var PT=Object.defineProperty;var Bm=e=>{throw TypeError(e)};var AT=(e,t,n)=>t in e?PT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var A=(e,t,n)=>AT(e,typeof t!="symbol"?t+"":t,n),ud=(e,t,n)=>t.has(e)||Bm("Cannot "+n);var P=(e,t,n)=>(ud(e,t,"read from private field"),n?n.call(e):t.get(e)),le=(e,t,n)=>t.has(e)?Bm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),K=(e,t,n,r)=>(ud(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),be=(e,t,n)=>(ud(e,t,"access private method"),n);var Ll=(e,t,n,r)=>({set _(s){K(e,t,s,n)},get _(){return P(e,t,r)}});function RT(e,t){for(var n=0;nr[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var SL=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ib(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ob={exports:{}},Tu={},ab={exports:{}},Ce={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var bl=Symbol.for("react.element"),IT=Symbol.for("react.portal"),DT=Symbol.for("react.fragment"),OT=Symbol.for("react.strict_mode"),MT=Symbol.for("react.profiler"),FT=Symbol.for("react.provider"),LT=Symbol.for("react.context"),VT=Symbol.for("react.forward_ref"),zT=Symbol.for("react.suspense"),$T=Symbol.for("react.memo"),UT=Symbol.for("react.lazy"),Wm=Symbol.iterator;function BT(e){return e===null||typeof e!="object"?null:(e=Wm&&e[Wm]||e["@@iterator"],typeof e=="function"?e:null)}var lb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},cb=Object.assign,ub={};function Bo(e,t,n){this.props=e,this.context=t,this.refs=ub,this.updater=n||lb}Bo.prototype.isReactComponent={};Bo.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Bo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function db(){}db.prototype=Bo.prototype;function Jp(e,t,n){this.props=e,this.context=t,this.refs=ub,this.updater=n||lb}var eh=Jp.prototype=new db;eh.constructor=Jp;cb(eh,Bo.prototype);eh.isPureReactComponent=!0;var Hm=Array.isArray,fb=Object.prototype.hasOwnProperty,th={current:null},pb={key:!0,ref:!0,__self:!0,__source:!0};function hb(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)fb.call(t,r)&&!pb.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1>>1,Re=D[ae];if(0>>1;aes(Ot,Y))hts(C,Ot)?(D[ae]=C,D[ht]=Y,ae=ht):(D[ae]=Ot,D[Ue]=Y,ae=Ue);else if(hts(C,Y))D[ae]=C,D[ht]=Y,ae=ht;else break e}}return U}function s(D,U){var Y=D.sortIndex-U.sortIndex;return Y!==0?Y:D.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,p=3,y=!1,b=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(D){for(var U=n(u);U!==null;){if(U.callback===null)r(u);else if(U.startTime<=D)r(u),U.sortIndex=U.expirationTime,t(c,U);else break;U=n(u)}}function j(D){if(g=!1,x(D),!b)if(n(c)!==null)b=!0,q(T);else{var U=n(u);U!==null&&oe(j,U.startTime-D)}}function T(D,U){b=!1,g&&(g=!1,v(_),_=-1),y=!0;var Y=p;try{for(x(U),f=n(c);f!==null&&(!(f.expirationTime>U)||D&&!H());){var ae=f.callback;if(typeof ae=="function"){f.callback=null,p=f.priorityLevel;var Re=ae(f.expirationTime<=U);U=e.unstable_now(),typeof Re=="function"?f.callback=Re:f===n(c)&&r(c),x(U)}else r(c);f=n(c)}if(f!==null)var ct=!0;else{var Ue=n(u);Ue!==null&&oe(j,Ue.startTime-U),ct=!1}return ct}finally{f=null,p=Y,y=!1}}var S=!1,N=null,_=-1,E=5,I=-1;function H(){return!(e.unstable_now()-ID||125ae?(D.sortIndex=Y,t(u,D),n(c)===null&&D===n(u)&&(g?(v(_),_=-1):g=!0,oe(j,Y-ae))):(D.sortIndex=Re,t(c,D),b||y||(b=!0,q(T))),D},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(D){var U=p;return function(){var Y=p;p=U;try{return D.apply(this,arguments)}finally{p=Y}}}})(xb);yb.exports=xb;var tk=yb.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var nk=h,pn=tk;function $(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hf=Object.prototype.hasOwnProperty,rk=/^[: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]*$/,qm={},Zm={};function sk(e){return hf.call(Zm,e)?!0:hf.call(qm,e)?!1:rk.test(e)?Zm[e]=!0:(qm[e]=!0,!1)}function ik(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ok(e,t,n,r){if(t===null||typeof t>"u"||ik(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Bt(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var _t={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){_t[e]=new Bt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];_t[t]=new Bt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){_t[e]=new Bt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){_t[e]=new Bt(e,2,!1,e,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(e){_t[e]=new Bt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){_t[e]=new Bt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){_t[e]=new Bt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){_t[e]=new Bt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){_t[e]=new Bt(e,5,!1,e.toLowerCase(),null,!1,!1)});var rh=/[\-:]([a-z])/g;function sh(e){return e[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(e){var t=e.replace(rh,sh);_t[t]=new Bt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(rh,sh);_t[t]=new Bt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(rh,sh);_t[t]=new Bt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){_t[e]=new Bt(e,1,!1,e.toLowerCase(),null,!1,!1)});_t.xlinkHref=new Bt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){_t[e]=new Bt(e,1,!1,e.toLowerCase(),null,!0,!0)});function ih(e,t,n,r){var s=_t.hasOwnProperty(t)?_t[t]:null;(s!==null?s.type!==0:r||!(2l||s[o]!==i[l]){var c=` `+s[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{pd=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?pa(e):""}function ak(e){switch(e.tag){case 5:return pa(e.type);case 16:return pa("Lazy");case 13:return pa("Suspense");case 19:return pa("SuspenseList");case 0:case 2:case 15:return e=hd(e.type,!1),e;case 11:return e=hd(e.type.render,!1),e;case 1:return e=hd(e.type,!0),e;default:return""}}function yf(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ji:return"Fragment";case _i:return"Portal";case mf:return"Profiler";case oh:return"StrictMode";case gf:return"Suspense";case vf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Sb:return(e.displayName||"Context")+".Consumer";case bb:return(e._context.displayName||"Context")+".Provider";case ah:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case lh:return t=e.displayName||null,t!==null?t:yf(e.type)||"Memo";case Wr:t=e._payload,e=e._init;try{return yf(e(t))}catch{}}return null}function lk(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return yf(t);case 8:return t===oh?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ys(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _b(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ck(e){var t=_b(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $l(e){e._valueTracker||(e._valueTracker=ck(e))}function jb(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=_b(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Dc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function xf(e,t){var n=t.checked;return et({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Gm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ys(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Cb(e,t){t=t.checked,t!=null&&ih(e,"checked",t,!1)}function wf(e,t){Cb(e,t);var n=ys(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?bf(e,t.type,n):t.hasOwnProperty("defaultValue")&&bf(e,t.type,ys(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Xm(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function bf(e,t,n){(t!=="number"||Dc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ha=Array.isArray;function Zi(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Ul.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Va(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ca={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},uk=["Webkit","ms","Moz","O"];Object.keys(Ca).forEach(function(e){uk.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ca[t]=Ca[e]})});function Pb(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ca.hasOwnProperty(e)&&Ca[e]?(""+t).trim():t+"px"}function Ab(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Pb(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var dk=et({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 _f(e,t){if(t){if(dk[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error($(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error($(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error($(61))}if(t.style!=null&&typeof t.style!="object")throw Error($(62))}}function jf(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Cf=null;function ch(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ef=null,Ki=null,Gi=null;function eg(e){if(e=_l(e)){if(typeof Ef!="function")throw Error($(280));var t=e.stateNode;t&&(t=Iu(t),Ef(e.stateNode,e.type,t))}}function Rb(e){Ki?Gi?Gi.push(e):Gi=[e]:Ki=e}function Ib(){if(Ki){var e=Ki,t=Gi;if(Gi=Ki=null,eg(e),t)for(e=0;e>>=0,e===0?32:31-(Sk(e)/Nk|0)|0}var Bl=64,Wl=4194304;function ma(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Lc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=ma(l):(i&=o,i!==0&&(r=ma(i)))}else o=n&~s,o!==0?r=ma(o):i!==0&&(r=ma(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Sl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-On(t),e[t]=n}function Ek(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Ta),cg=" ",ug=!1;function Jb(e,t){switch(e){case"keyup":return tP.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function e1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ci=!1;function rP(e,t){switch(e){case"compositionend":return e1(t);case"keypress":return t.which!==32?null:(ug=!0,cg);case"textInput":return e=t.data,e===cg&&ug?null:e;default:return null}}function sP(e,t){if(Ci)return e==="compositionend"||!vh&&Jb(e,t)?(e=Xb(),hc=hh=is=null,Ci=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=hg(n)}}function s1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?s1(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function i1(){for(var e=window,t=Dc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Dc(e.document)}return t}function yh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function pP(e){var t=i1(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&s1(n.ownerDocument.documentElement,n)){if(r!==null&&yh(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=mg(n,i);var o=mg(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ei=null,If=null,Pa=null,Df=!1;function gg(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Df||Ei==null||Ei!==Dc(r)||(r=Ei,"selectionStart"in r&&yh(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Pa&&Ha(Pa,r)||(Pa=r,r=$c(If,"onSelect"),0Pi||(e.current=zf[Pi],zf[Pi]=null,Pi--)}function $e(e,t){Pi++,zf[Pi]=e.current,e.current=t}var xs={},Rt=ks(xs),Xt=ks(!1),ei=xs;function Eo(e,t){var n=e.type.contextTypes;if(!n)return xs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Yt(e){return e=e.childContextTypes,e!=null}function Bc(){Qe(Xt),Qe(Rt)}function Ng(e,t,n){if(Rt.current!==xs)throw Error($(168));$e(Rt,t),$e(Xt,n)}function h1(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error($(108,lk(e)||"Unknown",s));return et({},n,r)}function Wc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xs,ei=Rt.current,$e(Rt,e),$e(Xt,Xt.current),!0}function _g(e,t,n){var r=e.stateNode;if(!r)throw Error($(169));n?(e=h1(e,t,ei),r.__reactInternalMemoizedMergedChildContext=e,Qe(Xt),Qe(Rt),$e(Rt,e)):Qe(Xt),$e(Xt,n)}var vr=null,Du=!1,Td=!1;function m1(e){vr===null?vr=[e]:vr.push(e)}function jP(e){Du=!0,m1(e)}function Ps(){if(!Td&&vr!==null){Td=!0;var e=0,t=Ve;try{var n=vr;for(Ve=1;e>=o,s-=o,wr=1<<32-On(t)+s|n<_?(E=N,N=null):E=N.sibling;var I=p(v,N,x[_],j);if(I===null){N===null&&(N=E);break}e&&N&&I.alternate===null&&t(v,N),m=i(I,m,_),S===null?T=I:S.sibling=I,S=I,N=E}if(_===x.length)return n(v,N),Ze&&Ds(v,_),T;if(N===null){for(;__?(E=N,N=null):E=N.sibling;var H=p(v,N,I.value,j);if(H===null){N===null&&(N=E);break}e&&N&&H.alternate===null&&t(v,N),m=i(H,m,_),S===null?T=H:S.sibling=H,S=H,N=E}if(I.done)return n(v,N),Ze&&Ds(v,_),T;if(N===null){for(;!I.done;_++,I=x.next())I=f(v,I.value,j),I!==null&&(m=i(I,m,_),S===null?T=I:S.sibling=I,S=I);return Ze&&Ds(v,_),T}for(N=r(v,N);!I.done;_++,I=x.next())I=y(N,v,_,I.value,j),I!==null&&(e&&I.alternate!==null&&N.delete(I.key===null?_:I.key),m=i(I,m,_),S===null?T=I:S.sibling=I,S=I);return e&&N.forEach(function(M){return t(v,M)}),Ze&&Ds(v,_),T}function w(v,m,x,j){if(typeof x=="object"&&x!==null&&x.type===ji&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case zl:e:{for(var T=x.key,S=m;S!==null;){if(S.key===T){if(T=x.type,T===ji){if(S.tag===7){n(v,S.sibling),m=s(S,x.props.children),m.return=v,v=m;break e}}else if(S.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Wr&&Eg(T)===S.type){n(v,S.sibling),m=s(S,x.props),m.ref=oa(v,S,x),m.return=v,v=m;break e}n(v,S);break}else t(v,S);S=S.sibling}x.type===ji?(m=Ys(x.props.children,v.mode,j,x.key),m.return=v,v=m):(j=Sc(x.type,x.key,x.props,null,v.mode,j),j.ref=oa(v,m,x),j.return=v,v=j)}return o(v);case _i:e:{for(S=x.key;m!==null;){if(m.key===S)if(m.tag===4&&m.stateNode.containerInfo===x.containerInfo&&m.stateNode.implementation===x.implementation){n(v,m.sibling),m=s(m,x.children||[]),m.return=v,v=m;break e}else{n(v,m);break}else t(v,m);m=m.sibling}m=Md(x,v.mode,j),m.return=v,v=m}return o(v);case Wr:return S=x._init,w(v,m,S(x._payload),j)}if(ha(x))return b(v,m,x,j);if(ta(x))return g(v,m,x,j);Xl(v,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,m!==null&&m.tag===6?(n(v,m.sibling),m=s(m,x),m.return=v,v=m):(n(v,m),m=Od(x,v.mode,j),m.return=v,v=m),o(v)):n(v,m)}return w}var ko=x1(!0),w1=x1(!1),qc=ks(null),Zc=null,Ii=null,Sh=null;function Nh(){Sh=Ii=Zc=null}function _h(e){var t=qc.current;Qe(qc),e._currentValue=t}function Bf(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Yi(e,t){Zc=e,Sh=Ii=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Kt=!0),e.firstContext=null)}function _n(e){var t=e._currentValue;if(Sh!==e)if(e={context:e,memoizedValue:t,next:null},Ii===null){if(Zc===null)throw Error($(308));Ii=e,Zc.dependencies={lanes:0,firstContext:e}}else Ii=Ii.next=e;return t}var Ls=null;function jh(e){Ls===null?Ls=[e]:Ls.push(e)}function b1(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,jh(t)):(n.next=s.next,s.next=n),t.interleaved=n,Tr(e,r)}function Tr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Hr=!1;function Ch(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function S1(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function _r(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ps(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,De&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Tr(e,n)}return s=r.interleaved,s===null?(t.next=t,jh(r)):(t.next=s.next,s.next=t),r.interleaved=t,Tr(e,n)}function gc(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dh(e,n)}}function Tg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Kc(e,t,n,r){var s=e.updateQueue;Hr=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,l=i;do{var p=l.lane,y=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:y,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var b=e,g=l;switch(p=t,y=n,g.tag){case 1:if(b=g.payload,typeof b=="function"){f=b.call(y,f,p);break e}f=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=g.payload,p=typeof b=="function"?b.call(y,f,p):b,p==null)break e;f=et({},f,p);break e;case 2:Hr=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else y={eventTime:y,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=y,c=f):d=d.next=y,o|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);ri|=o,e.lanes=o,e.memoizedState=f}}function kg(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Pd.transition;Pd.transition={};try{e(!1),t()}finally{Ve=n,Pd.transition=r}}function V1(){return jn().memoizedState}function kP(e,t,n){var r=ms(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},z1(e))$1(t,n);else if(n=b1(e,t,n,r),n!==null){var s=zt();Mn(n,e,r,s),U1(n,t,r)}}function PP(e,t,n){var r=ms(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(z1(e))$1(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Ln(l,o)){var c=t.interleaved;c===null?(s.next=s,jh(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=b1(e,t,s,r),n!==null&&(s=zt(),Mn(n,e,r,s),U1(n,t,r))}}function z1(e){var t=e.alternate;return e===Je||t!==null&&t===Je}function $1(e,t){Aa=Xc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function U1(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dh(e,n)}}var Yc={readContext:_n,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useInsertionEffect:Et,useLayoutEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useMutableSource:Et,useSyncExternalStore:Et,useId:Et,unstable_isNewReconciler:!1},AP={readContext:_n,useCallback:function(e,t){return Wn().memoizedState=[e,t===void 0?null:t],e},useContext:_n,useEffect:Ag,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,yc(4194308,4,D1.bind(null,t,e),n)},useLayoutEffect:function(e,t){return yc(4194308,4,e,t)},useInsertionEffect:function(e,t){return yc(4,2,e,t)},useMemo:function(e,t){var n=Wn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=kP.bind(null,Je,e),[r.memoizedState,e]},useRef:function(e){var t=Wn();return e={current:e},t.memoizedState=e},useState:Pg,useDebugValue:Dh,useDeferredValue:function(e){return Wn().memoizedState=e},useTransition:function(){var e=Pg(!1),t=e[0];return e=TP.bind(null,e[1]),Wn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Je,s=Wn();if(Ze){if(n===void 0)throw Error($(407));n=n()}else{if(n=t(),wt===null)throw Error($(349));ni&30||C1(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Ag(T1.bind(null,r,i,e),[e]),r.flags|=2048,Ja(9,E1.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Wn(),t=wt.identifierPrefix;if(Ze){var n=br,r=wr;n=(r&~(1<<32-On(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Xa++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Jn]=t,e[Za]=r,Y1(e,t,!1,!1),t.stateNode=e;e:{switch(o=jf(n,r),n){case"dialog":We("cancel",e),We("close",e),s=r;break;case"iframe":case"object":case"embed":We("load",e),s=r;break;case"video":case"audio":for(s=0;sRo&&(t.flags|=128,r=!0,aa(i,!1),t.lanes=4194304)}else{if(!r)if(e=Gc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),aa(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ze)return Tt(t),null}else 2*at()-i.renderingStartTime>Ro&&n!==1073741824&&(t.flags|=128,r=!0,aa(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=at(),t.sibling=null,n=Ye.current,$e(Ye,r?n&1|2:n&1),t):(Tt(t),null);case 22:case 23:return zh(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?sn&1073741824&&(Tt(t),t.subtreeFlags&6&&(t.flags|=8192)):Tt(t),null;case 24:return null;case 25:return null}throw Error($(156,t.tag))}function VP(e,t){switch(wh(t),t.tag){case 1:return Yt(t.type)&&Bc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Po(),Qe(Xt),Qe(Rt),kh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Th(t),null;case 13:if(Qe(Ye),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error($(340));To()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Qe(Ye),null;case 4:return Po(),null;case 10:return _h(t.type._context),null;case 22:case 23:return zh(),null;case 24:return null;default:return null}}var Jl=!1,At=!1,zP=typeof WeakSet=="function"?WeakSet:Set,J=null;function Di(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){rt(e,t,r)}else n.current=null}function Yf(e,t,n){try{n()}catch(r){rt(e,t,r)}}var Ug=!1;function $P(e,t){if(Of=Vc,e=i1(),yh(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var y;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(y=f.firstChild)!==null;)p=f,f=y;for(;;){if(f===e)break t;if(p===n&&++u===s&&(l=o),p===i&&++d===r&&(c=o),(y=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=y}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Mf={focusedElem:e,selectionRange:n},Vc=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var b=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var g=b.memoizedProps,w=b.memoizedState,v=t.stateNode,m=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Tn(t.type,g),w);v.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error($(163))}}catch(j){rt(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return b=Ug,Ug=!1,b}function Ra(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Yf(t,n,i)}s=s.next}while(s!==r)}}function Fu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Jf(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function tS(e){var t=e.alternate;t!==null&&(e.alternate=null,tS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Jn],delete t[Za],delete t[Vf],delete t[NP],delete t[_P])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function nS(e){return e.tag===5||e.tag===3||e.tag===4}function Bg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||nS(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ep(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Uc));else if(r!==4&&(e=e.child,e!==null))for(ep(e,t,n),e=e.sibling;e!==null;)ep(e,t,n),e=e.sibling}function tp(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(tp(e,t,n),e=e.sibling;e!==null;)tp(e,t,n),e=e.sibling}var St=null,Pn=!1;function Lr(e,t,n){for(n=n.child;n!==null;)rS(e,t,n),n=n.sibling}function rS(e,t,n){if(sr&&typeof sr.onCommitFiberUnmount=="function")try{sr.onCommitFiberUnmount(ku,n)}catch{}switch(n.tag){case 5:At||Di(n,t);case 6:var r=St,s=Pn;St=null,Lr(e,t,n),St=r,Pn=s,St!==null&&(Pn?(e=St,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):St.removeChild(n.stateNode));break;case 18:St!==null&&(Pn?(e=St,n=n.stateNode,e.nodeType===8?Ed(e.parentNode,n):e.nodeType===1&&Ed(e,n),Ba(e)):Ed(St,n.stateNode));break;case 4:r=St,s=Pn,St=n.stateNode.containerInfo,Pn=!0,Lr(e,t,n),St=r,Pn=s;break;case 0:case 11:case 14:case 15:if(!At&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Yf(n,t,o),s=s.next}while(s!==r)}Lr(e,t,n);break;case 1:if(!At&&(Di(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){rt(n,t,l)}Lr(e,t,n);break;case 21:Lr(e,t,n);break;case 22:n.mode&1?(At=(r=At)||n.memoizedState!==null,Lr(e,t,n),At=r):Lr(e,t,n);break;default:Lr(e,t,n)}}function Wg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new zP),t.forEach(function(r){var s=GP.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Cn(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=at()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*BP(r/1960))-r,10e?16:e,os===null)var r=!1;else{if(e=os,os=null,tu=0,De&6)throw Error($(331));var s=De;for(De|=4,J=e.current;J!==null;){var i=J,o=i.child;if(J.flags&16){var l=i.deletions;if(l!==null){for(var c=0;cat()-Lh?Xs(e,0):Fh|=n),Jt(e,t)}function dS(e,t){t===0&&(e.mode&1?(t=Wl,Wl<<=1,!(Wl&130023424)&&(Wl=4194304)):t=1);var n=zt();e=Tr(e,t),e!==null&&(Sl(e,t,n),Jt(e,n))}function KP(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),dS(e,n)}function GP(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error($(314))}r!==null&&r.delete(t),dS(e,n)}var fS;fS=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Xt.current)Kt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Kt=!1,FP(e,t,n);Kt=!!(e.flags&131072)}else Kt=!1,Ze&&t.flags&1048576&&g1(t,Qc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;xc(e,t),e=t.pendingProps;var s=Eo(t,Rt.current);Yi(t,n),s=Ah(null,t,r,e,s,n);var i=Rh();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Yt(r)?(i=!0,Wc(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Ch(t),s.updater=Mu,t.stateNode=s,s._reactInternals=t,Hf(t,r,e,n),t=Zf(null,t,r,!0,i,n)):(t.tag=0,Ze&&i&&xh(t),Lt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(xc(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=YP(r),e=Tn(r,e),s){case 0:t=qf(null,t,r,e,n);break e;case 1:t=Vg(null,t,r,e,n);break e;case 11:t=Fg(null,t,r,e,n);break e;case 14:t=Lg(null,t,r,Tn(r.type,e),n);break e}throw Error($(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tn(r,s),qf(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tn(r,s),Vg(e,t,r,s,n);case 3:e:{if(K1(t),e===null)throw Error($(387));r=t.pendingProps,i=t.memoizedState,s=i.element,S1(e,t),Kc(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Ao(Error($(423)),t),t=zg(e,t,r,n,s);break e}else if(r!==s){s=Ao(Error($(424)),t),t=zg(e,t,r,n,s);break e}else for(cn=fs(t.stateNode.containerInfo.firstChild),un=t,Ze=!0,An=null,n=w1(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(To(),r===s){t=kr(e,t,n);break e}Lt(e,t,r,n)}t=t.child}return t;case 5:return N1(t),e===null&&Uf(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Ff(r,s)?o=null:i!==null&&Ff(r,i)&&(t.flags|=32),Z1(e,t),Lt(e,t,o,n),t.child;case 6:return e===null&&Uf(t),null;case 13:return G1(e,t,n);case 4:return Eh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ko(t,null,r,n):Lt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tn(r,s),Fg(e,t,r,s,n);case 7:return Lt(e,t,t.pendingProps,n),t.child;case 8:return Lt(e,t,t.pendingProps.children,n),t.child;case 12:return Lt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,$e(qc,r._currentValue),r._currentValue=o,i!==null)if(Ln(i.value,o)){if(i.children===s.children&&!Xt.current){t=kr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=_r(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Bf(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error($(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Bf(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Lt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Yi(t,n),s=_n(s),r=r(s),t.flags|=1,Lt(e,t,r,n),t.child;case 14:return r=t.type,s=Tn(r,t.pendingProps),s=Tn(r.type,s),Lg(e,t,r,s,n);case 15:return Q1(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tn(r,s),xc(e,t),t.tag=1,Yt(r)?(e=!0,Wc(t)):e=!1,Yi(t,n),B1(t,r,s),Hf(t,r,s,n),Zf(null,t,r,!0,e,n);case 19:return X1(e,t,n);case 22:return q1(e,t,n)}throw Error($(156,t.tag))};function pS(e,t){return zb(e,t)}function XP(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sn(e,t,n,r){return new XP(e,t,n,r)}function Uh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function YP(e){if(typeof e=="function")return Uh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ah)return 11;if(e===lh)return 14}return 2}function gs(e,t){var n=e.alternate;return n===null?(n=Sn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Sc(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")Uh(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ji:return Ys(n.children,s,i,t);case oh:o=8,s|=8;break;case mf:return e=Sn(12,n,t,s|2),e.elementType=mf,e.lanes=i,e;case gf:return e=Sn(13,n,t,s),e.elementType=gf,e.lanes=i,e;case vf:return e=Sn(19,n,t,s),e.elementType=vf,e.lanes=i,e;case Nb:return Vu(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case bb:o=10;break e;case Sb:o=9;break e;case ah:o=11;break e;case lh:o=14;break e;case Wr:o=16,r=null;break e}throw Error($(130,e==null?e:typeof e,""))}return t=Sn(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Ys(e,t,n,r){return e=Sn(7,e,r,t),e.lanes=n,e}function Vu(e,t,n,r){return e=Sn(22,e,r,t),e.elementType=Nb,e.lanes=n,e.stateNode={isHidden:!1},e}function Od(e,t,n){return e=Sn(6,e,null,t),e.lanes=n,e}function Md(e,t,n){return t=Sn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function JP(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gd(0),this.expirationTimes=gd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gd(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Bh(e,t,n,r,s,i,o,l,c){return e=new JP(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Sn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ch(i),e}function e2(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vS)}catch(e){console.error(e)}}vS(),vb.exports=hn;var mi=vb.exports;const i2=ib(mi);var yS,Yg=mi;yS=Yg.createRoot,Yg.hydrateRoot;var Qo=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(){}},ii=typeof window>"u"||"Deno"in globalThis;function vn(){}function o2(e,t){return typeof e=="function"?e(t):e}function op(e){return typeof e=="number"&&e>=0&&e!==1/0}function xS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function eo(e,t){return typeof e=="function"?e(t):e}function Rn(e,t){return typeof e=="function"?e(t):e}function Jg(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==qh(o,t.options))return!1}else if(!tl(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||i&&!i(t))}function ev(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(oi(t.options.mutationKey)!==oi(i))return!1}else if(!tl(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function qh(e,t){return((t==null?void 0:t.queryKeyHashFn)||oi)(e)}function oi(e){return JSON.stringify(e,(t,n)=>ap(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function tl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!tl(e[n],t[n])):!1}function wS(e,t){if(e===t)return e;const n=tv(e)&&tv(t);if(n||ap(e)&&ap(t)){const r=n?e:Object.keys(e),s=r.length,i=n?t:Object.keys(t),o=i.length,l=n?[]:{};let c=0;for(let u=0;u{setTimeout(t,e)})}function lp(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?wS(e,t):t}function l2(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function c2(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Zh=Symbol();function bS(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Zh?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Ws,Gr,po,cy,u2=(cy=class extends Qo{constructor(){super();le(this,Ws);le(this,Gr);le(this,po);K(this,po,t=>{if(!ii&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){P(this,Gr)||this.setEventListener(P(this,po))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,Gr))==null||t.call(this),K(this,Gr,void 0))}setEventListener(t){var n;K(this,po,t),(n=P(this,Gr))==null||n.call(this),K(this,Gr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){P(this,Ws)!==t&&(K(this,Ws,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof P(this,Ws)=="boolean"?P(this,Ws):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ws=new WeakMap,Gr=new WeakMap,po=new WeakMap,cy),Kh=new u2,ho,Xr,mo,uy,d2=(uy=class extends Qo{constructor(){super();le(this,ho,!0);le(this,Xr);le(this,mo);K(this,mo,t=>{if(!ii&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){P(this,Xr)||this.setEventListener(P(this,mo))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,Xr))==null||t.call(this),K(this,Xr,void 0))}setEventListener(t){var n;K(this,mo,t),(n=P(this,Xr))==null||n.call(this),K(this,Xr,t(this.setOnline.bind(this)))}setOnline(t){P(this,ho)!==t&&(K(this,ho,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return P(this,ho)}},ho=new WeakMap,Xr=new WeakMap,mo=new WeakMap,uy),iu=new d2;function cp(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}function f2(e){return Math.min(1e3*2**e,3e4)}function SS(e){return(e??"online")==="online"?iu.isOnline():!0}var NS=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Fd(e){return e instanceof NS}function _S(e){let t=!1,n=0,r=!1,s;const i=cp(),o=g=>{var w;r||(p(new NS(g)),(w=e.abort)==null||w.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>Kh.isFocused()&&(e.networkMode==="always"||iu.isOnline())&&e.canRun(),d=()=>SS(e.networkMode)&&e.canRun(),f=g=>{var w;r||(r=!0,(w=e.onSuccess)==null||w.call(e,g),s==null||s(),i.resolve(g))},p=g=>{var w;r||(r=!0,(w=e.onError)==null||w.call(e,g),s==null||s(),i.reject(g))},y=()=>new Promise(g=>{var w;s=v=>{(r||u())&&g(v)},(w=e.onPause)==null||w.call(e)}).then(()=>{var g;s=void 0,r||(g=e.onContinue)==null||g.call(e)}),b=()=>{if(r)return;let g;const w=n===0?e.initialPromise:void 0;try{g=w??e.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(f).catch(v=>{var S;if(r)return;const m=e.retry??(ii?0:3),x=e.retryDelay??f2,j=typeof x=="function"?x(n,v):x,T=m===!0||typeof m=="number"&&nu()?void 0:y()).then(()=>{t?p(v):b()})})};return{promise:i,cancel:o,continue:()=>(s==null||s(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?b():y().then(b),i)}}function p2(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=l=>setTimeout(l,0);const i=l=>{t?e.push(l):s(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var gt=p2(),Hs,dy,jS=(dy=class{constructor(){le(this,Hs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),op(this.gcTime)&&K(this,Hs,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ii?1/0:5*60*1e3))}clearGcTimeout(){P(this,Hs)&&(clearTimeout(P(this,Hs)),K(this,Hs,void 0))}},Hs=new WeakMap,dy),go,vo,gn,kt,vl,Qs,kn,hr,fy,h2=(fy=class extends jS{constructor(t){super();le(this,kn);le(this,go);le(this,vo);le(this,gn);le(this,kt);le(this,vl);le(this,Qs);K(this,Qs,!1),K(this,vl,t.defaultOptions),this.setOptions(t.options),this.observers=[],K(this,gn,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,K(this,go,m2(this.options)),this.state=t.state??P(this,go),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=P(this,kt))==null?void 0:t.promise}setOptions(t){this.options={...P(this,vl),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&P(this,gn).remove(this)}setData(t,n){const r=lp(this.state.data,t,this.options);return be(this,kn,hr).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){be(this,kn,hr).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=P(this,kt))==null?void 0:r.promise;return(s=P(this,kt))==null||s.cancel(t),n?n.then(vn).catch(vn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(P(this,go))}isActive(){return this.observers.some(t=>Rn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Zh||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!xS(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,kt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,kt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),P(this,gn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(P(this,kt)&&(P(this,Qs)?P(this,kt).cancel({revert:!0}):P(this,kt).cancelRetry()),this.scheduleGc()),P(this,gn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||be(this,kn,hr).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(P(this,kt))return P(this,kt).continueRetry(),P(this,kt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(K(this,Qs,!0),r.signal)})},i=()=>{const f=bS(this.options,n),p={queryKey:this.queryKey,meta:this.meta};return s(p),K(this,Qs,!1),this.options.persister?this.options.persister(f,p,this):f(p)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};s(o),(c=this.options.behavior)==null||c.onFetch(o,this),K(this,vo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&be(this,kn,hr).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const l=f=>{var p,y,b,g;Fd(f)&&f.silent||be(this,kn,hr).call(this,{type:"error",error:f}),Fd(f)||((y=(p=P(this,gn).config).onError)==null||y.call(p,f,this),(g=(b=P(this,gn).config).onSettled)==null||g.call(b,this.state.data,f,this)),this.scheduleGc()};return K(this,kt,_S({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var p,y,b,g;if(f===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(w){l(w);return}(y=(p=P(this,gn).config).onSuccess)==null||y.call(p,f,this),(g=(b=P(this,gn).config).onSettled)==null||g.call(b,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,p)=>{be(this,kn,hr).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{be(this,kn,hr).call(this,{type:"pause"})},onContinue:()=>{be(this,kn,hr).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),P(this,kt).start()}},go=new WeakMap,vo=new WeakMap,gn=new WeakMap,kt=new WeakMap,vl=new WeakMap,Qs=new WeakMap,kn=new WeakSet,hr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...CS(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return Fd(s)&&s.revert&&P(this,vo)?{...P(this,vo),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),gt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),P(this,gn).notify({query:this,type:"updated",action:t})})},fy);function CS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:SS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function m2(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Kn,py,g2=(py=class extends Qo{constructor(t={}){super();le(this,Kn);this.config=t,K(this,Kn,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??qh(s,n);let o=this.get(i);return o||(o=new h2({cache:this,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){P(this,Kn).has(t.queryHash)||(P(this,Kn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=P(this,Kn).get(t.queryHash);n&&(t.destroy(),n===t&&P(this,Kn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){gt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return P(this,Kn).get(t)}getAll(){return[...P(this,Kn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Jg(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Jg(t,r)):n}notify(t){gt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){gt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){gt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Kn=new WeakMap,py),Gn,Mt,qs,Xn,Ur,hy,v2=(hy=class extends jS{constructor(t){super();le(this,Xn);le(this,Gn);le(this,Mt);le(this,qs);this.mutationId=t.mutationId,K(this,Mt,t.mutationCache),K(this,Gn,[]),this.state=t.state||ES(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){P(this,Gn).includes(t)||(P(this,Gn).push(t),this.clearGcTimeout(),P(this,Mt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){K(this,Gn,P(this,Gn).filter(n=>n!==t)),this.scheduleGc(),P(this,Mt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){P(this,Gn).length||(this.state.status==="pending"?this.scheduleGc():P(this,Mt).remove(this))}continue(){var t;return((t=P(this,qs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,i,o,l,c,u,d,f,p,y,b,g,w,v,m,x,j,T,S,N;K(this,qs,_S({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(_,E)=>{be(this,Xn,Ur).call(this,{type:"failed",failureCount:_,error:E})},onPause:()=>{be(this,Xn,Ur).call(this,{type:"pause"})},onContinue:()=>{be(this,Xn,Ur).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>P(this,Mt).canRun(this)}));const n=this.state.status==="pending",r=!P(this,qs).canStart();try{if(!n){be(this,Xn,Ur).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(s=P(this,Mt).config).onMutate)==null?void 0:i.call(s,t,this));const E=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t));E!==this.state.context&&be(this,Xn,Ur).call(this,{type:"pending",context:E,variables:t,isPaused:r})}const _=await P(this,qs).start();return await((u=(c=P(this,Mt).config).onSuccess)==null?void 0:u.call(c,_,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,_,t,this.state.context)),await((y=(p=P(this,Mt).config).onSettled)==null?void 0:y.call(p,_,null,this.state.variables,this.state.context,this)),await((g=(b=this.options).onSettled)==null?void 0:g.call(b,_,null,t,this.state.context)),be(this,Xn,Ur).call(this,{type:"success",data:_}),_}catch(_){try{throw await((v=(w=P(this,Mt).config).onError)==null?void 0:v.call(w,_,t,this.state.context,this)),await((x=(m=this.options).onError)==null?void 0:x.call(m,_,t,this.state.context)),await((T=(j=P(this,Mt).config).onSettled)==null?void 0:T.call(j,void 0,_,this.state.variables,this.state.context,this)),await((N=(S=this.options).onSettled)==null?void 0:N.call(S,void 0,_,t,this.state.context)),_}finally{be(this,Xn,Ur).call(this,{type:"error",error:_})}}finally{P(this,Mt).runNext(this)}}},Gn=new WeakMap,Mt=new WeakMap,qs=new WeakMap,Xn=new WeakSet,Ur=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),gt.batch(()=>{P(this,Gn).forEach(r=>{r.onMutationUpdate(t)}),P(this,Mt).notify({mutation:this,type:"updated",action:t})})},hy);function ES(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var rn,yl,my,y2=(my=class extends Qo{constructor(t={}){super();le(this,rn);le(this,yl);this.config=t,K(this,rn,new Map),K(this,yl,Date.now())}build(t,n,r){const s=new v2({mutationCache:this,mutationId:++Ll(this,yl)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){const n=nc(t),r=P(this,rn).get(n)??[];r.push(t),P(this,rn).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=nc(t);if(P(this,rn).has(n)){const s=(r=P(this,rn).get(n))==null?void 0:r.filter(i=>i!==t);s&&(s.length===0?P(this,rn).delete(n):P(this,rn).set(n,s))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=P(this,rn).get(nc(t)))==null?void 0:r.find(s=>s.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=P(this,rn).get(nc(t)))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){gt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...P(this,rn).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ev(n,r))}findAll(t={}){return this.getAll().filter(n=>ev(t,n))}notify(t){gt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return gt.batch(()=>Promise.all(t.map(n=>n.continue().catch(vn))))}},rn=new WeakMap,yl=new WeakMap,my);function nc(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function rv(e){return{onFetch:(t,n)=>{var d,f,p,y,b;const r=t.options,s=(p=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,i=((y=t.state.data)==null?void 0:y.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let g=!1;const w=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},v=bS(t.options,t.fetchOptions),m=async(x,j,T)=>{if(g)return Promise.reject();if(j==null&&x.pages.length)return Promise.resolve(x);const S={queryKey:t.queryKey,pageParam:j,direction:T?"backward":"forward",meta:t.options.meta};w(S);const N=await v(S),{maxPages:_}=t.options,E=T?c2:l2;return{pages:E(x.pages,N,_),pageParams:E(x.pageParams,j,_)}};if(s&&i.length){const x=s==="backward",j=x?x2:sv,T={pages:i,pageParams:o},S=j(r,T);l=await m(T,S,x)}else{const x=e??i.length;do{const j=c===0?o[0]??r.initialPageParam:sv(r,l);if(c>0&&j==null)break;l=await m(l,j),c++}while(c{var g,w;return(w=(g=t.options).persister)==null?void 0:w.call(g,u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function sv(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function x2(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var tt,Yr,Jr,yo,xo,es,wo,bo,gy,w2=(gy=class{constructor(e={}){le(this,tt);le(this,Yr);le(this,Jr);le(this,yo);le(this,xo);le(this,es);le(this,wo);le(this,bo);K(this,tt,e.queryCache||new g2),K(this,Yr,e.mutationCache||new y2),K(this,Jr,e.defaultOptions||{}),K(this,yo,new Map),K(this,xo,new Map),K(this,es,0)}mount(){Ll(this,es)._++,P(this,es)===1&&(K(this,wo,Kh.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,tt).onFocus())})),K(this,bo,iu.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,tt).onOnline())})))}unmount(){var e,t;Ll(this,es)._--,P(this,es)===0&&((e=P(this,wo))==null||e.call(this),K(this,wo,void 0),(t=P(this,bo))==null||t.call(this),K(this,bo,void 0))}isFetching(e){return P(this,tt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return P(this,Yr).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,tt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=P(this,tt).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(eo(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return P(this,tt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=P(this,tt).get(r.queryHash),i=s==null?void 0:s.state.data,o=o2(t,i);if(o!==void 0)return P(this,tt).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return gt.batch(()=>P(this,tt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,tt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=P(this,tt);gt.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=P(this,tt),r={type:"active",...e};return gt.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=gt.batch(()=>P(this,tt).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(vn).catch(vn)}invalidateQueries(e={},t={}){return gt.batch(()=>{if(P(this,tt).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=gt.batch(()=>P(this,tt).findAll(e).filter(s=>!s.isDisabled()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(vn)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(vn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=P(this,tt).build(this,t);return n.isStaleByTime(eo(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(vn).catch(vn)}fetchInfiniteQuery(e){return e.behavior=rv(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(vn).catch(vn)}ensureInfiniteQueryData(e){return e.behavior=rv(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return iu.isOnline()?P(this,Yr).resumePausedMutations():Promise.resolve()}getQueryCache(){return P(this,tt)}getMutationCache(){return P(this,Yr)}getDefaultOptions(){return P(this,Jr)}setDefaultOptions(e){K(this,Jr,e)}setQueryDefaults(e,t){P(this,yo).set(oi(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...P(this,yo).values()];let n={};return t.forEach(r=>{tl(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){P(this,xo).set(oi(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...P(this,xo).values()];let n={};return t.forEach(r=>{tl(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...P(this,Jr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=qh(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.enabled!==!0&&t.queryFn===Zh&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...P(this,Jr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){P(this,tt).clear(),P(this,Yr).clear()}},tt=new WeakMap,Yr=new WeakMap,Jr=new WeakMap,yo=new WeakMap,xo=new WeakMap,es=new WeakMap,wo=new WeakMap,bo=new WeakMap,gy),Wt,ke,xl,Ft,Zs,So,ts,Yn,wl,No,_o,Ks,Gs,ns,jo,Le,va,up,dp,fp,pp,hp,mp,gp,TS,vy,b2=(vy=class extends Qo{constructor(t,n){super();le(this,Le);le(this,Wt);le(this,ke);le(this,xl);le(this,Ft);le(this,Zs);le(this,So);le(this,ts);le(this,Yn);le(this,wl);le(this,No);le(this,_o);le(this,Ks);le(this,Gs);le(this,ns);le(this,jo,new Set);this.options=n,K(this,Wt,t),K(this,Yn,null),K(this,ts,cp()),this.options.experimental_prefetchInRender||P(this,ts).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(P(this,ke).addObserver(this),iv(P(this,ke),this.options)?be(this,Le,va).call(this):this.updateResult(),be(this,Le,pp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vp(P(this,ke),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vp(P(this,ke),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,be(this,Le,hp).call(this),be(this,Le,mp).call(this),P(this,ke).removeObserver(this)}setOptions(t,n){const r=this.options,s=P(this,ke);if(this.options=P(this,Wt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rn(this.options.enabled,P(this,ke))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");be(this,Le,gp).call(this),P(this,ke).setOptions(this.options),r._defaulted&&!su(this.options,r)&&P(this,Wt).getQueryCache().notify({type:"observerOptionsUpdated",query:P(this,ke),observer:this});const i=this.hasListeners();i&&ov(P(this,ke),s,this.options,r)&&be(this,Le,va).call(this),this.updateResult(n),i&&(P(this,ke)!==s||Rn(this.options.enabled,P(this,ke))!==Rn(r.enabled,P(this,ke))||eo(this.options.staleTime,P(this,ke))!==eo(r.staleTime,P(this,ke)))&&be(this,Le,up).call(this);const o=be(this,Le,dp).call(this);i&&(P(this,ke)!==s||Rn(this.options.enabled,P(this,ke))!==Rn(r.enabled,P(this,ke))||o!==P(this,ns))&&be(this,Le,fp).call(this,o)}getOptimisticResult(t){const n=P(this,Wt).getQueryCache().build(P(this,Wt),t),r=this.createResult(n,t);return N2(this,r)&&(K(this,Ft,r),K(this,So,this.options),K(this,Zs,P(this,ke).state)),r}getCurrentResult(){return P(this,Ft)}trackResult(t,n){const r={};return Object.keys(t).forEach(s=>{Object.defineProperty(r,s,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(s),n==null||n(s),t[s])})}),r}trackProp(t){P(this,jo).add(t)}getCurrentQuery(){return P(this,ke)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=P(this,Wt).defaultQueryOptions(t),r=P(this,Wt).getQueryCache().build(P(this,Wt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return be(this,Le,va).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),P(this,Ft)))}createResult(t,n){var _;const r=P(this,ke),s=this.options,i=P(this,Ft),o=P(this,Zs),l=P(this,So),u=t!==r?t.state:P(this,xl),{state:d}=t;let f={...d},p=!1,y;if(n._optimisticResults){const E=this.hasListeners(),I=!E&&iv(t,n),H=E&&ov(t,r,n,s);(I||H)&&(f={...f,...CS(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:g,status:w}=f;if(n.select&&f.data!==void 0)if(i&&f.data===(o==null?void 0:o.data)&&n.select===P(this,wl))y=P(this,No);else try{K(this,wl,n.select),y=n.select(f.data),y=lp(i==null?void 0:i.data,y,n),K(this,No,y),K(this,Yn,null)}catch(E){K(this,Yn,E)}else y=f.data;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let E;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData))E=i.data;else if(E=typeof n.placeholderData=="function"?n.placeholderData((_=P(this,_o))==null?void 0:_.state.data,P(this,_o)):n.placeholderData,n.select&&E!==void 0)try{E=n.select(E),K(this,Yn,null)}catch(I){K(this,Yn,I)}E!==void 0&&(w="success",y=lp(i==null?void 0:i.data,E,n),p=!0)}P(this,Yn)&&(b=P(this,Yn),y=P(this,No),g=Date.now(),w="error");const v=f.fetchStatus==="fetching",m=w==="pending",x=w==="error",j=m&&v,T=y!==void 0,N={status:w,fetchStatus:f.fetchStatus,isPending:m,isSuccess:w==="success",isError:x,isInitialLoading:j,isLoading:j,data:y,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:v,isRefetching:v&&!m,isLoadingError:x&&!T,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:x&&T,isStale:Gh(t,n),refetch:this.refetch,promise:P(this,ts)};if(this.options.experimental_prefetchInRender){const E=M=>{N.status==="error"?M.reject(N.error):N.data!==void 0&&M.resolve(N.data)},I=()=>{const M=K(this,ts,N.promise=cp());E(M)},H=P(this,ts);switch(H.status){case"pending":t.queryHash===r.queryHash&&E(H);break;case"fulfilled":(N.status==="error"||N.data!==H.value)&&I();break;case"rejected":(N.status!=="error"||N.error!==H.reason)&&I();break}}return N}updateResult(t){const n=P(this,Ft),r=this.createResult(P(this,ke),this.options);if(K(this,Zs,P(this,ke).state),K(this,So,this.options),P(this,Zs).data!==void 0&&K(this,_o,P(this,ke)),su(r,n))return;K(this,Ft,r);const s={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:o}=this.options,l=typeof o=="function"?o():o;if(l==="all"||!l&&!P(this,jo).size)return!0;const c=new Set(l??P(this,jo));return this.options.throwOnError&&c.add("error"),Object.keys(P(this,Ft)).some(u=>{const d=u;return P(this,Ft)[d]!==n[d]&&c.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(s.listeners=!0),be(this,Le,TS).call(this,{...s,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&be(this,Le,pp).call(this)}},Wt=new WeakMap,ke=new WeakMap,xl=new WeakMap,Ft=new WeakMap,Zs=new WeakMap,So=new WeakMap,ts=new WeakMap,Yn=new WeakMap,wl=new WeakMap,No=new WeakMap,_o=new WeakMap,Ks=new WeakMap,Gs=new WeakMap,ns=new WeakMap,jo=new WeakMap,Le=new WeakSet,va=function(t){be(this,Le,gp).call(this);let n=P(this,ke).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(vn)),n},up=function(){be(this,Le,hp).call(this);const t=eo(this.options.staleTime,P(this,ke));if(ii||P(this,Ft).isStale||!op(t))return;const r=xS(P(this,Ft).dataUpdatedAt,t)+1;K(this,Ks,setTimeout(()=>{P(this,Ft).isStale||this.updateResult()},r))},dp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(P(this,ke)):this.options.refetchInterval)??!1},fp=function(t){be(this,Le,mp).call(this),K(this,ns,t),!(ii||Rn(this.options.enabled,P(this,ke))===!1||!op(P(this,ns))||P(this,ns)===0)&&K(this,Gs,setInterval(()=>{(this.options.refetchIntervalInBackground||Kh.isFocused())&&be(this,Le,va).call(this)},P(this,ns)))},pp=function(){be(this,Le,up).call(this),be(this,Le,fp).call(this,be(this,Le,dp).call(this))},hp=function(){P(this,Ks)&&(clearTimeout(P(this,Ks)),K(this,Ks,void 0))},mp=function(){P(this,Gs)&&(clearInterval(P(this,Gs)),K(this,Gs,void 0))},gp=function(){const t=P(this,Wt).getQueryCache().build(P(this,Wt),this.options);if(t===P(this,ke))return;const n=P(this,ke);K(this,ke,t),K(this,xl,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},TS=function(t){gt.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(P(this,Ft))}),P(this,Wt).getQueryCache().notify({query:P(this,ke),type:"observerResultsUpdated"})})},vy);function S2(e,t){return Rn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function iv(e,t){return S2(e,t)||e.state.data!==void 0&&vp(e,t,t.refetchOnMount)}function vp(e,t,n){if(Rn(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Gh(e,t)}return!1}function ov(e,t,n,r){return(e!==t||Rn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Gh(e,n)}function Gh(e,t){return Rn(t.enabled,e)!==!1&&e.isStaleByTime(eo(t.staleTime,e))}function N2(e,t){return!su(e.getCurrentResult(),t)}var rs,ss,Ht,xr,jr,Nc,yp,yy,_2=(yy=class extends Qo{constructor(n,r){super();le(this,jr);le(this,rs);le(this,ss);le(this,Ht);le(this,xr);K(this,rs,n),this.setOptions(r),this.bindMethods(),be(this,jr,Nc).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=P(this,rs).defaultMutationOptions(n),su(this.options,r)||P(this,rs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:P(this,Ht),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&oi(r.mutationKey)!==oi(this.options.mutationKey)?this.reset():((s=P(this,Ht))==null?void 0:s.state.status)==="pending"&&P(this,Ht).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=P(this,Ht))==null||n.removeObserver(this)}onMutationUpdate(n){be(this,jr,Nc).call(this),be(this,jr,yp).call(this,n)}getCurrentResult(){return P(this,ss)}reset(){var n;(n=P(this,Ht))==null||n.removeObserver(this),K(this,Ht,void 0),be(this,jr,Nc).call(this),be(this,jr,yp).call(this)}mutate(n,r){var s;return K(this,xr,r),(s=P(this,Ht))==null||s.removeObserver(this),K(this,Ht,P(this,rs).getMutationCache().build(P(this,rs),this.options)),P(this,Ht).addObserver(this),P(this,Ht).execute(n)}},rs=new WeakMap,ss=new WeakMap,Ht=new WeakMap,xr=new WeakMap,jr=new WeakSet,Nc=function(){var r;const n=((r=P(this,Ht))==null?void 0:r.state)??ES();K(this,ss,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},yp=function(n){gt.batch(()=>{var r,s,i,o,l,c,u,d;if(P(this,xr)&&this.hasListeners()){const f=P(this,ss).variables,p=P(this,ss).context;(n==null?void 0:n.type)==="success"?((s=(r=P(this,xr)).onSuccess)==null||s.call(r,n.data,f,p),(o=(i=P(this,xr)).onSettled)==null||o.call(i,n.data,null,f,p)):(n==null?void 0:n.type)==="error"&&((c=(l=P(this,xr)).onError)==null||c.call(l,n.error,f,p),(d=(u=P(this,xr)).onSettled)==null||d.call(u,void 0,n.error,f,p))}this.listeners.forEach(f=>{f(P(this,ss))})})},yy),kS=h.createContext(void 0),qo=e=>{const t=h.useContext(kS);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},j2=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(kS.Provider,{value:e,children:t})),PS=h.createContext(!1),C2=()=>h.useContext(PS);PS.Provider;function E2(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var T2=h.createContext(E2()),k2=()=>h.useContext(T2);function AS(e,t){return typeof e=="function"?e(...t):!!e}function xp(){}var P2=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},A2=e=>{h.useEffect(()=>{e.clearReset()},[e])},R2=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&AS(n,[e.error,r]),I2=e=>{e.suspense&&(e.staleTime===void 0&&(e.staleTime=1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},D2=(e,t)=>e.isLoading&&e.isFetching&&!t,O2=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,av=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function M2(e,t,n){var d,f,p,y,b;const r=qo(),s=C2(),i=k2(),o=r.defaultQueryOptions(e);(f=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||f.call(d,o),o._optimisticResults=s?"isRestoring":"optimistic",I2(o),P2(o,i),A2(i);const l=!r.getQueryCache().get(o.queryHash),[c]=h.useState(()=>new t(r,o)),u=c.getOptimisticResult(o);if(h.useSyncExternalStore(h.useCallback(g=>{const w=s?xp:c.subscribe(gt.batchCalls(g));return c.updateResult(),w},[c,s]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),h.useEffect(()=>{c.setOptions(o,{listeners:!1})},[o,c]),O2(o,u))throw av(o,c,i);if(R2({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:r.getQueryCache().get(o.queryHash)}))throw u.error;if((y=(p=r.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||y.call(p,o,u),o.experimental_prefetchInRender&&!ii&&D2(u,s)){const g=l?av(o,c,i):(b=r.getQueryCache().get(o.queryHash))==null?void 0:b.promise;g==null||g.catch(xp).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function Zr(e,t){return M2(e,b2)}function Qt(e,t){const n=qo(),[r]=h.useState(()=>new _2(n,e));h.useEffect(()=>{r.setOptions(e)},[r,e]);const s=h.useSyncExternalStore(h.useCallback(o=>r.subscribe(gt.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=h.useCallback((o,l)=>{r.mutate(o,l).catch(xp)},[r]);if(s.error&&AS(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}async function RS(e){if(!e.ok){const t=await e.text()||e.statusText;throw new Error(`${e.status}: ${t}`)}}async function nt(e,t={}){const{method:n="GET",headers:r={},body:s}=t,i=await fetch(e,{method:n,headers:{"Content-Type":"application/json",...r},body:s,credentials:"include"});return await RS(i),i}const F2=({on401:e})=>async({queryKey:t})=>{const n=await fetch(t.join("/"),{credentials:"include"});return e==="returnNull"&&n.status===401?null:(await RS(n),await n.json())},L2=new w2({defaultOptions:{queries:{queryFn:F2({on401:"returnNull"}),refetchInterval:!1,refetchOnWindowFocus:!1,staleTime:1/0,retry:!1},mutations:{retry:!1}}}),V2=1,z2=1e6;let Ld=0;function $2(){return Ld=(Ld+1)%Number.MAX_SAFE_INTEGER,Ld.toString()}const Vd=new Map,lv=e=>{if(Vd.has(e))return;const t=setTimeout(()=>{Vd.delete(e),Oa({type:"REMOVE_TOAST",toastId:e})},z2);Vd.set(e,t)},U2=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,V2)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?lv(n):e.toasts.forEach(r=>{lv(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},_c=[];let jc={toasts:[]};function Oa(e){jc=U2(jc,e),_c.forEach(t=>{t(jc)})}function B2({...e}){const t=$2(),n=s=>Oa({type:"UPDATE_TOAST",toast:{...s,id:t}}),r=()=>Oa({type:"DISMISS_TOAST",toastId:t});return Oa({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||r()}}}),{id:t,dismiss:r,update:n}}function Zo(){const[e,t]=h.useState(jc);return h.useEffect(()=>(_c.push(t),()=>{const n=_c.indexOf(t);n>-1&&_c.splice(n,1)}),[e]),{...e,toast:B2,dismiss:n=>Oa({type:"DISMISS_TOAST",toastId:n})}}function ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function cv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function IS(...e){return t=>{let n=!1;const r=e.map(s=>{const i=cv(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s{const{children:o,...l}=i,c=h.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function s(i){const o=h.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,s]}function Dr(e,t=[]){let n=[];function r(i,o){const l=h.createContext(o),c=n.length;n=[...n,o];const u=f=>{var v;const{scope:p,children:y,...b}=f,g=((v=p==null?void 0:p[e])==null?void 0:v[c])||l,w=h.useMemo(()=>b,Object.values(b));return a.jsx(g.Provider,{value:w,children:y})};u.displayName=i+"Provider";function d(f,p){var g;const y=((g=p==null?void 0:p[e])==null?void 0:g[c])||l,b=h.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{const i=n.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,H2(s,...t)]}function H2(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function Io(e){const t=Q2(e),n=h.forwardRef((r,s)=>{const{children:i,...o}=r,l=h.Children.toArray(i),c=l.find(q2);if(c){const u=c.props.children,d=l.map(f=>f===c?h.Children.count(u)>1?h.Children.only(null):h.isValidElement(u)?u.props.children:null:f);return a.jsx(t,{...o,ref:s,children:h.isValidElement(u)?h.cloneElement(u,void 0,d):null})}return a.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}var DS=Io("Slot");function Q2(e){const t=h.forwardRef((n,r)=>{const{children:s,...i}=n;if(h.isValidElement(s)){const o=K2(s),l=Z2(i,s.props);return s.type!==h.Fragment&&(l.ref=r?IS(r,o):o),h.cloneElement(s,l)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var OS=Symbol("radix.slottable");function MS(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=OS,t}function q2(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===OS}function Z2(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{i(...l),s(...l)}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function K2(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Xh(e){const t=e+"CollectionProvider",[n,r]=Dr(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:w,children:v}=g,m=re.useRef(null),x=re.useRef(new Map).current;return a.jsx(s,{scope:w,itemMap:x,collectionRef:m,children:v})};o.displayName=t;const l=e+"CollectionSlot",c=Io(l),u=re.forwardRef((g,w)=>{const{scope:v,children:m}=g,x=i(l,v),j=ze(w,x.collectionRef);return a.jsx(c,{ref:j,children:m})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",p=Io(d),y=re.forwardRef((g,w)=>{const{scope:v,children:m,...x}=g,j=re.useRef(null),T=ze(w,j),S=i(d,v);return re.useEffect(()=>(S.itemMap.set(j,{ref:j,...x}),()=>void S.itemMap.delete(j))),a.jsx(p,{[f]:"",ref:T,children:m})});y.displayName=d;function b(g){const w=i(e+"CollectionConsumer",g);return re.useCallback(()=>{const m=w.collectionRef.current;if(!m)return[];const x=Array.from(m.querySelectorAll(`[${f}]`));return Array.from(w.itemMap.values()).sort((S,N)=>x.indexOf(S.ref.current)-x.indexOf(N.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:u,ItemSlot:y},b,r]}var G2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_e=G2.reduce((e,t)=>{const n=Io(`Primitive.${t}`),r=h.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function FS(e,t){e&&mi.flushSync(()=>e.dispatchEvent(t))}function en(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function X2(e,t=globalThis==null?void 0:globalThis.document){const n=en(e);h.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Y2="DismissableLayer",wp="dismissableLayer.update",J2="dismissableLayer.pointerDownOutside",eA="dismissableLayer.focusOutside",uv,LS=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cl=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,u=h.useContext(LS),[d,f]=h.useState(null),p=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=h.useState({}),b=ze(t,N=>f(N)),g=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(w),m=d?g.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,j=m>=v,T=nA(N=>{const _=N.target,E=[...u.branches].some(I=>I.contains(_));!j||E||(s==null||s(N),o==null||o(N),N.defaultPrevented||l==null||l())},p),S=rA(N=>{const _=N.target;[...u.branches].some(I=>I.contains(_))||(i==null||i(N),o==null||o(N),N.defaultPrevented||l==null||l())},p);return X2(N=>{m===u.layers.size-1&&(r==null||r(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},p),h.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(uv=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),dv(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=uv)}},[d,p,n,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),dv())},[d,u]),h.useEffect(()=>{const N=()=>y({});return document.addEventListener(wp,N),()=>document.removeEventListener(wp,N)},[]),a.jsx(_e.div,{...c,ref:b,style:{pointerEvents:x?j?"auto":"none":void 0,...e.style},onFocusCapture:ce(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ce(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ce(e.onPointerDownCapture,T.onPointerDownCapture)})});Cl.displayName=Y2;var tA="DismissableLayerBranch",VS=h.forwardRef((e,t)=>{const n=h.useContext(LS),r=h.useRef(null),s=ze(t,r);return h.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(_e.div,{...e,ref:s})});VS.displayName=tA;function nA(e,t=globalThis==null?void 0:globalThis.document){const n=en(e),r=h.useRef(!1),s=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){zS(J2,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function rA(e,t=globalThis==null?void 0:globalThis.document){const n=en(e),r=h.useRef(!1);return h.useEffect(()=>{const s=i=>{i.target&&!r.current&&zS(eA,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function dv(){const e=new CustomEvent(wp);document.dispatchEvent(e)}function zS(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?FS(s,i):s.dispatchEvent(i)}var sA=Cl,iA=VS,It=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},oA="Portal",Wu=h.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,i]=h.useState(!1);It(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?i2.createPortal(a.jsx(_e.div,{...r,ref:t}),o):null});Wu.displayName=oA;function aA(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var gi=e=>{const{present:t,children:n}=e,r=lA(t),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),i=ze(r.ref,cA(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:i}):null};gi.displayName="Presence";function lA(e){const[t,n]=h.useState(),r=h.useRef({}),s=h.useRef(e),i=h.useRef("none"),o=e?"mounted":"unmounted",[l,c]=aA(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=rc(r.current);i.current=l==="mounted"?u:"none"},[l]),It(()=>{const u=r.current,d=s.current;if(d!==e){const p=i.current,y=rc(u);e?c("MOUNT"):y==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&p!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),It(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=y=>{const g=rc(r.current).includes(y.animationName);if(y.target===t&&g&&(c("ANIMATION_END"),!s.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},p=y=>{y.target===t&&(i.current=rc(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function rc(e){return(e==null?void 0:e.animationName)||"none"}function cA(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Do({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,s]=uA({defaultProp:t,onChange:n}),i=e!==void 0,o=i?e:r,l=en(n),c=h.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else s(u)},[i,e,s,l]);return[o,c]}function uA({defaultProp:e,onChange:t}){const n=h.useState(e),[r]=n,s=h.useRef(r),i=en(t);return h.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}var dA="VisuallyHidden",El=h.forwardRef((e,t)=>a.jsx(_e.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));El.displayName=dA;var fA=El,Yh="ToastProvider",[Jh,pA,hA]=Xh("Toast"),[$S,_L]=Dr("Toast",[hA]),[mA,Hu]=$S(Yh),US=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:o}=e,[l,c]=h.useState(null),[u,d]=h.useState(0),f=h.useRef(!1),p=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Yh}\`. Expected non-empty \`string\`.`),a.jsx(Jh.Provider,{scope:t,children:a.jsx(mA,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:h.useCallback(()=>d(y=>y+1),[]),onToastRemove:h.useCallback(()=>d(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:p,children:o})})};US.displayName=Yh;var BS="ToastViewport",gA=["F8"],bp="toast.viewportPause",Sp="toast.viewportResume",WS=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=gA,label:s="Notifications ({hotkey})",...i}=e,o=Hu(BS,n),l=pA(n),c=h.useRef(null),u=h.useRef(null),d=h.useRef(null),f=h.useRef(null),p=ze(t,f,o.onViewportChange),y=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=o.toastCount>0;h.useEffect(()=>{const w=v=>{var x;r.length!==0&&r.every(j=>v[j]||v.code===j)&&((x=f.current)==null||x.focus())};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[r]),h.useEffect(()=>{const w=c.current,v=f.current;if(b&&w&&v){const m=()=>{if(!o.isClosePausedRef.current){const S=new CustomEvent(bp);v.dispatchEvent(S),o.isClosePausedRef.current=!0}},x=()=>{if(o.isClosePausedRef.current){const S=new CustomEvent(Sp);v.dispatchEvent(S),o.isClosePausedRef.current=!1}},j=S=>{!w.contains(S.relatedTarget)&&x()},T=()=>{w.contains(document.activeElement)||x()};return w.addEventListener("focusin",m),w.addEventListener("focusout",j),w.addEventListener("pointermove",m),w.addEventListener("pointerleave",T),window.addEventListener("blur",m),window.addEventListener("focus",x),()=>{w.removeEventListener("focusin",m),w.removeEventListener("focusout",j),w.removeEventListener("pointermove",m),w.removeEventListener("pointerleave",T),window.removeEventListener("blur",m),window.removeEventListener("focus",x)}}},[b,o.isClosePausedRef]);const g=h.useCallback(({tabbingDirection:w})=>{const m=l().map(x=>{const j=x.ref.current,T=[j,...kA(j)];return w==="forwards"?T:T.reverse()});return(w==="forwards"?m.reverse():m).flat()},[l]);return h.useEffect(()=>{const w=f.current;if(w){const v=m=>{var T,S,N;const x=m.altKey||m.ctrlKey||m.metaKey;if(m.key==="Tab"&&!x){const _=document.activeElement,E=m.shiftKey;if(m.target===w&&E){(T=u.current)==null||T.focus();return}const M=g({tabbingDirection:E?"backwards":"forwards"}),z=M.findIndex(F=>F===_);zd(M.slice(z+1))?m.preventDefault():E?(S=u.current)==null||S.focus():(N=d.current)==null||N.focus()}};return w.addEventListener("keydown",v),()=>w.removeEventListener("keydown",v)}},[l,g]),a.jsxs(iA,{ref:c,role:"region","aria-label":s.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&a.jsx(Np,{ref:u,onFocusFromOutsideViewport:()=>{const w=g({tabbingDirection:"forwards"});zd(w)}}),a.jsx(Jh.Slot,{scope:n,children:a.jsx(_e.ol,{tabIndex:-1,...i,ref:p})}),b&&a.jsx(Np,{ref:d,onFocusFromOutsideViewport:()=>{const w=g({tabbingDirection:"backwards"});zd(w)}})]})});WS.displayName=BS;var HS="ToastFocusProxy",Np=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=Hu(HS,n);return a.jsx(El,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var u;const l=o.relatedTarget;!((u=i.viewport)!=null&&u.contains(l))&&r()}})});Np.displayName=HS;var Qu="Toast",vA="toast.swipeStart",yA="toast.swipeMove",xA="toast.swipeCancel",wA="toast.swipeEnd",QS=h.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=e,[l=!0,c]=Do({prop:r,defaultProp:s,onChange:i});return a.jsx(gi,{present:n||l,children:a.jsx(NA,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:en(e.onPause),onResume:en(e.onResume),onSwipeStart:ce(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ce(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ce(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ce(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});QS.displayName=Qu;var[bA,SA]=$S(Qu,{onClose(){}}),NA=h.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:p,onSwipeEnd:y,...b}=e,g=Hu(Qu,n),[w,v]=h.useState(null),m=ze(t,F=>v(F)),x=h.useRef(null),j=h.useRef(null),T=s||g.duration,S=h.useRef(0),N=h.useRef(T),_=h.useRef(0),{onToastAdd:E,onToastRemove:I}=g,H=en(()=>{var ee;(w==null?void 0:w.contains(document.activeElement))&&((ee=g.viewport)==null||ee.focus()),o()}),M=h.useCallback(F=>{!F||F===1/0||(window.clearTimeout(_.current),S.current=new Date().getTime(),_.current=window.setTimeout(H,F))},[H]);h.useEffect(()=>{const F=g.viewport;if(F){const ee=()=>{M(N.current),u==null||u()},q=()=>{const oe=new Date().getTime()-S.current;N.current=N.current-oe,window.clearTimeout(_.current),c==null||c()};return F.addEventListener(bp,q),F.addEventListener(Sp,ee),()=>{F.removeEventListener(bp,q),F.removeEventListener(Sp,ee)}}},[g.viewport,T,c,u,M]),h.useEffect(()=>{i&&!g.isClosePausedRef.current&&M(T)},[i,T,g.isClosePausedRef,M]),h.useEffect(()=>(E(),()=>I()),[E,I]);const z=h.useMemo(()=>w?JS(w):null,[w]);return g.viewport?a.jsxs(a.Fragment,{children:[z&&a.jsx(_A,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:z}),a.jsx(bA,{scope:n,onClose:H,children:mi.createPortal(a.jsx(Jh.ItemSlot,{scope:n,children:a.jsx(sA,{asChild:!0,onEscapeKeyDown:ce(l,()=>{g.isFocusedToastEscapeKeyDownRef.current||H(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(_e.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":g.swipeDirection,...b,ref:m,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ce(e.onKeyDown,F=>{F.key==="Escape"&&(l==null||l(F.nativeEvent),F.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,H()))}),onPointerDown:ce(e.onPointerDown,F=>{F.button===0&&(x.current={x:F.clientX,y:F.clientY})}),onPointerMove:ce(e.onPointerMove,F=>{if(!x.current)return;const ee=F.clientX-x.current.x,q=F.clientY-x.current.y,oe=!!j.current,D=["left","right"].includes(g.swipeDirection),U=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,Y=D?U(0,ee):0,ae=D?0:U(0,q),Re=F.pointerType==="touch"?10:2,ct={x:Y,y:ae},Ue={originalEvent:F,delta:ct};oe?(j.current=ct,sc(yA,f,Ue,{discrete:!1})):fv(ct,g.swipeDirection,Re)?(j.current=ct,sc(vA,d,Ue,{discrete:!1}),F.target.setPointerCapture(F.pointerId)):(Math.abs(ee)>Re||Math.abs(q)>Re)&&(x.current=null)}),onPointerUp:ce(e.onPointerUp,F=>{const ee=j.current,q=F.target;if(q.hasPointerCapture(F.pointerId)&&q.releasePointerCapture(F.pointerId),j.current=null,x.current=null,ee){const oe=F.currentTarget,D={originalEvent:F,delta:ee};fv(ee,g.swipeDirection,g.swipeThreshold)?sc(wA,y,D,{discrete:!0}):sc(xA,p,D,{discrete:!0}),oe.addEventListener("click",U=>U.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),_A=e=>{const{__scopeToast:t,children:n,...r}=e,s=Hu(Qu,t),[i,o]=h.useState(!1),[l,c]=h.useState(!1);return EA(()=>o(!0)),h.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:a.jsx(Wu,{asChild:!0,children:a.jsx(El,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},jA="ToastTitle",qS=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(_e.div,{...r,ref:t})});qS.displayName=jA;var CA="ToastDescription",ZS=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(_e.div,{...r,ref:t})});ZS.displayName=CA;var KS="ToastAction",GS=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?a.jsx(YS,{altText:n,asChild:!0,children:a.jsx(em,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${KS}\`. Expected non-empty \`string\`.`),null)});GS.displayName=KS;var XS="ToastClose",em=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=SA(XS,n);return a.jsx(YS,{asChild:!0,children:a.jsx(_e.button,{type:"button",...r,ref:t,onClick:ce(e.onClick,s.onClose)})})});em.displayName=XS;var YS=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return a.jsx(_e.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function JS(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),TA(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...JS(r))}}),t}function sc(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?FS(s,i):s.dispatchEvent(i)}var fv=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),i=r>s;return t==="left"||t==="right"?i&&r>n:!i&&s>n};function EA(e=()=>{}){const t=en(e);It(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function TA(e){return e.nodeType===e.ELEMENT_NODE}function kA(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function zd(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var PA=US,eN=WS,tN=QS,nN=qS,rN=ZS,sN=GS,iN=em;function oN(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,hv=aN,Tl=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return hv(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const d=n==null?void 0:n[u],f=i==null?void 0:i[u];if(d===null)return null;const p=pv(d)||pv(f);return s[u][p]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,p]=d;return p===void 0||(u[f]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:p,...y}=d;return Object.entries(y).every(b=>{let[g,w]=b;return Array.isArray(w)?w.includes({...i,...l}[g]):{...i,...l}[g]===w})?[...u,f,p]:u},[]);return hv(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lN=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var RA={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"};/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IA=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>h.createElement("svg",{ref:c,...RA,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:lN("lucide",s),...l},[...o.map(([u,d])=>h.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fe=(e,t)=>{const n=h.forwardRef(({className:r,...s},i)=>h.createElement(IA,{ref:i,iconNode:t,className:lN(`lucide-${AA(e)}`,r),...s}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DA=Fe("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _p=Fe("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mv=Fe("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"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cc=Fe("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OA=Fe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cN=Fe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MA=Fe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $d=Fe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FA=Fe("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const to=Fe("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"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LA=Fe("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"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VA=Fe("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"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zA=Fe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uN=Fe("History",[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $A=Fe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UA=Fe("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BA=Fe("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WA=Fe("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jp=Fe("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cp=Fe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HA=Fe("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"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QA=Fe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ep=Fe("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"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qA=Fe("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"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZA=Fe("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"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gv=Fe("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const no=Fe("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"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vv=Fe("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"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KA=Fe("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tm=Fe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oo=Fe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),nm="-",GA=e=>{const t=YA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(nm);return l[0]===""&&l.length!==1&&l.shift(),dN(l,t)||XA(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},dN=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?dN(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(nm);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},yv=/^\[(.+)\]$/,XA=e=>{if(yv.test(e)){const t=yv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},YA=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return eR(Object.entries(e.classGroups),n).forEach(([i,o])=>{Tp(o,r,i,t)}),r},Tp=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:xv(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(JA(s)){Tp(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{Tp(o,xv(t,i),n,r)})})},xv=(e,t)=>{let n=e;return t.split(nm).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},JA=e=>e.isThemeGetter,eR=(e,t)=>t?e.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[n,s]}):e,tR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},fN="!",nR=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],i=t.length,o=l=>{const c=[];let u=0,d=0,f;for(let w=0;wd?f-d:void 0;return{modifiers:c,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:g}};return n?l=>n({className:l,parseClassName:o}):o},rR=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},sR=e=>({cache:tR(e.cacheSize),parseClassName:nR(e),...GA(e)}),iR=/\s+/,oR=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(iR);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:y}=n(u);let b=!!y,g=r(b?p.substring(0,y):p);if(!g){if(!b){l=u+(l.length>0?" "+l:l);continue}if(g=r(p),!g){l=u+(l.length>0?" "+l:l);continue}b=!1}const w=rR(d).join(":"),v=f?w+fN:w,m=v+g;if(i.includes(m))continue;i.push(m);const x=s(g,b);for(let j=0;j0?" "+l:l)}return l};function aR(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rf(d),e());return n=sR(u),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=oR(c,n);return s(c,d),d}return function(){return i(aR.apply(null,arguments))}}const Be=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},hN=/^\[(?:([a-z-]+):)?(.+)\]$/i,cR=/^\d+\/\d+$/,uR=new Set(["px","full","screen"]),dR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fR=/\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$/,pR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,hR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fr=e=>ro(e)||uR.has(e)||cR.test(e),Vr=e=>Ko(e,"length",NR),ro=e=>!!e&&!Number.isNaN(Number(e)),Ud=e=>Ko(e,"number",ro),ca=e=>!!e&&Number.isInteger(Number(e)),gR=e=>e.endsWith("%")&&ro(e.slice(0,-1)),ge=e=>hN.test(e),zr=e=>dR.test(e),vR=new Set(["length","size","percentage"]),yR=e=>Ko(e,vR,mN),xR=e=>Ko(e,"position",mN),wR=new Set(["image","url"]),bR=e=>Ko(e,wR,jR),SR=e=>Ko(e,"",_R),ua=()=>!0,Ko=(e,t,n)=>{const r=hN.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},NR=e=>fR.test(e)&&!pR.test(e),mN=()=>!1,_R=e=>hR.test(e),jR=e=>mR.test(e),CR=()=>{const e=Be("colors"),t=Be("spacing"),n=Be("blur"),r=Be("brightness"),s=Be("borderColor"),i=Be("borderRadius"),o=Be("borderSpacing"),l=Be("borderWidth"),c=Be("contrast"),u=Be("grayscale"),d=Be("hueRotate"),f=Be("invert"),p=Be("gap"),y=Be("gradientColorStops"),b=Be("gradientColorStopPositions"),g=Be("inset"),w=Be("margin"),v=Be("opacity"),m=Be("padding"),x=Be("saturate"),j=Be("scale"),T=Be("sepia"),S=Be("skew"),N=Be("space"),_=Be("translate"),E=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto",ge,t],M=()=>[ge,t],z=()=>["",fr,Vr],F=()=>["auto",ro,ge],ee=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],D=()=>["start","end","center","between","around","evenly","stretch"],U=()=>["","0",ge],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ae=()=>[ro,ge];return{cacheSize:500,separator:":",theme:{colors:[ua],spacing:[fr,Vr],blur:["none","",zr,ge],brightness:ae(),borderColor:[e],borderRadius:["none","","full",zr,ge],borderSpacing:M(),borderWidth:z(),contrast:ae(),grayscale:U(),hueRotate:ae(),invert:U(),gap:M(),gradientColorStops:[e],gradientColorStopPositions:[gR,Vr],inset:H(),margin:H(),opacity:ae(),padding:M(),saturate:ae(),scale:ae(),sepia:U(),skew:ae(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",ge]}],container:["container"],columns:[{columns:[zr]}],"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:[...ee(),ge]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ca,ge]}],basis:[{basis:H()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ge]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",ca,ge]}],"grid-cols":[{"grid-cols":[ua]}],"col-start-end":[{col:["auto",{span:["full",ca,ge]},ge]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[ua]}],"row-start-end":[{row:["auto",{span:[ca,ge]},ge]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ge]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ge]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...D()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...D(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...D(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[m]}],px:[{px:[m]}],py:[{py:[m]}],ps:[{ps:[m]}],pe:[{pe:[m]}],pt:[{pt:[m]}],pr:[{pr:[m]}],pb:[{pb:[m]}],pl:[{pl:[m]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ge,t]}],"min-w":[{"min-w":[ge,t,"min","max","fit"]}],"max-w":[{"max-w":[ge,t,"none","full","min","max","fit","prose",{screen:[zr]},zr]}],h:[{h:[ge,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ge,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ge,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ge,t,"auto","min","max","fit"]}],"font-size":[{text:["base",zr,Vr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ud]}],"font-family":[{font:[ua]}],"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",ge]}],"line-clamp":[{"line-clamp":["none",ro,Ud]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fr,ge]}],"list-image":[{"list-image":["none",ge]}],"list-style-type":[{list:["none","disc","decimal",ge]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fr,Vr]}],"underline-offset":[{"underline-offset":["auto",fr,ge]}],"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:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge]}],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",ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ee(),xR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",yR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},bR]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:q()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[fr,ge]}],"outline-w":[{outline:[fr,Vr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[fr,Vr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",zr,SR]}],"shadow-color":[{shadow:[ua]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...oe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":oe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",zr,ge]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ge]}],duration:[{duration:ae()}],ease:[{ease:["linear","in","out","in-out",ge]}],delay:[{delay:ae()}],animate:[{animate:["none","spin","ping","pulse","bounce",ge]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[ca,ge]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ge]}],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",ge]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"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",ge]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[fr,Vr,Ud]}],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"]}}},ER=lR(CR);function ie(...e){return ER(aN(e))}const TR=PA,gN=h.forwardRef(({className:e,...t},n)=>a.jsx(eN,{ref:n,className:ie("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}));gN.displayName=eN.displayName;const kR=Tl("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-red-500 bg-red-500 text-white",success:"success group border-green-500 bg-green-500 text-white"}},defaultVariants:{variant:"default"}}),vN=h.forwardRef(({className:e,variant:t,...n},r)=>a.jsx(tN,{ref:r,className:ie(kR({variant:t}),e),...n}));vN.displayName=tN.displayName;const PR=h.forwardRef(({className:e,...t},n)=>a.jsx(sN,{ref:n,className:ie("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 group-[.success]:border-muted/40 group-[.success]:hover:border-success/30 group-[.success]:hover:bg-success group-[.success]:hover:text-success-foreground group-[.success]:focus:ring-success",e),...t}));PR.displayName=sN.displayName;const yN=h.forwardRef(({className:e,...t},n)=>a.jsx(iN,{ref:n,className:ie("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 group-[.success]:text-green-300 group-[.success]:hover:text-green-50 group-[.success]:focus:ring-green-400 group-[.success]:focus:ring-offset-green-600",e),"toast-close":"",...t,children:a.jsx(Oo,{className:"h-4 w-4"})}));yN.displayName=iN.displayName;const xN=h.forwardRef(({className:e,...t},n)=>a.jsx(nN,{ref:n,className:ie("text-sm font-semibold",e),...t}));xN.displayName=nN.displayName;const wN=h.forwardRef(({className:e,...t},n)=>a.jsx(rN,{ref:n,className:ie("text-sm opacity-90",e),...t}));wN.displayName=rN.displayName;function AR(){const{toasts:e}=Zo();return a.jsxs(TR,{children:[e.map(function({id:t,title:n,description:r,action:s,...i}){return a.jsxs(vN,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(xN,{children:n}),r&&a.jsx(wN,{children:r})]}),s,a.jsx(yN,{})]},t)}),a.jsx(gN,{})]})}var RR=ZT[" useId ".trim().toString()]||(()=>{}),IR=0;function vs(e){const[t,n]=h.useState(RR());return It(()=>{n(r=>r??String(IR++))},[e]),t?`radix-${t}`:""}const DR=["top","right","bottom","left"],ws=Math.min,an=Math.max,ou=Math.round,ic=Math.floor,or=e=>({x:e,y:e}),OR={left:"right",right:"left",bottom:"top",top:"bottom"},MR={start:"end",end:"start"};function kp(e,t,n){return an(e,ws(t,n))}function Pr(e,t){return typeof e=="function"?e(t):e}function Ar(e){return e.split("-")[0]}function Go(e){return e.split("-")[1]}function rm(e){return e==="x"?"y":"x"}function sm(e){return e==="y"?"height":"width"}function bs(e){return["top","bottom"].includes(Ar(e))?"y":"x"}function im(e){return rm(bs(e))}function FR(e,t,n){n===void 0&&(n=!1);const r=Go(e),s=im(e),i=sm(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=au(o)),[o,au(o)]}function LR(e){const t=au(e);return[Pp(e),t,Pp(t)]}function Pp(e){return e.replace(/start|end/g,t=>MR[t])}function VR(e,t,n){const r=["left","right"],s=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?s:r:t?r:s;case"left":case"right":return t?i:o;default:return[]}}function zR(e,t,n,r){const s=Go(e);let i=VR(Ar(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(Pp)))),i}function au(e){return e.replace(/left|right|bottom|top/g,t=>OR[t])}function $R(e){return{top:0,right:0,bottom:0,left:0,...e}}function bN(e){return typeof e!="number"?$R(e):{top:e,right:e,bottom:e,left:e}}function lu(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function wv(e,t,n){let{reference:r,floating:s}=e;const i=bs(t),o=im(t),l=sm(o),c=Ar(t),u=i==="y",d=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,p=r[l]/2-s[l]/2;let y;switch(c){case"top":y={x:d,y:r.y-s.height};break;case"bottom":y={x:d,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:f};break;case"left":y={x:r.x-s.width,y:f};break;default:y={x:r.x,y:r.y}}switch(Go(t)){case"start":y[o]-=p*(n&&u?-1:1);break;case"end":y[o]+=p*(n&&u?-1:1);break}return y}const UR=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:f}=wv(u,r,c),p=r,y={},b=0;for(let g=0;g({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Pr(e,t)||{};if(u==null)return{};const f=bN(d),p={x:n,y:r},y=im(s),b=sm(y),g=await o.getDimensions(u),w=y==="y",v=w?"top":"left",m=w?"bottom":"right",x=w?"clientHeight":"clientWidth",j=i.reference[b]+i.reference[y]-p[y]-i.floating[b],T=p[y]-i.reference[y],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let N=S?S[x]:0;(!N||!await(o.isElement==null?void 0:o.isElement(S)))&&(N=l.floating[x]||i.floating[b]);const _=j/2-T/2,E=N/2-g[b]/2-1,I=ws(f[v],E),H=ws(f[m],E),M=I,z=N-g[b]-H,F=N/2-g[b]/2+_,ee=kp(M,F,z),q=!c.arrow&&Go(s)!=null&&F!==ee&&i.reference[b]/2-(FF<=0)){var H,M;const F=(((H=i.flip)==null?void 0:H.index)||0)+1,ee=N[F];if(ee)return{data:{index:F,overflows:I},reset:{placement:ee}};let q=(M=I.filter(oe=>oe.overflows[0]<=0).sort((oe,D)=>oe.overflows[1]-D.overflows[1])[0])==null?void 0:M.placement;if(!q)switch(y){case"bestFit":{var z;const oe=(z=I.filter(D=>{if(S){const U=bs(D.placement);return U===m||U==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(U=>U>0).reduce((U,Y)=>U+Y,0)]).sort((D,U)=>D[1]-U[1])[0])==null?void 0:z[0];oe&&(q=oe);break}case"initialPlacement":q=l;break}if(s!==q)return{reset:{placement:q}}}return{}}}};function bv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Sv(e){return DR.some(t=>e[t]>=0)}const HR=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=Pr(e,t);switch(r){case"referenceHidden":{const i=await nl(t,{...s,elementContext:"reference"}),o=bv(i,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Sv(o)}}}case"escaped":{const i=await nl(t,{...s,altBoundary:!0}),o=bv(i,n.floating);return{data:{escapedOffsets:o,escaped:Sv(o)}}}default:return{}}}}};async function QR(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Ar(n),l=Go(n),c=bs(n)==="y",u=["left","top"].includes(o)?-1:1,d=i&&c?-1:1,f=Pr(t,e);let{mainAxis:p,crossAxis:y,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof b=="number"&&(y=l==="end"?b*-1:b),c?{x:y*d,y:p*u}:{x:p*u,y:y*d}}const qR=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=t,c=await QR(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},ZR=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:w=>{let{x:v,y:m}=w;return{x:v,y:m}}},...c}=Pr(e,t),u={x:n,y:r},d=await nl(t,c),f=bs(Ar(s)),p=rm(f);let y=u[p],b=u[f];if(i){const w=p==="y"?"top":"left",v=p==="y"?"bottom":"right",m=y+d[w],x=y-d[v];y=kp(m,y,x)}if(o){const w=f==="y"?"top":"left",v=f==="y"?"bottom":"right",m=b+d[w],x=b-d[v];b=kp(m,b,x)}const g=l.fn({...t,[p]:y,[f]:b});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:i,[f]:o}}}}}},KR=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Pr(e,t),d={x:n,y:r},f=bs(s),p=rm(f);let y=d[p],b=d[f];const g=Pr(l,t),w=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const x=p==="y"?"height":"width",j=i.reference[p]-i.floating[x]+w.mainAxis,T=i.reference[p]+i.reference[x]-w.mainAxis;yT&&(y=T)}if(u){var v,m;const x=p==="y"?"width":"height",j=["top","left"].includes(Ar(s)),T=i.reference[f]-i.floating[x]+(j&&((v=o.offset)==null?void 0:v[f])||0)+(j?0:w.crossAxis),S=i.reference[f]+i.reference[x]+(j?0:((m=o.offset)==null?void 0:m[f])||0)-(j?w.crossAxis:0);bS&&(b=S)}return{[p]:y,[f]:b}}}},GR=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:l}=t,{apply:c=()=>{},...u}=Pr(e,t),d=await nl(t,u),f=Ar(s),p=Go(s),y=bs(s)==="y",{width:b,height:g}=i.floating;let w,v;f==="top"||f==="bottom"?(w=f,v=p===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(v=f,w=p==="end"?"top":"bottom");const m=g-d.top-d.bottom,x=b-d.left-d.right,j=ws(g-d[w],m),T=ws(b-d[v],x),S=!t.middlewareData.shift;let N=j,_=T;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(_=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=m),S&&!p){const I=an(d.left,0),H=an(d.right,0),M=an(d.top,0),z=an(d.bottom,0);y?_=b-2*(I!==0||H!==0?I+H:an(d.left,d.right)):N=g-2*(M!==0||z!==0?M+z:an(d.top,d.bottom))}await c({...t,availableWidth:_,availableHeight:N});const E=await o.getDimensions(l.floating);return b!==E.width||g!==E.height?{reset:{rects:!0}}:{}}}};function qu(){return typeof window<"u"}function Xo(e){return SN(e)?(e.nodeName||"").toLowerCase():"#document"}function dn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dr(e){var t;return(t=(SN(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function SN(e){return qu()?e instanceof Node||e instanceof dn(e).Node:!1}function Vn(e){return qu()?e instanceof Element||e instanceof dn(e).Element:!1}function lr(e){return qu()?e instanceof HTMLElement||e instanceof dn(e).HTMLElement:!1}function Nv(e){return!qu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof dn(e).ShadowRoot}function kl(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=zn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(s)}function XR(e){return["table","td","th"].includes(Xo(e))}function Zu(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function om(e){const t=am(),n=Vn(e)?zn(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function YR(e){let t=Ss(e);for(;lr(t)&&!Mo(t);){if(om(t))return t;if(Zu(t))return null;t=Ss(t)}return null}function am(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Mo(e){return["html","body","#document"].includes(Xo(e))}function zn(e){return dn(e).getComputedStyle(e)}function Ku(e){return Vn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ss(e){if(Xo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Nv(e)&&e.host||dr(e);return Nv(t)?t.host:t}function NN(e){const t=Ss(e);return Mo(t)?e.ownerDocument?e.ownerDocument.body:e.body:lr(t)&&kl(t)?t:NN(t)}function rl(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=NN(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=dn(s);if(i){const l=Ap(o);return t.concat(o,o.visualViewport||[],kl(s)?s:[],l&&n?rl(l):[])}return t.concat(s,rl(s,[],n))}function Ap(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _N(e){const t=zn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=lr(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,l=ou(n)!==i||ou(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function lm(e){return Vn(e)?e:e.contextElement}function so(e){const t=lm(e);if(!lr(t))return or(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=_N(t);let o=(i?ou(n.width):n.width)/r,l=(i?ou(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const JR=or(0);function jN(e){const t=dn(e);return!am()||!t.visualViewport?JR:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function eI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==dn(e)?!1:t}function ai(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=lm(e);let o=or(1);t&&(r?Vn(r)&&(o=so(r)):o=so(e));const l=eI(i,n,r)?jN(i):or(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,f=s.height/o.y;if(i){const p=dn(i),y=r&&Vn(r)?dn(r):r;let b=p,g=Ap(b);for(;g&&r&&y!==b;){const w=so(g),v=g.getBoundingClientRect(),m=zn(g),x=v.left+(g.clientLeft+parseFloat(m.paddingLeft))*w.x,j=v.top+(g.clientTop+parseFloat(m.paddingTop))*w.y;c*=w.x,u*=w.y,d*=w.x,f*=w.y,c+=x,u+=j,b=dn(g),g=Ap(b)}}return lu({width:d,height:f,x:c,y:u})}function cm(e,t){const n=Ku(e).scrollLeft;return t?t.left+n:ai(dr(e)).left+n}function CN(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-(n?0:cm(e,r)),i=r.top+t.scrollTop;return{x:s,y:i}}function tI(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=dr(r),l=t?Zu(t.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=or(1);const d=or(0),f=lr(r);if((f||!f&&!i)&&((Xo(r)!=="body"||kl(o))&&(c=Ku(r)),lr(r))){const y=ai(r);u=so(r),d.x=y.x+r.clientLeft,d.y=y.y+r.clientTop}const p=o&&!f&&!i?CN(o,c,!0):or(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-c.scrollTop*u.y+d.y+p.y}}function nI(e){return Array.from(e.getClientRects())}function rI(e){const t=dr(e),n=Ku(e),r=e.ownerDocument.body,s=an(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=an(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+cm(e);const l=-n.scrollTop;return zn(r).direction==="rtl"&&(o+=an(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}function sI(e,t){const n=dn(e),r=dr(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const u=am();(!u||u&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:l,y:c}}function iI(e,t){const n=ai(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=lr(e)?so(e):or(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:o,height:l,x:c,y:u}}function _v(e,t,n){let r;if(t==="viewport")r=sI(e,n);else if(t==="document")r=rI(dr(e));else if(Vn(t))r=iI(t,n);else{const s=jN(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return lu(r)}function EN(e,t){const n=Ss(e);return n===t||!Vn(n)||Mo(n)?!1:zn(n).position==="fixed"||EN(n,t)}function oI(e,t){const n=t.get(e);if(n)return n;let r=rl(e,[],!1).filter(l=>Vn(l)&&Xo(l)!=="body"),s=null;const i=zn(e).position==="fixed";let o=i?Ss(e):e;for(;Vn(o)&&!Mo(o);){const l=zn(o),c=om(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||kl(o)&&!c&&EN(e,o))?r=r.filter(d=>d!==o):s=l,o=Ss(o)}return t.set(e,r),r}function aI(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Zu(t)?[]:oI(t,this._c):[].concat(n),r],l=o[0],c=o.reduce((u,d)=>{const f=_v(t,d,s);return u.top=an(f.top,u.top),u.right=ws(f.right,u.right),u.bottom=ws(f.bottom,u.bottom),u.left=an(f.left,u.left),u},_v(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function lI(e){const{width:t,height:n}=_N(e);return{width:t,height:n}}function cI(e,t,n){const r=lr(t),s=dr(t),i=n==="fixed",o=ai(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=or(0);if(r||!r&&!i)if((Xo(t)!=="body"||kl(s))&&(l=Ku(t)),r){const p=ai(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else s&&(c.x=cm(s));const u=s&&!r&&!i?CN(s,l):or(0),d=o.left+l.scrollLeft-c.x-u.x,f=o.top+l.scrollTop-c.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function Bd(e){return zn(e).position==="static"}function jv(e,t){if(!lr(e)||zn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return dr(e)===n&&(n=n.ownerDocument.body),n}function TN(e,t){const n=dn(e);if(Zu(e))return n;if(!lr(e)){let s=Ss(e);for(;s&&!Mo(s);){if(Vn(s)&&!Bd(s))return s;s=Ss(s)}return n}let r=jv(e,t);for(;r&&XR(r)&&Bd(r);)r=jv(r,t);return r&&Mo(r)&&Bd(r)&&!om(r)?n:r||YR(e)||n}const uI=async function(e){const t=this.getOffsetParent||TN,n=this.getDimensions,r=await n(e.floating);return{reference:cI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function dI(e){return zn(e).direction==="rtl"}const fI={convertOffsetParentRelativeRectToViewportRelativeRect:tI,getDocumentElement:dr,getClippingRect:aI,getOffsetParent:TN,getElementRects:uI,getClientRects:nI,getDimensions:lI,getScale:so,isElement:Vn,isRTL:dI};function kN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pI(e,t){let n=null,r;const s=dr(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:d,top:f,width:p,height:y}=u;if(l||t(),!p||!y)return;const b=ic(f),g=ic(s.clientWidth-(d+p)),w=ic(s.clientHeight-(f+y)),v=ic(d),x={rootMargin:-b+"px "+-g+"px "+-w+"px "+-v+"px",threshold:an(0,ws(1,c))||1};let j=!0;function T(S){const N=S[0].intersectionRatio;if(N!==c){if(!j)return o();N?o(!1,N):r=setTimeout(()=>{o(!1,1e-7)},1e3)}N===1&&!kN(u,e.getBoundingClientRect())&&o(),j=!1}try{n=new IntersectionObserver(T,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(T,x)}n.observe(e)}return o(!0),i}function hI(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=lm(e),d=s||i?[...u?rl(u):[],...rl(t)]:[];d.forEach(v=>{s&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const f=u&&l?pI(u,n):null;let p=-1,y=null;o&&(y=new ResizeObserver(v=>{let[m]=v;m&&m.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=y)==null||x.observe(t)})),n()}),u&&!c&&y.observe(u),y.observe(t));let b,g=c?ai(e):null;c&&w();function w(){const v=ai(e);g&&!kN(g,v)&&n(),g=v,b=requestAnimationFrame(w)}return n(),()=>{var v;d.forEach(m=>{s&&m.removeEventListener("scroll",n),i&&m.removeEventListener("resize",n)}),f==null||f(),(v=y)==null||v.disconnect(),y=null,c&&cancelAnimationFrame(b)}}const mI=qR,gI=ZR,vI=WR,yI=GR,xI=HR,Cv=BR,wI=KR,bI=(e,t,n)=>{const r=new Map,s={platform:fI,...n},i={...s.platform,_c:r};return UR(e,t,{...s,platform:i})};var Ec=typeof document<"u"?h.useLayoutEffect:h.useEffect;function cu(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 n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!cu(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!cu(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function PN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ev(e,t){const n=PN(e);return Math.round(t*n)/n}function Wd(e){const t=h.useRef(e);return Ec(()=>{t.current=e}),t}function SI(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,y]=h.useState(r);cu(p,r)||y(r);const[b,g]=h.useState(null),[w,v]=h.useState(null),m=h.useCallback(D=>{D!==S.current&&(S.current=D,g(D))},[]),x=h.useCallback(D=>{D!==N.current&&(N.current=D,v(D))},[]),j=i||b,T=o||w,S=h.useRef(null),N=h.useRef(null),_=h.useRef(d),E=c!=null,I=Wd(c),H=Wd(s),M=Wd(u),z=h.useCallback(()=>{if(!S.current||!N.current)return;const D={placement:t,strategy:n,middleware:p};H.current&&(D.platform=H.current),bI(S.current,N.current,D).then(U=>{const Y={...U,isPositioned:M.current!==!1};F.current&&!cu(_.current,Y)&&(_.current=Y,mi.flushSync(()=>{f(Y)}))})},[p,t,n,H,M]);Ec(()=>{u===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,f(D=>({...D,isPositioned:!1})))},[u]);const F=h.useRef(!1);Ec(()=>(F.current=!0,()=>{F.current=!1}),[]),Ec(()=>{if(j&&(S.current=j),T&&(N.current=T),j&&T){if(I.current)return I.current(j,T,z);z()}},[j,T,z,I,E]);const ee=h.useMemo(()=>({reference:S,floating:N,setReference:m,setFloating:x}),[m,x]),q=h.useMemo(()=>({reference:j,floating:T}),[j,T]),oe=h.useMemo(()=>{const D={position:n,left:0,top:0};if(!q.floating)return D;const U=Ev(q.floating,d.x),Y=Ev(q.floating,d.y);return l?{...D,transform:"translate("+U+"px, "+Y+"px)",...PN(q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:Y}},[n,l,q.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:z,refs:ee,elements:q,floatingStyles:oe}),[d,z,ee,q,oe])}const NI=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Cv({element:r.current,padding:s}).fn(n):{}:r?Cv({element:r,padding:s}).fn(n):{}}}},_I=(e,t)=>({...mI(e),options:[e,t]}),jI=(e,t)=>({...gI(e),options:[e,t]}),CI=(e,t)=>({...wI(e),options:[e,t]}),EI=(e,t)=>({...vI(e),options:[e,t]}),TI=(e,t)=>({...yI(e),options:[e,t]}),kI=(e,t)=>({...xI(e),options:[e,t]}),PI=(e,t)=>({...NI(e),options:[e,t]});var AI="Arrow",AN=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return a.jsx(_e.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});AN.displayName=AI;var RI=AN;function II(e){const[t,n]=h.useState(void 0);return It(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var um="Popper",[RN,Gu]=Dr(um),[DI,IN]=RN(um),DN=e=>{const{__scopePopper:t,children:n}=e,[r,s]=h.useState(null);return a.jsx(DI,{scope:t,anchor:r,onAnchorChange:s,children:n})};DN.displayName=um;var ON="PopperAnchor",MN=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=IN(ON,n),o=h.useRef(null),l=ze(t,o);return h.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:a.jsx(_e.div,{...s,ref:l})});MN.displayName=ON;var dm="PopperContent",[OI,MI]=RN(dm),FN=h.forwardRef((e,t)=>{var C,se,ue,pe,Ee,Ie;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:y="optimized",onPlaced:b,...g}=e,w=IN(dm,n),[v,m]=h.useState(null),x=ze(t,yt=>m(yt)),[j,T]=h.useState(null),S=II(j),N=(S==null?void 0:S.width)??0,_=(S==null?void 0:S.height)??0,E=r+(i!=="center"?"-"+i:""),I=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},H=Array.isArray(u)?u:[u],M=H.length>0,z={padding:I,boundary:H.filter(LI),altBoundary:M},{refs:F,floatingStyles:ee,placement:q,isPositioned:oe,middlewareData:D}=SI({strategy:"fixed",placement:E,whileElementsMounted:(...yt)=>hI(...yt,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[_I({mainAxis:s+_,alignmentAxis:o}),c&&jI({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?CI():void 0,...z}),c&&EI({...z}),TI({...z,apply:({elements:yt,rects:jt,availableWidth:Is,availableHeight:Mr})=>{const{width:Fr,height:ad}=jt.reference,vi=yt.floating.style;vi.setProperty("--radix-popper-available-width",`${Is}px`),vi.setProperty("--radix-popper-available-height",`${Mr}px`),vi.setProperty("--radix-popper-anchor-width",`${Fr}px`),vi.setProperty("--radix-popper-anchor-height",`${ad}px`)}}),j&&PI({element:j,padding:l}),VI({arrowWidth:N,arrowHeight:_}),p&&kI({strategy:"referenceHidden",...z})]}),[U,Y]=zN(q),ae=en(b);It(()=>{oe&&(ae==null||ae())},[oe,ae]);const Re=(C=D.arrow)==null?void 0:C.x,ct=(se=D.arrow)==null?void 0:se.y,Ue=((ue=D.arrow)==null?void 0:ue.centerOffset)!==0,[Ot,ht]=h.useState();return It(()=>{v&&ht(window.getComputedStyle(v).zIndex)},[v]),a.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:oe?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ot,"--radix-popper-transform-origin":[(pe=D.transformOrigin)==null?void 0:pe.x,(Ee=D.transformOrigin)==null?void 0:Ee.y].join(" "),...((Ie=D.hide)==null?void 0:Ie.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(OI,{scope:n,placedSide:U,onArrowChange:T,arrowX:Re,arrowY:ct,shouldHideArrow:Ue,children:a.jsx(_e.div,{"data-side":U,"data-align":Y,...g,ref:x,style:{...g.style,animation:oe?void 0:"none"}})})})});FN.displayName=dm;var LN="PopperArrow",FI={top:"bottom",right:"left",bottom:"top",left:"right"},VN=h.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=MI(LN,r),o=FI[i.placedSide];return a.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:a.jsx(RI,{...s,ref:n,style:{...s.style,display:"block"}})})});VN.displayName=LN;function LI(e){return e!==null}var VI=e=>({name:"transformOrigin",options:e,fn(t){var w,v,m;const{placement:n,rects:r,middlewareData:s}=t,o=((w=s.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=zN(n),f={start:"0%",center:"50%",end:"100%"}[d],p=(((v=s.arrow)==null?void 0:v.x)??0)+l/2,y=(((m=s.arrow)==null?void 0:m.y)??0)+c/2;let b="",g="";return u==="bottom"?(b=o?f:`${p}px`,g=`${-c}px`):u==="top"?(b=o?f:`${p}px`,g=`${r.floating.height+c}px`):u==="right"?(b=`${-c}px`,g=o?f:`${y}px`):u==="left"&&(b=`${r.floating.width+c}px`,g=o?f:`${y}px`),{data:{x:b,y:g}}}});function zN(e){const[t,n="center"]=e.split("-");return[t,n]}var zI=DN,$N=MN,UN=FN,BN=VN,[Xu,jL]=Dr("Tooltip",[Gu]),fm=Gu(),WN="TooltipProvider",$I=700,Tv="tooltip.open",[UI,HN]=Xu(WN),QN=e=>{const{__scopeTooltip:t,delayDuration:n=$I,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,o=h.useRef(!0),l=h.useRef(!1),c=h.useRef(0);return h.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(UI,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:h.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:h.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:i})};QN.displayName=WN;var qN="Tooltip",[CL,Yu]=Xu(qN),Rp="TooltipTrigger",BI=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Yu(Rp,n),i=HN(Rp,n),o=fm(n),l=h.useRef(null),c=ze(t,l,s.onTriggerChange),u=h.useRef(!1),d=h.useRef(!1),f=h.useCallback(()=>u.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx($N,{asChild:!0,...o,children:a.jsx(_e.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:ce(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ce(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:ce(e.onBlur,s.onClose),onClick:ce(e.onClick,s.onClose)})})});BI.displayName=Rp;var WI="TooltipPortal",[EL,HI]=Xu(WI,{forceMount:void 0}),Fo="TooltipContent",ZN=h.forwardRef((e,t)=>{const n=HI(Fo,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,o=Yu(Fo,e.__scopeTooltip);return a.jsx(gi,{present:r||o.open,children:o.disableHoverableContent?a.jsx(KN,{side:s,...i,ref:t}):a.jsx(QI,{side:s,...i,ref:t})})}),QI=h.forwardRef((e,t)=>{const n=Yu(Fo,e.__scopeTooltip),r=HN(Fo,e.__scopeTooltip),s=h.useRef(null),i=ze(t,s),[o,l]=h.useState(null),{trigger:c,onClose:u}=n,d=s.current,{onPointerInTransitChange:f}=r,p=h.useCallback(()=>{l(null),f(!1)},[f]),y=h.useCallback((b,g)=>{const w=b.currentTarget,v={x:b.clientX,y:b.clientY},m=XI(v,w.getBoundingClientRect()),x=YI(v,m),j=JI(g.getBoundingClientRect()),T=tD([...x,...j]);l(T),f(!0)},[f]);return h.useEffect(()=>()=>p(),[p]),h.useEffect(()=>{if(c&&d){const b=w=>y(w,d),g=w=>y(w,c);return c.addEventListener("pointerleave",b),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",b),d.removeEventListener("pointerleave",g)}}},[c,d,y,p]),h.useEffect(()=>{if(o){const b=g=>{const w=g.target,v={x:g.clientX,y:g.clientY},m=(c==null?void 0:c.contains(w))||(d==null?void 0:d.contains(w)),x=!eD(v,o);m?p():x&&(p(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,d,o,u,p]),a.jsx(KN,{...e,ref:i})}),[qI,ZI]=Xu(qN,{isInside:!1}),KI=MS("TooltipContent"),KN=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=Yu(Fo,n),u=fm(n),{onClose:d}=c;return h.useEffect(()=>(document.addEventListener(Tv,d),()=>document.removeEventListener(Tv,d)),[d]),h.useEffect(()=>{if(c.trigger){const f=p=>{const y=p.target;y!=null&&y.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),a.jsx(Cl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(UN,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.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(KI,{children:r}),a.jsx(qI,{scope:n,isInside:!0,children:a.jsx(fA,{id:c.contentId,role:"tooltip",children:s||r})})]})})});ZN.displayName=Fo;var GN="TooltipArrow",GI=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=fm(n);return ZI(GN,n).isInside?null:a.jsx(BN,{...s,...r,ref:t})});GI.displayName=GN;function XI(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function YI(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function JI(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function eD(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;ir!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(s=!s)}return s}function tD(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),nD(t)}function nD(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var rD=QN,XN=ZN;const sD=rD,iD=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(XN,{ref:r,sideOffset:t,className:ie("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),...n}));iD.displayName=XN.displayName;function Yo(){const e=qo(),[t,n]=h.useState(null),[r,s]=h.useState(!0);h.useEffect(()=>{(async()=>{try{const c=await fetch("/api/auth/me",{credentials:"include"});if(c.ok){const u=await c.json();n(u)}else n(null)}catch{n(null)}finally{s(!1)}})()},[]);const i=Qt({mutationFn:async l=>await(await nt("/api/auth/login",{method:"POST",body:JSON.stringify(l)})).json(),onSuccess:l=>{n(l.user),e.clear(),window.location.reload()}}),o=Qt({mutationFn:async()=>{await nt("/api/auth/logout",{method:"POST"})},onSuccess:()=>{n(null),e.clear(),window.location.reload()}});return{user:t,isLoading:r,isAuthenticated:!!t,login:i.mutateAsync,logout:o.mutateAsync,isLoggingIn:i.isPending,isLoggingOut:o.isPending}}var Pl=e=>e.type==="checkbox",zs=e=>e instanceof Date,Vt=e=>e==null;const YN=e=>typeof e=="object";var lt=e=>!Vt(e)&&!Array.isArray(e)&&YN(e)&&!zs(e),JN=e=>lt(e)&&e.target?Pl(e.target)?e.target.checked:e.target.value:e,oD=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,e_=(e,t)=>e.has(oD(t)),aD=e=>{const t=e.constructor&&e.constructor.prototype;return lt(t)&&t.hasOwnProperty("isPrototypeOf")},pm=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ke(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(pm&&(e instanceof Blob||r))&&(n||lt(e)))if(t=n?[]:{},!n&&!aD(e))t=e;else for(const s in e)e.hasOwnProperty(s)&&(t[s]=Ke(e[s]));else return e;return t}var Al=e=>Array.isArray(e)?e.filter(Boolean):[],He=e=>e===void 0,W=(e,t,n)=>{if(!t||!lt(e))return n;const r=Al(t.split(/[,[\].]+?/)).reduce((s,i)=>Vt(s)?s:s[i],e);return He(r)||r===e?He(e[t])?n:e[t]:r},on=e=>typeof e=="boolean",hm=e=>/^\w*$/.test(e),t_=e=>Al(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Me=(e,t,n)=>{let r=-1;const s=hm(t)?[t]:t_(t),i=s.length,o=i-1;for(;++rre.useContext(n_),lD=e=>{const{children:t,...n}=e;return re.createElement(n_.Provider,{value:n},t)};var r_=(e,t,n,r=!0)=>{const s={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==bn.all&&(t._proxyFormState[o]=!r||bn.all),n&&(n[o]=!0),e[o]}});return s};function cD(e){const t=Rl(),{control:n=t.control,disabled:r,name:s,exact:i}=e||{},[o,l]=re.useState(n._formState),c=re.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=re.useRef(s);return u.current=s,re.useEffect(()=>n._subscribe({name:u.current,formState:c.current,exact:i,callback:d=>{!r&&l({...n._formState,...d})}}),[n,r,i]),re.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),re.useMemo(()=>r_(o,n,c.current,!1),[o,n])}var tr=e=>typeof e=="string",s_=(e,t,n,r,s)=>tr(e)?(r&&t.watch.add(e),W(n,e,s)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),W(n,i))):(r&&(t.watchAll=!0),n);function uD(e){const t=Rl(),{control:n=t.control,name:r,defaultValue:s,disabled:i,exact:o}=e||{},l=re.useRef(r),c=re.useRef(s);l.current=r,re.useEffect(()=>n._subscribe({name:l.current,formState:{values:!0},exact:o,callback:f=>!i&&d(s_(l.current,n._names,f.values||n._formValues,!1,c.current))}),[n,i,o]);const[u,d]=re.useState(n._getWatch(r,s));return re.useEffect(()=>n._removeUnmounted()),u}function dD(e){const t=Rl(),{name:n,disabled:r,control:s=t.control,shouldUnregister:i}=e,o=e_(s._names.array,n),l=uD({control:s,name:n,defaultValue:W(s._formValues,n,W(s._defaultValues,n,e.defaultValue)),exact:!0}),c=cD({control:s,name:n,exact:!0}),u=re.useRef(e),d=re.useRef(s.register(n,{...e.rules,value:l,...on(e.disabled)?{disabled:e.disabled}:{}})),f=re.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!W(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!W(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!W(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!W(c.validatingFields,n)},error:{enumerable:!0,get:()=>W(c.errors,n)}}),[c,n]),p=re.useCallback(w=>d.current.onChange({target:{value:JN(w),name:n},type:uu.CHANGE}),[n]),y=re.useCallback(()=>d.current.onBlur({target:{value:W(s._formValues,n),name:n},type:uu.BLUR}),[n,s._formValues]),b=re.useCallback(w=>{const v=W(s._fields,n);v&&w&&(v._f.ref={focus:()=>w.focus(),select:()=>w.select(),setCustomValidity:m=>w.setCustomValidity(m),reportValidity:()=>w.reportValidity()})},[s._fields,n]),g=re.useMemo(()=>({name:n,value:l,...on(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:p,onBlur:y,ref:b}),[n,r,c.disabled,p,y,b,l]);return re.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(n,{...u.current.rules,...on(u.current.disabled)?{disabled:u.current.disabled}:{}});const v=(m,x)=>{const j=W(s._fields,m);j&&j._f&&(j._f.mount=x)};if(v(n,!0),w){const m=Ke(W(s._options.defaultValues,n));Me(s._defaultValues,n,m),He(W(s._formValues,n))&&Me(s._formValues,n,m)}return!o&&s.register(n),()=>{(o?w&&!s._state.action:w)?s.unregister(n):v(n,!1)}},[n,s,o,i]),re.useEffect(()=>{s._setDisabledField({disabled:r,name:n})},[r,n,s]),re.useMemo(()=>({field:g,formState:c,fieldState:f}),[g,c,f])}const fD=e=>e.render(dD(e));var i_=(e,t,n,r,s)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:s||!0}}:{},Gt=e=>Array.isArray(e)?e:[e],kv=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}},Ip=e=>Vt(e)||!YN(e);function Kr(e,t){if(Ip(e)||Ip(t))return e===t;if(zs(e)&&zs(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){const i=e[s];if(!r.includes(s))return!1;if(s!=="ref"){const o=t[s];if(zs(i)&&zs(o)||lt(i)&<(o)||Array.isArray(i)&&Array.isArray(o)?!Kr(i,o):i!==o)return!1}}return!0}var Pt=e=>lt(e)&&!Object.keys(e).length,mm=e=>e.type==="file",In=e=>typeof e=="function",du=e=>{if(!pm)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},o_=e=>e.type==="select-multiple",gm=e=>e.type==="radio",pD=e=>gm(e)||Pl(e),Hd=e=>du(e)&&e.isConnected;function hD(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{for(const t in e)if(In(e[t]))return!0;return!1};function fu(e,t={}){const n=Array.isArray(e);if(lt(e)||n)for(const r in e)Array.isArray(e[r])||lt(e[r])&&!a_(e[r])?(t[r]=Array.isArray(e[r])?[]:{},fu(e[r],t[r])):Vt(e[r])||(t[r]=!0);return t}function l_(e,t,n){const r=Array.isArray(e);if(lt(e)||r)for(const s in e)Array.isArray(e[s])||lt(e[s])&&!a_(e[s])?He(t)||Ip(n[s])?n[s]=Array.isArray(e[s])?fu(e[s],[]):{...fu(e[s])}:l_(e[s],Vt(t)?{}:t[s],n[s]):n[s]=!Kr(e[s],t[s]);return n}var da=(e,t)=>l_(e,t,fu(t));const Pv={value:!1,isValid:!1},Av={value:!0,isValid:!0};var c_=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!He(e[0].attributes.value)?He(e[0].value)||e[0].value===""?Av:{value:e[0].value,isValid:!0}:Av:Pv}return Pv},u_=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>He(e)?e:t?e===""?NaN:e&&+e:n&&tr(e)?new Date(e):r?r(e):e;const Rv={isValid:!1,value:null};var d_=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Rv):Rv;function Iv(e){const t=e.ref;return mm(t)?t.files:gm(t)?d_(e.refs).value:o_(t)?[...t.selectedOptions].map(({value:n})=>n):Pl(t)?c_(e.refs).value:u_(He(t.value)?e.ref.value:t.value,e)}var gD=(e,t,n,r)=>{const s={};for(const i of e){const o=W(t,i);o&&Me(s,i,o._f)}return{criteriaMode:n,names:[...e],fields:s,shouldUseNativeValidation:r}},pu=e=>e instanceof RegExp,fa=e=>He(e)?e:pu(e)?e.source:lt(e)?pu(e.value)?e.value.source:e.value:e,Mi=e=>({isOnSubmit:!e||e===bn.onSubmit,isOnBlur:e===bn.onBlur,isOnChange:e===bn.onChange,isOnAll:e===bn.all,isOnTouch:e===bn.onTouched});const Dv="AsyncFunction";var vD=e=>!!e&&!!e.validate&&!!(In(e.validate)&&e.validate.constructor.name===Dv||lt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Dv)),yD=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Dp=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const io=(e,t,n,r)=>{for(const s of n||Object.keys(e)){const i=W(e,s);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(io(l,t))break}else if(lt(l)&&io(l,t))break}}};function Ov(e,t,n){const r=W(e,n);if(r||hm(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const i=s.join("."),o=W(t,i),l=W(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};s.pop()}return{name:n}}var xD=(e,t,n,r)=>{n(e);const{name:s,...i}=e;return Pt(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!r||bn.all))},wD=(e,t,n)=>!e||!t||e===t||Gt(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),bD=(e,t,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(t||e):(n?r.isOnBlur:s.isOnBlur)?!e:(n?r.isOnChange:s.isOnChange)?e:!0,SD=(e,t)=>!Al(W(e,t)).length&&dt(e,t),f_=(e,t,n)=>{const r=Gt(W(e,n));return Me(r,"root",t[n]),Me(e,n,r),e},Tc=e=>tr(e);function Mv(e,t,n="validate"){if(Tc(e)||Array.isArray(e)&&e.every(Tc)||on(e)&&!e)return{type:n,message:Tc(e)?e:"",ref:t}}var xi=e=>lt(e)&&!pu(e)?e:{value:e,message:""},Op=async(e,t,n,r,s,i)=>{const{ref:o,refs:l,required:c,maxLength:u,minLength:d,min:f,max:p,pattern:y,validate:b,name:g,valueAsNumber:w,mount:v}=e._f,m=W(n,g);if(!v||t.has(g))return{};const x=l?l[0]:o,j=M=>{s&&x.reportValidity&&(x.setCustomValidity(on(M)?"":M||""),x.reportValidity())},T={},S=gm(o),N=Pl(o),_=S||N,E=(w||mm(o))&&He(o.value)&&He(m)||du(o)&&o.value===""||m===""||Array.isArray(m)&&!m.length,I=i_.bind(null,g,r,T),H=(M,z,F,ee=pr.maxLength,q=pr.minLength)=>{const oe=M?z:F;T[g]={type:M?ee:q,message:oe,ref:o,...I(M?ee:q,oe)}};if(i?!Array.isArray(m)||!m.length:c&&(!_&&(E||Vt(m))||on(m)&&!m||N&&!c_(l).isValid||S&&!d_(l).isValid)){const{value:M,message:z}=Tc(c)?{value:!!c,message:c}:xi(c);if(M&&(T[g]={type:pr.required,message:z,ref:x,...I(pr.required,z)},!r))return j(z),T}if(!E&&(!Vt(f)||!Vt(p))){let M,z;const F=xi(p),ee=xi(f);if(!Vt(m)&&!isNaN(m)){const q=o.valueAsNumber||m&&+m;Vt(F.value)||(M=q>F.value),Vt(ee.value)||(z=qnew Date(new Date().toDateString()+" "+Y),D=o.type=="time",U=o.type=="week";tr(F.value)&&m&&(M=D?oe(m)>oe(F.value):U?m>F.value:q>new Date(F.value)),tr(ee.value)&&m&&(z=D?oe(m)+M.value,ee=!Vt(z.value)&&m.length<+z.value;if((F||ee)&&(H(F,M.message,z.message),!r))return j(T[g].message),T}if(y&&!E&&tr(m)){const{value:M,message:z}=xi(y);if(pu(M)&&!m.match(M)&&(T[g]={type:pr.pattern,message:z,ref:o,...I(pr.pattern,z)},!r))return j(z),T}if(b){if(In(b)){const M=await b(m,n),z=Mv(M,x);if(z&&(T[g]={...z,...I(pr.validate,z.message)},!r))return j(z.message),T}else if(lt(b)){let M={};for(const z in b){if(!Pt(M)&&!r)break;const F=Mv(await b[z](m,n),x,z);F&&(M={...F,...I(z,F.message)},j(F.message),r&&(T[g]=M))}if(!Pt(M)&&(T[g]={ref:x,...M},!r))return T}}return j(!0),T};const ND={mode:bn.onSubmit,reValidateMode:bn.onChange,shouldFocusError:!0};function _D(e={}){let t={...ND,...e},n={submitCount:0,isDirty:!1,isLoading:In(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const r={};let s=lt(t.defaultValues)||lt(t.values)?Ke(t.values||t.defaultValues)||{}:{},i=t.shouldUnregister?{}:Ke(s),o={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...d};const p={array:kv(),state:kv()},y=Mi(t.mode),b=Mi(t.reValidateMode),g=t.criteriaMode===bn.all,w=k=>R=>{clearTimeout(u),u=setTimeout(k,R)},v=async k=>{if(!t.disabled&&(d.isValid||f.isValid||k)){const R=t.resolver?Pt((await E()).errors):await H(r,!0);R!==n.isValid&&p.state.next({isValid:R})}},m=(k,R)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((k||Array.from(l.mount)).forEach(O=>{O&&(R?Me(n.validatingFields,O,R):dt(n.validatingFields,O))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Pt(n.validatingFields)}))},x=(k,R=[],O,X,Q=!0,B=!0)=>{if(X&&O&&!t.disabled){if(o.action=!0,B&&Array.isArray(W(r,k))){const te=O(W(r,k),X.argA,X.argB);Q&&Me(r,k,te)}if(B&&Array.isArray(W(n.errors,k))){const te=O(W(n.errors,k),X.argA,X.argB);Q&&Me(n.errors,k,te),SD(n.errors,k)}if((d.touchedFields||f.touchedFields)&&B&&Array.isArray(W(n.touchedFields,k))){const te=O(W(n.touchedFields,k),X.argA,X.argB);Q&&Me(n.touchedFields,k,te)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=da(s,i)),p.state.next({name:k,isDirty:z(k,R),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Me(i,k,R)},j=(k,R)=>{Me(n.errors,k,R),p.state.next({errors:n.errors})},T=k=>{n.errors=k,p.state.next({errors:n.errors,isValid:!1})},S=(k,R,O,X)=>{const Q=W(r,k);if(Q){const B=W(i,k,He(O)?W(s,k):O);He(B)||X&&X.defaultChecked||R?Me(i,k,R?B:Iv(Q._f)):q(k,B),o.mount&&v()}},N=(k,R,O,X,Q)=>{let B=!1,te=!1;const Oe={name:k};if(!t.disabled){if(!O||X){(d.isDirty||f.isDirty)&&(te=n.isDirty,n.isDirty=Oe.isDirty=z(),B=te!==Oe.isDirty);const ut=Kr(W(s,k),R);te=!!W(n.dirtyFields,k),ut?dt(n.dirtyFields,k):Me(n.dirtyFields,k,!0),Oe.dirtyFields=n.dirtyFields,B=B||(d.dirtyFields||f.dirtyFields)&&te!==!ut}if(O){const ut=W(n.touchedFields,k);ut||(Me(n.touchedFields,k,O),Oe.touchedFields=n.touchedFields,B=B||(d.touchedFields||f.touchedFields)&&ut!==O)}B&&Q&&p.state.next(Oe)}return B?Oe:{}},_=(k,R,O,X)=>{const Q=W(n.errors,k),B=(d.isValid||f.isValid)&&on(R)&&n.isValid!==R;if(t.delayError&&O?(c=w(()=>j(k,O)),c(t.delayError)):(clearTimeout(u),c=null,O?Me(n.errors,k,O):dt(n.errors,k)),(O?!Kr(Q,O):Q)||!Pt(X)||B){const te={...X,...B&&on(R)?{isValid:R}:{},errors:n.errors,name:k};n={...n,...te},p.state.next(te)}},E=async k=>{m(k,!0);const R=await t.resolver(i,t.context,gD(k||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return m(k),R},I=async k=>{const{errors:R}=await E(k);if(k)for(const O of k){const X=W(R,O);X?Me(n.errors,O,X):dt(n.errors,O)}else n.errors=R;return R},H=async(k,R,O={valid:!0})=>{for(const X in k){const Q=k[X];if(Q){const{_f:B,...te}=Q;if(B){const Oe=l.array.has(B.name),ut=Q._f&&vD(Q._f);ut&&d.validatingFields&&m([X],!0);const Ct=await Op(Q,l.disabled,i,g,t.shouldUseNativeValidation&&!R,Oe);if(ut&&d.validatingFields&&m([X]),Ct[B.name]&&(O.valid=!1,R))break;!R&&(W(Ct,B.name)?Oe?f_(n.errors,Ct,B.name):Me(n.errors,B.name,Ct[B.name]):dt(n.errors,B.name))}!Pt(te)&&await H(te,R,O)}}return O.valid},M=()=>{for(const k of l.unMount){const R=W(r,k);R&&(R._f.refs?R._f.refs.every(O=>!Hd(O)):!Hd(R._f.ref))&&ue(k)}l.unMount=new Set},z=(k,R)=>!t.disabled&&(k&&R&&Me(i,k,R),!Kr(Re(),s)),F=(k,R,O)=>s_(k,l,{...o.mount?i:He(R)?s:tr(k)?{[k]:R}:R},O,R),ee=k=>Al(W(o.mount?i:s,k,t.shouldUnregister?W(s,k,[]):[])),q=(k,R,O={})=>{const X=W(r,k);let Q=R;if(X){const B=X._f;B&&(!B.disabled&&Me(i,k,u_(R,B)),Q=du(B.ref)&&Vt(R)?"":R,o_(B.ref)?[...B.ref.options].forEach(te=>te.selected=Q.includes(te.value)):B.refs?Pl(B.ref)?B.refs.length>1?B.refs.forEach(te=>(!te.defaultChecked||!te.disabled)&&(te.checked=Array.isArray(Q)?!!Q.find(Oe=>Oe===te.value):Q===te.value)):B.refs[0]&&(B.refs[0].checked=!!Q):B.refs.forEach(te=>te.checked=te.value===Q):mm(B.ref)?B.ref.value="":(B.ref.value=Q,B.ref.type||p.state.next({name:k,values:Ke(i)})))}(O.shouldDirty||O.shouldTouch)&&N(k,Q,O.shouldTouch,O.shouldDirty,!0),O.shouldValidate&&ae(k)},oe=(k,R,O)=>{for(const X in R){const Q=R[X],B=`${k}.${X}`,te=W(r,B);(l.array.has(k)||lt(Q)||te&&!te._f)&&!zs(Q)?oe(B,Q,O):q(B,Q,O)}},D=(k,R,O={})=>{const X=W(r,k),Q=l.array.has(k),B=Ke(R);Me(i,k,B),Q?(p.array.next({name:k,values:Ke(i)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&O.shouldDirty&&p.state.next({name:k,dirtyFields:da(s,i),isDirty:z(k,B)})):X&&!X._f&&!Vt(B)?oe(k,B,O):q(k,B,O),Dp(k,l)&&p.state.next({...n}),p.state.next({name:o.mount?k:void 0,values:Ke(i)})},U=async k=>{o.mount=!0;const R=k.target;let O=R.name,X=!0;const Q=W(r,O),B=te=>{X=Number.isNaN(te)||zs(te)&&isNaN(te.getTime())||Kr(te,W(i,O,te))};if(Q){let te,Oe;const ut=R.type?Iv(Q._f):JN(k),Ct=k.type===uu.BLUR||k.type===uu.FOCUS_OUT,ET=!yD(Q._f)&&!t.resolver&&!W(n.errors,O)&&!Q._f.deps||bD(Ct,W(n.touchedFields,O),n.isSubmitted,b,y),ld=Dp(O,l,Ct);Me(i,O,ut),Ct?(Q._f.onBlur&&Q._f.onBlur(k),c&&c(0)):Q._f.onChange&&Q._f.onChange(k);const cd=N(O,ut,Ct),TT=!Pt(cd)||ld;if(!Ct&&p.state.next({name:O,type:k.type,values:Ke(i)}),ET)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?Ct&&v():Ct||v()),TT&&p.state.next({name:O,...ld?{}:cd});if(!Ct&&ld&&p.state.next({...n}),t.resolver){const{errors:$m}=await E([O]);if(B(ut),X){const kT=Ov(n.errors,r,O),Um=Ov($m,r,kT.name||O);te=Um.error,O=Um.name,Oe=Pt($m)}}else m([O],!0),te=(await Op(Q,l.disabled,i,g,t.shouldUseNativeValidation))[O],m([O]),B(ut),X&&(te?Oe=!1:(d.isValid||f.isValid)&&(Oe=await H(r,!0)));X&&(Q._f.deps&&ae(Q._f.deps),_(O,Oe,te,cd))}},Y=(k,R)=>{if(W(n.errors,R)&&k.focus)return k.focus(),1},ae=async(k,R={})=>{let O,X;const Q=Gt(k);if(t.resolver){const B=await I(He(k)?k:Q);O=Pt(B),X=k?!Q.some(te=>W(B,te)):O}else k?(X=(await Promise.all(Q.map(async B=>{const te=W(r,B);return await H(te&&te._f?{[B]:te}:te)}))).every(Boolean),!(!X&&!n.isValid)&&v()):X=O=await H(r);return p.state.next({...!tr(k)||(d.isValid||f.isValid)&&O!==n.isValid?{}:{name:k},...t.resolver||!k?{isValid:O}:{},errors:n.errors}),R.shouldFocus&&!X&&io(r,Y,k?Q:l.mount),X},Re=k=>{const R={...o.mount?i:s};return He(k)?R:tr(k)?W(R,k):k.map(O=>W(R,O))},ct=(k,R)=>({invalid:!!W((R||n).errors,k),isDirty:!!W((R||n).dirtyFields,k),error:W((R||n).errors,k),isValidating:!!W(n.validatingFields,k),isTouched:!!W((R||n).touchedFields,k)}),Ue=k=>{k&&Gt(k).forEach(R=>dt(n.errors,R)),p.state.next({errors:k?n.errors:{}})},Ot=(k,R,O)=>{const X=(W(r,k,{_f:{}})._f||{}).ref,Q=W(n.errors,k)||{},{ref:B,message:te,type:Oe,...ut}=Q;Me(n.errors,k,{...ut,...R,ref:X}),p.state.next({name:k,errors:n.errors,isValid:!1}),O&&O.shouldFocus&&X&&X.focus&&X.focus()},ht=(k,R)=>In(k)?p.state.subscribe({next:O=>k(F(void 0,R),O)}):F(k,R,!0),C=k=>p.state.subscribe({next:R=>{wD(k.name,R.name,k.exact)&&xD(R,k.formState||d,vi,k.reRenderRoot)&&k.callback({values:{...i},...n,...R})}}).unsubscribe,se=k=>(o.mount=!0,f={...f,...k.formState},C({...k,formState:f})),ue=(k,R={})=>{for(const O of k?Gt(k):l.mount)l.mount.delete(O),l.array.delete(O),R.keepValue||(dt(r,O),dt(i,O)),!R.keepError&&dt(n.errors,O),!R.keepDirty&&dt(n.dirtyFields,O),!R.keepTouched&&dt(n.touchedFields,O),!R.keepIsValidating&&dt(n.validatingFields,O),!t.shouldUnregister&&!R.keepDefaultValue&&dt(s,O);p.state.next({values:Ke(i)}),p.state.next({...n,...R.keepDirty?{isDirty:z()}:{}}),!R.keepIsValid&&v()},pe=({disabled:k,name:R})=>{(on(k)&&o.mount||k||l.disabled.has(R))&&(k?l.disabled.add(R):l.disabled.delete(R))},Ee=(k,R={})=>{let O=W(r,k);const X=on(R.disabled)||on(t.disabled);return Me(r,k,{...O||{},_f:{...O&&O._f?O._f:{ref:{name:k}},name:k,mount:!0,...R}}),l.mount.add(k),O?pe({disabled:on(R.disabled)?R.disabled:t.disabled,name:k}):S(k,!0,R.value),{...X?{disabled:R.disabled||t.disabled}:{},...t.progressive?{required:!!R.required,min:fa(R.min),max:fa(R.max),minLength:fa(R.minLength),maxLength:fa(R.maxLength),pattern:fa(R.pattern)}:{},name:k,onChange:U,onBlur:U,ref:Q=>{if(Q){Ee(k,R),O=W(r,k);const B=He(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,te=pD(B),Oe=O._f.refs||[];if(te?Oe.find(ut=>ut===B):B===O._f.ref)return;Me(r,k,{_f:{...O._f,...te?{refs:[...Oe.filter(Hd),B,...Array.isArray(W(s,k))?[{}]:[]],ref:{type:B.type,name:k}}:{ref:B}}}),S(k,!1,void 0,B)}else O=W(r,k,{}),O._f&&(O._f.mount=!1),(t.shouldUnregister||R.shouldUnregister)&&!(e_(l.array,k)&&o.action)&&l.unMount.add(k)}}},Ie=()=>t.shouldFocusError&&io(r,Y,l.mount),yt=k=>{on(k)&&(p.state.next({disabled:k}),io(r,(R,O)=>{const X=W(r,O);X&&(R.disabled=X._f.disabled||k,Array.isArray(X._f.refs)&&X._f.refs.forEach(Q=>{Q.disabled=X._f.disabled||k}))},0,!1))},jt=(k,R)=>async O=>{let X;O&&(O.preventDefault&&O.preventDefault(),O.persist&&O.persist());let Q=Ke(i);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:B,values:te}=await E();n.errors=B,Q=te}else await H(r);if(l.disabled.size)for(const B of l.disabled)Me(Q,B,void 0);if(dt(n.errors,"root"),Pt(n.errors)){p.state.next({errors:{}});try{await k(Q,O)}catch(B){X=B}}else R&&await R({...n.errors},O),Ie(),setTimeout(Ie);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Pt(n.errors)&&!X,submitCount:n.submitCount+1,errors:n.errors}),X)throw X},Is=(k,R={})=>{W(r,k)&&(He(R.defaultValue)?D(k,Ke(W(s,k))):(D(k,R.defaultValue),Me(s,k,Ke(R.defaultValue))),R.keepTouched||dt(n.touchedFields,k),R.keepDirty||(dt(n.dirtyFields,k),n.isDirty=R.defaultValue?z(k,Ke(W(s,k))):z()),R.keepError||(dt(n.errors,k),d.isValid&&v()),p.state.next({...n}))},Mr=(k,R={})=>{const O=k?Ke(k):s,X=Ke(O),Q=Pt(k),B=Q?s:X;if(R.keepDefaultValues||(s=O),!R.keepValues){if(R.keepDirtyValues){const te=new Set([...l.mount,...Object.keys(da(s,i))]);for(const Oe of Array.from(te))W(n.dirtyFields,Oe)?Me(B,Oe,W(i,Oe)):D(Oe,W(B,Oe))}else{if(pm&&He(k))for(const te of l.mount){const Oe=W(r,te);if(Oe&&Oe._f){const ut=Array.isArray(Oe._f.refs)?Oe._f.refs[0]:Oe._f.ref;if(du(ut)){const Ct=ut.closest("form");if(Ct){Ct.reset();break}}}}for(const te of l.mount)D(te,W(B,te))}i=Ke(B),p.array.next({values:{...B}}),p.state.next({values:{...B}})}l={mount:R.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!d.isValid||!!R.keepIsValid||!!R.keepDirtyValues,o.watch=!!t.shouldUnregister,p.state.next({submitCount:R.keepSubmitCount?n.submitCount:0,isDirty:Q?!1:R.keepDirty?n.isDirty:!!(R.keepDefaultValues&&!Kr(k,s)),isSubmitted:R.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Q?{}:R.keepDirtyValues?R.keepDefaultValues&&i?da(s,i):n.dirtyFields:R.keepDefaultValues&&k?da(s,k):R.keepDirty?n.dirtyFields:{},touchedFields:R.keepTouched?n.touchedFields:{},errors:R.keepErrors?n.errors:{},isSubmitSuccessful:R.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Fr=(k,R)=>Mr(In(k)?k(i):k,R),ad=(k,R={})=>{const O=W(r,k),X=O&&O._f;if(X){const Q=X.refs?X.refs[0]:X.ref;Q.focus&&(Q.focus(),R.shouldSelect&&In(Q.select)&&Q.select())}},vi=k=>{n={...n,...k}},zm={control:{register:Ee,unregister:ue,getFieldState:ct,handleSubmit:jt,setError:Ot,_subscribe:C,_runSchema:E,_getWatch:F,_getDirty:z,_setValid:v,_setFieldArray:x,_setDisabledField:pe,_setErrors:T,_getFieldArray:ee,_reset:Mr,_resetDefaultValues:()=>In(t.defaultValues)&&t.defaultValues().then(k=>{Fr(k,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:M,_disableForm:yt,_subjects:p,_proxyFormState:d,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state(k){o=k},get _defaultValues(){return s},get _names(){return l},set _names(k){l=k},get _formState(){return n},get _options(){return t},set _options(k){t={...t,...k}}},subscribe:se,trigger:ae,register:Ee,handleSubmit:jt,watch:ht,setValue:D,getValues:Re,reset:Fr,resetField:Is,clearErrors:Ue,unregister:ue,setError:Ot,setFocus:ad,getFieldState:ct};return{...zm,formControl:zm}}var $r=()=>{const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(Math.random()*16+e)%16|0;return(t=="x"?n:n&3|8).toString(16)})},Qd=(e,t,n={})=>n.shouldFocus||He(n.shouldFocus)?n.focusName||`${e}.${He(n.focusIndex)?t:n.focusIndex}.`:"",qd=(e,t)=>[...e,...Gt(t)],Zd=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Kd(e,t,n){return[...e.slice(0,t),...Gt(n),...e.slice(t)]}var Gd=(e,t,n)=>Array.isArray(e)?(He(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],Xd=(e,t)=>[...Gt(t),...Gt(e)];function jD(e,t){let n=0;const r=[...e];for(const s of t)r.splice(s-n,1),n++;return Al(r).length?r:[]}var Yd=(e,t)=>He(t)?[]:jD(e,Gt(t).sort((n,r)=>n-r)),Jd=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},Fv=(e,t,n)=>(e[t]=n,e);function CD(e){const t=Rl(),{control:n=t.control,name:r,keyName:s="id",shouldUnregister:i,rules:o}=e,[l,c]=re.useState(n._getFieldArray(r)),u=re.useRef(n._getFieldArray(r).map($r)),d=re.useRef(l),f=re.useRef(r),p=re.useRef(!1);f.current=r,d.current=l,n._names.array.add(r),o&&n.register(r,o),re.useEffect(()=>n._subjects.array.subscribe({next:({values:S,name:N})=>{if(N===f.current||!N){const _=W(S,f.current);Array.isArray(_)&&(c(_),u.current=_.map($r))}}}).unsubscribe,[n]);const y=re.useCallback(S=>{p.current=!0,n._setFieldArray(r,S)},[n,r]),b=(S,N)=>{const _=Gt(Ke(S)),E=qd(n._getFieldArray(r),_);n._names.focus=Qd(r,E.length-1,N),u.current=qd(u.current,_.map($r)),y(E),c(E),n._setFieldArray(r,E,qd,{argA:Zd(S)})},g=(S,N)=>{const _=Gt(Ke(S)),E=Xd(n._getFieldArray(r),_);n._names.focus=Qd(r,0,N),u.current=Xd(u.current,_.map($r)),y(E),c(E),n._setFieldArray(r,E,Xd,{argA:Zd(S)})},w=S=>{const N=Yd(n._getFieldArray(r),S);u.current=Yd(u.current,S),y(N),c(N),!Array.isArray(W(n._fields,r))&&Me(n._fields,r,void 0),n._setFieldArray(r,N,Yd,{argA:S})},v=(S,N,_)=>{const E=Gt(Ke(N)),I=Kd(n._getFieldArray(r),S,E);n._names.focus=Qd(r,S,_),u.current=Kd(u.current,S,E.map($r)),y(I),c(I),n._setFieldArray(r,I,Kd,{argA:S,argB:Zd(N)})},m=(S,N)=>{const _=n._getFieldArray(r);Jd(_,S,N),Jd(u.current,S,N),y(_),c(_),n._setFieldArray(r,_,Jd,{argA:S,argB:N},!1)},x=(S,N)=>{const _=n._getFieldArray(r);Gd(_,S,N),Gd(u.current,S,N),y(_),c(_),n._setFieldArray(r,_,Gd,{argA:S,argB:N},!1)},j=(S,N)=>{const _=Ke(N),E=Fv(n._getFieldArray(r),S,_);u.current=[...E].map((I,H)=>!I||H===S?$r():u.current[H]),y(E),c([...E]),n._setFieldArray(r,E,Fv,{argA:S,argB:_},!0,!1)},T=S=>{const N=Gt(Ke(S));u.current=N.map($r),y([...N]),c([...N]),n._setFieldArray(r,[...N],_=>_,{},!0,!1)};return re.useEffect(()=>{if(n._state.action=!1,Dp(r,n._names)&&n._subjects.state.next({...n._formState}),p.current&&(!Mi(n._options.mode).isOnSubmit||n._formState.isSubmitted)&&!Mi(n._options.reValidateMode).isOnSubmit)if(n._options.resolver)n._runSchema([r]).then(S=>{const N=W(S.errors,r),_=W(n._formState.errors,r);(_?!N&&_.type||N&&(_.type!==N.type||_.message!==N.message):N&&N.type)&&(N?Me(n._formState.errors,r,N):dt(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{const S=W(n._fields,r);S&&S._f&&!(Mi(n._options.reValidateMode).isOnSubmit&&Mi(n._options.mode).isOnSubmit)&&Op(S,n._names.disabled,n._formValues,n._options.criteriaMode===bn.all,n._options.shouldUseNativeValidation,!0).then(N=>!Pt(N)&&n._subjects.state.next({errors:f_(n._formState.errors,N,r)}))}n._subjects.state.next({name:r,values:Ke(n._formValues)}),n._names.focus&&io(n._fields,(S,N)=>{if(n._names.focus&&N.startsWith(n._names.focus)&&S.focus)return S.focus(),1}),n._names.focus="",n._setValid(),p.current=!1},[l,r,n]),re.useEffect(()=>(!W(n._formValues,r)&&n._setFieldArray(r),()=>{const S=(N,_)=>{const E=W(n._fields,N);E&&E._f&&(E._f.mount=_)};n._options.shouldUnregister||i?n.unregister(r):S(r,!1)}),[r,n,s,i]),{swap:re.useCallback(m,[y,r,n]),move:re.useCallback(x,[y,r,n]),prepend:re.useCallback(g,[y,r,n]),append:re.useCallback(b,[y,r,n]),remove:re.useCallback(w,[y,r,n]),insert:re.useCallback(v,[y,r,n]),update:re.useCallback(j,[y,r,n]),replace:re.useCallback(T,[y,r,n]),fields:re.useMemo(()=>l.map((S,N)=>({...S,[s]:u.current[N]||$r()})),[l,s])}}function Fi(e={}){const t=re.useRef(void 0),n=re.useRef(void 0),[r,s]=re.useState({isDirty:!1,isValidating:!1,isLoading:In(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:In(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:_D(e),formState:r},e.formControl&&e.defaultValues&&!In(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const i=t.current.control;return i._options=e,re.useLayoutEffect(()=>i._subscribe({formState:i._proxyFormState,callback:()=>s({...i._formState}),reRenderRoot:!0}),[i]),re.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),re.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==r.isDirty&&i._subjects.state.next({isDirty:o})}},[i,r.isDirty]),re.useEffect(()=>{e.values&&!Kr(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values,s(o=>({...o}))):i._resetDefaultValues()},[e.values,i]),re.useEffect(()=>{e.errors&&!Pt(e.errors)&&i._setErrors(e.errors)},[e.errors,i]),re.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),re.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[e.shouldUnregister,i]),t.current.formState=r_(r,i),t.current}const Lv=(e,t,n)=>{if(e&&"reportValidity"in e){const r=W(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},p_=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Lv(r.ref,n,e):r.refs&&r.refs.forEach(s=>Lv(s,n,e))}},ED=(e,t)=>{t.shouldUseNativeValidation&&p_(e,t);const n={};for(const r in e){const s=W(t.fields,r),i=Object.assign(e[r]||{},{ref:s&&s.ref});if(TD(t.names||Object.keys(e),r)){const o=Object.assign({},W(n,r));Me(o,"root",i),Me(n,r,o)}else Me(n,r,i)}return n},TD=(e,t)=>e.some(n=>n.startsWith(t+"."));var kD=function(e,t){for(var n={};e.length;){var r=e[0],s=r.code,i=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:i,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=n[o].types,u=c&&c[r.code];n[o]=i_(o,t,n,s,u?[].concat(u,r.message):r.message)}e.shift()}return n},ya=function(e,t,n){return n===void 0&&(n={}),function(r,s,i){try{return Promise.resolve(function(o,l){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return i.shouldUseNativeValidation&&p_({},i),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(o))return{values:{},errors:ED(kD(o.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}}};const Hn=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:ie("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Hn.displayName="Card";const Qn=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:ie("flex flex-col space-y-1.5 p-6",e),...t}));Qn.displayName="CardHeader";const qn=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:ie("text-2xl font-semibold leading-none tracking-tight",e),...t}));qn.displayName="CardTitle";const PD=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:ie("text-sm text-muted-foreground",e),...t}));PD.displayName="CardDescription";const Zn=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:ie("p-6 pt-0",e),...t}));Zn.displayName="CardContent";const AD=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:ie("flex items-center p-6 pt-0",e),...t}));AD.displayName="CardFooter";const vm=Tl("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),je=h.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},i)=>{const o=r?DS:"button";return a.jsx(o,{className:ie(vm({variant:t,size:n,className:e})),ref:i,...s})});je.displayName="Button";const Te=h.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:ie("flex h-10 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:r,...n}));Te.displayName="Input";var RD="Label",h_=h.forwardRef((e,t)=>a.jsx(_e.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));h_.displayName=RD;var m_=h_;const ID=Tl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),g_=h.forwardRef(({className:e,...t},n)=>a.jsx(m_,{ref:n,className:ie(ID(),e),...t}));g_.displayName=m_.displayName;const Li=lD,v_=h.createContext({}),Se=({...e})=>a.jsx(v_.Provider,{value:{name:e.name},children:a.jsx(fD,{...e})}),Ju=()=>{const e=h.useContext(v_),t=h.useContext(y_),{getFieldState:n,formState:r}=Rl(),s=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...s}},y_=h.createContext({}),ve=h.forwardRef(({className:e,...t},n)=>{const r=h.useId();return a.jsx(y_.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:ie("space-y-2",e),...t})})});ve.displayName="FormItem";const ye=h.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:s}=Ju();return a.jsx(g_,{ref:n,className:ie(r&&"text-destructive",e),htmlFor:s,...t})});ye.displayName="FormLabel";const xe=h.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:s,formMessageId:i}=Ju();return a.jsx(DS,{ref:t,id:r,"aria-describedby":n?`${s} ${i}`:`${s}`,"aria-invalid":!!n,...e})});xe.displayName="FormControl";const DD=h.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=Ju();return a.jsx("p",{ref:n,id:r,className:ie("text-sm text-muted-foreground",e),...t})});DD.displayName="FormDescription";const we=h.forwardRef(({className:e,children:t,...n},r)=>{const{error:s,formMessageId:i}=Ju(),o=s?String((s==null?void 0:s.message)??""):t;return o?a.jsx("p",{ref:r,id:i,className:ie("text-sm font-medium text-destructive",e),...n,children:o}):null});we.displayName="FormMessage";const OD=Tl("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),x_=h.forwardRef(({className:e,variant:t,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:ie(OD({variant:t}),e),...n}));x_.displayName="Alert";const MD=h.forwardRef(({className:e,...t},n)=>a.jsx("h5",{ref:n,className:ie("mb-1 font-medium leading-none tracking-tight",e),...t}));MD.displayName="AlertTitle";const w_=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:ie("text-sm [&_p]:leading-relaxed",e),...t}));w_.displayName="AlertDescription";const L=Symbol.for("drizzle:entityKind");function ft(e,t){if(!e||typeof e!="object")return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,L))throw new Error(`Class "${t.name??""}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(L in n&&n[L]===t[L])return!0;n=Object.getPrototypeOf(n)}return!1}var xy;xy=L;class Lo{constructor(t,n){A(this,"name");A(this,"keyAsName");A(this,"primary");A(this,"notNull");A(this,"default");A(this,"defaultFn");A(this,"onUpdateFn");A(this,"hasDefault");A(this,"isUnique");A(this,"uniqueName");A(this,"uniqueType");A(this,"dataType");A(this,"columnType");A(this,"enumValues");A(this,"generated");A(this,"generatedIdentity");A(this,"config");this.table=t,this.config=n,this.name=n.name,this.keyAsName=n.keyAsName,this.notNull=n.notNull,this.default=n.default,this.defaultFn=n.defaultFn,this.onUpdateFn=n.onUpdateFn,this.hasDefault=n.hasDefault,this.primary=n.primaryKey,this.isUnique=n.isUnique,this.uniqueName=n.uniqueName,this.uniqueType=n.uniqueType,this.dataType=n.dataType,this.columnType=n.columnType,this.generated=n.generated,this.generatedIdentity=n.generatedIdentity}mapFromDriverValue(t){return t}mapToDriverValue(t){return t}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}A(Lo,xy,"Column");var wy;wy=L;class b_{constructor(t,n,r){A(this,"config");A(this,"$default",this.$defaultFn);A(this,"$onUpdate",this.$onUpdateFn);this.config={name:t,keyAsName:t==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:n,columnType:r,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(t){return this.config.default=t,this.config.hasDefault=!0,this}$defaultFn(t){return this.config.defaultFn=t,this.config.hasDefault=!0,this}$onUpdateFn(t){return this.config.onUpdateFn=t,this.config.hasDefault=!0,this}primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(t){this.config.name===""&&(this.config.name=t)}}A(b_,wy,"ColumnBuilder");const oo=Symbol.for("drizzle:Name");var by;by=L;class S_{constructor(t,n){A(this,"reference");A(this,"_onUpdate","no action");A(this,"_onDelete","no action");this.reference=()=>{const{name:r,columns:s,foreignColumns:i}=t();return{name:r,columns:s,foreignTable:i[0].table,foreignColumns:i}},n&&(this._onUpdate=n.onUpdate,this._onDelete=n.onDelete)}onUpdate(t){return this._onUpdate=t===void 0?"no action":t,this}onDelete(t){return this._onDelete=t===void 0?"no action":t,this}build(t){return new N_(t,this)}}A(S_,by,"PgForeignKeyBuilder");var Sy;Sy=L;class N_{constructor(t,n){A(this,"reference");A(this,"onUpdate");A(this,"onDelete");this.table=t,this.reference=n.reference,this.onUpdate=n._onUpdate,this.onDelete=n._onDelete}getName(){const{name:t,columns:n,foreignColumns:r}=this.reference(),s=n.map(l=>l.name),i=r.map(l=>l.name),o=[this.table[oo],...s,r[0].table[oo],...i];return t??`${o.join("_")}_fk`}}A(N_,Sy,"PgForeignKey");function FD(e,...t){return e(...t)}function LD(e,t){return`${e[oo]}_${t.join("_")}_unique`}function Vv(e,t,n){for(let r=t;rArray.isArray(t)?j_(t):typeof t=="string"?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${t}`).join(",")}}`}var Ny,_y;class Ae extends(_y=b_,Ny=L,_y){constructor(){super(...arguments);A(this,"foreignKeyConfigs",[])}array(n){return new E_(this.config.name,this,n)}references(n,r={}){return this.foreignKeyConfigs.push({ref:n,actions:r}),this}unique(n,r){return this.config.isUnique=!0,this.config.uniqueName=n,this.config.uniqueType=r==null?void 0:r.nulls,this}generatedAlwaysAs(n){return this.config.generated={as:n,type:"always",mode:"stored"},this}buildForeignKeys(n,r){return this.foreignKeyConfigs.map(({ref:s,actions:i})=>FD((o,l)=>{const c=new S_(()=>{const u=o();return{columns:[n],foreignColumns:[u]}});return l.onUpdate&&c.onUpdate(l.onUpdate),l.onDelete&&c.onDelete(l.onDelete),c.build(r)},s,i))}buildExtraConfigColumn(n){return new C_(n,this.config)}}A(Ae,Ny,"PgColumnBuilder");var jy,Cy;class me extends(Cy=Lo,jy=L,Cy){constructor(t,n){n.uniqueName||(n.uniqueName=LD(t,[n.name])),super(t,n),this.table=t}}A(me,jy,"PgColumn");var Ey,Ty;class C_ extends(Ty=me,Ey=L,Ty){constructor(){super(...arguments);A(this,"indexConfig",{order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass});A(this,"defaultConfig",{order:"asc",nulls:"last",opClass:void 0})}getSQLType(){return this.getSQLType()}asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(n){return this.indexConfig.opClass=n,this}}A(C_,Ey,"ExtraConfigColumn");var ky;ky=L;class kc{constructor(t,n,r,s){A(this,"name");A(this,"keyAsName");A(this,"type");A(this,"indexConfig");this.name=t,this.keyAsName=n,this.type=r,this.indexConfig=s}}A(kc,ky,"IndexedColumn");var Py,Ay;class E_ extends(Ay=Ae,Py=L,Ay){constructor(t,n,r){super(t,"array","PgArray"),this.config.baseBuilder=n,this.config.size=r}build(t){const n=this.config.baseBuilder.build(t);return new Mp(t,this.config,n)}}A(E_,Py,"PgArrayBuilder");var Ry,Iy;const Eu=class Eu extends(Iy=me,Ry=L,Iy){constructor(n,r,s,i){super(n,r);A(this,"size");this.baseColumn=s,this.range=i,this.size=r.size}getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(n){return typeof n=="string"&&(n=VD(n)),n.map(r=>this.baseColumn.mapFromDriverValue(r))}mapToDriverValue(n,r=!1){const s=n.map(i=>i===null?null:ft(this.baseColumn,Eu)?this.baseColumn.mapToDriverValue(i,!0):this.baseColumn.mapToDriverValue(i));return r?s:j_(s)}};A(Eu,Ry,"PgArray");let Mp=Eu;const zv=Symbol.for("drizzle:isPgEnum");function zD(e){return!!e&&typeof e=="function"&&zv in e&&e[zv]===!0}var Dy;Dy=L;class ym{constructor(t,n,r,s=!1){this._={brand:"Subquery",sql:t,selectedFields:n,alias:r,isWith:s}}}A(ym,Dy,"Subquery");const $D={startActiveSpan(e,t){return t()}},ao=Symbol.for("drizzle:ViewBaseConfig"),ef=Symbol.for("drizzle:Schema"),$v=Symbol.for("drizzle:Columns"),Uv=Symbol.for("drizzle:ExtraConfigColumns"),tf=Symbol.for("drizzle:OriginalName"),nf=Symbol.for("drizzle:BaseName"),hu=Symbol.for("drizzle:IsAlias"),Bv=Symbol.for("drizzle:ExtraConfigBuilder"),T_=Symbol.for("drizzle:IsDrizzleTable");var Oy,My,Fy,Ly,Vy,zy,$y,Uy,By,Wy,uc;let ln=(Wy=L,By=oo,Uy=tf,$y=ef,zy=$v,Vy=Uv,Ly=nf,Fy=hu,My=T_,Oy=Bv,uc=class{constructor(t,n,r){A(this,By);A(this,Uy);A(this,$y);A(this,zy);A(this,Vy);A(this,Ly);A(this,Fy,!1);A(this,My,!0);A(this,Oy);this[oo]=this[tf]=t,this[ef]=n,this[nf]=r}},A(uc,Wy,"Table"),A(uc,"Symbol",{Name:oo,Schema:ef,OriginalName:tf,Columns:$v,ExtraConfigColumns:Uv,BaseName:nf,IsAlias:hu,ExtraConfigBuilder:Bv}),uc);function k_(e){return typeof e=="object"&&e!==null&&T_ in e}function UD(e){return e!=null&&typeof e.getSQL=="function"}function BD(e){var n;const t={sql:"",params:[]};for(const r of e)t.sql+=r.sql,t.params.push(...r.params),(n=r.typings)!=null&&n.length&&(t.typings||(t.typings=[]),t.typings.push(...r.typings));return t}var Hy;Hy=L;class yn{constructor(t){A(this,"value");this.value=Array.isArray(t)?t:[t]}getSQL(){return new it([this])}}A(yn,Hy,"StringChunk");var Qy;Qy=L;const Ms=class Ms{constructor(t){A(this,"decoder",P_);A(this,"shouldInlineParams",!1);this.queryChunks=t}append(t){return this.queryChunks.push(...t.queryChunks),this}toQuery(t){return $D.startActiveSpan("drizzle.buildSQL",n=>{const r=this.buildQueryFromSourceParams(this.queryChunks,t);return n==null||n.setAttributes({"drizzle.query.text":r.sql,"drizzle.query.params":JSON.stringify(r.params)}),r})}buildQueryFromSourceParams(t,n){const r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:s,escapeName:i,escapeParam:o,prepareTyping:l,inlineParams:c,paramStartIndex:u}=r;return BD(t.map(d=>{var f;if(ft(d,yn))return{sql:d.value.join(""),params:[]};if(ft(d,mu))return{sql:i(d.value),params:[]};if(d===void 0)return{sql:"",params:[]};if(Array.isArray(d)){const p=[new yn("(")];for(const[y,b]of d.entries())p.push(b),ye},A_={mapToDriverValue:e=>e};({...P_,...A_});var Zy;Zy=L;class xm{constructor(t,n=A_){A(this,"brand");this.value=t,this.encoder=n}getSQL(){return new it([this])}}A(xm,Zy,"Param");function gu(e,...t){const n=[];(t.length>0||e.length>0&&e[0]!=="")&&n.push(new yn(e[0]));for(const[r,s]of t.entries())n.push(s,new yn(e[r+1]));return new it(n)}(e=>{function t(){return new it([])}e.empty=t;function n(c){return new it(c)}e.fromList=n;function r(c){return new it([new yn(c)])}e.raw=r;function s(c,u){const d=[];for(const[f,p]of c.entries())f>0&&u!==void 0&&d.push(u),d.push(p);return new it(d)}e.join=s;function i(c){return new mu(c)}e.identifier=i;function o(c){return new vu(c)}e.placeholder=o;function l(c,u){return new xm(c,u)}e.param=l})(gu||(gu={}));(e=>{var n;n=L;const r=class r{constructor(i,o){A(this,"isSelectionField",!1);this.sql=i,this.fieldAlias=o}getSQL(){return this.sql}clone(){return new r(this.sql,this.fieldAlias)}};A(r,n,"SQL.Aliased");let t=r;e.Aliased=t})(it||(it={}));var Ky;Ky=L;class vu{constructor(t){this.name=t}getSQL(){return new it([this])}}A(vu,Ky,"Placeholder");const R_=Symbol.for("drizzle:IsDrizzleView");var Gy,Xy,Yy;Yy=L,Xy=ao,Gy=R_;class I_{constructor({name:t,schema:n,selectedFields:r,query:s}){A(this,Xy);A(this,Gy,!0);this[ao]={name:t,originalName:t,schema:n,selectedFields:r,query:s,isExisting:!s,isAlias:!1}}getSQL(){return new it([this])}}A(I_,Yy,"View");function WD(e){return typeof e=="object"&&e!==null&&R_ in e}Lo.prototype.getSQL=function(){return new it([this])};ln.prototype.getSQL=function(){return new it([this])};ym.prototype.getSQL=function(){return new it([this])};function HD(e){return e[ln.Symbol.Columns]}function QD(e){return e[ao].selectedFields}function bt(e,t){return{name:typeof e=="string"&&e.length>0?e:"",config:typeof e=="object"?e:t}}var Jy,ex;class Il extends(ex=Ae,Jy=L,ex){generatedAlwaysAsIdentity(t){if(t){const{name:n,...r}=t;this.config.generatedIdentity={type:"always",sequenceName:n,sequenceOptions:r}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(t){if(t){const{name:n,...r}=t;this.config.generatedIdentity={type:"byDefault",sequenceName:n,sequenceOptions:r}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}A(Il,Jy,"PgIntColumnBaseBuilder");var tx,nx;class D_ extends(nx=Il,tx=L,nx){constructor(t){super(t,"number","PgBigInt53")}build(t){return new O_(t,this.config)}}A(D_,tx,"PgBigInt53Builder");var rx,sx;class O_ extends(sx=me,rx=L,sx){getSQLType(){return"bigint"}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}}A(O_,rx,"PgBigInt53");var ix,ox;class M_ extends(ox=Il,ix=L,ox){constructor(t){super(t,"bigint","PgBigInt64")}build(t){return new F_(t,this.config)}}A(M_,ix,"PgBigInt64Builder");var ax,lx;class F_ extends(lx=me,ax=L,lx){getSQLType(){return"bigint"}mapFromDriverValue(t){return BigInt(t)}}A(F_,ax,"PgBigInt64");function qD(e,t){const{name:n,config:r}=bt(e,t);return r.mode==="number"?new D_(n):new M_(n)}var cx,ux;class L_ extends(ux=Ae,cx=L,ux){constructor(t){super(t,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new V_(t,this.config)}}A(L_,cx,"PgBigSerial53Builder");var dx,fx;class V_ extends(fx=me,dx=L,fx){getSQLType(){return"bigserial"}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}}A(V_,dx,"PgBigSerial53");var px,hx;class z_ extends(hx=Ae,px=L,hx){constructor(t){super(t,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(t){return new $_(t,this.config)}}A(z_,px,"PgBigSerial64Builder");var mx,gx;class $_ extends(gx=me,mx=L,gx){getSQLType(){return"bigserial"}mapFromDriverValue(t){return BigInt(t)}}A($_,mx,"PgBigSerial64");function ZD(e,t){const{name:n,config:r}=bt(e,t);return r.mode==="number"?new L_(n):new z_(n)}var vx,yx;class U_ extends(yx=Ae,vx=L,yx){constructor(t){super(t,"boolean","PgBoolean")}build(t){return new B_(t,this.config)}}A(U_,vx,"PgBooleanBuilder");var xx,wx;class B_ extends(wx=me,xx=L,wx){getSQLType(){return"boolean"}}A(B_,xx,"PgBoolean");function wm(e){return new U_(e??"")}var bx,Sx;class W_ extends(Sx=Ae,bx=L,Sx){constructor(t,n){super(t,"string","PgChar"),this.config.length=n.length,this.config.enumValues=n.enum}build(t){return new H_(t,this.config)}}A(W_,bx,"PgCharBuilder");var Nx,_x;class H_ extends(_x=me,Nx=L,_x){constructor(){super(...arguments);A(this,"length",this.config.length);A(this,"enumValues",this.config.enumValues)}getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}A(H_,Nx,"PgChar");function KD(e,t={}){const{name:n,config:r}=bt(e,t);return new W_(n,r)}var jx,Cx;class Q_ extends(Cx=Ae,jx=L,Cx){constructor(t){super(t,"string","PgCidr")}build(t){return new q_(t,this.config)}}A(Q_,jx,"PgCidrBuilder");var Ex,Tx;class q_ extends(Tx=me,Ex=L,Tx){getSQLType(){return"cidr"}}A(q_,Ex,"PgCidr");function GD(e){return new Q_(e??"")}var kx,Px;class Z_ extends(Px=Ae,kx=L,Px){constructor(t,n,r){super(t,"custom","PgCustomColumn"),this.config.fieldConfig=n,this.config.customTypeParams=r}build(t){return new K_(t,this.config)}}A(Z_,kx,"PgCustomColumnBuilder");var Ax,Rx;class K_ extends(Rx=me,Ax=L,Rx){constructor(n,r){super(n,r);A(this,"sqlName");A(this,"mapTo");A(this,"mapFrom");this.sqlName=r.customTypeParams.dataType(r.fieldConfig),this.mapTo=r.customTypeParams.toDriver,this.mapFrom=r.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(n){return typeof this.mapFrom=="function"?this.mapFrom(n):n}mapToDriverValue(n){return typeof this.mapTo=="function"?this.mapTo(n):n}}A(K_,Ax,"PgCustomColumn");function XD(e){return(t,n)=>{const{name:r,config:s}=bt(t,n);return new Z_(r,s,e)}}var Ix,Dx;class Jo extends(Dx=Ae,Ix=L,Dx){defaultNow(){return this.default(gu`now()`)}}A(Jo,Ix,"PgDateColumnBaseBuilder");var Ox,Mx;class G_ extends(Mx=Jo,Ox=L,Mx){constructor(t){super(t,"date","PgDate")}build(t){return new X_(t,this.config)}}A(G_,Ox,"PgDateBuilder");var Fx,Lx;class X_ extends(Lx=me,Fx=L,Lx){getSQLType(){return"date"}mapFromDriverValue(t){return new Date(t)}mapToDriverValue(t){return t.toISOString()}}A(X_,Fx,"PgDate");var Vx,zx;class Y_ extends(zx=Jo,Vx=L,zx){constructor(t){super(t,"string","PgDateString")}build(t){return new J_(t,this.config)}}A(Y_,Vx,"PgDateStringBuilder");var $x,Ux;class J_ extends(Ux=me,$x=L,Ux){getSQLType(){return"date"}}A(J_,$x,"PgDateString");function YD(e,t){const{name:n,config:r}=bt(e,t);return(r==null?void 0:r.mode)==="date"?new G_(n):new Y_(n)}var Bx,Wx;class ej extends(Wx=Ae,Bx=L,Wx){constructor(t){super(t,"number","PgDoublePrecision")}build(t){return new tj(t,this.config)}}A(ej,Bx,"PgDoublePrecisionBuilder");var Hx,Qx;class tj extends(Qx=me,Hx=L,Qx){getSQLType(){return"double precision"}mapFromDriverValue(t){return typeof t=="string"?Number.parseFloat(t):t}}A(tj,Hx,"PgDoublePrecision");function JD(e){return new ej(e??"")}var qx,Zx;class nj extends(Zx=Ae,qx=L,Zx){constructor(t){super(t,"string","PgInet")}build(t){return new rj(t,this.config)}}A(nj,qx,"PgInetBuilder");var Kx,Gx;class rj extends(Gx=me,Kx=L,Gx){getSQLType(){return"inet"}}A(rj,Kx,"PgInet");function eO(e){return new nj(e??"")}var Xx,Yx;class sj extends(Yx=Il,Xx=L,Yx){constructor(t){super(t,"number","PgInteger")}build(t){return new ij(t,this.config)}}A(sj,Xx,"PgIntegerBuilder");var Jx,e0;class ij extends(e0=me,Jx=L,e0){getSQLType(){return"integer"}mapFromDriverValue(t){return typeof t=="string"?Number.parseInt(t):t}}A(ij,Jx,"PgInteger");function Vo(e){return new sj(e??"")}var t0,n0;class oj extends(n0=Ae,t0=L,n0){constructor(t,n){super(t,"string","PgInterval"),this.config.intervalConfig=n}build(t){return new aj(t,this.config)}}A(oj,t0,"PgIntervalBuilder");var r0,s0;class aj extends(s0=me,r0=L,s0){constructor(){super(...arguments);A(this,"fields",this.config.intervalConfig.fields);A(this,"precision",this.config.intervalConfig.precision)}getSQLType(){const n=this.fields?` ${this.fields}`:"",r=this.precision?`(${this.precision})`:"";return`interval${n}${r}`}}A(aj,r0,"PgInterval");function tO(e,t={}){const{name:n,config:r}=bt(e,t);return new oj(n,r)}var i0,o0;class lj extends(o0=Ae,i0=L,o0){constructor(t){super(t,"json","PgJson")}build(t){return new cj(t,this.config)}}A(lj,i0,"PgJsonBuilder");var a0,l0;class cj extends(l0=me,a0=L,l0){constructor(t,n){super(t,n)}getSQLType(){return"json"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}}A(cj,a0,"PgJson");function nO(e){return new lj(e??"")}var c0,u0;class uj extends(u0=Ae,c0=L,u0){constructor(t){super(t,"json","PgJsonb")}build(t){return new dj(t,this.config)}}A(uj,c0,"PgJsonbBuilder");var d0,f0;class dj extends(f0=me,d0=L,f0){constructor(t,n){super(t,n)}getSQLType(){return"jsonb"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}}A(dj,d0,"PgJsonb");function fj(e){return new uj(e??"")}var p0,h0;class pj extends(h0=Ae,p0=L,h0){constructor(t){super(t,"array","PgLine")}build(t){return new hj(t,this.config)}}A(pj,p0,"PgLineBuilder");var m0,g0;class hj extends(g0=me,m0=L,g0){getSQLType(){return"line"}mapFromDriverValue(t){const[n,r,s]=t.slice(1,-1).split(",");return[Number.parseFloat(n),Number.parseFloat(r),Number.parseFloat(s)]}mapToDriverValue(t){return`{${t[0]},${t[1]},${t[2]}}`}}A(hj,m0,"PgLine");var v0,y0;class mj extends(y0=Ae,v0=L,y0){constructor(t){super(t,"json","PgLineABC")}build(t){return new gj(t,this.config)}}A(mj,v0,"PgLineABCBuilder");var x0,w0;class gj extends(w0=me,x0=L,w0){getSQLType(){return"line"}mapFromDriverValue(t){const[n,r,s]=t.slice(1,-1).split(",");return{a:Number.parseFloat(n),b:Number.parseFloat(r),c:Number.parseFloat(s)}}mapToDriverValue(t){return`{${t.a},${t.b},${t.c}}`}}A(gj,x0,"PgLineABC");function rO(e,t){const{name:n,config:r}=bt(e,t);return!(r!=null&&r.mode)||r.mode==="tuple"?new pj(n):new mj(n)}var b0,S0;class vj extends(S0=Ae,b0=L,S0){constructor(t){super(t,"string","PgMacaddr")}build(t){return new yj(t,this.config)}}A(vj,b0,"PgMacaddrBuilder");var N0,_0;class yj extends(_0=me,N0=L,_0){getSQLType(){return"macaddr"}}A(yj,N0,"PgMacaddr");function sO(e){return new vj(e??"")}var j0,C0;class xj extends(C0=Ae,j0=L,C0){constructor(t){super(t,"string","PgMacaddr8")}build(t){return new wj(t,this.config)}}A(xj,j0,"PgMacaddr8Builder");var E0,T0;class wj extends(T0=me,E0=L,T0){getSQLType(){return"macaddr8"}}A(wj,E0,"PgMacaddr8");function iO(e){return new xj(e??"")}var k0,P0;class bj extends(P0=Ae,k0=L,P0){constructor(t,n,r){super(t,"string","PgNumeric"),this.config.precision=n,this.config.scale=r}build(t){return new Sj(t,this.config)}}A(bj,k0,"PgNumericBuilder");var A0,R0;class Sj extends(R0=me,A0=L,R0){constructor(n,r){super(n,r);A(this,"precision");A(this,"scale");this.precision=r.precision,this.scale=r.scale}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}A(Sj,A0,"PgNumeric");function oO(e,t){const{name:n,config:r}=bt(e,t);return new bj(n,r==null?void 0:r.precision,r==null?void 0:r.scale)}var I0,D0;class Nj extends(D0=Ae,I0=L,D0){constructor(t){super(t,"array","PgPointTuple")}build(t){return new _j(t,this.config)}}A(Nj,I0,"PgPointTupleBuilder");var O0,M0;class _j extends(M0=me,O0=L,M0){getSQLType(){return"point"}mapFromDriverValue(t){if(typeof t=="string"){const[n,r]=t.slice(1,-1).split(",");return[Number.parseFloat(n),Number.parseFloat(r)]}return[t.x,t.y]}mapToDriverValue(t){return`(${t[0]},${t[1]})`}}A(_j,O0,"PgPointTuple");var F0,L0;class jj extends(L0=Ae,F0=L,L0){constructor(t){super(t,"json","PgPointObject")}build(t){return new Cj(t,this.config)}}A(jj,F0,"PgPointObjectBuilder");var V0,z0;class Cj extends(z0=me,V0=L,z0){getSQLType(){return"point"}mapFromDriverValue(t){if(typeof t=="string"){const[n,r]=t.slice(1,-1).split(",");return{x:Number.parseFloat(n),y:Number.parseFloat(r)}}return t}mapToDriverValue(t){return`(${t.x},${t.y})`}}A(Cj,V0,"PgPointObject");function aO(e,t){const{name:n,config:r}=bt(e,t);return!(r!=null&&r.mode)||r.mode==="tuple"?new Nj(n):new jj(n)}function lO(e){const t=[];for(let n=0;ntypeof n=="string"?Number.parseFloat(n):n)}getSQLType(){return"real"}}A(Ij,X0,"PgReal");function uO(e){return new Rj(e??"")}var J0,ew;class Dj extends(ew=Ae,J0=L,ew){constructor(t){super(t,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new Oj(t,this.config)}}A(Dj,J0,"PgSerialBuilder");var tw,nw;class Oj extends(nw=me,tw=L,nw){getSQLType(){return"serial"}}A(Oj,tw,"PgSerial");function Dl(e){return new Dj(e??"")}var rw,sw;class Mj extends(sw=Il,rw=L,sw){constructor(t){super(t,"number","PgSmallInt")}build(t){return new Fj(t,this.config)}}A(Mj,rw,"PgSmallIntBuilder");var iw,ow;class Fj extends(ow=me,iw=L,ow){constructor(){super(...arguments);A(this,"mapFromDriverValue",n=>typeof n=="string"?Number(n):n)}getSQLType(){return"smallint"}}A(Fj,iw,"PgSmallInt");function dO(e){return new Mj(e??"")}var aw,lw;class Lj extends(lw=Ae,aw=L,lw){constructor(t){super(t,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new Vj(t,this.config)}}A(Lj,aw,"PgSmallSerialBuilder");var cw,uw;class Vj extends(uw=me,cw=L,uw){getSQLType(){return"smallserial"}}A(Vj,cw,"PgSmallSerial");function fO(e){return new Lj(e??"")}var dw,fw;class zj extends(fw=Ae,dw=L,fw){constructor(t,n){super(t,"string","PgText"),this.config.enumValues=n.enum}build(t){return new $j(t,this.config)}}A(zj,dw,"PgTextBuilder");var pw,hw;class $j extends(hw=me,pw=L,hw){constructor(){super(...arguments);A(this,"enumValues",this.config.enumValues)}getSQLType(){return"text"}}A($j,pw,"PgText");function Ma(e,t={}){const{name:n,config:r}=bt(e,t);return new zj(n,r)}var mw,gw;class Uj extends(gw=Jo,mw=L,gw){constructor(t,n,r){super(t,"string","PgTime"),this.withTimezone=n,this.precision=r,this.config.withTimezone=n,this.config.precision=r}build(t){return new Bj(t,this.config)}}A(Uj,mw,"PgTimeBuilder");var vw,yw;class Bj extends(yw=me,vw=L,yw){constructor(n,r){super(n,r);A(this,"withTimezone");A(this,"precision");this.withTimezone=r.withTimezone,this.precision=r.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}A(Bj,vw,"PgTime");function pO(e,t={}){const{name:n,config:r}=bt(e,t);return new Uj(n,r.withTimezone??!1,r.precision)}var xw,ww;class Wj extends(ww=Jo,xw=L,ww){constructor(t,n,r){super(t,"date","PgTimestamp"),this.config.withTimezone=n,this.config.precision=r}build(t){return new Hj(t,this.config)}}A(Wj,xw,"PgTimestampBuilder");var bw,Sw;class Hj extends(Sw=me,bw=L,Sw){constructor(n,r){super(n,r);A(this,"withTimezone");A(this,"precision");A(this,"mapFromDriverValue",n=>new Date(this.withTimezone?n:n+"+0000"));A(this,"mapToDriverValue",n=>n.toISOString());this.withTimezone=r.withTimezone,this.precision=r.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}}A(Hj,bw,"PgTimestamp");var Nw,_w;class Qj extends(_w=Jo,Nw=L,_w){constructor(t,n,r){super(t,"string","PgTimestampString"),this.config.withTimezone=n,this.config.precision=r}build(t){return new qj(t,this.config)}}A(Qj,Nw,"PgTimestampStringBuilder");var jw,Cw;class qj extends(Cw=me,jw=L,Cw){constructor(n,r){super(n,r);A(this,"withTimezone");A(this,"precision");this.withTimezone=r.withTimezone,this.precision=r.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}A(qj,jw,"PgTimestampString");function Ns(e,t={}){const{name:n,config:r}=bt(e,t);return(r==null?void 0:r.mode)==="string"?new Qj(n,r.withTimezone??!1,r.precision):new Wj(n,(r==null?void 0:r.withTimezone)??!1,r==null?void 0:r.precision)}var Ew,Tw;class Zj extends(Tw=Ae,Ew=L,Tw){constructor(t){super(t,"string","PgUUID")}defaultRandom(){return this.default(gu`gen_random_uuid()`)}build(t){return new Kj(t,this.config)}}A(Zj,Ew,"PgUUIDBuilder");var kw,Pw;class Kj extends(Pw=me,kw=L,Pw){getSQLType(){return"uuid"}}A(Kj,kw,"PgUUID");function hO(e){return new Zj(e??"")}var Aw,Rw;class Gj extends(Rw=Ae,Aw=L,Rw){constructor(t,n){super(t,"string","PgVarchar"),this.config.length=n.length,this.config.enumValues=n.enum}build(t){return new Xj(t,this.config)}}A(Gj,Aw,"PgVarcharBuilder");var Iw,Dw;class Xj extends(Dw=me,Iw=L,Dw){constructor(){super(...arguments);A(this,"length",this.config.length);A(this,"enumValues",this.config.enumValues)}getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}A(Xj,Iw,"PgVarchar");function qe(e,t={}){const{name:n,config:r}=bt(e,t);return new Gj(n,r)}var Ow,Mw;class Yj extends(Mw=Ae,Ow=L,Mw){constructor(t,n){super(t,"string","PgBinaryVector"),this.config.dimensions=n.dimensions}build(t){return new Jj(t,this.config)}}A(Yj,Ow,"PgBinaryVectorBuilder");var Fw,Lw;class Jj extends(Lw=me,Fw=L,Lw){constructor(){super(...arguments);A(this,"dimensions",this.config.dimensions)}getSQLType(){return`bit(${this.dimensions})`}}A(Jj,Fw,"PgBinaryVector");function mO(e,t){const{name:n,config:r}=bt(e,t);return new Yj(n,r)}var Vw,zw;class eC extends(zw=Ae,Vw=L,zw){constructor(t,n){super(t,"array","PgHalfVector"),this.config.dimensions=n.dimensions}build(t){return new tC(t,this.config)}}A(eC,Vw,"PgHalfVectorBuilder");var $w,Uw;class tC extends(Uw=me,$w=L,Uw){constructor(){super(...arguments);A(this,"dimensions",this.config.dimensions)}getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(n){return JSON.stringify(n)}mapFromDriverValue(n){return n.slice(1,-1).split(",").map(r=>Number.parseFloat(r))}}A(tC,$w,"PgHalfVector");function gO(e,t){const{name:n,config:r}=bt(e,t);return new eC(n,r)}var Bw,Ww;class nC extends(Ww=Ae,Bw=L,Ww){constructor(t,n){super(t,"string","PgSparseVector"),this.config.dimensions=n.dimensions}build(t){return new rC(t,this.config)}}A(nC,Bw,"PgSparseVectorBuilder");var Hw,Qw;class rC extends(Qw=me,Hw=L,Qw){constructor(){super(...arguments);A(this,"dimensions",this.config.dimensions)}getSQLType(){return`sparsevec(${this.dimensions})`}}A(rC,Hw,"PgSparseVector");function vO(e,t){const{name:n,config:r}=bt(e,t);return new nC(n,r)}var qw,Zw;class sC extends(Zw=Ae,qw=L,Zw){constructor(t,n){super(t,"array","PgVector"),this.config.dimensions=n.dimensions}build(t){return new iC(t,this.config)}}A(sC,qw,"PgVectorBuilder");var Kw,Gw;class iC extends(Gw=me,Kw=L,Gw){constructor(){super(...arguments);A(this,"dimensions",this.config.dimensions)}getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(n){return JSON.stringify(n)}mapFromDriverValue(n){return n.slice(1,-1).split(",").map(r=>Number.parseFloat(r))}}A(iC,Kw,"PgVector");function yO(e,t){const{name:n,config:r}=bt(e,t);return new sC(n,r)}function xO(){return{bigint:qD,bigserial:ZD,boolean:wm,char:KD,cidr:GD,customType:XD,date:YD,doublePrecision:JD,inet:eO,integer:Vo,interval:tO,json:nO,jsonb:fj,line:rO,macaddr:sO,macaddr8:iO,numeric:oO,point:aO,geometry:cO,real:uO,serial:Dl,smallint:dO,smallserial:fO,text:Ma,time:pO,timestamp:Ns,uuid:hO,varchar:qe,bit:mO,halfvec:gO,sparsevec:vO,vector:yO}}const Fp=Symbol.for("drizzle:PgInlineForeignKeys"),Hv=Symbol.for("drizzle:EnableRLS");var Xw,Yw,Jw,eb,tb;class Fa extends(tb=ln,eb=L,Jw=Fp,Yw=Hv,Xw=ln.Symbol.ExtraConfigBuilder,tb){constructor(){super(...arguments);A(this,Jw,[]);A(this,Yw,!1);A(this,Xw)}}A(Fa,eb,"PgTable"),A(Fa,"Symbol",Object.assign({},ln.Symbol,{InlineForeignKeys:Fp,EnableRLS:Hv}));function wO(e,t,n,r,s=e){const i=new Fa(e,r,s),o=typeof t=="function"?t(xO()):t,l=Object.fromEntries(Object.entries(o).map(([d,f])=>{const p=f;p.setName(d);const y=p.build(i);return i[Fp].push(...p.buildForeignKeys(y,i)),[d,y]})),c=Object.fromEntries(Object.entries(o).map(([d,f])=>{const p=f;p.setName(d);const y=p.buildExtraConfigColumn(i);return[d,y]})),u=Object.assign(i,l);return u[ln.Symbol.Columns]=l,u[ln.Symbol.ExtraConfigColumns]=c,n&&(u[Fa.Symbol.ExtraConfigBuilder]=n),Object.assign(u,{enableRLS:()=>(u[Fa.Symbol.EnableRLS]=!0,u)})}const Ol=(e,t,n)=>wO(e,t,n,void 0);var nb;nb=L;class oC{constructor(t,n){this.unique=t,this.name=n}on(...t){return new Pc(t.map(n=>{if(ft(n,it))return n;n=n;const r=new kc(n.name,!!n.keyAsName,n.columnType,n.indexConfig);return n.indexConfig=JSON.parse(JSON.stringify(n.defaultConfig)),r}),this.unique,!1,this.name)}onOnly(...t){return new Pc(t.map(n=>{if(ft(n,it))return n;n=n;const r=new kc(n.name,!!n.keyAsName,n.columnType,n.indexConfig);return n.indexConfig=n.defaultConfig,r}),this.unique,!0,this.name)}using(t,...n){return new Pc(n.map(r=>{if(ft(r,it))return r;r=r;const s=new kc(r.name,!!r.keyAsName,r.columnType,r.indexConfig);return r.indexConfig=JSON.parse(JSON.stringify(r.defaultConfig)),s}),this.unique,!0,this.name,t)}}A(oC,nb,"PgIndexBuilderOn");var rb;rb=L;class Pc{constructor(t,n,r,s,i="btree"){A(this,"config");this.config={name:s,columns:t,unique:n,only:r,method:i}}concurrently(){return this.config.concurrently=!0,this}with(t){return this.config.with=t,this}where(t){return this.config.where=t,this}build(t){return new aC(this.config,t)}}A(Pc,rb,"PgIndexBuilder");var sb;sb=L;class aC{constructor(t,n){A(this,"config");this.config={...t,table:n}}}A(aC,sb,"PgIndex");function bO(e){return new oC(!1,e)}var Pe;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of i)o[l]=s[l];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Pe||(Pe={}));var Lp;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Lp||(Lp={}));const G=Pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yr=e=>{switch(typeof e){case"undefined":return G.undefined;case"string":return G.string;case"number":return isNaN(e)?G.nan:G.number;case"boolean":return G.boolean;case"function":return G.function;case"bigint":return G.bigint;case"symbol":return G.symbol;case"object":return Array.isArray(e)?G.array:e===null?G.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?G.promise:typeof Map<"u"&&e instanceof Map?G.map:typeof Set<"u"&&e instanceof Set?G.set:typeof Date<"u"&&e instanceof Date?G.date:G.object;default:return G.unknown}},V=Pe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),SO=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class fn extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,c=0;for(;cn.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}fn.create=e=>new fn(e);const zo=(e,t)=>{let n;switch(e.code){case V.invalid_type:e.received===G.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Pe.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${Pe.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Pe.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${Pe.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Pe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case V.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case V.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=t.defaultError,Pe.assertNever(e)}return{message:n}};let lC=zo;function NO(e){lC=e}function yu(){return lC}const xu=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(o,{data:t,defaultError:l}).message;return{...s,path:i,message:l}},_O=[];function Z(e,t){const n=yu(),r=xu({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===zo?void 0:zo].filter(s=>!!s)});e.common.issues.push(r)}class Dt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return fe;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return Dt.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return fe;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const fe=Object.freeze({status:"aborted"}),Vi=e=>({status:"dirty",value:e}),$t=e=>({status:"valid",value:e}),Vp=e=>e.status==="aborted",zp=e=>e.status==="dirty",li=e=>e.status==="valid",sl=e=>typeof Promise<"u"&&e instanceof Promise;function wu(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function cC(e,t,n,r,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var ne;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ne||(ne={}));var xa,wa;class cr{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Qv=(e,t)=>{if(li(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new fn(e.common.issues);return this._error=n,this._error}}};function he(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,l)=>{var c,u;const{message:d}=e;return o.code==="invalid_enum_value"?{message:d??l.defaultError}:typeof l.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:l.defaultError}},description:s}}class Ne{get description(){return this._def.description}_getType(t){return yr(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:yr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Dt,ctx:{common:t.parent.common,data:t.data,parsedType:yr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(sl(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:yr(t)},i=this._parseSync({data:t,path:s.path,parent:s});return Qv(s,i)}"~validate"(t){var n,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:yr(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:s});return li(i)?{value:i.value}:{issues:s.common.issues}}catch(i){!((r=(n=i==null?void 0:i.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:s}).then(i=>li(i)?{value:i.value}:{issues:s.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:yr(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(sl(s)?s:Promise.resolve(s));return Qv(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),l=()=>i.addIssue({code:V.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new $n({schema:this,typeName:de.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ar.create(this,this._def)}nullable(){return Es.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fn.create(this)}promise(){return Uo.create(this,this._def)}or(t){return ll.create([this,t],this._def)}and(t){return cl.create(this,t,this._def)}transform(t){return new $n({...he(this._def),schema:this,typeName:de.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new hl({...he(this._def),innerType:this,defaultValue:n,typeName:de.ZodDefault})}brand(){return new bm({typeName:de.ZodBranded,type:this,...he(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new ml({...he(this._def),innerType:this,catchValue:n,typeName:de.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Ml.create(this,t)}readonly(){return gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const jO=/^c[^\s-]{8,}$/i,CO=/^[0-9a-z]+$/,EO=/^[0-9A-HJKMNP-TV-Z]{26}$/i,TO=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kO=/^[a-z0-9_-]{21}$/i,PO=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,AO=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,RO=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,IO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let rf;const DO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,OO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,MO=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,FO=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,LO=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,VO=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,uC="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",zO=new RegExp(`^${uC}$`);function dC(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function $O(e){return new RegExp(`^${dC(e)}$`)}function fC(e){let t=`${uC}T${dC(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function UO(e,t){return!!((t==="v4"||!t)&&DO.test(e)||(t==="v6"||!t)&&MO.test(e))}function BO(e,t){if(!PO.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||t&&s.alg!==t)}catch{return!1}}function WO(e,t){return!!((t==="v4"||!t)&&OO.test(e)||(t==="v6"||!t)&&FO.test(e))}class Dn extends Ne{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==G.string){const i=this._getOrReturnCtx(t);return Z(i,{code:V.invalid_type,expected:G.string,received:i.parsedType}),fe}const r=new Dt;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.lengthi.value&&(s=this._getOrReturnCtx(t,s),Z(s,{code:V.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,l=t.data.lengtht.test(s),{validation:n,code:V.invalid_string,...ne.errToObj(r)})}_addCheck(t){return new Dn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ne.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ne.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ne.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ne.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ne.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ne.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ne.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ne.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ne.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ne.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ne.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ne.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ne.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...ne.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ne.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ne.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ne.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ne.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ne.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ne.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ne.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ne.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ne.errToObj(n)})}nonempty(t){return this.min(1,ne.errToObj(t))}trim(){return new Dn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Dn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Dn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Dn({checks:[],typeName:de.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...he(e)})};function HO(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=parseInt(e.toFixed(s).replace(".","")),o=parseInt(t.toFixed(s).replace(".",""));return i%o/Math.pow(10,s)}class _s extends Ne{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==G.number){const i=this._getOrReturnCtx(t);return Z(i,{code:V.invalid_type,expected:G.number,received:i.parsedType}),fe}let r;const s=new Dt;for(const i of this._def.checks)i.kind==="int"?Pe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Z(r,{code:V.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:V.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?HO(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Z(r,{code:V.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Z(r,{code:V.not_finite,message:i.message}),s.dirty()):Pe.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ne.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ne.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ne.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ne.toString(n))}setLimit(t,n,r,s){return new _s({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ne.toString(s)}]})}_addCheck(t){return new _s({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ne.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ne.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ne.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Pe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew _s({checks:[],typeName:de.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...he(e)});class js extends Ne{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==G.bigint)return this._getInvalidInput(t);let r;const s=new Dt;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:V.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:V.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Pe.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return Z(n,{code:V.invalid_type,expected:G.bigint,received:n.parsedType}),fe}gte(t,n){return this.setLimit("min",t,!0,ne.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ne.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ne.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ne.toString(n))}setLimit(t,n,r,s){return new js({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ne.toString(s)}]})}_addCheck(t){return new js({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ne.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new js({checks:[],typeName:de.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...he(e)})};class il extends Ne{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==G.boolean){const r=this._getOrReturnCtx(t);return Z(r,{code:V.invalid_type,expected:G.boolean,received:r.parsedType}),fe}return $t(t.data)}}il.create=e=>new il({typeName:de.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...he(e)});class ci extends Ne{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==G.date){const i=this._getOrReturnCtx(t);return Z(i,{code:V.invalid_type,expected:G.date,received:i.parsedType}),fe}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return Z(i,{code:V.invalid_date}),fe}const r=new Dt;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()i.value&&(s=this._getOrReturnCtx(t,s),Z(s,{code:V.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Pe.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new ci({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ne.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ne.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew ci({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:de.ZodDate,...he(e)});class bu extends Ne{_parse(t){if(this._getType(t)!==G.symbol){const r=this._getOrReturnCtx(t);return Z(r,{code:V.invalid_type,expected:G.symbol,received:r.parsedType}),fe}return $t(t.data)}}bu.create=e=>new bu({typeName:de.ZodSymbol,...he(e)});class ol extends Ne{_parse(t){if(this._getType(t)!==G.undefined){const r=this._getOrReturnCtx(t);return Z(r,{code:V.invalid_type,expected:G.undefined,received:r.parsedType}),fe}return $t(t.data)}}ol.create=e=>new ol({typeName:de.ZodUndefined,...he(e)});class al extends Ne{_parse(t){if(this._getType(t)!==G.null){const r=this._getOrReturnCtx(t);return Z(r,{code:V.invalid_type,expected:G.null,received:r.parsedType}),fe}return $t(t.data)}}al.create=e=>new al({typeName:de.ZodNull,...he(e)});class $o extends Ne{constructor(){super(...arguments),this._any=!0}_parse(t){return $t(t.data)}}$o.create=e=>new $o({typeName:de.ZodAny,...he(e)});class Js extends Ne{constructor(){super(...arguments),this._unknown=!0}_parse(t){return $t(t.data)}}Js.create=e=>new Js({typeName:de.ZodUnknown,...he(e)});class Rr extends Ne{_parse(t){const n=this._getOrReturnCtx(t);return Z(n,{code:V.invalid_type,expected:G.never,received:n.parsedType}),fe}}Rr.create=e=>new Rr({typeName:de.ZodNever,...he(e)});class Su extends Ne{_parse(t){if(this._getType(t)!==G.undefined){const r=this._getOrReturnCtx(t);return Z(r,{code:V.invalid_type,expected:G.void,received:r.parsedType}),fe}return $t(t.data)}}Su.create=e=>new Su({typeName:de.ZodVoid,...he(e)});class Fn extends Ne{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==G.array)return Z(n,{code:V.invalid_type,expected:G.array,received:n.parsedType}),fe;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.lengths.maxLength.value&&(Z(n,{code:V.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new cr(n,o,n.path,l)))).then(o=>Dt.mergeArray(r,o));const i=[...n.data].map((o,l)=>s.type._parseSync(new cr(n,o,n.path,l)));return Dt.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Fn({...this._def,minLength:{value:t,message:ne.toString(n)}})}max(t,n){return new Fn({...this._def,maxLength:{value:t,message:ne.toString(n)}})}length(t,n){return new Fn({...this._def,exactLength:{value:t,message:ne.toString(n)}})}nonempty(t){return this.min(1,t)}}Fn.create=(e,t)=>new Fn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:de.ZodArray,...he(t)});function Ni(e){if(e instanceof Xe){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ar.create(Ni(r))}return new Xe({...e._def,shape:()=>t})}else return e instanceof Fn?new Fn({...e._def,type:Ni(e.element)}):e instanceof ar?ar.create(Ni(e.unwrap())):e instanceof Es?Es.create(Ni(e.unwrap())):e instanceof ur?ur.create(e.items.map(t=>Ni(t))):e}class Xe extends Ne{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Pe.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==G.object){const u=this._getOrReturnCtx(t);return Z(u,{code:V.invalid_type,expected:G.object,received:u.parsedType}),fe}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Rr&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=i[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new cr(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Rr){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")l.length>0&&(Z(s,{code:V.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new cr(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>Dt.mergeObjectSync(r,u)):Dt.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return ne.errToObj,new Xe({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,i,o,l;const c=(o=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,n,r).message)!==null&&o!==void 0?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=ne.errToObj(t).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new Xe({...this._def,unknownKeys:"strip"})}passthrough(){return new Xe({...this._def,unknownKeys:"passthrough"})}extend(t){return new Xe({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Xe({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:de.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Xe({...this._def,catchall:t})}pick(t){const n={};return Pe.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Xe({...this._def,shape:()=>n})}omit(t){const n={};return Pe.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Xe({...this._def,shape:()=>n})}deepPartial(){return Ni(this)}partial(t){const n={};return Pe.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}),new Xe({...this._def,shape:()=>n})}required(t){const n={};return Pe.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ar;)i=i._def.innerType;n[r]=i}}),new Xe({...this._def,shape:()=>n})}keyof(){return pC(Pe.objectKeys(this.shape))}}Xe.create=(e,t)=>new Xe({shape:()=>e,unknownKeys:"strip",catchall:Rr.create(),typeName:de.ZodObject,...he(t)});Xe.strictCreate=(e,t)=>new Xe({shape:()=>e,unknownKeys:"strict",catchall:Rr.create(),typeName:de.ZodObject,...he(t)});Xe.lazycreate=(e,t)=>new Xe({shape:e,unknownKeys:"strip",catchall:Rr.create(),typeName:de.ZodObject,...he(t)});class ll extends Ne{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new fn(l.ctx.common.issues));return Z(n,{code:V.invalid_union,unionErrors:o}),fe}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(c=>new fn(c));return Z(n,{code:V.invalid_union,unionErrors:l}),fe}}get options(){return this._def.options}}ll.create=(e,t)=>new ll({options:e,typeName:de.ZodUnion,...he(t)});const mr=e=>e instanceof dl?mr(e.schema):e instanceof $n?mr(e.innerType()):e instanceof fl?[e.value]:e instanceof Cs?e.options:e instanceof pl?Pe.objectValues(e.enum):e instanceof hl?mr(e._def.innerType):e instanceof ol?[void 0]:e instanceof al?[null]:e instanceof ar?[void 0,...mr(e.unwrap())]:e instanceof Es?[null,...mr(e.unwrap())]:e instanceof bm||e instanceof gl?mr(e.unwrap()):e instanceof ml?mr(e._def.innerType):[];class ed extends Ne{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==G.object)return Z(n,{code:V.invalid_type,expected:G.object,received:n.parsedType}),fe;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Z(n,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),fe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const s=new Map;for(const i of n){const o=mr(i.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of o){if(s.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);s.set(l,i)}}return new ed({typeName:de.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...he(r)})}}function $p(e,t){const n=yr(e),r=yr(t);if(e===t)return{valid:!0,data:e};if(n===G.object&&r===G.object){const s=Pe.objectKeys(t),i=Pe.objectKeys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of i){const c=$p(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===G.array&&r===G.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i{if(Vp(i)||Vp(o))return fe;const l=$p(i.value,o.value);return l.valid?((zp(i)||zp(o))&&n.dirty(),{status:n.value,value:l.data}):(Z(r,{code:V.invalid_intersection_types}),fe)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}cl.create=(e,t,n)=>new cl({left:e,right:t,typeName:de.ZodIntersection,...he(n)});class ur extends Ne{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==G.array)return Z(r,{code:V.invalid_type,expected:G.array,received:r.parsedType}),fe;if(r.data.lengththis._def.items.length&&(Z(r,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new cr(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Dt.mergeArray(n,o)):Dt.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new ur({...this._def,rest:t})}}ur.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ur({items:e,typeName:de.ZodTuple,rest:null,...he(t)})};class ul extends Ne{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==G.object)return Z(r,{code:V.invalid_type,expected:G.object,received:r.parsedType}),fe;const s=[],i=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:i._parse(new cr(r,l,r.path,l)),value:o._parse(new cr(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?Dt.mergeObjectAsync(n,s):Dt.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ne?new ul({keyType:t,valueType:n,typeName:de.ZodRecord,...he(r)}):new ul({keyType:Dn.create(),valueType:t,typeName:de.ZodRecord,...he(n)})}}class Nu extends Ne{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==G.map)return Z(r,{code:V.invalid_type,expected:G.map,received:r.parsedType}),fe;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([l,c],u)=>({key:s._parse(new cr(r,l,r.path,[u,"key"])),value:i._parse(new cr(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return fe;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return fe;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}Nu.create=(e,t,n)=>new Nu({valueType:t,keyType:e,typeName:de.ZodMap,...he(n)});class ui extends Ne{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==G.set)return Z(r,{code:V.invalid_type,expected:G.set,received:r.parsedType}),fe;const s=this._def;s.minSize!==null&&r.data.sizes.maxSize.value&&(Z(r,{code:V.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return fe;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>i._parse(new cr(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,n){return new ui({...this._def,minSize:{value:t,message:ne.toString(n)}})}max(t,n){return new ui({...this._def,maxSize:{value:t,message:ne.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}ui.create=(e,t)=>new ui({valueType:e,minSize:null,maxSize:null,typeName:de.ZodSet,...he(t)});class lo extends Ne{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==G.function)return Z(n,{code:V.invalid_type,expected:G.function,received:n.parsedType}),fe;function r(l,c){return xu({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,yu(),zo].filter(u=>!!u),issueData:{code:V.invalid_arguments,argumentsError:c}})}function s(l,c){return xu({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,yu(),zo].filter(u=>!!u),issueData:{code:V.invalid_return_type,returnTypeError:c}})}const i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof Uo){const l=this;return $t(async function(...c){const u=new fn([]),d=await l._def.args.parseAsync(c,i).catch(y=>{throw u.addIssue(r(c,y)),u}),f=await Reflect.apply(o,this,d);return await l._def.returns._def.type.parseAsync(f,i).catch(y=>{throw u.addIssue(s(f,y)),u})})}else{const l=this;return $t(function(...c){const u=l._def.args.safeParse(c,i);if(!u.success)throw new fn([r(c,u.error)]);const d=Reflect.apply(o,this,u.data),f=l._def.returns.safeParse(d,i);if(!f.success)throw new fn([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new lo({...this._def,args:ur.create(t).rest(Js.create())})}returns(t){return new lo({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new lo({args:t||ur.create([]).rest(Js.create()),returns:n||Js.create(),typeName:de.ZodFunction,...he(r)})}}class dl extends Ne{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}dl.create=(e,t)=>new dl({getter:e,typeName:de.ZodLazy,...he(t)});class fl extends Ne{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Z(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),fe}return{status:"valid",value:t.data}}get value(){return this._def.value}}fl.create=(e,t)=>new fl({value:e,typeName:de.ZodLiteral,...he(t)});function pC(e,t){return new Cs({values:e,typeName:de.ZodEnum,...he(t)})}class Cs extends Ne{constructor(){super(...arguments),xa.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Z(n,{expected:Pe.joinValues(r),received:n.parsedType,code:V.invalid_type}),fe}if(wu(this,xa)||cC(this,xa,new Set(this._def.values)),!wu(this,xa).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return Z(n,{received:n.data,code:V.invalid_enum_value,options:r}),fe}return $t(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Cs.create(t,{...this._def,...n})}exclude(t,n=this._def){return Cs.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}xa=new WeakMap;Cs.create=pC;class pl extends Ne{constructor(){super(...arguments),wa.set(this,void 0)}_parse(t){const n=Pe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==G.string&&r.parsedType!==G.number){const s=Pe.objectValues(n);return Z(r,{expected:Pe.joinValues(s),received:r.parsedType,code:V.invalid_type}),fe}if(wu(this,wa)||cC(this,wa,new Set(Pe.getValidEnumValues(this._def.values))),!wu(this,wa).has(t.data)){const s=Pe.objectValues(n);return Z(r,{received:r.data,code:V.invalid_enum_value,options:s}),fe}return $t(t.data)}get enum(){return this._def.values}}wa=new WeakMap;pl.create=(e,t)=>new pl({values:e,typeName:de.ZodNativeEnum,...he(t)});class Uo extends Ne{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==G.promise&&n.common.async===!1)return Z(n,{code:V.invalid_type,expected:G.promise,received:n.parsedType}),fe;const r=n.parsedType===G.promise?n.data:Promise.resolve(n.data);return $t(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Uo.create=(e,t)=>new Uo({type:e,typeName:de.ZodPromise,...he(t)});class $n extends Ne{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===de.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{Z(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return fe;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?fe:c.status==="dirty"||n.value==="dirty"?Vi(c.value):c});{if(n.value==="aborted")return fe;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?fe:l.status==="dirty"||n.value==="dirty"?Vi(l.value):l}}if(s.type==="refinement"){const o=l=>{const c=s.refinement(l,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?fe:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?fe:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!li(o))return o;const l=s.transform(o.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>li(o)?Promise.resolve(s.transform(o.value,i)).then(l=>({status:n.value,value:l})):o);Pe.assertNever(s)}}$n.create=(e,t,n)=>new $n({schema:e,typeName:de.ZodEffects,effect:t,...he(n)});$n.createWithPreprocess=(e,t,n)=>new $n({schema:t,effect:{type:"preprocess",transform:e},typeName:de.ZodEffects,...he(n)});class ar extends Ne{_parse(t){return this._getType(t)===G.undefined?$t(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ar.create=(e,t)=>new ar({innerType:e,typeName:de.ZodOptional,...he(t)});class Es extends Ne{_parse(t){return this._getType(t)===G.null?$t(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Es.create=(e,t)=>new Es({innerType:e,typeName:de.ZodNullable,...he(t)});class hl extends Ne{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===G.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}hl.create=(e,t)=>new hl({innerType:e,typeName:de.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...he(t)});class ml extends Ne{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return sl(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new fn(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new fn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ml.create=(e,t)=>new ml({innerType:e,typeName:de.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...he(t)});class _u extends Ne{_parse(t){if(this._getType(t)!==G.nan){const r=this._getOrReturnCtx(t);return Z(r,{code:V.invalid_type,expected:G.nan,received:r.parsedType}),fe}return{status:"valid",value:t.data}}}_u.create=e=>new _u({typeName:de.ZodNaN,...he(e)});const QO=Symbol("zod_brand");class bm extends Ne{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Ml extends Ne{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?fe:i.status==="dirty"?(n.dirty(),Vi(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?fe:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Ml({in:t,out:n,typeName:de.ZodPipeline})}}class gl extends Ne{_parse(t){const n=this._def.innerType._parse(t),r=s=>(li(s)&&(s.value=Object.freeze(s.value)),s);return sl(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}gl.create=(e,t)=>new gl({innerType:e,typeName:de.ZodReadonly,...he(t)});function qv(e,t){const n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function hC(e,t={},n){return e?$o.create().superRefine((r,s)=>{var i,o;const l=e(r);if(l instanceof Promise)return l.then(c=>{var u,d;if(!c){const f=qv(t,r),p=(d=(u=f.fatal)!==null&&u!==void 0?u:n)!==null&&d!==void 0?d:!0;s.addIssue({code:"custom",...f,fatal:p})}});if(!l){const c=qv(t,r),u=(o=(i=c.fatal)!==null&&i!==void 0?i:n)!==null&&o!==void 0?o:!0;s.addIssue({code:"custom",...c,fatal:u})}}):$o.create()}const qO={object:Xe.lazycreate};var de;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(de||(de={}));const ZO=(e,t={message:`Input not instance of ${e.name}`})=>hC(n=>n instanceof e,t),mC=Dn.create,gC=_s.create,KO=_u.create,GO=js.create,vC=il.create,XO=ci.create,YO=bu.create,JO=ol.create,eM=al.create,tM=$o.create,nM=Js.create,rM=Rr.create,sM=Su.create,iM=Fn.create,oM=Xe.create,aM=Xe.strictCreate,lM=ll.create,cM=ed.create,uM=cl.create,dM=ur.create,fM=ul.create,pM=Nu.create,hM=ui.create,mM=lo.create,gM=dl.create,vM=fl.create,yM=Cs.create,xM=pl.create,wM=Uo.create,Zv=$n.create,bM=ar.create,SM=Es.create,NM=$n.createWithPreprocess,_M=Ml.create,jM=()=>mC().optional(),CM=()=>gC().optional(),EM=()=>vC().optional(),TM={string:e=>Dn.create({...e,coerce:!0}),number:e=>_s.create({...e,coerce:!0}),boolean:e=>il.create({...e,coerce:!0}),bigint:e=>js.create({...e,coerce:!0}),date:e=>ci.create({...e,coerce:!0})},kM=fe;var st=Object.freeze({__proto__:null,defaultErrorMap:zo,setErrorMap:NO,getErrorMap:yu,makeIssue:xu,EMPTY_PATH:_O,addIssueToContext:Z,ParseStatus:Dt,INVALID:fe,DIRTY:Vi,OK:$t,isAborted:Vp,isDirty:zp,isValid:li,isAsync:sl,get util(){return Pe},get objectUtil(){return Lp},ZodParsedType:G,getParsedType:yr,ZodType:Ne,datetimeRegex:fC,ZodString:Dn,ZodNumber:_s,ZodBigInt:js,ZodBoolean:il,ZodDate:ci,ZodSymbol:bu,ZodUndefined:ol,ZodNull:al,ZodAny:$o,ZodUnknown:Js,ZodNever:Rr,ZodVoid:Su,ZodArray:Fn,ZodObject:Xe,ZodUnion:ll,ZodDiscriminatedUnion:ed,ZodIntersection:cl,ZodTuple:ur,ZodRecord:ul,ZodMap:Nu,ZodSet:ui,ZodFunction:lo,ZodLazy:dl,ZodLiteral:fl,ZodEnum:Cs,ZodNativeEnum:pl,ZodPromise:Uo,ZodEffects:$n,ZodTransformer:$n,ZodOptional:ar,ZodNullable:Es,ZodDefault:hl,ZodCatch:ml,ZodNaN:_u,BRAND:QO,ZodBranded:bm,ZodPipeline:Ml,ZodReadonly:gl,custom:hC,Schema:Ne,ZodSchema:Ne,late:qO,get ZodFirstPartyTypeKind(){return de},coerce:TM,any:tM,array:iM,bigint:GO,boolean:vC,date:XO,discriminatedUnion:cM,effect:Zv,enum:yM,function:mM,instanceof:ZO,intersection:uM,lazy:gM,literal:vM,map:pM,nan:KO,nativeEnum:xM,never:rM,null:eM,nullable:SM,number:gC,object:oM,oboolean:EM,onumber:CM,optional:bM,ostring:jM,pipeline:_M,preprocess:NM,promise:wM,record:fM,set:hM,strictObject:aM,string:mC,symbol:YO,transformer:Zv,tuple:dM,undefined:JO,union:lM,unknown:nM,void:sM,NEVER:kM,ZodIssueCode:V,quotelessJson:SO,ZodError:fn});const Ge={INT8_MIN:-128,INT8_MAX:127,INT8_UNSIGNED_MAX:255,INT16_MIN:-32768,INT16_MAX:32767,INT16_UNSIGNED_MAX:65535,INT24_MIN:-8388608,INT24_MAX:8388607,INT24_UNSIGNED_MAX:16777215,INT32_MIN:-2147483648,INT32_MAX:2147483647,INT32_UNSIGNED_MAX:4294967295,INT48_MIN:-0x800000000000,INT48_MAX:0x7fffffffffff,INT48_UNSIGNED_MAX:0xffffffffffff,INT64_MIN:-9223372036854775808n,INT64_MAX:9223372036854775807n,INT64_UNSIGNED_MAX:18446744073709551615n};function ot(e,t){return t.includes(e.columnType)}function PM(e){return"enumValues"in e&&Array.isArray(e.enumValues)&&e.enumValues.length>0}const AM=st.union([st.string(),st.number(),st.boolean(),st.null()]),RM=st.union([AM,st.record(st.any()),st.array(st.any())]),IM=st.custom(e=>e instanceof Buffer);function yC(e,t){const n=(t==null?void 0:t.zodInstance)??st,r=(t==null?void 0:t.coerce)??{};let s;return PM(e)&&(s=e.enumValues.length?n.enum(e.enumValues):n.string()),s||(ot(e,["PgGeometry","PgPointTuple"])?s=n.tuple([n.number(),n.number()]):ot(e,["PgGeometryObject","PgPointObject"])?s=n.object({x:n.number(),y:n.number()}):ot(e,["PgHalfVector","PgVector"])?(s=n.array(n.number()),s=e.dimensions?s.length(e.dimensions):s):ot(e,["PgLine"])?s=n.tuple([n.number(),n.number(),n.number()]):ot(e,["PgLineABC"])?s=n.object({a:n.number(),b:n.number(),c:n.number()}):ot(e,["PgArray"])?(s=n.array(yC(e.baseColumn,n)),s=e.size?s.length(e.size):s):e.dataType==="array"?s=n.array(n.any()):e.dataType==="number"?s=DM(e,n,r):e.dataType==="bigint"?s=OM(e,n,r):e.dataType==="boolean"?s=r===!0||r.boolean?n.coerce.boolean():n.boolean():e.dataType==="date"?s=r===!0||r.date?n.coerce.date():n.date():e.dataType==="string"?s=MM(e,n,r):e.dataType==="json"?s=RM:e.dataType==="custom"?s=n.any():e.dataType==="buffer"&&(s=IM)),s||(s=n.any()),s}function DM(e,t,n){let r=e.getSQLType().includes("unsigned"),s,i,o=!1;ot(e,["MySqlTinyInt","SingleStoreTinyInt"])?(s=r?0:Ge.INT8_MIN,i=r?Ge.INT8_UNSIGNED_MAX:Ge.INT8_MAX,o=!0):ot(e,["PgSmallInt","PgSmallSerial","MySqlSmallInt","SingleStoreSmallInt"])?(s=r?0:Ge.INT16_MIN,i=r?Ge.INT16_UNSIGNED_MAX:Ge.INT16_MAX,o=!0):ot(e,["PgReal","MySqlFloat","MySqlMediumInt","SingleStoreMediumInt","SingleStoreFloat"])?(s=r?0:Ge.INT24_MIN,i=r?Ge.INT24_UNSIGNED_MAX:Ge.INT24_MAX,o=ot(e,["MySqlMediumInt","SingleStoreMediumInt"])):ot(e,["PgInteger","PgSerial","MySqlInt","SingleStoreInt"])?(s=r?0:Ge.INT32_MIN,i=r?Ge.INT32_UNSIGNED_MAX:Ge.INT32_MAX,o=!0):ot(e,["PgDoublePrecision","MySqlReal","MySqlDouble","SingleStoreReal","SingleStoreDouble","SQLiteReal"])?(s=r?0:Ge.INT48_MIN,i=r?Ge.INT48_UNSIGNED_MAX:Ge.INT48_MAX):ot(e,["PgBigInt53","PgBigSerial53","MySqlBigInt53","MySqlSerial","SingleStoreBigInt53","SingleStoreSerial","SQLiteInteger"])?(r=r||ot(e,["MySqlSerial","SingleStoreSerial"]),s=r?0:Number.MIN_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER,o=!0):ot(e,["MySqlYear","SingleStoreYear"])?(s=1901,i=2155,o=!0):(s=Number.MIN_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER);let l=n===!0||n!=null&&n.number?t.coerce.number():t.number();return l=l.min(s).max(i),o?l.int():l}function OM(e,t,n){const r=e.getSQLType().includes("unsigned"),s=r?0n:Ge.INT64_MIN,i=r?Ge.INT64_UNSIGNED_MAX:Ge.INT64_MAX;return(n===!0||n!=null&&n.bigint?t.coerce.bigint():t.bigint()).min(s).max(i)}function MM(e,t,n){if(ot(e,["PgUUID"]))return t.string().uuid();let r,s,i=!1;ot(e,["PgVarchar","SQLiteText"])?r=e.length:ot(e,["MySqlVarChar","SingleStoreVarChar"])?r=e.length??Ge.INT16_UNSIGNED_MAX:ot(e,["MySqlText","SingleStoreText"])&&(e.textType==="longtext"?r=Ge.INT32_UNSIGNED_MAX:e.textType==="mediumtext"?r=Ge.INT24_UNSIGNED_MAX:e.textType==="text"?r=Ge.INT16_UNSIGNED_MAX:r=Ge.INT8_UNSIGNED_MAX),ot(e,["PgChar","MySqlChar","SingleStoreChar"])&&(r=e.length,i=!0),ot(e,["PgBinaryVector"])&&(s=/^[01]+$/,r=e.dimensions);let o=n===!0||n!=null&&n.string?t.coerce.string():t.string();return o=s?o.regex(s):o,r&&i?o.length(r):r?o.max(r):o}function xC(e){return k_(e)?HD(e):QD(e)}function wC(e,t,n,r){const s={};for(const[i,o]of Object.entries(e)){if(!ft(o,Lo)&&!ft(o,it)&&!ft(o,it.Aliased)&&typeof o=="object"){const f=k_(o)||WD(o)?xC(o):o;s[i]=wC(f,t[i]??{},n,r);continue}const l=t[i];if(l!==void 0&&typeof l!="function"){s[i]=l;continue}const c=ft(o,Lo)?o:void 0,u=c?yC(c,r):st.any(),d=typeof l=="function"?l(u):u;n.never(c)||(s[i]=d,c&&(n.nullable(c)&&(s[i]=s[i].nullable()),n.optional(c)&&(s[i]=s[i].optional())))}return st.object(s)}const FM={never:e=>{var t,n;return((t=e==null?void 0:e.generated)==null?void 0:t.type)==="always"||((n=e==null?void 0:e.generatedIdentity)==null?void 0:n.type)==="always"},optional:e=>!e.notNull||e.notNull&&e.hasDefault,nullable:e=>!e.notNull},td=(e,t)=>{const n=xC(e);return wC(n,{},FM)};Ol("sessions",{sid:qe("sid").primaryKey(),sess:fj("sess").notNull(),expire:Ns("expire").notNull()},e=>[bO("IDX_session_expire").on(e.expire)]);const Sm=Ol("stores",{id:Dl("id").primaryKey(),name:qe("name",{length:255}).notNull(),address:Ma("address"),phone:qe("phone",{length:20}),email:qe("email",{length:255}),isActive:wm("is_active").default(!0),createdAt:Ns("created_at").defaultNow(),updatedAt:Ns("updated_at").defaultNow()}),bC=Ol("users",{id:Dl("id").primaryKey(),username:qe("username",{length:50}).unique().notNull(),password:qe("password",{length:255}).notNull(),email:qe("email",{length:255}).unique(),firstName:qe("first_name",{length:100}),lastName:qe("last_name",{length:100}),role:qe("role",{length:20}).notNull().default("employee"),storeId:Vo("store_id").references(()=>Sm.id),isActive:wm("is_active").default(!0),createdAt:Ns("created_at").defaultNow(),updatedAt:Ns("updated_at").defaultNow()}),SC=Ol("sales",{id:Dl("id").primaryKey(),storeId:Vo("store_id").references(()=>Sm.id).notNull(),userId:Vo("user_id").references(()=>bC.id).notNull(),timestamp:Ns("timestamp").defaultNow(),vendeur:qe("vendeur",{length:255}).notNull(),nom:qe("nom",{length:255}).notNull(),prenom:qe("prenom",{length:255}).notNull(),dateNaissance:qe("date_naissance",{length:10}).notNull(),lieuNaissance:qe("lieu_naissance",{length:255}),modePaiement:qe("mode_paiement",{length:50}).notNull().default("Espèce"),typeIdentite:qe("type_identite",{length:50}).notNull(),numeroIdentite:qe("numero_identite",{length:100}).notNull(),autoriteDelivrance:qe("autorite_delivrance",{length:255}),dateDelivrance:qe("date_delivrance",{length:10}).notNull(),photo_recto:Ma("photo_recto"),photo_verso:Ma("photo_verso"),photo_ticket:Ma("photo_ticket")}),LM=Ol("sale_products",{id:Dl("id").primaryKey(),saleId:Vo("sale_id").references(()=>SC.id,{onDelete:"cascade"}).notNull(),typeArticle:qe("type_article",{length:255}).notNull(),categorie:qe("categorie",{length:2}).notNull(),quantite:Vo("quantite").notNull(),gencode:qe("gencode",{length:13}).notNull(),createdAt:Ns("created_at").defaultNow()}),NC=td(bC).omit({id:!0,createdAt:!0,updatedAt:!0}),_C=td(Sm).omit({id:!0,createdAt:!0,updatedAt:!0});td(SC).omit({id:!0,timestamp:!0});td(LM).omit({id:!0,createdAt:!0});const VM=st.object({username:st.string().min(1,"Nom d'utilisateur requis"),password:st.string().min(1,"Mot de passe requis")});function zM(){const{login:e,isLoggingIn:t}=Yo(),{toast:n}=Zo(),{data:r}=Zr({queryKey:["/api/auth/default-credentials-status"],queryFn:async()=>(await nt("/api/auth/default-credentials-status")).json()}),s=Fi({resolver:ya(VM),defaultValues:{username:"",password:""}}),i=async o=>{try{await e(o),n({title:"Connexion réussie",description:"Bienvenue dans l'application !"})}catch{n({title:"Erreur de connexion",description:"Nom d'utilisateur ou mot de passe incorrect",variant:"destructive"})}};return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background mobile-padding py-4",children:a.jsxs(Hn,{className:"w-full max-w-md modern-card border border-border",children:[a.jsxs(Qn,{className:"text-center space-y-6",children:[a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"modern-icon-container",children:a.jsx(ZA,{className:"h-8 w-8"})})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(qn,{className:"text-2xl font-bold text-foreground",children:"RegisFlow"}),a.jsx("p",{className:"text-muted-foreground text-sm",children:"Registre des ventes des Feux d'artifice"})]})]}),a.jsxs(Zn,{className:"space-y-6",children:[a.jsx(Li,{...s,children:a.jsxs("form",{onSubmit:s.handleSubmit(i),className:"space-y-4",children:[a.jsx(Se,{control:s.control,name:"username",render:({field:o})=>a.jsxs(ve,{className:"space-y-2",children:[a.jsx(ye,{className:"font-semibold text-foreground",children:"Nom d'utilisateur"}),a.jsx(xe,{children:a.jsx(Te,{placeholder:"Votre nom d'utilisateur",className:"modern-input",...o})}),a.jsx(we,{})]})}),a.jsx(Se,{control:s.control,name:"password",render:({field:o})=>a.jsxs(ve,{className:"space-y-2",children:[a.jsx(ye,{className:"font-semibold text-foreground",children:"Mot de passe"}),a.jsx(xe,{children:a.jsx(Te,{type:"password",placeholder:"Votre mot de passe",className:"modern-input",...o})}),a.jsx(we,{})]})}),a.jsxs(je,{type:"submit",className:"w-full modern-button-primary",disabled:t,children:[a.jsx(UA,{className:"h-5 w-5 mr-2"}),t?"Connexion en cours...":"Se connecter"]})]})}),(r==null?void 0:r.showDefaultCredentials)&&a.jsxs(x_,{className:"status-info border-2 rounded-xl backdrop-blur-sm bg-blue-50/80 fade-in",children:[a.jsx($A,{className:"h-5 w-5"}),a.jsx(w_,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"font-semibold text-blue-900",children:"Compte administrateur par défaut"}),a.jsxs("div",{className:"bg-white/60 p-3 rounded-lg border border-blue-200/50 space-y-2",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm font-medium text-blue-700",children:"Utilisateur :"}),a.jsx("code",{className:"text-sm font-mono bg-blue-100 px-2 py-1 rounded text-blue-800",children:"admin"})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm font-medium text-blue-700",children:"Mot de passe :"}),a.jsx("code",{className:"text-sm font-mono bg-blue-100 px-2 py-1 rounded text-blue-800",children:"admin123"})]})]}),a.jsxs("div",{className:"flex items-start gap-2 p-3 bg-orange-50/80 border border-orange-200/50 rounded-lg",children:[a.jsx("div",{className:"text-orange-500 mt-0.5",children:"⚠️"}),a.jsxs("p",{className:"text-xs text-orange-700 leading-relaxed",children:[a.jsx("strong",{children:"Important :"})," Changez ce mot de passe après votre première connexion pour sécuriser l'application."]})]})]})})]})]})]})})}function Kv(e,[t,n]){return Math.min(n,Math.max(t,e))}var $M=h.createContext(void 0);function Nm(e){const t=h.useContext($M);return e||t||"ltr"}var sf=0;function jC(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Gv()),document.body.insertAdjacentElement("beforeend",e[1]??Gv()),sf++,()=>{sf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),sf--}},[])}function Gv(){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 of="focusScope.autoFocusOnMount",af="focusScope.autoFocusOnUnmount",Xv={bubbles:!1,cancelable:!0},UM="FocusScope",_m=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[l,c]=h.useState(null),u=en(s),d=en(i),f=h.useRef(null),p=ze(t,g=>c(g)),y=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let g=function(x){if(y.paused||!l)return;const j=x.target;l.contains(j)?f.current=j:Br(f.current,{select:!0})},w=function(x){if(y.paused||!l)return;const j=x.relatedTarget;j!==null&&(l.contains(j)||Br(f.current,{select:!0}))},v=function(x){if(document.activeElement===document.body)for(const T of x)T.removedNodes.length>0&&Br(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",w);const m=new MutationObserver(v);return l&&m.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",w),m.disconnect()}}},[r,l,y.paused]),h.useEffect(()=>{if(l){Jv.add(y);const g=document.activeElement;if(!l.contains(g)){const v=new CustomEvent(of,Xv);l.addEventListener(of,u),l.dispatchEvent(v),v.defaultPrevented||(BM(ZM(CC(l)),{select:!0}),document.activeElement===g&&Br(l))}return()=>{l.removeEventListener(of,u),setTimeout(()=>{const v=new CustomEvent(af,Xv);l.addEventListener(af,d),l.dispatchEvent(v),v.defaultPrevented||Br(g??document.body,{select:!0}),l.removeEventListener(af,d),Jv.remove(y)},0)}}},[l,u,d,y]);const b=h.useCallback(g=>{if(!n&&!r||y.paused)return;const w=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(w&&v){const m=g.currentTarget,[x,j]=WM(m);x&&j?!g.shiftKey&&v===j?(g.preventDefault(),n&&Br(x,{select:!0})):g.shiftKey&&v===x&&(g.preventDefault(),n&&Br(j,{select:!0})):v===m&&g.preventDefault()}},[n,r,y.paused]);return a.jsx(_e.div,{tabIndex:-1,...o,ref:p,onKeyDown:b})});_m.displayName=UM;function BM(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Br(r,{select:t}),document.activeElement!==n)return}function WM(e){const t=CC(e),n=Yv(t,e),r=Yv(t.reverse(),e);return[n,r]}function CC(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Yv(e,t){for(const n of e)if(!HM(n,{upTo:t}))return n}function HM(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 QM(e){return e instanceof HTMLInputElement&&"select"in e}function Br(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&QM(e)&&t&&e.select()}}var Jv=qM();function qM(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ey(e,t),e.unshift(t)},remove(t){var n;e=ey(e,t),(n=e[0])==null||n.resume()}}}function ey(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ZM(e){return e.filter(t=>t.tagName!=="A")}function KM(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var GM=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},wi=new WeakMap,oc=new WeakMap,ac={},lf=0,EC=function(e){return e&&(e.host||EC(e.parentNode))},XM=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=EC(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},YM=function(e,t,n,r){var s=XM(t,Array.isArray(e)?e:[e]);ac[n]||(ac[n]=new WeakMap);var i=ac[n],o=[],l=new Set,c=new Set(s),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};s.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(p){if(l.has(p))d(p);else try{var y=p.getAttribute(r),b=y!==null&&y!=="false",g=(wi.get(p)||0)+1,w=(i.get(p)||0)+1;wi.set(p,g),i.set(p,w),o.push(p),g===1&&b&&oc.set(p,!0),w===1&&p.setAttribute(n,"true"),b||p.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",p,v)}})};return d(t),l.clear(),lf++,function(){o.forEach(function(f){var p=wi.get(f)-1,y=i.get(f)-1;wi.set(f,p),i.set(f,y),p||(oc.has(f)||f.removeAttribute(r),oc.delete(f)),y||f.removeAttribute(n)}),lf--,lf||(wi=new WeakMap,wi=new WeakMap,oc=new WeakMap,ac={})}},TC=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=GM(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),YM(r,s,n,"aria-hidden")):function(){return null}},er=function(){return er=Object.assign||function(t){for(var n,r=1,s=arguments.length;r"u")return mF;var t=gF(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},yF=RC(),co="data-scroll-locked",xF=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),` .`.concat(eF,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"px ").concat(r,`; } body[`).concat(co,`] { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` padding-left: `.concat(s,`px; padding-top: `).concat(i,`px; padding-right: `).concat(o,`px; margin-left:0; margin-top:0; margin-right: `).concat(l,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(Ac,` { right: `).concat(l,"px ").concat(r,`; } .`).concat(Rc,` { margin-right: `).concat(l,"px ").concat(r,`; } .`).concat(Ac," .").concat(Ac,` { right: 0 `).concat(r,`; } .`).concat(Rc," .").concat(Rc,` { margin-right: 0 `).concat(r,`; } body[`).concat(co,`] { `).concat(tF,": ").concat(l,`px; } `)},ny=function(){var e=parseInt(document.body.getAttribute(co)||"0",10);return isFinite(e)?e:0},wF=function(){h.useEffect(function(){return document.body.setAttribute(co,(ny()+1).toString()),function(){var e=ny()-1;e<=0?document.body.removeAttribute(co):document.body.setAttribute(co,e.toString())}},[])},bF=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;wF();var i=h.useMemo(function(){return vF(s)},[s]);return h.createElement(yF,{styles:xF(i,!t,s,n?"":"!important")})},Up=!1;if(typeof window<"u")try{var lc=Object.defineProperty({},"passive",{get:function(){return Up=!0,!0}});window.addEventListener("test",lc,lc),window.removeEventListener("test",lc,lc)}catch{Up=!1}var bi=Up?{passive:!1}:!1,SF=function(e){return e.tagName==="TEXTAREA"},IC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!SF(e)&&n[t]==="visible")},NF=function(e){return IC(e,"overflowY")},_F=function(e){return IC(e,"overflowX")},ry=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=DC(e,r);if(s){var i=OC(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},jF=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},CF=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},DC=function(e,t){return e==="v"?NF(t):_F(t)},OC=function(e,t){return e==="v"?jF(t):CF(t)},EF=function(e,t){return e==="h"&&t==="rtl"?-1:1},TF=function(e,t,n,r,s){var i=EF(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,c=t.contains(l),u=!1,d=o>0,f=0,p=0;do{var y=OC(e,l),b=y[0],g=y[1],w=y[2],v=g-w-i*b;(b||v)&&DC(e,l)&&(f+=v,p+=b),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(f)<1||!s)||!d&&(Math.abs(p)<1||!s))&&(u=!0),u},cc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},sy=function(e){return[e.deltaX,e.deltaY]},iy=function(e){return e&&"current"in e?e.current:e},kF=function(e,t){return e[0]===t[0]&&e[1]===t[1]},PF=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},AF=0,Si=[];function RF(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState(AF++)[0],i=h.useState(RC)[0],o=h.useRef(e);h.useEffect(function(){o.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=JM([e.lockRef.current],(e.shards||[]).map(iy),!0).filter(Boolean);return g.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(g,w){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var v=cc(g),m=n.current,x="deltaX"in g?g.deltaX:m[0]-v[0],j="deltaY"in g?g.deltaY:m[1]-v[1],T,S=g.target,N=Math.abs(x)>Math.abs(j)?"h":"v";if("touches"in g&&N==="h"&&S.type==="range")return!1;var _=ry(N,S);if(!_)return!0;if(_?T=N:(T=N==="v"?"h":"v",_=ry(N,S)),!_)return!1;if(!r.current&&"changedTouches"in g&&(x||j)&&(r.current=T),!T)return!0;var E=r.current||T;return TF(E,w,g,E==="h"?x:j,!0)},[]),c=h.useCallback(function(g){var w=g;if(!(!Si.length||Si[Si.length-1]!==i)){var v="deltaY"in w?sy(w):cc(w),m=t.current.filter(function(T){return T.name===w.type&&(T.target===w.target||w.target===T.shadowParent)&&kF(T.delta,v)})[0];if(m&&m.should){w.cancelable&&w.preventDefault();return}if(!m){var x=(o.current.shards||[]).map(iy).filter(Boolean).filter(function(T){return T.contains(w.target)}),j=x.length>0?l(w,x[0]):!o.current.noIsolation;j&&w.cancelable&&w.preventDefault()}}},[]),u=h.useCallback(function(g,w,v,m){var x={name:g,delta:w,target:v,should:m,shadowParent:IF(v)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(j){return j!==x})},1)},[]),d=h.useCallback(function(g){n.current=cc(g),r.current=void 0},[]),f=h.useCallback(function(g){u(g.type,sy(g),g.target,l(g,e.lockRef.current))},[]),p=h.useCallback(function(g){u(g.type,cc(g),g.target,l(g,e.lockRef.current))},[]);h.useEffect(function(){return Si.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,bi),document.addEventListener("touchmove",c,bi),document.addEventListener("touchstart",d,bi),function(){Si=Si.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,bi),document.removeEventListener("touchmove",c,bi),document.removeEventListener("touchstart",d,bi)}},[]);var y=e.removeScrollBar,b=e.inert;return h.createElement(h.Fragment,null,b?h.createElement(i,{styles:PF(s)}):null,y?h.createElement(bF,{gapMode:e.gapMode}):null)}function IF(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const DF=lF(AC,RF);var jm=h.forwardRef(function(e,t){return h.createElement(nd,er({},e,{ref:t,sideCar:DF}))});jm.classNames=nd.classNames;var OF=[" ","Enter","ArrowUp","ArrowDown"],MF=[" ","Enter"],Fl="Select",[rd,sd,FF]=Xh(Fl),[ea,kL]=Dr(Fl,[FF,Gu]),id=Gu(),[LF,As]=ea(Fl),[VF,zF]=ea(Fl),MC=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:p,required:y,form:b}=e,g=id(t),[w,v]=h.useState(null),[m,x]=h.useState(null),[j,T]=h.useState(!1),S=Nm(u),[N=!1,_]=Do({prop:r,defaultProp:s,onChange:i}),[E,I]=Do({prop:o,defaultProp:l,onChange:c}),H=h.useRef(null),M=w?b||!!w.closest("form"):!0,[z,F]=h.useState(new Set),ee=Array.from(z).map(q=>q.props.value).join(";");return a.jsx(zI,{...g,children:a.jsxs(LF,{required:y,scope:t,trigger:w,onTriggerChange:v,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:j,onValueNodeHasChildrenChange:T,contentId:vs(),value:E,onValueChange:I,open:N,onOpenChange:_,dir:S,triggerPointerDownPosRef:H,disabled:p,children:[a.jsx(rd.Provider,{scope:t,children:a.jsx(VF,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback(q=>{F(oe=>new Set(oe).add(q))},[]),onNativeOptionRemove:h.useCallback(q=>{F(oe=>{const D=new Set(oe);return D.delete(q),D})},[]),children:n})}),M?a.jsxs(aE,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:f,value:E,onChange:q=>I(q.target.value),disabled:p,form:b,children:[E===void 0?a.jsx("option",{value:""}):null,Array.from(z)]},ee):null]})})};MC.displayName=Fl;var FC="SelectTrigger",LC=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=id(n),o=As(FC,n),l=o.disabled||r,c=ze(t,o.onTriggerChange),u=sd(n),d=h.useRef("touch"),[f,p,y]=lE(g=>{const w=u().filter(x=>!x.disabled),v=w.find(x=>x.value===o.value),m=cE(w,g,v);m!==void 0&&o.onValueChange(m.value)}),b=g=>{l||(o.onOpenChange(!0),y()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return a.jsx($N,{asChild:!0,...i,children:a.jsx(_e.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":oE(o.value)?"":void 0,...s,ref:c,onClick:ce(s.onClick,g=>{g.currentTarget.focus(),d.current!=="mouse"&&b(g)}),onPointerDown:ce(s.onPointerDown,g=>{d.current=g.pointerType;const w=g.target;w.hasPointerCapture(g.pointerId)&&w.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(b(g),g.preventDefault())}),onKeyDown:ce(s.onKeyDown,g=>{const w=f.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&p(g.key),!(w&&g.key===" ")&&OF.includes(g.key)&&(b(),g.preventDefault())})})})});LC.displayName=FC;var VC="SelectValue",zC=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...l}=e,c=As(VC,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=ze(t,c.onValueNodeChange);return It(()=>{u(d)},[u,d]),a.jsx(_e.span,{...l,ref:f,style:{pointerEvents:"none"},children:oE(c.value)?a.jsx(a.Fragment,{children:o}):i})});zC.displayName=VC;var $F="SelectIcon",$C=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(_e.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});$C.displayName=$F;var UF="SelectPortal",UC=e=>a.jsx(Wu,{asChild:!0,...e});UC.displayName=UF;var di="SelectContent",BC=h.forwardRef((e,t)=>{const n=As(di,e.__scopeSelect),[r,s]=h.useState();if(It(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?mi.createPortal(a.jsx(WC,{scope:e.__scopeSelect,children:a.jsx(rd.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),i):null}return a.jsx(HC,{...e,ref:t})});BC.displayName=di;var En=10,[WC,Rs]=ea(di),BF="SelectContentImpl",WF=Io("SelectContent.RemoveScroll"),HC=h.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:y,sticky:b,hideWhenDetached:g,avoidCollisions:w,...v}=e,m=As(di,n),[x,j]=h.useState(null),[T,S]=h.useState(null),N=ze(t,C=>j(C)),[_,E]=h.useState(null),[I,H]=h.useState(null),M=sd(n),[z,F]=h.useState(!1),ee=h.useRef(!1);h.useEffect(()=>{if(x)return TC(x)},[x]),jC();const q=h.useCallback(C=>{const[se,...ue]=M().map(Ie=>Ie.ref.current),[pe]=ue.slice(-1),Ee=document.activeElement;for(const Ie of C)if(Ie===Ee||(Ie==null||Ie.scrollIntoView({block:"nearest"}),Ie===se&&T&&(T.scrollTop=0),Ie===pe&&T&&(T.scrollTop=T.scrollHeight),Ie==null||Ie.focus(),document.activeElement!==Ee))return},[M,T]),oe=h.useCallback(()=>q([_,x]),[q,_,x]);h.useEffect(()=>{z&&oe()},[z,oe]);const{onOpenChange:D,triggerPointerDownPosRef:U}=m;h.useEffect(()=>{if(x){let C={x:0,y:0};const se=pe=>{var Ee,Ie;C={x:Math.abs(Math.round(pe.pageX)-(((Ee=U.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(pe.pageY)-(((Ie=U.current)==null?void 0:Ie.y)??0))}},ue=pe=>{C.x<=10&&C.y<=10?pe.preventDefault():x.contains(pe.target)||D(!1),document.removeEventListener("pointermove",se),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",ue,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",ue,{capture:!0})}}},[x,D,U]),h.useEffect(()=>{const C=()=>D(!1);return window.addEventListener("blur",C),window.addEventListener("resize",C),()=>{window.removeEventListener("blur",C),window.removeEventListener("resize",C)}},[D]);const[Y,ae]=lE(C=>{const se=M().filter(Ee=>!Ee.disabled),ue=se.find(Ee=>Ee.ref.current===document.activeElement),pe=cE(se,C,ue);pe&&setTimeout(()=>pe.ref.current.focus())}),Re=h.useCallback((C,se,ue)=>{const pe=!ee.current&&!ue;(m.value!==void 0&&m.value===se||pe)&&(E(C),pe&&(ee.current=!0))},[m.value]),ct=h.useCallback(()=>x==null?void 0:x.focus(),[x]),Ue=h.useCallback((C,se,ue)=>{const pe=!ee.current&&!ue;(m.value!==void 0&&m.value===se||pe)&&H(C)},[m.value]),Ot=r==="popper"?Bp:QC,ht=Ot===Bp?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:y,sticky:b,hideWhenDetached:g,avoidCollisions:w}:{};return a.jsx(WC,{scope:n,content:x,viewport:T,onViewportChange:S,itemRefCallback:Re,selectedItem:_,onItemLeave:ct,itemTextRefCallback:Ue,focusSelectedItem:oe,selectedItemText:I,position:r,isPositioned:z,searchRef:Y,children:a.jsx(jm,{as:WF,allowPinchZoom:!0,children:a.jsx(_m,{asChild:!0,trapped:m.open,onMountAutoFocus:C=>{C.preventDefault()},onUnmountAutoFocus:ce(s,C=>{var se;(se=m.trigger)==null||se.focus({preventScroll:!0}),C.preventDefault()}),children:a.jsx(Cl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:C=>C.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:a.jsx(Ot,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:C=>C.preventDefault(),...v,...ht,onPlaced:()=>F(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:ce(v.onKeyDown,C=>{const se=C.ctrlKey||C.altKey||C.metaKey;if(C.key==="Tab"&&C.preventDefault(),!se&&C.key.length===1&&ae(C.key),["ArrowUp","ArrowDown","Home","End"].includes(C.key)){let pe=M().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(C.key)&&(pe=pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(C.key)){const Ee=C.target,Ie=pe.indexOf(Ee);pe=pe.slice(Ie+1)}setTimeout(()=>q(pe)),C.preventDefault()}})})})})})})});HC.displayName=BF;var HF="SelectItemAlignedPosition",QC=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=As(di,n),o=Rs(di,n),[l,c]=h.useState(null),[u,d]=h.useState(null),f=ze(t,N=>d(N)),p=sd(n),y=h.useRef(!1),b=h.useRef(!0),{viewport:g,selectedItem:w,selectedItemText:v,focusSelectedItem:m}=o,x=h.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&g&&w&&v){const N=i.trigger.getBoundingClientRect(),_=u.getBoundingClientRect(),E=i.valueNode.getBoundingClientRect(),I=v.getBoundingClientRect();if(i.dir!=="rtl"){const Ee=I.left-_.left,Ie=E.left-Ee,yt=N.left-Ie,jt=N.width+yt,Is=Math.max(jt,_.width),Mr=window.innerWidth-En,Fr=Kv(Ie,[En,Math.max(En,Mr-Is)]);l.style.minWidth=jt+"px",l.style.left=Fr+"px"}else{const Ee=_.right-I.right,Ie=window.innerWidth-E.right-Ee,yt=window.innerWidth-N.right-Ie,jt=N.width+yt,Is=Math.max(jt,_.width),Mr=window.innerWidth-En,Fr=Kv(Ie,[En,Math.max(En,Mr-Is)]);l.style.minWidth=jt+"px",l.style.right=Fr+"px"}const H=p(),M=window.innerHeight-En*2,z=g.scrollHeight,F=window.getComputedStyle(u),ee=parseInt(F.borderTopWidth,10),q=parseInt(F.paddingTop,10),oe=parseInt(F.borderBottomWidth,10),D=parseInt(F.paddingBottom,10),U=ee+q+z+D+oe,Y=Math.min(w.offsetHeight*5,U),ae=window.getComputedStyle(g),Re=parseInt(ae.paddingTop,10),ct=parseInt(ae.paddingBottom,10),Ue=N.top+N.height/2-En,Ot=M-Ue,ht=w.offsetHeight/2,C=w.offsetTop+ht,se=ee+q+C,ue=U-se;if(se<=Ue){const Ee=H.length>0&&w===H[H.length-1].ref.current;l.style.bottom="0px";const Ie=u.clientHeight-g.offsetTop-g.offsetHeight,yt=Math.max(Ot,ht+(Ee?ct:0)+Ie+oe),jt=se+yt;l.style.height=jt+"px"}else{const Ee=H.length>0&&w===H[0].ref.current;l.style.top="0px";const yt=Math.max(Ue,ee+g.offsetTop+(Ee?Re:0)+ht)+ue;l.style.height=yt+"px",g.scrollTop=se-Ue+g.offsetTop}l.style.margin=`${En}px 0`,l.style.minHeight=Y+"px",l.style.maxHeight=M+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[p,i.trigger,i.valueNode,l,u,g,w,v,i.dir,r]);It(()=>x(),[x]);const[j,T]=h.useState();It(()=>{u&&T(window.getComputedStyle(u).zIndex)},[u]);const S=h.useCallback(N=>{N&&b.current===!0&&(x(),m==null||m(),b.current=!1)},[x,m]);return a.jsx(qF,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:y,onScrollButtonChange:S,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:a.jsx(_e.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});QC.displayName=HF;var QF="SelectPopperPosition",Bp=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=En,...i}=e,o=id(n);return a.jsx(UN,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.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)"}})});Bp.displayName=QF;var[qF,Cm]=ea(di,{}),Wp="SelectViewport",qC=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=Rs(Wp,n),o=Cm(Wp,n),l=ze(t,i.onViewportChange),c=h.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:r}),a.jsx(rd.Slot,{scope:n,children:a.jsx(_e.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ce(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:p}=o;if(p!=null&&p.current&&f){const y=Math.abs(c.current-d.scrollTop);if(y>0){const b=window.innerHeight-En*2,g=parseFloat(f.style.minHeight),w=parseFloat(f.style.height),v=Math.max(g,w);if(v0?j:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});qC.displayName=Wp;var ZC="SelectGroup",[ZF,KF]=ea(ZC),GF=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=vs();return a.jsx(ZF,{scope:n,id:s,children:a.jsx(_e.div,{role:"group","aria-labelledby":s,...r,ref:t})})});GF.displayName=ZC;var KC="SelectLabel",GC=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=KF(KC,n);return a.jsx(_e.div,{id:s.id,...r,ref:t})});GC.displayName=KC;var ju="SelectItem",[XF,XC]=ea(ju),YC=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,l=As(ju,n),c=Rs(ju,n),u=l.value===r,[d,f]=h.useState(i??""),[p,y]=h.useState(!1),b=ze(t,m=>{var x;return(x=c.itemRefCallback)==null?void 0:x.call(c,m,r,s)}),g=vs(),w=h.useRef("touch"),v=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A 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(XF,{scope:n,value:r,disabled:s,textId:g,isSelected:u,onItemTextChange:h.useCallback(m=>{f(x=>x||((m==null?void 0:m.textContent)??"").trim())},[]),children:a.jsx(rd.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:a.jsx(_e.div,{role:"option","aria-labelledby":g,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:b,onFocus:ce(o.onFocus,()=>y(!0)),onBlur:ce(o.onBlur,()=>y(!1)),onClick:ce(o.onClick,()=>{w.current!=="mouse"&&v()}),onPointerUp:ce(o.onPointerUp,()=>{w.current==="mouse"&&v()}),onPointerDown:ce(o.onPointerDown,m=>{w.current=m.pointerType}),onPointerMove:ce(o.onPointerMove,m=>{var x;w.current=m.pointerType,s?(x=c.onItemLeave)==null||x.call(c):w.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(o.onPointerLeave,m=>{var x;m.currentTarget===document.activeElement&&((x=c.onItemLeave)==null||x.call(c))}),onKeyDown:ce(o.onKeyDown,m=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&m.key===" "||(MF.includes(m.key)&&v(),m.key===" "&&m.preventDefault())})})})})});YC.displayName=ju;var ba="SelectItemText",JC=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=As(ba,n),l=Rs(ba,n),c=XC(ba,n),u=zF(ba,n),[d,f]=h.useState(null),p=ze(t,v=>f(v),c.onItemTextChange,v=>{var m;return(m=l.itemTextRefCallback)==null?void 0:m.call(l,v,c.value,c.disabled)}),y=d==null?void 0:d.textContent,b=h.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:y},c.value),[c.disabled,c.value,y]),{onNativeOptionAdd:g,onNativeOptionRemove:w}=u;return It(()=>(g(b),()=>w(b)),[g,w,b]),a.jsxs(a.Fragment,{children:[a.jsx(_e.span,{id:c.textId,...i,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?mi.createPortal(i.children,o.valueNode):null]})});JC.displayName=ba;var eE="SelectItemIndicator",tE=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return XC(eE,n).isSelected?a.jsx(_e.span,{"aria-hidden":!0,...r,ref:t}):null});tE.displayName=eE;var Hp="SelectScrollUpButton",nE=h.forwardRef((e,t)=>{const n=Rs(Hp,e.__scopeSelect),r=Cm(Hp,e.__scopeSelect),[s,i]=h.useState(!1),o=ze(t,r.onScrollButtonChange);return It(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(sE,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});nE.displayName=Hp;var Qp="SelectScrollDownButton",rE=h.forwardRef((e,t)=>{const n=Rs(Qp,e.__scopeSelect),r=Cm(Qp,e.__scopeSelect),[s,i]=h.useState(!1),o=ze(t,r.onScrollButtonChange);return It(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(sE,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});rE.displayName=Qp;var sE=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=Rs("SelectScrollButton",n),o=h.useRef(null),l=sd(n),c=h.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return h.useEffect(()=>()=>c(),[c]),It(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(_e.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ce(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:ce(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:ce(s.onPointerLeave,()=>{c()})})}),YF="SelectSeparator",iE=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(_e.div,{"aria-hidden":!0,...r,ref:t})});iE.displayName=YF;var qp="SelectArrow",JF=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=id(n),i=As(qp,n),o=Rs(qp,n);return i.open&&o.position==="popper"?a.jsx(BN,{...s,...r,ref:t}):null});JF.displayName=qp;function oE(e){return e===""||e===void 0}var aE=h.forwardRef((e,t)=>{const{value:n,...r}=e,s=h.useRef(null),i=ze(t,s),o=KM(n);return h.useEffect(()=>{const l=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==n&&d){const f=new Event("change",{bubbles:!0});d.call(l,n),l.dispatchEvent(f)}},[o,n]),a.jsx(El,{asChild:!0,children:a.jsx("select",{...r,ref:i,defaultValue:n})})});aE.displayName="BubbleSelect";function lE(e){const t=en(e),n=h.useRef(""),r=h.useRef(0),s=h.useCallback(o=>{const l=n.current+o;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function cE(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=e4(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function e4(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var t4=MC,uE=LC,n4=zC,r4=$C,s4=UC,dE=BC,i4=qC,fE=GC,pE=YC,o4=JC,a4=tE,hE=nE,mE=rE,gE=iE;const Sr=t4,Nr=n4,nr=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(uE,{ref:r,className:ie("flex h-10 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),...n,children:[t,a.jsx(r4,{asChild:!0,children:a.jsx(cN,{className:"h-4 w-4 opacity-50"})})]}));nr.displayName=uE.displayName;const vE=h.forwardRef(({className:e,...t},n)=>a.jsx(hE,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(MA,{className:"h-4 w-4"})}));vE.displayName=hE.displayName;const yE=h.forwardRef(({className:e,...t},n)=>a.jsx(mE,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(cN,{className:"h-4 w-4"})}));yE.displayName=mE.displayName;const rr=h.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>a.jsx(s4,{children:a.jsxs(dE,{ref:s,className:ie("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]",n==="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:n,...r,children:[a.jsx(vE,{}),a.jsx(i4,{className:ie("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(yE,{})]})}));rr.displayName=dE.displayName;const l4=h.forwardRef(({className:e,...t},n)=>a.jsx(fE,{ref:n,className:ie("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));l4.displayName=fE.displayName;const qt=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(pE,{ref:r,className:ie("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),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(a4,{children:a.jsx(OA,{className:"h-4 w-4"})})}),a.jsx(o4,{children:t})]}));qt.displayName=pE.displayName;const c4=h.forwardRef(({className:e,...t},n)=>a.jsx(gE,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));c4.displayName=gE.displayName;var ff="rovingFocusGroup.onEntryFocus",u4={bubbles:!1,cancelable:!0},od="RovingFocusGroup",[Zp,xE,d4]=Xh(od),[f4,wE]=Dr(od,[d4]),[p4,h4]=f4(od),bE=h.forwardRef((e,t)=>a.jsx(Zp.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Zp.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(m4,{...e,ref:t})})}));bE.displayName=od;var m4=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,p=h.useRef(null),y=ze(t,p),b=Nm(i),[g=null,w]=Do({prop:o,defaultProp:l,onChange:c}),[v,m]=h.useState(!1),x=en(u),j=xE(n),T=h.useRef(!1),[S,N]=h.useState(0);return h.useEffect(()=>{const _=p.current;if(_)return _.addEventListener(ff,x),()=>_.removeEventListener(ff,x)},[x]),a.jsx(p4,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:g,onItemFocus:h.useCallback(_=>w(_),[w]),onItemShiftTab:h.useCallback(()=>m(!0),[]),onFocusableItemAdd:h.useCallback(()=>N(_=>_+1),[]),onFocusableItemRemove:h.useCallback(()=>N(_=>_-1),[]),children:a.jsx(_e.div,{tabIndex:v||S===0?-1:0,"data-orientation":r,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:ce(e.onMouseDown,()=>{T.current=!0}),onFocus:ce(e.onFocus,_=>{const E=!T.current;if(_.target===_.currentTarget&&E&&!v){const I=new CustomEvent(ff,u4);if(_.currentTarget.dispatchEvent(I),!I.defaultPrevented){const H=j().filter(q=>q.focusable),M=H.find(q=>q.active),z=H.find(q=>q.id===g),ee=[M,z,...H].filter(Boolean).map(q=>q.ref.current);_E(ee,d)}}T.current=!1}),onBlur:ce(e.onBlur,()=>m(!1))})})}),SE="RovingFocusGroupItem",NE=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,...o}=e,l=vs(),c=i||l,u=h4(SE,n),d=u.currentTabStopId===c,f=xE(n),{onFocusableItemAdd:p,onFocusableItemRemove:y}=u;return h.useEffect(()=>{if(r)return p(),()=>y()},[r,p,y]),a.jsx(Zp.ItemSlot,{scope:n,id:c,focusable:r,active:s,children:a.jsx(_e.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:ce(e.onMouseDown,b=>{r?u.onItemFocus(c):b.preventDefault()}),onFocus:ce(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:ce(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const g=y4(b,u.orientation,u.dir);if(g!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let v=f().filter(m=>m.focusable).map(m=>m.ref.current);if(g==="last")v.reverse();else if(g==="prev"||g==="next"){g==="prev"&&v.reverse();const m=v.indexOf(b.currentTarget);v=u.loop?x4(v,m+1):v.slice(m+1)}setTimeout(()=>_E(v))}})})})});NE.displayName=SE;var g4={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function v4(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function y4(e,t,n){const r=v4(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return g4[r]}function _E(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function x4(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var w4=bE,b4=NE,Em="Tabs",[S4,PL]=Dr(Em,[wE]),jE=wE(),[N4,Tm]=S4(Em),CE=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Nm(l),[f,p]=Do({prop:r,onChange:s,defaultProp:i});return a.jsx(N4,{scope:n,baseId:vs(),value:f,onValueChange:p,orientation:o,dir:d,activationMode:c,children:a.jsx(_e.div,{dir:d,"data-orientation":o,...u,ref:t})})});CE.displayName=Em;var EE="TabsList",TE=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,i=Tm(EE,n),o=jE(n);return a.jsx(w4,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(_e.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:t})})});TE.displayName=EE;var kE="TabsTrigger",PE=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=e,o=Tm(kE,n),l=jE(n),c=IE(o.baseId,r),u=DE(o.baseId,r),d=r===o.value;return a.jsx(b4,{asChild:!0,...l,focusable:!s,active:d,children:a.jsx(_e.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:t,onMouseDown:ce(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?o.onValueChange(r):f.preventDefault()}),onKeyDown:ce(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(r)}),onFocus:ce(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!s&&f&&o.onValueChange(r)})})})});PE.displayName=kE;var AE="TabsContent",RE=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...o}=e,l=Tm(AE,n),c=IE(l.baseId,r),u=DE(l.baseId,r),d=r===l.value,f=h.useRef(d);return h.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),a.jsx(gi,{present:s||d,children:({present:p})=>a.jsx(_e.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:p&&i})})});RE.displayName=AE;function IE(e,t){return`${e}-trigger-${t}`}function DE(e,t){return`${e}-content-${t}`}var _4=CE,OE=TE,ME=PE,FE=RE;const LE=_4,km=h.forwardRef(({className:e,...t},n)=>a.jsx(OE,{ref:n,className:ie("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));km.displayName=OE.displayName;const as=h.forwardRef(({className:e,...t},n)=>a.jsx(ME,{ref:n,className:ie("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}));as.displayName=ME.displayName;const ls=h.forwardRef(({className:e,...t},n)=>a.jsx(FE,{ref:n,className:ie("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));ls.displayName=FE.displayName;const VE=h.createContext(void 0);function j4({children:e,userStoreId:t,isAdmin:n}){const[r,s]=h.useState(null),{data:i=[],isLoading:o}=Zr({queryKey:n?["/api/admin/stores"]:["/api/stores"],queryFn:async()=>(await nt(n?"/api/admin/stores":"/api/stores")).json(),enabled:!!n||!!t});h.useEffect(()=>{i.length>0&&r===null&&(n?s(i[0].id):t&&s(t))},[i,r,n,t]);const l=i.find(c=>c.id===r)||null;return a.jsx(VE.Provider,{value:{selectedStoreId:r,setSelectedStoreId:s,stores:i,selectedStore:l,isLoadingStores:o},children:e})}function Pm(){const e=h.useContext(VE);if(e===void 0)throw new Error("useStoreContext must be used within a StoreProvider");return e}function C4(){const[e,t]=h.useState(!1),[n,r]=h.useState(null),[s,i]=h.useState(!1),[o,l]=h.useState(null),c=h.useRef(null),u=h.useRef(null),d=h.useCallback(async y=>{console.log("=== SIMPLE CAMERA START ===");try{o&&o.getTracks().forEach(g=>g.stop());const b=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720},facingMode:"environment"}});console.log("Media stream obtained:",b),l(b),r(y),t(!0),setTimeout(()=>{if(c.current&&b){const g=c.current;console.log("Assigning stream to video element"),g.srcObject=b,g.autoplay=!0,g.playsInline=!0,g.muted=!0,g.play().then(()=>{console.log("Video playing successfully")}).catch(w=>{console.error("Video play failed:",w)})}},100)}catch(b){throw console.error("Camera start failed:",b),b}},[o]),f=h.useCallback(async()=>{if(console.log("=== SIMPLE CAMERA CAPTURE ==="),!c.current||!u.current)throw new Error("Video ou canvas non disponible");const y=c.current,b=u.current,g=b.getContext("2d");if(!g)throw new Error("Contexte canvas non disponible");if(y.videoWidth===0||y.videoHeight===0)throw new Error("Vidéo non prête - dimensions non disponibles");i(!0);try{b.width=y.videoWidth,b.height=y.videoHeight,g.drawImage(y,0,0,b.width,b.height);const w=b.toDataURL("image/jpeg",.8);return console.log("Photo captured successfully, size:",w.length),w}finally{i(!1)}},[]),p=h.useCallback(()=>{console.log("=== SIMPLE CAMERA STOP ==="),o&&(o.getTracks().forEach(y=>{y.stop(),console.log("Track stopped:",y.kind)}),l(null)),c.current&&(c.current.srcObject=null),t(!1),r(null),i(!1)},[o]);return{isOpen:e,currentPhotoType:n,isCapturing:s,videoRef:c,canvasRef:u,startCamera:d,capturePhoto:f,stopCamera:p}}function E4(e){if(!e||e.length!==13||!/^\d{13}$/.test(e))return!1;let t=0;for(let r=0;r<12;r++){const s=parseInt(e[r]);t+=r%2===0?s:s*3}return(10-t%10)%10===parseInt(e[12])}function T4(e){const n=[{key:"vendeur",label:"Vendeur"},{key:"nom",label:"Nom"},{key:"prenom",label:"Prénom"},{key:"dateNaissance",label:"Date de naissance"},{key:"lieuNaissance",label:"Lieu de naissance"},{key:"modePaiement",label:"Mode de paiement"},{key:"typeIdentite",label:"Type de pièce d'identité"},{key:"numeroIdentite",label:"Numéro de pièce d'identité"},{key:"dateDelivrance",label:"Date de délivrance"}].filter(r=>{const s=e[r.key];return!s||s.toString().trim()===""}).map(r=>r.label);return!e.products||!Array.isArray(e.products)||e.products.length===0?n.push("Au moins un produit"):e.products.forEach((r,s)=>{[{key:"typeArticle",label:`Type d'article (produit ${s+1})`},{key:"categorie",label:`Catégorie (produit ${s+1})`},{key:"quantite",label:`Quantité (produit ${s+1})`},{key:"gencode",label:`Code EAN-13 (produit ${s+1})`}].forEach(o=>{const l=r[o.key];o.key==="quantite"?(!l||isNaN(Number(l))||Number(l)<=0)&&n.push(o.label):(!l||l.toString().trim()==="")&&n.push(o.label)})}),n}const oy={"Pétard à mèche":["F3"],Batterie:["F3"],"Batterie nécessitant un support externe":["F3"],Combinaison:["F3"],"Combinaison nécessitant un support externe":["F3"],"Pétard aérien":["F2","F3"],"Pétard à composition flash":["F3"],Fusée:["F2","F3"],"Chandelle romaine":["F2","F3"],"Chandelle monocoup":["F2","F3"],Fontaine:["F2"]},k4=[{value:"CNI",label:"Carte Nationale d'Identité"},{value:"Passeport",label:"Passeport"},{value:"Permis de conduire",label:"Permis de conduire"}],P4=[{value:"Carte Bancaire",label:"Carte Bancaire"},{value:"Espèce",label:"Espèce"},{value:"Chèque",label:"Chèque"},{value:"Carte Cadeau",label:"Carte Cadeau"},{value:"Autre",label:"Autre"}];var Am="Dialog",[zE,$E]=Dr(Am),[A4,Un]=zE(Am),UE=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,l=h.useRef(null),c=h.useRef(null),[u=!1,d]=Do({prop:r,defaultProp:s,onChange:i});return a.jsx(A4,{scope:t,triggerRef:l,contentRef:c,contentId:vs(),titleId:vs(),descriptionId:vs(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};UE.displayName=Am;var BE="DialogTrigger",WE=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Un(BE,n),i=ze(t,s.triggerRef);return a.jsx(_e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Dm(s.open),...r,ref:i,onClick:ce(e.onClick,s.onOpenToggle)})});WE.displayName=BE;var Rm="DialogPortal",[R4,HE]=zE(Rm,{forceMount:void 0}),QE=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=Un(Rm,t);return a.jsx(R4,{scope:t,forceMount:n,children:h.Children.map(r,o=>a.jsx(gi,{present:n||i.open,children:a.jsx(Wu,{asChild:!0,container:s,children:o})}))})};QE.displayName=Rm;var Cu="DialogOverlay",qE=h.forwardRef((e,t)=>{const n=HE(Cu,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Un(Cu,e.__scopeDialog);return i.modal?a.jsx(gi,{present:r||i.open,children:a.jsx(D4,{...s,ref:t})}):null});qE.displayName=Cu;var I4=Io("DialogOverlay.RemoveScroll"),D4=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Un(Cu,n);return a.jsx(jm,{as:I4,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(_e.div,{"data-state":Dm(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),fi="DialogContent",ZE=h.forwardRef((e,t)=>{const n=HE(fi,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Un(fi,e.__scopeDialog);return a.jsx(gi,{present:r||i.open,children:i.modal?a.jsx(O4,{...s,ref:t}):a.jsx(M4,{...s,ref:t})})});ZE.displayName=fi;var O4=h.forwardRef((e,t)=>{const n=Un(fi,e.__scopeDialog),r=h.useRef(null),s=ze(t,n.contentRef,r);return h.useEffect(()=>{const i=r.current;if(i)return TC(i)},[]),a.jsx(KE,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ce(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:ce(e.onFocusOutside,i=>i.preventDefault())})}),M4=h.forwardRef((e,t)=>{const n=Un(fi,e.__scopeDialog),r=h.useRef(!1),s=h.useRef(!1);return a.jsx(KE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),KE=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,l=Un(fi,n),c=h.useRef(null),u=ze(t,c);return jC(),a.jsxs(a.Fragment,{children:[a.jsx(_m,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(Cl,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Dm(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(L4,{titleId:l.titleId}),a.jsx(z4,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Im="DialogTitle",GE=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Un(Im,n);return a.jsx(_e.h2,{id:s.titleId,...r,ref:t})});GE.displayName=Im;var XE="DialogDescription",YE=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Un(XE,n);return a.jsx(_e.p,{id:s.descriptionId,...r,ref:t})});YE.displayName=XE;var JE="DialogClose",eT=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Un(JE,n);return a.jsx(_e.button,{type:"button",...r,ref:t,onClick:ce(e.onClick,()=>s.onOpenChange(!1))})});eT.displayName=JE;function Dm(e){return e?"open":"closed"}var tT="DialogTitleWarning",[F4,nT]=W2(tT,{contentName:fi,titleName:Im,docsSlug:"dialog"}),L4=({titleId:e})=>{const t=nT(tT),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},V4="DialogDescriptionWarning",z4=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${nT(V4).contentName}}.`;return h.useEffect(()=>{var i;const s=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},rT=UE,sT=WE,iT=QE,Om=qE,Mm=ZE,Fm=GE,Lm=YE,Vm=eT;const zi=rT,ay=sT,$4=iT,oT=h.forwardRef(({className:e,...t},n)=>a.jsx(Om,{ref:n,className:ie("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}));oT.displayName=Om.displayName;const $s=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs($4,{children:[a.jsx(oT,{}),a.jsxs(Mm,{ref:r,className:ie("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),...n,children:[t,a.jsxs(Vm,{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(Oo,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$s.displayName=Mm.displayName;const Us=({className:e,...t})=>a.jsx("div",{className:ie("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Us.displayName="DialogHeader";const Bs=h.forwardRef(({className:e,...t},n)=>a.jsx(Fm,{ref:n,className:ie("text-lg font-semibold leading-none tracking-tight",e),...t}));Bs.displayName=Fm.displayName;const Sa=h.forwardRef(({className:e,...t},n)=>a.jsx(Lm,{ref:n,className:ie("text-sm text-muted-foreground",e),...t}));Sa.displayName=Lm.displayName;function U4({isOpen:e,photoType:t,videoRef:n,canvasRef:r,isCapturing:s,onClose:i,onCapture:o}){return h.useEffect(()=>{if(console.log("SimpleCameraModal - isOpen:",e),e&&n.current){console.log("SimpleCameraModal - Video element available");const l=n.current;l.onloadedmetadata=()=>{console.log("SimpleCameraModal - Video metadata loaded:",l.videoWidth,"x",l.videoHeight)},l.onplay=()=>{console.log("SimpleCameraModal - Video started playing")},l.onerror=c=>{console.error("SimpleCameraModal - Video error:",c)}}},[e,n]),e?a.jsx(zi,{open:e,onOpenChange:i,children:a.jsxs($s,{className:"max-w-2xl w-full mx-auto",children:[a.jsx(Us,{children:a.jsxs(Bs,{className:"text-center",children:["Capture photo ",t?t.charAt(0).toUpperCase()+t.slice(1):""]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"relative bg-black rounded-lg overflow-hidden",children:[a.jsx("video",{ref:n,autoPlay:!0,playsInline:!0,muted:!0,className:"w-full h-auto max-h-96",style:{minHeight:"200px",objectFit:"cover"}}),a.jsx("canvas",{ref:r,className:"hidden"}),a.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[a.jsx("div",{className:"absolute inset-4 border-2 border-white border-dashed rounded-lg opacity-80"}),a.jsx("div",{className:"absolute bottom-4 left-4 text-white text-sm bg-black bg-opacity-75 px-3 py-2 rounded",children:"Cadrez votre pièce d'identité dans le rectangle"}),a.jsx("div",{className:"absolute top-4 right-4 text-white text-sm bg-black bg-opacity-75 px-3 py-2 rounded",children:t==="recto"?"RECTO":"VERSO"})]})]}),a.jsxs("div",{className:"flex justify-center space-x-4",children:[a.jsxs(je,{variant:"outline",onClick:i,className:"flex-1 max-w-32",children:[a.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Annuler"]}),a.jsxs(je,{onClick:o,disabled:s,className:"bg-green-600 hover:bg-green-700 text-white flex-1 max-w-40",children:[a.jsx(Cc,{className:"h-4 w-4 mr-2"}),s?"Capture...":"Capturer"]})]})]})]})}):null}function B4(){const{toast:e}=Zo(),t=qo(),{user:n}=Yo(),{selectedStoreId:r}=Pm(),[s,i]=h.useState(!1),{isOpen:o,currentPhotoType:l,isCapturing:c,videoRef:u,canvasRef:d,startCamera:f,capturePhoto:p,stopCamera:y}=C4(),b=Fi({defaultValues:{vendeur:"",products:[{typeArticle:"",categorie:"",quantite:"",gencode:""}],nom:"",prenom:"",dateNaissance:"",lieuNaissance:"",modePaiement:"Espèce",typeIdentite:"",numeroIdentite:"",autoriteDelivrance:"",dateDelivrance:"",photoRecto:"",photoVerso:"",photoTicket:""}}),{fields:g,append:w,remove:v}=CD({control:b.control,name:"products"}),m=Qt({mutationFn:async S=>{const N={...S,...(n==null?void 0:n.role)==="admin"&&r&&{storeId:r}};return(await nt("/api/sales",{method:"POST",body:JSON.stringify(N)})).json()},onSuccess:()=>{t.invalidateQueries({queryKey:["/api/sales"],exact:!1}),e({title:"Vente enregistrée",description:"La vente a été enregistrée avec succès",variant:"success"}),b.reset({vendeur:"",products:[{typeArticle:"",categorie:"",quantite:"",gencode:""}],nom:"",prenom:"",dateNaissance:"",lieuNaissance:"",modePaiement:"Espèce",typeIdentite:"",numeroIdentite:"",autoriteDelivrance:"",dateDelivrance:"",photoRecto:"",photoVerso:"",photoTicket:""})},onError:S=>{e({title:"Erreur",description:S.message||"Erreur lors de l'enregistrement de la vente",variant:"destructive"})}}),x=async S=>{try{i(!0);const N=T4(S);if(N.length>0){e({title:"Champs manquants",description:`Veuillez remplir: ${N.join(", ")}`,variant:"destructive"});return}for(const[E,I]of S.products.entries())if(!E4(I.gencode)){e({title:"Code EAN13 invalide",description:`Le gencode du produit ${E+1} ("${I.gencode}") doit être un code EAN13 valide à 13 chiffres`,variant:"destructive"});return}const _={vendeur:S.vendeur,products:S.products.map(E=>({typeArticle:E.typeArticle,categorie:E.categorie,quantite:parseInt(E.quantite),gencode:E.gencode})),nom:S.nom,prenom:S.prenom,dateNaissance:S.dateNaissance,lieuNaissance:S.lieuNaissance,modePaiement:S.modePaiement,typeIdentite:S.typeIdentite,numeroIdentite:S.numeroIdentite,autoriteDelivrance:S.autoriteDelivrance,dateDelivrance:S.dateDelivrance,photoRecto:S.photoRecto,photoVerso:S.photoVerso,photoTicket:S.photoTicket};await m.mutateAsync(_)}catch(N){console.error("Sale creation error:",N)}finally{i(!1)}},j=(S,N)=>{const _=N==="recto"?"photoRecto":N==="verso"?"photoVerso":"photoTicket";b.setValue(_,S)},T=S=>{const N=S==="recto"?"photoRecto":S==="verso"?"photoVerso":"photoTicket";b.setValue(N,"")};return a.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-8",children:[a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Nouvelle Vente"}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Enregistrer une nouvelle vente de feux d'artifice"})]}),a.jsx(Li,{...b,children:a.jsxs("form",{onSubmit:b.handleSubmit(x),className:"space-y-8",children:[a.jsxs("div",{className:"modern-section",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(tm,{className:"h-5 w-5 text-blue-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Informations du vendeur"})]}),a.jsx("div",{className:"modern-card bg-blue-50 dark:bg-blue-900/20",children:a.jsx(Se,{control:b.control,name:"vendeur",render:({field:S})=>a.jsxs(ve,{children:[a.jsx(ye,{className:"text-gray-700 dark:text-gray-300",children:"Nom du vendeur"}),a.jsx(xe,{children:a.jsx(Te,{...S,className:"modern-input",placeholder:"Nom du vendeur"})}),a.jsx(we,{})]})})})]}),a.jsxs("div",{className:"modern-section",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(jp,{className:"h-5 w-5 text-green-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Produits vendus"})]}),a.jsxs(je,{type:"button",onClick:()=>w({typeArticle:"",categorie:"",quantite:"",gencode:""}),variant:"outline",size:"sm",className:"modern-button",children:[a.jsx(Cp,{className:"h-4 w-4 mr-2"}),"Ajouter un produit"]})]}),a.jsx("div",{className:"space-y-4",children:g.map((S,N)=>a.jsxs("div",{className:"modern-card bg-green-50 dark:bg-green-900/20",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("h3",{className:"font-medium text-gray-900 dark:text-white",children:["Produit ",N+1]}),g.length>1&&a.jsx(je,{type:"button",onClick:()=>v(N),variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700",children:a.jsx(WA,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx(Se,{control:b.control,name:`products.${N}.typeArticle`,render:({field:_})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Type d'article"}),a.jsxs(Sr,{onValueChange:_.onChange,value:_.value,children:[a.jsx(xe,{children:a.jsx(nr,{className:"modern-input",children:a.jsx(Nr,{placeholder:"Sélectionner le type"})})}),a.jsx(rr,{children:Object.keys(oy).map(E=>a.jsx(qt,{value:E,children:E},E))})]}),a.jsx(we,{})]})}),a.jsx(Se,{control:b.control,name:`products.${N}.categorie`,render:({field:_})=>{const E=b.watch(`products.${N}.typeArticle`),I=E?oy[E]||[]:[];return a.jsxs(ve,{children:[a.jsx(ye,{children:"Catégorie"}),a.jsxs(Sr,{onValueChange:_.onChange,value:_.value,disabled:!E,children:[a.jsx(xe,{children:a.jsx(nr,{className:"modern-input",children:a.jsx(Nr,{placeholder:"Sélectionner la catégorie"})})}),a.jsx(rr,{children:I.map(H=>a.jsx(qt,{value:H,children:H},H))})]}),a.jsx(we,{})]})}}),a.jsx(Se,{control:b.control,name:`products.${N}.quantite`,render:({field:_})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Quantité"}),a.jsx(xe,{children:a.jsx(Te,{..._,className:"modern-input",type:"number",min:"1",placeholder:"Quantité"})}),a.jsx(we,{})]})}),a.jsx(Se,{control:b.control,name:`products.${N}.gencode`,render:({field:_})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Code EAN-13"}),a.jsx(xe,{children:a.jsx(Te,{..._,className:"modern-input",placeholder:"Code EAN-13 (13 chiffres)",maxLength:13})}),a.jsx(we,{})]})})]})]},S.id))})]}),a.jsxs("div",{className:"modern-section",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(KA,{className:"h-5 w-5 text-purple-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Informations du client"})]}),a.jsx("div",{className:"modern-card bg-purple-50 dark:bg-purple-900/20",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx(Se,{control:b.control,name:"nom",render:({field:S})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Nom"}),a.jsx(xe,{children:a.jsx(Te,{...S,className:"modern-input",placeholder:"Nom"})}),a.jsx(we,{})]})}),a.jsx(Se,{control:b.control,name:"prenom",render:({field:S})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Prénom"}),a.jsx(xe,{children:a.jsx(Te,{...S,className:"modern-input",placeholder:"Prénom"})}),a.jsx(we,{})]})}),a.jsx(Se,{control:b.control,name:"dateNaissance",render:({field:S})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Date de naissance"}),a.jsx(xe,{children:a.jsx(Te,{...S,className:"modern-input",type:"date"})}),a.jsx(we,{})]})}),a.jsx(Se,{control:b.control,name:"lieuNaissance",render:({field:S})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Lieu de naissance"}),a.jsx(xe,{children:a.jsx(Te,{...S,className:"modern-input",placeholder:"Lieu de naissance"})}),a.jsx(we,{})]})}),a.jsx(Se,{control:b.control,name:"modePaiement",render:({field:S})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Mode de paiement"}),a.jsxs(Sr,{onValueChange:S.onChange,value:S.value,children:[a.jsx(xe,{children:a.jsx(nr,{className:"modern-input",children:a.jsx(Nr,{placeholder:"Mode de paiement"})})}),a.jsx(rr,{children:P4.map(N=>a.jsx(qt,{value:N,children:N},N))})]}),a.jsx(we,{})]})})]})})]}),a.jsxs("div",{className:"modern-section",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(DA,{className:"h-5 w-5 text-orange-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Pièce d'identité"})]}),a.jsxs("div",{className:"modern-card bg-orange-50 dark:bg-orange-900/20",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx(Se,{control:b.control,name:"typeIdentite",render:({field:S})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Type de pièce d'identité"}),a.jsxs(Sr,{onValueChange:S.onChange,value:S.value,children:[a.jsx(xe,{children:a.jsx(nr,{className:"modern-input",children:a.jsx(Nr,{placeholder:"Type d'identité"})})}),a.jsx(rr,{children:k4.map(N=>a.jsx(qt,{value:N,children:N},N))})]}),a.jsx(we,{})]})}),a.jsx(Se,{control:b.control,name:"numeroIdentite",render:({field:S})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Numéro de la pièce d'identité"}),a.jsx(xe,{children:a.jsx(Te,{...S,className:"modern-input",placeholder:"Numéro"})}),a.jsx(we,{})]})}),a.jsx(Se,{control:b.control,name:"autoriteDelivrance",render:({field:S})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Autorité de délivrance (optionnel)"}),a.jsx(xe,{children:a.jsx(Te,{...S,className:"modern-input",placeholder:"Autorité de délivrance"})}),a.jsx(we,{})]})}),a.jsx(Se,{control:b.control,name:"dateDelivrance",render:({field:S})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Date de délivrance"}),a.jsx(xe,{children:a.jsx(Te,{...S,className:"modern-input",type:"date"})}),a.jsx(we,{})]})})]}),a.jsxs("div",{className:"mt-6 pt-6 border-t border-orange-200 dark:border-orange-800",children:[a.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:"Photos de la pièce d'identité"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Photo Recto"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(je,{type:"button",onClick:()=>f("recto"),variant:"outline",size:"sm",className:"flex-1",children:[a.jsx(Cc,{className:"h-4 w-4 mr-2"}),b.watch("photoRecto")?"Reprendre":"Prendre"]}),b.watch("photoRecto")&&a.jsx(je,{type:"button",onClick:()=>T("recto"),variant:"outline",size:"sm",className:"text-red-600",children:a.jsx(no,{className:"h-4 w-4"})})]}),b.watch("photoRecto")&&a.jsx("div",{className:"text-xs text-green-600 dark:text-green-400",children:"✓ Photo capturée"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Photo Verso"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(je,{type:"button",onClick:()=>f("verso"),variant:"outline",size:"sm",className:"flex-1",children:[a.jsx(Cc,{className:"h-4 w-4 mr-2"}),b.watch("photoVerso")?"Reprendre":"Prendre"]}),b.watch("photoVerso")&&a.jsx(je,{type:"button",onClick:()=>T("verso"),variant:"outline",size:"sm",className:"text-red-600",children:a.jsx(no,{className:"h-4 w-4"})})]}),b.watch("photoVerso")&&a.jsx("div",{className:"text-xs text-green-600 dark:text-green-400",children:"✓ Photo capturée"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Photo Ticket"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(je,{type:"button",onClick:()=>f("ticket"),variant:"outline",size:"sm",className:"flex-1",children:[a.jsx(Cc,{className:"h-4 w-4 mr-2"}),b.watch("photoTicket")?"Reprendre":"Prendre"]}),b.watch("photoTicket")&&a.jsx(je,{type:"button",onClick:()=>T("ticket"),variant:"outline",size:"sm",className:"text-red-600",children:a.jsx(no,{className:"h-4 w-4"})})]}),b.watch("photoTicket")&&a.jsx("div",{className:"text-xs text-green-600 dark:text-green-400",children:"✓ Photo capturée"})]})]})]})]})]}),a.jsxs("div",{className:"flex justify-center gap-4 pt-6",children:[a.jsx(je,{type:"button",variant:"outline",onClick:()=>b.reset(),className:"modern-button",children:"Réinitialiser"}),a.jsxs(je,{type:"submit",disabled:s||m.isPending,className:"modern-button bg-green-600 hover:bg-green-700 text-white px-8",children:[a.jsx(HA,{className:"h-4 w-4 mr-2"}),s?"Enregistrement...":"Enregistrer la vente"]})]})]})}),a.jsx(U4,{isOpen:o,onClose:y,onCapture:j,currentPhotoType:l,isCapturing:c,videoRef:u,canvasRef:d,capturePhoto:p})]})}const W4="modulepreload",H4=function(e){return"/"+e},ly={},Ic=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=H4(c),c in ly)return;ly[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":W4,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((p,y)=>{f.addEventListener("load",p),f.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};var aT="AlertDialog",[Q4,AL]=Dr(aT,[$E]),Or=$E(),lT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Or(t);return a.jsx(rT,{...r,...n,modal:!0})};lT.displayName=aT;var q4="AlertDialogTrigger",cT=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Or(n);return a.jsx(sT,{...s,...r,ref:t})});cT.displayName=q4;var Z4="AlertDialogPortal",uT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Or(t);return a.jsx(iT,{...r,...n})};uT.displayName=Z4;var K4="AlertDialogOverlay",dT=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Or(n);return a.jsx(Om,{...s,...r,ref:t})});dT.displayName=K4;var uo="AlertDialogContent",[G4,X4]=Q4(uo),Y4=MS("AlertDialogContent"),fT=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,i=Or(n),o=h.useRef(null),l=ze(t,o),c=h.useRef(null);return a.jsx(F4,{contentName:uo,titleName:pT,docsSlug:"alert-dialog",children:a.jsx(G4,{scope:n,cancelRef:c,children:a.jsxs(Mm,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:ce(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(Y4,{children:r}),a.jsx(eL,{contentRef:o})]})})})});fT.displayName=uo;var pT="AlertDialogTitle",hT=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Or(n);return a.jsx(Fm,{...s,...r,ref:t})});hT.displayName=pT;var mT="AlertDialogDescription",gT=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Or(n);return a.jsx(Lm,{...s,...r,ref:t})});gT.displayName=mT;var J4="AlertDialogAction",vT=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Or(n);return a.jsx(Vm,{...s,...r,ref:t})});vT.displayName=J4;var yT="AlertDialogCancel",xT=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=X4(yT,n),i=Or(n),o=ze(t,s);return a.jsx(Vm,{...i,...r,ref:o})});xT.displayName=yT;var eL=({contentRef:e})=>{const t=`\`${uo}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${uo}\` by passing a \`${mT}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${uo}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return h.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},tL=lT,nL=cT,rL=uT,wT=dT,bT=fT,ST=vT,NT=xT,_T=hT,jT=gT;const Na=tL,_a=nL,sL=rL,CT=h.forwardRef(({className:e,...t},n)=>a.jsx(wT,{className:ie("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:n}));CT.displayName=wT.displayName;const $i=h.forwardRef(({className:e,...t},n)=>a.jsxs(sL,{children:[a.jsx(CT,{}),a.jsx(bT,{ref:n,className:ie("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),...t})]}));$i.displayName=bT.displayName;const Ui=({className:e,...t})=>a.jsx("div",{className:ie("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ui.displayName="AlertDialogHeader";const Bi=({className:e,...t})=>a.jsx("div",{className:ie("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Bi.displayName="AlertDialogFooter";const Wi=h.forwardRef(({className:e,...t},n)=>a.jsx(_T,{ref:n,className:ie("text-lg font-semibold",e),...t}));Wi.displayName=_T.displayName;const Hi=h.forwardRef(({className:e,...t},n)=>a.jsx(jT,{ref:n,className:ie("text-sm text-muted-foreground",e),...t}));Hi.displayName=jT.displayName;const Qi=h.forwardRef(({className:e,...t},n)=>a.jsx(ST,{ref:n,className:ie(vm(),e),...t}));Qi.displayName=ST.displayName;const qi=h.forwardRef(({className:e,...t},n)=>a.jsx(NT,{ref:n,className:ie(vm({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));qi.displayName=NT.displayName;async function iL(e){if(e.length!==0)try{const t=await Ic(()=>import("./exceljs.min-ZPdsRp2H.js").then(d=>d.e),[]),n=new t.Workbook,r=n.addWorksheet("Ventes");r.columns=[{header:"ID Vente",key:"id",width:8},{header:"Date",key:"date",width:12},{header:"Heure",key:"heure",width:8},{header:"Vendeur",key:"vendeur",width:15},{header:"Nom",key:"nom",width:15},{header:"Prénom",key:"prenom",width:15},{header:"Date de naissance",key:"dateNaissance",width:15},{header:"Lieu de naissance",key:"lieuNaissance",width:20},{header:"Type d'identité",key:"typeIdentite",width:15},{header:"Numéro d'identité",key:"numeroIdentite",width:15},{header:"Autorité de délivrance",key:"autoriteDeLivrance",width:20},{header:"Date de délivrance",key:"dateDelivrance",width:15},{header:"Mode de paiement",key:"modePaiement",width:15},{header:"Produit N°",key:"produitNumero",width:8},{header:"Type d'article",key:"typeArticle",width:20},{header:"Catégorie",key:"categorie",width:15},{header:"Quantité",key:"quantite",width:8},{header:"Code générique",key:"gencode",width:15}],e.forEach(d=>{d.products&&d.products.length>0?d.products.forEach((f,p)=>{r.addRow({id:d.id,date:fo(d.timestamp),heure:new Date(d.timestamp).toLocaleTimeString("fr-FR"),vendeur:d.vendeur,nom:d.nom,prenom:d.prenom,dateNaissance:d.dateNaissance||"",lieuNaissance:d.lieuNaissance||"",typeIdentite:d.typeIdentite||"",numeroIdentite:d.numeroIdentite||"",autoriteDeLivrance:d.autoriteDelivrance||"",dateDelivrance:d.dateDelivrance||"",modePaiement:d.modePaiement||"",produitNumero:p+1,typeArticle:f.typeArticle,categorie:f.categorie,quantite:f.quantite,gencode:f.gencode||""})}):r.addRow({id:d.id,date:fo(d.timestamp),heure:new Date(d.timestamp).toLocaleTimeString("fr-FR"),vendeur:d.vendeur,nom:d.nom,prenom:d.prenom,dateNaissance:d.dateNaissance||"",lieuNaissance:d.lieuNaissance||"",typeIdentite:d.typeIdentite||"",numeroIdentite:d.numeroIdentite||"",autoriteDeLivrance:d.autoriteDelivrance||"",dateDelivrance:d.dateDelivrance||"",modePaiement:d.modePaiement||"",produitNumero:"N/A",typeArticle:"N/A",categorie:"N/A",quantite:0,gencode:""})});const s=e.filter(d=>d.photo_recto||d.photo_verso||d.photo_ticket);if(s.length>0){const d=n.addWorksheet("Photos");d.columns=[{header:"ID Vente",key:"id",width:10},{header:"Date",key:"date",width:12},{header:"Client",key:"client",width:25},{header:"Vendeur",key:"vendeur",width:15},{header:"Photo Recto",key:"photoRecto",width:25},{header:"Photo Verso",key:"photoVerso",width:25},{header:"Photo Ticket",key:"photoTicket",width:25}];for(let f=0;f{const o=document.createElement("a");o.href=s,o.download=i,document.body.appendChild(o),o.click(),document.body.removeChild(o)};return a.jsx(zi,{open:e,onOpenChange:n,children:a.jsxs($s,{className:"mobile-modal-content max-w-4xl max-h-[90vh] overflow-y-auto slide-in-up",children:[a.jsx(Us,{className:"mobile-padding",children:a.jsx(Bs,{className:"responsive-title",children:"Détails de la Vente"})}),a.jsxs("div",{className:"mobile-spacing mobile-padding",children:[a.jsxs("div",{className:"border border-gray-200 p-4 bg-gray-50",children:[a.jsx("h4",{className:"font-medium text-gray-900 mb-3",children:"Informations Vendeur"}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Vendeur:"})," ",t.vendeur]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Date de vente:"})," ",Kp(t.timestamp)]})]})]}),a.jsxs("div",{className:"border border-gray-200 p-4 bg-white",children:[a.jsx("h4",{className:"font-medium text-gray-900 mb-3",children:"Informations Produits"}),t.products&&t.products.length>0?a.jsx("div",{className:"space-y-3",children:t.products.map((s,i)=>a.jsxs("div",{className:"border-l-4 border-blue-500 pl-3 bg-gray-50 p-2",children:[a.jsxs("div",{className:"text-sm font-medium text-gray-700 mb-1",children:["Produit ",i+1]}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Type d'article:"})," ",s.typeArticle]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Catégorie:"})," ",s.categorie]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Quantité:"})," ",s.quantite]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Code produit:"})," ",s.gencode||"Non spécifié"]})]})]},s.id||i))}):a.jsx("div",{className:"text-sm text-gray-500",children:"Aucun produit associé"})]}),a.jsxs("div",{className:"border border-gray-200 p-4 bg-gray-50",children:[a.jsx("h4",{className:"font-medium text-gray-900 mb-3",children:"Informations Client"}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Nom:"})," ",t.nom]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Prénom:"})," ",t.prenom]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Date de naissance:"})," ",t.dateNaissance?fo(t.dateNaissance):"Non spécifiée"]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Lieu de naissance:"})," ",t.lieuNaissance||"Non spécifié"]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Mode de paiement:"})," ",t.modePaiement||"Espèce"]})]})]}),a.jsxs("div",{className:"border border-gray-200 p-4 bg-white",children:[a.jsx("h4",{className:"font-medium text-gray-900 mb-3",children:"Pièce d'Identité"}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Type:"})," ",t.typeIdentite||"Non spécifié"]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Numéro:"})," ",t.numeroIdentite||"Non spécifié"]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Autorité de délivrance:"})," ",t.autoriteDelivrance||"Non spécifiée"]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Date de délivrance:"})," ",t.dateDelivrance?fo(t.dateDelivrance):"Non spécifiée"]})]})]}),(t.photo_recto||t.photo_verso||t.photo_ticket)&&a.jsxs("div",{className:"border border-gray-200 p-4 bg-white",children:[a.jsx("h4",{className:"font-medium text-gray-900 mb-4",children:"Photos"}),(t.photo_recto||t.photo_verso)&&a.jsxs("div",{className:"mb-6",children:[a.jsx("h5",{className:"text-sm font-medium text-gray-700 mb-3",children:"Pièce d'identité"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.photo_recto&&a.jsxs("div",{children:[a.jsx("span",{className:"text-xs text-gray-600 mb-2 block",children:"Photo Recto"}),a.jsx("img",{src:t.photo_recto,alt:"Photo recto",className:"w-full h-48 object-cover border mb-2"}),a.jsxs(je,{variant:"outline",size:"sm",onClick:()=>r(t.photo_recto,`vente-${t.id}-recto.jpg`),className:"w-full",children:[a.jsx(to,{className:"h-4 w-4 mr-2"}),"Télécharger Recto"]})]}),t.photo_verso&&a.jsxs("div",{children:[a.jsx("span",{className:"text-xs text-gray-600 mb-2 block",children:"Photo Verso"}),a.jsx("img",{src:t.photo_verso,alt:"Photo verso",className:"w-full h-48 object-cover border mb-2"}),a.jsxs(je,{variant:"outline",size:"sm",onClick:()=>r(t.photo_verso,`vente-${t.id}-verso.jpg`),className:"w-full",children:[a.jsx(to,{className:"h-4 w-4 mr-2"}),"Télécharger Verso"]})]})]})]}),t.photo_ticket&&a.jsxs("div",{children:[a.jsx("h5",{className:"text-sm font-medium text-gray-700 mb-3",children:"Ticket de caisse"}),a.jsxs("div",{className:"max-w-sm",children:[a.jsx("img",{src:t.photo_ticket,alt:"Photo ticket",className:"w-full h-auto border mb-2"}),a.jsxs(je,{variant:"outline",size:"sm",onClick:()=>r(t.photo_ticket,`vente-${t.id}-ticket.jpg`),className:"w-full",children:[a.jsx(to,{className:"h-4 w-4 mr-2"}),"Télécharger Ticket"]})]})]})]}),a.jsxs("div",{className:"border border-gray-200 p-4 bg-gray-50",children:[a.jsx("h4",{className:"font-medium text-gray-900 mb-3",children:"Informations Système"}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"ID:"})," ",t.id]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Timestamp:"})," ",Kp(t.timestamp)]})]})]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t border-gray-200",children:a.jsxs(je,{onClick:n,variant:"outline",children:[a.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Fermer"]})})]})})}function lL({canDelete:e=!1}){const{toast:t}=Zo(),n=qo(),{user:r}=Yo(),{selectedStoreId:s}=Pm(),[i,o]=h.useState(null),[l,c]=h.useState(""),[u,d]=h.useState(""),[f,p]=h.useState(""),{data:y,isLoading:b}=Zr({queryKey:["/api/sales",l,u,s],queryFn:async()=>{const S=new URLSearchParams;l&&S.append("startDate",l),u&&S.append("endDate",u),s&&S.append("storeId",s.toString());const N=S.toString();return(await nt(`/api/sales${N?`?${N}`:""}`)).json()},enabled:!!s&&!!r,refetchOnMount:!0,refetchOnWindowFocus:!1}),g=Array.isArray(y)?y:[],w=h.useMemo(()=>{if(!f.trim())return g;const S=f.toLowerCase().trim();return g.filter(N=>N.nom.toLowerCase().includes(S)||N.prenom.toLowerCase().includes(S)||N.vendeur.toLowerCase().includes(S)||N.typeArticle.toLowerCase().includes(S)||N.gencode.includes(S)||N.numeroIdentite.toLowerCase().includes(S)||N.lieuNaissance&&N.lieuNaissance.toLowerCase().includes(S)||N.modePaiement.toLowerCase().includes(S))},[g,f]),v=Qt({mutationFn:S=>nt(`/api/sales/${S}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["/api/sales"],exact:!1}),t({title:"Vente supprimée",description:"La vente a été supprimée avec succès",variant:"success"})},onError:()=>{t({title:"Erreur",description:"Impossible de supprimer la vente",variant:"destructive"})}}),m=S=>{v.mutate(S.id)},x=async()=>{if(w.length===0){t({title:"Aucune donnée",description:"Aucune vente à exporter",variant:"destructive"});return}try{const{default:S}=await Ic(async()=>{const{default:I}=await import("./jspdf.es.min-D4l-ggWr.js").then(H=>H.j);return{default:I}},[]),{default:N}=await Ic(async()=>{const{default:I}=await import("./jspdf.plugin.autotable-CfO62xhj.js");return{default:I}},[]),_=new S;if(_.setFont("helvetica"),_.setFontSize(16),_.text("Registre Détaillé des Ventes de Feux d'Artifice",20,20),_.setFontSize(10),_.text(`Généré le ${new Date().toLocaleDateString("fr-FR")} à ${new Date().toLocaleTimeString("fr-FR")}`,20,30),l||u){const I=`Période: ${l?new Date(l).toLocaleDateString("fr-FR"):"début"} - ${u?new Date(u).toLocaleDateString("fr-FR"):"fin"}`;_.text(I,20,35)}let E=l||u?50:45;w.forEach((I,H)=>{if(E>250&&(_.addPage(),E=20),_.setFontSize(12),_.setFont("helvetica","bold"),_.text(`VENTE #${I.id} - ${new Date(I.timestamp).toLocaleDateString("fr-FR")} ${new Date(I.timestamp).toLocaleTimeString("fr-FR")}`,20,E),E+=10,_.setFontSize(10),_.setFont("helvetica","normal"),_.text(`Vendeur: ${I.vendeur}`,20,E),E+=8,_.setFont("helvetica","bold"),_.text("INFORMATIONS CLIENT:",20,E),E+=6,_.setFont("helvetica","normal"),_.text(`Nom: ${I.nom} ${I.prenom}`,25,E),E+=5,_.text(`Date de naissance: ${I.dateNaissance||"Non spécifiée"}`,25,E),E+=5,_.text(`Lieu de naissance: ${I.lieuNaissance||"Non spécifié"}`,25,E),E+=5,_.text(`Mode de paiement: ${I.modePaiement||"Non spécifié"}`,25,E),E+=8,_.setFont("helvetica","bold"),_.text("PIÈCE D'IDENTITÉ:",20,E),E+=6,_.setFont("helvetica","normal"),_.text(`Type: ${I.typeIdentite||"Non spécifié"}`,25,E),E+=5,_.text(`Numéro: ${I.numeroIdentite||"Non spécifié"}`,25,E),E+=5,_.text(`Autorité de délivrance: ${I.autoriteDelivrance||"Non spécifiée"}`,25,E),E+=5,_.text(`Date de délivrance: ${I.dateDelivrance||"Non spécifiée"}`,25,E),E+=8,_.setFont("helvetica","bold"),_.text("PRODUITS VENDUS:",20,E),E+=6,I.products&&I.products.length>0?I.products.forEach((M,z)=>{_.setFont("helvetica","normal"),_.text(`Produit ${z+1}:`,25,E),E+=5,_.text(` • Type: ${M.typeArticle}`,30,E),E+=4,_.text(` • Catégorie: ${M.categorie}`,30,E),E+=4,_.text(` • Quantité: ${M.quantite}`,30,E),E+=4,_.text(` • Code: ${M.gencode||"Non spécifié"}`,30,E),E+=6}):(_.setFont("helvetica","normal"),_.text("Aucun produit enregistré",25,E),E+=6),I.photoRecto||I.photoVerso||I.photoTicket){_.setFont("helvetica","bold"),_.text("DOCUMENTS PHOTOGRAPHIÉS:",20,E),E+=8;const M=80,z=60;let F=20;if(I.photoRecto){E+z>280&&(_.addPage(),E=20),_.setFont("helvetica","normal"),_.text("Photo recto pièce d'identité:",F,E),E+=5;try{_.addImage(I.photoRecto,"JPEG",F,E,M,z),E+=z+5}catch{_.text("Photo non disponible (format non supporté)",F,E),E+=5}}if(I.photoVerso){E+z>280&&(_.addPage(),E=20),_.setFont("helvetica","normal"),_.text("Photo verso pièce d'identité:",F,E),E+=5;try{_.addImage(I.photoVerso,"JPEG",F,E,M,z),E+=z+5}catch{_.text("Photo non disponible (format non supporté)",F,E),E+=5}}if(I.photoTicket){E+z>280&&(_.addPage(),E=20),_.setFont("helvetica","normal"),_.text("Photo ticket/reçu:",F,E),E+=5;try{_.addImage(I.photoTicket,"JPEG",F,E,M,z),E+=z+5}catch{_.text("Photo non disponible (format non supporté)",F,E),E+=5}}E+=5}H{c(""),d(""),p("")},T=async()=>{if(w.length===0){t({title:"Aucune donnée",description:"Aucune vente à exporter",variant:"destructive"});return}try{const{exportToExcel:S}=await Ic(async()=>{const{exportToExcel:N}=await Promise.resolve().then(()=>oL);return{exportToExcel:N}},void 0);await S(w),t({title:"Export réussi",description:"Le fichier Excel a été téléchargé",variant:"success"})}catch(S){console.error("Erreur lors de l'export Excel:",S),t({title:"Erreur d'export",description:"Impossible de générer le fichier Excel",variant:"destructive"})}};return b?a.jsx("div",{className:"elegant-card",children:a.jsx("div",{className:"p-6",children:a.jsxs("div",{className:"animate-pulse space-y-4",children:[a.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/4"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/3"})]})})}):a.jsxs("div",{className:"space-y-6 animate-slide-in",children:[a.jsxs("div",{className:"search-container",children:[a.jsxs("div",{className:"search-header",children:[a.jsx(QA,{className:"h-5 w-5"}),a.jsx("span",{children:"Rechercher dans l'historique"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Te,{placeholder:"Rechercher par nom, prénom, vendeur, article, code...",value:f,onChange:S=>p(S.target.value),className:"search-input pr-10"}),f&&a.jsx("button",{onClick:()=>p(""),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",children:a.jsx(Oo,{className:"h-4 w-4"})})]}),f&&a.jsxs("div",{className:"text-sm text-gray-600",children:[w.length," résultat",w.length>1?"s":""," trouvé",w.length>1?"s":""," sur ",g.length," vente",g.length>1?"s":""]})]})]}),a.jsxs("div",{className:"filters-container",children:[a.jsxs("div",{className:"section-header mb-4",children:[a.jsx(zA,{className:"h-5 w-5"}),a.jsx("span",{children:"Filtres par date"})]}),a.jsxs("div",{className:"filters-grid",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2",children:"Date de début"}),a.jsx(Te,{type:"date",value:l,onChange:S=>c(S.target.value),className:"modern-input"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2",children:"Date de fin"}),a.jsx(Te,{type:"date",value:u,onChange:S=>d(S.target.value),className:"modern-input"})]}),a.jsx("div",{className:"flex items-end",children:a.jsxs("button",{onClick:j,className:"modern-button modern-button-secondary",children:[a.jsx(Oo,{className:"h-4 w-4"}),"Effacer"]})})]})]}),a.jsx("div",{className:"elegant-card",children:a.jsx("div",{className:"p-4",children:a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-600",children:[a.jsx(uN,{className:"h-5 w-5"}),a.jsxs("span",{className:"font-medium",children:[w.length," vente",w.length>1?"s":""]})]}),f&&a.jsx("div",{className:"text-sm text-blue-600 bg-blue-50 px-2 py-1 rounded",children:"Recherche active"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:x,disabled:w.length===0,className:"modern-button modern-button-secondary",children:[a.jsx(VA,{className:"h-4 w-4"}),"Registre PDF Détaillé"]}),a.jsxs("button",{onClick:T,disabled:w.length===0,className:"modern-button modern-button-secondary",children:[a.jsx(to,{className:"h-4 w-4"}),"Export Excel (.xlsx)"]})]})]})})}),a.jsx("div",{className:"elegant-card",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"modern-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Date et Heure"}),a.jsx("th",{children:"Vendeur"}),a.jsx("th",{children:"Client"}),a.jsx("th",{children:"Article"}),a.jsx("th",{children:"Cat."}),a.jsx("th",{children:"Qté"}),a.jsx("th",{children:"Paiement"}),a.jsx("th",{children:"Actions"})]})}),a.jsx("tbody",{children:w.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"text-center py-8 text-gray-500",children:f?"Aucun résultat pour cette recherche":"Aucune vente enregistrée"})}):w.map(S=>a.jsxs("tr",{children:[a.jsxs("td",{className:"font-mono text-sm",children:[a.jsx("div",{children:new Date(S.timestamp).toLocaleDateString("fr-FR")}),a.jsx("div",{className:"text-xs text-gray-500",children:new Date(S.timestamp).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("td",{className:"font-medium",children:S.vendeur}),a.jsx("td",{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(tm,{className:"h-4 w-4 text-gray-400"}),a.jsxs("span",{children:[S.nom," ",S.prenom]})]})}),a.jsx("td",{className:"text-sm",children:S.typeArticle}),a.jsx("td",{children:a.jsx("span",{className:`modern-badge ${S.categorie==="F3"?"badge-destructive":"badge-secondary"}`,children:S.categorie})}),a.jsx("td",{className:"text-center",children:S.quantite}),a.jsx("td",{className:"text-sm",children:S.modePaiement}),a.jsx("td",{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>o(S),className:"p-2 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",children:a.jsx(LA,{className:"h-4 w-4"})}),e&&a.jsxs(Na,{children:[a.jsx(_a,{asChild:!0,children:a.jsx("button",{className:"p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors",children:a.jsx(no,{className:"h-4 w-4"})})}),a.jsxs($i,{children:[a.jsxs(Ui,{children:[a.jsx(Wi,{children:"Supprimer la vente"}),a.jsxs(Hi,{children:["Êtes-vous sûr de vouloir supprimer cette vente ?",a.jsxs("div",{className:"mt-2 p-3 bg-gray-50 rounded-lg",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Client :"})," ",S.nom," ",S.prenom]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Article :"})," ",S.typeArticle]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Date :"})," ",new Date(S.timestamp).toLocaleDateString("fr-FR")]})]}),"Cette action est irréversible."]})]}),a.jsxs(Bi,{children:[a.jsx(qi,{children:"Annuler"}),a.jsx(Qi,{onClick:()=>m(S),className:"bg-red-600 hover:bg-red-700",children:"Supprimer"})]})]})]})]})})]},S.id))})]})})}),a.jsx(aL,{isOpen:!!i,sale:i,onClose:()=>o(null)})]})}const Gp=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:ie("w-full caption-bottom text-sm",e),...t})}));Gp.displayName="Table";const Xp=h.forwardRef(({className:e,...t},n)=>a.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));Xp.displayName="TableHeader";const Yp=h.forwardRef(({className:e,...t},n)=>a.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));Yp.displayName="TableBody";const cL=h.forwardRef(({className:e,...t},n)=>a.jsx("tfoot",{ref:n,className:ie("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));cL.displayName="TableFooter";const ja=h.forwardRef(({className:e,...t},n)=>a.jsx("tr",{ref:n,className:ie("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));ja.displayName="TableRow";const tn=h.forwardRef(({className:e,...t},n)=>a.jsx("th",{ref:n,className:ie("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));tn.displayName="TableHead";const nn=h.forwardRef(({className:e,...t},n)=>a.jsx("td",{ref:n,className:ie("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));nn.displayName="TableCell";const uL=h.forwardRef(({className:e,...t},n)=>a.jsx("caption",{ref:n,className:ie("mt-4 text-sm text-muted-foreground",e),...t}));uL.displayName="TableCaption";const dL=Tl("inline-flex items-center rounded-full 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",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function pf({className:e,variant:t,...n}){return a.jsx("div",{className:ie(dL({variant:t}),e),...n})}const fL=NC.extend({confirmPassword:st.string()}).refine(e=>e.password===e.confirmPassword,{message:"Les mots de passe ne correspondent pas",path:["confirmPassword"]}),pL=NC.partial().extend({id:st.number(),password:st.string().optional(),confirmPassword:st.string().optional()}).refine(e=>e.password||e.confirmPassword?e.password===e.confirmPassword:!0,{message:"Les mots de passe ne correspondent pas",path:["confirmPassword"]}),hL=_C.extend({id:st.number()});function mL(){const{toast:e}=Zo(),t=qo(),[n,r]=h.useState(!1),[s,i]=h.useState(!1),[o,l]=h.useState(null),[c,u]=h.useState(null),{data:d}=Zr({queryKey:["/api/auth/me"],queryFn:async()=>(await nt("/api/auth/me")).json()}),{data:f=[],isLoading:p}=Zr({queryKey:["/api/admin/users"],queryFn:async()=>(await nt("/api/admin/users")).json()}),{data:y=[],isLoading:b}=Zr({queryKey:["/api/admin/stores"],queryFn:async()=>(await nt("/api/admin/stores")).json()}),{data:g}=Zr({queryKey:["/api/admin/backup/stats"],queryFn:async()=>(await nt("/api/admin/backup/stats")).json(),refetchInterval:3e4}),{data:w}=Zr({queryKey:["/api/admin/purge/stats"],queryFn:async()=>(await nt("/api/admin/purge/stats")).json(),refetchInterval:3e4}),v=Qt({mutationFn:async C=>{const{confirmPassword:se,...ue}=C;return(await nt("/api/admin/users",{method:"POST",body:JSON.stringify(ue)})).json()},onSuccess:()=>{t.invalidateQueries({queryKey:["/api/admin/users"]}),r(!1),N.reset(),e({title:"Utilisateur créé avec succès",variant:"success"})},onError:()=>{e({title:"Erreur",description:"Impossible de créer l'utilisateur",variant:"destructive"})}}),m=Qt({mutationFn:async C=>{const{id:se,confirmPassword:ue,...pe}=C;return(await nt(`/api/admin/users/${se}`,{method:"PUT",body:JSON.stringify(pe)})).json()},onSuccess:()=>{t.invalidateQueries({queryKey:["/api/admin/users"]}),l(null),_.reset(),e({title:"Utilisateur modifié avec succès",variant:"success"})},onError:C=>{let se="Impossible de modifier l'utilisateur";C.message.includes("Vous ne pouvez pas changer votre propre rôle")?se="Vous ne pouvez pas changer votre propre rôle d'administrateur":C.message.includes("Impossible de modifier le rôle du dernier administrateur")&&(se="Impossible de modifier le rôle du dernier administrateur"),e({title:"Erreur",description:se,variant:"destructive"})}}),x=Qt({mutationFn:async C=>{await nt(`/api/admin/users/${C}`,{method:"DELETE"})},onSuccess:()=>{t.invalidateQueries({queryKey:["/api/admin/users"]}),e({title:"Utilisateur supprimé avec succès",variant:"success"})},onError:()=>{e({title:"Erreur",description:"Impossible de supprimer l'utilisateur",variant:"destructive"})}}),j=Qt({mutationFn:async C=>(await nt("/api/admin/stores",{method:"POST",body:JSON.stringify(C)})).json(),onSuccess:()=>{t.invalidateQueries({queryKey:["/api/admin/stores"]}),i(!1),E.reset(),e({title:"Magasin créé avec succès",variant:"success"})},onError:()=>{e({title:"Erreur",description:"Impossible de créer le magasin",variant:"destructive"})}}),T=Qt({mutationFn:async C=>{const{id:se,...ue}=C;return(await nt(`/api/admin/stores/${se}`,{method:"PUT",body:JSON.stringify(ue)})).json()},onSuccess:()=>{t.invalidateQueries({queryKey:["/api/admin/stores"]}),u(null),I.reset(),e({title:"Magasin modifié avec succès",variant:"success"})},onError:()=>{e({title:"Erreur",description:"Impossible de modifier le magasin",variant:"destructive"})}}),S=Qt({mutationFn:async C=>{await nt(`/api/admin/stores/${C}`,{method:"DELETE"})},onSuccess:()=>{t.invalidateQueries({queryKey:["/api/admin/stores"]}),e({title:"Magasin supprimé avec succès",variant:"success"})},onError:()=>{e({title:"Erreur",description:"Impossible de supprimer le magasin",variant:"destructive"})}}),N=Fi({resolver:ya(fL),defaultValues:{username:"",password:"",confirmPassword:"",email:"",firstName:"",lastName:"",role:"employee",storeId:void 0,isActive:!0}}),_=Fi({resolver:ya(pL)}),E=Fi({resolver:ya(_C),defaultValues:{name:"",address:"",phone:"",email:"",isActive:!0}}),I=Fi({resolver:ya(hL)}),H=async C=>{await v.mutateAsync(C)},M=async C=>{if((o==null?void 0:o.id)===(d==null?void 0:d.id)){const{role:ue,...pe}=C;await m.mutateAsync(pe)}else await m.mutateAsync(C)},z=async C=>{await j.mutateAsync(C)},F=async C=>{await T.mutateAsync(C)},ee=C=>{l(C),_.reset({id:C.id,username:C.username,email:C.email||"",firstName:C.firstName||"",lastName:C.lastName||"",role:C.role,storeId:C.storeId||void 0,isActive:C.isActive,password:"",confirmPassword:""})},q=C=>{u(C),I.reset({id:C.id,name:C.name,address:C.address||"",phone:C.phone||"",email:C.email||"",isActive:C.isActive})},oe=C=>{x.mutate(C.id)},D=C=>{S.mutate(C.id)},U=Qt({mutationFn:async()=>(await nt("/api/admin/backup/export")).json(),onSuccess:C=>{const se=new Blob([JSON.stringify(C,null,2)],{type:"application/json"}),ue=URL.createObjectURL(se),pe=document.createElement("a");pe.href=ue,pe.download=`backup_${new Date().toISOString().split("T")[0]}_${Date.now()}.json`,document.body.appendChild(pe),pe.click(),document.body.removeChild(pe),URL.revokeObjectURL(ue),e({title:"Sauvegarde exportée",description:"Le fichier de sauvegarde a été téléchargé",variant:"success"})},onError:()=>{e({title:"Erreur",description:"Impossible d'exporter la sauvegarde",variant:"destructive"})}}),Y=Qt({mutationFn:async C=>(await nt("/api/admin/backup/import",{method:"POST",body:JSON.stringify(C)})).json(),onSuccess:()=>{t.clear(),e({title:"Sauvegarde importée",description:"Les données ont été restaurées avec succès",variant:"success"})},onError:()=>{e({title:"Erreur",description:"Impossible d'importer la sauvegarde",variant:"destructive"})}}),ae=Qt({mutationFn:async()=>(await nt("/api/admin/backup/create",{method:"POST"})).json(),onSuccess:C=>{t.invalidateQueries({queryKey:["/api/admin/backup/stats"]}),e({title:"Sauvegarde créée",description:`Sauvegarde automatique créée: ${C.filename}`,variant:"success"})},onError:C=>{e({title:"Erreur de sauvegarde",description:C.message||"Impossible de créer la sauvegarde",variant:"destructive"})}}),Re=()=>{U.mutate()},ct=()=>{const C=document.createElement("input");C.type="file",C.accept=".json",C.onchange=se=>{var pe;const ue=(pe=se.target.files)==null?void 0:pe[0];if(ue){const Ee=new FileReader;Ee.onload=Ie=>{var yt;try{const jt=JSON.parse((yt=Ie.target)==null?void 0:yt.result);Y.mutate(jt)}catch{e({title:"Erreur",description:"Fichier de sauvegarde invalide",variant:"destructive"})}},Ee.readAsText(ue)}},C.click()},Ue=Qt({mutationFn:async()=>(await nt("/api/admin/purge/execute",{method:"POST"})).json(),onSuccess:C=>{t.invalidateQueries({queryKey:["/api/admin/purge/stats"]}),t.invalidateQueries({queryKey:["/api/sales"]}),e({title:"Purge exécutée avec succès",description:C.message||`${C.deletedCount} vente(s) supprimée(s)`,variant:"success"})},onError:C=>{e({title:"Erreur de purge",description:C.message||"Impossible d'exécuter la purge",variant:"destructive"})}}),Ot=()=>{Ue.mutate()},ht=C=>{const se={administrator:"destructive",manager:"default",employee:"secondary"},ue={administrator:"Administrateur",manager:"Manager",employee:"Employé"};return a.jsx(pf,{variant:se[C]||"secondary",children:ue[C]||C})};return a.jsxs(Hn,{children:[a.jsx(Qn,{children:a.jsxs(qn,{className:"flex items-center gap-2",children:[a.jsx(Ep,{className:"h-5 w-5"}),"Administration"]})}),a.jsx(Zn,{children:a.jsxs(LE,{defaultValue:"users",className:"space-y-4",children:[a.jsxs(km,{children:[a.jsx(as,{value:"users",children:"Utilisateurs"}),a.jsx(as,{value:"stores",children:"Magasins"}),a.jsx(as,{value:"backup",children:"Sauvegarde"}),a.jsx(as,{value:"purge",children:"Purge"})]}),a.jsxs(ls,{value:"users",className:"space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[a.jsx(tm,{className:"h-5 w-5"}),"Gestion des Utilisateurs"]}),a.jsxs(zi,{open:n,onOpenChange:r,children:[a.jsx(ay,{asChild:!0,children:a.jsxs(je,{children:[a.jsx(Cp,{className:"h-4 w-4 mr-2"}),"Nouvel Utilisateur"]})}),a.jsxs($s,{children:[a.jsxs(Us,{children:[a.jsx(Bs,{children:"Créer un nouvel utilisateur"}),a.jsx(Sa,{children:"Ajoutez un nouvel utilisateur au système"})]}),a.jsx(Li,{...N,children:a.jsxs("form",{onSubmit:N.handleSubmit(H),className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Se,{control:N.control,name:"username",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Nom d'utilisateur *"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})}),a.jsx(Se,{control:N.control,name:"email",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Email"}),a.jsx(xe,{children:a.jsx(Te,{type:"email",...C})}),a.jsx(we,{})]})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Se,{control:N.control,name:"firstName",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Prénom"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})}),a.jsx(Se,{control:N.control,name:"lastName",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Nom"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Se,{control:N.control,name:"password",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Mot de passe *"}),a.jsx(xe,{children:a.jsx(Te,{type:"password",...C})}),a.jsx(we,{})]})}),a.jsx(Se,{control:N.control,name:"confirmPassword",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Confirmer le mot de passe *"}),a.jsx(xe,{children:a.jsx(Te,{type:"password",...C})}),a.jsx(we,{})]})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Se,{control:N.control,name:"role",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Rôle *"}),a.jsxs(Sr,{value:C.value,onValueChange:C.onChange,children:[a.jsx(xe,{children:a.jsx(nr,{children:a.jsx(Nr,{})})}),a.jsxs(rr,{children:[a.jsx(qt,{value:"employee",children:"Employé"}),a.jsx(qt,{value:"manager",children:"Manager"}),a.jsx(qt,{value:"administrator",children:"Administrateur"})]})]}),a.jsx(we,{})]})}),a.jsx(Se,{control:N.control,name:"storeId",render:({field:C})=>{var se;return a.jsxs(ve,{children:[a.jsx(ye,{children:"Magasin"}),a.jsxs(Sr,{value:(se=C.value)==null?void 0:se.toString(),onValueChange:ue=>C.onChange(ue?parseInt(ue):void 0),children:[a.jsx(xe,{children:a.jsx(nr,{children:a.jsx(Nr,{placeholder:"Sélectionner un magasin"})})}),a.jsx(rr,{children:y.map(ue=>a.jsx(qt,{value:ue.id.toString(),children:ue.name},ue.id))})]}),a.jsx(we,{})]})}})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(je,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Annuler"}),a.jsx(je,{type:"submit",disabled:v.isPending,children:v.isPending?"Création...":"Créer"})]})]})})]})]})]}),p?a.jsx("div",{children:"Chargement..."}):a.jsxs(Gp,{children:[a.jsx(Xp,{children:a.jsxs(ja,{children:[a.jsx(tn,{children:"Utilisateur"}),a.jsx(tn,{children:"Email"}),a.jsx(tn,{children:"Rôle"}),a.jsx(tn,{children:"Magasin"}),a.jsx(tn,{children:"Statut"}),a.jsx(tn,{children:"Actions"})]})}),a.jsx(Yp,{children:f.map(C=>{var se;return a.jsxs(ja,{children:[a.jsx(nn,{children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:C.username}),(C.firstName||C.lastName)&&a.jsxs("div",{className:"text-sm text-muted-foreground",children:[C.firstName," ",C.lastName]})]})}),a.jsx(nn,{children:C.email||"-"}),a.jsx(nn,{children:ht(C.role)}),a.jsx(nn,{children:C.role==="administrator"?"Tous":((se=y.find(ue=>ue.id===C.storeId))==null?void 0:se.name)||"-"}),a.jsx(nn,{children:a.jsx(pf,{variant:C.isActive?"default":"secondary",children:C.isActive?"Actif":"Inactif"})}),a.jsx(nn,{children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(je,{variant:"ghost",size:"sm",onClick:()=>ee(C),children:a.jsx(gv,{className:"h-4 w-4"})}),a.jsxs(Na,{children:[a.jsx(_a,{asChild:!0,children:a.jsx(je,{variant:"ghost",size:"sm",disabled:C.role==="administrator",children:a.jsx(no,{className:"h-4 w-4 text-red-600"})})}),a.jsxs($i,{children:[a.jsxs(Ui,{children:[a.jsx(Wi,{children:"Confirmer la suppression"}),a.jsxs(Hi,{children:[`Êtes-vous sûr de vouloir supprimer l'utilisateur "`,C.username,'" ? Cette action est irréversible.',a.jsx("br",{}),a.jsx("br",{}),a.jsx("strong",{children:"Nom complet :"})," ",C.firstName," ",C.lastName,a.jsx("br",{}),a.jsx("strong",{children:"Email :"})," ",C.email||"Non renseigné",a.jsx("br",{}),a.jsx("strong",{children:"Rôle :"})," ",C.role]})]}),a.jsxs(Bi,{children:[a.jsx(qi,{children:"Annuler"}),a.jsx(Qi,{onClick:()=>oe(C),className:"bg-red-600 hover:bg-red-700",children:"Supprimer"})]})]})]})]})})]},C.id)})})]}),a.jsx(zi,{open:!!o,onOpenChange:C=>!C&&l(null),children:a.jsxs($s,{children:[a.jsxs(Us,{children:[a.jsx(Bs,{children:"Modifier l'utilisateur"}),a.jsx(Sa,{children:"Modifiez les informations de l'utilisateur"})]}),o&&a.jsx(Li,{..._,children:a.jsxs("form",{onSubmit:_.handleSubmit(M),className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Se,{control:_.control,name:"username",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Nom d'utilisateur"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})}),a.jsx(Se,{control:_.control,name:"email",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Email"}),a.jsx(xe,{children:a.jsx(Te,{type:"email",...C})}),a.jsx(we,{})]})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Se,{control:_.control,name:"firstName",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Prénom"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})}),a.jsx(Se,{control:_.control,name:"lastName",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Nom"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Se,{control:_.control,name:"password",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Nouveau mot de passe (optionnel)"}),a.jsx(xe,{children:a.jsx(Te,{type:"password",...C})}),a.jsx(we,{})]})}),a.jsx(Se,{control:_.control,name:"confirmPassword",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Confirmer le mot de passe"}),a.jsx(xe,{children:a.jsx(Te,{type:"password",...C})}),a.jsx(we,{})]})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Se,{control:_.control,name:"role",render:({field:C})=>{const se=(o==null?void 0:o.id)===(d==null?void 0:d.id);return a.jsxs(ve,{children:[a.jsx(ye,{children:"Rôle"}),a.jsxs(Sr,{value:C.value,onValueChange:C.onChange,disabled:se,children:[a.jsx(xe,{children:a.jsx(nr,{children:a.jsx(Nr,{})})}),a.jsxs(rr,{children:[a.jsx(qt,{value:"employee",children:"Employé"}),a.jsx(qt,{value:"manager",children:"Manager"}),a.jsx(qt,{value:"administrator",children:"Administrateur"})]})]}),se&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"Vous ne pouvez pas modifier votre propre rôle"}),a.jsx(we,{})]})}}),(o==null?void 0:o.id)!==(d==null?void 0:d.id)&&a.jsx(Se,{control:_.control,name:"storeId",render:({field:C})=>{var se;return a.jsxs(ve,{children:[a.jsx(ye,{children:"Magasin"}),a.jsxs(Sr,{value:(se=C.value)==null?void 0:se.toString(),onValueChange:ue=>C.onChange(parseInt(ue)),children:[a.jsx(xe,{children:a.jsx(nr,{children:a.jsx(Nr,{placeholder:"Sélectionner un magasin"})})}),a.jsx(rr,{children:y.map(ue=>a.jsx(qt,{value:ue.id.toString(),children:ue.name},ue.id))})]}),a.jsx(we,{})]})}})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(je,{type:"button",variant:"outline",onClick:()=>l(null),children:"Annuler"}),a.jsx(je,{type:"submit",disabled:m.isPending,children:m.isPending?"Modification...":"Modifier"})]})]})})]})})]}),a.jsxs(ls,{value:"stores",className:"space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[a.jsx(_p,{className:"h-5 w-5"}),"Gestion des Magasins"]}),a.jsxs(zi,{open:s,onOpenChange:i,children:[a.jsx(ay,{asChild:!0,children:a.jsxs(je,{children:[a.jsx(Cp,{className:"h-4 w-4 mr-2"}),"Nouveau Magasin"]})}),a.jsxs($s,{children:[a.jsxs(Us,{children:[a.jsx(Bs,{children:"Créer un nouveau magasin"}),a.jsx(Sa,{children:"Ajoutez un nouveau magasin au système"})]}),a.jsx(Li,{...E,children:a.jsxs("form",{onSubmit:E.handleSubmit(z),className:"space-y-4",children:[a.jsx(Se,{control:E.control,name:"name",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Nom du magasin *"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})}),a.jsx(Se,{control:E.control,name:"address",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Adresse"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Se,{control:E.control,name:"phone",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Téléphone"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})}),a.jsx(Se,{control:E.control,name:"email",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Email"}),a.jsx(xe,{children:a.jsx(Te,{type:"email",...C})}),a.jsx(we,{})]})})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(je,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Annuler"}),a.jsx(je,{type:"submit",disabled:j.isPending,children:j.isPending?"Création...":"Créer"})]})]})})]})]})]}),b?a.jsx("div",{children:"Chargement..."}):a.jsxs(Gp,{children:[a.jsx(Xp,{children:a.jsxs(ja,{children:[a.jsx(tn,{children:"Nom"}),a.jsx(tn,{children:"Adresse"}),a.jsx(tn,{children:"Téléphone"}),a.jsx(tn,{children:"Email"}),a.jsx(tn,{children:"Statut"}),a.jsx(tn,{children:"Actions"})]})}),a.jsx(Yp,{children:y.map(C=>a.jsxs(ja,{children:[a.jsx(nn,{className:"font-medium",children:C.name}),a.jsx(nn,{children:C.address||"-"}),a.jsx(nn,{children:C.phone||"-"}),a.jsx(nn,{children:C.email||"-"}),a.jsx(nn,{children:a.jsx(pf,{variant:C.isActive?"default":"secondary",children:C.isActive?"Actif":"Inactif"})}),a.jsx(nn,{children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(je,{variant:"ghost",size:"sm",onClick:()=>q(C),children:a.jsx(gv,{className:"h-4 w-4"})}),a.jsxs(Na,{children:[a.jsx(_a,{asChild:!0,children:a.jsx(je,{variant:"ghost",size:"sm",children:a.jsx(no,{className:"h-4 w-4 text-red-600"})})}),a.jsxs($i,{children:[a.jsxs(Ui,{children:[a.jsx(Wi,{children:"Confirmer la suppression"}),a.jsxs(Hi,{children:['Êtes-vous sûr de vouloir supprimer le magasin "',C.name,'" ? Cette action est irréversible.',a.jsx("br",{}),a.jsx("br",{}),a.jsx("strong",{children:"Adresse :"})," ",C.address||"Non renseignée",a.jsx("br",{}),a.jsx("strong",{children:"Téléphone :"})," ",C.phone||"Non renseigné",a.jsx("br",{}),a.jsx("strong",{children:"Email :"})," ",C.email||"Non renseigné"]})]}),a.jsxs(Bi,{children:[a.jsx(qi,{children:"Annuler"}),a.jsx(Qi,{onClick:()=>D(C),className:"bg-red-600 hover:bg-red-700",children:"Supprimer"})]})]})]})]})})]},C.id))})]}),a.jsx(zi,{open:!!c,onOpenChange:C=>!C&&u(null),children:a.jsxs($s,{children:[a.jsxs(Us,{children:[a.jsx(Bs,{children:"Modifier le magasin"}),a.jsx(Sa,{children:"Modifiez les informations du magasin"})]}),c&&a.jsx(Li,{...I,children:a.jsxs("form",{onSubmit:I.handleSubmit(F),className:"space-y-4",children:[a.jsx(Se,{control:I.control,name:"name",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Nom du magasin"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})}),a.jsx(Se,{control:I.control,name:"address",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Adresse"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Se,{control:I.control,name:"phone",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Téléphone"}),a.jsx(xe,{children:a.jsx(Te,{...C})}),a.jsx(we,{})]})}),a.jsx(Se,{control:I.control,name:"email",render:({field:C})=>a.jsxs(ve,{children:[a.jsx(ye,{children:"Email"}),a.jsx(xe,{children:a.jsx(Te,{type:"email",...C})}),a.jsx(we,{})]})})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(je,{type:"button",variant:"outline",onClick:()=>u(null),children:"Annuler"}),a.jsx(je,{type:"submit",disabled:T.isPending,children:T.isPending?"Modification...":"Modifier"})]})]})})]})})]}),a.jsxs(ls,{value:"backup",className:"space-y-4",children:[a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[a.jsx(FA,{className:"h-5 w-5"}),"Gestion des Sauvegardes"]})}),a.jsxs(Hn,{children:[a.jsx(Qn,{children:a.jsxs(qn,{className:"flex items-center gap-2",children:[a.jsx($d,{className:"h-5 w-5"}),"Sauvegarde Automatique"]})}),a.jsxs(Zn,{children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-green-600",children:(g==null?void 0:g.totalBackups)||0}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Sauvegardes disponibles"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-blue-600",children:"12h"}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Intervalle automatique"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-purple-600",children:"10"}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Maximum conservées"})]})]}),a.jsx("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(mv,{className:"h-4 w-4"}),a.jsx("span",{children:"Prochaine sauvegarde automatique : 00:00 ou 12:00"})]})}),a.jsx("div",{className:"mt-4",children:a.jsxs(je,{onClick:()=>ae.mutate(),disabled:ae.isPending,variant:"outline",className:"w-full",children:[a.jsx($d,{className:"h-4 w-4 mr-2"}),ae.isPending?"Création en cours...":"Créer une Sauvegarde Manuelle"]})})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(Hn,{children:[a.jsx(Qn,{children:a.jsxs(qn,{className:"flex items-center gap-2",children:[a.jsx(to,{className:"h-5 w-5"}),"Exporter la Base de Données"]})}),a.jsxs(Zn,{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Téléchargez une sauvegarde complète de toutes les données (utilisateurs, magasins, ventes)."}),a.jsxs(je,{onClick:Re,disabled:U.isPending,className:"w-full",children:[a.jsx(to,{className:"h-4 w-4 mr-2"}),U.isPending?"Export en cours...":"Télécharger la Sauvegarde"]})]})]}),a.jsxs(Hn,{children:[a.jsx(Qn,{children:a.jsxs(qn,{className:"flex items-center gap-2",children:[a.jsx(vv,{className:"h-5 w-5"}),"Importer une Sauvegarde"]})}),a.jsxs(Zn,{className:"space-y-4",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Restaurez les données à partir d'un fichier de sauvegarde.",a.jsx("strong",{className:"text-red-600",children:" Attention : cette action remplacera toutes les données existantes."})]}),a.jsxs(Na,{children:[a.jsx(_a,{asChild:!0,children:a.jsxs(je,{variant:"destructive",disabled:Y.isPending,className:"w-full",children:[a.jsx(vv,{className:"h-4 w-4 mr-2"}),Y.isPending?"Import en cours...":"Restaurer depuis un Fichier"]})}),a.jsxs($i,{children:[a.jsxs(Ui,{children:[a.jsx(Wi,{children:"Confirmer la restauration"}),a.jsxs(Hi,{children:["Êtes-vous sûr de vouloir restaurer les données depuis un fichier de sauvegarde ?",a.jsx("br",{}),a.jsx("br",{}),a.jsx("strong",{className:"text-red-600",children:"⚠️ ATTENTION : Cette action supprimera définitivement toutes les données actuelles (utilisateurs, magasins, ventes) et les remplacera par celles du fichier de sauvegarde."}),a.jsx("br",{}),a.jsx("br",{}),"Cette action est irréversible. Assurez-vous d'avoir une sauvegarde des données actuelles si vous souhaitez pouvoir les récupérer."]})]}),a.jsxs(Bi,{children:[a.jsx(qi,{children:"Annuler"}),a.jsx(Qi,{onClick:ct,className:"bg-red-600 hover:bg-red-700",children:"Confirmer la Restauration"})]})]})]})]})]})]}),a.jsxs(Hn,{children:[a.jsx(Qn,{children:a.jsx(qn,{children:"Informations sur les Sauvegardes"})}),a.jsx(Zn,{children:a.jsxs("div",{className:"space-y-3 text-sm",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Sauvegarde automatique :"})," Le système crée automatiquement une sauvegarde toutes les 12 heures (00:00 et 12:00) et conserve les 10 plus récentes."]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Format des fichiers :"})," Les sauvegardes sont au format JSON et contiennent toutes les données de l'application."]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Contenu inclus :"})," Utilisateurs, magasins, ventes, et toutes les relations entre ces données."]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Sécurité :"})," Les mots de passe sont hachés et ne peuvent pas être récupérés depuis une sauvegarde."]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Recommandation :"})," Les sauvegardes automatiques couvrent la plupart des besoins, mais vous pouvez créer des sauvegardes manuelles avant des modifications importantes."]})]})})]})]}),a.jsxs(ls,{value:"purge",className:"space-y-4",children:[a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[a.jsx($d,{className:"h-5 w-5"}),"Purge des Données"]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs(Hn,{children:[a.jsx(Qn,{children:a.jsxs(qn,{className:"text-base flex items-center gap-2",children:[a.jsx(mv,{className:"h-4 w-4"}),"Statistiques de Purge"]})}),a.jsxs(Zn,{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Total des ventes :"}),a.jsx("span",{className:"font-medium",children:(w==null?void 0:w.totalSales)||0})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Ventes anciennes (>19 mois) :"}),a.jsx("span",{className:"font-medium text-orange-600",children:(w==null?void 0:w.oldSales)||0})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Date limite :"}),a.jsx("span",{className:"font-medium text-xs",children:w!=null&&w.cutoffDate?new Date(w.cutoffDate).toLocaleDateString("fr-FR"):"-"})]}),a.jsx("div",{className:"pt-2 border-t",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${w!=null&&w.purgeEligible?"bg-orange-500":"bg-green-500"}`}),a.jsx("span",{className:"text-sm",children:w!=null&&w.purgeEligible?"Purge nécessaire":"Aucune purge nécessaire"})]})})]})]}),a.jsxs(Hn,{children:[a.jsx(Qn,{children:a.jsxs(qn,{className:"text-base flex items-center gap-2",children:[a.jsx(Ep,{className:"h-4 w-4"}),"Configuration"]})}),a.jsxs(Zn,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Purge Automatique"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Exécutée automatiquement le 1er de chaque mois à 02:00"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Rétention des Données"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"19 mois maximum (conforme à la réglementation)"})]}),a.jsx("div",{className:"pt-2 border-t",children:a.jsxs(Na,{children:[a.jsx(_a,{asChild:!0,children:a.jsx(je,{variant:"destructive",size:"sm",className:"w-full",disabled:!(w!=null&&w.purgeEligible)||Ue.isPending,children:Ue.isPending?"Purge en cours...":"Exécuter Purge Manuelle"})}),a.jsxs($i,{children:[a.jsxs(Ui,{children:[a.jsx(Wi,{children:"Confirmer la Purge"}),a.jsxs(Hi,{children:["Cette action va supprimer définitivement ",(w==null?void 0:w.oldSales)||0," vente(s) datant de plus de 19 mois. Cette opération est irréversible.",a.jsx("br",{}),a.jsx("br",{}),a.jsx("strong",{children:"Ventes concernées :"})," antérieures au ",w!=null&&w.cutoffDate?new Date(w.cutoffDate).toLocaleDateString("fr-FR"):"-"]})]}),a.jsxs(Bi,{children:[a.jsx(qi,{children:"Annuler"}),a.jsx(Qi,{onClick:Ot,className:"bg-destructive hover:bg-destructive/90",children:"Confirmer la Purge"})]})]})]})})]})]})]}),a.jsxs(Hn,{children:[a.jsx(Qn,{children:a.jsx(qn,{className:"text-base",children:"Information sur la Purge"})}),a.jsxs(Zn,{className:"space-y-3",children:[a.jsxs("div",{className:"bg-blue-50 p-3 rounded-lg border border-blue-200",children:[a.jsx("h4",{className:"font-medium text-sm text-blue-900 mb-2",children:"📋 Réglementation"}),a.jsx("p",{className:"text-xs text-blue-700",children:"Les données de ventes de feux d'artifice doivent être conservées pendant 19 mois maximum conformément à la réglementation française sur les articles pyrotechniques."})]}),a.jsxs("div",{className:"bg-green-50 p-3 rounded-lg border border-green-200",children:[a.jsx("h4",{className:"font-medium text-sm text-green-900 mb-2",children:"🔄 Automatisation"}),a.jsx("p",{className:"text-xs text-green-700",children:"La purge s'exécute automatiquement chaque mois pour maintenir la conformité. Vous pouvez également l'exécuter manuellement si nécessaire."})]}),a.jsxs("div",{className:"bg-orange-50 p-3 rounded-lg border border-orange-200",children:[a.jsx("h4",{className:"font-medium text-sm text-orange-900 mb-2",children:"⚠️ Attention"}),a.jsx("p",{className:"text-xs text-orange-700",children:"La purge supprime définitivement les données. Assurez-vous d'avoir effectué une sauvegarde récente avant d'exécuter une purge manuelle."})]})]})]})]})]})})]})}function gL(){const{user:e,logout:t}=Yo(),{toast:n}=Zo(),[r,s]=h.useState("new-sale"),{selectedStoreId:i,setSelectedStoreId:o,stores:l,selectedStore:c,isLoadingStores:u}=Pm(),d=async()=>{try{await t(),n({title:"Déconnexion réussie",description:"À bientôt !"})}catch{n({title:"Erreur",description:"Erreur lors de la déconnexion",variant:"destructive"})}},f=(e==null?void 0:e.role)==="admin",p=(e==null?void 0:e.role)==="admin"||(e==null?void 0:e.role)==="manager",y=(e==null?void 0:e.role)==="admin";return a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx("header",{className:"sticky top-0 z-50 border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex justify-between items-center h-16",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"relative",children:a.jsx("div",{className:"p-2 bg-primary text-primary-foreground",children:a.jsx(jp,{className:"h-6 w-6"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"text-xl font-bold text-foreground truncate",children:"RegisFlow"}),a.jsx("p",{className:"text-sm text-muted-foreground hidden sm:block",children:"Registre des ventes des Feux d'artifice"})]})]}),a.jsxs("div",{className:"flex items-center gap-2 sm:gap-4",children:[y&&!u&&a.jsxs("div",{className:"hidden sm:flex items-center gap-3 p-2 bg-muted border border-border",children:[a.jsx(_p,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs(Sr,{value:(i==null?void 0:i.toString())||"",onValueChange:b=>o(parseInt(b)),children:[a.jsx(nr,{className:"w-48 border-0 bg-transparent focus:ring-0 text-sm",children:a.jsx(Nr,{placeholder:"Magasin"})}),a.jsx(rr,{children:l.map(b=>a.jsx(qt,{value:b.id.toString(),children:b.name},b.id))})]})]}),!y&&c&&a.jsxs("div",{className:"hidden sm:flex items-center gap-2 px-3 py-2 bg-muted border border-border",children:[a.jsx(_p,{className:"h-4 w-4 text-primary"}),a.jsx("span",{className:"text-sm font-medium",children:c.name})]}),a.jsxs("div",{className:"flex items-center gap-1 sm:gap-3",children:[a.jsxs("div",{className:"text-right hidden sm:block",children:[a.jsxs("p",{className:"text-sm font-semibold text-foreground",children:[e==null?void 0:e.firstName," ",e==null?void 0:e.lastName]}),a.jsxs("div",{className:"flex items-center gap-1",children:[(e==null?void 0:e.role)==="admin"&&a.jsx(qA,{className:"h-3 w-3 text-primary"}),a.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:e==null?void 0:e.role})]})]}),a.jsxs(je,{variant:"outline",size:"sm",onClick:d,className:"border-2 hover:bg-destructive hover:text-destructive-foreground hover:border-destructive smooth-transition touch-friendly-button",children:[a.jsx(BA,{className:"h-4 w-4 sm:mr-2"}),a.jsx("span",{className:"hidden sm:inline",children:"Déconnexion"})]})]})]})]})})}),a.jsx("main",{className:"max-w-7xl mx-auto mobile-padding py-4 sm:py-6 lg:py-8",children:a.jsx("div",{className:"fade-in",children:a.jsxs(LE,{value:r,onValueChange:s,className:"mobile-form-responsive",children:[a.jsxs(km,{className:`grid w-full ${f?"grid-cols-3":"grid-cols-2"} max-w-full sm:max-w-2xl h-14 bg-muted p-0 border border-border`,children:[a.jsxs(as,{value:"new-sale",className:"h-full data-[state=active]:bg-background data-[state=active]:border-b-2 data-[state=active]:border-primary font-medium text-sm",children:[a.jsx(jp,{className:"h-5 w-5 mr-2"}),a.jsx("span",{className:"hidden sm:inline",children:"Nouvelle Vente"}),a.jsx("span",{className:"sm:hidden",children:"Vente"})]}),a.jsxs(as,{value:"history",className:"h-full data-[state=active]:bg-background data-[state=active]:border-b-2 data-[state=active]:border-primary font-medium text-sm",children:[a.jsx(uN,{className:"h-5 w-5 mr-2"}),a.jsx("span",{className:"hidden sm:inline",children:"Historique"}),a.jsx("span",{className:"sm:hidden",children:"Liste"})]}),f&&a.jsxs(as,{value:"admin",className:"h-full data-[state=active]:bg-background data-[state=active]:border-b-2 data-[state=active]:border-primary font-medium text-sm",children:[a.jsx(Ep,{className:"h-5 w-5 mr-2"}),a.jsx("span",{className:"hidden sm:inline",children:"Administration"}),a.jsx("span",{className:"sm:hidden",children:"Admin"})]})]}),a.jsx(ls,{value:"new-sale",className:"mt-8",children:a.jsx("div",{className:"slide-in-up",children:a.jsx(B4,{})})}),a.jsx(ls,{value:"history",className:"mt-8",children:a.jsx("div",{className:"slide-in-up",children:a.jsx(lL,{canDelete:p})})}),f&&a.jsx(ls,{value:"admin",className:"mt-8",children:a.jsx("div",{className:"slide-in-up",children:a.jsx(mL,{})})})]})})})]})}function vL(){const{user:e}=Yo();return a.jsx(j4,{userStoreId:e==null?void 0:e.storeId,isAdmin:(e==null?void 0:e.role)==="admin",children:a.jsx(gL,{})})}function yL(){const{isAuthenticated:e,isLoading:t}=Yo();return t?a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):e?a.jsx(vL,{}):a.jsx(zM,{})}function xL(){return a.jsx(j2,{client:L2,children:a.jsxs(sD,{children:[a.jsx(AR,{}),a.jsx(yL,{})]})})}yS(document.getElementById("root")).render(a.jsx(xL,{}));export{Ic as _,SL as c,ib as g};