@robthepcguy/rag-vault 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +441 -421
- package/dist/errors/index.d.ts +2 -6
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +8 -16
- package/dist/errors/index.js.map +1 -1
- package/dist/explainability/index.d.ts +2 -0
- package/dist/explainability/index.d.ts.map +1 -0
- package/dist/explainability/index.js +8 -0
- package/dist/explainability/index.js.map +1 -0
- package/dist/explainability/keywords.d.ts +18 -0
- package/dist/explainability/keywords.d.ts.map +1 -0
- package/dist/explainability/keywords.js +237 -0
- package/dist/explainability/keywords.js.map +1 -0
- package/dist/flywheel/feedback.d.ts +105 -0
- package/dist/flywheel/feedback.d.ts.map +1 -0
- package/dist/flywheel/feedback.js +219 -0
- package/dist/flywheel/feedback.js.map +1 -0
- package/dist/flywheel/index.d.ts +2 -0
- package/dist/flywheel/index.d.ts.map +1 -0
- package/dist/flywheel/index.js +9 -0
- package/dist/flywheel/index.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/server/index.d.ts +40 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +113 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/raw-data-utils.d.ts.map +1 -1
- package/dist/server/raw-data-utils.js.map +1 -1
- package/dist/utils/config.d.ts +15 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +84 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/math.d.ts +0 -7
- package/dist/utils/math.d.ts.map +1 -1
- package/dist/utils/math.js +0 -14
- package/dist/utils/math.js.map +1 -1
- package/dist/vectordb/index.d.ts +57 -2
- package/dist/vectordb/index.d.ts.map +1 -1
- package/dist/vectordb/index.js +255 -33
- package/dist/vectordb/index.js.map +1 -1
- package/dist/web/api-routes.d.ts.map +1 -1
- package/dist/web/api-routes.js +120 -7
- package/dist/web/api-routes.js.map +1 -1
- package/dist/web/config-routes.d.ts.map +1 -1
- package/dist/web/config-routes.js +84 -2
- package/dist/web/config-routes.js.map +1 -1
- package/dist/web/database-manager.d.ts +119 -1
- package/dist/web/database-manager.d.ts.map +1 -1
- package/dist/web/database-manager.js +339 -51
- package/dist/web/database-manager.js.map +1 -1
- package/dist/web/http-server.d.ts.map +1 -1
- package/dist/web/http-server.js +12 -2
- package/dist/web/http-server.js.map +1 -1
- package/dist/web/index.js +18 -10
- package/dist/web/index.js.map +1 -1
- package/dist/web/middleware/error-handler.d.ts +0 -16
- package/dist/web/middleware/error-handler.d.ts.map +1 -1
- package/dist/web/middleware/error-handler.js +0 -18
- package/dist/web/middleware/error-handler.js.map +1 -1
- package/dist/web/middleware/request-logger.d.ts +2 -1
- package/dist/web/middleware/request-logger.d.ts.map +1 -1
- package/package.json +129 -135
- package/skills/rag-vault/SKILL.md +111 -111
- package/web-ui/dist/assets/index-BcRp9-z9.js +120 -0
- package/web-ui/dist/assets/index-ej8i4PGl.css +1 -0
- package/web-ui/dist/index.html +14 -0
- package/web-ui/dist/vite.svg +3 -0
- package/dist/utils/logger.d.ts +0 -36
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -64
- package/dist/utils/logger.js.map +0 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
var Ik=Object.defineProperty;var vm=e=>{throw TypeError(e)};var Ak=(e,t,r)=>t in e?Ik(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var bm=(e,t,r)=>Ak(e,typeof t!="symbol"?t+"":t,r),Pu=(e,t,r)=>t.has(e)||vm("Cannot "+r);var I=(e,t,r)=>(Pu(e,t,"read from private field"),r?r.call(e):t.get(e)),fe=(e,t,r)=>t.has(e)?vm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ae=(e,t,r,i)=>(Pu(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r),je=(e,t,r)=>(Pu(e,t,"access private method"),r);var al=(e,t,r,i)=>({set _(l){ae(e,t,l,r)},get _(){return I(e,t,i)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();function Wd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tu={exports:{}},ya={},Ru={exports:{}},Ne={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var km;function Mk(){if(km)return Ne;km=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),v=Symbol.iterator;function b(L){return L===null||typeof L!="object"?null:(L=v&&L[v]||L["@@iterator"],typeof L=="function"?L:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},P=Object.assign,j={};function N(L,G,be){this.props=L,this.context=G,this.refs=j,this.updater=be||w}N.prototype.isReactComponent={},N.prototype.setState=function(L,G){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,G,"setState")},N.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function S(){}S.prototype=N.prototype;function T(L,G,be){this.props=L,this.context=G,this.refs=j,this.updater=be||w}var k=T.prototype=new S;k.constructor=T,P(k,N.prototype),k.isPureReactComponent=!0;var E=Array.isArray,R=Object.prototype.hasOwnProperty,M={current:null},H={key:!0,ref:!0,__self:!0,__source:!0};function B(L,G,be){var ge,ye={},we=null,Se=null;if(G!=null)for(ge in G.ref!==void 0&&(Se=G.ref),G.key!==void 0&&(we=""+G.key),G)R.call(G,ge)&&!H.hasOwnProperty(ge)&&(ye[ge]=G[ge]);var Ce=arguments.length-2;if(Ce===1)ye.children=be;else if(1<Ce){for(var Re=Array(Ce),et=0;et<Ce;et++)Re[et]=arguments[et+2];ye.children=Re}if(L&&L.defaultProps)for(ge in Ce=L.defaultProps,Ce)ye[ge]===void 0&&(ye[ge]=Ce[ge]);return{$$typeof:e,type:L,key:we,ref:Se,props:ye,_owner:M.current}}function te(L,G){return{$$typeof:e,type:L.type,key:G,ref:L.ref,props:L.props,_owner:L._owner}}function X(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function se(L){var G={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(be){return G[be]})}var ne=/\/+/g;function O(L,G){return typeof L=="object"&&L!==null&&L.key!=null?se(""+L.key):G.toString(36)}function _(L,G,be,ge,ye){var we=typeof L;(we==="undefined"||we==="boolean")&&(L=null);var Se=!1;if(L===null)Se=!0;else switch(we){case"string":case"number":Se=!0;break;case"object":switch(L.$$typeof){case e:case t:Se=!0}}if(Se)return Se=L,ye=ye(Se),L=ge===""?"."+O(Se,0):ge,E(ye)?(be="",L!=null&&(be=L.replace(ne,"$&/")+"/"),_(ye,G,be,"",function(et){return et})):ye!=null&&(X(ye)&&(ye=te(ye,be+(!ye.key||Se&&Se.key===ye.key?"":(""+ye.key).replace(ne,"$&/")+"/")+L)),G.push(ye)),1;if(Se=0,ge=ge===""?".":ge+":",E(L))for(var Ce=0;Ce<L.length;Ce++){we=L[Ce];var Re=ge+O(we,Ce);Se+=_(we,G,be,Re,ye)}else if(Re=b(L),typeof Re=="function")for(L=Re.call(L),Ce=0;!(we=L.next()).done;)we=we.value,Re=ge+O(we,Ce++),Se+=_(we,G,be,Re,ye);else if(we==="object")throw G=String(L),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return Se}function $(L,G,be){if(L==null)return L;var ge=[],ye=0;return _(L,ge,"","",function(we){return G.call(be,we,ye++)}),ge}function K(L){if(L._status===-1){var G=L._result;G=G(),G.then(function(be){(L._status===0||L._status===-1)&&(L._status=1,L._result=be)},function(be){(L._status===0||L._status===-1)&&(L._status=2,L._result=be)}),L._status===-1&&(L._status=0,L._result=G)}if(L._status===1)return L._result.default;throw L._result}var W={current:null},q={transition:null},Q={ReactCurrentDispatcher:W,ReactCurrentBatchConfig:q,ReactCurrentOwner:M};function J(){throw Error("act(...) is not supported in production builds of React.")}return Ne.Children={map:$,forEach:function(L,G,be){$(L,function(){G.apply(this,arguments)},be)},count:function(L){var G=0;return $(L,function(){G++}),G},toArray:function(L){return $(L,function(G){return G})||[]},only:function(L){if(!X(L))throw Error("React.Children.only expected to receive a single React element child.");return L}},Ne.Component=N,Ne.Fragment=r,Ne.Profiler=l,Ne.PureComponent=T,Ne.StrictMode=i,Ne.Suspense=h,Ne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,Ne.act=J,Ne.cloneElement=function(L,G,be){if(L==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+L+".");var ge=P({},L.props),ye=L.key,we=L.ref,Se=L._owner;if(G!=null){if(G.ref!==void 0&&(we=G.ref,Se=M.current),G.key!==void 0&&(ye=""+G.key),L.type&&L.type.defaultProps)var Ce=L.type.defaultProps;for(Re in G)R.call(G,Re)&&!H.hasOwnProperty(Re)&&(ge[Re]=G[Re]===void 0&&Ce!==void 0?Ce[Re]:G[Re])}var Re=arguments.length-2;if(Re===1)ge.children=be;else if(1<Re){Ce=Array(Re);for(var et=0;et<Re;et++)Ce[et]=arguments[et+2];ge.children=Ce}return{$$typeof:e,type:L.type,key:ye,ref:we,props:ge,_owner:Se}},Ne.createContext=function(L){return L={$$typeof:d,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},L.Provider={$$typeof:c,_context:L},L.Consumer=L},Ne.createElement=B,Ne.createFactory=function(L){var G=B.bind(null,L);return G.type=L,G},Ne.createRef=function(){return{current:null}},Ne.forwardRef=function(L){return{$$typeof:p,render:L}},Ne.isValidElement=X,Ne.lazy=function(L){return{$$typeof:x,_payload:{_status:-1,_result:L},_init:K}},Ne.memo=function(L,G){return{$$typeof:m,type:L,compare:G===void 0?null:G}},Ne.startTransition=function(L){var G=q.transition;q.transition={};try{L()}finally{q.transition=G}},Ne.unstable_act=J,Ne.useCallback=function(L,G){return W.current.useCallback(L,G)},Ne.useContext=function(L){return W.current.useContext(L)},Ne.useDebugValue=function(){},Ne.useDeferredValue=function(L){return W.current.useDeferredValue(L)},Ne.useEffect=function(L,G){return W.current.useEffect(L,G)},Ne.useId=function(){return W.current.useId()},Ne.useImperativeHandle=function(L,G,be){return W.current.useImperativeHandle(L,G,be)},Ne.useInsertionEffect=function(L,G){return W.current.useInsertionEffect(L,G)},Ne.useLayoutEffect=function(L,G){return W.current.useLayoutEffect(L,G)},Ne.useMemo=function(L,G){return W.current.useMemo(L,G)},Ne.useReducer=function(L,G,be){return W.current.useReducer(L,G,be)},Ne.useRef=function(L){return W.current.useRef(L)},Ne.useState=function(L){return W.current.useState(L)},Ne.useSyncExternalStore=function(L,G,be){return W.current.useSyncExternalStore(L,G,be)},Ne.useTransition=function(){return W.current.useTransition()},Ne.version="18.3.1",Ne}var wm;function Hd(){return wm||(wm=1,Ru.exports=Mk()),Ru.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var jm;function Ok(){if(jm)return ya;jm=1;var e=Hd(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(p,h,m){var x,v={},b=null,w=null;m!==void 0&&(b=""+m),h.key!==void 0&&(b=""+h.key),h.ref!==void 0&&(w=h.ref);for(x in h)i.call(h,x)&&!c.hasOwnProperty(x)&&(v[x]=h[x]);if(p&&p.defaultProps)for(x in h=p.defaultProps,h)v[x]===void 0&&(v[x]=h[x]);return{$$typeof:t,type:p,key:b,ref:w,props:v,_owner:l.current}}return ya.Fragment=r,ya.jsx=d,ya.jsxs=d,ya}var Sm;function Fk(){return Sm||(Sm=1,Tu.exports=Ok()),Tu.exports}var o=Fk(),Ri=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(){}},_k={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_r,Ud,$g,zk=($g=class{constructor(){fe(this,_r,_k);fe(this,Ud,!1)}setTimeoutProvider(e){ae(this,_r,e)}setTimeout(e,t){return I(this,_r).setTimeout(e,t)}clearTimeout(e){I(this,_r).clearTimeout(e)}setInterval(e,t){return I(this,_r).setInterval(e,t)}clearInterval(e){I(this,_r).clearInterval(e)}},_r=new WeakMap,Ud=new WeakMap,$g),js=new zk;function Vk(e){setTimeout(e,0)}var Ms=typeof window>"u"||"Deno"in globalThis;function Lt(){}function Bk(e,t){return typeof e=="function"?e(t):e}function rd(e){return typeof e=="number"&&e>=0&&e!==1/0}function Zg(e,t){return Math.max(e+(t||0)-Date.now(),0)}function qr(e,t){return typeof e=="function"?e(t):e}function cn(e,t){return typeof e=="function"?e(t):e}function Cm(e,t){const{type:r="all",exact:i,fetchStatus:l,predicate:c,queryKey:d,stale:p}=e;if(d){if(i){if(t.queryHash!==Kd(d,t.options))return!1}else if(!Da(t.queryKey,d))return!1}if(r!=="all"){const h=t.isActive();if(r==="active"&&!h||r==="inactive"&&h)return!1}return!(typeof p=="boolean"&&t.isStale()!==p||l&&l!==t.state.fetchStatus||c&&!c(t))}function Nm(e,t){const{exact:r,status:i,predicate:l,mutationKey:c}=e;if(c){if(!t.options.mutationKey)return!1;if(r){if(Os(t.options.mutationKey)!==Os(c))return!1}else if(!Da(t.options.mutationKey,c))return!1}return!(i&&t.state.status!==i||l&&!l(t))}function Kd(e,t){return((t==null?void 0:t.queryKeyHashFn)||Os)(e)}function Os(e){return JSON.stringify(e,(t,r)=>sd(r)?Object.keys(r).sort().reduce((i,l)=>(i[l]=r[l],i),{}):r)}function Da(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Da(e[r],t[r])):!1}var $k=Object.prototype.hasOwnProperty;function ex(e,t,r=0){if(e===t)return e;if(r>500)return t;const i=Em(e)&&Em(t);if(!i&&!(sd(e)&&sd(t)))return t;const c=(i?e:Object.keys(e)).length,d=i?t:Object.keys(t),p=d.length,h=i?new Array(p):{};let m=0;for(let x=0;x<p;x++){const v=i?x:d[x],b=e[v],w=t[v];if(b===w){h[v]=b,(i?x<c:$k.call(e,v))&&m++;continue}if(b===null||w===null||typeof b!="object"||typeof w!="object"){h[v]=w;continue}const P=ex(b,w,r+1);h[v]=P,P===b&&m++}return c===p&&m===c?e:h}function wl(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Em(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function sd(e){if(!Pm(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Pm(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Pm(e){return Object.prototype.toString.call(e)==="[object Object]"}function Uk(e){return new Promise(t=>{js.setTimeout(t,e)})}function id(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?ex(e,t):t}function Wk(e,t,r=0){const i=[...e,t];return r&&i.length>r?i.slice(1):i}function Hk(e,t,r=0){const i=[t,...e];return r&&i.length>r?i.slice(0,-1):i}var qd=Symbol();function tx(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===qd?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Qd(e,t){return typeof e=="function"?e(...t):!!e}function Kk(e,t,r){let i=!1,l;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(l??(l=t()),i||(i=!0,l.aborted?r():l.addEventListener("abort",r,{once:!0})),l)}),e}var Cs,zr,hi,Ug,qk=(Ug=class extends Ri{constructor(){super();fe(this,Cs);fe(this,zr);fe(this,hi);ae(this,hi,t=>{if(!Ms&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){I(this,zr)||this.setEventListener(I(this,hi))}onUnsubscribe(){var t;this.hasListeners()||((t=I(this,zr))==null||t.call(this),ae(this,zr,void 0))}setEventListener(t){var r;ae(this,hi,t),(r=I(this,zr))==null||r.call(this),ae(this,zr,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){I(this,Cs)!==t&&(ae(this,Cs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof I(this,Cs)=="boolean"?I(this,Cs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Cs=new WeakMap,zr=new WeakMap,hi=new WeakMap,Ug),Gd=new qk;function ad(){let e,t;const r=new Promise((l,c)=>{e=l,t=c});r.status="pending",r.catch(()=>{});function i(l){Object.assign(r,l),delete r.resolve,delete r.reject}return r.resolve=l=>{i({status:"fulfilled",value:l}),e(l)},r.reject=l=>{i({status:"rejected",reason:l}),t(l)},r}var Qk=Vk;function Gk(){let e=[],t=0,r=p=>{p()},i=p=>{p()},l=Qk;const c=p=>{t?e.push(p):l(()=>{r(p)})},d=()=>{const p=e;e=[],p.length&&l(()=>{i(()=>{p.forEach(h=>{r(h)})})})};return{batch:p=>{let h;t++;try{h=p()}finally{t--,t||d()}return h},batchCalls:p=>(...h)=>{c(()=>{p(...h)})},schedule:c,setNotifyFunction:p=>{r=p},setBatchNotifyFunction:p=>{i=p},setScheduler:p=>{l=p}}}var ct=Gk(),mi,Vr,gi,Wg,Yk=(Wg=class extends Ri{constructor(){super();fe(this,mi,!0);fe(this,Vr);fe(this,gi);ae(this,gi,t=>{if(!Ms&&window.addEventListener){const r=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}}})}onSubscribe(){I(this,Vr)||this.setEventListener(I(this,gi))}onUnsubscribe(){var t;this.hasListeners()||((t=I(this,Vr))==null||t.call(this),ae(this,Vr,void 0))}setEventListener(t){var r;ae(this,gi,t),(r=I(this,Vr))==null||r.call(this),ae(this,Vr,t(this.setOnline.bind(this)))}setOnline(t){I(this,mi)!==t&&(ae(this,mi,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return I(this,mi)}},mi=new WeakMap,Vr=new WeakMap,gi=new WeakMap,Wg),jl=new Yk;function Xk(e){return Math.min(1e3*2**e,3e4)}function nx(e){return(e??"online")==="online"?jl.isOnline():!0}var od=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function rx(e){let t=!1,r=0,i;const l=ad(),c=()=>l.status!=="pending",d=j=>{var N;if(!c()){const S=new od(j);b(S),(N=e.onCancel)==null||N.call(e,S)}},p=()=>{t=!0},h=()=>{t=!1},m=()=>Gd.isFocused()&&(e.networkMode==="always"||jl.isOnline())&&e.canRun(),x=()=>nx(e.networkMode)&&e.canRun(),v=j=>{c()||(i==null||i(),l.resolve(j))},b=j=>{c()||(i==null||i(),l.reject(j))},w=()=>new Promise(j=>{var N;i=S=>{(c()||m())&&j(S)},(N=e.onPause)==null||N.call(e)}).then(()=>{var j;i=void 0,c()||(j=e.onContinue)==null||j.call(e)}),P=()=>{if(c())return;let j;const N=r===0?e.initialPromise:void 0;try{j=N??e.fn()}catch(S){j=Promise.reject(S)}Promise.resolve(j).then(v).catch(S=>{var M;if(c())return;const T=e.retry??(Ms?0:3),k=e.retryDelay??Xk,E=typeof k=="function"?k(r,S):k,R=T===!0||typeof T=="number"&&r<T||typeof T=="function"&&T(r,S);if(t||!R){b(S);return}r++,(M=e.onFail)==null||M.call(e,r,S),Uk(E).then(()=>m()?void 0:w()).then(()=>{t?b(S):P()})})};return{promise:l,status:()=>l.status,cancel:d,continue:()=>(i==null||i(),l),cancelRetry:p,continueRetry:h,canStart:x,start:()=>(x()?P():w().then(P),l)}}var Ns,Hg,sx=(Hg=class{constructor(){fe(this,Ns)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),rd(this.gcTime)&&ae(this,Ns,js.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ms?1/0:300*1e3))}clearGcTimeout(){I(this,Ns)&&(js.clearTimeout(I(this,Ns)),ae(this,Ns,void 0))}},Ns=new WeakMap,Hg),Es,xi,ln,Ps,ht,za,Ts,jn,er,Kg,Jk=(Kg=class extends sx{constructor(t){super();fe(this,jn);fe(this,Es);fe(this,xi);fe(this,ln);fe(this,Ps);fe(this,ht);fe(this,za);fe(this,Ts);ae(this,Ts,!1),ae(this,za,t.defaultOptions),this.setOptions(t.options),this.observers=[],ae(this,Ps,t.client),ae(this,ln,I(this,Ps).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ae(this,Es,Rm(this.options)),this.state=t.state??I(this,Es),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=I(this,ht))==null?void 0:t.promise}setOptions(t){if(this.options={...I(this,za),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Rm(this.options);r.data!==void 0&&(this.setState(Tm(r.data,r.dataUpdatedAt)),ae(this,Es,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&I(this,ln).remove(this)}setData(t,r){const i=id(this.state.data,t,this.options);return je(this,jn,er).call(this,{data:i,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),i}setState(t,r){je(this,jn,er).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var i,l;const r=(i=I(this,ht))==null?void 0:i.promise;return(l=I(this,ht))==null||l.cancel(t),r?r.then(Lt).catch(Lt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(I(this,Es))}isActive(){return this.observers.some(t=>cn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qd||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>qr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Zg(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(i=>i.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=I(this,ht))==null||r.continue()}onOnline(){var r;const t=this.observers.find(i=>i.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=I(this,ht))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),I(this,ln).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(I(this,ht)&&(I(this,Ts)?I(this,ht).cancel({revert:!0}):I(this,ht).cancelRetry()),this.scheduleGc()),I(this,ln).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||je(this,jn,er).call(this,{type:"invalidate"})}async fetch(t,r){var h,m,x,v,b,w,P,j,N,S,T,k;if(this.state.fetchStatus!=="idle"&&((h=I(this,ht))==null?void 0:h.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(I(this,ht))return I(this,ht).continueRetry(),I(this,ht).promise}if(t&&this.setOptions(t),!this.options.queryFn){const E=this.observers.find(R=>R.options.queryFn);E&&this.setOptions(E.options)}const i=new AbortController,l=E=>{Object.defineProperty(E,"signal",{enumerable:!0,get:()=>(ae(this,Ts,!0),i.signal)})},c=()=>{const E=tx(this.options,r),M=(()=>{const H={client:I(this,Ps),queryKey:this.queryKey,meta:this.meta};return l(H),H})();return ae(this,Ts,!1),this.options.persister?this.options.persister(E,M,this):E(M)},p=(()=>{const E={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:I(this,Ps),state:this.state,fetchFn:c};return l(E),E})();(m=this.options.behavior)==null||m.onFetch(p,this),ae(this,xi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=p.fetchOptions)==null?void 0:x.meta))&&je(this,jn,er).call(this,{type:"fetch",meta:(v=p.fetchOptions)==null?void 0:v.meta}),ae(this,ht,rx({initialPromise:r==null?void 0:r.initialPromise,fn:p.fetchFn,onCancel:E=>{E instanceof od&&E.revert&&this.setState({...I(this,xi),fetchStatus:"idle"}),i.abort()},onFail:(E,R)=>{je(this,jn,er).call(this,{type:"failed",failureCount:E,error:R})},onPause:()=>{je(this,jn,er).call(this,{type:"pause"})},onContinue:()=>{je(this,jn,er).call(this,{type:"continue"})},retry:p.options.retry,retryDelay:p.options.retryDelay,networkMode:p.options.networkMode,canRun:()=>!0}));try{const E=await I(this,ht).start();if(E===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(E),(w=(b=I(this,ln).config).onSuccess)==null||w.call(b,E,this),(j=(P=I(this,ln).config).onSettled)==null||j.call(P,E,this.state.error,this),E}catch(E){if(E instanceof od){if(E.silent)return I(this,ht).promise;if(E.revert){if(this.state.data===void 0)throw E;return this.state.data}}throw je(this,jn,er).call(this,{type:"error",error:E}),(S=(N=I(this,ln).config).onError)==null||S.call(N,E,this),(k=(T=I(this,ln).config).onSettled)==null||k.call(T,this.state.data,E,this),E}finally{this.scheduleGc()}}},Es=new WeakMap,xi=new WeakMap,ln=new WeakMap,Ps=new WeakMap,ht=new WeakMap,za=new WeakMap,Ts=new WeakMap,jn=new WeakSet,er=function(t){const r=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...ix(i.data,this.options),fetchMeta:t.meta??null};case"success":const l={...i,...Tm(t.data,t.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ae(this,xi,t.manual?l:void 0),l;case"error":const c=t.error;return{...i,error:c,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:c,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=r(this.state),ct.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),I(this,ln).notify({query:this,type:"updated",action:t})})},Kg);function ix(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:nx(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Tm(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Rm(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,i=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Bt,Ee,Va,Dt,Rs,yi,tr,Br,Ba,vi,bi,Ds,Ls,$r,ki,Le,ja,ld,cd,ud,dd,pd,fd,hd,ax,qg,Zk=(qg=class extends Ri{constructor(t,r){super();fe(this,Le);fe(this,Bt);fe(this,Ee);fe(this,Va);fe(this,Dt);fe(this,Rs);fe(this,yi);fe(this,tr);fe(this,Br);fe(this,Ba);fe(this,vi);fe(this,bi);fe(this,Ds);fe(this,Ls);fe(this,$r);fe(this,ki,new Set);this.options=r,ae(this,Bt,t),ae(this,Br,null),ae(this,tr,ad()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(I(this,Ee).addObserver(this),Dm(I(this,Ee),this.options)?je(this,Le,ja).call(this):this.updateResult(),je(this,Le,dd).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return md(I(this,Ee),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return md(I(this,Ee),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,je(this,Le,pd).call(this),je(this,Le,fd).call(this),I(this,Ee).removeObserver(this)}setOptions(t){const r=this.options,i=I(this,Ee);if(this.options=I(this,Bt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof cn(this.options.enabled,I(this,Ee))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");je(this,Le,hd).call(this),I(this,Ee).setOptions(this.options),r._defaulted&&!wl(this.options,r)&&I(this,Bt).getQueryCache().notify({type:"observerOptionsUpdated",query:I(this,Ee),observer:this});const l=this.hasListeners();l&&Lm(I(this,Ee),i,this.options,r)&&je(this,Le,ja).call(this),this.updateResult(),l&&(I(this,Ee)!==i||cn(this.options.enabled,I(this,Ee))!==cn(r.enabled,I(this,Ee))||qr(this.options.staleTime,I(this,Ee))!==qr(r.staleTime,I(this,Ee)))&&je(this,Le,ld).call(this);const c=je(this,Le,cd).call(this);l&&(I(this,Ee)!==i||cn(this.options.enabled,I(this,Ee))!==cn(r.enabled,I(this,Ee))||c!==I(this,$r))&&je(this,Le,ud).call(this,c)}getOptimisticResult(t){const r=I(this,Bt).getQueryCache().build(I(this,Bt),t),i=this.createResult(r,t);return tw(this,i)&&(ae(this,Dt,i),ae(this,yi,this.options),ae(this,Rs,I(this,Ee).state)),i}getCurrentResult(){return I(this,Dt)}trackResult(t,r){return new Proxy(t,{get:(i,l)=>(this.trackProp(l),r==null||r(l),l==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&I(this,tr).status==="pending"&&I(this,tr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,l))})}trackProp(t){I(this,ki).add(t)}getCurrentQuery(){return I(this,Ee)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=I(this,Bt).defaultQueryOptions(t),i=I(this,Bt).getQueryCache().build(I(this,Bt),r);return i.fetch().then(()=>this.createResult(i,r))}fetch(t){return je(this,Le,ja).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),I(this,Dt)))}createResult(t,r){var te;const i=I(this,Ee),l=this.options,c=I(this,Dt),d=I(this,Rs),p=I(this,yi),m=t!==i?t.state:I(this,Va),{state:x}=t;let v={...x},b=!1,w;if(r._optimisticResults){const X=this.hasListeners(),se=!X&&Dm(t,r),ne=X&&Lm(t,i,r,l);(se||ne)&&(v={...v,...ix(x.data,t.options)}),r._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:P,errorUpdatedAt:j,status:N}=v;w=v.data;let S=!1;if(r.placeholderData!==void 0&&w===void 0&&N==="pending"){let X;c!=null&&c.isPlaceholderData&&r.placeholderData===(p==null?void 0:p.placeholderData)?(X=c.data,S=!0):X=typeof r.placeholderData=="function"?r.placeholderData((te=I(this,bi))==null?void 0:te.state.data,I(this,bi)):r.placeholderData,X!==void 0&&(N="success",w=id(c==null?void 0:c.data,X,r),b=!0)}if(r.select&&w!==void 0&&!S)if(c&&w===(d==null?void 0:d.data)&&r.select===I(this,Ba))w=I(this,vi);else try{ae(this,Ba,r.select),w=r.select(w),w=id(c==null?void 0:c.data,w,r),ae(this,vi,w),ae(this,Br,null)}catch(X){ae(this,Br,X)}I(this,Br)&&(P=I(this,Br),w=I(this,vi),j=Date.now(),N="error");const T=v.fetchStatus==="fetching",k=N==="pending",E=N==="error",R=k&&T,M=w!==void 0,B={status:N,fetchStatus:v.fetchStatus,isPending:k,isSuccess:N==="success",isError:E,isInitialLoading:R,isLoading:R,data:w,dataUpdatedAt:v.dataUpdatedAt,error:P,errorUpdatedAt:j,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:v.dataUpdateCount>0||v.errorUpdateCount>0,isFetchedAfterMount:v.dataUpdateCount>m.dataUpdateCount||v.errorUpdateCount>m.errorUpdateCount,isFetching:T,isRefetching:T&&!k,isLoadingError:E&&!M,isPaused:v.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:E&&M,isStale:Yd(t,r),refetch:this.refetch,promise:I(this,tr),isEnabled:cn(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const X=B.data!==void 0,se=B.status==="error"&&!X,ne=$=>{se?$.reject(B.error):X&&$.resolve(B.data)},O=()=>{const $=ae(this,tr,B.promise=ad());ne($)},_=I(this,tr);switch(_.status){case"pending":t.queryHash===i.queryHash&&ne(_);break;case"fulfilled":(se||B.data!==_.value)&&O();break;case"rejected":(!se||B.error!==_.reason)&&O();break}}return B}updateResult(){const t=I(this,Dt),r=this.createResult(I(this,Ee),this.options);if(ae(this,Rs,I(this,Ee).state),ae(this,yi,this.options),I(this,Rs).data!==void 0&&ae(this,bi,I(this,Ee)),wl(r,t))return;ae(this,Dt,r);const i=()=>{if(!t)return!0;const{notifyOnChangeProps:l}=this.options,c=typeof l=="function"?l():l;if(c==="all"||!c&&!I(this,ki).size)return!0;const d=new Set(c??I(this,ki));return this.options.throwOnError&&d.add("error"),Object.keys(I(this,Dt)).some(p=>{const h=p;return I(this,Dt)[h]!==t[h]&&d.has(h)})};je(this,Le,ax).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&je(this,Le,dd).call(this)}},Bt=new WeakMap,Ee=new WeakMap,Va=new WeakMap,Dt=new WeakMap,Rs=new WeakMap,yi=new WeakMap,tr=new WeakMap,Br=new WeakMap,Ba=new WeakMap,vi=new WeakMap,bi=new WeakMap,Ds=new WeakMap,Ls=new WeakMap,$r=new WeakMap,ki=new WeakMap,Le=new WeakSet,ja=function(t){je(this,Le,hd).call(this);let r=I(this,Ee).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Lt)),r},ld=function(){je(this,Le,pd).call(this);const t=qr(this.options.staleTime,I(this,Ee));if(Ms||I(this,Dt).isStale||!rd(t))return;const i=Zg(I(this,Dt).dataUpdatedAt,t)+1;ae(this,Ds,js.setTimeout(()=>{I(this,Dt).isStale||this.updateResult()},i))},cd=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(I(this,Ee)):this.options.refetchInterval)??!1},ud=function(t){je(this,Le,fd).call(this),ae(this,$r,t),!(Ms||cn(this.options.enabled,I(this,Ee))===!1||!rd(I(this,$r))||I(this,$r)===0)&&ae(this,Ls,js.setInterval(()=>{(this.options.refetchIntervalInBackground||Gd.isFocused())&&je(this,Le,ja).call(this)},I(this,$r)))},dd=function(){je(this,Le,ld).call(this),je(this,Le,ud).call(this,je(this,Le,cd).call(this))},pd=function(){I(this,Ds)&&(js.clearTimeout(I(this,Ds)),ae(this,Ds,void 0))},fd=function(){I(this,Ls)&&(js.clearInterval(I(this,Ls)),ae(this,Ls,void 0))},hd=function(){const t=I(this,Bt).getQueryCache().build(I(this,Bt),this.options);if(t===I(this,Ee))return;const r=I(this,Ee);ae(this,Ee,t),ae(this,Va,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},ax=function(t){ct.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(I(this,Dt))}),I(this,Bt).getQueryCache().notify({query:I(this,Ee),type:"observerResultsUpdated"})})},qg);function ew(e,t){return cn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Dm(e,t){return ew(e,t)||e.state.data!==void 0&&md(e,t,t.refetchOnMount)}function md(e,t,r){if(cn(t.enabled,e)!==!1&&qr(t.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&Yd(e,t)}return!1}function Lm(e,t,r,i){return(e!==t||cn(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Yd(e,r)}function Yd(e,t){return cn(t.enabled,e)!==!1&&e.isStaleByTime(qr(t.staleTime,e))}function tw(e,t){return!wl(e.getCurrentResult(),t)}function Im(e){return{onFetch:(t,r)=>{var x,v,b,w,P;const i=t.options,l=(b=(v=(x=t.fetchOptions)==null?void 0:x.meta)==null?void 0:v.fetchMore)==null?void 0:b.direction,c=((w=t.state.data)==null?void 0:w.pages)||[],d=((P=t.state.data)==null?void 0:P.pageParams)||[];let p={pages:[],pageParams:[]},h=0;const m=async()=>{let j=!1;const N=k=>{Kk(k,()=>t.signal,()=>j=!0)},S=tx(t.options,t.fetchOptions),T=async(k,E,R)=>{if(j)return Promise.reject();if(E==null&&k.pages.length)return Promise.resolve(k);const H=(()=>{const se={client:t.client,queryKey:t.queryKey,pageParam:E,direction:R?"backward":"forward",meta:t.options.meta};return N(se),se})(),B=await S(H),{maxPages:te}=t.options,X=R?Hk:Wk;return{pages:X(k.pages,B,te),pageParams:X(k.pageParams,E,te)}};if(l&&c.length){const k=l==="backward",E=k?nw:Am,R={pages:c,pageParams:d},M=E(i,R);p=await T(R,M,k)}else{const k=e??c.length;do{const E=h===0?d[0]??i.initialPageParam:Am(i,p);if(h>0&&E==null)break;p=await T(p,E),h++}while(h<k)}return p};t.options.persister?t.fetchFn=()=>{var j,N;return(N=(j=t.options).persister)==null?void 0:N.call(j,m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=m}}}function Am(e,{pages:t,pageParams:r}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,r[i],r):void 0}function nw(e,{pages:t,pageParams:r}){var i;return t.length>0?(i=e.getPreviousPageParam)==null?void 0:i.call(e,t[0],t,r[0],r):void 0}var $a,On,Ct,Is,Fn,Mr,Qg,rw=(Qg=class extends sx{constructor(t){super();fe(this,Fn);fe(this,$a);fe(this,On);fe(this,Ct);fe(this,Is);ae(this,$a,t.client),this.mutationId=t.mutationId,ae(this,Ct,t.mutationCache),ae(this,On,[]),this.state=t.state||ox(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){I(this,On).includes(t)||(I(this,On).push(t),this.clearGcTimeout(),I(this,Ct).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ae(this,On,I(this,On).filter(r=>r!==t)),this.scheduleGc(),I(this,Ct).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){I(this,On).length||(this.state.status==="pending"?this.scheduleGc():I(this,Ct).remove(this))}continue(){var t;return((t=I(this,Is))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var d,p,h,m,x,v,b,w,P,j,N,S,T,k,E,R,M,H;const r=()=>{je(this,Fn,Mr).call(this,{type:"continue"})},i={client:I(this,$a),meta:this.options.meta,mutationKey:this.options.mutationKey};ae(this,Is,rx({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(B,te)=>{je(this,Fn,Mr).call(this,{type:"failed",failureCount:B,error:te})},onPause:()=>{je(this,Fn,Mr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>I(this,Ct).canRun(this)}));const l=this.state.status==="pending",c=!I(this,Is).canStart();try{if(l)r();else{je(this,Fn,Mr).call(this,{type:"pending",variables:t,isPaused:c}),I(this,Ct).config.onMutate&&await I(this,Ct).config.onMutate(t,this,i);const te=await((p=(d=this.options).onMutate)==null?void 0:p.call(d,t,i));te!==this.state.context&&je(this,Fn,Mr).call(this,{type:"pending",context:te,variables:t,isPaused:c})}const B=await I(this,Is).start();return await((m=(h=I(this,Ct).config).onSuccess)==null?void 0:m.call(h,B,t,this.state.context,this,i)),await((v=(x=this.options).onSuccess)==null?void 0:v.call(x,B,t,this.state.context,i)),await((w=(b=I(this,Ct).config).onSettled)==null?void 0:w.call(b,B,null,this.state.variables,this.state.context,this,i)),await((j=(P=this.options).onSettled)==null?void 0:j.call(P,B,null,t,this.state.context,i)),je(this,Fn,Mr).call(this,{type:"success",data:B}),B}catch(B){try{await((S=(N=I(this,Ct).config).onError)==null?void 0:S.call(N,B,t,this.state.context,this,i))}catch(te){Promise.reject(te)}try{await((k=(T=this.options).onError)==null?void 0:k.call(T,B,t,this.state.context,i))}catch(te){Promise.reject(te)}try{await((R=(E=I(this,Ct).config).onSettled)==null?void 0:R.call(E,void 0,B,this.state.variables,this.state.context,this,i))}catch(te){Promise.reject(te)}try{await((H=(M=this.options).onSettled)==null?void 0:H.call(M,void 0,B,t,this.state.context,i))}catch(te){Promise.reject(te)}throw je(this,Fn,Mr).call(this,{type:"error",error:B}),B}finally{I(this,Ct).runNext(this)}}},$a=new WeakMap,On=new WeakMap,Ct=new WeakMap,Is=new WeakMap,Fn=new WeakSet,Mr=function(t){const r=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),ct.batch(()=>{I(this,On).forEach(i=>{i.onMutationUpdate(t)}),I(this,Ct).notify({mutation:this,type:"updated",action:t})})},Qg);function ox(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var nr,Sn,Ua,Gg,sw=(Gg=class extends Ri{constructor(t={}){super();fe(this,nr);fe(this,Sn);fe(this,Ua);this.config=t,ae(this,nr,new Set),ae(this,Sn,new Map),ae(this,Ua,0)}build(t,r,i){const l=new rw({client:t,mutationCache:this,mutationId:++al(this,Ua)._,options:t.defaultMutationOptions(r),state:i});return this.add(l),l}add(t){I(this,nr).add(t);const r=ol(t);if(typeof r=="string"){const i=I(this,Sn).get(r);i?i.push(t):I(this,Sn).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(I(this,nr).delete(t)){const r=ol(t);if(typeof r=="string"){const i=I(this,Sn).get(r);if(i)if(i.length>1){const l=i.indexOf(t);l!==-1&&i.splice(l,1)}else i[0]===t&&I(this,Sn).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=ol(t);if(typeof r=="string"){const i=I(this,Sn).get(r),l=i==null?void 0:i.find(c=>c.state.status==="pending");return!l||l===t}else return!0}runNext(t){var i;const r=ol(t);if(typeof r=="string"){const l=(i=I(this,Sn).get(r))==null?void 0:i.find(c=>c!==t&&c.state.isPaused);return(l==null?void 0:l.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ct.batch(()=>{I(this,nr).forEach(t=>{this.notify({type:"removed",mutation:t})}),I(this,nr).clear(),I(this,Sn).clear()})}getAll(){return Array.from(I(this,nr))}find(t){const r={exact:!0,...t};return this.getAll().find(i=>Nm(r,i))}findAll(t={}){return this.getAll().filter(r=>Nm(t,r))}notify(t){ct.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return ct.batch(()=>Promise.all(t.map(r=>r.continue().catch(Lt))))}},nr=new WeakMap,Sn=new WeakMap,Ua=new WeakMap,Gg);function ol(e){var t;return(t=e.options.scope)==null?void 0:t.id}var rr,Ur,$t,sr,lr,gl,gd,Yg,iw=(Yg=class extends Ri{constructor(r,i){super();fe(this,lr);fe(this,rr);fe(this,Ur);fe(this,$t);fe(this,sr);ae(this,rr,r),this.setOptions(i),this.bindMethods(),je(this,lr,gl).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var l;const i=this.options;this.options=I(this,rr).defaultMutationOptions(r),wl(this.options,i)||I(this,rr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:I(this,$t),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&Os(i.mutationKey)!==Os(this.options.mutationKey)?this.reset():((l=I(this,$t))==null?void 0:l.state.status)==="pending"&&I(this,$t).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=I(this,$t))==null||r.removeObserver(this)}onMutationUpdate(r){je(this,lr,gl).call(this),je(this,lr,gd).call(this,r)}getCurrentResult(){return I(this,Ur)}reset(){var r;(r=I(this,$t))==null||r.removeObserver(this),ae(this,$t,void 0),je(this,lr,gl).call(this),je(this,lr,gd).call(this)}mutate(r,i){var l;return ae(this,sr,i),(l=I(this,$t))==null||l.removeObserver(this),ae(this,$t,I(this,rr).getMutationCache().build(I(this,rr),this.options)),I(this,$t).addObserver(this),I(this,$t).execute(r)}},rr=new WeakMap,Ur=new WeakMap,$t=new WeakMap,sr=new WeakMap,lr=new WeakSet,gl=function(){var i;const r=((i=I(this,$t))==null?void 0:i.state)??ox();ae(this,Ur,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},gd=function(r){ct.batch(()=>{var i,l,c,d,p,h,m,x;if(I(this,sr)&&this.hasListeners()){const v=I(this,Ur).variables,b=I(this,Ur).context,w={client:I(this,rr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(l=(i=I(this,sr)).onSuccess)==null||l.call(i,r.data,v,b,w)}catch(P){Promise.reject(P)}try{(d=(c=I(this,sr)).onSettled)==null||d.call(c,r.data,null,v,b,w)}catch(P){Promise.reject(P)}}else if((r==null?void 0:r.type)==="error"){try{(h=(p=I(this,sr)).onError)==null||h.call(p,r.error,v,b,w)}catch(P){Promise.reject(P)}try{(x=(m=I(this,sr)).onSettled)==null||x.call(m,void 0,r.error,v,b,w)}catch(P){Promise.reject(P)}}}this.listeners.forEach(v=>{v(I(this,Ur))})})},Yg),_n,Xg,aw=(Xg=class extends Ri{constructor(t={}){super();fe(this,_n);this.config=t,ae(this,_n,new Map)}build(t,r,i){const l=r.queryKey,c=r.queryHash??Kd(l,r);let d=this.get(c);return d||(d=new Jk({client:t,queryKey:l,queryHash:c,options:t.defaultQueryOptions(r),state:i,defaultOptions:t.getQueryDefaults(l)}),this.add(d)),d}add(t){I(this,_n).has(t.queryHash)||(I(this,_n).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=I(this,_n).get(t.queryHash);r&&(t.destroy(),r===t&&I(this,_n).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ct.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return I(this,_n).get(t)}getAll(){return[...I(this,_n).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(i=>Cm(r,i))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(i=>Cm(t,i)):r}notify(t){ct.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){ct.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ct.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},_n=new WeakMap,Xg),Je,Wr,Hr,wi,ji,Kr,Si,Ci,Jg,ow=(Jg=class{constructor(e={}){fe(this,Je);fe(this,Wr);fe(this,Hr);fe(this,wi);fe(this,ji);fe(this,Kr);fe(this,Si);fe(this,Ci);ae(this,Je,e.queryCache||new aw),ae(this,Wr,e.mutationCache||new sw),ae(this,Hr,e.defaultOptions||{}),ae(this,wi,new Map),ae(this,ji,new Map),ae(this,Kr,0)}mount(){al(this,Kr)._++,I(this,Kr)===1&&(ae(this,Si,Gd.subscribe(async e=>{e&&(await this.resumePausedMutations(),I(this,Je).onFocus())})),ae(this,Ci,jl.subscribe(async e=>{e&&(await this.resumePausedMutations(),I(this,Je).onOnline())})))}unmount(){var e,t;al(this,Kr)._--,I(this,Kr)===0&&((e=I(this,Si))==null||e.call(this),ae(this,Si,void 0),(t=I(this,Ci))==null||t.call(this),ae(this,Ci,void 0))}isFetching(e){return I(this,Je).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return I(this,Wr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=I(this,Je).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=I(this,Je).build(this,t),i=r.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(qr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return I(this,Je).findAll(e).map(({queryKey:t,state:r})=>{const i=r.data;return[t,i]})}setQueryData(e,t,r){const i=this.defaultQueryOptions({queryKey:e}),l=I(this,Je).get(i.queryHash),c=l==null?void 0:l.state.data,d=Bk(t,c);if(d!==void 0)return I(this,Je).build(this,i).setData(d,{...r,manual:!0})}setQueriesData(e,t,r){return ct.batch(()=>I(this,Je).findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=I(this,Je).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=I(this,Je);ct.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=I(this,Je);return ct.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},i=ct.batch(()=>I(this,Je).findAll(e).map(l=>l.cancel(r)));return Promise.all(i).then(Lt).catch(Lt)}invalidateQueries(e,t={}){return ct.batch(()=>(I(this,Je).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},i=ct.batch(()=>I(this,Je).findAll(e).filter(l=>!l.isDisabled()&&!l.isStatic()).map(l=>{let c=l.fetch(void 0,r);return r.throwOnError||(c=c.catch(Lt)),l.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(i).then(Lt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=I(this,Je).build(this,t);return r.isStaleByTime(qr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Lt).catch(Lt)}fetchInfiniteQuery(e){return e.behavior=Im(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Lt).catch(Lt)}ensureInfiniteQueryData(e){return e.behavior=Im(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return jl.isOnline()?I(this,Wr).resumePausedMutations():Promise.resolve()}getQueryCache(){return I(this,Je)}getMutationCache(){return I(this,Wr)}getDefaultOptions(){return I(this,Hr)}setDefaultOptions(e){ae(this,Hr,e)}setQueryDefaults(e,t){I(this,wi).set(Os(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...I(this,wi).values()],r={};return t.forEach(i=>{Da(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,t){I(this,ji).set(Os(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...I(this,ji).values()],r={};return t.forEach(i=>{Da(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...I(this,Hr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Kd(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===qd&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...I(this,Hr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){I(this,Je).clear(),I(this,Wr).clear()}},Je=new WeakMap,Wr=new WeakMap,Hr=new WeakMap,wi=new WeakMap,ji=new WeakMap,Kr=new WeakMap,Si=new WeakMap,Ci=new WeakMap,Jg),y=Hd();const lw=Wd(y);var lx=y.createContext(void 0),En=e=>{const t=y.useContext(lx);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},cw=({client:e,children:t})=>(y.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(lx.Provider,{value:e,children:t})),cx=y.createContext(!1),uw=()=>y.useContext(cx);cx.Provider;function dw(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pw=y.createContext(dw()),fw=()=>y.useContext(pw),hw=(e,t,r)=>{const i=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Qd(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(t.isReset()||(e.retryOnMount=!1))},mw=e=>{y.useEffect(()=>{e.clearReset()},[e])},gw=({result:e,errorResetBoundary:t,throwOnError:r,query:i,suspense:l})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(l&&e.data===void 0||Qd(r,[e.error,i])),xw=e=>{if(e.suspense){const r=l=>l==="static"?l:Math.max(l??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...l)=>r(i(...l)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},yw=(e,t)=>e.isLoading&&e.isFetching&&!t,vw=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Mm=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function bw(e,t,r){var b,w,P,j;const i=uw(),l=fw(),c=En(),d=c.defaultQueryOptions(e);(w=(b=c.getDefaultOptions().queries)==null?void 0:b._experimental_beforeQuery)==null||w.call(b,d);const p=c.getQueryCache().get(d.queryHash);d._optimisticResults=i?"isRestoring":"optimistic",xw(d),hw(d,l,p),mw(l);const h=!c.getQueryCache().get(d.queryHash),[m]=y.useState(()=>new t(c,d)),x=m.getOptimisticResult(d),v=!i&&e.subscribed!==!1;if(y.useSyncExternalStore(y.useCallback(N=>{const S=v?m.subscribe(ct.batchCalls(N)):Lt;return m.updateResult(),S},[m,v]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),y.useEffect(()=>{m.setOptions(d)},[d,m]),vw(d,x))throw Mm(d,m,l);if(gw({result:x,errorResetBoundary:l,throwOnError:d.throwOnError,query:p,suspense:d.suspense}))throw x.error;if((j=(P=c.getDefaultOptions().queries)==null?void 0:P._experimental_afterQuery)==null||j.call(P,d,x),d.experimental_prefetchInRender&&!Ms&&yw(x,i)){const N=h?Mm(d,m,l):p==null?void 0:p.promise;N==null||N.catch(Lt).finally(()=>{m.updateResult()})}return d.notifyOnChangeProps?x:m.trackResult(x)}function dr(e,t){return bw(e,Zk)}function Ut(e,t){const r=En(),[i]=y.useState(()=>new iw(r,e));y.useEffect(()=>{i.setOptions(e)},[i,e]);const l=y.useSyncExternalStore(y.useCallback(d=>i.subscribe(ct.batchCalls(d)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),c=y.useCallback((d,p)=>{i.mutate(d,p).catch(Lt)},[i]);if(l.error&&Qd(i.options.throwOnError,[l.error]))throw l.error;return{...l,mutate:c,mutateAsync:l.mutate}}var ll={},Du={exports:{}},Vt={},Lu={exports:{}},Iu={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var Om;function kw(){return Om||(Om=1,(function(e){function t(q,Q){var J=q.length;q.push(Q);e:for(;0<J;){var L=J-1>>>1,G=q[L];if(0<l(G,Q))q[L]=Q,q[J]=G,J=L;else break e}}function r(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var Q=q[0],J=q.pop();if(J!==Q){q[0]=J;e:for(var L=0,G=q.length,be=G>>>1;L<be;){var ge=2*(L+1)-1,ye=q[ge],we=ge+1,Se=q[we];if(0>l(ye,J))we<G&&0>l(Se,ye)?(q[L]=Se,q[we]=J,L=we):(q[L]=ye,q[ge]=J,L=ge);else if(we<G&&0>l(Se,J))q[L]=Se,q[we]=J,L=we;else break e}}return Q}function l(q,Q){var J=q.sortIndex-Q.sortIndex;return J!==0?J:q.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var h=[],m=[],x=1,v=null,b=3,w=!1,P=!1,j=!1,N=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(q){for(var Q=r(m);Q!==null;){if(Q.callback===null)i(m);else if(Q.startTime<=q)i(m),Q.sortIndex=Q.expirationTime,t(h,Q);else break;Q=r(m)}}function E(q){if(j=!1,k(q),!P)if(r(h)!==null)P=!0,K(R);else{var Q=r(m);Q!==null&&W(E,Q.startTime-q)}}function R(q,Q){P=!1,j&&(j=!1,S(B),B=-1),w=!0;var J=b;try{for(k(Q),v=r(h);v!==null&&(!(v.expirationTime>Q)||q&&!se());){var L=v.callback;if(typeof L=="function"){v.callback=null,b=v.priorityLevel;var G=L(v.expirationTime<=Q);Q=e.unstable_now(),typeof G=="function"?v.callback=G:v===r(h)&&i(h),k(Q)}else i(h);v=r(h)}if(v!==null)var be=!0;else{var ge=r(m);ge!==null&&W(E,ge.startTime-Q),be=!1}return be}finally{v=null,b=J,w=!1}}var M=!1,H=null,B=-1,te=5,X=-1;function se(){return!(e.unstable_now()-X<te)}function ne(){if(H!==null){var q=e.unstable_now();X=q;var Q=!0;try{Q=H(!0,q)}finally{Q?O():(M=!1,H=null)}}else M=!1}var O;if(typeof T=="function")O=function(){T(ne)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,$=_.port2;_.port1.onmessage=ne,O=function(){$.postMessage(null)}}else O=function(){N(ne,0)};function K(q){H=q,M||(M=!0,O())}function W(q,Q){B=N(function(){q(e.unstable_now())},Q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_continueExecution=function(){P||w||(P=!0,K(R))},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(q){switch(b){case 1:case 2:case 3:var Q=3;break;default:Q=b}var J=b;b=Q;try{return q()}finally{b=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(q,Q){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var J=b;b=q;try{return Q()}finally{b=J}},e.unstable_scheduleCallback=function(q,Q,J){var L=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?L+J:L):J=L,q){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=J+G,q={id:x++,callback:Q,priorityLevel:q,startTime:J,expirationTime:G,sortIndex:-1},J>L?(q.sortIndex=J,t(m,q),r(h)===null&&q===r(m)&&(j?(S(B),B=-1):j=!0,W(E,J-L))):(q.sortIndex=G,t(h,q),P||w||(P=!0,K(R))),q},e.unstable_shouldYield=se,e.unstable_wrapCallback=function(q){var Q=b;return function(){var J=b;b=Q;try{return q.apply(this,arguments)}finally{b=J}}}})(Iu)),Iu}var Fm;function ww(){return Fm||(Fm=1,Lu.exports=kw()),Lu.exports}/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var _m;function jw(){if(_m)return Vt;_m=1;var e=Hd(),t=ww();function r(n){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+n,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,l={};function c(n,s){d(n,s),d(n+"Capture",s)}function d(n,s){for(l[n]=s,n=0;n<s.length;n++)i.add(s[n])}var p=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,x={},v={};function b(n){return h.call(v,n)?!0:h.call(x,n)?!1:m.test(n)?v[n]=!0:(x[n]=!0,!1)}function w(n,s,a,u){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return u?!1:a!==null?!a.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function P(n,s,a,u){if(s===null||typeof s>"u"||w(n,s,a,u))return!0;if(u)return!1;if(a!==null)switch(a.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function j(n,s,a,u,f,g,C){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=u,this.attributeNamespace=f,this.mustUseProperty=a,this.propertyName=n,this.type=s,this.sanitizeURL=g,this.removeEmptyString=C}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){N[n]=new j(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var s=n[0];N[s]=new j(s,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){N[n]=new j(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){N[n]=new j(n,2,!1,n,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){N[n]=new j(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){N[n]=new j(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){N[n]=new j(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){N[n]=new j(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){N[n]=new j(n,5,!1,n.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function T(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var s=n.replace(S,T);N[s]=new j(s,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var s=n.replace(S,T);N[s]=new j(s,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var s=n.replace(S,T);N[s]=new j(s,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){N[n]=new j(n,1,!1,n.toLowerCase(),null,!1,!1)}),N.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){N[n]=new j(n,1,!1,n.toLowerCase(),null,!0,!0)});function k(n,s,a,u){var f=N.hasOwnProperty(s)?N[s]:null;(f!==null?f.type!==0:u||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(P(s,a,f,u)&&(a=null),u||f===null?b(s)&&(a===null?n.removeAttribute(s):n.setAttribute(s,""+a)):f.mustUseProperty?n[f.propertyName]=a===null?f.type===3?!1:"":a:(s=f.attributeName,u=f.attributeNamespace,a===null?n.removeAttribute(s):(f=f.type,a=f===3||f===4&&a===!0?"":""+a,u?n.setAttributeNS(u,s,a):n.setAttribute(s,a))))}var E=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,R=Symbol.for("react.element"),M=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),te=Symbol.for("react.profiler"),X=Symbol.for("react.provider"),se=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),W=Symbol.for("react.offscreen"),q=Symbol.iterator;function Q(n){return n===null||typeof n!="object"?null:(n=q&&n[q]||n["@@iterator"],typeof n=="function"?n:null)}var J=Object.assign,L;function G(n){if(L===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);L=s&&s[1]||""}return`
|
|
34
|
+
`+L+n}var be=!1;function ge(n,s){if(!n||be)return"";be=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(U){var u=U}Reflect.construct(n,[],s)}else{try{s.call()}catch(U){u=U}n.call(s.prototype)}else{try{throw Error()}catch(U){u=U}n()}}catch(U){if(U&&u&&typeof U.stack=="string"){for(var f=U.stack.split(`
|
|
35
|
+
`),g=u.stack.split(`
|
|
36
|
+
`),C=f.length-1,D=g.length-1;1<=C&&0<=D&&f[C]!==g[D];)D--;for(;1<=C&&0<=D;C--,D--)if(f[C]!==g[D]){if(C!==1||D!==1)do if(C--,D--,0>D||f[C]!==g[D]){var A=`
|
|
37
|
+
`+f[C].replace(" at new "," at ");return n.displayName&&A.includes("<anonymous>")&&(A=A.replace("<anonymous>",n.displayName)),A}while(1<=C&&0<=D);break}}}finally{be=!1,Error.prepareStackTrace=a}return(n=n?n.displayName||n.name:"")?G(n):""}function ye(n){switch(n.tag){case 5:return G(n.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return n=ge(n.type,!1),n;case 11:return n=ge(n.type.render,!1),n;case 1:return n=ge(n.type,!0),n;default:return""}}function we(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case H:return"Fragment";case M:return"Portal";case te:return"Profiler";case B:return"StrictMode";case O:return"Suspense";case _:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case se:return(n.displayName||"Context")+".Consumer";case X:return(n._context.displayName||"Context")+".Provider";case ne:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case $:return s=n.displayName||null,s!==null?s:we(n.type)||"Memo";case K:s=n._payload,n=n._init;try{return we(n(s))}catch{}}return null}function Se(n){var s=n.type;switch(n.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=s.render,n=n.displayName||n.name||"",s.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return we(s);case 8:return s===B?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function Ce(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Re(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function et(n){var s=Re(n)?"checked":"value",a=Object.getOwnPropertyDescriptor(n.constructor.prototype,s),u=""+n[s];if(!n.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,g=a.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return f.call(this)},set:function(C){u=""+C,g.call(this,C)}}),Object.defineProperty(n,s,{enumerable:a.enumerable}),{getValue:function(){return u},setValue:function(C){u=""+C},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function Pt(n){n._valueTracker||(n._valueTracker=et(n))}function Wt(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var a=s.getValue(),u="";return n&&(u=Re(n)?n.checked?"true":"false":n.value),n=u,n!==a?(s.setValue(n),!0):!1}function vt(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function pn(n,s){var a=s.checked;return J({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??n._wrapperState.initialChecked})}function fn(n,s){var a=s.defaultValue==null?"":s.defaultValue,u=s.checked!=null?s.checked:s.defaultChecked;a=Ce(s.value!=null?s.value:a),n._wrapperState={initialChecked:u,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Pn(n,s){s=s.checked,s!=null&&k(n,"checked",s,!1)}function hn(n,s){Pn(n,s);var a=Ce(s.value),u=s.type;if(a!=null)u==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+a):n.value!==""+a&&(n.value=""+a);else if(u==="submit"||u==="reset"){n.removeAttribute("value");return}s.hasOwnProperty("value")?mt(n,s.type,a):s.hasOwnProperty("defaultValue")&&mt(n,s.type,Ce(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(n.defaultChecked=!!s.defaultChecked)}function bt(n,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var u=s.type;if(!(u!=="submit"&&u!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+n._wrapperState.initialValue,a||s===n.value||(n.value=s),n.defaultValue=s}a=n.name,a!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,a!==""&&(n.name=a)}function mt(n,s,a){(s!=="number"||vt(n.ownerDocument)!==n)&&(a==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+a&&(n.defaultValue=""+a))}var Ht=Array.isArray;function Kt(n,s,a,u){if(n=n.options,s){s={};for(var f=0;f<a.length;f++)s["$"+a[f]]=!0;for(a=0;a<n.length;a++)f=s.hasOwnProperty("$"+n[a].value),n[a].selected!==f&&(n[a].selected=f),f&&u&&(n[a].defaultSelected=!0)}else{for(a=""+Ce(a),s=null,f=0;f<n.length;f++){if(n[f].value===a){n[f].selected=!0,u&&(n[f].defaultSelected=!0);return}s!==null||n[f].disabled||(s=n[f])}s!==null&&(s.selected=!0)}}function Zr(n,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return J({},s,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function es(n,s){var a=s.value;if(a==null){if(a=s.children,s=s.defaultValue,a!=null){if(s!=null)throw Error(r(92));if(Ht(a)){if(1<a.length)throw Error(r(93));a=a[0]}s=a}s==null&&(s=""),a=s}n._wrapperState={initialValue:Ce(a)}}function ts(n,s){var a=Ce(s.value),u=Ce(s.defaultValue);a!=null&&(a=""+a,a!==n.value&&(n.value=a),s.defaultValue==null&&n.defaultValue!==a&&(n.defaultValue=a)),u!=null&&(n.defaultValue=""+u)}function ie(n){var s=n.textContent;s===n._wrapperState.initialValue&&s!==""&&s!==null&&(n.value=s)}function pe(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ie(n,s){return n==null||n==="http://www.w3.org/1999/xhtml"?pe(s):n==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var Me,Ye=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,u,f){MSApp.execUnsafeLocalFunction(function(){return n(s,a,u,f)})}:n})(function(n,s){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=s;else{for(Me=Me||document.createElement("div"),Me.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Me.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;s.firstChild;)n.appendChild(s.firstChild)}});function it(n,s){if(s){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=s;return}}n.textContent=s}var _e={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Bn=["Webkit","ms","Moz","O"];Object.keys(_e).forEach(function(n){Bn.forEach(function(s){s=s+n.charAt(0).toUpperCase()+n.substring(1),_e[s]=_e[n]})});function Tn(n,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||_e.hasOwnProperty(n)&&_e[n]?(""+s).trim():s+"px"}function fr(n,s){n=n.style;for(var a in s)if(s.hasOwnProperty(a)){var u=a.indexOf("--")===0,f=Tn(a,s[a],u);a==="float"&&(a="cssFloat"),u?n.setProperty(a,f):n[a]=f}}var hr=J({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $n(n,s){if(s){if(hr[n]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,n));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function Un(n,s){if(n.indexOf("-")===-1)return typeof s.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Wn=null;function Hn(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ns=null,mr=null,ve=null;function Oe(n){if(n=ra(n)){if(typeof ns!="function")throw Error(r(280));var s=n.stateNode;s&&(s=ko(s),ns(n.stateNode,n.type,s))}}function at(n){mr?ve?ve.push(n):ve=[n]:mr=n}function At(){if(mr){var n=mr,s=ve;if(ve=mr=null,Oe(n),s)for(n=0;n<s.length;n++)Oe(s[n])}}function rs(n,s){return n(s)}function Xa(){}var Hl=!1;function Vp(n,s,a){if(Hl)return n(s,a);Hl=!0;try{return rs(n,s,a)}finally{Hl=!1,(mr!==null||ve!==null)&&(Xa(),At())}}function Oi(n,s){var a=n.stateNode;if(a===null)return null;var u=ko(a);if(u===null)return null;a=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var Kl=!1;if(p)try{var Fi={};Object.defineProperty(Fi,"passive",{get:function(){Kl=!0}}),window.addEventListener("test",Fi,Fi),window.removeEventListener("test",Fi,Fi)}catch{Kl=!1}function zv(n,s,a,u,f,g,C,D,A){var U=Array.prototype.slice.call(arguments,3);try{s.apply(a,U)}catch(Z){this.onError(Z)}}var _i=!1,Ja=null,Za=!1,ql=null,Vv={onError:function(n){_i=!0,Ja=n}};function Bv(n,s,a,u,f,g,C,D,A){_i=!1,Ja=null,zv.apply(Vv,arguments)}function $v(n,s,a,u,f,g,C,D,A){if(Bv.apply(this,arguments),_i){if(_i){var U=Ja;_i=!1,Ja=null}else throw Error(r(198));Za||(Za=!0,ql=U)}}function ss(n){var s=n,a=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(a=s.return),n=s.return;while(n)}return s.tag===3?a:null}function Bp(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function $p(n){if(ss(n)!==n)throw Error(r(188))}function Uv(n){var s=n.alternate;if(!s){if(s=ss(n),s===null)throw Error(r(188));return s!==n?null:n}for(var a=n,u=s;;){var f=a.return;if(f===null)break;var g=f.alternate;if(g===null){if(u=f.return,u!==null){a=u;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===a)return $p(f),n;if(g===u)return $p(f),s;g=g.sibling}throw Error(r(188))}if(a.return!==u.return)a=f,u=g;else{for(var C=!1,D=f.child;D;){if(D===a){C=!0,a=f,u=g;break}if(D===u){C=!0,u=f,a=g;break}D=D.sibling}if(!C){for(D=g.child;D;){if(D===a){C=!0,a=g,u=f;break}if(D===u){C=!0,u=g,a=f;break}D=D.sibling}if(!C)throw Error(r(189))}}if(a.alternate!==u)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?n:s}function Up(n){return n=Uv(n),n!==null?Wp(n):null}function Wp(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var s=Wp(n);if(s!==null)return s;n=n.sibling}return null}var Hp=t.unstable_scheduleCallback,Kp=t.unstable_cancelCallback,Wv=t.unstable_shouldYield,Hv=t.unstable_requestPaint,tt=t.unstable_now,Kv=t.unstable_getCurrentPriorityLevel,Ql=t.unstable_ImmediatePriority,qp=t.unstable_UserBlockingPriority,eo=t.unstable_NormalPriority,qv=t.unstable_LowPriority,Qp=t.unstable_IdlePriority,to=null,Rn=null;function Qv(n){if(Rn&&typeof Rn.onCommitFiberRoot=="function")try{Rn.onCommitFiberRoot(to,n,void 0,(n.current.flags&128)===128)}catch{}}var mn=Math.clz32?Math.clz32:Xv,Gv=Math.log,Yv=Math.LN2;function Xv(n){return n>>>=0,n===0?32:31-(Gv(n)/Yv|0)|0}var no=64,ro=4194304;function zi(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function so(n,s){var a=n.pendingLanes;if(a===0)return 0;var u=0,f=n.suspendedLanes,g=n.pingedLanes,C=a&268435455;if(C!==0){var D=C&~f;D!==0?u=zi(D):(g&=C,g!==0&&(u=zi(g)))}else C=a&~f,C!==0?u=zi(C):g!==0&&(u=zi(g));if(u===0)return 0;if(s!==0&&s!==u&&(s&f)===0&&(f=u&-u,g=s&-s,f>=g||f===16&&(g&4194240)!==0))return s;if((u&4)!==0&&(u|=a&16),s=n.entangledLanes,s!==0)for(n=n.entanglements,s&=u;0<s;)a=31-mn(s),f=1<<a,u|=n[a],s&=~f;return u}function Jv(n,s){switch(n){case 1:case 2:case 4:return s+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Zv(n,s){for(var a=n.suspendedLanes,u=n.pingedLanes,f=n.expirationTimes,g=n.pendingLanes;0<g;){var C=31-mn(g),D=1<<C,A=f[C];A===-1?((D&a)===0||(D&u)!==0)&&(f[C]=Jv(D,s)):A<=s&&(n.expiredLanes|=D),g&=~D}}function Gl(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function Gp(){var n=no;return no<<=1,(no&4194240)===0&&(no=64),n}function Yl(n){for(var s=[],a=0;31>a;a++)s.push(n);return s}function Vi(n,s,a){n.pendingLanes|=s,s!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,s=31-mn(s),n[s]=a}function eb(n,s){var a=n.pendingLanes&~s;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=s,n.mutableReadLanes&=s,n.entangledLanes&=s,s=n.entanglements;var u=n.eventTimes;for(n=n.expirationTimes;0<a;){var f=31-mn(a),g=1<<f;s[f]=0,u[f]=-1,n[f]=-1,a&=~g}}function Xl(n,s){var a=n.entangledLanes|=s;for(n=n.entanglements;a;){var u=31-mn(a),f=1<<u;f&s|n[u]&s&&(n[u]|=s),a&=~f}}var Ae=0;function Yp(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var Xp,Jl,Jp,Zp,ef,Zl=!1,io=[],gr=null,xr=null,yr=null,Bi=new Map,$i=new Map,vr=[],tb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function tf(n,s){switch(n){case"focusin":case"focusout":gr=null;break;case"dragenter":case"dragleave":xr=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":Bi.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":$i.delete(s.pointerId)}}function Ui(n,s,a,u,f,g){return n===null||n.nativeEvent!==g?(n={blockedOn:s,domEventName:a,eventSystemFlags:u,nativeEvent:g,targetContainers:[f]},s!==null&&(s=ra(s),s!==null&&Jl(s)),n):(n.eventSystemFlags|=u,s=n.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),n)}function nb(n,s,a,u,f){switch(s){case"focusin":return gr=Ui(gr,n,s,a,u,f),!0;case"dragenter":return xr=Ui(xr,n,s,a,u,f),!0;case"mouseover":return yr=Ui(yr,n,s,a,u,f),!0;case"pointerover":var g=f.pointerId;return Bi.set(g,Ui(Bi.get(g)||null,n,s,a,u,f)),!0;case"gotpointercapture":return g=f.pointerId,$i.set(g,Ui($i.get(g)||null,n,s,a,u,f)),!0}return!1}function nf(n){var s=is(n.target);if(s!==null){var a=ss(s);if(a!==null){if(s=a.tag,s===13){if(s=Bp(a),s!==null){n.blockedOn=s,ef(n.priority,function(){Jp(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){n.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}n.blockedOn=null}function ao(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var a=tc(n.domEventName,n.eventSystemFlags,s[0],n.nativeEvent);if(a===null){a=n.nativeEvent;var u=new a.constructor(a.type,a);Wn=u,a.target.dispatchEvent(u),Wn=null}else return s=ra(a),s!==null&&Jl(s),n.blockedOn=a,!1;s.shift()}return!0}function rf(n,s,a){ao(n)&&a.delete(s)}function rb(){Zl=!1,gr!==null&&ao(gr)&&(gr=null),xr!==null&&ao(xr)&&(xr=null),yr!==null&&ao(yr)&&(yr=null),Bi.forEach(rf),$i.forEach(rf)}function Wi(n,s){n.blockedOn===s&&(n.blockedOn=null,Zl||(Zl=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,rb)))}function Hi(n){function s(f){return Wi(f,n)}if(0<io.length){Wi(io[0],n);for(var a=1;a<io.length;a++){var u=io[a];u.blockedOn===n&&(u.blockedOn=null)}}for(gr!==null&&Wi(gr,n),xr!==null&&Wi(xr,n),yr!==null&&Wi(yr,n),Bi.forEach(s),$i.forEach(s),a=0;a<vr.length;a++)u=vr[a],u.blockedOn===n&&(u.blockedOn=null);for(;0<vr.length&&(a=vr[0],a.blockedOn===null);)nf(a),a.blockedOn===null&&vr.shift()}var zs=E.ReactCurrentBatchConfig,oo=!0;function sb(n,s,a,u){var f=Ae,g=zs.transition;zs.transition=null;try{Ae=1,ec(n,s,a,u)}finally{Ae=f,zs.transition=g}}function ib(n,s,a,u){var f=Ae,g=zs.transition;zs.transition=null;try{Ae=4,ec(n,s,a,u)}finally{Ae=f,zs.transition=g}}function ec(n,s,a,u){if(oo){var f=tc(n,s,a,u);if(f===null)yc(n,s,u,lo,a),tf(n,u);else if(nb(f,n,s,a,u))u.stopPropagation();else if(tf(n,u),s&4&&-1<tb.indexOf(n)){for(;f!==null;){var g=ra(f);if(g!==null&&Xp(g),g=tc(n,s,a,u),g===null&&yc(n,s,u,lo,a),g===f)break;f=g}f!==null&&u.stopPropagation()}else yc(n,s,u,null,a)}}var lo=null;function tc(n,s,a,u){if(lo=null,n=Hn(u),n=is(n),n!==null)if(s=ss(n),s===null)n=null;else if(a=s.tag,a===13){if(n=Bp(s),n!==null)return n;n=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null);return lo=n,null}function sf(n){switch(n){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Kv()){case Ql:return 1;case qp:return 4;case eo:case qv:return 16;case Qp:return 536870912;default:return 16}default:return 16}}var br=null,nc=null,co=null;function af(){if(co)return co;var n,s=nc,a=s.length,u,f="value"in br?br.value:br.textContent,g=f.length;for(n=0;n<a&&s[n]===f[n];n++);var C=a-n;for(u=1;u<=C&&s[a-u]===f[g-u];u++);return co=f.slice(n,1<u?1-u:void 0)}function uo(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function po(){return!0}function of(){return!1}function qt(n){function s(a,u,f,g,C){this._reactName=a,this._targetInst=f,this.type=u,this.nativeEvent=g,this.target=C,this.currentTarget=null;for(var D in n)n.hasOwnProperty(D)&&(a=n[D],this[D]=a?a(g):g[D]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?po:of,this.isPropagationStopped=of,this}return J(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=po)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=po)},persist:function(){},isPersistent:po}),s}var Vs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rc=qt(Vs),Ki=J({},Vs,{view:0,detail:0}),ab=qt(Ki),sc,ic,qi,fo=J({},Ki,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:oc,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==qi&&(qi&&n.type==="mousemove"?(sc=n.screenX-qi.screenX,ic=n.screenY-qi.screenY):ic=sc=0,qi=n),sc)},movementY:function(n){return"movementY"in n?n.movementY:ic}}),lf=qt(fo),ob=J({},fo,{dataTransfer:0}),lb=qt(ob),cb=J({},Ki,{relatedTarget:0}),ac=qt(cb),ub=J({},Vs,{animationName:0,elapsedTime:0,pseudoElement:0}),db=qt(ub),pb=J({},Vs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),fb=qt(pb),hb=J({},Vs,{data:0}),cf=qt(hb),mb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gb={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yb(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=xb[n])?!!s[n]:!1}function oc(){return yb}var vb=J({},Ki,{key:function(n){if(n.key){var s=mb[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=uo(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?gb[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:oc,charCode:function(n){return n.type==="keypress"?uo(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?uo(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),bb=qt(vb),kb=J({},fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uf=qt(kb),wb=J({},Ki,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:oc}),jb=qt(wb),Sb=J({},Vs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Cb=qt(Sb),Nb=J({},fo,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Eb=qt(Nb),Pb=[9,13,27,32],lc=p&&"CompositionEvent"in window,Qi=null;p&&"documentMode"in document&&(Qi=document.documentMode);var Tb=p&&"TextEvent"in window&&!Qi,df=p&&(!lc||Qi&&8<Qi&&11>=Qi),pf=" ",ff=!1;function hf(n,s){switch(n){case"keyup":return Pb.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mf(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Bs=!1;function Rb(n,s){switch(n){case"compositionend":return mf(s);case"keypress":return s.which!==32?null:(ff=!0,pf);case"textInput":return n=s.data,n===pf&&ff?null:n;default:return null}}function Db(n,s){if(Bs)return n==="compositionend"||!lc&&hf(n,s)?(n=af(),co=nc=br=null,Bs=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return df&&s.locale!=="ko"?null:s.data;default:return null}}var Lb={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function gf(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!Lb[n.type]:s==="textarea"}function xf(n,s,a,u){at(u),s=yo(s,"onChange"),0<s.length&&(a=new rc("onChange","change",null,a,u),n.push({event:a,listeners:s}))}var Gi=null,Yi=null;function Ib(n){Mf(n,0)}function ho(n){var s=Ks(n);if(Wt(s))return n}function Ab(n,s){if(n==="change")return s}var yf=!1;if(p){var cc;if(p){var uc="oninput"in document;if(!uc){var vf=document.createElement("div");vf.setAttribute("oninput","return;"),uc=typeof vf.oninput=="function"}cc=uc}else cc=!1;yf=cc&&(!document.documentMode||9<document.documentMode)}function bf(){Gi&&(Gi.detachEvent("onpropertychange",kf),Yi=Gi=null)}function kf(n){if(n.propertyName==="value"&&ho(Yi)){var s=[];xf(s,Yi,n,Hn(n)),Vp(Ib,s)}}function Mb(n,s,a){n==="focusin"?(bf(),Gi=s,Yi=a,Gi.attachEvent("onpropertychange",kf)):n==="focusout"&&bf()}function Ob(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ho(Yi)}function Fb(n,s){if(n==="click")return ho(s)}function _b(n,s){if(n==="input"||n==="change")return ho(s)}function zb(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var gn=typeof Object.is=="function"?Object.is:zb;function Xi(n,s){if(gn(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var a=Object.keys(n),u=Object.keys(s);if(a.length!==u.length)return!1;for(u=0;u<a.length;u++){var f=a[u];if(!h.call(s,f)||!gn(n[f],s[f]))return!1}return!0}function wf(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function jf(n,s){var a=wf(n);n=0;for(var u;a;){if(a.nodeType===3){if(u=n+a.textContent.length,n<=s&&u>=s)return{node:a,offset:s-n};n=u}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=wf(a)}}function Sf(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?Sf(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function Cf(){for(var n=window,s=vt();s instanceof n.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)n=s.contentWindow;else break;s=vt(n.document)}return s}function dc(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}function Vb(n){var s=Cf(),a=n.focusedElem,u=n.selectionRange;if(s!==a&&a&&a.ownerDocument&&Sf(a.ownerDocument.documentElement,a)){if(u!==null&&dc(a)){if(s=u.start,n=u.end,n===void 0&&(n=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(n,a.value.length);else if(n=(s=a.ownerDocument||document)&&s.defaultView||window,n.getSelection){n=n.getSelection();var f=a.textContent.length,g=Math.min(u.start,f);u=u.end===void 0?g:Math.min(u.end,f),!n.extend&&g>u&&(f=u,u=g,g=f),f=jf(a,g);var C=jf(a,u);f&&C&&(n.rangeCount!==1||n.anchorNode!==f.node||n.anchorOffset!==f.offset||n.focusNode!==C.node||n.focusOffset!==C.offset)&&(s=s.createRange(),s.setStart(f.node,f.offset),n.removeAllRanges(),g>u?(n.addRange(s),n.extend(C.node,C.offset)):(s.setEnd(C.node,C.offset),n.addRange(s)))}}for(s=[],n=a;n=n.parentNode;)n.nodeType===1&&s.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)n=s[a],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var Bb=p&&"documentMode"in document&&11>=document.documentMode,$s=null,pc=null,Ji=null,fc=!1;function Nf(n,s,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;fc||$s==null||$s!==vt(u)||(u=$s,"selectionStart"in u&&dc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Ji&&Xi(Ji,u)||(Ji=u,u=yo(pc,"onSelect"),0<u.length&&(s=new rc("onSelect","select",null,s,a),n.push({event:s,listeners:u}),s.target=$s)))}function mo(n,s){var a={};return a[n.toLowerCase()]=s.toLowerCase(),a["Webkit"+n]="webkit"+s,a["Moz"+n]="moz"+s,a}var Us={animationend:mo("Animation","AnimationEnd"),animationiteration:mo("Animation","AnimationIteration"),animationstart:mo("Animation","AnimationStart"),transitionend:mo("Transition","TransitionEnd")},hc={},Ef={};p&&(Ef=document.createElement("div").style,"AnimationEvent"in window||(delete Us.animationend.animation,delete Us.animationiteration.animation,delete Us.animationstart.animation),"TransitionEvent"in window||delete Us.transitionend.transition);function go(n){if(hc[n])return hc[n];if(!Us[n])return n;var s=Us[n],a;for(a in s)if(s.hasOwnProperty(a)&&a in Ef)return hc[n]=s[a];return n}var Pf=go("animationend"),Tf=go("animationiteration"),Rf=go("animationstart"),Df=go("transitionend"),Lf=new Map,If="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function kr(n,s){Lf.set(n,s),c(s,[n])}for(var mc=0;mc<If.length;mc++){var gc=If[mc],$b=gc.toLowerCase(),Ub=gc[0].toUpperCase()+gc.slice(1);kr($b,"on"+Ub)}kr(Pf,"onAnimationEnd"),kr(Tf,"onAnimationIteration"),kr(Rf,"onAnimationStart"),kr("dblclick","onDoubleClick"),kr("focusin","onFocus"),kr("focusout","onBlur"),kr(Df,"onTransitionEnd"),d("onMouseEnter",["mouseout","mouseover"]),d("onMouseLeave",["mouseout","mouseover"]),d("onPointerEnter",["pointerout","pointerover"]),d("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Wb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Zi));function Af(n,s,a){var u=n.type||"unknown-event";n.currentTarget=a,$v(u,s,void 0,n),n.currentTarget=null}function Mf(n,s){s=(s&4)!==0;for(var a=0;a<n.length;a++){var u=n[a],f=u.event;u=u.listeners;e:{var g=void 0;if(s)for(var C=u.length-1;0<=C;C--){var D=u[C],A=D.instance,U=D.currentTarget;if(D=D.listener,A!==g&&f.isPropagationStopped())break e;Af(f,D,U),g=A}else for(C=0;C<u.length;C++){if(D=u[C],A=D.instance,U=D.currentTarget,D=D.listener,A!==g&&f.isPropagationStopped())break e;Af(f,D,U),g=A}}}if(Za)throw n=ql,Za=!1,ql=null,n}function Be(n,s){var a=s[Sc];a===void 0&&(a=s[Sc]=new Set);var u=n+"__bubble";a.has(u)||(Of(s,n,2,!1),a.add(u))}function xc(n,s,a){var u=0;s&&(u|=4),Of(a,n,u,s)}var xo="_reactListening"+Math.random().toString(36).slice(2);function ea(n){if(!n[xo]){n[xo]=!0,i.forEach(function(a){a!=="selectionchange"&&(Wb.has(a)||xc(a,!1,n),xc(a,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[xo]||(s[xo]=!0,xc("selectionchange",!1,s))}}function Of(n,s,a,u){switch(sf(s)){case 1:var f=sb;break;case 4:f=ib;break;default:f=ec}a=f.bind(null,s,a,n),f=void 0,!Kl||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),u?f!==void 0?n.addEventListener(s,a,{capture:!0,passive:f}):n.addEventListener(s,a,!0):f!==void 0?n.addEventListener(s,a,{passive:f}):n.addEventListener(s,a,!1)}function yc(n,s,a,u,f){var g=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var C=u.tag;if(C===3||C===4){var D=u.stateNode.containerInfo;if(D===f||D.nodeType===8&&D.parentNode===f)break;if(C===4)for(C=u.return;C!==null;){var A=C.tag;if((A===3||A===4)&&(A=C.stateNode.containerInfo,A===f||A.nodeType===8&&A.parentNode===f))return;C=C.return}for(;D!==null;){if(C=is(D),C===null)return;if(A=C.tag,A===5||A===6){u=g=C;continue e}D=D.parentNode}}u=u.return}Vp(function(){var U=g,Z=Hn(a),ee=[];e:{var Y=Lf.get(n);if(Y!==void 0){var oe=rc,ce=n;switch(n){case"keypress":if(uo(a)===0)break e;case"keydown":case"keyup":oe=bb;break;case"focusin":ce="focus",oe=ac;break;case"focusout":ce="blur",oe=ac;break;case"beforeblur":case"afterblur":oe=ac;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=lf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=lb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=jb;break;case Pf:case Tf:case Rf:oe=db;break;case Df:oe=Cb;break;case"scroll":oe=ab;break;case"wheel":oe=Eb;break;case"copy":case"cut":case"paste":oe=fb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=uf}var ue=(s&4)!==0,nt=!ue&&n==="scroll",z=ue?Y!==null?Y+"Capture":null:Y;ue=[];for(var F=U,V;F!==null;){V=F;var re=V.stateNode;if(V.tag===5&&re!==null&&(V=re,z!==null&&(re=Oi(F,z),re!=null&&ue.push(ta(F,re,V)))),nt)break;F=F.return}0<ue.length&&(Y=new oe(Y,ce,null,a,Z),ee.push({event:Y,listeners:ue}))}}if((s&7)===0){e:{if(Y=n==="mouseover"||n==="pointerover",oe=n==="mouseout"||n==="pointerout",Y&&a!==Wn&&(ce=a.relatedTarget||a.fromElement)&&(is(ce)||ce[Kn]))break e;if((oe||Y)&&(Y=Z.window===Z?Z:(Y=Z.ownerDocument)?Y.defaultView||Y.parentWindow:window,oe?(ce=a.relatedTarget||a.toElement,oe=U,ce=ce?is(ce):null,ce!==null&&(nt=ss(ce),ce!==nt||ce.tag!==5&&ce.tag!==6)&&(ce=null)):(oe=null,ce=U),oe!==ce)){if(ue=lf,re="onMouseLeave",z="onMouseEnter",F="mouse",(n==="pointerout"||n==="pointerover")&&(ue=uf,re="onPointerLeave",z="onPointerEnter",F="pointer"),nt=oe==null?Y:Ks(oe),V=ce==null?Y:Ks(ce),Y=new ue(re,F+"leave",oe,a,Z),Y.target=nt,Y.relatedTarget=V,re=null,is(Z)===U&&(ue=new ue(z,F+"enter",ce,a,Z),ue.target=V,ue.relatedTarget=nt,re=ue),nt=re,oe&&ce)t:{for(ue=oe,z=ce,F=0,V=ue;V;V=Ws(V))F++;for(V=0,re=z;re;re=Ws(re))V++;for(;0<F-V;)ue=Ws(ue),F--;for(;0<V-F;)z=Ws(z),V--;for(;F--;){if(ue===z||z!==null&&ue===z.alternate)break t;ue=Ws(ue),z=Ws(z)}ue=null}else ue=null;oe!==null&&Ff(ee,Y,oe,ue,!1),ce!==null&&nt!==null&&Ff(ee,nt,ce,ue,!0)}}e:{if(Y=U?Ks(U):window,oe=Y.nodeName&&Y.nodeName.toLowerCase(),oe==="select"||oe==="input"&&Y.type==="file")var de=Ab;else if(gf(Y))if(yf)de=_b;else{de=Ob;var he=Mb}else(oe=Y.nodeName)&&oe.toLowerCase()==="input"&&(Y.type==="checkbox"||Y.type==="radio")&&(de=Fb);if(de&&(de=de(n,U))){xf(ee,de,a,Z);break e}he&&he(n,Y,U),n==="focusout"&&(he=Y._wrapperState)&&he.controlled&&Y.type==="number"&&mt(Y,"number",Y.value)}switch(he=U?Ks(U):window,n){case"focusin":(gf(he)||he.contentEditable==="true")&&($s=he,pc=U,Ji=null);break;case"focusout":Ji=pc=$s=null;break;case"mousedown":fc=!0;break;case"contextmenu":case"mouseup":case"dragend":fc=!1,Nf(ee,a,Z);break;case"selectionchange":if(Bb)break;case"keydown":case"keyup":Nf(ee,a,Z)}var me;if(lc)e:{switch(n){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else Bs?hf(n,a)&&(ke="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(ke="onCompositionStart");ke&&(df&&a.locale!=="ko"&&(Bs||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Bs&&(me=af()):(br=Z,nc="value"in br?br.value:br.textContent,Bs=!0)),he=yo(U,ke),0<he.length&&(ke=new cf(ke,n,null,a,Z),ee.push({event:ke,listeners:he}),me?ke.data=me:(me=mf(a),me!==null&&(ke.data=me)))),(me=Tb?Rb(n,a):Db(n,a))&&(U=yo(U,"onBeforeInput"),0<U.length&&(Z=new cf("onBeforeInput","beforeinput",null,a,Z),ee.push({event:Z,listeners:U}),Z.data=me))}Mf(ee,s)})}function ta(n,s,a){return{instance:n,listener:s,currentTarget:a}}function yo(n,s){for(var a=s+"Capture",u=[];n!==null;){var f=n,g=f.stateNode;f.tag===5&&g!==null&&(f=g,g=Oi(n,a),g!=null&&u.unshift(ta(n,g,f)),g=Oi(n,s),g!=null&&u.push(ta(n,g,f))),n=n.return}return u}function Ws(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function Ff(n,s,a,u,f){for(var g=s._reactName,C=[];a!==null&&a!==u;){var D=a,A=D.alternate,U=D.stateNode;if(A!==null&&A===u)break;D.tag===5&&U!==null&&(D=U,f?(A=Oi(a,g),A!=null&&C.unshift(ta(a,A,D))):f||(A=Oi(a,g),A!=null&&C.push(ta(a,A,D)))),a=a.return}C.length!==0&&n.push({event:s,listeners:C})}var Hb=/\r\n?/g,Kb=/\u0000|\uFFFD/g;function _f(n){return(typeof n=="string"?n:""+n).replace(Hb,`
|
|
38
|
+
`).replace(Kb,"")}function vo(n,s,a){if(s=_f(s),_f(n)!==s&&a)throw Error(r(425))}function bo(){}var vc=null,bc=null;function kc(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var wc=typeof setTimeout=="function"?setTimeout:void 0,qb=typeof clearTimeout=="function"?clearTimeout:void 0,zf=typeof Promise=="function"?Promise:void 0,Qb=typeof queueMicrotask=="function"?queueMicrotask:typeof zf<"u"?function(n){return zf.resolve(null).then(n).catch(Gb)}:wc;function Gb(n){setTimeout(function(){throw n})}function jc(n,s){var a=s,u=0;do{var f=a.nextSibling;if(n.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(u===0){n.removeChild(f),Hi(s);return}u--}else a!=="$"&&a!=="$?"&&a!=="$!"||u++;a=f}while(a);Hi(s)}function wr(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return n}function Vf(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var a=n.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return n;s--}else a==="/$"&&s++}n=n.previousSibling}return null}var Hs=Math.random().toString(36).slice(2),Dn="__reactFiber$"+Hs,na="__reactProps$"+Hs,Kn="__reactContainer$"+Hs,Sc="__reactEvents$"+Hs,Yb="__reactListeners$"+Hs,Xb="__reactHandles$"+Hs;function is(n){var s=n[Dn];if(s)return s;for(var a=n.parentNode;a;){if(s=a[Kn]||a[Dn]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(n=Vf(n);n!==null;){if(a=n[Dn])return a;n=Vf(n)}return s}n=a,a=n.parentNode}return null}function ra(n){return n=n[Dn]||n[Kn],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Ks(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(r(33))}function ko(n){return n[na]||null}var Cc=[],qs=-1;function jr(n){return{current:n}}function $e(n){0>qs||(n.current=Cc[qs],Cc[qs]=null,qs--)}function ze(n,s){qs++,Cc[qs]=n.current,n.current=s}var Sr={},kt=jr(Sr),Mt=jr(!1),as=Sr;function Qs(n,s){var a=n.type.contextTypes;if(!a)return Sr;var u=n.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===s)return u.__reactInternalMemoizedMaskedChildContext;var f={},g;for(g in a)f[g]=s[g];return u&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=s,n.__reactInternalMemoizedMaskedChildContext=f),f}function Ot(n){return n=n.childContextTypes,n!=null}function wo(){$e(Mt),$e(kt)}function Bf(n,s,a){if(kt.current!==Sr)throw Error(r(168));ze(kt,s),ze(Mt,a)}function $f(n,s,a){var u=n.stateNode;if(s=s.childContextTypes,typeof u.getChildContext!="function")return a;u=u.getChildContext();for(var f in u)if(!(f in s))throw Error(r(108,Se(n)||"Unknown",f));return J({},a,u)}function jo(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Sr,as=kt.current,ze(kt,n),ze(Mt,Mt.current),!0}function Uf(n,s,a){var u=n.stateNode;if(!u)throw Error(r(169));a?(n=$f(n,s,as),u.__reactInternalMemoizedMergedChildContext=n,$e(Mt),$e(kt),ze(kt,n)):$e(Mt),ze(Mt,a)}var qn=null,So=!1,Nc=!1;function Wf(n){qn===null?qn=[n]:qn.push(n)}function Jb(n){So=!0,Wf(n)}function Cr(){if(!Nc&&qn!==null){Nc=!0;var n=0,s=Ae;try{var a=qn;for(Ae=1;n<a.length;n++){var u=a[n];do u=u(!0);while(u!==null)}qn=null,So=!1}catch(f){throw qn!==null&&(qn=qn.slice(n+1)),Hp(Ql,Cr),f}finally{Ae=s,Nc=!1}}return null}var Gs=[],Ys=0,Co=null,No=0,Zt=[],en=0,os=null,Qn=1,Gn="";function ls(n,s){Gs[Ys++]=No,Gs[Ys++]=Co,Co=n,No=s}function Hf(n,s,a){Zt[en++]=Qn,Zt[en++]=Gn,Zt[en++]=os,os=n;var u=Qn;n=Gn;var f=32-mn(u)-1;u&=~(1<<f),a+=1;var g=32-mn(s)+f;if(30<g){var C=f-f%5;g=(u&(1<<C)-1).toString(32),u>>=C,f-=C,Qn=1<<32-mn(s)+f|a<<f|u,Gn=g+n}else Qn=1<<g|a<<f|u,Gn=n}function Ec(n){n.return!==null&&(ls(n,1),Hf(n,1,0))}function Pc(n){for(;n===Co;)Co=Gs[--Ys],Gs[Ys]=null,No=Gs[--Ys],Gs[Ys]=null;for(;n===os;)os=Zt[--en],Zt[en]=null,Gn=Zt[--en],Zt[en]=null,Qn=Zt[--en],Zt[en]=null}var Qt=null,Gt=null,He=!1,xn=null;function Kf(n,s){var a=sn(5,null,null,0);a.elementType="DELETED",a.stateNode=s,a.return=n,s=n.deletions,s===null?(n.deletions=[a],n.flags|=16):s.push(a)}function qf(n,s){switch(n.tag){case 5:var a=n.type;return s=s.nodeType!==1||a.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(n.stateNode=s,Qt=n,Gt=wr(s.firstChild),!0):!1;case 6:return s=n.pendingProps===""||s.nodeType!==3?null:s,s!==null?(n.stateNode=s,Qt=n,Gt=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(a=os!==null?{id:Qn,overflow:Gn}:null,n.memoizedState={dehydrated:s,treeContext:a,retryLane:1073741824},a=sn(18,null,null,0),a.stateNode=s,a.return=n,n.child=a,Qt=n,Gt=null,!0):!1;default:return!1}}function Tc(n){return(n.mode&1)!==0&&(n.flags&128)===0}function Rc(n){if(He){var s=Gt;if(s){var a=s;if(!qf(n,s)){if(Tc(n))throw Error(r(418));s=wr(a.nextSibling);var u=Qt;s&&qf(n,s)?Kf(u,a):(n.flags=n.flags&-4097|2,He=!1,Qt=n)}}else{if(Tc(n))throw Error(r(418));n.flags=n.flags&-4097|2,He=!1,Qt=n}}}function Qf(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Qt=n}function Eo(n){if(n!==Qt)return!1;if(!He)return Qf(n),He=!0,!1;var s;if((s=n.tag!==3)&&!(s=n.tag!==5)&&(s=n.type,s=s!=="head"&&s!=="body"&&!kc(n.type,n.memoizedProps)),s&&(s=Gt)){if(Tc(n))throw Gf(),Error(r(418));for(;s;)Kf(n,s),s=wr(s.nextSibling)}if(Qf(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));e:{for(n=n.nextSibling,s=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"){if(s===0){Gt=wr(n.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}n=n.nextSibling}Gt=null}}else Gt=Qt?wr(n.stateNode.nextSibling):null;return!0}function Gf(){for(var n=Gt;n;)n=wr(n.nextSibling)}function Xs(){Gt=Qt=null,He=!1}function Dc(n){xn===null?xn=[n]:xn.push(n)}var Zb=E.ReactCurrentBatchConfig;function sa(n,s,a){if(n=a.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(r(309));var u=a.stateNode}if(!u)throw Error(r(147,n));var f=u,g=""+n;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===g?s.ref:(s=function(C){var D=f.refs;C===null?delete D[g]:D[g]=C},s._stringRef=g,s)}if(typeof n!="string")throw Error(r(284));if(!a._owner)throw Error(r(290,n))}return n}function Po(n,s){throw n=Object.prototype.toString.call(s),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n))}function Yf(n){var s=n._init;return s(n._payload)}function Xf(n){function s(z,F){if(n){var V=z.deletions;V===null?(z.deletions=[F],z.flags|=16):V.push(F)}}function a(z,F){if(!n)return null;for(;F!==null;)s(z,F),F=F.sibling;return null}function u(z,F){for(z=new Map;F!==null;)F.key!==null?z.set(F.key,F):z.set(F.index,F),F=F.sibling;return z}function f(z,F){return z=Ir(z,F),z.index=0,z.sibling=null,z}function g(z,F,V){return z.index=V,n?(V=z.alternate,V!==null?(V=V.index,V<F?(z.flags|=2,F):V):(z.flags|=2,F)):(z.flags|=1048576,F)}function C(z){return n&&z.alternate===null&&(z.flags|=2),z}function D(z,F,V,re){return F===null||F.tag!==6?(F=wu(V,z.mode,re),F.return=z,F):(F=f(F,V),F.return=z,F)}function A(z,F,V,re){var de=V.type;return de===H?Z(z,F,V.props.children,re,V.key):F!==null&&(F.elementType===de||typeof de=="object"&&de!==null&&de.$$typeof===K&&Yf(de)===F.type)?(re=f(F,V.props),re.ref=sa(z,F,V),re.return=z,re):(re=Jo(V.type,V.key,V.props,null,z.mode,re),re.ref=sa(z,F,V),re.return=z,re)}function U(z,F,V,re){return F===null||F.tag!==4||F.stateNode.containerInfo!==V.containerInfo||F.stateNode.implementation!==V.implementation?(F=ju(V,z.mode,re),F.return=z,F):(F=f(F,V.children||[]),F.return=z,F)}function Z(z,F,V,re,de){return F===null||F.tag!==7?(F=gs(V,z.mode,re,de),F.return=z,F):(F=f(F,V),F.return=z,F)}function ee(z,F,V){if(typeof F=="string"&&F!==""||typeof F=="number")return F=wu(""+F,z.mode,V),F.return=z,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case R:return V=Jo(F.type,F.key,F.props,null,z.mode,V),V.ref=sa(z,null,F),V.return=z,V;case M:return F=ju(F,z.mode,V),F.return=z,F;case K:var re=F._init;return ee(z,re(F._payload),V)}if(Ht(F)||Q(F))return F=gs(F,z.mode,V,null),F.return=z,F;Po(z,F)}return null}function Y(z,F,V,re){var de=F!==null?F.key:null;if(typeof V=="string"&&V!==""||typeof V=="number")return de!==null?null:D(z,F,""+V,re);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case R:return V.key===de?A(z,F,V,re):null;case M:return V.key===de?U(z,F,V,re):null;case K:return de=V._init,Y(z,F,de(V._payload),re)}if(Ht(V)||Q(V))return de!==null?null:Z(z,F,V,re,null);Po(z,V)}return null}function oe(z,F,V,re,de){if(typeof re=="string"&&re!==""||typeof re=="number")return z=z.get(V)||null,D(F,z,""+re,de);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case R:return z=z.get(re.key===null?V:re.key)||null,A(F,z,re,de);case M:return z=z.get(re.key===null?V:re.key)||null,U(F,z,re,de);case K:var he=re._init;return oe(z,F,V,he(re._payload),de)}if(Ht(re)||Q(re))return z=z.get(V)||null,Z(F,z,re,de,null);Po(F,re)}return null}function ce(z,F,V,re){for(var de=null,he=null,me=F,ke=F=0,ft=null;me!==null&&ke<V.length;ke++){me.index>ke?(ft=me,me=null):ft=me.sibling;var De=Y(z,me,V[ke],re);if(De===null){me===null&&(me=ft);break}n&&me&&De.alternate===null&&s(z,me),F=g(De,F,ke),he===null?de=De:he.sibling=De,he=De,me=ft}if(ke===V.length)return a(z,me),He&&ls(z,ke),de;if(me===null){for(;ke<V.length;ke++)me=ee(z,V[ke],re),me!==null&&(F=g(me,F,ke),he===null?de=me:he.sibling=me,he=me);return He&&ls(z,ke),de}for(me=u(z,me);ke<V.length;ke++)ft=oe(me,z,ke,V[ke],re),ft!==null&&(n&&ft.alternate!==null&&me.delete(ft.key===null?ke:ft.key),F=g(ft,F,ke),he===null?de=ft:he.sibling=ft,he=ft);return n&&me.forEach(function(Ar){return s(z,Ar)}),He&&ls(z,ke),de}function ue(z,F,V,re){var de=Q(V);if(typeof de!="function")throw Error(r(150));if(V=de.call(V),V==null)throw Error(r(151));for(var he=de=null,me=F,ke=F=0,ft=null,De=V.next();me!==null&&!De.done;ke++,De=V.next()){me.index>ke?(ft=me,me=null):ft=me.sibling;var Ar=Y(z,me,De.value,re);if(Ar===null){me===null&&(me=ft);break}n&&me&&Ar.alternate===null&&s(z,me),F=g(Ar,F,ke),he===null?de=Ar:he.sibling=Ar,he=Ar,me=ft}if(De.done)return a(z,me),He&&ls(z,ke),de;if(me===null){for(;!De.done;ke++,De=V.next())De=ee(z,De.value,re),De!==null&&(F=g(De,F,ke),he===null?de=De:he.sibling=De,he=De);return He&&ls(z,ke),de}for(me=u(z,me);!De.done;ke++,De=V.next())De=oe(me,z,ke,De.value,re),De!==null&&(n&&De.alternate!==null&&me.delete(De.key===null?ke:De.key),F=g(De,F,ke),he===null?de=De:he.sibling=De,he=De);return n&&me.forEach(function(Lk){return s(z,Lk)}),He&&ls(z,ke),de}function nt(z,F,V,re){if(typeof V=="object"&&V!==null&&V.type===H&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case R:e:{for(var de=V.key,he=F;he!==null;){if(he.key===de){if(de=V.type,de===H){if(he.tag===7){a(z,he.sibling),F=f(he,V.props.children),F.return=z,z=F;break e}}else if(he.elementType===de||typeof de=="object"&&de!==null&&de.$$typeof===K&&Yf(de)===he.type){a(z,he.sibling),F=f(he,V.props),F.ref=sa(z,he,V),F.return=z,z=F;break e}a(z,he);break}else s(z,he);he=he.sibling}V.type===H?(F=gs(V.props.children,z.mode,re,V.key),F.return=z,z=F):(re=Jo(V.type,V.key,V.props,null,z.mode,re),re.ref=sa(z,F,V),re.return=z,z=re)}return C(z);case M:e:{for(he=V.key;F!==null;){if(F.key===he)if(F.tag===4&&F.stateNode.containerInfo===V.containerInfo&&F.stateNode.implementation===V.implementation){a(z,F.sibling),F=f(F,V.children||[]),F.return=z,z=F;break e}else{a(z,F);break}else s(z,F);F=F.sibling}F=ju(V,z.mode,re),F.return=z,z=F}return C(z);case K:return he=V._init,nt(z,F,he(V._payload),re)}if(Ht(V))return ce(z,F,V,re);if(Q(V))return ue(z,F,V,re);Po(z,V)}return typeof V=="string"&&V!==""||typeof V=="number"?(V=""+V,F!==null&&F.tag===6?(a(z,F.sibling),F=f(F,V),F.return=z,z=F):(a(z,F),F=wu(V,z.mode,re),F.return=z,z=F),C(z)):a(z,F)}return nt}var Js=Xf(!0),Jf=Xf(!1),To=jr(null),Ro=null,Zs=null,Lc=null;function Ic(){Lc=Zs=Ro=null}function Ac(n){var s=To.current;$e(To),n._currentValue=s}function Mc(n,s,a){for(;n!==null;){var u=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),n===a)break;n=n.return}}function ei(n,s){Ro=n,Lc=Zs=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&s)!==0&&(Ft=!0),n.firstContext=null)}function tn(n){var s=n._currentValue;if(Lc!==n)if(n={context:n,memoizedValue:s,next:null},Zs===null){if(Ro===null)throw Error(r(308));Zs=n,Ro.dependencies={lanes:0,firstContext:n}}else Zs=Zs.next=n;return s}var cs=null;function Oc(n){cs===null?cs=[n]:cs.push(n)}function Zf(n,s,a,u){var f=s.interleaved;return f===null?(a.next=a,Oc(s)):(a.next=f.next,f.next=a),s.interleaved=a,Yn(n,u)}function Yn(n,s){n.lanes|=s;var a=n.alternate;for(a!==null&&(a.lanes|=s),a=n,n=n.return;n!==null;)n.childLanes|=s,a=n.alternate,a!==null&&(a.childLanes|=s),a=n,n=n.return;return a.tag===3?a.stateNode:null}var Nr=!1;function Fc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function eh(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Xn(n,s){return{eventTime:n,lane:s,tag:0,payload:null,callback:null,next:null}}function Er(n,s,a){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(Te&2)!==0){var f=u.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),u.pending=s,Yn(n,a)}return f=u.interleaved,f===null?(s.next=s,Oc(u)):(s.next=f.next,f.next=s),u.interleaved=s,Yn(n,a)}function Do(n,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194240)!==0)){var u=s.lanes;u&=n.pendingLanes,a|=u,s.lanes=a,Xl(n,a)}}function th(n,s){var a=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,a===u)){var f=null,g=null;if(a=a.firstBaseUpdate,a!==null){do{var C={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};g===null?f=g=C:g=g.next=C,a=a.next}while(a!==null);g===null?f=g=s:g=g.next=s}else f=g=s;a={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:u.shared,effects:u.effects},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=s:n.next=s,a.lastBaseUpdate=s}function Lo(n,s,a,u){var f=n.updateQueue;Nr=!1;var g=f.firstBaseUpdate,C=f.lastBaseUpdate,D=f.shared.pending;if(D!==null){f.shared.pending=null;var A=D,U=A.next;A.next=null,C===null?g=U:C.next=U,C=A;var Z=n.alternate;Z!==null&&(Z=Z.updateQueue,D=Z.lastBaseUpdate,D!==C&&(D===null?Z.firstBaseUpdate=U:D.next=U,Z.lastBaseUpdate=A))}if(g!==null){var ee=f.baseState;C=0,Z=U=A=null,D=g;do{var Y=D.lane,oe=D.eventTime;if((u&Y)===Y){Z!==null&&(Z=Z.next={eventTime:oe,lane:0,tag:D.tag,payload:D.payload,callback:D.callback,next:null});e:{var ce=n,ue=D;switch(Y=s,oe=a,ue.tag){case 1:if(ce=ue.payload,typeof ce=="function"){ee=ce.call(oe,ee,Y);break e}ee=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=ue.payload,Y=typeof ce=="function"?ce.call(oe,ee,Y):ce,Y==null)break e;ee=J({},ee,Y);break e;case 2:Nr=!0}}D.callback!==null&&D.lane!==0&&(n.flags|=64,Y=f.effects,Y===null?f.effects=[D]:Y.push(D))}else oe={eventTime:oe,lane:Y,tag:D.tag,payload:D.payload,callback:D.callback,next:null},Z===null?(U=Z=oe,A=ee):Z=Z.next=oe,C|=Y;if(D=D.next,D===null){if(D=f.shared.pending,D===null)break;Y=D,D=Y.next,Y.next=null,f.lastBaseUpdate=Y,f.shared.pending=null}}while(!0);if(Z===null&&(A=ee),f.baseState=A,f.firstBaseUpdate=U,f.lastBaseUpdate=Z,s=f.shared.interleaved,s!==null){f=s;do C|=f.lane,f=f.next;while(f!==s)}else g===null&&(f.shared.lanes=0);ps|=C,n.lanes=C,n.memoizedState=ee}}function nh(n,s,a){if(n=s.effects,s.effects=null,n!==null)for(s=0;s<n.length;s++){var u=n[s],f=u.callback;if(f!==null){if(u.callback=null,u=a,typeof f!="function")throw Error(r(191,f));f.call(u)}}}var ia={},Ln=jr(ia),aa=jr(ia),oa=jr(ia);function us(n){if(n===ia)throw Error(r(174));return n}function _c(n,s){switch(ze(oa,s),ze(aa,n),ze(Ln,ia),n=s.nodeType,n){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:Ie(null,"");break;default:n=n===8?s.parentNode:s,s=n.namespaceURI||null,n=n.tagName,s=Ie(s,n)}$e(Ln),ze(Ln,s)}function ti(){$e(Ln),$e(aa),$e(oa)}function rh(n){us(oa.current);var s=us(Ln.current),a=Ie(s,n.type);s!==a&&(ze(aa,n),ze(Ln,a))}function zc(n){aa.current===n&&($e(Ln),$e(aa))}var Ke=jr(0);function Io(n){for(var s=n;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Vc=[];function Bc(){for(var n=0;n<Vc.length;n++)Vc[n]._workInProgressVersionPrimary=null;Vc.length=0}var Ao=E.ReactCurrentDispatcher,$c=E.ReactCurrentBatchConfig,ds=0,qe=null,ot=null,dt=null,Mo=!1,la=!1,ca=0,ek=0;function wt(){throw Error(r(321))}function Uc(n,s){if(s===null)return!1;for(var a=0;a<s.length&&a<n.length;a++)if(!gn(n[a],s[a]))return!1;return!0}function Wc(n,s,a,u,f,g){if(ds=g,qe=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Ao.current=n===null||n.memoizedState===null?sk:ik,n=a(u,f),la){g=0;do{if(la=!1,ca=0,25<=g)throw Error(r(301));g+=1,dt=ot=null,s.updateQueue=null,Ao.current=ak,n=a(u,f)}while(la)}if(Ao.current=_o,s=ot!==null&&ot.next!==null,ds=0,dt=ot=qe=null,Mo=!1,s)throw Error(r(300));return n}function Hc(){var n=ca!==0;return ca=0,n}function In(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?qe.memoizedState=dt=n:dt=dt.next=n,dt}function nn(){if(ot===null){var n=qe.alternate;n=n!==null?n.memoizedState:null}else n=ot.next;var s=dt===null?qe.memoizedState:dt.next;if(s!==null)dt=s,ot=n;else{if(n===null)throw Error(r(310));ot=n,n={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},dt===null?qe.memoizedState=dt=n:dt=dt.next=n}return dt}function ua(n,s){return typeof s=="function"?s(n):s}function Kc(n){var s=nn(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=n;var u=ot,f=u.baseQueue,g=a.pending;if(g!==null){if(f!==null){var C=f.next;f.next=g.next,g.next=C}u.baseQueue=f=g,a.pending=null}if(f!==null){g=f.next,u=u.baseState;var D=C=null,A=null,U=g;do{var Z=U.lane;if((ds&Z)===Z)A!==null&&(A=A.next={lane:0,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),u=U.hasEagerState?U.eagerState:n(u,U.action);else{var ee={lane:Z,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null};A===null?(D=A=ee,C=u):A=A.next=ee,qe.lanes|=Z,ps|=Z}U=U.next}while(U!==null&&U!==g);A===null?C=u:A.next=D,gn(u,s.memoizedState)||(Ft=!0),s.memoizedState=u,s.baseState=C,s.baseQueue=A,a.lastRenderedState=u}if(n=a.interleaved,n!==null){f=n;do g=f.lane,qe.lanes|=g,ps|=g,f=f.next;while(f!==n)}else f===null&&(a.lanes=0);return[s.memoizedState,a.dispatch]}function qc(n){var s=nn(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=n;var u=a.dispatch,f=a.pending,g=s.memoizedState;if(f!==null){a.pending=null;var C=f=f.next;do g=n(g,C.action),C=C.next;while(C!==f);gn(g,s.memoizedState)||(Ft=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),a.lastRenderedState=g}return[g,u]}function sh(){}function ih(n,s){var a=qe,u=nn(),f=s(),g=!gn(u.memoizedState,f);if(g&&(u.memoizedState=f,Ft=!0),u=u.queue,Qc(lh.bind(null,a,u,n),[n]),u.getSnapshot!==s||g||dt!==null&&dt.memoizedState.tag&1){if(a.flags|=2048,da(9,oh.bind(null,a,u,f,s),void 0,null),pt===null)throw Error(r(349));(ds&30)!==0||ah(a,s,f)}return f}function ah(n,s,a){n.flags|=16384,n={getSnapshot:s,value:a},s=qe.updateQueue,s===null?(s={lastEffect:null,stores:null},qe.updateQueue=s,s.stores=[n]):(a=s.stores,a===null?s.stores=[n]:a.push(n))}function oh(n,s,a,u){s.value=a,s.getSnapshot=u,ch(s)&&uh(n)}function lh(n,s,a){return a(function(){ch(s)&&uh(n)})}function ch(n){var s=n.getSnapshot;n=n.value;try{var a=s();return!gn(n,a)}catch{return!0}}function uh(n){var s=Yn(n,1);s!==null&&kn(s,n,1,-1)}function dh(n){var s=In();return typeof n=="function"&&(n=n()),s.memoizedState=s.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ua,lastRenderedState:n},s.queue=n,n=n.dispatch=rk.bind(null,qe,n),[s.memoizedState,n]}function da(n,s,a,u){return n={tag:n,create:s,destroy:a,deps:u,next:null},s=qe.updateQueue,s===null?(s={lastEffect:null,stores:null},qe.updateQueue=s,s.lastEffect=n.next=n):(a=s.lastEffect,a===null?s.lastEffect=n.next=n:(u=a.next,a.next=n,n.next=u,s.lastEffect=n)),n}function ph(){return nn().memoizedState}function Oo(n,s,a,u){var f=In();qe.flags|=n,f.memoizedState=da(1|s,a,void 0,u===void 0?null:u)}function Fo(n,s,a,u){var f=nn();u=u===void 0?null:u;var g=void 0;if(ot!==null){var C=ot.memoizedState;if(g=C.destroy,u!==null&&Uc(u,C.deps)){f.memoizedState=da(s,a,g,u);return}}qe.flags|=n,f.memoizedState=da(1|s,a,g,u)}function fh(n,s){return Oo(8390656,8,n,s)}function Qc(n,s){return Fo(2048,8,n,s)}function hh(n,s){return Fo(4,2,n,s)}function mh(n,s){return Fo(4,4,n,s)}function gh(n,s){if(typeof s=="function")return n=n(),s(n),function(){s(null)};if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function xh(n,s,a){return a=a!=null?a.concat([n]):null,Fo(4,4,gh.bind(null,s,n),a)}function Gc(){}function yh(n,s){var a=nn();s=s===void 0?null:s;var u=a.memoizedState;return u!==null&&s!==null&&Uc(s,u[1])?u[0]:(a.memoizedState=[n,s],n)}function vh(n,s){var a=nn();s=s===void 0?null:s;var u=a.memoizedState;return u!==null&&s!==null&&Uc(s,u[1])?u[0]:(n=n(),a.memoizedState=[n,s],n)}function bh(n,s,a){return(ds&21)===0?(n.baseState&&(n.baseState=!1,Ft=!0),n.memoizedState=a):(gn(a,s)||(a=Gp(),qe.lanes|=a,ps|=a,n.baseState=!0),s)}function tk(n,s){var a=Ae;Ae=a!==0&&4>a?a:4,n(!0);var u=$c.transition;$c.transition={};try{n(!1),s()}finally{Ae=a,$c.transition=u}}function kh(){return nn().memoizedState}function nk(n,s,a){var u=Dr(n);if(a={lane:u,action:a,hasEagerState:!1,eagerState:null,next:null},wh(n))jh(s,a);else if(a=Zf(n,s,a,u),a!==null){var f=Rt();kn(a,n,u,f),Sh(a,s,u)}}function rk(n,s,a){var u=Dr(n),f={lane:u,action:a,hasEagerState:!1,eagerState:null,next:null};if(wh(n))jh(s,f);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var C=s.lastRenderedState,D=g(C,a);if(f.hasEagerState=!0,f.eagerState=D,gn(D,C)){var A=s.interleaved;A===null?(f.next=f,Oc(s)):(f.next=A.next,A.next=f),s.interleaved=f;return}}catch{}finally{}a=Zf(n,s,f,u),a!==null&&(f=Rt(),kn(a,n,u,f),Sh(a,s,u))}}function wh(n){var s=n.alternate;return n===qe||s!==null&&s===qe}function jh(n,s){la=Mo=!0;var a=n.pending;a===null?s.next=s:(s.next=a.next,a.next=s),n.pending=s}function Sh(n,s,a){if((a&4194240)!==0){var u=s.lanes;u&=n.pendingLanes,a|=u,s.lanes=a,Xl(n,a)}}var _o={readContext:tn,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useInsertionEffect:wt,useLayoutEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useMutableSource:wt,useSyncExternalStore:wt,useId:wt,unstable_isNewReconciler:!1},sk={readContext:tn,useCallback:function(n,s){return In().memoizedState=[n,s===void 0?null:s],n},useContext:tn,useEffect:fh,useImperativeHandle:function(n,s,a){return a=a!=null?a.concat([n]):null,Oo(4194308,4,gh.bind(null,s,n),a)},useLayoutEffect:function(n,s){return Oo(4194308,4,n,s)},useInsertionEffect:function(n,s){return Oo(4,2,n,s)},useMemo:function(n,s){var a=In();return s=s===void 0?null:s,n=n(),a.memoizedState=[n,s],n},useReducer:function(n,s,a){var u=In();return s=a!==void 0?a(s):s,u.memoizedState=u.baseState=s,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:s},u.queue=n,n=n.dispatch=nk.bind(null,qe,n),[u.memoizedState,n]},useRef:function(n){var s=In();return n={current:n},s.memoizedState=n},useState:dh,useDebugValue:Gc,useDeferredValue:function(n){return In().memoizedState=n},useTransition:function(){var n=dh(!1),s=n[0];return n=tk.bind(null,n[1]),In().memoizedState=n,[s,n]},useMutableSource:function(){},useSyncExternalStore:function(n,s,a){var u=qe,f=In();if(He){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),pt===null)throw Error(r(349));(ds&30)!==0||ah(u,s,a)}f.memoizedState=a;var g={value:a,getSnapshot:s};return f.queue=g,fh(lh.bind(null,u,g,n),[n]),u.flags|=2048,da(9,oh.bind(null,u,g,a,s),void 0,null),a},useId:function(){var n=In(),s=pt.identifierPrefix;if(He){var a=Gn,u=Qn;a=(u&~(1<<32-mn(u)-1)).toString(32)+a,s=":"+s+"R"+a,a=ca++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=ek++,s=":"+s+"r"+a.toString(32)+":";return n.memoizedState=s},unstable_isNewReconciler:!1},ik={readContext:tn,useCallback:yh,useContext:tn,useEffect:Qc,useImperativeHandle:xh,useInsertionEffect:hh,useLayoutEffect:mh,useMemo:vh,useReducer:Kc,useRef:ph,useState:function(){return Kc(ua)},useDebugValue:Gc,useDeferredValue:function(n){var s=nn();return bh(s,ot.memoizedState,n)},useTransition:function(){var n=Kc(ua)[0],s=nn().memoizedState;return[n,s]},useMutableSource:sh,useSyncExternalStore:ih,useId:kh,unstable_isNewReconciler:!1},ak={readContext:tn,useCallback:yh,useContext:tn,useEffect:Qc,useImperativeHandle:xh,useInsertionEffect:hh,useLayoutEffect:mh,useMemo:vh,useReducer:qc,useRef:ph,useState:function(){return qc(ua)},useDebugValue:Gc,useDeferredValue:function(n){var s=nn();return ot===null?s.memoizedState=n:bh(s,ot.memoizedState,n)},useTransition:function(){var n=qc(ua)[0],s=nn().memoizedState;return[n,s]},useMutableSource:sh,useSyncExternalStore:ih,useId:kh,unstable_isNewReconciler:!1};function yn(n,s){if(n&&n.defaultProps){s=J({},s),n=n.defaultProps;for(var a in n)s[a]===void 0&&(s[a]=n[a]);return s}return s}function Yc(n,s,a,u){s=n.memoizedState,a=a(u,s),a=a==null?s:J({},s,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var zo={isMounted:function(n){return(n=n._reactInternals)?ss(n)===n:!1},enqueueSetState:function(n,s,a){n=n._reactInternals;var u=Rt(),f=Dr(n),g=Xn(u,f);g.payload=s,a!=null&&(g.callback=a),s=Er(n,g,f),s!==null&&(kn(s,n,f,u),Do(s,n,f))},enqueueReplaceState:function(n,s,a){n=n._reactInternals;var u=Rt(),f=Dr(n),g=Xn(u,f);g.tag=1,g.payload=s,a!=null&&(g.callback=a),s=Er(n,g,f),s!==null&&(kn(s,n,f,u),Do(s,n,f))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var a=Rt(),u=Dr(n),f=Xn(a,u);f.tag=2,s!=null&&(f.callback=s),s=Er(n,f,u),s!==null&&(kn(s,n,u,a),Do(s,n,u))}};function Ch(n,s,a,u,f,g,C){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,g,C):s.prototype&&s.prototype.isPureReactComponent?!Xi(a,u)||!Xi(f,g):!0}function Nh(n,s,a){var u=!1,f=Sr,g=s.contextType;return typeof g=="object"&&g!==null?g=tn(g):(f=Ot(s)?as:kt.current,u=s.contextTypes,g=(u=u!=null)?Qs(n,f):Sr),s=new s(a,g),n.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=zo,n.stateNode=s,s._reactInternals=n,u&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=f,n.__reactInternalMemoizedMaskedChildContext=g),s}function Eh(n,s,a,u){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,u),s.state!==n&&zo.enqueueReplaceState(s,s.state,null)}function Xc(n,s,a,u){var f=n.stateNode;f.props=a,f.state=n.memoizedState,f.refs={},Fc(n);var g=s.contextType;typeof g=="object"&&g!==null?f.context=tn(g):(g=Ot(s)?as:kt.current,f.context=Qs(n,g)),f.state=n.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(Yc(n,s,g,a),f.state=n.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(s=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),s!==f.state&&zo.enqueueReplaceState(f,f.state,null),Lo(n,a,f,u),f.state=n.memoizedState),typeof f.componentDidMount=="function"&&(n.flags|=4194308)}function ni(n,s){try{var a="",u=s;do a+=ye(u),u=u.return;while(u);var f=a}catch(g){f=`
|
|
39
|
+
Error generating stack: `+g.message+`
|
|
40
|
+
`+g.stack}return{value:n,source:s,stack:f,digest:null}}function Jc(n,s,a){return{value:n,source:null,stack:a??null,digest:s??null}}function Zc(n,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var ok=typeof WeakMap=="function"?WeakMap:Map;function Ph(n,s,a){a=Xn(-1,a),a.tag=3,a.payload={element:null};var u=s.value;return a.callback=function(){Ko||(Ko=!0,hu=u),Zc(n,s)},a}function Th(n,s,a){a=Xn(-1,a),a.tag=3;var u=n.type.getDerivedStateFromError;if(typeof u=="function"){var f=s.value;a.payload=function(){return u(f)},a.callback=function(){Zc(n,s)}}var g=n.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(a.callback=function(){Zc(n,s),typeof u!="function"&&(Tr===null?Tr=new Set([this]):Tr.add(this));var C=s.stack;this.componentDidCatch(s.value,{componentStack:C!==null?C:""})}),a}function Rh(n,s,a){var u=n.pingCache;if(u===null){u=n.pingCache=new ok;var f=new Set;u.set(s,f)}else f=u.get(s),f===void 0&&(f=new Set,u.set(s,f));f.has(a)||(f.add(a),n=kk.bind(null,n,s,a),s.then(n,n))}function Dh(n){do{var s;if((s=n.tag===13)&&(s=n.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return n;n=n.return}while(n!==null);return null}function Lh(n,s,a,u,f){return(n.mode&1)===0?(n===s?n.flags|=65536:(n.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(s=Xn(-1,1),s.tag=2,Er(a,s,1))),a.lanes|=1),n):(n.flags|=65536,n.lanes=f,n)}var lk=E.ReactCurrentOwner,Ft=!1;function Tt(n,s,a,u){s.child=n===null?Jf(s,null,a,u):Js(s,n.child,a,u)}function Ih(n,s,a,u,f){a=a.render;var g=s.ref;return ei(s,f),u=Wc(n,s,a,u,g,f),a=Hc(),n!==null&&!Ft?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~f,Jn(n,s,f)):(He&&a&&Ec(s),s.flags|=1,Tt(n,s,u,f),s.child)}function Ah(n,s,a,u,f){if(n===null){var g=a.type;return typeof g=="function"&&!ku(g)&&g.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=g,Mh(n,s,g,u,f)):(n=Jo(a.type,null,u,s,s.mode,f),n.ref=s.ref,n.return=s,s.child=n)}if(g=n.child,(n.lanes&f)===0){var C=g.memoizedProps;if(a=a.compare,a=a!==null?a:Xi,a(C,u)&&n.ref===s.ref)return Jn(n,s,f)}return s.flags|=1,n=Ir(g,u),n.ref=s.ref,n.return=s,s.child=n}function Mh(n,s,a,u,f){if(n!==null){var g=n.memoizedProps;if(Xi(g,u)&&n.ref===s.ref)if(Ft=!1,s.pendingProps=u=g,(n.lanes&f)!==0)(n.flags&131072)!==0&&(Ft=!0);else return s.lanes=n.lanes,Jn(n,s,f)}return eu(n,s,a,u,f)}function Oh(n,s,a){var u=s.pendingProps,f=u.children,g=n!==null?n.memoizedState:null;if(u.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},ze(si,Yt),Yt|=a;else{if((a&1073741824)===0)return n=g!==null?g.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:n,cachePool:null,transitions:null},s.updateQueue=null,ze(si,Yt),Yt|=n,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=g!==null?g.baseLanes:a,ze(si,Yt),Yt|=u}else g!==null?(u=g.baseLanes|a,s.memoizedState=null):u=a,ze(si,Yt),Yt|=u;return Tt(n,s,f,a),s.child}function Fh(n,s){var a=s.ref;(n===null&&a!==null||n!==null&&n.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function eu(n,s,a,u,f){var g=Ot(a)?as:kt.current;return g=Qs(s,g),ei(s,f),a=Wc(n,s,a,u,g,f),u=Hc(),n!==null&&!Ft?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~f,Jn(n,s,f)):(He&&u&&Ec(s),s.flags|=1,Tt(n,s,a,f),s.child)}function _h(n,s,a,u,f){if(Ot(a)){var g=!0;jo(s)}else g=!1;if(ei(s,f),s.stateNode===null)Bo(n,s),Nh(s,a,u),Xc(s,a,u,f),u=!0;else if(n===null){var C=s.stateNode,D=s.memoizedProps;C.props=D;var A=C.context,U=a.contextType;typeof U=="object"&&U!==null?U=tn(U):(U=Ot(a)?as:kt.current,U=Qs(s,U));var Z=a.getDerivedStateFromProps,ee=typeof Z=="function"||typeof C.getSnapshotBeforeUpdate=="function";ee||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(D!==u||A!==U)&&Eh(s,C,u,U),Nr=!1;var Y=s.memoizedState;C.state=Y,Lo(s,u,C,f),A=s.memoizedState,D!==u||Y!==A||Mt.current||Nr?(typeof Z=="function"&&(Yc(s,a,Z,u),A=s.memoizedState),(D=Nr||Ch(s,a,D,u,Y,A,U))?(ee||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(s.flags|=4194308)):(typeof C.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=A),C.props=u,C.state=A,C.context=U,u=D):(typeof C.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{C=s.stateNode,eh(n,s),D=s.memoizedProps,U=s.type===s.elementType?D:yn(s.type,D),C.props=U,ee=s.pendingProps,Y=C.context,A=a.contextType,typeof A=="object"&&A!==null?A=tn(A):(A=Ot(a)?as:kt.current,A=Qs(s,A));var oe=a.getDerivedStateFromProps;(Z=typeof oe=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(D!==ee||Y!==A)&&Eh(s,C,u,A),Nr=!1,Y=s.memoizedState,C.state=Y,Lo(s,u,C,f);var ce=s.memoizedState;D!==ee||Y!==ce||Mt.current||Nr?(typeof oe=="function"&&(Yc(s,a,oe,u),ce=s.memoizedState),(U=Nr||Ch(s,a,U,u,Y,ce,A)||!1)?(Z||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(u,ce,A),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(u,ce,A)),typeof C.componentDidUpdate=="function"&&(s.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof C.componentDidUpdate!="function"||D===n.memoizedProps&&Y===n.memoizedState||(s.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||D===n.memoizedProps&&Y===n.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=ce),C.props=u,C.state=ce,C.context=A,u=U):(typeof C.componentDidUpdate!="function"||D===n.memoizedProps&&Y===n.memoizedState||(s.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||D===n.memoizedProps&&Y===n.memoizedState||(s.flags|=1024),u=!1)}return tu(n,s,a,u,g,f)}function tu(n,s,a,u,f,g){Fh(n,s);var C=(s.flags&128)!==0;if(!u&&!C)return f&&Uf(s,a,!1),Jn(n,s,g);u=s.stateNode,lk.current=s;var D=C&&typeof a.getDerivedStateFromError!="function"?null:u.render();return s.flags|=1,n!==null&&C?(s.child=Js(s,n.child,null,g),s.child=Js(s,null,D,g)):Tt(n,s,D,g),s.memoizedState=u.state,f&&Uf(s,a,!0),s.child}function zh(n){var s=n.stateNode;s.pendingContext?Bf(n,s.pendingContext,s.pendingContext!==s.context):s.context&&Bf(n,s.context,!1),_c(n,s.containerInfo)}function Vh(n,s,a,u,f){return Xs(),Dc(f),s.flags|=256,Tt(n,s,a,u),s.child}var nu={dehydrated:null,treeContext:null,retryLane:0};function ru(n){return{baseLanes:n,cachePool:null,transitions:null}}function Bh(n,s,a){var u=s.pendingProps,f=Ke.current,g=!1,C=(s.flags&128)!==0,D;if((D=C)||(D=n!==null&&n.memoizedState===null?!1:(f&2)!==0),D?(g=!0,s.flags&=-129):(n===null||n.memoizedState!==null)&&(f|=1),ze(Ke,f&1),n===null)return Rc(s),n=s.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((s.mode&1)===0?s.lanes=1:n.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(C=u.children,n=u.fallback,g?(u=s.mode,g=s.child,C={mode:"hidden",children:C},(u&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=C):g=Zo(C,u,0,null),n=gs(n,u,a,null),g.return=s,n.return=s,g.sibling=n,s.child=g,s.child.memoizedState=ru(a),s.memoizedState=nu,n):su(s,C));if(f=n.memoizedState,f!==null&&(D=f.dehydrated,D!==null))return ck(n,s,C,u,D,f,a);if(g){g=u.fallback,C=s.mode,f=n.child,D=f.sibling;var A={mode:"hidden",children:u.children};return(C&1)===0&&s.child!==f?(u=s.child,u.childLanes=0,u.pendingProps=A,s.deletions=null):(u=Ir(f,A),u.subtreeFlags=f.subtreeFlags&14680064),D!==null?g=Ir(D,g):(g=gs(g,C,a,null),g.flags|=2),g.return=s,u.return=s,u.sibling=g,s.child=u,u=g,g=s.child,C=n.child.memoizedState,C=C===null?ru(a):{baseLanes:C.baseLanes|a,cachePool:null,transitions:C.transitions},g.memoizedState=C,g.childLanes=n.childLanes&~a,s.memoizedState=nu,u}return g=n.child,n=g.sibling,u=Ir(g,{mode:"visible",children:u.children}),(s.mode&1)===0&&(u.lanes=a),u.return=s,u.sibling=null,n!==null&&(a=s.deletions,a===null?(s.deletions=[n],s.flags|=16):a.push(n)),s.child=u,s.memoizedState=null,u}function su(n,s){return s=Zo({mode:"visible",children:s},n.mode,0,null),s.return=n,n.child=s}function Vo(n,s,a,u){return u!==null&&Dc(u),Js(s,n.child,null,a),n=su(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function ck(n,s,a,u,f,g,C){if(a)return s.flags&256?(s.flags&=-257,u=Jc(Error(r(422))),Vo(n,s,C,u)):s.memoizedState!==null?(s.child=n.child,s.flags|=128,null):(g=u.fallback,f=s.mode,u=Zo({mode:"visible",children:u.children},f,0,null),g=gs(g,f,C,null),g.flags|=2,u.return=s,g.return=s,u.sibling=g,s.child=u,(s.mode&1)!==0&&Js(s,n.child,null,C),s.child.memoizedState=ru(C),s.memoizedState=nu,g);if((s.mode&1)===0)return Vo(n,s,C,null);if(f.data==="$!"){if(u=f.nextSibling&&f.nextSibling.dataset,u)var D=u.dgst;return u=D,g=Error(r(419)),u=Jc(g,u,void 0),Vo(n,s,C,u)}if(D=(C&n.childLanes)!==0,Ft||D){if(u=pt,u!==null){switch(C&-C){case 4:f=2;break;case 16:f=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(u.suspendedLanes|C))!==0?0:f,f!==0&&f!==g.retryLane&&(g.retryLane=f,Yn(n,f),kn(u,n,f,-1))}return bu(),u=Jc(Error(r(421))),Vo(n,s,C,u)}return f.data==="$?"?(s.flags|=128,s.child=n.child,s=wk.bind(null,n),f._reactRetry=s,null):(n=g.treeContext,Gt=wr(f.nextSibling),Qt=s,He=!0,xn=null,n!==null&&(Zt[en++]=Qn,Zt[en++]=Gn,Zt[en++]=os,Qn=n.id,Gn=n.overflow,os=s),s=su(s,u.children),s.flags|=4096,s)}function $h(n,s,a){n.lanes|=s;var u=n.alternate;u!==null&&(u.lanes|=s),Mc(n.return,s,a)}function iu(n,s,a,u,f){var g=n.memoizedState;g===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:a,tailMode:f}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=u,g.tail=a,g.tailMode=f)}function Uh(n,s,a){var u=s.pendingProps,f=u.revealOrder,g=u.tail;if(Tt(n,s,u.children,a),u=Ke.current,(u&2)!==0)u=u&1|2,s.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&$h(n,a,s);else if(n.tag===19)$h(n,a,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}u&=1}if(ze(Ke,u),(s.mode&1)===0)s.memoizedState=null;else switch(f){case"forwards":for(a=s.child,f=null;a!==null;)n=a.alternate,n!==null&&Io(n)===null&&(f=a),a=a.sibling;a=f,a===null?(f=s.child,s.child=null):(f=a.sibling,a.sibling=null),iu(s,!1,f,a,g);break;case"backwards":for(a=null,f=s.child,s.child=null;f!==null;){if(n=f.alternate,n!==null&&Io(n)===null){s.child=f;break}n=f.sibling,f.sibling=a,a=f,f=n}iu(s,!0,a,null,g);break;case"together":iu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Bo(n,s){(s.mode&1)===0&&n!==null&&(n.alternate=null,s.alternate=null,s.flags|=2)}function Jn(n,s,a){if(n!==null&&(s.dependencies=n.dependencies),ps|=s.lanes,(a&s.childLanes)===0)return null;if(n!==null&&s.child!==n.child)throw Error(r(153));if(s.child!==null){for(n=s.child,a=Ir(n,n.pendingProps),s.child=a,a.return=s;n.sibling!==null;)n=n.sibling,a=a.sibling=Ir(n,n.pendingProps),a.return=s;a.sibling=null}return s.child}function uk(n,s,a){switch(s.tag){case 3:zh(s),Xs();break;case 5:rh(s);break;case 1:Ot(s.type)&&jo(s);break;case 4:_c(s,s.stateNode.containerInfo);break;case 10:var u=s.type._context,f=s.memoizedProps.value;ze(To,u._currentValue),u._currentValue=f;break;case 13:if(u=s.memoizedState,u!==null)return u.dehydrated!==null?(ze(Ke,Ke.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?Bh(n,s,a):(ze(Ke,Ke.current&1),n=Jn(n,s,a),n!==null?n.sibling:null);ze(Ke,Ke.current&1);break;case 19:if(u=(a&s.childLanes)!==0,(n.flags&128)!==0){if(u)return Uh(n,s,a);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),ze(Ke,Ke.current),u)break;return null;case 22:case 23:return s.lanes=0,Oh(n,s,a)}return Jn(n,s,a)}var Wh,au,Hh,Kh;Wh=function(n,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)n.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},au=function(){},Hh=function(n,s,a,u){var f=n.memoizedProps;if(f!==u){n=s.stateNode,us(Ln.current);var g=null;switch(a){case"input":f=pn(n,f),u=pn(n,u),g=[];break;case"select":f=J({},f,{value:void 0}),u=J({},u,{value:void 0}),g=[];break;case"textarea":f=Zr(n,f),u=Zr(n,u),g=[];break;default:typeof f.onClick!="function"&&typeof u.onClick=="function"&&(n.onclick=bo)}$n(a,u);var C;a=null;for(U in f)if(!u.hasOwnProperty(U)&&f.hasOwnProperty(U)&&f[U]!=null)if(U==="style"){var D=f[U];for(C in D)D.hasOwnProperty(C)&&(a||(a={}),a[C]="")}else U!=="dangerouslySetInnerHTML"&&U!=="children"&&U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&U!=="autoFocus"&&(l.hasOwnProperty(U)?g||(g=[]):(g=g||[]).push(U,null));for(U in u){var A=u[U];if(D=f!=null?f[U]:void 0,u.hasOwnProperty(U)&&A!==D&&(A!=null||D!=null))if(U==="style")if(D){for(C in D)!D.hasOwnProperty(C)||A&&A.hasOwnProperty(C)||(a||(a={}),a[C]="");for(C in A)A.hasOwnProperty(C)&&D[C]!==A[C]&&(a||(a={}),a[C]=A[C])}else a||(g||(g=[]),g.push(U,a)),a=A;else U==="dangerouslySetInnerHTML"?(A=A?A.__html:void 0,D=D?D.__html:void 0,A!=null&&D!==A&&(g=g||[]).push(U,A)):U==="children"?typeof A!="string"&&typeof A!="number"||(g=g||[]).push(U,""+A):U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&(l.hasOwnProperty(U)?(A!=null&&U==="onScroll"&&Be("scroll",n),g||D===A||(g=[])):(g=g||[]).push(U,A))}a&&(g=g||[]).push("style",a);var U=g;(s.updateQueue=U)&&(s.flags|=4)}},Kh=function(n,s,a,u){a!==u&&(s.flags|=4)};function pa(n,s){if(!He)switch(n.tailMode){case"hidden":s=n.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?n.tail=null:a.sibling=null;break;case"collapsed":a=n.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function jt(n){var s=n.alternate!==null&&n.alternate.child===n.child,a=0,u=0;if(s)for(var f=n.child;f!==null;)a|=f.lanes|f.childLanes,u|=f.subtreeFlags&14680064,u|=f.flags&14680064,f.return=n,f=f.sibling;else for(f=n.child;f!==null;)a|=f.lanes|f.childLanes,u|=f.subtreeFlags,u|=f.flags,f.return=n,f=f.sibling;return n.subtreeFlags|=u,n.childLanes=a,s}function dk(n,s,a){var u=s.pendingProps;switch(Pc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jt(s),null;case 1:return Ot(s.type)&&wo(),jt(s),null;case 3:return u=s.stateNode,ti(),$e(Mt),$e(kt),Bc(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(n===null||n.child===null)&&(Eo(s)?s.flags|=4:n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,xn!==null&&(xu(xn),xn=null))),au(n,s),jt(s),null;case 5:zc(s);var f=us(oa.current);if(a=s.type,n!==null&&s.stateNode!=null)Hh(n,s,a,u,f),n.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!u){if(s.stateNode===null)throw Error(r(166));return jt(s),null}if(n=us(Ln.current),Eo(s)){u=s.stateNode,a=s.type;var g=s.memoizedProps;switch(u[Dn]=s,u[na]=g,n=(s.mode&1)!==0,a){case"dialog":Be("cancel",u),Be("close",u);break;case"iframe":case"object":case"embed":Be("load",u);break;case"video":case"audio":for(f=0;f<Zi.length;f++)Be(Zi[f],u);break;case"source":Be("error",u);break;case"img":case"image":case"link":Be("error",u),Be("load",u);break;case"details":Be("toggle",u);break;case"input":fn(u,g),Be("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!g.multiple},Be("invalid",u);break;case"textarea":es(u,g),Be("invalid",u)}$n(a,g),f=null;for(var C in g)if(g.hasOwnProperty(C)){var D=g[C];C==="children"?typeof D=="string"?u.textContent!==D&&(g.suppressHydrationWarning!==!0&&vo(u.textContent,D,n),f=["children",D]):typeof D=="number"&&u.textContent!==""+D&&(g.suppressHydrationWarning!==!0&&vo(u.textContent,D,n),f=["children",""+D]):l.hasOwnProperty(C)&&D!=null&&C==="onScroll"&&Be("scroll",u)}switch(a){case"input":Pt(u),bt(u,g,!0);break;case"textarea":Pt(u),ie(u);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(u.onclick=bo)}u=f,s.updateQueue=u,u!==null&&(s.flags|=4)}else{C=f.nodeType===9?f:f.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=pe(a)),n==="http://www.w3.org/1999/xhtml"?a==="script"?(n=C.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof u.is=="string"?n=C.createElement(a,{is:u.is}):(n=C.createElement(a),a==="select"&&(C=n,u.multiple?C.multiple=!0:u.size&&(C.size=u.size))):n=C.createElementNS(n,a),n[Dn]=s,n[na]=u,Wh(n,s,!1,!1),s.stateNode=n;e:{switch(C=Un(a,u),a){case"dialog":Be("cancel",n),Be("close",n),f=u;break;case"iframe":case"object":case"embed":Be("load",n),f=u;break;case"video":case"audio":for(f=0;f<Zi.length;f++)Be(Zi[f],n);f=u;break;case"source":Be("error",n),f=u;break;case"img":case"image":case"link":Be("error",n),Be("load",n),f=u;break;case"details":Be("toggle",n),f=u;break;case"input":fn(n,u),f=pn(n,u),Be("invalid",n);break;case"option":f=u;break;case"select":n._wrapperState={wasMultiple:!!u.multiple},f=J({},u,{value:void 0}),Be("invalid",n);break;case"textarea":es(n,u),f=Zr(n,u),Be("invalid",n);break;default:f=u}$n(a,f),D=f;for(g in D)if(D.hasOwnProperty(g)){var A=D[g];g==="style"?fr(n,A):g==="dangerouslySetInnerHTML"?(A=A?A.__html:void 0,A!=null&&Ye(n,A)):g==="children"?typeof A=="string"?(a!=="textarea"||A!=="")&&it(n,A):typeof A=="number"&&it(n,""+A):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(l.hasOwnProperty(g)?A!=null&&g==="onScroll"&&Be("scroll",n):A!=null&&k(n,g,A,C))}switch(a){case"input":Pt(n),bt(n,u,!1);break;case"textarea":Pt(n),ie(n);break;case"option":u.value!=null&&n.setAttribute("value",""+Ce(u.value));break;case"select":n.multiple=!!u.multiple,g=u.value,g!=null?Kt(n,!!u.multiple,g,!1):u.defaultValue!=null&&Kt(n,!!u.multiple,u.defaultValue,!0);break;default:typeof f.onClick=="function"&&(n.onclick=bo)}switch(a){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return jt(s),null;case 6:if(n&&s.stateNode!=null)Kh(n,s,n.memoizedProps,u);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(a=us(oa.current),us(Ln.current),Eo(s)){if(u=s.stateNode,a=s.memoizedProps,u[Dn]=s,(g=u.nodeValue!==a)&&(n=Qt,n!==null))switch(n.tag){case 3:vo(u.nodeValue,a,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&vo(u.nodeValue,a,(n.mode&1)!==0)}g&&(s.flags|=4)}else u=(a.nodeType===9?a:a.ownerDocument).createTextNode(u),u[Dn]=s,s.stateNode=u}return jt(s),null;case 13:if($e(Ke),u=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(He&&Gt!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Gf(),Xs(),s.flags|=98560,g=!1;else if(g=Eo(s),u!==null&&u.dehydrated!==null){if(n===null){if(!g)throw Error(r(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[Dn]=s}else Xs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;jt(s),g=!1}else xn!==null&&(xu(xn),xn=null),g=!0;if(!g)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(u=u!==null,u!==(n!==null&&n.memoizedState!==null)&&u&&(s.child.flags|=8192,(s.mode&1)!==0&&(n===null||(Ke.current&1)!==0?lt===0&&(lt=3):bu())),s.updateQueue!==null&&(s.flags|=4),jt(s),null);case 4:return ti(),au(n,s),n===null&&ea(s.stateNode.containerInfo),jt(s),null;case 10:return Ac(s.type._context),jt(s),null;case 17:return Ot(s.type)&&wo(),jt(s),null;case 19:if($e(Ke),g=s.memoizedState,g===null)return jt(s),null;if(u=(s.flags&128)!==0,C=g.rendering,C===null)if(u)pa(g,!1);else{if(lt!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(C=Io(n),C!==null){for(s.flags|=128,pa(g,!1),u=C.updateQueue,u!==null&&(s.updateQueue=u,s.flags|=4),s.subtreeFlags=0,u=a,a=s.child;a!==null;)g=a,n=u,g.flags&=14680066,C=g.alternate,C===null?(g.childLanes=0,g.lanes=n,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=C.childLanes,g.lanes=C.lanes,g.child=C.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=C.memoizedProps,g.memoizedState=C.memoizedState,g.updateQueue=C.updateQueue,g.type=C.type,n=C.dependencies,g.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),a=a.sibling;return ze(Ke,Ke.current&1|2),s.child}n=n.sibling}g.tail!==null&&tt()>ii&&(s.flags|=128,u=!0,pa(g,!1),s.lanes=4194304)}else{if(!u)if(n=Io(C),n!==null){if(s.flags|=128,u=!0,a=n.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),pa(g,!0),g.tail===null&&g.tailMode==="hidden"&&!C.alternate&&!He)return jt(s),null}else 2*tt()-g.renderingStartTime>ii&&a!==1073741824&&(s.flags|=128,u=!0,pa(g,!1),s.lanes=4194304);g.isBackwards?(C.sibling=s.child,s.child=C):(a=g.last,a!==null?a.sibling=C:s.child=C,g.last=C)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=tt(),s.sibling=null,a=Ke.current,ze(Ke,u?a&1|2:a&1),s):(jt(s),null);case 22:case 23:return vu(),u=s.memoizedState!==null,n!==null&&n.memoizedState!==null!==u&&(s.flags|=8192),u&&(s.mode&1)!==0?(Yt&1073741824)!==0&&(jt(s),s.subtreeFlags&6&&(s.flags|=8192)):jt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function pk(n,s){switch(Pc(s),s.tag){case 1:return Ot(s.type)&&wo(),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return ti(),$e(Mt),$e(kt),Bc(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 5:return zc(s),null;case 13:if($e(Ke),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Xs()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return $e(Ke),null;case 4:return ti(),null;case 10:return Ac(s.type._context),null;case 22:case 23:return vu(),null;case 24:return null;default:return null}}var $o=!1,St=!1,fk=typeof WeakSet=="function"?WeakSet:Set,le=null;function ri(n,s){var a=n.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(u){Xe(n,s,u)}else a.current=null}function ou(n,s,a){try{a()}catch(u){Xe(n,s,u)}}var qh=!1;function hk(n,s){if(vc=oo,n=Cf(),dc(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var u=a.getSelection&&a.getSelection();if(u&&u.rangeCount!==0){a=u.anchorNode;var f=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{a.nodeType,g.nodeType}catch{a=null;break e}var C=0,D=-1,A=-1,U=0,Z=0,ee=n,Y=null;t:for(;;){for(var oe;ee!==a||f!==0&&ee.nodeType!==3||(D=C+f),ee!==g||u!==0&&ee.nodeType!==3||(A=C+u),ee.nodeType===3&&(C+=ee.nodeValue.length),(oe=ee.firstChild)!==null;)Y=ee,ee=oe;for(;;){if(ee===n)break t;if(Y===a&&++U===f&&(D=C),Y===g&&++Z===u&&(A=C),(oe=ee.nextSibling)!==null)break;ee=Y,Y=ee.parentNode}ee=oe}a=D===-1||A===-1?null:{start:D,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for(bc={focusedElem:n,selectionRange:a},oo=!1,le=s;le!==null;)if(s=le,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,le=n;else for(;le!==null;){s=le;try{var ce=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(ce!==null){var ue=ce.memoizedProps,nt=ce.memoizedState,z=s.stateNode,F=z.getSnapshotBeforeUpdate(s.elementType===s.type?ue:yn(s.type,ue),nt);z.__reactInternalSnapshotBeforeUpdate=F}break;case 3:var V=s.stateNode.containerInfo;V.nodeType===1?V.textContent="":V.nodeType===9&&V.documentElement&&V.removeChild(V.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(re){Xe(s,s.return,re)}if(n=s.sibling,n!==null){n.return=s.return,le=n;break}le=s.return}return ce=qh,qh=!1,ce}function fa(n,s,a){var u=s.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var f=u=u.next;do{if((f.tag&n)===n){var g=f.destroy;f.destroy=void 0,g!==void 0&&ou(s,a,g)}f=f.next}while(f!==u)}}function Uo(n,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&n)===n){var u=a.create;a.destroy=u()}a=a.next}while(a!==s)}}function lu(n){var s=n.ref;if(s!==null){var a=n.stateNode;switch(n.tag){case 5:n=a;break;default:n=a}typeof s=="function"?s(n):s.current=n}}function Qh(n){var s=n.alternate;s!==null&&(n.alternate=null,Qh(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&(delete s[Dn],delete s[na],delete s[Sc],delete s[Yb],delete s[Xb])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function Gh(n){return n.tag===5||n.tag===3||n.tag===4}function Yh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Gh(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function cu(n,s,a){var u=n.tag;if(u===5||u===6)n=n.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(n,s):a.insertBefore(n,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(n,a)):(s=a,s.appendChild(n)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=bo));else if(u!==4&&(n=n.child,n!==null))for(cu(n,s,a),n=n.sibling;n!==null;)cu(n,s,a),n=n.sibling}function uu(n,s,a){var u=n.tag;if(u===5||u===6)n=n.stateNode,s?a.insertBefore(n,s):a.appendChild(n);else if(u!==4&&(n=n.child,n!==null))for(uu(n,s,a),n=n.sibling;n!==null;)uu(n,s,a),n=n.sibling}var gt=null,vn=!1;function Pr(n,s,a){for(a=a.child;a!==null;)Xh(n,s,a),a=a.sibling}function Xh(n,s,a){if(Rn&&typeof Rn.onCommitFiberUnmount=="function")try{Rn.onCommitFiberUnmount(to,a)}catch{}switch(a.tag){case 5:St||ri(a,s);case 6:var u=gt,f=vn;gt=null,Pr(n,s,a),gt=u,vn=f,gt!==null&&(vn?(n=gt,a=a.stateNode,n.nodeType===8?n.parentNode.removeChild(a):n.removeChild(a)):gt.removeChild(a.stateNode));break;case 18:gt!==null&&(vn?(n=gt,a=a.stateNode,n.nodeType===8?jc(n.parentNode,a):n.nodeType===1&&jc(n,a),Hi(n)):jc(gt,a.stateNode));break;case 4:u=gt,f=vn,gt=a.stateNode.containerInfo,vn=!0,Pr(n,s,a),gt=u,vn=f;break;case 0:case 11:case 14:case 15:if(!St&&(u=a.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){f=u=u.next;do{var g=f,C=g.destroy;g=g.tag,C!==void 0&&((g&2)!==0||(g&4)!==0)&&ou(a,s,C),f=f.next}while(f!==u)}Pr(n,s,a);break;case 1:if(!St&&(ri(a,s),u=a.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=a.memoizedProps,u.state=a.memoizedState,u.componentWillUnmount()}catch(D){Xe(a,s,D)}Pr(n,s,a);break;case 21:Pr(n,s,a);break;case 22:a.mode&1?(St=(u=St)||a.memoizedState!==null,Pr(n,s,a),St=u):Pr(n,s,a);break;default:Pr(n,s,a)}}function Jh(n){var s=n.updateQueue;if(s!==null){n.updateQueue=null;var a=n.stateNode;a===null&&(a=n.stateNode=new fk),s.forEach(function(u){var f=jk.bind(null,n,u);a.has(u)||(a.add(u),u.then(f,f))})}}function bn(n,s){var a=s.deletions;if(a!==null)for(var u=0;u<a.length;u++){var f=a[u];try{var g=n,C=s,D=C;e:for(;D!==null;){switch(D.tag){case 5:gt=D.stateNode,vn=!1;break e;case 3:gt=D.stateNode.containerInfo,vn=!0;break e;case 4:gt=D.stateNode.containerInfo,vn=!0;break e}D=D.return}if(gt===null)throw Error(r(160));Xh(g,C,f),gt=null,vn=!1;var A=f.alternate;A!==null&&(A.return=null),f.return=null}catch(U){Xe(f,s,U)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Zh(s,n),s=s.sibling}function Zh(n,s){var a=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(bn(s,n),An(n),u&4){try{fa(3,n,n.return),Uo(3,n)}catch(ue){Xe(n,n.return,ue)}try{fa(5,n,n.return)}catch(ue){Xe(n,n.return,ue)}}break;case 1:bn(s,n),An(n),u&512&&a!==null&&ri(a,a.return);break;case 5:if(bn(s,n),An(n),u&512&&a!==null&&ri(a,a.return),n.flags&32){var f=n.stateNode;try{it(f,"")}catch(ue){Xe(n,n.return,ue)}}if(u&4&&(f=n.stateNode,f!=null)){var g=n.memoizedProps,C=a!==null?a.memoizedProps:g,D=n.type,A=n.updateQueue;if(n.updateQueue=null,A!==null)try{D==="input"&&g.type==="radio"&&g.name!=null&&Pn(f,g),Un(D,C);var U=Un(D,g);for(C=0;C<A.length;C+=2){var Z=A[C],ee=A[C+1];Z==="style"?fr(f,ee):Z==="dangerouslySetInnerHTML"?Ye(f,ee):Z==="children"?it(f,ee):k(f,Z,ee,U)}switch(D){case"input":hn(f,g);break;case"textarea":ts(f,g);break;case"select":var Y=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!g.multiple;var oe=g.value;oe!=null?Kt(f,!!g.multiple,oe,!1):Y!==!!g.multiple&&(g.defaultValue!=null?Kt(f,!!g.multiple,g.defaultValue,!0):Kt(f,!!g.multiple,g.multiple?[]:"",!1))}f[na]=g}catch(ue){Xe(n,n.return,ue)}}break;case 6:if(bn(s,n),An(n),u&4){if(n.stateNode===null)throw Error(r(162));f=n.stateNode,g=n.memoizedProps;try{f.nodeValue=g}catch(ue){Xe(n,n.return,ue)}}break;case 3:if(bn(s,n),An(n),u&4&&a!==null&&a.memoizedState.isDehydrated)try{Hi(s.containerInfo)}catch(ue){Xe(n,n.return,ue)}break;case 4:bn(s,n),An(n);break;case 13:bn(s,n),An(n),f=n.child,f.flags&8192&&(g=f.memoizedState!==null,f.stateNode.isHidden=g,!g||f.alternate!==null&&f.alternate.memoizedState!==null||(fu=tt())),u&4&&Jh(n);break;case 22:if(Z=a!==null&&a.memoizedState!==null,n.mode&1?(St=(U=St)||Z,bn(s,n),St=U):bn(s,n),An(n),u&8192){if(U=n.memoizedState!==null,(n.stateNode.isHidden=U)&&!Z&&(n.mode&1)!==0)for(le=n,Z=n.child;Z!==null;){for(ee=le=Z;le!==null;){switch(Y=le,oe=Y.child,Y.tag){case 0:case 11:case 14:case 15:fa(4,Y,Y.return);break;case 1:ri(Y,Y.return);var ce=Y.stateNode;if(typeof ce.componentWillUnmount=="function"){u=Y,a=Y.return;try{s=u,ce.props=s.memoizedProps,ce.state=s.memoizedState,ce.componentWillUnmount()}catch(ue){Xe(u,a,ue)}}break;case 5:ri(Y,Y.return);break;case 22:if(Y.memoizedState!==null){nm(ee);continue}}oe!==null?(oe.return=Y,le=oe):nm(ee)}Z=Z.sibling}e:for(Z=null,ee=n;;){if(ee.tag===5){if(Z===null){Z=ee;try{f=ee.stateNode,U?(g=f.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(D=ee.stateNode,A=ee.memoizedProps.style,C=A!=null&&A.hasOwnProperty("display")?A.display:null,D.style.display=Tn("display",C))}catch(ue){Xe(n,n.return,ue)}}}else if(ee.tag===6){if(Z===null)try{ee.stateNode.nodeValue=U?"":ee.memoizedProps}catch(ue){Xe(n,n.return,ue)}}else if((ee.tag!==22&&ee.tag!==23||ee.memoizedState===null||ee===n)&&ee.child!==null){ee.child.return=ee,ee=ee.child;continue}if(ee===n)break e;for(;ee.sibling===null;){if(ee.return===null||ee.return===n)break e;Z===ee&&(Z=null),ee=ee.return}Z===ee&&(Z=null),ee.sibling.return=ee.return,ee=ee.sibling}}break;case 19:bn(s,n),An(n),u&4&&Jh(n);break;case 21:break;default:bn(s,n),An(n)}}function An(n){var s=n.flags;if(s&2){try{e:{for(var a=n.return;a!==null;){if(Gh(a)){var u=a;break e}a=a.return}throw Error(r(160))}switch(u.tag){case 5:var f=u.stateNode;u.flags&32&&(it(f,""),u.flags&=-33);var g=Yh(n);uu(n,g,f);break;case 3:case 4:var C=u.stateNode.containerInfo,D=Yh(n);cu(n,D,C);break;default:throw Error(r(161))}}catch(A){Xe(n,n.return,A)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function mk(n,s,a){le=n,em(n)}function em(n,s,a){for(var u=(n.mode&1)!==0;le!==null;){var f=le,g=f.child;if(f.tag===22&&u){var C=f.memoizedState!==null||$o;if(!C){var D=f.alternate,A=D!==null&&D.memoizedState!==null||St;D=$o;var U=St;if($o=C,(St=A)&&!U)for(le=f;le!==null;)C=le,A=C.child,C.tag===22&&C.memoizedState!==null?rm(f):A!==null?(A.return=C,le=A):rm(f);for(;g!==null;)le=g,em(g),g=g.sibling;le=f,$o=D,St=U}tm(n)}else(f.subtreeFlags&8772)!==0&&g!==null?(g.return=f,le=g):tm(n)}}function tm(n){for(;le!==null;){var s=le;if((s.flags&8772)!==0){var a=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:St||Uo(5,s);break;case 1:var u=s.stateNode;if(s.flags&4&&!St)if(a===null)u.componentDidMount();else{var f=s.elementType===s.type?a.memoizedProps:yn(s.type,a.memoizedProps);u.componentDidUpdate(f,a.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var g=s.updateQueue;g!==null&&nh(s,g,u);break;case 3:var C=s.updateQueue;if(C!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}nh(s,C,a)}break;case 5:var D=s.stateNode;if(a===null&&s.flags&4){a=D;var A=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":A.autoFocus&&a.focus();break;case"img":A.src&&(a.src=A.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var U=s.alternate;if(U!==null){var Z=U.memoizedState;if(Z!==null){var ee=Z.dehydrated;ee!==null&&Hi(ee)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}St||s.flags&512&&lu(s)}catch(Y){Xe(s,s.return,Y)}}if(s===n){le=null;break}if(a=s.sibling,a!==null){a.return=s.return,le=a;break}le=s.return}}function nm(n){for(;le!==null;){var s=le;if(s===n){le=null;break}var a=s.sibling;if(a!==null){a.return=s.return,le=a;break}le=s.return}}function rm(n){for(;le!==null;){var s=le;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{Uo(4,s)}catch(A){Xe(s,a,A)}break;case 1:var u=s.stateNode;if(typeof u.componentDidMount=="function"){var f=s.return;try{u.componentDidMount()}catch(A){Xe(s,f,A)}}var g=s.return;try{lu(s)}catch(A){Xe(s,g,A)}break;case 5:var C=s.return;try{lu(s)}catch(A){Xe(s,C,A)}}}catch(A){Xe(s,s.return,A)}if(s===n){le=null;break}var D=s.sibling;if(D!==null){D.return=s.return,le=D;break}le=s.return}}var gk=Math.ceil,Wo=E.ReactCurrentDispatcher,du=E.ReactCurrentOwner,rn=E.ReactCurrentBatchConfig,Te=0,pt=null,st=null,xt=0,Yt=0,si=jr(0),lt=0,ha=null,ps=0,Ho=0,pu=0,ma=null,_t=null,fu=0,ii=1/0,Zn=null,Ko=!1,hu=null,Tr=null,qo=!1,Rr=null,Qo=0,ga=0,mu=null,Go=-1,Yo=0;function Rt(){return(Te&6)!==0?tt():Go!==-1?Go:Go=tt()}function Dr(n){return(n.mode&1)===0?1:(Te&2)!==0&&xt!==0?xt&-xt:Zb.transition!==null?(Yo===0&&(Yo=Gp()),Yo):(n=Ae,n!==0||(n=window.event,n=n===void 0?16:sf(n.type)),n)}function kn(n,s,a,u){if(50<ga)throw ga=0,mu=null,Error(r(185));Vi(n,a,u),((Te&2)===0||n!==pt)&&(n===pt&&((Te&2)===0&&(Ho|=a),lt===4&&Lr(n,xt)),zt(n,u),a===1&&Te===0&&(s.mode&1)===0&&(ii=tt()+500,So&&Cr()))}function zt(n,s){var a=n.callbackNode;Zv(n,s);var u=so(n,n===pt?xt:0);if(u===0)a!==null&&Kp(a),n.callbackNode=null,n.callbackPriority=0;else if(s=u&-u,n.callbackPriority!==s){if(a!=null&&Kp(a),s===1)n.tag===0?Jb(im.bind(null,n)):Wf(im.bind(null,n)),Qb(function(){(Te&6)===0&&Cr()}),a=null;else{switch(Yp(u)){case 1:a=Ql;break;case 4:a=qp;break;case 16:a=eo;break;case 536870912:a=Qp;break;default:a=eo}a=fm(a,sm.bind(null,n))}n.callbackPriority=s,n.callbackNode=a}}function sm(n,s){if(Go=-1,Yo=0,(Te&6)!==0)throw Error(r(327));var a=n.callbackNode;if(ai()&&n.callbackNode!==a)return null;var u=so(n,n===pt?xt:0);if(u===0)return null;if((u&30)!==0||(u&n.expiredLanes)!==0||s)s=Xo(n,u);else{s=u;var f=Te;Te|=2;var g=om();(pt!==n||xt!==s)&&(Zn=null,ii=tt()+500,hs(n,s));do try{vk();break}catch(D){am(n,D)}while(!0);Ic(),Wo.current=g,Te=f,st!==null?s=0:(pt=null,xt=0,s=lt)}if(s!==0){if(s===2&&(f=Gl(n),f!==0&&(u=f,s=gu(n,f))),s===1)throw a=ha,hs(n,0),Lr(n,u),zt(n,tt()),a;if(s===6)Lr(n,u);else{if(f=n.current.alternate,(u&30)===0&&!xk(f)&&(s=Xo(n,u),s===2&&(g=Gl(n),g!==0&&(u=g,s=gu(n,g))),s===1))throw a=ha,hs(n,0),Lr(n,u),zt(n,tt()),a;switch(n.finishedWork=f,n.finishedLanes=u,s){case 0:case 1:throw Error(r(345));case 2:ms(n,_t,Zn);break;case 3:if(Lr(n,u),(u&130023424)===u&&(s=fu+500-tt(),10<s)){if(so(n,0)!==0)break;if(f=n.suspendedLanes,(f&u)!==u){Rt(),n.pingedLanes|=n.suspendedLanes&f;break}n.timeoutHandle=wc(ms.bind(null,n,_t,Zn),s);break}ms(n,_t,Zn);break;case 4:if(Lr(n,u),(u&4194240)===u)break;for(s=n.eventTimes,f=-1;0<u;){var C=31-mn(u);g=1<<C,C=s[C],C>f&&(f=C),u&=~g}if(u=f,u=tt()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*gk(u/1960))-u,10<u){n.timeoutHandle=wc(ms.bind(null,n,_t,Zn),u);break}ms(n,_t,Zn);break;case 5:ms(n,_t,Zn);break;default:throw Error(r(329))}}}return zt(n,tt()),n.callbackNode===a?sm.bind(null,n):null}function gu(n,s){var a=ma;return n.current.memoizedState.isDehydrated&&(hs(n,s).flags|=256),n=Xo(n,s),n!==2&&(s=_t,_t=a,s!==null&&xu(s)),n}function xu(n){_t===null?_t=n:_t.push.apply(_t,n)}function xk(n){for(var s=n;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var u=0;u<a.length;u++){var f=a[u],g=f.getSnapshot;f=f.value;try{if(!gn(g(),f))return!1}catch{return!1}}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Lr(n,s){for(s&=~pu,s&=~Ho,n.suspendedLanes|=s,n.pingedLanes&=~s,n=n.expirationTimes;0<s;){var a=31-mn(s),u=1<<a;n[a]=-1,s&=~u}}function im(n){if((Te&6)!==0)throw Error(r(327));ai();var s=so(n,0);if((s&1)===0)return zt(n,tt()),null;var a=Xo(n,s);if(n.tag!==0&&a===2){var u=Gl(n);u!==0&&(s=u,a=gu(n,u))}if(a===1)throw a=ha,hs(n,0),Lr(n,s),zt(n,tt()),a;if(a===6)throw Error(r(345));return n.finishedWork=n.current.alternate,n.finishedLanes=s,ms(n,_t,Zn),zt(n,tt()),null}function yu(n,s){var a=Te;Te|=1;try{return n(s)}finally{Te=a,Te===0&&(ii=tt()+500,So&&Cr())}}function fs(n){Rr!==null&&Rr.tag===0&&(Te&6)===0&&ai();var s=Te;Te|=1;var a=rn.transition,u=Ae;try{if(rn.transition=null,Ae=1,n)return n()}finally{Ae=u,rn.transition=a,Te=s,(Te&6)===0&&Cr()}}function vu(){Yt=si.current,$e(si)}function hs(n,s){n.finishedWork=null,n.finishedLanes=0;var a=n.timeoutHandle;if(a!==-1&&(n.timeoutHandle=-1,qb(a)),st!==null)for(a=st.return;a!==null;){var u=a;switch(Pc(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&wo();break;case 3:ti(),$e(Mt),$e(kt),Bc();break;case 5:zc(u);break;case 4:ti();break;case 13:$e(Ke);break;case 19:$e(Ke);break;case 10:Ac(u.type._context);break;case 22:case 23:vu()}a=a.return}if(pt=n,st=n=Ir(n.current,null),xt=Yt=s,lt=0,ha=null,pu=Ho=ps=0,_t=ma=null,cs!==null){for(s=0;s<cs.length;s++)if(a=cs[s],u=a.interleaved,u!==null){a.interleaved=null;var f=u.next,g=a.pending;if(g!==null){var C=g.next;g.next=f,u.next=C}a.pending=u}cs=null}return n}function am(n,s){do{var a=st;try{if(Ic(),Ao.current=_o,Mo){for(var u=qe.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}Mo=!1}if(ds=0,dt=ot=qe=null,la=!1,ca=0,du.current=null,a===null||a.return===null){lt=1,ha=s,st=null;break}e:{var g=n,C=a.return,D=a,A=s;if(s=xt,D.flags|=32768,A!==null&&typeof A=="object"&&typeof A.then=="function"){var U=A,Z=D,ee=Z.tag;if((Z.mode&1)===0&&(ee===0||ee===11||ee===15)){var Y=Z.alternate;Y?(Z.updateQueue=Y.updateQueue,Z.memoizedState=Y.memoizedState,Z.lanes=Y.lanes):(Z.updateQueue=null,Z.memoizedState=null)}var oe=Dh(C);if(oe!==null){oe.flags&=-257,Lh(oe,C,D,g,s),oe.mode&1&&Rh(g,U,s),s=oe,A=U;var ce=s.updateQueue;if(ce===null){var ue=new Set;ue.add(A),s.updateQueue=ue}else ce.add(A);break e}else{if((s&1)===0){Rh(g,U,s),bu();break e}A=Error(r(426))}}else if(He&&D.mode&1){var nt=Dh(C);if(nt!==null){(nt.flags&65536)===0&&(nt.flags|=256),Lh(nt,C,D,g,s),Dc(ni(A,D));break e}}g=A=ni(A,D),lt!==4&&(lt=2),ma===null?ma=[g]:ma.push(g),g=C;do{switch(g.tag){case 3:g.flags|=65536,s&=-s,g.lanes|=s;var z=Ph(g,A,s);th(g,z);break e;case 1:D=A;var F=g.type,V=g.stateNode;if((g.flags&128)===0&&(typeof F.getDerivedStateFromError=="function"||V!==null&&typeof V.componentDidCatch=="function"&&(Tr===null||!Tr.has(V)))){g.flags|=65536,s&=-s,g.lanes|=s;var re=Th(g,D,s);th(g,re);break e}}g=g.return}while(g!==null)}cm(a)}catch(de){s=de,st===a&&a!==null&&(st=a=a.return);continue}break}while(!0)}function om(){var n=Wo.current;return Wo.current=_o,n===null?_o:n}function bu(){(lt===0||lt===3||lt===2)&&(lt=4),pt===null||(ps&268435455)===0&&(Ho&268435455)===0||Lr(pt,xt)}function Xo(n,s){var a=Te;Te|=2;var u=om();(pt!==n||xt!==s)&&(Zn=null,hs(n,s));do try{yk();break}catch(f){am(n,f)}while(!0);if(Ic(),Te=a,Wo.current=u,st!==null)throw Error(r(261));return pt=null,xt=0,lt}function yk(){for(;st!==null;)lm(st)}function vk(){for(;st!==null&&!Wv();)lm(st)}function lm(n){var s=pm(n.alternate,n,Yt);n.memoizedProps=n.pendingProps,s===null?cm(n):st=s,du.current=null}function cm(n){var s=n;do{var a=s.alternate;if(n=s.return,(s.flags&32768)===0){if(a=dk(a,s,Yt),a!==null){st=a;return}}else{if(a=pk(a,s),a!==null){a.flags&=32767,st=a;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{lt=6,st=null;return}}if(s=s.sibling,s!==null){st=s;return}st=s=n}while(s!==null);lt===0&&(lt=5)}function ms(n,s,a){var u=Ae,f=rn.transition;try{rn.transition=null,Ae=1,bk(n,s,a,u)}finally{rn.transition=f,Ae=u}return null}function bk(n,s,a,u){do ai();while(Rr!==null);if((Te&6)!==0)throw Error(r(327));a=n.finishedWork;var f=n.finishedLanes;if(a===null)return null;if(n.finishedWork=null,n.finishedLanes=0,a===n.current)throw Error(r(177));n.callbackNode=null,n.callbackPriority=0;var g=a.lanes|a.childLanes;if(eb(n,g),n===pt&&(st=pt=null,xt=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||qo||(qo=!0,fm(eo,function(){return ai(),null})),g=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||g){g=rn.transition,rn.transition=null;var C=Ae;Ae=1;var D=Te;Te|=4,du.current=null,hk(n,a),Zh(a,n),Vb(bc),oo=!!vc,bc=vc=null,n.current=a,mk(a),Hv(),Te=D,Ae=C,rn.transition=g}else n.current=a;if(qo&&(qo=!1,Rr=n,Qo=f),g=n.pendingLanes,g===0&&(Tr=null),Qv(a.stateNode),zt(n,tt()),s!==null)for(u=n.onRecoverableError,a=0;a<s.length;a++)f=s[a],u(f.value,{componentStack:f.stack,digest:f.digest});if(Ko)throw Ko=!1,n=hu,hu=null,n;return(Qo&1)!==0&&n.tag!==0&&ai(),g=n.pendingLanes,(g&1)!==0?n===mu?ga++:(ga=0,mu=n):ga=0,Cr(),null}function ai(){if(Rr!==null){var n=Yp(Qo),s=rn.transition,a=Ae;try{if(rn.transition=null,Ae=16>n?16:n,Rr===null)var u=!1;else{if(n=Rr,Rr=null,Qo=0,(Te&6)!==0)throw Error(r(331));var f=Te;for(Te|=4,le=n.current;le!==null;){var g=le,C=g.child;if((le.flags&16)!==0){var D=g.deletions;if(D!==null){for(var A=0;A<D.length;A++){var U=D[A];for(le=U;le!==null;){var Z=le;switch(Z.tag){case 0:case 11:case 15:fa(8,Z,g)}var ee=Z.child;if(ee!==null)ee.return=Z,le=ee;else for(;le!==null;){Z=le;var Y=Z.sibling,oe=Z.return;if(Qh(Z),Z===U){le=null;break}if(Y!==null){Y.return=oe,le=Y;break}le=oe}}}var ce=g.alternate;if(ce!==null){var ue=ce.child;if(ue!==null){ce.child=null;do{var nt=ue.sibling;ue.sibling=null,ue=nt}while(ue!==null)}}le=g}}if((g.subtreeFlags&2064)!==0&&C!==null)C.return=g,le=C;else e:for(;le!==null;){if(g=le,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:fa(9,g,g.return)}var z=g.sibling;if(z!==null){z.return=g.return,le=z;break e}le=g.return}}var F=n.current;for(le=F;le!==null;){C=le;var V=C.child;if((C.subtreeFlags&2064)!==0&&V!==null)V.return=C,le=V;else e:for(C=F;le!==null;){if(D=le,(D.flags&2048)!==0)try{switch(D.tag){case 0:case 11:case 15:Uo(9,D)}}catch(de){Xe(D,D.return,de)}if(D===C){le=null;break e}var re=D.sibling;if(re!==null){re.return=D.return,le=re;break e}le=D.return}}if(Te=f,Cr(),Rn&&typeof Rn.onPostCommitFiberRoot=="function")try{Rn.onPostCommitFiberRoot(to,n)}catch{}u=!0}return u}finally{Ae=a,rn.transition=s}}return!1}function um(n,s,a){s=ni(a,s),s=Ph(n,s,1),n=Er(n,s,1),s=Rt(),n!==null&&(Vi(n,1,s),zt(n,s))}function Xe(n,s,a){if(n.tag===3)um(n,n,a);else for(;s!==null;){if(s.tag===3){um(s,n,a);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Tr===null||!Tr.has(u))){n=ni(a,n),n=Th(s,n,1),s=Er(s,n,1),n=Rt(),s!==null&&(Vi(s,1,n),zt(s,n));break}}s=s.return}}function kk(n,s,a){var u=n.pingCache;u!==null&&u.delete(s),s=Rt(),n.pingedLanes|=n.suspendedLanes&a,pt===n&&(xt&a)===a&&(lt===4||lt===3&&(xt&130023424)===xt&&500>tt()-fu?hs(n,0):pu|=a),zt(n,s)}function dm(n,s){s===0&&((n.mode&1)===0?s=1:(s=ro,ro<<=1,(ro&130023424)===0&&(ro=4194304)));var a=Rt();n=Yn(n,s),n!==null&&(Vi(n,s,a),zt(n,a))}function wk(n){var s=n.memoizedState,a=0;s!==null&&(a=s.retryLane),dm(n,a)}function jk(n,s){var a=0;switch(n.tag){case 13:var u=n.stateNode,f=n.memoizedState;f!==null&&(a=f.retryLane);break;case 19:u=n.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(s),dm(n,a)}var pm;pm=function(n,s,a){if(n!==null)if(n.memoizedProps!==s.pendingProps||Mt.current)Ft=!0;else{if((n.lanes&a)===0&&(s.flags&128)===0)return Ft=!1,uk(n,s,a);Ft=(n.flags&131072)!==0}else Ft=!1,He&&(s.flags&1048576)!==0&&Hf(s,No,s.index);switch(s.lanes=0,s.tag){case 2:var u=s.type;Bo(n,s),n=s.pendingProps;var f=Qs(s,kt.current);ei(s,a),f=Wc(null,s,u,n,f,a);var g=Hc();return s.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,Ot(u)?(g=!0,jo(s)):g=!1,s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Fc(s),f.updater=zo,s.stateNode=f,f._reactInternals=s,Xc(s,u,n,a),s=tu(null,s,u,!0,g,a)):(s.tag=0,He&&g&&Ec(s),Tt(null,s,f,a),s=s.child),s;case 16:u=s.elementType;e:{switch(Bo(n,s),n=s.pendingProps,f=u._init,u=f(u._payload),s.type=u,f=s.tag=Ck(u),n=yn(u,n),f){case 0:s=eu(null,s,u,n,a);break e;case 1:s=_h(null,s,u,n,a);break e;case 11:s=Ih(null,s,u,n,a);break e;case 14:s=Ah(null,s,u,yn(u.type,n),a);break e}throw Error(r(306,u,""))}return s;case 0:return u=s.type,f=s.pendingProps,f=s.elementType===u?f:yn(u,f),eu(n,s,u,f,a);case 1:return u=s.type,f=s.pendingProps,f=s.elementType===u?f:yn(u,f),_h(n,s,u,f,a);case 3:e:{if(zh(s),n===null)throw Error(r(387));u=s.pendingProps,g=s.memoizedState,f=g.element,eh(n,s),Lo(s,u,null,a);var C=s.memoizedState;if(u=C.element,g.isDehydrated)if(g={element:u,isDehydrated:!1,cache:C.cache,pendingSuspenseBoundaries:C.pendingSuspenseBoundaries,transitions:C.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){f=ni(Error(r(423)),s),s=Vh(n,s,u,a,f);break e}else if(u!==f){f=ni(Error(r(424)),s),s=Vh(n,s,u,a,f);break e}else for(Gt=wr(s.stateNode.containerInfo.firstChild),Qt=s,He=!0,xn=null,a=Jf(s,null,u,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Xs(),u===f){s=Jn(n,s,a);break e}Tt(n,s,u,a)}s=s.child}return s;case 5:return rh(s),n===null&&Rc(s),u=s.type,f=s.pendingProps,g=n!==null?n.memoizedProps:null,C=f.children,kc(u,f)?C=null:g!==null&&kc(u,g)&&(s.flags|=32),Fh(n,s),Tt(n,s,C,a),s.child;case 6:return n===null&&Rc(s),null;case 13:return Bh(n,s,a);case 4:return _c(s,s.stateNode.containerInfo),u=s.pendingProps,n===null?s.child=Js(s,null,u,a):Tt(n,s,u,a),s.child;case 11:return u=s.type,f=s.pendingProps,f=s.elementType===u?f:yn(u,f),Ih(n,s,u,f,a);case 7:return Tt(n,s,s.pendingProps,a),s.child;case 8:return Tt(n,s,s.pendingProps.children,a),s.child;case 12:return Tt(n,s,s.pendingProps.children,a),s.child;case 10:e:{if(u=s.type._context,f=s.pendingProps,g=s.memoizedProps,C=f.value,ze(To,u._currentValue),u._currentValue=C,g!==null)if(gn(g.value,C)){if(g.children===f.children&&!Mt.current){s=Jn(n,s,a);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var D=g.dependencies;if(D!==null){C=g.child;for(var A=D.firstContext;A!==null;){if(A.context===u){if(g.tag===1){A=Xn(-1,a&-a),A.tag=2;var U=g.updateQueue;if(U!==null){U=U.shared;var Z=U.pending;Z===null?A.next=A:(A.next=Z.next,Z.next=A),U.pending=A}}g.lanes|=a,A=g.alternate,A!==null&&(A.lanes|=a),Mc(g.return,a,s),D.lanes|=a;break}A=A.next}}else if(g.tag===10)C=g.type===s.type?null:g.child;else if(g.tag===18){if(C=g.return,C===null)throw Error(r(341));C.lanes|=a,D=C.alternate,D!==null&&(D.lanes|=a),Mc(C,a,s),C=g.sibling}else C=g.child;if(C!==null)C.return=g;else for(C=g;C!==null;){if(C===s){C=null;break}if(g=C.sibling,g!==null){g.return=C.return,C=g;break}C=C.return}g=C}Tt(n,s,f.children,a),s=s.child}return s;case 9:return f=s.type,u=s.pendingProps.children,ei(s,a),f=tn(f),u=u(f),s.flags|=1,Tt(n,s,u,a),s.child;case 14:return u=s.type,f=yn(u,s.pendingProps),f=yn(u.type,f),Ah(n,s,u,f,a);case 15:return Mh(n,s,s.type,s.pendingProps,a);case 17:return u=s.type,f=s.pendingProps,f=s.elementType===u?f:yn(u,f),Bo(n,s),s.tag=1,Ot(u)?(n=!0,jo(s)):n=!1,ei(s,a),Nh(s,u,f),Xc(s,u,f,a),tu(null,s,u,!0,n,a);case 19:return Uh(n,s,a);case 22:return Oh(n,s,a)}throw Error(r(156,s.tag))};function fm(n,s){return Hp(n,s)}function Sk(n,s,a,u){this.tag=n,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sn(n,s,a,u){return new Sk(n,s,a,u)}function ku(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Ck(n){if(typeof n=="function")return ku(n)?1:0;if(n!=null){if(n=n.$$typeof,n===ne)return 11;if(n===$)return 14}return 2}function Ir(n,s){var a=n.alternate;return a===null?(a=sn(n.tag,s,n.key,n.mode),a.elementType=n.elementType,a.type=n.type,a.stateNode=n.stateNode,a.alternate=n,n.alternate=a):(a.pendingProps=s,a.type=n.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=n.flags&14680064,a.childLanes=n.childLanes,a.lanes=n.lanes,a.child=n.child,a.memoizedProps=n.memoizedProps,a.memoizedState=n.memoizedState,a.updateQueue=n.updateQueue,s=n.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=n.sibling,a.index=n.index,a.ref=n.ref,a}function Jo(n,s,a,u,f,g){var C=2;if(u=n,typeof n=="function")ku(n)&&(C=1);else if(typeof n=="string")C=5;else e:switch(n){case H:return gs(a.children,f,g,s);case B:C=8,f|=8;break;case te:return n=sn(12,a,s,f|2),n.elementType=te,n.lanes=g,n;case O:return n=sn(13,a,s,f),n.elementType=O,n.lanes=g,n;case _:return n=sn(19,a,s,f),n.elementType=_,n.lanes=g,n;case W:return Zo(a,f,g,s);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case X:C=10;break e;case se:C=9;break e;case ne:C=11;break e;case $:C=14;break e;case K:C=16,u=null;break e}throw Error(r(130,n==null?n:typeof n,""))}return s=sn(C,a,s,f),s.elementType=n,s.type=u,s.lanes=g,s}function gs(n,s,a,u){return n=sn(7,n,u,s),n.lanes=a,n}function Zo(n,s,a,u){return n=sn(22,n,u,s),n.elementType=W,n.lanes=a,n.stateNode={isHidden:!1},n}function wu(n,s,a){return n=sn(6,n,null,s),n.lanes=a,n}function ju(n,s,a){return s=sn(4,n.children!==null?n.children:[],n.key,s),s.lanes=a,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}function Nk(n,s,a,u,f){this.tag=s,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Yl(0),this.expirationTimes=Yl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yl(0),this.identifierPrefix=u,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Su(n,s,a,u,f,g,C,D,A){return n=new Nk(n,s,a,D,A),s===1?(s=1,g===!0&&(s|=8)):s=0,g=sn(3,null,null,s),n.current=g,g.stateNode=n,g.memoizedState={element:u,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fc(g),n}function Ek(n,s,a){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:M,key:u==null?null:""+u,children:n,containerInfo:s,implementation:a}}function hm(n){if(!n)return Sr;n=n._reactInternals;e:{if(ss(n)!==n||n.tag!==1)throw Error(r(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(Ot(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(n.tag===1){var a=n.type;if(Ot(a))return $f(n,a,s)}return s}function mm(n,s,a,u,f,g,C,D,A){return n=Su(a,u,!0,n,f,g,C,D,A),n.context=hm(null),a=n.current,u=Rt(),f=Dr(a),g=Xn(u,f),g.callback=s??null,Er(a,g,f),n.current.lanes=f,Vi(n,f,u),zt(n,u),n}function el(n,s,a,u){var f=s.current,g=Rt(),C=Dr(f);return a=hm(a),s.context===null?s.context=a:s.pendingContext=a,s=Xn(g,C),s.payload={element:n},u=u===void 0?null:u,u!==null&&(s.callback=u),n=Er(f,s,C),n!==null&&(kn(n,f,C,g),Do(n,f,C)),C}function tl(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function gm(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<s?a:s}}function Cu(n,s){gm(n,s),(n=n.alternate)&&gm(n,s)}function Pk(){return null}var xm=typeof reportError=="function"?reportError:function(n){console.error(n)};function Nu(n){this._internalRoot=n}nl.prototype.render=Nu.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(r(409));el(n,s,null,null)},nl.prototype.unmount=Nu.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;fs(function(){el(null,n,null,null)}),s[Kn]=null}};function nl(n){this._internalRoot=n}nl.prototype.unstable_scheduleHydration=function(n){if(n){var s=Zp();n={blockedOn:null,target:n,priority:s};for(var a=0;a<vr.length&&s!==0&&s<vr[a].priority;a++);vr.splice(a,0,n),a===0&&nf(n)}};function Eu(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function rl(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function ym(){}function Tk(n,s,a,u,f){if(f){if(typeof u=="function"){var g=u;u=function(){var U=tl(C);g.call(U)}}var C=mm(s,u,n,0,null,!1,!1,"",ym);return n._reactRootContainer=C,n[Kn]=C.current,ea(n.nodeType===8?n.parentNode:n),fs(),C}for(;f=n.lastChild;)n.removeChild(f);if(typeof u=="function"){var D=u;u=function(){var U=tl(A);D.call(U)}}var A=Su(n,0,!1,null,null,!1,!1,"",ym);return n._reactRootContainer=A,n[Kn]=A.current,ea(n.nodeType===8?n.parentNode:n),fs(function(){el(s,A,a,u)}),A}function sl(n,s,a,u,f){var g=a._reactRootContainer;if(g){var C=g;if(typeof f=="function"){var D=f;f=function(){var A=tl(C);D.call(A)}}el(s,C,n,f)}else C=Tk(a,s,n,f,u);return tl(C)}Xp=function(n){switch(n.tag){case 3:var s=n.stateNode;if(s.current.memoizedState.isDehydrated){var a=zi(s.pendingLanes);a!==0&&(Xl(s,a|1),zt(s,tt()),(Te&6)===0&&(ii=tt()+500,Cr()))}break;case 13:fs(function(){var u=Yn(n,1);if(u!==null){var f=Rt();kn(u,n,1,f)}}),Cu(n,1)}},Jl=function(n){if(n.tag===13){var s=Yn(n,134217728);if(s!==null){var a=Rt();kn(s,n,134217728,a)}Cu(n,134217728)}},Jp=function(n){if(n.tag===13){var s=Dr(n),a=Yn(n,s);if(a!==null){var u=Rt();kn(a,n,s,u)}Cu(n,s)}},Zp=function(){return Ae},ef=function(n,s){var a=Ae;try{return Ae=n,s()}finally{Ae=a}},ns=function(n,s,a){switch(s){case"input":if(hn(n,a),s=a.name,a.type==="radio"&&s!=null){for(a=n;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var u=a[s];if(u!==n&&u.form===n.form){var f=ko(u);if(!f)throw Error(r(90));Wt(u),hn(u,f)}}}break;case"textarea":ts(n,a);break;case"select":s=a.value,s!=null&&Kt(n,!!a.multiple,s,!1)}},rs=yu,Xa=fs;var Rk={usingClientEntryPoint:!1,Events:[ra,Ks,ko,at,At,yu]},xa={findFiberByHostInstance:is,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Dk={bundleType:xa.bundleType,version:xa.version,rendererPackageName:xa.rendererPackageName,rendererConfig:xa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=Up(n),n===null?null:n.stateNode},findFiberByHostInstance:xa.findFiberByHostInstance||Pk,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var il=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!il.isDisabled&&il.supportsFiber)try{to=il.inject(Dk),Rn=il}catch{}}return Vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Rk,Vt.createPortal=function(n,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Eu(s))throw Error(r(200));return Ek(n,s,null,a)},Vt.createRoot=function(n,s){if(!Eu(n))throw Error(r(299));var a=!1,u="",f=xm;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(f=s.onRecoverableError)),s=Su(n,1,!1,null,null,a,!1,u,f),n[Kn]=s.current,ea(n.nodeType===8?n.parentNode:n),new Nu(s)},Vt.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=Up(s),n=n===null?null:n.stateNode,n},Vt.flushSync=function(n){return fs(n)},Vt.hydrate=function(n,s,a){if(!rl(s))throw Error(r(200));return sl(null,n,s,!0,a)},Vt.hydrateRoot=function(n,s,a){if(!Eu(n))throw Error(r(405));var u=a!=null&&a.hydratedSources||null,f=!1,g="",C=xm;if(a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(C=a.onRecoverableError)),s=mm(s,null,n,1,a??null,f,!1,g,C),n[Kn]=s.current,ea(n),u)for(n=0;n<u.length;n++)a=u[n],f=a._getVersion,f=f(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,f]:s.mutableSourceEagerHydrationData.push(a,f);return new nl(s)},Vt.render=function(n,s,a){if(!rl(s))throw Error(r(200));return sl(null,n,s,!1,a)},Vt.unmountComponentAtNode=function(n){if(!rl(n))throw Error(r(40));return n._reactRootContainer?(fs(function(){sl(null,null,n,!1,function(){n._reactRootContainer=null,n[Kn]=null})}),!0):!1},Vt.unstable_batchedUpdates=yu,Vt.unstable_renderSubtreeIntoContainer=function(n,s,a,u){if(!rl(a))throw Error(r(200));if(n==null||n._reactInternals===void 0)throw Error(r(38));return sl(n,s,a,!1,u)},Vt.version="18.3.1-next-f1338f8080-20240426",Vt}var zm;function Sw(){if(zm)return Du.exports;zm=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Du.exports=jw(),Du.exports}var Vm;function Cw(){if(Vm)return ll;Vm=1;var e=Sw();return ll.createRoot=e.createRoot,ll.hydrateRoot=e.hydrateRoot,ll}var Nw=Cw();/**
|
|
41
|
+
* react-router v7.13.0
|
|
42
|
+
*
|
|
43
|
+
* Copyright (c) Remix Software Inc.
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
+
*
|
|
48
|
+
* @license MIT
|
|
49
|
+
*/var Bm="popstate";function Ew(e={}){function t(i,l){let{pathname:c,search:d,hash:p}=i.location;return xd("",{pathname:c,search:d,hash:p},l.state&&l.state.usr||null,l.state&&l.state.key||"default")}function r(i,l){return typeof l=="string"?l:La(l)}return Tw(t,r,null,e)}function Ge(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Cn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Pw(){return Math.random().toString(36).substring(2,10)}function $m(e,t){return{usr:e.state,key:e.key,idx:t}}function xd(e,t,r=null,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Di(t):t,state:r,key:t&&t.key||i||Pw()}}function La({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Di(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function Tw(e,t,r,i={}){let{window:l=document.defaultView,v5Compat:c=!1}=i,d=l.history,p="POP",h=null,m=x();m==null&&(m=0,d.replaceState({...d.state,idx:m},""));function x(){return(d.state||{idx:null}).idx}function v(){p="POP";let N=x(),S=N==null?null:N-m;m=N,h&&h({action:p,location:j.location,delta:S})}function b(N,S){p="PUSH";let T=xd(j.location,N,S);m=x()+1;let k=$m(T,m),E=j.createHref(T);try{d.pushState(k,"",E)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;l.location.assign(E)}c&&h&&h({action:p,location:j.location,delta:1})}function w(N,S){p="REPLACE";let T=xd(j.location,N,S);m=x();let k=$m(T,m),E=j.createHref(T);d.replaceState(k,"",E),c&&h&&h({action:p,location:j.location,delta:0})}function P(N){return Rw(N)}let j={get action(){return p},get location(){return e(l,d)},listen(N){if(h)throw new Error("A history only accepts one active listener");return l.addEventListener(Bm,v),h=N,()=>{l.removeEventListener(Bm,v),h=null}},createHref(N){return t(l,N)},createURL:P,encodeLocation(N){let S=P(N);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:b,replace:w,go(N){return d.go(N)}};return j}function Rw(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Ge(r,"No window.location.(origin|href) available to create URL");let i=typeof e=="string"?e:La(e);return i=i.replace(/ $/,"%20"),!t&&i.startsWith("//")&&(i=r+i),new URL(i,r)}function ux(e,t,r="/"){return Dw(e,t,r,!1)}function Dw(e,t,r,i){let l=typeof t=="string"?Di(t):t,c=cr(l.pathname||"/",r);if(c==null)return null;let d=dx(e);Lw(d);let p=null;for(let h=0;p==null&&h<d.length;++h){let m=Uw(c);p=Bw(d[h],m,i)}return p}function dx(e,t=[],r=[],i="",l=!1){let c=(d,p,h=l,m)=>{let x={relativePath:m===void 0?d.path||"":m,caseSensitive:d.caseSensitive===!0,childrenIndex:p,route:d};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(i)&&h)return;Ge(x.relativePath.startsWith(i),`Absolute route path "${x.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(i.length)}let v=ir([i,x.relativePath]),b=r.concat(x);d.children&&d.children.length>0&&(Ge(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),dx(d.children,t,b,v,h)),!(d.path==null&&!d.index)&&t.push({path:v,score:zw(v,d.index),routesMeta:b})};return e.forEach((d,p)=>{var h;if(d.path===""||!((h=d.path)!=null&&h.includes("?")))c(d,p);else for(let m of px(d.path))c(d,p,!0,m)}),t}function px(e){let t=e.split("/");if(t.length===0)return[];let[r,...i]=t,l=r.endsWith("?"),c=r.replace(/\?$/,"");if(i.length===0)return l?[c,""]:[c];let d=px(i.join("/")),p=[];return p.push(...d.map(h=>h===""?c:[c,h].join("/"))),l&&p.push(...d),p.map(h=>e.startsWith("/")&&h===""?"/":h)}function Lw(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Vw(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var Iw=/^:[\w-]+$/,Aw=3,Mw=2,Ow=1,Fw=10,_w=-2,Um=e=>e==="*";function zw(e,t){let r=e.split("/"),i=r.length;return r.some(Um)&&(i+=_w),t&&(i+=Mw),r.filter(l=>!Um(l)).reduce((l,c)=>l+(Iw.test(c)?Aw:c===""?Ow:Fw),i)}function Vw(e,t){return e.length===t.length&&e.slice(0,-1).every((i,l)=>i===t[l])?e[e.length-1]-t[t.length-1]:0}function Bw(e,t,r=!1){let{routesMeta:i}=e,l={},c="/",d=[];for(let p=0;p<i.length;++p){let h=i[p],m=p===i.length-1,x=c==="/"?t:t.slice(c.length)||"/",v=Sl({path:h.relativePath,caseSensitive:h.caseSensitive,end:m},x),b=h.route;if(!v&&m&&r&&!i[i.length-1].route.index&&(v=Sl({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},x)),!v)return null;Object.assign(l,v.params),d.push({params:l,pathname:ir([c,v.pathname]),pathnameBase:qw(ir([c,v.pathnameBase])),route:b}),v.pathnameBase!=="/"&&(c=ir([c,v.pathnameBase]))}return d}function Sl(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=$w(e.path,e.caseSensitive,e.end),l=t.match(r);if(!l)return null;let c=l[0],d=c.replace(/(.)\/+$/,"$1"),p=l.slice(1);return{params:i.reduce((m,{paramName:x,isOptional:v},b)=>{if(x==="*"){let P=p[b]||"";d=c.slice(0,c.length-P.length).replace(/(.)\/+$/,"$1")}const w=p[b];return v&&!w?m[x]=void 0:m[x]=(w||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:d,pattern:e}}function $w(e,t=!1,r=!0){Cn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,p,h)=>(i.push({paramName:p,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),i]}function Uw(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Cn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function cr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}var Ww=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Hw(e,t="/"){let{pathname:r,search:i="",hash:l=""}=typeof e=="string"?Di(e):e,c;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?c=Wm(r.substring(1),"/"):c=Wm(r,t)):c=t,{pathname:c,search:Qw(i),hash:Gw(l)}}function Wm(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function Au(e,t,r,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Kw(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function fx(e){let t=Kw(e);return t.map((r,i)=>i===t.length-1?r.pathname:r.pathnameBase)}function hx(e,t,r,i=!1){let l;typeof e=="string"?l=Di(e):(l={...e},Ge(!l.pathname||!l.pathname.includes("?"),Au("?","pathname","search",l)),Ge(!l.pathname||!l.pathname.includes("#"),Au("#","pathname","hash",l)),Ge(!l.search||!l.search.includes("#"),Au("#","search","hash",l)));let c=e===""||l.pathname==="",d=c?"/":l.pathname,p;if(d==null)p=r;else{let v=t.length-1;if(!i&&d.startsWith("..")){let b=d.split("/");for(;b[0]==="..";)b.shift(),v-=1;l.pathname=b.join("/")}p=v>=0?t[v]:"/"}let h=Hw(l,p),m=d&&d!=="/"&&d.endsWith("/"),x=(c||d===".")&&r.endsWith("/");return!h.pathname.endsWith("/")&&(m||x)&&(h.pathname+="/"),h}var ir=e=>e.join("/").replace(/\/\/+/g,"/"),qw=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Qw=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Gw=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Yw=class{constructor(e,t,r,i=!1){this.status=e,this.statusText=t||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Xw(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Jw(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var mx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function gx(e,t){let r=e;if(typeof r!="string"||!Ww.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let i=r,l=!1;if(mx)try{let c=new URL(window.location.href),d=r.startsWith("//")?new URL(c.protocol+r):new URL(r),p=cr(d.pathname,t);d.origin===c.origin&&p!=null?r=p+d.search+d.hash:l=!0}catch{Cn(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var xx=["POST","PUT","PATCH","DELETE"];new Set(xx);var Zw=["GET",...xx];new Set(Zw);var Li=y.createContext(null);Li.displayName="DataRouter";var Ml=y.createContext(null);Ml.displayName="DataRouterState";var e1=y.createContext(!1),yx=y.createContext({isTransitioning:!1});yx.displayName="ViewTransition";var t1=y.createContext(new Map);t1.displayName="Fetchers";var n1=y.createContext(null);n1.displayName="Await";var un=y.createContext(null);un.displayName="Navigation";var Wa=y.createContext(null);Wa.displayName="Location";var pr=y.createContext({outlet:null,matches:[],isDataRoute:!1});pr.displayName="Route";var Xd=y.createContext(null);Xd.displayName="RouteError";var vx="REACT_ROUTER_ERROR",r1="REDIRECT",s1="ROUTE_ERROR_RESPONSE";function i1(e){if(e.startsWith(`${vx}:${r1}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function a1(e){if(e.startsWith(`${vx}:${s1}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Yw(t.status,t.statusText,t.data)}catch{}}function o1(e,{relative:t}={}){Ge(Ha(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=y.useContext(un),{hash:l,pathname:c,search:d}=Ka(e,{relative:t}),p=c;return r!=="/"&&(p=c==="/"?r:ir([r,c])),i.createHref({pathname:p,search:d,hash:l})}function Ha(){return y.useContext(Wa)!=null}function Yr(){return Ge(Ha(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(Wa).location}var bx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function kx(e){y.useContext(un).static||y.useLayoutEffect(e)}function Ii(){let{isDataRoute:e}=y.useContext(pr);return e?b1():l1()}function l1(){Ge(Ha(),"useNavigate() may be used only in the context of a <Router> component.");let e=y.useContext(Li),{basename:t,navigator:r}=y.useContext(un),{matches:i}=y.useContext(pr),{pathname:l}=Yr(),c=JSON.stringify(fx(i)),d=y.useRef(!1);return kx(()=>{d.current=!0}),y.useCallback((h,m={})=>{if(Cn(d.current,bx),!d.current)return;if(typeof h=="number"){r.go(h);return}let x=hx(h,JSON.parse(c),l,m.relative==="path");e==null&&t!=="/"&&(x.pathname=x.pathname==="/"?t:ir([t,x.pathname])),(m.replace?r.replace:r.push)(x,m.state,m)},[t,r,c,l,e])}y.createContext(null);function Ka(e,{relative:t}={}){let{matches:r}=y.useContext(pr),{pathname:i}=Yr(),l=JSON.stringify(fx(r));return y.useMemo(()=>hx(e,JSON.parse(l),i,t==="path"),[e,l,i,t])}function c1(e,t){return wx(e,t)}function wx(e,t,r,i,l){var T;Ge(Ha(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:c}=y.useContext(un),{matches:d}=y.useContext(pr),p=d[d.length-1],h=p?p.params:{},m=p?p.pathname:"/",x=p?p.pathnameBase:"/",v=p&&p.route;{let k=v&&v.path||"";Sx(m,!v||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
50
|
+
|
|
51
|
+
Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let b=Yr(),w;if(t){let k=typeof t=="string"?Di(t):t;Ge(x==="/"||((T=k.pathname)==null?void 0:T.startsWith(x)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${x}" but pathname "${k.pathname}" was given in the \`location\` prop.`),w=k}else w=b;let P=w.pathname||"/",j=P;if(x!=="/"){let k=x.replace(/^\//,"").split("/");j="/"+P.replace(/^\//,"").split("/").slice(k.length).join("/")}let N=ux(e,{pathname:j});Cn(v||N!=null,`No routes matched location "${w.pathname}${w.search}${w.hash}" `),Cn(N==null||N[N.length-1].route.element!==void 0||N[N.length-1].route.Component!==void 0||N[N.length-1].route.lazy!==void 0,`Matched leaf route at location "${w.pathname}${w.search}${w.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let S=h1(N&&N.map(k=>Object.assign({},k,{params:Object.assign({},h,k.params),pathname:ir([x,c.encodeLocation?c.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?x:ir([x,c.encodeLocation?c.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),d,r,i,l);return t&&S?y.createElement(Wa.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...w},navigationType:"POP"}},S):S}function u1(){let e=v1(),t=Xw(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:i},c={padding:"2px 4px",backgroundColor:i},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:c},"ErrorBoundary")," or"," ",y.createElement("code",{style:c},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},t),r?y.createElement("pre",{style:l},r):null,d)}var d1=y.createElement(u1,null),jx=class extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=a1(e.digest);r&&(e=r)}let t=e!==void 0?y.createElement(pr.Provider,{value:this.props.routeContext},y.createElement(Xd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?y.createElement(p1,{error:e},t):t}};jx.contextType=e1;var Mu=new WeakMap;function p1({children:e,error:t}){let{basename:r}=y.useContext(un);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=i1(t.digest);if(i){let l=Mu.get(t);if(l)throw l;let c=gx(i.location,r);if(mx&&!Mu.get(t))if(c.isExternal||i.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:i.replace}));throw Mu.set(t,d),d}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function f1({routeContext:e,match:t,children:r}){let i=y.useContext(Li);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(pr.Provider,{value:e},r)}function h1(e,t=[],r=null,i=null,l=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let c=e,d=r==null?void 0:r.errors;if(d!=null){let x=c.findIndex(v=>v.route.id&&(d==null?void 0:d[v.route.id])!==void 0);Ge(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,x+1))}let p=!1,h=-1;if(r)for(let x=0;x<c.length;x++){let v=c[x];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(h=x),v.route.id){let{loaderData:b,errors:w}=r,P=v.route.loader&&!b.hasOwnProperty(v.route.id)&&(!w||w[v.route.id]===void 0);if(v.route.lazy||P){p=!0,h>=0?c=c.slice(0,h+1):c=[c[0]];break}}}let m=r&&i?(x,v)=>{var b,w;i(x,{location:r.location,params:((w=(b=r.matches)==null?void 0:b[0])==null?void 0:w.params)??{},unstable_pattern:Jw(r.matches),errorInfo:v})}:void 0;return c.reduceRight((x,v,b)=>{let w,P=!1,j=null,N=null;r&&(w=d&&v.route.id?d[v.route.id]:void 0,j=v.route.errorElement||d1,p&&(h<0&&b===0?(Sx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),P=!0,N=null):h===b&&(P=!0,N=v.route.hydrateFallbackElement||null)));let S=t.concat(c.slice(0,b+1)),T=()=>{let k;return w?k=j:P?k=N:v.route.Component?k=y.createElement(v.route.Component,null):v.route.element?k=v.route.element:k=x,y.createElement(f1,{match:v,routeContext:{outlet:x,matches:S,isDataRoute:r!=null},children:k})};return r&&(v.route.ErrorBoundary||v.route.errorElement||b===0)?y.createElement(jx,{location:r.location,revalidation:r.revalidation,component:j,error:w,children:T(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:m}):T()},null)}function Jd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function m1(e){let t=y.useContext(Li);return Ge(t,Jd(e)),t}function g1(e){let t=y.useContext(Ml);return Ge(t,Jd(e)),t}function x1(e){let t=y.useContext(pr);return Ge(t,Jd(e)),t}function Zd(e){let t=x1(e),r=t.matches[t.matches.length-1];return Ge(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function y1(){return Zd("useRouteId")}function v1(){var i;let e=y.useContext(Xd),t=g1("useRouteError"),r=Zd("useRouteError");return e!==void 0?e:(i=t.errors)==null?void 0:i[r]}function b1(){let{router:e}=m1("useNavigate"),t=Zd("useNavigate"),r=y.useRef(!1);return kx(()=>{r.current=!0}),y.useCallback(async(l,c={})=>{Cn(r.current,bx),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...c}))},[e,t])}var Hm={};function Sx(e,t,r){!t&&!Hm[e]&&(Hm[e]=!0,Cn(!1,r))}y.memo(k1);function k1({routes:e,future:t,state:r,onError:i}){return wx(e,void 0,r,i,t)}function Or(e){Ge(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function w1({basename:e="/",children:t=null,location:r,navigationType:i="POP",navigator:l,static:c=!1,unstable_useTransitions:d}){Ge(!Ha(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=e.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:p,navigator:l,static:c,unstable_useTransitions:d,future:{}}),[p,l,c,d]);typeof r=="string"&&(r=Di(r));let{pathname:m="/",search:x="",hash:v="",state:b=null,key:w="default"}=r,P=y.useMemo(()=>{let j=cr(m,p);return j==null?null:{location:{pathname:j,search:x,hash:v,state:b,key:w},navigationType:i}},[p,m,x,v,b,w,i]);return Cn(P!=null,`<Router basename="${p}"> is not able to match the URL "${m}${x}${v}" because it does not start with the basename, so the <Router> won't render anything.`),P==null?null:y.createElement(un.Provider,{value:h},y.createElement(Wa.Provider,{children:t,value:P}))}function j1({children:e,location:t}){return c1(yd(e),t)}function yd(e,t=[]){let r=[];return y.Children.forEach(e,(i,l)=>{if(!y.isValidElement(i))return;let c=[...t,l];if(i.type===y.Fragment){r.push.apply(r,yd(i.props.children,c));return}Ge(i.type===Or,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ge(!i.props.index||!i.props.children,"An index route cannot have child routes.");let d={id:i.props.id||c.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(d.children=yd(i.props.children,c)),r.push(d)}),r}var xl="get",yl="application/x-www-form-urlencoded";function Ol(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function S1(e){return Ol(e)&&e.tagName.toLowerCase()==="button"}function C1(e){return Ol(e)&&e.tagName.toLowerCase()==="form"}function N1(e){return Ol(e)&&e.tagName.toLowerCase()==="input"}function E1(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function P1(e,t){return e.button===0&&(!t||t==="_self")&&!E1(e)}function vd(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let i=e[r];return t.concat(Array.isArray(i)?i.map(l=>[r,l]):[[r,i]])},[]))}function T1(e,t){let r=vd(e);return t&&t.forEach((i,l)=>{r.has(l)||t.getAll(l).forEach(c=>{r.append(l,c)})}),r}var cl=null;function R1(){if(cl===null)try{new FormData(document.createElement("form"),0),cl=!1}catch{cl=!0}return cl}var D1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ou(e){return e!=null&&!D1.has(e)?(Cn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yl}"`),null):e}function L1(e,t){let r,i,l,c,d;if(C1(e)){let p=e.getAttribute("action");i=p?cr(p,t):null,r=e.getAttribute("method")||xl,l=Ou(e.getAttribute("enctype"))||yl,c=new FormData(e)}else if(S1(e)||N1(e)&&(e.type==="submit"||e.type==="image")){let p=e.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||p.getAttribute("action");if(i=h?cr(h,t):null,r=e.getAttribute("formmethod")||p.getAttribute("method")||xl,l=Ou(e.getAttribute("formenctype"))||Ou(p.getAttribute("enctype"))||yl,c=new FormData(p,e),!R1()){let{name:m,type:x,value:v}=e;if(x==="image"){let b=m?`${m}.`:"";c.append(`${b}x`,"0"),c.append(`${b}y`,"0")}else m&&c.append(m,v)}}else{if(Ol(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=xl,i=null,l=yl,d=e}return c&&l==="text/plain"&&(d=c,c=void 0),{action:i,method:r.toLowerCase(),encType:l,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ep(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function I1(e,t,r,i){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${i}`:l.pathname=`${l.pathname}.${i}`:l.pathname==="/"?l.pathname=`_root.${i}`:t&&cr(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${i}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${i}`,l}async function A1(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function M1(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function O1(e,t,r){let i=await Promise.all(e.map(async l=>{let c=t.routes[l.route.id];if(c){let d=await A1(c,r);return d.links?d.links():[]}return[]}));return V1(i.flat(1).filter(M1).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function Km(e,t,r,i,l,c){let d=(h,m)=>r[m]?h.route.id!==r[m].route.id:!0,p=(h,m)=>{var x;return r[m].pathname!==h.pathname||((x=r[m].route.path)==null?void 0:x.endsWith("*"))&&r[m].params["*"]!==h.params["*"]};return c==="assets"?t.filter((h,m)=>d(h,m)||p(h,m)):c==="data"?t.filter((h,m)=>{var v;let x=i.routes[h.route.id];if(!x||!x.hasLoader)return!1;if(d(h,m)||p(h,m))return!0;if(h.route.shouldRevalidate){let b=h.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((v=r[0])==null?void 0:v.params)||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function F1(e,t,{includeHydrateFallback:r}={}){return _1(e.map(i=>{let l=t.routes[i.route.id];if(!l)return[];let c=[l.module];return l.clientActionModule&&(c=c.concat(l.clientActionModule)),l.clientLoaderModule&&(c=c.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(c=c.concat(l.hydrateFallbackModule)),l.imports&&(c=c.concat(l.imports)),c}).flat(1))}function _1(e){return[...new Set(e)]}function z1(e){let t={},r=Object.keys(e).sort();for(let i of r)t[i]=e[i];return t}function V1(e,t){let r=new Set;return new Set(t),e.reduce((i,l)=>{let c=JSON.stringify(z1(l));return r.has(c)||(r.add(c),i.push({key:c,link:l})),i},[])}function Cx(){let e=y.useContext(Li);return ep(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function B1(){let e=y.useContext(Ml);return ep(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var tp=y.createContext(void 0);tp.displayName="FrameworkContext";function Nx(){let e=y.useContext(tp);return ep(e,"You must render this element inside a <HydratedRouter> element"),e}function $1(e,t){let r=y.useContext(tp),[i,l]=y.useState(!1),[c,d]=y.useState(!1),{onFocus:p,onBlur:h,onMouseEnter:m,onMouseLeave:x,onTouchStart:v}=t,b=y.useRef(null);y.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let j=S=>{S.forEach(T=>{d(T.isIntersecting)})},N=new IntersectionObserver(j,{threshold:.5});return b.current&&N.observe(b.current),()=>{N.disconnect()}}},[e]),y.useEffect(()=>{if(i){let j=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(j)}}},[i]);let w=()=>{l(!0)},P=()=>{l(!1),d(!1)};return r?e!=="intent"?[c,b,{}]:[c,b,{onFocus:va(p,w),onBlur:va(h,P),onMouseEnter:va(m,w),onMouseLeave:va(x,P),onTouchStart:va(v,w)}]:[!1,b,{}]}function va(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function U1({page:e,...t}){let{router:r}=Cx(),i=y.useMemo(()=>ux(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?y.createElement(H1,{page:e,matches:i,...t}):null}function W1(e){let{manifest:t,routeModules:r}=Nx(),[i,l]=y.useState([]);return y.useEffect(()=>{let c=!1;return O1(e,t,r).then(d=>{c||l(d)}),()=>{c=!0}},[e,t,r]),i}function H1({page:e,matches:t,...r}){let i=Yr(),{future:l,manifest:c,routeModules:d}=Nx(),{basename:p}=Cx(),{loaderData:h,matches:m}=B1(),x=y.useMemo(()=>Km(e,t,m,c,i,"data"),[e,t,m,c,i]),v=y.useMemo(()=>Km(e,t,m,c,i,"assets"),[e,t,m,c,i]),b=y.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let j=new Set,N=!1;if(t.forEach(T=>{var E;let k=c.routes[T.route.id];!k||!k.hasLoader||(!x.some(R=>R.route.id===T.route.id)&&T.route.id in h&&((E=d[T.route.id])!=null&&E.shouldRevalidate)||k.hasClientLoader?N=!0:j.add(T.route.id))}),j.size===0)return[];let S=I1(e,p,l.unstable_trailingSlashAwareDataRequests,"data");return N&&j.size>0&&S.searchParams.set("_routes",t.filter(T=>j.has(T.route.id)).map(T=>T.route.id).join(",")),[S.pathname+S.search]},[p,l.unstable_trailingSlashAwareDataRequests,h,i,c,x,t,e,d]),w=y.useMemo(()=>F1(v,c),[v,c]),P=W1(v);return y.createElement(y.Fragment,null,b.map(j=>y.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...r})),w.map(j=>y.createElement("link",{key:j,rel:"modulepreload",href:j,...r})),P.map(({key:j,link:N})=>y.createElement("link",{key:j,nonce:r.nonce,...N,crossOrigin:N.crossOrigin??r.crossOrigin})))}function K1(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var q1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{q1&&(window.__reactRouterVersion="7.13.0")}catch{}function Q1({basename:e,children:t,unstable_useTransitions:r,window:i}){let l=y.useRef();l.current==null&&(l.current=Ew({window:i,v5Compat:!0}));let c=l.current,[d,p]=y.useState({action:c.action,location:c.location}),h=y.useCallback(m=>{r===!1?p(m):y.startTransition(()=>p(m))},[r]);return y.useLayoutEffect(()=>c.listen(h),[c,h]),y.createElement(w1,{basename:e,children:t,location:d.location,navigationType:d.action,navigator:c,unstable_useTransitions:r})}var Ex=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,np=y.forwardRef(function({onClick:t,discover:r="render",prefetch:i="none",relative:l,reloadDocument:c,replace:d,state:p,target:h,to:m,preventScrollReset:x,viewTransition:v,unstable_defaultShouldRevalidate:b,...w},P){let{basename:j,unstable_useTransitions:N}=y.useContext(un),S=typeof m=="string"&&Ex.test(m),T=gx(m,j);m=T.to;let k=o1(m,{relative:l}),[E,R,M]=$1(i,w),H=X1(m,{replace:d,state:p,target:h,preventScrollReset:x,relative:l,viewTransition:v,unstable_defaultShouldRevalidate:b,unstable_useTransitions:N});function B(X){t&&t(X),X.defaultPrevented||H(X)}let te=y.createElement("a",{...w,...M,href:T.absoluteURL||k,onClick:T.isExternal||c?t:B,ref:K1(P,R),target:h,"data-discover":!S&&r==="render"?"true":void 0});return E&&!S?y.createElement(y.Fragment,null,te,y.createElement(U1,{page:k})):te});np.displayName="Link";var Px=y.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:i="",end:l=!1,style:c,to:d,viewTransition:p,children:h,...m},x){let v=Ka(d,{relative:m.relative}),b=Yr(),w=y.useContext(Ml),{navigator:P,basename:j}=y.useContext(un),N=w!=null&&n2(v)&&p===!0,S=P.encodeLocation?P.encodeLocation(v).pathname:v.pathname,T=b.pathname,k=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(T=T.toLowerCase(),k=k?k.toLowerCase():null,S=S.toLowerCase()),k&&j&&(k=cr(k,j)||k);const E=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let R=T===S||!l&&T.startsWith(S)&&T.charAt(E)==="/",M=k!=null&&(k===S||!l&&k.startsWith(S)&&k.charAt(S.length)==="/"),H={isActive:R,isPending:M,isTransitioning:N},B=R?t:void 0,te;typeof i=="function"?te=i(H):te=[i,R?"active":null,M?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let X=typeof c=="function"?c(H):c;return y.createElement(np,{...m,"aria-current":B,className:te,ref:x,style:X,to:d,viewTransition:p},typeof h=="function"?h(H):h)});Px.displayName="NavLink";var G1=y.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:l,state:c,method:d=xl,action:p,onSubmit:h,relative:m,preventScrollReset:x,viewTransition:v,unstable_defaultShouldRevalidate:b,...w},P)=>{let{unstable_useTransitions:j}=y.useContext(un),N=e2(),S=t2(p,{relative:m}),T=d.toLowerCase()==="get"?"get":"post",k=typeof p=="string"&&Ex.test(p),E=R=>{if(h&&h(R),R.defaultPrevented)return;R.preventDefault();let M=R.nativeEvent.submitter,H=(M==null?void 0:M.getAttribute("formmethod"))||d,B=()=>N(M||R.currentTarget,{fetcherKey:t,method:H,navigate:r,replace:l,state:c,relative:m,preventScrollReset:x,viewTransition:v,unstable_defaultShouldRevalidate:b});j&&r!==!1?y.startTransition(()=>B()):B()};return y.createElement("form",{ref:P,method:T,action:S,onSubmit:i?h:E,...w,"data-discover":!k&&e==="render"?"true":void 0})});G1.displayName="Form";function Y1(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Tx(e){let t=y.useContext(Li);return Ge(t,Y1(e)),t}function X1(e,{target:t,replace:r,state:i,preventScrollReset:l,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:p,unstable_useTransitions:h}={}){let m=Ii(),x=Yr(),v=Ka(e,{relative:c});return y.useCallback(b=>{if(P1(b,t)){b.preventDefault();let w=r!==void 0?r:La(x)===La(v),P=()=>m(e,{replace:w,state:i,preventScrollReset:l,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:p});h?y.startTransition(()=>P()):P()}},[x,m,v,r,i,t,e,l,c,d,p,h])}function Rx(e){Cn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=y.useRef(vd(e)),r=y.useRef(!1),i=Yr(),l=y.useMemo(()=>T1(i.search,r.current?null:t.current),[i.search]),c=Ii(),d=y.useCallback((p,h)=>{const m=vd(typeof p=="function"?p(new URLSearchParams(l)):p);r.current=!0,c("?"+m,h)},[c,l]);return[l,d]}var J1=0,Z1=()=>`__${String(++J1)}__`;function e2(){let{router:e}=Tx("useSubmit"),{basename:t}=y.useContext(un),r=y1(),i=e.fetch,l=e.navigate;return y.useCallback(async(c,d={})=>{let{action:p,method:h,encType:m,formData:x,body:v}=L1(c,t);if(d.navigate===!1){let b=d.fetcherKey||Z1();await i(b,r,d.action||p,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:x,body:v,formMethod:d.method||h,formEncType:d.encType||m,flushSync:d.flushSync})}else await l(d.action||p,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:x,body:v,formMethod:d.method||h,formEncType:d.encType||m,replace:d.replace,state:d.state,fromRouteId:r,flushSync:d.flushSync,viewTransition:d.viewTransition})},[i,l,t,r])}function t2(e,{relative:t}={}){let{basename:r}=y.useContext(un),i=y.useContext(pr);Ge(i,"useFormAction must be used inside a RouteContext");let[l]=i.matches.slice(-1),c={...Ka(e||".",{relative:t})},d=Yr();if(e==null){c.search=d.search;let p=new URLSearchParams(c.search),h=p.getAll("index");if(h.some(x=>x==="")){p.delete("index"),h.filter(v=>v).forEach(v=>p.append("index",v));let x=p.toString();c.search=x?`?${x}`:""}}return(!e||e===".")&&l.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(c.pathname=c.pathname==="/"?r:ir([r,c.pathname])),La(c)}function n2(e,{relative:t}={}){let r=y.useContext(yx);Ge(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=Tx("useViewTransitionState"),l=Ka(e,{relative:t});if(!r.isTransitioning)return!1;let c=cr(r.currentLocation.pathname,i)||r.currentLocation.pathname,d=cr(r.nextLocation.pathname,i)||r.nextLocation.pathname;return Sl(l.pathname,d)!=null||Sl(l.pathname,c)!=null}class r2 extends y.Component{constructor(r){super(r);bm(this,"handleRetry",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,i){console.error("ErrorBoundary caught an error:",r,i)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 p-4",children:o.jsxs("div",{className:"max-w-md w-full bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 text-center",children:[o.jsx("div",{className:"text-red-500 mb-4",children:o.jsx("svg",{className:"w-16 h-16 mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),o.jsx("h1",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:"Something went wrong"}),o.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:"An unexpected error occurred. Please try again."}),this.state.error&&o.jsx("pre",{className:"text-left text-sm bg-gray-100 dark:bg-gray-700 p-3 rounded mb-4 overflow-auto max-h-32 text-gray-700 dark:text-gray-300",children:this.state.error.message}),o.jsxs("div",{className:"flex gap-3 justify-center",children:[o.jsx("button",{type:"button",onClick:this.handleRetry,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Try Again"}),o.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-lg hover:bg-gray-300 dark:hover:bg-gray-500 transition-colors",children:"Reload Page"})]})]})}):this.props.children}}function Nn(e,t){const[r,i]=y.useState(()=>{try{const c=window.localStorage.getItem(e);return c?JSON.parse(c):t}catch{return t}}),l=y.useCallback(c=>{i(d=>{const p=c instanceof Function?c(d):c;try{window.localStorage.setItem(e,JSON.stringify(p))}catch(h){console.warn(`Failed to persist "${e}" to localStorage:`,h)}return p})},[e]);return y.useEffect(()=>{const c=d=>{if(d.key===e&&d.newValue!==null)try{i(JSON.parse(d.newValue))}catch{}};return window.addEventListener("storage",c),()=>window.removeEventListener("storage",c)},[e]),[r,l]}const s2={theme:"system",lastBrowsedPath:"/",showHiddenFiles:!1,statsRefreshInterval:0},Dx=y.createContext(null);function i2(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function a2({children:e}){const[t,r]=Nn("rag-vault-preferences",s2),i=t.theme==="system"?i2():t.theme;y.useEffect(()=>{const h=document.documentElement;i==="dark"?h.classList.add("dark"):h.classList.remove("dark")},[i]),y.useEffect(()=>{if(t.theme!=="system")return;const h=window.matchMedia("(prefers-color-scheme: dark)"),m=()=>{const x=document.documentElement;h.matches?x.classList.add("dark"):x.classList.remove("dark")};return h.addEventListener("change",m),()=>h.removeEventListener("change",m)},[t.theme]);const l=y.useCallback(h=>{r(m=>({...m,theme:h}))},[r]),c=y.useCallback(h=>{r(m=>({...m,lastBrowsedPath:h}))},[r]),d=y.useCallback(h=>{r(m=>({...m,showHiddenFiles:h}))},[r]),p=y.useCallback(h=>{r(m=>({...m,statsRefreshInterval:h}))},[r]);return o.jsx(Dx.Provider,{value:{preferences:t,setTheme:l,setLastBrowsedPath:c,setShowHiddenFiles:d,setStatsRefreshInterval:p,effectiveTheme:i},children:e})}function Fl(){const e=y.useContext(Dx);if(!e)throw new Error("usePreferences must be used within a PreferencesProvider");return e}const rp=y.createContext({});function sp(e){const t=y.useRef(null);return t.current===null&&(t.current=e()),t.current}const _l=y.createContext(null),ip=y.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class o2 extends y.Component{getSnapshotBeforeUpdate(t){const r=this.props.childRef.current;if(r&&t.isPresent&&!this.props.isPresent){const i=this.props.sizeRef.current;i.height=r.offsetHeight||0,i.width=r.offsetWidth||0,i.top=r.offsetTop,i.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function l2({children:e,isPresent:t}){const r=y.useId(),i=y.useRef(null),l=y.useRef({width:0,height:0,top:0,left:0}),{nonce:c}=y.useContext(ip);return y.useInsertionEffect(()=>{const{width:d,height:p,top:h,left:m}=l.current;if(t||!i.current||!d||!p)return;i.current.dataset.motionPopId=r;const x=document.createElement("style");return c&&(x.nonce=c),document.head.appendChild(x),x.sheet&&x.sheet.insertRule(`
|
|
52
|
+
[data-motion-pop-id="${r}"] {
|
|
53
|
+
position: absolute !important;
|
|
54
|
+
width: ${d}px !important;
|
|
55
|
+
height: ${p}px !important;
|
|
56
|
+
top: ${h}px !important;
|
|
57
|
+
left: ${m}px !important;
|
|
58
|
+
}
|
|
59
|
+
`),()=>{document.head.removeChild(x)}},[t]),o.jsx(o2,{isPresent:t,childRef:i,sizeRef:l,children:y.cloneElement(e,{ref:i})})}const c2=({children:e,initial:t,isPresent:r,onExitComplete:i,custom:l,presenceAffectsLayout:c,mode:d})=>{const p=sp(u2),h=y.useId(),m=y.useCallback(v=>{p.set(v,!0);for(const b of p.values())if(!b)return;i&&i()},[p,i]),x=y.useMemo(()=>({id:h,initial:t,isPresent:r,custom:l,onExitComplete:m,register:v=>(p.set(v,!1),()=>p.delete(v))}),c?[Math.random(),m]:[r,m]);return y.useMemo(()=>{p.forEach((v,b)=>p.set(b,!1))},[r]),y.useEffect(()=>{!r&&!p.size&&i&&i()},[r]),d==="popLayout"&&(e=o.jsx(l2,{isPresent:r,children:e})),o.jsx(_l.Provider,{value:x,children:e})};function u2(){return new Map}function Lx(e=!0){const t=y.useContext(_l);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:i,register:l}=t,c=y.useId();y.useEffect(()=>{e&&l(c)},[e]);const d=y.useCallback(()=>e&&i&&i(c),[c,i,e]);return!r&&i?[!1,d]:[!0]}const ul=e=>e.key||"";function qm(e){const t=[];return y.Children.forEach(e,r=>{y.isValidElement(r)&&t.push(r)}),t}const ap=typeof window<"u",Ix=ap?y.useLayoutEffect:y.useEffect,ut=({children:e,custom:t,initial:r=!0,onExitComplete:i,presenceAffectsLayout:l=!0,mode:c="sync",propagate:d=!1})=>{const[p,h]=Lx(d),m=y.useMemo(()=>qm(e),[e]),x=d&&!p?[]:m.map(ul),v=y.useRef(!0),b=y.useRef(m),w=sp(()=>new Map),[P,j]=y.useState(m),[N,S]=y.useState(m);Ix(()=>{v.current=!1,b.current=m;for(let E=0;E<N.length;E++){const R=ul(N[E]);x.includes(R)?w.delete(R):w.get(R)!==!0&&w.set(R,!1)}},[N,x.length,x.join("-")]);const T=[];if(m!==P){let E=[...m];for(let R=0;R<N.length;R++){const M=N[R],H=ul(M);x.includes(H)||(E.splice(R,0,M),T.push(M))}c==="wait"&&T.length&&(E=T),S(qm(E)),j(m);return}const{forceRender:k}=y.useContext(rp);return o.jsx(o.Fragment,{children:N.map(E=>{const R=ul(E),M=d&&!p?!1:m===N||x.includes(R),H=()=>{if(w.has(R))w.set(R,!0);else return;let B=!0;w.forEach(te=>{te||(B=!1)}),B&&(k==null||k(),S(b.current),d&&(h==null||h()),i&&i())};return o.jsx(c2,{isPresent:M,initial:!v.current||r?void 0:!1,custom:M?void 0:t,presenceAffectsLayout:l,mode:c,onExitComplete:M?void 0:H,children:E},R)})})},Xt=e=>e;let Ax=Xt;function op(e){let t;return()=>(t===void 0&&(t=e()),t)}const Ni=(e,t,r)=>{const i=t-e;return i===0?1:(r-e)/i},ar=e=>e*1e3,or=e=>e/1e3,d2={useManualTiming:!1};function p2(e){let t=new Set,r=new Set,i=!1,l=!1;const c=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function p(m){c.has(m)&&(h.schedule(m),e()),m(d)}const h={schedule:(m,x=!1,v=!1)=>{const w=v&&i?t:r;return x&&c.add(m),w.has(m)||w.add(m),m},cancel:m=>{r.delete(m),c.delete(m)},process:m=>{if(d=m,i){l=!0;return}i=!0,[t,r]=[r,t],t.forEach(p),t.clear(),i=!1,l&&(l=!1,h.process(m))}};return h}const dl=["read","resolveKeyframes","update","preRender","render","postRender"],f2=40;function Mx(e,t){let r=!1,i=!0;const l={delta:0,timestamp:0,isProcessing:!1},c=()=>r=!0,d=dl.reduce((S,T)=>(S[T]=p2(c),S),{}),{read:p,resolveKeyframes:h,update:m,preRender:x,render:v,postRender:b}=d,w=()=>{const S=performance.now();r=!1,l.delta=i?1e3/60:Math.max(Math.min(S-l.timestamp,f2),1),l.timestamp=S,l.isProcessing=!0,p.process(l),h.process(l),m.process(l),x.process(l),v.process(l),b.process(l),l.isProcessing=!1,r&&t&&(i=!1,e(w))},P=()=>{r=!0,i=!0,l.isProcessing||e(w)};return{schedule:dl.reduce((S,T)=>{const k=d[T];return S[T]=(E,R=!1,M=!1)=>(r||P(),k.schedule(E,R,M)),S},{}),cancel:S=>{for(let T=0;T<dl.length;T++)d[dl[T]].cancel(S)},state:l,steps:d}}const{schedule:We,cancel:Qr,state:yt,steps:Fu}=Mx(typeof requestAnimationFrame<"u"?requestAnimationFrame:Xt,!0),Ox=y.createContext({strict:!1}),Qm={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ei={};for(const e in Qm)Ei[e]={isEnabled:t=>Qm[e].some(r=>!!t[r])};function h2(e){for(const t in e)Ei[t]={...Ei[t],...e[t]}}const m2=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Cl(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||m2.has(e)}let Fx=e=>!Cl(e);function g2(e){e&&(Fx=t=>t.startsWith("on")?!Cl(t):e(t))}try{g2(require("@emotion/is-prop-valid").default)}catch{}function x2(e,t,r){const i={};for(const l in e)l==="values"&&typeof e.values=="object"||(Fx(l)||r===!0&&Cl(l)||!t&&!Cl(l)||e.draggable&&l.startsWith("onDrag"))&&(i[l]=e[l]);return i}function y2(e){if(typeof Proxy>"u")return e;const t=new Map,r=(...i)=>e(...i);return new Proxy(r,{get:(i,l)=>l==="create"?e:(t.has(l)||t.set(l,e(l)),t.get(l))})}const zl=y.createContext({});function Ia(e){return typeof e=="string"||Array.isArray(e)}function Vl(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const lp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cp=["initial",...lp];function Bl(e){return Vl(e.animate)||cp.some(t=>Ia(e[t]))}function _x(e){return!!(Bl(e)||e.variants)}function v2(e,t){if(Bl(e)){const{initial:r,animate:i}=e;return{initial:r===!1||Ia(r)?r:void 0,animate:Ia(i)?i:void 0}}return e.inherit!==!1?t:{}}function b2(e){const{initial:t,animate:r}=v2(e,y.useContext(zl));return y.useMemo(()=>({initial:t,animate:r}),[Gm(t),Gm(r)])}function Gm(e){return Array.isArray(e)?e.join(" "):e}const k2=Symbol.for("motionComponentSymbol");function li(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function w2(e,t,r){return y.useCallback(i=>{i&&e.onMount&&e.onMount(i),t&&(i?t.mount(i):t.unmount()),r&&(typeof r=="function"?r(i):li(r)&&(r.current=i))},[t])}const up=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),j2="framerAppearId",zx="data-"+up(j2),{schedule:dp}=Mx(queueMicrotask,!1),Vx=y.createContext({});function S2(e,t,r,i,l){var c,d;const{visualElement:p}=y.useContext(zl),h=y.useContext(Ox),m=y.useContext(_l),x=y.useContext(ip).reducedMotion,v=y.useRef(null);i=i||h.renderer,!v.current&&i&&(v.current=i(e,{visualState:t,parent:p,props:r,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:x}));const b=v.current,w=y.useContext(Vx);b&&!b.projection&&l&&(b.type==="html"||b.type==="svg")&&C2(v.current,r,l,w);const P=y.useRef(!1);y.useInsertionEffect(()=>{b&&P.current&&b.update(r,m)});const j=r[zx],N=y.useRef(!!j&&!(!((c=window.MotionHandoffIsComplete)===null||c===void 0)&&c.call(window,j))&&((d=window.MotionHasOptimisedAnimation)===null||d===void 0?void 0:d.call(window,j)));return Ix(()=>{b&&(P.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),dp.render(b.render),N.current&&b.animationState&&b.animationState.animateChanges())}),y.useEffect(()=>{b&&(!N.current&&b.animationState&&b.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var S;(S=window.MotionHandoffMarkAsComplete)===null||S===void 0||S.call(window,j)}),N.current=!1))}),b}function C2(e,t,r,i){const{layoutId:l,layout:c,drag:d,dragConstraints:p,layoutScroll:h,layoutRoot:m}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:Bx(e.parent)),e.projection.setOptions({layoutId:l,layout:c,alwaysMeasureLayout:!!d||p&&li(p),visualElement:e,animationType:typeof c=="string"?c:"both",initialPromotionConfig:i,layoutScroll:h,layoutRoot:m})}function Bx(e){if(e)return e.options.allowProjection!==!1?e.projection:Bx(e.parent)}function N2({preloadedFeatures:e,createVisualElement:t,useRender:r,useVisualState:i,Component:l}){var c,d;e&&h2(e);function p(m,x){let v;const b={...y.useContext(ip),...m,layoutId:E2(m)},{isStatic:w}=b,P=b2(m),j=i(m,w);if(!w&&ap){P2();const N=T2(b);v=N.MeasureLayout,P.visualElement=S2(l,j,b,t,N.ProjectionNode)}return o.jsxs(zl.Provider,{value:P,children:[v&&P.visualElement?o.jsx(v,{visualElement:P.visualElement,...b}):null,r(l,m,w2(j,P.visualElement,x),j,w,P.visualElement)]})}p.displayName=`motion.${typeof l=="string"?l:`create(${(d=(c=l.displayName)!==null&&c!==void 0?c:l.name)!==null&&d!==void 0?d:""})`}`;const h=y.forwardRef(p);return h[k2]=l,h}function E2({layoutId:e}){const t=y.useContext(rp).id;return t&&e!==void 0?t+"-"+e:e}function P2(e,t){y.useContext(Ox).strict}function T2(e){const{drag:t,layout:r}=Ei;if(!t&&!r)return{};const i={...t,...r};return{MeasureLayout:t!=null&&t.isEnabled(e)||r!=null&&r.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const R2=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function pp(e){return typeof e!="string"||e.includes("-")?!1:!!(R2.indexOf(e)>-1||/[A-Z]/u.test(e))}function Ym(e){const t=[{},{}];return e==null||e.values.forEach((r,i)=>{t[0][i]=r.get(),t[1][i]=r.getVelocity()}),t}function fp(e,t,r,i){if(typeof t=="function"){const[l,c]=Ym(i);t=t(r!==void 0?r:e.custom,l,c)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[l,c]=Ym(i);t=t(r!==void 0?r:e.custom,l,c)}return t}const bd=e=>Array.isArray(e),D2=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),L2=e=>bd(e)?e[e.length-1]||0:e,Et=e=>!!(e&&e.getVelocity);function vl(e){const t=Et(e)?e.get():e;return D2(t)?t.toValue():t}function I2({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:r},i,l,c){const d={latestValues:A2(i,l,c,e),renderState:t()};return r&&(d.onMount=p=>r({props:i,current:p,...d}),d.onUpdate=p=>r(p)),d}const $x=e=>(t,r)=>{const i=y.useContext(zl),l=y.useContext(_l),c=()=>I2(e,t,i,l);return r?c():sp(c)};function A2(e,t,r,i){const l={},c=i(e,{});for(const b in c)l[b]=vl(c[b]);let{initial:d,animate:p}=e;const h=Bl(e),m=_x(e);t&&m&&!h&&e.inherit!==!1&&(d===void 0&&(d=t.initial),p===void 0&&(p=t.animate));let x=r?r.initial===!1:!1;x=x||d===!1;const v=x?p:d;if(v&&typeof v!="boolean"&&!Vl(v)){const b=Array.isArray(v)?v:[v];for(let w=0;w<b.length;w++){const P=fp(e,b[w]);if(P){const{transitionEnd:j,transition:N,...S}=P;for(const T in S){let k=S[T];if(Array.isArray(k)){const E=x?k.length-1:0;k=k[E]}k!==null&&(l[T]=k)}for(const T in j)l[T]=j[T]}}}return l}const Ai=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Fs=new Set(Ai),Ux=e=>t=>typeof t=="string"&&t.startsWith(e),Wx=Ux("--"),M2=Ux("var(--"),hp=e=>M2(e)?O2.test(e.split("/*")[0].trim()):!1,O2=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Hx=(e,t)=>t&&typeof e=="number"?t.transform(e):e,ur=(e,t,r)=>r>t?t:r<e?e:r,Mi={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Aa={...Mi,transform:e=>ur(0,1,e)},pl={...Mi,default:1},qa=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Fr=qa("deg"),zn=qa("%"),xe=qa("px"),F2=qa("vh"),_2=qa("vw"),Xm={...zn,parse:e=>zn.parse(e)/100,transform:e=>zn.transform(e*100)},z2={borderWidth:xe,borderTopWidth:xe,borderRightWidth:xe,borderBottomWidth:xe,borderLeftWidth:xe,borderRadius:xe,radius:xe,borderTopLeftRadius:xe,borderTopRightRadius:xe,borderBottomRightRadius:xe,borderBottomLeftRadius:xe,width:xe,maxWidth:xe,height:xe,maxHeight:xe,top:xe,right:xe,bottom:xe,left:xe,padding:xe,paddingTop:xe,paddingRight:xe,paddingBottom:xe,paddingLeft:xe,margin:xe,marginTop:xe,marginRight:xe,marginBottom:xe,marginLeft:xe,backgroundPositionX:xe,backgroundPositionY:xe},V2={rotate:Fr,rotateX:Fr,rotateY:Fr,rotateZ:Fr,scale:pl,scaleX:pl,scaleY:pl,scaleZ:pl,skew:Fr,skewX:Fr,skewY:Fr,distance:xe,translateX:xe,translateY:xe,translateZ:xe,x:xe,y:xe,z:xe,perspective:xe,transformPerspective:xe,opacity:Aa,originX:Xm,originY:Xm,originZ:xe},Jm={...Mi,transform:Math.round},mp={...z2,...V2,zIndex:Jm,size:xe,fillOpacity:Aa,strokeOpacity:Aa,numOctaves:Jm},B2={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$2=Ai.length;function U2(e,t,r){let i="",l=!0;for(let c=0;c<$2;c++){const d=Ai[c],p=e[d];if(p===void 0)continue;let h=!0;if(typeof p=="number"?h=p===(d.startsWith("scale")?1:0):h=parseFloat(p)===0,!h||r){const m=Hx(p,mp[d]);if(!h){l=!1;const x=B2[d]||d;i+=`${x}(${m}) `}r&&(t[d]=m)}}return i=i.trim(),r?i=r(t,l?"":i):l&&(i="none"),i}function gp(e,t,r){const{style:i,vars:l,transformOrigin:c}=e;let d=!1,p=!1;for(const h in t){const m=t[h];if(Fs.has(h)){d=!0;continue}else if(Wx(h)){l[h]=m;continue}else{const x=Hx(m,mp[h]);h.startsWith("origin")?(p=!0,c[h]=x):i[h]=x}}if(t.transform||(d||r?i.transform=U2(t,e.transform,r):i.transform&&(i.transform="none")),p){const{originX:h="50%",originY:m="50%",originZ:x=0}=c;i.transformOrigin=`${h} ${m} ${x}`}}const W2={offset:"stroke-dashoffset",array:"stroke-dasharray"},H2={offset:"strokeDashoffset",array:"strokeDasharray"};function K2(e,t,r=1,i=0,l=!0){e.pathLength=1;const c=l?W2:H2;e[c.offset]=xe.transform(-i);const d=xe.transform(t),p=xe.transform(r);e[c.array]=`${d} ${p}`}function Zm(e,t,r){return typeof e=="string"?e:xe.transform(t+r*e)}function q2(e,t,r){const i=Zm(t,e.x,e.width),l=Zm(r,e.y,e.height);return`${i} ${l}`}function xp(e,{attrX:t,attrY:r,attrScale:i,originX:l,originY:c,pathLength:d,pathSpacing:p=1,pathOffset:h=0,...m},x,v){if(gp(e,m,v),x){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:b,style:w,dimensions:P}=e;b.transform&&(P&&(w.transform=b.transform),delete b.transform),P&&(l!==void 0||c!==void 0||w.transform)&&(w.transformOrigin=q2(P,l!==void 0?l:.5,c!==void 0?c:.5)),t!==void 0&&(b.x=t),r!==void 0&&(b.y=r),i!==void 0&&(b.scale=i),d!==void 0&&K2(b,d,p,h,!1)}const yp=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Kx=()=>({...yp(),attrs:{}}),vp=e=>typeof e=="string"&&e.toLowerCase()==="svg";function qx(e,{style:t,vars:r},i,l){Object.assign(e.style,t,l&&l.getProjectionStyles(i));for(const c in r)e.style.setProperty(c,r[c])}const Qx=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Gx(e,t,r,i){qx(e,t,void 0,i);for(const l in t.attrs)e.setAttribute(Qx.has(l)?l:up(l),t.attrs[l])}const Nl={};function Q2(e){Object.assign(Nl,e)}function Yx(e,{layout:t,layoutId:r}){return Fs.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!Nl[e]||e==="opacity")}function bp(e,t,r){var i;const{style:l}=e,c={};for(const d in l)(Et(l[d])||t.style&&Et(t.style[d])||Yx(d,e)||((i=r==null?void 0:r.getValue(d))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(c[d]=l[d]);return c}function Xx(e,t,r){const i=bp(e,t,r);for(const l in e)if(Et(e[l])||Et(t[l])){const c=Ai.indexOf(l)!==-1?"attr"+l.charAt(0).toUpperCase()+l.substring(1):l;i[c]=e[l]}return i}function G2(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const e0=["x","y","width","height","cx","cy","r"],Y2={useVisualState:$x({scrapeMotionValuesFromProps:Xx,createRenderState:Kx,onUpdate:({props:e,prevProps:t,current:r,renderState:i,latestValues:l})=>{if(!r)return;let c=!!e.drag;if(!c){for(const p in l)if(Fs.has(p)){c=!0;break}}if(!c)return;let d=!t;if(t)for(let p=0;p<e0.length;p++){const h=e0[p];e[h]!==t[h]&&(d=!0)}d&&We.read(()=>{G2(r,i),We.render(()=>{xp(i,l,vp(r.tagName),e.transformTemplate),Gx(r,i)})})}})},X2={useVisualState:$x({scrapeMotionValuesFromProps:bp,createRenderState:yp})};function Jx(e,t,r){for(const i in t)!Et(t[i])&&!Yx(i,r)&&(e[i]=t[i])}function J2({transformTemplate:e},t){return y.useMemo(()=>{const r=yp();return gp(r,t,e),Object.assign({},r.vars,r.style)},[t])}function Z2(e,t){const r=e.style||{},i={};return Jx(i,r,e),Object.assign(i,J2(e,t)),i}function ej(e,t){const r={},i=Z2(e,t);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}function tj(e,t,r,i){const l=y.useMemo(()=>{const c=Kx();return xp(c,t,vp(i),e.transformTemplate),{...c.attrs,style:{...c.style}}},[t]);if(e.style){const c={};Jx(c,e.style,e),l.style={...c,...l.style}}return l}function nj(e=!1){return(r,i,l,{latestValues:c},d)=>{const h=(pp(r)?tj:ej)(i,c,d,r),m=x2(i,typeof r=="string",e),x=r!==y.Fragment?{...m,...h,ref:l}:{},{children:v}=i,b=y.useMemo(()=>Et(v)?v.get():v,[v]);return y.createElement(r,{...x,children:b})}}function rj(e,t){return function(i,{forwardMotionProps:l}={forwardMotionProps:!1}){const d={...pp(i)?Y2:X2,preloadedFeatures:e,useRender:nj(l),createVisualElement:t,Component:i};return N2(d)}}function Zx(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}function $l(e,t,r){const i=e.getProps();return fp(i,t,r!==void 0?r:i.custom,e)}const sj=op(()=>window.ScrollTimeline!==void 0);class ij{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,r){for(let i=0;i<this.animations.length;i++)this.animations[i][t]=r}attachTimeline(t,r){const i=this.animations.map(l=>{if(sj()&&l.attachTimeline)return l.attachTimeline(t);if(typeof r=="function")return r(l)});return()=>{i.forEach((l,c)=>{l&&l(),this.animations[c].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let r=0;r<this.animations.length;r++)t=Math.max(t,this.animations[r].duration);return t}runAll(t){this.animations.forEach(r=>r[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class aj extends ij{then(t,r){return Promise.all(this.animations).then(t).catch(r)}}function kp(e,t){return e?e[t]||e.default||e:void 0}const kd=2e4;function ey(e){let t=0;const r=50;let i=e.next(t);for(;!i.done&&t<kd;)t+=r,i=e.next(t);return t>=kd?1/0:t}function wp(e){return typeof e=="function"}function t0(e,t){e.timeline=t,e.onfinish=null}const jp=e=>Array.isArray(e)&&typeof e[0]=="number",oj={linearEasing:void 0};function lj(e,t){const r=op(e);return()=>{var i;return(i=oj[t])!==null&&i!==void 0?i:r()}}const El=lj(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ty=(e,t,r=10)=>{let i="";const l=Math.max(Math.round(t/r),2);for(let c=0;c<l;c++)i+=e(Ni(0,l-1,c))+", ";return`linear(${i.substring(0,i.length-2)})`};function ny(e){return!!(typeof e=="function"&&El()||!e||typeof e=="string"&&(e in wd||El())||jp(e)||Array.isArray(e)&&e.every(ny))}const Sa=([e,t,r,i])=>`cubic-bezier(${e}, ${t}, ${r}, ${i})`,wd={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Sa([0,.65,.55,1]),circOut:Sa([.55,0,1,.45]),backIn:Sa([.31,.01,.66,-.59]),backOut:Sa([.33,1.53,.69,.99])};function ry(e,t){if(e)return typeof e=="function"&&El()?ty(e,t):jp(e)?Sa(e):Array.isArray(e)?e.map(r=>ry(r,t)||wd.easeOut):wd[e]}const wn={x:!1,y:!1};function sy(){return wn.x||wn.y}function cj(e,t,r){var i;if(e instanceof Element)return[e];if(typeof e=="string"){let l=document;const c=(i=void 0)!==null&&i!==void 0?i:l.querySelectorAll(e);return c?Array.from(c):[]}return Array.from(e)}function iy(e,t){const r=cj(e),i=new AbortController,l={passive:!0,...t,signal:i.signal};return[r,l,()=>i.abort()]}function n0(e){return t=>{t.pointerType==="touch"||sy()||e(t)}}function uj(e,t,r={}){const[i,l,c]=iy(e,r),d=n0(p=>{const{target:h}=p,m=t(p);if(typeof m!="function"||!h)return;const x=n0(v=>{m(v),h.removeEventListener("pointerleave",x)});h.addEventListener("pointerleave",x,l)});return i.forEach(p=>{p.addEventListener("pointerenter",d,l)}),c}const ay=(e,t)=>t?e===t?!0:ay(e,t.parentElement):!1,Sp=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,dj=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function pj(e){return dj.has(e.tagName)||e.tabIndex!==-1}const Ca=new WeakSet;function r0(e){return t=>{t.key==="Enter"&&e(t)}}function _u(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const fj=(e,t)=>{const r=e.currentTarget;if(!r)return;const i=r0(()=>{if(Ca.has(r))return;_u(r,"down");const l=r0(()=>{_u(r,"up")}),c=()=>_u(r,"cancel");r.addEventListener("keyup",l,t),r.addEventListener("blur",c,t)});r.addEventListener("keydown",i,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",i),t)};function s0(e){return Sp(e)&&!sy()}function hj(e,t,r={}){const[i,l,c]=iy(e,r),d=p=>{const h=p.currentTarget;if(!s0(p)||Ca.has(h))return;Ca.add(h);const m=t(p),x=(w,P)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",b),!(!s0(w)||!Ca.has(h))&&(Ca.delete(h),typeof m=="function"&&m(w,{success:P}))},v=w=>{x(w,r.useGlobalTarget||ay(h,w.target))},b=w=>{x(w,!1)};window.addEventListener("pointerup",v,l),window.addEventListener("pointercancel",b,l)};return i.forEach(p=>{!pj(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(r.useGlobalTarget?window:p).addEventListener("pointerdown",d,l),p.addEventListener("focus",m=>fj(m,l),l)}),c}function mj(e){return e==="x"||e==="y"?wn[e]?null:(wn[e]=!0,()=>{wn[e]=!1}):wn.x||wn.y?null:(wn.x=wn.y=!0,()=>{wn.x=wn.y=!1})}const oy=new Set(["width","height","top","left","right","bottom",...Ai]);let bl;function gj(){bl=void 0}const Vn={now:()=>(bl===void 0&&Vn.set(yt.isProcessing||d2.useManualTiming?yt.timestamp:performance.now()),bl),set:e=>{bl=e,queueMicrotask(gj)}};function Cp(e,t){e.indexOf(t)===-1&&e.push(t)}function Np(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}class Ep{constructor(){this.subscriptions=[]}add(t){return Cp(this.subscriptions,t),()=>Np(this.subscriptions,t)}notify(t,r,i){const l=this.subscriptions.length;if(l)if(l===1)this.subscriptions[0](t,r,i);else for(let c=0;c<l;c++){const d=this.subscriptions[c];d&&d(t,r,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function ly(e,t){return t?e*(1e3/t):0}const i0=30,xj=e=>!isNaN(parseFloat(e));class yj{constructor(t,r={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,l=!0)=>{const c=Vn.now();this.updatedAt!==c&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),l&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=r.owner}setCurrent(t){this.current=t,this.updatedAt=Vn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=xj(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,r){this.events[t]||(this.events[t]=new Ep);const i=this.events[t].add(r);return t==="change"?()=>{i(),We.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t,r=!0){!r||!this.passiveEffect?this.updateAndNotify(t,r):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,r,i){this.set(r),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,r=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Vn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>i0)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,i0);return ly(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(t){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=t(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ma(e,t){return new yj(e,t)}function vj(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Ma(r))}function bj(e,t){const r=$l(e,t);let{transitionEnd:i={},transition:l={},...c}=r||{};c={...c,...i};for(const d in c){const p=L2(c[d]);vj(e,d,p)}}function kj(e){return!!(Et(e)&&e.add)}function jd(e,t){const r=e.getValue("willChange");if(kj(r))return r.add(t)}function cy(e){return e.props[zx]}const uy=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,wj=1e-7,jj=12;function Sj(e,t,r,i,l){let c,d,p=0;do d=t+(r-t)/2,c=uy(d,i,l)-e,c>0?r=d:t=d;while(Math.abs(c)>wj&&++p<jj);return d}function Qa(e,t,r,i){if(e===t&&r===i)return Xt;const l=c=>Sj(c,0,1,e,r);return c=>c===0||c===1?c:uy(l(c),t,i)}const dy=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,py=e=>t=>1-e(1-t),fy=Qa(.33,1.53,.69,.99),Pp=py(fy),hy=dy(Pp),my=e=>(e*=2)<1?.5*Pp(e):.5*(2-Math.pow(2,-10*(e-1))),Tp=e=>1-Math.sin(Math.acos(e)),gy=py(Tp),xy=dy(Tp),yy=e=>/^0[^.\s]+$/u.test(e);function Cj(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||yy(e):!0}const Ea=e=>Math.round(e*1e5)/1e5,Rp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Nj(e){return e==null}const Ej=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Dp=(e,t)=>r=>!!(typeof r=="string"&&Ej.test(r)&&r.startsWith(e)||t&&!Nj(r)&&Object.prototype.hasOwnProperty.call(r,t)),vy=(e,t,r)=>i=>{if(typeof i!="string")return i;const[l,c,d,p]=i.match(Rp);return{[e]:parseFloat(l),[t]:parseFloat(c),[r]:parseFloat(d),alpha:p!==void 0?parseFloat(p):1}},Pj=e=>ur(0,255,e),zu={...Mi,transform:e=>Math.round(Pj(e))},Ss={test:Dp("rgb","red"),parse:vy("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:i=1})=>"rgba("+zu.transform(e)+", "+zu.transform(t)+", "+zu.transform(r)+", "+Ea(Aa.transform(i))+")"};function Tj(e){let t="",r="",i="",l="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),i=e.substring(5,7),l=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),i=e.substring(3,4),l=e.substring(4,5),t+=t,r+=r,i+=i,l+=l),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(i,16),alpha:l?parseInt(l,16)/255:1}}const Sd={test:Dp("#"),parse:Tj,transform:Ss.transform},ci={test:Dp("hsl","hue"),parse:vy("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:i=1})=>"hsla("+Math.round(e)+", "+zn.transform(Ea(t))+", "+zn.transform(Ea(r))+", "+Ea(Aa.transform(i))+")"},Nt={test:e=>Ss.test(e)||Sd.test(e)||ci.test(e),parse:e=>Ss.test(e)?Ss.parse(e):ci.test(e)?ci.parse(e):Sd.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ss.transform(e):ci.transform(e)},Rj=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Dj(e){var t,r;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Rp))===null||t===void 0?void 0:t.length)||0)+(((r=e.match(Rj))===null||r===void 0?void 0:r.length)||0)>0}const by="number",ky="color",Lj="var",Ij="var(",a0="${}",Aj=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Oa(e){const t=e.toString(),r=[],i={color:[],number:[],var:[]},l=[];let c=0;const p=t.replace(Aj,h=>(Nt.test(h)?(i.color.push(c),l.push(ky),r.push(Nt.parse(h))):h.startsWith(Ij)?(i.var.push(c),l.push(Lj),r.push(h)):(i.number.push(c),l.push(by),r.push(parseFloat(h))),++c,a0)).split(a0);return{values:r,split:p,indexes:i,types:l}}function wy(e){return Oa(e).values}function jy(e){const{split:t,types:r}=Oa(e),i=t.length;return l=>{let c="";for(let d=0;d<i;d++)if(c+=t[d],l[d]!==void 0){const p=r[d];p===by?c+=Ea(l[d]):p===ky?c+=Nt.transform(l[d]):c+=l[d]}return c}}const Mj=e=>typeof e=="number"?0:e;function Oj(e){const t=wy(e);return jy(e)(t.map(Mj))}const Gr={test:Dj,parse:wy,createTransformer:jy,getAnimatableNone:Oj},Fj=new Set(["brightness","contrast","saturate","opacity"]);function _j(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=r.match(Rp)||[];if(!i)return e;const l=r.replace(i,"");let c=Fj.has(t)?1:0;return i!==r&&(c*=100),t+"("+c+l+")"}const zj=/\b([a-z-]*)\(.*?\)/gu,Cd={...Gr,getAnimatableNone:e=>{const t=e.match(zj);return t?t.map(_j).join(" "):e}},Vj={...mp,color:Nt,backgroundColor:Nt,outlineColor:Nt,fill:Nt,stroke:Nt,borderColor:Nt,borderTopColor:Nt,borderRightColor:Nt,borderBottomColor:Nt,borderLeftColor:Nt,filter:Cd,WebkitFilter:Cd},Lp=e=>Vj[e];function Sy(e,t){let r=Lp(e);return r!==Cd&&(r=Gr),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const Bj=new Set(["auto","none","0"]);function $j(e,t,r){let i=0,l;for(;i<e.length&&!l;){const c=e[i];typeof c=="string"&&!Bj.has(c)&&Oa(c).values.length&&(l=e[i]),i++}if(l&&r)for(const c of t)e[c]=Sy(r,l)}const o0=e=>e===Mi||e===xe,l0=(e,t)=>parseFloat(e.split(", ")[t]),c0=(e,t)=>(r,{transform:i})=>{if(i==="none"||!i)return 0;const l=i.match(/^matrix3d\((.+)\)$/u);if(l)return l0(l[1],t);{const c=i.match(/^matrix\((.+)\)$/u);return c?l0(c[1],e):0}},Uj=new Set(["x","y","z"]),Wj=Ai.filter(e=>!Uj.has(e));function Hj(e){const t=[];return Wj.forEach(r=>{const i=e.getValue(r);i!==void 0&&(t.push([r,i.get()]),i.set(r.startsWith("scale")?1:0))}),t}const Pi={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:c0(4,13),y:c0(5,14)};Pi.translateX=Pi.x;Pi.translateY=Pi.y;const As=new Set;let Nd=!1,Ed=!1;function Cy(){if(Ed){const e=Array.from(As).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),r=new Map;t.forEach(i=>{const l=Hj(i);l.length&&(r.set(i,l),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const l=r.get(i);l&&l.forEach(([c,d])=>{var p;(p=i.getValue(c))===null||p===void 0||p.set(d)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Ed=!1,Nd=!1,As.forEach(e=>e.complete()),As.clear()}function Ny(){As.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ed=!0)})}function Kj(){Ny(),Cy()}class Ip{constructor(t,r,i,l,c,d=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=r,this.name=i,this.motionValue=l,this.element=c,this.isAsync=d}scheduleResolve(){this.isScheduled=!0,this.isAsync?(As.add(this),Nd||(Nd=!0,We.read(Ny),We.resolveKeyframes(Cy))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:r,element:i,motionValue:l}=this;for(let c=0;c<t.length;c++)if(t[c]===null)if(c===0){const d=l==null?void 0:l.get(),p=t[t.length-1];if(d!==void 0)t[0]=d;else if(i&&r){const h=i.readValue(r,p);h!=null&&(t[0]=h)}t[0]===void 0&&(t[0]=p),l&&d===void 0&&l.set(t[0])}else t[c]=t[c-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),As.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,As.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Ey=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),qj=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Qj(e){const t=qj.exec(e);if(!t)return[,];const[,r,i,l]=t;return[`--${r??i}`,l]}function Py(e,t,r=1){const[i,l]=Qj(e);if(!i)return;const c=window.getComputedStyle(t).getPropertyValue(i);if(c){const d=c.trim();return Ey(d)?parseFloat(d):d}return hp(l)?Py(l,t,r+1):l}const Ty=e=>t=>t.test(e),Gj={test:e=>e==="auto",parse:e=>e},Ry=[Mi,xe,zn,Fr,_2,F2,Gj],u0=e=>Ry.find(Ty(e));class Dy extends Ip{constructor(t,r,i,l,c){super(t,r,i,l,c,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:r,name:i}=this;if(!r||!r.current)return;super.readKeyframes();for(let h=0;h<t.length;h++){let m=t[h];if(typeof m=="string"&&(m=m.trim(),hp(m))){const x=Py(m,r.current);x!==void 0&&(t[h]=x),h===t.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!oy.has(i)||t.length!==2)return;const[l,c]=t,d=u0(l),p=u0(c);if(d!==p)if(o0(d)&&o0(p))for(let h=0;h<t.length;h++){const m=t[h];typeof m=="string"&&(t[h]=parseFloat(m))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:r}=this,i=[];for(let l=0;l<t.length;l++)Cj(t[l])&&i.push(l);i.length&&$j(t,i,r)}measureInitialState(){const{element:t,unresolvedKeyframes:r,name:i}=this;if(!t||!t.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Pi[i](t.measureViewportBox(),window.getComputedStyle(t.current)),r[0]=this.measuredOrigin;const l=r[r.length-1];l!==void 0&&t.getValue(i,l).jump(l,!1)}measureEndState(){var t;const{element:r,name:i,unresolvedKeyframes:l}=this;if(!r||!r.current)return;const c=r.getValue(i);c&&c.jump(this.measuredOrigin,!1);const d=l.length-1,p=l[d];l[d]=Pi[i](r.measureViewportBox(),window.getComputedStyle(r.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([h,m])=>{r.getValue(h).set(m)}),this.resolveNoneKeyframes()}}const d0=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Gr.test(e)||e==="0")&&!e.startsWith("url("));function Yj(e){const t=e[0];if(e.length===1)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}function Xj(e,t,r,i){const l=e[0];if(l===null)return!1;if(t==="display"||t==="visibility")return!0;const c=e[e.length-1],d=d0(l,t),p=d0(c,t);return!d||!p?!1:Yj(e)||(r==="spring"||wp(r))&&i}const Jj=e=>e!==null;function Ul(e,{repeat:t,repeatType:r="loop"},i){const l=e.filter(Jj),c=t&&r!=="loop"&&t%2===1?0:l.length-1;return!c||i===void 0?l[c]:i}const Zj=40;class Ly{constructor({autoplay:t=!0,delay:r=0,type:i="keyframes",repeat:l=0,repeatDelay:c=0,repeatType:d="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Vn.now(),this.options={autoplay:t,delay:r,type:i,repeat:l,repeatDelay:c,repeatType:d,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>Zj?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Kj(),this._resolved}onKeyframesResolved(t,r){this.resolvedAt=Vn.now(),this.hasAttemptedResolve=!0;const{name:i,type:l,velocity:c,delay:d,onComplete:p,onUpdate:h,isGenerator:m}=this.options;if(!m&&!Xj(t,i,l,c))if(d)this.options.duration=0;else{h&&h(Ul(t,this.options,r)),p&&p(),this.resolveFinishedPromise();return}const x=this.initPlayback(t,r);x!==!1&&(this._resolved={keyframes:t,finalKeyframe:r,...x},this.onPostResolved())}onPostResolved(){}then(t,r){return this.currentFinishedPromise.then(t,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Qe=(e,t,r)=>e+(t-e)*r;function Vu(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function eS({hue:e,saturation:t,lightness:r,alpha:i}){e/=360,t/=100,r/=100;let l=0,c=0,d=0;if(!t)l=c=d=r;else{const p=r<.5?r*(1+t):r+t-r*t,h=2*r-p;l=Vu(h,p,e+1/3),c=Vu(h,p,e),d=Vu(h,p,e-1/3)}return{red:Math.round(l*255),green:Math.round(c*255),blue:Math.round(d*255),alpha:i}}function Pl(e,t){return r=>r>0?t:e}const Bu=(e,t,r)=>{const i=e*e,l=r*(t*t-i)+i;return l<0?0:Math.sqrt(l)},tS=[Sd,Ss,ci],nS=e=>tS.find(t=>t.test(e));function p0(e){const t=nS(e);if(!t)return!1;let r=t.parse(e);return t===ci&&(r=eS(r)),r}const f0=(e,t)=>{const r=p0(e),i=p0(t);if(!r||!i)return Pl(e,t);const l={...r};return c=>(l.red=Bu(r.red,i.red,c),l.green=Bu(r.green,i.green,c),l.blue=Bu(r.blue,i.blue,c),l.alpha=Qe(r.alpha,i.alpha,c),Ss.transform(l))},rS=(e,t)=>r=>t(e(r)),Ga=(...e)=>e.reduce(rS),Pd=new Set(["none","hidden"]);function sS(e,t){return Pd.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function iS(e,t){return r=>Qe(e,t,r)}function Ap(e){return typeof e=="number"?iS:typeof e=="string"?hp(e)?Pl:Nt.test(e)?f0:lS:Array.isArray(e)?Iy:typeof e=="object"?Nt.test(e)?f0:aS:Pl}function Iy(e,t){const r=[...e],i=r.length,l=e.map((c,d)=>Ap(c)(c,t[d]));return c=>{for(let d=0;d<i;d++)r[d]=l[d](c);return r}}function aS(e,t){const r={...e,...t},i={};for(const l in r)e[l]!==void 0&&t[l]!==void 0&&(i[l]=Ap(e[l])(e[l],t[l]));return l=>{for(const c in i)r[c]=i[c](l);return r}}function oS(e,t){var r;const i=[],l={color:0,var:0,number:0};for(let c=0;c<t.values.length;c++){const d=t.types[c],p=e.indexes[d][l[d]],h=(r=e.values[p])!==null&&r!==void 0?r:0;i[c]=h,l[d]++}return i}const lS=(e,t)=>{const r=Gr.createTransformer(t),i=Oa(e),l=Oa(t);return i.indexes.var.length===l.indexes.var.length&&i.indexes.color.length===l.indexes.color.length&&i.indexes.number.length>=l.indexes.number.length?Pd.has(e)&&!l.values.length||Pd.has(t)&&!i.values.length?sS(e,t):Ga(Iy(oS(i,l),l.values),r):Pl(e,t)};function Ay(e,t,r){return typeof e=="number"&&typeof t=="number"&&typeof r=="number"?Qe(e,t,r):Ap(e)(e,t)}const cS=5;function My(e,t,r){const i=Math.max(t-cS,0);return ly(r-e(i),t-i)}const Ze={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},$u=.001;function uS({duration:e=Ze.duration,bounce:t=Ze.bounce,velocity:r=Ze.velocity,mass:i=Ze.mass}){let l,c,d=1-t;d=ur(Ze.minDamping,Ze.maxDamping,d),e=ur(Ze.minDuration,Ze.maxDuration,or(e)),d<1?(l=m=>{const x=m*d,v=x*e,b=x-r,w=Td(m,d),P=Math.exp(-v);return $u-b/w*P},c=m=>{const v=m*d*e,b=v*r+r,w=Math.pow(d,2)*Math.pow(m,2)*e,P=Math.exp(-v),j=Td(Math.pow(m,2),d);return(-l(m)+$u>0?-1:1)*((b-w)*P)/j}):(l=m=>{const x=Math.exp(-m*e),v=(m-r)*e+1;return-$u+x*v},c=m=>{const x=Math.exp(-m*e),v=(r-m)*(e*e);return x*v});const p=5/e,h=pS(l,c,p);if(e=ar(e),isNaN(h))return{stiffness:Ze.stiffness,damping:Ze.damping,duration:e};{const m=Math.pow(h,2)*i;return{stiffness:m,damping:d*2*Math.sqrt(i*m),duration:e}}}const dS=12;function pS(e,t,r){let i=r;for(let l=1;l<dS;l++)i=i-e(i)/t(i);return i}function Td(e,t){return e*Math.sqrt(1-t*t)}const fS=["duration","bounce"],hS=["stiffness","damping","mass"];function h0(e,t){return t.some(r=>e[r]!==void 0)}function mS(e){let t={velocity:Ze.velocity,stiffness:Ze.stiffness,damping:Ze.damping,mass:Ze.mass,isResolvedFromDuration:!1,...e};if(!h0(e,hS)&&h0(e,fS))if(e.visualDuration){const r=e.visualDuration,i=2*Math.PI/(r*1.2),l=i*i,c=2*ur(.05,1,1-(e.bounce||0))*Math.sqrt(l);t={...t,mass:Ze.mass,stiffness:l,damping:c}}else{const r=uS(e);t={...t,...r,mass:Ze.mass},t.isResolvedFromDuration=!0}return t}function Oy(e=Ze.visualDuration,t=Ze.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:l}=r;const c=r.keyframes[0],d=r.keyframes[r.keyframes.length-1],p={done:!1,value:c},{stiffness:h,damping:m,mass:x,duration:v,velocity:b,isResolvedFromDuration:w}=mS({...r,velocity:-or(r.velocity||0)}),P=b||0,j=m/(2*Math.sqrt(h*x)),N=d-c,S=or(Math.sqrt(h/x)),T=Math.abs(N)<5;i||(i=T?Ze.restSpeed.granular:Ze.restSpeed.default),l||(l=T?Ze.restDelta.granular:Ze.restDelta.default);let k;if(j<1){const R=Td(S,j);k=M=>{const H=Math.exp(-j*S*M);return d-H*((P+j*S*N)/R*Math.sin(R*M)+N*Math.cos(R*M))}}else if(j===1)k=R=>d-Math.exp(-S*R)*(N+(P+S*N)*R);else{const R=S*Math.sqrt(j*j-1);k=M=>{const H=Math.exp(-j*S*M),B=Math.min(R*M,300);return d-H*((P+j*S*N)*Math.sinh(B)+R*N*Math.cosh(B))/R}}const E={calculatedDuration:w&&v||null,next:R=>{const M=k(R);if(w)p.done=R>=v;else{let H=0;j<1&&(H=R===0?ar(P):My(k,R,M));const B=Math.abs(H)<=i,te=Math.abs(d-M)<=l;p.done=B&&te}return p.value=p.done?d:M,p},toString:()=>{const R=Math.min(ey(E),kd),M=ty(H=>E.next(R*H).value,R,30);return R+"ms "+M}};return E}function m0({keyframes:e,velocity:t=0,power:r=.8,timeConstant:i=325,bounceDamping:l=10,bounceStiffness:c=500,modifyTarget:d,min:p,max:h,restDelta:m=.5,restSpeed:x}){const v=e[0],b={done:!1,value:v},w=B=>p!==void 0&&B<p||h!==void 0&&B>h,P=B=>p===void 0?h:h===void 0||Math.abs(p-B)<Math.abs(h-B)?p:h;let j=r*t;const N=v+j,S=d===void 0?N:d(N);S!==N&&(j=S-v);const T=B=>-j*Math.exp(-B/i),k=B=>S+T(B),E=B=>{const te=T(B),X=k(B);b.done=Math.abs(te)<=m,b.value=b.done?S:X};let R,M;const H=B=>{w(b.value)&&(R=B,M=Oy({keyframes:[b.value,P(b.value)],velocity:My(k,B,b.value),damping:l,stiffness:c,restDelta:m,restSpeed:x}))};return H(0),{calculatedDuration:null,next:B=>{let te=!1;return!M&&R===void 0&&(te=!0,E(B),H(B)),R!==void 0&&B>=R?M.next(B-R):(!te&&E(B),b)}}}const gS=Qa(.42,0,1,1),xS=Qa(0,0,.58,1),Fy=Qa(.42,0,.58,1),yS=e=>Array.isArray(e)&&typeof e[0]!="number",vS={linear:Xt,easeIn:gS,easeInOut:Fy,easeOut:xS,circIn:Tp,circInOut:xy,circOut:gy,backIn:Pp,backInOut:hy,backOut:fy,anticipate:my},g0=e=>{if(jp(e)){Ax(e.length===4);const[t,r,i,l]=e;return Qa(t,r,i,l)}else if(typeof e=="string")return vS[e];return e};function bS(e,t,r){const i=[],l=r||Ay,c=e.length-1;for(let d=0;d<c;d++){let p=l(e[d],e[d+1]);if(t){const h=Array.isArray(t)?t[d]||Xt:t;p=Ga(h,p)}i.push(p)}return i}function kS(e,t,{clamp:r=!0,ease:i,mixer:l}={}){const c=e.length;if(Ax(c===t.length),c===1)return()=>t[0];if(c===2&&t[0]===t[1])return()=>t[1];const d=e[0]===e[1];e[0]>e[c-1]&&(e=[...e].reverse(),t=[...t].reverse());const p=bS(t,i,l),h=p.length,m=x=>{if(d&&x<e[0])return t[0];let v=0;if(h>1)for(;v<e.length-2&&!(x<e[v+1]);v++);const b=Ni(e[v],e[v+1],x);return p[v](b)};return r?x=>m(ur(e[0],e[c-1],x)):m}function wS(e,t){const r=e[e.length-1];for(let i=1;i<=t;i++){const l=Ni(0,t,i);e.push(Qe(r,1,l))}}function jS(e){const t=[0];return wS(t,e.length-1),t}function SS(e,t){return e.map(r=>r*t)}function CS(e,t){return e.map(()=>t||Fy).splice(0,e.length-1)}function Tl({duration:e=300,keyframes:t,times:r,ease:i="easeInOut"}){const l=yS(i)?i.map(g0):g0(i),c={done:!1,value:t[0]},d=SS(r&&r.length===t.length?r:jS(t),e),p=kS(d,t,{ease:Array.isArray(l)?l:CS(t,l)});return{calculatedDuration:e,next:h=>(c.value=p(h),c.done=h>=e,c)}}const NS=e=>{const t=({timestamp:r})=>e(r);return{start:()=>We.update(t,!0),stop:()=>Qr(t),now:()=>yt.isProcessing?yt.timestamp:Vn.now()}},ES={decay:m0,inertia:m0,tween:Tl,keyframes:Tl,spring:Oy},PS=e=>e/100;class Mp extends Ly{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:h}=this.options;h&&h()};const{name:r,motionValue:i,element:l,keyframes:c}=this.options,d=(l==null?void 0:l.KeyframeResolver)||Ip,p=(h,m)=>this.onKeyframesResolved(h,m);this.resolver=new d(c,p,r,i,l),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:r="keyframes",repeat:i=0,repeatDelay:l=0,repeatType:c,velocity:d=0}=this.options,p=wp(r)?r:ES[r]||Tl;let h,m;p!==Tl&&typeof t[0]!="number"&&(h=Ga(PS,Ay(t[0],t[1])),t=[0,100]);const x=p({...this.options,keyframes:t});c==="mirror"&&(m=p({...this.options,keyframes:[...t].reverse(),velocity:-d})),x.calculatedDuration===null&&(x.calculatedDuration=ey(x));const{calculatedDuration:v}=x,b=v+l,w=b*(i+1)-l;return{generator:x,mirroredGenerator:m,mapPercentToKeyframes:h,calculatedDuration:v,resolvedDuration:b,totalDuration:w}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,r=!1){const{resolved:i}=this;if(!i){const{keyframes:B}=this.options;return{done:!0,value:B[B.length-1]}}const{finalKeyframe:l,generator:c,mirroredGenerator:d,mapPercentToKeyframes:p,keyframes:h,calculatedDuration:m,totalDuration:x,resolvedDuration:v}=i;if(this.startTime===null)return c.next(0);const{delay:b,repeat:w,repeatType:P,repeatDelay:j,onUpdate:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-x/this.speed,this.startTime)),r?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const S=this.currentTime-b*(this.speed>=0?1:-1),T=this.speed>=0?S<0:S>x;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=x);let k=this.currentTime,E=c;if(w){const B=Math.min(this.currentTime,x)/v;let te=Math.floor(B),X=B%1;!X&&B>=1&&(X=1),X===1&&te--,te=Math.min(te,w+1),!!(te%2)&&(P==="reverse"?(X=1-X,j&&(X-=j/v)):P==="mirror"&&(E=d)),k=ur(0,1,X)*v}const R=T?{done:!1,value:h[0]}:E.next(k);p&&(R.value=p(R.value));let{done:M}=R;!T&&m!==null&&(M=this.speed>=0?this.currentTime>=x:this.currentTime<=0);const H=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&M);return H&&l!==void 0&&(R.value=Ul(h,this.options,l)),N&&N(R.value),H&&this.finish(),R}get duration(){const{resolved:t}=this;return t?or(t.calculatedDuration):0}get time(){return or(this.currentTime)}set time(t){t=ar(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const r=this.playbackSpeed!==t;this.playbackSpeed=t,r&&(this.time=or(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=NS,onPlay:r,startTime:i}=this.options;this.driver||(this.driver=t(c=>this.tick(c))),r&&r();const l=this.driver.now();this.holdTime!==null?this.startTime=l-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=l):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const TS=new Set(["opacity","clipPath","filter","transform"]);function RS(e,t,r,{delay:i=0,duration:l=300,repeat:c=0,repeatType:d="loop",ease:p="easeInOut",times:h}={}){const m={[t]:r};h&&(m.offset=h);const x=ry(p,l);return Array.isArray(x)&&(m.easing=x),e.animate(m,{delay:i,duration:l,easing:Array.isArray(x)?"linear":x,fill:"both",iterations:c+1,direction:d==="reverse"?"alternate":"normal"})}const DS=op(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Rl=10,LS=2e4;function IS(e){return wp(e.type)||e.type==="spring"||!ny(e.ease)}function AS(e,t){const r=new Mp({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:e[0]};const l=[];let c=0;for(;!i.done&&c<LS;)i=r.sample(c),l.push(i.value),c+=Rl;return{times:void 0,keyframes:l,duration:c-Rl,ease:"linear"}}const _y={anticipate:my,backInOut:hy,circInOut:xy};function MS(e){return e in _y}class x0 extends Ly{constructor(t){super(t);const{name:r,motionValue:i,element:l,keyframes:c}=this.options;this.resolver=new Dy(c,(d,p)=>this.onKeyframesResolved(d,p),r,i,l),this.resolver.scheduleResolve()}initPlayback(t,r){let{duration:i=300,times:l,ease:c,type:d,motionValue:p,name:h,startTime:m}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof c=="string"&&El()&&MS(c)&&(c=_y[c]),IS(this.options)){const{onComplete:v,onUpdate:b,motionValue:w,element:P,...j}=this.options,N=AS(t,j);t=N.keyframes,t.length===1&&(t[1]=t[0]),i=N.duration,l=N.times,c=N.ease,d="keyframes"}const x=RS(p.owner.current,h,t,{...this.options,duration:i,times:l,ease:c});return x.startTime=m??this.calcStartTime(),this.pendingTimeline?(t0(x,this.pendingTimeline),this.pendingTimeline=void 0):x.onfinish=()=>{const{onComplete:v}=this.options;p.set(Ul(t,this.options,r)),v&&v(),this.cancel(),this.resolveFinishedPromise()},{animation:x,duration:i,times:l,type:d,ease:c,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:r}=t;return or(r)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:r}=t;return or(r.currentTime||0)}set time(t){const{resolved:r}=this;if(!r)return;const{animation:i}=r;i.currentTime=ar(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:r}=t;return r.playbackRate}set speed(t){const{resolved:r}=this;if(!r)return;const{animation:i}=r;i.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:r}=t;return r.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:r}=t;return r.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:r}=this;if(!r)return Xt;const{animation:i}=r;t0(i,t)}return Xt}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:r,keyframes:i,duration:l,type:c,ease:d,times:p}=t;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:m,onUpdate:x,onComplete:v,element:b,...w}=this.options,P=new Mp({...w,keyframes:i,duration:l,type:c,ease:d,times:p,isGenerator:!0}),j=ar(this.time);m.setWithVelocity(P.sample(j-Rl).value,P.sample(j).value,Rl)}const{onStop:h}=this.options;h&&h(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:r,name:i,repeatDelay:l,repeatType:c,damping:d,type:p}=t;if(!r||!r.owner||!(r.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:m}=r.owner.getProps();return DS()&&i&&TS.has(i)&&!h&&!m&&!l&&c!=="mirror"&&d!==0&&p!=="inertia"}}const OS={type:"spring",stiffness:500,damping:25,restSpeed:10},FS=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),_S={type:"keyframes",duration:.8},zS={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},VS=(e,{keyframes:t})=>t.length>2?_S:Fs.has(e)?e.startsWith("scale")?FS(t[1]):OS:zS;function BS({when:e,delay:t,delayChildren:r,staggerChildren:i,staggerDirection:l,repeat:c,repeatType:d,repeatDelay:p,from:h,elapsed:m,...x}){return!!Object.keys(x).length}const Op=(e,t,r,i={},l,c)=>d=>{const p=kp(i,e)||{},h=p.delay||i.delay||0;let{elapsed:m=0}=i;m=m-ar(h);let x={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...p,delay:-m,onUpdate:b=>{t.set(b),p.onUpdate&&p.onUpdate(b)},onComplete:()=>{d(),p.onComplete&&p.onComplete()},name:e,motionValue:t,element:c?void 0:l};BS(p)||(x={...x,...VS(e,x)}),x.duration&&(x.duration=ar(x.duration)),x.repeatDelay&&(x.repeatDelay=ar(x.repeatDelay)),x.from!==void 0&&(x.keyframes[0]=x.from);let v=!1;if((x.type===!1||x.duration===0&&!x.repeatDelay)&&(x.duration=0,x.delay===0&&(v=!0)),v&&!c&&t.get()!==void 0){const b=Ul(x.keyframes,p);if(b!==void 0)return We.update(()=>{x.onUpdate(b),x.onComplete()}),new aj([])}return!c&&x0.supports(x)?new x0(x):new Mp(x)};function $S({protectedKeys:e,needsAnimating:t},r){const i=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,i}function zy(e,t,{delay:r=0,transitionOverride:i,type:l}={}){var c;let{transition:d=e.getDefaultTransition(),transitionEnd:p,...h}=t;i&&(d=i);const m=[],x=l&&e.animationState&&e.animationState.getState()[l];for(const v in h){const b=e.getValue(v,(c=e.latestValues[v])!==null&&c!==void 0?c:null),w=h[v];if(w===void 0||x&&$S(x,v))continue;const P={delay:r,...kp(d||{},v)};let j=!1;if(window.MotionHandoffAnimation){const S=cy(e);if(S){const T=window.MotionHandoffAnimation(S,v,We);T!==null&&(P.startTime=T,j=!0)}}jd(e,v),b.start(Op(v,b,w,e.shouldReduceMotion&&oy.has(v)?{type:!1}:P,e,j));const N=b.animation;N&&m.push(N)}return p&&Promise.all(m).then(()=>{We.update(()=>{p&&bj(e,p)})}),m}function Rd(e,t,r={}){var i;const l=$l(e,t,r.type==="exit"?(i=e.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:c=e.getDefaultTransition()||{}}=l||{};r.transitionOverride&&(c=r.transitionOverride);const d=l?()=>Promise.all(zy(e,l,r)):()=>Promise.resolve(),p=e.variantChildren&&e.variantChildren.size?(m=0)=>{const{delayChildren:x=0,staggerChildren:v,staggerDirection:b}=c;return US(e,t,x+m,v,b,r)}:()=>Promise.resolve(),{when:h}=c;if(h){const[m,x]=h==="beforeChildren"?[d,p]:[p,d];return m().then(()=>x())}else return Promise.all([d(),p(r.delay)])}function US(e,t,r=0,i=0,l=1,c){const d=[],p=(e.variantChildren.size-1)*i,h=l===1?(m=0)=>m*i:(m=0)=>p-m*i;return Array.from(e.variantChildren).sort(WS).forEach((m,x)=>{m.notify("AnimationStart",t),d.push(Rd(m,t,{...c,delay:r+h(x)}).then(()=>m.notify("AnimationComplete",t)))}),Promise.all(d)}function WS(e,t){return e.sortNodePosition(t)}function HS(e,t,r={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const l=t.map(c=>Rd(e,c,r));i=Promise.all(l)}else if(typeof t=="string")i=Rd(e,t,r);else{const l=typeof t=="function"?$l(e,t,r.custom):t;i=Promise.all(zy(e,l,r))}return i.then(()=>{e.notify("AnimationComplete",t)})}const KS=cp.length;function Vy(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?Vy(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<KS;r++){const i=cp[r],l=e.props[i];(Ia(l)||l===!1)&&(t[i]=l)}return t}const qS=[...lp].reverse(),QS=lp.length;function GS(e){return t=>Promise.all(t.map(({animation:r,options:i})=>HS(e,r,i)))}function YS(e){let t=GS(e),r=y0(),i=!0;const l=h=>(m,x)=>{var v;const b=$l(e,x,h==="exit"?(v=e.presenceContext)===null||v===void 0?void 0:v.custom:void 0);if(b){const{transition:w,transitionEnd:P,...j}=b;m={...m,...j,...P}}return m};function c(h){t=h(e)}function d(h){const{props:m}=e,x=Vy(e.parent)||{},v=[],b=new Set;let w={},P=1/0;for(let N=0;N<QS;N++){const S=qS[N],T=r[S],k=m[S]!==void 0?m[S]:x[S],E=Ia(k),R=S===h?T.isActive:null;R===!1&&(P=N);let M=k===x[S]&&k!==m[S]&&E;if(M&&i&&e.manuallyAnimateOnMount&&(M=!1),T.protectedKeys={...w},!T.isActive&&R===null||!k&&!T.prevProp||Vl(k)||typeof k=="boolean")continue;const H=XS(T.prevProp,k);let B=H||S===h&&T.isActive&&!M&&E||N>P&&E,te=!1;const X=Array.isArray(k)?k:[k];let se=X.reduce(l(S),{});R===!1&&(se={});const{prevResolvedValues:ne={}}=T,O={...ne,...se},_=W=>{B=!0,b.has(W)&&(te=!0,b.delete(W)),T.needsAnimating[W]=!0;const q=e.getValue(W);q&&(q.liveStyle=!1)};for(const W in O){const q=se[W],Q=ne[W];if(w.hasOwnProperty(W))continue;let J=!1;bd(q)&&bd(Q)?J=!Zx(q,Q):J=q!==Q,J?q!=null?_(W):b.add(W):q!==void 0&&b.has(W)?_(W):T.protectedKeys[W]=!0}T.prevProp=k,T.prevResolvedValues=se,T.isActive&&(w={...w,...se}),i&&e.blockInitialAnimation&&(B=!1),B&&(!(M&&H)||te)&&v.push(...X.map(W=>({animation:W,options:{type:S}})))}if(b.size){const N={};b.forEach(S=>{const T=e.getBaseTarget(S),k=e.getValue(S);k&&(k.liveStyle=!0),N[S]=T??null}),v.push({animation:N})}let j=!!v.length;return i&&(m.initial===!1||m.initial===m.animate)&&!e.manuallyAnimateOnMount&&(j=!1),i=!1,j?t(v):Promise.resolve()}function p(h,m){var x;if(r[h].isActive===m)return Promise.resolve();(x=e.variantChildren)===null||x===void 0||x.forEach(b=>{var w;return(w=b.animationState)===null||w===void 0?void 0:w.setActive(h,m)}),r[h].isActive=m;const v=d(h);for(const b in r)r[b].protectedKeys={};return v}return{animateChanges:d,setActive:p,setAnimateFunction:c,getState:()=>r,reset:()=>{r=y0(),i=!0}}}function XS(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Zx(t,e):!1}function xs(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function y0(){return{animate:xs(!0),whileInView:xs(),whileHover:xs(),whileTap:xs(),whileDrag:xs(),whileFocus:xs(),exit:xs()}}class Xr{constructor(t){this.isMounted=!1,this.node=t}update(){}}class JS extends Xr{constructor(t){super(t),t.animationState||(t.animationState=YS(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Vl(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let ZS=0;class eC extends Xr{constructor(){super(...arguments),this.id=ZS++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const l=this.node.animationState.setActive("exit",!t);r&&!t&&l.then(()=>r(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const tC={animation:{Feature:JS},exit:{Feature:eC}};function Fa(e,t,r,i={passive:!0}){return e.addEventListener(t,r,i),()=>e.removeEventListener(t,r)}function Ya(e){return{point:{x:e.pageX,y:e.pageY}}}const nC=e=>t=>Sp(t)&&e(t,Ya(t));function Pa(e,t,r,i){return Fa(e,t,nC(r),i)}const v0=(e,t)=>Math.abs(e-t);function rC(e,t){const r=v0(e.x,t.x),i=v0(e.y,t.y);return Math.sqrt(r**2+i**2)}class By{constructor(t,r,{transformPagePoint:i,contextWindow:l,dragSnapToOrigin:c=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=Wu(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,w=rC(v.offset,{x:0,y:0})>=3;if(!b&&!w)return;const{point:P}=v,{timestamp:j}=yt;this.history.push({...P,timestamp:j});const{onStart:N,onMove:S}=this.handlers;b||(N&&N(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,v)},this.handlePointerMove=(v,b)=>{this.lastMoveEvent=v,this.lastMoveEventInfo=Uu(b,this.transformPagePoint),We.update(this.updatePoint,!0)},this.handlePointerUp=(v,b)=>{this.end();const{onEnd:w,onSessionEnd:P,resumeAnimation:j}=this.handlers;if(this.dragSnapToOrigin&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=Wu(v.type==="pointercancel"?this.lastMoveEventInfo:Uu(b,this.transformPagePoint),this.history);this.startEvent&&w&&w(v,N),P&&P(v,N)},!Sp(t))return;this.dragSnapToOrigin=c,this.handlers=r,this.transformPagePoint=i,this.contextWindow=l||window;const d=Ya(t),p=Uu(d,this.transformPagePoint),{point:h}=p,{timestamp:m}=yt;this.history=[{...h,timestamp:m}];const{onSessionStart:x}=r;x&&x(t,Wu(p,this.history)),this.removeListeners=Ga(Pa(this.contextWindow,"pointermove",this.handlePointerMove),Pa(this.contextWindow,"pointerup",this.handlePointerUp),Pa(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Qr(this.updatePoint)}}function Uu(e,t){return t?{point:t(e.point)}:e}function b0(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Wu({point:e},t){return{point:e,delta:b0(e,$y(t)),offset:b0(e,sC(t)),velocity:iC(t,.1)}}function sC(e){return e[0]}function $y(e){return e[e.length-1]}function iC(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,i=null;const l=$y(e);for(;r>=0&&(i=e[r],!(l.timestamp-i.timestamp>ar(t)));)r--;if(!i)return{x:0,y:0};const c=or(l.timestamp-i.timestamp);if(c===0)return{x:0,y:0};const d={x:(l.x-i.x)/c,y:(l.y-i.y)/c};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}const Uy=1e-4,aC=1-Uy,oC=1+Uy,Wy=.01,lC=0-Wy,cC=0+Wy;function Jt(e){return e.max-e.min}function uC(e,t,r){return Math.abs(e-t)<=r}function k0(e,t,r,i=.5){e.origin=i,e.originPoint=Qe(t.min,t.max,e.origin),e.scale=Jt(r)/Jt(t),e.translate=Qe(r.min,r.max,e.origin)-e.originPoint,(e.scale>=aC&&e.scale<=oC||isNaN(e.scale))&&(e.scale=1),(e.translate>=lC&&e.translate<=cC||isNaN(e.translate))&&(e.translate=0)}function Ta(e,t,r,i){k0(e.x,t.x,r.x,i?i.originX:void 0),k0(e.y,t.y,r.y,i?i.originY:void 0)}function w0(e,t,r){e.min=r.min+t.min,e.max=e.min+Jt(t)}function dC(e,t,r){w0(e.x,t.x,r.x),w0(e.y,t.y,r.y)}function j0(e,t,r){e.min=t.min-r.min,e.max=e.min+Jt(t)}function Ra(e,t,r){j0(e.x,t.x,r.x),j0(e.y,t.y,r.y)}function pC(e,{min:t,max:r},i){return t!==void 0&&e<t?e=i?Qe(t,e,i.min):Math.max(e,t):r!==void 0&&e>r&&(e=i?Qe(r,e,i.max):Math.min(e,r)),e}function S0(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function fC(e,{top:t,left:r,bottom:i,right:l}){return{x:S0(e.x,r,l),y:S0(e.y,t,i)}}function C0(e,t){let r=t.min-e.min,i=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,i]=[i,r]),{min:r,max:i}}function hC(e,t){return{x:C0(e.x,t.x),y:C0(e.y,t.y)}}function mC(e,t){let r=.5;const i=Jt(e),l=Jt(t);return l>i?r=Ni(t.min,t.max-i,e.min):i>l&&(r=Ni(e.min,e.max-l,t.min)),ur(0,1,r)}function gC(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const Dd=.35;function xC(e=Dd){return e===!1?e=0:e===!0&&(e=Dd),{x:N0(e,"left","right"),y:N0(e,"top","bottom")}}function N0(e,t,r){return{min:E0(e,t),max:E0(e,r)}}function E0(e,t){return typeof e=="number"?e:e[t]||0}const P0=()=>({translate:0,scale:1,origin:0,originPoint:0}),ui=()=>({x:P0(),y:P0()}),T0=()=>({min:0,max:0}),rt=()=>({x:T0(),y:T0()});function on(e){return[e("x"),e("y")]}function Hy({top:e,left:t,right:r,bottom:i}){return{x:{min:t,max:r},y:{min:e,max:i}}}function yC({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function vC(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:i.y,right:i.x}}function Hu(e){return e===void 0||e===1}function Ld({scale:e,scaleX:t,scaleY:r}){return!Hu(e)||!Hu(t)||!Hu(r)}function bs(e){return Ld(e)||Ky(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Ky(e){return R0(e.x)||R0(e.y)}function R0(e){return e&&e!=="0%"}function Dl(e,t,r){const i=e-r,l=t*i;return r+l}function D0(e,t,r,i,l){return l!==void 0&&(e=Dl(e,l,i)),Dl(e,r,i)+t}function Id(e,t=0,r=1,i,l){e.min=D0(e.min,t,r,i,l),e.max=D0(e.max,t,r,i,l)}function qy(e,{x:t,y:r}){Id(e.x,t.translate,t.scale,t.originPoint),Id(e.y,r.translate,r.scale,r.originPoint)}const L0=.999999999999,I0=1.0000000000001;function bC(e,t,r,i=!1){const l=r.length;if(!l)return;t.x=t.y=1;let c,d;for(let p=0;p<l;p++){c=r[p],d=c.projectionDelta;const{visualElement:h}=c.options;h&&h.props.style&&h.props.style.display==="contents"||(i&&c.options.layoutScroll&&c.scroll&&c!==c.root&&pi(e,{x:-c.scroll.offset.x,y:-c.scroll.offset.y}),d&&(t.x*=d.x.scale,t.y*=d.y.scale,qy(e,d)),i&&bs(c.latestValues)&&pi(e,c.latestValues))}t.x<I0&&t.x>L0&&(t.x=1),t.y<I0&&t.y>L0&&(t.y=1)}function di(e,t){e.min=e.min+t,e.max=e.max+t}function A0(e,t,r,i,l=.5){const c=Qe(e.min,e.max,l);Id(e,t,r,c,i)}function pi(e,t){A0(e.x,t.x,t.scaleX,t.scale,t.originX),A0(e.y,t.y,t.scaleY,t.scale,t.originY)}function Qy(e,t){return Hy(vC(e.getBoundingClientRect(),t))}function kC(e,t,r){const i=Qy(e,r),{scroll:l}=t;return l&&(di(i.x,l.offset.x),di(i.y,l.offset.y)),i}const Gy=({current:e})=>e?e.ownerDocument.defaultView:null,wC=new WeakMap;class jC{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=rt(),this.visualElement=t}start(t,{snapToCursor:r=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const l=x=>{const{dragSnapToOrigin:v}=this.getProps();v?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(Ya(x).point)},c=(x,v)=>{const{drag:b,dragPropagation:w,onDragStart:P}=this.getProps();if(b&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=mj(b),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),on(N=>{let S=this.getAxisMotionValue(N).get()||0;if(zn.test(S)){const{projection:T}=this.visualElement;if(T&&T.layout){const k=T.layout.layoutBox[N];k&&(S=Jt(k)*(parseFloat(S)/100))}}this.originPoint[N]=S}),P&&We.postRender(()=>P(x,v)),jd(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},d=(x,v)=>{const{dragPropagation:b,dragDirectionLock:w,onDirectionLock:P,onDrag:j}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:N}=v;if(w&&this.currentDirection===null){this.currentDirection=SC(N),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",v.point,N),this.updateAxis("y",v.point,N),this.visualElement.render(),j&&j(x,v)},p=(x,v)=>this.stop(x,v),h=()=>on(x=>{var v;return this.getAnimationState(x)==="paused"&&((v=this.getAxisMotionValue(x).animation)===null||v===void 0?void 0:v.play())}),{dragSnapToOrigin:m}=this.getProps();this.panSession=new By(t,{onSessionStart:l,onStart:c,onMove:d,onSessionEnd:p,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:m,contextWindow:Gy(this.visualElement)})}stop(t,r){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:l}=r;this.startAnimation(l);const{onDragEnd:c}=this.getProps();c&&We.postRender(()=>c(t,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(t,r,i){const{drag:l}=this.getProps();if(!i||!fl(t,l,this.currentDirection))return;const c=this.getAxisMotionValue(t);let d=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(d=pC(d,this.constraints[t],this.elastic[t])),c.set(d)}resolveConstraints(){var t;const{dragConstraints:r,dragElastic:i}=this.getProps(),l=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,c=this.constraints;r&&li(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&l?this.constraints=fC(l.layoutBox,r):this.constraints=!1,this.elastic=xC(i),c!==this.constraints&&l&&this.constraints&&!this.hasMutatedConstraints&&on(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=gC(l.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!li(t))return!1;const i=t.current,{projection:l}=this.visualElement;if(!l||!l.layout)return!1;const c=kC(i,l.root,this.visualElement.getTransformPagePoint());let d=hC(l.layout.layoutBox,c);if(r){const p=r(yC(d));this.hasMutatedConstraints=!!p,p&&(d=Hy(p))}return d}startAnimation(t){const{drag:r,dragMomentum:i,dragElastic:l,dragTransition:c,dragSnapToOrigin:d,onDragTransitionEnd:p}=this.getProps(),h=this.constraints||{},m=on(x=>{if(!fl(x,r,this.currentDirection))return;let v=h&&h[x]||{};d&&(v={min:0,max:0});const b=l?200:1e6,w=l?40:1e7,P={type:"inertia",velocity:i?t[x]:0,bounceStiffness:b,bounceDamping:w,timeConstant:750,restDelta:1,restSpeed:10,...c,...v};return this.startAxisValueAnimation(x,P)});return Promise.all(m).then(p)}startAxisValueAnimation(t,r){const i=this.getAxisMotionValue(t);return jd(this.visualElement,t),i.start(Op(t,i,0,r,this.visualElement,!1))}stopAnimation(){on(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){on(t=>{var r;return(r=this.getAxisMotionValue(t).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(t){var r;return(r=this.getAxisMotionValue(t).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(t){const r=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),l=i[r];return l||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){on(r=>{const{drag:i}=this.getProps();if(!fl(r,i,this.currentDirection))return;const{projection:l}=this.visualElement,c=this.getAxisMotionValue(r);if(l&&l.layout){const{min:d,max:p}=l.layout.layoutBox[r];c.set(t[r]-Qe(d,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:i}=this.visualElement;if(!li(r)||!i||!this.constraints)return;this.stopAnimation();const l={x:0,y:0};on(d=>{const p=this.getAxisMotionValue(d);if(p&&this.constraints!==!1){const h=p.get();l[d]=mC({min:h,max:h},this.constraints[d])}});const{transformTemplate:c}=this.visualElement.getProps();this.visualElement.current.style.transform=c?c({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),on(d=>{if(!fl(d,t,null))return;const p=this.getAxisMotionValue(d),{min:h,max:m}=this.constraints[d];p.set(Qe(h,m,l[d]))})}addListeners(){if(!this.visualElement.current)return;wC.set(this.visualElement,this);const t=this.visualElement.current,r=Pa(t,"pointerdown",h=>{const{drag:m,dragListener:x=!0}=this.getProps();m&&x&&this.start(h)}),i=()=>{const{dragConstraints:h}=this.getProps();li(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:l}=this.visualElement,c=l.addEventListener("measure",i);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),We.read(i);const d=Fa(window,"resize",()=>this.scalePositionWithinConstraints()),p=l.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&(on(x=>{const v=this.getAxisMotionValue(x);v&&(this.originPoint[x]+=h[x].translate,v.set(v.get()+h[x].translate))}),this.visualElement.render())}));return()=>{d(),r(),c(),p&&p()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:i=!1,dragPropagation:l=!1,dragConstraints:c=!1,dragElastic:d=Dd,dragMomentum:p=!0}=t;return{...t,drag:r,dragDirectionLock:i,dragPropagation:l,dragConstraints:c,dragElastic:d,dragMomentum:p}}}function fl(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function SC(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class CC extends Xr{constructor(t){super(t),this.removeGroupControls=Xt,this.removeListeners=Xt,this.controls=new jC(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Xt}unmount(){this.removeGroupControls(),this.removeListeners()}}const M0=e=>(t,r)=>{e&&We.postRender(()=>e(t,r))};class NC extends Xr{constructor(){super(...arguments),this.removePointerDownListener=Xt}onPointerDown(t){this.session=new By(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Gy(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:i,onPanEnd:l}=this.node.getProps();return{onSessionStart:M0(t),onStart:M0(r),onMove:i,onEnd:(c,d)=>{delete this.session,l&&We.postRender(()=>l(c,d))}}}mount(){this.removePointerDownListener=Pa(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const kl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function O0(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ba={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(xe.test(e))e=parseFloat(e);else return e;const r=O0(e,t.target.x),i=O0(e,t.target.y);return`${r}% ${i}%`}},EC={correct:(e,{treeScale:t,projectionDelta:r})=>{const i=e,l=Gr.parse(e);if(l.length>5)return i;const c=Gr.createTransformer(e),d=typeof l[0]!="number"?1:0,p=r.x.scale*t.x,h=r.y.scale*t.y;l[0+d]/=p,l[1+d]/=h;const m=Qe(p,h,.5);return typeof l[2+d]=="number"&&(l[2+d]/=m),typeof l[3+d]=="number"&&(l[3+d]/=m),c(l)}};class PC extends y.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:i,layoutId:l}=this.props,{projection:c}=t;Q2(TC),c&&(r.group&&r.group.add(c),i&&i.register&&l&&i.register(c),c.root.didUpdate(),c.addEventListener("animationComplete",()=>{this.safeToRemove()}),c.setOptions({...c.options,onExitComplete:()=>this.safeToRemove()})),kl.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:i,drag:l,isPresent:c}=this.props,d=i.projection;return d&&(d.isPresent=c,l||t.layoutDependency!==r||r===void 0?d.willUpdate():this.safeToRemove(),t.isPresent!==c&&(c?d.promote():d.relegate()||We.postRender(()=>{const p=d.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),dp.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:i}=this.props,{projection:l}=t;l&&(l.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(l),i&&i.deregister&&i.deregister(l))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Yy(e){const[t,r]=Lx(),i=y.useContext(rp);return o.jsx(PC,{...e,layoutGroup:i,switchLayoutGroup:y.useContext(Vx),isPresent:t,safeToRemove:r})}const TC={borderRadius:{...ba,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ba,borderTopRightRadius:ba,borderBottomLeftRadius:ba,borderBottomRightRadius:ba,boxShadow:EC};function RC(e,t,r){const i=Et(e)?e:Ma(e);return i.start(Op("",i,t,r)),i.animation}function DC(e){return e instanceof SVGElement&&e.tagName!=="svg"}const LC=(e,t)=>e.depth-t.depth;class IC{constructor(){this.children=[],this.isDirty=!1}add(t){Cp(this.children,t),this.isDirty=!0}remove(t){Np(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(LC),this.isDirty=!1,this.children.forEach(t)}}function AC(e,t){const r=Vn.now(),i=({timestamp:l})=>{const c=l-r;c>=t&&(Qr(i),e(c-t))};return We.read(i,!0),()=>Qr(i)}const Xy=["TopLeft","TopRight","BottomLeft","BottomRight"],MC=Xy.length,F0=e=>typeof e=="string"?parseFloat(e):e,_0=e=>typeof e=="number"||xe.test(e);function OC(e,t,r,i,l,c){l?(e.opacity=Qe(0,r.opacity!==void 0?r.opacity:1,FC(i)),e.opacityExit=Qe(t.opacity!==void 0?t.opacity:1,0,_C(i))):c&&(e.opacity=Qe(t.opacity!==void 0?t.opacity:1,r.opacity!==void 0?r.opacity:1,i));for(let d=0;d<MC;d++){const p=`border${Xy[d]}Radius`;let h=z0(t,p),m=z0(r,p);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||_0(h)===_0(m)?(e[p]=Math.max(Qe(F0(h),F0(m),i),0),(zn.test(m)||zn.test(h))&&(e[p]+="%")):e[p]=m}(t.rotate||r.rotate)&&(e.rotate=Qe(t.rotate||0,r.rotate||0,i))}function z0(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const FC=Jy(0,.5,gy),_C=Jy(.5,.95,Xt);function Jy(e,t,r){return i=>i<e?0:i>t?1:r(Ni(e,t,i))}function V0(e,t){e.min=t.min,e.max=t.max}function an(e,t){V0(e.x,t.x),V0(e.y,t.y)}function B0(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function $0(e,t,r,i,l){return e-=t,e=Dl(e,1/r,i),l!==void 0&&(e=Dl(e,1/l,i)),e}function zC(e,t=0,r=1,i=.5,l,c=e,d=e){if(zn.test(t)&&(t=parseFloat(t),t=Qe(d.min,d.max,t/100)-d.min),typeof t!="number")return;let p=Qe(c.min,c.max,i);e===c&&(p-=t),e.min=$0(e.min,t,r,p,l),e.max=$0(e.max,t,r,p,l)}function U0(e,t,[r,i,l],c,d){zC(e,t[r],t[i],t[l],t.scale,c,d)}const VC=["x","scaleX","originX"],BC=["y","scaleY","originY"];function W0(e,t,r,i){U0(e.x,t,VC,r?r.x:void 0,i?i.x:void 0),U0(e.y,t,BC,r?r.y:void 0,i?i.y:void 0)}function H0(e){return e.translate===0&&e.scale===1}function Zy(e){return H0(e.x)&&H0(e.y)}function K0(e,t){return e.min===t.min&&e.max===t.max}function $C(e,t){return K0(e.x,t.x)&&K0(e.y,t.y)}function q0(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ev(e,t){return q0(e.x,t.x)&&q0(e.y,t.y)}function Q0(e){return Jt(e.x)/Jt(e.y)}function G0(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class UC{constructor(){this.members=[]}add(t){Cp(this.members,t),t.scheduleRender()}remove(t){if(Np(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){const r=this.members.findIndex(l=>t===l);if(r===0)return!1;let i;for(let l=r;l>=0;l--){const c=this.members[l];if(c.isPresent!==!1){i=c;break}}return i?(this.promote(i),!0):!1}promote(t,r){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,r&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:l}=t.options;l===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:r,resumingFrom:i}=t;r.onExitComplete&&r.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function WC(e,t,r){let i="";const l=e.x.translate/t.x,c=e.y.translate/t.y,d=(r==null?void 0:r.z)||0;if((l||c||d)&&(i=`translate3d(${l}px, ${c}px, ${d}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:m,rotate:x,rotateX:v,rotateY:b,skewX:w,skewY:P}=r;m&&(i=`perspective(${m}px) ${i}`),x&&(i+=`rotate(${x}deg) `),v&&(i+=`rotateX(${v}deg) `),b&&(i+=`rotateY(${b}deg) `),w&&(i+=`skewX(${w}deg) `),P&&(i+=`skewY(${P}deg) `)}const p=e.x.scale*t.x,h=e.y.scale*t.y;return(p!==1||h!==1)&&(i+=`scale(${p}, ${h})`),i||"none"}const ks={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Na=typeof window<"u"&&window.MotionDebug!==void 0,Ku=["","X","Y","Z"],HC={visibility:"hidden"},Y0=1e3;let KC=0;function qu(e,t,r,i){const{latestValues:l}=t;l[e]&&(r[e]=l[e],t.setStaticValue(e,0),i&&(i[e]=0))}function tv(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=cy(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:l,layoutId:c}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",We,!(l||c))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&tv(i)}function nv({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:i,resetTransform:l}){return class{constructor(d={},p=t==null?void 0:t()){this.id=KC++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Na&&(ks.totalNodes=ks.resolvedTargetDeltas=ks.recalculatedProjection=0),this.nodes.forEach(GC),this.nodes.forEach(e4),this.nodes.forEach(t4),this.nodes.forEach(YC),Na&&window.MotionDebug.record(ks)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new IC)}addEventListener(d,p){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new Ep),this.eventHandlers.get(d).add(p)}notifyListeners(d,...p){const h=this.eventHandlers.get(d);h&&h.notify(...p)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=DC(d),this.instance=d;const{layoutId:h,layout:m,visualElement:x}=this.options;if(x&&!x.current&&x.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(m||h)&&(this.isLayoutDirty=!0),e){let v;const b=()=>this.root.updateBlockedByResize=!1;e(d,()=>{this.root.updateBlockedByResize=!0,v&&v(),v=AC(b,250),kl.hasAnimatedSinceResize&&(kl.hasAnimatedSinceResize=!1,this.nodes.forEach(J0))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&x&&(h||m)&&this.addEventListener("didUpdate",({delta:v,hasLayoutChanged:b,hasRelativeTargetChanged:w,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||x.getDefaultTransition()||a4,{onLayoutAnimationStart:N,onLayoutAnimationComplete:S}=x.getProps(),T=!this.targetLayout||!ev(this.targetLayout,P)||w,k=!b&&w;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||k||b&&(T||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(v,k);const E={...kp(j,"layout"),onPlay:N,onComplete:S};(x.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E)}else b||J0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Qr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(n4),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&tv(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let x=0;x<this.path.length;x++){const v=this.path[x];v.shouldResetTransform=!0,v.updateScroll("snapshot"),v.options.layoutRoot&&v.willUpdate(!1)}const{layoutId:p,layout:h}=this.options;if(p===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),d&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(X0);return}this.isUpdating||this.nodes.forEach(JC),this.isUpdating=!1,this.nodes.forEach(ZC),this.nodes.forEach(qC),this.nodes.forEach(QC),this.clearAllSnapshots();const p=Vn.now();yt.delta=ur(0,1e3/60,p-yt.timestamp),yt.timestamp=p,yt.isProcessing=!0,Fu.update.process(yt),Fu.preRender.process(yt),Fu.render.process(yt),yt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,dp.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(XC),this.sharedNodes.forEach(r4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,We.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){We.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const d=this.layout;this.layout=this.measure(!1),this.layoutCorrected=rt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(p=!1),p){const h=i(this.instance);this.scroll={animationId:this.root.animationId,phase:d,isRoot:h,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!l)return;const d=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!Zy(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,x=m!==this.prevTransformTemplateValue;d&&(p||bs(this.latestValues)||x)&&(l(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const p=this.measurePageBox();let h=this.removeElementScroll(p);return d&&(h=this.removeTransform(h)),o4(h),{animationId:this.root.animationId,measuredBox:p,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:p}=this.options;if(!p)return rt();const h=p.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(l4))){const{scroll:x}=this.root;x&&(di(h.x,x.offset.x),di(h.y,x.offset.y))}return h}removeElementScroll(d){var p;const h=rt();if(an(h,d),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return h;for(let m=0;m<this.path.length;m++){const x=this.path[m],{scroll:v,options:b}=x;x!==this.root&&v&&b.layoutScroll&&(v.wasRoot&&an(h,d),di(h.x,v.offset.x),di(h.y,v.offset.y))}return h}applyTransform(d,p=!1){const h=rt();an(h,d);for(let m=0;m<this.path.length;m++){const x=this.path[m];!p&&x.options.layoutScroll&&x.scroll&&x!==x.root&&pi(h,{x:-x.scroll.offset.x,y:-x.scroll.offset.y}),bs(x.latestValues)&&pi(h,x.latestValues)}return bs(this.latestValues)&&pi(h,this.latestValues),h}removeTransform(d){const p=rt();an(p,d);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!bs(m.latestValues))continue;Ld(m.latestValues)&&m.updateSnapshot();const x=rt(),v=m.measurePageBox();an(x,v),W0(p,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,x)}return bs(this.latestValues)&&W0(p,this.latestValues),p}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==yt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){var p;const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==h;if(!(d||m&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:v,layoutId:b}=this.options;if(!(!this.layout||!(v||b))){if(this.resolvedRelativeTargetAt=yt.timestamp,!this.targetDelta&&!this.relativeTarget){const w=this.getClosestProjectingParent();w&&w.layout&&this.animationProgress!==1?(this.relativeParent=w,this.forceRelativeParentToResolveTarget(),this.relativeTarget=rt(),this.relativeTargetOrigin=rt(),Ra(this.relativeTargetOrigin,this.layout.layoutBox,w.layout.layoutBox),an(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=rt(),this.targetWithTransforms=rt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),dC(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):an(this.target,this.layout.layoutBox),qy(this.target,this.targetDelta)):an(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const w=this.getClosestProjectingParent();w&&!!w.resumingFrom==!!this.resumingFrom&&!w.options.layoutScroll&&w.target&&this.animationProgress!==1?(this.relativeParent=w,this.forceRelativeParentToResolveTarget(),this.relativeTarget=rt(),this.relativeTargetOrigin=rt(),Ra(this.relativeTargetOrigin,this.target,w.target),an(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Na&&ks.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Ld(this.parent.latestValues)||Ky(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var d;const p=this.getLead(),h=!!this.resumingFrom||this!==p;let m=!0;if((this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty)&&(m=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===yt.timestamp&&(m=!1),m)return;const{layout:x,layoutId:v}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(x||v))return;an(this.layoutCorrected,this.layout.layoutBox);const b=this.treeScale.x,w=this.treeScale.y;bC(this.layoutCorrected,this.treeScale,this.path,h),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=rt());const{target:P}=p;if(!P){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(B0(this.prevProjectionDelta.x,this.projectionDelta.x),B0(this.prevProjectionDelta.y,this.projectionDelta.y)),Ta(this.projectionDelta,this.layoutCorrected,P,this.latestValues),(this.treeScale.x!==b||this.treeScale.y!==w||!G0(this.projectionDelta.x,this.prevProjectionDelta.x)||!G0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",P)),Na&&ks.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){var p;if((p=this.options.visualElement)===null||p===void 0||p.scheduleRender(),d){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ui(),this.projectionDelta=ui(),this.projectionDeltaWithTransform=ui()}setAnimationOrigin(d,p=!1){const h=this.snapshot,m=h?h.latestValues:{},x={...this.latestValues},v=ui();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const b=rt(),w=h?h.source:void 0,P=this.layout?this.layout.source:void 0,j=w!==P,N=this.getStack(),S=!N||N.members.length<=1,T=!!(j&&!S&&this.options.crossfade===!0&&!this.path.some(i4));this.animationProgress=0;let k;this.mixTargetDelta=E=>{const R=E/1e3;Z0(v.x,d.x,R),Z0(v.y,d.y,R),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ra(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),s4(this.relativeTarget,this.relativeTargetOrigin,b,R),k&&$C(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=rt()),an(k,this.relativeTarget)),j&&(this.animationValues=x,OC(x,m,this.latestValues,R,T,S)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Qr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=We.update(()=>{kl.hasAnimatedSinceResize=!0,this.currentAnimation=RC(0,Y0,{...d,onUpdate:p=>{this.mixTargetDelta(p),d.onUpdate&&d.onUpdate(p)},onComplete:()=>{d.onComplete&&d.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Y0),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:p,target:h,layout:m,latestValues:x}=d;if(!(!p||!h||!m)){if(this!==d&&this.layout&&m&&rv(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||rt();const v=Jt(this.layout.layoutBox.x);h.x.min=d.target.x.min,h.x.max=h.x.min+v;const b=Jt(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+b}an(p,h),pi(p,x),Ta(this.projectionDeltaWithTransform,this.layoutCorrected,p,x)}}registerSharedNode(d,p){this.sharedNodes.has(d)||this.sharedNodes.set(d,new UC),this.sharedNodes.get(d).add(p);const m=p.options.initialPromotionConfig;p.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(p):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:p}=this.options;return p?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:p}=this.options;return p?(d=this.getStack())===null||d===void 0?void 0:d.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:p,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),d&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let p=!1;const{latestValues:h}=d;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(p=!0),!p)return;const m={};h.z&&qu("z",d,m,this.animationValues);for(let x=0;x<Ku.length;x++)qu(`rotate${Ku[x]}`,d,m,this.animationValues),qu(`skew${Ku[x]}`,d,m,this.animationValues);d.render();for(const x in m)d.setStaticValue(x,m[x]),this.animationValues&&(this.animationValues[x]=m[x]);d.scheduleRender()}getProjectionStyles(d){var p,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return HC;const m={visibility:""},x=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,m.opacity="",m.pointerEvents=vl(d==null?void 0:d.pointerEvents)||"",m.transform=x?x(this.latestValues,""):"none",m;const v=this.getLead();if(!this.projectionDelta||!this.layout||!v.target){const j={};return this.options.layoutId&&(j.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,j.pointerEvents=vl(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!bs(this.latestValues)&&(j.transform=x?x({},""):"none",this.hasProjected=!1),j}const b=v.animationValues||v.latestValues;this.applyTransformsToTarget(),m.transform=WC(this.projectionDeltaWithTransform,this.treeScale,b),x&&(m.transform=x(b,m.transform));const{x:w,y:P}=this.projectionDelta;m.transformOrigin=`${w.origin*100}% ${P.origin*100}% 0`,v.animationValues?m.opacity=v===this?(h=(p=b.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:b.opacityExit:m.opacity=v===this?b.opacity!==void 0?b.opacity:"":b.opacityExit!==void 0?b.opacityExit:0;for(const j in Nl){if(b[j]===void 0)continue;const{correct:N,applyTo:S}=Nl[j],T=m.transform==="none"?b[j]:N(b[j],v);if(S){const k=S.length;for(let E=0;E<k;E++)m[S[E]]=T}else m[j]=T}return this.options.layoutId&&(m.pointerEvents=v===this?vl(d==null?void 0:d.pointerEvents)||"":"none"),m}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>{var p;return(p=d.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(X0),this.root.sharedNodes.clear()}}}function qC(e){e.updateLayout()}function QC(e){var t;const r=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&r&&e.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:l}=e.layout,{animationType:c}=e.options,d=r.source!==e.layout.source;c==="size"?on(v=>{const b=d?r.measuredBox[v]:r.layoutBox[v],w=Jt(b);b.min=i[v].min,b.max=b.min+w}):rv(c,r.layoutBox,i)&&on(v=>{const b=d?r.measuredBox[v]:r.layoutBox[v],w=Jt(i[v]);b.max=b.min+w,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[v].max=e.relativeTarget[v].min+w)});const p=ui();Ta(p,i,r.layoutBox);const h=ui();d?Ta(h,e.applyTransform(l,!0),r.measuredBox):Ta(h,i,r.layoutBox);const m=!Zy(p);let x=!1;if(!e.resumeFrom){const v=e.getClosestProjectingParent();if(v&&!v.resumeFrom){const{snapshot:b,layout:w}=v;if(b&&w){const P=rt();Ra(P,r.layoutBox,b.layoutBox);const j=rt();Ra(j,i,w.layoutBox),ev(P,j)||(x=!0),v.options.layoutRoot&&(e.relativeTarget=j,e.relativeTargetOrigin=P,e.relativeParent=v)}}}e.notifyListeners("didUpdate",{layout:i,snapshot:r,delta:h,layoutDelta:p,hasLayoutChanged:m,hasRelativeTargetChanged:x})}else if(e.isLead()){const{onExitComplete:i}=e.options;i&&i()}e.options.transition=void 0}function GC(e){Na&&ks.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function YC(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function XC(e){e.clearSnapshot()}function X0(e){e.clearMeasurements()}function JC(e){e.isLayoutDirty=!1}function ZC(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function J0(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function e4(e){e.resolveTargetDelta()}function t4(e){e.calcProjection()}function n4(e){e.resetSkewAndRotation()}function r4(e){e.removeLeadSnapshot()}function Z0(e,t,r){e.translate=Qe(t.translate,0,r),e.scale=Qe(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function eg(e,t,r,i){e.min=Qe(t.min,r.min,i),e.max=Qe(t.max,r.max,i)}function s4(e,t,r,i){eg(e.x,t.x,r.x,i),eg(e.y,t.y,r.y,i)}function i4(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const a4={duration:.45,ease:[.4,0,.1,1]},tg=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),ng=tg("applewebkit/")&&!tg("chrome/")?Math.round:Xt;function rg(e){e.min=ng(e.min),e.max=ng(e.max)}function o4(e){rg(e.x),rg(e.y)}function rv(e,t,r){return e==="position"||e==="preserve-aspect"&&!uC(Q0(t),Q0(r),.2)}function l4(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const c4=nv({attachResizeListener:(e,t)=>Fa(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Qu={current:void 0},sv=nv({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Qu.current){const e=new c4({});e.mount(window),e.setOptions({layoutScroll:!0}),Qu.current=e}return Qu.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),u4={pan:{Feature:NC},drag:{Feature:CC,ProjectionNode:sv,MeasureLayout:Yy}};function sg(e,t,r){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",r==="Start");const l="onHover"+r,c=i[l];c&&We.postRender(()=>c(t,Ya(t)))}class d4 extends Xr{mount(){const{current:t}=this.node;t&&(this.unmount=uj(t,r=>(sg(this.node,r,"Start"),i=>sg(this.node,i,"End"))))}unmount(){}}class p4 extends Xr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ga(Fa(this.node.current,"focus",()=>this.onFocus()),Fa(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function ig(e,t,r){const{props:i}=e;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",r==="Start");const l="onTap"+(r==="End"?"":r),c=i[l];c&&We.postRender(()=>c(t,Ya(t)))}class f4 extends Xr{mount(){const{current:t}=this.node;t&&(this.unmount=hj(t,r=>(ig(this.node,r,"Start"),(i,{success:l})=>ig(this.node,i,l?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Ad=new WeakMap,Gu=new WeakMap,h4=e=>{const t=Ad.get(e.target);t&&t(e)},m4=e=>{e.forEach(h4)};function g4({root:e,...t}){const r=e||document;Gu.has(r)||Gu.set(r,{});const i=Gu.get(r),l=JSON.stringify(t);return i[l]||(i[l]=new IntersectionObserver(m4,{root:e,...t})),i[l]}function x4(e,t,r){const i=g4(t);return Ad.set(e,r),i.observe(e),()=>{Ad.delete(e),i.unobserve(e)}}const y4={some:0,all:1};class v4 extends Xr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:r,margin:i,amount:l="some",once:c}=t,d={root:r?r.current:void 0,rootMargin:i,threshold:typeof l=="number"?l:y4[l]},p=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,c&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:x,onViewportLeave:v}=this.node.getProps(),b=m?x:v;b&&b(h)};return x4(this.node.current,d,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some(b4(t,r))&&this.startObserver()}unmount(){}}function b4({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const k4={inView:{Feature:v4},tap:{Feature:f4},focus:{Feature:p4},hover:{Feature:d4}},w4={layout:{ProjectionNode:sv,MeasureLayout:Yy}},Md={current:null},iv={current:!1};function j4(){if(iv.current=!0,!!ap)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Md.current=e.matches;e.addListener(t),t()}else Md.current=!1}const S4=[...Ry,Nt,Gr],C4=e=>S4.find(Ty(e)),ag=new WeakMap;function N4(e,t,r){for(const i in t){const l=t[i],c=r[i];if(Et(l))e.addValue(i,l);else if(Et(c))e.addValue(i,Ma(l,{owner:e}));else if(c!==l)if(e.hasValue(i)){const d=e.getValue(i);d.liveStyle===!0?d.jump(l):d.hasAnimated||d.set(l)}else{const d=e.getStaticValue(i);e.addValue(i,Ma(d!==void 0?d:l,{owner:e}))}}for(const i in r)t[i]===void 0&&e.removeValue(i);return t}const og=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class E4{scrapeMotionValuesFromProps(t,r,i){return{}}constructor({parent:t,props:r,presenceContext:i,reducedMotionConfig:l,blockInitialAnimation:c,visualState:d},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ip,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const w=Vn.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,We.render(this.render,!1,!0))};const{latestValues:h,renderState:m,onUpdate:x}=d;this.onUpdate=x,this.latestValues=h,this.baseTarget={...h},this.initialValues=r.initial?{...h}:{},this.renderState=m,this.parent=t,this.props=r,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=l,this.options=p,this.blockInitialAnimation=!!c,this.isControllingVariants=Bl(r),this.isVariantNode=_x(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:v,...b}=this.scrapeMotionValuesFromProps(r,{},this);for(const w in b){const P=b[w];h[w]!==void 0&&Et(P)&&P.set(h[w],!1)}}mount(t){this.current=t,ag.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,i)=>this.bindToMotionValue(i,r)),iv.current||j4(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Md.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){ag.delete(this.current),this.projection&&this.projection.unmount(),Qr(this.notifyUpdate),Qr(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const r=this.features[t];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(t,r){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const i=Fs.has(t),l=r.on("change",p=>{this.latestValues[t]=p,this.props.onUpdate&&We.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),c=r.on("renderRequest",this.scheduleRender);let d;window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{l(),c(),d&&d(),r.owner&&r.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ei){const r=Ei[t];if(!r)continue;const{isEnabled:i,Feature:l}=r;if(!this.features[t]&&l&&i(this.props)&&(this.features[t]=new l(this)),this.features[t]){const c=this.features[t];c.isMounted?c.update():(c.mount(),c.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):rt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let i=0;i<og.length;i++){const l=og[i];this.propEventSubscriptions[l]&&(this.propEventSubscriptions[l](),delete this.propEventSubscriptions[l]);const c="on"+l,d=t[c];d&&(this.propEventSubscriptions[l]=this.on(l,d))}this.prevMotionValues=N4(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(t),()=>r.variantChildren.delete(t)}addValue(t,r){const i=this.values.get(t);r!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&r!==void 0&&(i=Ma(r===null?void 0:r,{owner:this}),this.addValue(t,i)),i}readValue(t,r){var i;let l=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(i=this.getBaseTargetFromProps(this.props,t))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,t,this.options);return l!=null&&(typeof l=="string"&&(Ey(l)||yy(l))?l=parseFloat(l):!C4(l)&&Gr.test(r)&&(l=Sy(t,r)),this.setBaseTarget(t,Et(l)?l.get():l)),Et(l)?l.get():l}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var r;const{initial:i}=this.props;let l;if(typeof i=="string"||typeof i=="object"){const d=fp(this.props,i,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);d&&(l=d[t])}if(i&&l!==void 0)return l;const c=this.getBaseTargetFromProps(this.props,t);return c!==void 0&&!Et(c)?c:this.initialValues[t]!==void 0&&l===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new Ep),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}}class av extends E4{constructor(){super(...arguments),this.KeyframeResolver=Dy}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){return t.style?t.style[r]:void 0}removeValueFromRenderState(t,{vars:r,style:i}){delete r[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Et(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function P4(e){return window.getComputedStyle(e)}class T4 extends av{constructor(){super(...arguments),this.type="html",this.renderInstance=qx}readValueFromInstance(t,r){if(Fs.has(r)){const i=Lp(r);return i&&i.default||0}else{const i=P4(t),l=(Wx(r)?i.getPropertyValue(r):i[r])||0;return typeof l=="string"?l.trim():l}}measureInstanceViewportBox(t,{transformPagePoint:r}){return Qy(t,r)}build(t,r,i){gp(t,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,r,i){return bp(t,r,i)}}class R4 extends av{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=rt}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Fs.has(r)){const i=Lp(r);return i&&i.default||0}return r=Qx.has(r)?r:up(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,i){return Xx(t,r,i)}build(t,r,i){xp(t,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,r,i,l){Gx(t,r,i,l)}mount(t){this.isSVGTag=vp(t.tagName),super.mount(t)}}const D4=(e,t)=>pp(e)?new R4(t):new T4(t,{allowProjection:e!==y.Fragment}),L4=rj({...tC,...k4,...u4,...w4},D4),Pe=y2(L4);function I4({icon:e,title:t,description:r,action:i}){return o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e&&o.jsx("div",{className:"mb-4 text-gray-400",children:e}),o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:t}),r&&o.jsx("p",{className:"mt-1 text-sm text-gray-500 max-w-sm",children:r}),i&&o.jsx("button",{type:"button",onClick:i.onClick,className:"mt-4 px-4 py-2 text-sm font-medium text-blue-600 bg-blue-50 rounded-lg hover:bg-blue-100 transition-colors",children:i.label})]})}function A4({isOpen:e,onClose:t,title:r,children:i}){const l=y.useRef(null),c=y.useRef(null);return y.useEffect(()=>{var d;if(e){c.current=document.activeElement,(d=l.current)==null||d.focus();const p=h=>{h.key==="Escape"&&t()};return document.addEventListener("keydown",p),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p),document.body.style.overflow="",c.current instanceof HTMLElement&&c.current.focus()}}},[e,t]),e?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[o.jsx("div",{className:"absolute inset-0 bg-black/50 transition-opacity",onClick:t,"aria-hidden":"true"}),o.jsxs("div",{ref:l,tabIndex:-1,className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[85vh] flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[o.jsx("h2",{id:"modal-title",className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:r}),o.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 transition-colors","aria-label":"Close modal",children:o.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:i})]})]}):null}const M4={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-8 w-8"};function Ve({size:e="md",className:t=""}){return o.jsxs("svg",{className:`animate-spin ${M4[e]} text-current ${t}`,fill:"none",viewBox:"0 0 24 24",role:"status","aria-label":"Loading",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}const O4={success:{container:"bg-green-50 dark:bg-green-900/30 border-green-200 dark:border-green-800",icon:"text-green-500 dark:text-green-400",title:"text-green-800 dark:text-green-200",message:"text-green-700 dark:text-green-300"},error:{container:"bg-red-50 dark:bg-red-900/30 border-red-200 dark:border-red-800",icon:"text-red-500 dark:text-red-400",title:"text-red-800 dark:text-red-200",message:"text-red-700 dark:text-red-300"},info:{container:"bg-blue-50 dark:bg-blue-900/30 border-blue-200 dark:border-blue-800",icon:"text-blue-500 dark:text-blue-400",title:"text-blue-800 dark:text-blue-200",message:"text-blue-700 dark:text-blue-300"}};function F4({toast:e,onDismiss:t}){const r=O4[e.type],i=y.useRef(t);return i.current=t,y.useEffect(()=>{const l=setTimeout(()=>{i.current(e.id)},5e3);return()=>clearTimeout(l)},[e.id]),o.jsxs(Pe.div,{layout:!0,initial:{opacity:0,x:100,scale:.9},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:100,scale:.9},transition:{duration:.2,ease:[.25,.1,.25,1]},className:`flex items-start gap-3 p-4 border rounded-lg shadow-lg ${r.container}`,role:"alert","aria-live":"polite",children:[o.jsxs("div",{className:`flex-shrink-0 ${r.icon}`,children:[e.type==="success"&&o.jsx(_4,{}),e.type==="error"&&o.jsx(z4,{}),e.type==="info"&&o.jsx(V4,{})]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:`text-sm font-medium ${r.title}`,children:e.title}),e.message&&o.jsx("p",{className:`mt-1 text-sm ${r.message}`,children:e.message})]}),o.jsx("button",{type:"button",onClick:()=>t(e.id),className:"flex-shrink-0 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Dismiss",children:o.jsx(B4,{})})]})}function _4(){return o.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function z4(){return o.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function V4(){return o.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function B4(){return o.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function $4({toasts:e,onDismiss:t}){return o.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm",children:o.jsx(ut,{mode:"popLayout",children:e.map(r=>o.jsx(F4,{toast:r,onDismiss:t},r.id))})})}const ov=y.createContext(null);function U4({children:e}){const[t,r]=y.useState([]),i=y.useCallback(c=>{const d=`${Date.now()}-${Math.random().toString(36).slice(2,9)}`;r(p=>[...p,{...c,id:d}])},[]),l=y.useCallback(c=>{r(d=>d.filter(p=>p.id!==c))},[]);return o.jsxs(ov.Provider,{value:{addToast:i,removeToast:l},children:[e,o.jsx($4,{toasts:t,onDismiss:l})]})}function dn(){const e=y.useContext(ov);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}const W4="/api/v1/config",H4=3e4;async function It(e,t,r=H4){const i=new AbortController,l=setTimeout(()=>i.abort(),r);try{const c=await fetch(`${W4}${e}`,{headers:{"Content-Type":"application/json",...t==null?void 0:t.headers},...t,signal:i.signal}),d=await c.json();if(!c.ok)throw new Error(d.error||"Request failed");return d}catch(c){throw c instanceof Error&&c.name==="AbortError"?new Error("Request timed out"):c}finally{clearTimeout(l)}}async function K4(){return It("/current")}async function q4(){return(await It("/databases")).databases}async function Q4(e){return(await It("/databases/switch",{method:"POST",body:JSON.stringify({dbPath:e})})).config}async function G4(e,t,r){return(await It("/databases/create",{method:"POST",body:JSON.stringify({dbPath:e,name:t,modelName:r})})).config}async function Y4(e){return(await It("/databases/scan",{method:"POST",body:JSON.stringify({scanPath:e})})).databases}async function X4(e,t=!1){return(await It("/databases",{method:"DELETE",body:JSON.stringify({dbPath:e,deleteFiles:t})})).databases}async function J4(){return It("/allowed-roots")}async function Z4(e){return It("/allowed-roots",{method:"POST",body:JSON.stringify({path:e})})}async function eN(e){return It("/allowed-roots",{method:"DELETE",body:JSON.stringify({path:e})})}async function tN(e,t=!1){const r=new URLSearchParams({path:e});return t&&r.set("showHidden","true"),It(`/browse?${r.toString()}`)}async function nN(){return(await It("/models")).models}async function rN(){return It("/export")}async function sN(e){return It("/import",{method:"POST",body:JSON.stringify({config:e})})}async function iN(){return(await It("/hybrid-weight")).weight}async function aN(e){await It("/hybrid-weight",{method:"PUT",body:JSON.stringify({weight:e})})}function lv(e=0){const{data:t,isLoading:r,error:i,refetch:l,isFetching:c}=dr({queryKey:["config","current"],queryFn:K4,refetchInterval:e>0?e:!1});return{config:t,isLoading:r,error:i,refetch:l,isFetching:c}}function oN(){const{data:e,isLoading:t,error:r,refetch:i}=dr({queryKey:["config","databases"],queryFn:q4});return{databases:e||[],isLoading:t,error:r,refetch:i}}function lN(){const e=En(),{addToast:t}=dn(),r=Ut({mutationFn:i=>Q4(i),onSuccess:(i,l)=>{e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["files"]}),e.invalidateQueries({queryKey:["status"]}),t({type:"success",title:"Database switched",message:`Now using ${l.split("/").pop()||l}`})},onError:i=>{t({type:"error",title:"Failed to switch database",message:i.message})}});return{switchDatabase:r.mutate,switchDatabaseAsync:r.mutateAsync,isLoading:r.isPending,error:r.error,isSuccess:r.isSuccess}}function cN(){const e=En(),{addToast:t}=dn(),r=Ut({mutationFn:({dbPath:i,name:l,modelName:c})=>G4(i,l,c),onSuccess:(i,l)=>{e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["files"]}),e.invalidateQueries({queryKey:["status"]}),t({type:"success",title:"Database created",message:`Created and switched to ${l.dbPath.split("/").pop()||l.dbPath}`})},onError:i=>{t({type:"error",title:"Failed to create database",message:i.message})}});return{createDatabase:r.mutate,createDatabaseAsync:r.mutateAsync,isLoading:r.isPending,error:r.error,isSuccess:r.isSuccess}}function uN(){const{addToast:e}=dn(),t=Ut({mutationFn:r=>Y4(r),onError:r=>{e({type:"error",title:"Scan failed",message:r.message})}});return{scan:t.mutate,scanAsync:t.mutateAsync,isLoading:t.isPending,error:t.error,data:t.data,reset:t.reset}}function dN(){const e=En(),{addToast:t}=dn(),r=Ut({mutationFn:({dbPath:i,deleteFiles:l})=>X4(i,l),onSuccess:(i,l)=>{e.invalidateQueries({queryKey:["config","databases"]});const c=l.dbPath.split("/").pop()||l.dbPath;t({type:"success",title:"Database removed",message:l.deleteFiles?`Deleted ${c} and its files`:`Removed ${c} from list`})},onError:i=>{t({type:"error",title:"Failed to delete database",message:i.message})}});return{deleteDatabase:r.mutate,deleteDatabaseAsync:r.mutateAsync,isLoading:r.isPending,error:r.error}}function pN(){const{data:e,isLoading:t,error:r,refetch:i}=dr({queryKey:["config","allowed-roots"],queryFn:J4});return{data:e,isLoading:t,error:r,refetch:i}}function fN(){const e=En(),{addToast:t}=dn(),r=Ut({mutationFn:i=>Z4(i),onSuccess:()=>{e.invalidateQueries({queryKey:["config","allowed-roots"]}),t({type:"success",title:"Root added",message:"Allowed root added successfully"})},onError:i=>{t({type:"error",title:"Failed to add root",message:i.message})}});return{addRoot:r.mutate,addRootAsync:r.mutateAsync,isLoading:r.isPending,error:r.error}}function hN(){const e=En(),{addToast:t}=dn(),r=Ut({mutationFn:i=>eN(i),onSuccess:()=>{e.invalidateQueries({queryKey:["config","allowed-roots"]}),t({type:"success",title:"Root removed",message:"Allowed root removed successfully"})},onError:i=>{t({type:"error",title:"Failed to remove root",message:i.message})}});return{removeRoot:r.mutate,removeRootAsync:r.mutateAsync,isLoading:r.isPending,error:r.error}}function mN(){const{addToast:e}=dn(),t=Ut({mutationFn:({path:l,showHidden:c=!1})=>tN(l,c),onError:l=>{e({type:"error",title:"Failed to browse directory",message:l.message})}}),r=y.useCallback((l,c=!1)=>t.mutate({path:l,showHidden:c}),[t.mutate]),i=y.useCallback((l,c=!1)=>t.mutateAsync({path:l,showHidden:c}),[t.mutateAsync]);return{browse:r,browseAsync:i,isLoading:t.isPending,error:t.error,data:t.data,reset:t.reset}}function gN(){const{data:e,isLoading:t,error:r}=dr({queryKey:["config","models"],queryFn:nN});return{models:e||[],isLoading:t,error:r}}function xN(){const{addToast:e}=dn(),t=Ut({mutationFn:rN,onSuccess:()=>{e({type:"success",title:"Configuration exported",message:"Download should begin automatically"})},onError:r=>{e({type:"error",title:"Failed to export configuration",message:r.message})}});return{exportConfig:t.mutate,exportConfigAsync:t.mutateAsync,isLoading:t.isPending,error:t.error,data:t.data}}function yN(){const e=En(),{addToast:t}=dn(),r=Ut({mutationFn:i=>sN(i),onSuccess:()=>{e.invalidateQueries({queryKey:["config","allowed-roots"]}),t({type:"success",title:"Configuration imported",message:"Settings have been restored"})},onError:i=>{t({type:"error",title:"Failed to import configuration",message:i.message})}});return{importConfig:r.mutate,importConfigAsync:r.mutateAsync,isLoading:r.isPending,error:r.error}}function vN(){const{data:e,isLoading:t,error:r,refetch:i}=dr({queryKey:["config","hybrid-weight"],queryFn:iN});return{weight:e??.6,isLoading:t,error:r,refetch:i}}function bN(){const e=En(),{addToast:t}=dn(),r=Ut({mutationFn:i=>aN(i),onSuccess:()=>{e.invalidateQueries({queryKey:["config","hybrid-weight"]}),t({type:"success",title:"Search weight updated",message:"Hybrid search weight has been adjusted"})},onError:i=>{t({type:"error",title:"Failed to update search weight",message:i.message})}});return{setWeight:r.mutate,setWeightAsync:r.mutateAsync,isLoading:r.isPending,error:r.error}}const cv="/api/v1",kN=3e4,wN=3e5;async function Jr(e,t,r=kN){const i=new AbortController,l=setTimeout(()=>i.abort(),r);try{const c=await fetch(`${cv}${e}`,{headers:{"Content-Type":"application/json",...t==null?void 0:t.headers},...t,signal:i.signal}),d=await c.json();if(!c.ok)throw new Error(d.error||"Request failed");return d}catch(c){throw c instanceof Error&&c.name==="AbortError"?new Error("Request timed out"):c}finally{clearTimeout(l)}}async function uv(e,t){return(await Jr("/search",{method:"POST",body:JSON.stringify({query:e,limit:t})})).results}async function jN(e){const t=new AbortController,r=setTimeout(()=>t.abort(),wN);try{const i=new FormData;i.append("file",e);const l=await fetch(`${cv}/files/upload`,{method:"POST",body:i,signal:t.signal}),c=await l.json();if(!l.ok)throw new Error(c.error||"Upload failed");return c}catch(i){throw i instanceof Error&&i.name==="AbortError"?new Error("Upload timed out"):i}finally{clearTimeout(r)}}async function SN(e,t,r){return Jr("/data",{method:"POST",body:JSON.stringify({content:e,metadata:{source:t,format:r}})})}async function CN(){return(await Jr("/files")).files}async function NN(e){await Jr("/files",{method:"DELETE",body:JSON.stringify(e)})}async function EN(){return Jr("/status")}async function PN(e){const t=encodeURIComponent(e);return(await Jr(`/documents/chunks?filePath=${t}`)).chunks}async function TN(e,t){const r=await Jr("/chunks/batch-related",{method:"POST",body:JSON.stringify({chunks:e,limit:t})}),i={};for(const[l,c]of Object.entries(r.results)){const[d]=l.split(":");i[l]=c.map(p=>({...p,connectionReason:RN(p.score,p.filePath===d)}))}return i}function RN(e,t){return t?"Same document":e<.3?"Very similar":e<.5?"Related topic":"Loosely related"}async function lg(e,t,r){await Jr("/feedback",{method:"POST",body:JSON.stringify({type:e,source:t,target:r})})}function DN(){const e=En(),{addToast:t}=dn(),{data:r=[],isLoading:i,error:l}=dr({queryKey:["files"],queryFn:CN}),c=Ut({mutationFn:NN,onSuccess:()=>{e.invalidateQueries({queryKey:["files"]}),t({type:"success",title:"File deleted",message:"The file has been removed from the knowledge base."})},onError:d=>{t({type:"error",title:"Failed to delete file",message:d.message})}});return{files:r,isLoading:i,error:l,deleteFile:c.mutate,isDeleting:c.isPending}}function LN(){const[e,t]=y.useState([]),[r,i]=y.useState(!1),l=Ut({mutationFn:({query:p,limit:h})=>uv(p,h),onSuccess:p=>{t(p),i(!0)}});return{results:e,search:(p,h)=>{l.mutate({query:p,limit:h})},clear:()=>{t([]),i(!1)},isLoading:l.isPending,error:l.error,hasSearched:r}}function IN(){const{data:e,isLoading:t,error:r,refetch:i}=dr({queryKey:["status"],queryFn:EN,refetchInterval:3e4});return{status:e,isLoading:t,error:r,refetch:i}}function AN(){const e=En(),t=Ut({mutationFn:jN,onSuccess:()=>{e.invalidateQueries({queryKey:["files"]})}}),r=Ut({mutationFn:({content:i,source:l,format:c})=>SN(i,l,c),onSuccess:()=>{e.invalidateQueries({queryKey:["files"]})}});return{uploadFile:t.mutate,ingestData:r.mutate,isUploading:t.isPending,isIngesting:r.isPending,uploadError:t.error,ingestError:r.error,uploadResult:t.data,ingestResult:r.data,reset:()=>{t.reset(),r.reset()}}}function dv(e){const{data:t=[],isLoading:r,error:i,refetch:l}=dr({queryKey:["documentChunks",e],queryFn:()=>e?PN(e):Promise.resolve([]),enabled:!!e,staleTime:3e5});return{chunks:t,isLoading:r,error:i,refetch:l}}function MN(e="100px"){const[t,r]=y.useState(new Set),[i,l]=y.useState(null),c=y.useRef(null),d=y.useRef(new Map),p=y.useRef(new Set);y.useEffect(()=>{c.current=new IntersectionObserver(x=>{r(v=>{const b=new Set(v);for(const w of x){const P=Number(w.target.getAttribute("data-chunk-index"));Number.isNaN(P)||(w.isIntersecting?b.add(P):b.delete(P))}return b})},{rootMargin:e,threshold:[0,.25,.5,.75,1]});const m=c.current;for(const[,x]of d.current)m.observe(x);for(const x of p.current){const v=d.current.get(x);v&&m.observe(v)}return p.current.clear(),()=>{m.disconnect(),c.current=null}},[e]),y.useEffect(()=>{if(t.size===0)l(null);else{const m=Array.from(t).sort((x,v)=>x-v);l(m[0]??null)}},[t]);const h=y.useCallback((m,x)=>{const v=c.current,b=d.current.get(m);b&&v&&v.unobserve(b),p.current.delete(m),x?(d.current.set(m,x),x.setAttribute("data-chunk-index",String(m)),v?v.observe(x):p.current.add(m)):d.current.delete(m)},[]);return{visibleChunkIndices:t,registerChunk:h,activeChunkIndex:i}}function ON(e,t,r=300,i=5){const[l,c]=y.useState([]);y.useEffect(()=>{if(!e||t.size===0){c([]);return}const m=Array.from(t).map(v=>({filePath:e,chunkIndex:v})),x=setTimeout(()=>{c(m)},r);return()=>clearTimeout(x)},[e,t,r]);const{data:d={},isLoading:p,error:h}=dr({queryKey:["batchRelatedChunks",l,i],queryFn:()=>l.length>0?TN(l,i):{},enabled:l.length>0,staleTime:300*1e3});return{relatedChunks:d,isLoading:p,error:h}}function hl(){return crypto.randomUUID()}async function cg(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(i)).map(c=>c.toString(16).padStart(2,"0")).join("")}function ys(e,t){return e.fingerprint&&t.fingerprint?e.fingerprint===t.fingerprint:e.filePath===t.filePath&&e.chunkIndex===t.chunkIndex}const FN={version:1,vaultId:"",pins:[],trails:[],bookmarks:[]},pv=y.createContext(null);function _N({children:e,vaultId:t="default"}){const r=`rag-vault-links-v1-${t}`,[i,l]=Nn(r,{...FN,vaultId:t}),c=y.useCallback((ne,O,_,$,K)=>{const W={id:hl(),createdAt:new Date().toISOString(),sourceKey:ne,sourceText:_.slice(0,200),sourceFingerprint:"",targetKey:O,targetText:$.slice(0,200),targetFingerprint:"",label:K==null?void 0:K.label,autoGenerated:(K==null?void 0:K.autoGenerated)??!1,originalScore:K==null?void 0:K.originalScore};return Promise.all([cg(_),cg($)]).then(([q,Q])=>{l(J=>({...J,pins:J.pins.map(L=>L.id===W.id?{...L,sourceFingerprint:q,targetFingerprint:Q}:L)})),lg("pin",{...ne,fingerprint:q},{...O,fingerprint:Q}).catch(()=>{})}).catch(q=>{console.warn("Failed to hash text for pin fingerprints:",q)}),l(q=>({...q,pins:[...q.pins,W]})),W},[l]),d=y.useCallback(ne=>{const O=i.pins.find(_=>_.id===ne);l(_=>({..._,pins:_.pins.filter($=>$.id!==ne)})),O&&lg("unpin",{...O.sourceKey,fingerprint:O.sourceFingerprint},{...O.targetKey,fingerprint:O.targetFingerprint}).catch(()=>{})},[l,i.pins]),p=y.useCallback((ne,O)=>{l(_=>({..._,pins:_.pins.map($=>$.id===ne?{...$,label:O}:$)}))},[l]),h=y.useCallback(ne=>i.pins.filter(O=>ys(O.sourceKey,ne)),[i.pins]),m=y.useCallback(ne=>i.pins.filter(O=>ys(O.targetKey,ne)),[i.pins]),x=y.useCallback((ne,O)=>i.pins.some(_=>ys(_.sourceKey,ne)&&ys(_.targetKey,O)),[i.pins]),[v,b]=Nn(`rag-vault-current-trail-${t}`,null),w=y.useCallback(()=>{const ne={id:hl(),name:"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),steps:[]};b(ne)},[b]),P=y.useCallback((ne,O)=>{b(_=>{if(!_)return{id:hl(),name:"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),steps:[{chunkKey:ne,visitedAt:new Date().toISOString(),connectionReason:O}]};const $=_.steps[_.steps.length-1];return $&&ys($.chunkKey,ne)?_:{..._,updatedAt:new Date().toISOString(),steps:[..._.steps,{chunkKey:ne,visitedAt:new Date().toISOString(),connectionReason:O}]}})},[b]),j=y.useCallback(ne=>{if(!v)throw new Error("No current trail to save");const O={...v,name:ne,updatedAt:new Date().toISOString()};return l(_=>({..._,trails:[..._.trails,O]})),b(null),O},[v,l,b]),N=y.useCallback(ne=>{const O=i.trails.find(_=>_.id===ne);return O&&b({...O}),O||null},[i.trails,b]),S=y.useCallback(ne=>{l(O=>({...O,trails:O.trails.filter(_=>_.id!==ne)}))},[l]),T=y.useCallback(()=>{b(null)},[b]),k=y.useCallback((ne,O)=>{const _={id:hl(),chunkKey:ne,note:O,createdAt:new Date().toISOString()};return l($=>({...$,bookmarks:[...$.bookmarks||[],_]})),_},[l]),E=y.useCallback(ne=>{l(O=>({...O,bookmarks:(O.bookmarks||[]).filter(_=>_.id!==ne)}))},[l]),R=y.useCallback((ne,O)=>{l(_=>({..._,bookmarks:(_.bookmarks||[]).map($=>$.id===ne?{...$,note:O}:$)}))},[l]),M=y.useCallback(ne=>(i.bookmarks||[]).filter(O=>O.chunkKey.filePath===ne).sort((O,_)=>O.chunkKey.chunkIndex-_.chunkKey.chunkIndex),[i.bookmarks]),H=y.useCallback(ne=>(i.bookmarks||[]).some(O=>ys(O.chunkKey,ne)),[i.bookmarks]),B=y.useCallback(ne=>{const O=(i.bookmarks||[]).find(_=>ys(_.chunkKey,ne));return O?(E(O.id),!1):(k(ne),!0)},[i.bookmarks,k,E]),te=y.useCallback(()=>JSON.stringify(i,null,2),[i]),X=y.useCallback(ne=>{const O=[];let _=0;try{const $=JSON.parse(ne);if($.version!==1)return O.push(`Unsupported version: ${$.version}`),{imported:_,errors:O};if(Array.isArray($.pins))for(const K of $.pins)K.id&&K.sourceKey&&K.targetKey&&!i.pins.some(W=>W.id===K.id)&&(l(W=>({...W,pins:[...W.pins,K]})),_++);if(Array.isArray($.trails))for(const K of $.trails)K.id&&K.name&&Array.isArray(K.steps)&&!i.trails.some(W=>W.id===K.id)&&(l(W=>({...W,trails:[...W.trails,K]})),_++);if(Array.isArray($.bookmarks))for(const K of $.bookmarks)K.id&&K.chunkKey&&!(i.bookmarks||[]).some(W=>W.id===K.id)&&(l(W=>({...W,bookmarks:[...W.bookmarks||[],K]})),_++)}catch($){O.push(`Invalid JSON: ${$.message}`)}return{imported:_,errors:O}},[i,l]),se=y.useMemo(()=>({pins:i.pins,createPin:c,deletePin:d,updatePinLabel:p,getPinsFromChunk:h,getBacklinks:m,isPinned:x,trails:i.trails,currentTrail:v,startNewTrail:w,addToTrail:P,saveTrail:j,loadTrail:N,deleteTrail:S,clearCurrentTrail:T,bookmarks:i.bookmarks||[],createBookmark:k,deleteBookmark:E,updateBookmarkNote:R,getBookmarksForDocument:M,isBookmarked:H,toggleBookmark:B,exportLinks:te,importLinks:X}),[i.pins,i.trails,i.bookmarks,c,d,p,h,m,x,v,w,P,j,N,S,T,k,E,R,M,H,B,te,X]);return o.jsx(pv.Provider,{value:se,children:e})}function Wl(){const e=y.useContext(pv);if(!e)throw new Error("useLinks must be used within a LinksProvider");return e}function zN(){const e=Wl(),t=y.useMemo(()=>{const i=new Set;for(const l of e.pins)i.add(`${l.targetKey.filePath}:${l.targetKey.chunkIndex}`);return i},[e.pins]),r=y.useCallback((i,l,c,d,p)=>{const h=e.pins.find(m=>m.sourceKey.filePath===i.filePath&&m.sourceKey.chunkIndex===i.chunkIndex&&m.targetKey.filePath===l.filePath&&m.targetKey.chunkIndex===l.chunkIndex);h?e.deletePin(h.id):e.createPin(i,l,c,d,{autoGenerated:!1,originalScore:p})},[e]);return{pins:e.pins,pinnedChunkKeys:t,createPin:e.createPin,deletePin:e.deletePin,updatePinLabel:e.updatePinLabel,isPinned:e.isPinned,togglePin:r,getPinsFromChunk:e.getPinsFromChunk}}function Od(){return crypto.randomUUID()}function VN(e,t){const r=e||"1",i=String.fromCharCode(97+t);return`${r}${i}`}function BN(e){if(e.length===0)return null;const t=e[0];if(!t)return null;const r={id:Od(),chunkKey:t.chunkKey,visitedAt:t.visitedAt,connectionReason:t.connectionReason,branchLabel:"1",children:[]};let i=r;for(let l=1;l<e.length;l++){const c=e[l];if(!c)continue;const d={id:Od(),chunkKey:c.chunkKey,visitedAt:c.visitedAt,connectionReason:c.connectionReason,branchLabel:String(l+1),children:[]};i.children.push(d),i=d}return r}function fv(e,t=[]){return e&&(t.push({chunkKey:e.chunkKey,visitedAt:e.visitedAt,connectionReason:e.connectionReason}),e.children.length>0&&fv(e.children[0]||null,t)),t}function hv(e,t){if(!e)return null;if(e.id===t)return e;for(const r of e.children){const i=hv(r,t);if(i)return i}return null}function $N(){const e=Wl(),[t,r]=y.useState(null),i=y.useCallback((h,m)=>{e.addToTrail(h,m)},[e]),l=y.useCallback(()=>e.currentTrail?e.currentTrail.root?e.currentTrail.root:BN(e.currentTrail.steps):null,[e.currentTrail]),c=y.useCallback(()=>fv(l()),[l]),d=y.useCallback((h,m)=>{if(!e.currentTrail)return null;const x=l();if(!x)return null;const v=t||x.id,b=hv(x,v);if(!b)return null;const w={id:Od(),chunkKey:h,visitedAt:new Date().toISOString(),connectionReason:m,branchLabel:VN(b.branchLabel,b.children.length),children:[]};return b.children.push(w),r(w.id),w.id},[e.currentTrail,t,l]),p=y.useMemo(()=>{if(!e.currentTrail)return 0;const h=l();if(!h)return e.currentTrail.steps.length;let m=0;const x=v=>{m++,v.children.forEach(x)};return x(h),m},[e.currentTrail,l]);return{currentTrail:e.currentTrail,savedTrails:e.trails,isRecording:e.currentTrail!==null,stepCount:p,startNewTrail:e.startNewTrail,addStep:i,saveTrail:e.saveTrail,loadTrail:e.loadTrail,deleteTrail:e.deleteTrail,clearCurrentTrail:e.clearCurrentTrail,currentNodeId:t,setCurrentNodeId:r,addBranch:d,getTrailTree:l,flattenTrail:c}}function UN({totalChunks:e,activeChunkIndex:t,onNavigateToChunk:r,onToggleSplit:i,onPinTopSuggestion:l,onOpenSearch:c,onOpenHelp:d,onCloseOverlay:p,isOverlayOpen:h,enabled:m=!0,isSearchOpen:x=!1,onNextSearchMatch:v,onPreviousSearchMatch:b,onToggleBookmark:w,onOpenTagPicker:P,onToggleAnnotationPanel:j,onToggleReadingMode:N,onOpenComparison:S,onResetGraphLayout:T,onOpenGraphExport:k,onTogglePathfinding:E,onToggleClustering:R,isGraphOpen:M=!1,onToggleInferredLinks:H,onToggleCrossDocPanel:B,onToggleStatsPanel:te,onToggleDiscoveryMode:X,isDiscoveryMode:se=!1,onDiscoverySelectSuggestion:ne,onDiscoveryGoBack:O}){const _=y.useRef(null),$=y.useRef({totalChunks:e,activeChunkIndex:t,isOverlayOpen:h,isSearchOpen:x,isGraphOpen:M,isDiscoveryMode:se}),K=y.useRef({onNavigateToChunk:r,onToggleSplit:i,onPinTopSuggestion:l,onOpenSearch:c,onOpenHelp:d,onCloseOverlay:p,onNextSearchMatch:v,onPreviousSearchMatch:b,onToggleBookmark:w,onOpenTagPicker:P,onToggleAnnotationPanel:j,onToggleReadingMode:N,onOpenComparison:S,onResetGraphLayout:T,onOpenGraphExport:k,onTogglePathfinding:E,onToggleClustering:R,onToggleInferredLinks:H,onToggleCrossDocPanel:B,onToggleStatsPanel:te,onToggleDiscoveryMode:X,onDiscoverySelectSuggestion:ne,onDiscoveryGoBack:O});$.current={totalChunks:e,activeChunkIndex:t,isOverlayOpen:h,isSearchOpen:x,isGraphOpen:M,isDiscoveryMode:se},K.current={onNavigateToChunk:r,onToggleSplit:i,onPinTopSuggestion:l,onOpenSearch:c,onOpenHelp:d,onCloseOverlay:p,onNextSearchMatch:v,onPreviousSearchMatch:b,onToggleBookmark:w,onOpenTagPicker:P,onToggleAnnotationPanel:j,onToggleReadingMode:N,onOpenComparison:S,onResetGraphLayout:T,onOpenGraphExport:k,onTogglePathfinding:E,onToggleClustering:R,onToggleInferredLinks:H,onToggleCrossDocPanel:B,onToggleStatsPanel:te,onToggleDiscoveryMode:X,onDiscoverySelectSuggestion:ne,onDiscoveryGoBack:O};const W=y.useCallback(()=>{const Q=document.activeElement;if(Q){const L=Q.tagName.toLowerCase();if(L==="input"||L==="textarea"||Q.getAttribute("contenteditable")==="true")return!0}const J=window.getSelection();return!!(J&&J.toString().length>0)},[]),q=y.useCallback(Q=>{var G,be,ge,ye,we,Se,Ce,Re,et,Pt,Wt,vt,pn,fn,Pn,hn,bt;if(W())return;const J=$.current,L=K.current;if(Q.key==="Escape"){J.isOverlayOpen&&(Q.preventDefault(),L.onCloseOverlay());return}if(J.isSearchOpen){switch(Q.key){case"n":Q.preventDefault(),(G=L.onNextSearchMatch)==null||G.call(L);return;case"N":Q.preventDefault(),(be=L.onPreviousSearchMatch)==null||be.call(L);return}return}if(!J.isOverlayOpen)switch(Q.key){case"j":{Q.preventDefault();const mt=J.activeChunkIndex===null?0:Math.min(J.activeChunkIndex+1,J.totalChunks-1);L.onNavigateToChunk(mt);break}case"k":{Q.preventDefault();const mt=J.activeChunkIndex===null?0:Math.max(J.activeChunkIndex-1,0);L.onNavigateToChunk(mt);break}case" ":{Q.preventDefault(),L.onToggleSplit();break}case"p":{Q.preventDefault(),L.onPinTopSuggestion();break}case"/":{Q.preventDefault(),L.onOpenSearch();break}case"?":{Q.preventDefault(),L.onOpenHelp();break}case"b":{Q.preventDefault(),(ge=L.onToggleBookmark)==null||ge.call(L);break}case"t":{Q.preventDefault(),(ye=L.onOpenTagPicker)==null||ye.call(L);break}case"a":{Q.preventDefault(),(we=L.onToggleAnnotationPanel)==null||we.call(L);break}case"m":{Q.preventDefault(),(Se=L.onToggleReadingMode)==null||Se.call(L);break}case"c":{Q.preventDefault(),(Ce=L.onOpenComparison)==null||Ce.call(L);break}case"r":{J.isGraphOpen&&(Q.preventDefault(),(Re=L.onResetGraphLayout)==null||Re.call(L));break}case"e":{J.isGraphOpen&&(Q.preventDefault(),(et=L.onOpenGraphExport)==null||et.call(L));break}case"f":{J.isGraphOpen&&(Q.preventDefault(),(Pt=L.onTogglePathfinding)==null||Pt.call(L));break}case"g":{J.isGraphOpen&&(Q.preventDefault(),(Wt=L.onToggleClustering)==null||Wt.call(L));break}case"i":{Q.preventDefault(),(vt=L.onToggleInferredLinks)==null||vt.call(L);break}case"x":{Q.preventDefault(),(pn=L.onToggleCrossDocPanel)==null||pn.call(L);break}case"s":{Q.preventDefault(),(fn=L.onToggleStatsPanel)==null||fn.call(L);break}case"d":{Q.preventDefault(),(Pn=L.onToggleDiscoveryMode)==null||Pn.call(L);break}case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{if(J.isDiscoveryMode){Q.preventDefault();const mt=parseInt(Q.key,10)-1;(hn=L.onDiscoverySelectSuggestion)==null||hn.call(L,mt)}break}case"Backspace":{J.isDiscoveryMode&&(Q.preventDefault(),(bt=L.onDiscoveryGoBack)==null||bt.call(L));break}}},[W]);return y.useEffect(()=>{if(m)return document.addEventListener("keydown",q),()=>{document.removeEventListener("keydown",q)}},[m,q]),{containerRef:_}}async function WN(e){const r=new TextEncoder().encode(e.slice(0,500)),i=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(i)).slice(0,8).map(c=>c.toString(16).padStart(2,"0")).join("")}function HN({filePath:e,chunks:t,activeChunkIndex:r,vaultId:i="default",debounceMs:l=1e3}){const c=`rag-vault-reading-progress-${i}`,[d,p]=Nn(c,{}),h=y.useRef(null),m=y.useRef(null),x=y.useRef(!1),v=y.useRef({chunkIndex:0,scrollOffset:0});y.useEffect(()=>{if(t.length>0){const T=t[0];T&&WN(T.text).then(k=>{m.current=k})}},[t]);const b=y.useCallback(T=>`${e}:${T}`,[e]),w=Object.entries(d).find(([T])=>T.startsWith(`${e}:`)),P=!!w,j=w?w[1].lastChunkIndex:null,N=y.useCallback((T,k)=>{m.current&&(v.current={chunkIndex:T,scrollOffset:k},h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{const E=m.current;if(!E)return;const{chunkIndex:R,scrollOffset:M}=v.current,H=b(E);p(B=>({...B,[H]:{lastChunkIndex:R,scrollOffsetWithinChunk:M,lastVisited:new Date().toISOString(),fileFingerprint:E}}))},l))},[b,p,l]);y.useEffect(()=>{if(r!==null&&x.current){const T=document.getElementById(`chunk-${r}`),k=T?T.getBoundingClientRect().top:0;N(r,k)}},[r,N]);const S=y.useCallback(()=>{if(!m.current||t.length===0)return null;const T=m.current,k=b(T),E=d[k];return E?E.fileFingerprint!==T?(x.current=!0,{chunkIndex:0,scrollOffset:0}):(x.current=!0,{chunkIndex:Math.min(E.lastChunkIndex,t.length-1),scrollOffset:E.scrollOffsetWithinChunk}):Object.entries(d).find(([M])=>M.startsWith(`${e}:`))?(x.current=!0,{chunkIndex:0,scrollOffset:0}):(x.current=!0,null)},[e,t,d,b]);return y.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),{restorePosition:S,savePosition:N,hasSavedPosition:P,savedChunkIndex:j}}const KN=/^(#{1,6})\s+(.+)$/m,qN=/^([A-Z][A-Z0-9\s]{4,79})$/m,QN=/^(\d+(?:\.\d+)*)\s+(.+)$/m;function GN(e){const t=e.match(KN);if(t){const[,l,c]=t;if(l&&c)return{text:c.trim(),level:l.length,type:"markdown"}}const r=e.match(QN);if(r){const[,l,c]=r;if(l&&c){const d=l.split(".").length;return{text:`${l} ${c.trim()}`,level:d,type:"numbered"}}}const i=e.trim();if(i.length>=5&&i.length<=80){const l=i.match(qN);if(l!=null&&l[1]){const c=l[1].match(/[A-Z]/g);if(c&&c.length>=3)return{text:l[1].trim(),level:1,type:"allcaps"}}}return null}function YN(e,t){const r=[],i=e.split(`
|
|
60
|
+
`);for(const l of i){const c=GN(l);c&&r.push({...c,chunkIndex:t,text:c.text.length>80?`${c.text.slice(0,77)}...`:c.text})}return r}function XN(e){const t=Math.max(1,Math.floor(e.length/10));return e.filter((r,i)=>i%t===0).map((r,i)=>({id:`fallback-${r.chunkIndex}`,text:`Section ${i+1}`,level:1,chunkIndex:r.chunkIndex,type:"fallback"}))}function JN({chunks:e,minHeadings:t=2}){return y.useMemo(()=>{if(e.length===0)return{entries:[],hasHeadings:!1,isFallback:!1};const i=[];for(const d of e){const p=YN(d.text,d.chunkIndex);i.push(...p)}const l=[];for(const d of i){const p=l[l.length-1];(!p||p.text!==d.text||p.chunkIndex!==d.chunkIndex)&&l.push(d)}return l.length<t?{entries:XN(e),hasHeadings:!1,isFallback:!0}:{entries:l.map((d,p)=>({...d,id:`toc-${p}-${d.chunkIndex}`})),hasHeadings:!0,isFallback:!1}},[e,t])}function ug(){return crypto.randomUUID()}function ZN(e,t){return e.filePath===t.filePath&&e.chunkIndex===t.chunkIndex}const eE={version:1,vaultId:"",highlights:[],annotations:[]},mv=y.createContext(null);function tE({children:e,vaultId:t="default"}){const r=`rag-vault-annotations-v1-${t}`,[i,l]=Nn(r,{...eE,vaultId:t}),c=y.useCallback((N,S,T,k,E,R)=>{const M={id:ug(),chunkKey:N,range:S,text:T,contextBefore:k.slice(-30),contextAfter:E.slice(0,30),color:R,createdAt:new Date().toISOString()};return l(H=>({...H,highlights:[...H.highlights,M]})),M},[l]),d=y.useCallback(N=>{l(S=>({...S,highlights:S.highlights.filter(T=>T.id!==N),annotations:S.annotations.filter(T=>T.highlightId!==N)}))},[l]),p=y.useCallback((N,S)=>{l(T=>({...T,highlights:T.highlights.map(k=>k.id===N?{...k,color:S}:k)}))},[l]),h=y.useCallback(N=>i.highlights.filter(S=>ZN(S.chunkKey,N)).sort((S,T)=>S.range.startOffset-T.range.startOffset),[i.highlights]),m=y.useCallback((N,S)=>{const T={id:ug(),highlightId:N,note:S,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};return l(k=>({...k,annotations:[...k.annotations,T]})),T},[l]),x=y.useCallback((N,S)=>{l(T=>({...T,annotations:T.annotations.map(k=>k.id===N?{...k,note:S,updatedAt:new Date().toISOString()}:k)}))},[l]),v=y.useCallback(N=>{l(S=>({...S,annotations:S.annotations.filter(T=>T.id!==N)}))},[l]),b=y.useCallback(N=>i.annotations.find(S=>S.highlightId===N),[i.annotations]),w=y.useCallback(()=>JSON.stringify(i,null,2),[i]),P=y.useCallback(N=>{const S=[];let T=0;try{const k=JSON.parse(N);if(k.version!==1)return S.push(`Unsupported version: ${k.version}`),{imported:T,errors:S};if(Array.isArray(k.highlights))for(const E of k.highlights)E.id&&E.chunkKey&&E.range&&!i.highlights.some(R=>R.id===E.id)&&(l(R=>({...R,highlights:[...R.highlights,E]})),T++);if(Array.isArray(k.annotations))for(const E of k.annotations)E.id&&E.highlightId&&!i.annotations.some(R=>R.id===E.id)&&(l(R=>({...R,annotations:[...R.annotations,E]})),T++)}catch(k){S.push(`Invalid JSON: ${k.message}`)}return{imported:T,errors:S}},[i,l]),j=y.useMemo(()=>({highlights:i.highlights,createHighlight:c,deleteHighlight:d,updateHighlightColor:p,getHighlightsForChunk:h,annotations:i.annotations,createAnnotation:m,updateAnnotation:x,deleteAnnotation:v,getAnnotationForHighlight:b,exportAnnotations:w,importAnnotations:P}),[i.highlights,i.annotations,c,d,p,h,m,x,v,b,w,P]);return o.jsx(mv.Provider,{value:j,children:e})}function gv(){const e=y.useContext(mv);if(!e)throw new Error("useAnnotations must be used within an AnnotationsProvider");return e}function nE(e){const t=gv(),r=y.useMemo(()=>e?t.getHighlightsForChunk(e):[],[t,e]),i=y.useMemo(()=>{const x=new Map;for(const v of r){const b=t.getAnnotationForHighlight(v.id);b&&x.set(v.id,b)}return x},[r,t]),l=y.useCallback((x,v,b,w,P)=>{if(!e)throw new Error("No chunk key provided");return t.createHighlight(e,x,v,b,w,P)},[t,e]),c=y.useCallback(x=>{t.deleteHighlight(x)},[t]),d=y.useCallback((x,v)=>{t.updateHighlightColor(x,v)},[t]),p=y.useCallback((x,v)=>t.createAnnotation(x,v),[t]),h=y.useCallback((x,v)=>{t.updateAnnotation(x,v)},[t]),m=y.useCallback(x=>{t.deleteAnnotation(x)},[t]);return{highlights:r,annotations:i,createHighlight:l,deleteHighlight:c,updateHighlightColor:d,addNote:p,updateNote:h,deleteNote:m,hasHighlights:r.length>0}}function rE(e,t,r){var v,b;const i=e.getRangeAt(0),l=[],c=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let d=c.nextNode();for(;d!==null;)l.push(d),d=c.nextNode();let p=0,h=!1;for(const w of l){if(w===i.startContainer){p+=i.startOffset,h=!0;break}p+=((v=w.textContent)==null?void 0:v.length)??0}if(!h)return null;let m=0,x=!1;for(const w of l){if(w===i.endContainer){m+=i.endOffset,x=!0;break}m+=((b=w.textContent)==null?void 0:b.length)??0}return!x||p<0||m>r.length||p>=m?null:{startOffset:p,endOffset:m}}function sE({containerRef:e,chunkText:t,enabled:r=!0}){const[i,l]=y.useState(null),c=y.useCallback(()=>{var d;l(null),(d=window.getSelection())==null||d.removeAllRanges()},[]);return y.useEffect(()=>{if(!r)return;const d=()=>{const m=window.getSelection();if(!m||m.isCollapsed||!m.rangeCount){l(null);return}const x=e.current;if(!x){l(null);return}const v=m.getRangeAt(0);if(!x.contains(v.commonAncestorContainer)){l(null);return}const b=m.toString().trim();if(!b){l(null);return}const w=rE(m,x,t);if(!w){l(null);return}const P=v.getBoundingClientRect(),j=t.slice(Math.max(0,w.startOffset-30),w.startOffset),N=t.slice(w.endOffset,w.endOffset+30);l({startOffset:w.startOffset,endOffset:w.endOffset,text:b,contextBefore:j,contextAfter:N,rect:P})};let p;const h=()=>{clearTimeout(p),p=setTimeout(d,100)};return document.addEventListener("selectionchange",h),()=>{document.removeEventListener("selectionchange",h),clearTimeout(p)}},[r,e,t]),{selection:i,clearSelection:c}}function iE({filePath:e,activeChunkIndex:t,relatedChunks:r,pins:i,maxNodes:l=150}){const c=y.useMemo(()=>{const p=new Map,h=[],m=t!==null?`${e}:${t}`:null;m&&p.set(m,{id:m,filePath:e,chunkIndex:t,text:"(current chunk)"});for(const w of r){const P=`${w.filePath}:${w.chunkIndex}`;p.has(P)||p.set(P,{id:P,filePath:w.filePath,chunkIndex:w.chunkIndex,text:w.text.slice(0,100)+(w.text.length>100?"...":"")}),m&&m!==P&&h.push({source:m,target:P,score:w.score,type:"semantic",label:w.connectionReason})}for(const w of i){const P=`${w.sourceKey.filePath}:${w.sourceKey.chunkIndex}`,j=`${w.targetKey.filePath}:${w.targetKey.chunkIndex}`;p.has(P)||p.set(P,{id:P,filePath:w.sourceKey.filePath,chunkIndex:w.sourceKey.chunkIndex,text:w.sourceText.slice(0,100)+(w.sourceText.length>100?"...":"")}),p.has(j)||p.set(j,{id:j,filePath:w.targetKey.filePath,chunkIndex:w.targetKey.chunkIndex,text:w.targetText.slice(0,100)+(w.targetText.length>100?"...":"")});const N=h.findIndex(S=>S.source===P&&S.target===j);if(N>=0){const S=h[N];S&&(h[N]={...S,type:"pinned",label:w.label||S.label})}else h.push({source:P,target:j,score:w.originalScore??.5,type:"pinned",label:w.label})}let x=Array.from(p.values());if(x.length>l){const w=new Set(i.flatMap(S=>[`${S.sourceKey.filePath}:${S.sourceKey.chunkIndex}`,`${S.targetKey.filePath}:${S.targetKey.chunkIndex}`])),P=x.filter(S=>S.id===m||w.has(S.id)),j=Math.max(0,l-P.length),N=x.filter(S=>S.id!==m&&!w.has(S.id)).slice(0,j);x=P.concat(N)}const v=new Set(x.map(w=>w.id)),b=h.filter(w=>v.has(w.source)&&v.has(w.target));return{nodes:x,edges:b}},[e,t,r,i,l]),d=t!==null?`${e}:${t}`:null;return{graphData:c,currentNodeId:d}}function aE(e){return e.map(t=>({chunkIndex:t.chunkIndex,text:t.text,lowerText:t.text.toLowerCase()}))}function dg(e,t,r){if(!t||t.length===0)return[];const i=[],l=r?t:t.toLowerCase();for(const c of e){const d=r?c.text:c.lowerText;let p=0;for(;p<d.length;){const h=d.indexOf(l,p);if(h===-1)break;const m=Math.max(0,h-25),x=Math.min(c.text.length,h+t.length+25),v=c.text.slice(m,x);i.push({chunkIndex:c.chunkIndex,startOffset:h,endOffset:h+t.length,context:(m>0?"...":"")+v+(x<c.text.length?"...":"")}),p=h+1}}return i}const pg={query:"",matches:[],currentIndex:-1,caseSensitive:!1,isOpen:!1};function oE({chunks:e,onNavigateToChunk:t}){const[r,i]=y.useState(pg),l=y.useMemo(()=>aE(e),[e]),c=y.useCallback(()=>{i(j=>({...j,isOpen:!0}))},[]),d=y.useCallback(()=>{i(j=>({...j,isOpen:!1}))},[]),p=y.useCallback(()=>{i(pg)},[]),h=y.useCallback(j=>{const N=dg(l,j,r.caseSensitive);i(S=>({...S,query:j,matches:N,currentIndex:N.length>0?0:-1})),N.length>0&&t&&t(N[0].chunkIndex)},[l,r.caseSensitive,t]),m=y.useCallback(()=>{i(j=>{const N=!j.caseSensitive,S=dg(l,j.query,N);return{...j,caseSensitive:N,matches:S,currentIndex:S.length>0?0:-1}})},[l]),x=y.useCallback(()=>{i(j=>{if(j.matches.length===0)return j;const N=(j.currentIndex+1)%j.matches.length,S=j.matches[N];return S&&t&&t(S.chunkIndex),{...j,currentIndex:N}})},[t]),v=y.useCallback(()=>{i(j=>{if(j.matches.length===0)return j;const N=j.currentIndex<=0?j.matches.length-1:j.currentIndex-1,S=j.matches[N];return S&&t&&t(S.chunkIndex),{...j,currentIndex:N}})},[t]),b=y.useCallback(j=>{i(N=>{if(j<0||j>=N.matches.length)return N;const S=N.matches[j];return S&&t&&t(S.chunkIndex),{...N,currentIndex:j}})},[t]),w=y.useCallback(j=>r.matches.filter(N=>N.chunkIndex===j),[r.matches]),P=y.useMemo(()=>r.currentIndex>=0&&r.currentIndex<r.matches.length?r.matches[r.currentIndex]??null:null,[r.matches,r.currentIndex]);return{searchState:r,isSearchOpen:r.isOpen,openSearch:c,closeSearch:d,setQuery:h,toggleCaseSensitive:m,nextMatch:x,previousMatch:v,goToMatch:b,clearSearch:p,getMatchesForChunk:w,currentMatch:P,totalMatches:r.matches.length}}function fg(){return crypto.randomUUID()}const lE={version:1,vaultId:"",updatedAt:new Date().toISOString(),tags:[],taggedItems:[]},cE={red:{bg:"bg-red-100 dark:bg-red-900/40",text:"text-red-700 dark:text-red-300",border:"border-red-200 dark:border-red-800"},orange:{bg:"bg-orange-100 dark:bg-orange-900/40",text:"text-orange-700 dark:text-orange-300",border:"border-orange-200 dark:border-orange-800"},yellow:{bg:"bg-yellow-100 dark:bg-yellow-900/40",text:"text-yellow-700 dark:text-yellow-300",border:"border-yellow-200 dark:border-yellow-800"},green:{bg:"bg-green-100 dark:bg-green-900/40",text:"text-green-700 dark:text-green-300",border:"border-green-200 dark:border-green-800"},blue:{bg:"bg-blue-100 dark:bg-blue-900/40",text:"text-blue-700 dark:text-blue-300",border:"border-blue-200 dark:border-blue-800"},purple:{bg:"bg-purple-100 dark:bg-purple-900/40",text:"text-purple-700 dark:text-purple-300",border:"border-purple-200 dark:border-purple-800"},pink:{bg:"bg-pink-100 dark:bg-pink-900/40",text:"text-pink-700 dark:text-pink-300",border:"border-pink-200 dark:border-pink-800"},gray:{bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-700 dark:text-gray-300",border:"border-gray-200 dark:border-gray-600"}},xv=y.createContext(null);function uE({children:e,vaultId:t="default"}){const r=`rag-vault-tags-v1-${t}`,[i,l]=Nn(r,{...lE,vaultId:t}),c=y.useCallback((k,E)=>{const R={id:fg(),name:k.trim(),color:E,usageCount:0,lastUsedAt:new Date().toISOString(),createdAt:new Date().toISOString()};return l(M=>({...M,updatedAt:new Date().toISOString(),tags:[...M.tags,R]})),R},[l]),d=y.useCallback((k,E)=>{l(R=>({...R,updatedAt:new Date().toISOString(),tags:R.tags.map(M=>{if(M.id!==k)return M;const H={...E};return H.name!==void 0&&(H.name=H.name.trim()),{...M,...H}})}))},[l]),p=y.useCallback(k=>{l(E=>({...E,updatedAt:new Date().toISOString(),tags:E.tags.filter(R=>R.id!==k),taggedItems:E.taggedItems.filter(R=>R.tagId!==k)}))},[l]),h=y.useCallback(k=>i.tags.find(E=>E.id===k),[i.tags]),m=y.useCallback((k,E,R)=>{const M={id:fg(),tagId:k,targetType:E,targetKey:R,createdAt:new Date().toISOString()};return l(H=>({...H,updatedAt:new Date().toISOString(),taggedItems:[...H.taggedItems,M],tags:H.tags.map(B=>B.id===k?{...B,usageCount:B.usageCount+1,lastUsedAt:new Date().toISOString()}:B)})),M},[l]),x=y.useCallback(k=>{l(E=>({...E,updatedAt:new Date().toISOString(),taggedItems:E.taggedItems.filter(R=>R.id!==k)}))},[l]),v=y.useCallback((k,E,R)=>{l(M=>({...M,updatedAt:new Date().toISOString(),taggedItems:M.taggedItems.filter(H=>!(H.tagId===k&&H.targetType===E&&H.targetKey===R))}))},[l]),b=y.useCallback((k,E)=>{const R=i.taggedItems.filter(M=>M.targetType===k&&M.targetKey===E).map(M=>M.tagId);return i.tags.filter(M=>R.includes(M.id))},[i.tags,i.taggedItems]),w=y.useCallback(k=>i.taggedItems.filter(E=>E.tagId===k),[i.taggedItems]),P=y.useCallback((k,E,R)=>i.taggedItems.some(M=>M.tagId===k&&M.targetType===E&&M.targetKey===R),[i.taggedItems]),j=y.useCallback((k=10)=>[...i.tags].sort((E,R)=>R.usageCount!==E.usageCount?R.usageCount-E.usageCount:new Date(R.lastUsedAt).getTime()-new Date(E.lastUsedAt).getTime()).slice(0,k),[i.tags]),N=y.useCallback(()=>JSON.stringify(i,null,2),[i]),S=y.useCallback(k=>{const E=[];let R=0;try{const M=JSON.parse(k);if(M.version!==1)return E.push(`Unsupported version: ${M.version}`),{imported:R,errors:E};if(Array.isArray(M.tags))for(const H of M.tags)H.id&&H.name&&!i.tags.some(B=>B.id===H.id)&&(l(B=>({...B,updatedAt:new Date().toISOString(),tags:[...B.tags,H]})),R++);if(Array.isArray(M.taggedItems))for(const H of M.taggedItems)H.id&&H.tagId&&H.targetKey&&!i.taggedItems.some(B=>B.id===H.id)&&(l(B=>({...B,updatedAt:new Date().toISOString(),taggedItems:[...B.taggedItems,H]})),R++)}catch(M){E.push(`Invalid JSON: ${M.message}`)}return{imported:R,errors:E}},[i,l]),T=y.useMemo(()=>({tags:i.tags,createTag:c,updateTag:d,deleteTag:p,getTag:h,taggedItems:i.taggedItems,addTag:m,removeTag:x,removeTagFromTarget:v,getTagsForTarget:b,getTargetsForTag:w,isTagged:P,getTagSuggestions:j,exportTags:N,importTags:S}),[i.tags,i.taggedItems,c,d,p,h,m,x,v,b,w,P,j,N,S]);return o.jsx(xv.Provider,{value:T,children:e})}function yv(){const e=y.useContext(xv);if(!e)throw new Error("useTags must be used within a TagsProvider");return e}function dE(){return crypto.randomUUID()}const pE={version:1,vaultId:"",updatedAt:new Date().toISOString(),collections:[]},fE=["red","orange","yellow","green","blue","purple","pink","gray"],hg={red:{bg:"bg-red-100 dark:bg-red-900/40",text:"text-red-700 dark:text-red-300",border:"border-red-200 dark:border-red-800"},orange:{bg:"bg-orange-100 dark:bg-orange-900/40",text:"text-orange-700 dark:text-orange-300",border:"border-orange-200 dark:border-orange-800"},yellow:{bg:"bg-yellow-100 dark:bg-yellow-900/40",text:"text-yellow-700 dark:text-yellow-300",border:"border-yellow-200 dark:border-yellow-800"},green:{bg:"bg-green-100 dark:bg-green-900/40",text:"text-green-700 dark:text-green-300",border:"border-green-200 dark:border-green-800"},blue:{bg:"bg-blue-100 dark:bg-blue-900/40",text:"text-blue-700 dark:text-blue-300",border:"border-blue-200 dark:border-blue-800"},purple:{bg:"bg-purple-100 dark:bg-purple-900/40",text:"text-purple-700 dark:text-purple-300",border:"border-purple-200 dark:border-purple-800"},pink:{bg:"bg-pink-100 dark:bg-pink-900/40",text:"text-pink-700 dark:text-pink-300",border:"border-pink-200 dark:border-pink-800"},gray:{bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-700 dark:text-gray-300",border:"border-gray-200 dark:border-gray-600"}},vv=y.createContext(null);function hE({children:e,vaultId:t="default"}){const r=`rag-vault-collections-v1-${t}`,[i,l]=Nn(r,{...pE,vaultId:t}),c=y.useCallback((S,T,k)=>{const E={id:dE(),name:S.trim(),description:k==null?void 0:k.trim(),color:T,documents:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};return l(R=>({...R,updatedAt:new Date().toISOString(),collections:[...R.collections,E]})),E},[l]),d=y.useCallback((S,T)=>{l(k=>({...k,updatedAt:new Date().toISOString(),collections:k.collections.map(E=>E.id===S?{...E,...T,updatedAt:new Date().toISOString()}:E)}))},[l]),p=y.useCallback(S=>{l(T=>({...T,updatedAt:new Date().toISOString(),collections:T.collections.filter(k=>k.id!==S)}))},[l]),h=y.useCallback(S=>i.collections.find(T=>T.id===S),[i.collections]),m=y.useCallback((S,T)=>{l(k=>({...k,updatedAt:new Date().toISOString(),collections:k.collections.map(E=>E.id!==S||E.documents.includes(T)?E:{...E,documents:[...E.documents,T],updatedAt:new Date().toISOString()})}))},[l]),x=y.useCallback((S,T)=>{l(k=>({...k,updatedAt:new Date().toISOString(),collections:k.collections.map(E=>E.id!==S?E:{...E,documents:E.documents.filter(R=>R!==T),updatedAt:new Date().toISOString()})}))},[l]),v=y.useCallback(S=>i.collections.filter(T=>T.documents.includes(S)),[i.collections]),b=y.useCallback(S=>{const T=i.collections.find(k=>k.id===S);return(T==null?void 0:T.documents)??[]},[i.collections]),w=y.useCallback((S,T)=>{const k=i.collections.find(E=>E.id===S);return(k==null?void 0:k.documents.includes(T))??!1},[i.collections]),P=y.useCallback(()=>JSON.stringify(i,null,2),[i]),j=y.useCallback(S=>{const T=[];let k=0;try{const E=JSON.parse(S);if(E.version!==1)return T.push(`Unsupported version: ${E.version}`),{imported:k,errors:T};if(Array.isArray(E.collections))for(const R of E.collections)R.id&&R.name&&!i.collections.some(M=>M.id===R.id)&&(l(M=>({...M,updatedAt:new Date().toISOString(),collections:[...M.collections,R]})),k++)}catch(E){T.push(`Invalid JSON: ${E.message}`)}return{imported:k,errors:T}},[i,l]),N=y.useMemo(()=>({collections:i.collections,createCollection:c,updateCollection:d,deleteCollection:p,getCollection:h,addDocumentToCollection:m,removeDocumentFromCollection:x,getCollectionsForDocument:v,getDocumentsInCollection:b,isDocumentInCollection:w,exportCollections:P,importCollections:j}),[i.collections,c,d,p,h,m,x,v,b,w,P,j]);return o.jsx(vv.Provider,{value:N,children:e})}function Fp(){const e=y.useContext(vv);if(!e)throw new Error("useCollections must be used within a CollectionsProvider");return e}function mE(){const{collections:e,createCollection:t,updateCollection:r,deleteCollection:i,getCollection:l,getDocumentsInCollection:c}=Fp();return{collections:e,createCollection:t,updateCollection:r,deleteCollection:i,getCollection:l,getDocumentsInCollection:c}}const Fd={pan:{x:0,y:0},zoom:1},mg={version:1,vaultId:"",nodePositions:{},viewState:Fd},gE=y.createContext(null);function xE({children:e,vaultId:t="default"}){const r=`rag-vault-graph-state-v1-${t}`,[i,l]=Nn(r,{...mg,vaultId:t}),c=y.useCallback(N=>i.nodePositions[N],[i.nodePositions]),d=y.useCallback((N,S)=>{l(T=>({...T,nodePositions:{...T.nodePositions,[N]:{x:S.x,y:S.y,fixedAt:new Date().toISOString()}}}))},[l]),p=y.useCallback(()=>{l(N=>({...N,nodePositions:{}}))},[l]),h=y.useCallback(N=>{l(S=>({...S,viewState:{...S.viewState,pan:N}}))},[l]),m=y.useCallback(N=>{l(S=>({...S,viewState:{...S.viewState,zoom:N}}))},[l]),x=y.useCallback(N=>{l(S=>({...S,viewState:N}))},[l]),v=y.useCallback(()=>{l(N=>({...N,viewState:Fd}))},[l]),b=y.useCallback(()=>{l(N=>({...mg,vaultId:N.vaultId}))},[l]),w=y.useCallback(()=>JSON.stringify(i,null,2),[i]),P=y.useCallback(N=>{try{const S=JSON.parse(N);return S.version!==1?{success:!1,error:`Unsupported version: ${S.version}`}:(l(T=>({...T,nodePositions:S.nodePositions||{},viewState:S.viewState||Fd})),{success:!0})}catch(S){return{success:!1,error:`Invalid JSON: ${S.message}`}}},[l]),j=y.useMemo(()=>({nodePositions:i.nodePositions,getNodePosition:c,setNodePosition:d,clearNodePositions:p,viewState:i.viewState,setPan:h,setZoom:m,setViewState:x,resetViewState:v,resetAll:b,exportGraphState:w,importGraphState:P}),[i.nodePositions,i.viewState,c,d,p,h,m,x,v,b,w,P]);return o.jsx(gE.Provider,{value:j,children:e})}const yE={version:1,vaultId:"",documents:{}},vE=y.createContext(null);function bE({children:e,vaultId:t="default"}){const r=`rag-vault-reading-stats-v1-${t}`,[i,l]=Nn(r,{...yE,vaultId:t}),c=y.useCallback(T=>i.documents[T],[i.documents]),d=y.useCallback((T,k)=>{const E=i.documents[T];if(E)return E.chunkStats[k]},[i.documents]),p=y.useCallback((T,k)=>{const E=i.documents[T];return E?E.totalChunks!==k?{...E,totalChunks:k}:E:{filePath:T,totalChunks:k,chunksRead:0,totalTimeMs:0,sessions:[],chunkStats:{}}},[i.documents]),h=y.useCallback((T,k,E)=>{l(R=>{const M=p(T,E),H=M.chunkStats[k]||{totalTimeMs:0,readCount:0,lastReadAt:""},B=H.readCount===0,te={...H,readCount:H.readCount+1,lastReadAt:new Date().toISOString()},X={...M,chunksRead:B?M.chunksRead+1:M.chunksRead,chunkStats:{...M.chunkStats,[k]:te}};return{...R,documents:{...R.documents,[T]:X}}})},[l,p]),m=y.useCallback((T,k,E)=>{E<=0||l(R=>{const M=R.documents[T];if(!M)return R;const H=M.chunkStats[k]||{totalTimeMs:0,readCount:0,lastReadAt:new Date().toISOString()},B={...H,totalTimeMs:H.totalTimeMs+E},te=!M.chunkStats[k],X={...M,totalTimeMs:M.totalTimeMs+E,chunksRead:te?M.chunksRead+1:M.chunksRead,chunkStats:{...M.chunkStats,[k]:B}};return{...R,documents:{...R.documents,[T]:X}}})},[l]),x=y.useCallback(T=>{l(k=>{const E=k.documents[T];if(!E)return k;const R=E.sessions[E.sessions.length-1];if(R&&!R.endedAt)return k;const M={startedAt:new Date().toISOString(),endedAt:"",durationMs:0},H=[...E.sessions,M].slice(-10);return{...k,documents:{...k.documents,[T]:{...E,sessions:H}}}})},[l]),v=y.useCallback(T=>{l(k=>{const E=k.documents[T];if(!E)return k;const R=[...E.sessions],M=R[R.length-1];if(!M||M.endedAt)return k;const H=new Date().toISOString(),B=new Date(H).getTime()-new Date(M.startedAt).getTime();return R[R.length-1]={...M,endedAt:H,durationMs:B},{...k,documents:{...k.documents,[T]:{...E,sessions:R}}}})},[l]),b=y.useCallback(T=>{const k=i.documents[T];return!k||k.totalChunks===0?0:Math.round(k.chunksRead/k.totalChunks*100)},[i.documents]),w=y.useCallback(T=>{const k=i.documents[T];return(k==null?void 0:k.totalTimeMs)??0},[i.documents]),P=y.useCallback(T=>{const k=i.documents[T];return!k||k.chunksRead===0?0:Math.round(k.totalTimeMs/k.chunksRead)},[i.documents]),j=y.useCallback(()=>JSON.stringify(i,null,2),[i]),N=y.useCallback(T=>{l(T?k=>{const{[T]:E,...R}=k.documents;return{...k,documents:R}}:k=>({...k,documents:{}}))},[l]),S=y.useMemo(()=>({getDocumentStats:c,getChunkStats:d,recordChunkView:h,recordTimeSpent:m,startSession:x,endSession:v,getCompletionPercent:b,getTotalReadingTime:w,getAverageTimePerChunk:P,exportStats:j,clearStats:N}),[c,d,h,m,x,v,b,w,P,j,N]);return o.jsx(vE.Provider,{value:S,children:e})}const kE=10,wE=400,jE=5,SE=300*1e3,fi=new Map;function bv(e){return e.trim().toLowerCase().slice(0,100)}function CE(e){const t=bv(e),r=fi.get(t);return r&&Date.now()-r.timestamp<SE?r.results:(r&&fi.delete(t),null)}function NE(e,t){const r=bv(e);if(fi.size>=50){const i=fi.keys().next().value;i&&fi.delete(i)}fi.set(r,{results:t,timestamp:Date.now()})}function EE({selectionText:e,filePath:t,chunkIndex:r,enabled:i=!0}){const[l,c]=y.useState([]),[d,p]=y.useState(!1),[h,m]=y.useState(null),x=y.useRef(null),v=y.useRef(null),b=y.useRef(null),w=y.useCallback(()=>{c([]),m(null),p(!1),b.current=null,v.current&&(clearTimeout(v.current),v.current=null),x.current&&(x.current.abort(),x.current=null)},[]);return y.useEffect(()=>{if(!i){w();return}if(!e){w();return}if(e.length<kE){w();return}if(e===b.current)return;v.current&&clearTimeout(v.current),x.current&&x.current.abort();const P=CE(e);if(P){const j=P.filter(N=>!(N.filePath===t&&N.chunkIndex===r));c(j),m(e),b.current=e;return}return v.current=setTimeout(async()=>{p(!0),x.current=new AbortController;try{const j=await uv(e,jE),N=j.filter(S=>!(S.filePath===t&&S.chunkIndex===r));NE(e,j),c(N),m(e),b.current=e}catch(j){j instanceof Error&&j.name!=="AbortError"&&console.error("Auto-selection search failed:",j)}finally{p(!1)}},wE),()=>{v.current&&clearTimeout(v.current)}},[e,t,r,i,w]),y.useEffect(()=>()=>{v.current&&clearTimeout(v.current),x.current&&x.current.abort()},[]),{results:l,isSearching:d,searchedText:h,clearResults:w}}const PE=[{value:"light",label:"Light",icon:RE},{value:"dark",label:"Dark",icon:DE},{value:"system",label:"System",icon:LE}];function TE(){const{preferences:e,setTheme:t}=Fl();return o.jsx("div",{className:"flex items-center gap-1 p-1 bg-gray-100 dark:bg-gray-800 rounded-lg",children:PE.map(({value:r,label:i,icon:l})=>o.jsxs("button",{type:"button",onClick:()=>t(r),className:`
|
|
61
|
+
flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-md transition-all
|
|
62
|
+
${e.theme===r?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}
|
|
63
|
+
`,title:`${i} theme`,children:[o.jsx(l,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:i})]},r))})}function RE({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})})}function DE({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})}function LE({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}function IE(){const{config:e}=lv();return o.jsx("header",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-6 py-4 transition-colors",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h1",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"MCP Local RAG"}),o.jsxs("div",{className:"flex items-center gap-4",children:[e&&o.jsxs(np,{to:"/settings",className:"flex items-center gap-2 px-3 py-1.5 text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors",title:e.dbPath,children:[o.jsx(AE,{className:"w-4 h-4 text-green-500 dark:text-green-400"}),o.jsx("span",{className:"font-medium",children:e.name}),o.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"|"}),o.jsxs("span",{children:[e.documentCount," docs"]})]}),o.jsx(TE,{})]})]})})}function AE({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"})})}const ME=[{to:"/",label:"Search",icon:FE},{to:"/upload",label:"Upload",icon:_E},{to:"/files",label:"Files",icon:zE},{to:"/status",label:"Status",icon:VE},{to:"/settings",label:"Settings",icon:BE}];function OE(){return o.jsx("aside",{className:"w-56 bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 p-4 transition-colors",children:o.jsx("nav",{className:"space-y-1",children:ME.map(e=>o.jsxs(Px,{to:e.to,className:({isActive:t})=>`flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${t?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:[o.jsx(e.icon,{className:"w-5 h-5"}),e.label]},e.to))})})}function FE({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function _E({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})}function zE({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})})}function VE({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}function BE({className:e}){return o.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function $E({children:e}){return o.jsxs("div",{className:"min-h-screen flex flex-col bg-gray-50 dark:bg-gray-900 transition-colors",children:[o.jsx(IE,{}),o.jsxs("div",{className:"flex flex-1",children:[o.jsx(OE,{}),o.jsx("main",{className:"flex-1 p-6 overflow-auto",children:e})]})]})}const gg={fontSize:"base",lineHeight:"normal",fontFamily:"sans",showChunkNumbers:!0,showHeatmap:!1},UE={sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem"},WE={tight:"1.4",normal:"1.6",relaxed:"1.8"},HE={sans:'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',serif:'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',mono:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace'},kv=y.createContext(null);function KE({children:e,vaultId:t="default"}){const r=`rag-vault-reader-settings-${t}`,[i,l]=Nn(r,gg),c=y.useCallback(w=>{l(P=>({...P,fontSize:w}))},[l]),d=y.useCallback(w=>{l(P=>({...P,lineHeight:w}))},[l]),p=y.useCallback(w=>{l(P=>({...P,fontFamily:w}))},[l]),h=y.useCallback(w=>{l(P=>({...P,showChunkNumbers:w}))},[l]),m=y.useCallback(w=>{l(P=>({...P,showHeatmap:w}))},[l]),x=y.useCallback(()=>{l(gg)},[l]),v=y.useMemo(()=>({"--reader-font-size":UE[i.fontSize],"--reader-line-height":WE[i.lineHeight],"--reader-font-family":HE[i.fontFamily]}),[i.fontSize,i.lineHeight,i.fontFamily]),b=y.useMemo(()=>({settings:i,setFontSize:c,setLineHeight:d,setFontFamily:p,setShowChunkNumbers:h,setShowHeatmap:m,resetSettings:x,cssVariables:v}),[i,c,d,p,h,m,x,v]);return o.jsx(kv.Provider,{value:b,children:e})}function wv(){const e=y.useContext(kv);if(!e)throw new Error("useReaderSettings must be used within a ReaderSettingsProvider");return e}function qE(){const e=Ii(),{collections:t,createCollection:r,updateCollection:i,deleteCollection:l,getDocumentsInCollection:c}=mE(),[d,p]=y.useState(!1),[h,m]=y.useState(null),[x,v]=y.useState(""),[b,w]=y.useState(""),[P,j]=y.useState("blue"),N=()=>{p(!0),m(null),v(""),w(""),j("blue")},S=R=>{p(!1),m(R.id),v(R.name),w(R.description||""),j(R.color)},T=()=>{x.trim()&&(d?r(x.trim(),P,b.trim()||void 0):h&&i(h,{name:x.trim(),color:P,description:b.trim()||void 0}),p(!1),m(null),v(""),w(""))},k=()=>{p(!1),m(null),v(""),w("")},E=R=>{e(`/files?collection=${R}`)};return o.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:"Collections"}),o.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Organize your documents into collections."})]}),!d&&!h&&o.jsxs("button",{type:"button",onClick:N,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[o.jsx(xg,{className:"w-4 h-4"}),"New Collection"]})]}),o.jsx(ut,{children:(d||h)&&o.jsxs(Pe.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4 space-y-4",children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:d?"Create Collection":"Edit Collection"}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx("div",{children:o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Name",o.jsx("input",{type:"text",value:x,onChange:R=>v(R.target.value),placeholder:"Collection name",className:"mt-1 w-full px-3 py-2 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),o.jsxs("div",{children:[o.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Color"}),o.jsx("div",{className:"flex flex-wrap gap-2",children:fE.map(R=>o.jsx("button",{type:"button",onClick:()=>j(R),className:`w-8 h-8 rounded-full ${hg[R].bg} ${P===R?"ring-2 ring-offset-2 ring-blue-500 dark:ring-offset-gray-800":""}`},R))})]})]}),o.jsx("div",{children:o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Description (optional)",o.jsx("input",{type:"text",value:b,onChange:R=>w(R.target.value),placeholder:"What's this collection for?",className:"mt-1 w-full px-3 py-2 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),o.jsxs("div",{className:"flex gap-2 justify-end",children:[o.jsx("button",{type:"button",onClick:k,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),o.jsx("button",{type:"button",onClick:T,disabled:!x.trim(),className:"px-4 py-2 text-sm text-white bg-blue-600 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:d?"Create":"Save"})]})]})}),t.length===0?o.jsxs("div",{className:"text-center py-12 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[o.jsx(GE,{className:"w-12 h-12 mx-auto text-gray-400 dark:text-gray-500 mb-3"}),o.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-1",children:"No collections yet"}),o.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:"Create a collection to organize your documents."}),o.jsxs("button",{type:"button",onClick:N,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[o.jsx(xg,{className:"w-4 h-4"}),"Create your first collection"]})]}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:o.jsx(ut,{children:t.map(R=>{const M=c(R.id),H=hg[R.color];return o.jsxs(Pe.div,{layout:!0,initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:`bg-white dark:bg-gray-800 rounded-lg border ${H.border} p-4`,children:[o.jsxs("div",{className:"flex items-start justify-between mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`w-4 h-4 rounded-full ${H.bg}`}),o.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:R.name})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:()=>S(R),className:"p-1.5 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",title:"Edit",children:o.jsx(YE,{className:"w-4 h-4"})}),o.jsx(QE,{onDelete:()=>l(R.id)})]})]}),R.description&&o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:R.description}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[M.length," document",M.length!==1?"s":""]}),o.jsx("button",{type:"button",onClick:()=>E(R.id),className:"text-sm text-blue-600 dark:text-blue-400 hover:underline",children:"View documents →"})]})]},R.id)})})})]})}function QE({onDelete:e}){const[t,r]=y.useState(!1);return t?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:e,className:"px-2 py-1 text-xs font-medium text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/30 rounded hover:bg-red-100 dark:hover:bg-red-900/50 transition-colors",children:"Delete"}),o.jsx("button",{type:"button",onClick:()=>r(!1),className:"px-2 py-1 text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded transition-colors",children:"Cancel"})]}):o.jsx("button",{type:"button",onClick:()=>r(!0),className:"p-1.5 text-gray-400 hover:text-red-500 dark:hover:text-red-400 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",title:"Delete",children:o.jsx(XE,{className:"w-4 h-4"})})}function xg({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function GE({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})})}function YE({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}function XE({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function JE({file:e,onDelete:t,isDeleting:r}){const[i,l]=y.useState(!1),c=Ii(),d=e.source||e.filePath.split(/[/\\]/).pop()||e.filePath,p=e.filePath.includes("raw-data"),h=()=>{e.source?t({source:e.source}):t({filePath:e.filePath}),l(!1)},m=()=>{const x=new URLSearchParams({path:e.filePath});c(`/read?${x.toString()}`)};return o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",title:e.source||e.filePath,children:d}),o.jsxs("div",{className:"flex items-center gap-4 mt-1 text-sm text-gray-500 dark:text-gray-400",children:[o.jsxs("span",{children:[e.chunkCount," chunks"]}),p&&o.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"Ingested content"})]}),e.source&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate mt-1",title:e.filePath,children:e.filePath})]}),o.jsx("div",{className:"flex items-center gap-2",children:i?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:h,disabled:r,className:"px-3 py-1.5 text-sm bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50 transition-colors",children:"Confirm"}),o.jsx("button",{type:"button",onClick:()=>l(!1),disabled:r,className:"px-3 py-1.5 text-sm text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:"Cancel"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:m,className:"px-3 py-1.5 text-sm text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/30 rounded-lg transition-colors",children:"Read"}),o.jsx("button",{type:"button",onClick:()=>l(!0),className:"px-3 py-1.5 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30 rounded-lg transition-colors",children:"Delete"})]})})]})}function ZE({files:e,onDelete:t,isDeleting:r}){return e.length===0?o.jsxs("div",{className:"text-center py-12 text-gray-500",children:[o.jsx("p",{children:"No files ingested yet."}),o.jsx("p",{className:"text-sm mt-1",children:"Upload a file or paste content to get started."})]}):o.jsx("div",{className:"space-y-2",children:e.map(i=>o.jsx(JE,{file:i,onDelete:t,isDeleting:r},i.filePath))})}function eP(){const[e,t]=Rx(),{files:r,isLoading:i,error:l,deleteFile:c,isDeleting:d}=DN(),{collections:p}=Fp(),{tags:h,getTagsForTarget:m}=yv(),x=e.get("collection")||"",v=e.get("tag")||"",b=p.find(k=>k.id===x),w=h.find(k=>k.id===v),P=y.useMemo(()=>{let k=r;if(x&&b){const E=new Set(b.documents);k=k.filter(R=>E.has(R.filePath))}return v&&(k=k.filter(E=>m("document",E.filePath).some(M=>M.id===v))),k},[r,x,b,v,m]),j=k=>{const E=new URLSearchParams(e);k?E.set("collection",k):E.delete("collection"),t(E)},N=k=>{const E=new URLSearchParams(e);k?E.set("tag",k):E.delete("tag"),t(E)},S=()=>{t({})},T=x||v;return o.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:"Ingested Files"}),o.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Manage your knowledge base content."})]}),r.length>0&&o.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:P.length===r.length?`${r.length} file${r.length!==1?"s":""}`:`${P.length} of ${r.length} files`})]}),(p.length>0||h.length>0)&&o.jsxs("div",{className:"flex flex-wrap items-center gap-3 p-3 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[o.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Filter by:"}),p.length>0&&o.jsxs("select",{value:x,onChange:k=>j(k.target.value),className:"text-sm px-3 py-1.5 bg-white dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[o.jsx("option",{value:"",children:"All collections"}),p.map(k=>o.jsxs("option",{value:k.id,children:[k.name," (",k.documents.length,")"]},k.id))]}),h.length>0&&o.jsxs("select",{value:v,onChange:k=>N(k.target.value),className:"text-sm px-3 py-1.5 bg-white dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[o.jsx("option",{value:"",children:"All tags"}),h.map(k=>o.jsx("option",{value:k.id,children:k.name},k.id))]}),T&&o.jsx("button",{type:"button",onClick:S,className:"text-sm text-blue-600 dark:text-blue-400 hover:underline",children:"Clear filters"})]}),T&&o.jsxs("div",{className:"flex flex-wrap gap-2",children:[b&&o.jsx(yg,{label:b.name,type:"collection",onRemove:()=>j("")}),w&&o.jsx(yg,{label:w.name,type:"tag",color:w.color,onRemove:()=>N("")})]}),i?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(Ve,{className:"text-gray-400"}),o.jsx("span",{className:"ml-3 text-gray-500 dark:text-gray-400",children:"Loading files..."})]}):l?o.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-700 dark:text-red-400",children:[o.jsx("p",{className:"font-medium",children:"Error loading files"}),o.jsx("p",{className:"text-sm",children:l.message})]}):P.length===0?o.jsxs("div",{className:"text-center py-12 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[o.jsx(tP,{className:"w-10 h-10 mx-auto text-gray-400 dark:text-gray-500 mb-3"}),o.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:T?"No files match the selected filters.":"No files ingested yet."}),T&&o.jsx("button",{type:"button",onClick:S,className:"mt-2 text-sm text-blue-600 dark:text-blue-400 hover:underline",children:"Clear filters"})]}):o.jsx(ZE,{files:P,onDelete:c,isDeleting:d})]})}function yg({label:e,type:t,color:r,onRemove:i}){var c;const l=t==="tag"&&r?(c=cE[r])==null?void 0:c.bg:"bg-gray-100 dark:bg-gray-700";return o.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-1 text-sm rounded-full ${l}`,children:[t==="collection"?o.jsx(nP,{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400"}):o.jsx(rP,{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400"}),o.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:e}),o.jsx("button",{type:"button",onClick:i,className:"p-0.5 rounded-full hover:bg-black/10 dark:hover:bg-white/10",children:o.jsx(sP,{className:"w-3 h-3 text-gray-500 dark:text-gray-400"})})]})}function tP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})})}function nP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})})}function rP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"})})}function sP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}const vg=[{color:"yellow",bg:"bg-yellow-300",ring:"ring-yellow-400",label:"Yellow"},{color:"green",bg:"bg-green-300",ring:"ring-green-400",label:"Green"},{color:"blue",bg:"bg-blue-300",ring:"ring-blue-400",label:"Blue"},{color:"pink",bg:"bg-pink-300",ring:"ring-pink-400",label:"Pink"},{color:"purple",bg:"bg-purple-300",ring:"ring-purple-400",label:"Purple"}];function iP({highlight:e,annotation:t,onUpdateNote:r,onDeleteNote:i,onDeleteHighlight:l,onChangeColor:c}){const[d,p]=y.useState(!1),[h,m]=y.useState((t==null?void 0:t.note)||""),[x,v]=y.useState(!1),b=y.useCallback(()=>{h.trim()&&r(h.trim()),p(!1)},[h,r]),w=y.useCallback(j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),b()),j.key==="Escape"&&(p(!1),m((t==null?void 0:t.note)||""))},[b,t==null?void 0:t.note]),P=vg.find(j=>j.color===e.color);return o.jsxs(Pe.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm overflow-hidden",children:[o.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-900/50 border-b border-gray-200 dark:border-gray-700",children:o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic line-clamp-2",children:['"',e.text.length>60?`${e.text.slice(0,60)}...`:e.text,'"']})}),o.jsx("div",{className:"p-3",children:d?o.jsxs("div",{children:[o.jsx("textarea",{value:h,onChange:j=>m(j.target.value),onKeyDown:w,onBlur:b,placeholder:"Add a note...",className:"w-full px-2 py-1.5 text-sm bg-gray-100 dark:bg-gray-700 rounded border-0 resize-none focus:ring-2 focus:ring-blue-500",rows:3}),o.jsxs("div",{className:"flex justify-end gap-2 mt-2",children:[o.jsx("button",{type:"button",onClick:()=>{p(!1),m((t==null?void 0:t.note)||"")},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200",children:"Cancel"}),o.jsx("button",{type:"button",onClick:b,className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700",children:"Save"})]})]}):o.jsx("div",{children:t!=null&&t.note?o.jsx("button",{type:"button",className:"text-left text-sm text-gray-700 dark:text-gray-300 cursor-pointer hover:text-gray-900 dark:hover:text-gray-100",onClick:()=>p(!0),children:t.note}):o.jsx("button",{type:"button",onClick:()=>p(!0),className:"text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 italic",children:"+ Add note..."})})}),o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-t border-gray-100 dark:border-gray-700/50",children:[o.jsxs("div",{className:"relative",children:[o.jsx("button",{type:"button",onClick:()=>v(!x),className:`w-5 h-5 rounded-full ${P==null?void 0:P.bg} ring-1 ring-gray-300 dark:ring-gray-600`,title:"Change color"}),x&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>v(!1),onKeyDown:j=>j.key==="Escape"&&v(!1),role:"button",tabIndex:0,"aria-label":"Close color picker"}),o.jsx("div",{className:"absolute bottom-full left-0 mb-2 z-20 flex gap-1 p-1.5 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700",children:vg.map(({color:j,bg:N,ring:S})=>o.jsx("button",{type:"button",onClick:()=>{c(j),v(!1)},className:`w-5 h-5 rounded-full ${N} hover:ring-2 ${S} transition-all ${j===e.color?"ring-2":""}`,title:j},j))})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[t&&o.jsx("button",{type:"button",onClick:i,className:"text-xs text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400",title:"Delete note",children:"Remove note"}),o.jsx("button",{type:"button",onClick:l,className:"p-1 text-gray-400 hover:text-red-600 dark:hover:text-red-400",title:"Delete highlight",children:o.jsx(aP,{className:"w-4 h-4"})})]})]})]})}function aP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function oP({items:e,onNavigate:t,onSaveTrail:r,canSaveTrail:i}){return e.length===0?null:o.jsxs("nav",{className:"flex items-center gap-1 px-4 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 overflow-x-auto","aria-label":"Breadcrumb",children:[o.jsxs("ol",{className:"flex items-center gap-1",children:[o.jsx("li",{children:o.jsx("button",{type:"button",onClick:()=>t({filePath:"",label:"Search",chunkIndex:void 0}),className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors",children:o.jsx(lP,{})})}),e.map((l,c)=>o.jsxs(Pe.li,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"flex items-center",children:[o.jsx("span",{className:"mx-1 text-gray-400 dark:text-gray-500",children:"/"}),l.connectionReason&&o.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500 italic mr-1",children:['via "',l.connectionReason,'"']}),o.jsxs("button",{type:"button",onClick:()=>t(l),disabled:c===e.length-1,className:`
|
|
64
|
+
text-sm truncate max-w-[150px] px-2 py-0.5 rounded
|
|
65
|
+
${c===e.length-1?"text-gray-900 dark:text-gray-100 font-medium bg-gray-100 dark:bg-gray-700":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:bg-gray-100 dark:hover:bg-gray-700"}
|
|
66
|
+
transition-colors
|
|
67
|
+
`,title:`${l.label}${l.chunkIndex!==void 0?` #${l.chunkIndex}`:""}`,children:[l.label,l.chunkIndex!==void 0&&o.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["#",l.chunkIndex]})]})]},`${l.filePath}-${l.chunkIndex??"doc"}`))]}),r&&i&&e.length>1&&o.jsx(Pe.button,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},type:"button",onClick:r,className:"ml-auto px-2 py-1 text-xs font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors whitespace-nowrap",children:"Save Trail"})]})}function lP(){return o.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})})}const cP=[{color:"yellow",bg:"bg-yellow-300",ring:"ring-yellow-400"},{color:"green",bg:"bg-green-300",ring:"ring-green-400"},{color:"blue",bg:"bg-blue-300",ring:"ring-blue-400"},{color:"pink",bg:"bg-pink-300",ring:"ring-pink-400"},{color:"purple",bg:"bg-purple-300",ring:"ring-purple-400"}],uP=[{action:"related",icon:"🔍",label:"Related",title:"Find related content in vault"},{action:"support",icon:"✓",label:"Support",title:"Find supporting evidence"},{action:"contradict",icon:"✗",label:"Contradict",title:"Find contradicting content"},{action:"compare",icon:"⚖️",label:"Compare",title:"Compare with other chunks"},{action:"pin",icon:"📌",label:"Pin",title:"Pin selection as note"}];function dP({rect:e,onSelectColor:t,onClose:r,onSelectionAction:i,isActionLoading:l=!1,showMarginIndicator:c=!0}){const d=!!i,p=c&&!d,h=d?220:160,m=d?80:p?70:44,x=8,v=e.left+e.width/2-h/2,b=e.top-m-x+window.scrollY,w=Math.max(8,Math.min(v,window.innerWidth-h-8)),P=b<8?e.bottom+x+window.scrollY:b;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-50",onClick:r,onKeyDown:j=>j.key==="Escape"&&r(),role:"button",tabIndex:0,"aria-label":"Close popover"}),o.jsxs(Pe.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.1},className:"fixed z-50 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 p-2",style:{left:w,top:P,minWidth:h},children:[o.jsx("div",{className:"flex items-center justify-center gap-1 mb-1.5",children:cP.map(({color:j,bg:N,ring:S})=>o.jsx("button",{type:"button",onClick:()=>t(j),className:`w-7 h-7 rounded-full ${N} hover:ring-2 ${S} transition-all`,title:`Highlight ${j}`},j))}),p&&o.jsx("div",{className:"flex items-center justify-center gap-1.5 pt-1.5 border-t border-gray-200 dark:border-gray-700",children:o.jsxs("span",{className:"text-xs text-violet-600 dark:text-violet-400 flex items-center gap-1",children:[o.jsx(pP,{className:"w-3 h-3"}),"See margin",o.jsx(fP,{className:"w-3 h-3"})]})}),d&&o.jsx("div",{className:"flex items-center justify-center gap-1 pt-1.5 border-t border-gray-200 dark:border-gray-700",children:uP.map(({action:j,icon:N,title:S})=>o.jsx("button",{type:"button",onClick:()=>i(j),disabled:l,className:`
|
|
68
|
+
flex items-center justify-center w-8 h-8 rounded-md text-sm
|
|
69
|
+
transition-all
|
|
70
|
+
${l?"opacity-50 cursor-not-allowed":"hover:bg-gray-100 dark:hover:bg-gray-700"}
|
|
71
|
+
`,title:S,children:N},j))})]})]})}function pP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})})}function fP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}const hP={yellow:"bg-yellow-200 dark:bg-yellow-800/60",green:"bg-green-200 dark:bg-green-800/60",blue:"bg-blue-200 dark:bg-blue-800/60",pink:"bg-pink-200 dark:bg-pink-800/60",purple:"bg-purple-200 dark:bg-purple-800/60"},mP={yellow:"hover:bg-yellow-300 dark:hover:bg-yellow-700/60",green:"hover:bg-green-300 dark:hover:bg-green-700/60",blue:"hover:bg-blue-300 dark:hover:bg-blue-700/60",pink:"hover:bg-pink-300 dark:hover:bg-pink-700/60",purple:"hover:bg-purple-300 dark:hover:bg-purple-700/60"};function gP(e,t,r){const i=new Set;i.add(0),i.add(e.length);const l=[...t,...r];for(const p of l)p.startOffset>=0&&p.startOffset<=e.length&&i.add(p.startOffset),p.endOffset>=0&&p.endOffset<=e.length&&i.add(p.endOffset);const c=Array.from(i).sort((p,h)=>p-h),d=[];for(let p=0;p<c.length-1;p++){const h=c[p],m=c[p+1];if(h>=m)continue;const x=l.filter(v=>v.startOffset<=h&&v.endOffset>=m);d.push({text:e.slice(h,m),types:x})}return d}function xP(e){return e.map(t=>({startOffset:t.range.startOffset,endOffset:t.range.endOffset,type:"annotation",highlightId:t.id,color:t.color}))}function yP(e,t,r){let i=0;const l=[];let c=0;for(const d of e)d.chunkIndex<t&&c++;for(const d of e){if(d.chunkIndex!==t)continue;const p=c+i;l.push({startOffset:d.startOffset,endOffset:d.endOffset,type:p===r?"search-current":"search-match"}),i++}return l}function vP({text:e,highlights:t,searchMatches:r=[],currentSearchIndex:i=-1,chunkIndex:l,onHighlightClick:c}){const d=y.useMemo(()=>xP(t),[t]),p=y.useMemo(()=>yP(r,l,i),[r,l,i]),h=y.useMemo(()=>gP(e,d,p),[e,d,p]),m=y.useMemo(()=>{const x=new Map;for(const v of t)x.set(v.id,v);return x},[t]);return o.jsx("span",{className:"whitespace-pre-wrap",children:h.map((x,v)=>{const b=x.types.find(N=>N.type==="annotation"),w=x.types.find(N=>N.type==="search-current"),P=x.types.find(N=>N.type==="search-match"),j=["rounded","transition-colors"];if(b!=null&&b.color&&(j.push(hP[b.color]),j.push(mP[b.color]),j.push("cursor-pointer","px-0.5")),w&&(j.push("ring-2","ring-orange-500","dark:ring-orange-400","ring-offset-1","ring-offset-white","dark:ring-offset-gray-900"),b||j.push("bg-orange-100","dark:bg-orange-900/30")),P&&!w&&j.push("underline","decoration-dotted","decoration-orange-500","dark:decoration-orange-400","underline-offset-2"),b!=null&&b.highlightId){const N=m.get(b.highlightId);return o.jsx("span",{className:j.join(" "),onClick:S=>{S.stopPropagation(),N&&c&&c(N)},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),N&&c&&c(N))},role:"button",tabIndex:0,"data-highlight-id":b.highlightId,children:x.text},`highlight-${b.highlightId}-${v}`)}return w||P?o.jsx("span",{className:j.join(" "),"data-search-match":"true",children:x.text},`search-${v}-${x.text.length}`):o.jsx("span",{children:x.text},`text-${v}-${x.text.length}`)})})}function bP({chunk:e,isActive:t,onRegister:r,onClick:i,showChunkNumbers:l=!0,highlights:c=[],onCreateHighlight:d,onHighlightClick:p,searchMatches:h=[],currentSearchIndex:m=-1,isBookmarked:x=!1,onSelectionAction:v,isSelectionActionLoading:b=!1}){const w=y.useRef(null),P=y.useRef(null),j=y.useRef(null),N=i?P:w,{selection:S,clearSelection:T}=sE({containerRef:j,chunkText:e.text,enabled:!!d}),k=y.useCallback(B=>{S&&d&&(d({startOffset:S.startOffset,endOffset:S.endOffset},S.text,S.contextBefore,S.contextAfter,B),T())},[S,d,T]),E=y.useCallback(B=>{S&&v&&(v(B,{text:S.text,startOffset:S.startOffset,endOffset:S.endOffset,contextBefore:S.contextBefore,contextAfter:S.contextAfter}),B==="pin"&&T())},[S,v,T]);y.useEffect(()=>(r(e.chunkIndex,N.current),()=>{r(e.chunkIndex,null)}),[e.chunkIndex,r,N]);const R=o.jsx("div",{ref:j,children:c.length>0||h.length>0?o.jsx(vP,{text:e.text,highlights:c,searchMatches:h,currentSearchIndex:m,chunkIndex:e.chunkIndex,onHighlightClick:p}):o.jsx("span",{className:"whitespace-pre-wrap",children:e.text})}),M=o.jsxs(o.Fragment,{children:[l&&o.jsxs("div",{className:"absolute -left-1 top-5 flex items-center gap-1.5",children:[o.jsxs("span",{className:"book-chunk-badge",children:["§",e.chunkIndex]}),x&&o.jsx(kP,{className:"w-3.5 h-3.5 text-amber-600 dark:text-amber-500"})]}),o.jsx("div",{className:"pl-8 pr-4 max-w-none book-text",style:{fontSize:"var(--reader-font-size, 1.05rem)",lineHeight:"var(--reader-line-height, 1.85)",fontFamily:"var(--reader-font-family, 'Georgia', 'Palatino Linotype', serif)"},children:R}),t&&o.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-0.5 bg-amber-500/60 dark:bg-amber-600/50"}),o.jsx(ut,{children:S&&d&&o.jsx(dP,{rect:S.rect,onSelectColor:k,onClose:T,onSelectionAction:v?E:void 0,isActionLoading:b})})]}),H=`
|
|
72
|
+
book-page group relative py-6 px-8 mb-4 transition-all duration-200 text-left w-full
|
|
73
|
+
${t?"book-chunk-active":""}
|
|
74
|
+
`;return i?o.jsx("button",{ref:P,id:`chunk-${e.chunkIndex}`,type:"button",className:H,onClick:i,children:M}):o.jsx("div",{ref:w,id:`chunk-${e.chunkIndex}`,className:H,children:M})}function kP({className:e}){return o.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M5 4a2 2 0 012-2h6a2 2 0 012 2v14l-5-2.5L5 18V4z"})})}function jv({chunks:e,activeChunkIndex:t,onRegisterChunk:r,onChunkClick:i,scrollToChunk:l,showChunkNumbers:c=!0,getHighlightsForChunk:d,onCreateHighlight:p,onHighlightClick:h,getSearchMatchesForChunk:m,currentSearchIndex:x=-1,isChunkBookmarked:v}){return y.useEffect(()=>{if(l!=null){const b=document.getElementById(`chunk-${l}`);b&&requestAnimationFrame(()=>{b.scrollIntoView({behavior:"smooth",block:"center"})})}},[l]),e.length===0?o.jsx("div",{className:"flex items-center justify-center h-64 text-gray-500 dark:text-gray-400",children:o.jsx("p",{children:"No content to display"})}):o.jsx("div",{className:"max-w-3xl mx-auto space-y-2",children:e.map(b=>{const w=(d==null?void 0:d(b.chunkIndex))??[],P=(m==null?void 0:m(b.chunkIndex))??[],j=(v==null?void 0:v(b.chunkIndex))??!1;return o.jsx(bP,{chunk:b,isActive:t===b.chunkIndex,onRegister:r,onClick:i?()=>i(b):void 0,showChunkNumbers:c,highlights:w,onCreateHighlight:p?(N,S,T,k,E)=>p(b.chunkIndex,N,S,T,k,E):void 0,onHighlightClick:h,searchMatches:P,currentSearchIndex:x,isBookmarked:j},`${b.filePath}-${b.chunkIndex}`)})})}const wP={hidden:{opacity:0,y:-15,rotate:-3,scale:.95},visible:e=>({opacity:1,y:0,rotate:-.3,scale:1,transition:{delay:e*.06,duration:.3,ease:"easeOut"}}),exit:{opacity:0,x:-20,transition:{duration:.15}}};function jP(e){switch(e){case"backlink":return"zettel-backlink";case"forward":return"zettel-forward";case"semantic":return"zettel-semantic"}}function SP(e){switch(e){case"backlink":return"Links here";case"forward":return"Links to";case"semantic":return"Related"}}function CP(e){const t=e.split(/[/\\]/);return t[t.length-1]||e}function bg(e){return`${Math.round((1-e)*100)}%`}function ka({filePath:e,chunkIndex:t,previewText:r,type:i,score:l,sharedKeywords:c=[],onNavigate:d,onPin:p,isPinned:h=!1,animationIndex:m=0}){const x=CP(e),v=SP(i),b=jP(i);return o.jsxs(Pe.button,{type:"button",onClick:d,custom:m,variants:wP,initial:"hidden",animate:"visible",exit:"exit",className:`
|
|
75
|
+
zettel-slip ${b}
|
|
76
|
+
w-full text-left cursor-pointer
|
|
77
|
+
focus:outline-none focus:ring-2 focus:ring-amber-400 dark:focus:ring-amber-600
|
|
78
|
+
${h?"ring-2 ring-amber-500 dark:ring-amber-400":""}
|
|
79
|
+
`,children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[o.jsx(NP,{type:i}),o.jsx("span",{className:"text-xs font-medium text-stone-600 dark:text-stone-400 truncate font-serif",title:e,children:x}),o.jsxs("span",{className:"text-xs text-stone-400 dark:text-stone-500 font-mono",children:["#",t]})]}),l!==void 0&&o.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-stone-200/50 dark:bg-stone-700/50 text-stone-600 dark:text-stone-400",title:`Similarity: ${bg(l)}`,children:bg(l)})]}),o.jsxs("p",{className:"text-sm text-stone-700 dark:text-stone-300 line-clamp-3 font-serif leading-relaxed",children:[r.slice(0,180),r.length>180&&"..."]}),c.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:c.slice(0,3).map(w=>o.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-amber-100/60 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 rounded font-sans",children:w},w))}),o.jsxs("div",{className:"flex items-center justify-between mt-2 pt-1.5 border-t border-stone-200/50 dark:border-stone-700/50",children:[o.jsx("span",{className:"text-xs text-stone-500 dark:text-stone-400 italic",children:v}),o.jsx("div",{className:"flex items-center gap-1",children:p&&o.jsx("span",{role:"button",tabIndex:0,onClick:w=>{w.stopPropagation(),p()},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.stopPropagation(),w.preventDefault(),p())},className:`
|
|
80
|
+
p-1 rounded transition-colors
|
|
81
|
+
${h?"text-amber-600 dark:text-amber-400":"text-stone-400 hover:text-amber-500 dark:text-stone-500 dark:hover:text-amber-400"}
|
|
82
|
+
`,title:h?"Unpin":"Pin",children:o.jsx(EP,{className:"w-3.5 h-3.5"})})})]})]})}function NP({type:e}){const t={backlink:"bg-blue-500",forward:"bg-emerald-500",semantic:"bg-violet-500"}[e];return o.jsx("span",{className:`w-2 h-2 rounded-full ${t} flex-shrink-0`,"aria-hidden":"true"})}function EP({className:e}){return o.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M5 5a2 2 0 012-2h6a2 2 0 012 2v14l-5-2.5L5 19V5z"})})}function kg({message:e}){return o.jsxs(Pe.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center py-6 text-stone-500 dark:text-stone-400",children:[o.jsx(PP,{}),o.jsx("p",{className:"mt-2 text-sm font-serif italic",children:e})]})}function PP(){return o.jsx("svg",{className:"mx-auto h-10 w-10 text-stone-300 dark:text-stone-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}function oi({title:e,count:t,icon:r}){return o.jsxs("div",{className:"flex items-center gap-2 px-1 py-2",children:[r&&o.jsx("span",{className:"text-stone-400 dark:text-stone-500",children:r}),o.jsx("h4",{className:"text-xs font-semibold text-stone-600 dark:text-stone-400 uppercase tracking-wide font-sans",children:e}),t!==void 0&&t>0&&o.jsxs("span",{className:"text-xs text-stone-400 dark:text-stone-500",children:["(",t,")"]})]})}function Yu(){return o.jsxs("div",{className:"zettel-slip zettel-semantic animate-pulse",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full bg-stone-300 dark:bg-stone-600"}),o.jsx("div",{className:"h-3 w-24 bg-stone-300 dark:bg-stone-600 rounded"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"h-3 w-full bg-stone-200 dark:bg-stone-700 rounded"}),o.jsx("div",{className:"h-3 w-4/5 bg-stone-200 dark:bg-stone-700 rounded"}),o.jsx("div",{className:"h-3 w-2/3 bg-stone-200 dark:bg-stone-700 rounded"})]})]})}function TP({relatedChunks:e,isLoading:t,activeChunkIndex:r,currentFilePath:i,onNavigateToChunk:l,pinnedChunkKeys:c,onTogglePin:d,highlights:p=[],annotations:h=new Map,onUpdateNote:m,onDeleteNote:x,onDeleteHighlight:v,onChangeHighlightColor:b,backlinks:w=[],outgoingLinks:P=[],selectionSearchResults:j,isSelectionSearchLoading:N=!1,onClearSelectionSearch:S,autoSelectionResults:T=[],isAutoSearching:k=!1,selectionText:E=null}){const R=e.filter(O=>O.score<.7),M=p.length>0,H=w.length>0,B=P.length>0,te=T.length>0||k,X=j||N,se=[...w].sort((O,_)=>{const $=O.sourceKey.filePath===i,K=_.sourceKey.filePath===i;if($!==K)return $?-1:1;const W=!!O.label,q=!!_.label;return W!==q?W?-1:1:new Date(_.createdAt).getTime()-new Date(O.createdAt).getTime()}),ne=[...P].sort((O,_)=>{const $=O.targetKey.filePath===i,K=_.targetKey.filePath===i;if($!==K)return $?-1:1;const W=!!O.label,q=!!_.label;return W!==q?W?-1:1:new Date(_.createdAt).getTime()-new Date(O.createdAt).getTime()});return o.jsxs("div",{className:"h-full flex flex-col zettel-margin",children:[o.jsxs("div",{className:"zettel-header flex items-center justify-between",children:[o.jsxs("h3",{className:"text-sm font-semibold text-stone-700 dark:text-stone-300 font-serif",children:["Connections",r!==null&&o.jsxs("span",{className:"ml-2 text-stone-400 dark:text-stone-500 font-mono text-xs",children:["#",r]})]}),t&&o.jsx(Ve,{className:"w-4 h-4 text-stone-400"})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-4",children:[M&&o.jsxs("div",{className:"border-b border-stone-200/50 dark:border-stone-700/50 pb-4",children:[o.jsx(oi,{title:"Notes",count:p.length,icon:o.jsx(RP,{className:"w-3.5 h-3.5"})}),o.jsx("div",{className:"space-y-3 mt-2",children:o.jsx(ut,{mode:"popLayout",children:p.map(O=>o.jsx(iP,{highlight:O,annotation:h.get(O.id),onUpdateNote:_=>m==null?void 0:m(O.id,_),onDeleteNote:()=>{const _=h.get(O.id);_&&(x==null||x(_.id))},onDeleteHighlight:()=>v==null?void 0:v(O.id),onChangeColor:_=>b==null?void 0:b(O.id,_)},O.id))})})]}),te&&o.jsxs("div",{className:"border-b border-stone-200/50 dark:border-stone-700/50 pb-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx(oi,{title:"From Selection",count:T.length,icon:o.jsx(MP,{className:"w-3.5 h-3.5"})}),E&&o.jsxs("span",{className:"zettel-selection-pill truncate max-w-[150px]",title:E,children:['"',E.slice(0,30),E.length>30?"...":"",'"']})]}),o.jsx("div",{className:"space-y-2 mt-2",children:k?o.jsxs("div",{className:"zettel-searching",children:[o.jsx(Ve,{className:"w-4 h-4 text-violet-500"}),o.jsx("span",{className:"text-xs text-violet-600 dark:text-violet-400 font-serif italic",children:"Finding connections..."})]}):T.length===0?o.jsx("p",{className:"text-xs text-stone-500 dark:text-stone-400 italic font-serif py-2",children:"No related content found"}):o.jsx(ut,{mode:"popLayout",children:T.map((O,_)=>o.jsx(ka,{filePath:O.filePath,chunkIndex:O.chunkIndex,previewText:O.text,type:"semantic",score:O.score,onNavigate:()=>l(O.filePath,O.chunkIndex),onPin:d?()=>d(O.filePath,O.chunkIndex):void 0,isPinned:(c==null?void 0:c.has(`${O.filePath}:${O.chunkIndex}`))??!1,animationIndex:_},`${O.filePath}:${O.chunkIndex}`))})})]}),X&&!te&&o.jsxs("div",{className:"border-b border-stone-200/50 dark:border-stone-700/50 pb-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx(oi,{title:j?FP(j.action):"Searching...",count:j==null?void 0:j.results.length,icon:o.jsx(AP,{className:"w-3.5 h-3.5"})}),S&&o.jsx("button",{type:"button",onClick:S,className:"text-stone-400 hover:text-stone-600 dark:hover:text-stone-200 transition-colors",title:"Close",children:o.jsx(OP,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"space-y-2 mt-2",children:N?o.jsx(Yu,{}):(j==null?void 0:j.results.length)===0?o.jsx(kg,{message:"No results found"}):o.jsx(ut,{mode:"popLayout",children:j==null?void 0:j.results.map((O,_)=>o.jsx(ka,{filePath:O.filePath,chunkIndex:O.chunkIndex,previewText:O.text,type:"semantic",score:O.score,onNavigate:()=>l(O.filePath,O.chunkIndex),onPin:d?()=>d(O.filePath,O.chunkIndex):void 0,isPinned:(c==null?void 0:c.has(`${O.filePath}:${O.chunkIndex}`))??!1,animationIndex:_},`${O.filePath}:${O.chunkIndex}`))})})]}),H&&o.jsxs("div",{className:"border-b border-stone-200/50 dark:border-stone-700/50 pb-4",children:[o.jsx(oi,{title:"Links Here",count:se.length,icon:o.jsx(LP,{className:"w-3.5 h-3.5"})}),o.jsx("div",{className:"space-y-2 mt-2",children:o.jsx(ut,{mode:"popLayout",children:se.map((O,_)=>o.jsx(ka,{filePath:O.sourceKey.filePath,chunkIndex:O.sourceKey.chunkIndex,previewText:O.sourceText||"No preview available",type:"backlink",sharedKeywords:O.label?[O.label]:void 0,onNavigate:()=>l(O.sourceKey.filePath,O.sourceKey.chunkIndex),animationIndex:_},O.id))})})]}),B&&o.jsxs("div",{className:"border-b border-stone-200/50 dark:border-stone-700/50 pb-4",children:[o.jsx(oi,{title:"Links From",count:ne.length,icon:o.jsx(IP,{className:"w-3.5 h-3.5"})}),o.jsx("div",{className:"space-y-2 mt-2",children:o.jsx(ut,{mode:"popLayout",children:ne.map((O,_)=>o.jsx(ka,{filePath:O.targetKey.filePath,chunkIndex:O.targetKey.chunkIndex,previewText:O.targetText||"No preview available",type:"forward",sharedKeywords:O.label?[O.label]:void 0,onNavigate:()=>l(O.targetKey.filePath,O.targetKey.chunkIndex),animationIndex:_},O.id))})})]}),o.jsxs("div",{children:[o.jsx(oi,{title:"Suggested",count:R.length,icon:o.jsx(DP,{className:"w-3.5 h-3.5"})}),o.jsx("div",{className:"space-y-2 mt-2",children:o.jsx(ut,{mode:"popLayout",children:R.length===0&&!t?o.jsx(kg,{message:r!==null?"No related content found":"Scroll to see related content"}):t&&R.length===0?o.jsxs(o.Fragment,{children:[o.jsx(Yu,{}),o.jsx(Yu,{})]}):R.map((O,_)=>{var W;const $=`${O.filePath}:${O.chunkIndex}`,K=(c==null?void 0:c.has($))??!1;return o.jsx(ka,{filePath:O.filePath,chunkIndex:O.chunkIndex,previewText:O.text,type:"semantic",score:O.score,sharedKeywords:(W=O.explanation)==null?void 0:W.sharedKeywords,onNavigate:()=>l(O.filePath,O.chunkIndex),onPin:d?()=>d(O.filePath,O.chunkIndex):void 0,isPinned:K,animationIndex:_},$)})})})]})]})]})}function RP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}function DP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})})}function LP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})}function IP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})})}function AP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function MP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l4-4 4 4m0 6l-4 4-4-4"})})}function OP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function FP(e){switch(e){case"related":return"Related";case"support":return"Supporting";case"contradict":return"Contradicting";case"compare":return"Compare";case"pin":return"Pinned";default:return"Results"}}const Sv={nodeRadius:8,activeNodeRadius:12,currentNodeColor:"#3b82f6",defaultNodeColor:"#9ca3af",pinnedNodeColor:"#10b981",edgeWidth:1.5,pinnedEdgeColor:"#3b82f6",semanticEdgeColor:"#d1d5db",backlinkEdgeColor:"#8b5cf6",repulsionStrength:150,attractionStrength:.3,centerGravity:.05,velocityDecay:.4,maxNodes:150,neighborsToShow:10};function _P({graphData:e,config:t,width:r,height:i,enabled:l=!0}){const c=y.useMemo(()=>({...Sv,...t}),[t]),[d,p]=y.useState([]),[h,m]=y.useState(!1),x=y.useRef(null),v=y.useRef(0);y.useEffect(()=>{const j=r/2,N=i/2,S=e.nodes.map((T,k)=>{const E=d.find(H=>H.id===T.id);if(E&&E.x!==void 0&&E.y!==void 0)return{...T,x:E.x,y:E.y,vx:0,vy:0};const R=k/e.nodes.length*Math.PI*2,M=Math.min(r,i)*.3;return{...T,x:j+Math.cos(R)*M+(Math.random()-.5)*50,y:N+Math.sin(R)*M+(Math.random()-.5)*50,vx:0,vy:0}});p(S),m(!1),v.current=0},[e.nodes.length,r,i,e.nodes.map,d.find]);const b=y.useRef(new Map);y.useEffect(()=>{const j=new Map;for(const N of e.edges){const S=j.get(N.source)||[];S.push(N.target),j.set(N.source,S);const T=j.get(N.target)||[];T.push(N.source),j.set(N.target,T)}b.current=j},[e.edges]);const w=y.useCallback(()=>{if(!l||d.length===0)return!1;const j=r/2,N=i/2;let S=0;const T=d.map(k=>{let E=0,R=0;if(k.fx!==void 0&&k.fx!==null&&k.fy!==void 0&&k.fy!==null)return{...k,x:k.fx,y:k.fy};for(const $ of d){if($.id===k.id)continue;const K=(k.x??0)-($.x??0),W=(k.y??0)-($.y??0),q=Math.sqrt(K*K+W*W)||1,Q=c.repulsionStrength/(q*q);E+=K/q*Q,R+=W/q*Q}const M=b.current.get(k.id)||[];for(const $ of M){const K=d.find(Q=>Q.id===$);if(!K)continue;const W=(K.x??0)-(k.x??0),q=(K.y??0)-(k.y??0);E+=W*c.attractionStrength,R+=q*c.attractionStrength}E+=(j-(k.x??0))*c.centerGravity,R+=(N-(k.y??0))*c.centerGravity;const H=((k.vx??0)+E)*(1-c.velocityDecay),B=((k.vy??0)+R)*(1-c.velocityDecay),te=(k.x??0)+H,X=(k.y??0)+B,se=40,ne=Math.max(se,Math.min(r-se,te)),O=Math.max(se,Math.min(i-se,X)),_=Math.sqrt(H*H+B*B);return S=Math.max(S,_),{...k,x:ne,y:O,vx:H,vy:B}});return p(T),v.current++,S>.5&&v.current<300},[d,l,r,i,c]);y.useEffect(()=>{if(!l){x.current&&cancelAnimationFrame(x.current);return}const j=()=>{w()?x.current=requestAnimationFrame(j):m(!0)};return x.current=requestAnimationFrame(j),()=>{x.current&&cancelAnimationFrame(x.current)}},[w,l]);const P=y.useCallback(()=>{m(!1),v.current=0,p(j=>j.map(N=>({...N,vx:(Math.random()-.5)*10,vy:(Math.random()-.5)*10})))},[]);return{nodes:d,isStable:h,reheat:P}}function zP({graphData:e,currentNodeId:t,pinnedNodeIds:r,onNodeClick:i,config:l}){const c=y.useRef(null),d=y.useRef(null),[p,h]=y.useState({width:600,height:300}),[m,x]=y.useState(null),[v,b]=y.useState(null),[w,P]=y.useState({x:0,y:0}),[j,N]=y.useState(1),S=y.useRef(!1),T=y.useRef({x:0,y:0}),k=y.useMemo(()=>({...Sv,...l}),[l]),{nodes:E,isStable:R}=_P({graphData:e,config:l,width:p.width,height:p.height,enabled:e.nodes.length>0});y.useEffect(()=>{const _=d.current;if(!_)return;const $=new ResizeObserver(K=>{const W=K[0];W&&h({width:W.contentRect.width,height:W.contentRect.height})});return $.observe(_),()=>$.disconnect()},[]);const M=y.useCallback((_,$)=>{const K=c.current;if(!K)return{x:0,y:0};const W=K.getBoundingClientRect(),q=(_-W.left-w.x)/j,Q=($-W.top-w.y)/j;return{x:q,y:Q}},[w,j]),H=y.useCallback((_,$)=>{for(const K of E){if(K.x===void 0||K.y===void 0)continue;const W=_-K.x,q=$-K.y,Q=K.id===t?k.activeNodeRadius:k.nodeRadius;if(W*W+q*q<=Q*Q*1.5)return K}return null},[E,t,k.nodeRadius,k.activeNodeRadius]),B=y.useCallback(_=>{S.current=!0,T.current={x:_.clientX,y:_.clientY}},[]),te=y.useCallback(()=>{S.current=!1},[]),X=y.useCallback(_=>{if(S.current){const q=_.clientX-T.current.x,Q=_.clientY-T.current.y;P(J=>({x:J.x+q,y:J.y+Q})),T.current={x:_.clientX,y:_.clientY};return}const{x:$,y:K}=M(_.clientX,_.clientY),W=H($,K);if(x(W),W){const q=c.current;if(q){const Q=q.getBoundingClientRect();b({x:_.clientX-Q.left,y:_.clientY-Q.top,node:W})}}else b(null)},[M,H]),se=y.useCallback(_=>{const{x:$,y:K}=M(_.clientX,_.clientY),W=H($,K);W&&i&&i(W)},[M,H,i]),ne=y.useCallback(_=>{_.preventDefault();const $=_.deltaY>0?.9:1.1;N(K=>Math.max(.3,Math.min(3,K*$)))},[]);y.useEffect(()=>{const _=c.current;if(!_)return;const $=_.getContext("2d");if(!$)return;_.width=p.width*window.devicePixelRatio,_.height=p.height*window.devicePixelRatio,$.scale(window.devicePixelRatio,window.devicePixelRatio),$.clearRect(0,0,p.width,p.height),$.save(),$.translate(w.x,w.y),$.scale(j,j);const K=new Map;for(const W of E)W.x!==void 0&&W.y!==void 0&&K.set(W.id,{x:W.x,y:W.y});for(const W of e.edges){const q=K.get(W.source),Q=K.get(W.target);!q||!Q||($.beginPath(),$.moveTo(q.x,q.y),$.lineTo(Q.x,Q.y),$.strokeStyle=W.type==="pinned"?k.pinnedEdgeColor:W.type==="backlink"?k.backlinkEdgeColor:k.semanticEdgeColor,$.lineWidth=W.type==="pinned"?k.edgeWidth*1.5:k.edgeWidth,W.type==="semantic"?$.setLineDash([4,4]):$.setLineDash([]),$.stroke())}$.setLineDash([]);for(const W of E){if(W.x===void 0||W.y===void 0)continue;const q=W.id===t,Q=r.has(W.id),J=(m==null?void 0:m.id)===W.id,L=q?k.activeNodeRadius:k.nodeRadius,G=q?k.currentNodeColor:Q?k.pinnedNodeColor:k.defaultNodeColor;$.beginPath(),$.arc(W.x,W.y,J?L*1.3:L,0,Math.PI*2),$.fillStyle=G,$.fill(),$.strokeStyle=J?"#fff":"rgba(0,0,0,0.2)",$.lineWidth=J?2:1,$.stroke(),q&&($.font="10px sans-serif",$.fillStyle="#fff",$.textAlign="center",$.textBaseline="middle",$.fillText("●",W.x,W.y))}$.restore()},[E,e.edges,p,w,j,t,r,m,k]);const O=_=>{const $=_.split(/[/\\]/);return $[$.length-1]||_};return o.jsxs("div",{ref:d,className:"w-full h-full relative bg-gray-100 dark:bg-gray-900 rounded-lg overflow-hidden",children:[o.jsx("canvas",{ref:c,className:"w-full h-full cursor-grab active:cursor-grabbing",style:{width:p.width,height:p.height},onMouseDown:B,onMouseUp:te,onMouseMove:X,onMouseLeave:()=>{x(null),b(null),S.current=!1},onClick:se,onWheel:ne}),v&&o.jsxs("div",{className:"absolute pointer-events-none z-10 max-w-xs px-3 py-2 text-xs bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-900 rounded-lg shadow-lg",style:{left:Math.min(v.x+10,p.width-200),top:Math.min(v.y+10,p.height-60)},children:[o.jsx("p",{className:"font-medium truncate",children:O(v.node.filePath)}),o.jsxs("p",{className:"text-gray-300 dark:text-gray-600",children:["Chunk #",v.node.chunkIndex]}),o.jsx("p",{className:"mt-1 line-clamp-2 text-gray-400 dark:text-gray-500",children:v.node.text})]}),o.jsxs("div",{className:"absolute bottom-2 right-2 flex gap-1",children:[o.jsx("button",{type:"button",onClick:()=>N(_=>Math.min(3,_*1.2)),className:"p-1.5 bg-white dark:bg-gray-800 rounded shadow text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200",title:"Zoom in",children:o.jsx(VP,{className:"w-4 h-4"})}),o.jsx("button",{type:"button",onClick:()=>N(_=>Math.max(.3,_*.8)),className:"p-1.5 bg-white dark:bg-gray-800 rounded shadow text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200",title:"Zoom out",children:o.jsx(BP,{className:"w-4 h-4"})}),o.jsx("button",{type:"button",onClick:()=>{P({x:0,y:0}),N(1)},className:"p-1.5 bg-white dark:bg-gray-800 rounded shadow text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200",title:"Reset view",children:o.jsx($P,{className:"w-4 h-4"})}),!R&&o.jsx("span",{className:"p-1.5 text-xs text-gray-500 dark:text-gray-400",children:"Simulating..."})]}),o.jsxs("div",{className:"absolute top-2 left-2 text-xs text-gray-600 dark:text-gray-400 bg-white/80 dark:bg-gray-800/80 px-2 py-1 rounded",children:[o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:k.currentNodeColor}}),"Current"]}),o.jsxs("span",{className:"inline-flex items-center gap-1 ml-3",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:k.pinnedNodeColor}}),"Pinned"]}),o.jsxs("span",{className:"inline-flex items-center gap-1 ml-3",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:k.defaultNodeColor}}),"Related"]})]})]})}function VP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function BP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})}function $P({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}function UP({isOpen:e,onToggle:t,filePath:r,activeChunkIndex:i,relatedChunks:l,pins:c,onNavigateToChunk:d}){const{graphData:p,currentNodeId:h}=iE({filePath:r,activeChunkIndex:i,relatedChunks:l,pins:c}),m=y.useMemo(()=>{const v=new Set;for(const b of c)v.add(`${b.sourceKey.filePath}:${b.sourceKey.chunkIndex}`),v.add(`${b.targetKey.filePath}:${b.targetKey.chunkIndex}`);return v},[c]),x=v=>{d(v.filePath,v.chunkIndex)};return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:t,className:"flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:e?"Hide knowledge graph":"Show knowledge graph",children:[o.jsx(wg,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Graph"}),p.nodes.length>0&&o.jsxs("span",{className:"text-xs text-gray-400",children:["(",p.nodes.length,")"]})]}),o.jsx(ut,{children:e&&o.jsx(Pe.div,{initial:{height:0,opacity:0},animate:{height:300,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"absolute bottom-0 left-0 right-0 z-30 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 overflow-hidden",children:o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",children:[o.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Knowledge Graph",i!==null&&o.jsxs("span",{className:"ml-2 text-gray-500 dark:text-gray-400",children:["(centered on #",i,")"]})]}),o.jsx("button",{type:"button",onClick:t,className:"p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 rounded",children:o.jsx(WP,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"flex-1 p-2",children:p.nodes.length===0?o.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-gray-400",children:o.jsxs("div",{className:"text-center",children:[o.jsx(wg,{className:"w-10 h-10 mx-auto mb-2 opacity-50"}),o.jsx("p",{className:"text-sm",children:"No graph data available"}),o.jsx("p",{className:"text-xs mt-1",children:"Scroll through the document to load related content"})]})}):o.jsx(zP,{graphData:p,currentNodeId:h,pinnedNodeIds:m,onNodeClick:x})})]})})})]})}function wg({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}function WP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}const HP=[{key:"j",description:"Navigate to next chunk"},{key:"k",description:"Navigate to previous chunk"},{key:"Space",description:"Toggle split view"},{key:"p",description:"Pin top margin suggestion"},{key:"/",description:"Open search"},{key:"?",description:"Show keyboard shortcuts"},{key:"Esc",description:"Close overlays"}];function KP({isOpen:e,onClose:t}){return o.jsx(ut,{children:e&&o.jsxs(o.Fragment,{children:[o.jsx(Pe.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",onClick:t}),o.jsx(Pe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:r=>r.target===r.currentTarget&&t(),children:o.jsxs("div",{className:"w-full max-w-md bg-white dark:bg-gray-800 rounded-xl shadow-2xl overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:"Keyboard Shortcuts"}),o.jsx("button",{type:"button",onClick:t,className:"p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:o.jsx(qP,{className:"w-5 h-5"})})]}),o.jsx("div",{className:"p-4",children:o.jsx("table",{className:"w-full",children:o.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:HP.map(r=>o.jsxs("tr",{className:"group",children:[o.jsx("td",{className:"py-2.5 pr-4",children:o.jsx("kbd",{className:"inline-flex items-center justify-center min-w-[2rem] px-2 py-1 text-sm font-mono font-semibold text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded shadow-sm",children:r.key})}),o.jsx("td",{className:"py-2.5 text-sm text-gray-600 dark:text-gray-400",children:r.description})]},r.key))})})}),o.jsx("div",{className:"px-6 py-3 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700",children:o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 text-center",children:"Shortcuts are disabled when typing in inputs or selecting text"})})]})})]})})}function qP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function QP({isOpen:e,onClose:t}){const{settings:r,setFontSize:i,setLineHeight:l,setFontFamily:c,setShowChunkNumbers:d,setShowHeatmap:p,resetSettings:h}=wv();return o.jsx(ut,{children:e&&o.jsxs(o.Fragment,{children:[o.jsx(Pe.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-40",onClick:t}),o.jsx(Pe.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},className:"absolute right-0 top-full mt-2 z-50 w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 p-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("span",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Font Size"}),o.jsx("div",{className:"flex gap-1",role:"group","aria-label":"Font size",children:["sm","base","lg","xl"].map(m=>o.jsxs("button",{type:"button",onClick:()=>i(m),className:`
|
|
83
|
+
flex-1 px-2 py-1.5 text-sm rounded-md transition-colors
|
|
84
|
+
${r.fontSize===m?"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 font-medium":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}
|
|
85
|
+
`,children:[m==="sm"&&"S",m==="base"&&"M",m==="lg"&&"L",m==="xl"&&"XL"]},m))})]}),o.jsxs("div",{children:[o.jsx("span",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Line Spacing"}),o.jsx("div",{className:"flex gap-1",role:"group","aria-label":"Line spacing",children:["tight","normal","relaxed"].map(m=>o.jsx("button",{type:"button",onClick:()=>l(m),className:`
|
|
86
|
+
flex-1 px-2 py-1.5 text-sm rounded-md transition-colors capitalize
|
|
87
|
+
${r.lineHeight===m?"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 font-medium":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}
|
|
88
|
+
`,children:m},m))})]}),o.jsx("div",{children:o.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-2",children:["Font",o.jsxs("select",{value:r.fontFamily,onChange:m=>c(m.target.value),className:"mt-1 w-full px-3 py-2 text-sm bg-gray-100 dark:bg-gray-700 border-0 rounded-md text-gray-700 dark:text-gray-300 focus:ring-2 focus:ring-blue-500",children:[o.jsx("option",{value:"sans",children:"Sans-serif"}),o.jsx("option",{value:"serif",children:"Serif"}),o.jsx("option",{value:"mono",children:"Monospace"})]})]})}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Show chunk numbers"}),o.jsx("button",{type:"button",onClick:()=>d(!r.showChunkNumbers),className:`
|
|
89
|
+
relative inline-flex h-6 w-11 items-center rounded-full transition-colors
|
|
90
|
+
${r.showChunkNumbers?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}
|
|
91
|
+
`,children:o.jsx("span",{className:`
|
|
92
|
+
inline-block h-4 w-4 transform rounded-full bg-white transition-transform
|
|
93
|
+
${r.showChunkNumbers?"translate-x-6":"translate-x-1"}
|
|
94
|
+
`})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Semantic heatmap"}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Highlight connected terms"})]}),o.jsx("button",{type:"button",onClick:()=>p(!r.showHeatmap),className:`
|
|
95
|
+
relative inline-flex h-6 w-11 items-center rounded-full transition-colors
|
|
96
|
+
${r.showHeatmap?"bg-purple-600":"bg-gray-300 dark:bg-gray-600"}
|
|
97
|
+
`,children:o.jsx("span",{className:`
|
|
98
|
+
inline-block h-4 w-4 transform rounded-full bg-white transition-transform
|
|
99
|
+
${r.showHeatmap?"translate-x-6":"translate-x-1"}
|
|
100
|
+
`})})]}),o.jsx("div",{className:"pt-2 border-t border-gray-200 dark:border-gray-700",children:o.jsx("button",{type:"button",onClick:h,className:"w-full px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Reset to defaults"})})]})})]})})}function GP({onClick:e}){return o.jsxs("button",{type:"button",onClick:e,className:"flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Reader settings",children:[o.jsx(YP,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Display"})]})}function YP({className:e}){return o.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function XP({isOpen:e,query:t,matches:r,currentIndex:i,caseSensitive:l,onQueryChange:c,onToggleCaseSensitive:d,onNextMatch:p,onPreviousMatch:h,onGoToMatch:m,onClose:x}){const v=y.useRef(null),b=y.useRef(null);y.useEffect(()=>{e&&requestAnimationFrame(()=>{var P,j;(P=v.current)==null||P.focus(),(j=v.current)==null||j.select()})},[e]),y.useEffect(()=>{if(i>=0&&b.current){const P=b.current.querySelector(`[data-result-index="${i}"]`);P==null||P.scrollIntoView({block:"nearest",behavior:"smooth"})}},[i]);const w=y.useCallback(P=>{switch(P.key){case"Escape":P.preventDefault(),x();break;case"Enter":P.preventDefault(),P.shiftKey?h():p();break;case"n":P.target!==v.current&&(P.preventDefault(),P.shiftKey?h():p());break;case"N":P.target!==v.current&&(P.preventDefault(),h());break}},[x,p,h]);return o.jsx(ut,{children:e&&o.jsx(Pe.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},className:"fixed top-16 left-1/2 -translate-x-1/2 z-50 w-full max-w-lg px-4",onKeyDown:w,children:o.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl border border-gray-200 dark:border-gray-700 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 p-3 border-b border-gray-200 dark:border-gray-700",children:[o.jsx(ZP,{className:"w-5 h-5 text-gray-400 flex-shrink-0"}),o.jsx("input",{ref:v,type:"text",value:t,onChange:P=>c(P.target.value),placeholder:"Search in document...",className:"flex-1 bg-transparent text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none text-base"}),r.length>0&&o.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap px-2",children:[i+1,"/",r.length]}),o.jsx("button",{type:"button",onClick:d,className:`p-1.5 rounded text-sm font-medium transition-colors ${l?"bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-400":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"Case sensitive (Aa)",children:"Aa"}),o.jsxs("div",{className:"flex items-center gap-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[o.jsx("button",{type:"button",onClick:h,disabled:r.length===0,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-30 disabled:cursor-not-allowed rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",title:"Previous match (N)",children:o.jsx(eT,{className:"w-4 h-4"})}),o.jsx("button",{type:"button",onClick:p,disabled:r.length===0,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-30 disabled:cursor-not-allowed rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",title:"Next match (n)",children:o.jsx(tT,{className:"w-4 h-4"})})]}),o.jsx("button",{type:"button",onClick:x,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",title:"Close (Esc)",children:o.jsx(nT,{className:"w-4 h-4"})})]}),t.length>0&&o.jsx("div",{ref:b,className:"max-h-64 overflow-y-auto",children:r.length===0?o.jsx("div",{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:o.jsx("p",{className:"text-sm",children:"No matches found"})}):o.jsxs("div",{className:"py-1",children:[r.slice(0,50).map((P,j)=>o.jsxs("button",{"data-result-index":j,type:"button",onClick:()=>m(j),className:`w-full text-left px-4 py-2 hover:bg-gray-50 dark:hover:bg-gray-750 transition-colors ${j===i?"bg-blue-50 dark:bg-blue-900/20 border-l-2 border-blue-500":""}`,children:[o.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:o.jsxs("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Chunk #",P.chunkIndex]})}),o.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 line-clamp-2",children:JP(P.context,t,l)})]},`${P.chunkIndex}-${P.startOffset}`)),r.length>50&&o.jsxs("div",{className:"px-4 py-2 text-xs text-gray-500 dark:text-gray-400 text-center border-t border-gray-200 dark:border-gray-700",children:["Showing first 50 of ",r.length," matches"]})]})}),t.length===0&&o.jsxs("div",{className:"px-4 py-3 text-xs text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-850",children:[o.jsxs("span",{className:"mr-4",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-200 dark:bg-gray-700 rounded text-gray-600 dark:text-gray-300",children:"Enter"})," ","next"]}),o.jsxs("span",{className:"mr-4",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-200 dark:bg-gray-700 rounded text-gray-600 dark:text-gray-300",children:"Shift+Enter"})," ","previous"]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-200 dark:bg-gray-700 rounded text-gray-600 dark:text-gray-300",children:"Esc"})," ","close"]})]})]})})})}function JP(e,t,r){if(!t)return e;const i=r?t:t.toLowerCase(),c=(r?e:e.toLowerCase()).indexOf(i);if(c===-1)return e;const d=e.slice(0,c),p=e.slice(c,c+t.length),h=e.slice(c+t.length);return o.jsxs(o.Fragment,{children:[d,o.jsx("mark",{className:"bg-orange-200 dark:bg-orange-800/60 rounded px-0.5",children:p}),h]})}function ZP({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function eT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}function tT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function nT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function rT({filePath:e,chunkIndex:t,onClose:r,onNavigate:i}){const{chunks:l,isLoading:c,error:d}=dv(e),p=sT(e);return o.jsxs(Pe.div,{initial:{opacity:0,x:50},animate:{opacity:1,x:0},exit:{opacity:0,x:50},className:"h-full flex flex-col bg-white dark:bg-gray-800 border-l border-gray-200 dark:border-gray-700",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-750",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",title:e,children:p}),o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[l.length," chunks · Viewing #",t]})]}),o.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[o.jsx("button",{type:"button",onClick:()=>i(e,t),className:"px-3 py-1.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded-lg transition-colors",children:"Open Full"}),o.jsx("button",{type:"button",onClick:r,className:"p-1.5 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors","aria-label":"Close split view",children:o.jsx(iT,{})})]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:c?o.jsxs("div",{className:"flex items-center justify-center h-32",children:[o.jsx(Ve,{className:"w-6 h-6 text-gray-400"}),o.jsx("span",{className:"ml-2 text-gray-500 dark:text-gray-400",children:"Loading document..."})]}):d?o.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-700 dark:text-red-400",children:[o.jsx("p",{className:"font-medium",children:"Error loading document"}),o.jsx("p",{className:"text-sm mt-1",children:d.message})]}):o.jsx(jv,{chunks:l,activeChunkIndex:t,onRegisterChunk:()=>{},scrollToChunk:t})})]})}function sT(e){const t=e.split(/[/\\]/);return t[t.length-1]||e}function iT(){return o.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function aT({entries:e,activeChunkIndex:t,onNavigateToChunk:r,isOpen:i,onToggle:l,isFallback:c=!1}){const d=e.findIndex((h,m)=>{const x=e[m+1];return x?h.chunkIndex<=(t??0)&&x.chunkIndex>(t??0):h.chunkIndex<=(t??0)}),p=y.useCallback(h=>{r(h.chunkIndex)},[r]);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:l,className:"flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:i?"Hide table of contents":"Show table of contents",children:[o.jsx(lT,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Contents"}),o.jsx(Pe.span,{animate:{rotate:i?180:0},transition:{duration:.2},children:o.jsx(cT,{className:"w-3 h-3"})})]}),o.jsx(ut,{children:i&&o.jsx(Pe.div,{initial:{width:0,opacity:0},animate:{width:240,opacity:1},exit:{width:0,opacity:0},transition:{duration:.2},className:"fixed left-0 top-16 bottom-0 z-40 bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 shadow-lg overflow-hidden",children:o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Table of Contents"}),c&&o.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"(auto)"})]}),o.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:e.length===0?o.jsx("div",{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:o.jsx("p",{className:"text-sm",children:"No headings detected"})}):o.jsx("nav",{className:"space-y-0.5",children:e.map((h,m)=>o.jsx(oT,{entry:h,isCurrent:m===d,onClick:()=>p(h)},h.id))})})]})})})]})}function oT({entry:e,isCurrent:t,onClick:r}){const i=16+(e.level-1)*12;return o.jsxs("button",{type:"button",onClick:r,className:`
|
|
101
|
+
w-full text-left px-4 py-1.5 text-sm transition-colors
|
|
102
|
+
${t?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium border-l-2 border-blue-500":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 border-l-2 border-transparent"}
|
|
103
|
+
`,style:{paddingLeft:i},children:[o.jsx("span",{className:"line-clamp-2",children:e.text}),e.type==="allcaps"&&o.jsx("span",{className:"ml-1 text-xs text-gray-400",children:e.chunkIndex})]})}function lT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 10h16M4 14h16M4 18h16"})})}function cT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function uT({filePath:e,initialChunkIndex:t,onNavigate:r,onGoHome:i,pinnedChunkKeys:l,onTogglePin:c,onSaveTrail:d}){const[p,h]=y.useState(null),[m,x]=y.useState(()=>{const ve=Xu(e);return[{filePath:e,chunkIndex:t,label:ve}]}),[v,b]=y.useState(!1),[w,P]=y.useState(!1),[j,N]=y.useState(!1),[S,T]=y.useState(!1),[k,E]=y.useState(null),R=y.useRef(null),{settings:M,cssVariables:H}=wv(),{pins:B,getBacklinks:te,getPinsFromChunk:X}=Wl(),{chunks:se,isLoading:ne,error:O}=dv(e),{visibleChunkIndices:_,registerChunk:$,activeChunkIndex:K}=MN("100px"),{relatedChunks:W,isLoading:q}=ON(e,_,300,5),{results:Q,isSearching:J,searchedText:L}=EE({selectionText:k,filePath:e,chunkIndex:K??0,enabled:!p});y.useEffect(()=>{const ve=()=>{const At=window.getSelection();if(!At||At.isCollapsed||!At.rangeCount){E(null);return}const rs=At.toString().trim();rs.length>=10?E(rs):E(null)};let Oe;const at=()=>{clearTimeout(Oe),Oe=setTimeout(ve,150)};return document.addEventListener("selectionchange",at),()=>{document.removeEventListener("selectionchange",at),clearTimeout(Oe)}},[]);const{entries:G,isFallback:be}=JN({chunks:se}),ge=y.useCallback(ve=>{const Oe=document.getElementById(`chunk-${ve}`);Oe&&Oe.scrollIntoView({behavior:"smooth",block:"center"})},[]),{searchState:ye,isSearchOpen:we,openSearch:Se,closeSearch:Ce,setQuery:Re,toggleCaseSensitive:et,nextMatch:Pt,previousMatch:Wt,goToMatch:vt,getMatchesForChunk:pn}=oE({chunks:se,onNavigateToChunk:ge}),{restorePosition:fn,hasSavedPosition:Pn}=HN({filePath:e,chunks:se,activeChunkIndex:K}),hn=y.useMemo(()=>K!==null?{filePath:e,chunkIndex:K}:null,[e,K]),{highlights:bt,annotations:mt,createHighlight:Ht,deleteHighlight:Kt,updateHighlightColor:Zr,addNote:es,updateNote:ts,deleteNote:ie}=nE(hn),pe=y.useCallback(ve=>ve===K?bt:[],[K,bt]),Ie=y.useCallback((ve,Oe,at,At,rs,Xa)=>{ve===K&&Ht(Oe,at,At,rs,Xa)},[K,Ht]),Me=y.useCallback(ve=>{},[]),Ye=y.useCallback((ve,Oe)=>{const at=mt.get(ve);at?ts(at.id,Oe):es(ve,Oe)},[mt,ts,es]),it=y.useRef(!1);y.useEffect(()=>{if(se.length>0&&!it.current&&!t){it.current=!0;const ve=fn();ve&&requestAnimationFrame(()=>{const Oe=document.getElementById(`chunk-${ve.chunkIndex}`);Oe&&Oe.scrollIntoView({behavior:"auto",block:"start"})})}},[se,fn,t]);const _e=y.useMemo(()=>{if(K===null)return[];const ve=`${e}:${K}`;return W[ve]||[]},[e,K,W]),Bn=y.useCallback((ve,Oe)=>{const at=_e.find(At=>At.filePath===ve&&At.chunkIndex===Oe);x(At=>[...At,{filePath:ve,chunkIndex:Oe,label:Xu(ve),connectionReason:at==null?void 0:at.connectionReason}]),r(ve,Oe)},[_e,r]),Tn=y.useCallback((ve,Oe)=>{h({filePath:ve,chunkIndex:Oe})},[]),fr=y.useCallback(ve=>{if(!ve.filePath){i();return}const Oe=m.findIndex(at=>at.filePath===ve.filePath&&at.chunkIndex===ve.chunkIndex);Oe!==-1&&x(at=>at.slice(0,Oe+1)),r(ve.filePath,ve.chunkIndex)},[m,r,i]),hr=j||we||w,$n=y.useMemo(()=>K===null?[]:te({filePath:e,chunkIndex:K}),[e,K,te]),Un=y.useMemo(()=>K===null?[]:X({filePath:e,chunkIndex:K}),[e,K,X]),Wn=y.useCallback(()=>{if(_e.length>0&&c){const ve=_e[0];ve&&c(ve.filePath,ve.chunkIndex)}},[_e,c]),Hn=y.useCallback(()=>{if(p)h(null);else if(_e.length>0){const ve=_e[0];ve&&Tn(ve.filePath,ve.chunkIndex)}},[p,_e,Tn]),ns=y.useCallback(()=>{N(!1),Ce(),P(!1)},[Ce]);UN({totalChunks:se.length,activeChunkIndex:K,onNavigateToChunk:ge,onToggleSplit:Hn,onPinTopSuggestion:Wn,onOpenSearch:Se,onOpenHelp:()=>N(!0),onCloseOverlay:ns,isOverlayOpen:hr,enabled:!0,isSearchOpen:we,onNextSearchMatch:Pt,onPreviousSearchMatch:Wt});const mr=Xu(e);return o.jsxs("div",{className:"h-full flex flex-col",style:H,children:[o.jsx(oP,{items:m,onNavigate:fr,onSaveTrail:d,canSaveTrail:m.length>1}),o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[v&&o.jsx("div",{className:"w-60 flex-shrink-0"}),o.jsxs("div",{className:`
|
|
104
|
+
flex flex-col overflow-hidden transition-all duration-300
|
|
105
|
+
${p?"w-[40%]":"w-[60%]"}
|
|
106
|
+
`,children:[o.jsxs("div",{className:"book-header flex items-center justify-between px-6 py-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx(aT,{entries:G,activeChunkIndex:K,onNavigateToChunk:ge,isOpen:v,onToggle:()=>b(!v),isFallback:be}),o.jsxs("div",{children:[o.jsx("h2",{className:"book-title text-xl truncate",title:e,children:mr}),o.jsxs("p",{className:"text-sm text-stone-500 dark:text-stone-400 font-serif",children:[se.length," passages",K!==null&&` · §${K}`,Pn&&!t&&o.jsx("span",{className:"ml-2 text-amber-600 dark:text-amber-500",children:"· Restored"})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2 relative",children:[o.jsx(UP,{isOpen:S,onToggle:()=>T(!S),filePath:e,activeChunkIndex:K,relatedChunks:_e,pins:B,onNavigateToChunk:Bn}),o.jsx("button",{type:"button",onClick:()=>N(!0),className:"p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Keyboard shortcuts (?)",children:o.jsx(dT,{className:"w-4 h-4"})}),o.jsx(GP,{onClick:()=>P(!w)}),o.jsx(QP,{isOpen:w,onClose:()=>P(!1)})]})]}),o.jsx("div",{ref:R,className:"flex-1 overflow-y-auto px-8 py-6 book-reader",children:ne?o.jsxs("div",{className:"flex items-center justify-center h-32",children:[o.jsx(Ve,{className:"w-6 h-6 text-gray-400"}),o.jsx("span",{className:"ml-2 text-gray-500 dark:text-gray-400",children:"Loading document..."})]}):O?o.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-700 dark:text-red-400",children:[o.jsx("p",{className:"font-medium",children:"Error loading document"}),o.jsx("p",{className:"text-sm mt-1",children:O.message})]}):o.jsx(jv,{chunks:se,activeChunkIndex:K,onRegisterChunk:$,scrollToChunk:t,showChunkNumbers:M.showChunkNumbers,getHighlightsForChunk:pe,onCreateHighlight:Ie,onHighlightClick:Me,getSearchMatchesForChunk:pn,currentSearchIndex:ye.currentIndex})})]}),o.jsx(ut,{mode:"wait",children:p?o.jsx("div",{className:"w-[60%] border-l border-gray-200 dark:border-gray-700",children:o.jsx(rT,{filePath:p.filePath,chunkIndex:p.chunkIndex,onClose:()=>h(null),onNavigate:(ve,Oe)=>{h(null),Bn(ve,Oe)}})},"split"):o.jsx("div",{className:"w-[40%] border-l border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-850",children:o.jsx(TP,{relatedChunks:_e,isLoading:q,activeChunkIndex:K,currentFilePath:e,onNavigateToChunk:Bn,onOpenSplit:Tn,pinnedChunkKeys:l,onTogglePin:c,highlights:bt,annotations:mt,onUpdateNote:Ye,onDeleteNote:ie,onDeleteHighlight:Kt,onChangeHighlightColor:Zr,backlinks:$n,outgoingLinks:Un,autoSelectionResults:Q,isAutoSearching:J,selectionText:L})},"margin")})]}),o.jsx(KP,{isOpen:j,onClose:()=>N(!1)}),o.jsx(XP,{isOpen:we,query:ye.query,matches:ye.matches,currentIndex:ye.currentIndex,caseSensitive:ye.caseSensitive,onQueryChange:Re,onToggleCaseSensitive:et,onNextMatch:Pt,onPreviousMatch:Wt,onGoToMatch:vt,onClose:Ce})]})}function Xu(e){const t=e.split(/[/\\]/);return t[t.length-1]||e}function dT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6m-6 4h6"})})}function pT({currentTrail:e,savedTrails:t,onSaveTrail:r,onLoadTrail:i,onDeleteTrail:l,onClearCurrentTrail:c,onNavigateToStep:d,isOpen:p,onClose:h,trailTree:m,currentNodeId:x,onSetCurrentNode:v}){const[b,w]=y.useState(!1),[P,j]=y.useState(""),[N,S]=y.useState("current"),T=()=>{P.trim()&&(r(P.trim()),j(""),w(!1))};return p?o.jsx(Pe.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:h,children:o.jsxs(Pe.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-lg w-full mx-4 max-h-[80vh] flex flex-col",onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:"Trail Manager"}),o.jsx("button",{type:"button",onClick:h,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded transition-colors",children:o.jsx(mT,{})})]}),o.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[o.jsxs("button",{type:"button",onClick:()=>S("current"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${N==="current"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:["Current Trail",e&&o.jsx("span",{className:"ml-2 text-xs bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded",children:e.steps.length})]}),o.jsxs("button",{type:"button",onClick:()=>S("saved"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${N==="saved"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:["Saved Trails",t.length>0&&o.jsx("span",{className:"ml-2 text-xs bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-1.5 py-0.5 rounded",children:t.length})]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:o.jsx(ut,{mode:"wait",children:N==="current"?o.jsx(Pe.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},children:e?o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"space-y-2",children:m?o.jsx(Nv,{node:m,depth:0,currentNodeId:x,onNavigate:k=>d(k.chunkKey.filePath,k.chunkKey.chunkIndex),onSetCurrent:k=>v==null?void 0:v(k)}):e.steps.map((k,E)=>o.jsx(fT,{step:k,index:E,isLast:E===e.steps.length-1,onNavigate:()=>d(k.chunkKey.filePath,k.chunkKey.chunkIndex)},`${k.chunkKey.filePath}-${k.chunkKey.chunkIndex}-${E}`))}),o.jsxs("div",{className:"flex gap-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[o.jsx("button",{type:"button",onClick:()=>w(!0),disabled:e.steps.length<2,className:"flex-1 px-3 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Save Trail"}),o.jsx("button",{type:"button",onClick:c,className:"px-3 py-2 text-sm font-medium text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:"Clear"})]})]}):o.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[o.jsx(gT,{}),o.jsx("p",{className:"mt-2",children:"No active trail"}),o.jsx("p",{className:"text-sm mt-1",children:"Navigate between documents to start recording"})]})},"current"):o.jsx(Pe.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:t.length>0?o.jsx("div",{className:"space-y-2",children:t.map(k=>o.jsx(hT,{trail:k,onLoad:()=>{i(k.id),h()},onDelete:()=>l(k.id)},k.id))}):o.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[o.jsx(xT,{}),o.jsx("p",{className:"mt-2",children:"No saved trails"}),o.jsx("p",{className:"text-sm mt-1",children:"Save your explorations to revisit later"})]})},"saved")})}),o.jsx(ut,{children:b&&o.jsx(Pe.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-black/30 flex items-center justify-center rounded-xl",children:o.jsxs(Pe.div,{initial:{scale:.9},animate:{scale:1},exit:{scale:.9},className:"bg-white dark:bg-gray-800 rounded-lg p-4 m-4 shadow-lg",children:[o.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Save Trail"}),o.jsx("input",{type:"text",value:P,onChange:k=>j(k.target.value),placeholder:"Enter trail name...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500",onKeyDown:k=>{k.key==="Enter"&&T(),k.key==="Escape"&&w(!1)}}),o.jsxs("div",{className:"flex gap-2 mt-3",children:[o.jsx("button",{type:"button",onClick:T,disabled:!P.trim(),className:"flex-1 px-3 py-1.5 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors",children:"Save"}),o.jsx("button",{type:"button",onClick:()=>w(!1),className:"px-3 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:"Cancel"})]})]})})})]})}):null}function fT({step:e,index:t,isLast:r,onNavigate:i}){const l=Cv(e.chunkKey.filePath);return o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium ${r?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400"}`,children:t+1}),!r&&o.jsx("div",{className:"w-0.5 h-4 bg-gray-200 dark:bg-gray-700"})]}),o.jsxs("button",{type:"button",onClick:i,className:"flex-1 text-left p-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-750 transition-colors",children:[o.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:l}),o.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Chunk #",e.chunkKey.chunkIndex,e.connectionReason&&o.jsxs("span",{className:"ml-2 italic",children:['via "',e.connectionReason,'"']})]})]})]})}function hT({trail:e,onLoad:t,onDelete:r}){const[i,l]=y.useState(!1);return o.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name}),o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:[e.steps.length," steps · ",new Date(e.updatedAt).toLocaleDateString()]})]}),o.jsx("div",{className:"flex items-center gap-1",children:i?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:r,className:"px-2 py-1 text-xs font-medium text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/30 rounded hover:bg-red-100 dark:hover:bg-red-900/50 transition-colors",children:"Delete"}),o.jsx("button",{type:"button",onClick:()=>l(!1),className:"px-2 py-1 text-xs font-medium text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:"Cancel"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:t,className:"px-2 py-1 text-xs font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",children:"Load"}),o.jsx("button",{type:"button",onClick:()=>l(!0),className:"px-2 py-1 text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded transition-colors",children:"Delete"})]})})]})})}function Cv(e){const t=e.split(/[/\\]/);return t[t.length-1]||e}function mT(){return o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function gT(){return o.jsx("svg",{className:"mx-auto h-10 w-10 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7"})})}function xT(){return o.jsx("svg",{className:"mx-auto h-10 w-10 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})})}function Nv({node:e,depth:t,currentNodeId:r,onNavigate:i,onSetCurrent:l}){const[c,d]=y.useState(!0),p=Cv(e.chunkKey.filePath),h=e.id===r,m=e.children.length>1;return o.jsxs("div",{className:"relative",children:[o.jsxs("div",{className:"flex items-start gap-2",children:[m?o.jsx("button",{type:"button",onClick:()=>d(!c),className:"mt-1 w-5 h-5 flex items-center justify-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:c?o.jsx(yT,{className:"w-4 h-4"}):o.jsx(vT,{className:"w-4 h-4"})}):o.jsx("div",{className:"w-5"}),o.jsx("div",{className:`
|
|
107
|
+
flex items-center justify-center min-w-[2rem] h-6 px-1.5 rounded text-xs font-medium
|
|
108
|
+
${h?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400"}
|
|
109
|
+
`,children:e.branchLabel||t+1}),o.jsxs("button",{type:"button",onClick:()=>{i(e),l(e.id)},className:`
|
|
110
|
+
flex-1 text-left p-2 rounded-lg transition-colors
|
|
111
|
+
${h?"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700":"hover:bg-gray-50 dark:hover:bg-gray-750"}
|
|
112
|
+
`,children:[o.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:p}),o.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Chunk #",e.chunkKey.chunkIndex,e.connectionReason&&o.jsxs("span",{className:"ml-2 italic",children:['via "',e.connectionReason,'"']})]})]})]}),c&&e.children.length>0&&o.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-gray-700 pl-2",children:e.children.map(x=>o.jsx(Nv,{node:x,depth:t+1,currentNodeId:r,onNavigate:i,onSetCurrent:l},x.id))})]})}function yT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function vT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function bT(e){try{let t=e.replace(/-/g,"+").replace(/_/g,"/");const r=t.length%4;r>0&&(t+="=".repeat(4-r));const i=atob(t),l=JSON.parse(i);if(l.v!==1)return console.error("Unsupported trail version:",l.v),null;if(!l.vault||!Array.isArray(l.steps))return console.error("Invalid trail structure"),null;for(const c of l.steps)if(typeof c.p!="string"||typeof c.c!="number")return console.error("Invalid step structure: each step must have p (string) and c (number)"),null;return l}catch(t){return console.error("Failed to decode trail:",t),null}}function kT(){const e=window.location.hash;return e.startsWith("#trail=")?e.slice(7):null}function wT(e,t){const r=[],i=[];if(e.vault!==t.currentVaultId&&r.push(`This trail was created in a different vault (${e.vault}). Some steps may not be available.`),e.steps.length===0)return i.push("Trail has no steps"),{success:!1,warnings:r,errors:i};const c=[],d=[];for(const h of e.steps)if(!(!h.p||typeof h.c!="number")){if(t.checkFileExists&&!t.checkFileExists(h.p)){d.push(h.p);continue}c.push({chunkKey:{filePath:h.p,chunkIndex:h.c},visitedAt:new Date().toISOString()})}if(d.length>0){const h=[...new Set(d)];r.push(`${h.length} file(s) not found and will be skipped: ${h.slice(0,3).join(", ")}${h.length>3?"...":""}`)}return c.length===0?(i.push("No valid steps found in trail"),{success:!1,warnings:r,errors:i}):{success:!0,trail:{id:crypto.randomUUID(),name:"Imported Trail",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),steps:c},warnings:r,errors:i}}function jT(){const[e]=Rx(),t=Ii(),[r,i]=y.useState(!1),[l,c]=y.useState(!1),[d,p]=y.useState(null),h=e.get("path"),m=e.get("chunk"),x=m?Number.parseInt(m,10):void 0,{pinnedChunkKeys:v,togglePin:b}=zN(),{currentTrail:w,savedTrails:P,addStep:j,saveTrail:N,loadTrail:S,deleteTrail:T,clearCurrentTrail:k}=$N();y.useEffect(()=>{const X=kT();if(!X)return;const se=bT(X);if(!se)return;const ne=wT(se,{currentVaultId:"default"});p({decoded:se,validation:ne}),c(!0),window.history.replaceState(null,"",window.location.pathname+window.location.search)},[]);const E=y.useCallback((X,se)=>{const ne=new URLSearchParams({path:X});se!==void 0&&ne.set("chunk",String(se)),t(`/read?${ne.toString()}`),j({filePath:X,chunkIndex:se??0})},[t,j]),R=y.useCallback(()=>{t("/")},[t]),M=y.useCallback((X,se)=>{!h||x===void 0||b({filePath:h,chunkIndex:x},{filePath:X,chunkIndex:se},"","",void 0)},[h,x,b]),H=y.useCallback(()=>{i(!0)},[]),B=y.useCallback(()=>{if(!(d!=null&&d.validation.trail))return;const X=d.validation.trail;if(X.steps.length>0){const se=X.steps[0];if(se){for(const ne of X.steps)j(ne.chunkKey);t(`/read?path=${encodeURIComponent(se.chunkKey.filePath)}&chunk=${se.chunkKey.chunkIndex}`)}}c(!1),p(null)},[d,j,t]),te=y.useCallback(()=>{c(!1),p(null)},[]);return h?o.jsxs("div",{className:"h-[calc(100vh-4rem)]",children:[o.jsx(uT,{filePath:h,initialChunkIndex:x,onNavigate:E,onGoHome:R,pinnedChunkKeys:v,onTogglePin:M,onSaveTrail:H}),o.jsx(pT,{currentTrail:w,savedTrails:P,onSaveTrail:N,onLoadTrail:X=>{const se=S(X);if(se&&se.steps.length>0){const ne=se.steps[0];ne&&E(ne.chunkKey.filePath,ne.chunkKey.chunkIndex)}},onDeleteTrail:T,onClearCurrentTrail:k,onNavigateToStep:E,isOpen:r,onClose:()=>i(!1)}),o.jsx(ut,{children:l&&d&&o.jsx(Pe.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:te,children:o.jsxs(Pe.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-md w-full mx-4 p-6",onClick:X=>X.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/40 rounded-lg",children:o.jsx(ST,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:"Import Shared Trail"}),o.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[d.decoded.steps.length," steps"]})]})]}),d.validation.warnings.length>0&&o.jsx("div",{className:"mb-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-700 rounded-lg",children:o.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:d.validation.warnings[0]})}),d.validation.errors.length>0&&o.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-700 rounded-lg",children:o.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:d.validation.errors[0]})}),d.validation.success&&d.validation.trail&&o.jsxs("div",{className:"mb-4 max-h-48 overflow-y-auto",children:[o.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Trail steps:"}),o.jsxs("div",{className:"space-y-1",children:[d.validation.trail.steps.slice(0,5).map((X,se)=>o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsxs("span",{className:"text-gray-400 w-4",children:[se+1,"."]}),o.jsx("span",{className:"text-gray-700 dark:text-gray-300 truncate",children:X.chunkKey.filePath.split("/").pop()}),o.jsxs("span",{className:"text-gray-400 text-xs",children:["#",X.chunkKey.chunkIndex]})]},`${X.chunkKey.filePath}::${X.chunkKey.chunkIndex}`)),d.validation.trail.steps.length>5&&o.jsxs("p",{className:"text-xs text-gray-400 pl-6",children:["+",d.validation.trail.steps.length-5," more steps"]})]})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx("button",{type:"button",onClick:te,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),d.validation.success&&o.jsx("button",{type:"button",onClick:B,className:"px-4 py-2 text-sm text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-colors",children:"Import & Navigate"})]})]})})})]}):o.jsx("div",{className:"max-w-4xl mx-auto py-12",children:o.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-700 rounded-lg p-6",children:[o.jsx("h2",{className:"text-lg font-semibold text-yellow-800 dark:text-yellow-200 mb-2",children:"No document selected"}),o.jsx("p",{className:"text-yellow-700 dark:text-yellow-300 mb-4",children:"Please select a document from the search results or files page to read."}),o.jsx("button",{type:"button",onClick:R,className:"px-4 py-2 bg-yellow-600 text-white rounded-lg hover:bg-yellow-700 transition-colors",children:"Go to Search"})]})})}function ST({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"})})}function CT({result:e,isOpen:t,onClose:r}){const[i,l]=y.useState(!1),c=e.source||e.filePath,d=y.useRef(null);y.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const p=async()=>{try{await navigator.clipboard.writeText(e.text),l(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>l(!1),2e3)}catch{}};return o.jsx(A4,{isOpen:t,onClose:r,title:"Document Preview",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4 p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Source:"}),o.jsx("p",{className:"font-medium text-gray-900 dark:text-gray-100 break-all",children:c})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Chunk:"}),o.jsxs("p",{className:"font-medium text-gray-900 dark:text-gray-100",children:["#",e.chunkIndex]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Score:"}),o.jsx("p",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.score.toFixed(4)})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"File Path:"}),o.jsx("p",{className:"font-medium text-gray-900 dark:text-gray-100 break-all truncate",title:e.filePath,children:e.filePath})]})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Content"}),o.jsx("button",{type:"button",onClick:p,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:i?o.jsxs(o.Fragment,{children:[o.jsx(ET,{}),"Copied"]}):o.jsxs(o.Fragment,{children:[o.jsx(NT,{}),"Copy"]})})]}),o.jsx("div",{className:"p-4 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg",children:o.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:e.text})})]})]})})}function NT(){return o.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}function ET(){return o.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function PT({onSearch:e,isLoading:t}){const[r,i]=y.useState(""),[l,c]=y.useState(10),d=p=>{p.preventDefault(),r.trim()&&e(r.trim(),l)};return o.jsxs("form",{onSubmit:d,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"query",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Search Query"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",id:"query",value:r,onChange:p=>i(p.target.value),placeholder:"Enter your search query...",className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",disabled:t}),o.jsx("button",{type:"submit",disabled:t||!r.trim(),className:"px-6 py-2 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:t?"Searching...":"Search"})]})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("label",{htmlFor:"limit",className:"text-sm text-gray-600 dark:text-gray-400",children:"Results limit:"}),o.jsxs("select",{id:"limit",value:l,onChange:p=>c(Number(p.target.value)),className:"px-3 py-1.5 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",children:[o.jsx("option",{value:5,children:"5"}),o.jsx("option",{value:10,children:"10"}),o.jsx("option",{value:20,children:"20"}),o.jsx("option",{value:50,children:"50"})]})]})]})}function TT({results:e,hasSearched:t}){const[r,i]=y.useState(null),l=Ii(),c=d=>{const p=new URLSearchParams({path:d.filePath});p.set("chunk",String(d.chunkIndex)),l(`/read?${p.toString()}`)};return t?e.length===0?o.jsx(I4,{icon:o.jsx(DT,{}),title:"No results found",description:"Try different keywords or a broader query."}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:["Results (",e.length,")"]}),o.jsx("div",{className:"space-y-3",children:e.map((d,p)=>o.jsx(RT,{result:d,rank:p+1,onView:()=>i(d),onRead:()=>c(d)},`${d.filePath}-${d.chunkIndex}`))}),r&&o.jsx(CT,{result:r,isOpen:!0,onClose:()=>i(null)})]}):null}function RT({result:e,rank:t,onView:r,onRead:i}){const l=e.source||e.filePath,c=AT(e.score);return o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 hover:shadow-md transition-shadow",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-sm font-medium text-gray-400 dark:text-gray-500",children:["#",t]}),o.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",title:l,children:LT(l)})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`px-2 py-0.5 text-xs font-medium rounded-full ${c}`,title:`Distance score: ${e.score.toFixed(4)}`,children:IT(e.score)}),o.jsx("button",{type:"button",onClick:i,className:"px-2 py-1 text-xs font-medium text-green-600 dark:text-green-400 hover:text-green-800 dark:hover:text-green-300 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",children:"Read"}),o.jsx("button",{type:"button",onClick:r,className:"px-2 py-1 text-xs font-medium text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",children:"View"})]})]}),o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 whitespace-pre-wrap line-clamp-4",children:e.text}),o.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs text-gray-400 dark:text-gray-500",children:[o.jsxs("span",{children:["Chunk #",e.chunkIndex]}),e.source&&o.jsx("span",{className:"truncate",title:e.filePath,children:e.filePath.split("/").pop()})]})]})}function DT(){return o.jsx("svg",{className:"h-12 w-12",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function LT(e){if(e.startsWith("/")||e.includes("\\"))return e.split(/[/\\]/).pop()||e;if(e.startsWith("http"))try{const t=new URL(e);return t.hostname+t.pathname.slice(0,30)+(t.pathname.length>30?"...":"")}catch{return`${e.slice(0,40)}...`}return e}function IT(e){return e<.3?"Excellent":e<.5?"Good":e<.7?"Fair":"Low"}function AT(e){return e<.3?"bg-green-100 text-green-800":e<.5?"bg-blue-100 text-blue-800":e<.7?"bg-yellow-100 text-yellow-800":"bg-gray-100 text-gray-800"}function MT(){const{results:e,search:t,isLoading:r,error:i,hasSearched:l}=LN();return o.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:"Search Documents"}),o.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Search through your ingested documents using semantic and keyword matching."})]}),o.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:o.jsx(PT,{onSearch:t,isLoading:r})}),i&&o.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-700 dark:text-red-400",children:[o.jsx("p",{className:"font-medium",children:"Search Error"}),o.jsx("p",{className:"text-sm",children:i.message})]}),!r&&!l&&!i&&o.jsx("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:o.jsx("p",{children:"Enter a search query to find relevant documents."})}),o.jsx(TT,{results:e,hasSearched:l&&!r})]})}function _p({isOpen:e,onClose:t,onSelect:r,initialPath:i,title:l="Select Folder"}){const{preferences:c,setLastBrowsedPath:d,setShowHiddenFiles:p}=Fl(),[h,m]=y.useState(i||c.lastBrowsedPath||"/"),{browse:x,isLoading:v,data:b,error:w}=mN();y.useEffect(()=>{if(e){const k=i||c.lastBrowsedPath||"/";m(k),x(k,c.showHiddenFiles)}},[e,i,c.lastBrowsedPath,c.showHiddenFiles,x]);const P=k=>{m(k),d(k),x(k,c.showHiddenFiles)},j=()=>{const k=h.split("/").slice(0,-1).join("/")||"/";P(k)},N=()=>{d(h),r(h),t()},S=()=>{const k=!c.showHiddenFiles;p(k),x(h,k)};if(!e)return null;const T=h.split("/").filter(Boolean);return o.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l}),o.jsx("button",{type:"button",onClick:t,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",children:o.jsx(FT,{className:"w-5 h-5"})})]}),o.jsxs("div",{className:"flex items-center gap-1 px-4 py-2 bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700 overflow-x-auto",children:[o.jsx("button",{type:"button",onClick:()=>P("/"),className:"px-2 py-1 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded",children:"/"}),T.map((k,E)=>{const R=`/${T.slice(0,E+1).join("/")}`;return o.jsxs("span",{className:"flex items-center",children:[o.jsx("span",{className:"text-gray-400",children:"/"}),o.jsx("button",{type:"button",onClick:()=>P(R),className:"px-2 py-1 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded truncate max-w-32",children:k})]},R)})]}),o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-amber-50 dark:bg-amber-900/20 border-b border-amber-100 dark:border-amber-800/30",children:[o.jsx("span",{className:"text-sm text-amber-800 dark:text-amber-200 font-mono truncate flex-1",children:h}),o.jsxs("label",{className:"flex items-center gap-2 ml-4 cursor-pointer select-none",children:[o.jsx("input",{type:"checkbox",checked:c.showHiddenFiles,onChange:S,className:"w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-amber-600 focus:ring-amber-500 dark:bg-gray-700"}),o.jsx("span",{className:"text-xs text-amber-700 dark:text-amber-300 whitespace-nowrap",children:"Show hidden"})]})]}),o.jsx("div",{className:"flex-1 overflow-auto p-2 min-h-[300px] bg-white dark:bg-gray-800",children:v?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(Ve,{className:"text-gray-400"}),o.jsx("span",{className:"ml-3 text-gray-500 dark:text-gray-400",children:"Loading..."})]}):w?o.jsxs("div",{className:"p-4 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 rounded-lg",children:[o.jsx("p",{className:"font-medium",children:"Error"}),o.jsx("p",{className:"text-sm",children:w.message})]}):o.jsxs("div",{className:"space-y-1",children:[h!=="/"&&o.jsxs("button",{type:"button",onClick:j,className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[o.jsx(zT,{className:"w-5 h-5 text-gray-400"}),o.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:".."})]}),b==null?void 0:b.entries.map(k=>o.jsx(OT,{entry:k,onNavigate:P},k.path)),(b==null?void 0:b.entries.length)===0&&o.jsx("p",{className:"text-center text-gray-500 dark:text-gray-400 py-8",children:"This directory is empty"})]})}),o.jsxs("div",{className:"flex items-center justify-end gap-3 p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:[o.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:"Cancel"}),o.jsx("button",{type:"button",onClick:N,className:"px-4 py-2 text-sm font-medium text-white bg-amber-600 rounded-lg hover:bg-amber-700 transition-colors",children:"Select This Folder"})]})]})})}function OT({entry:e,onNavigate:t}){const r=e.name.startsWith(".");return e.isDirectory?o.jsxs("button",{type:"button",onClick:()=>t(e.path),className:`w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors ${r?"opacity-60":""}`,children:[o.jsx(_T,{className:"w-5 h-5 text-amber-500"}),o.jsx("span",{className:"text-gray-900 dark:text-white truncate",children:e.name})]}):o.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 ${r?"opacity-50":""} text-gray-400 dark:text-gray-500`,children:[o.jsx(VT,{className:"w-5 h-5"}),o.jsx("span",{className:"truncate",children:e.name})]})}function FT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function _T({className:e}){return o.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"})})}function zT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2zM12 11v6m0-6l-3 3m3-3l3 3"})})}function VT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})})}function BT({data:e,isLoading:t,onAdd:r,onRemove:i,isAdding:l,isRemoving:c}){const[d,p]=y.useState(!1),[h,m]=y.useState(null),x=S=>{m(S),i(S)},v=S=>{r(S)},b=S=>(e==null?void 0:e.userRoots.includes(S))??!1,w=S=>(e==null?void 0:e.envRoots.includes(S))??!1,P=S=>S===(e==null?void 0:e.baseDir),j=S=>P(S)?"Base Dir":w(S)?"Env":b(S)?"Custom":"",N=S=>P(S)?"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":w(S)?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300":b(S)?"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300";return o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"p-2 bg-purple-50 dark:bg-purple-900/30 rounded-lg",children:o.jsx($T,{className:"w-6 h-6 text-purple-600 dark:text-purple-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-white",children:"Allowed Scan Roots"}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Directories where database scanning is permitted"})]})]}),o.jsx("button",{type:"button",onClick:()=>p(!0),disabled:l,className:"px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-2",children:l?o.jsxs(o.Fragment,{children:[o.jsx(Ve,{size:"sm"}),"Adding..."]}):o.jsxs(o.Fragment,{children:[o.jsx(UT,{className:"w-4 h-4"}),"Add Root"]})})]}),t?o.jsxs("div",{className:"flex items-center justify-center py-8",children:[o.jsx(Ve,{className:"text-gray-400"}),o.jsx("span",{className:"ml-3 text-gray-500 dark:text-gray-400",children:"Loading allowed roots..."})]}):o.jsxs("div",{className:"space-y-2",children:[e==null?void 0:e.roots.map(S=>o.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-900 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[o.jsx(WT,{className:"w-5 h-5 text-gray-400 flex-shrink-0"}),o.jsx("span",{className:"font-mono text-sm text-gray-700 dark:text-gray-300 truncate",title:S,children:S}),o.jsx("span",{className:`px-2 py-0.5 text-xs font-medium rounded-full flex-shrink-0 ${N(S)}`,children:j(S)})]}),b(S)&&o.jsx("button",{type:"button",onClick:()=>x(S),disabled:c,className:"ml-4 p-1 text-red-500 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-900/30 rounded disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:"Remove this root",children:c&&h===S?o.jsx(Ve,{size:"sm"}):o.jsx(HT,{className:"w-4 h-4"})})]},S)),(e==null?void 0:e.roots.length)===0&&o.jsx("p",{className:"text-center text-gray-500 dark:text-gray-400 py-4",children:"No allowed roots configured"})]}),o.jsxs("div",{className:"mt-4 text-xs text-gray-500 dark:text-gray-400 space-y-1",children:[o.jsxs("p",{children:[o.jsx("strong",{className:"text-gray-700 dark:text-gray-300",children:"Base Dir:"})," Current database directory (always allowed)"]}),o.jsxs("p",{children:[o.jsx("strong",{className:"text-gray-700 dark:text-gray-300",children:"Env:"})," Set via ALLOWED_SCAN_ROOTS environment variable"]}),o.jsxs("p",{children:[o.jsx("strong",{className:"text-gray-700 dark:text-gray-300",children:"Custom:"})," User-added roots (can be removed)"]})]}),o.jsx(_p,{isOpen:d,onClose:()=>p(!1),onSelect:v,title:"Add Allowed Root"})]})}function $T({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})}function UT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function WT({className:e}){return o.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"})})}function HT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function KT({models:e,value:t,onChange:r,isLoading:i=!1,disabled:l=!1,label:c="Embedding Model",id:d="model-selector"}){const p=e.find(h=>h.id===t)||e.find(h=>h.isDefault);return o.jsxs("div",{children:[c&&o.jsx("label",{htmlFor:d,className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:c}),o.jsxs("div",{className:"relative",children:[o.jsx("select",{id:d,value:t||(p==null?void 0:p.id)||"",onChange:h=>r(h.target.value),disabled:l||i,className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white focus:ring-2 focus:ring-amber-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed appearance-none pr-10",children:i?o.jsx("option",{children:"Loading models..."}):e.map(h=>o.jsxs("option",{value:h.id,children:[h.name," ",h.isDefault?"(default)":""]},h.id))}),o.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none",children:i?o.jsx(Ve,{size:"sm",className:"text-gray-400"}):o.jsx(qT,{className:"w-4 h-4 text-gray-400"})})]}),p&&o.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:p.description})]})}function qT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function QT({onCreate:e,isLoading:t,error:r}){var N;const[i,l]=y.useState(""),[c,d]=y.useState(""),[p,h]=y.useState(!1),[m,x]=y.useState(!1),{models:v,isLoading:b}=gN(),w=((N=v.find(S=>S.isDefault))==null?void 0:N.id)||"",P=S=>{S.preventDefault(),i.trim()&&(e(i.trim(),void 0,c||w),l(""),d(""),h(!1))},j=S=>{l(S)};return o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-2 bg-purple-50 dark:bg-purple-900/30 rounded-lg",children:o.jsx(GT,{className:"w-6 h-6 text-purple-600 dark:text-purple-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-white",children:"Create Database"}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Create a new RAG database"})]})]}),p?o.jsxs("form",{onSubmit:P,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"dbPath",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Database Path"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",id:"dbPath",value:i,onChange:S=>l(S.target.value),placeholder:"/path/to/new-database",className:"flex-1 px-3 py-2 bg-white dark:bg-gray-900 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-purple-500 focus:border-transparent",disabled:t}),o.jsx("button",{type:"button",onClick:()=>x(!0),disabled:t,className:"px-3 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:"Browse folders",children:o.jsx(YT,{className:"w-5 h-5"})})]}),o.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Enter the full path where you want to create the database"})]}),o.jsx(KT,{models:v,value:c||w,onChange:d,isLoading:b,disabled:t}),r&&o.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3 text-sm text-red-700 dark:text-red-300",children:r.message}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx("button",{type:"submit",disabled:t||!i.trim(),className:"flex-1 px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:t?o.jsxs("span",{className:"flex items-center justify-center gap-2",children:[o.jsx(Ve,{size:"sm"}),"Creating..."]}):"Create Database"}),o.jsx("button",{type:"button",onClick:()=>{h(!1),l(""),d("")},disabled:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 disabled:opacity-50 transition-colors",children:"Cancel"})]})]}):o.jsx("button",{type:"button",onClick:()=>h(!0),className:"w-full px-4 py-3 text-sm font-medium text-purple-700 dark:text-purple-300 bg-purple-50 dark:bg-purple-900/30 border border-purple-200 dark:border-purple-700 rounded-lg hover:bg-purple-100 dark:hover:bg-purple-900/50 transition-colors",children:"+ Create New Database"}),o.jsx(_p,{isOpen:m,onClose:()=>x(!1),onSelect:j,title:"Select Database Location"})]})}function GT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function YT({className:e}){return o.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"})})}const XT=[{value:0,label:"Off"},{value:3e4,label:"30s"},{value:6e4,label:"1m"},{value:3e5,label:"5m"}];function JT({config:e,onRefresh:t,isFetching:r}){const{preferences:i,setStatsRefreshInterval:l}=Fl();return o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"p-2 bg-green-50 dark:bg-green-900/30 rounded-lg",children:o.jsx(ZT,{className:"w-6 h-6 text-green-600 dark:text-green-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-white",children:"Current Database"}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Active RAG database"})]})]}),t&&o.jsx("button",{type:"button",onClick:t,disabled:r,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",title:"Refresh stats",children:r?o.jsx(Ve,{size:"sm"}):o.jsx(e3,{className:"w-5 h-5"})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-100 dark:border-gray-700",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Name"}),o.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:e.name})]}),o.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-100 dark:border-gray-700",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Path"}),o.jsx("span",{className:"font-mono text-sm text-gray-900 dark:text-gray-200 max-w-xs truncate",title:e.dbPath,children:e.dbPath})]}),o.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-100 dark:border-gray-700",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Model"}),o.jsx("span",{className:"font-mono text-sm text-gray-900 dark:text-gray-200",children:e.modelName})]}),o.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-100 dark:border-gray-700",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Documents"}),o.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:e.documentCount})]}),o.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-100 dark:border-gray-700",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Chunks"}),o.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:e.chunkCount})]}),o.jsxs("div",{className:"flex justify-between items-center py-2",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Auto-refresh"}),o.jsx("div",{className:"flex items-center gap-1 p-0.5 bg-gray-100 dark:bg-gray-700 rounded-lg",children:XT.map(({value:c,label:d})=>o.jsx("button",{type:"button",onClick:()=>l(c),className:`px-2 py-1 text-xs font-medium rounded transition-all ${i.statsRefreshInterval===c?"bg-white dark:bg-gray-600 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:d},c))})]})]})]})}function ZT({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"})})}function e3({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}function t3(e){const t=new Date(e),i=new Date().getTime()-t.getTime();if(i<6e4)return"Just now";if(i<36e5){const l=Math.floor(i/6e4);return`${l} minute${l>1?"s":""} ago`}if(i<864e5){const l=Math.floor(i/36e5);return`${l} hour${l>1?"s":""} ago`}if(i<6048e5){const l=Math.floor(i/864e5);return`${l} day${l>1?"s":""} ago`}return t.toLocaleDateString()}function n3(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),i=Math.floor(e%3600/60),l=Math.floor(e%60),c=[];return t>0&&c.push(`${t}d`),r>0&&c.push(`${r}h`),i>0&&c.push(`${i}m`),(l>0||c.length===0)&&c.push(`${l}s`),c.join(" ")}function r3(e){if(e===0||e<0)return"0 B";const t=["B","KB","MB","GB","TB"],r=1024,i=Math.min(Math.floor(Math.log(e)/Math.log(r)),t.length-1);return`${(e/r**i).toFixed(i===0?0:1)} ${t[i]}`}function s3({databases:e,currentDbPath:t,onSwitch:r,onDelete:i,isLoading:l}){const[c,d]=y.useState(null),[p,h]=y.useState(null),[m,x]=y.useState(null),v=j=>{d(j),r(j)},b=j=>{x({path:j.path,name:j.name})},w=async j=>{if(m){h(m.path);try{await i(m.path,j)}finally{h(null),x(null)}}},P=e.filter(j=>j.path!==t);return P.length===0?o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-2 bg-blue-50 dark:bg-blue-900/30 rounded-lg",children:o.jsx(jg,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-white",children:"Recent Databases"}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Switch between databases"})]})]}),o.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-sm",children:"No other databases available. Create a new database or scan for existing ones."})]}):o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-2 bg-blue-50 dark:bg-blue-900/30 rounded-lg",children:o.jsx(jg,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-white",children:"Recent Databases"}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Switch between databases"})]})]}),o.jsx("div",{className:"space-y-2",children:P.map(j=>o.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-900 rounded-lg",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:j.name}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono truncate max-w-xs",title:j.path,children:j.path}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 dark:text-gray-500",children:[o.jsxs("span",{children:["Last used: ",t3(j.lastAccessed)]}),j.modelName&&o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"·"}),o.jsx("span",{className:"font-mono",children:j.modelName.split("/").pop()})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[o.jsx("button",{type:"button",onClick:()=>v(j.path),disabled:l,className:"px-4 py-2 text-sm font-medium text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-700 rounded-lg hover:bg-blue-100 dark:hover:bg-blue-900/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:l&&c===j.path?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(Ve,{size:"sm"}),"Switching..."]}):"Switch"}),o.jsx("button",{type:"button",onClick:()=>b(j),disabled:l||p===j.path,className:"p-2 text-gray-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:"Remove database",children:p===j.path?o.jsx(Ve,{size:"sm"}):o.jsx(i3,{className:"w-5 h-5"})})]})]},j.path))}),m&&o.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md mx-4 shadow-xl",children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"Remove Database"}),o.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:["Remove ",o.jsx("span",{className:"font-medium",children:m.name})," from your recent databases?"]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("button",{type:"button",onClick:()=>w(!1),disabled:l,className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 disabled:opacity-50 transition-colors",children:"Remove from list only"}),o.jsx("button",{type:"button",onClick:()=>w(!0),disabled:l,className:"w-full px-4 py-2 text-sm font-medium text-white bg-red-600 rounded-lg hover:bg-red-700 disabled:opacity-50 transition-colors",children:"Delete files permanently"}),o.jsx("button",{type:"button",onClick:()=>x(null),disabled:l,className:"w-full px-4 py-2 text-sm font-medium text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors",children:"Cancel"})]})]})})]})}function jg({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"})})}function i3({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function a3(){const e=y.useRef(null),{exportConfigAsync:t,isLoading:r}=xN(),{importConfig:i,isLoading:l}=yN(),{addToast:c}=dn(),{exportLinks:d,importLinks:p}=Wl(),{exportAnnotations:h,importAnnotations:m}=gv(),{exportCollections:x,importCollections:v}=Fp(),{exportTags:b,importTags:w}=yv(),[P,j]=y.useState(!1),[N,S]=y.useState({includeLinks:!0,includeAnnotations:!0,includeCollections:!0,includeTags:!0,includeServerConfig:!0}),[T,k]=y.useState(!1),[E,R]=y.useState("merge"),[M,H]=y.useState(null),[B,te]=y.useState(!1),X=y.useCallback(async()=>{te(!0);try{const O={version:1,exportedAt:new Date().toISOString(),vaultId:"default",data:{}};if(N.includeLinks&&(O.data.links=JSON.parse(d())),N.includeAnnotations&&(O.data.annotations=JSON.parse(h())),N.includeCollections&&(O.data.collections=JSON.parse(x())),N.includeTags&&(O.data.tags=JSON.parse(b())),N.includeServerConfig)try{O.data.serverConfig=await t()}catch{}const _=new Blob([JSON.stringify(O,null,2)],{type:"application/json"}),$=URL.createObjectURL(_),K=document.createElement("a");K.href=$,K.download=`rag-vault-backup-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(K),K.click(),document.body.removeChild(K),URL.revokeObjectURL($),c({type:"success",title:"Export complete",message:"Your vault data has been exported"}),j(!1)}catch(O){c({type:"error",title:"Export failed",message:O instanceof Error?O.message:"Unknown error"})}finally{te(!1)}},[N,d,h,x,b,t,c]),se=y.useCallback(async O=>{var $;const _=($=O.target.files)==null?void 0:$[0];if(_){try{const K=await _.text(),W=JSON.parse(K);if(W.version===1&&W.data)H(W),k(!0);else if(W.version&&W.allowedRoots)i(W),c({type:"success",title:"Config imported",message:"Server configuration has been restored"});else throw new Error("Unrecognized file format")}catch(K){c({type:"error",title:"Failed to import",message:K instanceof Error?K.message:"Invalid file format"})}e.current&&(e.current.value="")}},[i,c]),ne=y.useCallback(async()=>{if(!M)return;te(!0);const O=[];let _=0;try{const{data:$}=M;if($.links){const{imported:K,errors:W}=p(JSON.stringify($.links));_+=K,W.length>0&&O.push(`Links: ${W.join(", ")}`)}if($.annotations){const{imported:K,errors:W}=m(JSON.stringify($.annotations));_+=K,W.length>0&&O.push(`Annotations: ${W.join(", ")}`)}if($.collections){const{imported:K,errors:W}=v(JSON.stringify($.collections));_+=K,W.length>0&&O.push(`Collections: ${W.join(", ")}`)}if($.tags){const{imported:K,errors:W}=w(JSON.stringify($.tags));_+=K,W.length>0&&O.push(`Tags: ${W.join(", ")}`)}if($.serverConfig)try{i($.serverConfig),O.push("Server config restored")}catch{O.push("Server config: import failed")}c({type:"success",title:"Import complete",message:`Imported ${_} items`})}catch($){c({type:"error",title:"Import failed",message:$ instanceof Error?$.message:"Unknown error"})}finally{te(!1),k(!1),H(null)}},[M,E,p,m,v,w,i,c]);return o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-2 bg-indigo-50 dark:bg-indigo-900/30 rounded-lg",children:o.jsx(o3,{className:"w-6 h-6 text-indigo-600 dark:text-indigo-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-white",children:"Export / Import"}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Backup and restore your vault data"})]})]}),P&&o.jsxs("div",{className:"mb-4 p-4 bg-gray-50 dark:bg-gray-750 rounded-lg border border-gray-200 dark:border-gray-600",children:[o.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Select data to export"}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:N.includeLinks,onChange:O=>S(_=>({..._,includeLinks:O.target.checked})),className:"w-4 h-4 text-indigo-600 rounded focus:ring-indigo-500"}),o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Links, trails & bookmarks"})]}),o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:N.includeAnnotations,onChange:O=>S(_=>({..._,includeAnnotations:O.target.checked})),className:"w-4 h-4 text-indigo-600 rounded focus:ring-indigo-500"}),o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Highlights & annotations"})]}),o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:N.includeCollections,onChange:O=>S(_=>({..._,includeCollections:O.target.checked})),className:"w-4 h-4 text-indigo-600 rounded focus:ring-indigo-500"}),o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Collections"})]}),o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:N.includeTags,onChange:O=>S(_=>({..._,includeTags:O.target.checked})),className:"w-4 h-4 text-indigo-600 rounded focus:ring-indigo-500"}),o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Tags"})]}),o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:N.includeServerConfig,onChange:O=>S(_=>({..._,includeServerConfig:O.target.checked})),className:"w-4 h-4 text-indigo-600 rounded focus:ring-indigo-500"}),o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Server config"})]})]}),o.jsxs("div",{className:"mt-4 flex gap-2",children:[o.jsxs("button",{type:"button",onClick:X,disabled:B,className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:[B?o.jsx(Ve,{size:"sm"}):o.jsx(Sg,{className:"w-4 h-4"}),"Export"]}),o.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-3 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:"Cancel"})]})]}),T&&M&&o.jsxs("div",{className:"mb-4 p-4 bg-gray-50 dark:bg-gray-750 rounded-lg border border-gray-200 dark:border-gray-600",children:[o.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Import vault backup"}),o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:["From: ",new Date(M.exportedAt).toLocaleDateString()]}),o.jsxs("div",{className:"mb-3 text-xs text-gray-600 dark:text-gray-400",children:[o.jsx("p",{className:"font-medium mb-1",children:"Contains:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5",children:[M.data.links&&o.jsx("li",{children:"Links, trails & bookmarks"}),M.data.annotations&&o.jsx("li",{children:"Highlights & annotations"}),M.data.collections&&o.jsx("li",{children:"Collections"}),M.data.tags&&o.jsx("li",{children:"Tags"}),M.data.serverConfig&&o.jsx("li",{children:"Server config"})]})]}),o.jsx("div",{className:"mb-3",children:o.jsxs("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:["Import strategy",o.jsxs("select",{value:E,onChange:O=>R(O.target.value),className:"mt-1 w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100",children:[o.jsx("option",{value:"merge",children:"Merge (skip duplicates)"}),o.jsx("option",{value:"overwrite",children:"Add all (may create duplicates)"})]})]})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{type:"button",onClick:ne,disabled:B,className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:[B?o.jsx(Ve,{size:"sm"}):o.jsx(Cg,{className:"w-4 h-4"}),"Import"]}),o.jsx("button",{type:"button",onClick:()=>{k(!1),H(null)},className:"px-3 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:"Cancel"})]})]}),!P&&!T&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[o.jsx("button",{type:"button",onClick:()=>j(!0),disabled:r||B,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r?o.jsxs(o.Fragment,{children:[o.jsx(Ve,{size:"sm"}),"Exporting..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Sg,{className:"w-4 h-4"}),"Export Vault"]})}),o.jsx("button",{type:"button",onClick:()=>{var O;return(O=e.current)==null?void 0:O.click()},disabled:l||B,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-900/30 border border-indigo-200 dark:border-indigo-700 rounded-lg hover:bg-indigo-100 dark:hover:bg-indigo-900/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:l?o.jsxs(o.Fragment,{children:[o.jsx(Ve,{size:"sm"}),"Importing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Cg,{className:"w-4 h-4"}),"Import Backup"]})}),o.jsx("input",{ref:e,type:"file",accept:".json",onChange:se,className:"hidden"})]}),o.jsx("p",{className:"mt-4 text-xs text-gray-500 dark:text-gray-400",children:"Export saves all your vault data including links, annotations, collections, and tags. Import restores from a previously exported backup."})]})}function o3({className:e}){return o.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function Sg({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}function Cg({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})}function l3(){const{weight:e,isLoading:t}=vN(),{setWeight:r,isLoading:i}=bN(),[l,c]=y.useState(e),[d,p]=y.useState(!1);y.useEffect(()=>{d||c(e)},[e,d]);const h=y.useCallback(b=>{const w=parseFloat(b.target.value);c(w),p(!0)},[]),m=y.useCallback(()=>{r(l),p(!1)},[l,r]),x=y.useCallback(()=>{c(e),p(!1)},[e]),v=b=>b===0?"Vector-only search (pure semantic similarity)":b<.3?"Minimal keyword boost, semantic-focused":b<.5?"Balanced toward semantic meaning":b<.7?"Balanced hybrid search (recommended)":b<.9?"Balanced toward keyword matching":b<1?"Strong keyword boost, keyword-focused":"Maximum keyword influence";return o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-2 bg-cyan-50 dark:bg-cyan-900/30 rounded-lg",children:o.jsx(c3,{className:"w-6 h-6 text-cyan-600 dark:text-cyan-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-white",children:"Hybrid Search Weight"}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Balance between semantic and keyword matching"})]})]}),t?o.jsxs("div",{className:"flex items-center justify-center py-8",children:[o.jsx(Ve,{className:"text-gray-400"}),o.jsx("span",{className:"ml-3 text-gray-500 dark:text-gray-400",children:"Loading settings..."})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Semantic"}),o.jsx("span",{className:"text-sm font-mono text-gray-900 dark:text-white",children:l.toFixed(2)}),o.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Keyword"})]}),o.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",value:l,onChange:h,className:"w-full h-2 bg-gray-200 dark:bg-gray-700 rounded-lg appearance-none cursor-pointer accent-cyan-600"}),o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 text-center",children:v(l)})]}),d&&o.jsxs("div",{className:"flex gap-2 mt-4",children:[o.jsx("button",{type:"button",onClick:m,disabled:i,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium text-white bg-cyan-600 rounded-lg hover:bg-cyan-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:i?o.jsxs(o.Fragment,{children:[o.jsx(Ve,{size:"sm"}),"Saving..."]}):"Apply"}),o.jsx("button",{type:"button",onClick:x,disabled:i,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:"Reset"})]})]}),o.jsx("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-gray-900 rounded-lg",children:o.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 space-y-1",children:[o.jsxs("span",{className:"block",children:[o.jsx("strong",{className:"text-gray-700 dark:text-gray-300",children:"Lower values (0.0-0.4):"})," ","Better for conceptual questions, finding related ideas"]}),o.jsxs("span",{className:"block",children:[o.jsx("strong",{className:"text-gray-700 dark:text-gray-300",children:"Higher values (0.6-1.0):"})," ","Better for exact terms, code, error messages"]})]})})]})}function c3({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function u3({onScan:e,onSwitch:t,isScanning:r,isSwitching:i,scanResults:l,error:c,onReset:d}){const[p,h]=y.useState(""),[m,x]=y.useState(null),[v,b]=y.useState(!1),w=S=>{S.preventDefault(),p.trim()&&e(p.trim())},P=S=>{x(S),t(S)},j=()=>{h(""),d()},N=S=>{h(S)};return o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-2 bg-amber-50 dark:bg-amber-900/30 rounded-lg",children:o.jsx(d3,{className:"w-6 h-6 text-amber-600 dark:text-amber-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-white",children:"Scan for Databases"}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Find existing RAG databases"})]})]}),o.jsx("form",{onSubmit:w,className:"space-y-4",children:o.jsxs("div",{children:[o.jsx("label",{htmlFor:"scanPath",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Directory to Scan"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",id:"scanPath",value:p,onChange:S=>h(S.target.value),placeholder:"/path/to/scan",className:"flex-1 px-3 py-2 bg-white dark:bg-gray-900 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-amber-500 focus:border-transparent",disabled:r}),o.jsx("button",{type:"button",onClick:()=>b(!0),disabled:r,className:"px-3 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:"Browse folders",children:o.jsx(p3,{className:"w-5 h-5"})}),o.jsx("button",{type:"submit",disabled:r||!p.trim(),className:"px-4 py-2 text-sm font-medium text-white bg-amber-600 rounded-lg hover:bg-amber-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(Ve,{size:"sm"}),"Scanning..."]}):"Scan"})]}),o.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Searches the directory and up to 2 levels of subdirectories"})]})}),c&&o.jsx("div",{className:"mt-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3 text-sm text-red-700 dark:text-red-300",children:c.message}),l&&o.jsxs("div",{className:"mt-4 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Found ",l.length," database",l.length!==1?"s":""]}),o.jsx("button",{type:"button",onClick:j,className:"text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",children:"Clear results"})]}),l.length===0?o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 py-2",children:"No databases found in this directory."}):o.jsx("div",{className:"space-y-2",children:l.map(S=>o.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-900 rounded-lg",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:S.name}),S.isKnown&&o.jsx("span",{className:"px-2 py-0.5 text-xs font-medium text-green-700 dark:text-green-300 bg-green-100 dark:bg-green-900/30 rounded-full",children:"Known"})]}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono truncate max-w-xs",title:S.path,children:S.path})]}),o.jsx("button",{type:"button",onClick:()=>P(S.path),disabled:i,className:"ml-4 px-4 py-2 text-sm font-medium text-amber-700 dark:text-amber-300 bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-700 rounded-lg hover:bg-amber-100 dark:hover:bg-amber-900/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:i&&m===S.path?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(Ve,{size:"sm"}),"Switching..."]}):"Use"})]},S.path))})]}),o.jsx(_p,{isOpen:v,onClose:()=>b(!1),onSelect:N,title:"Select Directory to Scan"})]})}function d3({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function p3({className:e}){return o.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"})})}const f3={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}},vs={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.3,ease:[.25,.1,.25,1]}}};function h3(){const{preferences:e}=Fl(),{config:t,isLoading:r,error:i,refetch:l,isFetching:c}=lv(e.statsRefreshInterval),{databases:d,isLoading:p}=oN(),{switchDatabase:h,isLoading:m}=lN(),{deleteDatabase:x,isLoading:v}=dN(),{createDatabase:b,isLoading:w,error:P}=cN(),{scan:j,isLoading:N,data:S,error:T,reset:k}=uN(),{data:E,isLoading:R}=pN(),{addRoot:M,isLoading:H}=fN(),{removeRoot:B,isLoading:te}=hN(),X=_=>{h(_)},se=async(_,$)=>{await new Promise((K,W)=>{x({dbPath:_,deleteFiles:$},{onSuccess:()=>K(),onError:q=>W(q)})})},ne=(_,$,K)=>{b({dbPath:_,modelName:K})},O=_=>{j(_)};return o.jsxs("div",{className:"max-w-4xl mx-auto",children:[o.jsxs("div",{className:"flex items-center justify-between mb-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Settings"}),o.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Manage your RAG database configuration."})]}),o.jsx("button",{type:"button",onClick:()=>l(),disabled:r||c,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors",children:r||c?"Refreshing...":"Refresh"})]}),r&&!t?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(Ve,{className:"text-gray-400"}),o.jsx("span",{className:"ml-3 text-gray-500 dark:text-gray-400",children:"Loading configuration..."})]}):i?o.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-700 dark:text-red-300",children:[o.jsx("p",{className:"font-medium",children:"Error loading configuration"}),o.jsx("p",{className:"text-sm",children:i.message})]}):o.jsxs(Pe.div,{className:"space-y-6",variants:f3,initial:"hidden",animate:"visible",children:[t&&o.jsx(Pe.div,{variants:vs,children:o.jsx(JT,{config:t,onRefresh:()=>l(),isFetching:c})}),!p&&o.jsx(Pe.div,{variants:vs,children:o.jsx(s3,{databases:d,currentDbPath:t==null?void 0:t.dbPath,onSwitch:X,onDelete:se,isLoading:m||v})}),o.jsx(Pe.div,{variants:vs,children:o.jsx(QT,{onCreate:ne,isLoading:w,error:P})}),o.jsx(Pe.div,{variants:vs,children:o.jsx(u3,{onScan:O,onSwitch:X,isScanning:N,isSwitching:m,scanResults:S,error:T,onReset:k})}),o.jsx(Pe.div,{variants:vs,children:o.jsx(BT,{data:E,isLoading:R,onAdd:M,onRemove:B,isAdding:H,isRemoving:te})}),o.jsx(Pe.div,{variants:vs,children:o.jsx(l3,{})}),o.jsx(Pe.div,{variants:vs,children:o.jsx(a3,{})})]})]})}function m3({status:e}){const t=[{label:"Documents",value:e.documentCount.toString(),icon:g3},{label:"Chunks",value:e.chunkCount.toString(),icon:x3},{label:"Memory Usage",value:r3(e.memoryUsage*1024*1024),icon:y3}];return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:t.map(r=>o.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"p-2 bg-blue-50 dark:bg-blue-900/30 rounded-lg",children:o.jsx(r.icon,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:r.label}),o.jsx("p",{className:"text-2xl font-semibold text-gray-900 dark:text-gray-100",children:r.value})]})]})},r.label))}),o.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:"System Info"}),o.jsxs("dl",{className:"space-y-3",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx("dt",{className:"text-gray-500 dark:text-gray-400",children:"Search Mode"}),o.jsx("dd",{className:"text-gray-900 dark:text-gray-100 font-mono text-sm",children:e.searchMode})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("dt",{className:"text-gray-500 dark:text-gray-400",children:"FTS Index"}),o.jsx("dd",{className:"text-gray-900 dark:text-gray-100 font-mono text-sm",children:e.ftsIndexEnabled?"Enabled":"Disabled"})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("dt",{className:"text-gray-500 dark:text-gray-400",children:"Uptime"}),o.jsx("dd",{className:"text-gray-900 dark:text-gray-100 font-mono text-sm",children:n3(e.uptime)})]})]})]})]})}function g3({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}function x3({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 10h16M4 14h16M4 18h16"})})}function y3({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"})})}function v3(){const{status:e,isLoading:t,error:r,refetch:i}=IN();return o.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:"System Status"}),o.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Monitor your RAG system metrics and configuration."})]}),o.jsx("button",{type:"button",onClick:()=>i(),disabled:t,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors",children:t?"Refreshing...":"Refresh"})]}),t&&!e?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(Ve,{className:"text-gray-400"}),o.jsx("span",{className:"ml-3 text-gray-500 dark:text-gray-400",children:"Loading status..."})]}):r?o.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-700 dark:text-red-400",children:[o.jsx("p",{className:"font-medium",children:"Error loading status"}),o.jsx("p",{className:"text-sm",children:r.message})]}):e?o.jsx(m3,{status:e}):null]})}function b3({onIngest:e,isIngesting:t}){const[r,i]=y.useState(""),[l,c]=y.useState(""),[d,p]=y.useState("text"),h=x=>{x.preventDefault(),r.trim()&&l.trim()&&e(r.trim(),l.trim(),d)},m=()=>{const x=new Date().toISOString().split("T")[0];c(d==="html"?`page://${x}`:d==="markdown"?`note://${x}`:`clipboard://${x}`)};return o.jsxs("form",{onSubmit:h,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"source",className:"block text-sm font-medium text-gray-700 mb-1",children:"Source Identifier"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",id:"source",value:l,onChange:x=>c(x.target.value),placeholder:"e.g., https://example.com or clipboard://2024-01-15",className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",disabled:t}),o.jsx("button",{type:"button",onClick:m,className:"px-3 py-2 text-sm text-gray-600 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors",children:"Generate"})]})]}),o.jsxs("div",{children:[o.jsx("label",{htmlFor:"format",className:"block text-sm font-medium text-gray-700 mb-1",children:"Content Format"}),o.jsxs("select",{id:"format",value:d,onChange:x=>p(x.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",disabled:t,children:[o.jsx("option",{value:"text",children:"Plain Text"}),o.jsx("option",{value:"html",children:"HTML"}),o.jsx("option",{value:"markdown",children:"Markdown"})]})]}),o.jsxs("div",{children:[o.jsx("label",{htmlFor:"content",className:"block text-sm font-medium text-gray-700 mb-1",children:"Content"}),o.jsx("textarea",{id:"content",value:r,onChange:x=>i(x.target.value),placeholder:"Paste your content here...",rows:10,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none resize-y",disabled:t})]}),o.jsx("button",{type:"submit",disabled:t||!r.trim()||!l.trim(),className:"w-full px-6 py-2 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:t?"Ingesting...":"Ingest Content"})]})}var Ju={exports:{}},Zu,Ng;function k3(){if(Ng)return Zu;Ng=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Zu=e,Zu}var ed,Eg;function w3(){if(Eg)return ed;Eg=1;var e=k3();function t(){}function r(){}return r.resetWarningCache=t,ed=function(){function i(d,p,h,m,x,v){if(v!==e){var b=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw b.name="Invariant Violation",b}}i.isRequired=i;function l(){return i}var c={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:l,element:i,elementType:i,instanceOf:l,node:i,objectOf:l,oneOf:l,oneOfType:l,shape:l,exact:l,checkPropTypes:r,resetWarningCache:t};return c.PropTypes=c,c},ed}var Pg;function j3(){return Pg||(Pg=1,Ju.exports=w3()()),Ju.exports}var S3=j3();const Fe=Wd(S3);function _s(e,t,r,i){function l(c){return c instanceof r?c:new r(function(d){d(c)})}return new(r||(r=Promise))(function(c,d){function p(x){try{m(i.next(x))}catch(v){d(v)}}function h(x){try{m(i.throw(x))}catch(v){d(v)}}function m(x){x.done?c(x.value):l(x.value).then(p,h)}m((i=i.apply(e,t||[])).next())})}const C3=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function Ti(e,t,r){const i=N3(e),{webkitRelativePath:l}=e,c=typeof t=="string"?t:typeof l=="string"&&l.length>0?l:`./${e.name}`;return typeof i.path!="string"&&Tg(i,"path",c),Tg(i,"relativePath",c),i}function N3(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const i=t.split(".").pop().toLowerCase(),l=C3.get(i);l&&Object.defineProperty(e,"type",{value:l,writable:!1,configurable:!1,enumerable:!0})}return e}function Tg(e,t,r){Object.defineProperty(e,t,{value:r,writable:!1,configurable:!1,enumerable:!0})}const E3=[".DS_Store","Thumbs.db"];function P3(e){return _s(this,void 0,void 0,function*(){return Ll(e)&&T3(e.dataTransfer)?I3(e.dataTransfer,e.type):R3(e)?D3(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?L3(e):[]})}function T3(e){return Ll(e)}function R3(e){return Ll(e)&&Ll(e.target)}function Ll(e){return typeof e=="object"&&e!==null}function D3(e){return _d(e.target.files).map(t=>Ti(t))}function L3(e){return _s(this,void 0,void 0,function*(){return(yield Promise.all(e.map(r=>r.getFile()))).map(r=>Ti(r))})}function I3(e,t){return _s(this,void 0,void 0,function*(){if(e.items){const r=_d(e.items).filter(l=>l.kind==="file");if(t!=="drop")return r;const i=yield Promise.all(r.map(A3));return Rg(Ev(i))}return Rg(_d(e.files).map(r=>Ti(r)))})}function Rg(e){return e.filter(t=>E3.indexOf(t.name)===-1)}function _d(e){if(e===null)return[];const t=[];for(let r=0;r<e.length;r++){const i=e[r];t.push(i)}return t}function A3(e){if(typeof e.webkitGetAsEntry!="function")return Dg(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?Pv(t):Dg(e,t)}function Ev(e){return e.reduce((t,r)=>[...t,...Array.isArray(r)?Ev(r):[r]],[])}function Dg(e,t){return _s(this,void 0,void 0,function*(){var r;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const c=yield e.getAsFileSystemHandle();if(c===null)throw new Error(`${e} is not a File`);if(c!==void 0){const d=yield c.getFile();return d.handle=c,Ti(d)}}const i=e.getAsFile();if(!i)throw new Error(`${e} is not a File`);return Ti(i,(r=t==null?void 0:t.fullPath)!==null&&r!==void 0?r:void 0)})}function M3(e){return _s(this,void 0,void 0,function*(){return e.isDirectory?Pv(e):O3(e)})}function Pv(e){const t=e.createReader();return new Promise((r,i)=>{const l=[];function c(){t.readEntries(d=>_s(this,void 0,void 0,function*(){if(d.length){const p=Promise.all(d.map(M3));l.push(p),c()}else try{const p=yield Promise.all(l);r(p)}catch(p){i(p)}}),d=>{i(d)})}c()})}function O3(e){return _s(this,void 0,void 0,function*(){return new Promise((t,r)=>{e.file(i=>{const l=Ti(i,e.fullPath);t(l)},i=>{r(i)})})})}var ml={},Lg;function F3(){return Lg||(Lg=1,ml.__esModule=!0,ml.default=function(e,t){if(e&&t){var r=Array.isArray(t)?t:t.split(",");if(r.length===0)return!0;var i=e.name||"",l=(e.type||"").toLowerCase(),c=l.replace(/\/.*$/,"");return r.some(function(d){var p=d.trim().toLowerCase();return p.charAt(0)==="."?i.toLowerCase().endsWith(p):p.endsWith("/*")?c===p.replace(/\/.*$/,""):l===p})}return!0}),ml}var _3=F3();const td=Wd(_3);function Ig(e){return B3(e)||V3(e)||Rv(e)||z3()}function z3(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
113
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function V3(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function B3(e){if(Array.isArray(e))return zd(e)}function Ag(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),r.push.apply(r,i)}return r}function Mg(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ag(Object(r),!0).forEach(function(i){Tv(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ag(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Tv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _a(e,t){return W3(e)||U3(e,t)||Rv(e,t)||$3()}function $3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
114
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rv(e,t){if(e){if(typeof e=="string")return zd(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zd(e,t)}}function zd(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function U3(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i=[],l=!0,c=!1,d,p;try{for(r=r.call(e);!(l=(d=r.next()).done)&&(i.push(d.value),!(t&&i.length===t));l=!0);}catch(h){c=!0,p=h}finally{try{!l&&r.return!=null&&r.return()}finally{if(c)throw p}}return i}}function W3(e){if(Array.isArray(e))return e}var H3=typeof td=="function"?td:td.default,K3="file-invalid-type",q3="file-too-large",Q3="file-too-small",G3="too-many-files",Y3=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=t.split(","),i=r.length>1?"one of ".concat(r.join(", ")):r[0];return{code:K3,message:"File type must be ".concat(i)}},Og=function(t){return{code:q3,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},Fg=function(t){return{code:Q3,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},X3={code:G3,message:"Too many files"};function J3(e){return e.type===""&&typeof e.getAsFile=="function"}function Dv(e,t){var r=e.type==="application/x-moz-file"||H3(e,t)||J3(e);return[r,r?null:Y3(t)]}function Lv(e,t,r){if(ws(e.size))if(ws(t)&&ws(r)){if(e.size>r)return[!1,Og(r)];if(e.size<t)return[!1,Fg(t)]}else{if(ws(t)&&e.size<t)return[!1,Fg(t)];if(ws(r)&&e.size>r)return[!1,Og(r)]}return[!0,null]}function ws(e){return e!=null}function Z3(e){var t=e.files,r=e.accept,i=e.minSize,l=e.maxSize,c=e.multiple,d=e.maxFiles,p=e.validator;return!c&&t.length>1||c&&d>=1&&t.length>d?!1:t.every(function(h){var m=Dv(h,r),x=_a(m,1),v=x[0],b=Lv(h,i,l),w=_a(b,1),P=w[0],j=p?p(h):null;return v&&P&&!j})}function Il(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function wa(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function _g(e){e.preventDefault()}function e5(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function t5(e){return e.indexOf("Edge/")!==-1}function n5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return e5(e)||t5(e)}function Mn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(i){for(var l=arguments.length,c=new Array(l>1?l-1:0),d=1;d<l;d++)c[d-1]=arguments[d];return t.some(function(p){return!Il(i)&&p&&p.apply(void 0,[i].concat(c)),Il(i)})}}function r5(){return"showOpenFilePicker"in window}function s5(e){if(ws(e)){var t=Object.entries(e).filter(function(r){var i=_a(r,2),l=i[0],c=i[1],d=!0;return Iv(l)||(console.warn('Skipped "'.concat(l,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),d=!1),(!Array.isArray(c)||!c.every(Av))&&(console.warn('Skipped "'.concat(l,'" because an invalid file extension was provided.')),d=!1),d}).reduce(function(r,i){var l=_a(i,2),c=l[0],d=l[1];return Mg(Mg({},r),{},Tv({},c,d))},{});return[{description:"Files",accept:t}]}return e}function i5(e){if(ws(e))return Object.entries(e).reduce(function(t,r){var i=_a(r,2),l=i[0],c=i[1];return[].concat(Ig(t),[l],Ig(c))},[]).filter(function(t){return Iv(t)||Av(t)}).join(",")}function a5(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function o5(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function Iv(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function Av(e){return/^.*\.[\w]+$/.test(e)}var l5=["children"],c5=["open"],u5=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],d5=["refKey","onChange","onClick"];function zg(e){return h5(e)||f5(e)||Mv(e)||p5()}function p5(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
115
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function f5(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function h5(e){if(Array.isArray(e))return Vd(e)}function nd(e,t){return x5(e)||g5(e,t)||Mv(e,t)||m5()}function m5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
116
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mv(e,t){if(e){if(typeof e=="string")return Vd(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vd(e,t)}}function Vd(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function g5(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i=[],l=!0,c=!1,d,p;try{for(r=r.call(e);!(l=(d=r.next()).done)&&(i.push(d.value),!(t&&i.length===t));l=!0);}catch(h){c=!0,p=h}finally{try{!l&&r.return!=null&&r.return()}finally{if(c)throw p}}return i}}function x5(e){if(Array.isArray(e))return e}function Vg(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),r.push.apply(r,i)}return r}function Ue(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vg(Object(r),!0).forEach(function(i){Bd(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vg(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Bd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Al(e,t){if(e==null)return{};var r=y5(e,t),i,l;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(l=0;l<c.length;l++)i=c[l],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function y5(e,t){if(e==null)return{};var r={},i=Object.keys(e),l,c;for(c=0;c<i.length;c++)l=i[c],!(t.indexOf(l)>=0)&&(r[l]=e[l]);return r}var zp=y.forwardRef(function(e,t){var r=e.children,i=Al(e,l5),l=Fv(i),c=l.open,d=Al(l,c5);return y.useImperativeHandle(t,function(){return{open:c}},[c]),lw.createElement(y.Fragment,null,r(Ue(Ue({},d),{},{open:c})))});zp.displayName="Dropzone";var Ov={disabled:!1,getFilesFromEvent:P3,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};zp.defaultProps=Ov;zp.propTypes={children:Fe.func,accept:Fe.objectOf(Fe.arrayOf(Fe.string)),multiple:Fe.bool,preventDropOnDocument:Fe.bool,noClick:Fe.bool,noKeyboard:Fe.bool,noDrag:Fe.bool,noDragEventsBubbling:Fe.bool,minSize:Fe.number,maxSize:Fe.number,maxFiles:Fe.number,disabled:Fe.bool,getFilesFromEvent:Fe.func,onFileDialogCancel:Fe.func,onFileDialogOpen:Fe.func,useFsAccessApi:Fe.bool,autoFocus:Fe.bool,onDragEnter:Fe.func,onDragLeave:Fe.func,onDragOver:Fe.func,onDrop:Fe.func,onDropAccepted:Fe.func,onDropRejected:Fe.func,onError:Fe.func,validator:Fe.func};var $d={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function Fv(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Ue(Ue({},Ov),e),r=t.accept,i=t.disabled,l=t.getFilesFromEvent,c=t.maxSize,d=t.minSize,p=t.multiple,h=t.maxFiles,m=t.onDragEnter,x=t.onDragLeave,v=t.onDragOver,b=t.onDrop,w=t.onDropAccepted,P=t.onDropRejected,j=t.onFileDialogCancel,N=t.onFileDialogOpen,S=t.useFsAccessApi,T=t.autoFocus,k=t.preventDropOnDocument,E=t.noClick,R=t.noKeyboard,M=t.noDrag,H=t.noDragEventsBubbling,B=t.onError,te=t.validator,X=y.useMemo(function(){return i5(r)},[r]),se=y.useMemo(function(){return s5(r)},[r]),ne=y.useMemo(function(){return typeof N=="function"?N:Bg},[N]),O=y.useMemo(function(){return typeof j=="function"?j:Bg},[j]),_=y.useRef(null),$=y.useRef(null),K=y.useReducer(v5,$d),W=nd(K,2),q=W[0],Q=W[1],J=q.isFocused,L=q.isFileDialogActive,G=y.useRef(typeof window<"u"&&window.isSecureContext&&S&&r5()),be=function(){!G.current&&L&&setTimeout(function(){if($.current){var pe=$.current.files;pe.length||(Q({type:"closeDialog"}),O())}},300)};y.useEffect(function(){return window.addEventListener("focus",be,!1),function(){window.removeEventListener("focus",be,!1)}},[$,L,O,G]);var ge=y.useRef([]),ye=y.useRef([]),we=function(pe){_.current&&_.current.contains(pe.target)||(pe.preventDefault(),ge.current=[])};y.useEffect(function(){return k&&(document.addEventListener("dragover",_g,!1),document.addEventListener("drop",we,!1)),function(){k&&(document.removeEventListener("dragover",_g),document.removeEventListener("drop",we))}},[_,k]),y.useEffect(function(){var ie=function(it){ye.current=[].concat(zg(ye.current),[it.target]),wa(it)&&Q({isDragGlobal:!0,type:"setDragGlobal"})},pe=function(it){ye.current=ye.current.filter(function(_e){return _e!==it.target&&_e!==null}),!(ye.current.length>0)&&Q({isDragGlobal:!1,type:"setDragGlobal"})},Ie=function(){ye.current=[],Q({isDragGlobal:!1,type:"setDragGlobal"})},Me=function(){ye.current=[],Q({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",ie,!1),document.addEventListener("dragleave",pe,!1),document.addEventListener("dragend",Ie,!1),document.addEventListener("drop",Me,!1),function(){document.removeEventListener("dragenter",ie),document.removeEventListener("dragleave",pe),document.removeEventListener("dragend",Ie),document.removeEventListener("drop",Me)}},[_]),y.useEffect(function(){return!i&&T&&_.current&&_.current.focus(),function(){}},[_,T,i]);var Se=y.useCallback(function(ie){B?B(ie):console.error(ie)},[B]),Ce=y.useCallback(function(ie){ie.preventDefault(),ie.persist(),Kt(ie),ge.current=[].concat(zg(ge.current),[ie.target]),wa(ie)&&Promise.resolve(l(ie)).then(function(pe){if(!(Il(ie)&&!H)){var Ie=pe.length,Me=Ie>0&&Z3({files:pe,accept:X,minSize:d,maxSize:c,multiple:p,maxFiles:h,validator:te}),Ye=Ie>0&&!Me;Q({isDragAccept:Me,isDragReject:Ye,isDragActive:!0,type:"setDraggedFiles"}),m&&m(ie)}}).catch(function(pe){return Se(pe)})},[l,m,Se,H,X,d,c,p,h,te]),Re=y.useCallback(function(ie){ie.preventDefault(),ie.persist(),Kt(ie);var pe=wa(ie);if(pe&&ie.dataTransfer)try{ie.dataTransfer.dropEffect="copy"}catch{}return pe&&v&&v(ie),!1},[v,H]),et=y.useCallback(function(ie){ie.preventDefault(),ie.persist(),Kt(ie);var pe=ge.current.filter(function(Me){return _.current&&_.current.contains(Me)}),Ie=pe.indexOf(ie.target);Ie!==-1&&pe.splice(Ie,1),ge.current=pe,!(pe.length>0)&&(Q({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),wa(ie)&&x&&x(ie))},[_,x,H]),Pt=y.useCallback(function(ie,pe){var Ie=[],Me=[];ie.forEach(function(Ye){var it=Dv(Ye,X),_e=nd(it,2),Bn=_e[0],Tn=_e[1],fr=Lv(Ye,d,c),hr=nd(fr,2),$n=hr[0],Un=hr[1],Wn=te?te(Ye):null;if(Bn&&$n&&!Wn)Ie.push(Ye);else{var Hn=[Tn,Un];Wn&&(Hn=Hn.concat(Wn)),Me.push({file:Ye,errors:Hn.filter(function(ns){return ns})})}}),(!p&&Ie.length>1||p&&h>=1&&Ie.length>h)&&(Ie.forEach(function(Ye){Me.push({file:Ye,errors:[X3]})}),Ie.splice(0)),Q({acceptedFiles:Ie,fileRejections:Me,isDragReject:Me.length>0,type:"setFiles"}),b&&b(Ie,Me,pe),Me.length>0&&P&&P(Me,pe),Ie.length>0&&w&&w(Ie,pe)},[Q,p,X,d,c,h,b,w,P,te]),Wt=y.useCallback(function(ie){ie.preventDefault(),ie.persist(),Kt(ie),ge.current=[],wa(ie)&&Promise.resolve(l(ie)).then(function(pe){Il(ie)&&!H||Pt(pe,ie)}).catch(function(pe){return Se(pe)}),Q({type:"reset"})},[l,Pt,Se,H]),vt=y.useCallback(function(){if(G.current){Q({type:"openDialog"}),ne();var ie={multiple:p,types:se};window.showOpenFilePicker(ie).then(function(pe){return l(pe)}).then(function(pe){Pt(pe,null),Q({type:"closeDialog"})}).catch(function(pe){a5(pe)?(O(pe),Q({type:"closeDialog"})):o5(pe)?(G.current=!1,$.current?($.current.value=null,$.current.click()):Se(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):Se(pe)});return}$.current&&(Q({type:"openDialog"}),ne(),$.current.value=null,$.current.click())},[Q,ne,O,S,Pt,Se,se,p]),pn=y.useCallback(function(ie){!_.current||!_.current.isEqualNode(ie.target)||(ie.key===" "||ie.key==="Enter"||ie.keyCode===32||ie.keyCode===13)&&(ie.preventDefault(),vt())},[_,vt]),fn=y.useCallback(function(){Q({type:"focus"})},[]),Pn=y.useCallback(function(){Q({type:"blur"})},[]),hn=y.useCallback(function(){E||(n5()?setTimeout(vt,0):vt())},[E,vt]),bt=function(pe){return i?null:pe},mt=function(pe){return R?null:bt(pe)},Ht=function(pe){return M?null:bt(pe)},Kt=function(pe){H&&pe.stopPropagation()},Zr=y.useMemo(function(){return function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},pe=ie.refKey,Ie=pe===void 0?"ref":pe,Me=ie.role,Ye=ie.onKeyDown,it=ie.onFocus,_e=ie.onBlur,Bn=ie.onClick,Tn=ie.onDragEnter,fr=ie.onDragOver,hr=ie.onDragLeave,$n=ie.onDrop,Un=Al(ie,u5);return Ue(Ue(Bd({onKeyDown:mt(Mn(Ye,pn)),onFocus:mt(Mn(it,fn)),onBlur:mt(Mn(_e,Pn)),onClick:bt(Mn(Bn,hn)),onDragEnter:Ht(Mn(Tn,Ce)),onDragOver:Ht(Mn(fr,Re)),onDragLeave:Ht(Mn(hr,et)),onDrop:Ht(Mn($n,Wt)),role:typeof Me=="string"&&Me!==""?Me:"presentation"},Ie,_),!i&&!R?{tabIndex:0}:{}),Un)}},[_,pn,fn,Pn,hn,Ce,Re,et,Wt,R,M,i]),es=y.useCallback(function(ie){ie.stopPropagation()},[]),ts=y.useMemo(function(){return function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},pe=ie.refKey,Ie=pe===void 0?"ref":pe,Me=ie.onChange,Ye=ie.onClick,it=Al(ie,d5),_e=Bd({accept:X,multiple:p,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:bt(Mn(Me,Wt)),onClick:bt(Mn(Ye,es)),tabIndex:-1},Ie,$);return Ue(Ue({},_e),it)}},[$,r,p,Wt,i]);return Ue(Ue({},q),{},{isFocused:J&&!i,getRootProps:Zr,getInputProps:ts,rootRef:_,inputRef:$,open:bt(vt)})}function v5(e,t){switch(t.type){case"focus":return Ue(Ue({},e),{},{isFocused:!0});case"blur":return Ue(Ue({},e),{},{isFocused:!1});case"openDialog":return Ue(Ue({},$d),{},{isFileDialogActive:!0});case"closeDialog":return Ue(Ue({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Ue(Ue({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Ue(Ue({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:t.isDragReject});case"setDragGlobal":return Ue(Ue({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return Ue({},$d);default:return e}}function Bg(){}const b5={"application/pdf":[".pdf"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"text/plain":[".txt"],"text/markdown":[".md"],"text/html":[".html"],"application/json":[".json"]};function k5({onFilesSelect:e,isUploading:t}){const r=y.useCallback(d=>{d.length>0&&e(d)},[e]),{getRootProps:i,getInputProps:l,isDragActive:c}=Fv({onDrop:r,accept:b5,multiple:!0,disabled:t,maxSize:100*1024*1024});return o.jsxs("div",{...i(),className:`
|
|
117
|
+
border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors
|
|
118
|
+
${c?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}
|
|
119
|
+
${t?"opacity-50 cursor-not-allowed":""}
|
|
120
|
+
`,children:[o.jsx("input",{...l()}),o.jsx(w5,{className:"w-12 h-12 mx-auto text-gray-400 dark:text-gray-500 mb-4"}),c?o.jsx("p",{className:"text-blue-600 dark:text-blue-400 font-medium",children:"Drop files here..."}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-gray-600 dark:text-gray-300 font-medium mb-1",children:"Drag and drop files here, or click to select"}),o.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:"Supports PDF, DOCX, TXT, MD, HTML, JSON (max 100MB each)"})]})]})}function w5({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})})}function j5(){const[e,t]=y.useState("file"),[r,i]=y.useState([]),[l,c]=y.useState(!1),{uploadFile:d,ingestData:p,isIngesting:h,ingestError:m,ingestResult:x,reset:v}=AN(),b=y.useCallback(async E=>{const R=E.map(M=>({file:M,status:"pending"}));i(R),c(!0);for(let M=0;M<R.length;M++){const H=R[M];H&&(i(B=>B.map((te,X)=>X===M?{...te,status:"uploading"}:te)),await new Promise(B=>{d(H.file,{onSuccess:te=>{i(X=>X.map((se,ne)=>ne===M?{...se,status:"success",chunkCount:te.chunkCount}:se)),B()},onError:te=>{i(X=>X.map((se,ne)=>ne===M?{...se,status:"error",error:te.message}:se)),B()}})}))}c(!1)},[d]),w=E=>{v(),i([]),b(E)},P=(E,R,M)=>{v(),i([]),p({content:E,source:R,format:M})},j=()=>{i([])},N=r.filter(E=>E.status==="success").length,S=r.filter(E=>E.status==="error").length,T=r.reduce((E,R)=>E+(R.chunkCount||0),0),k=l||h;return o.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Upload Content"}),o.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Add documents to your knowledge base for semantic search."})]}),o.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700",children:o.jsxs("nav",{className:"-mb-px flex gap-6",children:[o.jsx("button",{type:"button",onClick:()=>t("file"),className:`py-3 px-1 border-b-2 font-medium text-sm transition-colors ${e==="file"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,children:"Upload Files"}),o.jsx("button",{type:"button",onClick:()=>t("content"),className:`py-3 px-1 border-b-2 font-medium text-sm transition-colors ${e==="content"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,children:"Paste Content"})]})}),o.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:e==="file"?o.jsx(k5,{onFilesSelect:w,isUploading:l}):o.jsx(b3,{onIngest:P,isIngesting:h})}),r.length>0&&o.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("h3",{className:"font-medium text-gray-900 dark:text-white",children:["Upload Progress (",N,"/",r.length,")"]}),!l&&o.jsx("button",{type:"button",onClick:j,className:"text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",children:"Clear"})]}),o.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:r.map((E,R)=>o.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-gray-50 dark:bg-gray-900",children:[o.jsxs("div",{className:"flex-shrink-0",children:[E.status==="pending"&&o.jsx("div",{className:"w-5 h-5 rounded-full border-2 border-gray-300 dark:border-gray-600"}),E.status==="uploading"&&o.jsx(Ve,{className:"w-5 h-5 text-blue-600"}),E.status==="success"&&o.jsx(S5,{className:"w-5 h-5 text-green-600"}),E.status==="error"&&o.jsx(C5,{className:"w-5 h-5 text-red-600"})]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:E.file.name}),E.status==="success"&&E.chunkCount&&o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[E.chunkCount," chunks created"]}),E.status==="error"&&E.error&&o.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:E.error})]}),o.jsxs("div",{className:"text-xs text-gray-400",children:[(E.file.size/1024).toFixed(0)," KB"]})]},`${E.file.name}-${R}`))}),!l&&r.length>0&&o.jsx("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700",children:o.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:[N>0&&o.jsxs("span",{className:"text-green-600 dark:text-green-400",children:[N," file",N!==1?"s":""," uploaded (",T," ","chunks)"]}),N>0&&S>0&&" • ",S>0&&o.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[S," failed"]})]})})]}),h&&o.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 flex items-center gap-3",children:[o.jsx(Ve,{className:"text-blue-600"}),o.jsx("span",{className:"text-blue-700 dark:text-blue-300",children:"Processing content..."})]}),m&&o.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-700 dark:text-red-300",children:[o.jsx("p",{className:"font-medium",children:"Error"}),o.jsx("p",{className:"text-sm",children:m.message})]}),x&&!k&&o.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4 text-green-700 dark:text-green-300",children:[o.jsx("p",{className:"font-medium",children:"Content Ingested Successfully"}),o.jsxs("div",{className:"text-sm mt-1 space-y-1",children:[o.jsxs("p",{children:["Chunks created: ",x.chunkCount]}),o.jsx("p",{className:"text-gray-500 dark:text-gray-400 truncate",children:x.filePath})]})]})]})}function S5({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function C5({className:e}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function N5(){return o.jsx(r2,{children:o.jsx($E,{children:o.jsxs(j1,{children:[o.jsx(Or,{path:"/",element:o.jsx(MT,{})}),o.jsx(Or,{path:"/read",element:o.jsx(KE,{children:o.jsx(jT,{})})}),o.jsx(Or,{path:"/upload",element:o.jsx(j5,{})}),o.jsx(Or,{path:"/files",element:o.jsx(eP,{})}),o.jsx(Or,{path:"/collections",element:o.jsx(qE,{})}),o.jsx(Or,{path:"/status",element:o.jsx(v3,{})}),o.jsx(Or,{path:"/settings",element:o.jsx(h3,{})})]})})})}const E5=y.createContext(null);function P5({children:e,vaultId:t="default"}){const r=`rag-vault-reading-mode-${t}`,[i,l]=Nn(r,"full"),c=y.useCallback(h=>{l(h)},[l]),d=y.useCallback(()=>{l(h=>h==="skim"?"full":"skim")},[l]),p=y.useMemo(()=>({mode:i,setMode:c,toggleMode:d,isSkimMode:i==="skim",isFullMode:i==="full"}),[i,c,d]);return o.jsx(E5.Provider,{value:p,children:e})}const T5=new ow({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}}),_v=document.getElementById("root");if(!_v)throw new Error('Root element not found. Ensure index.html has <div id="root"></div>');Nw.createRoot(_v).render(o.jsx(y.StrictMode,{children:o.jsx(cw,{client:T5,children:o.jsx(Q1,{children:o.jsx(a2,{children:o.jsx(U4,{children:o.jsx(_N,{children:o.jsx(tE,{children:o.jsx(uE,{children:o.jsx(hE,{children:o.jsx(xE,{children:o.jsx(P5,{children:o.jsx(bE,{children:o.jsx(N5,{})})})})})})})})})})})})}));
|