diff --git a/ui/dist/assets/index-B-WSkv0U.js b/ui/dist/assets/index-GtUlLYeZ.js similarity index 94% rename from ui/dist/assets/index-B-WSkv0U.js rename to ui/dist/assets/index-GtUlLYeZ.js index ebc4d713..ec7953f5 100644 --- a/ui/dist/assets/index-B-WSkv0U.js +++ b/ui/dist/assets/index-GtUlLYeZ.js @@ -1,4 +1,4 @@ -var HN=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var y$=HN((P$,Gu)=>{function _w(e,t){for(var r=0;rn[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"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();var Kc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bw={exports:{}},Xd={},Sw={exports:{}},tt={};/** +var HN=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var v$=HN((R$,Gu)=>{function _w(e,t){for(var r=0;rn[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"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();var Kc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bw={exports:{}},Xd={},Sw={exports:{}},tt={};/** * @license React * react.production.min.js * @@ -271,26 +271,26 @@ Error generating stack: `+o.message+` `)},V0=function(){var e=parseInt(document.body.getAttribute(Xi)||"0",10);return isFinite(e)?e:0},vM=function(){v.useEffect(function(){return document.body.setAttribute(Xi,(V0()+1).toString()),function(){var e=V0()-1;e<=0?document.body.removeAttribute(Xi):document.body.setAttribute(Xi,e.toString())}},[])},yM=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;vM();var o=v.useMemo(function(){return pM(s)},[s]);return v.createElement(mM,{styles:gM(o,!t,s,r?"":"!important")})},cm=!1;if(typeof window<"u")try{var vu=Object.defineProperty({},"passive",{get:function(){return cm=!0,!0}});window.addEventListener("test",vu,vu),window.removeEventListener("test",vu,vu)}catch{cm=!1}var _i=cm?{passive:!1}:!1,xM=function(e){return e.tagName==="TEXTAREA"},Hb=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!xM(e)&&r[t]==="visible")},wM=function(e){return Hb(e,"overflowY")},_M=function(e){return Hb(e,"overflowX")},W0=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=Yb(e,n);if(s){var o=Zb(e,n),i=o[1],a=o[2];if(i>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},bM=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},SM=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Yb=function(e,t){return e==="v"?wM(t):_M(t)},Zb=function(e,t){return e==="v"?bM(t):SM(t)},kM=function(e,t){return e==="h"&&t==="rtl"?-1:1},CM=function(e,t,r,n,s){var o=kM(e,window.getComputedStyle(t).direction),i=o*n,a=r.target,c=t.contains(a),u=!1,d=i>0,f=0,m=0;do{var y=Zb(e,a),x=y[0],g=y[1],_=y[2],p=g-_-o*x;(x||p)&&Yb(e,a)&&(f+=p,m+=x),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&(Math.abs(f)<1||!s)||!d&&(Math.abs(m)<1||!s))&&(u=!0),u},yu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},B0=function(e){return[e.deltaX,e.deltaY]},H0=function(e){return e&&"current"in e?e.current:e},jM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},EM=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},NM=0,bi=[];function TM(e){var t=v.useRef([]),r=v.useRef([0,0]),n=v.useRef(),s=v.useState(NM++)[0],o=v.useState(Bb)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=qO([e.lockRef.current],(e.shards||[]).map(H0),!0).filter(Boolean);return g.forEach(function(_){return _.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(g,_){if("touches"in g&&g.touches.length===2)return!i.current.allowPinchZoom;var p=yu(g),h=r.current,w="deltaX"in g?g.deltaX:h[0]-p[0],C="deltaY"in g?g.deltaY:h[1]-p[1],j,E=g.target,R=Math.abs(w)>Math.abs(C)?"h":"v";if("touches"in g&&R==="h"&&E.type==="range")return!1;var P=W0(R,E);if(!P)return!0;if(P?j=R:(j=R==="v"?"h":"v",P=W0(R,E)),!P)return!1;if(!n.current&&"changedTouches"in g&&(w||C)&&(n.current=j),!j)return!0;var A=n.current||j;return CM(A,_,g,A==="h"?w:C,!0)},[]),c=v.useCallback(function(g){var _=g;if(!(!bi.length||bi[bi.length-1]!==o)){var p="deltaY"in _?B0(_):yu(_),h=t.current.filter(function(j){return j.name===_.type&&(j.target===_.target||_.target===j.shadowParent)&&jM(j.delta,p)})[0];if(h&&h.should){_.cancelable&&_.preventDefault();return}if(!h){var w=(i.current.shards||[]).map(H0).filter(Boolean).filter(function(j){return j.contains(_.target)}),C=w.length>0?a(_,w[0]):!i.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),u=v.useCallback(function(g,_,p,h){var w={name:g,delta:_,target:p,should:h,shadowParent:RM(p)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(C){return C!==w})},1)},[]),d=v.useCallback(function(g){r.current=yu(g),n.current=void 0},[]),f=v.useCallback(function(g){u(g.type,B0(g),g.target,a(g,e.lockRef.current))},[]),m=v.useCallback(function(g){u(g.type,yu(g),g.target,a(g,e.lockRef.current))},[]);v.useEffect(function(){return bi.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,_i),document.addEventListener("touchmove",c,_i),document.addEventListener("touchstart",d,_i),function(){bi=bi.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,_i),document.removeEventListener("touchmove",c,_i),document.removeEventListener("touchstart",d,_i)}},[]);var y=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(o,{styles:EM(s)}):null,y?v.createElement(yM,{gapMode:e.gapMode}):null)}function RM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const PM=oM(Wb,TM);var jf=v.forwardRef(function(e,t){return v.createElement(Cf,In({},e,{ref:t,sideCar:PM}))});jf.classNames=Cf.classNames;var um=["Enter"," "],AM=["ArrowDown","PageUp","Home"],Kb=["ArrowUp","PageDown","End"],DM=[...AM,...Kb],OM={ltr:[...um,"ArrowRight"],rtl:[...um,"ArrowLeft"]},MM={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cc="Menu",[Gl,IM,LM]=bc(Cc),[ci,Gb]=xr(Cc,[LM,Pa,kf]),Ef=Pa(),qb=kf(),[FM,ui]=ci(Cc),[zM,jc]=ci(Cc),Xb=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:i=!0}=e,a=Ef(t),[c,u]=v.useState(null),d=v.useRef(!1),f=Dt(o),m=Ea(s);return v.useEffect(()=>{const y=()=>{d.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>d.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),l.jsx(Xg,{...a,children:l.jsx(FM,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:l.jsx(zM,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:i,children:n})})})};Xb.displayName=Cc;var UM="MenuAnchor",rv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(Qg,{...s,...n,ref:t})});rv.displayName=UM;var nv="MenuPortal",[$M,Qb]=ci(nv,{forceMount:void 0}),Jb=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=ui(nv,t);return l.jsx($M,{scope:t,forceMount:r,children:l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:n})})})};Jb.displayName=nv;var rn="MenuContent",[VM,sv]=ci(rn),eS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(WM,{...s,ref:t}):l.jsx(BM,{...s,ref:t})})})})}),WM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu),n=v.useRef(null),s=Ke(t,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ov,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),BM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu);return l.jsx(ov,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),ov=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,disableOutsideScroll:x,...g}=e,_=ui(rn,r),p=jc(rn,r),h=Ef(r),w=qb(r),C=IM(r),[j,E]=v.useState(null),R=v.useRef(null),P=Ke(t,R,_.onContentChange),A=v.useRef(0),L=v.useRef(""),q=v.useRef(0),N=v.useRef(null),F=v.useRef("right"),b=v.useRef(0),V=x?jf:v.Fragment,te=x?{as:bs,allowPinchZoom:!0}:void 0,W=I=>{var he,ye;const Q=L.current+I,z=C().filter(ke=>!ke.disabled),$=document.activeElement,fe=(he=z.find(ke=>ke.ref.current===$))==null?void 0:he.textValue,ne=z.map(ke=>ke.textValue),se=rI(ne,Q,fe),Oe=(ye=z.find(ke=>ke.textValue===se))==null?void 0:ye.ref.current;(function ke(Fe){L.current=Fe,window.clearTimeout(A.current),Fe!==""&&(A.current=window.setTimeout(()=>ke(""),1e3))})(Q),Oe&&setTimeout(()=>Oe.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),Vg();const Z=v.useCallback(I=>{var z,$;return F.current===((z=N.current)==null?void 0:z.side)&&sI(I,($=N.current)==null?void 0:$.area)},[]);return l.jsx(VM,{scope:r,searchRef:L,onItemEnter:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),onItemLeave:v.useCallback(I=>{var Q;Z(I)||((Q=R.current)==null||Q.focus(),E(null))},[Z]),onTriggerLeave:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),pointerGraceTimerRef:q,onPointerGraceIntentChange:v.useCallback(I=>{N.current=I},[]),children:l.jsx(V,{...te,children:l.jsx(wf,{asChild:!0,trapped:s,onMountAutoFocus:ce(o,I=>{var Q;I.preventDefault(),(Q=R.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,children:l.jsx(Fb,{asChild:!0,...w,dir:p.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:E,onEntryFocus:ce(c,I=>{p.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Jg,{role:"menu","aria-orientation":"vertical","data-state":gS(_.open),"data-radix-menu-content":"",dir:p.dir,...h,...g,ref:P,style:{outline:"none",...g.style},onKeyDown:ce(g.onKeyDown,I=>{const z=I.target.closest("[data-radix-menu-content]")===I.currentTarget,$=I.ctrlKey||I.altKey||I.metaKey,fe=I.key.length===1;z&&(I.key==="Tab"&&I.preventDefault(),!$&&fe&&W(I.key));const ne=R.current;if(I.target!==ne||!DM.includes(I.key))return;I.preventDefault();const Oe=C().filter(he=>!he.disabled).map(he=>he.ref.current);Kb.includes(I.key)&&Oe.reverse(),eI(Oe)}),onBlur:ce(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(A.current),L.current="")}),onPointerMove:ce(e.onPointerMove,ql(I=>{const Q=I.target,z=b.current!==I.clientX;if(I.currentTarget.contains(Q)&&z){const $=I.clientX>b.current?"right":"left";F.current=$,b.current=I.clientX}}))})})})})})})});eS.displayName=rn;var HM="MenuGroup",iv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"group",...n,ref:t})});iv.displayName=HM;var YM="MenuLabel",tS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});tS.displayName=YM;var jd="MenuItem",Y0="menu.itemSelect",Nf=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=v.useRef(null),i=jc(jd,e.__scopeMenu),a=sv(jd,e.__scopeMenu),c=Ke(t,o),u=v.useRef(!1),d=()=>{const f=o.current;if(!r&&f){const m=new CustomEvent(Y0,{bubbles:!0,cancelable:!0});f.addEventListener(Y0,y=>n==null?void 0:n(y),{once:!0}),$g(f,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(rS,{...s,ref:c,disabled:r,onClick:ce(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:ce(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:ce(e.onKeyDown,f=>{const m=a.searchRef.current!=="";r||m&&f.key===" "||um.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Nf.displayName=jd;var rS=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,i=sv(jd,r),a=qb(r),c=v.useRef(null),u=Ke(t,c),[d,f]=v.useState(!1),[m,y]=v.useState("");return v.useEffect(()=>{const x=c.current;x&&y((x.textContent??"").trim())},[o.children]),l.jsx(Gl.ItemSlot,{scope:r,disabled:n,textValue:s??m,children:l.jsx(zb,{asChild:!0,...a,focusable:!n,children:l.jsx(Re.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:ce(e.onPointerMove,ql(x=>{n?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(e.onPointerLeave,ql(x=>i.onItemLeave(x))),onFocus:ce(e.onFocus,()=>f(!0)),onBlur:ce(e.onBlur,()=>f(!1))})})})}),ZM="MenuCheckboxItem",nS=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return l.jsx(lS,{scope:e.__scopeMenu,checked:r,children:l.jsx(Nf,{role:"menuitemcheckbox","aria-checked":Ed(r)?"mixed":r,...s,ref:t,"data-state":lv(r),onSelect:ce(s.onSelect,()=>n==null?void 0:n(Ed(r)?!0:!r),{checkForDefaultPrevented:!1})})})});nS.displayName=ZM;var sS="MenuRadioGroup",[KM,GM]=ci(sS,{value:void 0,onValueChange:()=>{}}),oS=v.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=Dt(n);return l.jsx(KM,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(iv,{...s,ref:t})})});oS.displayName=sS;var iS="MenuRadioItem",aS=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=GM(iS,e.__scopeMenu),o=r===s.value;return l.jsx(lS,{scope:e.__scopeMenu,checked:o,children:l.jsx(Nf,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":lv(o),onSelect:ce(n.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,r)},{checkForDefaultPrevented:!1})})})});aS.displayName=iS;var av="MenuItemIndicator",[lS,qM]=ci(av,{checked:!1}),cS=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=qM(av,r);return l.jsx(ur,{present:n||Ed(o.checked)||o.checked===!0,children:l.jsx(Re.span,{...s,ref:t,"data-state":lv(o.checked)})})});cS.displayName=av;var XM="MenuSeparator",uS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});uS.displayName=XM;var QM="MenuArrow",dS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(ev,{...s,...n,ref:t})});dS.displayName=QM;var JM="MenuSub",[w$,fS]=ci(JM),ol="MenuSubTrigger",hS=v.forwardRef((e,t)=>{const r=ui(ol,e.__scopeMenu),n=jc(ol,e.__scopeMenu),s=fS(ol,e.__scopeMenu),o=sv(ol,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),l.jsx(rv,{asChild:!0,...u,children:l.jsx(rS,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":gS(r.open),...e,ref:yf(t,s.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ce(e.onPointerMove,ql(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:ce(e.onPointerLeave,ql(f=>{var y,x;d();const m=(y=r.content)==null?void 0:y.getBoundingClientRect();if(m){const g=(x=r.content)==null?void 0:x.dataset.side,_=g==="right",p=_?-5:5,h=m[_?"left":"right"],w=m[_?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+p,y:f.clientY},{x:h,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:h,y:m.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ce(e.onKeyDown,f=>{var y;const m=o.searchRef.current!=="";e.disabled||m&&f.key===" "||OM[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});hS.displayName=ol;var pS="MenuSubContent",mS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu),a=fS(pS,e.__scopeMenu),c=v.useRef(null),u=Ke(t,c);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:l.jsx(ov,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;i.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ce(e.onFocusOutside,d=>{d.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ce(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:ce(e.onKeyDown,d=>{var y;const f=d.currentTarget.contains(d.target),m=MM[i.dir].includes(d.key);f&&m&&(o.onOpenChange(!1),(y=a.trigger)==null||y.focus(),d.preventDefault())})})})})})});mS.displayName=pS;function gS(e){return e?"open":"closed"}function Ed(e){return e==="indeterminate"}function lv(e){return Ed(e)?"indeterminate":e?"checked":"unchecked"}function eI(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function tI(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function rI(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=tI(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function nI(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function sI(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return nI(r,t)}function ql(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oI=Xb,iI=rv,aI=Jb,lI=eS,cI=iv,uI=tS,dI=Nf,fI=nS,hI=oS,pI=aS,mI=cS,gI=uS,vI=dS,yI=hS,xI=mS,cv="DropdownMenu",[wI,_$]=xr(cv,[Gb]),wr=Gb(),[_I,vS]=wI(cv),yS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=wr(t),u=v.useRef(null),[d=!1,f]=on({prop:s,defaultProp:o,onChange:i});return l.jsx(_I,{scope:t,triggerId:Ur(),triggerRef:u,contentId:Ur(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:a,children:l.jsx(oI,{...c,open:d,onOpenChange:f,dir:n,modal:a,children:r})})};yS.displayName=cv;var xS="DropdownMenuTrigger",wS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=vS(xS,r),i=wr(r);return l.jsx(iI,{asChild:!0,...i,children:l.jsx(Re.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:yf(t,o.triggerRef),onPointerDown:ce(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:ce(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});wS.displayName=xS;var bI="DropdownMenuPortal",_S=e=>{const{__scopeDropdownMenu:t,...r}=e,n=wr(t);return l.jsx(aI,{...n,...r})};_S.displayName=bI;var bS="DropdownMenuContent",SS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=vS(bS,r),o=wr(r),i=v.useRef(!1);return l.jsx(lI,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:ce(e.onCloseAutoFocus,a=>{var c;i.current||(c=s.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ce(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});SS.displayName=bS;var SI="DropdownMenuGroup",kI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(cI,{...s,...n,ref:t})});kI.displayName=SI;var CI="DropdownMenuLabel",kS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(uI,{...s,...n,ref:t})});kS.displayName=CI;var jI="DropdownMenuItem",CS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(dI,{...s,...n,ref:t})});CS.displayName=jI;var EI="DropdownMenuCheckboxItem",jS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(fI,{...s,...n,ref:t})});jS.displayName=EI;var NI="DropdownMenuRadioGroup",TI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(hI,{...s,...n,ref:t})});TI.displayName=NI;var RI="DropdownMenuRadioItem",ES=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(pI,{...s,...n,ref:t})});ES.displayName=RI;var PI="DropdownMenuItemIndicator",NS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(mI,{...s,...n,ref:t})});NS.displayName=PI;var AI="DropdownMenuSeparator",TS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(gI,{...s,...n,ref:t})});TS.displayName=AI;var DI="DropdownMenuArrow",OI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(vI,{...s,...n,ref:t})});OI.displayName=DI;var MI="DropdownMenuSubTrigger",RS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(yI,{...s,...n,ref:t})});RS.displayName=MI;var II="DropdownMenuSubContent",PS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(xI,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});PS.displayName=II;var LI=yS,FI=wS,zI=_S,AS=SS,DS=kS,OS=CS,MS=jS,IS=ES,LS=NS,FS=TS,zS=RS,US=PS;const $S=LI,VS=FI,UI=v.forwardRef(({className:e,inset:t,children:r,...n},s)=>l.jsxs(zS,{ref:s,className:ae("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...n,children:[r,l.jsx(iA,{className:"ml-auto h-4 w-4"})]}));UI.displayName=zS.displayName;const $I=v.forwardRef(({className:e,...t},r)=>l.jsx(US,{ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));$I.displayName=US.displayName;const uv=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(zI,{children:l.jsx(AS,{ref:n,sideOffset:t,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));uv.displayName=AS.displayName;const Qi=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(OS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));Qi.displayName=OS.displayName;const VI=v.forwardRef(({className:e,children:t,checked:r,...n},s)=>l.jsxs(MS,{ref:s,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(eb,{className:"h-4 w-4"})})}),t]}));VI.displayName=MS.displayName;const WI=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(IS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(uA,{className:"h-2 w-2 fill-current"})})}),t]}));WI.displayName=IS.displayName;const WS=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(DS,{ref:n,className:ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));WS.displayName=DS.displayName;const BS=v.forwardRef(({className:e,...t},r)=>l.jsx(FS,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));BS.displayName=FS.displayName;var dv="Dialog",[HS,YS]=xr(dv),[BI,Tn]=HS(dv),ZS=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[u=!1,d]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(BI,{scope:t,triggerRef:a,contentRef:c,contentId:Ur(),titleId:Ur(),descriptionId:Ur(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};ZS.displayName=dv;var KS="DialogTrigger",GS=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(KS,r),o=Ke(t,s.triggerRef);return l.jsx(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":pv(s.open),...n,ref:o,onClick:ce(e.onClick,s.onOpenToggle)})});GS.displayName=KS;var fv="DialogPortal",[HI,qS]=HS(fv,{forceMount:void 0}),XS=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=Tn(fv,t);return l.jsx(HI,{scope:t,forceMount:r,children:v.Children.map(n,i=>l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:i})}))})};XS.displayName=fv;var Nd="DialogOverlay",QS=v.forwardRef((e,t)=>{const r=qS(Nd,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(Nd,e.__scopeDialog);return o.modal?l.jsx(ur,{present:n||o.open,children:l.jsx(YI,{...s,ref:t})}):null});QS.displayName=Nd;var YI=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(Nd,r);return l.jsx(jf,{as:bs,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(Re.div,{"data-state":pv(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ni="DialogContent",JS=v.forwardRef((e,t)=>{const r=qS(ni,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(ni,e.__scopeDialog);return l.jsx(ur,{present:n||o.open,children:o.modal?l.jsx(ZI,{...s,ref:t}):l.jsx(KI,{...s,ref:t})})});JS.displayName=ni;var ZI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(null),s=Ke(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ek,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ce(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault())})}),KI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(!1),s=v.useRef(!1);return l.jsx(ek,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),ek=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=Tn(ni,r),c=v.useRef(null),u=Ke(t,c);return Vg(),l.jsxs(l.Fragment,{children:[l.jsx(wf,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(Na,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":pv(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(qI,{titleId:a.titleId}),l.jsx(QI,{contentRef:c,descriptionId:a.descriptionId})]})]})}),hv="DialogTitle",tk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(hv,r);return l.jsx(Re.h2,{id:s.titleId,...n,ref:t})});tk.displayName=hv;var rk="DialogDescription",nk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(rk,r);return l.jsx(Re.p,{id:s.descriptionId,...n,ref:t})});nk.displayName=rk;var sk="DialogClose",ok=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(sk,r);return l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,()=>s.onOpenChange(!1))})});ok.displayName=sk;function pv(e){return e?"open":"closed"}var ik="DialogTitleWarning",[GI,ak]=oD(ik,{contentName:ni,titleName:hv,docsSlug:"dialog"}),qI=({titleId:e})=>{const t=ak(ik),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. +`)},NM=0,bi=[];function TM(e){var t=v.useRef([]),r=v.useRef([0,0]),n=v.useRef(),s=v.useState(NM++)[0],o=v.useState(Bb)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=qO([e.lockRef.current],(e.shards||[]).map(H0),!0).filter(Boolean);return g.forEach(function(_){return _.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(g,_){if("touches"in g&&g.touches.length===2)return!i.current.allowPinchZoom;var p=yu(g),h=r.current,w="deltaX"in g?g.deltaX:h[0]-p[0],C="deltaY"in g?g.deltaY:h[1]-p[1],j,E=g.target,R=Math.abs(w)>Math.abs(C)?"h":"v";if("touches"in g&&R==="h"&&E.type==="range")return!1;var P=W0(R,E);if(!P)return!0;if(P?j=R:(j=R==="v"?"h":"v",P=W0(R,E)),!P)return!1;if(!n.current&&"changedTouches"in g&&(w||C)&&(n.current=j),!j)return!0;var A=n.current||j;return CM(A,_,g,A==="h"?w:C,!0)},[]),c=v.useCallback(function(g){var _=g;if(!(!bi.length||bi[bi.length-1]!==o)){var p="deltaY"in _?B0(_):yu(_),h=t.current.filter(function(j){return j.name===_.type&&(j.target===_.target||_.target===j.shadowParent)&&jM(j.delta,p)})[0];if(h&&h.should){_.cancelable&&_.preventDefault();return}if(!h){var w=(i.current.shards||[]).map(H0).filter(Boolean).filter(function(j){return j.contains(_.target)}),C=w.length>0?a(_,w[0]):!i.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),u=v.useCallback(function(g,_,p,h){var w={name:g,delta:_,target:p,should:h,shadowParent:RM(p)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(C){return C!==w})},1)},[]),d=v.useCallback(function(g){r.current=yu(g),n.current=void 0},[]),f=v.useCallback(function(g){u(g.type,B0(g),g.target,a(g,e.lockRef.current))},[]),m=v.useCallback(function(g){u(g.type,yu(g),g.target,a(g,e.lockRef.current))},[]);v.useEffect(function(){return bi.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,_i),document.addEventListener("touchmove",c,_i),document.addEventListener("touchstart",d,_i),function(){bi=bi.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,_i),document.removeEventListener("touchmove",c,_i),document.removeEventListener("touchstart",d,_i)}},[]);var y=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(o,{styles:EM(s)}):null,y?v.createElement(yM,{gapMode:e.gapMode}):null)}function RM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const PM=oM(Wb,TM);var jf=v.forwardRef(function(e,t){return v.createElement(Cf,In({},e,{ref:t,sideCar:PM}))});jf.classNames=Cf.classNames;var um=["Enter"," "],AM=["ArrowDown","PageUp","Home"],Kb=["ArrowUp","PageDown","End"],DM=[...AM,...Kb],OM={ltr:[...um,"ArrowRight"],rtl:[...um,"ArrowLeft"]},MM={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cc="Menu",[Gl,IM,LM]=bc(Cc),[ci,Gb]=xr(Cc,[LM,Pa,kf]),Ef=Pa(),qb=kf(),[FM,ui]=ci(Cc),[zM,jc]=ci(Cc),Xb=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:i=!0}=e,a=Ef(t),[c,u]=v.useState(null),d=v.useRef(!1),f=Dt(o),m=Ea(s);return v.useEffect(()=>{const y=()=>{d.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>d.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),l.jsx(Xg,{...a,children:l.jsx(FM,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:l.jsx(zM,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:i,children:n})})})};Xb.displayName=Cc;var UM="MenuAnchor",rv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(Qg,{...s,...n,ref:t})});rv.displayName=UM;var nv="MenuPortal",[$M,Qb]=ci(nv,{forceMount:void 0}),Jb=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=ui(nv,t);return l.jsx($M,{scope:t,forceMount:r,children:l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:n})})})};Jb.displayName=nv;var rn="MenuContent",[VM,sv]=ci(rn),eS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(WM,{...s,ref:t}):l.jsx(BM,{...s,ref:t})})})})}),WM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu),n=v.useRef(null),s=Ke(t,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ov,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),BM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu);return l.jsx(ov,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),ov=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,disableOutsideScroll:x,...g}=e,_=ui(rn,r),p=jc(rn,r),h=Ef(r),w=qb(r),C=IM(r),[j,E]=v.useState(null),R=v.useRef(null),P=Ke(t,R,_.onContentChange),A=v.useRef(0),L=v.useRef(""),q=v.useRef(0),N=v.useRef(null),F=v.useRef("right"),b=v.useRef(0),V=x?jf:v.Fragment,te=x?{as:bs,allowPinchZoom:!0}:void 0,W=I=>{var he,ye;const Q=L.current+I,z=C().filter(ke=>!ke.disabled),$=document.activeElement,fe=(he=z.find(ke=>ke.ref.current===$))==null?void 0:he.textValue,ne=z.map(ke=>ke.textValue),se=rI(ne,Q,fe),Oe=(ye=z.find(ke=>ke.textValue===se))==null?void 0:ye.ref.current;(function ke(Fe){L.current=Fe,window.clearTimeout(A.current),Fe!==""&&(A.current=window.setTimeout(()=>ke(""),1e3))})(Q),Oe&&setTimeout(()=>Oe.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),Vg();const Z=v.useCallback(I=>{var z,$;return F.current===((z=N.current)==null?void 0:z.side)&&sI(I,($=N.current)==null?void 0:$.area)},[]);return l.jsx(VM,{scope:r,searchRef:L,onItemEnter:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),onItemLeave:v.useCallback(I=>{var Q;Z(I)||((Q=R.current)==null||Q.focus(),E(null))},[Z]),onTriggerLeave:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),pointerGraceTimerRef:q,onPointerGraceIntentChange:v.useCallback(I=>{N.current=I},[]),children:l.jsx(V,{...te,children:l.jsx(wf,{asChild:!0,trapped:s,onMountAutoFocus:ce(o,I=>{var Q;I.preventDefault(),(Q=R.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,children:l.jsx(Fb,{asChild:!0,...w,dir:p.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:E,onEntryFocus:ce(c,I=>{p.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Jg,{role:"menu","aria-orientation":"vertical","data-state":gS(_.open),"data-radix-menu-content":"",dir:p.dir,...h,...g,ref:P,style:{outline:"none",...g.style},onKeyDown:ce(g.onKeyDown,I=>{const z=I.target.closest("[data-radix-menu-content]")===I.currentTarget,$=I.ctrlKey||I.altKey||I.metaKey,fe=I.key.length===1;z&&(I.key==="Tab"&&I.preventDefault(),!$&&fe&&W(I.key));const ne=R.current;if(I.target!==ne||!DM.includes(I.key))return;I.preventDefault();const Oe=C().filter(he=>!he.disabled).map(he=>he.ref.current);Kb.includes(I.key)&&Oe.reverse(),eI(Oe)}),onBlur:ce(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(A.current),L.current="")}),onPointerMove:ce(e.onPointerMove,ql(I=>{const Q=I.target,z=b.current!==I.clientX;if(I.currentTarget.contains(Q)&&z){const $=I.clientX>b.current?"right":"left";F.current=$,b.current=I.clientX}}))})})})})})})});eS.displayName=rn;var HM="MenuGroup",iv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"group",...n,ref:t})});iv.displayName=HM;var YM="MenuLabel",tS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});tS.displayName=YM;var jd="MenuItem",Y0="menu.itemSelect",Nf=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=v.useRef(null),i=jc(jd,e.__scopeMenu),a=sv(jd,e.__scopeMenu),c=Ke(t,o),u=v.useRef(!1),d=()=>{const f=o.current;if(!r&&f){const m=new CustomEvent(Y0,{bubbles:!0,cancelable:!0});f.addEventListener(Y0,y=>n==null?void 0:n(y),{once:!0}),$g(f,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(rS,{...s,ref:c,disabled:r,onClick:ce(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:ce(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:ce(e.onKeyDown,f=>{const m=a.searchRef.current!=="";r||m&&f.key===" "||um.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Nf.displayName=jd;var rS=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,i=sv(jd,r),a=qb(r),c=v.useRef(null),u=Ke(t,c),[d,f]=v.useState(!1),[m,y]=v.useState("");return v.useEffect(()=>{const x=c.current;x&&y((x.textContent??"").trim())},[o.children]),l.jsx(Gl.ItemSlot,{scope:r,disabled:n,textValue:s??m,children:l.jsx(zb,{asChild:!0,...a,focusable:!n,children:l.jsx(Re.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:ce(e.onPointerMove,ql(x=>{n?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(e.onPointerLeave,ql(x=>i.onItemLeave(x))),onFocus:ce(e.onFocus,()=>f(!0)),onBlur:ce(e.onBlur,()=>f(!1))})})})}),ZM="MenuCheckboxItem",nS=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return l.jsx(lS,{scope:e.__scopeMenu,checked:r,children:l.jsx(Nf,{role:"menuitemcheckbox","aria-checked":Ed(r)?"mixed":r,...s,ref:t,"data-state":lv(r),onSelect:ce(s.onSelect,()=>n==null?void 0:n(Ed(r)?!0:!r),{checkForDefaultPrevented:!1})})})});nS.displayName=ZM;var sS="MenuRadioGroup",[KM,GM]=ci(sS,{value:void 0,onValueChange:()=>{}}),oS=v.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=Dt(n);return l.jsx(KM,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(iv,{...s,ref:t})})});oS.displayName=sS;var iS="MenuRadioItem",aS=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=GM(iS,e.__scopeMenu),o=r===s.value;return l.jsx(lS,{scope:e.__scopeMenu,checked:o,children:l.jsx(Nf,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":lv(o),onSelect:ce(n.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,r)},{checkForDefaultPrevented:!1})})})});aS.displayName=iS;var av="MenuItemIndicator",[lS,qM]=ci(av,{checked:!1}),cS=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=qM(av,r);return l.jsx(ur,{present:n||Ed(o.checked)||o.checked===!0,children:l.jsx(Re.span,{...s,ref:t,"data-state":lv(o.checked)})})});cS.displayName=av;var XM="MenuSeparator",uS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});uS.displayName=XM;var QM="MenuArrow",dS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(ev,{...s,...n,ref:t})});dS.displayName=QM;var JM="MenuSub",[x$,fS]=ci(JM),ol="MenuSubTrigger",hS=v.forwardRef((e,t)=>{const r=ui(ol,e.__scopeMenu),n=jc(ol,e.__scopeMenu),s=fS(ol,e.__scopeMenu),o=sv(ol,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),l.jsx(rv,{asChild:!0,...u,children:l.jsx(rS,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":gS(r.open),...e,ref:yf(t,s.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ce(e.onPointerMove,ql(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:ce(e.onPointerLeave,ql(f=>{var y,x;d();const m=(y=r.content)==null?void 0:y.getBoundingClientRect();if(m){const g=(x=r.content)==null?void 0:x.dataset.side,_=g==="right",p=_?-5:5,h=m[_?"left":"right"],w=m[_?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+p,y:f.clientY},{x:h,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:h,y:m.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ce(e.onKeyDown,f=>{var y;const m=o.searchRef.current!=="";e.disabled||m&&f.key===" "||OM[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});hS.displayName=ol;var pS="MenuSubContent",mS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu),a=fS(pS,e.__scopeMenu),c=v.useRef(null),u=Ke(t,c);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:l.jsx(ov,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;i.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ce(e.onFocusOutside,d=>{d.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ce(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:ce(e.onKeyDown,d=>{var y;const f=d.currentTarget.contains(d.target),m=MM[i.dir].includes(d.key);f&&m&&(o.onOpenChange(!1),(y=a.trigger)==null||y.focus(),d.preventDefault())})})})})})});mS.displayName=pS;function gS(e){return e?"open":"closed"}function Ed(e){return e==="indeterminate"}function lv(e){return Ed(e)?"indeterminate":e?"checked":"unchecked"}function eI(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function tI(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function rI(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=tI(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function nI(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function sI(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return nI(r,t)}function ql(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oI=Xb,iI=rv,aI=Jb,lI=eS,cI=iv,uI=tS,dI=Nf,fI=nS,hI=oS,pI=aS,mI=cS,gI=uS,vI=dS,yI=hS,xI=mS,cv="DropdownMenu",[wI,w$]=xr(cv,[Gb]),wr=Gb(),[_I,vS]=wI(cv),yS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=wr(t),u=v.useRef(null),[d=!1,f]=on({prop:s,defaultProp:o,onChange:i});return l.jsx(_I,{scope:t,triggerId:Ur(),triggerRef:u,contentId:Ur(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:a,children:l.jsx(oI,{...c,open:d,onOpenChange:f,dir:n,modal:a,children:r})})};yS.displayName=cv;var xS="DropdownMenuTrigger",wS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=vS(xS,r),i=wr(r);return l.jsx(iI,{asChild:!0,...i,children:l.jsx(Re.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:yf(t,o.triggerRef),onPointerDown:ce(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:ce(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});wS.displayName=xS;var bI="DropdownMenuPortal",_S=e=>{const{__scopeDropdownMenu:t,...r}=e,n=wr(t);return l.jsx(aI,{...n,...r})};_S.displayName=bI;var bS="DropdownMenuContent",SS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=vS(bS,r),o=wr(r),i=v.useRef(!1);return l.jsx(lI,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:ce(e.onCloseAutoFocus,a=>{var c;i.current||(c=s.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ce(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});SS.displayName=bS;var SI="DropdownMenuGroup",kI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(cI,{...s,...n,ref:t})});kI.displayName=SI;var CI="DropdownMenuLabel",kS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(uI,{...s,...n,ref:t})});kS.displayName=CI;var jI="DropdownMenuItem",CS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(dI,{...s,...n,ref:t})});CS.displayName=jI;var EI="DropdownMenuCheckboxItem",jS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(fI,{...s,...n,ref:t})});jS.displayName=EI;var NI="DropdownMenuRadioGroup",TI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(hI,{...s,...n,ref:t})});TI.displayName=NI;var RI="DropdownMenuRadioItem",ES=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(pI,{...s,...n,ref:t})});ES.displayName=RI;var PI="DropdownMenuItemIndicator",NS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(mI,{...s,...n,ref:t})});NS.displayName=PI;var AI="DropdownMenuSeparator",TS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(gI,{...s,...n,ref:t})});TS.displayName=AI;var DI="DropdownMenuArrow",OI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(vI,{...s,...n,ref:t})});OI.displayName=DI;var MI="DropdownMenuSubTrigger",RS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(yI,{...s,...n,ref:t})});RS.displayName=MI;var II="DropdownMenuSubContent",PS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(xI,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});PS.displayName=II;var LI=yS,FI=wS,zI=_S,AS=SS,DS=kS,OS=CS,MS=jS,IS=ES,LS=NS,FS=TS,zS=RS,US=PS;const $S=LI,VS=FI,UI=v.forwardRef(({className:e,inset:t,children:r,...n},s)=>l.jsxs(zS,{ref:s,className:ae("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...n,children:[r,l.jsx(iA,{className:"ml-auto h-4 w-4"})]}));UI.displayName=zS.displayName;const $I=v.forwardRef(({className:e,...t},r)=>l.jsx(US,{ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));$I.displayName=US.displayName;const uv=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(zI,{children:l.jsx(AS,{ref:n,sideOffset:t,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));uv.displayName=AS.displayName;const Qi=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(OS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));Qi.displayName=OS.displayName;const VI=v.forwardRef(({className:e,children:t,checked:r,...n},s)=>l.jsxs(MS,{ref:s,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(eb,{className:"h-4 w-4"})})}),t]}));VI.displayName=MS.displayName;const WI=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(IS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(uA,{className:"h-2 w-2 fill-current"})})}),t]}));WI.displayName=IS.displayName;const WS=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(DS,{ref:n,className:ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));WS.displayName=DS.displayName;const BS=v.forwardRef(({className:e,...t},r)=>l.jsx(FS,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));BS.displayName=FS.displayName;var dv="Dialog",[HS,YS]=xr(dv),[BI,Tn]=HS(dv),ZS=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[u=!1,d]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(BI,{scope:t,triggerRef:a,contentRef:c,contentId:Ur(),titleId:Ur(),descriptionId:Ur(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};ZS.displayName=dv;var KS="DialogTrigger",GS=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(KS,r),o=Ke(t,s.triggerRef);return l.jsx(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":pv(s.open),...n,ref:o,onClick:ce(e.onClick,s.onOpenToggle)})});GS.displayName=KS;var fv="DialogPortal",[HI,qS]=HS(fv,{forceMount:void 0}),XS=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=Tn(fv,t);return l.jsx(HI,{scope:t,forceMount:r,children:v.Children.map(n,i=>l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:i})}))})};XS.displayName=fv;var Nd="DialogOverlay",QS=v.forwardRef((e,t)=>{const r=qS(Nd,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(Nd,e.__scopeDialog);return o.modal?l.jsx(ur,{present:n||o.open,children:l.jsx(YI,{...s,ref:t})}):null});QS.displayName=Nd;var YI=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(Nd,r);return l.jsx(jf,{as:bs,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(Re.div,{"data-state":pv(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ni="DialogContent",JS=v.forwardRef((e,t)=>{const r=qS(ni,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(ni,e.__scopeDialog);return l.jsx(ur,{present:n||o.open,children:o.modal?l.jsx(ZI,{...s,ref:t}):l.jsx(KI,{...s,ref:t})})});JS.displayName=ni;var ZI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(null),s=Ke(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ek,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ce(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault())})}),KI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(!1),s=v.useRef(!1);return l.jsx(ek,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),ek=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=Tn(ni,r),c=v.useRef(null),u=Ke(t,c);return Vg(),l.jsxs(l.Fragment,{children:[l.jsx(wf,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(Na,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":pv(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(qI,{titleId:a.titleId}),l.jsx(QI,{contentRef:c,descriptionId:a.descriptionId})]})]})}),hv="DialogTitle",tk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(hv,r);return l.jsx(Re.h2,{id:s.titleId,...n,ref:t})});tk.displayName=hv;var rk="DialogDescription",nk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(rk,r);return l.jsx(Re.p,{id:s.descriptionId,...n,ref:t})});nk.displayName=rk;var sk="DialogClose",ok=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(sk,r);return l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,()=>s.onOpenChange(!1))})});ok.displayName=sk;function pv(e){return e?"open":"closed"}var ik="DialogTitleWarning",[GI,ak]=oD(ik,{contentName:ni,titleName:hv,docsSlug:"dialog"}),qI=({titleId:e})=>{const t=ak(ik),r=`\`${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 v.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},XI="DialogDescriptionWarning",QI=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ak(XI).contentName}}.`;return v.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},mv=ZS,gv=GS,vv=XS,Ec=QS,Nc=JS,Tc=tk,Rc=nk,Tf=ok;const yv=mv,xv=gv,JI=vv,lk=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));lk.displayName=Ec.displayName;const eL=_c("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Rf=v.forwardRef(({side:e="right",className:t,children:r,...n},s)=>l.jsxs(JI,{children:[l.jsx(lk,{}),l.jsxs(Nc,{ref:s,className:ae(eL({side:e}),t),...n,children:[r,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[l.jsx(Fg,{className:"h-4 w-4 dark:text-stone-200"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rf.displayName=Nc.displayName;const wv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});wv.displayName="SheetHeader";const _v=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold text-foreground",e),...t}));_v.displayName=Tc.displayName;const tL=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));tL.displayName=Rc.displayName;class Vr extends Error{constructor(t){var r,n,s,o;super("ClientResponseError"),this.url="",this.status=0,this.response={},this.isAbort=!1,this.originalError=null,Object.setPrototypeOf(this,Vr.prototype),t!==null&&typeof t=="object"&&(this.url=typeof t.url=="string"?t.url:"",this.status=typeof t.status=="number"?t.status:0,this.isAbort=!!t.isAbort,this.originalError=t.originalError,t.response!==null&&typeof t.response=="object"?this.response=t.response:t.data!==null&&typeof t.data=="object"?this.response=t.data:this.response={}),this.originalError||t instanceof Vr||(this.originalError=t),typeof DOMException<"u"&&t instanceof DOMException&&(this.isAbort=!0),this.name="ClientResponseError "+this.status,this.message=(r=this.response)==null?void 0:r.message,this.message||(this.isAbort?this.message="The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.":(o=(s=(n=this.originalError)==null?void 0:n.cause)==null?void 0:s.message)!=null&&o.includes("ECONNREFUSED ::1")?this.message="Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).":this.message="Something went wrong while processing your request.")}get data(){return this.response}toJSON(){return{...this}}}const xu=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function rL(e,t){const r={};if(typeof e!="string")return r;const n=Object.assign({},{}).decode||nL;let s=0;for(;s0&&(!r.exp||r.exp-t>Date.now()/1e3))}ck=typeof atob!="function"||oL?e=>{let t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,s=0,o=0,i="";n=t.charAt(o++);~n&&(r=s%4?64*r+n:n,s++%4)?i+=String.fromCharCode(255&r>>(-2*s&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return i}:atob;const K0="pb_auth";class iL{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get model(){return this.baseModel}get isValid(){return!uk(this.token)}get isAdmin(){return Ji(this.token).type==="admin"}get isAuthRecord(){return Ji(this.token).type==="authRecord"}save(t,r){this.baseToken=t||"",this.baseModel=r||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(t,r=K0){const n=rL(t||"")[r]||"";let s={};try{s=JSON.parse(n),(typeof s===null||typeof s!="object"||Array.isArray(s))&&(s={})}catch{}this.save(s.token||"",s.model||null)}exportToCookie(t,r=K0){var c,u;const n={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},s=Ji(this.token);n.expires=s!=null&&s.exp?new Date(1e3*s.exp):new Date("1970-01-01"),t=Object.assign({},n,t);const o={token:this.token,model:this.model?JSON.parse(JSON.stringify(this.model)):null};let i=Z0(r,JSON.stringify(o),t);const a=typeof Blob<"u"?new Blob([i]).size:i.length;if(o.model&&a>4096){o.model={id:(c=o==null?void 0:o.model)==null?void 0:c.id,email:(u=o==null?void 0:o.model)==null?void 0:u.email};const d=["collectionId","username","verified"];for(const f in this.model)d.includes(f)&&(o.model[f]=this.model[f]);i=Z0(r,JSON.stringify(o),t)}return i}onChange(t,r=!1){return this._onChangeCallbacks.push(t),r&&t(this.token,this.model),()=>{for(let n=this._onChangeCallbacks.length-1;n>=0;n--)if(this._onChangeCallbacks[n]==t)return delete this._onChangeCallbacks[n],void this._onChangeCallbacks.splice(n,1)}}triggerChange(){for(const t of this._onChangeCallbacks)t&&t(this.token,this.model)}}class aL extends iL{constructor(t="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=t,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get model(){return(this._storageGet(this.storageKey)||{}).model||null}save(t,r){this._storageSet(this.storageKey,{token:t,model:r}),super.save(t,r)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(t){if(typeof window<"u"&&(window!=null&&window.localStorage)){const r=window.localStorage.getItem(t)||"";try{return JSON.parse(r)}catch{return r}}return this.storageFallback[t]}_storageSet(t,r){if(typeof window<"u"&&(window!=null&&window.localStorage)){let n=r;typeof r!="string"&&(n=JSON.stringify(r)),window.localStorage.setItem(t,n)}else this.storageFallback[t]=r}_storageRemove(t){var r;typeof window<"u"&&(window!=null&&window.localStorage)&&((r=window.localStorage)==null||r.removeItem(t)),delete this.storageFallback[t]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",t=>{if(t.key!=this.storageKey)return;const r=this._storageGet(this.storageKey)||{};super.save(r.token||"",r.model||null)})}}class di{constructor(t){this.client=t}}class lL extends di{async getAll(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/settings",t)}async update(t,r){return r=Object.assign({method:"PATCH",body:t},r),this.client.send("/api/settings",r)}async testS3(t="storage",r){return r=Object.assign({method:"POST",body:{filesystem:t}},r),this.client.send("/api/settings/test/s3",r).then(()=>!0)}async testEmail(t,r,n){return n=Object.assign({method:"POST",body:{email:t,template:r}},n),this.client.send("/api/settings/test/email",n).then(()=>!0)}async generateAppleClientSecret(t,r,n,s,o,i){return i=Object.assign({method:"POST",body:{clientId:t,teamId:r,keyId:n,privateKey:s,duration:o}},i),this.client.send("/api/settings/apple/generate-client-secret",i)}}class bv extends di{decode(t){return t}async getFullList(t,r){if(typeof t=="number")return this._getFullList(t,r);let n=500;return(r=Object.assign({},t,r)).batch&&(n=r.batch,delete r.batch),this._getFullList(n,r)}async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send(this.baseCrudPath,n).then(s=>{var o;return s.items=((o=s.items)==null?void 0:o.map(i=>this.decode(i)))||[],s})}async getFirstListItem(t,r){return(r=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+t},r)).query=Object.assign({filter:t,skipTotal:1},r.query),this.getList(1,1,r).then(n=>{var s;if(!((s=n==null?void 0:n.items)!=null&&s.length))throw new Vr({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return n.items[0]})}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(n=>this.decode(n))}async create(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send(this.baseCrudPath,r).then(n=>this.decode(n))}async update(t,r,n){return n=Object.assign({method:"PATCH",body:r},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),n).then(s=>this.decode(s))}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(()=>!0)}_getFullList(t=500,r){(r=r||{}).query=Object.assign({skipTotal:1},r.query);let n=[],s=async o=>this.getList(o,t||500,r).then(i=>{const a=i.items;return n=n.concat(a),a.length==i.perPage?s(o+1):n});return s(1)}}function Dr(e,t,r,n){const s=n!==void 0;return s||r!==void 0?s?(console.warn(e),t.body=Object.assign({},t.body,r),t.query=Object.assign({},t.query,n),t):Object.assign(t,r):t}function Kh(e){var t;(t=e._resetAutoRefresh)==null||t.call(e)}class cL extends bv{get baseCrudPath(){return"/api/admins"}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i;return((o=this.client.authStore.model)==null?void 0:o.id)===s.id&&((i=this.client.authStore.model)==null?void 0:i.collectionId)===void 0&&this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o;return n&&((s=this.client.authStore.model)==null?void 0:s.id)===t&&((o=this.client.authStore.model)==null?void 0:o.collectionId)===void 0&&this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.admin)||{});return t!=null&&t.token&&(t!=null&&t.admin)&&this.client.authStore.save(t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",admin:r})}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};o=Dr("This form of authWithPassword(email, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(email, pass, options?).",o,n,s);const i=o.autoRefreshThreshold;delete o.autoRefreshThreshold,o.autoRefresh||Kh(this.client);let a=await this.client.send(this.baseCrudPath+"/auth-with-password",o);return a=this.authResponse(a),i&&function(u,d,f,m){Kh(u);const y=u.beforeSend,x=u.authStore.model,g=u.authStore.onChange((_,p)=>{(!_||(p==null?void 0:p.id)!=(x==null?void 0:x.id)||(p!=null&&p.collectionId||x!=null&&x.collectionId)&&(p==null?void 0:p.collectionId)!=(x==null?void 0:x.collectionId))&&Kh(u)});u._resetAutoRefresh=function(){g(),u.beforeSend=y,delete u._resetAutoRefresh},u.beforeSend=async(_,p)=>{var j;const h=u.authStore.token;if((j=p.query)!=null&&j.autoRefresh)return y?y(_,p):{url:_,sendOptions:p};let w=u.authStore.isValid;if(w&&uk(u.authStore.token,d))try{await f()}catch{w=!1}w||await m();const C=p.headers||{};for(let E in C)if(E.toLowerCase()=="authorization"&&h==C[E]&&u.authStore.token){C[E]=u.authStore.token;break}return p.headers=C,y?y(_,p):{url:_,sendOptions:p}}}(this.client,i,()=>this.authRefresh({autoRefresh:!0}),()=>this.authWithPassword(t,r,Object.assign({autoRefresh:!0},o))),a}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCrudPath+"/auth-refresh",n).then(this.authResponse.bind(this))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCrudPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(resetToken, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(resetToken, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCrudPath+"/confirm-password-reset",i).then(()=>!0)}}const uL=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function dk(e){if(e){e.query=e.query||{};for(let t in e)uL.includes(t)||(e.query[t]=e[t],delete e[t])}}class fk extends di{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(t,r,n){var i;if(!t)throw new Error("topic must be set.");let s=t;if(n){dk(n);const a="options="+encodeURIComponent(JSON.stringify({query:n.query,headers:n.headers}));s+=(s.includes("?")?"&":"?")+a}const o=function(a){const c=a;let u;try{u=JSON.parse(c==null?void 0:c.data)}catch{}r(u||{})};return this.subscriptions[s]||(this.subscriptions[s]=[]),this.subscriptions[s].push(o),this.isConnected?this.subscriptions[s].length===1?await this.submitSubscriptions():(i=this.eventSource)==null||i.addEventListener(s,o):await this.connect(),async()=>this.unsubscribeByTopicAndListener(t,o)}async unsubscribe(t){var n;let r=!1;if(t){const s=this.getSubscriptionsByTopic(t);for(let o in s)if(this.hasSubscriptionListeners(o)){for(let i of this.subscriptions[o])(n=this.eventSource)==null||n.removeEventListener(o,i);delete this.subscriptions[o],r||(r=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?r&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(t){var n;let r=!1;for(let s in this.subscriptions)if((s+"?").startsWith(t)){r=!0;for(let o of this.subscriptions[s])(n=this.eventSource)==null||n.removeEventListener(s,o);delete this.subscriptions[s]}r&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(t,r){var o;let n=!1;const s=this.getSubscriptionsByTopic(t);for(let i in s){if(!Array.isArray(this.subscriptions[i])||!this.subscriptions[i].length)continue;let a=!1;for(let c=this.subscriptions[i].length-1;c>=0;c--)this.subscriptions[i][c]===r&&(a=!0,delete this.subscriptions[i][c],this.subscriptions[i].splice(c,1),(o=this.eventSource)==null||o.removeEventListener(i,r));a&&(this.subscriptions[i].length||delete this.subscriptions[i],n||this.hasSubscriptionListeners(i)||(n=!0))}this.hasSubscriptionListeners()?n&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(t){var r,n;if(this.subscriptions=this.subscriptions||{},t)return!!((r=this.subscriptions[t])!=null&&r.length);for(let s in this.subscriptions)if((n=this.subscriptions[s])!=null&&n.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch(t=>{if(!(t!=null&&t.isAbort))throw t})}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(t){const r={};t=t.includes("?")?t:t+"?";for(let n in this.subscriptions)(n+"?").startsWith(t)&&(r[n]=this.subscriptions[n]);return r}getNonEmptySubscriptionKeys(){const t=[];for(let r in this.subscriptions)this.subscriptions[r].length&&t.push(r);return t}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.addEventListener(t,r)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.removeEventListener(t,r)}async connect(){if(!(this.reconnectAttempts>0))return new Promise((t,r)=>{this.pendingConnects.push({resolve:t,reject:r}),this.pendingConnects.length>1||this.initConnect()})}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout(()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))},this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=t=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",t=>{const r=t;this.clientId=r==null?void 0:r.lastEventId,this.submitSubscriptions().then(async()=>{let n=3;for(;this.hasUnsentSubscriptions()&&n>0;)n--,await this.submitSubscriptions()}).then(()=>{for(let s of this.pendingConnects)s.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const n=this.getSubscriptionsByTopic("PB_CONNECT");for(let s in n)for(let o of n[s])o(t)}).catch(n=>{this.clientId="",this.connectErrorHandler(n)})})}hasUnsentSubscriptions(){const t=this.getNonEmptySubscriptionKeys();if(t.length!=this.lastSentSubscriptions.length)return!0;for(const r of t)if(!this.lastSentSubscriptions.includes(r))return!0;return!1}connectErrorHandler(t){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let n of this.pendingConnects)n.reject(new Vr(t));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const r=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.initConnect()},r)}disconnect(t=!1){var r;if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(r=this.eventSource)==null||r.close(),this.eventSource=null,this.clientId="",!t){this.reconnectAttempts=0;for(let n of this.pendingConnects)n.resolve();this.pendingConnects=[]}}}class dL extends bv{constructor(t,r){super(t),this.collectionIdOrName=r}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}async subscribe(t,r,n){if(!t)throw new Error("Missing topic.");if(!r)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+t,r,n)}async unsubscribe(t){return t?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+t):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(t,r){if(typeof t=="number")return super.getFullList(t,r);const n=Object.assign({},t,r);return super.getFullList(n)}async getList(t=1,r=30,n){return super.getList(t,r,n)}async getFirstListItem(t,r){return super.getFirstListItem(t,r)}async getOne(t,r){return super.getOne(t,r)}async create(t,r){return super.create(t,r)}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i,a;return((o=this.client.authStore.model)==null?void 0:o.id)!==(s==null?void 0:s.id)||((i=this.client.authStore.model)==null?void 0:i.collectionId)!==this.collectionIdOrName&&((a=this.client.authStore.model)==null?void 0:a.collectionName)!==this.collectionIdOrName||this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o,i;return!n||((s=this.client.authStore.model)==null?void 0:s.id)!==t||((o=this.client.authStore.model)==null?void 0:o.collectionId)!==this.collectionIdOrName&&((i=this.client.authStore.model)==null?void 0:i.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.record)||{});return this.client.authStore.save(t==null?void 0:t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",record:r})}async listAuthMethods(t){return t=Object.assign({method:"GET"},t),this.client.send(this.baseCollectionPath+"/auth-methods",t).then(r=>Object.assign({},r,{usernamePassword:!!(r!=null&&r.usernamePassword),emailPassword:!!(r!=null&&r.emailPassword),authProviders:Array.isArray(r==null?void 0:r.authProviders)?r==null?void 0:r.authProviders:[]}))}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};return o=Dr("This form of authWithPassword(usernameOrEmail, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(usernameOrEmail, pass, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/auth-with-password",o).then(i=>this.authResponse(i))}async authWithOAuth2Code(t,r,n,s,o,i,a){let c={method:"POST",body:{provider:t,code:r,codeVerifier:n,redirectUrl:s,createData:o}};return c=Dr("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, options?).",c,i,a),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",c).then(u=>this.authResponse(u))}authWithOAuth2(...t){if(t.length>1||typeof(t==null?void 0:t[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((t==null?void 0:t[0])||"",(t==null?void 0:t[1])||"",(t==null?void 0:t[2])||"",(t==null?void 0:t[3])||"",(t==null?void 0:t[4])||{},(t==null?void 0:t[5])||{},(t==null?void 0:t[6])||{});const r=(t==null?void 0:t[0])||{};let n=null;r.urlCallback||(n=G0(void 0));const s=new fk(this.client);function o(){n==null||n.close(),s.unsubscribe()}const i={},a=r.requestKey;return a&&(i.requestKey=a),this.listAuthMethods(i).then(c=>{var m;const u=c.authProviders.find(y=>y.name===r.provider);if(!u)throw new Vr(new Error(`Missing or invalid provider "${r.provider}".`));const d=this.client.buildUrl("/api/oauth2-redirect"),f=a?(m=this.client.cancelControllers)==null?void 0:m[a]:void 0;return f&&(f.signal.onabort=()=>{o()}),new Promise(async(y,x)=>{var g;try{await s.subscribe("@oauth2",async w=>{var j;const C=s.clientId;try{if(!w.state||C!==w.state)throw new Error("State parameters don't match.");if(w.error||!w.code)throw new Error("OAuth2 redirect error or missing code: "+w.error);const E=Object.assign({},r);delete E.provider,delete E.scopes,delete E.createData,delete E.urlCallback,(j=f==null?void 0:f.signal)!=null&&j.onabort&&(f.signal.onabort=null);const R=await this.authWithOAuth2Code(u.name,w.code,u.codeVerifier,d,r.createData,E);y(R)}catch(E){x(new Vr(E))}o()});const _={state:s.clientId};(g=r.scopes)!=null&&g.length&&(_.scope=r.scopes.join(" "));const p=this._replaceQueryParams(u.authUrl+d,_);await(r.urlCallback||function(w){n?n.location.href=w:n=G0(w)})(p)}catch(_){o(),x(new Vr(_))}})}).catch(c=>{throw o(),c})}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCollectionPath+"/auth-refresh",n).then(s=>this.authResponse(s))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCollectionPath+"/confirm-password-reset",i).then(()=>!0)}async requestVerification(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-verification",s).then(()=>!0)}async confirmVerification(t,r,n){let s={method:"POST",body:{token:t}};return s=Dr("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/confirm-verification",s).then(()=>{const o=Ji(t),i=this.client.authStore.model;return i&&!i.verified&&i.id===o.id&&i.collectionId===o.collectionId&&(i.verified=!0,this.client.authStore.save(this.client.authStore.token,i)),!0})}async requestEmailChange(t,r,n){let s={method:"POST",body:{newEmail:t}};return s=Dr("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-email-change",s).then(()=>!0)}async confirmEmailChange(t,r,n,s){let o={method:"POST",body:{token:t,password:r}};return o=Dr("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/confirm-email-change",o).then(()=>{const i=Ji(t),a=this.client.authStore.model;return a&&a.id===i.id&&a.collectionId===i.collectionId&&this.client.authStore.clear(),!0})}async listExternalAuths(t,r){return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths",r)}async unlinkExternalAuth(t,r,n){return n=Object.assign({method:"DELETE"},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths/"+encodeURIComponent(r),n).then(()=>!0)}_replaceQueryParams(t,r={}){let n=t,s="";t.indexOf("?")>=0&&(n=t.substring(0,t.indexOf("?")),s=t.substring(t.indexOf("?")+1));const o={},i=s.split("&");for(const a of i){if(a=="")continue;const c=a.split("=");o[decodeURIComponent(c[0].replace(/\+/g," "))]=decodeURIComponent((c[1]||"").replace(/\+/g," "))}for(let a in r)r.hasOwnProperty(a)&&(r[a]==null?delete o[a]:o[a]=r[a]);s="";for(let a in o)o.hasOwnProperty(a)&&(s!=""&&(s+="&"),s+=encodeURIComponent(a.replace(/%20/g,"+"))+"="+encodeURIComponent(o[a].replace(/%20/g,"+")));return s!=""?n+"?"+s:n}}function G0(e){if(typeof window>"u"||!(window!=null&&window.open))throw new Vr(new Error("Not in a browser context - please pass a custom urlCallback function."));let t=1024,r=768,n=window.innerWidth,s=window.innerHeight;t=t>n?n:t,r=r>s?s:r;let o=n/2-t/2,i=s/2-r/2;return window.open(e,"popup_window","width="+t+",height="+r+",top="+i+",left="+o+",resizable,menubar=no")}class fL extends bv{get baseCrudPath(){return"/api/collections"}async import(t,r=!1,n){return n=Object.assign({method:"PUT",body:{collections:t,deleteMissing:r}},n),this.client.send(this.baseCrudPath+"/import",n).then(()=>!0)}}class hL extends di{async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send("/api/logs",n)}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send("/api/logs/"+encodeURIComponent(t),r)}async getStats(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/stats",t)}}class pL extends di{async check(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/health",t)}}class mL extends di{getUrl(t,r,n={}){if(!r||!(t!=null&&t.id)||!(t!=null&&t.collectionId)&&!(t!=null&&t.collectionName))return"";const s=[];s.push("api"),s.push("files"),s.push(encodeURIComponent(t.collectionId||t.collectionName)),s.push(encodeURIComponent(t.id)),s.push(encodeURIComponent(r));let o=this.client.buildUrl(s.join("/"));if(Object.keys(n).length){n.download===!1&&delete n.download;const i=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+i}return o}async getToken(t){return t=Object.assign({method:"POST"},t),this.client.send("/api/files/token",t).then(r=>(r==null?void 0:r.token)||"")}}class gL extends di{async getFullList(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/backups",t)}async create(t,r){return r=Object.assign({method:"POST",body:{name:t}},r),this.client.send("/api/backups",r).then(()=>!0)}async upload(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send("/api/backups/upload",r).then(()=>!0)}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}`,r).then(()=>!0)}async restore(t,r){return r=Object.assign({method:"POST"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}/restore`,r).then(()=>!0)}getDownloadUrl(t,r){return this.client.buildUrl(`/api/backups/${encodeURIComponent(r)}?token=${encodeURIComponent(t)}`)}}class vL{constructor(t="/",r,n="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseUrl=t,this.lang=n,this.authStore=r||new aL,this.admins=new cL(this),this.collections=new fL(this),this.files=new mL(this),this.logs=new hL(this),this.settings=new lL(this),this.realtime=new fk(this),this.health=new pL(this),this.backups=new gL(this)}collection(t){return this.recordServices[t]||(this.recordServices[t]=new dL(this,t)),this.recordServices[t]}autoCancellation(t){return this.enableAutoCancellation=!!t,this}cancelRequest(t){return this.cancelControllers[t]&&(this.cancelControllers[t].abort(),delete this.cancelControllers[t]),this}cancelAllRequests(){for(let t in this.cancelControllers)this.cancelControllers[t].abort();return this.cancelControllers={},this}filter(t,r){if(!r)return t;for(let n in r){let s=r[n];switch(typeof s){case"boolean":case"number":s=""+s;break;case"string":s="'"+s.replace(/'/g,"\\'")+"'";break;default:s=s===null?"null":s instanceof Date?"'"+s.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(s).replace(/'/g,"\\'")+"'"}t=t.replaceAll("{:"+n+"}",s)}return t}getFileUrl(t,r,n={}){return this.files.getUrl(t,r,n)}buildUrl(t){var n;let r=this.baseUrl;return typeof window>"u"||!window.location||r.startsWith("https://")||r.startsWith("http://")||(r=(n=window.location.origin)!=null&&n.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(r+=window.location.pathname||"/",r+=r.endsWith("/")?"":"/"),r+=this.baseUrl),t&&(r+=r.endsWith("/")?"":"/",r+=t.startsWith("/")?t.substring(1):t),r}async send(t,r){r=this.initSendOptions(t,r);let n=this.buildUrl(t);if(this.beforeSend){const s=Object.assign({},await this.beforeSend(n,r));s.url!==void 0||s.options!==void 0?(n=s.url||n,r=s.options||r):Object.keys(s).length&&(r=s,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(r.query!==void 0){const s=this.serializeQueryParams(r.query);s&&(n+=(n.includes("?")?"&":"?")+s),delete r.query}return this.getHeader(r.headers,"Content-Type")=="application/json"&&r.body&&typeof r.body!="string"&&(r.body=JSON.stringify(r.body)),(r.fetch||fetch)(n,r).then(async s=>{let o={};try{o=await s.json()}catch{}if(this.afterSend&&(o=await this.afterSend(s,o)),s.status>=400)throw new Vr({url:s.url,status:s.status,data:o});return o}).catch(s=>{throw new Vr(s)})}initSendOptions(t,r){if((r=Object.assign({method:"GET"},r)).body=this.convertToFormDataIfNeeded(r.body),dk(r),r.query=Object.assign({},r.params,r.query),r.requestKey===void 0&&(r.$autoCancel===!1||r.query.$autoCancel===!1?r.requestKey=null:(r.$cancelKey||r.query.$cancelKey)&&(r.requestKey=r.$cancelKey||r.query.$cancelKey)),delete r.$autoCancel,delete r.query.$autoCancel,delete r.$cancelKey,delete r.query.$cancelKey,this.getHeader(r.headers,"Content-Type")!==null||this.isFormData(r.body)||(r.headers=Object.assign({},r.headers,{"Content-Type":"application/json"})),this.getHeader(r.headers,"Accept-Language")===null&&(r.headers=Object.assign({},r.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(r.headers,"Authorization")===null&&(r.headers=Object.assign({},r.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&r.requestKey!==null){const n=r.requestKey||(r.method||"GET")+t;delete r.requestKey,this.cancelRequest(n);const s=new AbortController;this.cancelControllers[n]=s,r.signal=s.signal}return r}convertToFormDataIfNeeded(t){if(typeof FormData>"u"||t===void 0||typeof t!="object"||t===null||this.isFormData(t)||!this.hasBlobField(t))return t;const r=new FormData;for(const n in t){const s=t[n];if(typeof s!="object"||this.hasBlobField({data:s})){const o=Array.isArray(s)?s:[s];for(let i of o)r.append(n,i)}else{let o={};o[n]=s,r.append("@jsonPayload",JSON.stringify(o))}}return r}hasBlobField(t){for(const r in t){const n=Array.isArray(t[r])?t[r]:[t[r]];for(const s of n)if(typeof Blob<"u"&&s instanceof Blob||typeof File<"u"&&s instanceof File)return!0}return!1}getHeader(t,r){t=t||{},r=r.toLowerCase();for(let n in t)if(n.toLowerCase()==r)return t[n];return null}isFormData(t){return t&&(t.constructor.name==="FormData"||typeof FormData<"u"&&t instanceof FormData)}serializeQueryParams(t){const r=[];for(const n in t){if(t[n]===null)continue;const s=t[n],o=encodeURIComponent(n);if(Array.isArray(s))for(const i of s)r.push(o+"="+encodeURIComponent(i));else s instanceof Date?r.push(o+"="+encodeURIComponent(s.toISOString())):typeof s!==null&&typeof s=="object"?r.push(o+"="+encodeURIComponent(JSON.stringify(s))):r.push(o+"="+encodeURIComponent(s))}return r.join("&")}}var yL={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const xL=yL.VITE_API_DOMAIN;console.log(xL);let wu;const st=()=>wu||(wu=new vL("/"),wu);//! moment.js +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},XI="DialogDescriptionWarning",QI=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ak(XI).contentName}}.`;return v.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},mv=ZS,gv=GS,vv=XS,Ec=QS,Nc=JS,Tc=tk,Rc=nk,Tf=ok;const yv=mv,xv=gv,JI=vv,lk=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));lk.displayName=Ec.displayName;const eL=_c("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Rf=v.forwardRef(({side:e="right",className:t,children:r,...n},s)=>l.jsxs(JI,{children:[l.jsx(lk,{}),l.jsxs(Nc,{ref:s,className:ae(eL({side:e}),t),...n,children:[r,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[l.jsx(Fg,{className:"h-4 w-4 dark:text-stone-200"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rf.displayName=Nc.displayName;const wv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});wv.displayName="SheetHeader";const _v=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold text-foreground",e),...t}));_v.displayName=Tc.displayName;const tL=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));tL.displayName=Rc.displayName;class Vr extends Error{constructor(t){var r,n,s,o;super("ClientResponseError"),this.url="",this.status=0,this.response={},this.isAbort=!1,this.originalError=null,Object.setPrototypeOf(this,Vr.prototype),t!==null&&typeof t=="object"&&(this.url=typeof t.url=="string"?t.url:"",this.status=typeof t.status=="number"?t.status:0,this.isAbort=!!t.isAbort,this.originalError=t.originalError,t.response!==null&&typeof t.response=="object"?this.response=t.response:t.data!==null&&typeof t.data=="object"?this.response=t.data:this.response={}),this.originalError||t instanceof Vr||(this.originalError=t),typeof DOMException<"u"&&t instanceof DOMException&&(this.isAbort=!0),this.name="ClientResponseError "+this.status,this.message=(r=this.response)==null?void 0:r.message,this.message||(this.isAbort?this.message="The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.":(o=(s=(n=this.originalError)==null?void 0:n.cause)==null?void 0:s.message)!=null&&o.includes("ECONNREFUSED ::1")?this.message="Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).":this.message="Something went wrong while processing your request.")}get data(){return this.response}toJSON(){return{...this}}}const xu=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function rL(e,t){const r={};if(typeof e!="string")return r;const n=Object.assign({},{}).decode||nL;let s=0;for(;s0&&(!r.exp||r.exp-t>Date.now()/1e3))}ck=typeof atob!="function"||oL?e=>{let t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,s=0,o=0,i="";n=t.charAt(o++);~n&&(r=s%4?64*r+n:n,s++%4)?i+=String.fromCharCode(255&r>>(-2*s&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return i}:atob;const K0="pb_auth";class iL{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get model(){return this.baseModel}get isValid(){return!uk(this.token)}get isAdmin(){return Ji(this.token).type==="admin"}get isAuthRecord(){return Ji(this.token).type==="authRecord"}save(t,r){this.baseToken=t||"",this.baseModel=r||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(t,r=K0){const n=rL(t||"")[r]||"";let s={};try{s=JSON.parse(n),(typeof s===null||typeof s!="object"||Array.isArray(s))&&(s={})}catch{}this.save(s.token||"",s.model||null)}exportToCookie(t,r=K0){var c,u;const n={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},s=Ji(this.token);n.expires=s!=null&&s.exp?new Date(1e3*s.exp):new Date("1970-01-01"),t=Object.assign({},n,t);const o={token:this.token,model:this.model?JSON.parse(JSON.stringify(this.model)):null};let i=Z0(r,JSON.stringify(o),t);const a=typeof Blob<"u"?new Blob([i]).size:i.length;if(o.model&&a>4096){o.model={id:(c=o==null?void 0:o.model)==null?void 0:c.id,email:(u=o==null?void 0:o.model)==null?void 0:u.email};const d=["collectionId","username","verified"];for(const f in this.model)d.includes(f)&&(o.model[f]=this.model[f]);i=Z0(r,JSON.stringify(o),t)}return i}onChange(t,r=!1){return this._onChangeCallbacks.push(t),r&&t(this.token,this.model),()=>{for(let n=this._onChangeCallbacks.length-1;n>=0;n--)if(this._onChangeCallbacks[n]==t)return delete this._onChangeCallbacks[n],void this._onChangeCallbacks.splice(n,1)}}triggerChange(){for(const t of this._onChangeCallbacks)t&&t(this.token,this.model)}}class aL extends iL{constructor(t="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=t,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get model(){return(this._storageGet(this.storageKey)||{}).model||null}save(t,r){this._storageSet(this.storageKey,{token:t,model:r}),super.save(t,r)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(t){if(typeof window<"u"&&(window!=null&&window.localStorage)){const r=window.localStorage.getItem(t)||"";try{return JSON.parse(r)}catch{return r}}return this.storageFallback[t]}_storageSet(t,r){if(typeof window<"u"&&(window!=null&&window.localStorage)){let n=r;typeof r!="string"&&(n=JSON.stringify(r)),window.localStorage.setItem(t,n)}else this.storageFallback[t]=r}_storageRemove(t){var r;typeof window<"u"&&(window!=null&&window.localStorage)&&((r=window.localStorage)==null||r.removeItem(t)),delete this.storageFallback[t]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",t=>{if(t.key!=this.storageKey)return;const r=this._storageGet(this.storageKey)||{};super.save(r.token||"",r.model||null)})}}class di{constructor(t){this.client=t}}class lL extends di{async getAll(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/settings",t)}async update(t,r){return r=Object.assign({method:"PATCH",body:t},r),this.client.send("/api/settings",r)}async testS3(t="storage",r){return r=Object.assign({method:"POST",body:{filesystem:t}},r),this.client.send("/api/settings/test/s3",r).then(()=>!0)}async testEmail(t,r,n){return n=Object.assign({method:"POST",body:{email:t,template:r}},n),this.client.send("/api/settings/test/email",n).then(()=>!0)}async generateAppleClientSecret(t,r,n,s,o,i){return i=Object.assign({method:"POST",body:{clientId:t,teamId:r,keyId:n,privateKey:s,duration:o}},i),this.client.send("/api/settings/apple/generate-client-secret",i)}}class bv extends di{decode(t){return t}async getFullList(t,r){if(typeof t=="number")return this._getFullList(t,r);let n=500;return(r=Object.assign({},t,r)).batch&&(n=r.batch,delete r.batch),this._getFullList(n,r)}async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send(this.baseCrudPath,n).then(s=>{var o;return s.items=((o=s.items)==null?void 0:o.map(i=>this.decode(i)))||[],s})}async getFirstListItem(t,r){return(r=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+t},r)).query=Object.assign({filter:t,skipTotal:1},r.query),this.getList(1,1,r).then(n=>{var s;if(!((s=n==null?void 0:n.items)!=null&&s.length))throw new Vr({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return n.items[0]})}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(n=>this.decode(n))}async create(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send(this.baseCrudPath,r).then(n=>this.decode(n))}async update(t,r,n){return n=Object.assign({method:"PATCH",body:r},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),n).then(s=>this.decode(s))}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(()=>!0)}_getFullList(t=500,r){(r=r||{}).query=Object.assign({skipTotal:1},r.query);let n=[],s=async o=>this.getList(o,t||500,r).then(i=>{const a=i.items;return n=n.concat(a),a.length==i.perPage?s(o+1):n});return s(1)}}function Dr(e,t,r,n){const s=n!==void 0;return s||r!==void 0?s?(console.warn(e),t.body=Object.assign({},t.body,r),t.query=Object.assign({},t.query,n),t):Object.assign(t,r):t}function Kh(e){var t;(t=e._resetAutoRefresh)==null||t.call(e)}class cL extends bv{get baseCrudPath(){return"/api/admins"}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i;return((o=this.client.authStore.model)==null?void 0:o.id)===s.id&&((i=this.client.authStore.model)==null?void 0:i.collectionId)===void 0&&this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o;return n&&((s=this.client.authStore.model)==null?void 0:s.id)===t&&((o=this.client.authStore.model)==null?void 0:o.collectionId)===void 0&&this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.admin)||{});return t!=null&&t.token&&(t!=null&&t.admin)&&this.client.authStore.save(t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",admin:r})}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};o=Dr("This form of authWithPassword(email, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(email, pass, options?).",o,n,s);const i=o.autoRefreshThreshold;delete o.autoRefreshThreshold,o.autoRefresh||Kh(this.client);let a=await this.client.send(this.baseCrudPath+"/auth-with-password",o);return a=this.authResponse(a),i&&function(u,d,f,m){Kh(u);const y=u.beforeSend,x=u.authStore.model,g=u.authStore.onChange((_,p)=>{(!_||(p==null?void 0:p.id)!=(x==null?void 0:x.id)||(p!=null&&p.collectionId||x!=null&&x.collectionId)&&(p==null?void 0:p.collectionId)!=(x==null?void 0:x.collectionId))&&Kh(u)});u._resetAutoRefresh=function(){g(),u.beforeSend=y,delete u._resetAutoRefresh},u.beforeSend=async(_,p)=>{var j;const h=u.authStore.token;if((j=p.query)!=null&&j.autoRefresh)return y?y(_,p):{url:_,sendOptions:p};let w=u.authStore.isValid;if(w&&uk(u.authStore.token,d))try{await f()}catch{w=!1}w||await m();const C=p.headers||{};for(let E in C)if(E.toLowerCase()=="authorization"&&h==C[E]&&u.authStore.token){C[E]=u.authStore.token;break}return p.headers=C,y?y(_,p):{url:_,sendOptions:p}}}(this.client,i,()=>this.authRefresh({autoRefresh:!0}),()=>this.authWithPassword(t,r,Object.assign({autoRefresh:!0},o))),a}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCrudPath+"/auth-refresh",n).then(this.authResponse.bind(this))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCrudPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(resetToken, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(resetToken, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCrudPath+"/confirm-password-reset",i).then(()=>!0)}}const uL=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function dk(e){if(e){e.query=e.query||{};for(let t in e)uL.includes(t)||(e.query[t]=e[t],delete e[t])}}class fk extends di{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(t,r,n){var i;if(!t)throw new Error("topic must be set.");let s=t;if(n){dk(n);const a="options="+encodeURIComponent(JSON.stringify({query:n.query,headers:n.headers}));s+=(s.includes("?")?"&":"?")+a}const o=function(a){const c=a;let u;try{u=JSON.parse(c==null?void 0:c.data)}catch{}r(u||{})};return this.subscriptions[s]||(this.subscriptions[s]=[]),this.subscriptions[s].push(o),this.isConnected?this.subscriptions[s].length===1?await this.submitSubscriptions():(i=this.eventSource)==null||i.addEventListener(s,o):await this.connect(),async()=>this.unsubscribeByTopicAndListener(t,o)}async unsubscribe(t){var n;let r=!1;if(t){const s=this.getSubscriptionsByTopic(t);for(let o in s)if(this.hasSubscriptionListeners(o)){for(let i of this.subscriptions[o])(n=this.eventSource)==null||n.removeEventListener(o,i);delete this.subscriptions[o],r||(r=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?r&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(t){var n;let r=!1;for(let s in this.subscriptions)if((s+"?").startsWith(t)){r=!0;for(let o of this.subscriptions[s])(n=this.eventSource)==null||n.removeEventListener(s,o);delete this.subscriptions[s]}r&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(t,r){var o;let n=!1;const s=this.getSubscriptionsByTopic(t);for(let i in s){if(!Array.isArray(this.subscriptions[i])||!this.subscriptions[i].length)continue;let a=!1;for(let c=this.subscriptions[i].length-1;c>=0;c--)this.subscriptions[i][c]===r&&(a=!0,delete this.subscriptions[i][c],this.subscriptions[i].splice(c,1),(o=this.eventSource)==null||o.removeEventListener(i,r));a&&(this.subscriptions[i].length||delete this.subscriptions[i],n||this.hasSubscriptionListeners(i)||(n=!0))}this.hasSubscriptionListeners()?n&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(t){var r,n;if(this.subscriptions=this.subscriptions||{},t)return!!((r=this.subscriptions[t])!=null&&r.length);for(let s in this.subscriptions)if((n=this.subscriptions[s])!=null&&n.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch(t=>{if(!(t!=null&&t.isAbort))throw t})}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(t){const r={};t=t.includes("?")?t:t+"?";for(let n in this.subscriptions)(n+"?").startsWith(t)&&(r[n]=this.subscriptions[n]);return r}getNonEmptySubscriptionKeys(){const t=[];for(let r in this.subscriptions)this.subscriptions[r].length&&t.push(r);return t}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.addEventListener(t,r)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.removeEventListener(t,r)}async connect(){if(!(this.reconnectAttempts>0))return new Promise((t,r)=>{this.pendingConnects.push({resolve:t,reject:r}),this.pendingConnects.length>1||this.initConnect()})}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout(()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))},this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=t=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",t=>{const r=t;this.clientId=r==null?void 0:r.lastEventId,this.submitSubscriptions().then(async()=>{let n=3;for(;this.hasUnsentSubscriptions()&&n>0;)n--,await this.submitSubscriptions()}).then(()=>{for(let s of this.pendingConnects)s.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const n=this.getSubscriptionsByTopic("PB_CONNECT");for(let s in n)for(let o of n[s])o(t)}).catch(n=>{this.clientId="",this.connectErrorHandler(n)})})}hasUnsentSubscriptions(){const t=this.getNonEmptySubscriptionKeys();if(t.length!=this.lastSentSubscriptions.length)return!0;for(const r of t)if(!this.lastSentSubscriptions.includes(r))return!0;return!1}connectErrorHandler(t){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let n of this.pendingConnects)n.reject(new Vr(t));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const r=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.initConnect()},r)}disconnect(t=!1){var r;if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(r=this.eventSource)==null||r.close(),this.eventSource=null,this.clientId="",!t){this.reconnectAttempts=0;for(let n of this.pendingConnects)n.resolve();this.pendingConnects=[]}}}class dL extends bv{constructor(t,r){super(t),this.collectionIdOrName=r}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}async subscribe(t,r,n){if(!t)throw new Error("Missing topic.");if(!r)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+t,r,n)}async unsubscribe(t){return t?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+t):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(t,r){if(typeof t=="number")return super.getFullList(t,r);const n=Object.assign({},t,r);return super.getFullList(n)}async getList(t=1,r=30,n){return super.getList(t,r,n)}async getFirstListItem(t,r){return super.getFirstListItem(t,r)}async getOne(t,r){return super.getOne(t,r)}async create(t,r){return super.create(t,r)}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i,a;return((o=this.client.authStore.model)==null?void 0:o.id)!==(s==null?void 0:s.id)||((i=this.client.authStore.model)==null?void 0:i.collectionId)!==this.collectionIdOrName&&((a=this.client.authStore.model)==null?void 0:a.collectionName)!==this.collectionIdOrName||this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o,i;return!n||((s=this.client.authStore.model)==null?void 0:s.id)!==t||((o=this.client.authStore.model)==null?void 0:o.collectionId)!==this.collectionIdOrName&&((i=this.client.authStore.model)==null?void 0:i.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.record)||{});return this.client.authStore.save(t==null?void 0:t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",record:r})}async listAuthMethods(t){return t=Object.assign({method:"GET"},t),this.client.send(this.baseCollectionPath+"/auth-methods",t).then(r=>Object.assign({},r,{usernamePassword:!!(r!=null&&r.usernamePassword),emailPassword:!!(r!=null&&r.emailPassword),authProviders:Array.isArray(r==null?void 0:r.authProviders)?r==null?void 0:r.authProviders:[]}))}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};return o=Dr("This form of authWithPassword(usernameOrEmail, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(usernameOrEmail, pass, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/auth-with-password",o).then(i=>this.authResponse(i))}async authWithOAuth2Code(t,r,n,s,o,i,a){let c={method:"POST",body:{provider:t,code:r,codeVerifier:n,redirectUrl:s,createData:o}};return c=Dr("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, options?).",c,i,a),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",c).then(u=>this.authResponse(u))}authWithOAuth2(...t){if(t.length>1||typeof(t==null?void 0:t[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((t==null?void 0:t[0])||"",(t==null?void 0:t[1])||"",(t==null?void 0:t[2])||"",(t==null?void 0:t[3])||"",(t==null?void 0:t[4])||{},(t==null?void 0:t[5])||{},(t==null?void 0:t[6])||{});const r=(t==null?void 0:t[0])||{};let n=null;r.urlCallback||(n=G0(void 0));const s=new fk(this.client);function o(){n==null||n.close(),s.unsubscribe()}const i={},a=r.requestKey;return a&&(i.requestKey=a),this.listAuthMethods(i).then(c=>{var m;const u=c.authProviders.find(y=>y.name===r.provider);if(!u)throw new Vr(new Error(`Missing or invalid provider "${r.provider}".`));const d=this.client.buildUrl("/api/oauth2-redirect"),f=a?(m=this.client.cancelControllers)==null?void 0:m[a]:void 0;return f&&(f.signal.onabort=()=>{o()}),new Promise(async(y,x)=>{var g;try{await s.subscribe("@oauth2",async w=>{var j;const C=s.clientId;try{if(!w.state||C!==w.state)throw new Error("State parameters don't match.");if(w.error||!w.code)throw new Error("OAuth2 redirect error or missing code: "+w.error);const E=Object.assign({},r);delete E.provider,delete E.scopes,delete E.createData,delete E.urlCallback,(j=f==null?void 0:f.signal)!=null&&j.onabort&&(f.signal.onabort=null);const R=await this.authWithOAuth2Code(u.name,w.code,u.codeVerifier,d,r.createData,E);y(R)}catch(E){x(new Vr(E))}o()});const _={state:s.clientId};(g=r.scopes)!=null&&g.length&&(_.scope=r.scopes.join(" "));const p=this._replaceQueryParams(u.authUrl+d,_);await(r.urlCallback||function(w){n?n.location.href=w:n=G0(w)})(p)}catch(_){o(),x(new Vr(_))}})}).catch(c=>{throw o(),c})}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCollectionPath+"/auth-refresh",n).then(s=>this.authResponse(s))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCollectionPath+"/confirm-password-reset",i).then(()=>!0)}async requestVerification(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-verification",s).then(()=>!0)}async confirmVerification(t,r,n){let s={method:"POST",body:{token:t}};return s=Dr("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/confirm-verification",s).then(()=>{const o=Ji(t),i=this.client.authStore.model;return i&&!i.verified&&i.id===o.id&&i.collectionId===o.collectionId&&(i.verified=!0,this.client.authStore.save(this.client.authStore.token,i)),!0})}async requestEmailChange(t,r,n){let s={method:"POST",body:{newEmail:t}};return s=Dr("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-email-change",s).then(()=>!0)}async confirmEmailChange(t,r,n,s){let o={method:"POST",body:{token:t,password:r}};return o=Dr("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/confirm-email-change",o).then(()=>{const i=Ji(t),a=this.client.authStore.model;return a&&a.id===i.id&&a.collectionId===i.collectionId&&this.client.authStore.clear(),!0})}async listExternalAuths(t,r){return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths",r)}async unlinkExternalAuth(t,r,n){return n=Object.assign({method:"DELETE"},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths/"+encodeURIComponent(r),n).then(()=>!0)}_replaceQueryParams(t,r={}){let n=t,s="";t.indexOf("?")>=0&&(n=t.substring(0,t.indexOf("?")),s=t.substring(t.indexOf("?")+1));const o={},i=s.split("&");for(const a of i){if(a=="")continue;const c=a.split("=");o[decodeURIComponent(c[0].replace(/\+/g," "))]=decodeURIComponent((c[1]||"").replace(/\+/g," "))}for(let a in r)r.hasOwnProperty(a)&&(r[a]==null?delete o[a]:o[a]=r[a]);s="";for(let a in o)o.hasOwnProperty(a)&&(s!=""&&(s+="&"),s+=encodeURIComponent(a.replace(/%20/g,"+"))+"="+encodeURIComponent(o[a].replace(/%20/g,"+")));return s!=""?n+"?"+s:n}}function G0(e){if(typeof window>"u"||!(window!=null&&window.open))throw new Vr(new Error("Not in a browser context - please pass a custom urlCallback function."));let t=1024,r=768,n=window.innerWidth,s=window.innerHeight;t=t>n?n:t,r=r>s?s:r;let o=n/2-t/2,i=s/2-r/2;return window.open(e,"popup_window","width="+t+",height="+r+",top="+i+",left="+o+",resizable,menubar=no")}class fL extends bv{get baseCrudPath(){return"/api/collections"}async import(t,r=!1,n){return n=Object.assign({method:"PUT",body:{collections:t,deleteMissing:r}},n),this.client.send(this.baseCrudPath+"/import",n).then(()=>!0)}}class hL extends di{async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send("/api/logs",n)}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send("/api/logs/"+encodeURIComponent(t),r)}async getStats(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/stats",t)}}class pL extends di{async check(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/health",t)}}class mL extends di{getUrl(t,r,n={}){if(!r||!(t!=null&&t.id)||!(t!=null&&t.collectionId)&&!(t!=null&&t.collectionName))return"";const s=[];s.push("api"),s.push("files"),s.push(encodeURIComponent(t.collectionId||t.collectionName)),s.push(encodeURIComponent(t.id)),s.push(encodeURIComponent(r));let o=this.client.buildUrl(s.join("/"));if(Object.keys(n).length){n.download===!1&&delete n.download;const i=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+i}return o}async getToken(t){return t=Object.assign({method:"POST"},t),this.client.send("/api/files/token",t).then(r=>(r==null?void 0:r.token)||"")}}class gL extends di{async getFullList(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/backups",t)}async create(t,r){return r=Object.assign({method:"POST",body:{name:t}},r),this.client.send("/api/backups",r).then(()=>!0)}async upload(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send("/api/backups/upload",r).then(()=>!0)}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}`,r).then(()=>!0)}async restore(t,r){return r=Object.assign({method:"POST"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}/restore`,r).then(()=>!0)}getDownloadUrl(t,r){return this.client.buildUrl(`/api/backups/${encodeURIComponent(r)}?token=${encodeURIComponent(t)}`)}}class vL{constructor(t="/",r,n="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseUrl=t,this.lang=n,this.authStore=r||new aL,this.admins=new cL(this),this.collections=new fL(this),this.files=new mL(this),this.logs=new hL(this),this.settings=new lL(this),this.realtime=new fk(this),this.health=new pL(this),this.backups=new gL(this)}collection(t){return this.recordServices[t]||(this.recordServices[t]=new dL(this,t)),this.recordServices[t]}autoCancellation(t){return this.enableAutoCancellation=!!t,this}cancelRequest(t){return this.cancelControllers[t]&&(this.cancelControllers[t].abort(),delete this.cancelControllers[t]),this}cancelAllRequests(){for(let t in this.cancelControllers)this.cancelControllers[t].abort();return this.cancelControllers={},this}filter(t,r){if(!r)return t;for(let n in r){let s=r[n];switch(typeof s){case"boolean":case"number":s=""+s;break;case"string":s="'"+s.replace(/'/g,"\\'")+"'";break;default:s=s===null?"null":s instanceof Date?"'"+s.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(s).replace(/'/g,"\\'")+"'"}t=t.replaceAll("{:"+n+"}",s)}return t}getFileUrl(t,r,n={}){return this.files.getUrl(t,r,n)}buildUrl(t){var n;let r=this.baseUrl;return typeof window>"u"||!window.location||r.startsWith("https://")||r.startsWith("http://")||(r=(n=window.location.origin)!=null&&n.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(r+=window.location.pathname||"/",r+=r.endsWith("/")?"":"/"),r+=this.baseUrl),t&&(r+=r.endsWith("/")?"":"/",r+=t.startsWith("/")?t.substring(1):t),r}async send(t,r){r=this.initSendOptions(t,r);let n=this.buildUrl(t);if(this.beforeSend){const s=Object.assign({},await this.beforeSend(n,r));s.url!==void 0||s.options!==void 0?(n=s.url||n,r=s.options||r):Object.keys(s).length&&(r=s,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(r.query!==void 0){const s=this.serializeQueryParams(r.query);s&&(n+=(n.includes("?")?"&":"?")+s),delete r.query}return this.getHeader(r.headers,"Content-Type")=="application/json"&&r.body&&typeof r.body!="string"&&(r.body=JSON.stringify(r.body)),(r.fetch||fetch)(n,r).then(async s=>{let o={};try{o=await s.json()}catch{}if(this.afterSend&&(o=await this.afterSend(s,o)),s.status>=400)throw new Vr({url:s.url,status:s.status,data:o});return o}).catch(s=>{throw new Vr(s)})}initSendOptions(t,r){if((r=Object.assign({method:"GET"},r)).body=this.convertToFormDataIfNeeded(r.body),dk(r),r.query=Object.assign({},r.params,r.query),r.requestKey===void 0&&(r.$autoCancel===!1||r.query.$autoCancel===!1?r.requestKey=null:(r.$cancelKey||r.query.$cancelKey)&&(r.requestKey=r.$cancelKey||r.query.$cancelKey)),delete r.$autoCancel,delete r.query.$autoCancel,delete r.$cancelKey,delete r.query.$cancelKey,this.getHeader(r.headers,"Content-Type")!==null||this.isFormData(r.body)||(r.headers=Object.assign({},r.headers,{"Content-Type":"application/json"})),this.getHeader(r.headers,"Accept-Language")===null&&(r.headers=Object.assign({},r.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(r.headers,"Authorization")===null&&(r.headers=Object.assign({},r.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&r.requestKey!==null){const n=r.requestKey||(r.method||"GET")+t;delete r.requestKey,this.cancelRequest(n);const s=new AbortController;this.cancelControllers[n]=s,r.signal=s.signal}return r}convertToFormDataIfNeeded(t){if(typeof FormData>"u"||t===void 0||typeof t!="object"||t===null||this.isFormData(t)||!this.hasBlobField(t))return t;const r=new FormData;for(const n in t){const s=t[n];if(typeof s!="object"||this.hasBlobField({data:s})){const o=Array.isArray(s)?s:[s];for(let i of o)r.append(n,i)}else{let o={};o[n]=s,r.append("@jsonPayload",JSON.stringify(o))}}return r}hasBlobField(t){for(const r in t){const n=Array.isArray(t[r])?t[r]:[t[r]];for(const s of n)if(typeof Blob<"u"&&s instanceof Blob||typeof File<"u"&&s instanceof File)return!0}return!1}getHeader(t,r){t=t||{},r=r.toLowerCase();for(let n in t)if(n.toLowerCase()==r)return t[n];return null}isFormData(t){return t&&(t.constructor.name==="FormData"||typeof FormData<"u"&&t instanceof FormData)}serializeQueryParams(t){const r=[];for(const n in t){if(t[n]===null)continue;const s=t[n],o=encodeURIComponent(n);if(Array.isArray(s))for(const i of s)r.push(o+"="+encodeURIComponent(i));else s instanceof Date?r.push(o+"="+encodeURIComponent(s.toISOString())):typeof s!==null&&typeof s=="object"?r.push(o+"="+encodeURIComponent(JSON.stringify(s))):r.push(o+"="+encodeURIComponent(s))}return r.join("&")}}const yL=void 0;console.log(yL);let wu;const st=()=>wu||(wu=new vL("/"),wu);//! moment.js //! version : 2.30.1 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com -var hk;function ve(){return hk.apply(null,arguments)}function wL(e){hk=e}function Cn(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function Zo(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function ct(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Sv(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(ct(e,t))return!1;return!0}function _r(e){return e===void 0}function Cs(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function Pc(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function pk(e,t){var r=[],n,s=e.length;for(n=0;n>>0,n;for(n=0;n0)for(r=0;r>>0,n;for(n=0;n0)for(r=0;r=0;return(o?r?"+":"":"-")+Math.pow(10,Math.max(0,s)).toString().substr(1)+n}var Ev=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_u=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,qh={},ea={};function Ie(e,t,r,n){var s=n;typeof n=="string"&&(s=function(){return this[n]()}),e&&(ea[e]=s),t&&(ea[t[0]]=function(){return Hn(s.apply(this,arguments),t[1],t[2])}),r&&(ea[r]=function(){return this.localeData().ordinal(s.apply(this,arguments),e)})}function CL(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function jL(e){var t=e.match(Ev),r,n;for(r=0,n=t.length;r=0&&_u.test(e);)e=e.replace(_u,n),_u.lastIndex=0,r-=1;return e}var EL={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function NL(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(Ev).map(function(n){return n==="MMMM"||n==="MM"||n==="DD"||n==="dddd"?n.slice(1):n}).join(""),this._longDateFormat[e])}var TL="Invalid date";function RL(){return this._invalidDate}var PL="%d",AL=/\d{1,2}/;function DL(e){return this._ordinal.replace("%d",e)}var OL={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function ML(e,t,r,n){var s=this._relativeTime[r];return Gn(s)?s(e,t,r,n):s.replace(/%d/i,e)}function IL(e,t){var r=this._relativeTime[e>0?"future":"past"];return Gn(r)?r(t):r.replace(/%s/i,t)}var Q0={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ln(e){return typeof e=="string"?Q0[e]||Q0[e.toLowerCase()]:void 0}function Nv(e){var t={},r,n;for(n in e)ct(e,n)&&(r=ln(n),r&&(t[r]=e[n]));return t}var LL={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function FL(e){var t=[],r;for(r in e)ct(e,r)&&t.push({unit:r,priority:LL[r]});return t.sort(function(n,s){return n.priority-s.priority}),t}var yk=/\d/,Zr=/\d\d/,xk=/\d{3}/,Tv=/\d{4}/,Af=/[+-]?\d{6}/,Ct=/\d\d?/,wk=/\d\d\d\d?/,_k=/\d\d\d\d\d\d?/,Df=/\d{1,3}/,Rv=/\d{1,4}/,Of=/[+-]?\d{1,6}/,Aa=/\d+/,Mf=/[+-]?\d+/,zL=/Z|[+-]\d\d:?\d\d/gi,If=/Z|[+-]\d\d(?::?\d\d)?/gi,UL=/[+-]?\d+(\.\d{1,3})?/,Dc=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Da=/^[1-9]\d?/,Pv=/^([1-9]\d|\d)/,Td;Td={};function _e(e,t,r){Td[e]=Gn(t)?t:function(n,s){return n&&r?r:t}}function $L(e,t){return ct(Td,e)?Td[e](t._strict,t._locale):new RegExp(VL(e))}function VL(e){return gs(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,r,n,s,o){return r||n||s||o}))}function gs(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Jr(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function rt(e){var t=+e,r=0;return t!==0&&isFinite(t)&&(r=Jr(t)),r}var pm={};function vt(e,t){var r,n=t,s;for(typeof e=="string"&&(e=[e]),Cs(t)&&(n=function(o,i){i[t]=rt(o)}),s=e.length,r=0;r68?1900:2e3)};var bk=Oa("FullYear",!0);function YL(){return Lf(this.year())}function Oa(e,t){return function(r){return r!=null?(Sk(this,e,r),ve.updateOffset(this,t),this):Xl(this,e)}}function Xl(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function Sk(e,t,r){var n,s,o,i,a;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,s=e._isUTC,t){case"Milliseconds":return void(s?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(s?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(s?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(s?n.setUTCHours(r):n.setHours(r));case"Date":return void(s?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=r,i=e.month(),a=e.date(),a=a===29&&i===1&&!Lf(o)?28:a,s?n.setUTCFullYear(o,i,a):n.setFullYear(o,i,a)}}function ZL(e){return e=ln(e),Gn(this[e])?this[e]():this}function KL(e,t){if(typeof e=="object"){e=Nv(e);var r=FL(e),n,s=r.length;for(n=0;n=0?(a=new Date(e+400,t,r,n,s,o,i),isFinite(a.getFullYear())&&a.setFullYear(e)):a=new Date(e,t,r,n,s,o,i),a}function Ql(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,t=new Date(Date.UTC.apply(null,r)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Rd(e,t,r){var n=7+t-r,s=(7+Ql(e,0,n).getUTCDay()-t)%7;return-s+n-1}function Tk(e,t,r,n,s){var o=(7+r-n)%7,i=Rd(e,n,s),a=1+7*(t-1)+o+i,c,u;return a<=0?(c=e-1,u=bl(c)+a):a>bl(e)?(c=e+1,u=a-bl(e)):(c=e,u=a),{year:c,dayOfYear:u}}function Jl(e,t,r){var n=Rd(e.year(),t,r),s=Math.floor((e.dayOfYear()-n-1)/7)+1,o,i;return s<1?(i=e.year()-1,o=s+vs(i,t,r)):s>vs(e.year(),t,r)?(o=s-vs(e.year(),t,r),i=e.year()+1):(i=e.year(),o=s),{week:o,year:i}}function vs(e,t,r){var n=Rd(e,t,r),s=Rd(e+1,t,r);return(bl(e)-n+s)/7}Ie("w",["ww",2],"wo","week");Ie("W",["WW",2],"Wo","isoWeek");_e("w",Ct,Da);_e("ww",Ct,Zr);_e("W",Ct,Da);_e("WW",Ct,Zr);Oc(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=rt(e)});function a4(e){return Jl(e,this._week.dow,this._week.doy).week}var l4={dow:0,doy:6};function c4(){return this._week.dow}function u4(){return this._week.doy}function d4(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function f4(e){var t=Jl(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}Ie("d",0,"do","day");Ie("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)});Ie("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)});Ie("dddd",0,0,function(e){return this.localeData().weekdays(this,e)});Ie("e",0,0,"weekday");Ie("E",0,0,"isoWeekday");_e("d",Ct);_e("e",Ct);_e("E",Ct);_e("dd",function(e,t){return t.weekdaysMinRegex(e)});_e("ddd",function(e,t){return t.weekdaysShortRegex(e)});_e("dddd",function(e,t){return t.weekdaysRegex(e)});Oc(["dd","ddd","dddd"],function(e,t,r,n){var s=r._locale.weekdaysParse(e,n,r._strict);s!=null?t.d=s:Xe(r).invalidWeekday=e});Oc(["d","e","E"],function(e,t,r,n){t[n]=rt(e)});function h4(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function p4(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Dv(e,t){return e.slice(t,7).concat(e.slice(0,t))}var m4="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Rk="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),g4="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),v4=Dc,y4=Dc,x4=Dc;function w4(e,t){var r=Cn(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?Dv(r,this._week.dow):e?r[e.day()]:r}function _4(e){return e===!0?Dv(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function b4(e){return e===!0?Dv(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function S4(e,t,r){var n,s,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=Kn([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();return r?t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1?s:null):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null):(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null):t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1||(s=zt.call(this._shortWeekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):(s=zt.call(this._minWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null))}function k4(e,t,r){var n,s,o;if(this._weekdaysParseExact)return S4.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(s=Kn([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(s,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(s,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(s,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(s,"")+"|^"+this.weekdaysShort(s,"")+"|^"+this.weekdaysMin(s,""),this._weekdaysParse[n]=new RegExp(o.replace(".",""),"i")),r&&t==="dddd"&&this._fullWeekdaysParse[n].test(e))return n;if(r&&t==="ddd"&&this._shortWeekdaysParse[n].test(e))return n;if(r&&t==="dd"&&this._minWeekdaysParse[n].test(e))return n;if(!r&&this._weekdaysParse[n].test(e))return n}}function C4(e){if(!this.isValid())return e!=null?this:NaN;var t=Xl(this,"Day");return e!=null?(e=h4(e,this.localeData()),this.add(e-t,"d")):t}function j4(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function E4(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=p4(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function N4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(ct(this,"_weekdaysRegex")||(this._weekdaysRegex=v4),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function T4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ct(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=y4),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function R4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ct(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=x4),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ov(){function e(d,f){return f.length-d.length}var t=[],r=[],n=[],s=[],o,i,a,c,u;for(o=0;o<7;o++)i=Kn([2e3,1]).day(o),a=gs(this.weekdaysMin(i,"")),c=gs(this.weekdaysShort(i,"")),u=gs(this.weekdays(i,"")),t.push(a),r.push(c),n.push(u),s.push(a),s.push(c),s.push(u);t.sort(e),r.sort(e),n.sort(e),s.sort(e),this._weekdaysRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Mv(){return this.hours()%12||12}function P4(){return this.hours()||24}Ie("H",["HH",2],0,"hour");Ie("h",["hh",2],0,Mv);Ie("k",["kk",2],0,P4);Ie("hmm",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)});Ie("hmmss",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)+Hn(this.seconds(),2)});Ie("Hmm",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)});Ie("Hmmss",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)+Hn(this.seconds(),2)});function Pk(e,t){Ie(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}Pk("a",!0);Pk("A",!1);function Ak(e,t){return t._meridiemParse}_e("a",Ak);_e("A",Ak);_e("H",Ct,Pv);_e("h",Ct,Da);_e("k",Ct,Da);_e("HH",Ct,Zr);_e("hh",Ct,Zr);_e("kk",Ct,Zr);_e("hmm",wk);_e("hmmss",_k);_e("Hmm",wk);_e("Hmmss",_k);vt(["H","HH"],Gt);vt(["k","kk"],function(e,t,r){var n=rt(e);t[Gt]=n===24?0:n});vt(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e});vt(["h","hh"],function(e,t,r){t[Gt]=rt(e),Xe(r).bigHour=!0});vt("hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n)),Xe(r).bigHour=!0});vt("hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s)),Xe(r).bigHour=!0});vt("Hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n))});vt("Hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s))});function A4(e){return(e+"").toLowerCase().charAt(0)==="p"}var D4=/[ap]\.?m?\.?/i,O4=Oa("Hours",!0);function M4(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"}var Dk={calendar:SL,longDateFormat:EL,invalidDate:TL,ordinal:PL,dayOfMonthOrdinalParse:AL,relativeTime:OL,months:qL,monthsShort:kk,week:l4,weekdays:m4,weekdaysMin:g4,weekdaysShort:Rk,meridiemParse:D4},Nt={},Xa={},ec;function I4(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r0;){if(s=Ff(o.slice(0,r).join("-")),s)return s;if(n&&n.length>=r&&I4(o,n)>=r-1)break;r--}t++}return ec}function F4(e){return!!(e&&e.match("^[^/\\\\]*$"))}function Ff(e){var t=null,r;if(Nt[e]===void 0&&typeof Gu<"u"&&Gu&&Gu.exports&&F4(e))try{t=ec._abbr,r=require,r("./locale/"+e),co(t)}catch{Nt[e]=null}return Nt[e]}function co(e,t){var r;return e&&(_r(t)?r=As(e):r=Iv(e,t),r?ec=r:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ec._abbr}function Iv(e,t){if(t!==null){var r,n=Dk;if(t.abbr=e,Nt[e]!=null)gk("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Nt[e]._config;else if(t.parentLocale!=null)if(Nt[t.parentLocale]!=null)n=Nt[t.parentLocale]._config;else if(r=Ff(t.parentLocale),r!=null)n=r._config;else return Xa[t.parentLocale]||(Xa[t.parentLocale]=[]),Xa[t.parentLocale].push({name:e,config:t}),null;return Nt[e]=new jv(fm(n,t)),Xa[e]&&Xa[e].forEach(function(s){Iv(s.name,s.config)}),co(e),Nt[e]}else return delete Nt[e],null}function z4(e,t){if(t!=null){var r,n,s=Dk;Nt[e]!=null&&Nt[e].parentLocale!=null?Nt[e].set(fm(Nt[e]._config,t)):(n=Ff(e),n!=null&&(s=n._config),t=fm(s,t),n==null&&(t.abbr=e),r=new jv(t),r.parentLocale=Nt[e],Nt[e]=r),co(e)}else Nt[e]!=null&&(Nt[e].parentLocale!=null?(Nt[e]=Nt[e].parentLocale,e===co()&&co(e)):Nt[e]!=null&&delete Nt[e]);return Nt[e]}function As(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ec;if(!Cn(e)){if(t=Ff(e),t)return t;e=[e]}return L4(e)}function U4(){return hm(Nt)}function Lv(e){var t,r=e._a;return r&&Xe(e).overflow===-2&&(t=r[fs]<0||r[fs]>11?fs:r[Ln]<1||r[Ln]>Av(r[ar],r[fs])?Ln:r[Gt]<0||r[Gt]>24||r[Gt]===24&&(r[vn]!==0||r[hs]!==0||r[Wo]!==0)?Gt:r[vn]<0||r[vn]>59?vn:r[hs]<0||r[hs]>59?hs:r[Wo]<0||r[Wo]>999?Wo:-1,Xe(e)._overflowDayOfYear&&(tLn)&&(t=Ln),Xe(e)._overflowWeeks&&t===-1&&(t=BL),Xe(e)._overflowWeekday&&t===-1&&(t=HL),Xe(e).overflow=t),e}var $4=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,V4=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,W4=/Z|[+-]\d\d(?::?\d\d)?/,bu=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Xh=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],B4=/^\/?Date\((-?\d+)/i,H4=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Y4={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ok(e){var t,r,n=e._i,s=$4.exec(n)||V4.exec(n),o,i,a,c,u=bu.length,d=Xh.length;if(s){for(Xe(e).iso=!0,t=0,r=u;tbl(i)||e._dayOfYear===0)&&(Xe(e)._overflowDayOfYear=!0),r=Ql(i,0,e._dayOfYear),e._a[fs]=r.getUTCMonth(),e._a[Ln]=r.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=n[t]=s[t];for(;t<7;t++)e._a[t]=n[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[Gt]===24&&e._a[vn]===0&&e._a[hs]===0&&e._a[Wo]===0&&(e._nextDay=!0,e._a[Gt]=0),e._d=(e._useUTC?Ql:i4).apply(null,n),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Gt]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(Xe(e).weekdayMismatch=!0)}}function e5(e){var t,r,n,s,o,i,a,c,u;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,r=Ci(t.GG,e._a[ar],Jl(kt(),1,4).year),n=Ci(t.W,1),s=Ci(t.E,1),(s<1||s>7)&&(c=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,u=Jl(kt(),o,i),r=Ci(t.gg,e._a[ar],u.year),n=Ci(t.w,u.week),t.d!=null?(s=t.d,(s<0||s>6)&&(c=!0)):t.e!=null?(s=t.e+o,(t.e<0||t.e>6)&&(c=!0)):s=o),n<1||n>vs(r,o,i)?Xe(e)._overflowWeeks=!0:c!=null?Xe(e)._overflowWeekday=!0:(a=Tk(r,n,s,o,i),e._a[ar]=a.year,e._dayOfYear=a.dayOfYear)}ve.ISO_8601=function(){};ve.RFC_2822=function(){};function zv(e){if(e._f===ve.ISO_8601){Ok(e);return}if(e._f===ve.RFC_2822){Mk(e);return}e._a=[],Xe(e).empty=!0;var t=""+e._i,r,n,s,o,i,a=t.length,c=0,u,d;for(s=vk(e._f,e._locale).match(Ev)||[],d=s.length,r=0;r0&&Xe(e).unusedInput.push(i),t=t.slice(t.indexOf(n)+n.length),c+=n.length),ea[o]?(n?Xe(e).empty=!1:Xe(e).unusedTokens.push(o),WL(o,n,e)):e._strict&&!n&&Xe(e).unusedTokens.push(o);Xe(e).charsLeftOver=a-c,t.length>0&&Xe(e).unusedInput.push(t),e._a[Gt]<=12&&Xe(e).bigHour===!0&&e._a[Gt]>0&&(Xe(e).bigHour=void 0),Xe(e).parsedDateParts=e._a.slice(0),Xe(e).meridiem=e._meridiem,e._a[Gt]=t5(e._locale,e._a[Gt],e._meridiem),u=Xe(e).era,u!==null&&(e._a[ar]=e._locale.erasConvertYear(u,e._a[ar])),Fv(e),Lv(e)}function t5(e,t,r){var n;return r==null?t:e.meridiemHour!=null?e.meridiemHour(t,r):(e.isPM!=null&&(n=e.isPM(r),n&&t<12&&(t+=12),!n&&t===12&&(t=0)),t)}function r5(e){var t,r,n,s,o,i,a=!1,c=e._f.length;if(c===0){Xe(e).invalidFormat=!0,e._d=new Date(NaN);return}for(s=0;sthis?this:e:Pf()});function Fk(e,t){var r,n;if(t.length===1&&Cn(t[0])&&(t=t[0]),!t.length)return kt();for(r=t[0],n=1;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function S5(){if(!_r(this._isDSTShifted))return this._isDSTShifted;var e={},t;return Cv(e,this),e=Ik(e),e._a?(t=e._isUTC?Kn(e._a):kt(e._a),this._isDSTShifted=this.isValid()&&p5(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function k5(){return this.isValid()?!this._isUTC:!1}function C5(){return this.isValid()?this._isUTC:!1}function Uk(){return this.isValid()?this._isUTC&&this._offset===0:!1}var j5=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,E5=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Rn(e,t){var r=e,n=null,s,o,i;return Bu(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:Cs(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(n=j5.exec(e))?(s=n[1]==="-"?-1:1,r={y:0,d:rt(n[Ln])*s,h:rt(n[Gt])*s,m:rt(n[vn])*s,s:rt(n[hs])*s,ms:rt(mm(n[Wo]*1e3))*s}):(n=E5.exec(e))?(s=n[1]==="-"?-1:1,r={y:Po(n[2],s),M:Po(n[3],s),w:Po(n[4],s),d:Po(n[5],s),h:Po(n[6],s),m:Po(n[7],s),s:Po(n[8],s)}):r==null?r={}:typeof r=="object"&&("from"in r||"to"in r)&&(i=N5(kt(r.from),kt(r.to)),r={},r.ms=i.milliseconds,r.M=i.months),o=new zf(r),Bu(e)&&ct(e,"_locale")&&(o._locale=e._locale),Bu(e)&&ct(e,"_isValid")&&(o._isValid=e._isValid),o}Rn.fn=zf.prototype;Rn.invalid=h5;function Po(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function ew(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=+t-+e.clone().add(r.months,"M"),r}function N5(e,t){var r;return e.isValid()&&t.isValid()?(t=$v(t,e),e.isBefore(t)?r=ew(e,t):(r=ew(t,e),r.milliseconds=-r.milliseconds,r.months=-r.months),r):{milliseconds:0,months:0}}function $k(e,t){return function(r,n){var s,o;return n!==null&&!isNaN(+n)&&(gk(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=r,r=n,n=o),s=Rn(r,n),Vk(this,s,e),this}}function Vk(e,t,r,n){var s=t._milliseconds,o=mm(t._days),i=mm(t._months);e.isValid()&&(n=n??!0,i&&jk(e,Xl(e,"Month")+i*r),o&&Sk(e,"Date",Xl(e,"Date")+o*r),s&&e._d.setTime(e._d.valueOf()+s*r),n&&ve.updateOffset(e,o||i))}var T5=$k(1,"add"),R5=$k(-1,"subtract");function Wk(e){return typeof e=="string"||e instanceof String}function P5(e){return jn(e)||Pc(e)||Wk(e)||Cs(e)||D5(e)||A5(e)||e===null||e===void 0}function A5(e){var t=Zo(e)&&!Sv(e),r=!1,n=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s,o,i=n.length;for(s=0;sr.valueOf():r.valueOf()9999?Wu(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Gn(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Wu(r,"Z")):Wu(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Z5(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",r,n,s,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),r="["+e+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",s="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(r+n+s+o)}function K5(e){e||(e=this.isUtc()?ve.defaultFormatUtc:ve.defaultFormat);var t=Wu(this,e);return this.localeData().postformat(t)}function G5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function q5(e){return this.from(kt(),e)}function X5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Q5(e){return this.to(kt(),e)}function Bk(e){var t;return e===void 0?this._locale._abbr:(t=As(e),t!=null&&(this._locale=t),this)}var Hk=an("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function Yk(){return this._locale}var Pd=1e3,ta=60*Pd,Ad=60*ta,Zk=(365*400+97)*24*Ad;function ra(e,t){return(e%t+t)%t}function Kk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-Zk:new Date(e,t,r).valueOf()}function Gk(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-Zk:Date.UTC(e,t,r)}function J5(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year(),0,1);break;case"quarter":t=r(this.year(),this.month()-this.month()%3,1);break;case"month":t=r(this.year(),this.month(),1);break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=r(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad);break;case"minute":t=this._d.valueOf(),t-=ra(t,ta);break;case"second":t=this._d.valueOf(),t-=ra(t,Pd);break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function eF(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year()+1,0,1)-1;break;case"quarter":t=r(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=r(this.year(),this.month()+1,1)-1;break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=r(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Ad-ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad)-1;break;case"minute":t=this._d.valueOf(),t+=ta-ra(t,ta)-1;break;case"second":t=this._d.valueOf(),t+=Pd-ra(t,Pd)-1;break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function tF(){return this._d.valueOf()-(this._offset||0)*6e4}function rF(){return Math.floor(this.valueOf()/1e3)}function nF(){return new Date(this.valueOf())}function sF(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function oF(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function iF(){return this.isValid()?this.toISOString():null}function aF(){return kv(this)}function lF(){return Qs({},Xe(this))}function cF(){return Xe(this).overflow}function uF(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Ie("N",0,0,"eraAbbr");Ie("NN",0,0,"eraAbbr");Ie("NNN",0,0,"eraAbbr");Ie("NNNN",0,0,"eraName");Ie("NNNNN",0,0,"eraNarrow");Ie("y",["y",1],"yo","eraYear");Ie("y",["yy",2],0,"eraYear");Ie("y",["yyy",3],0,"eraYear");Ie("y",["yyyy",4],0,"eraYear");_e("N",Vv);_e("NN",Vv);_e("NNN",Vv);_e("NNNN",_F);_e("NNNNN",bF);vt(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var s=r._locale.erasParse(e,n,r._strict);s?Xe(r).era=s:Xe(r).invalidEra=e});_e("y",Aa);_e("yy",Aa);_e("yyy",Aa);_e("yyyy",Aa);_e("yo",SF);vt(["y","yy","yyy","yyyy"],ar);vt(["yo"],function(e,t,r,n){var s;r._locale._eraYearOrdinalRegex&&(s=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[ar]=r._locale.eraYearOrdinalParse(e,s):t[ar]=parseInt(e,10)});function dF(e,t){var r,n,s,o=this._eras||As("en")._eras;for(r=0,n=o.length;r=0)return o[n]}function hF(e,t){var r=e.since<=e.until?1:-1;return t===void 0?ve(e.since).year():ve(e.since).year()+(t-e.offset)*r}function pF(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;eo&&(t=o),RF.call(this,e,t,r,n,s))}function RF(e,t,r,n,s){var o=Tk(e,t,r,n,s),i=Ql(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}Ie("Q",0,"Qo","quarter");_e("Q",yk);vt("Q",function(e,t){t[fs]=(rt(e)-1)*3});function PF(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}Ie("D",["DD",2],"Do","date");_e("D",Ct,Da);_e("DD",Ct,Zr);_e("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient});vt(["D","DD"],Ln);vt("Do",function(e,t){t[Ln]=rt(e.match(Ct)[0])});var Xk=Oa("Date",!0);Ie("DDD",["DDDD",3],"DDDo","dayOfYear");_e("DDD",Df);_e("DDDD",xk);vt(["DDD","DDDD"],function(e,t,r){r._dayOfYear=rt(e)});function AF(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}Ie("m",["mm",2],0,"minute");_e("m",Ct,Pv);_e("mm",Ct,Zr);vt(["m","mm"],vn);var DF=Oa("Minutes",!1);Ie("s",["ss",2],0,"second");_e("s",Ct,Pv);_e("ss",Ct,Zr);vt(["s","ss"],hs);var OF=Oa("Seconds",!1);Ie("S",0,0,function(){return~~(this.millisecond()/100)});Ie(0,["SS",2],0,function(){return~~(this.millisecond()/10)});Ie(0,["SSS",3],0,"millisecond");Ie(0,["SSSS",4],0,function(){return this.millisecond()*10});Ie(0,["SSSSS",5],0,function(){return this.millisecond()*100});Ie(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});Ie(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});Ie(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});Ie(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});_e("S",Df,yk);_e("SS",Df,Zr);_e("SSS",Df,xk);var Js,Qk;for(Js="SSSS";Js.length<=9;Js+="S")_e(Js,Aa);function MF(e,t){t[Wo]=rt(("0."+e)*1e3)}for(Js="S";Js.length<=9;Js+="S")vt(Js,MF);Qk=Oa("Milliseconds",!1);Ie("z",0,0,"zoneAbbr");Ie("zz",0,0,"zoneName");function IF(){return this._isUTC?"UTC":""}function LF(){return this._isUTC?"Coordinated Universal Time":""}var le=Ac.prototype;le.add=T5;le.calendar=I5;le.clone=L5;le.diff=B5;le.endOf=eF;le.format=K5;le.from=G5;le.fromNow=q5;le.to=X5;le.toNow=Q5;le.get=ZL;le.invalidAt=cF;le.isAfter=F5;le.isBefore=z5;le.isBetween=U5;le.isSame=$5;le.isSameOrAfter=V5;le.isSameOrBefore=W5;le.isValid=aF;le.lang=Hk;le.locale=Bk;le.localeData=Yk;le.max=a5;le.min=i5;le.parsingFlags=lF;le.set=KL;le.startOf=J5;le.subtract=R5;le.toArray=sF;le.toObject=oF;le.toDate=nF;le.toISOString=Y5;le.inspect=Z5;typeof Symbol<"u"&&Symbol.for!=null&&(le[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});le.toJSON=iF;le.toString=H5;le.unix=rF;le.valueOf=tF;le.creationData=uF;le.eraName=pF;le.eraNarrow=mF;le.eraAbbr=gF;le.eraYear=vF;le.year=bk;le.isLeapYear=YL;le.weekYear=kF;le.isoWeekYear=CF;le.quarter=le.quarters=PF;le.month=Ek;le.daysInMonth=n4;le.week=le.weeks=d4;le.isoWeek=le.isoWeeks=f4;le.weeksInYear=NF;le.weeksInWeekYear=TF;le.isoWeeksInYear=jF;le.isoWeeksInISOWeekYear=EF;le.date=Xk;le.day=le.days=C4;le.weekday=j4;le.isoWeekday=E4;le.dayOfYear=AF;le.hour=le.hours=O4;le.minute=le.minutes=DF;le.second=le.seconds=OF;le.millisecond=le.milliseconds=Qk;le.utcOffset=g5;le.utc=y5;le.local=x5;le.parseZone=w5;le.hasAlignedHourOffset=_5;le.isDST=b5;le.isLocal=k5;le.isUtcOffset=C5;le.isUtc=Uk;le.isUTC=Uk;le.zoneAbbr=IF;le.zoneName=LF;le.dates=an("dates accessor is deprecated. Use date instead.",Xk);le.months=an("months accessor is deprecated. Use month instead",Ek);le.years=an("years accessor is deprecated. Use year instead",bk);le.zone=an("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",v5);le.isDSTShifted=an("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",S5);function FF(e){return kt(e*1e3)}function zF(){return kt.apply(null,arguments).parseZone()}function Jk(e){return e}var ut=jv.prototype;ut.calendar=kL;ut.longDateFormat=NL;ut.invalidDate=RL;ut.ordinal=DL;ut.preparse=Jk;ut.postformat=Jk;ut.relativeTime=ML;ut.pastFuture=IL;ut.set=bL;ut.eras=dF;ut.erasParse=fF;ut.erasConvertYear=hF;ut.erasAbbrRegex=xF;ut.erasNameRegex=yF;ut.erasNarrowRegex=wF;ut.months=JL;ut.monthsShort=e4;ut.monthsParse=r4;ut.monthsRegex=o4;ut.monthsShortRegex=s4;ut.week=a4;ut.firstDayOfYear=u4;ut.firstDayOfWeek=c4;ut.weekdays=w4;ut.weekdaysMin=b4;ut.weekdaysShort=_4;ut.weekdaysParse=k4;ut.weekdaysRegex=N4;ut.weekdaysShortRegex=T4;ut.weekdaysMinRegex=R4;ut.isPM=A4;ut.meridiem=M4;function Dd(e,t,r,n){var s=As(),o=Kn().set(n,t);return s[r](o,e)}function eC(e,t,r){if(Cs(e)&&(t=e,e=void 0),e=e||"",t!=null)return Dd(e,t,r,"month");var n,s=[];for(n=0;n<12;n++)s[n]=Dd(e,n,r,"month");return s}function Bv(e,t,r,n){typeof e=="boolean"?(Cs(t)&&(r=t,t=void 0),t=t||""):(t=e,r=t,e=!1,Cs(t)&&(r=t,t=void 0),t=t||"");var s=As(),o=e?s._week.dow:0,i,a=[];if(r!=null)return Dd(t,(r+o)%7,n,"day");for(i=0;i<7;i++)a[i]=Dd(t,(i+o)%7,n,"day");return a}function UF(e,t){return eC(e,t,"months")}function $F(e,t){return eC(e,t,"monthsShort")}function VF(e,t,r){return Bv(e,t,r,"weekdays")}function WF(e,t,r){return Bv(e,t,r,"weekdaysShort")}function BF(e,t,r){return Bv(e,t,r,"weekdaysMin")}co("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=rt(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+r}});ve.lang=an("moment.lang is deprecated. Use moment.locale instead.",co);ve.langData=an("moment.langData is deprecated. Use moment.localeData instead.",As);var ns=Math.abs;function HF(){var e=this._data;return this._milliseconds=ns(this._milliseconds),this._days=ns(this._days),this._months=ns(this._months),e.milliseconds=ns(e.milliseconds),e.seconds=ns(e.seconds),e.minutes=ns(e.minutes),e.hours=ns(e.hours),e.months=ns(e.months),e.years=ns(e.years),this}function tC(e,t,r,n){var s=Rn(t,r);return e._milliseconds+=n*s._milliseconds,e._days+=n*s._days,e._months+=n*s._months,e._bubble()}function YF(e,t){return tC(this,e,t,1)}function ZF(e,t){return tC(this,e,t,-1)}function tw(e){return e<0?Math.floor(e):Math.ceil(e)}function KF(){var e=this._milliseconds,t=this._days,r=this._months,n=this._data,s,o,i,a,c;return e>=0&&t>=0&&r>=0||e<=0&&t<=0&&r<=0||(e+=tw(vm(r)+t)*864e5,t=0,r=0),n.milliseconds=e%1e3,s=Jr(e/1e3),n.seconds=s%60,o=Jr(s/60),n.minutes=o%60,i=Jr(o/60),n.hours=i%24,t+=Jr(i/24),c=Jr(rC(t)),r+=c,t-=tw(vm(c)),a=Jr(r/12),r%=12,n.days=t,n.months=r,n.years=a,this}function rC(e){return e*4800/146097}function vm(e){return e*146097/4800}function GF(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if(e=ln(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+n/864e5,r=this._months+rC(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(vm(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return t*24+n/36e5;case"minute":return t*1440+n/6e4;case"second":return t*86400+n/1e3;case"millisecond":return Math.floor(t*864e5)+n;default:throw new Error("Unknown unit "+e)}}function Ds(e){return function(){return this.as(e)}}var nC=Ds("ms"),qF=Ds("s"),XF=Ds("m"),QF=Ds("h"),JF=Ds("d"),e3=Ds("w"),t3=Ds("M"),r3=Ds("Q"),n3=Ds("y"),s3=nC;function o3(){return Rn(this)}function i3(e){return e=ln(e),this.isValid()?this[e+"s"]():NaN}function fi(e){return function(){return this.isValid()?this._data[e]:NaN}}var a3=fi("milliseconds"),l3=fi("seconds"),c3=fi("minutes"),u3=fi("hours"),d3=fi("days"),f3=fi("months"),h3=fi("years");function p3(){return Jr(this.days()/7)}var as=Math.round,Ui={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function m3(e,t,r,n,s){return s.relativeTime(t||1,!!r,e,n)}function g3(e,t,r,n){var s=Rn(e).abs(),o=as(s.as("s")),i=as(s.as("m")),a=as(s.as("h")),c=as(s.as("d")),u=as(s.as("M")),d=as(s.as("w")),f=as(s.as("y")),m=o<=r.ss&&["s",o]||o0,m[4]=n,m3.apply(null,m)}function v3(e){return e===void 0?as:typeof e=="function"?(as=e,!0):!1}function y3(e,t){return Ui[e]===void 0?!1:t===void 0?Ui[e]:(Ui[e]=t,e==="s"&&(Ui.ss=t-1),!0)}function x3(e,t){if(!this.isValid())return this.localeData().invalidDate();var r=!1,n=Ui,s,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(r=e),typeof t=="object"&&(n=Object.assign({},Ui,t),t.s!=null&&t.ss==null&&(n.ss=t.s-1)),s=this.localeData(),o=g3(this,!r,n,s),r&&(o=s.pastFuture(+this,o)),s.postformat(o)}var Qh=Math.abs;function Si(e){return(e>0)-(e<0)||+e}function $f(){if(!this.isValid())return this.localeData().invalidDate();var e=Qh(this._milliseconds)/1e3,t=Qh(this._days),r=Qh(this._months),n,s,o,i,a=this.asSeconds(),c,u,d,f;return a?(n=Jr(e/60),s=Jr(n/60),e%=60,n%=60,o=Jr(r/12),r%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",c=a<0?"-":"",u=Si(this._months)!==Si(a)?"-":"",d=Si(this._days)!==Si(a)?"-":"",f=Si(this._milliseconds)!==Si(a)?"-":"",c+"P"+(o?u+o+"Y":"")+(r?u+r+"M":"")+(t?d+t+"D":"")+(s||n||e?"T":"")+(s?f+s+"H":"")+(n?f+n+"M":"")+(e?f+i+"S":"")):"P0D"}var it=zf.prototype;it.isValid=f5;it.abs=HF;it.add=YF;it.subtract=ZF;it.as=GF;it.asMilliseconds=nC;it.asSeconds=qF;it.asMinutes=XF;it.asHours=QF;it.asDays=JF;it.asWeeks=e3;it.asMonths=t3;it.asQuarters=r3;it.asYears=n3;it.valueOf=s3;it._bubble=KF;it.clone=o3;it.get=i3;it.milliseconds=a3;it.seconds=l3;it.minutes=c3;it.hours=u3;it.days=d3;it.weeks=p3;it.months=f3;it.years=h3;it.humanize=x3;it.toISOString=$f;it.toString=$f;it.toJSON=$f;it.locale=Bk;it.localeData=Yk;it.toIsoString=an("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$f);it.lang=Hk;Ie("X",0,0,"unix");Ie("x",0,0,"valueOf");_e("x",Mf);_e("X",UL);vt("X",function(e,t,r){r._d=new Date(parseFloat(e)*1e3)});vt("x",function(e,t,r){r._d=new Date(rt(e))});//! moment.js -ve.version="2.30.1";wL(kt);ve.fn=le;ve.min=l5;ve.max=c5;ve.now=u5;ve.utc=Kn;ve.unix=FF;ve.months=UF;ve.isDate=Pc;ve.locale=co;ve.invalid=Pf;ve.duration=Rn;ve.isMoment=jn;ve.weekdays=VF;ve.parseZone=zF;ve.localeData=As;ve.isDuration=Bu;ve.monthsShort=$F;ve.weekdaysMin=BF;ve.defineLocale=Iv;ve.updateLocale=z4;ve.locales=U4;ve.weekdaysShort=WF;ve.normalizeUnits=ln;ve.relativeTimeRounding=v3;ve.relativeTimeThreshold=y3;ve.calendarFormat=M5;ve.prototype=le;ve.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const w3=async()=>await st().collection("access").getFullList({sort:"-created",filter:"deleted = null"}),jo=async e=>e.id?await st().collection("access").update(e.id,e):await st().collection("access").create(e),_3=async e=>(e.deleted=ve.utc().format("YYYY-MM-DD HH:mm:ss"),await st().collection("access").update(e.id,e)),rw=async()=>await st().collection("access_groups").getFullList({sort:"-created",expand:"access"}),b3=async e=>{const t=st();if((await t.collection("access").getList(1,1,{filter:`group='${e}' && deleted=null`})).items.length>0)throw new Error("该分组下有授权配置,无法删除");await t.collection("access_groups").delete(e)},S3=async e=>{const t=st();return e.id?await t.collection("access_groups").update(e.id,e):await t.collection("access_groups").create(e)},nw=async e=>await st().collection("access_groups").update(e.id,e),k3=(e,t)=>{switch(t.type){case"SET_ACCESSES":return{...e,accesses:t.payload};case"ADD_ACCESS":return{...e,accesses:[t.payload,...e.accesses]};case"DELETE_ACCESS":return{...e,accesses:e.accesses.filter(r=>r.id!==t.payload)};case"UPDATE_ACCESS":return{...e,accesses:e.accesses.map(r=>r.id===t.payload.id?t.payload:r)};case"SET_EMAILS":return{...e,emails:t.payload};case"ADD_EMAIL":return{...e,emails:{...e.emails,content:{emails:[...e.emails.content.emails,t.payload]}}};case"SET_ACCESS_GROUPS":return{...e,accessGroups:t.payload};default:return e}},C3=async()=>{try{return await st().collection("settings").getFirstListItem("name='emails'")}catch{return{content:{emails:[]}}}},sC=async e=>{try{return await st().collection("settings").getFirstListItem(`name='${e}'`)}catch{return{name:e}}},Mc=async e=>{const t=st();let r;return e.id?r=await t.collection("settings").update(e.id,e):r=await t.collection("settings").create(e),r},oC=v.createContext({}),Kr=()=>v.useContext(oC),j3=({children:e})=>{const[t,r]=v.useReducer(k3,{accesses:[],emails:{content:{emails:[]}},accessGroups:[]});v.useEffect(()=>{(async()=>{const d=await w3();r({type:"SET_ACCESSES",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await C3();r({type:"SET_EMAILS",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await rw();r({type:"SET_ACCESS_GROUPS",payload:d})})()},[]);const n=v.useCallback(async()=>{const u=await rw();r({type:"SET_ACCESS_GROUPS",payload:u})},[]),s=v.useCallback(u=>{r({type:"SET_EMAILS",payload:u})},[]),o=v.useCallback(u=>{r({type:"DELETE_ACCESS",payload:u})},[]),i=v.useCallback(u=>{r({type:"ADD_ACCESS",payload:u})},[]),a=v.useCallback(u=>{r({type:"UPDATE_ACCESS",payload:u})},[]),c=v.useCallback(u=>{r({type:"SET_ACCESS_GROUPS",payload:u})},[]);return l.jsx(oC.Provider,{value:{config:{accesses:t.accesses,emails:t.emails,accessGroups:t.accessGroups},deleteAccess:o,addAccess:i,setEmails:s,updateAccess:a,setAccessGroups:c,reloadAccessGroups:n},children:e&&e})},E3={theme:"system",setTheme:()=>null},iC=v.createContext(E3);function N3({children:e,defaultTheme:t="system",storageKey:r="vite-ui-theme",...n}){const[s,o]=v.useState(()=>localStorage.getItem(r)||t);v.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(c);return}a.classList.add(s)},[s]);const i={theme:s,setTheme:a=>{localStorage.setItem(r,a),o(a)}};return l.jsx(iC.Provider,{...n,value:i,children:e})}const T3=()=>{const e=v.useContext(iC);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function R3(){const{setTheme:e}=T3();return l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",children:[l.jsx(xA,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),l.jsx(vA,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(Qi,{onClick:()=>e("light"),children:"浅色"}),l.jsx(Qi,{onClick:()=>e("dark"),children:"暗黑"}),l.jsx(Qi,{onClick:()=>e("system"),children:"系统"})]})]})}var P3="Separator",sw="horizontal",A3=["horizontal","vertical"],aC=v.forwardRef((e,t)=>{const{decorative:r,orientation:n=sw,...s}=e,o=D3(n)?n:sw,a=r?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return l.jsx(Re.div,{"data-orientation":o,...a,...s,ref:t})});aC.displayName=P3;function D3(e){return A3.includes(e)}var lC=aC;const Wt=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>l.jsx(lC,{ref:s,decorative:r,orientation:t,className:ae("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Wt.displayName=lC.displayName;const O3="Certimate v0.1.11",cC=()=>l.jsxs("div",{className:"fixed right-0 bottom-0 w-full flex justify-between p-5",children:[l.jsx("div",{className:""}),l.jsxs("div",{className:"text-muted-foreground text-sm hover:text-stone-900 dark:hover:text-stone-200 flex",children:[l.jsxs("a",{href:"https://docs.certimate.me",target:"_blank",className:"flex items-center",children:[l.jsx(sA,{size:16}),l.jsx("div",{className:"ml-1",children:"文档"})]}),l.jsx(Wt,{orientation:"vertical",className:"mx-2"}),l.jsx("a",{href:"https://github.com/usual2970/certimate/releases",target:"_blank",children:O3})]})]});function M3(){const e=Nr(),t=Nn();if(!st().authStore.isValid||!st().authStore.isAdmin)return l.jsx(Q1,{to:"/login"});const r=t.pathname,n=i=>(console.log(r),i==r?"bg-muted text-primary":"text-muted-foreground"),s=()=>{st().authStore.clear(),e("/login")},o=()=>{e("/setting/account")};return l.jsx(l.Fragment,{children:l.jsx(j3,{children:l.jsxs("div",{className:"grid min-h-screen w-full md:grid-cols-[180px_1fr] lg:grid-cols-[200px_1fr] 2xl:md:grid-cols-[280px_1fr] ",children:[l.jsx("div",{className:"hidden border-r dark:border-stone-500 bg-muted/40 md:block",children:l.jsxs("div",{className:"flex h-full max-h-screen flex-col gap-2",children:[l.jsx("div",{className:"flex h-14 items-center border-b dark:border-stone-500 px-4 lg:h-[60px] lg:px-6",children:l.jsxs(fr,{to:"/",className:"flex items-center gap-2 font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"})]})}),l.jsx("div",{className:"flex-1",children:l.jsxs("nav",{className:"grid items-start px-2 text-sm font-medium lg:px-4",children:[l.jsxs(fr,{to:"/",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/")),children:[l.jsx(x0,{className:"h-4 w-4"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/domains")),children:[l.jsx(rm,{className:"h-4 w-4"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/access")),children:[l.jsx(w0,{className:"h-4 w-4"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/history")),children:[l.jsx(y0,{className:"h-4 w-4"}),"部署历史"]})]})})]})}),l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("header",{className:"flex h-14 items-center gap-4 border-b dark:border-stone-500 bg-muted/40 px-4 lg:h-[60px] lg:px-6",children:[l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",className:"shrink-0 md:hidden",children:[l.jsx(gA,{className:"h-5 w-5 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle navigation menu"})]})}),l.jsx(Rf,{side:"left",className:"flex flex-col",children:l.jsxs("nav",{className:"grid gap-2 text-lg font-medium",children:[l.jsxs(fr,{to:"/",className:"flex items-center gap-2 text-lg font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"}),l.jsx("span",{className:"sr-only",children:"Certimate"})]}),l.jsxs(fr,{to:"/",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/")),children:[l.jsx(x0,{className:"h-5 w-5"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/domains")),children:[l.jsx(rm,{className:"h-5 w-5"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/access")),children:[l.jsx(w0,{className:"h-5 w-5"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/history")),children:[l.jsx(y0,{className:"h-5 w-5"}),"部署历史"]})]})})]}),l.jsx("div",{className:"w-full flex-1"}),l.jsx(R3,{}),l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"secondary",size:"icon",className:"rounded-full",children:[l.jsx(cA,{className:"h-5 w-5"}),l.jsx("span",{className:"sr-only",children:"Toggle user menu"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(WS,{children:"账户"}),l.jsx(BS,{}),l.jsx(Qi,{onClick:o,children:"偏好设置"}),l.jsx(Qi,{onClick:s,children:"退出"})]})]})]}),l.jsxs("main",{className:"flex flex-1 flex-col gap-4 p-4 lg:gap-6 lg:p-6 relative",children:[l.jsx(Ig,{}),l.jsx(cC,{})]})]})]})})})}const Hv=({phase:e,phaseSuccess:t})=>{let r=l.jsx(l.Fragment,{children:" "});return e==="check"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="apply"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="deploy"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"部署"})]})),r};var I3="VisuallyHidden",Ic=v.forwardRef((e,t)=>l.jsx(Re.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}}));Ic.displayName=I3;var L3=Ic,[Vf,b$]=xr("Tooltip",[Pa]),Wf=Pa(),uC="TooltipProvider",F3=700,ym="tooltip.open",[z3,Yv]=Vf(uC),Zv=e=>{const{__scopeTooltip:t,delayDuration:r=F3,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,[i,a]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),l.jsx(z3,{scope:t,isOpenDelayed:i,delayDuration:r,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:o})};Zv.displayName=uC;var Bf="Tooltip",[U3,Hf]=Vf(Bf),dC=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s=!1,onOpenChange:o,disableHoverableContent:i,delayDuration:a}=e,c=Yv(Bf,e.__scopeTooltip),u=Wf(t),[d,f]=v.useState(null),m=Ur(),y=v.useRef(0),x=i??c.disableHoverableContent,g=a??c.delayDuration,_=v.useRef(!1),[p=!1,h]=on({prop:n,defaultProp:s,onChange:R=>{R?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),o==null||o(R)}}),w=v.useMemo(()=>p?_.current?"delayed-open":"instant-open":"closed",[p]),C=v.useCallback(()=>{window.clearTimeout(y.current),_.current=!1,h(!0)},[h]),j=v.useCallback(()=>{window.clearTimeout(y.current),h(!1)},[h]),E=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{_.current=!0,h(!0)},g)},[g,h]);return v.useEffect(()=>()=>window.clearTimeout(y.current),[]),l.jsx(Xg,{...u,children:l.jsx(U3,{scope:t,contentId:m,open:p,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayed?E():C()},[c.isOpenDelayed,E,C]),onTriggerLeave:v.useCallback(()=>{x?j():window.clearTimeout(y.current)},[j,x]),onOpen:C,onClose:j,disableHoverableContent:x,children:r})})};dC.displayName=Bf;var xm="TooltipTrigger",fC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Hf(xm,r),o=Yv(xm,r),i=Wf(r),a=v.useRef(null),c=Ke(t,a,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(Qg,{asChild:!0,...i,children:l.jsx(Re.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ce(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{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)})})});fC.displayName=xm;var $3="TooltipPortal",[S$,V3]=Vf($3,{forceMount:void 0}),ma="TooltipContent",Kv=v.forwardRef((e,t)=>{const r=V3(ma,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=Hf(ma,e.__scopeTooltip);return l.jsx(ur,{present:n||i.open,children:i.disableHoverableContent?l.jsx(hC,{side:s,...o,ref:t}):l.jsx(W3,{side:s,...o,ref:t})})}),W3=v.forwardRef((e,t)=>{const r=Hf(ma,e.__scopeTooltip),n=Yv(ma,e.__scopeTooltip),s=v.useRef(null),o=Ke(t,s),[i,a]=v.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:f}=n,m=v.useCallback(()=>{a(null),f(!1)},[f]),y=v.useCallback((x,g)=>{const _=x.currentTarget,p={x:x.clientX,y:x.clientY},h=Z3(p,_.getBoundingClientRect()),w=K3(p,h),C=G3(g.getBoundingClientRect()),j=X3([...w,...C]);a(j),f(!0)},[f]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const x=_=>y(_,d),g=_=>y(_,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",g)}}},[c,d,y,m]),v.useEffect(()=>{if(i){const x=g=>{const _=g.target,p={x:g.clientX,y:g.clientY},h=(c==null?void 0:c.contains(_))||(d==null?void 0:d.contains(_)),w=!q3(p,i);h?m():w&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,i,u,m]),l.jsx(hC,{...e,ref:o})}),[B3,H3]=Vf(Bf,{isInside:!1}),hC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,c=Hf(ma,r),u=Wf(r),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(ym,d),()=>document.removeEventListener(ym,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=m=>{const y=m.target;y!=null&&y.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(Jg,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.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:[l.jsx(zg,{children:n}),l.jsx(B3,{scope:r,isInside:!0,children:l.jsx(L3,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Kv.displayName=ma;var pC="TooltipArrow",Y3=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Wf(r);return H3(pC,r).isInside?null:l.jsx(ev,{...s,...n,ref:t})});Y3.displayName=pC;function Z3(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function K3(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function G3(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function q3(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function X3(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),Q3(t)}function Q3(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const o=r[r.length-1],i=r[r.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var J3=Zv,e6=dC,t6=fC,mC=Kv;const r6=J3,gC=e6,vC=t6,yC=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(mC,{ref:n,sideOffset:t,className:ae("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",e),...r}));yC.displayName=mC.displayName;const Gv=({deployment:e})=>{const t=r=>e.log[r]?e.log[r][e.log[r].length-1].error:"";return l.jsx(l.Fragment,{children:e.phase==="deploy"&&e.phaseSuccess||e.wholeSuccess?l.jsx(lA,{size:16,className:"text-green-700"}):l.jsx(l.Fragment,{children:t(e.phase).length?l.jsx(r6,{children:l.jsxs(gC,{children:[l.jsx(vC,{asChild:!0,className:"cursor-pointer",children:l.jsx(g0,{size:16,className:"text-red-700"})}),l.jsx(yC,{className:"max-w-[35em]",children:t(e.phase)})]})}):l.jsx(g0,{size:16,className:"text-red-700"})})})},xC=({className:e,...t})=>l.jsx("nav",{role:"navigation","aria-label":"pagination",className:ae("mx-auto flex w-full justify-center",e),...t});xC.displayName="Pagination";const wC=v.forwardRef(({className:e,...t},r)=>l.jsx("ul",{ref:r,className:ae("flex flex-row items-center gap-1",e),...t}));wC.displayName="PaginationContent";const wm=v.forwardRef(({className:e,...t},r)=>l.jsx("li",{ref:r,className:ae("",e),...t}));wm.displayName="PaginationItem";const _C=({className:e,isActive:t,size:r="icon",...n})=>l.jsx("a",{"aria-current":t?"page":void 0,className:ae(xf({variant:t?"outline":"ghost",size:r}),e),...n});_C.displayName="PaginationLink";const bC=({className:e,...t})=>l.jsxs("span",{"aria-hidden":!0,className:ae("flex h-9 w-9 items-center justify-center",e),...t,children:[l.jsx(dA,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"More pages"})]});bC.displayName="PaginationEllipsis";const SC=({totalPages:e,currentPage:t,onPageChange:r})=>{const s=()=>{if(e>7){let u=[];const d=Math.max(2,t-1),f=Math.min(e-1,t+1),m=e-1;return u=o(d,f),t>3&&u.unshift("..."),t{let d=a;const f=[];for(;d<=c;)f.push(d),d+=u;return f},i=s();return l.jsx(l.Fragment,{children:l.jsx(xC,{className:"dark:text-stone-200 justify-end mt-3",children:l.jsx(wC,{children:i.map((a,c)=>a==="..."?l.jsx(wm,{children:l.jsx(bC,{})},c):l.jsx(wm,{children:l.jsx(_C,{href:"#",isActive:t==a,onClick:u=>{u.preventDefault(),r(a)},children:a})},c))})})})},na=({when:e,children:t,fallback:r})=>e?t:r;var kC="AlertDialog",[n6,k$]=xr(kC,[YS]),Os=YS(),CC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(mv,{...n,...r,modal:!0})};CC.displayName=kC;var s6="AlertDialogTrigger",jC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(gv,{...s,...n,ref:t})});jC.displayName=s6;var o6="AlertDialogPortal",EC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(vv,{...n,...r})};EC.displayName=o6;var i6="AlertDialogOverlay",NC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Ec,{...s,...n,ref:t})});NC.displayName=i6;var sa="AlertDialogContent",[a6,l6]=n6(sa),TC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,o=Os(r),i=v.useRef(null),a=Ke(t,i),c=v.useRef(null);return l.jsx(GI,{contentName:sa,titleName:RC,docsSlug:"alert-dialog",children:l.jsx(a6,{scope:r,cancelRef:c,children:l.jsxs(Nc,{role:"alertdialog",...o,...s,ref:a,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:[l.jsx(zg,{children:n}),l.jsx(u6,{contentRef:i})]})})})});TC.displayName=sa;var RC="AlertDialogTitle",PC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tc,{...s,...n,ref:t})});PC.displayName=RC;var AC="AlertDialogDescription",DC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Rc,{...s,...n,ref:t})});DC.displayName=AC;var c6="AlertDialogAction",OC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tf,{...s,...n,ref:t})});OC.displayName=c6;var MC="AlertDialogCancel",IC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=l6(MC,r),o=Os(r),i=Ke(t,s);return l.jsx(Tf,{...o,...n,ref:i})});IC.displayName=MC;var u6=({contentRef:e})=>{const t=`\`${sa}\` requires a description for the component to be accessible for screen reader users. +`+new Error().stack),r=!1}return t.apply(this,arguments)},t)}var X0={};function gk(e,t){ve.deprecationHandler!=null&&ve.deprecationHandler(e,t),X0[e]||(mk(t),X0[e]=!0)}ve.suppressDeprecationWarnings=!1;ve.deprecationHandler=null;function Gn(e){return typeof Function<"u"&&e instanceof Function||Object.prototype.toString.call(e)==="[object Function]"}function _L(e){var t,r;for(r in e)ct(e,r)&&(t=e[r],Gn(t)?this[r]=t:this["_"+r]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function fm(e,t){var r=Qs({},e),n;for(n in t)ct(t,n)&&(Zo(e[n])&&Zo(t[n])?(r[n]={},Qs(r[n],e[n]),Qs(r[n],t[n])):t[n]!=null?r[n]=t[n]:delete r[n]);for(n in e)ct(e,n)&&!ct(t,n)&&Zo(e[n])&&(r[n]=Qs({},r[n]));return r}function jv(e){e!=null&&this.set(e)}var hm;Object.keys?hm=Object.keys:hm=function(e){var t,r=[];for(t in e)ct(e,t)&&r.push(t);return r};var bL={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function SL(e,t,r){var n=this._calendar[e]||this._calendar.sameElse;return Gn(n)?n.call(t,r):n}function Hn(e,t,r){var n=""+Math.abs(e),s=t-n.length,o=e>=0;return(o?r?"+":"":"-")+Math.pow(10,Math.max(0,s)).toString().substr(1)+n}var Ev=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_u=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,qh={},ea={};function Ie(e,t,r,n){var s=n;typeof n=="string"&&(s=function(){return this[n]()}),e&&(ea[e]=s),t&&(ea[t[0]]=function(){return Hn(s.apply(this,arguments),t[1],t[2])}),r&&(ea[r]=function(){return this.localeData().ordinal(s.apply(this,arguments),e)})}function kL(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function CL(e){var t=e.match(Ev),r,n;for(r=0,n=t.length;r=0&&_u.test(e);)e=e.replace(_u,n),_u.lastIndex=0,r-=1;return e}var jL={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function EL(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(Ev).map(function(n){return n==="MMMM"||n==="MM"||n==="DD"||n==="dddd"?n.slice(1):n}).join(""),this._longDateFormat[e])}var NL="Invalid date";function TL(){return this._invalidDate}var RL="%d",PL=/\d{1,2}/;function AL(e){return this._ordinal.replace("%d",e)}var DL={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function OL(e,t,r,n){var s=this._relativeTime[r];return Gn(s)?s(e,t,r,n):s.replace(/%d/i,e)}function ML(e,t){var r=this._relativeTime[e>0?"future":"past"];return Gn(r)?r(t):r.replace(/%s/i,t)}var Q0={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ln(e){return typeof e=="string"?Q0[e]||Q0[e.toLowerCase()]:void 0}function Nv(e){var t={},r,n;for(n in e)ct(e,n)&&(r=ln(n),r&&(t[r]=e[n]));return t}var IL={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function LL(e){var t=[],r;for(r in e)ct(e,r)&&t.push({unit:r,priority:IL[r]});return t.sort(function(n,s){return n.priority-s.priority}),t}var yk=/\d/,Zr=/\d\d/,xk=/\d{3}/,Tv=/\d{4}/,Af=/[+-]?\d{6}/,Ct=/\d\d?/,wk=/\d\d\d\d?/,_k=/\d\d\d\d\d\d?/,Df=/\d{1,3}/,Rv=/\d{1,4}/,Of=/[+-]?\d{1,6}/,Aa=/\d+/,Mf=/[+-]?\d+/,FL=/Z|[+-]\d\d:?\d\d/gi,If=/Z|[+-]\d\d(?::?\d\d)?/gi,zL=/[+-]?\d+(\.\d{1,3})?/,Dc=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Da=/^[1-9]\d?/,Pv=/^([1-9]\d|\d)/,Td;Td={};function _e(e,t,r){Td[e]=Gn(t)?t:function(n,s){return n&&r?r:t}}function UL(e,t){return ct(Td,e)?Td[e](t._strict,t._locale):new RegExp($L(e))}function $L(e){return gs(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,r,n,s,o){return r||n||s||o}))}function gs(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Jr(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function rt(e){var t=+e,r=0;return t!==0&&isFinite(t)&&(r=Jr(t)),r}var pm={};function vt(e,t){var r,n=t,s;for(typeof e=="string"&&(e=[e]),Cs(t)&&(n=function(o,i){i[t]=rt(o)}),s=e.length,r=0;r68?1900:2e3)};var bk=Oa("FullYear",!0);function HL(){return Lf(this.year())}function Oa(e,t){return function(r){return r!=null?(Sk(this,e,r),ve.updateOffset(this,t),this):Xl(this,e)}}function Xl(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function Sk(e,t,r){var n,s,o,i,a;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,s=e._isUTC,t){case"Milliseconds":return void(s?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(s?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(s?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(s?n.setUTCHours(r):n.setHours(r));case"Date":return void(s?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=r,i=e.month(),a=e.date(),a=a===29&&i===1&&!Lf(o)?28:a,s?n.setUTCFullYear(o,i,a):n.setFullYear(o,i,a)}}function YL(e){return e=ln(e),Gn(this[e])?this[e]():this}function ZL(e,t){if(typeof e=="object"){e=Nv(e);var r=LL(e),n,s=r.length;for(n=0;n=0?(a=new Date(e+400,t,r,n,s,o,i),isFinite(a.getFullYear())&&a.setFullYear(e)):a=new Date(e,t,r,n,s,o,i),a}function Ql(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,t=new Date(Date.UTC.apply(null,r)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Rd(e,t,r){var n=7+t-r,s=(7+Ql(e,0,n).getUTCDay()-t)%7;return-s+n-1}function Tk(e,t,r,n,s){var o=(7+r-n)%7,i=Rd(e,n,s),a=1+7*(t-1)+o+i,c,u;return a<=0?(c=e-1,u=bl(c)+a):a>bl(e)?(c=e+1,u=a-bl(e)):(c=e,u=a),{year:c,dayOfYear:u}}function Jl(e,t,r){var n=Rd(e.year(),t,r),s=Math.floor((e.dayOfYear()-n-1)/7)+1,o,i;return s<1?(i=e.year()-1,o=s+vs(i,t,r)):s>vs(e.year(),t,r)?(o=s-vs(e.year(),t,r),i=e.year()+1):(i=e.year(),o=s),{week:o,year:i}}function vs(e,t,r){var n=Rd(e,t,r),s=Rd(e+1,t,r);return(bl(e)-n+s)/7}Ie("w",["ww",2],"wo","week");Ie("W",["WW",2],"Wo","isoWeek");_e("w",Ct,Da);_e("ww",Ct,Zr);_e("W",Ct,Da);_e("WW",Ct,Zr);Oc(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=rt(e)});function i4(e){return Jl(e,this._week.dow,this._week.doy).week}var a4={dow:0,doy:6};function l4(){return this._week.dow}function c4(){return this._week.doy}function u4(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function d4(e){var t=Jl(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}Ie("d",0,"do","day");Ie("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)});Ie("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)});Ie("dddd",0,0,function(e){return this.localeData().weekdays(this,e)});Ie("e",0,0,"weekday");Ie("E",0,0,"isoWeekday");_e("d",Ct);_e("e",Ct);_e("E",Ct);_e("dd",function(e,t){return t.weekdaysMinRegex(e)});_e("ddd",function(e,t){return t.weekdaysShortRegex(e)});_e("dddd",function(e,t){return t.weekdaysRegex(e)});Oc(["dd","ddd","dddd"],function(e,t,r,n){var s=r._locale.weekdaysParse(e,n,r._strict);s!=null?t.d=s:Xe(r).invalidWeekday=e});Oc(["d","e","E"],function(e,t,r,n){t[n]=rt(e)});function f4(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function h4(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Dv(e,t){return e.slice(t,7).concat(e.slice(0,t))}var p4="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Rk="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),m4="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),g4=Dc,v4=Dc,y4=Dc;function x4(e,t){var r=Cn(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?Dv(r,this._week.dow):e?r[e.day()]:r}function w4(e){return e===!0?Dv(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function _4(e){return e===!0?Dv(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function b4(e,t,r){var n,s,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=Kn([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();return r?t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1?s:null):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null):(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null):t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1||(s=zt.call(this._shortWeekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):(s=zt.call(this._minWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null))}function S4(e,t,r){var n,s,o;if(this._weekdaysParseExact)return b4.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(s=Kn([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(s,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(s,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(s,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(s,"")+"|^"+this.weekdaysShort(s,"")+"|^"+this.weekdaysMin(s,""),this._weekdaysParse[n]=new RegExp(o.replace(".",""),"i")),r&&t==="dddd"&&this._fullWeekdaysParse[n].test(e))return n;if(r&&t==="ddd"&&this._shortWeekdaysParse[n].test(e))return n;if(r&&t==="dd"&&this._minWeekdaysParse[n].test(e))return n;if(!r&&this._weekdaysParse[n].test(e))return n}}function k4(e){if(!this.isValid())return e!=null?this:NaN;var t=Xl(this,"Day");return e!=null?(e=f4(e,this.localeData()),this.add(e-t,"d")):t}function C4(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function j4(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=h4(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function E4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(ct(this,"_weekdaysRegex")||(this._weekdaysRegex=g4),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function N4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ct(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=v4),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function T4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ct(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=y4),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ov(){function e(d,f){return f.length-d.length}var t=[],r=[],n=[],s=[],o,i,a,c,u;for(o=0;o<7;o++)i=Kn([2e3,1]).day(o),a=gs(this.weekdaysMin(i,"")),c=gs(this.weekdaysShort(i,"")),u=gs(this.weekdays(i,"")),t.push(a),r.push(c),n.push(u),s.push(a),s.push(c),s.push(u);t.sort(e),r.sort(e),n.sort(e),s.sort(e),this._weekdaysRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Mv(){return this.hours()%12||12}function R4(){return this.hours()||24}Ie("H",["HH",2],0,"hour");Ie("h",["hh",2],0,Mv);Ie("k",["kk",2],0,R4);Ie("hmm",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)});Ie("hmmss",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)+Hn(this.seconds(),2)});Ie("Hmm",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)});Ie("Hmmss",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)+Hn(this.seconds(),2)});function Pk(e,t){Ie(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}Pk("a",!0);Pk("A",!1);function Ak(e,t){return t._meridiemParse}_e("a",Ak);_e("A",Ak);_e("H",Ct,Pv);_e("h",Ct,Da);_e("k",Ct,Da);_e("HH",Ct,Zr);_e("hh",Ct,Zr);_e("kk",Ct,Zr);_e("hmm",wk);_e("hmmss",_k);_e("Hmm",wk);_e("Hmmss",_k);vt(["H","HH"],Gt);vt(["k","kk"],function(e,t,r){var n=rt(e);t[Gt]=n===24?0:n});vt(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e});vt(["h","hh"],function(e,t,r){t[Gt]=rt(e),Xe(r).bigHour=!0});vt("hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n)),Xe(r).bigHour=!0});vt("hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s)),Xe(r).bigHour=!0});vt("Hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n))});vt("Hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s))});function P4(e){return(e+"").toLowerCase().charAt(0)==="p"}var A4=/[ap]\.?m?\.?/i,D4=Oa("Hours",!0);function O4(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"}var Dk={calendar:bL,longDateFormat:jL,invalidDate:NL,ordinal:RL,dayOfMonthOrdinalParse:PL,relativeTime:DL,months:GL,monthsShort:kk,week:a4,weekdays:p4,weekdaysMin:m4,weekdaysShort:Rk,meridiemParse:A4},Nt={},Xa={},ec;function M4(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r0;){if(s=Ff(o.slice(0,r).join("-")),s)return s;if(n&&n.length>=r&&M4(o,n)>=r-1)break;r--}t++}return ec}function L4(e){return!!(e&&e.match("^[^/\\\\]*$"))}function Ff(e){var t=null,r;if(Nt[e]===void 0&&typeof Gu<"u"&&Gu&&Gu.exports&&L4(e))try{t=ec._abbr,r=require,r("./locale/"+e),co(t)}catch{Nt[e]=null}return Nt[e]}function co(e,t){var r;return e&&(_r(t)?r=As(e):r=Iv(e,t),r?ec=r:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ec._abbr}function Iv(e,t){if(t!==null){var r,n=Dk;if(t.abbr=e,Nt[e]!=null)gk("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Nt[e]._config;else if(t.parentLocale!=null)if(Nt[t.parentLocale]!=null)n=Nt[t.parentLocale]._config;else if(r=Ff(t.parentLocale),r!=null)n=r._config;else return Xa[t.parentLocale]||(Xa[t.parentLocale]=[]),Xa[t.parentLocale].push({name:e,config:t}),null;return Nt[e]=new jv(fm(n,t)),Xa[e]&&Xa[e].forEach(function(s){Iv(s.name,s.config)}),co(e),Nt[e]}else return delete Nt[e],null}function F4(e,t){if(t!=null){var r,n,s=Dk;Nt[e]!=null&&Nt[e].parentLocale!=null?Nt[e].set(fm(Nt[e]._config,t)):(n=Ff(e),n!=null&&(s=n._config),t=fm(s,t),n==null&&(t.abbr=e),r=new jv(t),r.parentLocale=Nt[e],Nt[e]=r),co(e)}else Nt[e]!=null&&(Nt[e].parentLocale!=null?(Nt[e]=Nt[e].parentLocale,e===co()&&co(e)):Nt[e]!=null&&delete Nt[e]);return Nt[e]}function As(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ec;if(!Cn(e)){if(t=Ff(e),t)return t;e=[e]}return I4(e)}function z4(){return hm(Nt)}function Lv(e){var t,r=e._a;return r&&Xe(e).overflow===-2&&(t=r[fs]<0||r[fs]>11?fs:r[Ln]<1||r[Ln]>Av(r[ar],r[fs])?Ln:r[Gt]<0||r[Gt]>24||r[Gt]===24&&(r[vn]!==0||r[hs]!==0||r[Wo]!==0)?Gt:r[vn]<0||r[vn]>59?vn:r[hs]<0||r[hs]>59?hs:r[Wo]<0||r[Wo]>999?Wo:-1,Xe(e)._overflowDayOfYear&&(tLn)&&(t=Ln),Xe(e)._overflowWeeks&&t===-1&&(t=WL),Xe(e)._overflowWeekday&&t===-1&&(t=BL),Xe(e).overflow=t),e}var U4=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,$4=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,V4=/Z|[+-]\d\d(?::?\d\d)?/,bu=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Xh=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],W4=/^\/?Date\((-?\d+)/i,B4=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,H4={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ok(e){var t,r,n=e._i,s=U4.exec(n)||$4.exec(n),o,i,a,c,u=bu.length,d=Xh.length;if(s){for(Xe(e).iso=!0,t=0,r=u;tbl(i)||e._dayOfYear===0)&&(Xe(e)._overflowDayOfYear=!0),r=Ql(i,0,e._dayOfYear),e._a[fs]=r.getUTCMonth(),e._a[Ln]=r.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=n[t]=s[t];for(;t<7;t++)e._a[t]=n[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[Gt]===24&&e._a[vn]===0&&e._a[hs]===0&&e._a[Wo]===0&&(e._nextDay=!0,e._a[Gt]=0),e._d=(e._useUTC?Ql:o4).apply(null,n),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Gt]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(Xe(e).weekdayMismatch=!0)}}function J4(e){var t,r,n,s,o,i,a,c,u;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,r=Ci(t.GG,e._a[ar],Jl(kt(),1,4).year),n=Ci(t.W,1),s=Ci(t.E,1),(s<1||s>7)&&(c=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,u=Jl(kt(),o,i),r=Ci(t.gg,e._a[ar],u.year),n=Ci(t.w,u.week),t.d!=null?(s=t.d,(s<0||s>6)&&(c=!0)):t.e!=null?(s=t.e+o,(t.e<0||t.e>6)&&(c=!0)):s=o),n<1||n>vs(r,o,i)?Xe(e)._overflowWeeks=!0:c!=null?Xe(e)._overflowWeekday=!0:(a=Tk(r,n,s,o,i),e._a[ar]=a.year,e._dayOfYear=a.dayOfYear)}ve.ISO_8601=function(){};ve.RFC_2822=function(){};function zv(e){if(e._f===ve.ISO_8601){Ok(e);return}if(e._f===ve.RFC_2822){Mk(e);return}e._a=[],Xe(e).empty=!0;var t=""+e._i,r,n,s,o,i,a=t.length,c=0,u,d;for(s=vk(e._f,e._locale).match(Ev)||[],d=s.length,r=0;r0&&Xe(e).unusedInput.push(i),t=t.slice(t.indexOf(n)+n.length),c+=n.length),ea[o]?(n?Xe(e).empty=!1:Xe(e).unusedTokens.push(o),VL(o,n,e)):e._strict&&!n&&Xe(e).unusedTokens.push(o);Xe(e).charsLeftOver=a-c,t.length>0&&Xe(e).unusedInput.push(t),e._a[Gt]<=12&&Xe(e).bigHour===!0&&e._a[Gt]>0&&(Xe(e).bigHour=void 0),Xe(e).parsedDateParts=e._a.slice(0),Xe(e).meridiem=e._meridiem,e._a[Gt]=e5(e._locale,e._a[Gt],e._meridiem),u=Xe(e).era,u!==null&&(e._a[ar]=e._locale.erasConvertYear(u,e._a[ar])),Fv(e),Lv(e)}function e5(e,t,r){var n;return r==null?t:e.meridiemHour!=null?e.meridiemHour(t,r):(e.isPM!=null&&(n=e.isPM(r),n&&t<12&&(t+=12),!n&&t===12&&(t=0)),t)}function t5(e){var t,r,n,s,o,i,a=!1,c=e._f.length;if(c===0){Xe(e).invalidFormat=!0,e._d=new Date(NaN);return}for(s=0;sthis?this:e:Pf()});function Fk(e,t){var r,n;if(t.length===1&&Cn(t[0])&&(t=t[0]),!t.length)return kt();for(r=t[0],n=1;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function b5(){if(!_r(this._isDSTShifted))return this._isDSTShifted;var e={},t;return Cv(e,this),e=Ik(e),e._a?(t=e._isUTC?Kn(e._a):kt(e._a),this._isDSTShifted=this.isValid()&&h5(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function S5(){return this.isValid()?!this._isUTC:!1}function k5(){return this.isValid()?this._isUTC:!1}function Uk(){return this.isValid()?this._isUTC&&this._offset===0:!1}var C5=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,j5=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Rn(e,t){var r=e,n=null,s,o,i;return Bu(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:Cs(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(n=C5.exec(e))?(s=n[1]==="-"?-1:1,r={y:0,d:rt(n[Ln])*s,h:rt(n[Gt])*s,m:rt(n[vn])*s,s:rt(n[hs])*s,ms:rt(mm(n[Wo]*1e3))*s}):(n=j5.exec(e))?(s=n[1]==="-"?-1:1,r={y:Po(n[2],s),M:Po(n[3],s),w:Po(n[4],s),d:Po(n[5],s),h:Po(n[6],s),m:Po(n[7],s),s:Po(n[8],s)}):r==null?r={}:typeof r=="object"&&("from"in r||"to"in r)&&(i=E5(kt(r.from),kt(r.to)),r={},r.ms=i.milliseconds,r.M=i.months),o=new zf(r),Bu(e)&&ct(e,"_locale")&&(o._locale=e._locale),Bu(e)&&ct(e,"_isValid")&&(o._isValid=e._isValid),o}Rn.fn=zf.prototype;Rn.invalid=f5;function Po(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function ew(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=+t-+e.clone().add(r.months,"M"),r}function E5(e,t){var r;return e.isValid()&&t.isValid()?(t=$v(t,e),e.isBefore(t)?r=ew(e,t):(r=ew(t,e),r.milliseconds=-r.milliseconds,r.months=-r.months),r):{milliseconds:0,months:0}}function $k(e,t){return function(r,n){var s,o;return n!==null&&!isNaN(+n)&&(gk(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=r,r=n,n=o),s=Rn(r,n),Vk(this,s,e),this}}function Vk(e,t,r,n){var s=t._milliseconds,o=mm(t._days),i=mm(t._months);e.isValid()&&(n=n??!0,i&&jk(e,Xl(e,"Month")+i*r),o&&Sk(e,"Date",Xl(e,"Date")+o*r),s&&e._d.setTime(e._d.valueOf()+s*r),n&&ve.updateOffset(e,o||i))}var N5=$k(1,"add"),T5=$k(-1,"subtract");function Wk(e){return typeof e=="string"||e instanceof String}function R5(e){return jn(e)||Pc(e)||Wk(e)||Cs(e)||A5(e)||P5(e)||e===null||e===void 0}function P5(e){var t=Zo(e)&&!Sv(e),r=!1,n=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s,o,i=n.length;for(s=0;sr.valueOf():r.valueOf()9999?Wu(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Gn(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Wu(r,"Z")):Wu(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Y5(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",r,n,s,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),r="["+e+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",s="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(r+n+s+o)}function Z5(e){e||(e=this.isUtc()?ve.defaultFormatUtc:ve.defaultFormat);var t=Wu(this,e);return this.localeData().postformat(t)}function K5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function G5(e){return this.from(kt(),e)}function q5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function X5(e){return this.to(kt(),e)}function Bk(e){var t;return e===void 0?this._locale._abbr:(t=As(e),t!=null&&(this._locale=t),this)}var Hk=an("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function Yk(){return this._locale}var Pd=1e3,ta=60*Pd,Ad=60*ta,Zk=(365*400+97)*24*Ad;function ra(e,t){return(e%t+t)%t}function Kk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-Zk:new Date(e,t,r).valueOf()}function Gk(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-Zk:Date.UTC(e,t,r)}function Q5(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year(),0,1);break;case"quarter":t=r(this.year(),this.month()-this.month()%3,1);break;case"month":t=r(this.year(),this.month(),1);break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=r(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad);break;case"minute":t=this._d.valueOf(),t-=ra(t,ta);break;case"second":t=this._d.valueOf(),t-=ra(t,Pd);break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function J5(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year()+1,0,1)-1;break;case"quarter":t=r(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=r(this.year(),this.month()+1,1)-1;break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=r(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Ad-ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad)-1;break;case"minute":t=this._d.valueOf(),t+=ta-ra(t,ta)-1;break;case"second":t=this._d.valueOf(),t+=Pd-ra(t,Pd)-1;break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function eF(){return this._d.valueOf()-(this._offset||0)*6e4}function tF(){return Math.floor(this.valueOf()/1e3)}function rF(){return new Date(this.valueOf())}function nF(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function sF(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function oF(){return this.isValid()?this.toISOString():null}function iF(){return kv(this)}function aF(){return Qs({},Xe(this))}function lF(){return Xe(this).overflow}function cF(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Ie("N",0,0,"eraAbbr");Ie("NN",0,0,"eraAbbr");Ie("NNN",0,0,"eraAbbr");Ie("NNNN",0,0,"eraName");Ie("NNNNN",0,0,"eraNarrow");Ie("y",["y",1],"yo","eraYear");Ie("y",["yy",2],0,"eraYear");Ie("y",["yyy",3],0,"eraYear");Ie("y",["yyyy",4],0,"eraYear");_e("N",Vv);_e("NN",Vv);_e("NNN",Vv);_e("NNNN",wF);_e("NNNNN",_F);vt(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var s=r._locale.erasParse(e,n,r._strict);s?Xe(r).era=s:Xe(r).invalidEra=e});_e("y",Aa);_e("yy",Aa);_e("yyy",Aa);_e("yyyy",Aa);_e("yo",bF);vt(["y","yy","yyy","yyyy"],ar);vt(["yo"],function(e,t,r,n){var s;r._locale._eraYearOrdinalRegex&&(s=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[ar]=r._locale.eraYearOrdinalParse(e,s):t[ar]=parseInt(e,10)});function uF(e,t){var r,n,s,o=this._eras||As("en")._eras;for(r=0,n=o.length;r=0)return o[n]}function fF(e,t){var r=e.since<=e.until?1:-1;return t===void 0?ve(e.since).year():ve(e.since).year()+(t-e.offset)*r}function hF(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;eo&&(t=o),TF.call(this,e,t,r,n,s))}function TF(e,t,r,n,s){var o=Tk(e,t,r,n,s),i=Ql(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}Ie("Q",0,"Qo","quarter");_e("Q",yk);vt("Q",function(e,t){t[fs]=(rt(e)-1)*3});function RF(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}Ie("D",["DD",2],"Do","date");_e("D",Ct,Da);_e("DD",Ct,Zr);_e("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient});vt(["D","DD"],Ln);vt("Do",function(e,t){t[Ln]=rt(e.match(Ct)[0])});var Xk=Oa("Date",!0);Ie("DDD",["DDDD",3],"DDDo","dayOfYear");_e("DDD",Df);_e("DDDD",xk);vt(["DDD","DDDD"],function(e,t,r){r._dayOfYear=rt(e)});function PF(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}Ie("m",["mm",2],0,"minute");_e("m",Ct,Pv);_e("mm",Ct,Zr);vt(["m","mm"],vn);var AF=Oa("Minutes",!1);Ie("s",["ss",2],0,"second");_e("s",Ct,Pv);_e("ss",Ct,Zr);vt(["s","ss"],hs);var DF=Oa("Seconds",!1);Ie("S",0,0,function(){return~~(this.millisecond()/100)});Ie(0,["SS",2],0,function(){return~~(this.millisecond()/10)});Ie(0,["SSS",3],0,"millisecond");Ie(0,["SSSS",4],0,function(){return this.millisecond()*10});Ie(0,["SSSSS",5],0,function(){return this.millisecond()*100});Ie(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});Ie(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});Ie(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});Ie(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});_e("S",Df,yk);_e("SS",Df,Zr);_e("SSS",Df,xk);var Js,Qk;for(Js="SSSS";Js.length<=9;Js+="S")_e(Js,Aa);function OF(e,t){t[Wo]=rt(("0."+e)*1e3)}for(Js="S";Js.length<=9;Js+="S")vt(Js,OF);Qk=Oa("Milliseconds",!1);Ie("z",0,0,"zoneAbbr");Ie("zz",0,0,"zoneName");function MF(){return this._isUTC?"UTC":""}function IF(){return this._isUTC?"Coordinated Universal Time":""}var le=Ac.prototype;le.add=N5;le.calendar=M5;le.clone=I5;le.diff=W5;le.endOf=J5;le.format=Z5;le.from=K5;le.fromNow=G5;le.to=q5;le.toNow=X5;le.get=YL;le.invalidAt=lF;le.isAfter=L5;le.isBefore=F5;le.isBetween=z5;le.isSame=U5;le.isSameOrAfter=$5;le.isSameOrBefore=V5;le.isValid=iF;le.lang=Hk;le.locale=Bk;le.localeData=Yk;le.max=i5;le.min=o5;le.parsingFlags=aF;le.set=ZL;le.startOf=Q5;le.subtract=T5;le.toArray=nF;le.toObject=sF;le.toDate=rF;le.toISOString=H5;le.inspect=Y5;typeof Symbol<"u"&&Symbol.for!=null&&(le[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});le.toJSON=oF;le.toString=B5;le.unix=tF;le.valueOf=eF;le.creationData=cF;le.eraName=hF;le.eraNarrow=pF;le.eraAbbr=mF;le.eraYear=gF;le.year=bk;le.isLeapYear=HL;le.weekYear=SF;le.isoWeekYear=kF;le.quarter=le.quarters=RF;le.month=Ek;le.daysInMonth=r4;le.week=le.weeks=u4;le.isoWeek=le.isoWeeks=d4;le.weeksInYear=EF;le.weeksInWeekYear=NF;le.isoWeeksInYear=CF;le.isoWeeksInISOWeekYear=jF;le.date=Xk;le.day=le.days=k4;le.weekday=C4;le.isoWeekday=j4;le.dayOfYear=PF;le.hour=le.hours=D4;le.minute=le.minutes=AF;le.second=le.seconds=DF;le.millisecond=le.milliseconds=Qk;le.utcOffset=m5;le.utc=v5;le.local=y5;le.parseZone=x5;le.hasAlignedHourOffset=w5;le.isDST=_5;le.isLocal=S5;le.isUtcOffset=k5;le.isUtc=Uk;le.isUTC=Uk;le.zoneAbbr=MF;le.zoneName=IF;le.dates=an("dates accessor is deprecated. Use date instead.",Xk);le.months=an("months accessor is deprecated. Use month instead",Ek);le.years=an("years accessor is deprecated. Use year instead",bk);le.zone=an("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",g5);le.isDSTShifted=an("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",b5);function LF(e){return kt(e*1e3)}function FF(){return kt.apply(null,arguments).parseZone()}function Jk(e){return e}var ut=jv.prototype;ut.calendar=SL;ut.longDateFormat=EL;ut.invalidDate=TL;ut.ordinal=AL;ut.preparse=Jk;ut.postformat=Jk;ut.relativeTime=OL;ut.pastFuture=ML;ut.set=_L;ut.eras=uF;ut.erasParse=dF;ut.erasConvertYear=fF;ut.erasAbbrRegex=yF;ut.erasNameRegex=vF;ut.erasNarrowRegex=xF;ut.months=QL;ut.monthsShort=JL;ut.monthsParse=t4;ut.monthsRegex=s4;ut.monthsShortRegex=n4;ut.week=i4;ut.firstDayOfYear=c4;ut.firstDayOfWeek=l4;ut.weekdays=x4;ut.weekdaysMin=_4;ut.weekdaysShort=w4;ut.weekdaysParse=S4;ut.weekdaysRegex=E4;ut.weekdaysShortRegex=N4;ut.weekdaysMinRegex=T4;ut.isPM=P4;ut.meridiem=O4;function Dd(e,t,r,n){var s=As(),o=Kn().set(n,t);return s[r](o,e)}function eC(e,t,r){if(Cs(e)&&(t=e,e=void 0),e=e||"",t!=null)return Dd(e,t,r,"month");var n,s=[];for(n=0;n<12;n++)s[n]=Dd(e,n,r,"month");return s}function Bv(e,t,r,n){typeof e=="boolean"?(Cs(t)&&(r=t,t=void 0),t=t||""):(t=e,r=t,e=!1,Cs(t)&&(r=t,t=void 0),t=t||"");var s=As(),o=e?s._week.dow:0,i,a=[];if(r!=null)return Dd(t,(r+o)%7,n,"day");for(i=0;i<7;i++)a[i]=Dd(t,(i+o)%7,n,"day");return a}function zF(e,t){return eC(e,t,"months")}function UF(e,t){return eC(e,t,"monthsShort")}function $F(e,t,r){return Bv(e,t,r,"weekdays")}function VF(e,t,r){return Bv(e,t,r,"weekdaysShort")}function WF(e,t,r){return Bv(e,t,r,"weekdaysMin")}co("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=rt(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+r}});ve.lang=an("moment.lang is deprecated. Use moment.locale instead.",co);ve.langData=an("moment.langData is deprecated. Use moment.localeData instead.",As);var ns=Math.abs;function BF(){var e=this._data;return this._milliseconds=ns(this._milliseconds),this._days=ns(this._days),this._months=ns(this._months),e.milliseconds=ns(e.milliseconds),e.seconds=ns(e.seconds),e.minutes=ns(e.minutes),e.hours=ns(e.hours),e.months=ns(e.months),e.years=ns(e.years),this}function tC(e,t,r,n){var s=Rn(t,r);return e._milliseconds+=n*s._milliseconds,e._days+=n*s._days,e._months+=n*s._months,e._bubble()}function HF(e,t){return tC(this,e,t,1)}function YF(e,t){return tC(this,e,t,-1)}function tw(e){return e<0?Math.floor(e):Math.ceil(e)}function ZF(){var e=this._milliseconds,t=this._days,r=this._months,n=this._data,s,o,i,a,c;return e>=0&&t>=0&&r>=0||e<=0&&t<=0&&r<=0||(e+=tw(vm(r)+t)*864e5,t=0,r=0),n.milliseconds=e%1e3,s=Jr(e/1e3),n.seconds=s%60,o=Jr(s/60),n.minutes=o%60,i=Jr(o/60),n.hours=i%24,t+=Jr(i/24),c=Jr(rC(t)),r+=c,t-=tw(vm(c)),a=Jr(r/12),r%=12,n.days=t,n.months=r,n.years=a,this}function rC(e){return e*4800/146097}function vm(e){return e*146097/4800}function KF(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if(e=ln(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+n/864e5,r=this._months+rC(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(vm(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return t*24+n/36e5;case"minute":return t*1440+n/6e4;case"second":return t*86400+n/1e3;case"millisecond":return Math.floor(t*864e5)+n;default:throw new Error("Unknown unit "+e)}}function Ds(e){return function(){return this.as(e)}}var nC=Ds("ms"),GF=Ds("s"),qF=Ds("m"),XF=Ds("h"),QF=Ds("d"),JF=Ds("w"),e3=Ds("M"),t3=Ds("Q"),r3=Ds("y"),n3=nC;function s3(){return Rn(this)}function o3(e){return e=ln(e),this.isValid()?this[e+"s"]():NaN}function fi(e){return function(){return this.isValid()?this._data[e]:NaN}}var i3=fi("milliseconds"),a3=fi("seconds"),l3=fi("minutes"),c3=fi("hours"),u3=fi("days"),d3=fi("months"),f3=fi("years");function h3(){return Jr(this.days()/7)}var as=Math.round,Ui={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function p3(e,t,r,n,s){return s.relativeTime(t||1,!!r,e,n)}function m3(e,t,r,n){var s=Rn(e).abs(),o=as(s.as("s")),i=as(s.as("m")),a=as(s.as("h")),c=as(s.as("d")),u=as(s.as("M")),d=as(s.as("w")),f=as(s.as("y")),m=o<=r.ss&&["s",o]||o0,m[4]=n,p3.apply(null,m)}function g3(e){return e===void 0?as:typeof e=="function"?(as=e,!0):!1}function v3(e,t){return Ui[e]===void 0?!1:t===void 0?Ui[e]:(Ui[e]=t,e==="s"&&(Ui.ss=t-1),!0)}function y3(e,t){if(!this.isValid())return this.localeData().invalidDate();var r=!1,n=Ui,s,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(r=e),typeof t=="object"&&(n=Object.assign({},Ui,t),t.s!=null&&t.ss==null&&(n.ss=t.s-1)),s=this.localeData(),o=m3(this,!r,n,s),r&&(o=s.pastFuture(+this,o)),s.postformat(o)}var Qh=Math.abs;function Si(e){return(e>0)-(e<0)||+e}function $f(){if(!this.isValid())return this.localeData().invalidDate();var e=Qh(this._milliseconds)/1e3,t=Qh(this._days),r=Qh(this._months),n,s,o,i,a=this.asSeconds(),c,u,d,f;return a?(n=Jr(e/60),s=Jr(n/60),e%=60,n%=60,o=Jr(r/12),r%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",c=a<0?"-":"",u=Si(this._months)!==Si(a)?"-":"",d=Si(this._days)!==Si(a)?"-":"",f=Si(this._milliseconds)!==Si(a)?"-":"",c+"P"+(o?u+o+"Y":"")+(r?u+r+"M":"")+(t?d+t+"D":"")+(s||n||e?"T":"")+(s?f+s+"H":"")+(n?f+n+"M":"")+(e?f+i+"S":"")):"P0D"}var it=zf.prototype;it.isValid=d5;it.abs=BF;it.add=HF;it.subtract=YF;it.as=KF;it.asMilliseconds=nC;it.asSeconds=GF;it.asMinutes=qF;it.asHours=XF;it.asDays=QF;it.asWeeks=JF;it.asMonths=e3;it.asQuarters=t3;it.asYears=r3;it.valueOf=n3;it._bubble=ZF;it.clone=s3;it.get=o3;it.milliseconds=i3;it.seconds=a3;it.minutes=l3;it.hours=c3;it.days=u3;it.weeks=h3;it.months=d3;it.years=f3;it.humanize=y3;it.toISOString=$f;it.toString=$f;it.toJSON=$f;it.locale=Bk;it.localeData=Yk;it.toIsoString=an("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$f);it.lang=Hk;Ie("X",0,0,"unix");Ie("x",0,0,"valueOf");_e("x",Mf);_e("X",zL);vt("X",function(e,t,r){r._d=new Date(parseFloat(e)*1e3)});vt("x",function(e,t,r){r._d=new Date(rt(e))});//! moment.js +ve.version="2.30.1";xL(kt);ve.fn=le;ve.min=a5;ve.max=l5;ve.now=c5;ve.utc=Kn;ve.unix=LF;ve.months=zF;ve.isDate=Pc;ve.locale=co;ve.invalid=Pf;ve.duration=Rn;ve.isMoment=jn;ve.weekdays=$F;ve.parseZone=FF;ve.localeData=As;ve.isDuration=Bu;ve.monthsShort=UF;ve.weekdaysMin=WF;ve.defineLocale=Iv;ve.updateLocale=F4;ve.locales=z4;ve.weekdaysShort=VF;ve.normalizeUnits=ln;ve.relativeTimeRounding=g3;ve.relativeTimeThreshold=v3;ve.calendarFormat=O5;ve.prototype=le;ve.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const x3=async()=>await st().collection("access").getFullList({sort:"-created",filter:"deleted = null"}),jo=async e=>e.id?await st().collection("access").update(e.id,e):await st().collection("access").create(e),w3=async e=>(e.deleted=ve.utc().format("YYYY-MM-DD HH:mm:ss"),await st().collection("access").update(e.id,e)),rw=async()=>await st().collection("access_groups").getFullList({sort:"-created",expand:"access"}),_3=async e=>{const t=st();if((await t.collection("access").getList(1,1,{filter:`group='${e}' && deleted=null`})).items.length>0)throw new Error("该分组下有授权配置,无法删除");await t.collection("access_groups").delete(e)},b3=async e=>{const t=st();return e.id?await t.collection("access_groups").update(e.id,e):await t.collection("access_groups").create(e)},nw=async e=>await st().collection("access_groups").update(e.id,e),S3=(e,t)=>{switch(t.type){case"SET_ACCESSES":return{...e,accesses:t.payload};case"ADD_ACCESS":return{...e,accesses:[t.payload,...e.accesses]};case"DELETE_ACCESS":return{...e,accesses:e.accesses.filter(r=>r.id!==t.payload)};case"UPDATE_ACCESS":return{...e,accesses:e.accesses.map(r=>r.id===t.payload.id?t.payload:r)};case"SET_EMAILS":return{...e,emails:t.payload};case"ADD_EMAIL":return{...e,emails:{...e.emails,content:{emails:[...e.emails.content.emails,t.payload]}}};case"SET_ACCESS_GROUPS":return{...e,accessGroups:t.payload};default:return e}},k3=async()=>{try{return await st().collection("settings").getFirstListItem("name='emails'")}catch{return{content:{emails:[]}}}},sC=async e=>{try{return await st().collection("settings").getFirstListItem(`name='${e}'`)}catch{return{name:e}}},Mc=async e=>{const t=st();let r;return e.id?r=await t.collection("settings").update(e.id,e):r=await t.collection("settings").create(e),r},oC=v.createContext({}),Kr=()=>v.useContext(oC),C3=({children:e})=>{const[t,r]=v.useReducer(S3,{accesses:[],emails:{content:{emails:[]}},accessGroups:[]});v.useEffect(()=>{(async()=>{const d=await x3();r({type:"SET_ACCESSES",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await k3();r({type:"SET_EMAILS",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await rw();r({type:"SET_ACCESS_GROUPS",payload:d})})()},[]);const n=v.useCallback(async()=>{const u=await rw();r({type:"SET_ACCESS_GROUPS",payload:u})},[]),s=v.useCallback(u=>{r({type:"SET_EMAILS",payload:u})},[]),o=v.useCallback(u=>{r({type:"DELETE_ACCESS",payload:u})},[]),i=v.useCallback(u=>{r({type:"ADD_ACCESS",payload:u})},[]),a=v.useCallback(u=>{r({type:"UPDATE_ACCESS",payload:u})},[]),c=v.useCallback(u=>{r({type:"SET_ACCESS_GROUPS",payload:u})},[]);return l.jsx(oC.Provider,{value:{config:{accesses:t.accesses,emails:t.emails,accessGroups:t.accessGroups},deleteAccess:o,addAccess:i,setEmails:s,updateAccess:a,setAccessGroups:c,reloadAccessGroups:n},children:e&&e})},j3={theme:"system",setTheme:()=>null},iC=v.createContext(j3);function E3({children:e,defaultTheme:t="system",storageKey:r="vite-ui-theme",...n}){const[s,o]=v.useState(()=>localStorage.getItem(r)||t);v.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(c);return}a.classList.add(s)},[s]);const i={theme:s,setTheme:a=>{localStorage.setItem(r,a),o(a)}};return l.jsx(iC.Provider,{...n,value:i,children:e})}const N3=()=>{const e=v.useContext(iC);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function T3(){const{setTheme:e}=N3();return l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",children:[l.jsx(xA,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),l.jsx(vA,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(Qi,{onClick:()=>e("light"),children:"浅色"}),l.jsx(Qi,{onClick:()=>e("dark"),children:"暗黑"}),l.jsx(Qi,{onClick:()=>e("system"),children:"系统"})]})]})}var R3="Separator",sw="horizontal",P3=["horizontal","vertical"],aC=v.forwardRef((e,t)=>{const{decorative:r,orientation:n=sw,...s}=e,o=A3(n)?n:sw,a=r?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return l.jsx(Re.div,{"data-orientation":o,...a,...s,ref:t})});aC.displayName=R3;function A3(e){return P3.includes(e)}var lC=aC;const Wt=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>l.jsx(lC,{ref:s,decorative:r,orientation:t,className:ae("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Wt.displayName=lC.displayName;const D3="Certimate v0.1.11",cC=()=>l.jsxs("div",{className:"fixed right-0 bottom-0 w-full flex justify-between p-5",children:[l.jsx("div",{className:""}),l.jsxs("div",{className:"text-muted-foreground text-sm hover:text-stone-900 dark:hover:text-stone-200 flex",children:[l.jsxs("a",{href:"https://docs.certimate.me",target:"_blank",className:"flex items-center",children:[l.jsx(sA,{size:16}),l.jsx("div",{className:"ml-1",children:"文档"})]}),l.jsx(Wt,{orientation:"vertical",className:"mx-2"}),l.jsx("a",{href:"https://github.com/usual2970/certimate/releases",target:"_blank",children:D3})]})]});function O3(){const e=Nr(),t=Nn();if(!st().authStore.isValid||!st().authStore.isAdmin)return l.jsx(Q1,{to:"/login"});const r=t.pathname,n=i=>(console.log(r),i==r?"bg-muted text-primary":"text-muted-foreground"),s=()=>{st().authStore.clear(),e("/login")},o=()=>{e("/setting/account")};return l.jsx(l.Fragment,{children:l.jsx(C3,{children:l.jsxs("div",{className:"grid min-h-screen w-full md:grid-cols-[180px_1fr] lg:grid-cols-[200px_1fr] 2xl:md:grid-cols-[280px_1fr] ",children:[l.jsx("div",{className:"hidden border-r dark:border-stone-500 bg-muted/40 md:block",children:l.jsxs("div",{className:"flex h-full max-h-screen flex-col gap-2",children:[l.jsx("div",{className:"flex h-14 items-center border-b dark:border-stone-500 px-4 lg:h-[60px] lg:px-6",children:l.jsxs(fr,{to:"/",className:"flex items-center gap-2 font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"})]})}),l.jsx("div",{className:"flex-1",children:l.jsxs("nav",{className:"grid items-start px-2 text-sm font-medium lg:px-4",children:[l.jsxs(fr,{to:"/",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/")),children:[l.jsx(x0,{className:"h-4 w-4"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/domains")),children:[l.jsx(rm,{className:"h-4 w-4"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/access")),children:[l.jsx(w0,{className:"h-4 w-4"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/history")),children:[l.jsx(y0,{className:"h-4 w-4"}),"部署历史"]})]})})]})}),l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("header",{className:"flex h-14 items-center gap-4 border-b dark:border-stone-500 bg-muted/40 px-4 lg:h-[60px] lg:px-6",children:[l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",className:"shrink-0 md:hidden",children:[l.jsx(gA,{className:"h-5 w-5 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle navigation menu"})]})}),l.jsx(Rf,{side:"left",className:"flex flex-col",children:l.jsxs("nav",{className:"grid gap-2 text-lg font-medium",children:[l.jsxs(fr,{to:"/",className:"flex items-center gap-2 text-lg font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"}),l.jsx("span",{className:"sr-only",children:"Certimate"})]}),l.jsxs(fr,{to:"/",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/")),children:[l.jsx(x0,{className:"h-5 w-5"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/domains")),children:[l.jsx(rm,{className:"h-5 w-5"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/access")),children:[l.jsx(w0,{className:"h-5 w-5"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/history")),children:[l.jsx(y0,{className:"h-5 w-5"}),"部署历史"]})]})})]}),l.jsx("div",{className:"w-full flex-1"}),l.jsx(T3,{}),l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"secondary",size:"icon",className:"rounded-full",children:[l.jsx(cA,{className:"h-5 w-5"}),l.jsx("span",{className:"sr-only",children:"Toggle user menu"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(WS,{children:"账户"}),l.jsx(BS,{}),l.jsx(Qi,{onClick:o,children:"偏好设置"}),l.jsx(Qi,{onClick:s,children:"退出"})]})]})]}),l.jsxs("main",{className:"flex flex-1 flex-col gap-4 p-4 lg:gap-6 lg:p-6 relative",children:[l.jsx(Ig,{}),l.jsx(cC,{})]})]})]})})})}const Hv=({phase:e,phaseSuccess:t})=>{let r=l.jsx(l.Fragment,{children:" "});return e==="check"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="apply"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="deploy"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"部署"})]})),r};var M3="VisuallyHidden",Ic=v.forwardRef((e,t)=>l.jsx(Re.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}}));Ic.displayName=M3;var I3=Ic,[Vf,_$]=xr("Tooltip",[Pa]),Wf=Pa(),uC="TooltipProvider",L3=700,ym="tooltip.open",[F3,Yv]=Vf(uC),Zv=e=>{const{__scopeTooltip:t,delayDuration:r=L3,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,[i,a]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),l.jsx(F3,{scope:t,isOpenDelayed:i,delayDuration:r,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:o})};Zv.displayName=uC;var Bf="Tooltip",[z3,Hf]=Vf(Bf),dC=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s=!1,onOpenChange:o,disableHoverableContent:i,delayDuration:a}=e,c=Yv(Bf,e.__scopeTooltip),u=Wf(t),[d,f]=v.useState(null),m=Ur(),y=v.useRef(0),x=i??c.disableHoverableContent,g=a??c.delayDuration,_=v.useRef(!1),[p=!1,h]=on({prop:n,defaultProp:s,onChange:R=>{R?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),o==null||o(R)}}),w=v.useMemo(()=>p?_.current?"delayed-open":"instant-open":"closed",[p]),C=v.useCallback(()=>{window.clearTimeout(y.current),_.current=!1,h(!0)},[h]),j=v.useCallback(()=>{window.clearTimeout(y.current),h(!1)},[h]),E=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{_.current=!0,h(!0)},g)},[g,h]);return v.useEffect(()=>()=>window.clearTimeout(y.current),[]),l.jsx(Xg,{...u,children:l.jsx(z3,{scope:t,contentId:m,open:p,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayed?E():C()},[c.isOpenDelayed,E,C]),onTriggerLeave:v.useCallback(()=>{x?j():window.clearTimeout(y.current)},[j,x]),onOpen:C,onClose:j,disableHoverableContent:x,children:r})})};dC.displayName=Bf;var xm="TooltipTrigger",fC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Hf(xm,r),o=Yv(xm,r),i=Wf(r),a=v.useRef(null),c=Ke(t,a,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(Qg,{asChild:!0,...i,children:l.jsx(Re.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ce(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{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)})})});fC.displayName=xm;var U3="TooltipPortal",[b$,$3]=Vf(U3,{forceMount:void 0}),ma="TooltipContent",Kv=v.forwardRef((e,t)=>{const r=$3(ma,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=Hf(ma,e.__scopeTooltip);return l.jsx(ur,{present:n||i.open,children:i.disableHoverableContent?l.jsx(hC,{side:s,...o,ref:t}):l.jsx(V3,{side:s,...o,ref:t})})}),V3=v.forwardRef((e,t)=>{const r=Hf(ma,e.__scopeTooltip),n=Yv(ma,e.__scopeTooltip),s=v.useRef(null),o=Ke(t,s),[i,a]=v.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:f}=n,m=v.useCallback(()=>{a(null),f(!1)},[f]),y=v.useCallback((x,g)=>{const _=x.currentTarget,p={x:x.clientX,y:x.clientY},h=Y3(p,_.getBoundingClientRect()),w=Z3(p,h),C=K3(g.getBoundingClientRect()),j=q3([...w,...C]);a(j),f(!0)},[f]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const x=_=>y(_,d),g=_=>y(_,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",g)}}},[c,d,y,m]),v.useEffect(()=>{if(i){const x=g=>{const _=g.target,p={x:g.clientX,y:g.clientY},h=(c==null?void 0:c.contains(_))||(d==null?void 0:d.contains(_)),w=!G3(p,i);h?m():w&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,i,u,m]),l.jsx(hC,{...e,ref:o})}),[W3,B3]=Vf(Bf,{isInside:!1}),hC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,c=Hf(ma,r),u=Wf(r),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(ym,d),()=>document.removeEventListener(ym,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=m=>{const y=m.target;y!=null&&y.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(Jg,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.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:[l.jsx(zg,{children:n}),l.jsx(W3,{scope:r,isInside:!0,children:l.jsx(I3,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Kv.displayName=ma;var pC="TooltipArrow",H3=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Wf(r);return B3(pC,r).isInside?null:l.jsx(ev,{...s,...n,ref:t})});H3.displayName=pC;function Y3(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Z3(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function K3(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function G3(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function q3(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),X3(t)}function X3(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const o=r[r.length-1],i=r[r.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var Q3=Zv,J3=dC,e6=fC,mC=Kv;const t6=Q3,gC=J3,vC=e6,yC=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(mC,{ref:n,sideOffset:t,className:ae("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",e),...r}));yC.displayName=mC.displayName;const Gv=({deployment:e})=>{const t=r=>e.log[r]?e.log[r][e.log[r].length-1].error:"";return l.jsx(l.Fragment,{children:e.phase==="deploy"&&e.phaseSuccess||e.wholeSuccess?l.jsx(lA,{size:16,className:"text-green-700"}):l.jsx(l.Fragment,{children:t(e.phase).length?l.jsx(t6,{children:l.jsxs(gC,{children:[l.jsx(vC,{asChild:!0,className:"cursor-pointer",children:l.jsx(g0,{size:16,className:"text-red-700"})}),l.jsx(yC,{className:"max-w-[35em]",children:t(e.phase)})]})}):l.jsx(g0,{size:16,className:"text-red-700"})})})},xC=({className:e,...t})=>l.jsx("nav",{role:"navigation","aria-label":"pagination",className:ae("mx-auto flex w-full justify-center",e),...t});xC.displayName="Pagination";const wC=v.forwardRef(({className:e,...t},r)=>l.jsx("ul",{ref:r,className:ae("flex flex-row items-center gap-1",e),...t}));wC.displayName="PaginationContent";const wm=v.forwardRef(({className:e,...t},r)=>l.jsx("li",{ref:r,className:ae("",e),...t}));wm.displayName="PaginationItem";const _C=({className:e,isActive:t,size:r="icon",...n})=>l.jsx("a",{"aria-current":t?"page":void 0,className:ae(xf({variant:t?"outline":"ghost",size:r}),e),...n});_C.displayName="PaginationLink";const bC=({className:e,...t})=>l.jsxs("span",{"aria-hidden":!0,className:ae("flex h-9 w-9 items-center justify-center",e),...t,children:[l.jsx(dA,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"More pages"})]});bC.displayName="PaginationEllipsis";const SC=({totalPages:e,currentPage:t,onPageChange:r})=>{const s=()=>{if(e>7){let u=[];const d=Math.max(2,t-1),f=Math.min(e-1,t+1),m=e-1;return u=o(d,f),t>3&&u.unshift("..."),t{let d=a;const f=[];for(;d<=c;)f.push(d),d+=u;return f},i=s();return l.jsx(l.Fragment,{children:l.jsx(xC,{className:"dark:text-stone-200 justify-end mt-3",children:l.jsx(wC,{children:i.map((a,c)=>a==="..."?l.jsx(wm,{children:l.jsx(bC,{})},c):l.jsx(wm,{children:l.jsx(_C,{href:"#",isActive:t==a,onClick:u=>{u.preventDefault(),r(a)},children:a})},c))})})})},na=({when:e,children:t,fallback:r})=>e?t:r;var kC="AlertDialog",[r6,S$]=xr(kC,[YS]),Os=YS(),CC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(mv,{...n,...r,modal:!0})};CC.displayName=kC;var n6="AlertDialogTrigger",jC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(gv,{...s,...n,ref:t})});jC.displayName=n6;var s6="AlertDialogPortal",EC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(vv,{...n,...r})};EC.displayName=s6;var o6="AlertDialogOverlay",NC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Ec,{...s,...n,ref:t})});NC.displayName=o6;var sa="AlertDialogContent",[i6,a6]=r6(sa),TC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,o=Os(r),i=v.useRef(null),a=Ke(t,i),c=v.useRef(null);return l.jsx(GI,{contentName:sa,titleName:RC,docsSlug:"alert-dialog",children:l.jsx(i6,{scope:r,cancelRef:c,children:l.jsxs(Nc,{role:"alertdialog",...o,...s,ref:a,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:[l.jsx(zg,{children:n}),l.jsx(c6,{contentRef:i})]})})})});TC.displayName=sa;var RC="AlertDialogTitle",PC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tc,{...s,...n,ref:t})});PC.displayName=RC;var AC="AlertDialogDescription",DC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Rc,{...s,...n,ref:t})});DC.displayName=AC;var l6="AlertDialogAction",OC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tf,{...s,...n,ref:t})});OC.displayName=l6;var MC="AlertDialogCancel",IC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=a6(MC,r),o=Os(r),i=Ke(t,s);return l.jsx(Tf,{...o,...n,ref:i})});IC.displayName=MC;var c6=({contentRef:e})=>{const t=`\`${sa}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${sa}\` by passing a \`${AC}\` 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 \`${sa}\`. 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 v.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},d6=CC,f6=jC,h6=EC,LC=NC,FC=TC,zC=OC,UC=IC,$C=PC,VC=DC;const WC=d6,BC=f6,p6=h6,HC=v.forwardRef(({className:e,...t},r)=>l.jsx(LC,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));HC.displayName=LC.displayName;const qv=v.forwardRef(({className:e,...t},r)=>l.jsxs(p6,{children:[l.jsx(HC,{}),l.jsx(FC,{ref:r,className:ae("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})]}));qv.displayName=FC.displayName;const Xv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});Xv.displayName="AlertDialogHeader";const Qv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qv.displayName="AlertDialogFooter";const Jv=v.forwardRef(({className:e,...t},r)=>l.jsx($C,{ref:r,className:ae("text-lg font-semibold",e),...t}));Jv.displayName=$C.displayName;const ey=v.forwardRef(({className:e,...t},r)=>l.jsx(VC,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));ey.displayName=VC.displayName;const ty=v.forwardRef(({className:e,...t},r)=>l.jsx(zC,{ref:r,className:ae(xf(),e),...t}));ty.displayName=zC.displayName;const ry=v.forwardRef(({className:e,...t},r)=>l.jsx(UC,{ref:r,className:ae(xf({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ry.displayName=UC.displayName;function YC(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ny="Switch",[m6,C$]=xr(ny),[g6,v6]=m6(ny),ZC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:o,required:i,disabled:a,value:c="on",onCheckedChange:u,...d}=e,[f,m]=v.useState(null),y=Ke(t,h=>m(h)),x=v.useRef(!1),g=f?!!f.closest("form"):!0,[_=!1,p]=on({prop:s,defaultProp:o,onChange:u});return l.jsxs(g6,{scope:r,checked:_,disabled:a,children:[l.jsx(Re.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":qC(_),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:y,onClick:ce(e.onClick,h=>{p(w=>!w),g&&(x.current=h.isPropagationStopped(),x.current||h.stopPropagation())})}),g&&l.jsx(y6,{control:f,bubbles:!x.current,name:n,value:c,checked:_,required:i,disabled:a,style:{transform:"translateX(-100%)"}})]})});ZC.displayName=ny;var KC="SwitchThumb",GC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=v6(KC,r);return l.jsx(Re.span,{"data-state":qC(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});GC.displayName=KC;var y6=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=v.useRef(null),i=YC(r),a=Sb(t);return v.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[i,r,n]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qC(e){return e?"checked":"unchecked"}var XC=ZC,x6=GC;const Lc=v.forwardRef(({className:e,...t},r)=>l.jsx(XC,{className:ae("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:l.jsx(x6,{className:ae("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Lc.displayName=XC.displayName;var sy="ToastProvider",[oy,w6,_6]=bc("Toast"),[QC,j$]=xr("Toast",[_6]),[b6,Yf]=QC(sy),JC=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[a,c]=v.useState(null),[u,d]=v.useState(0),f=v.useRef(!1),m=v.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${sy}\`. Expected non-empty \`string\`.`),l.jsx(oy.Provider,{scope:t,children:l.jsx(b6,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:c,onToastAdd:v.useCallback(()=>d(y=>y+1),[]),onToastRemove:v.useCallback(()=>d(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:i})})};JC.displayName=sy;var ej="ToastViewport",S6=["F8"],_m="toast.viewportPause",bm="toast.viewportResume",tj=v.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=S6,label:s="Notifications ({hotkey})",...o}=e,i=Yf(ej,r),a=w6(r),c=v.useRef(null),u=v.useRef(null),d=v.useRef(null),f=v.useRef(null),m=Ke(t,f,i.onViewportChange),y=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=i.toastCount>0;v.useEffect(()=>{const _=p=>{var w;n.every(C=>p[C]||p.code===C)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[n]),v.useEffect(()=>{const _=c.current,p=f.current;if(x&&_&&p){const h=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(_m);p.dispatchEvent(E),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(bm);p.dispatchEvent(E),i.isClosePausedRef.current=!1}},C=E=>{!_.contains(E.relatedTarget)&&w()},j=()=>{_.contains(document.activeElement)||w()};return _.addEventListener("focusin",h),_.addEventListener("focusout",C),_.addEventListener("pointermove",h),_.addEventListener("pointerleave",j),window.addEventListener("blur",h),window.addEventListener("focus",w),()=>{_.removeEventListener("focusin",h),_.removeEventListener("focusout",C),_.removeEventListener("pointermove",h),_.removeEventListener("pointerleave",j),window.removeEventListener("blur",h),window.removeEventListener("focus",w)}}},[x,i.isClosePausedRef]);const g=v.useCallback(({tabbingDirection:_})=>{const h=a().map(w=>{const C=w.ref.current,j=[C,...I6(C)];return _==="forwards"?j:j.reverse()});return(_==="forwards"?h.reverse():h).flat()},[a]);return v.useEffect(()=>{const _=f.current;if(_){const p=h=>{var j,E,R;const w=h.altKey||h.ctrlKey||h.metaKey;if(h.key==="Tab"&&!w){const P=document.activeElement,A=h.shiftKey;if(h.target===_&&A){(j=u.current)==null||j.focus();return}const N=g({tabbingDirection:A?"backwards":"forwards"}),F=N.findIndex(b=>b===P);Jh(N.slice(F+1))?h.preventDefault():A?(E=u.current)==null||E.focus():(R=d.current)==null||R.focus()}};return _.addEventListener("keydown",p),()=>_.removeEventListener("keydown",p)}},[a,g]),l.jsxs(yD,{ref:c,role:"region","aria-label":s.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&l.jsx(Sm,{ref:u,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"forwards"});Jh(_)}}),l.jsx(oy.Slot,{scope:r,children:l.jsx(Re.ol,{tabIndex:-1,...o,ref:m})}),x&&l.jsx(Sm,{ref:d,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"backwards"});Jh(_)}})]})});tj.displayName=ej;var rj="ToastFocusProxy",Sm=v.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=Yf(rj,r);return l.jsx(Ic,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&n()}})});Sm.displayName=rj;var Zf="Toast",k6="toast.swipeStart",C6="toast.swipeMove",j6="toast.swipeCancel",E6="toast.swipeEnd",nj=v.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[a=!0,c]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(ur,{present:r||a,children:l.jsx(R6,{open:a,...i,ref:t,onClose:()=>c(!1),onPause:Dt(e.onPause),onResume:Dt(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)})})})});nj.displayName=Zf;var[N6,T6]=QC(Zf,{onClose(){}}),R6=v.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:y,...x}=e,g=Yf(Zf,r),[_,p]=v.useState(null),h=Ke(t,b=>p(b)),w=v.useRef(null),C=v.useRef(null),j=s||g.duration,E=v.useRef(0),R=v.useRef(j),P=v.useRef(0),{onToastAdd:A,onToastRemove:L}=g,q=Dt(()=>{var V;(_==null?void 0:_.contains(document.activeElement))&&((V=g.viewport)==null||V.focus()),i()}),N=v.useCallback(b=>{!b||b===1/0||(window.clearTimeout(P.current),E.current=new Date().getTime(),P.current=window.setTimeout(q,b))},[q]);v.useEffect(()=>{const b=g.viewport;if(b){const V=()=>{N(R.current),u==null||u()},te=()=>{const W=new Date().getTime()-E.current;R.current=R.current-W,window.clearTimeout(P.current),c==null||c()};return b.addEventListener(_m,te),b.addEventListener(bm,V),()=>{b.removeEventListener(_m,te),b.removeEventListener(bm,V)}}},[g.viewport,j,c,u,N]),v.useEffect(()=>{o&&!g.isClosePausedRef.current&&N(j)},[o,j,g.isClosePausedRef,N]),v.useEffect(()=>(A(),()=>L()),[A,L]);const F=v.useMemo(()=>_?uj(_):null,[_]);return g.viewport?l.jsxs(l.Fragment,{children:[F&&l.jsx(P6,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:F}),l.jsx(N6,{scope:r,onClose:q,children:Ns.createPortal(l.jsx(oy.ItemSlot,{scope:r,children:l.jsx(vD,{asChild:!0,onEscapeKeyDown:ce(a,()=>{g.isFocusedToastEscapeKeyDownRef.current||q(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Re.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":g.swipeDirection,...x,ref:h,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ce(e.onKeyDown,b=>{b.key==="Escape"&&(a==null||a(b.nativeEvent),b.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:ce(e.onPointerDown,b=>{b.button===0&&(w.current={x:b.clientX,y:b.clientY})}),onPointerMove:ce(e.onPointerMove,b=>{if(!w.current)return;const V=b.clientX-w.current.x,te=b.clientY-w.current.y,W=!!C.current,Z=["left","right"].includes(g.swipeDirection),I=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,Q=Z?I(0,V):0,z=Z?0:I(0,te),$=b.pointerType==="touch"?10:2,fe={x:Q,y:z},ne={originalEvent:b,delta:fe};W?(C.current=fe,Su(C6,f,ne,{discrete:!1})):ow(fe,g.swipeDirection,$)?(C.current=fe,Su(k6,d,ne,{discrete:!1}),b.target.setPointerCapture(b.pointerId)):(Math.abs(V)>$||Math.abs(te)>$)&&(w.current=null)}),onPointerUp:ce(e.onPointerUp,b=>{const V=C.current,te=b.target;if(te.hasPointerCapture(b.pointerId)&&te.releasePointerCapture(b.pointerId),C.current=null,w.current=null,V){const W=b.currentTarget,Z={originalEvent:b,delta:V};ow(V,g.swipeDirection,g.swipeThreshold)?Su(E6,y,Z,{discrete:!0}):Su(j6,m,Z,{discrete:!0}),W.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),P6=e=>{const{__scopeToast:t,children:r,...n}=e,s=Yf(Zf,t),[o,i]=v.useState(!1),[a,c]=v.useState(!1);return O6(()=>i(!0)),v.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:l.jsx(kc,{asChild:!0,children:l.jsx(Ic,{...n,children:o&&l.jsxs(l.Fragment,{children:[s.label," ",r]})})})},A6="ToastTitle",sj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});sj.displayName=A6;var D6="ToastDescription",oj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});oj.displayName=D6;var ij="ToastAction",aj=v.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?l.jsx(cj,{altText:r,asChild:!0,children:l.jsx(iy,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ij}\`. Expected non-empty \`string\`.`),null)});aj.displayName=ij;var lj="ToastClose",iy=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=T6(lj,r);return l.jsx(cj,{asChild:!0,children:l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,s.onClose)})})});iy.displayName=lj;var cj=v.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return l.jsx(Re.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function uj(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),M6(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=n.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...uj(n))}}),t}function Su(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?$g(s,o):s.dispatchEvent(o)}var ow=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),o=n>s;return t==="left"||t==="right"?o&&n>r:!o&&s>r};function O6(e=()=>{}){const t=Dt(e);Jt(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function M6(e){return e.nodeType===e.ELEMENT_NODE}function I6(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Jh(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var L6=JC,dj=tj,fj=nj,hj=sj,pj=oj,mj=aj,gj=iy;const F6=L6,vj=v.forwardRef(({className:e,...t},r)=>l.jsx(dj,{ref:r,className:ae("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}));vj.displayName=dj.displayName;const z6=_c("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),yj=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx(fj,{ref:n,className:ae(z6({variant:t}),e),...r}));yj.displayName=fj.displayName;const U6=v.forwardRef(({className:e,...t},r)=>l.jsx(mj,{ref:r,className:ae("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));U6.displayName=mj.displayName;const xj=v.forwardRef(({className:e,...t},r)=>l.jsx(gj,{ref:r,className:ae("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:l.jsx(Fg,{className:"h-4 w-4"})}));xj.displayName=gj.displayName;const wj=v.forwardRef(({className:e,...t},r)=>l.jsx(hj,{ref:r,className:ae("text-sm font-semibold",e),...t}));wj.displayName=hj.displayName;const _j=v.forwardRef(({className:e,...t},r)=>l.jsx(pj,{ref:r,className:ae("text-sm opacity-90",e),...t}));_j.displayName=pj.displayName;const $6=1,V6=1e6;let ep=0;function W6(){return ep=(ep+1)%Number.MAX_SAFE_INTEGER,ep.toString()}const tp=new Map,iw=e=>{if(tp.has(e))return;const t=setTimeout(()=>{tp.delete(e),Sl({type:"REMOVE_TOAST",toastId:e})},V6);tp.set(e,t)},B6=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,$6)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?iw(r):e.toasts.forEach(n=>{iw(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Yu=[];let Zu={toasts:[]};function Sl(e){Zu=B6(Zu,e),Yu.forEach(t=>{t(Zu)})}function H6({...e}){const t=W6(),r=s=>Sl({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>Sl({type:"DISMISS_TOAST",toastId:t});return Sl({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function qn(){const[e,t]=v.useState(Zu);return v.useEffect(()=>(Yu.push(t),()=>{const r=Yu.indexOf(t);r>-1&&Yu.splice(r,1)}),[e]),{...e,toast:H6,dismiss:r=>Sl({type:"DISMISS_TOAST",toastId:r})}}function ay(){const{toasts:e}=qn();return l.jsxs(F6,{children:[e.map(function({id:t,title:r,description:n,action:s,...o}){return l.jsxs(yj,{...o,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(wj,{children:r}),n&&l.jsx(_j,{children:n})]}),s,l.jsx(xj,{})]},t)}),l.jsx(vj,{})]})}function ku(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bj={exports:{}};/*! +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},u6=CC,d6=jC,f6=EC,LC=NC,FC=TC,zC=OC,UC=IC,$C=PC,VC=DC;const WC=u6,BC=d6,h6=f6,HC=v.forwardRef(({className:e,...t},r)=>l.jsx(LC,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));HC.displayName=LC.displayName;const qv=v.forwardRef(({className:e,...t},r)=>l.jsxs(h6,{children:[l.jsx(HC,{}),l.jsx(FC,{ref:r,className:ae("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})]}));qv.displayName=FC.displayName;const Xv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});Xv.displayName="AlertDialogHeader";const Qv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qv.displayName="AlertDialogFooter";const Jv=v.forwardRef(({className:e,...t},r)=>l.jsx($C,{ref:r,className:ae("text-lg font-semibold",e),...t}));Jv.displayName=$C.displayName;const ey=v.forwardRef(({className:e,...t},r)=>l.jsx(VC,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));ey.displayName=VC.displayName;const ty=v.forwardRef(({className:e,...t},r)=>l.jsx(zC,{ref:r,className:ae(xf(),e),...t}));ty.displayName=zC.displayName;const ry=v.forwardRef(({className:e,...t},r)=>l.jsx(UC,{ref:r,className:ae(xf({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ry.displayName=UC.displayName;function YC(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ny="Switch",[p6,k$]=xr(ny),[m6,g6]=p6(ny),ZC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:o,required:i,disabled:a,value:c="on",onCheckedChange:u,...d}=e,[f,m]=v.useState(null),y=Ke(t,h=>m(h)),x=v.useRef(!1),g=f?!!f.closest("form"):!0,[_=!1,p]=on({prop:s,defaultProp:o,onChange:u});return l.jsxs(m6,{scope:r,checked:_,disabled:a,children:[l.jsx(Re.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":qC(_),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:y,onClick:ce(e.onClick,h=>{p(w=>!w),g&&(x.current=h.isPropagationStopped(),x.current||h.stopPropagation())})}),g&&l.jsx(v6,{control:f,bubbles:!x.current,name:n,value:c,checked:_,required:i,disabled:a,style:{transform:"translateX(-100%)"}})]})});ZC.displayName=ny;var KC="SwitchThumb",GC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=g6(KC,r);return l.jsx(Re.span,{"data-state":qC(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});GC.displayName=KC;var v6=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=v.useRef(null),i=YC(r),a=Sb(t);return v.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[i,r,n]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qC(e){return e?"checked":"unchecked"}var XC=ZC,y6=GC;const Lc=v.forwardRef(({className:e,...t},r)=>l.jsx(XC,{className:ae("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:l.jsx(y6,{className:ae("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Lc.displayName=XC.displayName;var sy="ToastProvider",[oy,x6,w6]=bc("Toast"),[QC,C$]=xr("Toast",[w6]),[_6,Yf]=QC(sy),JC=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[a,c]=v.useState(null),[u,d]=v.useState(0),f=v.useRef(!1),m=v.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${sy}\`. Expected non-empty \`string\`.`),l.jsx(oy.Provider,{scope:t,children:l.jsx(_6,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:c,onToastAdd:v.useCallback(()=>d(y=>y+1),[]),onToastRemove:v.useCallback(()=>d(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:i})})};JC.displayName=sy;var ej="ToastViewport",b6=["F8"],_m="toast.viewportPause",bm="toast.viewportResume",tj=v.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=b6,label:s="Notifications ({hotkey})",...o}=e,i=Yf(ej,r),a=x6(r),c=v.useRef(null),u=v.useRef(null),d=v.useRef(null),f=v.useRef(null),m=Ke(t,f,i.onViewportChange),y=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=i.toastCount>0;v.useEffect(()=>{const _=p=>{var w;n.every(C=>p[C]||p.code===C)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[n]),v.useEffect(()=>{const _=c.current,p=f.current;if(x&&_&&p){const h=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(_m);p.dispatchEvent(E),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(bm);p.dispatchEvent(E),i.isClosePausedRef.current=!1}},C=E=>{!_.contains(E.relatedTarget)&&w()},j=()=>{_.contains(document.activeElement)||w()};return _.addEventListener("focusin",h),_.addEventListener("focusout",C),_.addEventListener("pointermove",h),_.addEventListener("pointerleave",j),window.addEventListener("blur",h),window.addEventListener("focus",w),()=>{_.removeEventListener("focusin",h),_.removeEventListener("focusout",C),_.removeEventListener("pointermove",h),_.removeEventListener("pointerleave",j),window.removeEventListener("blur",h),window.removeEventListener("focus",w)}}},[x,i.isClosePausedRef]);const g=v.useCallback(({tabbingDirection:_})=>{const h=a().map(w=>{const C=w.ref.current,j=[C,...M6(C)];return _==="forwards"?j:j.reverse()});return(_==="forwards"?h.reverse():h).flat()},[a]);return v.useEffect(()=>{const _=f.current;if(_){const p=h=>{var j,E,R;const w=h.altKey||h.ctrlKey||h.metaKey;if(h.key==="Tab"&&!w){const P=document.activeElement,A=h.shiftKey;if(h.target===_&&A){(j=u.current)==null||j.focus();return}const N=g({tabbingDirection:A?"backwards":"forwards"}),F=N.findIndex(b=>b===P);Jh(N.slice(F+1))?h.preventDefault():A?(E=u.current)==null||E.focus():(R=d.current)==null||R.focus()}};return _.addEventListener("keydown",p),()=>_.removeEventListener("keydown",p)}},[a,g]),l.jsxs(yD,{ref:c,role:"region","aria-label":s.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&l.jsx(Sm,{ref:u,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"forwards"});Jh(_)}}),l.jsx(oy.Slot,{scope:r,children:l.jsx(Re.ol,{tabIndex:-1,...o,ref:m})}),x&&l.jsx(Sm,{ref:d,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"backwards"});Jh(_)}})]})});tj.displayName=ej;var rj="ToastFocusProxy",Sm=v.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=Yf(rj,r);return l.jsx(Ic,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&n()}})});Sm.displayName=rj;var Zf="Toast",S6="toast.swipeStart",k6="toast.swipeMove",C6="toast.swipeCancel",j6="toast.swipeEnd",nj=v.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[a=!0,c]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(ur,{present:r||a,children:l.jsx(T6,{open:a,...i,ref:t,onClose:()=>c(!1),onPause:Dt(e.onPause),onResume:Dt(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)})})})});nj.displayName=Zf;var[E6,N6]=QC(Zf,{onClose(){}}),T6=v.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:y,...x}=e,g=Yf(Zf,r),[_,p]=v.useState(null),h=Ke(t,b=>p(b)),w=v.useRef(null),C=v.useRef(null),j=s||g.duration,E=v.useRef(0),R=v.useRef(j),P=v.useRef(0),{onToastAdd:A,onToastRemove:L}=g,q=Dt(()=>{var V;(_==null?void 0:_.contains(document.activeElement))&&((V=g.viewport)==null||V.focus()),i()}),N=v.useCallback(b=>{!b||b===1/0||(window.clearTimeout(P.current),E.current=new Date().getTime(),P.current=window.setTimeout(q,b))},[q]);v.useEffect(()=>{const b=g.viewport;if(b){const V=()=>{N(R.current),u==null||u()},te=()=>{const W=new Date().getTime()-E.current;R.current=R.current-W,window.clearTimeout(P.current),c==null||c()};return b.addEventListener(_m,te),b.addEventListener(bm,V),()=>{b.removeEventListener(_m,te),b.removeEventListener(bm,V)}}},[g.viewport,j,c,u,N]),v.useEffect(()=>{o&&!g.isClosePausedRef.current&&N(j)},[o,j,g.isClosePausedRef,N]),v.useEffect(()=>(A(),()=>L()),[A,L]);const F=v.useMemo(()=>_?uj(_):null,[_]);return g.viewport?l.jsxs(l.Fragment,{children:[F&&l.jsx(R6,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:F}),l.jsx(E6,{scope:r,onClose:q,children:Ns.createPortal(l.jsx(oy.ItemSlot,{scope:r,children:l.jsx(vD,{asChild:!0,onEscapeKeyDown:ce(a,()=>{g.isFocusedToastEscapeKeyDownRef.current||q(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Re.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":g.swipeDirection,...x,ref:h,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ce(e.onKeyDown,b=>{b.key==="Escape"&&(a==null||a(b.nativeEvent),b.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:ce(e.onPointerDown,b=>{b.button===0&&(w.current={x:b.clientX,y:b.clientY})}),onPointerMove:ce(e.onPointerMove,b=>{if(!w.current)return;const V=b.clientX-w.current.x,te=b.clientY-w.current.y,W=!!C.current,Z=["left","right"].includes(g.swipeDirection),I=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,Q=Z?I(0,V):0,z=Z?0:I(0,te),$=b.pointerType==="touch"?10:2,fe={x:Q,y:z},ne={originalEvent:b,delta:fe};W?(C.current=fe,Su(k6,f,ne,{discrete:!1})):ow(fe,g.swipeDirection,$)?(C.current=fe,Su(S6,d,ne,{discrete:!1}),b.target.setPointerCapture(b.pointerId)):(Math.abs(V)>$||Math.abs(te)>$)&&(w.current=null)}),onPointerUp:ce(e.onPointerUp,b=>{const V=C.current,te=b.target;if(te.hasPointerCapture(b.pointerId)&&te.releasePointerCapture(b.pointerId),C.current=null,w.current=null,V){const W=b.currentTarget,Z={originalEvent:b,delta:V};ow(V,g.swipeDirection,g.swipeThreshold)?Su(j6,y,Z,{discrete:!0}):Su(C6,m,Z,{discrete:!0}),W.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),R6=e=>{const{__scopeToast:t,children:r,...n}=e,s=Yf(Zf,t),[o,i]=v.useState(!1),[a,c]=v.useState(!1);return D6(()=>i(!0)),v.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:l.jsx(kc,{asChild:!0,children:l.jsx(Ic,{...n,children:o&&l.jsxs(l.Fragment,{children:[s.label," ",r]})})})},P6="ToastTitle",sj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});sj.displayName=P6;var A6="ToastDescription",oj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});oj.displayName=A6;var ij="ToastAction",aj=v.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?l.jsx(cj,{altText:r,asChild:!0,children:l.jsx(iy,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ij}\`. Expected non-empty \`string\`.`),null)});aj.displayName=ij;var lj="ToastClose",iy=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=N6(lj,r);return l.jsx(cj,{asChild:!0,children:l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,s.onClose)})})});iy.displayName=lj;var cj=v.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return l.jsx(Re.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function uj(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),O6(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=n.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...uj(n))}}),t}function Su(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?$g(s,o):s.dispatchEvent(o)}var ow=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),o=n>s;return t==="left"||t==="right"?o&&n>r:!o&&s>r};function D6(e=()=>{}){const t=Dt(e);Jt(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function O6(e){return e.nodeType===e.ELEMENT_NODE}function M6(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Jh(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var I6=JC,dj=tj,fj=nj,hj=sj,pj=oj,mj=aj,gj=iy;const L6=I6,vj=v.forwardRef(({className:e,...t},r)=>l.jsx(dj,{ref:r,className:ae("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}));vj.displayName=dj.displayName;const F6=_c("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),yj=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx(fj,{ref:n,className:ae(F6({variant:t}),e),...r}));yj.displayName=fj.displayName;const z6=v.forwardRef(({className:e,...t},r)=>l.jsx(mj,{ref:r,className:ae("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));z6.displayName=mj.displayName;const xj=v.forwardRef(({className:e,...t},r)=>l.jsx(gj,{ref:r,className:ae("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:l.jsx(Fg,{className:"h-4 w-4"})}));xj.displayName=gj.displayName;const wj=v.forwardRef(({className:e,...t},r)=>l.jsx(hj,{ref:r,className:ae("text-sm font-semibold",e),...t}));wj.displayName=hj.displayName;const _j=v.forwardRef(({className:e,...t},r)=>l.jsx(pj,{ref:r,className:ae("text-sm opacity-90",e),...t}));_j.displayName=pj.displayName;const U6=1,$6=1e6;let ep=0;function V6(){return ep=(ep+1)%Number.MAX_SAFE_INTEGER,ep.toString()}const tp=new Map,iw=e=>{if(tp.has(e))return;const t=setTimeout(()=>{tp.delete(e),Sl({type:"REMOVE_TOAST",toastId:e})},$6);tp.set(e,t)},W6=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,U6)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?iw(r):e.toasts.forEach(n=>{iw(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Yu=[];let Zu={toasts:[]};function Sl(e){Zu=W6(Zu,e),Yu.forEach(t=>{t(Zu)})}function B6({...e}){const t=V6(),r=s=>Sl({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>Sl({type:"DISMISS_TOAST",toastId:t});return Sl({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function qn(){const[e,t]=v.useState(Zu);return v.useEffect(()=>(Yu.push(t),()=>{const r=Yu.indexOf(t);r>-1&&Yu.splice(r,1)}),[e]),{...e,toast:B6,dismiss:r=>Sl({type:"DISMISS_TOAST",toastId:r})}}function ay(){const{toasts:e}=qn();return l.jsxs(L6,{children:[e.map(function({id:t,title:r,description:n,action:s,...o}){return l.jsxs(yj,{...o,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(wj,{children:r}),n&&l.jsx(_j,{children:n})]}),s,l.jsx(xj,{})]},t)}),l.jsx(vj,{})]})}function ku(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bj={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -301,8 +301,8 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,s,o){function i(u,d){if(!s[u]){if(!n[u]){var f=typeof ku=="function"&&ku;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var y=s[u]={exports:{}};n[u][0].call(y.exports,function(x){var g=n[u][1][x];return i(g||x)},y,y.exports,r,n,s,o)}return s[u].exports}for(var a=typeof ku=="function"&&ku,c=0;c>2,y=(3&u)<<4|d>>4,x=1>6:64,g=2>4,d=(15&m)<<4|(y=a.indexOf(c.charAt(g++)))>>2,f=(3&y)<<6|(x=a.indexOf(c.charAt(g++))),h[_++]=u,y!==64&&(h[_++]=d),x!==64&&(h[_++]=f);return h}},{"./support":30,"./utils":32}],2:[function(r,n,s){var o=r("./external"),i=r("./stream/DataWorker"),a=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(d,f,m,y,x){this.compressedSize=d,this.uncompressedSize=f,this.crc32=m,this.compression=y,this.compressedContent=x}u.prototype={getContentWorker:function(){var d=new i(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,m){return d.pipe(new a).pipe(new c("uncompressedSize")).pipe(f.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var o=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var o=r("./utils"),i=function(){for(var a,c=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;c[u]=a}return c}();n.exports=function(a,c){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(u,d,f,m){var y=i,x=m+f;u^=-1;for(var g=m;g>>8^y[255&(u^d[g])];return-1^u}(0|c,a,a.length,0):function(u,d,f,m){var y=i,x=m+f;u^=-1;for(var g=m;g>>8^y[255&(u^d.charCodeAt(g))];return-1^u}(0|c,a,a.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var o=null;o=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:o}},{lie:37}],7:[function(r,n,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=r("pako"),a=r("./utils"),c=r("./stream/GenericWorker"),u=o?"uint8array":"array";function d(f,m){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=m,this.meta={}}s.magic="\b\0",a.inherits(d,c),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(m){f.push({data:m,meta:f.meta})}},s.compressWorker=function(f){return new d("Deflate",f)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function o(y,x){var g,_="";for(g=0;g>>=8;return _}function i(y,x,g,_,p,h){var w,C,j=y.file,E=y.compression,R=h!==u.utf8encode,P=a.transformTo("string",h(j.name)),A=a.transformTo("string",u.utf8encode(j.name)),L=j.comment,q=a.transformTo("string",h(L)),N=a.transformTo("string",u.utf8encode(L)),F=A.length!==j.name.length,b=N.length!==L.length,V="",te="",W="",Z=j.dir,I=j.date,Q={crc32:0,compressedSize:0,uncompressedSize:0};x&&!g||(Q.crc32=y.crc32,Q.compressedSize=y.compressedSize,Q.uncompressedSize=y.uncompressedSize);var z=0;x&&(z|=8),R||!F&&!b||(z|=2048);var $=0,fe=0;Z&&($|=16),p==="UNIX"?(fe=798,$|=function(se,Oe){var he=se;return se||(he=Oe?16893:33204),(65535&he)<<16}(j.unixPermissions,Z)):(fe=20,$|=function(se){return 63&(se||0)}(j.dosPermissions)),w=I.getUTCHours(),w<<=6,w|=I.getUTCMinutes(),w<<=5,w|=I.getUTCSeconds()/2,C=I.getUTCFullYear()-1980,C<<=4,C|=I.getUTCMonth()+1,C<<=5,C|=I.getUTCDate(),F&&(te=o(1,1)+o(d(P),4)+A,V+="up"+o(te.length,2)+te),b&&(W=o(1,1)+o(d(q),4)+N,V+="uc"+o(W.length,2)+W);var ne="";return ne+=` -\0`,ne+=o(z,2),ne+=E.magic,ne+=o(w,2),ne+=o(C,2),ne+=o(Q.crc32,4),ne+=o(Q.compressedSize,4),ne+=o(Q.uncompressedSize,4),ne+=o(P.length,2),ne+=o(V.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ne+P+V,dirRecord:f.CENTRAL_FILE_HEADER+o(fe,2)+ne+o(q.length,2)+"\0\0\0\0"+o($,4)+o(_,4)+P+V+q}}var a=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),f=r("../signature");function m(y,x,g,_){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=g,this.encodeFileName=_,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(m,c),m.prototype.push=function(y){var x=y.meta.percent||0,g=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,c.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:g?(x+100*(g-_-1))/g:100}}))},m.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var x=this.streamFiles&&!y.file.dir;if(x){var g=i(y,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(y){this.accumulate=!1;var x=this.streamFiles&&!y.file.dir,g=i(y,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),x)this.push({data:function(_){return f.DATA_DESCRIPTOR+o(_.crc32,4)+o(_.compressedSize,4)+o(_.uncompressedSize,4)}(y),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var y=this.bytesWritten,x=0;x=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=i},{"../utils":32}],19:[function(r,n,s){var o=r("./Uint8ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var o=r("./ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var o=r("../utils"),i=r("../support"),a=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(f){var m=o.getTypeOf(f);return o.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(f):i.uint8array?new d(o.transformTo("uint8array",f)):new a(o.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var o=r("./GenericWorker"),i=r("../utils");function a(c){o.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,o),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var o=r("./GenericWorker"),i=r("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,o),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(a,i),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function o(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c "+i:i}},n.exports=o},{}],29:[function(r,n,s){var o=r("../utils"),i=r("./ConvertWorker"),a=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),f=null;if(u.nodestream)try{f=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(x,g){return new d.Promise(function(_,p){var h=[],w=x._internalType,C=x._outputType,j=x._mimeType;x.on("data",function(E,R){h.push(E),g&&g(R)}).on("error",function(E){h=[],p(E)}).on("end",function(){try{var E=function(R,P,A){switch(R){case"blob":return o.newBlob(o.transformTo("arraybuffer",P),A);case"base64":return c.encode(P);default:return o.transformTo(R,P)}}(C,function(R,P){var A,L=0,q=null,N=0;for(A=0;A"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),s.blob=i.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var o=r("./utils"),i=r("./support"),a=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}s.utf8encode=function(y){return i.nodebuffer?a.newBufferFrom(y,"utf-8"):function(x){var g,_,p,h,w,C=x.length,j=0;for(h=0;h>>6:(_<65536?g[w++]=224|_>>>12:(g[w++]=240|_>>>18,g[w++]=128|_>>>12&63),g[w++]=128|_>>>6&63),g[w++]=128|63&_);return g}(y)},s.utf8decode=function(y){return i.nodebuffer?o.transformTo("nodebuffer",y).toString("utf-8"):function(x){var g,_,p,h,w=x.length,C=new Array(2*w);for(g=_=0;g>10&1023,C[_++]=56320|1023&p)}return C.length!==_&&(C.subarray?C=C.subarray(0,_):C.length=_),o.applyFromCharCode(C)}(y=o.transformTo(i.uint8array?"uint8array":"array",y))},o.inherits(f,c),f.prototype.processChunk=function(y){var x=o.transformTo(i.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var g=x;(x=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),x.set(g,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var _=function(h,w){var C;for((w=w||h.length)>h.length&&(w=h.length),C=w-1;0<=C&&(192&h[C])==128;)C--;return C<0||C===0?w:C+u[h[C]]>w?C:w}(x),p=x;_!==x.length&&(i.uint8array?(p=x.subarray(0,_),this.leftOver=x.subarray(_,x.length)):(p=x.slice(0,_),this.leftOver=x.slice(_,x.length))),this.push({data:s.utf8decode(p),meta:y.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=f,o.inherits(m,c),m.prototype.processChunk=function(y){this.push({data:s.utf8encode(y.data),meta:y.meta})},s.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var o=r("./support"),i=r("./base64"),a=r("./nodejsUtils"),c=r("./external");function u(g){return g}function d(g,_){for(var p=0;p>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var x,g,_,p=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4>>6:(y<65536?m[_++]=224|y>>>12:(m[_++]=240|y>>>18,m[_++]=128|y>>>12&63),m[_++]=128|y>>>6&63),m[_++]=128|63&y);return m},s.buf2binstring=function(f){return d(f,f.length)},s.binstring2buf=function(f){for(var m=new o.Buf8(f.length),y=0,x=m.length;y>10&1023,h[x++]=56320|1023&g)}return d(h,x)},s.utf8border=function(f,m){var y;for((m=m||f.length)>f.length&&(m=f.length),y=m-1;0<=y&&(192&f[y])==128;)y--;return y<0||y===0?m:y+c[f[y]]>m?y:m}},{"./common":41}],43:[function(r,n,s){n.exports=function(o,i,a,c){for(var u=65535&o|0,d=o>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3>>1:i>>>1;a[c]=i}return a}();n.exports=function(i,a,c,u){var d=o,f=u+c;i^=-1;for(var m=u;m>>8^d[255&(i^a[m])];return-1^i}},{}],46:[function(r,n,s){var o,i=r("../utils/common"),a=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),f=0,m=4,y=0,x=-2,g=-1,_=4,p=2,h=8,w=9,C=286,j=30,E=19,R=2*C+1,P=15,A=3,L=258,q=L+A+1,N=42,F=113,b=1,V=2,te=3,W=4;function Z(k,J){return k.msg=d[J],J}function I(k){return(k<<1)-(4k.avail_out&&(K=k.avail_out),K!==0&&(i.arraySet(k.output,J.pending_buf,J.pending_out,K,k.next_out),k.next_out+=K,J.pending_out+=K,k.total_out+=K,k.avail_out-=K,J.pending-=K,J.pending===0&&(J.pending_out=0))}function $(k,J){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,J),k.block_start=k.strstart,z(k.strm)}function fe(k,J){k.pending_buf[k.pending++]=J}function ne(k,J){k.pending_buf[k.pending++]=J>>>8&255,k.pending_buf[k.pending++]=255&J}function se(k,J){var K,D,S=k.max_chain_length,T=k.strstart,O=k.prev_length,Y=k.nice_match,M=k.strstart>k.w_size-q?k.strstart-(k.w_size-q):0,H=k.window,X=k.w_mask,ee=k.prev,me=k.strstart+L,Ye=H[T+O-1],Ue=H[T+O];k.prev_length>=k.good_match&&(S>>=2),Y>k.lookahead&&(Y=k.lookahead);do if(H[(K=J)+O]===Ue&&H[K+O-1]===Ye&&H[K]===H[T]&&H[++K]===H[T+1]){T+=2,K++;do;while(H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&TM&&--S!=0);return O<=k.lookahead?O:k.lookahead}function Oe(k){var J,K,D,S,T,O,Y,M,H,X,ee=k.w_size;do{if(S=k.window_size-k.lookahead-k.strstart,k.strstart>=ee+(ee-q)){for(i.arraySet(k.window,k.window,ee,ee,0),k.match_start-=ee,k.strstart-=ee,k.block_start-=ee,J=K=k.hash_size;D=k.head[--J],k.head[J]=ee<=D?D-ee:0,--K;);for(J=K=ee;D=k.prev[--J],k.prev[J]=ee<=D?D-ee:0,--K;);S+=ee}if(k.strm.avail_in===0)break;if(O=k.strm,Y=k.window,M=k.strstart+k.lookahead,H=S,X=void 0,X=O.avail_in,H=A)for(T=k.strstart-k.insert,k.ins_h=k.window[T],k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A)if(D=a._tr_tally(k,k.strstart-k.match_start,k.match_length-A),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=A){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A&&k.match_length<=k.prev_length){for(S=k.strstart+k.lookahead-A,D=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-A),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=S&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(K=k.pending_buf_size-5);;){if(k.lookahead<=1){if(Oe(k),k.lookahead===0&&J===f)return b;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var D=k.block_start+K;if((k.strstart===0||k.strstart>=D)&&(k.lookahead=k.strstart-D,k.strstart=D,$(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-q&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=0,J===m?($(k,!0),k.strm.avail_out===0?te:W):(k.strstart>k.block_start&&($(k,!1),k.strm.avail_out),b)}),new ke(4,4,8,4,he),new ke(4,5,16,8,he),new ke(4,6,32,32,he),new ke(4,4,16,16,ye),new ke(8,16,32,32,ye),new ke(8,16,128,128,ye),new ke(8,32,128,256,ye),new ke(32,128,258,1024,ye),new ke(32,258,258,4096,ye)],s.deflateInit=function(k,J){return nt(k,J,h,15,8,0)},s.deflateInit2=nt,s.deflateReset=Pe,s.deflateResetKeep=Me,s.deflateSetHeader=function(k,J){return k&&k.state?k.state.wrap!==2?x:(k.state.gzhead=J,y):x},s.deflate=function(k,J){var K,D,S,T;if(!k||!k.state||5>8&255),fe(D,D.gzhead.time>>16&255),fe(D,D.gzhead.time>>24&255),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(fe(D,255&D.gzhead.extra.length),fe(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(k.adler=u(k.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,3),D.status=F);else{var O=h+(D.w_bits-8<<4)<<8;O|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(O|=32),O+=31-O%31,D.status=F,ne(D,O),D.strstart!==0&&(ne(D,k.adler>>>16),ne(D,65535&k.adler)),k.adler=1}if(D.status===69)if(D.gzhead.extra){for(S=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending!==D.pending_buf_size));)fe(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&z(k),D.pending+2<=D.pending_buf_size&&(fe(D,255&k.adler),fe(D,k.adler>>8&255),k.adler=0,D.status=F)):D.status=F),D.pending!==0){if(z(k),k.avail_out===0)return D.last_flush=-1,y}else if(k.avail_in===0&&I(J)<=I(K)&&J!==m)return Z(k,-5);if(D.status===666&&k.avail_in!==0)return Z(k,-5);if(k.avail_in!==0||D.lookahead!==0||J!==f&&D.status!==666){var Y=D.strategy===2?function(M,H){for(var X;;){if(M.lookahead===0&&(Oe(M),M.lookahead===0)){if(H===f)return b;break}if(M.match_length=0,X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):D.strategy===3?function(M,H){for(var X,ee,me,Ye,Ue=M.window;;){if(M.lookahead<=L){if(Oe(M),M.lookahead<=L&&H===f)return b;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=A&&0M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=A?(X=a._tr_tally(M,1,M.match_length-A),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):o[D.level].func(D,J);if(Y!==te&&Y!==W||(D.status=666),Y===b||Y===te)return k.avail_out===0&&(D.last_flush=-1),y;if(Y===V&&(J===1?a._tr_align(D):J!==5&&(a._tr_stored_block(D,0,0,!1),J===3&&(Q(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),z(k),k.avail_out===0))return D.last_flush=-1,y}return J!==m?y:D.wrap<=0?1:(D.wrap===2?(fe(D,255&k.adler),fe(D,k.adler>>8&255),fe(D,k.adler>>16&255),fe(D,k.adler>>24&255),fe(D,255&k.total_in),fe(D,k.total_in>>8&255),fe(D,k.total_in>>16&255),fe(D,k.total_in>>24&255)):(ne(D,k.adler>>>16),ne(D,65535&k.adler)),z(k),0=K.w_size&&(T===0&&(Q(K.head),K.strstart=0,K.block_start=0,K.insert=0),H=new i.Buf8(K.w_size),i.arraySet(H,J,X-K.w_size,K.w_size,0),J=H,X=K.w_size),O=k.avail_in,Y=k.next_in,M=k.input,k.avail_in=X,k.next_in=0,k.input=J,Oe(K);K.lookahead>=A;){for(D=K.strstart,S=K.lookahead-(A-1);K.ins_h=(K.ins_h<>>=A=P>>>24,w-=A,(A=P>>>16&255)===0)V[d++]=65535&P;else{if(!(16&A)){if(!(64&A)){P=C[(65535&P)+(h&(1<>>=A,w-=A),w<15&&(h+=b[c++]<>>=A=P>>>24,w-=A,!(16&(A=P>>>16&255))){if(!(64&A)){P=j[(65535&P)+(h&(1<>>=A,w-=A,(A=d-f)>3,h&=(1<<(w-=L<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(N){var F;return N&&N.state?(F=N.state,N.total_in=N.total_out=F.total=0,N.msg="",F.wrap&&(N.adler=1&F.wrap),F.mode=x,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new o.Buf32(g),F.distcode=F.distdyn=new o.Buf32(_),F.sane=1,F.back=-1,m):y}function C(N){var F;return N&&N.state?((F=N.state).wsize=0,F.whave=0,F.wnext=0,w(N)):y}function j(N,F){var b,V;return N&&N.state?(V=N.state,F<0?(b=0,F=-F):(b=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=W.wsize?(o.arraySet(W.window,F,b-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(V<(te=W.wsize-W.wnext)&&(te=V),o.arraySet(W.window,F,b-V,te,W.wnext),(V-=te)?(o.arraySet(W.window,F,b-V,V,0),W.wnext=V,W.whave=W.wsize):(W.wnext+=te,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,b.check=a(b.check,T,2,0),$=z=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&z)<<8)+(z>>8))%31){N.msg="incorrect header check",b.mode=30;break}if((15&z)!=8){N.msg="unknown compression method",b.mode=30;break}if($-=4,k=8+(15&(z>>>=4)),b.wbits===0)b.wbits=k;else if(k>b.wbits){N.msg="invalid window size",b.mode=30;break}b.dmax=1<>8&1),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=3;case 3:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.time=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,T[2]=z>>>16&255,T[3]=z>>>24&255,b.check=a(b.check,T,4,0)),$=z=0,b.mode=4;case 4:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.xflags=255&z,b.head.os=z>>8),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length=z,b.head&&(b.head.extra_len=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(I<(se=b.length)&&(se=I),se&&(b.head&&(k=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),o.arraySet(b.head.extra,V,W,se,k)),512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,b.length-=se),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.name+=String.fromCharCode(k)),k&&se>9&1,b.head.done=!0),N.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}N.adler=b.check=p(z),$=z=0,b.mode=11;case 11:if(b.havedict===0)return N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,2;N.adler=b.check=1,b.mode=12;case 12:if(F===5||F===6)break e;case 13:if(b.last){z>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}switch(b.last=1&z,$-=1,3&(z>>>=1)){case 0:b.mode=14;break;case 1:if(L(b),b.mode=20,F!==6)break;z>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:N.msg="invalid block type",b.mode=30}z>>>=2,$-=2;break;case 14:for(z>>>=7&$,$-=7&$;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if((65535&z)!=(z>>>16^65535)){N.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&z,$=z=0,b.mode=15,F===6)break e;case 15:b.mode=16;case 16:if(se=b.length){if(I>>=5,$-=5,b.ndist=1+(31&z),z>>>=5,$-=5,b.ncode=4+(15&z),z>>>=4,$-=4,286>>=3,$-=3}for(;b.have<19;)b.lens[O[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,K={bits:b.lenbits},J=u(0,b.lens,0,19,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(Fe<16)z>>>=ye,$-=ye,b.lens[b.have++]=Fe;else{if(Fe===16){for(D=ye+2;$>>=ye,$-=ye,b.have===0){N.msg="invalid bit length repeat",b.mode=30;break}k=b.lens[b.have-1],se=3+(3&z),z>>>=2,$-=2}else if(Fe===17){for(D=ye+3;$>>=ye)),z>>>=3,$-=3}else{for(D=ye+7;$>>=ye)),z>>>=7,$-=7}if(b.have+se>b.nlen+b.ndist){N.msg="invalid bit length repeat",b.mode=30;break}for(;se--;)b.lens[b.have++]=k}}if(b.mode===30)break;if(b.lens[256]===0){N.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,K={bits:b.lenbits},J=u(d,b.lens,0,b.nlen,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,K={bits:b.distbits},J=u(f,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,K),b.distbits=K.bits,J){N.msg="invalid distances set",b.mode=30;break}if(b.mode=20,F===6)break e;case 20:b.mode=21;case 21:if(6<=I&&258<=Q){N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,c(N,ne),Z=N.next_out,te=N.output,Q=N.avail_out,W=N.next_in,V=N.input,I=N.avail_in,z=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ke=(S=b.lencode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(ke&&!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.lencode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,b.length=Fe,ke===0){b.mode=26;break}if(32&ke){b.back=-1,b.mode=12;break}if(64&ke){N.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ke,b.mode=22;case 22:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ke=(S=b.distcode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.distcode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,64&ke){N.msg="invalid distance code",b.mode=30;break}b.offset=Fe,b.extra=15&ke,b.mode=24;case 24:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){N.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(Q===0)break e;if(se=ne-Q,b.offset>se){if((se=b.offset-se)>b.whave&&b.sane){N.msg="invalid distance too far back",b.mode=30;break}Oe=se>b.wnext?(se-=b.wnext,b.wsize-se):b.wnext-se,se>b.length&&(se=b.length),he=b.window}else he=te,Oe=Z-b.offset,se=b.length;for(QR?(A=Oe[he+_[F]],$[fe+_[F]]):(A=96,0),h=1<>Z)+(w-=h)]=P<<24|A<<16|L|0,w!==0;);for(h=1<>=1;if(h!==0?(z&=h-1,z+=h):z=0,F++,--ne[N]==0){if(N===V)break;N=f[m+_[F]]}if(te>>7)]}function fe(S,T){S.pending_buf[S.pending++]=255&T,S.pending_buf[S.pending++]=T>>>8&255}function ne(S,T,O){S.bi_valid>p-O?(S.bi_buf|=T<>p-S.bi_valid,S.bi_valid+=O-p):(S.bi_buf|=T<>>=1,O<<=1,0<--T;);return O>>>1}function he(S,T,O){var Y,M,H=new Array(_+1),X=0;for(Y=1;Y<=_;Y++)H[Y]=X=X+O[Y-1]<<1;for(M=0;M<=T;M++){var ee=S[2*M+1];ee!==0&&(S[2*M]=Oe(H[ee]++,ee))}}function ye(S){var T;for(T=0;T>1;1<=O;O--)Me(S,H,O);for(M=me;O=S.heap[1],S.heap[1]=S.heap[S.heap_len--],Me(S,H,1),Y=S.heap[1],S.heap[--S.heap_max]=O,S.heap[--S.heap_max]=Y,H[2*M]=H[2*O]+H[2*Y],S.depth[M]=(S.depth[O]>=S.depth[Y]?S.depth[O]:S.depth[Y])+1,H[2*O+1]=H[2*Y+1]=M,S.heap[1]=M++,Me(S,H,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(Ue,jt){var Gr,Ht,Qn,at,Jn,es,qr=jt.dyn_tree,$c=jt.max_code,Vc=jt.stat_desc.static_tree,hi=jt.stat_desc.has_stree,Wc=jt.stat_desc.extra_bits,pi=jt.stat_desc.extra_base,Pn=jt.stat_desc.max_length,Is=0;for(at=0;at<=_;at++)Ue.bl_count[at]=0;for(qr[2*Ue.heap[Ue.heap_max]+1]=0,Gr=Ue.heap_max+1;Gr>=7;M>>=1)if(1&Ye&&ee.dyn_ltree[2*me]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(H=S.static_len+3+7>>>3)<=M&&(M=H)):M=H=O+5,O+4<=M&&T!==-1?D(S,T,O,Y):S.strategy===4||H===M?(ne(S,2+(Y?1:0),3),Pe(S,q,N)):(ne(S,4+(Y?1:0),3),function(ee,me,Ye,Ue){var jt;for(ne(ee,me-257,5),ne(ee,Ye-1,5),ne(ee,Ue-4,4),jt=0;jt>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&T,S.pending_buf[S.l_buf+S.last_lit]=255&O,S.last_lit++,T===0?S.dyn_ltree[2*O]++:(S.matches++,T--,S.dyn_ltree[2*(b[O]+f+1)]++,S.dyn_dtree[2*$(T)]++),S.last_lit===S.lit_bufsize-1},s._tr_align=function(S){ne(S,2,3),se(S,w,q),function(T){T.bi_valid===16?(fe(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):8<=T.bi_valid&&(T.pending_buf[T.pending++]=255&T.bi_buf,T.bi_buf>>=8,T.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(o){(function(i,a){if(!i.setImmediate){var c,u,d,f,m=1,y={},x=!1,g=i.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(i);_=_&&_.setTimeout?_:i,c={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){h(C)})}:function(){if(i.postMessage&&!i.importScripts){var C=!0,j=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=j,C}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(C){i.postMessage(f+C,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){h(C.data)},function(C){d.port2.postMessage(C)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(C){var j=g.createElement("script");j.onreadystatechange=function(){h(C),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(C){setTimeout(h,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var j=new Array(arguments.length-1),E=0;E"u"?o===void 0?this:o:self)}).call(this,typeof Kc<"u"?Kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bj);var Y6=bj.exports;const Z6=Lm(Y6);function K6(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{n.result?t(n.result.toString()):r("No content found")},n.onerror=()=>r(n.error),n.readAsText(e)})}const G6=async(e,t)=>{const r=new Z6;t.forEach(o=>{r.file(o.name,o.content)});const n=await r.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(n),s.download=e,s.click()},ga=e=>{const t=new Date(e);return new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"Asia/Shanghai"}).format(t)},q6=e=>ga(e).split(" ")[0];function Sj(e){const t=new Date;t.setUTCDate(t.getUTCDate()+e);const r=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),o=String(t.getUTCHours()).padStart(2,"0"),i=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${r}-${n}-${s} ${o}:${i}:${a}`}const X6=async e=>{let t=1;e.page&&(t=e.page);let r=2;e.perPage&&(r=e.perPage);const n=st();let s="";return e.state==="enabled"?s="enabled=true":e.state==="disabled"?s="enabled=false":e.state==="expired"&&(s=n.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})),n.collection("domains").getList(t,r,{sort:"-created",expand:"lastDeployment",filter:s})},Q6=async()=>{const e=st(),t=await e.collection("domains").getList(1,1,{}),r=await e.collection("domains").getList(1,1,{filter:e.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})}),n=await e.collection("domains").getList(1,1,{filter:"enabled=true"}),s=await e.collection("domains").getList(1,1,{filter:"enabled=false"});return{total:t.totalItems,expired:r.totalItems,enabled:n.totalItems,disabled:s.totalItems}},J6=async e=>await st().collection("domains").getOne(e),km=async e=>e.id?await st().collection("domains").update(e.id,e):await st().collection("domains").create(e),ez=async e=>await st().collection("domains").delete(e),tz=(e,t)=>st().collection("domains").subscribe(e,r=>{r.action==="update"&&t(r.record)},{expand:"lastDeployment"}),rz=e=>{st().collection("domains").unsubscribe(e)},nz=()=>{const e=qn(),t=Nr(),r=Nn(),n=new URLSearchParams(r.search),s=n.get("page"),o=n.get("state"),[i,a]=v.useState(0),c=()=>{t("/edit")},u=w=>{n.set("page",w.toString()),t(`?${n.toString()}`)},d=w=>{t(`/edit?id=${w}`)},f=w=>{t(`/history?domain=${w}`)},m=async w=>{try{await ez(w),x(y.filter(C=>C.id!==w))}catch(C){console.error("Error deleting domain:",C)}},[y,x]=v.useState([]);v.useEffect(()=>{(async()=>{const C=await X6({page:s?Number(s):1,perPage:10,state:o||""});x(C.items),a(C.totalPages)})()},[s,o]);const g=async w=>{const C=y.filter(P=>P.id===w),j=C[0].enabled,E=C[0];E.enabled=!j,await km(E);const R=y.map(P=>P.id===w?{...P,checked:!j}:P);x(R)},_=async w=>{try{rz(w.id),tz(w.id,C=>{console.log(C);const j=y.map(E=>E.id===C.id?{...C}:E);x(j)}),w.rightnow=!0,await km(w),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:l.jsxs(l.Fragment,{children:["执行失败,请查看",l.jsx(fr,{to:`/history?domain=${w.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}},p=async w=>{await _({...w,deployed:!1})},h=async w=>{const C=`${w.id}-${w.domain}.zip`,j=[{name:`${w.domain}.pem`,content:w.certificate?w.certificate:""},{name:`${w.domain}.key`,content:w.privateKey?w.privateKey:""}];await G6(C,j)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),l.jsx(He,{onClick:c,children:"新增域名"})]}),y.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-36",children:"域名"}),l.jsx("div",{className:"w-40",children:"有效期限"}),l.jsx("div",{className:"w-32",children:"最近执行状态"}),l.jsx("div",{className:"w-64",children:"最近执行阶段"}),l.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),l.jsx("div",{className:"w-24",children:"是否启用"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),y.map(w=>{var C,j,E,R;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-36 w-full pt-1 sm:pt-0 flex items-center",children:w.domain}),l.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx("div",{children:w.expiredAt?l.jsxs(l.Fragment,{children:[l.jsx("div",{children:"有效期90天"}),l.jsxs("div",{children:[q6(w.expiredAt),"到期"]})]}):"---"})}),l.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((C=w.expand)!=null&&C.lastDeployment)?l.jsx(l.Fragment,{children:l.jsx(Gv,{deployment:w.expand.lastDeployment})}):"---"}),l.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((j=w.expand)!=null&&j.lastDeployment)?l.jsx(Hv,{phase:(E=w.expand.lastDeployment)==null?void 0:E.phase,phaseSuccess:(R=w.expand.lastDeployment)==null?void 0:R.phaseSuccess}):"---"}),l.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:w.lastDeployedAt?ga(w.lastDeployedAt):"---"}),l.jsx("div",{className:"sm:w-24 flex items-center",children:l.jsx(Zv,{children:l.jsxs(gC,{children:[l.jsx(vC,{children:l.jsx(Lc,{checked:w.enabled,onCheckedChange:()=>{g(w.id)}})}),l.jsx(Kv,{children:l.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:w.enabled?"禁用":"启用"})})]})})}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(He,{variant:"link",className:"p-0",onClick:()=>f(w.id),children:"部署历史"}),l.jsxs(na,{when:!!w.enabled,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>_(w),children:"立即部署"})]}),l.jsxs(na,{when:!!(w.enabled&&w.deployed),children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>p(w),children:"强行部署"})]}),l.jsxs(na,{when:!!w.expiredAt,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>h(w),children:"下载"})]}),!w.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{children:"删除域名"}),l.jsx(ey,{children:"确定要删除域名吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{children:"取消"}),l.jsx(ty,{onClick:()=>{m(w.id)},children:"确认"})]})]})]}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>d(w.id),children:"编辑"})]})]})]},w.id)}),l.jsx(SC,{totalPages:i,currentPage:s?Number(s):1,onPageChange:w=>{u(w)}})]}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(rm,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(He,{onClick:c,className:"mt-3",children:"添加域名"})]})})]})})},Te=v.forwardRef(({className:e,type:t,...r},n)=>l.jsx("input",{type:t,className:ae("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",e),ref:n,...r}));Te.displayName="Input";var Fc=e=>e.type==="checkbox",$i=e=>e instanceof Date,pr=e=>e==null;const kj=e=>typeof e=="object";var qt=e=>!pr(e)&&!Array.isArray(e)&&kj(e)&&!$i(e),Cj=e=>qt(e)&&e.target?Fc(e.target)?e.target.checked:e.target.value:e,sz=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,jj=(e,t)=>e.has(sz(t)),oz=e=>{const t=e.constructor&&e.constructor.prototype;return qt(t)&&t.hasOwnProperty("isPrototypeOf")},ly=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function br(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ly&&(e instanceof Blob||e instanceof FileList))&&(r||qt(e)))if(t=r?[]:{},!r&&!oz(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=br(e[n]));else return e;return t}var Kf=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,ue=(e,t,r)=>{if(!t||!qt(e))return r;const n=Kf(t.split(/[,[\].]+?/)).reduce((s,o)=>pr(s)?s:s[o],e);return Ft(n)||n===e?Ft(e[t])?r:e[t]:n},Fn=e=>typeof e=="boolean",cy=e=>/^\w*$/.test(e),Ej=e=>Kf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ft=(e,t,r)=>{let n=-1;const s=cy(t)?[t]:Ej(t),o=s.length,i=o-1;for(;++nWe.useContext(Nj),iz=e=>{const{children:t,...r}=e;return We.createElement(Nj.Provider,{value:r},t)};var Tj=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==gn.all&&(t._proxyFormState[i]=!n||gn.all),r&&(r[i]=!0),e[i]}});return s},Or=e=>qt(e)&&!Object.keys(e).length,Rj=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Or(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||gn.all))},kl=e=>Array.isArray(e)?e:[e],Pj=(e,t,r)=>!e||!t||e===t||kl(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n)));function uy(e){const t=We.useRef(e);t.current=e,We.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function az(e){const t=Gf(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[i,a]=We.useState(r._formState),c=We.useRef(!0),u=We.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=We.useRef(s);return d.current=s,uy({disabled:n,next:f=>c.current&&Pj(d.current,f.name,o)&&Rj(f,u.current,r._updateFormState)&&a({...r._formState,...f}),subject:r._subjects.state}),We.useEffect(()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1}),[r]),Tj(i,r,u.current,!1)}var Un=e=>typeof e=="string",Aj=(e,t,r,n,s)=>Un(e)?(n&&t.watch.add(e),ue(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),ue(r,o))):(n&&(t.watchAll=!0),r);function lz(e){const t=Gf(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:i}=e||{},a=We.useRef(n);a.current=n,uy({disabled:o,subject:r._subjects.values,next:d=>{Pj(a.current,d.name,i)&&u(br(Aj(a.current,r._names,d.values||r._formValues,!1,s)))}});const[c,u]=We.useState(r._getWatch(n,s));return We.useEffect(()=>r._removeUnmounted()),c}function cz(e){const t=Gf(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o}=e,i=jj(s._names.array,r),a=lz({control:s,name:r,defaultValue:ue(s._formValues,r,ue(s._defaultValues,r,e.defaultValue)),exact:!0}),c=az({control:s,name:r}),u=We.useRef(s.register(r,{...e.rules,value:a,...Fn(e.disabled)?{disabled:e.disabled}:{}}));return We.useEffect(()=>{const d=s._options.shouldUnregister||o,f=(m,y)=>{const x=ue(s._fields,m);x&&x._f&&(x._f.mount=y)};if(f(r,!0),d){const m=br(ue(s._options.defaultValues,r));ft(s._defaultValues,r,m),Ft(ue(s._formValues,r))&&ft(s._formValues,r,m)}return()=>{(i?d&&!s._state.action:d)?s.unregister(r):f(r,!1)}},[r,s,i,o]),We.useEffect(()=>{ue(s._fields,r)&&s._updateDisabledField({disabled:n,fields:s._fields,name:r,value:ue(s._fields,r)._f.value})},[n,r,s]),{field:{name:r,value:a,...Fn(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:We.useCallback(d=>u.current.onChange({target:{value:Cj(d),name:r},type:Od.CHANGE}),[r]),onBlur:We.useCallback(()=>u.current.onBlur({target:{value:ue(s._formValues,r),name:r},type:Od.BLUR}),[r,s]),ref:d=>{const f=ue(s._fields,r);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:m=>d.setCustomValidity(m),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!ue(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ue(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ue(c.validatingFields,r)},error:{enumerable:!0,get:()=>ue(c.errors,r)}})}}const uz=e=>e.render(cz(e));var Dj=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},aw=e=>({isOnSubmit:!e||e===gn.onSubmit,isOnBlur:e===gn.onBlur,isOnChange:e===gn.onChange,isOnAll:e===gn.all,isOnTouch:e===gn.onTouched}),lw=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Cl=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=ue(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)break;if(i.ref&&t(i.ref,i.name)&&!n)break;Cl(a,t)}else qt(a)&&Cl(a,t)}}};var dz=(e,t,r)=>{const n=kl(ue(e,r));return ft(n,"root",t[r]),ft(e,r,n),e},dy=e=>e.type==="file",eo=e=>typeof e=="function",Md=e=>{if(!ly)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ku=e=>Un(e),fy=e=>e.type==="radio",Id=e=>e instanceof RegExp;const cw={value:!1,isValid:!1},uw={value:!0,isValid:!0};var Oj=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?uw:{value:e[0].value,isValid:!0}:uw:cw}return cw};const dw={isValid:!1,value:null};var Mj=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,dw):dw;function fw(e,t,r="validate"){if(Ku(e)||Array.isArray(e)&&e.every(Ku)||Fn(e)&&!e)return{type:r,message:Ku(e)?e:"",ref:t}}var ki=e=>qt(e)&&!Id(e)?e:{value:e,message:""},hw=async(e,t,r,n,s)=>{const{ref:o,refs:i,required:a,maxLength:c,minLength:u,min:d,max:f,pattern:m,validate:y,name:x,valueAsNumber:g,mount:_,disabled:p}=e._f,h=ue(t,x);if(!_||p)return{};const w=i?i[0]:o,C=N=>{n&&w.reportValidity&&(w.setCustomValidity(Fn(N)?"":N||""),w.reportValidity())},j={},E=fy(o),R=Fc(o),P=E||R,A=(g||dy(o))&&Ft(o.value)&&Ft(h)||Md(o)&&o.value===""||h===""||Array.isArray(h)&&!h.length,L=Dj.bind(null,x,r,j),q=(N,F,b,V=ss.maxLength,te=ss.minLength)=>{const W=N?F:b;j[x]={type:N?V:te,message:W,ref:o,...L(N?V:te,W)}};if(s?!Array.isArray(h)||!h.length:a&&(!P&&(A||pr(h))||Fn(h)&&!h||R&&!Oj(i).isValid||E&&!Mj(i).isValid)){const{value:N,message:F}=Ku(a)?{value:!!a,message:a}:ki(a);if(N&&(j[x]={type:ss.required,message:F,ref:w,...L(ss.required,F)},!r))return C(F),j}if(!A&&(!pr(d)||!pr(f))){let N,F;const b=ki(f),V=ki(d);if(!pr(h)&&!isNaN(h)){const te=o.valueAsNumber||h&&+h;pr(b.value)||(N=te>b.value),pr(V.value)||(F=tenew Date(new Date().toDateString()+" "+Q),Z=o.type=="time",I=o.type=="week";Un(b.value)&&h&&(N=Z?W(h)>W(b.value):I?h>b.value:te>new Date(b.value)),Un(V.value)&&h&&(F=Z?W(h)+N.value,V=!pr(F.value)&&h.length<+F.value;if((b||V)&&(q(b,N.message,F.message),!r))return C(j[x].message),j}if(m&&!A&&Un(h)){const{value:N,message:F}=ki(m);if(Id(N)&&!h.match(N)&&(j[x]={type:ss.pattern,message:F,ref:o,...L(ss.pattern,F)},!r))return C(F),j}if(y){if(eo(y)){const N=await y(h,t),F=fw(N,w);if(F&&(j[x]={...F,...L(ss.validate,F.message)},!r))return C(F.message),j}else if(qt(y)){let N={};for(const F in y){if(!Or(N)&&!r)break;const b=fw(await y[F](h,t),w,F);b&&(N={...b,...L(F,b.message)},C(b.message),r&&(j[x]=N))}if(!Or(N)&&(j[x]={ref:w,...N},!r))return j}}return C(!0),j};function fz(e,t){const r=t.slice(0,-1).length;let n=0;for(;n{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},Ld=e=>pr(e)||!kj(e);function Bo(e,t){if(Ld(e)||Ld(t))return e===t;if($i(e)&&$i(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r){const o=e[s];if(!n.includes(s))return!1;if(s!=="ref"){const i=t[s];if($i(o)&&$i(i)||qt(o)&&qt(i)||Array.isArray(o)&&Array.isArray(i)?!Bo(o,i):o!==i)return!1}}return!0}var Ij=e=>e.type==="select-multiple",pz=e=>fy(e)||Fc(e),np=e=>Md(e)&&e.isConnected,Lj=e=>{for(const t in e)if(eo(e[t]))return!0;return!1};function Fd(e,t={}){const r=Array.isArray(e);if(qt(e)||r)for(const n in e)Array.isArray(e[n])||qt(e[n])&&!Lj(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Fd(e[n],t[n])):pr(e[n])||(t[n]=!0);return t}function Fj(e,t,r){const n=Array.isArray(e);if(qt(e)||n)for(const s in e)Array.isArray(e[s])||qt(e[s])&&!Lj(e[s])?Ft(t)||Ld(r[s])?r[s]=Array.isArray(e[s])?Fd(e[s],[]):{...Fd(e[s])}:Fj(e[s],pr(t)?{}:t[s],r[s]):r[s]=!Bo(e[s],t[s]);return r}var Cu=(e,t)=>Fj(e,t,Fd(t)),zj=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ft(e)?e:t?e===""?NaN:e&&+e:r&&Un(e)?new Date(e):n?n(e):e;function sp(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return dy(t)?t.files:fy(t)?Mj(e.refs).value:Ij(t)?[...t.selectedOptions].map(({value:r})=>r):Fc(t)?Oj(e.refs).value:zj(Ft(t.value)?e.ref.value:t.value,e)}var mz=(e,t,r,n)=>{const s={};for(const o of e){const i=ue(t,o);i&&ft(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ja=e=>Ft(e)?e:Id(e)?e.source:qt(e)?Id(e.value)?e.value.source:e.value:e,gz=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function pw(e,t,r){const n=ue(e,r);if(n||cy(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=ue(t,o),a=ue(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:r}}var vz=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,yz=(e,t)=>!Kf(ue(e,t)).length&&Yt(e,t);const xz={mode:gn.onSubmit,reValidateMode:gn.onChange,shouldFocusError:!0};function wz(e={}){let t={...xz,...e},r={submitCount:0,isDirty:!1,isLoading:eo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=qt(t.defaultValues)||qt(t.values)?br(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:br(s),i={action:!1,mount:!1,watch:!1},a={mount: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},f={values:rp(),array:rp(),state:rp()},m=aw(t.mode),y=aw(t.reValidateMode),x=t.criteriaMode===gn.all,g=S=>T=>{clearTimeout(u),u=setTimeout(S,T)},_=async S=>{if(d.isValid||S){const T=t.resolver?Or((await P()).errors):await L(n,!0);T!==r.isValid&&f.state.next({isValid:T})}},p=(S,T)=>{(d.isValidating||d.validatingFields)&&((S||Array.from(a.mount)).forEach(O=>{O&&(T?ft(r.validatingFields,O,T):Yt(r.validatingFields,O))}),f.state.next({validatingFields:r.validatingFields,isValidating:!Or(r.validatingFields)}))},h=(S,T=[],O,Y,M=!0,H=!0)=>{if(Y&&O){if(i.action=!0,H&&Array.isArray(ue(n,S))){const X=O(ue(n,S),Y.argA,Y.argB);M&&ft(n,S,X)}if(H&&Array.isArray(ue(r.errors,S))){const X=O(ue(r.errors,S),Y.argA,Y.argB);M&&ft(r.errors,S,X),yz(r.errors,S)}if(d.touchedFields&&H&&Array.isArray(ue(r.touchedFields,S))){const X=O(ue(r.touchedFields,S),Y.argA,Y.argB);M&&ft(r.touchedFields,S,X)}d.dirtyFields&&(r.dirtyFields=Cu(s,o)),f.state.next({name:S,isDirty:N(S,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ft(o,S,T)},w=(S,T)=>{ft(r.errors,S,T),f.state.next({errors:r.errors})},C=S=>{r.errors=S,f.state.next({errors:r.errors,isValid:!1})},j=(S,T,O,Y)=>{const M=ue(n,S);if(M){const H=ue(o,S,Ft(O)?ue(s,S):O);Ft(H)||Y&&Y.defaultChecked||T?ft(o,S,T?H:sp(M._f)):V(S,H),i.mount&&_()}},E=(S,T,O,Y,M)=>{let H=!1,X=!1;const ee={name:S},me=!!(ue(n,S)&&ue(n,S)._f&&ue(n,S)._f.disabled);if(!O||Y){d.isDirty&&(X=r.isDirty,r.isDirty=ee.isDirty=N(),H=X!==ee.isDirty);const Ye=me||Bo(ue(s,S),T);X=!!(!me&&ue(r.dirtyFields,S)),Ye||me?Yt(r.dirtyFields,S):ft(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,H=H||d.dirtyFields&&X!==!Ye}if(O){const Ye=ue(r.touchedFields,S);Ye||(ft(r.touchedFields,S,O),ee.touchedFields=r.touchedFields,H=H||d.touchedFields&&Ye!==O)}return H&&M&&f.state.next(ee),H?ee:{}},R=(S,T,O,Y)=>{const M=ue(r.errors,S),H=d.isValid&&Fn(T)&&r.isValid!==T;if(e.delayError&&O?(c=g(()=>w(S,O)),c(e.delayError)):(clearTimeout(u),c=null,O?ft(r.errors,S,O):Yt(r.errors,S)),(O?!Bo(M,O):M)||!Or(Y)||H){const X={...Y,...H&&Fn(T)?{isValid:T}:{},errors:r.errors,name:S};r={...r,...X},f.state.next(X)}},P=async S=>{p(S,!0);const T=await t.resolver(o,t.context,mz(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return p(S),T},A=async S=>{const{errors:T}=await P(S);if(S)for(const O of S){const Y=ue(T,O);Y?ft(r.errors,O,Y):Yt(r.errors,O)}else r.errors=T;return T},L=async(S,T,O={valid:!0})=>{for(const Y in S){const M=S[Y];if(M){const{_f:H,...X}=M;if(H){const ee=a.array.has(H.name);p([Y],!0);const me=await hw(M,o,x,t.shouldUseNativeValidation&&!T,ee);if(p([Y]),me[H.name]&&(O.valid=!1,T))break;!T&&(ue(me,H.name)?ee?dz(r.errors,me,H.name):ft(r.errors,H.name,me[H.name]):Yt(r.errors,H.name))}X&&await L(X,T,O)}}return O.valid},q=()=>{for(const S of a.unMount){const T=ue(n,S);T&&(T._f.refs?T._f.refs.every(O=>!np(O)):!np(T._f.ref))&&Oe(S)}a.unMount=new Set},N=(S,T)=>(S&&T&&ft(o,S,T),!Bo(z(),s)),F=(S,T,O)=>Aj(S,a,{...i.mount?o:Ft(T)?s:Un(S)?{[S]:T}:T},O,T),b=S=>Kf(ue(i.mount?o:s,S,e.shouldUnregister?ue(s,S,[]):[])),V=(S,T,O={})=>{const Y=ue(n,S);let M=T;if(Y){const H=Y._f;H&&(!H.disabled&&ft(o,S,zj(T,H)),M=Md(H.ref)&&pr(T)?"":T,Ij(H.ref)?[...H.ref.options].forEach(X=>X.selected=M.includes(X.value)):H.refs?Fc(H.ref)?H.refs.length>1?H.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(M)?!!M.find(ee=>ee===X.value):M===X.value)):H.refs[0]&&(H.refs[0].checked=!!M):H.refs.forEach(X=>X.checked=X.value===M):dy(H.ref)?H.ref.value="":(H.ref.value=M,H.ref.type||f.values.next({name:S,values:{...o}})))}(O.shouldDirty||O.shouldTouch)&&E(S,M,O.shouldTouch,O.shouldDirty,!0),O.shouldValidate&&Q(S)},te=(S,T,O)=>{for(const Y in T){const M=T[Y],H=`${S}.${Y}`,X=ue(n,H);(a.array.has(S)||!Ld(M)||X&&!X._f)&&!$i(M)?te(H,M,O):V(H,M,O)}},W=(S,T,O={})=>{const Y=ue(n,S),M=a.array.has(S),H=br(T);ft(o,S,H),M?(f.array.next({name:S,values:{...o}}),(d.isDirty||d.dirtyFields)&&O.shouldDirty&&f.state.next({name:S,dirtyFields:Cu(s,o),isDirty:N(S,H)})):Y&&!Y._f&&!pr(H)?te(S,H,O):V(S,H,O),lw(S,a)&&f.state.next({...r}),f.values.next({name:i.mount?S:void 0,values:{...o}})},Z=async S=>{i.mount=!0;const T=S.target;let O=T.name,Y=!0;const M=ue(n,O),H=()=>T.type?sp(M._f):Cj(S),X=ee=>{Y=Number.isNaN(ee)||ee===ue(o,O,ee)};if(M){let ee,me;const Ye=H(),Ue=S.type===Od.BLUR||S.type===Od.FOCUS_OUT,jt=!gz(M._f)&&!t.resolver&&!ue(r.errors,O)&&!M._f.deps||vz(Ue,ue(r.touchedFields,O),r.isSubmitted,y,m),Gr=lw(O,a,Ue);ft(o,O,Ye),Ue?(M._f.onBlur&&M._f.onBlur(S),c&&c(0)):M._f.onChange&&M._f.onChange(S);const Ht=E(O,Ye,Ue,!1),Qn=!Or(Ht)||Gr;if(!Ue&&f.values.next({name:O,type:S.type,values:{...o}}),jt)return d.isValid&&_(),Qn&&f.state.next({name:O,...Gr?{}:Ht});if(!Ue&&Gr&&f.state.next({...r}),t.resolver){const{errors:at}=await P([O]);if(X(Ye),Y){const Jn=pw(r.errors,n,O),es=pw(at,n,Jn.name||O);ee=es.error,O=es.name,me=Or(at)}}else p([O],!0),ee=(await hw(M,o,x,t.shouldUseNativeValidation))[O],p([O]),X(Ye),Y&&(ee?me=!1:d.isValid&&(me=await L(n,!0)));Y&&(M._f.deps&&Q(M._f.deps),R(O,me,ee,Ht))}},I=(S,T)=>{if(ue(r.errors,T)&&S.focus)return S.focus(),1},Q=async(S,T={})=>{let O,Y;const M=kl(S);if(t.resolver){const H=await A(Ft(S)?S:M);O=Or(H),Y=S?!M.some(X=>ue(H,X)):O}else S?(Y=(await Promise.all(M.map(async H=>{const X=ue(n,H);return await L(X&&X._f?{[H]:X}:X)}))).every(Boolean),!(!Y&&!r.isValid)&&_()):Y=O=await L(n);return f.state.next({...!Un(S)||d.isValid&&O!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:O}:{},errors:r.errors}),T.shouldFocus&&!Y&&Cl(n,I,S?M:a.mount),Y},z=S=>{const T={...i.mount?o:s};return Ft(S)?T:Un(S)?ue(T,S):S.map(O=>ue(T,O))},$=(S,T)=>({invalid:!!ue((T||r).errors,S),isDirty:!!ue((T||r).dirtyFields,S),error:ue((T||r).errors,S),isValidating:!!ue(r.validatingFields,S),isTouched:!!ue((T||r).touchedFields,S)}),fe=S=>{S&&kl(S).forEach(T=>Yt(r.errors,T)),f.state.next({errors:S?r.errors:{}})},ne=(S,T,O)=>{const Y=(ue(n,S,{_f:{}})._f||{}).ref,M=ue(r.errors,S)||{},{ref:H,message:X,type:ee,...me}=M;ft(r.errors,S,{...me,...T,ref:Y}),f.state.next({name:S,errors:r.errors,isValid:!1}),O&&O.shouldFocus&&Y&&Y.focus&&Y.focus()},se=(S,T)=>eo(S)?f.values.subscribe({next:O=>S(F(void 0,T),O)}):F(S,T,!0),Oe=(S,T={})=>{for(const O of S?kl(S):a.mount)a.mount.delete(O),a.array.delete(O),T.keepValue||(Yt(n,O),Yt(o,O)),!T.keepError&&Yt(r.errors,O),!T.keepDirty&&Yt(r.dirtyFields,O),!T.keepTouched&&Yt(r.touchedFields,O),!T.keepIsValidating&&Yt(r.validatingFields,O),!t.shouldUnregister&&!T.keepDefaultValue&&Yt(s,O);f.values.next({values:{...o}}),f.state.next({...r,...T.keepDirty?{isDirty:N()}:{}}),!T.keepIsValid&&_()},he=({disabled:S,name:T,field:O,fields:Y,value:M})=>{if(Fn(S)&&i.mount||S){const H=S?void 0:Ft(M)?sp(O?O._f:ue(Y,T)._f):M;ft(o,T,H),E(T,H,!1,!1,!0)}},ye=(S,T={})=>{let O=ue(n,S);const Y=Fn(T.disabled);return ft(n,S,{...O||{},_f:{...O&&O._f?O._f:{ref:{name:S}},name:S,mount:!0,...T}}),a.mount.add(S),O?he({field:O,disabled:T.disabled,name:S,value:T.value}):j(S,!0,T.value),{...Y?{disabled:T.disabled}:{},...t.progressive?{required:!!T.required,min:Ja(T.min),max:Ja(T.max),minLength:Ja(T.minLength),maxLength:Ja(T.maxLength),pattern:Ja(T.pattern)}:{},name:S,onChange:Z,onBlur:Z,ref:M=>{if(M){ye(S,T),O=ue(n,S);const H=Ft(M.value)&&M.querySelectorAll&&M.querySelectorAll("input,select,textarea")[0]||M,X=pz(H),ee=O._f.refs||[];if(X?ee.find(me=>me===H):H===O._f.ref)return;ft(n,S,{_f:{...O._f,...X?{refs:[...ee.filter(np),H,...Array.isArray(ue(s,S))?[{}]:[]],ref:{type:H.type,name:S}}:{ref:H}}}),j(S,!1,void 0,H)}else O=ue(n,S,{}),O._f&&(O._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(jj(a.array,S)&&i.action)&&a.unMount.add(S)}}},ke=()=>t.shouldFocusError&&Cl(n,I,a.mount),Fe=S=>{Fn(S)&&(f.state.next({disabled:S}),Cl(n,(T,O)=>{const Y=ue(n,O);Y&&(T.disabled=Y._f.disabled||S,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(M=>{M.disabled=Y._f.disabled||S}))},0,!1))},Me=(S,T)=>async O=>{let Y;O&&(O.preventDefault&&O.preventDefault(),O.persist&&O.persist());let M=br(o);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:H,values:X}=await P();r.errors=H,M=X}else await L(n);if(Yt(r.errors,"root"),Or(r.errors)){f.state.next({errors:{}});try{await S(M,O)}catch(H){Y=H}}else T&&await T({...r.errors},O),ke(),setTimeout(ke);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Or(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},Pe=(S,T={})=>{ue(n,S)&&(Ft(T.defaultValue)?W(S,br(ue(s,S))):(W(S,T.defaultValue),ft(s,S,br(T.defaultValue))),T.keepTouched||Yt(r.touchedFields,S),T.keepDirty||(Yt(r.dirtyFields,S),r.isDirty=T.defaultValue?N(S,br(ue(s,S))):N()),T.keepError||(Yt(r.errors,S),d.isValid&&_()),f.state.next({...r}))},nt=(S,T={})=>{const O=S?br(S):s,Y=br(O),M=Or(S),H=M?s:Y;if(T.keepDefaultValues||(s=O),!T.keepValues){if(T.keepDirtyValues)for(const X of a.mount)ue(r.dirtyFields,X)?ft(H,X,ue(o,X)):W(X,ue(H,X));else{if(ly&&Ft(S))for(const X of a.mount){const ee=ue(n,X);if(ee&&ee._f){const me=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Md(me)){const Ye=me.closest("form");if(Ye){Ye.reset();break}}}}n={}}o=e.shouldUnregister?T.keepDefaultValues?br(s):{}:br(H),f.array.next({values:{...H}}),f.values.next({values:{...H}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!T.keepIsValid||!!T.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:M?!1:T.keepDirty?r.isDirty:!!(T.keepDefaultValues&&!Bo(S,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:T.keepDirtyValues?T.keepDefaultValues&&o?Cu(s,o):r.dirtyFields:T.keepDefaultValues&&S?Cu(s,S):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},k=(S,T)=>nt(eo(S)?S(o):S,T);return{control:{register:ye,unregister:Oe,getFieldState:$,handleSubmit:Me,setError:ne,_executeSchema:P,_getWatch:F,_getDirty:N,_updateValid:_,_removeUnmounted:q,_updateFieldArray:h,_updateDisabledField:he,_getFieldArray:b,_reset:nt,_resetDefaultValues:()=>eo(t.defaultValues)&&t.defaultValues().then(S=>{k(S,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:S=>{r={...r,...S}},_disableForm:Fe,_subjects:f,_proxyFormState:d,_setErrors:C,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(S){i=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},set _formState(S){r=S},get _options(){return t},set _options(S){t={...t,...S}}},trigger:Q,register:ye,handleSubmit:Me,watch:se,setValue:W,getValues:z,reset:k,resetField:Pe,clearErrors:fe,unregister:Oe,setError:ne,setFocus:(S,T={})=>{const O=ue(n,S),Y=O&&O._f;if(Y){const M=Y.refs?Y.refs[0]:Y.ref;M.focus&&(M.focus(),T.shouldSelect&&M.select())}},getFieldState:$}}function Tr(e={}){const t=We.useRef(),r=We.useRef(),[n,s]=We.useState({isDirty:!1,isValidating:!1,isLoading:eo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:eo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...wz(e),formState:n});const o=t.current.control;return o._options=e,uy({subject:o._subjects.state,next:i=>{Rj(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),We.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),We.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),We.useEffect(()=>{e.values&&!Bo(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),We.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),We.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),We.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=Tj(n,o),t.current}const mw=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ue(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Uj=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?mw(n.ref,r,e):n.refs&&n.refs.forEach(s=>mw(s,r,e))}},_z=(e,t)=>{t.shouldUseNativeValidation&&Uj(e,t);const r={};for(const n in e){const s=ue(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(bz(t.names||Object.keys(e),n)){const i=Object.assign({},ue(r,n));ft(i,"root",o),ft(r,n,i)}else ft(r,n,o)}return r},bz=(e,t)=>e.some(r=>r.startsWith(t+"."));var Sz=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=Dj(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r},Rr=function(e,t,r){return r===void 0&&(r={}),function(n,s,o){try{return Promise.resolve(function(i,a){try{var c=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(u){return o.shouldUseNativeValidation&&Uj({},o),{errors:{},values:r.raw?n:u}})}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:_z(Sz(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},ot;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ot||(ot={}));var Cm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cm||(Cm={}));const we=ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=e=>{switch(typeof e){case"undefined":return we.undefined;case"string":return we.string;case"number":return isNaN(e)?we.nan:we.number;case"boolean":return we.boolean;case"function":return we.function;case"bigint":return we.bigint;case"symbol":return we.symbol;case"object":return Array.isArray(e)?we.array:e===null?we.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?we.promise:typeof Map<"u"&&e instanceof Map?we.map:typeof Set<"u"&&e instanceof Set?we.set:typeof Date<"u"&&e instanceof Date?we.date:we.object;default:return we.unknown}},ie=ot.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"]),kz=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Wr extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;cr.message){const r={},n=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Wr.create=e=>new Wr(e);const va=(e,t)=>{let r;switch(e.code){case ie.invalid_type:e.received===we.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ot.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${ot.joinValues(e.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ot.joinValues(e.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${ot.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ot.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ie.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case ie.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=t.defaultError,ot.assertNever(e)}return{message:r}};let $j=va;function Cz(e){$j=e}function zd(){return $j}const Ud=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},jz=[];function ge(e,t){const r=zd(),n=Ud({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===va?void 0:va].filter(s=>!!s)});e.common.issues.push(n)}class cr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return Be;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,i=await s.value;n.push({key:o,value:i})}return cr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Be;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:t.value,value:n}}}const Be=Object.freeze({status:"aborted"}),Vi=e=>({status:"dirty",value:e}),gr=e=>({status:"valid",value:e}),jm=e=>e.status==="aborted",Em=e=>e.status==="dirty",tc=e=>e.status==="valid",rc=e=>typeof Promise<"u"&&e instanceof Promise;function $d(e,t,r,n){if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Vj(e,t,r,n,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,r),r}var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));var il,al;class Yn{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,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 gw=(e,t)=>{if(tc(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 r=new Wr(e.common.issues);return this._error=r,this._error}}};function Ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))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:(i,a)=>{var c,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(c=d??n)!==null&&c!==void 0?c:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??r)!==null&&u!==void 0?u:a.defaultError}},description:s}}class Je{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)}get description(){return this._def.description}_getType(t){return Zs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new cr,ctx:{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(rc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;const s={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},o=this._parseSync({data:t,path:s.path,parent:s});return gw(s,o)}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(rc(s)?s:Promise.resolve(s));return gw(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ie.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new En({schema:this,typeName:$e.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Wn.create(this,this._def)}nullable(){return wo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _n.create(this,this._def)}promise(){return xa.create(this,this._def)}or(t){return ic.create([this,t],this._def)}and(t){return ac.create(this,t,this._def)}transform(t){return new En({...Ze(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new fc({...Ze(this._def),innerType:this,defaultValue:r,typeName:$e.ZodDefault})}brand(){return new hy({typeName:$e.ZodBranded,type:this,...Ze(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new hc({...Ze(this._def),innerType:this,catchValue:r,typeName:$e.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return zc.create(this,t)}readonly(){return pc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ez=/^c[^\s-]{8,}$/i,Nz=/^[0-9a-z]+$/,Tz=/^[0-9A-HJKMNP-TV-Z]{26}$/,Rz=/^[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,Pz=/^[a-z0-9_-]{21}$/i,Az=/^[-+]?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)?)??$/,Dz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Oz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let op;const Mz=/^(?:(?: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])$/,Iz=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Lz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wj="((\\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])))",Fz=new RegExp(`^${Wj}$`);function Bj(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 zz(e){return new RegExp(`^${Bj(e)}$`)}function Hj(e){let t=`${Wj}T${Bj(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Uz(e,t){return!!((t==="v4"||!t)&&Mz.test(e)||(t==="v6"||!t)&&Iz.test(e))}class yn extends Je{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==we.string){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.string,received:o.parsedType}),Be}const n=new cr;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.lengtht.test(s),{validation:r,code:ie.invalid_string,...De.errToObj(n)})}_addCheck(t){return new yn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}datetime(t){var r,n;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:(r=t==null?void 0:t.offset)!==null&&r!==void 0?r:!1,local:(n=t==null?void 0:t.local)!==null&&n!==void 0?n:!1,...De.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,...De.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...De.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...De.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...De.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...De.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...De.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...De.errToObj(r)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new yn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yn({...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 isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yn({checks:[],typeName:$e.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};function $z(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class vo extends Je{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)!==we.number){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.number,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="int"?ot.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?$z(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_finite,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new vo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new vo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuet.kind==="int"||t.kind==="multipleOf"&&ot.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.valuenew vo({checks:[],typeName:$e.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class yo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==we.bigint){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.bigint,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new yo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new yo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yo({checks:[],typeName:$e.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};class nc extends Je{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==we.boolean){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.boolean,received:n.parsedType}),Be}return gr(t.data)}}nc.create=e=>new nc({typeName:$e.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class si extends Je{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==we.date){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.date,received:o.parsedType}),Be}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_date}),Be}const n=new cr;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ot.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new si({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew si({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:$e.ZodDate,...Ze(e)});class Vd extends Je{_parse(t){if(this._getType(t)!==we.symbol){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.symbol,received:n.parsedType}),Be}return gr(t.data)}}Vd.create=e=>new Vd({typeName:$e.ZodSymbol,...Ze(e)});class sc extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.undefined,received:n.parsedType}),Be}return gr(t.data)}}sc.create=e=>new sc({typeName:$e.ZodUndefined,...Ze(e)});class oc extends Je{_parse(t){if(this._getType(t)!==we.null){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.null,received:n.parsedType}),Be}return gr(t.data)}}oc.create=e=>new oc({typeName:$e.ZodNull,...Ze(e)});class ya extends Je{constructor(){super(...arguments),this._any=!0}_parse(t){return gr(t.data)}}ya.create=e=>new ya({typeName:$e.ZodAny,...Ze(e)});class Ko extends Je{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gr(t.data)}}Ko.create=e=>new Ko({typeName:$e.ZodUnknown,...Ze(e)});class js extends Je{_parse(t){const r=this._getOrReturnCtx(t);return ge(r,{code:ie.invalid_type,expected:we.never,received:r.parsedType}),Be}}js.create=e=>new js({typeName:$e.ZodNever,...Ze(e)});class Wd extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.void,received:n.parsedType}),Be}return gr(t.data)}}Wd.create=e=>new Wd({typeName:$e.ZodVoid,...Ze(e)});class _n extends Je{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==we.array)return ge(r,{code:ie.invalid_type,expected:we.array,received:r.parsedType}),Be;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.lengths.maxLength.value&&(ge(r,{code:ie.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Yn(r,i,r.path,a)))).then(i=>cr.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new Yn(r,i,r.path,a)));return cr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new _n({...this._def,minLength:{value:t,message:De.toString(r)}})}max(t,r){return new _n({...this._def,maxLength:{value:t,message:De.toString(r)}})}length(t,r){return new _n({...this._def,exactLength:{value:t,message:De.toString(r)}})}nonempty(t){return this.min(1,t)}}_n.create=(e,t)=>new _n({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...Ze(t)});function ji(e){if(e instanceof Rt){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Wn.create(ji(n))}return new Rt({...e._def,shape:()=>t})}else return e instanceof _n?new _n({...e._def,type:ji(e.element)}):e instanceof Wn?Wn.create(ji(e.unwrap())):e instanceof wo?wo.create(ji(e.unwrap())):e instanceof Zn?Zn.create(e.items.map(t=>ji(t))):e}class Rt extends Je{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(),r=ot.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==we.object){const u=this._getOrReturnCtx(t);return ge(u,{code:ie.invalid_type,expected:we.object,received:u.parsedType}),Be}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof js&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=o[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Yn(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof js){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")a.length>0&&(ge(s,{code:ie.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Yn(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,m=await d.value;u.push({key:f,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>cr.mergeObjectSync(n,u)):cr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,i,a;const c=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=De.errToObj(t).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$e.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const r={};return ot.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}omit(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}deepPartial(){return ji(this)}partial(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}),new Rt({...this._def,shape:()=>r})}required(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Wn;)o=o._def.innerType;r[n]=o}}),new Rt({...this._def,shape:()=>r})}keyof(){return Yj(ot.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});class ic extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Wr(a.ctx.common.issues));return ge(r,{code:ie.invalid_union,unionErrors:i}),Be}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new Wr(c));return ge(r,{code:ie.invalid_union,unionErrors:a}),Be}}get options(){return this._def.options}}ic.create=(e,t)=>new ic({options:e,typeName:$e.ZodUnion,...Ze(t)});const os=e=>e instanceof cc?os(e.schema):e instanceof En?os(e.innerType()):e instanceof uc?[e.value]:e instanceof xo?e.options:e instanceof dc?ot.objectValues(e.enum):e instanceof fc?os(e._def.innerType):e instanceof sc?[void 0]:e instanceof oc?[null]:e instanceof Wn?[void 0,...os(e.unwrap())]:e instanceof wo?[null,...os(e.unwrap())]:e instanceof hy||e instanceof pc?os(e.unwrap()):e instanceof hc?os(e._def.innerType):[];class qf extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.object)return ge(r,{code:ie.invalid_type,expected:we.object,received:r.parsedType}),Be;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(ge(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const i=os(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new qf({typeName:$e.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...Ze(n)})}}function Nm(e,t){const r=Zs(e),n=Zs(t);if(e===t)return{valid:!0,data:e};if(r===we.object&&n===we.object){const s=ot.objectKeys(t),o=ot.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=Nm(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===we.array&&n===we.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o{if(jm(o)||jm(i))return Be;const a=Nm(o.value,i.value);return a.valid?((Em(o)||Em(i))&&r.dirty(),{status:r.value,value:a.data}):(ge(n,{code:ie.invalid_intersection_types}),Be)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ac.create=(e,t,r)=>new ac({left:e,right:t,typeName:$e.ZodIntersection,...Ze(r)});class Zn extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.array)return ge(n,{code:ie.invalid_type,expected:we.array,received:n.parsedType}),Be;if(n.data.lengththis._def.items.length&&(ge(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Yn(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>cr.mergeArray(r,i)):cr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new Zn({...this._def,rest:t})}}Zn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:e,typeName:$e.ZodTuple,rest:null,...Ze(t)})};class lc extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.object)return ge(n,{code:ie.invalid_type,expected:we.object,received:n.parsedType}),Be;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new Yn(n,a,n.path,a)),value:i._parse(new Yn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?cr.mergeObjectAsync(r,s):cr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Je?new lc({keyType:t,valueType:r,typeName:$e.ZodRecord,...Ze(n)}):new lc({keyType:yn.create(),valueType:t,typeName:$e.ZodRecord,...Ze(r)})}}class Bd extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.map)return ge(n,{code:ie.invalid_type,expected:we.map,received:n.parsedType}),Be;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new Yn(n,a,n.path,[u,"key"])),value:o._parse(new Yn(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}}Bd.create=(e,t,r)=>new Bd({valueType:t,keyType:e,typeName:$e.ZodMap,...Ze(r)});class oi extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.set)return ge(n,{code:ie.invalid_type,expected:we.set,received:n.parsedType}),Be;const s=this._def;s.minSize!==null&&n.data.sizes.maxSize.value&&(ge(n,{code:ie.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Be;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const a=[...n.data.values()].map((c,u)=>o._parse(new Yn(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,r){return new oi({...this._def,minSize:{value:t,message:De.toString(r)}})}max(t,r){return new oi({...this._def,maxSize:{value:t,message:De.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}oi.create=(e,t)=>new oi({valueType:e,minSize:null,maxSize:null,typeName:$e.ZodSet,...Ze(t)});class oa extends Je{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.function)return ge(r,{code:ie.invalid_type,expected:we.function,received:r.parsedType}),Be;function n(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:c}})}function s(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:c}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof xa){const a=this;return gr(async function(...c){const u=new Wr([]),d=await a._def.args.parseAsync(c,o).catch(y=>{throw u.addIssue(n(c,y)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(y=>{throw u.addIssue(s(f,y)),u})})}else{const a=this;return gr(function(...c){const u=a._def.args.safeParse(c,o);if(!u.success)throw new Wr([n(c,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new Wr([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new oa({...this._def,args:Zn.create(t).rest(Ko.create())})}returns(t){return new oa({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new oa({args:t||Zn.create([]).rest(Ko.create()),returns:r||Ko.create(),typeName:$e.ZodFunction,...Ze(n)})}}class cc extends Je{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}cc.create=(e,t)=>new cc({getter:e,typeName:$e.ZodLazy,...Ze(t)});class uc extends Je{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return ge(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Be}return{status:"valid",value:t.data}}get value(){return this._def.value}}uc.create=(e,t)=>new uc({value:e,typeName:$e.ZodLiteral,...Ze(t)});function Yj(e,t){return new xo({values:e,typeName:$e.ZodEnum,...Ze(t)})}class xo extends Je{constructor(){super(...arguments),il.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{expected:ot.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Be}if($d(this,il)||Vj(this,il,new Set(this._def.values)),!$d(this,il).has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Be}return gr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return xo.create(t,{...this._def,...r})}exclude(t,r=this._def){return xo.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}il=new WeakMap;xo.create=Yj;class dc extends Je{constructor(){super(...arguments),al.set(this,void 0)}_parse(t){const r=ot.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==we.string&&n.parsedType!==we.number){const s=ot.objectValues(r);return ge(n,{expected:ot.joinValues(s),received:n.parsedType,code:ie.invalid_type}),Be}if($d(this,al)||Vj(this,al,new Set(ot.getValidEnumValues(this._def.values))),!$d(this,al).has(t.data)){const s=ot.objectValues(r);return ge(n,{received:n.data,code:ie.invalid_enum_value,options:s}),Be}return gr(t.data)}get enum(){return this._def.values}}al=new WeakMap;dc.create=(e,t)=>new dc({values:e,typeName:$e.ZodNativeEnum,...Ze(t)});class xa extends Je{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.promise&&r.common.async===!1)return ge(r,{code:ie.invalid_type,expected:we.promise,received:r.parsedType}),Be;const n=r.parsedType===we.promise?r.data:Promise.resolve(r.data);return gr(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}xa.create=(e,t)=>new xa({type:e,typeName:$e.ZodPromise,...Ze(t)});class En extends Je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{ge(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Be;const c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Be:c.status==="dirty"||r.value==="dirty"?Vi(c.value):c});{if(r.value==="aborted")return Be;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Be:a.status==="dirty"||r.value==="dirty"?Vi(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!tc(i))return i;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>tc(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):i);ot.assertNever(s)}}En.create=(e,t,r)=>new En({schema:e,typeName:$e.ZodEffects,effect:t,...Ze(r)});En.createWithPreprocess=(e,t,r)=>new En({schema:t,effect:{type:"preprocess",transform:e},typeName:$e.ZodEffects,...Ze(r)});class Wn extends Je{_parse(t){return this._getType(t)===we.undefined?gr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Wn.create=(e,t)=>new Wn({innerType:e,typeName:$e.ZodOptional,...Ze(t)});class wo extends Je{_parse(t){return this._getType(t)===we.null?gr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wo.create=(e,t)=>new wo({innerType:e,typeName:$e.ZodNullable,...Ze(t)});class fc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===we.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}fc.create=(e,t)=>new fc({innerType:e,typeName:$e.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ze(t)});class hc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rc(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}hc.create=(e,t)=>new hc({innerType:e,typeName:$e.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ze(t)});class Hd extends Je{_parse(t){if(this._getType(t)!==we.nan){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.nan,received:n.parsedType}),Be}return{status:"valid",value:t.data}}}Hd.create=e=>new Hd({typeName:$e.ZodNaN,...Ze(e)});const Vz=Symbol("zod_brand");class hy extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class zc extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Be:o.status==="dirty"?(r.dirty(),Vi(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Be:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new zc({in:t,out:r,typeName:$e.ZodPipeline})}}class pc extends Je{_parse(t){const r=this._def.innerType._parse(t),n=s=>(tc(s)&&(s.value=Object.freeze(s.value)),s);return rc(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>new pc({innerType:e,typeName:$e.ZodReadonly,...Ze(t)});function Zj(e,t={},r){return e?ya.create().superRefine((n,s)=>{var o,i;if(!e(n)){const a=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,c=(i=(o=a.fatal)!==null&&o!==void 0?o:r)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...u,fatal:c})}}):ya.create()}const Wz={object:Rt.lazycreate};var $e;(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"})($e||($e={}));const Bz=(e,t={message:`Input not instance of ${e.name}`})=>Zj(r=>r instanceof e,t),Kj=yn.create,Gj=vo.create,Hz=Hd.create,Yz=yo.create,qj=nc.create,Zz=si.create,Kz=Vd.create,Gz=sc.create,qz=oc.create,Xz=ya.create,Qz=Ko.create,Jz=js.create,e8=Wd.create,t8=_n.create,r8=Rt.create,n8=Rt.strictCreate,s8=ic.create,o8=qf.create,i8=ac.create,a8=Zn.create,l8=lc.create,c8=Bd.create,u8=oi.create,d8=oa.create,f8=cc.create,h8=uc.create,p8=xo.create,m8=dc.create,g8=xa.create,vw=En.create,v8=Wn.create,y8=wo.create,x8=En.createWithPreprocess,w8=zc.create,_8=()=>Kj().optional(),b8=()=>Gj().optional(),S8=()=>qj().optional(),k8={string:e=>yn.create({...e,coerce:!0}),number:e=>vo.create({...e,coerce:!0}),boolean:e=>nc.create({...e,coerce:!0}),bigint:e=>yo.create({...e,coerce:!0}),date:e=>si.create({...e,coerce:!0})},C8=Be;var pe=Object.freeze({__proto__:null,defaultErrorMap:va,setErrorMap:Cz,getErrorMap:zd,makeIssue:Ud,EMPTY_PATH:jz,addIssueToContext:ge,ParseStatus:cr,INVALID:Be,DIRTY:Vi,OK:gr,isAborted:jm,isDirty:Em,isValid:tc,isAsync:rc,get util(){return ot},get objectUtil(){return Cm},ZodParsedType:we,getParsedType:Zs,ZodType:Je,datetimeRegex:Hj,ZodString:yn,ZodNumber:vo,ZodBigInt:yo,ZodBoolean:nc,ZodDate:si,ZodSymbol:Vd,ZodUndefined:sc,ZodNull:oc,ZodAny:ya,ZodUnknown:Ko,ZodNever:js,ZodVoid:Wd,ZodArray:_n,ZodObject:Rt,ZodUnion:ic,ZodDiscriminatedUnion:qf,ZodIntersection:ac,ZodTuple:Zn,ZodRecord:lc,ZodMap:Bd,ZodSet:oi,ZodFunction:oa,ZodLazy:cc,ZodLiteral:uc,ZodEnum:xo,ZodNativeEnum:dc,ZodPromise:xa,ZodEffects:En,ZodTransformer:En,ZodOptional:Wn,ZodNullable:wo,ZodDefault:fc,ZodCatch:hc,ZodNaN:Hd,BRAND:Vz,ZodBranded:hy,ZodPipeline:zc,ZodReadonly:pc,custom:Zj,Schema:Je,ZodSchema:Je,late:Wz,get ZodFirstPartyTypeKind(){return $e},coerce:k8,any:Xz,array:t8,bigint:Yz,boolean:qj,date:Zz,discriminatedUnion:o8,effect:vw,enum:p8,function:d8,instanceof:Bz,intersection:i8,lazy:f8,literal:h8,map:c8,nan:Hz,nativeEnum:m8,never:Jz,null:qz,nullable:y8,number:Gj,object:r8,oboolean:S8,onumber:b8,optional:v8,ostring:_8,pipeline:w8,preprocess:x8,promise:g8,record:l8,set:u8,strictObject:n8,string:Kj,symbol:Kz,transformer:vw,tuple:a8,undefined:Gz,union:s8,unknown:Qz,void:e8,NEVER:C8,ZodIssueCode:ie,quotelessJson:kz,ZodError:Wr}),j8="Label",Xj=v.forwardRef((e,t)=>l.jsx(Re.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Xj.displayName=j8;var Qj=Xj;const E8=_c("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ma=v.forwardRef(({className:e,...t},r)=>l.jsx(Qj,{ref:r,className:ae(E8(),e),...t}));Ma.displayName=Qj.displayName;const Pr=iz,Jj=v.createContext({}),Ne=({...e})=>l.jsx(Jj.Provider,{value:{name:e.name},children:l.jsx(uz,{...e})}),Xf=()=>{const e=v.useContext(Jj),t=v.useContext(eE),{getFieldState:r,formState:n}=Gf(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},eE=v.createContext({}),Ce=v.forwardRef(({className:e,...t},r)=>{const n=v.useId();return l.jsx(eE.Provider,{value:{id:n},children:l.jsx("div",{ref:r,className:ae("space-y-2",e),...t})})});Ce.displayName="FormItem";const je=v.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Xf();return l.jsx(Ma,{ref:r,className:ae(n&&"text-destructive",e),htmlFor:s,...t})});je.displayName="FormLabel";const Ee=v.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:o}=Xf();return l.jsx(bs,{ref:t,id:n,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});Ee.displayName="FormControl";const N8=v.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Xf();return l.jsx("p",{ref:r,id:n,className:ae("text-sm text-muted-foreground",e),...t})});N8.displayName="FormDescription";const Se=v.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:o}=Xf(),i=s?String(s==null?void 0:s.message):t;return i?l.jsx("p",{ref:n,id:o,className:ae("text-sm font-medium text-destructive",e),...r,children:i}):null});Se.displayName="FormMessage";function Tm(e,[t,r]){return Math.min(r,Math.max(t,e))}var T8=[" ","Enter","ArrowUp","ArrowDown"],R8=[" ","Enter"],Uc="Select",[Qf,Jf,P8]=bc(Uc),[Ia,E$]=xr(Uc,[P8,Pa]),eh=Pa(),[A8,Eo]=Ia(Uc),[D8,O8]=Ia(Uc),tE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:y}=e,x=eh(t),[g,_]=v.useState(null),[p,h]=v.useState(null),[w,C]=v.useState(!1),j=Ea(u),[E=!1,R]=on({prop:n,defaultProp:s,onChange:o}),[P,A]=on({prop:i,defaultProp:a,onChange:c}),L=v.useRef(null),q=g?!!g.closest("form"):!0,[N,F]=v.useState(new Set),b=Array.from(N).map(V=>V.props.value).join(";");return l.jsx(Xg,{...x,children:l.jsxs(A8,{required:y,scope:t,trigger:g,onTriggerChange:_,valueNode:p,onValueNodeChange:h,valueNodeHasChildren:w,onValueNodeHasChildrenChange:C,contentId:Ur(),value:P,onValueChange:A,open:E,onOpenChange:R,dir:j,triggerPointerDownPosRef:L,disabled:m,children:[l.jsx(Qf.Provider,{scope:t,children:l.jsx(D8,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{F(te=>new Set(te).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{F(te=>{const W=new Set(te);return W.delete(V),W})},[]),children:r})}),q?l.jsxs(EE,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:V=>A(V.target.value),disabled:m,children:[P===void 0?l.jsx("option",{value:""}):null,Array.from(N)]},b):null]})})};tE.displayName=Uc;var rE="SelectTrigger",nE=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=eh(r),i=Eo(rE,r),a=i.disabled||n,c=Ke(t,i.onTriggerChange),u=Jf(r),[d,f,m]=NE(x=>{const g=u().filter(h=>!h.disabled),_=g.find(h=>h.value===i.value),p=TE(g,x,_);p!==void 0&&i.onValueChange(p.value)}),y=()=>{a||(i.onOpenChange(!0),m())};return l.jsx(Qg,{asChild:!0,...o,children:l.jsx(Re.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":jE(i.value)?"":void 0,...s,ref:c,onClick:ce(s.onClick,x=>{x.currentTarget.focus()}),onPointerDown:ce(s.onPointerDown,x=>{const g=x.target;g.hasPointerCapture(x.pointerId)&&g.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(y(),i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:ce(s.onKeyDown,x=>{const g=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&f(x.key),!(g&&x.key===" ")&&T8.includes(x.key)&&(y(),x.preventDefault())})})})});nE.displayName=rE;var sE="SelectValue",oE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,c=Eo(sE,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=Ke(t,c.onValueNodeChange);return Jt(()=>{u(d)},[u,d]),l.jsx(Re.span,{...a,ref:f,style:{pointerEvents:"none"},children:jE(c.value)?l.jsx(l.Fragment,{children:i}):o})});oE.displayName=sE;var M8="SelectIcon",iE=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return l.jsx(Re.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});iE.displayName=M8;var I8="SelectPortal",aE=e=>l.jsx(kc,{asChild:!0,...e});aE.displayName=I8;var ii="SelectContent",lE=v.forwardRef((e,t)=>{const r=Eo(ii,e.__scopeSelect),[n,s]=v.useState();if(Jt(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?Ns.createPortal(l.jsx(cE,{scope:e.__scopeSelect,children:l.jsx(Qf.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(uE,{...e,ref:t})});lE.displayName=ii;var ls=10,[cE,No]=Ia(ii),L8="SelectContentImpl",uE=v.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_,...p}=e,h=Eo(ii,r),[w,C]=v.useState(null),[j,E]=v.useState(null),R=Ke(t,he=>C(he)),[P,A]=v.useState(null),[L,q]=v.useState(null),N=Jf(r),[F,b]=v.useState(!1),V=v.useRef(!1);v.useEffect(()=>{if(w)return tv(w)},[w]),Vg();const te=v.useCallback(he=>{const[ye,...ke]=N().map(Pe=>Pe.ref.current),[Fe]=ke.slice(-1),Me=document.activeElement;for(const Pe of he)if(Pe===Me||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===ye&&j&&(j.scrollTop=0),Pe===Fe&&j&&(j.scrollTop=j.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==Me))return},[N,j]),W=v.useCallback(()=>te([P,w]),[te,P,w]);v.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:Z,triggerPointerDownPosRef:I}=h;v.useEffect(()=>{if(w){let he={x:0,y:0};const ye=Fe=>{var Me,Pe;he={x:Math.abs(Math.round(Fe.pageX)-(((Me=I.current)==null?void 0:Me.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((Pe=I.current)==null?void 0:Pe.y)??0))}},ke=Fe=>{he.x<=10&&he.y<=10?Fe.preventDefault():w.contains(Fe.target)||Z(!1),document.removeEventListener("pointermove",ye),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",ke,{capture:!0})}}},[w,Z,I]),v.useEffect(()=>{const he=()=>Z(!1);return window.addEventListener("blur",he),window.addEventListener("resize",he),()=>{window.removeEventListener("blur",he),window.removeEventListener("resize",he)}},[Z]);const[Q,z]=NE(he=>{const ye=N().filter(Me=>!Me.disabled),ke=ye.find(Me=>Me.ref.current===document.activeElement),Fe=TE(ye,he,ke);Fe&&setTimeout(()=>Fe.ref.current.focus())}),$=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&(A(he),Fe&&(V.current=!0))},[h.value]),fe=v.useCallback(()=>w==null?void 0:w.focus(),[w]),ne=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&q(he)},[h.value]),se=n==="popper"?Rm:dE,Oe=se===Rm?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_}:{};return l.jsx(cE,{scope:r,content:w,viewport:j,onViewportChange:E,itemRefCallback:$,selectedItem:P,onItemLeave:fe,itemTextRefCallback:ne,focusSelectedItem:W,selectedItemText:L,position:n,isPositioned:F,searchRef:Q,children:l.jsx(jf,{as:bs,allowPinchZoom:!0,children:l.jsx(wf,{asChild:!0,trapped:h.open,onMountAutoFocus:he=>{he.preventDefault()},onUnmountAutoFocus:ce(s,he=>{var ye;(ye=h.trigger)==null||ye.focus({preventScroll:!0}),he.preventDefault()}),children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:he=>he.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:l.jsx(se,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:he=>he.preventDefault(),...p,...Oe,onPlaced:()=>b(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...p.style},onKeyDown:ce(p.onKeyDown,he=>{const ye=he.ctrlKey||he.altKey||he.metaKey;if(he.key==="Tab"&&he.preventDefault(),!ye&&he.key.length===1&&z(he.key),["ArrowUp","ArrowDown","Home","End"].includes(he.key)){let Fe=N().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(he.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(he.key)){const Me=he.target,Pe=Fe.indexOf(Me);Fe=Fe.slice(Pe+1)}setTimeout(()=>te(Fe)),he.preventDefault()}})})})})})})});uE.displayName=L8;var F8="SelectItemAlignedPosition",dE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=Eo(ii,r),i=No(ii,r),[a,c]=v.useState(null),[u,d]=v.useState(null),f=Ke(t,R=>d(R)),m=Jf(r),y=v.useRef(!1),x=v.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:p,focusSelectedItem:h}=i,w=v.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&g&&_&&p){const R=o.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),L=p.getBoundingClientRect();if(o.dir!=="rtl"){const Me=L.left-P.left,Pe=A.left-Me,nt=R.left-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.left=D+"px"}else{const Me=P.right-L.right,Pe=window.innerWidth-A.right-Me,nt=window.innerWidth-R.right-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.right=D+"px"}const q=m(),N=window.innerHeight-ls*2,F=g.scrollHeight,b=window.getComputedStyle(u),V=parseInt(b.borderTopWidth,10),te=parseInt(b.paddingTop,10),W=parseInt(b.borderBottomWidth,10),Z=parseInt(b.paddingBottom,10),I=V+te+F+Z+W,Q=Math.min(_.offsetHeight*5,I),z=window.getComputedStyle(g),$=parseInt(z.paddingTop,10),fe=parseInt(z.paddingBottom,10),ne=R.top+R.height/2-ls,se=N-ne,Oe=_.offsetHeight/2,he=_.offsetTop+Oe,ye=V+te+he,ke=I-ye;if(ye<=ne){const Me=_===q[q.length-1].ref.current;a.style.bottom="0px";const Pe=u.clientHeight-g.offsetTop-g.offsetHeight,nt=Math.max(se,Oe+(Me?fe:0)+Pe+W),k=ye+nt;a.style.height=k+"px"}else{const Me=_===q[0].ref.current;a.style.top="0px";const nt=Math.max(ne,V+g.offsetTop+(Me?$:0)+Oe)+ke;a.style.height=nt+"px",g.scrollTop=ye-ne+g.offsetTop}a.style.margin=`${ls}px 0`,a.style.minHeight=Q+"px",a.style.maxHeight=N+"px",n==null||n(),requestAnimationFrame(()=>y.current=!0)}},[m,o.trigger,o.valueNode,a,u,g,_,p,o.dir,n]);Jt(()=>w(),[w]);const[C,j]=v.useState();Jt(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const E=v.useCallback(R=>{R&&x.current===!0&&(w(),h==null||h(),x.current=!1)},[w,h]);return l.jsx(U8,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:y,onScrollButtonChange:E,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:l.jsx(Re.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});dE.displayName=F8;var z8="SelectPopperPosition",Rm=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=ls,...o}=e,i=eh(r);return l.jsx(Jg,{...i,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})});Rm.displayName=z8;var[U8,py]=Ia(ii,{}),Pm="SelectViewport",fE=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=No(Pm,r),i=py(Pm,r),a=Ke(t,o.onViewportChange),c=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.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:n}),l.jsx(Qf.Slot,{scope:r,children:l.jsx(Re.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ce(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&f){const y=Math.abs(c.current-d.scrollTop);if(y>0){const x=window.innerHeight-ls*2,g=parseFloat(f.style.minHeight),_=parseFloat(f.style.height),p=Math.max(g,_);if(p0?C:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});fE.displayName=Pm;var hE="SelectGroup",[$8,V8]=Ia(hE),pE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ur();return l.jsx($8,{scope:r,id:s,children:l.jsx(Re.div,{role:"group","aria-labelledby":s,...n,ref:t})})});pE.displayName=hE;var mE="SelectLabel",gE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=V8(mE,r);return l.jsx(Re.div,{id:s.id,...n,ref:t})});gE.displayName=mE;var Yd="SelectItem",[W8,vE]=Ia(Yd),yE=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=Eo(Yd,r),c=No(Yd,r),u=a.value===n,[d,f]=v.useState(o??""),[m,y]=v.useState(!1),x=Ke(t,p=>{var h;return(h=c.itemRefCallback)==null?void 0:h.call(c,p,n,s)}),g=Ur(),_=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")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 l.jsx(W8,{scope:r,value:n,disabled:s,textId:g,isSelected:u,onItemTextChange:v.useCallback(p=>{f(h=>h||((p==null?void 0:p.textContent)??"").trim())},[]),children:l.jsx(Qf.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:l.jsx(Re.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:x,onFocus:ce(i.onFocus,()=>y(!0)),onBlur:ce(i.onBlur,()=>y(!1)),onPointerUp:ce(i.onPointerUp,_),onPointerMove:ce(i.onPointerMove,p=>{var h;s?(h=c.onItemLeave)==null||h.call(c):p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(i.onPointerLeave,p=>{var h;p.currentTarget===document.activeElement&&((h=c.onItemLeave)==null||h.call(c))}),onKeyDown:ce(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(R8.includes(p.key)&&_(),p.key===" "&&p.preventDefault())})})})})});yE.displayName=Yd;var ll="SelectItemText",xE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=Eo(ll,r),a=No(ll,r),c=vE(ll,r),u=O8(ll,r),[d,f]=v.useState(null),m=Ke(t,p=>f(p),c.onItemTextChange,p=>{var h;return(h=a.itemTextRefCallback)==null?void 0:h.call(a,p,c.value,c.disabled)}),y=d==null?void 0:d.textContent,x=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:y},c.value),[c.disabled,c.value,y]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return Jt(()=>(g(x),()=>_(x)),[g,_,x]),l.jsxs(l.Fragment,{children:[l.jsx(Re.span,{id:c.textId,...o,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ns.createPortal(o.children,i.valueNode):null]})});xE.displayName=ll;var wE="SelectItemIndicator",_E=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return vE(wE,r).isSelected?l.jsx(Re.span,{"aria-hidden":!0,...n,ref:t}):null});_E.displayName=wE;var Am="SelectScrollUpButton",bE=v.forwardRef((e,t)=>{const r=No(Am,e.__scopeSelect),n=py(Am,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});bE.displayName=Am;var Dm="SelectScrollDownButton",SE=v.forwardRef((e,t)=>{const r=No(Dm,e.__scopeSelect),n=py(Dm,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});SE.displayName=Dm;var kE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=No("SelectScrollButton",r),i=v.useRef(null),a=Jf(r),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Jt(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Re.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ce(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ce(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ce(s.onPointerLeave,()=>{c()})})}),B8="SelectSeparator",CE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(Re.div,{"aria-hidden":!0,...n,ref:t})});CE.displayName=B8;var Om="SelectArrow",H8=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=eh(r),o=Eo(Om,r),i=No(Om,r);return o.open&&i.position==="popper"?l.jsx(ev,{...s,...n,ref:t}):null});H8.displayName=Om;function jE(e){return e===""||e===void 0}var EE=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=v.useRef(null),o=Ke(t,s),i=YC(r);return v.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==r&&d){const f=new Event("change",{bubbles:!0});d.call(a,r),a.dispatchEvent(f)}},[i,r]),l.jsx(Ic,{asChild:!0,children:l.jsx("select",{...n,ref:o,defaultValue:r})})});EE.displayName="BubbleSelect";function NE(e){const t=Dt(e),r=v.useRef(""),n=v.useRef(0),s=v.useCallback(i=>{const a=r.current+i;t(a),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=v.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function TE(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=Y8(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Y8(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Z8=tE,RE=nE,K8=oE,G8=iE,q8=aE,PE=lE,X8=fE,Q8=pE,AE=gE,DE=yE,J8=xE,eU=_E,OE=bE,ME=SE,IE=CE;const Mo=Z8,cl=Q8,Io=K8,Ks=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(RE,{ref:n,className:ae("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 placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,l.jsx(G8,{asChild:!0,children:l.jsx(Lg,{className:"h-4 w-4 opacity-50"})})]}));Ks.displayName=RE.displayName;const LE=v.forwardRef(({className:e,...t},r)=>l.jsx(OE,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(aA,{className:"h-4 w-4"})}));LE.displayName=OE.displayName;const FE=v.forwardRef(({className:e,...t},r)=>l.jsx(ME,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Lg,{className:"h-4 w-4"})}));FE.displayName=ME.displayName;const Gs=v.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>l.jsx(q8,{children:l.jsxs(PE,{ref:s,className:ae("relative z-50 max-h-96 min-w-[8rem] overflow-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",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[l.jsx(LE,{}),l.jsx(X8,{className:ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(FE,{})]})}));Gs.displayName=PE.displayName;const Wi=v.forwardRef(({className:e,...t},r)=>l.jsx(AE,{ref:r,className:ae("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Wi.displayName=AE.displayName;const pn=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(DE,{ref:n,className:ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(eU,{children:l.jsx(eb,{className:"h-4 w-4"})})}),l.jsx(J8,{children:t})]}));pn.displayName=DE.displayName;const tU=v.forwardRef(({className:e,...t},r)=>l.jsx(IE,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));tU.displayName=IE.displayName;const Mm=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["aliyun-dcdn",["阿里云-DCDN","/imgs/providers/aliyun.svg"]],["tencent-cdn",["腾讯云-CDN","/imgs/providers/tencent.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["qiniu-cdn",["七牛云-CDN","/imgs/providers/qiniu.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),rU=Array.from(Mm.keys()),my=mv,gy=gv,nU=vv,zE=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{ref:r,className:ae("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}));zE.displayName=Ec.displayName;const th=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(nU,{children:[l.jsx(zE,{}),l.jsxs(Nc,{ref:n,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,l.jsxs(Tf,{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:[l.jsx(Fg,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));th.displayName=Nc.displayName;const rh=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});rh.displayName="DialogHeader";const nh=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold leading-none tracking-tight",e),...t}));nh.displayName=Tc.displayName;const sU=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));sU.displayName=Rc.displayName;function oU(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var vy="ScrollArea",[UE,N$]=xr(vy),[iU,cn]=UE(vy),$E=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[f,m]=v.useState(null),[y,x]=v.useState(null),[g,_]=v.useState(null),[p,h]=v.useState(0),[w,C]=v.useState(0),[j,E]=v.useState(!1),[R,P]=v.useState(!1),A=Ke(t,q=>c(q)),L=Ea(s);return l.jsx(iU,{scope:r,type:n,dir:L,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:j,onScrollbarXEnabledChange:E,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:R,onScrollbarYEnabledChange:P,onCornerWidthChange:h,onCornerHeightChange:C,children:l.jsx(Re.div,{dir:L,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":p+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});$E.displayName=vy;var VE="ScrollAreaViewport",WE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=cn(VE,r),a=v.useRef(null),c=Ke(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(Re.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});WE.displayName=VE;var Xn="ScrollAreaScrollbar",yy=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return v.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?l.jsx(aU,{...n,ref:t,forceMount:r}):s.type==="scroll"?l.jsx(lU,{...n,ref:t,forceMount:r}):s.type==="auto"?l.jsx(BE,{...n,ref:t,forceMount:r}):s.type==="always"?l.jsx(xy,{...n,ref:t}):null});yy.displayName=Xn;var aU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),[o,i]=v.useState(!1);return v.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(ur,{present:r||o,children:l.jsx(BE,{"data-state":o?"visible":"hidden",...n,ref:t})})}),lU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),o=e.orientation==="horizontal",i=oh(()=>c("SCROLL_END"),100),[a,c]=oU("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,c]),v.useEffect(()=>{const u=s.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const y=u[d];f!==y&&(c("SCROLL"),i()),f=y};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[s.viewport,o,c,i]),l.jsx(ur,{present:r||a!=="hidden",children:l.jsx(xy,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ce(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ce(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),BE=v.forwardRef((e,t)=>{const r=cn(Xn,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=v.useState(!1),a=e.orientation==="horizontal",c=oh(()=>{if(r.viewport){const u=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,s=cn(Xn,e.__scopeScrollArea),o=v.useRef(null),i=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=GE(a.viewport,a.content),d={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>o.current=m,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:m=>i.current=m};function f(m,y){return pU(m,i.current,a,y)}return r==="horizontal"?l.jsx(cU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollLeft,y=yw(m,a,s.dir);o.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=f(m,s.dir))}}):r==="vertical"?l.jsx(uU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollTop,y=yw(m,a);o.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=f(m))}}):null}),cU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Kd(i.paddingLeft),paddingEnd:Kd(i.paddingRight)}})}})}),uU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Kd(i.paddingTop),paddingEnd:Kd(i.paddingBottom)}})}})}),[dU,HE]=UE(Xn),YE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=e,y=cn(Xn,r),[x,g]=v.useState(null),_=Ke(t,A=>g(A)),p=v.useRef(null),h=v.useRef(""),w=y.viewport,C=n.content-n.viewport,j=Dt(d),E=Dt(c),R=oh(f,10);function P(A){if(p.current){const L=A.clientX-p.current.left,q=A.clientY-p.current.top;u({x:L,y:q})}}return v.useEffect(()=>{const A=L=>{const q=L.target;(x==null?void 0:x.contains(q))&&j(L,C)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[w,x,C,j]),v.useEffect(E,[n,E]),wa(x,R),wa(y.content,R),l.jsx(dU,{scope:r,scrollbar:x,hasThumb:s,onThumbChange:Dt(o),onThumbPointerUp:Dt(i),onThumbPositionChange:E,onThumbPointerDown:Dt(a),children:l.jsx(Re.div,{...m,ref:_,style:{position:"absolute",...m.style},onPointerDown:ce(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),p.current=x.getBoundingClientRect(),h.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),P(A))}),onPointerMove:ce(e.onPointerMove,P),onPointerUp:ce(e.onPointerUp,A=>{const L=A.target;L.hasPointerCapture(A.pointerId)&&L.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=h.current,y.viewport&&(y.viewport.style.scrollBehavior=""),p.current=null})})})}),Zd="ScrollAreaThumb",ZE=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=HE(Zd,e.__scopeScrollArea);return l.jsx(ur,{present:r||s.hasThumb,children:l.jsx(fU,{ref:t,...n})})}),fU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=cn(Zd,r),i=HE(Zd,r),{onThumbPositionChange:a}=i,c=Ke(t,f=>i.onThumbChange(f)),u=v.useRef(),d=oh(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=o.viewport;if(f){const m=()=>{if(d(),!u.current){const y=mU(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[o.viewport,d,a]),l.jsx(Re.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ce(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),x=f.clientX-y.left,g=f.clientY-y.top;i.onThumbPointerDown({x,y:g})}),onPointerUp:ce(e.onPointerUp,i.onThumbPointerUp)})});ZE.displayName=Zd;var wy="ScrollAreaCorner",KE=v.forwardRef((e,t)=>{const r=cn(wy,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?l.jsx(hU,{...e,ref:t}):null});KE.displayName=wy;var hU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=cn(wy,r),[o,i]=v.useState(0),[a,c]=v.useState(0),u=!!(o&&a);return wa(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),wa(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),i(d)}),u?l.jsx(Re.div,{...n,ref:t,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Kd(e){return e?parseInt(e,10):0}function GE(e,t){const r=e/t;return isNaN(r)?0:r}function sh(e){const t=GE(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function pU(e,t,r,n="ltr"){const s=sh(r),o=s/2,i=t||o,a=s-i,c=r.scrollbar.paddingStart+i,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,d=r.content-r.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return qE([c,u],f)(e)}function yw(e,t,r="ltr"){const n=sh(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-n,c=r==="ltr"?[0,i]:[i*-1,0],u=Tm(e,c);return qE([0,i],[0,a])(u)}function qE(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function XE(e,t){return e>0&&e{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,a=r.top!==o.top;(i||a)&&t(),r=o,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function oh(e,t){const r=Dt(e),n=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),v.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function wa(e,t){const r=Dt(t);Jt(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var QE=$E,gU=WE,vU=KE;const ih=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(QE,{ref:n,className:ae("relative overflow-hidden",e),...r,children:[l.jsx(gU,{className:"h-full w-full rounded-[inherit]",children:t}),l.jsx(JE,{}),l.jsx(vU,{})]}));ih.displayName=QE.displayName;const JE=v.forwardRef(({className:e,orientation:t="vertical",...r},n)=>l.jsx(yy,{ref:n,orientation:t,className:ae("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:l.jsx(ZE,{className:"relative flex-1 rounded-full bg-border"})}));JE.displayName=yy.displayName;const uo=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["cloudflare",["Cloudflare","/imgs/providers/cloudflare.svg"]],["namesilo",["Namesilo","/imgs/providers/namesilo.svg"]],["godaddy",["GoDaddy","/imgs/providers/godaddy.svg"]],["qiniu",["七牛云","/imgs/providers/qiniu.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),xw=e=>uo.get(e),To=pe.union([pe.literal("aliyun"),pe.literal("tencent"),pe.literal("ssh"),pe.literal("webhook"),pe.literal("cloudflare"),pe.literal("qiniu"),pe.literal("namesilo"),pe.literal("godaddy")],{message:"请选择云服务商"}),Ro=e=>{switch(e){case"aliyun":case"tencent":return"all";case"ssh":case"webhook":case"qiniu":return"deploy";case"cloudflare":case"namesilo":case"godaddy":return"apply";default:return"all"}},yU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,secretId:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={secretId:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:o.secretId,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{secretId:c.secretId,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},xU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKeyId:pe.string().min(1).max(64),accessSecretId:pe.string().min(1).max(64)});let o={accessKeyId:"",accessKeySecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:o.accessKeyId,accessSecretId:o.accessKeySecret}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKeyId:c.accessKeyId,accessKeySecret:c.accessSecretId}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKeyId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeyId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeyId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessSecretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeySecret"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeySecret",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},mc=v.forwardRef(({className:e,...t},r)=>l.jsx("textarea",{className:ae("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));mc.displayName="Textarea";const _y=({className:e,trigger:t})=>{const{reloadAccessGroups:r}=Kr(),[n,s]=v.useState(!1),o=pe.object({name:pe.string().min(1).max(64)}),i=Tr({resolver:Rr(o),defaultValues:{name:""}}),a=async c=>{try{await S3({name:c.name}),r(),s(!1)}catch(u){Object.entries(u.response.data).forEach(([f,m])=>{i.setError(f,{type:"manual",message:m.message})})}};return l.jsxs(my,{onOpenChange:s,open:n,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加分组"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"组名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入组名",...c,type:"text"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},wU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n,reloadAccessGroups:s,config:{accessGroups:o}}=Kr(),i=v.useRef(null),[a,c]=v.useState(""),u=e&&e.group?e.group:"",d=/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,f=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,m=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,host:pe.string().refine(h=>f.test(h)||d.test(h),{message:"请输入正确的域名或IP"}),group:pe.string().optional(),port:pe.string().min(1).max(5),username:pe.string().min(1).max(64),password:pe.string().min(0).max(64),key:pe.string().min(0).max(20480),keyFile:pe.any().optional(),command:pe.string().min(1).max(2048),certPath:pe.string().min(0).max(2048),keyPath:pe.string().min(0).max(2048)});let y={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:"",command:"sudo service nginx restart",certPath:"/etc/nginx/ssl/certificate.crt",keyPath:"/etc/nginx/ssl/private.key"};e&&(y=e.config);const x=Tr({resolver:Rr(m),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",group:e==null?void 0:e.group,host:y.host,port:y.port,username:y.username,password:y.password,key:y.key,keyFile:y.keyFile,certPath:y.certPath,keyPath:y.keyPath,command:y.command}}),g=async h=>{console.log(h);let w=h.group;w=="emptyId"&&(w="");const C={id:h.id,name:h.name,configType:h.configType,usage:Ro(h.configType),group:w,config:{host:h.host,port:h.port,username:h.username,password:h.password,key:h.key,command:h.command,certPath:h.certPath,keyPath:h.keyPath}};try{const j=await jo(C);t(),C.id=j.id,C.created=j.created,C.updated=j.updated,h.id?n(C):r(C),w!=u&&(u&&await nw({id:u,"access-":C.id}),w&&await nw({id:w,"access+":C.id})),s()}catch(j){Object.entries(j.response.data).forEach(([R,P])=>{x.setError(R,{type:"manual",message:P.message})});return}},_=async h=>{var E;const w=(E=h.target.files)==null?void 0:E[0];if(!w)return;const C=w;c(C.name);const j=await K6(C);x.setValue("key",j)},p=()=>{var h;console.log(i.current),(h=i.current)==null||h.click()};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...x,children:l.jsxs("form",{onSubmit:h=>{h.stopPropagation(),x.handleSubmit(g)(h)},className:"space-y-3",children:[l.jsx(Ne,{control:x.control,name:"name",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"group",render:({field:h})=>l.jsxs(Ce,{children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"授权配置组(用于将一个域名证书部署到多个 ssh 主机)"}),l.jsx(_y,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{...h,value:h.value,defaultValue:"emptyId",onValueChange:w=>{x.setValue("group",w)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),o.map(w=>l.jsx(pn,{value:w.id?w.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:w.name})},w.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"id",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"configType",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(Ne,{control:x.control,name:"host",render:({field:h})=>l.jsxs(Ce,{className:"grow",children:[l.jsx(je,{children:"服务器HOST"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Host",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"port",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SSH端口"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Port",...h,type:"number"})}),l.jsx(Se,{})]})})]}),l.jsx(Ne,{control:x.control,name:"username",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入用户名",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"password",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入密码",...h,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"key",render:({field:h})=>l.jsxs(Ce,{hidden:!0,children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Key",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyFile",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsxs("div",{children:[l.jsx(He,{type:"button",variant:"secondary",size:"sm",className:"w-48",onClick:p,children:a||"请选择文件"}),l.jsx(Te,{placeholder:"请输入Key",...h,ref:i,className:"hidden",hidden:!0,type:"file",onChange:_})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"certPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"证书上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入证书上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"私钥上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入私钥上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"command",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Command"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:"请输入要执行的命令",...h})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},_U=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,url:pe.string().url()});let o={url:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"webhook",url:o.url}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{url:c.url}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"url",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Webhook Url"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Webhook Url",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},bU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,dnsApiToken:pe.string().min(1).max(64)});let o={dnsApiToken:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"cloudflare",dnsApiToken:o.dnsApiToken}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{dnsApiToken:c.dnsApiToken}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"dnsApiToken",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"CLOUD_DNS_API_TOKEN"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入CLOUD_DNS_API_TOKEN",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},SU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKey:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={accessKey:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"qiniu",accessKey:o.accessKey,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKey:c.accessKey,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},kU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64)});let o={apiKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"namesilo",apiKey:o.apiKey}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"NAMESILO_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入NAMESILO_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},CU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64),apiSecret:pe.string().min(1).max(64)});let o={apiKey:"",apiSecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"godaddy",apiKey:o.apiKey,apiSecret:o.apiSecret}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey,apiSecret:c.apiSecret}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiSecret",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_SECRET"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_SECRET",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})};function jl({trigger:e,op:t,data:r,className:n}){const[s,o]=v.useState(!1),i=Array.from(uo.keys()),[a,c]=v.useState((r==null?void 0:r.configType)||"");let u=l.jsx(l.Fragment,{children:" "});switch(a){case"tencent":u=l.jsx(yU,{data:r,onAfterReq:()=>{o(!1)}});break;case"aliyun":u=l.jsx(xU,{data:r,onAfterReq:()=>{o(!1)}});break;case"ssh":u=l.jsx(wU,{data:r,onAfterReq:()=>{o(!1)}});break;case"webhook":u=l.jsx(_U,{data:r,onAfterReq:()=>{o(!1)}});break;case"cloudflare":u=l.jsx(bU,{data:r,onAfterReq:()=>{o(!1)}});break;case"qiniu":u=l.jsx(SU,{data:r,onAfterReq:()=>{o(!1)}});break;case"namesilo":u=l.jsx(kU,{data:r,onAfterReq:()=>{o(!1)}});break;case"godaddy":u=l.jsx(CU,{data:r,onAfterReq:()=>{o(!1)}});break}const d=f=>f==a?"border-primary":"";return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(n),children:e}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsxs(nh,{children:[t=="add"?"添加":"编辑","授权"]})}),l.jsx(ih,{className:"max-h-[80vh]",children:l.jsxs("div",{className:"container py-3",children:[l.jsx(Ma,{children:"服务商"}),l.jsxs(Mo,{onValueChange:f=>{console.log(f),c(f)},defaultValue:a,children:[l.jsx(Ks,{className:"mt-3",children:l.jsx(Io,{placeholder:"请选择服务商"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商"}),i.map(f=>{var m,y;return l.jsx(pn,{value:f,children:l.jsxs("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer",d(f)),children:[l.jsx("img",{src:(m=uo.get(f))==null?void 0:m[1],className:"h-6 w-6"}),l.jsx("div",{children:(y=uo.get(f))==null?void 0:y[0]})]})},f)})]})})]}),u]})})]})]})}const jU=({className:e,trigger:t})=>{const{config:{emails:r},setEmails:n}=Kr(),[s,o]=v.useState(!1),i=pe.object({email:pe.string().email()}),a=Tr({resolver:Rr(i),defaultValues:{email:""}}),c=async u=>{if(r.content.emails.includes(u.email)){a.setError("email",{message:"邮箱已存在"});return}const d=[...r.content.emails,u.email];try{const f=await Mc({...r,name:"emails",content:{emails:d}});n(f),a.reset(),a.clearErrors(),o(!1)}catch(f){Object.entries(f.response.data).forEach(([y,x])=>{a.setError(y,{type:"manual",message:x.message})})}};return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加邮箱"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...a,children:l.jsxs("form",{onSubmit:u=>{console.log(u),u.stopPropagation(),a.handleSubmit(c)(u)},className:"space-y-8",children:[l.jsx(Ne,{control:a.control,name:"email",render:({field:u})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...u,type:"email"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},EU=()=>{const{config:{accesses:e,emails:t,accessGroups:r}}=Kr(),[n,s]=v.useState(),o=Nn(),[i,a]=v.useState("base"),[c,u]=v.useState(n?n.targetType:"");v.useEffect(()=>{const p=new URLSearchParams(o.search).get("id");p&&(async()=>{const w=await J6(p);s(w),u(w.targetType)})()},[o.search]);const d=pe.object({id:pe.string().optional(),domain:pe.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:"请输入正确的域名"}),email:pe.string().email().optional(),access:pe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择DNS服务商授权配置"}),targetAccess:pe.string().optional(),targetType:pe.string().regex(/^[a-zA-Z0-9-]+$/,{message:"请选择部署服务类型"}),variables:pe.string().optional(),group:pe.string().optional(),nameservers:pe.string().optional()}),f=Tr({resolver:Rr(d),defaultValues:{id:"",domain:"",email:"",access:"",targetAccess:"",targetType:"",variables:"",group:"",nameservers:""}});v.useEffect(()=>{n&&f.reset({id:n.id,domain:n.domain,email:n.email,access:n.access,targetAccess:n.targetAccess,targetType:n.targetType,variables:n.variables,group:n.group,nameservers:n.nameservers})},[n,f]);const m=e.filter(_=>{if(_.usage=="apply")return!1;if(c=="")return!0;const p=c.split("-");return _.configType===p[0]}),{toast:y}=qn(),x=Nr(),g=async _=>{const p=_.group=="emptyId"?"":_.group,h=_.targetAccess==="emptyId"?"":_.targetAccess;if(p==""&&h==""){f.setError("group",{type:"manual",message:"部署授权和部署授权组至少选一个"}),f.setError("targetAccess",{type:"manual",message:"部署授权和部署授权组至少选一个"});return}const w={id:_.id,crontab:"0 0 * * *",domain:_.domain,email:_.email,access:_.access,group:p,targetAccess:h,targetType:_.targetType,variables:_.variables,nameservers:_.nameservers};try{await km(w);let C="域名编辑成功";w.id==""&&(C="域名添加成功"),y({title:"成功",description:C}),x("/domains")}catch(C){Object.entries(C.response.data).forEach(([E,R])=>{f.setError(E,{type:"manual",message:R.message})});return}};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:" h-5 text-muted-foreground",children:[n!=null&&n.id?"编辑":"新增","域名"]}),l.jsxs("div",{className:"mt-5 flex w-full justify-center md:space-x-10 flex-col md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[200px] text-muted-foreground space-x-3 md:space-y-3 flex-row md:flex-col flex",children:[l.jsx("div",{className:ae("cursor-pointer text-right",i==="base"?"text-primary":""),onClick:()=>{a("base")},children:"基础设置"}),l.jsx("div",{className:ae("cursor-pointer text-right",i==="advance"?"text-primary":""),onClick:()=>{a("advance")},children:"高级设置"})]}),l.jsx("div",{className:"w-full md:w-[35em] bg-gray-100 dark:bg-gray-900 p-5 rounded mt-3 md:mt-0",children:l.jsx(Pr,{...f,children:l.jsxs("form",{onSubmit:f.handleSubmit(g),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:f.control,name:"domain",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"域名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入域名",..._})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"email",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"Email(申请证书需要提供邮箱)"}),l.jsx(jU,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("email",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择邮箱"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"邮箱列表"}),t.content.emails.map(p=>l.jsx(pn,{value:p,children:l.jsx("div",{children:p})},p))]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"access",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"DNS 服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("access",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商授权配置"}),e.filter(p=>p.usage!="deploy").map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetType",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"部署服务类型"}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{u(p),f.setValue("targetType",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择部署服务类型"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"部署服务类型"}),rU.map(p=>{var h,w;return l.jsx(pn,{value:p,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=Mm.get(p))==null?void 0:h[1]}),l.jsx("div",{children:(w=Mm.get(p))==null?void 0:w[0]})]})},p)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetAccess",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"部署服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{f.setValue("targetAccess",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsxs(Wi,{children:["服务商授权配置",f.getValues().targetAccess]}),l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:"flex items-center space-x-2",children:"--"})}),m.map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"group",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance"||c!="ssh",children:[l.jsx(je,{className:"w-full flex justify-between",children:l.jsx("div",{children:"部署配置组(用于将一个域名证书部署到多个 ssh 主机)"})}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,defaultValue:"emptyId",onValueChange:p=>{f.setValue("group",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),r.filter(p=>{var h;return p.expand&&((h=p.expand)==null?void 0:h.access.length)>0}).map(p=>l.jsx(pn,{value:p.id?p.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:p.name})},p.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"variables",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance",children:[l.jsx(je,{children:"变量"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:`可在SSH部署中使用,形如: +\0`,ne+=o(z,2),ne+=E.magic,ne+=o(w,2),ne+=o(C,2),ne+=o(Q.crc32,4),ne+=o(Q.compressedSize,4),ne+=o(Q.uncompressedSize,4),ne+=o(P.length,2),ne+=o(V.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ne+P+V,dirRecord:f.CENTRAL_FILE_HEADER+o(fe,2)+ne+o(q.length,2)+"\0\0\0\0"+o($,4)+o(_,4)+P+V+q}}var a=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),f=r("../signature");function m(y,x,g,_){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=g,this.encodeFileName=_,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(m,c),m.prototype.push=function(y){var x=y.meta.percent||0,g=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,c.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:g?(x+100*(g-_-1))/g:100}}))},m.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var x=this.streamFiles&&!y.file.dir;if(x){var g=i(y,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(y){this.accumulate=!1;var x=this.streamFiles&&!y.file.dir,g=i(y,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),x)this.push({data:function(_){return f.DATA_DESCRIPTOR+o(_.crc32,4)+o(_.compressedSize,4)+o(_.uncompressedSize,4)}(y),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var y=this.bytesWritten,x=0;x=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=i},{"../utils":32}],19:[function(r,n,s){var o=r("./Uint8ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var o=r("./ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var o=r("../utils"),i=r("../support"),a=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(f){var m=o.getTypeOf(f);return o.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(f):i.uint8array?new d(o.transformTo("uint8array",f)):new a(o.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var o=r("./GenericWorker"),i=r("../utils");function a(c){o.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,o),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var o=r("./GenericWorker"),i=r("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,o),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(a,i),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function o(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c "+i:i}},n.exports=o},{}],29:[function(r,n,s){var o=r("../utils"),i=r("./ConvertWorker"),a=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),f=null;if(u.nodestream)try{f=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(x,g){return new d.Promise(function(_,p){var h=[],w=x._internalType,C=x._outputType,j=x._mimeType;x.on("data",function(E,R){h.push(E),g&&g(R)}).on("error",function(E){h=[],p(E)}).on("end",function(){try{var E=function(R,P,A){switch(R){case"blob":return o.newBlob(o.transformTo("arraybuffer",P),A);case"base64":return c.encode(P);default:return o.transformTo(R,P)}}(C,function(R,P){var A,L=0,q=null,N=0;for(A=0;A"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),s.blob=i.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var o=r("./utils"),i=r("./support"),a=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}s.utf8encode=function(y){return i.nodebuffer?a.newBufferFrom(y,"utf-8"):function(x){var g,_,p,h,w,C=x.length,j=0;for(h=0;h>>6:(_<65536?g[w++]=224|_>>>12:(g[w++]=240|_>>>18,g[w++]=128|_>>>12&63),g[w++]=128|_>>>6&63),g[w++]=128|63&_);return g}(y)},s.utf8decode=function(y){return i.nodebuffer?o.transformTo("nodebuffer",y).toString("utf-8"):function(x){var g,_,p,h,w=x.length,C=new Array(2*w);for(g=_=0;g>10&1023,C[_++]=56320|1023&p)}return C.length!==_&&(C.subarray?C=C.subarray(0,_):C.length=_),o.applyFromCharCode(C)}(y=o.transformTo(i.uint8array?"uint8array":"array",y))},o.inherits(f,c),f.prototype.processChunk=function(y){var x=o.transformTo(i.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var g=x;(x=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),x.set(g,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var _=function(h,w){var C;for((w=w||h.length)>h.length&&(w=h.length),C=w-1;0<=C&&(192&h[C])==128;)C--;return C<0||C===0?w:C+u[h[C]]>w?C:w}(x),p=x;_!==x.length&&(i.uint8array?(p=x.subarray(0,_),this.leftOver=x.subarray(_,x.length)):(p=x.slice(0,_),this.leftOver=x.slice(_,x.length))),this.push({data:s.utf8decode(p),meta:y.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=f,o.inherits(m,c),m.prototype.processChunk=function(y){this.push({data:s.utf8encode(y.data),meta:y.meta})},s.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var o=r("./support"),i=r("./base64"),a=r("./nodejsUtils"),c=r("./external");function u(g){return g}function d(g,_){for(var p=0;p>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var x,g,_,p=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4>>6:(y<65536?m[_++]=224|y>>>12:(m[_++]=240|y>>>18,m[_++]=128|y>>>12&63),m[_++]=128|y>>>6&63),m[_++]=128|63&y);return m},s.buf2binstring=function(f){return d(f,f.length)},s.binstring2buf=function(f){for(var m=new o.Buf8(f.length),y=0,x=m.length;y>10&1023,h[x++]=56320|1023&g)}return d(h,x)},s.utf8border=function(f,m){var y;for((m=m||f.length)>f.length&&(m=f.length),y=m-1;0<=y&&(192&f[y])==128;)y--;return y<0||y===0?m:y+c[f[y]]>m?y:m}},{"./common":41}],43:[function(r,n,s){n.exports=function(o,i,a,c){for(var u=65535&o|0,d=o>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3>>1:i>>>1;a[c]=i}return a}();n.exports=function(i,a,c,u){var d=o,f=u+c;i^=-1;for(var m=u;m>>8^d[255&(i^a[m])];return-1^i}},{}],46:[function(r,n,s){var o,i=r("../utils/common"),a=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),f=0,m=4,y=0,x=-2,g=-1,_=4,p=2,h=8,w=9,C=286,j=30,E=19,R=2*C+1,P=15,A=3,L=258,q=L+A+1,N=42,F=113,b=1,V=2,te=3,W=4;function Z(k,J){return k.msg=d[J],J}function I(k){return(k<<1)-(4k.avail_out&&(K=k.avail_out),K!==0&&(i.arraySet(k.output,J.pending_buf,J.pending_out,K,k.next_out),k.next_out+=K,J.pending_out+=K,k.total_out+=K,k.avail_out-=K,J.pending-=K,J.pending===0&&(J.pending_out=0))}function $(k,J){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,J),k.block_start=k.strstart,z(k.strm)}function fe(k,J){k.pending_buf[k.pending++]=J}function ne(k,J){k.pending_buf[k.pending++]=J>>>8&255,k.pending_buf[k.pending++]=255&J}function se(k,J){var K,D,S=k.max_chain_length,T=k.strstart,O=k.prev_length,Y=k.nice_match,M=k.strstart>k.w_size-q?k.strstart-(k.w_size-q):0,H=k.window,X=k.w_mask,ee=k.prev,me=k.strstart+L,Ye=H[T+O-1],Ue=H[T+O];k.prev_length>=k.good_match&&(S>>=2),Y>k.lookahead&&(Y=k.lookahead);do if(H[(K=J)+O]===Ue&&H[K+O-1]===Ye&&H[K]===H[T]&&H[++K]===H[T+1]){T+=2,K++;do;while(H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&TM&&--S!=0);return O<=k.lookahead?O:k.lookahead}function Oe(k){var J,K,D,S,T,O,Y,M,H,X,ee=k.w_size;do{if(S=k.window_size-k.lookahead-k.strstart,k.strstart>=ee+(ee-q)){for(i.arraySet(k.window,k.window,ee,ee,0),k.match_start-=ee,k.strstart-=ee,k.block_start-=ee,J=K=k.hash_size;D=k.head[--J],k.head[J]=ee<=D?D-ee:0,--K;);for(J=K=ee;D=k.prev[--J],k.prev[J]=ee<=D?D-ee:0,--K;);S+=ee}if(k.strm.avail_in===0)break;if(O=k.strm,Y=k.window,M=k.strstart+k.lookahead,H=S,X=void 0,X=O.avail_in,H=A)for(T=k.strstart-k.insert,k.ins_h=k.window[T],k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A)if(D=a._tr_tally(k,k.strstart-k.match_start,k.match_length-A),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=A){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A&&k.match_length<=k.prev_length){for(S=k.strstart+k.lookahead-A,D=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-A),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=S&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(K=k.pending_buf_size-5);;){if(k.lookahead<=1){if(Oe(k),k.lookahead===0&&J===f)return b;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var D=k.block_start+K;if((k.strstart===0||k.strstart>=D)&&(k.lookahead=k.strstart-D,k.strstart=D,$(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-q&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=0,J===m?($(k,!0),k.strm.avail_out===0?te:W):(k.strstart>k.block_start&&($(k,!1),k.strm.avail_out),b)}),new ke(4,4,8,4,he),new ke(4,5,16,8,he),new ke(4,6,32,32,he),new ke(4,4,16,16,ye),new ke(8,16,32,32,ye),new ke(8,16,128,128,ye),new ke(8,32,128,256,ye),new ke(32,128,258,1024,ye),new ke(32,258,258,4096,ye)],s.deflateInit=function(k,J){return nt(k,J,h,15,8,0)},s.deflateInit2=nt,s.deflateReset=Pe,s.deflateResetKeep=Me,s.deflateSetHeader=function(k,J){return k&&k.state?k.state.wrap!==2?x:(k.state.gzhead=J,y):x},s.deflate=function(k,J){var K,D,S,T;if(!k||!k.state||5>8&255),fe(D,D.gzhead.time>>16&255),fe(D,D.gzhead.time>>24&255),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(fe(D,255&D.gzhead.extra.length),fe(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(k.adler=u(k.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,3),D.status=F);else{var O=h+(D.w_bits-8<<4)<<8;O|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(O|=32),O+=31-O%31,D.status=F,ne(D,O),D.strstart!==0&&(ne(D,k.adler>>>16),ne(D,65535&k.adler)),k.adler=1}if(D.status===69)if(D.gzhead.extra){for(S=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending!==D.pending_buf_size));)fe(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&z(k),D.pending+2<=D.pending_buf_size&&(fe(D,255&k.adler),fe(D,k.adler>>8&255),k.adler=0,D.status=F)):D.status=F),D.pending!==0){if(z(k),k.avail_out===0)return D.last_flush=-1,y}else if(k.avail_in===0&&I(J)<=I(K)&&J!==m)return Z(k,-5);if(D.status===666&&k.avail_in!==0)return Z(k,-5);if(k.avail_in!==0||D.lookahead!==0||J!==f&&D.status!==666){var Y=D.strategy===2?function(M,H){for(var X;;){if(M.lookahead===0&&(Oe(M),M.lookahead===0)){if(H===f)return b;break}if(M.match_length=0,X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):D.strategy===3?function(M,H){for(var X,ee,me,Ye,Ue=M.window;;){if(M.lookahead<=L){if(Oe(M),M.lookahead<=L&&H===f)return b;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=A&&0M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=A?(X=a._tr_tally(M,1,M.match_length-A),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):o[D.level].func(D,J);if(Y!==te&&Y!==W||(D.status=666),Y===b||Y===te)return k.avail_out===0&&(D.last_flush=-1),y;if(Y===V&&(J===1?a._tr_align(D):J!==5&&(a._tr_stored_block(D,0,0,!1),J===3&&(Q(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),z(k),k.avail_out===0))return D.last_flush=-1,y}return J!==m?y:D.wrap<=0?1:(D.wrap===2?(fe(D,255&k.adler),fe(D,k.adler>>8&255),fe(D,k.adler>>16&255),fe(D,k.adler>>24&255),fe(D,255&k.total_in),fe(D,k.total_in>>8&255),fe(D,k.total_in>>16&255),fe(D,k.total_in>>24&255)):(ne(D,k.adler>>>16),ne(D,65535&k.adler)),z(k),0=K.w_size&&(T===0&&(Q(K.head),K.strstart=0,K.block_start=0,K.insert=0),H=new i.Buf8(K.w_size),i.arraySet(H,J,X-K.w_size,K.w_size,0),J=H,X=K.w_size),O=k.avail_in,Y=k.next_in,M=k.input,k.avail_in=X,k.next_in=0,k.input=J,Oe(K);K.lookahead>=A;){for(D=K.strstart,S=K.lookahead-(A-1);K.ins_h=(K.ins_h<>>=A=P>>>24,w-=A,(A=P>>>16&255)===0)V[d++]=65535&P;else{if(!(16&A)){if(!(64&A)){P=C[(65535&P)+(h&(1<>>=A,w-=A),w<15&&(h+=b[c++]<>>=A=P>>>24,w-=A,!(16&(A=P>>>16&255))){if(!(64&A)){P=j[(65535&P)+(h&(1<>>=A,w-=A,(A=d-f)>3,h&=(1<<(w-=L<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(N){var F;return N&&N.state?(F=N.state,N.total_in=N.total_out=F.total=0,N.msg="",F.wrap&&(N.adler=1&F.wrap),F.mode=x,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new o.Buf32(g),F.distcode=F.distdyn=new o.Buf32(_),F.sane=1,F.back=-1,m):y}function C(N){var F;return N&&N.state?((F=N.state).wsize=0,F.whave=0,F.wnext=0,w(N)):y}function j(N,F){var b,V;return N&&N.state?(V=N.state,F<0?(b=0,F=-F):(b=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=W.wsize?(o.arraySet(W.window,F,b-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(V<(te=W.wsize-W.wnext)&&(te=V),o.arraySet(W.window,F,b-V,te,W.wnext),(V-=te)?(o.arraySet(W.window,F,b-V,V,0),W.wnext=V,W.whave=W.wsize):(W.wnext+=te,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,b.check=a(b.check,T,2,0),$=z=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&z)<<8)+(z>>8))%31){N.msg="incorrect header check",b.mode=30;break}if((15&z)!=8){N.msg="unknown compression method",b.mode=30;break}if($-=4,k=8+(15&(z>>>=4)),b.wbits===0)b.wbits=k;else if(k>b.wbits){N.msg="invalid window size",b.mode=30;break}b.dmax=1<>8&1),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=3;case 3:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.time=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,T[2]=z>>>16&255,T[3]=z>>>24&255,b.check=a(b.check,T,4,0)),$=z=0,b.mode=4;case 4:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.xflags=255&z,b.head.os=z>>8),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length=z,b.head&&(b.head.extra_len=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(I<(se=b.length)&&(se=I),se&&(b.head&&(k=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),o.arraySet(b.head.extra,V,W,se,k)),512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,b.length-=se),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.name+=String.fromCharCode(k)),k&&se>9&1,b.head.done=!0),N.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}N.adler=b.check=p(z),$=z=0,b.mode=11;case 11:if(b.havedict===0)return N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,2;N.adler=b.check=1,b.mode=12;case 12:if(F===5||F===6)break e;case 13:if(b.last){z>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}switch(b.last=1&z,$-=1,3&(z>>>=1)){case 0:b.mode=14;break;case 1:if(L(b),b.mode=20,F!==6)break;z>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:N.msg="invalid block type",b.mode=30}z>>>=2,$-=2;break;case 14:for(z>>>=7&$,$-=7&$;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if((65535&z)!=(z>>>16^65535)){N.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&z,$=z=0,b.mode=15,F===6)break e;case 15:b.mode=16;case 16:if(se=b.length){if(I>>=5,$-=5,b.ndist=1+(31&z),z>>>=5,$-=5,b.ncode=4+(15&z),z>>>=4,$-=4,286>>=3,$-=3}for(;b.have<19;)b.lens[O[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,K={bits:b.lenbits},J=u(0,b.lens,0,19,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(Fe<16)z>>>=ye,$-=ye,b.lens[b.have++]=Fe;else{if(Fe===16){for(D=ye+2;$>>=ye,$-=ye,b.have===0){N.msg="invalid bit length repeat",b.mode=30;break}k=b.lens[b.have-1],se=3+(3&z),z>>>=2,$-=2}else if(Fe===17){for(D=ye+3;$>>=ye)),z>>>=3,$-=3}else{for(D=ye+7;$>>=ye)),z>>>=7,$-=7}if(b.have+se>b.nlen+b.ndist){N.msg="invalid bit length repeat",b.mode=30;break}for(;se--;)b.lens[b.have++]=k}}if(b.mode===30)break;if(b.lens[256]===0){N.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,K={bits:b.lenbits},J=u(d,b.lens,0,b.nlen,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,K={bits:b.distbits},J=u(f,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,K),b.distbits=K.bits,J){N.msg="invalid distances set",b.mode=30;break}if(b.mode=20,F===6)break e;case 20:b.mode=21;case 21:if(6<=I&&258<=Q){N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,c(N,ne),Z=N.next_out,te=N.output,Q=N.avail_out,W=N.next_in,V=N.input,I=N.avail_in,z=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ke=(S=b.lencode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(ke&&!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.lencode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,b.length=Fe,ke===0){b.mode=26;break}if(32&ke){b.back=-1,b.mode=12;break}if(64&ke){N.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ke,b.mode=22;case 22:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ke=(S=b.distcode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.distcode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,64&ke){N.msg="invalid distance code",b.mode=30;break}b.offset=Fe,b.extra=15&ke,b.mode=24;case 24:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){N.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(Q===0)break e;if(se=ne-Q,b.offset>se){if((se=b.offset-se)>b.whave&&b.sane){N.msg="invalid distance too far back",b.mode=30;break}Oe=se>b.wnext?(se-=b.wnext,b.wsize-se):b.wnext-se,se>b.length&&(se=b.length),he=b.window}else he=te,Oe=Z-b.offset,se=b.length;for(QR?(A=Oe[he+_[F]],$[fe+_[F]]):(A=96,0),h=1<>Z)+(w-=h)]=P<<24|A<<16|L|0,w!==0;);for(h=1<>=1;if(h!==0?(z&=h-1,z+=h):z=0,F++,--ne[N]==0){if(N===V)break;N=f[m+_[F]]}if(te>>7)]}function fe(S,T){S.pending_buf[S.pending++]=255&T,S.pending_buf[S.pending++]=T>>>8&255}function ne(S,T,O){S.bi_valid>p-O?(S.bi_buf|=T<>p-S.bi_valid,S.bi_valid+=O-p):(S.bi_buf|=T<>>=1,O<<=1,0<--T;);return O>>>1}function he(S,T,O){var Y,M,H=new Array(_+1),X=0;for(Y=1;Y<=_;Y++)H[Y]=X=X+O[Y-1]<<1;for(M=0;M<=T;M++){var ee=S[2*M+1];ee!==0&&(S[2*M]=Oe(H[ee]++,ee))}}function ye(S){var T;for(T=0;T>1;1<=O;O--)Me(S,H,O);for(M=me;O=S.heap[1],S.heap[1]=S.heap[S.heap_len--],Me(S,H,1),Y=S.heap[1],S.heap[--S.heap_max]=O,S.heap[--S.heap_max]=Y,H[2*M]=H[2*O]+H[2*Y],S.depth[M]=(S.depth[O]>=S.depth[Y]?S.depth[O]:S.depth[Y])+1,H[2*O+1]=H[2*Y+1]=M,S.heap[1]=M++,Me(S,H,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(Ue,jt){var Gr,Ht,Qn,at,Jn,es,qr=jt.dyn_tree,$c=jt.max_code,Vc=jt.stat_desc.static_tree,hi=jt.stat_desc.has_stree,Wc=jt.stat_desc.extra_bits,pi=jt.stat_desc.extra_base,Pn=jt.stat_desc.max_length,Is=0;for(at=0;at<=_;at++)Ue.bl_count[at]=0;for(qr[2*Ue.heap[Ue.heap_max]+1]=0,Gr=Ue.heap_max+1;Gr>=7;M>>=1)if(1&Ye&&ee.dyn_ltree[2*me]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(H=S.static_len+3+7>>>3)<=M&&(M=H)):M=H=O+5,O+4<=M&&T!==-1?D(S,T,O,Y):S.strategy===4||H===M?(ne(S,2+(Y?1:0),3),Pe(S,q,N)):(ne(S,4+(Y?1:0),3),function(ee,me,Ye,Ue){var jt;for(ne(ee,me-257,5),ne(ee,Ye-1,5),ne(ee,Ue-4,4),jt=0;jt>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&T,S.pending_buf[S.l_buf+S.last_lit]=255&O,S.last_lit++,T===0?S.dyn_ltree[2*O]++:(S.matches++,T--,S.dyn_ltree[2*(b[O]+f+1)]++,S.dyn_dtree[2*$(T)]++),S.last_lit===S.lit_bufsize-1},s._tr_align=function(S){ne(S,2,3),se(S,w,q),function(T){T.bi_valid===16?(fe(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):8<=T.bi_valid&&(T.pending_buf[T.pending++]=255&T.bi_buf,T.bi_buf>>=8,T.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(o){(function(i,a){if(!i.setImmediate){var c,u,d,f,m=1,y={},x=!1,g=i.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(i);_=_&&_.setTimeout?_:i,c={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){h(C)})}:function(){if(i.postMessage&&!i.importScripts){var C=!0,j=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=j,C}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(C){i.postMessage(f+C,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){h(C.data)},function(C){d.port2.postMessage(C)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(C){var j=g.createElement("script");j.onreadystatechange=function(){h(C),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(C){setTimeout(h,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var j=new Array(arguments.length-1),E=0;E"u"?o===void 0?this:o:self)}).call(this,typeof Kc<"u"?Kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bj);var H6=bj.exports;const Y6=Lm(H6);function Z6(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{n.result?t(n.result.toString()):r("No content found")},n.onerror=()=>r(n.error),n.readAsText(e)})}const K6=async(e,t)=>{const r=new Y6;t.forEach(o=>{r.file(o.name,o.content)});const n=await r.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(n),s.download=e,s.click()},ga=e=>{const t=new Date(e);return new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"Asia/Shanghai"}).format(t)},G6=e=>ga(e).split(" ")[0];function Sj(e){const t=new Date;t.setUTCDate(t.getUTCDate()+e);const r=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),o=String(t.getUTCHours()).padStart(2,"0"),i=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${r}-${n}-${s} ${o}:${i}:${a}`}const q6=async e=>{let t=1;e.page&&(t=e.page);let r=2;e.perPage&&(r=e.perPage);const n=st();let s="";return e.state==="enabled"?s="enabled=true":e.state==="disabled"?s="enabled=false":e.state==="expired"&&(s=n.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})),n.collection("domains").getList(t,r,{sort:"-created",expand:"lastDeployment",filter:s})},X6=async()=>{const e=st(),t=await e.collection("domains").getList(1,1,{}),r=await e.collection("domains").getList(1,1,{filter:e.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})}),n=await e.collection("domains").getList(1,1,{filter:"enabled=true"}),s=await e.collection("domains").getList(1,1,{filter:"enabled=false"});return{total:t.totalItems,expired:r.totalItems,enabled:n.totalItems,disabled:s.totalItems}},Q6=async e=>await st().collection("domains").getOne(e),km=async e=>e.id?await st().collection("domains").update(e.id,e):await st().collection("domains").create(e),J6=async e=>await st().collection("domains").delete(e),ez=(e,t)=>st().collection("domains").subscribe(e,r=>{r.action==="update"&&t(r.record)},{expand:"lastDeployment"}),tz=e=>{st().collection("domains").unsubscribe(e)},rz=()=>{const e=qn(),t=Nr(),r=Nn(),n=new URLSearchParams(r.search),s=n.get("page"),o=n.get("state"),[i,a]=v.useState(0),c=()=>{t("/edit")},u=w=>{n.set("page",w.toString()),t(`?${n.toString()}`)},d=w=>{t(`/edit?id=${w}`)},f=w=>{t(`/history?domain=${w}`)},m=async w=>{try{await J6(w),x(y.filter(C=>C.id!==w))}catch(C){console.error("Error deleting domain:",C)}},[y,x]=v.useState([]);v.useEffect(()=>{(async()=>{const C=await q6({page:s?Number(s):1,perPage:10,state:o||""});x(C.items),a(C.totalPages)})()},[s,o]);const g=async w=>{const C=y.filter(P=>P.id===w),j=C[0].enabled,E=C[0];E.enabled=!j,await km(E);const R=y.map(P=>P.id===w?{...P,checked:!j}:P);x(R)},_=async w=>{try{tz(w.id),ez(w.id,C=>{console.log(C);const j=y.map(E=>E.id===C.id?{...C}:E);x(j)}),w.rightnow=!0,await km(w),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:l.jsxs(l.Fragment,{children:["执行失败,请查看",l.jsx(fr,{to:`/history?domain=${w.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}},p=async w=>{await _({...w,deployed:!1})},h=async w=>{const C=`${w.id}-${w.domain}.zip`,j=[{name:`${w.domain}.pem`,content:w.certificate?w.certificate:""},{name:`${w.domain}.key`,content:w.privateKey?w.privateKey:""}];await K6(C,j)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),l.jsx(He,{onClick:c,children:"新增域名"})]}),y.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-36",children:"域名"}),l.jsx("div",{className:"w-40",children:"有效期限"}),l.jsx("div",{className:"w-32",children:"最近执行状态"}),l.jsx("div",{className:"w-64",children:"最近执行阶段"}),l.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),l.jsx("div",{className:"w-24",children:"是否启用"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),y.map(w=>{var C,j,E,R;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-36 w-full pt-1 sm:pt-0 flex items-center",children:w.domain}),l.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx("div",{children:w.expiredAt?l.jsxs(l.Fragment,{children:[l.jsx("div",{children:"有效期90天"}),l.jsxs("div",{children:[G6(w.expiredAt),"到期"]})]}):"---"})}),l.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((C=w.expand)!=null&&C.lastDeployment)?l.jsx(l.Fragment,{children:l.jsx(Gv,{deployment:w.expand.lastDeployment})}):"---"}),l.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((j=w.expand)!=null&&j.lastDeployment)?l.jsx(Hv,{phase:(E=w.expand.lastDeployment)==null?void 0:E.phase,phaseSuccess:(R=w.expand.lastDeployment)==null?void 0:R.phaseSuccess}):"---"}),l.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:w.lastDeployedAt?ga(w.lastDeployedAt):"---"}),l.jsx("div",{className:"sm:w-24 flex items-center",children:l.jsx(Zv,{children:l.jsxs(gC,{children:[l.jsx(vC,{children:l.jsx(Lc,{checked:w.enabled,onCheckedChange:()=>{g(w.id)}})}),l.jsx(Kv,{children:l.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:w.enabled?"禁用":"启用"})})]})})}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(He,{variant:"link",className:"p-0",onClick:()=>f(w.id),children:"部署历史"}),l.jsxs(na,{when:!!w.enabled,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>_(w),children:"立即部署"})]}),l.jsxs(na,{when:!!(w.enabled&&w.deployed),children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>p(w),children:"强行部署"})]}),l.jsxs(na,{when:!!w.expiredAt,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>h(w),children:"下载"})]}),!w.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{children:"删除域名"}),l.jsx(ey,{children:"确定要删除域名吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{children:"取消"}),l.jsx(ty,{onClick:()=>{m(w.id)},children:"确认"})]})]})]}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>d(w.id),children:"编辑"})]})]})]},w.id)}),l.jsx(SC,{totalPages:i,currentPage:s?Number(s):1,onPageChange:w=>{u(w)}})]}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(rm,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(He,{onClick:c,className:"mt-3",children:"添加域名"})]})})]})})},Te=v.forwardRef(({className:e,type:t,...r},n)=>l.jsx("input",{type:t,className:ae("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",e),ref:n,...r}));Te.displayName="Input";var Fc=e=>e.type==="checkbox",$i=e=>e instanceof Date,pr=e=>e==null;const kj=e=>typeof e=="object";var qt=e=>!pr(e)&&!Array.isArray(e)&&kj(e)&&!$i(e),Cj=e=>qt(e)&&e.target?Fc(e.target)?e.target.checked:e.target.value:e,nz=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,jj=(e,t)=>e.has(nz(t)),sz=e=>{const t=e.constructor&&e.constructor.prototype;return qt(t)&&t.hasOwnProperty("isPrototypeOf")},ly=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function br(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ly&&(e instanceof Blob||e instanceof FileList))&&(r||qt(e)))if(t=r?[]:{},!r&&!sz(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=br(e[n]));else return e;return t}var Kf=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,ue=(e,t,r)=>{if(!t||!qt(e))return r;const n=Kf(t.split(/[,[\].]+?/)).reduce((s,o)=>pr(s)?s:s[o],e);return Ft(n)||n===e?Ft(e[t])?r:e[t]:n},Fn=e=>typeof e=="boolean",cy=e=>/^\w*$/.test(e),Ej=e=>Kf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ft=(e,t,r)=>{let n=-1;const s=cy(t)?[t]:Ej(t),o=s.length,i=o-1;for(;++nWe.useContext(Nj),oz=e=>{const{children:t,...r}=e;return We.createElement(Nj.Provider,{value:r},t)};var Tj=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==gn.all&&(t._proxyFormState[i]=!n||gn.all),r&&(r[i]=!0),e[i]}});return s},Or=e=>qt(e)&&!Object.keys(e).length,Rj=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Or(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||gn.all))},kl=e=>Array.isArray(e)?e:[e],Pj=(e,t,r)=>!e||!t||e===t||kl(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n)));function uy(e){const t=We.useRef(e);t.current=e,We.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function iz(e){const t=Gf(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[i,a]=We.useState(r._formState),c=We.useRef(!0),u=We.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=We.useRef(s);return d.current=s,uy({disabled:n,next:f=>c.current&&Pj(d.current,f.name,o)&&Rj(f,u.current,r._updateFormState)&&a({...r._formState,...f}),subject:r._subjects.state}),We.useEffect(()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1}),[r]),Tj(i,r,u.current,!1)}var Un=e=>typeof e=="string",Aj=(e,t,r,n,s)=>Un(e)?(n&&t.watch.add(e),ue(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),ue(r,o))):(n&&(t.watchAll=!0),r);function az(e){const t=Gf(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:i}=e||{},a=We.useRef(n);a.current=n,uy({disabled:o,subject:r._subjects.values,next:d=>{Pj(a.current,d.name,i)&&u(br(Aj(a.current,r._names,d.values||r._formValues,!1,s)))}});const[c,u]=We.useState(r._getWatch(n,s));return We.useEffect(()=>r._removeUnmounted()),c}function lz(e){const t=Gf(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o}=e,i=jj(s._names.array,r),a=az({control:s,name:r,defaultValue:ue(s._formValues,r,ue(s._defaultValues,r,e.defaultValue)),exact:!0}),c=iz({control:s,name:r}),u=We.useRef(s.register(r,{...e.rules,value:a,...Fn(e.disabled)?{disabled:e.disabled}:{}}));return We.useEffect(()=>{const d=s._options.shouldUnregister||o,f=(m,y)=>{const x=ue(s._fields,m);x&&x._f&&(x._f.mount=y)};if(f(r,!0),d){const m=br(ue(s._options.defaultValues,r));ft(s._defaultValues,r,m),Ft(ue(s._formValues,r))&&ft(s._formValues,r,m)}return()=>{(i?d&&!s._state.action:d)?s.unregister(r):f(r,!1)}},[r,s,i,o]),We.useEffect(()=>{ue(s._fields,r)&&s._updateDisabledField({disabled:n,fields:s._fields,name:r,value:ue(s._fields,r)._f.value})},[n,r,s]),{field:{name:r,value:a,...Fn(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:We.useCallback(d=>u.current.onChange({target:{value:Cj(d),name:r},type:Od.CHANGE}),[r]),onBlur:We.useCallback(()=>u.current.onBlur({target:{value:ue(s._formValues,r),name:r},type:Od.BLUR}),[r,s]),ref:d=>{const f=ue(s._fields,r);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:m=>d.setCustomValidity(m),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!ue(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ue(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ue(c.validatingFields,r)},error:{enumerable:!0,get:()=>ue(c.errors,r)}})}}const cz=e=>e.render(lz(e));var Dj=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},aw=e=>({isOnSubmit:!e||e===gn.onSubmit,isOnBlur:e===gn.onBlur,isOnChange:e===gn.onChange,isOnAll:e===gn.all,isOnTouch:e===gn.onTouched}),lw=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Cl=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=ue(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)break;if(i.ref&&t(i.ref,i.name)&&!n)break;Cl(a,t)}else qt(a)&&Cl(a,t)}}};var uz=(e,t,r)=>{const n=kl(ue(e,r));return ft(n,"root",t[r]),ft(e,r,n),e},dy=e=>e.type==="file",eo=e=>typeof e=="function",Md=e=>{if(!ly)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ku=e=>Un(e),fy=e=>e.type==="radio",Id=e=>e instanceof RegExp;const cw={value:!1,isValid:!1},uw={value:!0,isValid:!0};var Oj=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?uw:{value:e[0].value,isValid:!0}:uw:cw}return cw};const dw={isValid:!1,value:null};var Mj=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,dw):dw;function fw(e,t,r="validate"){if(Ku(e)||Array.isArray(e)&&e.every(Ku)||Fn(e)&&!e)return{type:r,message:Ku(e)?e:"",ref:t}}var ki=e=>qt(e)&&!Id(e)?e:{value:e,message:""},hw=async(e,t,r,n,s)=>{const{ref:o,refs:i,required:a,maxLength:c,minLength:u,min:d,max:f,pattern:m,validate:y,name:x,valueAsNumber:g,mount:_,disabled:p}=e._f,h=ue(t,x);if(!_||p)return{};const w=i?i[0]:o,C=N=>{n&&w.reportValidity&&(w.setCustomValidity(Fn(N)?"":N||""),w.reportValidity())},j={},E=fy(o),R=Fc(o),P=E||R,A=(g||dy(o))&&Ft(o.value)&&Ft(h)||Md(o)&&o.value===""||h===""||Array.isArray(h)&&!h.length,L=Dj.bind(null,x,r,j),q=(N,F,b,V=ss.maxLength,te=ss.minLength)=>{const W=N?F:b;j[x]={type:N?V:te,message:W,ref:o,...L(N?V:te,W)}};if(s?!Array.isArray(h)||!h.length:a&&(!P&&(A||pr(h))||Fn(h)&&!h||R&&!Oj(i).isValid||E&&!Mj(i).isValid)){const{value:N,message:F}=Ku(a)?{value:!!a,message:a}:ki(a);if(N&&(j[x]={type:ss.required,message:F,ref:w,...L(ss.required,F)},!r))return C(F),j}if(!A&&(!pr(d)||!pr(f))){let N,F;const b=ki(f),V=ki(d);if(!pr(h)&&!isNaN(h)){const te=o.valueAsNumber||h&&+h;pr(b.value)||(N=te>b.value),pr(V.value)||(F=tenew Date(new Date().toDateString()+" "+Q),Z=o.type=="time",I=o.type=="week";Un(b.value)&&h&&(N=Z?W(h)>W(b.value):I?h>b.value:te>new Date(b.value)),Un(V.value)&&h&&(F=Z?W(h)+N.value,V=!pr(F.value)&&h.length<+F.value;if((b||V)&&(q(b,N.message,F.message),!r))return C(j[x].message),j}if(m&&!A&&Un(h)){const{value:N,message:F}=ki(m);if(Id(N)&&!h.match(N)&&(j[x]={type:ss.pattern,message:F,ref:o,...L(ss.pattern,F)},!r))return C(F),j}if(y){if(eo(y)){const N=await y(h,t),F=fw(N,w);if(F&&(j[x]={...F,...L(ss.validate,F.message)},!r))return C(F.message),j}else if(qt(y)){let N={};for(const F in y){if(!Or(N)&&!r)break;const b=fw(await y[F](h,t),w,F);b&&(N={...b,...L(F,b.message)},C(b.message),r&&(j[x]=N))}if(!Or(N)&&(j[x]={ref:w,...N},!r))return j}}return C(!0),j};function dz(e,t){const r=t.slice(0,-1).length;let n=0;for(;n{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},Ld=e=>pr(e)||!kj(e);function Bo(e,t){if(Ld(e)||Ld(t))return e===t;if($i(e)&&$i(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r){const o=e[s];if(!n.includes(s))return!1;if(s!=="ref"){const i=t[s];if($i(o)&&$i(i)||qt(o)&&qt(i)||Array.isArray(o)&&Array.isArray(i)?!Bo(o,i):o!==i)return!1}}return!0}var Ij=e=>e.type==="select-multiple",hz=e=>fy(e)||Fc(e),np=e=>Md(e)&&e.isConnected,Lj=e=>{for(const t in e)if(eo(e[t]))return!0;return!1};function Fd(e,t={}){const r=Array.isArray(e);if(qt(e)||r)for(const n in e)Array.isArray(e[n])||qt(e[n])&&!Lj(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Fd(e[n],t[n])):pr(e[n])||(t[n]=!0);return t}function Fj(e,t,r){const n=Array.isArray(e);if(qt(e)||n)for(const s in e)Array.isArray(e[s])||qt(e[s])&&!Lj(e[s])?Ft(t)||Ld(r[s])?r[s]=Array.isArray(e[s])?Fd(e[s],[]):{...Fd(e[s])}:Fj(e[s],pr(t)?{}:t[s],r[s]):r[s]=!Bo(e[s],t[s]);return r}var Cu=(e,t)=>Fj(e,t,Fd(t)),zj=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ft(e)?e:t?e===""?NaN:e&&+e:r&&Un(e)?new Date(e):n?n(e):e;function sp(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return dy(t)?t.files:fy(t)?Mj(e.refs).value:Ij(t)?[...t.selectedOptions].map(({value:r})=>r):Fc(t)?Oj(e.refs).value:zj(Ft(t.value)?e.ref.value:t.value,e)}var pz=(e,t,r,n)=>{const s={};for(const o of e){const i=ue(t,o);i&&ft(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ja=e=>Ft(e)?e:Id(e)?e.source:qt(e)?Id(e.value)?e.value.source:e.value:e,mz=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function pw(e,t,r){const n=ue(e,r);if(n||cy(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=ue(t,o),a=ue(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:r}}var gz=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,vz=(e,t)=>!Kf(ue(e,t)).length&&Yt(e,t);const yz={mode:gn.onSubmit,reValidateMode:gn.onChange,shouldFocusError:!0};function xz(e={}){let t={...yz,...e},r={submitCount:0,isDirty:!1,isLoading:eo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=qt(t.defaultValues)||qt(t.values)?br(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:br(s),i={action:!1,mount:!1,watch:!1},a={mount: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},f={values:rp(),array:rp(),state:rp()},m=aw(t.mode),y=aw(t.reValidateMode),x=t.criteriaMode===gn.all,g=S=>T=>{clearTimeout(u),u=setTimeout(S,T)},_=async S=>{if(d.isValid||S){const T=t.resolver?Or((await P()).errors):await L(n,!0);T!==r.isValid&&f.state.next({isValid:T})}},p=(S,T)=>{(d.isValidating||d.validatingFields)&&((S||Array.from(a.mount)).forEach(O=>{O&&(T?ft(r.validatingFields,O,T):Yt(r.validatingFields,O))}),f.state.next({validatingFields:r.validatingFields,isValidating:!Or(r.validatingFields)}))},h=(S,T=[],O,Y,M=!0,H=!0)=>{if(Y&&O){if(i.action=!0,H&&Array.isArray(ue(n,S))){const X=O(ue(n,S),Y.argA,Y.argB);M&&ft(n,S,X)}if(H&&Array.isArray(ue(r.errors,S))){const X=O(ue(r.errors,S),Y.argA,Y.argB);M&&ft(r.errors,S,X),vz(r.errors,S)}if(d.touchedFields&&H&&Array.isArray(ue(r.touchedFields,S))){const X=O(ue(r.touchedFields,S),Y.argA,Y.argB);M&&ft(r.touchedFields,S,X)}d.dirtyFields&&(r.dirtyFields=Cu(s,o)),f.state.next({name:S,isDirty:N(S,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ft(o,S,T)},w=(S,T)=>{ft(r.errors,S,T),f.state.next({errors:r.errors})},C=S=>{r.errors=S,f.state.next({errors:r.errors,isValid:!1})},j=(S,T,O,Y)=>{const M=ue(n,S);if(M){const H=ue(o,S,Ft(O)?ue(s,S):O);Ft(H)||Y&&Y.defaultChecked||T?ft(o,S,T?H:sp(M._f)):V(S,H),i.mount&&_()}},E=(S,T,O,Y,M)=>{let H=!1,X=!1;const ee={name:S},me=!!(ue(n,S)&&ue(n,S)._f&&ue(n,S)._f.disabled);if(!O||Y){d.isDirty&&(X=r.isDirty,r.isDirty=ee.isDirty=N(),H=X!==ee.isDirty);const Ye=me||Bo(ue(s,S),T);X=!!(!me&&ue(r.dirtyFields,S)),Ye||me?Yt(r.dirtyFields,S):ft(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,H=H||d.dirtyFields&&X!==!Ye}if(O){const Ye=ue(r.touchedFields,S);Ye||(ft(r.touchedFields,S,O),ee.touchedFields=r.touchedFields,H=H||d.touchedFields&&Ye!==O)}return H&&M&&f.state.next(ee),H?ee:{}},R=(S,T,O,Y)=>{const M=ue(r.errors,S),H=d.isValid&&Fn(T)&&r.isValid!==T;if(e.delayError&&O?(c=g(()=>w(S,O)),c(e.delayError)):(clearTimeout(u),c=null,O?ft(r.errors,S,O):Yt(r.errors,S)),(O?!Bo(M,O):M)||!Or(Y)||H){const X={...Y,...H&&Fn(T)?{isValid:T}:{},errors:r.errors,name:S};r={...r,...X},f.state.next(X)}},P=async S=>{p(S,!0);const T=await t.resolver(o,t.context,pz(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return p(S),T},A=async S=>{const{errors:T}=await P(S);if(S)for(const O of S){const Y=ue(T,O);Y?ft(r.errors,O,Y):Yt(r.errors,O)}else r.errors=T;return T},L=async(S,T,O={valid:!0})=>{for(const Y in S){const M=S[Y];if(M){const{_f:H,...X}=M;if(H){const ee=a.array.has(H.name);p([Y],!0);const me=await hw(M,o,x,t.shouldUseNativeValidation&&!T,ee);if(p([Y]),me[H.name]&&(O.valid=!1,T))break;!T&&(ue(me,H.name)?ee?uz(r.errors,me,H.name):ft(r.errors,H.name,me[H.name]):Yt(r.errors,H.name))}X&&await L(X,T,O)}}return O.valid},q=()=>{for(const S of a.unMount){const T=ue(n,S);T&&(T._f.refs?T._f.refs.every(O=>!np(O)):!np(T._f.ref))&&Oe(S)}a.unMount=new Set},N=(S,T)=>(S&&T&&ft(o,S,T),!Bo(z(),s)),F=(S,T,O)=>Aj(S,a,{...i.mount?o:Ft(T)?s:Un(S)?{[S]:T}:T},O,T),b=S=>Kf(ue(i.mount?o:s,S,e.shouldUnregister?ue(s,S,[]):[])),V=(S,T,O={})=>{const Y=ue(n,S);let M=T;if(Y){const H=Y._f;H&&(!H.disabled&&ft(o,S,zj(T,H)),M=Md(H.ref)&&pr(T)?"":T,Ij(H.ref)?[...H.ref.options].forEach(X=>X.selected=M.includes(X.value)):H.refs?Fc(H.ref)?H.refs.length>1?H.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(M)?!!M.find(ee=>ee===X.value):M===X.value)):H.refs[0]&&(H.refs[0].checked=!!M):H.refs.forEach(X=>X.checked=X.value===M):dy(H.ref)?H.ref.value="":(H.ref.value=M,H.ref.type||f.values.next({name:S,values:{...o}})))}(O.shouldDirty||O.shouldTouch)&&E(S,M,O.shouldTouch,O.shouldDirty,!0),O.shouldValidate&&Q(S)},te=(S,T,O)=>{for(const Y in T){const M=T[Y],H=`${S}.${Y}`,X=ue(n,H);(a.array.has(S)||!Ld(M)||X&&!X._f)&&!$i(M)?te(H,M,O):V(H,M,O)}},W=(S,T,O={})=>{const Y=ue(n,S),M=a.array.has(S),H=br(T);ft(o,S,H),M?(f.array.next({name:S,values:{...o}}),(d.isDirty||d.dirtyFields)&&O.shouldDirty&&f.state.next({name:S,dirtyFields:Cu(s,o),isDirty:N(S,H)})):Y&&!Y._f&&!pr(H)?te(S,H,O):V(S,H,O),lw(S,a)&&f.state.next({...r}),f.values.next({name:i.mount?S:void 0,values:{...o}})},Z=async S=>{i.mount=!0;const T=S.target;let O=T.name,Y=!0;const M=ue(n,O),H=()=>T.type?sp(M._f):Cj(S),X=ee=>{Y=Number.isNaN(ee)||ee===ue(o,O,ee)};if(M){let ee,me;const Ye=H(),Ue=S.type===Od.BLUR||S.type===Od.FOCUS_OUT,jt=!mz(M._f)&&!t.resolver&&!ue(r.errors,O)&&!M._f.deps||gz(Ue,ue(r.touchedFields,O),r.isSubmitted,y,m),Gr=lw(O,a,Ue);ft(o,O,Ye),Ue?(M._f.onBlur&&M._f.onBlur(S),c&&c(0)):M._f.onChange&&M._f.onChange(S);const Ht=E(O,Ye,Ue,!1),Qn=!Or(Ht)||Gr;if(!Ue&&f.values.next({name:O,type:S.type,values:{...o}}),jt)return d.isValid&&_(),Qn&&f.state.next({name:O,...Gr?{}:Ht});if(!Ue&&Gr&&f.state.next({...r}),t.resolver){const{errors:at}=await P([O]);if(X(Ye),Y){const Jn=pw(r.errors,n,O),es=pw(at,n,Jn.name||O);ee=es.error,O=es.name,me=Or(at)}}else p([O],!0),ee=(await hw(M,o,x,t.shouldUseNativeValidation))[O],p([O]),X(Ye),Y&&(ee?me=!1:d.isValid&&(me=await L(n,!0)));Y&&(M._f.deps&&Q(M._f.deps),R(O,me,ee,Ht))}},I=(S,T)=>{if(ue(r.errors,T)&&S.focus)return S.focus(),1},Q=async(S,T={})=>{let O,Y;const M=kl(S);if(t.resolver){const H=await A(Ft(S)?S:M);O=Or(H),Y=S?!M.some(X=>ue(H,X)):O}else S?(Y=(await Promise.all(M.map(async H=>{const X=ue(n,H);return await L(X&&X._f?{[H]:X}:X)}))).every(Boolean),!(!Y&&!r.isValid)&&_()):Y=O=await L(n);return f.state.next({...!Un(S)||d.isValid&&O!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:O}:{},errors:r.errors}),T.shouldFocus&&!Y&&Cl(n,I,S?M:a.mount),Y},z=S=>{const T={...i.mount?o:s};return Ft(S)?T:Un(S)?ue(T,S):S.map(O=>ue(T,O))},$=(S,T)=>({invalid:!!ue((T||r).errors,S),isDirty:!!ue((T||r).dirtyFields,S),error:ue((T||r).errors,S),isValidating:!!ue(r.validatingFields,S),isTouched:!!ue((T||r).touchedFields,S)}),fe=S=>{S&&kl(S).forEach(T=>Yt(r.errors,T)),f.state.next({errors:S?r.errors:{}})},ne=(S,T,O)=>{const Y=(ue(n,S,{_f:{}})._f||{}).ref,M=ue(r.errors,S)||{},{ref:H,message:X,type:ee,...me}=M;ft(r.errors,S,{...me,...T,ref:Y}),f.state.next({name:S,errors:r.errors,isValid:!1}),O&&O.shouldFocus&&Y&&Y.focus&&Y.focus()},se=(S,T)=>eo(S)?f.values.subscribe({next:O=>S(F(void 0,T),O)}):F(S,T,!0),Oe=(S,T={})=>{for(const O of S?kl(S):a.mount)a.mount.delete(O),a.array.delete(O),T.keepValue||(Yt(n,O),Yt(o,O)),!T.keepError&&Yt(r.errors,O),!T.keepDirty&&Yt(r.dirtyFields,O),!T.keepTouched&&Yt(r.touchedFields,O),!T.keepIsValidating&&Yt(r.validatingFields,O),!t.shouldUnregister&&!T.keepDefaultValue&&Yt(s,O);f.values.next({values:{...o}}),f.state.next({...r,...T.keepDirty?{isDirty:N()}:{}}),!T.keepIsValid&&_()},he=({disabled:S,name:T,field:O,fields:Y,value:M})=>{if(Fn(S)&&i.mount||S){const H=S?void 0:Ft(M)?sp(O?O._f:ue(Y,T)._f):M;ft(o,T,H),E(T,H,!1,!1,!0)}},ye=(S,T={})=>{let O=ue(n,S);const Y=Fn(T.disabled);return ft(n,S,{...O||{},_f:{...O&&O._f?O._f:{ref:{name:S}},name:S,mount:!0,...T}}),a.mount.add(S),O?he({field:O,disabled:T.disabled,name:S,value:T.value}):j(S,!0,T.value),{...Y?{disabled:T.disabled}:{},...t.progressive?{required:!!T.required,min:Ja(T.min),max:Ja(T.max),minLength:Ja(T.minLength),maxLength:Ja(T.maxLength),pattern:Ja(T.pattern)}:{},name:S,onChange:Z,onBlur:Z,ref:M=>{if(M){ye(S,T),O=ue(n,S);const H=Ft(M.value)&&M.querySelectorAll&&M.querySelectorAll("input,select,textarea")[0]||M,X=hz(H),ee=O._f.refs||[];if(X?ee.find(me=>me===H):H===O._f.ref)return;ft(n,S,{_f:{...O._f,...X?{refs:[...ee.filter(np),H,...Array.isArray(ue(s,S))?[{}]:[]],ref:{type:H.type,name:S}}:{ref:H}}}),j(S,!1,void 0,H)}else O=ue(n,S,{}),O._f&&(O._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(jj(a.array,S)&&i.action)&&a.unMount.add(S)}}},ke=()=>t.shouldFocusError&&Cl(n,I,a.mount),Fe=S=>{Fn(S)&&(f.state.next({disabled:S}),Cl(n,(T,O)=>{const Y=ue(n,O);Y&&(T.disabled=Y._f.disabled||S,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(M=>{M.disabled=Y._f.disabled||S}))},0,!1))},Me=(S,T)=>async O=>{let Y;O&&(O.preventDefault&&O.preventDefault(),O.persist&&O.persist());let M=br(o);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:H,values:X}=await P();r.errors=H,M=X}else await L(n);if(Yt(r.errors,"root"),Or(r.errors)){f.state.next({errors:{}});try{await S(M,O)}catch(H){Y=H}}else T&&await T({...r.errors},O),ke(),setTimeout(ke);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Or(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},Pe=(S,T={})=>{ue(n,S)&&(Ft(T.defaultValue)?W(S,br(ue(s,S))):(W(S,T.defaultValue),ft(s,S,br(T.defaultValue))),T.keepTouched||Yt(r.touchedFields,S),T.keepDirty||(Yt(r.dirtyFields,S),r.isDirty=T.defaultValue?N(S,br(ue(s,S))):N()),T.keepError||(Yt(r.errors,S),d.isValid&&_()),f.state.next({...r}))},nt=(S,T={})=>{const O=S?br(S):s,Y=br(O),M=Or(S),H=M?s:Y;if(T.keepDefaultValues||(s=O),!T.keepValues){if(T.keepDirtyValues)for(const X of a.mount)ue(r.dirtyFields,X)?ft(H,X,ue(o,X)):W(X,ue(H,X));else{if(ly&&Ft(S))for(const X of a.mount){const ee=ue(n,X);if(ee&&ee._f){const me=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Md(me)){const Ye=me.closest("form");if(Ye){Ye.reset();break}}}}n={}}o=e.shouldUnregister?T.keepDefaultValues?br(s):{}:br(H),f.array.next({values:{...H}}),f.values.next({values:{...H}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!T.keepIsValid||!!T.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:M?!1:T.keepDirty?r.isDirty:!!(T.keepDefaultValues&&!Bo(S,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:T.keepDirtyValues?T.keepDefaultValues&&o?Cu(s,o):r.dirtyFields:T.keepDefaultValues&&S?Cu(s,S):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},k=(S,T)=>nt(eo(S)?S(o):S,T);return{control:{register:ye,unregister:Oe,getFieldState:$,handleSubmit:Me,setError:ne,_executeSchema:P,_getWatch:F,_getDirty:N,_updateValid:_,_removeUnmounted:q,_updateFieldArray:h,_updateDisabledField:he,_getFieldArray:b,_reset:nt,_resetDefaultValues:()=>eo(t.defaultValues)&&t.defaultValues().then(S=>{k(S,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:S=>{r={...r,...S}},_disableForm:Fe,_subjects:f,_proxyFormState:d,_setErrors:C,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(S){i=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},set _formState(S){r=S},get _options(){return t},set _options(S){t={...t,...S}}},trigger:Q,register:ye,handleSubmit:Me,watch:se,setValue:W,getValues:z,reset:k,resetField:Pe,clearErrors:fe,unregister:Oe,setError:ne,setFocus:(S,T={})=>{const O=ue(n,S),Y=O&&O._f;if(Y){const M=Y.refs?Y.refs[0]:Y.ref;M.focus&&(M.focus(),T.shouldSelect&&M.select())}},getFieldState:$}}function Tr(e={}){const t=We.useRef(),r=We.useRef(),[n,s]=We.useState({isDirty:!1,isValidating:!1,isLoading:eo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:eo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...xz(e),formState:n});const o=t.current.control;return o._options=e,uy({subject:o._subjects.state,next:i=>{Rj(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),We.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),We.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),We.useEffect(()=>{e.values&&!Bo(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),We.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),We.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),We.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=Tj(n,o),t.current}const mw=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ue(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Uj=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?mw(n.ref,r,e):n.refs&&n.refs.forEach(s=>mw(s,r,e))}},wz=(e,t)=>{t.shouldUseNativeValidation&&Uj(e,t);const r={};for(const n in e){const s=ue(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(_z(t.names||Object.keys(e),n)){const i=Object.assign({},ue(r,n));ft(i,"root",o),ft(r,n,i)}else ft(r,n,o)}return r},_z=(e,t)=>e.some(r=>r.startsWith(t+"."));var bz=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=Dj(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r},Rr=function(e,t,r){return r===void 0&&(r={}),function(n,s,o){try{return Promise.resolve(function(i,a){try{var c=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(u){return o.shouldUseNativeValidation&&Uj({},o),{errors:{},values:r.raw?n:u}})}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:wz(bz(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},ot;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ot||(ot={}));var Cm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cm||(Cm={}));const we=ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=e=>{switch(typeof e){case"undefined":return we.undefined;case"string":return we.string;case"number":return isNaN(e)?we.nan:we.number;case"boolean":return we.boolean;case"function":return we.function;case"bigint":return we.bigint;case"symbol":return we.symbol;case"object":return Array.isArray(e)?we.array:e===null?we.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?we.promise:typeof Map<"u"&&e instanceof Map?we.map:typeof Set<"u"&&e instanceof Set?we.set:typeof Date<"u"&&e instanceof Date?we.date:we.object;default:return we.unknown}},ie=ot.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"]),Sz=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Wr extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;cr.message){const r={},n=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Wr.create=e=>new Wr(e);const va=(e,t)=>{let r;switch(e.code){case ie.invalid_type:e.received===we.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ot.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${ot.joinValues(e.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ot.joinValues(e.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${ot.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ot.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ie.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case ie.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=t.defaultError,ot.assertNever(e)}return{message:r}};let $j=va;function kz(e){$j=e}function zd(){return $j}const Ud=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},Cz=[];function ge(e,t){const r=zd(),n=Ud({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===va?void 0:va].filter(s=>!!s)});e.common.issues.push(n)}class cr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return Be;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,i=await s.value;n.push({key:o,value:i})}return cr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Be;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:t.value,value:n}}}const Be=Object.freeze({status:"aborted"}),Vi=e=>({status:"dirty",value:e}),gr=e=>({status:"valid",value:e}),jm=e=>e.status==="aborted",Em=e=>e.status==="dirty",tc=e=>e.status==="valid",rc=e=>typeof Promise<"u"&&e instanceof Promise;function $d(e,t,r,n){if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Vj(e,t,r,n,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,r),r}var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));var il,al;class Yn{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,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 gw=(e,t)=>{if(tc(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 r=new Wr(e.common.issues);return this._error=r,this._error}}};function Ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))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:(i,a)=>{var c,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(c=d??n)!==null&&c!==void 0?c:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??r)!==null&&u!==void 0?u:a.defaultError}},description:s}}class Je{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)}get description(){return this._def.description}_getType(t){return Zs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new cr,ctx:{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(rc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;const s={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},o=this._parseSync({data:t,path:s.path,parent:s});return gw(s,o)}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(rc(s)?s:Promise.resolve(s));return gw(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ie.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new En({schema:this,typeName:$e.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Wn.create(this,this._def)}nullable(){return wo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _n.create(this,this._def)}promise(){return xa.create(this,this._def)}or(t){return ic.create([this,t],this._def)}and(t){return ac.create(this,t,this._def)}transform(t){return new En({...Ze(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new fc({...Ze(this._def),innerType:this,defaultValue:r,typeName:$e.ZodDefault})}brand(){return new hy({typeName:$e.ZodBranded,type:this,...Ze(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new hc({...Ze(this._def),innerType:this,catchValue:r,typeName:$e.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return zc.create(this,t)}readonly(){return pc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const jz=/^c[^\s-]{8,}$/i,Ez=/^[0-9a-z]+$/,Nz=/^[0-9A-HJKMNP-TV-Z]{26}$/,Tz=/^[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,Rz=/^[a-z0-9_-]{21}$/i,Pz=/^[-+]?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)?)??$/,Az=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Dz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let op;const Oz=/^(?:(?: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])$/,Mz=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Iz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wj="((\\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])))",Lz=new RegExp(`^${Wj}$`);function Bj(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 Fz(e){return new RegExp(`^${Bj(e)}$`)}function Hj(e){let t=`${Wj}T${Bj(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function zz(e,t){return!!((t==="v4"||!t)&&Oz.test(e)||(t==="v6"||!t)&&Mz.test(e))}class yn extends Je{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==we.string){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.string,received:o.parsedType}),Be}const n=new cr;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.lengtht.test(s),{validation:r,code:ie.invalid_string,...De.errToObj(n)})}_addCheck(t){return new yn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}datetime(t){var r,n;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:(r=t==null?void 0:t.offset)!==null&&r!==void 0?r:!1,local:(n=t==null?void 0:t.local)!==null&&n!==void 0?n:!1,...De.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,...De.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...De.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...De.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...De.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...De.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...De.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...De.errToObj(r)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new yn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yn({...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 isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yn({checks:[],typeName:$e.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};function Uz(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class vo extends Je{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)!==we.number){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.number,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="int"?ot.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?Uz(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_finite,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new vo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new vo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuet.kind==="int"||t.kind==="multipleOf"&&ot.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.valuenew vo({checks:[],typeName:$e.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class yo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==we.bigint){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.bigint,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new yo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new yo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yo({checks:[],typeName:$e.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};class nc extends Je{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==we.boolean){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.boolean,received:n.parsedType}),Be}return gr(t.data)}}nc.create=e=>new nc({typeName:$e.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class si extends Je{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==we.date){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.date,received:o.parsedType}),Be}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_date}),Be}const n=new cr;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ot.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new si({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew si({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:$e.ZodDate,...Ze(e)});class Vd extends Je{_parse(t){if(this._getType(t)!==we.symbol){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.symbol,received:n.parsedType}),Be}return gr(t.data)}}Vd.create=e=>new Vd({typeName:$e.ZodSymbol,...Ze(e)});class sc extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.undefined,received:n.parsedType}),Be}return gr(t.data)}}sc.create=e=>new sc({typeName:$e.ZodUndefined,...Ze(e)});class oc extends Je{_parse(t){if(this._getType(t)!==we.null){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.null,received:n.parsedType}),Be}return gr(t.data)}}oc.create=e=>new oc({typeName:$e.ZodNull,...Ze(e)});class ya extends Je{constructor(){super(...arguments),this._any=!0}_parse(t){return gr(t.data)}}ya.create=e=>new ya({typeName:$e.ZodAny,...Ze(e)});class Ko extends Je{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gr(t.data)}}Ko.create=e=>new Ko({typeName:$e.ZodUnknown,...Ze(e)});class js extends Je{_parse(t){const r=this._getOrReturnCtx(t);return ge(r,{code:ie.invalid_type,expected:we.never,received:r.parsedType}),Be}}js.create=e=>new js({typeName:$e.ZodNever,...Ze(e)});class Wd extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.void,received:n.parsedType}),Be}return gr(t.data)}}Wd.create=e=>new Wd({typeName:$e.ZodVoid,...Ze(e)});class _n extends Je{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==we.array)return ge(r,{code:ie.invalid_type,expected:we.array,received:r.parsedType}),Be;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.lengths.maxLength.value&&(ge(r,{code:ie.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Yn(r,i,r.path,a)))).then(i=>cr.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new Yn(r,i,r.path,a)));return cr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new _n({...this._def,minLength:{value:t,message:De.toString(r)}})}max(t,r){return new _n({...this._def,maxLength:{value:t,message:De.toString(r)}})}length(t,r){return new _n({...this._def,exactLength:{value:t,message:De.toString(r)}})}nonempty(t){return this.min(1,t)}}_n.create=(e,t)=>new _n({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...Ze(t)});function ji(e){if(e instanceof Rt){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Wn.create(ji(n))}return new Rt({...e._def,shape:()=>t})}else return e instanceof _n?new _n({...e._def,type:ji(e.element)}):e instanceof Wn?Wn.create(ji(e.unwrap())):e instanceof wo?wo.create(ji(e.unwrap())):e instanceof Zn?Zn.create(e.items.map(t=>ji(t))):e}class Rt extends Je{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(),r=ot.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==we.object){const u=this._getOrReturnCtx(t);return ge(u,{code:ie.invalid_type,expected:we.object,received:u.parsedType}),Be}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof js&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=o[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Yn(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof js){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")a.length>0&&(ge(s,{code:ie.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Yn(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,m=await d.value;u.push({key:f,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>cr.mergeObjectSync(n,u)):cr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,i,a;const c=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=De.errToObj(t).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$e.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const r={};return ot.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}omit(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}deepPartial(){return ji(this)}partial(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}),new Rt({...this._def,shape:()=>r})}required(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Wn;)o=o._def.innerType;r[n]=o}}),new Rt({...this._def,shape:()=>r})}keyof(){return Yj(ot.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});class ic extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Wr(a.ctx.common.issues));return ge(r,{code:ie.invalid_union,unionErrors:i}),Be}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new Wr(c));return ge(r,{code:ie.invalid_union,unionErrors:a}),Be}}get options(){return this._def.options}}ic.create=(e,t)=>new ic({options:e,typeName:$e.ZodUnion,...Ze(t)});const os=e=>e instanceof cc?os(e.schema):e instanceof En?os(e.innerType()):e instanceof uc?[e.value]:e instanceof xo?e.options:e instanceof dc?ot.objectValues(e.enum):e instanceof fc?os(e._def.innerType):e instanceof sc?[void 0]:e instanceof oc?[null]:e instanceof Wn?[void 0,...os(e.unwrap())]:e instanceof wo?[null,...os(e.unwrap())]:e instanceof hy||e instanceof pc?os(e.unwrap()):e instanceof hc?os(e._def.innerType):[];class qf extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.object)return ge(r,{code:ie.invalid_type,expected:we.object,received:r.parsedType}),Be;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(ge(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const i=os(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new qf({typeName:$e.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...Ze(n)})}}function Nm(e,t){const r=Zs(e),n=Zs(t);if(e===t)return{valid:!0,data:e};if(r===we.object&&n===we.object){const s=ot.objectKeys(t),o=ot.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=Nm(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===we.array&&n===we.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o{if(jm(o)||jm(i))return Be;const a=Nm(o.value,i.value);return a.valid?((Em(o)||Em(i))&&r.dirty(),{status:r.value,value:a.data}):(ge(n,{code:ie.invalid_intersection_types}),Be)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ac.create=(e,t,r)=>new ac({left:e,right:t,typeName:$e.ZodIntersection,...Ze(r)});class Zn extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.array)return ge(n,{code:ie.invalid_type,expected:we.array,received:n.parsedType}),Be;if(n.data.lengththis._def.items.length&&(ge(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Yn(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>cr.mergeArray(r,i)):cr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new Zn({...this._def,rest:t})}}Zn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:e,typeName:$e.ZodTuple,rest:null,...Ze(t)})};class lc extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.object)return ge(n,{code:ie.invalid_type,expected:we.object,received:n.parsedType}),Be;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new Yn(n,a,n.path,a)),value:i._parse(new Yn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?cr.mergeObjectAsync(r,s):cr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Je?new lc({keyType:t,valueType:r,typeName:$e.ZodRecord,...Ze(n)}):new lc({keyType:yn.create(),valueType:t,typeName:$e.ZodRecord,...Ze(r)})}}class Bd extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.map)return ge(n,{code:ie.invalid_type,expected:we.map,received:n.parsedType}),Be;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new Yn(n,a,n.path,[u,"key"])),value:o._parse(new Yn(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}}Bd.create=(e,t,r)=>new Bd({valueType:t,keyType:e,typeName:$e.ZodMap,...Ze(r)});class oi extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.set)return ge(n,{code:ie.invalid_type,expected:we.set,received:n.parsedType}),Be;const s=this._def;s.minSize!==null&&n.data.sizes.maxSize.value&&(ge(n,{code:ie.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Be;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const a=[...n.data.values()].map((c,u)=>o._parse(new Yn(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,r){return new oi({...this._def,minSize:{value:t,message:De.toString(r)}})}max(t,r){return new oi({...this._def,maxSize:{value:t,message:De.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}oi.create=(e,t)=>new oi({valueType:e,minSize:null,maxSize:null,typeName:$e.ZodSet,...Ze(t)});class oa extends Je{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.function)return ge(r,{code:ie.invalid_type,expected:we.function,received:r.parsedType}),Be;function n(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:c}})}function s(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:c}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof xa){const a=this;return gr(async function(...c){const u=new Wr([]),d=await a._def.args.parseAsync(c,o).catch(y=>{throw u.addIssue(n(c,y)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(y=>{throw u.addIssue(s(f,y)),u})})}else{const a=this;return gr(function(...c){const u=a._def.args.safeParse(c,o);if(!u.success)throw new Wr([n(c,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new Wr([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new oa({...this._def,args:Zn.create(t).rest(Ko.create())})}returns(t){return new oa({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new oa({args:t||Zn.create([]).rest(Ko.create()),returns:r||Ko.create(),typeName:$e.ZodFunction,...Ze(n)})}}class cc extends Je{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}cc.create=(e,t)=>new cc({getter:e,typeName:$e.ZodLazy,...Ze(t)});class uc extends Je{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return ge(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Be}return{status:"valid",value:t.data}}get value(){return this._def.value}}uc.create=(e,t)=>new uc({value:e,typeName:$e.ZodLiteral,...Ze(t)});function Yj(e,t){return new xo({values:e,typeName:$e.ZodEnum,...Ze(t)})}class xo extends Je{constructor(){super(...arguments),il.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{expected:ot.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Be}if($d(this,il)||Vj(this,il,new Set(this._def.values)),!$d(this,il).has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Be}return gr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return xo.create(t,{...this._def,...r})}exclude(t,r=this._def){return xo.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}il=new WeakMap;xo.create=Yj;class dc extends Je{constructor(){super(...arguments),al.set(this,void 0)}_parse(t){const r=ot.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==we.string&&n.parsedType!==we.number){const s=ot.objectValues(r);return ge(n,{expected:ot.joinValues(s),received:n.parsedType,code:ie.invalid_type}),Be}if($d(this,al)||Vj(this,al,new Set(ot.getValidEnumValues(this._def.values))),!$d(this,al).has(t.data)){const s=ot.objectValues(r);return ge(n,{received:n.data,code:ie.invalid_enum_value,options:s}),Be}return gr(t.data)}get enum(){return this._def.values}}al=new WeakMap;dc.create=(e,t)=>new dc({values:e,typeName:$e.ZodNativeEnum,...Ze(t)});class xa extends Je{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.promise&&r.common.async===!1)return ge(r,{code:ie.invalid_type,expected:we.promise,received:r.parsedType}),Be;const n=r.parsedType===we.promise?r.data:Promise.resolve(r.data);return gr(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}xa.create=(e,t)=>new xa({type:e,typeName:$e.ZodPromise,...Ze(t)});class En extends Je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{ge(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Be;const c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Be:c.status==="dirty"||r.value==="dirty"?Vi(c.value):c});{if(r.value==="aborted")return Be;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Be:a.status==="dirty"||r.value==="dirty"?Vi(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!tc(i))return i;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>tc(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):i);ot.assertNever(s)}}En.create=(e,t,r)=>new En({schema:e,typeName:$e.ZodEffects,effect:t,...Ze(r)});En.createWithPreprocess=(e,t,r)=>new En({schema:t,effect:{type:"preprocess",transform:e},typeName:$e.ZodEffects,...Ze(r)});class Wn extends Je{_parse(t){return this._getType(t)===we.undefined?gr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Wn.create=(e,t)=>new Wn({innerType:e,typeName:$e.ZodOptional,...Ze(t)});class wo extends Je{_parse(t){return this._getType(t)===we.null?gr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wo.create=(e,t)=>new wo({innerType:e,typeName:$e.ZodNullable,...Ze(t)});class fc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===we.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}fc.create=(e,t)=>new fc({innerType:e,typeName:$e.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ze(t)});class hc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rc(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}hc.create=(e,t)=>new hc({innerType:e,typeName:$e.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ze(t)});class Hd extends Je{_parse(t){if(this._getType(t)!==we.nan){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.nan,received:n.parsedType}),Be}return{status:"valid",value:t.data}}}Hd.create=e=>new Hd({typeName:$e.ZodNaN,...Ze(e)});const $z=Symbol("zod_brand");class hy extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class zc extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Be:o.status==="dirty"?(r.dirty(),Vi(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Be:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new zc({in:t,out:r,typeName:$e.ZodPipeline})}}class pc extends Je{_parse(t){const r=this._def.innerType._parse(t),n=s=>(tc(s)&&(s.value=Object.freeze(s.value)),s);return rc(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>new pc({innerType:e,typeName:$e.ZodReadonly,...Ze(t)});function Zj(e,t={},r){return e?ya.create().superRefine((n,s)=>{var o,i;if(!e(n)){const a=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,c=(i=(o=a.fatal)!==null&&o!==void 0?o:r)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...u,fatal:c})}}):ya.create()}const Vz={object:Rt.lazycreate};var $e;(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"})($e||($e={}));const Wz=(e,t={message:`Input not instance of ${e.name}`})=>Zj(r=>r instanceof e,t),Kj=yn.create,Gj=vo.create,Bz=Hd.create,Hz=yo.create,qj=nc.create,Yz=si.create,Zz=Vd.create,Kz=sc.create,Gz=oc.create,qz=ya.create,Xz=Ko.create,Qz=js.create,Jz=Wd.create,e8=_n.create,t8=Rt.create,r8=Rt.strictCreate,n8=ic.create,s8=qf.create,o8=ac.create,i8=Zn.create,a8=lc.create,l8=Bd.create,c8=oi.create,u8=oa.create,d8=cc.create,f8=uc.create,h8=xo.create,p8=dc.create,m8=xa.create,vw=En.create,g8=Wn.create,v8=wo.create,y8=En.createWithPreprocess,x8=zc.create,w8=()=>Kj().optional(),_8=()=>Gj().optional(),b8=()=>qj().optional(),S8={string:e=>yn.create({...e,coerce:!0}),number:e=>vo.create({...e,coerce:!0}),boolean:e=>nc.create({...e,coerce:!0}),bigint:e=>yo.create({...e,coerce:!0}),date:e=>si.create({...e,coerce:!0})},k8=Be;var pe=Object.freeze({__proto__:null,defaultErrorMap:va,setErrorMap:kz,getErrorMap:zd,makeIssue:Ud,EMPTY_PATH:Cz,addIssueToContext:ge,ParseStatus:cr,INVALID:Be,DIRTY:Vi,OK:gr,isAborted:jm,isDirty:Em,isValid:tc,isAsync:rc,get util(){return ot},get objectUtil(){return Cm},ZodParsedType:we,getParsedType:Zs,ZodType:Je,datetimeRegex:Hj,ZodString:yn,ZodNumber:vo,ZodBigInt:yo,ZodBoolean:nc,ZodDate:si,ZodSymbol:Vd,ZodUndefined:sc,ZodNull:oc,ZodAny:ya,ZodUnknown:Ko,ZodNever:js,ZodVoid:Wd,ZodArray:_n,ZodObject:Rt,ZodUnion:ic,ZodDiscriminatedUnion:qf,ZodIntersection:ac,ZodTuple:Zn,ZodRecord:lc,ZodMap:Bd,ZodSet:oi,ZodFunction:oa,ZodLazy:cc,ZodLiteral:uc,ZodEnum:xo,ZodNativeEnum:dc,ZodPromise:xa,ZodEffects:En,ZodTransformer:En,ZodOptional:Wn,ZodNullable:wo,ZodDefault:fc,ZodCatch:hc,ZodNaN:Hd,BRAND:$z,ZodBranded:hy,ZodPipeline:zc,ZodReadonly:pc,custom:Zj,Schema:Je,ZodSchema:Je,late:Vz,get ZodFirstPartyTypeKind(){return $e},coerce:S8,any:qz,array:e8,bigint:Hz,boolean:qj,date:Yz,discriminatedUnion:s8,effect:vw,enum:h8,function:u8,instanceof:Wz,intersection:o8,lazy:d8,literal:f8,map:l8,nan:Bz,nativeEnum:p8,never:Qz,null:Gz,nullable:v8,number:Gj,object:t8,oboolean:b8,onumber:_8,optional:g8,ostring:w8,pipeline:x8,preprocess:y8,promise:m8,record:a8,set:c8,strictObject:r8,string:Kj,symbol:Zz,transformer:vw,tuple:i8,undefined:Kz,union:n8,unknown:Xz,void:Jz,NEVER:k8,ZodIssueCode:ie,quotelessJson:Sz,ZodError:Wr}),C8="Label",Xj=v.forwardRef((e,t)=>l.jsx(Re.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Xj.displayName=C8;var Qj=Xj;const j8=_c("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ma=v.forwardRef(({className:e,...t},r)=>l.jsx(Qj,{ref:r,className:ae(j8(),e),...t}));Ma.displayName=Qj.displayName;const Pr=oz,Jj=v.createContext({}),Ne=({...e})=>l.jsx(Jj.Provider,{value:{name:e.name},children:l.jsx(cz,{...e})}),Xf=()=>{const e=v.useContext(Jj),t=v.useContext(eE),{getFieldState:r,formState:n}=Gf(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},eE=v.createContext({}),Ce=v.forwardRef(({className:e,...t},r)=>{const n=v.useId();return l.jsx(eE.Provider,{value:{id:n},children:l.jsx("div",{ref:r,className:ae("space-y-2",e),...t})})});Ce.displayName="FormItem";const je=v.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Xf();return l.jsx(Ma,{ref:r,className:ae(n&&"text-destructive",e),htmlFor:s,...t})});je.displayName="FormLabel";const Ee=v.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:o}=Xf();return l.jsx(bs,{ref:t,id:n,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});Ee.displayName="FormControl";const E8=v.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Xf();return l.jsx("p",{ref:r,id:n,className:ae("text-sm text-muted-foreground",e),...t})});E8.displayName="FormDescription";const Se=v.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:o}=Xf(),i=s?String(s==null?void 0:s.message):t;return i?l.jsx("p",{ref:n,id:o,className:ae("text-sm font-medium text-destructive",e),...r,children:i}):null});Se.displayName="FormMessage";function Tm(e,[t,r]){return Math.min(r,Math.max(t,e))}var N8=[" ","Enter","ArrowUp","ArrowDown"],T8=[" ","Enter"],Uc="Select",[Qf,Jf,R8]=bc(Uc),[Ia,j$]=xr(Uc,[R8,Pa]),eh=Pa(),[P8,Eo]=Ia(Uc),[A8,D8]=Ia(Uc),tE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:y}=e,x=eh(t),[g,_]=v.useState(null),[p,h]=v.useState(null),[w,C]=v.useState(!1),j=Ea(u),[E=!1,R]=on({prop:n,defaultProp:s,onChange:o}),[P,A]=on({prop:i,defaultProp:a,onChange:c}),L=v.useRef(null),q=g?!!g.closest("form"):!0,[N,F]=v.useState(new Set),b=Array.from(N).map(V=>V.props.value).join(";");return l.jsx(Xg,{...x,children:l.jsxs(P8,{required:y,scope:t,trigger:g,onTriggerChange:_,valueNode:p,onValueNodeChange:h,valueNodeHasChildren:w,onValueNodeHasChildrenChange:C,contentId:Ur(),value:P,onValueChange:A,open:E,onOpenChange:R,dir:j,triggerPointerDownPosRef:L,disabled:m,children:[l.jsx(Qf.Provider,{scope:t,children:l.jsx(A8,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{F(te=>new Set(te).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{F(te=>{const W=new Set(te);return W.delete(V),W})},[]),children:r})}),q?l.jsxs(EE,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:V=>A(V.target.value),disabled:m,children:[P===void 0?l.jsx("option",{value:""}):null,Array.from(N)]},b):null]})})};tE.displayName=Uc;var rE="SelectTrigger",nE=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=eh(r),i=Eo(rE,r),a=i.disabled||n,c=Ke(t,i.onTriggerChange),u=Jf(r),[d,f,m]=NE(x=>{const g=u().filter(h=>!h.disabled),_=g.find(h=>h.value===i.value),p=TE(g,x,_);p!==void 0&&i.onValueChange(p.value)}),y=()=>{a||(i.onOpenChange(!0),m())};return l.jsx(Qg,{asChild:!0,...o,children:l.jsx(Re.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":jE(i.value)?"":void 0,...s,ref:c,onClick:ce(s.onClick,x=>{x.currentTarget.focus()}),onPointerDown:ce(s.onPointerDown,x=>{const g=x.target;g.hasPointerCapture(x.pointerId)&&g.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(y(),i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:ce(s.onKeyDown,x=>{const g=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&f(x.key),!(g&&x.key===" ")&&N8.includes(x.key)&&(y(),x.preventDefault())})})})});nE.displayName=rE;var sE="SelectValue",oE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,c=Eo(sE,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=Ke(t,c.onValueNodeChange);return Jt(()=>{u(d)},[u,d]),l.jsx(Re.span,{...a,ref:f,style:{pointerEvents:"none"},children:jE(c.value)?l.jsx(l.Fragment,{children:i}):o})});oE.displayName=sE;var O8="SelectIcon",iE=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return l.jsx(Re.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});iE.displayName=O8;var M8="SelectPortal",aE=e=>l.jsx(kc,{asChild:!0,...e});aE.displayName=M8;var ii="SelectContent",lE=v.forwardRef((e,t)=>{const r=Eo(ii,e.__scopeSelect),[n,s]=v.useState();if(Jt(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?Ns.createPortal(l.jsx(cE,{scope:e.__scopeSelect,children:l.jsx(Qf.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(uE,{...e,ref:t})});lE.displayName=ii;var ls=10,[cE,No]=Ia(ii),I8="SelectContentImpl",uE=v.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_,...p}=e,h=Eo(ii,r),[w,C]=v.useState(null),[j,E]=v.useState(null),R=Ke(t,he=>C(he)),[P,A]=v.useState(null),[L,q]=v.useState(null),N=Jf(r),[F,b]=v.useState(!1),V=v.useRef(!1);v.useEffect(()=>{if(w)return tv(w)},[w]),Vg();const te=v.useCallback(he=>{const[ye,...ke]=N().map(Pe=>Pe.ref.current),[Fe]=ke.slice(-1),Me=document.activeElement;for(const Pe of he)if(Pe===Me||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===ye&&j&&(j.scrollTop=0),Pe===Fe&&j&&(j.scrollTop=j.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==Me))return},[N,j]),W=v.useCallback(()=>te([P,w]),[te,P,w]);v.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:Z,triggerPointerDownPosRef:I}=h;v.useEffect(()=>{if(w){let he={x:0,y:0};const ye=Fe=>{var Me,Pe;he={x:Math.abs(Math.round(Fe.pageX)-(((Me=I.current)==null?void 0:Me.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((Pe=I.current)==null?void 0:Pe.y)??0))}},ke=Fe=>{he.x<=10&&he.y<=10?Fe.preventDefault():w.contains(Fe.target)||Z(!1),document.removeEventListener("pointermove",ye),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",ke,{capture:!0})}}},[w,Z,I]),v.useEffect(()=>{const he=()=>Z(!1);return window.addEventListener("blur",he),window.addEventListener("resize",he),()=>{window.removeEventListener("blur",he),window.removeEventListener("resize",he)}},[Z]);const[Q,z]=NE(he=>{const ye=N().filter(Me=>!Me.disabled),ke=ye.find(Me=>Me.ref.current===document.activeElement),Fe=TE(ye,he,ke);Fe&&setTimeout(()=>Fe.ref.current.focus())}),$=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&(A(he),Fe&&(V.current=!0))},[h.value]),fe=v.useCallback(()=>w==null?void 0:w.focus(),[w]),ne=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&q(he)},[h.value]),se=n==="popper"?Rm:dE,Oe=se===Rm?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_}:{};return l.jsx(cE,{scope:r,content:w,viewport:j,onViewportChange:E,itemRefCallback:$,selectedItem:P,onItemLeave:fe,itemTextRefCallback:ne,focusSelectedItem:W,selectedItemText:L,position:n,isPositioned:F,searchRef:Q,children:l.jsx(jf,{as:bs,allowPinchZoom:!0,children:l.jsx(wf,{asChild:!0,trapped:h.open,onMountAutoFocus:he=>{he.preventDefault()},onUnmountAutoFocus:ce(s,he=>{var ye;(ye=h.trigger)==null||ye.focus({preventScroll:!0}),he.preventDefault()}),children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:he=>he.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:l.jsx(se,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:he=>he.preventDefault(),...p,...Oe,onPlaced:()=>b(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...p.style},onKeyDown:ce(p.onKeyDown,he=>{const ye=he.ctrlKey||he.altKey||he.metaKey;if(he.key==="Tab"&&he.preventDefault(),!ye&&he.key.length===1&&z(he.key),["ArrowUp","ArrowDown","Home","End"].includes(he.key)){let Fe=N().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(he.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(he.key)){const Me=he.target,Pe=Fe.indexOf(Me);Fe=Fe.slice(Pe+1)}setTimeout(()=>te(Fe)),he.preventDefault()}})})})})})})});uE.displayName=I8;var L8="SelectItemAlignedPosition",dE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=Eo(ii,r),i=No(ii,r),[a,c]=v.useState(null),[u,d]=v.useState(null),f=Ke(t,R=>d(R)),m=Jf(r),y=v.useRef(!1),x=v.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:p,focusSelectedItem:h}=i,w=v.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&g&&_&&p){const R=o.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),L=p.getBoundingClientRect();if(o.dir!=="rtl"){const Me=L.left-P.left,Pe=A.left-Me,nt=R.left-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.left=D+"px"}else{const Me=P.right-L.right,Pe=window.innerWidth-A.right-Me,nt=window.innerWidth-R.right-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.right=D+"px"}const q=m(),N=window.innerHeight-ls*2,F=g.scrollHeight,b=window.getComputedStyle(u),V=parseInt(b.borderTopWidth,10),te=parseInt(b.paddingTop,10),W=parseInt(b.borderBottomWidth,10),Z=parseInt(b.paddingBottom,10),I=V+te+F+Z+W,Q=Math.min(_.offsetHeight*5,I),z=window.getComputedStyle(g),$=parseInt(z.paddingTop,10),fe=parseInt(z.paddingBottom,10),ne=R.top+R.height/2-ls,se=N-ne,Oe=_.offsetHeight/2,he=_.offsetTop+Oe,ye=V+te+he,ke=I-ye;if(ye<=ne){const Me=_===q[q.length-1].ref.current;a.style.bottom="0px";const Pe=u.clientHeight-g.offsetTop-g.offsetHeight,nt=Math.max(se,Oe+(Me?fe:0)+Pe+W),k=ye+nt;a.style.height=k+"px"}else{const Me=_===q[0].ref.current;a.style.top="0px";const nt=Math.max(ne,V+g.offsetTop+(Me?$:0)+Oe)+ke;a.style.height=nt+"px",g.scrollTop=ye-ne+g.offsetTop}a.style.margin=`${ls}px 0`,a.style.minHeight=Q+"px",a.style.maxHeight=N+"px",n==null||n(),requestAnimationFrame(()=>y.current=!0)}},[m,o.trigger,o.valueNode,a,u,g,_,p,o.dir,n]);Jt(()=>w(),[w]);const[C,j]=v.useState();Jt(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const E=v.useCallback(R=>{R&&x.current===!0&&(w(),h==null||h(),x.current=!1)},[w,h]);return l.jsx(z8,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:y,onScrollButtonChange:E,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:l.jsx(Re.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});dE.displayName=L8;var F8="SelectPopperPosition",Rm=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=ls,...o}=e,i=eh(r);return l.jsx(Jg,{...i,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})});Rm.displayName=F8;var[z8,py]=Ia(ii,{}),Pm="SelectViewport",fE=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=No(Pm,r),i=py(Pm,r),a=Ke(t,o.onViewportChange),c=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.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:n}),l.jsx(Qf.Slot,{scope:r,children:l.jsx(Re.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ce(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&f){const y=Math.abs(c.current-d.scrollTop);if(y>0){const x=window.innerHeight-ls*2,g=parseFloat(f.style.minHeight),_=parseFloat(f.style.height),p=Math.max(g,_);if(p0?C:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});fE.displayName=Pm;var hE="SelectGroup",[U8,$8]=Ia(hE),pE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ur();return l.jsx(U8,{scope:r,id:s,children:l.jsx(Re.div,{role:"group","aria-labelledby":s,...n,ref:t})})});pE.displayName=hE;var mE="SelectLabel",gE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=$8(mE,r);return l.jsx(Re.div,{id:s.id,...n,ref:t})});gE.displayName=mE;var Yd="SelectItem",[V8,vE]=Ia(Yd),yE=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=Eo(Yd,r),c=No(Yd,r),u=a.value===n,[d,f]=v.useState(o??""),[m,y]=v.useState(!1),x=Ke(t,p=>{var h;return(h=c.itemRefCallback)==null?void 0:h.call(c,p,n,s)}),g=Ur(),_=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")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 l.jsx(V8,{scope:r,value:n,disabled:s,textId:g,isSelected:u,onItemTextChange:v.useCallback(p=>{f(h=>h||((p==null?void 0:p.textContent)??"").trim())},[]),children:l.jsx(Qf.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:l.jsx(Re.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:x,onFocus:ce(i.onFocus,()=>y(!0)),onBlur:ce(i.onBlur,()=>y(!1)),onPointerUp:ce(i.onPointerUp,_),onPointerMove:ce(i.onPointerMove,p=>{var h;s?(h=c.onItemLeave)==null||h.call(c):p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(i.onPointerLeave,p=>{var h;p.currentTarget===document.activeElement&&((h=c.onItemLeave)==null||h.call(c))}),onKeyDown:ce(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(T8.includes(p.key)&&_(),p.key===" "&&p.preventDefault())})})})})});yE.displayName=Yd;var ll="SelectItemText",xE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=Eo(ll,r),a=No(ll,r),c=vE(ll,r),u=D8(ll,r),[d,f]=v.useState(null),m=Ke(t,p=>f(p),c.onItemTextChange,p=>{var h;return(h=a.itemTextRefCallback)==null?void 0:h.call(a,p,c.value,c.disabled)}),y=d==null?void 0:d.textContent,x=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:y},c.value),[c.disabled,c.value,y]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return Jt(()=>(g(x),()=>_(x)),[g,_,x]),l.jsxs(l.Fragment,{children:[l.jsx(Re.span,{id:c.textId,...o,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ns.createPortal(o.children,i.valueNode):null]})});xE.displayName=ll;var wE="SelectItemIndicator",_E=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return vE(wE,r).isSelected?l.jsx(Re.span,{"aria-hidden":!0,...n,ref:t}):null});_E.displayName=wE;var Am="SelectScrollUpButton",bE=v.forwardRef((e,t)=>{const r=No(Am,e.__scopeSelect),n=py(Am,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});bE.displayName=Am;var Dm="SelectScrollDownButton",SE=v.forwardRef((e,t)=>{const r=No(Dm,e.__scopeSelect),n=py(Dm,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});SE.displayName=Dm;var kE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=No("SelectScrollButton",r),i=v.useRef(null),a=Jf(r),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Jt(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Re.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ce(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ce(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ce(s.onPointerLeave,()=>{c()})})}),W8="SelectSeparator",CE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(Re.div,{"aria-hidden":!0,...n,ref:t})});CE.displayName=W8;var Om="SelectArrow",B8=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=eh(r),o=Eo(Om,r),i=No(Om,r);return o.open&&i.position==="popper"?l.jsx(ev,{...s,...n,ref:t}):null});B8.displayName=Om;function jE(e){return e===""||e===void 0}var EE=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=v.useRef(null),o=Ke(t,s),i=YC(r);return v.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==r&&d){const f=new Event("change",{bubbles:!0});d.call(a,r),a.dispatchEvent(f)}},[i,r]),l.jsx(Ic,{asChild:!0,children:l.jsx("select",{...n,ref:o,defaultValue:r})})});EE.displayName="BubbleSelect";function NE(e){const t=Dt(e),r=v.useRef(""),n=v.useRef(0),s=v.useCallback(i=>{const a=r.current+i;t(a),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=v.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function TE(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=H8(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function H8(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Y8=tE,RE=nE,Z8=oE,K8=iE,G8=aE,PE=lE,q8=fE,X8=pE,AE=gE,DE=yE,Q8=xE,J8=_E,OE=bE,ME=SE,IE=CE;const Mo=Y8,cl=X8,Io=Z8,Ks=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(RE,{ref:n,className:ae("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 placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,l.jsx(K8,{asChild:!0,children:l.jsx(Lg,{className:"h-4 w-4 opacity-50"})})]}));Ks.displayName=RE.displayName;const LE=v.forwardRef(({className:e,...t},r)=>l.jsx(OE,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(aA,{className:"h-4 w-4"})}));LE.displayName=OE.displayName;const FE=v.forwardRef(({className:e,...t},r)=>l.jsx(ME,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Lg,{className:"h-4 w-4"})}));FE.displayName=ME.displayName;const Gs=v.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>l.jsx(G8,{children:l.jsxs(PE,{ref:s,className:ae("relative z-50 max-h-96 min-w-[8rem] overflow-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",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[l.jsx(LE,{}),l.jsx(q8,{className:ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(FE,{})]})}));Gs.displayName=PE.displayName;const Wi=v.forwardRef(({className:e,...t},r)=>l.jsx(AE,{ref:r,className:ae("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Wi.displayName=AE.displayName;const pn=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(DE,{ref:n,className:ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(J8,{children:l.jsx(eb,{className:"h-4 w-4"})})}),l.jsx(Q8,{children:t})]}));pn.displayName=DE.displayName;const eU=v.forwardRef(({className:e,...t},r)=>l.jsx(IE,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));eU.displayName=IE.displayName;const Mm=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["aliyun-dcdn",["阿里云-DCDN","/imgs/providers/aliyun.svg"]],["tencent-cdn",["腾讯云-CDN","/imgs/providers/tencent.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["qiniu-cdn",["七牛云-CDN","/imgs/providers/qiniu.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),tU=Array.from(Mm.keys()),my=mv,gy=gv,rU=vv,zE=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{ref:r,className:ae("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}));zE.displayName=Ec.displayName;const th=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(rU,{children:[l.jsx(zE,{}),l.jsxs(Nc,{ref:n,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,l.jsxs(Tf,{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:[l.jsx(Fg,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));th.displayName=Nc.displayName;const rh=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});rh.displayName="DialogHeader";const nh=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold leading-none tracking-tight",e),...t}));nh.displayName=Tc.displayName;const nU=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));nU.displayName=Rc.displayName;function sU(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var vy="ScrollArea",[UE,E$]=xr(vy),[oU,cn]=UE(vy),$E=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[f,m]=v.useState(null),[y,x]=v.useState(null),[g,_]=v.useState(null),[p,h]=v.useState(0),[w,C]=v.useState(0),[j,E]=v.useState(!1),[R,P]=v.useState(!1),A=Ke(t,q=>c(q)),L=Ea(s);return l.jsx(oU,{scope:r,type:n,dir:L,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:j,onScrollbarXEnabledChange:E,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:R,onScrollbarYEnabledChange:P,onCornerWidthChange:h,onCornerHeightChange:C,children:l.jsx(Re.div,{dir:L,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":p+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});$E.displayName=vy;var VE="ScrollAreaViewport",WE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=cn(VE,r),a=v.useRef(null),c=Ke(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(Re.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});WE.displayName=VE;var Xn="ScrollAreaScrollbar",yy=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return v.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?l.jsx(iU,{...n,ref:t,forceMount:r}):s.type==="scroll"?l.jsx(aU,{...n,ref:t,forceMount:r}):s.type==="auto"?l.jsx(BE,{...n,ref:t,forceMount:r}):s.type==="always"?l.jsx(xy,{...n,ref:t}):null});yy.displayName=Xn;var iU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),[o,i]=v.useState(!1);return v.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(ur,{present:r||o,children:l.jsx(BE,{"data-state":o?"visible":"hidden",...n,ref:t})})}),aU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),o=e.orientation==="horizontal",i=oh(()=>c("SCROLL_END"),100),[a,c]=sU("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,c]),v.useEffect(()=>{const u=s.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const y=u[d];f!==y&&(c("SCROLL"),i()),f=y};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[s.viewport,o,c,i]),l.jsx(ur,{present:r||a!=="hidden",children:l.jsx(xy,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ce(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ce(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),BE=v.forwardRef((e,t)=>{const r=cn(Xn,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=v.useState(!1),a=e.orientation==="horizontal",c=oh(()=>{if(r.viewport){const u=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,s=cn(Xn,e.__scopeScrollArea),o=v.useRef(null),i=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=GE(a.viewport,a.content),d={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>o.current=m,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:m=>i.current=m};function f(m,y){return hU(m,i.current,a,y)}return r==="horizontal"?l.jsx(lU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollLeft,y=yw(m,a,s.dir);o.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=f(m,s.dir))}}):r==="vertical"?l.jsx(cU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollTop,y=yw(m,a);o.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=f(m))}}):null}),lU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Kd(i.paddingLeft),paddingEnd:Kd(i.paddingRight)}})}})}),cU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Kd(i.paddingTop),paddingEnd:Kd(i.paddingBottom)}})}})}),[uU,HE]=UE(Xn),YE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=e,y=cn(Xn,r),[x,g]=v.useState(null),_=Ke(t,A=>g(A)),p=v.useRef(null),h=v.useRef(""),w=y.viewport,C=n.content-n.viewport,j=Dt(d),E=Dt(c),R=oh(f,10);function P(A){if(p.current){const L=A.clientX-p.current.left,q=A.clientY-p.current.top;u({x:L,y:q})}}return v.useEffect(()=>{const A=L=>{const q=L.target;(x==null?void 0:x.contains(q))&&j(L,C)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[w,x,C,j]),v.useEffect(E,[n,E]),wa(x,R),wa(y.content,R),l.jsx(uU,{scope:r,scrollbar:x,hasThumb:s,onThumbChange:Dt(o),onThumbPointerUp:Dt(i),onThumbPositionChange:E,onThumbPointerDown:Dt(a),children:l.jsx(Re.div,{...m,ref:_,style:{position:"absolute",...m.style},onPointerDown:ce(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),p.current=x.getBoundingClientRect(),h.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),P(A))}),onPointerMove:ce(e.onPointerMove,P),onPointerUp:ce(e.onPointerUp,A=>{const L=A.target;L.hasPointerCapture(A.pointerId)&&L.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=h.current,y.viewport&&(y.viewport.style.scrollBehavior=""),p.current=null})})})}),Zd="ScrollAreaThumb",ZE=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=HE(Zd,e.__scopeScrollArea);return l.jsx(ur,{present:r||s.hasThumb,children:l.jsx(dU,{ref:t,...n})})}),dU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=cn(Zd,r),i=HE(Zd,r),{onThumbPositionChange:a}=i,c=Ke(t,f=>i.onThumbChange(f)),u=v.useRef(),d=oh(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=o.viewport;if(f){const m=()=>{if(d(),!u.current){const y=pU(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[o.viewport,d,a]),l.jsx(Re.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ce(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),x=f.clientX-y.left,g=f.clientY-y.top;i.onThumbPointerDown({x,y:g})}),onPointerUp:ce(e.onPointerUp,i.onThumbPointerUp)})});ZE.displayName=Zd;var wy="ScrollAreaCorner",KE=v.forwardRef((e,t)=>{const r=cn(wy,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?l.jsx(fU,{...e,ref:t}):null});KE.displayName=wy;var fU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=cn(wy,r),[o,i]=v.useState(0),[a,c]=v.useState(0),u=!!(o&&a);return wa(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),wa(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),i(d)}),u?l.jsx(Re.div,{...n,ref:t,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Kd(e){return e?parseInt(e,10):0}function GE(e,t){const r=e/t;return isNaN(r)?0:r}function sh(e){const t=GE(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function hU(e,t,r,n="ltr"){const s=sh(r),o=s/2,i=t||o,a=s-i,c=r.scrollbar.paddingStart+i,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,d=r.content-r.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return qE([c,u],f)(e)}function yw(e,t,r="ltr"){const n=sh(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-n,c=r==="ltr"?[0,i]:[i*-1,0],u=Tm(e,c);return qE([0,i],[0,a])(u)}function qE(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function XE(e,t){return e>0&&e{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,a=r.top!==o.top;(i||a)&&t(),r=o,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function oh(e,t){const r=Dt(e),n=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),v.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function wa(e,t){const r=Dt(t);Jt(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var QE=$E,mU=WE,gU=KE;const ih=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(QE,{ref:n,className:ae("relative overflow-hidden",e),...r,children:[l.jsx(mU,{className:"h-full w-full rounded-[inherit]",children:t}),l.jsx(JE,{}),l.jsx(gU,{})]}));ih.displayName=QE.displayName;const JE=v.forwardRef(({className:e,orientation:t="vertical",...r},n)=>l.jsx(yy,{ref:n,orientation:t,className:ae("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:l.jsx(ZE,{className:"relative flex-1 rounded-full bg-border"})}));JE.displayName=yy.displayName;const uo=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["cloudflare",["Cloudflare","/imgs/providers/cloudflare.svg"]],["namesilo",["Namesilo","/imgs/providers/namesilo.svg"]],["godaddy",["GoDaddy","/imgs/providers/godaddy.svg"]],["qiniu",["七牛云","/imgs/providers/qiniu.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),xw=e=>uo.get(e),To=pe.union([pe.literal("aliyun"),pe.literal("tencent"),pe.literal("ssh"),pe.literal("webhook"),pe.literal("cloudflare"),pe.literal("qiniu"),pe.literal("namesilo"),pe.literal("godaddy")],{message:"请选择云服务商"}),Ro=e=>{switch(e){case"aliyun":case"tencent":return"all";case"ssh":case"webhook":case"qiniu":return"deploy";case"cloudflare":case"namesilo":case"godaddy":return"apply";default:return"all"}},vU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,secretId:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={secretId:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:o.secretId,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{secretId:c.secretId,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},yU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKeyId:pe.string().min(1).max(64),accessSecretId:pe.string().min(1).max(64)});let o={accessKeyId:"",accessKeySecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:o.accessKeyId,accessSecretId:o.accessKeySecret}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKeyId:c.accessKeyId,accessKeySecret:c.accessSecretId}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKeyId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeyId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeyId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessSecretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeySecret"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeySecret",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},mc=v.forwardRef(({className:e,...t},r)=>l.jsx("textarea",{className:ae("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));mc.displayName="Textarea";const _y=({className:e,trigger:t})=>{const{reloadAccessGroups:r}=Kr(),[n,s]=v.useState(!1),o=pe.object({name:pe.string().min(1).max(64)}),i=Tr({resolver:Rr(o),defaultValues:{name:""}}),a=async c=>{try{await b3({name:c.name}),r(),s(!1)}catch(u){Object.entries(u.response.data).forEach(([f,m])=>{i.setError(f,{type:"manual",message:m.message})})}};return l.jsxs(my,{onOpenChange:s,open:n,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加分组"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"组名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入组名",...c,type:"text"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},xU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n,reloadAccessGroups:s,config:{accessGroups:o}}=Kr(),i=v.useRef(null),[a,c]=v.useState(""),u=e&&e.group?e.group:"",d=/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,f=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,m=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,host:pe.string().refine(h=>f.test(h)||d.test(h),{message:"请输入正确的域名或IP"}),group:pe.string().optional(),port:pe.string().min(1).max(5),username:pe.string().min(1).max(64),password:pe.string().min(0).max(64),key:pe.string().min(0).max(20480),keyFile:pe.any().optional(),command:pe.string().min(1).max(2048),certPath:pe.string().min(0).max(2048),keyPath:pe.string().min(0).max(2048)});let y={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:"",command:"sudo service nginx restart",certPath:"/etc/nginx/ssl/certificate.crt",keyPath:"/etc/nginx/ssl/private.key"};e&&(y=e.config);const x=Tr({resolver:Rr(m),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",group:e==null?void 0:e.group,host:y.host,port:y.port,username:y.username,password:y.password,key:y.key,keyFile:y.keyFile,certPath:y.certPath,keyPath:y.keyPath,command:y.command}}),g=async h=>{console.log(h);let w=h.group;w=="emptyId"&&(w="");const C={id:h.id,name:h.name,configType:h.configType,usage:Ro(h.configType),group:w,config:{host:h.host,port:h.port,username:h.username,password:h.password,key:h.key,command:h.command,certPath:h.certPath,keyPath:h.keyPath}};try{const j=await jo(C);t(),C.id=j.id,C.created=j.created,C.updated=j.updated,h.id?n(C):r(C),w!=u&&(u&&await nw({id:u,"access-":C.id}),w&&await nw({id:w,"access+":C.id})),s()}catch(j){Object.entries(j.response.data).forEach(([R,P])=>{x.setError(R,{type:"manual",message:P.message})});return}},_=async h=>{var E;const w=(E=h.target.files)==null?void 0:E[0];if(!w)return;const C=w;c(C.name);const j=await Z6(C);x.setValue("key",j)},p=()=>{var h;console.log(i.current),(h=i.current)==null||h.click()};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...x,children:l.jsxs("form",{onSubmit:h=>{h.stopPropagation(),x.handleSubmit(g)(h)},className:"space-y-3",children:[l.jsx(Ne,{control:x.control,name:"name",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"group",render:({field:h})=>l.jsxs(Ce,{children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"授权配置组(用于将一个域名证书部署到多个 ssh 主机)"}),l.jsx(_y,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{...h,value:h.value,defaultValue:"emptyId",onValueChange:w=>{x.setValue("group",w)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),o.map(w=>l.jsx(pn,{value:w.id?w.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:w.name})},w.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"id",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"configType",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(Ne,{control:x.control,name:"host",render:({field:h})=>l.jsxs(Ce,{className:"grow",children:[l.jsx(je,{children:"服务器HOST"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Host",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"port",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SSH端口"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Port",...h,type:"number"})}),l.jsx(Se,{})]})})]}),l.jsx(Ne,{control:x.control,name:"username",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入用户名",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"password",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入密码",...h,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"key",render:({field:h})=>l.jsxs(Ce,{hidden:!0,children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Key",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyFile",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsxs("div",{children:[l.jsx(He,{type:"button",variant:"secondary",size:"sm",className:"w-48",onClick:p,children:a||"请选择文件"}),l.jsx(Te,{placeholder:"请输入Key",...h,ref:i,className:"hidden",hidden:!0,type:"file",onChange:_})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"certPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"证书上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入证书上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"私钥上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入私钥上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"command",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Command"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:"请输入要执行的命令",...h})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},wU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,url:pe.string().url()});let o={url:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"webhook",url:o.url}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{url:c.url}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"url",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Webhook Url"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Webhook Url",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},_U=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,dnsApiToken:pe.string().min(1).max(64)});let o={dnsApiToken:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"cloudflare",dnsApiToken:o.dnsApiToken}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{dnsApiToken:c.dnsApiToken}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"dnsApiToken",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"CLOUD_DNS_API_TOKEN"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入CLOUD_DNS_API_TOKEN",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},bU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKey:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={accessKey:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"qiniu",accessKey:o.accessKey,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKey:c.accessKey,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},SU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64)});let o={apiKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"namesilo",apiKey:o.apiKey}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"NAMESILO_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入NAMESILO_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},kU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64),apiSecret:pe.string().min(1).max(64)});let o={apiKey:"",apiSecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"godaddy",apiKey:o.apiKey,apiSecret:o.apiSecret}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey,apiSecret:c.apiSecret}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiSecret",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_SECRET"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_SECRET",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})};function jl({trigger:e,op:t,data:r,className:n}){const[s,o]=v.useState(!1),i=Array.from(uo.keys()),[a,c]=v.useState((r==null?void 0:r.configType)||"");let u=l.jsx(l.Fragment,{children:" "});switch(a){case"tencent":u=l.jsx(vU,{data:r,onAfterReq:()=>{o(!1)}});break;case"aliyun":u=l.jsx(yU,{data:r,onAfterReq:()=>{o(!1)}});break;case"ssh":u=l.jsx(xU,{data:r,onAfterReq:()=>{o(!1)}});break;case"webhook":u=l.jsx(wU,{data:r,onAfterReq:()=>{o(!1)}});break;case"cloudflare":u=l.jsx(_U,{data:r,onAfterReq:()=>{o(!1)}});break;case"qiniu":u=l.jsx(bU,{data:r,onAfterReq:()=>{o(!1)}});break;case"namesilo":u=l.jsx(SU,{data:r,onAfterReq:()=>{o(!1)}});break;case"godaddy":u=l.jsx(kU,{data:r,onAfterReq:()=>{o(!1)}});break}const d=f=>f==a?"border-primary":"";return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(n),children:e}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsxs(nh,{children:[t=="add"?"添加":"编辑","授权"]})}),l.jsx(ih,{className:"max-h-[80vh]",children:l.jsxs("div",{className:"container py-3",children:[l.jsx(Ma,{children:"服务商"}),l.jsxs(Mo,{onValueChange:f=>{console.log(f),c(f)},defaultValue:a,children:[l.jsx(Ks,{className:"mt-3",children:l.jsx(Io,{placeholder:"请选择服务商"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商"}),i.map(f=>{var m,y;return l.jsx(pn,{value:f,children:l.jsxs("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer",d(f)),children:[l.jsx("img",{src:(m=uo.get(f))==null?void 0:m[1],className:"h-6 w-6"}),l.jsx("div",{children:(y=uo.get(f))==null?void 0:y[0]})]})},f)})]})})]}),u]})})]})]})}const CU=({className:e,trigger:t})=>{const{config:{emails:r},setEmails:n}=Kr(),[s,o]=v.useState(!1),i=pe.object({email:pe.string().email()}),a=Tr({resolver:Rr(i),defaultValues:{email:""}}),c=async u=>{if(r.content.emails.includes(u.email)){a.setError("email",{message:"邮箱已存在"});return}const d=[...r.content.emails,u.email];try{const f=await Mc({...r,name:"emails",content:{emails:d}});n(f),a.reset(),a.clearErrors(),o(!1)}catch(f){Object.entries(f.response.data).forEach(([y,x])=>{a.setError(y,{type:"manual",message:x.message})})}};return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加邮箱"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...a,children:l.jsxs("form",{onSubmit:u=>{console.log(u),u.stopPropagation(),a.handleSubmit(c)(u)},className:"space-y-8",children:[l.jsx(Ne,{control:a.control,name:"email",render:({field:u})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...u,type:"email"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},jU=()=>{const{config:{accesses:e,emails:t,accessGroups:r}}=Kr(),[n,s]=v.useState(),o=Nn(),[i,a]=v.useState("base"),[c,u]=v.useState(n?n.targetType:"");v.useEffect(()=>{const p=new URLSearchParams(o.search).get("id");p&&(async()=>{const w=await Q6(p);s(w),u(w.targetType)})()},[o.search]);const d=pe.object({id:pe.string().optional(),domain:pe.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:"请输入正确的域名"}),email:pe.string().email().optional(),access:pe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择DNS服务商授权配置"}),targetAccess:pe.string().optional(),targetType:pe.string().regex(/^[a-zA-Z0-9-]+$/,{message:"请选择部署服务类型"}),variables:pe.string().optional(),group:pe.string().optional(),nameservers:pe.string().optional()}),f=Tr({resolver:Rr(d),defaultValues:{id:"",domain:"",email:"",access:"",targetAccess:"",targetType:"",variables:"",group:"",nameservers:""}});v.useEffect(()=>{n&&f.reset({id:n.id,domain:n.domain,email:n.email,access:n.access,targetAccess:n.targetAccess,targetType:n.targetType,variables:n.variables,group:n.group,nameservers:n.nameservers})},[n,f]);const m=e.filter(_=>{if(_.usage=="apply")return!1;if(c=="")return!0;const p=c.split("-");return _.configType===p[0]}),{toast:y}=qn(),x=Nr(),g=async _=>{const p=_.group=="emptyId"?"":_.group,h=_.targetAccess==="emptyId"?"":_.targetAccess;if(p==""&&h==""){f.setError("group",{type:"manual",message:"部署授权和部署授权组至少选一个"}),f.setError("targetAccess",{type:"manual",message:"部署授权和部署授权组至少选一个"});return}const w={id:_.id,crontab:"0 0 * * *",domain:_.domain,email:_.email,access:_.access,group:p,targetAccess:h,targetType:_.targetType,variables:_.variables,nameservers:_.nameservers};try{await km(w);let C="域名编辑成功";w.id==""&&(C="域名添加成功"),y({title:"成功",description:C}),x("/domains")}catch(C){Object.entries(C.response.data).forEach(([E,R])=>{f.setError(E,{type:"manual",message:R.message})});return}};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:" h-5 text-muted-foreground",children:[n!=null&&n.id?"编辑":"新增","域名"]}),l.jsxs("div",{className:"mt-5 flex w-full justify-center md:space-x-10 flex-col md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[200px] text-muted-foreground space-x-3 md:space-y-3 flex-row md:flex-col flex",children:[l.jsx("div",{className:ae("cursor-pointer text-right",i==="base"?"text-primary":""),onClick:()=>{a("base")},children:"基础设置"}),l.jsx("div",{className:ae("cursor-pointer text-right",i==="advance"?"text-primary":""),onClick:()=>{a("advance")},children:"高级设置"})]}),l.jsx("div",{className:"w-full md:w-[35em] bg-gray-100 dark:bg-gray-900 p-5 rounded mt-3 md:mt-0",children:l.jsx(Pr,{...f,children:l.jsxs("form",{onSubmit:f.handleSubmit(g),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:f.control,name:"domain",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"域名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入域名",..._})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"email",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"Email(申请证书需要提供邮箱)"}),l.jsx(CU,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("email",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择邮箱"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"邮箱列表"}),t.content.emails.map(p=>l.jsx(pn,{value:p,children:l.jsx("div",{children:p})},p))]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"access",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"DNS 服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("access",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商授权配置"}),e.filter(p=>p.usage!="deploy").map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetType",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"部署服务类型"}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{u(p),f.setValue("targetType",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择部署服务类型"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"部署服务类型"}),tU.map(p=>{var h,w;return l.jsx(pn,{value:p,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=Mm.get(p))==null?void 0:h[1]}),l.jsx("div",{children:(w=Mm.get(p))==null?void 0:w[0]})]})},p)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetAccess",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"部署服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{f.setValue("targetAccess",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsxs(Wi,{children:["服务商授权配置",f.getValues().targetAccess]}),l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:"flex items-center space-x-2",children:"--"})}),m.map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"group",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance"||c!="ssh",children:[l.jsx(je,{className:"w-full flex justify-between",children:l.jsx("div",{children:"部署配置组(用于将一个域名证书部署到多个 ssh 主机)"})}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,defaultValue:"emptyId",onValueChange:p=>{f.setValue("group",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),r.filter(p=>{var h;return p.expand&&((h=p.expand)==null?void 0:h.access.length)>0}).map(p=>l.jsx(pn,{value:p.id?p.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:p.name})},p.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"variables",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance",children:[l.jsx(je,{children:"变量"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:`可在SSH部署中使用,形如: key=val; key2=val2;`,..._,className:"placeholder:whitespace-pre-wrap"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"nameservers",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance",children:[l.jsx(je,{children:"域名服务器"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:`自定义域名服务器,多个用分号隔开,如: 8.8.8.8; -8.8.4.4;`,..._,className:"placeholder:whitespace-pre-wrap"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})})},eN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));eN.displayName="Card";const tN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("flex flex-col space-y-1.5 p-6",e),...t}));tN.displayName="CardHeader";const rN=v.forwardRef(({className:e,...t},r)=>l.jsx("h3",{ref:r,className:ae("text-2xl font-semibold leading-none tracking-tight",e),...t}));rN.displayName="CardTitle";const nN=v.forwardRef(({className:e,...t},r)=>l.jsx("p",{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));nN.displayName="CardDescription";const sN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("p-6 pt-0",e),...t}));sN.displayName="CardContent";const oN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("flex items-center p-6 pt-0",e),...t}));oN.displayName="CardFooter";const _o=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",NU=()=>{const{config:{accessGroups:e},reloadAccessGroups:t}=Kr(),{toast:r}=qn(),n=Nr(),s=async i=>{try{await b3(i),t()}catch(a){r({title:"删除失败",description:_o(a),variant:"destructive"});return}},o=()=>{n("/access")};return l.jsxs("div",{className:"mt-10",children:[l.jsx(na,{when:e.length==0,children:l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(v0,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(_y,{trigger:l.jsx(He,{children:"新增授权组"}),className:"mt-3"})]})})}),l.jsx(ih,{className:"h-[75vh] overflow-hidden",children:l.jsx("div",{className:"flex gap-5 flex-wrap",children:e.map(i=>l.jsxs(eN,{className:"w-full md:w-[350px]",children:[l.jsxs(tN,{children:[l.jsx(rN,{children:i.name}),l.jsxs(nN,{children:["共有",i.expand?i.expand.access.length:0,"个部署授权配置"]})]}),l.jsx(sN,{className:"min-h-[180px]",children:i.expand?l.jsx(l.Fragment,{children:i.expand.access.slice(0,3).map(a=>l.jsx("div",{className:"flex flex-col mb-3",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"",children:l.jsx("img",{src:xw(a.configType)[1],alt:"provider",className:"w-8 h-8"})}),l.jsxs("div",{className:"ml-3",children:[l.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:a.name}),l.jsx("div",{className:"text-xs text-muted-foreground",children:xw(a.configType)[0]})]})]})},a.id))}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex text-gray-700 dark:text-gray-200 items-center",children:[l.jsx("div",{children:l.jsx(v0,{size:40})}),l.jsx("div",{className:"ml-2",children:"暂无部署授权配置,请添加后开始使用吧"})]})})}),l.jsx(oN,{children:l.jsxs("div",{className:"flex justify-end w-full",children:[l.jsx(na,{when:!!(i.expand&&i.expand.access.length>0),children:l.jsx("div",{children:l.jsx(He,{size:"sm",variant:"link",onClick:()=>{n(`/access?accessGroupId=${i.id}&tab=access`,{replace:!0})},children:"所有授权"})})}),l.jsx(na,{when:!i.expand||i.expand.access.length==0,children:l.jsx("div",{children:l.jsx(He,{size:"sm",onClick:o,children:"新增授权"})})}),l.jsx("div",{className:"ml-3",children:l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"destructive",size:"sm",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{className:"dark:text-gray-200",children:"删除组"}),l.jsx(ey,{children:"确定要删除部署授权组吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{className:"dark:text-gray-200",children:"取消"}),l.jsx(ty,{onClick:()=>{s(i.id?i.id:"")},children:"确认"})]})]})]})})]})})]}))})})]})};var by="Tabs",[TU,T$]=xr(by,[kf]),iN=kf(),[RU,Sy]=TU(by),aN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Ea(a),[f,m]=on({prop:n,onChange:s,defaultProp:o});return l.jsx(RU,{scope:r,baseId:Ur(),value:f,onValueChange:m,orientation:i,dir:d,activationMode:c,children:l.jsx(Re.div,{dir:d,"data-orientation":i,...u,ref:t})})});aN.displayName=by;var lN="TabsList",cN=v.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,o=Sy(lN,r),i=iN(r);return l.jsx(Fb,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:l.jsx(Re.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});cN.displayName=lN;var uN="TabsTrigger",dN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...o}=e,i=Sy(uN,r),a=iN(r),c=pN(i.baseId,n),u=mN(i.baseId,n),d=n===i.value;return l.jsx(zb,{asChild:!0,...a,focusable:!s,active:d,children:l.jsx(Re.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,...o,ref:t,onMouseDown:ce(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(n):f.preventDefault()}),onKeyDown:ce(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(n)}),onFocus:ce(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(n)})})})});dN.displayName=uN;var fN="TabsContent",hN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:o,...i}=e,a=Sy(fN,r),c=pN(a.baseId,n),u=mN(a.baseId,n),d=n===a.value,f=v.useRef(d);return v.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(ur,{present:s||d,children:({present:m})=>l.jsx(Re.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&o})})});hN.displayName=fN;function pN(e,t){return`${e}-trigger-${t}`}function mN(e,t){return`${e}-content-${t}`}var PU=aN,gN=cN,vN=dN,yN=hN;const xN=PU,ky=v.forwardRef(({className:e,...t},r)=>l.jsx(gN,{ref:r,className:ae("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ky.displayName=gN.displayName;const ia=v.forwardRef(({className:e,...t},r)=>l.jsx(vN,{ref:r,className:ae("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}));ia.displayName=vN.displayName;const Gd=v.forwardRef(({className:e,...t},r)=>l.jsx(yN,{ref:r,className:ae("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Gd.displayName=yN.displayName;const AU=()=>{const{config:e,deleteAccess:t}=Kr(),{accesses:r}=e,n=10,s=Math.ceil(r.length/n),o=Nr(),i=Nn(),a=new URLSearchParams(i.search),c=a.get("page"),u=c?Number(c):1,d=a.get("tab"),f=a.get("accessGroupId"),m=(u-1)*n,y=m+n,x=async _=>{const p=await _3(_);t(p.id)},g=_=>{a.set("tab",_),o({search:a.toString()})};return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"授权管理"}),d!="access_group"?l.jsx(jl,{trigger:l.jsx(He,{children:"添加授权"}),op:"add"}):l.jsx(_y,{trigger:l.jsx(He,{children:"添加授权组"})})]}),l.jsxs(xN,{defaultValue:d||"access",value:d||"access",className:"w-full mt-5",children:[l.jsxs(ky,{className:"space-x-5 px-3",children:[l.jsx(ia,{value:"access",onClick:()=>{g("access")},children:"授权管理"}),l.jsx(ia,{value:"access_group",onClick:()=>{g("access_group")},children:"授权组管理"})]}),l.jsx(Gd,{value:"access",children:r.length===0?l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(hA,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加授权开始部署证书吧。"}),l.jsx(jl,{trigger:l.jsx(He,{children:"添加授权"}),op:"add",className:"mt-3"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"名称"}),l.jsx("div",{className:"w-48",children:"服务商"}),l.jsx("div",{className:"w-52",children:"创建时间"}),l.jsx("div",{className:"w-52",children:"更新时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"授权列表"}),r.filter(_=>f?_.group==f:!0).slice(m,y).map(_=>{var p,h;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:_.name}),l.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[l.jsx("img",{src:(p=uo.get(_.configType))==null?void 0:p[1],className:"w-6"}),l.jsx("div",{children:(h=uo.get(_.configType))==null?void 0:h[0]})]}),l.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["创建于"," ",_.created&&ga(_.created)]}),l.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["更新于"," ",_.updated&&ga(_.updated)]}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(jl,{trigger:l.jsx(He,{variant:"link",className:"p-0",children:"编辑"}),op:"edit",data:_}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>{x(_)},children:"删除"})]})]},_.id)}),l.jsx(SC,{totalPages:s,currentPage:u,onPageChange:_=>{a.set("page",_.toString()),o({search:a.toString()})}})]})}),l.jsx(Gd,{value:"access_group",children:l.jsx(NU,{})})]})]})},DU=_c("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"}}),Cy=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx("div",{ref:n,role:"alert",className:ae(DU({variant:t}),e),...r}));Cy.displayName="Alert";const jy=v.forwardRef(({className:e,...t},r)=>l.jsx("h5",{ref:r,className:ae("mb-1 font-medium leading-none tracking-tight",e),...t}));jy.displayName="AlertTitle";const Ey=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("text-sm [&_p]:leading-relaxed",e),...t}));Ey.displayName="AlertDescription";const wN=async e=>{let t=1;e.page&&(t=e.page);let r=50;e.perPage&&(r=e.perPage);let n="domain!=null";return e.domain&&(n=`domain="${e.domain}"`),await st().collection("deployments").getList(t,r,{filter:n,sort:"-deployedAt",expand:"domain"})},OU=()=>{const e=Nr(),[t,r]=v.useState(),[n]=JP(),s=n.get("domain");return v.useEffect(()=>{(async()=>{const i={};s&&(i.domain=s);const a=await wN(i);r(a.items)})()},[s]),l.jsxs(ih,{className:"h-[80vh] overflow-hidden",children:[l.jsx("div",{className:"text-muted-foreground",children:"部署历史"}),t!=null&&t.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"域名"}),l.jsx("div",{className:"w-24",children:"状态"}),l.jsx("div",{className:"w-56",children:"阶段"}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),t==null?void 0:t.map(o=>{var i,a;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=o.expand.domain)==null?void 0:i.domain}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Gv,{deployment:o})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Hv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ga(o.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),l.jsxs(Rf,{className:"sm:max-w-5xl",children:[l.jsx(wv,{children:l.jsxs(_v,{children:[(a=o.expand.domain)==null?void 0:a.domain,"-",o.id,"部署详情"]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&l.jsx(l.Fragment,{children:o.log.check.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&l.jsx(l.Fragment,{children:o.log.apply.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>l.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&l.jsx(l.Fragment,{children:o.log.deploy.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]}):l.jsx(l.Fragment,{children:l.jsxs(Cy,{className:"max-w-[40em] mx-auto mt-20",children:[l.jsx(jy,{children:"暂无数据"}),l.jsxs(Ey,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(tb,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(He,{onClick:()=>{e("/")},children:"添加域名"})})]})]})})]})},MU=pe.object({username:pe.string().email({message:"请输入正确的邮箱地址"}),password:pe.string().min(10,{message:"密码至少10个字符"})}),IU=()=>{const e=Tr({resolver:Rr(MU),defaultValues:{username:"",password:""}}),t=async n=>{try{await st().admins.authWithPassword(n.username,n.password),r("/")}catch(s){const o=_o(s);e.setError("username",{message:o}),e.setError("password",{message:o})}},r=Nr();return l.jsxs("div",{className:"max-w-[35em] border dark:border-stone-500 mx-auto mt-32 p-10 rounded-md shadow-md",children:[l.jsx("div",{className:"flex justify-center mb-10",children:l.jsx("img",{src:"/vite.svg",className:"w-16"})}),l.jsx(Pr,{...e,children:l.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:e.control,name:"username",render:({field:n})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"email",...n})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:e.control,name:"password",render:({field:n})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"password",...n,type:"password"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"登录"})})]})})]})},LU=()=>st().authStore.isValid&&st().authStore.isAdmin?l.jsx(Q1,{to:"/"}):l.jsxs("div",{className:"container",children:[l.jsx(Ig,{}),l.jsx(cC,{})]}),FU=pe.object({oldPassword:pe.string().min(10,{message:"密码至少10个字符"}),newPassword:pe.string().min(10,{message:"密码至少10个字符"}),confirmPassword:pe.string().min(10,{message:"密码至少10个字符"})}).refine(e=>e.newPassword===e.confirmPassword,{message:"两次密码不一致",path:["confirmPassword"]}),zU=()=>{const{toast:e}=qn(),t=Nr(),r=Tr({resolver:Rr(FU),defaultValues:{oldPassword:"",newPassword:"",confirmPassword:""}}),n=async s=>{var o,i;try{await st().admins.authWithPassword((o=st().authStore.model)==null?void 0:o.email,s.oldPassword)}catch(a){const c=_o(a);r.setError("oldPassword",{message:c})}try{await st().admins.update((i=st().authStore.model)==null?void 0:i.id,{password:s.newPassword,passwordConfirm:s.confirmPassword}),st().authStore.clear(),e({title:"修改密码成功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(a){const c=_o(a);e({title:"修改密码失败",description:c,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(Pr,{...r,children:l.jsxs("form",{onSubmit:r.handleSubmit(n),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:r.control,name:"oldPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"当前密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"当前密码",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:r.control,name:"newPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"新密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"newPassword",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:r.control,name:"confirmPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"确认密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"confirmPassword",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"确认修改"})})]})})})})},UU=()=>{const e=Nn(),[t,r]=v.useState("account"),n=Nr();return v.useEffect(()=>{const o=e.pathname.split("/")[2];r(o)},[e]),l.jsxs("div",{children:[l.jsx(ay,{}),l.jsx("div",{className:"text-muted-foreground border-b dark:border-stone-500 py-5",children:"偏好设置"}),l.jsx("div",{className:"w-full mt-5 p-0 md:p-3 flex justify-center",children:l.jsxs(xN,{defaultValue:"account",className:"w-full",value:t,children:[l.jsxs(ky,{className:"mx-auto",children:[l.jsxs(ia,{value:"account",onClick:()=>{n("/setting/account")},className:"px-5",children:[l.jsx(wA,{size:14}),l.jsx("div",{className:"ml-1",children:"账户"})]}),l.jsxs(ia,{value:"password",onClick:()=>{n("/setting/password")},className:"px-5",children:[l.jsx(fA,{size:14}),l.jsx("div",{className:"ml-1",children:"密码"})]}),l.jsxs(ia,{value:"notify",onClick:()=>{n("/setting/notify")},className:"px-5",children:[l.jsx(mA,{size:14}),l.jsx("div",{className:"ml-1",children:"消息推送"})]})]}),l.jsx(Gd,{value:t,children:l.jsx("div",{className:"mt-5 w-full md:w-[45em]",children:l.jsx(Ig,{})})})]})})]})},$U=()=>{const[e,t]=v.useState(),[r,n]=v.useState(),s=Nr();return v.useEffect(()=>{(async()=>{const i=await Q6();t(i)})()},[]),v.useEffect(()=>{(async()=>{const a=await wN({perPage:8});n(a.items)})()},[]),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("div",{className:"flex justify-between items-center",children:l.jsx("div",{className:"text-muted-foreground",children:"控制面板"})}),l.jsxs("div",{className:"flex mt-10 gap-5 flex-col flex-wrap md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(yA,{size:48,strokeWidth:1,className:"text-blue-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"所有"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.total?l.jsx(fr,{to:"/domains",className:"hover:underline",children:e==null?void 0:e.total}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(oA,{size:48,strokeWidth:1,className:"text-red-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"即将过期"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.expired?l.jsx(fr,{to:"/domains?state=expired",className:"hover:underline",children:e==null?void 0:e.expired}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(pA,{size:48,strokeWidth:1,className:"text-green-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"启用中"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.enabled?l.jsx(fr,{to:"/domains?state=enabled",className:"hover:underline",children:e==null?void 0:e.enabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(nA,{size:48,strokeWidth:1,className:"text-gray-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"未启用"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.disabled?l.jsx(fr,{to:"/domains?state=disabled",className:"hover:underline",children:e==null?void 0:e.disabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground mt-5 text-sm",children:"部署历史"}),(r==null?void 0:r.length)==0?l.jsx(l.Fragment,{children:l.jsxs(Cy,{className:"max-w-[40em] mt-10",children:[l.jsx(jy,{children:"暂无数据"}),l.jsxs(Ey,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(tb,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(He,{onClick:()=>{s("/edit")},children:"添加域名"})})]})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"域名"}),l.jsx("div",{className:"w-24",children:"状态"}),l.jsx("div",{className:"w-56",children:"阶段"}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),r==null?void 0:r.map(o=>{var i,a;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=o.expand.domain)==null?void 0:i.domain}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Gv,{deployment:o})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Hv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ga(o.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),l.jsxs(Rf,{className:"sm:max-w-5xl",children:[l.jsx(wv,{children:l.jsxs(_v,{children:[(a=o.expand.domain)==null?void 0:a.domain,"-",o.id,"部署详情"]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&l.jsx(l.Fragment,{children:o.log.check.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&l.jsx(l.Fragment,{children:o.log.apply.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>l.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&l.jsx(l.Fragment,{children:o.log.deploy.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]})]})]})},VU=pe.object({email:pe.string().email("请输入正确的邮箱")}),WU=()=>{var i;const{toast:e}=qn(),t=Nr(),[r,n]=v.useState(!1),s=Tr({resolver:Rr(VU),defaultValues:{email:(i=st().authStore.model)==null?void 0:i.email}}),o=async a=>{var c;try{await st().admins.update((c=st().authStore.model)==null?void 0:c.id,{email:a.email}),st().authStore.clear(),e({title:"修改账户邮箱功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(u){const d=_o(u);e({title:"修改账户邮箱失败",description:d,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(Pr,{...s,children:l.jsxs("form",{onSubmit:s.handleSubmit(o),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:s.control,name:"email",render:({field:a})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...a,type:"email",onChange:c=>{n(!0),s.setValue("email",c.target.value)}})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:r?l.jsx(He,{type:"submit",children:"确认修改"}):l.jsx(He,{type:"submit",disabled:!0,variant:"secondary",children:"确认修改"})})]})})})})},BU=(e,t)=>{switch(t.type){case"SET_CHANNEL":{const r=t.payload.channel;return{...e,content:{...e.content,[r]:t.payload.data}}}case"SET_CHANNELS":return{...t.payload};default:return e}},_N=v.createContext({}),Ny=()=>v.useContext(_N),HU=({children:e})=>{const[t,r]=v.useReducer(BU,{});v.useEffect(()=>{(async()=>{const i=await sC("notifyChannels");r({type:"SET_CHANNELS",payload:i})})()},[]);const n=v.useCallback(o=>{r({type:"SET_CHANNEL",payload:o})},[]),s=v.useCallback(o=>{r({type:"SET_CHANNELS",payload:o})},[]);return l.jsx(_N.Provider,{value:{config:t,setChannel:n,setChannels:s},children:e})},YU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{accessToken:"",secret:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={accessToken:"",secret:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.dingtalk?u.dingtalk:c})();n({id:e.id??"",name:"dingtalk",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{const i=await Mc({...e,name:"notifyChannels",content:{...e.content,dingtalk:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"AccessToken",value:r.data.accessToken,onChange:i=>{n({...r,data:{...r.data,accessToken:i.target.value}})}}),l.jsx(Te,{placeholder:"加签的签名",className:"mt-2",value:r.data.secret,onChange:i=>{n({...r,data:{...r.data,secret:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})},ZU={title:"您有{COUNT}张证书即将过期",content:"有{COUNT}张证书即将过期,域名分别为{DOMAINS},请保持关注!"},KU=()=>{const[e,t]=v.useState(""),[r,n]=v.useState([ZU]),{toast:s}=qn();v.useEffect(()=>{(async()=>{const u=await sC("templates");u.content&&(n(u.content.notifyTemplates),t(u.id?u.id:""))})()},[]);const o=c=>{const u=r[0];n([{...u,title:c}])},i=c=>{const u=r[0];n([{...u,content:c}])},a=async()=>{const c=await Mc({id:e,content:{notifyTemplates:r},name:"templates"});c.id&&t(c.id),s({title:"保存成功",description:"通知模板保存成功"})};return l.jsxs("div",{children:[l.jsx(Te,{value:r[0].title,onChange:c=>{o(c.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数"}),l.jsx(mc,{className:"mt-2",value:r[0].content,onChange:c=>{i(c.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数,DOMAINS:域名列表"}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:a,children:"保存"})})]})},GU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{apiToken:"",chatId:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={apiToken:"",chatId:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.telegram?u.telegram:c})();n({id:e.id??"",name:"telegram",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{const i=await Mc({...e,name:"notifyChannels",content:{...e.content,telegram:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"ApiToken",value:r.data.apiToken,onChange:i=>{n({...r,data:{...r.data,apiToken:i.target.value}})}}),l.jsx(Te,{placeholder:"ChatId",value:r.data.chatId,onChange:i=>{n({...r,data:{...r.data,chatId:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};function qU(e){try{return new URL(e),!0}catch{return!1}}const XU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{url:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={url:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.webhook?u.webhook:c})();n({id:e.id??"",name:"webhook",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{if(r.data.url=r.data.url.trim(),!qU(r.data.url)){s({title:"保存失败",description:"Url格式不正确",variant:"destructive"});return}const i=await Mc({...e,name:"notifyChannels",content:{...e.content,webhook:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"Url",value:r.data.url,onChange:i=>{n({...r,data:{...r.data,url:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};var Ty="Collapsible",[QU,bN]=xr(Ty),[JU,Ry]=QU(Ty),SN=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:o,onOpenChange:i,...a}=e,[c=!1,u]=on({prop:n,defaultProp:s,onChange:i});return l.jsx(JU,{scope:r,disabled:o,contentId:Ur(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Re.div,{"data-state":Ay(c),"data-disabled":o?"":void 0,...a,ref:t})})});SN.displayName=Ty;var kN="CollapsibleTrigger",CN=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,s=Ry(kN,r);return l.jsx(Re.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Ay(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:ce(e.onClick,s.onOpenToggle)})});CN.displayName=kN;var Py="CollapsibleContent",jN=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Ry(Py,e.__scopeCollapsible);return l.jsx(ur,{present:r||s.open,children:({present:o})=>l.jsx(e$,{...n,ref:t,present:o})})});jN.displayName=Py;var e$=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:s,...o}=e,i=Ry(Py,r),[a,c]=v.useState(n),u=v.useRef(null),d=Ke(t,u),f=v.useRef(0),m=f.current,y=v.useRef(0),x=y.current,g=i.open||a,_=v.useRef(g),p=v.useRef();return v.useEffect(()=>{const h=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(h)},[]),Jt(()=>{const h=u.current;if(h){p.current=p.current||{transitionDuration:h.style.transitionDuration,animationName:h.style.animationName},h.style.transitionDuration="0s",h.style.animationName="none";const w=h.getBoundingClientRect();f.current=w.height,y.current=w.width,_.current||(h.style.transitionDuration=p.current.transitionDuration,h.style.animationName=p.current.animationName),c(n)}},[i.open,n]),l.jsx(Re.div,{"data-state":Ay(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...o,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:g&&s})});function Ay(e){return e?"open":"closed"}var t$=SN,r$=CN,n$=jN,Ms="Accordion",s$=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Dy,o$,i$]=bc(Ms),[ah,R$]=xr(Ms,[i$,bN]),Oy=bN(),EN=We.forwardRef((e,t)=>{const{type:r,...n}=e,s=n,o=n;return l.jsx(Dy.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?l.jsx(u$,{...o,ref:t}):l.jsx(c$,{...s,ref:t})})});EN.displayName=Ms;var[NN,a$]=ah(Ms),[TN,l$]=ah(Ms,{collapsible:!1}),c$=We.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},collapsible:o=!1,...i}=e,[a,c]=on({prop:r,defaultProp:n,onChange:s});return l.jsx(NN,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:c,onItemClose:We.useCallback(()=>o&&c(""),[o,c]),children:l.jsx(TN,{scope:e.__scopeAccordion,collapsible:o,children:l.jsx(RN,{...i,ref:t})})})}),u$=We.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[i=[],a]=on({prop:r,defaultProp:n,onChange:s}),c=We.useCallback(d=>a((f=[])=>[...f,d]),[a]),u=We.useCallback(d=>a((f=[])=>f.filter(m=>m!==d)),[a]);return l.jsx(NN,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:u,children:l.jsx(TN,{scope:e.__scopeAccordion,collapsible:!0,children:l.jsx(RN,{...o,ref:t})})})}),[d$,lh]=ah(Ms),RN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:n,dir:s,orientation:o="vertical",...i}=e,a=We.useRef(null),c=Ke(a,t),u=o$(r),f=Ea(s)==="ltr",m=ce(e.onKeyDown,y=>{var P;if(!s$.includes(y.key))return;const x=y.target,g=u().filter(A=>{var L;return!((L=A.ref.current)!=null&&L.disabled)}),_=g.findIndex(A=>A.ref.current===x),p=g.length;if(_===-1)return;y.preventDefault();let h=_;const w=0,C=p-1,j=()=>{h=_+1,h>C&&(h=w)},E=()=>{h=_-1,h{const{__scopeAccordion:r,value:n,...s}=e,o=lh(qd,r),i=a$(qd,r),a=Oy(r),c=Ur(),u=n&&i.value.includes(n)||!1,d=o.disabled||e.disabled;return l.jsx(f$,{scope:r,open:u,disabled:d,triggerId:c,children:l.jsx(t$,{"data-orientation":o.orientation,"data-state":LN(u),...a,...s,ref:t,disabled:d,open:u,onOpenChange:f=>{f?i.onItemOpen(n):i.onItemClose(n)}})})});PN.displayName=qd;var AN="AccordionHeader",DN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(AN,r);return l.jsx(Re.h3,{"data-orientation":s.orientation,"data-state":LN(o.open),"data-disabled":o.disabled?"":void 0,...n,ref:t})});DN.displayName=AN;var Im="AccordionTrigger",ON=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(Im,r),i=l$(Im,r),a=Oy(r);return l.jsx(Dy.ItemSlot,{scope:r,children:l.jsx(r$,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...a,...n,ref:t})})});ON.displayName=Im;var MN="AccordionContent",IN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(MN,r),i=Oy(r);return l.jsx(n$,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...i,...n,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});IN.displayName=MN;function LN(e){return e?"open":"closed"}var h$=EN,p$=PN,m$=DN,FN=ON,zN=IN;const ww=h$,ul=v.forwardRef(({className:e,...t},r)=>l.jsx(p$,{ref:r,className:ae("border-b",e),...t}));ul.displayName="AccordionItem";const dl=v.forwardRef(({className:e,children:t,...r},n)=>l.jsx(m$,{className:"flex",children:l.jsxs(FN,{ref:n,className:ae("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,l.jsx(Lg,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));dl.displayName=FN.displayName;const fl=v.forwardRef(({className:e,children:t,...r},n)=>l.jsx(zN,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:l.jsx("div",{className:ae("pb-4 pt-0",e),children:t})}));fl.displayName=zN.displayName;const g$=()=>l.jsx(l.Fragment,{children:l.jsxs(HU,{children:[l.jsx("div",{className:"border rounded-sm p-5 shadow-lg",children:l.jsx(ww,{type:"multiple",className:"dark:text-stone-200",children:l.jsxs(ul,{value:"item-1",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"模板"}),l.jsx(fl,{children:l.jsx(KU,{})})]})})}),l.jsx("div",{className:"border rounded-md p-5 mt-7 shadow-lg",children:l.jsxs(ww,{type:"single",className:"dark:text-stone-200",children:[l.jsxs(ul,{value:"item-2",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"钉钉"}),l.jsx(fl,{children:l.jsx(YU,{})})]}),l.jsxs(ul,{value:"item-4",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Telegram"}),l.jsx(fl,{children:l.jsx(GU,{})})]}),l.jsxs(ul,{value:"item-5",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Webhook"}),l.jsx(fl,{children:l.jsx(XU,{})})]})]})})]})}),v$=FP([{path:"/",element:l.jsx(M3,{}),children:[{path:"/",element:l.jsx($U,{})},{path:"/domains",element:l.jsx(nz,{})},{path:"/edit",element:l.jsx(EU,{})},{path:"/access",element:l.jsx(AU,{})},{path:"/history",element:l.jsx(OU,{})},{path:"/setting",element:l.jsx(UU,{}),children:[{path:"/setting/password",element:l.jsx(zU,{})},{path:"/setting/account",element:l.jsx(WU,{})},{path:"/setting/notify",element:l.jsx(g$,{})}]}]},{path:"/login",element:l.jsx(LU,{}),children:[{path:"/login",element:l.jsx(IU,{})}]},{path:"/about",element:l.jsx("div",{children:"About"})}]);ip.createRoot(document.getElementById("root")).render(l.jsx(We.StrictMode,{children:l.jsx(N3,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(ZP,{router:v$})})}))});export default y$(); +8.8.4.4;`,..._,className:"placeholder:whitespace-pre-wrap"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})})},eN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));eN.displayName="Card";const tN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("flex flex-col space-y-1.5 p-6",e),...t}));tN.displayName="CardHeader";const rN=v.forwardRef(({className:e,...t},r)=>l.jsx("h3",{ref:r,className:ae("text-2xl font-semibold leading-none tracking-tight",e),...t}));rN.displayName="CardTitle";const nN=v.forwardRef(({className:e,...t},r)=>l.jsx("p",{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));nN.displayName="CardDescription";const sN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("p-6 pt-0",e),...t}));sN.displayName="CardContent";const oN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("flex items-center p-6 pt-0",e),...t}));oN.displayName="CardFooter";const _o=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",EU=()=>{const{config:{accessGroups:e},reloadAccessGroups:t}=Kr(),{toast:r}=qn(),n=Nr(),s=async i=>{try{await _3(i),t()}catch(a){r({title:"删除失败",description:_o(a),variant:"destructive"});return}},o=()=>{n("/access")};return l.jsxs("div",{className:"mt-10",children:[l.jsx(na,{when:e.length==0,children:l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(v0,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(_y,{trigger:l.jsx(He,{children:"新增授权组"}),className:"mt-3"})]})})}),l.jsx(ih,{className:"h-[75vh] overflow-hidden",children:l.jsx("div",{className:"flex gap-5 flex-wrap",children:e.map(i=>l.jsxs(eN,{className:"w-full md:w-[350px]",children:[l.jsxs(tN,{children:[l.jsx(rN,{children:i.name}),l.jsxs(nN,{children:["共有",i.expand?i.expand.access.length:0,"个部署授权配置"]})]}),l.jsx(sN,{className:"min-h-[180px]",children:i.expand?l.jsx(l.Fragment,{children:i.expand.access.slice(0,3).map(a=>l.jsx("div",{className:"flex flex-col mb-3",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"",children:l.jsx("img",{src:xw(a.configType)[1],alt:"provider",className:"w-8 h-8"})}),l.jsxs("div",{className:"ml-3",children:[l.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:a.name}),l.jsx("div",{className:"text-xs text-muted-foreground",children:xw(a.configType)[0]})]})]})},a.id))}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex text-gray-700 dark:text-gray-200 items-center",children:[l.jsx("div",{children:l.jsx(v0,{size:40})}),l.jsx("div",{className:"ml-2",children:"暂无部署授权配置,请添加后开始使用吧"})]})})}),l.jsx(oN,{children:l.jsxs("div",{className:"flex justify-end w-full",children:[l.jsx(na,{when:!!(i.expand&&i.expand.access.length>0),children:l.jsx("div",{children:l.jsx(He,{size:"sm",variant:"link",onClick:()=>{n(`/access?accessGroupId=${i.id}&tab=access`,{replace:!0})},children:"所有授权"})})}),l.jsx(na,{when:!i.expand||i.expand.access.length==0,children:l.jsx("div",{children:l.jsx(He,{size:"sm",onClick:o,children:"新增授权"})})}),l.jsx("div",{className:"ml-3",children:l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"destructive",size:"sm",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{className:"dark:text-gray-200",children:"删除组"}),l.jsx(ey,{children:"确定要删除部署授权组吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{className:"dark:text-gray-200",children:"取消"}),l.jsx(ty,{onClick:()=>{s(i.id?i.id:"")},children:"确认"})]})]})]})})]})})]}))})})]})};var by="Tabs",[NU,N$]=xr(by,[kf]),iN=kf(),[TU,Sy]=NU(by),aN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Ea(a),[f,m]=on({prop:n,onChange:s,defaultProp:o});return l.jsx(TU,{scope:r,baseId:Ur(),value:f,onValueChange:m,orientation:i,dir:d,activationMode:c,children:l.jsx(Re.div,{dir:d,"data-orientation":i,...u,ref:t})})});aN.displayName=by;var lN="TabsList",cN=v.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,o=Sy(lN,r),i=iN(r);return l.jsx(Fb,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:l.jsx(Re.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});cN.displayName=lN;var uN="TabsTrigger",dN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...o}=e,i=Sy(uN,r),a=iN(r),c=pN(i.baseId,n),u=mN(i.baseId,n),d=n===i.value;return l.jsx(zb,{asChild:!0,...a,focusable:!s,active:d,children:l.jsx(Re.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,...o,ref:t,onMouseDown:ce(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(n):f.preventDefault()}),onKeyDown:ce(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(n)}),onFocus:ce(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(n)})})})});dN.displayName=uN;var fN="TabsContent",hN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:o,...i}=e,a=Sy(fN,r),c=pN(a.baseId,n),u=mN(a.baseId,n),d=n===a.value,f=v.useRef(d);return v.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(ur,{present:s||d,children:({present:m})=>l.jsx(Re.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&o})})});hN.displayName=fN;function pN(e,t){return`${e}-trigger-${t}`}function mN(e,t){return`${e}-content-${t}`}var RU=aN,gN=cN,vN=dN,yN=hN;const xN=RU,ky=v.forwardRef(({className:e,...t},r)=>l.jsx(gN,{ref:r,className:ae("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ky.displayName=gN.displayName;const ia=v.forwardRef(({className:e,...t},r)=>l.jsx(vN,{ref:r,className:ae("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}));ia.displayName=vN.displayName;const Gd=v.forwardRef(({className:e,...t},r)=>l.jsx(yN,{ref:r,className:ae("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Gd.displayName=yN.displayName;const PU=()=>{const{config:e,deleteAccess:t}=Kr(),{accesses:r}=e,n=10,s=Math.ceil(r.length/n),o=Nr(),i=Nn(),a=new URLSearchParams(i.search),c=a.get("page"),u=c?Number(c):1,d=a.get("tab"),f=a.get("accessGroupId"),m=(u-1)*n,y=m+n,x=async _=>{const p=await w3(_);t(p.id)},g=_=>{a.set("tab",_),o({search:a.toString()})};return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"授权管理"}),d!="access_group"?l.jsx(jl,{trigger:l.jsx(He,{children:"添加授权"}),op:"add"}):l.jsx(_y,{trigger:l.jsx(He,{children:"添加授权组"})})]}),l.jsxs(xN,{defaultValue:d||"access",value:d||"access",className:"w-full mt-5",children:[l.jsxs(ky,{className:"space-x-5 px-3",children:[l.jsx(ia,{value:"access",onClick:()=>{g("access")},children:"授权管理"}),l.jsx(ia,{value:"access_group",onClick:()=>{g("access_group")},children:"授权组管理"})]}),l.jsx(Gd,{value:"access",children:r.length===0?l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(hA,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加授权开始部署证书吧。"}),l.jsx(jl,{trigger:l.jsx(He,{children:"添加授权"}),op:"add",className:"mt-3"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"名称"}),l.jsx("div",{className:"w-48",children:"服务商"}),l.jsx("div",{className:"w-52",children:"创建时间"}),l.jsx("div",{className:"w-52",children:"更新时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"授权列表"}),r.filter(_=>f?_.group==f:!0).slice(m,y).map(_=>{var p,h;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:_.name}),l.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[l.jsx("img",{src:(p=uo.get(_.configType))==null?void 0:p[1],className:"w-6"}),l.jsx("div",{children:(h=uo.get(_.configType))==null?void 0:h[0]})]}),l.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["创建于"," ",_.created&&ga(_.created)]}),l.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["更新于"," ",_.updated&&ga(_.updated)]}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(jl,{trigger:l.jsx(He,{variant:"link",className:"p-0",children:"编辑"}),op:"edit",data:_}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>{x(_)},children:"删除"})]})]},_.id)}),l.jsx(SC,{totalPages:s,currentPage:u,onPageChange:_=>{a.set("page",_.toString()),o({search:a.toString()})}})]})}),l.jsx(Gd,{value:"access_group",children:l.jsx(EU,{})})]})]})},AU=_c("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"}}),Cy=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx("div",{ref:n,role:"alert",className:ae(AU({variant:t}),e),...r}));Cy.displayName="Alert";const jy=v.forwardRef(({className:e,...t},r)=>l.jsx("h5",{ref:r,className:ae("mb-1 font-medium leading-none tracking-tight",e),...t}));jy.displayName="AlertTitle";const Ey=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("text-sm [&_p]:leading-relaxed",e),...t}));Ey.displayName="AlertDescription";const wN=async e=>{let t=1;e.page&&(t=e.page);let r=50;e.perPage&&(r=e.perPage);let n="domain!=null";return e.domain&&(n=`domain="${e.domain}"`),await st().collection("deployments").getList(t,r,{filter:n,sort:"-deployedAt",expand:"domain"})},DU=()=>{const e=Nr(),[t,r]=v.useState(),[n]=JP(),s=n.get("domain");return v.useEffect(()=>{(async()=>{const i={};s&&(i.domain=s);const a=await wN(i);r(a.items)})()},[s]),l.jsxs(ih,{className:"h-[80vh] overflow-hidden",children:[l.jsx("div",{className:"text-muted-foreground",children:"部署历史"}),t!=null&&t.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"域名"}),l.jsx("div",{className:"w-24",children:"状态"}),l.jsx("div",{className:"w-56",children:"阶段"}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),t==null?void 0:t.map(o=>{var i,a;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=o.expand.domain)==null?void 0:i.domain}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Gv,{deployment:o})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Hv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ga(o.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),l.jsxs(Rf,{className:"sm:max-w-5xl",children:[l.jsx(wv,{children:l.jsxs(_v,{children:[(a=o.expand.domain)==null?void 0:a.domain,"-",o.id,"部署详情"]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&l.jsx(l.Fragment,{children:o.log.check.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&l.jsx(l.Fragment,{children:o.log.apply.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>l.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&l.jsx(l.Fragment,{children:o.log.deploy.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]}):l.jsx(l.Fragment,{children:l.jsxs(Cy,{className:"max-w-[40em] mx-auto mt-20",children:[l.jsx(jy,{children:"暂无数据"}),l.jsxs(Ey,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(tb,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(He,{onClick:()=>{e("/")},children:"添加域名"})})]})]})})]})},OU=pe.object({username:pe.string().email({message:"请输入正确的邮箱地址"}),password:pe.string().min(10,{message:"密码至少10个字符"})}),MU=()=>{const e=Tr({resolver:Rr(OU),defaultValues:{username:"",password:""}}),t=async n=>{try{await st().admins.authWithPassword(n.username,n.password),r("/")}catch(s){const o=_o(s);e.setError("username",{message:o}),e.setError("password",{message:o})}},r=Nr();return l.jsxs("div",{className:"max-w-[35em] border dark:border-stone-500 mx-auto mt-32 p-10 rounded-md shadow-md",children:[l.jsx("div",{className:"flex justify-center mb-10",children:l.jsx("img",{src:"/vite.svg",className:"w-16"})}),l.jsx(Pr,{...e,children:l.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:e.control,name:"username",render:({field:n})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"email",...n})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:e.control,name:"password",render:({field:n})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"password",...n,type:"password"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"登录"})})]})})]})},IU=()=>st().authStore.isValid&&st().authStore.isAdmin?l.jsx(Q1,{to:"/"}):l.jsxs("div",{className:"container",children:[l.jsx(Ig,{}),l.jsx(cC,{})]}),LU=pe.object({oldPassword:pe.string().min(10,{message:"密码至少10个字符"}),newPassword:pe.string().min(10,{message:"密码至少10个字符"}),confirmPassword:pe.string().min(10,{message:"密码至少10个字符"})}).refine(e=>e.newPassword===e.confirmPassword,{message:"两次密码不一致",path:["confirmPassword"]}),FU=()=>{const{toast:e}=qn(),t=Nr(),r=Tr({resolver:Rr(LU),defaultValues:{oldPassword:"",newPassword:"",confirmPassword:""}}),n=async s=>{var o,i;try{await st().admins.authWithPassword((o=st().authStore.model)==null?void 0:o.email,s.oldPassword)}catch(a){const c=_o(a);r.setError("oldPassword",{message:c})}try{await st().admins.update((i=st().authStore.model)==null?void 0:i.id,{password:s.newPassword,passwordConfirm:s.confirmPassword}),st().authStore.clear(),e({title:"修改密码成功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(a){const c=_o(a);e({title:"修改密码失败",description:c,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(Pr,{...r,children:l.jsxs("form",{onSubmit:r.handleSubmit(n),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:r.control,name:"oldPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"当前密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"当前密码",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:r.control,name:"newPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"新密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"newPassword",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:r.control,name:"confirmPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"确认密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"confirmPassword",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"确认修改"})})]})})})})},zU=()=>{const e=Nn(),[t,r]=v.useState("account"),n=Nr();return v.useEffect(()=>{const o=e.pathname.split("/")[2];r(o)},[e]),l.jsxs("div",{children:[l.jsx(ay,{}),l.jsx("div",{className:"text-muted-foreground border-b dark:border-stone-500 py-5",children:"偏好设置"}),l.jsx("div",{className:"w-full mt-5 p-0 md:p-3 flex justify-center",children:l.jsxs(xN,{defaultValue:"account",className:"w-full",value:t,children:[l.jsxs(ky,{className:"mx-auto",children:[l.jsxs(ia,{value:"account",onClick:()=>{n("/setting/account")},className:"px-5",children:[l.jsx(wA,{size:14}),l.jsx("div",{className:"ml-1",children:"账户"})]}),l.jsxs(ia,{value:"password",onClick:()=>{n("/setting/password")},className:"px-5",children:[l.jsx(fA,{size:14}),l.jsx("div",{className:"ml-1",children:"密码"})]}),l.jsxs(ia,{value:"notify",onClick:()=>{n("/setting/notify")},className:"px-5",children:[l.jsx(mA,{size:14}),l.jsx("div",{className:"ml-1",children:"消息推送"})]})]}),l.jsx(Gd,{value:t,children:l.jsx("div",{className:"mt-5 w-full md:w-[45em]",children:l.jsx(Ig,{})})})]})})]})},UU=()=>{const[e,t]=v.useState(),[r,n]=v.useState(),s=Nr();return v.useEffect(()=>{(async()=>{const i=await X6();t(i)})()},[]),v.useEffect(()=>{(async()=>{const a=await wN({perPage:8});n(a.items)})()},[]),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("div",{className:"flex justify-between items-center",children:l.jsx("div",{className:"text-muted-foreground",children:"控制面板"})}),l.jsxs("div",{className:"flex mt-10 gap-5 flex-col flex-wrap md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(yA,{size:48,strokeWidth:1,className:"text-blue-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"所有"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.total?l.jsx(fr,{to:"/domains",className:"hover:underline",children:e==null?void 0:e.total}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(oA,{size:48,strokeWidth:1,className:"text-red-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"即将过期"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.expired?l.jsx(fr,{to:"/domains?state=expired",className:"hover:underline",children:e==null?void 0:e.expired}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(pA,{size:48,strokeWidth:1,className:"text-green-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"启用中"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.enabled?l.jsx(fr,{to:"/domains?state=enabled",className:"hover:underline",children:e==null?void 0:e.enabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(nA,{size:48,strokeWidth:1,className:"text-gray-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"未启用"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.disabled?l.jsx(fr,{to:"/domains?state=disabled",className:"hover:underline",children:e==null?void 0:e.disabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground mt-5 text-sm",children:"部署历史"}),(r==null?void 0:r.length)==0?l.jsx(l.Fragment,{children:l.jsxs(Cy,{className:"max-w-[40em] mt-10",children:[l.jsx(jy,{children:"暂无数据"}),l.jsxs(Ey,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(tb,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(He,{onClick:()=>{s("/edit")},children:"添加域名"})})]})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"域名"}),l.jsx("div",{className:"w-24",children:"状态"}),l.jsx("div",{className:"w-56",children:"阶段"}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),r==null?void 0:r.map(o=>{var i,a;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=o.expand.domain)==null?void 0:i.domain}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Gv,{deployment:o})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Hv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ga(o.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),l.jsxs(Rf,{className:"sm:max-w-5xl",children:[l.jsx(wv,{children:l.jsxs(_v,{children:[(a=o.expand.domain)==null?void 0:a.domain,"-",o.id,"部署详情"]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&l.jsx(l.Fragment,{children:o.log.check.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&l.jsx(l.Fragment,{children:o.log.apply.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>l.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&l.jsx(l.Fragment,{children:o.log.deploy.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]})]})]})},$U=pe.object({email:pe.string().email("请输入正确的邮箱")}),VU=()=>{var i;const{toast:e}=qn(),t=Nr(),[r,n]=v.useState(!1),s=Tr({resolver:Rr($U),defaultValues:{email:(i=st().authStore.model)==null?void 0:i.email}}),o=async a=>{var c;try{await st().admins.update((c=st().authStore.model)==null?void 0:c.id,{email:a.email}),st().authStore.clear(),e({title:"修改账户邮箱功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(u){const d=_o(u);e({title:"修改账户邮箱失败",description:d,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(Pr,{...s,children:l.jsxs("form",{onSubmit:s.handleSubmit(o),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:s.control,name:"email",render:({field:a})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...a,type:"email",onChange:c=>{n(!0),s.setValue("email",c.target.value)}})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:r?l.jsx(He,{type:"submit",children:"确认修改"}):l.jsx(He,{type:"submit",disabled:!0,variant:"secondary",children:"确认修改"})})]})})})})},WU=(e,t)=>{switch(t.type){case"SET_CHANNEL":{const r=t.payload.channel;return{...e,content:{...e.content,[r]:t.payload.data}}}case"SET_CHANNELS":return{...t.payload};default:return e}},_N=v.createContext({}),Ny=()=>v.useContext(_N),BU=({children:e})=>{const[t,r]=v.useReducer(WU,{});v.useEffect(()=>{(async()=>{const i=await sC("notifyChannels");r({type:"SET_CHANNELS",payload:i})})()},[]);const n=v.useCallback(o=>{r({type:"SET_CHANNEL",payload:o})},[]),s=v.useCallback(o=>{r({type:"SET_CHANNELS",payload:o})},[]);return l.jsx(_N.Provider,{value:{config:t,setChannel:n,setChannels:s},children:e})},HU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{accessToken:"",secret:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={accessToken:"",secret:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.dingtalk?u.dingtalk:c})();n({id:e.id??"",name:"dingtalk",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{const i=await Mc({...e,name:"notifyChannels",content:{...e.content,dingtalk:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"AccessToken",value:r.data.accessToken,onChange:i=>{n({...r,data:{...r.data,accessToken:i.target.value}})}}),l.jsx(Te,{placeholder:"加签的签名",className:"mt-2",value:r.data.secret,onChange:i=>{n({...r,data:{...r.data,secret:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})},YU={title:"您有{COUNT}张证书即将过期",content:"有{COUNT}张证书即将过期,域名分别为{DOMAINS},请保持关注!"},ZU=()=>{const[e,t]=v.useState(""),[r,n]=v.useState([YU]),{toast:s}=qn();v.useEffect(()=>{(async()=>{const u=await sC("templates");u.content&&(n(u.content.notifyTemplates),t(u.id?u.id:""))})()},[]);const o=c=>{const u=r[0];n([{...u,title:c}])},i=c=>{const u=r[0];n([{...u,content:c}])},a=async()=>{const c=await Mc({id:e,content:{notifyTemplates:r},name:"templates"});c.id&&t(c.id),s({title:"保存成功",description:"通知模板保存成功"})};return l.jsxs("div",{children:[l.jsx(Te,{value:r[0].title,onChange:c=>{o(c.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数"}),l.jsx(mc,{className:"mt-2",value:r[0].content,onChange:c=>{i(c.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数,DOMAINS:域名列表"}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:a,children:"保存"})})]})},KU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{apiToken:"",chatId:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={apiToken:"",chatId:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.telegram?u.telegram:c})();n({id:e.id??"",name:"telegram",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{const i=await Mc({...e,name:"notifyChannels",content:{...e.content,telegram:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"ApiToken",value:r.data.apiToken,onChange:i=>{n({...r,data:{...r.data,apiToken:i.target.value}})}}),l.jsx(Te,{placeholder:"ChatId",value:r.data.chatId,onChange:i=>{n({...r,data:{...r.data,chatId:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};function GU(e){try{return new URL(e),!0}catch{return!1}}const qU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{url:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={url:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.webhook?u.webhook:c})();n({id:e.id??"",name:"webhook",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{if(r.data.url=r.data.url.trim(),!GU(r.data.url)){s({title:"保存失败",description:"Url格式不正确",variant:"destructive"});return}const i=await Mc({...e,name:"notifyChannels",content:{...e.content,webhook:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"Url",value:r.data.url,onChange:i=>{n({...r,data:{...r.data,url:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};var Ty="Collapsible",[XU,bN]=xr(Ty),[QU,Ry]=XU(Ty),SN=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:o,onOpenChange:i,...a}=e,[c=!1,u]=on({prop:n,defaultProp:s,onChange:i});return l.jsx(QU,{scope:r,disabled:o,contentId:Ur(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Re.div,{"data-state":Ay(c),"data-disabled":o?"":void 0,...a,ref:t})})});SN.displayName=Ty;var kN="CollapsibleTrigger",CN=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,s=Ry(kN,r);return l.jsx(Re.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Ay(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:ce(e.onClick,s.onOpenToggle)})});CN.displayName=kN;var Py="CollapsibleContent",jN=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Ry(Py,e.__scopeCollapsible);return l.jsx(ur,{present:r||s.open,children:({present:o})=>l.jsx(JU,{...n,ref:t,present:o})})});jN.displayName=Py;var JU=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:s,...o}=e,i=Ry(Py,r),[a,c]=v.useState(n),u=v.useRef(null),d=Ke(t,u),f=v.useRef(0),m=f.current,y=v.useRef(0),x=y.current,g=i.open||a,_=v.useRef(g),p=v.useRef();return v.useEffect(()=>{const h=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(h)},[]),Jt(()=>{const h=u.current;if(h){p.current=p.current||{transitionDuration:h.style.transitionDuration,animationName:h.style.animationName},h.style.transitionDuration="0s",h.style.animationName="none";const w=h.getBoundingClientRect();f.current=w.height,y.current=w.width,_.current||(h.style.transitionDuration=p.current.transitionDuration,h.style.animationName=p.current.animationName),c(n)}},[i.open,n]),l.jsx(Re.div,{"data-state":Ay(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...o,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:g&&s})});function Ay(e){return e?"open":"closed"}var e$=SN,t$=CN,r$=jN,Ms="Accordion",n$=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Dy,s$,o$]=bc(Ms),[ah,T$]=xr(Ms,[o$,bN]),Oy=bN(),EN=We.forwardRef((e,t)=>{const{type:r,...n}=e,s=n,o=n;return l.jsx(Dy.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?l.jsx(c$,{...o,ref:t}):l.jsx(l$,{...s,ref:t})})});EN.displayName=Ms;var[NN,i$]=ah(Ms),[TN,a$]=ah(Ms,{collapsible:!1}),l$=We.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},collapsible:o=!1,...i}=e,[a,c]=on({prop:r,defaultProp:n,onChange:s});return l.jsx(NN,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:c,onItemClose:We.useCallback(()=>o&&c(""),[o,c]),children:l.jsx(TN,{scope:e.__scopeAccordion,collapsible:o,children:l.jsx(RN,{...i,ref:t})})})}),c$=We.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[i=[],a]=on({prop:r,defaultProp:n,onChange:s}),c=We.useCallback(d=>a((f=[])=>[...f,d]),[a]),u=We.useCallback(d=>a((f=[])=>f.filter(m=>m!==d)),[a]);return l.jsx(NN,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:u,children:l.jsx(TN,{scope:e.__scopeAccordion,collapsible:!0,children:l.jsx(RN,{...o,ref:t})})})}),[u$,lh]=ah(Ms),RN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:n,dir:s,orientation:o="vertical",...i}=e,a=We.useRef(null),c=Ke(a,t),u=s$(r),f=Ea(s)==="ltr",m=ce(e.onKeyDown,y=>{var P;if(!n$.includes(y.key))return;const x=y.target,g=u().filter(A=>{var L;return!((L=A.ref.current)!=null&&L.disabled)}),_=g.findIndex(A=>A.ref.current===x),p=g.length;if(_===-1)return;y.preventDefault();let h=_;const w=0,C=p-1,j=()=>{h=_+1,h>C&&(h=w)},E=()=>{h=_-1,h{const{__scopeAccordion:r,value:n,...s}=e,o=lh(qd,r),i=i$(qd,r),a=Oy(r),c=Ur(),u=n&&i.value.includes(n)||!1,d=o.disabled||e.disabled;return l.jsx(d$,{scope:r,open:u,disabled:d,triggerId:c,children:l.jsx(e$,{"data-orientation":o.orientation,"data-state":LN(u),...a,...s,ref:t,disabled:d,open:u,onOpenChange:f=>{f?i.onItemOpen(n):i.onItemClose(n)}})})});PN.displayName=qd;var AN="AccordionHeader",DN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(AN,r);return l.jsx(Re.h3,{"data-orientation":s.orientation,"data-state":LN(o.open),"data-disabled":o.disabled?"":void 0,...n,ref:t})});DN.displayName=AN;var Im="AccordionTrigger",ON=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(Im,r),i=a$(Im,r),a=Oy(r);return l.jsx(Dy.ItemSlot,{scope:r,children:l.jsx(t$,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...a,...n,ref:t})})});ON.displayName=Im;var MN="AccordionContent",IN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(MN,r),i=Oy(r);return l.jsx(r$,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...i,...n,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});IN.displayName=MN;function LN(e){return e?"open":"closed"}var f$=EN,h$=PN,p$=DN,FN=ON,zN=IN;const ww=f$,ul=v.forwardRef(({className:e,...t},r)=>l.jsx(h$,{ref:r,className:ae("border-b",e),...t}));ul.displayName="AccordionItem";const dl=v.forwardRef(({className:e,children:t,...r},n)=>l.jsx(p$,{className:"flex",children:l.jsxs(FN,{ref:n,className:ae("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,l.jsx(Lg,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));dl.displayName=FN.displayName;const fl=v.forwardRef(({className:e,children:t,...r},n)=>l.jsx(zN,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:l.jsx("div",{className:ae("pb-4 pt-0",e),children:t})}));fl.displayName=zN.displayName;const m$=()=>l.jsx(l.Fragment,{children:l.jsxs(BU,{children:[l.jsx("div",{className:"border rounded-sm p-5 shadow-lg",children:l.jsx(ww,{type:"multiple",className:"dark:text-stone-200",children:l.jsxs(ul,{value:"item-1",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"模板"}),l.jsx(fl,{children:l.jsx(ZU,{})})]})})}),l.jsx("div",{className:"border rounded-md p-5 mt-7 shadow-lg",children:l.jsxs(ww,{type:"single",className:"dark:text-stone-200",children:[l.jsxs(ul,{value:"item-2",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"钉钉"}),l.jsx(fl,{children:l.jsx(HU,{})})]}),l.jsxs(ul,{value:"item-4",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Telegram"}),l.jsx(fl,{children:l.jsx(KU,{})})]}),l.jsxs(ul,{value:"item-5",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Webhook"}),l.jsx(fl,{children:l.jsx(qU,{})})]})]})})]})}),g$=FP([{path:"/",element:l.jsx(O3,{}),children:[{path:"/",element:l.jsx(UU,{})},{path:"/domains",element:l.jsx(rz,{})},{path:"/edit",element:l.jsx(jU,{})},{path:"/access",element:l.jsx(PU,{})},{path:"/history",element:l.jsx(DU,{})},{path:"/setting",element:l.jsx(zU,{}),children:[{path:"/setting/password",element:l.jsx(FU,{})},{path:"/setting/account",element:l.jsx(VU,{})},{path:"/setting/notify",element:l.jsx(m$,{})}]}]},{path:"/login",element:l.jsx(IU,{}),children:[{path:"/login",element:l.jsx(MU,{})}]},{path:"/about",element:l.jsx("div",{children:"About"})}]);ip.createRoot(document.getElementById("root")).render(l.jsx(We.StrictMode,{children:l.jsx(E3,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(ZP,{router:g$})})}))});export default v$(); diff --git a/ui/dist/index.html b/ui/dist/index.html index 0635c061..89f70228 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -5,7 +5,7 @@ Certimate - Your Trusted SSL Automation Partner - + diff --git a/ui/package-lock.json b/ui/package-lock.json index 12c292c6..408326c3 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -53,7 +53,7 @@ "eslint-plugin-react-refresh": "^0.4.7", "postcss": "^8.4.40", "tailwindcss": "^3.4.7", - "typescript": "^5.2.2", + "typescript": "^5.6.2", "vite": "^5.3.4" } }, @@ -2100,9 +2100,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.19.0.tgz", - "integrity": "sha512-JlPfZ/C7yn5S5p0yKk7uhHTTnFlvTgLetl2VxqE518QgyM7C9bSfFTYvB/Q/ftkq0RIPY4ySxTz+/wKJ/dXC0w==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz", + "integrity": "sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w==", "cpu": [ "arm" ], @@ -2113,9 +2113,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.19.0.tgz", - "integrity": "sha512-RDxUSY8D1tWYfn00DDi5myxKgOk6RvWPxhmWexcICt/MEC6yEMr4HNCu1sXXYLw8iAsg0D44NuU+qNq7zVWCrw==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz", + "integrity": "sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA==", "cpu": [ "arm64" ], @@ -2126,9 +2126,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.19.0.tgz", - "integrity": "sha512-emvKHL4B15x6nlNTBMtIaC9tLPRpeA5jMvRLXVbl/W9Ie7HhkrE7KQjvgS9uxgatL1HmHWDXk5TTS4IaNJxbAA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz", + "integrity": "sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q==", "cpu": [ "arm64" ], @@ -2139,9 +2139,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.19.0.tgz", - "integrity": "sha512-fO28cWA1dC57qCd+D0rfLC4VPbh6EOJXrreBmFLWPGI9dpMlER2YwSPZzSGfq11XgcEpPukPTfEVFtw2q2nYJg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz", + "integrity": "sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw==", "cpu": [ "x64" ], @@ -2152,9 +2152,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.19.0.tgz", - "integrity": "sha512-2Rn36Ubxdv32NUcfm0wB1tgKqkQuft00PtM23VqLuCUR4N5jcNWDoV5iBC9jeGdgS38WK66ElncprqgMUOyomw==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz", + "integrity": "sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ==", "cpu": [ "arm" ], @@ -2165,9 +2165,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.19.0.tgz", - "integrity": "sha512-gJuzIVdq/X1ZA2bHeCGCISe0VWqCoNT8BvkQ+BfsixXwTOndhtLUpOg0A1Fcx/+eA6ei6rMBzlOz4JzmiDw7JQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz", + "integrity": "sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg==", "cpu": [ "arm" ], @@ -2178,9 +2178,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.19.0.tgz", - "integrity": "sha512-0EkX2HYPkSADo9cfeGFoQ7R0/wTKb7q6DdwI4Yn/ULFE1wuRRCHybxpl2goQrx4c/yzK3I8OlgtBu4xvted0ug==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz", + "integrity": "sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw==", "cpu": [ "arm64" ], @@ -2191,9 +2191,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.19.0.tgz", - "integrity": "sha512-GlIQRj9px52ISomIOEUq/IojLZqzkvRpdP3cLgIE1wUWaiU5Takwlzpz002q0Nxxr1y2ZgxC2obWxjr13lvxNQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz", + "integrity": "sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA==", "cpu": [ "arm64" ], @@ -2204,9 +2204,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.19.0.tgz", - "integrity": "sha512-N6cFJzssruDLUOKfEKeovCKiHcdwVYOT1Hs6dovDQ61+Y9n3Ek4zXvtghPPelt6U0AH4aDGnDLb83uiJMkWYzQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz", + "integrity": "sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg==", "cpu": [ "ppc64" ], @@ -2217,9 +2217,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.19.0.tgz", - "integrity": "sha512-2DnD3mkS2uuam/alF+I7M84koGwvn3ZVD7uG+LEWpyzo/bq8+kKnus2EVCkcvh6PlNB8QPNFOz6fWd5N8o1CYg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz", + "integrity": "sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA==", "cpu": [ "riscv64" ], @@ -2230,9 +2230,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.19.0.tgz", - "integrity": "sha512-D6pkaF7OpE7lzlTOFCB2m3Ngzu2ykw40Nka9WmKGUOTS3xcIieHe82slQlNq69sVB04ch73thKYIWz/Ian8DUA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz", + "integrity": "sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q==", "cpu": [ "s390x" ], @@ -2243,9 +2243,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.19.0.tgz", - "integrity": "sha512-HBndjQLP8OsdJNSxpNIN0einbDmRFg9+UQeZV1eiYupIRuZsDEoeGU43NQsS34Pp166DtwQOnpcbV/zQxM+rWA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz", + "integrity": "sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg==", "cpu": [ "x64" ], @@ -2256,9 +2256,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.19.0.tgz", - "integrity": "sha512-HxfbvfCKJe/RMYJJn0a12eiOI9OOtAUF4G6ozrFUK95BNyoJaSiBjIOHjZskTUffUrB84IPKkFG9H9nEvJGW6A==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz", + "integrity": "sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g==", "cpu": [ "x64" ], @@ -2269,9 +2269,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.19.0.tgz", - "integrity": "sha512-HxDMKIhmcguGTiP5TsLNolwBUK3nGGUEoV/BO9ldUBoMLBssvh4J0X8pf11i1fTV7WShWItB1bKAKjX4RQeYmg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz", + "integrity": "sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw==", "cpu": [ "arm64" ], @@ -2282,9 +2282,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.19.0.tgz", - "integrity": "sha512-xItlIAZZaiG/u0wooGzRsx11rokP4qyc/79LkAOdznGRAbOFc+SfEdfUOszG1odsHNgwippUJavag/+W/Etc6Q==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz", + "integrity": "sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g==", "cpu": [ "ia32" ], @@ -2295,9 +2295,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.19.0.tgz", - "integrity": "sha512-xNo5fV5ycvCCKqiZcpB65VMR11NJB+StnxHz20jdqRAktfdfzhgjTiJ2doTDQE/7dqGaV5I7ZGqKpgph6lCIag==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz", + "integrity": "sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q==", "cpu": [ "x64" ], @@ -2350,7 +2350,7 @@ }, "node_modules/@types/estree": { "version": "1.0.5", - "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.5.tgz", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, @@ -4032,9 +4032,9 @@ } }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -4290,9 +4290,9 @@ } }, "node_modules/picocolors": { - "version": "1.0.1", - "resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -4327,9 +4327,9 @@ "integrity": "sha512-WJHyaqdAt95JgZ1OCRD099+DST4IIG0M/jMrCckWYDSN/6ocp61qsz7m6h0xI0J2N79ScBljceEC0fFAaQrrAw==" }, "node_modules/postcss": { - "version": "8.4.40", - "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.40.tgz", - "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==", + "version": "8.4.47", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", + "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", "funding": [ { "type": "opencollective", @@ -4346,8 +4346,8 @@ ], "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" + "picocolors": "^1.1.0", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -4743,9 +4743,9 @@ } }, "node_modules/rollup": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.19.0.tgz", - "integrity": "sha512-5r7EYSQIowHsK4eTZ0Y81qpZuJz+MUuYeqmmYmRMl1nwhdmbiYqt5jwzf6u7wyOzJgYqtCRMtVRKOtHANBz7rA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.4.tgz", + "integrity": "sha512-vD8HJ5raRcWOyymsR6Z3o6+RzfEPCnVLMFJ6vRslO1jt4LO6dUo5Qnpg7y4RkZFM2DMe3WUirkI5c16onjrc6A==", "dev": true, "dependencies": { "@types/estree": "1.0.5" @@ -4758,22 +4758,22 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.19.0", - "@rollup/rollup-android-arm64": "4.19.0", - "@rollup/rollup-darwin-arm64": "4.19.0", - "@rollup/rollup-darwin-x64": "4.19.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.19.0", - "@rollup/rollup-linux-arm-musleabihf": "4.19.0", - "@rollup/rollup-linux-arm64-gnu": "4.19.0", - "@rollup/rollup-linux-arm64-musl": "4.19.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.19.0", - "@rollup/rollup-linux-riscv64-gnu": "4.19.0", - "@rollup/rollup-linux-s390x-gnu": "4.19.0", - "@rollup/rollup-linux-x64-gnu": "4.19.0", - "@rollup/rollup-linux-x64-musl": "4.19.0", - "@rollup/rollup-win32-arm64-msvc": "4.19.0", - "@rollup/rollup-win32-ia32-msvc": "4.19.0", - "@rollup/rollup-win32-x64-msvc": "4.19.0", + "@rollup/rollup-android-arm-eabi": "4.22.4", + "@rollup/rollup-android-arm64": "4.22.4", + "@rollup/rollup-darwin-arm64": "4.22.4", + "@rollup/rollup-darwin-x64": "4.22.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.22.4", + "@rollup/rollup-linux-arm-musleabihf": "4.22.4", + "@rollup/rollup-linux-arm64-gnu": "4.22.4", + "@rollup/rollup-linux-arm64-musl": "4.22.4", + "@rollup/rollup-linux-powerpc64le-gnu": "4.22.4", + "@rollup/rollup-linux-riscv64-gnu": "4.22.4", + "@rollup/rollup-linux-s390x-gnu": "4.22.4", + "@rollup/rollup-linux-x64-gnu": "4.22.4", + "@rollup/rollup-linux-x64-musl": "4.22.4", + "@rollup/rollup-win32-arm64-msvc": "4.22.4", + "@rollup/rollup-win32-ia32-msvc": "4.22.4", + "@rollup/rollup-win32-x64-msvc": "4.22.4", "fsevents": "~2.3.2" } }, @@ -4869,9 +4869,9 @@ } }, "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "engines": { "node": ">=0.10.0" } @@ -5187,9 +5187,9 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -5303,14 +5303,14 @@ } }, "node_modules/vite": { - "version": "5.3.5", - "resolved": "https://registry.npmmirror.com/vite/-/vite-5.3.5.tgz", - "integrity": "sha512-MdjglKR6AQXQb9JGiS7Rc2wC6uMjcm7Go/NHNO63EwiJXfuk9PgqiP/n5IDJCziMkfw9n4Ubp7lttNwz+8ZVKA==", + "version": "5.4.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.8.tgz", + "integrity": "sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==", "dev": true, "dependencies": { "esbuild": "^0.21.3", - "postcss": "^8.4.39", - "rollup": "^4.13.0" + "postcss": "^8.4.43", + "rollup": "^4.20.0" }, "bin": { "vite": "bin/vite.js" @@ -5329,6 +5329,7 @@ "less": "*", "lightningcss": "^1.21.0", "sass": "*", + "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.4.0" @@ -5346,6 +5347,9 @@ "sass": { "optional": true }, + "sass-embedded": { + "optional": true + }, "stylus": { "optional": true }, diff --git a/ui/package.json b/ui/package.json index 1c954e65..d151ae32 100644 --- a/ui/package.json +++ b/ui/package.json @@ -55,7 +55,7 @@ "eslint-plugin-react-refresh": "^0.4.7", "postcss": "^8.4.40", "tailwindcss": "^3.4.7", - "typescript": "^5.2.2", + "typescript": "^5.6.2", "vite": "^5.3.4" } }