dsh-mobile-plugin 0.5.59 → 0.5.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/docs/chat-embed.md +123 -0
- package/docs/extension-authoring.md +235 -47
- package/docs/extension-sample/README.md +16 -10
- package/extensions/README.md +1 -1
- package/lib/client.js +31 -0
- package/lib/mobile/approval-memory.js +9 -2
- package/lib/mobile/approvals.js +12 -1
- package/lib/mobile/session-send.js +37 -2
- package/lib/panel/index.html +1 -1
- package/lib/relay/lan-proxy.js +55 -1
- package/lib/remote/host.cjs +27 -0
- package/lib/remote/instance-hint.cjs +66 -0
- package/lib/routes/mobile-api.js +4 -0
- package/package.json +2 -1
package/lib/panel/index.html
CHANGED
|
@@ -22,7 +22,7 @@ Error generating stack: `+e.message+`
|
|
|
22
22
|
}
|
|
23
23
|
`),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,G.jsx)(Wb,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:g.cloneElement(e,{ref:u})})}var Kb=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=Pp(qb),d=(0,g.useId)(),f=(0,g.useRef)(n),p=(0,g.useRef)(r);Fp(()=>{f.current=n,p.current=r});let m=!0,h=(0,g.useMemo)(()=>(m=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:e=>(u.set(e,!1),()=>{u.delete(e),!f.current&&!u.size&&p.current?.()})}),[n,u,r]);return a&&m&&(h={...h}),(0,g.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),g.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,G.jsx)(Gb,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,children:e}),(0,G.jsx)(Ip.Provider,{value:h,children:e})};function qb(){return new Map}function Jb(e=!0){let t=(0,g.useContext)(Ip);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,g.useId)();(0,g.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,g.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var Yb=e=>e.key||``;function Xb(e){let t=[];return g.Children.forEach(e,e=>{(0,g.isValidElement)(e)&&t.push(e)}),t}var Zb=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=Jb(o),f=(0,g.useMemo)(()=>Xb(e),[e]),p=o&&!u?[]:f.map(Yb),m=(0,g.useRef)(!0),h=Pp(()=>new Map),_=(0,g.useRef)(new Set),[v,y]=(0,g.useState)(f),[b,x]=(0,g.useState)(f);Fp(()=>{o&&!u&&!b.length&&d?.()},[u,o,b.length,d]),Fp(()=>{m.current=!1;for(let e=0;e<b.length;e++){let t=Yb(b[e]);p.includes(t)?(h.delete(t),_.current.delete(t)):h.get(t)!==!0&&h.set(t,!1)}},[b,p.length,p.join(`-`)]);let S=[];if(f!==v){let e=[...f],t=0;for(let n of b){let r=p.indexOf(Yb(n));r===-1?(e.splice(t++,0,n),S.push(n)):t=r+S.length+1}return S.every(e=>h.get(Yb(e)))?e=f:a===`wait`&&(e=S),x(Xb(e)),y(f),null}let{forceRender:C}=(0,g.useContext)(Np);return(0,G.jsx)(G.Fragment,{children:b.map(e=>{let g=Yb(e),v=o&&!u?!1:f===b||p.includes(g);return(0,G.jsx)(Kb,{isPresent:v,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:v?void 0:()=>{if(_.current.has(g))return;if(h.has(g))_.current.add(g),h.set(g,!0);else return;let e=!0;h.forEach(t=>{t||(e=!1)}),e&&(C?.(),y([]),o&&d?.(),r&&r())},anchorX:s,anchorY:c,children:e},g)})})},Qb=(0,g.createContext)({strict:!1}),$b={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},ex=!1;function tx(){if(ex)return;let e={};for(let t in $b)e[t]={isEnabled:e=>$b[t].some(t=>!!e[t])};gb(e),ex=!0}function nx(){return tx(),_b()}function rx(e){let t=nx();for(let n in e)t[n]={...t[n],...e[n]};gb(t)}function ix({children:e,features:t,strict:n=!1}){let[,r]=(0,g.useState)(!ax(t)),i=(0,g.useRef)(void 0);if(!ax(t)){let{renderer:e,...n}=t;i.current=e,rx(n)}return(0,g.useEffect)(()=>{ax(t)&&t().then(({renderer:e,...t})=>{rx(t),i.current=e,r(!0)})},[]),(0,G.jsx)(Qb.Provider,{value:{renderer:i.current,strict:n},children:e})}function ax(e){return typeof e==`function`}var ox=(0,g.createContext)({});function sx(e,t){if(sb(e)){let{initial:t,animate:n}=e;return{initial:t===!1||ib(t)?t:void 0,animate:ib(n)?n:void 0}}return e.inherit===!1?{}:t}function cx(e){let{initial:t,animate:n}=sx(e,(0,g.useContext)(ox));return(0,g.useMemo)(()=>({initial:t,animate:n}),[lx(t),lx(n)])}function lx(e){return Array.isArray(e)?e.join(` `):e}var ux=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function dx(e,t,n){for(let r in t)!Ev(t[r])&&!Cb(r,n)&&(e[r]=t[r])}function fx({transformTemplate:e},t){return(0,g.useMemo)(()=>{let n=ux();return gy(n,t,e),Object.assign({},n.vars,n.style)},[t])}function px(e,t){let n=e.style||{},r={};return dx(r,n,e),Object.assign(r,fx(e,t)),r}function mx(e,t){let n={},r=px(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var hx=()=>({...ux(),attrs:{}});function gx(e,t,n,r){let i=(0,g.useMemo)(()=>{let n=hx();return xy(n,t,Ob(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};dx(t,e.style,e),i.style={...t,...i.style}}return i}var _x=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function vx(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||_x.has(e)}function yx(e,t){return e.startsWith(`on`)?!vx(e):t?.(e)??!vx(e)}function bx(e,t,n,r){let i={};for(let a in e)(a!==`values`||typeof e.values!=`object`)&&(Ev(e[a])||(yx(a,r)||n===!0&&vx(a)||!t&&!vx(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a]));return i}var xx=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function Sx(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(xx.indexOf(e)>-1||/[A-Z]/u.test(e))}function Cx(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??Sx(e)?gx:mx)(t,r,i,e),l=bx(t,typeof e==`string`,a,s),u=e===g.Fragment?{}:{...l,...c,ref:n},{children:d}=t,f=(0,g.useMemo)(()=>Ev(d)?d.get():d,[d]);return(0,g.createElement)(e,{...u,children:f})}function wx({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Tx(n,r,i,e),renderState:t()}}function Tx(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=zb(a[e]);let{initial:o,animate:s}=e,c=sb(e),l=cb(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!rb(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=vv(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var Ex=e=>(t,n)=>{let r=(0,g.useContext)(ox),i=(0,g.useContext)(Ip),a=()=>wx(e,t,r,i);return n?a():Pp(a)},Dx=Ex({scrapeMotionValuesFromProps:wb,createRenderState:ux}),Ox=Ex({scrapeMotionValuesFromProps:Ab,createRenderState:hx}),kx=Symbol.for(`motionComponentSymbol`);function Ax(e,t,n){let r=(0,g.useRef)(n);(0,g.useInsertionEffect)(()=>{r.current=n});let i=(0,g.useRef)(null);return(0,g.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`){if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n)}else a&&(a.current=n)},[t])}var jx=(0,g.createContext)({});function Mx(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Nx(e,t,n,r,i,a){let{visualElement:o}=(0,g.useContext)(ox),s=(0,g.useContext)(Qb),c=(0,g.useContext)(Ip),l=(0,g.useContext)(Bb),u=l.reducedMotion,d=l.skipAnimations,f=(0,g.useRef)(null),p=(0,g.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,g.useContext)(jx);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&Px(f.current,n,i,h);let _=(0,g.useRef)(!1);(0,g.useInsertionEffect)(()=>{m&&_.current&&m.update(n,c)});let v=n[Av],y=(0,g.useRef)(!!v&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return Fp(()=>{p.current&&m&&(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),Fp(()=>{p.current=!0,m&&(_.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),y.current&&m.animationState&&m.animationState.animateChanges())}),(0,g.useEffect)(()=>{m&&(!y.current&&m.animationState&&m.animationState.animateChanges(),y.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),!1),m.enteringChildren=void 0)}),m}function Px(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:Fx(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&Mx(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function Fx(e){if(e)return e.options.allowProjection===!1?Fx(e.parent):e.projection}function Ix(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&rx(r);let a=n?n===`svg`:Sx(e),o=a?Ox:Dx;function s(n,s){let c,l={...(0,g.useContext)(Bb),...n,layoutId:Lx(n)},{isStatic:u,isValidProp:d}=l,f=cx(n),p=o(n,u);if(!u&&typeof window<`u`){Rx(l,r);let t=zx(l);c=t.MeasureLayout,f.visualElement=Nx(e,p,l,i,t.ProjectionNode,a)}return(0,G.jsxs)(ox.Provider,{value:f,children:[c&&f.visualElement?(0,G.jsx)(c,{visualElement:f.visualElement,...l}):null,Cx(e,n,Ax(p,f.visualElement,s),p,u,t,a,d)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,g.forwardRef)(s);return c[kx]=e,c}function Lx({layoutId:e}){let t=(0,g.useContext)(Np).id;return t&&e!==void 0?t+`-`+e:e}function Rx(e,t){(0,g.useContext)(Qb).strict}function zx(e){let{drag:t,layout:n}=nx();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Bx(e,t){if(typeof Proxy>`u`)return Ix;let n=new Map,r=(n,r)=>Ix(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,Ix(a,void 0,e,t)),n.get(a))})}var Vx=Bx(),Hx=(e,t)=>t.isSVG??Sx(e)?new jb(t):new Eb(t,{allowProjection:e!==g.Fragment}),Ux=class extends bb{constructor(e){super(e),e.animationState||=Pb(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();rb(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},Wx=0,Gx={animation:{Feature:Ux},exit:{Feature:class extends bb{constructor(){super(...arguments),this.id=Wx++}update(){let{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;let{isPresent:r,onExitComplete:i}=e,a=t?.isPresent;if(r===a)return;if(r&&a===!1){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=yv(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive(`exit`,!1);this.exit=void 0;return}let o=this.exit=n.setActive(`exit`,!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function Kx(e){return{point:{x:e.pageX,y:e.pageY}}}function qx(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&Wh.postRender(()=>i(t,Kx(t)))}var Jx=class extends bb{mount(){let{current:e}=this.node;e&&(this.unmount=Vy(e,(e,t)=>(qx(this.node,t,`Start`),e=>qx(this.node,e,`End`))))}unmount(){}},Yx=class extends bb{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}e&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=Kp(Rb(this.node.current,`focus`,()=>this.onFocus()),Rb(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Xx(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&Wh.postRender(()=>i(t,Kx(t)))}var Zx=class extends bb{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Qy(e,(e,t)=>(Xx(this.node,t,`Start`),(e,{success:t})=>Xx(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Qx=new WeakMap,$x=new WeakMap,eS=e=>{let t=Qx.get(e.target);t&&t(e)},tS=e=>{e.forEach(eS)};function nS({root:e,...t}){let n=e||document;$x.has(n)||$x.set(n,{});let r=$x.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(tS,{root:e,...t})),r[i]}function rS(e,t,n){let r=nS(t);return Qx.set(e,n),r.observe(e),()=>{Qx.delete(e),r.unobserve(e)}}var iS={some:0,all:1},aS=class extends bb{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:iS[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=rS(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(oS(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function oS({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var sS={inView:{Feature:aS},tap:{Feature:Zx},focus:{Feature:Yx},hover:{Feature:Jx}};function cS(e){return(0,g.useEffect)(()=>()=>e(),[])}var lS={renderer:Hx,...Gx,...sS};function uS(e){let t=Pp(()=>rv(e)),{isStatic:n}=(0,g.useContext)(Bb);if(n){let[,n]=(0,g.useState)(e);(0,g.useEffect)(()=>t.on(`change`,n),[])}return t}function dS(e,t){let n=uS(t()),r=()=>n.set(t());return r(),Fp(()=>{let t=()=>Wh.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),Gh(r)}}),n}function fS(e){tv.current=[],e();let t=dS(tv.current,e);return tv.current=void 0,t}function pS(e,t,n,r){if(typeof e==`function`)return fS(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return hS(e,t,n,r);let i=typeof t==`function`?t:$y(t,n,r),a=Array.isArray(e)?mS(e,i):mS([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;if(o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1){let e=r?.ease;a.accelerate={...o,times:[0,...t,1],keyframes:[n[0],...n,n[n.length-1]],isTransformed:!0,...e?{ease:Array.isArray(e)?[e[0],...e]:e}:{}}}return a}function mS(e,t){let n=Pp(()=>[]);return dS(e,()=>{n.length=0;let r=e.length;for(let t=0;t<r;t++)n[t]=e[t].get();return t(n)})}function hS(e,t,n,r){let i=Pp(()=>Object.keys(n)),a=Pp(()=>({}));for(let o of i)a[o]=pS(e,t,n[o],r);return a}function gS(){!db.current&&pb();let[e]=(0,g.useState)(ub.current);return e}function _S(){let e=gS(),{reducedMotion:t}=(0,g.useContext)(Bb);return t===`never`?!1:t===`always`||e}function vS(e){return typeof e==`object`&&!Array.isArray(e)}function yS(e,t,n,r){return e==null?[]:typeof e==`string`&&vS(t)?ty(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(e=>e!=null):[e]}function bS(e,t,n){return e*(t+1)+n*t}function xS(e,t,n,r){return typeof t==`number`?t:t.startsWith(`-`)||t.startsWith(`+`)?Math.max(0,e+parseFloat(t)):t===`<`?n:t.startsWith(`<`)?Math.max(0,n+parseFloat(t.slice(1))):r.get(t)??e}function SS(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];i.at>t&&i.at<n&&(Rp(e,i),r--)}}function CS(e,t,n,r,i,a){SS(e,i,a);for(let o=0;o<t.length;o++)e.push({value:t[o],at:Ch(i,a,r[o]),easing:_m(n,o)})}function wS(e,t,n=0){let r=t+1+t*n;for(let t=0;t<e.length;t++)e[t]=e[t]/r}function TS(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}var ES=`easeInOut`,DS=20;function OS(e,{defaultTransition:t={},...n}={},r,i){let a=t.duration||.3,o=new Map,s=new Map,c={},l=new Map,u=0,d=0,f=0;for(let n=0;n<e.length;n++){let o=e[n];if(typeof o==`string`){l.set(o,d);continue}if(!Array.isArray(o)){l.set(o.name,xS(d,o.at,u,l));continue}let[p,m,h={}]=o;h.at!==void 0&&(d=xS(d,h.at,u,l));let g=0,_=(e,n,r,o=0,s=0)=>{let c=jS(e),{delay:l=0,times:u=mg(c),type:p=t.type||`keyframes`,repeat:m,repeatType:h,repeatDelay:_=0,...v}=n,{ease:y=t.ease||`easeOut`,duration:b}=n,x=typeof l==`function`?l(o,s):l,S=c.length,C=k_(p)?p:i?.[p||`keyframes`];if(S<=2&&C){let e=100;if(S===2&&PS(c)){let t=c[1]-c[0];e=Math.abs(t)}let n={...t,...v};b!==void 0&&(n.duration=Yp(b));let r=Zh(n,e,C);y=r.ease,b=r.duration}b??=a;let w=d+x;u.length===1&&u[0]===0&&(u[1]=1);let T=u.length-c.length;if(T>0&&pg(u,T),c.length===1&&c.unshift(null),m&&`${m}${DS}`,m&&m<DS){let e=b>0?_/b:0;b=bS(b,m,_);let t=[...c],n=[...u];y=Array.isArray(y)?[...y]:[y];let r=[...y],i=h===`reverse`||h===`mirror`,a=t,o=r;i&&(a=[...t].reverse(),h===`reverse`&&(o=[...r].reverse().map(e=>typeof e==`function`?am(e):e)));for(let s=0;s<m;s++){let l=i&&s%2==0,d=l?a:t,f=l?o:r,p=(s+1)*(1+e);e>0&&(c.push(c[c.length-1]),u.push(p),y.push(`linear`)),c.push(...d);for(let e=0;e<d.length;e++)u.push(n[e]+p),y.push(e===0?`linear`:_m(f,e-1))}wS(u,m,e)}let E=w+b;CS(r,c,y,u,w,E),g=Math.max(x+b,g),f=Math.max(E,f)};if(Ev(p)){let e=kS(p,s);_(m,h,AS(`default`,e))}else{let e=yS(p,m,r,c),t=e.length;for(let n=0;n<t;n++){m=m,h=h;let r=e[n],i=kS(r,s);for(let e in m)_(m[e],MS(h,e),AS(e,i),n,t)}}u=d,d+=g}return s.forEach((e,r)=>{for(let i in e){let a=e[i];a.sort(TS);let s=[],c=[],l=[];for(let e=0;e<a.length;e++){let{at:t,value:n,easing:r}=a[e];s.push(n),c.push(qp(0,f,t)),l.push(r||`easeOut`)}c[0]!==0&&(c.unshift(0),s.unshift(s[0]),l.unshift(ES)),c[c.length-1]!==1&&(c.push(1),s.push(null)),o.has(r)||o.set(r,{keyframes:{},transition:{}});let u=o.get(r);u.keyframes[i]=s;let{type:d,...p}=t;u.transition[i]={...p,duration:f,ease:l,times:c,...n}}}),o}function kS(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function AS(e,t){return t[e]||(t[e]=[]),t[e]}function jS(e){return Array.isArray(e)?e:[e]}function MS(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}var NS=e=>typeof e==`number`,PS=e=>e.every(NS);function FS(e,t){return Ev(e)||typeof e==`number`||typeof e==`string`&&!vS(t)}function IS(e,t,n,r){let i=[];if(FS(e,t))i.push(Lb(e,vS(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return i;let a=yS(e,t,r),o=a.length;for(let e=0;e<o;e++){let r=a[e],s={...n};`delay`in s&&typeof s.delay==`function`&&(s.delay=s.delay(e,o)),r instanceof Element?i.push(...Ny(r,t,s,nb.get(r))):i.push(...Xv(Jv(r)??Py,r,t,s))}}return i}function LS(e,t,n){let r=[];return OS(e.map(e=>{if(Array.isArray(e)&&typeof e[0]==`function`){let t=e[0],n=rv(0);return n.on(`change`,t),e.length===1?[n,[0,1]]:e.length===2?[n,[0,1],e[1]]:[n,e[1],e[2]]}return e}),t,n,{spring:lg}).forEach(({keyframes:e,transition:t},n)=>{r.push(...IS(n,e,t))}),r}function RS(e){return Array.isArray(e)&&e.some(Array.isArray)}function zS(e={}){let{scope:t,reduceMotion:n,skipAnimations:r}=e;function i(e,i,a){let o=[],s,c={};if(n!==void 0&&(c.reduceMotion=n),r!==void 0&&(c.skipAnimations=r),RS(e)){let{onComplete:n,...r}=i||{};typeof n==`function`&&(s=n),o=LS(e,{...c,...r},t)}else{let{onComplete:n,...r}=a||{};typeof n==`function`&&(s=n),o=IS(e,i,{...c,...r},t)}let l=new Z_(o);return s&&l.finished.then(s),t&&(t.animations.push(l),l.finished.then(()=>{Rp(t.animations,l)})),l}return i}var BS=Object.assign(zS(),{addEffect:Kv,removeEffect:qv});function VS(){let e=Pp(()=>({current:null,animations:[]})),t=_S()??void 0,{skipAnimations:n}=(0,g.useContext)(Bb),r=(0,g.useMemo)(()=>zS({scope:e,reduceMotion:t,skipAnimations:n}),[e,t,n]);return cS(()=>{e.animations.forEach(e=>e.stop()),e.animations.length=0}),[e,r]}var HS=Vx,US=(0,g.createContext)({disableAnimations:!1});function WS(){return(0,g.use)(US)}var GS=`(prefers-reduced-motion: reduce)`;function KS(){let e=Td(GS),{disableAnimations:t}=WS();return t||e}var qS=Ku(``,{variants:{size:{sm:`h-6 gap-0.75 rounded-xs px-2 text-xs has-data-[icon=end]:pe-1.5 has-data-[icon=start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5`,md:`h-8 gap-1 rounded-sm px-3 text-sm has-data-[icon=end]:pe-2 has-data-[icon=start]:ps-2 [&_svg:not([class*='size-'])]:size-4`,lg:`h-10 gap-1.25 rounded-md px-3.5 text-base has-data-[icon=end]:pe-2.5 has-data-[icon=start]:ps-2.5 [&_svg:not([class*='size-'])]:size-4.5`}},defaultVariants:{size:`md`}}),JS=g.createContext(null),YS={opacity:0,scale:.85,filter:`blur(8px)`},XS={opacity:0},ZS={duration:.28,ease:[.4,0,.2,1]},QS={duration:0},$S={sm:`size-3`,md:`size-3.5`,lg:`size-4`};function eC({className:e,variant:t,size:n,render:r,dismissible:i=!1,open:a,onOpenChange:o,onDismiss:s,closeLabel:c=`Dismiss`,children:l,onClick:u,...d}){let f=g.useContext(JS),p=t??f?.variant??`soft`,m=n??f?.size??`md`,h=KS(),[_,v]=g.useState(!0),y=a!==void 0,b=y?a:_,x=g.useCallback(()=>{y||v(!1),o?.(!1)},[y,o]);g.useEffect(()=>{if(f&&i)return f.register(x)},[f,i,x]);let S=e=>{u?.(e),!e.defaultPrevented&&i&&x()},C=i?(0,G.jsxs)(G.Fragment,{children:[l,(0,G.jsx)(tC,{size:m}),(0,G.jsx)(`span`,{className:`sr-only`,children:c})]}):l,w=Mp({defaultTagName:`button`,render:r,state:{variant:p,size:m,dismissible:i},props:Dr({"data-slot":`chip`,"data-dismissible":i||void 0,type:r?void 0:`button`,...Uu(d.disabled),className:X(Ju({variant:p}),qS({size:m}),i&&`group/chip`,e),onClick:S,children:C},d)});return i?(0,G.jsx)(ix,{features:lS,strict:!0,children:(0,G.jsx)(Zb,{initial:!1,onExitComplete:()=>s?.(),children:b&&(0,G.jsx)(HS.span,{initial:!1,exit:h?XS:YS,transition:h?QS:ZS,className:`inline-flex align-middle`,children:w},`chip`)})}):w}function tC({size:e}){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`chip-close-icon`,"data-icon":`end`,className:X($S[e],`opacity-60 transition-opacity duration-200 group-hover/chip:opacity-100 motion-reduce:transition-none`),children:(0,G.jsx)(`path`,{d:`M11.523 3.522c.264-.264.691-.264.955 0s.264.691 0 .955L8.955 8l3.522 3.522c.264.264.264.691 0 .955s-.691.264-.955 0L8 8.955l-3.522 3.522c-.264.264-.691.264-.955 0s-.264-.691 0-.955L7.045 8 3.522 4.478c-.264-.264-.264-.691 0-.955s.691-.264.955 0L8 7.045l3.523-3.522z`})})}var nC=`M4.3 12.55 L9.25 17.5 L19.7 6.5`,rC={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0};async function iC(e){if(typeof e==`string`)return e;if(typeof e==`function`)return await e();let t=e.current;if(!t)throw Error("CopyButton: the `value` ref is not attached to an element");return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t.value:t.textContent??``}async function aC(e){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();try{if(!document.execCommand(`copy`))throw Error(`Copying to clipboard is not supported`)}finally{t.remove()}}function oC({value:e,timeout:t=2e3,label:n=`Copy`,copiedLabel:r=`Copied`,onCopy:i,onCopyError:a,icon:o,onClick:s,variant:c=`ghost`,size:l=`icon-sm`,className:u,children:d,...f}){let[p,m]=g.useState(!1),h=g.useRef(void 0);return g.useEffect(()=>()=>clearTimeout(h.current),[]),(0,G.jsxs)(Z,{"data-slot":`copy-button`,"data-copied":p||void 0,type:`button`,variant:c,size:l,"aria-label":p?r:n,onClick:async n=>{if(s?.(n),n.defaultPrevented)return;let r;try{r=await iC(e),await aC(r)}catch(e){a?.(e);return}i?.(r),m(!0),clearTimeout(h.current),h.current=setTimeout(()=>m(!1),t)},className:X(`group/copy`,u),...f,children:[(0,G.jsxs)(`span`,{"data-icon":d==null?void 0:`start`,className:`grid place-items-center *:[grid-area:1/1]`,children:[(0,G.jsx)(`span`,{className:X(`grid place-items-center transition-[opacity,scale] delay-150 duration-150 ease-out group-data-copied/copy:delay-0`,`group-data-copied/copy:scale-50 group-data-copied/copy:opacity-0`,`motion-reduce:transition-none`),children:o??(0,G.jsx)(`svg`,{...rC,children:(0,G.jsx)(`path`,{d:`M4.012 16.737c-.307-.175-.562-.427-.739-.732S3.001 15.353 3 15V5c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1M7 9.667c0-.707.281-1.386.781-1.886S8.96 7 9.667 7h8.666c.35 0 .697.069 1.021.203s.618.33.865.578.444.542.578.865A2.67 2.67 0 0 1 21 9.667v8.666a2.67 2.67 0 0 1-.781 1.886 2.67 2.67 0 0 1-1.886.781H9.667a2.67 2.67 0 0 1-1.021-.203c-.324-.134-.618-.331-.865-.578s-.444-.542-.578-.865S7 18.683 7 18.333V9.667z`})})}),(0,G.jsx)(`svg`,{...rC,children:(0,G.jsx)(`path`,{d:nC,pathLength:1,strokeDasharray:`1 2`,className:X(`[stroke-dashoffset:1.02] group-data-copied/copy:[stroke-dashoffset:0]`,`transition-[stroke-dashoffset] duration-200 ease-in`,`group-data-copied/copy:delay-100 group-data-copied/copy:duration-350 group-data-copied/copy:ease-out`,`motion-reduce:transition-none`)})})]}),typeof d==`string`&&p?r:d,(0,G.jsx)(`span`,{role:`status`,className:`sr-only`,children:p?r:``})]})}var sC=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAewAAAHsAQAAAAA4UaPNAAACeUlEQVR42u2dQW7DMAwEhX5A//+lfsA2sU0umRg9BChKYQwfDNlzEVbKkqKUYZ9ca4CDg4OD/398+DXt5360zOvtcT+vn/flY1tf46MLHPzv8REKfz48Wi6dn89P8R/PPihOCs2Dt9V8muTLW/8JuL6Jj9E8eH/Nx7O/mmJ1DM2Db6d5fbVOP+PennkefE8/b5ba1/CxUD5G8+BdNZ/zNr/c5G3A+2v+Lo2pI8In//wNPQ/eVvNXfHpI/TDz48pPapY+t9Pz4D01v8ZrWsYv179nMmWA0PPgjf18Cl2XCNvD25LMRPPgnb3N8MxkdjWh/7e/AmgevLXmtfYgx7AlOU8MC76Bt0lpmVxjE2r38jO392gevHPextM1teQml1aqsUfz4F3neamoOa/s2+9TPfQ8eGNv46l4jVvVvetbvA14b2+T0+9j1PWpVGY5IquD5sFb5200/a55mzD8MyV20Dx4b2/jlqbYezH2Ec/ibcC3mOfTDpFQdQ5azTS9g+bBW8ewVerTSngbQ2Dh58H7x7BZzyr+aJl5xQrNgzf387EaNWtCPlpyaSWaB288z4uko7Ty7dE3Q2vp6XnwtjFsOehDqmsiq2MS4VJ7AN7a20yTsFTqykYsxeoQkAVZeh68q7fR/VBpJ+xMu6VeBgg9D941hq0HGljdA6uFB/EZmgdv6+ff7H7Nx4BouhLNg+8wz4eMo/G25Ib6efANYtibauF0XqVZqb1E8+B9Ne8K1xTNq8iT1UHz4FtoPkSuZcOl8JL6efC95nldgS2nfNQt4WgefAM/b/Us4pHrE/IJCfQ8+C55m5XWqkpUy5oUeHfN8/dz4ODg4Pvi3/5iKXEUjwVUAAAAAElFTkSuQmCC`,cC=`0x62744c084c272ddba4680920edc3239cb7180718`;function lC(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`stroke-0`,fill:`currentColor`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z`})})}function uC({compact:e=!1}={}){let[t,n]=(0,g.useState)(!1),[r,i]=(0,g.useState)(!1);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Z,{variant:`secondary`,size:e?`sm`:`lg`,className:`pointer-events-auto rounded-full shadow-lg`,onClick:()=>{i(!1),n(!0)},children:[(0,G.jsx)(lC,{}),Q(`panel.links.sponsor`)]}),(0,G.jsx)(dC,{open:t,onOpenChange:n,copyFailed:r,setCopyFailed:i})]})}function dC({open:e,onOpenChange:t,copyFailed:n,setCopyFailed:r}){return(0,G.jsx)(qf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Jf,{className:`max-w-sm`,children:[(0,G.jsxs)(Yf,{className:`gap-1.5`,children:[(0,G.jsx)(Xf,{className:`text-xl`,children:Q(`panel.links.sponsorTitle`)}),(0,G.jsx)(Zf,{children:Q(`panel.links.sponsorIntro`)})]}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(`img`,{src:sC,alt:Q(`panel.links.sponsorQrAlt`),className:`size-44 rounded-lg border border-border-muted bg-white p-2`})}),(0,G.jsxs)(`div`,{className:`flex justify-center gap-2`,children:[(0,G.jsx)(eC,{variant:`soft`,size:`sm`,children:`USDT`}),(0,G.jsx)(eC,{variant:`soft`,size:`sm`,children:`Polygon`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-border-muted bg-background-muted p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-foreground-muted`,children:Q(`panel.links.sponsorAddress`)}),(0,G.jsx)(oC,{value:cC,label:Q(`panel.links.sponsorCopy`),copiedLabel:Q(`panel.links.sponsorCopied`),size:`sm`,variant:`outline`,onCopyError:()=>r(!0),onCopy:()=>r(!1),children:Q(`panel.links.sponsorCopy`)})]}),(0,G.jsx)(`code`,{className:`block select-all break-all font-mono text-[11px] leading-4 text-foreground-strong`,children:cC}),n?(0,G.jsx)(`p`,{className:`text-[11px] leading-4 text-foreground-strong`,children:Q(`panel.links.sponsorCopyFailed`)}):null]})]}),(0,G.jsx)(`div`,{className:`px-6 pt-4 pb-6`,children:(0,G.jsx)(`p`,{className:`text-center text-sm text-foreground-muted`,children:Q(`panel.links.sponsorNote`)})})]})})}var fC=`https://github.com/WNLUO/dsh-mobile-plugin`,pC=[{platform:`android`,channels:[{nameKey:`panel.links.distPlatform`,hintKey:`panel.links.domesticRecommended`,url:`https://app.wnluo.com/api/public/apps/14/download-latest`},{name:`GitHub`,hintKey:`panel.links.overseasRecommended`,url:`https://github.com/WNLUO/dsh-mobile-plugin/releases/latest/download/ai-hub-android.apk`}]},{platform:`apple`,channels:[{name:`App Store`,hintKey:`panel.links.appStore`,url:`https://apps.apple.com/cn/app/ai-hub/id6821681438`},{name:`TestFlight`,hintKey:`panel.links.testFlight`,url:`https://testflight.apple.com/join/4fn5PCMD`}]}],mC=[{nameKey:`panel.links.publicRelay`,url:`https://ai-hub-de-1.wnluo.com`}],hC=mC[0].url;function gC(){return(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`size-[18px] stroke-0`,fill:`currentColor`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})})}function _C({compact:e=!1}={}){return(0,G.jsxs)(`a`,{href:fC,target:`_blank`,rel:`noreferrer noopener`,className:`${Ju({variant:`secondary`,size:e?`sm`:`lg`})} pointer-events-auto rounded-full shadow-lg`,children:[(0,G.jsx)(gC,{}),Q(`panel.links.star`)]})}function vC({compact:e=!1,hidden:t=!1}){return t?null:(0,G.jsxs)(`div`,{className:`pointer-events-none fixed start-5 z-40 flex flex-col items-start gap-2 ${e?`bottom-4`:`bottom-6`}`,children:[(0,G.jsx)(_C,{compact:e}),(0,G.jsx)(uC,{compact:e}),(0,G.jsx)(jp,{compact:e})]})}var yC=`--nested-drawers`,bC=`--drawer-height`,xC=`--drawer-frontmost-height`,SC=`--drawer-swipe-movement-x`,CC=`--drawer-swipe-movement-y`,wC=`--drawer-snap-point-offset`,TC=`--drawer-swipe-strength`,EC=`--drawer-swipe-progress`,DC=g.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Wd(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Vr(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Ft,props:[{role:`presentation`,hidden:!u,style:{pointerEvents:c?void 0:`none`,userSelect:`none`,WebkitUserSelect:`none`,[EC]:`0`,[TC]:`1`}},o],enabled:a||!l})}),OC=Kd,kC=`data-drawer-content`,AC=g.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Wd(),Vr(`div`,e,{ref:t,props:[{[kC]:``},a]})}),jC=g.createContext(void 0);function MC(){return g.useContext(jC)}var NC=`data-expanded`,PC=`data-nested-drawer-open`,FC=`data-nested-drawer-swiping`,IC=`data-swipe-dismiss`,LC=`data-swipe-direction`,RC=`data-swiping`,zC=g.createContext(void 0);function BC(e){let t=g.useContext(zC);if(e!==!0&&t===void 0)throw Error(S(90));return t}function VC(e,t){let n=e+t;return n>=0?t:-Math.sqrt(-n)-e}function HC(e,t,n){if(!Number.isFinite(t)||t<=0)return null;if(typeof e==`number`)return Number.isFinite(e)?e<=1?mi(e,0,1)*t:e:null;let r=e.trim();if(r.endsWith(`px`)){let e=Number.parseFloat(r);return Number.isFinite(e)?e:null}if(r.endsWith(`rem`)){let e=Number.parseFloat(r);return Number.isFinite(e)?e*n:null}return null}function UC(e,t){let n=-1,r=1/0;for(let i=0;i<e.length;i+=1){let a=Math.abs(e[i]-t);a<r&&(r=a,n=i)}return n}function WC(){let e=Wd(),{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:i}=BC(),a=e.useState(`viewportElement`),[o,s]=g.useState(0),[c,l]=g.useState(16),u=J(()=>{let e=Le(a).documentElement;s(a?a.offsetHeight:e.clientHeight);let t=parseFloat(getComputedStyle(e).fontSize);Number.isFinite(t)&&l(t)});b(()=>{if(u(),!a||typeof ResizeObserver!=`function`)return;let e=new ResizeObserver(u);return e.observe(a),()=>{e.disconnect()}},[u,a]);let d=g.useMemo(()=>{if(!t||t.length===0||o<=0||i<=0)return[];let e=Math.min(i,o),n=t.map(t=>{let n=HC(t,o,c);if(n===null)return null;let r=mi(n,0,e);return{value:t,height:r,offset:Math.max(0,i-r)}}).filter(e=>!!e);if(n.length<=1)return n;let r=[],a=[];for(let e=n.length-1;e>=0;--e){let t=n[e];a.some(e=>Math.abs(e-t.height)<=1)||(a.push(t.height),r.push(t))}return r.reverse(),r},[i,c,t,o]);return{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:i,viewportHeight:o,resolvedSnapPoints:d,activeSnapPointOffset:g.useMemo(()=>{if(n===null)return;let e=d.find(e=>Object.is(e.value,n));if(e)return e;let t=Math.min(i,o),r=HC(n,o,c);if(r===null)return;let a=mi(r,0,t);return d[UC(d.map(e=>e.height),a)]},[n,i,d,c,o])?.offset??null}}var GC=g.createContext(null);function KC(){return g.useContext(GC)}var qC=!1;function JC(){qC||=(typeof CSS<`u`&&`registerProperty`in CSS&&([SC,CC,wC].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),[{name:EC,initialValue:`0`},{name:TC,initialValue:`1`}].forEach(({name:e,initialValue:t})=>{try{CSS.registerProperty({name:e,syntax:`<number>`,inherits:!1,initialValue:t})}catch{}})),!0)}var YC={...Ft,expanded(e){return e?{[NC]:``}:null},nestedDrawerOpen(e){return e?{[PC]:``}:null},nestedDrawerSwiping(e){return e?{[FC]:``}:null},swipeDirection(e){return{[LC]:e}},swiping(e){return e?{[RC]:``}:null}},XC=g.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Wd(),l=c.context.popupRef,{swipeDirection:u,frontmostHeight:d,hasNestedDrawer:f,nestedSwiping:p,nestedSwipeProgressStore:m,onPopupHeightChange:_,notifyParentFrontmostHeight:v,notifyParentHasNestedDrawer:y}=BC(),x=c.useState(`descriptionElementId`),S=c.useState(`disablePointerDismissal`),C=c.useState(`floatingRootContext`),w=c.useState(`popupProps`),T=c.useState(`modal`),E=c.useState(`mounted`),D=c.useState(`nested`),O=c.useState(`nestedOpenDrawerCount`),k=c.useState(`transitionStatus`),A=c.useState(`open`),j=c.useState(`openMethod`),M=c.useState(`titleElementId`),N=c.useState(`role`),P=C.useState(`floatingId`),F=s.id??P,I=KC();Xd();let{snapPoints:L,activeSnapPoint:R,activeSnapPointOffset:z}=WC(),B=O>0,V=I?.swiping??!1,H=I?.swipeStrength??null,[U,W]=g.useState(0),ee=g.useRef(0),K=J(()=>{let e=l.current;if(!e)return;let t=e.offsetHeight;if(ee.current>0&&d>ee.current&&t>ee.current)return;if(ee.current>0&&f){let e=ee.current;W(e),_(e);return}let n=t;n!==ee.current&&(ee.current=n,W(n),_(n))});b(()=>{if(!E){ee.current=0,W(0),_(0);return}let e=l.current;if(!e||(JC(),K(),typeof ResizeObserver!=`function`))return;let t=new ResizeObserver(K);return t.observe(e),()=>{t.disconnect()}},[K,E,B,_,l]),b(()=>{let e=()=>{let e=l.current;if(!e)return;let t=m.getSnapshot();t>0?e.style.setProperty(EC,`${t}`):e.style.setProperty(EC,`0`)};e();let t=m.subscribe(e),n=l.current;return()=>{t(),n&&n.style.setProperty(EC,`0`)}},[m,l]),b(()=>{if(A)return v?.(d),()=>{v?.(0)}},[d,A,v]),b(()=>{if(y)return y(A||k===`ending`),()=>{y(!1)}},[y,A,k]),ii({open:A,ref:l,onComplete(){A&&c.context.onOpenChangeComplete?.(!0)}});let te=o===void 0?l:o,q=c.useStateSetter(`popupElement`),ne={open:A,nested:D,transitionStatus:k,expanded:R===1,nestedDrawerOpen:B,nestedDrawerSwiping:p,swipeDirection:u,swiping:V},re;U&&(f||k===`ending`)&&(re=`${U}px`);let ie=L&&L.length>0&&(u===`down`||u===`up`),ae=null;ie&&z!==null&&(ae=u===`up`?-z:z);let oe=I?I.getDragStyles():h;if(ie&&u===`down`){let e=z??0,t=Number.parseFloat(String(oe[CC]));oe=V&&Number.isFinite(t)?{...oe,transform:void 0,[CC]:`${VC(e,t)}px`}:{...oe,transform:void 0}}let se=Vr(`div`,e,{state:ne,props:[w,{id:F,"aria-labelledby":M,"aria-describedby":x,role:N,...Ws,hidden:!E,onKeyDown(e){tf.has(e.key)&&e.stopPropagation()},style:{...oe,[EC]:`0`,[yC]:O,[bC]:re,[wC]:typeof ae==`number`?`${ae}px`:`0px`,[xC]:d?`${d}px`:void 0,[TC]:typeof H==`number`&&Number.isFinite(H)&&H>0?`${H}`:`1`}},s],ref:[t,l,q],stateAttributesMapping:YC});return(0,G.jsx)(Oo,{context:C,openInteractionType:j,disabled:!E,closeOnFocusOut:!S,initialFocus:te,returnFocus:a,modal:T!==!1,restoreFocus:`popup`,children:se})}),ZC=hf;function QC({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=g.useRef(e!==void 0),[a,o]=g.useState(t);return[i&&e!==void 0?e:a,g.useCallback(e=>{i||o(e)},[])]}var $C,ew;function tw(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null,swipeDirection:f=`down`,snapToSequentialPoints:p=!1,snapPoints:m,snapPoint:h,defaultSnapPoint:_,onSnapPointChange:v}=e,y=BC(!0),b=y?.onNestedSwipeProgressChange,x=y?.onNestedFrontmostHeightChange,S=y?.onNestedSwipingChange,C=y?.onNestedDrawerPresenceChange,[w,T]=g.useState(0),[E,D]=g.useState(0),[O,k]=g.useState(!1),[A,j]=g.useState(!1),[M]=g.useState(nw),N=_===void 0?m?.[0]??null:_,P=h!==void 0,[F,I]=QC({controlled:h,default:N,name:`Drawer`,state:`snapPoint`}),L=g.useRef(!1),R=g.useRef(!1),z=J((e,t)=>{let n=t??ja(`none`);v?.(e,n),!n.isCanceled&&I(e)}),B=g.useMemo(()=>P||!m||m.length===0?F:F===null||!m.some(e=>Object.is(e,F))?N:F,[F,P,N,m]),V=J(e=>{T(e),!L.current&&e>0&&D(e)}),H=J(e=>{if(e>0){L.current=!0,D(e);return}L.current=!1,w>0&&D(w)}),U=J(e=>{k(e)}),W=J(e=>{M.set(e),b?.(e)}),ee=J(e=>{j(e),S?.(e)}),K=J((e,t)=>{i?.(e,t),!t.isCanceled&&!e&&m&&m.length>0&&z(N,ja(t.reason,t.event,t.trigger))}),te=g.useMemo(()=>({swipeDirection:f,swipeAreaActiveRef:R,snapToSequentialPoints:p,snapPoints:m,activeSnapPoint:B,setActiveSnapPoint:z,frontmostHeight:E,popupHeight:w,hasNestedDrawer:O,nestedSwiping:A,nestedSwipeProgressStore:M,onNestedDrawerPresenceChange:U,onPopupHeightChange:V,onNestedFrontmostHeightChange:H,onNestedSwipingChange:ee,onNestedSwipeProgressChange:W,notifyParentFrontmostHeight:x,notifyParentSwipingChange:S,notifyParentSwipeProgressChange:b,notifyParentHasNestedDrawer:C}),[B,E,O,A,M,C,b,S,x,U,H,W,ee,V,w,z,m,p,R,f]),q=Pf(`drawer`,{open:n,defaultOpen:r,onOpenChange:K,onOpenChangeComplete:a,disablePointerDismissal:o,modal:s,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d,children:typeof t==`function`?e=>(0,G.jsxs)(g.Fragment,{children:[$C||=(0,G.jsx)(rw,{}),t(e)]}):(0,G.jsxs)(g.Fragment,{children:[ew||=(0,G.jsx)(rw,{}),t]})});return(0,G.jsx)(zC.Provider,{value:te,children:q})}function nw(){let e=0,t=new Set;return{getSnapshot:()=>e,set(n){let r=Number.isFinite(n)?n:0;r!==e&&(e=r,t.forEach(e=>{e()}))},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function rw(){let e=MC(),t=Wd(!1),n=e?.setDrawerOpen,r=e?.removeDrawer,i=t.useState(`open`),a=t.useState(`nestedOpenDialogCount`),o=t.useState(`popupElement`),s=a===0;return b(()=>{if(r)return()=>{r(t)}},[r,t]),b(()=>{n?.(t,i)},[i,n,t]),g.useEffect(()=>{if(!i||!s||!rt)return;let e=pe(o).CloseWatcher;if(!e)return;function n(e){t.select(`open`)&&t.setOpen(!1,ja(Ca,e))}let r=new e,a=Re(r,`close`,n);return()=>{a(),r.destroy()}},[t,s,i,o]),null}var iw=Lf,aw=Hf,ow=`data-nested-dialog-open`,sw=g.createContext(void 0);function cw(){return g.useContext(sw)}var lw=10,uw=.5,dw=.5,fw=300,pw=4,mw=.2,hw=4,gw=80,_w=360,vw=.1,yw=6,bw=2,xw=`[${kC}]`,Sw=g.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=Wd(),c=s.context.popupRef,l=s.context.backdropRef,{swipeDirection:u,notifyParentSwipingChange:d,notifyParentSwipeProgressChange:f,frontmostHeight:p,snapToSequentialPoints:m,swipeAreaActiveRef:h}=BC(),_=MC(),{snapPoints:v,resolvedSnapPoints:y,activeSnapPoint:x,activeSnapPointOffset:S,setActiveSnapPoint:C,popupHeight:w}=WC(),T=s.useState(`open`),E=s.useState(`mounted`),D=s.useState(`nested`),O=s.useState(`nestedOpenDrawerCount`),k=s.useState(`viewportElement`),A=s.useState(`popupElement`),j=_?.visualStateStore,M=O>0,N=u===`left`||u===`right`?`horizontal`:`vertical`,P=N===`vertical`,F=P?`horizontal`:`vertical`,[I,L]=g.useState(null),R=g.useRef(void 0),z=g.useRef(null),B=He(),V=g.useRef(!1),H=g.useRef(!1),U=g.useRef(``),W=g.useRef(!1),ee=g.useRef(!1),K=g.useRef(null),te=cw(),q=g.useMemo(()=>{if(!v||v.length<2||y.length<2||u!==`down`&&u!==`up`)return null;let e=y.map(e=>e.offset).sort((e,t)=>e-t),t=e[0];return{minOffset:t,range:e[1]-t}},[y,v,u]),ne=g.useMemo(()=>!q||S===null?null:mi((S-q.minOffset)/q.range,0,1),[S,q]),re=g.useMemo(()=>v&&v.length>0&&(u===`down`||u===`up`)?u===`down`?[`down`,`up`]:[`up`,`down`]:[u],[v,u]),ie=J(e=>{c.current?.toggleAttribute(IC,e),l.current?.toggleAttribute(IC,e)}),ae=J(()=>{ie(!1),c.current?.removeAttribute(vt),L(null)}),oe=J(()=>{H.current&&(H.current=!1,d?.(!1))}),se=J((e,t,n)=>{let r=T&&!D&&t,i=r?e:0,a=T&&t?e:0;n&&f&&(f(a),a<=0&&oe()),j?.set({swipeProgress:i,frontmostHeight:i>0?p:0});let o=l.current;if(!o)return;let s=r&&i>0;o.style.setProperty(EC,s?`${i}`:`0`),s&&p>0?o.style.setProperty(bC,`${p}px`):o.style.removeProperty(bC)});function ce(e,t,n,r,i,a,o,s){let c=Ew(e,t);if(c<=0)return null;let l=((t===`down`||t===`up`)&&v&&v.length>0?S??0:0)+ki(t,n,r),u=Math.max(0,c-l);if(u<=0)return null;let d=ki(t,o,s),f=Math.abs(d)>0?d:ki(t,i,a);return f<=mw?null:vw+(mi(u/mi(f,mw,hw),gw,_w)-gw)/280*.9}function le(e){if(H.current||!e)return;let t=ki(e.direction??u,e.deltaX,e.deltaY);Math.abs(t)<lw||(H.current=!0,d?.(!0))}let ue=Pi({enabled:E&&!M,directions:re,elementRef:s.context.popupRef,ignoreSelectorWhenTouch:!1,ignoreScrollableAncestors:!0,movementCssVars:{x:SC,y:CC},onSwipeStart(e){if(`touches`in e||e.pointerType===`touch`)return;let t=c.current,n=Le(t).getSelection?.();if(!n||n.isCollapsed)return;let r=ge(n.anchorNode)?n.anchorNode:n.anchorNode?.parentElement,i=ge(n.focusNode)?n.focusNode:n.focusNode?.parentElement;(Y(t,r)||Y(t,i))&&n.removeAllRanges()},onSwipingChange(e){V.current=e,Cw(s.context.backdropRef.current,e),!e&&!f&&oe()},swipeThreshold({element:e,direction:t}){return Dw(e,t)},canStart(e,t){let n=s.context.popupRef.current;if(!n)return!1;let r=n.ownerDocument,i=bi(n.getRootNode(),e.x,e.y);if(!i||!Y(n,i))return!1;let a=t.nativeEvent;return!((`touches`in a||a.pointerType===`touch`)&&jw(r,n))},onProgress(e,t){let n=V.current;n&&le(t);let r=!!(v&&v.length>0);if(n&&u===`down`&&r&&t){let e=s.context.popupRef.current;e&&(e.style.removeProperty(`transform`),e.style.setProperty(CC,`${VC(S??0,t.deltaY)}px`))}let i=e;if(q&&w>0){let e=S??q.minOffset;n&&t&&Number.isFinite(t.deltaY)?i=(e=>mi((e-q.minOffset)/q.range,0,1))(mi(e+t.deltaY,0,w)):ne!==null&&(i=ne)}n||(f?.(0),oe()),se(i,!0,n)},onRelease({event:e,deltaX:t,deltaY:n,direction:r,velocityX:i,velocityY:a,releaseVelocityX:o,releaseVelocityY:c}){let l=s.context.popupRef.current;if(!l){ae();return}let d=l;function f(e){oe(),ie(!0),d.style.removeProperty(`transition`),d.setAttribute(vt,``),ei.flushSync(()=>{L(ce(d,e,t,n,i,a,o,c))})}if(!v||v.length===0){if(!r){ae();return}let e=ki(r,t,n);if(e<=0)return ae(),!1;if(ki(r,i,a)>=uw)return f(r),!0;let o=e>Dw(d,r);return o?f(r):ae(),o}if(u!==`down`&&u!==`up`){ae();return}if(!w)return ae(),!1;if(y.length===0){ae();return}let p=u===`down`?n:-n,h=Math.sign(p),g=u===`down`?c:-c,_=u===`down`?a:-a,b=g;if(h!==0&&Math.abs(p)>=lw){let e=Math.sign(b);e!==0&&e!==h&&(b=_)}let T=S??0,E=mi(T+p,0,w),D=Math.abs(b)>=dw?mi(b,-4,pw)*fw:0,O=m?E:mi(E+D,0,w),k=ja(ka,e),A=()=>(se(0,!0,!0),ae(),!1),j=e=>(C(e.value,k),A()),M=e=>r?(C(null,k),k.isCanceled?A():(R.current=x,f(u),!0)):j(e);if(m){let e=[...y].sort((e,t)=>e.offset-t.offset),t=e.map(e=>e.offset),n=UC(t,T),r=e[UC(t,O)],i=Math.sign(b),a=h!==0&&i!==0&&i===h&&Math.abs(b)>=dw,o=O;if(a){let t=mi(n+h,0,e.length-1);if(t!==n){let n=e[t];(h>0?O<n.offset:O>n.offset)&&(r=n,o=n.offset)}else if(h>0)return M(r)}return Math.abs(o-w)<Math.abs(o-r.offset)?M(r):j(r)}let N=y[UC(y.map(e=>e.offset),O)];return b>=uw&&p>0||Math.abs(O-w)<Math.abs(O-N.offset)?M(N):j(N)},onDismiss(e){j?.set({swipeProgress:0,frontmostHeight:0});let t=s.context.backdropRef.current;t&&(t.style.setProperty(EC,`0`),t.style.removeProperty(bC));let n=ja(ka,e);if(s.setOpen(!1,n),n.isCanceled){let t=R.current;t!==void 0&&C(t,ja(ka,e)),R.current=void 0,z.current?.(),ae();return}if(s.select(`open`)){let t=e;B.request(()=>{if(s.select(`open`)){let e=R.current;e!==void 0&&C(e,ja(ka,t)),R.current=void 0,ae(),z.current?.()}else R.current=void 0});return}R.current=void 0,ie(!0)}}),de=ue.getPointerProps(),fe=ue.getTouchProps(),{moveNative:pe,reset:me}=ue;z.current=me,g.useEffect(()=>{let e=k??A;if(!e)return;let t=e,n=Le(t);function r(e,r,i){let a=P?i.clientY-r.lastY:i.clientX-r.lastX;if(e.touches.length===2||jw(n,t)||!T||!E||M||Fw(r,e,i,P))return;let o=r.scrollTarget;if(!o||o===n.documentElement||o===n.body){e.cancelable&&e.preventDefault(),e.stopPropagation(),pe(e,t);return}if(!Iw(o,N)){e.cancelable&&e.preventDefault(),e.stopPropagation();return}if(a!==0){let t=zw(o,N,u,a);r.allowSwipe?e.cancelable&&e.preventDefault():e.cancelable&&t?(r.allowSwipe=!0,e.preventDefault()):r.allowSwipe=!1}r.allowSwipe===!0&&(e.stopPropagation(),pe(e,t))}function i(e){if(te?.onTouchMove(e),ee.current)return;let t=K.current,n=e.touches[0];n&&t&&(r(e,t,n),Pw(t,n))}return Re(n,`touchmove`,i,{passive:!1,capture:!0})},[E,M,T,A,P,N,u,pe,k,te]),b(()=>{q&&!ue.swiping&&se(!T||D?0:ne??0,!0,!1)},[se,p,D,f,T,ne,q,ue.swiping,s,j]),b(()=>{if(f)return T||f(0),()=>{f(0)}},[f,T]),b(()=>{T&&(h.current||me(),ae())},[ae,T,me,h]),b(()=>{let e=l.current;return()=>{j?.set({swipeProgress:0,frontmostHeight:0}),Cw(e,!1);let t=l.current;t!==e&&Cw(t,!1),oe()}},[l,oe,j]);let he=g.useMemo(()=>({swiping:ue.swiping,getDragStyles:ue.getDragStyles,swipeStrength:I??null,setSwipeDismissed:ie}),[ie,ue.getDragStyles,ue.swiping,I]);function _e(e){ee.current=e,K.current=null}function ve(){_e(!1),U.current=``,W.current=!1}function ye(e){return U.current=``,e.pointerType!==`touch`}return(0,G.jsx)(If,{ref:t,className:r,style:i,render:n,...Dr(o,{onPointerDown(e){if(U.current=e.pointerType,W.current=e.pointerType===`pen`,!T||!E||M)return;let t=bi(e.currentTarget.getRootNode(),e.clientX,e.clientY);ww(t)||Tw(t)||e.pointerType!==`touch`&&de.onPointerDown?.(e)},onPointerMove(e){e.pointerType!==`touch`&&de.onPointerMove?.(e)},onPointerUp(e){ye(e)&&de.onPointerUp?.(e)},onPointerCancel(e){ye(e)&&de.onPointerCancel?.(e)},onTouchStart(e){if(U.current===`pen`&&W.current){W.current=!1,_e(!1);return}if(!T||!E||M){_e(!1);return}let t=e.touches[0];if(!t)return;if(Nw(e)){_e(!1);return}let n=e.currentTarget,r=bi(n.getRootNode(),t.clientX,t.clientY),i=ut(e.nativeEvent),a=ge(i)?i:n;if(!Y(n,a)){_e(!0);return}if(te?.onTouchStart(e),ww(r)){_e(!0);return}ee.current=!1;let o=yi(a,n,N),s=yi(a,n,F)!=null,c=null;o&&(c=Rw(o,N,u)?null:!1),K.current={startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,scrollTarget:o,hasCrossAxisScrollableContent:s,allowSwipe:c,preserveNativeCrossAxisScroll:!1,drawerAxisAttributed:!1},fe.onTouchStart?.(e)},onTouchEnd(e){te?.onTouchEnd(e),ve(),fe.onTouchEnd?.(e)},onTouchCancel(e){te?.onTouchCancel(),ve(),fe.onTouchCancel?.(e)},[ow]:void 0}),children:(0,G.jsx)(GC.Provider,{value:he,children:a})})});function Cw(e,t){e?.toggleAttribute(RC,t)}function ww(e){return!!e?.closest(li)}function Tw(e){return!!e?.closest(xw)}function Ew(e,t){return t===`left`||t===`right`?e.offsetWidth:e.offsetHeight}function Dw(e,t){return Math.max(Ew(e,t)*.5,lw)}function Ow(e,t){return e instanceof t.HTMLInputElement&&e.type===`range`}function kw(e){return e.tagName===`INPUT`||e.tagName===`TEXTAREA`}function Aw(e,t){let n=ge(e.anchorNode)?e.anchorNode:e.anchorNode?.parentElement,r=ge(e.focusNode)?e.focusNode:e.focusNode?.parentElement;return e.containsNode(t,!0)||Y(t,n)||Y(t,r)}function jw(e,t){let n=lt(e);if(n&&Y(t,n)&&kw(n)){let{selectionStart:e,selectionEnd:t}=n;if(e!=null&&t!=null&&e<t)return!0}let r=e.getSelection?.();return!r||r.isCollapsed?!1:Aw(r,t)}function Mw(e,t){return e.composedPath().some(e=>Ow(e,t))}function Nw(e){return Mw(e.nativeEvent,pe(e.currentTarget))}function Pw(e,t){e.lastX=t.clientX,e.lastY=t.clientY}function Fw(e,t,n,r){if(e.preserveNativeCrossAxisScroll)return!0;if(e.drawerAxisAttributed||e.allowSwipe===!0||!e.hasCrossAxisScrollableContent)return!1;if(!t.cancelable)return e.preserveNativeCrossAxisScroll=!0,!0;let i=r?n.clientY-e.startY:n.clientX-e.startX,a=r?n.clientX-e.startX:n.clientY-e.startY,o=Math.abs(i),s=Math.abs(a);return s>=yw&&s>o+bw?(e.preserveNativeCrossAxisScroll=!0,!0):o>=yw?(e.drawerAxisAttributed=!0,!1):!0}function Iw(e,t){return Lw(e,t).max>0}function Lw(e,t){if(t===`vertical`){let t=Math.max(0,e.scrollHeight-e.clientHeight);return{offset:e.scrollTop,max:t}}let n=Math.max(0,e.scrollWidth-e.clientWidth);return{offset:e.scrollLeft,max:n}}function Rw(e,t,n){let r=Bw(n,t),{offset:i,max:a}=Lw(e,t);return r?i<=0:i>=a}function zw(e,t,n,r){return(Bw(n,t)?r>0:r<0)&&Rw(e,t,n)}function Bw(e,t){return t===`vertical`?e===`down`:e===`right`}var Vw=class extends Uf{};function Hw(){return new Vw}var Uw={top:`up`,bottom:`down`,left:`left`,right:`right`},Ww=g.createContext(`bottom`),Gw=g.createContext(0),Kw=g.createContext(!1),qw=Object.assign(function({side:e=`bottom`,...t}){let n=g.useContext(Gw)+1;return(0,G.jsx)(Gw,{value:n,children:(0,G.jsx)(Kw,{value:t.snapPoints!=null,children:(0,G.jsx)(Ww,{value:e,children:(0,G.jsx)(tw,{swipeDirection:Uw[e],...t})})})})},{createHandle:Hw});function Jw({className:e,...t}){return(0,G.jsx)(aw,{"data-slot":`drawer-trigger`,className:X(e),...t})}var Yw={bottom:`items-end justify-center`,top:`items-start justify-center`,left:`items-stretch justify-start`,right:`items-stretch justify-end`},Xw={bottom:X(`w-full origin-bottom [height:var(--drawer-height,auto)] max-h-full [--stack-extent:var(--drawer-frontmost-height,var(--drawer-height,0px))]`,`data-nested-drawer-open:[height:var(--drawer-frontmost-height,auto)] data-nested-drawer-open:overflow-hidden`,`[transform:translateY(calc(var(--drawer-swipe-movement-y)-var(--stack-offset)))_scale(var(--stack-scale))]`,`data-starting-style:[transform:translateY(calc(100%+0.5rem))] data-ending-style:[transform:translateY(calc(100%+0.5rem))]`),top:X(`w-full origin-top [height:var(--drawer-height,auto)] max-h-full [--stack-extent:var(--drawer-frontmost-height,var(--drawer-height,0px))]`,`data-nested-drawer-open:[height:var(--drawer-frontmost-height,auto)] data-nested-drawer-open:overflow-hidden`,`[transform:translateY(calc(var(--drawer-swipe-movement-y)+var(--stack-offset)))_scale(var(--stack-scale))]`,`data-starting-style:[transform:translateY(calc(-100%-0.5rem))] data-ending-style:[transform:translateY(calc(-100%-0.5rem))]`),left:X(`h-full w-96 max-w-full origin-left [--stack-extent:25rem]`,`[transform:translateX(calc(var(--drawer-swipe-movement-x)+var(--stack-offset)))_scale(var(--stack-scale))]`,`data-starting-style:[transform:translateX(calc(-100%-0.5rem))] data-ending-style:[transform:translateX(calc(-100%-0.5rem))]`),right:X(`h-full w-96 max-w-full origin-right [--stack-extent:25rem]`,`[transform:translateX(calc(var(--drawer-swipe-movement-x)-var(--stack-offset)))_scale(var(--stack-scale))]`,`data-starting-style:[transform:translateX(calc(100%+0.5rem))] data-ending-style:[transform:translateX(calc(100%+0.5rem))]`)},Zw={bottom:X(`h-[calc(100dvh-1rem)] w-full min-h-0 origin-bottom shadow-[0_-24px_32px_-12px_var(--shadow-color)]`,`[--snap-offset:var(--drawer-snap-point-offset,0px)]`,`[transform:translateY(calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)))]`,`data-starting-style:[transform:translateY(calc(100%+0.5rem))] data-ending-style:[transform:translateY(calc(100%+0.5rem))]`),top:X(`h-[calc(100dvh-1rem)] w-full min-h-0 origin-top`,`[--snap-offset:var(--drawer-snap-point-offset,0px)]`,`[transform:translateY(calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)))]`,`data-starting-style:[transform:translateY(calc(-100%-0.5rem))] data-ending-style:[transform:translateY(calc(-100%-0.5rem))]`)},Qw={bottom:`shadow-[0_-24px_32px_-12px_var(--shadow-color)]`,top:`shadow-2xl`,left:`shadow-[24px_0_32px_-12px_var(--shadow-color)]`,right:`shadow-[-24px_0_32px_-12px_var(--shadow-color)]`},$w={bottom:`before:absolute before:top-1.5 before:left-1/2 before:h-1 before:w-11.5 before:-translate-x-1/2 before:rounded-full`,top:`before:absolute before:bottom-1.5 before:left-1/2 before:h-1 before:w-11.5 before:-translate-x-1/2 before:rounded-full`,left:`before:absolute before:inset-e-1.5 before:top-1/2 before:h-11.5 before:w-1 before:-translate-y-1/2 before:rounded-full`,right:`before:absolute before:inset-s-1.5 before:top-1/2 before:h-11.5 before:w-1 before:-translate-y-1/2 before:rounded-full`},eT={bottom:`pt-4!`,top:`pb-4!`,left:`pe-4!`,right:`ps-4!`},tT={bottom:`overflow-hidden [&>[data-slot=drawer-header]]:-mt-4 [&>[data-slot=drawer-close-button]]:top-0`,top:`overflow-hidden [&>[data-slot=drawer-footer]]:-mb-4`,left:`overflow-hidden [&>:not([data-slot=drawer-close-button])]:-me-4 [&>[data-slot=drawer-close-button]]:inset-e-0`,right:`overflow-hidden [&>:not([data-slot=drawer-close-button])]:-ms-4`};function nT({className:e,children:t,closeButton:n=!0,closeLabel:r=`Close`,backdrop:i,frame:a=!0,backdropProps:o,viewportProps:s,...c}){let l=g.useContext(Ww),u=g.useContext(Gw),d=g.useContext(Kw),f=o?.forceRender===!0||(i??u<=1),p=a&&f,m=d&&(l===`bottom`||l===`top`)?l:null,{portal:h,popup:_}=Kf(c);return(0,G.jsxs)(ZC,{...h,children:[f&&(0,G.jsx)(DC,{"data-slot":`drawer-backdrop`,...o,className:X(`fixed inset-0 z-50 bg-black/30 backdrop-blur-sm supports-[-webkit-touch-callout:none]:absolute`,`opacity-[calc(1-var(--drawer-swipe-progress))]`,`motion-safe:transition-opacity motion-safe:duration-400 motion-safe:ease-out`,`data-ending-style:opacity-0 data-starting-style:opacity-0 data-swiping:duration-0`,o?.className)}),(0,G.jsx)(Sw,{"data-slot":`drawer-viewport`,...s,className:X(`fixed inset-0 z-50 flex overflow-hidden p-2`,Yw[l],m&&`touch-none`,s?.className),children:(0,G.jsx)(XC,{"data-slot":`drawer-popup`,...p?{"data-frame":``}:{},className:X(`relative flex min-h-0 flex-col rounded-2xl border`,m?X(`bg-background border-border-overlay before:bg-background-strong`,p&&X(`data-expanded:before:bg-background data-expanded:border-white/15 data-expanded:p-1.5`,`data-expanded:bg-white/10 data-expanded:shadow-none data-expanded:backdrop-blur-sm`)):p?`before:bg-background border-white/15 bg-white/10 p-1.5 backdrop-blur-sm`:`bg-background border-border-overlay before:bg-background-strong`,`isolate outline-none`,(d||!p)&&Qw[l],eT[l],$w[l],`motion-safe:transition-[transform,height] motion-safe:duration-400 motion-safe:ease-[cubic-bezier(0.32,1.2,0.4,1)]`,`data-ending-style:motion-safe:duration-300 data-ending-style:motion-safe:ease-out`,`data-nested-drawer-swiping:duration-0 data-swiping:duration-0 data-swiping:select-none`,m?X(`touch-none`,Zw[m]):X(`[--stack-progress:clamp(0,var(--drawer-swipe-progress,0),1)] [--stack-step:0.05]`,`[--stack-count:max(0,calc(var(--nested-drawers,0)-var(--stack-progress)))]`,`[--stack-scale:clamp(0,calc(1-var(--stack-step)*var(--stack-count)),1)]`,`[--stack-shrink:calc(1-var(--stack-scale))]`,`[--stack-peek:calc(var(--stack-count)*1.5rem)]`,`[--stack-offset:calc(var(--stack-peek)+var(--stack-shrink)*var(--stack-extent))]`,Xw[l]),e),..._,children:(0,G.jsxs)(`div`,{"data-slot":`drawer-content`,className:X(`relative flex min-h-0 flex-col not-has-[>[data-slot=drawer-footer]]:pb-6 not-has-[>[data-slot=drawer-header]]:pt-6 [&>[data-slot=drawer-header]+[data-slot=drawer-footer]]:pt-0`,p||m?`bg-background rounded-[calc(var(--radius-2xl)*5/6)]`:tT[l],m?`h-[calc(100dvh-1.5rem-var(--snap-offset,0))]`:`flex-1`),children:[t,n&&(0,G.jsx)(OC,{"aria-label":r,"data-slot":`drawer-close-button`,className:X(Ju({variant:`outline`,size:`icon-sm`}),`absolute inset-e-3 top-3 z-10`),children:(0,G.jsx)(oT,{})})]})})})]})}function rT({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`drawer-header`,className:X(`flex shrink-0 flex-col gap-2 p-6`,e),...t})}function iT({className:e,...t}){return(0,G.jsx)(iw,{"data-slot":`drawer-title`,className:X(`text-foreground-intense text-2xl font-semibold`,e),...t})}function aT({className:e,...t}){return(0,G.jsx)(AC,{"data-slot":`drawer-body`,className:X(`min-h-0 flex-1 overflow-y-auto px-6`,e),...t})}function oT(e){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,G.jsx)(`path`,{d:`M11.594 3.594c.225-.225.588-.225.813 0s.225.588 0 .812L8.813 8l3.594 3.594c.225.225.225.588 0 .813s-.588.225-.812 0L8 8.812l-3.594 3.594c-.225.225-.588.225-.812 0s-.225-.588 0-.812L7.188 8 3.594 4.406c-.225-.225-.225-.588 0-.812s.588-.225.813 0L8 7.187l3.594-3.594z`})})}var sT=g.createContext(void 0);function cT(e){let t=g.useContext(sT);if(t===void 0&&!e)throw Error(S(33));return t}var lT=g.createContext(void 0);function uT(e){let t=g.useContext(lT);if(t===void 0&&!e)throw Error(S(36));return t}var dT=g.createContext(void 0);function fT(e=!0){let t=g.useContext(dT);if(t===void 0&&!e)throw Error(S(25));return t}function pT(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=fT(!0),f=d!==void 0;return g.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:ya})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!it&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&ca(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var mT={type:`regular-item`};function hT(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=g.useRef(null),{getButtonProps:d,buttonRef:f}=la({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=pT({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=g.useCallback(e=>Dr(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=hr(u,f);return g.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var gT=g.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function _T(){return g.useContext(gT)}function vT(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=_T(),u=g.useRef(-1),[d,f]=g.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=g.useRef(null),h=g.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return b(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var yT=`data-checked`,bT=`data-unchecked`,xT={checked(e){return e?{[yT]:``}:{[bT]:``}},...xt},ST=g.createContext(void 0),CT=g.createContext(void 0);function wT(e){let t=g.useContext(CT);if(t===void 0&&!e)throw Error(S(69));return t}var TT=g.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=uT(),{side:c,align:l}=cT(),u=wT(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),_=s.useState(`activeTriggerElement`),v=s.useState(`parent`),y=s.useState(`lastOpenChangeReason`),b=s.useState(`rootId`),x=s.useState(`floatingRootContext`),S=s.useState(`floatingTreeRoot`),C=s.useState(`closeDelay`),w=s.useState(`hoverEnabled`),T=s.useState(`disabled`),E=s.useState(`openMethod`),D=v.type===`context-menu`;ii({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),g.useEffect(()=>{function e(e){s.setOpen(!1,ja(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,s]),Cc(x,{enabled:w&&!T&&!D&&v.type!==`menubar`,closeDelay:C});let O=s.useStateSetter(`popupElement`),k=Vr(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:v.type===`menu`,instant:h},ref:[t,s.context.popupRef,O],stateAttributesMapping:Ft,props:[p,{onKeyDown(e){u&&tf.has(e.key)&&e.stopPropagation()}},sl(f),o,{"data-rootownerid":b}]}),A=v.type===void 0||D;return(_||v.type===`menubar`&&y!==`outside-press`)&&(A=!0),(0,G.jsx)(Oo,{context:x,openInteractionType:E,modal:D,disabled:!m,returnFocus:a===void 0?A:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:S,previousFocusableElement:_,nextFocusableElement:v.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:k})}),ET=g.createContext(void 0);function DT(){let e=g.useContext(ET);if(e===void 0)throw Error(S(32));return e}var OT=g.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=uT();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,G.jsx)(ET.Provider,{value:n,children:(0,G.jsx)(La,{ref:t,...r,portalOwnerRole:o})})});function kT(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=J(i),[,o]=g.useState(!1),s=y(jT).current,c=y(AT).current,l=g.useRef(0),u=g.useRef(!0),d=g.useRef(null),f=g.useRef(null),p=J(()=>{u.current||(u.current=!0,o(e=>!e))}),m=J((e,t)=>{c.set(e,t),p()}),h=J(e=>{c.delete(e),p()}),_=J(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function v(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!PT(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&FT(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=NT(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let x=J(()=>{let[e,t]=MT(c),n=_(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});v(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});b(()=>(!u.current&&d.current&&_(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,_]),b(()=>{u.current&&x()}),b(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let S=J(e=>(s.add(e),()=>{s.delete(e)})),C=g.useMemo(()=>({register:m,unregister:h,subscribeMapChange:S,nextIndexRef:l}),[m,h,S,l]);return(0,G.jsx)(gT.Provider,{value:C,children:t})}function AT(){return new Map}function jT(){return new Set}function MT(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>FT(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function NT(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function PT(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function FT(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var IT=20;function LT(e,t,n,r){let[i,a]=g.useState(!1);b(()=>{if(!e||!t||n==null){a(!1);return}let r=Le(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-IT)},[e,t,n]),Ef(e&&(!t||i),r)}var RT=g.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=di,style:_,...v}=e,{store:y}=uT(),x=DT(),S=fT(!0),C=y.useState(`parent`),w=y.useState(`floatingRootContext`),T=y.useState(`floatingTreeRoot`),E=y.useState(`mounted`),D=y.useState(`open`),O=y.useState(`modal`),k=y.useState(`openMethod`),A=y.useState(`activeTriggerElement`),j=y.useState(`transitionStatus`),M=y.useState(`positionerElement`),N=y.useState(`instantType`),P=y.useState(`adaptiveOrigin`),F=y.useState(`lastOpenChangeReason`),I=y.useState(`floatingNodeId`),L=y.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),z=g.useRef(null),B=ri(M),V=n,H=c,U=l,W=s,ee=h;C.type===`context-menu`&&(V=n??C.context?.anchor,W??=`start`,!o&&W!==`center`&&(U=e.alignOffset??2,H=e.sideOffset??-5));let K=o,te=W;C.type===`menu`?(K??=`inline-end`,te??=`start`,ee=e.collisionAvoidance??fi):C.type===`menubar`&&(K??=C.context.orientation===`vertical`?`inline-end`:`bottom`,te??=`start`);let q=C.type===`context-menu`,ne=il({anchor:V,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:K,sideOffset:H,align:te,alignOffset:U,arrowPadding:q?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:x,disableAnchorTracking:m,collisionAvoidance:ee,shift:q?{crossAxis:!(`side`in ee&&ee.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P});g.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&y.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===y.select(`floatingParentNodeId`)&&y.setOpen(!1,ja(Ea)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[y,T.events,I]),g.useEffect(()=>{if(y.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==y.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;y.setOpen(!1,ja(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,y]);let re=Ge();g.useEffect(()=>{D||re.clear()},[D,re]),g.useEffect(()=>{function e(e){if(D&&e.nodeId===y.select(`floatingParentNodeId`)){if(e.target&&A&&A!==e.target){let e=y.select(`closeDelay`);e>0?re.isStarted()||re.start(e,()=>{y.setOpen(!1,ja(Ea))}):y.setOpen(!1,ja(Ea))}else re.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,y,re]),g.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:y.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,y,I,L]),b(()=>{let e=R,t=z.current;if(e&&(z.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return B(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[R,B,y]);let ie={open:D,side:ne.side,align:ne.align,anchorHidden:ne.anchorHidden,nested:C.type===`menu`,instant:N},ae=C.type===`menubar`&&C.context.modal;LT(D&&(ae||O&&F!==`trigger-hover`),k===`touch`,M,A);let J=cl(e,ie,{styles:ne.positionerStyles,transitionStatus:j,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),oe=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),se=null;return C.type===`menubar`?se=C.context.contentElement:C.type===void 0&&(se=A),(0,G.jsxs)(sT.Provider,{value:ne,children:[oe&&(0,G.jsx)(mf,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:Xr(!D),cutout:se}),(0,G.jsx)(vo,{id:I,children:(0,G.jsx)(kT,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:J})})]})}),zT=g.createContext(void 0);function BT(){let e=g.useContext(zT);if(e===void 0)throw Error(S(34));return e}var VT=g.memo(g.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=g.useState(void 0),[p,m]=QC({controlled:i,default:a,name:`MenuRadioGroup`}),h=J((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),_=Vr(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),v=g.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,G.jsx)(ST.Provider,{value:f,children:(0,G.jsx)(zT.Provider,{value:v,children:_})})})),HT=g.createContext(void 0);function UT(){let e=g.useContext(HT);if(e===void 0)throw Error(S(35));return e}var WT=g.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=vT({guess:!0,label:a}),m=cT(!0),h=qd(i),{store:_}=uT(),v=_.useState(`isActive`,f.index),y=_.useState(`itemProps`),{value:b,setValue:x,disabled:S}=BT(),C=_.useState(`disabled`),w=s||S||C,T=b===l,{getItemProps:E,itemRef:D}=hT({closeOnClick:c,disabled:w,highlighted:v,id:h,store:_,nativeButton:o,nodeId:m?.context.nodeId,itemMetadata:mT}),O=g.useMemo(()=>({disabled:w,highlighted:v,checked:T}),[w,v,T]);function k(e){let t=ja(ya,e.nativeEvent,void 0,{preventUnmountOnClose:p});x(l,t)}let A=Vr(`div`,e,{state:O,stateAttributesMapping:xT,props:[y,{role:`menuitemradio`,"aria-checked":T,onClick:k},d,E],ref:[D,t,f.ref]});return(0,G.jsx)(HT.Provider,{value:O,children:A})}),GT=g.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=UT(),c=g.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Us(s.checked);return ii({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),Vr(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:xT,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),KT=g.createContext(null);function qT(e){let t=g.useContext(KT);if(t===null&&!e)throw Error(S(5));return t}var JT={...dc,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},YT=class extends ce{constructor(e,t,n=!1){let r=new ic,i=ZT(r,t,n,e);super(i,XT(r),JT),q(this,`unsubscribeParentListener`,null),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}};function XT(e){return{positionerRef:g.createRef(),popupRef:g.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:g.createRef(),beforeContentFocusGuardRef:g.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function ZT(e,t,n=!1,r){return{...ac(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new fo,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:h,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var QT=g.createContext(void 0);function $T(){return g.useContext(QT)}var eE=F(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:_=null,highlightItemOnHover:v=!0}=e,x=fT(!0),S=uT(!0),C=qT(!0),w=$T(),T=g.useMemo(()=>w&&S?{type:`menu`,store:S.store}:C?{type:`menubar`,context:C}:x&&!S?{type:`context-menu`,context:x}:{type:void 0},[x,S,C,w]),E=Qi(),D=Qi(),O=ho(),k=T.type===`menu`?T.store:void 0,A=(n??a)&&k?.state.transitionStatus===`starting`,j=y(()=>A?k?.state.instantType:void 0).current,M=tE({open:a,openProp:n,activeTriggerId:_,triggerIdProp:p,parent:T,disabled:o,highlightItemOnHover:v,modal:T.type===void 0?s:void 0,rootId:E,instantType:j},D,O!=null);M.useControlledProp(`openProp`,n),M.useControlledProp(`triggerIdProp`,p),M.useContextCallback(`onOpenChangeComplete`,i);let N=M.useState(`floatingTreeRoot`),P=_o(N),F=M.useState(`open`),I=M.useState(`activeTriggerElement`),L=M.useState(`positionerElement`),R=M.useState(`hoverEnabled`),z=M.useState(`disabled`),B=M.useState(`lastOpenChangeReason`),V=M.useState(`parent`),H=M.useState(`activeIndex`),U=M.useState(`payload`),W=M.useState(`floatingParentNodeId`),ee=g.useRef(null),K=g.useRef(V.type!==`context-menu`),te=Ge(),q=g.useRef(!0),ne=Ge(),re=W!=null,{openMethod:ie,triggerProps:ae}=Vf(F);M.useSyncedValues({disabled:o,highlightItemOnHover:v,modal:V.type===void 0?s:void 0,openMethod:ie,rootId:E}),ec(M);let{forceUnmount:oe,transitionStatus:se}=tc(F,M,()=>{M.set(`allowMouseEnter`,!1)},A),ce=ri(M.context.popupRef);g.useEffect(()=>{if(j===void 0)return;let e=()=>{M.state.instantType===j&&M.set(`instantType`,void 0)};if(!F){e();return}if(se!==void 0)return;if(M.context.popupRef.current==null){e();return}let t=new AbortController;return ce(e,t.signal),()=>{t.abort()}},[j,F,se,ce,M]),b(()=>{x&&!S?M.update({parent:{type:`context-menu`,context:x},floatingNodeId:P,floatingParentNodeId:O}):S&&M.update({floatingNodeId:P,floatingParentNodeId:O})},[x,S,P,O,M]),g.useEffect(()=>{if(F||(ee.current=null),V.type===`context-menu`){if(!F){te.clear(),K.current=!1;return}te.start(500,()=>{K.current=!0})}},[te,F,V.type]),b(()=>{!F&&!R&&M.set(`hoverEnabled`,!0)},[F,R,M]);let le=J((e,t)=>{let n=t.reason;if(!e&&!M.select(`open`)||F===e&&t.trigger===I&&B===n)return;let i=Zs(t);if(!e&&t.trigger==null&&(t.trigger=I??void 0),r?.(e,t),t.isCanceled)return;M.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!q.current)return;e&&n===`trigger-focus`?(q.current=!1,ne.start(300,()=>{q.current=!0})):(q.current=!0,ne.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);ee.current=t.event;let c=Xs(M.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=V.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,M.update(c)}),ue=Hs({popupStore:M,floatingRootContext:M.state.floatingRootContext,floatingId:D,nested:O!=null,onOpenChange:le}),de=ue.context.events;b(()=>{let e=({open:e,eventDetails:t})=>le(e,t);return de.on(`setOpen`,e),()=>{de?.off(`setOpen`,e)}},[de,le]);let fe=g.useCallback(()=>{M.setOpen(!1,ja(Oa))},[M]);g.useImperativeHandle(u,()=>({unmount:oe,close:fe}),[oe,fe]);let pe;V.type===`context-menu`&&(pe=V.context),g.useImperativeHandle(pe?.positionerRef,()=>L,[L]),g.useImperativeHandle(pe?.actionsRef,()=>({setOpen:le}),[le]);let me=Fo(ue,{enabled:!z,bubbles:{escapeKey:d&&V.type===`menu`},outsidePress(){return V.type!==`context-menu`||ee.current?.type===`contextmenu`||K.current},externalTree:re?N:void 0}),he=Wc(),ge=g.useCallback(e=>{M.select(`activeIndex`)!==e&&M.set(`activeIndex`,e)},[M]),_e=Nc(ue,{enabled:!z,listRef:M.context.itemDomElements,activeIndex:H,nested:V.type!==void 0,loopFocus:c,orientation:l,parentOrientation:V.type===`menubar`?V.context.orientation:void 0,rtl:he===`rtl`,disabledIndices:m,onNavigate:ge,openOnArrowKeyDown:V.type!==`context-menu`,externalTree:re?N:void 0,focusItemOnHover:v}),ve=g.useCallback(e=>{M.context.typingRef.current=e},[M]),ye=Pc(ue,{enabled:!z,listRef:M.context.itemLabels,elementsRef:M.context.itemDomElements,activeIndex:H,resetMs:500,onMatch:e=>{F&&e!==H&&M.set(`activeIndex`,e)},onTyping:ve}),be=g.useMemo(()=>{let e=Dr(ye.reference,_e.reference,me.reference,{onMouseMove(){M.set(`allowMouseEnter`,!0)}},ae);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=F,e},[M,ye.reference,_e.reference,me.reference,ae,F]),xe=g.useMemo(()=>{let e=Dr(_e.trigger,me.trigger,ae);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[_e.trigger,me.trigger,ae]);y(()=>(M.update({inactiveTriggerProps:xe}),null)),nc(M,{floatingRootContext:ue,activeTriggerProps:be,inactiveTriggerProps:xe,popupProps:g.useMemo(()=>Dr(Ws,{id:D,role:`menu`,"aria-orientation":l===`horizontal`?`horizontal`:void 0,"aria-labelledby":I?.id,onMouseMove(){M.set(`allowMouseEnter`,!0),V.type===`menu`&&M.set(`hoverEnabled`,!1)},onClick(){M.select(`hoverEnabled`)&&M.set(`hoverEnabled`,!1)},onKeyDown(e){let t=M.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},ye.floating,_e.floating,me.floating),[I,D,l,V.type,M,ye.floating,_e.floating,me.floating]),itemProps:_e.item??h});let Se=g.useMemo(()=>({store:M,parent:T}),[M,T]),Ce=(0,G.jsxs)(lT.Provider,{value:Se,children:[f&&(0,G.jsx)(qs,{handle:f,store:M}),typeof t==`function`?t({payload:U}):t]});return V.type===void 0||V.type===`context-menu`?(0,G.jsx)(yo,{externalTree:N,children:Ce}):Ce});function tE(e,t,n){return y(()=>new YT(e,t,n)).current}var nE=5;function rE(e,t){let n=iE(t);return e.clientX>=n.left-nE&&e.clientX<=n.right+nE&&e.clientY>=n.top-nE&&e.clientY<=n.bottom+nE}function iE(e){let t=e.getBoundingClientRect(),n=pe(e);if(ct)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function aE(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=oa(),{ref:i,index:a}=vT(e),o=n===a,s=g.useRef(null),c=hr(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function oE(e){let{render:t,className:n,style:r,state:i=h,props:a=m,refs:o=m,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=aE({metadata:s});return Vr(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function sE(e){if(_e(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!ke(e))return sE(Me(e))}function cE(e,t){let n=g.useRef(null);function r(t){ei.flushSync(()=>{e.setOpen(!1,ja(xa,t.nativeEvent,t.currentTarget))}),tr(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&nr(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{ei.flushSync(()=>{e.setOpen(!1,ja(xa,n.nativeEvent,n.currentTarget))});let i=er(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&Y(r,i);){let e=i;if(i=Zn(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function lE(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=g.useRef(!1);return g.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Le(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:h,[t,n,r])}var uE=I(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=uT(!0),_=fc(d)??m?.store;if(!_)throw Error(S(85));let v=qd(s),y=_.useState(`isTriggerActive`,v),b=_.useState(`floatingRootContext`),x=_.useState(`isOpenedByTrigger`,v),C=_.useState(`triggerPopupId`,v),w=g.useRef(null),T=fE(),E=oa(!0),D=go(),O=g.useMemo(()=>D??new fo,[D]),{registerTrigger:k,isMountedByThisTrigger:A}=$s(v,w,_,{payload:f,closeDelay:u,parent:T,floatingTreeRoot:O,floatingNodeId:_o(O),floatingParentNodeId:ho(),keyboardEventRelay:E?.relayKeyboardEvent}),j=T.type===`menubar`,M=_.useState(`disabled`),N=a||M||j&&T.context.disabled,{getButtonProps:P,buttonRef:F}=la({disabled:N,native:o});g.useEffect(()=>{!x&&T.type===void 0&&(_.context.allowMouseUpTriggerRef.current=!1)},[_,x,T.type]);let I=g.useRef(null),L=Ge(),R=J(e=>{if(!I.current)return;L.clear(),_.context.allowMouseUpTriggerRef.current=!1;let t=e.target;Y(I.current,t)||Y(_.select(`positionerElement`),t)||t===I.current||(t==null||sE(t)!==_.select(`rootId`))&&(rE(e,I.current)||O.events.emit(`close`,{domEvent:e,reason:Ta}))});g.useEffect(()=>{x&&_.select(`lastOpenChangeReason`)===`trigger-hover`&&Le(I.current).addEventListener(`mouseup`,R,{once:!0})},[x,R,_]);let z=j&&T.context.hasSubmenuOpen,B=Tc(b,{enabled:(c??z)&&!N&&(!j||z&&!A),handleClose:Hc({blockPointerEvents:!j}),mouseOnly:!0,move:!1,restMs:T.type===void 0?l:void 0,delay:{close:u},triggerElementRef:w,externalTree:O,isActiveTrigger:y,isClosing:()=>_.select(`transitionStatus`)===`ending`}),V=dE(x,_.select(`lastOpenChangeReason`)),H=ko(b,{enabled:!N,event:x&&j?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:T.type===void 0&&V}),U=_c(b,{enabled:!N&&z}),W=lE({open:x,enabled:j,mouseDownAction:`open`}),ee=g.useMemo(()=>Dr(U.reference,H.reference),[U.reference,H.reference]),K=_.useState(`triggerProps`,A),{preFocusGuardRef:te,handlePreFocusGuardFocus:q,handleFocusTargetFocus:ne}=cE(_,w),re={disabled:N,open:x},ie=[I,t,F,k,w],ae=[ee,B??h,K,{"aria-haspopup":`menu`,"aria-controls":C,id:v,onMouseDown:e=>{_.select(`open`)||(L.start(200,()=>{_.context.allowMouseUpTriggerRef.current=!0}),Le(e.currentTarget).addEventListener(`mouseup`,R,{once:!0}))}},j?{role:`menuitem`}:{},W,p,P],oe=Vr(`button`,e,{enabled:!j,stateAttributesMapping:Nt,state:re,ref:ie,props:ae});return j?(0,G.jsx)(oE,{tag:`button`,render:n,className:r,style:i,state:re,refs:ie,props:ae,stateAttributesMapping:Nt}):x?(0,G.jsxs)(g.Fragment,{children:[(0,G.jsx)(mr,{ref:te,onFocus:q},`${v}-pre-focus-guard`),(0,G.jsx)(g.Fragment,{children:oe},v),(0,G.jsx)(mr,{ref:_.context.triggerFocusTargetRef,onFocus:ne},`${v}-post-focus-guard`)]}):(0,G.jsx)(g.Fragment,{children:oe},v)});function dE(e,t){let n=Ge(),[r,i]=g.useState(!1);return b(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function fE(){let e=qT(!0);return g.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}function pE(e){let[t,n]=g.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var mE=g.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Vr(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function hE(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var gE=[`side`,`sideOffset`,`align`,`alignOffset`,`anchor`,`positionMethod`,`collisionBoundary`,`collisionPadding`,`collisionAvoidance`,`sticky`,`arrowPadding`,`disableAnchorTracking`],_E=[`container`,`keepMounted`];function vE(e){let{positionerProps:t,portalProps:n,...r}=e,i={...t},a={...n},o={};for(let e of Object.keys(r)){let t=r[e];gE.includes(e)?t!==void 0&&(i[e]=t):_E.includes(e)?t!==void 0&&(a[e]=t):o[e]=t}return{positioner:i,portal:a,popup:o}}var yE=[`relative inline-flex items-center gap-1.5 transform-gpu cursor-pointer font-medium outline-none`,`transition duration-250 ease-[cubic-bezier(0.175,0.885,0.32,1.5)]`,`select-none not-data-popup-open:active:scale-[0.97] not-data-popup-open:active:duration-100 not-data-popup-open:active:ease-in-out not-data-popup-open:active:translate-y-px`,`data-disabled:opacity-disabled data-disabled:pointer-events-none`,`group-data-disabled/submenu-trigger:opacity-disabled group-data-disabled/submenu-trigger:pointer-events-none`,`motion-reduce:transition-none`,`data-[orientation=vertical]:text-start`,`[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='stroke-'])]:stroke-[1.85]`],bE=[`text-foreground-strong hover:text-foreground-intense focus-visible:text-foreground-intense`,`data-active:text-foreground-intense data-popup-open:text-foreground-intense data-pressed:text-foreground-intense`],xE=[...bE,`before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit]`,`before:transition-colors before:duration-300`,`motion-reduce:before:transition-none`,`hover:before:bg-background-muted focus-visible:before:bg-background-muted`,`data-active:before:bg-background-muted`,`data-popup-open:before:bg-background-muted data-pressed:before:bg-background-muted`,`data-highlighted:not-data-disabled:text-foreground-intense`,`data-highlighted:not-data-disabled:before:bg-background-muted`,`group-data-highlighted/submenu-trigger:not-data-disabled:text-foreground-intense`,`group-data-highlighted/submenu-trigger:not-data-disabled:before:bg-background-muted`,`group-data-popup-open/submenu-trigger:not-data-disabled:text-foreground-intense`,`group-data-popup-open/submenu-trigger:not-data-disabled:before:bg-background-muted`],SE=[...bE,`after:absolute after:rounded-full after:bg-no-repeat`,`after:[background-image:linear-gradient(0deg,currentColor,currentColor)]`,`after:transition-[background-size] after:duration-300`,`motion-reduce:after:transition-none`,`data-[orientation=horizontal]:after:inset-x-0`,`data-[orientation=horizontal]:after:h-0.5`,`data-[orientation=horizontal]:after:bg-size-[0_2px]`,`ltr:data-[orientation=horizontal]:after:bg-right rtl:data-[orientation=horizontal]:after:bg-left`,`hover:data-[orientation=horizontal]:after:bg-size-[100%_2px] focus-visible:data-[orientation=horizontal]:after:bg-size-[100%_2px]`,`ltr:hover:data-[orientation=horizontal]:after:bg-left rtl:hover:data-[orientation=horizontal]:after:bg-right`,`ltr:focus-visible:data-[orientation=horizontal]:after:bg-left rtl:focus-visible:data-[orientation=horizontal]:after:bg-right`,`data-active:data-[orientation=horizontal]:after:bg-size-[100%_2px]`,`ltr:data-active:data-[orientation=horizontal]:after:bg-left rtl:data-active:data-[orientation=horizontal]:after:bg-right`,`data-popup-open:data-[orientation=horizontal]:after:bg-size-[100%_2px]`,`ltr:data-popup-open:data-[orientation=horizontal]:after:bg-left rtl:data-popup-open:data-[orientation=horizontal]:after:bg-right`,`data-pressed:data-[orientation=horizontal]:after:bg-size-[100%_2px]`,`ltr:data-pressed:data-[orientation=horizontal]:after:bg-left rtl:data-pressed:data-[orientation=horizontal]:after:bg-right`,`data-[orientation=vertical]:after:inset-s-0 data-[orientation=vertical]:after:top-[25%] data-[orientation=vertical]:after:bottom-[25%]`,`data-[orientation=vertical]:after:w-0.5`,`data-[orientation=vertical]:after:bg-size-[2px_0]`,`data-[orientation=vertical]:after:[background-position-y:bottom]`,`hover:data-[orientation=vertical]:after:bg-size-[2px_100%] hover:data-[orientation=vertical]:after:[background-position-y:top]`,`focus-visible:data-[orientation=vertical]:after:bg-size-[2px_100%] focus-visible:data-[orientation=vertical]:after:[background-position-y:top]`,`data-active:data-[orientation=vertical]:after:bg-size-[2px_100%] data-active:data-[orientation=vertical]:after:[background-position-y:top]`,`data-popup-open:data-[orientation=vertical]:after:bg-size-[2px_100%] data-popup-open:data-[orientation=vertical]:after:[background-position-y:top]`,`data-pressed:data-[orientation=vertical]:after:bg-size-[2px_100%] data-pressed:data-[orientation=vertical]:after:[background-position-y:top]`],CE=[...bE,`max-w-full`,`**:data-[slot=navigation-link-indicator]:inline-flex`,`**:data-[slot=navigation-link-indicator]:items-center`,`**:data-[slot=navigation-link-indicator]:justify-center`,`**:data-[slot=navigation-link-indicator]:overflow-hidden`,`**:data-[slot=navigation-link-indicator]:shrink-0`,`**:data-[slot=navigation-link-indicator]:w-0`,`**:data-[slot=navigation-link-indicator]:opacity-0`,`rtl:**:data-[slot=navigation-link-indicator]:rotate-180`,`**:data-[slot=navigation-link-indicator]:transition-[width,opacity]`,`**:data-[slot=navigation-link-indicator]:duration-250`,`**:data-[slot=navigation-link-indicator]:ease-out`,`motion-reduce:**:data-[slot=navigation-link-indicator]:transition-none`,`hover:**:data-[slot=navigation-link-indicator]:opacity-100 focus-visible:**:data-[slot=navigation-link-indicator]:opacity-100`,`data-active:**:data-[slot=navigation-link-indicator]:opacity-100`,`**:data-[slot=navigation-link-label]:flex-1`,`**:data-[slot=navigation-link-label]:min-w-0`,`**:data-[slot=navigation-link-label]:truncate`],wE=Ku(X(yE),{variants:{variant:{pill:X(xE),line:X(SE),indicator:X(CE)},size:{sm:`text-xs [&_svg:not([class*='size-'])]:size-4`,md:`text-sm [&_svg:not([class*='size-'])]:size-4.5`,lg:`text-base [&_svg:not([class*='size-'])]:size-5`}},compoundVariants:[{variant:`pill`,size:`sm`,class:X(`data-[orientation=horizontal]:rounded-sm data-[orientation=horizontal]:py-2 data-[orientation=horizontal]:px-3 data-[orientation=horizontal]:has-data-[icon=end]:pe-2 data-[orientation=horizontal]:has-data-[icon=start]:ps-2`,`data-[orientation=vertical]:rounded-xs data-[orientation=vertical]:py-1.5 data-[orientation=vertical]:px-2.5 data-[orientation=vertical]:has-data-[icon=end]:pe-1.5 data-[orientation=vertical]:has-data-[icon=start]:ps-1.5`,`in-aria-[orientation=vertical]:rounded-xs in-aria-[orientation=vertical]:py-1.5 in-aria-[orientation=vertical]:px-2.5 in-aria-[orientation=vertical]:has-data-[icon=end]:pe-1.5 in-aria-[orientation=vertical]:has-data-[icon=start]:ps-1.5`)},{variant:`pill`,size:`md`,class:X(`data-[orientation=horizontal]:rounded-md data-[orientation=horizontal]:py-2.5 data-[orientation=horizontal]:px-3.5 data-[orientation=horizontal]:has-data-[icon=end]:pe-2.5 data-[orientation=horizontal]:has-data-[icon=start]:ps-2.5`,`data-[orientation=vertical]:rounded-sm data-[orientation=vertical]:py-2 data-[orientation=vertical]:px-3 data-[orientation=vertical]:has-data-[icon=end]:pe-2 data-[orientation=vertical]:has-data-[icon=start]:ps-2`,`in-aria-[orientation=vertical]:rounded-sm in-aria-[orientation=vertical]:py-2 in-aria-[orientation=vertical]:px-3 in-aria-[orientation=vertical]:has-data-[icon=end]:pe-2 in-aria-[orientation=vertical]:has-data-[icon=start]:ps-2`)},{variant:`pill`,size:`lg`,class:X(`data-[orientation=horizontal]:rounded-lg data-[orientation=horizontal]:py-3 data-[orientation=horizontal]:px-4 data-[orientation=horizontal]:has-data-[icon=end]:pe-3 data-[orientation=horizontal]:has-data-[icon=start]:ps-3`,`data-[orientation=vertical]:rounded-md data-[orientation=vertical]:py-2.5 data-[orientation=vertical]:px-3.5 data-[orientation=vertical]:has-data-[icon=end]:pe-2.5 data-[orientation=vertical]:has-data-[icon=start]:ps-2.5`,`in-aria-[orientation=vertical]:rounded-md in-aria-[orientation=vertical]:py-2.5 in-aria-[orientation=vertical]:px-3.5 in-aria-[orientation=vertical]:has-data-[icon=end]:pe-2.5 in-aria-[orientation=vertical]:has-data-[icon=start]:ps-2.5`)},{variant:`line`,size:`sm`,class:X(`data-[orientation=horizontal]:py-2`,`data-[orientation=vertical]:py-1.5 data-[orientation=vertical]:ps-2.5`,`data-[orientation=vertical]:has-data-[icon=end]:pe-1.5 data-[orientation=vertical]:has-data-[icon=start]:ps-1.5`,`data-[orientation=horizontal]:after:bottom-1`)},{variant:`line`,size:`md`,class:X(`data-[orientation=horizontal]:py-2.5`,`data-[orientation=vertical]:py-2 data-[orientation=vertical]:ps-3`,`data-[orientation=vertical]:has-data-[icon=end]:pe-2 data-[orientation=vertical]:has-data-[icon=start]:ps-2.5`,`data-[orientation=horizontal]:after:bottom-1.5`)},{variant:`line`,size:`lg`,class:X(`data-[orientation=horizontal]:py-3`,`data-[orientation=vertical]:py-2.5 data-[orientation=vertical]:ps-3.5`,`data-[orientation=vertical]:has-data-[icon=end]:pe-2.5 data-[orientation=vertical]:has-data-[icon=start]:ps-2.5`,`data-[orientation=horizontal]:after:bottom-2`)},{variant:`indicator`,size:`sm`,class:X(`data-[orientation=horizontal]:py-2`,`data-[orientation=vertical]:py-1.5`,`hover:**:data-[slot=navigation-link-indicator]:w-4 focus-visible:**:data-[slot=navigation-link-indicator]:w-4 data-active:**:data-[slot=navigation-link-indicator]:w-4`)},{variant:`indicator`,size:`md`,class:X(`data-[orientation=horizontal]:py-2.5`,`data-[orientation=vertical]:py-2`,`hover:**:data-[slot=navigation-link-indicator]:w-4.5 focus-visible:**:data-[slot=navigation-link-indicator]:w-4.5 data-active:**:data-[slot=navigation-link-indicator]:w-4.5`)},{variant:`indicator`,size:`lg`,class:X(`data-[orientation=horizontal]:py-3`,`data-[orientation=vertical]:py-2.5`,`hover:**:data-[slot=navigation-link-indicator]:w-5 focus-visible:**:data-[slot=navigation-link-indicator]:w-5 data-active:**:data-[slot=navigation-link-indicator]:w-5`)}],defaultVariants:{variant:`pill`,size:`md`}}),TE=g.createContext(null);function EE(){let e=g.useContext(TE);if(!e)throw Error(`DropdownMenu sub-components must be rendered inside <DropdownMenu>`);return e}function DE({size:e=`md`,children:t,...n}){let r=KS(),i=g.useMemo(()=>({size:e,reducedMotion:r}),[e,r]);return(0,G.jsx)(TE,{value:i,children:(0,G.jsx)(eE,{...n,children:t})})}function OE({className:e,...t}){return(0,G.jsx)(uE,{"data-slot":`dropdown-menu-trigger`,className:X(e),...t})}var kE={sm:`min-w-40 rounded-md`,md:`min-w-48 rounded-lg`,lg:`min-w-56 rounded-xl`};function AE(e,t){return X(`max-h-(--available-height) w-(--anchor-width) bg-background border-border-overlay flex flex-col border shadow-2xl outline-none`,kE[e],`origin-(--transform-origin)`,`motion-safe:transition-[opacity,scale] motion-safe:duration-200 motion-safe:ease-[cubic-bezier(0.175,0.885,0.32,1.5)]`,`data-starting-style:motion-safe:scale-90 data-starting-style:motion-safe:opacity-0`,`data-ending-style:motion-safe:scale-95 data-ending-style:motion-safe:opacity-0 data-ending-style:motion-safe:duration-100 data-ending-style:motion-safe:ease-out`,t)}function jE({className:e,children:t,...n}){let{size:r}=EE(),{positioner:i,portal:a,popup:o}=vE(n);return(0,G.jsx)(OT,{...a,children:(0,G.jsx)(RT,{align:`start`,sideOffset:6,...i,className:X(`isolate z-50`,i.className),children:(0,G.jsx)(TT,{"data-slot":`dropdown-menu-content`,className:AE(r,e),...o,children:(0,G.jsx)(`div`,{className:`flex flex-col gap-0.5 overflow-x-hidden overflow-y-auto p-2`,children:t})})})})}var ME=`w-full outline-hidden`,NE={sm:`gap-1`,md:`gap-1.5`,lg:`gap-1.5`};function PE({className:e,...t}){return(0,G.jsx)(mE,{"data-slot":`dropdown-menu-separator`,className:X(`bg-border -mx-2 my-1.5 h-px shrink-0`,e),...t})}function FE(e){return(0,G.jsx)(VT,{"data-slot":`dropdown-menu-radio-group`,...e})}function IE({className:e,children:t,...n}){let{size:r,reducedMotion:i}=EE();return(0,G.jsxs)(WT,{"data-slot":`dropdown-menu-radio-item`,"data-orientation":`vertical`,className:X(wE({variant:`pill`,size:r}),ME,`justify-between`,e),...n,children:[(0,G.jsx)(`span`,{className:X(`flex items-center`,NE[r]),children:t}),(0,G.jsx)(GT,{"data-slot":`dropdown-menu-radio-item-indicator`,keepMounted:!i,className:`group/check text-foreground-intense shrink-0`,children:(0,G.jsx)(LE,{"data-icon":`end`,className:`me-0.5 size-[1.125em]`})})]})}function LE({className:e,...t}){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:X(`stroke-2`,e),...t,children:(0,G.jsx)(`path`,{d:`M4.3 12.55 L9.25 17.5 L19.7 6.5`,pathLength:1,strokeDasharray:`1 2`,className:X(`opacity-0 [stroke-dashoffset:1.02]`,`group-data-checked/check:opacity-100 group-data-checked/check:[stroke-dashoffset:0]`,`motion-safe:transition-[opacity,stroke-dashoffset] motion-safe:ease-out`,`motion-safe:delay-[0ms,150ms] motion-safe:duration-[150ms,0ms]`,`motion-safe:group-data-checked/check:delay-[0ms] motion-safe:group-data-checked/check:duration-[0ms,300ms]`)})})}function RE(...e){return e.filter(Boolean).join(` `)}var zE={ok:`bg-success`,warn:`bg-warning`,error:`bg-error`,off:`bg-foreground-subtle`},BE={ok:`text-success`,warn:`text-warning`,error:`text-error`,off:`text-foreground-muted`};function VE(e){if(e==null||e===0||e===``)return`—`;let t=new Date(e);if(Number.isNaN(t.getTime()))return String(e);try{return t.toLocaleString(bp(),{hour12:!1})}catch{return t.toLocaleString(void 0,{hour12:!1})}}function HE(e){return e===`connected`?`ok`:e===`error`?`error`:e===`connecting`?`warn`:`off`}function UE(e){let t={connected:`panel.status.connected`,connecting:`panel.status.connecting`,error:`panel.status.error`,off:`panel.status.off`};return t[e]?Q(t[e]):e}function WE(e,t){return t?e===`listening`?`ok`:e===`error`?`error`:`warn`:`off`}function GE(e,t){return t?e===`listening`?Q(`panel.lan.listening`):e===`error`?Q(`panel.lan.error`):e:Q(`panel.lan.off`)}function KE(e){let t={healthy:`panel.sidecar.healthy`,starting:`panel.sidecar.starting`,restarting:`panel.sidecar.restarting`,error:`panel.sidecar.error`,stopped:`panel.sidecar.stopped`};return t[e]?Q(t[e]):e}function qE(){return(0,g.useSyncExternalStore)(Sp,bp,bp)}var JE=`(max-width: 767px)`;function YE(){let[e,t]=(0,g.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(JE).matches);return(0,g.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(JE),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function XE(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,G.jsx)(`path`,{d:`M3.6 9h16.8M3.6 15h16.8`}),(0,G.jsx)(`path`,{d:`M12 3c2.4 2.4 3.6 5.4 3.6 9s-1.2 6.6-3.6 9c-2.4-2.4-3.6-5.4-3.6-9S9.6 5.4 12 3Z`})]})}function ZE({checked:e}){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:RE(`size-4.5 shrink-0 stroke-2`,e?`visible`:`invisible`),children:(0,G.jsx)(`path`,{d:`M4.3 12.55 L9.25 17.5 L19.7 6.5`})})}function QE(){let e=qE(),t=Q(`panel.language.open`),n=YE(),[r,i]=(0,g.useState)(!1),a=yp(),o=(0,G.jsx)(Z,{variant:`soft`,size:`icon-md`,className:`pointer-events-auto rounded-full shadow-sm`,"aria-label":t,title:`${t} · ${ap[e]}`,children:(0,G.jsx)(XE,{})});if(n){let e=(e,t)=>{let n=a===e;return(0,G.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,onClick:()=>{xp(e),i(!1)},className:RE(`flex w-full cursor-pointer items-center justify-between gap-3 rounded-md px-3 py-2.5 text-left text-sm transition-colors hover:bg-background-muted`,n?`text-foreground-intense`:`text-foreground`),children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,G.jsx)(ZE,{checked:n})]},e)};return(0,G.jsxs)(qw,{open:r,onOpenChange:i,children:[(0,G.jsx)(Jw,{render:o}),(0,G.jsxs)(nT,{closeLabel:Q(`panel.common.close`),children:[(0,G.jsx)(rT,{children:(0,G.jsx)(iT,{children:t})}),(0,G.jsx)(aT,{className:`px-3 pb-3`,children:(0,G.jsxs)(`div`,{role:`radiogroup`,"aria-label":t,className:`flex flex-col gap-0.5`,children:[e(`system`,Q(`panel.language.system`)),(0,G.jsx)(`div`,{className:`my-1 h-px shrink-0 bg-border`}),ip.map(t=>e(t,ap[t]))]})})]})]})}return(0,G.jsxs)(DE,{children:[(0,G.jsx)(OE,{render:o}),(0,G.jsx)(jE,{align:`end`,style:{width:`auto`,minWidth:`11rem`},children:(0,G.jsxs)(FE,{value:a,onValueChange:e=>xp(e),children:[(0,G.jsx)(IE,{value:`system`,children:Q(`panel.language.system`)}),(0,G.jsx)(PE,{}),ip.map(e=>(0,G.jsx)(IE,{value:e,children:ap[e]},e))]})})]})}function $E(){return Fd()}var eD=`data-ds-dark-theme`,tD=`data-ds-theme-source`;function nD(){try{if(typeof window>`u`||window.parent===window)return null;let e=window.parent.document;return e&&e.documentElement?e:null}catch{return null}}function rD(e){let t=e.body;if(t)return t.hasAttribute(eD)?`dark`:`light`;let n=e.documentElement.getAttribute(tD);return n===`dark`?`dark`:n===`light`?`light`:null}function iD(){try{return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}catch{return`light`}}var aD=`dsh-mobile-console-theme`;function oD(){try{let e=typeof localStorage>`u`?null:localStorage.getItem(aD);return e===`dark`||e===`light`?e:null}catch{return null}}function sD(e){try{typeof localStorage<`u`&&(e?localStorage.setItem(aD,e):localStorage.removeItem(aD))}catch{}dD(uD());for(let e of cD)e()}var cD=new Set;function lD(e){return cD.add(e),()=>cD.delete(e)}function uD(){let e=oD();if(e)return e;let t=nD();if(t){let e=rD(t);if(e)return e}return iD()}function dD(e){if(typeof document>`u`)return;let t=document.documentElement;t.classList.remove(`light`,`dark`),t.classList.add(e),t.style.colorScheme=e}function fD(){let e=()=>dD(uD());e();let t=[],n=nD();if(n&&typeof MutationObserver==`function`){let r=new MutationObserver(e);r.observe(n.body||n.documentElement,{attributes:!0,attributeFilter:[eD]}),r.observe(n.documentElement,{attributes:!0,attributeFilter:[tD,`class`]}),t.push(()=>r.disconnect())}try{let n=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>e();n.addEventListener(`change`,r),t.push(()=>n.removeEventListener(`change`,r))}catch{}return()=>{for(let e of t)e()}}function pD(){let[e,t]=(0,g.useState)(()=>uD());return(0,g.useEffect)(()=>lD(()=>t(uD())),[]),e}function mD(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,G.jsx)(`path`,{d:`M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41`})]})}function hD(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M20.5 14.5A8.5 8.5 0 0 1 9.5 3.5a8.5 8.5 0 1 0 11 11Z`})})}function gD(){let{resolvedTheme:e,setTheme:t}=$E(),n=e===`dark`,r=Q(n?`panel.theme.toDay`:`panel.theme.toNight`);return(0,G.jsx)(Z,{variant:`soft`,size:`icon-md`,className:`pointer-events-auto rounded-full shadow-sm`,"aria-label":r,title:r,onClick:()=>t(n?`light`:`dark`),children:n?(0,G.jsx)(mD,{}):(0,G.jsx)(hD,{})})}function _D(){let e=pD()===`dark`,t=Q(e?`panel.theme.toDay`:`panel.theme.toNight`);return(0,G.jsx)(Z,{variant:`soft`,size:`icon-md`,className:`pointer-events-auto rounded-full shadow-sm`,"aria-label":t,title:t,onClick:()=>sD(e?`light`:`dark`),children:e?(0,G.jsx)(mD,{}):(0,G.jsx)(hD,{})})}function vD(){return(0,G.jsxs)(`div`,{className:`pointer-events-none fixed end-6 top-6 z-40 flex items-center gap-2`,children:[(0,G.jsx)(QE,{}),(0,G.jsx)(gD,{})]})}var yD=`dsh-mobile-plugin:panel-visibility`,bD=null;function xD(){return bD===!1?!1:typeof document>`u`||!document.hidden}function SD(){if(typeof window>`u`||window.parent===window)return()=>{};let e=e=>{let t=e&&e.data;t&&typeof t==`object`&&t.type===yD&&(bD=t.visible===!0)};return window.addEventListener(`message`,e),()=>{window.removeEventListener(`message`,e),bD=null}}var CD=`text-[2.5rem]`,wD={indicator:`text-primary`,track:`text-primary-soft`},TD={indicator:`text-current`,track:`text-current/20`};function ED({colors:e,reduced:t}){return(0,G.jsxs)(`svg`,{width:`1em`,height:`1em`,viewBox:`0 0 40 40`,fill:`none`,stroke:`currentColor`,strokeWidth:`4`,strokeLinecap:`round`,"aria-hidden":`true`,className:X(`size-[1em] stroke-4!`,e.indicator),children:[(0,G.jsx)(`circle`,{cx:`20`,cy:`20`,r:`16`,className:e.track}),t?(0,G.jsx)(`circle`,{cx:`20`,cy:`20`,r:`16`,pathLength:1,strokeDasharray:`0.25 0.75`}):(0,G.jsx)(HS.circle,{cx:`20`,cy:`20`,r:`16`,pathLength:1,strokeDasharray:`0.25 0.75`,initial:{strokeDashoffset:0},animate:{strokeDashoffset:-1},transition:{duration:.9,repeat:1/0,ease:`linear`}})]})}var DD=12,OD=1.2;function kD({colors:e,reduced:t}){return(0,G.jsx)(`svg`,{width:`1em`,height:`1em`,viewBox:`0 0 40 40`,fill:`currentColor`,"aria-hidden":`true`,className:X(`size-[1em]`,e.indicator),children:Array.from({length:DD},(e,n)=>{let r={x:18,y:2,width:4,height:6,rx:2,transform:`rotate(${360/DD*n} 20 20)`};return t?(0,G.jsx)(`rect`,{...r,opacity:.25},n):(0,G.jsx)(HS.rect,{...r,initial:{opacity:0},animate:{opacity:[0,1,.5,0]},transition:{duration:OD,repeat:1/0,ease:`linear`,delay:n/DD*OD-OD,times:[0,.1,.5,1]}},n)})})}var AD=`M12.846 3.581C12.711 3.231 12.375 3 12 3C11.625 3 11.278 3.263 11.154 3.581C10.604 5.011 10.054 6.442 9.504 7.872C8.752 8.16 8.159 8.752 7.871 9.504C6.441 10.054 5.011 10.604 3.581 11.154C3.41 11.22 3.263 11.336 3.159 11.487C3.055 11.638 3 11.817 3 12C3 12.183 3.056 12.362 3.159 12.513C3.262 12.664 3.41 12.78 3.581 12.846C5.011 13.396 6.442 13.946 7.872 14.496C8.16 15.248 8.752 15.841 9.504 16.129C10.054 17.559 10.604 18.989 11.154 20.419C11.22 20.59 11.336 20.737 11.487 20.841C11.638 20.945 11.817 21 12 21C12.183 21 12.362 20.945 12.513 20.841C12.664 20.737 12.78 20.59 12.846 20.419C13.396 18.989 13.946 17.559 14.496 16.129C15.248 15.841 15.841 15.248 16.129 14.496C17.559 13.946 18.989 13.396 20.419 12.846C20.59 12.78 20.737 12.664 20.841 12.513C20.945 12.362 21 12.183 21 12C21 11.817 20.945 11.638 20.841 11.487C20.737 11.336 20.59 11.22 20.419 11.154C18.989 10.604 17.559 10.054 16.129 9.504C15.841 8.752 15.248 8.16 14.496 7.871C13.946 6.441 13.396 5.011 12.846 3.581Z`,jD=`M12.704 5C12.469 5 12.235 5 12 5C11.765 5 11.531 5 11.296 5C10.161 5.053 9.025 5.106 7.889 5.159C6.979 6.069 6.069 6.979 5.159 7.889C5.106 9.025 5.053 10.161 5 11.296C5 11.395 5 11.494 5 11.593C5 11.729 5 11.864 5 12C5 12.136 5 12.271 5 12.407C5 12.506 5 12.605 5 12.704C5.053 13.839 5.106 14.975 5.159 16.111C6.069 17.021 6.979 17.931 7.889 18.841C9.025 18.894 10.161 18.947 11.296 19C11.395 19 11.494 19 11.593 19C11.729 19 11.864 19 12 19C12.136 19 12.271 19 12.407 19C12.506 19 12.605 19 12.704 19C13.839 18.947 14.975 18.894 16.111 18.841C17.021 17.931 17.931 17.021 18.841 16.111C18.894 14.975 18.947 13.839 19 12.704C19 12.605 19 12.506 19 12.407C19 12.271 19 12.136 19 12C19 11.864 19 11.729 19 11.593C19 11.494 19 11.395 19 11.296C18.947 10.161 18.894 9.025 18.841 7.889C17.931 6.979 17.021 6.069 16.111 5.159C14.975 5.106 13.839 5.053 12.704 5Z`;function MD(e){return e.match(/-?\d+(?:\.\d+)?/g)?.map(Number)??[]}var ND=MD(AD),PD=MD(jD),FD=(ND.length-2)/6;function ID(e){let t=`M${e[0]} ${e[1]}`;for(let n=0;n<FD;n++){let r=2+n*6;t+=`C${e[r]} ${e[r+1]} ${e[r+2]} ${e[r+3]} ${e[r+4]} ${e[r+5]}`}return t+`Z`}function LD(e,t,n){return e+(t-e)*n}function RD(e){return e<.5?2*e*e:1-(-2*e+2)**2/2}var zD=2.5,BD=.4;function VD({colors:e,reduced:t}){let n=uS(0);g.useEffect(()=>{if(t)return;let e=BS(n,1,{duration:zD,repeat:1/0,ease:`linear`});return()=>e.stop()},[t,n]);let r=pS(n,e=>{if(e<BD/2){let t=RD(e/(BD/2));return ID(ND.map((e,n)=>LD(e,PD[n],t)))}if(e<BD){let t=RD((e-BD/2)/(BD/2));return ID(PD.map((e,n)=>LD(e,ND[n],t)))}return AD}),i=pS(n,e=>e<BD?RD(e/BD)*360:360);return(0,G.jsx)(`svg`,{width:`1em`,height:`1em`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,"aria-hidden":`true`,className:X(`size-[1em]`,e.indicator),children:t?(0,G.jsx)(`path`,{d:AD}):(0,G.jsx)(HS.path,{d:r,style:{transformOrigin:`12px 12px`,rotate:i}})})}var HD={circular:ED,dots:kD,sparkle:VD};function UD({variant:e=`circular`,currentColor:t=!1,"aria-label":n=`Loading`,className:r,...i}){let a=KS(),o=t?TD:wD,s=HD[e],c=(0,G.jsx)(s,{colors:o,reduced:a});return(0,G.jsx)(`span`,{"data-slot":`spinner`,role:`status`,"aria-label":n,className:X(`inline-flex shrink-0 items-center justify-center align-middle`,CD,r),...i,children:a?c:(0,G.jsx)(ix,{features:lS,strict:!0,children:c})})}function WD(e,{storage:t=`local`}={}){let[n,r,i]=Cd(t,e,``,{serializer:e=>e,deserializer:e=>e}),a=n!==`1`,o=(0,g.useCallback)(()=>r(`1`),[r]),s=(0,g.useCallback)(()=>i(),[i]);return(0,g.useMemo)(()=>({open:a,dismiss:o,reset:s}),[a,o,s])}var GD=Ku(X(`group/alert relative rounded-xl border p-5 text-foreground backdrop-blur-xl`,`grid w-full items-start`,`[grid-template-columns:auto_1fr_auto] [grid-template-areas:'icon_title_close'_'._description_.'_'._actions_actions']`,`@min-[460px]:data-[layout=inline]:items-center`,`@min-[460px]:data-[layout=inline]:[grid-template-columns:auto_auto_1fr_auto_auto]`,`@min-[460px]:data-[layout=inline]:[grid-template-areas:'icon_title_description_actions_close']`),{variants:{variant:{default:`bg-background border-border`,primary:`bg-primary-subtle border-primary-soft`,secondary:`bg-secondary-subtle border-secondary-soft`,error:`bg-error-subtle border-error-soft`,success:`bg-success-subtle border-success-soft`,warning:`bg-warning-subtle border-warning-soft`,info:`bg-info-subtle border-info-soft`}},defaultVariants:{variant:`default`}}),KD={default:`text-foreground-intense`,primary:`text-primary`,secondary:`text-secondary-emphasis`,error:`text-error-emphasis`,success:`text-success-emphasis`,warning:`text-warning-emphasis`,info:`text-info-emphasis`},qD=g.createContext(`default`),JD={opacity:0,scale:.88,filter:`blur(12px)`,height:0},YD={opacity:0},XD={default:{duration:.32,ease:[.4,0,.2,1]},height:{duration:.3,ease:[.4,0,.2,1],delay:.18}};function ZD({variant:e,layout:t=`block`,dismissible:n=!1,open:r,onOpenChange:i,persistKey:a,persistStorage:o=`local`,closeLabel:s=`Dismiss`,role:c=`alert`,className:l,children:u,style:d,...f}){let p=KS(),[m,h]=g.useState(!0),_=WD(a??``,{storage:o}),v=r!==void 0,y=!v&&a!=null,b=v?r:y?_.open:m,x=g.useCallback(()=>{if(v){i?.(!1);return}y?_.dismiss():h(!1),i?.(!1)},[v,y,_,i]);return(0,G.jsx)(qD.Provider,{value:e??`default`,children:(0,G.jsx)(ix,{features:lS,strict:!0,children:(0,G.jsx)(Zb,{initial:!1,children:b&&(0,G.jsx)(HS.div,{initial:!1,exit:p?YD:JD,transition:p?{duration:0}:XD,className:`@container overflow-hidden`,children:(0,G.jsxs)(`div`,{role:c,"data-slot":`alert`,"data-layout":t,style:d,className:X(GD({variant:e}),l),...f,children:[u,n&&(0,G.jsx)(`button`,{type:`button`,"aria-label":s,"data-slot":`alert-close`,onClick:x,className:X(`text-foreground-muted cursor-pointer rounded-md p-1 transition-colors outline-none [grid-area:close]`,`hover:text-foreground-intense`,`focus-visible:ring-ring focus-visible:ring-2`,`self-start @min-[460px]:group-data-[layout=inline]/alert:self-center`,`ms-3 -me-1 -mt-1 @min-[460px]:group-data-[layout=inline]/alert:my-0`),children:(0,G.jsx)(QD,{})})]})},`alert`)})})})}function QD(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,className:`size-4`,children:(0,G.jsx)(`path`,{d:`M11.523 3.522c.264-.264.691-.264.955 0s.264.691 0 .955L8.955 8l3.522 3.522c.264.264.264.691 0 .955s-.691.264-.955 0L8 8.955l-3.522 3.522c-.264.264-.691.264-.955 0s-.264-.691 0-.955L7.045 8 3.522 4.478c-.264-.264-.264-.691 0-.955s.691-.264.955 0L8 7.045l3.523-3.522z`})})}function $D({className:e,...t}){let n=g.useContext(qD);return(0,G.jsx)(`span`,{"data-slot":`alert-icon`,className:X(`me-3 flex h-lh shrink-0 items-center [grid-area:icon] [&_svg:not([class*='size-'])]:size-5`,KD[n],e),...t})}function eO({className:e,as:t=`h5`,...n}){return(0,G.jsx)(t,{"data-slot":`alert-title`,className:X(`text-foreground-intense self-center font-semibold [grid-area:title]`,`text-base @min-[460px]:group-data-[layout=inline]/alert:me-3 @min-[460px]:group-data-[layout=inline]/alert:text-sm`,e),...n})}function tO({className:e,...t}){return(0,G.jsx)(`p`,{"data-slot":`alert-description`,className:X(`text-foreground text-sm [grid-area:description]`,`mt-2 @min-[460px]:group-data-[layout=inline]/alert:mt-0`,e),...t})}var nO=[`before:pointer-events-none`,`before:absolute`,`before:inset-0`,`before:-z-1`,`before:rounded-[inherit]`,`[a,button]:before:transition-[opacity,background-color,border-color]`,`[a,button]:before:duration-250`,`motion-reduce:[a,button]:before:transition-none`],rO=Ku(`relative isolate inline-flex shrink-0 items-center justify-center rounded-full whitespace-nowrap outline-offset-1 select-none [&_svg]:shrink-0 [a,button]:transform-gpu [a,button]:cursor-pointer [a,button]:transition [a,button]:duration-250 [a,button]:ease-[cubic-bezier(0.175,0.885,0.32,1.5)] [a,button]:not-data-popup-open:active:translate-y-px [a,button]:not-data-popup-open:active:scale-[0.97] [a,button]:not-data-popup-open:active:duration-100 [a,button]:not-data-popup-open:active:ease-in-out motion-reduce:[a,button]:transition-none`,{variants:{variant:{primary:X(nO,`bg-primary text-primary-foreground outline-ring-primary [a,button]:before:bg-[radial-gradient(138.15%_78.13%_at_52.05%_50%,var(--primary)_0%,var(--primary-muted)_75%)] [a,button]:before:opacity-0`,`[a,button]:hover:before:opacity-100`,`[a,button]:data-pressed:before:opacity-100`,`[a,button]:data-popup-open:before:opacity-100`),"primary-outline":X(nO,`text-primary before:border before:border-primary outline-ring-primary`,`[a,button]:hover:before:bg-primary [a,button]:hover:text-primary-foreground`,`[a,button]:data-pressed:before:bg-primary [a,button]:data-pressed:text-primary-foreground`,`[a,button]:data-popup-open:before:bg-primary [a,button]:data-popup-open:text-primary-foreground`),secondary:X(nO,`bg-secondary-muted text-secondary-foreground outline-ring-secondary [a,button]:before:bg-[radial-gradient(138.15%_78.13%_at_52.05%_50%,var(--secondary)_0%,var(--secondary-muted)_95%)] [a,button]:before:opacity-0`,`[a,button]:hover:before:opacity-100`,`[a,button]:data-pressed:before:opacity-100`,`[a,button]:data-popup-open:before:opacity-100`),soft:X(nO,`text-foreground-intense before:bg-background-muted before:backdrop-blur-md [a,button]:before:border [a,button]:before:border-transparent outline-ring`,`data-[slot=breadcrumb-link]:not-data-active:text-foreground-muted data-[slot=breadcrumb-link]:hover:text-foreground-intense`,`[a,button]:hover:before:bg-background-subtle [a,button]:hover:before:border-border`,`[a,button]:data-pressed:before:bg-background-subtle [a,button]:data-pressed:before:border-border`,`[a,button]:data-popup-open:before:bg-background-subtle [a,button]:data-popup-open:before:border-border`,`data-active:before:bg-background-subtle data-active:border data-active:before:border-border`),outline:X(nO,`bg-background text-foreground-intense before:bg-background before:border-border before:border outline-ring`,`data-[slot=breadcrumb-link]:not-data-active:text-foreground-muted data-[slot=breadcrumb-link]:hover:text-foreground-intense`,`[a,button]:hover:before:bg-background-subtle [a,button]:hover:before:border-border-strong`,`[a,button]:data-pressed:before:bg-background-subtle [a,button]:data-pressed:before:border-border-strong`,`[a,button]:data-popup-open:before:bg-background-subtle [a,button]:data-popup-open:before:border-border-strong`,`data-active:before:bg-background-subtle data-active:before:border-border-strong`),error:X(nO,`bg-error-muted text-error-foreground outline-ring-error [a,button]:before:bg-[radial-gradient(138.15%_78.13%_at_52.05%_50%,var(--error-muted)_0%,rgba(255,255,255,.5)_95%)] [a,button]:before:opacity-0`,`[a,button]:hover:before:opacity-100`,`[a,button]:data-pressed:before:opacity-100`,`[a,button]:data-popup-open:before:opacity-100`),success:X(nO,`bg-success-muted text-success-foreground outline-ring-success [a,button]:before:bg-[radial-gradient(138.15%_78.13%_at_52.05%_50%,var(--success-muted)_0%,rgba(255,255,255,.5)_95%)] [a,button]:before:opacity-0`,`[a,button]:hover:before:opacity-100`,`[a,button]:data-pressed:before:opacity-100`,`[a,button]:data-popup-open:before:opacity-100`),warning:X(nO,`bg-warning-muted text-warning-foreground outline-ring-warning [a,button]:before:bg-[radial-gradient(138.15%_78.13%_at_52.05%_50%,var(--warning-muted)_0%,rgba(255,255,255,.5)_95%)] [a,button]:before:opacity-0`,`[a,button]:hover:before:opacity-100`,`[a,button]:data-pressed:before:opacity-100`,`[a,button]:data-popup-open:before:opacity-100`),info:X(nO,`bg-info-muted text-info-foreground outline-ring-info [a,button]:before:bg-[radial-gradient(138.15%_78.13%_at_52.05%_50%,var(--info-muted)_0%,rgba(255,255,255,.5)_95%)] [a,button]:before:opacity-0`,`[a,button]:hover:before:opacity-100`,`[a,button]:data-pressed:before:opacity-100`,`[a,button]:data-popup-open:before:opacity-100`),light:X(nO,`text-white before:bg-white/10 before:border-white/10 before:border before:backdrop-blur-md outline-ring-light`,`[a,button]:hover:before:bg-white/15 [a,button]:hover:before:border-white/15`,`[a,button]:data-pressed:before:bg-white/15 [a,button]:data-pressed:before:border-white/15`,`[a,button]:data-popup-open:before:bg-white/15 [a,button]:data-popup-open:before:border-white/15`,`data-active:before:bg-white/15 data-active:before:border-white/15`)},size:{xs:`h-4 w-fit gap-0.5 px-1.5 text-[.625rem] has-data-[icon=end]:pe-1.25 has-data-[icon=start]:ps-1.25 [&_svg:not([class*='size-'])]:size-2.5 [&_svg:not([class*='stroke-'])]:stroke-2`,sm:`h-5 w-fit gap-0.5 px-2 text-xs has-data-[icon=end]:pe-1.5 has-data-[icon=start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3 [&_svg:not([class*='stroke-'])]:stroke-[1.85]`,md:`h-6 w-fit gap-0.75 px-2.5 text-xs has-data-[icon=end]:pe-1.75 has-data-[icon=start]:ps-1.75 [&_svg:not([class*='size-'])]:size-3.5 [&_svg:not([class*='stroke-'])]:stroke-[1.75]`,lg:`h-7 w-fit gap-1 px-3 text-sm has-data-[icon=end]:pe-2.25 has-data-[icon=start]:ps-2.25 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='stroke-'])]:stroke-[1.75]`,"icon-sm":`h-5 w-5 [&_svg:not([class*='size-'])]:size-3 [&_svg:not([class*='stroke-'])]:stroke-[1.85]`,"icon-md":`h-6 w-6 [&_svg:not([class*='size-'])]:size-3.5 [&_svg:not([class*='stroke-'])]:stroke-[1.75]`,"icon-lg":`h-7 w-7 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='stroke-'])]:stroke-[1.75]`}},defaultVariants:{variant:`primary`,size:`md`}});function iO({className:e,variant:t,size:n,render:r,...i}){let a=g.isValidElement(r)?r.props:void 0,o=g.isValidElement(r)&&(r.type===`a`||r.type===`button`)||i.onClick!=null||a?.href!=null||a?.onClick!=null||a?.tabIndex!=null;return Mp({defaultTagName:`span`,render:r,state:{variant:t,size:n},props:Dr({"data-slot":`badge`,...o?Uu():{},className:X(rO({variant:t,size:n}),e)},i)})}function aO(e,t,n,r,i){return g.isValidElement(t)?g.cloneElement(t,{...i,...t.props,className:X(n,t.props.className,r)}):g.createElement(e,{...i,className:X(n,r)})}var oO=`[--card-radius:var(--radius-xl)]`,sO=`rounded-[calc(var(--card-radius)*4/3)]`,cO={none:`rounded-(--card-radius)`,solid:X(sO,`bg-background-muted/60 p-2 backdrop-blur-xl dark:bg-background-subtle`),glass:X(sO,`border border-white/15 bg-white/10 p-2 backdrop-blur-sm`)},lO={none:`border`,solid:`border-border-muted border`,glass:``};function uO({frame:e=!1,inset:t=!0,className:n,contentProps:r,render:i,children:a,...o}){let s=e===!0?`solid`:e===!1?`none`:e;return aO(`div`,i,X(`group/card flex flex-col`,oO,cO[s]),n,{"data-slot":`card`,"data-frame":s,...t?{"data-inset":``}:{},...o,children:(0,G.jsx)(`div`,{"data-slot":`card-content`,...r,className:X(`bg-background flex min-h-0 flex-1 flex-col overflow-hidden rounded-(--card-radius)`,t&&`p-2`,lO[s],r?.className),children:a})})}function dO({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`card-header`,className:X(`flex flex-1 flex-col gap-1.5 p-6 group-data-inset/card:px-4`,e),...t})}function fO({className:e,render:t,...n}){return aO(`h3`,t,`text-foreground-intense text-lg font-semibold`,e,{"data-slot":`card-title`,...n})}var pO=g.createContext(void 0);function mO(){let e=g.useContext(pO);if(e===void 0)throw Error(S(63));return e}var hO=`data-valid`,gO=`data-invalid`,_O={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},vO={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},yO={valid(e){return e===null?null:e?{[hO]:``}:{[gO]:``}}},bO=`data-checked`,xO=`data-unchecked`,SO={...yO,checked(e){return e?{[bO]:``}:{[xO]:``}}},CO={invalid:void 0,name:void 0,validityData:{state:_O,errors:[],error:``,value:``,initialValue:null},setValidityData:p,disabled:void 0,setTouched:p,setDirty:p,setFilled:p,setFocused:p,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:vO,registerFieldControl:p,validation:{getValidationProps:(e,t=h)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:p,getInputControl:()=>null,commit:async()=>{},change:p}},wO=g.createContext(CO);function TO(e=!0){let t=g.useContext(wO);if(t.setValidityData===p&&!e)throw Error(S(28));return t}function EO(e,t,n,r,i=!0,a){let{registerFieldControl:o}=TO(),s=y(()=>Symbol());b(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),b(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var DO=g.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:p,validationMode:`onSubmit`,submitCountRef:{current:0}});function OO(){return g.useContext(DO)}var kO=g.createContext({controlId:void 0,registerControlId:p,resetControlId:p,labelId:void 0,setLabelId:p,messageIds:[],setMessageIds:p,getDescriptionProps:e=>e});function AO(){return g.useContext(kO)}function jO(e,t,n,r=!0,i){let[a,o]=g.useState(),s=qd(i?`${i}-label`:void 0),c=e??t??a;return b(()=>{let i=e||t||!r?void 0:MO(n.current,s);a!==i&&o(i)}),c}function MO(e,t){let n=NO(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function NO(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function PO(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=AO(),o=qd(),s=y(()=>Symbol()),c=g.useRef(!1),l=g.useRef(!1),u=J(()=>{c.current&&i!==p&&(c.current=!1,i(s.current,void 0))});return b(()=>{if(!n||i===p){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}if(e===void 0){u();return}c.current=!0,i(s.current,e)},[t,n,i,a,o,s,u]),b(()=>u,[u]),(n?r:void 0)??t??o}var FO=g.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:_,uncheckedValue:v,value:y,style:x,...S}=e,{clearErrors:C}=OO(),{state:w,setTouched:T,setDirty:E,validityData:D,setFilled:O,setFocused:k,validationMode:A,disabled:j,name:M,validation:N}=TO(),{labelId:P}=AO(),F=j||m,I=M??l,L=g.useRef(null),R=hr(L,c,N.inputRef),z=g.useRef(null),B=qd(),V=PO({id:s}),H=u?void 0:V,[U,W]=QC({controlled:n,default:!!i,name:`Switch`,state:`checked`});EO(z,B,U,void 0,!F,l),b(()=>{O(U)},[U,O]),zf(U,()=>{C(I),E(U!==D.initialValue),N.change(U)});let{getButtonProps:ee,buttonRef:K}=la({disabled:F,native:u}),te=jO(a,P,L,!u,H),q={id:u?V:B,role:`switch`,"aria-checked":U,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":te,onFocus(){F||k(!0)},onBlur(){let e=L.current;e&&!F&&(T(!0),k(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){if(f||F)return;e.preventDefault();let t=L.current;t&&ca(t,e)}},ne={...N.getValidationProps(F),checked:U,disabled:F,form:o,id:H,name:I,required:p,style:I?pr:fr,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:R,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=ja(ma,e.nativeEvent);d?.(t,n),!n.isCanceled&&W(t)},onClick(e){e.stopPropagation()},onFocus(){z.current?.focus()},...y===void 0?h:{value:y}},re=g.useMemo(()=>({...w,checked:U,disabled:F,readOnly:f,required:p}),[w,U,F,f,p]),ie=Vr(`span`,e,{state:re,ref:[t,z,K],props:[q,S,ee,e=>N.getValidationProps(F,e)],stateAttributesMapping:SO});return(0,G.jsxs)(pO.Provider,{value:re,children:[ie,!U&&I&&v!==void 0&&(0,G.jsx)(`input`,{type:`hidden`,form:o,name:I,value:v,disabled:F}),(0,G.jsx)(`input`,{...ne,suppressHydrationWarning:!0})]})}),IO=g.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Vr(`span`,e,{state:mO(),ref:t,stateAttributesMapping:SO,props:a})}),LO={sm:{root:`h-4 w-7.5`,thumb:`size-3`,thumbWidthKeyframes:[`0.75rem`,`1.25rem`,`0.75rem`],thumbXKeyframes:[0,`0.3125rem`,`0.875rem`],check:`size-2.5`},md:{root:`h-5 w-9.5`,thumb:`size-4`,thumbWidthKeyframes:[`1rem`,`1.6875rem`,`1rem`],thumbXKeyframes:[0,`0.4375rem`,`1.125rem`],check:`size-3`},lg:{root:`h-6 w-11.5`,thumb:`size-5`,thumbWidthKeyframes:[`1.25rem`,`2.125rem`,`1.25rem`],thumbXKeyframes:[0,`0.5rem`,`1.375rem`],check:`size-4`}},RO={duration:.25,ease:[.4,0,.2,1]};function zO(e,t){return t===1?[...e]:e.map(e=>typeof e==`number`?-e:`-${e}`)}function BO({renderProps:e,state:t,dirSign:n,sizeConfig:r,reduced:i}){let{checked:a}=t,{ref:o,onDrag:s,onDragStart:c,onDragEnd:l,onAnimationStart:u,onAnimationEnd:d,...f}=e,p=g.useMemo(()=>{let e=zO(r.thumbXKeyframes,n);return a?e:e.reverse()},[a,n,r]),m=p[p.length-1],[h,_]=VS(),v=Hu(o,h),y=g.useRef(a);return g.useEffect(()=>{let e=y.current!==a;y.current=a,e&&!i?_(h.current,{x:p,width:r.thumbWidthKeyframes},RO):_(h.current,{x:m},{duration:0})},[a,r,_,h,i,p,m]),(0,G.jsx)(HS.span,{...f,ref:v,initial:{x:m},children:(0,G.jsx)(HS.svg,{className:X(`text-foreground-intense`,r.check),xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 12 12`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{strokeDasharray:12},initial:!1,animate:{strokeDashoffset:a?0:12},transition:i?{duration:0}:{strokeDashoffset:{duration:a?.3:0,ease:`easeOut`,delay:a?.25:0}},children:(0,G.jsx)(`path`,{d:`M3 6l2 2 4-4`})})})}function VO({className:e,size:t=`md`,...n}){let r=Wc()===`rtl`?-1:1,i=LO[t],a=KS(),o=n[`aria-invalid`],s=o===!0||o===`true`;return(0,G.jsx)(ix,{features:lS,strict:!0,children:(0,G.jsx)(FO,{"data-slot":`switch`,className:X(`bg-background-strong outline-ring flex shrink-0 rounded-full border border-transparent p-px outline-offset-1`,i.root,`transition-background duration-200 motion-reduce:transition-none`,`data-checked:bg-primary data-checked:outline-ring-primary`,`data-disabled:not-data-checked:border-border-strong data-disabled:opacity-disabled data-disabled:cursor-not-allowed data-disabled:not-data-checked:border-dashed`,`data-invalid:border-error data-invalid:not-data-checked:bg-error-subtle data-invalid:outline-ring-error`,e),...n,...s?{"data-invalid":``}:{},children:(0,G.jsx)(IO,{"data-slot":`switch-thumb`,className:X(`group flex items-center justify-center rounded-full bg-white shadow-2xs`,i.thumb,`data-checked:bg-primary-foreground`),render:(e,t)=>(0,G.jsx)(BO,{renderProps:e,state:t,dirSign:r,sizeConfig:i,reduced:a})})})})}var HO=g.createContext(void 0);function UO(e){let t=g.useContext(HO);if(t===void 0&&!e)throw Error(S(72));return t}var WO={...dc,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},GO=class extends ce{constructor(e,t,n){let r=new ic;super(KO(e,r,t,n),qO(r),WO),q(this,`setOpen`,(e,t)=>{Qs(this,e,t,{extraState:{openChangeReason:t.reason}})})}cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,ja(ha,e))}};function KO(e,t,n,r=!1){return{...ac(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function qO(e){return{popupRef:g.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var JO=F(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=Ks((e,t)=>new GO({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,_=p.useState(`activeTriggerId`),v=p.useState(`mounted`),y=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),ec(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:x,transitionStatus:S}=tc(h,p),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=g.useRef(null);b(()=>{m&&t&&p.setOpen(!1,ja(Da))},[m,t,p]),b(()=>{S===`ending`&&T===`none`||S!==`ending`&&C?(w!==`delay`&&(E.current=w),p.set(`instantType`,`delay`)):E.current!==null&&(p.set(`instantType`,E.current),E.current=null)},[S,C,T,w,p]),b(()=>{h&&(_??p.set(`payload`,void 0))},[p,_,h]),g.useImperativeHandle(o,()=>({unmount:x,close:()=>p.setOpen(!1,ja(Oa))}),[x,p]);let D=h||v||!t&&a!==`none`;return(0,G.jsxs)(HO.Provider,{value:p,children:[l&&(0,G.jsx)(qs,{handle:l,store:p}),D&&(0,G.jsx)(YO,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:y}):f]})});function YO({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=Fo(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=Mo(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=g.useMemo(()=>Dr(a.reference,i.reference),[a.reference,i.reference]);return nc(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??h}),null}var XO=g.createContext(void 0);function ZO(){return g.useContext(XO)}var QO=`data-base-ui-tooltip-trigger`;function $O(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(ge(n))return n}}let t=e.target;return ge(t)?t:null}function ek(e){let t=e;for(;t;){let e=t.closest(`[${QO}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&ge(n.host)?n.host:null}return null}var tk=I(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=UO(!0),m=fc(a)??p;if(!m)throw Error(S(82));let h=qd(d),_=m.useState(`isTriggerActive`,h),v=m.useState(`isOpenedByTrigger`,h),y=m.useState(`floatingRootContext`),b=g.useRef(null),x=u??0,{registerTrigger:C,isMountedByThisTrigger:w}=$s(h,b,m,{payload:o,closeOnClick:l,closeDelay:x}),T=ZO(),{activeIdRef:E,delayRef:D,isInstantPhase:O,hasProvider:k}=Ya(y,{open:v}),A=Sc(y);m.useSyncedValue(`isInstantPhase`,O);let j=m.useState(`disabled`),M=s??j,N=Ba(M),P=m.useState(`trackCursorAxis`),F=m.useState(`disableHoverablePopup`),I=g.useRef(!1),L=Ge(),R=g.useRef(void 0);function z(){return k&&E.current!=null?0:c??T??600}function B(e){let t=b.current;if(!t||!e)return!1;let n=ek(e);return n!==null&&n!==t&&Y(t,n)}function V(e){let t=B(e);return I.current=t,t&&(A.openChangeTimeout.clear(),A.restTimeout.clear(),A.restTimeoutPending=!1,L.clear()),t}let H=Tc(y,{enabled:!M,mouseOnly:!0,move:!1,handleClose:!F&&P!==`both`?Hc():null,restMs:z,delay(){return u==null&&k?{close:Ua(D.current,`close`)}:{close:x}},triggerElementRef:b,isActiveTrigger:_,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!I.current}}),U=_c(y,{enabled:!M}).reference,W=e=>{let t=I.current,n=$O(e),r=V(n),i=b.current,a=i&&n&&Y(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,ja(ga,e));return}if(t&&!r&&a&&!N.current&&!m.select(`open`)&&i&&Zt(R.current)){let t=()=>{!I.current&&!N.current&&!m.select(`open`)&&m.setOpen(!0,ja(ga,e,i))},n=z();n===0?(L.clear(),t()):L.start(n,t)}},G=m.useState(`triggerProps`,w);return Vr(`button`,e,{state:{open:v},ref:[t,C,b],props:[H,U,w||P!==`none`?G:void 0,{onMouseOver(e){W(e.nativeEvent)},onFocus(e){B($O(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){I.current=!1,L.clear(),R.current=void 0},onPointerEnter(e){R.current=e.pointerType},onPointerDown(e){R.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[It]:M?``:void 0,[QO]:M?void 0:``},f],stateAttributesMapping:Mt})}),nk=g.createContext(void 0);function rk(){let e=g.useContext(nk);if(e===void 0)throw Error(S(70));return e}var ik=g.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return UO().useState(`mounted`)||n?(0,G.jsx)(nk.Provider,{value:n,children:(0,G.jsx)(Ra,{ref:t,...r})}):null}),ak=g.createContext(void 0);function ok(){let e=g.useContext(ak);if(e===void 0)throw Error(S(71));return e}var sk=g.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=fi,style:_,...v}=e,y=UO(),b=rk(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`trackCursorAxis`),w=y.useState(`disableHoverablePopup`),T=y.useState(`floatingRootContext`),E=y.useState(`instantType`),D=y.useState(`transitionStatus`),O=il({anchor:i,positionMethod:a,floatingRootContext:T,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,adaptiveOrigin:y.useState(`adaptiveOrigin`)}),k=cl(e,g.useMemo(()=>({open:x,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:C===`none`?E:`tracking-cursor`}),[x,O.side,O.align,O.anchorHidden,C,E]),{styles:O.positionerStyles,transitionStatus:D,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x||C===`both`||w});return(0,G.jsx)(ak.Provider,{value:O,children:k})}),ck=g.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=UO(),{side:s,align:c}=ok(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);ii({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Cc(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Vr(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[Ws,f,sl(d),a],stateAttributesMapping:Ft})}),lk=g.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=UO(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=ok();return Vr(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:Pt})});function uk(e){return(0,G.jsx)(JO,{...e})}function dk(e){return(0,G.jsx)(tk,{"data-slot":`tooltip-trigger`,...e})}function fk({className:e,arrow:t=!0,children:n,...r}){let{positioner:i,portal:a,popup:o}=vE(r);return(0,G.jsx)(ik,{...a,children:(0,G.jsx)(sk,{side:`top`,align:`center`,alignOffset:0,sideOffset:t?8:4,...i,className:X(`isolate z-50`,i.className),children:(0,G.jsxs)(ck,{"data-slot":`tooltip-content`,className:X(`bg-background-inverse text-foreground-inverse rounded-xs px-3 py-1.5 text-xs shadow-md`,`motion-safe:origin-(--transform-origin) motion-safe:transition-[opacity,scale] motion-safe:duration-200 motion-safe:ease-[cubic-bezier(0.175,0.885,0.32,1.5)]`,`data-starting-style:motion-safe:scale-90 data-starting-style:motion-safe:opacity-0`,`data-ending-style:motion-safe:scale-95 data-ending-style:motion-safe:opacity-0 data-ending-style:motion-safe:duration-100 data-ending-style:motion-safe:ease-out`,`data-instant:motion-safe:transition-none`,e),...o,children:[n,t&&(0,G.jsx)(lk,{"data-slot":`tooltip-arrow`,className:X(`bg-background-inverse fill-background-inverse size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]`,`data-[side=top]:-bottom-2.5`,`data-[side=bottom]:top-1`,`data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2`,`data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2`,`data-[side=inline-start]:-inset-e-1 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-translate-y-1/2`,`data-[side=inline-end]:-inset-s-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-translate-y-1/2`)})]})})})}function pk({className:e}){return(0,G.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:e??`size-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.2`}),(0,G.jsx)(`path`,{d:`M6.3 6.1a1.75 1.75 0 0 1 3.4.55c0 1.15-1.7 1.35-1.7 2.55`}),(0,G.jsx)(`path`,{d:`M8 11.5h.01`})]})}function mk({tone:e}){return(0,G.jsx)(`span`,{className:RE(`inline-block size-2 shrink-0 rounded-full`,zE[e]),"aria-hidden":!0})}function $({label:e,hint:t,tone:n,mono:r,nowrap:i,children:a}){return(0,G.jsxs)(`div`,{className:RE(`flex justify-between gap-4 border-b border-border-muted py-2 last:border-b-0`,i?`items-center whitespace-nowrap`:`items-baseline`),children:[(0,G.jsx)(`dt`,{className:i?`shrink-0 text-xs text-foreground-muted`:`min-w-0 flex-1 text-sm text-foreground-muted`,children:t?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[e,(0,G.jsxs)(uk,{children:[(0,G.jsx)(dk,{delay:250,render:(0,G.jsx)(`button`,{type:`button`,"aria-label":t,title:t,className:`shrink-0 cursor-pointer text-foreground-muted transition-colors duration-200 hover:text-foreground-strong focus-visible:outline-none motion-reduce:transition-none`,children:(0,G.jsx)(pk,{})})}),(0,G.jsx)(fk,{className:`max-w-72`,children:(0,G.jsx)(`p`,{children:t})})]})]}):e}),(0,G.jsx)(`dd`,{className:RE(`shrink-0 text-right text-sm`,i?`whitespace-nowrap text-xs`:`min-w-0 break-all`,r?`font-mono text-xs text-foreground-strong`:`text-foreground`,n&&BE[n]),children:a})]})}function hk({children:e,className:t}){return(0,G.jsx)(`dl`,{className:RE(`mt-1`,t),children:e})}function gk({tone:e,text:t,detail:n}){return(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-center justify-end gap-x-2`,children:[(0,G.jsx)(mk,{tone:e}),(0,G.jsx)(`span`,{children:t}),n?(0,G.jsx)(`span`,{className:`text-xs text-foreground-muted`,children:n}):null]})}function _k(e){return e.available?e.enabled?e.error?`panel.tailcat.error`:e.ready?`panel.tailcat.ready`:`panel.tailcat.starting`:`panel.tailcat.disabled`:`panel.tailcat.unavailable`}function vk(e){return e.available?e.enabled?e.path===`direct`&&e.active?`panel.p2p.open`:e.error?`panel.p2p.error`:e.path===`failed`?`panel.p2p.blocked`:e.ready?e.path===`waiting`?`panel.p2p.waiting`:`panel.p2p.punching`:e.started?`panel.p2p.punching`:`panel.p2p.waiting`:`panel.p2p.disabled`:`panel.p2p.unavailable`}function yk(e){return!e.available||!e.enabled?`off`:e.path===`direct`&&e.active?`ok`:e.error||e.path===`failed`?`error`:`warn`}function bk(e){return!e.available||!e.enabled?`off`:e.error?`error`:e.ready?`ok`:`warn`}function xk({status:e,busy:t,onToggle:n,onManageTailcat:r,onManageP2P:i}){let a=e.tunnel,o=e.enabled,s=e.tailcat??null,c=e.p2p??null;return(0,G.jsxs)(uO,{frame:`solid`,children:[(0,G.jsx)(dO,{className:`px-4 py-3`,children:(0,G.jsx)(fO,{className:`text-base lg:text-lg`,children:Q(`panel.connection.state`)})}),(0,G.jsxs)(`label`,{className:`flex items-center justify-between gap-4 border-b border-border-muted py-3`,children:[(0,G.jsx)(`span`,{className:`text-sm text-foreground-muted`,children:Q(`panel.connection.remoteControl`)}),(0,G.jsx)(VO,{size:`md`,checked:o,disabled:t!==``,onCheckedChange:e=>n(e),"aria-label":Q(`panel.connection.remoteControl`)})]}),(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.connection.deviceName`),children:e.name||`—`}),(0,G.jsx)($,{label:Q(`panel.connection.instanceId`),mono:!0,children:e.instanceId||`—`}),(0,G.jsxs)($,{label:Q(`panel.connection.platform`),children:[e.platform,` `,e.osVersion,` · `,e.arch]}),(0,G.jsx)($,{label:Q(`panel.connection.tunnel`),tone:HE(a.state),...a.state===`error`&&a.error?{"data-error":a.error}:{},children:(0,G.jsx)(gk,{tone:HE(a.state),text:UE(a.state),...a.error?{detail:a.error}:{}})}),s?(0,G.jsx)($,{label:Q(`panel.tailcat.title`),tone:bk(s),children:(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-center justify-end gap-x-2`,children:[(0,G.jsx)(gk,{tone:bk(s),text:Q(_k(s)),...s.error?{detail:s.error}:{}}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:r,children:Q(`panel.tailcat.manage`)})]})}):null,c?(0,G.jsx)($,{label:Q(`panel.p2p.title`),tone:yk(c),children:(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-center justify-end gap-x-2`,children:[(0,G.jsx)(gk,{tone:yk(c),text:Q(vk(c)),...c.error?{detail:c.error}:{}}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:i,children:Q(`panel.p2p.manage`)})]})}):null,(0,G.jsx)($,{label:Q(`panel.connection.sidecar`),children:(0,G.jsx)(gk,{tone:e.sidecar.state===`healthy`?`ok`:`warn`,text:KE(e.sidecar.state),...e.sidecar.restarts>0?{detail:Q(`panel.connection.sidecarRestarts`,{count:e.sidecar.restarts})}:{}})}),(0,G.jsx)($,{label:Q(`panel.connection.mirror`),children:(0,G.jsx)(gk,{tone:e.mirror.ok?`ok`:e.mirror.error?`error`:`warn`,text:e.mirror.ok?Q(`panel.connection.mirrorOk`):Q(`panel.connection.mirrorOff`),detail:VE(e.mirror.pushedAt)})})]}),e.lan.recovery?.state===`awaiting-device`?(0,G.jsx)(hk,{children:(0,G.jsx)($,{label:Q(`panel.connection.lan`),children:(0,G.jsx)(gk,{tone:`warn`,text:Q(`panel.connection.lanWaiting`)})})}):e.lan.recovery?.state===`verified`?(0,G.jsx)(hk,{children:(0,G.jsx)($,{label:Q(`panel.connection.lan`),children:(0,G.jsx)(gk,{tone:`ok`,text:Q(`panel.connection.lanVerified`)})})}):null,e.lan.enabled&&(e.lan.error||e.lan.discovery?.error)?(0,G.jsxs)(ZD,{variant:`warning`,className:`mt-3`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.connection.lan`)}),(0,G.jsx)(tO,{children:e.lan.error||e.lan.discovery?.error})]}):null,(0,G.jsx)(Sk,{status:e})]})}function Sk({status:e}){let t=e.tunnel.admissionHint;return t?t===`register-secret`?(0,G.jsxs)(ZD,{variant:`warning`,className:`mt-3`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.connection.relayNeedsSecret`)}),(0,G.jsx)(tO,{children:Q(`panel.connection.relayNeedsSecretBody`)})]}):(0,G.jsxs)(ZD,{variant:`warning`,className:`mt-3`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.connection.relayRejected`)}),(0,G.jsx)(tO,{children:Q(`panel.connection.relayRejectedBody`)})]}):null}function Ck(e){return Pf(`alert-dialog`,e)}var wk=class extends Uf{};function Tk(){return new wk}var Ek=Object.assign(function(e){return(0,G.jsx)(Ck,{...e})},{createHandle:Tk});function Dk({className:e,children:t,backdrop:n=!0,frame:r=!0,backdropProps:i,viewportProps:a,...o}){let{portal:s,popup:c}=Kf(o),l=i?.forceRender===!0,u=r&&n;return(0,G.jsxs)(hf,{...s,children:[n&&(0,G.jsx)(Gd,{"data-slot":`alert-dialog-backdrop`,...i,className:X(`fixed inset-0 z-50 bg-black/30 backdrop-blur-sm supports-[-webkit-touch-callout:none]:absolute`,`motion-safe:transition-opacity motion-safe:duration-250 motion-safe:ease-out`,`data-ending-style:motion-safe:opacity-0 data-starting-style:motion-safe:opacity-0`,i?.className)}),(0,G.jsx)(If,{"data-slot":`alert-dialog-viewport`,...a,className:X(`fixed inset-0 z-50 flex items-center justify-center overflow-hidden p-4`,a?.className),children:(0,G.jsx)(pf,{"data-slot":`alert-dialog-popup`,...u?{"data-frame":``}:{},className:X(`group/alert-dialog-popup relative flex max-h-full min-h-0 w-100 max-w-full flex-col`,`rounded-2xl border`,u?X(`border-white/15 bg-white/10 p-1.5 backdrop-blur-sm`,!l&&`data-nested:border-border-overlay data-nested:bg-background data-nested:p-0 data-nested:shadow-2xl data-nested:backdrop-blur-none`):`bg-background border-border-overlay`,!u&&`shadow-2xl`,`isolate transform-gpu outline-none`,`motion-safe:transition-[opacity,scale] motion-safe:duration-250 motion-safe:ease-[cubic-bezier(0.175,0.885,0.32,1.5)]`,`data-starting-style:motion-safe:scale-95 data-starting-style:motion-safe:opacity-0`,`data-ending-style:motion-safe:scale-95 data-ending-style:motion-safe:opacity-0 data-ending-style:motion-safe:duration-100 data-ending-style:motion-safe:ease-out`,e),...c,children:(0,G.jsx)(`div`,{"data-slot":`alert-dialog-content`,className:X(`flex min-h-0 flex-col overflow-hidden not-has-[>[data-slot=alert-dialog-footer]]:pb-6 not-has-[>[data-slot=alert-dialog-header]]:pt-6 [&>[data-slot=alert-dialog-header]+[data-slot=alert-dialog-footer]]:pt-0`,u&&X(`bg-background rounded-[calc(var(--radius-2xl)*5/6)]`,!l&&`group-data-nested/alert-dialog-popup:rounded-none group-data-nested/alert-dialog-popup:bg-transparent`)),children:t})})})]})}function Ok({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:X(`flex shrink-0 flex-col gap-2 p-6`,e),...t})}function kk({className:e,...t}){return(0,G.jsx)(Lf,{"data-slot":`alert-dialog-title`,className:X(`text-foreground-intense text-xl font-semibold`,e),...t})}function Ak({className:e,...t}){return(0,G.jsx)(Jd,{"data-slot":`alert-dialog-description`,className:X(`text-foreground-muted text-sm`,e),...t})}function jk({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-body`,className:X(`min-h-0 flex-1 px-6`,e),...t})}function Mk({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:X(`flex flex-col-reverse gap-2 p-6 sm:flex-row sm:justify-end`,e),...t})}var Nk=`data-checked`,Pk=`data-unchecked`,Fk={checked(e){return e?{[Nk]:``}:{[Pk]:``}},...xt,...yO},Ik=`data-composite-item-active`,Lk=g.createContext({disabled:!1});function Rk(){return g.useContext(Lk)}var zk=g.createContext(void 0);function Bk(){return g.useContext(zk)}function Vk(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Hk=g.createContext(void 0);function Uk(){let e=g.useContext(Hk);if(e===void 0)throw Error(S(52));return e}var Wk=g.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,readOnly:a=!1,required:o=!1,"aria-labelledby":s,value:c,inputRef:l,nativeButton:u=!1,id:d,style:f,...m}=e,_=Bk(),{disabled:v,readOnly:y,required:x,form:S,checkedValue:C,touched:w=!1,validation:T,name:E,setCheckedValue:D=p,setTouched:O=p,registerInputRef:k=p}=_??{},{setTouched:A,setFilled:j,state:M,disabled:N}=TO(),P=Rk(),{labelId:F,getDescriptionProps:I}=AO(),L=N||P.disabled||v||i,R=y||a,z=x||o,B=S,V=_?C===c:c===``,H=g.useRef(null),U=g.useRef(null),W=T?.registerInput,ee=hr(l,U,k,g.useCallback(e=>W?.(e,{controlRef:H,value:void 0}),[W]));b(()=>{U.current?.checked&&j(!0)},[j]),b(()=>{if(U.current){if(L&&V){k(null);return}k(U.current)}},[V,L,k]);let K=qd(),te=PO({id:d}),q=u?void 0:te,ne={role:`radio`,"aria-checked":V,"aria-labelledby":jO(s,F,U,!u,q),[Ik]:V?``:void 0,id:u?te:K,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||L||R)return;e.preventDefault();let t=U.current;t&&ca(t,e)},onFocus(e){e.defaultPrevented||L||R||!w||(U.current?.click(),O(!1))}},{getButtonProps:re,buttonRef:ie}=la({disabled:L,native:u,composite:!1}),ae={type:`radio`,ref:ee,form:B,id:q,name:E,tabIndex:-1,style:E?pr:fr,"aria-hidden":!0,...c===void 0?h:{value:Vk(c)},disabled:L,checked:V,required:z,readOnly:R,onChange(e){if(e.nativeEvent.defaultPrevented||L||R||c===void 0)return;let t=ja(ma,e.nativeEvent);D(c,t),!t.isCanceled&&A(!0)},onClick(e){e.stopPropagation()},onFocus(){H.current?.focus()}},J=g.useMemo(()=>({...M,required:z,disabled:L,readOnly:R,checked:V}),[M,L,R,V,z]),oe=J,se=_!==void 0,ce=[t,H,ie],le=[ne,m,re,I,T?e=>T.getValidationProps(L,e):h],ue=Vr(`span`,e,{enabled:!se,state:J,ref:ce,props:le,stateAttributesMapping:Fk});return(0,G.jsxs)(Hk.Provider,{value:oe,children:[se?(0,G.jsx)(oE,{tag:`span`,render:n,className:r,style:f,state:J,refs:ce,props:le,stateAttributesMapping:Fk}):ue,(0,G.jsx)(`input`,{...ae,suppressHydrationWarning:!0})]})}),Gk=g.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Uk(),c=s.checked,{mounted:l,transitionStatus:u,setMounted:d}=Us(c),f={...s,transitionStatus:u},p=g.useRef(null),m=a||l,h=Vr(`span`,e,{ref:[t,p],state:f,props:o,stateAttributesMapping:Fk});return ii({batch:!0,enabled:!c,open:c,ref:p,onComplete(){c||d(!1)}}),m?h:null}),Kk={duration:.3,ease:[.4,0,.2,1]},qk={duration:.3,ease:[.4,0,.2,1]},Jk={duration:0};function Yk({checked:e,reduced:t}){return(0,G.jsx)(Gk,{"data-slot":`radio-indicator`,className:`flex items-center justify-center`,keepMounted:!0,children:(0,G.jsx)(HS.span,{className:`bg-primary-foreground size-[0.5em] min-h-2 min-w-2 rounded-full`,initial:!1,animate:{scale:+!!e},transition:t?Jk:qk})})}function Xk({renderProps:e,state:t,reduced:n}){let{checked:r}=t,{ref:i,...a}=e,[o,s]=VS(),c=Hu(i,o),l=g.useRef(r);return g.useEffect(()=>{let e=l.current!==r;l.current=r,e&&!n&&s(o.current,{scale:[1,.8,1.1,1]},Kk)},[r,s,o,n]),(0,G.jsx)(`span`,{"data-slot":`radio`,...a,ref:c,children:(0,G.jsx)(Yk,{checked:r,reduced:n})})}function Zk({className:e,...t}){let n=KS(),r=t[`aria-invalid`],i=r===!0||r===`true`;return(0,G.jsx)(ix,{features:lS,strict:!0,children:(0,G.jsx)(Wk,{...t,...i?{"data-invalid":``}:{},className:X(`flex size-[1em] min-h-4 min-w-4 shrink-0 cursor-default items-center justify-center`,`bg-background border-border-strong outline-ring-input rounded-full border outline-offset-1`,`transition-[background-color,border-color,box-shadow] duration-200 motion-reduce:transition-none`,`hover:not-data-checked:not-data-disabled:not-data-invalid:border-border-emphasis`,`data-checked:bg-primary data-checked:outline-ring-primary data-checked:border-transparent`,`data-disabled:not-data-checked:bg-background-subtle data-disabled:data-checked:opacity-disabled data-disabled:cursor-not-allowed data-disabled:not-data-checked:border-dashed`,`data-invalid:border-error data-invalid:not-data-checked:bg-error-subtle data-invalid:outline-ring-error`,e),render:(e,t)=>(0,G.jsx)(Xk,{renderProps:e,state:t,reduced:n})})})}function Qk(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=m}=e,[p,h]=g.useState(0),_=r!=null,v=g.useRef(null),y=hr(v,c),x=g.useRef([]),S=g.useRef(!1),C=g.useRef(null),w=o??p,T=J((e,t=!1)=>{if(C.current=x.current[e]??null,(s??h)(e),t){let t=x.current[e];sf(v.current,t,a,n)}}),E=J(e=>{if(e.size===0)return;if(S.current){let e=x.current,t=e.indexOf(C.current);if(t===-1){let t=e[w];!t||jn(e,w,d)?T($k(e,d)):C.current=t}else t!==w&&T(t);return}S.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)T(i);else if(jn(t,w,d)){let e=An(t,{disabledIndices:d});Dn(t,e)||T(e)}sf(v.current,r,a,n)});b(()=>{if(d==null||o!=null||!S.current)return;let e=x.current;if(jn(e,w,d)){let t=An(e,{disabledIndices:d});Dn(e,t)||T(t)}},[d,o,w,x,T]);let D=J((e,t,n)=>i?i(e,t,n,x):n),O=J(e=>{let o=e.key===`Home`||e.key===`End`;if(!tf.has(e.key)||!l&&o||eA(e,f)||!v.current)return;let s=a===`rtl`,c=s?$d:ef,p=s?ef:$d,m=n===`vertical`?Qd:c,h=n===`vertical`?Zd:p,g=ut(e.nativeEvent);if(g!=null&&of(g)&&!hE(g)){let t=g.selectionStart,n=g.selectionEnd,r=g.value;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==m&&t>0)return}let y=w,b=On(x,d),S=kn(x,d);r!=null&&(y=r({disabledIndices:d,elementsRef:x,event:e,highlightedIndex:w,loopFocus:t,maxIndex:S,minIndex:b,onLoop:D,orientation:n,rtl:s}));let C=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,E=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?y=b:e.key===`End`&&(y=S)),y===w&&(C||E)&&(t&&y===S&&C?(y=b,i&&(y=i(e,w,y,x))):t&&y===b&&E?(y=S,i&&(y=i(e,w,y,x))):y=An(x.current,{startingIndex:y,decrement:E,disabledIndices:d})),y!==w&&!Dn(x.current,y)&&(u&&e.stopPropagation(),(_||o||C||E)&&e.preventDefault(),T(y,!0),queueMicrotask(()=>{x.current[y]?.focus()}))});return{props:{ref:y,onFocus(e){let t=v.current,n=ut(e.nativeEvent);t&&n!=null&&of(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:O},highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:x,onMapChange:E,relayKeyboardEvent:O}}function $k(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!jn(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function eA(e,t){for(let n of rf)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function tA(e){let{render:t,className:n,style:r,refs:i=m,props:a=m,state:o=h,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:_,onMapChange:v,stopEventPropagation:y=!0,rootRef:b,disabledIndices:x,modifierKeys:S,highlightItemOnHover:C=!1,tag:w=`div`,...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:O,elementsRef:k,onMapChange:A,relayKeyboardEvent:j}=Qk({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:b,stopEventPropagation:y,enableHomeAndEndKeys:_,direction:Wc(),disabledIndices:x,modifierKeys:S}),M=Vr(w,e,{state:o,ref:i,props:[E,...a,T],stateAttributesMapping:s}),N=g.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:O,highlightItemOnHover:C,relayKeyboardEvent:j}),[D,O,C,j]);return(0,G.jsx)(aa.Provider,{value:N,children:(0,G.jsx)(kT,{elementsRef:k,onMapChange:e=>{v?.(e),A(e)},children:M})})}function nA(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var rA=Object.keys(_O);function iA(e,t){return e.matches(`:disabled`)?!1:!t||e.form===t||e.form===null&&!e.hasAttribute(`form`)}function aA(e,t){let n=null;for(let r of e.keys())if(iA(r,t)){if(!r.validity.valid)return r;n??=r}return n}function oA(e){return{..._O,valid:!e,customError:e}}function sA(e){return e&&e.validationMessage?[e.validationMessage]:[]}function cA(e){let{elementRef:t,formRef:n}=OO(),{setValidityData:r,validate:i,validityData:a,validationDebounceTime:o,invalid:s,markedDirtyRef:c,state:l,shouldValidateOnChange:u,validationMode:d,registeredFieldIdRef:f}=e,{controlId:p,getDescriptionProps:m}=AO(),_=Ge(),v=g.useRef(null),b=y(()=>new Map).current,x=g.useRef(0),S=g.useRef(null),C=g.useCallback((e,t)=>(b.set(e,t),()=>{b.delete(e)}),[b]),w=J(()=>{let e=aA(b,t.current);return e&&b.get(e)?.controlRef.current||null}),T=J(async(e,o=!1)=>{x.current+=1;let m=x.current;function h(e,t=s){let r=f.current??p;if(r==null)return;let i=n.current.fields.get(r);if(!i)return;let a=nA(e,t);n.current.fields.set(r,{...i,validityData:a})}function g(t,n){let r=t.valid===!1?n:[];return{value:e,state:t,error:r[0]??``,errors:r,initialValue:a.initialValue}}function y(e,t){let n=e.validity.customError?e.validationMessage:``,r=t.replace(/\r\n?/g,`
|
|
24
24
|
`);e.setCustomValidity(r),S.current=[e,r,n]}function C(){let e=S.current;S.current=null,e&&(!e[0].willValidate||e[0].validationMessage===e[1])&&e[0].setCustomValidity(e[2])}function w(e,t,n){let i=g(e,t);h(i,n),r(i)}function T(e){let t=rA.reduce((t,n)=>(t[n]=e.validity[n],t),{}),n=!1;for(let e of rA)if(e!==`valid`){if(e===`valueMissing`&&t[e])n=!0;else if(t[e])return t}return n&&!c.current&&(t.valid=!0,t.valueMissing=!1),t}function E(){return b.size>0?aA(b,t.current):v.current}let D=E();function O(){return D=E(),D?.willValidate?T(D):oA(!1)}if(o){if(l.valid!==!1||!D)return;if(!D.validity.valueMissing){C();let e=E(),t=e?.validity.customError?sA(e):[];w(oA(t.length>0),t,!1);return}for(let e of rA)if(e!==`valid`&&e!==`valueMissing`&&e!==`customError`&&D.validity[e])return}_.clear(),C();let k=O(),A=sA(D),j=u();if(A.length===0||j){let t=Array.from(n.current.fields.values()).reduce((e,t)=>(t.name&&(e[t.name]=t.getValue()),e),{}),r=i(e,t),o;if(typeof r==`object`&&r&&`then`in r){if(k.valid===!1?w(k,A):(d===`onSubmit`||!a.state.customError)&&(k.valid=null,w(k,A)),o=await r,m!==x.current)return;k=O()}else o=r;A=o?[].concat(o).filter(Boolean):[],A.length>0?(k.valid=!1,k.customError=!0,D?.willValidate&&y(D,A.join(`
|
|
25
|
-
`))):A=sA(D)}w(k,A)}),E=J((e,t=!1)=>{if(_.clear(),x.current+=1,t)return;let n=u();n&&e!==``&&o?_.start(o,()=>{T(e)}):T(e,!n)}),D=g.useCallback((e,t={})=>Dr(m(t),l.valid===!1&&!l.disabled&&!e?{"aria-invalid":!0}:h),[m,l.disabled,l.valid]);return g.useMemo(()=>({getValidationProps:D,inputRef:v,registeredInputs:b,registerInput:C,getInputControl:w,commit:T,change:E}),[D,b,C,w,T,E])}var lA=g.createContext(void 0);function uA(e=!1){let t=g.useContext(lA);if(!t&&!e)throw Error(S(86));return t}var dA=[nf],fA=g.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:m,...h}=e,{setTouched:_,setFocused:v,validationMode:y,name:b,disabled:x,state:S,validation:C,setDirty:w,setFilled:T,validityData:E}=TO(),{labelId:D}=AO(),{clearErrors:O,elementRef:k}=OO(),A=uA(!0),j=x||i,M=b??d,N=qd(p),[P,F]=QC({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[I,L]=g.useState(!1),R=J((e,t)=>{s?.(e,t),!t.isCanceled&&F(e)}),z=C.getInputControl,B=g.useMemo(()=>({get current(){return z()}}),[z]),V=g.useRef(null),H=g.useRef(null);function U(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),V.current=e,t}let W=J(e=>{if(!e||e.disabled)return;H.current||=e;let t=V.current,n=e.checked||t==null||t.disabled?U(e):void 0;return()=>{H.current===e&&(H.current=null),V.current===e?n?(n(),V.current=null):U(null):n?.()}}),ee=J(()=>{let e=k.current;if(!e)return P??null;for(let t of C.registeredInputs.keys())if(t.checked&&iA(t,e))return P??null;return null});EO(B,N,P??null,ee,!j,d),zf(P,()=>{O(M),w(P!==E.initialValue),T(P!=null),C.change(P);let e=H.current;P==null&&e&&!e.disabled&&U(e)});let K=D??A?.legendId,te={...S,disabled:j??!1,required:o??!1,readOnly:a??!1},q=g.useMemo(()=>({checkedValue:P,disabled:j,form:u,validation:C,name:M,readOnly:a,registerInputRef:W,required:o,setCheckedValue:R,setTouched:L,touched:I}),[P,j,u,C,M,a,W,o,R,L,I]),ne={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":j||void 0,"aria-readonly":a||void 0,"aria-labelledby":K,onFocus(){v(!0)},onBlur(e){Y(e.currentTarget,e.relatedTarget)||(_(!0),v(!1),y===`onBlur`&&C.commit(P))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(L(!0),v(!0))}};return(0,G.jsx)(zk.Provider,{value:q,children:(0,G.jsx)(tA,{render:n,className:r,style:m,state:te,props:[ne,h,e=>C.getValidationProps(j??!1,e)],refs:[t],stateAttributesMapping:yO,enableHomeAndEndKeys:!1,modifierKeys:dA})})});function pA({className:e,orientation:t=`vertical`,...n}){return(0,G.jsx)(fA,{"data-slot":`radio-group`,"aria-orientation":t,className:X(`flex`,t===`horizontal`?`flex-wrap gap-4`:`flex-col gap-2`,e),...n})}function mA(e){if(!Array.isArray(e))return`full`;if(e.length===0)return`none`;let t=new Set(e);return[`input`,`dispatch`,`operate`,`files.write`,`transfer`,`manage`,`config`].some(e=>t.has(e))?`full`:t.has(`approve`)?`approve`:`readonly`}var hA=3e4,gA=1e3;function _A(e,t=Date.now()){let n=e?.tailcat?.expiresAt??0;if(!Number.isFinite(n)||n<=0)return null;let r=n*1e3-t;return r<=0?null:Math.max(r-hA,gA)}var vA=class extends Error{constructor(e,t,n){super(e),q(this,`code`,void 0),q(this,`status`,void 0),this.name=`ApiError`,this.code=t,this.status=n}};async function yA(e){let t=null;try{t=await e.json()}catch{t=null}let n=t?.error;if(typeof n==`string`&&n)return new vA(n,`http_${e.status}`,e.status);if(n&&typeof n==`object`){let t=n,r=typeof t.code==`string`&&t.code?t.code:`http_${e.status}`;return new vA(typeof t.message==`string`&&t.message?t.message:Q(`panel.net.requestFailed`,{status:e.status}),r,e.status)}return new vA(Q(`panel.net.requestFailed`,{status:e.status}),`http_${e.status}`,e.status)}async function bA(e){let t=e.split(`?`)[0]===`/api/relay/pairing`,n=t?3e4:e===`/api/relay/status`?12e3:0,r=n?new AbortController:null,i=r?window.setTimeout(()=>r.abort(),n):null;try{let n=await fetch(e,{headers:{accept:`application/json`},...r?{signal:r.signal}:{}});if(!n.ok)throw await yA(n);let i=await n.json();if(t&&(i?.ok!==!0||typeof i.svg!=`string`||!i.svg.includes(`<svg`)))throw new vA(Q(`panel.pairing.qrFailed`),`pairing_invalid`,n.status);return i}catch(e){throw r?.signal.aborted?new vA(Q(t?`panel.console.pairingTimeout`:`panel.console.statusTimeout`),t?`pairing_timeout`:`status_timeout`,0):e}finally{i!==null&&window.clearTimeout(i)}}async function xA(e,t){let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`,accept:`application/json`},body:JSON.stringify(t??{})});if(!n.ok)throw await yA(n);let r=await n.json();return SA(r),r}function SA(e){let t=e?.applyError;if(typeof t==`string`&&t)throw new vA(Q(`panel.shell.applyFailed`,{message:t}),`apply_failed`,200)}function CA(e,t){return xA(`/api/relay/devices/permissions`,{deviceId:e,tier:t})}function wA(e){return e instanceof vA?e.message:e instanceof Error?e.message||Q(`panel.net.requestFailedNoStatus`):String(e)}function TA(e){let t=g.useRef(!0);t.current&&(t.current=!1,e())}var EA=g.createContext(void 0),DA=g.createContext(void 0),OA=g.createContext(void 0);function kA(){let e=g.useContext(EA);if(e===void 0)throw Error(S(60));return e}function AA(){let e=g.useContext(DA);if(e===void 0)throw Error(S(101));return e}function jA(){let e=g.useContext(OA);if(e===void 0)throw Error(S(61));return e}function MA(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var NA=(e,t)=>Object.is(e,t);function PA(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function FA(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!MA(e,t,(e,t)=>PA(e,t,n)):e!==t}function IA(e,t,n){return e?e.some(e=>e!==void 0&&PA(t,e,n)):!1}function LA(e,t,n){return e?e.findIndex(e=>e!==void 0&&PA(e,t,n)):-1}function RA(e,t){if(t!==NA)return n=>IA(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function zA(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(RA(t,n)):LA(e,t,n);return i===-1?null:i}function BA(e,t,n,r,i,a){return IA(r,t,i)?a!=null&&e>a&&IA(r,n[a],i)?a:e:e===a?zA(n,r,i,!0):a}function VA(e,t,n){return e.filter(e=>!PA(t,e,n))}function HA(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function UA(e){return HA(e?.[0])}function WA(e){return UA(e)?e.flatMap(e=>e.items):e}function GA(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(UA(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function KA(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Vk(e)}function qA(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Vk(e.value):Vk(e)}function JA(e,t,n){function r(){return KA(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=WA(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function YA(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,G.jsx)(g.Fragment,{children:JA(r,t,n)},i)),e),[])}var XA={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:qA(t,r)!==``},hasNullItemLabel:(e,t)=>t?GA(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>PA(t,e,n)):PA(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function ZA(e,t){return Math.max(0,e-t)}function QA(e,t){if(t<=0)return 0;let n=mi(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function $A(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:_=!1,modal:v=!0,actionsRef:x,inputRef:S,onOpenChangeComplete:C,items:w,multiple:T=!1,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O=NA,highlightItemOnHover:k=!0,children:A}=e,{clearErrors:j}=OO(),{setDirty:M,setTouched:N,setFocused:P,validityData:F,setFilled:I,name:L,disabled:R,validation:z,validationMode:B}=TO(),V=PO({id:t}),H=R||d,U=L??c,[W,ee]=QC({controlled:n,default:T?r??m:r,name:`Select`,state:`value`}),[K,te]=QC({controlled:a,default:o,name:`Select`,state:`open`}),q=g.useRef([]),ne=g.useRef([]),re=g.useRef(null),ie=g.useRef(null),ae=g.useRef(0),oe=g.useRef(null),se=g.useRef([]),le=g.useRef(!1),ue=g.useRef(null),de=g.useRef(null),fe=g.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=g.useRef(!1),me=g.useRef(W),{mounted:he,setMounted:ge,transitionStatus:_e}=Us(K),{openMethod:ve,triggerProps:ye}=Vf(K),be=y(()=>new ce({id:V,labelId:void 0,modal:v,multiple:T,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O,value:W,open:K,mounted:he,transitionStatus:_e,items:w,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:h,triggerProps:h,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:p,setOpen:p,handleScrollArrowVisibility:p,onOpenChangeComplete:p,listRef:q,popupRef:re,scrollHandlerRef:ie,scrollArrowsMountedCountRef:ae,valueRef:oe,valuesRef:se,labelsRef:ne,typingRef:le,selectionRef:fe,firstItemTextRef:ue,selectedItemTextRef:de,alignItemWithTriggerActiveRef:pe,initialValueRef:me},XA)).current,xe=be.useState(`activeIndex`),Se=be.useState(`selectedIndex`),Ce=be.useState(`triggerElement`),we=be.useState(`positionerElement`),Te=pE(ve),Ee=ve??Te,De=g.useMemo(()=>T?``:qA(W,D),[T,W,D]),Oe=g.useMemo(()=>T&&Array.isArray(W)?W.map(e=>qA(e,D)):qA(W,D),[T,W,D]);EO(Ba(Ce),V,W,J(()=>Oe),!H,c);let ke=T?Array.isArray(W)&&W.length>0:W!=null&&De!==``;b(()=>{I(ke)},[ke,I]),b(function(){let e=zA(se.current,W,O,T);e===null&&(de.current=null),!K&&be.set(`selectedIndex`,e)},[T,K,W,O,be]),zf(W,()=>{j(U),M(FA(W,F.initialValue,O)),z.change(W)});let Ae=J((e,t)=>{s?.(e,t),!t.isCanceled&&(te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(N(!0),P(!1),B===`onBlur`&&z.commit(W)))}),je=J(()=>{ge(!1),be.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),C?.(!1)});ii({enabled:!x,open:K,ref:re,onComplete(){K||je()}}),g.useImperativeHandle(x,()=>({unmount:je}),[je]);let Me=J((e,t)=>{i?.(e,t),!t.isCanceled&&ee(e)}),Ne=J(e=>{let t=ZA(e.scrollHeight,e.clientHeight),n=QA(e.scrollTop,t),r=n>0,i=n<t;be.set(`scrollUpArrowVisible`,r),be.set(`scrollDownArrowVisible`,i)}),Pe=pc({open:K,onOpenChange:Ae,elements:{reference:Ce,floating:we}}),Fe=ko(Pe,{enabled:!H,event:`mousedown`}),Ie=Fo(Pe),Le=Nc(Pe,{enabled:!H,listRef:q,activeIndex:xe,selectedIndex:Se,disabledIndices:m,onNavigate(e){(e!==null||K)&&be.set(`activeIndex`,e)},focusItemOnHover:k}),Re=Pc(Pe,{enabled:!H&&(K||!f&&!T),listRef:ne,activeIndex:xe,selectedIndex:Se,disabledIndices:e=>hE(q.current[e]),onMatch(e){K?be.set(`activeIndex`,e):Me(se.current[e],ja(ma))},onTyping(e){le.current=e}}),ze=g.useMemo(()=>Dr(Re.reference,Le.reference,Ie.reference,Fe.reference,ye),[Fe.reference,Re.reference,Le.reference,Ie.reference,ye]),Be=g.useMemo(()=>Dr(Ws,Re.floating,Le.floating,Ie.floating),[Re.floating,Le.floating,Ie.floating]),Ve=Le.item??h;be.useContextCallback(`setValue`,Me),be.useContextCallback(`setOpen`,Ae),be.useContextCallback(`handleScrollArrowVisibility`,Ne),be.useContextCallback(`onOpenChangeComplete`,C),TA(()=>{be.update({popupProps:Be,triggerProps:ze})}),be.useSyncedValues({id:V,modal:v,multiple:T,value:W,open:K,mounted:he,transitionStatus:_e,popupProps:Be,triggerProps:ze,items:w,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O,openMethod:Ee});let He=g.useMemo(()=>({disabled:H,readOnly:f,required:_,multiple:T,highlightItemOnHover:k,itemProps:Ve}),[H,f,_,T,k,Ve]),Ue=hr(S,z.inputRef),We=T?void 0:U,Ge=g.useMemo(()=>!T||!Array.isArray(W)||!U?null:W.map(e=>{let t=qA(e,D);return(0,G.jsx)(`input`,{type:`hidden`,form:l,name:U,value:t,disabled:H},t)}),[T,W,l,U,D,H]);return(0,G.jsxs)(EA.Provider,{value:be,children:[(0,G.jsx)(DA.Provider,{value:He,children:(0,G.jsx)(OA.Provider,{value:Pe,children:A})}),(0,G.jsx)(`input`,{...z.getValidationProps(H,{onFocus(){be.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||H||f)return;let t=e.currentTarget.value,n=ja(ma,e.nativeEvent);function r(){if(T)return;let e=t.toLowerCase(),r=se.current.findIndex(t=>qA(t,D).toLowerCase()===e||KA(t,E).toLowerCase()===e);r===-1&&(r=se.current.findIndex((t,n)=>{let r=ne.current[n];return r!=null&&r.toLowerCase()===e}));let i=se.current[r];i!=null&&Me(i,n)}be.set(`forceMount`,!0),queueMicrotask(r)}}),id:V&&We==null?`${V}-hidden-input`:void 0,form:l,name:We,autoComplete:u,value:De,disabled:H,required:_&&!(T&&ke),readOnly:f,ref:Ue,style:U?pr:fr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ge]})}function ej(e,t){let n=qd(e);return b(()=>(t(n),()=>{t(e=>e===n?void 0:e)}),[n,t]),n}function tj(e={}){let{id:t,fallbackControlId:n,native:r=!1,setLabelId:i,focusControl:a}=e,{controlId:o,setLabelId:s}=AO(),c=ej(t,J(e=>{s(e),i?.(e)})),l=o??n;function u(e){if(a){a(e,l);return}if(!l)return;let t=Le(e.currentTarget).getElementById(l);_e(t)&&nj(t)}function d(e){ut(e.nativeEvent)?.closest(`button,input,select,textarea`)||(!e.defaultPrevented&&e.detail>1&&e.preventDefault(),!r&&u(e))}return r?{id:c,htmlFor:l,onMouseDown:d}:{id:c,onClick:d,onPointerDown(e){e.preventDefault()}}}function nj(e){e.focus({focusVisible:!0})}function rj(e,t){return e??t}var ij=`data-popup-side`,aj=400,oj={...Nt,...yO,popupSide:e=>e?{[ij]:e}:null,value:()=>null},sj=g.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,validation:f,state:p,disabled:m}=TO(),{labelId:h}=AO(),_=kA(),{readOnly:v,required:y,disabled:b}=AA(),x=m||b||a,S=_.useState(`open`),C=_.useState(`mounted`),w=_.useState(`value`),T=_.useState(`triggerProps`),E=_.useState(`positionerElement`),D=_.useState(`listElement`),O=_.useState(`popupSide`),k=_.useState(`id`),A=_.useState(`labelId`),j=_.useState(`hasSelectedValue`),M=C&&E?O:null,N=i??k,P=rj(h,A);PO({id:i});let F=Ba(E),I=g.useRef(null),{getButtonProps:L,buttonRef:R}=la({disabled:x,native:o}),z=_.useStateSetter(`triggerElement`),B=Ge(),V=Ge(),H=Ge();g.useEffect(()=>{if(S)return H.start(aj,()=>{_.context.selectionRef.current.allowUnselectedMouseUp=!0,_.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{H.clear()};_.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},V.clear()},[S,_,V,H]);let U=Dr(T,{id:N,role:`combobox`,"aria-expanded":S,"aria-haspopup":`listbox`,"aria-controls":S?D?.id??Wt(E)?.id:void 0,"aria-labelledby":P,"aria-readonly":v||void 0,"aria-required":y||void 0,tabIndex:x?-1:0,onFocus(e){u(!0),S&&_.context.alignItemWithTriggerActiveRef.current&&_.context.setOpen(!1,ja(ma,e.nativeEvent)),B.start(0,()=>{_.set(`forceMount`,!0)})},onBlur(e){Y(E,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(w))},onMouseDown(e){if(S)return;let t=Le(e.currentTarget);function n(e){if(!I.current)return;let t=e.target;Y(I.current,t)||Y(F.current,t)||rE(e,I.current)||_.context.setOpen(!1,ja(Ta,e))}V.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,L),W=f.getValidationProps(x,U);W.role=`combobox`;let G={...p,open:S,disabled:x,value:w,readOnly:v,popupSide:M,placeholder:!j};return Vr(`button`,e,{ref:[t,I,R,z],state:G,stateAttributesMapping:oj,props:W})}),cj={value:()=>null},lj=g.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=kA(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?YA(l,u,d):JA(l,u,d)),Vr(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:cj})}),uj=g.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Vr(`span`,e,{state:{open:kA().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Mt})}),dj=g.forwardRef(function(e,t){let n=kA(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,G.jsx)(La,{ref:t,...e}):null}),fj=g.createContext(void 0);function pj(){let e=g.useContext(fj);if(!e)throw Error(S(59));return e}function mj(e,t){e&&Object.assign(e.style,t)}var hj={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},gj={position:`fixed`},_j=g.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:_=di,style:v,...y}=e,x=kA(),S=jA(),C=x.useState(`open`),w=x.useState(`mounted`),T=x.useState(`modal`),E=x.useState(`value`),D=x.useState(`openMethod`),O=x.useState(`positionerElement`),k=x.useState(`triggerElement`),A=x.useState(`isItemEqualToValue`),j=x.useState(`transitionStatus`),M=g.useRef(null),N=g.useRef(null),[P,F]=g.useState(h),I=w&&P&&D!==`touch`;!w&&P!==h&&F(h),g.useImperativeHandle(x.context.alignItemWithTriggerActiveRef,()=>I),LT((I||T)&&C,D===`touch`,O,k);let L=il({anchor:n,floatingRootContext:S,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??I,collisionAvoidance:_,keepMounted:!0}),R=I?`none`:L.side,z=I?gj:L.positionerStyles,B={open:C,side:R,align:L.align,anchorHidden:L.anchorHidden};b(()=>{x.set(`popupSide`,L.side)},[x,L.side]);let V=cl(e,B,{styles:z,transitionStatus:j,props:y,refs:[t,x.useStateSetter(`positionerElement`)],hidden:!w,inert:!C}),H=g.useRef(0),U=J(e=>{if(x.context.valuesRef.current.length===0)return;let t=H.current;H.current=e.size;let n=ja(ma);if(t!==0&&!x.state.multiple&&E!==null&&LA(x.context.valuesRef.current,E,A)===-1){let e=x.context.initialValueRef.current,t=e!=null&&LA(x.context.valuesRef.current,e,A)!==-1?e:null;x.context.setValue(t,n),t===null&&(x.set(`selectedIndex`,null),x.context.selectedItemTextRef.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(E)){let e=E.filter(e=>LA(x.context.valuesRef.current,e,A)!==-1);e.length!==E.length&&(x.context.setValue(e,n),e.length===0&&(x.set(`selectedIndex`,null),x.context.selectedItemTextRef.current=null))}if(C&&I){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};mj(O,e),mj(x.context.popupRef.current,e)}}),W=g.useMemo(()=>({...L,side:R,alignItemWithTriggerActive:I,setControlledAlignItemWithTrigger:F,scrollUpArrowRef:M,scrollDownArrowRef:N}),[L,R,I,F]);return(0,G.jsx)(kT,{elementsRef:x.context.listRef,labelsRef:x.context.labelsRef,onMapChange:U,children:(0,G.jsxs)(fj.Provider,{value:W,children:[w&&T&&(0,G.jsx)(mf,{inert:Xr(!C),cutout:k}),V]})})}),vj=`base-ui-disable-scrollbar`,yj={className:vj,getElement(e){return(0,G.jsx)(`style`,{nonce:e,href:vj,precedence:`base-ui:low`,children:`.${vj}{scrollbar-width:none}.${vj}::-webkit-scrollbar{display:none}`})}},bj=g.createContext(void 0),xj={disableStyleElements:!1};function Sj(){return g.useContext(bj)??xj}var Cj=`--transform-origin`,wj={...Pt,...xt},Tj=g.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=kA(),{multiple:c,readOnly:l,highlightItemOnHover:u}=AA(),d=jA(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:_}=pj(),v=wT(!0)!=null,y=Wc(),{nonce:x,disableStyleElements:S}=Sj(),C=s.useState(`id`),w=s.useState(`open`),T=s.useState(`openMethod`),E=s.useState(`mounted`),D=s.useState(`popupProps`),O=s.useState(`transitionStatus`),k=s.useState(`triggerElement`),A=s.useState(`positionerElement`),j=s.useState(`listElement`),M=g.useRef(!1),N=g.useRef(!1),P=g.useRef({}),F=He(),I=J(e=>{if(!A||!s.context.popupRef.current||!N.current)return;let t=A.style.top===`0px`,n=A.style.bottom===`0px`;if(M.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=Oj(A),i=kj(A.getBoundingClientRect().height,`y`,r),a=Le(A),o=pe(A),c=o.getComputedStyle(A),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=Ej(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=Dj(e),g=null,_=e=>{A.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=mi(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(M.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=mi(g,0,Dj(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(M.current=!0),s.context.handleScrollArrowVisibility(e)});g.useImperativeHandle(s.context.scrollHandlerRef,()=>I,[I]),ii({open:w,ref:s.context.popupRef,onComplete(){w&&s.context.onOpenChangeComplete(!0)}});let L={open:w,transitionStatus:O,side:f,align:p};b(()=>{A&&s.context.popupRef.current&&!Object.keys(P.current).length&&(P.current={top:A.style.top||`0`,left:A.style.left||`0`,right:A.style.right,height:A.style.height,bottom:A.style.bottom,minHeight:A.style.minHeight,maxHeight:A.style.maxHeight,marginTop:A.style.marginTop,marginBottom:A.style.marginBottom})},[s,A]),b(()=>{w||m||(N.current=!1,M.current=!1,mj(A,P.current))},[w,m,A]),b(()=>{let e=s.context.popupRef.current;if(!w||!k||!A||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(N.current=!0,e.style.removeProperty(Cj),!m){F.request(()=>s.context.handleScrollArrowVisibility(j||e));return}let t=Mj(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=pe(A),i=r.getComputedStyle(A),a=r.getComputedStyle(e),o=Le(k),c=Oj(k),l=Aj(k.getBoundingClientRect(),c),d=Aj(A.getBoundingClientRect(),c),f=l.height,p=j||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),g=parseFloat(i.marginTop)||10,v=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=Ej(a),S=o.documentElement.clientHeight-g-v,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=y===`rtl`?l.right-d.width:l.left,D=0;if(t&&n){let e=Aj(n.getBoundingClientRect(),c);T=Aj(t.getBoundingClientRect(),c),E=d.left+(y===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;D=T.top-d.top+T.height/2-r}let O=w+D+v+h,N=Math.min(S,O),F=S-g-v,I=O-N,L=C-5;A.style.left=`${mi(E,5,L-d.width)}px`,A.style.height=`${N}px`,A.style.maxHeight=`none`,A.style.marginTop=`${g}px`,A.style.marginBottom=`${v}px`,e.style.height=`100%`;let R=Dj(p),z=I>=R-1;z&&(N=Math.min(S,d.height)-(I-R));let B=l.top<20||l.bottom>S-20||Math.ceil(N)+1<Math.min(m,b),V=(r.visualViewport?.scale??1)!==1&&ot;if(B||V){mj(A,P.current),_(!1);return}let H=Math.max(b,N);if(z){let e=Math.max(0,S-O);A.style.top=d.height>=F?`0`:`${e}px`,A.style.height=`${N}px`,p.scrollTop=Dj(p)}else A.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=mi(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(Cj,`50% ${i}%`)}(H===S||N>=x)&&(M.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,w,A,k,m,_,F,j,u,y,h]),g.useEffect(()=>{if(!m||!A||!w)return;let e=pe(A);function t(e){s.context.setOpen(!1,ja(Aa,e))}return Re(e,`resize`,t)},[s,m,A,w]);let R={...j?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${C}-list`},onKeyDown(e){v&&tf.has(e.key)&&e.stopPropagation()},onScroll(e){j||I(e.currentTarget)},...m&&{style:j?{height:`100%`}:hj},className:!j&&m?yj.className:void 0},z=Vr(`div`,e,{ref:[t,s.context.popupRef],state:L,stateAttributesMapping:wj,props:[D,R,sl(O),o]});return(0,G.jsxs)(g.Fragment,{children:[!S&&yj.getElement(x),(0,G.jsx)(Oo,{context:d,modal:!1,disabled:!E,openInteractionType:T,returnFocus:a,restoreFocus:!0,children:z})]})});function Ej(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Dj(e){return ZA(e.scrollHeight,e.clientHeight)}function Oj(e){return vs.getScale(e)}function kj(e,t,n){return e/n[t]}function Aj(e,t){return En({x:kj(e.x,`x`,t),y:kj(e.y,`y`,t),width:kj(e.width,`x`,t),height:kj(e.height,`y`,t)})}var jj=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Mj(e){let{style:t}=e,n={};for(let[e,r]of jj)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of jj){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Nj=g.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=kA(),{multiple:s,readOnly:c}=AA(),{alignItemWithTriggerActive:l}=pj(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:hj},className:u&&d!==`touch`?yj.className:void 0};return Vr(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),Pj=g.createContext(void 0);function Fj(){let e=g.useContext(Pj);if(!e)throw Error(S(57));return e}var Ij=g.memo(g.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=g.useRef(null),d=vT({guess:!0,label:o,textRef:u}),f=kA(),{itemProps:p,multiple:m,disabled:h,readOnly:_}=AA(),v=h||s,y=f.useState(`isActive`,d.index),x=f.useState(`open`),S=f.useState(`isSelected`,a),C=f.useState(`isSelectedByFocus`,d.index),w=f.useState(`isItemEqualToValue`),T=d.index,E=g.useRef(null);b(()=>{let e=f.context.valuesRef.current;return e[T]=a,()=>{delete e[T]}},[T,a,f]),b(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=BA(T,a,f.context.valuesRef.current,e,w,t),r=n===T,T===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&PA(a,e,w),r&&(n=T)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[T,m,w,f,a]);let D=g.useRef(`mouse`),O=g.useRef(!1),{getButtonProps:k,buttonRef:A}=la({disabled:v,focusableWhenDisabled:!0,native:c,composite:!0}),j={disabled:v,selected:S,highlighted:y};function M(e){if(h||_)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=S?VA(n,a,w):[...n,a];f.context.setValue(r,ja(ya,e))}else f.context.setValue(a,ja(ya,e)),f.context.setOpen(!1,ja(ya,e))}function N(){f.context.selectionRef.current.dragY=0}let P={role:`option`,"aria-selected":S,tabIndex:x&&y?0:-1,onKeyDown(e){f.set(`activeIndex`,T),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=D.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&Yt(e.nativeEvent)&&(n!==void 0||y),i=t&&!r&&!O.current;O.current=!1,!(v||i)&&M(e.nativeEvent)},onPointerEnter(e){D.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){D.current=e.pointerType,O.current=!0,N()},onMouseUp(){if(N(),v||D.current===`touch`||O.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&S,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!S;e||t||(O.current=!0,E.current?.click(),O.current=!1)}},F=Vr(`div`,e,{ref:[A,t,d.ref,E],state:j,props:[p,P,l,k]}),I=g.useMemo(()=>({selected:S,index:T,textRef:u,selectedByFocus:C}),[S,T,u,C]);return(0,G.jsx)(Pj.Provider,{value:I,children:F})})),Lj=g.forwardRef(function(e,t){let{selected:n}=Fj();return e.keepMounted||n?(0,G.jsx)(Rj,{...e,ref:t}):null}),Rj=g.memo(g.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Fj(),c=g.useRef(null),{transitionStatus:l,setMounted:u}=Us(s),d=Vr(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:xt});return ii({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),zj=g.memo(g.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Fj(),a=kA(),{render:o,className:s,style:c,...l}=e;return Vr(`div`,e,{ref:[g.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),Bj=g.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=kA(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=pj(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=Ge(),v=c?f:d,{mounted:y,transitionStatus:x,setMounted:S}=Us(g);b(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),ii({open:g,ref:v,onComplete(){g||S(!1)}});let C=Vr(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:x},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=ZA(e.scrollHeight,e.clientHeight),r=QA(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){_.clear();return}if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=Vj(a,c,r,e.clientHeight,t,n)}_.start(40,t)}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:xt});return y||o?C:null});function Vj(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?QA(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?QA(l.offsetTop+l.offsetHeight-r+i,a):a}var Hj=g.forwardRef(function(e,t){return(0,G.jsx)(Bj,{...e,ref:t,direction:`down`})}),Uj=g.forwardRef(function(e,t){return(0,G.jsx)(Bj,{...e,ref:t,direction:`up`})}),Wj=Ku(`w-full border text-foreground outline-none transition-[background-color,border-color,box-shadow] duration-200 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{outline:`bg-background border-border-strong hover:not-focus:not-focus-visible:not-has-focus:not-has-focus-visible:not-data-popup-open:not-has-data-popup-open:not-data-pressed:not-has-data-pressed:not-data-invalid:not-has-data-invalid:border-border-emphasis`,soft:`bg-background-muted border-transparent hover:not-focus:not-focus-visible:not-has-focus:not-has-focus-visible:not-data-popup-open:not-has-data-popup-open:not-data-pressed:not-has-data-pressed:not-data-invalid:not-has-data-invalid:border-border-strong`},size:{sm:`h-8 px-3 text-xs pointer-coarse:text-base rounded-sm gap-1.5 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='stroke-'])]:stroke-[1.75]`,md:`h-10 px-3.5 text-sm pointer-coarse:text-base rounded-md gap-2 [&_svg:not([class*='size-'])]:size-4.5 [&_svg:not([class*='stroke-'])]:stroke-[1.65]`,lg:`h-12 px-4 text-base rounded-lg gap-2 [&_svg:not([class*='size-'])]:size-5 [&_svg:not([class*='stroke-'])]:stroke-[1.65]`},state:{self:X(`focus-visible:ring-3 focus-visible:ring-ring-input focus-visible:border-transparent focus-visible:bg-background`,`data-popup-open:ring-3 data-popup-open:ring-ring-input data-popup-open:border-transparent data-popup-open:bg-background`,`data-pressed:ring-3 data-pressed:ring-ring-input data-pressed:border-transparent data-pressed:bg-background`,`data-invalid:bg-error-subtle data-invalid:border-error`,`data-invalid:focus-visible:border-transparent data-invalid:focus-visible:ring-ring-error data-invalid:focus-visible:bg-background`,`data-invalid:data-popup-open:border-transparent data-invalid:data-popup-open:ring-ring-error data-invalid:data-popup-open:bg-background`,`data-invalid:data-pressed:border-transparent data-invalid:data-pressed:ring-ring-error data-invalid:data-pressed:bg-background`,`data-disabled:border-border-strong! data-disabled:bg-background-subtle! data-disabled:cursor-not-allowed data-disabled:border-dashed data-disabled:opacity-disabled`),within:X(`flex items-center`,`has-focus:ring-[3px] has-focus:ring-ring-input has-focus:border-transparent has-focus:bg-background`,`has-data-popup-open:ring-3 has-data-popup-open:ring-ring-input has-data-popup-open:border-transparent has-data-popup-open:bg-background`,`has-data-pressed:ring-3 has-data-pressed:ring-ring-input has-data-pressed:border-transparent has-data-pressed:bg-background`,`data-invalid:bg-error-subtle data-invalid:border-error data-invalid:has-focus:border-transparent data-invalid:has-focus:ring-ring-error data-invalid:has-focus:bg-background`,`data-invalid:has-data-popup-open:border-transparent data-invalid:has-data-popup-open:ring-ring-error data-invalid:has-data-popup-open:bg-background`,`data-invalid:has-data-pressed:border-transparent data-invalid:has-data-pressed:ring-ring-error data-invalid:has-data-pressed:bg-background`,`has-data-invalid:bg-error-subtle has-data-invalid:border-error has-data-invalid:has-focus:border-transparent has-data-invalid:has-focus:ring-ring-error has-data-invalid:has-focus:bg-background`,`has-data-invalid:has-data-popup-open:border-transparent has-data-invalid:has-data-popup-open:ring-ring-error has-data-invalid:has-data-popup-open:bg-background`,`has-data-invalid:has-data-pressed:border-transparent has-data-invalid:has-data-pressed:ring-ring-error has-data-invalid:has-data-pressed:bg-background`,`has-[input:disabled]:border-border-strong! has-[input:disabled]:bg-background-subtle! has-[input:disabled]:cursor-not-allowed has-[input:disabled]:border-dashed has-[input:disabled]:opacity-disabled`)}},defaultVariants:{variant:`outline`,size:`md`,state:`self`}}),Gj=g.createContext(null);function Kj(){let e=g.useContext(Gj);if(!e)throw Error(`Select sub-components must be rendered inside <Select>`);return e}function qj({size:e=`md`,variant:t=`outline`,alignItemWithTrigger:n=!0,value:r,defaultValue:i,onValueChange:a,multiple:o=!1,children:s,...c}){let l=KS(),u=r!==void 0,[d,f]=g.useState(i??(o?[]:null)),p=u?r:d,m=o?Array.isArray(p)&&p.length>0:p!=null&&p!==``,h=g.useCallback((e,t)=>{u||f(e),a?.(e,t)},[u,a]),_=g.useCallback(e=>{let t=o?[]:null,n={reason:`none`,event:e?.nativeEvent??new Event(`clear`),trigger:void 0,cancel:()=>{},allowPropagation:()=>{},isCanceled:!1,isPropagationAllowed:!1};h(t,n)},[o,h]),v=g.useMemo(()=>({size:e,variant:t,alignItemWithTrigger:n,hasValue:m,clear:_,multiple:o,reducedMotion:l}),[e,t,n,m,_,o,l]);return(0,G.jsx)(Gj.Provider,{value:v,children:(0,G.jsx)($A,{value:p,onValueChange:h,multiple:o,...c,children:s})})}var Jj={sm:`size-4`,md:`size-4.5`,lg:`size-5`};function Yj({className:e,clearable:t,startSlot:n,endSlot:r,children:i,onKeyDown:a,...o}){let{size:s,variant:c,alignItemWithTrigger:l,hasValue:u,clear:d}=Kj(),f=Jj[s],p=o[`aria-invalid`],m=p===!0||p===`true`,h=t&&u,g=e=>{a?.(e),!e.defaultPrevented&&h&&(e.key===`Delete`||e.key===`Backspace`)&&(e.preventDefault(),d(e))};return(0,G.jsxs)(sj,{"data-slot":`select-trigger`,className:X(Wj({variant:c,size:s,state:`self`}),`data-placeholder:text-foreground-subtle flex items-center justify-between`,e),...o,onKeyDown:g,...m?{"data-invalid":``}:{},children:[n&&(0,G.jsx)(`span`,{"data-slot":`select-trigger-start`,className:`-ms-1 shrink-0`,children:n}),(0,G.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center truncate text-start`,children:i}),h?(0,G.jsx)(`span`,{"data-slot":`select-clear`,"aria-hidden":`true`,onPointerDown:e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),e.preventDefault(),d(e)},onClick:e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()},className:`text-foreground-subtle hover:text-foreground shrink-0 cursor-pointer transition-colors duration-200 motion-reduce:transition-none`,children:(0,G.jsx)(cM,{className:`size-[1em]`})}):null,r&&(0,G.jsx)(`span`,{"data-slot":`select-trigger-end`,className:`shrink-0`,children:r}),(0,G.jsx)(uj,{"data-slot":`select-icon`,className:`text-foreground -me-1 shrink-0`,render:l?(0,G.jsx)(oM,{className:f}):(0,G.jsx)(aM,{className:X(f,`motion-safe:transition-transform motion-safe:duration-200`,`data-popup-open:rotate-180`)})})]})}function Xj({className:e,...t}){return(0,G.jsx)(lj,{"data-slot":`select-value`,className:X(`min-w-0 flex-1 truncate text-start`,e),...t})}var Zj={sm:`rounded-md`,md:`rounded-lg`,lg:`rounded-xl`};function Qj({className:e,alignItemWithTrigger:t,children:n,...r}){let{size:i,alignItemWithTrigger:a}=Kj(),o=t??a,{positioner:s,portal:c,popup:l}=vE(r);return(0,G.jsx)(dj,{...c,children:(0,G.jsx)(_j,{sideOffset:6,...s,alignItemWithTrigger:o,className:X(`isolate z-50`,s.className),children:(0,G.jsxs)(Tj,{"data-slot":`select-content`,"data-align-trigger":o||void 0,className:X(`bg-background border-border-overlay flex flex-col border shadow-2xl outline-none`,Zj[i],`min-w-36`,o?`w-[calc(var(--anchor-width)+1rem)]`:`w-(--anchor-width)`,o?`origin-center`:`origin-(--transform-origin)`,`motion-safe:transition-[opacity,scale] motion-safe:duration-200 motion-safe:ease-[cubic-bezier(0.175,0.885,0.32,1.5)]`,`data-starting-style:motion-safe:scale-90 data-starting-style:motion-safe:opacity-0`,`data-ending-style:motion-safe:scale-95 data-ending-style:motion-safe:opacity-0 data-ending-style:motion-safe:duration-100 data-ending-style:motion-safe:ease-out`,e),...l,children:[(0,G.jsx)(eM,{}),(0,G.jsx)(Nj,{className:`flex max-h-(--available-height) flex-col gap-0.5 overflow-y-auto p-2`,children:n}),(0,G.jsx)(tM,{})]})})})}var $j=X(`bg-background text-foreground z-1 flex h-6 w-[calc(100%-var(--border-width)*2)] cursor-default items-center justify-center`);function eM(){let{size:e}=Kj();return(0,G.jsx)(Uj,{"data-slot":`select-scroll-up`,"aria-hidden":`true`,className:X($j,Zj[e],`top-px rounded-b-none`),children:(0,G.jsx)(aM,{className:X(Jj[e],`rotate-180`)})})}function tM(){let{size:e}=Kj();return(0,G.jsx)(Hj,{"data-slot":`select-scroll-down`,"aria-hidden":`true`,className:X($j,Zj[e],`bottom-px rounded-t-none`),children:(0,G.jsx)(aM,{className:Jj[e]})})}var nM={sm:`gap-1 rounded-xs py-1.5 px-2.5 text-xs has-data-[icon=end]:pe-1.5 has-data-[icon=start]:ps-1.5 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='stroke-'])]:stroke-[1.75]`,md:`gap-1.5 rounded-sm py-2 px-3 text-sm has-data-[icon=end]:pe-2 has-data-[icon=start]:ps-2 [&_svg:not([class*='size-'])]:size-4.5 [&_svg:not([class*='stroke-'])]:stroke-[1.65]`,lg:`gap-1.5 rounded-md py-2.5 px-3.5 text-base has-data-[icon=end]:pe-2.5 has-data-[icon=start]:ps-2.5 [&_svg:not([class*='size-'])]:size-5 [&_svg:not([class*='stroke-'])]:stroke-[1.65]`},rM={sm:`gap-1`,md:`gap-1.5`,lg:`gap-1.5`};function iM({className:e,children:t,...n}){let{size:r,reducedMotion:i}=Kj();return(0,G.jsxs)(Ij,{"data-slot":`select-item`,className:X(`text-foreground relative isolate flex w-full cursor-default items-center justify-between outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,`before:bg-background-muted before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:opacity-0`,`active:translate-y-px active:scale-[0.98]`,`data-highlighted:not-data-disabled:text-foreground-intense data-highlighted:not-data-disabled:before:opacity-100`,`motion-safe:transition motion-safe:duration-250 motion-safe:ease-[cubic-bezier(0.175,0.885,0.32,1.5)]`,`motion-safe:active:duration-100 motion-safe:active:ease-in-out`,`motion-safe:before:transition-opacity motion-safe:before:duration-200 motion-safe:before:ease-out`,`data-disabled:opacity-disabled data-disabled:pointer-events-none`,nM[r],e),...n,children:[(0,G.jsx)(zj,{className:X(`flex items-center text-start`,rM[r]),children:t}),(0,G.jsx)(Lj,{"data-slot":`select-item-indicator`,keepMounted:!i,className:`group/check text-foreground-intense shrink-0`,children:(0,G.jsx)(sM,{"data-icon":`end`,className:`me-0.5 size-[1.125em]`})})]})}function aM(e){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,G.jsx)(`path`,{d:`M11.594 5.594c.225-.225.588-.225.813 0s.225.588 0 .813l-4 4c-.225.225-.588.225-.812 0l-4-4c-.225-.225-.225-.588 0-.812s.588-.225.812 0L8 9.187l3.594-3.594z`})})}function oM(e){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,G.jsx)(`path`,{d:`M10.26 9.593c.225-.224.589-.224.814 0s.224.589 0 .813l-2.667 2.667c-.225.224-.589.224-.813 0l-2.666-2.667c-.225-.225-.225-.589 0-.813s.588-.224.813 0l2.26 2.26 2.261-2.26zM7.593 2.927c.225-.225.589-.225.813 0l2.667 2.666c.224.224.224.589 0 .813s-.589.225-.814 0L7.999 4.146 5.74 6.407c-.225.224-.588.224-.812 0s-.225-.589 0-.813l2.666-2.666z`})})}function sM({className:e,...t}){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:X(`stroke-2`,e),...t,children:(0,G.jsx)(`path`,{d:`M4.3 12.55 L9.25 17.5 L19.7 6.5`,pathLength:1,strokeDasharray:`1 2`,className:X(`opacity-0 [stroke-dashoffset:1.02]`,`group-data-selected/check:opacity-100 group-data-selected/check:[stroke-dashoffset:0]`,`motion-safe:transition-[opacity,stroke-dashoffset] motion-safe:ease-out`,`motion-safe:delay-[0ms,150ms] motion-safe:duration-[150ms,0ms]`,`motion-safe:group-data-selected/check:delay-[0ms] motion-safe:group-data-selected/check:duration-[0ms,300ms]`)})})}function cM(e){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`2 2 16 16`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,G.jsx)(`path`,{d:`M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z`})})}function lM(e){return e?e.lan.length>0?e.lan:e.public:[]}function uM(e){return!e||e.lan.length===0?[]:e.public}function dM(e){return e?.ipv6??[]}function fM(e,t){let n=Q(e===`lan`?`panel.address.lan`:e===`ipv6`?`panel.address.ipv6`:`panel.address.public`);return t?`${n} · ${t}`:n}function pM(e,t){return`http://${e.includes(`:`)?`[${e}]`:e}:${String(t??``)}`}function mM({book:e,port:t,value:n,busy:r=!1,onChange:i,fallbackUrls:a=[],align:o=`end`}){let s=o===`start`?`items-start`:`items-end`,c=o===`start`?`justify-start`:`justify-end`,l=o===`start`?`text-start`:`text-end`,u=String(t??``),d=lM(e),f=uM(e),p=dM(e),m=e&&e.lan.length>0?`lan`:`public`,h=d.some(e=>e.address===n)?n:d[0]?.address??``;return d.length===0?p.length===0&&a.length>0?(0,G.jsx)(`span`,{className:`flex flex-col gap-0.5 ${s}`,children:a.map(e=>(0,G.jsx)(`span`,{children:e},e))}):p.length===0?(0,G.jsx)(`span`,{className:`font-sans text-foreground-muted`,children:Q(`panel.address.empty`)}):(0,G.jsx)(`span`,{className:`flex w-full flex-col gap-1 ${s}`,children:p.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2 ${c}`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-foreground-muted`,children:pM(e.address,u)}),(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-foreground-subtle`,children:`${fM(`ipv6`,e.interface)}${Q(`panel.address.ipv6Hint`)}`})]},e.address))}):(0,G.jsxs)(`span`,{className:`flex w-full flex-col gap-1 ${s}`,children:[d.length>1?(0,G.jsx)(pA,{className:RE(`w-full gap-1`,s,r&&`pointer-events-none opacity-60`),value:h,onValueChange:e=>{typeof e==`string`&&e!==h&&i(e)},children:d.map(e=>(0,G.jsxs)(`label`,{className:`flex w-full cursor-pointer flex-wrap items-baseline gap-x-2 ${c}`,children:[(0,G.jsx)(Zk,{value:e.address,"aria-label":pM(e.address,u)}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:pM(e.address,u)}),(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-foreground-muted`,children:fM(m,e.interface)})]},e.address))}):(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2 ${c}`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:pM(d[0].address,u)}),(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-foreground-muted`,children:fM(m,d[0].interface)})]}),f.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2 ${c}`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-foreground-muted`,children:pM(e.address,u)}),(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-foreground-subtle`,children:`${fM(`public`,e.interface)}${Q(`panel.address.publicHint`)}`})]},e.address)),p.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2 ${c}`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-foreground-muted`,children:pM(e.address,u)}),(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-foreground-subtle`,children:Q(`panel.address.ipv6Pick`,{kind:fM(`ipv6`,e.interface)})})]},e.address)),d.length>1?(0,G.jsx)(`span`,{className:`font-sans text-xs text-foreground-muted ${l}`,children:Q(`panel.address.hint`)}):null]})}var hM=`data:image/png;base64,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`;function gM(e){return e.name===`GitHub`?(0,G.jsx)(CM,{}):e.name===`App Store`||e.name===`TestFlight`?(0,G.jsx)(SM,{}):(0,G.jsx)(wM,{})}function _M(e){return e===`android`?(0,G.jsx)(xM,{}):(0,G.jsx)(SM,{})}function vM({channel:e}){return(0,G.jsxs)(`a`,{className:`flex items-center gap-3 rounded-lg border border-border-muted px-3 py-2.5 transition-colors hover:bg-background-muted`,href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:[(0,G.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-background-muted text-foreground`,children:gM(e)}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{className:`text-sm text-foreground-intense`,children:e.name??(e.nameKey?Q(e.nameKey):``)}),(0,G.jsx)(`span`,{className:`truncate text-xs text-foreground-muted`,children:Q(e.hintKey)})]})]})}function yM(){return(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:pC.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-1.5 pb-0.5 text-xs text-foreground-muted`,children:[_M(e.platform),(0,G.jsx)(`span`,{children:Q(e.platform===`android`?`panel.links.android`:`panel.links.apple`)})]}),e.channels.map(e=>(0,G.jsx)(vM,{channel:e},e.url))]},e.platform))})}function bM({size:e=`md`,variant:t=`outline`,className:n}){let[r,i]=(0,g.useState)(!1),a=(0,g.useRef)(null);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Z,{variant:t,size:e,className:n,onClick:()=>i(!0),children:Q(`panel.download.open`)}),(0,G.jsx)(qf,{open:r,onOpenChange:i,children:(0,G.jsxs)(Jf,{className:`max-w-xl`,closeLabel:Q(`panel.common.close`),initialFocus:a,children:[(0,G.jsx)(Yf,{children:(0,G.jsxs)(Xf,{className:`flex flex-wrap items-center gap-2.5 pr-8`,children:[(0,G.jsx)(`img`,{src:hM,alt:``,className:`size-8 rounded-lg bg-white p-0.5`}),(0,G.jsx)(`span`,{className:`min-w-0 break-words`,children:Q(`panel.download.title`)})]})}),(0,G.jsx)(`div`,{ref:a,tabIndex:-1,className:`outline-none`,children:(0,G.jsx)(Qf,{children:(0,G.jsx)(yM,{})})})]})})]})}function xM(){return(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`size-3.5 stroke-0`,fill:`currentColor`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M17.523 15.3414c-.5511 0-.9993-.4486-.9993-.9997s.4483-.9993.9993-.9993c.5511 0 .9993.4483.9993.9993.0001.5511-.4482.9997-.9993.9997m-11.046 0c-.5511 0-.9993-.4486-.9993-.9997s.4482-.9993.9993-.9993c.551 0 .9993.4483.9993.9993 0 .5511-.4483.9997-.9993.9997m11.4045-6.02 1.9973-3.4592a.416.416 0 0 0-.1521-.5676.416.416 0 0 0-.5676.1521l-2.0223 3.503C15.5902 8.2439 13.8533 7.8508 12 7.8508s-3.5902.3931-5.1367 1.0989L4.841 5.4467a.4161.4161 0 0 0-.5677-.1521.4157.4157 0 0 0-.1521.5676l1.9973 3.4592C2.6889 11.1867.3432 14.6589 0 18.761h24c-.3435-4.1021-2.6892-7.5743-6.1185-9.4396`})})}function SM(){return(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`size-4 stroke-0`,fill:`currentColor`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701`})})}function CM(){return(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`size-[18px] stroke-0`,fill:`currentColor`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})})}function wM(){return(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`size-[18px]`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.85`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M12 4v10`}),(0,G.jsx)(`path`,{d:`m8 10.5 4 4 4-4`}),(0,G.jsx)(`path`,{d:`M4 18.5h16`})]})}function TM({on:e,what:t,label:n,className:r,disabled:i,onClick:a}){let o=n??Q(e?`panel.common.hide`:`panel.common.show`);return(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:r,"aria-label":`${o}${t}`,disabled:i,onClick:a,children:o})}function EM(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-6`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,G.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,G.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`}),(0,G.jsx)(`path`,{d:`M14 14h3v3M21 14v.01M14 21h.01M17 21h4v-4`})]})}function DM({status:e,pairing:t,addressBook:n,busy:r,error:i,restartError:a,onOpenConfig:o,onChangePolicy:s,onChangeTier:c,onChangeAutoReview:l,onOpenSelfCheck:u,onRetryPairing:d,onSavePreferred:f,onEditPort:p}){let m=r!==``,h=e.pairingPolicy===`code`,_=e.pairingTier??`full`,v=e.approvalAutoReview===!0,y=t?.relayUrl||e.relayUrl||`—`,b=OM(n,t),[x,S]=g.useState({relay:!1}),[C,w]=g.useState(!1),[T,E]=g.useState(!1),[D,O]=g.useState(!1),k=e=>S(t=>({...t,[e]:!t[e]}));return(0,G.jsxs)(uO,{frame:`solid`,children:[(0,G.jsx)(dO,{className:`flex-none px-4 py-3`,children:(0,G.jsxs)(fO,{className:`flex flex-wrap items-center justify-between gap-x-2 gap-y-1 text-base lg:text-lg`,children:[(0,G.jsx)(`span`,{children:Q(`panel.pairing.cardTitle`)}),(0,G.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2 xl:px-4 xl:before:border xl:before:border-border xl:before:bg-background`,disabled:m,onClick:o,children:Q(`panel.pairing.openConfig`)}),(0,G.jsx)(bM,{size:`sm`,variant:`ghost`,className:`px-2 xl:px-4 xl:before:border xl:before:border-border xl:before:bg-background`}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2`,onClick:()=>O(!0),children:Q(`panel.common.more`)})]})]})}),i?(0,G.jsxs)(ZD,{variant:`warning`,className:`mt-3`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.pairing.qrFailed`)}),(0,G.jsx)(tO,{children:i})]}):null,(0,G.jsxs)(`div`,{className:`mt-3 flex flex-col gap-4 sm:flex-row sm:items-stretch`,children:[(0,G.jsx)(`div`,{className:`relative mx-auto aspect-square w-full max-w-[200px] shrink-0 self-center sm:mx-0 sm:w-[150px] sm:max-w-none sm:self-start lg:w-auto lg:self-stretch`,children:t?.svg?(0,G.jsxs)(`button`,{type:`button`,className:`absolute inset-0 flex cursor-zoom-in flex-col items-center justify-center gap-2 rounded-md border border-border-muted bg-background-muted p-3 text-foreground-subtle transition-colors hover:bg-background-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>E(!0),"aria-label":`${Q(`panel.pairing.qrZoom`)}:${Q(`panel.pairing.qr`)}`,children:[(0,G.jsx)(EM,{}),(0,G.jsx)(`span`,{className:`text-xs`,children:Q(`panel.pairing.qrHidden`)}),(0,G.jsx)(`span`,{className:`text-xs`,children:Q(`panel.common.show`)})]}):(0,G.jsx)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 rounded-md border border-border-muted bg-background-muted p-3 text-foreground-subtle`,children:i?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-xs`,children:Q(`panel.pairing.qrFailed`)}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:m,onClick:d,children:Q(`panel.console.retryPairing`)})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(UD,{}),(0,G.jsx)(`span`,{className:`text-xs`,children:Q(`panel.pairing.noQr`)})]})})}),(0,G.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,G.jsx)(`div`,{className:`hscroll -mx-1 px-1`,children:(0,G.jsxs)(hk,{className:`min-w-max`,children:[(0,G.jsx)($,{label:Q(`panel.connection.relayUrl`),nowrap:!0,children:(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[x.relay?(0,G.jsx)(`span`,{className:`min-w-0 font-mono text-xs text-foreground-strong`,children:y}):(0,G.jsx)(`span`,{className:`text-xs text-foreground-subtle`,children:Q(`panel.pairing.hidden`)}),(0,G.jsx)(TM,{on:x.relay,what:Q(`panel.connection.relayUrl`),label:x.relay?Q(`panel.common.hide`):Q(`panel.common.show`),onClick:()=>k(`relay`)})]})}),(0,G.jsx)($,{label:Q(`panel.pairing.port`),mono:!0,nowrap:!0,children:(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[(0,G.jsxs)(`span`,{children:[t?.lanPort??e.lan.port,t?.lanPortAdjusted?(0,G.jsx)(`span`,{className:`ml-2 font-sans text-xs text-foreground-muted`,children:Q(`panel.pairing.portFallback`)}):null]}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,"aria-label":Q(`panel.pairing.portTitle`),disabled:m,onClick:p,children:Q(`panel.common.edit`)})]})}),(0,G.jsx)($,{label:Q(`panel.pairing.phoneAddress`),nowrap:!0,children:(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[b?null:(0,G.jsx)(`span`,{className:`text-xs text-foreground-subtle`,children:Q(`panel.pairing.noAddress`)}),(0,G.jsx)(TM,{on:!1,what:Q(`panel.pairing.phoneAddress`),label:Q(`panel.common.show`),onClick:()=>w(!0)})]})})]})})})]}),a?(0,G.jsxs)(ZD,{variant:`error`,className:`mt-3`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.pairing.sidecarRestartFailed`)}),(0,G.jsx)(tO,{children:a})]}):null,(0,G.jsx)(qf,{open:T,onOpenChange:E,children:(0,G.jsxs)(Jf,{className:`w-[min(680px,94vw)] max-h-[90vh] max-w-none`,closeLabel:Q(`panel.common.close`),children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.pairing.qr`)})}),(0,G.jsx)(Qf,{children:(0,G.jsx)(`div`,{className:`flex items-center justify-center overflow-auto rounded-md bg-white p-2 sm:p-4`,children:t?.svg?(0,G.jsx)(`div`,{className:`aspect-square h-[min(64vh,560px)] w-auto max-w-full [&_svg]:h-full [&_svg]:w-full`,dangerouslySetInnerHTML:{__html:t.svg}}):null})})]})}),(0,G.jsx)(qf,{open:C,onOpenChange:w,children:(0,G.jsxs)(Jf,{className:`max-w-xl`,closeLabel:Q(`panel.common.close`),children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.pairing.phoneAddress`)})}),(0,G.jsx)(Qf,{children:(0,G.jsx)(mM,{book:n,port:t?.lanPort??e.lan.port,value:n?.preferred??``,busy:m,onChange:f,fallbackUrls:t?.lanUrls??[]})}),(0,G.jsx)($f,{className:`flex justify-end`,children:(0,G.jsx)(Z,{variant:`outline`,onClick:()=>w(!1),children:Q(`panel.common.close`)})})]})}),(0,G.jsx)(qf,{open:D,onOpenChange:O,children:(0,G.jsxs)(Jf,{className:`max-w-md`,closeLabel:Q(`panel.common.close`),children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.common.more`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.pairing.policy`),children:(0,G.jsx)(VO,{size:`md`,checked:h,disabled:m,onCheckedChange:e=>s(e?`code`:`deny`),"aria-label":Q(`panel.devices.allowTitle`)})}),(0,G.jsx)($,{label:Q(`panel.pairing.tier`),hint:Q(`panel.pairing.tierHint`),children:(0,G.jsxs)(qj,{size:`sm`,value:_,disabled:m,itemToStringLabel:e=>AM(e),onValueChange:e=>{typeof e==`string`&&e!==_&&c(e)},children:[(0,G.jsx)(Yj,{className:`min-w-0 max-w-full`,"aria-label":Q(`panel.pairing.tier`),children:(0,G.jsx)(Xj,{})}),(0,G.jsx)(Qj,{children:kM.map(e=>(0,G.jsx)(iM,{value:e,children:AM(e)},e))})]})}),(0,G.jsx)($,{label:Q(`panel.pairing.autoReview`),hint:Q(`panel.pairing.autoReviewHint`),children:(0,G.jsx)(VO,{size:`sm`,checked:v,disabled:m,"aria-label":Q(`panel.pairing.autoReview`),onCheckedChange:e=>{e!==v&&l(e)}})})]}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Z,{variant:`outline`,size:`sm`,onClick:u,children:Q(`panel.pairing.checkNetwork`)})})]})]})})]})}function OM(e,t){return e&&e.lan.length+e.public.length>0?`book`:t?.lanUrls?.[0]??``}var kM=[`readonly`,`approve`,`full`];function AM(e){return Q(e===`readonly`?`panel.pairing.tierReadonly`:e===`approve`?`panel.pairing.tierApprove`:`panel.pairing.tierFull`)}var jM={ok:4e3,soft:6e3,error:9e3};function MM(){let e=(0,g.useRef)(pd());return e.current=pd(),(0,g.useCallback)((t,n)=>{e.current.add({title:n,type:t,timeout:jM[t],priority:t===`error`?`high`:`low`})},[])}function NM(e){return e===`none`?Q(`panel.devices.tierNone`):AM(e)}function PM(e){return e===`none`?`readonly`:e}function FM(e,t){if(!e)return``;let n=Math.max(0,t-e);if(n<6e4)return Q(`panel.devices.justNow`);let r=Math.floor(n/6e4);if(r<60)return Q(`panel.devices.minutesAgo`,{count:r});let i=Math.floor(r/60);return i<24?Q(`panel.devices.hoursAgo`,{count:i}):Q(`panel.devices.daysAgo`,{count:Math.floor(i/24)})}function IM(e,t){return e?LM(e,t)?Q(`panel.devices.online`):FM(e,t):Q(`panel.devices.noRecord`)}function LM(e,t){return e>0&&t-e<=3e5}function RM(e){return{ios:`iOS`,android:`Android`,linux:`Linux`,darwin:`macOS`,win32:`Windows`}[e]??(e||Q(`panel.devices.unknownPlatform`))}function zM(e){return Q(e===`relay`?`panel.devices.channelRelay`:e===`lan`?`panel.devices.channelLan`:`panel.devices.channelUnknown`)}function BM(e){let t=e?.model||e?.name||Q(`panel.devices.unknown`);return e?.suffix?`${t} · ${e.suffix}`:t}function VM(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M12 3l7 3v5c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6l7-3Z`}),(0,G.jsx)(`path`,{d:`m9 12 2 2 4-4`})]})}function HM(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M9 15l6-6`}),(0,G.jsx)(`path`,{d:`M7 17l-1 1a3 3 0 0 1-4-4l2-2a3 3 0 0 1 4 0`}),(0,G.jsx)(`path`,{d:`M17 7l1-1a3 3 0 0 1 4 4l-2 2a3 3 0 0 1-4 0`})]})}function UM({onRevokeAll:e,busy:t,fill:n=!1}){let r=MM(),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(`full`),[m,h]=(0,g.useState)(!1),_=(0,g.useRef)(!1),v=(0,g.useRef)(null),[y,b]=(0,g.useState)(!1),[x,S]=(0,g.useState)(null),[C,w]=(0,g.useState)(!1),T=(0,g.useRef)(0),E=(0,g.useCallback)(async()=>{let e=++T.current;w(!1);try{let t=await bA(`/api/relay/devices?history=1`);e===T.current&&S(t)}catch{e===T.current&&w(!0)}},[]),D=(0,g.useCallback)(async()=>{try{let e=await bA(`/api/relay/devices`),t=e.revokedCount??0,n=v.current!==null&&v.current!==t;v.current=t,a(e),n&&_.current&&E()}catch{}},[E]);(0,g.useEffect)(()=>{let e=()=>{xD()&&D()};e();let t=window.setInterval(e,3e3);return document.addEventListener(`visibilitychange`,e),()=>{window.clearInterval(t),document.removeEventListener(`visibilitychange`,e)}},[D]);let O=i?.devices??[],k=i?.serverNow??0,A=i?.revokedCount??0;(0,g.useEffect)(()=>{_.current=y},[y]),(0,g.useEffect)(()=>{y&&E()},[y,E]);function j(e){let t=FM(e.revokedAt||e.expiresAt,k)||`—`;return Q(e.kind===`revoked`?`panel.devices.historyRevoked`:`panel.devices.historyExpired`,{time:t})}let M=(x?.devices??[]).filter(e=>e.kind===`revoked`||e.kind===`expired`),N=C||(x?.devices.length??0)>0&&M.length===0;async function P(e){l(!0);try{let t=await xA(`/api/relay/devices/revoke`,{deviceId:e.deviceId});s(null),await D(),y&&E(),r(`soft`,Q(t.closed>0?`panel.devices.unbindDoneClosed`:`panel.devices.unbindDone`,{name:BM(e),count:t.revoked,closed:t.closed}))}catch(e){r(`error`,Q(`panel.devices.unbindFailed`,{message:wA(e)}))}finally{l(!1)}}async function F(e,t){h(!0);try{await CA(e.deviceId,t),d(null),await D(),r(`soft`,Q(`panel.devices.permissionsDone`,{name:BM(e),tier:AM(t)}))}catch(e){r(`error`,Q(`panel.devices.permissionsFailed`,{message:wA(e)}))}finally{h(!1)}}return O.length===0&&A===0?null:(0,G.jsxs)(uO,{frame:`solid`,className:n?`flex h-full min-h-0 flex-col`:void 0,children:[(0,G.jsx)(dO,{className:n?`flex-none px-4 py-3`:`px-4 py-3`,children:(0,G.jsxs)(fO,{className:`flex flex-wrap items-center justify-between gap-x-2 gap-y-1 text-base lg:text-lg`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[Q(`panel.devices.title`),O.length>0?(0,G.jsx)(iO,{variant:`secondary`,size:`sm`,children:O.length}):null]}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`shrink-0 px-2 xl:px-4 xl:before:border xl:before:border-border xl:before:bg-background`,disabled:t!==``,onClick:e,children:Q(`panel.pairing.revokeAll`)})]})}),(0,G.jsxs)(`div`,{className:n?`hvscroll mt-1 min-h-0 flex-1`:`hscroll mt-1`,children:[(0,G.jsx)(`div`,{className:`min-w-max`,children:O.map(e=>{let t=LM(e.lastSeenAt,k);return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border-muted py-2 whitespace-nowrap last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-foreground-strong`,children:BM(e)}),(0,G.jsx)(iO,{variant:`secondary`,size:`xs`,children:NM(mA(e.permissions))}),(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 whitespace-nowrap text-xs text-foreground-muted`,children:[(0,G.jsx)(`span`,{children:RM(e.platform)}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsx)(`span`,{children:zM(e.lastChannel)}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t?(0,G.jsx)(mk,{tone:`ok`}):null,(0,G.jsx)(`span`,{children:IM(e.lastSeenAt,k)})]})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,G.jsx)(Z,{variant:`ghost`,size:`icon-md`,"aria-label":Q(`panel.devices.permissions`),title:Q(`panel.devices.permissions`),onClick:()=>{p(PM(mA(e.permissions))),d(e)},children:(0,G.jsx)(VM,{})}),(0,G.jsx)(Z,{variant:`ghost`,size:`icon-md`,"aria-label":Q(`panel.devices.unbind`),title:Q(`panel.devices.unbind`),onClick:()=>s(e),children:(0,G.jsx)(HM,{})})]})]},e.deviceId)})}),(0,G.jsxs)(`div`,{className:`mt-1 border-t border-border-muted pt-2`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":y,className:`flex w-full cursor-pointer items-center justify-between gap-2 text-xs text-foreground-muted focus-visible:outline-none`,onClick:()=>b(e=>!e),children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[Q(`panel.devices.historyTitle`),(0,G.jsx)(iO,{variant:`secondary`,size:`xs`,children:Q(`panel.devices.historyCount`,{count:A})})]}),(0,G.jsx)(`svg`,{viewBox:`0 0 12 12`,className:`size-3 shrink-0 transition-transform ${y?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`m4.5 2.5 3.5 3.5-3.5 3.5`})})]}),y?(0,G.jsxs)(`div`,{className:`mt-2`,children:[M.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-foreground`,children:BM(e)}),(0,G.jsxs)(`span`,{className:`text-xs text-foreground-muted`,children:[RM(e.platform),e.osVersion?` ${e.osVersion}`:``,e.appVersion?Q(`panel.devices.appVersion`,{version:e.appVersion}):``]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-foreground-muted`,children:[(0,G.jsx)(`span`,{children:Q(`panel.devices.historyBoundAt`,{time:FM(e.boundAt,k)||`—`})}),(0,G.jsx)(`span`,{children:Q(`panel.devices.historyLastSeen`,{time:e.lastSeenAt?FM(e.lastSeenAt,k):Q(`panel.devices.noRecord`)})}),(0,G.jsx)(`span`,{children:j(e)})]})]},e.deviceId)),N?(0,G.jsx)(`p`,{className:`py-2 text-xs text-foreground-muted`,children:Q(`panel.devices.historyFailed`)}):null,(0,G.jsx)(`p`,{className:`py-2 text-xs text-foreground-muted`,children:Q(`panel.devices.historyRetention`,{days:30})})]}):null]})]}),(0,G.jsx)(Ek,{open:o!==null,onOpenChange:e=>{!e&&!c&&s(null)},children:(0,G.jsxs)(Dk,{children:[(0,G.jsx)(Ok,{children:(0,G.jsx)(kk,{children:Q(`panel.devices.unbindTitle`)})}),(0,G.jsxs)(jk,{className:`flex flex-col gap-2 text-sm`,children:[(0,G.jsx)(Ak,{children:Q(`panel.devices.unbindConfirm`,{name:BM(o)})}),(0,G.jsx)(`p`,{className:`text-foreground-muted`,children:Q(o?.legacy?`panel.devices.effectLegacy`:`panel.devices.effectIdentity`)})]}),(0,G.jsxs)(Mk,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,disabled:c,onClick:()=>s(null),children:Q(`panel.devices.cancel`)}),(0,G.jsx)(Z,{variant:`destructive`,disabled:c,onClick:()=>{o&&P(o)},children:c?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(UD,{}),Q(`panel.devices.unbinding`)]}):Q(`panel.devices.unbind`)})]})]})}),(0,G.jsx)(Ek,{open:u!==null,onOpenChange:e=>{!e&&!m&&d(null)},children:(0,G.jsxs)(Dk,{children:[(0,G.jsx)(Ok,{children:(0,G.jsx)(kk,{children:Q(`panel.devices.permissionsTitle`)})}),(0,G.jsxs)(jk,{className:`flex flex-col gap-3 text-sm`,children:[(0,G.jsx)(Ak,{children:Q(`panel.devices.permissionsHint`)}),(0,G.jsx)(pA,{className:`flex flex-col gap-2`,value:f,onValueChange:e=>{typeof e==`string`&&p(e)},children:kM.map(e=>(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2`,children:[(0,G.jsx)(Zk,{value:e}),(0,G.jsx)(`span`,{children:AM(e)})]},e))})]}),(0,G.jsxs)(Mk,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,disabled:m,onClick:()=>d(null),children:Q(`panel.devices.cancel`)}),(0,G.jsx)(Z,{variant:`secondary`,disabled:m,onClick:()=>{u&&F(u,f)},children:m?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(UD,{}),Q(`panel.devices.permissionsApply`)]}):Q(`panel.devices.permissionsApply`)})]})]})})]})}var WM=function(e){let t=qd(),[n,r]=g.useState(t),[i,a]=g.useState(),[o,s]=g.useState([]),c=n===void 0?t:n,l=y(()=>new Map),{messageIds:u}=AO(),d=J((e,t)=>{let n=l.current;t===void 0?n.delete(e):n.set(e,t),r(e=>{if(n.size===0)return e;let t;for(let r of n.values()){if(r===e)return e;t===void 0&&(t=r)}return t})}),f=J(()=>{l.current.size===0&&r(t)}),p=g.useCallback(e=>{let t=e[`aria-describedby`]?e[`aria-describedby`].split(` `):[];return t.push(...u,...o),{...e,"aria-describedby":Array.from(new Set(t)).join(` `)||void 0}},[u,o]),m=g.useMemo(()=>({controlId:c,registerControlId:d,resetControlId:f,labelId:i,setLabelId:a,messageIds:o,setMessageIds:s,getDescriptionProps:p}),[c,d,f,i,a,o,s,p]);return(0,G.jsx)(kO.Provider,{value:m,children:e.children})};function GM(e){let{change:t,commit:n,invalid:r,markedDirtyRef:i,name:a,setRegisteredFieldName:o,registeredFieldIdRef:s,setValidityData:c,validityData:l}=e,{formRef:u}=OO(),d=g.useRef(null),f=g.useRef(null),p=g.useRef(!1),m=J(()=>{let e=f.current;if(e)return e.getValue?e.getValue():e.value});function h(e){return e.value===void 0?m():e.value}let _=J(()=>{let e=f.current;if(i.current=!0,!e){n(l.value);return}n(h(e))});function v(){let e=f.current;e&&e.id&&u.current.fields.set(e.id,{getValue:m,name:a??e.name,controlRef:e.controlRef,validityData:nA(l,r),validate:_})}function y(e=f.current?.id){e&&u.current.fields.delete(e)}function x(e){if(p.current)return;p.current=!0;let t=h(e);c(e=>e.initialValue===t?e:{...e,initialValue:t})}return b(()=>{let e=f.current;e&&e.id&&(o(a?void 0:e.name),u.current.fields.set(e.id,{getValue:m,name:a??e.name,controlRef:e.controlRef,validityData:nA(l,r),validate:_}))},[u,m,r,a,o,_,l]),b(()=>{let e=u.current.fields;return()=>{let t=f.current?.id;t&&e.delete(t)}},[u]),[_,J((e,n)=>{if(!n){d.current===e&&(d.current=null,t(void 0,!0),y(),f.current=null,o(void 0),s.current=void 0);return}let r=f.current?.id,i=d.current;i&&i!==e&&t(void 0,!0),d.current=e,f.current=n,a||o(n.name),s.current=n.id,r&&r!==n.id&&y(r),x(n),v()})]}var KM=g.forwardRef(function(e,t){let{errors:n,validationMode:r,submitCountRef:i}=OO(),{render:a,className:o,validate:s,validationDebounceTime:c=0,validationMode:l=r,name:u,disabled:d=!1,invalid:f,dirty:p,touched:m,actionsRef:h,style:_,...v}=e,y=uA(!0)?.disabled,x=J(s||(()=>null)),S=y||d,[C,w]=g.useState(!1),[T,E]=g.useState(!1),[D,O]=g.useState(!1),[k,A]=g.useState(!1),j=p??T,M=m??C,N=g.useRef(j),P=g.useRef(void 0),[F,I]=g.useState(),L=u??F;b(()=>{p!==void 0&&(N.current=p)},[p]);let R=J(e=>{p===void 0&&(e&&(N.current=!0),E(e))}),z=J(e=>{m===void 0&&w(e)}),B=J(()=>l===`onChange`||l===`onSubmit`&&i.current>0),V=L&&Object.hasOwn(n,L)?n[L]:null,H=!!(Array.isArray(V)?V.length:V),U=f===!0||H,[W,ee]=g.useState({state:_O,error:``,errors:[],value:null,initialValue:null}),K=!U&&(S?null:W.state.valid),te=g.useMemo(()=>({disabled:S,touched:M,dirty:j,valid:K,filled:D,focused:k}),[S,M,j,K,D,k]),q=cA({setValidityData:ee,validate:x,validityData:W,validationDebounceTime:c,invalid:U,markedDirtyRef:N,state:te,shouldValidateOnChange:B,validationMode:l,registeredFieldIdRef:P}),[ne,re]=GM({change:q.change,commit:q.commit,invalid:U,markedDirtyRef:N,name:u,setRegisteredFieldName:I,registeredFieldIdRef:P,setValidityData:ee,validityData:W});g.useImperativeHandle(h,()=>({validate:ne}),[ne]);let ie=g.useMemo(()=>({invalid:U,name:L,validityData:W,setValidityData:ee,disabled:S,setTouched:z,setDirty:R,setFilled:O,setFocused:A,validationMode:l,shouldValidateOnChange:B,state:te,registerFieldControl:re,validation:q}),[U,L,W,S,z,R,O,A,l,B,te,re,q]),ae=Vr(`div`,e,{ref:t,state:te,props:v,stateAttributesMapping:yO});return(0,G.jsx)(wO.Provider,{value:ie,children:ae})}),qM=g.forwardRef(function(e,t){return(0,G.jsx)(WM,{children:(0,G.jsx)(KM,{...e,ref:t})})}),JM=g.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,nativeLabel:o=!0,...s}=e,c=TO(!1),l=Rk(),{labelId:u}=AO(),d={...c.state,disabled:c.disabled||l.disabled},f=g.useRef(null),p=tj({id:u??a,native:o});return Vr(`label`,e,{ref:[t,f],state:d,props:[p,s],stateAttributesMapping:yO})}),YM=g.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:_,setDirty:v,validityData:y,setFocused:x,setFilled:S,validationMode:C,validation:w}=TO(),{clearErrors:T,elementRef:E,submitCountRef:D}=OO(),O=h||s,k=m??a,A={...p,disabled:O},{labelId:j}=AO(),M=PO({id:i}),[N]=QC({controlled:o,default:l,name:`FieldControl`,state:`value`}),P=o!==void 0,F=P?N:void 0,I=F==null?void 0:String(F),L=J(()=>w.inputRef.current?.value);EO(w.inputRef,M,I,L,!O,a),b(()=>{let e=I??w.inputRef.current?.value;e!==void 0&&S(e!==``)},[I,w.inputRef,S]),zf(I,()=>{I!==void 0&&(T(k),v(I!==(y.initialValue??``)),w.change(I))});let R=g.useRef(null),z=Ge();return b(()=>{u&&R.current===lt(Le(R.current))&&x(!0)},[u,x]),Vr(`input`,e,{ref:[t,R],state:A,props:[{id:M,disabled:O,name:k,ref:w.inputRef,"aria-labelledby":j,autoFocus:u,...P?{value:F}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=ja(ma,e.nativeEvent);c?.(t,n),!P&&(v(t!==(y.initialValue??``)),S(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(T(k),w.change(t)))},onFocus(){x(!0)},onBlur(e){if(_(!0),x(!1),C===`onBlur`){let t=e.currentTarget.value;w.commit(t),P&&queueMicrotask(()=>{let e=w.inputRef.current?.value;e!==void 0&&e!==t&&e!==(y.initialValue??``)&&w.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){_(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===E.current&&!e.defaultPrevented){let t=e.currentTarget,n=D.current;z.start(0,()=>{D.current===n&&w.commit(t.value)})}else w.commit(t)}}},f,e=>w.getValidationProps(O,e)],stateAttributesMapping:yO})});function XM({className:e,...t}){return(0,G.jsx)(qM,{"data-slot":`field`,className:X(e),...t})}function ZM({className:e,...t}){return(0,G.jsx)(JM,{"data-slot":`field-label`,className:X(`text-foreground-intense mb-1.5 flex w-fit items-center text-sm font-medium select-none`,`data-disabled:opacity-disabled`,e),...t})}var QM={sm:`py-2`,md:`py-2.5`,lg:`py-3`},$M={sm:`min-h-16`,md:`min-h-20`,lg:`min-h-24`},eN={sm:`0.5rem`,md:`0.625rem`,lg:`0.75rem`};function tN(e,t){(Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,`value`)?.set)?.call(e,t),e.dispatchEvent(new Event(`input`,{bubbles:!0}))}function nN({className:e,variant:t=`outline`,inputSize:n=`md`,clearable:r,startSlot:i,endSlot:a,onClear:o,ref:s,rows:c=3,...l}){let u=g.useRef(null),d=Hu(s,u),f=!!(r||i||a),p=l[`aria-invalid`],m=p===!0||p===`true`,h=()=>{u.current&&l.value===void 0&&tN(u.current,``),u.current?.focus(),o?.()};return f?(0,G.jsxs)(`div`,{"data-slot":`textarea-wrapper`,"data-invalid":m?``:void 0,style:{"--textarea-h":`calc(${c} * 1lh + 2 * ${eN[n]} + 2px)`},className:X(Wj({variant:t,size:n,state:`within`}),`h-(--textarea-h) resize-y items-start overflow-hidden`,$M[n],QM[n],`has-[textarea:disabled]:border-border-strong! has-[textarea:disabled]:bg-background-subtle! has-[textarea:disabled]:opacity-disabled has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:border-dashed`,e),children:[i&&(0,G.jsx)(`div`,{"data-slot":`textarea-start`,className:`-ms-1 inline-flex h-lh shrink-0 items-center`,children:i}),(0,G.jsx)(YM,{"data-slot":`textarea`,ref:d,render:(0,G.jsx)(`textarea`,{rows:c}),placeholder:l.placeholder??` `,className:`peer text-foreground placeholder:text-foreground-subtle min-w-0 flex-1 resize-none self-stretch bg-transparent outline-none disabled:cursor-not-allowed`,...l}),r&&(0,G.jsx)(`button`,{"data-slot":`textarea-clear`,type:`button`,onClick:h,className:`text-foreground-subtle hover:text-foreground pointer-events-none inline-flex h-lh shrink-0 cursor-pointer items-center opacity-0 transition-[opacity,color] duration-200 peer-not-placeholder-shown:pointer-events-auto peer-not-placeholder-shown:opacity-100 motion-reduce:transition-none`,tabIndex:-1,"aria-label":`Clear input`,children:(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`2 2 16 16`,fill:`currentColor`,className:`size-[1em]`,children:(0,G.jsx)(`path`,{d:`M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z`})})}),a&&(0,G.jsx)(`div`,{"data-slot":`textarea-end`,className:`-me-1 inline-flex h-lh shrink-0 items-center`,children:a})]}):(0,G.jsx)(YM,{"data-slot":`textarea`,ref:d,render:(0,G.jsx)(`textarea`,{rows:c}),className:X(Wj({variant:t,size:n,state:`self`}),`placeholder:text-foreground-subtle h-auto resize-y`,QM[n],$M[n],e),...l,...m?{"data-invalid":``}:{}})}function rN(e){let t=typeof e==`string`?e:e instanceof vA?e.code:``,n={"credentials-unavailable":`errorAuth`,REMOTE_AUTH:`errorAuth`,REMOTE_REVOKED:`errorAuth`,REMOTE_EXPIRED:`errorExpired`,REMOTE_TIMEOUT:`errorTimeout`,REMOTE_CONNECT:`errorConnect`,REMOTE_INVITATION:`errorInvitation`,REMOTE_OPEN_URL:`invalidOpenUrl`,REMOTE_POPUP:`popupBlocked`,REMOTE_EXTERNAL_OPEN:`externalOpenFailed`,SHELL_UNAVAILABLE:`shellUnavailable`};return Q(n[t]?`panel.remote.${n[t]}`:`panel.remote.failed`)}var iN=`/api/relay/remote-computers`,aN={list:()=>bA(iN),invite:()=>xA(`${iN}/invite`,{}),add:e=>xA(`${iN}/add`,{invite:e}),open:e=>xA(`${iN}/open`,{id:e}),openShell:e=>xA(`${iN}/open-shell`,{id:e}),remove:e=>xA(`${iN}/remove`,{id:e}),mode:(e,t)=>xA(`${iN}/mode`,{id:e,mode:t}),revoke:e=>xA(`${iN}/revoke`,{deviceId:e})};function oN(e){return[`auto`,...new Set(e.map(e=>e.channel).filter(e=>e&&e!==`auto`))]}function sN(e){let t;try{t=new URL(e)}catch{throw new vA(Q(`panel.remote.invalidOpenUrl`),`REMOTE_OPEN_URL`,0)}if(t.protocol!==`http:`||t.hostname!==`127.0.0.1`||!t.port||t.username||t.password)throw new vA(Q(`panel.remote.invalidOpenUrl`),`REMOTE_OPEN_URL`,0);return t.href}function cN(e){return e instanceof vA?e.code===`SHELL_UNAVAILABLE`||e.status===404||e.status===405||e.status===0:e instanceof TypeError}async function lN(e){try{let t=await aN.openShell(e);return sN(t.url),t}catch(e){if(!cN(e))throw e}return uN(e)}async function uN(e){let t=window.location.protocol===`http:`||window.location.protocol===`https:`,n=t?window.open(`about:blank`,`_blank`):null;if(t&&!n)throw new vA(Q(`panel.remote.popupBlocked`),`REMOTE_POPUP`,0);try{n&&(n.opener=null);let t=await aN.open(e),r=sN(t.url);if(n)n.location.replace(r);else try{let e=window.top;if(!e||e.location.origin!==window.location.origin)throw Error(`origin`);e.location.href=r}catch{throw new vA(Q(`panel.remote.externalOpenFailed`),`REMOTE_EXTERNAL_OPEN`,0)}return t}catch(e){throw n?.close(),e}}function dN(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`13`,rx:`2`}),(0,G.jsx)(`path`,{d:`M8 21h8M12 17v4`})]})}function fN(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M4 7h16`}),(0,G.jsx)(`path`,{d:`M9 7V4.5A1.5 1.5 0 0 1 10.5 3h3A1.5 1.5 0 0 1 15 4.5V7`}),(0,G.jsx)(`path`,{d:`M6 7l1 12.5A2 2 0 0 0 9 21h6a2 2 0 0 0 2-1.5L18 7`}),(0,G.jsx)(`path`,{d:`M10 11v6M14 11v6`})]})}function pN(e){let t={auto:`auto`,lan:`lan`,direct:`direct`,ipv6:`ipv6`,relay:`relay`,tunnel:`tailcat`,tailcat:`tailcat`,p2p:`p2p`};return e?t[e]?Q(`panel.remote.channel.${t[e]}`):e:Q(`panel.common.none`)}function mN(){let e=MM(),[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)([]),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(null),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(null),[S,C]=(0,g.useState)(`auto`),[w,T]=(0,g.useState)(0),E=(0,g.useRef)(0),D=(0,g.useRef)(!1),O=(0,g.useRef)(!1),k=(0,g.useCallback)(async()=>{if(!D.current){D.current=!0;try{let e=await aN.list();if(!O.current)return;E.current=e.serverNow-Date.now(),T(e.serverNow),n(e),o(!1),c(``)}catch(e){if(!O.current)return;let t=e instanceof vA&&e.status===403;o(t),c(t?``:rN(e)),t&&n(null)}finally{D.current=!1,O.current&&i(!0)}}},[]);(0,g.useEffect)(()=>{O.current=!0;let e=()=>{xD()&&(T(Date.now()+E.current),k())};e();let t=window.setInterval(e,3e3);return document.addEventListener(`visibilitychange`,e),()=>{O.current=!1,window.clearInterval(t),document.removeEventListener(`visibilitychange`,e)}},[k]);let A=e=>l.includes(e),j=e=>l.some(t=>t.endsWith(`:${e}`));async function M(t,r,i){if(!l.includes(t)){u(e=>[...e,t]);try{await r(),i&&e(`ok`,Q(i)),await k()}catch(t){t instanceof vA&&t.status===403&&(o(!0),n(null),f(null),x(null),m(null)),e(`error`,t instanceof vA&&t.status===403?Q(`panel.remote.localOnly`):rN(t))}finally{u(e=>e.filter(e=>e!==t))}}}function N(){m(null),y(!1),f(`invite`),M(`invite`,async()=>{m(await aN.invite())})}async function P(){if(!(!p||p.expiresAt<=w))try{await navigator.clipboard.writeText(p.invite),y(!1),e(`ok`,Q(`panel.remote.copied`))}catch{y(!0)}}function F(e){M(`open:${e.id}`,()=>lN(e.id))}function I(e){window.confirm(Q(`panel.remote.removeConfirm`,{name:e.name||e.instanceId}))&&M(`remove:${e.id}`,()=>aN.remove(e.id),`panel.remote.removed`)}let L=t?.devices??[],R=t?.authorizedComputers??[],z=r&&!a&&t!==null,B=p!==null&&p.expiresAt<=w,V=d===`invite`?A(`invite`):d===`add`&&A(`add`),H=b!==null&&A(`mode:${b.id}`);return(0,G.jsxs)(uO,{frame:`solid`,className:`flex h-full min-h-0 flex-col`,children:[(0,G.jsx)(dO,{className:`flex-none px-4 py-3`,children:(0,G.jsxs)(fO,{className:`flex flex-wrap items-center justify-between gap-x-2 gap-y-1 text-base lg:text-lg`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{children:Q(`panel.remote.title`)}),L.length>0?(0,G.jsx)(iO,{variant:`secondary`,size:`sm`,children:L.length}):null]}),z?(0,G.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2 text-xs xl:px-4 xl:text-sm xl:before:border xl:before:border-border xl:before:bg-background`,disabled:A(`invite`),onClick:N,children:Q(`panel.remote.createInvite`)}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2 text-xs xl:px-4 xl:text-sm xl:before:border xl:before:border-border xl:before:bg-background`,disabled:A(`add`),onClick:()=>{_(``),f(`add`)},children:Q(`panel.remote.add`)})]}):null]})}),r?null:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-sm text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.shell.readingStatus`)]}),a?(0,G.jsx)(`p`,{className:`mt-2 text-sm text-foreground-muted`,children:Q(`panel.remote.localOnly`)}):null,s?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-error`,children:s}):null,z?(0,G.jsxs)(G.Fragment,{children:[L.length===0?(0,G.jsx)(`p`,{className:`mt-3 text-xs text-foreground-muted`,children:Q(`panel.remote.empty`)}):null,(0,G.jsx)(`div`,{className:`mt-1 flex min-h-0 flex-1 flex-col`,children:L.map(e=>{let t=e.expiresAt??0,n=e.state===`expired`||t>0&&t<=w,r=e.state===`revoked`?`revoked`:n?`expired`:e.state,i=e.attached&&e.state!==`revoked`,a=j(e.id);return(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col justify-between gap-2 border-b border-border-muted py-2 last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-sm text-foreground-strong`,children:e.name||e.instanceId}),(0,G.jsx)(iO,{variant:`secondary`,size:`xs`,children:Q(`panel.remote.state.${r}`)})]}),(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2 text-xs xl:px-2 xl:text-sm`,disabled:a,onClick:()=>{C(e.mode),x(e)},children:Q(`panel.remote.route`)}),i?(0,G.jsxs)(`span`,{className:`whitespace-nowrap px-1 text-xs text-foreground-muted`,children:[pN(e.mode),` · `,pN(e.channel),e.latencyMs!==null&&Number.isFinite(e.latencyMs)?` · ${Math.round(e.latencyMs)} ms`:``]}):(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2`,"aria-label":Q(`panel.remote.open`),disabled:a||e.state===`revoked`,onClick:()=>F(e),children:(0,G.jsx)(dN,{})}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2`,"aria-label":Q(`panel.remote.remove`),disabled:a,onClick:()=>I(e),children:(0,G.jsx)(fN,{})}),a?(0,G.jsx)(UD,{}):null]})]}),n&&e.state!==`revoked`?(0,G.jsx)(`p`,{className:`text-xs text-foreground-muted`,children:Q(`panel.remote.expiredHint`)}):null,e.lastError||e.lastErrorCode?(0,G.jsx)(`p`,{className:`text-xs break-all text-error`,children:rN(e.lastErrorCode)}):null]},e.id)})}),R.length>0?(0,G.jsxs)(`div`,{className:`mt-1 border-t border-border-muted pt-2`,children:[(0,G.jsx)(`p`,{className:`text-xs text-foreground-muted`,children:Q(`panel.remote.authorizedTitle`)}),R.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border-muted py-3 last:border-b-0`,children:[(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(`p`,{className:`truncate text-sm text-foreground-strong`,children:e.name||Q(`panel.remote.unknownComputer`)})}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2`,"aria-label":Q(`panel.remote.revoke`),disabled:A(`revoke:${e.deviceId}`),onClick:()=>{window.confirm(Q(`panel.remote.revokeConfirm`,{name:e.name||Q(`panel.remote.unknownComputer`)}))&&M(`revoke:${e.deviceId}`,()=>aN.revoke(e.deviceId),`panel.remote.revoked`)},children:(0,G.jsx)(fN,{})})]},e.deviceId))]}):null]}):null,(0,G.jsx)(qf,{open:d!==null,onOpenChange:e=>{!e&&!V&&(f(null),m(null))},children:(0,G.jsxs)(Jf,{className:`max-w-md`,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(d===`invite`?`panel.remote.createInvite`:`panel.remote.add`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-5 text-foreground-muted`,children:Q(d===`invite`?`panel.remote.inviteHint`:`panel.remote.addHint`)}),d===`invite`?p?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(XM,{children:[(0,G.jsx)(ZM,{htmlFor:`remote-computer-invite`,children:Q(`panel.remote.inviteLabel`)}),(0,G.jsx)(nN,{id:`remote-computer-invite`,rows:4,readOnly:!0,value:p.invite,onFocus:e=>e.target.select()})]}),(0,G.jsx)(`p`,{className:`text-xs text-foreground-muted`,children:Q(B?`panel.remote.inviteExpired`:`panel.remote.inviteRemaining`,{minutes:Math.max(0,Math.ceil((p.expiresAt-w)/6e4))})}),v?(0,G.jsx)(`p`,{role:`status`,className:`text-xs text-foreground-muted`,children:Q(`panel.remote.manualCopy`)}):null]}):V?(0,G.jsx)(UD,{}):null:(0,G.jsxs)(XM,{children:[(0,G.jsx)(ZM,{htmlFor:`remote-computer-add`,children:Q(`panel.remote.inviteLabel`)}),(0,G.jsx)(nN,{id:`remote-computer-add`,rows:4,value:h,onChange:e=>_(e.target.value),autoComplete:`off`,spellCheck:!1})]})]}),(0,G.jsxs)($f,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,disabled:V,onClick:()=>{f(null),m(null)},children:Q(`panel.common.close`)}),d===`invite`?(0,G.jsx)(Z,{variant:`primary`,disabled:V||!p||B,onClick:()=>void P(),children:Q(`panel.remote.copy`)}):(0,G.jsx)(Z,{variant:`primary`,disabled:V||!h.trim(),onClick:()=>void M(`add`,async()=>{await aN.add(h.trim()),_(``),f(null)},`panel.remote.added`),children:Q(`panel.remote.add`)})]})]})}),(0,G.jsx)(qf,{open:b!==null,onOpenChange:e=>{!e&&!H&&x(null)},children:(0,G.jsxs)(Jf,{className:`max-w-sm`,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.remote.route`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-3 text-sm`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-5 text-foreground-muted`,children:Q(`panel.remote.routeHint`)}),(0,G.jsx)(pA,{className:`flex flex-col gap-2`,value:S,onValueChange:e=>{typeof e==`string`&&C(e)},children:oN(b?.routes??[]).map(e=>(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2`,children:[(0,G.jsx)(Zk,{value:e}),(0,G.jsx)(`span`,{children:pN(e)})]},e))})]}),(0,G.jsxs)($f,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,disabled:H,onClick:()=>x(null),children:Q(`panel.common.cancel`)}),(0,G.jsx)(Z,{variant:`primary`,disabled:H||!oN(b?.routes??[]).includes(S),onClick:()=>{b&&M(`mode:${b.id}`,async()=>{await aN.mode(b.id,S),x(null)},`panel.remote.modeSaved`)},children:Q(`panel.common.save`)})]})]})})]})}function hN(e){let t=Number.isFinite(e)&&e>0?e:0;return t===0?`0 MB`:t<1048576?`${Math.max(1,Math.round(t/1024))} KB`:`${(t/1024/1024).toFixed(1)} MB`}function gN(e,t=Date.now()){if(!e)return``;let n=Math.floor((t-e)/36e5);return n<1?Q(`panel.inbox.ageLessThanHour`):n<24?Q(`panel.inbox.ageHours`,{hours:n}):Q(`panel.inbox.ageDays`,{days:Math.floor(n/24)})}function _N({framed:e=!0}){let t=MM(),[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(!1),u=(0,g.useCallback)(async()=>{try{r(await bA(`/api/relay/inbox/status`))}catch{r(null)}finally{a(!0)}},[]);(0,g.useEffect)(()=>{u()},[u]);let d=n?.deletableFiles??0,f=gN(n?.oldestAt??null),p=n?.stagingFiles??0;async function m(e){if(!c){l(!0);try{let t=await xA(`/api/relay/inbox/auto`,{enabled:e});r(e=>e&&{...e,autoClear:t.data.autoClear})}catch(e){t(`error`,Q(`panel.inbox.autoFailed`,{message:wA(e)}))}finally{l(!1)}}}async function h(){if(o)return;let e=d>0?Q(`panel.inbox.confirmDetail`,{count:d,hours:n?.keepHours??24,bytes:hN(n?.deletableBytes??0)}):Q(`panel.inbox.confirmNothing`,{hours:n?.keepHours??24});if(window.confirm(`${Q(`panel.inbox.confirmTitle`)}\n\n${e}\n\n${Q(`panel.inbox.confirmIrreversible`)}`)){s(!0);try{let e=await xA(`/api/relay/inbox/clear`),n=hN(e.freedBytes);t(e.failedFiles>0?`soft`:`ok`,e.deletedFiles>0?`${Q(`panel.inbox.cleared`,{bytes:n,count:e.deletedFiles})}${e.failedFiles>0?Q(`panel.inbox.clearedSomeFailed`,{count:e.failedFiles}):``}`:Q(`panel.inbox.nothingToClear`)),await u()}catch(e){t(`error`,Q(`panel.inbox.clearFailed`,{message:wA(e)}))}finally{s(!1)}}}let _=(0,G.jsxs)(G.Fragment,{children:[i?null:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-sm text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.inbox.reading`)]}),i&&n===null?(0,G.jsxs)(ZD,{variant:`info`,className:`mt-2`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.inbox.unreadableTitle`)}),(0,G.jsx)(tO,{children:Q(`panel.inbox.unreadableBody`)})]}):null,n===null?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`mt-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 border-b border-border-muted py-2`,children:[(0,G.jsx)(`dt`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.inbox.used`)}),(0,G.jsx)(`dd`,{className:`min-w-0 text-right text-sm break-all`,children:Q(`panel.inbox.usedValue`,{bytes:hN(n.bytes),count:n.files})})]}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 border-b border-border-muted py-2`,children:[(0,G.jsx)(`dt`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.inbox.deletable`)}),(0,G.jsx)(`dd`,{className:`min-w-0 text-right text-sm break-all`,children:d>0?Q(`panel.inbox.deletableValue`,{bytes:hN(n.deletableBytes),count:d}):Q(`panel.common.none`)})]}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-2`,children:[(0,G.jsx)(`dt`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.inbox.keep`)}),(0,G.jsx)(`dd`,{className:`min-w-0 text-right text-sm break-all`,children:f?Q(`panel.inbox.keepValueOldest`,{hours:n.keepHours,age:f}):Q(`panel.inbox.keepValue`,{hours:n.keepHours})})]})]}),p>0?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-foreground-muted`,children:Q(`panel.inbox.staging`,{bytes:hN(n.stagingBytes??0),count:n.stagingFiles??0})}):null,(0,G.jsxs)(`label`,{className:`mt-3 flex items-center justify-between gap-4 border-t border-border-muted pt-3`,children:[(0,G.jsx)(`span`,{className:`block text-sm text-foreground`,children:Q(`panel.inbox.auto`)}),(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[c?(0,G.jsx)(UD,{}):null,(0,G.jsx)(VO,{size:`md`,checked:n.autoClear===!0,disabled:o||c,onCheckedChange:e=>void m(e),"aria-label":Q(`panel.inbox.autoA11y`)})]})]}),(0,G.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,G.jsx)(Z,{variant:d>0?`primary`:`outline`,size:`md`,disabled:o,onClick:()=>void h(),children:Q(o?`panel.inbox.clearing`:`panel.inbox.clear`)})})]})]});return e?(0,G.jsxs)(uO,{frame:`solid`,children:[(0,G.jsx)(dO,{className:`px-4 py-3`,children:(0,G.jsx)(fO,{className:`flex items-center gap-2`,children:(0,G.jsx)(`span`,{children:Q(`panel.inbox.title`)})})}),_]}):_}var vN=`https://github.com/WNLUO/dsh-mobile-server`;function yN(){return[Q(`panel.notice.promptIntro`),``,`${Q(`panel.notice.promptRepo`)}: ${vN}`,``,Q(`panel.notice.promptAsk`),``,Q(`panel.notice.promptDo`),``,Q(`panel.notice.promptAfter`),``,Q(`panel.notice.promptStyle`)].join(`
|
|
25
|
+
`))):A=sA(D)}w(k,A)}),E=J((e,t=!1)=>{if(_.clear(),x.current+=1,t)return;let n=u();n&&e!==``&&o?_.start(o,()=>{T(e)}):T(e,!n)}),D=g.useCallback((e,t={})=>Dr(m(t),l.valid===!1&&!l.disabled&&!e?{"aria-invalid":!0}:h),[m,l.disabled,l.valid]);return g.useMemo(()=>({getValidationProps:D,inputRef:v,registeredInputs:b,registerInput:C,getInputControl:w,commit:T,change:E}),[D,b,C,w,T,E])}var lA=g.createContext(void 0);function uA(e=!1){let t=g.useContext(lA);if(!t&&!e)throw Error(S(86));return t}var dA=[nf],fA=g.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:m,...h}=e,{setTouched:_,setFocused:v,validationMode:y,name:b,disabled:x,state:S,validation:C,setDirty:w,setFilled:T,validityData:E}=TO(),{labelId:D}=AO(),{clearErrors:O,elementRef:k}=OO(),A=uA(!0),j=x||i,M=b??d,N=qd(p),[P,F]=QC({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[I,L]=g.useState(!1),R=J((e,t)=>{s?.(e,t),!t.isCanceled&&F(e)}),z=C.getInputControl,B=g.useMemo(()=>({get current(){return z()}}),[z]),V=g.useRef(null),H=g.useRef(null);function U(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),V.current=e,t}let W=J(e=>{if(!e||e.disabled)return;H.current||=e;let t=V.current,n=e.checked||t==null||t.disabled?U(e):void 0;return()=>{H.current===e&&(H.current=null),V.current===e?n?(n(),V.current=null):U(null):n?.()}}),ee=J(()=>{let e=k.current;if(!e)return P??null;for(let t of C.registeredInputs.keys())if(t.checked&&iA(t,e))return P??null;return null});EO(B,N,P??null,ee,!j,d),zf(P,()=>{O(M),w(P!==E.initialValue),T(P!=null),C.change(P);let e=H.current;P==null&&e&&!e.disabled&&U(e)});let K=D??A?.legendId,te={...S,disabled:j??!1,required:o??!1,readOnly:a??!1},q=g.useMemo(()=>({checkedValue:P,disabled:j,form:u,validation:C,name:M,readOnly:a,registerInputRef:W,required:o,setCheckedValue:R,setTouched:L,touched:I}),[P,j,u,C,M,a,W,o,R,L,I]),ne={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":j||void 0,"aria-readonly":a||void 0,"aria-labelledby":K,onFocus(){v(!0)},onBlur(e){Y(e.currentTarget,e.relatedTarget)||(_(!0),v(!1),y===`onBlur`&&C.commit(P))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(L(!0),v(!0))}};return(0,G.jsx)(zk.Provider,{value:q,children:(0,G.jsx)(tA,{render:n,className:r,style:m,state:te,props:[ne,h,e=>C.getValidationProps(j??!1,e)],refs:[t],stateAttributesMapping:yO,enableHomeAndEndKeys:!1,modifierKeys:dA})})});function pA({className:e,orientation:t=`vertical`,...n}){return(0,G.jsx)(fA,{"data-slot":`radio-group`,"aria-orientation":t,className:X(`flex`,t===`horizontal`?`flex-wrap gap-4`:`flex-col gap-2`,e),...n})}function mA(e){if(!Array.isArray(e))return`full`;if(e.length===0)return`none`;let t=new Set(e);return[`input`,`dispatch`,`operate`,`files.write`,`transfer`,`manage`,`config`].some(e=>t.has(e))?`full`:t.has(`approve`)?`approve`:`readonly`}var hA=3e4,gA=1e3;function _A(e,t=Date.now()){let n=e?.tailcat?.expiresAt??0;if(!Number.isFinite(n)||n<=0)return null;let r=n*1e3-t;return r<=0?null:Math.max(r-hA,gA)}var vA=class extends Error{constructor(e,t,n){super(e),q(this,`code`,void 0),q(this,`status`,void 0),this.name=`ApiError`,this.code=t,this.status=n}};async function yA(e){let t=null;try{t=await e.json()}catch{t=null}let n=t?.error;if(typeof n==`string`&&n)return new vA(n,`http_${e.status}`,e.status);if(n&&typeof n==`object`){let t=n,r=typeof t.code==`string`&&t.code?t.code:`http_${e.status}`;return new vA(typeof t.message==`string`&&t.message?t.message:Q(`panel.net.requestFailed`,{status:e.status}),r,e.status)}return new vA(Q(`panel.net.requestFailed`,{status:e.status}),`http_${e.status}`,e.status)}async function bA(e){let t=e.split(`?`)[0]===`/api/relay/pairing`,n=t?3e4:e===`/api/relay/status`?12e3:0,r=n?new AbortController:null,i=r?window.setTimeout(()=>r.abort(),n):null;try{let n=await fetch(e,{headers:{accept:`application/json`},...r?{signal:r.signal}:{}});if(!n.ok)throw await yA(n);let i=await n.json();if(t&&(i?.ok!==!0||typeof i.svg!=`string`||!i.svg.includes(`<svg`)))throw new vA(Q(`panel.pairing.qrFailed`),`pairing_invalid`,n.status);return i}catch(e){throw r?.signal.aborted?new vA(Q(t?`panel.console.pairingTimeout`:`panel.console.statusTimeout`),t?`pairing_timeout`:`status_timeout`,0):e}finally{i!==null&&window.clearTimeout(i)}}async function xA(e,t){let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`,accept:`application/json`},body:JSON.stringify(t??{})});if(!n.ok)throw await yA(n);let r=await n.json();return SA(r),r}function SA(e){let t=e?.applyError;if(typeof t==`string`&&t)throw new vA(Q(`panel.shell.applyFailed`,{message:t}),`apply_failed`,200)}function CA(e,t){return xA(`/api/relay/devices/permissions`,{deviceId:e,tier:t})}function wA(e){return e instanceof vA?e.message:e instanceof Error?e.message||Q(`panel.net.requestFailedNoStatus`):String(e)}function TA(e){let t=g.useRef(!0);t.current&&(t.current=!1,e())}var EA=g.createContext(void 0),DA=g.createContext(void 0),OA=g.createContext(void 0);function kA(){let e=g.useContext(EA);if(e===void 0)throw Error(S(60));return e}function AA(){let e=g.useContext(DA);if(e===void 0)throw Error(S(101));return e}function jA(){let e=g.useContext(OA);if(e===void 0)throw Error(S(61));return e}function MA(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var NA=(e,t)=>Object.is(e,t);function PA(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function FA(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!MA(e,t,(e,t)=>PA(e,t,n)):e!==t}function IA(e,t,n){return e?e.some(e=>e!==void 0&&PA(t,e,n)):!1}function LA(e,t,n){return e?e.findIndex(e=>e!==void 0&&PA(e,t,n)):-1}function RA(e,t){if(t!==NA)return n=>IA(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function zA(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(RA(t,n)):LA(e,t,n);return i===-1?null:i}function BA(e,t,n,r,i,a){return IA(r,t,i)?a!=null&&e>a&&IA(r,n[a],i)?a:e:e===a?zA(n,r,i,!0):a}function VA(e,t,n){return e.filter(e=>!PA(t,e,n))}function HA(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function UA(e){return HA(e?.[0])}function WA(e){return UA(e)?e.flatMap(e=>e.items):e}function GA(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(UA(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function KA(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Vk(e)}function qA(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Vk(e.value):Vk(e)}function JA(e,t,n){function r(){return KA(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=WA(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function YA(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,G.jsx)(g.Fragment,{children:JA(r,t,n)},i)),e),[])}var XA={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:qA(t,r)!==``},hasNullItemLabel:(e,t)=>t?GA(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>PA(t,e,n)):PA(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function ZA(e,t){return Math.max(0,e-t)}function QA(e,t){if(t<=0)return 0;let n=mi(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function $A(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:_=!1,modal:v=!0,actionsRef:x,inputRef:S,onOpenChangeComplete:C,items:w,multiple:T=!1,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O=NA,highlightItemOnHover:k=!0,children:A}=e,{clearErrors:j}=OO(),{setDirty:M,setTouched:N,setFocused:P,validityData:F,setFilled:I,name:L,disabled:R,validation:z,validationMode:B}=TO(),V=PO({id:t}),H=R||d,U=L??c,[W,ee]=QC({controlled:n,default:T?r??m:r,name:`Select`,state:`value`}),[K,te]=QC({controlled:a,default:o,name:`Select`,state:`open`}),q=g.useRef([]),ne=g.useRef([]),re=g.useRef(null),ie=g.useRef(null),ae=g.useRef(0),oe=g.useRef(null),se=g.useRef([]),le=g.useRef(!1),ue=g.useRef(null),de=g.useRef(null),fe=g.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=g.useRef(!1),me=g.useRef(W),{mounted:he,setMounted:ge,transitionStatus:_e}=Us(K),{openMethod:ve,triggerProps:ye}=Vf(K),be=y(()=>new ce({id:V,labelId:void 0,modal:v,multiple:T,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O,value:W,open:K,mounted:he,transitionStatus:_e,items:w,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:h,triggerProps:h,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:p,setOpen:p,handleScrollArrowVisibility:p,onOpenChangeComplete:p,listRef:q,popupRef:re,scrollHandlerRef:ie,scrollArrowsMountedCountRef:ae,valueRef:oe,valuesRef:se,labelsRef:ne,typingRef:le,selectionRef:fe,firstItemTextRef:ue,selectedItemTextRef:de,alignItemWithTriggerActiveRef:pe,initialValueRef:me},XA)).current,xe=be.useState(`activeIndex`),Se=be.useState(`selectedIndex`),Ce=be.useState(`triggerElement`),we=be.useState(`positionerElement`),Te=pE(ve),Ee=ve??Te,De=g.useMemo(()=>T?``:qA(W,D),[T,W,D]),Oe=g.useMemo(()=>T&&Array.isArray(W)?W.map(e=>qA(e,D)):qA(W,D),[T,W,D]);EO(Ba(Ce),V,W,J(()=>Oe),!H,c);let ke=T?Array.isArray(W)&&W.length>0:W!=null&&De!==``;b(()=>{I(ke)},[ke,I]),b(function(){let e=zA(se.current,W,O,T);e===null&&(de.current=null),!K&&be.set(`selectedIndex`,e)},[T,K,W,O,be]),zf(W,()=>{j(U),M(FA(W,F.initialValue,O)),z.change(W)});let Ae=J((e,t)=>{s?.(e,t),!t.isCanceled&&(te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(N(!0),P(!1),B===`onBlur`&&z.commit(W)))}),je=J(()=>{ge(!1),be.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),C?.(!1)});ii({enabled:!x,open:K,ref:re,onComplete(){K||je()}}),g.useImperativeHandle(x,()=>({unmount:je}),[je]);let Me=J((e,t)=>{i?.(e,t),!t.isCanceled&&ee(e)}),Ne=J(e=>{let t=ZA(e.scrollHeight,e.clientHeight),n=QA(e.scrollTop,t),r=n>0,i=n<t;be.set(`scrollUpArrowVisible`,r),be.set(`scrollDownArrowVisible`,i)}),Pe=pc({open:K,onOpenChange:Ae,elements:{reference:Ce,floating:we}}),Fe=ko(Pe,{enabled:!H,event:`mousedown`}),Ie=Fo(Pe),Le=Nc(Pe,{enabled:!H,listRef:q,activeIndex:xe,selectedIndex:Se,disabledIndices:m,onNavigate(e){(e!==null||K)&&be.set(`activeIndex`,e)},focusItemOnHover:k}),Re=Pc(Pe,{enabled:!H&&(K||!f&&!T),listRef:ne,activeIndex:xe,selectedIndex:Se,disabledIndices:e=>hE(q.current[e]),onMatch(e){K?be.set(`activeIndex`,e):Me(se.current[e],ja(ma))},onTyping(e){le.current=e}}),ze=g.useMemo(()=>Dr(Re.reference,Le.reference,Ie.reference,Fe.reference,ye),[Fe.reference,Re.reference,Le.reference,Ie.reference,ye]),Be=g.useMemo(()=>Dr(Ws,Re.floating,Le.floating,Ie.floating),[Re.floating,Le.floating,Ie.floating]),Ve=Le.item??h;be.useContextCallback(`setValue`,Me),be.useContextCallback(`setOpen`,Ae),be.useContextCallback(`handleScrollArrowVisibility`,Ne),be.useContextCallback(`onOpenChangeComplete`,C),TA(()=>{be.update({popupProps:Be,triggerProps:ze})}),be.useSyncedValues({id:V,modal:v,multiple:T,value:W,open:K,mounted:he,transitionStatus:_e,popupProps:Be,triggerProps:ze,items:w,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O,openMethod:Ee});let He=g.useMemo(()=>({disabled:H,readOnly:f,required:_,multiple:T,highlightItemOnHover:k,itemProps:Ve}),[H,f,_,T,k,Ve]),Ue=hr(S,z.inputRef),We=T?void 0:U,Ge=g.useMemo(()=>!T||!Array.isArray(W)||!U?null:W.map(e=>{let t=qA(e,D);return(0,G.jsx)(`input`,{type:`hidden`,form:l,name:U,value:t,disabled:H},t)}),[T,W,l,U,D,H]);return(0,G.jsxs)(EA.Provider,{value:be,children:[(0,G.jsx)(DA.Provider,{value:He,children:(0,G.jsx)(OA.Provider,{value:Pe,children:A})}),(0,G.jsx)(`input`,{...z.getValidationProps(H,{onFocus(){be.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||H||f)return;let t=e.currentTarget.value,n=ja(ma,e.nativeEvent);function r(){if(T)return;let e=t.toLowerCase(),r=se.current.findIndex(t=>qA(t,D).toLowerCase()===e||KA(t,E).toLowerCase()===e);r===-1&&(r=se.current.findIndex((t,n)=>{let r=ne.current[n];return r!=null&&r.toLowerCase()===e}));let i=se.current[r];i!=null&&Me(i,n)}be.set(`forceMount`,!0),queueMicrotask(r)}}),id:V&&We==null?`${V}-hidden-input`:void 0,form:l,name:We,autoComplete:u,value:De,disabled:H,required:_&&!(T&&ke),readOnly:f,ref:Ue,style:U?pr:fr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ge]})}function ej(e,t){let n=qd(e);return b(()=>(t(n),()=>{t(e=>e===n?void 0:e)}),[n,t]),n}function tj(e={}){let{id:t,fallbackControlId:n,native:r=!1,setLabelId:i,focusControl:a}=e,{controlId:o,setLabelId:s}=AO(),c=ej(t,J(e=>{s(e),i?.(e)})),l=o??n;function u(e){if(a){a(e,l);return}if(!l)return;let t=Le(e.currentTarget).getElementById(l);_e(t)&&nj(t)}function d(e){ut(e.nativeEvent)?.closest(`button,input,select,textarea`)||(!e.defaultPrevented&&e.detail>1&&e.preventDefault(),!r&&u(e))}return r?{id:c,htmlFor:l,onMouseDown:d}:{id:c,onClick:d,onPointerDown(e){e.preventDefault()}}}function nj(e){e.focus({focusVisible:!0})}function rj(e,t){return e??t}var ij=`data-popup-side`,aj=400,oj={...Nt,...yO,popupSide:e=>e?{[ij]:e}:null,value:()=>null},sj=g.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,validation:f,state:p,disabled:m}=TO(),{labelId:h}=AO(),_=kA(),{readOnly:v,required:y,disabled:b}=AA(),x=m||b||a,S=_.useState(`open`),C=_.useState(`mounted`),w=_.useState(`value`),T=_.useState(`triggerProps`),E=_.useState(`positionerElement`),D=_.useState(`listElement`),O=_.useState(`popupSide`),k=_.useState(`id`),A=_.useState(`labelId`),j=_.useState(`hasSelectedValue`),M=C&&E?O:null,N=i??k,P=rj(h,A);PO({id:i});let F=Ba(E),I=g.useRef(null),{getButtonProps:L,buttonRef:R}=la({disabled:x,native:o}),z=_.useStateSetter(`triggerElement`),B=Ge(),V=Ge(),H=Ge();g.useEffect(()=>{if(S)return H.start(aj,()=>{_.context.selectionRef.current.allowUnselectedMouseUp=!0,_.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{H.clear()};_.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},V.clear()},[S,_,V,H]);let U=Dr(T,{id:N,role:`combobox`,"aria-expanded":S,"aria-haspopup":`listbox`,"aria-controls":S?D?.id??Wt(E)?.id:void 0,"aria-labelledby":P,"aria-readonly":v||void 0,"aria-required":y||void 0,tabIndex:x?-1:0,onFocus(e){u(!0),S&&_.context.alignItemWithTriggerActiveRef.current&&_.context.setOpen(!1,ja(ma,e.nativeEvent)),B.start(0,()=>{_.set(`forceMount`,!0)})},onBlur(e){Y(E,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(w))},onMouseDown(e){if(S)return;let t=Le(e.currentTarget);function n(e){if(!I.current)return;let t=e.target;Y(I.current,t)||Y(F.current,t)||rE(e,I.current)||_.context.setOpen(!1,ja(Ta,e))}V.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,L),W=f.getValidationProps(x,U);W.role=`combobox`;let G={...p,open:S,disabled:x,value:w,readOnly:v,popupSide:M,placeholder:!j};return Vr(`button`,e,{ref:[t,I,R,z],state:G,stateAttributesMapping:oj,props:W})}),cj={value:()=>null},lj=g.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=kA(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?YA(l,u,d):JA(l,u,d)),Vr(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:cj})}),uj=g.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Vr(`span`,e,{state:{open:kA().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Mt})}),dj=g.forwardRef(function(e,t){let n=kA(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,G.jsx)(La,{ref:t,...e}):null}),fj=g.createContext(void 0);function pj(){let e=g.useContext(fj);if(!e)throw Error(S(59));return e}function mj(e,t){e&&Object.assign(e.style,t)}var hj={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},gj={position:`fixed`},_j=g.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:_=di,style:v,...y}=e,x=kA(),S=jA(),C=x.useState(`open`),w=x.useState(`mounted`),T=x.useState(`modal`),E=x.useState(`value`),D=x.useState(`openMethod`),O=x.useState(`positionerElement`),k=x.useState(`triggerElement`),A=x.useState(`isItemEqualToValue`),j=x.useState(`transitionStatus`),M=g.useRef(null),N=g.useRef(null),[P,F]=g.useState(h),I=w&&P&&D!==`touch`;!w&&P!==h&&F(h),g.useImperativeHandle(x.context.alignItemWithTriggerActiveRef,()=>I),LT((I||T)&&C,D===`touch`,O,k);let L=il({anchor:n,floatingRootContext:S,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??I,collisionAvoidance:_,keepMounted:!0}),R=I?`none`:L.side,z=I?gj:L.positionerStyles,B={open:C,side:R,align:L.align,anchorHidden:L.anchorHidden};b(()=>{x.set(`popupSide`,L.side)},[x,L.side]);let V=cl(e,B,{styles:z,transitionStatus:j,props:y,refs:[t,x.useStateSetter(`positionerElement`)],hidden:!w,inert:!C}),H=g.useRef(0),U=J(e=>{if(x.context.valuesRef.current.length===0)return;let t=H.current;H.current=e.size;let n=ja(ma);if(t!==0&&!x.state.multiple&&E!==null&&LA(x.context.valuesRef.current,E,A)===-1){let e=x.context.initialValueRef.current,t=e!=null&&LA(x.context.valuesRef.current,e,A)!==-1?e:null;x.context.setValue(t,n),t===null&&(x.set(`selectedIndex`,null),x.context.selectedItemTextRef.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(E)){let e=E.filter(e=>LA(x.context.valuesRef.current,e,A)!==-1);e.length!==E.length&&(x.context.setValue(e,n),e.length===0&&(x.set(`selectedIndex`,null),x.context.selectedItemTextRef.current=null))}if(C&&I){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};mj(O,e),mj(x.context.popupRef.current,e)}}),W=g.useMemo(()=>({...L,side:R,alignItemWithTriggerActive:I,setControlledAlignItemWithTrigger:F,scrollUpArrowRef:M,scrollDownArrowRef:N}),[L,R,I,F]);return(0,G.jsx)(kT,{elementsRef:x.context.listRef,labelsRef:x.context.labelsRef,onMapChange:U,children:(0,G.jsxs)(fj.Provider,{value:W,children:[w&&T&&(0,G.jsx)(mf,{inert:Xr(!C),cutout:k}),V]})})}),vj=`base-ui-disable-scrollbar`,yj={className:vj,getElement(e){return(0,G.jsx)(`style`,{nonce:e,href:vj,precedence:`base-ui:low`,children:`.${vj}{scrollbar-width:none}.${vj}::-webkit-scrollbar{display:none}`})}},bj=g.createContext(void 0),xj={disableStyleElements:!1};function Sj(){return g.useContext(bj)??xj}var Cj=`--transform-origin`,wj={...Pt,...xt},Tj=g.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=kA(),{multiple:c,readOnly:l,highlightItemOnHover:u}=AA(),d=jA(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:_}=pj(),v=wT(!0)!=null,y=Wc(),{nonce:x,disableStyleElements:S}=Sj(),C=s.useState(`id`),w=s.useState(`open`),T=s.useState(`openMethod`),E=s.useState(`mounted`),D=s.useState(`popupProps`),O=s.useState(`transitionStatus`),k=s.useState(`triggerElement`),A=s.useState(`positionerElement`),j=s.useState(`listElement`),M=g.useRef(!1),N=g.useRef(!1),P=g.useRef({}),F=He(),I=J(e=>{if(!A||!s.context.popupRef.current||!N.current)return;let t=A.style.top===`0px`,n=A.style.bottom===`0px`;if(M.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=Oj(A),i=kj(A.getBoundingClientRect().height,`y`,r),a=Le(A),o=pe(A),c=o.getComputedStyle(A),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=Ej(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=Dj(e),g=null,_=e=>{A.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=mi(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(M.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=mi(g,0,Dj(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(M.current=!0),s.context.handleScrollArrowVisibility(e)});g.useImperativeHandle(s.context.scrollHandlerRef,()=>I,[I]),ii({open:w,ref:s.context.popupRef,onComplete(){w&&s.context.onOpenChangeComplete(!0)}});let L={open:w,transitionStatus:O,side:f,align:p};b(()=>{A&&s.context.popupRef.current&&!Object.keys(P.current).length&&(P.current={top:A.style.top||`0`,left:A.style.left||`0`,right:A.style.right,height:A.style.height,bottom:A.style.bottom,minHeight:A.style.minHeight,maxHeight:A.style.maxHeight,marginTop:A.style.marginTop,marginBottom:A.style.marginBottom})},[s,A]),b(()=>{w||m||(N.current=!1,M.current=!1,mj(A,P.current))},[w,m,A]),b(()=>{let e=s.context.popupRef.current;if(!w||!k||!A||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(N.current=!0,e.style.removeProperty(Cj),!m){F.request(()=>s.context.handleScrollArrowVisibility(j||e));return}let t=Mj(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=pe(A),i=r.getComputedStyle(A),a=r.getComputedStyle(e),o=Le(k),c=Oj(k),l=Aj(k.getBoundingClientRect(),c),d=Aj(A.getBoundingClientRect(),c),f=l.height,p=j||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),g=parseFloat(i.marginTop)||10,v=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=Ej(a),S=o.documentElement.clientHeight-g-v,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=y===`rtl`?l.right-d.width:l.left,D=0;if(t&&n){let e=Aj(n.getBoundingClientRect(),c);T=Aj(t.getBoundingClientRect(),c),E=d.left+(y===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;D=T.top-d.top+T.height/2-r}let O=w+D+v+h,N=Math.min(S,O),F=S-g-v,I=O-N,L=C-5;A.style.left=`${mi(E,5,L-d.width)}px`,A.style.height=`${N}px`,A.style.maxHeight=`none`,A.style.marginTop=`${g}px`,A.style.marginBottom=`${v}px`,e.style.height=`100%`;let R=Dj(p),z=I>=R-1;z&&(N=Math.min(S,d.height)-(I-R));let B=l.top<20||l.bottom>S-20||Math.ceil(N)+1<Math.min(m,b),V=(r.visualViewport?.scale??1)!==1&&ot;if(B||V){mj(A,P.current),_(!1);return}let H=Math.max(b,N);if(z){let e=Math.max(0,S-O);A.style.top=d.height>=F?`0`:`${e}px`,A.style.height=`${N}px`,p.scrollTop=Dj(p)}else A.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=mi(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(Cj,`50% ${i}%`)}(H===S||N>=x)&&(M.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,w,A,k,m,_,F,j,u,y,h]),g.useEffect(()=>{if(!m||!A||!w)return;let e=pe(A);function t(e){s.context.setOpen(!1,ja(Aa,e))}return Re(e,`resize`,t)},[s,m,A,w]);let R={...j?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${C}-list`},onKeyDown(e){v&&tf.has(e.key)&&e.stopPropagation()},onScroll(e){j||I(e.currentTarget)},...m&&{style:j?{height:`100%`}:hj},className:!j&&m?yj.className:void 0},z=Vr(`div`,e,{ref:[t,s.context.popupRef],state:L,stateAttributesMapping:wj,props:[D,R,sl(O),o]});return(0,G.jsxs)(g.Fragment,{children:[!S&&yj.getElement(x),(0,G.jsx)(Oo,{context:d,modal:!1,disabled:!E,openInteractionType:T,returnFocus:a,restoreFocus:!0,children:z})]})});function Ej(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Dj(e){return ZA(e.scrollHeight,e.clientHeight)}function Oj(e){return vs.getScale(e)}function kj(e,t,n){return e/n[t]}function Aj(e,t){return En({x:kj(e.x,`x`,t),y:kj(e.y,`y`,t),width:kj(e.width,`x`,t),height:kj(e.height,`y`,t)})}var jj=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Mj(e){let{style:t}=e,n={};for(let[e,r]of jj)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of jj){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Nj=g.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=kA(),{multiple:s,readOnly:c}=AA(),{alignItemWithTriggerActive:l}=pj(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:hj},className:u&&d!==`touch`?yj.className:void 0};return Vr(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),Pj=g.createContext(void 0);function Fj(){let e=g.useContext(Pj);if(!e)throw Error(S(57));return e}var Ij=g.memo(g.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=g.useRef(null),d=vT({guess:!0,label:o,textRef:u}),f=kA(),{itemProps:p,multiple:m,disabled:h,readOnly:_}=AA(),v=h||s,y=f.useState(`isActive`,d.index),x=f.useState(`open`),S=f.useState(`isSelected`,a),C=f.useState(`isSelectedByFocus`,d.index),w=f.useState(`isItemEqualToValue`),T=d.index,E=g.useRef(null);b(()=>{let e=f.context.valuesRef.current;return e[T]=a,()=>{delete e[T]}},[T,a,f]),b(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=BA(T,a,f.context.valuesRef.current,e,w,t),r=n===T,T===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&PA(a,e,w),r&&(n=T)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[T,m,w,f,a]);let D=g.useRef(`mouse`),O=g.useRef(!1),{getButtonProps:k,buttonRef:A}=la({disabled:v,focusableWhenDisabled:!0,native:c,composite:!0}),j={disabled:v,selected:S,highlighted:y};function M(e){if(h||_)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=S?VA(n,a,w):[...n,a];f.context.setValue(r,ja(ya,e))}else f.context.setValue(a,ja(ya,e)),f.context.setOpen(!1,ja(ya,e))}function N(){f.context.selectionRef.current.dragY=0}let P={role:`option`,"aria-selected":S,tabIndex:x&&y?0:-1,onKeyDown(e){f.set(`activeIndex`,T),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=D.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&Yt(e.nativeEvent)&&(n!==void 0||y),i=t&&!r&&!O.current;O.current=!1,!(v||i)&&M(e.nativeEvent)},onPointerEnter(e){D.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){D.current=e.pointerType,O.current=!0,N()},onMouseUp(){if(N(),v||D.current===`touch`||O.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&S,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!S;e||t||(O.current=!0,E.current?.click(),O.current=!1)}},F=Vr(`div`,e,{ref:[A,t,d.ref,E],state:j,props:[p,P,l,k]}),I=g.useMemo(()=>({selected:S,index:T,textRef:u,selectedByFocus:C}),[S,T,u,C]);return(0,G.jsx)(Pj.Provider,{value:I,children:F})})),Lj=g.forwardRef(function(e,t){let{selected:n}=Fj();return e.keepMounted||n?(0,G.jsx)(Rj,{...e,ref:t}):null}),Rj=g.memo(g.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Fj(),c=g.useRef(null),{transitionStatus:l,setMounted:u}=Us(s),d=Vr(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:xt});return ii({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),zj=g.memo(g.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Fj(),a=kA(),{render:o,className:s,style:c,...l}=e;return Vr(`div`,e,{ref:[g.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),Bj=g.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=kA(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=pj(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=Ge(),v=c?f:d,{mounted:y,transitionStatus:x,setMounted:S}=Us(g);b(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),ii({open:g,ref:v,onComplete(){g||S(!1)}});let C=Vr(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:x},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=ZA(e.scrollHeight,e.clientHeight),r=QA(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){_.clear();return}if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=Vj(a,c,r,e.clientHeight,t,n)}_.start(40,t)}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:xt});return y||o?C:null});function Vj(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?QA(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?QA(l.offsetTop+l.offsetHeight-r+i,a):a}var Hj=g.forwardRef(function(e,t){return(0,G.jsx)(Bj,{...e,ref:t,direction:`down`})}),Uj=g.forwardRef(function(e,t){return(0,G.jsx)(Bj,{...e,ref:t,direction:`up`})}),Wj=Ku(`w-full border text-foreground outline-none transition-[background-color,border-color,box-shadow] duration-200 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{outline:`bg-background border-border-strong hover:not-focus:not-focus-visible:not-has-focus:not-has-focus-visible:not-data-popup-open:not-has-data-popup-open:not-data-pressed:not-has-data-pressed:not-data-invalid:not-has-data-invalid:border-border-emphasis`,soft:`bg-background-muted border-transparent hover:not-focus:not-focus-visible:not-has-focus:not-has-focus-visible:not-data-popup-open:not-has-data-popup-open:not-data-pressed:not-has-data-pressed:not-data-invalid:not-has-data-invalid:border-border-strong`},size:{sm:`h-8 px-3 text-xs pointer-coarse:text-base rounded-sm gap-1.5 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='stroke-'])]:stroke-[1.75]`,md:`h-10 px-3.5 text-sm pointer-coarse:text-base rounded-md gap-2 [&_svg:not([class*='size-'])]:size-4.5 [&_svg:not([class*='stroke-'])]:stroke-[1.65]`,lg:`h-12 px-4 text-base rounded-lg gap-2 [&_svg:not([class*='size-'])]:size-5 [&_svg:not([class*='stroke-'])]:stroke-[1.65]`},state:{self:X(`focus-visible:ring-3 focus-visible:ring-ring-input focus-visible:border-transparent focus-visible:bg-background`,`data-popup-open:ring-3 data-popup-open:ring-ring-input data-popup-open:border-transparent data-popup-open:bg-background`,`data-pressed:ring-3 data-pressed:ring-ring-input data-pressed:border-transparent data-pressed:bg-background`,`data-invalid:bg-error-subtle data-invalid:border-error`,`data-invalid:focus-visible:border-transparent data-invalid:focus-visible:ring-ring-error data-invalid:focus-visible:bg-background`,`data-invalid:data-popup-open:border-transparent data-invalid:data-popup-open:ring-ring-error data-invalid:data-popup-open:bg-background`,`data-invalid:data-pressed:border-transparent data-invalid:data-pressed:ring-ring-error data-invalid:data-pressed:bg-background`,`data-disabled:border-border-strong! data-disabled:bg-background-subtle! data-disabled:cursor-not-allowed data-disabled:border-dashed data-disabled:opacity-disabled`),within:X(`flex items-center`,`has-focus:ring-[3px] has-focus:ring-ring-input has-focus:border-transparent has-focus:bg-background`,`has-data-popup-open:ring-3 has-data-popup-open:ring-ring-input has-data-popup-open:border-transparent has-data-popup-open:bg-background`,`has-data-pressed:ring-3 has-data-pressed:ring-ring-input has-data-pressed:border-transparent has-data-pressed:bg-background`,`data-invalid:bg-error-subtle data-invalid:border-error data-invalid:has-focus:border-transparent data-invalid:has-focus:ring-ring-error data-invalid:has-focus:bg-background`,`data-invalid:has-data-popup-open:border-transparent data-invalid:has-data-popup-open:ring-ring-error data-invalid:has-data-popup-open:bg-background`,`data-invalid:has-data-pressed:border-transparent data-invalid:has-data-pressed:ring-ring-error data-invalid:has-data-pressed:bg-background`,`has-data-invalid:bg-error-subtle has-data-invalid:border-error has-data-invalid:has-focus:border-transparent has-data-invalid:has-focus:ring-ring-error has-data-invalid:has-focus:bg-background`,`has-data-invalid:has-data-popup-open:border-transparent has-data-invalid:has-data-popup-open:ring-ring-error has-data-invalid:has-data-popup-open:bg-background`,`has-data-invalid:has-data-pressed:border-transparent has-data-invalid:has-data-pressed:ring-ring-error has-data-invalid:has-data-pressed:bg-background`,`has-[input:disabled]:border-border-strong! has-[input:disabled]:bg-background-subtle! has-[input:disabled]:cursor-not-allowed has-[input:disabled]:border-dashed has-[input:disabled]:opacity-disabled`)}},defaultVariants:{variant:`outline`,size:`md`,state:`self`}}),Gj=g.createContext(null);function Kj(){let e=g.useContext(Gj);if(!e)throw Error(`Select sub-components must be rendered inside <Select>`);return e}function qj({size:e=`md`,variant:t=`outline`,alignItemWithTrigger:n=!0,value:r,defaultValue:i,onValueChange:a,multiple:o=!1,children:s,...c}){let l=KS(),u=r!==void 0,[d,f]=g.useState(i??(o?[]:null)),p=u?r:d,m=o?Array.isArray(p)&&p.length>0:p!=null&&p!==``,h=g.useCallback((e,t)=>{u||f(e),a?.(e,t)},[u,a]),_=g.useCallback(e=>{let t=o?[]:null,n={reason:`none`,event:e?.nativeEvent??new Event(`clear`),trigger:void 0,cancel:()=>{},allowPropagation:()=>{},isCanceled:!1,isPropagationAllowed:!1};h(t,n)},[o,h]),v=g.useMemo(()=>({size:e,variant:t,alignItemWithTrigger:n,hasValue:m,clear:_,multiple:o,reducedMotion:l}),[e,t,n,m,_,o,l]);return(0,G.jsx)(Gj.Provider,{value:v,children:(0,G.jsx)($A,{value:p,onValueChange:h,multiple:o,...c,children:s})})}var Jj={sm:`size-4`,md:`size-4.5`,lg:`size-5`};function Yj({className:e,clearable:t,startSlot:n,endSlot:r,children:i,onKeyDown:a,...o}){let{size:s,variant:c,alignItemWithTrigger:l,hasValue:u,clear:d}=Kj(),f=Jj[s],p=o[`aria-invalid`],m=p===!0||p===`true`,h=t&&u,g=e=>{a?.(e),!e.defaultPrevented&&h&&(e.key===`Delete`||e.key===`Backspace`)&&(e.preventDefault(),d(e))};return(0,G.jsxs)(sj,{"data-slot":`select-trigger`,className:X(Wj({variant:c,size:s,state:`self`}),`data-placeholder:text-foreground-subtle flex items-center justify-between`,e),...o,onKeyDown:g,...m?{"data-invalid":``}:{},children:[n&&(0,G.jsx)(`span`,{"data-slot":`select-trigger-start`,className:`-ms-1 shrink-0`,children:n}),(0,G.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center truncate text-start`,children:i}),h?(0,G.jsx)(`span`,{"data-slot":`select-clear`,"aria-hidden":`true`,onPointerDown:e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),e.preventDefault(),d(e)},onClick:e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()},className:`text-foreground-subtle hover:text-foreground shrink-0 cursor-pointer transition-colors duration-200 motion-reduce:transition-none`,children:(0,G.jsx)(cM,{className:`size-[1em]`})}):null,r&&(0,G.jsx)(`span`,{"data-slot":`select-trigger-end`,className:`shrink-0`,children:r}),(0,G.jsx)(uj,{"data-slot":`select-icon`,className:`text-foreground -me-1 shrink-0`,render:l?(0,G.jsx)(oM,{className:f}):(0,G.jsx)(aM,{className:X(f,`motion-safe:transition-transform motion-safe:duration-200`,`data-popup-open:rotate-180`)})})]})}function Xj({className:e,...t}){return(0,G.jsx)(lj,{"data-slot":`select-value`,className:X(`min-w-0 flex-1 truncate text-start`,e),...t})}var Zj={sm:`rounded-md`,md:`rounded-lg`,lg:`rounded-xl`};function Qj({className:e,alignItemWithTrigger:t,children:n,...r}){let{size:i,alignItemWithTrigger:a}=Kj(),o=t??a,{positioner:s,portal:c,popup:l}=vE(r);return(0,G.jsx)(dj,{...c,children:(0,G.jsx)(_j,{sideOffset:6,...s,alignItemWithTrigger:o,className:X(`isolate z-50`,s.className),children:(0,G.jsxs)(Tj,{"data-slot":`select-content`,"data-align-trigger":o||void 0,className:X(`bg-background border-border-overlay flex flex-col border shadow-2xl outline-none`,Zj[i],`min-w-36`,o?`w-[calc(var(--anchor-width)+1rem)]`:`w-(--anchor-width)`,o?`origin-center`:`origin-(--transform-origin)`,`motion-safe:transition-[opacity,scale] motion-safe:duration-200 motion-safe:ease-[cubic-bezier(0.175,0.885,0.32,1.5)]`,`data-starting-style:motion-safe:scale-90 data-starting-style:motion-safe:opacity-0`,`data-ending-style:motion-safe:scale-95 data-ending-style:motion-safe:opacity-0 data-ending-style:motion-safe:duration-100 data-ending-style:motion-safe:ease-out`,e),...l,children:[(0,G.jsx)(eM,{}),(0,G.jsx)(Nj,{className:`flex max-h-(--available-height) flex-col gap-0.5 overflow-y-auto p-2`,children:n}),(0,G.jsx)(tM,{})]})})})}var $j=X(`bg-background text-foreground z-1 flex h-6 w-[calc(100%-var(--border-width)*2)] cursor-default items-center justify-center`);function eM(){let{size:e}=Kj();return(0,G.jsx)(Uj,{"data-slot":`select-scroll-up`,"aria-hidden":`true`,className:X($j,Zj[e],`top-px rounded-b-none`),children:(0,G.jsx)(aM,{className:X(Jj[e],`rotate-180`)})})}function tM(){let{size:e}=Kj();return(0,G.jsx)(Hj,{"data-slot":`select-scroll-down`,"aria-hidden":`true`,className:X($j,Zj[e],`bottom-px rounded-t-none`),children:(0,G.jsx)(aM,{className:Jj[e]})})}var nM={sm:`gap-1 rounded-xs py-1.5 px-2.5 text-xs has-data-[icon=end]:pe-1.5 has-data-[icon=start]:ps-1.5 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='stroke-'])]:stroke-[1.75]`,md:`gap-1.5 rounded-sm py-2 px-3 text-sm has-data-[icon=end]:pe-2 has-data-[icon=start]:ps-2 [&_svg:not([class*='size-'])]:size-4.5 [&_svg:not([class*='stroke-'])]:stroke-[1.65]`,lg:`gap-1.5 rounded-md py-2.5 px-3.5 text-base has-data-[icon=end]:pe-2.5 has-data-[icon=start]:ps-2.5 [&_svg:not([class*='size-'])]:size-5 [&_svg:not([class*='stroke-'])]:stroke-[1.65]`},rM={sm:`gap-1`,md:`gap-1.5`,lg:`gap-1.5`};function iM({className:e,children:t,...n}){let{size:r,reducedMotion:i}=Kj();return(0,G.jsxs)(Ij,{"data-slot":`select-item`,className:X(`text-foreground relative isolate flex w-full cursor-default items-center justify-between outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,`before:bg-background-muted before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:opacity-0`,`active:translate-y-px active:scale-[0.98]`,`data-highlighted:not-data-disabled:text-foreground-intense data-highlighted:not-data-disabled:before:opacity-100`,`motion-safe:transition motion-safe:duration-250 motion-safe:ease-[cubic-bezier(0.175,0.885,0.32,1.5)]`,`motion-safe:active:duration-100 motion-safe:active:ease-in-out`,`motion-safe:before:transition-opacity motion-safe:before:duration-200 motion-safe:before:ease-out`,`data-disabled:opacity-disabled data-disabled:pointer-events-none`,nM[r],e),...n,children:[(0,G.jsx)(zj,{className:X(`flex items-center text-start`,rM[r]),children:t}),(0,G.jsx)(Lj,{"data-slot":`select-item-indicator`,keepMounted:!i,className:`group/check text-foreground-intense shrink-0`,children:(0,G.jsx)(sM,{"data-icon":`end`,className:`me-0.5 size-[1.125em]`})})]})}function aM(e){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,G.jsx)(`path`,{d:`M11.594 5.594c.225-.225.588-.225.813 0s.225.588 0 .813l-4 4c-.225.225-.588.225-.812 0l-4-4c-.225-.225-.225-.588 0-.812s.588-.225.812 0L8 9.187l3.594-3.594z`})})}function oM(e){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,G.jsx)(`path`,{d:`M10.26 9.593c.225-.224.589-.224.814 0s.224.589 0 .813l-2.667 2.667c-.225.224-.589.224-.813 0l-2.666-2.667c-.225-.225-.225-.589 0-.813s.588-.224.813 0l2.26 2.26 2.261-2.26zM7.593 2.927c.225-.225.589-.225.813 0l2.667 2.666c.224.224.224.589 0 .813s-.589.225-.814 0L7.999 4.146 5.74 6.407c-.225.224-.588.224-.812 0s-.225-.589 0-.813l2.666-2.666z`})})}function sM({className:e,...t}){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:X(`stroke-2`,e),...t,children:(0,G.jsx)(`path`,{d:`M4.3 12.55 L9.25 17.5 L19.7 6.5`,pathLength:1,strokeDasharray:`1 2`,className:X(`opacity-0 [stroke-dashoffset:1.02]`,`group-data-selected/check:opacity-100 group-data-selected/check:[stroke-dashoffset:0]`,`motion-safe:transition-[opacity,stroke-dashoffset] motion-safe:ease-out`,`motion-safe:delay-[0ms,150ms] motion-safe:duration-[150ms,0ms]`,`motion-safe:group-data-selected/check:delay-[0ms] motion-safe:group-data-selected/check:duration-[0ms,300ms]`)})})}function cM(e){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`2 2 16 16`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,G.jsx)(`path`,{d:`M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z`})})}function lM(e){return e?e.lan.length>0?e.lan:e.public:[]}function uM(e){return!e||e.lan.length===0?[]:e.public}function dM(e){return e?.ipv6??[]}function fM(e,t){let n=Q(e===`lan`?`panel.address.lan`:e===`ipv6`?`panel.address.ipv6`:`panel.address.public`);return t?`${n} · ${t}`:n}function pM(e,t){return`http://${e.includes(`:`)?`[${e}]`:e}:${String(t??``)}`}function mM({book:e,port:t,value:n,busy:r=!1,onChange:i,fallbackUrls:a=[],align:o=`end`}){let s=o===`start`?`items-start`:`items-end`,c=o===`start`?`justify-start`:`justify-end`,l=o===`start`?`text-start`:`text-end`,u=String(t??``),d=lM(e),f=uM(e),p=dM(e),m=e&&e.lan.length>0?`lan`:`public`,h=d.some(e=>e.address===n)?n:d[0]?.address??``;return d.length===0?p.length===0&&a.length>0?(0,G.jsx)(`span`,{className:`flex flex-col gap-0.5 ${s}`,children:a.map(e=>(0,G.jsx)(`span`,{children:e},e))}):p.length===0?(0,G.jsx)(`span`,{className:`font-sans text-foreground-muted`,children:Q(`panel.address.empty`)}):(0,G.jsx)(`span`,{className:`flex w-full flex-col gap-1 ${s}`,children:p.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2 ${c}`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-foreground-muted`,children:pM(e.address,u)}),(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-foreground-subtle`,children:`${fM(`ipv6`,e.interface)}${Q(`panel.address.ipv6Hint`)}`})]},e.address))}):(0,G.jsxs)(`span`,{className:`flex w-full flex-col gap-1 ${s}`,children:[d.length>1?(0,G.jsx)(pA,{className:RE(`w-full gap-1`,s,r&&`pointer-events-none opacity-60`),value:h,onValueChange:e=>{typeof e==`string`&&e!==h&&i(e)},children:d.map(e=>(0,G.jsxs)(`label`,{className:`flex w-full cursor-pointer flex-wrap items-baseline gap-x-2 ${c}`,children:[(0,G.jsx)(Zk,{value:e.address,"aria-label":pM(e.address,u)}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:pM(e.address,u)}),(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-foreground-muted`,children:fM(m,e.interface)})]},e.address))}):(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2 ${c}`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:pM(d[0].address,u)}),(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-foreground-muted`,children:fM(m,d[0].interface)})]}),f.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2 ${c}`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-foreground-muted`,children:pM(e.address,u)}),(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-foreground-subtle`,children:`${fM(`public`,e.interface)}${Q(`panel.address.publicHint`)}`})]},e.address)),p.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2 ${c}`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-foreground-muted`,children:pM(e.address,u)}),(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-foreground-subtle`,children:Q(`panel.address.ipv6Pick`,{kind:fM(`ipv6`,e.interface)})})]},e.address)),d.length>1?(0,G.jsx)(`span`,{className:`font-sans text-xs text-foreground-muted ${l}`,children:Q(`panel.address.hint`)}):null]})}var hM=`data:image/png;base64,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`;function gM(e){return e.name===`GitHub`?(0,G.jsx)(CM,{}):e.name===`App Store`||e.name===`TestFlight`?(0,G.jsx)(SM,{}):(0,G.jsx)(wM,{})}function _M(e){return e===`android`?(0,G.jsx)(xM,{}):(0,G.jsx)(SM,{})}function vM({channel:e}){return(0,G.jsxs)(`a`,{className:`flex items-center gap-3 rounded-lg border border-border-muted px-3 py-2.5 transition-colors hover:bg-background-muted`,href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:[(0,G.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-background-muted text-foreground`,children:gM(e)}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{className:`text-sm text-foreground-intense`,children:e.name??(e.nameKey?Q(e.nameKey):``)}),(0,G.jsx)(`span`,{className:`truncate text-xs text-foreground-muted`,children:Q(e.hintKey)})]})]})}function yM(){return(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:pC.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-1.5 pb-0.5 text-xs text-foreground-muted`,children:[_M(e.platform),(0,G.jsx)(`span`,{children:Q(e.platform===`android`?`panel.links.android`:`panel.links.apple`)})]}),e.channels.map(e=>(0,G.jsx)(vM,{channel:e},e.url))]},e.platform))})}function bM({size:e=`md`,variant:t=`outline`,className:n}){let[r,i]=(0,g.useState)(!1),a=(0,g.useRef)(null);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Z,{variant:t,size:e,className:n,onClick:()=>i(!0),children:Q(`panel.download.open`)}),(0,G.jsx)(qf,{open:r,onOpenChange:i,children:(0,G.jsxs)(Jf,{className:`max-w-xl`,closeLabel:Q(`panel.common.close`),initialFocus:a,children:[(0,G.jsx)(Yf,{children:(0,G.jsxs)(Xf,{className:`flex flex-wrap items-center gap-2.5 pr-8`,children:[(0,G.jsx)(`img`,{src:hM,alt:``,className:`size-8 rounded-lg bg-white p-0.5`}),(0,G.jsx)(`span`,{className:`min-w-0 break-words`,children:Q(`panel.download.title`)})]})}),(0,G.jsx)(`div`,{ref:a,tabIndex:-1,className:`outline-none`,children:(0,G.jsx)(Qf,{children:(0,G.jsx)(yM,{})})})]})})]})}function xM(){return(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`size-3.5 stroke-0`,fill:`currentColor`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M17.523 15.3414c-.5511 0-.9993-.4486-.9993-.9997s.4483-.9993.9993-.9993c.5511 0 .9993.4483.9993.9993.0001.5511-.4482.9997-.9993.9997m-11.046 0c-.5511 0-.9993-.4486-.9993-.9997s.4482-.9993.9993-.9993c.551 0 .9993.4483.9993.9993 0 .5511-.4483.9997-.9993.9997m11.4045-6.02 1.9973-3.4592a.416.416 0 0 0-.1521-.5676.416.416 0 0 0-.5676.1521l-2.0223 3.503C15.5902 8.2439 13.8533 7.8508 12 7.8508s-3.5902.3931-5.1367 1.0989L4.841 5.4467a.4161.4161 0 0 0-.5677-.1521.4157.4157 0 0 0-.1521.5676l1.9973 3.4592C2.6889 11.1867.3432 14.6589 0 18.761h24c-.3435-4.1021-2.6892-7.5743-6.1185-9.4396`})})}function SM(){return(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`size-4 stroke-0`,fill:`currentColor`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701`})})}function CM(){return(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`size-[18px] stroke-0`,fill:`currentColor`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})})}function wM(){return(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`size-[18px]`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.85`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M12 4v10`}),(0,G.jsx)(`path`,{d:`m8 10.5 4 4 4-4`}),(0,G.jsx)(`path`,{d:`M4 18.5h16`})]})}function TM({on:e,what:t,label:n,className:r,disabled:i,onClick:a}){let o=n??Q(e?`panel.common.hide`:`panel.common.show`);return(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:r,"aria-label":`${o}${t}`,disabled:i,onClick:a,children:o})}function EM(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-6`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,G.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,G.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`}),(0,G.jsx)(`path`,{d:`M14 14h3v3M21 14v.01M14 21h.01M17 21h4v-4`})]})}function DM({status:e,pairing:t,addressBook:n,busy:r,error:i,restartError:a,onOpenConfig:o,onChangePolicy:s,onChangeTier:c,onChangeAutoReview:l,onOpenSelfCheck:u,onRetryPairing:d,onSavePreferred:f,onEditPort:p}){let m=r!==``,h=e.pairingPolicy===`code`,_=e.pairingTier??`full`,v=e.approvalAutoReview===!0,y=t?.relayUrl||e.relayUrl||`—`,b=OM(n,t),[x,S]=g.useState({relay:!1}),[C,w]=g.useState(!1),[T,E]=g.useState(!1),[D,O]=g.useState(!1),k=e=>S(t=>({...t,[e]:!t[e]}));return(0,G.jsxs)(uO,{frame:`solid`,children:[(0,G.jsx)(dO,{className:`flex-none px-4 py-3`,children:(0,G.jsxs)(fO,{className:`flex flex-wrap items-center justify-between gap-x-2 gap-y-1 text-base lg:text-lg`,children:[(0,G.jsx)(`span`,{children:Q(`panel.pairing.cardTitle`)}),(0,G.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2 xl:px-4 xl:before:border xl:before:border-border xl:before:bg-background`,disabled:m,onClick:o,children:Q(`panel.pairing.openConfig`)}),(0,G.jsx)(bM,{size:`sm`,variant:`ghost`,className:`px-2 xl:px-4 xl:before:border xl:before:border-border xl:before:bg-background`}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2`,onClick:()=>O(!0),children:Q(`panel.common.more`)})]})]})}),i?(0,G.jsxs)(ZD,{variant:`warning`,className:`mt-3`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.pairing.qrFailed`)}),(0,G.jsx)(tO,{children:i})]}):null,(0,G.jsxs)(`div`,{className:`mt-3 flex flex-col gap-4 sm:flex-row sm:items-stretch`,children:[(0,G.jsx)(`div`,{className:`relative mx-auto aspect-square w-full max-w-[200px] shrink-0 self-center sm:mx-0 sm:w-[150px] sm:max-w-none sm:self-start lg:w-auto lg:self-stretch`,children:t?.svg?(0,G.jsxs)(`button`,{type:`button`,className:`absolute inset-0 flex cursor-zoom-in flex-col items-center justify-center gap-2 rounded-md border border-border-muted bg-background-muted p-3 text-foreground-subtle transition-colors hover:bg-background-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>E(!0),"aria-label":`${Q(`panel.pairing.qrZoom`)}:${Q(`panel.pairing.qr`)}`,children:[(0,G.jsx)(EM,{}),(0,G.jsx)(`span`,{className:`text-xs`,children:Q(`panel.pairing.qrHidden`)}),(0,G.jsx)(`span`,{className:`text-xs`,children:Q(`panel.common.show`)})]}):(0,G.jsx)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 rounded-md border border-border-muted bg-background-muted p-3 text-foreground-subtle`,children:i?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-xs`,children:Q(`panel.pairing.qrFailed`)}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:m,onClick:d,children:Q(`panel.console.retryPairing`)})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(UD,{}),(0,G.jsx)(`span`,{className:`text-xs`,children:Q(`panel.pairing.noQr`)})]})})}),(0,G.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,G.jsx)(`div`,{className:`hscroll -mx-1 px-1`,children:(0,G.jsxs)(hk,{className:`min-w-max`,children:[(0,G.jsx)($,{label:Q(`panel.connection.relayUrl`),nowrap:!0,children:(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[x.relay?(0,G.jsx)(`span`,{className:`min-w-0 font-mono text-xs text-foreground-strong`,children:y}):(0,G.jsx)(`span`,{className:`text-xs text-foreground-subtle`,children:Q(`panel.pairing.hidden`)}),(0,G.jsx)(TM,{on:x.relay,what:Q(`panel.connection.relayUrl`),label:x.relay?Q(`panel.common.hide`):Q(`panel.common.show`),onClick:()=>k(`relay`)})]})}),(0,G.jsx)($,{label:Q(`panel.pairing.port`),mono:!0,nowrap:!0,children:(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[(0,G.jsxs)(`span`,{children:[t?.lanPort??e.lan.port,t?.lanPortAdjusted?(0,G.jsx)(`span`,{className:`ml-2 font-sans text-xs text-foreground-muted`,children:Q(`panel.pairing.portFallback`)}):null]}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,"aria-label":Q(`panel.pairing.portTitle`),disabled:m,onClick:p,children:Q(`panel.common.edit`)})]})}),(0,G.jsx)($,{label:Q(`panel.pairing.phoneAddress`),nowrap:!0,children:(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[b?null:(0,G.jsx)(`span`,{className:`text-xs text-foreground-subtle`,children:Q(`panel.pairing.noAddress`)}),(0,G.jsx)(TM,{on:!1,what:Q(`panel.pairing.phoneAddress`),label:Q(`panel.common.show`),onClick:()=>w(!0)})]})})]})})})]}),a?(0,G.jsxs)(ZD,{variant:`error`,className:`mt-3`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.pairing.sidecarRestartFailed`)}),(0,G.jsx)(tO,{children:a})]}):null,(0,G.jsx)(qf,{open:T,onOpenChange:E,children:(0,G.jsxs)(Jf,{className:`w-[min(680px,94vw)] max-h-[90vh] max-w-none`,closeLabel:Q(`panel.common.close`),children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.pairing.qr`)})}),(0,G.jsx)(Qf,{children:(0,G.jsx)(`div`,{className:`flex items-center justify-center overflow-auto rounded-md bg-white p-2 sm:p-4`,children:t?.svg?(0,G.jsx)(`div`,{className:`aspect-square h-[min(64vh,560px)] w-auto max-w-full [&_svg]:h-full [&_svg]:w-full`,dangerouslySetInnerHTML:{__html:t.svg}}):null})})]})}),(0,G.jsx)(qf,{open:C,onOpenChange:w,children:(0,G.jsxs)(Jf,{className:`max-w-xl`,closeLabel:Q(`panel.common.close`),children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.pairing.phoneAddress`)})}),(0,G.jsx)(Qf,{children:(0,G.jsx)(mM,{book:n,port:t?.lanPort??e.lan.port,value:n?.preferred??``,busy:m,onChange:f,fallbackUrls:t?.lanUrls??[]})}),(0,G.jsx)($f,{className:`flex justify-end`,children:(0,G.jsx)(Z,{variant:`outline`,onClick:()=>w(!1),children:Q(`panel.common.close`)})})]})}),(0,G.jsx)(qf,{open:D,onOpenChange:O,children:(0,G.jsxs)(Jf,{className:`max-w-md`,closeLabel:Q(`panel.common.close`),children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.common.more`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.pairing.policy`),children:(0,G.jsx)(VO,{size:`md`,checked:h,disabled:m,onCheckedChange:e=>s(e?`code`:`deny`),"aria-label":Q(`panel.devices.allowTitle`)})}),(0,G.jsx)($,{label:Q(`panel.pairing.tier`),hint:Q(`panel.pairing.tierHint`),children:(0,G.jsxs)(qj,{size:`sm`,value:_,disabled:m,itemToStringLabel:e=>AM(e),onValueChange:e=>{typeof e==`string`&&e!==_&&c(e)},children:[(0,G.jsx)(Yj,{className:`min-w-0 max-w-full`,"aria-label":Q(`panel.pairing.tier`),children:(0,G.jsx)(Xj,{})}),(0,G.jsx)(Qj,{children:kM.map(e=>(0,G.jsx)(iM,{value:e,children:AM(e)},e))})]})}),(0,G.jsx)($,{label:Q(`panel.pairing.autoReview`),hint:Q(`panel.pairing.autoReviewHint`),children:(0,G.jsx)(VO,{size:`sm`,checked:v,disabled:m,"aria-label":Q(`panel.pairing.autoReview`),onCheckedChange:e=>{e!==v&&l(e)}})})]}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Z,{variant:`outline`,size:`sm`,onClick:u,children:Q(`panel.pairing.checkNetwork`)})})]})]})})]})}function OM(e,t){return e&&e.lan.length+e.public.length>0?`book`:t?.lanUrls?.[0]??``}var kM=[`readonly`,`approve`,`full`];function AM(e){return Q(e===`readonly`?`panel.pairing.tierReadonly`:e===`approve`?`panel.pairing.tierApprove`:`panel.pairing.tierFull`)}var jM={ok:4e3,soft:6e3,error:9e3};function MM(){let e=(0,g.useRef)(pd());return e.current=pd(),(0,g.useCallback)((t,n)=>{e.current.add({title:n,type:t,timeout:jM[t],priority:t===`error`?`high`:`low`})},[])}function NM(e){return e===`none`?Q(`panel.devices.tierNone`):AM(e)}function PM(e){return e===`none`?`readonly`:e}function FM(e,t){if(!e)return``;let n=Math.max(0,t-e);if(n<6e4)return Q(`panel.devices.justNow`);let r=Math.floor(n/6e4);if(r<60)return Q(`panel.devices.minutesAgo`,{count:r});let i=Math.floor(r/60);return i<24?Q(`panel.devices.hoursAgo`,{count:i}):Q(`panel.devices.daysAgo`,{count:Math.floor(i/24)})}function IM(e,t){return e?LM(e,t)?Q(`panel.devices.online`):FM(e,t):Q(`panel.devices.noRecord`)}function LM(e,t){return e>0&&t-e<=3e5}function RM(e){return{ios:`iOS`,android:`Android`,linux:`Linux`,darwin:`macOS`,win32:`Windows`}[e]??(e||Q(`panel.devices.unknownPlatform`))}function zM(e){return Q(e===`relay`?`panel.devices.channelRelay`:e===`lan`?`panel.devices.channelLan`:`panel.devices.channelUnknown`)}function BM(e){let t=e?.model||e?.name||Q(`panel.devices.unknown`);return e?.suffix?`${t} · ${e.suffix}`:t}function VM(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M12 3l7 3v5c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6l7-3Z`}),(0,G.jsx)(`path`,{d:`m9 12 2 2 4-4`})]})}function HM(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M9 15l6-6`}),(0,G.jsx)(`path`,{d:`M7 17l-1 1a3 3 0 0 1-4-4l2-2a3 3 0 0 1 4 0`}),(0,G.jsx)(`path`,{d:`M17 7l1-1a3 3 0 0 1 4 4l-2 2a3 3 0 0 1-4 0`})]})}function UM({onRevokeAll:e,busy:t,fill:n=!1}){let r=MM(),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(`full`),[m,h]=(0,g.useState)(!1),_=(0,g.useRef)(!1),v=(0,g.useRef)(null),[y,b]=(0,g.useState)(!1),[x,S]=(0,g.useState)(null),[C,w]=(0,g.useState)(!1),T=(0,g.useRef)(0),E=(0,g.useCallback)(async()=>{let e=++T.current;w(!1);try{let t=await bA(`/api/relay/devices?history=1`);e===T.current&&S(t)}catch{e===T.current&&w(!0)}},[]),D=(0,g.useCallback)(async()=>{try{let e=await bA(`/api/relay/devices`),t=e.revokedCount??0,n=v.current!==null&&v.current!==t;v.current=t,a(e),n&&_.current&&E()}catch{}},[E]);(0,g.useEffect)(()=>{let e=()=>{xD()&&D()};e();let t=window.setInterval(e,3e3);return document.addEventListener(`visibilitychange`,e),()=>{window.clearInterval(t),document.removeEventListener(`visibilitychange`,e)}},[D]);let O=i?.devices??[],k=i?.serverNow??0,A=i?.revokedCount??0;(0,g.useEffect)(()=>{_.current=y},[y]),(0,g.useEffect)(()=>{y&&E()},[y,E]);function j(e){let t=FM(e.revokedAt||e.expiresAt,k)||`—`;return Q(e.kind===`revoked`?`panel.devices.historyRevoked`:`panel.devices.historyExpired`,{time:t})}let M=(x?.devices??[]).filter(e=>e.kind===`revoked`||e.kind===`expired`),N=C||(x?.devices.length??0)>0&&M.length===0;async function P(e){l(!0);try{let t=await xA(`/api/relay/devices/revoke`,{deviceId:e.deviceId});s(null),await D(),y&&E(),r(`soft`,Q(t.closed>0?`panel.devices.unbindDoneClosed`:`panel.devices.unbindDone`,{name:BM(e),count:t.revoked,closed:t.closed}))}catch(e){r(`error`,Q(`panel.devices.unbindFailed`,{message:wA(e)}))}finally{l(!1)}}async function F(e,t){h(!0);try{await CA(e.deviceId,t),d(null),await D(),r(`soft`,Q(`panel.devices.permissionsDone`,{name:BM(e),tier:AM(t)}))}catch(e){r(`error`,Q(`panel.devices.permissionsFailed`,{message:wA(e)}))}finally{h(!1)}}return O.length===0&&A===0?null:(0,G.jsxs)(uO,{frame:`solid`,className:n?`flex h-full min-h-0 flex-col`:void 0,children:[(0,G.jsx)(dO,{className:n?`flex-none px-4 py-3`:`px-4 py-3`,children:(0,G.jsxs)(fO,{className:`flex flex-wrap items-center justify-between gap-x-2 gap-y-1 text-base lg:text-lg`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[Q(`panel.devices.title`),O.length>0?(0,G.jsx)(iO,{variant:`secondary`,size:`sm`,children:O.length}):null]}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`shrink-0 px-2 xl:px-4 xl:before:border xl:before:border-border xl:before:bg-background`,disabled:t!==``,onClick:e,children:Q(`panel.pairing.revokeAll`)})]})}),(0,G.jsxs)(`div`,{className:n?`hvscroll mt-1 min-h-0 flex-1`:`hscroll mt-1`,children:[(0,G.jsx)(`div`,{className:`min-w-max`,children:O.map(e=>{let t=LM(e.lastSeenAt,k);return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border-muted py-2 whitespace-nowrap last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-foreground-strong`,children:BM(e)}),(0,G.jsx)(iO,{variant:`secondary`,size:`xs`,children:NM(mA(e.permissions))}),(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 whitespace-nowrap text-xs text-foreground-muted`,children:[(0,G.jsx)(`span`,{children:RM(e.platform)}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsx)(`span`,{children:zM(e.lastChannel)}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t?(0,G.jsx)(mk,{tone:`ok`}):null,(0,G.jsx)(`span`,{children:IM(e.lastSeenAt,k)})]})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,G.jsx)(Z,{variant:`ghost`,size:`icon-md`,"aria-label":Q(`panel.devices.permissions`),title:Q(`panel.devices.permissions`),onClick:()=>{p(PM(mA(e.permissions))),d(e)},children:(0,G.jsx)(VM,{})}),(0,G.jsx)(Z,{variant:`ghost`,size:`icon-md`,"aria-label":Q(`panel.devices.unbind`),title:Q(`panel.devices.unbind`),onClick:()=>s(e),children:(0,G.jsx)(HM,{})})]})]},e.deviceId)})}),(0,G.jsxs)(`div`,{className:`mt-1 border-t border-border-muted pt-2`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":y,className:`flex w-full cursor-pointer items-center justify-between gap-2 text-xs text-foreground-muted focus-visible:outline-none`,onClick:()=>b(e=>!e),children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[Q(`panel.devices.historyTitle`),(0,G.jsx)(iO,{variant:`secondary`,size:`xs`,children:Q(`panel.devices.historyCount`,{count:A})})]}),(0,G.jsx)(`svg`,{viewBox:`0 0 12 12`,className:`size-3 shrink-0 transition-transform ${y?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`m4.5 2.5 3.5 3.5-3.5 3.5`})})]}),y?(0,G.jsxs)(`div`,{className:`mt-2`,children:[M.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-foreground`,children:BM(e)}),(0,G.jsxs)(`span`,{className:`text-xs text-foreground-muted`,children:[RM(e.platform),e.osVersion?` ${e.osVersion}`:``,e.appVersion?Q(`panel.devices.appVersion`,{version:e.appVersion}):``]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-foreground-muted`,children:[(0,G.jsx)(`span`,{children:Q(`panel.devices.historyBoundAt`,{time:FM(e.boundAt,k)||`—`})}),(0,G.jsx)(`span`,{children:Q(`panel.devices.historyLastSeen`,{time:e.lastSeenAt?FM(e.lastSeenAt,k):Q(`panel.devices.noRecord`)})}),(0,G.jsx)(`span`,{children:j(e)})]})]},e.deviceId)),N?(0,G.jsx)(`p`,{className:`py-2 text-xs text-foreground-muted`,children:Q(`panel.devices.historyFailed`)}):null,(0,G.jsx)(`p`,{className:`py-2 text-xs text-foreground-muted`,children:Q(`panel.devices.historyRetention`,{days:30})})]}):null]})]}),(0,G.jsx)(Ek,{open:o!==null,onOpenChange:e=>{!e&&!c&&s(null)},children:(0,G.jsxs)(Dk,{children:[(0,G.jsx)(Ok,{children:(0,G.jsx)(kk,{children:Q(`panel.devices.unbindTitle`)})}),(0,G.jsxs)(jk,{className:`flex flex-col gap-2 text-sm`,children:[(0,G.jsx)(Ak,{children:Q(`panel.devices.unbindConfirm`,{name:BM(o)})}),(0,G.jsx)(`p`,{className:`text-foreground-muted`,children:Q(o?.legacy?`panel.devices.effectLegacy`:`panel.devices.effectIdentity`)})]}),(0,G.jsxs)(Mk,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,disabled:c,onClick:()=>s(null),children:Q(`panel.devices.cancel`)}),(0,G.jsx)(Z,{variant:`destructive`,disabled:c,onClick:()=>{o&&P(o)},children:c?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(UD,{}),Q(`panel.devices.unbinding`)]}):Q(`panel.devices.unbind`)})]})]})}),(0,G.jsx)(Ek,{open:u!==null,onOpenChange:e=>{!e&&!m&&d(null)},children:(0,G.jsxs)(Dk,{children:[(0,G.jsx)(Ok,{children:(0,G.jsx)(kk,{children:Q(`panel.devices.permissionsTitle`)})}),(0,G.jsxs)(jk,{className:`flex flex-col gap-3 text-sm`,children:[(0,G.jsx)(Ak,{children:Q(`panel.devices.permissionsHint`)}),(0,G.jsx)(pA,{className:`flex flex-col gap-2`,value:f,onValueChange:e=>{typeof e==`string`&&p(e)},children:kM.map(e=>(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2`,children:[(0,G.jsx)(Zk,{value:e}),(0,G.jsx)(`span`,{children:AM(e)})]},e))})]}),(0,G.jsxs)(Mk,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,disabled:m,onClick:()=>d(null),children:Q(`panel.devices.cancel`)}),(0,G.jsx)(Z,{variant:`secondary`,disabled:m,onClick:()=>{u&&F(u,f)},children:m?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(UD,{}),Q(`panel.devices.permissionsApply`)]}):Q(`panel.devices.permissionsApply`)})]})]})})]})}var WM=function(e){let t=qd(),[n,r]=g.useState(t),[i,a]=g.useState(),[o,s]=g.useState([]),c=n===void 0?t:n,l=y(()=>new Map),{messageIds:u}=AO(),d=J((e,t)=>{let n=l.current;t===void 0?n.delete(e):n.set(e,t),r(e=>{if(n.size===0)return e;let t;for(let r of n.values()){if(r===e)return e;t===void 0&&(t=r)}return t})}),f=J(()=>{l.current.size===0&&r(t)}),p=g.useCallback(e=>{let t=e[`aria-describedby`]?e[`aria-describedby`].split(` `):[];return t.push(...u,...o),{...e,"aria-describedby":Array.from(new Set(t)).join(` `)||void 0}},[u,o]),m=g.useMemo(()=>({controlId:c,registerControlId:d,resetControlId:f,labelId:i,setLabelId:a,messageIds:o,setMessageIds:s,getDescriptionProps:p}),[c,d,f,i,a,o,s,p]);return(0,G.jsx)(kO.Provider,{value:m,children:e.children})};function GM(e){let{change:t,commit:n,invalid:r,markedDirtyRef:i,name:a,setRegisteredFieldName:o,registeredFieldIdRef:s,setValidityData:c,validityData:l}=e,{formRef:u}=OO(),d=g.useRef(null),f=g.useRef(null),p=g.useRef(!1),m=J(()=>{let e=f.current;if(e)return e.getValue?e.getValue():e.value});function h(e){return e.value===void 0?m():e.value}let _=J(()=>{let e=f.current;if(i.current=!0,!e){n(l.value);return}n(h(e))});function v(){let e=f.current;e&&e.id&&u.current.fields.set(e.id,{getValue:m,name:a??e.name,controlRef:e.controlRef,validityData:nA(l,r),validate:_})}function y(e=f.current?.id){e&&u.current.fields.delete(e)}function x(e){if(p.current)return;p.current=!0;let t=h(e);c(e=>e.initialValue===t?e:{...e,initialValue:t})}return b(()=>{let e=f.current;e&&e.id&&(o(a?void 0:e.name),u.current.fields.set(e.id,{getValue:m,name:a??e.name,controlRef:e.controlRef,validityData:nA(l,r),validate:_}))},[u,m,r,a,o,_,l]),b(()=>{let e=u.current.fields;return()=>{let t=f.current?.id;t&&e.delete(t)}},[u]),[_,J((e,n)=>{if(!n){d.current===e&&(d.current=null,t(void 0,!0),y(),f.current=null,o(void 0),s.current=void 0);return}let r=f.current?.id,i=d.current;i&&i!==e&&t(void 0,!0),d.current=e,f.current=n,a||o(n.name),s.current=n.id,r&&r!==n.id&&y(r),x(n),v()})]}var KM=g.forwardRef(function(e,t){let{errors:n,validationMode:r,submitCountRef:i}=OO(),{render:a,className:o,validate:s,validationDebounceTime:c=0,validationMode:l=r,name:u,disabled:d=!1,invalid:f,dirty:p,touched:m,actionsRef:h,style:_,...v}=e,y=uA(!0)?.disabled,x=J(s||(()=>null)),S=y||d,[C,w]=g.useState(!1),[T,E]=g.useState(!1),[D,O]=g.useState(!1),[k,A]=g.useState(!1),j=p??T,M=m??C,N=g.useRef(j),P=g.useRef(void 0),[F,I]=g.useState(),L=u??F;b(()=>{p!==void 0&&(N.current=p)},[p]);let R=J(e=>{p===void 0&&(e&&(N.current=!0),E(e))}),z=J(e=>{m===void 0&&w(e)}),B=J(()=>l===`onChange`||l===`onSubmit`&&i.current>0),V=L&&Object.hasOwn(n,L)?n[L]:null,H=!!(Array.isArray(V)?V.length:V),U=f===!0||H,[W,ee]=g.useState({state:_O,error:``,errors:[],value:null,initialValue:null}),K=!U&&(S?null:W.state.valid),te=g.useMemo(()=>({disabled:S,touched:M,dirty:j,valid:K,filled:D,focused:k}),[S,M,j,K,D,k]),q=cA({setValidityData:ee,validate:x,validityData:W,validationDebounceTime:c,invalid:U,markedDirtyRef:N,state:te,shouldValidateOnChange:B,validationMode:l,registeredFieldIdRef:P}),[ne,re]=GM({change:q.change,commit:q.commit,invalid:U,markedDirtyRef:N,name:u,setRegisteredFieldName:I,registeredFieldIdRef:P,setValidityData:ee,validityData:W});g.useImperativeHandle(h,()=>({validate:ne}),[ne]);let ie=g.useMemo(()=>({invalid:U,name:L,validityData:W,setValidityData:ee,disabled:S,setTouched:z,setDirty:R,setFilled:O,setFocused:A,validationMode:l,shouldValidateOnChange:B,state:te,registerFieldControl:re,validation:q}),[U,L,W,S,z,R,O,A,l,B,te,re,q]),ae=Vr(`div`,e,{ref:t,state:te,props:v,stateAttributesMapping:yO});return(0,G.jsx)(wO.Provider,{value:ie,children:ae})}),qM=g.forwardRef(function(e,t){return(0,G.jsx)(WM,{children:(0,G.jsx)(KM,{...e,ref:t})})}),JM=g.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,nativeLabel:o=!0,...s}=e,c=TO(!1),l=Rk(),{labelId:u}=AO(),d={...c.state,disabled:c.disabled||l.disabled},f=g.useRef(null),p=tj({id:u??a,native:o});return Vr(`label`,e,{ref:[t,f],state:d,props:[p,s],stateAttributesMapping:yO})}),YM=g.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:_,setDirty:v,validityData:y,setFocused:x,setFilled:S,validationMode:C,validation:w}=TO(),{clearErrors:T,elementRef:E,submitCountRef:D}=OO(),O=h||s,k=m??a,A={...p,disabled:O},{labelId:j}=AO(),M=PO({id:i}),[N]=QC({controlled:o,default:l,name:`FieldControl`,state:`value`}),P=o!==void 0,F=P?N:void 0,I=F==null?void 0:String(F),L=J(()=>w.inputRef.current?.value);EO(w.inputRef,M,I,L,!O,a),b(()=>{let e=I??w.inputRef.current?.value;e!==void 0&&S(e!==``)},[I,w.inputRef,S]),zf(I,()=>{I!==void 0&&(T(k),v(I!==(y.initialValue??``)),w.change(I))});let R=g.useRef(null),z=Ge();return b(()=>{u&&R.current===lt(Le(R.current))&&x(!0)},[u,x]),Vr(`input`,e,{ref:[t,R],state:A,props:[{id:M,disabled:O,name:k,ref:w.inputRef,"aria-labelledby":j,autoFocus:u,...P?{value:F}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=ja(ma,e.nativeEvent);c?.(t,n),!P&&(v(t!==(y.initialValue??``)),S(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(T(k),w.change(t)))},onFocus(){x(!0)},onBlur(e){if(_(!0),x(!1),C===`onBlur`){let t=e.currentTarget.value;w.commit(t),P&&queueMicrotask(()=>{let e=w.inputRef.current?.value;e!==void 0&&e!==t&&e!==(y.initialValue??``)&&w.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){_(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===E.current&&!e.defaultPrevented){let t=e.currentTarget,n=D.current;z.start(0,()=>{D.current===n&&w.commit(t.value)})}else w.commit(t)}}},f,e=>w.getValidationProps(O,e)],stateAttributesMapping:yO})});function XM({className:e,...t}){return(0,G.jsx)(qM,{"data-slot":`field`,className:X(e),...t})}function ZM({className:e,...t}){return(0,G.jsx)(JM,{"data-slot":`field-label`,className:X(`text-foreground-intense mb-1.5 flex w-fit items-center text-sm font-medium select-none`,`data-disabled:opacity-disabled`,e),...t})}var QM={sm:`py-2`,md:`py-2.5`,lg:`py-3`},$M={sm:`min-h-16`,md:`min-h-20`,lg:`min-h-24`},eN={sm:`0.5rem`,md:`0.625rem`,lg:`0.75rem`};function tN(e,t){(Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,`value`)?.set)?.call(e,t),e.dispatchEvent(new Event(`input`,{bubbles:!0}))}function nN({className:e,variant:t=`outline`,inputSize:n=`md`,clearable:r,startSlot:i,endSlot:a,onClear:o,ref:s,rows:c=3,...l}){let u=g.useRef(null),d=Hu(s,u),f=!!(r||i||a),p=l[`aria-invalid`],m=p===!0||p===`true`,h=()=>{u.current&&l.value===void 0&&tN(u.current,``),u.current?.focus(),o?.()};return f?(0,G.jsxs)(`div`,{"data-slot":`textarea-wrapper`,"data-invalid":m?``:void 0,style:{"--textarea-h":`calc(${c} * 1lh + 2 * ${eN[n]} + 2px)`},className:X(Wj({variant:t,size:n,state:`within`}),`h-(--textarea-h) resize-y items-start overflow-hidden`,$M[n],QM[n],`has-[textarea:disabled]:border-border-strong! has-[textarea:disabled]:bg-background-subtle! has-[textarea:disabled]:opacity-disabled has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:border-dashed`,e),children:[i&&(0,G.jsx)(`div`,{"data-slot":`textarea-start`,className:`-ms-1 inline-flex h-lh shrink-0 items-center`,children:i}),(0,G.jsx)(YM,{"data-slot":`textarea`,ref:d,render:(0,G.jsx)(`textarea`,{rows:c}),placeholder:l.placeholder??` `,className:`peer text-foreground placeholder:text-foreground-subtle min-w-0 flex-1 resize-none self-stretch bg-transparent outline-none disabled:cursor-not-allowed`,...l}),r&&(0,G.jsx)(`button`,{"data-slot":`textarea-clear`,type:`button`,onClick:h,className:`text-foreground-subtle hover:text-foreground pointer-events-none inline-flex h-lh shrink-0 cursor-pointer items-center opacity-0 transition-[opacity,color] duration-200 peer-not-placeholder-shown:pointer-events-auto peer-not-placeholder-shown:opacity-100 motion-reduce:transition-none`,tabIndex:-1,"aria-label":`Clear input`,children:(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`2 2 16 16`,fill:`currentColor`,className:`size-[1em]`,children:(0,G.jsx)(`path`,{d:`M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z`})})}),a&&(0,G.jsx)(`div`,{"data-slot":`textarea-end`,className:`-me-1 inline-flex h-lh shrink-0 items-center`,children:a})]}):(0,G.jsx)(YM,{"data-slot":`textarea`,ref:d,render:(0,G.jsx)(`textarea`,{rows:c}),className:X(Wj({variant:t,size:n,state:`self`}),`placeholder:text-foreground-subtle h-auto resize-y`,QM[n],$M[n],e),...l,...m?{"data-invalid":``}:{}})}function rN(e){let t=typeof e==`string`?e:e instanceof vA?e.code:``,n={"credentials-unavailable":`errorAuth`,REMOTE_AUTH:`errorAuth`,REMOTE_REVOKED:`errorAuth`,REMOTE_EXPIRED:`errorExpired`,REMOTE_TIMEOUT:`errorTimeout`,REMOTE_CONNECT:`errorConnect`,REMOTE_INVITATION:`errorInvitation`,REMOTE_OPEN_URL:`invalidOpenUrl`,REMOTE_POPUP:`popupBlocked`,REMOTE_EXTERNAL_OPEN:`externalOpenFailed`,SHELL_UNAVAILABLE:`shellUnavailable`};return Q(n[t]?`panel.remote.${n[t]}`:`panel.remote.failed`)}var iN=`/api/relay/remote-computers`,aN={list:()=>bA(iN),invite:()=>xA(`${iN}/invite`,{}),add:e=>xA(`${iN}/add`,{invite:e}),open:e=>xA(`${iN}/open`,{id:e}),openShell:e=>xA(`${iN}/open-shell`,{id:e}),remove:e=>xA(`${iN}/remove`,{id:e}),mode:(e,t)=>xA(`${iN}/mode`,{id:e,mode:t}),revoke:e=>xA(`${iN}/revoke`,{deviceId:e})};function oN(e){return[`auto`,...new Set(e.map(e=>e.channel).filter(e=>e&&e!==`auto`))]}function sN(e){let t;try{t=new URL(e)}catch{throw new vA(Q(`panel.remote.invalidOpenUrl`),`REMOTE_OPEN_URL`,0)}if(t.protocol!==`http:`||t.hostname!==`127.0.0.1`||!t.port||t.username||t.password)throw new vA(Q(`panel.remote.invalidOpenUrl`),`REMOTE_OPEN_URL`,0);return t.href}function cN(e){return e instanceof vA?e.code===`SHELL_UNAVAILABLE`||e.status===404||e.status===405||e.status===0:e instanceof TypeError}async function lN(e){try{let t=await aN.openShell(e);return sN(t.url),t}catch(e){if(!cN(e))throw e}return uN(e)}async function uN(e){let t=window.location.protocol===`http:`||window.location.protocol===`https:`,n=t?window.open(`about:blank`,`_blank`):null;if(t&&!n)throw new vA(Q(`panel.remote.popupBlocked`),`REMOTE_POPUP`,0);try{n&&(n.opener=null);let t=await aN.open(e),r=sN(t.url);if(n)n.location.replace(r);else try{let e=window.top;if(!e||e.location.origin!==window.location.origin)throw Error(`origin`);e.location.href=r}catch{throw new vA(Q(`panel.remote.externalOpenFailed`),`REMOTE_EXTERNAL_OPEN`,0)}return t}catch(e){throw n?.close(),e}}function dN(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`13`,rx:`2`}),(0,G.jsx)(`path`,{d:`M8 21h8M12 17v4`})]})}function fN(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M4 7h16`}),(0,G.jsx)(`path`,{d:`M9 7V4.5A1.5 1.5 0 0 1 10.5 3h3A1.5 1.5 0 0 1 15 4.5V7`}),(0,G.jsx)(`path`,{d:`M6 7l1 12.5A2 2 0 0 0 9 21h6a2 2 0 0 0 2-1.5L18 7`}),(0,G.jsx)(`path`,{d:`M10 11v6M14 11v6`})]})}function pN(e){let t={auto:`auto`,lan:`lan`,direct:`direct`,ipv6:`ipv6`,relay:`relay`,tunnel:`tailcat`,tailcat:`tailcat`,p2p:`p2p`};return e?t[e]?Q(`panel.remote.channel.${t[e]}`):e:Q(`panel.common.none`)}function mN(){let e=MM(),[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)([]),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(null),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(null),[S,C]=(0,g.useState)(`auto`),[w,T]=(0,g.useState)(0),E=(0,g.useRef)(0),D=(0,g.useRef)(!1),O=(0,g.useRef)(!1),k=(0,g.useCallback)(async()=>{if(!D.current){D.current=!0;try{let e=await aN.list();if(!O.current)return;E.current=e.serverNow-Date.now(),T(e.serverNow),n(e),o(!1),c(``)}catch(e){if(!O.current)return;let t=e instanceof vA&&e.status===403;o(t),c(t?``:rN(e)),t&&n(null)}finally{D.current=!1,O.current&&i(!0)}}},[]);(0,g.useEffect)(()=>{O.current=!0;let e=()=>{xD()&&(T(Date.now()+E.current),k())};e();let t=window.setInterval(e,3e3);return document.addEventListener(`visibilitychange`,e),()=>{O.current=!1,window.clearInterval(t),document.removeEventListener(`visibilitychange`,e)}},[k]);let A=e=>l.includes(e),j=e=>l.some(t=>t.endsWith(`:${e}`));async function M(t,r,i){if(!l.includes(t)){u(e=>[...e,t]);try{await r(),i&&e(`ok`,Q(i)),await k()}catch(t){t instanceof vA&&t.status===403&&(o(!0),n(null),f(null),x(null),m(null)),e(`error`,t instanceof vA&&t.status===403?Q(`panel.remote.localOnly`):rN(t))}finally{u(e=>e.filter(e=>e!==t))}}}function N(){m(null),y(!1),f(`invite`),M(`invite`,async()=>{m(await aN.invite())})}async function P(){if(!(!p||p.expiresAt<=w))try{await navigator.clipboard.writeText(p.invite),y(!1),e(`ok`,Q(`panel.remote.copied`))}catch{y(!0)}}function F(e){M(`open:${e.id}`,()=>lN(e.id))}function I(e){window.confirm(Q(`panel.remote.removeConfirm`,{name:e.name||e.instanceId}))&&M(`remove:${e.id}`,()=>aN.remove(e.id),`panel.remote.removed`)}let L=t?.devices??[],R=t?.authorizedComputers??[],z=r&&!a&&t!==null,B=p!==null&&p.expiresAt<=w,V=d===`invite`?A(`invite`):d===`add`&&A(`add`),H=b!==null&&A(`mode:${b.id}`);return(0,G.jsxs)(uO,{frame:`solid`,className:`flex h-full min-h-0 flex-col`,children:[(0,G.jsx)(dO,{className:`flex-none px-4 py-3`,children:(0,G.jsxs)(fO,{className:`flex flex-wrap items-center justify-between gap-x-2 gap-y-1 text-base lg:text-lg`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{children:Q(`panel.remote.title`)}),L.length>0?(0,G.jsx)(iO,{variant:`secondary`,size:`sm`,children:L.length}):null]}),z?(0,G.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2 text-xs xl:px-4 xl:text-sm xl:before:border xl:before:border-border xl:before:bg-background`,disabled:A(`invite`),onClick:N,children:Q(`panel.remote.createInvite`)}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2 text-xs xl:px-4 xl:text-sm xl:before:border xl:before:border-border xl:before:bg-background`,disabled:A(`add`),onClick:()=>{_(``),f(`add`)},children:Q(`panel.remote.add`)})]}):null]})}),r?null:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-sm text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.shell.readingStatus`)]}),a?(0,G.jsx)(`p`,{className:`mt-2 text-sm text-foreground-muted`,children:Q(`panel.remote.localOnly`)}):null,s?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-error`,children:s}):null,z?(0,G.jsxs)(G.Fragment,{children:[L.length===0?(0,G.jsx)(`p`,{className:`mt-3 text-xs text-foreground-muted`,children:Q(`panel.remote.empty`)}):null,(0,G.jsx)(`div`,{className:`mt-1 flex min-h-0 flex-1 flex-col`,children:L.map(e=>{let t=e.expiresAt??0,n=e.state===`expired`||t>0&&t<=w,r=e.state===`revoked`?`revoked`:n?`expired`:e.state,i=e.attached&&e.state!==`revoked`,a=j(e.id);return(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col justify-between gap-2 border-b border-border-muted py-2 last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-sm text-foreground-strong`,children:e.name||e.instanceId}),(0,G.jsx)(iO,{variant:`secondary`,size:`xs`,children:Q(`panel.remote.state.${r}`)})]}),(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2 text-xs xl:px-2 xl:text-sm`,disabled:a,onClick:()=>{C(e.mode),x(e)},children:Q(`panel.remote.route`)}),i?(0,G.jsxs)(`span`,{className:`whitespace-nowrap px-1 text-xs text-foreground-muted`,children:[pN(e.mode),` · `,pN(e.channel),e.latencyMs!==null&&Number.isFinite(e.latencyMs)?` · ${Math.round(e.latencyMs)} ms`:``]}):(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2`,"aria-label":Q(`panel.remote.open`),disabled:a||e.state===`revoked`,onClick:()=>F(e),children:(0,G.jsx)(dN,{})}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2`,"aria-label":Q(`panel.remote.remove`),disabled:a,onClick:()=>I(e),children:(0,G.jsx)(fN,{})}),a?(0,G.jsx)(UD,{}):null]})]}),n&&e.state!==`revoked`?(0,G.jsx)(`p`,{className:`text-xs text-foreground-muted`,children:Q(`panel.remote.expiredHint`)}):null,e.lastError||e.lastErrorCode?(0,G.jsx)(`p`,{className:`text-xs break-all text-error`,children:rN(e.lastErrorCode)}):null]},e.id)})}),R.length>0?(0,G.jsxs)(`div`,{className:`mt-1 border-t border-border-muted pt-2`,children:[(0,G.jsx)(`p`,{className:`text-xs text-foreground-muted`,children:Q(`panel.remote.authorizedTitle`)}),R.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border-muted py-3 last:border-b-0`,children:[(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(`p`,{className:`truncate text-sm text-foreground-strong`,children:e.name||Q(`panel.remote.unknownComputer`)})}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,className:`px-2`,"aria-label":Q(`panel.remote.revoke`),disabled:A(`revoke:${e.deviceId}`),onClick:()=>{window.confirm(Q(`panel.remote.revokeConfirm`,{name:e.name||Q(`panel.remote.unknownComputer`)}))&&M(`revoke:${e.deviceId}`,()=>aN.revoke(e.deviceId),`panel.remote.revoked`)},children:(0,G.jsx)(fN,{})})]},e.deviceId))]}):null]}):null,(0,G.jsx)(qf,{open:d!==null,onOpenChange:e=>{!e&&!V&&(f(null),m(null))},children:(0,G.jsxs)(Jf,{className:`max-w-md`,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(d===`invite`?`panel.remote.createInvite`:`panel.remote.add`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-3`,children:[d===`invite`||d===`add`?(0,G.jsx)(`p`,{className:`text-xs leading-5 text-foreground-muted`,children:Q(d===`invite`?`panel.remote.inviteHint`:`panel.remote.addHint`)}):null,d===`invite`?p?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(XM,{children:[(0,G.jsx)(ZM,{htmlFor:`remote-computer-invite`,children:Q(`panel.remote.inviteLabel`)}),(0,G.jsx)(nN,{id:`remote-computer-invite`,rows:4,readOnly:!0,value:p.invite,onFocus:e=>e.target.select()})]}),(0,G.jsx)(`p`,{className:`text-xs text-foreground-muted`,children:Q(B?`panel.remote.inviteExpired`:`panel.remote.inviteRemaining`,{minutes:Math.max(0,Math.ceil((p.expiresAt-w)/6e4))})}),v?(0,G.jsx)(`p`,{role:`status`,className:`text-xs text-foreground-muted`,children:Q(`panel.remote.manualCopy`)}):null]}):V?(0,G.jsx)(UD,{}):null:(0,G.jsxs)(XM,{children:[(0,G.jsx)(ZM,{htmlFor:`remote-computer-add`,children:Q(`panel.remote.inviteLabel`)}),(0,G.jsx)(nN,{id:`remote-computer-add`,rows:4,value:h,onChange:e=>_(e.target.value),autoComplete:`off`,spellCheck:!1})]})]}),(0,G.jsxs)($f,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,disabled:V,onClick:()=>{f(null),m(null)},children:Q(`panel.common.close`)}),d===`invite`?(0,G.jsx)(Z,{variant:`primary`,disabled:V||!p||B,onClick:()=>void P(),children:Q(`panel.remote.copy`)}):(0,G.jsx)(Z,{variant:`primary`,disabled:V||!h.trim(),onClick:()=>void M(`add`,async()=>{await aN.add(h.trim()),_(``),f(null)},`panel.remote.added`),children:Q(`panel.remote.add`)})]})]})}),(0,G.jsx)(qf,{open:b!==null,onOpenChange:e=>{!e&&!H&&x(null)},children:(0,G.jsxs)(Jf,{className:`max-w-sm`,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.remote.route`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-3 text-sm`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-5 text-foreground-muted`,children:Q(`panel.remote.routeHint`)}),(0,G.jsx)(pA,{className:`flex flex-col gap-2`,value:S,onValueChange:e=>{typeof e==`string`&&C(e)},children:oN(b?.routes??[]).map(e=>(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2`,children:[(0,G.jsx)(Zk,{value:e}),(0,G.jsx)(`span`,{children:pN(e)})]},e))})]}),(0,G.jsxs)($f,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,disabled:H,onClick:()=>x(null),children:Q(`panel.common.cancel`)}),(0,G.jsx)(Z,{variant:`primary`,disabled:H||!oN(b?.routes??[]).includes(S),onClick:()=>{b&&M(`mode:${b.id}`,async()=>{await aN.mode(b.id,S),x(null)},`panel.remote.modeSaved`)},children:Q(`panel.common.save`)})]})]})})]})}function hN(e){let t=Number.isFinite(e)&&e>0?e:0;return t===0?`0 MB`:t<1048576?`${Math.max(1,Math.round(t/1024))} KB`:`${(t/1024/1024).toFixed(1)} MB`}function gN(e,t=Date.now()){if(!e)return``;let n=Math.floor((t-e)/36e5);return n<1?Q(`panel.inbox.ageLessThanHour`):n<24?Q(`panel.inbox.ageHours`,{hours:n}):Q(`panel.inbox.ageDays`,{days:Math.floor(n/24)})}function _N({framed:e=!0}){let t=MM(),[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(!1),u=(0,g.useCallback)(async()=>{try{r(await bA(`/api/relay/inbox/status`))}catch{r(null)}finally{a(!0)}},[]);(0,g.useEffect)(()=>{u()},[u]);let d=n?.deletableFiles??0,f=gN(n?.oldestAt??null),p=n?.stagingFiles??0;async function m(e){if(!c){l(!0);try{let t=await xA(`/api/relay/inbox/auto`,{enabled:e});r(e=>e&&{...e,autoClear:t.data.autoClear})}catch(e){t(`error`,Q(`panel.inbox.autoFailed`,{message:wA(e)}))}finally{l(!1)}}}async function h(){if(o)return;let e=d>0?Q(`panel.inbox.confirmDetail`,{count:d,hours:n?.keepHours??24,bytes:hN(n?.deletableBytes??0)}):Q(`panel.inbox.confirmNothing`,{hours:n?.keepHours??24});if(window.confirm(`${Q(`panel.inbox.confirmTitle`)}\n\n${e}\n\n${Q(`panel.inbox.confirmIrreversible`)}`)){s(!0);try{let e=await xA(`/api/relay/inbox/clear`),n=hN(e.freedBytes);t(e.failedFiles>0?`soft`:`ok`,e.deletedFiles>0?`${Q(`panel.inbox.cleared`,{bytes:n,count:e.deletedFiles})}${e.failedFiles>0?Q(`panel.inbox.clearedSomeFailed`,{count:e.failedFiles}):``}`:Q(`panel.inbox.nothingToClear`)),await u()}catch(e){t(`error`,Q(`panel.inbox.clearFailed`,{message:wA(e)}))}finally{s(!1)}}}let _=(0,G.jsxs)(G.Fragment,{children:[i?null:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-sm text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.inbox.reading`)]}),i&&n===null?(0,G.jsxs)(ZD,{variant:`info`,className:`mt-2`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.inbox.unreadableTitle`)}),(0,G.jsx)(tO,{children:Q(`panel.inbox.unreadableBody`)})]}):null,n===null?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`mt-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 border-b border-border-muted py-2`,children:[(0,G.jsx)(`dt`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.inbox.used`)}),(0,G.jsx)(`dd`,{className:`min-w-0 text-right text-sm break-all`,children:Q(`panel.inbox.usedValue`,{bytes:hN(n.bytes),count:n.files})})]}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 border-b border-border-muted py-2`,children:[(0,G.jsx)(`dt`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.inbox.deletable`)}),(0,G.jsx)(`dd`,{className:`min-w-0 text-right text-sm break-all`,children:d>0?Q(`panel.inbox.deletableValue`,{bytes:hN(n.deletableBytes),count:d}):Q(`panel.common.none`)})]}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-2`,children:[(0,G.jsx)(`dt`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.inbox.keep`)}),(0,G.jsx)(`dd`,{className:`min-w-0 text-right text-sm break-all`,children:f?Q(`panel.inbox.keepValueOldest`,{hours:n.keepHours,age:f}):Q(`panel.inbox.keepValue`,{hours:n.keepHours})})]})]}),p>0?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-foreground-muted`,children:Q(`panel.inbox.staging`,{bytes:hN(n.stagingBytes??0),count:n.stagingFiles??0})}):null,(0,G.jsxs)(`label`,{className:`mt-3 flex items-center justify-between gap-4 border-t border-border-muted pt-3`,children:[(0,G.jsx)(`span`,{className:`block text-sm text-foreground`,children:Q(`panel.inbox.auto`)}),(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[c?(0,G.jsx)(UD,{}):null,(0,G.jsx)(VO,{size:`md`,checked:n.autoClear===!0,disabled:o||c,onCheckedChange:e=>void m(e),"aria-label":Q(`panel.inbox.autoA11y`)})]})]}),(0,G.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,G.jsx)(Z,{variant:d>0?`primary`:`outline`,size:`md`,disabled:o,onClick:()=>void h(),children:Q(o?`panel.inbox.clearing`:`panel.inbox.clear`)})})]})]});return e?(0,G.jsxs)(uO,{frame:`solid`,children:[(0,G.jsx)(dO,{className:`px-4 py-3`,children:(0,G.jsx)(fO,{className:`flex items-center gap-2`,children:(0,G.jsx)(`span`,{children:Q(`panel.inbox.title`)})})}),_]}):_}var vN=`https://github.com/WNLUO/dsh-mobile-server`;function yN(){return[Q(`panel.notice.promptIntro`),``,`${Q(`panel.notice.promptRepo`)}: ${vN}`,``,Q(`panel.notice.promptAsk`),``,Q(`panel.notice.promptDo`),``,Q(`panel.notice.promptAfter`),``,Q(`panel.notice.promptStyle`)].join(`
|
|
26
26
|
`)}function bN({title:e,summary:t,children:n}){return(0,G.jsxs)(`details`,{className:`group rounded-lg border border-border-muted bg-background-muted`,children:[(0,G.jsxs)(`summary`,{className:`flex cursor-pointer list-none flex-col gap-0.5 px-3 py-2.5 marker:content-none`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground-strong`,children:[(0,G.jsx)(`svg`,{viewBox:`0 0 12 12`,className:`size-3 shrink-0 text-foreground-muted transition-transform group-open:rotate-90`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`m4.5 2.5 3.5 3.5-3.5 3.5`})}),e]}),(0,G.jsx)(`span`,{className:`pl-5 text-xs leading-5 text-foreground-muted`,children:t})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-2.5 border-t border-border-muted px-3 py-3`,children:n})]})}function xN({lines:e}){return(0,G.jsx)(`pre`,{className:`overflow-x-auto rounded bg-background-subtle px-2.5 py-2 font-mono text-[11px] leading-5 break-words whitespace-pre-wrap text-foreground-strong`,children:e.join(`
|
|
27
27
|
`)})}function SN({open:e,onOpenChange:t,port:n}){let r=(0,g.useRef)(null),[i,a]=(0,g.useState)(!1);async function o(){try{await navigator.clipboard.writeText(yN()),a(!0),window.setTimeout(()=>a(!1),2e3)}catch{a(!1)}}return(0,G.jsx)(qf,{open:e,onOpenChange:e=>{e||a(!1),t(e)},children:(0,G.jsxs)(Jf,{className:`w-[min(860px,92vw)] max-w-none`,closeLabel:Q(`panel.common.close`),initialFocus:r,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.notice.setupGuideTitle`)})}),(0,G.jsx)(`div`,{ref:r,tabIndex:-1,className:`flex min-h-0 flex-col outline-none`,children:(0,G.jsxs)(Qf,{className:`flex flex-col gap-3 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:[(0,G.jsxs)(bN,{title:Q(`panel.notice.guideRelayTitle`),summary:Q(`panel.notice.guideRelaySummary`),children:[(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground`,children:Q(`panel.notice.guideRelayReady`)}),(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground-muted`,children:Q(`panel.notice.guideRelayCopyHint`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>void o(),children:Q(`panel.notice.guideRelayCopy`)}),i?(0,G.jsx)(`span`,{className:`text-xs text-success`,children:Q(`panel.notice.guideRelayCopied`)}):null]}),(0,G.jsx)(`p`,{className:`rounded-md border border-border-muted bg-background px-2.5 py-2 text-xs leading-5 text-warning`,children:Q(`panel.notice.guideRelayWarn`)})]}),(0,G.jsxs)(bN,{title:Q(`panel.notice.guideTunnelTitle`),summary:Q(`panel.notice.guideTunnelSummary`),children:[(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground`,children:Q(`panel.notice.guideTunnelOS`)}),(0,G.jsx)(xN,{lines:[`# macOS`,`brew install cloudflared`,`# Linux`,`curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o cloudflared`,`chmod +x cloudflared && sudo mv cloudflared /usr/local/bin/`,`# Windows (PowerShell)`,`winget install --id Cloudflare.cloudflared`]}),(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground`,children:Q(`panel.notice.guideTunnelTry`)}),(0,G.jsx)(xN,{lines:[`cloudflared tunnel --url http://127.0.0.1:${n}`]}),(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground`,children:Q(`panel.notice.guideTunnelFixed`)}),(0,G.jsx)(xN,{lines:[`cloudflared tunnel login`,`cloudflared tunnel create dsh`,`cloudflared tunnel route dns dsh dsh.example.com`,`cloudflared tunnel run --url http://127.0.0.1:${n} dsh`]}),(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground-muted`,children:Q(`panel.notice.guideTunnelFill`)}),(0,G.jsx)(`p`,{className:`mt-1 border-t border-border-muted pt-3 text-sm font-semibold text-foreground-strong`,children:Q(`panel.notice.guideTailscaleTitle`)}),(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground`,children:Q(`panel.notice.guideTailscaleInstall`)}),(0,G.jsx)(xN,{lines:[`# macOS`,`brew install tailscale`,`# Linux`,`curl -fsSL https://tailscale.com/install.sh | sh`,`# Windows`,`winget install --id Tailscale.Tailscale`,`sudo tailscale up`]}),(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground`,children:Q(`panel.notice.guideTailscaleServe`)}),(0,G.jsx)(xN,{lines:[`tailscale serve --bg http://127.0.0.1:${n}`]}),(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground-muted`,children:Q(`panel.notice.guideTailscaleFill`)})]})]})})]})})}var CN=`0.4.9`;function wN({lanPort:e}){let[t,n]=(0,g.useState)(!1),[r,i]=(0,g.useState)(!1);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Z,{variant:`ghost`,size:`sm`,className:`gap-1.5`,onClick:()=>n(!0),children:[(0,G.jsx)(`span`,{children:Q(`panel.notice.title`)}),(0,G.jsx)(`span`,{className:`text-xs text-foreground-muted`,children:`${Q(`panel.notice.versionLabel`)} ≥ ${CN}`})]}),(0,G.jsx)(qf,{open:t,onOpenChange:n,children:(0,G.jsxs)(Jf,{className:`max-w-md`,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.notice.title`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-1`,children:[(0,G.jsx)(`span`,{className:`text-sm text-foreground-muted`,children:Q(`panel.notice.versionLabel`)}),(0,G.jsx)(iO,{variant:`warning`,size:`sm`,children:`≥ ${CN}`})]}),(0,G.jsxs)(`p`,{className:`flex items-start gap-2 text-sm leading-5 text-foreground-muted`,children:[(0,G.jsx)(`span`,{className:`flex h-5 shrink-0 items-center`,children:(0,G.jsx)(mk,{tone:`warn`})}),(0,G.jsx)(`span`,{className:`min-w-0`,children:Q(`panel.notice.effective`)})]}),(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground-muted`,children:Q(`panel.notice.body`,{version:CN})})]}),(0,G.jsxs)(`section`,{className:`flex flex-col gap-1.5 border-t border-border-muted pt-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-1`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-foreground-strong`,children:Q(`panel.notice.selfHostTitle`)}),(0,G.jsx)(`button`,{type:`button`,className:`cursor-pointer text-sm text-foreground-intense underline underline-offset-2 hover:text-foreground-strong`,onClick:()=>{n(!1),i(!0)},children:Q(`panel.notice.selfHostAction`)})]}),(0,G.jsx)(`p`,{className:`text-sm leading-6 text-foreground-muted`,children:Q(`panel.notice.selfHostBody`)})]})]})]})}),(0,G.jsx)(SN,{open:r,onOpenChange:i,port:e})]})}function TN(e){return e.available?e.enabled?e.path===`direct`&&e.active?`panel.p2p.open`:e.error?`panel.p2p.error`:e.path===`failed`?`panel.p2p.blocked`:e.ready?e.path===`waiting`?`panel.p2p.waiting`:`panel.p2p.punching`:e.started?`panel.p2p.punching`:`panel.p2p.waiting`:`panel.p2p.disabled`:`panel.p2p.unavailable`}function EN(e){return e.length>16?`${e.slice(0,12)}…${e.slice(-4)}`:e}function DN({open:e,onOpenChange:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),o=(0,g.useCallback)(async()=>{try{let e=await bA(`/api/relay/p2p`);r(e.status??null),a(``)}catch(e){a(wA(e))}},[]);(0,g.useEffect)(()=>{if(!e)return;let t=()=>{xD()&&o()};t();let n=window.setInterval(t,2e3);return document.addEventListener(`visibilitychange`,t),()=>{window.clearInterval(n),document.removeEventListener(`visibilitychange`,t)}},[e,o]);let s=n;return(0,G.jsx)(qf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Jf,{className:`max-w-md`,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.p2p.title`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-5 text-foreground-muted`,children:Q(`panel.p2p.hint`)}),i?(0,G.jsx)(`p`,{className:`text-xs text-error`,children:i}):null,s===null?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-sm text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.shell.readingStatus`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 border-b border-border-muted py-2`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.p2p.stateLabel`)}),(0,G.jsxs)(`span`,{className:`min-w-0 text-right text-sm break-all`,children:[Q(TN(s)),s.error?(0,G.jsx)(`span`,{className:`ml-1 text-xs text-foreground-muted`,children:s.error}):null]})]}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 border-b border-border-muted py-2`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.p2p.addressLabel`)}),(0,G.jsx)(`span`,{className:`min-w-0 text-right font-mono text-xs break-all text-foreground-strong`,children:s.url||Q(`panel.p2p.noAddress`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-border-muted py-2`,children:[(0,G.jsxs)(`span`,{className:`text-sm text-foreground-muted`,children:[Q(`panel.p2p.candidatesLabel`),` (`,s.candidates.length,`)`]}),s.candidates.length===0?(0,G.jsx)(`span`,{className:`text-xs text-foreground-muted`,children:Q(`panel.p2p.noCandidates`)}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-1`,children:s.candidates.map(e=>(0,G.jsx)(`li`,{className:`font-mono text-xs break-all text-foreground-strong`,children:e},e))})]}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-2`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.p2p.keyLabel`)}),(0,G.jsx)(`span`,{className:`min-w-0 text-right font-mono text-xs break-all text-foreground-strong`,children:s.publicKey?EN(s.publicKey):Q(`panel.p2p.noKey`)})]})]})]}),(0,G.jsx)($f,{className:`flex justify-end gap-2`,children:(0,G.jsx)(Z,{variant:`outline`,onClick:()=>t(!1),children:Q(`panel.common.close`)})})]})})}var ON=g.forwardRef(function(e,t){return(0,G.jsx)(YM,{ref:t,...e})});function kN(e,t){(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`)?.set)?.call(e,t),e.dispatchEvent(new Event(`input`,{bubbles:!0}))}function AN({className:e,variant:t=`outline`,inputSize:n=`md`,clearable:r,startSlot:i,endSlot:a,onClear:o,inputProps:s,ref:c,...l}){let u=g.useRef(null),d=!!(r||i||a),f=l[`aria-invalid`],p=f===!0||f===`true`,m=Hu(c,u),h=()=>{u.current&&l.value===void 0&&kN(u.current,``),u.current?.focus(),o?.()};return d?(0,G.jsxs)(`div`,{"data-slot":`input-wrapper`,className:X(Wj({variant:t,size:n,state:`within`}),e),...p?{"data-invalid":``}:{},children:[i&&(0,G.jsx)(`div`,{"data-slot":`input-start`,className:`-ms-1 flex shrink-0 items-center`,children:i}),(0,G.jsx)(ON,{"data-slot":`input`,ref:m,placeholder:l.placeholder??` `,...s,className:X(`peer text-foreground placeholder:text-foreground-subtle h-full min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed`,s?.className),...l}),r&&(0,G.jsx)(`button`,{"data-slot":`input-clear`,type:`button`,onClick:h,className:`text-foreground-subtle hover:text-foreground pointer-events-none shrink-0 cursor-pointer opacity-0 transition-[opacity,color] duration-200 peer-not-placeholder-shown:pointer-events-auto peer-not-placeholder-shown:opacity-100`,tabIndex:-1,"aria-label":`Clear input`,children:(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`2 2 16 16`,fill:`currentColor`,className:`size-[1em]`,children:(0,G.jsx)(`path`,{d:`M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z`})})}),a&&(0,G.jsx)(`div`,{"data-slot":`input-end`,className:`-me-1 flex shrink-0 items-center`,children:a})]}):(0,G.jsx)(ON,{"data-slot":`input`,ref:m,...s,className:X(Wj({variant:t,size:n,state:`self`}),`placeholder:text-foreground-subtle`,s?.className,e),...l,...p?{"data-invalid":``}:{}})}var jN=1024,MN=65535;function NN({open:e,onOpenChange:t,port:n,busy:r,onSave:i}){let[a,o]=(0,g.useState)(String(n));(0,g.useEffect)(()=>{e&&o(String(n))},[e]);let s=a.trim(),c=Number(s),l=s!==``&&Number.isInteger(c)&&c>=jN&&c<=MN&&r===``;return(0,G.jsx)(qf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Jf,{className:`max-w-sm`,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.pairing.portTitle`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(XM,{children:[(0,G.jsx)(ZM,{htmlFor:`relay-lan-port`,children:Q(`panel.pairing.port`)}),(0,G.jsx)(AN,{inputProps:{id:`relay-lan-port`,inputMode:`numeric`},value:a,onChange:e=>o(e.target.value)})]}),(0,G.jsx)(`p`,{className:`text-xs text-foreground-muted`,children:Q(`panel.pairing.portHint`)})]}),(0,G.jsxs)($f,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,disabled:r!==``,onClick:()=>t(!1),children:Q(`panel.common.cancel`)}),(0,G.jsx)(Z,{variant:`primary`,disabled:!l,onClick:()=>i(c),children:Q(`panel.common.save`)})]})]})})}function PN({open:e,onOpenChange:t,status:n,addressBook:r,lanUrls:i,busy:a,onSave:o,onSavePreferred:s}){let[c,l]=(0,g.useState)(n.relayUrl),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(``),[m,h]=(0,g.useState)(``),[_,v]=(0,g.useState)(``),[y,b]=(0,g.useState)(!1),[x,S]=(0,g.useState)(!1),C=(0,g.useRef)(null),w=(0,g.useRef)(null),T=(0,g.useRef)(null),E=(0,g.useRef)(!1),D=(0,g.useRef)(!1),O=(0,g.useRef)(!1),k=r?r.lan.length>0?r.lan:r.public:[];(0,g.useEffect)(()=>{e&&l(n.relayUrl)},[e]),(0,g.useEffect)(()=>{e||(b(!1),S(!1))},[e]),(0,g.useEffect)(()=>{if(!e){E.current=!1,D.current=!1,O.current=!1,v(``);return}if(E.current||d(r?.manual??``),D.current||p(r?.manualIpv6??``),!O.current){let e=r?r.lan.length>0?r.lan:r.public:[];h((r?.preferred||``).trim()||(e[0]?.address??``))}},[e,r]);let A=a===``,j=e=>e.trim().replace(/\/+$/,``);function M(){if(!A)return;let e={};c.trim()!==n.relayUrl&&(e.relayUrl=c.trim());let t=j(u);t!==j(r?.manual??``)&&(e.manualLanUrl=t);let i=j(f);i!==j(r?.manualIpv6??``)&&(e.manualIpv6Url=i);let a=m.trim();if(O.current&&a!==(r?.preferred??``).trim()){if(a&&!k.some(e=>e.address===a)){v(Q(`panel.address.lanUnknown`));return}e.preferredLanAddress=a}o(e)}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(qf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Jf,{className:`w-[min(1100px,92vw)]`,initialFocus:T,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.pairing.openConfig`)})}),(0,G.jsx)(`div`,{ref:T,tabIndex:-1,className:`outline-none`,children:(0,G.jsxs)(Qf,{className:`grid max-h-[calc(100vh-13rem)] grid-cols-2 items-start gap-x-8 overflow-y-auto`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(XM,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-1`,children:[(0,G.jsx)(ZM,{htmlFor:`relay-url`,children:Q(`panel.connection.relayUrl`)}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:()=>b(!0),children:Q(`panel.relay.choosePublicRelay`)})]}),(0,G.jsx)(AN,{inputProps:{id:`relay-url`,className:`font-mono`},value:c,placeholder:`https://example.com`,onChange:e=>l(e.target.value)})]}),(0,G.jsxs)(XM,{children:[(0,G.jsx)(ZM,{htmlFor:`relay-manual-lan`,children:Q(`panel.address.direct`)}),(0,G.jsx)(AN,{inputProps:{id:`relay-manual-lan`,className:`font-mono`},value:u,placeholder:Q(`panel.address.directPlaceholder`),onChange:e=>{E.current=!0,d(e.target.value)}})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(XM,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-1`,children:[(0,G.jsx)(ZM,{htmlFor:`relay-preferred-lan`,children:Q(`panel.address.lan`)}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:()=>S(!0),children:Q(`panel.onboarding.chooseAddress`)})]}),(0,G.jsx)(AN,{inputProps:{id:`relay-preferred-lan`,className:`font-mono`,list:`relay-lan-candidates`},value:m,placeholder:Q(`panel.address.lanPlaceholder`),onChange:e=>{O.current=!0,v(``),h(e.target.value)}}),(0,G.jsx)(`datalist`,{id:`relay-lan-candidates`,children:k.map(e=>(0,G.jsx)(`option`,{value:e.address,children:e.url},e.address))}),_?(0,G.jsx)(`p`,{className:`text-xs text-error`,children:_}):null]}),(0,G.jsxs)(XM,{children:[(0,G.jsx)(ZM,{htmlFor:`relay-manual-ipv6`,children:Q(`panel.address.ipv6Url`)}),(0,G.jsx)(AN,{inputProps:{id:`relay-manual-ipv6`,className:`font-mono`},value:f,placeholder:Q(`panel.address.ipv6Placeholder`),onChange:e=>{D.current=!0,p(e.target.value)}})]})]})]})}),(0,G.jsxs)($f,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,disabled:a===`config`,onClick:()=>t(!1),children:Q(`panel.common.cancel`)}),(0,G.jsx)(Z,{variant:`primary`,disabled:!A,onClick:M,children:Q(`panel.relay.saveConfig`)})]})]})}),(0,G.jsx)(qf,{open:y,onOpenChange:b,children:(0,G.jsxs)(Jf,{className:`w-[min(560px,92vw)]`,initialFocus:C,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.onboarding.publicRelay`)})}),(0,G.jsx)(`div`,{ref:C,tabIndex:-1,className:`outline-none`,children:(0,G.jsx)(Qf,{className:`flex max-h-[60vh] flex-col gap-0.5 overflow-y-auto`,children:mC.map(e=>{let t=c.trim()===e.url;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{l(e.url),b(!1)},className:`flex w-full items-baseline justify-between gap-3 rounded px-2 py-1.5 text-left ${t?`bg-background-muted`:`hover:bg-background-muted`}`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e.url}),(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-foreground-muted`,children:Q(t?`panel.relay.selected`:e.nameKey)})]},e.url)})})}),(0,G.jsxs)($f,{className:`flex justify-between gap-2`,children:[(0,G.jsx)(Z,{variant:`ghost`,disabled:c.trim()===``,onClick:()=>{l(``),b(!1)},children:Q(`panel.relay.clear`)}),(0,G.jsx)(Z,{variant:`outline`,onClick:()=>b(!1),children:Q(`panel.common.close`)})]})]})}),(0,G.jsx)(qf,{open:x,onOpenChange:S,children:(0,G.jsxs)(Jf,{className:`w-[min(560px,92vw)]`,initialFocus:w,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.address.lan`)})}),(0,G.jsx)(`div`,{ref:w,tabIndex:-1,className:`outline-none`,children:(0,G.jsx)(Qf,{className:`max-h-[60vh] overflow-y-auto px-1 py-2`,children:(0,G.jsx)(mM,{align:`start`,book:r,port:n.lan.port,value:r?.preferred??``,busy:a!==``,fallbackUrls:i,onChange:e=>{s(e),S(!1)}})})}),(0,G.jsx)($f,{className:`flex justify-end`,children:(0,G.jsx)(Z,{variant:`outline`,onClick:()=>S(!1),children:Q(`panel.common.close`)})})]})})]})}var FN=18e5,IN=3e5,LN=15e3,RN=null,zN=0,BN=0,VN=null;function HN(e){return typeof e!=`number`||!Number.isFinite(e)?!1:e===0||Date.now()-e>FN}function UN(e){if(!e&&VN)return VN;let t=(async()=>{let t=await bA(e?`/api/relay/selfcheck?force=1`:`/api/relay/selfcheck`);return RN=t,zN=Date.now(),t})();return e||(VN=t,t.finally(()=>{VN===t&&(VN=null)})),t}function WN(e,t=``){let[n,r]=(0,g.useState)(RN),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(!1),u=(0,g.useRef)(!0);(0,g.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let d=(0,g.useCallback)(async e=>{if(!e&&RN&&Date.now()-zN<LN){r(RN);return}a(!0);try{let t=await UN(e);if(!u.current)return;r(t),s(``),l(!1)}catch(e){if(!u.current)return;l(e instanceof vA&&e.status===404),s(wA(e))}finally{u.current&&a(!1)}},[]);(0,g.useEffect)(()=>{e&&(Date.now()-BN<IN||RN&&Date.now()-zN<LN||(BN=Date.now(),d(!1)))},[e,d]);let f=(0,g.useRef)(null);return(0,g.useEffect)(()=>{if(t){if(f.current===null){f.current=t;return}f.current!==t&&(f.current=t,d(!0))}},[t,d]),{data:n,checking:i,error:o,missing:c,ensure:(0,g.useCallback)(()=>void d(!1),[d]),refresh:(0,g.useCallback)(()=>void d(!0),[d])}}function GN(e){return e===`ok`?`ok`:e===`unknown`?`warn`:`error`}var KN={ok:{long:`panel.selfcheck.verdict.ok`,short:`panel.selfcheck.short.ok`},"not-listening":{long:`panel.selfcheck.verdict.notListening`,short:`panel.selfcheck.short.notListening`},"firewall-blocked":{long:`panel.selfcheck.verdict.firewallBlocked`,short:`panel.selfcheck.short.firewallBlocked`},unknown:{long:`panel.selfcheck.verdict.unknown`,short:`panel.selfcheck.short.unknown`},network:{long:`panel.selfcheck.verdict.network`,short:`panel.selfcheck.short.network`}};function qN(e){return Q(KN[e]?.long??`panel.selfcheck.verdict.unknown`)}function JN(e){if(!e)return{tone:`off`,text:Q(`panel.selfcheck.notChecked`)};let t=e.firewall,n=ZN(t.appPath);return!t.supported||t.enabled===null?{tone:`warn`,text:Q(`panel.selfcheck.unknown`)}:t.enabled===!1?{tone:`ok`,text:Q(`panel.selfcheck.firewallOff`),...n?{detail:n}:{}}:t.allowsApp===!1?{tone:`error`,text:Q(`panel.selfcheck.blocked`),...n?{detail:n}:{}}:t.allowsApp===!0?{tone:`ok`,text:Q(`panel.selfcheck.allowed`),...n?{detail:n}:{}}:{tone:`warn`,text:Q(`panel.selfcheck.unknown`)}}function YN(e,t){let n=typeof e?.mobile?.lastMobileAt==`number`?e.mobile.lastMobileAt:t;return typeof n!=`number`||!Number.isFinite(n)?{tone:`off`,text:Q(`panel.selfcheck.notChecked`)}:n===0?{tone:`warn`,text:Q(`panel.selfcheck.mobileNever`)}:(typeof e?.mobile?.idle==`boolean`?e.mobile.idle:HN(n))?{tone:`warn`,text:Q(`panel.selfcheck.mobileIdle`),detail:VE(n)}:{tone:`ok`,text:Q(`panel.selfcheck.mobileRecent`),detail:VE(n)}}function XN(e){let t={listening:`panel.lan.listening`,off:`panel.status.off`,error:`panel.lan.error`};return t[e]?Q(t[e]):e}function ZN(e){let t=String(e??``).trim();if(!t)return``;let n=t.split(/[\\/]/);return n[n.length-1]??``}function QN({open:e,onOpenChange:t,state:n,lastMobileAt:r}){(0,g.useEffect)(()=>{e&&n.ensure()},[e,n.ensure]);let i=n.data,a=JN(i),o=YN(i,r),s=i?GN(i.verdict):`warn`;return(0,G.jsx)(qf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Jf,{className:`max-w-xl`,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.selfcheck.title`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-3`,children:[n.error?(0,G.jsxs)(ZD,{variant:n.missing?`warning`:`error`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:n.missing?Q(`panel.selfcheck.unavailable`):Q(`panel.selfcheck.failed`)}),n.missing?null:(0,G.jsx)(tO,{children:n.error})]}):null,i?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:RE(`text-sm`,s===`ok`?`text-foreground`:BE[s]),children:qN(i.verdict)}),(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.connection.lan`),children:(0,G.jsx)(gk,{tone:i.listening.state===`listening`?`ok`:i.listening.state===`error`?`error`:`off`,text:XN(i.listening.state),detail:Q(`panel.selfcheck.port`,{port:i.listening.port})})}),(0,G.jsx)($,{label:Q(`panel.connection.tunnel`),children:(0,G.jsx)(gk,{tone:HE(i.tunnel.state),text:UE(i.tunnel.state)})}),(0,G.jsx)($,{label:Q(`panel.selfcheck.firewall`),children:(0,G.jsx)(gk,{tone:a.tone,text:a.text,detail:a.detail})}),(0,G.jsx)($,{label:Q(`panel.selfcheck.mobile`),children:(0,G.jsx)(gk,{tone:o.tone,text:o.text,detail:o.detail})})]}),(0,G.jsx)(`p`,{className:`text-xs text-foreground-muted`,children:Q(`panel.selfcheck.checkedAt`,{time:VE(i.checkedAt)})})]}):n.checking?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-sm text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.selfcheck.checking`)]}):null]}),(0,G.jsxs)($f,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,onClick:()=>t(!1),children:Q(`panel.common.close`)}),(0,G.jsx)(Z,{variant:`primary`,disabled:n.checking,onClick:n.refresh,children:n.checking?Q(`panel.selfcheck.checking`):Q(`panel.selfcheck.recheck`)})]})]})})}function $N(e){return e.available?e.enabled?e.error?`panel.tailcat.error`:e.ready?`panel.tailcat.ready`:`panel.tailcat.starting`:`panel.tailcat.disabled`:`panel.tailcat.unavailable`}function eP(e){return e.length>16?`${e.slice(0,12)}…${e.slice(-4)}`:e}function tP({open:e,onOpenChange:t,onChanged:n}){let r=MM(),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(``),u=(0,g.useCallback)(async()=>{try{a(await bA(`/api/relay/tailcat`)),s(``)}catch(e){s(wA(e))}},[]);(0,g.useEffect)(()=>{if(!e)return;let t=()=>{xD()&&u()};t();let n=window.setInterval(t,2e3);return document.addEventListener(`visibilitychange`,t),()=>{window.clearInterval(n),document.removeEventListener(`visibilitychange`,t)}},[e,u]);let d=(0,g.useCallback)(async(e,t,i)=>{l(e);try{a(await t()),r(`soft`,i),n?.()}catch(e){r(`error`,wA(e))}finally{l(``)}},[r,n]),f=e=>void d(`toggle`,()=>xA(`/api/relay/tailcat/enabled`,{enabled:e}),Q(e?`panel.tailcat.enabledToast`:`panel.tailcat.disabledToast`)),p=e=>{window.confirm(Q(`panel.tailcat.revokeConfirm`))&&d(`revoke`,()=>xA(`/api/relay/tailcat/revoke`,{client:e}),Q(`panel.tailcat.revokedToast`))},m=i?.status??null,h=i?.allowedClients??[];return(0,G.jsx)(qf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Jf,{className:`max-w-md`,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.tailcat.title`)})}),(0,G.jsxs)(Qf,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-5 text-foreground-muted`,children:Q(`panel.tailcat.hint`)}),o?(0,G.jsx)(`p`,{className:`text-xs text-error`,children:o}):null,i===null?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-sm text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.shell.readingStatus`)]}):m===null?(0,G.jsx)(`p`,{className:`text-sm text-foreground-muted`,children:Q(`panel.tailcat.unavailable`)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 border-b border-border-muted py-2`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.tailcat.title`)}),(0,G.jsxs)(`span`,{className:`min-w-0 text-right text-sm break-all`,children:[Q($N(m)),m.error?(0,G.jsx)(`span`,{className:`ml-1 text-xs text-foreground-muted`,children:m.error}):null]})]}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 border-b border-border-muted py-2`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-sm text-foreground-muted`,children:Q(`panel.tailcat.addressLabel`)}),(0,G.jsx)(`span`,{className:`min-w-0 text-right font-mono text-xs break-all text-foreground-strong`,children:m.address||Q(`panel.tailcat.noAddress`)})]}),(0,G.jsxs)(`label`,{className:`flex items-center justify-between gap-4 border-b border-border-muted py-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-foreground-muted`,children:Q(`panel.tailcat.enableLabel`)}),(0,G.jsx)(VO,{size:`md`,checked:m.enabled,disabled:!m.available||c!==``,onCheckedChange:e=>f(e),"aria-label":Q(`panel.tailcat.enableLabel`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsxs)(`span`,{className:`text-sm text-foreground-muted`,children:[Q(`panel.tailcat.pairedLabel`),` (`,m.paired,`)`]}),h.length===0?(0,G.jsx)(`span`,{className:`text-xs text-foreground-muted`,children:Q(`panel.tailcat.noClients`)}):(0,G.jsx)(`ul`,{className:`flex flex-col`,children:h.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3 border-b border-border-muted py-1.5 last:border-b-0`,children:[(0,G.jsx)(`span`,{className:`min-w-0 font-mono text-xs break-all text-foreground-strong`,children:eP(e)}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:c!==``,onClick:()=>p(e),children:Q(`panel.tailcat.revoke`)})]},e))})]})]})]}),(0,G.jsx)($f,{className:`flex justify-end gap-2`,children:(0,G.jsx)(Z,{variant:`outline`,disabled:c!==``,onClick:()=>t(!1),children:Q(`panel.common.close`)})})]})})}var nP=`/dsh-market/api/v1`,rP=`dsh-mobile-plugin`,iP=class extends Error{constructor(e,t,n){super(n),q(this,`status`,void 0),q(this,`code`,void 0),this.name=`MarketError`,this.status=e,this.code=t}},aP=e=>e&&typeof e==`object`?e:{},oP=e=>typeof e==`string`&&e!==``?e:null;async function sP(e,t){let n;try{n=await fetch(`${nP}${e}`,{credentials:`same-origin`,...t})}catch(e){throw new iP(0,`market_unreachable`,Q(`panel.net.marketUnreachable`,{message:String(e?.message||e)}))}let r=await n.json().catch(()=>null);if(!n.ok){let e=aP(r),t=aP(e.failure),i=oP(t.code)??(typeof e.error==`string`?e.error:`HTTP ${n.status}`),a=oP(t.message)??oP(e.error)??Q(`panel.net.marketHttp`,{status:n.status});throw new iP(n.status,i,a)}return r}async function cP(){try{return{available:!0,restartSupported:aP(aP(await sP(`/capabilities`)).restart).supported===!0}}catch{return{available:!1,restartSupported:!1}}}async function lP(e=rP,t=!1){let n=aP(await sP(`/updates${`?name=${encodeURIComponent(e)}${t?`&force=1`:``}`}`)),r=aP(n.package??n);return{installedVersion:oP(r.installedVersion),latestVersion:oP(r.latestVersion),updateAvailable:r.updateAvailable===!0,source:oP(r.source)}}var uP={status:`/api/relay/update/status`,check:`/api/relay/update/check`,apply:`/api/relay/update/apply`,auto:`/api/relay/update/auto`,otaStatus:`/api/relay/update/ota/status`,otaCheck:`/api/relay/update/ota/check`,otaApply:`/api/relay/update/ota/apply`},dP=e=>e&&typeof e==`object`?e:{},fP=e=>typeof e==`string`&&e!==``?e:null,pP=e=>typeof e==`boolean`?e:null,mP=e=>typeof e==`number`&&Number.isFinite(e)?e:null;async function hP(e,t){let n=await fetch(e,{credentials:`same-origin`,headers:{accept:`application/json`,...t?.body?{"content-type":`application/json`}:{}},...t}),r=null;try{r=await n.json()}catch{r=null}let i=dP(r),a=dP(i.error);if(!n.ok){let e=fP(a.code)??`http_${n.status}`;throw new vA(fP(a.message)??Q(`panel.net.hostHttp`,{status:n.status}),e,n.status)}return i}function gP(e){return e instanceof vA?e.status===404:e instanceof SyntaxError}function _P(e){return e instanceof vA&&e.code===`update_unavailable`}function vP(e){let t=dP(e);return Object.keys(t).length===0?null:{installedVersion:fP(t.installedVersion),latestVersion:fP(t.latestVersion),updateAvailable:t.updateAvailable===!0,source:fP(t.source),checkedAt:fP(t.checkedAt)}}function yP(e){let t=dP(e),n=dP(t.failure),r=fP(n.code);return{installed:pP(t.installed),skipped:pP(t.skipped),state:fP(t.state),beforeVersion:fP(t.beforeVersion),installedVersion:fP(t.installedVersion),swapped:pP(t.swapped),restartRequired:pP(t.restartRequired),refreshRequired:pP(t.refreshRequired),failure:r?{code:r,message:fP(n.message)??r}:null}}function bP(e){let t=dP(e);return{available:t.available===!0,version:fP(t.version),installedVersion:fP(t.installedVersion),source:fP(t.source),previousVersion:fP(t.previousVersion),activatedAt:fP(t.activatedAt),lastError:fP(t.lastError),inFlight:mP(t.inFlight)??0,swapping:t.swapping===!0,autoUpdate:t.autoUpdate===!0,autoIntervalMs:mP(t.autoIntervalMs)??6e5,marketBase:fP(t.marketBase),marketLastCheckedAt:fP(t.marketLastCheckedAt),marketLastError:fP(t.marketLastError),marketResult:vP(t.marketResult),lastApply:t.lastApply?yP(t.lastApply):null,appliedAt:fP(t.appliedAt),runningShellHash:fP(t.runningShellHash),installedShellHash:fP(t.installedShellHash),shellChanged:t.shellChanged===!0}}async function xP(){return bP((await hP(uP.status)).data)}async function SP(){let e=dP((await hP(uP.check,{method:`POST`,body:JSON.stringify({})})).data);return{update:vP(e.update),status:e.status?bP(e.status):null}}async function CP(e=!1){let t=dP((await hP(uP.apply,{method:`POST`,body:JSON.stringify({force:e})})).data),n=dP(t.status);return{...yP(t),status:Object.keys(n).length>0?bP(n):null}}async function wP(e){let t=dP((await hP(uP.auto,{method:`POST`,body:JSON.stringify({enabled:e})})).data);return{enabled:t.enabled===!0,status:t.status?bP(t.status):null}}var TP=new Set([`OPERATION_BUSY`,`RELEASE_TOO_FRESH`,`VERSION_UNCHANGED`,`PLUGIN_NOT_INSTALLED`,`AGENTS_RUNNING`]);function EP(e,t){return e?VE(e):t}function DP(e){let t=e.installedVersion??e.beforeVersion;return e.failure?{text:Q(`panel.update.applyFailed`,{message:e.failure.message}),ok:!1}:e.installed===!1?e.skipped?{text:t?Q(`panel.update.applyUpToDate`,{version:t}):Q(`panel.update.applyUpToDatePlain`),ok:!0}:{text:t?Q(`panel.update.applyDiskUnchanged`,{version:t}):Q(`panel.update.applyFailedRetry`),ok:!1}:{text:t?Q(`panel.update.applySwitched`,{version:t}):Q(`panel.update.applySwitchedPlain`),ok:!0}}function OP({version:e,busy:t,onRestartSidecar:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(``),h=MM(),[_,v]=(0,g.useState)(!1),y=(0,g.useCallback)(e=>{e&&i(t=>({...e,available:e.available===!0||t?.available===!0}))},[]),b=r!==null&&r.available&&!s,x=t!==``||p!==``,S=(0,g.useCallback)(async()=>{try{let e=await xP();i(e),c(e.available!==!0)}catch(e){i(null),c(_P(e))}finally{o(!0)}},[]);(0,g.useEffect)(()=>{S()},[S]),(0,g.useEffect)(()=>{if(!a)return;let e=!0;return SP().then(t=>{e&&(t.update&&f(t.update),t.status&&y(t.status))}).catch(()=>{}),()=>{e=!1}},[a]);let C=r?.swapping===!0;(0,g.useEffect)(()=>{if(!C)return;let e=window.setInterval(()=>void S(),1500);return()=>window.clearInterval(e)},[C,S]),(0,g.useEffect)(()=>{if(b||!a)return;let e=!0;return cP().then(t=>{e&&u(t)}),()=>{e=!1}},[b,a]);let w=(0,g.useCallback)(e=>{if(e instanceof iP&&TP.has(e.code)){h(`soft`,`${e.message}(${e.code})`);return}h(`error`,wA(e))},[]),T=(0,g.useCallback)(async()=>{m(`check`);try{let e=await SP();e.status&&y(e.status),e.update&&f(e.update)}catch(e){gP(e)||_P(e)?await S():h(`error`,wA(e))}finally{m(``)}},[S]),E=(0,g.useCallback)(async e=>{m(`apply`);try{let t=await CP(e);t.status&&y(t.status);let n=DP(t),r=t.failure!==null&&TP.has(t.failure.code);n.ok||r?h(`soft`,n.text):h(`error`,n.text)}catch(e){gP(e)||_P(e)?await S():h(`error`,wA(e))}finally{m(``)}},[S]),D=(0,g.useCallback)(async()=>{m(`check`);try{let e=await SP();e.status&&y(e.status),f(e.update)}catch(e){if(!gP(e))f(null),h(`error`,wA(e));else try{f(await lP(void 0,!0))}catch(e){f(null),w(e)}}finally{m(``)}},[w]),O=(0,g.useCallback)(async e=>{v(!0);try{let t=await wP(e);t.status&&y(t.status);let n=Math.round((t.status?.autoIntervalMs??r?.autoIntervalMs??6e5)/6e4);h(`soft`,t.enabled?Q(`panel.update.autoOn`,{minutes:n}):Q(`panel.update.autoOff`))}catch(e){h(`error`,Q(`panel.update.autoToggleFailed`,{message:wA(e)})),await S()}finally{v(!1)}},[r?.autoIntervalMs,S]),k=d?.latestVersion??r?.marketResult?.latestVersion??null,A=d?.source??r?.marketResult?.source??null,j=A===`linked`||A===`file`||A===`workspace`,M=d?.updateAvailable??r?.marketResult?.updateAvailable??!1,N=r?.lastApply?DP(r.lastApply):null,P=e||`—`,F=r?.version??null,I=b&&!!F&&!!e&&F!==e;return(0,G.jsxs)(uO,{frame:`solid`,children:[(0,G.jsx)(dO,{className:`px-4 py-3`,children:(0,G.jsxs)(fO,{className:`flex items-center gap-2 text-base lg:text-lg`,children:[(0,G.jsx)(`span`,{children:Q(`panel.update.title`)}),(0,G.jsx)(iO,{variant:`soft`,size:`sm`,children:e||Q(`panel.update.unknownVersion`)})]})}),a?null:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-sm text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.update.reading`)]}),s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.update.runningVersion`),mono:!0,children:P}),(0,G.jsx)($,{label:Q(`panel.update.latestOnline`),mono:!0,children:k??Q(`panel.update.notChecked`)})]}),(0,G.jsxs)(`p`,{className:`mt-3 text-xs text-foreground-muted`,children:[M?Q(`panel.update.hasNew`):``,Q(`panel.update.nothingToInstall`)]})]}):null,a&&!b&&!s&&l!==null&&!l.available?(0,G.jsxs)(ZD,{variant:`info`,className:`mt-3`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.update.noMarketTitle`)}),(0,G.jsx)(tO,{children:Q(`panel.update.noMarketBody`)})]}):null,b&&r?(0,G.jsxs)(G.Fragment,{children:[j?null:(0,G.jsxs)(`label`,{className:`mt-1 flex items-start justify-between gap-4 border-b border-border-muted py-3`,children:[(0,G.jsx)(`span`,{className:`min-w-0`,children:(0,G.jsx)(`span`,{className:`block text-sm text-foreground`,children:Q(`panel.update.autoUpdate`)})}),(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[_?(0,G.jsx)(UD,{}):null,(0,G.jsx)(VO,{size:`md`,checked:r.autoUpdate,disabled:x||_,onCheckedChange:e=>void O(e),"aria-label":Q(`panel.update.autoUpdate`)})]})]}),(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.update.runningVersion`),mono:!0,children:P}),(0,G.jsx)($,{label:Q(`panel.update.latestOnline`),mono:!0,children:k??Q(`panel.update.notChecked`)}),(0,G.jsx)($,{label:Q(`panel.update.lastCheck`),children:EP(d?.checkedAt??r.marketLastCheckedAt,Q(`panel.update.notChecked`))}),(0,G.jsx)($,{label:Q(`panel.update.lastApply`),children:r.lastApply?EP(r.appliedAt,Q(`panel.update.neverUpdated`)):Q(`panel.update.neverUpdated`)})]}),I?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-foreground-muted`,children:Q(`panel.update.versionDrift`,{version:e??``,shell:F??``})}):null,r.shellChanged?(0,G.jsxs)(ZD,{variant:`info`,className:`mt-3`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.update.shellChangedTitle`)}),(0,G.jsx)(tO,{children:Q(`panel.update.shellChangedBody`)})]}):null,r.lastError?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-foreground-muted`,children:Q(`panel.update.lastErrorLine`,{message:r.lastError})}):null,(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,size:`md`,disabled:x,onClick:n,children:Q(`panel.update.restartSidecar`)}),(0,G.jsx)(Z,{variant:`outline`,size:`md`,disabled:x,onClick:()=>void T(),children:Q(p===`check`?`panel.update.checking`:`panel.update.check`)}),j?null:(0,G.jsx)(Z,{variant:`primary`,size:`md`,disabled:x,onClick:()=>void E(!1),children:Q(p===`apply`?`panel.update.updating`:`panel.update.updateNow`)})]}),!j&&(M||N!==null&&!N.ok)?(0,G.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:x,onClick:()=>void E(!0),children:Q(`panel.update.forceHint`)})}):null]}):null,a&&!b&&!s&&l?.available?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.update.runningVersion`),mono:!0,children:P}),(0,G.jsx)($,{label:Q(`panel.update.latestOnline`),mono:!0,children:k??Q(`panel.update.notChecked`)}),(0,G.jsx)($,{label:Q(`panel.update.checkResult`),children:Q(M?`panel.update.resultHasNew`:`panel.update.resultUpToDate`)})]}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,G.jsx)(Z,{variant:`outline`,size:`md`,disabled:x,onClick:n,children:Q(`panel.update.restartSidecar`)}),(0,G.jsx)(Z,{variant:`outline`,size:`md`,disabled:x,onClick:()=>void D(),children:Q(p===`check`?`panel.update.checking`:`panel.update.check`)}),r!==null&&!j?(0,G.jsx)(Z,{variant:`primary`,size:`md`,disabled:x,onClick:()=>void E(!1),children:Q(p===`apply`?`panel.update.updating`:`panel.update.updateNow`)}):null]})]}):null]})}function kP({webAccess:e,busy:t,onToggle:n}){let r=e?.enabled===!0,i=typeof e?.expiresAt==`number`?e.expiresAt:0;return(0,G.jsxs)(uO,{frame:`solid`,children:[(0,G.jsx)(dO,{className:`px-4 py-3`,children:(0,G.jsx)(fO,{className:`text-base lg:text-lg`,children:Q(`panel.webAccess.title`)})}),(0,G.jsx)(hk,{children:(0,G.jsx)($,{label:Q(`panel.webAccess.state`),tone:r?`ok`:`off`,children:r?Q(`panel.webAccess.expires`,{time:VE(i)}):Q(`panel.webAccess.closed`)})}),(0,G.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-foreground-muted`,children:Q(`panel.webAccess.hint`)}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r?(0,G.jsx)(Z,{variant:`outline`,size:`sm`,disabled:t===`webAccess`,onClick:()=>n(!1),children:Q(`panel.webAccess.close`)}):(0,G.jsx)(Z,{variant:`outline`,size:`sm`,disabled:t===`webAccess`,onClick:()=>n(!0),children:Q(`panel.webAccess.open`)})})]})}function AP(e,t=``){let n=document.documentElement;n.setAttribute(`data-dshm-panel-state`,e),t?n.setAttribute(`data-dshm-panel-error`,t):n.removeAttribute(`data-dshm-panel-error`),window.parent!==window&&window.parent.postMessage({type:`dsh-mobile-plugin:panel-state`,state:e,message:t},`*`)}function jP(e){try{let t=new URL(document.baseURI),n=t.pathname.replace(/\/console\/?$/,``);return t.pathname=e===`debug`?`${n}/debug`:e===`setup`?`${n}/setup`:n,t.search=``,t.hash=``,t.href}catch{return``}}var MP=1500,NP=600;function PP(){return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M4 7h16`}),(0,G.jsx)(`path`,{d:`M9 7V4.5A1.5 1.5 0 0 1 10.5 3h3A1.5 1.5 0 0 1 15 4.5V7`}),(0,G.jsx)(`path`,{d:`M6 7l1 12.5A2 2 0 0 0 9 21h6a2 2 0 0 0 2-1.5L18 7`}),(0,G.jsx)(`path`,{d:`M10 11v6M14 11v6`})]})}function FP(){let[e,t]=(0,g.useState)(null),[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(!1),[m,h]=(0,g.useState)(!1),[_,v]=(0,g.useState)(!1),[y,b]=(0,g.useState)(!1),[x,S]=(0,g.useState)(!1),[C,w]=(0,g.useState)(!1),T=MM();(0,g.useEffect)(()=>{e?AP(`ready`):n&&AP(`error`,n)},[e,n]);let E=(0,g.useRef)(null),[D,O]=(0,g.useState)(0);(0,g.useEffect)(()=>{let e=E.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>O(e.getBoundingClientRect().height);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]);let k=WN(HN(e?.lastMobileAt),e?`${+!!e.enabled}|${+!!e.lan.enabled}|${e.lan.state}|${e.tunnel.state}|${+((e.lastMobileAt??0)>0)}`:``),A=(0,g.useCallback)(async()=>{try{t(await bA(`/api/relay/status`)),r(``)}catch(e){r(wA(e))}},[]),j=(0,g.useCallback)(async()=>{l(``);try{s(await bA(`/api/relay/pairing`)),l(``)}catch(e){s(null),l(wA(e))}},[]),M=(0,g.useCallback)(async()=>{try{d(await bA(`/api/relay/addresses`))}catch{d(null)}},[]);(0,g.useEffect)(()=>{let e=()=>{xD()&&A()};e();let t=0,n=window.setTimeout(()=>{t=window.setInterval(e,3e3)},MP);return document.addEventListener(`visibilitychange`,e),()=>{window.clearTimeout(n),t&&window.clearInterval(t),document.removeEventListener(`visibilitychange`,e)}},[A]),(0,g.useEffect)(()=>{if(!e?.enabled)return;let t=window.setTimeout(()=>void j(),NP);return()=>window.clearTimeout(t)},[e?.enabled,j]),(0,g.useEffect)(()=>{e?.enabled&&o&&e.pairingCode&&o.pairingCode!==e.pairingCode&&j()},[e?.pairingCode,e?.enabled,o,j]);let N=(0,g.useCallback)(async()=>{try{s(await bA(`/api/relay/pairing`)),l(``)}catch{}},[]);(0,g.useEffect)(()=>{if(!e?.enabled)return;let t=_A(o);if(t===null)return;let n=window.setTimeout(()=>void N(),t);return()=>window.clearTimeout(n)},[o,e?.enabled,N]),(0,g.useEffect)(()=>{if(!e?.enabled)return;let t=window.setTimeout(()=>void M(),NP);return()=>window.clearTimeout(t)},[e?.enabled,o,M]),(0,g.useEffect)(()=>{f&&e?.enabled&&(j(),M())},[f,e?.enabled,j,M]);let P=(0,g.useCallback)(async(e,t)=>{a(e);try{await t()}catch(e){T(`error`,wA(e))}finally{a(``)}},[T]),F=e=>P(`toggle`,async()=>{t(await xA(`/api/relay/toggle`,{enabled:e})),e?await j():(s(null),l(``)),T(`soft`,Q(e?`panel.shell.remoteEnabled`:`panel.shell.remoteDisabled`))}),I=()=>P(`reconnect`,async()=>{t(await xA(`/api/relay/reconnect`)),T(`soft`,Q(`panel.shell.reconnecting`))}),L=()=>P(`restart`,async()=>{let e=await xA(`/api/relay/restart-sidecar`);t(e.status),T(`soft`,Q(`panel.shell.sidecarRestarted`))}),R=()=>{window.confirm(Q(`panel.shell.revokeConfirm`))&&P(`revoke`,async()=>{let e=await xA(`/api/relay/revoke-all`);await A(),await j(),T(`soft`,`${Q(`panel.shell.revoked`,{count:e.revoked})}${e.revokedRelay?Q(`panel.shell.revokedRelay`,{count:e.revokedRelay}):``}`)})},z=e=>P(`webAccess`,async()=>{let n=await xA(`/api/relay/web-access`,{enabled:e});t(e=>e&&{...e,webAccess:n.webAccess}),T(`soft`,Q(e?`panel.webAccess.opened`:`panel.webAccess.closedNotice`))}),B=e=>P(`config`,async()=>{t(await xA(`/api/relay/config`,e)),p(!1),await j(),T(`soft`,Q(`panel.shell.configSaved`))}),V=e=>P(`policy`,async()=>{t(await xA(`/api/relay/config`,{pairingPolicy:e})),T(`soft`,Q(e===`code`?`panel.shell.deviceAllowed`:`panel.shell.deviceDenied`))}),H=e=>P(`tier`,async()=>{t(await xA(`/api/relay/config`,{pairingTier:e})),T(`soft`,Q(`panel.shell.configSaved`))}),U=e=>P(`autoReview`,async()=>{t(await xA(`/api/relay/config`,{approvalAutoReview:e})),T(`soft`,Q(e?`panel.shell.autoReviewOn`:`panel.shell.autoReviewOff`))}),W=e=>P(`lan`,async()=>{t(await xA(`/api/relay/config`,{lanPort:e})),h(!1),await j(),T(`soft`,Q(`panel.shell.lanSaved`))}),ee=e=>P(`lan`,async()=>{t(await xA(`/api/relay/config`,{preferredLanAddress:e})),await Promise.all([j(),M()]),T(`soft`,e?Q(`panel.shell.preferredAddress`,{address:e}):Q(`panel.shell.preferredAuto`))}),K=e=>{let t=jP(e);t&&window.open(t,`_blank`,`noreferrer`)},te=e?e.tunnel.state===`connected`||e.lan.state===`listening`?`ok`:e.enabled?`warn`:`off`:null;return e?(0,G.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-col gap-3 p-4 sm:p-5`,children:[(0,G.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[te?(0,G.jsx)(mk,{tone:te}):null,(0,G.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name||e.instanceId}),(0,G.jsx)(iO,{variant:`soft`,size:`sm`,children:e.appVersion||Q(`panel.shell.unknownVersion`)}),(0,G.jsxs)(`span`,{className:`hidden whitespace-nowrap text-xs text-foreground-muted lg:inline`,children:[Q(`panel.connection.tunnel`),` `,UE(e.tunnel.state),` · `,Q(`panel.connection.lan`),` `,GE(e.lan.state,e.lan.enabled)]})]}),i?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.shell.busy`)]}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,G.jsx)(QE,{}),(0,G.jsx)(_D,{}),(0,G.jsx)(Z,{variant:`ghost`,size:`icon-md`,"aria-label":Q(`panel.inbox.title`),title:Q(`panel.inbox.title`),onClick:()=>w(!0),children:(0,G.jsx)(PP,{})}),(0,G.jsx)(wN,{lanPort:e.lan.port}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:()=>K(`debug`),children:Q(`panel.console.troubleshoot`)}),(0,G.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:i!==``,onClick:()=>void I(),children:Q(`panel.pairing.reconnect`)})]})]}),n?(0,G.jsxs)(ZD,{variant:`error`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.shell.statusFailed`)}),(0,G.jsx)(tO,{children:n})]}):null,(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,G.jsx)(DM,{status:e,pairing:o,addressBook:u,busy:i,error:c,restartError:e.sidecar.restartError,onOpenConfig:()=>p(!0),onChangePolicy:e=>void V(e),onChangeTier:e=>void H(e),onChangeAutoReview:e=>void U(e),onOpenSelfCheck:()=>v(!0),onRetryPairing:()=>void j(),onSavePreferred:e=>void ee(e),onEditPort:()=>h(!0)}),(0,G.jsx)(mN,{})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,G.jsx)(`div`,{ref:E,children:(0,G.jsx)(xk,{status:e,busy:i,onToggle:F,onManageTailcat:()=>b(!0),onManageP2P:()=>S(!0)})}),(0,G.jsx)(`div`,{className:`min-h-0`,style:D>0?{height:`${D}px`}:void 0,children:(0,G.jsx)(UM,{onRevokeAll:R,busy:i,fill:!0})})]}),(0,G.jsxs)(`div`,{className:`columns-1 gap-3 md:columns-2 xl:columns-3 [&>*]:mb-3 [&>*]:break-inside-avoid`,children:[e.webAccess?.enabled&&e.panelScope!==`loopback`?(0,G.jsx)(kP,{webAccess:e.webAccess,busy:i,onToggle:e=>void z(e)}):null,(0,G.jsx)(OP,{version:e.appVersion||``,busy:i,onRestartSidecar:()=>void L()})]})]}),(0,G.jsx)(PN,{open:f,onOpenChange:p,status:e,addressBook:u,lanUrls:o?.lanUrls??[],busy:i,onSave:e=>void B(e),onSavePreferred:e=>void ee(e)}),(0,G.jsx)(QN,{open:_,onOpenChange:v,state:k,lastMobileAt:e.lastMobileAt}),(0,G.jsx)(tP,{open:y,onOpenChange:b,onChanged:()=>void A()}),(0,G.jsx)(DN,{open:x,onOpenChange:S}),(0,G.jsx)(NN,{open:m,onOpenChange:h,port:o?.lanPort??e.lan.requestedPort??e.lan.port,busy:i,onSave:e=>void W(e)}),(0,G.jsx)(qf,{open:C,onOpenChange:w,children:(0,G.jsxs)(Jf,{className:`max-w-md`,children:[(0,G.jsx)(Yf,{children:(0,G.jsx)(Xf,{children:Q(`panel.inbox.title`)})}),(0,G.jsx)(Qf,{children:(0,G.jsx)(_N,{framed:!1})})]})})]}):(0,G.jsx)(`main`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-3 p-5`,children:n?(0,G.jsx)(`p`,{className:`text-sm text-error`,children:n}):(0,G.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.shell.readingStatus`)]})})}function IP(e){if(typeof e!=`number`||!Number.isFinite(e))return`—`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${r===0?Math.round(n):n.toFixed(1)} ${t[r]}`}function LP(e,t){let n=Array.isArray(e)?e:[];if(!n.length)return t;let r=e=>e.length>34?`${e.slice(0,31)}…`:e,i=n.slice(0,2).map(e=>r(e.url)).join(` `);return n.length>2?`${i} +${n.length-2}`:i}function RP(e){let{status:t,statusError:n,half:r,halfError:i}=e;return t?r?.lastError?{tone:`error`,key:`panel.debug.verdict.loadFailed`}:i&&!r?{tone:`warn`,key:`panel.debug.verdict.halfDown`}:r?.retrying?{tone:`warn`,key:`panel.debug.verdict.retrying`}:t.enabled?t.sidecar.state===`healthy`?t.tunnel.state===`error`?{tone:`error`,key:t.tunnel.admissionHint?`panel.debug.verdict.tunnelRejected`:`panel.debug.verdict.tunnelBad`}:t.lan.enabled&&t.lan.state===`error`?{tone:`error`,key:`panel.debug.verdict.lanBad`}:t.lastMobileAt?{tone:`ok`,key:`panel.debug.verdict.ok`}:{tone:`warn`,key:`panel.debug.verdict.phoneNever`}:{tone:`error`,key:`panel.debug.verdict.sidecarBad`}:{tone:`warn`,key:`panel.debug.verdict.disabled`}:n?{tone:`error`,key:`panel.debug.verdict.controlDown`}:{tone:`warn`,key:`panel.debug.verdict.reading`}}function zP({title:e,children:t,className:n}){return(0,G.jsxs)(uO,{frame:`solid`,className:n,children:[(0,G.jsx)(dO,{children:(0,G.jsx)(fO,{children:e})}),t]})}function BP(){let[e,t]=(0,g.useState)(null),[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(null),[m,h]=(0,g.useState)(``),[_,v]=(0,g.useState)(``),[y,b]=(0,g.useState)(``),[x,S]=(0,g.useState)(``),C=(0,g.useCallback)(async()=>{try{t(await bA(`/api/relay/status`)),h(``)}catch(e){t(null),h(wA(e))}try{let e=await bA(`/api/relay/host-half`);r(e?.half&&typeof e.half==`object`?e.half:null),v(``)}catch(e){r(null),v(wA(e))}try{a(await bA(`/api/relay/faults`))}catch{a(null)}try{let e=await bA(`/api/relay/update/status`);d(e?.data??null)}catch{d(null)}try{s(await bA(`/api/relay/addresses`))}catch{s(null)}try{l(await bA(`/api/relay/devices`))}catch{l(null)}},[]);(0,g.useEffect)(()=>{C();let e=()=>{xD()&&C()},t=window.setInterval(e,5e3);return document.addEventListener(`visibilitychange`,e),()=>{window.clearInterval(t),document.removeEventListener(`visibilitychange`,e)}},[C]);let w=(0,g.useCallback)(async(e,t)=>{b(e),S(``);try{S(await t())}catch(e){S(wA(e))}finally{b(``),await C()}},[C]),T=()=>w(`host`,async()=>(await xA(`/api/relay/host-half/reload`,{}),Q(`panel.debug.reloaded`))),E=()=>w(`sidecar`,async()=>(await xA(`/api/relay/restart-sidecar`,{}),Q(`panel.debug.sidecarRestarted`))),D=()=>w(`selfcheck`,async()=>{let e=await bA(`/api/relay/selfcheck?force=1`);return p(e),Q(`panel.debug.selfcheckDone`)}),O=e?.selfCheck??null,k=e?.desktopHalf??null,A=Array.isArray(i?.faults)?i.faults:[],j=Array.isArray(O?.unavailable)?O.unavailable:[],M=(0,g.useMemo)(()=>RP({status:e,statusError:m,half:n,halfError:_}),[e,m,n,_]),N=Array.isArray(o?.lan)?o.lan:[],P=Array.isArray(o?.public)?o.public:[],F=Array.isArray(o?.ipv6)?o.ipv6:[],I=Array.isArray(c?.devices)?c.devices:[],L=(0,g.useMemo)(()=>{let t=[`dsh-mobile-plugin debug`];n?(t.push(`plugin_version=${n.version??``}`),t.push(`plugin_source=${n.source??``}`),t.push(`activated_at=${n.activatedAt??``}`),t.push(`installed_version=${n.installedVersion??n.version??``}`),t.push(`shell_changed=${n.shellChanged?`true`:`false`}`),t.push(`retrying=${n.retrying?`true`:`false`}`),t.push(`retry_attempts=${n.retryAttempts??0}`),t.push(`host_last_error=${n.lastError??``}`)):t.push(`host_half=unavailable ${_}`),e?(t.push(`enabled=${e.enabled?`true`:`false`}`),t.push(`tunnel=${e.tunnel.state} ${e.tunnel.error??``}`),t.push(`lan=${e.lan.state} enabled=${e.lan.enabled?`true`:`false`} port=${e.lan.port}`),t.push(`sidecar=${e.sidecar.state} restarts=${e.sidecar.restarts}`),t.push(`mirror_ok=${e.mirror.ok?`true`:`false`} ${e.mirror.error??``}`),t.push(`panel_scope=${e.panelScope??``}`),t.push(`panel_url=${e.panelUrl??``}`),t.push(`last_mobile_at=${e.lastMobileAt??0}`),t.push(`local_port=${e.localPort??0}`)):t.push(`status=unavailable ${m}`),O&&(t.push(`host_rss=${O.hostProcess?.rss??``}`),t.push(`host_heap_used=${O.hostProcess?.heapUsed??``}`),t.push(`streams_relay_sse=${O.streams?.relaySseOpen??``}`),t.push(`streams_lan=${O.streams?.lanSseOpen??``}`)),k&&(t.push(`client_reports=${k.clientReports??0}`),t.push(`client_last_at=${k.clientLastAt??0}`)),c&&t.push(`devices=${I.length}`),f&&t.push(`selfcheck_verdict=${f.verdict} at=${f.checkedAt}`),i?.installed===!1&&t.push(`faults=not-installed`);for(let e of A.slice(-5))t.push(`fault=${e.kind} ${new Date(e.at).toISOString()} ${e.message}`);return t.join(`
|
|
28
28
|
`)},[n,_,e,m,O,k,i,A,c,I.length,f]),R=()=>w(`copy`,async()=>navigator.clipboard&&typeof navigator.clipboard.writeText==`function`?(await navigator.clipboard.writeText(L),Q(`panel.debug.copied`)):Q(`panel.debug.copyFailed`));return(0,G.jsxs)(`main`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4 p-5`,children:[(0,G.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h1`,{className:`text-lg font-semibold text-foreground-intense`,children:Q(`panel.debug.title`)}),n?.version?(0,G.jsx)(iO,{variant:`soft`,size:`sm`,children:n.version}):null,y?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-foreground-muted`,children:[(0,G.jsx)(UD,{}),Q(`panel.debug.working`)]}):null,(0,G.jsxs)(`span`,{className:`ml-auto flex flex-wrap gap-2`,children:[(0,G.jsx)(Z,{variant:`soft`,size:`sm`,onClick:()=>void C(),children:Q(`panel.debug.refresh`)}),(0,G.jsx)(Z,{variant:`soft`,size:`sm`,onClick:()=>void T(),children:Q(`panel.debug.reloadHost`)}),(0,G.jsx)(Z,{variant:`soft`,size:`sm`,onClick:()=>void E(),children:Q(`panel.debug.restartSidecar`)}),(0,G.jsx)(Z,{variant:`soft`,size:`sm`,onClick:()=>void R(),children:Q(`panel.debug.copy`)})]})]}),(0,G.jsxs)(`div`,{className:RE(`flex items-start gap-2.5 rounded-xl border px-4 py-3 text-sm`,M.tone===`ok`&&`border-success/30 bg-success/10 text-success`,M.tone===`warn`&&`border-warning/30 bg-warning/10 text-warning`,M.tone===`error`&&`border-error/30 bg-error/10 text-error`),children:[(0,G.jsx)(`span`,{className:RE(`mt-1.5 inline-block size-2 shrink-0 rounded-full`,M.tone===`ok`&&`bg-success`,M.tone===`warn`&&`bg-warning`,M.tone===`error`&&`bg-error`),"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block font-medium`,children:Q(M.key)}),(0,G.jsx)(`span`,{className:`mt-1 block text-xs text-foreground-muted`,children:Q(`panel.debug.lead`)})]})]}),x?(0,G.jsxs)(ZD,{variant:`info`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(tO,{children:x})]}):null,(0,G.jsxs)(`div`,{className:`grid items-start gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(zP,{title:Q(`panel.debug.sectionStartup`),children:(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.debug.pluginVersion`),children:(0,G.jsx)(gk,{tone:n?.version?`ok`:`error`,text:n?.version?String(n.version):Q(`panel.debug.unknown`)})}),(0,G.jsx)($,{label:Q(`panel.debug.source`),children:n?.source||Q(`panel.debug.unknown`)}),(0,G.jsx)($,{label:Q(`panel.debug.activatedAt`),children:VE(n?.activatedAt)}),(0,G.jsx)($,{label:Q(`panel.debug.onDisk`),children:n?.installedVersion||u?.installedVersion||Q(`panel.debug.unknown`)}),(0,G.jsx)($,{label:Q(`panel.debug.shellChanged`),tone:n?.shellChanged?`warn`:`ok`,children:n?.shellChanged?Q(`panel.debug.shellChangedYes`):Q(`panel.debug.shellChangedNo`)}),(0,G.jsx)($,{label:Q(`panel.debug.retrying`),tone:n?.retrying?`warn`:`ok`,children:n?.retrying?`${Q(`panel.debug.retryingYes`)} · ${String(n.retryAttempts??0)}${n.nextRetryAt?` → ${n.nextRetryAt}`:``}`:Q(`panel.debug.retryingNo`)}),(0,G.jsx)($,{label:Q(`panel.debug.runningVersion`),children:u?.runningVersion||n?.version||Q(`panel.debug.unknown`)}),(0,G.jsx)($,{label:Q(`panel.debug.lastError`),tone:n?.lastError?`error`:`ok`,children:n?.lastError||Q(`panel.debug.noError`)})]})}),(0,G.jsx)(zP,{title:Q(`panel.debug.sectionLink`),children:e?(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.connection.remoteControl`),tone:e.enabled?`ok`:`warn`,children:e.enabled?Q(`panel.debug.on`):Q(`panel.debug.off`)}),(0,G.jsx)($,{label:Q(`panel.connection.tunnel`),tone:HE(e.tunnel.state),children:(0,G.jsx)(gk,{tone:HE(e.tunnel.state),text:UE(e.tunnel.state),...e.tunnel.error?{detail:e.tunnel.error}:{}})}),(0,G.jsx)($,{label:Q(`panel.connection.lan`),tone:WE(e.lan.state,e.lan.enabled),children:(0,G.jsx)(gk,{tone:WE(e.lan.state,e.lan.enabled),text:GE(e.lan.state,e.lan.enabled),...e.lan.port?{detail:String(e.lan.port)}:{}})}),(0,G.jsx)($,{label:Q(`panel.connection.sidecar`),children:(0,G.jsx)(gk,{tone:e.sidecar.state===`healthy`?`ok`:`warn`,text:KE(e.sidecar.state),...e.sidecar.restarts>0?{detail:Q(`panel.connection.sidecarRestarts`,{count:e.sidecar.restarts})}:{}})}),e.sidecar.restartError?(0,G.jsx)($,{label:Q(`panel.debug.sidecarError`),tone:`error`,children:e.sidecar.restartError}):null,(0,G.jsx)($,{label:Q(`panel.connection.mirror`),children:(0,G.jsx)(gk,{tone:e.mirror.ok?`ok`:e.mirror.error?`error`:`warn`,text:e.mirror.ok?Q(`panel.connection.mirrorOk`):Q(`panel.connection.mirrorOff`),detail:VE(e.mirror.pushedAt)})}),(0,G.jsx)($,{label:Q(`panel.debug.lastMobile`),children:(0,G.jsx)(gk,{tone:e.lastMobileAt?`ok`:`warn`,text:e.lastMobileAt?VE(e.lastMobileAt):Q(`panel.debug.mobileNever`)})})]}):(0,G.jsx)(`p`,{className:`text-sm text-foreground-muted`,children:Q(`panel.debug.statusUnavailable`)})}),(0,G.jsx)(zP,{title:Q(`panel.debug.sectionAddress`),children:(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.debug.localPort`),mono:!0,children:e?.localPort?String(e.localPort):Q(`panel.debug.unknown`)}),(0,G.jsx)($,{label:Q(`panel.debug.panelScope`),children:e?.panelScope||Q(`panel.debug.unknown`)}),(0,G.jsx)($,{label:Q(`panel.debug.panelUrl`),mono:!0,children:e?.panelUrl||Q(`panel.debug.unknown`)}),(0,G.jsx)($,{label:Q(`panel.debug.webAccess`),children:e?.webAccess?.enabled?Q(`panel.debug.webAccessOpen`,{time:VE(e.webAccess.expiresAt)}):Q(`panel.debug.webAccessClosed`)}),(0,G.jsx)($,{label:Q(`panel.debug.addressLan`),mono:!0,children:LP(N,Q(`panel.debug.addressNone`))}),(0,G.jsx)($,{label:Q(`panel.debug.addressPublic`),mono:!0,children:LP(P,Q(`panel.debug.addressNone`))}),(0,G.jsx)($,{label:Q(`panel.debug.addressIpv6`),mono:!0,children:LP(F,Q(`panel.debug.addressNone`))})]})}),(0,G.jsx)(zP,{title:Q(`panel.debug.sectionDevices`),children:(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.debug.deviceCount`),children:c?String(I.length):Q(`panel.debug.unknown`)}),I.length===0?(0,G.jsx)($,{label:Q(`panel.debug.deviceRecent`),children:Q(`panel.debug.deviceNone`)}):I.slice(0,5).map(e=>(0,G.jsx)($,{label:`${e.model||e.name||e.deviceId.slice(0,8)}${e.suffix?` #${e.suffix}`:``}`,children:(0,G.jsx)(gk,{tone:e.lastSeenAt?`ok`:`warn`,text:e.lastSeenAt?VE(e.lastSeenAt):Q(`panel.debug.mobileNever`),detail:[e.platform,e.appVersion].filter(Boolean).join(` · `)})},e.deviceId))]})}),(0,G.jsx)(zP,{title:Q(`panel.debug.sectionMemory`),children:O?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.debug.hostRss`),mono:!0,children:IP(O.hostProcess?.rss)}),(0,G.jsx)($,{label:Q(`panel.debug.hostHeap`),mono:!0,children:`${IP(O.hostProcess?.heapUsed)} / ${IP(O.hostProcess?.heapSizeLimit)}`}),(0,G.jsx)($,{label:Q(`panel.debug.sidecarRss`),mono:!0,children:IP(O.sidecarProcess?.memory?.rss)}),(0,G.jsx)($,{label:Q(`panel.debug.streams`),children:`${Q(`panel.debug.streamRelay`)} ${O.streams?.relaySseOpen??`—`} · ${Q(`panel.debug.streamLan`)} ${O.streams?.lanSseOpen??`—`} · ${Q(`panel.debug.streamUpstream`)} ${O.streams?.lanUpstreamOpen??`—`}`}),(0,G.jsx)($,{label:Q(`panel.debug.mirrorCache`),children:`${O.mirror?.cachedSessions??`—`} / ${O.mirror?.cachedMessages??`—`} · ${IP(O.mirror?.cachedBytes)}`}),(0,G.jsx)($,{label:Q(`panel.debug.pushFailures`),children:String(O.mirror?.pushFailures??`—`)}),(0,G.jsx)($,{label:Q(`panel.debug.credentials`),children:String(O.credentials?.active??`—`)})]}),(0,G.jsx)(`p`,{className:`mt-2 text-xs text-foreground-muted`,children:Q(`panel.debug.memoryCaveat`)}),j.length?(0,G.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1 text-xs text-foreground-muted`,children:j.map(e=>(0,G.jsx)(`li`,{className:`break-all font-mono`,children:e},e))}):null]}):(0,G.jsx)(`p`,{className:`text-sm text-foreground-muted`,children:Q(`panel.debug.statusUnavailable`)})}),(0,G.jsxs)(zP,{title:Q(`panel.debug.sectionSelfcheck`),children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,G.jsx)(Z,{variant:`soft`,size:`sm`,onClick:()=>void D(),children:Q(`panel.selfcheck.recheck`)}),f?(0,G.jsx)(`span`,{className:`text-xs text-foreground-muted`,children:Q(`panel.selfcheck.checkedAt`,{time:VE(f.checkedAt)})}):null]}),f?(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.selfcheck.title`),tone:GN(f.verdict),children:qN(f.verdict)}),(0,G.jsx)($,{label:Q(`panel.selfcheck.firewall`),children:f.firewall.supported?`${f.firewall.enabled===null?Q(`panel.selfcheck.unknown`):f.firewall.enabled?Q(`panel.debug.on`):Q(`panel.debug.off`)} · ${f.firewall.allowsApp===null?Q(`panel.selfcheck.unknown`):f.firewall.allowsApp?Q(`panel.selfcheck.allowed`):Q(`panel.selfcheck.blocked`)}`:Q(`panel.selfcheck.unknown`)}),(0,G.jsx)($,{label:Q(`panel.selfcheck.mobile`),children:VE(f.mobile.lastMobileAt)}),(0,G.jsx)($,{label:Q(`panel.selfcheck.port`,{port:f.listening.port}),children:UE(f.tunnel.state)})]}):(0,G.jsx)(`p`,{className:`text-sm text-foreground-muted`,children:Q(`panel.debug.selfcheckHint`)})]})]}),(0,G.jsx)(zP,{title:Q(`panel.debug.sectionFaults`),children:i?.installed===!1?(0,G.jsx)(`p`,{className:`text-sm text-foreground-muted`,children:Q(`panel.debug.faultsNotInstalled`)}):A.length===0?(0,G.jsx)(`p`,{className:`text-sm text-foreground-muted`,children:Q(`panel.debug.faultsEmpty`)}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-2`,children:A.slice().reverse().map((e,t)=>(0,G.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-border-muted pb-2 last:border-b-0`,children:[(0,G.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-2 text-sm`,children:[(0,G.jsx)(iO,{variant:e.fatal?`error`:`warning`,size:`sm`,children:e.kind}),(0,G.jsx)(`span`,{className:`text-xs text-foreground-muted`,children:VE(e.at)}),e.fatal?(0,G.jsx)(iO,{variant:`error`,size:`sm`,children:Q(`panel.debug.faultFatal`)}):null]}),(0,G.jsx)(`span`,{className:`break-all font-mono text-xs text-foreground-muted`,children:e.message})]},`${e.at}-${t}`))})}),k?(0,G.jsx)(zP,{title:Q(`panel.debug.sectionClient`),children:(0,G.jsxs)(hk,{children:[(0,G.jsx)($,{label:Q(`panel.debug.clientReports`),children:String(k.clientReports??0)}),(0,G.jsx)($,{label:Q(`panel.debug.clientLastAt`),children:VE(k.clientLastAt)}),(0,G.jsx)($,{label:Q(`panel.debug.receiptGets`),children:`${k.readReceiptGets??0} · ${VE(k.readReceiptLastAt)}`}),(0,G.jsx)($,{label:Q(`panel.debug.readPosts`),children:`${k.desktopReadPosts??0} · ${VE(k.desktopReadLastAt)}`}),(0,G.jsx)($,{label:Q(`panel.debug.viewPosts`),children:`${k.desktopViewPosts??0} · ${VE(k.desktopViewLastAt)}`}),(0,G.jsx)($,{label:Q(`panel.debug.clientReport`),children:k.client?JSON.stringify(k.client):Q(`panel.debug.unknown`)})]})}):null,m?(0,G.jsxs)(ZD,{variant:`error`,children:[(0,G.jsx)($D,{}),(0,G.jsx)(eO,{children:Q(`panel.debug.statusUnavailable`)}),(0,G.jsx)(tO,{children:m})]}):null]})}var VP=[{textKey:`panel.onboarding.linuxStep1`},{text:`systemctl status firewalld`,cmd:!0},{text:`sudo ufw status`,cmd:!0},{textKey:`panel.onboarding.linuxStep2`},{text:`sudo firewall-cmd --permanent --add-port={port}/tcp
|