cortex-md 1.1.1

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.
@@ -0,0 +1,121 @@
1
+ function YC(e,t){for(var r=0;r<t.length;r++){const o=t[r];if(typeof o!="string"&&!Array.isArray(o)){for(const i in o)if(i!=="default"&&!(i in e)){const c=Object.getOwnPropertyDescriptor(o,i);c&&Object.defineProperty(e,i,c.get?c:{enumerable:!0,get:()=>o[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))o(i);new MutationObserver(i=>{for(const c of i)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&o(u)}).observe(document,{childList:!0,subtree:!0});function r(i){const c={};return i.integrity&&(c.integrity=i.integrity),i.referrerPolicy&&(c.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?c.credentials="include":i.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(i){if(i.ep)return;i.ep=!0;const c=r(i);fetch(i.href,c)}})();function $v(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jd={exports:{}},Mi={},ef={exports:{}},Fe={};var cx;function XC(){if(cx)return Fe;cx=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),v=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function k(D,K,ue){this.props=D,this.context=K,this.refs=b,this.updater=ue||S}k.prototype.isReactComponent={},k.prototype.setState=function(D,K){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,K,"setState")},k.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function N(){}N.prototype=k.prototype;function E(D,K,ue){this.props=D,this.context=K,this.refs=b,this.updater=ue||S}var R=E.prototype=new N;R.constructor=E,C(R,k.prototype),R.isPureReactComponent=!0;var T=Array.isArray,M=Object.prototype.hasOwnProperty,F={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function O(D,K,ue){var ge,Ce={},fe=null,Z=null;if(K!=null)for(ge in K.ref!==void 0&&(Z=K.ref),K.key!==void 0&&(fe=""+K.key),K)M.call(K,ge)&&!I.hasOwnProperty(ge)&&(Ce[ge]=K[ge]);var H=arguments.length-2;if(H===1)Ce.children=ue;else if(1<H){for(var ne=Array(H),ae=0;ae<H;ae++)ne[ae]=arguments[ae+2];Ce.children=ne}if(D&&D.defaultProps)for(ge in H=D.defaultProps,H)Ce[ge]===void 0&&(Ce[ge]=H[ge]);return{$$typeof:e,type:D,key:fe,ref:Z,props:Ce,_owner:F.current}}function q(D,K){return{$$typeof:e,type:D.type,key:K,ref:D.ref,props:D.props,_owner:D._owner}}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function G(D){var K={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(ue){return K[ue]})}var _=/\/+/g;function ee(D,K){return typeof D=="object"&&D!==null&&D.key!=null?G(""+D.key):K.toString(36)}function X(D,K,ue,ge,Ce){var fe=typeof D;(fe==="undefined"||fe==="boolean")&&(D=null);var Z=!1;if(D===null)Z=!0;else switch(fe){case"string":case"number":Z=!0;break;case"object":switch(D.$$typeof){case e:case t:Z=!0}}if(Z)return Z=D,Ce=Ce(Z),D=ge===""?"."+ee(Z,0):ge,T(Ce)?(ue="",D!=null&&(ue=D.replace(_,"$&/")+"/"),X(Ce,K,ue,"",function(ae){return ae})):Ce!=null&&(U(Ce)&&(Ce=q(Ce,ue+(!Ce.key||Z&&Z.key===Ce.key?"":(""+Ce.key).replace(_,"$&/")+"/")+D)),K.push(Ce)),1;if(Z=0,ge=ge===""?".":ge+":",T(D))for(var H=0;H<D.length;H++){fe=D[H];var ne=ge+ee(fe,H);Z+=X(fe,K,ue,ne,Ce)}else if(ne=w(D),typeof ne=="function")for(D=ne.call(D),H=0;!(fe=D.next()).done;)fe=fe.value,ne=ge+ee(fe,H++),Z+=X(fe,K,ue,ne,Ce);else if(fe==="object")throw K=String(D),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return Z}function he(D,K,ue){if(D==null)return D;var ge=[],Ce=0;return X(D,ge,"","",function(fe){return K.call(ue,fe,Ce++)}),ge}function ie(D){if(D._status===-1){var K=D._result;K=K(),K.then(function(ue){(D._status===0||D._status===-1)&&(D._status=1,D._result=ue)},function(ue){(D._status===0||D._status===-1)&&(D._status=2,D._result=ue)}),D._status===-1&&(D._status=0,D._result=K)}if(D._status===1)return D._result.default;throw D._result}var $={current:null},z={transition:null},B={ReactCurrentDispatcher:$,ReactCurrentBatchConfig:z,ReactCurrentOwner:F};function Y(){throw Error("act(...) is not supported in production builds of React.")}return Fe.Children={map:he,forEach:function(D,K,ue){he(D,function(){K.apply(this,arguments)},ue)},count:function(D){var K=0;return he(D,function(){K++}),K},toArray:function(D){return he(D,function(K){return K})||[]},only:function(D){if(!U(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},Fe.Component=k,Fe.Fragment=r,Fe.Profiler=i,Fe.PureComponent=E,Fe.StrictMode=o,Fe.Suspense=h,Fe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=B,Fe.act=Y,Fe.cloneElement=function(D,K,ue){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var ge=C({},D.props),Ce=D.key,fe=D.ref,Z=D._owner;if(K!=null){if(K.ref!==void 0&&(fe=K.ref,Z=F.current),K.key!==void 0&&(Ce=""+K.key),D.type&&D.type.defaultProps)var H=D.type.defaultProps;for(ne in K)M.call(K,ne)&&!I.hasOwnProperty(ne)&&(ge[ne]=K[ne]===void 0&&H!==void 0?H[ne]:K[ne])}var ne=arguments.length-2;if(ne===1)ge.children=ue;else if(1<ne){H=Array(ne);for(var ae=0;ae<ne;ae++)H[ae]=arguments[ae+2];ge.children=H}return{$$typeof:e,type:D.type,key:Ce,ref:fe,props:ge,_owner:Z}},Fe.createContext=function(D){return D={$$typeof:u,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:c,_context:D},D.Consumer=D},Fe.createElement=O,Fe.createFactory=function(D){var K=O.bind(null,D);return K.type=D,K},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(D){return{$$typeof:d,render:D}},Fe.isValidElement=U,Fe.lazy=function(D){return{$$typeof:x,_payload:{_status:-1,_result:D},_init:ie}},Fe.memo=function(D,K){return{$$typeof:g,type:D,compare:K===void 0?null:K}},Fe.startTransition=function(D){var K=z.transition;z.transition={};try{D()}finally{z.transition=K}},Fe.unstable_act=Y,Fe.useCallback=function(D,K){return $.current.useCallback(D,K)},Fe.useContext=function(D){return $.current.useContext(D)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(D){return $.current.useDeferredValue(D)},Fe.useEffect=function(D,K){return $.current.useEffect(D,K)},Fe.useId=function(){return $.current.useId()},Fe.useImperativeHandle=function(D,K,ue){return $.current.useImperativeHandle(D,K,ue)},Fe.useInsertionEffect=function(D,K){return $.current.useInsertionEffect(D,K)},Fe.useLayoutEffect=function(D,K){return $.current.useLayoutEffect(D,K)},Fe.useMemo=function(D,K){return $.current.useMemo(D,K)},Fe.useReducer=function(D,K,ue){return $.current.useReducer(D,K,ue)},Fe.useRef=function(D){return $.current.useRef(D)},Fe.useState=function(D){return $.current.useState(D)},Fe.useSyncExternalStore=function(D,K,ue){return $.current.useSyncExternalStore(D,K,ue)},Fe.useTransition=function(){return $.current.useTransition()},Fe.version="18.3.1",Fe}var ux;function yc(){return ux||(ux=1,ef.exports=XC()),ef.exports}var dx;function ZC(){if(dx)return Mi;dx=1;var e=yc(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function u(d,h,g){var x,v={},w=null,S=null;g!==void 0&&(w=""+g),h.key!==void 0&&(w=""+h.key),h.ref!==void 0&&(S=h.ref);for(x in h)o.call(h,x)&&!c.hasOwnProperty(x)&&(v[x]=h[x]);if(d&&d.defaultProps)for(x in h=d.defaultProps,h)v[x]===void 0&&(v[x]=h[x]);return{$$typeof:t,type:d,key:w,ref:S,props:v,_owner:i.current}}return Mi.Fragment=r,Mi.jsx=u,Mi.jsxs=u,Mi}var fx;function JC(){return fx||(fx=1,Jd.exports=ZC()),Jd.exports}var a=JC(),Tl={},tf={exports:{}},qt={},nf={exports:{}},rf={};var px;function eN(){return px||(px=1,(function(e){function t(z,B){var Y=z.length;z.push(B);e:for(;0<Y;){var D=Y-1>>>1,K=z[D];if(0<i(K,B))z[D]=B,z[Y]=K,Y=D;else break e}}function r(z){return z.length===0?null:z[0]}function o(z){if(z.length===0)return null;var B=z[0],Y=z.pop();if(Y!==B){z[0]=Y;e:for(var D=0,K=z.length,ue=K>>>1;D<ue;){var ge=2*(D+1)-1,Ce=z[ge],fe=ge+1,Z=z[fe];if(0>i(Ce,Y))fe<K&&0>i(Z,Ce)?(z[D]=Z,z[fe]=Y,D=fe):(z[D]=Ce,z[ge]=Y,D=ge);else if(fe<K&&0>i(Z,Y))z[D]=Z,z[fe]=Y,D=fe;else break e}}return B}function i(z,B){var Y=z.sortIndex-B.sortIndex;return Y!==0?Y:z.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var h=[],g=[],x=1,v=null,w=3,S=!1,C=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function R(z){for(var B=r(g);B!==null;){if(B.callback===null)o(g);else if(B.startTime<=z)o(g),B.sortIndex=B.expirationTime,t(h,B);else break;B=r(g)}}function T(z){if(b=!1,R(z),!C)if(r(h)!==null)C=!0,ie(M);else{var B=r(g);B!==null&&$(T,B.startTime-z)}}function M(z,B){C=!1,b&&(b=!1,N(O),O=-1),S=!0;var Y=w;try{for(R(B),v=r(h);v!==null&&(!(v.expirationTime>B)||z&&!G());){var D=v.callback;if(typeof D=="function"){v.callback=null,w=v.priorityLevel;var K=D(v.expirationTime<=B);B=e.unstable_now(),typeof K=="function"?v.callback=K:v===r(h)&&o(h),R(B)}else o(h);v=r(h)}if(v!==null)var ue=!0;else{var ge=r(g);ge!==null&&$(T,ge.startTime-B),ue=!1}return ue}finally{v=null,w=Y,S=!1}}var F=!1,I=null,O=-1,q=5,U=-1;function G(){return!(e.unstable_now()-U<q)}function _(){if(I!==null){var z=e.unstable_now();U=z;var B=!0;try{B=I(!0,z)}finally{B?ee():(F=!1,I=null)}}else F=!1}var ee;if(typeof E=="function")ee=function(){E(_)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,he=X.port2;X.port1.onmessage=_,ee=function(){he.postMessage(null)}}else ee=function(){k(_,0)};function ie(z){I=z,F||(F=!0,ee())}function $(z,B){O=k(function(){z(e.unstable_now())},B)}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(z){z.callback=null},e.unstable_continueExecution=function(){C||S||(C=!0,ie(M))},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(z){switch(w){case 1:case 2:case 3:var B=3;break;default:B=w}var Y=w;w=B;try{return z()}finally{w=Y}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(z,B){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var Y=w;w=z;try{return B()}finally{w=Y}},e.unstable_scheduleCallback=function(z,B,Y){var D=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?D+Y:D):Y=D,z){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=Y+K,z={id:x++,callback:B,priorityLevel:z,startTime:Y,expirationTime:K,sortIndex:-1},Y>D?(z.sortIndex=Y,t(g,z),r(h)===null&&z===r(g)&&(b?(N(O),O=-1):b=!0,$(T,Y-D))):(z.sortIndex=K,t(h,z),C||S||(C=!0,ie(M))),z},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(z){var B=w;return function(){var Y=w;w=B;try{return z.apply(this,arguments)}finally{w=Y}}}})(rf)),rf}var hx;function tN(){return hx||(hx=1,nf.exports=eN()),nf.exports}var mx;function nN(){if(mx)return qt;mx=1;var e=yc(),t=tN();function r(n){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+n,l=1;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l]);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 o=new Set,i={};function c(n,s){u(n,s),u(n+"Capture",s)}function u(n,s){for(i[n]=s,n=0;n<s.length;n++)o.add(s[n])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,g=/^[: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 w(n){return h.call(v,n)?!0:h.call(x,n)?!1:g.test(n)?v[n]=!0:(x[n]=!0,!1)}function S(n,s,l,f){if(l!==null&&l.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return f?!1:l!==null?!l.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function C(n,s,l,f){if(s===null||typeof s>"u"||S(n,s,l,f))return!0;if(f)return!1;if(l!==null)switch(l.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 b(n,s,l,f,m,y,j){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=f,this.attributeNamespace=m,this.mustUseProperty=l,this.propertyName=n,this.type=s,this.sanitizeURL=y,this.removeEmptyString=j}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){k[n]=new b(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var s=n[0];k[s]=new b(s,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){k[n]=new b(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){k[n]=new b(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){k[n]=new b(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){k[n]=new b(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){k[n]=new b(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){k[n]=new b(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){k[n]=new b(n,5,!1,n.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function E(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(N,E);k[s]=new b(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(N,E);k[s]=new b(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(N,E);k[s]=new b(s,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){k[n]=new b(n,1,!1,n.toLowerCase(),null,!1,!1)}),k.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){k[n]=new b(n,1,!1,n.toLowerCase(),null,!0,!0)});function R(n,s,l,f){var m=k.hasOwnProperty(s)?k[s]:null;(m!==null?m.type!==0:f||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(C(s,l,m,f)&&(l=null),f||m===null?w(s)&&(l===null?n.removeAttribute(s):n.setAttribute(s,""+l)):m.mustUseProperty?n[m.propertyName]=l===null?m.type===3?!1:"":l:(s=m.attributeName,f=m.attributeNamespace,l===null?n.removeAttribute(s):(m=m.type,l=m===3||m===4&&l===!0?"":""+l,f?n.setAttributeNS(f,s,l):n.setAttribute(s,l))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),F=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),U=Symbol.for("react.provider"),G=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),$=Symbol.for("react.offscreen"),z=Symbol.iterator;function B(n){return n===null||typeof n!="object"?null:(n=z&&n[z]||n["@@iterator"],typeof n=="function"?n:null)}var Y=Object.assign,D;function K(n){if(D===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);D=s&&s[1]||""}return`
2
+ `+D+n}var ue=!1;function ge(n,s){if(!n||ue)return"";ue=!0;var l=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(Q){var f=Q}Reflect.construct(n,[],s)}else{try{s.call()}catch(Q){f=Q}n.call(s.prototype)}else{try{throw Error()}catch(Q){f=Q}n()}}catch(Q){if(Q&&f&&typeof Q.stack=="string"){for(var m=Q.stack.split(`
3
+ `),y=f.stack.split(`
4
+ `),j=m.length-1,P=y.length-1;1<=j&&0<=P&&m[j]!==y[P];)P--;for(;1<=j&&0<=P;j--,P--)if(m[j]!==y[P]){if(j!==1||P!==1)do if(j--,P--,0>P||m[j]!==y[P]){var A=`
5
+ `+m[j].replace(" at new "," at ");return n.displayName&&A.includes("<anonymous>")&&(A=A.replace("<anonymous>",n.displayName)),A}while(1<=j&&0<=P);break}}}finally{ue=!1,Error.prepareStackTrace=l}return(n=n?n.displayName||n.name:"")?K(n):""}function Ce(n){switch(n.tag){case 5:return K(n.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("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 fe(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 I:return"Fragment";case F:return"Portal";case q:return"Profiler";case O:return"StrictMode";case ee:return"Suspense";case X:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case G:return(n.displayName||"Context")+".Consumer";case U:return(n._context.displayName||"Context")+".Provider";case _:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case he:return s=n.displayName||null,s!==null?s:fe(n.type)||"Memo";case ie:s=n._payload,n=n._init;try{return fe(n(s))}catch{}}return null}function Z(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 fe(s);case 8:return s===O?"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 H(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ne(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ae(n){var s=ne(n)?"checked":"value",l=Object.getOwnPropertyDescriptor(n.constructor.prototype,s),f=""+n[s];if(!n.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var m=l.get,y=l.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return m.call(this)},set:function(j){f=""+j,y.call(this,j)}}),Object.defineProperty(n,s,{enumerable:l.enumerable}),{getValue:function(){return f},setValue:function(j){f=""+j},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function Me(n){n._valueTracker||(n._valueTracker=ae(n))}function Ae(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var l=s.getValue(),f="";return n&&(f=ne(n)?n.checked?"true":"false":n.value),n=f,n!==l?(s.setValue(n),!0):!1}function te(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 be(n,s){var l=s.checked;return Y({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??n._wrapperState.initialChecked})}function De(n,s){var l=s.defaultValue==null?"":s.defaultValue,f=s.checked!=null?s.checked:s.defaultChecked;l=H(s.value!=null?s.value:l),n._wrapperState={initialChecked:f,initialValue:l,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function J(n,s){s=s.checked,s!=null&&R(n,"checked",s,!1)}function me(n,s){J(n,s);var l=H(s.value),f=s.type;if(l!=null)f==="number"?(l===0&&n.value===""||n.value!=l)&&(n.value=""+l):n.value!==""+l&&(n.value=""+l);else if(f==="submit"||f==="reset"){n.removeAttribute("value");return}s.hasOwnProperty("value")?We(n,s.type,l):s.hasOwnProperty("defaultValue")&&We(n,s.type,H(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(n.defaultChecked=!!s.defaultChecked)}function Te(n,s,l){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var f=s.type;if(!(f!=="submit"&&f!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+n._wrapperState.initialValue,l||s===n.value||(n.value=s),n.defaultValue=s}l=n.name,l!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,l!==""&&(n.name=l)}function We(n,s,l){(s!=="number"||te(n.ownerDocument)!==n)&&(l==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+l&&(n.defaultValue=""+l))}var Le=Array.isArray;function qe(n,s,l,f){if(n=n.options,s){s={};for(var m=0;m<l.length;m++)s["$"+l[m]]=!0;for(l=0;l<n.length;l++)m=s.hasOwnProperty("$"+n[l].value),n[l].selected!==m&&(n[l].selected=m),m&&f&&(n[l].defaultSelected=!0)}else{for(l=""+H(l),s=null,m=0;m<n.length;m++){if(n[m].value===l){n[m].selected=!0,f&&(n[m].defaultSelected=!0);return}s!==null||n[m].disabled||(s=n[m])}s!==null&&(s.selected=!0)}}function sn(n,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return Y({},s,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Nr(n,s){var l=s.value;if(l==null){if(l=s.children,s=s.defaultValue,l!=null){if(s!=null)throw Error(r(92));if(Le(l)){if(1<l.length)throw Error(r(93));l=l[0]}s=l}s==null&&(s=""),l=s}n._wrapperState={initialValue:H(l)}}function jr(n,s){var l=H(s.value),f=H(s.defaultValue);l!=null&&(l=""+l,l!==n.value&&(n.value=l),s.defaultValue==null&&n.defaultValue!==l&&(n.defaultValue=l)),f!=null&&(n.defaultValue=""+f)}function Ws(n){var s=n.textContent;s===n._wrapperState.initialValue&&s!==""&&s!==null&&(n.value=s)}function wa(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 Hn(n,s){return n==null||n==="http://www.w3.org/1999/xhtml"?wa(s):n==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var bn,Er=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,l,f,m){MSApp.execUnsafeLocalFunction(function(){return n(s,l,f,m)})}:n})(function(n,s){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=s;else{for(bn=bn||document.createElement("div"),bn.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=bn.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;s.firstChild;)n.appendChild(s.firstChild)}});function Rr(n,s){if(s){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=s;return}}n.textContent=s}var zt={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},ba=["Webkit","ms","Moz","O"];Object.keys(zt).forEach(function(n){ba.forEach(function(s){s=s+n.charAt(0).toUpperCase()+n.substring(1),zt[s]=zt[n]})});function Sa(n,s,l){return s==null||typeof s=="boolean"||s===""?"":l||typeof s!="number"||s===0||zt.hasOwnProperty(n)&&zt[n]?(""+s).trim():s+"px"}function ka(n,s){n=n.style;for(var l in s)if(s.hasOwnProperty(l)){var f=l.indexOf("--")===0,m=Sa(l,s[l],f);l==="float"&&(l="cssFloat"),f?n.setProperty(l,m):n[l]=m}}var qo=Y({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 Ks(n,s){if(s){if(qo[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 Qo(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 qs=null;function Go(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Yo=null,Tr=null,nt=null;function Nt(n){if(n=gi(n)){if(typeof Yo!="function")throw Error(r(280));var s=n.stateNode;s&&(s=Ha(s),Yo(n.stateNode,n.type,s))}}function jt(n){Tr?nt?nt.push(n):nt=[n]:Tr=n}function Sn(){if(Tr){var n=Tr,s=nt;if(nt=Tr=null,Nt(n),s)for(n=0;n<s.length;n++)Nt(s[n])}}function _t(n,s){return n(s)}function Et(){}var Bt=!1;function or(n,s,l){if(Bt)return n(s,l);Bt=!0;try{return _t(n,s,l)}finally{Bt=!1,(Tr!==null||nt!==null)&&(Et(),Sn())}}function rt(n,s){var l=n.stateNode;if(l===null)return null;var f=Ha(l);if(f===null)return null;l=f[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":(f=!f.disabled)||(n=n.type,f=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!f;break e;default:n=!1}if(n)return null;if(l&&typeof l!="function")throw Error(r(231,s,typeof l));return l}var on=!1;if(d)try{var Rt={};Object.defineProperty(Rt,"passive",{get:function(){on=!0}}),window.addEventListener("test",Rt,Rt),window.removeEventListener("test",Rt,Rt)}catch{on=!1}function kn(n,s,l,f,m,y,j,P,A){var Q=Array.prototype.slice.call(arguments,3);try{s.apply(l,Q)}catch(se){this.onError(se)}}var Cn=!1,Wn=null,Gt=!1,ir=null,Xo={onError:function(n){Cn=!0,Wn=n}};function sk(n,s,l,f,m,y,j,P,A){Cn=!1,Wn=null,kn.apply(Xo,arguments)}function ok(n,s,l,f,m,y,j,P,A){if(sk.apply(this,arguments),Cn){if(Cn){var Q=Wn;Cn=!1,Wn=null}else throw Error(r(198));Gt||(Gt=!0,ir=Q)}}function ds(n){var s=n,l=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(l=s.return),n=s.return;while(n)}return s.tag===3?l:null}function Dh(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 _h(n){if(ds(n)!==n)throw Error(r(188))}function ik(n){var s=n.alternate;if(!s){if(s=ds(n),s===null)throw Error(r(188));return s!==n?null:n}for(var l=n,f=s;;){var m=l.return;if(m===null)break;var y=m.alternate;if(y===null){if(f=m.return,f!==null){l=f;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===l)return _h(m),n;if(y===f)return _h(m),s;y=y.sibling}throw Error(r(188))}if(l.return!==f.return)l=m,f=y;else{for(var j=!1,P=m.child;P;){if(P===l){j=!0,l=m,f=y;break}if(P===f){j=!0,f=m,l=y;break}P=P.sibling}if(!j){for(P=y.child;P;){if(P===l){j=!0,l=y,f=m;break}if(P===f){j=!0,f=y,l=m;break}P=P.sibling}if(!j)throw Error(r(189))}}if(l.alternate!==f)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?n:s}function Ah(n){return n=ik(n),n!==null?Ih(n):null}function Ih(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var s=Ih(n);if(s!==null)return s;n=n.sibling}return null}var Oh=t.unstable_scheduleCallback,Lh=t.unstable_cancelCallback,ak=t.unstable_shouldYield,lk=t.unstable_requestPaint,lt=t.unstable_now,ck=t.unstable_getCurrentPriorityLevel,yu=t.unstable_ImmediatePriority,Fh=t.unstable_UserBlockingPriority,Ca=t.unstable_NormalPriority,uk=t.unstable_LowPriority,$h=t.unstable_IdlePriority,Na=null,Kn=null;function dk(n){if(Kn&&typeof Kn.onCommitFiberRoot=="function")try{Kn.onCommitFiberRoot(Na,n,void 0,(n.current.flags&128)===128)}catch{}}var Nn=Math.clz32?Math.clz32:hk,fk=Math.log,pk=Math.LN2;function hk(n){return n>>>=0,n===0?32:31-(fk(n)/pk|0)|0}var ja=64,Ea=4194304;function Zo(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 Ra(n,s){var l=n.pendingLanes;if(l===0)return 0;var f=0,m=n.suspendedLanes,y=n.pingedLanes,j=l&268435455;if(j!==0){var P=j&~m;P!==0?f=Zo(P):(y&=j,y!==0&&(f=Zo(y)))}else j=l&~m,j!==0?f=Zo(j):y!==0&&(f=Zo(y));if(f===0)return 0;if(s!==0&&s!==f&&(s&m)===0&&(m=f&-f,y=s&-s,m>=y||m===16&&(y&4194240)!==0))return s;if((f&4)!==0&&(f|=l&16),s=n.entangledLanes,s!==0)for(n=n.entanglements,s&=f;0<s;)l=31-Nn(s),m=1<<l,f|=n[l],s&=~m;return f}function mk(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 gk(n,s){for(var l=n.suspendedLanes,f=n.pingedLanes,m=n.expirationTimes,y=n.pendingLanes;0<y;){var j=31-Nn(y),P=1<<j,A=m[j];A===-1?((P&l)===0||(P&f)!==0)&&(m[j]=mk(P,s)):A<=s&&(n.expiredLanes|=P),y&=~P}}function wu(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function zh(){var n=ja;return ja<<=1,(ja&4194240)===0&&(ja=64),n}function bu(n){for(var s=[],l=0;31>l;l++)s.push(n);return s}function Jo(n,s,l){n.pendingLanes|=s,s!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,s=31-Nn(s),n[s]=l}function xk(n,s){var l=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 f=n.eventTimes;for(n=n.expirationTimes;0<l;){var m=31-Nn(l),y=1<<m;s[m]=0,f[m]=-1,n[m]=-1,l&=~y}}function Su(n,s){var l=n.entangledLanes|=s;for(n=n.entanglements;l;){var f=31-Nn(l),m=1<<f;m&s|n[f]&s&&(n[f]|=s),l&=~m}}var Ke=0;function Bh(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var Vh,ku,Uh,Hh,Wh,Cu=!1,Ta=[],Pr=null,Mr=null,Dr=null,ei=new Map,ti=new Map,_r=[],vk="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 Kh(n,s){switch(n){case"focusin":case"focusout":Pr=null;break;case"dragenter":case"dragleave":Mr=null;break;case"mouseover":case"mouseout":Dr=null;break;case"pointerover":case"pointerout":ei.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":ti.delete(s.pointerId)}}function ni(n,s,l,f,m,y){return n===null||n.nativeEvent!==y?(n={blockedOn:s,domEventName:l,eventSystemFlags:f,nativeEvent:y,targetContainers:[m]},s!==null&&(s=gi(s),s!==null&&ku(s)),n):(n.eventSystemFlags|=f,s=n.targetContainers,m!==null&&s.indexOf(m)===-1&&s.push(m),n)}function yk(n,s,l,f,m){switch(s){case"focusin":return Pr=ni(Pr,n,s,l,f,m),!0;case"dragenter":return Mr=ni(Mr,n,s,l,f,m),!0;case"mouseover":return Dr=ni(Dr,n,s,l,f,m),!0;case"pointerover":var y=m.pointerId;return ei.set(y,ni(ei.get(y)||null,n,s,l,f,m)),!0;case"gotpointercapture":return y=m.pointerId,ti.set(y,ni(ti.get(y)||null,n,s,l,f,m)),!0}return!1}function qh(n){var s=fs(n.target);if(s!==null){var l=ds(s);if(l!==null){if(s=l.tag,s===13){if(s=Dh(l),s!==null){n.blockedOn=s,Wh(n.priority,function(){Uh(l)});return}}else if(s===3&&l.stateNode.current.memoizedState.isDehydrated){n.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Pa(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var l=ju(n.domEventName,n.eventSystemFlags,s[0],n.nativeEvent);if(l===null){l=n.nativeEvent;var f=new l.constructor(l.type,l);qs=f,l.target.dispatchEvent(f),qs=null}else return s=gi(l),s!==null&&ku(s),n.blockedOn=l,!1;s.shift()}return!0}function Qh(n,s,l){Pa(n)&&l.delete(s)}function wk(){Cu=!1,Pr!==null&&Pa(Pr)&&(Pr=null),Mr!==null&&Pa(Mr)&&(Mr=null),Dr!==null&&Pa(Dr)&&(Dr=null),ei.forEach(Qh),ti.forEach(Qh)}function ri(n,s){n.blockedOn===s&&(n.blockedOn=null,Cu||(Cu=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,wk)))}function si(n){function s(m){return ri(m,n)}if(0<Ta.length){ri(Ta[0],n);for(var l=1;l<Ta.length;l++){var f=Ta[l];f.blockedOn===n&&(f.blockedOn=null)}}for(Pr!==null&&ri(Pr,n),Mr!==null&&ri(Mr,n),Dr!==null&&ri(Dr,n),ei.forEach(s),ti.forEach(s),l=0;l<_r.length;l++)f=_r[l],f.blockedOn===n&&(f.blockedOn=null);for(;0<_r.length&&(l=_r[0],l.blockedOn===null);)qh(l),l.blockedOn===null&&_r.shift()}var Qs=T.ReactCurrentBatchConfig,Ma=!0;function bk(n,s,l,f){var m=Ke,y=Qs.transition;Qs.transition=null;try{Ke=1,Nu(n,s,l,f)}finally{Ke=m,Qs.transition=y}}function Sk(n,s,l,f){var m=Ke,y=Qs.transition;Qs.transition=null;try{Ke=4,Nu(n,s,l,f)}finally{Ke=m,Qs.transition=y}}function Nu(n,s,l,f){if(Ma){var m=ju(n,s,l,f);if(m===null)Uu(n,s,f,Da,l),Kh(n,f);else if(yk(m,n,s,l,f))f.stopPropagation();else if(Kh(n,f),s&4&&-1<vk.indexOf(n)){for(;m!==null;){var y=gi(m);if(y!==null&&Vh(y),y=ju(n,s,l,f),y===null&&Uu(n,s,f,Da,l),y===m)break;m=y}m!==null&&f.stopPropagation()}else Uu(n,s,f,null,l)}}var Da=null;function ju(n,s,l,f){if(Da=null,n=Go(f),n=fs(n),n!==null)if(s=ds(n),s===null)n=null;else if(l=s.tag,l===13){if(n=Dh(s),n!==null)return n;n=null}else if(l===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null);return Da=n,null}function Gh(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(ck()){case yu:return 1;case Fh:return 4;case Ca:case uk:return 16;case $h:return 536870912;default:return 16}default:return 16}}var Ar=null,Eu=null,_a=null;function Yh(){if(_a)return _a;var n,s=Eu,l=s.length,f,m="value"in Ar?Ar.value:Ar.textContent,y=m.length;for(n=0;n<l&&s[n]===m[n];n++);var j=l-n;for(f=1;f<=j&&s[l-f]===m[y-f];f++);return _a=m.slice(n,1<f?1-f:void 0)}function Aa(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 Ia(){return!0}function Xh(){return!1}function Yt(n){function s(l,f,m,y,j){this._reactName=l,this._targetInst=m,this.type=f,this.nativeEvent=y,this.target=j,this.currentTarget=null;for(var P in n)n.hasOwnProperty(P)&&(l=n[P],this[P]=l?l(y):y[P]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Ia:Xh,this.isPropagationStopped=Xh,this}return Y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Ia)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ia)},persist:function(){},isPersistent:Ia}),s}var Gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ru=Yt(Gs),oi=Y({},Gs,{view:0,detail:0}),kk=Yt(oi),Tu,Pu,ii,Oa=Y({},oi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Du,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!==ii&&(ii&&n.type==="mousemove"?(Tu=n.screenX-ii.screenX,Pu=n.screenY-ii.screenY):Pu=Tu=0,ii=n),Tu)},movementY:function(n){return"movementY"in n?n.movementY:Pu}}),Zh=Yt(Oa),Ck=Y({},Oa,{dataTransfer:0}),Nk=Yt(Ck),jk=Y({},oi,{relatedTarget:0}),Mu=Yt(jk),Ek=Y({},Gs,{animationName:0,elapsedTime:0,pseudoElement:0}),Rk=Yt(Ek),Tk=Y({},Gs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Pk=Yt(Tk),Mk=Y({},Gs,{data:0}),Jh=Yt(Mk),Dk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_k={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"},Ak={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ik(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=Ak[n])?!!s[n]:!1}function Du(){return Ik}var Ok=Y({},oi,{key:function(n){if(n.key){var s=Dk[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=Aa(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?_k[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Du,charCode:function(n){return n.type==="keypress"?Aa(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Aa(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Lk=Yt(Ok),Fk=Y({},Oa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),em=Yt(Fk),$k=Y({},oi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Du}),zk=Yt($k),Bk=Y({},Gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vk=Yt(Bk),Uk=Y({},Oa,{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}),Hk=Yt(Uk),Wk=[9,13,27,32],_u=d&&"CompositionEvent"in window,ai=null;d&&"documentMode"in document&&(ai=document.documentMode);var Kk=d&&"TextEvent"in window&&!ai,tm=d&&(!_u||ai&&8<ai&&11>=ai),nm=" ",rm=!1;function sm(n,s){switch(n){case"keyup":return Wk.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function om(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ys=!1;function qk(n,s){switch(n){case"compositionend":return om(s);case"keypress":return s.which!==32?null:(rm=!0,nm);case"textInput":return n=s.data,n===nm&&rm?null:n;default:return null}}function Qk(n,s){if(Ys)return n==="compositionend"||!_u&&sm(n,s)?(n=Yh(),_a=Eu=Ar=null,Ys=!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 tm&&s.locale!=="ko"?null:s.data;default:return null}}var Gk={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 im(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!Gk[n.type]:s==="textarea"}function am(n,s,l,f){jt(f),s=Ba(s,"onChange"),0<s.length&&(l=new Ru("onChange","change",null,l,f),n.push({event:l,listeners:s}))}var li=null,ci=null;function Yk(n){Nm(n,0)}function La(n){var s=to(n);if(Ae(s))return n}function Xk(n,s){if(n==="change")return s}var lm=!1;if(d){var Au;if(d){var Iu="oninput"in document;if(!Iu){var cm=document.createElement("div");cm.setAttribute("oninput","return;"),Iu=typeof cm.oninput=="function"}Au=Iu}else Au=!1;lm=Au&&(!document.documentMode||9<document.documentMode)}function um(){li&&(li.detachEvent("onpropertychange",dm),ci=li=null)}function dm(n){if(n.propertyName==="value"&&La(ci)){var s=[];am(s,ci,n,Go(n)),or(Yk,s)}}function Zk(n,s,l){n==="focusin"?(um(),li=s,ci=l,li.attachEvent("onpropertychange",dm)):n==="focusout"&&um()}function Jk(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return La(ci)}function eC(n,s){if(n==="click")return La(s)}function tC(n,s){if(n==="input"||n==="change")return La(s)}function nC(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var jn=typeof Object.is=="function"?Object.is:nC;function ui(n,s){if(jn(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var l=Object.keys(n),f=Object.keys(s);if(l.length!==f.length)return!1;for(f=0;f<l.length;f++){var m=l[f];if(!h.call(s,m)||!jn(n[m],s[m]))return!1}return!0}function fm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function pm(n,s){var l=fm(n);n=0;for(var f;l;){if(l.nodeType===3){if(f=n+l.textContent.length,n<=s&&f>=s)return{node:l,offset:s-n};n=f}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=fm(l)}}function hm(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?hm(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function mm(){for(var n=window,s=te();s instanceof n.HTMLIFrameElement;){try{var l=typeof s.contentWindow.location.href=="string"}catch{l=!1}if(l)n=s.contentWindow;else break;s=te(n.document)}return s}function Ou(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 rC(n){var s=mm(),l=n.focusedElem,f=n.selectionRange;if(s!==l&&l&&l.ownerDocument&&hm(l.ownerDocument.documentElement,l)){if(f!==null&&Ou(l)){if(s=f.start,n=f.end,n===void 0&&(n=s),"selectionStart"in l)l.selectionStart=s,l.selectionEnd=Math.min(n,l.value.length);else if(n=(s=l.ownerDocument||document)&&s.defaultView||window,n.getSelection){n=n.getSelection();var m=l.textContent.length,y=Math.min(f.start,m);f=f.end===void 0?y:Math.min(f.end,m),!n.extend&&y>f&&(m=f,f=y,y=m),m=pm(l,y);var j=pm(l,f);m&&j&&(n.rangeCount!==1||n.anchorNode!==m.node||n.anchorOffset!==m.offset||n.focusNode!==j.node||n.focusOffset!==j.offset)&&(s=s.createRange(),s.setStart(m.node,m.offset),n.removeAllRanges(),y>f?(n.addRange(s),n.extend(j.node,j.offset)):(s.setEnd(j.node,j.offset),n.addRange(s)))}}for(s=[],n=l;n=n.parentNode;)n.nodeType===1&&s.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<s.length;l++)n=s[l],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var sC=d&&"documentMode"in document&&11>=document.documentMode,Xs=null,Lu=null,di=null,Fu=!1;function gm(n,s,l){var f=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Fu||Xs==null||Xs!==te(f)||(f=Xs,"selectionStart"in f&&Ou(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),di&&ui(di,f)||(di=f,f=Ba(Lu,"onSelect"),0<f.length&&(s=new Ru("onSelect","select",null,s,l),n.push({event:s,listeners:f}),s.target=Xs)))}function Fa(n,s){var l={};return l[n.toLowerCase()]=s.toLowerCase(),l["Webkit"+n]="webkit"+s,l["Moz"+n]="moz"+s,l}var Zs={animationend:Fa("Animation","AnimationEnd"),animationiteration:Fa("Animation","AnimationIteration"),animationstart:Fa("Animation","AnimationStart"),transitionend:Fa("Transition","TransitionEnd")},$u={},xm={};d&&(xm=document.createElement("div").style,"AnimationEvent"in window||(delete Zs.animationend.animation,delete Zs.animationiteration.animation,delete Zs.animationstart.animation),"TransitionEvent"in window||delete Zs.transitionend.transition);function $a(n){if($u[n])return $u[n];if(!Zs[n])return n;var s=Zs[n],l;for(l in s)if(s.hasOwnProperty(l)&&l in xm)return $u[n]=s[l];return n}var vm=$a("animationend"),ym=$a("animationiteration"),wm=$a("animationstart"),bm=$a("transitionend"),Sm=new Map,km="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 Ir(n,s){Sm.set(n,s),c(s,[n])}for(var zu=0;zu<km.length;zu++){var Bu=km[zu],oC=Bu.toLowerCase(),iC=Bu[0].toUpperCase()+Bu.slice(1);Ir(oC,"on"+iC)}Ir(vm,"onAnimationEnd"),Ir(ym,"onAnimationIteration"),Ir(wm,"onAnimationStart"),Ir("dblclick","onDoubleClick"),Ir("focusin","onFocus"),Ir("focusout","onBlur"),Ir(bm,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("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 fi="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(" "),aC=new Set("cancel close invalid load scroll toggle".split(" ").concat(fi));function Cm(n,s,l){var f=n.type||"unknown-event";n.currentTarget=l,ok(f,s,void 0,n),n.currentTarget=null}function Nm(n,s){s=(s&4)!==0;for(var l=0;l<n.length;l++){var f=n[l],m=f.event;f=f.listeners;e:{var y=void 0;if(s)for(var j=f.length-1;0<=j;j--){var P=f[j],A=P.instance,Q=P.currentTarget;if(P=P.listener,A!==y&&m.isPropagationStopped())break e;Cm(m,P,Q),y=A}else for(j=0;j<f.length;j++){if(P=f[j],A=P.instance,Q=P.currentTarget,P=P.listener,A!==y&&m.isPropagationStopped())break e;Cm(m,P,Q),y=A}}}if(Gt)throw n=ir,Gt=!1,ir=null,n}function Ye(n,s){var l=s[Gu];l===void 0&&(l=s[Gu]=new Set);var f=n+"__bubble";l.has(f)||(jm(s,n,2,!1),l.add(f))}function Vu(n,s,l){var f=0;s&&(f|=4),jm(l,n,f,s)}var za="_reactListening"+Math.random().toString(36).slice(2);function pi(n){if(!n[za]){n[za]=!0,o.forEach(function(l){l!=="selectionchange"&&(aC.has(l)||Vu(l,!1,n),Vu(l,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[za]||(s[za]=!0,Vu("selectionchange",!1,s))}}function jm(n,s,l,f){switch(Gh(s)){case 1:var m=bk;break;case 4:m=Sk;break;default:m=Nu}l=m.bind(null,s,l,n),m=void 0,!on||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(m=!0),f?m!==void 0?n.addEventListener(s,l,{capture:!0,passive:m}):n.addEventListener(s,l,!0):m!==void 0?n.addEventListener(s,l,{passive:m}):n.addEventListener(s,l,!1)}function Uu(n,s,l,f,m){var y=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var j=f.tag;if(j===3||j===4){var P=f.stateNode.containerInfo;if(P===m||P.nodeType===8&&P.parentNode===m)break;if(j===4)for(j=f.return;j!==null;){var A=j.tag;if((A===3||A===4)&&(A=j.stateNode.containerInfo,A===m||A.nodeType===8&&A.parentNode===m))return;j=j.return}for(;P!==null;){if(j=fs(P),j===null)return;if(A=j.tag,A===5||A===6){f=y=j;continue e}P=P.parentNode}}f=f.return}or(function(){var Q=y,se=Go(l),oe=[];e:{var re=Sm.get(n);if(re!==void 0){var xe=Ru,we=n;switch(n){case"keypress":if(Aa(l)===0)break e;case"keydown":case"keyup":xe=Lk;break;case"focusin":we="focus",xe=Mu;break;case"focusout":we="blur",xe=Mu;break;case"beforeblur":case"afterblur":xe=Mu;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xe=Zh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=Nk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=zk;break;case vm:case ym:case wm:xe=Rk;break;case bm:xe=Vk;break;case"scroll":xe=kk;break;case"wheel":xe=Hk;break;case"copy":case"cut":case"paste":xe=Pk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=em}var Se=(s&4)!==0,ct=!Se&&n==="scroll",V=Se?re!==null?re+"Capture":null:re;Se=[];for(var L=Q,W;L!==null;){W=L;var ce=W.stateNode;if(W.tag===5&&ce!==null&&(W=ce,V!==null&&(ce=rt(L,V),ce!=null&&Se.push(hi(L,ce,W)))),ct)break;L=L.return}0<Se.length&&(re=new xe(re,we,null,l,se),oe.push({event:re,listeners:Se}))}}if((s&7)===0){e:{if(re=n==="mouseover"||n==="pointerover",xe=n==="mouseout"||n==="pointerout",re&&l!==qs&&(we=l.relatedTarget||l.fromElement)&&(fs(we)||we[ar]))break e;if((xe||re)&&(re=se.window===se?se:(re=se.ownerDocument)?re.defaultView||re.parentWindow:window,xe?(we=l.relatedTarget||l.toElement,xe=Q,we=we?fs(we):null,we!==null&&(ct=ds(we),we!==ct||we.tag!==5&&we.tag!==6)&&(we=null)):(xe=null,we=Q),xe!==we)){if(Se=Zh,ce="onMouseLeave",V="onMouseEnter",L="mouse",(n==="pointerout"||n==="pointerover")&&(Se=em,ce="onPointerLeave",V="onPointerEnter",L="pointer"),ct=xe==null?re:to(xe),W=we==null?re:to(we),re=new Se(ce,L+"leave",xe,l,se),re.target=ct,re.relatedTarget=W,ce=null,fs(se)===Q&&(Se=new Se(V,L+"enter",we,l,se),Se.target=W,Se.relatedTarget=ct,ce=Se),ct=ce,xe&&we)t:{for(Se=xe,V=we,L=0,W=Se;W;W=Js(W))L++;for(W=0,ce=V;ce;ce=Js(ce))W++;for(;0<L-W;)Se=Js(Se),L--;for(;0<W-L;)V=Js(V),W--;for(;L--;){if(Se===V||V!==null&&Se===V.alternate)break t;Se=Js(Se),V=Js(V)}Se=null}else Se=null;xe!==null&&Em(oe,re,xe,Se,!1),we!==null&&ct!==null&&Em(oe,ct,we,Se,!0)}}e:{if(re=Q?to(Q):window,xe=re.nodeName&&re.nodeName.toLowerCase(),xe==="select"||xe==="input"&&re.type==="file")var ke=Xk;else if(im(re))if(lm)ke=tC;else{ke=Jk;var Ee=Zk}else(xe=re.nodeName)&&xe.toLowerCase()==="input"&&(re.type==="checkbox"||re.type==="radio")&&(ke=eC);if(ke&&(ke=ke(n,Q))){am(oe,ke,l,se);break e}Ee&&Ee(n,re,Q),n==="focusout"&&(Ee=re._wrapperState)&&Ee.controlled&&re.type==="number"&&We(re,"number",re.value)}switch(Ee=Q?to(Q):window,n){case"focusin":(im(Ee)||Ee.contentEditable==="true")&&(Xs=Ee,Lu=Q,di=null);break;case"focusout":di=Lu=Xs=null;break;case"mousedown":Fu=!0;break;case"contextmenu":case"mouseup":case"dragend":Fu=!1,gm(oe,l,se);break;case"selectionchange":if(sC)break;case"keydown":case"keyup":gm(oe,l,se)}var Re;if(_u)e:{switch(n){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else Ys?sm(n,l)&&(Pe="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(Pe="onCompositionStart");Pe&&(tm&&l.locale!=="ko"&&(Ys||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&Ys&&(Re=Yh()):(Ar=se,Eu="value"in Ar?Ar.value:Ar.textContent,Ys=!0)),Ee=Ba(Q,Pe),0<Ee.length&&(Pe=new Jh(Pe,n,null,l,se),oe.push({event:Pe,listeners:Ee}),Re?Pe.data=Re:(Re=om(l),Re!==null&&(Pe.data=Re)))),(Re=Kk?qk(n,l):Qk(n,l))&&(Q=Ba(Q,"onBeforeInput"),0<Q.length&&(se=new Jh("onBeforeInput","beforeinput",null,l,se),oe.push({event:se,listeners:Q}),se.data=Re))}Nm(oe,s)})}function hi(n,s,l){return{instance:n,listener:s,currentTarget:l}}function Ba(n,s){for(var l=s+"Capture",f=[];n!==null;){var m=n,y=m.stateNode;m.tag===5&&y!==null&&(m=y,y=rt(n,l),y!=null&&f.unshift(hi(n,y,m)),y=rt(n,s),y!=null&&f.push(hi(n,y,m))),n=n.return}return f}function Js(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function Em(n,s,l,f,m){for(var y=s._reactName,j=[];l!==null&&l!==f;){var P=l,A=P.alternate,Q=P.stateNode;if(A!==null&&A===f)break;P.tag===5&&Q!==null&&(P=Q,m?(A=rt(l,y),A!=null&&j.unshift(hi(l,A,P))):m||(A=rt(l,y),A!=null&&j.push(hi(l,A,P)))),l=l.return}j.length!==0&&n.push({event:s,listeners:j})}var lC=/\r\n?/g,cC=/\u0000|\uFFFD/g;function Rm(n){return(typeof n=="string"?n:""+n).replace(lC,`
6
+ `).replace(cC,"")}function Va(n,s,l){if(s=Rm(s),Rm(n)!==s&&l)throw Error(r(425))}function Ua(){}var Hu=null,Wu=null;function Ku(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 qu=typeof setTimeout=="function"?setTimeout:void 0,uC=typeof clearTimeout=="function"?clearTimeout:void 0,Tm=typeof Promise=="function"?Promise:void 0,dC=typeof queueMicrotask=="function"?queueMicrotask:typeof Tm<"u"?function(n){return Tm.resolve(null).then(n).catch(fC)}:qu;function fC(n){setTimeout(function(){throw n})}function Qu(n,s){var l=s,f=0;do{var m=l.nextSibling;if(n.removeChild(l),m&&m.nodeType===8)if(l=m.data,l==="/$"){if(f===0){n.removeChild(m),si(s);return}f--}else l!=="$"&&l!=="$?"&&l!=="$!"||f++;l=m}while(l);si(s)}function Or(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 Pm(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var l=n.data;if(l==="$"||l==="$!"||l==="$?"){if(s===0)return n;s--}else l==="/$"&&s++}n=n.previousSibling}return null}var eo=Math.random().toString(36).slice(2),qn="__reactFiber$"+eo,mi="__reactProps$"+eo,ar="__reactContainer$"+eo,Gu="__reactEvents$"+eo,pC="__reactListeners$"+eo,hC="__reactHandles$"+eo;function fs(n){var s=n[qn];if(s)return s;for(var l=n.parentNode;l;){if(s=l[ar]||l[qn]){if(l=s.alternate,s.child!==null||l!==null&&l.child!==null)for(n=Pm(n);n!==null;){if(l=n[qn])return l;n=Pm(n)}return s}n=l,l=n.parentNode}return null}function gi(n){return n=n[qn]||n[ar],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function to(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(r(33))}function Ha(n){return n[mi]||null}var Yu=[],no=-1;function Lr(n){return{current:n}}function Xe(n){0>no||(n.current=Yu[no],Yu[no]=null,no--)}function Qe(n,s){no++,Yu[no]=n.current,n.current=s}var Fr={},Tt=Lr(Fr),Vt=Lr(!1),ps=Fr;function ro(n,s){var l=n.type.contextTypes;if(!l)return Fr;var f=n.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===s)return f.__reactInternalMemoizedMaskedChildContext;var m={},y;for(y in l)m[y]=s[y];return f&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=s,n.__reactInternalMemoizedMaskedChildContext=m),m}function Ut(n){return n=n.childContextTypes,n!=null}function Wa(){Xe(Vt),Xe(Tt)}function Mm(n,s,l){if(Tt.current!==Fr)throw Error(r(168));Qe(Tt,s),Qe(Vt,l)}function Dm(n,s,l){var f=n.stateNode;if(s=s.childContextTypes,typeof f.getChildContext!="function")return l;f=f.getChildContext();for(var m in f)if(!(m in s))throw Error(r(108,Z(n)||"Unknown",m));return Y({},l,f)}function Ka(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Fr,ps=Tt.current,Qe(Tt,n),Qe(Vt,Vt.current),!0}function _m(n,s,l){var f=n.stateNode;if(!f)throw Error(r(169));l?(n=Dm(n,s,ps),f.__reactInternalMemoizedMergedChildContext=n,Xe(Vt),Xe(Tt),Qe(Tt,n)):Xe(Vt),Qe(Vt,l)}var lr=null,qa=!1,Xu=!1;function Am(n){lr===null?lr=[n]:lr.push(n)}function mC(n){qa=!0,Am(n)}function $r(){if(!Xu&&lr!==null){Xu=!0;var n=0,s=Ke;try{var l=lr;for(Ke=1;n<l.length;n++){var f=l[n];do f=f(!0);while(f!==null)}lr=null,qa=!1}catch(m){throw lr!==null&&(lr=lr.slice(n+1)),Oh(yu,$r),m}finally{Ke=s,Xu=!1}}return null}var so=[],oo=0,Qa=null,Ga=0,an=[],ln=0,hs=null,cr=1,ur="";function ms(n,s){so[oo++]=Ga,so[oo++]=Qa,Qa=n,Ga=s}function Im(n,s,l){an[ln++]=cr,an[ln++]=ur,an[ln++]=hs,hs=n;var f=cr;n=ur;var m=32-Nn(f)-1;f&=~(1<<m),l+=1;var y=32-Nn(s)+m;if(30<y){var j=m-m%5;y=(f&(1<<j)-1).toString(32),f>>=j,m-=j,cr=1<<32-Nn(s)+m|l<<m|f,ur=y+n}else cr=1<<y|l<<m|f,ur=n}function Zu(n){n.return!==null&&(ms(n,1),Im(n,1,0))}function Ju(n){for(;n===Qa;)Qa=so[--oo],so[oo]=null,Ga=so[--oo],so[oo]=null;for(;n===hs;)hs=an[--ln],an[ln]=null,ur=an[--ln],an[ln]=null,cr=an[--ln],an[ln]=null}var Xt=null,Zt=null,Je=!1,En=null;function Om(n,s){var l=fn(5,null,null,0);l.elementType="DELETED",l.stateNode=s,l.return=n,s=n.deletions,s===null?(n.deletions=[l],n.flags|=16):s.push(l)}function Lm(n,s){switch(n.tag){case 5:var l=n.type;return s=s.nodeType!==1||l.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(n.stateNode=s,Xt=n,Zt=Or(s.firstChild),!0):!1;case 6:return s=n.pendingProps===""||s.nodeType!==3?null:s,s!==null?(n.stateNode=s,Xt=n,Zt=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(l=hs!==null?{id:cr,overflow:ur}:null,n.memoizedState={dehydrated:s,treeContext:l,retryLane:1073741824},l=fn(18,null,null,0),l.stateNode=s,l.return=n,n.child=l,Xt=n,Zt=null,!0):!1;default:return!1}}function ed(n){return(n.mode&1)!==0&&(n.flags&128)===0}function td(n){if(Je){var s=Zt;if(s){var l=s;if(!Lm(n,s)){if(ed(n))throw Error(r(418));s=Or(l.nextSibling);var f=Xt;s&&Lm(n,s)?Om(f,l):(n.flags=n.flags&-4097|2,Je=!1,Xt=n)}}else{if(ed(n))throw Error(r(418));n.flags=n.flags&-4097|2,Je=!1,Xt=n}}}function Fm(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Xt=n}function Ya(n){if(n!==Xt)return!1;if(!Je)return Fm(n),Je=!0,!1;var s;if((s=n.tag!==3)&&!(s=n.tag!==5)&&(s=n.type,s=s!=="head"&&s!=="body"&&!Ku(n.type,n.memoizedProps)),s&&(s=Zt)){if(ed(n))throw $m(),Error(r(418));for(;s;)Om(n,s),s=Or(s.nextSibling)}if(Fm(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 l=n.data;if(l==="/$"){if(s===0){Zt=Or(n.nextSibling);break e}s--}else l!=="$"&&l!=="$!"&&l!=="$?"||s++}n=n.nextSibling}Zt=null}}else Zt=Xt?Or(n.stateNode.nextSibling):null;return!0}function $m(){for(var n=Zt;n;)n=Or(n.nextSibling)}function io(){Zt=Xt=null,Je=!1}function nd(n){En===null?En=[n]:En.push(n)}var gC=T.ReactCurrentBatchConfig;function xi(n,s,l){if(n=l.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(r(309));var f=l.stateNode}if(!f)throw Error(r(147,n));var m=f,y=""+n;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===y?s.ref:(s=function(j){var P=m.refs;j===null?delete P[y]:P[y]=j},s._stringRef=y,s)}if(typeof n!="string")throw Error(r(284));if(!l._owner)throw Error(r(290,n))}return n}function Xa(n,s){throw n=Object.prototype.toString.call(s),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n))}function zm(n){var s=n._init;return s(n._payload)}function Bm(n){function s(V,L){if(n){var W=V.deletions;W===null?(V.deletions=[L],V.flags|=16):W.push(L)}}function l(V,L){if(!n)return null;for(;L!==null;)s(V,L),L=L.sibling;return null}function f(V,L){for(V=new Map;L!==null;)L.key!==null?V.set(L.key,L):V.set(L.index,L),L=L.sibling;return V}function m(V,L){return V=qr(V,L),V.index=0,V.sibling=null,V}function y(V,L,W){return V.index=W,n?(W=V.alternate,W!==null?(W=W.index,W<L?(V.flags|=2,L):W):(V.flags|=2,L)):(V.flags|=1048576,L)}function j(V){return n&&V.alternate===null&&(V.flags|=2),V}function P(V,L,W,ce){return L===null||L.tag!==6?(L=qd(W,V.mode,ce),L.return=V,L):(L=m(L,W),L.return=V,L)}function A(V,L,W,ce){var ke=W.type;return ke===I?se(V,L,W.props.children,ce,W.key):L!==null&&(L.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===ie&&zm(ke)===L.type)?(ce=m(L,W.props),ce.ref=xi(V,L,W),ce.return=V,ce):(ce=bl(W.type,W.key,W.props,null,V.mode,ce),ce.ref=xi(V,L,W),ce.return=V,ce)}function Q(V,L,W,ce){return L===null||L.tag!==4||L.stateNode.containerInfo!==W.containerInfo||L.stateNode.implementation!==W.implementation?(L=Qd(W,V.mode,ce),L.return=V,L):(L=m(L,W.children||[]),L.return=V,L)}function se(V,L,W,ce,ke){return L===null||L.tag!==7?(L=ks(W,V.mode,ce,ke),L.return=V,L):(L=m(L,W),L.return=V,L)}function oe(V,L,W){if(typeof L=="string"&&L!==""||typeof L=="number")return L=qd(""+L,V.mode,W),L.return=V,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case M:return W=bl(L.type,L.key,L.props,null,V.mode,W),W.ref=xi(V,null,L),W.return=V,W;case F:return L=Qd(L,V.mode,W),L.return=V,L;case ie:var ce=L._init;return oe(V,ce(L._payload),W)}if(Le(L)||B(L))return L=ks(L,V.mode,W,null),L.return=V,L;Xa(V,L)}return null}function re(V,L,W,ce){var ke=L!==null?L.key:null;if(typeof W=="string"&&W!==""||typeof W=="number")return ke!==null?null:P(V,L,""+W,ce);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case M:return W.key===ke?A(V,L,W,ce):null;case F:return W.key===ke?Q(V,L,W,ce):null;case ie:return ke=W._init,re(V,L,ke(W._payload),ce)}if(Le(W)||B(W))return ke!==null?null:se(V,L,W,ce,null);Xa(V,W)}return null}function xe(V,L,W,ce,ke){if(typeof ce=="string"&&ce!==""||typeof ce=="number")return V=V.get(W)||null,P(L,V,""+ce,ke);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case M:return V=V.get(ce.key===null?W:ce.key)||null,A(L,V,ce,ke);case F:return V=V.get(ce.key===null?W:ce.key)||null,Q(L,V,ce,ke);case ie:var Ee=ce._init;return xe(V,L,W,Ee(ce._payload),ke)}if(Le(ce)||B(ce))return V=V.get(W)||null,se(L,V,ce,ke,null);Xa(L,ce)}return null}function we(V,L,W,ce){for(var ke=null,Ee=null,Re=L,Pe=L=0,vt=null;Re!==null&&Pe<W.length;Pe++){Re.index>Pe?(vt=Re,Re=null):vt=Re.sibling;var Ue=re(V,Re,W[Pe],ce);if(Ue===null){Re===null&&(Re=vt);break}n&&Re&&Ue.alternate===null&&s(V,Re),L=y(Ue,L,Pe),Ee===null?ke=Ue:Ee.sibling=Ue,Ee=Ue,Re=vt}if(Pe===W.length)return l(V,Re),Je&&ms(V,Pe),ke;if(Re===null){for(;Pe<W.length;Pe++)Re=oe(V,W[Pe],ce),Re!==null&&(L=y(Re,L,Pe),Ee===null?ke=Re:Ee.sibling=Re,Ee=Re);return Je&&ms(V,Pe),ke}for(Re=f(V,Re);Pe<W.length;Pe++)vt=xe(Re,V,Pe,W[Pe],ce),vt!==null&&(n&&vt.alternate!==null&&Re.delete(vt.key===null?Pe:vt.key),L=y(vt,L,Pe),Ee===null?ke=vt:Ee.sibling=vt,Ee=vt);return n&&Re.forEach(function(Qr){return s(V,Qr)}),Je&&ms(V,Pe),ke}function Se(V,L,W,ce){var ke=B(W);if(typeof ke!="function")throw Error(r(150));if(W=ke.call(W),W==null)throw Error(r(151));for(var Ee=ke=null,Re=L,Pe=L=0,vt=null,Ue=W.next();Re!==null&&!Ue.done;Pe++,Ue=W.next()){Re.index>Pe?(vt=Re,Re=null):vt=Re.sibling;var Qr=re(V,Re,Ue.value,ce);if(Qr===null){Re===null&&(Re=vt);break}n&&Re&&Qr.alternate===null&&s(V,Re),L=y(Qr,L,Pe),Ee===null?ke=Qr:Ee.sibling=Qr,Ee=Qr,Re=vt}if(Ue.done)return l(V,Re),Je&&ms(V,Pe),ke;if(Re===null){for(;!Ue.done;Pe++,Ue=W.next())Ue=oe(V,Ue.value,ce),Ue!==null&&(L=y(Ue,L,Pe),Ee===null?ke=Ue:Ee.sibling=Ue,Ee=Ue);return Je&&ms(V,Pe),ke}for(Re=f(V,Re);!Ue.done;Pe++,Ue=W.next())Ue=xe(Re,V,Pe,Ue.value,ce),Ue!==null&&(n&&Ue.alternate!==null&&Re.delete(Ue.key===null?Pe:Ue.key),L=y(Ue,L,Pe),Ee===null?ke=Ue:Ee.sibling=Ue,Ee=Ue);return n&&Re.forEach(function(GC){return s(V,GC)}),Je&&ms(V,Pe),ke}function ct(V,L,W,ce){if(typeof W=="object"&&W!==null&&W.type===I&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case M:e:{for(var ke=W.key,Ee=L;Ee!==null;){if(Ee.key===ke){if(ke=W.type,ke===I){if(Ee.tag===7){l(V,Ee.sibling),L=m(Ee,W.props.children),L.return=V,V=L;break e}}else if(Ee.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===ie&&zm(ke)===Ee.type){l(V,Ee.sibling),L=m(Ee,W.props),L.ref=xi(V,Ee,W),L.return=V,V=L;break e}l(V,Ee);break}else s(V,Ee);Ee=Ee.sibling}W.type===I?(L=ks(W.props.children,V.mode,ce,W.key),L.return=V,V=L):(ce=bl(W.type,W.key,W.props,null,V.mode,ce),ce.ref=xi(V,L,W),ce.return=V,V=ce)}return j(V);case F:e:{for(Ee=W.key;L!==null;){if(L.key===Ee)if(L.tag===4&&L.stateNode.containerInfo===W.containerInfo&&L.stateNode.implementation===W.implementation){l(V,L.sibling),L=m(L,W.children||[]),L.return=V,V=L;break e}else{l(V,L);break}else s(V,L);L=L.sibling}L=Qd(W,V.mode,ce),L.return=V,V=L}return j(V);case ie:return Ee=W._init,ct(V,L,Ee(W._payload),ce)}if(Le(W))return we(V,L,W,ce);if(B(W))return Se(V,L,W,ce);Xa(V,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,L!==null&&L.tag===6?(l(V,L.sibling),L=m(L,W),L.return=V,V=L):(l(V,L),L=qd(W,V.mode,ce),L.return=V,V=L),j(V)):l(V,L)}return ct}var ao=Bm(!0),Vm=Bm(!1),Za=Lr(null),Ja=null,lo=null,rd=null;function sd(){rd=lo=Ja=null}function od(n){var s=Za.current;Xe(Za),n._currentValue=s}function id(n,s,l){for(;n!==null;){var f=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,f!==null&&(f.childLanes|=s)):f!==null&&(f.childLanes&s)!==s&&(f.childLanes|=s),n===l)break;n=n.return}}function co(n,s){Ja=n,rd=lo=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&s)!==0&&(Ht=!0),n.firstContext=null)}function cn(n){var s=n._currentValue;if(rd!==n)if(n={context:n,memoizedValue:s,next:null},lo===null){if(Ja===null)throw Error(r(308));lo=n,Ja.dependencies={lanes:0,firstContext:n}}else lo=lo.next=n;return s}var gs=null;function ad(n){gs===null?gs=[n]:gs.push(n)}function Um(n,s,l,f){var m=s.interleaved;return m===null?(l.next=l,ad(s)):(l.next=m.next,m.next=l),s.interleaved=l,dr(n,f)}function dr(n,s){n.lanes|=s;var l=n.alternate;for(l!==null&&(l.lanes|=s),l=n,n=n.return;n!==null;)n.childLanes|=s,l=n.alternate,l!==null&&(l.childLanes|=s),l=n,n=n.return;return l.tag===3?l.stateNode:null}var zr=!1;function ld(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hm(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 fr(n,s){return{eventTime:n,lane:s,tag:0,payload:null,callback:null,next:null}}function Br(n,s,l){var f=n.updateQueue;if(f===null)return null;if(f=f.shared,(Ve&2)!==0){var m=f.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),f.pending=s,dr(n,l)}return m=f.interleaved,m===null?(s.next=s,ad(f)):(s.next=m.next,m.next=s),f.interleaved=s,dr(n,l)}function el(n,s,l){if(s=s.updateQueue,s!==null&&(s=s.shared,(l&4194240)!==0)){var f=s.lanes;f&=n.pendingLanes,l|=f,s.lanes=l,Su(n,l)}}function Wm(n,s){var l=n.updateQueue,f=n.alternate;if(f!==null&&(f=f.updateQueue,l===f)){var m=null,y=null;if(l=l.firstBaseUpdate,l!==null){do{var j={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};y===null?m=y=j:y=y.next=j,l=l.next}while(l!==null);y===null?m=y=s:y=y.next=s}else m=y=s;l={baseState:f.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:f.shared,effects:f.effects},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=s:n.next=s,l.lastBaseUpdate=s}function tl(n,s,l,f){var m=n.updateQueue;zr=!1;var y=m.firstBaseUpdate,j=m.lastBaseUpdate,P=m.shared.pending;if(P!==null){m.shared.pending=null;var A=P,Q=A.next;A.next=null,j===null?y=Q:j.next=Q,j=A;var se=n.alternate;se!==null&&(se=se.updateQueue,P=se.lastBaseUpdate,P!==j&&(P===null?se.firstBaseUpdate=Q:P.next=Q,se.lastBaseUpdate=A))}if(y!==null){var oe=m.baseState;j=0,se=Q=A=null,P=y;do{var re=P.lane,xe=P.eventTime;if((f&re)===re){se!==null&&(se=se.next={eventTime:xe,lane:0,tag:P.tag,payload:P.payload,callback:P.callback,next:null});e:{var we=n,Se=P;switch(re=s,xe=l,Se.tag){case 1:if(we=Se.payload,typeof we=="function"){oe=we.call(xe,oe,re);break e}oe=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Se.payload,re=typeof we=="function"?we.call(xe,oe,re):we,re==null)break e;oe=Y({},oe,re);break e;case 2:zr=!0}}P.callback!==null&&P.lane!==0&&(n.flags|=64,re=m.effects,re===null?m.effects=[P]:re.push(P))}else xe={eventTime:xe,lane:re,tag:P.tag,payload:P.payload,callback:P.callback,next:null},se===null?(Q=se=xe,A=oe):se=se.next=xe,j|=re;if(P=P.next,P===null){if(P=m.shared.pending,P===null)break;re=P,P=re.next,re.next=null,m.lastBaseUpdate=re,m.shared.pending=null}}while(!0);if(se===null&&(A=oe),m.baseState=A,m.firstBaseUpdate=Q,m.lastBaseUpdate=se,s=m.shared.interleaved,s!==null){m=s;do j|=m.lane,m=m.next;while(m!==s)}else y===null&&(m.shared.lanes=0);ys|=j,n.lanes=j,n.memoizedState=oe}}function Km(n,s,l){if(n=s.effects,s.effects=null,n!==null)for(s=0;s<n.length;s++){var f=n[s],m=f.callback;if(m!==null){if(f.callback=null,f=l,typeof m!="function")throw Error(r(191,m));m.call(f)}}}var vi={},Qn=Lr(vi),yi=Lr(vi),wi=Lr(vi);function xs(n){if(n===vi)throw Error(r(174));return n}function cd(n,s){switch(Qe(wi,s),Qe(yi,n),Qe(Qn,vi),n=s.nodeType,n){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:Hn(null,"");break;default:n=n===8?s.parentNode:s,s=n.namespaceURI||null,n=n.tagName,s=Hn(s,n)}Xe(Qn),Qe(Qn,s)}function uo(){Xe(Qn),Xe(yi),Xe(wi)}function qm(n){xs(wi.current);var s=xs(Qn.current),l=Hn(s,n.type);s!==l&&(Qe(yi,n),Qe(Qn,l))}function ud(n){yi.current===n&&(Xe(Qn),Xe(yi))}var st=Lr(0);function nl(n){for(var s=n;s!==null;){if(s.tag===13){var l=s.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.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 dd=[];function fd(){for(var n=0;n<dd.length;n++)dd[n]._workInProgressVersionPrimary=null;dd.length=0}var rl=T.ReactCurrentDispatcher,pd=T.ReactCurrentBatchConfig,vs=0,ot=null,ft=null,gt=null,sl=!1,bi=!1,Si=0,xC=0;function Pt(){throw Error(r(321))}function hd(n,s){if(s===null)return!1;for(var l=0;l<s.length&&l<n.length;l++)if(!jn(n[l],s[l]))return!1;return!0}function md(n,s,l,f,m,y){if(vs=y,ot=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,rl.current=n===null||n.memoizedState===null?bC:SC,n=l(f,m),bi){y=0;do{if(bi=!1,Si=0,25<=y)throw Error(r(301));y+=1,gt=ft=null,s.updateQueue=null,rl.current=kC,n=l(f,m)}while(bi)}if(rl.current=al,s=ft!==null&&ft.next!==null,vs=0,gt=ft=ot=null,sl=!1,s)throw Error(r(300));return n}function gd(){var n=Si!==0;return Si=0,n}function Gn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?ot.memoizedState=gt=n:gt=gt.next=n,gt}function un(){if(ft===null){var n=ot.alternate;n=n!==null?n.memoizedState:null}else n=ft.next;var s=gt===null?ot.memoizedState:gt.next;if(s!==null)gt=s,ft=n;else{if(n===null)throw Error(r(310));ft=n,n={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},gt===null?ot.memoizedState=gt=n:gt=gt.next=n}return gt}function ki(n,s){return typeof s=="function"?s(n):s}function xd(n){var s=un(),l=s.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var f=ft,m=f.baseQueue,y=l.pending;if(y!==null){if(m!==null){var j=m.next;m.next=y.next,y.next=j}f.baseQueue=m=y,l.pending=null}if(m!==null){y=m.next,f=f.baseState;var P=j=null,A=null,Q=y;do{var se=Q.lane;if((vs&se)===se)A!==null&&(A=A.next={lane:0,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),f=Q.hasEagerState?Q.eagerState:n(f,Q.action);else{var oe={lane:se,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null};A===null?(P=A=oe,j=f):A=A.next=oe,ot.lanes|=se,ys|=se}Q=Q.next}while(Q!==null&&Q!==y);A===null?j=f:A.next=P,jn(f,s.memoizedState)||(Ht=!0),s.memoizedState=f,s.baseState=j,s.baseQueue=A,l.lastRenderedState=f}if(n=l.interleaved,n!==null){m=n;do y=m.lane,ot.lanes|=y,ys|=y,m=m.next;while(m!==n)}else m===null&&(l.lanes=0);return[s.memoizedState,l.dispatch]}function vd(n){var s=un(),l=s.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var f=l.dispatch,m=l.pending,y=s.memoizedState;if(m!==null){l.pending=null;var j=m=m.next;do y=n(y,j.action),j=j.next;while(j!==m);jn(y,s.memoizedState)||(Ht=!0),s.memoizedState=y,s.baseQueue===null&&(s.baseState=y),l.lastRenderedState=y}return[y,f]}function Qm(){}function Gm(n,s){var l=ot,f=un(),m=s(),y=!jn(f.memoizedState,m);if(y&&(f.memoizedState=m,Ht=!0),f=f.queue,yd(Zm.bind(null,l,f,n),[n]),f.getSnapshot!==s||y||gt!==null&&gt.memoizedState.tag&1){if(l.flags|=2048,Ci(9,Xm.bind(null,l,f,m,s),void 0,null),xt===null)throw Error(r(349));(vs&30)!==0||Ym(l,s,m)}return m}function Ym(n,s,l){n.flags|=16384,n={getSnapshot:s,value:l},s=ot.updateQueue,s===null?(s={lastEffect:null,stores:null},ot.updateQueue=s,s.stores=[n]):(l=s.stores,l===null?s.stores=[n]:l.push(n))}function Xm(n,s,l,f){s.value=l,s.getSnapshot=f,Jm(s)&&eg(n)}function Zm(n,s,l){return l(function(){Jm(s)&&eg(n)})}function Jm(n){var s=n.getSnapshot;n=n.value;try{var l=s();return!jn(n,l)}catch{return!0}}function eg(n){var s=dr(n,1);s!==null&&Mn(s,n,1,-1)}function tg(n){var s=Gn();return typeof n=="function"&&(n=n()),s.memoizedState=s.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ki,lastRenderedState:n},s.queue=n,n=n.dispatch=wC.bind(null,ot,n),[s.memoizedState,n]}function Ci(n,s,l,f){return n={tag:n,create:s,destroy:l,deps:f,next:null},s=ot.updateQueue,s===null?(s={lastEffect:null,stores:null},ot.updateQueue=s,s.lastEffect=n.next=n):(l=s.lastEffect,l===null?s.lastEffect=n.next=n:(f=l.next,l.next=n,n.next=f,s.lastEffect=n)),n}function ng(){return un().memoizedState}function ol(n,s,l,f){var m=Gn();ot.flags|=n,m.memoizedState=Ci(1|s,l,void 0,f===void 0?null:f)}function il(n,s,l,f){var m=un();f=f===void 0?null:f;var y=void 0;if(ft!==null){var j=ft.memoizedState;if(y=j.destroy,f!==null&&hd(f,j.deps)){m.memoizedState=Ci(s,l,y,f);return}}ot.flags|=n,m.memoizedState=Ci(1|s,l,y,f)}function rg(n,s){return ol(8390656,8,n,s)}function yd(n,s){return il(2048,8,n,s)}function sg(n,s){return il(4,2,n,s)}function og(n,s){return il(4,4,n,s)}function ig(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 ag(n,s,l){return l=l!=null?l.concat([n]):null,il(4,4,ig.bind(null,s,n),l)}function wd(){}function lg(n,s){var l=un();s=s===void 0?null:s;var f=l.memoizedState;return f!==null&&s!==null&&hd(s,f[1])?f[0]:(l.memoizedState=[n,s],n)}function cg(n,s){var l=un();s=s===void 0?null:s;var f=l.memoizedState;return f!==null&&s!==null&&hd(s,f[1])?f[0]:(n=n(),l.memoizedState=[n,s],n)}function ug(n,s,l){return(vs&21)===0?(n.baseState&&(n.baseState=!1,Ht=!0),n.memoizedState=l):(jn(l,s)||(l=zh(),ot.lanes|=l,ys|=l,n.baseState=!0),s)}function vC(n,s){var l=Ke;Ke=l!==0&&4>l?l:4,n(!0);var f=pd.transition;pd.transition={};try{n(!1),s()}finally{Ke=l,pd.transition=f}}function dg(){return un().memoizedState}function yC(n,s,l){var f=Wr(n);if(l={lane:f,action:l,hasEagerState:!1,eagerState:null,next:null},fg(n))pg(s,l);else if(l=Um(n,s,l,f),l!==null){var m=It();Mn(l,n,f,m),hg(l,s,f)}}function wC(n,s,l){var f=Wr(n),m={lane:f,action:l,hasEagerState:!1,eagerState:null,next:null};if(fg(n))pg(s,m);else{var y=n.alternate;if(n.lanes===0&&(y===null||y.lanes===0)&&(y=s.lastRenderedReducer,y!==null))try{var j=s.lastRenderedState,P=y(j,l);if(m.hasEagerState=!0,m.eagerState=P,jn(P,j)){var A=s.interleaved;A===null?(m.next=m,ad(s)):(m.next=A.next,A.next=m),s.interleaved=m;return}}catch{}l=Um(n,s,m,f),l!==null&&(m=It(),Mn(l,n,f,m),hg(l,s,f))}}function fg(n){var s=n.alternate;return n===ot||s!==null&&s===ot}function pg(n,s){bi=sl=!0;var l=n.pending;l===null?s.next=s:(s.next=l.next,l.next=s),n.pending=s}function hg(n,s,l){if((l&4194240)!==0){var f=s.lanes;f&=n.pendingLanes,l|=f,s.lanes=l,Su(n,l)}}var al={readContext:cn,useCallback:Pt,useContext:Pt,useEffect:Pt,useImperativeHandle:Pt,useInsertionEffect:Pt,useLayoutEffect:Pt,useMemo:Pt,useReducer:Pt,useRef:Pt,useState:Pt,useDebugValue:Pt,useDeferredValue:Pt,useTransition:Pt,useMutableSource:Pt,useSyncExternalStore:Pt,useId:Pt,unstable_isNewReconciler:!1},bC={readContext:cn,useCallback:function(n,s){return Gn().memoizedState=[n,s===void 0?null:s],n},useContext:cn,useEffect:rg,useImperativeHandle:function(n,s,l){return l=l!=null?l.concat([n]):null,ol(4194308,4,ig.bind(null,s,n),l)},useLayoutEffect:function(n,s){return ol(4194308,4,n,s)},useInsertionEffect:function(n,s){return ol(4,2,n,s)},useMemo:function(n,s){var l=Gn();return s=s===void 0?null:s,n=n(),l.memoizedState=[n,s],n},useReducer:function(n,s,l){var f=Gn();return s=l!==void 0?l(s):s,f.memoizedState=f.baseState=s,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:s},f.queue=n,n=n.dispatch=yC.bind(null,ot,n),[f.memoizedState,n]},useRef:function(n){var s=Gn();return n={current:n},s.memoizedState=n},useState:tg,useDebugValue:wd,useDeferredValue:function(n){return Gn().memoizedState=n},useTransition:function(){var n=tg(!1),s=n[0];return n=vC.bind(null,n[1]),Gn().memoizedState=n,[s,n]},useMutableSource:function(){},useSyncExternalStore:function(n,s,l){var f=ot,m=Gn();if(Je){if(l===void 0)throw Error(r(407));l=l()}else{if(l=s(),xt===null)throw Error(r(349));(vs&30)!==0||Ym(f,s,l)}m.memoizedState=l;var y={value:l,getSnapshot:s};return m.queue=y,rg(Zm.bind(null,f,y,n),[n]),f.flags|=2048,Ci(9,Xm.bind(null,f,y,l,s),void 0,null),l},useId:function(){var n=Gn(),s=xt.identifierPrefix;if(Je){var l=ur,f=cr;l=(f&~(1<<32-Nn(f)-1)).toString(32)+l,s=":"+s+"R"+l,l=Si++,0<l&&(s+="H"+l.toString(32)),s+=":"}else l=xC++,s=":"+s+"r"+l.toString(32)+":";return n.memoizedState=s},unstable_isNewReconciler:!1},SC={readContext:cn,useCallback:lg,useContext:cn,useEffect:yd,useImperativeHandle:ag,useInsertionEffect:sg,useLayoutEffect:og,useMemo:cg,useReducer:xd,useRef:ng,useState:function(){return xd(ki)},useDebugValue:wd,useDeferredValue:function(n){var s=un();return ug(s,ft.memoizedState,n)},useTransition:function(){var n=xd(ki)[0],s=un().memoizedState;return[n,s]},useMutableSource:Qm,useSyncExternalStore:Gm,useId:dg,unstable_isNewReconciler:!1},kC={readContext:cn,useCallback:lg,useContext:cn,useEffect:yd,useImperativeHandle:ag,useInsertionEffect:sg,useLayoutEffect:og,useMemo:cg,useReducer:vd,useRef:ng,useState:function(){return vd(ki)},useDebugValue:wd,useDeferredValue:function(n){var s=un();return ft===null?s.memoizedState=n:ug(s,ft.memoizedState,n)},useTransition:function(){var n=vd(ki)[0],s=un().memoizedState;return[n,s]},useMutableSource:Qm,useSyncExternalStore:Gm,useId:dg,unstable_isNewReconciler:!1};function Rn(n,s){if(n&&n.defaultProps){s=Y({},s),n=n.defaultProps;for(var l in n)s[l]===void 0&&(s[l]=n[l]);return s}return s}function bd(n,s,l,f){s=n.memoizedState,l=l(f,s),l=l==null?s:Y({},s,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var ll={isMounted:function(n){return(n=n._reactInternals)?ds(n)===n:!1},enqueueSetState:function(n,s,l){n=n._reactInternals;var f=It(),m=Wr(n),y=fr(f,m);y.payload=s,l!=null&&(y.callback=l),s=Br(n,y,m),s!==null&&(Mn(s,n,m,f),el(s,n,m))},enqueueReplaceState:function(n,s,l){n=n._reactInternals;var f=It(),m=Wr(n),y=fr(f,m);y.tag=1,y.payload=s,l!=null&&(y.callback=l),s=Br(n,y,m),s!==null&&(Mn(s,n,m,f),el(s,n,m))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var l=It(),f=Wr(n),m=fr(l,f);m.tag=2,s!=null&&(m.callback=s),s=Br(n,m,f),s!==null&&(Mn(s,n,f,l),el(s,n,f))}};function mg(n,s,l,f,m,y,j){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(f,y,j):s.prototype&&s.prototype.isPureReactComponent?!ui(l,f)||!ui(m,y):!0}function gg(n,s,l){var f=!1,m=Fr,y=s.contextType;return typeof y=="object"&&y!==null?y=cn(y):(m=Ut(s)?ps:Tt.current,f=s.contextTypes,y=(f=f!=null)?ro(n,m):Fr),s=new s(l,y),n.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=ll,n.stateNode=s,s._reactInternals=n,f&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=m,n.__reactInternalMemoizedMaskedChildContext=y),s}function xg(n,s,l,f){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(l,f),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(l,f),s.state!==n&&ll.enqueueReplaceState(s,s.state,null)}function Sd(n,s,l,f){var m=n.stateNode;m.props=l,m.state=n.memoizedState,m.refs={},ld(n);var y=s.contextType;typeof y=="object"&&y!==null?m.context=cn(y):(y=Ut(s)?ps:Tt.current,m.context=ro(n,y)),m.state=n.memoizedState,y=s.getDerivedStateFromProps,typeof y=="function"&&(bd(n,s,y,l),m.state=n.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(s=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),s!==m.state&&ll.enqueueReplaceState(m,m.state,null),tl(n,l,m,f),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308)}function fo(n,s){try{var l="",f=s;do l+=Ce(f),f=f.return;while(f);var m=l}catch(y){m=`
7
+ Error generating stack: `+y.message+`
8
+ `+y.stack}return{value:n,source:s,stack:m,digest:null}}function kd(n,s,l){return{value:n,source:null,stack:l??null,digest:s??null}}function Cd(n,s){try{console.error(s.value)}catch(l){setTimeout(function(){throw l})}}var CC=typeof WeakMap=="function"?WeakMap:Map;function vg(n,s,l){l=fr(-1,l),l.tag=3,l.payload={element:null};var f=s.value;return l.callback=function(){ml||(ml=!0,$d=f),Cd(n,s)},l}function yg(n,s,l){l=fr(-1,l),l.tag=3;var f=n.type.getDerivedStateFromError;if(typeof f=="function"){var m=s.value;l.payload=function(){return f(m)},l.callback=function(){Cd(n,s)}}var y=n.stateNode;return y!==null&&typeof y.componentDidCatch=="function"&&(l.callback=function(){Cd(n,s),typeof f!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var j=s.stack;this.componentDidCatch(s.value,{componentStack:j!==null?j:""})}),l}function wg(n,s,l){var f=n.pingCache;if(f===null){f=n.pingCache=new CC;var m=new Set;f.set(s,m)}else m=f.get(s),m===void 0&&(m=new Set,f.set(s,m));m.has(l)||(m.add(l),n=FC.bind(null,n,s,l),s.then(n,n))}function bg(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 Sg(n,s,l,f,m){return(n.mode&1)===0?(n===s?n.flags|=65536:(n.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(s=fr(-1,1),s.tag=2,Br(l,s,1))),l.lanes|=1),n):(n.flags|=65536,n.lanes=m,n)}var NC=T.ReactCurrentOwner,Ht=!1;function At(n,s,l,f){s.child=n===null?Vm(s,null,l,f):ao(s,n.child,l,f)}function kg(n,s,l,f,m){l=l.render;var y=s.ref;return co(s,m),f=md(n,s,l,f,y,m),l=gd(),n!==null&&!Ht?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~m,pr(n,s,m)):(Je&&l&&Zu(s),s.flags|=1,At(n,s,f,m),s.child)}function Cg(n,s,l,f,m){if(n===null){var y=l.type;return typeof y=="function"&&!Kd(y)&&y.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(s.tag=15,s.type=y,Ng(n,s,y,f,m)):(n=bl(l.type,null,f,s,s.mode,m),n.ref=s.ref,n.return=s,s.child=n)}if(y=n.child,(n.lanes&m)===0){var j=y.memoizedProps;if(l=l.compare,l=l!==null?l:ui,l(j,f)&&n.ref===s.ref)return pr(n,s,m)}return s.flags|=1,n=qr(y,f),n.ref=s.ref,n.return=s,s.child=n}function Ng(n,s,l,f,m){if(n!==null){var y=n.memoizedProps;if(ui(y,f)&&n.ref===s.ref)if(Ht=!1,s.pendingProps=f=y,(n.lanes&m)!==0)(n.flags&131072)!==0&&(Ht=!0);else return s.lanes=n.lanes,pr(n,s,m)}return Nd(n,s,l,f,m)}function jg(n,s,l){var f=s.pendingProps,m=f.children,y=n!==null?n.memoizedState:null;if(f.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qe(ho,Jt),Jt|=l;else{if((l&1073741824)===0)return n=y!==null?y.baseLanes|l:l,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:n,cachePool:null,transitions:null},s.updateQueue=null,Qe(ho,Jt),Jt|=n,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=y!==null?y.baseLanes:l,Qe(ho,Jt),Jt|=f}else y!==null?(f=y.baseLanes|l,s.memoizedState=null):f=l,Qe(ho,Jt),Jt|=f;return At(n,s,m,l),s.child}function Eg(n,s){var l=s.ref;(n===null&&l!==null||n!==null&&n.ref!==l)&&(s.flags|=512,s.flags|=2097152)}function Nd(n,s,l,f,m){var y=Ut(l)?ps:Tt.current;return y=ro(s,y),co(s,m),l=md(n,s,l,f,y,m),f=gd(),n!==null&&!Ht?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~m,pr(n,s,m)):(Je&&f&&Zu(s),s.flags|=1,At(n,s,l,m),s.child)}function Rg(n,s,l,f,m){if(Ut(l)){var y=!0;Ka(s)}else y=!1;if(co(s,m),s.stateNode===null)ul(n,s),gg(s,l,f),Sd(s,l,f,m),f=!0;else if(n===null){var j=s.stateNode,P=s.memoizedProps;j.props=P;var A=j.context,Q=l.contextType;typeof Q=="object"&&Q!==null?Q=cn(Q):(Q=Ut(l)?ps:Tt.current,Q=ro(s,Q));var se=l.getDerivedStateFromProps,oe=typeof se=="function"||typeof j.getSnapshotBeforeUpdate=="function";oe||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(P!==f||A!==Q)&&xg(s,j,f,Q),zr=!1;var re=s.memoizedState;j.state=re,tl(s,f,j,m),A=s.memoizedState,P!==f||re!==A||Vt.current||zr?(typeof se=="function"&&(bd(s,l,se,f),A=s.memoizedState),(P=zr||mg(s,l,P,f,re,A,Q))?(oe||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(s.flags|=4194308)):(typeof j.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=A),j.props=f,j.state=A,j.context=Q,f=P):(typeof j.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{j=s.stateNode,Hm(n,s),P=s.memoizedProps,Q=s.type===s.elementType?P:Rn(s.type,P),j.props=Q,oe=s.pendingProps,re=j.context,A=l.contextType,typeof A=="object"&&A!==null?A=cn(A):(A=Ut(l)?ps:Tt.current,A=ro(s,A));var xe=l.getDerivedStateFromProps;(se=typeof xe=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(P!==oe||re!==A)&&xg(s,j,f,A),zr=!1,re=s.memoizedState,j.state=re,tl(s,f,j,m);var we=s.memoizedState;P!==oe||re!==we||Vt.current||zr?(typeof xe=="function"&&(bd(s,l,xe,f),we=s.memoizedState),(Q=zr||mg(s,l,Q,f,re,we,A)||!1)?(se||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(f,we,A),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(f,we,A)),typeof j.componentDidUpdate=="function"&&(s.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof j.componentDidUpdate!="function"||P===n.memoizedProps&&re===n.memoizedState||(s.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||P===n.memoizedProps&&re===n.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=we),j.props=f,j.state=we,j.context=A,f=Q):(typeof j.componentDidUpdate!="function"||P===n.memoizedProps&&re===n.memoizedState||(s.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||P===n.memoizedProps&&re===n.memoizedState||(s.flags|=1024),f=!1)}return jd(n,s,l,f,y,m)}function jd(n,s,l,f,m,y){Eg(n,s);var j=(s.flags&128)!==0;if(!f&&!j)return m&&_m(s,l,!1),pr(n,s,y);f=s.stateNode,NC.current=s;var P=j&&typeof l.getDerivedStateFromError!="function"?null:f.render();return s.flags|=1,n!==null&&j?(s.child=ao(s,n.child,null,y),s.child=ao(s,null,P,y)):At(n,s,P,y),s.memoizedState=f.state,m&&_m(s,l,!0),s.child}function Tg(n){var s=n.stateNode;s.pendingContext?Mm(n,s.pendingContext,s.pendingContext!==s.context):s.context&&Mm(n,s.context,!1),cd(n,s.containerInfo)}function Pg(n,s,l,f,m){return io(),nd(m),s.flags|=256,At(n,s,l,f),s.child}var Ed={dehydrated:null,treeContext:null,retryLane:0};function Rd(n){return{baseLanes:n,cachePool:null,transitions:null}}function Mg(n,s,l){var f=s.pendingProps,m=st.current,y=!1,j=(s.flags&128)!==0,P;if((P=j)||(P=n!==null&&n.memoizedState===null?!1:(m&2)!==0),P?(y=!0,s.flags&=-129):(n===null||n.memoizedState!==null)&&(m|=1),Qe(st,m&1),n===null)return td(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):(j=f.children,n=f.fallback,y?(f=s.mode,y=s.child,j={mode:"hidden",children:j},(f&1)===0&&y!==null?(y.childLanes=0,y.pendingProps=j):y=Sl(j,f,0,null),n=ks(n,f,l,null),y.return=s,n.return=s,y.sibling=n,s.child=y,s.child.memoizedState=Rd(l),s.memoizedState=Ed,n):Td(s,j));if(m=n.memoizedState,m!==null&&(P=m.dehydrated,P!==null))return jC(n,s,j,f,P,m,l);if(y){y=f.fallback,j=s.mode,m=n.child,P=m.sibling;var A={mode:"hidden",children:f.children};return(j&1)===0&&s.child!==m?(f=s.child,f.childLanes=0,f.pendingProps=A,s.deletions=null):(f=qr(m,A),f.subtreeFlags=m.subtreeFlags&14680064),P!==null?y=qr(P,y):(y=ks(y,j,l,null),y.flags|=2),y.return=s,f.return=s,f.sibling=y,s.child=f,f=y,y=s.child,j=n.child.memoizedState,j=j===null?Rd(l):{baseLanes:j.baseLanes|l,cachePool:null,transitions:j.transitions},y.memoizedState=j,y.childLanes=n.childLanes&~l,s.memoizedState=Ed,f}return y=n.child,n=y.sibling,f=qr(y,{mode:"visible",children:f.children}),(s.mode&1)===0&&(f.lanes=l),f.return=s,f.sibling=null,n!==null&&(l=s.deletions,l===null?(s.deletions=[n],s.flags|=16):l.push(n)),s.child=f,s.memoizedState=null,f}function Td(n,s){return s=Sl({mode:"visible",children:s},n.mode,0,null),s.return=n,n.child=s}function cl(n,s,l,f){return f!==null&&nd(f),ao(s,n.child,null,l),n=Td(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function jC(n,s,l,f,m,y,j){if(l)return s.flags&256?(s.flags&=-257,f=kd(Error(r(422))),cl(n,s,j,f)):s.memoizedState!==null?(s.child=n.child,s.flags|=128,null):(y=f.fallback,m=s.mode,f=Sl({mode:"visible",children:f.children},m,0,null),y=ks(y,m,j,null),y.flags|=2,f.return=s,y.return=s,f.sibling=y,s.child=f,(s.mode&1)!==0&&ao(s,n.child,null,j),s.child.memoizedState=Rd(j),s.memoizedState=Ed,y);if((s.mode&1)===0)return cl(n,s,j,null);if(m.data==="$!"){if(f=m.nextSibling&&m.nextSibling.dataset,f)var P=f.dgst;return f=P,y=Error(r(419)),f=kd(y,f,void 0),cl(n,s,j,f)}if(P=(j&n.childLanes)!==0,Ht||P){if(f=xt,f!==null){switch(j&-j){case 4:m=2;break;case 16:m=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:m=32;break;case 536870912:m=268435456;break;default:m=0}m=(m&(f.suspendedLanes|j))!==0?0:m,m!==0&&m!==y.retryLane&&(y.retryLane=m,dr(n,m),Mn(f,n,m,-1))}return Wd(),f=kd(Error(r(421))),cl(n,s,j,f)}return m.data==="$?"?(s.flags|=128,s.child=n.child,s=$C.bind(null,n),m._reactRetry=s,null):(n=y.treeContext,Zt=Or(m.nextSibling),Xt=s,Je=!0,En=null,n!==null&&(an[ln++]=cr,an[ln++]=ur,an[ln++]=hs,cr=n.id,ur=n.overflow,hs=s),s=Td(s,f.children),s.flags|=4096,s)}function Dg(n,s,l){n.lanes|=s;var f=n.alternate;f!==null&&(f.lanes|=s),id(n.return,s,l)}function Pd(n,s,l,f,m){var y=n.memoizedState;y===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:l,tailMode:m}:(y.isBackwards=s,y.rendering=null,y.renderingStartTime=0,y.last=f,y.tail=l,y.tailMode=m)}function _g(n,s,l){var f=s.pendingProps,m=f.revealOrder,y=f.tail;if(At(n,s,f.children,l),f=st.current,(f&2)!==0)f=f&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&&Dg(n,l,s);else if(n.tag===19)Dg(n,l,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}f&=1}if(Qe(st,f),(s.mode&1)===0)s.memoizedState=null;else switch(m){case"forwards":for(l=s.child,m=null;l!==null;)n=l.alternate,n!==null&&nl(n)===null&&(m=l),l=l.sibling;l=m,l===null?(m=s.child,s.child=null):(m=l.sibling,l.sibling=null),Pd(s,!1,m,l,y);break;case"backwards":for(l=null,m=s.child,s.child=null;m!==null;){if(n=m.alternate,n!==null&&nl(n)===null){s.child=m;break}n=m.sibling,m.sibling=l,l=m,m=n}Pd(s,!0,l,null,y);break;case"together":Pd(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function ul(n,s){(s.mode&1)===0&&n!==null&&(n.alternate=null,s.alternate=null,s.flags|=2)}function pr(n,s,l){if(n!==null&&(s.dependencies=n.dependencies),ys|=s.lanes,(l&s.childLanes)===0)return null;if(n!==null&&s.child!==n.child)throw Error(r(153));if(s.child!==null){for(n=s.child,l=qr(n,n.pendingProps),s.child=l,l.return=s;n.sibling!==null;)n=n.sibling,l=l.sibling=qr(n,n.pendingProps),l.return=s;l.sibling=null}return s.child}function EC(n,s,l){switch(s.tag){case 3:Tg(s),io();break;case 5:qm(s);break;case 1:Ut(s.type)&&Ka(s);break;case 4:cd(s,s.stateNode.containerInfo);break;case 10:var f=s.type._context,m=s.memoizedProps.value;Qe(Za,f._currentValue),f._currentValue=m;break;case 13:if(f=s.memoizedState,f!==null)return f.dehydrated!==null?(Qe(st,st.current&1),s.flags|=128,null):(l&s.child.childLanes)!==0?Mg(n,s,l):(Qe(st,st.current&1),n=pr(n,s,l),n!==null?n.sibling:null);Qe(st,st.current&1);break;case 19:if(f=(l&s.childLanes)!==0,(n.flags&128)!==0){if(f)return _g(n,s,l);s.flags|=128}if(m=s.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),Qe(st,st.current),f)break;return null;case 22:case 23:return s.lanes=0,jg(n,s,l)}return pr(n,s,l)}var Ag,Md,Ig,Og;Ag=function(n,s){for(var l=s.child;l!==null;){if(l.tag===5||l.tag===6)n.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},Md=function(){},Ig=function(n,s,l,f){var m=n.memoizedProps;if(m!==f){n=s.stateNode,xs(Qn.current);var y=null;switch(l){case"input":m=be(n,m),f=be(n,f),y=[];break;case"select":m=Y({},m,{value:void 0}),f=Y({},f,{value:void 0}),y=[];break;case"textarea":m=sn(n,m),f=sn(n,f),y=[];break;default:typeof m.onClick!="function"&&typeof f.onClick=="function"&&(n.onclick=Ua)}Ks(l,f);var j;l=null;for(Q in m)if(!f.hasOwnProperty(Q)&&m.hasOwnProperty(Q)&&m[Q]!=null)if(Q==="style"){var P=m[Q];for(j in P)P.hasOwnProperty(j)&&(l||(l={}),l[j]="")}else Q!=="dangerouslySetInnerHTML"&&Q!=="children"&&Q!=="suppressContentEditableWarning"&&Q!=="suppressHydrationWarning"&&Q!=="autoFocus"&&(i.hasOwnProperty(Q)?y||(y=[]):(y=y||[]).push(Q,null));for(Q in f){var A=f[Q];if(P=m?.[Q],f.hasOwnProperty(Q)&&A!==P&&(A!=null||P!=null))if(Q==="style")if(P){for(j in P)!P.hasOwnProperty(j)||A&&A.hasOwnProperty(j)||(l||(l={}),l[j]="");for(j in A)A.hasOwnProperty(j)&&P[j]!==A[j]&&(l||(l={}),l[j]=A[j])}else l||(y||(y=[]),y.push(Q,l)),l=A;else Q==="dangerouslySetInnerHTML"?(A=A?A.__html:void 0,P=P?P.__html:void 0,A!=null&&P!==A&&(y=y||[]).push(Q,A)):Q==="children"?typeof A!="string"&&typeof A!="number"||(y=y||[]).push(Q,""+A):Q!=="suppressContentEditableWarning"&&Q!=="suppressHydrationWarning"&&(i.hasOwnProperty(Q)?(A!=null&&Q==="onScroll"&&Ye("scroll",n),y||P===A||(y=[])):(y=y||[]).push(Q,A))}l&&(y=y||[]).push("style",l);var Q=y;(s.updateQueue=Q)&&(s.flags|=4)}},Og=function(n,s,l,f){l!==f&&(s.flags|=4)};function Ni(n,s){if(!Je)switch(n.tailMode){case"hidden":s=n.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?n.tail=null:l.sibling=null;break;case"collapsed":l=n.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:f.sibling=null}}function Mt(n){var s=n.alternate!==null&&n.alternate.child===n.child,l=0,f=0;if(s)for(var m=n.child;m!==null;)l|=m.lanes|m.childLanes,f|=m.subtreeFlags&14680064,f|=m.flags&14680064,m.return=n,m=m.sibling;else for(m=n.child;m!==null;)l|=m.lanes|m.childLanes,f|=m.subtreeFlags,f|=m.flags,m.return=n,m=m.sibling;return n.subtreeFlags|=f,n.childLanes=l,s}function RC(n,s,l){var f=s.pendingProps;switch(Ju(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(s),null;case 1:return Ut(s.type)&&Wa(),Mt(s),null;case 3:return f=s.stateNode,uo(),Xe(Vt),Xe(Tt),fd(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(n===null||n.child===null)&&(Ya(s)?s.flags|=4:n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,En!==null&&(Vd(En),En=null))),Md(n,s),Mt(s),null;case 5:ud(s);var m=xs(wi.current);if(l=s.type,n!==null&&s.stateNode!=null)Ig(n,s,l,f,m),n.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!f){if(s.stateNode===null)throw Error(r(166));return Mt(s),null}if(n=xs(Qn.current),Ya(s)){f=s.stateNode,l=s.type;var y=s.memoizedProps;switch(f[qn]=s,f[mi]=y,n=(s.mode&1)!==0,l){case"dialog":Ye("cancel",f),Ye("close",f);break;case"iframe":case"object":case"embed":Ye("load",f);break;case"video":case"audio":for(m=0;m<fi.length;m++)Ye(fi[m],f);break;case"source":Ye("error",f);break;case"img":case"image":case"link":Ye("error",f),Ye("load",f);break;case"details":Ye("toggle",f);break;case"input":De(f,y),Ye("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!y.multiple},Ye("invalid",f);break;case"textarea":Nr(f,y),Ye("invalid",f)}Ks(l,y),m=null;for(var j in y)if(y.hasOwnProperty(j)){var P=y[j];j==="children"?typeof P=="string"?f.textContent!==P&&(y.suppressHydrationWarning!==!0&&Va(f.textContent,P,n),m=["children",P]):typeof P=="number"&&f.textContent!==""+P&&(y.suppressHydrationWarning!==!0&&Va(f.textContent,P,n),m=["children",""+P]):i.hasOwnProperty(j)&&P!=null&&j==="onScroll"&&Ye("scroll",f)}switch(l){case"input":Me(f),Te(f,y,!0);break;case"textarea":Me(f),Ws(f);break;case"select":case"option":break;default:typeof y.onClick=="function"&&(f.onclick=Ua)}f=m,s.updateQueue=f,f!==null&&(s.flags|=4)}else{j=m.nodeType===9?m:m.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=wa(l)),n==="http://www.w3.org/1999/xhtml"?l==="script"?(n=j.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof f.is=="string"?n=j.createElement(l,{is:f.is}):(n=j.createElement(l),l==="select"&&(j=n,f.multiple?j.multiple=!0:f.size&&(j.size=f.size))):n=j.createElementNS(n,l),n[qn]=s,n[mi]=f,Ag(n,s,!1,!1),s.stateNode=n;e:{switch(j=Qo(l,f),l){case"dialog":Ye("cancel",n),Ye("close",n),m=f;break;case"iframe":case"object":case"embed":Ye("load",n),m=f;break;case"video":case"audio":for(m=0;m<fi.length;m++)Ye(fi[m],n);m=f;break;case"source":Ye("error",n),m=f;break;case"img":case"image":case"link":Ye("error",n),Ye("load",n),m=f;break;case"details":Ye("toggle",n),m=f;break;case"input":De(n,f),m=be(n,f),Ye("invalid",n);break;case"option":m=f;break;case"select":n._wrapperState={wasMultiple:!!f.multiple},m=Y({},f,{value:void 0}),Ye("invalid",n);break;case"textarea":Nr(n,f),m=sn(n,f),Ye("invalid",n);break;default:m=f}Ks(l,m),P=m;for(y in P)if(P.hasOwnProperty(y)){var A=P[y];y==="style"?ka(n,A):y==="dangerouslySetInnerHTML"?(A=A?A.__html:void 0,A!=null&&Er(n,A)):y==="children"?typeof A=="string"?(l!=="textarea"||A!=="")&&Rr(n,A):typeof A=="number"&&Rr(n,""+A):y!=="suppressContentEditableWarning"&&y!=="suppressHydrationWarning"&&y!=="autoFocus"&&(i.hasOwnProperty(y)?A!=null&&y==="onScroll"&&Ye("scroll",n):A!=null&&R(n,y,A,j))}switch(l){case"input":Me(n),Te(n,f,!1);break;case"textarea":Me(n),Ws(n);break;case"option":f.value!=null&&n.setAttribute("value",""+H(f.value));break;case"select":n.multiple=!!f.multiple,y=f.value,y!=null?qe(n,!!f.multiple,y,!1):f.defaultValue!=null&&qe(n,!!f.multiple,f.defaultValue,!0);break;default:typeof m.onClick=="function"&&(n.onclick=Ua)}switch(l){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Mt(s),null;case 6:if(n&&s.stateNode!=null)Og(n,s,n.memoizedProps,f);else{if(typeof f!="string"&&s.stateNode===null)throw Error(r(166));if(l=xs(wi.current),xs(Qn.current),Ya(s)){if(f=s.stateNode,l=s.memoizedProps,f[qn]=s,(y=f.nodeValue!==l)&&(n=Xt,n!==null))switch(n.tag){case 3:Va(f.nodeValue,l,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Va(f.nodeValue,l,(n.mode&1)!==0)}y&&(s.flags|=4)}else f=(l.nodeType===9?l:l.ownerDocument).createTextNode(f),f[qn]=s,s.stateNode=f}return Mt(s),null;case 13:if(Xe(st),f=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(Je&&Zt!==null&&(s.mode&1)!==0&&(s.flags&128)===0)$m(),io(),s.flags|=98560,y=!1;else if(y=Ya(s),f!==null&&f.dehydrated!==null){if(n===null){if(!y)throw Error(r(318));if(y=s.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[qn]=s}else io(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Mt(s),y=!1}else En!==null&&(Vd(En),En=null),y=!0;if(!y)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=l,s):(f=f!==null,f!==(n!==null&&n.memoizedState!==null)&&f&&(s.child.flags|=8192,(s.mode&1)!==0&&(n===null||(st.current&1)!==0?pt===0&&(pt=3):Wd())),s.updateQueue!==null&&(s.flags|=4),Mt(s),null);case 4:return uo(),Md(n,s),n===null&&pi(s.stateNode.containerInfo),Mt(s),null;case 10:return od(s.type._context),Mt(s),null;case 17:return Ut(s.type)&&Wa(),Mt(s),null;case 19:if(Xe(st),y=s.memoizedState,y===null)return Mt(s),null;if(f=(s.flags&128)!==0,j=y.rendering,j===null)if(f)Ni(y,!1);else{if(pt!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(j=nl(n),j!==null){for(s.flags|=128,Ni(y,!1),f=j.updateQueue,f!==null&&(s.updateQueue=f,s.flags|=4),s.subtreeFlags=0,f=l,l=s.child;l!==null;)y=l,n=f,y.flags&=14680066,j=y.alternate,j===null?(y.childLanes=0,y.lanes=n,y.child=null,y.subtreeFlags=0,y.memoizedProps=null,y.memoizedState=null,y.updateQueue=null,y.dependencies=null,y.stateNode=null):(y.childLanes=j.childLanes,y.lanes=j.lanes,y.child=j.child,y.subtreeFlags=0,y.deletions=null,y.memoizedProps=j.memoizedProps,y.memoizedState=j.memoizedState,y.updateQueue=j.updateQueue,y.type=j.type,n=j.dependencies,y.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),l=l.sibling;return Qe(st,st.current&1|2),s.child}n=n.sibling}y.tail!==null&&lt()>mo&&(s.flags|=128,f=!0,Ni(y,!1),s.lanes=4194304)}else{if(!f)if(n=nl(j),n!==null){if(s.flags|=128,f=!0,l=n.updateQueue,l!==null&&(s.updateQueue=l,s.flags|=4),Ni(y,!0),y.tail===null&&y.tailMode==="hidden"&&!j.alternate&&!Je)return Mt(s),null}else 2*lt()-y.renderingStartTime>mo&&l!==1073741824&&(s.flags|=128,f=!0,Ni(y,!1),s.lanes=4194304);y.isBackwards?(j.sibling=s.child,s.child=j):(l=y.last,l!==null?l.sibling=j:s.child=j,y.last=j)}return y.tail!==null?(s=y.tail,y.rendering=s,y.tail=s.sibling,y.renderingStartTime=lt(),s.sibling=null,l=st.current,Qe(st,f?l&1|2:l&1),s):(Mt(s),null);case 22:case 23:return Hd(),f=s.memoizedState!==null,n!==null&&n.memoizedState!==null!==f&&(s.flags|=8192),f&&(s.mode&1)!==0?(Jt&1073741824)!==0&&(Mt(s),s.subtreeFlags&6&&(s.flags|=8192)):Mt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function TC(n,s){switch(Ju(s),s.tag){case 1:return Ut(s.type)&&Wa(),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return uo(),Xe(Vt),Xe(Tt),fd(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 5:return ud(s),null;case 13:if(Xe(st),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(r(340));io()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return Xe(st),null;case 4:return uo(),null;case 10:return od(s.type._context),null;case 22:case 23:return Hd(),null;case 24:return null;default:return null}}var dl=!1,Dt=!1,PC=typeof WeakSet=="function"?WeakSet:Set,ye=null;function po(n,s){var l=n.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(f){at(n,s,f)}else l.current=null}function Dd(n,s,l){try{l()}catch(f){at(n,s,f)}}var Lg=!1;function MC(n,s){if(Hu=Ma,n=mm(),Ou(n)){if("selectionStart"in n)var l={start:n.selectionStart,end:n.selectionEnd};else e:{l=(l=n.ownerDocument)&&l.defaultView||window;var f=l.getSelection&&l.getSelection();if(f&&f.rangeCount!==0){l=f.anchorNode;var m=f.anchorOffset,y=f.focusNode;f=f.focusOffset;try{l.nodeType,y.nodeType}catch{l=null;break e}var j=0,P=-1,A=-1,Q=0,se=0,oe=n,re=null;t:for(;;){for(var xe;oe!==l||m!==0&&oe.nodeType!==3||(P=j+m),oe!==y||f!==0&&oe.nodeType!==3||(A=j+f),oe.nodeType===3&&(j+=oe.nodeValue.length),(xe=oe.firstChild)!==null;)re=oe,oe=xe;for(;;){if(oe===n)break t;if(re===l&&++Q===m&&(P=j),re===y&&++se===f&&(A=j),(xe=oe.nextSibling)!==null)break;oe=re,re=oe.parentNode}oe=xe}l=P===-1||A===-1?null:{start:P,end:A}}else l=null}l=l||{start:0,end:0}}else l=null;for(Wu={focusedElem:n,selectionRange:l},Ma=!1,ye=s;ye!==null;)if(s=ye,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,ye=n;else for(;ye!==null;){s=ye;try{var we=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(we!==null){var Se=we.memoizedProps,ct=we.memoizedState,V=s.stateNode,L=V.getSnapshotBeforeUpdate(s.elementType===s.type?Se:Rn(s.type,Se),ct);V.__reactInternalSnapshotBeforeUpdate=L}break;case 3:var W=s.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ce){at(s,s.return,ce)}if(n=s.sibling,n!==null){n.return=s.return,ye=n;break}ye=s.return}return we=Lg,Lg=!1,we}function ji(n,s,l){var f=s.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var m=f=f.next;do{if((m.tag&n)===n){var y=m.destroy;m.destroy=void 0,y!==void 0&&Dd(s,l,y)}m=m.next}while(m!==f)}}function fl(n,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&n)===n){var f=l.create;l.destroy=f()}l=l.next}while(l!==s)}}function _d(n){var s=n.ref;if(s!==null){var l=n.stateNode;n.tag,n=l,typeof s=="function"?s(n):s.current=n}}function Fg(n){var s=n.alternate;s!==null&&(n.alternate=null,Fg(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&(delete s[qn],delete s[mi],delete s[Gu],delete s[pC],delete s[hC])),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 $g(n){return n.tag===5||n.tag===3||n.tag===4}function zg(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||$g(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 Ad(n,s,l){var f=n.tag;if(f===5||f===6)n=n.stateNode,s?l.nodeType===8?l.parentNode.insertBefore(n,s):l.insertBefore(n,s):(l.nodeType===8?(s=l.parentNode,s.insertBefore(n,l)):(s=l,s.appendChild(n)),l=l._reactRootContainer,l!=null||s.onclick!==null||(s.onclick=Ua));else if(f!==4&&(n=n.child,n!==null))for(Ad(n,s,l),n=n.sibling;n!==null;)Ad(n,s,l),n=n.sibling}function Id(n,s,l){var f=n.tag;if(f===5||f===6)n=n.stateNode,s?l.insertBefore(n,s):l.appendChild(n);else if(f!==4&&(n=n.child,n!==null))for(Id(n,s,l),n=n.sibling;n!==null;)Id(n,s,l),n=n.sibling}var St=null,Tn=!1;function Vr(n,s,l){for(l=l.child;l!==null;)Bg(n,s,l),l=l.sibling}function Bg(n,s,l){if(Kn&&typeof Kn.onCommitFiberUnmount=="function")try{Kn.onCommitFiberUnmount(Na,l)}catch{}switch(l.tag){case 5:Dt||po(l,s);case 6:var f=St,m=Tn;St=null,Vr(n,s,l),St=f,Tn=m,St!==null&&(Tn?(n=St,l=l.stateNode,n.nodeType===8?n.parentNode.removeChild(l):n.removeChild(l)):St.removeChild(l.stateNode));break;case 18:St!==null&&(Tn?(n=St,l=l.stateNode,n.nodeType===8?Qu(n.parentNode,l):n.nodeType===1&&Qu(n,l),si(n)):Qu(St,l.stateNode));break;case 4:f=St,m=Tn,St=l.stateNode.containerInfo,Tn=!0,Vr(n,s,l),St=f,Tn=m;break;case 0:case 11:case 14:case 15:if(!Dt&&(f=l.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){m=f=f.next;do{var y=m,j=y.destroy;y=y.tag,j!==void 0&&((y&2)!==0||(y&4)!==0)&&Dd(l,s,j),m=m.next}while(m!==f)}Vr(n,s,l);break;case 1:if(!Dt&&(po(l,s),f=l.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=l.memoizedProps,f.state=l.memoizedState,f.componentWillUnmount()}catch(P){at(l,s,P)}Vr(n,s,l);break;case 21:Vr(n,s,l);break;case 22:l.mode&1?(Dt=(f=Dt)||l.memoizedState!==null,Vr(n,s,l),Dt=f):Vr(n,s,l);break;default:Vr(n,s,l)}}function Vg(n){var s=n.updateQueue;if(s!==null){n.updateQueue=null;var l=n.stateNode;l===null&&(l=n.stateNode=new PC),s.forEach(function(f){var m=zC.bind(null,n,f);l.has(f)||(l.add(f),f.then(m,m))})}}function Pn(n,s){var l=s.deletions;if(l!==null)for(var f=0;f<l.length;f++){var m=l[f];try{var y=n,j=s,P=j;e:for(;P!==null;){switch(P.tag){case 5:St=P.stateNode,Tn=!1;break e;case 3:St=P.stateNode.containerInfo,Tn=!0;break e;case 4:St=P.stateNode.containerInfo,Tn=!0;break e}P=P.return}if(St===null)throw Error(r(160));Bg(y,j,m),St=null,Tn=!1;var A=m.alternate;A!==null&&(A.return=null),m.return=null}catch(Q){at(m,s,Q)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Ug(s,n),s=s.sibling}function Ug(n,s){var l=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Pn(s,n),Yn(n),f&4){try{ji(3,n,n.return),fl(3,n)}catch(Se){at(n,n.return,Se)}try{ji(5,n,n.return)}catch(Se){at(n,n.return,Se)}}break;case 1:Pn(s,n),Yn(n),f&512&&l!==null&&po(l,l.return);break;case 5:if(Pn(s,n),Yn(n),f&512&&l!==null&&po(l,l.return),n.flags&32){var m=n.stateNode;try{Rr(m,"")}catch(Se){at(n,n.return,Se)}}if(f&4&&(m=n.stateNode,m!=null)){var y=n.memoizedProps,j=l!==null?l.memoizedProps:y,P=n.type,A=n.updateQueue;if(n.updateQueue=null,A!==null)try{P==="input"&&y.type==="radio"&&y.name!=null&&J(m,y),Qo(P,j);var Q=Qo(P,y);for(j=0;j<A.length;j+=2){var se=A[j],oe=A[j+1];se==="style"?ka(m,oe):se==="dangerouslySetInnerHTML"?Er(m,oe):se==="children"?Rr(m,oe):R(m,se,oe,Q)}switch(P){case"input":me(m,y);break;case"textarea":jr(m,y);break;case"select":var re=m._wrapperState.wasMultiple;m._wrapperState.wasMultiple=!!y.multiple;var xe=y.value;xe!=null?qe(m,!!y.multiple,xe,!1):re!==!!y.multiple&&(y.defaultValue!=null?qe(m,!!y.multiple,y.defaultValue,!0):qe(m,!!y.multiple,y.multiple?[]:"",!1))}m[mi]=y}catch(Se){at(n,n.return,Se)}}break;case 6:if(Pn(s,n),Yn(n),f&4){if(n.stateNode===null)throw Error(r(162));m=n.stateNode,y=n.memoizedProps;try{m.nodeValue=y}catch(Se){at(n,n.return,Se)}}break;case 3:if(Pn(s,n),Yn(n),f&4&&l!==null&&l.memoizedState.isDehydrated)try{si(s.containerInfo)}catch(Se){at(n,n.return,Se)}break;case 4:Pn(s,n),Yn(n);break;case 13:Pn(s,n),Yn(n),m=n.child,m.flags&8192&&(y=m.memoizedState!==null,m.stateNode.isHidden=y,!y||m.alternate!==null&&m.alternate.memoizedState!==null||(Fd=lt())),f&4&&Vg(n);break;case 22:if(se=l!==null&&l.memoizedState!==null,n.mode&1?(Dt=(Q=Dt)||se,Pn(s,n),Dt=Q):Pn(s,n),Yn(n),f&8192){if(Q=n.memoizedState!==null,(n.stateNode.isHidden=Q)&&!se&&(n.mode&1)!==0)for(ye=n,se=n.child;se!==null;){for(oe=ye=se;ye!==null;){switch(re=ye,xe=re.child,re.tag){case 0:case 11:case 14:case 15:ji(4,re,re.return);break;case 1:po(re,re.return);var we=re.stateNode;if(typeof we.componentWillUnmount=="function"){f=re,l=re.return;try{s=f,we.props=s.memoizedProps,we.state=s.memoizedState,we.componentWillUnmount()}catch(Se){at(f,l,Se)}}break;case 5:po(re,re.return);break;case 22:if(re.memoizedState!==null){Kg(oe);continue}}xe!==null?(xe.return=re,ye=xe):Kg(oe)}se=se.sibling}e:for(se=null,oe=n;;){if(oe.tag===5){if(se===null){se=oe;try{m=oe.stateNode,Q?(y=m.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none"):(P=oe.stateNode,A=oe.memoizedProps.style,j=A!=null&&A.hasOwnProperty("display")?A.display:null,P.style.display=Sa("display",j))}catch(Se){at(n,n.return,Se)}}}else if(oe.tag===6){if(se===null)try{oe.stateNode.nodeValue=Q?"":oe.memoizedProps}catch(Se){at(n,n.return,Se)}}else if((oe.tag!==22&&oe.tag!==23||oe.memoizedState===null||oe===n)&&oe.child!==null){oe.child.return=oe,oe=oe.child;continue}if(oe===n)break e;for(;oe.sibling===null;){if(oe.return===null||oe.return===n)break e;se===oe&&(se=null),oe=oe.return}se===oe&&(se=null),oe.sibling.return=oe.return,oe=oe.sibling}}break;case 19:Pn(s,n),Yn(n),f&4&&Vg(n);break;case 21:break;default:Pn(s,n),Yn(n)}}function Yn(n){var s=n.flags;if(s&2){try{e:{for(var l=n.return;l!==null;){if($g(l)){var f=l;break e}l=l.return}throw Error(r(160))}switch(f.tag){case 5:var m=f.stateNode;f.flags&32&&(Rr(m,""),f.flags&=-33);var y=zg(n);Id(n,y,m);break;case 3:case 4:var j=f.stateNode.containerInfo,P=zg(n);Ad(n,P,j);break;default:throw Error(r(161))}}catch(A){at(n,n.return,A)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function DC(n,s,l){ye=n,Hg(n)}function Hg(n,s,l){for(var f=(n.mode&1)!==0;ye!==null;){var m=ye,y=m.child;if(m.tag===22&&f){var j=m.memoizedState!==null||dl;if(!j){var P=m.alternate,A=P!==null&&P.memoizedState!==null||Dt;P=dl;var Q=Dt;if(dl=j,(Dt=A)&&!Q)for(ye=m;ye!==null;)j=ye,A=j.child,j.tag===22&&j.memoizedState!==null?qg(m):A!==null?(A.return=j,ye=A):qg(m);for(;y!==null;)ye=y,Hg(y),y=y.sibling;ye=m,dl=P,Dt=Q}Wg(n)}else(m.subtreeFlags&8772)!==0&&y!==null?(y.return=m,ye=y):Wg(n)}}function Wg(n){for(;ye!==null;){var s=ye;if((s.flags&8772)!==0){var l=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Dt||fl(5,s);break;case 1:var f=s.stateNode;if(s.flags&4&&!Dt)if(l===null)f.componentDidMount();else{var m=s.elementType===s.type?l.memoizedProps:Rn(s.type,l.memoizedProps);f.componentDidUpdate(m,l.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var y=s.updateQueue;y!==null&&Km(s,y,f);break;case 3:var j=s.updateQueue;if(j!==null){if(l=null,s.child!==null)switch(s.child.tag){case 5:l=s.child.stateNode;break;case 1:l=s.child.stateNode}Km(s,j,l)}break;case 5:var P=s.stateNode;if(l===null&&s.flags&4){l=P;var A=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":A.autoFocus&&l.focus();break;case"img":A.src&&(l.src=A.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var Q=s.alternate;if(Q!==null){var se=Q.memoizedState;if(se!==null){var oe=se.dehydrated;oe!==null&&si(oe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Dt||s.flags&512&&_d(s)}catch(re){at(s,s.return,re)}}if(s===n){ye=null;break}if(l=s.sibling,l!==null){l.return=s.return,ye=l;break}ye=s.return}}function Kg(n){for(;ye!==null;){var s=ye;if(s===n){ye=null;break}var l=s.sibling;if(l!==null){l.return=s.return,ye=l;break}ye=s.return}}function qg(n){for(;ye!==null;){var s=ye;try{switch(s.tag){case 0:case 11:case 15:var l=s.return;try{fl(4,s)}catch(A){at(s,l,A)}break;case 1:var f=s.stateNode;if(typeof f.componentDidMount=="function"){var m=s.return;try{f.componentDidMount()}catch(A){at(s,m,A)}}var y=s.return;try{_d(s)}catch(A){at(s,y,A)}break;case 5:var j=s.return;try{_d(s)}catch(A){at(s,j,A)}}}catch(A){at(s,s.return,A)}if(s===n){ye=null;break}var P=s.sibling;if(P!==null){P.return=s.return,ye=P;break}ye=s.return}}var _C=Math.ceil,pl=T.ReactCurrentDispatcher,Od=T.ReactCurrentOwner,dn=T.ReactCurrentBatchConfig,Ve=0,xt=null,dt=null,kt=0,Jt=0,ho=Lr(0),pt=0,Ei=null,ys=0,hl=0,Ld=0,Ri=null,Wt=null,Fd=0,mo=1/0,hr=null,ml=!1,$d=null,Ur=null,gl=!1,Hr=null,xl=0,Ti=0,zd=null,vl=-1,yl=0;function It(){return(Ve&6)!==0?lt():vl!==-1?vl:vl=lt()}function Wr(n){return(n.mode&1)===0?1:(Ve&2)!==0&&kt!==0?kt&-kt:gC.transition!==null?(yl===0&&(yl=zh()),yl):(n=Ke,n!==0||(n=window.event,n=n===void 0?16:Gh(n.type)),n)}function Mn(n,s,l,f){if(50<Ti)throw Ti=0,zd=null,Error(r(185));Jo(n,l,f),((Ve&2)===0||n!==xt)&&(n===xt&&((Ve&2)===0&&(hl|=l),pt===4&&Kr(n,kt)),Kt(n,f),l===1&&Ve===0&&(s.mode&1)===0&&(mo=lt()+500,qa&&$r()))}function Kt(n,s){var l=n.callbackNode;gk(n,s);var f=Ra(n,n===xt?kt:0);if(f===0)l!==null&&Lh(l),n.callbackNode=null,n.callbackPriority=0;else if(s=f&-f,n.callbackPriority!==s){if(l!=null&&Lh(l),s===1)n.tag===0?mC(Gg.bind(null,n)):Am(Gg.bind(null,n)),dC(function(){(Ve&6)===0&&$r()}),l=null;else{switch(Bh(f)){case 1:l=yu;break;case 4:l=Fh;break;case 16:l=Ca;break;case 536870912:l=$h;break;default:l=Ca}l=rx(l,Qg.bind(null,n))}n.callbackPriority=s,n.callbackNode=l}}function Qg(n,s){if(vl=-1,yl=0,(Ve&6)!==0)throw Error(r(327));var l=n.callbackNode;if(go()&&n.callbackNode!==l)return null;var f=Ra(n,n===xt?kt:0);if(f===0)return null;if((f&30)!==0||(f&n.expiredLanes)!==0||s)s=wl(n,f);else{s=f;var m=Ve;Ve|=2;var y=Xg();(xt!==n||kt!==s)&&(hr=null,mo=lt()+500,bs(n,s));do try{OC();break}catch(P){Yg(n,P)}while(!0);sd(),pl.current=y,Ve=m,dt!==null?s=0:(xt=null,kt=0,s=pt)}if(s!==0){if(s===2&&(m=wu(n),m!==0&&(f=m,s=Bd(n,m))),s===1)throw l=Ei,bs(n,0),Kr(n,f),Kt(n,lt()),l;if(s===6)Kr(n,f);else{if(m=n.current.alternate,(f&30)===0&&!AC(m)&&(s=wl(n,f),s===2&&(y=wu(n),y!==0&&(f=y,s=Bd(n,y))),s===1))throw l=Ei,bs(n,0),Kr(n,f),Kt(n,lt()),l;switch(n.finishedWork=m,n.finishedLanes=f,s){case 0:case 1:throw Error(r(345));case 2:Ss(n,Wt,hr);break;case 3:if(Kr(n,f),(f&130023424)===f&&(s=Fd+500-lt(),10<s)){if(Ra(n,0)!==0)break;if(m=n.suspendedLanes,(m&f)!==f){It(),n.pingedLanes|=n.suspendedLanes&m;break}n.timeoutHandle=qu(Ss.bind(null,n,Wt,hr),s);break}Ss(n,Wt,hr);break;case 4:if(Kr(n,f),(f&4194240)===f)break;for(s=n.eventTimes,m=-1;0<f;){var j=31-Nn(f);y=1<<j,j=s[j],j>m&&(m=j),f&=~y}if(f=m,f=lt()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*_C(f/1960))-f,10<f){n.timeoutHandle=qu(Ss.bind(null,n,Wt,hr),f);break}Ss(n,Wt,hr);break;case 5:Ss(n,Wt,hr);break;default:throw Error(r(329))}}}return Kt(n,lt()),n.callbackNode===l?Qg.bind(null,n):null}function Bd(n,s){var l=Ri;return n.current.memoizedState.isDehydrated&&(bs(n,s).flags|=256),n=wl(n,s),n!==2&&(s=Wt,Wt=l,s!==null&&Vd(s)),n}function Vd(n){Wt===null?Wt=n:Wt.push.apply(Wt,n)}function AC(n){for(var s=n;;){if(s.flags&16384){var l=s.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var f=0;f<l.length;f++){var m=l[f],y=m.getSnapshot;m=m.value;try{if(!jn(y(),m))return!1}catch{return!1}}}if(l=s.child,s.subtreeFlags&16384&&l!==null)l.return=s,s=l;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 Kr(n,s){for(s&=~Ld,s&=~hl,n.suspendedLanes|=s,n.pingedLanes&=~s,n=n.expirationTimes;0<s;){var l=31-Nn(s),f=1<<l;n[l]=-1,s&=~f}}function Gg(n){if((Ve&6)!==0)throw Error(r(327));go();var s=Ra(n,0);if((s&1)===0)return Kt(n,lt()),null;var l=wl(n,s);if(n.tag!==0&&l===2){var f=wu(n);f!==0&&(s=f,l=Bd(n,f))}if(l===1)throw l=Ei,bs(n,0),Kr(n,s),Kt(n,lt()),l;if(l===6)throw Error(r(345));return n.finishedWork=n.current.alternate,n.finishedLanes=s,Ss(n,Wt,hr),Kt(n,lt()),null}function Ud(n,s){var l=Ve;Ve|=1;try{return n(s)}finally{Ve=l,Ve===0&&(mo=lt()+500,qa&&$r())}}function ws(n){Hr!==null&&Hr.tag===0&&(Ve&6)===0&&go();var s=Ve;Ve|=1;var l=dn.transition,f=Ke;try{if(dn.transition=null,Ke=1,n)return n()}finally{Ke=f,dn.transition=l,Ve=s,(Ve&6)===0&&$r()}}function Hd(){Jt=ho.current,Xe(ho)}function bs(n,s){n.finishedWork=null,n.finishedLanes=0;var l=n.timeoutHandle;if(l!==-1&&(n.timeoutHandle=-1,uC(l)),dt!==null)for(l=dt.return;l!==null;){var f=l;switch(Ju(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&Wa();break;case 3:uo(),Xe(Vt),Xe(Tt),fd();break;case 5:ud(f);break;case 4:uo();break;case 13:Xe(st);break;case 19:Xe(st);break;case 10:od(f.type._context);break;case 22:case 23:Hd()}l=l.return}if(xt=n,dt=n=qr(n.current,null),kt=Jt=s,pt=0,Ei=null,Ld=hl=ys=0,Wt=Ri=null,gs!==null){for(s=0;s<gs.length;s++)if(l=gs[s],f=l.interleaved,f!==null){l.interleaved=null;var m=f.next,y=l.pending;if(y!==null){var j=y.next;y.next=m,f.next=j}l.pending=f}gs=null}return n}function Yg(n,s){do{var l=dt;try{if(sd(),rl.current=al,sl){for(var f=ot.memoizedState;f!==null;){var m=f.queue;m!==null&&(m.pending=null),f=f.next}sl=!1}if(vs=0,gt=ft=ot=null,bi=!1,Si=0,Od.current=null,l===null||l.return===null){pt=1,Ei=s,dt=null;break}e:{var y=n,j=l.return,P=l,A=s;if(s=kt,P.flags|=32768,A!==null&&typeof A=="object"&&typeof A.then=="function"){var Q=A,se=P,oe=se.tag;if((se.mode&1)===0&&(oe===0||oe===11||oe===15)){var re=se.alternate;re?(se.updateQueue=re.updateQueue,se.memoizedState=re.memoizedState,se.lanes=re.lanes):(se.updateQueue=null,se.memoizedState=null)}var xe=bg(j);if(xe!==null){xe.flags&=-257,Sg(xe,j,P,y,s),xe.mode&1&&wg(y,Q,s),s=xe,A=Q;var we=s.updateQueue;if(we===null){var Se=new Set;Se.add(A),s.updateQueue=Se}else we.add(A);break e}else{if((s&1)===0){wg(y,Q,s),Wd();break e}A=Error(r(426))}}else if(Je&&P.mode&1){var ct=bg(j);if(ct!==null){(ct.flags&65536)===0&&(ct.flags|=256),Sg(ct,j,P,y,s),nd(fo(A,P));break e}}y=A=fo(A,P),pt!==4&&(pt=2),Ri===null?Ri=[y]:Ri.push(y),y=j;do{switch(y.tag){case 3:y.flags|=65536,s&=-s,y.lanes|=s;var V=vg(y,A,s);Wm(y,V);break e;case 1:P=A;var L=y.type,W=y.stateNode;if((y.flags&128)===0&&(typeof L.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(Ur===null||!Ur.has(W)))){y.flags|=65536,s&=-s,y.lanes|=s;var ce=yg(y,P,s);Wm(y,ce);break e}}y=y.return}while(y!==null)}Jg(l)}catch(ke){s=ke,dt===l&&l!==null&&(dt=l=l.return);continue}break}while(!0)}function Xg(){var n=pl.current;return pl.current=al,n===null?al:n}function Wd(){(pt===0||pt===3||pt===2)&&(pt=4),xt===null||(ys&268435455)===0&&(hl&268435455)===0||Kr(xt,kt)}function wl(n,s){var l=Ve;Ve|=2;var f=Xg();(xt!==n||kt!==s)&&(hr=null,bs(n,s));do try{IC();break}catch(m){Yg(n,m)}while(!0);if(sd(),Ve=l,pl.current=f,dt!==null)throw Error(r(261));return xt=null,kt=0,pt}function IC(){for(;dt!==null;)Zg(dt)}function OC(){for(;dt!==null&&!ak();)Zg(dt)}function Zg(n){var s=nx(n.alternate,n,Jt);n.memoizedProps=n.pendingProps,s===null?Jg(n):dt=s,Od.current=null}function Jg(n){var s=n;do{var l=s.alternate;if(n=s.return,(s.flags&32768)===0){if(l=RC(l,s,Jt),l!==null){dt=l;return}}else{if(l=TC(l,s),l!==null){l.flags&=32767,dt=l;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{pt=6,dt=null;return}}if(s=s.sibling,s!==null){dt=s;return}dt=s=n}while(s!==null);pt===0&&(pt=5)}function Ss(n,s,l){var f=Ke,m=dn.transition;try{dn.transition=null,Ke=1,LC(n,s,l,f)}finally{dn.transition=m,Ke=f}return null}function LC(n,s,l,f){do go();while(Hr!==null);if((Ve&6)!==0)throw Error(r(327));l=n.finishedWork;var m=n.finishedLanes;if(l===null)return null;if(n.finishedWork=null,n.finishedLanes=0,l===n.current)throw Error(r(177));n.callbackNode=null,n.callbackPriority=0;var y=l.lanes|l.childLanes;if(xk(n,y),n===xt&&(dt=xt=null,kt=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||gl||(gl=!0,rx(Ca,function(){return go(),null})),y=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||y){y=dn.transition,dn.transition=null;var j=Ke;Ke=1;var P=Ve;Ve|=4,Od.current=null,MC(n,l),Ug(l,n),rC(Wu),Ma=!!Hu,Wu=Hu=null,n.current=l,DC(l),lk(),Ve=P,Ke=j,dn.transition=y}else n.current=l;if(gl&&(gl=!1,Hr=n,xl=m),y=n.pendingLanes,y===0&&(Ur=null),dk(l.stateNode),Kt(n,lt()),s!==null)for(f=n.onRecoverableError,l=0;l<s.length;l++)m=s[l],f(m.value,{componentStack:m.stack,digest:m.digest});if(ml)throw ml=!1,n=$d,$d=null,n;return(xl&1)!==0&&n.tag!==0&&go(),y=n.pendingLanes,(y&1)!==0?n===zd?Ti++:(Ti=0,zd=n):Ti=0,$r(),null}function go(){if(Hr!==null){var n=Bh(xl),s=dn.transition,l=Ke;try{if(dn.transition=null,Ke=16>n?16:n,Hr===null)var f=!1;else{if(n=Hr,Hr=null,xl=0,(Ve&6)!==0)throw Error(r(331));var m=Ve;for(Ve|=4,ye=n.current;ye!==null;){var y=ye,j=y.child;if((ye.flags&16)!==0){var P=y.deletions;if(P!==null){for(var A=0;A<P.length;A++){var Q=P[A];for(ye=Q;ye!==null;){var se=ye;switch(se.tag){case 0:case 11:case 15:ji(8,se,y)}var oe=se.child;if(oe!==null)oe.return=se,ye=oe;else for(;ye!==null;){se=ye;var re=se.sibling,xe=se.return;if(Fg(se),se===Q){ye=null;break}if(re!==null){re.return=xe,ye=re;break}ye=xe}}}var we=y.alternate;if(we!==null){var Se=we.child;if(Se!==null){we.child=null;do{var ct=Se.sibling;Se.sibling=null,Se=ct}while(Se!==null)}}ye=y}}if((y.subtreeFlags&2064)!==0&&j!==null)j.return=y,ye=j;else e:for(;ye!==null;){if(y=ye,(y.flags&2048)!==0)switch(y.tag){case 0:case 11:case 15:ji(9,y,y.return)}var V=y.sibling;if(V!==null){V.return=y.return,ye=V;break e}ye=y.return}}var L=n.current;for(ye=L;ye!==null;){j=ye;var W=j.child;if((j.subtreeFlags&2064)!==0&&W!==null)W.return=j,ye=W;else e:for(j=L;ye!==null;){if(P=ye,(P.flags&2048)!==0)try{switch(P.tag){case 0:case 11:case 15:fl(9,P)}}catch(ke){at(P,P.return,ke)}if(P===j){ye=null;break e}var ce=P.sibling;if(ce!==null){ce.return=P.return,ye=ce;break e}ye=P.return}}if(Ve=m,$r(),Kn&&typeof Kn.onPostCommitFiberRoot=="function")try{Kn.onPostCommitFiberRoot(Na,n)}catch{}f=!0}return f}finally{Ke=l,dn.transition=s}}return!1}function ex(n,s,l){s=fo(l,s),s=vg(n,s,1),n=Br(n,s,1),s=It(),n!==null&&(Jo(n,1,s),Kt(n,s))}function at(n,s,l){if(n.tag===3)ex(n,n,l);else for(;s!==null;){if(s.tag===3){ex(s,n,l);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Ur===null||!Ur.has(f))){n=fo(l,n),n=yg(s,n,1),s=Br(s,n,1),n=It(),s!==null&&(Jo(s,1,n),Kt(s,n));break}}s=s.return}}function FC(n,s,l){var f=n.pingCache;f!==null&&f.delete(s),s=It(),n.pingedLanes|=n.suspendedLanes&l,xt===n&&(kt&l)===l&&(pt===4||pt===3&&(kt&130023424)===kt&&500>lt()-Fd?bs(n,0):Ld|=l),Kt(n,s)}function tx(n,s){s===0&&((n.mode&1)===0?s=1:(s=Ea,Ea<<=1,(Ea&130023424)===0&&(Ea=4194304)));var l=It();n=dr(n,s),n!==null&&(Jo(n,s,l),Kt(n,l))}function $C(n){var s=n.memoizedState,l=0;s!==null&&(l=s.retryLane),tx(n,l)}function zC(n,s){var l=0;switch(n.tag){case 13:var f=n.stateNode,m=n.memoizedState;m!==null&&(l=m.retryLane);break;case 19:f=n.stateNode;break;default:throw Error(r(314))}f!==null&&f.delete(s),tx(n,l)}var nx;nx=function(n,s,l){if(n!==null)if(n.memoizedProps!==s.pendingProps||Vt.current)Ht=!0;else{if((n.lanes&l)===0&&(s.flags&128)===0)return Ht=!1,EC(n,s,l);Ht=(n.flags&131072)!==0}else Ht=!1,Je&&(s.flags&1048576)!==0&&Im(s,Ga,s.index);switch(s.lanes=0,s.tag){case 2:var f=s.type;ul(n,s),n=s.pendingProps;var m=ro(s,Tt.current);co(s,l),m=md(null,s,f,n,m,l);var y=gd();return s.flags|=1,typeof m=="object"&&m!==null&&typeof m.render=="function"&&m.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,Ut(f)?(y=!0,Ka(s)):y=!1,s.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,ld(s),m.updater=ll,s.stateNode=m,m._reactInternals=s,Sd(s,f,n,l),s=jd(null,s,f,!0,y,l)):(s.tag=0,Je&&y&&Zu(s),At(null,s,m,l),s=s.child),s;case 16:f=s.elementType;e:{switch(ul(n,s),n=s.pendingProps,m=f._init,f=m(f._payload),s.type=f,m=s.tag=VC(f),n=Rn(f,n),m){case 0:s=Nd(null,s,f,n,l);break e;case 1:s=Rg(null,s,f,n,l);break e;case 11:s=kg(null,s,f,n,l);break e;case 14:s=Cg(null,s,f,Rn(f.type,n),l);break e}throw Error(r(306,f,""))}return s;case 0:return f=s.type,m=s.pendingProps,m=s.elementType===f?m:Rn(f,m),Nd(n,s,f,m,l);case 1:return f=s.type,m=s.pendingProps,m=s.elementType===f?m:Rn(f,m),Rg(n,s,f,m,l);case 3:e:{if(Tg(s),n===null)throw Error(r(387));f=s.pendingProps,y=s.memoizedState,m=y.element,Hm(n,s),tl(s,f,null,l);var j=s.memoizedState;if(f=j.element,y.isDehydrated)if(y={element:f,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},s.updateQueue.baseState=y,s.memoizedState=y,s.flags&256){m=fo(Error(r(423)),s),s=Pg(n,s,f,l,m);break e}else if(f!==m){m=fo(Error(r(424)),s),s=Pg(n,s,f,l,m);break e}else for(Zt=Or(s.stateNode.containerInfo.firstChild),Xt=s,Je=!0,En=null,l=Vm(s,null,f,l),s.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(io(),f===m){s=pr(n,s,l);break e}At(n,s,f,l)}s=s.child}return s;case 5:return qm(s),n===null&&td(s),f=s.type,m=s.pendingProps,y=n!==null?n.memoizedProps:null,j=m.children,Ku(f,m)?j=null:y!==null&&Ku(f,y)&&(s.flags|=32),Eg(n,s),At(n,s,j,l),s.child;case 6:return n===null&&td(s),null;case 13:return Mg(n,s,l);case 4:return cd(s,s.stateNode.containerInfo),f=s.pendingProps,n===null?s.child=ao(s,null,f,l):At(n,s,f,l),s.child;case 11:return f=s.type,m=s.pendingProps,m=s.elementType===f?m:Rn(f,m),kg(n,s,f,m,l);case 7:return At(n,s,s.pendingProps,l),s.child;case 8:return At(n,s,s.pendingProps.children,l),s.child;case 12:return At(n,s,s.pendingProps.children,l),s.child;case 10:e:{if(f=s.type._context,m=s.pendingProps,y=s.memoizedProps,j=m.value,Qe(Za,f._currentValue),f._currentValue=j,y!==null)if(jn(y.value,j)){if(y.children===m.children&&!Vt.current){s=pr(n,s,l);break e}}else for(y=s.child,y!==null&&(y.return=s);y!==null;){var P=y.dependencies;if(P!==null){j=y.child;for(var A=P.firstContext;A!==null;){if(A.context===f){if(y.tag===1){A=fr(-1,l&-l),A.tag=2;var Q=y.updateQueue;if(Q!==null){Q=Q.shared;var se=Q.pending;se===null?A.next=A:(A.next=se.next,se.next=A),Q.pending=A}}y.lanes|=l,A=y.alternate,A!==null&&(A.lanes|=l),id(y.return,l,s),P.lanes|=l;break}A=A.next}}else if(y.tag===10)j=y.type===s.type?null:y.child;else if(y.tag===18){if(j=y.return,j===null)throw Error(r(341));j.lanes|=l,P=j.alternate,P!==null&&(P.lanes|=l),id(j,l,s),j=y.sibling}else j=y.child;if(j!==null)j.return=y;else for(j=y;j!==null;){if(j===s){j=null;break}if(y=j.sibling,y!==null){y.return=j.return,j=y;break}j=j.return}y=j}At(n,s,m.children,l),s=s.child}return s;case 9:return m=s.type,f=s.pendingProps.children,co(s,l),m=cn(m),f=f(m),s.flags|=1,At(n,s,f,l),s.child;case 14:return f=s.type,m=Rn(f,s.pendingProps),m=Rn(f.type,m),Cg(n,s,f,m,l);case 15:return Ng(n,s,s.type,s.pendingProps,l);case 17:return f=s.type,m=s.pendingProps,m=s.elementType===f?m:Rn(f,m),ul(n,s),s.tag=1,Ut(f)?(n=!0,Ka(s)):n=!1,co(s,l),gg(s,f,m),Sd(s,f,m,l),jd(null,s,f,!0,n,l);case 19:return _g(n,s,l);case 22:return jg(n,s,l)}throw Error(r(156,s.tag))};function rx(n,s){return Oh(n,s)}function BC(n,s,l,f){this.tag=n,this.key=l,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=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fn(n,s,l,f){return new BC(n,s,l,f)}function Kd(n){return n=n.prototype,!(!n||!n.isReactComponent)}function VC(n){if(typeof n=="function")return Kd(n)?1:0;if(n!=null){if(n=n.$$typeof,n===_)return 11;if(n===he)return 14}return 2}function qr(n,s){var l=n.alternate;return l===null?(l=fn(n.tag,s,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=s,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&14680064,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,s=n.dependencies,l.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l}function bl(n,s,l,f,m,y){var j=2;if(f=n,typeof n=="function")Kd(n)&&(j=1);else if(typeof n=="string")j=5;else e:switch(n){case I:return ks(l.children,m,y,s);case O:j=8,m|=8;break;case q:return n=fn(12,l,s,m|2),n.elementType=q,n.lanes=y,n;case ee:return n=fn(13,l,s,m),n.elementType=ee,n.lanes=y,n;case X:return n=fn(19,l,s,m),n.elementType=X,n.lanes=y,n;case $:return Sl(l,m,y,s);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case U:j=10;break e;case G:j=9;break e;case _:j=11;break e;case he:j=14;break e;case ie:j=16,f=null;break e}throw Error(r(130,n==null?n:typeof n,""))}return s=fn(j,l,s,m),s.elementType=n,s.type=f,s.lanes=y,s}function ks(n,s,l,f){return n=fn(7,n,f,s),n.lanes=l,n}function Sl(n,s,l,f){return n=fn(22,n,f,s),n.elementType=$,n.lanes=l,n.stateNode={isHidden:!1},n}function qd(n,s,l){return n=fn(6,n,null,s),n.lanes=l,n}function Qd(n,s,l){return s=fn(4,n.children!==null?n.children:[],n.key,s),s.lanes=l,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}function UC(n,s,l,f,m){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=bu(0),this.expirationTimes=bu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bu(0),this.identifierPrefix=f,this.onRecoverableError=m,this.mutableSourceEagerHydrationData=null}function Gd(n,s,l,f,m,y,j,P,A){return n=new UC(n,s,l,P,A),s===1?(s=1,y===!0&&(s|=8)):s=0,y=fn(3,null,null,s),n.current=y,y.stateNode=n,y.memoizedState={element:f,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},ld(y),n}function HC(n,s,l){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:F,key:f==null?null:""+f,children:n,containerInfo:s,implementation:l}}function sx(n){if(!n)return Fr;n=n._reactInternals;e:{if(ds(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(Ut(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(n.tag===1){var l=n.type;if(Ut(l))return Dm(n,l,s)}return s}function ox(n,s,l,f,m,y,j,P,A){return n=Gd(l,f,!0,n,m,y,j,P,A),n.context=sx(null),l=n.current,f=It(),m=Wr(l),y=fr(f,m),y.callback=s??null,Br(l,y,m),n.current.lanes=m,Jo(n,m,f),Kt(n,f),n}function kl(n,s,l,f){var m=s.current,y=It(),j=Wr(m);return l=sx(l),s.context===null?s.context=l:s.pendingContext=l,s=fr(y,j),s.payload={element:n},f=f===void 0?null:f,f!==null&&(s.callback=f),n=Br(m,s,j),n!==null&&(Mn(n,m,j,y),el(n,m,j)),j}function Cl(n){return n=n.current,n.child?(n.child.tag===5,n.child.stateNode):null}function ix(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<s?l:s}}function Yd(n,s){ix(n,s),(n=n.alternate)&&ix(n,s)}function WC(){return null}var ax=typeof reportError=="function"?reportError:function(n){console.error(n)};function Xd(n){this._internalRoot=n}Nl.prototype.render=Xd.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(r(409));kl(n,s,null,null)},Nl.prototype.unmount=Xd.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;ws(function(){kl(null,n,null,null)}),s[ar]=null}};function Nl(n){this._internalRoot=n}Nl.prototype.unstable_scheduleHydration=function(n){if(n){var s=Hh();n={blockedOn:null,target:n,priority:s};for(var l=0;l<_r.length&&s!==0&&s<_r[l].priority;l++);_r.splice(l,0,n),l===0&&qh(n)}};function Zd(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function jl(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function lx(){}function KC(n,s,l,f,m){if(m){if(typeof f=="function"){var y=f;f=function(){var Q=Cl(j);y.call(Q)}}var j=ox(s,f,n,0,null,!1,!1,"",lx);return n._reactRootContainer=j,n[ar]=j.current,pi(n.nodeType===8?n.parentNode:n),ws(),j}for(;m=n.lastChild;)n.removeChild(m);if(typeof f=="function"){var P=f;f=function(){var Q=Cl(A);P.call(Q)}}var A=Gd(n,0,!1,null,null,!1,!1,"",lx);return n._reactRootContainer=A,n[ar]=A.current,pi(n.nodeType===8?n.parentNode:n),ws(function(){kl(s,A,l,f)}),A}function El(n,s,l,f,m){var y=l._reactRootContainer;if(y){var j=y;if(typeof m=="function"){var P=m;m=function(){var A=Cl(j);P.call(A)}}kl(s,j,n,m)}else j=KC(l,s,n,m,f);return Cl(j)}Vh=function(n){switch(n.tag){case 3:var s=n.stateNode;if(s.current.memoizedState.isDehydrated){var l=Zo(s.pendingLanes);l!==0&&(Su(s,l|1),Kt(s,lt()),(Ve&6)===0&&(mo=lt()+500,$r()))}break;case 13:ws(function(){var f=dr(n,1);if(f!==null){var m=It();Mn(f,n,1,m)}}),Yd(n,1)}},ku=function(n){if(n.tag===13){var s=dr(n,134217728);if(s!==null){var l=It();Mn(s,n,134217728,l)}Yd(n,134217728)}},Uh=function(n){if(n.tag===13){var s=Wr(n),l=dr(n,s);if(l!==null){var f=It();Mn(l,n,s,f)}Yd(n,s)}},Hh=function(){return Ke},Wh=function(n,s){var l=Ke;try{return Ke=n,s()}finally{Ke=l}},Yo=function(n,s,l){switch(s){case"input":if(me(n,l),s=l.name,l.type==="radio"&&s!=null){for(l=n;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<l.length;s++){var f=l[s];if(f!==n&&f.form===n.form){var m=Ha(f);if(!m)throw Error(r(90));Ae(f),me(f,m)}}}break;case"textarea":jr(n,l);break;case"select":s=l.value,s!=null&&qe(n,!!l.multiple,s,!1)}},_t=Ud,Et=ws;var qC={usingClientEntryPoint:!1,Events:[gi,to,Ha,jt,Sn,Ud]},Pi={findFiberByHostInstance:fs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},QC={bundleType:Pi.bundleType,version:Pi.version,rendererPackageName:Pi.rendererPackageName,rendererConfig:Pi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=Ah(n),n===null?null:n.stateNode},findFiberByHostInstance:Pi.findFiberByHostInstance||WC,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 Rl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rl.isDisabled&&Rl.supportsFiber)try{Na=Rl.inject(QC),Kn=Rl}catch{}}return qt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qC,qt.createPortal=function(n,s){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Zd(s))throw Error(r(200));return HC(n,s,null,l)},qt.createRoot=function(n,s){if(!Zd(n))throw Error(r(299));var l=!1,f="",m=ax;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onRecoverableError!==void 0&&(m=s.onRecoverableError)),s=Gd(n,1,!1,null,null,l,!1,f,m),n[ar]=s.current,pi(n.nodeType===8?n.parentNode:n),new Xd(s)},qt.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=Ah(s),n=n===null?null:n.stateNode,n},qt.flushSync=function(n){return ws(n)},qt.hydrate=function(n,s,l){if(!jl(s))throw Error(r(200));return El(null,n,s,!0,l)},qt.hydrateRoot=function(n,s,l){if(!Zd(n))throw Error(r(405));var f=l!=null&&l.hydratedSources||null,m=!1,y="",j=ax;if(l!=null&&(l.unstable_strictMode===!0&&(m=!0),l.identifierPrefix!==void 0&&(y=l.identifierPrefix),l.onRecoverableError!==void 0&&(j=l.onRecoverableError)),s=ox(s,null,n,1,l??null,m,!1,y,j),n[ar]=s.current,pi(n),f)for(n=0;n<f.length;n++)l=f[n],m=l._getVersion,m=m(l._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[l,m]:s.mutableSourceEagerHydrationData.push(l,m);return new Nl(s)},qt.render=function(n,s,l){if(!jl(s))throw Error(r(200));return El(null,n,s,!1,l)},qt.unmountComponentAtNode=function(n){if(!jl(n))throw Error(r(40));return n._reactRootContainer?(ws(function(){El(null,null,n,!1,function(){n._reactRootContainer=null,n[ar]=null})}),!0):!1},qt.unstable_batchedUpdates=Ud,qt.unstable_renderSubtreeIntoContainer=function(n,s,l,f){if(!jl(l))throw Error(r(200));if(n==null||n._reactInternals===void 0)throw Error(r(38));return El(n,s,l,!1,f)},qt.version="18.3.1-next-f1338f8080-20240426",qt}var gx;function zv(){if(gx)return tf.exports;gx=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(),tf.exports=nN(),tf.exports}var xx;function rN(){if(xx)return Tl;xx=1;var e=zv();return Tl.createRoot=e.createRoot,Tl.hydrateRoot=e.hydrateRoot,Tl}var sN=rN(),p=yc();const He=$v(p),wc=YC({__proto__:null,default:He},[p]);function oN(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var r,o,i,c,u=[],d="",h=e.split("/");for(h[0]||h.shift();i=h.shift();)r=i[0],r==="*"?(u.push(r),d+=i[1]==="?"?"(?:/(.*))?":"/(.*)"):r===":"?(o=i.indexOf("?",1),c=i.indexOf(".",1),u.push(i.substring(1,~o?o:~c?c:i.length)),d+=~o&&!~c?"(?:/([^/]+?))?":"/([^/]+?)",~c&&(d+=(~o?"?":"")+"\\"+i.substring(c))):d+="/"+i;return{keys:u,pattern:new RegExp("^"+d+(t?"(?=$|/)":"/?$"),"i")}}var sf={exports:{}},of={};var vx;function iN(){if(vx)return of;vx=1;var e=yc();function t(v,w){return v===w&&(v!==0||1/v===1/w)||v!==v&&w!==w}var r=typeof Object.is=="function"?Object.is:t,o=e.useState,i=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function d(v,w){var S=w(),C=o({inst:{value:S,getSnapshot:w}}),b=C[0].inst,k=C[1];return c(function(){b.value=S,b.getSnapshot=w,h(b)&&k({inst:b})},[v,S,w]),i(function(){return h(b)&&k({inst:b}),v(function(){h(b)&&k({inst:b})})},[v]),u(S),S}function h(v){var w=v.getSnapshot;v=v.value;try{var S=w();return!r(v,S)}catch{return!0}}function g(v,w){return w()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:d;return of.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,of}var yx;function aN(){return yx||(yx=1,sf.exports=iN()),sf.exports}var Bv=aN();const lN=wc.useInsertionEffect,cN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",uN=cN?p.useLayoutEffect:p.useEffect,dN=lN||uN,Vv=e=>{const t=p.useRef([e,(...r)=>t[0](...r)]).current;return dN(()=>{t[0]=e}),t[1]},fN="popstate",fp="pushState",pp="replaceState",pN="hashchange",wx=[fN,fp,pp,pN],hN=e=>{for(const t of wx)addEventListener(t,e);return()=>{for(const t of wx)removeEventListener(t,e)}},Uv=(e,t)=>Bv.useSyncExternalStore(hN,e,t),bx=()=>location.search,mN=({ssrSearch:e}={})=>Uv(bx,e!=null?()=>e:bx),Sx=()=>location.pathname,gN=({ssrPath:e}={})=>Uv(Sx,e!=null?()=>e:Sx),xN=(e,{replace:t=!1,state:r=null}={})=>history[t?pp:fp](r,"",e),vN=(e={})=>[gN(e),xN],kx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[kx]>"u"){for(const e of[fp,pp]){const t=history[e];history[e]=function(){const r=t.apply(this,arguments),o=new Event(e);return o.arguments=arguments,dispatchEvent(o),r}}Object.defineProperty(window,kx,{value:!0})}const yN=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",Hv=(e="")=>e==="/"?"":e,wN=(e,t)=>e[0]==="~"?e.slice(1):Hv(t)+e,bN=(e="",t)=>yN(Cx(Hv(e)),Cx(t)),Cx=e=>{try{return decodeURI(e)}catch{return e}},Wv={hook:vN,searchHook:mN,parser:oN,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,t,r)=>e(t,r)},Kv=p.createContext(Wv),Io=()=>p.useContext(Kv),qv={},Qv=p.createContext(qv),SN=()=>p.useContext(Qv),bc=e=>{const[t,r]=e.hook(e);return[bN(e.base,t),Vv((o,i)=>e.aroundNav(r,wN(o,e.base),i))]},Oo=()=>bc(Io()),hp=(e,t,r,o)=>{const{pattern:i,keys:c}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",o),u=i.exec(r)||[],[d,...h]=u;return d!==void 0?[!0,(()=>{const g=c!==!1?Object.fromEntries(c.map((v,w)=>[v,h[w]])):u.groups;let x={...h};return g&&Object.assign(x,g),x})(),...o?[d]:[]]:[!1,null]},kN=e=>hp(Io().parser,e,Oo()[0]),Gv=({children:e,...t})=>{const r=Io(),o=t.hook?Wv:r;let i=o;const[c,u=t.ssrSearch??""]=t.ssrPath?.split("?")??[];c&&(t.ssrSearch=u,t.ssrPath=c),t.hrefs=t.hrefs??t.hook?.hrefs,t.searchHook=t.searchHook??t.hook?.searchHook;let d=p.useRef({}),h=d.current,g=h;for(let x in o){const v=x==="base"?o[x]+(t[x]??""):t[x]??o[x];h===g&&v!==g[x]&&(d.current=g={...g}),g[x]=v,(v!==o[x]||v!==i[x])&&(i=g)}return p.createElement(Kv.Provider,{value:i,children:e})},Nx=({children:e,component:t},r)=>t?p.createElement(t,{params:r}):typeof e=="function"?e(r):e,CN=e=>{let t=p.useRef(qv);const r=t.current;return t.current=Object.keys(e).length!==Object.keys(r).length||Object.entries(e).some(([o,i])=>i!==r[o])?e:r},mr=({path:e,nest:t,match:r,...o})=>{const i=Io(),[c]=bc(i),[u,d,h]=r??hp(i.parser,e,c,t),g=CN({...SN(),...d});if(!u)return null;const x=h?p.createElement(Gv,{base:h},Nx(o,g)):Nx(o,g);return p.createElement(Qv.Provider,{value:g,children:x})},Yv=p.forwardRef((e,t)=>{const r=Io(),[o,i]=bc(r),{to:c="",href:u=c,onClick:d,asChild:h,children:g,className:x,replace:v,state:w,transition:S,...C}=e,b=Vv(N=>{N.ctrlKey||N.metaKey||N.altKey||N.shiftKey||N.button!==0||(d?.(N),N.defaultPrevented||(N.preventDefault(),i(u,e)))}),k=r.hrefs(u[0]==="~"?u.slice(1):r.base+u,r);return h&&p.isValidElement(g)?p.cloneElement(g,{onClick:b,href:k}):p.createElement("a",{...C,onClick:b,href:k,className:x?.call?x(o===u):x,children:g,ref:t})}),Xv=e=>Array.isArray(e)?e.flatMap(t=>Xv(t&&t.type===p.Fragment?t.props.children:t)):[e],NN=({children:e,location:t})=>{const r=Io(),[o]=bc(r);for(const i of Xv(e)){let c=0;if(p.isValidElement(i)&&(c=hp(r.parser,i.props.path,t||o,i.props.nest))[0])return p.cloneElement(i,{match:c})}return null},Oi={v:[]},jx=()=>Oi.v.forEach(e=>e()),jN=e=>(Oi.v.push(e)===1&&addEventListener("hashchange",jx),()=>{Oi.v=Oi.v.filter(t=>t!==e),Oi.v.length||removeEventListener("hashchange",jx)}),EN=()=>"/"+location.hash.replace(/^#?\/?/,""),RN=(e,{state:t=null,replace:r=!1}={})=>{const o=location.href,[i,c]=e.replace(/^#?\/?/,"").split("?"),u=new URL(location.href);u.hash=`/${i}`,c&&(u.search=c);const d=u.href;r?history.replaceState(t,"",d):history.pushState(t,"",d);const h=typeof HashChangeEvent<"u"?new HashChangeEvent("hashchange",{oldURL:o,newURL:d}):new Event("hashchange",{detail:{oldURL:o,newURL:d}});dispatchEvent(h)},Zv=({ssrPath:e="/"}={})=>[Bv.useSyncExternalStore(jN,EN,()=>e),RN];Zv.hrefs=e=>"#"+e;var Lo=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(){}},TN={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},PN=class{#e=TN;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},js=new PN;function MN(e){setTimeout(e,0)}var Ps=typeof window>"u"||"Deno"in globalThis;function Ot(){}function DN(e,t){return typeof e=="function"?e(t):e}function Pf(e){return typeof e=="number"&&e>=0&&e!==1/0}function Jv(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Jr(e,t){return typeof e=="function"?e(t):e}function pn(e,t){return typeof e=="function"?e(t):e}function Ex(e,t){const{type:r="all",exact:o,fetchStatus:i,predicate:c,queryKey:u,stale:d}=e;if(u){if(o){if(t.queryHash!==mp(u,t.options))return!1}else if(!Ki(t.queryKey,u))return!1}if(r!=="all"){const h=t.isActive();if(r==="active"&&!h||r==="inactive"&&h)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||i&&i!==t.state.fetchStatus||c&&!c(t))}function Rx(e,t){const{exact:r,status:o,predicate:i,mutationKey:c}=e;if(c){if(!t.options.mutationKey)return!1;if(r){if(Ms(t.options.mutationKey)!==Ms(c))return!1}else if(!Ki(t.options.mutationKey,c))return!1}return!(o&&t.state.status!==o||i&&!i(t))}function mp(e,t){return(t?.queryKeyHashFn||Ms)(e)}function Ms(e){return JSON.stringify(e,(t,r)=>Mf(r)?Object.keys(r).sort().reduce((o,i)=>(o[i]=r[i],o),{}):r)}function Ki(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Ki(e[r],t[r])):!1}var _N=Object.prototype.hasOwnProperty;function ey(e,t,r=0){if(e===t)return e;if(r>500)return t;const o=Tx(e)&&Tx(t);if(!o&&!(Mf(e)&&Mf(t)))return t;const c=(o?e:Object.keys(e)).length,u=o?t:Object.keys(t),d=u.length,h=o?new Array(d):{};let g=0;for(let x=0;x<d;x++){const v=o?x:u[x],w=e[v],S=t[v];if(w===S){h[v]=w,(o?x<c:_N.call(e,v))&&g++;continue}if(w===null||S===null||typeof w!="object"||typeof S!="object"){h[v]=S;continue}const C=ey(w,S,r+1);h[v]=C,C===w&&g++}return c===d&&g===c?e:h}function Gl(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 Tx(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Mf(e){if(!Px(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Px(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Px(e){return Object.prototype.toString.call(e)==="[object Object]"}function AN(e){return new Promise(t=>{js.setTimeout(t,e)})}function Df(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?ey(e,t):t}function IN(e,t,r=0){const o=[...e,t];return r&&o.length>r?o.slice(1):o}function ON(e,t,r=0){const o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var gp=Symbol();function ty(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===gp?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function xp(e,t){return typeof e=="function"?e(...t):!!e}function LN(e,t,r){let o=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),o||(o=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)}),e}var FN=class extends Lo{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Ps&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},vp=new FN;function _f(){let e,t;const r=new Promise((i,c)=>{e=i,t=c});r.status="pending",r.catch(()=>{});function o(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{o({status:"fulfilled",value:i}),e(i)},r.reject=i=>{o({status:"rejected",reason:i}),t(i)},r}var $N=MN;function zN(){let e=[],t=0,r=d=>{d()},o=d=>{d()},i=$N;const c=d=>{t?e.push(d):i(()=>{r(d)})},u=()=>{const d=e;e=[],d.length&&i(()=>{o(()=>{d.forEach(h=>{r(h)})})})};return{batch:d=>{let h;t++;try{h=d()}finally{t--,t||u()}return h},batchCalls:d=>(...h)=>{c(()=>{d(...h)})},schedule:c,setNotifyFunction:d=>{r=d},setBatchNotifyFunction:d=>{o=d},setScheduler:d=>{i=d}}}var mt=zN(),BN=class extends Lo{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Ps&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}},Yl=new BN;function VN(e){return Math.min(1e3*2**e,3e4)}function ny(e){return(e??"online")==="online"?Yl.isOnline():!0}var Af=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function ry(e){let t=!1,r=0,o;const i=_f(),c=()=>i.status!=="pending",u=b=>{if(!c()){const k=new Af(b);w(k),e.onCancel?.(k)}},d=()=>{t=!0},h=()=>{t=!1},g=()=>vp.isFocused()&&(e.networkMode==="always"||Yl.isOnline())&&e.canRun(),x=()=>ny(e.networkMode)&&e.canRun(),v=b=>{c()||(o?.(),i.resolve(b))},w=b=>{c()||(o?.(),i.reject(b))},S=()=>new Promise(b=>{o=k=>{(c()||g())&&b(k)},e.onPause?.()}).then(()=>{o=void 0,c()||e.onContinue?.()}),C=()=>{if(c())return;let b;const k=r===0?e.initialPromise:void 0;try{b=k??e.fn()}catch(N){b=Promise.reject(N)}Promise.resolve(b).then(v).catch(N=>{if(c())return;const E=e.retry??(Ps?0:3),R=e.retryDelay??VN,T=typeof R=="function"?R(r,N):R,M=E===!0||typeof E=="number"&&r<E||typeof E=="function"&&E(r,N);if(t||!M){w(N);return}r++,e.onFail?.(r,N),AN(T).then(()=>g()?void 0:S()).then(()=>{t?w(N):C()})})};return{promise:i,status:()=>i.status,cancel:u,continue:()=>(o?.(),i),cancelRetry:d,continueRetry:h,canStart:x,start:()=>(x()?C():S().then(C),i)}}var sy=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Pf(this.gcTime)&&(this.#e=js.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ps?1/0:300*1e3))}clearGcTimeout(){this.#e&&(js.clearTimeout(this.#e),this.#e=void 0)}},UN=class extends sy{#e;#t;#n;#s;#r;#i;#a;constructor(e){super(),this.#a=!1,this.#i=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#n=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Dx(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#i,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Dx(this.options);t.data!==void 0&&(this.setState(Mx(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const r=Df(this.state.data,e,this.options);return this.#o({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(Ot).catch(Ot):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>pn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===gp||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Jr(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Jv(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#a?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const d=this.observers.find(h=>h.options.queryFn);d&&this.setOptions(d.options)}const r=new AbortController,o=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(this.#a=!0,r.signal)})},i=()=>{const d=ty(this.options,t),g=(()=>{const x={client:this.#s,queryKey:this.queryKey,meta:this.meta};return o(x),x})();return this.#a=!1,this.options.persister?this.options.persister(d,g,this):d(g)},u=(()=>{const d={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:i};return o(d),d})();this.options.behavior?.onFetch(u,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#o({type:"fetch",meta:u.fetchOptions?.meta}),this.#r=ry({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:d=>{d instanceof Af&&d.revert&&this.setState({...this.#t,fetchStatus:"idle"}),r.abort()},onFail:(d,h)=>{this.#o({type:"failed",failureCount:d,error:h})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const d=await this.#r.start();if(d===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(d),this.#n.config.onSuccess?.(d,this),this.#n.config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof Af){if(d.silent)return this.#r.promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw this.#o({type:"error",error:d}),this.#n.config.onError?.(d,this),this.#n.config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}#o(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...oy(r.data,this.options),fetchMeta:e.meta??null};case"success":const o={...r,...Mx(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?o:void 0,o;case"error":const i=e.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),mt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function oy(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ny(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Mx(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Dx(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,o=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var HN=class extends Lo{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=_f(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#s=void 0;#r;#i;#a;#o;#m;#f;#p;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),_x(this.#t,this.options)?this.#d():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return If(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return If(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#b(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof pn(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Gl(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const o=this.hasListeners();o&&Ax(this.#t,r,this.options,t)&&this.#d(),this.updateResult(),o&&(this.#t!==r||pn(this.options.enabled,this.#t)!==pn(t.enabled,this.#t)||Jr(this.options.staleTime,this.#t)!==Jr(t.staleTime,this.#t))&&this.#g();const i=this.#x();o&&(this.#t!==r||pn(this.options.enabled,this.#t)!==pn(t.enabled,this.#t)||i!==this.#l)&&this.#v(i)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);return KN(this,r)&&(this.#s=r,this.#i=this.options,this.#r=this.#t.state),r}getCurrentResult(){return this.#s}trackResult(e,t){return new Proxy(e,{get:(r,o)=>(this.trackProp(o),t?.(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,o))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#d(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Ot)),t}#g(){this.#w();const e=Jr(this.options.staleTime,this.#t);if(Ps||this.#s.isStale||!Pf(e))return;const r=Jv(this.#s.dataUpdatedAt,e)+1;this.#c=js.setTimeout(()=>{this.#s.isStale||this.updateResult()},r)}#x(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#b(),this.#l=e,!(Ps||pn(this.options.enabled,this.#t)===!1||!Pf(this.#l)||this.#l===0)&&(this.#u=js.setInterval(()=>{(this.options.refetchIntervalInBackground||vp.isFocused())&&this.#d()},this.#l))}#y(){this.#g(),this.#v(this.#x())}#w(){this.#c&&(js.clearTimeout(this.#c),this.#c=void 0)}#b(){this.#u&&(js.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#t,o=this.options,i=this.#s,c=this.#r,u=this.#i,h=e!==r?e.state:this.#n,{state:g}=e;let x={...g},v=!1,w;if(t._optimisticResults){const O=this.hasListeners(),q=!O&&_x(e,t),U=O&&Ax(e,r,t,o);(q||U)&&(x={...x,...oy(g.data,e.options)}),t._optimisticResults==="isRestoring"&&(x.fetchStatus="idle")}let{error:S,errorUpdatedAt:C,status:b}=x;w=x.data;let k=!1;if(t.placeholderData!==void 0&&w===void 0&&b==="pending"){let O;i?.isPlaceholderData&&t.placeholderData===u?.placeholderData?(O=i.data,k=!0):O=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,O!==void 0&&(b="success",w=Df(i?.data,O,t),v=!0)}if(t.select&&w!==void 0&&!k)if(i&&w===c?.data&&t.select===this.#m)w=this.#f;else try{this.#m=t.select,w=t.select(w),w=Df(i?.data,w,t),this.#f=w,this.#o=null}catch(O){this.#o=O}this.#o&&(S=this.#o,w=this.#f,C=Date.now(),b="error");const N=x.fetchStatus==="fetching",E=b==="pending",R=b==="error",T=E&&N,M=w!==void 0,I={status:b,fetchStatus:x.fetchStatus,isPending:E,isSuccess:b==="success",isError:R,isInitialLoading:T,isLoading:T,data:w,dataUpdatedAt:x.dataUpdatedAt,error:S,errorUpdatedAt:C,failureCount:x.fetchFailureCount,failureReason:x.fetchFailureReason,errorUpdateCount:x.errorUpdateCount,isFetched:x.dataUpdateCount>0||x.errorUpdateCount>0,isFetchedAfterMount:x.dataUpdateCount>h.dataUpdateCount||x.errorUpdateCount>h.errorUpdateCount,isFetching:N,isRefetching:N&&!E,isLoadingError:R&&!M,isPaused:x.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:R&&M,isStale:yp(e,t),refetch:this.refetch,promise:this.#a,isEnabled:pn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const O=I.data!==void 0,q=I.status==="error"&&!O,U=ee=>{q?ee.reject(I.error):O&&ee.resolve(I.data)},G=()=>{const ee=this.#a=I.promise=_f();U(ee)},_=this.#a;switch(_.status){case"pending":e.queryHash===r.queryHash&&U(_);break;case"fulfilled":(q||I.data!==_.value)&&G();break;case"rejected":(!q||I.error!==_.reason)&&G();break}}return I}updateResult(){const e=this.#s,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#i=this.options,this.#r.data!==void 0&&(this.#p=this.#t),Gl(t,e))return;this.#s=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!this.#h.size)return!0;const c=new Set(i??this.#h);return this.options.throwOnError&&c.add("error"),Object.keys(this.#s).some(u=>{const d=u;return this.#s[d]!==e[d]&&c.has(d)})};this.#k({listeners:r()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#k(e){mt.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function WN(e,t){return pn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _x(e,t){return WN(e,t)||e.state.data!==void 0&&If(e,t,t.refetchOnMount)}function If(e,t,r){if(pn(t.enabled,e)!==!1&&Jr(t.staleTime,e)!=="static"){const o=typeof r=="function"?r(e):r;return o==="always"||o!==!1&&yp(e,t)}return!1}function Ax(e,t,r,o){return(e!==t||pn(o.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&yp(e,r)}function yp(e,t){return pn(t.enabled,e)!==!1&&e.isStaleByTime(Jr(t.staleTime,e))}function KN(e,t){return!Gl(e.getCurrentResult(),t)}function Ix(e){return{onFetch:(t,r)=>{const o=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,c=t.state.data?.pages||[],u=t.state.data?.pageParams||[];let d={pages:[],pageParams:[]},h=0;const g=async()=>{let x=!1;const v=C=>{LN(C,()=>t.signal,()=>x=!0)},w=ty(t.options,t.fetchOptions),S=async(C,b,k)=>{if(x)return Promise.reject();if(b==null&&C.pages.length)return Promise.resolve(C);const E=(()=>{const F={client:t.client,queryKey:t.queryKey,pageParam:b,direction:k?"backward":"forward",meta:t.options.meta};return v(F),F})(),R=await w(E),{maxPages:T}=t.options,M=k?ON:IN;return{pages:M(C.pages,R,T),pageParams:M(C.pageParams,b,T)}};if(i&&c.length){const C=i==="backward",b=C?qN:Ox,k={pages:c,pageParams:u},N=b(o,k);d=await S(k,N,C)}else{const C=e??c.length;do{const b=h===0?u[0]??o.initialPageParam:Ox(o,d);if(h>0&&b==null)break;d=await S(d,b),h++}while(h<C)}return d};t.options.persister?t.fetchFn=()=>t.options.persister?.(g,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=g}}}function Ox(e,{pages:t,pageParams:r}){const o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,r[o],r):void 0}function qN(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var QN=class extends sy{#e;#t;#n;#s;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||iy(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#s=ry({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(c,u)=>{this.#r({type:"failed",failureCount:c,error:u})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const o=this.state.status==="pending",i=!this.#s.canStart();try{if(o)t();else{this.#r({type:"pending",variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,r);const u=await this.options.onMutate?.(e,r);u!==this.state.context&&this.#r({type:"pending",context:u,variables:e,isPaused:i})}const c=await this.#s.start();return await this.#n.config.onSuccess?.(c,e,this.state.context,this,r),await this.options.onSuccess?.(c,e,this.state.context,r),await this.#n.config.onSettled?.(c,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(c,null,e,this.state.context,r),this.#r({type:"success",data:c}),c}catch(c){try{await this.#n.config.onError?.(c,e,this.state.context,this,r)}catch(u){Promise.reject(u)}try{await this.options.onError?.(c,e,this.state.context,r)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,c,this.state.variables,this.state.context,this,r)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,c,e,this.state.context,r)}catch(u){Promise.reject(u)}throw this.#r({type:"error",error:c}),c}finally{this.#n.runNext(this)}}#r(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),mt.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function iy(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var GN=class extends Lo{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,r){const o=new QN({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:r});return this.add(o),o}add(e){this.#e.add(e);const t=Pl(e);if(typeof t=="string"){const r=this.#t.get(t);r?r.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Pl(e);if(typeof t=="string"){const r=this.#t.get(t);if(r)if(r.length>1){const o=r.indexOf(e);o!==-1&&r.splice(o,1)}else r[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Pl(e);if(typeof t=="string"){const o=this.#t.get(t)?.find(i=>i.state.status==="pending");return!o||o===e}else return!0}runNext(e){const t=Pl(e);return typeof t=="string"?this.#t.get(t)?.find(o=>o!==e&&o.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){mt.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Rx(t,r))}findAll(e={}){return this.getAll().filter(t=>Rx(e,t))}notify(e){mt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return mt.batch(()=>Promise.all(e.map(t=>t.continue().catch(Ot))))}};function Pl(e){return e.options.scope?.id}var YN=class extends Lo{#e;#t=void 0;#n;#s;constructor(t,r){super(),this.#e=t,this.setOptions(r),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const r=this.options;this.options=this.#e.defaultMutationOptions(t),Gl(this.options,r)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),r?.mutationKey&&this.options.mutationKey&&Ms(r.mutationKey)!==Ms(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#i(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#i()}mutate(t,r){return this.#s=r,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??iy();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#i(t){mt.batch(()=>{if(this.#s&&this.hasListeners()){const r=this.#t.variables,o=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#s.onSuccess?.(t.data,r,o,i)}catch(c){Promise.reject(c)}try{this.#s.onSettled?.(t.data,null,r,o,i)}catch(c){Promise.reject(c)}}else if(t?.type==="error"){try{this.#s.onError?.(t.error,r,o,i)}catch(c){Promise.reject(c)}try{this.#s.onSettled?.(void 0,t.error,r,o,i)}catch(c){Promise.reject(c)}}}this.listeners.forEach(r=>{r(this.#t)})})}},XN=class extends Lo{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){const o=t.queryKey,i=t.queryHash??mp(o,t);let c=this.get(i);return c||(c=new UN({client:e,queryKey:o,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(o)}),this.add(c)),c}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){mt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Ex(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>Ex(e,r)):t}notify(e){mt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){mt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){mt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ZN=class{#e;#t;#n;#s;#r;#i;#a;#o;constructor(e={}){this.#e=e.queryCache||new XN,this.#t=e.mutationCache||new GN,this.#n=e.defaultOptions||{},this.#s=new Map,this.#r=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#a=vp.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=Yl.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#e.build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Jr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:r})=>{const o=r.data;return[t,o]})}setQueryData(e,t,r){const o=this.defaultQueryOptions({queryKey:e}),c=this.#e.get(o.queryHash)?.state.data,u=DN(t,c);if(u!==void 0)return this.#e.build(this,o).setData(u,{...r,manual:!0})}setQueriesData(e,t,r){return mt.batch(()=>this.#e.findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;mt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#e;return mt.batch(()=>(r.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},o=mt.batch(()=>this.#e.findAll(e).map(i=>i.cancel(r)));return Promise.all(o).then(Ot).catch(Ot)}invalidateQueries(e,t={}){return mt.batch(()=>(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},o=mt.batch(()=>this.#e.findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let c=i.fetch(void 0,r);return r.throwOnError||(c=c.catch(Ot)),i.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(o).then(Ot)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#e.build(this,t);return r.isStaleByTime(Jr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ot).catch(Ot)}fetchInfiniteQuery(e){return e.behavior=Ix(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ot).catch(Ot)}ensureInfiniteQueryData(e){return e.behavior=Ix(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Yl.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#s.set(Ms(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#s.values()],r={};return t.forEach(o=>{Ki(e,o.queryKey)&&Object.assign(r,o.defaultOptions)}),r}setMutationDefaults(e,t){this.#r.set(Ms(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],r={};return t.forEach(o=>{Ki(e,o.mutationKey)&&Object.assign(r,o.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=mp(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===gp&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},ay=p.createContext(void 0),rn=e=>{const t=p.useContext(ay);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},JN=({client:e,children:t})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(ay.Provider,{value:e,children:t})),ly=p.createContext(!1),ej=()=>p.useContext(ly);ly.Provider;function tj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var nj=p.createContext(tj()),rj=()=>p.useContext(nj),sj=(e,t,r)=>{const o=r?.state.error&&typeof e.throwOnError=="function"?xp(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=!1))},oj=e=>{p.useEffect(()=>{e.clearReset()},[e])},ij=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(i&&e.data===void 0||xp(r,[e.error,o])),aj=e=>{if(e.suspense){const r=i=>i==="static"?i:Math.max(i??1e3,1e3),o=e.staleTime;e.staleTime=typeof o=="function"?(...i)=>r(o(...i)):r(o),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},lj=(e,t)=>e.isLoading&&e.isFetching&&!t,cj=(e,t)=>e?.suspense&&t.isPending,Lx=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function uj(e,t,r){const o=ej(),i=rj(),c=rn(),u=c.defaultQueryOptions(e);c.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const d=c.getQueryCache().get(u.queryHash);u._optimisticResults=o?"isRestoring":"optimistic",aj(u),sj(u,i,d),oj(i);const h=!c.getQueryCache().get(u.queryHash),[g]=p.useState(()=>new t(c,u)),x=g.getOptimisticResult(u),v=!o&&e.subscribed!==!1;if(p.useSyncExternalStore(p.useCallback(w=>{const S=v?g.subscribe(mt.batchCalls(w)):Ot;return g.updateResult(),S},[g,v]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),p.useEffect(()=>{g.setOptions(u)},[u,g]),cj(u,x))throw Lx(u,g,i);if(ij({result:x,errorResetBoundary:i,throwOnError:u.throwOnError,query:d,suspense:u.suspense}))throw x.error;return c.getDefaultOptions().queries?._experimental_afterQuery?.(u,x),u.experimental_prefetchInRender&&!Ps&&lj(x,o)&&(h?Lx(u,g,i):d?.promise)?.catch(Ot).finally(()=>{g.updateResult()}),u.notifyOnChangeProps?x:g.trackResult(x)}function it(e,t){return uj(e,HN)}function Ct(e,t){const r=rn(),[o]=p.useState(()=>new YN(r,e));p.useEffect(()=>{o.setOptions(e)},[o,e]);const i=p.useSyncExternalStore(p.useCallback(u=>o.subscribe(mt.batchCalls(u)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),c=p.useCallback((u,d)=>{o.mutate(u,d).catch(Ot)},[o]);if(i.error&&xp(o.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:c,mutateAsync:i.mutate}}const cy="__PORT_5000__".startsWith("__")?"":"__PORT_5000__";async function uy(e){if(!e.ok){const t=await e.text()||e.statusText;throw new Error(`${e.status}: ${t}`)}}async function je(e,t,r){const o=await fetch(`${cy}${t}`,{method:e,headers:r?{"Content-Type":"application/json"}:{},body:r?JSON.stringify(r):void 0});return await uy(o),o}function Oe(e,t){if(!t)return e;const r=e.includes("?")?"&":"?";return`${e}${r}${t.startsWith("?")?t.slice(1):t}`}const dj=({on401:e})=>async({queryKey:t})=>{const r=await fetch(`${cy}${t.join("/")}`);return await uy(r),await r.json()},fj=new ZN({defaultOptions:{queries:{queryFn:dj({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!1,staleTime:1/0,retry:!1},mutations:{retry:!1}}}),pj=1,hj=1e6;let af=0;function mj(){return af=(af+1)%Number.MAX_SAFE_INTEGER,af.toString()}const lf=new Map,Fx=e=>{if(lf.has(e))return;const t=setTimeout(()=>{lf.delete(e),zi({type:"REMOVE_TOAST",toastId:e})},hj);lf.set(e,t)},gj=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,pj)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?Fx(r):e.toasts.forEach(o=>{Fx(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===r||r===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Bl=[];let Vl={toasts:[]};function zi(e){Vl=gj(Vl,e),Bl.forEach(t=>{t(Vl)})}function xj({...e}){const t=mj(),r=i=>zi({type:"UPDATE_TOAST",toast:{...i,id:t}}),o=()=>zi({type:"DISMISS_TOAST",toastId:t});return zi({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||o()}}}),{id:t,dismiss:o,update:r}}function os(){const[e,t]=p.useState(Vl);return p.useEffect(()=>(Bl.push(t),()=>{const r=Bl.indexOf(t);r>-1&&Bl.splice(r,1)}),[e]),{...e,toast:xj,dismiss:r=>zi({type:"DISMISS_TOAST",toastId:r})}}var In=zv();const vj=$v(In);function le(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),r===!1||!i.defaultPrevented)return t?.(i)}}function $x(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function nr(...e){return t=>{let r=!1;const o=e.map(i=>{const c=$x(i,t);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let i=0;i<o.length;i++){const c=o[i];typeof c=="function"?c():$x(e[i],null)}}}}function _e(...e){return p.useCallback(nr(...e),e)}function yj(e,t){const r=p.createContext(t),o=c=>{const{children:u,...d}=c,h=p.useMemo(()=>d,Object.values(d));return a.jsx(r.Provider,{value:h,children:u})};o.displayName=e+"Provider";function i(c){const u=p.useContext(r);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${c}\` must be used within \`${e}\``)}return[o,i]}function Qt(e,t=[]){let r=[];function o(c,u){const d=p.createContext(u),h=r.length;r=[...r,u];const g=v=>{const{scope:w,children:S,...C}=v,b=w?.[e]?.[h]||d,k=p.useMemo(()=>C,Object.values(C));return a.jsx(b.Provider,{value:k,children:S})};g.displayName=c+"Provider";function x(v,w){const S=w?.[e]?.[h]||d,C=p.useContext(S);if(C)return C;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${c}\``)}return[g,x]}const i=()=>{const c=r.map(u=>p.createContext(u));return function(d){const h=d?.[e]||c;return p.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return i.scopeName=e,[o,wj(i,...t)]}function wj(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const o=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(c){const u=o.reduce((d,{useScope:h,scopeName:g})=>{const v=h(c)[`__scope${g}`];return{...d,...v}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function zx(e){const t=bj(e),r=p.forwardRef((o,i)=>{const{children:c,...u}=o,d=p.Children.toArray(c),h=d.find(kj);if(h){const g=h.props.children,x=d.map(v=>v===h?p.Children.count(g)>1?p.Children.only(null):p.isValidElement(g)?g.props.children:null:v);return a.jsx(t,{...u,ref:i,children:p.isValidElement(g)?p.cloneElement(g,void 0,x):null})}return a.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}function bj(e){const t=p.forwardRef((r,o)=>{const{children:i,...c}=r;if(p.isValidElement(i)){const u=Nj(i),d=Cj(c,i.props);return i.type!==p.Fragment&&(d.ref=o?nr(o,u):u),p.cloneElement(i,d)}return p.Children.count(i)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sj=Symbol("radix.slottable");function kj(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Sj}function Cj(e,t){const r={...t};for(const o in t){const i=e[o],c=t[o];/^on[A-Z]/.test(o)?i&&c?r[o]=(...d)=>{const h=c(...d);return i(...d),h}:i&&(r[o]=i):o==="style"?r[o]={...i,...c}:o==="className"&&(r[o]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function Nj(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Sc(e){const t=e+"CollectionProvider",[r,o]=Qt(t),[i,c]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=b=>{const{scope:k,children:N}=b,E=He.useRef(null),R=He.useRef(new Map).current;return a.jsx(i,{scope:k,itemMap:R,collectionRef:E,children:N})};u.displayName=t;const d=e+"CollectionSlot",h=zx(d),g=He.forwardRef((b,k)=>{const{scope:N,children:E}=b,R=c(d,N),T=_e(k,R.collectionRef);return a.jsx(h,{ref:T,children:E})});g.displayName=d;const x=e+"CollectionItemSlot",v="data-radix-collection-item",w=zx(x),S=He.forwardRef((b,k)=>{const{scope:N,children:E,...R}=b,T=He.useRef(null),M=_e(k,T),F=c(x,N);return He.useEffect(()=>(F.itemMap.set(T,{ref:T,...R}),()=>{F.itemMap.delete(T)})),a.jsx(w,{[v]:"",ref:M,children:E})});S.displayName=x;function C(b){const k=c(e+"CollectionConsumer",b);return He.useCallback(()=>{const E=k.collectionRef.current;if(!E)return[];const R=Array.from(E.querySelectorAll(`[${v}]`));return Array.from(k.itemMap.values()).sort((F,I)=>R.indexOf(F.ref.current)-R.indexOf(I.ref.current))},[k.collectionRef,k.itemMap])}return[{Provider:u,Slot:g,ItemSlot:S},C,o]}function jj(e){const t=Ej(e),r=p.forwardRef((o,i)=>{const{children:c,...u}=o,d=p.Children.toArray(c),h=d.find(Tj);if(h){const g=h.props.children,x=d.map(v=>v===h?p.Children.count(g)>1?p.Children.only(null):p.isValidElement(g)?g.props.children:null:v);return a.jsx(t,{...u,ref:i,children:p.isValidElement(g)?p.cloneElement(g,void 0,x):null})}return a.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}function Ej(e){const t=p.forwardRef((r,o)=>{const{children:i,...c}=r;if(p.isValidElement(i)){const u=Mj(i),d=Pj(c,i.props);return i.type!==p.Fragment&&(d.ref=o?nr(o,u):u),p.cloneElement(i,d)}return p.Children.count(i)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Rj=Symbol("radix.slottable");function Tj(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rj}function Pj(e,t){const r={...t};for(const o in t){const i=e[o],c=t[o];/^on[A-Z]/.test(o)?i&&c?r[o]=(...d)=>{const h=c(...d);return i(...d),h}:i&&(r[o]=i):o==="style"?r[o]={...i,...c}:o==="className"&&(r[o]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function Mj(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Dj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=Dj.reduce((e,t)=>{const r=jj(`Primitive.${t}`),o=p.forwardRef((i,c)=>{const{asChild:u,...d}=i,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(h,{...d,ref:c})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function wp(e,t){e&&In.flushSync(()=>e.dispatchEvent(t))}function ut(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...r)=>t.current?.(...r),[])}function _j(e,t=globalThis?.document){const r=ut(e);p.useEffect(()=>{const o=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[r,t])}var Aj="DismissableLayer",Of="dismissableLayer.update",Ij="dismissableLayer.pointerDownOutside",Oj="dismissableLayer.focusOutside",Bx,dy=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Bs=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:c,onInteractOutside:u,onDismiss:d,...h}=e,g=p.useContext(dy),[x,v]=p.useState(null),w=x?.ownerDocument??globalThis?.document,[,S]=p.useState({}),C=_e(t,I=>v(I)),b=Array.from(g.layers),[k]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),N=b.indexOf(k),E=x?b.indexOf(x):-1,R=g.layersWithOutsidePointerEventsDisabled.size>0,T=E>=N,M=Fj(I=>{const O=I.target,q=[...g.branches].some(U=>U.contains(O));!T||q||(i?.(I),u?.(I),I.defaultPrevented||d?.())},w),F=$j(I=>{const O=I.target;[...g.branches].some(U=>U.contains(O))||(c?.(I),u?.(I),I.defaultPrevented||d?.())},w);return _j(I=>{E===g.layers.size-1&&(o?.(I),!I.defaultPrevented&&d&&(I.preventDefault(),d()))},w),p.useEffect(()=>{if(x)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(Bx=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(x)),g.layers.add(x),Vx(),()=>{r&&g.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=Bx)}},[x,w,r,g]),p.useEffect(()=>()=>{x&&(g.layers.delete(x),g.layersWithOutsidePointerEventsDisabled.delete(x),Vx())},[x,g]),p.useEffect(()=>{const I=()=>S({});return document.addEventListener(Of,I),()=>document.removeEventListener(Of,I)},[]),a.jsx(Ne.div,{...h,ref:C,style:{pointerEvents:R?T?"auto":"none":void 0,...e.style},onFocusCapture:le(e.onFocusCapture,F.onFocusCapture),onBlurCapture:le(e.onBlurCapture,F.onBlurCapture),onPointerDownCapture:le(e.onPointerDownCapture,M.onPointerDownCapture)})});Bs.displayName=Aj;var Lj="DismissableLayerBranch",fy=p.forwardRef((e,t)=>{const r=p.useContext(dy),o=p.useRef(null),i=_e(t,o);return p.useEffect(()=>{const c=o.current;if(c)return r.branches.add(c),()=>{r.branches.delete(c)}},[r.branches]),a.jsx(Ne.div,{...e,ref:i})});fy.displayName=Lj;function Fj(e,t=globalThis?.document){const r=ut(e),o=p.useRef(!1),i=p.useRef(()=>{});return p.useEffect(()=>{const c=d=>{if(d.target&&!o.current){let h=function(){py(Ij,r,g,{discrete:!0})};const g={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);o.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",c),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>o.current=!0}}function $j(e,t=globalThis?.document){const r=ut(e),o=p.useRef(!1);return p.useEffect(()=>{const i=c=>{c.target&&!o.current&&py(Oj,r,{originalEvent:c},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Vx(){const e=new CustomEvent(Of);document.dispatchEvent(e)}function py(e,t,r,{discrete:o}){const i=r.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),o?wp(i,c):i.dispatchEvent(c)}var zj=Bs,Bj=fy,wt=globalThis?.document?p.useLayoutEffect:()=>{},Vj="Portal",Fo=p.forwardRef((e,t)=>{const{container:r,...o}=e,[i,c]=p.useState(!1);wt(()=>c(!0),[]);const u=r||i&&globalThis?.document?.body;return u?vj.createPortal(a.jsx(Ne.div,{...o,ref:t}),u):null});Fo.displayName=Vj;function Uj(e,t){return p.useReducer((r,o)=>t[r][o]??r,e)}var bt=e=>{const{present:t,children:r}=e,o=Hj(t),i=typeof r=="function"?r({present:o.isPresent}):p.Children.only(r),c=_e(o.ref,Wj(i));return typeof r=="function"||o.isPresent?p.cloneElement(i,{ref:c}):null};bt.displayName="Presence";function Hj(e){const[t,r]=p.useState(),o=p.useRef(null),i=p.useRef(e),c=p.useRef("none"),u=e?"mounted":"unmounted",[d,h]=Uj(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const g=Ml(o.current);c.current=d==="mounted"?g:"none"},[d]),wt(()=>{const g=o.current,x=i.current;if(x!==e){const w=c.current,S=Ml(g);e?h("MOUNT"):S==="none"||g?.display==="none"?h("UNMOUNT"):h(x&&w!==S?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),wt(()=>{if(t){let g;const x=t.ownerDocument.defaultView??window,v=S=>{const b=Ml(o.current).includes(CSS.escape(S.animationName));if(S.target===t&&b&&(h("ANIMATION_END"),!i.current)){const k=t.style.animationFillMode;t.style.animationFillMode="forwards",g=x.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=k)})}},w=S=>{S.target===t&&(c.current=Ml(o.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{x.clearTimeout(g),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:p.useCallback(g=>{o.current=g?getComputedStyle(g):null,r(g)},[])}}function Ml(e){return e?.animationName||"none"}function Wj(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Kj=wc[" useInsertionEffect ".trim().toString()]||wt;function Fn({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[i,c,u]=qj({defaultProp:t,onChange:r}),d=e!==void 0,h=d?e:i;{const x=p.useRef(e!==void 0);p.useEffect(()=>{const v=x.current;v!==d&&console.warn(`${o} is changing from ${v?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),x.current=d},[d,o])}const g=p.useCallback(x=>{if(d){const v=Qj(x)?x(e):x;v!==e&&u.current?.(v)}else c(x)},[d,e,c,u]);return[h,g]}function qj({defaultProp:e,onChange:t}){const[r,o]=p.useState(e),i=p.useRef(r),c=p.useRef(t);return Kj(()=>{c.current=t},[t]),p.useEffect(()=>{i.current!==r&&(c.current?.(r),i.current=r)},[r,i]),[r,o,c]}function Qj(e){return typeof e=="function"}var hy=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Gj="VisuallyHidden",kc=p.forwardRef((e,t)=>a.jsx(Ne.span,{...e,ref:t,style:{...hy,...e.style}}));kc.displayName=Gj;var Yj=kc,bp="ToastProvider",[Sp,Xj,Zj]=Sc("Toast"),[my]=Qt("Toast",[Zj]),[Jj,Cc]=my(bp),gy=e=>{const{__scopeToast:t,label:r="Notification",duration:o=5e3,swipeDirection:i="right",swipeThreshold:c=50,children:u}=e,[d,h]=p.useState(null),[g,x]=p.useState(0),v=p.useRef(!1),w=p.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${bp}\`. Expected non-empty \`string\`.`),a.jsx(Sp.Provider,{scope:t,children:a.jsx(Jj,{scope:t,label:r,duration:o,swipeDirection:i,swipeThreshold:c,toastCount:g,viewport:d,onViewportChange:h,onToastAdd:p.useCallback(()=>x(S=>S+1),[]),onToastRemove:p.useCallback(()=>x(S=>S-1),[]),isFocusedToastEscapeKeyDownRef:v,isClosePausedRef:w,children:u})})};gy.displayName=bp;var xy="ToastViewport",e2=["F8"],Lf="toast.viewportPause",Ff="toast.viewportResume",vy=p.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:o=e2,label:i="Notifications ({hotkey})",...c}=e,u=Cc(xy,r),d=Xj(r),h=p.useRef(null),g=p.useRef(null),x=p.useRef(null),v=p.useRef(null),w=_e(t,v,u.onViewportChange),S=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),C=u.toastCount>0;p.useEffect(()=>{const k=N=>{o.length!==0&&o.every(R=>N[R]||N.code===R)&&v.current?.focus()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o]),p.useEffect(()=>{const k=h.current,N=v.current;if(C&&k&&N){const E=()=>{if(!u.isClosePausedRef.current){const F=new CustomEvent(Lf);N.dispatchEvent(F),u.isClosePausedRef.current=!0}},R=()=>{if(u.isClosePausedRef.current){const F=new CustomEvent(Ff);N.dispatchEvent(F),u.isClosePausedRef.current=!1}},T=F=>{!k.contains(F.relatedTarget)&&R()},M=()=>{k.contains(document.activeElement)||R()};return k.addEventListener("focusin",E),k.addEventListener("focusout",T),k.addEventListener("pointermove",E),k.addEventListener("pointerleave",M),window.addEventListener("blur",E),window.addEventListener("focus",R),()=>{k.removeEventListener("focusin",E),k.removeEventListener("focusout",T),k.removeEventListener("pointermove",E),k.removeEventListener("pointerleave",M),window.removeEventListener("blur",E),window.removeEventListener("focus",R)}}},[C,u.isClosePausedRef]);const b=p.useCallback(({tabbingDirection:k})=>{const E=d().map(R=>{const T=R.ref.current,M=[T,...p2(T)];return k==="forwards"?M:M.reverse()});return(k==="forwards"?E.reverse():E).flat()},[d]);return p.useEffect(()=>{const k=v.current;if(k){const N=E=>{const R=E.altKey||E.ctrlKey||E.metaKey;if(E.key==="Tab"&&!R){const M=document.activeElement,F=E.shiftKey;if(E.target===k&&F){g.current?.focus();return}const q=b({tabbingDirection:F?"backwards":"forwards"}),U=q.findIndex(G=>G===M);cf(q.slice(U+1))?E.preventDefault():F?g.current?.focus():x.current?.focus()}};return k.addEventListener("keydown",N),()=>k.removeEventListener("keydown",N)}},[d,b]),a.jsxs(Bj,{ref:h,role:"region","aria-label":i.replace("{hotkey}",S),tabIndex:-1,style:{pointerEvents:C?void 0:"none"},children:[C&&a.jsx($f,{ref:g,onFocusFromOutsideViewport:()=>{const k=b({tabbingDirection:"forwards"});cf(k)}}),a.jsx(Sp.Slot,{scope:r,children:a.jsx(Ne.ol,{tabIndex:-1,...c,ref:w})}),C&&a.jsx($f,{ref:x,onFocusFromOutsideViewport:()=>{const k=b({tabbingDirection:"backwards"});cf(k)}})]})});vy.displayName=xy;var yy="ToastFocusProxy",$f=p.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:o,...i}=e,c=Cc(yy,r);return a.jsx(kc,{tabIndex:0,...i,ref:t,style:{position:"fixed"},onFocus:u=>{const d=u.relatedTarget;!c.viewport?.contains(d)&&o()}})});$f.displayName=yy;var ta="Toast",t2="toast.swipeStart",n2="toast.swipeMove",r2="toast.swipeCancel",s2="toast.swipeEnd",wy=p.forwardRef((e,t)=>{const{forceMount:r,open:o,defaultOpen:i,onOpenChange:c,...u}=e,[d,h]=Fn({prop:o,defaultProp:i??!0,onChange:c,caller:ta});return a.jsx(bt,{present:r||d,children:a.jsx(a2,{open:d,...u,ref:t,onClose:()=>h(!1),onPause:ut(e.onPause),onResume:ut(e.onResume),onSwipeStart:le(e.onSwipeStart,g=>{g.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:le(e.onSwipeMove,g=>{const{x,y:v}=g.detail.delta;g.currentTarget.setAttribute("data-swipe","move"),g.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${x}px`),g.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${v}px`)}),onSwipeCancel:le(e.onSwipeCancel,g=>{g.currentTarget.setAttribute("data-swipe","cancel"),g.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),g.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),g.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),g.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:le(e.onSwipeEnd,g=>{const{x,y:v}=g.detail.delta;g.currentTarget.setAttribute("data-swipe","end"),g.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),g.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),g.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${x}px`),g.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${v}px`),h(!1)})})})});wy.displayName=ta;var[o2,i2]=my(ta,{onClose(){}}),a2=p.forwardRef((e,t)=>{const{__scopeToast:r,type:o="foreground",duration:i,open:c,onClose:u,onEscapeKeyDown:d,onPause:h,onResume:g,onSwipeStart:x,onSwipeMove:v,onSwipeCancel:w,onSwipeEnd:S,...C}=e,b=Cc(ta,r),[k,N]=p.useState(null),E=_e(t,X=>N(X)),R=p.useRef(null),T=p.useRef(null),M=i||b.duration,F=p.useRef(0),I=p.useRef(M),O=p.useRef(0),{onToastAdd:q,onToastRemove:U}=b,G=ut(()=>{k?.contains(document.activeElement)&&b.viewport?.focus(),u()}),_=p.useCallback(X=>{!X||X===1/0||(window.clearTimeout(O.current),F.current=new Date().getTime(),O.current=window.setTimeout(G,X))},[G]);p.useEffect(()=>{const X=b.viewport;if(X){const he=()=>{_(I.current),g?.()},ie=()=>{const $=new Date().getTime()-F.current;I.current=I.current-$,window.clearTimeout(O.current),h?.()};return X.addEventListener(Lf,ie),X.addEventListener(Ff,he),()=>{X.removeEventListener(Lf,ie),X.removeEventListener(Ff,he)}}},[b.viewport,M,h,g,_]),p.useEffect(()=>{c&&!b.isClosePausedRef.current&&_(M)},[c,M,b.isClosePausedRef,_]),p.useEffect(()=>(q(),()=>U()),[q,U]);const ee=p.useMemo(()=>k?Ey(k):null,[k]);return b.viewport?a.jsxs(a.Fragment,{children:[ee&&a.jsx(l2,{__scopeToast:r,role:"status","aria-live":o==="foreground"?"assertive":"polite",children:ee}),a.jsx(o2,{scope:r,onClose:G,children:In.createPortal(a.jsx(Sp.ItemSlot,{scope:r,children:a.jsx(zj,{asChild:!0,onEscapeKeyDown:le(d,()=>{b.isFocusedToastEscapeKeyDownRef.current||G(),b.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Ne.li,{tabIndex:0,"data-state":c?"open":"closed","data-swipe-direction":b.swipeDirection,...C,ref:E,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:le(e.onKeyDown,X=>{X.key==="Escape"&&(d?.(X.nativeEvent),X.nativeEvent.defaultPrevented||(b.isFocusedToastEscapeKeyDownRef.current=!0,G()))}),onPointerDown:le(e.onPointerDown,X=>{X.button===0&&(R.current={x:X.clientX,y:X.clientY})}),onPointerMove:le(e.onPointerMove,X=>{if(!R.current)return;const he=X.clientX-R.current.x,ie=X.clientY-R.current.y,$=!!T.current,z=["left","right"].includes(b.swipeDirection),B=["left","up"].includes(b.swipeDirection)?Math.min:Math.max,Y=z?B(0,he):0,D=z?0:B(0,ie),K=X.pointerType==="touch"?10:2,ue={x:Y,y:D},ge={originalEvent:X,delta:ue};$?(T.current=ue,Dl(n2,v,ge,{discrete:!1})):Ux(ue,b.swipeDirection,K)?(T.current=ue,Dl(t2,x,ge,{discrete:!1}),X.target.setPointerCapture(X.pointerId)):(Math.abs(he)>K||Math.abs(ie)>K)&&(R.current=null)}),onPointerUp:le(e.onPointerUp,X=>{const he=T.current,ie=X.target;if(ie.hasPointerCapture(X.pointerId)&&ie.releasePointerCapture(X.pointerId),T.current=null,R.current=null,he){const $=X.currentTarget,z={originalEvent:X,delta:he};Ux(he,b.swipeDirection,b.swipeThreshold)?Dl(s2,S,z,{discrete:!0}):Dl(r2,w,z,{discrete:!0}),$.addEventListener("click",B=>B.preventDefault(),{once:!0})}})})})}),b.viewport)})]}):null}),l2=e=>{const{__scopeToast:t,children:r,...o}=e,i=Cc(ta,t),[c,u]=p.useState(!1),[d,h]=p.useState(!1);return d2(()=>u(!0)),p.useEffect(()=>{const g=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(g)},[]),d?null:a.jsx(Fo,{asChild:!0,children:a.jsx(kc,{...o,children:c&&a.jsxs(a.Fragment,{children:[i.label," ",r]})})})},c2="ToastTitle",by=p.forwardRef((e,t)=>{const{__scopeToast:r,...o}=e;return a.jsx(Ne.div,{...o,ref:t})});by.displayName=c2;var u2="ToastDescription",Sy=p.forwardRef((e,t)=>{const{__scopeToast:r,...o}=e;return a.jsx(Ne.div,{...o,ref:t})});Sy.displayName=u2;var ky="ToastAction",Cy=p.forwardRef((e,t)=>{const{altText:r,...o}=e;return r.trim()?a.jsx(jy,{altText:r,asChild:!0,children:a.jsx(kp,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ky}\`. Expected non-empty \`string\`.`),null)});Cy.displayName=ky;var Ny="ToastClose",kp=p.forwardRef((e,t)=>{const{__scopeToast:r,...o}=e,i=i2(Ny,r);return a.jsx(jy,{asChild:!0,children:a.jsx(Ne.button,{type:"button",...o,ref:t,onClick:le(e.onClick,i.onClose)})})});kp.displayName=Ny;var jy=p.forwardRef((e,t)=>{const{__scopeToast:r,altText:o,...i}=e;return a.jsx(Ne.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...i,ref:t})});function Ey(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),f2(o)){const i=o.ariaHidden||o.hidden||o.style.display==="none",c=o.dataset.radixToastAnnounceExclude==="";if(!i)if(c){const u=o.dataset.radixToastAnnounceAlt;u&&t.push(u)}else t.push(...Ey(o))}}),t}function Dl(e,t,r,{discrete:o}){const i=r.originalEvent.currentTarget,c=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),o?wp(i,c):i.dispatchEvent(c)}var Ux=(e,t,r=0)=>{const o=Math.abs(e.x),i=Math.abs(e.y),c=o>i;return t==="left"||t==="right"?c&&o>r:!c&&i>r};function d2(e=()=>{}){const t=ut(e);wt(()=>{let r=0,o=0;return r=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(o)}},[t])}function f2(e){return e.nodeType===e.ELEMENT_NODE}function p2(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const i=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||i?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function cf(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var h2=gy,Ry=vy,Ty=wy,Py=by,My=Sy,Dy=Cy,_y=kp;function Ay(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Ay(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function Iy(){for(var e,t,r=0,o="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Ay(e))&&(o&&(o+=" "),o+=t);return o}const Hx=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Wx=Iy,$o=(e,t)=>r=>{var o;if(t?.variants==null)return Wx(e,r?.class,r?.className);const{variants:i,defaultVariants:c}=t,u=Object.keys(i).map(g=>{const x=r?.[g],v=c?.[g];if(x===null)return null;const w=Hx(x)||Hx(v);return i[g][w]}),d=r&&Object.entries(r).reduce((g,x)=>{let[v,w]=x;return w===void 0||(g[v]=w),g},{}),h=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((g,x)=>{let{class:v,className:w,...S}=x;return Object.entries(S).every(C=>{let[b,k]=C;return Array.isArray(k)?k.includes({...c,...d}[b]):{...c,...d}[b]===k})?[...g,v,w]:g},[]);return Wx(e,u,h,r?.class,r?.className)};const m2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Oy=(...e)=>e.filter((t,r,o)=>!!t&&o.indexOf(t)===r).join(" ");var g2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const x2=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:i="",children:c,iconNode:u,...d},h)=>p.createElement("svg",{ref:h,...g2,width:t,height:t,stroke:e,strokeWidth:o?Number(r)*24/Number(t):r,className:Oy("lucide",i),...d},[...u.map(([g,x])=>p.createElement(g,x)),...Array.isArray(c)?c:[c]]));const de=(e,t)=>{const r=p.forwardRef(({className:o,...i},c)=>p.createElement(x2,{ref:c,iconNode:t,className:Oy(`lucide-${m2(e)}`,o),...i}));return r.displayName=`${e}`,r};const v2=de("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const Ly=de("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);const y2=de("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const na=de("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);const Fy=de("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const xr=de("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const vr=de("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const On=de("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const $y=de("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Nc=de("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const w2=de("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const b2=de("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const zy=de("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const By=de("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const S2=de("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const k2=de("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);const Cp=de("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const Np=de("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const jc=de("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const Vy=de("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const Ec=de("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const C2=de("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);const N2=de("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);const j2=de("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);const tn=de("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const E2=de("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const R2=de("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const T2=de("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);const Rc=de("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const P2=de("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const M2=de("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);const D2=de("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);const jp=de("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const _2=de("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);const A2=de("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const I2=de("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);const O2=de("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);const L2=de("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const F2=de("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);const Ep=de("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);const Es=de("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const kr=de("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);const $2=de("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const z2=de("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);const B2=de("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const V2=de("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);const qi=de("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);const zf=de("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);const U2=de("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const H2=de("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);const Uy=de("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);const W2=de("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);const K2=de("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);const yr=de("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const q2=de("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const Q2=de("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const G2=de("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const Y2=de("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);const Hy=de("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const Rs=de("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const X2=de("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);const Wy=de("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Z2=de("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const Ky=de("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);const Bi=de("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const ts=de("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const Rp=de("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);const J2=de("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const qy=de("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);const eE=de("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const tE=de("Thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]);const nE=de("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);const is=de("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const rE=de("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Ul=de("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const Tp=de("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);const er=de("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Qy=de("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);const sE=de("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);const oE=de("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Pp="-",iE=e=>{const t=lE(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:u=>{const d=u.split(Pp);return d[0]===""&&d.length!==1&&d.shift(),Gy(d,t)||aE(u)},getConflictingClassGroupIds:(u,d)=>{const h=r[u]||[];return d&&o[u]?[...h,...o[u]]:h}}},Gy=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],o=t.nextPart.get(r),i=o?Gy(e.slice(1),o):void 0;if(i)return i;if(t.validators.length===0)return;const c=e.join(Pp);return t.validators.find(({validator:u})=>u(c))?.classGroupId},Kx=/^\[(.+)\]$/,aE=e=>{if(Kx.test(e)){const t=Kx.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},lE=e=>{const{theme:t,prefix:r}=e,o={nextPart:new Map,validators:[]};return uE(Object.entries(e.classGroups),r).forEach(([c,u])=>{Bf(u,o,c,t)}),o},Bf=(e,t,r,o)=>{e.forEach(i=>{if(typeof i=="string"){const c=i===""?t:qx(t,i);c.classGroupId=r;return}if(typeof i=="function"){if(cE(i)){Bf(i(o),t,r,o);return}t.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([c,u])=>{Bf(u,qx(t,c),r,o)})})},qx=(e,t)=>{let r=e;return t.split(Pp).forEach(o=>{r.nextPart.has(o)||r.nextPart.set(o,{nextPart:new Map,validators:[]}),r=r.nextPart.get(o)}),r},cE=e=>e.isThemeGetter,uE=(e,t)=>t?e.map(([r,o])=>{const i=o.map(c=>typeof c=="string"?t+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([u,d])=>[t+u,d])):c);return[r,i]}):e,dE=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,o=new Map;const i=(c,u)=>{r.set(c,u),t++,t>e&&(t=0,o=r,r=new Map)};return{get(c){let u=r.get(c);if(u!==void 0)return u;if((u=o.get(c))!==void 0)return i(c,u),u},set(c,u){r.has(c)?r.set(c,u):i(c,u)}}},Yy="!",fE=e=>{const{separator:t,experimentalParseClassName:r}=e,o=t.length===1,i=t[0],c=t.length,u=d=>{const h=[];let g=0,x=0,v;for(let k=0;k<d.length;k++){let N=d[k];if(g===0){if(N===i&&(o||d.slice(k,k+c)===t)){h.push(d.slice(x,k)),x=k+c;continue}if(N==="/"){v=k;continue}}N==="["?g++:N==="]"&&g--}const w=h.length===0?d:d.substring(x),S=w.startsWith(Yy),C=S?w.substring(1):w,b=v&&v>x?v-x:void 0;return{modifiers:h,hasImportantModifier:S,baseClassName:C,maybePostfixModifierPosition:b}};return r?d=>r({className:d,parseClassName:u}):u},pE=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(o=>{o[0]==="["?(t.push(...r.sort(),o),r=[]):r.push(o)}),t.push(...r.sort()),t},hE=e=>({cache:dE(e.cacheSize),parseClassName:fE(e),...iE(e)}),mE=/\s+/,gE=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:i}=t,c=[],u=e.trim().split(mE);let d="";for(let h=u.length-1;h>=0;h-=1){const g=u[h],{modifiers:x,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:S}=r(g);let C=!!S,b=o(C?w.substring(0,S):w);if(!b){if(!C){d=g+(d.length>0?" "+d:d);continue}if(b=o(w),!b){d=g+(d.length>0?" "+d:d);continue}C=!1}const k=pE(x).join(":"),N=v?k+Yy:k,E=N+b;if(c.includes(E))continue;c.push(E);const R=i(b,C);for(let T=0;T<R.length;++T){const M=R[T];c.push(N+M)}d=g+(d.length>0?" "+d:d)}return d};function xE(){let e=0,t,r,o="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Xy(t))&&(o&&(o+=" "),o+=r);return o}const Xy=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=Xy(e[o]))&&(r&&(r+=" "),r+=t);return r};function vE(e,...t){let r,o,i,c=u;function u(h){const g=t.reduce((x,v)=>v(x),e());return r=hE(g),o=r.cache.get,i=r.cache.set,c=d,d(h)}function d(h){const g=o(h);if(g)return g;const x=gE(h,r);return i(h,x),x}return function(){return c(xE.apply(null,arguments))}}const Ze=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},Zy=/^\[(?:([a-z-]+):)?(.+)\]$/i,yE=/^\d+\/\d+$/,wE=new Set(["px","full","screen"]),bE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,CE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gr=e=>So(e)||wE.has(e)||yE.test(e),Gr=e=>zo(e,"length",_E),So=e=>!!e&&!Number.isNaN(Number(e)),uf=e=>zo(e,"number",So),Di=e=>!!e&&Number.isInteger(Number(e)),jE=e=>e.endsWith("%")&&So(e.slice(0,-1)),Ie=e=>Zy.test(e),Yr=e=>bE.test(e),EE=new Set(["length","size","percentage"]),RE=e=>zo(e,EE,Jy),TE=e=>zo(e,"position",Jy),PE=new Set(["image","url"]),ME=e=>zo(e,PE,IE),DE=e=>zo(e,"",AE),_i=()=>!0,zo=(e,t,r)=>{const o=Zy.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):r(o[2]):!1},_E=e=>SE.test(e)&&!kE.test(e),Jy=()=>!1,AE=e=>CE.test(e),IE=e=>NE.test(e),OE=()=>{const e=Ze("colors"),t=Ze("spacing"),r=Ze("blur"),o=Ze("brightness"),i=Ze("borderColor"),c=Ze("borderRadius"),u=Ze("borderSpacing"),d=Ze("borderWidth"),h=Ze("contrast"),g=Ze("grayscale"),x=Ze("hueRotate"),v=Ze("invert"),w=Ze("gap"),S=Ze("gradientColorStops"),C=Ze("gradientColorStopPositions"),b=Ze("inset"),k=Ze("margin"),N=Ze("opacity"),E=Ze("padding"),R=Ze("saturate"),T=Ze("scale"),M=Ze("sepia"),F=Ze("skew"),I=Ze("space"),O=Ze("translate"),q=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",Ie,t],_=()=>[Ie,t],ee=()=>["",gr,Gr],X=()=>["auto",So,Ie],he=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ie=()=>["solid","dashed","dotted","double","none"],$=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>["start","end","center","between","around","evenly","stretch"],B=()=>["","0",Ie],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>[So,Ie];return{cacheSize:500,separator:":",theme:{colors:[_i],spacing:[gr,Gr],blur:["none","",Yr,Ie],brightness:D(),borderColor:[e],borderRadius:["none","","full",Yr,Ie],borderSpacing:_(),borderWidth:ee(),contrast:D(),grayscale:B(),hueRotate:D(),invert:B(),gap:_(),gradientColorStops:[e],gradientColorStopPositions:[jE,Gr],inset:G(),margin:G(),opacity:D(),padding:_(),saturate:D(),scale:D(),sepia:B(),skew:D(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",Ie]}],container:["container"],columns:[{columns:[Yr]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...he(),Ie]}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Di,Ie]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ie]}],grow:[{grow:B()}],shrink:[{shrink:B()}],order:[{order:["first","last","none",Di,Ie]}],"grid-cols":[{"grid-cols":[_i]}],"col-start-end":[{col:["auto",{span:["full",Di,Ie]},Ie]}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":[_i]}],"row-start-end":[{row:["auto",{span:[Di,Ie]},Ie]}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ie]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ie]}],gap:[{gap:[w]}],"gap-x":[{"gap-x":[w]}],"gap-y":[{"gap-y":[w]}],"justify-content":[{justify:["normal",...z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ie,t]}],"min-w":[{"min-w":[Ie,t,"min","max","fit"]}],"max-w":[{"max-w":[Ie,t,"none","full","min","max","fit","prose",{screen:[Yr]},Yr]}],h:[{h:[Ie,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ie,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ie,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ie,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Yr,Gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",uf]}],"font-family":[{font:[_i]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ie]}],"line-clamp":[{"line-clamp":["none",So,uf]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",gr,Ie]}],"list-image":[{"list-image":["none",Ie]}],"list-style-type":[{list:["none","disc","decimal",Ie]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[N]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",gr,Gr]}],"underline-offset":[{"underline-offset":["auto",gr,Ie]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ie]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[N]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...he(),TE]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",RE]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ME]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[S]}],"gradient-via":[{via:[S]}],"gradient-to":[{to:[S]}],rounded:[{rounded:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"border-w":[{border:[d]}],"border-w-x":[{"border-x":[d]}],"border-w-y":[{"border-y":[d]}],"border-w-s":[{"border-s":[d]}],"border-w-e":[{"border-e":[d]}],"border-w-t":[{"border-t":[d]}],"border-w-r":[{"border-r":[d]}],"border-w-b":[{"border-b":[d]}],"border-w-l":[{"border-l":[d]}],"border-opacity":[{"border-opacity":[N]}],"border-style":[{border:[...ie(),"hidden"]}],"divide-x":[{"divide-x":[d]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[d]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[N]}],"divide-style":[{divide:ie()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ie()]}],"outline-offset":[{"outline-offset":[gr,Ie]}],"outline-w":[{outline:[gr,Gr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[N]}],"ring-offset-w":[{"ring-offset":[gr,Gr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Yr,DE]}],"shadow-color":[{shadow:[_i]}],opacity:[{opacity:[N]}],"mix-blend":[{"mix-blend":[...$(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[o]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",Yr,Ie]}],grayscale:[{grayscale:[g]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[v]}],saturate:[{saturate:[R]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[g]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[v]}],"backdrop-opacity":[{"backdrop-opacity":[N]}],"backdrop-saturate":[{"backdrop-saturate":[R]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[u]}],"border-spacing-x":[{"border-spacing-x":[u]}],"border-spacing-y":[{"border-spacing-y":[u]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ie]}],duration:[{duration:D()}],ease:[{ease:["linear","in","out","in-out",Ie]}],delay:[{delay:D()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ie]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Di,Ie]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[F]}],"skew-y":[{"skew-y":[F]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ie]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ie]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ie]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[gr,Gr,uf]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},LE=vE(OE);function ve(...e){return LE(Iy(e))}const FE=h2,e0=p.forwardRef(({className:e,...t},r)=>a.jsx(Ry,{ref:r,className:ve("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));e0.displayName=Ry.displayName;const $E=$o("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),t0=p.forwardRef(({className:e,variant:t,...r},o)=>a.jsx(Ty,{ref:o,className:ve($E({variant:t}),e),...r}));t0.displayName=Ty.displayName;const zE=p.forwardRef(({className:e,...t},r)=>a.jsx(Dy,{ref:r,className:ve("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));zE.displayName=Dy.displayName;const n0=p.forwardRef(({className:e,...t},r)=>a.jsx(_y,{ref:r,className:ve("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:a.jsx(er,{className:"h-4 w-4"})}));n0.displayName=_y.displayName;const r0=p.forwardRef(({className:e,...t},r)=>a.jsx(Py,{ref:r,className:ve("text-sm font-semibold",e),...t}));r0.displayName=Py.displayName;const s0=p.forwardRef(({className:e,...t},r)=>a.jsx(My,{ref:r,className:ve("text-sm opacity-90",e),...t}));s0.displayName=My.displayName;function BE(){const{toasts:e}=os();return a.jsxs(FE,{children:[e.map(function({id:t,title:r,description:o,action:i,...c}){return a.jsxs(t0,{...c,children:[a.jsxs("div",{className:"grid gap-1",children:[r&&a.jsx(r0,{children:r}),o&&a.jsx(s0,{children:o})]}),i,a.jsx(n0,{})]},t)}),a.jsx(e0,{})]})}var VE=wc[" useId ".trim().toString()]||(()=>{}),UE=0;function xn(e){const[t,r]=p.useState(VE());return wt(()=>{r(o=>o??String(UE++))},[e]),t?`radix-${t}`:""}const HE=["top","right","bottom","left"],ns=Math.min,en=Math.max,Xl=Math.round,_l=Math.floor,tr=e=>({x:e,y:e}),WE={left:"right",right:"left",bottom:"top",top:"bottom"};function Vf(e,t,r){return en(e,ns(t,r))}function wr(e,t){return typeof e=="function"?e(t):e}function br(e){return e.split("-")[0]}function Bo(e){return e.split("-")[1]}function Mp(e){return e==="x"?"y":"x"}function Dp(e){return e==="y"?"height":"width"}function Jn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function _p(e){return Mp(Jn(e))}function KE(e,t,r){r===void 0&&(r=!1);const o=Bo(e),i=_p(e),c=Dp(i);let u=i==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=Zl(u)),[u,Zl(u)]}function qE(e){const t=Zl(e);return[Uf(e),t,Uf(t)]}function Uf(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Qx=["left","right"],Gx=["right","left"],QE=["top","bottom"],GE=["bottom","top"];function YE(e,t,r){switch(e){case"top":case"bottom":return r?t?Gx:Qx:t?Qx:Gx;case"left":case"right":return t?QE:GE;default:return[]}}function XE(e,t,r,o){const i=Bo(e);let c=YE(br(e),r==="start",o);return i&&(c=c.map(u=>u+"-"+i),t&&(c=c.concat(c.map(Uf)))),c}function Zl(e){const t=br(e);return WE[t]+e.slice(t.length)}function ZE(e){return{top:0,right:0,bottom:0,left:0,...e}}function o0(e){return typeof e!="number"?ZE(e):{top:e,right:e,bottom:e,left:e}}function Jl(e){const{x:t,y:r,width:o,height:i}=e;return{width:o,height:i,top:r,left:t,right:t+o,bottom:r+i,x:t,y:r}}function Yx(e,t,r){let{reference:o,floating:i}=e;const c=Jn(t),u=_p(t),d=Dp(u),h=br(t),g=c==="y",x=o.x+o.width/2-i.width/2,v=o.y+o.height/2-i.height/2,w=o[d]/2-i[d]/2;let S;switch(h){case"top":S={x,y:o.y-i.height};break;case"bottom":S={x,y:o.y+o.height};break;case"right":S={x:o.x+o.width,y:v};break;case"left":S={x:o.x-i.width,y:v};break;default:S={x:o.x,y:o.y}}switch(Bo(t)){case"start":S[u]-=w*(r&&g?-1:1);break;case"end":S[u]+=w*(r&&g?-1:1);break}return S}async function JE(e,t){var r;t===void 0&&(t={});const{x:o,y:i,platform:c,rects:u,elements:d,strategy:h}=e,{boundary:g="clippingAncestors",rootBoundary:x="viewport",elementContext:v="floating",altBoundary:w=!1,padding:S=0}=wr(t,e),C=o0(S),k=d[w?v==="floating"?"reference":"floating":v],N=Jl(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(k)))==null||r?k:k.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(d.floating)),boundary:g,rootBoundary:x,strategy:h})),E=v==="floating"?{x:o,y:i,width:u.floating.width,height:u.floating.height}:u.reference,R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(d.floating)),T=await(c.isElement==null?void 0:c.isElement(R))?await(c.getScale==null?void 0:c.getScale(R))||{x:1,y:1}:{x:1,y:1},M=Jl(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:E,offsetParent:R,strategy:h}):E);return{top:(N.top-M.top+C.top)/T.y,bottom:(M.bottom-N.bottom+C.bottom)/T.y,left:(N.left-M.left+C.left)/T.x,right:(M.right-N.right+C.right)/T.x}}const eR=50,tR=async(e,t,r)=>{const{placement:o="bottom",strategy:i="absolute",middleware:c=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:JE},h=await(u.isRTL==null?void 0:u.isRTL(t));let g=await u.getElementRects({reference:e,floating:t,strategy:i}),{x,y:v}=Yx(g,o,h),w=o,S=0;const C={};for(let b=0;b<c.length;b++){const k=c[b];if(!k)continue;const{name:N,fn:E}=k,{x:R,y:T,data:M,reset:F}=await E({x,y:v,initialPlacement:o,placement:w,strategy:i,middlewareData:C,rects:g,platform:d,elements:{reference:e,floating:t}});x=R??x,v=T??v,C[N]={...C[N],...M},F&&S<eR&&(S++,typeof F=="object"&&(F.placement&&(w=F.placement),F.rects&&(g=F.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):F.rects),{x,y:v}=Yx(g,w,h)),b=-1)}return{x,y:v,placement:w,strategy:i,middlewareData:C}},nR=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:o,placement:i,rects:c,platform:u,elements:d,middlewareData:h}=t,{element:g,padding:x=0}=wr(e,t)||{};if(g==null)return{};const v=o0(x),w={x:r,y:o},S=_p(i),C=Dp(S),b=await u.getDimensions(g),k=S==="y",N=k?"top":"left",E=k?"bottom":"right",R=k?"clientHeight":"clientWidth",T=c.reference[C]+c.reference[S]-w[S]-c.floating[C],M=w[S]-c.reference[S],F=await(u.getOffsetParent==null?void 0:u.getOffsetParent(g));let I=F?F[R]:0;(!I||!await(u.isElement==null?void 0:u.isElement(F)))&&(I=d.floating[R]||c.floating[C]);const O=T/2-M/2,q=I/2-b[C]/2-1,U=ns(v[N],q),G=ns(v[E],q),_=U,ee=I-b[C]-G,X=I/2-b[C]/2+O,he=Vf(_,X,ee),ie=!h.arrow&&Bo(i)!=null&&X!==he&&c.reference[C]/2-(X<_?U:G)-b[C]/2<0,$=ie?X<_?X-_:X-ee:0;return{[S]:w[S]+$,data:{[S]:he,centerOffset:X-he-$,...ie&&{alignmentOffset:$}},reset:ie}}}),rR=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,o;const{placement:i,middlewareData:c,rects:u,initialPlacement:d,platform:h,elements:g}=t,{mainAxis:x=!0,crossAxis:v=!0,fallbackPlacements:w,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:b=!0,...k}=wr(e,t);if((r=c.arrow)!=null&&r.alignmentOffset)return{};const N=br(i),E=Jn(d),R=br(d)===d,T=await(h.isRTL==null?void 0:h.isRTL(g.floating)),M=w||(R||!b?[Zl(d)]:qE(d)),F=C!=="none";!w&&F&&M.push(...XE(d,b,C,T));const I=[d,...M],O=await h.detectOverflow(t,k),q=[];let U=((o=c.flip)==null?void 0:o.overflows)||[];if(x&&q.push(O[N]),v){const X=KE(i,u,T);q.push(O[X[0]],O[X[1]])}if(U=[...U,{placement:i,overflows:q}],!q.every(X=>X<=0)){var G,_;const X=(((G=c.flip)==null?void 0:G.index)||0)+1,he=I[X];if(he&&(!(v==="alignment"?E!==Jn(he):!1)||U.every(z=>Jn(z.placement)===E?z.overflows[0]>0:!0)))return{data:{index:X,overflows:U},reset:{placement:he}};let ie=(_=U.filter($=>$.overflows[0]<=0).sort(($,z)=>$.overflows[1]-z.overflows[1])[0])==null?void 0:_.placement;if(!ie)switch(S){case"bestFit":{var ee;const $=(ee=U.filter(z=>{if(F){const B=Jn(z.placement);return B===E||B==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(B=>B>0).reduce((B,Y)=>B+Y,0)]).sort((z,B)=>z[1]-B[1])[0])==null?void 0:ee[0];$&&(ie=$);break}case"initialPlacement":ie=d;break}if(i!==ie)return{reset:{placement:ie}}}return{}}}};function Xx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Zx(e){return HE.some(t=>e[t]>=0)}const sR=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:o}=t,{strategy:i="referenceHidden",...c}=wr(e,t);switch(i){case"referenceHidden":{const u=await o.detectOverflow(t,{...c,elementContext:"reference"}),d=Xx(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Zx(d)}}}case"escaped":{const u=await o.detectOverflow(t,{...c,altBoundary:!0}),d=Xx(u,r.floating);return{data:{escapedOffsets:d,escaped:Zx(d)}}}default:return{}}}}},i0=new Set(["left","top"]);async function oR(e,t){const{placement:r,platform:o,elements:i}=e,c=await(o.isRTL==null?void 0:o.isRTL(i.floating)),u=br(r),d=Bo(r),h=Jn(r)==="y",g=i0.has(u)?-1:1,x=c&&h?-1:1,v=wr(t,e);let{mainAxis:w,crossAxis:S,alignmentAxis:C}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return d&&typeof C=="number"&&(S=d==="end"?C*-1:C),h?{x:S*x,y:w*g}:{x:w*g,y:S*x}}const iR=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,o;const{x:i,y:c,placement:u,middlewareData:d}=t,h=await oR(t,e);return u===((r=d.offset)==null?void 0:r.placement)&&(o=d.arrow)!=null&&o.alignmentOffset?{}:{x:i+h.x,y:c+h.y,data:{...h,placement:u}}}}},aR=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:o,placement:i,platform:c}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:h={fn:N=>{let{x:E,y:R}=N;return{x:E,y:R}}},...g}=wr(e,t),x={x:r,y:o},v=await c.detectOverflow(t,g),w=Jn(br(i)),S=Mp(w);let C=x[S],b=x[w];if(u){const N=S==="y"?"top":"left",E=S==="y"?"bottom":"right",R=C+v[N],T=C-v[E];C=Vf(R,C,T)}if(d){const N=w==="y"?"top":"left",E=w==="y"?"bottom":"right",R=b+v[N],T=b-v[E];b=Vf(R,b,T)}const k=h.fn({...t,[S]:C,[w]:b});return{...k,data:{x:k.x-r,y:k.y-o,enabled:{[S]:u,[w]:d}}}}}},lR=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:o,placement:i,rects:c,middlewareData:u}=t,{offset:d=0,mainAxis:h=!0,crossAxis:g=!0}=wr(e,t),x={x:r,y:o},v=Jn(i),w=Mp(v);let S=x[w],C=x[v];const b=wr(d,t),k=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(h){const R=w==="y"?"height":"width",T=c.reference[w]-c.floating[R]+k.mainAxis,M=c.reference[w]+c.reference[R]-k.mainAxis;S<T?S=T:S>M&&(S=M)}if(g){var N,E;const R=w==="y"?"width":"height",T=i0.has(br(i)),M=c.reference[v]-c.floating[R]+(T&&((N=u.offset)==null?void 0:N[v])||0)+(T?0:k.crossAxis),F=c.reference[v]+c.reference[R]+(T?0:((E=u.offset)==null?void 0:E[v])||0)-(T?k.crossAxis:0);C<M?C=M:C>F&&(C=F)}return{[w]:S,[v]:C}}}},cR=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,o;const{placement:i,rects:c,platform:u,elements:d}=t,{apply:h=()=>{},...g}=wr(e,t),x=await u.detectOverflow(t,g),v=br(i),w=Bo(i),S=Jn(i)==="y",{width:C,height:b}=c.floating;let k,N;v==="top"||v==="bottom"?(k=v,N=w===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(N=v,k=w==="end"?"top":"bottom");const E=b-x.top-x.bottom,R=C-x.left-x.right,T=ns(b-x[k],E),M=ns(C-x[N],R),F=!t.middlewareData.shift;let I=T,O=M;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(O=R),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(I=E),F&&!w){const U=en(x.left,0),G=en(x.right,0),_=en(x.top,0),ee=en(x.bottom,0);S?O=C-2*(U!==0||G!==0?U+G:en(x.left,x.right)):I=b-2*(_!==0||ee!==0?_+ee:en(x.top,x.bottom))}await h({...t,availableWidth:O,availableHeight:I});const q=await u.getDimensions(d.floating);return C!==q.width||b!==q.height?{reset:{rects:!0}}:{}}}};function Tc(){return typeof window<"u"}function Vo(e){return a0(e)?(e.nodeName||"").toLowerCase():"#document"}function nn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function rr(e){var t;return(t=(a0(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function a0(e){return Tc()?e instanceof Node||e instanceof nn(e).Node:!1}function $n(e){return Tc()?e instanceof Element||e instanceof nn(e).Element:!1}function Cr(e){return Tc()?e instanceof HTMLElement||e instanceof nn(e).HTMLElement:!1}function Jx(e){return!Tc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof nn(e).ShadowRoot}function ra(e){const{overflow:t,overflowX:r,overflowY:o,display:i}=zn(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&i!=="inline"&&i!=="contents"}function uR(e){return/^(table|td|th)$/.test(Vo(e))}function Pc(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const dR=/transform|translate|scale|rotate|perspective|filter/,fR=/paint|layout|strict|content/,Cs=e=>!!e&&e!=="none";let df;function Ap(e){const t=$n(e)?zn(e):e;return Cs(t.transform)||Cs(t.translate)||Cs(t.scale)||Cs(t.rotate)||Cs(t.perspective)||!Ip()&&(Cs(t.backdropFilter)||Cs(t.filter))||dR.test(t.willChange||"")||fR.test(t.contain||"")}function pR(e){let t=rs(e);for(;Cr(t)&&!To(t);){if(Ap(t))return t;if(Pc(t))return null;t=rs(t)}return null}function Ip(){return df==null&&(df=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),df}function To(e){return/^(html|body|#document)$/.test(Vo(e))}function zn(e){return nn(e).getComputedStyle(e)}function Mc(e){return $n(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rs(e){if(Vo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Jx(e)&&e.host||rr(e);return Jx(t)?t.host:t}function l0(e){const t=rs(e);return To(t)?e.ownerDocument?e.ownerDocument.body:e.body:Cr(t)&&ra(t)?t:l0(t)}function Qi(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=l0(e),c=i===((o=e.ownerDocument)==null?void 0:o.body),u=nn(i);if(c){const d=Hf(u);return t.concat(u,u.visualViewport||[],ra(i)?i:[],d&&r?Qi(d):[])}else return t.concat(i,Qi(i,[],r))}function Hf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function c0(e){const t=zn(e);let r=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=Cr(e),c=i?e.offsetWidth:r,u=i?e.offsetHeight:o,d=Xl(r)!==c||Xl(o)!==u;return d&&(r=c,o=u),{width:r,height:o,$:d}}function Op(e){return $n(e)?e:e.contextElement}function ko(e){const t=Op(e);if(!Cr(t))return tr(1);const r=t.getBoundingClientRect(),{width:o,height:i,$:c}=c0(t);let u=(c?Xl(r.width):r.width)/o,d=(c?Xl(r.height):r.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const hR=tr(0);function u0(e){const t=nn(e);return!Ip()||!t.visualViewport?hR:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function mR(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==nn(e)?!1:t}function Ds(e,t,r,o){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),c=Op(e);let u=tr(1);t&&(o?$n(o)&&(u=ko(o)):u=ko(e));const d=mR(c,r,o)?u0(c):tr(0);let h=(i.left+d.x)/u.x,g=(i.top+d.y)/u.y,x=i.width/u.x,v=i.height/u.y;if(c){const w=nn(c),S=o&&$n(o)?nn(o):o;let C=w,b=Hf(C);for(;b&&o&&S!==C;){const k=ko(b),N=b.getBoundingClientRect(),E=zn(b),R=N.left+(b.clientLeft+parseFloat(E.paddingLeft))*k.x,T=N.top+(b.clientTop+parseFloat(E.paddingTop))*k.y;h*=k.x,g*=k.y,x*=k.x,v*=k.y,h+=R,g+=T,C=nn(b),b=Hf(C)}}return Jl({width:x,height:v,x:h,y:g})}function Dc(e,t){const r=Mc(e).scrollLeft;return t?t.left+r:Ds(rr(e)).left+r}function d0(e,t){const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-Dc(e,r),i=r.top+t.scrollTop;return{x:o,y:i}}function gR(e){let{elements:t,rect:r,offsetParent:o,strategy:i}=e;const c=i==="fixed",u=rr(o),d=t?Pc(t.floating):!1;if(o===u||d&&c)return r;let h={scrollLeft:0,scrollTop:0},g=tr(1);const x=tr(0),v=Cr(o);if((v||!v&&!c)&&((Vo(o)!=="body"||ra(u))&&(h=Mc(o)),v)){const S=Ds(o);g=ko(o),x.x=S.x+o.clientLeft,x.y=S.y+o.clientTop}const w=u&&!v&&!c?d0(u,h):tr(0);return{width:r.width*g.x,height:r.height*g.y,x:r.x*g.x-h.scrollLeft*g.x+x.x+w.x,y:r.y*g.y-h.scrollTop*g.y+x.y+w.y}}function xR(e){return Array.from(e.getClientRects())}function vR(e){const t=rr(e),r=Mc(e),o=e.ownerDocument.body,i=en(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),c=en(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let u=-r.scrollLeft+Dc(e);const d=-r.scrollTop;return zn(o).direction==="rtl"&&(u+=en(t.clientWidth,o.clientWidth)-i),{width:i,height:c,x:u,y:d}}const ev=25;function yR(e,t){const r=nn(e),o=rr(e),i=r.visualViewport;let c=o.clientWidth,u=o.clientHeight,d=0,h=0;if(i){c=i.width,u=i.height;const x=Ip();(!x||x&&t==="fixed")&&(d=i.offsetLeft,h=i.offsetTop)}const g=Dc(o);if(g<=0){const x=o.ownerDocument,v=x.body,w=getComputedStyle(v),S=x.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,C=Math.abs(o.clientWidth-v.clientWidth-S);C<=ev&&(c-=C)}else g<=ev&&(c+=g);return{width:c,height:u,x:d,y:h}}function wR(e,t){const r=Ds(e,!0,t==="fixed"),o=r.top+e.clientTop,i=r.left+e.clientLeft,c=Cr(e)?ko(e):tr(1),u=e.clientWidth*c.x,d=e.clientHeight*c.y,h=i*c.x,g=o*c.y;return{width:u,height:d,x:h,y:g}}function tv(e,t,r){let o;if(t==="viewport")o=yR(e,r);else if(t==="document")o=vR(rr(e));else if($n(t))o=wR(t,r);else{const i=u0(e);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Jl(o)}function f0(e,t){const r=rs(e);return r===t||!$n(r)||To(r)?!1:zn(r).position==="fixed"||f0(r,t)}function bR(e,t){const r=t.get(e);if(r)return r;let o=Qi(e,[],!1).filter(d=>$n(d)&&Vo(d)!=="body"),i=null;const c=zn(e).position==="fixed";let u=c?rs(e):e;for(;$n(u)&&!To(u);){const d=zn(u),h=Ap(u);!h&&d.position==="fixed"&&(i=null),(c?!h&&!i:!h&&d.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ra(u)&&!h&&f0(e,u))?o=o.filter(x=>x!==u):i=d,u=rs(u)}return t.set(e,o),o}function SR(e){let{element:t,boundary:r,rootBoundary:o,strategy:i}=e;const u=[...r==="clippingAncestors"?Pc(t)?[]:bR(t,this._c):[].concat(r),o],d=tv(t,u[0],i);let h=d.top,g=d.right,x=d.bottom,v=d.left;for(let w=1;w<u.length;w++){const S=tv(t,u[w],i);h=en(S.top,h),g=ns(S.right,g),x=ns(S.bottom,x),v=en(S.left,v)}return{width:g-v,height:x-h,x:v,y:h}}function kR(e){const{width:t,height:r}=c0(e);return{width:t,height:r}}function CR(e,t,r){const o=Cr(t),i=rr(t),c=r==="fixed",u=Ds(e,!0,c,t);let d={scrollLeft:0,scrollTop:0};const h=tr(0);function g(){h.x=Dc(i)}if(o||!o&&!c)if((Vo(t)!=="body"||ra(i))&&(d=Mc(t)),o){const S=Ds(t,!0,c,t);h.x=S.x+t.clientLeft,h.y=S.y+t.clientTop}else i&&g();c&&!o&&i&&g();const x=i&&!o&&!c?d0(i,d):tr(0),v=u.left+d.scrollLeft-h.x-x.x,w=u.top+d.scrollTop-h.y-x.y;return{x:v,y:w,width:u.width,height:u.height}}function ff(e){return zn(e).position==="static"}function nv(e,t){if(!Cr(e)||zn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return rr(e)===r&&(r=r.ownerDocument.body),r}function p0(e,t){const r=nn(e);if(Pc(e))return r;if(!Cr(e)){let i=rs(e);for(;i&&!To(i);){if($n(i)&&!ff(i))return i;i=rs(i)}return r}let o=nv(e,t);for(;o&&uR(o)&&ff(o);)o=nv(o,t);return o&&To(o)&&ff(o)&&!Ap(o)?r:o||pR(e)||r}const NR=async function(e){const t=this.getOffsetParent||p0,r=this.getDimensions,o=await r(e.floating);return{reference:CR(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function jR(e){return zn(e).direction==="rtl"}const ER={convertOffsetParentRelativeRectToViewportRelativeRect:gR,getDocumentElement:rr,getClippingRect:SR,getOffsetParent:p0,getElementRects:NR,getClientRects:xR,getDimensions:kR,getScale:ko,isElement:$n,isRTL:jR};function h0(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function RR(e,t){let r=null,o;const i=rr(e);function c(){var d;clearTimeout(o),(d=r)==null||d.disconnect(),r=null}function u(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),c();const g=e.getBoundingClientRect(),{left:x,top:v,width:w,height:S}=g;if(d||t(),!w||!S)return;const C=_l(v),b=_l(i.clientWidth-(x+w)),k=_l(i.clientHeight-(v+S)),N=_l(x),R={rootMargin:-C+"px "+-b+"px "+-k+"px "+-N+"px",threshold:en(0,ns(1,h))||1};let T=!0;function M(F){const I=F[0].intersectionRatio;if(I!==h){if(!T)return u();I?u(!1,I):o=setTimeout(()=>{u(!1,1e-7)},1e3)}I===1&&!h0(g,e.getBoundingClientRect())&&u(),T=!1}try{r=new IntersectionObserver(M,{...R,root:i.ownerDocument})}catch{r=new IntersectionObserver(M,R)}r.observe(e)}return u(!0),c}function TR(e,t,r,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=o,g=Op(e),x=i||c?[...g?Qi(g):[],...t?Qi(t):[]]:[];x.forEach(N=>{i&&N.addEventListener("scroll",r,{passive:!0}),c&&N.addEventListener("resize",r)});const v=g&&d?RR(g,r):null;let w=-1,S=null;u&&(S=new ResizeObserver(N=>{let[E]=N;E&&E.target===g&&S&&t&&(S.unobserve(t),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var R;(R=S)==null||R.observe(t)})),r()}),g&&!h&&S.observe(g),t&&S.observe(t));let C,b=h?Ds(e):null;h&&k();function k(){const N=Ds(e);b&&!h0(b,N)&&r(),b=N,C=requestAnimationFrame(k)}return r(),()=>{var N;x.forEach(E=>{i&&E.removeEventListener("scroll",r),c&&E.removeEventListener("resize",r)}),v?.(),(N=S)==null||N.disconnect(),S=null,h&&cancelAnimationFrame(C)}}const PR=iR,MR=aR,DR=rR,_R=cR,AR=sR,rv=nR,IR=lR,OR=(e,t,r)=>{const o=new Map,i={platform:ER,...r},c={...i.platform,_c:o};return tR(e,t,{...i,platform:c})};var LR=typeof document<"u",FR=function(){},Hl=LR?p.useLayoutEffect:FR;function ec(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,o,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(o=r;o--!==0;)if(!ec(e[o],t[o]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(o=r;o--!==0;)if(!{}.hasOwnProperty.call(t,i[o]))return!1;for(o=r;o--!==0;){const c=i[o];if(!(c==="_owner"&&e.$$typeof)&&!ec(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function m0(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function sv(e,t){const r=m0(e);return Math.round(t*r)/r}function pf(e){const t=p.useRef(e);return Hl(()=>{t.current=e}),t}function $R(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:c,floating:u}={},transform:d=!0,whileElementsMounted:h,open:g}=e,[x,v]=p.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[w,S]=p.useState(o);ec(w,o)||S(o);const[C,b]=p.useState(null),[k,N]=p.useState(null),E=p.useCallback(z=>{z!==F.current&&(F.current=z,b(z))},[]),R=p.useCallback(z=>{z!==I.current&&(I.current=z,N(z))},[]),T=c||C,M=u||k,F=p.useRef(null),I=p.useRef(null),O=p.useRef(x),q=h!=null,U=pf(h),G=pf(i),_=pf(g),ee=p.useCallback(()=>{if(!F.current||!I.current)return;const z={placement:t,strategy:r,middleware:w};G.current&&(z.platform=G.current),OR(F.current,I.current,z).then(B=>{const Y={...B,isPositioned:_.current!==!1};X.current&&!ec(O.current,Y)&&(O.current=Y,In.flushSync(()=>{v(Y)}))})},[w,t,r,G,_]);Hl(()=>{g===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,v(z=>({...z,isPositioned:!1})))},[g]);const X=p.useRef(!1);Hl(()=>(X.current=!0,()=>{X.current=!1}),[]),Hl(()=>{if(T&&(F.current=T),M&&(I.current=M),T&&M){if(U.current)return U.current(T,M,ee);ee()}},[T,M,ee,U,q]);const he=p.useMemo(()=>({reference:F,floating:I,setReference:E,setFloating:R}),[E,R]),ie=p.useMemo(()=>({reference:T,floating:M}),[T,M]),$=p.useMemo(()=>{const z={position:r,left:0,top:0};if(!ie.floating)return z;const B=sv(ie.floating,x.x),Y=sv(ie.floating,x.y);return d?{...z,transform:"translate("+B+"px, "+Y+"px)",...m0(ie.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:B,top:Y}},[r,d,ie.floating,x.x,x.y]);return p.useMemo(()=>({...x,update:ee,refs:he,elements:ie,floatingStyles:$}),[x,ee,he,ie,$])}const zR=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:o,padding:i}=typeof e=="function"?e(r):e;return o&&t(o)?o.current!=null?rv({element:o.current,padding:i}).fn(r):{}:o?rv({element:o,padding:i}).fn(r):{}}}},BR=(e,t)=>{const r=PR(e);return{name:r.name,fn:r.fn,options:[e,t]}},VR=(e,t)=>{const r=MR(e);return{name:r.name,fn:r.fn,options:[e,t]}},UR=(e,t)=>({fn:IR(e).fn,options:[e,t]}),HR=(e,t)=>{const r=DR(e);return{name:r.name,fn:r.fn,options:[e,t]}},WR=(e,t)=>{const r=_R(e);return{name:r.name,fn:r.fn,options:[e,t]}},KR=(e,t)=>{const r=AR(e);return{name:r.name,fn:r.fn,options:[e,t]}},qR=(e,t)=>{const r=zR(e);return{name:r.name,fn:r.fn,options:[e,t]}};var QR="Arrow",g0=p.forwardRef((e,t)=>{const{children:r,width:o=10,height:i=5,...c}=e;return a.jsx(Ne.svg,{...c,ref:t,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});g0.displayName=QR;var GR=g0;function Lp(e){const[t,r]=p.useState(void 0);return wt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const c=i[0];let u,d;if("borderBoxSize"in c){const h=c.borderBoxSize,g=Array.isArray(h)?h[0]:h;u=g.inlineSize,d=g.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else r(void 0)},[e]),t}var Fp="Popper",[x0,as]=Qt(Fp),[YR,v0]=x0(Fp),y0=e=>{const{__scopePopper:t,children:r}=e,[o,i]=p.useState(null);return a.jsx(YR,{scope:t,anchor:o,onAnchorChange:i,children:r})};y0.displayName=Fp;var w0="PopperAnchor",b0=p.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:o,...i}=e,c=v0(w0,r),u=p.useRef(null),d=_e(t,u),h=p.useRef(null);return p.useEffect(()=>{const g=h.current;h.current=o?.current||u.current,g!==h.current&&c.onAnchorChange(h.current)}),o?null:a.jsx(Ne.div,{...i,ref:d})});b0.displayName=w0;var $p="PopperContent",[XR,ZR]=x0($p),S0=p.forwardRef((e,t)=>{const{__scopePopper:r,side:o="bottom",sideOffset:i=0,align:c="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:h=!0,collisionBoundary:g=[],collisionPadding:x=0,sticky:v="partial",hideWhenDetached:w=!1,updatePositionStrategy:S="optimized",onPlaced:C,...b}=e,k=v0($p,r),[N,E]=p.useState(null),R=_e(t,Z=>E(Z)),[T,M]=p.useState(null),F=Lp(T),I=F?.width??0,O=F?.height??0,q=o+(c!=="center"?"-"+c:""),U=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},G=Array.isArray(g)?g:[g],_=G.length>0,ee={padding:U,boundary:G.filter(eT),altBoundary:_},{refs:X,floatingStyles:he,placement:ie,isPositioned:$,middlewareData:z}=$R({strategy:"fixed",placement:q,whileElementsMounted:(...Z)=>TR(...Z,{animationFrame:S==="always"}),elements:{reference:k.anchor},middleware:[BR({mainAxis:i+O,alignmentAxis:u}),h&&VR({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?UR():void 0,...ee}),h&&HR({...ee}),WR({...ee,apply:({elements:Z,rects:H,availableWidth:ne,availableHeight:ae})=>{const{width:Me,height:Ae}=H.reference,te=Z.floating.style;te.setProperty("--radix-popper-available-width",`${ne}px`),te.setProperty("--radix-popper-available-height",`${ae}px`),te.setProperty("--radix-popper-anchor-width",`${Me}px`),te.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),T&&qR({element:T,padding:d}),tT({arrowWidth:I,arrowHeight:O}),w&&KR({strategy:"referenceHidden",...ee})]}),[B,Y]=N0(ie),D=ut(C);wt(()=>{$&&D?.()},[$,D]);const K=z.arrow?.x,ue=z.arrow?.y,ge=z.arrow?.centerOffset!==0,[Ce,fe]=p.useState();return wt(()=>{N&&fe(window.getComputedStyle(N).zIndex)},[N]),a.jsx("div",{ref:X.setFloating,"data-radix-popper-content-wrapper":"",style:{...he,transform:$?he.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ce,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(XR,{scope:r,placedSide:B,onArrowChange:M,arrowX:K,arrowY:ue,shouldHideArrow:ge,children:a.jsx(Ne.div,{"data-side":B,"data-align":Y,...b,ref:R,style:{...b.style,animation:$?void 0:"none"}})})})});S0.displayName=$p;var k0="PopperArrow",JR={top:"bottom",right:"left",bottom:"top",left:"right"},C0=p.forwardRef(function(t,r){const{__scopePopper:o,...i}=t,c=ZR(k0,o),u=JR[c.placedSide];return a.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:a.jsx(GR,{...i,ref:r,style:{...i.style,display:"block"}})})});C0.displayName=k0;function eT(e){return e!==null}var tT=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:o,middlewareData:i}=t,u=i.arrow?.centerOffset!==0,d=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[g,x]=N0(r),v={start:"0%",center:"50%",end:"100%"}[x],w=(i.arrow?.x??0)+d/2,S=(i.arrow?.y??0)+h/2;let C="",b="";return g==="bottom"?(C=u?v:`${w}px`,b=`${-h}px`):g==="top"?(C=u?v:`${w}px`,b=`${o.floating.height+h}px`):g==="right"?(C=`${-h}px`,b=u?v:`${S}px`):g==="left"&&(C=`${o.floating.width+h}px`,b=u?v:`${S}px`),{data:{x:C,y:b}}}});function N0(e){const[t,r="center"]=e.split("-");return[t,r]}var _c=y0,sa=b0,Ac=S0,Ic=C0,nT=Symbol("radix.slottable");function rT(e){const t=({children:r})=>a.jsx(a.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=nT,t}var[Oc]=Qt("Tooltip",[as]),Lc=as(),j0="TooltipProvider",sT=700,Wf="tooltip.open",[oT,zp]=Oc(j0),E0=e=>{const{__scopeTooltip:t,delayDuration:r=sT,skipDelayDuration:o=300,disableHoverableContent:i=!1,children:c}=e,u=p.useRef(!0),d=p.useRef(!1),h=p.useRef(0);return p.useEffect(()=>{const g=h.current;return()=>window.clearTimeout(g)},[]),a.jsx(oT,{scope:t,isOpenDelayedRef:u,delayDuration:r,onOpen:p.useCallback(()=>{window.clearTimeout(h.current),u.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>u.current=!0,o)},[o]),isPointerInTransitRef:d,onPointerInTransitChange:p.useCallback(g=>{d.current=g},[]),disableHoverableContent:i,children:c})};E0.displayName=j0;var Gi="Tooltip",[iT,Fc]=Oc(Gi),R0=e=>{const{__scopeTooltip:t,children:r,open:o,defaultOpen:i,onOpenChange:c,disableHoverableContent:u,delayDuration:d}=e,h=zp(Gi,e.__scopeTooltip),g=Lc(t),[x,v]=p.useState(null),w=xn(),S=p.useRef(0),C=u??h.disableHoverableContent,b=d??h.delayDuration,k=p.useRef(!1),[N,E]=Fn({prop:o,defaultProp:i??!1,onChange:I=>{I?(h.onOpen(),document.dispatchEvent(new CustomEvent(Wf))):h.onClose(),c?.(I)},caller:Gi}),R=p.useMemo(()=>N?k.current?"delayed-open":"instant-open":"closed",[N]),T=p.useCallback(()=>{window.clearTimeout(S.current),S.current=0,k.current=!1,E(!0)},[E]),M=p.useCallback(()=>{window.clearTimeout(S.current),S.current=0,E(!1)},[E]),F=p.useCallback(()=>{window.clearTimeout(S.current),S.current=window.setTimeout(()=>{k.current=!0,E(!0),S.current=0},b)},[b,E]);return p.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=0)},[]),a.jsx(_c,{...g,children:a.jsx(iT,{scope:t,contentId:w,open:N,stateAttribute:R,trigger:x,onTriggerChange:v,onTriggerEnter:p.useCallback(()=>{h.isOpenDelayedRef.current?F():T()},[h.isOpenDelayedRef,F,T]),onTriggerLeave:p.useCallback(()=>{C?M():(window.clearTimeout(S.current),S.current=0)},[M,C]),onOpen:T,onClose:M,disableHoverableContent:C,children:r})})};R0.displayName=Gi;var Kf="TooltipTrigger",T0=p.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,i=Fc(Kf,r),c=zp(Kf,r),u=Lc(r),d=p.useRef(null),h=_e(t,d,i.onTriggerChange),g=p.useRef(!1),x=p.useRef(!1),v=p.useCallback(()=>g.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),a.jsx(sa,{asChild:!0,...u,children:a.jsx(Ne.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...o,ref:h,onPointerMove:le(e.onPointerMove,w=>{w.pointerType!=="touch"&&!x.current&&!c.isPointerInTransitRef.current&&(i.onTriggerEnter(),x.current=!0)}),onPointerLeave:le(e.onPointerLeave,()=>{i.onTriggerLeave(),x.current=!1}),onPointerDown:le(e.onPointerDown,()=>{i.open&&i.onClose(),g.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:le(e.onFocus,()=>{g.current||i.onOpen()}),onBlur:le(e.onBlur,i.onClose),onClick:le(e.onClick,i.onClose)})})});T0.displayName=Kf;var aT="TooltipPortal",[HO,lT]=Oc(aT,{forceMount:void 0}),Po="TooltipContent",P0=p.forwardRef((e,t)=>{const r=lT(Po,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...c}=e,u=Fc(Po,e.__scopeTooltip);return a.jsx(bt,{present:o||u.open,children:u.disableHoverableContent?a.jsx(M0,{side:i,...c,ref:t}):a.jsx(cT,{side:i,...c,ref:t})})}),cT=p.forwardRef((e,t)=>{const r=Fc(Po,e.__scopeTooltip),o=zp(Po,e.__scopeTooltip),i=p.useRef(null),c=_e(t,i),[u,d]=p.useState(null),{trigger:h,onClose:g}=r,x=i.current,{onPointerInTransitChange:v}=o,w=p.useCallback(()=>{d(null),v(!1)},[v]),S=p.useCallback((C,b)=>{const k=C.currentTarget,N={x:C.clientX,y:C.clientY},E=hT(N,k.getBoundingClientRect()),R=mT(N,E),T=gT(b.getBoundingClientRect()),M=vT([...R,...T]);d(M),v(!0)},[v]);return p.useEffect(()=>()=>w(),[w]),p.useEffect(()=>{if(h&&x){const C=k=>S(k,x),b=k=>S(k,h);return h.addEventListener("pointerleave",C),x.addEventListener("pointerleave",b),()=>{h.removeEventListener("pointerleave",C),x.removeEventListener("pointerleave",b)}}},[h,x,S,w]),p.useEffect(()=>{if(u){const C=b=>{const k=b.target,N={x:b.clientX,y:b.clientY},E=h?.contains(k)||x?.contains(k),R=!xT(N,u);E?w():R&&(w(),g())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[h,x,u,g,w]),a.jsx(M0,{...e,ref:c})}),[uT,dT]=Oc(Gi,{isInside:!1}),fT=rT("TooltipContent"),M0=p.forwardRef((e,t)=>{const{__scopeTooltip:r,children:o,"aria-label":i,onEscapeKeyDown:c,onPointerDownOutside:u,...d}=e,h=Fc(Po,r),g=Lc(r),{onClose:x}=h;return p.useEffect(()=>(document.addEventListener(Wf,x),()=>document.removeEventListener(Wf,x)),[x]),p.useEffect(()=>{if(h.trigger){const v=w=>{w.target?.contains(h.trigger)&&x()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[h.trigger,x]),a.jsx(Bs,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:v=>v.preventDefault(),onDismiss:x,children:a.jsxs(Ac,{"data-state":h.stateAttribute,...g,...d,ref:t,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(fT,{children:o}),a.jsx(uT,{scope:r,isInside:!0,children:a.jsx(Yj,{id:h.contentId,role:"tooltip",children:i||o})})]})})});P0.displayName=Po;var D0="TooltipArrow",pT=p.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,i=Lc(r);return dT(D0,r).isInside?null:a.jsx(Ic,{...i,...o,ref:t})});pT.displayName=D0;function hT(e,t){const r=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),c=Math.abs(t.left-e.x);switch(Math.min(r,o,i,c)){case c:return"left";case i:return"right";case r:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function mT(e,t,r=5){const o=[];switch(t){case"top":o.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":o.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":o.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":o.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return o}function gT(e){const{top:t,right:r,bottom:o,left:i}=e;return[{x:i,y:t},{x:r,y:t},{x:r,y:o},{x:i,y:o}]}function xT(e,t){const{x:r,y:o}=e;let i=!1;for(let c=0,u=t.length-1;c<t.length;u=c++){const d=t[c],h=t[u],g=d.x,x=d.y,v=h.x,w=h.y;x>o!=w>o&&r<(v-g)*(o-x)/(w-x)+g&&(i=!i)}return i}function vT(e){const t=e.slice();return t.sort((r,o)=>r.x<o.x?-1:r.x>o.x?1:r.y<o.y?-1:r.y>o.y?1:0),yT(t)}function yT(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o<e.length;o++){const i=e[o];for(;t.length>=2;){const c=t[t.length-1],u=t[t.length-2];if((c.x-u.x)*(i.y-u.y)>=(c.y-u.y)*(i.x-u.x))t.pop();else break}t.push(i)}t.pop();const r=[];for(let o=e.length-1;o>=0;o--){const i=e[o];for(;r.length>=2;){const c=r[r.length-1],u=r[r.length-2];if((c.x-u.x)*(i.y-u.y)>=(c.y-u.y)*(i.x-u.x))r.pop();else break}r.push(i)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var wT=E0,bT=R0,ST=T0,_0=P0;const A0=wT,qf=bT,Qf=ST,tc=p.forwardRef(({className:e,sideOffset:t=4,...r},o)=>a.jsx(_0,{ref:o,sideOffset:t,className:ve("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...r}));tc.displayName=_0.displayName;var kT=Symbol.for("react.lazy"),nc=wc[" use ".trim().toString()];function CT(e){return typeof e=="object"&&e!==null&&"then"in e}function I0(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===kT&&"_payload"in e&&CT(e._payload)}function Bp(e){const t=NT(e),r=p.forwardRef((o,i)=>{let{children:c,...u}=o;I0(c)&&typeof nc=="function"&&(c=nc(c._payload));const d=p.Children.toArray(c),h=d.find(ET);if(h){const g=h.props.children,x=d.map(v=>v===h?p.Children.count(g)>1?p.Children.only(null):p.isValidElement(g)?g.props.children:null:v);return a.jsx(t,{...u,ref:i,children:p.isValidElement(g)?p.cloneElement(g,void 0,x):null})}return a.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}var Vp=Bp("Slot");function NT(e){const t=p.forwardRef((r,o)=>{let{children:i,...c}=r;if(I0(i)&&typeof nc=="function"&&(i=nc(i._payload)),p.isValidElement(i)){const u=TT(i),d=RT(c,i.props);return i.type!==p.Fragment&&(d.ref=o?nr(o,u):u),p.cloneElement(i,d)}return p.Children.count(i)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jT=Symbol("radix.slottable");function ET(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jT}function RT(e,t){const r={...t};for(const o in t){const i=e[o],c=t[o];/^on[A-Z]/.test(o)?i&&c?r[o]=(...d)=>{const h=c(...d);return i(...d),h}:i&&(r[o]=i):o==="style"?r[o]={...i,...c}:o==="className"&&(r[o]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function TT(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const hf=768;function PT(){const[e,t]=p.useState(void 0);return p.useEffect(()=>{const r=window.matchMedia(`(max-width: ${hf-1}px)`),o=()=>{t(window.innerWidth<hf)};return r.addEventListener("change",o),t(window.innerWidth<hf),()=>r.removeEventListener("change",o)},[]),!!e}const MT=$o("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover-elevate active-elevate-2",{variants:{variant:{default:"bg-primary text-primary-foreground border border-primary-border",destructive:"bg-destructive text-destructive-foreground border border-destructive-border",outline:" border [border-color:var(--button-outline)] shadow-xs active:shadow-none ",secondary:"border bg-secondary text-secondary-foreground border border-secondary-border ",ghost:"border border-transparent"},size:{default:"min-h-9 px-4 py-2",sm:"min-h-8 rounded-md px-3 text-xs",lg:"min-h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),pe=p.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...i},c)=>{const u=o?Vp:"button";return a.jsx(u,{className:ve(MT({variant:t,size:r,className:e})),ref:c,...i})});pe.displayName="Button";const Ge=p.forwardRef(({className:e,type:t,...r},o)=>a.jsx("input",{type:t,className:ve("flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...r}));Ge.displayName="Input";var DT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_T=DT.reduce((e,t)=>{const r=Bp(`Primitive.${t}`),o=p.forwardRef((i,c)=>{const{asChild:u,...d}=i,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(h,{...d,ref:c})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),AT="Separator",ov="horizontal",IT=["horizontal","vertical"],O0=p.forwardRef((e,t)=>{const{decorative:r,orientation:o=ov,...i}=e,c=OT(o)?o:ov,d=r?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return a.jsx(_T.div,{"data-orientation":c,...d,...i,ref:t})});O0.displayName=AT;function OT(e){return IT.includes(e)}var L0=O0;const LT=p.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...o},i)=>a.jsx(L0,{ref:i,decorative:r,orientation:t,className:ve("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));LT.displayName=L0.displayName;var mf="focusScope.autoFocusOnMount",gf="focusScope.autoFocusOnUnmount",iv={bubbles:!1,cancelable:!0},FT="FocusScope",oa=p.forwardRef((e,t)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:c,...u}=e,[d,h]=p.useState(null),g=ut(i),x=ut(c),v=p.useRef(null),w=_e(t,b=>h(b)),S=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(o){let b=function(R){if(S.paused||!d)return;const T=R.target;d.contains(T)?v.current=T:Xr(v.current,{select:!0})},k=function(R){if(S.paused||!d)return;const T=R.relatedTarget;T!==null&&(d.contains(T)||Xr(v.current,{select:!0}))},N=function(R){if(document.activeElement===document.body)for(const M of R)M.removedNodes.length>0&&Xr(d)};document.addEventListener("focusin",b),document.addEventListener("focusout",k);const E=new MutationObserver(N);return d&&E.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",k),E.disconnect()}}},[o,d,S.paused]),p.useEffect(()=>{if(d){lv.add(S);const b=document.activeElement;if(!d.contains(b)){const N=new CustomEvent(mf,iv);d.addEventListener(mf,g),d.dispatchEvent(N),N.defaultPrevented||($T(HT(F0(d)),{select:!0}),document.activeElement===b&&Xr(d))}return()=>{d.removeEventListener(mf,g),setTimeout(()=>{const N=new CustomEvent(gf,iv);d.addEventListener(gf,x),d.dispatchEvent(N),N.defaultPrevented||Xr(b??document.body,{select:!0}),d.removeEventListener(gf,x),lv.remove(S)},0)}}},[d,g,x,S]);const C=p.useCallback(b=>{if(!r&&!o||S.paused)return;const k=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,N=document.activeElement;if(k&&N){const E=b.currentTarget,[R,T]=zT(E);R&&T?!b.shiftKey&&N===T?(b.preventDefault(),r&&Xr(R,{select:!0})):b.shiftKey&&N===R&&(b.preventDefault(),r&&Xr(T,{select:!0})):N===E&&b.preventDefault()}},[r,o,S.paused]);return a.jsx(Ne.div,{tabIndex:-1,...u,ref:w,onKeyDown:C})});oa.displayName=FT;function $T(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(Xr(o,{select:t}),document.activeElement!==r)return}function zT(e){const t=F0(e),r=av(t,e),o=av(t.reverse(),e);return[r,o]}function F0(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const i=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||i?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function av(e,t){for(const r of e)if(!BT(r,{upTo:t}))return r}function BT(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function VT(e){return e instanceof HTMLInputElement&&"select"in e}function Xr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&VT(e)&&t&&e.select()}}var lv=UT();function UT(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=cv(e,t),e.unshift(t)},remove(t){e=cv(e,t),e[0]?.resume()}}}function cv(e,t){const r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}function HT(e){return e.filter(t=>t.tagName!=="A")}var xf=0;function $c(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??uv()),document.body.insertAdjacentElement("beforeend",e[1]??uv()),xf++,()=>{xf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xf--}},[])}function uv(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Zn=function(){return Zn=Object.assign||function(t){for(var r,o=1,i=arguments.length;o<i;o++){r=arguments[o];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(t[c]=r[c])}return t},Zn.apply(this,arguments)};function $0(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,o=Object.getOwnPropertySymbols(e);i<o.length;i++)t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(r[o[i]]=e[o[i]]);return r}function WT(e,t,r){if(r||arguments.length===2)for(var o=0,i=t.length,c;o<i;o++)(c||!(o in t))&&(c||(c=Array.prototype.slice.call(t,0,o)),c[o]=t[o]);return e.concat(c||Array.prototype.slice.call(t))}var Wl="right-scroll-bar-position",Kl="width-before-scroll-bar",KT="with-scroll-bars-hidden",qT="--removed-body-scroll-bar-size";function vf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function QT(e,t){var r=p.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(o){var i=r.value;i!==o&&(r.value=o,r.callback(o,i))}}}})[0];return r.callback=t,r.facade}var GT=typeof window<"u"?p.useLayoutEffect:p.useEffect,dv=new WeakMap;function YT(e,t){var r=QT(null,function(o){return e.forEach(function(i){return vf(i,o)})});return GT(function(){var o=dv.get(r);if(o){var i=new Set(o),c=new Set(e),u=r.current;i.forEach(function(d){c.has(d)||vf(d,null)}),c.forEach(function(d){i.has(d)||vf(d,u)})}dv.set(r,e)},[e]),r}function XT(e){return e}function ZT(e,t){t===void 0&&(t=XT);var r=[],o=!1,i={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(c){var u=t(c,o);return r.push(u),function(){r=r.filter(function(d){return d!==u})}},assignSyncMedium:function(c){for(o=!0;r.length;){var u=r;r=[],u.forEach(c)}r={push:function(d){return c(d)},filter:function(){return r}}},assignMedium:function(c){o=!0;var u=[];if(r.length){var d=r;r=[],d.forEach(c),u=r}var h=function(){var x=u;u=[],x.forEach(c)},g=function(){return Promise.resolve().then(h)};g(),r={push:function(x){u.push(x),g()},filter:function(x){return u=u.filter(x),r}}}};return i}function JT(e){e===void 0&&(e={});var t=ZT(null);return t.options=Zn({async:!0,ssr:!1},e),t}var z0=function(e){var t=e.sideCar,r=$0(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return p.createElement(o,Zn({},r))};z0.isSideCarExport=!0;function eP(e,t){return e.useMedium(t),z0}var B0=JT(),yf=function(){},zc=p.forwardRef(function(e,t){var r=p.useRef(null),o=p.useState({onScrollCapture:yf,onWheelCapture:yf,onTouchMoveCapture:yf}),i=o[0],c=o[1],u=e.forwardProps,d=e.children,h=e.className,g=e.removeScrollBar,x=e.enabled,v=e.shards,w=e.sideCar,S=e.noRelative,C=e.noIsolation,b=e.inert,k=e.allowPinchZoom,N=e.as,E=N===void 0?"div":N,R=e.gapMode,T=$0(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=w,F=YT([r,t]),I=Zn(Zn({},T),i);return p.createElement(p.Fragment,null,x&&p.createElement(M,{sideCar:B0,removeScrollBar:g,shards:v,noRelative:S,noIsolation:C,inert:b,setCallbacks:c,allowPinchZoom:!!k,lockRef:r,gapMode:R}),u?p.cloneElement(p.Children.only(d),Zn(Zn({},I),{ref:F})):p.createElement(E,Zn({},I,{className:h,ref:F}),d))});zc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};zc.classNames={fullWidth:Kl,zeroRight:Wl};var tP=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function nP(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=tP();return t&&e.setAttribute("nonce",t),e}function rP(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function sP(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var oP=function(){var e=0,t=null;return{add:function(r){e==0&&(t=nP())&&(rP(t,r),sP(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},iP=function(){var e=oP();return function(t,r){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},V0=function(){var e=iP(),t=function(r){var o=r.styles,i=r.dynamic;return e(o,i),null};return t},aP={left:0,top:0,right:0,gap:0},wf=function(e){return parseInt(e||"",10)||0},lP=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[wf(r),wf(o),wf(i)]},cP=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return aP;var t=lP(e),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-r+t[2]-t[0])}},uP=V0(),Co="data-scroll-locked",dP=function(e,t,r,o){var i=e.left,c=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),`
9
+ .`.concat(KT,` {
10
+ overflow: hidden `).concat(o,`;
11
+ padding-right: `).concat(d,"px ").concat(o,`;
12
+ }
13
+ body[`).concat(Co,`] {
14
+ overflow: hidden `).concat(o,`;
15
+ overscroll-behavior: contain;
16
+ `).concat([t&&"position: relative ".concat(o,";"),r==="margin"&&`
17
+ padding-left: `.concat(i,`px;
18
+ padding-top: `).concat(c,`px;
19
+ padding-right: `).concat(u,`px;
20
+ margin-left:0;
21
+ margin-top:0;
22
+ margin-right: `).concat(d,"px ").concat(o,`;
23
+ `),r==="padding"&&"padding-right: ".concat(d,"px ").concat(o,";")].filter(Boolean).join(""),`
24
+ }
25
+
26
+ .`).concat(Wl,` {
27
+ right: `).concat(d,"px ").concat(o,`;
28
+ }
29
+
30
+ .`).concat(Kl,` {
31
+ margin-right: `).concat(d,"px ").concat(o,`;
32
+ }
33
+
34
+ .`).concat(Wl," .").concat(Wl,` {
35
+ right: 0 `).concat(o,`;
36
+ }
37
+
38
+ .`).concat(Kl," .").concat(Kl,` {
39
+ margin-right: 0 `).concat(o,`;
40
+ }
41
+
42
+ body[`).concat(Co,`] {
43
+ `).concat(qT,": ").concat(d,`px;
44
+ }
45
+ `)},fv=function(){var e=parseInt(document.body.getAttribute(Co)||"0",10);return isFinite(e)?e:0},fP=function(){p.useEffect(function(){return document.body.setAttribute(Co,(fv()+1).toString()),function(){var e=fv()-1;e<=0?document.body.removeAttribute(Co):document.body.setAttribute(Co,e.toString())}},[])},pP=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,i=o===void 0?"margin":o;fP();var c=p.useMemo(function(){return cP(i)},[i]);return p.createElement(uP,{styles:dP(c,!t,i,r?"":"!important")})},Gf=!1;if(typeof window<"u")try{var Al=Object.defineProperty({},"passive",{get:function(){return Gf=!0,!0}});window.addEventListener("test",Al,Al),window.removeEventListener("test",Al,Al)}catch{Gf=!1}var xo=Gf?{passive:!1}:!1,hP=function(e){return e.tagName==="TEXTAREA"},U0=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!hP(e)&&r[t]==="visible")},mP=function(e){return U0(e,"overflowY")},gP=function(e){return U0(e,"overflowX")},pv=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var i=H0(e,o);if(i){var c=W0(e,o),u=c[1],d=c[2];if(u>d)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},xP=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},vP=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},H0=function(e,t){return e==="v"?mP(t):gP(t)},W0=function(e,t){return e==="v"?xP(t):vP(t)},yP=function(e,t){return e==="h"&&t==="rtl"?-1:1},wP=function(e,t,r,o,i){var c=yP(e,window.getComputedStyle(t).direction),u=c*o,d=r.target,h=t.contains(d),g=!1,x=u>0,v=0,w=0;do{if(!d)break;var S=W0(e,d),C=S[0],b=S[1],k=S[2],N=b-k-c*C;(C||N)&&H0(e,d)&&(v+=N,w+=C);var E=d.parentNode;d=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!h&&d!==document.body||h&&(t.contains(d)||t===d));return(x&&Math.abs(v)<1||!x&&Math.abs(w)<1)&&(g=!0),g},Il=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},hv=function(e){return[e.deltaX,e.deltaY]},mv=function(e){return e&&"current"in e?e.current:e},bP=function(e,t){return e[0]===t[0]&&e[1]===t[1]},SP=function(e){return`
46
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
47
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
48
+ `)},kP=0,vo=[];function CP(e){var t=p.useRef([]),r=p.useRef([0,0]),o=p.useRef(),i=p.useState(kP++)[0],c=p.useState(V0)[0],u=p.useRef(e);p.useEffect(function(){u.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var b=WT([e.lockRef.current],(e.shards||[]).map(mv),!0).filter(Boolean);return b.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),b.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var d=p.useCallback(function(b,k){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!u.current.allowPinchZoom;var N=Il(b),E=r.current,R="deltaX"in b?b.deltaX:E[0]-N[0],T="deltaY"in b?b.deltaY:E[1]-N[1],M,F=b.target,I=Math.abs(R)>Math.abs(T)?"h":"v";if("touches"in b&&I==="h"&&F.type==="range")return!1;var O=window.getSelection(),q=O&&O.anchorNode,U=q?q===F||q.contains(F):!1;if(U)return!1;var G=pv(I,F);if(!G)return!0;if(G?M=I:(M=I==="v"?"h":"v",G=pv(I,F)),!G)return!1;if(!o.current&&"changedTouches"in b&&(R||T)&&(o.current=M),!M)return!0;var _=o.current||M;return wP(_,k,b,_==="h"?R:T)},[]),h=p.useCallback(function(b){var k=b;if(!(!vo.length||vo[vo.length-1]!==c)){var N="deltaY"in k?hv(k):Il(k),E=t.current.filter(function(M){return M.name===k.type&&(M.target===k.target||k.target===M.shadowParent)&&bP(M.delta,N)})[0];if(E&&E.should){k.cancelable&&k.preventDefault();return}if(!E){var R=(u.current.shards||[]).map(mv).filter(Boolean).filter(function(M){return M.contains(k.target)}),T=R.length>0?d(k,R[0]):!u.current.noIsolation;T&&k.cancelable&&k.preventDefault()}}},[]),g=p.useCallback(function(b,k,N,E){var R={name:b,delta:k,target:N,should:E,shadowParent:NP(N)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(T){return T!==R})},1)},[]),x=p.useCallback(function(b){r.current=Il(b),o.current=void 0},[]),v=p.useCallback(function(b){g(b.type,hv(b),b.target,d(b,e.lockRef.current))},[]),w=p.useCallback(function(b){g(b.type,Il(b),b.target,d(b,e.lockRef.current))},[]);p.useEffect(function(){return vo.push(c),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:w}),document.addEventListener("wheel",h,xo),document.addEventListener("touchmove",h,xo),document.addEventListener("touchstart",x,xo),function(){vo=vo.filter(function(b){return b!==c}),document.removeEventListener("wheel",h,xo),document.removeEventListener("touchmove",h,xo),document.removeEventListener("touchstart",x,xo)}},[]);var S=e.removeScrollBar,C=e.inert;return p.createElement(p.Fragment,null,C?p.createElement(c,{styles:SP(i)}):null,S?p.createElement(pP,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function NP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const jP=eP(B0,CP);var ia=p.forwardRef(function(e,t){return p.createElement(zc,Zn({},e,{ref:t,sideCar:jP}))});ia.classNames=zc.classNames;var EP=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},yo=new WeakMap,Ol=new WeakMap,Ll={},bf=0,K0=function(e){return e&&(e.host||K0(e.parentNode))},RP=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=K0(r);return o&&e.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},TP=function(e,t,r,o){var i=RP(t,Array.isArray(e)?e:[e]);Ll[r]||(Ll[r]=new WeakMap);var c=Ll[r],u=[],d=new Set,h=new Set(i),g=function(v){!v||d.has(v)||(d.add(v),g(v.parentNode))};i.forEach(g);var x=function(v){!v||h.has(v)||Array.prototype.forEach.call(v.children,function(w){if(d.has(w))x(w);else try{var S=w.getAttribute(o),C=S!==null&&S!=="false",b=(yo.get(w)||0)+1,k=(c.get(w)||0)+1;yo.set(w,b),c.set(w,k),u.push(w),b===1&&C&&Ol.set(w,!0),k===1&&w.setAttribute(r,"true"),C||w.setAttribute(o,"true")}catch(N){console.error("aria-hidden: cannot operate on ",w,N)}})};return x(t),d.clear(),bf++,function(){u.forEach(function(v){var w=yo.get(v)-1,S=c.get(v)-1;yo.set(v,w),c.set(v,S),w||(Ol.has(v)||v.removeAttribute(o),Ol.delete(v)),S||v.removeAttribute(r)}),bf--,bf||(yo=new WeakMap,yo=new WeakMap,Ol=new WeakMap,Ll={})}},Bc=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),i=EP(e);return i?(o.push.apply(o,Array.from(i.querySelectorAll("[aria-live], script"))),TP(o,i,r,"aria-hidden")):function(){return null}};function PP(e){const t=MP(e),r=p.forwardRef((o,i)=>{const{children:c,...u}=o,d=p.Children.toArray(c),h=d.find(_P);if(h){const g=h.props.children,x=d.map(v=>v===h?p.Children.count(g)>1?p.Children.only(null):p.isValidElement(g)?g.props.children:null:v);return a.jsx(t,{...u,ref:i,children:p.isValidElement(g)?p.cloneElement(g,void 0,x):null})}return a.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}function MP(e){const t=p.forwardRef((r,o)=>{const{children:i,...c}=r;if(p.isValidElement(i)){const u=IP(i),d=AP(c,i.props);return i.type!==p.Fragment&&(d.ref=o?nr(o,u):u),p.cloneElement(i,d)}return p.Children.count(i)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var DP=Symbol("radix.slottable");function _P(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===DP}function AP(e,t){const r={...t};for(const o in t){const i=e[o],c=t[o];/^on[A-Z]/.test(o)?i&&c?r[o]=(...d)=>{const h=c(...d);return i(...d),h}:i&&(r[o]=i):o==="style"?r[o]={...i,...c}:o==="className"&&(r[o]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function IP(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Vc="Dialog",[q0]=Qt(Vc),[OP,Un]=q0(Vc),Q0=e=>{const{__scopeDialog:t,children:r,open:o,defaultOpen:i,onOpenChange:c,modal:u=!0}=e,d=p.useRef(null),h=p.useRef(null),[g,x]=Fn({prop:o,defaultProp:i??!1,onChange:c,caller:Vc});return a.jsx(OP,{scope:t,triggerRef:d,contentRef:h,contentId:xn(),titleId:xn(),descriptionId:xn(),open:g,onOpenChange:x,onOpenToggle:p.useCallback(()=>x(v=>!v),[x]),modal:u,children:r})};Q0.displayName=Vc;var G0="DialogTrigger",LP=p.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,i=Un(G0,r),c=_e(t,i.triggerRef);return a.jsx(Ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Wp(i.open),...o,ref:c,onClick:le(e.onClick,i.onOpenToggle)})});LP.displayName=G0;var Up="DialogPortal",[FP,Y0]=q0(Up,{forceMount:void 0}),X0=e=>{const{__scopeDialog:t,forceMount:r,children:o,container:i}=e,c=Un(Up,t);return a.jsx(FP,{scope:t,forceMount:r,children:p.Children.map(o,u=>a.jsx(bt,{present:r||c.open,children:a.jsx(Fo,{asChild:!0,container:i,children:u})}))})};X0.displayName=Up;var rc="DialogOverlay",Z0=p.forwardRef((e,t)=>{const r=Y0(rc,e.__scopeDialog),{forceMount:o=r.forceMount,...i}=e,c=Un(rc,e.__scopeDialog);return c.modal?a.jsx(bt,{present:o||c.open,children:a.jsx(zP,{...i,ref:t})}):null});Z0.displayName=rc;var $P=PP("DialogOverlay.RemoveScroll"),zP=p.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,i=Un(rc,r);return a.jsx(ia,{as:$P,allowPinchZoom:!0,shards:[i.contentRef],children:a.jsx(Ne.div,{"data-state":Wp(i.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),_s="DialogContent",J0=p.forwardRef((e,t)=>{const r=Y0(_s,e.__scopeDialog),{forceMount:o=r.forceMount,...i}=e,c=Un(_s,e.__scopeDialog);return a.jsx(bt,{present:o||c.open,children:c.modal?a.jsx(BP,{...i,ref:t}):a.jsx(VP,{...i,ref:t})})});J0.displayName=_s;var BP=p.forwardRef((e,t)=>{const r=Un(_s,e.__scopeDialog),o=p.useRef(null),i=_e(t,r.contentRef,o);return p.useEffect(()=>{const c=o.current;if(c)return Bc(c)},[]),a.jsx(ew,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:le(e.onCloseAutoFocus,c=>{c.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:le(e.onPointerDownOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&c.preventDefault()}),onFocusOutside:le(e.onFocusOutside,c=>c.preventDefault())})}),VP=p.forwardRef((e,t)=>{const r=Un(_s,e.__scopeDialog),o=p.useRef(!1),i=p.useRef(!1);return a.jsx(ew,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{e.onCloseAutoFocus?.(c),c.defaultPrevented||(o.current||r.triggerRef.current?.focus(),c.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:c=>{e.onInteractOutside?.(c),c.defaultPrevented||(o.current=!0,c.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=c.target;r.triggerRef.current?.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&i.current&&c.preventDefault()}})}),ew=p.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:c,...u}=e,d=Un(_s,r),h=p.useRef(null),g=_e(t,h);return $c(),a.jsxs(a.Fragment,{children:[a.jsx(oa,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:c,children:a.jsx(Bs,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Wp(d.open),...u,ref:g,onDismiss:()=>d.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(UP,{titleId:d.titleId}),a.jsx(WP,{contentRef:h,descriptionId:d.descriptionId})]})]})}),Hp="DialogTitle",tw=p.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,i=Un(Hp,r);return a.jsx(Ne.h2,{id:i.titleId,...o,ref:t})});tw.displayName=Hp;var nw="DialogDescription",rw=p.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,i=Un(nw,r);return a.jsx(Ne.p,{id:i.descriptionId,...o,ref:t})});rw.displayName=nw;var sw="DialogClose",ow=p.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,i=Un(sw,r);return a.jsx(Ne.button,{type:"button",...o,ref:t,onClick:le(e.onClick,()=>i.onOpenChange(!1))})});ow.displayName=sw;function Wp(e){return e?"open":"closed"}var iw="DialogTitleWarning",[WO,aw]=yj(iw,{contentName:_s,titleName:Hp,docsSlug:"dialog"}),UP=({titleId:e})=>{const t=aw(iw),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
49
+
50
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
51
+
52
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},HP="DialogDescriptionWarning",WP=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${aw(HP).contentName}}.`;return p.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},lw=Q0,cw=X0,Uc=Z0,Hc=J0,Wc=tw,Kc=rw,uw=ow;const dw=lw,KP=cw,fw=p.forwardRef(({className:e,...t},r)=>a.jsx(Uc,{className:ve("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));fw.displayName=Uc.displayName;const qP=$o("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Kp=p.forwardRef(({side:e="right",className:t,children:r,...o},i)=>a.jsxs(KP,{children:[a.jsx(fw,{}),a.jsxs(Hc,{ref:i,className:ve(qP({side:e}),t),...o,children:[r,a.jsxs(uw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[a.jsx(er,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Kp.displayName=Hc.displayName;const qp=({className:e,...t})=>a.jsx("div",{className:ve("flex flex-col space-y-2 text-center sm:text-left",e),...t});qp.displayName="SheetHeader";const Qp=p.forwardRef(({className:e,...t},r)=>a.jsx(Wc,{ref:r,className:ve("text-lg font-semibold text-foreground",e),...t}));Qp.displayName=Wc.displayName;const Gp=p.forwardRef(({className:e,...t},r)=>a.jsx(Kc,{ref:r,className:ve("text-sm text-muted-foreground",e),...t}));Gp.displayName=Kc.displayName;const QP="sidebar_state",GP=3600*24*7,YP="16rem",XP="18rem",ZP="3rem",JP="b",pw=p.createContext(null);function qc(){const e=p.useContext(pw);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function eM({defaultOpen:e=!0,open:t,onOpenChange:r,className:o,style:i,children:c,...u}){const d=PT(),[h,g]=p.useState(!1),[x,v]=p.useState(e),w=t??x,S=p.useCallback(N=>{const E=typeof N=="function"?N(w):N;r?r(E):v(E),document.cookie=`${QP}=${E}; path=/; max-age=${GP}`},[r,w]),C=p.useCallback(()=>d?g(N=>!N):S(N=>!N),[d,S,g]);p.useEffect(()=>{const N=E=>{E.key===JP&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),C())};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[C]);const b=w?"expanded":"collapsed",k=p.useMemo(()=>({state:b,open:w,setOpen:S,isMobile:d,openMobile:h,setOpenMobile:g,toggleSidebar:C}),[b,w,S,d,h,g,C]);return a.jsx(pw.Provider,{value:k,children:a.jsx(A0,{delayDuration:0,children:a.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":YP,"--sidebar-width-icon":ZP,...i},className:ve("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",o),...u,children:c})})})}function tM({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:o,children:i,...c}){const{isMobile:u,state:d,openMobile:h,setOpenMobile:g}=qc();return r==="none"?a.jsx("div",{"data-slot":"sidebar",className:ve("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",o),...c,children:i}):u?a.jsx(dw,{open:h,onOpenChange:g,...c,children:a.jsxs(Kp,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden",style:{"--sidebar-width":XP},side:e,children:[a.jsxs(qp,{className:"sr-only",children:[a.jsx(Qp,{children:"Sidebar"}),a.jsx(Gp,{children:"Displays the mobile sidebar."})]}),a.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):a.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":d,"data-collapsible":d==="collapsed"?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[a.jsx("div",{"data-slot":"sidebar-gap",className:ve("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+var(--spacing-4))]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),a.jsx("div",{"data-slot":"sidebar-container",className:ve("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+var(--spacing-4)+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",o),...c,children:a.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:i})})]})}function As({className:e,onClick:t,...r}){const{toggleSidebar:o}=qc();return a.jsxs(pe,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:ve("h-7 w-7",e),onClick:i=>{t?.(i),o()},...r,children:[a.jsx(V2,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function nM({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:ve("flex flex-col gap-2 p-2",e),...t})}function rM({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:ve("flex flex-col gap-2 p-2",e),...t})}function sM({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:ve("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function hw({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:ve("relative flex w-full min-w-0 flex-col p-2",e),...t})}function oM({className:e,asChild:t=!1,...r}){const o=t?Vp:"div";return a.jsx(o,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:ve("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...r})}function mw({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:ve("w-full text-sm",e),...t})}function gw({className:e,...t}){return a.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:ve("flex w-full min-w-0 flex-col gap-1",e),...t})}function xw({className:e,...t}){return a.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:ve("group/menu-item relative",e),...t})}const iM=$o("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:w-8! group-data-[collapsible=icon]:h-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function vw({asChild:e=!1,isActive:t=!1,variant:r="default",size:o="default",tooltip:i,className:c,...u}){const d=e?Vp:"button",{isMobile:h,state:g}=qc(),x=a.jsx(d,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":o,"data-active":t,className:ve(iM({variant:r,size:o}),c),...u});return i?(typeof i=="string"&&(i={children:i}),a.jsxs(qf,{children:[a.jsx(Qf,{asChild:!0,children:x}),a.jsx(tc,{side:"right",align:"center",hidden:g!=="collapsed"||h,...i})]})):x}const yw=p.createContext(null);function aM({children:e}){const t=rn(),[r,o]=p.useState(null),{data:i=[],isLoading:c,refetch:u}=it({queryKey:["/api/vaults"],queryFn:()=>je("GET","/api/vaults").then(x=>x.json()),staleTime:0,refetchOnMount:"always"});p.useEffect(()=>{i.length>0&&!r&&o(i[0].id),r&&i.length>0&&!i.find(x=>x.id===r)&&o(i[0].id)},[i,r]);const d=i.find(x=>x.id===r)||null,h=p.useCallback(x=>{o(x),t.invalidateQueries({queryKey:["/api/notes"]}),t.invalidateQueries({queryKey:["/api/notes/folders"]}),t.invalidateQueries({queryKey:["/api/tasks"]}),t.invalidateQueries({queryKey:["/api/chat/sessions"]}),t.invalidateQueries({queryKey:["/api/skills"]}),t.invalidateQueries({queryKey:["/api/search"]})},[t]),g=r?`?vault=${r}`:"";return a.jsx(yw.Provider,{value:{vaults:i,activeVault:d,setActiveVaultId:h,isLoading:c,vaultParam:g,vaultId:r||void 0,refetchVaults:()=>u()},children:e})}function yn(){const e=p.useContext(yw);if(!e)throw new Error("useVault must be used within VaultProvider");return e}const sc=""+new URL("cortex-icon-BKk7C7Sc.png",import.meta.url).href;var lM=p.createContext(void 0);function aa(e){const t=p.useContext(lM);return e||t||"ltr"}function Yf(e,[t,r]){return Math.min(r,Math.max(t,e))}function cM(e,t){return p.useReducer((r,o)=>t[r][o]??r,e)}var Yp="ScrollArea",[ww]=Qt(Yp),[uM,wn]=ww(Yp),bw=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:o="hover",dir:i,scrollHideDelay:c=600,...u}=e,[d,h]=p.useState(null),[g,x]=p.useState(null),[v,w]=p.useState(null),[S,C]=p.useState(null),[b,k]=p.useState(null),[N,E]=p.useState(0),[R,T]=p.useState(0),[M,F]=p.useState(!1),[I,O]=p.useState(!1),q=_e(t,G=>h(G)),U=aa(i);return a.jsx(uM,{scope:r,type:o,dir:U,scrollHideDelay:c,scrollArea:d,viewport:g,onViewportChange:x,content:v,onContentChange:w,scrollbarX:S,onScrollbarXChange:C,scrollbarXEnabled:M,onScrollbarXEnabledChange:F,scrollbarY:b,onScrollbarYChange:k,scrollbarYEnabled:I,onScrollbarYEnabledChange:O,onCornerWidthChange:E,onCornerHeightChange:T,children:a.jsx(Ne.div,{dir:U,...u,ref:q,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":R+"px",...e.style}})})});bw.displayName=Yp;var Sw="ScrollAreaViewport",kw=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:o,nonce:i,...c}=e,u=wn(Sw,r),d=p.useRef(null),h=_e(t,d,u.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),a.jsx(Ne.div,{"data-radix-scroll-area-viewport":"",...c,ref:h,style:{overflowX:u.scrollbarXEnabled?"scroll":"hidden",overflowY:u.scrollbarYEnabled?"scroll":"hidden",...e.style},children:a.jsx("div",{ref:u.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});kw.displayName=Sw;var sr="ScrollAreaScrollbar",Xp=p.forwardRef((e,t)=>{const{forceMount:r,...o}=e,i=wn(sr,e.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:u}=i,d=e.orientation==="horizontal";return p.useEffect(()=>(d?c(!0):u(!0),()=>{d?c(!1):u(!1)}),[d,c,u]),i.type==="hover"?a.jsx(dM,{...o,ref:t,forceMount:r}):i.type==="scroll"?a.jsx(fM,{...o,ref:t,forceMount:r}):i.type==="auto"?a.jsx(Cw,{...o,ref:t,forceMount:r}):i.type==="always"?a.jsx(Zp,{...o,ref:t}):null});Xp.displayName=sr;var dM=p.forwardRef((e,t)=>{const{forceMount:r,...o}=e,i=wn(sr,e.__scopeScrollArea),[c,u]=p.useState(!1);return p.useEffect(()=>{const d=i.scrollArea;let h=0;if(d){const g=()=>{window.clearTimeout(h),u(!0)},x=()=>{h=window.setTimeout(()=>u(!1),i.scrollHideDelay)};return d.addEventListener("pointerenter",g),d.addEventListener("pointerleave",x),()=>{window.clearTimeout(h),d.removeEventListener("pointerenter",g),d.removeEventListener("pointerleave",x)}}},[i.scrollArea,i.scrollHideDelay]),a.jsx(bt,{present:r||c,children:a.jsx(Cw,{"data-state":c?"visible":"hidden",...o,ref:t})})}),fM=p.forwardRef((e,t)=>{const{forceMount:r,...o}=e,i=wn(sr,e.__scopeScrollArea),c=e.orientation==="horizontal",u=Gc(()=>h("SCROLL_END"),100),[d,h]=cM("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(d==="idle"){const g=window.setTimeout(()=>h("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(g)}},[d,i.scrollHideDelay,h]),p.useEffect(()=>{const g=i.viewport,x=c?"scrollLeft":"scrollTop";if(g){let v=g[x];const w=()=>{const S=g[x];v!==S&&(h("SCROLL"),u()),v=S};return g.addEventListener("scroll",w),()=>g.removeEventListener("scroll",w)}},[i.viewport,c,h,u]),a.jsx(bt,{present:r||d!=="hidden",children:a.jsx(Zp,{"data-state":d==="hidden"?"hidden":"visible",...o,ref:t,onPointerEnter:le(e.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:le(e.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),Cw=p.forwardRef((e,t)=>{const r=wn(sr,e.__scopeScrollArea),{forceMount:o,...i}=e,[c,u]=p.useState(!1),d=e.orientation==="horizontal",h=Gc(()=>{if(r.viewport){const g=r.viewport.offsetWidth<r.viewport.scrollWidth,x=r.viewport.offsetHeight<r.viewport.scrollHeight;u(d?g:x)}},10);return Mo(r.viewport,h),Mo(r.content,h),a.jsx(bt,{present:o||c,children:a.jsx(Zp,{"data-state":c?"visible":"hidden",...i,ref:t})})}),Zp=p.forwardRef((e,t)=>{const{orientation:r="vertical",...o}=e,i=wn(sr,e.__scopeScrollArea),c=p.useRef(null),u=p.useRef(0),[d,h]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),g=Tw(d.viewport,d.content),x={...o,sizes:d,onSizesChange:h,hasThumb:g>0&&g<1,onThumbChange:w=>c.current=w,onThumbPointerUp:()=>u.current=0,onThumbPointerDown:w=>u.current=w};function v(w,S){return vM(w,u.current,d,S)}return r==="horizontal"?a.jsx(pM,{...x,ref:t,onThumbPositionChange:()=>{if(i.viewport&&c.current){const w=i.viewport.scrollLeft,S=gv(w,d,i.dir);c.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:w=>{i.viewport&&(i.viewport.scrollLeft=w)},onDragScroll:w=>{i.viewport&&(i.viewport.scrollLeft=v(w,i.dir))}}):r==="vertical"?a.jsx(hM,{...x,ref:t,onThumbPositionChange:()=>{if(i.viewport&&c.current){const w=i.viewport.scrollTop,S=gv(w,d);c.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:w=>{i.viewport&&(i.viewport.scrollTop=w)},onDragScroll:w=>{i.viewport&&(i.viewport.scrollTop=v(w))}}):null}),pM=p.forwardRef((e,t)=>{const{sizes:r,onSizesChange:o,...i}=e,c=wn(sr,e.__scopeScrollArea),[u,d]=p.useState(),h=p.useRef(null),g=_e(t,h,c.onScrollbarXChange);return p.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),a.jsx(jw,{"data-orientation":"horizontal",...i,ref:g,sizes:r,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Qc(r)+"px",...e.style},onThumbPointerDown:x=>e.onThumbPointerDown(x.x),onDragScroll:x=>e.onDragScroll(x.x),onWheelScroll:(x,v)=>{if(c.viewport){const w=c.viewport.scrollLeft+x.deltaX;e.onWheelScroll(w),Mw(w,v)&&x.preventDefault()}},onResize:()=>{h.current&&c.viewport&&u&&o({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:ic(u.paddingLeft),paddingEnd:ic(u.paddingRight)}})}})}),hM=p.forwardRef((e,t)=>{const{sizes:r,onSizesChange:o,...i}=e,c=wn(sr,e.__scopeScrollArea),[u,d]=p.useState(),h=p.useRef(null),g=_e(t,h,c.onScrollbarYChange);return p.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),a.jsx(jw,{"data-orientation":"vertical",...i,ref:g,sizes:r,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Qc(r)+"px",...e.style},onThumbPointerDown:x=>e.onThumbPointerDown(x.y),onDragScroll:x=>e.onDragScroll(x.y),onWheelScroll:(x,v)=>{if(c.viewport){const w=c.viewport.scrollTop+x.deltaY;e.onWheelScroll(w),Mw(w,v)&&x.preventDefault()}},onResize:()=>{h.current&&c.viewport&&u&&o({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:ic(u.paddingTop),paddingEnd:ic(u.paddingBottom)}})}})}),[mM,Nw]=ww(sr),jw=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:o,hasThumb:i,onThumbChange:c,onThumbPointerUp:u,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:g,onWheelScroll:x,onResize:v,...w}=e,S=wn(sr,r),[C,b]=p.useState(null),k=_e(t,q=>b(q)),N=p.useRef(null),E=p.useRef(""),R=S.viewport,T=o.content-o.viewport,M=ut(x),F=ut(h),I=Gc(v,10);function O(q){if(N.current){const U=q.clientX-N.current.left,G=q.clientY-N.current.top;g({x:U,y:G})}}return p.useEffect(()=>{const q=U=>{const G=U.target;C?.contains(G)&&M(U,T)};return document.addEventListener("wheel",q,{passive:!1}),()=>document.removeEventListener("wheel",q,{passive:!1})},[R,C,T,M]),p.useEffect(F,[o,F]),Mo(C,I),Mo(S.content,I),a.jsx(mM,{scope:r,scrollbar:C,hasThumb:i,onThumbChange:ut(c),onThumbPointerUp:ut(u),onThumbPositionChange:F,onThumbPointerDown:ut(d),children:a.jsx(Ne.div,{...w,ref:k,style:{position:"absolute",...w.style},onPointerDown:le(e.onPointerDown,q=>{q.button===0&&(q.target.setPointerCapture(q.pointerId),N.current=C.getBoundingClientRect(),E.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),O(q))}),onPointerMove:le(e.onPointerMove,O),onPointerUp:le(e.onPointerUp,q=>{const U=q.target;U.hasPointerCapture(q.pointerId)&&U.releasePointerCapture(q.pointerId),document.body.style.webkitUserSelect=E.current,S.viewport&&(S.viewport.style.scrollBehavior=""),N.current=null})})})}),oc="ScrollAreaThumb",Ew=p.forwardRef((e,t)=>{const{forceMount:r,...o}=e,i=Nw(oc,e.__scopeScrollArea);return a.jsx(bt,{present:r||i.hasThumb,children:a.jsx(gM,{ref:t,...o})})}),gM=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:o,...i}=e,c=wn(oc,r),u=Nw(oc,r),{onThumbPositionChange:d}=u,h=_e(t,v=>u.onThumbChange(v)),g=p.useRef(void 0),x=Gc(()=>{g.current&&(g.current(),g.current=void 0)},100);return p.useEffect(()=>{const v=c.viewport;if(v){const w=()=>{if(x(),!g.current){const S=yM(v,d);g.current=S,d()}};return d(),v.addEventListener("scroll",w),()=>v.removeEventListener("scroll",w)}},[c.viewport,x,d]),a.jsx(Ne.div,{"data-state":u.hasThumb?"visible":"hidden",...i,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:le(e.onPointerDownCapture,v=>{const S=v.target.getBoundingClientRect(),C=v.clientX-S.left,b=v.clientY-S.top;u.onThumbPointerDown({x:C,y:b})}),onPointerUp:le(e.onPointerUp,u.onThumbPointerUp)})});Ew.displayName=oc;var Jp="ScrollAreaCorner",Rw=p.forwardRef((e,t)=>{const r=wn(Jp,e.__scopeScrollArea),o=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&o?a.jsx(xM,{...e,ref:t}):null});Rw.displayName=Jp;var xM=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,...o}=e,i=wn(Jp,r),[c,u]=p.useState(0),[d,h]=p.useState(0),g=!!(c&&d);return Mo(i.scrollbarX,()=>{const x=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(x),h(x)}),Mo(i.scrollbarY,()=>{const x=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(x),u(x)}),g?a.jsx(Ne.div,{...o,ref:t,style:{width:c,height:d,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ic(e){return e?parseInt(e,10):0}function Tw(e,t){const r=e/t;return isNaN(r)?0:r}function Qc(e){const t=Tw(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=(e.scrollbar.size-r)*t;return Math.max(o,18)}function vM(e,t,r,o="ltr"){const i=Qc(r),c=i/2,u=t||c,d=i-u,h=r.scrollbar.paddingStart+u,g=r.scrollbar.size-r.scrollbar.paddingEnd-d,x=r.content-r.viewport,v=o==="ltr"?[0,x]:[x*-1,0];return Pw([h,g],v)(e)}function gv(e,t,r="ltr"){const o=Qc(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,c=t.scrollbar.size-i,u=t.content-t.viewport,d=c-o,h=r==="ltr"?[0,u]:[u*-1,0],g=Yf(e,h);return Pw([0,u],[0,d])(g)}function Pw(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(r-e[0])}}function Mw(e,t){return e>0&&e<t}var yM=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},o=0;return(function i(){const c={left:e.scrollLeft,top:e.scrollTop},u=r.left!==c.left,d=r.top!==c.top;(u||d)&&t(),r=c,o=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(o)};function Gc(e,t){const r=ut(e),o=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(o.current),[]),p.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(r,t)},[r,t])}function Mo(e,t){const r=ut(t);wt(()=>{let o=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(o),i.unobserve(e)}}},[e,r])}var Dw=bw,wM=kw,bM=Rw;const Is=p.forwardRef(({className:e,children:t,...r},o)=>a.jsxs(Dw,{ref:o,className:ve("relative overflow-hidden",e),...r,children:[a.jsx(wM,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(_w,{}),a.jsx(bM,{})]}));Is.displayName=Dw.displayName;const _w=p.forwardRef(({className:e,orientation:t="vertical",...r},o)=>a.jsx(Xp,{ref:o,orientation:t,className:ve("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:a.jsx(Ew,{className:"relative flex-1 rounded-full bg-border"})}));_w.displayName=Xp.displayName;var Sf="rovingFocusGroup.onEntryFocus",SM={bubbles:!1,cancelable:!0},la="RovingFocusGroup",[Xf,Aw,kM]=Sc(la),[CM,Yc]=Qt(la,[kM]),[NM,jM]=CM(la),Iw=p.forwardRef((e,t)=>a.jsx(Xf.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Xf.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(EM,{...e,ref:t})})}));Iw.displayName=la;var EM=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:i=!1,dir:c,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:g,preventScrollOnEntryFocus:x=!1,...v}=e,w=p.useRef(null),S=_e(t,w),C=aa(c),[b,k]=Fn({prop:u,defaultProp:d??null,onChange:h,caller:la}),[N,E]=p.useState(!1),R=ut(g),T=Aw(r),M=p.useRef(!1),[F,I]=p.useState(0);return p.useEffect(()=>{const O=w.current;if(O)return O.addEventListener(Sf,R),()=>O.removeEventListener(Sf,R)},[R]),a.jsx(NM,{scope:r,orientation:o,dir:C,loop:i,currentTabStopId:b,onItemFocus:p.useCallback(O=>k(O),[k]),onItemShiftTab:p.useCallback(()=>E(!0),[]),onFocusableItemAdd:p.useCallback(()=>I(O=>O+1),[]),onFocusableItemRemove:p.useCallback(()=>I(O=>O-1),[]),children:a.jsx(Ne.div,{tabIndex:N||F===0?-1:0,"data-orientation":o,...v,ref:S,style:{outline:"none",...e.style},onMouseDown:le(e.onMouseDown,()=>{M.current=!0}),onFocus:le(e.onFocus,O=>{const q=!M.current;if(O.target===O.currentTarget&&q&&!N){const U=new CustomEvent(Sf,SM);if(O.currentTarget.dispatchEvent(U),!U.defaultPrevented){const G=T().filter(ie=>ie.focusable),_=G.find(ie=>ie.active),ee=G.find(ie=>ie.id===b),he=[_,ee,...G].filter(Boolean).map(ie=>ie.ref.current);Fw(he,x)}}M.current=!1}),onBlur:le(e.onBlur,()=>E(!1))})})}),Ow="RovingFocusGroupItem",Lw=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:i=!1,tabStopId:c,children:u,...d}=e,h=xn(),g=c||h,x=jM(Ow,r),v=x.currentTabStopId===g,w=Aw(r),{onFocusableItemAdd:S,onFocusableItemRemove:C,currentTabStopId:b}=x;return p.useEffect(()=>{if(o)return S(),()=>C()},[o,S,C]),a.jsx(Xf.ItemSlot,{scope:r,id:g,focusable:o,active:i,children:a.jsx(Ne.span,{tabIndex:v?0:-1,"data-orientation":x.orientation,...d,ref:t,onMouseDown:le(e.onMouseDown,k=>{o?x.onItemFocus(g):k.preventDefault()}),onFocus:le(e.onFocus,()=>x.onItemFocus(g)),onKeyDown:le(e.onKeyDown,k=>{if(k.key==="Tab"&&k.shiftKey){x.onItemShiftTab();return}if(k.target!==k.currentTarget)return;const N=PM(k,x.orientation,x.dir);if(N!==void 0){if(k.metaKey||k.ctrlKey||k.altKey||k.shiftKey)return;k.preventDefault();let R=w().filter(T=>T.focusable).map(T=>T.ref.current);if(N==="last")R.reverse();else if(N==="prev"||N==="next"){N==="prev"&&R.reverse();const T=R.indexOf(k.currentTarget);R=x.loop?MM(R,T+1):R.slice(T+1)}setTimeout(()=>Fw(R))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:b!=null}):u})})});Lw.displayName=Ow;var RM={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function TM(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function PM(e,t,r){const o=TM(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return RM[o]}function Fw(e,t=!1){const r=document.activeElement;for(const o of e)if(o===r||(o.focus({preventScroll:t}),document.activeElement!==r))return}function MM(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var $w=Iw,zw=Lw;function DM(e){const t=_M(e),r=p.forwardRef((o,i)=>{const{children:c,...u}=o,d=p.Children.toArray(c),h=d.find(IM);if(h){const g=h.props.children,x=d.map(v=>v===h?p.Children.count(g)>1?p.Children.only(null):p.isValidElement(g)?g.props.children:null:v);return a.jsx(t,{...u,ref:i,children:p.isValidElement(g)?p.cloneElement(g,void 0,x):null})}return a.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}function _M(e){const t=p.forwardRef((r,o)=>{const{children:i,...c}=r;if(p.isValidElement(i)){const u=LM(i),d=OM(c,i.props);return i.type!==p.Fragment&&(d.ref=o?nr(o,u):u),p.cloneElement(i,d)}return p.Children.count(i)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var AM=Symbol("radix.slottable");function IM(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===AM}function OM(e,t){const r={...t};for(const o in t){const i=e[o],c=t[o];/^on[A-Z]/.test(o)?i&&c?r[o]=(...d)=>{const h=c(...d);return i(...d),h}:i&&(r[o]=i):o==="style"?r[o]={...i,...c}:o==="className"&&(r[o]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function LM(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Zf=["Enter"," "],FM=["ArrowDown","PageUp","Home"],Bw=["ArrowUp","PageDown","End"],$M=[...FM,...Bw],zM={ltr:[...Zf,"ArrowRight"],rtl:[...Zf,"ArrowLeft"]},BM={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ca="Menu",[Yi,VM,UM]=Sc(ca),[Vs,Vw]=Qt(ca,[UM,as,Yc]),Xc=as(),Uw=Yc(),[HM,Us]=Vs(ca),[WM,ua]=Vs(ca),Hw=e=>{const{__scopeMenu:t,open:r=!1,children:o,dir:i,onOpenChange:c,modal:u=!0}=e,d=Xc(t),[h,g]=p.useState(null),x=p.useRef(!1),v=ut(c),w=aa(i);return p.useEffect(()=>{const S=()=>{x.current=!0,document.addEventListener("pointerdown",C,{capture:!0,once:!0}),document.addEventListener("pointermove",C,{capture:!0,once:!0})},C=()=>x.current=!1;return document.addEventListener("keydown",S,{capture:!0}),()=>{document.removeEventListener("keydown",S,{capture:!0}),document.removeEventListener("pointerdown",C,{capture:!0}),document.removeEventListener("pointermove",C,{capture:!0})}},[]),a.jsx(_c,{...d,children:a.jsx(HM,{scope:t,open:r,onOpenChange:v,content:h,onContentChange:g,children:a.jsx(WM,{scope:t,onClose:p.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:x,dir:w,modal:u,children:o})})})};Hw.displayName=ca;var KM="MenuAnchor",eh=p.forwardRef((e,t)=>{const{__scopeMenu:r,...o}=e,i=Xc(r);return a.jsx(sa,{...i,...o,ref:t})});eh.displayName=KM;var th="MenuPortal",[qM,Ww]=Vs(th,{forceMount:void 0}),Kw=e=>{const{__scopeMenu:t,forceMount:r,children:o,container:i}=e,c=Us(th,t);return a.jsx(qM,{scope:t,forceMount:r,children:a.jsx(bt,{present:r||c.open,children:a.jsx(Fo,{asChild:!0,container:i,children:o})})})};Kw.displayName=th;var vn="MenuContent",[QM,nh]=Vs(vn),qw=p.forwardRef((e,t)=>{const r=Ww(vn,e.__scopeMenu),{forceMount:o=r.forceMount,...i}=e,c=Us(vn,e.__scopeMenu),u=ua(vn,e.__scopeMenu);return a.jsx(Yi.Provider,{scope:e.__scopeMenu,children:a.jsx(bt,{present:o||c.open,children:a.jsx(Yi.Slot,{scope:e.__scopeMenu,children:u.modal?a.jsx(GM,{...i,ref:t}):a.jsx(YM,{...i,ref:t})})})})}),GM=p.forwardRef((e,t)=>{const r=Us(vn,e.__scopeMenu),o=p.useRef(null),i=_e(t,o);return p.useEffect(()=>{const c=o.current;if(c)return Bc(c)},[]),a.jsx(rh,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:le(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),YM=p.forwardRef((e,t)=>{const r=Us(vn,e.__scopeMenu);return a.jsx(rh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),XM=DM("MenuContent.ScrollLock"),rh=p.forwardRef((e,t)=>{const{__scopeMenu:r,loop:o=!1,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:h,onEscapeKeyDown:g,onPointerDownOutside:x,onFocusOutside:v,onInteractOutside:w,onDismiss:S,disableOutsideScroll:C,...b}=e,k=Us(vn,r),N=ua(vn,r),E=Xc(r),R=Uw(r),T=VM(r),[M,F]=p.useState(null),I=p.useRef(null),O=_e(t,I,k.onContentChange),q=p.useRef(0),U=p.useRef(""),G=p.useRef(0),_=p.useRef(null),ee=p.useRef("right"),X=p.useRef(0),he=C?ia:p.Fragment,ie=C?{as:XM,allowPinchZoom:!0}:void 0,$=B=>{const Y=U.current+B,D=T().filter(Z=>!Z.disabled),K=document.activeElement,ue=D.find(Z=>Z.ref.current===K)?.textValue,ge=D.map(Z=>Z.textValue),Ce=c3(ge,Y,ue),fe=D.find(Z=>Z.textValue===Ce)?.ref.current;(function Z(H){U.current=H,window.clearTimeout(q.current),H!==""&&(q.current=window.setTimeout(()=>Z(""),1e3))})(Y),fe&&setTimeout(()=>fe.focus())};p.useEffect(()=>()=>window.clearTimeout(q.current),[]),$c();const z=p.useCallback(B=>ee.current===_.current?.side&&d3(B,_.current?.area),[]);return a.jsx(QM,{scope:r,searchRef:U,onItemEnter:p.useCallback(B=>{z(B)&&B.preventDefault()},[z]),onItemLeave:p.useCallback(B=>{z(B)||(I.current?.focus(),F(null))},[z]),onTriggerLeave:p.useCallback(B=>{z(B)&&B.preventDefault()},[z]),pointerGraceTimerRef:G,onPointerGraceIntentChange:p.useCallback(B=>{_.current=B},[]),children:a.jsx(he,{...ie,children:a.jsx(oa,{asChild:!0,trapped:i,onMountAutoFocus:le(c,B=>{B.preventDefault(),I.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:a.jsx(Bs,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:g,onPointerDownOutside:x,onFocusOutside:v,onInteractOutside:w,onDismiss:S,children:a.jsx($w,{asChild:!0,...R,dir:N.dir,orientation:"vertical",loop:o,currentTabStopId:M,onCurrentTabStopIdChange:F,onEntryFocus:le(h,B=>{N.isUsingKeyboardRef.current||B.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(Ac,{role:"menu","aria-orientation":"vertical","data-state":cb(k.open),"data-radix-menu-content":"",dir:N.dir,...E,...b,ref:O,style:{outline:"none",...b.style},onKeyDown:le(b.onKeyDown,B=>{const D=B.target.closest("[data-radix-menu-content]")===B.currentTarget,K=B.ctrlKey||B.altKey||B.metaKey,ue=B.key.length===1;D&&(B.key==="Tab"&&B.preventDefault(),!K&&ue&&$(B.key));const ge=I.current;if(B.target!==ge||!$M.includes(B.key))return;B.preventDefault();const fe=T().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);Bw.includes(B.key)&&fe.reverse(),a3(fe)}),onBlur:le(e.onBlur,B=>{B.currentTarget.contains(B.target)||(window.clearTimeout(q.current),U.current="")}),onPointerMove:le(e.onPointerMove,Xi(B=>{const Y=B.target,D=X.current!==B.clientX;if(B.currentTarget.contains(Y)&&D){const K=B.clientX>X.current?"right":"left";ee.current=K,X.current=B.clientX}}))})})})})})})});qw.displayName=vn;var ZM="MenuGroup",sh=p.forwardRef((e,t)=>{const{__scopeMenu:r,...o}=e;return a.jsx(Ne.div,{role:"group",...o,ref:t})});sh.displayName=ZM;var JM="MenuLabel",Qw=p.forwardRef((e,t)=>{const{__scopeMenu:r,...o}=e;return a.jsx(Ne.div,{...o,ref:t})});Qw.displayName=JM;var ac="MenuItem",xv="menu.itemSelect",Zc=p.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:o,...i}=e,c=p.useRef(null),u=ua(ac,e.__scopeMenu),d=nh(ac,e.__scopeMenu),h=_e(t,c),g=p.useRef(!1),x=()=>{const v=c.current;if(!r&&v){const w=new CustomEvent(xv,{bubbles:!0,cancelable:!0});v.addEventListener(xv,S=>o?.(S),{once:!0}),wp(v,w),w.defaultPrevented?g.current=!1:u.onClose()}};return a.jsx(Gw,{...i,ref:h,disabled:r,onClick:le(e.onClick,x),onPointerDown:v=>{e.onPointerDown?.(v),g.current=!0},onPointerUp:le(e.onPointerUp,v=>{g.current||v.currentTarget?.click()}),onKeyDown:le(e.onKeyDown,v=>{const w=d.searchRef.current!=="";r||w&&v.key===" "||Zf.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Zc.displayName=ac;var Gw=p.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:o=!1,textValue:i,...c}=e,u=nh(ac,r),d=Uw(r),h=p.useRef(null),g=_e(t,h),[x,v]=p.useState(!1),[w,S]=p.useState("");return p.useEffect(()=>{const C=h.current;C&&S((C.textContent??"").trim())},[c.children]),a.jsx(Yi.ItemSlot,{scope:r,disabled:o,textValue:i??w,children:a.jsx(zw,{asChild:!0,...d,focusable:!o,children:a.jsx(Ne.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...c,ref:g,onPointerMove:le(e.onPointerMove,Xi(C=>{o?u.onItemLeave(C):(u.onItemEnter(C),C.defaultPrevented||C.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:le(e.onPointerLeave,Xi(C=>u.onItemLeave(C))),onFocus:le(e.onFocus,()=>v(!0)),onBlur:le(e.onBlur,()=>v(!1))})})})}),e3="MenuCheckboxItem",Yw=p.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:o,...i}=e;return a.jsx(tb,{scope:e.__scopeMenu,checked:r,children:a.jsx(Zc,{role:"menuitemcheckbox","aria-checked":lc(r)?"mixed":r,...i,ref:t,"data-state":ih(r),onSelect:le(i.onSelect,()=>o?.(lc(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Yw.displayName=e3;var Xw="MenuRadioGroup",[t3,n3]=Vs(Xw,{value:void 0,onValueChange:()=>{}}),Zw=p.forwardRef((e,t)=>{const{value:r,onValueChange:o,...i}=e,c=ut(o);return a.jsx(t3,{scope:e.__scopeMenu,value:r,onValueChange:c,children:a.jsx(sh,{...i,ref:t})})});Zw.displayName=Xw;var Jw="MenuRadioItem",eb=p.forwardRef((e,t)=>{const{value:r,...o}=e,i=n3(Jw,e.__scopeMenu),c=r===i.value;return a.jsx(tb,{scope:e.__scopeMenu,checked:c,children:a.jsx(Zc,{role:"menuitemradio","aria-checked":c,...o,ref:t,"data-state":ih(c),onSelect:le(o.onSelect,()=>i.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});eb.displayName=Jw;var oh="MenuItemIndicator",[tb,r3]=Vs(oh,{checked:!1}),nb=p.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:o,...i}=e,c=r3(oh,r);return a.jsx(bt,{present:o||lc(c.checked)||c.checked===!0,children:a.jsx(Ne.span,{...i,ref:t,"data-state":ih(c.checked)})})});nb.displayName=oh;var s3="MenuSeparator",rb=p.forwardRef((e,t)=>{const{__scopeMenu:r,...o}=e;return a.jsx(Ne.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});rb.displayName=s3;var o3="MenuArrow",sb=p.forwardRef((e,t)=>{const{__scopeMenu:r,...o}=e,i=Xc(r);return a.jsx(Ic,{...i,...o,ref:t})});sb.displayName=o3;var i3="MenuSub",[KO,ob]=Vs(i3),Li="MenuSubTrigger",ib=p.forwardRef((e,t)=>{const r=Us(Li,e.__scopeMenu),o=ua(Li,e.__scopeMenu),i=ob(Li,e.__scopeMenu),c=nh(Li,e.__scopeMenu),u=p.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=c,g={__scopeMenu:e.__scopeMenu},x=p.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return p.useEffect(()=>x,[x]),p.useEffect(()=>{const v=d.current;return()=>{window.clearTimeout(v),h(null)}},[d,h]),a.jsx(eh,{asChild:!0,...g,children:a.jsx(Gw,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":cb(r.open),...e,ref:nr(t,i.onTriggerChange),onClick:v=>{e.onClick?.(v),!(e.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:le(e.onPointerMove,Xi(v=>{c.onItemEnter(v),!v.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(c.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),x()},100))})),onPointerLeave:le(e.onPointerLeave,Xi(v=>{x();const w=r.content?.getBoundingClientRect();if(w){const S=r.content?.dataset.side,C=S==="right",b=C?-5:5,k=w[C?"left":"right"],N=w[C?"right":"left"];c.onPointerGraceIntentChange({area:[{x:v.clientX+b,y:v.clientY},{x:k,y:w.top},{x:N,y:w.top},{x:N,y:w.bottom},{x:k,y:w.bottom}],side:S}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(v),v.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:le(e.onKeyDown,v=>{const w=c.searchRef.current!=="";e.disabled||w&&v.key===" "||zM[o.dir].includes(v.key)&&(r.onOpenChange(!0),r.content?.focus(),v.preventDefault())})})})});ib.displayName=Li;var ab="MenuSubContent",lb=p.forwardRef((e,t)=>{const r=Ww(vn,e.__scopeMenu),{forceMount:o=r.forceMount,...i}=e,c=Us(vn,e.__scopeMenu),u=ua(vn,e.__scopeMenu),d=ob(ab,e.__scopeMenu),h=p.useRef(null),g=_e(t,h);return a.jsx(Yi.Provider,{scope:e.__scopeMenu,children:a.jsx(bt,{present:o||c.open,children:a.jsx(Yi.Slot,{scope:e.__scopeMenu,children:a.jsx(rh,{id:d.contentId,"aria-labelledby":d.triggerId,...i,ref:g,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{u.isUsingKeyboardRef.current&&h.current?.focus(),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:le(e.onFocusOutside,x=>{x.target!==d.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:le(e.onEscapeKeyDown,x=>{u.onClose(),x.preventDefault()}),onKeyDown:le(e.onKeyDown,x=>{const v=x.currentTarget.contains(x.target),w=BM[u.dir].includes(x.key);v&&w&&(c.onOpenChange(!1),d.trigger?.focus(),x.preventDefault())})})})})})});lb.displayName=ab;function cb(e){return e?"open":"closed"}function lc(e){return e==="indeterminate"}function ih(e){return lc(e)?"indeterminate":e?"checked":"unchecked"}function a3(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function l3(e,t){return e.map((r,o)=>e[(t+o)%e.length])}function c3(e,t,r){const i=t.length>1&&Array.from(t).every(g=>g===t[0])?t[0]:t,c=r?e.indexOf(r):-1;let u=l3(e,Math.max(c,0));i.length===1&&(u=u.filter(g=>g!==r));const h=u.find(g=>g.toLowerCase().startsWith(i.toLowerCase()));return h!==r?h:void 0}function u3(e,t){const{x:r,y:o}=e;let i=!1;for(let c=0,u=t.length-1;c<t.length;u=c++){const d=t[c],h=t[u],g=d.x,x=d.y,v=h.x,w=h.y;x>o!=w>o&&r<(v-g)*(o-x)/(w-x)+g&&(i=!i)}return i}function d3(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return u3(r,t)}function Xi(e){return t=>t.pointerType==="mouse"?e(t):void 0}var f3=Hw,p3=eh,h3=Kw,m3=qw,g3=sh,x3=Qw,v3=Zc,y3=Yw,w3=Zw,b3=eb,S3=nb,k3=rb,C3=sb,N3=ib,j3=lb,Jc="DropdownMenu",[E3]=Qt(Jc,[Vw]),Ft=Vw(),[R3,ub]=E3(Jc),db=e=>{const{__scopeDropdownMenu:t,children:r,dir:o,open:i,defaultOpen:c,onOpenChange:u,modal:d=!0}=e,h=Ft(t),g=p.useRef(null),[x,v]=Fn({prop:i,defaultProp:c??!1,onChange:u,caller:Jc});return a.jsx(R3,{scope:t,triggerId:xn(),triggerRef:g,contentId:xn(),open:x,onOpenChange:v,onOpenToggle:p.useCallback(()=>v(w=>!w),[v]),modal:d,children:a.jsx(f3,{...h,open:x,onOpenChange:v,dir:o,modal:d,children:r})})};db.displayName=Jc;var fb="DropdownMenuTrigger",pb=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:o=!1,...i}=e,c=ub(fb,r),u=Ft(r);return a.jsx(p3,{asChild:!0,...u,children:a.jsx(Ne.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...i,ref:nr(t,c.triggerRef),onPointerDown:le(e.onPointerDown,d=>{!o&&d.button===0&&d.ctrlKey===!1&&(c.onOpenToggle(),c.open||d.preventDefault())}),onKeyDown:le(e.onKeyDown,d=>{o||(["Enter"," "].includes(d.key)&&c.onOpenToggle(),d.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});pb.displayName=fb;var T3="DropdownMenuPortal",hb=e=>{const{__scopeDropdownMenu:t,...r}=e,o=Ft(t);return a.jsx(h3,{...o,...r})};hb.displayName=T3;var mb="DropdownMenuContent",gb=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=ub(mb,r),c=Ft(r),u=p.useRef(!1);return a.jsx(m3,{id:i.contentId,"aria-labelledby":i.triggerId,...c,...o,ref:t,onCloseAutoFocus:le(e.onCloseAutoFocus,d=>{u.current||i.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:le(e.onInteractOutside,d=>{const h=d.detail.originalEvent,g=h.button===0&&h.ctrlKey===!0,x=h.button===2||g;(!i.modal||x)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gb.displayName=mb;var P3="DropdownMenuGroup",M3=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(g3,{...i,...o,ref:t})});M3.displayName=P3;var D3="DropdownMenuLabel",xb=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(x3,{...i,...o,ref:t})});xb.displayName=D3;var _3="DropdownMenuItem",vb=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(v3,{...i,...o,ref:t})});vb.displayName=_3;var A3="DropdownMenuCheckboxItem",yb=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(y3,{...i,...o,ref:t})});yb.displayName=A3;var I3="DropdownMenuRadioGroup",O3=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(w3,{...i,...o,ref:t})});O3.displayName=I3;var L3="DropdownMenuRadioItem",wb=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(b3,{...i,...o,ref:t})});wb.displayName=L3;var F3="DropdownMenuItemIndicator",bb=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(S3,{...i,...o,ref:t})});bb.displayName=F3;var $3="DropdownMenuSeparator",Sb=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(k3,{...i,...o,ref:t})});Sb.displayName=$3;var z3="DropdownMenuArrow",B3=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(C3,{...i,...o,ref:t})});B3.displayName=z3;var V3="DropdownMenuSubTrigger",kb=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(N3,{...i,...o,ref:t})});kb.displayName=V3;var U3="DropdownMenuSubContent",Cb=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...o}=e,i=Ft(r);return a.jsx(j3,{...i,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Cb.displayName=U3;var H3=db,W3=pb,K3=hb,Nb=gb,jb=xb,Eb=vb,Rb=yb,Tb=wb,Pb=bb,Mb=Sb,Db=kb,_b=Cb;const eu=H3,tu=W3,q3=p.forwardRef(({className:e,inset:t,children:r,...o},i)=>a.jsxs(Db,{ref:i,className:ve("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...o,children:[r,a.jsx(On,{className:"ml-auto"})]}));q3.displayName=Db.displayName;const Q3=p.forwardRef(({className:e,...t},r)=>a.jsx(_b,{ref:r,className:ve("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));Q3.displayName=_b.displayName;const da=p.forwardRef(({className:e,sideOffset:t=4,...r},o)=>a.jsx(K3,{children:a.jsx(Nb,{ref:o,sideOffset:t,className:ve("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...r})}));da.displayName=Nb.displayName;const Ln=p.forwardRef(({className:e,inset:t,...r},o)=>a.jsx(Eb,{ref:o,className:ve("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r}));Ln.displayName=Eb.displayName;const G3=p.forwardRef(({className:e,children:t,checked:r,...o},i)=>a.jsxs(Rb,{ref:i,className:ve("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...o,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Pb,{children:a.jsx(xr,{className:"h-4 w-4"})})}),t]}));G3.displayName=Rb.displayName;const Y3=p.forwardRef(({className:e,children:t,...r},o)=>a.jsxs(Tb,{ref:o,className:ve("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Pb,{children:a.jsx(zy,{className:"h-2 w-2 fill-current"})})}),t]}));Y3.displayName=Tb.displayName;const X3=p.forwardRef(({className:e,inset:t,...r},o)=>a.jsx(jb,{ref:o,className:ve("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));X3.displayName=jb.displayName;const fa=p.forwardRef(({className:e,...t},r)=>a.jsx(Mb,{ref:r,className:ve("-mx-1 my-1 h-px bg-muted",e),...t}));fa.displayName=Mb.displayName;const Vi=lw,Z3=cw,Ab=p.forwardRef(({className:e,...t},r)=>a.jsx(Uc,{ref:r,className:ve("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Ab.displayName=Uc.displayName;const No=p.forwardRef(({className:e,children:t,...r},o)=>a.jsxs(Z3,{children:[a.jsx(Ab,{}),a.jsxs(Hc,{ref:o,className:ve("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,a.jsxs(uw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(er,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));No.displayName=Hc.displayName;const jo=({className:e,...t})=>a.jsx("div",{className:ve("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});jo.displayName="DialogHeader";const ql=({className:e,...t})=>a.jsx("div",{className:ve("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ql.displayName="DialogFooter";const Eo=p.forwardRef(({className:e,...t},r)=>a.jsx(Wc,{ref:r,className:ve("text-lg font-semibold leading-none tracking-tight",e),...t}));Eo.displayName=Wc.displayName;const Ib=p.forwardRef(({className:e,...t},r)=>a.jsx(Kc,{ref:r,className:ve("text-sm text-muted-foreground",e),...t}));Ib.displayName=Kc.displayName;const Ob=p.createContext({theme:"system",setTheme:()=>{},resolved:"dark"});function J3({children:e}){const[t,r]=p.useState("dark"),o=t==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t;return p.useEffect(()=>{document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(o)},[o]),a.jsx(Ob.Provider,{value:{theme:t,setTheme:r,resolved:o},children:e})}const eD=()=>p.useContext(Ob),tD=[{title:"Chat",href:"/chat",icon:kr},{title:"Notes",href:"/notes",icon:tn},{title:"Tasks",href:"/tasks",icon:ts},{title:"Files",href:"/files",icon:Rc},{title:"Search",href:"/search",icon:Rs},{title:"Settings",href:"/settings",icon:Wy}];function nD(e){const t=new Date(e),r=new Date,o=r.getTime()-t.getTime(),i=o/(1e3*60*60),c=o/(1e3*60*60*24);return i<1?{key:"just-now",label:"Just now",order:0}:i<24&&t.getDate()===r.getDate()?{key:"today",label:"Today",order:1}:c<2?{key:"yesterday",label:"Yesterday",order:2}:c<7?{key:"this-week",label:"This week",order:3}:c<30?{key:"this-month",label:"This month",order:4}:{key:"older",label:"Older",order:5}}function rD({sessions:e,location:t}){const[r,o]=p.useState(new Set(["older"])),i=p.useMemo(()=>{const u={};for(const d of e.slice(0,50)){const h=nD(d.createdAt);u[h.key]||(u[h.key]={label:h.label,order:h.order,sessions:[]}),u[h.key].sessions.push(d)}return Object.entries(u).sort(([,d],[,h])=>d.order-h.order)},[e]),c=u=>{o(d=>{const h=new Set(d);return h.has(u)?h.delete(u):h.add(u),h})};return a.jsx(Is,{className:"max-h-[400px]",children:i.map(([u,d])=>{const h=r.has(u);return a.jsxs(hw,{children:[a.jsxs("button",{onClick:()=>c(u),className:"flex items-center gap-1 px-3 py-1.5 w-full text-left group hover:bg-muted/30 rounded transition-colors",children:[h?a.jsx(On,{className:"w-2.5 h-2.5 text-muted-foreground/40 transition-transform"}):a.jsx(vr,{className:"w-2.5 h-2.5 text-muted-foreground/40 transition-transform"}),a.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/50 font-medium",children:d.label}),a.jsx("span",{className:"text-[9px] text-muted-foreground/25 ml-auto tabular-nums",children:d.sessions.length})]}),!h&&a.jsx(mw,{children:a.jsx(gw,{children:d.sessions.map(g=>a.jsx(xw,{children:a.jsx(vw,{asChild:!0,isActive:t===`/chat/${g.id}`,className:"text-xs",children:a.jsxs(Yv,{href:`/chat/${g.id}`,children:[a.jsx(kr,{className:"w-3 h-3 shrink-0"}),a.jsx("span",{className:"truncate",children:g.title})]})})},g.id))})})]},u)})})}function sD(){const[e,t]=Oo(),{resolved:r,setTheme:o}=eD(),{state:i}=qc(),c=i==="collapsed";rn();const{vaults:u,activeVault:d,setActiveVaultId:h,vaultParam:g,refetchVaults:x}=yn(),[v,w]=p.useState(!1),[S,C]=p.useState(!1),[b,k]=p.useState(!1),[N,E]=p.useState(""),[R,T]=p.useState(null),{data:M}=it({queryKey:["/api/chat/sessions",d?.id],queryFn:()=>je("GET",Oe("/api/chat/sessions",g)).then(_=>_.json()),refetchInterval:5e3,enabled:!!d}),F=async()=>{try{const ee=await(await je("POST",Oe("/api/chat/sessions",g),{title:"New Chat"})).json();t(`/chat/${ee.id}`)}catch{}},I=async()=>{if(N.trim())try{const ee=await(await je("POST","/api/vaults",{name:N.trim(),icon:N.trim().charAt(0).toUpperCase(),color:"#64748b"})).json();x(),h(ee.id),w(!1),E(""),t("/chat")}catch{}},O=async()=>{if(!(!R||!N.trim()))try{await je("PATCH",`/api/vaults/${R.id}`,{name:N.trim(),icon:N.trim().charAt(0).toUpperCase(),color:"#64748b"}),x(),C(!1),T(null)}catch{}},q=async()=>{if(R)try{await je("DELETE",`/api/vaults/${R.id}`),x(),k(!1),T(null)}catch{}},U=_=>{T(_),E(_.name),C(!0)},G=_=>{T(_),k(!0)};return a.jsxs(a.Fragment,{children:[a.jsxs(tM,{collapsible:"icon",className:"border-r border-border/50",children:[a.jsx(nM,{className:"p-3 pb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg overflow-hidden",children:a.jsx("img",{src:sc,alt:"Cortex",className:"w-7 h-7"})}),!c&&a.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Cortex"})]})}),a.jsxs(sM,{children:[!c&&d&&a.jsx("div",{className:"px-3 mb-2",children:a.jsxs(eu,{children:[a.jsx(tu,{asChild:!0,children:a.jsxs("button",{className:"w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-border/50 hover:bg-muted/50 transition-colors text-left","data-testid":"button-vault-switcher",children:[a.jsx("span",{className:"w-5 h-5 rounded bg-muted/60 flex items-center justify-center text-[10px] font-semibold text-muted-foreground uppercase leading-none",children:d.name?.charAt(0)||"V"}),a.jsx("span",{className:"text-xs font-medium flex-1 truncate",children:d.name}),a.jsx(vr,{className:"w-3 h-3 text-muted-foreground shrink-0"})]})}),a.jsxs(da,{align:"start",className:"w-56",children:[u.map(_=>a.jsxs(Ln,{className:"flex items-center gap-2 justify-between group",onClick:()=>{h(_.id),t("/chat")},"data-testid":`vault-item-${_.slug}`,children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a.jsx("span",{className:"w-5 h-5 rounded bg-muted/60 flex items-center justify-center text-[10px] font-semibold text-muted-foreground uppercase leading-none shrink-0",children:_.name?.charAt(0)||"V"}),a.jsx("span",{className:"text-xs truncate",children:_.name}),_.id===d.id&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary shrink-0"})]}),a.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.jsx("button",{onClick:ee=>{ee.stopPropagation(),U(_)},className:"p-0.5 rounded hover:bg-muted","data-testid":`button-rename-vault-${_.slug}`,children:a.jsx(U2,{className:"w-3 h-3 text-muted-foreground"})}),u.length>1&&a.jsx("button",{onClick:ee=>{ee.stopPropagation(),G(_)},className:"p-0.5 rounded hover:bg-destructive/10","data-testid":`button-delete-vault-${_.slug}`,children:a.jsx(is,{className:"w-3 h-3 text-muted-foreground"})})]})]},_.id)),a.jsx(fa,{}),a.jsxs(Ln,{onClick:()=>{E(""),w(!0)},className:"flex items-center gap-2","data-testid":"button-create-vault",children:[a.jsx(yr,{className:"w-3.5 h-3.5"}),a.jsx("span",{className:"text-xs",children:"New Vault"})]})]})]})}),c&&d&&a.jsx("div",{className:"flex justify-center mb-2",children:a.jsx("button",{className:"w-8 h-8 rounded-lg border border-border/50 flex items-center justify-center hover:bg-muted/50 transition-colors text-base",title:d.name,"data-testid":"button-vault-switcher-collapsed",children:a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase",children:d.name?.charAt(0)||"V"})})}),a.jsx("div",{className:"px-3 mb-1",children:a.jsxs(pe,{variant:"outline",size:c?"icon":"sm",className:"w-full justify-start gap-2 text-xs",onClick:F,"data-testid":"button-new-chat",children:[a.jsx(yr,{className:"w-3.5 h-3.5"}),!c&&"New Chat"]})}),a.jsxs(hw,{children:[!c&&a.jsx(oM,{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 px-3",children:"Navigate"}),a.jsx(mw,{children:a.jsx(gw,{children:tD.map(_=>{const ee=e===_.href||e.startsWith(_.href+"/")||_.href==="/chat"&&e==="/";return a.jsx(xw,{children:a.jsx(vw,{asChild:!0,isActive:ee,tooltip:_.title,children:a.jsxs(Yv,{href:_.href,"data-testid":`nav-${_.title.toLowerCase()}`,children:[a.jsx(_.icon,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm",children:_.title})]})})},_.title)})})})]}),!c&&M&&M.length>0&&a.jsx(rD,{sessions:M,location:e})]}),a.jsx(rM,{className:"p-3 pt-0",children:a.jsx(pe,{variant:"ghost",size:"icon",className:"w-8 h-8",onClick:()=>o(r==="dark"?"light":"dark"),"data-testid":"button-theme-toggle",children:r==="dark"?a.jsx(J2,{className:"w-3.5 h-3.5"}):a.jsx(B2,{className:"w-3.5 h-3.5"})})})]}),a.jsx(Vi,{open:v,onOpenChange:w,children:a.jsxs(No,{className:"sm:max-w-[400px]",children:[a.jsx(jo,{children:a.jsx(Eo,{className:"text-base",children:"Create Vault"})}),a.jsx("div",{className:"space-y-4 py-2",children:a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-muted-foreground mb-1.5 block",children:"Name"}),a.jsx(Ge,{value:N,onChange:_=>E(_.target.value),placeholder:"e.g. Work, Personal, Research...",className:"text-sm","data-testid":"input-vault-name",autoFocus:!0,onKeyDown:_=>{_.key==="Enter"&&I()}})]})}),a.jsxs(ql,{children:[a.jsx(pe,{variant:"outline",size:"sm",onClick:()=>w(!1),children:"Cancel"}),a.jsx(pe,{size:"sm",onClick:I,disabled:!N.trim(),"data-testid":"button-confirm-create-vault",children:"Create"})]})]})}),a.jsx(Vi,{open:S,onOpenChange:C,children:a.jsxs(No,{className:"sm:max-w-[400px]",children:[a.jsx(jo,{children:a.jsx(Eo,{className:"text-base",children:"Rename Vault"})}),a.jsx("div",{className:"space-y-4 py-2",children:a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-muted-foreground mb-1.5 block",children:"Name"}),a.jsx(Ge,{value:N,onChange:_=>E(_.target.value),className:"text-sm","data-testid":"input-rename-vault",autoFocus:!0,onKeyDown:_=>{_.key==="Enter"&&O()}})]})}),a.jsxs(ql,{children:[a.jsx(pe,{variant:"outline",size:"sm",onClick:()=>C(!1),children:"Cancel"}),a.jsx(pe,{size:"sm",onClick:O,disabled:!N.trim(),"data-testid":"button-confirm-rename-vault",children:"Save"})]})]})}),a.jsx(Vi,{open:b,onOpenChange:k,children:a.jsxs(No,{className:"sm:max-w-[360px]",children:[a.jsx(jo,{children:a.jsx(Eo,{className:"text-base",children:"Delete Vault"})}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Are you sure you want to remove ",a.jsx("span",{className:"font-medium text-foreground",children:R?.name}),"? The data folder will be kept on disk for safety."]}),a.jsxs(ql,{children:[a.jsx(pe,{variant:"outline",size:"sm",onClick:()=>k(!1),children:"Cancel"}),a.jsx(pe,{variant:"destructive",size:"sm",onClick:q,"data-testid":"button-confirm-delete-vault",children:"Delete"})]})]})})]})}const pa=p.forwardRef(({className:e,...t},r)=>a.jsx("textarea",{className:ve("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));pa.displayName="Textarea";const oD=$o("whitespace-nowrap inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 hover-elevate ",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-xs",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-xs",outline:" border [border-color:var(--badge-outline)] shadow-xs"}},defaultVariants:{variant:"default"}});function et({className:e,variant:t,...r}){return a.jsx("div",{className:ve(oD({variant:t}),e),...r})}function ah(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Hs=ah();function Lb(e){Hs=e}var Ns={exec:()=>null};function Be(e,t=""){let r=typeof e=="string"?e:e.source,o={replace:(i,c)=>{let u=typeof c=="string"?c:c.source;return u=u.replace(Lt.caret,"$1"),r=r.replace(i,u),o},getRegex:()=>new RegExp(r,t)};return o}var iD=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Lt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},aD=/^(?:[ \t]*(?:\n|$))+/,lD=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,cD=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ha=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,uD=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,lh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Fb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$b=Be(Fb).replace(/bull/g,lh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),dD=Be(Fb).replace(/bull/g,lh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ch=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,fD=/^[^\n]+/,uh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,pD=Be(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",uh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),hD=Be(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,lh).getRegex(),nu="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",dh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,mD=Be("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",dh).replace("tag",nu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),zb=Be(ch).replace("hr",ha).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",nu).getRegex(),gD=Be(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",zb).getRegex(),fh={blockquote:gD,code:lD,def:pD,fences:cD,heading:uD,hr:ha,html:mD,lheading:$b,list:hD,newline:aD,paragraph:zb,table:Ns,text:fD},vv=Be("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ha).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",nu).getRegex(),xD={...fh,lheading:dD,table:vv,paragraph:Be(ch).replace("hr",ha).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vv).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",nu).getRegex()},vD={...fh,html:Be(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",dh).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ns,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Be(ch).replace("hr",ha).replace("heading",` *#{1,6} *[^
53
+ ]`).replace("lheading",$b).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},yD=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wD=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Bb=/^( {2,}|\\)\n(?!\s*$)/,bD=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ru=/[\p{P}\p{S}]/u,ph=/[\s\p{P}\p{S}]/u,Vb=/[^\s\p{P}\p{S}]/u,SD=Be(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ph).getRegex(),Ub=/(?!~)[\p{P}\p{S}]/u,kD=/(?!~)[\s\p{P}\p{S}]/u,CD=/(?:[^\s\p{P}\p{S}]|~)/u,Hb=/(?![*_])[\p{P}\p{S}]/u,ND=/(?![*_])[\s\p{P}\p{S}]/u,jD=/(?:[^\s\p{P}\p{S}]|[*_])/u,ED=Be(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",iD?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Wb=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,RD=Be(Wb,"u").replace(/punct/g,ru).getRegex(),TD=Be(Wb,"u").replace(/punct/g,Ub).getRegex(),Kb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",PD=Be(Kb,"gu").replace(/notPunctSpace/g,Vb).replace(/punctSpace/g,ph).replace(/punct/g,ru).getRegex(),MD=Be(Kb,"gu").replace(/notPunctSpace/g,CD).replace(/punctSpace/g,kD).replace(/punct/g,Ub).getRegex(),DD=Be("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Vb).replace(/punctSpace/g,ph).replace(/punct/g,ru).getRegex(),_D=Be(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Hb).getRegex(),AD="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ID=Be(AD,"gu").replace(/notPunctSpace/g,jD).replace(/punctSpace/g,ND).replace(/punct/g,Hb).getRegex(),OD=Be(/\\(punct)/,"gu").replace(/punct/g,ru).getRegex(),LD=Be(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),FD=Be(dh).replace("(?:-->|$)","-->").getRegex(),$D=Be("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",FD).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),cc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,zD=Be(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",cc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qb=Be(/^!?\[(label)\]\[(ref)\]/).replace("label",cc).replace("ref",uh).getRegex(),Qb=Be(/^!?\[(ref)\](?:\[\])?/).replace("ref",uh).getRegex(),BD=Be("reflink|nolink(?!\\()","g").replace("reflink",qb).replace("nolink",Qb).getRegex(),yv=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,hh={_backpedal:Ns,anyPunctuation:OD,autolink:LD,blockSkip:ED,br:Bb,code:wD,del:Ns,delLDelim:Ns,delRDelim:Ns,emStrongLDelim:RD,emStrongRDelimAst:PD,emStrongRDelimUnd:DD,escape:yD,link:zD,nolink:Qb,punctuation:SD,reflink:qb,reflinkSearch:BD,tag:$D,text:bD,url:Ns},VD={...hh,link:Be(/^!?\[(label)\]\((.*?)\)/).replace("label",cc).getRegex(),reflink:Be(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",cc).getRegex()},Jf={...hh,emStrongRDelimAst:MD,emStrongLDelim:TD,delLDelim:_D,delRDelim:ID,url:Be(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",yv).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Be(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",yv).getRegex()},UD={...Jf,br:Be(Bb).replace("{2,}","*").getRegex(),text:Be(Jf.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Fl={normal:fh,gfm:xD,pedantic:vD},Ai={normal:hh,gfm:Jf,breaks:UD,pedantic:VD},HD={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},wv=e=>HD[e];function Xn(e,t){if(t){if(Lt.escapeTest.test(e))return e.replace(Lt.escapeReplace,wv)}else if(Lt.escapeTestNoEncode.test(e))return e.replace(Lt.escapeReplaceNoEncode,wv);return e}function bv(e){try{e=encodeURI(e).replace(Lt.percentDecode,"%")}catch{return null}return e}function Sv(e,t){let r=e.replace(Lt.findPipe,(c,u,d)=>{let h=!1,g=u;for(;--g>=0&&d[g]==="\\";)h=!h;return h?"|":" |"}),o=r.split(Lt.splitPipe),i=0;if(o[0].trim()||o.shift(),o.length>0&&!o.at(-1)?.trim()&&o.pop(),t)if(o.length>t)o.splice(t);else for(;o.length<t;)o.push("");for(;i<o.length;i++)o[i]=o[i].trim().replace(Lt.slashPipe,"|");return o}function Ii(e,t,r){let o=e.length;if(o===0)return"";let i=0;for(;i<o&&e.charAt(o-i-1)===t;)i++;return e.slice(0,o-i)}function WD(e,t){if(e.indexOf(t[1])===-1)return-1;let r=0;for(let o=0;o<e.length;o++)if(e[o]==="\\")o++;else if(e[o]===t[0])r++;else if(e[o]===t[1]&&(r--,r<0))return o;return r>0?-2:-1}function KD(e,t=0){let r=t,o="";for(let i of e)if(i===" "){let c=4-r%4;o+=" ".repeat(c),r+=c}else o+=i,r++;return o}function kv(e,t,r,o,i){let c=t.href,u=t.title||null,d=e[1].replace(i.other.outputLinkReplace,"$1");o.state.inLink=!0;let h={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:c,title:u,text:d,tokens:o.inlineTokens(d)};return o.state.inLink=!1,h}function qD(e,t,r){let o=e.match(r.other.indentCodeCompensation);if(o===null)return t;let i=o[1];return t.split(`
54
+ `).map(c=>{let u=c.match(r.other.beginningSpace);if(u===null)return c;let[d]=u;return d.length>=i.length?c.slice(i.length):c}).join(`
55
+ `)}var uc=class{options;rules;lexer;constructor(e){this.options=e||Hs}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Ii(r,`
56
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],o=qD(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:o}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let o=Ii(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Ii(t[0],`
57
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=Ii(t[0],`
58
+ `).split(`
59
+ `),o="",i="",c=[];for(;r.length>0;){let u=!1,d=[],h;for(h=0;h<r.length;h++)if(this.rules.other.blockquoteStart.test(r[h]))d.push(r[h]),u=!0;else if(!u)d.push(r[h]);else break;r=r.slice(h);let g=d.join(`
60
+ `),x=g.replace(this.rules.other.blockquoteSetextReplace,`
61
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");o=o?`${o}
62
+ ${g}`:g,i=i?`${i}
63
+ ${x}`:x;let v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(x,c,!0),this.lexer.state.top=v,r.length===0)break;let w=c.at(-1);if(w?.type==="code")break;if(w?.type==="blockquote"){let S=w,C=S.raw+`
64
+ `+r.join(`
65
+ `),b=this.blockquote(C);c[c.length-1]=b,o=o.substring(0,o.length-S.raw.length)+b.raw,i=i.substring(0,i.length-S.text.length)+b.text;break}else if(w?.type==="list"){let S=w,C=S.raw+`
66
+ `+r.join(`
67
+ `),b=this.list(C);c[c.length-1]=b,o=o.substring(0,o.length-w.raw.length)+b.raw,i=i.substring(0,i.length-S.raw.length)+b.raw,r=C.substring(c.at(-1).raw.length).split(`
68
+ `);continue}}return{type:"blockquote",raw:o,tokens:c,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim(),o=r.length>1,i={type:"list",raw:"",ordered:o,start:o?+r.slice(0,-1):"",loose:!1,items:[]};r=o?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=o?r:"[*+-]");let c=this.rules.other.listItemRegex(r),u=!1;for(;e;){let h=!1,g="",x="";if(!(t=c.exec(e))||this.rules.block.hr.test(e))break;g=t[0],e=e.substring(g.length);let v=KD(t[2].split(`
69
+ `,1)[0],t[1].length),w=e.split(`
70
+ `,1)[0],S=!v.trim(),C=0;if(this.options.pedantic?(C=2,x=v.trimStart()):S?C=t[1].length+1:(C=v.search(this.rules.other.nonSpaceChar),C=C>4?1:C,x=v.slice(C),C+=t[1].length),S&&this.rules.other.blankLine.test(w)&&(g+=w+`
71
+ `,e=e.substring(w.length+1),h=!0),!h){let b=this.rules.other.nextBulletRegex(C),k=this.rules.other.hrRegex(C),N=this.rules.other.fencesBeginRegex(C),E=this.rules.other.headingBeginRegex(C),R=this.rules.other.htmlBeginRegex(C),T=this.rules.other.blockquoteBeginRegex(C);for(;e;){let M=e.split(`
72
+ `,1)[0],F;if(w=M,this.options.pedantic?(w=w.replace(this.rules.other.listReplaceNesting," "),F=w):F=w.replace(this.rules.other.tabCharGlobal," "),N.test(w)||E.test(w)||R.test(w)||T.test(w)||b.test(w)||k.test(w))break;if(F.search(this.rules.other.nonSpaceChar)>=C||!w.trim())x+=`
73
+ `+F.slice(C);else{if(S||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||N.test(v)||E.test(v)||k.test(v))break;x+=`
74
+ `+w}S=!w.trim(),g+=M+`
75
+ `,e=e.substring(M.length+1),v=F.slice(C)}}i.loose||(u?i.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(u=!0)),i.items.push({type:"list_item",raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(x),loose:!1,text:x,tokens:[]}),i.raw+=g}let d=i.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let h of i.items){if(this.lexer.state.top=!1,h.tokens=this.lexer.blockTokens(h.text,[]),h.task){if(h.text=h.text.replace(this.rules.other.listReplaceTask,""),h.tokens[0]?.type==="text"||h.tokens[0]?.type==="paragraph"){h.tokens[0].raw=h.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),h.tokens[0].text=h.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let x=this.lexer.inlineQueue.length-1;x>=0;x--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[x].src)){this.lexer.inlineQueue[x].src=this.lexer.inlineQueue[x].src.replace(this.rules.other.listReplaceTask,"");break}}let g=this.rules.other.listTaskCheckbox.exec(h.raw);if(g){let x={type:"checkbox",raw:g[0]+" ",checked:g[0]!=="[ ]"};h.checked=x.checked,i.loose?h.tokens[0]&&["paragraph","text"].includes(h.tokens[0].type)&&"tokens"in h.tokens[0]&&h.tokens[0].tokens?(h.tokens[0].raw=x.raw+h.tokens[0].raw,h.tokens[0].text=x.raw+h.tokens[0].text,h.tokens[0].tokens.unshift(x)):h.tokens.unshift({type:"paragraph",raw:x.raw,text:x.raw,tokens:[x]}):h.tokens.unshift(x)}}if(!i.loose){let g=h.tokens.filter(v=>v.type==="space"),x=g.length>0&&g.some(v=>this.rules.other.anyLine.test(v.raw));i.loose=x}}if(i.loose)for(let h of i.items){h.loose=!0;for(let g of h.tokens)g.type==="text"&&(g.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:o,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=Sv(t[1]),o=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
76
+ `):[],c={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===o.length){for(let u of o)this.rules.other.tableAlignRight.test(u)?c.align.push("right"):this.rules.other.tableAlignCenter.test(u)?c.align.push("center"):this.rules.other.tableAlignLeft.test(u)?c.align.push("left"):c.align.push(null);for(let u=0;u<r.length;u++)c.header.push({text:r[u],tokens:this.lexer.inline(r[u]),header:!0,align:c.align[u]});for(let u of i)c.rows.push(Sv(u,c.header.length).map((d,h)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:c.align[h]})));return c}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===`
77
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let c=Ii(r.slice(0,-1),"\\");if((r.length-c.length)%2===0)return}else{let c=WD(t[2],"()");if(c===-2)return;if(c>-1){let u=(t[0].indexOf("!")===0?5:4)+t[1].length+c;t[2]=t[2].substring(0,c),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let o=t[2],i="";if(this.options.pedantic){let c=this.rules.other.pedanticHrefTitle.exec(o);c&&(o=c[1],i=c[3])}else i=t[3]?t[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?o=o.slice(1):o=o.slice(1,-1)),kv(t,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[o.toLowerCase()];if(!i){let c=r[0].charAt(0);return{type:"text",raw:c,text:c}}return kv(r,i,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let o=this.rules.inline.emStrongLDelim.exec(e);if(!(!o||o[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(o[1]||o[2])||!r||this.rules.inline.punctuation.exec(r))){let i=[...o[0]].length-1,c,u,d=i,h=0,g=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+i);(o=g.exec(t))!=null;){if(c=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!c)continue;if(u=[...c].length,o[3]||o[4]){d+=u;continue}else if((o[5]||o[6])&&i%3&&!((i+u)%3)){h+=u;continue}if(d-=u,d>0)continue;u=Math.min(u,u+d+h);let x=[...o[0]][0].length,v=e.slice(0,i+o.index+x+u);if(Math.min(i,u)%2){let S=v.slice(1,-1);return{type:"em",raw:v,text:S,tokens:this.lexer.inlineTokens(S)}}let w=v.slice(2,-2);return{type:"strong",raw:v,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),o=this.rules.other.nonSpaceChar.test(r),i=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return o&&i&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,r=""){let o=this.rules.inline.delLDelim.exec(e);if(o&&(!o[1]||!r||this.rules.inline.punctuation.exec(r))){let i=[...o[0]].length-1,c,u,d=i,h=this.rules.inline.delRDelim;for(h.lastIndex=0,t=t.slice(-1*e.length+i);(o=h.exec(t))!=null;){if(c=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!c||(u=[...c].length,u!==i))continue;if(o[3]||o[4]){d+=u;continue}if(d-=u,d>0)continue;u=Math.min(u,u+d);let g=[...o[0]][0].length,x=e.slice(0,i+o.index+g+u),v=x.slice(i,-i);return{type:"del",raw:x,text:v,tokens:this.lexer.inlineTokens(v)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,o;return t[2]==="@"?(r=t[1],o="mailto:"+r):(r=t[1],o=r),{type:"link",raw:t[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,o;if(t[2]==="@")r=t[0],o="mailto:"+r;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);r=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},_n=class ep{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Hs,this.options.tokenizer=this.options.tokenizer||new uc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:Lt,block:Fl.normal,inline:Ai.normal};this.options.pedantic?(r.block=Fl.pedantic,r.inline=Ai.pedantic):this.options.gfm&&(r.block=Fl.gfm,this.options.breaks?r.inline=Ai.breaks:r.inline=Ai.gfm),this.tokenizer.rules=r}static get rules(){return{block:Fl,inline:Ai}}static lex(t,r){return new ep(r).lex(t)}static lexInline(t,r){return new ep(r).inlineTokens(t)}lex(t){t=t.replace(Lt.carriageReturn,`
78
+ `),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let o=this.inlineQueue[r];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[],o=!1){for(this.options.pedantic&&(t=t.replace(Lt.tabCharGlobal," ").replace(Lt.spaceLine,""));t;){let i;if(this.options.extensions?.block?.some(u=>(i=u.call({lexer:this},t,r))?(t=t.substring(i.raw.length),r.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let u=r.at(-1);i.raw.length===1&&u!==void 0?u.raw+=`
79
+ `:r.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let u=r.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
80
+ `)?"":`
81
+ `)+i.raw,u.text+=`
82
+ `+i.text,this.inlineQueue.at(-1).src=u.text):r.push(i);continue}if(i=this.tokenizer.fences(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.heading(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.hr(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.blockquote(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.list(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.html(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.def(t)){t=t.substring(i.raw.length);let u=r.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
83
+ `)?"":`
84
+ `)+i.raw,u.text+=`
85
+ `+i.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},r.push(i));continue}if(i=this.tokenizer.table(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.lheading(t)){t=t.substring(i.raw.length),r.push(i);continue}let c=t;if(this.options.extensions?.startBlock){let u=1/0,d=t.slice(1),h;this.options.extensions.startBlock.forEach(g=>{h=g.call({lexer:this},d),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=t.substring(0,u+1))}if(this.state.top&&(i=this.tokenizer.paragraph(c))){let u=r.at(-1);o&&u?.type==="paragraph"?(u.raw+=(u.raw.endsWith(`
86
+ `)?"":`
87
+ `)+i.raw,u.text+=`
88
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):r.push(i),o=c.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let u=r.at(-1);u?.type==="text"?(u.raw+=(u.raw.endsWith(`
89
+ `)?"":`
90
+ `)+i.raw,u.text+=`
91
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):r.push(i);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let o=t,i=null;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)h.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,i.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let c;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)c=i[2]?i[2].length:0,o=o.slice(0,i.index+c)+"["+"a".repeat(i[0].length-c-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);o=this.options.hooks?.emStrongMask?.call({lexer:this},o)??o;let u=!1,d="";for(;t;){u||(d=""),u=!1;let h;if(this.options.extensions?.inline?.some(x=>(h=x.call({lexer:this},t,r))?(t=t.substring(h.raw.length),r.push(h),!0):!1))continue;if(h=this.tokenizer.escape(t)){t=t.substring(h.raw.length),r.push(h);continue}if(h=this.tokenizer.tag(t)){t=t.substring(h.raw.length),r.push(h);continue}if(h=this.tokenizer.link(t)){t=t.substring(h.raw.length),r.push(h);continue}if(h=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(h.raw.length);let x=r.at(-1);h.type==="text"&&x?.type==="text"?(x.raw+=h.raw,x.text+=h.text):r.push(h);continue}if(h=this.tokenizer.emStrong(t,o,d)){t=t.substring(h.raw.length),r.push(h);continue}if(h=this.tokenizer.codespan(t)){t=t.substring(h.raw.length),r.push(h);continue}if(h=this.tokenizer.br(t)){t=t.substring(h.raw.length),r.push(h);continue}if(h=this.tokenizer.del(t,o,d)){t=t.substring(h.raw.length),r.push(h);continue}if(h=this.tokenizer.autolink(t)){t=t.substring(h.raw.length),r.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(t))){t=t.substring(h.raw.length),r.push(h);continue}let g=t;if(this.options.extensions?.startInline){let x=1/0,v=t.slice(1),w;this.options.extensions.startInline.forEach(S=>{w=S.call({lexer:this},v),typeof w=="number"&&w>=0&&(x=Math.min(x,w))}),x<1/0&&x>=0&&(g=t.substring(0,x+1))}if(h=this.tokenizer.inlineText(g)){t=t.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(d=h.raw.slice(-1)),u=!0;let x=r.at(-1);x?.type==="text"?(x.raw+=h.raw,x.text+=h.text):r.push(h);continue}if(t){let x="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return r}},dc=class{options;parser;constructor(e){this.options=e||Hs}space(e){return""}code({text:e,lang:t,escaped:r}){let o=(t||"").match(Lt.notSpaceStart)?.[0],i=e.replace(Lt.endingNewline,"")+`
92
+ `;return o?'<pre><code class="language-'+Xn(o)+'">'+(r?i:Xn(i,!0))+`</code></pre>
93
+ `:"<pre><code>"+(r?i:Xn(i,!0))+`</code></pre>
94
+ `}blockquote({tokens:e}){return`<blockquote>
95
+ ${this.parser.parse(e)}</blockquote>
96
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
97
+ `}hr(e){return`<hr>
98
+ `}list(e){let t=e.ordered,r=e.start,o="";for(let u=0;u<e.items.length;u++){let d=e.items[u];o+=this.listitem(d)}let i=t?"ol":"ul",c=t&&r!==1?' start="'+r+'"':"";return"<"+i+c+`>
99
+ `+o+"</"+i+`>
100
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
101
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
102
+ `}table(e){let t="",r="";for(let i=0;i<e.header.length;i++)r+=this.tablecell(e.header[i]);t+=this.tablerow({text:r});let o="";for(let i=0;i<e.rows.length;i++){let c=e.rows[i];r="";for(let u=0;u<c.length;u++)r+=this.tablecell(c[u]);o+=this.tablerow({text:r})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
103
+ <thead>
104
+ `+t+`</thead>
105
+ `+o+`</table>
106
+ `}tablerow({text:e}){return`<tr>
107
+ ${e}</tr>
108
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
109
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Xn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let o=this.parser.parseInline(r),i=bv(e);if(i===null)return o;e=i;let c='<a href="'+e+'"';return t&&(c+=' title="'+Xn(t)+'"'),c+=">"+o+"</a>",c}image({href:e,title:t,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));let i=bv(e);if(i===null)return Xn(r);e=i;let c=`<img src="${e}" alt="${Xn(r)}"`;return t&&(c+=` title="${Xn(t)}"`),c+=">",c}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Xn(e.text)}},mh=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},An=class tp{options;renderer;textRenderer;constructor(t){this.options=t||Hs,this.options.renderer=this.options.renderer||new dc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new mh}static parse(t,r){return new tp(r).parse(t)}static parseInline(t,r){return new tp(r).parseInline(t)}parse(t){let r="";for(let o=0;o<t.length;o++){let i=t[o];if(this.options.extensions?.renderers?.[i.type]){let u=i,d=this.options.extensions.renderers[u.type].call({parser:this},u);if(d!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(u.type)){r+=d||"";continue}}let c=i;switch(c.type){case"space":{r+=this.renderer.space(c);break}case"hr":{r+=this.renderer.hr(c);break}case"heading":{r+=this.renderer.heading(c);break}case"code":{r+=this.renderer.code(c);break}case"table":{r+=this.renderer.table(c);break}case"blockquote":{r+=this.renderer.blockquote(c);break}case"list":{r+=this.renderer.list(c);break}case"checkbox":{r+=this.renderer.checkbox(c);break}case"html":{r+=this.renderer.html(c);break}case"def":{r+=this.renderer.def(c);break}case"paragraph":{r+=this.renderer.paragraph(c);break}case"text":{r+=this.renderer.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}parseInline(t,r=this.renderer){let o="";for(let i=0;i<t.length;i++){let c=t[i];if(this.options.extensions?.renderers?.[c.type]){let d=this.options.extensions.renderers[c.type].call({parser:this},c);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(c.type)){o+=d||"";continue}}let u=c;switch(u.type){case"escape":{o+=r.text(u);break}case"html":{o+=r.html(u);break}case"link":{o+=r.link(u);break}case"image":{o+=r.image(u);break}case"checkbox":{o+=r.checkbox(u);break}case"strong":{o+=r.strong(u);break}case"em":{o+=r.em(u);break}case"codespan":{o+=r.codespan(u);break}case"br":{o+=r.br(u);break}case"del":{o+=r.del(u);break}case"text":{o+=r.text(u);break}default:{let d='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return o}},Fi=class{options;block;constructor(e){this.options=e||Hs}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?_n.lex:_n.lexInline}provideParser(){return this.block?An.parse:An.parseInline}},QD=class{defaults=ah();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=An;Renderer=dc;TextRenderer=mh;Lexer=_n;Tokenizer=uc;Hooks=Fi;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let o of e)switch(r=r.concat(t.call(this,o)),o.type){case"table":{let i=o;for(let c of i.header)r=r.concat(this.walkTokens(c.tokens,t));for(let c of i.rows)for(let u of c)r=r.concat(this.walkTokens(u.tokens,t));break}case"list":{let i=o;r=r.concat(this.walkTokens(i.items,t));break}default:{let i=o;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(c=>{let u=i[c].flat(1/0);r=r.concat(this.walkTokens(u,t))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let c=t.renderers[i.name];c?t.renderers[i.name]=function(...u){let d=i.renderer.apply(this,u);return d===!1&&(d=c.apply(this,u)),d}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let c=t[i.level];c?c.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),o.extensions=t),r.renderer){let i=this.defaults.renderer||new dc(this.defaults);for(let c in r.renderer){if(!(c in i))throw new Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;let u=c,d=r.renderer[u],h=i[u];i[u]=(...g)=>{let x=d.apply(i,g);return x===!1&&(x=h.apply(i,g)),x||""}}o.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new uc(this.defaults);for(let c in r.tokenizer){if(!(c in i))throw new Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;let u=c,d=r.tokenizer[u],h=i[u];i[u]=(...g)=>{let x=d.apply(i,g);return x===!1&&(x=h.apply(i,g)),x}}o.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new Fi;for(let c in r.hooks){if(!(c in i))throw new Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;let u=c,d=r.hooks[u],h=i[u];Fi.passThroughHooks.has(c)?i[u]=g=>{if(this.defaults.async&&Fi.passThroughHooksRespectAsync.has(c))return(async()=>{let v=await d.call(i,g);return h.call(i,v)})();let x=d.call(i,g);return h.call(i,x)}:i[u]=(...g)=>{if(this.defaults.async)return(async()=>{let v=await d.apply(i,g);return v===!1&&(v=await h.apply(i,g)),v})();let x=d.apply(i,g);return x===!1&&(x=h.apply(i,g)),x}}o.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,c=r.walkTokens;o.walkTokens=function(u){let d=[];return d.push(c.call(this,u)),i&&(d=d.concat(i.call(this,u))),d}}this.defaults={...this.defaults,...o}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return _n.lex(e,t??this.defaults)}parser(e,t){return An.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let o={...r},i={...this.defaults,...o},c=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&o.async===!1)return c(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let u=i.hooks?await i.hooks.preprocess(t):t,d=await(i.hooks?await i.hooks.provideLexer():e?_n.lex:_n.lexInline)(u,i),h=i.hooks?await i.hooks.processAllTokens(d):d;i.walkTokens&&await Promise.all(this.walkTokens(h,i.walkTokens));let g=await(i.hooks?await i.hooks.provideParser():e?An.parse:An.parseInline)(h,i);return i.hooks?await i.hooks.postprocess(g):g})().catch(c);try{i.hooks&&(t=i.hooks.preprocess(t));let u=(i.hooks?i.hooks.provideLexer():e?_n.lex:_n.lexInline)(t,i);i.hooks&&(u=i.hooks.processAllTokens(u)),i.walkTokens&&this.walkTokens(u,i.walkTokens);let d=(i.hooks?i.hooks.provideParser():e?An.parse:An.parseInline)(u,i);return i.hooks&&(d=i.hooks.postprocess(d)),d}catch(u){return c(u)}}}onError(e,t){return r=>{if(r.message+=`
110
+ Please report this to https://github.com/markedjs/marked.`,e){let o="<p>An error occurred:</p><pre>"+Xn(r.message+"",!0)+"</pre>";return t?Promise.resolve(o):o}if(t)return Promise.reject(r);throw r}}},Os=new QD;function ze(e,t){return Os.parse(e,t)}ze.options=ze.setOptions=function(e){return Os.setOptions(e),ze.defaults=Os.defaults,Lb(ze.defaults),ze};ze.getDefaults=ah;ze.defaults=Hs;ze.use=function(...e){return Os.use(...e),ze.defaults=Os.defaults,Lb(ze.defaults),ze};ze.walkTokens=function(e,t){return Os.walkTokens(e,t)};ze.parseInline=Os.parseInline;ze.Parser=An;ze.parser=An.parse;ze.Renderer=dc;ze.TextRenderer=mh;ze.Lexer=_n;ze.lexer=_n.lex;ze.Tokenizer=uc;ze.Hooks=Fi;ze.parse=ze;ze.options;ze.setOptions;ze.use;ze.walkTokens;ze.parseInline;An.parse;_n.lex;ze.use({renderer:{link({href:e,title:t,tokens:r}){const o=this.parser.parseInline(r),i=t?` title="${t}"`:"";return e&&/^https?:\/\//.test(e)?`<a href="${e}"${i} target="_blank" rel="noopener noreferrer" class="text-primary underline underline-offset-2">${o}</a>`:`<a href="${e}"${i}>${o}</a>`}}});function Gb(e){const[t,r]=p.useState([]),o=p.useRef(0),i=p.useCallback(async C=>{const b=`img-${++o.current}-${Date.now()}`,k=URL.createObjectURL(C);r(N=>[...N,{id:b,file:C,preview:k,uploading:!0}]);try{const N=new FormData;N.append("file",C,C.name||"pasted-image.png");const E=e?Oe("/api/chat/assets",e):"/api/chat/assets",R=await fetch(E,{method:"POST",body:N});if(!R.ok)throw new Error("Upload failed");const T=await R.json();r(M=>M.map(F=>F.id===b?{...F,uploading:!1,uploaded:{url:T.url,mediaType:C.type||"image/png"}}:F))}catch(N){r(E=>E.map(R=>R.id===b?{...R,uploading:!1,error:N.message}:R))}},[]),c=p.useCallback(C=>{r(b=>{const k=b.find(N=>N.id===C);return k&&URL.revokeObjectURL(k.preview),b.filter(N=>N.id!==C)})},[]),u=p.useCallback(()=>{r(C=>(C.forEach(b=>URL.revokeObjectURL(b.preview)),[]))},[]),d=p.useCallback(C=>{const b=C.clipboardData?.items;if(b){for(let k=0;k<b.length;k++)if(b[k].type.startsWith("image/")){C.preventDefault();const N=b[k].getAsFile();N&&i(N)}}},[i]),h=p.useCallback(C=>{C.preventDefault(),C.stopPropagation();const b=C.dataTransfer?.files;if(b)for(let k=0;k<b.length;k++)b[k].type.startsWith("image/")&&i(b[k])},[i]),g=p.useCallback(C=>{C.preventDefault(),C.stopPropagation()},[]),x=t.filter(C=>C.uploaded).map(C=>C.uploaded),v=t.length>0,w=t.length>0&&t.every(C=>C.uploaded),S=t.some(C=>C.uploading);return{pendingImages:t,uploadedImages:x,hasImages:v,allUploaded:w,isUploading:S,addImage:i,removeImage:c,clearImages:u,handlePaste:d,handleDrop:h,handleDragOver:g}}function GD(e){const t=YD(e),r=p.forwardRef((o,i)=>{const{children:c,...u}=o,d=p.Children.toArray(c),h=d.find(ZD);if(h){const g=h.props.children,x=d.map(v=>v===h?p.Children.count(g)>1?p.Children.only(null):p.isValidElement(g)?g.props.children:null:v);return a.jsx(t,{...u,ref:i,children:p.isValidElement(g)?p.cloneElement(g,void 0,x):null})}return a.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}function YD(e){const t=p.forwardRef((r,o)=>{const{children:i,...c}=r;if(p.isValidElement(i)){const u=e_(i),d=JD(c,i.props);return i.type!==p.Fragment&&(d.ref=o?nr(o,u):u),p.cloneElement(i,d)}return p.Children.count(i)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var XD=Symbol("radix.slottable");function ZD(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===XD}function JD(e,t){const r={...t};for(const o in t){const i=e[o],c=t[o];/^on[A-Z]/.test(o)?i&&c?r[o]=(...d)=>{const h=c(...d);return i(...d),h}:i&&(r[o]=i):o==="style"?r[o]={...i,...c}:o==="className"&&(r[o]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function e_(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var su="Popover",[Yb]=Qt(su,[as]),ma=as(),[t_,ls]=Yb(su),Xb=e=>{const{__scopePopover:t,children:r,open:o,defaultOpen:i,onOpenChange:c,modal:u=!1}=e,d=ma(t),h=p.useRef(null),[g,x]=p.useState(!1),[v,w]=Fn({prop:o,defaultProp:i??!1,onChange:c,caller:su});return a.jsx(_c,{...d,children:a.jsx(t_,{scope:t,contentId:xn(),triggerRef:h,open:v,onOpenChange:w,onOpenToggle:p.useCallback(()=>w(S=>!S),[w]),hasCustomAnchor:g,onCustomAnchorAdd:p.useCallback(()=>x(!0),[]),onCustomAnchorRemove:p.useCallback(()=>x(!1),[]),modal:u,children:r})})};Xb.displayName=su;var Zb="PopoverAnchor",n_=p.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,i=ls(Zb,r),c=ma(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=i;return p.useEffect(()=>(u(),()=>d()),[u,d]),a.jsx(sa,{...c,...o,ref:t})});n_.displayName=Zb;var Jb="PopoverTrigger",e1=p.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,i=ls(Jb,r),c=ma(r),u=_e(t,i.triggerRef),d=a.jsx(Ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":o1(i.open),...o,ref:u,onClick:le(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?d:a.jsx(sa,{asChild:!0,...c,children:d})});e1.displayName=Jb;var gh="PopoverPortal",[r_,s_]=Yb(gh,{forceMount:void 0}),t1=e=>{const{__scopePopover:t,forceMount:r,children:o,container:i}=e,c=ls(gh,t);return a.jsx(r_,{scope:t,forceMount:r,children:a.jsx(bt,{present:r||c.open,children:a.jsx(Fo,{asChild:!0,container:i,children:o})})})};t1.displayName=gh;var Do="PopoverContent",n1=p.forwardRef((e,t)=>{const r=s_(Do,e.__scopePopover),{forceMount:o=r.forceMount,...i}=e,c=ls(Do,e.__scopePopover);return a.jsx(bt,{present:o||c.open,children:c.modal?a.jsx(i_,{...i,ref:t}):a.jsx(a_,{...i,ref:t})})});n1.displayName=Do;var o_=GD("PopoverContent.RemoveScroll"),i_=p.forwardRef((e,t)=>{const r=ls(Do,e.__scopePopover),o=p.useRef(null),i=_e(t,o),c=p.useRef(!1);return p.useEffect(()=>{const u=o.current;if(u)return Bc(u)},[]),a.jsx(ia,{as:o_,allowPinchZoom:!0,children:a.jsx(r1,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:le(e.onCloseAutoFocus,u=>{u.preventDefault(),c.current||r.triggerRef.current?.focus()}),onPointerDownOutside:le(e.onPointerDownOutside,u=>{const d=u.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0,g=d.button===2||h;c.current=g},{checkForDefaultPrevented:!1}),onFocusOutside:le(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),a_=p.forwardRef((e,t)=>{const r=ls(Do,e.__scopePopover),o=p.useRef(!1),i=p.useRef(!1);return a.jsx(r1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{e.onCloseAutoFocus?.(c),c.defaultPrevented||(o.current||r.triggerRef.current?.focus(),c.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:c=>{e.onInteractOutside?.(c),c.defaultPrevented||(o.current=!0,c.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=c.target;r.triggerRef.current?.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&i.current&&c.preventDefault()}})}),r1=p.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:x,...v}=e,w=ls(Do,r),S=ma(r);return $c(),a.jsx(oa,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:c,children:a.jsx(Bs,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:x,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:g,onDismiss:()=>w.onOpenChange(!1),children:a.jsx(Ac,{"data-state":o1(w.open),role:"dialog",id:w.contentId,...S,...v,ref:t,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),s1="PopoverClose",l_=p.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,i=ls(s1,r);return a.jsx(Ne.button,{type:"button",...o,ref:t,onClick:le(e.onClick,()=>i.onOpenChange(!1))})});l_.displayName=s1;var c_="PopoverArrow",u_=p.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,i=ma(r);return a.jsx(Ic,{...i,...o,ref:t})});u_.displayName=c_;function o1(e){return e?"open":"closed"}var d_=Xb,f_=e1,p_=t1,i1=n1;const a1=d_,l1=f_,xh=p.forwardRef(({className:e,align:t="center",sideOffset:r=4,...o},i)=>a.jsx(p_,{children:a.jsx(i1,{ref:i,align:t,sideOffset:r,className:ve("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...o})}));xh.displayName=i1.displayName;function c1({onUploadFile:e,onAttachItem:t,size:r="md"}){const[o,i]=p.useState(!1),[c,u]=p.useState(null),[d,h]=p.useState(""),g=p.useRef(null),{vaultParam:x,vaultId:v}=yn(),{data:w=[]}=it({queryKey:["/api/notes",v],queryFn:()=>je("GET",Oe("/api/notes",x)).then(M=>M.json()),enabled:!!v&&o}),{data:S=[]}=it({queryKey:["/api/tasks",v],queryFn:()=>je("GET",Oe("/api/tasks",x)).then(M=>M.json()),enabled:!!v&&o}),{data:C=[]}=it({queryKey:["/api/files",v],queryFn:()=>je("GET",Oe("/api/files",x)).then(M=>M.json()),enabled:!!v&&o}),b=p.useMemo(()=>{const M=c==="notes"?w:c==="tasks"?S:c==="files"?C:[],F=c==="files"?"name":"title";if(!d)return M.slice(0,20);const I=d.toLowerCase();return M.filter(O=>(O[F]||"").toLowerCase().includes(I)).slice(0,20)},[c,w,S,C,d]),k=M=>{t?.({type:c==="notes"?"note":c==="files"?"file":"task",id:M.id,title:M.title||M.name,mimeType:M.mimeType}),i(!1),u(null),h("")},N=()=>{e(),i(!1),u(null),h("")},E=()=>{u(null),h("")},R=r==="sm"?"h-5 w-5":"h-7 w-7",T=r==="sm"?"w-3.5 h-3.5":"w-4 h-4";return a.jsxs(a1,{open:o,onOpenChange:M=>{i(M),M||(u(null),h(""))},children:[a.jsx(l1,{asChild:!0,children:a.jsx(pe,{variant:"ghost",size:"icon",className:`${R} rounded-lg text-muted-foreground/50 hover:text-foreground`,title:"Attach",children:a.jsx(yr,{className:T})})}),a.jsx(xh,{side:"top",align:"start",className:"w-56 p-1",sideOffset:8,children:c?a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("button",{className:"flex items-center gap-1.5 px-2 py-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:E,children:[a.jsx(On,{className:"w-2.5 h-2.5 rotate-180"}),c==="notes"?"Notes":c==="files"?"Files":"Tasks"]}),a.jsx("div",{className:"px-1.5 pb-1.5",children:a.jsxs("div",{className:"relative",children:[a.jsx(Rs,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground/40"}),a.jsx(Ge,{ref:g,value:d,onChange:M=>h(M.target.value),placeholder:`Filter ${c}...`,className:"h-7 text-xs pl-7 bg-muted/30 border-border/30"})]})}),a.jsxs("div",{className:"max-h-48 overflow-y-auto",children:[b.length===0&&a.jsx("p",{className:"text-[10px] text-muted-foreground/40 text-center py-3",children:d?"No matches":`No ${c}`}),b.map(M=>a.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-left rounded-md hover:bg-muted/60 transition-colors",onClick:()=>k(M),children:[c==="notes"?a.jsx(tn,{className:"w-3 h-3 text-muted-foreground/50 shrink-0"}):c==="files"?a.jsx(qi,{className:"w-3 h-3 text-muted-foreground/50 shrink-0"}):a.jsx(ts,{className:"w-3 h-3 text-muted-foreground/50 shrink-0"}),a.jsx("span",{className:"truncate text-foreground",children:M.title||M.name})]},M.id))]})]}):a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("button",{className:"flex items-center gap-2.5 px-3 py-2 text-xs text-foreground rounded-md hover:bg-muted/60 transition-colors",onClick:N,children:[a.jsx(Ul,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Upload files or images"]}),t&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"flex items-center gap-2.5 px-3 py-2 text-xs text-foreground rounded-md hover:bg-muted/60 transition-colors",onClick:()=>{u("notes"),setTimeout(()=>g.current?.focus(),50)},children:[a.jsx(tn,{className:"w-3.5 h-3.5 text-muted-foreground"}),a.jsx("span",{className:"flex-1 text-left",children:"Add notes"}),a.jsx(On,{className:"w-3 h-3 text-muted-foreground/50"})]}),a.jsxs("button",{className:"flex items-center gap-2.5 px-3 py-2 text-xs text-foreground rounded-md hover:bg-muted/60 transition-colors",onClick:()=>{u("tasks"),setTimeout(()=>g.current?.focus(),50)},children:[a.jsx(ts,{className:"w-3.5 h-3.5 text-muted-foreground"}),a.jsx("span",{className:"flex-1 text-left",children:"Add tasks"}),a.jsx(On,{className:"w-3 h-3 text-muted-foreground/50"})]}),a.jsxs("button",{className:"flex items-center gap-2.5 px-3 py-2 text-xs text-foreground rounded-md hover:bg-muted/60 transition-colors",onClick:()=>{u("files"),setTimeout(()=>g.current?.focus(),50)},children:[a.jsx(qi,{className:"w-3.5 h-3.5 text-muted-foreground"}),a.jsx("span",{className:"flex-1 text-left",children:"Add files"}),a.jsx(On,{className:"w-3 h-3 text-muted-foreground/50"})]})]})]})})]})}function kf(){const[,e]=kN("/chat/:id"),[t,r]=Oo(),o=e?.id,[i,c]=p.useState([]),[u,d]=p.useState(""),[h,g]=p.useState("idle"),[x,v]=p.useState(new Set),[w,S]=p.useState([]),[C,b]=p.useState(!1),k=p.useRef(null),N=p.useRef(null),E=p.useRef(null),R=p.useRef(null),T=p.useRef(null),M=p.useRef(null),F=rn(),{vaultParam:I,vaultId:O,activeVault:q}=yn(),{pendingImages:U,uploadedImages:G,hasImages:_,isUploading:ee,addImage:X,removeImage:he,clearImages:ie,handlePaste:$,handleDrop:z,handleDragOver:B}=Gb(I),[Y,D]=p.useState(!1),[K,ue]=p.useState([]),{data:ge=[]}=it({queryKey:["/api/skills",O],queryFn:()=>je("GET",Oe("/api/skills",I)).then(te=>te.json()),enabled:!!O}),Ce=ge.filter(te=>te.enabled&&(te.priority??1)===0),fe=ge.filter(te=>te.enabled&&(te.priority??1)>0),{data:Z}=it({queryKey:["/api/chat/sessions",o,O],queryFn:()=>o?je("GET",Oe(`/api/chat/sessions/${o}`,I)).then(te=>te.json()):null,enabled:!!o&&!!O});p.useEffect(()=>{Z?.events&&c(Z.events)},[Z]),p.useEffect(()=>{if(!o)return;const be=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`,De=new WebSocket(be);return k.current=De,De.onopen=()=>{De.send(JSON.stringify({type:"join",sessionId:o}));const J=N.current;J&&(N.current=null,g("thinking"),De.send(J))},De.onmessage=J=>{const me=JSON.parse(J.data);me.type==="status"?(g(me.content==="thinking"?"thinking":(me.content==="done","idle")),me.content==="done"&&(F.invalidateQueries({queryKey:["/api/chat/sessions"]}),F.invalidateQueries({queryKey:["/api/notes"]}),F.invalidateQueries({queryKey:["/api/notes/folders"]}),F.invalidateQueries({queryKey:["/api/tasks"]}))):c(Te=>[...Te,me])},De.onerror=()=>{N.current&&(N.current=null,g("idle"))},De.onclose=()=>{k.current=null},()=>{De.close(),k.current=null}},[o]),p.useEffect(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[i]);const H=p.useCallback(async()=>{const te=u.trim(),be=G.length>0?G:void 0;if(!te&&!be&&K.length===0||h==="thinking"||ee)return;d(""),ie();const De=[...K];ue([]),R.current&&(R.current.style.height="auto");const J={type:"chat",message:te,vaultId:O};be&&(J.images=be),De.length>0&&(J.files=De),w.length>0&&(J.pinnedSkills=w);let me=o;if(!me)try{const qe=await(await je("POST",Oe("/api/chat/sessions",I),{title:"New Chat"})).json();me=qe.id,N.current=JSON.stringify({...J,sessionId:me}),g("thinking"),r(`/chat/${qe.id}`);return}catch{return}const Te=JSON.stringify({...J,sessionId:me}),We=k.current;We&&We.readyState===WebSocket.OPEN?(g("thinking"),We.send(Te)):(N.current=Te,g("thinking"))},[u,o,h,r,O,I,G,ee,ie,w]),ne=te=>{te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),H())},ae=te=>{v(be=>{const De=new Set(be);return De.has(te)?De.delete(te):De.add(te),De})},Me=async()=>{try{const be=await(await je("POST",Oe("/api/chat/sessions",I),{title:"New Chat"})).json();c([]),g("idle"),r(`/chat/${be.id}`)}catch{}},Ae=(te,be)=>{const De=te.metadata?.role==="user";switch(te.type){case"message":if(De){const me=te.metadata?.images||[],Te=te.content.replace(/!\[image\]\([^)]+\)\n?/g,"").trim();return a.jsx("div",{className:"flex justify-end mb-4",children:a.jsxs("div",{className:"max-w-[80%] bg-muted/40 border border-border/30 text-foreground rounded-2xl rounded-br-md px-4 py-2.5",children:[me.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:me.map((We,Le)=>a.jsx("img",{src:We,alt:"pasted",className:"max-w-[200px] max-h-[150px] rounded-lg object-cover","data-testid":`img-user-${be}-${Le}`},Le))}),Te&&a.jsx("p",{className:"text-sm whitespace-pre-wrap",children:Te})]})},te.id||be)}return a.jsxs("div",{className:"flex mb-4 gap-3",children:[a.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-muted/60 flex items-center justify-center mt-0.5",children:a.jsx(Bi,{className:"w-3.5 h-3.5 text-muted-foreground"})}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("div",{className:"text-sm prose prose-sm dark:prose-invert max-w-none [&_p]:mb-2 [&_ul]:mb-2 [&_ol]:mb-2 [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:text-xs",dangerouslySetInnerHTML:{__html:ze.parse(te.content)}})})]},te.id||be);case"thought":return a.jsxs("div",{className:"flex mb-2 gap-3 items-start",children:[a.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-muted/60 flex items-center justify-center mt-0.5",children:a.jsx(na,{className:"w-3.5 h-3.5 text-muted-foreground"})}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("p",{className:"text-xs text-muted-foreground italic",children:te.content})})]},te.id||be);case"tool_call":try{const me=JSON.parse(te.content),Te=x.has(te.id||String(be));return a.jsxs("div",{className:"flex mb-1 gap-3 items-start",children:[a.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-muted/60 flex items-center justify-center mt-0.5",children:a.jsx(Tp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("button",{onClick:()=>ae(te.id||String(be)),className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[Te?a.jsx(vr,{className:"w-3 h-3"}):a.jsx(On,{className:"w-3 h-3"}),a.jsx(et,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-4 font-mono",children:me.name})]}),Te&&a.jsx("pre",{className:"text-[10px] text-muted-foreground bg-muted/50 rounded p-2 mt-1 overflow-x-auto",children:JSON.stringify(me.args,null,2)})]})]},te.id||be)}catch{return null}case"tool_result":const J=x.has(te.id||String(be));return a.jsxs("div",{className:"flex mb-2 gap-3 items-start",children:[a.jsx("div",{className:"w-7"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("button",{onClick:()=>ae(te.id||String(be)),className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[J?a.jsx(vr,{className:"w-3 h-3"}):a.jsx(On,{className:"w-3 h-3"}),a.jsx("span",{children:"Result"})]}),J&&a.jsx("pre",{className:"text-[10px] text-muted-foreground bg-muted/50 rounded p-2 mt-1 overflow-x-auto max-h-32",children:(()=>{try{return JSON.stringify(JSON.parse(te.content),null,2)}catch{return te.content}})()})]})]},te.id||be);case"error":return a.jsxs("div",{className:"flex mb-3 gap-3 items-start",children:[a.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-destructive/10 flex items-center justify-center mt-0.5",children:a.jsx(Nc,{className:"w-3.5 h-3.5 text-destructive"})}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("p",{className:"text-xs text-destructive",children:te.content})})]},te.id||be);default:return null}};return!o&&t!=="/"?a.jsxs("div",{className:"flex-1 flex flex-col",children:[a.jsxs("header",{className:"flex items-center gap-2 px-4 h-12 border-b border-border/50 shrink-0",children:[a.jsx(As,{"data-testid":"button-sidebar-toggle"}),a.jsx("span",{className:"text-sm font-medium",children:"Chat"})]}),a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsxs("div",{className:"text-center max-w-md",children:[a.jsx("div",{className:"w-16 h-16 rounded-2xl bg-muted/40 flex items-center justify-center mx-auto mb-4",children:a.jsx("img",{src:sc,alt:"Cortex",className:"w-10 h-10"})}),a.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Cortex"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Your personal AI operating system. Ask me anything, create notes, manage tasks, or browse the web."}),a.jsxs(pe,{onClick:Me,className:"gap-2","data-testid":"button-start-chat",children:[a.jsx(yr,{className:"w-4 h-4"})," Start a conversation"]})]})})]}):a.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[a.jsxs("header",{className:"flex items-center gap-2 px-4 h-12 border-b border-border/50 shrink-0",children:[a.jsx(As,{"data-testid":"button-sidebar-toggle"}),a.jsx(kr,{className:"w-4 h-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium truncate",children:Z?.title||"New Chat"}),h==="thinking"&&a.jsxs(et,{variant:"secondary",className:"text-[10px] gap-1 ml-auto",children:[a.jsx(Es,{className:"w-3 h-3 animate-spin"}),"Thinking"]})]}),a.jsx("div",{ref:E,className:"flex-1 overflow-y-auto",children:a.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-6",children:[i.length===0&&a.jsx("div",{className:"flex items-center justify-center h-full min-h-[300px]",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl bg-muted/40 flex items-center justify-center mx-auto mb-3",children:a.jsx("img",{src:sc,alt:"Cortex",className:"w-7 h-7"})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Send a message to start"})]})}),i.map((te,be)=>Ae(te,be)),h==="thinking"&&i.length>0&&a.jsxs("div",{className:"flex mb-3 gap-3 items-center",children:[a.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-muted/60 flex items-center justify-center",children:a.jsx(Es,{className:"w-3.5 h-3.5 text-muted-foreground animate-spin"})}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground/40 animate-bounce",style:{animationDelay:"0ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground/40 animate-bounce",style:{animationDelay:"150ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground/40 animate-bounce",style:{animationDelay:"300ms"}})]})]})]})}),a.jsx("div",{className:`border-t border-border/50 bg-background px-4 py-3 shrink-0 transition-colors ${Y?"bg-muted/30 border-border":""}`,onDrop:te=>{z(te),D(!1)},onDragOver:te=>{B(te),D(!0)},onDragLeave:()=>D(!1),children:a.jsxs("div",{className:"max-w-3xl mx-auto",children:[K.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:K.map(te=>a.jsxs("div",{className:"flex items-center gap-1.5 bg-muted/50 border border-border/40 rounded-lg px-2.5 py-1 text-xs text-muted-foreground group",children:[a.jsx(qi,{className:"w-3 h-3 shrink-0"}),a.jsx("span",{className:"truncate max-w-[150px]",children:te.name}),a.jsx("button",{onClick:()=>ue(be=>be.filter(De=>De.id!==te.id)),className:"opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx(er,{className:"w-3 h-3"})})]},te.id))}),U.length>0&&a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:U.map(te=>a.jsxs("div",{className:"relative group",children:[a.jsx("img",{src:te.preview,alt:"preview",className:`h-16 w-16 rounded-lg object-cover border border-border/50 ${te.uploading?"opacity-50":""} ${te.error?"border-destructive":""}`}),te.uploading&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx(Es,{className:"w-4 h-4 animate-spin text-muted-foreground"})}),a.jsx("button",{onClick:()=>he(te.id),className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-destructive text-destructive-foreground rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity","data-testid":`button-remove-image-${te.id}`,children:a.jsx(er,{className:"w-2.5 h-2.5"})})]},te.id))}),C&&a.jsxs("div",{ref:M,className:"mb-2 bg-background border border-border/50 rounded-xl p-3 shadow-lg",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-xs font-medium flex items-center gap-1.5",children:[a.jsx(Bi,{className:"w-3 h-3 text-primary"}),"Active Skills"]}),a.jsx(pe,{size:"sm",variant:"ghost",className:"h-5 text-[10px] px-2",onClick:()=>b(!1),children:"Done"})]}),a.jsxs("div",{className:"space-y-0.5 max-h-52 overflow-y-auto",children:[Ce.length>0&&a.jsxs("div",{className:"mb-1.5",children:[a.jsx("p",{className:"text-[9px] text-muted-foreground uppercase tracking-wider mb-1 px-1",children:"Always active"}),Ce.map(te=>a.jsxs("div",{className:"flex items-center gap-2 py-1 px-2 rounded-lg opacity-60",children:[a.jsx("div",{className:"w-3 h-3 rounded bg-primary/20 flex items-center justify-center shrink-0",children:a.jsx(xr,{className:"w-2 h-2 text-primary"})}),a.jsx("span",{className:"text-xs",children:te.name}),a.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto truncate max-w-[120px]",children:te.description})]},te.name))]}),fe.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-[9px] text-muted-foreground uppercase tracking-wider mb-1 px-1",children:"Pin to activate"}),fe.map(te=>{const be=w.includes(te.name);return a.jsxs("button",{className:`w-full flex items-center gap-2 py-1 px-2 rounded-lg text-left transition-colors ${be?"bg-primary/10":"hover:bg-muted/50"}`,onClick:()=>S(De=>be?De.filter(J=>J!==te.name):[...De,te.name]),children:[a.jsx("div",{className:`w-3 h-3 rounded border flex items-center justify-center shrink-0 ${be?"bg-primary border-primary":"border-border"}`,children:be&&a.jsx(xr,{className:"w-2 h-2 text-primary-foreground"})}),a.jsx("span",{className:"text-xs",children:te.name}),a.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto truncate max-w-[120px]",children:te.description})]},te.name)})]})]})]}),a.jsxs("div",{className:"relative bg-muted/30 rounded-2xl border border-border/40 transition-colors",children:[a.jsx("input",{ref:T,type:"file",multiple:!0,className:"hidden",onChange:async te=>{const be=te.target.files;if(be){for(const De of Array.from(be))if(De.type.startsWith("image/"))X(De);else{const J=new FormData;J.append("file",De);try{const Te=await(await fetch(Oe("/api/files",I),{method:"POST",body:J})).json();ue(We=>[...We,{id:Te.id,name:Te.name,mimeType:Te.mimeType}])}catch{}}te.target.value=""}}}),a.jsx(pa,{ref:R,value:u,onChange:te=>{d(te.target.value);const be=te.target;be.style.height="auto",be.style.height=Math.min(be.scrollHeight,400)+"px"},onKeyDown:ne,onPaste:$,placeholder:Y?"Drop image here...":"Ask anything... (paste or drop images)",className:"min-h-[44px] max-h-[400px] resize-none border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 text-sm px-4 pt-3 pb-0 overflow-y-auto",rows:1,"data-testid":"input-chat"}),a.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(c1,{onUploadFile:()=>T.current?.click(),size:"md"}),a.jsxs(pe,{size:"sm",variant:"ghost",className:`h-7 px-2 gap-1 text-xs rounded-full ${C||w.length>0?"text-primary bg-primary/10":"text-muted-foreground"}`,onClick:()=>b(te=>!te),title:"Manage active skills",children:[a.jsx(Bi,{className:"w-3.5 h-3.5"}),w.length>0&&a.jsxs("span",{className:"text-[10px] font-medium",children:["+",w.length]})]})]}),a.jsx(pe,{size:"icon",className:"h-7 w-7 rounded-full bg-foreground/80 hover:bg-foreground text-background disabled:opacity-30 disabled:bg-muted-foreground/30",onClick:H,disabled:!u.trim()&&!_||h==="thinking"||ee,"data-testid":"button-send",children:a.jsx(Ly,{className:"w-3.5 h-3.5"})})]})]}),a.jsx("p",{className:"text-[10px] text-muted-foreground/50 mt-1.5 text-center",children:"Cortex can make mistakes. Paste or drop images to analyze them."})]})})]})}function u1({context:e,open:t,onClose:r,placeholder:o,width:i,style:c,onRemoveContext:u,availableItems:d,onAddContext:h}){const[g,x]=p.useState([]),[v,w]=p.useState(""),[S,C]=p.useState("idle"),[b,k]=p.useState(null),[N,E]=p.useState(new Set),[R,T]=p.useState(null),[M,F]=p.useState(0),I=p.useRef(null),O=p.useRef(null),q=p.useRef(null),U=p.useRef(null),G=p.useRef(null),_=p.useRef(null),ee=rn(),{vaultParam:X,vaultId:he}=yn(),{pendingImages:ie,uploadedImages:$,hasImages:z,isUploading:B,addImage:Y,removeImage:D,clearImages:K,handlePaste:ue,handleDrop:ge,handleDragOver:Ce}=Gb(X),fe=e.map(J=>J.id||J.title).join(","),Z=p.useRef(fe);p.useEffect(()=>{Z.current!==fe&&(x([]),k(null),C("idle"),O.current&&(O.current.close(),O.current=null),Z.current=fe)},[fe]),p.useEffect(()=>{if(!b||!t)return;const me=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`,Te=new WebSocket(me);return O.current=Te,Te.onopen=()=>{Te.send(JSON.stringify({type:"join",sessionId:b}));const We=q.current;We&&(q.current=null,C("thinking"),Te.send(We))},Te.onmessage=We=>{const Le=JSON.parse(We.data);Le.type==="status"?(C(Le.content==="thinking"?"thinking":"idle"),Le.content==="done"&&(ee.invalidateQueries({queryKey:["/api/notes"]}),ee.invalidateQueries({queryKey:["/api/notes/folders"]}),ee.invalidateQueries({queryKey:["/api/tasks"]}))):x(qe=>[...qe,Le])},Te.onerror=()=>{q.current&&(q.current=null,C("idle"))},Te.onclose=()=>{O.current=null},()=>{Te.close(),O.current=null}},[b,t]),p.useEffect(()=>{U.current&&(U.current.scrollTop=U.current.scrollHeight)},[g]),p.useEffect(()=>{t&&setTimeout(()=>G.current?.focus(),100)},[t]);const H=new Set(e.map(J=>J.id)),ne=(d||[]).filter(J=>H.has(J.id)||R===null?!1:R===""?!0:J.title.toLowerCase().includes(R.toLowerCase())).slice(0,8);p.useEffect(()=>{F(0)},[R]);const ae=p.useCallback(async()=>{const J=v.trim(),me=$.length>0?$:void 0;if(!J&&!me||S==="thinking"||B)return;w(""),K(),G.current&&(G.current.style.height="auto");const Te={type:"chat",message:J,context:e,vaultId:he};me&&(Te.images=me);let We=b;if(!We)try{const sn=e.length>0?`About: ${e.map(Ws=>Ws.title).join(", ").slice(0,50)}`:"Context Chat",jr=await(await je("POST",Oe("/api/chat/sessions",X),{title:sn})).json();We=jr.id,q.current=JSON.stringify({...Te,sessionId:We}),C("thinking"),k(jr.id);return}catch{return}const Le=JSON.stringify({...Te,sessionId:We}),qe=O.current;qe&&qe.readyState===WebSocket.OPEN?(C("thinking"),qe.send(Le)):(q.current=Le,C("thinking"))},[v,b,S,e,he,X,$,B,K]),Me=J=>{const me=J.target.value;w(me);const Te=J.target.selectionStart,Le=me.slice(0,Te).match(/@([^@]*)$/);Le&&d&&d.length>0?T(Le[1]):T(null)},Ae=p.useCallback(J=>{const me=G.current;if(me){const Te=me.selectionStart,Le=v.slice(0,Te).lastIndexOf("@");if(Le>=0){const qe=v.slice(0,Le)+v.slice(Te);w(qe)}}T(null),h?.(J),setTimeout(()=>G.current?.focus(),10)},[v,h]),te=J=>{if(R!==null&&ne.length>0){if(J.key==="ArrowDown"){J.preventDefault(),F(me=>(me+1)%ne.length);return}if(J.key==="ArrowUp"){J.preventDefault(),F(me=>(me-1+ne.length)%ne.length);return}if(J.key==="Enter"){J.preventDefault(),Ae(ne[M]);return}if(J.key==="Escape"){J.preventDefault(),T(null);return}}J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),ae()),J.key==="Escape"&&r()},be=J=>{E(me=>{const Te=new Set(me);return Te.has(J)?Te.delete(J):Te.add(J),Te})},De=(J,me)=>{const Te=J.metadata?.role==="user";switch(J.type){case"message":if(Te){const Le=J.metadata?.images||[],qe=J.content.replace(/!\[image\]\([^)]+\)\n?/g,"").trim();return a.jsx("div",{className:"flex justify-end mb-3",children:a.jsxs("div",{className:"max-w-[85%] bg-muted/40 border border-border/30 text-foreground rounded-2xl rounded-br-md px-3 py-2",children:[Le.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1 mb-1",children:Le.map((sn,Nr)=>a.jsx("img",{src:sn,alt:"pasted",className:"max-w-[120px] max-h-[90px] rounded-md object-cover"},Nr))}),qe&&a.jsx("p",{className:"text-xs whitespace-pre-wrap",children:qe})]})},J.id||me)}return a.jsxs("div",{className:"flex mb-3 gap-2",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-muted/60 flex items-center justify-center mt-0.5",children:a.jsx(Bi,{className:"w-3 h-3 text-muted-foreground"})}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("div",{className:"text-xs prose prose-xs dark:prose-invert max-w-none [&_p]:mb-1.5 [&_ul]:mb-1.5 [&_pre]:bg-muted [&_pre]:p-2 [&_pre]:rounded [&_code]:text-[10px]",dangerouslySetInnerHTML:{__html:ze.parse(J.content)}})})]},J.id||me);case"thought":return a.jsxs("div",{className:"flex mb-1.5 gap-2 items-center",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-muted/60 flex items-center justify-center",children:a.jsx(na,{className:"w-3 h-3 text-muted-foreground"})}),a.jsx("p",{className:"text-[10px] text-muted-foreground/70 italic leading-none",children:J.content})]},J.id||me);case"tool_call":try{const Le=JSON.parse(J.content),qe=N.has(J.id||String(me));return a.jsxs("div",{className:"flex mb-1 gap-2 items-start",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-muted/60 flex items-center justify-center",children:a.jsx(Tp,{className:"w-3 h-3 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("button",{onClick:()=>be(J.id||String(me)),className:"flex items-center gap-1 text-[10px] text-blue-500 hover:text-blue-400",children:[qe?a.jsx(vr,{className:"w-2.5 h-2.5"}):a.jsx(On,{className:"w-2.5 h-2.5"}),a.jsx(et,{variant:"secondary",className:"text-[9px] px-1 py-0 h-3.5 font-mono",children:Le.name})]}),qe&&a.jsx("pre",{className:"text-[9px] text-muted-foreground bg-muted/50 rounded p-1.5 mt-0.5 overflow-x-auto",children:JSON.stringify(Le.args,null,2)})]})]},J.id||me)}catch{return null}case"tool_result":const We=N.has(J.id||String(me));return a.jsxs("div",{className:"flex mb-1.5 gap-2 items-start",children:[a.jsx("div",{className:"flex-shrink-0 w-6"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("button",{onClick:()=>be(J.id||String(me)),className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground",children:[We?a.jsx(vr,{className:"w-2.5 h-2.5"}):a.jsx(On,{className:"w-2.5 h-2.5"}),a.jsx("span",{children:"Result"})]}),We&&a.jsx("pre",{className:"text-[9px] text-muted-foreground bg-muted/50 rounded p-1.5 mt-0.5 overflow-x-auto max-h-24",children:(()=>{try{return JSON.stringify(JSON.parse(J.content),null,2)}catch{return J.content}})()})]})]},J.id||me);case"error":return a.jsxs("div",{className:"flex mb-2 gap-2 items-center",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-destructive/10 flex items-center justify-center",children:a.jsx(Nc,{className:"w-3 h-3 text-destructive"})}),a.jsx("p",{className:"text-[10px] text-destructive leading-none",children:J.content})]},J.id||me);default:return null}};return t?a.jsxs("div",{className:"border-l border-border/50 flex flex-col bg-background shrink-0 h-full",style:{width:i??350,...c},"data-testid":"context-chat-panel",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 h-10 border-b border-border/50 shrink-0",children:[a.jsx(kr,{className:"w-3.5 h-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-medium flex-1",children:"AI Chat"}),a.jsx(pe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:r,"data-testid":"button-close-chat",children:a.jsx(er,{className:"w-3.5 h-3.5"})})]}),e.length>0&&a.jsx("div",{className:"px-3 py-2 border-b border-border/50 flex flex-wrap gap-1",children:e.map((J,me)=>a.jsxs(et,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-4 gap-1 group/badge",children:[J.type==="note"?a.jsx(tn,{className:"w-2.5 h-2.5"}):J.type==="file"?a.jsx(qi,{className:"w-2.5 h-2.5"}):a.jsx(ts,{className:"w-2.5 h-2.5"}),a.jsx("span",{className:"truncate max-w-[150px] inline-block align-bottom",title:J.title,children:J.title}),u&&J.id&&a.jsx("button",{onClick:Te=>{Te.stopPropagation(),u(J.id)},className:"ml-0.5 opacity-0 group-hover/badge:opacity-100 transition-opacity hover:text-destructive",title:"Remove from context",children:a.jsx(er,{className:"w-2.5 h-2.5"})})]},J.id||me))}),a.jsxs("div",{ref:U,className:"flex-1 overflow-y-auto px-3 py-3",children:[g.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center px-4",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-muted/40 flex items-center justify-center mb-2",children:a.jsx(Bi,{className:"w-3.5 h-3.5 text-muted-foreground/40"})}),a.jsx("p",{className:"text-xs text-muted-foreground/40",children:e.length>0?`${e.length} item${e.length>1?"s":""} in context`:"No context selected"}),a.jsx("p",{className:"text-[10px] text-muted-foreground/25 mt-1",children:e.length>0?"Ask a question to get started":"Select items to chat about them"})]}),g.map((J,me)=>De(J,me)),S==="thinking"&&a.jsxs("div",{className:"flex mb-2 gap-2 items-center",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-muted/60 flex items-center justify-center",children:a.jsx(Es,{className:"w-3 h-3 text-muted-foreground animate-spin"})}),a.jsx("span",{className:"text-[10px] text-muted-foreground/60 leading-none",children:"Thinking..."})]})]}),a.jsxs("div",{className:"border-t border-border/50 p-2 shrink-0",onDrop:ge,onDragOver:Ce,children:[ie.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2 px-0.5",children:ie.map(J=>a.jsxs("div",{className:"relative group",children:[a.jsx("img",{src:J.preview,alt:"preview",className:`h-10 w-10 rounded object-cover border border-border/50 ${J.uploading?"opacity-50":""}`}),J.uploading&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx(Es,{className:"w-3 h-3 animate-spin text-muted-foreground"})}),a.jsx("button",{onClick:()=>D(J.id),className:"absolute -top-1 -right-1 w-3.5 h-3.5 bg-destructive text-destructive-foreground rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx(er,{className:"w-2 h-2"})})]},J.id))}),a.jsxs("div",{className:"relative bg-muted/30 rounded-xl border border-border/40 transition-colors",children:[a.jsx("input",{ref:_,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:J=>{const me=J.target.files;me&&Array.from(me).forEach(Te=>Y(Te)),J.target.value=""}}),a.jsxs("div",{className:"relative",children:[R!==null&&ne.length>0&&a.jsx("div",{ref:I,className:"absolute bottom-full left-0 right-0 mb-1 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-50 max-h-48 overflow-y-auto",children:ne.map((J,me)=>a.jsxs("button",{className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 transition-colors ${me===M?"bg-primary/10 text-foreground":"text-muted-foreground hover:bg-muted/50"}`,onMouseDown:Te=>{Te.preventDefault(),Ae(J)},onMouseEnter:()=>F(me),children:[J.type==="note"?a.jsx(tn,{className:"w-3 h-3 shrink-0"}):J.type==="file"?a.jsx(qi,{className:"w-3 h-3 shrink-0"}):a.jsx(ts,{className:"w-3 h-3 shrink-0"}),a.jsx("span",{className:"truncate",children:J.title})]},J.id||me))}),a.jsx(pa,{ref:G,value:v,onChange:J=>{Me(J);const me=J.target;me.style.height="auto",me.style.height=Math.min(me.scrollHeight,300)+"px"},onKeyDown:te,onPaste:ue,placeholder:o||(d?"Type @ to add notes...":"Ask anything..."),className:"min-h-[32px] max-h-[300px] resize-none border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 text-xs px-3 pt-2.5 pb-0 leading-relaxed overflow-y-auto",rows:1,"data-testid":"input-context-chat"})]}),a.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[a.jsx(c1,{onUploadFile:()=>_.current?.click(),onAttachItem:h?J=>{h({type:J.type,title:J.title,content:"",id:J.id})}:void 0,size:"sm"}),a.jsx(pe,{size:"icon",className:"h-5 w-5 rounded-full bg-foreground/80 hover:bg-foreground text-background disabled:opacity-30 disabled:bg-muted-foreground/30",onClick:ae,disabled:!v.trim()&&!z||S==="thinking"||B,"data-testid":"button-context-send",children:a.jsx(Ly,{className:"w-2.5 h-2.5"})})]})]})]})]}):null}function np({defaultWidth:e,minWidth:t,maxWidth:r,storageKey:o,reverse:i=!1}){const[c,u]=p.useState(()=>{if(o)try{const w=localStorage.getItem(o);if(w){const S=parseInt(w,10);if(!isNaN(S)&&S>=t&&S<=r)return S}}catch{}return e}),d=p.useRef(0),h=p.useRef(0),[g,x]=p.useState(!1),v=p.useCallback(w=>{w.preventDefault(),d.current=w.clientX,h.current=c,x(!0);const S=b=>{const k=b.clientX-d.current,N=i?h.current-k:h.current+k,E=Math.floor(window.innerWidth*.5),R=Math.min(r,E),T=Math.max(t,Math.min(R,N));u(T)},C=()=>{if(document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",C),document.body.style.cursor="",document.body.style.userSelect="",x(!1),o)try{localStorage.setItem(o,String(c))}catch{}};document.addEventListener("mousemove",S),document.addEventListener("mouseup",C),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[c,t,r,i,o]);return p.useEffect(()=>{if(o)try{localStorage.setItem(o,String(c))}catch{}},[c,o]),{width:c,isResizing:g,onMouseDown:v}}function rp({onMouseDown:e,isResizing:t}){return a.jsx("div",{className:`w-1.5 cursor-col-resize flex items-center justify-center shrink-0 transition-colors group
111
+ ${t?"bg-primary/10":"hover:bg-border/30"}`,onMouseDown:e,role:"separator","aria-orientation":"vertical",children:a.jsx("div",{className:`w-px h-full transition-colors
112
+ ${t?"bg-primary/50":"bg-border/20 group-hover:bg-border/60"}`})})}function h_({src:e,alt:t,open:r,onClose:o}){const[i,c]=p.useState(1),[u,d]=p.useState(0);p.useEffect(()=>{r&&(c(1),d(0))},[r]),p.useEffect(()=>{if(!r)return;const w=S=>{S.key==="Escape"&&o()};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[r,o]),p.useEffect(()=>(r?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[r]);const h=p.useCallback(()=>c(w=>Math.min(w+.25,5)),[]),g=p.useCallback(()=>c(w=>Math.max(w-.25,.25)),[]),x=p.useCallback(()=>d(w=>(w+90)%360),[]),v=p.useCallback(w=>{w.preventDefault(),w.deltaY<0?c(S=>Math.min(S+.1,5)):c(S=>Math.max(S-.1,.25))},[]);return r?a.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/80 backdrop-blur-sm",onClick:o,children:[a.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-1 z-[101]",onClick:w=>w.stopPropagation(),children:[a.jsx(pe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white/70 hover:text-white hover:bg-white/10",onClick:h,title:"Zoom in",children:a.jsx(sE,{className:"w-4 h-4"})}),a.jsx(pe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white/70 hover:text-white hover:bg-white/10",onClick:g,title:"Zoom out",children:a.jsx(oE,{className:"w-4 h-4"})}),a.jsx(pe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white/70 hover:text-white hover:bg-white/10",onClick:x,title:"Rotate",children:a.jsx(Y2,{className:"w-4 h-4"})}),a.jsx("div",{className:"w-px h-5 bg-white/20 mx-1"}),a.jsx(pe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white/70 hover:text-white hover:bg-white/10",onClick:o,title:"Close",children:a.jsx(er,{className:"w-4 h-4"})})]}),i!==1&&a.jsxs("div",{className:"absolute top-4 left-4 text-white/50 text-xs z-[101]",children:[Math.round(i*100),"%"]}),a.jsx("img",{src:e,alt:t||"",className:"max-w-[90vw] max-h-[90vh] object-contain select-none cursor-zoom-in transition-transform duration-150",style:{transform:`scale(${i}) rotate(${u}deg)`},onClick:w=>w.stopPropagation(),onWheel:v,draggable:!1}),t&&a.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white/50 text-xs max-w-md truncate z-[101]",children:t})]}):null}function m_(){const[e,t]=p.useState(null),r=p.useCallback(i=>{const c=i.target;if(c.tagName==="IMG"){const u=c;if(u.naturalWidth<50&&u.naturalHeight<50)return;i.preventDefault(),t({src:u.src,alt:u.alt||""})}},[]),o=p.useCallback(()=>t(null),[]);return{lightbox:e,handleContainerClick:r,closeLightbox:o}}function g_({textareaRef:e,onInsert:t}){const r=(c,u)=>{const d=e.current;if(!d)return;const h=d.selectionStart,g=d.selectionEnd,x=d.value.substring(h,g),v=`${c}${x||"text"}${u}`,w=d.value.substring(0,h)+v+d.value.substring(g);t(w),setTimeout(()=>{d.focus(),d.selectionStart=h+c.length,d.selectionEnd=h+c.length+(x||"text").length},10)},o=c=>{const u=e.current;if(!u)return;const d=u.selectionStart,h=u.value.substring(0,d),g=u.value.substring(d),v=`${h.length>0&&!h.endsWith(`
113
+ `)?`
114
+ `:""}${c} `,w=h+v+g;t(w),setTimeout(()=>{u.focus(),u.selectionStart=u.selectionEnd=d+v.length},10)},i=[{icon:y2,label:"Bold",action:()=>r("**","**")},{icon:A2,label:"Italic",action:()=>r("*","*")},{icon:S2,label:"Code",action:()=>r("`","`")},{icon:L2,label:"Link",action:()=>r("[","](url)")},{divider:!0},{icon:D2,label:"Heading",action:()=>o("##")},{icon:Ep,label:"Bullet List",action:()=>o("-")},{icon:F2,label:"Numbered List",action:()=>o("1.")},{icon:q2,label:"Quote",action:()=>o(">")},{icon:$2,label:"Divider",action:()=>o("---")}];return a.jsx("div",{className:"flex items-center gap-0.5 px-3 py-1.5 border-b border-border/30 bg-muted/20",children:i.map((c,u)=>{if("divider"in c&&c.divider)return a.jsx("div",{className:"w-px h-4 bg-border/50 mx-1"},u);const d=c.icon;return a.jsx(pe,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-foreground",onClick:c.action,title:c.label,children:a.jsx(d,{className:"w-3 h-3"})},u)})})}function x_({note:e,isSelected:t,isInContext:r,onSelect:o,onToggleContext:i}){const c=p.useMemo(()=>e.content.replace(/!\[.*?\]\(.*?\)/g,"[image]").replace(/[#*_`\[\]>]/g,"").replace(/\n+/g," ").trim().slice(0,100),[e.content]),u=p.useMemo(()=>{const d=Date.now()-new Date(e.updatedAt).getTime(),h=Math.floor(d/6e4);if(h<60)return`${h}m ago`;const g=Math.floor(h/60);if(g<24)return`${g}h ago`;const x=Math.floor(g/24);return x<7?`${x}d ago`:new Date(e.updatedAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})},[e.updatedAt]);return a.jsx("button",{onClick:d=>{d.ctrlKey||d.metaKey?(d.preventDefault(),i()):o()},className:`w-full text-left p-3 rounded-lg transition-colors ${t?"bg-primary/8 border border-primary/15":r?"bg-primary/5 border border-primary/10":"hover:bg-muted/40 border border-transparent"}`,"data-testid":`note-item-${e.id}`,title:r?"Ctrl+Click to remove from context":"Ctrl+Click to add to AI context",children:a.jsx("div",{className:"flex items-start gap-2",children:a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[r&&a.jsx(kr,{className:"w-2.5 h-2.5 text-primary shrink-0"}),e.pinned&&a.jsx(Uy,{className:"w-2.5 h-2.5 text-primary shrink-0"}),a.jsx("span",{className:"text-[13px] font-medium truncate text-foreground",children:e.title})]}),c&&a.jsx("p",{className:"text-[11px] text-muted-foreground/60 line-clamp-2 leading-relaxed",children:c}),a.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[a.jsxs("span",{className:"text-[10px] text-muted-foreground/40 flex items-center gap-0.5",children:[a.jsx(By,{className:"w-2.5 h-2.5"}),u]}),e.tags.length>0&&a.jsxs(et,{variant:"secondary",className:"text-[9px] px-1 py-0 h-3.5 font-normal",children:[e.tags[0],e.tags.length>1?` +${e.tags.length-1}`:""]}),e.attachments.length>0&&a.jsxs("span",{className:"text-[10px] text-muted-foreground/40 flex items-center gap-0.5",children:[a.jsx(jp,{className:"w-2.5 h-2.5"}),e.attachments.length]})]})]})})})}function v_(){const[e,t]=p.useState(null),[r,o]=p.useState(!1),[i,c]=p.useState(""),[u,d]=p.useState(""),[h,g]=p.useState(""),[x,v]=p.useState(!0),[w,S]=p.useState("edit"),[C,b]=p.useState(new Set),k=p.useRef(null),N=p.useRef(null),E=p.useRef(null),R=rn(),{toast:T}=os(),{vaultParam:M,vaultId:F}=yn(),{lightbox:I,handleContainerClick:O,closeLightbox:q}=m_(),U=np({defaultWidth:280,minWidth:200,maxWidth:420,storageKey:"cortex-notes-list-width"}),G=np({defaultWidth:420,minWidth:280,maxWidth:800,storageKey:"cortex-notes-chat-width",reverse:!0}),{data:_=[]}=it({queryKey:["/api/notes",F],queryFn:()=>je("GET",Oe("/api/notes",M)).then(H=>H.json()),staleTime:0,refetchOnMount:"always",enabled:!!F}),ee=Ct({mutationFn:H=>je("POST",Oe("/api/notes",M),H).then(ne=>ne.json()),onSuccess:H=>{R.invalidateQueries({queryKey:["/api/notes"]}),t(H),o(!0),S("edit"),c(H.title),d(H.content)}}),X=Ct({mutationFn:({id:H,...ne})=>je("PATCH",Oe(`/api/notes/${H}`,M),ne).then(ae=>ae.json()),onSuccess:H=>{R.invalidateQueries({queryKey:["/api/notes"]}),t(H)}}),he=Ct({mutationFn:H=>je("DELETE",Oe(`/api/notes/${H}`,M)),onSuccess:()=>{R.invalidateQueries({queryKey:["/api/notes"]}),t(null),o(!1)}}),ie=p.useCallback(()=>{e&&(X.mutate({id:e.id,title:i,content:u}),o(!1),T({title:"Note saved"}))},[e,i,u,X,T]);p.useEffect(()=>{const H=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key==="s"&&r&&(ne.preventDefault(),ie())};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[r,ie]);const $=async H=>{if(!e)return;const ne=new FormData;ne.append("file",H);try{const Me=await(await fetch(Oe(`/api/notes/${e.id}/assets`,M),{method:"POST",body:ne})).json(),Ae=`
115
+ ![${H.name}](${Me.url})
116
+ `;d(te=>te+Ae),T({title:"Image uploaded"})}catch{T({title:"Upload failed",variant:"destructive"})}},z=H=>{const ne=H.clipboardData?.items;if(ne){for(const ae of Array.from(ne))if(ae.type.startsWith("image/")){const Me=ae.getAsFile();Me&&$(Me)}}},B=async(H,ne)=>{const ae=new FormData;ae.append("title",`Dump ${new Date().toLocaleString()}`),ne&&ae.append("file",ne);try{await fetch(Oe("/api/notes/inbox/dump",M),{method:"POST",body:ae}),R.invalidateQueries({queryKey:["/api/notes"]}),T({title:"Dumped to inbox"})}catch{}},Y=H=>{X.mutate({id:H.id,pinned:!H.pinned})},D=p.useMemo(()=>_.filter(H=>!h||H.title.toLowerCase().includes(h.toLowerCase())||H.content.toLowerCase().includes(h.toLowerCase())).sort((H,ne)=>(ne.pinned?1:0)-(H.pinned?1:0)||new Date(ne.updatedAt).getTime()-new Date(H.updatedAt).getTime()),[_,h]),K=H=>{t(H),o(!1),S("edit"),c(H.title),d(H.content)};p.useEffect(()=>{if(!e)return;const H=_.find(ne=>ne.id===e.id);H&&H.updatedAt!==e.updatedAt&&(t(H),r||(c(H.title),d(H.content)))},[_]);const ue=p.useCallback(H=>{b(ne=>{const ae=new Set(ne);return ae.has(H)?ae.delete(H):ae.add(H),ae})},[]),ge=p.useCallback(H=>{H.id&&b(ne=>new Set(ne).add(H.id))},[]),Ce=p.useCallback(H=>{b(ne=>{const ae=new Set(ne);return ae.delete(H),ae})},[]),fe=p.useMemo(()=>{const H=new Set(C);return e&&H.add(e.id),_.filter(ne=>H.has(ne.id)).map(ne=>({type:"note",title:ne.title,content:ne.content,id:ne.id}))},[C,e,_]),Z=p.useMemo(()=>_.map(H=>({type:"note",title:H.title,content:H.content,id:H.id})),[_]);return a.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[a.jsxs("header",{className:"flex items-center gap-2 px-4 h-12 border-b border-border/50 shrink-0",children:[a.jsx(As,{}),a.jsx(tn,{className:"w-4 h-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:"Notes"}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsxs(pe,{size:"sm",variant:x?"secondary":"ghost",className:"text-xs gap-1",onClick:()=>v(!x),"data-testid":"button-toggle-chat",children:[a.jsx(kr,{className:"w-3.5 h-3.5"})," AI"]}),a.jsxs(pe,{size:"sm",variant:"ghost",className:"text-xs gap-1",onClick:()=>{N.current?.click()},children:[a.jsx(_2,{className:"w-3.5 h-3.5"})," Quick Dump"]}),a.jsx("input",{ref:N,type:"file",accept:"image/*",className:"hidden",onChange:H=>{const ne=H.target.files?.[0];ne&&B(void 0,ne)}}),a.jsxs(pe,{size:"sm",variant:"default",className:"text-xs gap-1",onClick:()=>ee.mutate({title:"Untitled",content:""}),"data-testid":"button-new-note",children:[a.jsx(yr,{className:"w-3.5 h-3.5"})," New Note"]})]})]}),a.jsxs("div",{className:"flex-1 flex min-h-0",children:[a.jsxs("div",{className:"border-r border-border/50 flex flex-col shrink-0",style:{width:U.width},children:[a.jsx("div",{className:"p-2 space-y-2",children:a.jsxs("div",{className:"relative",children:[a.jsx(Rs,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground/50"}),a.jsx(Ge,{placeholder:"Search notes...",className:"h-8 text-xs pl-8 bg-muted/30 border-border/30",value:h,onChange:H=>g(H.target.value),"data-testid":"input-search-notes"})]})}),a.jsx(Is,{className:"flex-1",children:a.jsxs("div",{className:"p-1.5 space-y-0.5",children:[D.length===0&&a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl bg-muted/20 flex items-center justify-center mx-auto mb-2",children:a.jsx(tn,{className:"w-4.5 h-4.5 text-muted-foreground/20"})}),a.jsx("p",{className:"text-[11px] text-muted-foreground/40",children:"No notes yet"}),a.jsx("p",{className:"text-[10px] text-muted-foreground/25 mt-0.5",children:"Create one to get started"})]}),D.map(H=>a.jsx(x_,{note:H,isSelected:e?.id===H.id,isInContext:C.has(H.id),onSelect:()=>K(H),onToggleContext:()=>ue(H.id)},H.id))]})})]}),a.jsx(rp,{onMouseDown:U.onMouseDown,isResizing:U.isResizing}),a.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:e?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 h-11 border-b border-border/50 shrink-0",children:[r?a.jsx(Ge,{value:i,onChange:H=>c(H.target.value),className:"h-7 text-[13px] font-semibold border-0 bg-transparent p-0 focus-visible:ring-0 flex-1","data-testid":"input-note-title"}):a.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:a.jsx("span",{className:"text-[13px] font-semibold truncate",children:e.title})}),a.jsx("div",{className:"flex items-center gap-1 shrink-0",children:r?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex rounded-md border border-border/30 mr-1",children:[a.jsx(pe,{variant:w==="edit"?"secondary":"ghost",size:"icon",className:"h-6 w-6 rounded-r-none",onClick:()=>S("edit"),title:"Edit",children:a.jsx(zf,{className:"w-3 h-3"})}),a.jsx(pe,{variant:w==="preview"?"secondary":"ghost",size:"icon",className:"h-6 w-6 rounded-l-none",onClick:()=>S("preview"),title:"Preview",children:a.jsx(Ec,{className:"w-3 h-3"})})]}),a.jsxs(pe,{size:"sm",variant:"ghost",className:"h-7 text-xs gap-1",onClick:()=>k.current?.click(),children:[a.jsx(jp,{className:"w-3 h-3"})," Image"]}),a.jsx("input",{ref:k,type:"file",accept:"image/*",className:"hidden",onChange:H=>{const ne=H.target.files?.[0];ne&&$(ne)}}),a.jsx(pe,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>{o(!1),c(e.title),d(e.content)},children:"Cancel"}),a.jsxs(pe,{size:"sm",variant:"default",className:"h-7 text-xs gap-1",onClick:ie,"data-testid":"button-save-note",children:[a.jsx(Hy,{className:"w-3 h-3"})," Save"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs(pe,{size:"sm",variant:"ghost",className:"h-7 text-xs gap-1",onClick:()=>{o(!0),S("edit")},"data-testid":"button-edit-note",children:[a.jsx(zf,{className:"w-3 h-3"})," Edit"]}),a.jsxs(eu,{children:[a.jsx(tu,{asChild:!0,children:a.jsx(pe,{variant:"ghost",size:"icon",className:"h-7 w-7",children:a.jsx(Np,{className:"w-3.5 h-3.5"})})}),a.jsxs(da,{align:"end",children:[a.jsxs(Ln,{onClick:()=>Y(e),className:"text-xs gap-2",children:[e.pinned?a.jsx(H2,{className:"w-3.5 h-3.5"}):a.jsx(Uy,{className:"w-3.5 h-3.5"}),e.pinned?"Unpin":"Pin to top"]}),a.jsx(fa,{}),a.jsxs(Ln,{onClick:()=>he.mutate(e.id),className:"text-xs text-destructive gap-2",children:[a.jsx(is,{className:"w-3.5 h-3.5"}),"Delete note"]})]})]})]})})]}),r?a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[w==="edit"&&a.jsx(g_,{textareaRef:E,onInsert:H=>d(H)}),a.jsx("div",{className:"flex-1 overflow-auto",children:w==="edit"?a.jsx(pa,{ref:E,value:u,onChange:H=>d(H.target.value),onPaste:z,className:"min-h-full h-full text-sm font-mono resize-none border-0 rounded-none bg-transparent focus-visible:ring-0 p-4 leading-relaxed",placeholder:"Write markdown here... (paste images with Ctrl+V)","data-testid":"input-note-content"}):a.jsx("div",{className:"p-4",children:a.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_img]:rounded-lg [&_img]:max-w-[600px] [&_img]:cursor-pointer [&_img]:hover:opacity-90 [&_img]:transition-opacity [&_p]:mb-3 [&_ul]:mb-3 [&_ol]:mb-3 [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:text-xs [&_h1]:text-lg [&_h2]:text-base [&_h3]:text-sm",dangerouslySetInnerHTML:{__html:ze.parse(u)},onClick:O})})}),a.jsxs("div",{className:"flex items-center gap-3 px-4 h-7 border-t border-border/30 bg-muted/20 shrink-0",children:[a.jsxs("span",{className:"text-[10px] text-muted-foreground/40",children:[u.split(/\s+/).filter(Boolean).length," words"]}),a.jsxs("span",{className:"text-[10px] text-muted-foreground/40",children:[u.length," chars"]}),a.jsxs("span",{className:"text-[10px] text-muted-foreground/40",children:[u.split(`
117
+ `).length," lines"]}),a.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/40",children:"Markdown supported · Ctrl+S to save"})]})]}):a.jsx(Is,{className:"flex-1",children:a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-4 border-b border-border/30",children:[a.jsxs("span",{className:"text-[10px] text-muted-foreground/40",children:["Updated ",new Date(e.updatedAt).toLocaleString()]}),e.tags.length>0&&a.jsx("div",{className:"flex items-center gap-1",children:e.tags.map(H=>a.jsxs(et,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-4 font-normal gap-1",children:[a.jsx(qy,{className:"w-2 h-2"}),H]},H))})]}),e.content?a.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_img]:rounded-lg [&_img]:max-w-[600px] [&_img]:cursor-pointer [&_img]:hover:opacity-90 [&_img]:transition-opacity [&_p]:mb-3 [&_ul]:mb-3 [&_ol]:mb-3 [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:text-xs [&_h1]:text-lg [&_h2]:text-base [&_h3]:text-sm",dangerouslySetInnerHTML:{__html:ze.parse(e.content)},onClick:O}):a.jsx("p",{className:"text-sm text-muted-foreground/40 italic",children:"Empty note — click Edit to add content"})]})})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-muted/20 border border-dashed border-border/40 flex items-center justify-center mx-auto mb-3",children:a.jsx(tn,{className:"w-6 h-6 text-muted-foreground/20"})}),a.jsx("p",{className:"text-sm text-muted-foreground/50",children:"Select or create a note"}),a.jsx("p",{className:"text-[11px] text-muted-foreground/25 mt-1",children:"Full markdown with images, Ctrl+V to paste"})]})})}),x&&a.jsx(rp,{onMouseDown:G.onMouseDown,isResizing:G.isResizing}),a.jsx(u1,{open:x,onClose:()=>v(!1),width:G.width,context:fe,availableItems:Z,onAddContext:ge,onRemoveContext:Ce,placeholder:fe.length>1?`${fe.length} notes in context — ask anything...`:fe.length===1?`Ask about "${fe[0].title}"...`:"Select a note or type @ to add..."})]}),I&&a.jsx(h_,{src:I.src,alt:I.alt,open:!!I,onClose:q})]})}function vh(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ou="Checkbox",[y_]=Qt(ou),[w_,yh]=y_(ou);function b_(e){const{__scopeCheckbox:t,checked:r,children:o,defaultChecked:i,disabled:c,form:u,name:d,onCheckedChange:h,required:g,value:x="on",internal_do_not_use_render:v}=e,[w,S]=Fn({prop:r,defaultProp:i??!1,onChange:h,caller:ou}),[C,b]=p.useState(null),[k,N]=p.useState(null),E=p.useRef(!1),R=C?!!u||!!C.closest("form"):!0,T={checked:w,disabled:c,setChecked:S,control:C,setControl:b,name:d,form:u,value:x,hasConsumerStoppedPropagationRef:E,required:g,defaultChecked:es(i)?!1:i,isFormControl:R,bubbleInput:k,setBubbleInput:N};return a.jsx(w_,{scope:t,...T,children:S_(v)?v(T):o})}var d1="CheckboxTrigger",f1=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...o},i)=>{const{control:c,value:u,disabled:d,checked:h,required:g,setControl:x,setChecked:v,hasConsumerStoppedPropagationRef:w,isFormControl:S,bubbleInput:C}=yh(d1,e),b=_e(i,x),k=p.useRef(h);return p.useEffect(()=>{const N=c?.form;if(N){const E=()=>v(k.current);return N.addEventListener("reset",E),()=>N.removeEventListener("reset",E)}},[c,v]),a.jsx(Ne.button,{type:"button",role:"checkbox","aria-checked":es(h)?"mixed":h,"aria-required":g,"data-state":x1(h),"data-disabled":d?"":void 0,disabled:d,value:u,...o,ref:b,onKeyDown:le(t,N=>{N.key==="Enter"&&N.preventDefault()}),onClick:le(r,N=>{v(E=>es(E)?!0:!E),C&&S&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})})});f1.displayName=d1;var wh=p.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:o,checked:i,defaultChecked:c,required:u,disabled:d,value:h,onCheckedChange:g,form:x,...v}=e;return a.jsx(b_,{__scopeCheckbox:r,checked:i,defaultChecked:c,disabled:d,required:u,onCheckedChange:g,name:o,form:x,value:h,internal_do_not_use_render:({isFormControl:w})=>a.jsxs(a.Fragment,{children:[a.jsx(f1,{...v,ref:t,__scopeCheckbox:r}),w&&a.jsx(g1,{__scopeCheckbox:r})]})})});wh.displayName=ou;var p1="CheckboxIndicator",h1=p.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:o,...i}=e,c=yh(p1,r);return a.jsx(bt,{present:o||es(c.checked)||c.checked===!0,children:a.jsx(Ne.span,{"data-state":x1(c.checked),"data-disabled":c.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});h1.displayName=p1;var m1="CheckboxBubbleInput",g1=p.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:o,hasConsumerStoppedPropagationRef:i,checked:c,defaultChecked:u,required:d,disabled:h,name:g,value:x,form:v,bubbleInput:w,setBubbleInput:S}=yh(m1,e),C=_e(r,S),b=vh(c),k=Lp(o);p.useEffect(()=>{const E=w;if(!E)return;const R=window.HTMLInputElement.prototype,M=Object.getOwnPropertyDescriptor(R,"checked").set,F=!i.current;if(b!==c&&M){const I=new Event("click",{bubbles:F});E.indeterminate=es(c),M.call(E,es(c)?!1:c),E.dispatchEvent(I)}},[w,b,c,i]);const N=p.useRef(es(c)?!1:c);return a.jsx(Ne.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??N.current,required:d,disabled:h,name:g,value:x,form:v,...t,tabIndex:-1,ref:C,style:{...t.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});g1.displayName=m1;function S_(e){return typeof e=="function"}function es(e){return e==="indeterminate"}function x1(e){return es(e)?"indeterminate":e?"checked":"unchecked"}const iu=p.forwardRef(({className:e,...t},r)=>a.jsx(wh,{ref:r,className:ve("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:a.jsx(h1,{className:ve("flex items-center justify-center text-current"),children:a.jsx(xr,{className:"h-4 w-4"})})}));iu.displayName=wh.displayName;function k_(e){const t=C_(e),r=p.forwardRef((o,i)=>{const{children:c,...u}=o,d=p.Children.toArray(c),h=d.find(j_);if(h){const g=h.props.children,x=d.map(v=>v===h?p.Children.count(g)>1?p.Children.only(null):p.isValidElement(g)?g.props.children:null:v);return a.jsx(t,{...u,ref:i,children:p.isValidElement(g)?p.cloneElement(g,void 0,x):null})}return a.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}function C_(e){const t=p.forwardRef((r,o)=>{const{children:i,...c}=r;if(p.isValidElement(i)){const u=R_(i),d=E_(c,i.props);return i.type!==p.Fragment&&(d.ref=o?nr(o,u):u),p.cloneElement(i,d)}return p.Children.count(i)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var N_=Symbol("radix.slottable");function j_(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===N_}function E_(e,t){const r={...t};for(const o in t){const i=e[o],c=t[o];/^on[A-Z]/.test(o)?i&&c?r[o]=(...d)=>{const h=c(...d);return i(...d),h}:i&&(r[o]=i):o==="style"?r[o]={...i,...c}:o==="className"&&(r[o]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function R_(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var T_=[" ","Enter","ArrowUp","ArrowDown"],P_=[" ","Enter"],Ls="Select",[au,lu,M_]=Sc(Ls),[Uo]=Qt(Ls,[M_,as]),cu=as(),[D_,cs]=Uo(Ls),[__,A_]=Uo(Ls),v1=e=>{const{__scopeSelect:t,children:r,open:o,defaultOpen:i,onOpenChange:c,value:u,defaultValue:d,onValueChange:h,dir:g,name:x,autoComplete:v,disabled:w,required:S,form:C}=e,b=cu(t),[k,N]=p.useState(null),[E,R]=p.useState(null),[T,M]=p.useState(!1),F=aa(g),[I,O]=Fn({prop:o,defaultProp:i??!1,onChange:c,caller:Ls}),[q,U]=Fn({prop:u,defaultProp:d,onChange:h,caller:Ls}),G=p.useRef(null),_=k?C||!!k.closest("form"):!0,[ee,X]=p.useState(new Set),he=Array.from(ee).map(ie=>ie.props.value).join(";");return a.jsx(_c,{...b,children:a.jsxs(D_,{required:S,scope:t,trigger:k,onTriggerChange:N,valueNode:E,onValueNodeChange:R,valueNodeHasChildren:T,onValueNodeHasChildrenChange:M,contentId:xn(),value:q,onValueChange:U,open:I,onOpenChange:O,dir:F,triggerPointerDownPosRef:G,disabled:w,children:[a.jsx(au.Provider,{scope:t,children:a.jsx(__,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(ie=>{X($=>new Set($).add(ie))},[]),onNativeOptionRemove:p.useCallback(ie=>{X($=>{const z=new Set($);return z.delete(ie),z})},[]),children:r})}),_?a.jsxs(V1,{"aria-hidden":!0,required:S,tabIndex:-1,name:x,autoComplete:v,value:q,onChange:ie=>U(ie.target.value),disabled:w,form:C,children:[q===void 0?a.jsx("option",{value:""}):null,Array.from(ee)]},he):null]})})};v1.displayName=Ls;var y1="SelectTrigger",w1=p.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:o=!1,...i}=e,c=cu(r),u=cs(y1,r),d=u.disabled||o,h=_e(t,u.onTriggerChange),g=lu(r),x=p.useRef("touch"),[v,w,S]=H1(b=>{const k=g().filter(R=>!R.disabled),N=k.find(R=>R.value===u.value),E=W1(k,b,N);E!==void 0&&u.onValueChange(E.value)}),C=b=>{d||(u.onOpenChange(!0),S()),b&&(u.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return a.jsx(sa,{asChild:!0,...c,children:a.jsx(Ne.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":U1(u.value)?"":void 0,...i,ref:h,onClick:le(i.onClick,b=>{b.currentTarget.focus(),x.current!=="mouse"&&C(b)}),onPointerDown:le(i.onPointerDown,b=>{x.current=b.pointerType;const k=b.target;k.hasPointerCapture(b.pointerId)&&k.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(C(b),b.preventDefault())}),onKeyDown:le(i.onKeyDown,b=>{const k=v.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&w(b.key),!(k&&b.key===" ")&&T_.includes(b.key)&&(C(),b.preventDefault())})})})});w1.displayName=y1;var b1="SelectValue",S1=p.forwardRef((e,t)=>{const{__scopeSelect:r,className:o,style:i,children:c,placeholder:u="",...d}=e,h=cs(b1,r),{onValueNodeHasChildrenChange:g}=h,x=c!==void 0,v=_e(t,h.onValueNodeChange);return wt(()=>{g(x)},[g,x]),a.jsx(Ne.span,{...d,ref:v,style:{pointerEvents:"none"},children:U1(h.value)?a.jsx(a.Fragment,{children:u}):c})});S1.displayName=b1;var I_="SelectIcon",k1=p.forwardRef((e,t)=>{const{__scopeSelect:r,children:o,...i}=e;return a.jsx(Ne.span,{"aria-hidden":!0,...i,ref:t,children:o||"▼"})});k1.displayName=I_;var O_="SelectPortal",C1=e=>a.jsx(Fo,{asChild:!0,...e});C1.displayName=O_;var Fs="SelectContent",N1=p.forwardRef((e,t)=>{const r=cs(Fs,e.__scopeSelect),[o,i]=p.useState();if(wt(()=>{i(new DocumentFragment)},[]),!r.open){const c=o;return c?In.createPortal(a.jsx(j1,{scope:e.__scopeSelect,children:a.jsx(au.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),c):null}return a.jsx(E1,{...e,ref:t})});N1.displayName=Fs;var Dn=10,[j1,us]=Uo(Fs),L_="SelectContentImpl",F_=k_("SelectContent.RemoveScroll"),E1=p.forwardRef((e,t)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:c,onPointerDownOutside:u,side:d,sideOffset:h,align:g,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:S,sticky:C,hideWhenDetached:b,avoidCollisions:k,...N}=e,E=cs(Fs,r),[R,T]=p.useState(null),[M,F]=p.useState(null),I=_e(t,Z=>T(Z)),[O,q]=p.useState(null),[U,G]=p.useState(null),_=lu(r),[ee,X]=p.useState(!1),he=p.useRef(!1);p.useEffect(()=>{if(R)return Bc(R)},[R]),$c();const ie=p.useCallback(Z=>{const[H,...ne]=_().map(Ae=>Ae.ref.current),[ae]=ne.slice(-1),Me=document.activeElement;for(const Ae of Z)if(Ae===Me||(Ae?.scrollIntoView({block:"nearest"}),Ae===H&&M&&(M.scrollTop=0),Ae===ae&&M&&(M.scrollTop=M.scrollHeight),Ae?.focus(),document.activeElement!==Me))return},[_,M]),$=p.useCallback(()=>ie([O,R]),[ie,O,R]);p.useEffect(()=>{ee&&$()},[ee,$]);const{onOpenChange:z,triggerPointerDownPosRef:B}=E;p.useEffect(()=>{if(R){let Z={x:0,y:0};const H=ae=>{Z={x:Math.abs(Math.round(ae.pageX)-(B.current?.x??0)),y:Math.abs(Math.round(ae.pageY)-(B.current?.y??0))}},ne=ae=>{Z.x<=10&&Z.y<=10?ae.preventDefault():R.contains(ae.target)||z(!1),document.removeEventListener("pointermove",H),B.current=null};return B.current!==null&&(document.addEventListener("pointermove",H),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",ne,{capture:!0})}}},[R,z,B]),p.useEffect(()=>{const Z=()=>z(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[z]);const[Y,D]=H1(Z=>{const H=_().filter(Me=>!Me.disabled),ne=H.find(Me=>Me.ref.current===document.activeElement),ae=W1(H,Z,ne);ae&&setTimeout(()=>ae.ref.current.focus())}),K=p.useCallback((Z,H,ne)=>{const ae=!he.current&&!ne;(E.value!==void 0&&E.value===H||ae)&&(q(Z),ae&&(he.current=!0))},[E.value]),ue=p.useCallback(()=>R?.focus(),[R]),ge=p.useCallback((Z,H,ne)=>{const ae=!he.current&&!ne;(E.value!==void 0&&E.value===H||ae)&&G(Z)},[E.value]),Ce=o==="popper"?sp:R1,fe=Ce===sp?{side:d,sideOffset:h,align:g,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:S,sticky:C,hideWhenDetached:b,avoidCollisions:k}:{};return a.jsx(j1,{scope:r,content:R,viewport:M,onViewportChange:F,itemRefCallback:K,selectedItem:O,onItemLeave:ue,itemTextRefCallback:ge,focusSelectedItem:$,selectedItemText:U,position:o,isPositioned:ee,searchRef:Y,children:a.jsx(ia,{as:F_,allowPinchZoom:!0,children:a.jsx(oa,{asChild:!0,trapped:E.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:le(i,Z=>{E.trigger?.focus({preventScroll:!0}),Z.preventDefault()}),children:a.jsx(Bs,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:a.jsx(Ce,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:Z=>Z.preventDefault(),...N,...fe,onPlaced:()=>X(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...N.style},onKeyDown:le(N.onKeyDown,Z=>{const H=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!H&&Z.key.length===1&&D(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let ae=_().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const Me=Z.target,Ae=ae.indexOf(Me);ae=ae.slice(Ae+1)}setTimeout(()=>ie(ae)),Z.preventDefault()}})})})})})})});E1.displayName=L_;var $_="SelectItemAlignedPosition",R1=p.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:o,...i}=e,c=cs(Fs,r),u=us(Fs,r),[d,h]=p.useState(null),[g,x]=p.useState(null),v=_e(t,I=>x(I)),w=lu(r),S=p.useRef(!1),C=p.useRef(!0),{viewport:b,selectedItem:k,selectedItemText:N,focusSelectedItem:E}=u,R=p.useCallback(()=>{if(c.trigger&&c.valueNode&&d&&g&&b&&k&&N){const I=c.trigger.getBoundingClientRect(),O=g.getBoundingClientRect(),q=c.valueNode.getBoundingClientRect(),U=N.getBoundingClientRect();if(c.dir!=="rtl"){const Me=U.left-O.left,Ae=q.left-Me,te=I.left-Ae,be=I.width+te,De=Math.max(be,O.width),J=window.innerWidth-Dn,me=Yf(Ae,[Dn,Math.max(Dn,J-De)]);d.style.minWidth=be+"px",d.style.left=me+"px"}else{const Me=O.right-U.right,Ae=window.innerWidth-q.right-Me,te=window.innerWidth-I.right-Ae,be=I.width+te,De=Math.max(be,O.width),J=window.innerWidth-Dn,me=Yf(Ae,[Dn,Math.max(Dn,J-De)]);d.style.minWidth=be+"px",d.style.right=me+"px"}const G=w(),_=window.innerHeight-Dn*2,ee=b.scrollHeight,X=window.getComputedStyle(g),he=parseInt(X.borderTopWidth,10),ie=parseInt(X.paddingTop,10),$=parseInt(X.borderBottomWidth,10),z=parseInt(X.paddingBottom,10),B=he+ie+ee+z+$,Y=Math.min(k.offsetHeight*5,B),D=window.getComputedStyle(b),K=parseInt(D.paddingTop,10),ue=parseInt(D.paddingBottom,10),ge=I.top+I.height/2-Dn,Ce=_-ge,fe=k.offsetHeight/2,Z=k.offsetTop+fe,H=he+ie+Z,ne=B-H;if(H<=ge){const Me=G.length>0&&k===G[G.length-1].ref.current;d.style.bottom="0px";const Ae=g.clientHeight-b.offsetTop-b.offsetHeight,te=Math.max(Ce,fe+(Me?ue:0)+Ae+$),be=H+te;d.style.height=be+"px"}else{const Me=G.length>0&&k===G[0].ref.current;d.style.top="0px";const te=Math.max(ge,he+b.offsetTop+(Me?K:0)+fe)+ne;d.style.height=te+"px",b.scrollTop=H-ge+b.offsetTop}d.style.margin=`${Dn}px 0`,d.style.minHeight=Y+"px",d.style.maxHeight=_+"px",o?.(),requestAnimationFrame(()=>S.current=!0)}},[w,c.trigger,c.valueNode,d,g,b,k,N,c.dir,o]);wt(()=>R(),[R]);const[T,M]=p.useState();wt(()=>{g&&M(window.getComputedStyle(g).zIndex)},[g]);const F=p.useCallback(I=>{I&&C.current===!0&&(R(),E?.(),C.current=!1)},[R,E]);return a.jsx(B_,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:S,onScrollButtonChange:F,children:a.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:a.jsx(Ne.div,{...i,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});R1.displayName=$_;var z_="SelectPopperPosition",sp=p.forwardRef((e,t)=>{const{__scopeSelect:r,align:o="start",collisionPadding:i=Dn,...c}=e,u=cu(r);return a.jsx(Ac,{...u,...c,ref:t,align:o,collisionPadding:i,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});sp.displayName=z_;var[B_,bh]=Uo(Fs,{}),op="SelectViewport",T1=p.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:o,...i}=e,c=us(op,r),u=bh(op,r),d=_e(t,c.onViewportChange),h=p.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),a.jsx(au.Slot,{scope:r,children:a.jsx(Ne.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:le(i.onScroll,g=>{const x=g.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=u;if(w?.current&&v){const S=Math.abs(h.current-x.scrollTop);if(S>0){const C=window.innerHeight-Dn*2,b=parseFloat(v.style.minHeight),k=parseFloat(v.style.height),N=Math.max(b,k);if(N<C){const E=N+S,R=Math.min(C,E),T=E-R;v.style.height=R+"px",v.style.bottom==="0px"&&(x.scrollTop=T>0?T:0,v.style.justifyContent="flex-end")}}}h.current=x.scrollTop})})})]})});T1.displayName=op;var P1="SelectGroup",[V_,U_]=Uo(P1),H_=p.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,i=xn();return a.jsx(V_,{scope:r,id:i,children:a.jsx(Ne.div,{role:"group","aria-labelledby":i,...o,ref:t})})});H_.displayName=P1;var M1="SelectLabel",D1=p.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,i=U_(M1,r);return a.jsx(Ne.div,{id:i.id,...o,ref:t})});D1.displayName=M1;var fc="SelectItem",[W_,_1]=Uo(fc),A1=p.forwardRef((e,t)=>{const{__scopeSelect:r,value:o,disabled:i=!1,textValue:c,...u}=e,d=cs(fc,r),h=us(fc,r),g=d.value===o,[x,v]=p.useState(c??""),[w,S]=p.useState(!1),C=_e(t,E=>h.itemRefCallback?.(E,o,i)),b=xn(),k=p.useRef("touch"),N=()=>{i||(d.onValueChange(o),d.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(W_,{scope:r,value:o,disabled:i,textId:b,isSelected:g,onItemTextChange:p.useCallback(E=>{v(R=>R||(E?.textContent??"").trim())},[]),children:a.jsx(au.ItemSlot,{scope:r,value:o,disabled:i,textValue:x,children:a.jsx(Ne.div,{role:"option","aria-labelledby":b,"data-highlighted":w?"":void 0,"aria-selected":g&&w,"data-state":g?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...u,ref:C,onFocus:le(u.onFocus,()=>S(!0)),onBlur:le(u.onBlur,()=>S(!1)),onClick:le(u.onClick,()=>{k.current!=="mouse"&&N()}),onPointerUp:le(u.onPointerUp,()=>{k.current==="mouse"&&N()}),onPointerDown:le(u.onPointerDown,E=>{k.current=E.pointerType}),onPointerMove:le(u.onPointerMove,E=>{k.current=E.pointerType,i?h.onItemLeave?.():k.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:le(u.onPointerLeave,E=>{E.currentTarget===document.activeElement&&h.onItemLeave?.()}),onKeyDown:le(u.onKeyDown,E=>{h.searchRef?.current!==""&&E.key===" "||(P_.includes(E.key)&&N(),E.key===" "&&E.preventDefault())})})})})});A1.displayName=fc;var $i="SelectItemText",I1=p.forwardRef((e,t)=>{const{__scopeSelect:r,className:o,style:i,...c}=e,u=cs($i,r),d=us($i,r),h=_1($i,r),g=A_($i,r),[x,v]=p.useState(null),w=_e(t,N=>v(N),h.onItemTextChange,N=>d.itemTextRefCallback?.(N,h.value,h.disabled)),S=x?.textContent,C=p.useMemo(()=>a.jsx("option",{value:h.value,disabled:h.disabled,children:S},h.value),[h.disabled,h.value,S]),{onNativeOptionAdd:b,onNativeOptionRemove:k}=g;return wt(()=>(b(C),()=>k(C)),[b,k,C]),a.jsxs(a.Fragment,{children:[a.jsx(Ne.span,{id:h.textId,...c,ref:w}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren?In.createPortal(c.children,u.valueNode):null]})});I1.displayName=$i;var O1="SelectItemIndicator",L1=p.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e;return _1(O1,r).isSelected?a.jsx(Ne.span,{"aria-hidden":!0,...o,ref:t}):null});L1.displayName=O1;var ip="SelectScrollUpButton",F1=p.forwardRef((e,t)=>{const r=us(ip,e.__scopeSelect),o=bh(ip,e.__scopeSelect),[i,c]=p.useState(!1),u=_e(t,o.onScrollButtonChange);return wt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const g=h.scrollTop>0;c(g)};const h=r.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),i?a.jsx(z1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=r;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});F1.displayName=ip;var ap="SelectScrollDownButton",$1=p.forwardRef((e,t)=>{const r=us(ap,e.__scopeSelect),o=bh(ap,e.__scopeSelect),[i,c]=p.useState(!1),u=_e(t,o.onScrollButtonChange);return wt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const g=h.scrollHeight-h.clientHeight,x=Math.ceil(h.scrollTop)<g;c(x)};const h=r.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),i?a.jsx(z1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=r;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});$1.displayName=ap;var z1=p.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:o,...i}=e,c=us("SelectScrollButton",r),u=p.useRef(null),d=lu(r),h=p.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return p.useEffect(()=>()=>h(),[h]),wt(()=>{d().find(x=>x.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),a.jsx(Ne.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:le(i.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(o,50))}),onPointerMove:le(i.onPointerMove,()=>{c.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(o,50))}),onPointerLeave:le(i.onPointerLeave,()=>{h()})})}),K_="SelectSeparator",B1=p.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e;return a.jsx(Ne.div,{"aria-hidden":!0,...o,ref:t})});B1.displayName=K_;var lp="SelectArrow",q_=p.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,i=cu(r),c=cs(lp,r),u=us(lp,r);return c.open&&u.position==="popper"?a.jsx(Ic,{...i,...o,ref:t}):null});q_.displayName=lp;var Q_="SelectBubbleInput",V1=p.forwardRef(({__scopeSelect:e,value:t,...r},o)=>{const i=p.useRef(null),c=_e(o,i),u=vh(t);return p.useEffect(()=>{const d=i.current;if(!d)return;const h=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&x){const v=new Event("change",{bubbles:!0});x.call(d,t),d.dispatchEvent(v)}},[u,t]),a.jsx(Ne.select,{...r,style:{...hy,...r.style},ref:c,defaultValue:t})});V1.displayName=Q_;function U1(e){return e===""||e===void 0}function H1(e){const t=ut(e),r=p.useRef(""),o=p.useRef(0),i=p.useCallback(u=>{const d=r.current+u;t(d),(function h(g){r.current=g,window.clearTimeout(o.current),g!==""&&(o.current=window.setTimeout(()=>h(""),1e3))})(d)},[t]),c=p.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,i,c]}function W1(e,t,r){const i=t.length>1&&Array.from(t).every(g=>g===t[0])?t[0]:t,c=r?e.indexOf(r):-1;let u=G_(e,Math.max(c,0));i.length===1&&(u=u.filter(g=>g!==r));const h=u.find(g=>g.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==r?h:void 0}function G_(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var Y_=v1,K1=w1,X_=S1,Z_=k1,J_=C1,q1=N1,eA=T1,Q1=D1,G1=A1,tA=I1,nA=L1,Y1=F1,X1=$1,Z1=B1;const _o=Y_,Ao=X_,$s=p.forwardRef(({className:e,children:t,...r},o)=>a.jsxs(K1,{ref:o,className:ve("flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,a.jsx(Z_,{asChild:!0,children:a.jsx(vr,{className:"h-4 w-4 opacity-50"})})]}));$s.displayName=K1.displayName;const J1=p.forwardRef(({className:e,...t},r)=>a.jsx(Y1,{ref:r,className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx($y,{className:"h-4 w-4"})}));J1.displayName=Y1.displayName;const eS=p.forwardRef(({className:e,...t},r)=>a.jsx(X1,{ref:r,className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(vr,{className:"h-4 w-4"})}));eS.displayName=X1.displayName;const zs=p.forwardRef(({className:e,children:t,position:r="popper",...o},i)=>a.jsx(J_,{children:a.jsxs(q1,{ref:i,className:ve("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o,children:[a.jsx(J1,{}),a.jsx(eA,{className:ve("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(eS,{})]})}));zs.displayName=q1.displayName;const rA=p.forwardRef(({className:e,...t},r)=>a.jsx(Q1,{ref:r,className:ve("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));rA.displayName=Q1.displayName;const Sr=p.forwardRef(({className:e,children:t,...r},o)=>a.jsxs(G1,{ref:o,className:ve("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(nA,{children:a.jsx(xr,{className:"h-4 w-4"})})}),a.jsx(tA,{children:t})]}));Sr.displayName=G1.displayName;const sA=p.forwardRef(({className:e,...t},r)=>a.jsx(Z1,{ref:r,className:ve("-mx-1 my-1 h-px bg-muted",e),...t}));sA.displayName=Z1.displayName;function oA(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>o=>{t.forEach(i=>i(o))},t)}const uu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ho(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Sh(e){return"nodeType"in e}function $t(e){var t,r;return e?Ho(e)?e:Sh(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function kh(e){const{Document:t}=$t(e);return e instanceof t}function ga(e){return Ho(e)?!1:e instanceof $t(e).HTMLElement}function tS(e){return e instanceof $t(e).SVGElement}function Wo(e){return e?Ho(e)?e.document:Sh(e)?kh(e)?e:ga(e)||tS(e)?e.ownerDocument:document:document:document}const Bn=uu?p.useLayoutEffect:p.useEffect;function du(e){const t=p.useRef(e);return Bn(()=>{t.current=e}),p.useCallback(function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return t.current==null?void 0:t.current(...o)},[])}function iA(){const e=p.useRef(null),t=p.useCallback((o,i)=>{e.current=setInterval(o,i)},[]),r=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Zi(e,t){t===void 0&&(t=[e]);const r=p.useRef(e);return Bn(()=>{r.current!==e&&(r.current=e)},t),r}function xa(e,t){const r=p.useRef();return p.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...t])}function pc(e){const t=du(e),r=p.useRef(null),o=p.useCallback(i=>{i!==r.current&&t?.(i,r.current),r.current=i},[]);return[r,o]}function hc(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let Cf={};function va(e,t){return p.useMemo(()=>{if(t)return t;const r=Cf[e]==null?0:Cf[e]+1;return Cf[e]=r,e+"-"+r},[e,t])}function nS(e){return function(t){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((c,u)=>{const d=Object.entries(u);for(const[h,g]of d){const x=c[h];x!=null&&(c[h]=x+e*g)}return c},{...t})}}const Ro=nS(1),Ji=nS(-1);function aA(e){return"clientX"in e&&"clientY"in e}function fu(e){if(!e)return!1;const{KeyboardEvent:t}=$t(e.target);return t&&e instanceof t}function lA(e){if(!e)return!1;const{TouchEvent:t}=$t(e.target);return t&&e instanceof t}function mc(e){if(lA(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return aA(e)?{x:e.clientX,y:e.clientY}:null}const ss=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[ss.Translate.toString(e),ss.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:o}=e;return t+" "+r+"ms "+o}}}),Cv="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function cA(e){return e.matches(Cv)?e:e.querySelector(Cv)}const uA={display:"none"};function dA(e){let{id:t,value:r}=e;return He.createElement("div",{id:t,style:uA},r)}function fA(e){let{id:t,announcement:r,ariaLiveType:o="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return He.createElement("div",{id:t,style:i,role:"status","aria-live":o,"aria-atomic":!0},r)}function pA(){const[e,t]=p.useState("");return{announce:p.useCallback(o=>{o!=null&&t(o)},[]),announcement:e}}const rS=p.createContext(null);function hA(e){const t=p.useContext(rS);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function mA(){const[e]=p.useState(()=>new Set),t=p.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[p.useCallback(o=>{let{type:i,event:c}=o;e.forEach(u=>{var d;return(d=u[i])==null?void 0:d.call(u,c)})},[e]),t]}const gA={draggable:`
118
+ To pick up a draggable item, press the space bar.
119
+ While dragging, use the arrow keys to move the item.
120
+ Press space again to drop the item in its new position, or press escape to cancel.
121
+ `},xA={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function vA(e){let{announcements:t=xA,container:r,hiddenTextDescribedById:o,screenReaderInstructions:i=gA}=e;const{announce:c,announcement:u}=pA(),d=va("DndLiveRegion"),[h,g]=p.useState(!1);if(p.useEffect(()=>{g(!0)},[]),hA(p.useMemo(()=>({onDragStart(v){let{active:w}=v;c(t.onDragStart({active:w}))},onDragMove(v){let{active:w,over:S}=v;t.onDragMove&&c(t.onDragMove({active:w,over:S}))},onDragOver(v){let{active:w,over:S}=v;c(t.onDragOver({active:w,over:S}))},onDragEnd(v){let{active:w,over:S}=v;c(t.onDragEnd({active:w,over:S}))},onDragCancel(v){let{active:w,over:S}=v;c(t.onDragCancel({active:w,over:S}))}}),[c,t])),!h)return null;const x=He.createElement(He.Fragment,null,He.createElement(dA,{id:o,value:i.draggable}),He.createElement(fA,{id:d,announcement:u}));return r?In.createPortal(x,r):x}var ht;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ht||(ht={}));function gc(){}function Nv(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function yA(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>[...t].filter(o=>o!=null),[...t])}const Vn=Object.freeze({x:0,y:0});function wA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function bA(e,t){const r=mc(e);if(!r)return"0 0";const o={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return o.x+"% "+o.y+"%"}function SA(e,t){let{data:{value:r}}=e,{data:{value:o}}=t;return r-o}function kA(e,t){let{data:{value:r}}=e,{data:{value:o}}=t;return o-r}function jv(e){let{left:t,top:r,height:o,width:i}=e;return[{x:t,y:r},{x:t+i,y:r},{x:t,y:r+o},{x:t+i,y:r+o}]}function sS(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}const oS=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:o}=e;const i=jv(t),c=[];for(const u of o){const{id:d}=u,h=r.get(d);if(h){const g=jv(h),x=i.reduce((w,S,C)=>w+wA(g[C],S),0),v=Number((x/4).toFixed(4));c.push({id:d,data:{droppableContainer:u,value:v}})}}return c.sort(SA)};function CA(e,t){const r=Math.max(t.top,e.top),o=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),c=Math.min(t.top+t.height,e.top+e.height),u=i-o,d=c-r;if(o<i&&r<c){const h=t.width*t.height,g=e.width*e.height,x=u*d,v=x/(h+g-x);return Number(v.toFixed(4))}return 0}const NA=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:o}=e;const i=[];for(const c of o){const{id:u}=c,d=r.get(u);if(d){const h=CA(d,t);h>0&&i.push({id:u,data:{droppableContainer:c,value:h}})}}return i.sort(kA)};function jA(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function iS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Vn}function EA(e){return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),c=1;c<o;c++)i[c-1]=arguments[c];return i.reduce((u,d)=>({...u,top:u.top+e*d.y,bottom:u.bottom+e*d.y,left:u.left+e*d.x,right:u.right+e*d.x}),{...r})}}const RA=EA(1);function aS(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function TA(e,t,r){const o=aS(t);if(!o)return e;const{scaleX:i,scaleY:c,x:u,y:d}=o,h=e.left-u-(1-i)*parseFloat(r),g=e.top-d-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),x=i?e.width/i:e.width,v=c?e.height/c:e.height;return{width:x,height:v,top:g,right:h+x,bottom:g+v,left:h}}const PA={ignoreTransform:!1};function Ko(e,t){t===void 0&&(t=PA);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:g,transformOrigin:x}=$t(e).getComputedStyle(e);g&&(r=TA(r,g,x))}const{top:o,left:i,width:c,height:u,bottom:d,right:h}=r;return{top:o,left:i,width:c,height:u,bottom:d,right:h}}function Ev(e){return Ko(e,{ignoreTransform:!0})}function MA(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function DA(e,t){return t===void 0&&(t=$t(e).getComputedStyle(e)),t.position==="fixed"}function _A(e,t){t===void 0&&(t=$t(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const c=t[i];return typeof c=="string"?r.test(c):!1})}function pu(e,t){const r=[];function o(i){if(t!=null&&r.length>=t||!i)return r;if(kh(i)&&i.scrollingElement!=null&&!r.includes(i.scrollingElement))return r.push(i.scrollingElement),r;if(!ga(i)||tS(i)||r.includes(i))return r;const c=$t(e).getComputedStyle(i);return i!==e&&_A(i,c)&&r.push(i),DA(i,c)?r:o(i.parentNode)}return e?o(e):r}function lS(e){const[t]=pu(e,1);return t??null}function Nf(e){return!uu||!e?null:Ho(e)?e:Sh(e)?kh(e)||e===Wo(e).scrollingElement?window:ga(e)?e:null:null}function cS(e){return Ho(e)?e.scrollX:e.scrollLeft}function uS(e){return Ho(e)?e.scrollY:e.scrollTop}function cp(e){return{x:cS(e),y:uS(e)}}var yt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(yt||(yt={}));function dS(e){return!uu||!e?!1:e===document.scrollingElement}function fS(e){const t={x:0,y:0},r=dS(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},i=e.scrollTop<=t.y,c=e.scrollLeft<=t.x,u=e.scrollTop>=o.y,d=e.scrollLeft>=o.x;return{isTop:i,isLeft:c,isBottom:u,isRight:d,maxScroll:o,minScroll:t}}const AA={x:.2,y:.2};function IA(e,t,r,o,i){let{top:c,left:u,right:d,bottom:h}=r;o===void 0&&(o=10),i===void 0&&(i=AA);const{isTop:g,isBottom:x,isLeft:v,isRight:w}=fS(e),S={x:0,y:0},C={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!g&&c<=t.top+b.height?(S.y=yt.Backward,C.y=o*Math.abs((t.top+b.height-c)/b.height)):!x&&h>=t.bottom-b.height&&(S.y=yt.Forward,C.y=o*Math.abs((t.bottom-b.height-h)/b.height)),!w&&d>=t.right-b.width?(S.x=yt.Forward,C.x=o*Math.abs((t.right-b.width-d)/b.width)):!v&&u<=t.left+b.width&&(S.x=yt.Backward,C.x=o*Math.abs((t.left+b.width-u)/b.width)),{direction:S,speed:C}}function OA(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:u}=window;return{top:0,left:0,right:c,bottom:u,width:c,height:u}}const{top:t,left:r,right:o,bottom:i}=e.getBoundingClientRect();return{top:t,left:r,right:o,bottom:i,width:e.clientWidth,height:e.clientHeight}}function pS(e){return e.reduce((t,r)=>Ro(t,cp(r)),Vn)}function LA(e){return e.reduce((t,r)=>t+cS(r),0)}function FA(e){return e.reduce((t,r)=>t+uS(r),0)}function hS(e,t){if(t===void 0&&(t=Ko),!e)return;const{top:r,left:o,bottom:i,right:c}=t(e);lS(e)&&(i<=0||c<=0||r>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const $A=[["x",["left","right"],LA],["y",["top","bottom"],FA]];class Ch{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=pu(r),i=pS(o);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,u,d]of $A)for(const h of u)Object.defineProperty(this,h,{get:()=>{const g=d(o),x=i[c]-g;return this.rect[h]+x},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ui{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=t}add(t,r,o){var i;(i=this.target)==null||i.addEventListener(t,r,o),this.listeners.push([t,r,o])}}function zA(e){const{EventTarget:t}=$t(e);return e instanceof t?e:Wo(e)}function jf(e,t){const r=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+o**2)>t:"x"in t&&"y"in t?r>t.x&&o>t.y:"x"in t?r>t.x:"y"in t?o>t.y:!1}var hn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(hn||(hn={}));function Rv(e){e.preventDefault()}function BA(e){e.stopPropagation()}var $e;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})($e||($e={}));const mS={start:[$e.Space,$e.Enter],cancel:[$e.Esc],end:[$e.Space,$e.Enter,$e.Tab]},VA=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case $e.Right:return{...r,x:r.x+25};case $e.Left:return{...r,x:r.x-25};case $e.Down:return{...r,y:r.y+25};case $e.Up:return{...r,y:r.y-25}}};class Nh{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new Ui(Wo(r)),this.windowListeners=new Ui($t(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(hn.Resize,this.handleCancel),this.windowListeners.add(hn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(hn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,o=t.node.current;o&&hS(o),r(Vn)}handleKeyDown(t){if(fu(t)){const{active:r,context:o,options:i}=this.props,{keyboardCodes:c=mS,coordinateGetter:u=VA,scrollBehavior:d="smooth"}=i,{code:h}=t;if(c.end.includes(h)){this.handleEnd(t);return}if(c.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:g}=o.current,x=g?{x:g.left,y:g.top}:Vn;this.referenceCoordinates||(this.referenceCoordinates=x);const v=u(t,{active:r,context:o.current,currentCoordinates:x});if(v){const w=Ji(v,x),S={x:0,y:0},{scrollableAncestors:C}=o.current;for(const b of C){const k=t.code,{isTop:N,isRight:E,isLeft:R,isBottom:T,maxScroll:M,minScroll:F}=fS(b),I=OA(b),O={x:Math.min(k===$e.Right?I.right-I.width/2:I.right,Math.max(k===$e.Right?I.left:I.left+I.width/2,v.x)),y:Math.min(k===$e.Down?I.bottom-I.height/2:I.bottom,Math.max(k===$e.Down?I.top:I.top+I.height/2,v.y))},q=k===$e.Right&&!E||k===$e.Left&&!R,U=k===$e.Down&&!T||k===$e.Up&&!N;if(q&&O.x!==v.x){const G=b.scrollLeft+w.x,_=k===$e.Right&&G<=M.x||k===$e.Left&&G>=F.x;if(_&&!w.y){b.scrollTo({left:G,behavior:d});return}_?S.x=b.scrollLeft-G:S.x=k===$e.Right?b.scrollLeft-M.x:b.scrollLeft-F.x,S.x&&b.scrollBy({left:-S.x,behavior:d});break}else if(U&&O.y!==v.y){const G=b.scrollTop+w.y,_=k===$e.Down&&G<=M.y||k===$e.Up&&G>=F.y;if(_&&!w.x){b.scrollTo({top:G,behavior:d});return}_?S.y=b.scrollTop-G:S.y=k===$e.Down?b.scrollTop-M.y:b.scrollTop-F.y,S.y&&b.scrollBy({top:-S.y,behavior:d});break}}this.handleMove(t,Ro(Ji(v,this.referenceCoordinates),S))}}}handleMove(t,r){const{onMove:o}=this.props;t.preventDefault(),o(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Nh.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:o=mS,onActivation:i}=t,{active:c}=r;const{code:u}=e.nativeEvent;if(o.start.includes(u)){const d=c.activatorNode.current;return d&&e.target!==d?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Tv(e){return!!(e&&"distance"in e)}function Pv(e){return!!(e&&"delay"in e)}class jh{constructor(t,r,o){var i;o===void 0&&(o=zA(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:c}=t,{target:u}=c;this.props=t,this.events=r,this.document=Wo(u),this.documentListeners=new Ui(this.document),this.listeners=new Ui(o),this.windowListeners=new Ui($t(u)),this.initialCoordinates=(i=mc(c))!=null?i:Vn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:o}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(hn.Resize,this.handleCancel),this.windowListeners.add(hn.DragStart,Rv),this.windowListeners.add(hn.VisibilityChange,this.handleCancel),this.windowListeners.add(hn.ContextMenu,Rv),this.documentListeners.add(hn.Keydown,this.handleKeydown),r){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Pv(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Tv(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:o,onPending:i}=this.props;i(o,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(hn.Click,BA,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(hn.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:o,initialCoordinates:i,props:c}=this,{onMove:u,options:{activationConstraint:d}}=c;if(!i)return;const h=(r=mc(t))!=null?r:Vn,g=Ji(i,h);if(!o&&d){if(Tv(d)){if(d.tolerance!=null&&jf(g,d.tolerance))return this.handleCancel();if(jf(g,d.distance))return this.handleStart()}if(Pv(d)&&jf(g,d.tolerance))return this.handleCancel();this.handlePending(d,g);return}t.cancelable&&t.preventDefault(),u(h)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===$e.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const UA={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Eh extends jh{constructor(t){const{event:r}=t,o=Wo(r.target);super(t,UA,o)}}Eh.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:o}=t;return!r.isPrimary||r.button!==0?!1:(o?.({event:r}),!0)}}];const HA={move:{name:"mousemove"},end:{name:"mouseup"}};var up;(function(e){e[e.RightClick=2]="RightClick"})(up||(up={}));class WA extends jh{constructor(t){super(t,HA,Wo(t.event.target))}}WA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:o}=t;return r.button===up.RightClick?!1:(o?.({event:r}),!0)}}];const Ef={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class KA extends jh{constructor(t){super(t,Ef)}static setup(){return window.addEventListener(Ef.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ef.move.name,t)};function t(){}}}KA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:o}=t;const{touches:i}=r;return i.length>1?!1:(o?.({event:r}),!0)}}];var Hi;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Hi||(Hi={}));var xc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(xc||(xc={}));function qA(e){let{acceleration:t,activator:r=Hi.Pointer,canScroll:o,draggingRect:i,enabled:c,interval:u=5,order:d=xc.TreeOrder,pointerCoordinates:h,scrollableAncestors:g,scrollableAncestorRects:x,delta:v,threshold:w}=e;const S=GA({delta:v,disabled:!c}),[C,b]=iA(),k=p.useRef({x:0,y:0}),N=p.useRef({x:0,y:0}),E=p.useMemo(()=>{switch(r){case Hi.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Hi.DraggableRect:return i}},[r,i,h]),R=p.useRef(null),T=p.useCallback(()=>{const F=R.current;if(!F)return;const I=k.current.x*N.current.x,O=k.current.y*N.current.y;F.scrollBy(I,O)},[]),M=p.useMemo(()=>d===xc.TreeOrder?[...g].reverse():g,[d,g]);p.useEffect(()=>{if(!c||!g.length||!E){b();return}for(const F of M){if(o?.(F)===!1)continue;const I=g.indexOf(F),O=x[I];if(!O)continue;const{direction:q,speed:U}=IA(F,O,E,t,w);for(const G of["x","y"])S[G][q[G]]||(U[G]=0,q[G]=0);if(U.x>0||U.y>0){b(),R.current=F,C(T,u),k.current=U,N.current=q;return}}k.current={x:0,y:0},N.current={x:0,y:0},b()},[t,T,o,b,c,u,JSON.stringify(E),JSON.stringify(S),C,g,M,x,JSON.stringify(w)])}const QA={x:{[yt.Backward]:!1,[yt.Forward]:!1},y:{[yt.Backward]:!1,[yt.Forward]:!1}};function GA(e){let{delta:t,disabled:r}=e;const o=hc(t);return xa(i=>{if(r||!o||!i)return QA;const c={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[yt.Backward]:i.x[yt.Backward]||c.x===-1,[yt.Forward]:i.x[yt.Forward]||c.x===1},y:{[yt.Backward]:i.y[yt.Backward]||c.y===-1,[yt.Forward]:i.y[yt.Forward]||c.y===1}}},[r,t,o])}function YA(e,t){const r=t!=null?e.get(t):void 0,o=r?r.node.current:null;return xa(i=>{var c;return t==null?null:(c=o??i)!=null?c:null},[o,t])}function XA(e,t){return p.useMemo(()=>e.reduce((r,o)=>{const{sensor:i}=o,c=i.activators.map(u=>({eventName:u.eventName,handler:t(u.handler,o)}));return[...r,...c]},[]),[e,t])}var ea;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ea||(ea={}));var dp;(function(e){e.Optimized="optimized"})(dp||(dp={}));const Mv=new Map;function ZA(e,t){let{dragging:r,dependencies:o,config:i}=t;const[c,u]=p.useState(null),{frequency:d,measure:h,strategy:g}=i,x=p.useRef(e),v=k(),w=Zi(v),S=p.useCallback(function(N){N===void 0&&(N=[]),!w.current&&u(E=>E===null?N:E.concat(N.filter(R=>!E.includes(R))))},[w]),C=p.useRef(null),b=xa(N=>{if(v&&!r)return Mv;if(!N||N===Mv||x.current!==e||c!=null){const E=new Map;for(let R of e){if(!R)continue;if(c&&c.length>0&&!c.includes(R.id)&&R.rect.current){E.set(R.id,R.rect.current);continue}const T=R.node.current,M=T?new Ch(h(T),T):null;R.rect.current=M,M&&E.set(R.id,M)}return E}return N},[e,c,r,v,h]);return p.useEffect(()=>{x.current=e},[e]),p.useEffect(()=>{v||S()},[r,v]),p.useEffect(()=>{c&&c.length>0&&u(null)},[JSON.stringify(c)]),p.useEffect(()=>{v||typeof d!="number"||C.current!==null||(C.current=setTimeout(()=>{S(),C.current=null},d))},[d,v,S,...o]),{droppableRects:b,measureDroppableContainers:S,measuringScheduled:c!=null};function k(){switch(g){case ea.Always:return!1;case ea.BeforeDragging:return r;default:return!r}}}function Rh(e,t){return xa(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function JA(e,t){return Rh(e,t)}function eI(e){let{callback:t,disabled:r}=e;const o=du(t),i=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(o)},[o,r]);return p.useEffect(()=>()=>i?.disconnect(),[i]),i}function hu(e){let{callback:t,disabled:r}=e;const o=du(t),i=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(o)},[r]);return p.useEffect(()=>()=>i?.disconnect(),[i]),i}function tI(e){return new Ch(Ko(e),e)}function Dv(e,t,r){t===void 0&&(t=tI);const[o,i]=p.useState(null);function c(){i(h=>{if(!e)return null;if(e.isConnected===!1){var g;return(g=h??r)!=null?g:null}const x=t(e);return JSON.stringify(h)===JSON.stringify(x)?h:x})}const u=eI({callback(h){if(e)for(const g of h){const{type:x,target:v}=g;if(x==="childList"&&v instanceof HTMLElement&&v.contains(e)){c();break}}}}),d=hu({callback:c});return Bn(()=>{c(),e?(d?.observe(e),u?.observe(document.body,{childList:!0,subtree:!0})):(d?.disconnect(),u?.disconnect())},[e]),o}function nI(e){const t=Rh(e);return iS(e,t)}const _v=[];function rI(e){const t=p.useRef(e),r=xa(o=>e?o&&o!==_v&&e&&t.current&&e.parentNode===t.current.parentNode?o:pu(e):_v,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function sI(e){const[t,r]=p.useState(null),o=p.useRef(e),i=p.useCallback(c=>{const u=Nf(c.target);u&&r(d=>d?(d.set(u,cp(u)),new Map(d)):null)},[]);return p.useEffect(()=>{const c=o.current;if(e!==c){u(c);const d=e.map(h=>{const g=Nf(h);return g?(g.addEventListener("scroll",i,{passive:!0}),[g,cp(g)]):null}).filter(h=>h!=null);r(d.length?new Map(d):null),o.current=e}return()=>{u(e),u(c)};function u(d){d.forEach(h=>{const g=Nf(h);g?.removeEventListener("scroll",i)})}},[i,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,u)=>Ro(c,u),Vn):pS(e):Vn,[e,t])}function Av(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const o=e!==Vn;o&&!r.current&&(r.current=e),!o&&r.current&&(r.current=null)},[e]),r.current?Ji(e,r.current):Vn}function oI(e){p.useEffect(()=>{if(!uu)return;const t=e.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function iI(e,t){return p.useMemo(()=>e.reduce((r,o)=>{let{eventName:i,handler:c}=o;return r[i]=u=>{c(u,t)},r},{}),[e,t])}function gS(e){return p.useMemo(()=>e?MA(e):null,[e])}const Iv=[];function aI(e,t){t===void 0&&(t=Ko);const[r]=e,o=gS(r?$t(r):null),[i,c]=p.useState(Iv);function u(){c(()=>e.length?e.map(h=>dS(h)?o:new Ch(t(h),h)):Iv)}const d=hu({callback:u});return Bn(()=>{d?.disconnect(),u(),e.forEach(h=>d?.observe(h))},[e]),i}function xS(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ga(t)?t:e}function lI(e){let{measure:t}=e;const[r,o]=p.useState(null),i=p.useCallback(g=>{for(const{target:x}of g)if(ga(x)){o(v=>{const w=t(x);return v?{...v,width:w.width,height:w.height}:w});break}},[t]),c=hu({callback:i}),u=p.useCallback(g=>{const x=xS(g);c?.disconnect(),x&&c?.observe(x),o(x?t(x):null)},[t,c]),[d,h]=pc(u);return p.useMemo(()=>({nodeRef:d,rect:r,setRef:h}),[r,d,h])}const cI=[{sensor:Eh,options:{}},{sensor:Nh,options:{}}],uI={current:{}},Ql={draggable:{measure:Ev},droppable:{measure:Ev,strategy:ea.WhileDragging,frequency:dp.Optimized},dragOverlay:{measure:Ko}};class Wi extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,o;return(r=(o=this.get(t))==null?void 0:o.node.current)!=null?r:void 0}}const dI={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Wi,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:gc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ql,measureDroppableContainers:gc,windowRect:null,measuringScheduled:!1},vS={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:gc,draggableNodes:new Map,over:null,measureDroppableContainers:gc},ya=p.createContext(vS),yS=p.createContext(dI);function fI(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Wi}}}function pI(e,t){switch(t.type){case ht.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ht.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ht.DragEnd:case ht.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ht.RegisterDroppable:{const{element:r}=t,{id:o}=r,i=new Wi(e.droppable.containers);return i.set(o,r),{...e,droppable:{...e.droppable,containers:i}}}case ht.SetDroppableDisabled:{const{id:r,key:o,disabled:i}=t,c=e.droppable.containers.get(r);if(!c||o!==c.key)return e;const u=new Wi(e.droppable.containers);return u.set(r,{...c,disabled:i}),{...e,droppable:{...e.droppable,containers:u}}}case ht.UnregisterDroppable:{const{id:r,key:o}=t,i=e.droppable.containers.get(r);if(!i||o!==i.key)return e;const c=new Wi(e.droppable.containers);return c.delete(r),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function hI(e){let{disabled:t}=e;const{active:r,activatorEvent:o,draggableNodes:i}=p.useContext(ya),c=hc(o),u=hc(r?.id);return p.useEffect(()=>{if(!t&&!o&&c&&u!=null){if(!fu(c)||document.activeElement===c.target)return;const d=i.get(u);if(!d)return;const{activatorNode:h,node:g}=d;if(!h.current&&!g.current)return;requestAnimationFrame(()=>{for(const x of[h.current,g.current]){if(!x)continue;const v=cA(x);if(v){v.focus();break}}})}},[o,t,i,u,c]),null}function wS(e,t){let{transform:r,...o}=t;return e!=null&&e.length?e.reduce((i,c)=>c({transform:i,...o}),r):r}function mI(e){return p.useMemo(()=>({draggable:{...Ql.draggable,...e?.draggable},droppable:{...Ql.droppable,...e?.droppable},dragOverlay:{...Ql.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function gI(e){let{activeNode:t,measure:r,initialRect:o,config:i=!0}=e;const c=p.useRef(!1),{x:u,y:d}=typeof i=="boolean"?{x:i,y:i}:i;Bn(()=>{if(!u&&!d||!t){c.current=!1;return}if(c.current||!o)return;const g=t?.node.current;if(!g||g.isConnected===!1)return;const x=r(g),v=iS(x,o);if(u||(v.x=0),d||(v.y=0),c.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const w=lS(g);w&&w.scrollBy({top:v.y,left:v.x})}},[t,u,d,o,r])}const mu=p.createContext({...Vn,scaleX:1,scaleY:1});var Zr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Zr||(Zr={}));const xI=p.memo(function(t){var r,o,i,c;let{id:u,accessibility:d,autoScroll:h=!0,children:g,sensors:x=cI,collisionDetection:v=NA,measuring:w,modifiers:S,...C}=t;const b=p.useReducer(pI,void 0,fI),[k,N]=b,[E,R]=mA(),[T,M]=p.useState(Zr.Uninitialized),F=T===Zr.Initialized,{draggable:{active:I,nodes:O,translate:q},droppable:{containers:U}}=k,G=I!=null?O.get(I):null,_=p.useRef({initial:null,translated:null}),ee=p.useMemo(()=>{var nt;return I!=null?{id:I,data:(nt=G?.data)!=null?nt:uI,rect:_}:null},[I,G]),X=p.useRef(null),[he,ie]=p.useState(null),[$,z]=p.useState(null),B=Zi(C,Object.values(C)),Y=va("DndDescribedBy",u),D=p.useMemo(()=>U.getEnabled(),[U]),K=mI(w),{droppableRects:ue,measureDroppableContainers:ge,measuringScheduled:Ce}=ZA(D,{dragging:F,dependencies:[q.x,q.y],config:K.droppable}),fe=YA(O,I),Z=p.useMemo(()=>$?mc($):null,[$]),H=Tr(),ne=JA(fe,K.draggable.measure);gI({activeNode:I!=null?O.get(I):null,config:H.layoutShiftCompensation,initialRect:ne,measure:K.draggable.measure});const ae=Dv(fe,K.draggable.measure,ne),Me=Dv(fe?fe.parentElement:null),Ae=p.useRef({activatorEvent:null,active:null,activeNode:fe,collisionRect:null,collisions:null,droppableRects:ue,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:U,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),te=U.getNodeFor((r=Ae.current.over)==null?void 0:r.id),be=lI({measure:K.dragOverlay.measure}),De=(o=be.nodeRef.current)!=null?o:fe,J=F?(i=be.rect)!=null?i:ae:null,me=!!(be.nodeRef.current&&be.rect),Te=nI(me?null:ae),We=gS(De?$t(De):null),Le=rI(F?te??fe:null),qe=aI(Le),sn=wS(S,{transform:{x:q.x-Te.x,y:q.y-Te.y,scaleX:1,scaleY:1},activatorEvent:$,active:ee,activeNodeRect:ae,containerNodeRect:Me,draggingNodeRect:J,over:Ae.current.over,overlayNodeRect:be.rect,scrollableAncestors:Le,scrollableAncestorRects:qe,windowRect:We}),Nr=Z?Ro(Z,q):null,jr=sI(Le),Ws=Av(jr),wa=Av(jr,[ae]),Hn=Ro(sn,Ws),bn=J?RA(J,sn):null,Er=ee&&bn?v({active:ee,collisionRect:bn,droppableRects:ue,droppableContainers:D,pointerCoordinates:Nr}):null,Rr=sS(Er,"id"),[zt,ba]=p.useState(null),Sa=me?sn:Ro(sn,wa),ka=jA(Sa,(c=zt?.rect)!=null?c:null,ae),qo=p.useRef(null),Ks=p.useCallback((nt,Nt)=>{let{sensor:jt,options:Sn}=Nt;if(X.current==null)return;const _t=O.get(X.current);if(!_t)return;const Et=nt.nativeEvent,Bt=new jt({active:X.current,activeNode:_t,event:Et,options:Sn,context:Ae,onAbort(rt){if(!O.get(rt))return;const{onDragAbort:Rt}=B.current,kn={id:rt};Rt?.(kn),E({type:"onDragAbort",event:kn})},onPending(rt,on,Rt,kn){if(!O.get(rt))return;const{onDragPending:Wn}=B.current,Gt={id:rt,constraint:on,initialCoordinates:Rt,offset:kn};Wn?.(Gt),E({type:"onDragPending",event:Gt})},onStart(rt){const on=X.current;if(on==null)return;const Rt=O.get(on);if(!Rt)return;const{onDragStart:kn}=B.current,Cn={activatorEvent:Et,active:{id:on,data:Rt.data,rect:_}};In.unstable_batchedUpdates(()=>{kn?.(Cn),M(Zr.Initializing),N({type:ht.DragStart,initialCoordinates:rt,active:on}),E({type:"onDragStart",event:Cn}),ie(qo.current),z(Et)})},onMove(rt){N({type:ht.DragMove,coordinates:rt})},onEnd:or(ht.DragEnd),onCancel:or(ht.DragCancel)});qo.current=Bt;function or(rt){return async function(){const{active:Rt,collisions:kn,over:Cn,scrollAdjustedTranslate:Wn}=Ae.current;let Gt=null;if(Rt&&Wn){const{cancelDrop:ir}=B.current;Gt={activatorEvent:Et,active:Rt,collisions:kn,delta:Wn,over:Cn},rt===ht.DragEnd&&typeof ir=="function"&&await Promise.resolve(ir(Gt))&&(rt=ht.DragCancel)}X.current=null,In.unstable_batchedUpdates(()=>{N({type:rt}),M(Zr.Uninitialized),ba(null),ie(null),z(null),qo.current=null;const ir=rt===ht.DragEnd?"onDragEnd":"onDragCancel";if(Gt){const Xo=B.current[ir];Xo?.(Gt),E({type:ir,event:Gt})}})}}},[O]),Qo=p.useCallback((nt,Nt)=>(jt,Sn)=>{const _t=jt.nativeEvent,Et=O.get(Sn);if(X.current!==null||!Et||_t.dndKit||_t.defaultPrevented)return;const Bt={active:Et};nt(jt,Nt.options,Bt)===!0&&(_t.dndKit={capturedBy:Nt.sensor},X.current=Sn,Ks(jt,Nt))},[O,Ks]),qs=XA(x,Qo);oI(x),Bn(()=>{ae&&T===Zr.Initializing&&M(Zr.Initialized)},[ae,T]),p.useEffect(()=>{const{onDragMove:nt}=B.current,{active:Nt,activatorEvent:jt,collisions:Sn,over:_t}=Ae.current;if(!Nt||!jt)return;const Et={active:Nt,activatorEvent:jt,collisions:Sn,delta:{x:Hn.x,y:Hn.y},over:_t};In.unstable_batchedUpdates(()=>{nt?.(Et),E({type:"onDragMove",event:Et})})},[Hn.x,Hn.y]),p.useEffect(()=>{const{active:nt,activatorEvent:Nt,collisions:jt,droppableContainers:Sn,scrollAdjustedTranslate:_t}=Ae.current;if(!nt||X.current==null||!Nt||!_t)return;const{onDragOver:Et}=B.current,Bt=Sn.get(Rr),or=Bt&&Bt.rect.current?{id:Bt.id,rect:Bt.rect.current,data:Bt.data,disabled:Bt.disabled}:null,rt={active:nt,activatorEvent:Nt,collisions:jt,delta:{x:_t.x,y:_t.y},over:or};In.unstable_batchedUpdates(()=>{ba(or),Et?.(rt),E({type:"onDragOver",event:rt})})},[Rr]),Bn(()=>{Ae.current={activatorEvent:$,active:ee,activeNode:fe,collisionRect:bn,collisions:Er,droppableRects:ue,draggableNodes:O,draggingNode:De,draggingNodeRect:J,droppableContainers:U,over:zt,scrollableAncestors:Le,scrollAdjustedTranslate:Hn},_.current={initial:J,translated:bn}},[ee,fe,Er,bn,O,De,J,ue,U,zt,Le,Hn]),qA({...H,delta:q,draggingRect:bn,pointerCoordinates:Nr,scrollableAncestors:Le,scrollableAncestorRects:qe});const Go=p.useMemo(()=>({active:ee,activeNode:fe,activeNodeRect:ae,activatorEvent:$,collisions:Er,containerNodeRect:Me,dragOverlay:be,draggableNodes:O,droppableContainers:U,droppableRects:ue,over:zt,measureDroppableContainers:ge,scrollableAncestors:Le,scrollableAncestorRects:qe,measuringConfiguration:K,measuringScheduled:Ce,windowRect:We}),[ee,fe,ae,$,Er,Me,be,O,U,ue,zt,ge,Le,qe,K,Ce,We]),Yo=p.useMemo(()=>({activatorEvent:$,activators:qs,active:ee,activeNodeRect:ae,ariaDescribedById:{draggable:Y},dispatch:N,draggableNodes:O,over:zt,measureDroppableContainers:ge}),[$,qs,ee,ae,N,Y,O,zt,ge]);return He.createElement(rS.Provider,{value:R},He.createElement(ya.Provider,{value:Yo},He.createElement(yS.Provider,{value:Go},He.createElement(mu.Provider,{value:ka},g)),He.createElement(hI,{disabled:d?.restoreFocus===!1})),He.createElement(vA,{...d,hiddenTextDescribedById:Y}));function Tr(){const nt=he?.autoScrollEnabled===!1,Nt=typeof h=="object"?h.enabled===!1:h===!1,jt=F&&!nt&&!Nt;return typeof h=="object"?{...h,enabled:jt}:{enabled:jt}}}),vI=p.createContext(null),Ov="button",yI="Draggable";function wI(e){let{id:t,data:r,disabled:o=!1,attributes:i}=e;const c=va(yI),{activators:u,activatorEvent:d,active:h,activeNodeRect:g,ariaDescribedById:x,draggableNodes:v,over:w}=p.useContext(ya),{role:S=Ov,roleDescription:C="draggable",tabIndex:b=0}=i??{},k=h?.id===t,N=p.useContext(k?mu:vI),[E,R]=pc(),[T,M]=pc(),F=iI(u,t),I=Zi(r);Bn(()=>(v.set(t,{id:t,key:c,node:E,activatorNode:T,data:I}),()=>{const q=v.get(t);q&&q.key===c&&v.delete(t)}),[v,t]);const O=p.useMemo(()=>({role:S,tabIndex:b,"aria-disabled":o,"aria-pressed":k&&S===Ov?!0:void 0,"aria-roledescription":C,"aria-describedby":x.draggable}),[o,S,b,k,C,x.draggable]);return{active:h,activatorEvent:d,activeNodeRect:g,attributes:O,isDragging:k,listeners:o?void 0:F,node:E,over:w,setNodeRef:R,setActivatorNodeRef:M,transform:N}}function bS(){return p.useContext(yS)}const bI="Droppable",SI={timeout:25};function SS(e){let{data:t,disabled:r=!1,id:o,resizeObserverConfig:i}=e;const c=va(bI),{active:u,dispatch:d,over:h,measureDroppableContainers:g}=p.useContext(ya),x=p.useRef({disabled:r}),v=p.useRef(!1),w=p.useRef(null),S=p.useRef(null),{disabled:C,updateMeasurementsFor:b,timeout:k}={...SI,...i},N=Zi(b??o),E=p.useCallback(()=>{if(!v.current){v.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{g(Array.isArray(N.current)?N.current:[N.current]),S.current=null},k)},[k]),R=hu({callback:E,disabled:C||!u}),T=p.useCallback((O,q)=>{R&&(q&&(R.unobserve(q),v.current=!1),O&&R.observe(O))},[R]),[M,F]=pc(T),I=Zi(t);return p.useEffect(()=>{!R||!M.current||(R.disconnect(),v.current=!1,R.observe(M.current))},[M,R]),p.useEffect(()=>(d({type:ht.RegisterDroppable,element:{id:o,key:c,disabled:r,node:M,rect:w,data:I}}),()=>d({type:ht.UnregisterDroppable,key:c,id:o})),[o]),p.useEffect(()=>{r!==x.current.disabled&&(d({type:ht.SetDroppableDisabled,id:o,key:c,disabled:r}),x.current.disabled=r)},[o,c,r,d]),{active:u,rect:w,isOver:h?.id===o,node:M,over:h,setNodeRef:F}}function kI(e){let{animation:t,children:r}=e;const[o,i]=p.useState(null),[c,u]=p.useState(null),d=hc(r);return!r&&!o&&d&&i(d),Bn(()=>{if(!c)return;const h=o?.key,g=o?.props.id;if(h==null||g==null){i(null);return}Promise.resolve(t(g,c)).then(()=>{i(null)})},[t,o,c]),He.createElement(He.Fragment,null,r,o?p.cloneElement(o,{ref:u}):null)}const CI={x:0,y:0,scaleX:1,scaleY:1};function NI(e){let{children:t}=e;return He.createElement(ya.Provider,{value:vS},He.createElement(mu.Provider,{value:CI},t))}const jI={position:"fixed",touchAction:"none"},EI=e=>fu(e)?"transform 250ms ease":void 0,RI=p.forwardRef((e,t)=>{let{as:r,activatorEvent:o,adjustScale:i,children:c,className:u,rect:d,style:h,transform:g,transition:x=EI}=e;if(!d)return null;const v=i?g:{...g,scaleX:1,scaleY:1},w={...jI,width:d.width,height:d.height,top:d.top,left:d.left,transform:ss.Transform.toString(v),transformOrigin:i&&o?bA(o,d):void 0,transition:typeof x=="function"?x(o):x,...h};return He.createElement(r,{className:u,style:w,ref:t},c)}),TI=e=>t=>{let{active:r,dragOverlay:o}=t;const i={},{styles:c,className:u}=e;if(c!=null&&c.active)for(const[d,h]of Object.entries(c.active))h!==void 0&&(i[d]=r.node.style.getPropertyValue(d),r.node.style.setProperty(d,h));if(c!=null&&c.dragOverlay)for(const[d,h]of Object.entries(c.dragOverlay))h!==void 0&&o.node.style.setProperty(d,h);return u!=null&&u.active&&r.node.classList.add(u.active),u!=null&&u.dragOverlay&&o.node.classList.add(u.dragOverlay),function(){for(const[h,g]of Object.entries(i))r.node.style.setProperty(h,g);u!=null&&u.active&&r.node.classList.remove(u.active)}},PI=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:ss.Transform.toString(t)},{transform:ss.Transform.toString(r)}]},MI={duration:250,easing:"ease",keyframes:PI,sideEffects:TI({styles:{active:{opacity:"0"}}})};function DI(e){let{config:t,draggableNodes:r,droppableContainers:o,measuringConfiguration:i}=e;return du((c,u)=>{if(t===null)return;const d=r.get(c);if(!d)return;const h=d.node.current;if(!h)return;const g=xS(u);if(!g)return;const{transform:x}=$t(u).getComputedStyle(u),v=aS(x);if(!v)return;const w=typeof t=="function"?t:_I(t);return hS(h,i.draggable.measure),w({active:{id:c,data:d.data,node:h,rect:i.draggable.measure(h)},draggableNodes:r,dragOverlay:{node:u,rect:i.dragOverlay.measure(g)},droppableContainers:o,measuringConfiguration:i,transform:v})})}function _I(e){const{duration:t,easing:r,sideEffects:o,keyframes:i}={...MI,...e};return c=>{let{active:u,dragOverlay:d,transform:h,...g}=c;if(!t)return;const x={x:d.rect.left-u.rect.left,y:d.rect.top-u.rect.top},v={scaleX:h.scaleX!==1?u.rect.width*h.scaleX/d.rect.width:1,scaleY:h.scaleY!==1?u.rect.height*h.scaleY/d.rect.height:1},w={x:h.x-x.x,y:h.y-x.y,...v},S=i({...g,active:u,dragOverlay:d,transform:{initial:h,final:w}}),[C]=S,b=S[S.length-1];if(JSON.stringify(C)===JSON.stringify(b))return;const k=o?.({active:u,dragOverlay:d,...g}),N=d.node.animate(S,{duration:t,easing:r,fill:"forwards"});return new Promise(E=>{N.onfinish=()=>{k?.(),E()}})}}let Lv=0;function AI(e){return p.useMemo(()=>{if(e!=null)return Lv++,Lv},[e])}const II=He.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:o,style:i,transition:c,modifiers:u,wrapperElement:d="div",className:h,zIndex:g=999}=e;const{activatorEvent:x,active:v,activeNodeRect:w,containerNodeRect:S,draggableNodes:C,droppableContainers:b,dragOverlay:k,over:N,measuringConfiguration:E,scrollableAncestors:R,scrollableAncestorRects:T,windowRect:M}=bS(),F=p.useContext(mu),I=AI(v?.id),O=wS(u,{activatorEvent:x,active:v,activeNodeRect:w,containerNodeRect:S,draggingNodeRect:k.rect,over:N,overlayNodeRect:k.rect,scrollableAncestors:R,scrollableAncestorRects:T,transform:F,windowRect:M}),q=Rh(w),U=DI({config:o,draggableNodes:C,droppableContainers:b,measuringConfiguration:E}),G=q?k.setRef:void 0;return He.createElement(NI,null,He.createElement(kI,{animation:U},v&&I?He.createElement(RI,{key:I,id:v.id,ref:G,as:d,activatorEvent:x,adjustScale:t,className:h,transition:c,rect:q,style:{zIndex:g,...i},transform:O},r):null))});function kS(e,t,r){const o=e.slice();return o.splice(r<0?o.length+r:r,0,o.splice(t,1)[0]),o}function OI(e,t){return e.reduce((r,o,i)=>{const c=t.get(o);return c&&(r[i]=c),r},Array(e.length))}function $l(e){return e!==null&&e>=0}function LI(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function FI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const CS=e=>{let{rects:t,activeIndex:r,overIndex:o,index:i}=e;const c=kS(t,o,r),u=t[i],d=c[i];return!d||!u?null:{x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height}},zl={scaleX:1,scaleY:1},$I=e=>{var t;let{activeIndex:r,activeNodeRect:o,index:i,rects:c,overIndex:u}=e;const d=(t=c[r])!=null?t:o;if(!d)return null;if(i===r){const g=c[u];return g?{x:0,y:r<u?g.top+g.height-(d.top+d.height):g.top-d.top,...zl}:null}const h=zI(c,i,r);return i>r&&i<=u?{x:0,y:-d.height-h,...zl}:i<r&&i>=u?{x:0,y:d.height+h,...zl}:{x:0,y:0,...zl}};function zI(e,t,r){const o=e[t],i=e[t-1],c=e[t+1];return o?r<t?i?o.top-(i.top+i.height):c?c.top-(o.top+o.height):0:c?c.top-(o.top+o.height):i?o.top-(i.top+i.height):0:0}const NS="Sortable",jS=He.createContext({activeIndex:-1,containerId:NS,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:CS,disabled:{draggable:!1,droppable:!1}});function BI(e){let{children:t,id:r,items:o,strategy:i=CS,disabled:c=!1}=e;const{active:u,dragOverlay:d,droppableRects:h,over:g,measureDroppableContainers:x}=bS(),v=va(NS,r),w=d.rect!==null,S=p.useMemo(()=>o.map(F=>typeof F=="object"&&"id"in F?F.id:F),[o]),C=u!=null,b=u?S.indexOf(u.id):-1,k=g?S.indexOf(g.id):-1,N=p.useRef(S),E=!LI(S,N.current),R=k!==-1&&b===-1||E,T=FI(c);Bn(()=>{E&&C&&x(S)},[E,S,C,x]),p.useEffect(()=>{N.current=S},[S]);const M=p.useMemo(()=>({activeIndex:b,containerId:v,disabled:T,disableTransforms:R,items:S,overIndex:k,useDragOverlay:w,sortedRects:OI(S,h),strategy:i}),[b,v,T.draggable,T.droppable,R,S,k,h,w,i]);return He.createElement(jS.Provider,{value:M},t)}const VI=e=>{let{id:t,items:r,activeIndex:o,overIndex:i}=e;return kS(r,o,i).indexOf(t)},UI=e=>{let{containerId:t,isSorting:r,wasDragging:o,index:i,items:c,newIndex:u,previousItems:d,previousContainerId:h,transition:g}=e;return!g||!o||d!==c&&i===u?!1:r?!0:u!==i&&t===h},HI={duration:200,easing:"ease"},ES="transform",WI=ss.Transition.toString({property:ES,duration:0,easing:"linear"}),KI={roleDescription:"sortable"};function qI(e){let{disabled:t,index:r,node:o,rect:i}=e;const[c,u]=p.useState(null),d=p.useRef(r);return Bn(()=>{if(!t&&r!==d.current&&o.current){const h=i.current;if(h){const g=Ko(o.current,{ignoreTransform:!0}),x={x:h.left-g.left,y:h.top-g.top,scaleX:h.width/g.width,scaleY:h.height/g.height};(x.x||x.y)&&u(x)}}r!==d.current&&(d.current=r)},[t,r,o,i]),p.useEffect(()=>{c&&u(null)},[c]),c}function QI(e){let{animateLayoutChanges:t=UI,attributes:r,disabled:o,data:i,getNewIndex:c=VI,id:u,strategy:d,resizeObserverConfig:h,transition:g=HI}=e;const{items:x,containerId:v,activeIndex:w,disabled:S,disableTransforms:C,sortedRects:b,overIndex:k,useDragOverlay:N,strategy:E}=p.useContext(jS),R=GI(o,S),T=x.indexOf(u),M=p.useMemo(()=>({sortable:{containerId:v,index:T,items:x},...i}),[v,i,T,x]),F=p.useMemo(()=>x.slice(x.indexOf(u)),[x,u]),{rect:I,node:O,isOver:q,setNodeRef:U}=SS({id:u,data:M,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:F,...h}}),{active:G,activatorEvent:_,activeNodeRect:ee,attributes:X,setNodeRef:he,listeners:ie,isDragging:$,over:z,setActivatorNodeRef:B,transform:Y}=wI({id:u,data:M,attributes:{...KI,...r},disabled:R.draggable}),D=oA(U,he),K=!!G,ue=K&&!C&&$l(w)&&$l(k),ge=!N&&$,Ce=ge&&ue?Y:null,Z=ue?Ce??(d??E)({rects:b,activeNodeRect:ee,activeIndex:w,overIndex:k,index:T}):null,H=$l(w)&&$l(k)?c({id:u,items:x,activeIndex:w,overIndex:k}):T,ne=G?.id,ae=p.useRef({activeId:ne,items:x,newIndex:H,containerId:v}),Me=x!==ae.current.items,Ae=t({active:G,containerId:v,isDragging:$,isSorting:K,id:u,index:T,items:x,newIndex:ae.current.newIndex,previousItems:ae.current.items,previousContainerId:ae.current.containerId,transition:g,wasDragging:ae.current.activeId!=null}),te=qI({disabled:!Ae,index:T,node:O,rect:I});return p.useEffect(()=>{K&&ae.current.newIndex!==H&&(ae.current.newIndex=H),v!==ae.current.containerId&&(ae.current.containerId=v),x!==ae.current.items&&(ae.current.items=x)},[K,H,v,x]),p.useEffect(()=>{if(ne===ae.current.activeId)return;if(ne!=null&&ae.current.activeId==null){ae.current.activeId=ne;return}const De=setTimeout(()=>{ae.current.activeId=ne},50);return()=>clearTimeout(De)},[ne]),{active:G,activeIndex:w,attributes:X,data:M,rect:I,index:T,newIndex:H,items:x,isOver:q,isSorting:K,isDragging:$,listeners:ie,node:O,overIndex:k,over:z,setNodeRef:D,setActivatorNodeRef:B,setDroppableNodeRef:U,setDraggableNodeRef:he,transform:te??Z,transition:be()};function be(){if(te||Me&&ae.current.newIndex===T)return WI;if(!(ge&&!fu(_)||!g)&&(K||Ae))return ss.Transition.toString({...g,property:ES})}}function GI(e,t){var r,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(o=e?.droppable)!=null?o:t.droppable}}function vc(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const YI=[$e.Down,$e.Right,$e.Up,$e.Left],XI=(e,t)=>{let{context:{active:r,collisionRect:o,droppableRects:i,droppableContainers:c,over:u,scrollableAncestors:d}}=t;if(YI.includes(e.code)){if(e.preventDefault(),!r||!o)return;const h=[];c.getEnabled().forEach(v=>{if(!v||v!=null&&v.disabled)return;const w=i.get(v.id);if(w)switch(e.code){case $e.Down:o.top<w.top&&h.push(v);break;case $e.Up:o.top>w.top&&h.push(v);break;case $e.Left:o.left>w.left&&h.push(v);break;case $e.Right:o.left<w.left&&h.push(v);break}});const g=oS({collisionRect:o,droppableRects:i,droppableContainers:h});let x=sS(g,"id");if(x===u?.id&&g.length>1&&(x=g[1].id),x!=null){const v=c.get(r.id),w=c.get(x),S=w?i.get(w.id):null,C=w?.node.current;if(C&&S&&v&&w){const k=pu(C).some((F,I)=>d[I]!==F),N=RS(v,w),E=ZI(v,w),R=k||!N?{x:0,y:0}:{x:E?o.width-S.width:0,y:E?o.height-S.height:0},T={x:S.left,y:S.top};return R.x&&R.y?T:Ji(T,R)}}}};function RS(e,t){return!vc(e)||!vc(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ZI(e,t){return!vc(e)||!vc(t)||!RS(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const gn={todo:{label:"To Do",icon:zy,color:"text-zinc-400",bgColor:"bg-zinc-400"},in_progress:{label:"In Progress",icon:By,color:"text-amber-500",bgColor:"bg-amber-500"},done:{label:"Done",icon:w2,color:"text-emerald-500",bgColor:"bg-emerald-500"},closed:{label:"Closed",icon:b2,color:"text-violet-500",bgColor:"bg-violet-500"},archived:{label:"Archived",icon:v2,color:"text-zinc-500",bgColor:"bg-zinc-500"}},JI=["todo","in_progress","done","closed"],eO=["todo","in_progress","done"],Ts={low:{label:"Low",color:"text-zinc-400",dotColor:"bg-zinc-400"},medium:{label:"Medium",color:"text-yellow-500",dotColor:"bg-yellow-500"},high:{label:"High",color:"text-orange-500",dotColor:"bg-orange-500"},urgent:{label:"Urgent",color:"text-red-500",dotColor:"bg-red-500"}};function tO({task:e,onOpen:t,onToggle:r,subtaskCount:o,subtaskDone:i}){const{attributes:c,listeners:u,setNodeRef:d,transform:h,transition:g,isDragging:x}=QI({id:e.id,data:{task:e,type:"task"}}),v={transform:ss.Transform.toString(h),transition:g,opacity:x?.4:1},w=Ts[e.priority]||Ts.medium;return gn[e.status]||gn.todo,a.jsx("div",{ref:d,style:v,className:"group relative rounded-lg border border-border/50 bg-card p-3 card-hover cursor-pointer",onClick:()=>t(e),"data-testid":`kanban-card-${e.id}`,children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-1 cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition-colors shrink-0 opacity-0 group-hover:opacity-100",...c,...u,onClick:S=>S.stopPropagation(),children:a.jsx(M2,{className:"w-3.5 h-3.5"})}),a.jsx(iu,{checked:e.status==="done",onCheckedChange:()=>r(e),className:"mt-0.5 shrink-0",onClick:S=>S.stopPropagation(),"data-testid":`checkbox-task-${e.id}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`text-[13px] font-medium leading-tight ${e.status==="done"?"line-through text-muted-foreground":"text-foreground"}`,children:e.title}),e.description&&a.jsx("p",{className:"text-[11px] text-muted-foreground/70 mt-1 line-clamp-2 leading-relaxed",children:e.description.replace(/[#*_`\[\]]/g,"").slice(0,120)}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-2 flex-wrap",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${w.dotColor} shrink-0`}),e.dueDate&&a.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-0.5",children:[a.jsx(Fy,{className:"w-2.5 h-2.5"}),new Date(e.dueDate).toLocaleDateString("en-US",{month:"short",day:"numeric"})]}),e.tags.length>0&&e.tags.slice(0,2).map(S=>a.jsx(et,{variant:"secondary",className:"text-[9px] px-1 py-0 h-3.5 font-normal",children:S},S)),o>0&&a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[i,"/",o]})]})]})]})})}function nO({status:e,tasks:t,allTasks:r,onOpen:o,onToggle:i,onAddTask:c}){const u=gn[e]||gn.todo,d=u.icon,{setNodeRef:h,isOver:g}=SS({id:`column-${e}`});return a.jsxs("div",{className:"flex-1 min-w-[280px] max-w-[360px] flex flex-col",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3 px-1",children:[a.jsx(d,{className:`w-4 h-4 ${u.color}`}),a.jsx("span",{className:"text-xs font-semibold tracking-wide uppercase text-muted-foreground",children:u.label}),a.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-0.5",children:t.length}),a.jsx(pe,{variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto text-muted-foreground/50 hover:text-foreground",onClick:()=>c(e),"data-testid":`button-add-task-${e}`,children:a.jsx(yr,{className:"w-3 h-3"})})]}),a.jsx("div",{ref:h,className:`flex-1 rounded-lg transition-colors ${g?"bg-primary/5 ring-1 ring-primary/20":""}`,children:a.jsx(Is,{className:"h-[calc(100vh-180px)]",children:a.jsx(BI,{items:t.map(x=>x.id),strategy:$I,children:a.jsxs("div",{className:"space-y-2 pr-2 pb-8",children:[t.map(x=>{const v=r.filter(w=>w.parentId===x.id);return a.jsx(tO,{task:x,onOpen:o,onToggle:i,subtaskCount:v.length,subtaskDone:v.filter(w=>w.status==="done").length},x.id)}),t.length===0&&a.jsxs("div",{className:"text-center py-8",children:[a.jsx(d,{className:`w-5 h-5 ${u.color} opacity-20 mx-auto mb-1.5`}),a.jsx("p",{className:"text-[11px] text-muted-foreground/30",children:"No tasks"})]})]})})})})]})}function rO({task:e,allTasks:t,open:r,onClose:o,onUpdate:i,onDelete:c}){const[u,d]=p.useState(!1),[h,g]=p.useState(""),[x,v]=p.useState(""),[w,S]=p.useState(""),[C,b]=p.useState(""),[k,N]=p.useState(""),[E,R]=p.useState(""),T=p.useCallback(()=>{e&&(g(e.title),v(e.description),S(e.status),b(e.priority),N(e.dueDate||""),R(e.tags.join(", ")),d(!0))},[e]),M=()=>{e&&(i({id:e.id,title:h,description:x,status:w,priority:C,dueDate:k||null,tags:E.split(",").map(U=>U.trim()).filter(Boolean)}),d(!1))};if(!e)return null;const F=gn[e.status]||gn.todo,I=Ts[e.priority]||Ts.medium,O=F.icon,q=t.filter(U=>U.parentId===e.id);return a.jsx(dw,{open:r,onOpenChange:U=>{U||(d(!1),o())},children:a.jsxs(Kp,{side:"right",className:"w-full sm:max-w-lg p-0 flex flex-col overflow-hidden border-l border-border/50",children:[a.jsxs(qp,{className:"sr-only",children:[a.jsx(Qp,{children:e.title}),a.jsx(Gp,{children:"Task details"})]}),a.jsxs("div",{className:"flex items-center gap-2 px-5 h-14 border-b border-border/50 shrink-0",children:[a.jsx(O,{className:`w-4 h-4 ${F.color} shrink-0`}),a.jsx("span",{className:"text-xs text-muted-foreground",children:F.label}),a.jsx("div",{className:"ml-auto flex items-center gap-1",children:u?a.jsxs(a.Fragment,{children:[a.jsx(pe,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>d(!1),children:"Cancel"}),a.jsxs(pe,{size:"sm",className:"h-7 text-xs gap-1",onClick:M,"data-testid":"button-save-task",children:[a.jsx(Hy,{className:"w-3 h-3"})," Save"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs(pe,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1",onClick:T,"data-testid":"button-edit-task",children:[a.jsx(zf,{className:"w-3 h-3"})," Edit"]}),a.jsxs(eu,{children:[a.jsx(tu,{asChild:!0,children:a.jsx(pe,{variant:"ghost",size:"icon",className:"h-7 w-7",children:a.jsx(Np,{className:"w-3.5 h-3.5"})})}),a.jsxs(da,{align:"end",children:[Object.entries(gn).map(([U,G])=>a.jsxs(Ln,{onClick:()=>i({id:e.id,status:U}),className:"text-xs gap-2",children:[a.jsx(G.icon,{className:`w-3.5 h-3.5 ${G.color}`}),"Move to ",G.label]},U)),a.jsx(fa,{}),a.jsxs(Ln,{onClick:()=>c(e.id),className:"text-xs text-destructive gap-2",children:[a.jsx(is,{className:"w-3.5 h-3.5"}),"Delete task"]})]})]})]})})]}),a.jsx(Is,{className:"flex-1",children:a.jsxs("div",{className:"px-5 py-5 space-y-5",children:[u?a.jsx(Ge,{value:h,onChange:U=>g(U.target.value),className:"text-base font-semibold border-0 bg-transparent px-0 focus-visible:ring-0 h-auto",placeholder:"Task title","data-testid":"input-edit-task-title"}):a.jsx("h2",{className:`text-base font-semibold ${e.status==="done"?"line-through text-muted-foreground":""}`,children:e.title}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 font-medium",children:"Status"}),u?a.jsxs(_o,{value:w,onValueChange:S,children:[a.jsx($s,{className:"h-8 text-xs",children:a.jsx(Ao,{})}),a.jsx(zs,{children:Object.entries(gn).map(([U,G])=>a.jsx(Sr,{value:U,children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(G.icon,{className:`w-3 h-3 ${G.color}`}),G.label]})},U))})]}):a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(O,{className:`w-3.5 h-3.5 ${F.color}`}),a.jsx("span",{className:"text-xs",children:F.label})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 font-medium",children:"Priority"}),u?a.jsxs(_o,{value:C,onValueChange:b,children:[a.jsx($s,{className:"h-8 text-xs",children:a.jsx(Ao,{})}),a.jsx(zs,{children:Object.entries(Ts).map(([U,G])=>a.jsx(Sr,{value:U,children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:`w-2 h-2 rounded-full ${G.dotColor}`}),G.label]})},U))})]}):a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(T2,{className:`w-3.5 h-3.5 ${I.color}`}),a.jsx("span",{className:"text-xs",children:I.label})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 font-medium",children:"Due Date"}),u?a.jsx(Ge,{type:"date",value:k,onChange:U=>N(U.target.value),className:"h-8 text-xs"}):a.jsx("span",{className:"text-xs text-muted-foreground",children:e.dueDate?new Date(e.dueDate).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}):"No date"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 font-medium",children:"Tags"}),u?a.jsx(Ge,{value:E,onChange:U=>R(U.target.value),placeholder:"tag1, tag2",className:"h-8 text-xs"}):a.jsx("div",{className:"flex flex-wrap gap-1",children:e.tags.length>0?e.tags.map(U=>a.jsxs(et,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-4 font-normal gap-1",children:[a.jsx(qy,{className:"w-2 h-2"}),U]},U)):a.jsx("span",{className:"text-xs text-muted-foreground",children:"No tags"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 font-medium",children:"Description"}),u?a.jsx(pa,{value:x,onChange:U=>v(U.target.value),placeholder:"Add a description (supports markdown)...",className:"min-h-[200px] text-sm font-mono resize-none","data-testid":"input-edit-task-desc"}):e.description?a.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none text-sm [&_img]:rounded-lg [&_img]:max-w-full [&_p]:mb-2 [&_ul]:mb-2 [&_ol]:mb-2 [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:text-xs",dangerouslySetInnerHTML:{__html:ze.parse(e.description)}}):a.jsx("p",{className:"text-sm text-muted-foreground/50 italic",children:"No description"})]}),q.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 font-medium",children:["Subtasks (",q.filter(U=>U.status==="done").length,"/",q.length,")"]}),a.jsx("div",{className:"space-y-1",children:q.map(U=>a.jsxs("div",{className:"flex items-center gap-2 py-1",children:[a.jsx(iu,{checked:U.status==="done",onCheckedChange:()=>i({id:U.id,status:U.status==="done"?"todo":"done"}),className:"shrink-0"}),a.jsx("span",{className:`text-xs ${U.status==="done"?"line-through text-muted-foreground":""}`,children:U.title})]},U.id))})]}),a.jsxs("div",{className:"border-t border-border/30 pt-4 space-y-1",children:[a.jsxs("p",{className:"text-[10px] text-muted-foreground/50",children:["Created ",new Date(e.createdAt).toLocaleString()]}),a.jsxs("p",{className:"text-[10px] text-muted-foreground/50",children:["Updated ",new Date(e.updatedAt).toLocaleString()]}),e.completedAt&&a.jsxs("p",{className:"text-[10px] text-muted-foreground/50",children:["Completed ",new Date(e.completedAt).toLocaleString()]})]})]})})]})})}function sO(){const[e,t]=p.useState("list"),[r,o]=p.useState(null),[i,c]=p.useState(new Set(eO)),[u,d]=p.useState(!0),h=np({defaultWidth:420,minWidth:280,maxWidth:800,storageKey:"cortex-tasks-chat-width",reverse:!0}),[g,x]=p.useState(null),v=rn(),{toast:w}=os(),{vaultParam:S,vaultId:C}=yn(),b=yA(Nv(Eh,{activationConstraint:{distance:5}}),Nv(Nh,{coordinateGetter:XI})),{data:k=[]}=it({queryKey:["/api/tasks",C],queryFn:()=>je("GET",Oe("/api/tasks",S)).then($=>$.json()),staleTime:0,refetchOnMount:"always",enabled:!!C}),N=Ct({mutationFn:$=>je("POST",Oe("/api/tasks",S),$).then(z=>z.json()),onSuccess:()=>{v.invalidateQueries({queryKey:["/api/tasks"]}),w({title:"Task created"})}}),E=Ct({mutationFn:({id:$,...z})=>je("PATCH",Oe(`/api/tasks/${$}`,S),z).then(B=>B.json()),onSuccess:$=>{v.invalidateQueries({queryKey:["/api/tasks"]}),r&&$&&$.id===r.id&&o($)}}),R=Ct({mutationFn:$=>je("POST",Oe("/api/tasks/reorder",S),$),onSuccess:()=>{v.invalidateQueries({queryKey:["/api/tasks"]})}}),T=Ct({mutationFn:$=>je("DELETE",Oe(`/api/tasks/${$}`,S)),onSuccess:()=>{v.invalidateQueries({queryKey:["/api/tasks"]}),o(null),w({title:"Task deleted"})}});p.useEffect(()=>{if(!r)return;const $=k.find(z=>z.id===r.id);$&&$.updatedAt!==r.updatedAt&&o($)},[k]);const M=p.useCallback($=>{E.mutate({id:$.id,status:$.status==="done"?"todo":"done"})},[E]),F=p.useCallback($=>{c(z=>{const B=new Set(z);return B.has($)?B.size>1&&B.delete($):B.add($),B})},[]),I=p.useMemo(()=>{const $={};for(const z of JI)i.has(z)&&($[z]=[]);return k.filter(z=>!z.parentId&&i.has(z.status)).sort((z,B)=>z.order-B.order).forEach(z=>{$[z.status]&&$[z.status].push(z)}),$},[k,i]),O=p.useMemo(()=>k.filter($=>i.has($.status)).sort(($,z)=>$.order-z.order),[k,i]),q=O.filter($=>!$.parentId),U=$=>O.filter(z=>z.parentId===$),G=$=>{x($.active.id)},_=$=>{const{active:z,over:B}=$;if(x(null),!B)return;const Y=k.find(Z=>Z.id===z.id);if(!Y)return;let D=null;const K=B.id;if(K.startsWith("column-"))D=K.replace("column-","");else{const Z=k.find(H=>H.id===K);Z&&(D=Z.status)}if(!D)return;Y.status!==D&&E.mutate({id:Y.id,status:D});const ue=k.filter(Z=>!Z.parentId&&(Z.id===Y.id?D:Z.status)===D).sort((Z,H)=>Z.order-H.order),ge=ue.findIndex(Z=>Z.id===Y.id),Ce=k.find(Z=>Z.id===K),fe=Ce?ue.findIndex(Z=>Z.id===Ce.id):ue.length-1;if(ge!==fe&&fe>=0){const Z=[...ue],[H]=Z.splice(ge,1);H&&Z.splice(fe,0,H),R.mutate({taskIds:Z.map(ne=>ne.id)})}},ee=$=>{},X=g?k.find($=>$.id===g):null,he=$=>{N.mutate({title:"Untitled Task",status:$})},ie=($,z=0)=>{const B=U($.id),Y=gn[$.status]||gn.todo,D=Ts[$.priority]||Ts.medium,K=Y.icon;return a.jsxs("div",{style:{paddingLeft:z*24},children:[a.jsxs("div",{className:"group flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>o($),"data-testid":`task-item-${$.id}`,children:[a.jsx(iu,{checked:$.status==="done",onCheckedChange:()=>M($),className:"shrink-0",onClick:ue=>ue.stopPropagation(),"data-testid":`checkbox-task-${$.id}`}),a.jsx(K,{className:`w-3.5 h-3.5 ${Y.color} shrink-0`}),a.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:`text-[13px] font-medium truncate ${$.status==="done"?"line-through text-muted-foreground":"text-foreground"}`,children:$.title}),$.description&&a.jsxs(a.Fragment,{children:[a.jsx(On,{className:"w-3 h-3 text-muted-foreground/30 shrink-0"}),a.jsx("span",{className:"text-[11px] text-muted-foreground/50 truncate",children:$.description.replace(/[#*_`\[\]]/g,"").slice(0,60)})]})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${D.dotColor}`,title:D.label}),$.tags.length>0&&a.jsxs(et,{variant:"secondary",className:"text-[9px] px-1 py-0 h-3.5 font-normal",children:[$.tags[0],$.tags.length>1?` +${$.tags.length-1}`:""]}),$.dueDate&&a.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-0.5",children:[a.jsx(Fy,{className:"w-2.5 h-2.5"}),new Date($.dueDate).toLocaleDateString("en-US",{month:"short",day:"numeric"})]}),B.length>0&&a.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:[B.filter(ue=>ue.status==="done").length,"/",B.length]})]})]}),B.map(ue=>ie(ue,z+1))]},$.id)};return a.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[a.jsxs("header",{className:"flex items-center gap-2 px-4 h-12 border-b border-border/50 shrink-0",children:[a.jsx(As,{}),a.jsx(ts,{className:"w-4 h-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:"Tasks"}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsxs(a1,{children:[a.jsx(l1,{asChild:!0,children:a.jsxs(pe,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5",children:[a.jsx(R2,{className:"w-3 h-3"}),a.jsx("span",{children:"Filter"}),i.size<Object.keys(gn).length&&a.jsx(et,{variant:"secondary",className:"text-[9px] px-1 py-0 h-3.5 font-normal ml-0.5",children:i.size})]})}),a.jsx(xh,{align:"end",className:"w-48 p-1",children:Object.entries(gn).map(([$,z])=>{const B=i.has($);return a.jsxs("button",{onClick:()=>F($),className:"flex items-center gap-2 w-full px-2.5 py-1.5 text-xs rounded-md hover:bg-muted/60 transition-colors","data-testid":`filter-status-${$}`,children:[a.jsx("span",{className:`w-3.5 h-3.5 rounded border flex items-center justify-center transition-colors ${B?"bg-primary border-primary text-primary-foreground":"border-border"}`,children:B&&a.jsx(xr,{className:"w-2.5 h-2.5"})}),a.jsx(z.icon,{className:`w-3 h-3 ${z.color}`}),a.jsx("span",{className:"flex-1 text-left",children:z.label})]},$)})})]}),a.jsxs("div",{className:"flex rounded-md border border-border/50",children:[a.jsx(pe,{size:"sm",variant:e==="kanban"?"secondary":"ghost",className:"h-7 text-xs px-2 rounded-r-none",onClick:()=>t("kanban"),children:a.jsx(O2,{className:"w-3 h-3"})}),a.jsx(pe,{size:"sm",variant:e==="list"?"secondary":"ghost",className:"h-7 text-xs px-2 rounded-l-none",onClick:()=>t("list"),children:a.jsx(Ep,{className:"w-3 h-3"})})]}),a.jsxs(pe,{size:"sm",variant:u?"secondary":"ghost",className:"text-xs gap-1",onClick:()=>d(!u),"data-testid":"button-toggle-chat",children:[a.jsx(kr,{className:"w-3.5 h-3.5"})," AI"]}),a.jsxs(pe,{size:"sm",variant:"default",className:"text-xs gap-1",onClick:()=>N.mutate({title:"Untitled Task"}),"data-testid":"button-new-task",children:[a.jsx(yr,{className:"w-3.5 h-3.5"})," New Task"]})]})]}),a.jsxs("div",{className:"flex-1 flex min-h-0",children:[a.jsx("div",{className:"flex-1 overflow-auto p-4",children:e==="kanban"?a.jsxs(xI,{sensors:b,collisionDetection:oS,onDragStart:G,onDragEnd:_,onDragOver:ee,children:[a.jsx("div",{className:"flex gap-4 h-full",children:Object.keys(I).map($=>a.jsx(nO,{status:$,tasks:I[$]||[],allTasks:k,onOpen:o,onToggle:M,onAddTask:he},$))}),a.jsx(II,{children:X?a.jsxs("div",{className:"rounded-lg border border-primary/30 bg-card p-3 shadow-lg w-[280px] opacity-90",children:[a.jsx("p",{className:"text-[13px] font-medium",children:X.title}),X.description&&a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1 line-clamp-1",children:X.description.slice(0,60)})]}):null})]}):a.jsxs("div",{className:"max-w-3xl mx-auto",children:[q.length===0&&a.jsxs("div",{className:"text-center py-16",children:[a.jsx(ts,{className:"w-10 h-10 text-muted-foreground/30 mx-auto mb-3"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"No tasks yet. Create one to get started."})]}),q.map($=>ie($))]})}),u&&a.jsx(rp,{onMouseDown:h.onMouseDown,isResizing:h.isResizing}),a.jsx(u1,{open:u,onClose:()=>d(!1),width:h.width,context:O.filter($=>$.status!=="archived").slice(0,20).map($=>({type:"task",title:$.title,content:`Status: ${$.status} | Priority: ${$.priority}${$.description?" | "+$.description:""}${$.dueDate?" | Due: "+$.dueDate:""}`,id:$.id})),placeholder:"Ask about your tasks..."})]}),a.jsx(rO,{task:r,allTasks:k,open:!!r,onClose:()=>o(null),onUpdate:$=>E.mutate($),onDelete:$=>T.mutate($)})]})}const mn=p.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:ve("shadcn-card rounded-xl border bg-card border-card-border text-card-foreground shadow-sm",e),...t}));mn.displayName="Card";const oO=p.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:ve("flex flex-col space-y-1.5 p-6",e),...t}));oO.displayName="CardHeader";const iO=p.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:ve("text-2xl font-semibold leading-none tracking-tight",e),...t}));iO.displayName="CardTitle";const aO=p.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:ve("text-sm text-muted-foreground",e),...t}));aO.displayName="CardDescription";const TS=p.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:ve("p-6 pt-0",e),...t}));TS.displayName="CardContent";const lO=p.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:ve("flex items-center p-6 pt-0",e),...t}));lO.displayName="CardFooter";const cO={note:{icon:tn,color:"text-emerald-500",bg:"bg-emerald-500/10",label:"Note"},task:{icon:ts,color:"text-blue-500",bg:"bg-blue-500/10",label:"Task"},chat:{icon:kr,color:"text-purple-500",bg:"bg-purple-500/10",label:"Chat"}};function uO(){const[e,t]=p.useState(""),[,r]=Oo(),{vaultParam:o,vaultId:i}=yn(),{data:c=[],isLoading:u}=it({queryKey:["/api/search",e,i],queryFn:()=>e.length>=2?je("GET",Oe(`/api/search?q=${encodeURIComponent(e)}`,o)).then(h=>h.json()):Promise.resolve([]),enabled:e.length>=2&&!!i}),d=h=>{switch(h.type){case"note":r("/notes");break;case"task":r("/tasks");break;case"chat":r(`/chat/${h.id}`);break}};return a.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[a.jsxs("header",{className:"flex items-center gap-2 px-4 h-12 border-b border-border/50 shrink-0",children:[a.jsx(As,{}),a.jsx(Rs,{className:"w-4 h-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:"Search"})]}),a.jsx("div",{className:"flex-1 overflow-auto",children:a.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-8",children:[a.jsxs("div",{className:"relative mb-8",children:[a.jsx(Rs,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),a.jsx(Ge,{placeholder:"Search notes, tasks, and conversations...",className:"h-11 pl-10 text-sm bg-muted/50 border-border/50 focus-visible:border-primary/50",value:e,onChange:h=>t(h.target.value),autoFocus:!0,"data-testid":"input-search"})]}),e.length<2&&a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Rs,{className:"w-10 h-10 text-muted-foreground/20 mx-auto mb-3"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Type at least 2 characters to search"}),a.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Searches across all notes, tasks, and chat history"})]}),e.length>=2&&c.length===0&&!u&&a.jsx("div",{className:"text-center py-12",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:['No results for "',e,'"']})}),a.jsx("div",{className:"space-y-2",children:c.map(h=>{const g=cO[h.type],x=g.icon;return a.jsx(mn,{className:"p-3 cursor-pointer hover:border-primary/30 transition-colors",onClick:()=>d(h),"data-testid":`search-result-${h.id}`,children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:`w-8 h-8 rounded-lg ${g.bg} flex items-center justify-center shrink-0`,children:a.jsx(x,{className:`w-4 h-4 ${g.color}`})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-sm font-medium",children:h.title}),a.jsx(et,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-3.5",children:g.label})]}),a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:h.snippet}),h.path&&a.jsx("span",{className:"text-[9px] text-muted-foreground/60",children:h.path})]}),a.jsxs("span",{className:"text-[9px] text-muted-foreground/40 shrink-0",children:[Math.round(h.score*100),"%"]})]})},`${h.type}-${h.id}`)})})]})})]})}var gu="Switch",[dO]=Qt(gu),[fO,pO]=dO(gu),PS=p.forwardRef((e,t)=>{const{__scopeSwitch:r,name:o,checked:i,defaultChecked:c,required:u,disabled:d,value:h="on",onCheckedChange:g,form:x,...v}=e,[w,S]=p.useState(null),C=_e(t,R=>S(R)),b=p.useRef(!1),k=w?x||!!w.closest("form"):!0,[N,E]=Fn({prop:i,defaultProp:c??!1,onChange:g,caller:gu});return a.jsxs(fO,{scope:r,checked:N,disabled:d,children:[a.jsx(Ne.button,{type:"button",role:"switch","aria-checked":N,"aria-required":u,"data-state":AS(N),"data-disabled":d?"":void 0,disabled:d,value:h,...v,ref:C,onClick:le(e.onClick,R=>{E(T=>!T),k&&(b.current=R.isPropagationStopped(),b.current||R.stopPropagation())})}),k&&a.jsx(_S,{control:w,bubbles:!b.current,name:o,value:h,checked:N,required:u,disabled:d,form:x,style:{transform:"translateX(-100%)"}})]})});PS.displayName=gu;var MS="SwitchThumb",DS=p.forwardRef((e,t)=>{const{__scopeSwitch:r,...o}=e,i=pO(MS,r);return a.jsx(Ne.span,{"data-state":AS(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t})});DS.displayName=MS;var hO="SwitchBubbleInput",_S=p.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:o=!0,...i},c)=>{const u=p.useRef(null),d=_e(u,c),h=vh(r),g=Lp(t);return p.useEffect(()=>{const x=u.current;if(!x)return;const v=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(v,"checked").set;if(h!==r&&S){const C=new Event("click",{bubbles:o});S.call(x,r),x.dispatchEvent(C)}},[h,r,o]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:d,style:{...i.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});_S.displayName=hO;function AS(e){return e?"checked":"unchecked"}var IS=PS,mO=DS;const xu=p.forwardRef(({className:e,...t},r)=>a.jsx(IS,{className:ve("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:a.jsx(mO,{className:ve("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));xu.displayName=IS.displayName;var gO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xO=gO.reduce((e,t)=>{const r=Bp(`Primitive.${t}`),o=p.forwardRef((i,c)=>{const{asChild:u,...d}=i,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(h,{...d,ref:c})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),vO="Label",OS=p.forwardRef((e,t)=>a.jsx(xO.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));OS.displayName=vO;var LS=OS;const yO=$o("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),tt=p.forwardRef(({className:e,...t},r)=>a.jsx(LS,{ref:r,className:ve(yO(),e),...t}));tt.displayName=LS.displayName;var vu="Tabs",[wO]=Qt(vu,[Yc]),FS=Yc(),[bO,Th]=wO(vu),$S=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:c,orientation:u="horizontal",dir:d,activationMode:h="automatic",...g}=e,x=aa(d),[v,w]=Fn({prop:o,onChange:i,defaultProp:c??"",caller:vu});return a.jsx(bO,{scope:r,baseId:xn(),value:v,onValueChange:w,orientation:u,dir:x,activationMode:h,children:a.jsx(Ne.div,{dir:x,"data-orientation":u,...g,ref:t})})});$S.displayName=vu;var zS="TabsList",BS=p.forwardRef((e,t)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,c=Th(zS,r),u=FS(r);return a.jsx($w,{asChild:!0,...u,orientation:c.orientation,dir:c.dir,loop:o,children:a.jsx(Ne.div,{role:"tablist","aria-orientation":c.orientation,...i,ref:t})})});BS.displayName=zS;var VS="TabsTrigger",US=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...c}=e,u=Th(VS,r),d=FS(r),h=KS(u.baseId,o),g=qS(u.baseId,o),x=o===u.value;return a.jsx(zw,{asChild:!0,...d,focusable:!i,active:x,children:a.jsx(Ne.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":g,"data-state":x?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:h,...c,ref:t,onMouseDown:le(e.onMouseDown,v=>{!i&&v.button===0&&v.ctrlKey===!1?u.onValueChange(o):v.preventDefault()}),onKeyDown:le(e.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&u.onValueChange(o)}),onFocus:le(e.onFocus,()=>{const v=u.activationMode!=="manual";!x&&!i&&v&&u.onValueChange(o)})})})});US.displayName=VS;var HS="TabsContent",WS=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,forceMount:i,children:c,...u}=e,d=Th(HS,r),h=KS(d.baseId,o),g=qS(d.baseId,o),x=o===d.value,v=p.useRef(x);return p.useEffect(()=>{const w=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(w)},[]),a.jsx(bt,{present:i||x,children:({present:w})=>a.jsx(Ne.div,{"data-state":x?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":h,hidden:!w,id:g,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:v.current?"0s":void 0},children:w&&c})})});WS.displayName=HS;function KS(e,t){return`${e}-trigger-${t}`}function qS(e,t){return`${e}-content-${t}`}var SO=$S,QS=BS,GS=US,YS=WS;const kO=SO,XS=p.forwardRef(({className:e,...t},r)=>a.jsx(QS,{ref:r,className:ve("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));XS.displayName=QS.displayName;const wo=p.forwardRef(({className:e,...t},r)=>a.jsx(GS,{ref:r,className:ve("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));wo.displayName=GS.displayName;const bo=p.forwardRef(({className:e,...t},r)=>a.jsx(YS,{ref:r,className:ve("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));bo.displayName=YS.displayName;const Rf=[{id:"openai",name:"OpenAI",keyPrefix:"sk-",placeholder:"sk-...",docsUrl:"https://platform.openai.com/api-keys",color:"text-green-400"},{id:"anthropic",name:"Anthropic (Claude)",keyPrefix:"sk-ant-",placeholder:"sk-ant-...",docsUrl:"https://console.anthropic.com/settings/keys",color:"text-orange-400"},{id:"grok",name:"xAI (Grok)",keyPrefix:"xai-",placeholder:"xai-...",docsUrl:"https://console.x.ai/",color:"text-blue-400"},{id:"google",name:"Google (Gemini)",keyPrefix:"AI",placeholder:"AIza...",docsUrl:"https://aistudio.google.com/apikey",color:"text-yellow-400"}];function ZS({open:e,onOpenChange:t,mode:r="dialog"}){const o=a.jsx(CO,{onDone:()=>t(!1),mode:r});return r==="inline"?o:a.jsx(Vi,{open:e,onOpenChange:t,children:a.jsxs(No,{className:"sm:max-w-lg",children:[a.jsxs(jo,{children:[a.jsxs(Eo,{className:"flex items-center gap-2",children:[a.jsx(I2,{className:"w-5 h-5 text-primary"}),"Welcome to Cortex"]}),a.jsx(Ib,{children:"To get started, add at least one AI provider API key. Your key is stored locally in your data directory — never sent anywhere except the provider's API."})]}),o]})})}function CO({onDone:e,mode:t}){const{toast:r}=os(),o=rn(),{data:i}=it({queryKey:["/api/keys"],queryFn:()=>je("GET","/api/keys").then(R=>R.json())}),[c,u]=p.useState(null),[d,h]=p.useState({}),[g,x]=p.useState({}),[v,w]=p.useState(null),[S,C]=p.useState({}),b=Ct({mutationFn:R=>je("PATCH","/api/keys",R).then(T=>T.json()),onSuccess:()=>{o.invalidateQueries({queryKey:["/api/keys"]}),o.invalidateQueries({queryKey:["/api/info"]}),o.invalidateQueries({queryKey:["/api/config"]})}}),k=async(R,T)=>{w(R),C(M=>({...M,[R]:void 0}));try{const F=await(await je("POST","/api/keys/verify",{provider:R,key:T})).json();C(I=>({...I,[R]:F})),F.valid?(await b.mutateAsync({[R]:T}),h(I=>({...I,[R]:""})),u(null),r({title:"Key verified and saved",description:F.warning||`${Rf.find(I=>I.id===R)?.name} is ready to use.`})):r({title:"Invalid key",description:F.error||"The key could not be verified.",variant:"destructive"})}catch(M){C(F=>({...F,[R]:{valid:!1,error:M.message}})),r({title:"Verification failed",description:M.message,variant:"destructive"})}finally{w(null)}},N=async R=>{await b.mutateAsync({[R]:""}),C(T=>{const M={...T};return delete M[R],M}),r({title:"Key removed",description:`${Rf.find(T=>T.id===R)?.name} key has been removed.`})},E=i?Object.values(i).some(R=>R.set):!1;return a.jsxs("div",{className:"space-y-3",children:[Rf.map(R=>{const T=i?.[R.id],M=T?.set,F=c===R.id,I=d[R.id]||"",O=v===R.id,q=S[R.id];return a.jsxs("div",{className:"border border-border/50 rounded-lg overflow-hidden",children:[a.jsxs("button",{className:"w-full flex items-center gap-3 p-3 hover:bg-muted/30 transition-colors text-left",onClick:()=>u(F?null:R.id),children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`text-sm font-medium ${R.color}`,children:R.name}),M&&a.jsxs(et,{variant:"default",className:"text-[9px] px-1.5 py-0 h-3.5 bg-green-500/20 text-green-400 border-green-500/30",children:[a.jsx(xr,{className:"w-2.5 h-2.5 mr-0.5"}),T?.source==="env"?"From env":"Configured"]})]}),M&&T?.masked&&a.jsx("p",{className:"text-[10px] text-muted-foreground font-mono mt-0.5",children:T.masked})]}),F?a.jsx($y,{className:"w-4 h-4 text-muted-foreground shrink-0"}):a.jsx(vr,{className:"w-4 h-4 text-muted-foreground shrink-0"})]}),F&&a.jsxs("div",{className:"px-3 pb-3 space-y-2 border-t border-border/30 pt-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Ge,{className:"text-xs h-8 font-mono pr-8",type:g[R.id]?"text":"password",placeholder:R.placeholder,value:I,onChange:U=>h(G=>({...G,[R.id]:U.target.value})),onKeyDown:U=>{U.key==="Enter"&&I.trim()&&k(R.id,I.trim())},autoFocus:!0}),a.jsx("button",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>x(U=>({...U,[R.id]:!U[R.id]})),type:"button",children:g[R.id]?a.jsx(Vy,{className:"w-3.5 h-3.5"}):a.jsx(Ec,{className:"w-3.5 h-3.5"})})]}),a.jsxs(pe,{size:"sm",className:"h-8 text-xs px-3",onClick:()=>k(R.id,I.trim()),disabled:!I.trim()||O,children:[O?a.jsx(Es,{className:"w-3 h-3 animate-spin mr-1"}):a.jsx(xr,{className:"w-3 h-3 mr-1"}),"Verify & Save"]})]}),q&&!q.valid&&a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-red-400",children:[a.jsx(er,{className:"w-3 h-3 shrink-0"}),q.error||"Key is invalid"]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("a",{href:R.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-primary hover:underline flex items-center gap-1",children:["Get an API key",a.jsx(jc,{className:"w-2.5 h-2.5"})]}),M&&a.jsx(pe,{size:"sm",variant:"ghost",className:"h-6 text-[10px] px-2 text-muted-foreground hover:text-destructive",onClick:()=>N(R.id),children:"Remove key"})]})]})]},R.id)}),a.jsxs("div",{className:"flex items-start gap-2 pt-1",children:[a.jsx(Z2,{className:"w-3.5 h-3.5 text-muted-foreground mt-0.5 shrink-0"}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Keys are stored in your local config.json file. They are only sent to the respective provider's API. Environment variables are also supported and take lower priority."})]}),t==="dialog"&&a.jsx("div",{className:"flex justify-end pt-2",children:a.jsx(pe,{size:"sm",onClick:e,disabled:!E,className:"text-xs",children:E?"Get Started":"Add at least one key to continue"})})]})}function NO(){const{data:e,isLoading:t}=it({queryKey:["/api/info"],queryFn:()=>je("GET","/api/info").then(r=>r.json())});return{needsSetup:!t&&e&&!e.hasApiKey,isLoading:t}}async function JS(e){const t=window.cortexDesktop;t?.openFolder?await t.openFolder(e):await je("POST","/api/open-folder",{folderPath:e})}const ek=["core","browser","research","writing","productivity","custom"],tk={core:"Core",browser:"Browser",research:"Research",writing:"Writing",productivity:"Productivity",custom:"Custom"},jO={core:"Essential tools — always available",browser:"Web browsing and automation",research:"Search and deep research",writing:"Drafting and summarization",productivity:"Planning, code, and meetings",custom:"User-created skills"},nk=["Always","High","Medium","Low"],rk=["bg-green-500","bg-blue-500","bg-yellow-500","bg-gray-400"];function EO(){const{toast:e}=os(),t=rn(),{vaults:r,activeVault:o,vaultParam:i,vaultId:c,refetchVaults:u}=yn(),{data:d}=it({queryKey:["/api/config"],queryFn:()=>je("GET","/api/config").then(E=>E.json())}),{data:h}=it({queryKey:["/api/info"],queryFn:()=>je("GET","/api/info").then(E=>E.json())}),{data:g=[]}=it({queryKey:["/api/skills",c],queryFn:()=>je("GET",Oe("/api/skills",i)).then(E=>E.json()),enabled:!!c}),x=Ct({mutationFn:E=>je("PATCH","/api/config",E).then(R=>R.json()),onSuccess:()=>{t.invalidateQueries({queryKey:["/api/config"]}),e({title:"Settings saved"})}}),v=Ct({mutationFn:E=>je("POST",Oe("/api/skills",i),{...E,enabled:!E.enabled}),onSuccess:()=>{t.invalidateQueries({queryKey:["/api/skills"]})}}),w=Ct({mutationFn:E=>je("POST",Oe("/api/skills",i),E),onSuccess:()=>{t.invalidateQueries({queryKey:["/api/skills"]}),e({title:"Skill saved"})}}),S=Ct({mutationFn:E=>je("DELETE",Oe(`/api/skills/${encodeURIComponent(E)}`,i)),onSuccess:()=>{t.invalidateQueries({queryKey:["/api/skills"]}),e({title:"Skill deleted"})}}),[C,b]=p.useState(null),[k,N]=p.useState(!1);return a.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[a.jsxs("header",{className:"flex items-center gap-2 px-4 h-12 border-b border-border/50 shrink-0",children:[a.jsx(As,{}),a.jsx(Wy,{className:"w-4 h-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:"Settings"})]}),a.jsx(Is,{className:"flex-1",children:a.jsx("div",{className:"max-w-2xl mx-auto px-4 py-6",children:a.jsxs(kO,{defaultValue:"mcp",children:[a.jsxs(XS,{className:"mb-6",children:[a.jsx(wo,{value:"mcp",className:"text-xs",children:"MCP Servers"}),a.jsx(wo,{value:"vaults",className:"text-xs",children:"Vaults"}),a.jsx(wo,{value:"general",className:"text-xs",children:"General"}),a.jsx(wo,{value:"skills",className:"text-xs",children:"Skills"}),a.jsx(wo,{value:"about",className:"text-xs",children:"About"})]}),a.jsxs(bo,{value:"mcp",className:"space-y-4",children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"MCP servers extend the AI agent with new capabilities — browser automation, file access, web search, and more. Connect popular servers below or add a custom one."}),a.jsx(MO,{config:d,updateConfig:x})]}),a.jsxs(bo,{value:"vaults",className:"space-y-4",children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Each vault is an independent workspace with its own notes, tasks, chats, and settings. Vaults map to folders on disk — you can point them anywhere."}),r.map(E=>a.jsx(RO,{vault:E,isActive:E.id===o?.id,onUpdated:()=>{u(),t.invalidateQueries({queryKey:["/api/vaults"]})}},E.id))]}),a.jsxs(bo,{value:"general",className:"space-y-6",children:[a.jsxs(mn,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(na,{className:"w-4 h-4 text-primary"}),a.jsx("h3",{className:"text-sm font-medium",children:"AI Provider Keys"}),h?.provider&&h.provider!=="none"&&a.jsxs(et,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-3.5 ml-auto",children:["Active: ",h.provider]})]}),a.jsx("p",{className:"text-[10px] text-muted-foreground mb-3",children:"Add API keys to connect AI providers. The first configured key determines the active provider."}),a.jsx(ZS,{open:!1,onOpenChange:()=>{},mode:"inline"}),a.jsxs("div",{className:"mt-3",children:[a.jsx(tt,{className:"text-xs text-muted-foreground",children:"Model Override"}),a.jsx(Ge,{className:"mt-1 text-sm h-8",placeholder:"Auto-detect",defaultValue:d?.aiModel||"",onBlur:E=>x.mutate({aiModel:E.target.value||void 0})}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Override the default model (e.g. gpt-4o, claude-sonnet-4-20250514, gemini-2.0-flash)."})]})]}),a.jsx(TO,{config:d,updateConfig:x}),a.jsxs(mn,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Qy,{className:"w-4 h-4 text-primary"}),a.jsx("h3",{className:"text-sm font-medium",children:"Search"})]}),a.jsxs("div",{children:[a.jsx(tt,{className:"text-xs text-muted-foreground",children:"Vector Search Backend"}),a.jsxs(_o,{value:d?.vectorSearch||"local",onValueChange:E=>x.mutate({vectorSearch:E}),children:[a.jsx($s,{className:"mt-1 text-sm h-8",children:a.jsx(Ao,{})}),a.jsxs(zs,{children:[a.jsx(Sr,{value:"local",children:"Local (keyword-based)"}),a.jsx(Sr,{value:"openai",children:"OpenAI Embeddings"})]})]})]})]}),a.jsxs(mn,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Rc,{className:"w-4 h-4 text-primary"}),a.jsx("h3",{className:"text-sm font-medium",children:"Storage"})]}),a.jsxs("div",{children:[a.jsx(tt,{className:"text-xs text-muted-foreground",children:"Data Root Directory"}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("code",{className:"text-xs bg-muted px-2 py-1 rounded font-mono flex-1 truncate",children:h?.dataDir||"~/.cortex-data"}),a.jsxs(pe,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>h?.dataDir&&JS(h.dataDir),disabled:!h?.dataDir,title:"Open in file manager",children:[a.jsx(jc,{className:"w-3 h-3"}),"Open"]})]}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Set CORTEX_DATA_DIR env variable to change. Individual vaults can override this with custom folder paths."})]})]})]}),a.jsx(bo,{value:"skills",className:"space-y-4",children:C||k?a.jsx(PO,{skill:C,onSave:E=>{w.mutate(E),b(null),N(!1)},onCancel:()=>{b(null),N(!1)}}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{children:a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Skills teach the AI agent how to behave. Drop .json files into your vault's skills/ directory to add custom skills.",o&&a.jsxs("span",{className:"ml-1 font-medium",children:["Vault: ",o.icon," ",o.name]})]})}),a.jsxs(pe,{size:"sm",variant:"outline",className:"h-7 text-xs shrink-0",onClick:()=>N(!0),children:[a.jsx(yr,{className:"w-3 h-3 mr-1.5"}),"New Skill"]})]}),ek.map(E=>{const R=g.filter(T=>(T.category||"custom")===E);return R.length===0?null:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:tk[E]||E}),a.jsx("span",{className:"text-[10px] text-muted-foreground",children:jO[E]})]}),a.jsx("div",{className:"space-y-2",children:R.map(T=>a.jsx(mn,{className:"p-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-2 h-2 rounded-full ${rk[T.priority??1]} shrink-0`,title:`Priority: ${nk[T.priority??1]}`}),a.jsx(Tp,{className:"w-3.5 h-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:T.name}),T.builtin&&a.jsx(et,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-3.5",children:"Built-in"}),T.instructionsOnly&&a.jsx(et,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-3.5",children:"Guide"}),a.jsxs(et,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-3.5",children:["v",T.version]})]}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:T.description}),a.jsxs("div",{className:"flex flex-wrap gap-1 mt-1.5",children:[T.tools?.map(M=>a.jsx(et,{variant:"secondary",className:"text-[9px] font-mono px-1.5 py-0 h-3.5",children:M.name},M.name)),(T.triggerKeywords||[]).slice(0,5).map(M=>a.jsx(et,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-3.5 text-blue-400 border-blue-400/30",children:M},M)),(T.triggerKeywords||[]).length>5&&a.jsxs(et,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-3.5 text-blue-400 border-blue-400/30",children:["+",T.triggerKeywords.length-5," more"]})]})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(pe,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>b(T),title:"Edit skill",children:a.jsx(Ky,{className:"w-3 h-3"})}),!T.builtin&&a.jsx(pe,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-destructive",onClick:()=>{confirm(`Delete skill "${T.name}"?`)&&S.mutate(T.name)},title:"Delete skill",children:a.jsx(is,{className:"w-3 h-3"})}),a.jsx(xu,{checked:T.enabled,onCheckedChange:()=>v.mutate(T),"data-testid":`switch-skill-${T.name}`})]})]})},T.name))})]},E)})]})}),a.jsx(bo,{value:"about",className:"space-y-4",children:a.jsxs(mn,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl bg-muted/40 flex items-center justify-center",children:a.jsx("img",{src:sc,alt:"Cortex",className:"w-7 h-7"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Cortex"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Personal AI Operating System"})]})]}),a.jsxs("div",{className:"space-y-2 text-xs text-muted-foreground",children:[a.jsxs("p",{children:["Version: ",h?.version||"1.0.0"]}),a.jsx("p",{children:"Data: All stored as plain JSON and Markdown files on your filesystem."}),a.jsx("p",{children:"Sync: Copy vault folders to OneDrive, Google Drive, or USB for portability."}),a.jsx("p",{children:"Privacy: Everything runs locally. AI calls go directly to your configured provider."})]})]})})]})})})]})}function RO({vault:e,isActive:t,onUpdated:r}){const{toast:o}=os(),[i,c]=p.useState(e.settings?.folderPath||""),[u,d]=p.useState(e.settings?.browserHeadless??!1),[h,g]=p.useState(e.settings?.aiModel||""),[x,v]=p.useState(!1),{data:w}=it({queryKey:["/api/vaults",e.id,"path"],queryFn:()=>je("GET",`/api/vaults/${e.id}/path`).then(N=>N.json())});p.useEffect(()=>{c(e.settings?.folderPath||""),d(e.settings?.browserHeadless??!1),g(e.settings?.aiModel||"")},[e]);const S=async N=>{v(!0);try{await je("PATCH",`/api/vaults/${e.id}/settings`,N),r(),o({title:"Vault settings saved"})}catch(E){o({title:"Error",description:E.message,variant:"destructive"})}finally{v(!1)}},C=async N=>{d(N),await S({browserHeadless:N})},b=async()=>{const N=i.trim()||null;await S({folderPath:N})},k=async()=>{const N=h.trim()||null;await S({aiModel:N})};return a.jsxs(mn,{className:`p-4 ${t?"ring-1 ring-primary/30":""}`,children:[a.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[a.jsx("span",{className:"text-lg",children:e.icon}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm font-medium",children:e.name}),t&&a.jsx(et,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-3.5",children:"Active"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[a.jsx("p",{className:"text-[10px] text-muted-foreground font-mono truncate",children:w?.path||"loading..."}),w?.path&&a.jsx(pe,{variant:"ghost",size:"icon",className:"h-4 w-4 shrink-0 text-muted-foreground hover:text-primary",onClick:()=>JS(w.path),title:"Open vault folder",children:a.jsx(jc,{className:"w-2.5 h-2.5"})})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs(tt,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1.5",children:[a.jsx(Rc,{className:"w-3 h-3"}),"Data Folder"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ge,{className:"text-xs h-8 font-mono flex-1",placeholder:"Default (inside .cortex-data)",value:i,onChange:N=>c(N.target.value),onKeyDown:N=>{N.key==="Enter"&&b()},"data-testid":`input-vault-folder-${e.slug}`}),a.jsx(pe,{size:"sm",variant:"outline",className:"h-8 text-xs px-3",onClick:b,disabled:x,"data-testid":`button-save-folder-${e.slug}`,children:x?"...":"Save"})]}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Absolute path to an external folder (e.g. D:\\CortexVaults\\work or ~/Google Drive/cortex-work). Leave empty for default location."})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs(tt,{className:"text-xs flex items-center gap-1.5",children:[a.jsx(z2,{className:"w-3 h-3 text-muted-foreground"}),"Browser Headless Mode"]}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:u?"Browser runs invisibly in the background":"Browser window will be visible when browsing"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[u?a.jsx(Vy,{className:"w-3.5 h-3.5 text-muted-foreground"}):a.jsx(Ec,{className:"w-3.5 h-3.5 text-primary"}),a.jsx(xu,{checked:u,onCheckedChange:C,"data-testid":`switch-headless-${e.slug}`})]})]}),a.jsxs("div",{children:[a.jsxs(tt,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1.5",children:[a.jsx(na,{className:"w-3 h-3"}),"AI Model Override"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ge,{className:"text-xs h-8 font-mono flex-1",placeholder:"Use global default",value:h,onChange:N=>g(N.target.value),onKeyDown:N=>{N.key==="Enter"&&k()},"data-testid":`input-vault-model-${e.slug}`}),a.jsx(pe,{size:"sm",variant:"outline",className:"h-8 text-xs px-3",onClick:k,disabled:x,"data-testid":`button-save-model-${e.slug}`,children:x?"...":"Save"})]}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Override the AI model for this vault only (e.g. claude-sonnet-4-20250514, gpt-4o)."})]})]})]})}function TO({config:e,updateConfig:t}){const r=e?.agent||{},[o,i]=p.useState(String(r.maxTurns??200)),[c,u]=p.useState(String(r.maxTokens??16384)),[d,h]=p.useState(String(r.temperature??.7)),[g,x]=p.useState(String(r.fetchTimeout??15e3)),[v,w]=p.useState(String(r.fetchMaxLength??15e3)),[S,C]=p.useState(r.systemPromptSuffix??"");p.useEffect(()=>{const N=e?.agent||{};i(String(N.maxTurns??200)),u(String(N.maxTokens??16384)),h(String(N.temperature??.7)),x(String(N.fetchTimeout??15e3)),w(String(N.fetchMaxLength??15e3)),C(N.systemPromptSuffix??"")},[e]);const b=(N,E,R="int")=>{const T=R==="float"?parseFloat(E):parseInt(E,10);isNaN(T)||t.mutate({agent:{...e?.agent,[N]:T}})},k=()=>{t.mutate({agent:{...e?.agent,systemPromptSuffix:S}})};return a.jsxs(mn,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Ky,{className:"w-4 h-4 text-primary"}),a.jsx("h3",{className:"text-sm font-medium",children:"Agent"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsxs(tt,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1",children:[a.jsx(kr,{className:"w-3 h-3"}),"Max Turns"]}),a.jsx(Ge,{className:"text-xs h-8 font-mono",type:"number",min:1,max:50,value:o,onChange:N=>i(N.target.value),onBlur:()=>b("maxTurns",o),onKeyDown:N=>{N.key==="Enter"&&b("maxTurns",o)},"data-testid":"input-max-turns"}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:"Tool-call loops per message (1–50)"})]}),a.jsxs("div",{children:[a.jsxs(tt,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1",children:[a.jsx(tn,{className:"w-3 h-3"}),"Max Tokens"]}),a.jsx(Ge,{className:"text-xs h-8 font-mono",type:"number",min:256,max:32768,step:256,value:c,onChange:N=>u(N.target.value),onBlur:()=>b("maxTokens",c),onKeyDown:N=>{N.key==="Enter"&&b("maxTokens",c)},"data-testid":"input-max-tokens"}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:"Response length limit (256–32768)"})]})]}),a.jsxs("div",{children:[a.jsxs(tt,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1",children:[a.jsx(tE,{className:"w-3 h-3"}),"Temperature: ",d]}),a.jsx(Ge,{className:"text-xs h-8 font-mono",type:"number",min:0,max:2,step:.1,value:d,onChange:N=>h(N.target.value),onBlur:()=>b("temperature",d,"float"),onKeyDown:N=>{N.key==="Enter"&&b("temperature",d,"float")},"data-testid":"input-temperature"}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:"0 = deterministic, 1 = balanced, 2 = creative"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsxs(tt,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1",children:[a.jsx(nE,{className:"w-3 h-3"}),"Fetch Timeout (ms)"]}),a.jsx(Ge,{className:"text-xs h-8 font-mono",type:"number",min:1e3,max:12e4,step:1e3,value:g,onChange:N=>x(N.target.value),onBlur:()=>b("fetchTimeout",g),onKeyDown:N=>{N.key==="Enter"&&b("fetchTimeout",g)},"data-testid":"input-fetch-timeout"}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:"web_fetch timeout"})]}),a.jsxs("div",{children:[a.jsxs(tt,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1",children:[a.jsx(tn,{className:"w-3 h-3"}),"Fetch Max Length"]}),a.jsx(Ge,{className:"text-xs h-8 font-mono",type:"number",min:1e3,max:2e5,step:1e3,value:v,onChange:N=>w(N.target.value),onBlur:()=>b("fetchMaxLength",v),onKeyDown:N=>{N.key==="Enter"&&b("fetchMaxLength",v)},"data-testid":"input-fetch-max-length"}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:"Max chars from web_fetch"})]})]}),a.jsxs("div",{children:[a.jsxs(tt,{className:"text-xs text-muted-foreground flex items-center gap-1.5 mb-1",children:[a.jsx(na,{className:"w-3 h-3"}),"Custom System Prompt"]}),a.jsx("textarea",{className:"w-full text-xs font-mono bg-background border border-input rounded-md px-3 py-2 min-h-[60px] resize-y focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Additional instructions appended to the system prompt...",value:S,onChange:N=>C(N.target.value),onBlur:k,"data-testid":"textarea-system-prompt"}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:'Appended as "Custom Instructions" to every system prompt. Use for persona, style, or domain-specific rules.'})]})]})]})}function PO({skill:e,onSave:t,onCancel:r}){const o=!e,[i,c]=p.useState(e?.name||""),[u,d]=p.useState(e?.description||""),[h,g]=p.useState(e?.category||"custom"),[x,v]=p.useState(String(e?.priority??1)),[w,S]=p.useState(e?.triggerKeywords?.join(", ")||""),[C,b]=p.useState(e?.instructions||""),[k,N]=p.useState(e?.instructionsOnly??!1),E=()=>{i.trim()&&t({name:i.trim(),description:u.trim(),version:e?.version||"1.0",instructions:C.trim(),tools:e?.tools||[],enabled:e?.enabled??!0,builtin:e?.builtin??!1,triggerKeywords:w.split(",").map(R=>R.trim()).filter(Boolean),category:h,instructionsOnly:k,priority:parseInt(x,10),filePath:e?.filePath||null})};return a.jsxs(mn,{className:"p-4 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:o?"New Skill":`Edit: ${e.name}`}),a.jsx(pe,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:r,children:"Cancel"})]}),a.jsxs("div",{children:[a.jsx(tt,{className:"text-xs text-muted-foreground mb-1 block",children:"Name"}),a.jsx(Ge,{className:"text-sm h-8",placeholder:"my-skill",value:i,onChange:R=>c(R.target.value),disabled:!o&&e.builtin,"data-testid":"input-skill-name"})]}),a.jsxs("div",{children:[a.jsx(tt,{className:"text-xs text-muted-foreground mb-1 block",children:"Description"}),a.jsx(Ge,{className:"text-sm h-8",placeholder:"What this skill does",value:u,onChange:R=>d(R.target.value),"data-testid":"input-skill-description"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(tt,{className:"text-xs text-muted-foreground mb-1 block",children:"Category"}),a.jsxs(_o,{value:h,onValueChange:g,children:[a.jsx($s,{className:"text-sm h-8",children:a.jsx(Ao,{})}),a.jsx(zs,{children:ek.map(R=>a.jsx(Sr,{value:R,children:tk[R]},R))})]})]}),a.jsxs("div",{children:[a.jsx(tt,{className:"text-xs text-muted-foreground mb-1 block",children:"Priority"}),a.jsxs(_o,{value:x,onValueChange:v,children:[a.jsx($s,{className:"text-sm h-8",children:a.jsx(Ao,{})}),a.jsx(zs,{children:nk.map((R,T)=>a.jsx(Sr,{value:String(T),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-2 h-2 rounded-full ${rk[T]}`}),R]})},T))})]})]})]}),a.jsxs("div",{children:[a.jsx(tt,{className:"text-xs text-muted-foreground mb-1 block",children:"Trigger Keywords"}),a.jsx(Ge,{className:"text-sm h-8",placeholder:"browse, navigate, click, website (comma-separated)",value:w,onChange:R=>S(R.target.value),"data-testid":"input-skill-keywords"}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Comma-separated words that activate this skill when detected in user messages."})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(tt,{className:"text-xs",children:"Instructions Only (no tools)"}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Injects guidance into the system prompt without registering tools."})]}),a.jsx(xu,{checked:k,onCheckedChange:N,"data-testid":"switch-instructions-only"})]}),a.jsxs("div",{children:[a.jsx(tt,{className:"text-xs text-muted-foreground mb-1 block",children:"Instructions"}),a.jsx("textarea",{className:"w-full text-xs font-mono bg-background border border-input rounded-md px-3 py-2 min-h-[200px] resize-y focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Detailed instructions for the AI agent when this skill is active...",value:C,onChange:R=>b(R.target.value),"data-testid":"textarea-skill-instructions"})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[a.jsxs(pe,{size:"sm",className:"h-8 text-xs px-4",onClick:E,disabled:!i.trim(),"data-testid":"button-save-skill",children:[a.jsx(xr,{className:"w-3 h-3 mr-1.5"}),o?"Create Skill":"Save Changes"]}),a.jsx(pe,{size:"sm",variant:"outline",className:"h-8 text-xs px-4",onClick:r,children:"Cancel"})]})]})}function MO({config:e,updateConfig:t}){const{toast:r}=os(),o=rn(),[i,c]=p.useState(null),[u,d]=p.useState(!1),[h,g]=p.useState(""),[x,v]=p.useState(""),[w,S]=p.useState(""),{data:C={},refetch:b}=it({queryKey:["/api/mcp/status"],queryFn:()=>je("GET","/api/mcp/status").then(_=>_.json()),refetchInterval:5e3}),{data:k={}}=it({queryKey:["/api/mcp/presets"],queryFn:()=>je("GET","/api/mcp/presets").then(_=>_.json())}),{data:N=[]}=it({queryKey:["/api/mcp/auth"],queryFn:()=>je("GET","/api/mcp/auth").then(_=>_.json()),refetchInterval:2e3}),E=Object.keys(e?.mcpServers||{}),R=Array.from(new Set([...E,...Object.keys(C)])),T=Object.entries(k).filter(([_])=>!R.includes(_)),M=async _=>{c(_);try{_==="playwright"&&e?.browserBackend!=="playwright-mcp"&&t.mutate({browserBackend:"playwright-mcp"});const X=await(await je("POST",`/api/mcp/connect/${_}`)).json();await b(),X.connected?r({title:"Connected",description:`${_} is now active`}):r({title:"Connection failed",description:`Could not connect to ${_}`,variant:"destructive"})}catch(ee){r({title:"Connection failed",description:ee.message,variant:"destructive"})}finally{c(null)}},F=async _=>{try{await je("POST",`/api/mcp/disconnect/${_}`),await b(),_==="playwright"&&t.mutate({browserBackend:"none"}),r({title:"Disconnected",description:`${_} has been disconnected`})}catch(ee){r({title:"Error",description:ee.message,variant:"destructive"})}},I=async _=>{c(_);try{await je("POST",`/api/mcp/disconnect/${_}`);const X=await(await je("POST",`/api/mcp/connect/${_}`)).json();await b(),X.connected?r({title:"Reconnected",description:`${_} is active`}):r({title:"Reconnect failed",variant:"destructive"})}catch(ee){r({title:"Reconnect failed",description:ee.message,variant:"destructive"})}finally{c(null)}},O=async _=>{try{await je("POST","/api/mcp/servers",{name:_}),o.invalidateQueries({queryKey:["/api/config"]}),await b(),r({title:"Server added",description:`${_} has been configured`}),d(!1),M(_)}catch(ee){r({title:"Error",description:ee.message,variant:"destructive"})}},q=async()=>{if(!h.trim()||!x.trim()){r({title:"Name and command are required",variant:"destructive"});return}const _=w.trim()?w.trim().split(/\s+/):[];try{await je("POST","/api/mcp/servers",{name:h.trim(),command:x.trim(),args:_}),o.invalidateQueries({queryKey:["/api/config"]}),await b(),r({title:"Server added",description:`${h} has been configured`}),g(""),v(""),S(""),d(!1)}catch(ee){r({title:"Error",description:ee.message,variant:"destructive"})}},U=async _=>{try{await je("DELETE",`/api/mcp/servers/${_}`),o.invalidateQueries({queryKey:["/api/config"]}),await b(),_==="playwright"&&t.mutate({browserBackend:"none"}),r({title:"Server removed",description:`${_} has been removed`})}catch(ee){r({title:"Error",description:ee.message,variant:"destructive"})}},G=Object.values(C).filter(_=>_.connected).length;return a.jsxs(mn,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(X2,{className:"w-4 h-4 text-primary"}),a.jsx("h3",{className:"text-sm font-medium",children:"MCP Servers"}),G>0&&a.jsxs(et,{variant:"default",className:"text-[9px] px-1.5 py-0 h-3.5 ml-auto bg-green-500/20 text-green-400 border-green-500/30",children:[G," connected"]})]}),a.jsx("p",{className:"text-[10px] text-muted-foreground mb-3",children:"MCP servers extend the AI agent with new capabilities — browser automation, Microsoft 365 access, and more."}),a.jsxs("div",{className:"space-y-2",children:[R.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground italic py-2",children:"No MCP servers configured."}),R.map(_=>{const ee=C[_],X=ee?.connected===!0,he=ee?.tools||[],ie=ee?.label||k[_]?.label||_,$=ee?.description||k[_]?.description||"",z=ee?.setupNotes||k[_]?.setupNotes,B=i===_;return a.jsxs("div",{className:"border border-border/50 rounded-lg p-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs font-medium",children:ie}),a.jsx(et,{variant:X?"default":"secondary",className:`text-[9px] px-1.5 py-0 h-3.5 ${X?"bg-green-500/20 text-green-400 border-green-500/30":""}`,children:X?"Connected":"Disconnected"})]}),$&&a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:$})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[B?a.jsx(pe,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",disabled:!0,children:a.jsx(Es,{className:"w-3 h-3 animate-spin"})}):X?a.jsxs(a.Fragment,{children:[a.jsx(pe,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>I(_),title:"Reconnect","data-testid":`button-reconnect-${_}`,children:a.jsx(Q2,{className:"w-3 h-3"})}),a.jsx(pe,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-destructive",onClick:()=>F(_),title:"Disconnect","data-testid":`button-disconnect-${_}`,children:a.jsx(W2,{className:"w-3 h-3"})})]}):a.jsx(pe,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>M(_),title:"Connect","data-testid":`button-connect-${_}`,children:a.jsx(K2,{className:"w-3 h-3"})}),a.jsx(pe,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-destructive",onClick:()=>U(_),title:"Remove server","data-testid":`button-remove-${_}`,children:a.jsx(is,{className:"w-3 h-3"})})]})]}),X&&he.length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsxs(tt,{className:"text-[10px] text-muted-foreground mb-1 block",children:[he.length," tools available"]}),a.jsxs("div",{className:"flex flex-wrap gap-1",children:[he.slice(0,10).map(Y=>a.jsx(et,{variant:"secondary",className:"text-[9px] font-mono px-1.5 py-0 h-3.5",children:Y},Y)),he.length>10&&a.jsxs(et,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-3.5",children:["+",he.length-10," more"]})]})]}),!X&&z&&a.jsxs("div",{className:"mt-2 flex items-start gap-1.5",children:[a.jsx(Nc,{className:"w-3 h-3 text-muted-foreground mt-0.5 shrink-0"}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:z})]}),N.filter(Y=>Y.serverName===_).slice(-1).map((Y,D)=>a.jsxs("div",{className:"mt-2 bg-muted/40 border border-border/50 rounded-md p-2.5",children:[a.jsx("p",{className:"text-[10px] text-foreground mb-1.5 font-medium",children:"Authentication required"}),a.jsx("p",{className:"text-[10px] text-muted-foreground whitespace-pre-wrap mb-2",children:Y.message}),a.jsxs("div",{className:"flex items-center gap-2",children:[Y.url&&a.jsxs(pe,{size:"sm",variant:"outline",className:"h-6 text-[10px] gap-1",onClick:()=>{window.cortexDesktop?.openFolder,window.open(Y.url,"_blank")},children:[a.jsx(jc,{className:"w-2.5 h-2.5"}),"Open Login Page"]}),Y.code&&a.jsxs(pe,{size:"sm",variant:"ghost",className:"h-6 text-[10px] gap-1 font-mono",onClick:()=>{navigator.clipboard.writeText(Y.code),r({title:"Code copied",description:Y.code})},children:["Code: ",Y.code," (click to copy)"]})]})]},D))]},_)})]}),u?a.jsxs("div",{className:"mt-3 border border-border/50 rounded-lg p-3 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(tt,{className:"text-xs font-medium",children:"Add MCP Server"}),a.jsx(pe,{size:"sm",variant:"ghost",className:"h-5 text-[10px] px-2",onClick:()=>d(!1),children:"Cancel"})]}),T.length>0&&a.jsxs("div",{children:[a.jsx(tt,{className:"text-[10px] text-muted-foreground mb-1.5 block",children:"Quick Add (Presets)"}),a.jsx("div",{className:"space-y-1.5",children:T.map(([_,ee])=>a.jsxs("button",{className:"w-full text-left p-2 border border-border/50 rounded-md hover:bg-muted/50 transition-colors",onClick:()=>O(_),"data-testid":`button-add-preset-${_}`,children:[a.jsx("div",{className:"text-xs font-medium",children:ee.label}),a.jsx("div",{className:"text-[10px] text-muted-foreground",children:ee.description})]},_))})]}),a.jsxs("div",{children:[a.jsx(tt,{className:"text-[10px] text-muted-foreground mb-1.5 block",children:T.length>0?"Or add custom":"Custom Server"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ge,{className:"text-xs h-7 font-mono",placeholder:"Server name (e.g. my-mcp-server)",value:h,onChange:_=>g(_.target.value),"data-testid":"input-custom-mcp-name"}),a.jsx(Ge,{className:"text-xs h-7 font-mono",placeholder:"Command (e.g. npx)",value:x,onChange:_=>v(_.target.value),"data-testid":"input-custom-mcp-command"}),a.jsx(Ge,{className:"text-xs h-7 font-mono",placeholder:"Args (space-separated, e.g. -y @my/package mcp)",value:w,onChange:_=>S(_.target.value),"data-testid":"input-custom-mcp-args"}),a.jsxs(pe,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:q,disabled:!h.trim()||!x.trim(),"data-testid":"button-add-custom-mcp",children:[a.jsx(eE,{className:"w-3 h-3 mr-1.5"}),"Add Custom Server"]})]})]})]}):a.jsxs(pe,{size:"sm",variant:"outline",className:"h-7 text-xs mt-3 w-full",onClick:()=>d(!0),"data-testid":"button-add-mcp-server",children:[a.jsx(yr,{className:"w-3 h-3 mr-1.5"}),"Add MCP Server"]})]})}function Ph(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Mh(e){return e.startsWith("image/")?jp:e.includes("pdf")?tn:e.includes("spreadsheet")||e.includes("csv")||e.includes("excel")?j2:e.includes("zip")||e.includes("tar")||e.includes("rar")?C2:e.includes("javascript")||e.includes("typescript")||e.includes("json")||e.includes("html")||e.includes("css")?N2:e.includes("text")?tn:E2}function DO({file:e,onDelete:t,onCreateNote:r,onPreview:o}){const i=Mh(e.mimeType),c=e.mimeType.startsWith("image/"),u=yn().vaultParam;return a.jsxs("div",{className:"group relative rounded-lg border border-border/40 bg-card card-hover cursor-pointer overflow-hidden",onClick:()=>o(e),"data-testid":`file-card-${e.id}`,children:[a.jsx("div",{className:"aspect-[4/3] bg-muted/20 flex items-center justify-center overflow-hidden",children:c?a.jsx("img",{src:Oe(e.url,u),alt:e.name,className:"w-full h-full object-cover transition-transform duration-200 group-hover:scale-[1.02]",loading:"lazy"}):a.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl bg-muted/40 flex items-center justify-center",children:a.jsx(i,{className:"w-5 h-5 text-muted-foreground/40"})}),a.jsx("span",{className:"text-[9px] text-muted-foreground/30 uppercase tracking-wider font-medium",children:e.name.split(".").pop()})]})}),a.jsxs("div",{className:"p-2.5",children:[a.jsx("p",{className:"text-xs font-medium truncate text-foreground",title:e.name,children:e.name}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:Ph(e.size)}),a.jsx("span",{className:"text-[10px] text-muted-foreground/40",children:new Date(e.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]})]}),a.jsx("div",{className:"absolute top-1.5 right-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsxs(eu,{children:[a.jsx(tu,{asChild:!0,children:a.jsx(pe,{variant:"secondary",size:"icon",className:"h-6 w-6 bg-background/80 backdrop-blur-sm shadow-sm",onClick:d=>d.stopPropagation(),children:a.jsx(Np,{className:"w-3 h-3"})})}),a.jsxs(da,{align:"end",children:[a.jsxs(Ln,{onClick:d=>{d.stopPropagation(),o(e)},className:"text-xs gap-2",children:[a.jsx(Ec,{className:"w-3.5 h-3.5"})," Preview"]}),a.jsxs(Ln,{onClick:d=>{d.stopPropagation(),r(e.id)},className:"text-xs gap-2",children:[a.jsx(Rp,{className:"w-3.5 h-3.5"})," Create Note"]}),a.jsxs(Ln,{onClick:d=>{d.stopPropagation();const h=document.createElement("a");h.href=Oe(e.url,u),h.download=e.name,h.click()},className:"text-xs gap-2",children:[a.jsx(Cp,{className:"w-3.5 h-3.5"})," Download"]}),a.jsx(fa,{}),a.jsxs(Ln,{onClick:d=>{d.stopPropagation(),t(e.id)},className:"text-xs text-destructive gap-2",children:[a.jsx(is,{className:"w-3.5 h-3.5"})," Delete"]})]})]})})]})}function _O({file:e,onDelete:t,onCreateNote:r,onPreview:o}){const i=Mh(e.mimeType),c=yn().vaultParam;return a.jsxs("div",{className:"group flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>o(e),"data-testid":`file-row-${e.id}`,children:[a.jsx("div",{className:"w-8 h-8 rounded-md bg-muted/50 flex items-center justify-center shrink-0",children:a.jsx(i,{className:"w-4 h-4 text-muted-foreground/60"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-[13px] font-medium truncate text-foreground",children:e.name}),a.jsxs("p",{className:"text-[10px] text-muted-foreground/50",children:[Ph(e.size)," · ",new Date(e.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]}),a.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[a.jsx(pe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:u=>{u.stopPropagation(),r(e.id)},title:"Create note",children:a.jsx(Rp,{className:"w-3 h-3"})}),a.jsx(pe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:u=>{u.stopPropagation();const d=document.createElement("a");d.href=Oe(e.url,c),d.download=e.name,d.click()},title:"Download",children:a.jsx(Cp,{className:"w-3 h-3"})}),a.jsx(pe,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:u=>{u.stopPropagation(),t(e.id)},title:"Delete",children:a.jsx(is,{className:"w-3 h-3"})})]})]})}function AO(){const[e,t]=p.useState(""),[r,o]=p.useState("grid"),[i,c]=p.useState(null),[u,d]=p.useState(!1),h=p.useRef(null),g=rn(),{toast:x}=os(),{vaultParam:v,vaultId:w}=yn(),[,S]=Oo(),{data:C=[],isLoading:b}=it({queryKey:["/api/files",w],queryFn:()=>je("GET",Oe("/api/files",v)).then(O=>O.json()),staleTime:0,refetchOnMount:"always",enabled:!!w}),k=Ct({mutationFn:async O=>{const q=new FormData;return q.append("file",O),(await fetch(Oe("/api/files",v),{method:"POST",body:q})).json()},onSuccess:()=>{g.invalidateQueries({queryKey:["/api/files"]}),x({title:"File uploaded"})},onError:()=>{x({title:"Upload failed",variant:"destructive"})}}),N=Ct({mutationFn:O=>je("DELETE",Oe(`/api/files/${O}`,v)),onSuccess:()=>{g.invalidateQueries({queryKey:["/api/files"]}),c(null),x({title:"File deleted"})}}),E=Ct({mutationFn:O=>je("POST",Oe(`/api/files/${O}/create-note`,v)).then(q=>q.json()),onSuccess:O=>{g.invalidateQueries({queryKey:["/api/notes"]}),x({title:"Note created"}),S("/notes")}}),R=p.useCallback(O=>{O&&Array.from(O).forEach(q=>k.mutate(q))},[k]),T=p.useCallback(O=>{O.preventDefault(),d(!1),R(O.dataTransfer.files)},[R]),M=p.useCallback(O=>{O.preventDefault(),d(!0)},[]),F=p.useCallback(O=>{O.preventDefault(),d(!1)},[]),I=p.useMemo(()=>C.filter(O=>!e||O.name.toLowerCase().includes(e.toLowerCase())).sort((O,q)=>new Date(q.createdAt).getTime()-new Date(O.createdAt).getTime()),[C,e]);return a.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[a.jsxs("header",{className:"flex items-center gap-2 px-4 h-12 border-b border-border/50 shrink-0",children:[a.jsx(As,{}),a.jsx(Rc,{className:"w-4 h-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:"Files"}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Rs,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground/50"}),a.jsx(Ge,{placeholder:"Search files...",className:"h-7 text-xs pl-7 w-44 bg-muted/30 border-border/30",value:e,onChange:O=>t(O.target.value),"data-testid":"input-search-files"})]}),a.jsxs("div",{className:"flex rounded-md border border-border/50",children:[a.jsx(pe,{size:"sm",variant:r==="grid"?"secondary":"ghost",className:"h-7 text-xs px-2 rounded-r-none",onClick:()=>o("grid"),children:a.jsx(P2,{className:"w-3 h-3"})}),a.jsx(pe,{size:"sm",variant:r==="list"?"secondary":"ghost",className:"h-7 text-xs px-2 rounded-l-none",onClick:()=>o("list"),children:a.jsx(Ep,{className:"w-3 h-3"})})]}),a.jsx("input",{ref:h,type:"file",multiple:!0,className:"hidden",onChange:O=>{R(O.target.files),O.target.value=""}}),a.jsxs(pe,{size:"sm",variant:"default",className:"text-xs gap-1",onClick:()=>h.current?.click(),"data-testid":"button-upload-file",children:[a.jsx(Ul,{className:"w-3.5 h-3.5"})," Upload"]})]})]}),a.jsxs("div",{className:"flex-1 overflow-auto relative",onDrop:T,onDragOver:M,onDragLeave:F,children:[u&&a.jsx("div",{className:"absolute inset-0 z-10 bg-primary/5 border-2 border-dashed border-primary/30 rounded-lg m-4 flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Ul,{className:"w-8 h-8 text-primary/50 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-primary/70 font-medium",children:"Drop files here"})]})}),k.isPending&&a.jsxs("div",{className:"mx-4 mt-4 p-3 rounded-lg bg-primary/5 border border-primary/20 flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"}),a.jsx("span",{className:"text-xs text-primary",children:"Uploading..."})]}),I.length===0&&!b&&!k.isPending&&a.jsxs("div",{className:"flex flex-col items-center justify-center h-full cursor-pointer group/empty",onClick:()=>h.current?.click(),children:[a.jsx("div",{className:"w-16 h-16 rounded-2xl bg-muted/20 border border-dashed border-border/50 flex items-center justify-center mb-3 transition-colors group-hover/empty:border-primary/30 group-hover/empty:bg-primary/5",children:a.jsx(Ul,{className:"w-6 h-6 text-muted-foreground/25 transition-colors group-hover/empty:text-primary/40"})}),a.jsx("p",{className:"text-sm text-muted-foreground/50 mb-1",children:"No files yet"}),a.jsx("p",{className:"text-[11px] text-muted-foreground/30",children:"Drop files here or click to upload"})]}),I.length>0&&r==="grid"&&a.jsx("div",{className:"p-4 grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-3",children:I.map(O=>a.jsx(DO,{file:O,onDelete:q=>N.mutate(q),onCreateNote:q=>E.mutate(q),onPreview:c},O.id))}),I.length>0&&r==="list"&&a.jsx("div",{className:"p-4 max-w-3xl mx-auto",children:I.map(O=>a.jsx(_O,{file:O,onDelete:q=>N.mutate(q),onCreateNote:q=>E.mutate(q),onPreview:c},O.id))})]}),a.jsx(Vi,{open:!!i,onOpenChange:O=>{O||c(null)},children:a.jsxs(No,{className:"sm:max-w-2xl p-0 overflow-hidden",children:[a.jsx(jo,{className:"px-5 pt-5 pb-0",children:a.jsx(Eo,{className:"text-sm font-medium truncate",children:i?.name})}),i&&a.jsxs("div",{className:"px-5 pb-5",children:[i.mimeType.startsWith("image/")?a.jsx("img",{src:Oe(i.url,v),alt:i.name,className:"w-full max-h-[60vh] object-contain rounded-lg bg-muted/20"}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[(()=>{const O=Mh(i.mimeType);return a.jsx(O,{className:"w-12 h-12 text-muted-foreground/30 mb-3"})})(),a.jsx("p",{className:"text-sm text-muted-foreground",children:i.name}),a.jsxs("p",{className:"text-[11px] text-muted-foreground/50 mt-1",children:[Ph(i.size)," · ",i.mimeType]})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-4 pt-3 border-t border-border/30",children:[a.jsxs("span",{className:"text-[10px] text-muted-foreground/50 flex-1",children:["Uploaded ",new Date(i.createdAt).toLocaleString()]}),a.jsxs(pe,{size:"sm",variant:"ghost",className:"h-7 text-xs gap-1",onClick:()=>E.mutate(i.id),children:[a.jsx(Rp,{className:"w-3 h-3"})," Create Note"]}),a.jsxs(pe,{size:"sm",variant:"ghost",className:"h-7 text-xs gap-1",onClick:()=>{const O=document.createElement("a");O.href=Oe(i.url,v),O.download=i.name,O.click()},children:[a.jsx(Cp,{className:"w-3 h-3"})," Download"]}),a.jsxs(pe,{size:"sm",variant:"ghost",className:"h-7 text-xs gap-1 text-destructive",onClick:()=>N.mutate(i.id),children:[a.jsx(is,{className:"w-3 h-3"})," Delete"]})]})]})]})})]})}function IO(){return a.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gray-50",children:a.jsx(mn,{className:"w-full max-w-md mx-4",children:a.jsxs(TS,{className:"pt-6",children:[a.jsxs("div",{className:"flex mb-4 gap-2",children:[a.jsx(Nc,{className:"h-8 w-8 text-red-500"}),a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"404 Page Not Found"})]}),a.jsx("p",{className:"mt-4 text-sm text-gray-600",children:"Did you forget to add the page to the router?"})]})})})}const OO={openai:"OpenAI",anthropic:"Claude",grok:"Grok",google:"Gemini",none:"No Provider"},LO={openai:"gpt-4o",anthropic:"claude-sonnet-4-20250514",grok:"grok-3",google:"gemini-2.0-flash"};function Tf(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}const FO={openai:{input:2.5,output:10},anthropic:{input:3,output:15},grok:{input:3,output:15},google:{input:.1,output:.4}};function Fv(e,t,r){const o=FO[e];if(!o)return"";const i=t/1e6*o.input+r/1e6*o.output;return i<.01?"<$0.01":`~$${i.toFixed(2)}`}function $O(){const e=rn(),{vaultParam:t}=yn(),[,r]=Oo(),{data:o}=it({queryKey:["/api/stats",t],queryFn:()=>je("GET",Oe("/api/stats",t)).then(S=>S.json()),refetchInterval:5e3}),{data:i}=it({queryKey:["/api/info"],queryFn:()=>je("GET","/api/info").then(S=>S.json())}),{data:c}=it({queryKey:["/api/config"],queryFn:()=>je("GET","/api/config").then(S=>S.json())}),u=Ct({mutationFn:S=>je("PATCH","/api/config",S).then(C=>C.json()),onSuccess:()=>{e.invalidateQueries({queryKey:["/api/config"]}),e.invalidateQueries({queryKey:["/api/info"]})}}),d=Ct({mutationFn:()=>je("POST",Oe("/api/stats/reset",t)),onSuccess:()=>{e.invalidateQueries({queryKey:["/api/stats"]})}}),h=(o?.totalInputTokens||0)+(o?.totalOutputTokens||0),g=i?.provider||"none",x=i?.hasApiKey||!1,v=Object.entries(i?.keyStatus||{}).filter(([,S])=>S.set).map(([S])=>S),w=S=>{if(!i?.keyStatus?.[S]?.set){r("/settings");return}u.mutate({aiProvider:S,aiModel:LO[S]||void 0})};return a.jsxs("div",{className:"h-6 border-t border-border/50 bg-background/80 backdrop-blur-sm flex items-center px-3 text-[10px] text-muted-foreground gap-0 shrink-0 select-none",children:[a.jsxs(qf,{children:[a.jsx(Qf,{asChild:!0,children:a.jsxs("button",{className:"flex items-center gap-1 px-1.5 h-full hover:bg-muted/50 rounded-sm transition-colors",onClick:()=>d.mutate(),children:[a.jsx(Qy,{className:"w-3 h-3"}),a.jsxs("span",{className:"tabular-nums",children:[Tf(h)," tokens",h>0&&g!=="none"&&a.jsx("span",{className:"ml-1 opacity-60",children:Fv(g,o?.totalInputTokens||0,o?.totalOutputTokens||0)})]})]})}),a.jsx(tc,{side:"top",className:"text-xs",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{children:["Input: ",Tf(o?.totalInputTokens||0)]}),a.jsxs("div",{children:["Output: ",Tf(o?.totalOutputTokens||0)]}),a.jsxs("div",{children:["Requests: ",o?.totalRequests||0]}),h>0&&g!=="none"&&a.jsxs("div",{className:"font-medium",children:["Est. cost: ",Fv(g,o?.totalInputTokens||0,o?.totalOutputTokens||0)]}),a.jsxs("div",{className:"text-muted-foreground mt-1 flex items-center gap-1",children:[a.jsx(G2,{className:"w-2.5 h-2.5"})," Click to reset"]})]})})]}),a.jsx("div",{className:"w-px h-3 bg-border/50 mx-1"}),x?a.jsxs("div",{className:"flex items-center gap-0.5",children:[a.jsx(k2,{className:"w-3 h-3 mx-1"}),a.jsxs(_o,{value:g,onValueChange:w,children:[a.jsx($s,{className:"h-5 border-0 bg-transparent shadow-none text-[10px] text-muted-foreground px-1 py-0 min-w-0 w-auto gap-1 focus:ring-0 [&>svg]:w-2.5 [&>svg]:h-2.5",children:a.jsx(Ao,{})}),a.jsxs(zs,{align:"start",side:"top",className:"min-w-[120px]",children:[v.map(S=>a.jsx(Sr,{value:S,className:"text-xs",children:OO[S]||S},S)),v.length===0&&a.jsx(Sr,{value:"none",className:"text-xs",disabled:!0,children:"No keys configured"})]})]})]}):a.jsxs("button",{className:"flex items-center gap-1 px-1.5 h-full hover:bg-muted/50 rounded-sm transition-colors text-yellow-500",onClick:()=>r("/settings"),children:[a.jsx(rE,{className:"w-3 h-3"}),a.jsx("span",{children:"No API Key"})]}),c?.aiModel&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-3 bg-border/50 mx-1"}),a.jsxs(qf,{children:[a.jsx(Qf,{asChild:!0,children:a.jsx("span",{className:"px-1.5 font-mono truncate max-w-[120px]",children:c.aiModel})}),a.jsxs(tc,{side:"top",className:"text-xs",children:["Model override: ",c.aiModel]})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"px-1 opacity-50",children:"v2.0"})]})}function zO(){return a.jsxs(NN,{children:[a.jsx(mr,{path:"/",component:kf}),a.jsx(mr,{path:"/chat",component:kf}),a.jsx(mr,{path:"/chat/:id",component:kf}),a.jsx(mr,{path:"/notes",component:v_}),a.jsx(mr,{path:"/tasks",component:sO}),a.jsx(mr,{path:"/files",component:AO}),a.jsx(mr,{path:"/search",component:uO}),a.jsx(mr,{path:"/settings",component:EO}),a.jsx(mr,{component:IO})]})}function BO(){const{needsSetup:e}=NO(),[t,r]=p.useState(!1);return!e||t?null:a.jsx(ZS,{open:!0,onOpenChange:o=>{o||r(!0)},mode:"dialog"})}function VO(){const e={"--sidebar-width":"16rem","--sidebar-width-icon":"3.5rem"};return a.jsx(J3,{children:a.jsx(JN,{client:fj,children:a.jsx(aM,{children:a.jsxs(A0,{children:[a.jsx(Gv,{hook:Zv,children:a.jsx(eM,{style:e,children:a.jsxs("div",{className:"flex h-screen w-full bg-background",children:[a.jsx(sD,{}),a.jsxs("main",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(zO,{})}),a.jsx($O,{})]})]})})}),a.jsx(BO,{}),a.jsx(BE,{})]})})})})}window.location.hash||(window.location.hash="#/");sN.createRoot(document.getElementById("root")).render(a.jsx(VO,{}));