aims-workstation 0.1.20 → 0.1.21

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.
@@ -49,7 +49,7 @@ Error generating stack: `+e.message+`
49
49
  `},Qr=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},$r=function(){v.useEffect(function(){return document.body.setAttribute(Xr,(Qr()+1).toString()),function(){var e=Qr()-1;e<=0?document.body.removeAttribute(Xr):document.body.setAttribute(Xr,e.toString())}},[])},ei=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;$r();var a=v.useMemo(function(){return Jr(i)},[i]);return v.createElement(Yr,{styles:Zr(a,!t,i,n?``:`!important`)})},ti=!1;if(typeof window<`u`)try{var ni=Object.defineProperty({},"passive",{get:function(){return ti=!0,!0}});window.addEventListener(`test`,ni,ni),window.removeEventListener(`test`,ni,ni)}catch{ti=!1}var ri=ti?{passive:!1}:!1,ii=function(e){return e.tagName===`TEXTAREA`},ai=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!ii(e)&&n[t]===`visible`)},oi=function(e){return ai(e,`overflowY`)},si=function(e){return ai(e,`overflowX`)},ci=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),di(e,r)){var i=fi(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},li=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},ui=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},di=function(e,t){return e===`v`?oi(t):si(t)},fi=function(e,t){return e===`v`?li(t):ui(t)},pi=function(e,t){return e===`h`&&t===`rtl`?-1:1},mi=function(e,t,n,r,i){var a=pi(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=fi(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&di(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},hi=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},gi=function(e){return[e.deltaX,e.deltaY]},_i=function(e){return e&&`current`in e?e.current:e},vi=function(e,t){return e[0]===t[0]&&e[1]===t[1]},yi=function(e){return`
50
50
  .block-interactivity-${e} {pointer-events: none;}
51
51
  .allow-interactivity-${e} {pointer-events: all;}
52
- `},bi=0,xi=[];function Si(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(bi++)[0],a=v.useState(Wr)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=br([e.lockRef.current],(e.shards||[]).map(_i),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=v.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=hi(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ci(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ci(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return mi(h,t,e,h===`h`?s:c,!0)},[]),c=v.useCallback(function(e){var n=e;if(xi.length&&xi[xi.length-1]===a){var r=`deltaY`in n?gi(n):hi(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&vi(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(_i).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=v.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ci(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=v.useCallback(function(e){n.current=hi(e),r.current=void 0},[]),d=v.useCallback(function(t){l(t.type,gi(t),t.target,s(t,e.lockRef.current))},[]),f=v.useCallback(function(t){l(t.type,hi(t),t.target,s(t,e.lockRef.current))},[]);v.useEffect(function(){return xi.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ri),document.addEventListener(`touchmove`,c,ri),document.addEventListener(`touchstart`,u,ri),function(){xi=xi.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ri),document.removeEventListener(`touchmove`,c,ri),document.removeEventListener(`touchstart`,u,ri)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(a,{styles:yi(i)}):null,p?v.createElement(ei,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ci(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var wi=Pr(Fr,Si),Ti=v.forwardRef(function(e,t){return v.createElement(Lr,vr({},e,{ref:t,sideCar:wi}))});Ti.classNames=Lr.classNames;var Ei=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Di=new WeakMap,Oi=new WeakMap,ki={},Ai=0,ji=function(e){return e&&(e.host||ji(e.parentNode))},Mi=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ji(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Ni=function(e,t,n,r){var i=Mi(t,Array.isArray(e)?e:[e]);ki[n]||(ki[n]=new WeakMap);var a=ki[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Di.get(e)||0)+1,l=(a.get(e)||0)+1;Di.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Oi.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Ai++,function(){o.forEach(function(e){var t=Di.get(e)-1,i=a.get(e)-1;Di.set(e,t),a.set(e,i),t||(Oi.has(e)||e.removeAttribute(r),Oi.delete(e)),i||e.removeAttribute(n)}),Ai--,Ai||(Di=new WeakMap,Di=new WeakMap,Oi=new WeakMap,ki={})}},Pi=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Ei(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Ni(r,i,n,`aria-hidden`)):function(){return null}},Fi=Object.defineProperty,Ii=(e,t)=>Fi(e,`name`,{value:t,configurable:!0}),Li=`Dialog`,[Ri,zi]=xt(Li),[Bi,Vi]=Ri(Li),Hi=Ii(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),{nodes:l,registry:u}=Xn(),[d,f]=$t({prop:r,defaultProp:i??!1,onChange:a,caller:Li}),[p,m]=v.useState(0),[h,g]=v.useState(0);return(0,U.jsx)(Bi,{scope:t,triggerRef:s,contentRef:c,contentId:vn(),titleId:vn(),descriptionId:vn(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),Ui=`DialogPortal`,[Wi,Gi]=Ri(Ui,{forceMount:void 0}),Ki=Ii(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Vi(Ui,t);return(0,U.jsx)(Wi,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,U.jsx)(cn,{present:n||a.open,children:(0,U.jsx)(ur,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),qi=`DialogOverlay`,Ji=v.forwardRef(Ii(function(e,t){let n=Gi(qi,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Vi(qi,e.__scopeDialog);return a.modal?(0,U.jsx)(cn,{present:r||a.open,children:(0,U.jsx)(Xi,{...i,ref:t})}):null},`DialogOverlay`)),Yi=Ye(`DialogOverlay.RemoveScroll`),Xi=v.forwardRef(Ii(function(e,t){let{__scopeDialog:n,...r}=e,i=Vi(qi,n),a=H(t,In());return(0,U.jsx)(Ti,{as:Yi,allowPinchZoom:!0,shards:v.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,U.jsx)(W.div,{"data-state":sa(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Zi=`DialogContent`,Qi=v.forwardRef(Ii(function(e,t){let n=Gi(Zi,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Vi(Zi,e.__scopeDialog);return(0,U.jsx)(cn,{present:r||a.open,children:a.modal?(0,U.jsx)($i,{...i,ref:t}):(0,U.jsx)(ea,{...i,ref:t})})},`DialogContent`)),$i=v.forwardRef(Ii(function(e,t){let n=Vi(Zi,e.__scopeDialog),r=v.useRef(null),i=H(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return Pi(e)},[]),(0,U.jsx)(ta,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),ea=v.forwardRef(Ii(function(e,t){let n=Vi(Zi,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,U.jsx)(ta,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),ta=v.forwardRef(Ii(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=Vi(Zi,n);return gr(),(0,U.jsx)(Yn,{registry:l.branchRegistry,children:(0,U.jsx)(qn,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(Fn,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?oa(o,l.descriptionId):o,"data-state":sa(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),na=v.forwardRef(Ii(function(e,t){let{__scopeDialog:n,...r}=e,i=Vi(`DialogTitle`,n),{setTitleCount:a}=i;return Ct(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,U.jsx)(W.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),ra=v.forwardRef(Ii(function(e,t){let{__scopeDialog:n,...r}=e,i=Vi(`DialogDescription`,n),{setDescriptionCount:a}=i;return Ct(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,U.jsx)(W.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),ia=`DialogClose`,aa=v.forwardRef(Ii(function(e,t){let{__scopeDialog:n,...r}=e,i=Vi(ia,n);return(0,U.jsx)(W.button,{type:`button`,...r,ref:t,onClick:G(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function oa(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}Ii(oa,`concatAriaDescribedby`);function sa(e){return e?`open`:`closed`}Ii(sa,`getState`);var ca=Object.defineProperty,la=(e,t)=>ca(e,`name`,{value:t,configurable:!0});function ua(e){let[t,n]=v.useState(void 0);return Ct(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=0,r=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;let i=r[0];window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{let t,r;if(`borderBoxSize`in i){let e=i.borderBoxSize,n=Array.isArray(e)?e[0]:e;t=n.inlineSize,r=n.blockSize}else t=e.offsetWidth,r=e.offsetHeight;n({width:t,height:r})})});return r.observe(e,{box:`border-box`}),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}n(void 0)},[e]),t}la(ua,`useSize`);var da=Object.defineProperty,fa=(e,t)=>da(e,`name`,{value:t,configurable:!0}),pa=`Checkbox`,[ma,ha]=xt(pa),[ga,_a]=ma(pa);function va(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=$t({prop:n,defaultProp:i??!1,onChange:c,caller:pa}),[m,h]=v.useState(null),[g,_]=v.useState(null),[y,b]=v.useState(null),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,userClick:y,onUserClick:b,required:l,defaultChecked:!Da(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,U.jsx)(ga,{scope:t,...S,children:Ea(d)?d(S):r})}fa(va,`CheckboxProvider`);var ya=`CheckboxTrigger`,ba=v.forwardRef(fa(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,onUserClick:f,isFormControl:p,bubbleInput:m}=_a(ya,e),h=H(i,u),g=v.useRef(c);return v.useEffect(()=>{let e=a?.form;if(e){let t=fa(()=>d(g.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,U.jsx)(W.button,{type:`button`,role:`checkbox`,"aria-checked":Da(c)?`mixed`:c,"aria-required":l,"data-state":Oa(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:G(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:G(n,e=>{let t=e.isPropagationStopped();f({requestedChecked:Da(c)?!0:!c,hasConsumerStoppedPropagation:t}),d(e=>Da(e)?!0:!e),m&&p&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),xa=v.forwardRef(fa(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,U.jsx)(va,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ba,{...d,ref:t,__scopeCheckbox:n}),e&&(0,U.jsx)(Ta,{__scopeCheckbox:n})]})})},`Checkbox`)),Sa=`CheckboxIndicator`,Ca=v.forwardRef(fa(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=_a(Sa,n);return(0,U.jsx)(cn,{present:r||Da(a.checked)||a.checked===!0,children:(0,U.jsx)(W.span,{"data-state":Oa(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),wa=`CheckboxBubbleInput`,Ta=v.forwardRef(fa(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:c,disabled:l,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:m}=_a(wa,e),h=H(r,m),g=ua(i),_=v.useRef(!1),y=v.useRef(o),b=v.useRef(a),x=v.useRef(null);v.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=y.current!==o;y.current=o;let i=a!==null&&a!==b.current;if(b.current=a,i)x.current=r?null:a,r&&(e.indeterminate=Da(o),n.call(e,!Da(o)&&o)),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=x.current;x.current=null;let r=t?.requestedChecked===o;_.current=!0,e.indeterminate=Da(o),n.call(e,!Da(o)&&o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),_.current=!1}},[p,o,a]);let S=v.useRef(!Da(o)&&o);return(0,U.jsx)(W.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??S.current,required:c,disabled:l,name:u,value:d,form:f,...n,tabIndex:-1,ref:h,onClick:G(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function Ea(e){return typeof e==`function`}fa(Ea,`isFunction`);function Da(e){return e===`indeterminate`}fa(Da,`isIndeterminate`);function Oa(e){return Da(e)?`indeterminate`:e?`checked`:`unchecked`}fa(Oa,`getState`);var ka=[`top`,`right`,`bottom`,`left`],Aa=Math.min,ja=Math.max,Ma=Math.round,Na=Math.floor,Pa=e=>({x:e,y:e}),Fa={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ia(e,t,n){return ja(e,Aa(t,n))}function La(e,t){return typeof e==`function`?e(t):e}function Ra(e){return e.split(`-`)[0]}function za(e){return e.split(`-`)[1]}function Ba(e){return e===`x`?`y`:`x`}function Va(e){return e===`y`?`height`:`width`}function Ha(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ua(e){return Ba(Ha(e))}function Wa(e,t,n){n===void 0&&(n=!1);let r=za(e),i=Ua(e),a=Va(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=$a(o)),[o,$a(o)]}function Ga(e){let t=$a(e);return[Ka(e),t,Ka(t)]}function Ka(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var qa=[`left`,`right`],Ja=[`right`,`left`],Ya=[`top`,`bottom`],Xa=[`bottom`,`top`];function Za(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ja:qa:t?qa:Ja;case`left`:case`right`:return t?Ya:Xa;default:return[]}}function Qa(e,t,n,r){let i=za(e),a=Za(Ra(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ka)))),a}function $a(e){let t=Ra(e);return Fa[t]+e.slice(t.length)}function eo(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function to(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:eo(e)}function no(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ro(e,t,n){let{reference:r,floating:i}=e,a=Ha(t),o=Ua(t),s=Va(o),c=Ra(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=za(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function io(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=La(t,e),p=to(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=no(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=no(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ao=50,oo=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:io},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ro(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ao&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ro(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},so=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=La(e,t)||{};if(l==null)return{};let d=to(u),f={x:n,y:r},p=Ua(i),m=Va(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Aa(d[_],T),D=Aa(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Ia(E,k,O),j=!c.arrow&&za(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ee=j?k<E?k-E:k-O:0;return{[p]:f[p]+ee,data:{[p]:A,centerOffset:k-A-ee,...j&&{alignmentOffset:ee}},reset:j}}}),co=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=La(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ra(r),_=Ha(o),v=Ra(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[$a(o)]:Ga(o)),x=p!==`none`;!d&&x&&b.push(...Qa(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Wa(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Ha(t)||T.every(e=>Ha(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ha(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function lo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uo(e){return ka.some(t=>e[t]>=0)}var fo=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=La(e,t);switch(i){case`referenceHidden`:{let e=lo(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:uo(e)}}}case`escaped`:{let e=lo(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:uo(e)}}}default:return{}}}}},po=new Set([`left`,`top`]);async function mo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ra(n),s=za(n),c=Ha(n)===`y`,l=po.has(o)?-1:1,u=a&&c?-1:1,d=La(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ho=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await mo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},go=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=La(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ha(i),p=Ba(f),m=u[p],h=u[f],g=(e,t)=>Ia(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},_o=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=La(e,t),u={x:n,y:r},d=Ha(i),f=Ba(d),p=u[f],m=u[d],h=La(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=po.has(Ra(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},vo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=La(e,t),c=await i.detectOverflow(t,s),l=Ra(n),u=za(n),d=Ha(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Aa(p-c[m],g),y=Aa(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*ja(c.left,c.right):S=p-2*ja(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function yo(){return typeof window<`u`}function bo(e){return Co(e)?(e.nodeName||``).toLowerCase():`#document`}function xo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function So(e){return((Co(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Co(e){return yo()?e instanceof Node||e instanceof xo(e).Node:!1}function wo(e){return yo()?e instanceof Element||e instanceof xo(e).Element:!1}function To(e){return yo()?e instanceof HTMLElement||e instanceof xo(e).HTMLElement:!1}function Eo(e){return!yo()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof xo(e).ShadowRoot}function Do(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=K(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Oo(e){return/^(table|td|th)$/.test(bo(e))}function ko(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ao=/transform|translate|scale|rotate|perspective|filter/,jo=/paint|layout|strict|content/,Mo=e=>!!e&&e!==`none`,No;function Po(e){let t=wo(e)?K(e):e;return Mo(t.transform)||Mo(t.translate)||Mo(t.scale)||Mo(t.rotate)||Mo(t.perspective)||!Io()&&(Mo(t.backdropFilter)||Mo(t.filter))||Ao.test(t.willChange||``)||jo.test(t.contain||``)}function Fo(e){let t=zo(e);for(;To(t)&&!Lo(t);){if(Po(t))return t;if(ko(t))return null;t=zo(t)}return null}function Io(){return No??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),No}function Lo(e){return/^(html|body|#document)$/.test(bo(e))}function K(e){return xo(e).getComputedStyle(e)}function Ro(e){return wo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function zo(e){if(bo(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Eo(e)&&e.host||So(e);return Eo(t)?t.host:t}function Bo(e){let t=zo(e);return Lo(t)?(e.ownerDocument||e).body:To(t)&&Do(t)?t:Bo(t)}function Vo(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Bo(e),i=r===e.ownerDocument?.body,a=xo(r);if(i){let e=Ho(a);return t.concat(a,a.visualViewport||[],Do(r)?r:[],e&&n?Vo(e):[])}return t.concat(r,Vo(r,[],n))}function Ho(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Uo(e){let t=K(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=To(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ma(n)!==a||Ma(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Wo(e){return wo(e)?e:e.contextElement}function Go(e){let t=Wo(e);if(!To(t))return Pa(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Uo(t),o=(a?Ma(n.width):n.width)/r,s=(a?Ma(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ko=Pa(0);function qo(e){let t=xo(e);return!Io()||!t.visualViewport?Ko:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jo(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===xo(e)}function Yo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Wo(e),o=Pa(1);t&&(r?wo(r)&&(o=Go(r)):o=Go(e));let s=Jo(a,n,r)?qo(a):Pa(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=xo(a),t=wo(r)?xo(r):r,n=e,i=Ho(n);for(;i&&t!==n;){let e=Go(i),t=i.getBoundingClientRect(),r=K(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=xo(i),i=Ho(n)}}return no({width:u,height:d,x:c,y:l})}function Xo(e,t){let n=Ro(e).scrollLeft;return t?t.left+n:Yo(So(e)).left+n}function Zo(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Xo(e,n),y:n.top+t.scrollTop}}function Qo(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=So(r),s=t?ko(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Pa(1),u=Pa(0),d=To(r);if((d||!a)&&((bo(r)!==`body`||Do(o))&&(c=Ro(r)),d)){let e=Yo(r);l=Go(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Zo(o,c):Pa(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function $o(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function es(e){let t=Ro(e),n=e.ownerDocument.body,r=ja(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ja(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Xo(e),o=-t.scrollTop;return K(n).direction===`rtl`&&(a+=ja(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ts=25;function ns(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=xo(e),a=So(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Io()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Xo(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ts&&(s-=o)}return{width:s,height:c,x:l,y:u}}function rs(e,t){let n=Yo(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Go(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function is(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ns(e,n,t);else if(t===`document`)r=es(So(e));else if(wo(t))r=rs(t,n);else{let n=qo(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return no(r)}function as(e,t){let n=t.get(e);if(n)return n;let r=Vo(e,[],!1).filter(e=>wo(e)&&bo(e)!==`body`),i=null,a=K(e).position===`fixed`,o=a?zo(e):e;for(;wo(o)&&!Lo(o);){let e=K(o),t=Po(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=zo(o)}return t.set(e,r),r}function os(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ko(t)?[]:as(t,this._c):[].concat(n),r],o=is(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=is(t,a[e],i);s=ja(n.top,s),c=Aa(n.right,c),l=Aa(n.bottom,l),u=ja(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ss(e){let{width:t,height:n}=Uo(e);return{width:t,height:n}}function cs(e,t,n){let r=To(t),i=So(t),a=n===`fixed`,o=Yo(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Pa(0);if((r||!a)&&((bo(t)!==`body`||Do(i))&&(s=Ro(t)),r)){let e=Yo(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Xo(i));let l=i&&!r&&!a?Zo(i,s):Pa(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function ls(e){return K(e).position===`static`}function us(e,t){if(!To(e)||K(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return So(e)===n&&(n=n.ownerDocument.body),n}function ds(e,t){let n=xo(e);if(ko(e))return n;if(!To(e)){let t=zo(e);for(;t&&!Lo(t);){if(wo(t)&&!ls(t))return t;t=zo(t)}return n}let r=us(e,t);for(;r&&Oo(r)&&ls(r);)r=us(r,t);return r&&Lo(r)&&ls(r)&&!Po(r)?n:r||Fo(e)||n}var fs=async function(e){let t=this.getOffsetParent||ds,n=this.getDimensions,r=await n(e.floating);return{reference:cs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ps(e){return K(e).direction===`rtl`}var ms={convertOffsetParentRelativeRectToViewportRelativeRect:Qo,getDocumentElement:So,getClippingRect:os,getOffsetParent:ds,getElementRects:fs,getClientRects:$o,getDimensions:ss,getScale:Go,isElement:wo,isRTL:ps};function hs(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gs(e,t,n){let r=null,i,a=So(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Na(d),h=Na(a.clientWidth-(u+f)),g=Na(a.clientHeight-(d+p)),_=Na(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ja(0,Aa(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!hs(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=xo(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function _s(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Wo(e),u=i||a?[...l?Vo(l):[],...t?Vo(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?gs(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Yo(e):null;c&&g();function g(){let t=Yo(e);h&&!hs(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var vs=ho,ys=go,bs=co,xs=vo,Ss=fo,Cs=so,ws=_o,Ts=(e,t,n)=>{let r=new Map,i=n??{},a={...ms,...i.platform,_c:r};return oo(e,t,{...i,platform:a})},Es=typeof document<`u`?v.useLayoutEffect:function(){};function Ds(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ds(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ds(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Os(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ks(e,t){let n=Os(e);return Math.round(t*n)/n}function As(e){let t=v.useRef(e);return Es(()=>{t.current=e}),t}function js(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);Ds(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=As(c),O=As(i),k=As(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Ts(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Ds(T.current,t)&&(T.current=t,pt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Es(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);Es(()=>(j.current=!0,()=>{j.current=!1}),[]),Es(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let ee=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),M=v.useMemo(()=>({reference:x,floating:S}),[x,S]),N=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=ks(M.floating,u.x),r=ks(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Os(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:ee,elements:M,floatingStyles:N}),[u,A,ee,M,N])}var Ms=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Cs({element:r.current,padding:i}).fn(n):r?Cs({element:r,padding:i}).fn(n):{}}}},Ns=(e,t)=>{let n=vs(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ps=(e,t)=>{let n=ys(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fs=(e,t)=>({fn:ws(e).fn,options:[e,t]}),Is=(e,t)=>{let n=bs(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ls=(e,t)=>{let n=xs(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rs=(e,t)=>{let n=Ss(e);return{name:n.name,fn:n.fn,options:[e,t]}},zs=(e,t)=>{let n=Ms(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bs=Object.defineProperty,Vs=(e,t)=>Bs(e,`name`,{value:t,configurable:!0}),Hs={Partial:`partial`,Always:`always`},Us={Optimized:`optimized`,Always:`always`},Ws=`Popper`,[Gs,Ks]=xt(Ws),[qs,Js]=Gs(Ws),Ys=Vs(e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,U.jsx)(qs,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Xs=`PopperAnchor`,Zs=v.forwardRef(Vs(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Js(Xs,n),o=v.useRef(null),s=a.onAnchorChange,c=H(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&ic(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,U.jsx)(W.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Qs=`PopperContent`,[$s,ec]=Gs(Qs),tc=v.forwardRef(Vs(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=Hs.Partial,hideWhenDetached:f=!1,updatePositionStrategy:p=Us.Optimized,onPlaced:m,...h}=e,g=Js(Qs,n),[_,y]=v.useState(null),b=H(t,y),[x,S]=v.useState(null),C=ua(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(nc),altBoundary:k},{refs:j,floatingStyles:ee,placement:M,isPositioned:N,middlewareData:P}=js({strategy:`fixed`,placement:E,whileElementsMounted:Vs((...e)=>_s(...e,{animationFrame:p===Us.Always}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Ns({mainAxis:i+T,alignmentAxis:o}),c&&Ps({mainAxis:!0,crossAxis:!1,...d===Hs.Partial?{limiter:Fs()}:{},...A}),c&&Is({...A}),Ls({...A,apply:Vs(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),x&&zs({element:x,padding:s}),rc({arrowWidth:w,arrowHeight:T}),f&&Rs(k?{strategy:`referenceHidden`,...A}:{strategy:`referenceHidden`,padding:A.padding,altBoundary:A.altBoundary})]}),F=g.setPlacementState;Ct(()=>(F(M),()=>{F(void 0)}),[M,F]);let[I,L]=ic(M),te=Dn(m);Ct(()=>{N&&te?.()},[N,te]);let ne=P.arrow?.x,re=P.arrow?.y,ie=P.arrow?.centerOffset!==0,[ae,oe]=v.useState();return Ct(()=>{_&&oe(window.getComputedStyle(_).zIndex)},[_]),(0,U.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:N?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,U.jsx)($s,{scope:n,placedSide:I,placedAlign:L,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,U.jsx)(W.div,{"data-side":I,"data-align":L,...h,ref:b,style:{...h.style,animation:N?h.style?.animation:`none`}})})})},`PopperContent`));function nc(e){return e!==null}Vs(nc,`isNotNull`);var rc=Vs(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=ic(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function ic(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Vs(ic,`getSideAndAlignFromPlacement`);var ac=Object.defineProperty,oc=(e,t)=>ac(e,`name`,{value:t,configurable:!0}),sc=!1;function cc(){let[e,t]=v.useState(sc);return v.useEffect(()=>{sc||(sc=!0,t(!0))},[]),e}oc(cc,`useIsHydrated`);var lc=v.useSyncExternalStore;function uc(){return()=>{}}oc(uc,`subscribe`);function dc(){return lc(uc,()=>!0,()=>!1)}oc(dc,`useIsHydratedModern`);var fc=typeof lc==`function`?dc:cc,pc=Object.defineProperty,mc=(e,t)=>pc(e,`name`,{value:t,configurable:!0}),hc=`rovingFocusGroup.onEntryFocus`,gc={bubbles:!1,cancelable:!0},_c=`RovingFocusGroup`,[vc,yc,bc]=Et(_c),[xc,Sc]=xt(_c,[bc]),Cc={Vertical:`vertical`,Horizontal:`horizontal`},wc={LTR:`ltr`,RTL:`rtl`},[Tc,Ec]=xc(_c),Dc=v.forwardRef(mc(function(e,t){return(0,U.jsx)(vc.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,U.jsx)(vc.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,U.jsx)(Oc,{...e,ref:t})})})},`RovingFocusGroup`)),Oc=v.forwardRef(mc(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=v.useRef(null),p=H(t,f),m=Cn(a),[h,g]=$t({prop:o,defaultProp:s??null,onChange:c,caller:_c}),[_,y]=v.useState(!1),b=Dn(l),x=yc(n),S=v.useRef(!1),[C,w]=v.useState(0);return v.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(hc,b),()=>e.removeEventListener(hc,b)},[b]),(0,U.jsx)(Tc,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:v.useCallback(e=>g(e),[g]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:v.useCallback(()=>w(e=>e-1),[]),children:(0,U.jsx)(W.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:G(e.onMouseDown,()=>{S.current=!0}),onFocus:G(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(hc,gc);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Pc([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:G(e.onBlur,()=>y(!1))})})},`RovingFocusGroupImpl`)),kc=`RovingFocusGroupItem`,Ac=v.forwardRef(mc(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=vn(),l=a||c,u=Ec(kc,n),d=u.currentTabStopId===l,f=yc(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=fc();return Ct(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),v.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,U.jsx)(vc.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,U.jsx)(W.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:G(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:G(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:G(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Nc(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Fc(n,r+1):n.slice(r+1)}setTimeout(()=>Pc(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),jc={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Mc(e,t){return t===wc.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}mc(Mc,`getDirectionAwareKey`);function Nc(e,t,n){let r=Mc(e.key,n);if(!(t===Cc.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===Cc.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return jc[r]}mc(Nc,`getFocusIntent`);function Pc(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}mc(Pc,`focusFirst`);function Fc(e,t){return e.map((n,r)=>e[(t+r)%e.length])}mc(Fc,`wrapArray`);var Ic=Object.defineProperty,Lc=(e,t)=>Ic(e,`name`,{value:t,configurable:!0}),Rc=[`Enter`,` `],zc=[`ArrowDown`,`PageUp`,`Home`],Bc=[`ArrowUp`,`PageDown`,`End`],Vc=[...zc,...Bc];[...Rc],[...Rc];var Hc=`Menu`,[Uc,Wc,Gc]=Et(Hc),[Kc,qc]=xt(Hc,[Gc,Ks,Sc]),Jc=Ks(),Yc=Sc(),[Xc,Zc]=Kc(Hc),[Qc,$c]=Kc(Hc),el=Lc(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Jc(t),[c,l]=v.useState(null),u=v.useRef(!1),d=Dn(a),f=Cn(i);return v.useEffect(()=>{let e=Lc(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Lc(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),v.useEffect(()=>{if(!n)return;let e=Lc(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,U.jsx)(Ys,{...s,children:(0,U.jsx)(Xc,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,U.jsx)(Qc,{scope:t,onClose:v.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),tl=v.forwardRef(Lc(function(e,t){let{__scopeMenu:n,...r}=e,i=Jc(n);return(0,U.jsx)(Zs,{...i,...r,ref:t})},`MenuAnchor`)),nl=`MenuPortal`,[rl,il]=Kc(nl,{forceMount:void 0}),al=Lc(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Zc(nl,t);return(0,U.jsx)(rl,{scope:t,forceMount:n,children:(0,U.jsx)(cn,{present:n||a.open,children:(0,U.jsx)(ur,{asChild:!0,container:i,children:r})})})},`MenuPortal`),ol=`MenuContent`,[sl,cl]=Kc(ol),ll=v.forwardRef(Lc(function(e,t){let n=il(ol,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Zc(ol,e.__scopeMenu),o=$c(ol,e.__scopeMenu);return(0,U.jsx)(Uc.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(cn,{present:r||a.open,children:(0,U.jsx)(Uc.Slot,{scope:e.__scopeMenu,children:o.modal?(0,U.jsx)(ul,{...i,ref:t}):(0,U.jsx)(dl,{...i,ref:t})})})})},`MenuContent`)),ul=v.forwardRef(Lc(function(e,t){let n=Zc(ol,e.__scopeMenu),r=v.useRef(null),i=H(t,r);return v.useEffect(()=>{let e=r.current;if(e)return Pi(e)},[]),(0,U.jsx)(pl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),dl=v.forwardRef(Lc(function(e,t){let n=Zc(ol,e.__scopeMenu);return(0,U.jsx)(pl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),fl=Ye(`MenuContent.ScrollLock`),pl=v.forwardRef(Lc(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Zc(ol,n),_=$c(ol,n),y=Jc(n),b=Yc(n),x=Wc(n),[S,C]=v.useState(null),w=v.useRef(null),[T,E]=v.useState(null);Zn(T);let{nodes:D,registry:O}=Xn(),k=!!(i||m),A=H(t,w,g.onContentChange,E),j=v.useRef(0),ee=v.useRef(``),M=v.useRef(0),N=v.useRef(null),P=v.useRef(`right`),F=v.useRef(0),I=v.useMemo(()=>m?[w,...D.map(e=>({current:e}))]:[],[w,D,m]),L=m?Ti:v.Fragment,te=m?{as:fl,allowPinchZoom:!0,shards:I}:void 0,ne=Lc(e=>{let t=ee.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Al(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){ee.current=e,window.clearTimeout(j.current),e!==``&&(j.current=window.setTimeout(()=>s(``),1e3))}Lc(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);v.useEffect(()=>()=>window.clearTimeout(j.current),[]),gr();let re=v.useCallback(e=>P.current===N.current?.side&&Ml(e,N.current?.area),[]);return(0,U.jsx)(sl,{scope:n,searchRef:ee,onItemEnter:v.useCallback(e=>{re(e)&&e.preventDefault()},[re]),onItemLeave:v.useCallback(e=>{re(e)||(w.current?.focus(),C(null))},[re]),onTriggerLeave:v.useCallback(e=>{re(e)&&e.preventDefault()},[re]),pointerGraceTimerRef:M,onPointerGraceIntentChange:v.useCallback(e=>{N.current=e},[]),children:(0,U.jsx)(Yn,{registry:k?O:null,children:(0,U.jsx)(L,{...te,children:(0,U.jsx)(qn,{asChild:!0,trapped:i,branches:D,onMountAutoFocus:G(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,U.jsx)(Fn,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,U.jsx)(Dc,{asChild:!0,...b,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:G(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,U.jsx)(tc,{role:`menu`,"aria-orientation":`vertical`,"data-state":Tl(g.open),"data-radix-menu-content":``,dir:_.dir,...y,...h,ref:A,style:{outline:`none`,...h.style},onKeyDown:G(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ne(e.key));let i=w.current;if(e.target!==i||!Vc.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Bc.includes(e.key)&&a.reverse(),Ol(a)}),onBlur:G(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(j.current),ee.current=``)}),onPointerMove:G(e.onPointerMove,Nl(e=>{let t=e.target,n=F.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>F.current?`right`:`left`;P.current=t,F.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),ml=`MenuItem`,hl=`menu.itemSelect`,gl=v.forwardRef(Lc(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=v.useRef(null),o=$c(ml,e.__scopeMenu),s=cl(ml,e.__scopeMenu),c=H(t,a),l=v.useRef(!1),u=Lc(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(hl,{bubbles:!0,cancelable:!0});e.addEventListener(hl,e=>r?.(e),{once:!0}),gt(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,U.jsx)(_l,{...i,ref:c,disabled:n,onClick:G(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:G(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:G(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&Rc.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),_l=v.forwardRef(Lc(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=cl(ml,n),s=Yc(n),c=v.useRef(null),l=H(t,c),[u,d]=v.useState(!1),[f,p]=v.useState(``);return v.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,U.jsx)(Uc.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,U.jsx)(Ac,{asChild:!0,...s,focusable:!r,children:(0,U.jsx)(W.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:G(e.onPointerMove,Nl(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(e.onPointerLeave,Nl(e=>o.onItemLeave(e))),onFocus:G(e.onFocus,()=>d(!0)),onBlur:G(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[vl,yl]=Kc(`MenuRadioGroup`,{value:void 0,onValueChange:Lc(()=>{},`onValueChange`)}),[bl,xl]=Kc(`MenuItemIndicator`,{checked:!1}),Sl=v.forwardRef(Lc(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(W.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Cl,wl]=Kc(`MenuSub`);function Tl(e){return e?`open`:`closed`}Lc(Tl,`getOpenState`);function El(e){return e===`indeterminate`}Lc(El,`isIndeterminate`);function Dl(e){return El(e)?`indeterminate`:e?`checked`:`unchecked`}Lc(Dl,`getCheckedState`);function Ol(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Lc(Ol,`focusFirst`);function kl(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Lc(kl,`wrapArray`);function Al(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=kl(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Lc(Al,`getNextMatch`);function jl(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Lc(jl,`isPointInPolygon`);function Ml(e,t){return t?jl({x:e.clientX,y:e.clientY},t):!1}Lc(Ml,`isPointerInGraceArea`);function Nl(e){return t=>t.pointerType===`mouse`?e(t):void 0}Lc(Nl,`whenMouse`);var Pl=Object.defineProperty,Fl=(e,t)=>Pl(e,`name`,{value:t,configurable:!0}),Il=`DropdownMenu`,[Ll,Rl]=xt(Il,[qc]),zl=qc(),[Bl,Vl]=Ll(Il),Hl=Fl(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=zl(t),l=v.useRef(null),[u,d]=$t({prop:i,defaultProp:a??!1,onChange:o,caller:Il});return(0,U.jsx)(Bl,{scope:t,triggerId:vn(),triggerRef:l,contentId:vn(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,U.jsx)(el,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),Ul=`DropdownMenuTrigger`,Wl=v.forwardRef(Fl(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Vl(Ul,n),o=zl(n),s=H(t,a.triggerRef);return(0,U.jsx)(tl,{asChild:!0,...o,children:(0,U.jsx)(W.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:G(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:G(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),Gl=Fl(e=>{let{__scopeDropdownMenu:t,...n}=e,r=zl(t);return(0,U.jsx)(al,{...r,...n})},`DropdownMenuPortal`),Kl=`DropdownMenuContent`,ql=v.forwardRef(Fl(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Vl(Kl,n),a=zl(n),o=v.useRef(!1);return(0,U.jsx)(ll,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:G(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Jl=v.forwardRef(Fl(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=zl(n);return(0,U.jsx)(gl,{...i,...r,ref:t})},`DropdownMenuItem`)),Yl=v.forwardRef(Fl(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=zl(n);return(0,U.jsx)(Sl,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Xl=Object.defineProperty,Zl=v.forwardRef(((e,t)=>Xl(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,U.jsx)(W.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Ql=Object.defineProperty,$l=(e,t)=>Ql(e,`name`,{value:t,configurable:!0});function eu(e,[t,n]){return Math.min(n,Math.max(t,e))}$l(eu,`clamp`);var tu=Object.defineProperty,q=(e,t)=>tu(e,`name`,{value:t,configurable:!0});function nu(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}q(nu,`useStateMachine`);var ru={Auto:`auto`,Always:`always`,Scroll:`scroll`,Hover:`hover`},iu={Vertical:`vertical`,Horizontal:`horizontal`},au={LTR:`ltr`,RTL:`rtl`},ou=`ScrollArea`,[su,cu]=xt(ou),[lu,uu]=su(ou),du=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,type:r=ru.Hover,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=v.useState(null),[l,u]=v.useState(null),[d,f]=v.useState(null),[p,m]=v.useState(null),[h,g]=v.useState(null),[_,y]=v.useState(0),[b,x]=v.useState(0),[S,C]=v.useState(!1),[w,T]=v.useState(!1),E=H(t,c),D=Cn(i);return(0,U.jsx)(lu,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,U.jsx)(W.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":b+`px`,...e.style}})})},`ScrollArea`)),fu=`ScrollAreaViewport`,pu=Qe(fu),mu=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,disableImplicitContentElement:a,...o}=e,s=uu(fu,n),c=H(t,v.useRef(null),s.onViewportChange),l=v.isValidElement(r);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(hu,{nonce:i}),(0,U.jsx)(W.div,{"data-radix-scroll-area-viewport":``,...o,ref:c,style:{overflowX:s.scrollbarXEnabled?`scroll`:`hidden`,overflowY:s.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:a?r:l?(0,U.jsx)(pu,{child:r,children:e=>(0,U.jsx)(_u,{__scopeScrollArea:n,children:e})}):(0,U.jsx)(pu,{children:(0,U.jsx)(_u,{__scopeScrollArea:n,children:r})})})]})},`ScrollAreaViewport`)),hu=v.memo(q(function({nonce:e}){return(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),gu=`ScrollAreaContent`,_u=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,children:r,...i}=e,a=H(t,uu(gu,n).onContentChange);return(0,U.jsx)(W.div,{...i,ref:a,style:{minWidth:`100%`,display:`table`,...e.style},children:r})},`ScrollAreaContent`)),vu=`ScrollAreaScrollbar`,yu=v.forwardRef(q(function(e,t){let{forceMount:n,...r}=e,i=uu(vu,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===iu.Horizontal;return v.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===ru.Hover?(0,U.jsx)(bu,{...r,ref:t,forceMount:n}):i.type===ru.Scroll?(0,U.jsx)(xu,{...r,ref:t,forceMount:n}):i.type===ru.Auto?(0,U.jsx)(Su,{...r,ref:t,forceMount:n}):i.type===ru.Always?(0,U.jsx)(Cu,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),bu=v.forwardRef(q(function(e,t){let{forceMount:n,...r}=e,i=uu(vu,e.__scopeScrollArea),[a,o]=v.useState(!1);return v.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=q(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=q(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,U.jsx)(cn,{present:n||a,children:(0,U.jsx)(Su,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),xu=v.forwardRef(q(function(e,t){let{forceMount:n,...r}=e,i=uu(vu,e.__scopeScrollArea),a=e.orientation===iu.Horizontal,o=Uu(()=>c(`SCROLL_END`),100),[s,c]=nu(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return v.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),v.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=q(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,U.jsx)(cn,{present:n||s!==`hidden`,children:(0,U.jsx)(Cu,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:G(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:G(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),Su=v.forwardRef(q(function(e,t){let n=uu(vu,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=v.useState(!1),s=e.orientation===iu.Horizontal,c=Uu(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Wu(n.viewport,c),Wu(n.content,c),(0,U.jsx)(cn,{present:r||a,children:(0,U.jsx)(Cu,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),Cu=v.forwardRef(q(function(e,t){let{orientation:n=iu.Vertical,...r}=e,i=uu(vu,e.__scopeScrollArea),a=v.useRef(null),o=v.useRef(0),[s,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Iu(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:q(e=>a.current=e,`onThumbChange`),onThumbPointerUp:q(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:q(e=>o.current=e,`onThumbPointerDown`)};function d(e,t){return Ru(e,o.current,s,t)}return q(d,`getScrollPosition`),n===iu.Horizontal?(0,U.jsx)(wu,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=zu(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===iu.Vertical?(0,U.jsx)(Tu,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=zu(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null},`ScrollAreaScrollbarVisible`)),wu=v.forwardRef(q(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=uu(vu,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=H(t,c,a.onScrollbarXChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,U.jsx)(Ou,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===au.RTL?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===au.LTR?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Lu(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Vu(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Fu(o.paddingLeft),paddingEnd:Fu(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),Tu=v.forwardRef(q(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=uu(vu,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=H(t,c,a.onScrollbarYChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,U.jsx)(Ou,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===au.LTR?0:void 0,left:a.dir===au.RTL?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Lu(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Vu(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Fu(o.paddingTop),paddingEnd:Fu(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[Eu,Du]=su(vu),Ou=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=uu(vu,n),[m,h]=v.useState(null),g=H(t,h),_=v.useRef(null),y=v.useRef(``),b=p.viewport,x=r.content-r.viewport,S=Dn(u),C=Dn(c),w=Uu(d,10);function T(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return q(T,`handleDragScroll`),v.useEffect(()=>{let e=q(e=>{let t=e.target;m?.contains(t)&&S(e,x)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[b,m,x,S]),v.useEffect(C,[r,C]),Wu(m,w),Wu(p.content,w),(0,U.jsx)(Eu,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Dn(a),onThumbPointerUp:Dn(o),onThumbPositionChange:C,onThumbPointerDown:Dn(s),children:(0,U.jsx)(W.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:G(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:G(e.onPointerMove,T),onPointerUp:G(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})},`ScrollAreaScrollbarImpl`)),ku=`ScrollAreaThumb`,Au=v.forwardRef(q(function(e,t){let{forceMount:n,...r}=e,i=Du(ku,e.__scopeScrollArea);return(0,U.jsx)(cn,{present:n||i.hasThumb,children:(0,U.jsx)(ju,{ref:t,...r})})},`ScrollAreaThumb`)),ju=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=uu(ku,n),o=Du(ku,n),{onThumbPositionChange:s}=o,c=H(t,o.onThumbChange),l=v.useRef(void 0),u=Uu(()=>{l.current&&=(l.current(),void 0)},100);return v.useEffect(()=>{let e=a.viewport;if(e){let t=q(()=>{if(u(),!l.current){let t=Hu(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,U.jsx)(W.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:G(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:G(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),Mu=`ScrollAreaCorner`,Nu=v.forwardRef(q(function(e,t){let n=uu(Mu,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==ru.Scroll&&r?(0,U.jsx)(Pu,{...e,ref:t}):null},`ScrollAreaCorner`)),Pu=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,...r}=e,i=uu(Mu,n),[a,o]=v.useState(0),[s,c]=v.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return Wu(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Wu(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),v.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,U.jsx)(W.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===au.LTR?0:void 0,left:i.dir===au.RTL?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function Fu(e){return e?parseInt(e,10):0}q(Fu,`toInt`);function Iu(e,t){let n=e/t;return isNaN(n)?0:n}q(Iu,`getThumbRatio`);function Lu(e){let t=Iu(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}q(Lu,`getThumbSize`);function Ru(e,t,n,r=au.LTR){let i=Lu(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===au.LTR?[0,u]:[u*-1,0];return Bu([c,l],d)(e)}q(Ru,`getScrollPositionFromPointer`);function zu(e,t,n=au.LTR){let r=Lu(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=eu(e,n===au.LTR?[0,o]:[o*-1,0]);return Bu([0,o],[0,s])(c)}q(zu,`getThumbOffsetFromScroll`);function Bu(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}q(Bu,`linearScale`);function Vu(e,t){return e>0&&e<t}q(Vu,`isScrollingWithinScrollbarBounds`);var Hu=q((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)}return q(i,`loop`),i(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function Uu(e,t){let n=Dn(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}q(Uu,`useDebounceCallback`);function Wu(e,t){let n=Dn(t);Ct(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}q(Wu,`useResizeObserver`);var Gu=Object.defineProperty,Ku=(e,t)=>Gu(e,`name`,{value:t,configurable:!0}),qu={ItemAligned:`item-aligned`,Popper:`popper`},Ju={LTR:`ltr`,RTL:`rtl`},Yu=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Xu=[` `,`Enter`],Zu=`Select`,[Qu,$u,ed]=Et(Zu),[td,nd]=xt(Zu,[ed,Ks]),rd=Ks(),[id,ad]=td(Zu),[od,sd]=td(Zu);function cd(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=rd(t),[_,y]=v.useState(null),[b,x]=v.useState(null),[S,C]=v.useState(!1),w=Cn(l),[T,E]=$t({prop:r,defaultProp:i??!1,onChange:a,caller:Zu}),[D,O]=$t({prop:o,defaultProp:s,onChange:c,caller:Zu}),k=v.useRef(null),A=v.useRef(!1),[j,ee]=v.useState(null),M=Ku(e=>{ee({value:e,hasConsumerStoppedPropagation:A.current}),O(e)},`handleUserSelect`),N=v.useRef(D);v.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=Ku(()=>O(N.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,O]);let P=!_||!!m||!!_.closest(`form`),[F,I]=v.useState(new Set),L=vn(),te=Array.from(F).map(e=>e.props.value).join(`;`),ne=v.useCallback(e=>{I(t=>new Set(t).add(e))},[]),re=v.useCallback(e=>{I(t=>{let n=new Set(t);return n.delete(e),n})},[]),ie={required:p,trigger:_,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:L,value:D,onValueChange:O,hasConsumerStoppedPropagationRef:A,userSelection:j,onUserSelect:M,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:F,nativeSelectKey:te,isFormControl:P};return(0,U.jsx)(Ys,{...g,children:(0,U.jsx)(id,{scope:t,...ie,children:(0,U.jsx)(Qu.Provider,{scope:t,children:(0,U.jsx)(od,{scope:t,onNativeOptionAdd:ne,onNativeOptionRemove:re,children:Yd(h)?h(ie):n})})})})}Ku(cd,`SelectProvider`);var ld=Ku(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,U.jsx)(cd,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[n,e?(0,U.jsx)(Jd,{__scopeSelect:t}):null]})})},`Select`),ud=`SelectTrigger`,dd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=rd(n),o=ad(ud,n),s=o.disabled||r,c=H(t,o.onTriggerChange),l=$u(n),u=v.useRef(`touch`),[d,f,p]=Zd(e=>{let t=l().filter(e=>!e.disabled),n=Qd(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onUserSelect(n.value)}),m=Ku(e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,U.jsx)(Zs,{asChild:!0,...a,children:(0,U.jsx)(W.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Xd(o.value)?``:void 0,...i,ref:c,onClick:G(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:G(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:G(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(o.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),f(e.key)),!(t&&e.key===` `)&&Yu.includes(e.key)&&(m(),e.preventDefault())})})})},`SelectTrigger`)),fd=`SelectValue`,pd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=ad(fd,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=H(t,c.onValueNodeChange);Ct(()=>{l(u)},[l,u]);let f=Xd(c.value);return(0,U.jsx)(W.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,U.jsx)(v.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),md=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,U.jsx)(W.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[hd,gd]=td(`SelectPortal`,{forceMount:void 0}),_d=Ku(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,U.jsx)(hd,{scope:e.__scopeSelect,forceMount:n,children:(0,U.jsx)(ur,{asChild:!0,...r})})},`SelectPortal`),vd=`SelectContent`,yd=v.forwardRef(Ku(function(e,t){let n=gd(vd,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=ad(vd,e.__scopeSelect),[o,s]=v.useState();return Ct(()=>{s(new DocumentFragment)},[]),(0,U.jsx)(cn,{present:r||a.open,children:({present:e})=>e?(0,U.jsx)(Td,{...i,ref:t}):(0,U.jsx)(bd,{...i,fragment:o})})},`SelectContent`)),bd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?pt.createPortal((0,U.jsx)(Sd,{scope:n,children:(0,U.jsx)(Qu.Slot,{scope:n,children:(0,U.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),xd=10,[Sd,Cd]=td(vd),wd=Ye(`SelectContent.RemoveScroll`),Td=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n}=e,{position:r=qu.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,y=ad(vd,n),[b,x]=v.useState(null),[S,C]=v.useState(null),w=H(t,x),[T,E]=v.useState(null),[D,O]=v.useState(null),k=$u(n),[A,j]=v.useState(!1),ee=v.useRef(!1),M=v.useRef(!1),N=v.useRef(!1);v.useEffect(()=>{if(b)return Pi(b)},[b]),gr();let P=v.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),F=v.useCallback(()=>P([T,b]),[P,T,b]);v.useEffect(()=>{A&&F()},[A,F]);let{onOpenChange:I,triggerPointerDownPosRef:L}=y;v.useEffect(()=>{if(b){let e={x:0,y:0},t=Ku(t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},`handlePointerMove`),n=Ku(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(b)||I(!1),document.removeEventListener(`pointermove`,t),L.current=null},`handlePointerUp`);return L.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,I,L]),v.useEffect(()=>{let e=Ku(()=>I(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[I]);let[te,ne]=Zd(e=>{let t=k().filter(e=>!e.disabled),n=Qd(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=v.useCallback((e,t,n)=>{let r=!M.current;r&&(M.current=!0);let i=!ee.current&&!n;y.value!==void 0&&y.value===t||i?(E(e),i&&(ee.current=!0)):r&&E(e)},[y.value]),ie=v.useCallback(()=>b?.focus(),[b]),ae=v.useCallback((e,t,n)=>{if(!e)return;let r=!N.current;r&&(N.current=!0);let i=!ee.current&&!n;(y.value!==void 0&&y.value===t||i||r)&&O(e)},[y.value]),oe=r===qu.Popper?Dd:Ed,se=oe===Dd?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,U.jsx)(Sd,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:re,selectedItem:T,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:F,selectedItemText:D,position:r,isPositioned:A,searchRef:te,children:(0,U.jsx)(Ti,{as:wd,allowPinchZoom:!0,children:(0,U.jsx)(qn,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:G(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,U.jsx)(Fn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,U.jsx)(oe,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:G(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>P(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Ed=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=ad(vd,n),o=Cd(vd,n),[s,c]=v.useState(null),[l,u]=v.useState(null),d=H(t,u),f=$u(n),p=v.useRef(!1),m=v.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:y}=o,b=v.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==Ju.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-xd,d=eu(a,[xd,Math.max(xd,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-xd,d=eu(a,[xd,Math.max(xd,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-xd*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-xd,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${xd}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Ct(()=>b(),[b]);let[x,S]=v.useState();Ct(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]);let C=v.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]);return(0,U.jsx)(Od,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:C,children:(0,U.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,U.jsx)(W.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),Dd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=xd,...a}=e,o=rd(n);return(0,U.jsx)(tc,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[Od,kd]=td(vd,{}),Ad=`SelectViewport`,jd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Cd(Ad,n),o=kd(Ad,n),s=H(t,a.onViewportChange),c=v.useRef(0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,U.jsx)(Qu.Slot,{scope:n,children:(0,U.jsx)(W.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:G(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-xd*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[Md,Nd]=td(`SelectGroup`),Pd=`SelectItem`,[Fd,Id]=td(Pd),Ld=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=ad(Pd,n),c=Cd(Pd,n),l=s.value===r,[u,d]=v.useState(a??``),[f,p]=v.useState(!1),m=H(t,Dn(e=>c.itemRefCallback?.(e,r,i))),h=vn(),g=v.useRef(`touch`);function _(e){s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),s.onUserSelect(r),s.onOpenChange(!1)}return Ku(_,`handleSelect`),(0,U.jsx)(Fd,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:v.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,U.jsx)(Qu.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,U.jsx)(W.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:G(o.onFocus,()=>p(!0)),onBlur:G(o.onBlur,()=>p(!1)),onClick:G(o.onClick,e=>{i||g.current!==`mouse`&&_(e)}),onPointerUp:G(o.onPointerUp,e=>{i||g.current===`mouse`&&_(e)}),onPointerDown:G(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:G(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:G(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:G(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(Xu.includes(e.key)&&_(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Rd=`SelectItemText`,zd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=ad(Rd,n),s=Cd(Rd,n),c=Id(Rd,n),l=sd(Rd,n),[u,d]=v.useState(null),f=Dn(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=H(t,d,c.onItemTextChange,f),m=u?.textContent,h=v.useMemo(()=>(0,U.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return Ct(()=>(g(h),()=>_(h)),[g,_,h]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(W.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Xd(o.value)?pt.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),Bd=`SelectItemIndicator`,Vd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,...r}=e;return Id(Bd,n).isSelected?(0,U.jsx)(W.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Hd=`SelectScrollUpButton`,Ud=v.forwardRef(Ku(function(e,t){let n=Cd(Hd,e.__scopeSelect),r=kd(Hd,e.__scopeSelect),[i,a]=v.useState(!1),o=H(t,r.onScrollButtonChange);return Ct(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};Ku(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(Kd,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Wd=`SelectScrollDownButton`,Gd=v.forwardRef(Ku(function(e,t){let n=Cd(Wd,e.__scopeSelect),r=kd(Wd,e.__scopeSelect),[i,a]=v.useState(!1),o=H(t,r.onScrollButtonChange);return Ct(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};Ku(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(Kd,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),Kd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Cd(`SelectScrollButton`,n),o=v.useRef(null),s=$u(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Ct(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,U.jsx)(W.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:G(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:G(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:G(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),qd=`SelectBubbleInput`,Jd=v.forwardRef(Ku(function({__scopeSelect:e,...t},n){let r=ad(qd,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u,userSelection:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=v.useRef(null),h=H(n,m),g=i??``,_=v.useRef(g),y=v.useRef(d),b=v.useRef(!1),x=Array.from(f).some(e=>(e.props.value??``)===``);return v.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=d!==null&&d!==y.current;y.current=d;let i=_.current!==g;_.current=g;let a=r&&i;if(r&&!i&&d.value!==g&&!d.hasConsumerStoppedPropagation&&n){b.current=!0;try{n.call(e,d.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{b.current=!1,n.call(e,g)}return}let o=a&&!d.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,g),e.dispatchEvent(t)}},[g,d]),(0,U.jsxs)(W.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>{b.current||a(e.target.value)},...t,style:{..._t,...t.style},ref:h,defaultValue:g,children:[Xd(i)&&!x?(0,U.jsx)(`option`,{value:``}):null,Array.from(f)]},p)},`SelectBubbleInput`));function Yd(e){return typeof e==`function`}Ku(Yd,`isFunction`);function Xd(e){return e===``||e===void 0}Ku(Xd,`shouldShowPlaceholder`);function Zd(e){let t=Dn(e),n=v.useRef(``),r=v.useRef(0),i=v.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}Ku(a,`updateSearch`),a(i)},[t]),a=v.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}Ku(Zd,`useTypeaheadSearch`);function Qd(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=$d(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Ku(Qd,`findNextItem`);function $d(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ku($d,`wrapArray`);var ef=Object.defineProperty,tf=(e,t)=>ef(e,`name`,{value:t,configurable:!0}),nf={Horizontal:`horizontal`,Vertical:`vertical`},rf=nf.Horizontal,af=Object.values(nf),of=v.forwardRef(tf(function(e,t){let{decorative:n,orientation:r=rf,...i}=e,a=sf(r)?r:rf,o=a===nf.Vertical?a:void 0,s=n?{role:`none`}:{"aria-orientation":o,role:`separator`};return(0,U.jsx)(W.div,{"data-orientation":a,...s,...i,ref:t})},`Separator`));function sf(e){return af.includes(e)}tf(sf,`isValidOrientation`);var cf=Object.defineProperty,lf=(e,t)=>cf(e,`name`,{value:t,configurable:!0}),uf=`Switch`,[df,ff]=xt(uf),[pf,mf]=df(uf);function hf(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=$t({prop:n,defaultProp:i??!1,onChange:c,caller:uf}),[m,h]=v.useState(null),[g,_]=v.useState(null),[y,b]=v.useState(null),x={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,userClick:y,onUserClick:b,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,U.jsx)(pf,{scope:t,...x,children:Cf(d)?d(x):r})}lf(hf,`SwitchProvider`);var gf=`SwitchTrigger`,_f=v.forwardRef(lf(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,onUserClick:f,isFormControl:p,bubbleInput:m}=mf(gf,e),h=H(r,u),g=v.useRef(c);return v.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=lf(()=>d(g.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,U.jsx)(W.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":wf(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:G(t,e=>{let t=e.isPropagationStopped();f({requestedChecked:!c,hasConsumerStoppedPropagation:t}),d(e=>!e),m&&p&&(t||e.stopPropagation())})})},`SwitchTrigger`)),vf=v.forwardRef(lf(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,U.jsx)(hf,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(_f,{...d,ref:t,__scopeSwitch:n}),e&&(0,U.jsx)(Sf,{__scopeSwitch:n})]})})},`Switch`)),yf=`SwitchThumb`,bf=v.forwardRef(lf(function(e,t){let{__scopeSwitch:n,...r}=e,i=mf(yf,n);return(0,U.jsx)(W.span,{"data-state":wf(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),xf=`SwitchBubbleInput`,Sf=v.forwardRef(lf(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:c,disabled:l,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:m}=mf(xf,e),h=H(r,m),g=ua(i),_=v.useRef(!1),y=v.useRef(o),b=v.useRef(a),x=v.useRef(null);v.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=y.current!==o;y.current=o;let i=a!==null&&a!==b.current;if(b.current=a,i)x.current=r?null:a,r&&n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=x.current;x.current=null;let r=t?.requestedChecked===o;_.current=!0,n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),_.current=!1}},[p,o,a]);let S=v.useRef(o);return(0,U.jsx)(W.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??S.current,required:c,disabled:l,name:u,value:d,form:f,...n,tabIndex:-1,ref:h,onClick:G(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function Cf(e){return typeof e==`function`}lf(Cf,`isFunction`);function wf(e){return e?`checked`:`unchecked`}lf(wf,`getState`);var Tf=Object.defineProperty,Ef=(e,t)=>Tf(e,`name`,{value:t,configurable:!0}),Df={Automatic:`automatic`,Manual:`manual`},Of=`Tabs`,[kf,Af]=xt(Of,[Sc]),jf=Sc(),[Mf,Nf]=kf(Of),Pf=v.forwardRef(Ef(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=Df.Automatic,...l}=e,u=Cn(s),[d,f]=$t({prop:r,onChange:i,defaultProp:a??``,caller:Of});return(0,U.jsx)(Mf,{scope:n,baseId:vn(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,U.jsx)(W.div,{dir:u,"data-orientation":o,...l,ref:t})})},`Tabs`)),Ff=`TabsList`,If=v.forwardRef(Ef(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=Nf(Ff,n),o=jf(n);return(0,U.jsx)(Dc,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,U.jsx)(W.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),Lf=`TabsTrigger`,Rf=v.forwardRef(Ef(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Nf(Lf,n),s=jf(n),c=Vf(o.baseId,r),l=Hf(o.baseId,r),u=r===o.value;return(0,U.jsx)(Ac,{asChild:!0,...s,focusable:!i,active:u,children:(0,U.jsx)(W.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:G(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?(e.currentTarget.focus(),o.onValueChange(r)):e.preventDefault()}),onKeyDown:G(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:G(e.onFocus,()=>{let e=o.activationMode!==Df.Manual;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),zf=`TabsContent`,Bf=v.forwardRef(Ef(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Nf(zf,n),c=Vf(s.baseId,r),l=Hf(s.baseId,r),u=r===s.value,d=v.useRef(u);return v.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,U.jsx)(cn,{present:i||u,children:({present:n})=>(0,U.jsx)(W.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function Vf(e,t){return`${e}-trigger-${t}`}Ef(Vf,`makeTriggerId`);function Hf(e,t){return`${e}-content-${t}`}Ef(Hf,`makeContentId`);var Uf=He(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function J({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?Xe:`span`;return(0,U.jsx)(i,{"data-slot":`badge`,"data-variant":t,className:B(Uf({variant:t}),e),...r})}var Wf=He(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40`,outline:`border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,xs:`h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-9`,"icon-xs":`size-6 rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function Y({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?Xe:`button`;return(0,U.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:B(Wf({variant:t,size:n,className:e})),...i})}function Gf({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card`,className:B(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),...t})}function Kf({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-header`,className:B(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function qf({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-title`,className:B(`leading-none font-semibold`,e),...t})}function Jf({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-content`,className:B(`px-6`,e),...t})}function Yf({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-footer`,className:B(`flex items-center px-6 [.border-t]:pt-6`,e),...t})}var Xf=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function Zf(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:Xf(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var Qf=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},$f=e=>{let t=Qf(e);return t.charAt(0).toUpperCase()+t.slice(1)},ep=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),tp={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function np(e){return e!=null}function rp(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??tp.width,a=e.size??e.height??tp.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?ep(...c):ep(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??tp[`stroke-width`])*Number(e.size??e.width??tp.width)/Number(t.size??t.width??tp.width):t.strokeWidth??tp[`stroke-width`];return[`svg`,{...Object.entries(tp).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&np(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&np(t.width)&&{[r(`width`)]:t.width},...`height`in t&&np(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function ip(e,t={}){return rp(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var ap=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},op=(0,v.createContext)({}),sp=()=>(0,v.useContext)(op),cp=(0,v.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:y=``}=sp()??{},b=!!c||ap(d),[x,S,C=[]]=ip(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:ep(y,s),hasA11yProp:b,attributes:d});return(0,v.createElement)(x,{ref:f,...S},[...C.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function X(e,t=[],n=[]){let r=typeof e==`string`?Zf(e,t,n):e,i=(0,v.forwardRef)(({className:e,...t},n)=>(0,v.createElement)(cp,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=$f(r.name)),i}var lp={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};lp.node;var up=X(lp),dp={name:`align-end-vertical`,size:24,node:[[`rect`,{width:`16`,height:`6`,x:`2`,y:`4`,rx:`2`,key:`10wcwx`}],[`rect`,{width:`9`,height:`6`,x:`9`,y:`14`,rx:`2`,key:`4p5bwg`}],[`path`,{d:`M22 22V2`,key:`12ipfv`}]]};dp.node;var fp=X(dp),pp={name:`align-start-vertical`,size:24,node:[[`rect`,{width:`9`,height:`6`,x:`6`,y:`14`,rx:`2`,key:`lpm2y7`}],[`rect`,{width:`16`,height:`6`,x:`6`,y:`4`,rx:`2`,key:`rdj6ps`}],[`path`,{d:`M2 2v20`,key:`1ivd8o`}]]};pp.node;var mp=X(pp),hp={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};hp.node;var gp=X(hp),_p={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};_p.node;var vp=X(_p),yp={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};yp.node;var bp=X(yp),xp={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};xp.node;var Sp=X(xp),Cp={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};Cp.node;var wp=X(Cp),Tp={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};Tp.node;var Ep=X(Tp),Dp={name:`chart-line`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`m19 9-5 5-4-4-3 3`,key:`2osh9i`}]],aliases:[`line-chart`]};Dp.node;var Op=X(Dp),kp={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};kp.node;var Ap=X(kp),jp={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};jp.node;var Mp=X(jp),Np={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Np.node;var Pp=X(Np),Fp={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Fp.node;var Ip=X(Fp),Lp={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};Lp.node;var Rp=X(Lp),zp={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};zp.node;var Bp=X(zp),Vp={name:`clipboard-list`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]};Vp.node;var Hp=X(Vp),Up={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};Up.node;var Wp=X(Up),Gp={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Gp.node;var Kp=X(Gp),qp={name:`cloud-upload`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]],aliases:[`upload-cloud`]};qp.node;var Jp=X(qp),Yp={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};Yp.node;var Xp=X(Yp),Zp={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};Zp.node;var Qp=X(Zp),$p={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};$p.node;var em=X($p),tm={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};tm.node;var nm=X(tm),rm={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};rm.node;var im=X(rm),am={name:`ellipsis-vertical`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]],aliases:[`more-vertical`]};am.node;var om=X(am),sm={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};sm.node;var cm=X(sm),lm={name:`factory`,size:24,node:[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M16 16h.01`,key:`1f9h7w`}],[`path`,{d:`M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z`,key:`1iv0i2`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]};lm.node;var um=X(lm),dm={name:`file-clock`,size:24,node:[[`path`,{d:`M16 22h2a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v2.85`,key:`ryk6xj`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 14v2.2l1.6 1`,key:`6m4bie`}],[`circle`,{cx:`8`,cy:`16`,r:`6`,key:`10v15b`}]]};dm.node;var fm=X(dm),pm={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};pm.node;var mm=X(pm),hm={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};hm.node;var gm=X(hm),_m={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};_m.node;var vm=X(_m),ym={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};ym.node;var bm=X(ym),xm={name:`gauge`,size:24,node:[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]};xm.node;var Sm=X(xm),Cm={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};Cm.node;var wm=X(Cm),Tm={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};Tm.node;var Em=X(Tm),Dm={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};Dm.node;var Om=X(Dm),km={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};km.node;var Am=X(km),jm={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};jm.node;var Mm=X(jm),Nm={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};Nm.node;var Pm=X(Nm),Fm={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};Fm.node;var Im=X(Fm),Lm={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};Lm.node;var Rm=X(Lm),zm={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};zm.node;var Bm=X(zm),Vm={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};Vm.node;var Hm=X(Vm),Um={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};Um.node;var Wm=X(Um),Gm={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};Gm.node;var Km=X(Gm),qm={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};qm.node;var Jm=X(qm),Ym={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Ym.node;var Xm=X(Ym),Zm={name:`monitor-cog`,size:24,node:[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]};Zm.node;var Qm=X(Zm),$m={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};$m.node;var eh=X($m),th={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};th.node;var nh=X(th),rh={name:`octagon-alert`,size:24,node:[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]],aliases:[`alert-octagon`]};rh.node;var ih=X(rh),ah={name:`octagon-x`,size:24,node:[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-octagon`]};ah.node;var oh=X(ah),sh={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};sh.node;var ch=X(sh),lh={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};lh.node;var uh=X(lh),dh={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};dh.node;var fh=X(dh),ph={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};ph.node;var mh=X(ph),hh={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};hh.node;var gh=X(hh),_h={name:`radar`,size:24,node:[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]};_h.node;var vh=X(_h),yh={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};yh.node;var bh=X(yh),xh={name:`rocket`,size:24,node:[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]};xh.node;var Sh=X(xh),Ch={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};Ch.node;var wh=X(Ch),Th={name:`save`,size:24,node:[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]};Th.node;var Eh=X(Th),Dh={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Dh.node;var Oh=X(Dh),kh={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};kh.node;var Ah=X(kh),jh={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};jh.node;var Mh=X(jh),Nh={name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]};Nh.node;var Ph=X(Nh),Fh={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Fh.node;var Ih=X(Fh),Lh={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};Lh.node;var Rh=X(Lh),zh={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};zh.node;var Bh=X(zh),Vh={name:`shield`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]};Vh.node;var Hh=X(Vh),Uh={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};Uh.node;var Wh=X(Uh),Gh={name:`square-pen`,size:24,node:[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]],aliases:[`pen-box`,`edit`,`pen-square`]};Gh.node;var Kh=X(Gh),qh={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};qh.node;var Jh=X(qh),Yh={name:`stretch-horizontal`,size:24,node:[[`rect`,{width:`20`,height:`6`,x:`2`,y:`4`,rx:`2`,key:`qdearl`}],[`rect`,{width:`20`,height:`6`,x:`2`,y:`14`,rx:`2`,key:`1xrn6j`}]]};Yh.node;var Xh=X(Yh),Zh={name:`stretch-vertical`,size:24,node:[[`rect`,{width:`6`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`19qu7m`}],[`rect`,{width:`6`,height:`20`,x:`14`,y:`2`,rx:`2`,key:`24v0nk`}]]};Zh.node;var Qh=X(Zh),$h={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};$h.node;var eg=X($h),tg={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};tg.node;var ng=X(tg),rg={name:`trending-up`,size:24,node:[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]};rg.node;var ig=X(rg),ag={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};ag.node;var og=X(ag),sg={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};sg.node;var cg=X(sg),lg={name:`wifi`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]};lg.node;var ug=X(lg),dg={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};dg.node;var fg=X(dg),pg={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};pg.node;var mg=X(pg);function hg({className:e,...t}){return(0,U.jsx)(xa,{"data-slot":`checkbox`,className:B(`peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary`,e),...t,children:(0,U.jsx)(Ca,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none`,children:(0,U.jsx)(Ap,{className:`size-3.5`})})})}function gg({...e}){return(0,U.jsx)(Hi,{"data-slot":`dialog`,...e})}function _g({...e}){return(0,U.jsx)(Ki,{"data-slot":`dialog-portal`,...e})}function vg({className:e,...t}){return(0,U.jsx)(Ji,{"data-slot":`dialog-overlay`,className:B(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function yg({className:e,children:t,showCloseButton:n=!0,...r}){return(0,U.jsxs)(_g,{"data-slot":`dialog-portal`,children:[(0,U.jsx)(vg,{}),(0,U.jsxs)(Qi,{"data-slot":`dialog-content`,className:B(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,U.jsxs)(aa,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,U.jsx)(mg,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function bg({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`dialog-header`,className:B(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function xg({className:e,showCloseButton:t=!1,children:n,...r}){return(0,U.jsxs)(`div`,{"data-slot":`dialog-footer`,className:B(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,U.jsx)(aa,{asChild:!0,children:(0,U.jsx)(Y,{variant:`outline`,children:`Close`})})]})}function Sg({className:e,...t}){return(0,U.jsx)(na,{"data-slot":`dialog-title`,className:B(`text-lg leading-none font-semibold`,e),...t})}function Cg({className:e,...t}){return(0,U.jsx)(ra,{"data-slot":`dialog-description`,className:B(`text-sm text-muted-foreground`,e),...t})}function wg({className:e,type:t,...n}){return(0,U.jsx)(`input`,{type:t,"data-slot":`input`,className:B(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}function Tg({className:e,...t}){return(0,U.jsx)(Zl,{"data-slot":`label`,className:B(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Eg({...e}){return(0,U.jsx)(ld,{"data-slot":`select`,...e})}function Dg({...e}){return(0,U.jsx)(pd,{"data-slot":`select-value`,...e})}function Og({className:e,size:t=`default`,children:n,...r}){return(0,U.jsxs)(dd,{"data-slot":`select-trigger`,"data-size":t,className:B(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,U.jsx)(md,{asChild:!0,children:(0,U.jsx)(Mp,{className:`size-4 opacity-50`})})]})}function kg({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,U.jsx)(_d,{children:(0,U.jsxs)(yd,{"data-slot":`select-content`,className:B(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,U.jsx)(jg,{}),(0,U.jsx)(jd,{className:B(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,U.jsx)(Mg,{})]})})}function Ag({className:e,children:t,...n}){return(0,U.jsxs)(Ld,{"data-slot":`select-item`,className:B(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,U.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(Vd,{children:(0,U.jsx)(Ap,{className:`size-4`})})}),(0,U.jsx)(zd,{children:t})]})}function jg({className:e,...t}){return(0,U.jsx)(Ud,{"data-slot":`select-scroll-up-button`,className:B(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(Ip,{className:`size-4`})})}function Mg({className:e,...t}){return(0,U.jsx)(Gd,{"data-slot":`select-scroll-down-button`,className:B(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(Mp,{className:`size-4`})})}function Ng(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var Pg=e=>{switch(e){case`success`:return Lg;case`info`:return zg;case`warning`:return Rg;case`error`:return Bg;default:return null}},Fg=Array(12).fill(0),Ig=({visible:e,className:t})=>v.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},v.createElement(`div`,{className:`sonner-spinner`},Fg.map((e,t)=>v.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Lg=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},v.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Rg=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},v.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),zg=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},v.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),Bg=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},v.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Vg=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},v.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),v.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),Hg=()=>{let[e,t]=v.useState(document.hidden);return v.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},Ug=1,Wg=100,Gg=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:Ug++,Kg=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-Wg;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=Gg(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],v.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Jg(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=Gg(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},qg=(e,t)=>Kg.message(e,t),Jg=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Z=Object.assign(qg,{success:Kg.success,info:Kg.info,warning:Kg.warning,error:Kg.error,custom:Kg.custom,message:Kg.message,promise:Kg.promise,dismiss:Kg.dismiss,loading:Kg.loading},{getHistory:()=>Kg.toasts,getToasts:()=>Kg.getActiveToasts()});Ng(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Yg(e){return e.label!==void 0}var Xg=3,Zg=`24px`,Qg=`16px`,$g=4e3,e_=356,t_=14,n_=45,r_=200;function i_(...e){return e.filter(Boolean).join(` `)}function a_(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var o_=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:y=``,duration:b,position:x,gap:S,expandByDefault:C,classNames:w,icons:T,closeButtonAriaLabel:E=`Close toast`}=e,[D,O]=v.useState(null),[k,A]=v.useState(null),[j,ee]=v.useState(!1),[M,N]=v.useState(!1),[P,F]=v.useState(!1),[I,L]=v.useState(!1),[te,ne]=v.useState(!1),[re,ie]=v.useState(0),[ae,oe]=v.useState(0),se=v.useRef(n.duration||b||$g),ce=v.useRef(null),le=v.useRef(null),ue=c===0,de=c+1<=o,fe=n.type,R=fe??`default`,z=n.dismissible!==!1,pe=n.className||``,me=n.descriptionClassName||``,he=v.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ge=v.useMemo(()=>n.closeButton??p,[n.closeButton,p]),_e=v.useMemo(()=>n.duration||b||$g,[n.duration,b]),ve=v.useRef(0),ye=v.useRef(0),be=v.useRef(0),xe=v.useRef(null),[Se,Ce]=x.split(`-`),we=v.useMemo(()=>s.reduce((e,t,n)=>n>=he?e:e+t.height,0),[s,he]),Te=Hg(),Ee=v.useMemo(()=>e.swipeDirections??a_(x),[e.swipeDirections,x]),B=n.invert||t,De=fe===`loading`;ye.current=v.useMemo(()=>he*S+we,[he,we]),v.useEffect(()=>{se.current=_e},[_e]),v.useEffect(()=>{ee(!0)},[]),v.useEffect(()=>{let e=le.current;if(e){let t=e.getBoundingClientRect().height;return oe(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),v.useLayoutEffect(()=>{if(!j)return;let e=le.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,oe(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[j,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let V=v.useCallback(()=>{N(!0),ie(ye.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},r_)},[n,d,a,ye]);v.useEffect(()=>{if(n.promise&&fe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Te?(()=>{if(be.current<ve.current){let e=new Date().getTime()-ve.current;se.current-=e}be.current=new Date().getTime()})():se.current!==1/0&&(ve.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),V()},se.current)),()=>clearTimeout(e)},[u,i,n,fe,Te,V]),v.useEffect(()=>{n.delete&&(V(),n.onDismiss==null||n.onDismiss.call(n,n))},[V,n.delete]);function Oe(){return T?.loading?v.createElement(`div`,{className:i_(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":fe===`loading`},T.loading):v.createElement(Ig,{className:i_(w?.loader,n?.classNames?.loader),visible:fe===`loading`})}let ke=n.icon||T?.[fe]||Pg(fe);return v.createElement(`li`,{tabIndex:0,ref:le,className:i_(_,pe,w?.toast,n?.classNames?.toast,w?.[R],n?.classNames?.[R]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":j,"data-promise":!!n.promise,"data-swiped":te,"data-removed":M,"data-visible":de,"data-y-position":Se,"data-x-position":Ce,"data-index":c,"data-front":ue,"data-swiping":P,"data-dismissible":z,"data-type":fe,"data-invert":B,"data-swipe-out":I,"data-swipe-direction":k,"data-expanded":!!(u||C&&j),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?re:ye.current}px`,"--initial-height":C?`auto`:`${ae}px`,...m,...n.style},onDragEnd:()=>{F(!1),O(null),xe.current=null},onPointerDown:e=>{e.button!==2&&!De&&z&&(ce.current=new Date,ie(ye.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),xe.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{if(I||!z)return;xe.current=null;let e=Number(le.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(le.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ce.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if((D===`x`?Ee.includes(e>0?`right`:`left`):Ee.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=n_||a>.11))ie(ye.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),V(),L(!0);else{var o,s;(o=le.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=le.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),ne(!1),F(!1),O(null)}},onPointerMove:e=>{var t,n;if(!xe.current||!z||window.getSelection()?.toString().length>0)return;let r=e.clientY-xe.current.y,i=e.clientX-xe.current.x;!D&&(Math.abs(i)>1||Math.abs(r)>1)&&O(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(Ee.includes(`top`)||Ee.includes(`bottom`)){if(Ee.includes(`top`)&&r<0||Ee.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(D===`x`&&(Ee.includes(`left`)||Ee.includes(`right`))){if(Ee.includes(`left`)&&i<0||Ee.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&ne(!0),(t=le.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=le.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},ge&&!n.jsx&&fe!==`loading`?v.createElement(`button`,{"aria-label":E,"data-disabled":De,"data-close-button":!0,onClick:De||!z?()=>{}:()=>{V(),n.onDismiss==null||n.onDismiss.call(n,n)},className:i_(w?.closeButton,n?.classNames?.closeButton)},T?.close??Vg):null,(fe||n.icon||n.promise)&&n.icon!==null&&(T?.[fe]!==null||n.icon)?v.createElement(`div`,{"data-icon":``,className:i_(w?.icon,n?.classNames?.icon)},fe===`loading`?n.icon||Oe():n.promise?Oe():null,fe===`loading`?null:ke):null,v.createElement(`div`,{"data-content":``,className:i_(w?.content,n?.classNames?.content)},v.createElement(`div`,{"data-title":``,className:i_(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?v.createElement(`div`,{"data-description":``,className:i_(y,me,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),v.isValidElement(n.cancel)?n.cancel:n.cancel&&Yg(n.cancel)?v.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{Yg(n.cancel)&&z&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),V())},className:i_(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,v.isValidElement(n.action)?n.action:n.action&&Yg(n.action)?v.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{Yg(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&V())},className:i_(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function s_(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function c_(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Qg:Zg;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var l_=v.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=Xg,toastOptions:g,dir:_=s_(),gap:y=t_,icons:b,customAriaLabel:x,containerAriaLabel:S=`Notifications`}=e,[C,w]=v.useState([]),T=v.useMemo(()=>n?C.filter(e=>e.toasterId===n):C.filter(e=>!e.toasterId),[C,n]),E=v.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[D,O]=v.useState([]),[k,A]=v.useState(!1),[j,ee]=v.useState(!1),[M,N]=v.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),P=v.useRef(null),F=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),I=v.useRef(null),L=v.useRef(!1),te=v.useCallback(e=>{w(t=>(t.find(t=>t.id===e.id)?.delete||Kg.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return v.useEffect(()=>Kg.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{w(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{pt.flushSync(()=>{w(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),v.useEffect(()=>{if(d!==`system`){N(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?N(`dark`):N(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{N(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{N(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),v.useEffect(()=>{C.length<=1&&A(!1)},[C]),v.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;A(!0),(t=P.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===P.current||P.current?.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),v.useEffect(()=>{if(P.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}},[P.current]),v.createElement(`section`,{ref:t,"aria-label":x??`${S} ${F}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},E.map((t,n)=>{let[i,a]=t.split(`-`);return T.length?v.createElement(`ol`,{key:t,dir:_===`auto`?s_():_,tabIndex:-1,ref:P,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${e_}px`,"--gap":`${y}px`,...m,...c_(l,u)},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,I.current&&=(I.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||L.current||(L.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ee(!0)},onPointerUp:()=>ee(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>v.createElement(o_,{key:n.id,icons:b,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:j,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:te,toasts:T.filter(e=>e.position==n.position),heights:D.filter(e=>e.position==n.position),setHeights:O,expandByDefault:o,gap:y,expanded:k,swipeDirections:e.swipeDirections}))):null}))});function u_(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return t%360}var d_=e=>({"--agent-h":String(u_(e))}),f_=e=>{let t=u_(e);return`linear-gradient(135deg, oklch(0.6 0.14 ${t}), oklch(0.45 0.12 ${(t+45)%360}))`};function p_({id:e,name:t,size:n=`md`}){return(0,U.jsx)(`span`,{className:B(`flex shrink-0 items-center justify-center rounded-lg text-[10px] font-bold text-white`,n===`md`?`h-6 w-6 text-[11px]`:`h-5 w-5`),style:{background:f_(e)},children:(t||`?`).trim().charAt(0).toUpperCase()})}var m_=[`exec`,`data_describe`,`data_query`,`search_knowledge`,`save_experience`],h_=[{id:`observer`,emoji:`👀`,title:`只读参谋`,desc:`能查数据、检索知识、给建议——不会动手改任何东西,适合先试试水`,autonomy:`L1`},{id:`worker`,emoji:`🔧`,title:`干活帮手`,desc:`能执行命令、读写数据集、跑配置的动作——重要写操作会先弹卡问你`,autonomy:`L2`,recommended:!0},{id:`full`,emoji:`🚀`,title:`全自主干将`,desc:`以上全部,且写操作免确认——只给完全信任、可承受失误的场景`,autonomy:`L3`}];function g_({onOpen:e}){let[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!0),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)([]),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!0),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(`all`),[w,T]=(0,v.useState)(()=>localStorage.getItem(`aims.guide-done`)===`1`),[E,D]=(0,v.useState)(``),O=(0,v.useRef)(``),[k,A]=(0,v.useState)(!1),[j,ee]=(0,v.useState)([]),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)(`L2`),[te,ne]=(0,v.useState)(m_),[re,ie]=(0,v.useState)(`worker`),[ae,oe]=(0,v.useState)(!1),[se,ce]=(0,v.useState)(!1),[le,ue]=(0,v.useState)(null),[de,fe]=(0,v.useState)(null),[R,z]=(0,v.useState)(null),[pe,me]=(0,v.useState)(null),[he,ge]=(0,v.useState)(!1),[_e,ve]=(0,v.useState)(!1),[ye,be]=(0,v.useState)(1),[xe,Se]=(0,v.useState)(``),[Ce,we]=(0,v.useState)(``),[Te,Ee]=(0,v.useState)(``),[De,je]=(0,v.useState)(!1),[Me,Ne]=(0,v.useState)(!1),[Pe,Fe]=(0,v.useState)(``),[Ie,Re]=(0,v.useState)([]),[ze,Be]=(0,v.useState)([]),Ve=(0,v.useMemo)(()=>new Set(ze.map(e=>e.id)),[ze]),He=async(e=!0)=>{if(!Ce.trim())Z.error(`请先描述你想让小助手做什么`);else{je(!0);try{let t=await Oe(`/api/agents/draft-prompt`,{name:xe.trim(),description:Ce.trim()});Ee(t.prompt),t.name&&!xe.trim()&&Se(t.name),e&&be(2)}catch(e){Z.error(String(e.message))}finally{je(!1)}}},Ue=async()=>{try{let e=await V(`/api/agents/knowledges?keyword=${encodeURIComponent(Pe.trim())}`);Re(e.items||[]),e.error&&Z.warning(`ARM 知识检索不可达`,{description:e.error})}catch(e){Z.error(String(e.message))}},We=async()=>{Ne(!0);try{let e=await Oe(`/api/agents/create`,{name:xe.trim(),description:Ce.trim(),prompt:Te.trim(),knowledge_ids:ze.map(e=>e.id)});e.local?Z.warning(`${e.manifest.name} 已创建为本地助手(ARM 不可达)`,{description:`离线可用:对话/工作台/数据集正常,编辑仅写本地。恢复连接后在卡片上点「发布」转正到 ARM(身份不变)。`,duration:7e3}):Z.success(`${e.manifest.name} ${e.manifest.version} 已创建并下载到本地${e.knowledges_bound?`(绑定知识 ${e.knowledges_bound} 条)`:``}——下一步完成上岗配置`),ve(!1),Se(``),we(``),Ee(``),Be([]),Re([]),Fe(``),await Ge(),nt({agent_id:e.agent_id,name:e.manifest.name})}catch(e){Z.error(String(e.message))}finally{Ne(!1)}},Ge=async(e=O.current)=>{try{let t=await V(`/api/agents${e?`?keyword=${encodeURIComponent(e)}`:``}`);if(e!==O.current)return;n(t.agents),i(t.online),c(!!t.auth_error),o(t.me||null),t.source&&u(t.source),t.sources&&f(t.sources)}catch{e===O.current&&(i(!1),c(!1),o(null))}finally{e===O.current&&(g(!1),A(!1))}},Ke=async e=>{if(e&&e!==l?.id&&!p){m(!0),g(!0);try{let t=await Oe(`/api/arm/sources/${encodeURIComponent(e)}/select`);t.probe.online?Z.success(`已切换到 ARM 源「${t.source.name}」`,{description:`连通 ${t.probe.latency_ms}ms——目录、下载、新建、发布、经验回流现在都打这个源`}):Z.warning(`已切换到 ARM 源「${t.source.name}」,但当前不可达`,{description:`${t.probe.error||``};显示本地库,可随时切回`.replace(/^;/,``)}),await Ge()}catch(e){Z.error(String(e.message))}finally{m(!1),g(!1)}}};(0,v.useEffect)(()=>{Ge(``),V(`/api/tools`).then(e=>ee(e.tools))},[]),(0,v.useEffect)(()=>{if(O.current=E,!E){Ge(``);return}A(!0);let e=setTimeout(()=>Ge(E),400);return()=>clearTimeout(e)},[E]);let H=(0,v.useMemo)(()=>t.filter(e=>e.deployed),[t]),qe=(0,v.useMemo)(()=>t.filter(e=>e.installed),[t]),Je=(0,v.useMemo)(()=>t.filter(e=>e.update_available),[t]),Ye=(0,v.useMemo)(()=>({all:t,deployed:H,installed:qe,updates:Je})[S],[t,H,qe,Je,S]),Xe=async()=>{x(!0);try{let e=await Oe(`/api/arm/sync`),{new:t,update:n,delisted:r}=e.events,i=[`目录 ${e.remote_count} 名`];t.length&&i.push(`${t.length} 名新助手`),n.length&&i.push(`${n.length} 名可升级`),r.length&&i.push(`${r.length} 名已下架`),e.outbox_flushed&&i.push(`回流 ${e.outbox_flushed} 条离线经验`),Z.success(`已同步:${i.join(` · `)}`),await Ge()}catch(e){Z.error(String(e.message))}finally{x(!1)}},Ze=async(e,t)=>{y(e.agent_id);try{let n=await Oe(`/api/agents/${e.agent_id}/${t}`);Z.success(`${n.manifest.name} ${n.manifest.version} 已${t===`upgrade`?`升级`:`下载`}(本地知识 ${n.manifest.knowledges_local} 条,工作台与数据不受影响)`),await Ge(),t===`upgrade`&&ue(null)}catch(e){Z.error(String(e.message))}finally{y(null)}},Qe=async e=>{fe(e);try{z(await V(`/api/agents/${e.agent_id}/versions`))}catch(e){Z.error(String(e.message))}},$e=async(e,t)=>{try{await Oe(`/api/agents/${e.agent_id}/rollback`,{version:t}),Z.success(`已回滚到 ${t}`),z(await V(`/api/agents/${e.agent_id}/versions`)),await Ge()}catch(e){Z.error(String(e.message))}},et=async e=>{y(e.agent_id);try{await Ae(`/api/agents/${e.agent_id}`,{force:!0,purge_workspaces:he}),Z.success(`${e.name} 已卸载${he?`(工作区数据已清除)`:`(工作区数据已保留)`}`),me(null),ge(!1),await Ge()}catch(e){Z.error(String(e.message))}finally{y(null)}},tt=e=>{let t=h_.find(t=>t.id===e);t&&(L(t.autonomy),ne(e===`observer`?m_:j.map(e=>e.name)),ie(e))},nt=e=>{N(e),F(e.name),oe(!1),ne(j.map(e=>e.name)),L(`L2`),ie(`worker`)},rt=async e=>{try{let t=(await V(`/api/deployment?agent_id=${e.agent_id}`)).deployment;N(e),F(t.name||e.name),oe(!0),ie(`custom`),L(t.default_autonomy||`L2`),ne((t.toolset||[]).map(e=>e.tool))}catch(e){Z.error(String(e.message))}},it=e=>e.local_only||!e.foreign&&r&&!!a&&(a.role===`ADMIN`||!!e.created_by_id&&a.id===e.created_by_id),[at,ot]=(0,v.useState)(null),[st,ct]=(0,v.useState)(``),[lt,ut]=(0,v.useState)(``),[dt,ft]=(0,v.useState)(``),[pt,mt]=(0,v.useState)(!1),[ht,W]=(0,v.useState)(null),[gt,_t]=(0,v.useState)(!1),[vt,yt]=(0,v.useState)(``),[bt,xt]=(0,v.useState)([]),[St,Ct]=(0,v.useState)(``),[wt,Tt]=(0,v.useState)([]),[Et,Dt]=(0,v.useState)(`essential`),[Ot,kt]=(0,v.useState)(null),[At,jt]=(0,v.useState)(!1),[Mt,Nt]=(0,v.useState)(!1),[Pt,Ft]=(0,v.useState)(null),[It,Lt]=(0,v.useState)(``),[Rt,zt]=(0,v.useState)(!1),[Bt,G]=(0,v.useState)(null),[Vt,Ht]=(0,v.useState)(!1),Ut=async()=>{if(Bt){Ht(!0);try{let e=await Oe(`/api/agents/${Bt.agent_id}/publish`),t=[`知识 ${e.copied.knowledges} 条已复制${e.copied.failed?`(${e.copied.failed} 条失败)`:``}`];(e.skipped.skills||e.skipped.ui_bindings)&&t.push(`未复制:技能 ${e.skipped.skills} / UI 资产 ${e.skipped.ui_bindings}(ARM 侧资产,可在编辑里重绑)`),t.push(`本地身份与数据不变(档案/配置分离)`),Z.success(`「${e.manifest.name}」已发布到「${e.target.name}」${e.manifest.version}`,{description:t.join(`;`),duration:7e3}),G(null),await Ge()}catch(e){Z.error(String(e.message))}finally{Ht(!1)}}},Wt=async e=>{try{W(await V(`/api/agents/${e}/bindings`))}catch(e){W(null),Z.error(String(e.message))}},Gt=async()=>{try{let e=await V(`/api/agents/skills?keyword=${encodeURIComponent(vt.trim())}`);xt(e.items||[]),e.error&&Z.error(e.error)}catch(e){Z.error(String(e.message))}},Kt=async()=>{try{let e=await V(`/api/agents/knowledges?keyword=${encodeURIComponent(St.trim())}`);Tt(e.items||[]),e.error&&Z.error(e.error)}catch(e){Z.error(String(e.message))}},qt=async(e,t,n)=>{if(at){_t(!0);try{await Oe(`/api/agents/${at.agent_id}/bindings`,{type:e,ref_id:t,kind:n}),Z.success(e===`skill`?`技能已绑定(本地档案已同步物化)`:`知识已绑定(本地档案已同步物化)`),xt([]),Tt([]),await Wt(at.agent_id)}catch(e){Z.error(String(e.message))}finally{_t(!1)}}},Jt=async(e,t,n)=>{if(at){_t(!0);try{await Ae(`/api/agents/${at.agent_id}/bindings`,{type:e,binding_id:t}),Z.success(`已解绑 ${n}(本地档案已同步物化)`),await Wt(at.agent_id)}catch(e){Z.error(String(e.message))}finally{_t(!1)}}},Yt=async e=>{ot(e),ct(e.name),ut(e.description||``),ft(`(读取档案…)`),W(null),xt([]),Tt([]),yt(``),Ct(``),Wt(e.agent_id);try{let t=await V(`/api/agents/${e.agent_id}/profile`);ct(t.name),ut(t.description),ft(t.prompt)}catch(e){ft(``),Z.error(String(e.message))}},Xt=async()=>{if(at){mt(!0);try{await ke(`/api/agents/${at.agent_id}`,{name:st.trim(),description:lt.trim(),prompt:dt.trim()}),Z.success(`档案已更新(ARM + 本地已同步)`),ot(null),await Ge()}catch(e){Z.error(String(e.message))}finally{mt(!1)}}},Zt=async()=>{if(Ot){Nt(!0);try{await Oe(`/api/agents/${Ot.agent_id}/arm-delete`,{also_uninstall:!0,purge_workspaces:At}),Z.success(`${Ot.name} 已从 ARM 删除${Ot.installed?`(本地档案已一并卸载)`:``}`),kt(null),jt(!1),await Ge()}catch(e){Z.error(String(e.message))}finally{Nt(!1)}}},Qt=async()=>{if(Pt){zt(!0);try{let e=await Oe(`/api/agents/${Pt.agent_id}/clone`,{name:It.trim()});Z.success(`已创建「${e.name}」`,{description:`档案已物化本地 · 复制绑定:技能 ${e.copied.skills} · 知识 ${e.copied.knowledges} · UI 资产 ${e.copied.ui_assets}${e.copied.failed?`(${e.copied.failed} 条失败可稍后在编辑里补绑)`:``}——副本归你所有,可自由编辑`,duration:6e3}),Ft(null),await Ge()}catch(e){Z.error(String(e.message))}finally{zt(!1)}}},$t=async()=>{if(M){ce(!0);try{if(await ke(`/api/deployment`,{agent_id:M.agent_id,name:P,default_autonomy:I,toolset:te.map(e=>({tool:e})),knowledge_slices:[`ARM经验库(检索式注入)`]}),await Ge(),ae){Z.success(`已更新 ${P} 的权限`,{description:`工具 ${te.length} 项 · ${I} · 即时生效`}),N(null);return}Z.success(`🎉 ${M.name} 已上岗!`,{description:`档案已物化本地(离线可用),工位已就绪——跟它说的第一句话开始吧`,duration:6e3}),N(null),V(`/api/dev/inspirations?agent_id=${M.agent_id}`).catch(()=>{}),e(M.agent_id,P,`workbench`)}catch(e){Z.error(String(e.message))}finally{ce(!1)}}},en=e=>(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1 text-[10px] text-muted-foreground`,children:[e.installed?(0,U.jsxs)(J,{variant:`outline`,className:`h-5 text-[10px] text-primary`,children:[`已下载 `,e.installed_version]}):(0,U.jsx)(J,{variant:`outline`,className:`h-5 text-[10px]`,children:e.version}),(0,U.jsxs)(J,{variant:`outline`,className:`h-5 text-[10px]`,children:[(0,U.jsx)(fg,{className:`mr-0.5 h-2.5 w-2.5`}),e.skills,` 技能`]}),(0,U.jsxs)(J,{variant:`outline`,className:`h-5 text-[10px]`,children:[(0,U.jsx)(Sp,{className:`mr-0.5 h-2.5 w-2.5`}),e.knowledges,` 知识`]}),e.local_only&&(0,U.jsx)(J,{className:`h-5 bg-warning/15 text-[10px] text-warning hover:bg-warning/25`,title:`离线创建的本地档案——仅本机可见可用;恢复 ARM 连接后在卡片上点「发布」转正(身份与数据不变)`,children:`未发布`}),e.foreign&&e.source_name&&(0,U.jsx)(J,{className:`h-5 max-w-40 bg-ai/10 text-[10px] text-ai hover:bg-ai/20`,title:`来自 ARM 源「${e.source_name}」,当前源「${l?.name||``}」的目录里没有它——升级/编辑请切回来源源;也可点「发布」把它推送到当前源(同 id,身份不变)`,children:(0,U.jsxs)(`span`,{className:`truncate`,children:[`来自 `,e.source_name]})}),e.created_by&&a&&e.created_by_id!==a.id&&(0,U.jsx)(J,{variant:`outline`,className:`h-5 max-w-36 text-[10px]`,title:`由 ${e.created_by} 创建——编辑需联系作者或管理员,或点卡片上的克隆图标复制一份自己改`,children:(0,U.jsxs)(`span`,{className:`truncate`,children:[`by `,e.created_by]})})]});return(0,U.jsxs)(`div`,{className:`h-full overflow-auto p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-bold`,children:[(0,U.jsx)(cg,{className:`h-5 w-5 text-primary`}),`助手大厅`]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`档案物化到本地助手库(离线可用)· 上岗配置由平台管理(档案/配置分离)· 升级不触碰工作台与数据`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,U.jsxs)(J,{variant:`secondary`,children:[`共 `,t.length,` 名`]}),(0,U.jsxs)(J,{className:`bg-success/15 text-success hover:bg-success/25`,children:[`在岗 `,H.length]}),Je.length>0&&(0,U.jsxs)(J,{className:`bg-warning/15 text-warning hover:bg-warning/25`,children:[`可升级 `,Je.length]}),a&&(0,U.jsxs)(J,{variant:`outline`,className:`font-normal`,title:`ARM 令牌身份(编辑/删除按此判定):${a.name||a.id.slice(0,8)}${a.role===`ADMIN`?`——管理员可管理全部助手`:`——可编辑自己创建的助手`}`,children:[a.name||`已认证`,a.role===`ADMIN`?` · 管理员`:``]}),d.length>1?(0,U.jsxs)(Eg,{value:l?.id||``,onValueChange:Ke,disabled:p,children:[(0,U.jsxs)(Og,{className:`h-8 w-44 text-xs`,title:`当前 ARM 源:${l?.name||``}(${l?.base||``})——目录检索、下载、新建、发布、经验回流都打这个源;公库/私库随时切换,本地库不受影响`,children:[(0,U.jsx)(Mh,{className:`mr-1 h-3.5 w-3.5 shrink-0 text-primary`}),(0,U.jsx)(Dg,{placeholder:`ARM 源`})]}),(0,U.jsx)(kg,{children:d.map(e=>(0,U.jsx)(Ag,{value:e.id,className:`text-xs`,children:e.name},e.id))})]}):l&&(0,U.jsxs)(J,{variant:`outline`,className:`h-8 gap-1 px-2 font-normal`,title:`ARM 源:${l.base}——在「系统设置 · ARM 源」可添加私库/其他站点,大厅随时切换`,children:[(0,U.jsx)(Mh,{className:`h-3.5 w-3.5 text-primary`}),l.name]}),(0,U.jsxs)(Y,{size:`sm`,className:`gap-1 text-xs`,onClick:()=>{be(1),ve(!0)},title:`描述需求,AI 起草档案 → ARM 创建 → 上岗,一条链完成`,children:[(0,U.jsx)(Wh,{className:`h-3.5 w-3.5`}),`新建助手`]}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`gap-1 text-xs`,disabled:b||!r,onClick:Xe,title:r?`比对 ARM 远端目录`:`离线模式`,children:[(0,U.jsx)(bh,{className:`h-3.5 w-3.5 ${b?`animate-spin`:``}`}),`检查更新`]})]})]}),!r&&s&&(0,U.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning`,children:[(0,U.jsx)(Mm,{className:`h-4 w-4 shrink-0`}),`ARM 源「`,l?.name||`ARM`,`」令牌未配置或无权限——请到该 ARM 站点生成访问令牌(arm_pat_…),再到「系统设置 · ARM 源」粘贴保存。`,(0,U.jsx)(`a`,{href:l?.base||`http://arm.agent-platform.dev.aimstek.cn`,target:`_blank`,rel:`noreferrer`,className:`ml-auto shrink-0 underline underline-offset-2 hover:text-warning/80`,children:`打开 ARM →`})]}),!r&&!s&&(0,U.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning`,children:[(0,U.jsx)(Kp,{className:`h-4 w-4 shrink-0`}),`离线模式:ARM 源「`,l?.name||`ARM`,`」不可达,以上为本地助手库(`,qe.length,` 名,对话/工作台/数据集可继续使用);下载与升级需恢复连接`,d.length>1?`,或切换到其他 ARM 源`:``,`。`]}),(0,U.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`relative w-64 shrink-0`,children:[(0,U.jsx)(Oh,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground ${k?`animate-pulse text-primary`:``}`}),(0,U.jsx)(wg,{value:E,onChange:e=>D(e.target.value),placeholder:`搜索助手(名称/描述,检索 ARM 目录)`,className:`h-8 pl-8 pr-7 text-xs`}),E&&(0,U.jsx)(`button`,{onClick:()=>D(``),title:`清空搜索`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(mg,{className:`h-3.5 w-3.5`})})]}),!w&&H.length===0&&!h&&(0,U.jsxs)(`div`,{className:`mb-4 flex items-center gap-3 rounded-xl border border-primary/30 bg-primary/5 px-3.5 py-2.5`,children:[(0,U.jsx)(Wh,{className:`h-4 w-4 shrink-0 text-primary`}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 text-[11px]`,children:[(0,U.jsx)(`span`,{className:`font-semibold text-primary`,children:`30 秒上手`}),(0,U.jsx)(`span`,{children:`① 从下面挑一名助手,点「上岗配置」`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,U.jsx)(`span`,{children:`② 在工作台跟它说第一句话`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,U.jsx)(`span`,{children:`③ 说「右上加一个最近告警」,看着界面长出来`})]}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-[11px]`,onClick:()=>{localStorage.setItem(`aims.guide-done`,`1`),T(!0)},children:`知道了`})]}),(0,U.jsx)(`div`,{className:`flex gap-1.5 text-xs`,children:[[`all`,`全部 ${t.length}`],[`deployed`,`在岗 ${H.length}`],[`installed`,`已下载 ${qe.length}`],[`updates`,`可更新 ${Je.length}`]].map(([e,t])=>(0,U.jsx)(`button`,{onClick:()=>C(e),className:`rounded-full border px-2.5 py-1 transition-colors ${S===e?`border-primary/60 bg-primary/15 text-primary`:`border-border text-muted-foreground hover:text-foreground`}`,children:t},e))})]}),h?(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-3 xl:grid-cols-4`,children:[...Array(8)].map((e,t)=>(0,U.jsx)(Gf,{className:`h-44 animate-pulse`},t))}):(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4`,children:Ye.map(t=>(0,U.jsxs)(Gf,{className:`flex flex-col ${t.deployed?`border-primary/40`:``} ${!r&&!t.installed?`opacity-50`:``}`,children:[(0,U.jsx)(Kf,{className:`pb-2`,children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsxs)(qf,{className:`flex items-center gap-1.5 text-sm leading-snug`,children:[(0,U.jsx)(p_,{id:t.agent_id,name:t.name}),t.name]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[t.update_available&&(0,U.jsxs)(J,{className:`h-5 bg-warning/15 text-[10px] text-warning hover:bg-warning/25`,children:[(0,U.jsx)(Rp,{className:`mr-0.5 h-2.5 w-2.5`}),t.remote_version]}),t.delisted&&(0,U.jsx)(J,{variant:`outline`,className:`h-5 text-[10px] text-destructive`,children:`已下架`}),t.deployed&&(0,U.jsx)(J,{className:`h-5 bg-success/15 text-[10px] text-success hover:bg-success/25`,children:`在岗`})]})]})}),(0,U.jsxs)(Jf,{className:`flex-1 space-y-2 pb-2`,children:[(0,U.jsx)(`p`,{className:`line-clamp-2 h-8 text-[11px] text-muted-foreground`,children:t.description||`(ARM 档案无描述)`}),en(t)]}),(0,U.jsxs)(Yf,{className:`gap-1.5`,children:[t.deployed?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{size:`sm`,className:`flex-1 text-xs`,onClick:()=>e(t.agent_id,t.name,`workbench`),children:`进入工作台 →`}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 shrink-0 p-0`,onClick:()=>rt(t),title:`调整权限(工具集/自主级别,即时生效)`,children:(0,U.jsx)(Hh,{className:`h-3.5 w-3.5`})})]}):!r&&!t.installed?(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`flex-1 text-xs`,disabled:!0,title:`离线模式:恢复 ARM 连接后可上岗`,children:`上岗配置(离线不可用)`}):(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`flex-1 text-xs`,onClick:()=>nt(t),children:[(0,U.jsx)(Wh,{className:`mr-1 h-3 w-3`}),`上岗配置`]}),t.update_available&&(0,U.jsxs)(Y,{size:`sm`,className:`text-xs`,disabled:_===t.agent_id,onClick:()=>ue(t),children:[(0,U.jsx)(Rp,{className:`mr-1 h-3 w-3`}),`升级`]}),!t.update_available&&!t.installed&&r&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`text-xs`,disabled:_===t.agent_id,onClick:()=>Ze(t,`download`),title:`下载档案到本地,离线可用`,children:(0,U.jsx)(im,{className:`h-3.5 w-3.5`})}),t.installed&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,onClick:()=>Qe(t),title:`版本历史 / 回滚 / 卸载`,children:(0,U.jsx)(om,{className:`h-3.5 w-3.5`})}),(t.local_only||t.foreign)&&r&&(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 gap-1 px-2 text-[11px] text-warning hover:text-warning`,disabled:_===t.agent_id,onClick:()=>G(t),title:t.foreign?`发布到当前源「${l?.name||``}」:来自「${t.source_name||``}」的助手以同一身份推送过去(档案 + 知识全文;技能/UI 资产不复制)`:`发布到「${l?.name||`ARM`}」:团队可见、可绑定技能/知识;助手身份与本地数据不变`,children:[(0,U.jsx)(Jp,{className:`h-3.5 w-3.5`}),`发布`]}),r&&!t.foreign&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,disabled:_===t.agent_id,onClick:()=>{Ft(t),Lt(`${t.name}-副本`)},title:`克隆为新助手(复制档案与全部绑定,副本归你所有可自由编辑)——无编辑权限或想做类似助手时用`,children:(0,U.jsx)(Xp,{className:`h-3.5 w-3.5`})}),it(t)&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,disabled:_===t.agent_id,onClick:()=>Yt(t),title:`编辑档案(名称/Prompt/技能与知识绑定)${t.created_via_workstation?`· 工作站创建`:``}`,children:(0,U.jsx)(Kh,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0 text-destructive hover:text-destructive`,disabled:_===t.agent_id,onClick:()=>{kt(t),jt(!1)},title:`从 ARM 删除(不可恢复)`,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})})]})]})]},t.agent_id))}),Ye.length===0&&(0,U.jsx)(`div`,{className:`mt-10 text-center text-sm text-muted-foreground`,children:r?E?`没有匹配「${E}」的助手——换个关键词试试`:`没有匹配的助手`:E?`本地库中没有匹配「${E}」的助手(离线模式不检索 ARM 目录)`:`本地库为空:恢复 ARM 连接后点「检查更新」下载助手`}),(0,U.jsx)(gg,{open:_e,onOpenChange:e=>{!Me&&!De&&ve(e)},children:(0,U.jsxs)(yg,{className:`flex max-h-[88vh] max-w-2xl flex-col overflow-hidden sm:max-w-2xl`,children:[(0,U.jsxs)(bg,{children:[(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Wh,{className:`h-4 w-4 text-primary`}),`新建助手`]}),(0,U.jsx)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[[`1`,`描述`],[`2`,`档案`],[`3`,`上岗`]].map(([e,t],n)=>(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[n>0&&(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,U.jsx)(`span`,{className:`flex h-4 w-4 items-center justify-center rounded-full text-[9px] ${ye>n?`bg-primary text-primary-foreground`:`border border-border text-muted-foreground`}`,children:e}),(0,U.jsx)(`span`,{className:ye>n?`font-medium text-foreground`:`text-muted-foreground`,children:t})]},e))})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-0.5`,children:ye===1?(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:`你想让小助手帮你做什么?`}),(0,U.jsx)(`p`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:`用一段话描述职责,AI 起草名称与 System Prompt,下一步可自由编辑。`})]}),(0,U.jsx)(`textarea`,{value:Ce,onChange:e=>we(e.target.value),spellCheck:!1,rows:5,placeholder:`例如:帮我盯冷库温度,出现异常时结合传感器读数和压缩机状态给出处置建议;每天早上汇总告警……`,className:`w-full resize-y rounded-md border bg-background p-2.5 text-xs leading-relaxed`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`试试:`}),[`排查WMS日志报错并给出定位`,`汇总每日告警生成晨报`,`回答新人运维常见问题`,`冷库温度异常诊断`].map(e=>(0,U.jsx)(`button`,{onClick:()=>we(e),className:`rounded-full border border-border px-2 py-0.5 text-[10px] text-muted-foreground transition-colors hover:border-primary/60 hover:text-primary`,children:e},e))]})]}):(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`名称(ARM 全局唯一)`}),(0,U.jsx)(wg,{value:xe,onChange:e=>Se(e.target.value),placeholder:`如:冷库温控诊断助手`,className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`描述(≤512 字,可选)`}),(0,U.jsx)(wg,{value:Ce,onChange:e=>we(e.target.value),placeholder:`一句话职责说明`,className:`text-xs`})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`System Prompt`,(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-6 gap-1 px-1.5 text-[10px]`,disabled:De,onClick:()=>He(!1),children:[(0,U.jsx)(Wh,{className:`h-3 w-3 ${De?`animate-pulse`:``}`}),De?`起草中…`:`重新起草`]}),(0,U.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:`按左侧描述重新生成`})]}),(0,U.jsx)(`textarea`,{value:Te,onChange:e=>Ee(e.target.value),spellCheck:!1,rows:8,className:`w-full resize-y rounded-md border bg-background p-2 font-mono text-xs leading-relaxed`})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`绑定知识(可选)——助手创建后即可检索这些经验`,ze.length>0&&(0,U.jsxs)(J,{variant:`secondary`,className:`h-4 px-1 text-[9px]`,children:[`已选 `,ze.length]})]}),ze.length>0&&(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:ze.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-1.5 py-0.5 text-[10px]`,children:[(0,U.jsx)(`span`,{className:`max-w-56 truncate`,title:e.name,children:e.name}),(0,U.jsx)(`button`,{className:`shrink-0 text-muted-foreground hover:text-destructive`,onClick:()=>Be(t=>t.filter(t=>t.id!==e.id)),children:(0,U.jsx)(mg,{className:`h-2.5 w-2.5`})})]},e.id))}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(wg,{value:Pe,onChange:e=>Fe(e.target.value),placeholder:`按关键词检索 ARM 知识库,如 wms / 告警 / dockerfile`,className:`text-xs`,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),Ue())}}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-8 shrink-0 text-xs`,disabled:!Pe.trim(),onClick:Ue,children:`检索`})]}),Ie.length>0&&(0,U.jsx)(`div`,{className:`max-h-36 space-y-0.5 overflow-y-auto rounded-md border p-1`,children:Ie.map(e=>{let t=Ve.has(e.id);return(0,U.jsxs)(`button`,{onClick:()=>Be(n=>t?n.filter(t=>t.id!==e.id):[...n,{id:e.id,name:e.name}]),className:`flex w-full min-w-0 items-start gap-2 rounded px-1.5 py-1 text-left transition-colors hover:bg-accent`,children:[t?(0,U.jsx)(Bp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-primary`}):(0,U.jsx)(mh,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[11px] font-medium`,title:e.name,children:e.name}),e.description&&(0,U.jsx)(`span`,{className:`block truncate text-[10px] text-muted-foreground`,title:e.description,children:e.description})]})]},e.id)})})]})]})}),(0,U.jsx)(xg,{children:ye===1?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{variant:`ghost`,className:`text-xs text-muted-foreground`,onClick:()=>be(2),children:`跳过,手动填写 →`}),(0,U.jsxs)(Y,{className:`gap-1 text-xs`,disabled:De||!Ce.trim(),onClick:()=>He(!0),children:[(0,U.jsx)(Wh,{className:`h-3.5 w-3.5 ${De?`animate-pulse`:``}`}),De?`AI 起草中…`:`AI 起草档案 →`]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:Me,onClick:()=>be(1),children:`← 上一步`}),(0,U.jsx)(Y,{disabled:Me||!xe.trim()||!Te.trim(),onClick:We,children:Me?`创建中…`:`创建并进入上岗配置`})]})})]})}),(0,U.jsx)(gg,{open:!!at,onOpenChange:e=>{!e&&!pt&&!gt&&(ot(null),W(null),Ge())},children:(0,U.jsxs)(yg,{className:`flex max-h-[88vh] max-w-2xl flex-col overflow-hidden sm:max-w-2xl`,children:[(0,U.jsxs)(bg,{children:[(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Kh,{className:`h-4 w-4 text-primary`}),`编辑档案 · `,at?.name,at?.created_via_workstation&&(0,U.jsx)(J,{variant:`secondary`,className:`h-4 px-1 text-[9px]`,children:`工作站创建`})]}),(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:at?.local_only?`本地未发布档案——保存仅写本地(版本前进可回滚);发布到 ARM 后编辑将同步远端。恢复连接前暂不能绑定技能/知识。`:`档案存于 ARM(创建者或管理员可改);保存/绑定后本地档案同步物化(版本前进,可回滚)。`})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto pr-0.5`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`名称`}),(0,U.jsx)(wg,{value:st,onChange:e=>ct(e.target.value),className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`描述`}),(0,U.jsx)(wg,{value:lt,onChange:e=>ut(e.target.value),className:`text-xs`})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`System Prompt(保存后本地档案同步更新)`}),(0,U.jsx)(`textarea`,{value:dt,onChange:e=>ft(e.target.value),spellCheck:!1,rows:8,className:`w-full resize-y rounded-md border bg-background p-2 font-mono text-xs leading-relaxed`})]}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t pt-3`,children:[(0,U.jsxs)(Tg,{className:`text-xs`,children:[`绑定技能(`,ht?.skills.length??`…`,`)——立即生效,无需保存`]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[ht&&ht.skills.length===0&&(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`暂无绑定`}),(ht?.skills||[]).map(e=>(0,U.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-1.5 py-0.5 text-[10px]`,title:e.description,children:[(0,U.jsx)(fg,{className:`h-2.5 w-2.5 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`max-w-56 truncate`,children:e.name}),(0,U.jsx)(`button`,{disabled:gt,className:`shrink-0 text-muted-foreground hover:text-destructive`,title:`解绑`,onClick:()=>Jt(`skill`,e.binding_id,e.name),children:(0,U.jsx)(mg,{className:`h-2.5 w-2.5`})})]},e.binding_id))]}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(wg,{value:vt,onChange:e=>yt(e.target.value),placeholder:at?.local_only?`本地未发布档案,发布后可绑定技能`:`按关键词检索 ARM 技能库`,className:`text-xs`,disabled:!!at?.local_only,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),Gt())}}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-8 shrink-0 text-xs`,disabled:!vt.trim()||!!at?.local_only,onClick:Gt,children:`检索`})]}),bt.length>0&&(0,U.jsx)(`div`,{className:`max-h-28 space-y-0.5 overflow-y-auto rounded-md border p-1`,children:bt.map(e=>{let t=ht?.skills.some(t=>t.ref_id===e.id);return(0,U.jsxs)(`button`,{disabled:gt||t,onClick:()=>qt(`skill`,e.id),className:`flex w-full min-w-0 items-start gap-2 rounded px-1.5 py-1 text-left transition-colors hover:bg-accent disabled:opacity-50`,children:[t?(0,U.jsx)(Bp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-primary`}):(0,U.jsx)(mh,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[11px] font-medium`,title:e.name,children:e.name}),e.description&&(0,U.jsx)(`span`,{className:`block truncate text-[10px] text-muted-foreground`,title:e.description,children:e.description})]})]},e.id)})})]}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t pt-3`,children:[(0,U.jsxs)(Tg,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[`绑定知识(`,ht?.knowledges.length??`…`,`)——立即生效,无需保存`,(0,U.jsxs)(Eg,{value:Et,onValueChange:Dt,children:[(0,U.jsx)(Og,{className:`h-6 w-28 text-[10px]`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsx)(Ag,{value:`essential`,className:`text-xs`,children:`核心知识`}),(0,U.jsx)(Ag,{value:`experience`,className:`text-xs`,children:`经验`})]})]}),(0,U.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:`新增绑定按此类型写入`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[ht&&ht.knowledges.length===0&&(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`暂无绑定`}),(ht?.knowledges||[]).map(e=>(0,U.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-1.5 py-0.5 text-[10px]`,title:e.description,children:[(0,U.jsx)(Sp,{className:`h-2.5 w-2.5 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`max-w-56 truncate`,children:e.name}),e.kind&&(0,U.jsx)(J,{variant:`outline`,className:`h-3.5 px-1 text-[8px]`,children:e.kind===`essential`?`核心`:`经验`}),(0,U.jsx)(`button`,{disabled:gt,className:`shrink-0 text-muted-foreground hover:text-destructive`,title:`解绑`,onClick:()=>Jt(`knowledge`,e.binding_id,e.name),children:(0,U.jsx)(mg,{className:`h-2.5 w-2.5`})})]},e.binding_id))]}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(wg,{value:St,onChange:e=>Ct(e.target.value),placeholder:at?.local_only?`本地未发布档案,发布后可绑定知识`:`按关键词检索 ARM 知识库`,className:`text-xs`,disabled:!!at?.local_only,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),Kt())}}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-8 shrink-0 text-xs`,disabled:!St.trim()||!!at?.local_only,onClick:Kt,children:`检索`})]}),wt.length>0&&(0,U.jsx)(`div`,{className:`max-h-28 space-y-0.5 overflow-y-auto rounded-md border p-1`,children:wt.map(e=>{let t=ht?.knowledges.some(t=>t.ref_id===e.id);return(0,U.jsxs)(`button`,{disabled:gt||t,onClick:()=>qt(`knowledge`,e.id,Et),className:`flex w-full min-w-0 items-start gap-2 rounded px-1.5 py-1 text-left transition-colors hover:bg-accent disabled:opacity-50`,children:[t?(0,U.jsx)(Bp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-primary`}):(0,U.jsx)(mh,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[11px] font-medium`,title:e.name,children:e.name}),e.description&&(0,U.jsx)(`span`,{className:`block truncate text-[10px] text-muted-foreground`,title:e.description,children:e.description})]})]},e.id)})})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:pt||gt,onClick:()=>{ot(null),W(null),Ge()},children:`关闭`}),(0,U.jsx)(Y,{disabled:pt||!st.trim()||!dt.trim(),onClick:Xt,children:pt?`保存中…`:`保存档案(ARM + 本地)`})]})]})}),(0,U.jsx)(gg,{open:!!Pt,onOpenChange:e=>{Rt||Ft(e?Pt:null)},children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Xp,{className:`h-4 w-4 text-primary`}),`克隆助手 · `,Pt?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,U.jsxs)(`p`,{className:`text-muted-foreground`,children:[`复制档案(Prompt/描述)与全部绑定(技能 `,Pt?.skills??0,` · 知识 `,Pt?.knowledges??0,`),创建一个`,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:`归你所有`}),`的新助手——可自由编辑,不影响原助手。`,!Pt?.installed&&`(原助手未下载也无妨,克隆直接读 ARM 档案)`]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`新助手名称(ARM 全局唯一)`}),(0,U.jsx)(wg,{value:It,onChange:e=>Lt(e.target.value),placeholder:`${Pt?.name||``}-副本`,className:`text-xs`,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&It.trim()&&!Rt&&(e.preventDefault(),Qt())}})]}),(0,U.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`创建后档案自动物化本地;克隆完成即可「上岗配置」或进编辑调整 Prompt。`})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:Rt,onClick:()=>Ft(null),children:`取消`}),(0,U.jsx)(Y,{disabled:Rt||!It.trim(),onClick:Qt,children:Rt?`克隆中…`:`创建副本`})]})]})}),(0,U.jsx)(gg,{open:!!Bt,onOpenChange:e=>{Vt||G(e?Bt:null)},children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Jp,{className:`h-4 w-4 text-warning`}),`发布到「`,l?.name||`ARM`,`」 · `,Bt?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[Bt?.foreign?(0,U.jsxs)(`p`,{className:`leading-relaxed text-muted-foreground`,children:[`该助手来自 ARM 源「`,Bt.source_name,`」。发布后以`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`同一身份(id)`}),`出现在当前源「`,l?.name,`」: 档案(名称 / 描述 / Prompt)与本地已物化的`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`知识全文`}),`一并创建并绑定;技能与 UI 资产属 ARM 侧资产`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`不复制`}),`(发布后可在编辑里重新绑定)。 本地在岗状态、工作台与数据不受影响。`]}):(0,U.jsxs)(`p`,{className:`leading-relaxed text-muted-foreground`,children:[`该助手创建于离线环境(档案仅在本机)。发布后:`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`团队可见`}),`、可绑定技能/知识/UI 资产、进入版本升级链路。 助手身份与本地数据`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`保持不变`}),`(档案/配置分离),在岗状态与工作台不受影响。`]}),(0,U.jsx)(`p`,{className:`rounded-md border border-warning/30 bg-warning/10 px-2.5 py-1.5 text-warning`,children:`名称在该 ARM 源内全局唯一——若他人已用同名(含其本人发布同款),发布会提示冲突,改名后重试即可。`})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:Vt,onClick:()=>G(null),children:`取消`}),(0,U.jsx)(Y,{disabled:Vt,onClick:Ut,children:Vt?`发布中…`:`发布到「${l?.name||`ARM`}」`})]})]})}),(0,U.jsx)(gg,{open:!!Ot,onOpenChange:e=>{Mt||kt(e?Ot:null)},children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-2 text-destructive`,children:[(0,U.jsx)(ng,{className:`h-4 w-4`}),Ot?.local_only?`删除本地档案「${Ot?.name}」?`:`从 ARM 删除「${Ot?.name}」?`]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[Ot?.local_only?(0,U.jsxs)(`p`,{className:`leading-relaxed`,children:[`该助手是离线创建的`,(0,U.jsx)(`b`,{children:`本地未发布档案`}),`(ARM 上不存在)——删除仅移除本机的档案/配置/工作台,不影响其他人。`]}):(0,U.jsxs)(`p`,{className:`leading-relaxed`,children:[`将调用 ARM 删除接口`,(0,U.jsx)(`b`,{children:`永久移除该助手档案`}),`(含已绑定的知识与版本记录),所有工作站将不再可见,此操作不可恢复。`,Ot?.deployed&&` 该助手当前在岗,删除将同时移除上岗配置、工作台与本地档案。`]}),Ot?.installed&&!Ot?.deployed&&(0,U.jsxs)(`label`,{className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 p-2.5`,children:[(0,U.jsx)(hg,{checked:At,onCheckedChange:e=>jt(!!e)}),(0,U.jsx)(`span`,{children:`同时清除工作区数据(数据集库与文件;不勾选则保留在磁盘)`})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:Mt,onClick:()=>kt(null),children:`取消`}),(0,U.jsx)(Y,{variant:`destructive`,disabled:Mt,onClick:Zt,children:Mt?`删除中…`:Ot?.local_only?`确认删除本地档案`:`确认从 ARM 删除`})]})]})}),(0,U.jsx)(gg,{open:!!M,onOpenChange:e=>!se&&N(e?M:null),children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[ae?`调整权限`:`上岗配置`,` · `,M?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`岗位名称`}),(0,U.jsx)(wg,{value:P,onChange:e=>F(e.target.value),className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`它能做什么?(选一档,工具与确认策略一次配好)`}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[h_.map(e=>{let t=re===e.id,n=e.id===`observer`?m_.length:j.length,r=e.autonomy===`L3`?`免确认`:e.autonomy===`L2`?`写操作先确认`:`不动手`;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>tt(e.id),className:B(`flex items-start gap-2 rounded-lg border p-2.5 text-left transition-colors`,t?`border-primary bg-primary/10`:`border-border hover:border-primary/50`),children:[(0,U.jsx)(`span`,{className:`pt-0.5 text-sm leading-none`,children:e.emoji}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-medium`,children:[e.title,`recommended`in e&&e.recommended&&(0,U.jsx)(J,{className:`h-4 bg-primary/15 px-1 text-[9px] text-primary`,children:`推荐`}),t&&(0,U.jsx)(Bp,{className:`h-3.5 w-3.5 text-primary`})]}),(0,U.jsx)(`span`,{className:`mt-0.5 block text-[10px] leading-relaxed text-muted-foreground`,children:e.desc}),(0,U.jsxs)(`span`,{className:`mt-0.5 block text-[9px] text-muted-foreground`,children:[n,` 项工具 · `,r,`(`,e.autonomy,`)`]})]})]},e.id)}),re===`custom`&&(0,U.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`当前为手动微调的自定义组合`})]})]}),(0,U.jsxs)(`details`,{className:`rounded-md border`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer select-none px-2.5 py-2 text-[11px] text-muted-foreground hover:text-foreground`,children:`高级:逐项微调工具与自主级别`}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t p-2.5`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`自主级别(写操作要不要先问你)`}),(0,U.jsxs)(Eg,{value:I,onValueChange:e=>{L(e),ie(`custom`)},children:[(0,U.jsx)(Og,{className:`text-xs`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsx)(Ag,{value:`L0`,className:`text-xs`,children:`只回答不动手(L0)`}),(0,U.jsx)(Ag,{value:`L1`,className:`text-xs`,children:`给建议不动手(L1)`}),(0,U.jsx)(Ag,{value:`L2`,className:`text-xs`,children:`做了等我确认(L2)`}),(0,U.jsx)(Ag,{value:`L3`,className:`text-xs text-destructive`,children:`全自动免确认(L3)`})]})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`text-xs`,children:[`工具(`,te.length,`/`,j.length,` 项)`]}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 rounded-md border p-2`,children:j.map(e=>(0,U.jsxs)(`label`,{className:`flex items-start gap-2 text-xs`,children:[(0,U.jsx)(hg,{checked:te.includes(e.name),onCheckedChange:t=>{ne(n=>t?[...n,e.name]:n.filter(t=>t!==e.name)),ie(`custom`)}}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:e.name}),(0,U.jsx)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:e.description.slice(0,40)}),e.min_level>=2&&(0,U.jsx)(J,{variant:`outline`,className:`ml-1 h-4 px-1 text-[9px] text-warning`,children:`写·L2`})]})]},e.name))})]})]})]}),(0,U.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:ae?`保存后即时生效,不影响会话与数据`:`保存后自动下载档案到本地(离线可用)并生成初版工作台与默认工作区`})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:se,onClick:()=>N(null),children:`取消`}),(0,U.jsx)(Y,{disabled:se,onClick:$t,children:se?ae?`保存中…`:`上岗中…`:ae?`保存调整`:`确认上岗`})]})]})}),(0,U.jsx)(gg,{open:!!le,onOpenChange:e=>!e&&ue(null),children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[`升级 · `,le?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(J,{variant:`outline`,children:le?.installed_version}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,U.jsx)(J,{className:`bg-warning/15 text-warning hover:bg-warning/25`,children:le?.remote_version})]}),(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:`将从 ARM 拉取新版本档案(prompt + 绑定知识全文)物化到本地版本目录,原版本保留可回滚。若该助手在 ARM 绑定了 UI 资产(三资产模型),将一并物化为工作台新版本(历史可回滚)。`}),(0,U.jsx)(`p`,{className:`rounded-md border border-success/30 bg-success/10 px-2.5 py-1.5 text-success`,children:`你的工作台、插件、工作区与数据将完整保留(档案/配置分离);UI 资产物化只前进版本号不覆盖历史。档案实质变更后,可在「定制工作台」让工程师基于新能力重新定制。`})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:()=>ue(null),children:`稍后`}),(0,U.jsx)(Y,{disabled:_===le?.agent_id,onClick:()=>le&&Ze(le,`upgrade`),children:_===le?.agent_id?`升级中…`:`升级并保留配置`})]})]})}),(0,U.jsx)(gg,{open:!!de,onOpenChange:e=>{e||(fe(null),z(null))},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[`本地版本 · `,de?.name]})}),(0,U.jsxs)(`div`,{className:`max-h-72 space-y-1.5 overflow-auto text-xs`,children:[!R&&(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:`加载中…`}),R?.versions.length===0&&(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:`无本地版本`}),R?.versions.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border px-2.5 py-2`,children:[(0,U.jsx)(wh,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:e.version}),e.current&&(0,U.jsx)(J,{className:`h-4 bg-primary/15 px-1 text-[9px] text-primary`,children:`当前`}),R.remote_version===e.version&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:`与远端一致`})]}),(0,U.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[Le(e.downloaded_at,`dts`),` · 本地知识 `,e.knowledges,` 条`]})]}),!e.current&&(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-7 text-[11px]`,onClick:()=>de&&$e(de,e.version),children:`回滚到此版`})]},e.version))]}),(0,U.jsxs)(xg,{className:`sm:justify-between`,children:[(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,className:`gap-1 text-xs text-destructive hover:text-destructive`,onClick:()=>de&&me(de),children:[(0,U.jsx)(ng,{className:`h-3.5 w-3.5`}),`卸载该助手`]}),(0,U.jsx)(Y,{variant:`outline`,onClick:()=>{fe(null),z(null)},children:`关闭`})]})]})}),(0,U.jsx)(gg,{open:!!pe,onOpenChange:e=>{e||(me(null),ge(!1))},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[`卸载 · `,pe?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,U.jsxs)(`p`,{children:[`将删除:本地档案(全部版本)、上岗配置、工作台定义与草稿`,pe?.deployed?`(该助手在岗,将一并下岗)`:``,`。`]}),(0,U.jsxs)(`label`,{className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 p-2.5`,children:[(0,U.jsx)(hg,{checked:he,onCheckedChange:e=>ge(!!e)}),(0,U.jsx)(`span`,{children:`同时清除工作区数据(默认工作区目录 + 数据集库;自定义路径只删登记、不动用户文件)`})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:()=>me(null),children:`取消`}),(0,U.jsx)(Y,{variant:`destructive`,disabled:_===pe?.agent_id,onClick:()=>pe&&et(pe),children:_===pe?.agent_id?`卸载中…`:`确认卸载`})]})]})})]})}function __(e){return e?.views?.length?e.views:[{id:`main`,name:`主视图`,panels:e?.panels||[]}]}function v_(e){let t=__(e).map(e=>({...e,panels:[...e.panels]}));return{...e,views:t,panels:t.flatMap(e=>e.panels)}}var y_=He(`relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current`}},defaultVariants:{variant:`default`}});function b_({className:e,variant:t,...n}){return(0,U.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:B(y_({variant:t}),e),...n})}function x_({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`alert-title`,className:B(`col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight`,e),...t})}function S_({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`alert-description`,className:B(`col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground [&_p]:leading-relaxed`,e),...t})}function C_(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var w_=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,T_=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E_={};function D_(e,t){return((t||E_).jsx?T_:w_).test(e)}var O_=/[ \t\n\f\r]/g;function k_(e){return typeof e==`object`?e.type===`text`&&A_(e.value):A_(e)}function A_(e){return e.replace(O_,``)===``}var j_=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};j_.prototype.normal={},j_.prototype.property={},j_.prototype.space=void 0;function M_(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new j_(n,r,t)}function N_(e){return e.toLowerCase()}var P_=class{constructor(e,t){this.attribute=t,this.property=e}};P_.prototype.attribute=``,P_.prototype.booleanish=!1,P_.prototype.boolean=!1,P_.prototype.commaOrSpaceSeparated=!1,P_.prototype.commaSeparated=!1,P_.prototype.defined=!1,P_.prototype.mustUseProperty=!1,P_.prototype.number=!1,P_.prototype.overloadedBoolean=!1,P_.prototype.property=``,P_.prototype.spaceSeparated=!1,P_.prototype.space=void 0;var F_=s({boolean:()=>L_,booleanish:()=>R_,commaOrSpaceSeparated:()=>H_,commaSeparated:()=>V_,number:()=>Q,overloadedBoolean:()=>z_,spaceSeparated:()=>B_}),I_=0,L_=U_(),R_=U_(),z_=U_(),Q=U_(),B_=U_(),V_=U_(),H_=U_();function U_(){return 2**++I_}var W_=Object.keys(F_),G_=class extends P_{constructor(e,t,n,r){let i=-1;if(super(e,t),K_(this,`space`,r),typeof n==`number`)for(;++i<W_.length;){let e=W_[i];K_(this,W_[i],(n&F_[e])===F_[e])}}};G_.prototype.defined=!0;function K_(e,t,n){n&&(e[t]=n)}function q_(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new G_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[N_(r)]=r,n[N_(a.attribute)]=r}return new j_(t,n,e.space)}var J_=q_({properties:{ariaActiveDescendant:null,ariaAtomic:R_,ariaAutoComplete:null,ariaBusy:R_,ariaChecked:R_,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:B_,ariaCurrent:null,ariaDescribedBy:B_,ariaDetails:null,ariaDisabled:R_,ariaDropEffect:B_,ariaErrorMessage:null,ariaExpanded:R_,ariaFlowTo:B_,ariaGrabbed:R_,ariaHasPopup:null,ariaHidden:R_,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:B_,ariaLevel:Q,ariaLive:null,ariaModal:R_,ariaMultiLine:R_,ariaMultiSelectable:R_,ariaOrientation:null,ariaOwns:B_,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:R_,ariaReadOnly:R_,ariaRelevant:null,ariaRequired:R_,ariaRoleDescription:B_,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:R_,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Y_(e,t){return t in e?e[t]:t}function X_(e,t){return Y_(e,t.toLowerCase())}var Z_=q_({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:V_,acceptCharset:B_,accessKey:B_,action:null,allow:null,allowFullScreen:L_,allowPaymentRequest:L_,allowUserMedia:L_,alpha:L_,alt:null,as:null,async:L_,autoCapitalize:null,autoComplete:B_,autoFocus:L_,autoPlay:L_,blocking:B_,capture:null,charSet:null,checked:L_,cite:null,className:B_,closedBy:null,colorSpace:null,cols:Q,colSpan:Q,command:null,commandFor:null,content:null,contentEditable:R_,controls:L_,controlsList:B_,coords:Q|V_,crossOrigin:null,data:null,dateTime:null,decoding:null,default:L_,defer:L_,dir:null,dirName:null,disabled:L_,download:z_,draggable:R_,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:L_,formTarget:null,headers:B_,height:Q,hidden:z_,high:Q,href:null,hrefLang:null,htmlFor:B_,httpEquiv:B_,id:null,imageSizes:null,imageSrcSet:null,inert:L_,inputMode:null,integrity:null,is:null,isMap:L_,itemId:null,itemProp:B_,itemRef:B_,itemScope:L_,itemType:B_,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:L_,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:L_,muted:L_,name:null,nonce:null,noModule:L_,noValidate:L_,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:L_,optimum:Q,pattern:null,ping:B_,placeholder:null,playsInline:L_,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:L_,referrerPolicy:null,rel:B_,required:L_,reversed:L_,rows:Q,rowSpan:Q,sandbox:B_,scope:null,scoped:L_,seamless:L_,selected:L_,shadowRootClonable:L_,shadowRootCustomElementRegistry:L_,shadowRootDelegatesFocus:L_,shadowRootMode:null,shadowRootSerializable:L_,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:R_,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:L_,useMap:null,value:R_,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:B_,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:L_,declare:L_,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:L_,noHref:L_,noShade:L_,noWrap:L_,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:R_,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:L_,disablePictureInPicture:L_,disableRemotePlayback:L_,exportParts:V_,part:B_,prefix:null,property:null,results:Q,security:null,unselectable:null},space:`html`,transform:X_}),Q_=q_({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:H_,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:B_,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:L_,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:V_,g2:V_,glyphName:V_,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:H_,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:B_,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:H_,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:H_,rev:H_,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:H_,requiredFeatures:H_,requiredFonts:H_,requiredFormats:H_,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:H_,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:H_,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:H_,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Y_}),$_=q_({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),ev=q_({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:X_}),tv=q_({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),nv={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},rv=/[A-Z]/g,iv=/-[a-z]/g,av=/^data[-\w.:]+$/i;function ov(e,t){let n=N_(t),r=t,i=P_;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&av.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(iv,cv);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!iv.test(e)){let n=e.replace(rv,sv);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=G_}return new i(r,t)}function sv(e){return`-`+e.toLowerCase()}function cv(e){return e.charAt(1).toUpperCase()}var lv=M_([J_,Z_,$_,ev,tv],`html`),uv=M_([J_,Q_,$_,ev,tv],`svg`);function dv(e){return e.join(` `).trim()}var fv=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
52
+ `},bi=0,xi=[];function Si(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(bi++)[0],a=v.useState(Wr)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=br([e.lockRef.current],(e.shards||[]).map(_i),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=v.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=hi(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ci(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ci(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return mi(h,t,e,h===`h`?s:c,!0)},[]),c=v.useCallback(function(e){var n=e;if(xi.length&&xi[xi.length-1]===a){var r=`deltaY`in n?gi(n):hi(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&vi(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(_i).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=v.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ci(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=v.useCallback(function(e){n.current=hi(e),r.current=void 0},[]),d=v.useCallback(function(t){l(t.type,gi(t),t.target,s(t,e.lockRef.current))},[]),f=v.useCallback(function(t){l(t.type,hi(t),t.target,s(t,e.lockRef.current))},[]);v.useEffect(function(){return xi.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ri),document.addEventListener(`touchmove`,c,ri),document.addEventListener(`touchstart`,u,ri),function(){xi=xi.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ri),document.removeEventListener(`touchmove`,c,ri),document.removeEventListener(`touchstart`,u,ri)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(a,{styles:yi(i)}):null,p?v.createElement(ei,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ci(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var wi=Pr(Fr,Si),Ti=v.forwardRef(function(e,t){return v.createElement(Lr,vr({},e,{ref:t,sideCar:wi}))});Ti.classNames=Lr.classNames;var Ei=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Di=new WeakMap,Oi=new WeakMap,ki={},Ai=0,ji=function(e){return e&&(e.host||ji(e.parentNode))},Mi=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ji(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Ni=function(e,t,n,r){var i=Mi(t,Array.isArray(e)?e:[e]);ki[n]||(ki[n]=new WeakMap);var a=ki[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Di.get(e)||0)+1,l=(a.get(e)||0)+1;Di.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Oi.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Ai++,function(){o.forEach(function(e){var t=Di.get(e)-1,i=a.get(e)-1;Di.set(e,t),a.set(e,i),t||(Oi.has(e)||e.removeAttribute(r),Oi.delete(e)),i||e.removeAttribute(n)}),Ai--,Ai||(Di=new WeakMap,Di=new WeakMap,Oi=new WeakMap,ki={})}},Pi=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Ei(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Ni(r,i,n,`aria-hidden`)):function(){return null}},Fi=Object.defineProperty,Ii=(e,t)=>Fi(e,`name`,{value:t,configurable:!0}),Li=`Dialog`,[Ri,zi]=xt(Li),[Bi,Vi]=Ri(Li),Hi=Ii(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),{nodes:l,registry:u}=Xn(),[d,f]=$t({prop:r,defaultProp:i??!1,onChange:a,caller:Li}),[p,m]=v.useState(0),[h,g]=v.useState(0);return(0,U.jsx)(Bi,{scope:t,triggerRef:s,contentRef:c,contentId:vn(),titleId:vn(),descriptionId:vn(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),Ui=`DialogPortal`,[Wi,Gi]=Ri(Ui,{forceMount:void 0}),Ki=Ii(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Vi(Ui,t);return(0,U.jsx)(Wi,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,U.jsx)(cn,{present:n||a.open,children:(0,U.jsx)(ur,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),qi=`DialogOverlay`,Ji=v.forwardRef(Ii(function(e,t){let n=Gi(qi,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Vi(qi,e.__scopeDialog);return a.modal?(0,U.jsx)(cn,{present:r||a.open,children:(0,U.jsx)(Xi,{...i,ref:t})}):null},`DialogOverlay`)),Yi=Ye(`DialogOverlay.RemoveScroll`),Xi=v.forwardRef(Ii(function(e,t){let{__scopeDialog:n,...r}=e,i=Vi(qi,n),a=H(t,In());return(0,U.jsx)(Ti,{as:Yi,allowPinchZoom:!0,shards:v.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,U.jsx)(W.div,{"data-state":sa(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Zi=`DialogContent`,Qi=v.forwardRef(Ii(function(e,t){let n=Gi(Zi,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Vi(Zi,e.__scopeDialog);return(0,U.jsx)(cn,{present:r||a.open,children:a.modal?(0,U.jsx)($i,{...i,ref:t}):(0,U.jsx)(ea,{...i,ref:t})})},`DialogContent`)),$i=v.forwardRef(Ii(function(e,t){let n=Vi(Zi,e.__scopeDialog),r=v.useRef(null),i=H(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return Pi(e)},[]),(0,U.jsx)(ta,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),ea=v.forwardRef(Ii(function(e,t){let n=Vi(Zi,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,U.jsx)(ta,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),ta=v.forwardRef(Ii(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=Vi(Zi,n);return gr(),(0,U.jsx)(Yn,{registry:l.branchRegistry,children:(0,U.jsx)(qn,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(Fn,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?oa(o,l.descriptionId):o,"data-state":sa(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),na=v.forwardRef(Ii(function(e,t){let{__scopeDialog:n,...r}=e,i=Vi(`DialogTitle`,n),{setTitleCount:a}=i;return Ct(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,U.jsx)(W.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),ra=v.forwardRef(Ii(function(e,t){let{__scopeDialog:n,...r}=e,i=Vi(`DialogDescription`,n),{setDescriptionCount:a}=i;return Ct(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,U.jsx)(W.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),ia=`DialogClose`,aa=v.forwardRef(Ii(function(e,t){let{__scopeDialog:n,...r}=e,i=Vi(ia,n);return(0,U.jsx)(W.button,{type:`button`,...r,ref:t,onClick:G(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function oa(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}Ii(oa,`concatAriaDescribedby`);function sa(e){return e?`open`:`closed`}Ii(sa,`getState`);var ca=Object.defineProperty,la=(e,t)=>ca(e,`name`,{value:t,configurable:!0});function ua(e){let[t,n]=v.useState(void 0);return Ct(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=0,r=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;let i=r[0];window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{let t,r;if(`borderBoxSize`in i){let e=i.borderBoxSize,n=Array.isArray(e)?e[0]:e;t=n.inlineSize,r=n.blockSize}else t=e.offsetWidth,r=e.offsetHeight;n({width:t,height:r})})});return r.observe(e,{box:`border-box`}),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}n(void 0)},[e]),t}la(ua,`useSize`);var da=Object.defineProperty,fa=(e,t)=>da(e,`name`,{value:t,configurable:!0}),pa=`Checkbox`,[ma,ha]=xt(pa),[ga,_a]=ma(pa);function va(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=$t({prop:n,defaultProp:i??!1,onChange:c,caller:pa}),[m,h]=v.useState(null),[g,_]=v.useState(null),[y,b]=v.useState(null),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,userClick:y,onUserClick:b,required:l,defaultChecked:!Da(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,U.jsx)(ga,{scope:t,...S,children:Ea(d)?d(S):r})}fa(va,`CheckboxProvider`);var ya=`CheckboxTrigger`,ba=v.forwardRef(fa(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,onUserClick:f,isFormControl:p,bubbleInput:m}=_a(ya,e),h=H(i,u),g=v.useRef(c);return v.useEffect(()=>{let e=a?.form;if(e){let t=fa(()=>d(g.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,U.jsx)(W.button,{type:`button`,role:`checkbox`,"aria-checked":Da(c)?`mixed`:c,"aria-required":l,"data-state":Oa(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:G(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:G(n,e=>{let t=e.isPropagationStopped();f({requestedChecked:Da(c)?!0:!c,hasConsumerStoppedPropagation:t}),d(e=>Da(e)?!0:!e),m&&p&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),xa=v.forwardRef(fa(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,U.jsx)(va,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ba,{...d,ref:t,__scopeCheckbox:n}),e&&(0,U.jsx)(Ta,{__scopeCheckbox:n})]})})},`Checkbox`)),Sa=`CheckboxIndicator`,Ca=v.forwardRef(fa(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=_a(Sa,n);return(0,U.jsx)(cn,{present:r||Da(a.checked)||a.checked===!0,children:(0,U.jsx)(W.span,{"data-state":Oa(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),wa=`CheckboxBubbleInput`,Ta=v.forwardRef(fa(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:c,disabled:l,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:m}=_a(wa,e),h=H(r,m),g=ua(i),_=v.useRef(!1),y=v.useRef(o),b=v.useRef(a),x=v.useRef(null);v.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=y.current!==o;y.current=o;let i=a!==null&&a!==b.current;if(b.current=a,i)x.current=r?null:a,r&&(e.indeterminate=Da(o),n.call(e,!Da(o)&&o)),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=x.current;x.current=null;let r=t?.requestedChecked===o;_.current=!0,e.indeterminate=Da(o),n.call(e,!Da(o)&&o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),_.current=!1}},[p,o,a]);let S=v.useRef(!Da(o)&&o);return(0,U.jsx)(W.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??S.current,required:c,disabled:l,name:u,value:d,form:f,...n,tabIndex:-1,ref:h,onClick:G(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function Ea(e){return typeof e==`function`}fa(Ea,`isFunction`);function Da(e){return e===`indeterminate`}fa(Da,`isIndeterminate`);function Oa(e){return Da(e)?`indeterminate`:e?`checked`:`unchecked`}fa(Oa,`getState`);var ka=[`top`,`right`,`bottom`,`left`],Aa=Math.min,ja=Math.max,Ma=Math.round,Na=Math.floor,Pa=e=>({x:e,y:e}),Fa={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ia(e,t,n){return ja(e,Aa(t,n))}function La(e,t){return typeof e==`function`?e(t):e}function Ra(e){return e.split(`-`)[0]}function za(e){return e.split(`-`)[1]}function Ba(e){return e===`x`?`y`:`x`}function Va(e){return e===`y`?`height`:`width`}function Ha(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ua(e){return Ba(Ha(e))}function Wa(e,t,n){n===void 0&&(n=!1);let r=za(e),i=Ua(e),a=Va(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=$a(o)),[o,$a(o)]}function Ga(e){let t=$a(e);return[Ka(e),t,Ka(t)]}function Ka(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var qa=[`left`,`right`],Ja=[`right`,`left`],Ya=[`top`,`bottom`],Xa=[`bottom`,`top`];function Za(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ja:qa:t?qa:Ja;case`left`:case`right`:return t?Ya:Xa;default:return[]}}function Qa(e,t,n,r){let i=za(e),a=Za(Ra(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ka)))),a}function $a(e){let t=Ra(e);return Fa[t]+e.slice(t.length)}function eo(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function to(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:eo(e)}function no(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ro(e,t,n){let{reference:r,floating:i}=e,a=Ha(t),o=Ua(t),s=Va(o),c=Ra(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=za(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function io(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=La(t,e),p=to(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=no(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=no(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ao=50,oo=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:io},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ro(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ao&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ro(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},so=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=La(e,t)||{};if(l==null)return{};let d=to(u),f={x:n,y:r},p=Ua(i),m=Va(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Aa(d[_],T),D=Aa(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Ia(E,k,O),j=!c.arrow&&za(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ee=j?k<E?k-E:k-O:0;return{[p]:f[p]+ee,data:{[p]:A,centerOffset:k-A-ee,...j&&{alignmentOffset:ee}},reset:j}}}),co=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=La(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ra(r),_=Ha(o),v=Ra(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[$a(o)]:Ga(o)),x=p!==`none`;!d&&x&&b.push(...Qa(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Wa(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Ha(t)||T.every(e=>Ha(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ha(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function lo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uo(e){return ka.some(t=>e[t]>=0)}var fo=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=La(e,t);switch(i){case`referenceHidden`:{let e=lo(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:uo(e)}}}case`escaped`:{let e=lo(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:uo(e)}}}default:return{}}}}},po=new Set([`left`,`top`]);async function mo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ra(n),s=za(n),c=Ha(n)===`y`,l=po.has(o)?-1:1,u=a&&c?-1:1,d=La(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ho=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await mo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},go=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=La(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ha(i),p=Ba(f),m=u[p],h=u[f],g=(e,t)=>Ia(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},_o=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=La(e,t),u={x:n,y:r},d=Ha(i),f=Ba(d),p=u[f],m=u[d],h=La(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=po.has(Ra(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},vo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=La(e,t),c=await i.detectOverflow(t,s),l=Ra(n),u=za(n),d=Ha(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Aa(p-c[m],g),y=Aa(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*ja(c.left,c.right):S=p-2*ja(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function yo(){return typeof window<`u`}function bo(e){return Co(e)?(e.nodeName||``).toLowerCase():`#document`}function xo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function So(e){return((Co(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Co(e){return yo()?e instanceof Node||e instanceof xo(e).Node:!1}function wo(e){return yo()?e instanceof Element||e instanceof xo(e).Element:!1}function To(e){return yo()?e instanceof HTMLElement||e instanceof xo(e).HTMLElement:!1}function Eo(e){return!yo()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof xo(e).ShadowRoot}function Do(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=K(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Oo(e){return/^(table|td|th)$/.test(bo(e))}function ko(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ao=/transform|translate|scale|rotate|perspective|filter/,jo=/paint|layout|strict|content/,Mo=e=>!!e&&e!==`none`,No;function Po(e){let t=wo(e)?K(e):e;return Mo(t.transform)||Mo(t.translate)||Mo(t.scale)||Mo(t.rotate)||Mo(t.perspective)||!Io()&&(Mo(t.backdropFilter)||Mo(t.filter))||Ao.test(t.willChange||``)||jo.test(t.contain||``)}function Fo(e){let t=zo(e);for(;To(t)&&!Lo(t);){if(Po(t))return t;if(ko(t))return null;t=zo(t)}return null}function Io(){return No??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),No}function Lo(e){return/^(html|body|#document)$/.test(bo(e))}function K(e){return xo(e).getComputedStyle(e)}function Ro(e){return wo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function zo(e){if(bo(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Eo(e)&&e.host||So(e);return Eo(t)?t.host:t}function Bo(e){let t=zo(e);return Lo(t)?(e.ownerDocument||e).body:To(t)&&Do(t)?t:Bo(t)}function Vo(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Bo(e),i=r===e.ownerDocument?.body,a=xo(r);if(i){let e=Ho(a);return t.concat(a,a.visualViewport||[],Do(r)?r:[],e&&n?Vo(e):[])}return t.concat(r,Vo(r,[],n))}function Ho(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Uo(e){let t=K(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=To(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ma(n)!==a||Ma(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Wo(e){return wo(e)?e:e.contextElement}function Go(e){let t=Wo(e);if(!To(t))return Pa(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Uo(t),o=(a?Ma(n.width):n.width)/r,s=(a?Ma(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ko=Pa(0);function qo(e){let t=xo(e);return!Io()||!t.visualViewport?Ko:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jo(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===xo(e)}function Yo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Wo(e),o=Pa(1);t&&(r?wo(r)&&(o=Go(r)):o=Go(e));let s=Jo(a,n,r)?qo(a):Pa(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=xo(a),t=wo(r)?xo(r):r,n=e,i=Ho(n);for(;i&&t!==n;){let e=Go(i),t=i.getBoundingClientRect(),r=K(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=xo(i),i=Ho(n)}}return no({width:u,height:d,x:c,y:l})}function Xo(e,t){let n=Ro(e).scrollLeft;return t?t.left+n:Yo(So(e)).left+n}function Zo(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Xo(e,n),y:n.top+t.scrollTop}}function Qo(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=So(r),s=t?ko(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Pa(1),u=Pa(0),d=To(r);if((d||!a)&&((bo(r)!==`body`||Do(o))&&(c=Ro(r)),d)){let e=Yo(r);l=Go(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Zo(o,c):Pa(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function $o(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function es(e){let t=Ro(e),n=e.ownerDocument.body,r=ja(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ja(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Xo(e),o=-t.scrollTop;return K(n).direction===`rtl`&&(a+=ja(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ts=25;function ns(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=xo(e),a=So(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Io()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Xo(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ts&&(s-=o)}return{width:s,height:c,x:l,y:u}}function rs(e,t){let n=Yo(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Go(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function is(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ns(e,n,t);else if(t===`document`)r=es(So(e));else if(wo(t))r=rs(t,n);else{let n=qo(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return no(r)}function as(e,t){let n=t.get(e);if(n)return n;let r=Vo(e,[],!1).filter(e=>wo(e)&&bo(e)!==`body`),i=null,a=K(e).position===`fixed`,o=a?zo(e):e;for(;wo(o)&&!Lo(o);){let e=K(o),t=Po(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=zo(o)}return t.set(e,r),r}function os(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ko(t)?[]:as(t,this._c):[].concat(n),r],o=is(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=is(t,a[e],i);s=ja(n.top,s),c=Aa(n.right,c),l=Aa(n.bottom,l),u=ja(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ss(e){let{width:t,height:n}=Uo(e);return{width:t,height:n}}function cs(e,t,n){let r=To(t),i=So(t),a=n===`fixed`,o=Yo(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Pa(0);if((r||!a)&&((bo(t)!==`body`||Do(i))&&(s=Ro(t)),r)){let e=Yo(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Xo(i));let l=i&&!r&&!a?Zo(i,s):Pa(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function ls(e){return K(e).position===`static`}function us(e,t){if(!To(e)||K(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return So(e)===n&&(n=n.ownerDocument.body),n}function ds(e,t){let n=xo(e);if(ko(e))return n;if(!To(e)){let t=zo(e);for(;t&&!Lo(t);){if(wo(t)&&!ls(t))return t;t=zo(t)}return n}let r=us(e,t);for(;r&&Oo(r)&&ls(r);)r=us(r,t);return r&&Lo(r)&&ls(r)&&!Po(r)?n:r||Fo(e)||n}var fs=async function(e){let t=this.getOffsetParent||ds,n=this.getDimensions,r=await n(e.floating);return{reference:cs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ps(e){return K(e).direction===`rtl`}var ms={convertOffsetParentRelativeRectToViewportRelativeRect:Qo,getDocumentElement:So,getClippingRect:os,getOffsetParent:ds,getElementRects:fs,getClientRects:$o,getDimensions:ss,getScale:Go,isElement:wo,isRTL:ps};function hs(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gs(e,t,n){let r=null,i,a=So(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Na(d),h=Na(a.clientWidth-(u+f)),g=Na(a.clientHeight-(d+p)),_=Na(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ja(0,Aa(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!hs(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=xo(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function _s(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Wo(e),u=i||a?[...l?Vo(l):[],...t?Vo(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?gs(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Yo(e):null;c&&g();function g(){let t=Yo(e);h&&!hs(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var vs=ho,ys=go,bs=co,xs=vo,Ss=fo,Cs=so,ws=_o,Ts=(e,t,n)=>{let r=new Map,i=n??{},a={...ms,...i.platform,_c:r};return oo(e,t,{...i,platform:a})},Es=typeof document<`u`?v.useLayoutEffect:function(){};function Ds(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ds(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ds(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Os(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ks(e,t){let n=Os(e);return Math.round(t*n)/n}function As(e){let t=v.useRef(e);return Es(()=>{t.current=e}),t}function js(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);Ds(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=As(c),O=As(i),k=As(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Ts(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Ds(T.current,t)&&(T.current=t,pt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Es(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);Es(()=>(j.current=!0,()=>{j.current=!1}),[]),Es(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let ee=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),M=v.useMemo(()=>({reference:x,floating:S}),[x,S]),N=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=ks(M.floating,u.x),r=ks(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Os(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:ee,elements:M,floatingStyles:N}),[u,A,ee,M,N])}var Ms=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Cs({element:r.current,padding:i}).fn(n):r?Cs({element:r,padding:i}).fn(n):{}}}},Ns=(e,t)=>{let n=vs(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ps=(e,t)=>{let n=ys(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fs=(e,t)=>({fn:ws(e).fn,options:[e,t]}),Is=(e,t)=>{let n=bs(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ls=(e,t)=>{let n=xs(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rs=(e,t)=>{let n=Ss(e);return{name:n.name,fn:n.fn,options:[e,t]}},zs=(e,t)=>{let n=Ms(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bs=Object.defineProperty,Vs=(e,t)=>Bs(e,`name`,{value:t,configurable:!0}),Hs={Partial:`partial`,Always:`always`},Us={Optimized:`optimized`,Always:`always`},Ws=`Popper`,[Gs,Ks]=xt(Ws),[qs,Js]=Gs(Ws),Ys=Vs(e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,U.jsx)(qs,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Xs=`PopperAnchor`,Zs=v.forwardRef(Vs(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Js(Xs,n),o=v.useRef(null),s=a.onAnchorChange,c=H(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&ic(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,U.jsx)(W.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Qs=`PopperContent`,[$s,ec]=Gs(Qs),tc=v.forwardRef(Vs(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=Hs.Partial,hideWhenDetached:f=!1,updatePositionStrategy:p=Us.Optimized,onPlaced:m,...h}=e,g=Js(Qs,n),[_,y]=v.useState(null),b=H(t,y),[x,S]=v.useState(null),C=ua(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(nc),altBoundary:k},{refs:j,floatingStyles:ee,placement:M,isPositioned:N,middlewareData:P}=js({strategy:`fixed`,placement:E,whileElementsMounted:Vs((...e)=>_s(...e,{animationFrame:p===Us.Always}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Ns({mainAxis:i+T,alignmentAxis:o}),c&&Ps({mainAxis:!0,crossAxis:!1,...d===Hs.Partial?{limiter:Fs()}:{},...A}),c&&Is({...A}),Ls({...A,apply:Vs(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),x&&zs({element:x,padding:s}),rc({arrowWidth:w,arrowHeight:T}),f&&Rs(k?{strategy:`referenceHidden`,...A}:{strategy:`referenceHidden`,padding:A.padding,altBoundary:A.altBoundary})]}),F=g.setPlacementState;Ct(()=>(F(M),()=>{F(void 0)}),[M,F]);let[I,L]=ic(M),te=Dn(m);Ct(()=>{N&&te?.()},[N,te]);let ne=P.arrow?.x,re=P.arrow?.y,ie=P.arrow?.centerOffset!==0,[ae,oe]=v.useState();return Ct(()=>{_&&oe(window.getComputedStyle(_).zIndex)},[_]),(0,U.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:N?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,U.jsx)($s,{scope:n,placedSide:I,placedAlign:L,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,U.jsx)(W.div,{"data-side":I,"data-align":L,...h,ref:b,style:{...h.style,animation:N?h.style?.animation:`none`}})})})},`PopperContent`));function nc(e){return e!==null}Vs(nc,`isNotNull`);var rc=Vs(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=ic(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function ic(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Vs(ic,`getSideAndAlignFromPlacement`);var ac=Object.defineProperty,oc=(e,t)=>ac(e,`name`,{value:t,configurable:!0}),sc=!1;function cc(){let[e,t]=v.useState(sc);return v.useEffect(()=>{sc||(sc=!0,t(!0))},[]),e}oc(cc,`useIsHydrated`);var lc=v.useSyncExternalStore;function uc(){return()=>{}}oc(uc,`subscribe`);function dc(){return lc(uc,()=>!0,()=>!1)}oc(dc,`useIsHydratedModern`);var fc=typeof lc==`function`?dc:cc,pc=Object.defineProperty,mc=(e,t)=>pc(e,`name`,{value:t,configurable:!0}),hc=`rovingFocusGroup.onEntryFocus`,gc={bubbles:!1,cancelable:!0},_c=`RovingFocusGroup`,[vc,yc,bc]=Et(_c),[xc,Sc]=xt(_c,[bc]),Cc={Vertical:`vertical`,Horizontal:`horizontal`},wc={LTR:`ltr`,RTL:`rtl`},[Tc,Ec]=xc(_c),Dc=v.forwardRef(mc(function(e,t){return(0,U.jsx)(vc.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,U.jsx)(vc.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,U.jsx)(Oc,{...e,ref:t})})})},`RovingFocusGroup`)),Oc=v.forwardRef(mc(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=v.useRef(null),p=H(t,f),m=Cn(a),[h,g]=$t({prop:o,defaultProp:s??null,onChange:c,caller:_c}),[_,y]=v.useState(!1),b=Dn(l),x=yc(n),S=v.useRef(!1),[C,w]=v.useState(0);return v.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(hc,b),()=>e.removeEventListener(hc,b)},[b]),(0,U.jsx)(Tc,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:v.useCallback(e=>g(e),[g]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:v.useCallback(()=>w(e=>e-1),[]),children:(0,U.jsx)(W.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:G(e.onMouseDown,()=>{S.current=!0}),onFocus:G(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(hc,gc);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Pc([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:G(e.onBlur,()=>y(!1))})})},`RovingFocusGroupImpl`)),kc=`RovingFocusGroupItem`,Ac=v.forwardRef(mc(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=vn(),l=a||c,u=Ec(kc,n),d=u.currentTabStopId===l,f=yc(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=fc();return Ct(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),v.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,U.jsx)(vc.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,U.jsx)(W.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:G(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:G(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:G(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Nc(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Fc(n,r+1):n.slice(r+1)}setTimeout(()=>Pc(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),jc={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Mc(e,t){return t===wc.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}mc(Mc,`getDirectionAwareKey`);function Nc(e,t,n){let r=Mc(e.key,n);if(!(t===Cc.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===Cc.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return jc[r]}mc(Nc,`getFocusIntent`);function Pc(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}mc(Pc,`focusFirst`);function Fc(e,t){return e.map((n,r)=>e[(t+r)%e.length])}mc(Fc,`wrapArray`);var Ic=Object.defineProperty,Lc=(e,t)=>Ic(e,`name`,{value:t,configurable:!0}),Rc=[`Enter`,` `],zc=[`ArrowDown`,`PageUp`,`Home`],Bc=[`ArrowUp`,`PageDown`,`End`],Vc=[...zc,...Bc];[...Rc],[...Rc];var Hc=`Menu`,[Uc,Wc,Gc]=Et(Hc),[Kc,qc]=xt(Hc,[Gc,Ks,Sc]),Jc=Ks(),Yc=Sc(),[Xc,Zc]=Kc(Hc),[Qc,$c]=Kc(Hc),el=Lc(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Jc(t),[c,l]=v.useState(null),u=v.useRef(!1),d=Dn(a),f=Cn(i);return v.useEffect(()=>{let e=Lc(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Lc(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),v.useEffect(()=>{if(!n)return;let e=Lc(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,U.jsx)(Ys,{...s,children:(0,U.jsx)(Xc,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,U.jsx)(Qc,{scope:t,onClose:v.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),tl=v.forwardRef(Lc(function(e,t){let{__scopeMenu:n,...r}=e,i=Jc(n);return(0,U.jsx)(Zs,{...i,...r,ref:t})},`MenuAnchor`)),nl=`MenuPortal`,[rl,il]=Kc(nl,{forceMount:void 0}),al=Lc(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Zc(nl,t);return(0,U.jsx)(rl,{scope:t,forceMount:n,children:(0,U.jsx)(cn,{present:n||a.open,children:(0,U.jsx)(ur,{asChild:!0,container:i,children:r})})})},`MenuPortal`),ol=`MenuContent`,[sl,cl]=Kc(ol),ll=v.forwardRef(Lc(function(e,t){let n=il(ol,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Zc(ol,e.__scopeMenu),o=$c(ol,e.__scopeMenu);return(0,U.jsx)(Uc.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(cn,{present:r||a.open,children:(0,U.jsx)(Uc.Slot,{scope:e.__scopeMenu,children:o.modal?(0,U.jsx)(ul,{...i,ref:t}):(0,U.jsx)(dl,{...i,ref:t})})})})},`MenuContent`)),ul=v.forwardRef(Lc(function(e,t){let n=Zc(ol,e.__scopeMenu),r=v.useRef(null),i=H(t,r);return v.useEffect(()=>{let e=r.current;if(e)return Pi(e)},[]),(0,U.jsx)(pl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),dl=v.forwardRef(Lc(function(e,t){let n=Zc(ol,e.__scopeMenu);return(0,U.jsx)(pl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),fl=Ye(`MenuContent.ScrollLock`),pl=v.forwardRef(Lc(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Zc(ol,n),_=$c(ol,n),y=Jc(n),b=Yc(n),x=Wc(n),[S,C]=v.useState(null),w=v.useRef(null),[T,E]=v.useState(null);Zn(T);let{nodes:D,registry:O}=Xn(),k=!!(i||m),A=H(t,w,g.onContentChange,E),j=v.useRef(0),ee=v.useRef(``),M=v.useRef(0),N=v.useRef(null),P=v.useRef(`right`),F=v.useRef(0),I=v.useMemo(()=>m?[w,...D.map(e=>({current:e}))]:[],[w,D,m]),L=m?Ti:v.Fragment,te=m?{as:fl,allowPinchZoom:!0,shards:I}:void 0,ne=Lc(e=>{let t=ee.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Al(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){ee.current=e,window.clearTimeout(j.current),e!==``&&(j.current=window.setTimeout(()=>s(``),1e3))}Lc(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);v.useEffect(()=>()=>window.clearTimeout(j.current),[]),gr();let re=v.useCallback(e=>P.current===N.current?.side&&Ml(e,N.current?.area),[]);return(0,U.jsx)(sl,{scope:n,searchRef:ee,onItemEnter:v.useCallback(e=>{re(e)&&e.preventDefault()},[re]),onItemLeave:v.useCallback(e=>{re(e)||(w.current?.focus(),C(null))},[re]),onTriggerLeave:v.useCallback(e=>{re(e)&&e.preventDefault()},[re]),pointerGraceTimerRef:M,onPointerGraceIntentChange:v.useCallback(e=>{N.current=e},[]),children:(0,U.jsx)(Yn,{registry:k?O:null,children:(0,U.jsx)(L,{...te,children:(0,U.jsx)(qn,{asChild:!0,trapped:i,branches:D,onMountAutoFocus:G(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,U.jsx)(Fn,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,U.jsx)(Dc,{asChild:!0,...b,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:G(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,U.jsx)(tc,{role:`menu`,"aria-orientation":`vertical`,"data-state":Tl(g.open),"data-radix-menu-content":``,dir:_.dir,...y,...h,ref:A,style:{outline:`none`,...h.style},onKeyDown:G(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ne(e.key));let i=w.current;if(e.target!==i||!Vc.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Bc.includes(e.key)&&a.reverse(),Ol(a)}),onBlur:G(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(j.current),ee.current=``)}),onPointerMove:G(e.onPointerMove,Nl(e=>{let t=e.target,n=F.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>F.current?`right`:`left`;P.current=t,F.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),ml=`MenuItem`,hl=`menu.itemSelect`,gl=v.forwardRef(Lc(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=v.useRef(null),o=$c(ml,e.__scopeMenu),s=cl(ml,e.__scopeMenu),c=H(t,a),l=v.useRef(!1),u=Lc(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(hl,{bubbles:!0,cancelable:!0});e.addEventListener(hl,e=>r?.(e),{once:!0}),gt(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,U.jsx)(_l,{...i,ref:c,disabled:n,onClick:G(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:G(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:G(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&Rc.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),_l=v.forwardRef(Lc(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=cl(ml,n),s=Yc(n),c=v.useRef(null),l=H(t,c),[u,d]=v.useState(!1),[f,p]=v.useState(``);return v.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,U.jsx)(Uc.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,U.jsx)(Ac,{asChild:!0,...s,focusable:!r,children:(0,U.jsx)(W.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:G(e.onPointerMove,Nl(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(e.onPointerLeave,Nl(e=>o.onItemLeave(e))),onFocus:G(e.onFocus,()=>d(!0)),onBlur:G(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[vl,yl]=Kc(`MenuRadioGroup`,{value:void 0,onValueChange:Lc(()=>{},`onValueChange`)}),[bl,xl]=Kc(`MenuItemIndicator`,{checked:!1}),Sl=v.forwardRef(Lc(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(W.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Cl,wl]=Kc(`MenuSub`);function Tl(e){return e?`open`:`closed`}Lc(Tl,`getOpenState`);function El(e){return e===`indeterminate`}Lc(El,`isIndeterminate`);function Dl(e){return El(e)?`indeterminate`:e?`checked`:`unchecked`}Lc(Dl,`getCheckedState`);function Ol(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Lc(Ol,`focusFirst`);function kl(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Lc(kl,`wrapArray`);function Al(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=kl(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Lc(Al,`getNextMatch`);function jl(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Lc(jl,`isPointInPolygon`);function Ml(e,t){return t?jl({x:e.clientX,y:e.clientY},t):!1}Lc(Ml,`isPointerInGraceArea`);function Nl(e){return t=>t.pointerType===`mouse`?e(t):void 0}Lc(Nl,`whenMouse`);var Pl=Object.defineProperty,Fl=(e,t)=>Pl(e,`name`,{value:t,configurable:!0}),Il=`DropdownMenu`,[Ll,Rl]=xt(Il,[qc]),zl=qc(),[Bl,Vl]=Ll(Il),Hl=Fl(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=zl(t),l=v.useRef(null),[u,d]=$t({prop:i,defaultProp:a??!1,onChange:o,caller:Il});return(0,U.jsx)(Bl,{scope:t,triggerId:vn(),triggerRef:l,contentId:vn(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,U.jsx)(el,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),Ul=`DropdownMenuTrigger`,Wl=v.forwardRef(Fl(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Vl(Ul,n),o=zl(n),s=H(t,a.triggerRef);return(0,U.jsx)(tl,{asChild:!0,...o,children:(0,U.jsx)(W.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:G(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:G(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),Gl=Fl(e=>{let{__scopeDropdownMenu:t,...n}=e,r=zl(t);return(0,U.jsx)(al,{...r,...n})},`DropdownMenuPortal`),Kl=`DropdownMenuContent`,ql=v.forwardRef(Fl(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Vl(Kl,n),a=zl(n),o=v.useRef(!1);return(0,U.jsx)(ll,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:G(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Jl=v.forwardRef(Fl(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=zl(n);return(0,U.jsx)(gl,{...i,...r,ref:t})},`DropdownMenuItem`)),Yl=v.forwardRef(Fl(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=zl(n);return(0,U.jsx)(Sl,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Xl=Object.defineProperty,Zl=v.forwardRef(((e,t)=>Xl(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,U.jsx)(W.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Ql=Object.defineProperty,$l=(e,t)=>Ql(e,`name`,{value:t,configurable:!0});function eu(e,[t,n]){return Math.min(n,Math.max(t,e))}$l(eu,`clamp`);var tu=Object.defineProperty,q=(e,t)=>tu(e,`name`,{value:t,configurable:!0});function nu(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}q(nu,`useStateMachine`);var ru={Auto:`auto`,Always:`always`,Scroll:`scroll`,Hover:`hover`},iu={Vertical:`vertical`,Horizontal:`horizontal`},au={LTR:`ltr`,RTL:`rtl`},ou=`ScrollArea`,[su,cu]=xt(ou),[lu,uu]=su(ou),du=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,type:r=ru.Hover,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=v.useState(null),[l,u]=v.useState(null),[d,f]=v.useState(null),[p,m]=v.useState(null),[h,g]=v.useState(null),[_,y]=v.useState(0),[b,x]=v.useState(0),[S,C]=v.useState(!1),[w,T]=v.useState(!1),E=H(t,c),D=Cn(i);return(0,U.jsx)(lu,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,U.jsx)(W.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":b+`px`,...e.style}})})},`ScrollArea`)),fu=`ScrollAreaViewport`,pu=Qe(fu),mu=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,disableImplicitContentElement:a,...o}=e,s=uu(fu,n),c=H(t,v.useRef(null),s.onViewportChange),l=v.isValidElement(r);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(hu,{nonce:i}),(0,U.jsx)(W.div,{"data-radix-scroll-area-viewport":``,...o,ref:c,style:{overflowX:s.scrollbarXEnabled?`scroll`:`hidden`,overflowY:s.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:a?r:l?(0,U.jsx)(pu,{child:r,children:e=>(0,U.jsx)(_u,{__scopeScrollArea:n,children:e})}):(0,U.jsx)(pu,{children:(0,U.jsx)(_u,{__scopeScrollArea:n,children:r})})})]})},`ScrollAreaViewport`)),hu=v.memo(q(function({nonce:e}){return(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),gu=`ScrollAreaContent`,_u=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,children:r,...i}=e,a=H(t,uu(gu,n).onContentChange);return(0,U.jsx)(W.div,{...i,ref:a,style:{minWidth:`100%`,display:`table`,...e.style},children:r})},`ScrollAreaContent`)),vu=`ScrollAreaScrollbar`,yu=v.forwardRef(q(function(e,t){let{forceMount:n,...r}=e,i=uu(vu,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===iu.Horizontal;return v.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===ru.Hover?(0,U.jsx)(bu,{...r,ref:t,forceMount:n}):i.type===ru.Scroll?(0,U.jsx)(xu,{...r,ref:t,forceMount:n}):i.type===ru.Auto?(0,U.jsx)(Su,{...r,ref:t,forceMount:n}):i.type===ru.Always?(0,U.jsx)(Cu,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),bu=v.forwardRef(q(function(e,t){let{forceMount:n,...r}=e,i=uu(vu,e.__scopeScrollArea),[a,o]=v.useState(!1);return v.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=q(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=q(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,U.jsx)(cn,{present:n||a,children:(0,U.jsx)(Su,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),xu=v.forwardRef(q(function(e,t){let{forceMount:n,...r}=e,i=uu(vu,e.__scopeScrollArea),a=e.orientation===iu.Horizontal,o=Uu(()=>c(`SCROLL_END`),100),[s,c]=nu(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return v.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),v.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=q(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,U.jsx)(cn,{present:n||s!==`hidden`,children:(0,U.jsx)(Cu,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:G(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:G(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),Su=v.forwardRef(q(function(e,t){let n=uu(vu,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=v.useState(!1),s=e.orientation===iu.Horizontal,c=Uu(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Wu(n.viewport,c),Wu(n.content,c),(0,U.jsx)(cn,{present:r||a,children:(0,U.jsx)(Cu,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),Cu=v.forwardRef(q(function(e,t){let{orientation:n=iu.Vertical,...r}=e,i=uu(vu,e.__scopeScrollArea),a=v.useRef(null),o=v.useRef(0),[s,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Iu(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:q(e=>a.current=e,`onThumbChange`),onThumbPointerUp:q(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:q(e=>o.current=e,`onThumbPointerDown`)};function d(e,t){return Ru(e,o.current,s,t)}return q(d,`getScrollPosition`),n===iu.Horizontal?(0,U.jsx)(wu,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=zu(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===iu.Vertical?(0,U.jsx)(Tu,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=zu(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null},`ScrollAreaScrollbarVisible`)),wu=v.forwardRef(q(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=uu(vu,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=H(t,c,a.onScrollbarXChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,U.jsx)(Ou,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===au.RTL?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===au.LTR?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Lu(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Vu(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Fu(o.paddingLeft),paddingEnd:Fu(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),Tu=v.forwardRef(q(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=uu(vu,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=H(t,c,a.onScrollbarYChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,U.jsx)(Ou,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===au.LTR?0:void 0,left:a.dir===au.RTL?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Lu(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Vu(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Fu(o.paddingTop),paddingEnd:Fu(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[Eu,Du]=su(vu),Ou=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=uu(vu,n),[m,h]=v.useState(null),g=H(t,h),_=v.useRef(null),y=v.useRef(``),b=p.viewport,x=r.content-r.viewport,S=Dn(u),C=Dn(c),w=Uu(d,10);function T(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return q(T,`handleDragScroll`),v.useEffect(()=>{let e=q(e=>{let t=e.target;m?.contains(t)&&S(e,x)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[b,m,x,S]),v.useEffect(C,[r,C]),Wu(m,w),Wu(p.content,w),(0,U.jsx)(Eu,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Dn(a),onThumbPointerUp:Dn(o),onThumbPositionChange:C,onThumbPointerDown:Dn(s),children:(0,U.jsx)(W.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:G(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:G(e.onPointerMove,T),onPointerUp:G(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})},`ScrollAreaScrollbarImpl`)),ku=`ScrollAreaThumb`,Au=v.forwardRef(q(function(e,t){let{forceMount:n,...r}=e,i=Du(ku,e.__scopeScrollArea);return(0,U.jsx)(cn,{present:n||i.hasThumb,children:(0,U.jsx)(ju,{ref:t,...r})})},`ScrollAreaThumb`)),ju=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=uu(ku,n),o=Du(ku,n),{onThumbPositionChange:s}=o,c=H(t,o.onThumbChange),l=v.useRef(void 0),u=Uu(()=>{l.current&&=(l.current(),void 0)},100);return v.useEffect(()=>{let e=a.viewport;if(e){let t=q(()=>{if(u(),!l.current){let t=Hu(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,U.jsx)(W.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:G(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:G(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),Mu=`ScrollAreaCorner`,Nu=v.forwardRef(q(function(e,t){let n=uu(Mu,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==ru.Scroll&&r?(0,U.jsx)(Pu,{...e,ref:t}):null},`ScrollAreaCorner`)),Pu=v.forwardRef(q(function(e,t){let{__scopeScrollArea:n,...r}=e,i=uu(Mu,n),[a,o]=v.useState(0),[s,c]=v.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return Wu(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Wu(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),v.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,U.jsx)(W.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===au.LTR?0:void 0,left:i.dir===au.RTL?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function Fu(e){return e?parseInt(e,10):0}q(Fu,`toInt`);function Iu(e,t){let n=e/t;return isNaN(n)?0:n}q(Iu,`getThumbRatio`);function Lu(e){let t=Iu(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}q(Lu,`getThumbSize`);function Ru(e,t,n,r=au.LTR){let i=Lu(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===au.LTR?[0,u]:[u*-1,0];return Bu([c,l],d)(e)}q(Ru,`getScrollPositionFromPointer`);function zu(e,t,n=au.LTR){let r=Lu(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=eu(e,n===au.LTR?[0,o]:[o*-1,0]);return Bu([0,o],[0,s])(c)}q(zu,`getThumbOffsetFromScroll`);function Bu(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}q(Bu,`linearScale`);function Vu(e,t){return e>0&&e<t}q(Vu,`isScrollingWithinScrollbarBounds`);var Hu=q((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)}return q(i,`loop`),i(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function Uu(e,t){let n=Dn(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}q(Uu,`useDebounceCallback`);function Wu(e,t){let n=Dn(t);Ct(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}q(Wu,`useResizeObserver`);var Gu=Object.defineProperty,Ku=(e,t)=>Gu(e,`name`,{value:t,configurable:!0}),qu={ItemAligned:`item-aligned`,Popper:`popper`},Ju={LTR:`ltr`,RTL:`rtl`},Yu=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Xu=[` `,`Enter`],Zu=`Select`,[Qu,$u,ed]=Et(Zu),[td,nd]=xt(Zu,[ed,Ks]),rd=Ks(),[id,ad]=td(Zu),[od,sd]=td(Zu);function cd(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=rd(t),[_,y]=v.useState(null),[b,x]=v.useState(null),[S,C]=v.useState(!1),w=Cn(l),[T,E]=$t({prop:r,defaultProp:i??!1,onChange:a,caller:Zu}),[D,O]=$t({prop:o,defaultProp:s,onChange:c,caller:Zu}),k=v.useRef(null),A=v.useRef(!1),[j,ee]=v.useState(null),M=Ku(e=>{ee({value:e,hasConsumerStoppedPropagation:A.current}),O(e)},`handleUserSelect`),N=v.useRef(D);v.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=Ku(()=>O(N.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,O]);let P=!_||!!m||!!_.closest(`form`),[F,I]=v.useState(new Set),L=vn(),te=Array.from(F).map(e=>e.props.value).join(`;`),ne=v.useCallback(e=>{I(t=>new Set(t).add(e))},[]),re=v.useCallback(e=>{I(t=>{let n=new Set(t);return n.delete(e),n})},[]),ie={required:p,trigger:_,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:L,value:D,onValueChange:O,hasConsumerStoppedPropagationRef:A,userSelection:j,onUserSelect:M,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:F,nativeSelectKey:te,isFormControl:P};return(0,U.jsx)(Ys,{...g,children:(0,U.jsx)(id,{scope:t,...ie,children:(0,U.jsx)(Qu.Provider,{scope:t,children:(0,U.jsx)(od,{scope:t,onNativeOptionAdd:ne,onNativeOptionRemove:re,children:Yd(h)?h(ie):n})})})})}Ku(cd,`SelectProvider`);var ld=Ku(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,U.jsx)(cd,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[n,e?(0,U.jsx)(Jd,{__scopeSelect:t}):null]})})},`Select`),ud=`SelectTrigger`,dd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=rd(n),o=ad(ud,n),s=o.disabled||r,c=H(t,o.onTriggerChange),l=$u(n),u=v.useRef(`touch`),[d,f,p]=Zd(e=>{let t=l().filter(e=>!e.disabled),n=Qd(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onUserSelect(n.value)}),m=Ku(e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,U.jsx)(Zs,{asChild:!0,...a,children:(0,U.jsx)(W.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Xd(o.value)?``:void 0,...i,ref:c,onClick:G(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:G(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:G(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(o.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),f(e.key)),!(t&&e.key===` `)&&Yu.includes(e.key)&&(m(),e.preventDefault())})})})},`SelectTrigger`)),fd=`SelectValue`,pd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=ad(fd,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=H(t,c.onValueNodeChange);Ct(()=>{l(u)},[l,u]);let f=Xd(c.value);return(0,U.jsx)(W.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,U.jsx)(v.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),md=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,U.jsx)(W.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[hd,gd]=td(`SelectPortal`,{forceMount:void 0}),_d=Ku(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,U.jsx)(hd,{scope:e.__scopeSelect,forceMount:n,children:(0,U.jsx)(ur,{asChild:!0,...r})})},`SelectPortal`),vd=`SelectContent`,yd=v.forwardRef(Ku(function(e,t){let n=gd(vd,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=ad(vd,e.__scopeSelect),[o,s]=v.useState();return Ct(()=>{s(new DocumentFragment)},[]),(0,U.jsx)(cn,{present:r||a.open,children:({present:e})=>e?(0,U.jsx)(Td,{...i,ref:t}):(0,U.jsx)(bd,{...i,fragment:o})})},`SelectContent`)),bd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?pt.createPortal((0,U.jsx)(Sd,{scope:n,children:(0,U.jsx)(Qu.Slot,{scope:n,children:(0,U.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),xd=10,[Sd,Cd]=td(vd),wd=Ye(`SelectContent.RemoveScroll`),Td=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n}=e,{position:r=qu.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,y=ad(vd,n),[b,x]=v.useState(null),[S,C]=v.useState(null),w=H(t,x),[T,E]=v.useState(null),[D,O]=v.useState(null),k=$u(n),[A,j]=v.useState(!1),ee=v.useRef(!1),M=v.useRef(!1),N=v.useRef(!1);v.useEffect(()=>{if(b)return Pi(b)},[b]),gr();let P=v.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),F=v.useCallback(()=>P([T,b]),[P,T,b]);v.useEffect(()=>{A&&F()},[A,F]);let{onOpenChange:I,triggerPointerDownPosRef:L}=y;v.useEffect(()=>{if(b){let e={x:0,y:0},t=Ku(t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},`handlePointerMove`),n=Ku(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(b)||I(!1),document.removeEventListener(`pointermove`,t),L.current=null},`handlePointerUp`);return L.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,I,L]),v.useEffect(()=>{let e=Ku(()=>I(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[I]);let[te,ne]=Zd(e=>{let t=k().filter(e=>!e.disabled),n=Qd(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=v.useCallback((e,t,n)=>{let r=!M.current;r&&(M.current=!0);let i=!ee.current&&!n;y.value!==void 0&&y.value===t||i?(E(e),i&&(ee.current=!0)):r&&E(e)},[y.value]),ie=v.useCallback(()=>b?.focus(),[b]),ae=v.useCallback((e,t,n)=>{if(!e)return;let r=!N.current;r&&(N.current=!0);let i=!ee.current&&!n;(y.value!==void 0&&y.value===t||i||r)&&O(e)},[y.value]),oe=r===qu.Popper?Dd:Ed,se=oe===Dd?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,U.jsx)(Sd,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:re,selectedItem:T,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:F,selectedItemText:D,position:r,isPositioned:A,searchRef:te,children:(0,U.jsx)(Ti,{as:wd,allowPinchZoom:!0,children:(0,U.jsx)(qn,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:G(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,U.jsx)(Fn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,U.jsx)(oe,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:G(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>P(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Ed=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=ad(vd,n),o=Cd(vd,n),[s,c]=v.useState(null),[l,u]=v.useState(null),d=H(t,u),f=$u(n),p=v.useRef(!1),m=v.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:y}=o,b=v.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==Ju.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-xd,d=eu(a,[xd,Math.max(xd,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-xd,d=eu(a,[xd,Math.max(xd,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-xd*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-xd,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${xd}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Ct(()=>b(),[b]);let[x,S]=v.useState();Ct(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]);let C=v.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]);return(0,U.jsx)(Od,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:C,children:(0,U.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,U.jsx)(W.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),Dd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=xd,...a}=e,o=rd(n);return(0,U.jsx)(tc,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[Od,kd]=td(vd,{}),Ad=`SelectViewport`,jd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Cd(Ad,n),o=kd(Ad,n),s=H(t,a.onViewportChange),c=v.useRef(0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,U.jsx)(Qu.Slot,{scope:n,children:(0,U.jsx)(W.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:G(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-xd*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[Md,Nd]=td(`SelectGroup`),Pd=`SelectItem`,[Fd,Id]=td(Pd),Ld=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=ad(Pd,n),c=Cd(Pd,n),l=s.value===r,[u,d]=v.useState(a??``),[f,p]=v.useState(!1),m=H(t,Dn(e=>c.itemRefCallback?.(e,r,i))),h=vn(),g=v.useRef(`touch`);function _(e){s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),s.onUserSelect(r),s.onOpenChange(!1)}return Ku(_,`handleSelect`),(0,U.jsx)(Fd,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:v.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,U.jsx)(Qu.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,U.jsx)(W.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:G(o.onFocus,()=>p(!0)),onBlur:G(o.onBlur,()=>p(!1)),onClick:G(o.onClick,e=>{i||g.current!==`mouse`&&_(e)}),onPointerUp:G(o.onPointerUp,e=>{i||g.current===`mouse`&&_(e)}),onPointerDown:G(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:G(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:G(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:G(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(Xu.includes(e.key)&&_(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Rd=`SelectItemText`,zd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=ad(Rd,n),s=Cd(Rd,n),c=Id(Rd,n),l=sd(Rd,n),[u,d]=v.useState(null),f=Dn(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=H(t,d,c.onItemTextChange,f),m=u?.textContent,h=v.useMemo(()=>(0,U.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return Ct(()=>(g(h),()=>_(h)),[g,_,h]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(W.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Xd(o.value)?pt.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),Bd=`SelectItemIndicator`,Vd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,...r}=e;return Id(Bd,n).isSelected?(0,U.jsx)(W.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Hd=`SelectScrollUpButton`,Ud=v.forwardRef(Ku(function(e,t){let n=Cd(Hd,e.__scopeSelect),r=kd(Hd,e.__scopeSelect),[i,a]=v.useState(!1),o=H(t,r.onScrollButtonChange);return Ct(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};Ku(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(Kd,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Wd=`SelectScrollDownButton`,Gd=v.forwardRef(Ku(function(e,t){let n=Cd(Wd,e.__scopeSelect),r=kd(Wd,e.__scopeSelect),[i,a]=v.useState(!1),o=H(t,r.onScrollButtonChange);return Ct(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};Ku(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(Kd,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),Kd=v.forwardRef(Ku(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Cd(`SelectScrollButton`,n),o=v.useRef(null),s=$u(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Ct(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,U.jsx)(W.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:G(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:G(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:G(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),qd=`SelectBubbleInput`,Jd=v.forwardRef(Ku(function({__scopeSelect:e,...t},n){let r=ad(qd,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u,userSelection:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=v.useRef(null),h=H(n,m),g=i??``,_=v.useRef(g),y=v.useRef(d),b=v.useRef(!1),x=Array.from(f).some(e=>(e.props.value??``)===``);return v.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=d!==null&&d!==y.current;y.current=d;let i=_.current!==g;_.current=g;let a=r&&i;if(r&&!i&&d.value!==g&&!d.hasConsumerStoppedPropagation&&n){b.current=!0;try{n.call(e,d.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{b.current=!1,n.call(e,g)}return}let o=a&&!d.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,g),e.dispatchEvent(t)}},[g,d]),(0,U.jsxs)(W.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>{b.current||a(e.target.value)},...t,style:{..._t,...t.style},ref:h,defaultValue:g,children:[Xd(i)&&!x?(0,U.jsx)(`option`,{value:``}):null,Array.from(f)]},p)},`SelectBubbleInput`));function Yd(e){return typeof e==`function`}Ku(Yd,`isFunction`);function Xd(e){return e===``||e===void 0}Ku(Xd,`shouldShowPlaceholder`);function Zd(e){let t=Dn(e),n=v.useRef(``),r=v.useRef(0),i=v.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}Ku(a,`updateSearch`),a(i)},[t]),a=v.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}Ku(Zd,`useTypeaheadSearch`);function Qd(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=$d(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Ku(Qd,`findNextItem`);function $d(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ku($d,`wrapArray`);var ef=Object.defineProperty,tf=(e,t)=>ef(e,`name`,{value:t,configurable:!0}),nf={Horizontal:`horizontal`,Vertical:`vertical`},rf=nf.Horizontal,af=Object.values(nf),of=v.forwardRef(tf(function(e,t){let{decorative:n,orientation:r=rf,...i}=e,a=sf(r)?r:rf,o=a===nf.Vertical?a:void 0,s=n?{role:`none`}:{"aria-orientation":o,role:`separator`};return(0,U.jsx)(W.div,{"data-orientation":a,...s,...i,ref:t})},`Separator`));function sf(e){return af.includes(e)}tf(sf,`isValidOrientation`);var cf=Object.defineProperty,lf=(e,t)=>cf(e,`name`,{value:t,configurable:!0}),uf=`Switch`,[df,ff]=xt(uf),[pf,mf]=df(uf);function hf(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=$t({prop:n,defaultProp:i??!1,onChange:c,caller:uf}),[m,h]=v.useState(null),[g,_]=v.useState(null),[y,b]=v.useState(null),x={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,userClick:y,onUserClick:b,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,U.jsx)(pf,{scope:t,...x,children:Cf(d)?d(x):r})}lf(hf,`SwitchProvider`);var gf=`SwitchTrigger`,_f=v.forwardRef(lf(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,onUserClick:f,isFormControl:p,bubbleInput:m}=mf(gf,e),h=H(r,u),g=v.useRef(c);return v.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=lf(()=>d(g.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,U.jsx)(W.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":wf(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:G(t,e=>{let t=e.isPropagationStopped();f({requestedChecked:!c,hasConsumerStoppedPropagation:t}),d(e=>!e),m&&p&&(t||e.stopPropagation())})})},`SwitchTrigger`)),vf=v.forwardRef(lf(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,U.jsx)(hf,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(_f,{...d,ref:t,__scopeSwitch:n}),e&&(0,U.jsx)(Sf,{__scopeSwitch:n})]})})},`Switch`)),yf=`SwitchThumb`,bf=v.forwardRef(lf(function(e,t){let{__scopeSwitch:n,...r}=e,i=mf(yf,n);return(0,U.jsx)(W.span,{"data-state":wf(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),xf=`SwitchBubbleInput`,Sf=v.forwardRef(lf(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:c,disabled:l,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:m}=mf(xf,e),h=H(r,m),g=ua(i),_=v.useRef(!1),y=v.useRef(o),b=v.useRef(a),x=v.useRef(null);v.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=y.current!==o;y.current=o;let i=a!==null&&a!==b.current;if(b.current=a,i)x.current=r?null:a,r&&n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=x.current;x.current=null;let r=t?.requestedChecked===o;_.current=!0,n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),_.current=!1}},[p,o,a]);let S=v.useRef(o);return(0,U.jsx)(W.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??S.current,required:c,disabled:l,name:u,value:d,form:f,...n,tabIndex:-1,ref:h,onClick:G(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function Cf(e){return typeof e==`function`}lf(Cf,`isFunction`);function wf(e){return e?`checked`:`unchecked`}lf(wf,`getState`);var Tf=Object.defineProperty,Ef=(e,t)=>Tf(e,`name`,{value:t,configurable:!0}),Df={Automatic:`automatic`,Manual:`manual`},Of=`Tabs`,[kf,Af]=xt(Of,[Sc]),jf=Sc(),[Mf,Nf]=kf(Of),Pf=v.forwardRef(Ef(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=Df.Automatic,...l}=e,u=Cn(s),[d,f]=$t({prop:r,onChange:i,defaultProp:a??``,caller:Of});return(0,U.jsx)(Mf,{scope:n,baseId:vn(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,U.jsx)(W.div,{dir:u,"data-orientation":o,...l,ref:t})})},`Tabs`)),Ff=`TabsList`,If=v.forwardRef(Ef(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=Nf(Ff,n),o=jf(n);return(0,U.jsx)(Dc,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,U.jsx)(W.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),Lf=`TabsTrigger`,Rf=v.forwardRef(Ef(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Nf(Lf,n),s=jf(n),c=Vf(o.baseId,r),l=Hf(o.baseId,r),u=r===o.value;return(0,U.jsx)(Ac,{asChild:!0,...s,focusable:!i,active:u,children:(0,U.jsx)(W.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:G(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?(e.currentTarget.focus(),o.onValueChange(r)):e.preventDefault()}),onKeyDown:G(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:G(e.onFocus,()=>{let e=o.activationMode!==Df.Manual;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),zf=`TabsContent`,Bf=v.forwardRef(Ef(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Nf(zf,n),c=Vf(s.baseId,r),l=Hf(s.baseId,r),u=r===s.value,d=v.useRef(u);return v.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,U.jsx)(cn,{present:i||u,children:({present:n})=>(0,U.jsx)(W.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function Vf(e,t){return`${e}-trigger-${t}`}Ef(Vf,`makeTriggerId`);function Hf(e,t){return`${e}-content-${t}`}Ef(Hf,`makeContentId`);var Uf=He(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function J({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?Xe:`span`;return(0,U.jsx)(i,{"data-slot":`badge`,"data-variant":t,className:B(Uf({variant:t}),e),...r})}var Wf=He(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40`,outline:`border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,xs:`h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-9`,"icon-xs":`size-6 rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function Y({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?Xe:`button`;return(0,U.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:B(Wf({variant:t,size:n,className:e})),...i})}function Gf({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card`,className:B(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),...t})}function Kf({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-header`,className:B(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function qf({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-title`,className:B(`leading-none font-semibold`,e),...t})}function Jf({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-content`,className:B(`px-6`,e),...t})}function Yf({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-footer`,className:B(`flex items-center px-6 [.border-t]:pt-6`,e),...t})}var Xf=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function Zf(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:Xf(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var Qf=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},$f=e=>{let t=Qf(e);return t.charAt(0).toUpperCase()+t.slice(1)},ep=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),tp={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function np(e){return e!=null}function rp(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??tp.width,a=e.size??e.height??tp.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?ep(...c):ep(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??tp[`stroke-width`])*Number(e.size??e.width??tp.width)/Number(t.size??t.width??tp.width):t.strokeWidth??tp[`stroke-width`];return[`svg`,{...Object.entries(tp).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&np(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&np(t.width)&&{[r(`width`)]:t.width},...`height`in t&&np(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function ip(e,t={}){return rp(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var ap=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},op=(0,v.createContext)({}),sp=()=>(0,v.useContext)(op),cp=(0,v.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:y=``}=sp()??{},b=!!c||ap(d),[x,S,C=[]]=ip(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:ep(y,s),hasA11yProp:b,attributes:d});return(0,v.createElement)(x,{ref:f,...S},[...C.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function X(e,t=[],n=[]){let r=typeof e==`string`?Zf(e,t,n):e,i=(0,v.forwardRef)(({className:e,...t},n)=>(0,v.createElement)(cp,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=$f(r.name)),i}var lp={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};lp.node;var up=X(lp),dp={name:`align-end-vertical`,size:24,node:[[`rect`,{width:`16`,height:`6`,x:`2`,y:`4`,rx:`2`,key:`10wcwx`}],[`rect`,{width:`9`,height:`6`,x:`9`,y:`14`,rx:`2`,key:`4p5bwg`}],[`path`,{d:`M22 22V2`,key:`12ipfv`}]]};dp.node;var fp=X(dp),pp={name:`align-start-vertical`,size:24,node:[[`rect`,{width:`9`,height:`6`,x:`6`,y:`14`,rx:`2`,key:`lpm2y7`}],[`rect`,{width:`16`,height:`6`,x:`6`,y:`4`,rx:`2`,key:`rdj6ps`}],[`path`,{d:`M2 2v20`,key:`1ivd8o`}]]};pp.node;var mp=X(pp),hp={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};hp.node;var gp=X(hp),_p={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};_p.node;var vp=X(_p),yp={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};yp.node;var bp=X(yp),xp={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};xp.node;var Sp=X(xp),Cp={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};Cp.node;var wp=X(Cp),Tp={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};Tp.node;var Ep=X(Tp),Dp={name:`chart-line`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`m19 9-5 5-4-4-3 3`,key:`2osh9i`}]],aliases:[`line-chart`]};Dp.node;var Op=X(Dp),kp={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};kp.node;var Ap=X(kp),jp={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};jp.node;var Mp=X(jp),Np={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Np.node;var Pp=X(Np),Fp={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Fp.node;var Ip=X(Fp),Lp={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};Lp.node;var Rp=X(Lp),zp={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};zp.node;var Bp=X(zp),Vp={name:`clipboard-list`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]};Vp.node;var Hp=X(Vp),Up={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};Up.node;var Wp=X(Up),Gp={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Gp.node;var Kp=X(Gp),qp={name:`cloud-upload`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]],aliases:[`upload-cloud`]};qp.node;var Jp=X(qp),Yp={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};Yp.node;var Xp=X(Yp),Zp={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};Zp.node;var Qp=X(Zp),$p={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};$p.node;var em=X($p),tm={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};tm.node;var nm=X(tm),rm={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};rm.node;var im=X(rm),am={name:`ellipsis-vertical`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]],aliases:[`more-vertical`]};am.node;var om=X(am),sm={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};sm.node;var cm=X(sm),lm={name:`factory`,size:24,node:[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M16 16h.01`,key:`1f9h7w`}],[`path`,{d:`M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z`,key:`1iv0i2`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]};lm.node;var um=X(lm),dm={name:`file-clock`,size:24,node:[[`path`,{d:`M16 22h2a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v2.85`,key:`ryk6xj`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 14v2.2l1.6 1`,key:`6m4bie`}],[`circle`,{cx:`8`,cy:`16`,r:`6`,key:`10v15b`}]]};dm.node;var fm=X(dm),pm={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};pm.node;var mm=X(pm),hm={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};hm.node;var gm=X(hm),_m={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};_m.node;var vm=X(_m),ym={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};ym.node;var bm=X(ym),xm={name:`gauge`,size:24,node:[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]};xm.node;var Sm=X(xm),Cm={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};Cm.node;var wm=X(Cm),Tm={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};Tm.node;var Em=X(Tm),Dm={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};Dm.node;var Om=X(Dm),km={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};km.node;var Am=X(km),jm={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};jm.node;var Mm=X(jm),Nm={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};Nm.node;var Pm=X(Nm),Fm={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};Fm.node;var Im=X(Fm),Lm={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};Lm.node;var Rm=X(Lm),zm={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};zm.node;var Bm=X(zm),Vm={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};Vm.node;var Hm=X(Vm),Um={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};Um.node;var Wm=X(Um),Gm={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};Gm.node;var Km=X(Gm),qm={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};qm.node;var Jm=X(qm),Ym={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Ym.node;var Xm=X(Ym),Zm={name:`monitor-cog`,size:24,node:[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]};Zm.node;var Qm=X(Zm),$m={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};$m.node;var eh=X($m),th={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};th.node;var nh=X(th),rh={name:`octagon-alert`,size:24,node:[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]],aliases:[`alert-octagon`]};rh.node;var ih=X(rh),ah={name:`octagon-x`,size:24,node:[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-octagon`]};ah.node;var oh=X(ah),sh={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};sh.node;var ch=X(sh),lh={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};lh.node;var uh=X(lh),dh={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};dh.node;var fh=X(dh),ph={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};ph.node;var mh=X(ph),hh={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};hh.node;var gh=X(hh),_h={name:`radar`,size:24,node:[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]};_h.node;var vh=X(_h),yh={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};yh.node;var bh=X(yh),xh={name:`rocket`,size:24,node:[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]};xh.node;var Sh=X(xh),Ch={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};Ch.node;var wh=X(Ch),Th={name:`save`,size:24,node:[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]};Th.node;var Eh=X(Th),Dh={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Dh.node;var Oh=X(Dh),kh={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};kh.node;var Ah=X(kh),jh={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};jh.node;var Mh=X(jh),Nh={name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]};Nh.node;var Ph=X(Nh),Fh={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Fh.node;var Ih=X(Fh),Lh={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};Lh.node;var Rh=X(Lh),zh={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};zh.node;var Bh=X(zh),Vh={name:`shield`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]};Vh.node;var Hh=X(Vh),Uh={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};Uh.node;var Wh=X(Uh),Gh={name:`square-pen`,size:24,node:[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]],aliases:[`pen-box`,`edit`,`pen-square`]};Gh.node;var Kh=X(Gh),qh={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};qh.node;var Jh=X(qh),Yh={name:`stretch-horizontal`,size:24,node:[[`rect`,{width:`20`,height:`6`,x:`2`,y:`4`,rx:`2`,key:`qdearl`}],[`rect`,{width:`20`,height:`6`,x:`2`,y:`14`,rx:`2`,key:`1xrn6j`}]]};Yh.node;var Xh=X(Yh),Zh={name:`stretch-vertical`,size:24,node:[[`rect`,{width:`6`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`19qu7m`}],[`rect`,{width:`6`,height:`20`,x:`14`,y:`2`,rx:`2`,key:`24v0nk`}]]};Zh.node;var Qh=X(Zh),$h={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};$h.node;var eg=X($h),tg={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};tg.node;var ng=X(tg),rg={name:`trending-up`,size:24,node:[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]};rg.node;var ig=X(rg),ag={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};ag.node;var og=X(ag),sg={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};sg.node;var cg=X(sg),lg={name:`wifi`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]};lg.node;var ug=X(lg),dg={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};dg.node;var fg=X(dg),pg={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};pg.node;var mg=X(pg);function hg({className:e,...t}){return(0,U.jsx)(xa,{"data-slot":`checkbox`,className:B(`peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary`,e),...t,children:(0,U.jsx)(Ca,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none`,children:(0,U.jsx)(Ap,{className:`size-3.5`})})})}function gg({...e}){return(0,U.jsx)(Hi,{"data-slot":`dialog`,...e})}function _g({...e}){return(0,U.jsx)(Ki,{"data-slot":`dialog-portal`,...e})}function vg({className:e,...t}){return(0,U.jsx)(Ji,{"data-slot":`dialog-overlay`,className:B(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function yg({className:e,children:t,showCloseButton:n=!0,...r}){return(0,U.jsxs)(_g,{"data-slot":`dialog-portal`,children:[(0,U.jsx)(vg,{}),(0,U.jsxs)(Qi,{"data-slot":`dialog-content`,className:B(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,U.jsxs)(aa,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,U.jsx)(mg,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function bg({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`dialog-header`,className:B(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function xg({className:e,showCloseButton:t=!1,children:n,...r}){return(0,U.jsxs)(`div`,{"data-slot":`dialog-footer`,className:B(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,U.jsx)(aa,{asChild:!0,children:(0,U.jsx)(Y,{variant:`outline`,children:`Close`})})]})}function Sg({className:e,...t}){return(0,U.jsx)(na,{"data-slot":`dialog-title`,className:B(`text-lg leading-none font-semibold`,e),...t})}function Cg({className:e,...t}){return(0,U.jsx)(ra,{"data-slot":`dialog-description`,className:B(`text-sm text-muted-foreground`,e),...t})}function wg({className:e,type:t,...n}){return(0,U.jsx)(`input`,{type:t,"data-slot":`input`,className:B(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}function Tg({className:e,...t}){return(0,U.jsx)(Zl,{"data-slot":`label`,className:B(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Eg({...e}){return(0,U.jsx)(ld,{"data-slot":`select`,...e})}function Dg({...e}){return(0,U.jsx)(pd,{"data-slot":`select-value`,...e})}function Og({className:e,size:t=`default`,children:n,...r}){return(0,U.jsxs)(dd,{"data-slot":`select-trigger`,"data-size":t,className:B(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,U.jsx)(md,{asChild:!0,children:(0,U.jsx)(Mp,{className:`size-4 opacity-50`})})]})}function kg({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,U.jsx)(_d,{children:(0,U.jsxs)(yd,{"data-slot":`select-content`,className:B(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,U.jsx)(jg,{}),(0,U.jsx)(jd,{className:B(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,U.jsx)(Mg,{})]})})}function Ag({className:e,children:t,...n}){return(0,U.jsxs)(Ld,{"data-slot":`select-item`,className:B(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,U.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(Vd,{children:(0,U.jsx)(Ap,{className:`size-4`})})}),(0,U.jsx)(zd,{children:t})]})}function jg({className:e,...t}){return(0,U.jsx)(Ud,{"data-slot":`select-scroll-up-button`,className:B(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(Ip,{className:`size-4`})})}function Mg({className:e,...t}){return(0,U.jsx)(Gd,{"data-slot":`select-scroll-down-button`,className:B(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(Mp,{className:`size-4`})})}function Ng(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var Pg=e=>{switch(e){case`success`:return Lg;case`info`:return zg;case`warning`:return Rg;case`error`:return Bg;default:return null}},Fg=Array(12).fill(0),Ig=({visible:e,className:t})=>v.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},v.createElement(`div`,{className:`sonner-spinner`},Fg.map((e,t)=>v.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Lg=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},v.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Rg=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},v.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),zg=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},v.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),Bg=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},v.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Vg=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},v.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),v.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),Hg=()=>{let[e,t]=v.useState(document.hidden);return v.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},Ug=1,Wg=100,Gg=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:Ug++,Kg=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-Wg;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=Gg(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],v.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Jg(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=Gg(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},qg=(e,t)=>Kg.message(e,t),Jg=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Z=Object.assign(qg,{success:Kg.success,info:Kg.info,warning:Kg.warning,error:Kg.error,custom:Kg.custom,message:Kg.message,promise:Kg.promise,dismiss:Kg.dismiss,loading:Kg.loading},{getHistory:()=>Kg.toasts,getToasts:()=>Kg.getActiveToasts()});Ng(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Yg(e){return e.label!==void 0}var Xg=3,Zg=`24px`,Qg=`16px`,$g=4e3,e_=356,t_=14,n_=45,r_=200;function i_(...e){return e.filter(Boolean).join(` `)}function a_(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var o_=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:y=``,duration:b,position:x,gap:S,expandByDefault:C,classNames:w,icons:T,closeButtonAriaLabel:E=`Close toast`}=e,[D,O]=v.useState(null),[k,A]=v.useState(null),[j,ee]=v.useState(!1),[M,N]=v.useState(!1),[P,F]=v.useState(!1),[I,L]=v.useState(!1),[te,ne]=v.useState(!1),[re,ie]=v.useState(0),[ae,oe]=v.useState(0),se=v.useRef(n.duration||b||$g),ce=v.useRef(null),le=v.useRef(null),ue=c===0,de=c+1<=o,fe=n.type,R=fe??`default`,z=n.dismissible!==!1,pe=n.className||``,me=n.descriptionClassName||``,he=v.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ge=v.useMemo(()=>n.closeButton??p,[n.closeButton,p]),_e=v.useMemo(()=>n.duration||b||$g,[n.duration,b]),ve=v.useRef(0),ye=v.useRef(0),be=v.useRef(0),xe=v.useRef(null),[Se,Ce]=x.split(`-`),we=v.useMemo(()=>s.reduce((e,t,n)=>n>=he?e:e+t.height,0),[s,he]),Te=Hg(),Ee=v.useMemo(()=>e.swipeDirections??a_(x),[e.swipeDirections,x]),B=n.invert||t,De=fe===`loading`;ye.current=v.useMemo(()=>he*S+we,[he,we]),v.useEffect(()=>{se.current=_e},[_e]),v.useEffect(()=>{ee(!0)},[]),v.useEffect(()=>{let e=le.current;if(e){let t=e.getBoundingClientRect().height;return oe(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),v.useLayoutEffect(()=>{if(!j)return;let e=le.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,oe(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[j,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let V=v.useCallback(()=>{N(!0),ie(ye.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},r_)},[n,d,a,ye]);v.useEffect(()=>{if(n.promise&&fe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Te?(()=>{if(be.current<ve.current){let e=new Date().getTime()-ve.current;se.current-=e}be.current=new Date().getTime()})():se.current!==1/0&&(ve.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),V()},se.current)),()=>clearTimeout(e)},[u,i,n,fe,Te,V]),v.useEffect(()=>{n.delete&&(V(),n.onDismiss==null||n.onDismiss.call(n,n))},[V,n.delete]);function Oe(){return T?.loading?v.createElement(`div`,{className:i_(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":fe===`loading`},T.loading):v.createElement(Ig,{className:i_(w?.loader,n?.classNames?.loader),visible:fe===`loading`})}let ke=n.icon||T?.[fe]||Pg(fe);return v.createElement(`li`,{tabIndex:0,ref:le,className:i_(_,pe,w?.toast,n?.classNames?.toast,w?.[R],n?.classNames?.[R]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":j,"data-promise":!!n.promise,"data-swiped":te,"data-removed":M,"data-visible":de,"data-y-position":Se,"data-x-position":Ce,"data-index":c,"data-front":ue,"data-swiping":P,"data-dismissible":z,"data-type":fe,"data-invert":B,"data-swipe-out":I,"data-swipe-direction":k,"data-expanded":!!(u||C&&j),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?re:ye.current}px`,"--initial-height":C?`auto`:`${ae}px`,...m,...n.style},onDragEnd:()=>{F(!1),O(null),xe.current=null},onPointerDown:e=>{e.button!==2&&!De&&z&&(ce.current=new Date,ie(ye.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),xe.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{if(I||!z)return;xe.current=null;let e=Number(le.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(le.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ce.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if((D===`x`?Ee.includes(e>0?`right`:`left`):Ee.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=n_||a>.11))ie(ye.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),V(),L(!0);else{var o,s;(o=le.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=le.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),ne(!1),F(!1),O(null)}},onPointerMove:e=>{var t,n;if(!xe.current||!z||window.getSelection()?.toString().length>0)return;let r=e.clientY-xe.current.y,i=e.clientX-xe.current.x;!D&&(Math.abs(i)>1||Math.abs(r)>1)&&O(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(Ee.includes(`top`)||Ee.includes(`bottom`)){if(Ee.includes(`top`)&&r<0||Ee.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(D===`x`&&(Ee.includes(`left`)||Ee.includes(`right`))){if(Ee.includes(`left`)&&i<0||Ee.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&ne(!0),(t=le.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=le.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},ge&&!n.jsx&&fe!==`loading`?v.createElement(`button`,{"aria-label":E,"data-disabled":De,"data-close-button":!0,onClick:De||!z?()=>{}:()=>{V(),n.onDismiss==null||n.onDismiss.call(n,n)},className:i_(w?.closeButton,n?.classNames?.closeButton)},T?.close??Vg):null,(fe||n.icon||n.promise)&&n.icon!==null&&(T?.[fe]!==null||n.icon)?v.createElement(`div`,{"data-icon":``,className:i_(w?.icon,n?.classNames?.icon)},fe===`loading`?n.icon||Oe():n.promise?Oe():null,fe===`loading`?null:ke):null,v.createElement(`div`,{"data-content":``,className:i_(w?.content,n?.classNames?.content)},v.createElement(`div`,{"data-title":``,className:i_(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?v.createElement(`div`,{"data-description":``,className:i_(y,me,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),v.isValidElement(n.cancel)?n.cancel:n.cancel&&Yg(n.cancel)?v.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{Yg(n.cancel)&&z&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),V())},className:i_(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,v.isValidElement(n.action)?n.action:n.action&&Yg(n.action)?v.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{Yg(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&V())},className:i_(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function s_(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function c_(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Qg:Zg;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var l_=v.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=Xg,toastOptions:g,dir:_=s_(),gap:y=t_,icons:b,customAriaLabel:x,containerAriaLabel:S=`Notifications`}=e,[C,w]=v.useState([]),T=v.useMemo(()=>n?C.filter(e=>e.toasterId===n):C.filter(e=>!e.toasterId),[C,n]),E=v.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[D,O]=v.useState([]),[k,A]=v.useState(!1),[j,ee]=v.useState(!1),[M,N]=v.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),P=v.useRef(null),F=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),I=v.useRef(null),L=v.useRef(!1),te=v.useCallback(e=>{w(t=>(t.find(t=>t.id===e.id)?.delete||Kg.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return v.useEffect(()=>Kg.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{w(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{pt.flushSync(()=>{w(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),v.useEffect(()=>{if(d!==`system`){N(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?N(`dark`):N(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{N(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{N(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),v.useEffect(()=>{C.length<=1&&A(!1)},[C]),v.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;A(!0),(t=P.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===P.current||P.current?.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),v.useEffect(()=>{if(P.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}},[P.current]),v.createElement(`section`,{ref:t,"aria-label":x??`${S} ${F}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},E.map((t,n)=>{let[i,a]=t.split(`-`);return T.length?v.createElement(`ol`,{key:t,dir:_===`auto`?s_():_,tabIndex:-1,ref:P,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${e_}px`,"--gap":`${y}px`,...m,...c_(l,u)},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,I.current&&=(I.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||L.current||(L.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ee(!0)},onPointerUp:()=>ee(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>v.createElement(o_,{key:n.id,icons:b,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:j,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:te,toasts:T.filter(e=>e.position==n.position),heights:D.filter(e=>e.position==n.position),setHeights:O,expandByDefault:o,gap:y,expanded:k,swipeDirections:e.swipeDirections}))):null}))});function u_(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return t%360}var d_=e=>({"--agent-h":String(u_(e))}),f_=e=>{let t=u_(e);return`linear-gradient(135deg, oklch(0.6 0.14 ${t}), oklch(0.45 0.12 ${(t+45)%360}))`};function p_({id:e,name:t,size:n=`md`}){return(0,U.jsx)(`span`,{className:B(`flex shrink-0 items-center justify-center rounded-lg text-[10px] font-bold text-white`,n===`md`?`h-6 w-6 text-[11px]`:`h-5 w-5`),style:{background:f_(e)},children:(t||`?`).trim().charAt(0).toUpperCase()})}var m_=[`exec`,`data_describe`,`data_query`,`search_knowledge`,`save_experience`],h_=[{id:`observer`,emoji:`👀`,title:`只读参谋`,desc:`能查数据、检索知识、给建议——不会动手改任何东西,适合先试试水`,autonomy:`L1`},{id:`worker`,emoji:`🔧`,title:`干活帮手`,desc:`能执行命令、读写数据集、跑配置的动作——重要写操作会先弹卡问你`,autonomy:`L2`,recommended:!0},{id:`full`,emoji:`🚀`,title:`全自主干将`,desc:`以上全部,且写操作免确认——只给完全信任、可承受失误的场景`,autonomy:`L3`}];function g_({onOpen:e}){let[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!0),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)([]),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!0),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(`all`),[w,T]=(0,v.useState)(()=>localStorage.getItem(`aims.guide-done`)===`1`),[E,D]=(0,v.useState)(``),O=(0,v.useRef)(``),[k,A]=(0,v.useState)(!1),[j,ee]=(0,v.useState)([]),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)(`L2`),[te,ne]=(0,v.useState)(m_),[re,ie]=(0,v.useState)(`worker`),[ae,oe]=(0,v.useState)(!1),[se,ce]=(0,v.useState)(!1),[le,ue]=(0,v.useState)(null),[de,fe]=(0,v.useState)(null),[R,z]=(0,v.useState)(null),[pe,me]=(0,v.useState)(null),[he,ge]=(0,v.useState)(!1),[_e,ve]=(0,v.useState)(!1),[ye,be]=(0,v.useState)(1),[xe,Se]=(0,v.useState)(``),[Ce,we]=(0,v.useState)(``),[Te,Ee]=(0,v.useState)(``),[De,je]=(0,v.useState)(!1),[Me,Ne]=(0,v.useState)(!1),[Pe,Fe]=(0,v.useState)(``),[Ie,Re]=(0,v.useState)([]),[ze,Be]=(0,v.useState)([]),Ve=(0,v.useMemo)(()=>new Set(ze.map(e=>e.id)),[ze]),He=async(e=!0)=>{if(!Ce.trim())Z.error(`请先描述你想让小助手做什么`);else{je(!0);try{let t=await Oe(`/api/agents/draft-prompt`,{name:xe.trim(),description:Ce.trim()});Ee(t.prompt),t.name&&!xe.trim()&&Se(t.name),e&&be(2)}catch(e){Z.error(String(e.message))}finally{je(!1)}}},Ue=async()=>{try{let e=await V(`/api/agents/knowledges?keyword=${encodeURIComponent(Pe.trim())}`);Re(e.items||[]),e.error&&Z.warning(`ARM 知识检索不可达`,{description:e.error})}catch(e){Z.error(String(e.message))}},We=async()=>{Ne(!0);try{let e=await Oe(`/api/agents/create`,{name:xe.trim(),description:Ce.trim(),prompt:Te.trim(),knowledge_ids:ze.map(e=>e.id)});e.local?Z.warning(`${e.manifest.name} 已创建为本地助手(ARM 不可达)`,{description:`离线可用:对话/工作台/数据集正常,编辑仅写本地。恢复连接后在卡片上点「发布」转正到 ARM(身份不变)。`,duration:7e3}):Z.success(`${e.manifest.name} ${e.manifest.version} 已创建并下载到本地${e.knowledges_bound?`(绑定知识 ${e.knowledges_bound} 条)`:``}——下一步完成上岗配置`),ve(!1),Se(``),we(``),Ee(``),Be([]),Re([]),Fe(``),await Ge(),nt({agent_id:e.agent_id,name:e.manifest.name})}catch(e){Z.error(String(e.message))}finally{Ne(!1)}},Ge=async(e=O.current)=>{try{let t=await V(`/api/agents${e?`?keyword=${encodeURIComponent(e)}`:``}`);if(e!==O.current)return;n(t.agents),i(t.online),c(!!t.auth_error),o(t.me||null),t.source&&u(t.source),t.sources&&f(t.sources)}catch{e===O.current&&(i(!1),c(!1),o(null))}finally{e===O.current&&(g(!1),A(!1))}},Ke=async e=>{if(e&&e!==l?.id&&!p){m(!0),g(!0);try{let t=await Oe(`/api/arm/sources/${encodeURIComponent(e)}/select`);t.probe.online?Z.success(`已切换到 ARM 源「${t.source.name}」`,{description:`连通 ${t.probe.latency_ms}ms——目录、下载、新建、发布、经验回流现在都打这个源`}):Z.warning(`已切换到 ARM 源「${t.source.name}」,但当前不可达`,{description:`${t.probe.error||``};显示本地库,可随时切回`.replace(/^;/,``)}),await Ge()}catch(e){Z.error(String(e.message))}finally{m(!1),g(!1)}}};(0,v.useEffect)(()=>{Ge(``),V(`/api/tools`).then(e=>ee(e.tools))},[]),(0,v.useEffect)(()=>{if(O.current=E,!E){Ge(``);return}A(!0);let e=setTimeout(()=>Ge(E),400);return()=>clearTimeout(e)},[E]);let H=(0,v.useMemo)(()=>t.filter(e=>e.deployed),[t]),qe=(0,v.useMemo)(()=>t.filter(e=>e.installed),[t]),Je=(0,v.useMemo)(()=>t.filter(e=>e.update_available),[t]),Ye=(0,v.useMemo)(()=>({all:t,deployed:H,installed:qe,updates:Je})[S],[t,H,qe,Je,S]),Xe=async()=>{x(!0);try{let e=await Oe(`/api/arm/sync`),{new:t,update:n,delisted:r}=e.events,i=[`目录 ${e.remote_count} 名`];t.length&&i.push(`${t.length} 名新助手`),n.length&&i.push(`${n.length} 名可升级`),r.length&&i.push(`${r.length} 名已下架`),e.outbox_flushed&&i.push(`回流 ${e.outbox_flushed} 条离线经验`),Z.success(`已同步:${i.join(` · `)}`),await Ge()}catch(e){Z.error(String(e.message))}finally{x(!1)}},Ze=async(e,t)=>{y(e.agent_id);try{let n=await Oe(`/api/agents/${e.agent_id}/${t}`);Z.success(`${n.manifest.name} ${n.manifest.version} 已${t===`upgrade`?`升级`:`下载`}(本地知识 ${n.manifest.knowledges_local} 条,工作台与数据不受影响)`),await Ge(),t===`upgrade`&&ue(null)}catch(e){Z.error(String(e.message))}finally{y(null)}},Qe=async e=>{fe(e);try{z(await V(`/api/agents/${e.agent_id}/versions`))}catch(e){Z.error(String(e.message))}},$e=async(e,t)=>{try{await Oe(`/api/agents/${e.agent_id}/rollback`,{version:t}),Z.success(`已回滚到 ${t}`),z(await V(`/api/agents/${e.agent_id}/versions`)),await Ge()}catch(e){Z.error(String(e.message))}},et=async e=>{y(e.agent_id);try{await Ae(`/api/agents/${e.agent_id}`,{force:!0,purge_workspaces:he}),Z.success(`${e.name} 已卸载${he?`(工作区数据已清除)`:`(工作区数据已保留)`}`),me(null),ge(!1),await Ge()}catch(e){Z.error(String(e.message))}finally{y(null)}},tt=e=>{let t=h_.find(t=>t.id===e);t&&(L(t.autonomy),ne(e===`observer`?m_:j.map(e=>e.name)),ie(e))},nt=e=>{N(e),F(e.name),oe(!1),ne(j.map(e=>e.name)),L(`L2`),ie(`worker`)},rt=async e=>{try{let t=(await V(`/api/deployment?agent_id=${e.agent_id}`)).deployment;N(e),F(t.name||e.name),oe(!0),ie(`custom`),L(t.default_autonomy||`L2`),ne((t.toolset||[]).map(e=>e.tool))}catch(e){Z.error(String(e.message))}},it=e=>e.local_only||!e.foreign&&r&&!!a&&(a.role===`ADMIN`||!!e.created_by_id&&a.id===e.created_by_id),[at,ot]=(0,v.useState)(null),[st,ct]=(0,v.useState)(``),[lt,ut]=(0,v.useState)(``),[dt,ft]=(0,v.useState)(``),[pt,mt]=(0,v.useState)(!1),[ht,W]=(0,v.useState)(null),[gt,_t]=(0,v.useState)(!1),[vt,yt]=(0,v.useState)(``),[bt,xt]=(0,v.useState)([]),[St,Ct]=(0,v.useState)(``),[wt,Tt]=(0,v.useState)([]),[Et,Dt]=(0,v.useState)(`essential`),[Ot,kt]=(0,v.useState)(null),[At,jt]=(0,v.useState)(!1),[Mt,Nt]=(0,v.useState)(!1),[Pt,Ft]=(0,v.useState)(null),[It,Lt]=(0,v.useState)(``),[Rt,zt]=(0,v.useState)(!1),[Bt,G]=(0,v.useState)(null),[Vt,Ht]=(0,v.useState)(!1),Ut=async()=>{if(Bt){Ht(!0);try{let e=await Oe(`/api/agents/${Bt.agent_id}/publish`),t=[`知识 ${e.copied.knowledges} 条已复制${e.copied.failed?`(${e.copied.failed} 条失败)`:``}`];(e.skipped.skills||e.skipped.ui_bindings)&&t.push(`未复制:技能 ${e.skipped.skills} / UI 资产 ${e.skipped.ui_bindings}(ARM 侧资产,可在编辑里重绑)`),t.push(`本地身份与数据不变(档案/配置分离)`),Z.success(`「${e.manifest.name}」已发布到「${e.target.name}」${e.manifest.version}`,{description:t.join(`;`),duration:7e3}),G(null),await Ge()}catch(e){Z.error(String(e.message))}finally{Ht(!1)}}},Wt=async e=>{try{W(await V(`/api/agents/${e}/bindings`))}catch(e){W(null),Z.error(String(e.message))}},Gt=async()=>{try{let e=await V(`/api/agents/skills?keyword=${encodeURIComponent(vt.trim())}`);xt(e.items||[]),e.error&&Z.error(e.error)}catch(e){Z.error(String(e.message))}},Kt=async()=>{try{let e=await V(`/api/agents/knowledges?keyword=${encodeURIComponent(St.trim())}`);Tt(e.items||[]),e.error&&Z.error(e.error)}catch(e){Z.error(String(e.message))}},qt=async(e,t,n)=>{if(at){_t(!0);try{await Oe(`/api/agents/${at.agent_id}/bindings`,{type:e,ref_id:t,kind:n}),Z.success(e===`skill`?`技能已绑定(本地档案已同步物化)`:`知识已绑定(本地档案已同步物化)`),xt([]),Tt([]),await Wt(at.agent_id)}catch(e){Z.error(String(e.message))}finally{_t(!1)}}},Jt=async(e,t,n)=>{if(at){_t(!0);try{await Ae(`/api/agents/${at.agent_id}/bindings`,{type:e,binding_id:t}),Z.success(`已解绑 ${n}(本地档案已同步物化)`),await Wt(at.agent_id)}catch(e){Z.error(String(e.message))}finally{_t(!1)}}},Yt=async e=>{ot(e),ct(e.name),ut(e.description||``),ft(`(读取档案…)`),W(null),xt([]),Tt([]),yt(``),Ct(``),Wt(e.agent_id);try{let t=await V(`/api/agents/${e.agent_id}/profile`);ct(t.name),ut(t.description),ft(t.prompt)}catch(e){ft(``),Z.error(String(e.message))}},Xt=async()=>{if(at){mt(!0);try{await ke(`/api/agents/${at.agent_id}`,{name:st.trim(),description:lt.trim(),prompt:dt.trim()}),Z.success(`档案已更新(ARM + 本地已同步)`),ot(null),await Ge()}catch(e){Z.error(String(e.message))}finally{mt(!1)}}},Zt=async()=>{if(Ot){Nt(!0);try{await Oe(`/api/agents/${Ot.agent_id}/arm-delete`,{also_uninstall:!0,purge_workspaces:At}),Z.success(`${Ot.name} 已从 ARM 删除${Ot.installed?`(本地档案已一并卸载)`:``}`),kt(null),jt(!1),await Ge()}catch(e){Z.error(String(e.message))}finally{Nt(!1)}}},Qt=async()=>{if(Pt){zt(!0);try{let e=await Oe(`/api/agents/${Pt.agent_id}/clone`,{name:It.trim()});Z.success(`已创建「${e.name}」`,{description:`档案已物化本地 · 复制绑定:技能 ${e.copied.skills} · 知识 ${e.copied.knowledges} · UI 资产 ${e.copied.ui_assets}${e.copied.failed?`(${e.copied.failed} 条失败可稍后在编辑里补绑)`:``}——副本归你所有,可自由编辑`,duration:6e3}),Ft(null),await Ge()}catch(e){Z.error(String(e.message))}finally{zt(!1)}}},$t=async()=>{if(M){ce(!0);try{if(await ke(`/api/deployment`,{agent_id:M.agent_id,name:P,default_autonomy:I,toolset:te.map(e=>({tool:e})),knowledge_slices:[`ARM经验库(检索式注入)`]}),await Ge(),ae){Z.success(`已更新 ${P} 的权限`,{description:`工具 ${te.length} 项 · ${I} · 即时生效`}),N(null);return}Z.success(`🎉 ${M.name} 已上岗!`,{description:`档案已物化本地(离线可用),工位已就绪——跟它说的第一句话开始吧`,duration:6e3}),N(null),V(`/api/dev/inspirations?agent_id=${M.agent_id}`).catch(()=>{}),e(M.agent_id,P,`workbench`)}catch(e){Z.error(String(e.message))}finally{ce(!1)}}},en=e=>(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1 text-[10px] text-muted-foreground`,children:[e.installed?(0,U.jsxs)(J,{variant:`outline`,className:`h-5 text-[10px] text-primary`,children:[`已下载 `,e.installed_version]}):(0,U.jsx)(J,{variant:`outline`,className:`h-5 text-[10px]`,children:e.version}),(0,U.jsxs)(J,{variant:`outline`,className:`h-5 text-[10px]`,children:[(0,U.jsx)(fg,{className:`mr-0.5 h-2.5 w-2.5`}),e.skills,` 技能`]}),(0,U.jsxs)(J,{variant:`outline`,className:`h-5 text-[10px]`,children:[(0,U.jsx)(Sp,{className:`mr-0.5 h-2.5 w-2.5`}),e.knowledges,` 知识`]}),e.local_only&&(0,U.jsx)(J,{className:`h-5 bg-warning/15 text-[10px] text-warning hover:bg-warning/25`,title:`离线创建的本地档案——仅本机可见可用;恢复 ARM 连接后在卡片上点「发布」转正(身份与数据不变)`,children:`未发布`}),e.foreign&&e.source_name&&(0,U.jsx)(J,{className:`h-5 max-w-40 bg-ai/10 text-[10px] text-ai hover:bg-ai/20`,title:`来自 ARM 源「${e.source_name}」,当前源「${l?.name||``}」的目录里没有它——升级/编辑请切回来源源;也可点「发布」把它推送到当前源(同 id,身份不变)`,children:(0,U.jsxs)(`span`,{className:`truncate`,children:[`来自 `,e.source_name]})}),e.created_by&&a&&e.created_by_id!==a.id&&(0,U.jsx)(J,{variant:`outline`,className:`h-5 max-w-36 text-[10px]`,title:`由 ${e.created_by} 创建——编辑需联系作者或管理员,或点卡片上的克隆图标复制一份自己改`,children:(0,U.jsxs)(`span`,{className:`truncate`,children:[`by `,e.created_by]})})]});return(0,U.jsxs)(`div`,{className:`h-full overflow-auto p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-bold`,children:[(0,U.jsx)(cg,{className:`h-5 w-5 text-primary`}),`助手大厅`]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`档案物化到本地助手库(离线可用)· 上岗配置由平台管理(档案/配置分离)· 升级不触碰工作台与数据`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,U.jsxs)(J,{variant:`secondary`,children:[`共 `,t.length,` 名`]}),(0,U.jsxs)(J,{className:`bg-success/15 text-success hover:bg-success/25`,children:[`在岗 `,H.length]}),Je.length>0&&(0,U.jsxs)(J,{className:`bg-warning/15 text-warning hover:bg-warning/25`,children:[`可升级 `,Je.length]}),a&&(0,U.jsxs)(J,{variant:`outline`,className:`font-normal`,title:`ARM 令牌身份(编辑/删除按此判定):${a.name||a.id.slice(0,8)}${a.role===`ADMIN`?`——管理员可管理全部助手`:`——可编辑自己创建的助手`}`,children:[a.name||`已认证`,a.role===`ADMIN`?` · 管理员`:``]}),d.length>1?(0,U.jsxs)(Eg,{value:l?.id||``,onValueChange:Ke,disabled:p,children:[(0,U.jsxs)(Og,{className:`h-8 w-44 text-xs data-[size=default]:h-8`,title:`当前 ARM 源:${l?.name||``}(${l?.base||``})——目录检索、下载、新建、发布、经验回流都打这个源;公库/私库随时切换,本地库不受影响`,children:[(0,U.jsx)(Mh,{className:`mr-1 h-3.5 w-3.5 shrink-0 text-primary`}),(0,U.jsx)(Dg,{placeholder:`ARM 源`})]}),(0,U.jsx)(kg,{children:d.map(e=>(0,U.jsx)(Ag,{value:e.id,className:`text-xs`,children:e.name},e.id))})]}):l&&(0,U.jsxs)(J,{variant:`outline`,className:`h-8 gap-1 px-2 font-normal`,title:`ARM 源:${l.base}——在「系统设置 · ARM 源」可添加私库/其他站点,大厅随时切换`,children:[(0,U.jsx)(Mh,{className:`h-3.5 w-3.5 text-primary`}),l.name]}),(0,U.jsxs)(Y,{size:`sm`,className:`gap-1 text-xs`,onClick:()=>{be(1),ve(!0)},title:`描述需求,AI 起草档案 → ARM 创建 → 上岗,一条链完成`,children:[(0,U.jsx)(Wh,{className:`h-3.5 w-3.5`}),`新建助手`]}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`gap-1 text-xs`,disabled:b||!r,onClick:Xe,title:r?`比对 ARM 远端目录`:`离线模式`,children:[(0,U.jsx)(bh,{className:`h-3.5 w-3.5 ${b?`animate-spin`:``}`}),`检查更新`]})]})]}),!r&&s&&(0,U.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning`,children:[(0,U.jsx)(Mm,{className:`h-4 w-4 shrink-0`}),`ARM 源「`,l?.name||`ARM`,`」令牌未配置或无权限——请到该 ARM 站点生成访问令牌(arm_pat_…),再到「系统设置 · ARM 源」粘贴保存。`,(0,U.jsx)(`a`,{href:l?.base||`http://arm.agent-platform.dev.aimstek.cn`,target:`_blank`,rel:`noreferrer`,className:`ml-auto shrink-0 underline underline-offset-2 hover:text-warning/80`,children:`打开 ARM →`})]}),!r&&!s&&(0,U.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning`,children:[(0,U.jsx)(Kp,{className:`h-4 w-4 shrink-0`}),`离线模式:ARM 源「`,l?.name||`ARM`,`」不可达,以上为本地助手库(`,qe.length,` 名,对话/工作台/数据集可继续使用);下载与升级需恢复连接`,d.length>1?`,或切换到其他 ARM 源`:``,`。`]}),(0,U.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`relative w-64 shrink-0`,children:[(0,U.jsx)(Oh,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground ${k?`animate-pulse text-primary`:``}`}),(0,U.jsx)(wg,{value:E,onChange:e=>D(e.target.value),placeholder:`搜索助手(名称/描述,检索 ARM 目录)`,className:`h-8 pl-8 pr-7 text-xs`}),E&&(0,U.jsx)(`button`,{onClick:()=>D(``),title:`清空搜索`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(mg,{className:`h-3.5 w-3.5`})})]}),!w&&H.length===0&&!h&&(0,U.jsxs)(`div`,{className:`mb-4 flex items-center gap-3 rounded-xl border border-primary/30 bg-primary/5 px-3.5 py-2.5`,children:[(0,U.jsx)(Wh,{className:`h-4 w-4 shrink-0 text-primary`}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 text-[11px]`,children:[(0,U.jsx)(`span`,{className:`font-semibold text-primary`,children:`30 秒上手`}),(0,U.jsx)(`span`,{children:`① 从下面挑一名助手,点「上岗配置」`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,U.jsx)(`span`,{children:`② 在工作台跟它说第一句话`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,U.jsx)(`span`,{children:`③ 说「右上加一个最近告警」,看着界面长出来`})]}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-[11px]`,onClick:()=>{localStorage.setItem(`aims.guide-done`,`1`),T(!0)},children:`知道了`})]}),(0,U.jsx)(`div`,{className:`flex gap-1.5 text-xs`,children:[[`all`,`全部 ${t.length}`],[`deployed`,`在岗 ${H.length}`],[`installed`,`已下载 ${qe.length}`],[`updates`,`可更新 ${Je.length}`]].map(([e,t])=>(0,U.jsx)(`button`,{onClick:()=>C(e),className:`rounded-full border px-2.5 py-1 transition-colors ${S===e?`border-primary/60 bg-primary/15 text-primary`:`border-border text-muted-foreground hover:text-foreground`}`,children:t},e))})]}),h?(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-3 xl:grid-cols-4`,children:[...Array(8)].map((e,t)=>(0,U.jsx)(Gf,{className:`h-44 animate-pulse`},t))}):(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4`,children:Ye.map(t=>(0,U.jsxs)(Gf,{className:`flex flex-col ${t.deployed?`border-primary/40`:``} ${!r&&!t.installed?`opacity-50`:``}`,children:[(0,U.jsx)(Kf,{className:`pb-2`,children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsxs)(qf,{className:`flex items-center gap-1.5 text-sm leading-snug`,children:[(0,U.jsx)(p_,{id:t.agent_id,name:t.name}),t.name]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[t.update_available&&(0,U.jsxs)(J,{className:`h-5 bg-warning/15 text-[10px] text-warning hover:bg-warning/25`,children:[(0,U.jsx)(Rp,{className:`mr-0.5 h-2.5 w-2.5`}),t.remote_version]}),t.delisted&&(0,U.jsx)(J,{variant:`outline`,className:`h-5 text-[10px] text-destructive`,children:`已下架`}),t.deployed&&(0,U.jsx)(J,{className:`h-5 bg-success/15 text-[10px] text-success hover:bg-success/25`,children:`在岗`})]})]})}),(0,U.jsxs)(Jf,{className:`flex-1 space-y-2 pb-2`,children:[(0,U.jsx)(`p`,{className:`line-clamp-2 h-8 text-[11px] text-muted-foreground`,children:t.description||`(ARM 档案无描述)`}),en(t)]}),(0,U.jsxs)(Yf,{className:`gap-1.5`,children:[t.deployed?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{size:`sm`,className:`flex-1 text-xs`,onClick:()=>e(t.agent_id,t.name,`workbench`),children:`进入工作台 →`}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 shrink-0 p-0`,onClick:()=>rt(t),title:`调整权限(工具集/自主级别,即时生效)`,children:(0,U.jsx)(Hh,{className:`h-3.5 w-3.5`})})]}):!r&&!t.installed?(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`flex-1 text-xs`,disabled:!0,title:`离线模式:恢复 ARM 连接后可上岗`,children:`上岗配置(离线不可用)`}):(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`flex-1 text-xs`,onClick:()=>nt(t),children:[(0,U.jsx)(Wh,{className:`mr-1 h-3 w-3`}),`上岗配置`]}),t.update_available&&(0,U.jsxs)(Y,{size:`sm`,className:`text-xs`,disabled:_===t.agent_id,onClick:()=>ue(t),children:[(0,U.jsx)(Rp,{className:`mr-1 h-3 w-3`}),`升级`]}),!t.update_available&&!t.installed&&r&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`text-xs`,disabled:_===t.agent_id,onClick:()=>Ze(t,`download`),title:`下载档案到本地,离线可用`,children:(0,U.jsx)(im,{className:`h-3.5 w-3.5`})}),t.installed&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,onClick:()=>Qe(t),title:`版本历史 / 回滚 / 卸载`,children:(0,U.jsx)(om,{className:`h-3.5 w-3.5`})}),(t.local_only||t.foreign)&&r&&(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 gap-1 px-2 text-[11px] text-warning hover:text-warning`,disabled:_===t.agent_id,onClick:()=>G(t),title:t.foreign?`发布到当前源「${l?.name||``}」:来自「${t.source_name||``}」的助手以同一身份推送过去(档案 + 知识全文;技能/UI 资产不复制)`:`发布到「${l?.name||`ARM`}」:团队可见、可绑定技能/知识;助手身份与本地数据不变`,children:[(0,U.jsx)(Jp,{className:`h-3.5 w-3.5`}),`发布`]}),r&&!t.foreign&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,disabled:_===t.agent_id,onClick:()=>{Ft(t),Lt(`${t.name}-副本`)},title:`克隆为新助手(复制档案与全部绑定,副本归你所有可自由编辑)——无编辑权限或想做类似助手时用`,children:(0,U.jsx)(Xp,{className:`h-3.5 w-3.5`})}),it(t)&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,disabled:_===t.agent_id,onClick:()=>Yt(t),title:`编辑档案(名称/Prompt/技能与知识绑定)${t.created_via_workstation?`· 工作站创建`:``}`,children:(0,U.jsx)(Kh,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0 text-destructive hover:text-destructive`,disabled:_===t.agent_id,onClick:()=>{kt(t),jt(!1)},title:`从 ARM 删除(不可恢复)`,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})})]})]})]},t.agent_id))}),Ye.length===0&&(0,U.jsx)(`div`,{className:`mt-10 text-center text-sm text-muted-foreground`,children:r?E?`没有匹配「${E}」的助手——换个关键词试试`:`没有匹配的助手`:E?`本地库中没有匹配「${E}」的助手(离线模式不检索 ARM 目录)`:`本地库为空:恢复 ARM 连接后点「检查更新」下载助手`}),(0,U.jsx)(gg,{open:_e,onOpenChange:e=>{!Me&&!De&&ve(e)},children:(0,U.jsxs)(yg,{className:`flex max-h-[88vh] max-w-2xl flex-col overflow-hidden sm:max-w-2xl`,children:[(0,U.jsxs)(bg,{children:[(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Wh,{className:`h-4 w-4 text-primary`}),`新建助手`]}),(0,U.jsx)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[[`1`,`描述`],[`2`,`档案`],[`3`,`上岗`]].map(([e,t],n)=>(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[n>0&&(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,U.jsx)(`span`,{className:`flex h-4 w-4 items-center justify-center rounded-full text-[9px] ${ye>n?`bg-primary text-primary-foreground`:`border border-border text-muted-foreground`}`,children:e}),(0,U.jsx)(`span`,{className:ye>n?`font-medium text-foreground`:`text-muted-foreground`,children:t})]},e))})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-0.5`,children:ye===1?(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:`你想让小助手帮你做什么?`}),(0,U.jsx)(`p`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:`用一段话描述职责,AI 起草名称与 System Prompt,下一步可自由编辑。`})]}),(0,U.jsx)(`textarea`,{value:Ce,onChange:e=>we(e.target.value),spellCheck:!1,rows:5,placeholder:`例如:帮我盯冷库温度,出现异常时结合传感器读数和压缩机状态给出处置建议;每天早上汇总告警……`,className:`w-full resize-y rounded-md border bg-background p-2.5 text-xs leading-relaxed`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`试试:`}),[`排查WMS日志报错并给出定位`,`汇总每日告警生成晨报`,`回答新人运维常见问题`,`冷库温度异常诊断`].map(e=>(0,U.jsx)(`button`,{onClick:()=>we(e),className:`rounded-full border border-border px-2 py-0.5 text-[10px] text-muted-foreground transition-colors hover:border-primary/60 hover:text-primary`,children:e},e))]})]}):(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`名称(ARM 全局唯一)`}),(0,U.jsx)(wg,{value:xe,onChange:e=>Se(e.target.value),placeholder:`如:冷库温控诊断助手`,className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`描述(≤512 字,可选)`}),(0,U.jsx)(wg,{value:Ce,onChange:e=>we(e.target.value),placeholder:`一句话职责说明`,className:`text-xs`})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`System Prompt`,(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-6 gap-1 px-1.5 text-[10px]`,disabled:De,onClick:()=>He(!1),children:[(0,U.jsx)(Wh,{className:`h-3 w-3 ${De?`animate-pulse`:``}`}),De?`起草中…`:`重新起草`]}),(0,U.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:`按左侧描述重新生成`})]}),(0,U.jsx)(`textarea`,{value:Te,onChange:e=>Ee(e.target.value),spellCheck:!1,rows:8,className:`w-full resize-y rounded-md border bg-background p-2 font-mono text-xs leading-relaxed`})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`绑定知识(可选)——助手创建后即可检索这些经验`,ze.length>0&&(0,U.jsxs)(J,{variant:`secondary`,className:`h-4 px-1 text-[9px]`,children:[`已选 `,ze.length]})]}),ze.length>0&&(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:ze.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-1.5 py-0.5 text-[10px]`,children:[(0,U.jsx)(`span`,{className:`max-w-56 truncate`,title:e.name,children:e.name}),(0,U.jsx)(`button`,{className:`shrink-0 text-muted-foreground hover:text-destructive`,onClick:()=>Be(t=>t.filter(t=>t.id!==e.id)),children:(0,U.jsx)(mg,{className:`h-2.5 w-2.5`})})]},e.id))}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(wg,{value:Pe,onChange:e=>Fe(e.target.value),placeholder:`按关键词检索 ARM 知识库,如 wms / 告警 / dockerfile`,className:`text-xs`,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),Ue())}}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-8 shrink-0 text-xs`,disabled:!Pe.trim(),onClick:Ue,children:`检索`})]}),Ie.length>0&&(0,U.jsx)(`div`,{className:`max-h-36 space-y-0.5 overflow-y-auto rounded-md border p-1`,children:Ie.map(e=>{let t=Ve.has(e.id);return(0,U.jsxs)(`button`,{onClick:()=>Be(n=>t?n.filter(t=>t.id!==e.id):[...n,{id:e.id,name:e.name}]),className:`flex w-full min-w-0 items-start gap-2 rounded px-1.5 py-1 text-left transition-colors hover:bg-accent`,children:[t?(0,U.jsx)(Bp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-primary`}):(0,U.jsx)(mh,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[11px] font-medium`,title:e.name,children:e.name}),e.description&&(0,U.jsx)(`span`,{className:`block truncate text-[10px] text-muted-foreground`,title:e.description,children:e.description})]})]},e.id)})})]})]})}),(0,U.jsx)(xg,{children:ye===1?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{variant:`ghost`,className:`text-xs text-muted-foreground`,onClick:()=>be(2),children:`跳过,手动填写 →`}),(0,U.jsxs)(Y,{className:`gap-1 text-xs`,disabled:De||!Ce.trim(),onClick:()=>He(!0),children:[(0,U.jsx)(Wh,{className:`h-3.5 w-3.5 ${De?`animate-pulse`:``}`}),De?`AI 起草中…`:`AI 起草档案 →`]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:Me,onClick:()=>be(1),children:`← 上一步`}),(0,U.jsx)(Y,{disabled:Me||!xe.trim()||!Te.trim(),onClick:We,children:Me?`创建中…`:`创建并进入上岗配置`})]})})]})}),(0,U.jsx)(gg,{open:!!at,onOpenChange:e=>{!e&&!pt&&!gt&&(ot(null),W(null),Ge())},children:(0,U.jsxs)(yg,{className:`flex max-h-[88vh] max-w-2xl flex-col overflow-hidden sm:max-w-2xl`,children:[(0,U.jsxs)(bg,{children:[(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Kh,{className:`h-4 w-4 text-primary`}),`编辑档案 · `,at?.name,at?.created_via_workstation&&(0,U.jsx)(J,{variant:`secondary`,className:`h-4 px-1 text-[9px]`,children:`工作站创建`})]}),(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:at?.local_only?`本地未发布档案——保存仅写本地(版本前进可回滚);发布到 ARM 后编辑将同步远端。恢复连接前暂不能绑定技能/知识。`:`档案存于 ARM(创建者或管理员可改);保存/绑定后本地档案同步物化(版本前进,可回滚)。`})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto pr-0.5`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`名称`}),(0,U.jsx)(wg,{value:st,onChange:e=>ct(e.target.value),className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`描述`}),(0,U.jsx)(wg,{value:lt,onChange:e=>ut(e.target.value),className:`text-xs`})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`System Prompt(保存后本地档案同步更新)`}),(0,U.jsx)(`textarea`,{value:dt,onChange:e=>ft(e.target.value),spellCheck:!1,rows:8,className:`w-full resize-y rounded-md border bg-background p-2 font-mono text-xs leading-relaxed`})]}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t pt-3`,children:[(0,U.jsxs)(Tg,{className:`text-xs`,children:[`绑定技能(`,ht?.skills.length??`…`,`)——立即生效,无需保存`]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[ht&&ht.skills.length===0&&(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`暂无绑定`}),(ht?.skills||[]).map(e=>(0,U.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-1.5 py-0.5 text-[10px]`,title:e.description,children:[(0,U.jsx)(fg,{className:`h-2.5 w-2.5 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`max-w-56 truncate`,children:e.name}),(0,U.jsx)(`button`,{disabled:gt,className:`shrink-0 text-muted-foreground hover:text-destructive`,title:`解绑`,onClick:()=>Jt(`skill`,e.binding_id,e.name),children:(0,U.jsx)(mg,{className:`h-2.5 w-2.5`})})]},e.binding_id))]}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(wg,{value:vt,onChange:e=>yt(e.target.value),placeholder:at?.local_only?`本地未发布档案,发布后可绑定技能`:`按关键词检索 ARM 技能库`,className:`text-xs`,disabled:!!at?.local_only,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),Gt())}}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-8 shrink-0 text-xs`,disabled:!vt.trim()||!!at?.local_only,onClick:Gt,children:`检索`})]}),bt.length>0&&(0,U.jsx)(`div`,{className:`max-h-28 space-y-0.5 overflow-y-auto rounded-md border p-1`,children:bt.map(e=>{let t=ht?.skills.some(t=>t.ref_id===e.id);return(0,U.jsxs)(`button`,{disabled:gt||t,onClick:()=>qt(`skill`,e.id),className:`flex w-full min-w-0 items-start gap-2 rounded px-1.5 py-1 text-left transition-colors hover:bg-accent disabled:opacity-50`,children:[t?(0,U.jsx)(Bp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-primary`}):(0,U.jsx)(mh,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[11px] font-medium`,title:e.name,children:e.name}),e.description&&(0,U.jsx)(`span`,{className:`block truncate text-[10px] text-muted-foreground`,title:e.description,children:e.description})]})]},e.id)})})]}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t pt-3`,children:[(0,U.jsxs)(Tg,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[`绑定知识(`,ht?.knowledges.length??`…`,`)——立即生效,无需保存`,(0,U.jsxs)(Eg,{value:Et,onValueChange:Dt,children:[(0,U.jsx)(Og,{className:`h-6 w-28 text-[10px] data-[size=default]:h-6`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsx)(Ag,{value:`essential`,className:`text-xs`,children:`核心知识`}),(0,U.jsx)(Ag,{value:`experience`,className:`text-xs`,children:`经验`})]})]}),(0,U.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:`新增绑定按此类型写入`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[ht&&ht.knowledges.length===0&&(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`暂无绑定`}),(ht?.knowledges||[]).map(e=>(0,U.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-1.5 py-0.5 text-[10px]`,title:e.description,children:[(0,U.jsx)(Sp,{className:`h-2.5 w-2.5 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`max-w-56 truncate`,children:e.name}),e.kind&&(0,U.jsx)(J,{variant:`outline`,className:`h-3.5 px-1 text-[8px]`,children:e.kind===`essential`?`核心`:`经验`}),(0,U.jsx)(`button`,{disabled:gt,className:`shrink-0 text-muted-foreground hover:text-destructive`,title:`解绑`,onClick:()=>Jt(`knowledge`,e.binding_id,e.name),children:(0,U.jsx)(mg,{className:`h-2.5 w-2.5`})})]},e.binding_id))]}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(wg,{value:St,onChange:e=>Ct(e.target.value),placeholder:at?.local_only?`本地未发布档案,发布后可绑定知识`:`按关键词检索 ARM 知识库`,className:`text-xs`,disabled:!!at?.local_only,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),Kt())}}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-8 shrink-0 text-xs`,disabled:!St.trim()||!!at?.local_only,onClick:Kt,children:`检索`})]}),wt.length>0&&(0,U.jsx)(`div`,{className:`max-h-28 space-y-0.5 overflow-y-auto rounded-md border p-1`,children:wt.map(e=>{let t=ht?.knowledges.some(t=>t.ref_id===e.id);return(0,U.jsxs)(`button`,{disabled:gt||t,onClick:()=>qt(`knowledge`,e.id,Et),className:`flex w-full min-w-0 items-start gap-2 rounded px-1.5 py-1 text-left transition-colors hover:bg-accent disabled:opacity-50`,children:[t?(0,U.jsx)(Bp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-primary`}):(0,U.jsx)(mh,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[11px] font-medium`,title:e.name,children:e.name}),e.description&&(0,U.jsx)(`span`,{className:`block truncate text-[10px] text-muted-foreground`,title:e.description,children:e.description})]})]},e.id)})})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:pt||gt,onClick:()=>{ot(null),W(null),Ge()},children:`关闭`}),(0,U.jsx)(Y,{disabled:pt||!st.trim()||!dt.trim(),onClick:Xt,children:pt?`保存中…`:`保存档案(ARM + 本地)`})]})]})}),(0,U.jsx)(gg,{open:!!Pt,onOpenChange:e=>{Rt||Ft(e?Pt:null)},children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Xp,{className:`h-4 w-4 text-primary`}),`克隆助手 · `,Pt?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,U.jsxs)(`p`,{className:`text-muted-foreground`,children:[`复制档案(Prompt/描述)与全部绑定(技能 `,Pt?.skills??0,` · 知识 `,Pt?.knowledges??0,`),创建一个`,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:`归你所有`}),`的新助手——可自由编辑,不影响原助手。`,!Pt?.installed&&`(原助手未下载也无妨,克隆直接读 ARM 档案)`]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`新助手名称(ARM 全局唯一)`}),(0,U.jsx)(wg,{value:It,onChange:e=>Lt(e.target.value),placeholder:`${Pt?.name||``}-副本`,className:`text-xs`,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&It.trim()&&!Rt&&(e.preventDefault(),Qt())}})]}),(0,U.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`创建后档案自动物化本地;克隆完成即可「上岗配置」或进编辑调整 Prompt。`})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:Rt,onClick:()=>Ft(null),children:`取消`}),(0,U.jsx)(Y,{disabled:Rt||!It.trim(),onClick:Qt,children:Rt?`克隆中…`:`创建副本`})]})]})}),(0,U.jsx)(gg,{open:!!Bt,onOpenChange:e=>{Vt||G(e?Bt:null)},children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Jp,{className:`h-4 w-4 text-warning`}),`发布到「`,l?.name||`ARM`,`」 · `,Bt?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[Bt?.foreign?(0,U.jsxs)(`p`,{className:`leading-relaxed text-muted-foreground`,children:[`该助手来自 ARM 源「`,Bt.source_name,`」。发布后以`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`同一身份(id)`}),`出现在当前源「`,l?.name,`」: 档案(名称 / 描述 / Prompt)与本地已物化的`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`知识全文`}),`一并创建并绑定;技能与 UI 资产属 ARM 侧资产`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`不复制`}),`(发布后可在编辑里重新绑定)。 本地在岗状态、工作台与数据不受影响。`]}):(0,U.jsxs)(`p`,{className:`leading-relaxed text-muted-foreground`,children:[`该助手创建于离线环境(档案仅在本机)。发布后:`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`团队可见`}),`、可绑定技能/知识/UI 资产、进入版本升级链路。 助手身份与本地数据`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`保持不变`}),`(档案/配置分离),在岗状态与工作台不受影响。`]}),(0,U.jsx)(`p`,{className:`rounded-md border border-warning/30 bg-warning/10 px-2.5 py-1.5 text-warning`,children:`名称在该 ARM 源内全局唯一——若他人已用同名(含其本人发布同款),发布会提示冲突,改名后重试即可。`})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:Vt,onClick:()=>G(null),children:`取消`}),(0,U.jsx)(Y,{disabled:Vt,onClick:Ut,children:Vt?`发布中…`:`发布到「${l?.name||`ARM`}」`})]})]})}),(0,U.jsx)(gg,{open:!!Ot,onOpenChange:e=>{Mt||kt(e?Ot:null)},children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-2 text-destructive`,children:[(0,U.jsx)(ng,{className:`h-4 w-4`}),Ot?.local_only?`删除本地档案「${Ot?.name}」?`:`从 ARM 删除「${Ot?.name}」?`]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[Ot?.local_only?(0,U.jsxs)(`p`,{className:`leading-relaxed`,children:[`该助手是离线创建的`,(0,U.jsx)(`b`,{children:`本地未发布档案`}),`(ARM 上不存在)——删除仅移除本机的档案/配置/工作台,不影响其他人。`]}):(0,U.jsxs)(`p`,{className:`leading-relaxed`,children:[`将调用 ARM 删除接口`,(0,U.jsx)(`b`,{children:`永久移除该助手档案`}),`(含已绑定的知识与版本记录),所有工作站将不再可见,此操作不可恢复。`,Ot?.deployed&&` 该助手当前在岗,删除将同时移除上岗配置、工作台与本地档案。`]}),Ot?.installed&&!Ot?.deployed&&(0,U.jsxs)(`label`,{className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 p-2.5`,children:[(0,U.jsx)(hg,{checked:At,onCheckedChange:e=>jt(!!e)}),(0,U.jsx)(`span`,{children:`同时清除工作区数据(数据集库与文件;不勾选则保留在磁盘)`})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:Mt,onClick:()=>kt(null),children:`取消`}),(0,U.jsx)(Y,{variant:`destructive`,disabled:Mt,onClick:Zt,children:Mt?`删除中…`:Ot?.local_only?`确认删除本地档案`:`确认从 ARM 删除`})]})]})}),(0,U.jsx)(gg,{open:!!M,onOpenChange:e=>!se&&N(e?M:null),children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[ae?`调整权限`:`上岗配置`,` · `,M?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`岗位名称`}),(0,U.jsx)(wg,{value:P,onChange:e=>F(e.target.value),className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`它能做什么?(选一档,工具与确认策略一次配好)`}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[h_.map(e=>{let t=re===e.id,n=e.id===`observer`?m_.length:j.length,r=e.autonomy===`L3`?`免确认`:e.autonomy===`L2`?`写操作先确认`:`不动手`;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>tt(e.id),className:B(`flex items-start gap-2 rounded-lg border p-2.5 text-left transition-colors`,t?`border-primary bg-primary/10`:`border-border hover:border-primary/50`),children:[(0,U.jsx)(`span`,{className:`pt-0.5 text-sm leading-none`,children:e.emoji}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-medium`,children:[e.title,`recommended`in e&&e.recommended&&(0,U.jsx)(J,{className:`h-4 bg-primary/15 px-1 text-[9px] text-primary`,children:`推荐`}),t&&(0,U.jsx)(Bp,{className:`h-3.5 w-3.5 text-primary`})]}),(0,U.jsx)(`span`,{className:`mt-0.5 block text-[10px] leading-relaxed text-muted-foreground`,children:e.desc}),(0,U.jsxs)(`span`,{className:`mt-0.5 block text-[9px] text-muted-foreground`,children:[n,` 项工具 · `,r,`(`,e.autonomy,`)`]})]})]},e.id)}),re===`custom`&&(0,U.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`当前为手动微调的自定义组合`})]})]}),(0,U.jsxs)(`details`,{className:`rounded-md border`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer select-none px-2.5 py-2 text-[11px] text-muted-foreground hover:text-foreground`,children:`高级:逐项微调工具与自主级别`}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t p-2.5`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`自主级别(写操作要不要先问你)`}),(0,U.jsxs)(Eg,{value:I,onValueChange:e=>{L(e),ie(`custom`)},children:[(0,U.jsx)(Og,{className:`text-xs`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsx)(Ag,{value:`L0`,className:`text-xs`,children:`只回答不动手(L0)`}),(0,U.jsx)(Ag,{value:`L1`,className:`text-xs`,children:`给建议不动手(L1)`}),(0,U.jsx)(Ag,{value:`L2`,className:`text-xs`,children:`做了等我确认(L2)`}),(0,U.jsx)(Ag,{value:`L3`,className:`text-xs text-destructive`,children:`全自动免确认(L3)`})]})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`text-xs`,children:[`工具(`,te.length,`/`,j.length,` 项)`]}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 rounded-md border p-2`,children:j.map(e=>(0,U.jsxs)(`label`,{className:`flex items-start gap-2 text-xs`,children:[(0,U.jsx)(hg,{checked:te.includes(e.name),onCheckedChange:t=>{ne(n=>t?[...n,e.name]:n.filter(t=>t!==e.name)),ie(`custom`)}}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:e.name}),(0,U.jsx)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:e.description.slice(0,40)}),e.min_level>=2&&(0,U.jsx)(J,{variant:`outline`,className:`ml-1 h-4 px-1 text-[9px] text-warning`,children:`写·L2`})]})]},e.name))})]})]})]}),(0,U.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:ae?`保存后即时生效,不影响会话与数据`:`保存后自动下载档案到本地(离线可用)并生成初版工作台与默认工作区`})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:se,onClick:()=>N(null),children:`取消`}),(0,U.jsx)(Y,{disabled:se,onClick:$t,children:se?ae?`保存中…`:`上岗中…`:ae?`保存调整`:`确认上岗`})]})]})}),(0,U.jsx)(gg,{open:!!le,onOpenChange:e=>!e&&ue(null),children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[`升级 · `,le?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(J,{variant:`outline`,children:le?.installed_version}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,U.jsx)(J,{className:`bg-warning/15 text-warning hover:bg-warning/25`,children:le?.remote_version})]}),(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:`将从 ARM 拉取新版本档案(prompt + 绑定知识全文)物化到本地版本目录,原版本保留可回滚。若该助手在 ARM 绑定了 UI 资产(三资产模型),将一并物化为工作台新版本(历史可回滚)。`}),(0,U.jsx)(`p`,{className:`rounded-md border border-success/30 bg-success/10 px-2.5 py-1.5 text-success`,children:`你的工作台、插件、工作区与数据将完整保留(档案/配置分离);UI 资产物化只前进版本号不覆盖历史。档案实质变更后,可在「定制工作台」让工程师基于新能力重新定制。`})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:()=>ue(null),children:`稍后`}),(0,U.jsx)(Y,{disabled:_===le?.agent_id,onClick:()=>le&&Ze(le,`upgrade`),children:_===le?.agent_id?`升级中…`:`升级并保留配置`})]})]})}),(0,U.jsx)(gg,{open:!!de,onOpenChange:e=>{e||(fe(null),z(null))},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[`本地版本 · `,de?.name]})}),(0,U.jsxs)(`div`,{className:`max-h-72 space-y-1.5 overflow-auto text-xs`,children:[!R&&(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:`加载中…`}),R?.versions.length===0&&(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:`无本地版本`}),R?.versions.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border px-2.5 py-2`,children:[(0,U.jsx)(wh,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:e.version}),e.current&&(0,U.jsx)(J,{className:`h-4 bg-primary/15 px-1 text-[9px] text-primary`,children:`当前`}),R.remote_version===e.version&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:`与远端一致`})]}),(0,U.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[Le(e.downloaded_at,`dts`),` · 本地知识 `,e.knowledges,` 条`]})]}),!e.current&&(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-7 text-[11px]`,onClick:()=>de&&$e(de,e.version),children:`回滚到此版`})]},e.version))]}),(0,U.jsxs)(xg,{className:`sm:justify-between`,children:[(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,className:`gap-1 text-xs text-destructive hover:text-destructive`,onClick:()=>de&&me(de),children:[(0,U.jsx)(ng,{className:`h-3.5 w-3.5`}),`卸载该助手`]}),(0,U.jsx)(Y,{variant:`outline`,onClick:()=>{fe(null),z(null)},children:`关闭`})]})]})}),(0,U.jsx)(gg,{open:!!pe,onOpenChange:e=>{e||(me(null),ge(!1))},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[`卸载 · `,pe?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,U.jsxs)(`p`,{children:[`将删除:本地档案(全部版本)、上岗配置、工作台定义与草稿`,pe?.deployed?`(该助手在岗,将一并下岗)`:``,`。`]}),(0,U.jsxs)(`label`,{className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 p-2.5`,children:[(0,U.jsx)(hg,{checked:he,onCheckedChange:e=>ge(!!e)}),(0,U.jsx)(`span`,{children:`同时清除工作区数据(默认工作区目录 + 数据集库;自定义路径只删登记、不动用户文件)`})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:()=>me(null),children:`取消`}),(0,U.jsx)(Y,{variant:`destructive`,disabled:_===pe?.agent_id,onClick:()=>pe&&et(pe),children:_===pe?.agent_id?`卸载中…`:`确认卸载`})]})]})})]})}function __(e){return e?.views?.length?e.views:[{id:`main`,name:`主视图`,panels:e?.panels||[]}]}function v_(e){let t=__(e).map(e=>({...e,panels:[...e.panels]}));return{...e,views:t,panels:t.flatMap(e=>e.panels)}}var y_=He(`relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current`}},defaultVariants:{variant:`default`}});function b_({className:e,variant:t,...n}){return(0,U.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:B(y_({variant:t}),e),...n})}function x_({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`alert-title`,className:B(`col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight`,e),...t})}function S_({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`alert-description`,className:B(`col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground [&_p]:leading-relaxed`,e),...t})}function C_(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var w_=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,T_=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E_={};function D_(e,t){return((t||E_).jsx?T_:w_).test(e)}var O_=/[ \t\n\f\r]/g;function k_(e){return typeof e==`object`?e.type===`text`&&A_(e.value):A_(e)}function A_(e){return e.replace(O_,``)===``}var j_=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};j_.prototype.normal={},j_.prototype.property={},j_.prototype.space=void 0;function M_(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new j_(n,r,t)}function N_(e){return e.toLowerCase()}var P_=class{constructor(e,t){this.attribute=t,this.property=e}};P_.prototype.attribute=``,P_.prototype.booleanish=!1,P_.prototype.boolean=!1,P_.prototype.commaOrSpaceSeparated=!1,P_.prototype.commaSeparated=!1,P_.prototype.defined=!1,P_.prototype.mustUseProperty=!1,P_.prototype.number=!1,P_.prototype.overloadedBoolean=!1,P_.prototype.property=``,P_.prototype.spaceSeparated=!1,P_.prototype.space=void 0;var F_=s({boolean:()=>L_,booleanish:()=>R_,commaOrSpaceSeparated:()=>H_,commaSeparated:()=>V_,number:()=>Q,overloadedBoolean:()=>z_,spaceSeparated:()=>B_}),I_=0,L_=U_(),R_=U_(),z_=U_(),Q=U_(),B_=U_(),V_=U_(),H_=U_();function U_(){return 2**++I_}var W_=Object.keys(F_),G_=class extends P_{constructor(e,t,n,r){let i=-1;if(super(e,t),K_(this,`space`,r),typeof n==`number`)for(;++i<W_.length;){let e=W_[i];K_(this,W_[i],(n&F_[e])===F_[e])}}};G_.prototype.defined=!0;function K_(e,t,n){n&&(e[t]=n)}function q_(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new G_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[N_(r)]=r,n[N_(a.attribute)]=r}return new j_(t,n,e.space)}var J_=q_({properties:{ariaActiveDescendant:null,ariaAtomic:R_,ariaAutoComplete:null,ariaBusy:R_,ariaChecked:R_,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:B_,ariaCurrent:null,ariaDescribedBy:B_,ariaDetails:null,ariaDisabled:R_,ariaDropEffect:B_,ariaErrorMessage:null,ariaExpanded:R_,ariaFlowTo:B_,ariaGrabbed:R_,ariaHasPopup:null,ariaHidden:R_,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:B_,ariaLevel:Q,ariaLive:null,ariaModal:R_,ariaMultiLine:R_,ariaMultiSelectable:R_,ariaOrientation:null,ariaOwns:B_,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:R_,ariaReadOnly:R_,ariaRelevant:null,ariaRequired:R_,ariaRoleDescription:B_,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:R_,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Y_(e,t){return t in e?e[t]:t}function X_(e,t){return Y_(e,t.toLowerCase())}var Z_=q_({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:V_,acceptCharset:B_,accessKey:B_,action:null,allow:null,allowFullScreen:L_,allowPaymentRequest:L_,allowUserMedia:L_,alpha:L_,alt:null,as:null,async:L_,autoCapitalize:null,autoComplete:B_,autoFocus:L_,autoPlay:L_,blocking:B_,capture:null,charSet:null,checked:L_,cite:null,className:B_,closedBy:null,colorSpace:null,cols:Q,colSpan:Q,command:null,commandFor:null,content:null,contentEditable:R_,controls:L_,controlsList:B_,coords:Q|V_,crossOrigin:null,data:null,dateTime:null,decoding:null,default:L_,defer:L_,dir:null,dirName:null,disabled:L_,download:z_,draggable:R_,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:L_,formTarget:null,headers:B_,height:Q,hidden:z_,high:Q,href:null,hrefLang:null,htmlFor:B_,httpEquiv:B_,id:null,imageSizes:null,imageSrcSet:null,inert:L_,inputMode:null,integrity:null,is:null,isMap:L_,itemId:null,itemProp:B_,itemRef:B_,itemScope:L_,itemType:B_,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:L_,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:L_,muted:L_,name:null,nonce:null,noModule:L_,noValidate:L_,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:L_,optimum:Q,pattern:null,ping:B_,placeholder:null,playsInline:L_,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:L_,referrerPolicy:null,rel:B_,required:L_,reversed:L_,rows:Q,rowSpan:Q,sandbox:B_,scope:null,scoped:L_,seamless:L_,selected:L_,shadowRootClonable:L_,shadowRootCustomElementRegistry:L_,shadowRootDelegatesFocus:L_,shadowRootMode:null,shadowRootSerializable:L_,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:R_,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:L_,useMap:null,value:R_,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:B_,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:L_,declare:L_,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:L_,noHref:L_,noShade:L_,noWrap:L_,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:R_,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:L_,disablePictureInPicture:L_,disableRemotePlayback:L_,exportParts:V_,part:B_,prefix:null,property:null,results:Q,security:null,unselectable:null},space:`html`,transform:X_}),Q_=q_({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:H_,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:B_,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:L_,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:V_,g2:V_,glyphName:V_,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:H_,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:B_,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:H_,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:H_,rev:H_,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:H_,requiredFeatures:H_,requiredFonts:H_,requiredFormats:H_,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:H_,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:H_,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:H_,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Y_}),$_=q_({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),ev=q_({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:X_}),tv=q_({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),nv={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},rv=/[A-Z]/g,iv=/-[a-z]/g,av=/^data[-\w.:]+$/i;function ov(e,t){let n=N_(t),r=t,i=P_;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&av.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(iv,cv);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!iv.test(e)){let n=e.replace(rv,sv);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=G_}return new i(r,t)}function sv(e){return`-`+e.toLowerCase()}function cv(e){return e.charAt(1).toUpperCase()}var lv=M_([J_,Z_,$_,ev,tv],`html`),uv=M_([J_,Q_,$_,ev,tv],`svg`);function dv(e){return e.join(` `).trim()}var fv=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
53
53
  `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),pv=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(fv());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),mv=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),hv=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(pv()),r=mv();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),gv=vv(`end`),_v=vv(`start`);function vv(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function yv(e){let t=_v(e),n=gv(e);if(t&&n)return{start:t,end:n}}function bv(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Sv(e.position):`start`in e||`end`in e?Sv(e):`line`in e||`column`in e?xv(e):``}function xv(e){return Cv(e&&e.line)+`:`+Cv(e&&e.column)}function Sv(e){return xv(e&&e.start)+`-`+xv(e&&e.end)}function Cv(e){return e&&typeof e==`number`?e:1}var wv=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=bv(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};wv.prototype.file=``,wv.prototype.name=``,wv.prototype.reason=``,wv.prototype.message=``,wv.prototype.stack=``,wv.prototype.column=void 0,wv.prototype.line=void 0,wv.prototype.ancestors=void 0,wv.prototype.cause=void 0,wv.prototype.fatal=void 0,wv.prototype.place=void 0,wv.prototype.ruleId=void 0,wv.prototype.source=void 0;var Tv=l(hv(),1),Ev={}.hasOwnProperty,Dv=new Map,Ov=/[A-Z]/g,kv=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Av=new Set([`td`,`th`]),jv=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Mv(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Uv(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Hv(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?uv:lv,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Nv(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Nv(e,t,n){if(t.type===`element`)return Pv(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Fv(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Lv(e,t,n);if(t.type===`mdxjsEsm`)return Iv(e,t);if(t.type===`root`)return Rv(e,t,n);if(t.type===`text`)return zv(e,t)}function Pv(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=uv,e.schema=i),e.ancestors.push(t);let a=Yv(e,t.tagName,!1),o=Wv(e,t),s=Kv(e,t);return kv.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!k_(e)})),Bv(e,o,a,t),Vv(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Fv(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Xv(e,t.position)}function Iv(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xv(e,t.position)}function Lv(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=uv,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Yv(e,t.name,!0),o=Gv(e,t),s=Kv(e,t);return Bv(e,o,a,t),Vv(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Rv(e,t,n){let r={};return Vv(r,Kv(e,t)),e.create(t,e.Fragment,r,n)}function zv(e,t){return t.value}function Bv(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vv(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Hv(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Uv(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=_v(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Wv(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ev.call(t.properties,i)){let a=qv(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Av.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Gv(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Xv(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Xv(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Kv(e,t){let n=[],r=-1,i=e.passKeys?new Map:Dv;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Nv(e,a,o);s!==void 0&&n.push(s)}return n}function qv(e,t,n){let r=ov(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?C_(n):dv(n)),r.property===`style`){let t=typeof n==`object`?n:Jv(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Zv(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?nv[r.property]||r.property:r.attribute,n]}}function Jv(e,t){try{return(0,Tv.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new wv("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=jv+`#cannot-parse-style-attribute`,r}}function Yv(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=D_(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=D_(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Ev.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Xv(e)}function Xv(e,t){let n=new wv("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=jv+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Zv(e){let t={},n;for(n in e)Ev.call(e,n)&&(t[Qv(n)]=e[n]);return t}function Qv(e){let t=e.replace(Ov,$v);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function $v(e){return`-`+e.toLowerCase()}var ey={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},ty={};function ny(e,t){let n=t||ty;return ry(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function ry(e,t,n){if(ay(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return iy(e.children,t,n)}return Array.isArray(e)?iy(e,t,n):``}function iy(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ry(e[i],t,n);return r.join(``)}function ay(e){return!!(e&&typeof e==`object`)}var oy=document.createElement(`i`);function sy(e){let t=`&`+e+`;`;oy.innerHTML=t;let n=oy.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function cy(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function ly(e,t){return e.length>0?(cy(e,e.length,0,t),e):t}var uy={}.hasOwnProperty;function dy(e){let t={},n=-1;for(;++n<e.length;)fy(t,e[n]);return t}function fy(e,t){let n;for(n in t){let r=(uy.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){uy.call(r,a)||(r[a]=[]);let e=i[a];py(r[a],Array.isArray(e)?e:e?[e]:[])}}}function py(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);cy(e,0,0,r)}function my(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function hy(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var gy=Dy(/[A-Za-z]/),_y=Dy(/[\dA-Za-z]/),vy=Dy(/[#-'*+\--9=?A-Z^-~]/);function yy(e){return e!==null&&(e<32||e===127)}var by=Dy(/\d/),xy=Dy(/[\dA-Fa-f]/),Sy=Dy(/[!-/:-@[-`{-~]/);function $(e){return e!==null&&e<-2}function Cy(e){return e!==null&&(e<0||e===32)}function wy(e){return e===-2||e===-1||e===32}var Ty=Dy(/\p{P}|\p{S}/u),Ey=Dy(/\s/);function Dy(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Oy(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&_y(e.charCodeAt(n+1))&&_y(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function ky(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return wy(r)?(e.enter(n),s(r)):t(r)}function s(r){return wy(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function Ay(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&wy(t)?(e.enter(r),c(t)):l(t)}function c(t){return wy(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var jy={tokenize:My};function My(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),ky(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return $(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Ny=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Py(this,e,t,n,!1)}addBefore(e,t,n){Py(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function Py(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var Fy={tokenize:Ly},Iy={tokenize:Ry};function Ly(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new Ny;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Iy,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Iy,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return $(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new Ny;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ry(e,t,n){return ky(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function zy(e){if(e===null||Cy(e)||Ey(e))return 1;if(Ty(e))return 2}function By(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Vy={name:`attention`,resolveAll:Hy,tokenize:Uy};function Hy(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};Wy(o,-a),Wy(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=ly(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=ly(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=ly(r,By(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=ly(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=ly(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),cy(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Uy(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=zy(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=zy(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Wy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Gy={name:`autolink`,tokenize:Ky};function Ky(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return gy(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||_y(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||_y(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||yy(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):vy(t)?(e.consume(t),l):n(t)}function u(e){return _y(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||_y(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var qy={partial:!0,tokenize:Jy};function Jy(e,t,n){return r;function r(t){return wy(t)?ky(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||$(e)?t(e):n(e)}}var Yy={continuation:{tokenize:Zy},exit:Qy,name:`blockQuote`,tokenize:Xy};function Xy(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return wy(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Zy(e,t,n){let r=this;return i;function i(t){return wy(t)?ky(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Yy,t,n)(r)}}function Qy(e){e.exit(`blockQuote`)}var $y={name:`characterEscape`,tokenize:eb};function eb(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Sy(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var tb={name:`characterReference`,tokenize:nb};function nb(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=_y,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=xy,u):(e.enter(`characterReferenceValue`),a=7,o=by,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===_y&&!sy(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var rb={partial:!0,tokenize:ib};function ib(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ab={concrete:!0,name:`codeFenced`,tokenize:ob};function ob(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),wy(t)?ky(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||$(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(rb,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):wy(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),ky(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||$(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&wy(t)?ky(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$(t)?e.check(rb,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||$(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),wy(t)?ky(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),wy(t)?ky(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var sb={name:`codeIndented`,tokenize:lb},cb={partial:!0,tokenize:ub};function lb(e,t,n){return r;function r(t){return e.enter(`codeIndented`),Ay(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):$(t)?e.attempt(cb,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||$(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function ub(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):$(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):Ay(e,t,a,`linePrefix`,4,4)(o)}function a(e){return $(e)?i(e):n(e)}}var db={name:`codeText`,previous:pb,resolve:fb,tokenize:mb};function fb(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function pb(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function mb(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||$(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var hb=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&gb(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),gb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),gb(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);gb(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);gb(this.left,t.reverse())}}}};function gb(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function _b(e){let t={},n=-1,r,i,a,o,s,c,l,u=new hb(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,vb(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return cy(e,0,1/0,u.slice(0)),!l}function vb(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var yb={resolve:xb,tokenize:Sb},bb={partial:!0,tokenize:Cb};function xb(e){return _b(e),e}function Sb(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):$(t)?e.check(bb,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Cb(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ky(e,a,`linePrefix`)}function a(i){if(i===null||$(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function wb(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||yy(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||$(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Cy(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||yy(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Tb(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):$(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||$(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!wy(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Eb(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ky(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||$(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Db(e,t){let n;return r;function r(i){return $(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):wy(i)?ky(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Ob={name:`definition`,tokenize:Ab},kb={partial:!0,tokenize:jb};function Ab(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Tb.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=hy(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Cy(t)?Db(e,l)(t):l(t)}function l(t){return wb(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(kb,d,d)(t)}function d(t){return wy(t)?ky(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||$(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function jb(e,t,n){return r;function r(t){return Cy(t)?Db(e,i)(t):n(t)}function i(t){return Eb(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return wy(t)?ky(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$(e)?t(e):n(e)}}var Mb={name:`hardBreakEscape`,tokenize:Nb};function Nb(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return $(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Pb={name:`headingAtx`,resolve:Fb,tokenize:Ib};function Fb(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};cy(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function Ib(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Cy(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||$(n)?(e.exit(`atxHeading`),t(n)):wy(n)?ky(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Cy(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Lb=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Rb=[`pre`,`script`,`style`,`textarea`],zb={concrete:!0,name:`htmlFlow`,resolveTo:Vb,tokenize:Hb},Bb={partial:!0,tokenize:Ub};function Vb(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Hb(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:F):gy(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):gy(a)?(e.consume(a),i=4,r.interrupt?t:F):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:F):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return gy(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Cy(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Rb.includes(l)?(i=1,r.interrupt?t(s):O(s)):Lb.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||_y(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return wy(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||gy(t)?(e.consume(t),b):wy(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||_y(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):wy(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):wy(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||$(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Cy(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||wy(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||$(t)?O(t):wy(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),ee):t===60&&i===1?(e.consume(t),M):t===62&&i===4?(e.consume(t),I):t===63&&i===3?(e.consume(t),F):t===93&&i===5?(e.consume(t),P):$(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Bb,L,k)(t)):t===null||$(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(rb,A,L)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||$(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function ee(t){return t===45?(e.consume(t),F):O(t)}function M(t){return t===47?(e.consume(t),o=``,N):O(t)}function N(t){if(t===62){let n=o.toLowerCase();return Rb.includes(n)?(e.consume(t),I):O(t)}return gy(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),N):O(t)}function P(t){return t===93?(e.consume(t),F):O(t)}function F(t){return t===62?(e.consume(t),I):t===45&&i===2?(e.consume(t),F):O(t)}function I(t){return t===null||$(t)?(e.exit(`htmlFlowData`),L(t)):(e.consume(t),I)}function L(n){return e.exit(`htmlFlow`),t(n)}}function Ub(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(qy,t,n)}}var Wb={name:`htmlText`,tokenize:Gb};function Gb(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):gy(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):gy(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):$(t)?(o=d,M(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ee(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):$(t)?(o=h,M(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ee(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ee(t):$(t)?(o=v,M(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):$(t)?(o=y,M(t)):(e.consume(t),y)}function b(e){return e===62?ee(e):y(e)}function x(t){return gy(t)?(e.consume(t),S):n(t)}function S(t){return t===45||_y(t)?(e.consume(t),S):C(t)}function C(t){return $(t)?(o=C,M(t)):wy(t)?(e.consume(t),C):ee(t)}function w(t){return t===45||_y(t)?(e.consume(t),w):t===47||t===62||Cy(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ee):t===58||t===95||gy(t)?(e.consume(t),E):$(t)?(o=T,M(t)):wy(t)?(e.consume(t),T):ee(t)}function E(t){return t===45||t===46||t===58||t===95||_y(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$(t)?(o=D,M(t)):wy(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):$(t)?(o=O,M(t)):wy(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):$(t)?(o=k,M(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Cy(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Cy(e)?T(e):n(e)}function ee(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function M(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),N}function N(t){return wy(t)?ky(e,P,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):P(t)}function P(t){return e.enter(`htmlTextData`),o(t)}}var Kb={name:`labelEnd`,resolveAll:Xb,resolveTo:Zb,tokenize:Qb},qb={tokenize:$b},Jb={tokenize:ex},Yb={tokenize:tx};function Xb(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&cy(e,0,e.length,n),e}function Zb(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=ly(o,e.slice(i+1,i+r+3)),o=ly(o,[[`enter`,l,t]]),o=ly(o,By(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=ly(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=ly(o,e.slice(a+1)),o=ly(o,[[`exit`,s,t]]),cy(e,i,e.length,o),e}function Qb(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(hy(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(qb,u,o?u:d)(t):t===91?e.attempt(Jb,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Yb,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function $b(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Cy(t)?Db(e,a)(t):a(t)}function a(t){return t===41?u(t):wb(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Cy(t)?Db(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Eb(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Cy(t)?Db(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function ex(e,t,n){let r=this;return i;function i(t){return Tb.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(hy(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function tx(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var nx={name:`labelStartImage`,resolveAll:Kb.resolveAll,tokenize:rx};function rx(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var ix={name:`labelStartLink`,resolveAll:Kb.resolveAll,tokenize:ax};function ax(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var ox={name:`lineEnding`,tokenize:sx};function sx(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),ky(e,t,`linePrefix`)}}var cx={name:`thematicBreak`,tokenize:lx};function lx(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||$(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),wy(t)?ky(e,s,`whitespace`)(t):s(t))}}var ux={continuation:{tokenize:mx},exit:gx,name:`list`,tokenize:px},dx={partial:!0,tokenize:_x},fx={partial:!0,tokenize:hx};function px(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:by(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(cx,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return by(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(qy,r.interrupt?n:u,e.attempt(dx,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return wy(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function mx(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(qy,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ky(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!wy(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(fx,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,ky(e,e.attempt(ux,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function hx(e,t,n){let r=this;return ky(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function gx(e){e.exit(this.containerState.type)}function _x(e,t,n){let r=this;return ky(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!wy(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var vx={name:`setextUnderline`,resolveTo:yx,tokenize:bx};function yx(e,t){let n=new Ny,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function bx(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),wy(t)?ky(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var xx={tokenize:Sx};function Sx(e){let t=this,n=e.attempt(qy,r,e.attempt(this.parser.constructs.flowInitial,i,ky(e,e.attempt(this.parser.constructs.flow,i,e.attempt(yb,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Cx={resolveAll:Dx()},wx=Ex(`string`),Tx=Ex(`text`);function Ex(e){return{resolveAll:Dx(e===`text`?Ox:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Dx(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Ox(e,t){let n=new Ny,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var kx=s({attentionMarkers:()=>Lx,contentInitial:()=>jx,disable:()=>Rx,document:()=>Ax,flow:()=>Nx,flowInitial:()=>Mx,insideSpan:()=>Ix,string:()=>Px,text:()=>Fx}),Ax={42:ux,43:ux,45:ux,48:ux,49:ux,50:ux,51:ux,52:ux,53:ux,54:ux,55:ux,56:ux,57:ux,62:Yy},jx={91:Ob},Mx={[-2]:sb,[-1]:sb,32:sb},Nx={35:Pb,42:cx,45:[vx,cx],60:zb,61:vx,95:cx,96:ab,126:ab},Px={38:tb,92:$y},Fx={[-5]:ox,[-4]:ox,[-3]:ox,33:nx,38:tb,42:Vy,60:[Gy,Wb],91:ix,92:[Mb,$y],93:Kb,95:Vy,96:db},Ix={null:[Vy,Cx]},Lx={null:[42,95]},Rx={null:[]};function zx(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=ly(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=By(a,l.events,l),l.events):[]}function f(e,t){return Vx(p(e),t)}function p(e){return Bx(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){$(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&cy(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Bx(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Vx(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
54
54
  `;break;case-3:o=`\r
55
55
  `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Hx(e){let t={constructs:dy([kx,...(e||{}).extensions||[]]),content:n(jy),defined:[],document:n(Fy),flow:n(xx),lazy:{},string:n(wx),text:n(Tx)};return t;function n(e){return n;function n(n){return zx(t,e,n)}}}function Ux(e){for(;!_b(e););return e}var Wx=/[\0\t\n\r]/g;function Gx(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){Wx.lastIndex=c;let n=Wx.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Kx=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qx(e){return e.replace(Kx,Jx)}function Jx(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return my(n.slice(t?2:1),t?16:10)}return sy(n)||e}var Yx={}.hasOwnProperty;function Xx(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Zx(n)(Ux(Hx(n).document().write(Gx()(e,t,!0))))}function Zx(e){let t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:o(ge),autolinkProtocol:E,autolinkEmail:E,atxHeading:o(z),blockQuote:o(le),characterEscape:E,characterReference:E,codeFenced:o(ue),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(ue,s),codeText:o(de,s),codeTextData:E,data:E,codeFlowValue:E,definition:o(fe),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(R),hardBreakEscape:o(pe),hardBreakTrailing:o(pe),htmlFlow:o(me,s),htmlFlowData:E,htmlText:o(me,s),htmlTextData:E,image:o(he),label:s,link:o(ge),listItem:o(ve),listItemValue:p,listOrdered:o(_e,f),listUnordered:o(_e),paragraph:o(ye),reference:ne,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(z),strong:o(be),thematicBreak:o(Se)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:ce,autolinkProtocol:se,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:ae,characterReference:oe,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:D,codeIndented:l(v),codeText:l(ee),codeTextData:D,data:D,definition:l(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:D,htmlText:l(j),htmlTextData:D,image:l(N),label:F,labelText:P,lineEnding:O,link:l(M),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:re,resourceDestinationString:I,resourceTitleString:L,resource:te,setextHeading:l(T),setextHeadingLineSequence:w,setextHeadingText:C,strong:l(),thematicBreak:l()}};$x(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[],position:void 0},o={stack:[r],tokenStack:[],config:t,enter:c,exit:u,buffer:s,resume:d,data:n},l=[],f=[],p=-1;for(;++p<e.length;)f.push(e[p]),(e[p][1].type===`listOrdered`||e[p][1].type===`listUnordered`)&&(e[p][0]===`enter`?l.push(f.length-1):a(f,l.pop()));for(e=f,p=-1;++p<e.length;){let n=t[e[p][0]];e[p][0]===`enter`&&t.beforeEnter.length>0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),Yx.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||tS).call(o,void 0,e[0])}for(r.position={start:Qx(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Qx(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p<t.transforms.length;)r=t.transforms[p](r)||r;return r}function i(e,t,n){let r=-1;for(;++r<e.length;)e[r].call(t,n)}function a(e,t){let n=e.length-1,r=t-1,i=-1,a=!1,o,s,c,l,u=[];for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let n=r;for(s=void 0;n--;){let t=e[n];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=n}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),u.push({at:s||r,event:[`exit`,o,t[2]]})}if(t[1].type===`listItemPrefix`){let e={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=e,u.push({at:r,event:[`enter`,e,t[2]]}),c=void 0,l=!0}}}let d=e.splice(t),f=0;for(r=-1;++r<d.length;){for(;f<u.length&&u[f].at===t+r;)e.push(u[f++].event);e.push(d[r])}e[t][1]._spread=a}function o(e,t){return n;function n(n){c.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:`fragment`,children:[]})}function c(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Qx(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),u.call(this,t)}}function u(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw Error("Cannot close `"+e.type+"` ("+bv({start:e.start,end:e.end})+`): it’s not open`);r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||tS).call(this,e,r[0])),n.position.end=Qx(e.end)}function d(){return ny(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function h(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function v(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function y(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=hy(this.sliceSerialize(e)).toLowerCase()}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function x(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function S(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function C(){this.data.setextHeadingSlurpLineEnding=!0}function w(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function E(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=xe(),n.position={start:Qx(e.start),end:void 0},t.push(n)),this.stack.push(n)}function D(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Qx(e.end)}function O(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Qx(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(E.call(this,e),D.call(this,e))}function k(){this.data.atHardBreak=!0}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=qx(t),n.identifier=hy(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function te(){this.data.inReference=void 0}function ne(){this.data.referenceType=`collapsed`}function re(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=hy(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ie(e){this.data.characterReferenceType=e.type}function ae(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=my(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=sy(t);let i=this.stack[this.stack.length-1];i.value+=r}function oe(e){let t=this.stack.pop();t.position.end=Qx(e.end)}function se(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ce(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function le(){return{type:`blockquote`,children:[],position:void 0}}function ue(){return{type:`code`,lang:null,meta:null,value:``,position:void 0}}function de(){return{type:`inlineCode`,value:``,position:void 0}}function fe(){return{type:`definition`,identifier:``,label:null,title:null,url:``,position:void 0}}function R(){return{type:`emphasis`,children:[],position:void 0}}function z(){return{type:`heading`,depth:0,children:[],position:void 0}}function pe(){return{type:`break`,position:void 0}}function me(){return{type:`html`,value:``,position:void 0}}function he(){return{type:`image`,title:null,url:``,alt:null,position:void 0}}function ge(){return{type:`link`,title:null,url:``,children:[],position:void 0}}function _e(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[],position:void 0}}function ve(e){return{type:`listItem`,spread:e._spread,checked:null,children:[],position:void 0}}function ye(){return{type:`paragraph`,children:[],position:void 0}}function be(){return{type:`strong`,children:[],position:void 0}}function xe(){return{type:`text`,value:``,position:void 0}}function Se(){return{type:`thematicBreak`,position:void 0}}}function Qx(e){return{line:e.line,column:e.column,offset:e.offset}}function $x(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?$x(e,r):eS(e,r)}}function eS(e,t){let n;for(n in t)if(Yx.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`afterExit`:case`beforeEnter`:{let r=t[n];r&&e[n].push(r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function tS(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+bv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+bv({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+bv({start:t.start,end:t.end})+`) is still open`)}function nS(e){let t=this;t.parser=n;function n(n){return Xx(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function rS(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function iS(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
@@ -98,7 +98,7 @@ Error generating stack: `+e.message+`
98
98
  `)),d=Math.min(i,r);return(0,U.jsxs)(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-3`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold`,children:i<r?`第 ${i+1}/${r} 步 · ${n[i].question}`:`全部选择完毕,请确认`}),(0,U.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:n.map((e,t)=>(0,U.jsx)(`span`,{className:`h-1.5 w-4 rounded-full transition-colors ${t<d||c?`bg-primary`:t===i?`bg-primary/40`:`bg-muted`}`},t))})]}),o.some(Boolean)&&(0,U.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1`,children:n.map((e,t)=>o[t]&&(0,U.jsxs)(`button`,{onClick:()=>a(t),className:`inline-flex max-w-full items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] transition-colors ${i===t?`border-primary/60 bg-primary/10`:`bg-card hover:border-primary/40`}`,children:[(0,U.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.question}),(0,U.jsx)(`span`,{className:`max-w-32 truncate font-medium`,children:o[t]}),i!==t&&(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`✎`})]},t))}),i<r?(0,U.jsx)(`div`,{className:`space-y-1.5`,children:n[i].options.map((e,t)=>(0,U.jsxs)(`button`,{onClick:()=>l(e.value||e.label),className:`flex w-full items-center gap-2 rounded-md border bg-card px-2.5 py-1.5 text-left text-xs transition-colors hover:border-primary/60 hover:bg-primary/10`,children:[(0,U.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:String.fromCharCode(65+t)}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description&&(0,U.jsx)(`span`,{className:`block text-[10px] text-muted-foreground`,children:e.description})]}),e.recommended&&(0,U.jsx)(J,{className:`bg-success/15 text-[9px] text-success hover:bg-success/25`,children:`推荐`})]},t))}):(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`div`,{className:`rounded-md border bg-card px-2.5 py-2 text-xs leading-relaxed`,children:n.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,U.jsx)(Ap,{className:`h-3 w-3 shrink-0 translate-y-0.5 text-success`}),(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.question,`:`]}),(0,U.jsx)(`span`,{className:`min-w-0 font-medium break-words`,children:o[t]})]},t))}),(0,U.jsxs)(Y,{size:`sm`,className:`w-full text-xs`,disabled:!c,onClick:u,children:[(0,U.jsx)(Ah,{className:`h-3 w-3`}),`确认发送(`,r,` 项选择)`]})]}),(0,U.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[i>0&&(0,U.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-[10px]`,onClick:()=>a(e=>Math.max(0,e-1)),children:[(0,U.jsx)(gp,{className:`h-3 w-3`}),`上一步`]}),i<r&&o[i]&&(0,U.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-[10px]`,onClick:()=>a(e=>Math.min(r,e+1)),children:[`下一步`,(0,U.jsx)(vp,{className:`h-3 w-3`})]}),i<r&&(0,U.jsxs)(`span`,{className:`ml-auto`,children:[`选完 `,r,` 项后统一发送,不会逐项触发对话`]})]})]})}function yD({text:e,onSend:t}){let n=(e||``).split(/```a2ui\s*\n?([\s\S]*?)```/g),r=e=>{try{return JSON.parse(e)?.type===`choice`}catch{return!1}},i=[],a=0;for(;a<n.length;){if(a%2==0){n[a].trim()&&i.push((0,U.jsx)(mD,{text:n[a]},a)),a++;continue}let e=[],o=a;for(;o<n.length&&r(n[o])&&(e.length===0||!n[o-1].trim());)e.push(n[o]),o+=2;e.length>=2?i.push((0,U.jsx)(vD,{blocks:e.map(e=>JSON.parse(e)),onSend:t},a)):i.push((0,U.jsx)(hD,{raw:n[a],onSend:t},a)),a+=e.length>=2?e.length*2-1:1}return(0,U.jsx)(v.Fragment,{children:i})}function bD({className:e,children:t,...n}){return(0,U.jsxs)(du,{"data-slot":`scroll-area`,className:B(`relative`,e),...n,children:[(0,U.jsx)(mu,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,U.jsx)(xD,{}),(0,U.jsx)(Nu,{})]})}function xD({className:e,orientation:t=`vertical`,...n}){return(0,U.jsx)(yu,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:B(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,U.jsx)(Au,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function SD({className:e,...t}){return(0,U.jsx)(`textarea`,{"data-slot":`textarea`,className:B(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40`,e),...t})}var CD=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`,wD=2048,TD=2097152,ED=10;async function DD(e){let t={blob:e,name:e.name};if(/gif|svg/.test(e.type))return t;let n;try{n=await createImageBitmap(e)}catch{return t}let r=Math.min(1,wD/Math.max(n.width,n.height));if(r===1&&e.size<=TD)return n.close(),t;let i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(n.width*r)),i.height=Math.max(1,Math.round(n.height*r)),i.getContext(`2d`)?.drawImage(n,0,0,i.width,i.height),n.close();let a=await new Promise(e=>i.toBlob(e,`image/jpeg`,.9));return a&&a.size<e.size?{blob:a,name:e.name.replace(/\.\w+$/,``)+`.jpg`}:t}function OD({agentId:e,agentName:t,sessionId:n,wsId:r,injectedDevice:i,autonomy:a}){let[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(``),[C,w]=(0,v.useState)(``),T=(0,v.useRef)(null),E=(0,v.useRef)(null),D=(0,v.useRef)(!1);(0,v.useEffect)(()=>{D.current=u},[u]);let O=(0,v.useRef)(!1),k=(0,v.useRef)(!1);(0,v.useEffect)(()=>{let e=!0,t=async()=>{if(D.current||!e)return;let t;try{t=await V(`/api/chat/history?sessionId=${encodeURIComponent(n)}`)}catch{return}if(!e||!t.exists)return;let r=!!(t.running||t.pending);(!O.current||r||k.current)&&(O.current=!0,k.current=r,s([...t.msgs||[],...t.pending?[{kind:`pending`,intro:`(恢复现场)待确认操作:${t.pending.tool}`}]:[]]),p(t.pending||null),h(r?`后台进行中:${t.statusText||(t.pending?`等待人工确认`:``)}`:``))};t();let r=setInterval(t,2500);return()=>{e=!1,clearInterval(r)}},[n]);let A=(0,v.useRef)(!0),j=(0,v.useCallback)(()=>{let e=T.current?.closest(`[data-slot="scroll-area-viewport"]`);e&&(e.scrollTop=e.scrollHeight)},[]);(0,v.useEffect)(()=>{let e=T.current?.closest(`[data-slot="scroll-area-viewport"]`);if(!e)return;let t=()=>{A.current=e.scrollHeight-e.scrollTop-e.clientHeight<80};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,v.useEffect)(()=>{A.current&&j()},[o,m,j]),(0,v.useEffect)(()=>{A.current=!0},[n]);let ee=e=>s(t=>[...t,e]),[M,N]=(0,v.useState)([]),[P,F]=(0,v.useState)(null),[I,L]=(0,v.useState)(!1),te=(0,v.useRef)(0),ne=(0,v.useRef)(null),re=`agentId=${encodeURIComponent(e)}${r?`&ws_id=${encodeURIComponent(r)}`:``}`,ie=e=>`/api/attachments/file?${re}&rel=${encodeURIComponent(e)}`;(0,v.useEffect)(()=>{N(e=>(e.forEach(e=>e.preview&&URL.revokeObjectURL(e.preview)),[]))},[n]);let ae=async e=>{let t=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,n=e.type.startsWith(`image/`),r=e.name&&!/^image\.\w+$/i.test(e.name)?e.name:`粘贴图片-${Le(new Date().toISOString(),`t`).replace(/:/g,``)}.${(e.type.split(`/`)[1]||`png`).replace(`jpeg`,`jpg`)}`,i=n?URL.createObjectURL(e):void 0;N(a=>[...a,{id:t,rel:``,name:r,size:e.size,mime:e.type||`application/octet-stream`,kind:n?`image`:`binary`,status:`uploading`,preview:i}]);try{let i=n?await DD(new File([e],r,{type:e.type})):{blob:e,name:r},a=await fetch(`/api/attachments?${re}`,{method:`POST`,headers:{"Content-Type":i.blob.type||`application/octet-stream`,"X-File-Name":encodeURIComponent(i.name)},body:i.blob}),o=await a.json().catch(()=>({}));if(!a.ok||!o.attachment)throw Error(o.error||`HTTP ${a.status}`);typeof o.vision==`boolean`&&F(o.vision);let s=o.attachment;N(e=>e.map(e=>e.id===t?{...e,...s,status:`ok`}:e))}catch(e){N(e=>e.filter(e=>e.id!==t)),i&&URL.revokeObjectURL(i),Z.error(`附件上传失败:${r}`,{description:String(e.message)})}},oe=e=>{let t=Array.from(e);M.length+t.length>ED?Z.info(`单条消息最多 ${ED} 个附件`):t.forEach(e=>void ae(e))},se=e=>{N(t=>t.filter(t=>t.id!==e.id)),e.preview&&URL.revokeObjectURL(e.preview),e.rel&&fetch(`/api/attachments?${re}&rel=${encodeURIComponent(e.rel)}`,{method:`DELETE`}).catch(()=>{})},ce=e=>{let t=Array.from(e.clipboardData?.files||[]);t.length&&(e.preventDefault(),oe(t))},le=e=>Array.from(e.dataTransfer.types).includes(`Files`),ue=e=>{le(e)&&(e.preventDefault(),te.current++,L(!0))},de=e=>{le(e)&&e.preventDefault()},fe=()=>{--te.current<=0&&(te.current=0,L(!1))},R=e=>{e.preventDefault(),te.current=0,L(!1),e.dataTransfer.files.length&&oe(e.dataTransfer.files)},z=(0,v.useRef)(null),pe=()=>{z.current?.abort(),Oe(`/api/chat/interrupt`,{sessionId:n}).catch(()=>{})},me=async()=>{if(u)Z.info(`对话进行中,请先中断再清空`);else if(window.confirm(`清空当前会话?服务端上下文与待确认操作将被丢弃,从零开始对话。`))try{await Oe(`/api/session/reset`,{scope:`chat`,sessionId:n}),s([]),p(null),h(``),O.current=!1,Z.success(`会话已清空`)}catch(e){Z.error(String(e.message))}},he=e=>{let t=e.type;if(t===`status`)h(String(e.text||``));else if(t===`text_delta`){let t=e.delta;h(``),s(e=>{let n=e[e.length-1];return n?.kind===`bot`?[...e.slice(0,-1),{...n,text:(n.text||``)+t}]:[...e,{kind:`bot`,text:t}]})}else t===`tool_start`?ee({kind:`evt`,evt:{tool:e.tool,args:e.args,result:`…`,status:`start`}}):t===`tool_end`?s(t=>{let n=[...t].reverse().findIndex(t=>t.kind===`evt`&&t.evt?.tool===e.tool&&t.evt?.status===`start`);if(n<0)return[...t,{kind:`evt`,evt:e}];let r=t.length-1-n;return t.map((t,n)=>n===r?{kind:`evt`,evt:e}:t)}):t===`pending`?(p(e.pending),ee({kind:`pending`,intro:e.intro}),h(``)):t===`done`?(h(``),e.reply&&s(t=>{let n=t[t.length-1];return n?.kind===`bot`&&n.text&&e.reply&&n.text.trim()===String(e.reply).trim()?t:[...t,{kind:`bot`,text:String(e.reply)}]})):t===`interrupted`?(h(``),s(e=>{let t=e[e.length-1];return t?.kind===`bot`?[...e.slice(0,-1),{...t,text:(t.text||``)+`
99
99
 
100
100
  (已中断)`}]:[...e,{kind:`bot`,text:`(已中断)`}]})):t===`error`&&(Z.error(String(e.message)),h(``))},ge=async()=>{let e=c.trim(),t=M.filter(e=>e.status===`ok`);!e&&!t.length||u||(M.some(e=>e.status===`uploading`)?Z.info(`附件还在上传,请稍候`):(l(``),N([]),t.forEach(e=>e.preview&&URL.revokeObjectURL(e.preview)),await _e(e,t.map(({rel:e,name:t,size:n,mime:r,kind:i})=>({rel:e,name:t,size:n,mime:r,kind:i})))))},_e=async(t,o=[])=>{if(u)return;d(!0),A.current=!0,ee({kind:`user`,text:t,...o.length?{attachments:o}:{}});let s=new AbortController;z.current=s;try{await je(`/api/chat`,{sessionId:n,agentId:e,message:t,autonomyLevel:a,ws_id:r,context:i?{device:i}:null,attachments:o.map(e=>({rel:e.rel}))},he,s.signal)}catch(e){s.signal.aborted||Z.error(String(e.message))}finally{d(!1),z.current===s&&(z.current=null)}},ve=async e=>{if(!f)return;p(null),d(!0),A.current=!0,s(e=>e.filter(e=>e.kind!==`pending`));let t=new AbortController;z.current=t;try{await je(`/api/chat/confirm`,{sessionId:n,approved:e},he,t.signal)}catch(e){t.signal.aborted||Z.error(String(e.message))}finally{d(!1),z.current===t&&(z.current=null)}};return(0,U.jsxs)(`div`,{className:`relative flex h-full flex-col`,onDragEnter:ue,onDragOver:de,onDragLeave:fe,onDrop:R,children:[I&&(0,U.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-lg border-2 border-dashed border-primary/60 bg-primary/5 text-xs text-primary`,children:[(0,U.jsx)(ch,{className:`mr-1.5 h-4 w-4`}),`释放以添加附件(保存到当前工作区)`]}),(0,U.jsx)(bD,{className:`min-h-0 flex-1 [&>div>div]:block!`,children:(0,U.jsxs)(`div`,{className:`space-y-2.5 p-3`,ref:T,children:[o.length===0&&(0,U.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(Om,{className:`h-5 w-5 opacity-50`}),`试试:「STK-R3 什么情况?帮我处理」 / 粘贴报错截图、拖入日志文件让助手分析`]}),o.map((n,r)=>{if(n.kind===`user`)return(0,U.jsxs)(`div`,{className:`ml-auto max-w-[85%] space-y-1.5 rounded-lg bg-primary/20 px-3 py-1.5 text-xs leading-relaxed break-words`,children:[n.text&&(0,U.jsx)(`div`,{children:n.text}),!!n.attachments?.length&&(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.attachments.map(e=>e.kind===`image`?(0,U.jsx)(`a`,{href:ie(e.rel),target:`_blank`,rel:`noreferrer`,title:`${e.name} · ${CD(e.size)}`,children:(0,U.jsx)(`img`,{src:ie(e.rel),alt:e.name,className:`max-h-28 max-w-[220px] rounded border object-cover`})},e.rel):(0,U.jsxs)(`a`,{href:ie(e.rel),target:`_blank`,rel:`noreferrer`,download:e.name,title:e.rel,className:`flex items-center gap-1 rounded border bg-background/60 px-1.5 py-0.5 text-[11px] hover:bg-background`,children:[(0,U.jsx)(mm,{className:`h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{className:`max-w-[160px] truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:CD(e.size)})]},e.rel))})]},r);if(n.kind===`bot`)return(0,U.jsxs)(`div`,{className:`max-w-[92%] rounded-lg bg-card px-3 py-2 text-xs leading-relaxed break-words`,children:[(0,U.jsxs)(`div`,{className:`agent-h mb-1 flex items-center gap-1 text-[9px]`,style:d_(e),children:[(0,U.jsx)(`span`,{className:`agent-h-bg h-1 w-1 rounded-full`,style:d_(e)}),t||`助手`]}),(0,U.jsx)(yD,{text:n.text||``,onSend:_e}),u&&r===o.length-1&&(0,U.jsx)(`span`,{className:`ml-0.5 inline-block h-3 w-1.5 animate-pulse rounded-sm bg-primary align-middle`})]},r);if(n.kind===`evt`&&n.evt){let e=n.evt.status,t={ok:`✅`,executed:`▶`,blocked:`⛔`,cancelled:`🚫`,rejected:`❌`,start:`⏳`}[e]||`•`;return(0,U.jsxs)(`div`,{className:B(`max-w-[92%] rounded-md border border-dashed px-2.5 py-1.5 text-[11px]`,e===`blocked`?`border-destructive/50 text-destructive`:e===`start`?`border-border text-muted-foreground`:`border-border`),children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`shrink-0`,children:t}),(0,U.jsx)(fg,{className:`h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono font-semibold`,children:n.evt.tool}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:JSON.stringify(n.evt.args)})]}),e!==`start`&&(0,U.jsx)(`pre`,{className:`mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-all text-[10px] leading-relaxed text-muted-foreground`,children:String(n.evt.result).slice(0,700)})]},r)}return n.kind===`pending`?(0,U.jsx)(Gf,{className:`max-w-[92%] border-ai/50 bg-ai/5`,children:(0,U.jsxs)(Jf,{className:`space-y-2 p-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-ai`,children:[(0,U.jsx)(Rh,{className:`h-3.5 w-3.5`}),`人工确认(L2)· 助手请求执行写操作`]}),n.intro&&(0,U.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:(0,U.jsx)(mD,{text:n.intro})}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(Y,{size:`sm`,variant:`destructive`,onClick:()=>ve(!1),children:`取消`}),(0,U.jsx)(Y,{size:`sm`,onClick:()=>ve(!0),children:`确认执行`})]})]})},r):null}),m&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-primary`}),m,m.startsWith(`后台进行中`)&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-5 gap-1 px-1.5 text-[10px] text-destructive hover:text-destructive`,onClick:()=>{h(``),pe()},children:`⏹ 中断`}),(0,U.jsx)(`span`,{ref:E})]})]})}),(0,U.jsxs)(`div`,{className:`border-t`,children:[M.length>0&&(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start gap-1.5 px-2 pt-2`,children:[M.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-card px-1.5 py-1 text-[11px]`,children:[e.kind===`image`&&e.preview?(0,U.jsx)(`img`,{src:e.preview,alt:e.name,className:`h-9 w-9 rounded object-cover`}):(0,U.jsx)(mm,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`max-w-[140px] truncate`,title:e.name,children:e.name}),(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e.status===`uploading`?`上传中…`:CD(e.size)})]}),e.status===`uploading`?(0,U.jsx)(Hm,{className:`h-3 w-3 animate-spin text-muted-foreground`}):(0,U.jsx)(`button`,{type:`button`,className:`rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground`,title:`移除(同时删除工作区中的文件)`,onClick:()=>se(e),children:(0,U.jsx)(mg,{className:`h-3 w-3`})})]},e.id)),P===!1&&M.some(e=>e.kind===`image`)&&(0,U.jsx)(`div`,{className:`w-full text-[10px] text-warning`,children:`当前模型不支持看图:图片仅保存为工作区文件供助手按路径处理(可在 系统设置 · LLM · 视觉能力 调整)`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[(0,U.jsx)(`input`,{ref:ne,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files?.length&&oe(e.target.files),e.target.value=``}}),(0,U.jsx)(Y,{size:`icon`,variant:`outline`,title:`添加附件(保存到当前工作区;也可直接粘贴截图 / 拖入文件)`,disabled:u,onClick:()=>ne.current?.click(),children:(0,U.jsx)(ch,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(SD,{value:c,onChange:e=>l(e.target.value),rows:1,placeholder:`描述问题…(Enter 发送,Shift+Enter 换行;可粘贴截图 / 拖入文件)`,className:`min-h-[38px] resize-none text-xs`,onPaste:ce,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ge())}}),u?(0,U.jsx)(Y,{size:`icon`,variant:`destructive`,title:`中断当前对话`,onClick:pe,children:(0,U.jsx)(Jh,{className:`h-3.5 w-3.5`})}):(0,U.jsx)(Y,{size:`icon`,disabled:!c.trim()&&!M.some(e=>e.status===`ok`),onClick:ge,children:(0,U.jsx)(Ah,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`icon`,variant:`outline`,title:`清空会话(丢弃服务端上下文,从零开始)`,disabled:u,onClick:me,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`shrink-0 text-[11px]`,onClick:()=>{w(``),S(``),b(!0),_(!0),Oe(`/api/experience/draft`,{sessionId:n}).then(e=>{w(e.markdown)}).catch(e=>{Z.error(String(e.message)),_(!1)}).finally(()=>b(!1))},children:`📥 沉淀经验`})]})]}),(0,U.jsx)(gg,{open:g,onOpenChange:_,children:(0,U.jsxs)(yg,{className:`flex max-h-[85vh] max-w-xl flex-col`,children:[(0,U.jsx)(bg,{className:`shrink-0`,children:(0,U.jsx)(Sg,{children:`经验回流 · AI 起草 → 人工审阅 → 写入 ARM`})}),(0,U.jsx)(wg,{value:x,onChange:e=>S(e.target.value),placeholder:`经验标题(留空自动生成)`,className:`shrink-0 text-xs`}),y?(0,U.jsxs)(`div`,{className:`flex min-h-[120px] flex-1 flex-col items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(Hm,{className:`h-4 w-4 animate-spin`}),`AI 正在提炼本次会话经验,请稍候…`]}):(0,U.jsx)(SD,{value:C,onChange:e=>w(e.target.value),className:`min-h-[120px] flex-1 font-mono text-[11px]`}),(0,U.jsxs)(xg,{className:`shrink-0`,children:[(0,U.jsx)(Y,{variant:`outline`,onClick:()=>_(!1),children:`取消`}),(0,U.jsx)(Y,{disabled:y,onClick:async()=>{try{let t=await Oe(`/api/experience/commit`,{agentId:e,name:x.trim()||`MVP经验-${Le(new Date().toISOString())}`,description:`工作台人工审阅沉淀`,content:C});_(!1),Z.success(`已回流 ARM 知识库`,{description:t.result.slice(0,90)})}catch(e){Z.error(String(e.message))}},children:`确认沉淀到 ARM 知识库`})]})]})})]})}var kD=function(e,t,n,r){var i;t[0]=0;for(var a=1;a<t.length;a++){var o=t[a++],s=t[a]?(t[0]|=o?1:2,n[t[a++]]):t[++a];o===3?r[0]=s:o===4?r[1]=Object.assign(r[1]||{},s):o===5?(r[1]=r[1]||{})[t[++a]]=s:o===6?r[1][t[++a]]+=s+``:o?(i=e.apply(s,kD(e,s,n,[``,null])),r.push(i),s[0]?t[0]|=2:(t[a-2]=0,t[a]=i)):r.push(s)}return r},AD=new Map;function jD(e){var t=AD.get(this);return t||(t=new Map,AD.set(this,t)),(t=kD(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,r=1,i=``,a=``,o=[0],s=function(e){r===1&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,``)))?o.push(0,e,i):r===3&&(e||i)?(o.push(3,e,i),r=2):r===2&&i===`...`&&e?o.push(4,e,0):r===2&&i&&!e?o.push(5,0,!0,i):r>=5&&((i||!e&&r===5)&&(o.push(r,0,i,n),r=6),e&&(o.push(r,e,0,n),r=6)),i=``},c=0;c<e.length;c++){c&&(r===1&&s(),s(c));for(var l=0;l<e[c].length;l++)t=e[c][l],r===1?t===`<`?(s(),o=[o],r=3):i+=t:r===4?i===`--`&&t===`>`?(r=1,i=``):i=t+i[0]:a?t===a?a=``:i+=t:t===`"`||t===`'`?a=t:t===`>`?(s(),r=1):r&&(t===`=`?(r=5,n=i,i=``):t===`/`&&(r<5||e[c][l+1]===`>`)?(s(),r===3&&(o=o[0]),r=o,(o=o[0]).push(2,0,r),r=0):t===` `||t===` `||t===`
101
- `||t===`\r`?(s(),r=2):i+=t),r===3&&i===`!--`&&(r=4,o=o[0])}return s(),o}(e)),t),arguments,[])).length>1?t:t[0]}var MD={primary:`text-primary`,success:`text-success`,warning:`text-warning`,destructive:`text-destructive`,muted:`text-muted-foreground`},ND={primary:`border-primary/40 bg-primary/15 text-primary`,success:`border-success/40 bg-success/15 text-success`,warning:`border-warning/40 bg-warning/15 text-warning`,destructive:`border-destructive/40 bg-destructive/15 text-destructive`,muted:`border-border bg-muted text-muted-foreground`},PD={primary:`bg-primary`,success:`bg-success`,warning:`bg-warning`,destructive:`bg-destructive`,muted:`bg-muted-foreground`},FD={primary:`border-l-primary/85 bg-primary/10`,success:`border-l-success/85 bg-success/10`,warning:`border-l-warning/85 bg-warning/10`,destructive:`border-l-destructive/85 bg-destructive/10`,muted:`border-l-border bg-muted/50`};function ID({title:e,actions:t,flush:n,className:r,children:i}){return(0,U.jsxs)(`div`,{className:B(`rounded-lg border bg-card text-xs text-card-foreground`,n?`p-0`:`p-3`,r),children:[(e||t)&&(0,U.jsxs)(`div`,{className:B(`flex items-center justify-between gap-2`,!n&&`mb-2`,n&&`border-b px-3 py-2`),children:[(0,U.jsx)(`div`,{className:`font-semibold`,children:e}),(0,U.jsx)(`div`,{className:`flex items-center gap-1.5`,children:t})]}),i]})}function LD({tone:e=`muted`,className:t,children:n}){return(0,U.jsx)(`span`,{className:B(`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap`,ND[e],t),children:n})}function RD({variant:e=`secondary`,className:t,...n}){return(0,U.jsx)(`button`,{type:`button`,className:B(`inline-flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50`,{primary:`bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`border bg-secondary text-secondary-foreground hover:bg-accent`,danger:`bg-destructive text-white hover:bg-destructive/90`,ghost:`text-foreground hover:bg-accent`}[e],t),...n})}function zD({label:e,value:t,hint:n,tone:r=`primary`,trend:i,className:a}){let o=(0,v.useRef)(t),[s,c]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let e=o.current;if(o.current=t,e===t||e===void 0)return;c(!0);let n=setTimeout(()=>c(!1),800);return()=>clearTimeout(n)},[t]),(0,U.jsxs)(`div`,{className:B(`rounded-lg border bg-card p-2.5`,a),children:[(0,U.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:B(`mt-0.5 truncate text-base font-semibold tabular-nums transition-colors duration-500`,s?`text-foreground`:MD[r]),children:t}),i&&i.length>=2&&(0,U.jsx)(`div`,{className:`mt-1`,children:(0,U.jsx)(BD,{data:i,tone:r,height:20})}),n!=null&&n!==``&&(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:n})]})}function BD({data:e,tone:t=`chart`,height:n=28,className:r}){let i=e.length;if(!i||i<2)return null;let a=Math.min(...e),o=Math.max(...e)-a||1,s=e.map((e,t)=>`${(t/(i-1)*100).toFixed(2)},${(n-2-(e-a)/o*(n-4)).toFixed(2)}`),c=s[i-1].split(`,`),l=t===`chart`?`text-chart-2`:MD[t];return(0,U.jsxs)(`svg`,{viewBox:`0 0 100 ${n}`,height:n,preserveAspectRatio:`none`,className:B(`w-full overflow-visible`,l,r),"aria-hidden":!0,children:[(0,U.jsx)(`polygon`,{points:`0,${n} ${s.join(` `)} 100,${n}`,fill:`currentColor`,opacity:`0.12`}),(0,U.jsx)(`polyline`,{points:s.join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,U.jsx)(`circle`,{cx:c[0],cy:c[1],r:`2`,fill:`currentColor`})]})}function VD({items:e,className:t}){let n=Math.max(...e.map(e=>e.value),1);return(0,U.jsx)(`div`,{className:B(`space-y-1.5`,t),children:e.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`w-20 shrink-0 truncate text-[10px] text-muted-foreground`,children:e.label}),(0,U.jsx)(`div`,{className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded bg-muted`,children:(0,U.jsx)(`div`,{className:B(`h-full rounded transition-[width]`,PD[e.tone||`primary`]),style:{width:`${Math.max(e.value/n*100,e.value>0?3:0)}%`}})}),(0,U.jsx)(`span`,{className:`w-10 shrink-0 text-right font-mono text-[10px] tabular-nums text-muted-foreground`,children:e.value})]},t))})}function HD({items:e,cell:t=12,gap:n=4,className:r}){return(0,U.jsx)(`div`,{className:B(`grid`,r),style:{gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, 1fr))`,gap:n},children:e.map((e,t)=>(0,U.jsx)(`div`,{title:e.title,className:B(`aspect-square rounded-[3px] transition-colors`,PD[e.tone||`muted`])},t))})}function UD({tone:e=`muted`,pulse:t,className:n}){return(0,U.jsx)(`span`,{className:B(`inline-block h-1.5 w-1.5 shrink-0 rounded-full`,PD[e],t&&`animate-pulse`,n)})}function WD({tone:e=`muted`,title:t,detail:n,meta:r,active:i,onClick:a,className:o,children:s}){let c=(0,v.useRef)(!1),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=c.current;if(c.current=!!i,e||!i)return;u(!0);let t=setTimeout(()=>u(!1),900);return()=>clearTimeout(t)},[i]);let d=!!a;return(0,U.jsxs)(`div`,{onClick:a,role:d?`button`:void 0,tabIndex:d?0:void 0,onKeyDown:d?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a?.())}:void 0,className:B(`rounded-md border border-l-2 p-2 text-xs transition-colors`,FD[e],i&&`ring-2 ring-ring/50`,l&&`animate-pulse ring-ring`,d&&`cursor-pointer hover:border-ring/50 focus-visible:outline-none`,o),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(UD,{tone:e,pulse:e===`destructive`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:t}),r!=null&&r!==``&&(0,U.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground`,children:r})]}),n!=null&&n!==``&&(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:n}),s]})}function GD({text:e=`暂无数据`,className:t}){return(0,U.jsxs)(`div`,{className:B(`flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed p-5 text-center`,t),children:[(0,U.jsxs)(`svg`,{viewBox:`0 0 48 48`,className:`h-10 w-10 text-muted-foreground/50`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`24`,cy:`24`,r:`16`,opacity:`0.5`}),(0,U.jsx)(`circle`,{cx:`24`,cy:`24`,r:`9`,opacity:`0.7`}),(0,U.jsx)(`path`,{d:`M24 24 L37 13`}),(0,U.jsx)(`circle`,{cx:`30.5`,cy:`19`,r:`1.6`,fill:`currentColor`,stroke:`none`})]}),(0,U.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e})]})}function KD({rows:e=3,text:t,className:n}){return(0,U.jsxs)(`div`,{className:B(`space-y-2 p-3`,n),role:`status`,"aria-label":typeof t==`string`?t:`加载中`,children:[Array.from({length:e}).map((e,t)=>(0,U.jsx)(`div`,{className:B(`h-3.5 animate-pulse rounded bg-muted`,t%3==2?`w-2/3`:`w-full`)},t)),t!=null&&t!==``&&(0,U.jsx)(`div`,{className:`pt-1 text-center text-[10px] text-muted-foreground`,children:t})]})}function qD({text:e,className:t}){return(0,U.jsx)(`div`,{className:B(`rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-[11px] text-destructive`,t),children:e?(0,U.jsxs)(U.Fragment,{children:[`加载失败:`,e]}):`加载失败`})}var JD={Card:ID,Badge:LD,Button:RD,Stat:zD,Spark:BD,Bars:VD,Matrix:HD,StatusDot:UD,StatusItem:WD,Empty:GD,Loading:KD,Error:qD},YD=jD.bind(v.createElement),XD=class extends v.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message||e)}}componentDidCatch(e){try{this.props.onError?.(String(e?.message||e))}catch{}}render(){return this.state.err?(0,U.jsxs)(`div`,{className:`p-3 text-[11px] leading-relaxed text-destructive`,children:[`面板运行错误:`,this.state.err,(0,U.jsx)(`br`,{}),`可在「定制工作台」中修正代码后重新发布。`]}):this.props.children}};function ZD(e){return Function(`React`,`html`,`ui`,`useState`,`useEffect`,`useRef`,`useMemo`,`"use strict";\n${e}\n;if (typeof Panel !== "function") throw new Error("插件代码必须定义 function Panel(props)");\nreturn Panel;`)(v,YD,JD,v.useState,v.useEffect,v.useRef,v.useMemo)}function QD(e,t,n){if(e)try{fetch(`/api/panel-error`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,kind:t,message:n})}).catch(()=>{})}catch{}}function $D({code:e,data:t,meta:n}){let r=n?.agentId,i=n?.panelId,a=n?.pluginId,o=(0,v.useMemo)(()=>{let t={agentId:r,panelId:i,pluginId:a};try{return ZD(e)}catch(e){return QD(t,`compile`,String(e.message)),()=>(0,U.jsxs)(`div`,{className:`p-3 text-[11px] text-destructive`,children:[`编译失败:`,String(e.message)]})}},[e,r,i,a]);return(0,U.jsx)(XD,{onError:e=>QD(n,`runtime`,e),children:(0,U.jsx)(o,{...t})})}var eO={activity:up,alert:og,gauge:Sm,list:Bm,chart:Op,box:Ep,cpu:Qp,radar:vh,clipboard:Hp,wrench:fg,message:Xm,puzzle:gh,grid:Im},tO={agent_dialog:Xm,custom:gh,custom_panel:gh,placeholder:Ep,kpi_strip:Sm,realtime_list:Bm,status_grid:Im,action_group:fg,inspection_report:Hp};function nO(e){return eO[String(e.icon||``)]||tO[e.type]||up}var rO=12;function iO({dsl:e,renderPanel:t,renderDialog:n,renderPlaceholder:r,edit:i,className:a,onMaximize:o,renderHeaderActions:s}){let c=(0,v.useRef)(null),l=(0,v.useRef)(null),[u,d]=(0,v.useState)(!1),f=(0,v.useRef)(null),p=(0,v.useRef)(null),m=()=>{if(p.current!==null)return;let e=()=>{let t=c.current,n=f.current;if(t&&n){let e=t.getBoundingClientRect();n.x>e.right-48?t.scrollLeft+=16:n.x<e.left+48&&(t.scrollLeft-=16),n.y>e.bottom-48?t.scrollTop+=16:n.y<e.top+48&&(t.scrollTop-=16)}p.current=requestAnimationFrame(e)};p.current=requestAnimationFrame(e)},h=()=>{p.current!==null&&(cancelAnimationFrame(p.current),p.current=null),f.current=null};(0,v.useEffect)(()=>h,[]);let g=e.panels.reduce((e,t)=>Math.max(e,(t.grid?.y||1)+(t.grid?.h||1)-1),1),_=()=>{let e=c.current?.getBoundingClientRect();return{col:e?(e.width+rO)/12:100,row:e?(e.height+rO)/g:178}},y=(t,n,r)=>{if(!i||t.button!==0)return;t.stopPropagation();let a=e.panels[n].grid||{x:1,y:1,w:6,h:1};l.current={i:n,mode:r,sx:t.clientX,sy:t.clientY,g:{...a},moved:!1},m();try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}},b=e=>{let t=l.current;if(!i||!t)return;f.current={x:e.clientX,y:e.clientY};let n=e.clientX-t.sx,r=e.clientY-t.sy;if(!t.moved&&Math.abs(n)<4&&Math.abs(r)<4)return;t.moved||(t.moved=!0,d(!0));let{col:a,row:o}=_(),s=Math.round(n/a),c=Math.round(r/o);t.mode===`move`?i.onGrid(t.i,{x:Math.min(Math.max(1,t.g.x+s),12-t.g.w+1),y:Math.max(1,t.g.y+c)}):i.onGrid(t.i,{w:Math.min(Math.max(1,t.g.w+s),12-t.g.x+1),h:Math.min(Math.max(1,t.g.h+c),12)})},x=()=>{setTimeout(()=>{l.current=null},0),d(!1),h()},S=t=>{let n=e.panels[t].grid;return n?e.panels.some((e,r)=>{if(r===t)return!1;let i=e.grid;return i?n.x<i.x+i.w&&i.x<n.x+n.w&&n.y<i.y+i.h&&i.y<n.y+n.h:!1}):!1};return(0,U.jsxs)(`div`,{ref:c,className:B(`grid gap-3`,i&&`touch-none select-none`,a),style:{gridTemplateColumns:`repeat(12, minmax(0, 1fr))`,gridTemplateRows:`repeat(${g}, minmax(120px, 1fr))`},onPointerDown:()=>{i&&i.onSelect(null)},children:[i&&u&&(0,U.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-20 opacity-30`,style:{backgroundImage:`linear-gradient(to right, var(--border) 1px, transparent 1px), linear-gradient(to bottom, var(--border) 1px, transparent 1px)`,backgroundSize:`calc((100% + ${rO}px) / 12) 100%, 100% calc((100% + ${rO}px) / ${g})`}}),e.panels.map((e,a)=>{let c=e.grid||{x:1,y:1,w:6,h:1},u=Math.round(c.w/12*100),d=nO(e),f=i&&S(a),p=e.title||(e.type===`agent_dialog`?`诊断对话`:``),m=!i&&p&&!e.bare&&e.type!==`placeholder`,h=e.type===`agent_dialog`?n?n(e):null:e.type===`placeholder`?r?r(e):null:t(e);return(0,U.jsxs)(`div`,{style:{gridColumn:`${c.x} / span ${c.w}`,gridRow:`${c.y} / span ${c.h}`,animationDelay:`${Math.min(a*45,360)}ms`},title:f?`与其他面板重叠——拖动错开或调整大小`:void 0,className:B(`group relative flex min-h-0 flex-col overflow-hidden rounded-lg motion-safe:animate-in motion-safe:fade-in-0 motion-safe:zoom-in-95 motion-safe:slide-in-from-bottom-1 motion-safe:fill-mode-both motion-safe:duration-300`,i?i.sel===a?`border border-primary bg-card ring-2 ring-primary/50`:e.bare?`border border-dashed border-border/60 bg-card hover:border-primary/50`:`border border-border bg-card hover:border-primary/50`:e.bare?`border-transparent bg-transparent`:`border border-border bg-card`,f&&`outline-2 outline-dashed outline-warning/80`,i&&`cursor-grab active:cursor-grabbing`),onPointerDown:e=>{i&&(e.stopPropagation(),i.onSelect(a),y(e,a,`move`))},onDoubleClick:()=>{i?.onAICustomize&&!l.current?.moved&&i.onAICustomize(a)},onPointerMove:b,onPointerUp:x,onPointerCancel:x,children:[m&&(0,U.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,U.jsx)(d,{className:`h-3.5 w-3.5 shrink-0 text-primary/80`}),(0,U.jsx)(`span`,{className:`truncate text-xs font-medium`,children:p}),e.subtitle?(0,U.jsx)(`span`,{className:`min-w-0 truncate text-[10px] text-muted-foreground`,children:String(e.subtitle)}):null,(0,U.jsxs)(`div`,{className:`ml-auto flex min-w-0 items-center gap-1.5`,children:[s?.(e),o&&(0,U.jsx)(`button`,{onClick:e=>{e.stopPropagation(),o(a)},className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground/60 opacity-0 transition-all hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100`,title:`全屏查看(ESC 退出)`,children:(0,U.jsx)(Km,{className:`h-3 w-3`})})]})]}),i&&(0,U.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 flex items-center gap-1.5 border-b bg-background/85 px-2 py-1 text-[10px] backdrop-blur-sm`,children:[(0,U.jsx)(d,{className:`h-3 w-3 shrink-0 text-primary/80`}),(0,U.jsx)(`span`,{className:`font-medium`,children:e.title}),f&&(0,U.jsx)(`span`,{className:`shrink-0 text-warning`,title:`与其他面板重叠`,children:`⚠ 重叠`}),(0,U.jsx)(J,{variant:`secondary`,className:`h-4 px-1 text-[9px]`,children:e.panel||e.type}),i.sel===a&&i.onAICustomize&&(0,U.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i.onAICustomize(a)},className:`pointer-events-auto ml-auto flex h-5 shrink-0 items-center gap-1 rounded bg-ai px-1.5 text-[10px] font-medium text-white transition-colors hover:bg-ai/85`,title:`把这个区块锁定为 AI 定制目标(双击面板同效)`,children:[(0,U.jsx)(Wh,{className:`h-2.5 w-2.5`}),`AI 定制`]}),(0,U.jsxs)(`span`,{className:B(`font-mono text-muted-foreground tabular-nums`,i.sel===a&&i.onAICustomize&&`ml-1.5`),children:[u,`%宽·`,c.h,`行`]})]}),(0,U.jsx)(`div`,{className:B(`min-h-0 flex-1 overflow-auto`,i&&`pointer-events-none pt-4`),children:h}),i&&(0,U.jsx)(`span`,{onPointerDown:e=>y(e,a,`resize`),onPointerMove:b,onPointerUp:x,onPointerCancel:x,className:`absolute -bottom-1 -right-1 z-10 flex h-7 w-7 cursor-nwse-resize items-center justify-center rounded-tl-md border-b border-r border-primary/60 bg-primary/25 hover:bg-primary/50`,title:`拖拽调大小(当前 ${u}% 宽 · ${c.h} 行)`,children:(0,U.jsx)(Km,{className:`h-3 w-3 translate-x-[5px] translate-y-[5px] text-primary`})})]},e.id)})]})}function aO(){return(0,U.jsxs)(`div`,{className:`relative mb-0.5 h-3.5 select-none text-[8px] text-muted-foreground`,children:[(0,U.jsx)(`div`,{className:`grid h-full grid-cols-12`,children:[...Array(12)].map((e,t)=>(0,U.jsx)(`div`,{className:`border-l border-border/60 pl-0.5 pt-0.5 font-mono`,children:t+1},t))}),[25,50,75].map(e=>(0,U.jsxs)(`span`,{className:`absolute -top-0 font-mono`,style:{left:`${e}%`},children:[e,`%`]},e))]})}function oO({open:e,onOpenChange:t,onPick:n}){let[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),l=e=>{o(!0),c(``),V(`/api/fs/dirs${e?`?path=${encodeURIComponent(e)}`:``}`).then(e=>i(e)).catch(e=>c(String(e.message))).finally(()=>o(!1))};return(0,v.useEffect)(()=>{e&&!r&&l()},[e]),(0,U.jsx)(gg,{open:e,onOpenChange:t,children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsx)(bg,{children:(0,U.jsx)(Sg,{children:`选择工作区目录`})}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 gap-1 px-2 text-[11px]`,disabled:!r?.parent,onClick:()=>r?.parent&&l(r.parent),title:`上级目录`,children:[(0,U.jsx)(bp,{className:`h-3 w-3`}),`上级`]}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 gap-1 px-2 text-[11px]`,onClick:()=>l(),children:[(0,U.jsx)(Em,{className:`h-3 w-3`}),`主目录`]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate rounded-md border bg-muted/40 px-2 py-1.5 font-mono text-[11px] text-muted-foreground`,title:r?.path,children:r?.path||`…`})]}),(0,U.jsxs)(bD,{className:`h-64 rounded-md border`,children:[a&&(0,U.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(Hm,{className:`h-4 w-4 animate-spin`}),`读取中…`]}),!a&&s&&(0,U.jsx)(`div`,{className:`p-3 text-xs text-destructive`,children:s}),!a&&!s&&r&&r.dirs.length===0&&(0,U.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`此目录下没有子目录——可直接点「选择当前目录」。`}),!a&&!s&&r&&r.dirs.map(e=>(0,U.jsxs)(`button`,{onClick:()=>l(`${r.path}/${e}`),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs hover:bg-accent`,children:[(0,U.jsx)(bm,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate`,children:e})]},e))]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:()=>t(!1),children:`取消`}),(0,U.jsxs)(Y,{className:`gap-1`,disabled:!r||a,onClick:()=>{r&&(n(r.path),t(!1))},children:[(0,U.jsx)(Ap,{className:`h-3.5 w-3.5`}),`选择当前目录`]})]})]})})}var sO={read_panel_plugin:`读取插件代码`,write_panel_plugin:`编写面板插件`,update_workbench:`点亮画布布局`,create_collection:`创建数据集`,exec:`探索与验证`,data_query:`查询数据`,data_write:`写入数据`,search_knowledge:`检索知识经验`,save_experience:`沉淀经验`},cO=e=>sO[e]||e;function lO({steps:e,status:t,lit:n,inline:r,onClose:i}){return!e.length&&!n?null:(0,U.jsxs)(`div`,{className:B(`rounded-xl border bg-background/92 p-3 shadow-xl backdrop-blur-md`,r?`relative w-full`:`pointer-events-auto absolute bottom-3 left-1/2 z-30 w-72 -translate-x-1/2`,`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-2 motion-safe:duration-300`,n?`border-success/50 shadow-success/10`:`border-border shadow-ai/10`),children:[(0,U.jsxs)(`div`,{className:B(`mb-1.5 flex items-center gap-1.5 text-xs font-semibold`,n?`text-success`:`text-ai`),children:[n?(0,U.jsx)(Wh,{className:`h-3.5 w-3.5 shrink-0`}):(0,U.jsx)(Hm,{className:`h-3.5 w-3.5 shrink-0 animate-spin`}),(0,U.jsx)(`span`,{className:`truncate`,children:n?`画布已点亮——审阅后发布生效`:`定制进行中…`}),i&&(0,U.jsx)(`button`,{onClick:i,className:`ml-auto shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground`,title:`收起`,children:`×`})]}),(0,U.jsx)(`div`,{className:`space-y-1`,children:e.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[e.state===`done`?(0,U.jsx)(Ap,{className:`h-3 w-3 shrink-0 text-success`}):(0,U.jsx)(Hm,{className:`h-3 w-3 shrink-0 animate-spin text-ai`}),(0,U.jsx)(`span`,{className:B(`truncate`,e.state===`done`?`text-muted-foreground`:`text-foreground`),children:e.label})]},t))}),t&&!n&&(0,U.jsx)(`div`,{className:`mt-1.5 truncate border-t pt-1.5 text-[10px] text-muted-foreground`,children:t})]})}function uO({agentId:e,open:t,onClose:n,onPreview:r,onPublished:i}){let a=(0,v.useRef)(`dev-${e.slice(0,8)}`),o=(0,v.useRef)(null),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)({steps:[]}),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),w=(0,v.useRef)(null),T=(0,v.useRef)(!0);(0,v.useEffect)(()=>{T.current&&w.current&&(w.current.scrollTop=w.current.scrollHeight)}),(0,v.useEffect)(()=>{if(d||_||!h.steps.length)return;let e=setTimeout(()=>g({steps:[]}),2500);return()=>clearTimeout(e)},[d,_,h]),(0,v.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&!d&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,d,n]);let E=(0,v.useCallback)(async()=>{let t=l.trim();if(!t||d)return;u(``),f(!0),y(!1),x(null),g({steps:[]}),T.current=!0,c(e=>[...e,{role:`user`,text:t}]);let n=!1,r=!1,i=new AbortController;o.current=i;try{await je(`/api/dev/chat`,{sessionId:a.current,agentId:e,message:t},t=>{let i=t.type;i===`status`?m(String(t.text||``)):i===`text_delta`?(r=!0,m(``),c(e=>{let n=e[e.length-1];return n?.role===`agent`?[...e.slice(0,-1),{role:`agent`,text:n.text+String(t.delta)}]:[...e,{role:`agent`,text:String(t.delta)}]})):i===`tool_start`?(n=!0,g(e=>({steps:[...e.steps,{label:cO(String(t.tool)),state:`active`}]}))):i===`tool_end`?g(e=>{let n=[...e.steps],r=cO(String(t.tool));for(let e=n.length-1;e>=0;e--)if(n[e].label===r&&n[e].state===`active`){n[e]={...n[e],state:`done`};break}return{steps:n}}):i===`done`?!r&&!n&&c(e=>[...e,{role:`agent`,text:`(模型返回了空回复——请重试)`}]):i===`interrupted`?c(e=>[...e,{role:`agent`,text:`(已中断)`}]):i===`meta`?t.hasDraft&&(y(!0),V(`/api/workbench?agent_id=${e}&draft=1`).then(e=>x(e.dsl)).catch(()=>{})):i===`error`&&Z.error(String(t.message))},i.signal)}catch(e){i.signal.aborted?c(e=>[...e,{role:`agent`,text:`(已中断)`}]):c(t=>[...t,{role:`agent`,text:`❌ ${String(e.message)}`}])}finally{m(``),f(!1),o.current===i&&(o.current=null)}},[l,d,e]),D=async t=>{if(t===`preview`&&b)r(b),n();else{C(t);try{if(t===`publish`){let t=await ke(`/api/workbench`,{agent_id:e,dsl:b||(await V(`/api/workbench?agent_id=${e}&draft=1`)).dsl});Z.success(`已发布 ${t.dsl.version},工位即时生效 ✨`),i(t.dsl),x(null),y(!1),g({steps:[]}),n()}else t===`discard`&&(await Ae(`/api/workbench/draft`,{agent_id:e}),Z.info(`已放弃草稿`),x(null),y(!1))}catch(e){Z.error(String(e.message))}finally{C(null)}}};return t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/30 backdrop-blur-[1px]`,onClick:()=>{d||n()}}),(0,U.jsxs)(`div`,{className:`fixed inset-y-0 right-0 z-50 flex w-[400px] max-w-[92vw] flex-col border-l bg-background shadow-2xl motion-safe:animate-in motion-safe:slide-in-from-right-4 motion-safe:duration-300`,children:[(0,U.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2 border-b px-4`,children:[(0,U.jsx)(Wh,{className:`h-4 w-4 text-ai`}),(0,U.jsx)(`span`,{className:`text-sm font-semibold`,children:`AI 定制工位`}),(0,U.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`说需求 → 看着界面长出来`}),(0,U.jsx)(`button`,{onClick:n,disabled:d,className:`ml-auto rounded p-1 text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40`,title:d?`定制进行中,先停止再关闭`:`关闭(ESC)`,children:`✕`})]}),(0,U.jsxs)(`div`,{ref:w,className:`min-h-0 flex-1 space-y-2.5 overflow-y-auto p-3`,children:[s.length===0&&(0,U.jsxs)(`div`,{className:`rounded-lg border border-dashed border-ai/30 bg-ai/5 p-3 text-[11px] leading-relaxed text-muted-foreground`,children:[`直接说,比如:`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`「右上加一个最近记录」`}),`「把列表换成状态点阵」「加一个统计图」。改动先进草稿,你确认才发布。`]}),s.map((e,t)=>(0,U.jsx)(`div`,{className:e.role===`user`?`ml-auto max-w-[88%] rounded-lg bg-primary/20 px-2.5 py-1.5 text-xs whitespace-pre-wrap break-words`:`max-w-full rounded-lg bg-card px-2.5 py-1.5 text-xs leading-relaxed whitespace-pre-wrap break-words`,children:e.text},t)),(d||p)&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-primary`}),p||`开发中…`]}),(0,U.jsx)(lO,{inline:!0,steps:h.steps,status:p,lit:_,onClose:()=>{g({steps:[]}),y(!1)}}),_&&b&&(0,U.jsxs)(`div`,{className:`rounded-lg border border-success/40 bg-success/10 p-2.5`,children:[(0,U.jsxs)(`div`,{className:`text-[11px] font-semibold text-success`,children:[`✨ 草稿已生成(`,b.panels.length,` 个面板)`]}),(0,U.jsxs)(`div`,{className:`mt-1.5 flex gap-1.5`,children:[(0,U.jsx)(Y,{size:`sm`,className:`h-7 gap-1 text-[11px]`,disabled:S!==null,onClick:()=>D(`preview`),children:S===`preview`?`打开中…`:`在工位上预览`}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-7 text-[11px]`,disabled:S!==null,onClick:()=>D(`publish`),children:S===`publish`?`发布中…`:`直接发布`}),(0,U.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 gap-1 text-[11px] text-muted-foreground`,disabled:S!==null,onClick:()=>D(`discard`),children:[(0,U.jsx)(ng,{className:`h-3 w-3`}),`放弃`]})]})]})]}),(0,U.jsxs)(`div`,{className:`shrink-0 border-t p-2`,children:[(0,U.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),rows:2,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),E())},placeholder:`描述想要的界面…(Enter 发送,Shift+Enter 换行)`,className:`min-h-[52px] w-full resize-none rounded-md border bg-background px-2 py-1.5 text-xs`}),(0,U.jsxs)(`div`,{className:`mt-1 flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`与「定制工作台」共享会话上下文`}),d?(0,U.jsxs)(Y,{size:`sm`,variant:`destructive`,className:`h-7 gap-1 text-xs`,onClick:()=>o.current?.abort(),children:[(0,U.jsx)(Jh,{className:`h-3 w-3`}),`停止`]}):(0,U.jsxs)(Y,{size:`sm`,className:`h-7 gap-1 text-xs`,disabled:!l.trim(),onClick:E,children:[(0,U.jsx)(Ah,{className:`h-3 w-3`}),`发送`]})]})]})]})]}):null}function dO(e=1023){let[t,n]=(0,v.useState)(()=>{try{return window.matchMedia(`(max-width: ${e}px)`).matches}catch{return!1}});return(0,v.useEffect)(()=>{let t=window.matchMedia(`(max-width: ${e}px)`),r=()=>n(t.matches);return t.addEventListener?.(`change`,r),window.addEventListener(`resize`,r),()=>{t.removeEventListener?.(`change`,r),window.removeEventListener(`resize`,r)}},[e]),t}function fO({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,U.jsx)(of,{"data-slot":`separator`,decorative:n,orientation:t,className:B(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}function pO({className:e,orientation:t=`horizontal`,...n}){return(0,U.jsx)(Pf,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:B(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var mO=He(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function hO({className:e,variant:t=`default`,...n}){return(0,U.jsx)(If,{"data-slot":`tabs-list`,"data-variant":t,className:B(mO({variant:t}),e),...n})}function gO({className:e,...t}){return(0,U.jsx)(Rf,{"data-slot":`tabs-trigger`,className:B(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function _O({className:e,...t}){return(0,U.jsx)(Bf,{"data-slot":`tabs-content`,className:B(`flex-1 outline-none`,e),...t})}async function vO(e,t){let n=e.usage.length?`插件「${e.name}」被 ${e.usage.length} 处引用,删除将从这些工作台摘除该面板。确认删除?`:`删除插件「${e.name}」?`;if(window.confirm(n))try{await Ae(`/api/panels`,{id:e.id,force:!0}),Z.success(`已删除`),t()}catch(e){Z.error(String(e.message))}}function yO({target:e,onClose:t,agents:n}){let[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(!0),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!e){i(null);return}let n=e.type===`panel`?`id=${encodeURIComponent(e.id||``)}`:`agentId=${encodeURIComponent(e.agentId||``)}`;V(`/api/assets/preview?type=${e.type}&${n}`).then(e=>{i(e),o(e.name)}).catch(e=>{Z.error(String(e.message)),t()})},[e]);let d=async()=>{if(e){u(!0);try{let n=await Oe(`/api/assets/share`,{type:e.type,id:e.id,agentId:e.agentId,name:a,bind_agent:s&&e.agentId?e.agentId:void 0}),i=r?.manifest.requires.apis.length||0,o=r?.manifest.requires.actions.length||0;n.bind_error?Z.warning(`已发布 ${n.name}@${n.version},但绑定助手失败`,{description:`${n.bind_error}——仅助手创建者或管理员可绑定 UI 资产,可在 ARM 助手详情页手动绑定`}):Z.success(`已发布 ${n.name}@${n.version}${n.bound?`,已绑定到助手`:``}`,{description:`外部 API ×${i} · 交互脚本 ×${o}${o?`(命令全文已在 ARM 资产包 SKILL.md 留档)`:``}`}),t()}catch(e){Z.error(String(e.message))}finally{u(!1)}}};if(!e)return null;let f=r?.manifest.requires;return(0,U.jsx)(gg,{open:!!e,onOpenChange:e=>{!e&&!l&&t()},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Jp,{className:`h-4 w-4 text-primary`}),`发布为 UI 资产 · `,e.title]})}),(0,U.jsx)(bD,{className:`max-h-96`,children:(0,U.jsxs)(`div`,{className:`space-y-3 pr-2 text-xs`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`资产名(全局唯一锚,同名发布追加新版本)`}),(0,U.jsx)(wg,{value:a,onChange:e=>o(e.target.value),className:`font-mono text-xs`})]}),r&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-2.5`,children:[(0,U.jsx)(`div`,{className:`font-medium`,children:`包含内容`}),(0,U.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`面板插件:`,r.manifest.provides.panels.join(`、`)||`无`,(0,U.jsx)(`br`,{}),`数据集 schema:`,r.manifest.provides.collections.join(`、`)||`无`,`(仅建表定义,不含数据)`,r.manifest.provides.workbench&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`br`,{}),`工作台 DSL:workbench.json`]})]}),(0,U.jsx)(`div`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:r.files.join(` · `)})]}),!!f?.apis.length&&(0,U.jsxs)(`div`,{className:`rounded-md border border-blue-500/30 bg-blue-500/5 p-2.5`,children:[(0,U.jsx)(`div`,{className:`font-medium text-blue-300`,children:`外部 API 依赖(安装后环境需可达)`}),(0,U.jsx)(`ul`,{className:`mt-1 list-disc pl-4 text-muted-foreground`,children:f.apis.map(e=>(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`span`,{className:`font-mono`,children:e.host}),`:`,e.usage]},e.host))})]}),!!f?.actions.length&&(0,U.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:[(0,U.jsx)(`div`,{className:`font-medium text-warning`,children:`交互脚本(真实 shell 命令,随包公开)`}),(0,U.jsx)(`ul`,{className:`mt-1 space-y-1`,children:f.actions.map(e=>(0,U.jsxs)(`li`,{className:`text-muted-foreground`,children:[`[`,e.panel,`/`,e.id,`] `,e.label,e.has_credentials&&(0,U.jsx)(J,{className:`ml-1 h-4 bg-warning/15 px-1 text-[9px] text-warning`,children:`⚠️ 疑似含凭据`}),(0,U.jsx)(`div`,{className:`mt-0.5 break-all rounded bg-muted/50 p-1 font-mono text-[10px]`,children:e.exec})]},`${e.panel}/${e.id}`))}),(0,U.jsx)(`p`,{className:`mt-1.5 text-[10px] text-warning`,children:`命令明文将进入资产包——含密码/令牌的命令请先改用环境变量或凭据占位,再发布。`})]}),e.agentId&&n&&n.length>0&&(0,U.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border p-2.5`,children:[(0,U.jsx)(hg,{checked:s,onCheckedChange:e=>c(!!e)}),(0,U.jsx)(`span`,{children:`发布后同时绑定到当前助手(下载该助手的其他现场将自动物化此工作台)`})]})]})]})}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:l,onClick:t,children:`取消`}),(0,U.jsx)(Y,{disabled:l||!a,onClick:d,children:l?`发布中…`:`发布到 ARM`})]})]})})}function bO({open:e,onClose:t,onInstalled:n,agents:r}){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(``),m=(0,v.useRef)(0);(0,v.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{let e=++m.current;l(!0),V(`/api/assets/arm-library${i?`?keyword=${encodeURIComponent(i)}`:``}`).then(t=>{e===m.current&&s(t.items||[])}).catch(e=>Z.error(String(e.message))).finally(()=>{e===m.current&&l(!1)})},400);return()=>clearTimeout(t)},[i,e]),(0,v.useEffect)(()=>{e&&!f&&r.length&&p(r[0].agent_id)},[e,r]);let h=async e=>{if(e.asset_type===`workbench`&&!f)Z.warning(`请先选择目标助手`);else{d(e.name);try{let r=await Oe(`/api/assets/install`,{name:e.name,agentId:e.asset_type===`workbench`?f:void 0}),i=r.workbench?`,工作台已导入为草稿(审阅后在「定制工作台」发布)`:``,a=r.skipped_collections.length?`;同名数据集保留本地:${r.skipped_collections.join(`、`)}`:``;Z.success(`已安装 ${e.name}:面板 ×${r.panels.length}${i}${a}`),n(),t()}catch(e){Z.error(String(e.message))}finally{d(null)}}};return(0,U.jsx)(gg,{open:e,onOpenChange:e=>{!e&&!u&&t()},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Im,{className:`h-4 w-4 text-primary`}),`从 ARM 安装 UI 资产`]})}),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(Oh,{className:`absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground`}),(0,U.jsx)(wg,{placeholder:`搜索资产名 / 描述…`,value:i,onChange:e=>a(e.target.value),className:`pl-9`,autoFocus:!0})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`shrink-0`,children:`工作台资产安装到:`}),(0,U.jsx)(`select`,{value:f,onChange:e=>p(e.target.value),className:`h-8 flex-1 rounded-md border bg-background px-2 text-xs`,children:r.map(e=>(0,U.jsx)(`option`,{value:e.agent_id,children:e.name},e.agent_id))})]}),(0,U.jsx)(bD,{className:`max-h-80`,children:(0,U.jsxs)(`div`,{className:`space-y-1.5 pr-2`,children:[c&&!o.length&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`加载中…`}),!c&&!o.length&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:i?`没有匹配资产`:`ARM 上暂无 UI 资产`}),o.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md border p-2.5`,children:[e.asset_type===`workbench`?(0,U.jsx)(Im,{className:`h-4 w-4 shrink-0 text-violet-400`}):(0,U.jsx)(gh,{className:`h-4 w-4 shrink-0 text-primary`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium`,children:[(0,U.jsx)(`span`,{className:`truncate font-mono`,children:e.name}),e.latest_version&&(0,U.jsx)(J,{variant:`secondary`,className:`h-4 px-1 text-[9px]`,children:e.latest_version}),e.installed&&(0,U.jsx)(J,{className:`h-4 bg-success/15 px-1 text-[9px] text-success`,children:`本地已有`}),e.upgrade_available&&(0,U.jsx)(J,{className:`h-4 bg-warning/15 px-1 text-[9px] text-warning`,children:`⤴ 可升级`})]}),(0,U.jsxs)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:[e.description||`—`,` · 下载 `,e.download_count,` 次 · `,e.publisher]})]}),(0,U.jsx)(Y,{size:`sm`,variant:`secondary`,className:`h-7 text-[11px]`,disabled:u!==null,onClick:()=>h(e),children:u===e.name?`安装中…`:`安装`})]},e.name))]})}),(0,U.jsx)(xg,{children:(0,U.jsx)(Y,{variant:`outline`,onClick:t,children:`关闭`})})]})})}function xO(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(`library`),[c,l]=(0,v.useState)([]),u=()=>V(`/api/plugins/center`).then(t);if((0,v.useEffect)(()=>{u(),V(`/api/agents`).then(e=>l((e.agents||[]).filter(e=>e.installed).map(({agent_id:e,name:t})=>({agent_id:e,name:t})))).catch(()=>{})},[]),!e)return(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`插件中心加载中…`});let d=async(e,t,n)=>{let r=n===`deprecated`?`active`:`deprecated`;try{await Oe(`/api/plugins/lifecycle`,{kind:e,id:t,status:r}),Z.success(r===`deprecated`?`已停用(存量引用仍可渲染,新增被阻止)`:`已恢复`),u()}catch(e){Z.error(String(e.message))}},f=({icon:e,name:t,sub:n,status:r,usage:i,onToggle:a,tag:o,onDelete:s,onShare:c,armRef:l})=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md border p-2.5`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium`,children:[e,t,(0,U.jsx)(J,{variant:`secondary`,className:`h-4 px-1 text-[9px]`,children:o}),(0,U.jsx)(J,{className:`h-4 px-1 text-[9px] ${r===`deprecated`?`bg-destructive/15 text-destructive hover:bg-destructive/25`:`bg-success/15 text-success hover:bg-success/25`}`,children:r===`deprecated`?`已停用`:`在用`}),l&&(0,U.jsxs)(J,{className:`h-4 bg-violet-500/15 px-1 text-[9px] text-violet-300`,title:`ARM ${l.skill_name}@${l.version||``}`,children:[`已发布`,l.version?` ${l.version}`:``]})]}),(0,U.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:n}),(0,U.jsxs)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:[`引用:`,i.length?i.map(e=>`${e.agent}${e.draft?`*`:``}`).join(`、`):`无`]})]}),c&&(0,U.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 text-[11px] text-violet-400`,onClick:c,title:`发布到 ARM UI 资产市场`,children:[(0,U.jsx)(Jp,{className:`h-3 w-3`}),l?`更新`:`发布`]}),s&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 text-[11px] text-destructive`,onClick:s,children:`删除`}),(0,U.jsx)(Y,{size:`sm`,variant:r===`deprecated`?`secondary`:`ghost`,className:`h-7 text-[11px] ${r===`deprecated`?``:`text-destructive`}`,onClick:a,children:r===`deprecated`?`恢复`:`停用`})]});return(0,U.jsxs)(`div`,{className:`h-full overflow-auto p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-bold`,children:[(0,U.jsx)(gh,{className:`h-5 w-5 text-primary`}),`插件中心`]}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[`统一注册表:系统面板与契约插件同源治理 · 生命周期(在用/停用)· 引用追踪(* 为草稿引用)· `,(0,U.jsx)(`span`,{className:`text-violet-400`,children:`发布/安装 ARM UI 资产(三资产模型)`})]})]}),(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(pO,{value:o,onValueChange:e=>s(e),children:(0,U.jsxs)(hO,{className:`h-7 p-0.5`,children:[(0,U.jsxs)(gO,{value:`library`,className:`h-6 gap-1 px-3 text-[11px]`,title:`AI 开发 / ARM 安装 / 人工沉淀`,children:[(0,U.jsx)(wp,{className:`h-3 w-3`}),`插件库`,(0,U.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:e.library.length})]}),(0,U.jsxs)(gO,{value:`system`,className:`h-6 gap-1 px-3 text-[11px]`,title:`平台预装`,children:[(0,U.jsx)(um,{className:`h-3 w-3`}),`系统插件`,(0,U.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:e.system.length})]})]})}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 gap-1 text-[11px]`,onClick:()=>a(!0),children:[(0,U.jsx)(Im,{className:`h-3 w-3`}),`从 ARM 安装`]})]})}),(0,U.jsx)(Jf,{className:`p-3`,children:(0,U.jsx)(`div`,{className:`space-y-1.5`,children:o===`library`?(0,U.jsxs)(U.Fragment,{children:[e.library.map(e=>(0,U.jsx)(f,{icon:(0,U.jsx)(gh,{className:`h-3 w-3 text-primary`}),name:`${e.name} ${e.version}`,sub:`${e.author===`ai`?`AI 开发`:e.author===`arm`?`ARM 安装`:`人工`} · ${e.description||e.id}`,status:e.status,usage:e.usage,tag:e.author===`ai`?`ai`:e.author===`arm`?`arm`:`human`,onToggle:()=>d(`plugin`,e.id,e.status),onDelete:()=>vO(e,u),onShare:()=>r({type:`panel`,id:e.id,title:e.name}),armRef:e.arm_ref},e.id)),e.library.length===0&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`插件库为空`})]}):(0,U.jsxs)(U.Fragment,{children:[e.system.map(e=>(0,U.jsx)(f,{icon:(0,U.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.id}),name:e.name,sub:e.note,status:e.status,usage:e.usage,tag:`system`,onToggle:()=>d(`system`,e.id,e.status)},e.id)),e.system.length===0&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`暂无系统插件`})]})})})]}),(0,U.jsx)(fO,{className:`my-4`}),(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsxs)(qf,{className:`flex items-center gap-1.5 text-xs`,children:[(0,U.jsx)(Bh,{className:`h-3.5 w-3.5`}),`治理策略`]})}),(0,U.jsx)(Jf,{className:`p-3 text-[11px] leading-relaxed text-muted-foreground`,children:(0,U.jsx)(bD,{className:`max-h-40`,children:(0,U.jsxs)(`ul`,{className:`list-disc space-y-1 pl-4`,children:[(0,U.jsx)(`li`,{children:`一切面板进同一注册表:系统插件也有 manifest 与生命周期,不再是编译进前端的二等公民`}),(0,U.jsx)(`li`,{children:`停用(deprecate)不破坏存量:已引用的工作台继续渲染,但编辑器「添加面板」不再出现——安全下线`}),(0,U.jsx)(`li`,{children:`入库强制过校验器(check-panel.mjs):编译/契约/沙箱/模板四关 + 质量警告入审计——ARM 安装的插件同样过检`}),(0,U.jsx)(`li`,{children:`出网最小化:/api/proxy 仅放行插件代码中声明过的主机(防止面板成为任意内网跳板)`}),(0,U.jsx)(`li`,{children:`版本化与回滚:插件独立版本(同 id 覆盖自增),工作台按 id 引用,升级即时生效可回滚`}),(0,U.jsx)(`li`,{children:`数据隔离:插件数据集按助手分库(store-助手ID.db),共享需显式 scope=shared;资产包只带 schema 不带数据`}),(0,U.jsx)(`li`,{children:`UI 资产四红线(docs/08):包非运行时 · 数据必走 collection · 外部依赖必声明 · 单向 DAG`})]})})})]}),(0,U.jsx)(yO,{target:n,onClose:()=>{r(null),u()},agents:c}),(0,U.jsx)(bO,{open:i,onClose:()=>a(!1),onInstalled:u,agents:c})]})}function SO({agentId:e,onName:t,onEdit:n}){let[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(2),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(null),[ee,M]=(0,v.useState)(null),[N,P]=(0,v.useState)(!1),[F,I]=(0,v.useState)(null),[L,te]=(0,v.useState)(()=>{try{return+(localStorage.getItem(`aims.view.${e}`)||0)||0}catch{return 0}}),[ne,re]=(0,v.useState)(0),[ie,ae]=(0,v.useState)(null),oe=dO();(0,v.useEffect)(()=>{if(A===null)return;let e=e=>{e.key===`Escape`&&j(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[A]);let se=(0,v.useMemo)(()=>p?.workspaces.find(e=>e.id===p.current)||null,[p]),ce=se?.id||`default`,le=(0,v.useMemo)(()=>`chat-${e}-${ce}`,[e,ce]),ue=()=>V(`/api/state`).then(o).catch(()=>{}),de=()=>V(`/api/workspaces?agent_id=${e}`).then(m).catch(()=>{});(0,v.useEffect)(()=>{V(`/api/workbench?agent_id=${e}`).then(e=>{i(e.dsl),e.dsl&&t(e.dsl.workbench)}),V(`/api/deployment?agent_id=${e}`).then(e=>{f({L0:0,L1:1,L2:2,L3:3}[e.deployment?.default_autonomy||`L2`]??2)}),V(`/api/panels?with_code=1`).then(e=>c(e.plugins||[])),V(`/api/dev/inspirations?agent_id=${e}`).catch(()=>{}),de(),ue();let n=setInterval(ue,5e3);return()=>clearInterval(n)},[e]);let fe=async()=>{try{let t=await ke(`/api/workbench`,{agent_id:e,dsl:F});Z.success(`已发布 ${t.dsl.version},工位即时生效 ✨`),I(null),i(t.dsl)}catch(e){Z.error(String(e.message))}},R=async()=>{try{await Ae(`/api/workbench/draft`,{agent_id:e}),Z.info(`已放弃草稿`),I(null)}catch(e){Z.error(String(e.message))}};(0,v.useEffect)(()=>{ae(document.querySelector(`[data-slot="app-header-right"]`))},[]),(0,v.useEffect)(()=>{F&&V(`/api/panels?with_code=1`).then(e=>c(e.plugins||[])).catch(()=>{})},[F]);let z=async t=>{try{m(await Oe(`/api/workspaces/select`,{agent_id:e,ws_id:t}))}catch(e){Z.error(String(e.message))}},pe=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Pm,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(Eg,{value:ce,onValueChange:z,children:[(0,U.jsx)(Og,{className:`h-7 w-32 text-xs md:w-40`,title:se?.path,children:(0,U.jsx)(Dg,{children:(0,U.jsx)(`span`,{className:`truncate`,children:se?`${se.name}${se.external?`(外部)`:``}`:`默认工作区`})})}),(0,U.jsx)(kg,{children:(p?.workspaces||[]).map(e=>(0,U.jsx)(Ag,{value:e.id,className:`text-xs`,children:(0,U.jsxs)(`span`,{className:`max-w-64 truncate`,title:e.path,children:[e.name,e.external?` · 外部目录`:``,e.id===p?.current?` ✓`:``]})},e.id))})]}),se&&se.id!=="default"&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 shrink-0 p-0 text-muted-foreground`,onClick:()=>D(se),title:`删除当前工作区`,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 shrink-0 p-0 text-muted-foreground`,onClick:()=>g(!0),title:`新建工作区(默认目录或自定义路径)`,children:(0,U.jsx)(vm,{className:`h-3.5 w-3.5`})}),(0,U.jsxs)(Y,{size:`sm`,className:`h-7 gap-1 bg-ai text-white hover:bg-ai/90`,title:`说一句话,看着界面长出来(先进草稿,确认才发布)`,onClick:()=>P(!0),children:[(0,U.jsx)(Wh,{className:`h-3.5 w-3.5`}),`AI 定制`]}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`hidden h-7 gap-1 text-xs md:inline-flex`,title:`把当前工作台打包为 ARM UI 资产,别人下载即得同款工位`,onClick:()=>M({type:`workbench`,agentId:e,title:r?.workbench||`当前工作台`}),children:[(0,U.jsx)(Jp,{className:`h-3.5 w-3.5 text-violet-400`}),`分享`]}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`hidden h-7 gap-1 text-xs md:inline-flex`,onClick:n,children:[(0,U.jsx)(Ph,{className:`h-3.5 w-3.5`}),`编辑布局`]})]}),me=async()=>{T(!0);try{let t=await Oe(`/api/workspaces`,{agent_id:e,name:_||void 0,...b?{path:b}:{}});m(t),g(!1),y(``),x(``),Z.success(`工作区已创建${b?`(登记外部目录)`:``}`),await z(t.workspaces[t.workspaces.length-1].id)}catch(e){Z.error(String(e.message))}finally{T(!1)}},he=async()=>{if(E)try{m(await Ae(`/api/workspaces/${E.id}?agent_id=${e}`,{purge:O})),Z.success(`工作区已删除${O?`(目录已清除)`:`(仅移除登记)`}`),D(null),k(!1)}catch(e){Z.error(String(e.message))}},ge=(0,v.useMemo)(()=>__(r),[r]),_e=Math.min(L,Math.max(ge.length-1,0)),ve=ge[_e]||ge[0],ye=(0,v.useMemo)(()=>ve?.panels||[],[ve]);(0,v.useEffect)(()=>{try{localStorage.setItem(`aims.view.${e}`,String(_e))}catch{}},[e,_e]);let be=(0,v.useMemo)(()=>__(F),[F]),xe=ve?.panels.find(e=>e.type===`agent_dialog`)||ge.flatMap(e=>e.panels).find(e=>e.type===`agent_dialog`),Se=be[Math.min(ne,be.length-1)]||be[0],Ce=t=>n=>{let r=t.panels.find(e=>e.id===n.id)||n,i=r.type===`custom`?r.code||``:s.find(e=>e.id===r.panel)?.code||``;return i?(0,U.jsx)($D,{code:i,data:Te(n),meta:{agentId:e,panelId:n.id,pluginId:r.panel}},`${n.id}:${ce}`):(0,U.jsx)(`div`,{className:`p-3 text-[11px] text-muted-foreground`,children:`(插件代码加载中…)`})},we=ye.filter(e=>e.type===`custom`||e.type===`custom_panel`).map(e=>({panel:e,code:e.type===`custom`?e.code||``:s.find(t=>t.id===e.panel)?.code||``})).filter(e=>e.code),Te=t=>({devices:a?.devices||[],alarms:a?.alarms||[],kpi:a?.kpi||{},work_orders:a?.work_orders||[],inspections:a?.inspections||{},selected:l,onSelect:u,agentId:e,store:Fe(e,ce),runAction:(n,r)=>Ie(e,String(t?.id||``),n,r),params:{...t?.params||{},agentId:e,wsId:ce}});return!r||!a?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`工作台加载中…`}):(0,U.jsxs)(`div`,{className:`flex h-full flex-col gap-2 overflow-hidden px-2 py-2 lg:px-4 lg:py-2.5`,children:[ie&&(0,pt.createPortal)((0,U.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:pe}),ie),(0,U.jsx)(`h1`,{className:`sr-only`,children:r.workbench}),!ie&&(0,U.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5 text-[11px]`,children:pe}),oe?(0,U.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:xe?(0,U.jsx)(OD,{agentId:e,agentName:r.workbench,sessionId:le,wsId:ce,injectedDevice:l,autonomy:d},`m:${e}:${ce}`):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-muted-foreground`,children:`此工作台暂无对话面板——可在桌面端添加「诊断对话」区块`})}):(0,U.jsxs)(U.Fragment,{children:[ge.length>1&&(0,U.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border bg-card p-1`,children:ge.map((e,t)=>(0,U.jsxs)(`button`,{onClick:()=>te(t),className:B(`flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs transition-colors`,t===_e?`bg-primary/15 font-medium text-primary`:`text-muted-foreground hover:bg-accent hover:text-foreground`),title:e.name,children:[(0,U.jsx)(Pm,{className:`h-3.5 w-3.5 shrink-0`}),e.name]},e.id))}),(0,U.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[F&&(0,U.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col gap-2 rounded-lg border-2 border-dashed border-ai/60 bg-background/80 p-2 backdrop-blur-[2px] motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-200`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs`,children:[(0,U.jsx)(cm,{className:`h-3.5 w-3.5 shrink-0 text-ai`}),(0,U.jsx)(`span`,{className:`font-semibold text-ai`,children:`草稿预览(AI 生成)`}),(0,U.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[F.panels.length,` 个面板 · `,be.length>1?`${be.length} 个视图`:`以下为发布后的样子`]}),be.length>1&&(0,U.jsx)(`span`,{className:`flex items-center gap-1`,children:be.map((e,t)=>(0,U.jsx)(`button`,{onClick:()=>re(t),className:B(`rounded px-1.5 py-0.5 text-[10px] transition-colors`,t===Math.min(ne,be.length-1)?`bg-primary/20 text-primary`:`text-muted-foreground hover:text-foreground`),children:e.name},e.id))}),(0,U.jsxs)(`div`,{className:`ml-auto flex gap-1.5`,children:[(0,U.jsxs)(Y,{size:`sm`,className:`h-7 gap-1 text-[11px]`,onClick:fe,children:[(0,U.jsx)(Sh,{className:`h-3 w-3`}),`发布生效`]}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 text-[11px]`,onClick:R,children:`放弃`}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-7 text-[11px]`,onClick:()=>I(null),children:`收起`})]})]}),(0,U.jsx)(iO,{className:`min-h-0 flex-1 overflow-auto p-0.5`,dsl:{...F,panels:Se?.panels||[]},renderPanel:Ce(F),renderDialog:()=>(0,U.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(Wh,{className:`h-4 w-4 text-primary`}),`诊断对话(发布后可交互)`]}),renderPlaceholder:()=>(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-[11px] text-muted-foreground`,children:`空区块`})})]}),(0,U.jsx)(iO,{className:`absolute inset-0 overflow-auto p-0.5`,dsl:{...r,panels:ve?.panels||[]},onMaximize:j,renderHeaderActions:e=>e.type===`agent_dialog`?(0,U.jsxs)(U.Fragment,{children:[l&&(0,U.jsxs)(`span`,{className:`hidden min-w-0 truncate text-[10px] text-muted-foreground lg:inline`,title:`上下文:${l}(点选设备自动注入,点其他设备切换)`,children:[`上下文 `,l]}),(0,U.jsxs)(Eg,{value:String(d),onValueChange:e=>f(+e),children:[(0,U.jsx)(Og,{className:`h-6 w-[118px] shrink-0 text-[11px]`,title:`自主级别(L0 只读 → L3 免确认)`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsx)(Ag,{value:`0`,className:`text-xs`,children:`只回答不动手(L0)`}),(0,U.jsx)(Ag,{value:`1`,className:`text-xs`,children:`给建议不动手(L1)`}),(0,U.jsx)(Ag,{value:`2`,className:`text-xs`,children:`做了等我确认(L2)`}),(0,U.jsx)(Ag,{value:`3`,className:`text-xs text-destructive`,children:`全自动免确认(L3)`})]})]})]}):null,renderPanel:Ce(r),renderDialog:()=>(0,U.jsx)(OD,{agentId:e,agentName:r.workbench,sessionId:le,wsId:ce,injectedDevice:l,autonomy:d},`${e}:${ce}`),renderPlaceholder:()=>(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-[11px] text-muted-foreground`,children:`空区块——到「编辑布局」添加插件或让 AI 定制`})})]}),A!==null&&ye[A]&&(()=>{let t=ye[A],n=we.find(e=>e.panel.id===t.id),i=t.type===`agent_dialog`?(0,U.jsx)(OD,{agentId:e,agentName:r.workbench,sessionId:le,wsId:ce,injectedDevice:l,autonomy:d},`max:${e}:${ce}`):n?(0,U.jsx)($D,{code:n.code,data:Te(t),meta:{agentId:e,panelId:t.id,pluginId:t.panel}}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-xs text-muted-foreground`,children:`该面板无内容`});return(0,U.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col bg-background/90 p-4 backdrop-blur-sm motion-safe:animate-in motion-safe:fade-in-0 motion-safe:zoom-in-95 motion-safe:duration-200`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 px-1`,children:[(0,U.jsx)(Km,{className:`h-4 w-4 shrink-0 text-primary/80`}),(0,U.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:t.title}),(0,U.jsx)(J,{variant:`secondary`,className:`h-5 shrink-0 text-[10px]`,children:r.version}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`ml-auto h-7 shrink-0 gap-1 text-xs`,onClick:()=>j(null),children:[(0,U.jsx)(mg,{className:`h-3.5 w-3.5`}),`还原(ESC)`]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-lg border bg-card`,children:i})]})})(),(0,U.jsx)(gg,{open:h,onOpenChange:g,children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsx)(Sg,{children:`新建工作区`})}),(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`名称`}),(0,U.jsx)(wg,{value:_,onChange:e=>y(e.target.value),placeholder:`如:产线B改造`,className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`自定义目录(可选,留空则在平台 workspace 目录下动态新增)`}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(wg,{value:b,onChange:e=>x(e.target.value),placeholder:`/Users/you/projects/line-b 或点浏览选择`,className:`font-mono text-xs`}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-8 shrink-0 gap-1 text-xs`,onClick:()=>C(!0),children:[(0,U.jsx)(gm,{className:`h-3.5 w-3.5`}),`浏览…`]})]}),(0,U.jsx)(`p`,{className:`text-[10px] text-warning`,children:`⚠ 助手将能读写该目录(exec 工作目录即此处);目录须已存在,平台不会在其中写入数据库文件。`})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:w,onClick:()=>g(!1),children:`取消`}),(0,U.jsx)(Y,{disabled:w,onClick:me,children:w?`创建中…`:`创建并切换`})]}),(0,U.jsx)(oO,{open:S,onOpenChange:C,onPick:e=>x(e)})]})}),(0,U.jsx)(gg,{open:!!E,onOpenChange:e=>{e||(D(null),k(!1))},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[`删除工作区 · `,E?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,U.jsx)(`p`,{className:`font-mono text-[11px] text-muted-foreground`,children:E?.path}),E?.external?(0,U.jsxs)(`p`,{children:[`外部目录工作区:仅移除登记,`,(0,U.jsx)(`b`,{children:`不删除`}),`你的文件;该工作区的数据集库将一并删除。`]}):(0,U.jsxs)(`label`,{className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 p-2.5`,children:[(0,U.jsx)(hg,{checked:O,onCheckedChange:e=>k(!!e)}),(0,U.jsx)(`span`,{children:`同时删除平台目录下的工作区文件夹(数据集库始终删除)`})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:()=>D(null),children:`取消`}),(0,U.jsx)(Y,{variant:`destructive`,onClick:he,children:`确认删除`})]})]})})]}),(0,U.jsx)(yO,{target:ee,onClose:()=>M(null),agents:[{agent_id:e,name:r.workbench||`当前助手`}]}),(0,U.jsx)(uO,{agentId:e,open:N,onClose:()=>P(!1),onPreview:e=>I(e),onPublished:e=>{I(null),i(e)}})]})}function CO({...e}){return(0,U.jsx)(Hl,{"data-slot":`dropdown-menu`,...e})}function wO({...e}){return(0,U.jsx)(Wl,{"data-slot":`dropdown-menu-trigger`,...e})}function TO({className:e,sideOffset:t=4,...n}){return(0,U.jsx)(Gl,{children:(0,U.jsx)(ql,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:B(`z-50 min-w-36 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,e),...n})})}function EO({className:e,...t}){return(0,U.jsx)(Jl,{"data-slot":`dropdown-menu-item`,className:B(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-xs outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0`,e),...t})}function DO({className:e,...t}){return(0,U.jsx)(Yl,{"data-slot":`dropdown-menu-separator`,className:B(`-mx-1 my-1 h-px bg-border`,e),...t})}function OO({pluginId:e,onRollback:t}){let[n,r]=(0,v.useState)(null);return(0,v.useEffect)(()=>{e&&V(`/api/panels?id=${e}`).then(e=>r(e.plugin)).catch(()=>r(null))},[e]),n?(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:n.version}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`(当前)`})]}),(n.history||[]).slice().reverse().map(n=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:n.version}),(0,U.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:Le(n.at,`dts`)}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`ml-auto h-6 text-[10px]`,onClick:()=>t(e,n.version),children:`回退`})]},n.version)),!(n.history||[]).length&&(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`无历史版本`})]}):(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`(插件信息加载中…)`})}var kO=[{emoji:`📋`,title:`最近记录`,desc:`数据/操作时间线`,prompt:`新建一个区块:展示我数据集里最近 20 条记录的倒序时间线(ui.StatusItem,按重要程度着色),数据不足时先建合适的数据集`},{emoji:`⭐`,title:`关键指标`,desc:`大数字状态卡`,prompt:`新建一个区块:用 ui.Stat 大数字卡展示当前最关键的状态指标(数据从 /api/state 或数据集取),异常着色`},{emoji:`✅`,title:`待办清单`,desc:`可勾选任务`,prompt:`先建 todos 数据集(title/done/due),再做一个面板:ui.StatusItem 待办列表 + 完成态切换(store.update),顶部 ui.Button 清除已完成`},{emoji:`📊`,title:`分类统计`,desc:`计数条形图`,prompt:`新建一个区块:对相关数据按类型或状态聚合计数,用 ui.Bars 横向条形展示`},{emoji:`🔍`,title:`快速检索`,desc:`关键词搜索`,prompt:`新建一个区块:输入关键词检索我的数据集(store.list filter 或接口查询),结果用 ui.StatusItem 列表展示,带加载/空/错误三态`},{emoji:`🕒`,title:`活动流水`,desc:`今日事件流`,prompt:`新建一个区块:今天发生的事件/变更流水(按时间倒序),新条目突出显示,支持点击查看详情`}],AO=e=>({x:1,y:e.reduce((e,t)=>Math.max(e,t.grid?t.grid.y+t.grid.h-1:0),0)+1,w:6,h:1});function jO({agentId:e}){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)([]),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(0),[w,T]=(0,v.useState)(null),[E,D]=(0,v.useState)([]),[O,k]=(0,v.useState)(null),A=(0,v.useRef)(`dev-${e.slice(0,8)}`).current,j=(0,v.useRef)(null),[ee,M]=(0,v.useState)([]),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(!1),[L,te]=(0,v.useState)(``),[ne,re]=(0,v.useState)(null),[ie,ae]=(0,v.useState)(!1),[oe,se]=(0,v.useState)({steps:[]}),[ce,le]=(0,v.useState)(!1),[ue,de]=(0,v.useState)([]),[fe,R]=(0,v.useState)(!0),[z,pe]=(0,v.useState)(!1),[me,he]=(0,v.useState)(`main`),[ge,_e]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(F||ce||!oe.steps.length)return;let e=setTimeout(()=>se({steps:[]}),2500);return()=>clearTimeout(e)},[F,ce,oe]);let[ve,ye]=(0,v.useState)(null),be=(0,v.useRef)(null),xe=(0,v.useRef)(null),Se=(0,v.useRef)(!0),Ce=(0,v.useCallback)(()=>{let e=be.current?.closest(`[data-slot="scroll-area-viewport"]`);e&&(e.scrollTop=e.scrollHeight)},[]);(0,v.useEffect)(()=>{let e=be.current?.closest(`[data-slot="scroll-area-viewport"]`);if(!e)return;let t=()=>{Se.current=e.scrollHeight-e.scrollTop-e.clientHeight<80};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,v.useEffect)(()=>{Se.current&&Ce()},[ee,F,L,Ce]);let we=()=>{V(`/api/workbench?agent_id=${e}&draft=1`).then(e=>{let t=v_(e.dsl);n(t),he(__(t)[0].id),i(e.isDraft),o(e.versions||[]),c(JSON.stringify(t,null,2))}),V(`/api/panels`).then(e=>f(e.plugins||[]))};(0,v.useEffect)(()=>{we()},[e]);let[Te,Ee]=(0,v.useState)(null);(0,v.useEffect)(()=>{Ee(document.querySelector(`[data-slot="app-header-right"]`))},[]),(0,v.useEffect)(()=>{let t=!0;return R(!0),de([]),V(`/api/dev/inspirations?agent_id=${e}`).then(e=>{t&&de(e.items?.length?e.items:kO)}).catch(()=>{t&&de(kO)}).finally(()=>{t&&R(!1)}),()=>{t=!1}},[e]);let De=()=>{z||(pe(!0),V(`/api/dev/inspirations?agent_id=${e}&refresh=1`).then(e=>{e.items?.length&&de(e.items)}).catch(()=>Z.error(`重新生成失败,稍后再试`)).finally(()=>pe(!1)))};if((0,v.useEffect)(()=>{let e=()=>V(`/api/state`).then(T).catch(()=>{});e();let t=setInterval(e,5e3);return V(`/api/panels?with_code=1`).then(e=>D(e.plugins||[])),()=>clearInterval(t)},[]),!t)return(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`加载工作台 DSL…`});let Me=__(t),Ne=Me[Math.max(Me.findIndex(e=>e.id===me),0)],Pe=Ne.panels,Re=_===null?null:Pe[_],ze=e=>{let t=__(e);return t.find(e=>e.id===Ne.id)||t[0]},Be=e=>{let r=JSON.parse(JSON.stringify(t));e(r);let a=__(r);r.views=a,r.panels=a.flatMap(e=>e.panels),n(r),c(JSON.stringify(r,null,2)),i(!0)},Ve=(e,t)=>Be(n=>{let r=ze(n).panels,i=r[e].grid||{x:1,y:1,w:6,h:1};r[e].grid={...i,...t}}),He=t=>({devices:w?.devices||[],alarms:w?.alarms||[],kpi:w?.kpi||{},work_orders:w?.work_orders||[],inspections:w?.inspections||{},selected:O,onSelect:k,agentId:e,store:Fe(e),runAction:(n,r)=>Ie(e,String(t.id),n,r),params:{...t.params||{},agentId:e,wsId:`default`}}),Ue=e=>e.type===`custom`?e.code:E.find(t=>t.id===e.panel)?.code||``,We=()=>Be(e=>{let t=ze(e).panels;t.push({id:`block_${Math.random().toString(36).slice(2,6)}`,type:`placeholder`,title:`空区块`,grid:AO(t)})}),Ge=(e,t)=>{Be(n=>{let r=ze(n).panels;if(e!==null&&e<r.length){let n=r[e];Object.assign(n,{type:`custom_panel`,panel:t.id,title:n.title===`空区块`?t.name:n.title})}else r.push({id:`plug_${t.id}_${Math.random().toString(36).slice(2,5)}`,type:`custom_panel`,title:t.name,panel:t.id,grid:AO(r)})}),m(!1),g(null),Z.success(`已插入「${t.name}」(草稿,待发布)`)},Ke=async e=>{let t=Pe[e];re(e);let n=``;try{let e=t.panel||t.id,r=await V(`/api/panel-errors?key=${encodeURIComponent(e)}`);n=r.errors?.length?r.errors.map(e=>`[${e.kind}] ${e.message}`).join(` | `):``}catch{}P(`请调试该插件:${n?`最近运行错误:${n}。`:`暂无上报错误,请先 read_panel_plugin 审代码,重点检查结果处理与错误路径。`}请定位根因、修复并说明验证方式。`),Z.info(`已锁定调试目标并带上错误上下文,发送即开始`)},H=async(e,t)=>{try{let n=await Oe(`/api/panels/rollback`,{id:e,version:t});Z.success(`已回退到 ${t}(新版本号 ${n.plugin.version},引用即时生效)`),we()}catch(e){Z.error(String(e.message))}},qe=()=>{if(ne===null||!Pe[ne])return``;let e=Pe[ne],t=e.grid||{x:1,y:1,w:6,h:1},n=Math.round(t.w/12*100),r=t.w<=3?`窄条(紧凑单列列表/迷你卡)`:t.w>=9?`宽区块(表格/多列仪表)`:`中等宽度(两列卡/紧凑表)`;return`【定制目标】区块「${e.title}」(id=${e.id}):第${t.x}列起、跨${t.w}列(约${n}%宽)、跨${t.h}行(${r})。${e.panel?`当前引用插件 ${e.panel}——先 read_panel_plugin 再决定改造还是重写。`:`空区块,可新建插件。`}${e.bare?`本区块为通栏视觉面板(bare:无面板头无边框,内容顶格,适合 KPI 条/图表/矩阵墙)。`:`面板头由平台渲染(标题「${e.title}」)——插件首屏直接进入内容,勿写标题行。`}`},Je=e=>{re(e),P(``),setTimeout(()=>xe.current?.focus(),50),Z.info(`已锁定定制目标「${Pe[e].title}」——在右侧描述需求即可`)},Ye=async()=>{u(!0);try{let r=await ke(`/api/workbench`,{agent_id:e,dsl:t});n(r.dsl),o(r.versions),c(JSON.stringify(r.dsl,null,2)),i(!1),ae(!1),Z.success(`已发布 ${r.dsl.version},工作台即时生效`)}catch(e){Z.error(String(e.message))}finally{u(!1)}},Xe=async()=>{await Ae(`/api/workbench/draft`,{agent_id:e}),Z.success(`已放弃草稿`),we()},Ze=async t=>{try{let r=await Oe(`/api/workbench/rollback`,{agent_id:e,version:t});n(r.dsl),o(r.versions),c(JSON.stringify(r.dsl,null,2)),i(!1),Z.success(`已回滚到 ${t}`)}catch(e){Z.error(String(e.message))}},Qe=()=>Be(e=>{let t=__(e);t.push({id:`view_${Math.random().toString(36).slice(2,6)}`,name:`视图${t.length+1}`,panels:[{id:`block_${Math.random().toString(36).slice(2,6)}`,type:`placeholder`,title:`空区块`,grid:{x:1,y:1,w:6,h:1}}]})}),$e=()=>Be(e=>{let t=__(e),n=t.find(e=>e.id===Ne.id)||t[0];t.push({id:`view_${Math.random().toString(36).slice(2,6)}`,name:`${n.name} 副本`,panels:n.panels.map(e=>({...e,id:`${e.id}_${Math.random().toString(36).slice(2,5)}`}))})}),et=e=>Be(t=>{let n=ze(t);e.trim()&&(n.name=e.trim())}),tt=()=>{Me.length<=1?Z.info(`至少保留一个视图`):(Be(e=>{let t=__(e),n=Math.max(t.findIndex(e=>e.id===Ne.id),0);t.splice(n,1)}),he(``),y(null),re(null))},nt=()=>{j.current?.abort()},rt=async()=>{if(F)Z.info(`对话进行中,请先停止再清空`);else if(window.confirm(`清空二开助手的会话历史?服务端上下文将被丢弃并从零开始;已生成的草稿与插件不受影响。`))try{await Oe(`/api/session/reset`,{scope:`dev`,sessionId:A}),M([]),te(``),Z.success(`会话已清空`)}catch(e){Z.error(String(e.message))}},it=async()=>{let t=N.trim();if(!t||F)return;let n=qe()?`${qe()}\n需求:${t}`:t;P(``),I(!0),ae(!1),se({steps:[]}),le(!1),Se.current=!0,M(e=>[...e,{role:`user`,text:t}]);let r=!1,i=!1,a=new AbortController;j.current=a;try{await je(`/api/dev/chat`,{sessionId:A,agentId:e,message:n},e=>{let t=e.type;t===`status`?te(String(e.text||``)):t===`text_delta`?(i=!0,te(``),M(t=>{let n=t[t.length-1];return n?.role===`agent`&&n.streaming?[...t.slice(0,-1),{...n,text:n.text+String(e.delta)}]:[...t,{role:`agent`,text:String(e.delta),streaming:!0}]})):t===`done`?!i&&!r&&M(e=>[...e,{role:`agent`,text:`(模型返回了空回复——请重试;若持续出现请到「系统设置」检查模型配置)`}]):t===`tool_start`?(r=!0,se(t=>({steps:[...t.steps,{label:cO(String(e.tool)),state:`active`}]})),M(t=>[...t,{role:`agent`,text:``,streaming:!1,events:[{tool:String(e.tool),args:e.args||{}}]}])):t===`tool_end`?(se(t=>{let n=[...t.steps],r=cO(String(e.tool));for(let e=n.length-1;e>=0;e--)if(n[e].label===r&&n[e].state===`active`){n[e]={...n[e],state:`done`};break}return{steps:n}}),M(t=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.role===`agent`&&r.events){for(let n=r.events.length-1;n>=0;n--)if(r.events[n].tool===e.tool&&r.events[n].result===void 0)return r.events[n].result=String(e.result||``),r.events[n].ok=e.ok!==!1,[...t]}}return t})):t===`interrupted`?(te(``),M(e=>[...e,{role:`agent`,text:`(已中断)`}])):t===`meta`?e.hasDraft?(ae(!0),le(!0),we()):r&&we():t===`error`&&Z.error(String(e.message))},a.signal)}catch(e){a.signal.aborted?M(e=>[...e,{role:`agent`,text:`(已中断)`}]):M(t=>[...t,{role:`agent`,text:`❌ ${String(e.message)}`}])}finally{te(``),I(!1),j.current===a&&(j.current=null)}},at=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(J,{variant:r?`outline`:`secondary`,className:B(`h-6 shrink-0 px-1.5 text-[10px]`,r&&`border-warning/50 text-warning`),children:r?`草稿未发布`:`线上 ${t.version}`}),r&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-1.5 text-[10px] text-warning hover:text-warning`,title:`放弃当前草稿,回到线上版本`,onClick:Xe,children:`放弃`}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-6 shrink-0 px-2 text-[11px]`,onClick:()=>{g(null),m(!0)},children:[(0,U.jsx)(gh,{className:`mr-1 h-3 w-3`}),`插件库`]}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-6 shrink-0 px-2 text-[11px]`,title:`把当前工作台(含依赖插件/数据集 schema/交互脚本)发布为 ARM UI 资产`,onClick:()=>ye({type:`workbench`,agentId:e,title:t.workbench}),children:[(0,U.jsx)(Jp,{className:`mr-1 h-3 w-3 text-violet-400`}),`导出资产`]}),(0,U.jsxs)(Y,{size:`sm`,className:`h-6 shrink-0 px-2 text-[11px]`,disabled:l||!r,onClick:Ye,children:[(0,U.jsx)(Eh,{className:`mr-1 h-3 w-3`}),l?`发布中…`:`审阅后发布`]})]});return(0,U.jsxs)(`div`,{className:`flex h-full flex-col gap-2 overflow-hidden px-4 py-2.5`,children:[!Te&&(0,U.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5`,children:at}),Te&&(0,pt.createPortal)((0,U.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:at}),Te),(0,U.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[1fr_380px] gap-4`,children:[(0,U.jsx)(`div`,{className:`flex min-h-0 flex-col`,children:(0,U.jsxs)(pO,{defaultValue:`canvas`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-nowrap items-center gap-1.5 overflow-x-auto rounded-md border bg-card p-1.5`,children:[(0,U.jsxs)(hO,{className:`h-8 shrink-0`,children:[(0,U.jsxs)(gO,{value:`canvas`,className:`px-2 text-xs`,children:[(0,U.jsx)(Im,{className:`mr-1 h-3.5 w-3.5`}),`画布`]}),(0,U.jsx)(gO,{value:`json`,className:`px-2 text-xs`,children:`JSON`})]}),(0,U.jsx)(fO,{orientation:`vertical`,className:`mx-1 h-5 shrink-0`}),(0,U.jsxs)(Y,{size:`sm`,variant:`secondary`,className:`h-7 shrink-0 text-xs`,onClick:We,children:[(0,U.jsx)(mh,{className:`mr-1 h-3 w-3`}),`添加区块`]}),(0,U.jsx)(fO,{orientation:`vertical`,className:`mx-1 h-5 shrink-0`}),Re?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`max-w-28 shrink-0 truncate text-[11px] text-muted-foreground`,title:Re.title,children:[`「`,Re.title,`」`]}),(0,U.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:`按住拖动调整位置 · 右下角手柄调大小`}),(0,U.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 shrink-0 text-xs text-primary`,onClick:()=>Je(_),children:[(0,U.jsx)(wp,{className:`mr-1 h-3 w-3`}),`AI 定制`]}),(0,U.jsxs)(CO,{children:[(0,U.jsx)(wO,{asChild:!0,children:(0,U.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 shrink-0 text-xs`,children:[(0,U.jsx)(om,{className:`h-3 w-3`}),`更多`]})}),(0,U.jsxs)(TO,{align:`end`,children:[(Re.type===`custom`||Re.type===`custom_panel`)&&(0,U.jsxs)(EO,{className:`text-warning focus:text-warning`,onClick:()=>Ke(_),children:[(0,U.jsx)(fg,{}),`AI 调试`]}),(0,U.jsxs)(EO,{onClick:()=>Ve(_,{x:1,w:12}),children:[(0,U.jsx)(Xh,{className:`text-muted-foreground`}),`占满宽度`]}),(0,U.jsxs)(EO,{onClick:()=>{let e=Pe.reduce((e,t)=>Math.max(e,(t.grid?.y||1)+(t.grid?.h||1)-1),1);Ve(_,{h:Math.max(1,e-(Re.grid?.y||1)+1)})},children:[(0,U.jsx)(Qh,{className:`text-muted-foreground`}),`延到底部`]}),(0,U.jsxs)(EO,{onClick:()=>Ve(_,{x:1}),children:[(0,U.jsx)(mp,{className:`text-muted-foreground`}),`贴左`]}),(0,U.jsxs)(EO,{onClick:()=>Ve(_,{x:12-(Re.grid?.w||6)+1}),children:[(0,U.jsx)(fp,{className:`text-muted-foreground`}),`贴右`]}),(0,U.jsx)(DO,{}),(0,U.jsxs)(EO,{onClick:()=>{g(_),m(!0)},children:[(0,U.jsx)(gh,{className:`text-muted-foreground`}),`换插件`]}),(0,U.jsxs)(EO,{onClick:()=>{C(_),x(!0)},children:[(0,U.jsx)(Ph,{className:`text-muted-foreground`}),`面板设置`]}),(0,U.jsxs)(EO,{className:`text-destructive focus:text-destructive`,onClick:()=>{Be(e=>ze(e).panels.splice(_,1)),y(null),re(null)},children:[(0,U.jsx)(ng,{}),`删除区块`]})]})]})]}):(0,U.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:`点击画布中的区块进行编辑`})]}),(0,U.jsxs)(_O,{value:`canvas`,className:`mt-1.5 flex min-h-0 flex-1 flex-col gap-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border bg-card p-1`,children:[Me.map(e=>(0,U.jsxs)(`button`,{onClick:()=>{he(e.id),y(null),re(null)},className:B(`flex h-7 min-w-0 items-center gap-1.5 rounded-md px-2.5 text-xs transition-colors`,e.id===Ne.id?`bg-primary/15 font-medium text-primary`:`text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,U.jsx)(`span`,{className:`truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`shrink-0 text-[9px] opacity-60`,children:e.panels.length})]},e.id)),(0,U.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,U.jsx)(`button`,{onClick:Qe,title:`新建视图(新场景一块新屏)`,className:`rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,U.jsx)(mh,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(`button`,{onClick:$e,title:`复制当前视图`,className:`rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,U.jsx)(Xp,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(`button`,{onClick:()=>_e(!0),title:`重命名当前视图`,className:`rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,U.jsx)(uh,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(`button`,{onClick:tt,title:`删除当前视图(至少保留一个)`,className:`rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-destructive`,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})})]})]}),(0,U.jsx)(`div`,{className:`shrink-0`,children:(0,U.jsx)(aO,{})}),(0,U.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden rounded-lg border bg-muted/20 p-2`,children:[(0,U.jsx)(iO,{className:`absolute inset-0 overflow-auto`,dsl:{...t,panels:Ne.panels},edit:{sel:_,onSelect:y,onGrid:(e,t)=>Ve(e,t),onAICustomize:Je},renderPanel:t=>{let n=Ue(t);return n?(0,U.jsx)($D,{code:n,data:He(t),meta:{agentId:e,panelId:t.id,pluginId:t.panel}}):(0,U.jsx)(`div`,{className:`p-3 text-[11px] text-muted-foreground`,children:`(插件代码加载中…)`})},renderDialog:()=>(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(wp,{className:`h-5 w-5 text-primary`}),`诊断对话(内核)`,(0,U.jsx)(`span`,{className:`text-[10px]`,children:`发布后在工作台可交互`})]}),renderPlaceholder:()=>(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(mh,{className:`h-4 w-4`}),`空区块`,(0,U.jsx)(`span`,{className:`text-[10px]`,children:`选中后「换插件」或「AI 定制」`})]})}),(0,U.jsx)(lO,{steps:oe.steps,status:L,lit:ce,onClose:()=>{se({steps:[]}),le(!1)}})]}),(0,U.jsx)(`p`,{className:`shrink-0 text-center text-[10px] text-muted-foreground`,children:`拖拽吸附 12 列网格 · 右下角手柄调大小 · 画布比例 = 真实工作台(所见即所得)`})]}),(0,U.jsxs)(_O,{value:`json`,className:`mt-2 flex min-h-0 flex-1 flex-col gap-2`,children:[(0,U.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),spellCheck:!1,className:`min-h-0 w-full flex-1 resize-none rounded-md border bg-muted p-3 font-mono text-[11px] leading-relaxed`}),(0,U.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,U.jsx)(Y,{size:`sm`,onClick:()=>{try{let e=JSON.parse(s);if(!e.panels&&!e.views)throw Error(`缺少 panels/views`);let t=v_(e);n(t),he(__(t)[0].id),i(!0),Z.success(`JSON 已应用(未发布)`)}catch(e){Z.error(`JSON 解析失败: ${e.message}`)}},children:`应用 JSON`}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,onClick:()=>c(JSON.stringify(t,null,2)),children:`从画布刷新`})]})]})]})}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-4`,children:[(0,U.jsx)(Gf,{className:`flex min-h-0 flex-1 flex-col py-0`,children:(0,U.jsxs)(Jf,{className:`flex min-h-0 flex-1 flex-col p-0`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-b px-3 py-2 text-xs font-semibold`,children:[(0,U.jsx)(Wh,{className:`h-3.5 w-3.5 text-ai`}),`二开助手`,(0,U.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`· 描述需求,直接定制区块`}),(0,U.jsx)(`button`,{className:`ml-auto shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground disabled:opacity-40`,title:`清空会话(丢弃服务端上下文,从零开始)`,disabled:F,onClick:rt,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})})]}),ne!==null&&Pe[ne]&&(()=>{let e=Pe[ne],t=e.grid||{x:1,y:1,w:6,h:1},n=Math.round(t.w/12*100);return(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-b bg-primary/5 px-3 py-1.5 text-[11px]`,children:[(0,U.jsx)(em,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,U.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`定制目标:`,(0,U.jsx)(`b`,{children:e.title}),` · `,n,`% 宽 · `,t.h,` 行`,e.panel?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(`span`,{className:`font-mono`,children:e.panel})]}):` · 空区块`]}),(0,U.jsx)(`button`,{className:`ml-auto shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground`,title:`取消目标,改为自由描述`,onClick:()=>re(null),children:`×`})]})})(),ie&&r&&(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-b bg-success/10 px-3 py-1.5 text-[11px] text-success`,children:[(0,U.jsx)(Bp,{className:`h-3.5 w-3.5 shrink-0`}),`草稿已生成——到顶部「审阅后发布」生效`]}),(0,U.jsx)(bD,{className:`min-h-0 flex-1`,children:(0,U.jsxs)(`div`,{className:`space-y-2.5 p-3`,ref:be,children:[ee.length===0&&(0,U.jsx)(`div`,{className:`space-y-2`,children:(0,U.jsxs)(`div`,{className:`rounded-md border border-dashed border-primary/30 bg-primary/5 p-3 text-[11px] leading-relaxed`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-xs font-semibold text-ai`,children:[`✨ 灵感库 · 为这个助手定制`,!fe&&ue.length>0&&(0,U.jsxs)(`button`,{onClick:De,disabled:z,title:`按自描述重新生成一批(不满意就换)`,className:`ml-auto flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-normal text-muted-foreground transition-colors hover:text-primary disabled:opacity-50`,children:[(0,U.jsx)(bh,{className:B(`h-3 w-3`,z&&`animate-spin`)}),z?`构思中…`:`换一批`]})]}),(0,U.jsx)(`div`,{children:`由助手自描述(AGENT.md)生成——选中画布区块再描述 = 只改它;直接描述 = 自动建区块。`}),fe&&(0,U.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-ai`}),`正在阅读这个助手的自描述并构思灵感…(不影响你直接输入需求)`]}),(0,U.jsxs)(`div`,{className:`mt-1.5 grid grid-cols-2 gap-1.5`,children:[fe&&[...[,,,,,,]].map((e,t)=>(0,U.jsx)(`div`,{className:`h-[46px] animate-pulse rounded-md border bg-muted/50`},t)),!fe&&ue.map(e=>(0,U.jsxs)(`button`,{onClick:()=>P(e.prompt),title:e.prompt,className:`flex h-[46px] flex-col items-start gap-0.5 overflow-hidden rounded-md border bg-card/60 p-2 text-left transition-colors hover:border-primary/60`,children:[(0,U.jsxs)(`span`,{className:`text-[11px] font-medium`,children:[e.emoji,` `,e.title]}),(0,U.jsx)(`span`,{className:`line-clamp-1 w-full text-[10px] text-muted-foreground`,children:e.desc})]},e.title))]})]})}),ee.map((e,t)=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:e.role===`user`?`ml-auto max-w-[90%] rounded-lg bg-primary/20 px-2.5 py-1.5 text-xs break-words whitespace-pre-wrap`:`max-w-full rounded-lg bg-card px-2.5 py-1.5 text-xs leading-relaxed break-words whitespace-pre-wrap`,children:e.text}),(e.events||[]).map((e,t)=>(0,U.jsxs)(`div`,{className:`mt-1 min-w-0 rounded-md border border-dashed px-2 py-1 text-[10px]`,children:[(0,U.jsx)(`span`,{children:e.ok===!1?`❌`:`🛠`}),` `,(0,U.jsx)(`span`,{className:`font-mono font-semibold`,children:e.tool}),(0,U.jsx)(`pre`,{className:`mt-0.5 max-h-32 overflow-auto whitespace-pre-wrap break-all text-muted-foreground`,children:String(e.result||``).slice(0,260)})]},t))]},t)),(F||L)&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-primary`}),L||`开发中…`]})]})}),(0,U.jsxs)(`div`,{className:`shrink-0 space-y-1 border-t p-2`,children:[(0,U.jsx)(`textarea`,{ref:xe,value:N,onChange:e=>P(e.target.value),rows:2,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),it())},placeholder:ne===null?`描述需求,如「左上窄条做一个最近工单列表」(Enter 发送)…`:`描述对「${Pe[ne]?.title}」的需求(Enter 发送,Shift+Enter 换行)…`,className:`min-h-[56px] w-full resize-none rounded-md border bg-background px-2 py-1.5 text-xs`}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:ne===null?`未锁定目标——助手会自动规划区块位置`:`目标上下文(位置/几何/插件)发送时自动携带`}),F?(0,U.jsxs)(Y,{size:`sm`,variant:`destructive`,className:`h-7 gap-1 text-xs`,onClick:nt,children:[(0,U.jsx)(Jh,{className:`h-3 w-3`}),`停止`]}):(0,U.jsxs)(Y,{size:`sm`,className:`h-7 gap-1 text-xs`,disabled:!N.trim(),onClick:it,children:[(0,U.jsx)(Ah,{className:`h-3 w-3`}),`发送`]})]})]})]})}),(0,U.jsx)(Gf,{className:`shrink-0 py-0`,children:(0,U.jsxs)(Jf,{className:`p-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b px-3 py-2 text-xs font-semibold`,children:[(0,U.jsx)(wh,{className:`h-3.5 w-3.5`}),`版本历史`]}),(0,U.jsx)(`div`,{className:`max-h-40 overflow-y-auto`,children:(0,U.jsxs)(`div`,{className:`divide-y`,children:[a.length===0&&(0,U.jsx)(`div`,{className:`p-3 text-center text-xs text-muted-foreground`,children:`暂无历史`}),[...a].reverse().map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`font-mono font-semibold`,children:e.version}),t===0&&!r&&(0,U.jsx)(J,{className:`ml-1 h-4 px-1 text-[9px]`,children:`线上`}),(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:Le(e.at,`dts`)})]}),t!==0&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 text-[10px]`,onClick:()=>Ze(e.version),children:`回滚`})]},`${e.version}-${e.at}`))]})})]})})]})]}),(0,U.jsx)(gg,{open:b,onOpenChange:x,children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[`区块设置 · `,Pe[S]?.title]})}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`标题`}),(0,U.jsx)(wg,{defaultValue:Pe[S]?.title||``,className:`text-xs`,onBlur:e=>Be(t=>{ze(t).panels[S].title=e.target.value})})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`副标题(面板头右侧灰字)`}),(0,U.jsx)(wg,{defaultValue:String(Pe[S]?.subtitle??``),className:`text-xs`,placeholder:`可选`,onBlur:e=>Be(t=>{ze(t).panels[S].subtitle=e.target.value})})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`图标`}),(0,U.jsx)(wg,{defaultValue:String(Pe[S]?.icon??``),className:`text-xs font-mono`,placeholder:`activity/alert/gauge…`,onBlur:e=>Be(t=>{ze(t).panels[S].icon=e.target.value.trim()})})]})]}),(0,U.jsxs)(`label`,{className:`flex items-start gap-2 rounded-md border p-2.5 text-xs leading-relaxed`,children:[(0,U.jsx)(hg,{checked:!!Pe[S]?.bare,onCheckedChange:e=>Be(t=>{ze(t).panels[S].bare=!!e})}),(0,U.jsx)(`span`,{children:`通栏视觉面板(bare)——无面板头与边框,内容顶格;适合 KPI 条 / 图表墙 / 状态矩阵等全画布表达。信息型列表面板请保持默认框架头。`})]}),Pe[S]?.type===`custom`&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`内联代码(契约:function Panel(props))`}),(0,U.jsx)(`textarea`,{defaultValue:Pe[S]?.code||``,spellCheck:!1,onBlur:e=>Be(t=>{ze(t).panels[S].code=e.target.value}),className:`h-40 w-full rounded-md border bg-muted p-2 font-mono text-[10px]`})]}),Pe[S]?.type===`custom_panel`&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`插件版本(可回退,回退即时生效)`}),(0,U.jsx)(OO,{pluginId:String(Pe[S]?.panel||``),onRollback:H})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`params(插件经 props.params 读取)`}),(0,U.jsx)(`textarea`,{defaultValue:JSON.stringify(Pe[S]?.params||{},null,1),spellCheck:!1,onBlur:e=>{try{Be(t=>{ze(t).panels[S].params=JSON.parse(e.target.value||`{}`)})}catch{Z.error(`params JSON 无效`)}},className:`h-20 w-full rounded-md border bg-muted p-2 font-mono text-[10px]`})]})]}),(0,U.jsx)(xg,{children:(0,U.jsx)(Y,{onClick:()=>x(!1),children:`完成`})})]})}),(0,U.jsx)(gg,{open:p,onOpenChange:e=>{m(e),e||g(null)},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(gh,{className:`h-4 w-4`}),`插件库`,h===null?``:` · 插入到选中区块`]})}),(0,U.jsx)(`div`,{className:`max-h-72 overflow-y-auto`,children:(0,U.jsx)(`div`,{className:`space-y-1.5`,children:d.filter(e=>e.status!==`deprecated`).map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border p-2.5`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs font-medium`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:e.name,children:e.name}),(0,U.jsx)(J,{variant:`secondary`,className:`h-4 shrink-0 px-1 text-[9px]`,children:e.version}),(0,U.jsx)(J,{variant:`outline`,className:`h-4 shrink-0 px-1 text-[9px]`,children:e.author===`system`?`范本`:e.author===`ai`?`AI`:`人工`})]}),(0,U.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.description||e.id})]}),(0,U.jsx)(Y,{size:`sm`,variant:`secondary`,className:`h-7 shrink-0 text-[11px]`,onClick:()=>Ge(h,e),children:`插入`})]},e.id))})}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,size:`sm`,onClick:We,children:`先加空区块`}),(0,U.jsx)(Y,{variant:`outline`,onClick:()=>m(!1),children:`关闭`})]})]})}),(0,U.jsx)(gg,{open:ge,onOpenChange:_e,children:(0,U.jsxs)(yg,{className:`max-w-xs`,children:[(0,U.jsx)(bg,{children:(0,U.jsx)(Sg,{children:`重命名视图`})}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`视图名称`}),(0,U.jsx)(wg,{defaultValue:Ne.name,className:`text-xs`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(et(e.target.value),_e(!1))},onBlur:e=>{et(e.target.value),_e(!1)}},Ne.id)]})]})}),(0,U.jsx)(yO,{target:ve,onClose:()=>ye(null),agents:[{agent_id:e,name:t.workbench||`当前助手`}]}),(0,U.jsx)(`p`,{className:`shrink-0 text-center text-[11px] text-muted-foreground`,children:`区块几何 = 插件设计输入:宽≤3 列紧凑列表、≥9 列表格/仪表 · AI 定制锁定目标、上下文自动携带 · 草稿审阅发布。`})]})}function MO({className:e,size:t=`default`,...n}){return(0,U.jsx)(vf,{"data-slot":`switch`,"data-size":t,className:B(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80`,e),...n,children:(0,U.jsx)(bf,{"data-slot":`switch-thumb`,className:B(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground`)})})}function NO(){let[e,t]=(0,v.useState)([]),[n,r]=(0,v.useState)([]),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),c=[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],l=e=>{let t=e.trim().split(/\s+/);if(t.length!==5)return e;let n=e=>String(+e).padStart(2,`0`);return/^\d+ \d+ \* \* \*$/.test(e)?`每天 ${n(t[1])}:${n(t[0])}`:/^\d+ \* \* \* \*$/.test(e)?`每小时第 ${t[0]} 分`:/^\d+ \d+ \* \* \d+$/.test(e)&&+t[4]<=7?`每${c[t[4]%7]} ${n(t[1])}:${n(t[0])}`:`cron:${e}`},u=e=>{if(e.preset===`custom`)return e.cron.trim();if(e.preset===`hourly`)return`${+e.minute||0} * * * *`;let[t,n]=(e.time||`09:00`).split(`:`);return e.preset===`daily`?`${+n||0} ${+t||0} * * *`:`${+n||0} ${+t||0} * * ${e.weekday||`1`}`},d=e=>{let t=e.trim().split(/\s+/),n=e=>String(e).padStart(2,`0`);return t.length===5&&/^\d+ \d+ \* \* \*$/.test(e)?{preset:`daily`,time:`${n(+t[1])}:${n(+t[0])}`,minute:`0`,weekday:`1`}:t.length===5&&/^\d+ \* \* \* \*$/.test(e)?{preset:`hourly`,time:`09:00`,minute:t[0],weekday:`1`}:t.length===5&&/^\d+ \d+ \* \* \d+$/.test(e)&&+t[4]<=7?{preset:`weekly`,time:`${n(+t[1])}:${n(+t[0])}`,minute:`0`,weekday:String(t[4]%7)}:{preset:`custom`,time:`09:00`,minute:`0`,weekday:`1`}},f=e=>s(e?{mode:`edit`,id:e.id,name:e.name,agent_id:e.agent_id,...d(e.cron),cron:e.cron,autonomy:e.autonomy_level==null?``:String(e.autonomy_level),message:e.message}:{mode:`add`,name:``,agent_id:n[0]?.agent_id||``,preset:`daily`,time:`12:00`,minute:`0`,weekday:`1`,cron:`0 12 * * *`,autonomy:``,message:``}),p=()=>V(`/api/schedules`).then(e=>t(e.schedules||[])).catch(()=>{}),m=()=>{p(),V(`/api/quick-switch`).then(e=>r(e.agents||[])).catch(()=>{})};(0,v.useEffect)(()=>{m();let e=setInterval(m,3e4);return()=>clearInterval(e)},[]);let h=async()=>{let e=o;if(!e)return;let t=u(e);if(!e.name.trim()||!e.agent_id||!e.message.trim())Z.error(`名称、目标助手与消息内容必填`);else{a(e.id||`add`);try{let n={name:e.name.trim(),agent_id:e.agent_id,cron:t,message:e.message.trim(),...e.autonomy===``?{}:{autonomy_level:+e.autonomy}};e.mode===`add`?(await Oe(`/api/schedules`,n),Z.success(`定时任务「${e.name.trim()}」已创建`,{description:`${l(t)} · 到点自动发给该助手执行`})):(await ke(`/api/schedules/${e.id}`,n),Z.success(`定时任务已更新`)),s(null),await p()}catch(e){Z.error(String(e.message))}finally{a(null)}}},g=async(e,t)=>{a(e.id);try{await ke(`/api/schedules/${e.id}`,t),await p()}catch(e){Z.error(String(e.message))}finally{a(null)}},_=async e=>{a(e.id);try{let t=await Oe(`/api/schedules/${e.id}/run`),n={ok:`执行完成`,error:`执行出错`,skipped_busy:`会话忙,本次跳过`,skipped_pending:`有待确认操作,本次跳过`};t.run.status===`ok`?Z.success(`「${e.name}」${n[t.run.status]}`,{description:t.run.summary.slice(0,160)}):Z.warning(`「${e.name}」${n[t.run.status]||t.run.status}`,{description:t.run.summary.slice(0,160)}),await p()}catch(e){Z.error(String(e.message))}finally{a(null)}},y=async e=>{if(window.confirm(`删除定时任务「${e.name}」?(${l(e.cron)} → ${e.agent_name})`)){a(e.id);try{await Ae(`/api/schedules/${e.id}`,{}),Z.success(`已删除`),await p()}catch(e){Z.error(String(e.message))}finally{a(null)}}};return(0,U.jsxs)(`div`,{className:`h-full overflow-auto p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-bold`,children:[(0,U.jsx)(Wp,{className:`h-5 w-5 text-primary`}),`平台定时任务`]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`到点自动向在岗助手发消息并让它执行——与人工发消息完全同构(同一守护栏 / 分级自主 / 审计;打开该助手的工作台能在对话里看到每次定时轮次)。 会话正在处理或有待确认操作时跳过该次;停机期间错过的触发不补跑。`})]}),(0,U.jsx)(Gf,{className:`mb-3 max-w-3xl`,children:(0,U.jsxs)(Jf,{className:`space-y-3 p-4`,children:[n.length===0&&(0,U.jsx)(`div`,{className:`rounded-md border border-warning/40 bg-warning/10 p-2.5 text-[11px] leading-relaxed text-warning`,children:`当前没有在岗助手——定时任务面向在岗助手,先到「助手大厅」完成一次上岗配置。`}),e.length===0&&n.length>0&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`还没有定时任务——例如「每天 12:00,让巡检助手检查活跃告警并汇总到对话」。`}),e.length>0&&(0,U.jsx)(`div`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-2 text-xs ${e.enabled?``:`opacity-60`}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,U.jsx)(J,{variant:`outline`,className:`h-4 max-w-40 px-1 text-[9px]`,children:(0,U.jsx)(`span`,{className:`truncate`,children:e.agent_name})}),(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px] font-mono`,title:e.cron,children:l(e.cron)}),!e.deployed&&(0,U.jsx)(J,{className:`h-4 bg-destructive/15 px-1 text-[9px] text-destructive`,title:`目标助手已不在岗,任务将在下次触发时报错——请编辑或删除`,children:`已下岗`}),e.autonomy_level!=null&&(0,U.jsxs)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,title:`该任务覆盖会话的自主级别`,children:[`L`,e.autonomy_level]})]}),(0,U.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,title:e.message,children:e.message}),(0,U.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[e.enabled?`下次 ${e.next_run?Le(e.next_run,`dts`):`待计算`}`:`已停用`,e.last&&` · 最近:${{ok:`✅`,error:`❌`,skipped_busy:`⏭`,skipped_pending:`⏭`}[e.last.status]||``}${e.last.trigger===`manual`?`手动`:`定时`} ${Le(e.last.at,`dt`)} ${e.last.summary?`「${e.last.summary.slice(0,60)}」`:e.last.status}`]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(MO,{checked:e.enabled,disabled:i===e.id,onCheckedChange:t=>g(e,{enabled:t}),title:e.enabled?`停用`:`启用`}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,disabled:i===e.id,onClick:()=>_(e),title:`立即执行一次(不影响定时节奏)`,children:(0,U.jsx)(fh,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,disabled:i===e.id,onClick:()=>f(e),title:`编辑`,children:(0,U.jsx)(Kh,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0 text-destructive hover:text-destructive`,disabled:i===e.id,onClick:()=>y(e),title:`删除`,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})})]})]},e.id))}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(Y,{size:`sm`,className:`text-xs`,disabled:n.length===0,onClick:()=>f(),children:[(0,U.jsx)(mh,{className:`mr-1 h-3.5 w-3.5`}),`新建任务`]}),(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`周期支持常见预设与 cron(分 时 日 月 周,本地时区);精度约 ±30 秒。`})]})]})}),(0,U.jsx)(gg,{open:!!o,onOpenChange:e=>{!e&&i===null&&s(null)},children:(0,U.jsxs)(yg,{className:`max-w-lg`,children:[(0,U.jsxs)(bg,{children:[(0,U.jsxs)(Sg,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(Wp,{className:`h-4 w-4 text-primary`}),o?.mode===`add`?`新建定时任务`:`编辑 · ${o?.name}`]}),(0,U.jsx)(Cg,{className:`text-[11px]`,children:`到点后消息会以「【定时任务 · 名称】」开头发给目标助手,助手按其能力与守护栏执行。`})]}),o&&(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`任务名称`}),(0,U.jsx)(wg,{value:o.name,onChange:e=>s({...o,name:e.target.value}),placeholder:`如:每日告警巡检`,className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`目标助手(在岗)`}),(0,U.jsxs)(Eg,{value:o.agent_id,onValueChange:e=>s({...o,agent_id:e}),children:[(0,U.jsx)(Og,{className:`h-8 text-xs`,children:(0,U.jsx)(Dg,{placeholder:`选择助手`})}),(0,U.jsx)(kg,{children:n.map(e=>(0,U.jsx)(Ag,{value:e.agent_id,className:`text-xs`,children:e.name},e.agent_id))})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`自主级别`}),(0,U.jsxs)(Eg,{value:o.autonomy,onValueChange:e=>s({...o,autonomy:e}),children:[(0,U.jsx)(Og,{className:`h-8 text-xs`,title:`缺省跟随该助手的上岗配置;写命令仍按守护栏管控`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsx)(Ag,{value:``,className:`text-xs`,children:`跟随上岗配置`}),[`0`,`1`,`2`,`3`].map(e=>(0,U.jsxs)(Ag,{value:e,className:`text-xs`,children:[`L`,e,`:`,[`只读`,`建议`,`写需确认`,`免确认`][+e]]},e))]})]})]})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`周期`}),(0,U.jsxs)(Eg,{value:o.preset,onValueChange:e=>s({...o,preset:e}),children:[(0,U.jsx)(Og,{className:`h-8 text-xs`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsx)(Ag,{value:`daily`,className:`text-xs`,children:`每天`}),(0,U.jsx)(Ag,{value:`hourly`,className:`text-xs`,children:`每小时`}),(0,U.jsx)(Ag,{value:`weekly`,className:`text-xs`,children:`每周`}),(0,U.jsx)(Ag,{value:`custom`,className:`text-xs`,children:`自定义 cron`})]})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[o.preset===`daily`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`时间`}),(0,U.jsx)(wg,{type:`time`,value:o.time,onChange:e=>s({...o,time:e.target.value}),className:`h-8 font-mono text-xs`})]}),o.preset===`hourly`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`第几分(0-59)`}),(0,U.jsx)(wg,{type:`number`,min:0,max:59,value:o.minute,onChange:e=>s({...o,minute:e.target.value}),className:`h-8 font-mono text-xs`})]}),o.preset===`weekly`&&(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`星期`}),(0,U.jsxs)(Eg,{value:o.weekday,onValueChange:e=>s({...o,weekday:e}),children:[(0,U.jsx)(Og,{className:`h-8 text-xs`,children:(0,U.jsx)(Dg,{})}),(0,U.jsx)(kg,{children:[`1`,`2`,`3`,`4`,`5`,`6`,`0`].map(e=>(0,U.jsx)(Ag,{value:e,className:`text-xs`,children:c[e%7]},e))})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`时间`}),(0,U.jsx)(wg,{type:`time`,value:o.time,onChange:e=>s({...o,time:e.target.value}),className:`h-8 font-mono text-xs`})]})]}),o.preset===`custom`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`cron(分 时 日 月 周)`}),(0,U.jsx)(wg,{value:o.cron,onChange:e=>s({...o,cron:e.target.value}),placeholder:`*/30 9-18 * * 1-5`,className:`h-8 font-mono text-xs`})]})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`到点发送的消息`}),(0,U.jsx)(SD,{value:o.message,onChange:e=>s({...o,message:e.target.value}),placeholder:`如:检查当前活跃告警,把高优先级的汇总成一段简报发在这里;有异常升级的单独说明。`,className:`min-h-[88px] text-xs`})]}),(0,U.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`将按 `,(0,U.jsx)(`span`,{className:`font-mono`,children:l(u(o))}),` 触发(本地时区)。`]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:i!==null,onClick:()=>s(null),children:`取消`}),(0,U.jsx)(Y,{disabled:i!==null,onClick:h,children:i?`保存中…`:o?.mode===`add`?`创建任务`:`保存`})]})]})})]})}var PO=[{key:`tool_calls`,label:`工具调用`,icon:(0,U.jsx)(fg,{className:`h-3.5 w-3.5`}),tone:`text-chart-2`},{key:`guardrail_blocks`,label:`守护栏拦截`,icon:(0,U.jsx)(Rh,{className:`h-3.5 w-3.5`}),tone:`text-destructive`},{key:`human_confirms`,label:`人工确认执行`,icon:(0,U.jsx)(up,{className:`h-3.5 w-3.5`}),tone:`text-warning`},{key:`orchestrations`,label:`编排执行`,icon:(0,U.jsx)(Wh,{className:`h-3.5 w-3.5`}),tone:`text-violet-400`},{key:`experiences`,label:`经验回流`,icon:(0,U.jsx)(Sp,{className:`h-3.5 w-3.5`}),tone:`text-success`},{key:`kb_searches`,label:`知识检索`,icon:(0,U.jsx)(Oh,{className:`h-3.5 w-3.5`}),tone:`text-cyan-400`},{key:`ai_drafts`,label:`AI 起草`,icon:(0,U.jsx)(ig,{className:`h-3.5 w-3.5`}),tone:`text-pink-400`}];function FO(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(!1),c=()=>V(`/api/evolution`).then(t);(0,v.useEffect)(()=>{c();let e=setInterval(c,1e4);return()=>clearInterval(e)},[]);let l=async()=>{if(n.trim()){s(!0);try{let e=await V(`/api/kb/search?q=${encodeURIComponent(n)}`);a(e.items),c()}finally{s(!1)}}};return e?(0,U.jsxs)(`div`,{className:`h-full overflow-auto p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-bold`,children:[(0,U.jsx)(ig,{className:`h-5 w-5 text-primary`}),`自进化看板`]}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[e.flywheel_note,` · 数据来自审计日志与指标流的实时聚合`]})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-4 gap-3 xl:grid-cols-7`,children:PO.map(t=>(0,U.jsx)(Gf,{className:`py-3`,children:(0,U.jsxs)(Jf,{className:`px-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[t.icon,t.label]}),(0,U.jsx)(`div`,{className:`mt-1 text-xl font-bold ${t.tone}`,children:e.totals[t.key]??0})]})},t.key))}),(0,U.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4`,children:[(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsx)(qf,{className:`text-xs text-muted-foreground`,children:`飞轮证据 · 检索相似度趋势(回流前后对比)`})}),(0,U.jsx)(Jf,{className:`p-0`,children:(0,U.jsx)(bD,{className:`h-64`,children:(0,U.jsxs)(`div`,{className:`space-y-1.5 p-3`,children:[e.similarity_trend.length===0&&(0,U.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:`尚无检索记录`}),e.similarity_trend.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`w-40 shrink-0 truncate text-muted-foreground`,title:e.query,children:e.query}),(0,U.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:(0,U.jsx)(`div`,{className:`h-full rounded ${e.similarity>=75?`bg-success`:e.similarity>=55?`bg-warning`:`bg-muted-foreground`}`,style:{width:`${e.similarity}%`}})}),(0,U.jsxs)(`span`,{className:`w-9 text-right font-mono ${e.similarity>=75?`text-success`:`text-muted-foreground`}`,children:[e.similarity,`%`]})]},t))]})})})]}),(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsxs)(qf,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(Sp,{className:`h-3.5 w-3.5`}),`经验沉淀(写入 ARM 知识库)`]})}),(0,U.jsx)(Jf,{className:`p-0`,children:(0,U.jsx)(bD,{className:`h-64`,children:(0,U.jsxs)(`div`,{className:`divide-y`,children:[e.experiences.length===0&&(0,U.jsx)(`div`,{className:`p-8 text-center text-xs text-muted-foreground`,children:`尚无回流记录`}),e.experiences.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs`,children:[(0,U.jsx)(fm,{className:`h-3 w-3 shrink-0 text-success`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.title,children:e.title}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground`,children:e.knowledge_id?e.knowledge_id.slice(0,8):`—`}),(0,U.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:Le(e.ts)})]},t))]})})})]})]}),(0,U.jsxs)(`div`,{className:`mt-4 grid grid-cols-3 gap-4`,children:[(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsx)(qf,{className:`text-xs text-muted-foreground`,children:`工具调用分布`})}),(0,U.jsxs)(Jf,{className:`p-3`,children:[Object.keys(e.by_tool).length===0&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`暂无数据`}),Object.entries(e.by_tool).sort((e,t)=>t[1]-e[1]).map(([t,n])=>{let r=Math.max(...Object.values(e.by_tool));return(0,U.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`w-36 shrink-0 truncate font-mono`,children:t}),(0,U.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:(0,U.jsx)(`div`,{className:`h-full rounded bg-chart-2`,style:{width:`${n/r*100}%`}})}),(0,U.jsx)(`span`,{className:`w-6 text-right font-mono`,children:n})]},t)})]})]}),(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsxs)(qf,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(nm,{className:`h-3.5 w-3.5`}),`ARM 知识库实检(真实 RAG)`]})}),(0,U.jsxs)(Jf,{className:`p-3`,children:[(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(wg,{value:n,onChange:e=>r(e.target.value),onKeyDown:e=>e.key===`Enter`&&l(),placeholder:`如:堆垛机 货叉定位偏移`,className:`text-xs`}),(0,U.jsx)(Y,{size:`sm`,disabled:o,onClick:l,children:o?`检索中`:`检索`})]}),(0,U.jsx)(bD,{className:`mt-2 h-44`,children:(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[!i&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`输入问题检索企业经验库(与助手使用同一数据源)`}),i?.length===0&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`无命中`}),i?.map((e,t)=>(0,U.jsxs)(`div`,{className:`rounded-md bg-card px-2.5 py-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[e.similarity!=null&&(0,U.jsxs)(J,{variant:`secondary`,className:`h-4 text-[9px] ${e.similarity>=75?`text-success`:``}`,children:[e.similarity,`%`]}),(0,U.jsx)(`span`,{className:`truncate font-medium`,children:e.title})]}),(0,U.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-[10px] leading-relaxed text-muted-foreground`,children:e.snippet})]},t))]})})]})]}),(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsx)(qf,{className:`text-xs text-muted-foreground`,children:`审计流(实时)`})}),(0,U.jsx)(Jf,{className:`p-0`,children:(0,U.jsx)(bD,{className:`h-52`,children:(0,U.jsx)(`div`,{className:`divide-y font-mono text-[10px]`,children:e.recent_audit.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:Le(e.ts,`t`)}),(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:e.actor}),(0,U.jsx)(`span`,{className:`truncate`,children:e.tool||e.logic||e.action||e.name||e.verdict||``})]},t))})})})]})]})]}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`进化数据加载中…`})}function IO(){let[e,t]=(0,v.useState)(`arm`),n=e===`evolution`||e===`plugins`,[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)({}),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(`auto`),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(``),[ee,M]=(0,v.useState)(!1),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(!1),[L,te]=(0,v.useState)([]),[ne,re]=(0,v.useState)([]),[ie,ae]=(0,v.useState)(!1),[oe,se]=(0,v.useState)(``),[ce,le]=(0,v.useState)(``),[ue,de]=(0,v.useState)(!1),[fe,R]=(0,v.useState)(null),z=()=>{V(`/api/settings`).then(e=>{i(e),c(e.arm.sources||[]),g(e.llm.model),y(e.llm.base_url_runtime?e.llm.base_url:``),C(e.llm.context_tokens_runtime?String(e.llm.context_tokens):``),T(e.llm.vision_mode||`auto`),j(e.scene.profile),te(e.guard.deny),re(e.guard.ro),ae(e.guard.sudo_u_l2)}),V(`/api/arm/status`).then(o).catch(()=>o(null))};(0,v.useEffect)(()=>{z()},[]);let pe=e=>e.online?`连通 ${e.latency_ms}ms`:`不可达:${e.error||``}`,me=async e=>{f(e.id);try{let t=await Oe(`/api/arm/sources/${encodeURIComponent(e.id)}/select`);m(n=>({...n,[e.id]:t.probe})),t.probe.online?Z.success(`当前源已切换为「${e.name}」(${pe(t.probe)})`,{description:`大厅目录、下载、新建、发布、经验回流即时跟随`}):Z.warning(`当前源已切换为「${e.name}」,但${pe(t.probe)}`,{description:`大厅显示本地库;可随时切回其他源`}),z()}catch(e){Z.error(String(e.message))}finally{f(null)}},he=async e=>{f(e.id);try{let t=await Oe(`/api/arm/sources/${encodeURIComponent(e.id)}/probe`);m(n=>({...n,[e.id]:t}))}catch(e){Z.error(String(e.message))}finally{f(null)}},ge=async e=>{if(window.confirm(`删除 ARM 源「${e.name}」?\n不影响已下载的本地助手(它们会显示为「来自 ${e.name}」);若它是当前源,将切回默认源。`)){f(e.id);try{await Ae(`/api/arm/sources/${encodeURIComponent(e.id)}`,{}),Z.success(`已删除源「${e.name}」`),z()}catch(e){Z.error(String(e.message))}finally{f(null)}}},_e=async()=>{let e=l;if(e){f(e.id||`add`);try{if(e.mode===`add`){let t=await Oe(`/api/arm/sources`,{name:e.name.trim(),base:e.base.trim(),token:e.token.trim()});m(e=>({...e,[t.source.id]:t.probe})),t.probe.online?Z.success(`已添加源「${t.source.name}」(${pe(t.probe)})`,{description:`在列表上点「设为当前」或到大厅切换即可使用`}):Z.warning(`已添加源「${t.source.name}」,但${pe(t.probe)}`,{description:`检查地址/令牌,或稍后点「测试连接」`})}else await ke(`/api/arm/sources/${encodeURIComponent(e.id)}`,{name:e.name.trim(),base:e.base.trim(),...e.clearToken?{token:``}:e.token.trim()?{token:e.token.trim()}:{}}),Z.success(`源「${e.name.trim()}」已更新`);u(null),z()}catch(e){Z.error(String(e.message))}finally{f(null)}}},ve=async()=>{D(!0),k(null);try{let e=await ke(`/api/settings`,{llm_model:h.trim(),llm_base_url:_.trim(),llm_context_tokens:S.trim(),llm_vision:w,...b.trim()?{llm_api_key:b.trim()}:{}});x(``),k(e.llm_probe||null),e.llm_probe?.online?Z.success(`模型已切换(探针 ${e.llm_probe.latency_ms}ms:${e.llm_probe.reply||`ok`})`):e.note&&Z.warning(`已保存,但探针未通过`,{description:e.note}),z()}catch(e){Z.error(String(e.message))}finally{D(!1)}},ye=async()=>{I(!0);try{if(await ke(`/api/settings`,{access_token:N}),N.trim()){if(!(await fetch(`/api/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:N.trim()})})).ok)throw Error(`已保存但自动登录失败,刷新后输入令牌进入`);Z.success(`访问令牌已启用(当前浏览器已自动登录)`)}else Z.success(`访问令牌已关闭(恢复开放访问)`);P(``),z()}catch(e){Z.error(String(e.message))}finally{I(!1)}},be=async()=>{M(!0);try{await ke(`/api/settings`,{scene_profile:A}),Z.success(A.trim()?`场景画像已保存,对全部助手即时生效(新对话起)`:`场景画像已清空(不再注入)`),z()}catch(e){Z.error(String(e.message))}finally{M(!1)}},xe=async()=>{de(!0);try{await ke(`/api/settings`,{guard:{deny:L,ro:ne,sudo_u_l2:ie}}),Z.success(`守护栏已更新(危险规则 ${L.length} 条 · 白名单 ${ne.length} 命令),即时生效`),R(null),z()}catch(e){Z.error(String(e.message))}finally{de(!1)}};return(0,U.jsxs)(`div`,{className:`h-full overflow-auto p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-bold`,children:[(0,U.jsx)(Ih,{className:`h-5 w-5 text-primary`}),`系统设置`]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`平台全局配置 · 修改保存后即时生效(无需重启)· 运行时配置优先于 .env`})]}),(0,U.jsxs)(pO,{value:e,onValueChange:t,className:n?``:`max-w-2xl`,children:[(0,U.jsxs)(hO,{children:[(0,U.jsxs)(gO,{value:`arm`,className:`text-xs`,children:[(0,U.jsx)(Mh,{className:`mr-1 h-3.5 w-3.5`}),`ARM 源`,a&&(0,U.jsx)(`span`,{className:`ml-1 h-1.5 w-1.5 rounded-full ${a.online?`bg-success`:`bg-warning`}`})]}),(0,U.jsxs)(gO,{value:`llm`,className:`text-xs`,children:[(0,U.jsx)(wp,{className:`mr-1 h-3.5 w-3.5`}),`LLM 模型服务`]}),(0,U.jsxs)(gO,{value:`scene`,className:`text-xs`,children:[(0,U.jsx)(wm,{className:`mr-1 h-3.5 w-3.5`}),`场景画像`,r&&r.scene.length>0&&(0,U.jsx)(`span`,{className:`ml-1 h-1.5 w-1.5 rounded-full bg-success`})]}),(0,U.jsxs)(gO,{value:`auth`,className:`text-xs`,children:[(0,U.jsx)(Wm,{className:`mr-1 h-3.5 w-3.5`}),`访问安全`,r?.auth.enabled&&(0,U.jsx)(`span`,{className:`ml-1 h-1.5 w-1.5 rounded-full bg-success`})]}),(0,U.jsxs)(gO,{value:`guard`,className:`text-xs`,children:[(0,U.jsx)(Hh,{className:`mr-1 h-3.5 w-3.5`}),`守护栏`,(0,U.jsxs)(`span`,{className:`ml-1 text-[9px] text-muted-foreground`,children:[L.length,`规`]})]}),(0,U.jsxs)(gO,{value:`evolution`,className:`text-xs`,children:[(0,U.jsx)(ig,{className:`mr-1 h-3.5 w-3.5`}),`自进化`]}),(0,U.jsxs)(gO,{value:`plugins`,className:`text-xs`,children:[(0,U.jsx)(gh,{className:`mr-1 h-3.5 w-3.5`}),`插件中心`]})]}),(0,U.jsxs)(_O,{value:`arm`,className:`mt-3`,children:[(0,U.jsxs)(Gf,{className:`mb-3 max-w-2xl`,children:[(0,U.jsxs)(Kf,{className:`pb-2`,children:[(0,U.jsxs)(qf,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(Mh,{className:`h-4 w-4 text-primary`}),`ARM 源`,a&&(0,U.jsx)(J,{variant:`outline`,className:`text-[10px] ${a.online?`text-success`:`text-warning`}`,children:a.online?`在线 · ${a.latency_ms}ms`:`不可达(回落本地库)`})]}),(0,U.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:`ARM 是可私有化部署的资源管理系统(助手档案 + 知识库)。可配置多个源——公司公库、客户私库、本地开发版——并随时切换当前源: 检索 / 下载 / 新建 / 发布 / 经验回流全部即时跟随;已下载的本地助手不受影响,并记住自己来自哪个源。`})]}),(0,U.jsxs)(Jf,{className:`space-y-3`,children:[r&&!r.arm.token_set&&r.arm.token_source===`none`&&(0,U.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/40 bg-warning/10 p-2.5 text-[11px] leading-relaxed text-warning`,children:[(0,U.jsx)(`span`,{className:`shrink-0`,children:`🔑`}),(0,U.jsxs)(`div`,{className:`flex-1`,children:[`当前源「`,r.arm.current_name,`」尚未配置访问令牌——匿名仅能浏览目录,`,(0,U.jsx)(`b`,{children:`下载 / 上岗 / 新建 / 发布 / 经验回流`}),`等操作会被 ARM 拒绝(401/403)。 请登录该 ARM 站点生成访问令牌(arm_pat_… 开头),点该源的编辑按钮粘贴保存。`,(0,U.jsx)(`a`,{href:r.arm.api_base,target:`_blank`,rel:`noreferrer`,className:`ml-1 underline underline-offset-2 hover:text-warning`,children:`打开 ARM 生成令牌 →`})]})]}),(0,U.jsx)(`div`,{className:`divide-y rounded-md border`,children:s.map(e=>{let t=p[e.id],n={runtime:`运行时配置`,env:`env ARM_API_TOKEN`,pat:`~/.arm PAT`,none:``}[e.token_source];return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-2 text-xs ${e.current?`bg-primary/5`:``}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.name}),e.current&&(0,U.jsx)(J,{className:`h-4 px-1 text-[9px]`,children:`当前`}),e.builtin&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,title:`内置默认源:地址/令牌留空时回落 env(ARM_API_BASE / ARM_API_TOKEN)、~/.arm PAT 与内网默认地址;不可删除`,children:`默认`}),t&&(0,U.jsx)(`span`,{className:`text-[10px] ${t.online?`text-success`:`text-warning`}`,children:pe(t)})]}),(0,U.jsxs)(`div`,{className:`truncate font-mono text-[10px] text-muted-foreground`,title:e.base,children:[e.base||`(未配置地址)`,e.builtin&&!e.base_runtime?` · 默认地址`:``]}),(0,U.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[`令牌:`,e.token_set?`${e.token_masked} · ${n}`:`未配置(匿名只读;下载/新建/发布会被拒)`]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[!e.current&&(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 text-[11px]`,disabled:d===e.id,onClick:()=>me(e),title:`设为当前源:大厅目录 / 下载 / 新建 / 发布 / 经验回流即时切换`,children:[(0,U.jsx)(Ap,{className:`mr-1 h-3 w-3`}),`设为当前`]}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,disabled:d===e.id,onClick:()=>he(e),title:`测试连接(不切换)`,children:(0,U.jsx)(ug,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,onClick:()=>u({mode:`edit`,id:e.id,name:e.name,base:e.base_runtime?e.base:``,token:``,builtin:e.builtin,clearToken:!1}),title:`编辑名称 / 地址 / 令牌`,children:(0,U.jsx)(Kh,{className:`h-3.5 w-3.5`})}),!e.builtin&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0 text-destructive hover:text-destructive`,disabled:d===e.id,onClick:()=>ge(e),title:`删除源(不影响已下载的本地助手)`,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})})]})]},e.id)})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(Y,{size:`sm`,className:`text-xs`,onClick:()=>u({mode:`add`,name:``,base:``,token:``,clearToken:!1}),children:[(0,U.jsx)(mh,{className:`mr-1 h-3.5 w-3.5`}),`添加 ARM 源`]}),(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`公库 / 私库并存:从一个源下载助手,在大厅切到另一个源后点卡片「发布」即可推送过去(同 id,身份不变)。`})]})]})]}),(0,U.jsx)(gg,{open:!!l,onOpenChange:e=>{!e&&d===null&&u(null)},children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsxs)(bg,{children:[(0,U.jsxs)(Sg,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(Mh,{className:`h-4 w-4 text-primary`}),l?.mode===`add`?`添加 ARM 源`:`编辑 ARM 源 · ${l?.name}`]}),(0,U.jsx)(Cg,{className:`text-[11px]`,children:`每个源使用自己的访问令牌——不会把一个站点的令牌发给另一个站点。`})]}),l&&(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`名称`}),(0,U.jsx)(wg,{value:l.name,onChange:e=>u({...l,name:e.target.value}),placeholder:`如 公司公库 / 客户私库 / 本地开发版`,className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`站点地址(REST API 根地址)`}),(0,U.jsx)(wg,{value:l.base,onChange:e=>u({...l,base:e.target.value}),placeholder:l.builtin?`留空 = 回落 env / 内置默认(${(r?.arm.default_base||``).replace(/^https?:\/\//,``)})`:`如 http://localhost:3001 或 https://arm.customer.com`,className:`font-mono text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`访问令牌(arm_pat_…)`}),(0,U.jsx)(wg,{type:`password`,value:l.token,disabled:l.clearToken,onChange:e=>u({...l,token:e.target.value}),placeholder:l.mode===`edit`?`留空保持不变`:l.builtin?`留空 = 回落 env / ~/.arm PAT`:`留空 = 匿名只读`,className:`font-mono text-xs`}),l.mode===`edit`&&(0,U.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(MO,{checked:l.clearToken,onCheckedChange:e=>u({...l,clearToken:e,token:e?``:l.token})}),`清除已配置的令牌`,l.builtin?`(回落 env / PAT)`:`(转匿名只读)`]})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:d!==null,onClick:()=>u(null),children:`取消`}),(0,U.jsx)(Y,{disabled:d!==null||!l?.name.trim()||!l?.builtin&&!l?.base.trim(),onClick:_e,children:d?`保存中…`:l?.mode===`add`?`添加并测试连接`:`保存`})]})]})})]}),(0,U.jsx)(_O,{value:`llm`,className:`mt-3`,children:(0,U.jsxs)(Gf,{className:`mb-3 max-w-2xl`,children:[(0,U.jsxs)(Kf,{className:`pb-2`,children:[(0,U.jsxs)(qf,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(wp,{className:`h-4 w-4 text-primary`}),`LLM 模型服务`,r&&(0,U.jsx)(J,{variant:`outline`,className:`text-[10px]`,children:r.llm.model})]}),(0,U.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:`OpenAI 兼容端点:缺省公司内网 bifrost 网关(内网开箱可用),可切换模型 / 自建网关 / 公有云端点。保存后新对话即时使用新模型,应用失败自动回滚。`})]}),(0,U.jsxs)(Jf,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`模型`,r&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:r.llm.model_runtime?`运行时配置`:`默认(.env)`})]}),(0,U.jsx)(wg,{value:h,onChange:e=>g(e.target.value),list:`llm-catalog`,placeholder:`如 def / glm-5.3 / 自定义名称`,className:`font-mono text-xs`}),(0,U.jsx)(`datalist`,{id:`llm-catalog`,children:(r?.llm.catalog||[]).map(e=>(0,U.jsx)(`option`,{value:e},e))})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`text-xs`,children:[`端点地址(留空 = `,r?.llm.default_base||`默认内网 bifrost`,`)`]}),(0,U.jsx)(wg,{value:_,onChange:e=>y(e.target.value),placeholder:`https://your-gateway/v1(OpenAI 兼容)`,className:`font-mono text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`API Key`,r&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:r.llm.key_set?`${r.llm.key_masked} · ${r.llm.key_source}`:`未配置`})]}),(0,U.jsx)(wg,{type:`password`,value:b,onChange:e=>x(e.target.value),placeholder:r?.llm.key_set?`已配置(留空保持不变)`:`sk-… / api key`,className:`font-mono text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`上下文窗口(token)`,r&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:r.llm.context_tokens_source===`runtime`?`运行时配置 ${r.llm.context_tokens}`:r.llm.context_tokens_source===`model`?`自动识别 ${r.llm.context_tokens}`:`默认 ${r.llm.default_context_tokens}`})]}),(0,U.jsx)(wg,{type:`number`,inputMode:`numeric`,min:4e3,max:2e6,step:1e3,value:S,onChange:e=>C(e.target.value),placeholder:`留空 = 按模型自动识别(未识别回落 ${r?.llm.default_context_tokens||128e3})`,className:`font-mono text-xs`}),(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`留空 = 按模型名自动识别(GLM-5.x / MiniMax-M3+ / GPT-4.1 / Gemini → 1M,GLM-4.6 / Claude → 200K,其余常见 128K 档)。会话历史超出窗口时自动丢弃最早轮次(保留当前轮);配大了也不怕——请求若仍报上下文超限,系统会自动收缩历史并重试一次,再失败会给出明确的调低指引。`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`视觉能力(对话附图)`,r&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:r.llm.vision?`当前:支持看图`:`当前:不支持看图`})]}),(0,U.jsxs)(Eg,{value:w,onValueChange:e=>T(e),children:[(0,U.jsx)(Og,{className:`h-8 w-full text-xs`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsxs)(Ag,{value:`auto`,className:`text-xs`,children:[`自动(按模型条目判定:`,r?.llm.vision_auto?`支持`:`不支持`,`)`]}),(0,U.jsx)(Ag,{value:`on`,className:`text-xs`,children:`强制开 — 自定义模型确认支持视觉时`}),(0,U.jsx)(Ag,{value:`off`,className:`text-xs`,children:`强制关 — 图片只存工作区,不送模型`})]})]}),(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`开:对话里粘贴/上传的图片随消息送给模型识别;关:图片仅保存到工作区供助手按路径处理。自定义模型名(如 def)按纯文本模板克隆、无法自动识别能力,请按实际选择。`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Y,{size:`sm`,className:`text-xs`,disabled:E,onClick:ve,children:E?`切换中…`:`保存并测试模型`}),O&&(0,U.jsx)(`span`,{className:`flex items-center gap-1 text-[11px] ${O.online?`text-success`:`text-warning`}`,children:O.online?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Bp,{className:`h-3.5 w-3.5`}),`探针通过 `,O.latency_ms,`ms:`,O.reply]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kp,{className:`h-3.5 w-3.5`}),`未通过:`,O.error]})})]})]})]})}),(0,U.jsx)(_O,{value:`scene`,className:`mt-3`,children:(0,U.jsxs)(Gf,{className:`mb-3 max-w-2xl`,children:[(0,U.jsxs)(Kf,{className:`pb-2`,children:[(0,U.jsxs)(qf,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(wm,{className:`h-4 w-4 text-primary`}),`场景画像`,r&&(0,U.jsx)(J,{variant:`outline`,className:`text-[10px] ${r.scene.length?`text-success`:``}`,children:r.scene.length?`已启用 · ${r.scene.length} 字`:`未配置(不注入)`})]}),(0,U.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[`平台级、全局一份的使用方场景描述(团队环境 / 系统清单 / 规范 / 联系人),作为常驻事实注入`,(0,U.jsx)(`b`,{children:`所有助手`}),`的上下文—— 助手不必每次重新探索环境。与知识检索互补(常驻事实 vs 按需检索)。⚠ 不放凭据:写"凭据在哪、找谁要"即可。`]})]}),(0,U.jsxs)(Jf,{className:`space-y-2`,children:[(0,U.jsx)(`textarea`,{value:A,onChange:e=>j(e.target.value),spellCheck:!1,rows:8,placeholder:`例如:
101
+ `||t===`\r`?(s(),r=2):i+=t),r===3&&i===`!--`&&(r=4,o=o[0])}return s(),o}(e)),t),arguments,[])).length>1?t:t[0]}var MD={primary:`text-primary`,success:`text-success`,warning:`text-warning`,destructive:`text-destructive`,muted:`text-muted-foreground`},ND={primary:`border-primary/40 bg-primary/15 text-primary`,success:`border-success/40 bg-success/15 text-success`,warning:`border-warning/40 bg-warning/15 text-warning`,destructive:`border-destructive/40 bg-destructive/15 text-destructive`,muted:`border-border bg-muted text-muted-foreground`},PD={primary:`bg-primary`,success:`bg-success`,warning:`bg-warning`,destructive:`bg-destructive`,muted:`bg-muted-foreground`},FD={primary:`border-l-primary/85 bg-primary/10`,success:`border-l-success/85 bg-success/10`,warning:`border-l-warning/85 bg-warning/10`,destructive:`border-l-destructive/85 bg-destructive/10`,muted:`border-l-border bg-muted/50`};function ID({title:e,actions:t,flush:n,className:r,children:i}){return(0,U.jsxs)(`div`,{className:B(`rounded-lg border bg-card text-xs text-card-foreground`,n?`p-0`:`p-3`,r),children:[(e||t)&&(0,U.jsxs)(`div`,{className:B(`flex items-center justify-between gap-2`,!n&&`mb-2`,n&&`border-b px-3 py-2`),children:[(0,U.jsx)(`div`,{className:`font-semibold`,children:e}),(0,U.jsx)(`div`,{className:`flex items-center gap-1.5`,children:t})]}),i]})}function LD({tone:e=`muted`,className:t,children:n}){return(0,U.jsx)(`span`,{className:B(`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap`,ND[e],t),children:n})}function RD({variant:e=`secondary`,className:t,...n}){return(0,U.jsx)(`button`,{type:`button`,className:B(`inline-flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50`,{primary:`bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`border bg-secondary text-secondary-foreground hover:bg-accent`,danger:`bg-destructive text-white hover:bg-destructive/90`,ghost:`text-foreground hover:bg-accent`}[e],t),...n})}function zD({label:e,value:t,hint:n,tone:r=`primary`,trend:i,className:a}){let o=(0,v.useRef)(t),[s,c]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let e=o.current;if(o.current=t,e===t||e===void 0)return;c(!0);let n=setTimeout(()=>c(!1),800);return()=>clearTimeout(n)},[t]),(0,U.jsxs)(`div`,{className:B(`rounded-lg border bg-card p-2.5`,a),children:[(0,U.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:B(`mt-0.5 truncate text-base font-semibold tabular-nums transition-colors duration-500`,s?`text-foreground`:MD[r]),children:t}),i&&i.length>=2&&(0,U.jsx)(`div`,{className:`mt-1`,children:(0,U.jsx)(BD,{data:i,tone:r,height:20})}),n!=null&&n!==``&&(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:n})]})}function BD({data:e,tone:t=`chart`,height:n=28,className:r}){let i=e.length;if(!i||i<2)return null;let a=Math.min(...e),o=Math.max(...e)-a||1,s=e.map((e,t)=>`${(t/(i-1)*100).toFixed(2)},${(n-2-(e-a)/o*(n-4)).toFixed(2)}`),c=s[i-1].split(`,`),l=t===`chart`?`text-chart-2`:MD[t];return(0,U.jsxs)(`svg`,{viewBox:`0 0 100 ${n}`,height:n,preserveAspectRatio:`none`,className:B(`w-full overflow-visible`,l,r),"aria-hidden":!0,children:[(0,U.jsx)(`polygon`,{points:`0,${n} ${s.join(` `)} 100,${n}`,fill:`currentColor`,opacity:`0.12`}),(0,U.jsx)(`polyline`,{points:s.join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,U.jsx)(`circle`,{cx:c[0],cy:c[1],r:`2`,fill:`currentColor`})]})}function VD({items:e,className:t}){let n=Math.max(...e.map(e=>e.value),1);return(0,U.jsx)(`div`,{className:B(`space-y-1.5`,t),children:e.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`w-20 shrink-0 truncate text-[10px] text-muted-foreground`,children:e.label}),(0,U.jsx)(`div`,{className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded bg-muted`,children:(0,U.jsx)(`div`,{className:B(`h-full rounded transition-[width]`,PD[e.tone||`primary`]),style:{width:`${Math.max(e.value/n*100,e.value>0?3:0)}%`}})}),(0,U.jsx)(`span`,{className:`w-10 shrink-0 text-right font-mono text-[10px] tabular-nums text-muted-foreground`,children:e.value})]},t))})}function HD({items:e,cell:t=12,gap:n=4,className:r}){return(0,U.jsx)(`div`,{className:B(`grid`,r),style:{gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, 1fr))`,gap:n},children:e.map((e,t)=>(0,U.jsx)(`div`,{title:e.title,className:B(`aspect-square rounded-[3px] transition-colors`,PD[e.tone||`muted`])},t))})}function UD({tone:e=`muted`,pulse:t,className:n}){return(0,U.jsx)(`span`,{className:B(`inline-block h-1.5 w-1.5 shrink-0 rounded-full`,PD[e],t&&`animate-pulse`,n)})}function WD({tone:e=`muted`,title:t,detail:n,meta:r,active:i,onClick:a,className:o,children:s}){let c=(0,v.useRef)(!1),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=c.current;if(c.current=!!i,e||!i)return;u(!0);let t=setTimeout(()=>u(!1),900);return()=>clearTimeout(t)},[i]);let d=!!a;return(0,U.jsxs)(`div`,{onClick:a,role:d?`button`:void 0,tabIndex:d?0:void 0,onKeyDown:d?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a?.())}:void 0,className:B(`rounded-md border border-l-2 p-2 text-xs transition-colors`,FD[e],i&&`ring-2 ring-ring/50`,l&&`animate-pulse ring-ring`,d&&`cursor-pointer hover:border-ring/50 focus-visible:outline-none`,o),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(UD,{tone:e,pulse:e===`destructive`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:t}),r!=null&&r!==``&&(0,U.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground`,children:r})]}),n!=null&&n!==``&&(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:n}),s]})}function GD({text:e=`暂无数据`,className:t}){return(0,U.jsxs)(`div`,{className:B(`flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed p-5 text-center`,t),children:[(0,U.jsxs)(`svg`,{viewBox:`0 0 48 48`,className:`h-10 w-10 text-muted-foreground/50`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`24`,cy:`24`,r:`16`,opacity:`0.5`}),(0,U.jsx)(`circle`,{cx:`24`,cy:`24`,r:`9`,opacity:`0.7`}),(0,U.jsx)(`path`,{d:`M24 24 L37 13`}),(0,U.jsx)(`circle`,{cx:`30.5`,cy:`19`,r:`1.6`,fill:`currentColor`,stroke:`none`})]}),(0,U.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e})]})}function KD({rows:e=3,text:t,className:n}){return(0,U.jsxs)(`div`,{className:B(`space-y-2 p-3`,n),role:`status`,"aria-label":typeof t==`string`?t:`加载中`,children:[Array.from({length:e}).map((e,t)=>(0,U.jsx)(`div`,{className:B(`h-3.5 animate-pulse rounded bg-muted`,t%3==2?`w-2/3`:`w-full`)},t)),t!=null&&t!==``&&(0,U.jsx)(`div`,{className:`pt-1 text-center text-[10px] text-muted-foreground`,children:t})]})}function qD({text:e,className:t}){return(0,U.jsx)(`div`,{className:B(`rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-[11px] text-destructive`,t),children:e?(0,U.jsxs)(U.Fragment,{children:[`加载失败:`,e]}):`加载失败`})}var JD={Card:ID,Badge:LD,Button:RD,Stat:zD,Spark:BD,Bars:VD,Matrix:HD,StatusDot:UD,StatusItem:WD,Empty:GD,Loading:KD,Error:qD},YD=jD.bind(v.createElement),XD=class extends v.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message||e)}}componentDidCatch(e){try{this.props.onError?.(String(e?.message||e))}catch{}}render(){return this.state.err?(0,U.jsxs)(`div`,{className:`p-3 text-[11px] leading-relaxed text-destructive`,children:[`面板运行错误:`,this.state.err,(0,U.jsx)(`br`,{}),`可在「定制工作台」中修正代码后重新发布。`]}):this.props.children}};function ZD(e){return Function(`React`,`html`,`ui`,`useState`,`useEffect`,`useRef`,`useMemo`,`"use strict";\n${e}\n;if (typeof Panel !== "function") throw new Error("插件代码必须定义 function Panel(props)");\nreturn Panel;`)(v,YD,JD,v.useState,v.useEffect,v.useRef,v.useMemo)}function QD(e,t,n){if(e)try{fetch(`/api/panel-error`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,kind:t,message:n})}).catch(()=>{})}catch{}}function $D({code:e,data:t,meta:n}){let r=n?.agentId,i=n?.panelId,a=n?.pluginId,o=(0,v.useMemo)(()=>{let t={agentId:r,panelId:i,pluginId:a};try{return ZD(e)}catch(e){return QD(t,`compile`,String(e.message)),()=>(0,U.jsxs)(`div`,{className:`p-3 text-[11px] text-destructive`,children:[`编译失败:`,String(e.message)]})}},[e,r,i,a]);return(0,U.jsx)(XD,{onError:e=>QD(n,`runtime`,e),children:(0,U.jsx)(o,{...t})})}var eO={activity:up,alert:og,gauge:Sm,list:Bm,chart:Op,box:Ep,cpu:Qp,radar:vh,clipboard:Hp,wrench:fg,message:Xm,puzzle:gh,grid:Im},tO={agent_dialog:Xm,custom:gh,custom_panel:gh,placeholder:Ep,kpi_strip:Sm,realtime_list:Bm,status_grid:Im,action_group:fg,inspection_report:Hp};function nO(e){return eO[String(e.icon||``)]||tO[e.type]||up}var rO=12;function iO({dsl:e,renderPanel:t,renderDialog:n,renderPlaceholder:r,edit:i,className:a,onMaximize:o,renderHeaderActions:s}){let c=(0,v.useRef)(null),l=(0,v.useRef)(null),[u,d]=(0,v.useState)(!1),f=(0,v.useRef)(null),p=(0,v.useRef)(null),m=()=>{if(p.current!==null)return;let e=()=>{let t=c.current,n=f.current;if(t&&n){let e=t.getBoundingClientRect();n.x>e.right-48?t.scrollLeft+=16:n.x<e.left+48&&(t.scrollLeft-=16),n.y>e.bottom-48?t.scrollTop+=16:n.y<e.top+48&&(t.scrollTop-=16)}p.current=requestAnimationFrame(e)};p.current=requestAnimationFrame(e)},h=()=>{p.current!==null&&(cancelAnimationFrame(p.current),p.current=null),f.current=null};(0,v.useEffect)(()=>h,[]);let g=e.panels.reduce((e,t)=>Math.max(e,(t.grid?.y||1)+(t.grid?.h||1)-1),1),_=()=>{let e=c.current?.getBoundingClientRect();return{col:e?(e.width+rO)/12:100,row:e?(e.height+rO)/g:178}},y=(t,n,r)=>{if(!i||t.button!==0)return;t.stopPropagation();let a=e.panels[n].grid||{x:1,y:1,w:6,h:1};l.current={i:n,mode:r,sx:t.clientX,sy:t.clientY,g:{...a},moved:!1},m();try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}},b=e=>{let t=l.current;if(!i||!t)return;f.current={x:e.clientX,y:e.clientY};let n=e.clientX-t.sx,r=e.clientY-t.sy;if(!t.moved&&Math.abs(n)<4&&Math.abs(r)<4)return;t.moved||(t.moved=!0,d(!0));let{col:a,row:o}=_(),s=Math.round(n/a),c=Math.round(r/o);t.mode===`move`?i.onGrid(t.i,{x:Math.min(Math.max(1,t.g.x+s),12-t.g.w+1),y:Math.max(1,t.g.y+c)}):i.onGrid(t.i,{w:Math.min(Math.max(1,t.g.w+s),12-t.g.x+1),h:Math.min(Math.max(1,t.g.h+c),12)})},x=()=>{setTimeout(()=>{l.current=null},0),d(!1),h()},S=t=>{let n=e.panels[t].grid;return n?e.panels.some((e,r)=>{if(r===t)return!1;let i=e.grid;return i?n.x<i.x+i.w&&i.x<n.x+n.w&&n.y<i.y+i.h&&i.y<n.y+n.h:!1}):!1};return(0,U.jsxs)(`div`,{ref:c,className:B(`grid gap-3`,i&&`touch-none select-none`,a),style:{gridTemplateColumns:`repeat(12, minmax(0, 1fr))`,gridTemplateRows:`repeat(${g}, minmax(120px, 1fr))`},onPointerDown:()=>{i&&i.onSelect(null)},children:[i&&u&&(0,U.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-20 opacity-30`,style:{backgroundImage:`linear-gradient(to right, var(--border) 1px, transparent 1px), linear-gradient(to bottom, var(--border) 1px, transparent 1px)`,backgroundSize:`calc((100% + ${rO}px) / 12) 100%, 100% calc((100% + ${rO}px) / ${g})`}}),e.panels.map((e,a)=>{let c=e.grid||{x:1,y:1,w:6,h:1},u=Math.round(c.w/12*100),d=nO(e),f=i&&S(a),p=e.title||(e.type===`agent_dialog`?`诊断对话`:``),m=!i&&p&&!e.bare&&e.type!==`placeholder`,h=e.type===`agent_dialog`?n?n(e):null:e.type===`placeholder`?r?r(e):null:t(e);return(0,U.jsxs)(`div`,{style:{gridColumn:`${c.x} / span ${c.w}`,gridRow:`${c.y} / span ${c.h}`,animationDelay:`${Math.min(a*45,360)}ms`},title:f?`与其他面板重叠——拖动错开或调整大小`:void 0,className:B(`group relative flex min-h-0 flex-col overflow-hidden rounded-lg motion-safe:animate-in motion-safe:fade-in-0 motion-safe:zoom-in-95 motion-safe:slide-in-from-bottom-1 motion-safe:fill-mode-both motion-safe:duration-300`,i?i.sel===a?`border border-primary bg-card ring-2 ring-primary/50`:e.bare?`border border-dashed border-border/60 bg-card hover:border-primary/50`:`border border-border bg-card hover:border-primary/50`:e.bare?`border-transparent bg-transparent`:`border border-border bg-card`,f&&`outline-2 outline-dashed outline-warning/80`,i&&`cursor-grab active:cursor-grabbing`),onPointerDown:e=>{i&&(e.stopPropagation(),i.onSelect(a),y(e,a,`move`))},onDoubleClick:()=>{i?.onAICustomize&&!l.current?.moved&&i.onAICustomize(a)},onPointerMove:b,onPointerUp:x,onPointerCancel:x,children:[m&&(0,U.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,U.jsx)(d,{className:`h-3.5 w-3.5 shrink-0 text-primary/80`}),(0,U.jsx)(`span`,{className:`truncate text-xs font-medium`,children:p}),e.subtitle?(0,U.jsx)(`span`,{className:`min-w-0 truncate text-[10px] text-muted-foreground`,children:String(e.subtitle)}):null,(0,U.jsxs)(`div`,{className:`ml-auto flex min-w-0 items-center gap-1.5`,children:[o&&(0,U.jsx)(`button`,{onClick:e=>{e.stopPropagation(),o(a)},className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground/60 opacity-0 transition-all hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100`,title:`全屏查看(ESC 退出)`,children:(0,U.jsx)(Km,{className:`h-3 w-3`})}),s?.(e)]})]}),i&&(0,U.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 flex items-center gap-1.5 border-b bg-background/85 px-2 py-1 text-[10px] backdrop-blur-sm`,children:[(0,U.jsx)(d,{className:`h-3 w-3 shrink-0 text-primary/80`}),(0,U.jsx)(`span`,{className:`font-medium`,children:e.title}),f&&(0,U.jsx)(`span`,{className:`shrink-0 text-warning`,title:`与其他面板重叠`,children:`⚠ 重叠`}),(0,U.jsx)(J,{variant:`secondary`,className:`h-4 px-1 text-[9px]`,children:e.panel||e.type}),i.sel===a&&i.onAICustomize&&(0,U.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i.onAICustomize(a)},className:`pointer-events-auto ml-auto flex h-5 shrink-0 items-center gap-1 rounded bg-ai px-1.5 text-[10px] font-medium text-white transition-colors hover:bg-ai/85`,title:`把这个区块锁定为 AI 定制目标(双击面板同效)`,children:[(0,U.jsx)(Wh,{className:`h-2.5 w-2.5`}),`AI 定制`]}),(0,U.jsxs)(`span`,{className:B(`font-mono text-muted-foreground tabular-nums`,i.sel===a&&i.onAICustomize&&`ml-1.5`),children:[u,`%宽·`,c.h,`行`]})]}),(0,U.jsx)(`div`,{className:B(`min-h-0 flex-1 overflow-auto`,i&&`pointer-events-none pt-4`),children:h}),i&&(0,U.jsx)(`span`,{onPointerDown:e=>y(e,a,`resize`),onPointerMove:b,onPointerUp:x,onPointerCancel:x,className:`absolute -bottom-1 -right-1 z-10 flex h-7 w-7 cursor-nwse-resize items-center justify-center rounded-tl-md border-b border-r border-primary/60 bg-primary/25 hover:bg-primary/50`,title:`拖拽调大小(当前 ${u}% 宽 · ${c.h} 行)`,children:(0,U.jsx)(Km,{className:`h-3 w-3 translate-x-[5px] translate-y-[5px] text-primary`})})]},e.id)})]})}function aO(){return(0,U.jsxs)(`div`,{className:`relative mb-0.5 h-3.5 select-none text-[8px] text-muted-foreground`,children:[(0,U.jsx)(`div`,{className:`grid h-full grid-cols-12`,children:[...Array(12)].map((e,t)=>(0,U.jsx)(`div`,{className:`border-l border-border/60 pl-0.5 pt-0.5 font-mono`,children:t+1},t))}),[25,50,75].map(e=>(0,U.jsxs)(`span`,{className:`absolute -top-0 font-mono`,style:{left:`${e}%`},children:[e,`%`]},e))]})}function oO({open:e,onOpenChange:t,onPick:n}){let[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),l=e=>{o(!0),c(``),V(`/api/fs/dirs${e?`?path=${encodeURIComponent(e)}`:``}`).then(e=>i(e)).catch(e=>c(String(e.message))).finally(()=>o(!1))};return(0,v.useEffect)(()=>{e&&!r&&l()},[e]),(0,U.jsx)(gg,{open:e,onOpenChange:t,children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsx)(bg,{children:(0,U.jsx)(Sg,{children:`选择工作区目录`})}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 gap-1 px-2 text-[11px]`,disabled:!r?.parent,onClick:()=>r?.parent&&l(r.parent),title:`上级目录`,children:[(0,U.jsx)(bp,{className:`h-3 w-3`}),`上级`]}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 gap-1 px-2 text-[11px]`,onClick:()=>l(),children:[(0,U.jsx)(Em,{className:`h-3 w-3`}),`主目录`]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate rounded-md border bg-muted/40 px-2 py-1.5 font-mono text-[11px] text-muted-foreground`,title:r?.path,children:r?.path||`…`})]}),(0,U.jsxs)(bD,{className:`h-64 rounded-md border`,children:[a&&(0,U.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(Hm,{className:`h-4 w-4 animate-spin`}),`读取中…`]}),!a&&s&&(0,U.jsx)(`div`,{className:`p-3 text-xs text-destructive`,children:s}),!a&&!s&&r&&r.dirs.length===0&&(0,U.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`此目录下没有子目录——可直接点「选择当前目录」。`}),!a&&!s&&r&&r.dirs.map(e=>(0,U.jsxs)(`button`,{onClick:()=>l(`${r.path}/${e}`),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs hover:bg-accent`,children:[(0,U.jsx)(bm,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate`,children:e})]},e))]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:()=>t(!1),children:`取消`}),(0,U.jsxs)(Y,{className:`gap-1`,disabled:!r||a,onClick:()=>{r&&(n(r.path),t(!1))},children:[(0,U.jsx)(Ap,{className:`h-3.5 w-3.5`}),`选择当前目录`]})]})]})})}var sO={read_panel_plugin:`读取插件代码`,write_panel_plugin:`编写面板插件`,update_workbench:`点亮画布布局`,create_collection:`创建数据集`,exec:`探索与验证`,data_query:`查询数据`,data_write:`写入数据`,search_knowledge:`检索知识经验`,save_experience:`沉淀经验`},cO=e=>sO[e]||e;function lO({steps:e,status:t,lit:n,inline:r,onClose:i}){return!e.length&&!n?null:(0,U.jsxs)(`div`,{className:B(`rounded-xl border bg-background/92 p-3 shadow-xl backdrop-blur-md`,r?`relative w-full`:`pointer-events-auto absolute bottom-3 left-1/2 z-30 w-72 -translate-x-1/2`,`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-2 motion-safe:duration-300`,n?`border-success/50 shadow-success/10`:`border-border shadow-ai/10`),children:[(0,U.jsxs)(`div`,{className:B(`mb-1.5 flex items-center gap-1.5 text-xs font-semibold`,n?`text-success`:`text-ai`),children:[n?(0,U.jsx)(Wh,{className:`h-3.5 w-3.5 shrink-0`}):(0,U.jsx)(Hm,{className:`h-3.5 w-3.5 shrink-0 animate-spin`}),(0,U.jsx)(`span`,{className:`truncate`,children:n?`画布已点亮——审阅后发布生效`:`定制进行中…`}),i&&(0,U.jsx)(`button`,{onClick:i,className:`ml-auto shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground`,title:`收起`,children:`×`})]}),(0,U.jsx)(`div`,{className:`space-y-1`,children:e.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[e.state===`done`?(0,U.jsx)(Ap,{className:`h-3 w-3 shrink-0 text-success`}):(0,U.jsx)(Hm,{className:`h-3 w-3 shrink-0 animate-spin text-ai`}),(0,U.jsx)(`span`,{className:B(`truncate`,e.state===`done`?`text-muted-foreground`:`text-foreground`),children:e.label})]},t))}),t&&!n&&(0,U.jsx)(`div`,{className:`mt-1.5 truncate border-t pt-1.5 text-[10px] text-muted-foreground`,children:t})]})}function uO({agentId:e,open:t,onClose:n,onPreview:r,onPublished:i}){let a=(0,v.useRef)(`dev-${e.slice(0,8)}`),o=(0,v.useRef)(null),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)({steps:[]}),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),w=(0,v.useRef)(null),T=(0,v.useRef)(!0);(0,v.useEffect)(()=>{T.current&&w.current&&(w.current.scrollTop=w.current.scrollHeight)}),(0,v.useEffect)(()=>{if(d||_||!h.steps.length)return;let e=setTimeout(()=>g({steps:[]}),2500);return()=>clearTimeout(e)},[d,_,h]),(0,v.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&!d&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,d,n]);let E=(0,v.useCallback)(async()=>{let t=l.trim();if(!t||d)return;u(``),f(!0),y(!1),x(null),g({steps:[]}),T.current=!0,c(e=>[...e,{role:`user`,text:t}]);let n=!1,r=!1,i=new AbortController;o.current=i;try{await je(`/api/dev/chat`,{sessionId:a.current,agentId:e,message:t},t=>{let i=t.type;i===`status`?m(String(t.text||``)):i===`text_delta`?(r=!0,m(``),c(e=>{let n=e[e.length-1];return n?.role===`agent`?[...e.slice(0,-1),{role:`agent`,text:n.text+String(t.delta)}]:[...e,{role:`agent`,text:String(t.delta)}]})):i===`tool_start`?(n=!0,g(e=>({steps:[...e.steps,{label:cO(String(t.tool)),state:`active`}]}))):i===`tool_end`?g(e=>{let n=[...e.steps],r=cO(String(t.tool));for(let e=n.length-1;e>=0;e--)if(n[e].label===r&&n[e].state===`active`){n[e]={...n[e],state:`done`};break}return{steps:n}}):i===`done`?!r&&!n&&c(e=>[...e,{role:`agent`,text:`(模型返回了空回复——请重试)`}]):i===`interrupted`?c(e=>[...e,{role:`agent`,text:`(已中断)`}]):i===`meta`?t.hasDraft&&(y(!0),V(`/api/workbench?agent_id=${e}&draft=1`).then(e=>x(e.dsl)).catch(()=>{})):i===`error`&&Z.error(String(t.message))},i.signal)}catch(e){i.signal.aborted?c(e=>[...e,{role:`agent`,text:`(已中断)`}]):c(t=>[...t,{role:`agent`,text:`❌ ${String(e.message)}`}])}finally{m(``),f(!1),o.current===i&&(o.current=null)}},[l,d,e]),D=async t=>{if(t===`preview`&&b)r(b),n();else{C(t);try{if(t===`publish`){let t=await ke(`/api/workbench`,{agent_id:e,dsl:b||(await V(`/api/workbench?agent_id=${e}&draft=1`)).dsl});Z.success(`已发布 ${t.dsl.version},工位即时生效 ✨`),i(t.dsl),x(null),y(!1),g({steps:[]}),n()}else t===`discard`&&(await Ae(`/api/workbench/draft`,{agent_id:e}),Z.info(`已放弃草稿`),x(null),y(!1))}catch(e){Z.error(String(e.message))}finally{C(null)}}};return t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/30 backdrop-blur-[1px]`,onClick:()=>{d||n()}}),(0,U.jsxs)(`div`,{className:`fixed inset-y-0 right-0 z-50 flex w-[400px] max-w-[92vw] flex-col border-l bg-background shadow-2xl motion-safe:animate-in motion-safe:slide-in-from-right-4 motion-safe:duration-300`,children:[(0,U.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2 border-b px-4`,children:[(0,U.jsx)(Wh,{className:`h-4 w-4 text-ai`}),(0,U.jsx)(`span`,{className:`text-sm font-semibold`,children:`AI 定制工位`}),(0,U.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`说需求 → 看着界面长出来`}),(0,U.jsx)(`button`,{onClick:n,disabled:d,className:`ml-auto rounded p-1 text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40`,title:d?`定制进行中,先停止再关闭`:`关闭(ESC)`,children:`✕`})]}),(0,U.jsxs)(`div`,{ref:w,className:`min-h-0 flex-1 space-y-2.5 overflow-y-auto p-3`,children:[s.length===0&&(0,U.jsxs)(`div`,{className:`rounded-lg border border-dashed border-ai/30 bg-ai/5 p-3 text-[11px] leading-relaxed text-muted-foreground`,children:[`直接说,比如:`,(0,U.jsx)(`b`,{className:`text-foreground`,children:`「右上加一个最近记录」`}),`「把列表换成状态点阵」「加一个统计图」。改动先进草稿,你确认才发布。`]}),s.map((e,t)=>(0,U.jsx)(`div`,{className:e.role===`user`?`ml-auto max-w-[88%] rounded-lg bg-primary/20 px-2.5 py-1.5 text-xs whitespace-pre-wrap break-words`:`max-w-full rounded-lg bg-card px-2.5 py-1.5 text-xs leading-relaxed whitespace-pre-wrap break-words`,children:e.text},t)),(d||p)&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-primary`}),p||`开发中…`]}),(0,U.jsx)(lO,{inline:!0,steps:h.steps,status:p,lit:_,onClose:()=>{g({steps:[]}),y(!1)}}),_&&b&&(0,U.jsxs)(`div`,{className:`rounded-lg border border-success/40 bg-success/10 p-2.5`,children:[(0,U.jsxs)(`div`,{className:`text-[11px] font-semibold text-success`,children:[`✨ 草稿已生成(`,b.panels.length,` 个面板)`]}),(0,U.jsxs)(`div`,{className:`mt-1.5 flex gap-1.5`,children:[(0,U.jsx)(Y,{size:`sm`,className:`h-7 gap-1 text-[11px]`,disabled:S!==null,onClick:()=>D(`preview`),children:S===`preview`?`打开中…`:`在工位上预览`}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-7 text-[11px]`,disabled:S!==null,onClick:()=>D(`publish`),children:S===`publish`?`发布中…`:`直接发布`}),(0,U.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 gap-1 text-[11px] text-muted-foreground`,disabled:S!==null,onClick:()=>D(`discard`),children:[(0,U.jsx)(ng,{className:`h-3 w-3`}),`放弃`]})]})]})]}),(0,U.jsxs)(`div`,{className:`shrink-0 border-t p-2`,children:[(0,U.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),rows:2,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),E())},placeholder:`描述想要的界面…(Enter 发送,Shift+Enter 换行)`,className:`min-h-[52px] w-full resize-none rounded-md border bg-background px-2 py-1.5 text-xs`}),(0,U.jsxs)(`div`,{className:`mt-1 flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`与「定制工作台」共享会话上下文`}),d?(0,U.jsxs)(Y,{size:`sm`,variant:`destructive`,className:`h-7 gap-1 text-xs`,onClick:()=>o.current?.abort(),children:[(0,U.jsx)(Jh,{className:`h-3 w-3`}),`停止`]}):(0,U.jsxs)(Y,{size:`sm`,className:`h-7 gap-1 text-xs`,disabled:!l.trim(),onClick:E,children:[(0,U.jsx)(Ah,{className:`h-3 w-3`}),`发送`]})]})]})]})]}):null}function dO(e=1023){let[t,n]=(0,v.useState)(()=>{try{return window.matchMedia(`(max-width: ${e}px)`).matches}catch{return!1}});return(0,v.useEffect)(()=>{let t=window.matchMedia(`(max-width: ${e}px)`),r=()=>n(t.matches);return t.addEventListener?.(`change`,r),window.addEventListener(`resize`,r),()=>{t.removeEventListener?.(`change`,r),window.removeEventListener(`resize`,r)}},[e]),t}function fO({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,U.jsx)(of,{"data-slot":`separator`,decorative:n,orientation:t,className:B(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}function pO({className:e,orientation:t=`horizontal`,...n}){return(0,U.jsx)(Pf,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:B(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var mO=He(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function hO({className:e,variant:t=`default`,...n}){return(0,U.jsx)(If,{"data-slot":`tabs-list`,"data-variant":t,className:B(mO({variant:t}),e),...n})}function gO({className:e,...t}){return(0,U.jsx)(Rf,{"data-slot":`tabs-trigger`,className:B(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function _O({className:e,...t}){return(0,U.jsx)(Bf,{"data-slot":`tabs-content`,className:B(`flex-1 outline-none`,e),...t})}async function vO(e,t){let n=e.usage.length?`插件「${e.name}」被 ${e.usage.length} 处引用,删除将从这些工作台摘除该面板。确认删除?`:`删除插件「${e.name}」?`;if(window.confirm(n))try{await Ae(`/api/panels`,{id:e.id,force:!0}),Z.success(`已删除`),t()}catch(e){Z.error(String(e.message))}}function yO({target:e,onClose:t,agents:n}){let[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(!0),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!e){i(null);return}let n=e.type===`panel`?`id=${encodeURIComponent(e.id||``)}`:`agentId=${encodeURIComponent(e.agentId||``)}`;V(`/api/assets/preview?type=${e.type}&${n}`).then(e=>{i(e),o(e.name)}).catch(e=>{Z.error(String(e.message)),t()})},[e]);let d=async()=>{if(e){u(!0);try{let n=await Oe(`/api/assets/share`,{type:e.type,id:e.id,agentId:e.agentId,name:a,bind_agent:s&&e.agentId?e.agentId:void 0}),i=r?.manifest.requires.apis.length||0,o=r?.manifest.requires.actions.length||0;n.bind_error?Z.warning(`已发布 ${n.name}@${n.version},但绑定助手失败`,{description:`${n.bind_error}——仅助手创建者或管理员可绑定 UI 资产,可在 ARM 助手详情页手动绑定`}):Z.success(`已发布 ${n.name}@${n.version}${n.bound?`,已绑定到助手`:``}`,{description:`外部 API ×${i} · 交互脚本 ×${o}${o?`(命令全文已在 ARM 资产包 SKILL.md 留档)`:``}`}),t()}catch(e){Z.error(String(e.message))}finally{u(!1)}}};if(!e)return null;let f=r?.manifest.requires;return(0,U.jsx)(gg,{open:!!e,onOpenChange:e=>{!e&&!l&&t()},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Jp,{className:`h-4 w-4 text-primary`}),`发布为 UI 资产 · `,e.title]})}),(0,U.jsx)(bD,{className:`max-h-96`,children:(0,U.jsxs)(`div`,{className:`space-y-3 pr-2 text-xs`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`资产名(全局唯一锚,同名发布追加新版本)`}),(0,U.jsx)(wg,{value:a,onChange:e=>o(e.target.value),className:`font-mono text-xs`})]}),r&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-2.5`,children:[(0,U.jsx)(`div`,{className:`font-medium`,children:`包含内容`}),(0,U.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`面板插件:`,r.manifest.provides.panels.join(`、`)||`无`,(0,U.jsx)(`br`,{}),`数据集 schema:`,r.manifest.provides.collections.join(`、`)||`无`,`(仅建表定义,不含数据)`,r.manifest.provides.workbench&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`br`,{}),`工作台 DSL:workbench.json`]})]}),(0,U.jsx)(`div`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:r.files.join(` · `)})]}),!!f?.apis.length&&(0,U.jsxs)(`div`,{className:`rounded-md border border-blue-500/30 bg-blue-500/5 p-2.5`,children:[(0,U.jsx)(`div`,{className:`font-medium text-blue-300`,children:`外部 API 依赖(安装后环境需可达)`}),(0,U.jsx)(`ul`,{className:`mt-1 list-disc pl-4 text-muted-foreground`,children:f.apis.map(e=>(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`span`,{className:`font-mono`,children:e.host}),`:`,e.usage]},e.host))})]}),!!f?.actions.length&&(0,U.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:[(0,U.jsx)(`div`,{className:`font-medium text-warning`,children:`交互脚本(真实 shell 命令,随包公开)`}),(0,U.jsx)(`ul`,{className:`mt-1 space-y-1`,children:f.actions.map(e=>(0,U.jsxs)(`li`,{className:`text-muted-foreground`,children:[`[`,e.panel,`/`,e.id,`] `,e.label,e.has_credentials&&(0,U.jsx)(J,{className:`ml-1 h-4 bg-warning/15 px-1 text-[9px] text-warning`,children:`⚠️ 疑似含凭据`}),(0,U.jsx)(`div`,{className:`mt-0.5 break-all rounded bg-muted/50 p-1 font-mono text-[10px]`,children:e.exec})]},`${e.panel}/${e.id}`))}),(0,U.jsx)(`p`,{className:`mt-1.5 text-[10px] text-warning`,children:`命令明文将进入资产包——含密码/令牌的命令请先改用环境变量或凭据占位,再发布。`})]}),e.agentId&&n&&n.length>0&&(0,U.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border p-2.5`,children:[(0,U.jsx)(hg,{checked:s,onCheckedChange:e=>c(!!e)}),(0,U.jsx)(`span`,{children:`发布后同时绑定到当前助手(下载该助手的其他现场将自动物化此工作台)`})]})]})]})}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:l,onClick:t,children:`取消`}),(0,U.jsx)(Y,{disabled:l||!a,onClick:d,children:l?`发布中…`:`发布到 ARM`})]})]})})}function bO({open:e,onClose:t,onInstalled:n,agents:r}){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(``),m=(0,v.useRef)(0);(0,v.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{let e=++m.current;l(!0),V(`/api/assets/arm-library${i?`?keyword=${encodeURIComponent(i)}`:``}`).then(t=>{e===m.current&&s(t.items||[])}).catch(e=>Z.error(String(e.message))).finally(()=>{e===m.current&&l(!1)})},400);return()=>clearTimeout(t)},[i,e]),(0,v.useEffect)(()=>{e&&!f&&r.length&&p(r[0].agent_id)},[e,r]);let h=async e=>{if(e.asset_type===`workbench`&&!f)Z.warning(`请先选择目标助手`);else{d(e.name);try{let r=await Oe(`/api/assets/install`,{name:e.name,agentId:e.asset_type===`workbench`?f:void 0}),i=r.workbench?`,工作台已导入为草稿(审阅后在「定制工作台」发布)`:``,a=r.skipped_collections.length?`;同名数据集保留本地:${r.skipped_collections.join(`、`)}`:``;Z.success(`已安装 ${e.name}:面板 ×${r.panels.length}${i}${a}`),n(),t()}catch(e){Z.error(String(e.message))}finally{d(null)}}};return(0,U.jsx)(gg,{open:e,onOpenChange:e=>{!e&&!u&&t()},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Im,{className:`h-4 w-4 text-primary`}),`从 ARM 安装 UI 资产`]})}),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(Oh,{className:`absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground`}),(0,U.jsx)(wg,{placeholder:`搜索资产名 / 描述…`,value:i,onChange:e=>a(e.target.value),className:`pl-9`,autoFocus:!0})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`shrink-0`,children:`工作台资产安装到:`}),(0,U.jsx)(`select`,{value:f,onChange:e=>p(e.target.value),className:`h-8 flex-1 rounded-md border bg-background px-2 text-xs`,children:r.map(e=>(0,U.jsx)(`option`,{value:e.agent_id,children:e.name},e.agent_id))})]}),(0,U.jsx)(bD,{className:`max-h-80`,children:(0,U.jsxs)(`div`,{className:`space-y-1.5 pr-2`,children:[c&&!o.length&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`加载中…`}),!c&&!o.length&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:i?`没有匹配资产`:`ARM 上暂无 UI 资产`}),o.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md border p-2.5`,children:[e.asset_type===`workbench`?(0,U.jsx)(Im,{className:`h-4 w-4 shrink-0 text-violet-400`}):(0,U.jsx)(gh,{className:`h-4 w-4 shrink-0 text-primary`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium`,children:[(0,U.jsx)(`span`,{className:`truncate font-mono`,children:e.name}),e.latest_version&&(0,U.jsx)(J,{variant:`secondary`,className:`h-4 px-1 text-[9px]`,children:e.latest_version}),e.installed&&(0,U.jsx)(J,{className:`h-4 bg-success/15 px-1 text-[9px] text-success`,children:`本地已有`}),e.upgrade_available&&(0,U.jsx)(J,{className:`h-4 bg-warning/15 px-1 text-[9px] text-warning`,children:`⤴ 可升级`})]}),(0,U.jsxs)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:[e.description||`—`,` · 下载 `,e.download_count,` 次 · `,e.publisher]})]}),(0,U.jsx)(Y,{size:`sm`,variant:`secondary`,className:`h-7 text-[11px]`,disabled:u!==null,onClick:()=>h(e),children:u===e.name?`安装中…`:`安装`})]},e.name))]})}),(0,U.jsx)(xg,{children:(0,U.jsx)(Y,{variant:`outline`,onClick:t,children:`关闭`})})]})})}function xO(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(`library`),[c,l]=(0,v.useState)([]),u=()=>V(`/api/plugins/center`).then(t);if((0,v.useEffect)(()=>{u(),V(`/api/agents`).then(e=>l((e.agents||[]).filter(e=>e.installed).map(({agent_id:e,name:t})=>({agent_id:e,name:t})))).catch(()=>{})},[]),!e)return(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`插件中心加载中…`});let d=async(e,t,n)=>{let r=n===`deprecated`?`active`:`deprecated`;try{await Oe(`/api/plugins/lifecycle`,{kind:e,id:t,status:r}),Z.success(r===`deprecated`?`已停用(存量引用仍可渲染,新增被阻止)`:`已恢复`),u()}catch(e){Z.error(String(e.message))}},f=({icon:e,name:t,sub:n,status:r,usage:i,onToggle:a,tag:o,onDelete:s,onShare:c,armRef:l})=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md border p-2.5`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium`,children:[e,t,(0,U.jsx)(J,{variant:`secondary`,className:`h-4 px-1 text-[9px]`,children:o}),(0,U.jsx)(J,{className:`h-4 px-1 text-[9px] ${r===`deprecated`?`bg-destructive/15 text-destructive hover:bg-destructive/25`:`bg-success/15 text-success hover:bg-success/25`}`,children:r===`deprecated`?`已停用`:`在用`}),l&&(0,U.jsxs)(J,{className:`h-4 bg-violet-500/15 px-1 text-[9px] text-violet-300`,title:`ARM ${l.skill_name}@${l.version||``}`,children:[`已发布`,l.version?` ${l.version}`:``]})]}),(0,U.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:n}),(0,U.jsxs)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:[`引用:`,i.length?i.map(e=>`${e.agent}${e.draft?`*`:``}`).join(`、`):`无`]})]}),c&&(0,U.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 text-[11px] text-violet-400`,onClick:c,title:`发布到 ARM UI 资产市场`,children:[(0,U.jsx)(Jp,{className:`h-3 w-3`}),l?`更新`:`发布`]}),s&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 text-[11px] text-destructive`,onClick:s,children:`删除`}),(0,U.jsx)(Y,{size:`sm`,variant:r===`deprecated`?`secondary`:`ghost`,className:`h-7 text-[11px] ${r===`deprecated`?``:`text-destructive`}`,onClick:a,children:r===`deprecated`?`恢复`:`停用`})]});return(0,U.jsxs)(`div`,{className:`h-full overflow-auto p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-bold`,children:[(0,U.jsx)(gh,{className:`h-5 w-5 text-primary`}),`插件中心`]}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[`统一注册表:系统面板与契约插件同源治理 · 生命周期(在用/停用)· 引用追踪(* 为草稿引用)· `,(0,U.jsx)(`span`,{className:`text-violet-400`,children:`发布/安装 ARM UI 资产(三资产模型)`})]})]}),(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(pO,{value:o,onValueChange:e=>s(e),children:(0,U.jsxs)(hO,{className:`h-7 p-0.5`,children:[(0,U.jsxs)(gO,{value:`library`,className:`h-6 gap-1 px-3 text-[11px]`,title:`AI 开发 / ARM 安装 / 人工沉淀`,children:[(0,U.jsx)(wp,{className:`h-3 w-3`}),`插件库`,(0,U.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:e.library.length})]}),(0,U.jsxs)(gO,{value:`system`,className:`h-6 gap-1 px-3 text-[11px]`,title:`平台预装`,children:[(0,U.jsx)(um,{className:`h-3 w-3`}),`系统插件`,(0,U.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:e.system.length})]})]})}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 gap-1 text-[11px]`,onClick:()=>a(!0),children:[(0,U.jsx)(Im,{className:`h-3 w-3`}),`从 ARM 安装`]})]})}),(0,U.jsx)(Jf,{className:`p-3`,children:(0,U.jsx)(`div`,{className:`space-y-1.5`,children:o===`library`?(0,U.jsxs)(U.Fragment,{children:[e.library.map(e=>(0,U.jsx)(f,{icon:(0,U.jsx)(gh,{className:`h-3 w-3 text-primary`}),name:`${e.name} ${e.version}`,sub:`${e.author===`ai`?`AI 开发`:e.author===`arm`?`ARM 安装`:`人工`} · ${e.description||e.id}`,status:e.status,usage:e.usage,tag:e.author===`ai`?`ai`:e.author===`arm`?`arm`:`human`,onToggle:()=>d(`plugin`,e.id,e.status),onDelete:()=>vO(e,u),onShare:()=>r({type:`panel`,id:e.id,title:e.name}),armRef:e.arm_ref},e.id)),e.library.length===0&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`插件库为空`})]}):(0,U.jsxs)(U.Fragment,{children:[e.system.map(e=>(0,U.jsx)(f,{icon:(0,U.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.id}),name:e.name,sub:e.note,status:e.status,usage:e.usage,tag:`system`,onToggle:()=>d(`system`,e.id,e.status)},e.id)),e.system.length===0&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`暂无系统插件`})]})})})]}),(0,U.jsx)(fO,{className:`my-4`}),(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsxs)(qf,{className:`flex items-center gap-1.5 text-xs`,children:[(0,U.jsx)(Bh,{className:`h-3.5 w-3.5`}),`治理策略`]})}),(0,U.jsx)(Jf,{className:`p-3 text-[11px] leading-relaxed text-muted-foreground`,children:(0,U.jsx)(bD,{className:`max-h-40`,children:(0,U.jsxs)(`ul`,{className:`list-disc space-y-1 pl-4`,children:[(0,U.jsx)(`li`,{children:`一切面板进同一注册表:系统插件也有 manifest 与生命周期,不再是编译进前端的二等公民`}),(0,U.jsx)(`li`,{children:`停用(deprecate)不破坏存量:已引用的工作台继续渲染,但编辑器「添加面板」不再出现——安全下线`}),(0,U.jsx)(`li`,{children:`入库强制过校验器(check-panel.mjs):编译/契约/沙箱/模板四关 + 质量警告入审计——ARM 安装的插件同样过检`}),(0,U.jsx)(`li`,{children:`出网最小化:/api/proxy 仅放行插件代码中声明过的主机(防止面板成为任意内网跳板)`}),(0,U.jsx)(`li`,{children:`版本化与回滚:插件独立版本(同 id 覆盖自增),工作台按 id 引用,升级即时生效可回滚`}),(0,U.jsx)(`li`,{children:`数据隔离:插件数据集按助手分库(store-助手ID.db),共享需显式 scope=shared;资产包只带 schema 不带数据`}),(0,U.jsx)(`li`,{children:`UI 资产四红线(docs/08):包非运行时 · 数据必走 collection · 外部依赖必声明 · 单向 DAG`})]})})})]}),(0,U.jsx)(yO,{target:n,onClose:()=>{r(null),u()},agents:c}),(0,U.jsx)(bO,{open:i,onClose:()=>a(!1),onInstalled:u,agents:c})]})}function SO({agentId:e,onName:t,onEdit:n}){let[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(2),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(null),[ee,M]=(0,v.useState)(null),[N,P]=(0,v.useState)(!1),[F,I]=(0,v.useState)(null),[L,te]=(0,v.useState)(()=>{try{return+(localStorage.getItem(`aims.view.${e}`)||0)||0}catch{return 0}}),[ne,re]=(0,v.useState)(0),[ie,ae]=(0,v.useState)(null),oe=dO();(0,v.useEffect)(()=>{if(A===null)return;let e=e=>{e.key===`Escape`&&j(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[A]);let se=(0,v.useMemo)(()=>p?.workspaces.find(e=>e.id===p.current)||null,[p]),ce=se?.id||`default`,le=(0,v.useMemo)(()=>`chat-${e}-${ce}`,[e,ce]),ue=()=>V(`/api/state`).then(o).catch(()=>{}),de=()=>V(`/api/workspaces?agent_id=${e}`).then(m).catch(()=>{});(0,v.useEffect)(()=>{V(`/api/workbench?agent_id=${e}`).then(e=>{i(e.dsl),e.dsl&&t(e.dsl.workbench)}),V(`/api/deployment?agent_id=${e}`).then(e=>{f({L0:0,L1:1,L2:2,L3:3}[e.deployment?.default_autonomy||`L2`]??2)}),V(`/api/panels?with_code=1`).then(e=>c(e.plugins||[])),V(`/api/dev/inspirations?agent_id=${e}`).catch(()=>{}),de(),ue();let n=setInterval(ue,5e3);return()=>clearInterval(n)},[e]);let fe=async()=>{try{let t=await ke(`/api/workbench`,{agent_id:e,dsl:F});Z.success(`已发布 ${t.dsl.version},工位即时生效 ✨`),I(null),i(t.dsl)}catch(e){Z.error(String(e.message))}},R=async()=>{try{await Ae(`/api/workbench/draft`,{agent_id:e}),Z.info(`已放弃草稿`),I(null)}catch(e){Z.error(String(e.message))}};(0,v.useEffect)(()=>{ae(document.querySelector(`[data-slot="app-header-right"]`))},[]),(0,v.useEffect)(()=>{F&&V(`/api/panels?with_code=1`).then(e=>c(e.plugins||[])).catch(()=>{})},[F]);let z=async t=>{try{m(await Oe(`/api/workspaces/select`,{agent_id:e,ws_id:t}))}catch(e){Z.error(String(e.message))}},pe=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Pm,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(Eg,{value:ce,onValueChange:z,children:[(0,U.jsx)(Og,{className:`h-7 w-32 text-xs data-[size=default]:h-7 md:w-40`,title:se?.path,children:(0,U.jsx)(Dg,{children:(0,U.jsx)(`span`,{className:`truncate`,children:se?`${se.name}${se.external?`(外部)`:``}`:`默认工作区`})})}),(0,U.jsx)(kg,{children:(p?.workspaces||[]).map(e=>(0,U.jsx)(Ag,{value:e.id,className:`text-xs`,children:(0,U.jsxs)(`span`,{className:`max-w-64 truncate`,title:e.path,children:[e.name,e.external?` · 外部目录`:``,e.id===p?.current?` ✓`:``]})},e.id))})]}),se&&se.id!=="default"&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 shrink-0 p-0 text-muted-foreground`,onClick:()=>D(se),title:`删除当前工作区`,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 shrink-0 p-0 text-muted-foreground`,onClick:()=>g(!0),title:`新建工作区(默认目录或自定义路径)`,children:(0,U.jsx)(vm,{className:`h-3.5 w-3.5`})}),(0,U.jsxs)(Y,{size:`sm`,className:`h-7 gap-1 bg-ai text-white hover:bg-ai/90`,title:`说一句话,看着界面长出来(先进草稿,确认才发布)`,onClick:()=>P(!0),children:[(0,U.jsx)(Wh,{className:`h-3.5 w-3.5`}),`AI 定制`]}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`hidden h-7 gap-1 text-xs md:inline-flex`,title:`把当前工作台打包为 ARM UI 资产,别人下载即得同款工位`,onClick:()=>M({type:`workbench`,agentId:e,title:r?.workbench||`当前工作台`}),children:[(0,U.jsx)(Jp,{className:`h-3.5 w-3.5 text-violet-400`}),`分享`]}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`hidden h-7 gap-1 text-xs md:inline-flex`,onClick:n,children:[(0,U.jsx)(Ph,{className:`h-3.5 w-3.5`}),`编辑布局`]})]}),me=async()=>{T(!0);try{let t=await Oe(`/api/workspaces`,{agent_id:e,name:_||void 0,...b?{path:b}:{}});m(t),g(!1),y(``),x(``),Z.success(`工作区已创建${b?`(登记外部目录)`:``}`),await z(t.workspaces[t.workspaces.length-1].id)}catch(e){Z.error(String(e.message))}finally{T(!1)}},he=async()=>{if(E)try{m(await Ae(`/api/workspaces/${E.id}?agent_id=${e}`,{purge:O})),Z.success(`工作区已删除${O?`(目录已清除)`:`(仅移除登记)`}`),D(null),k(!1)}catch(e){Z.error(String(e.message))}},ge=(0,v.useMemo)(()=>__(r),[r]),_e=Math.min(L,Math.max(ge.length-1,0)),ve=ge[_e]||ge[0],ye=(0,v.useMemo)(()=>ve?.panels||[],[ve]);(0,v.useEffect)(()=>{try{localStorage.setItem(`aims.view.${e}`,String(_e))}catch{}},[e,_e]);let be=(0,v.useMemo)(()=>__(F),[F]),xe=ve?.panels.find(e=>e.type===`agent_dialog`)||ge.flatMap(e=>e.panels).find(e=>e.type===`agent_dialog`),Se=be[Math.min(ne,be.length-1)]||be[0],Ce=t=>n=>{let r=t.panels.find(e=>e.id===n.id)||n,i=r.type===`custom`?r.code||``:s.find(e=>e.id===r.panel)?.code||``;return i?(0,U.jsx)($D,{code:i,data:Te(n),meta:{agentId:e,panelId:n.id,pluginId:r.panel}},`${n.id}:${ce}`):(0,U.jsx)(`div`,{className:`p-3 text-[11px] text-muted-foreground`,children:`(插件代码加载中…)`})},we=ye.filter(e=>e.type===`custom`||e.type===`custom_panel`).map(e=>({panel:e,code:e.type===`custom`?e.code||``:s.find(t=>t.id===e.panel)?.code||``})).filter(e=>e.code),Te=t=>({devices:a?.devices||[],alarms:a?.alarms||[],kpi:a?.kpi||{},work_orders:a?.work_orders||[],inspections:a?.inspections||{},selected:l,onSelect:u,agentId:e,store:Fe(e,ce),runAction:(n,r)=>Ie(e,String(t?.id||``),n,r),params:{...t?.params||{},agentId:e,wsId:ce}});return!r||!a?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`工作台加载中…`}):(0,U.jsxs)(`div`,{className:`flex h-full flex-col gap-2 overflow-hidden px-2 py-2 lg:px-4 lg:py-2.5`,children:[ie&&(0,pt.createPortal)((0,U.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:pe}),ie),(0,U.jsx)(`h1`,{className:`sr-only`,children:r.workbench}),!ie&&(0,U.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5 text-[11px]`,children:pe}),oe?(0,U.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:xe?(0,U.jsx)(OD,{agentId:e,agentName:r.workbench,sessionId:le,wsId:ce,injectedDevice:l,autonomy:d},`m:${e}:${ce}`):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-muted-foreground`,children:`此工作台暂无对话面板——可在桌面端添加「诊断对话」区块`})}):(0,U.jsxs)(U.Fragment,{children:[ge.length>1&&(0,U.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border bg-card p-1`,children:ge.map((e,t)=>(0,U.jsxs)(`button`,{onClick:()=>te(t),className:B(`flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs transition-colors`,t===_e?`bg-primary/15 font-medium text-primary`:`text-muted-foreground hover:bg-accent hover:text-foreground`),title:e.name,children:[(0,U.jsx)(Pm,{className:`h-3.5 w-3.5 shrink-0`}),e.name]},e.id))}),(0,U.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[F&&(0,U.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col gap-2 rounded-lg border-2 border-dashed border-ai/60 bg-background/80 p-2 backdrop-blur-[2px] motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-200`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs`,children:[(0,U.jsx)(cm,{className:`h-3.5 w-3.5 shrink-0 text-ai`}),(0,U.jsx)(`span`,{className:`font-semibold text-ai`,children:`草稿预览(AI 生成)`}),(0,U.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[F.panels.length,` 个面板 · `,be.length>1?`${be.length} 个视图`:`以下为发布后的样子`]}),be.length>1&&(0,U.jsx)(`span`,{className:`flex items-center gap-1`,children:be.map((e,t)=>(0,U.jsx)(`button`,{onClick:()=>re(t),className:B(`rounded px-1.5 py-0.5 text-[10px] transition-colors`,t===Math.min(ne,be.length-1)?`bg-primary/20 text-primary`:`text-muted-foreground hover:text-foreground`),children:e.name},e.id))}),(0,U.jsxs)(`div`,{className:`ml-auto flex gap-1.5`,children:[(0,U.jsxs)(Y,{size:`sm`,className:`h-7 gap-1 text-[11px]`,onClick:fe,children:[(0,U.jsx)(Sh,{className:`h-3 w-3`}),`发布生效`]}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 text-[11px]`,onClick:R,children:`放弃`}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,className:`h-7 text-[11px]`,onClick:()=>I(null),children:`收起`})]})]}),(0,U.jsx)(iO,{className:`min-h-0 flex-1 overflow-auto p-0.5`,dsl:{...F,panels:Se?.panels||[]},renderPanel:Ce(F),renderDialog:()=>(0,U.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(Wh,{className:`h-4 w-4 text-primary`}),`诊断对话(发布后可交互)`]}),renderPlaceholder:()=>(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-[11px] text-muted-foreground`,children:`空区块`})})]}),(0,U.jsx)(iO,{className:`absolute inset-0 overflow-auto p-0.5`,dsl:{...r,panels:ve?.panels||[]},onMaximize:j,renderHeaderActions:e=>e.type===`agent_dialog`?(0,U.jsxs)(U.Fragment,{children:[l&&(0,U.jsxs)(`span`,{className:`hidden min-w-0 truncate text-[10px] text-muted-foreground lg:inline`,title:`上下文:${l}(点选设备自动注入,点其他设备切换)`,children:[`上下文 `,l]}),(0,U.jsxs)(Eg,{value:String(d),onValueChange:e=>{let t=+e;f(t),Oe(`/api/chat/autonomy`,{sessionId:le,level:t}).then(e=>Z.success(`自主级别已切换:${[`L0 只读`,`L1 给建议不动手`,`L2 做了等我确认`,`L3 全自动免确认`][t]}`,{description:e?.note||`即时生效:进行中的一轮其后续工具调用按新级别执行,下条消息起系统提示词同步更新`})).catch(e=>Z.error(String(e.message)))},children:[(0,U.jsx)(Og,{className:`h-5 w-fit shrink-0 gap-1 rounded-full border-0 px-2 text-[10px] font-semibold shadow-none data-[size=default]:h-5 [&_svg]:size-3! ${d===3?`bg-destructive/10 text-destructive hover:bg-destructive/20`:d===2?`bg-primary/10 text-primary hover:bg-primary/20`:`bg-accent text-muted-foreground hover:bg-accent/70`}`,title:`自主级别:L0 只读 → L3 免确认(当前对话即时生效,点击切换)`,children:(0,U.jsx)(Dg,{children:(0,U.jsx)(`span`,{children:[`L0`,`L1`,`L2`,`L3`][d]})})}),(0,U.jsxs)(kg,{children:[(0,U.jsx)(Ag,{value:`0`,className:`text-xs`,children:`只回答不动手(L0)`}),(0,U.jsx)(Ag,{value:`1`,className:`text-xs`,children:`给建议不动手(L1)`}),(0,U.jsx)(Ag,{value:`2`,className:`text-xs`,children:`做了等我确认(L2)`}),(0,U.jsx)(Ag,{value:`3`,className:`text-xs text-destructive`,children:`全自动免确认(L3)`})]})]})]}):null,renderPanel:Ce(r),renderDialog:()=>(0,U.jsx)(OD,{agentId:e,agentName:r.workbench,sessionId:le,wsId:ce,injectedDevice:l,autonomy:d},`${e}:${ce}`),renderPlaceholder:()=>(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-[11px] text-muted-foreground`,children:`空区块——到「编辑布局」添加插件或让 AI 定制`})})]}),A!==null&&ye[A]&&(()=>{let t=ye[A],n=we.find(e=>e.panel.id===t.id),i=t.type===`agent_dialog`?(0,U.jsx)(OD,{agentId:e,agentName:r.workbench,sessionId:le,wsId:ce,injectedDevice:l,autonomy:d},`max:${e}:${ce}`):n?(0,U.jsx)($D,{code:n.code,data:Te(t),meta:{agentId:e,panelId:t.id,pluginId:t.panel}}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-xs text-muted-foreground`,children:`该面板无内容`});return(0,U.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col bg-background/90 p-4 backdrop-blur-sm motion-safe:animate-in motion-safe:fade-in-0 motion-safe:zoom-in-95 motion-safe:duration-200`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 px-1`,children:[(0,U.jsx)(Km,{className:`h-4 w-4 shrink-0 text-primary/80`}),(0,U.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:t.title}),(0,U.jsx)(J,{variant:`secondary`,className:`h-5 shrink-0 text-[10px]`,children:r.version}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`ml-auto h-7 shrink-0 gap-1 text-xs`,onClick:()=>j(null),children:[(0,U.jsx)(mg,{className:`h-3.5 w-3.5`}),`还原(ESC)`]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-lg border bg-card`,children:i})]})})(),(0,U.jsx)(gg,{open:h,onOpenChange:g,children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsx)(Sg,{children:`新建工作区`})}),(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`名称`}),(0,U.jsx)(wg,{value:_,onChange:e=>y(e.target.value),placeholder:`如:产线B改造`,className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`自定义目录(可选,留空则在平台 workspace 目录下动态新增)`}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(wg,{value:b,onChange:e=>x(e.target.value),placeholder:`/Users/you/projects/line-b 或点浏览选择`,className:`font-mono text-xs`}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-8 shrink-0 gap-1 text-xs`,onClick:()=>C(!0),children:[(0,U.jsx)(gm,{className:`h-3.5 w-3.5`}),`浏览…`]})]}),(0,U.jsx)(`p`,{className:`text-[10px] text-warning`,children:`⚠ 助手将能读写该目录(exec 工作目录即此处);目录须已存在,平台不会在其中写入数据库文件。`})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:w,onClick:()=>g(!1),children:`取消`}),(0,U.jsx)(Y,{disabled:w,onClick:me,children:w?`创建中…`:`创建并切换`})]}),(0,U.jsx)(oO,{open:S,onOpenChange:C,onPick:e=>x(e)})]})}),(0,U.jsx)(gg,{open:!!E,onOpenChange:e=>{e||(D(null),k(!1))},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[`删除工作区 · `,E?.name]})}),(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,U.jsx)(`p`,{className:`font-mono text-[11px] text-muted-foreground`,children:E?.path}),E?.external?(0,U.jsxs)(`p`,{children:[`外部目录工作区:仅移除登记,`,(0,U.jsx)(`b`,{children:`不删除`}),`你的文件;该工作区的数据集库将一并删除。`]}):(0,U.jsxs)(`label`,{className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 p-2.5`,children:[(0,U.jsx)(hg,{checked:O,onCheckedChange:e=>k(!!e)}),(0,U.jsx)(`span`,{children:`同时删除平台目录下的工作区文件夹(数据集库始终删除)`})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:()=>D(null),children:`取消`}),(0,U.jsx)(Y,{variant:`destructive`,onClick:he,children:`确认删除`})]})]})})]}),(0,U.jsx)(yO,{target:ee,onClose:()=>M(null),agents:[{agent_id:e,name:r.workbench||`当前助手`}]}),(0,U.jsx)(uO,{agentId:e,open:N,onClose:()=>P(!1),onPreview:e=>I(e),onPublished:e=>{I(null),i(e)}})]})}function CO({...e}){return(0,U.jsx)(Hl,{"data-slot":`dropdown-menu`,...e})}function wO({...e}){return(0,U.jsx)(Wl,{"data-slot":`dropdown-menu-trigger`,...e})}function TO({className:e,sideOffset:t=4,...n}){return(0,U.jsx)(Gl,{children:(0,U.jsx)(ql,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:B(`z-50 min-w-36 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,e),...n})})}function EO({className:e,...t}){return(0,U.jsx)(Jl,{"data-slot":`dropdown-menu-item`,className:B(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-xs outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0`,e),...t})}function DO({className:e,...t}){return(0,U.jsx)(Yl,{"data-slot":`dropdown-menu-separator`,className:B(`-mx-1 my-1 h-px bg-border`,e),...t})}function OO({pluginId:e,onRollback:t}){let[n,r]=(0,v.useState)(null);return(0,v.useEffect)(()=>{e&&V(`/api/panels?id=${e}`).then(e=>r(e.plugin)).catch(()=>r(null))},[e]),n?(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:n.version}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`(当前)`})]}),(n.history||[]).slice().reverse().map(n=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:n.version}),(0,U.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:Le(n.at,`dts`)}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`ml-auto h-6 text-[10px]`,onClick:()=>t(e,n.version),children:`回退`})]},n.version)),!(n.history||[]).length&&(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`无历史版本`})]}):(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`(插件信息加载中…)`})}var kO=[{emoji:`📋`,title:`最近记录`,desc:`数据/操作时间线`,prompt:`新建一个区块:展示我数据集里最近 20 条记录的倒序时间线(ui.StatusItem,按重要程度着色),数据不足时先建合适的数据集`},{emoji:`⭐`,title:`关键指标`,desc:`大数字状态卡`,prompt:`新建一个区块:用 ui.Stat 大数字卡展示当前最关键的状态指标(数据从 /api/state 或数据集取),异常着色`},{emoji:`✅`,title:`待办清单`,desc:`可勾选任务`,prompt:`先建 todos 数据集(title/done/due),再做一个面板:ui.StatusItem 待办列表 + 完成态切换(store.update),顶部 ui.Button 清除已完成`},{emoji:`📊`,title:`分类统计`,desc:`计数条形图`,prompt:`新建一个区块:对相关数据按类型或状态聚合计数,用 ui.Bars 横向条形展示`},{emoji:`🔍`,title:`快速检索`,desc:`关键词搜索`,prompt:`新建一个区块:输入关键词检索我的数据集(store.list filter 或接口查询),结果用 ui.StatusItem 列表展示,带加载/空/错误三态`},{emoji:`🕒`,title:`活动流水`,desc:`今日事件流`,prompt:`新建一个区块:今天发生的事件/变更流水(按时间倒序),新条目突出显示,支持点击查看详情`}],AO=e=>({x:1,y:e.reduce((e,t)=>Math.max(e,t.grid?t.grid.y+t.grid.h-1:0),0)+1,w:6,h:1});function jO({agentId:e}){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)([]),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(0),[w,T]=(0,v.useState)(null),[E,D]=(0,v.useState)([]),[O,k]=(0,v.useState)(null),A=(0,v.useRef)(`dev-${e.slice(0,8)}`).current,j=(0,v.useRef)(null),[ee,M]=(0,v.useState)([]),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(!1),[L,te]=(0,v.useState)(``),[ne,re]=(0,v.useState)(null),[ie,ae]=(0,v.useState)(!1),[oe,se]=(0,v.useState)({steps:[]}),[ce,le]=(0,v.useState)(!1),[ue,de]=(0,v.useState)([]),[fe,R]=(0,v.useState)(!0),[z,pe]=(0,v.useState)(!1),[me,he]=(0,v.useState)(`main`),[ge,_e]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(F||ce||!oe.steps.length)return;let e=setTimeout(()=>se({steps:[]}),2500);return()=>clearTimeout(e)},[F,ce,oe]);let[ve,ye]=(0,v.useState)(null),be=(0,v.useRef)(null),xe=(0,v.useRef)(null),Se=(0,v.useRef)(!0),Ce=(0,v.useCallback)(()=>{let e=be.current?.closest(`[data-slot="scroll-area-viewport"]`);e&&(e.scrollTop=e.scrollHeight)},[]);(0,v.useEffect)(()=>{let e=be.current?.closest(`[data-slot="scroll-area-viewport"]`);if(!e)return;let t=()=>{Se.current=e.scrollHeight-e.scrollTop-e.clientHeight<80};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,v.useEffect)(()=>{Se.current&&Ce()},[ee,F,L,Ce]);let we=()=>{V(`/api/workbench?agent_id=${e}&draft=1`).then(e=>{let t=v_(e.dsl);n(t),he(__(t)[0].id),i(e.isDraft),o(e.versions||[]),c(JSON.stringify(t,null,2))}),V(`/api/panels`).then(e=>f(e.plugins||[]))};(0,v.useEffect)(()=>{we()},[e]);let[Te,Ee]=(0,v.useState)(null);(0,v.useEffect)(()=>{Ee(document.querySelector(`[data-slot="app-header-right"]`))},[]),(0,v.useEffect)(()=>{let t=!0;return R(!0),de([]),V(`/api/dev/inspirations?agent_id=${e}`).then(e=>{t&&de(e.items?.length?e.items:kO)}).catch(()=>{t&&de(kO)}).finally(()=>{t&&R(!1)}),()=>{t=!1}},[e]);let De=()=>{z||(pe(!0),V(`/api/dev/inspirations?agent_id=${e}&refresh=1`).then(e=>{e.items?.length&&de(e.items)}).catch(()=>Z.error(`重新生成失败,稍后再试`)).finally(()=>pe(!1)))};if((0,v.useEffect)(()=>{let e=()=>V(`/api/state`).then(T).catch(()=>{});e();let t=setInterval(e,5e3);return V(`/api/panels?with_code=1`).then(e=>D(e.plugins||[])),()=>clearInterval(t)},[]),!t)return(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`加载工作台 DSL…`});let Me=__(t),Ne=Me[Math.max(Me.findIndex(e=>e.id===me),0)],Pe=Ne.panels,Re=_===null?null:Pe[_],ze=e=>{let t=__(e);return t.find(e=>e.id===Ne.id)||t[0]},Be=e=>{let r=JSON.parse(JSON.stringify(t));e(r);let a=__(r);r.views=a,r.panels=a.flatMap(e=>e.panels),n(r),c(JSON.stringify(r,null,2)),i(!0)},Ve=(e,t)=>Be(n=>{let r=ze(n).panels,i=r[e].grid||{x:1,y:1,w:6,h:1};r[e].grid={...i,...t}}),He=t=>({devices:w?.devices||[],alarms:w?.alarms||[],kpi:w?.kpi||{},work_orders:w?.work_orders||[],inspections:w?.inspections||{},selected:O,onSelect:k,agentId:e,store:Fe(e),runAction:(n,r)=>Ie(e,String(t.id),n,r),params:{...t.params||{},agentId:e,wsId:`default`}}),Ue=e=>e.type===`custom`?e.code:E.find(t=>t.id===e.panel)?.code||``,We=()=>Be(e=>{let t=ze(e).panels;t.push({id:`block_${Math.random().toString(36).slice(2,6)}`,type:`placeholder`,title:`空区块`,grid:AO(t)})}),Ge=(e,t)=>{Be(n=>{let r=ze(n).panels;if(e!==null&&e<r.length){let n=r[e];Object.assign(n,{type:`custom_panel`,panel:t.id,title:n.title===`空区块`?t.name:n.title})}else r.push({id:`plug_${t.id}_${Math.random().toString(36).slice(2,5)}`,type:`custom_panel`,title:t.name,panel:t.id,grid:AO(r)})}),m(!1),g(null),Z.success(`已插入「${t.name}」(草稿,待发布)`)},Ke=async e=>{let t=Pe[e];re(e);let n=``;try{let e=t.panel||t.id,r=await V(`/api/panel-errors?key=${encodeURIComponent(e)}`);n=r.errors?.length?r.errors.map(e=>`[${e.kind}] ${e.message}`).join(` | `):``}catch{}P(`请调试该插件:${n?`最近运行错误:${n}。`:`暂无上报错误,请先 read_panel_plugin 审代码,重点检查结果处理与错误路径。`}请定位根因、修复并说明验证方式。`),Z.info(`已锁定调试目标并带上错误上下文,发送即开始`)},H=async(e,t)=>{try{let n=await Oe(`/api/panels/rollback`,{id:e,version:t});Z.success(`已回退到 ${t}(新版本号 ${n.plugin.version},引用即时生效)`),we()}catch(e){Z.error(String(e.message))}},qe=()=>{if(ne===null||!Pe[ne])return``;let e=Pe[ne],t=e.grid||{x:1,y:1,w:6,h:1},n=Math.round(t.w/12*100),r=t.w<=3?`窄条(紧凑单列列表/迷你卡)`:t.w>=9?`宽区块(表格/多列仪表)`:`中等宽度(两列卡/紧凑表)`;return`【定制目标】区块「${e.title}」(id=${e.id}):第${t.x}列起、跨${t.w}列(约${n}%宽)、跨${t.h}行(${r})。${e.panel?`当前引用插件 ${e.panel}——先 read_panel_plugin 再决定改造还是重写。`:`空区块,可新建插件。`}${e.bare?`本区块为通栏视觉面板(bare:无面板头无边框,内容顶格,适合 KPI 条/图表/矩阵墙)。`:`面板头由平台渲染(标题「${e.title}」)——插件首屏直接进入内容,勿写标题行。`}`},Je=e=>{re(e),P(``),setTimeout(()=>xe.current?.focus(),50),Z.info(`已锁定定制目标「${Pe[e].title}」——在右侧描述需求即可`)},Ye=async()=>{u(!0);try{let r=await ke(`/api/workbench`,{agent_id:e,dsl:t});n(r.dsl),o(r.versions),c(JSON.stringify(r.dsl,null,2)),i(!1),ae(!1),Z.success(`已发布 ${r.dsl.version},工作台即时生效`)}catch(e){Z.error(String(e.message))}finally{u(!1)}},Xe=async()=>{await Ae(`/api/workbench/draft`,{agent_id:e}),Z.success(`已放弃草稿`),we()},Ze=async t=>{try{let r=await Oe(`/api/workbench/rollback`,{agent_id:e,version:t});n(r.dsl),o(r.versions),c(JSON.stringify(r.dsl,null,2)),i(!1),Z.success(`已回滚到 ${t}`)}catch(e){Z.error(String(e.message))}},Qe=()=>Be(e=>{let t=__(e);t.push({id:`view_${Math.random().toString(36).slice(2,6)}`,name:`视图${t.length+1}`,panels:[{id:`block_${Math.random().toString(36).slice(2,6)}`,type:`placeholder`,title:`空区块`,grid:{x:1,y:1,w:6,h:1}}]})}),$e=()=>Be(e=>{let t=__(e),n=t.find(e=>e.id===Ne.id)||t[0];t.push({id:`view_${Math.random().toString(36).slice(2,6)}`,name:`${n.name} 副本`,panels:n.panels.map(e=>({...e,id:`${e.id}_${Math.random().toString(36).slice(2,5)}`}))})}),et=e=>Be(t=>{let n=ze(t);e.trim()&&(n.name=e.trim())}),tt=()=>{Me.length<=1?Z.info(`至少保留一个视图`):(Be(e=>{let t=__(e),n=Math.max(t.findIndex(e=>e.id===Ne.id),0);t.splice(n,1)}),he(``),y(null),re(null))},nt=()=>{j.current?.abort()},rt=async()=>{if(F)Z.info(`对话进行中,请先停止再清空`);else if(window.confirm(`清空二开助手的会话历史?服务端上下文将被丢弃并从零开始;已生成的草稿与插件不受影响。`))try{await Oe(`/api/session/reset`,{scope:`dev`,sessionId:A}),M([]),te(``),Z.success(`会话已清空`)}catch(e){Z.error(String(e.message))}},it=async()=>{let t=N.trim();if(!t||F)return;let n=qe()?`${qe()}\n需求:${t}`:t;P(``),I(!0),ae(!1),se({steps:[]}),le(!1),Se.current=!0,M(e=>[...e,{role:`user`,text:t}]);let r=!1,i=!1,a=new AbortController;j.current=a;try{await je(`/api/dev/chat`,{sessionId:A,agentId:e,message:n},e=>{let t=e.type;t===`status`?te(String(e.text||``)):t===`text_delta`?(i=!0,te(``),M(t=>{let n=t[t.length-1];return n?.role===`agent`&&n.streaming?[...t.slice(0,-1),{...n,text:n.text+String(e.delta)}]:[...t,{role:`agent`,text:String(e.delta),streaming:!0}]})):t===`done`?!i&&!r&&M(e=>[...e,{role:`agent`,text:`(模型返回了空回复——请重试;若持续出现请到「系统设置」检查模型配置)`}]):t===`tool_start`?(r=!0,se(t=>({steps:[...t.steps,{label:cO(String(e.tool)),state:`active`}]})),M(t=>[...t,{role:`agent`,text:``,streaming:!1,events:[{tool:String(e.tool),args:e.args||{}}]}])):t===`tool_end`?(se(t=>{let n=[...t.steps],r=cO(String(e.tool));for(let e=n.length-1;e>=0;e--)if(n[e].label===r&&n[e].state===`active`){n[e]={...n[e],state:`done`};break}return{steps:n}}),M(t=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.role===`agent`&&r.events){for(let n=r.events.length-1;n>=0;n--)if(r.events[n].tool===e.tool&&r.events[n].result===void 0)return r.events[n].result=String(e.result||``),r.events[n].ok=e.ok!==!1,[...t]}}return t})):t===`interrupted`?(te(``),M(e=>[...e,{role:`agent`,text:`(已中断)`}])):t===`meta`?e.hasDraft?(ae(!0),le(!0),we()):r&&we():t===`error`&&Z.error(String(e.message))},a.signal)}catch(e){a.signal.aborted?M(e=>[...e,{role:`agent`,text:`(已中断)`}]):M(t=>[...t,{role:`agent`,text:`❌ ${String(e.message)}`}])}finally{te(``),I(!1),j.current===a&&(j.current=null)}},at=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(J,{variant:r?`outline`:`secondary`,className:B(`h-6 shrink-0 px-1.5 text-[10px]`,r&&`border-warning/50 text-warning`),children:r?`草稿未发布`:`线上 ${t.version}`}),r&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-1.5 text-[10px] text-warning hover:text-warning`,title:`放弃当前草稿,回到线上版本`,onClick:Xe,children:`放弃`}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-6 shrink-0 px-2 text-[11px]`,onClick:()=>{g(null),m(!0)},children:[(0,U.jsx)(gh,{className:`mr-1 h-3 w-3`}),`插件库`]}),(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-6 shrink-0 px-2 text-[11px]`,title:`把当前工作台(含依赖插件/数据集 schema/交互脚本)发布为 ARM UI 资产`,onClick:()=>ye({type:`workbench`,agentId:e,title:t.workbench}),children:[(0,U.jsx)(Jp,{className:`mr-1 h-3 w-3 text-violet-400`}),`导出资产`]}),(0,U.jsxs)(Y,{size:`sm`,className:`h-6 shrink-0 px-2 text-[11px]`,disabled:l||!r,onClick:Ye,children:[(0,U.jsx)(Eh,{className:`mr-1 h-3 w-3`}),l?`发布中…`:`审阅后发布`]})]});return(0,U.jsxs)(`div`,{className:`flex h-full flex-col gap-2 overflow-hidden px-4 py-2.5`,children:[!Te&&(0,U.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5`,children:at}),Te&&(0,pt.createPortal)((0,U.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:at}),Te),(0,U.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[1fr_380px] gap-4`,children:[(0,U.jsx)(`div`,{className:`flex min-h-0 flex-col`,children:(0,U.jsxs)(pO,{defaultValue:`canvas`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-nowrap items-center gap-1.5 overflow-x-auto rounded-md border bg-card p-1.5`,children:[(0,U.jsxs)(hO,{className:`h-8 shrink-0`,children:[(0,U.jsxs)(gO,{value:`canvas`,className:`px-2 text-xs`,children:[(0,U.jsx)(Im,{className:`mr-1 h-3.5 w-3.5`}),`画布`]}),(0,U.jsx)(gO,{value:`json`,className:`px-2 text-xs`,children:`JSON`})]}),(0,U.jsx)(fO,{orientation:`vertical`,className:`mx-1 h-5 shrink-0`}),(0,U.jsxs)(Y,{size:`sm`,variant:`secondary`,className:`h-7 shrink-0 text-xs`,onClick:We,children:[(0,U.jsx)(mh,{className:`mr-1 h-3 w-3`}),`添加区块`]}),(0,U.jsx)(fO,{orientation:`vertical`,className:`mx-1 h-5 shrink-0`}),Re?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`max-w-28 shrink-0 truncate text-[11px] text-muted-foreground`,title:Re.title,children:[`「`,Re.title,`」`]}),(0,U.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:`按住拖动调整位置 · 右下角手柄调大小`}),(0,U.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 shrink-0 text-xs text-primary`,onClick:()=>Je(_),children:[(0,U.jsx)(wp,{className:`mr-1 h-3 w-3`}),`AI 定制`]}),(0,U.jsxs)(CO,{children:[(0,U.jsx)(wO,{asChild:!0,children:(0,U.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 shrink-0 text-xs`,children:[(0,U.jsx)(om,{className:`h-3 w-3`}),`更多`]})}),(0,U.jsxs)(TO,{align:`end`,children:[(Re.type===`custom`||Re.type===`custom_panel`)&&(0,U.jsxs)(EO,{className:`text-warning focus:text-warning`,onClick:()=>Ke(_),children:[(0,U.jsx)(fg,{}),`AI 调试`]}),(0,U.jsxs)(EO,{onClick:()=>Ve(_,{x:1,w:12}),children:[(0,U.jsx)(Xh,{className:`text-muted-foreground`}),`占满宽度`]}),(0,U.jsxs)(EO,{onClick:()=>{let e=Pe.reduce((e,t)=>Math.max(e,(t.grid?.y||1)+(t.grid?.h||1)-1),1);Ve(_,{h:Math.max(1,e-(Re.grid?.y||1)+1)})},children:[(0,U.jsx)(Qh,{className:`text-muted-foreground`}),`延到底部`]}),(0,U.jsxs)(EO,{onClick:()=>Ve(_,{x:1}),children:[(0,U.jsx)(mp,{className:`text-muted-foreground`}),`贴左`]}),(0,U.jsxs)(EO,{onClick:()=>Ve(_,{x:12-(Re.grid?.w||6)+1}),children:[(0,U.jsx)(fp,{className:`text-muted-foreground`}),`贴右`]}),(0,U.jsx)(DO,{}),(0,U.jsxs)(EO,{onClick:()=>{g(_),m(!0)},children:[(0,U.jsx)(gh,{className:`text-muted-foreground`}),`换插件`]}),(0,U.jsxs)(EO,{onClick:()=>{C(_),x(!0)},children:[(0,U.jsx)(Ph,{className:`text-muted-foreground`}),`面板设置`]}),(0,U.jsxs)(EO,{className:`text-destructive focus:text-destructive`,onClick:()=>{Be(e=>ze(e).panels.splice(_,1)),y(null),re(null)},children:[(0,U.jsx)(ng,{}),`删除区块`]})]})]})]}):(0,U.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:`点击画布中的区块进行编辑`})]}),(0,U.jsxs)(_O,{value:`canvas`,className:`mt-1.5 flex min-h-0 flex-1 flex-col gap-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border bg-card p-1`,children:[Me.map(e=>(0,U.jsxs)(`button`,{onClick:()=>{he(e.id),y(null),re(null)},className:B(`flex h-7 min-w-0 items-center gap-1.5 rounded-md px-2.5 text-xs transition-colors`,e.id===Ne.id?`bg-primary/15 font-medium text-primary`:`text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,U.jsx)(`span`,{className:`truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`shrink-0 text-[9px] opacity-60`,children:e.panels.length})]},e.id)),(0,U.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,U.jsx)(`button`,{onClick:Qe,title:`新建视图(新场景一块新屏)`,className:`rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,U.jsx)(mh,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(`button`,{onClick:$e,title:`复制当前视图`,className:`rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,U.jsx)(Xp,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(`button`,{onClick:()=>_e(!0),title:`重命名当前视图`,className:`rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,U.jsx)(uh,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(`button`,{onClick:tt,title:`删除当前视图(至少保留一个)`,className:`rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-destructive`,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})})]})]}),(0,U.jsx)(`div`,{className:`shrink-0`,children:(0,U.jsx)(aO,{})}),(0,U.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden rounded-lg border bg-muted/20 p-2`,children:[(0,U.jsx)(iO,{className:`absolute inset-0 overflow-auto`,dsl:{...t,panels:Ne.panels},edit:{sel:_,onSelect:y,onGrid:(e,t)=>Ve(e,t),onAICustomize:Je},renderPanel:t=>{let n=Ue(t);return n?(0,U.jsx)($D,{code:n,data:He(t),meta:{agentId:e,panelId:t.id,pluginId:t.panel}}):(0,U.jsx)(`div`,{className:`p-3 text-[11px] text-muted-foreground`,children:`(插件代码加载中…)`})},renderDialog:()=>(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(wp,{className:`h-5 w-5 text-primary`}),`诊断对话(内核)`,(0,U.jsx)(`span`,{className:`text-[10px]`,children:`发布后在工作台可交互`})]}),renderPlaceholder:()=>(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(mh,{className:`h-4 w-4`}),`空区块`,(0,U.jsx)(`span`,{className:`text-[10px]`,children:`选中后「换插件」或「AI 定制」`})]})}),(0,U.jsx)(lO,{steps:oe.steps,status:L,lit:ce,onClose:()=>{se({steps:[]}),le(!1)}})]}),(0,U.jsx)(`p`,{className:`shrink-0 text-center text-[10px] text-muted-foreground`,children:`拖拽吸附 12 列网格 · 右下角手柄调大小 · 画布比例 = 真实工作台(所见即所得)`})]}),(0,U.jsxs)(_O,{value:`json`,className:`mt-2 flex min-h-0 flex-1 flex-col gap-2`,children:[(0,U.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),spellCheck:!1,className:`min-h-0 w-full flex-1 resize-none rounded-md border bg-muted p-3 font-mono text-[11px] leading-relaxed`}),(0,U.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,U.jsx)(Y,{size:`sm`,onClick:()=>{try{let e=JSON.parse(s);if(!e.panels&&!e.views)throw Error(`缺少 panels/views`);let t=v_(e);n(t),he(__(t)[0].id),i(!0),Z.success(`JSON 已应用(未发布)`)}catch(e){Z.error(`JSON 解析失败: ${e.message}`)}},children:`应用 JSON`}),(0,U.jsx)(Y,{size:`sm`,variant:`outline`,onClick:()=>c(JSON.stringify(t,null,2)),children:`从画布刷新`})]})]})]})}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-4`,children:[(0,U.jsx)(Gf,{className:`flex min-h-0 flex-1 flex-col py-0`,children:(0,U.jsxs)(Jf,{className:`flex min-h-0 flex-1 flex-col p-0`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-b px-3 py-2 text-xs font-semibold`,children:[(0,U.jsx)(Wh,{className:`h-3.5 w-3.5 text-ai`}),`二开助手`,(0,U.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`· 描述需求,直接定制区块`}),(0,U.jsx)(`button`,{className:`ml-auto shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground disabled:opacity-40`,title:`清空会话(丢弃服务端上下文,从零开始)`,disabled:F,onClick:rt,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})})]}),ne!==null&&Pe[ne]&&(()=>{let e=Pe[ne],t=e.grid||{x:1,y:1,w:6,h:1},n=Math.round(t.w/12*100);return(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-b bg-primary/5 px-3 py-1.5 text-[11px]`,children:[(0,U.jsx)(em,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,U.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`定制目标:`,(0,U.jsx)(`b`,{children:e.title}),` · `,n,`% 宽 · `,t.h,` 行`,e.panel?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(`span`,{className:`font-mono`,children:e.panel})]}):` · 空区块`]}),(0,U.jsx)(`button`,{className:`ml-auto shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground`,title:`取消目标,改为自由描述`,onClick:()=>re(null),children:`×`})]})})(),ie&&r&&(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-b bg-success/10 px-3 py-1.5 text-[11px] text-success`,children:[(0,U.jsx)(Bp,{className:`h-3.5 w-3.5 shrink-0`}),`草稿已生成——到顶部「审阅后发布」生效`]}),(0,U.jsx)(bD,{className:`min-h-0 flex-1`,children:(0,U.jsxs)(`div`,{className:`space-y-2.5 p-3`,ref:be,children:[ee.length===0&&(0,U.jsx)(`div`,{className:`space-y-2`,children:(0,U.jsxs)(`div`,{className:`rounded-md border border-dashed border-primary/30 bg-primary/5 p-3 text-[11px] leading-relaxed`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-xs font-semibold text-ai`,children:[`✨ 灵感库 · 为这个助手定制`,!fe&&ue.length>0&&(0,U.jsxs)(`button`,{onClick:De,disabled:z,title:`按自描述重新生成一批(不满意就换)`,className:`ml-auto flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-normal text-muted-foreground transition-colors hover:text-primary disabled:opacity-50`,children:[(0,U.jsx)(bh,{className:B(`h-3 w-3`,z&&`animate-spin`)}),z?`构思中…`:`换一批`]})]}),(0,U.jsx)(`div`,{children:`由助手自描述(AGENT.md)生成——选中画布区块再描述 = 只改它;直接描述 = 自动建区块。`}),fe&&(0,U.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-ai`}),`正在阅读这个助手的自描述并构思灵感…(不影响你直接输入需求)`]}),(0,U.jsxs)(`div`,{className:`mt-1.5 grid grid-cols-2 gap-1.5`,children:[fe&&[...[,,,,,,]].map((e,t)=>(0,U.jsx)(`div`,{className:`h-[46px] animate-pulse rounded-md border bg-muted/50`},t)),!fe&&ue.map(e=>(0,U.jsxs)(`button`,{onClick:()=>P(e.prompt),title:e.prompt,className:`flex h-[46px] flex-col items-start gap-0.5 overflow-hidden rounded-md border bg-card/60 p-2 text-left transition-colors hover:border-primary/60`,children:[(0,U.jsxs)(`span`,{className:`text-[11px] font-medium`,children:[e.emoji,` `,e.title]}),(0,U.jsx)(`span`,{className:`line-clamp-1 w-full text-[10px] text-muted-foreground`,children:e.desc})]},e.title))]})]})}),ee.map((e,t)=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:e.role===`user`?`ml-auto max-w-[90%] rounded-lg bg-primary/20 px-2.5 py-1.5 text-xs break-words whitespace-pre-wrap`:`max-w-full rounded-lg bg-card px-2.5 py-1.5 text-xs leading-relaxed break-words whitespace-pre-wrap`,children:e.text}),(e.events||[]).map((e,t)=>(0,U.jsxs)(`div`,{className:`mt-1 min-w-0 rounded-md border border-dashed px-2 py-1 text-[10px]`,children:[(0,U.jsx)(`span`,{children:e.ok===!1?`❌`:`🛠`}),` `,(0,U.jsx)(`span`,{className:`font-mono font-semibold`,children:e.tool}),(0,U.jsx)(`pre`,{className:`mt-0.5 max-h-32 overflow-auto whitespace-pre-wrap break-all text-muted-foreground`,children:String(e.result||``).slice(0,260)})]},t))]},t)),(F||L)&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-primary`}),L||`开发中…`]})]})}),(0,U.jsxs)(`div`,{className:`shrink-0 space-y-1 border-t p-2`,children:[(0,U.jsx)(`textarea`,{ref:xe,value:N,onChange:e=>P(e.target.value),rows:2,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),it())},placeholder:ne===null?`描述需求,如「左上窄条做一个最近工单列表」(Enter 发送)…`:`描述对「${Pe[ne]?.title}」的需求(Enter 发送,Shift+Enter 换行)…`,className:`min-h-[56px] w-full resize-none rounded-md border bg-background px-2 py-1.5 text-xs`}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:ne===null?`未锁定目标——助手会自动规划区块位置`:`目标上下文(位置/几何/插件)发送时自动携带`}),F?(0,U.jsxs)(Y,{size:`sm`,variant:`destructive`,className:`h-7 gap-1 text-xs`,onClick:nt,children:[(0,U.jsx)(Jh,{className:`h-3 w-3`}),`停止`]}):(0,U.jsxs)(Y,{size:`sm`,className:`h-7 gap-1 text-xs`,disabled:!N.trim(),onClick:it,children:[(0,U.jsx)(Ah,{className:`h-3 w-3`}),`发送`]})]})]})]})}),(0,U.jsx)(Gf,{className:`shrink-0 py-0`,children:(0,U.jsxs)(Jf,{className:`p-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b px-3 py-2 text-xs font-semibold`,children:[(0,U.jsx)(wh,{className:`h-3.5 w-3.5`}),`版本历史`]}),(0,U.jsx)(`div`,{className:`max-h-40 overflow-y-auto`,children:(0,U.jsxs)(`div`,{className:`divide-y`,children:[a.length===0&&(0,U.jsx)(`div`,{className:`p-3 text-center text-xs text-muted-foreground`,children:`暂无历史`}),[...a].reverse().map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`font-mono font-semibold`,children:e.version}),t===0&&!r&&(0,U.jsx)(J,{className:`ml-1 h-4 px-1 text-[9px]`,children:`线上`}),(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:Le(e.at,`dts`)})]}),t!==0&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 text-[10px]`,onClick:()=>Ze(e.version),children:`回滚`})]},`${e.version}-${e.at}`))]})})]})})]})]}),(0,U.jsx)(gg,{open:b,onOpenChange:x,children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{children:[`区块设置 · `,Pe[S]?.title]})}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`标题`}),(0,U.jsx)(wg,{defaultValue:Pe[S]?.title||``,className:`text-xs`,onBlur:e=>Be(t=>{ze(t).panels[S].title=e.target.value})})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`副标题(面板头右侧灰字)`}),(0,U.jsx)(wg,{defaultValue:String(Pe[S]?.subtitle??``),className:`text-xs`,placeholder:`可选`,onBlur:e=>Be(t=>{ze(t).panels[S].subtitle=e.target.value})})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`图标`}),(0,U.jsx)(wg,{defaultValue:String(Pe[S]?.icon??``),className:`text-xs font-mono`,placeholder:`activity/alert/gauge…`,onBlur:e=>Be(t=>{ze(t).panels[S].icon=e.target.value.trim()})})]})]}),(0,U.jsxs)(`label`,{className:`flex items-start gap-2 rounded-md border p-2.5 text-xs leading-relaxed`,children:[(0,U.jsx)(hg,{checked:!!Pe[S]?.bare,onCheckedChange:e=>Be(t=>{ze(t).panels[S].bare=!!e})}),(0,U.jsx)(`span`,{children:`通栏视觉面板(bare)——无面板头与边框,内容顶格;适合 KPI 条 / 图表墙 / 状态矩阵等全画布表达。信息型列表面板请保持默认框架头。`})]}),Pe[S]?.type===`custom`&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`内联代码(契约:function Panel(props))`}),(0,U.jsx)(`textarea`,{defaultValue:Pe[S]?.code||``,spellCheck:!1,onBlur:e=>Be(t=>{ze(t).panels[S].code=e.target.value}),className:`h-40 w-full rounded-md border bg-muted p-2 font-mono text-[10px]`})]}),Pe[S]?.type===`custom_panel`&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`插件版本(可回退,回退即时生效)`}),(0,U.jsx)(OO,{pluginId:String(Pe[S]?.panel||``),onRollback:H})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`params(插件经 props.params 读取)`}),(0,U.jsx)(`textarea`,{defaultValue:JSON.stringify(Pe[S]?.params||{},null,1),spellCheck:!1,onBlur:e=>{try{Be(t=>{ze(t).panels[S].params=JSON.parse(e.target.value||`{}`)})}catch{Z.error(`params JSON 无效`)}},className:`h-20 w-full rounded-md border bg-muted p-2 font-mono text-[10px]`})]})]}),(0,U.jsx)(xg,{children:(0,U.jsx)(Y,{onClick:()=>x(!1),children:`完成`})})]})}),(0,U.jsx)(gg,{open:p,onOpenChange:e=>{m(e),e||g(null)},children:(0,U.jsxs)(yg,{children:[(0,U.jsx)(bg,{children:(0,U.jsxs)(Sg,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(gh,{className:`h-4 w-4`}),`插件库`,h===null?``:` · 插入到选中区块`]})}),(0,U.jsx)(`div`,{className:`max-h-72 overflow-y-auto`,children:(0,U.jsx)(`div`,{className:`space-y-1.5`,children:d.filter(e=>e.status!==`deprecated`).map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border p-2.5`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs font-medium`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:e.name,children:e.name}),(0,U.jsx)(J,{variant:`secondary`,className:`h-4 shrink-0 px-1 text-[9px]`,children:e.version}),(0,U.jsx)(J,{variant:`outline`,className:`h-4 shrink-0 px-1 text-[9px]`,children:e.author===`system`?`范本`:e.author===`ai`?`AI`:`人工`})]}),(0,U.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.description||e.id})]}),(0,U.jsx)(Y,{size:`sm`,variant:`secondary`,className:`h-7 shrink-0 text-[11px]`,onClick:()=>Ge(h,e),children:`插入`})]},e.id))})}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,size:`sm`,onClick:We,children:`先加空区块`}),(0,U.jsx)(Y,{variant:`outline`,onClick:()=>m(!1),children:`关闭`})]})]})}),(0,U.jsx)(gg,{open:ge,onOpenChange:_e,children:(0,U.jsxs)(yg,{className:`max-w-xs`,children:[(0,U.jsx)(bg,{children:(0,U.jsx)(Sg,{children:`重命名视图`})}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`视图名称`}),(0,U.jsx)(wg,{defaultValue:Ne.name,className:`text-xs`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(et(e.target.value),_e(!1))},onBlur:e=>{et(e.target.value),_e(!1)}},Ne.id)]})]})}),(0,U.jsx)(yO,{target:ve,onClose:()=>ye(null),agents:[{agent_id:e,name:t.workbench||`当前助手`}]}),(0,U.jsx)(`p`,{className:`shrink-0 text-center text-[11px] text-muted-foreground`,children:`区块几何 = 插件设计输入:宽≤3 列紧凑列表、≥9 列表格/仪表 · AI 定制锁定目标、上下文自动携带 · 草稿审阅发布。`})]})}function MO({className:e,size:t=`default`,...n}){return(0,U.jsx)(vf,{"data-slot":`switch`,"data-size":t,className:B(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80`,e),...n,children:(0,U.jsx)(bf,{"data-slot":`switch-thumb`,className:B(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground`)})})}function NO(){let[e,t]=(0,v.useState)([]),[n,r]=(0,v.useState)([]),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),c=[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],l=e=>{let t=e.trim().split(/\s+/);if(t.length!==5)return e;let n=e=>String(+e).padStart(2,`0`);return/^\d+ \d+ \* \* \*$/.test(e)?`每天 ${n(t[1])}:${n(t[0])}`:/^\d+ \* \* \* \*$/.test(e)?`每小时第 ${t[0]} 分`:/^\d+ \d+ \* \* \d+$/.test(e)&&+t[4]<=7?`每${c[t[4]%7]} ${n(t[1])}:${n(t[0])}`:`cron:${e}`},u=e=>{if(e.preset===`custom`)return e.cron.trim();if(e.preset===`hourly`)return`${+e.minute||0} * * * *`;let[t,n]=(e.time||`09:00`).split(`:`);return e.preset===`daily`?`${+n||0} ${+t||0} * * *`:`${+n||0} ${+t||0} * * ${e.weekday||`1`}`},d=e=>{let t=e.trim().split(/\s+/),n=e=>String(e).padStart(2,`0`);return t.length===5&&/^\d+ \d+ \* \* \*$/.test(e)?{preset:`daily`,time:`${n(+t[1])}:${n(+t[0])}`,minute:`0`,weekday:`1`}:t.length===5&&/^\d+ \* \* \* \*$/.test(e)?{preset:`hourly`,time:`09:00`,minute:t[0],weekday:`1`}:t.length===5&&/^\d+ \d+ \* \* \d+$/.test(e)&&+t[4]<=7?{preset:`weekly`,time:`${n(+t[1])}:${n(+t[0])}`,minute:`0`,weekday:String(t[4]%7)}:{preset:`custom`,time:`09:00`,minute:`0`,weekday:`1`}},f=e=>s(e?{mode:`edit`,id:e.id,name:e.name,agent_id:e.agent_id,...d(e.cron),cron:e.cron,autonomy:e.autonomy_level==null?``:String(e.autonomy_level),message:e.message}:{mode:`add`,name:``,agent_id:n[0]?.agent_id||``,preset:`daily`,time:`12:00`,minute:`0`,weekday:`1`,cron:`0 12 * * *`,autonomy:``,message:``}),p=()=>V(`/api/schedules`).then(e=>t(e.schedules||[])).catch(()=>{}),m=()=>{p(),V(`/api/quick-switch`).then(e=>r(e.agents||[])).catch(()=>{})};(0,v.useEffect)(()=>{m();let e=setInterval(m,3e4);return()=>clearInterval(e)},[]);let h=async()=>{let e=o;if(!e)return;let t=u(e);if(!e.name.trim()||!e.agent_id||!e.message.trim())Z.error(`名称、目标助手与消息内容必填`);else{a(e.id||`add`);try{let n={name:e.name.trim(),agent_id:e.agent_id,cron:t,message:e.message.trim(),...e.autonomy===``?{}:{autonomy_level:+e.autonomy}};e.mode===`add`?(await Oe(`/api/schedules`,n),Z.success(`定时任务「${e.name.trim()}」已创建`,{description:`${l(t)} · 到点自动发给该助手执行`})):(await ke(`/api/schedules/${e.id}`,n),Z.success(`定时任务已更新`)),s(null),await p()}catch(e){Z.error(String(e.message))}finally{a(null)}}},g=async(e,t)=>{a(e.id);try{await ke(`/api/schedules/${e.id}`,t),await p()}catch(e){Z.error(String(e.message))}finally{a(null)}},_=async e=>{a(e.id);try{let t=await Oe(`/api/schedules/${e.id}/run`),n={ok:`执行完成`,error:`执行出错`,skipped_busy:`会话忙,本次跳过`,skipped_pending:`有待确认操作,本次跳过`};t.run.status===`ok`?Z.success(`「${e.name}」${n[t.run.status]}`,{description:t.run.summary.slice(0,160)}):Z.warning(`「${e.name}」${n[t.run.status]||t.run.status}`,{description:t.run.summary.slice(0,160)}),await p()}catch(e){Z.error(String(e.message))}finally{a(null)}},y=async e=>{if(window.confirm(`删除定时任务「${e.name}」?(${l(e.cron)} → ${e.agent_name})`)){a(e.id);try{await Ae(`/api/schedules/${e.id}`,{}),Z.success(`已删除`),await p()}catch(e){Z.error(String(e.message))}finally{a(null)}}};return(0,U.jsxs)(`div`,{className:`h-full overflow-auto p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-bold`,children:[(0,U.jsx)(Wp,{className:`h-5 w-5 text-primary`}),`平台定时任务`]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`到点自动向在岗助手发消息并让它执行——与人工发消息完全同构(同一守护栏 / 分级自主 / 审计;打开该助手的工作台能在对话里看到每次定时轮次)。 会话正在处理或有待确认操作时跳过该次;停机期间错过的触发不补跑。`})]}),(0,U.jsx)(Gf,{className:`mb-3 max-w-3xl`,children:(0,U.jsxs)(Jf,{className:`space-y-3 p-4`,children:[n.length===0&&(0,U.jsx)(`div`,{className:`rounded-md border border-warning/40 bg-warning/10 p-2.5 text-[11px] leading-relaxed text-warning`,children:`当前没有在岗助手——定时任务面向在岗助手,先到「助手大厅」完成一次上岗配置。`}),e.length===0&&n.length>0&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`还没有定时任务——例如「每天 12:00,让巡检助手检查活跃告警并汇总到对话」。`}),e.length>0&&(0,U.jsx)(`div`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-2 text-xs ${e.enabled?``:`opacity-60`}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,U.jsx)(J,{variant:`outline`,className:`h-4 max-w-40 px-1 text-[9px]`,children:(0,U.jsx)(`span`,{className:`truncate`,children:e.agent_name})}),(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px] font-mono`,title:e.cron,children:l(e.cron)}),!e.deployed&&(0,U.jsx)(J,{className:`h-4 bg-destructive/15 px-1 text-[9px] text-destructive`,title:`目标助手已不在岗,任务将在下次触发时报错——请编辑或删除`,children:`已下岗`}),e.autonomy_level!=null&&(0,U.jsxs)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,title:`该任务覆盖会话的自主级别`,children:[`L`,e.autonomy_level]})]}),(0,U.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,title:e.message,children:e.message}),(0,U.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[e.enabled?`下次 ${e.next_run?Le(e.next_run,`dts`):`待计算`}`:`已停用`,e.last&&` · 最近:${{ok:`✅`,error:`❌`,skipped_busy:`⏭`,skipped_pending:`⏭`}[e.last.status]||``}${e.last.trigger===`manual`?`手动`:`定时`} ${Le(e.last.at,`dt`)} ${e.last.summary?`「${e.last.summary.slice(0,60)}」`:e.last.status}`]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(MO,{checked:e.enabled,disabled:i===e.id,onCheckedChange:t=>g(e,{enabled:t}),title:e.enabled?`停用`:`启用`}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,disabled:i===e.id,onClick:()=>_(e),title:`立即执行一次(不影响定时节奏)`,children:(0,U.jsx)(fh,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,disabled:i===e.id,onClick:()=>f(e),title:`编辑`,children:(0,U.jsx)(Kh,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0 text-destructive hover:text-destructive`,disabled:i===e.id,onClick:()=>y(e),title:`删除`,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})})]})]},e.id))}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(Y,{size:`sm`,className:`text-xs`,disabled:n.length===0,onClick:()=>f(),children:[(0,U.jsx)(mh,{className:`mr-1 h-3.5 w-3.5`}),`新建任务`]}),(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`周期支持常见预设与 cron(分 时 日 月 周,本地时区);精度约 ±30 秒。`})]})]})}),(0,U.jsx)(gg,{open:!!o,onOpenChange:e=>{!e&&i===null&&s(null)},children:(0,U.jsxs)(yg,{className:`max-w-lg`,children:[(0,U.jsxs)(bg,{children:[(0,U.jsxs)(Sg,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(Wp,{className:`h-4 w-4 text-primary`}),o?.mode===`add`?`新建定时任务`:`编辑 · ${o?.name}`]}),(0,U.jsx)(Cg,{className:`text-[11px]`,children:`到点后消息会以「【定时任务 · 名称】」开头发给目标助手,助手按其能力与守护栏执行。`})]}),o&&(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`任务名称`}),(0,U.jsx)(wg,{value:o.name,onChange:e=>s({...o,name:e.target.value}),placeholder:`如:每日告警巡检`,className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`目标助手(在岗)`}),(0,U.jsxs)(Eg,{value:o.agent_id,onValueChange:e=>s({...o,agent_id:e}),children:[(0,U.jsx)(Og,{className:`h-8 text-xs data-[size=default]:h-8`,children:(0,U.jsx)(Dg,{placeholder:`选择助手`})}),(0,U.jsx)(kg,{children:n.map(e=>(0,U.jsx)(Ag,{value:e.agent_id,className:`text-xs`,children:e.name},e.agent_id))})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`自主级别`}),(0,U.jsxs)(Eg,{value:o.autonomy,onValueChange:e=>s({...o,autonomy:e}),children:[(0,U.jsx)(Og,{className:`h-8 text-xs data-[size=default]:h-8`,title:`缺省跟随该助手的上岗配置;写命令仍按守护栏管控`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsx)(Ag,{value:``,className:`text-xs`,children:`跟随上岗配置`}),[`0`,`1`,`2`,`3`].map(e=>(0,U.jsxs)(Ag,{value:e,className:`text-xs`,children:[`L`,e,`:`,[`只读`,`建议`,`写需确认`,`免确认`][+e]]},e))]})]})]})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`周期`}),(0,U.jsxs)(Eg,{value:o.preset,onValueChange:e=>s({...o,preset:e}),children:[(0,U.jsx)(Og,{className:`h-8 text-xs data-[size=default]:h-8`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsx)(Ag,{value:`daily`,className:`text-xs`,children:`每天`}),(0,U.jsx)(Ag,{value:`hourly`,className:`text-xs`,children:`每小时`}),(0,U.jsx)(Ag,{value:`weekly`,className:`text-xs`,children:`每周`}),(0,U.jsx)(Ag,{value:`custom`,className:`text-xs`,children:`自定义 cron`})]})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[o.preset===`daily`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`时间`}),(0,U.jsx)(wg,{type:`time`,value:o.time,onChange:e=>s({...o,time:e.target.value}),className:`h-8 font-mono text-xs`})]}),o.preset===`hourly`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`第几分(0-59)`}),(0,U.jsx)(wg,{type:`number`,min:0,max:59,value:o.minute,onChange:e=>s({...o,minute:e.target.value}),className:`h-8 font-mono text-xs`})]}),o.preset===`weekly`&&(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`星期`}),(0,U.jsxs)(Eg,{value:o.weekday,onValueChange:e=>s({...o,weekday:e}),children:[(0,U.jsx)(Og,{className:`h-8 text-xs data-[size=default]:h-8`,children:(0,U.jsx)(Dg,{})}),(0,U.jsx)(kg,{children:[`1`,`2`,`3`,`4`,`5`,`6`,`0`].map(e=>(0,U.jsx)(Ag,{value:e,className:`text-xs`,children:c[e%7]},e))})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`时间`}),(0,U.jsx)(wg,{type:`time`,value:o.time,onChange:e=>s({...o,time:e.target.value}),className:`h-8 font-mono text-xs`})]})]}),o.preset===`custom`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`cron(分 时 日 月 周)`}),(0,U.jsx)(wg,{value:o.cron,onChange:e=>s({...o,cron:e.target.value}),placeholder:`*/30 9-18 * * 1-5`,className:`h-8 font-mono text-xs`})]})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`到点发送的消息`}),(0,U.jsx)(SD,{value:o.message,onChange:e=>s({...o,message:e.target.value}),placeholder:`如:检查当前活跃告警,把高优先级的汇总成一段简报发在这里;有异常升级的单独说明。`,className:`min-h-[88px] text-xs`})]}),(0,U.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`将按 `,(0,U.jsx)(`span`,{className:`font-mono`,children:l(u(o))}),` 触发(本地时区)。`]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:i!==null,onClick:()=>s(null),children:`取消`}),(0,U.jsx)(Y,{disabled:i!==null,onClick:h,children:i?`保存中…`:o?.mode===`add`?`创建任务`:`保存`})]})]})})]})}var PO=[{key:`tool_calls`,label:`工具调用`,icon:(0,U.jsx)(fg,{className:`h-3.5 w-3.5`}),tone:`text-chart-2`},{key:`guardrail_blocks`,label:`守护栏拦截`,icon:(0,U.jsx)(Rh,{className:`h-3.5 w-3.5`}),tone:`text-destructive`},{key:`human_confirms`,label:`人工确认执行`,icon:(0,U.jsx)(up,{className:`h-3.5 w-3.5`}),tone:`text-warning`},{key:`orchestrations`,label:`编排执行`,icon:(0,U.jsx)(Wh,{className:`h-3.5 w-3.5`}),tone:`text-violet-400`},{key:`experiences`,label:`经验回流`,icon:(0,U.jsx)(Sp,{className:`h-3.5 w-3.5`}),tone:`text-success`},{key:`kb_searches`,label:`知识检索`,icon:(0,U.jsx)(Oh,{className:`h-3.5 w-3.5`}),tone:`text-cyan-400`},{key:`ai_drafts`,label:`AI 起草`,icon:(0,U.jsx)(ig,{className:`h-3.5 w-3.5`}),tone:`text-pink-400`}];function FO(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(!1),c=()=>V(`/api/evolution`).then(t);(0,v.useEffect)(()=>{c();let e=setInterval(c,1e4);return()=>clearInterval(e)},[]);let l=async()=>{if(n.trim()){s(!0);try{let e=await V(`/api/kb/search?q=${encodeURIComponent(n)}`);a(e.items),c()}finally{s(!1)}}};return e?(0,U.jsxs)(`div`,{className:`h-full overflow-auto p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-bold`,children:[(0,U.jsx)(ig,{className:`h-5 w-5 text-primary`}),`自进化看板`]}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[e.flywheel_note,` · 数据来自审计日志与指标流的实时聚合`]})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-4 gap-3 xl:grid-cols-7`,children:PO.map(t=>(0,U.jsx)(Gf,{className:`py-3`,children:(0,U.jsxs)(Jf,{className:`px-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[t.icon,t.label]}),(0,U.jsx)(`div`,{className:`mt-1 text-xl font-bold ${t.tone}`,children:e.totals[t.key]??0})]})},t.key))}),(0,U.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4`,children:[(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsx)(qf,{className:`text-xs text-muted-foreground`,children:`飞轮证据 · 检索相似度趋势(回流前后对比)`})}),(0,U.jsx)(Jf,{className:`p-0`,children:(0,U.jsx)(bD,{className:`h-64`,children:(0,U.jsxs)(`div`,{className:`space-y-1.5 p-3`,children:[e.similarity_trend.length===0&&(0,U.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:`尚无检索记录`}),e.similarity_trend.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`w-40 shrink-0 truncate text-muted-foreground`,title:e.query,children:e.query}),(0,U.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:(0,U.jsx)(`div`,{className:`h-full rounded ${e.similarity>=75?`bg-success`:e.similarity>=55?`bg-warning`:`bg-muted-foreground`}`,style:{width:`${e.similarity}%`}})}),(0,U.jsxs)(`span`,{className:`w-9 text-right font-mono ${e.similarity>=75?`text-success`:`text-muted-foreground`}`,children:[e.similarity,`%`]})]},t))]})})})]}),(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsxs)(qf,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(Sp,{className:`h-3.5 w-3.5`}),`经验沉淀(写入 ARM 知识库)`]})}),(0,U.jsx)(Jf,{className:`p-0`,children:(0,U.jsx)(bD,{className:`h-64`,children:(0,U.jsxs)(`div`,{className:`divide-y`,children:[e.experiences.length===0&&(0,U.jsx)(`div`,{className:`p-8 text-center text-xs text-muted-foreground`,children:`尚无回流记录`}),e.experiences.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs`,children:[(0,U.jsx)(fm,{className:`h-3 w-3 shrink-0 text-success`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.title,children:e.title}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground`,children:e.knowledge_id?e.knowledge_id.slice(0,8):`—`}),(0,U.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:Le(e.ts)})]},t))]})})})]})]}),(0,U.jsxs)(`div`,{className:`mt-4 grid grid-cols-3 gap-4`,children:[(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsx)(qf,{className:`text-xs text-muted-foreground`,children:`工具调用分布`})}),(0,U.jsxs)(Jf,{className:`p-3`,children:[Object.keys(e.by_tool).length===0&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`暂无数据`}),Object.entries(e.by_tool).sort((e,t)=>t[1]-e[1]).map(([t,n])=>{let r=Math.max(...Object.values(e.by_tool));return(0,U.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`w-36 shrink-0 truncate font-mono`,children:t}),(0,U.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:(0,U.jsx)(`div`,{className:`h-full rounded bg-chart-2`,style:{width:`${n/r*100}%`}})}),(0,U.jsx)(`span`,{className:`w-6 text-right font-mono`,children:n})]},t)})]})]}),(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsxs)(qf,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(nm,{className:`h-3.5 w-3.5`}),`ARM 知识库实检(真实 RAG)`]})}),(0,U.jsxs)(Jf,{className:`p-3`,children:[(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(wg,{value:n,onChange:e=>r(e.target.value),onKeyDown:e=>e.key===`Enter`&&l(),placeholder:`如:堆垛机 货叉定位偏移`,className:`text-xs`}),(0,U.jsx)(Y,{size:`sm`,disabled:o,onClick:l,children:o?`检索中`:`检索`})]}),(0,U.jsx)(bD,{className:`mt-2 h-44`,children:(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[!i&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`输入问题检索企业经验库(与助手使用同一数据源)`}),i?.length===0&&(0,U.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`无命中`}),i?.map((e,t)=>(0,U.jsxs)(`div`,{className:`rounded-md bg-card px-2.5 py-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[e.similarity!=null&&(0,U.jsxs)(J,{variant:`secondary`,className:`h-4 text-[9px] ${e.similarity>=75?`text-success`:``}`,children:[e.similarity,`%`]}),(0,U.jsx)(`span`,{className:`truncate font-medium`,children:e.title})]}),(0,U.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-[10px] leading-relaxed text-muted-foreground`,children:e.snippet})]},t))]})})]})]}),(0,U.jsxs)(Gf,{className:`py-0`,children:[(0,U.jsx)(Kf,{className:`border-b py-2.5`,children:(0,U.jsx)(qf,{className:`text-xs text-muted-foreground`,children:`审计流(实时)`})}),(0,U.jsx)(Jf,{className:`p-0`,children:(0,U.jsx)(bD,{className:`h-52`,children:(0,U.jsx)(`div`,{className:`divide-y font-mono text-[10px]`,children:e.recent_audit.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:Le(e.ts,`t`)}),(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:e.actor}),(0,U.jsx)(`span`,{className:`truncate`,children:e.tool||e.logic||e.action||e.name||e.verdict||``})]},t))})})})]})]})]}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`进化数据加载中…`})}function IO(){let[e,t]=(0,v.useState)(`arm`),n=e===`evolution`||e===`plugins`,[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)({}),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(`auto`),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(``),[ee,M]=(0,v.useState)(!1),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(!1),[L,te]=(0,v.useState)([]),[ne,re]=(0,v.useState)([]),[ie,ae]=(0,v.useState)(!1),[oe,se]=(0,v.useState)(``),[ce,le]=(0,v.useState)(``),[ue,de]=(0,v.useState)(!1),[fe,R]=(0,v.useState)(null),z=()=>{V(`/api/settings`).then(e=>{i(e),c(e.arm.sources||[]),g(e.llm.model),y(e.llm.base_url_runtime?e.llm.base_url:``),C(e.llm.context_tokens_runtime?String(e.llm.context_tokens):``),T(e.llm.vision_mode||`auto`),j(e.scene.profile),te(e.guard.deny),re(e.guard.ro),ae(e.guard.sudo_u_l2)}),V(`/api/arm/status`).then(o).catch(()=>o(null))};(0,v.useEffect)(()=>{z()},[]);let pe=e=>e.online?`连通 ${e.latency_ms}ms`:`不可达:${e.error||``}`,me=async e=>{f(e.id);try{let t=await Oe(`/api/arm/sources/${encodeURIComponent(e.id)}/select`);m(n=>({...n,[e.id]:t.probe})),t.probe.online?Z.success(`当前源已切换为「${e.name}」(${pe(t.probe)})`,{description:`大厅目录、下载、新建、发布、经验回流即时跟随`}):Z.warning(`当前源已切换为「${e.name}」,但${pe(t.probe)}`,{description:`大厅显示本地库;可随时切回其他源`}),z()}catch(e){Z.error(String(e.message))}finally{f(null)}},he=async e=>{f(e.id);try{let t=await Oe(`/api/arm/sources/${encodeURIComponent(e.id)}/probe`);m(n=>({...n,[e.id]:t}))}catch(e){Z.error(String(e.message))}finally{f(null)}},ge=async e=>{if(window.confirm(`删除 ARM 源「${e.name}」?\n不影响已下载的本地助手(它们会显示为「来自 ${e.name}」);若它是当前源,将切回默认源。`)){f(e.id);try{await Ae(`/api/arm/sources/${encodeURIComponent(e.id)}`,{}),Z.success(`已删除源「${e.name}」`),z()}catch(e){Z.error(String(e.message))}finally{f(null)}}},_e=async()=>{let e=l;if(e){f(e.id||`add`);try{if(e.mode===`add`){let t=await Oe(`/api/arm/sources`,{name:e.name.trim(),base:e.base.trim(),token:e.token.trim()});m(e=>({...e,[t.source.id]:t.probe})),t.probe.online?Z.success(`已添加源「${t.source.name}」(${pe(t.probe)})`,{description:`在列表上点「设为当前」或到大厅切换即可使用`}):Z.warning(`已添加源「${t.source.name}」,但${pe(t.probe)}`,{description:`检查地址/令牌,或稍后点「测试连接」`})}else await ke(`/api/arm/sources/${encodeURIComponent(e.id)}`,{name:e.name.trim(),base:e.base.trim(),...e.clearToken?{token:``}:e.token.trim()?{token:e.token.trim()}:{}}),Z.success(`源「${e.name.trim()}」已更新`);u(null),z()}catch(e){Z.error(String(e.message))}finally{f(null)}}},ve=async()=>{D(!0),k(null);try{let e=await ke(`/api/settings`,{llm_model:h.trim(),llm_base_url:_.trim(),llm_context_tokens:S.trim(),llm_vision:w,...b.trim()?{llm_api_key:b.trim()}:{}});x(``),k(e.llm_probe||null),e.llm_probe?.online?Z.success(`模型已切换(探针 ${e.llm_probe.latency_ms}ms:${e.llm_probe.reply||`ok`})`):e.note&&Z.warning(`已保存,但探针未通过`,{description:e.note}),z()}catch(e){Z.error(String(e.message))}finally{D(!1)}},ye=async()=>{I(!0);try{if(await ke(`/api/settings`,{access_token:N}),N.trim()){if(!(await fetch(`/api/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:N.trim()})})).ok)throw Error(`已保存但自动登录失败,刷新后输入令牌进入`);Z.success(`访问令牌已启用(当前浏览器已自动登录)`)}else Z.success(`访问令牌已关闭(恢复开放访问)`);P(``),z()}catch(e){Z.error(String(e.message))}finally{I(!1)}},be=async()=>{M(!0);try{await ke(`/api/settings`,{scene_profile:A}),Z.success(A.trim()?`场景画像已保存,对全部助手即时生效(新对话起)`:`场景画像已清空(不再注入)`),z()}catch(e){Z.error(String(e.message))}finally{M(!1)}},xe=async()=>{de(!0);try{await ke(`/api/settings`,{guard:{deny:L,ro:ne,sudo_u_l2:ie}}),Z.success(`守护栏已更新(危险规则 ${L.length} 条 · 白名单 ${ne.length} 命令),即时生效`),R(null),z()}catch(e){Z.error(String(e.message))}finally{de(!1)}};return(0,U.jsxs)(`div`,{className:`h-full overflow-auto p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-bold`,children:[(0,U.jsx)(Ih,{className:`h-5 w-5 text-primary`}),`系统设置`]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`平台全局配置 · 修改保存后即时生效(无需重启)· 运行时配置优先于 .env`})]}),(0,U.jsxs)(pO,{value:e,onValueChange:t,className:n?``:`max-w-2xl`,children:[(0,U.jsxs)(hO,{children:[(0,U.jsxs)(gO,{value:`arm`,className:`text-xs`,children:[(0,U.jsx)(Mh,{className:`mr-1 h-3.5 w-3.5`}),`ARM 源`,a&&(0,U.jsx)(`span`,{className:`ml-1 h-1.5 w-1.5 rounded-full ${a.online?`bg-success`:`bg-warning`}`})]}),(0,U.jsxs)(gO,{value:`llm`,className:`text-xs`,children:[(0,U.jsx)(wp,{className:`mr-1 h-3.5 w-3.5`}),`LLM 模型服务`]}),(0,U.jsxs)(gO,{value:`scene`,className:`text-xs`,children:[(0,U.jsx)(wm,{className:`mr-1 h-3.5 w-3.5`}),`场景画像`,r&&r.scene.length>0&&(0,U.jsx)(`span`,{className:`ml-1 h-1.5 w-1.5 rounded-full bg-success`})]}),(0,U.jsxs)(gO,{value:`auth`,className:`text-xs`,children:[(0,U.jsx)(Wm,{className:`mr-1 h-3.5 w-3.5`}),`访问安全`,r?.auth.enabled&&(0,U.jsx)(`span`,{className:`ml-1 h-1.5 w-1.5 rounded-full bg-success`})]}),(0,U.jsxs)(gO,{value:`guard`,className:`text-xs`,children:[(0,U.jsx)(Hh,{className:`mr-1 h-3.5 w-3.5`}),`守护栏`,(0,U.jsxs)(`span`,{className:`ml-1 text-[9px] text-muted-foreground`,children:[L.length,`规`]})]}),(0,U.jsxs)(gO,{value:`evolution`,className:`text-xs`,children:[(0,U.jsx)(ig,{className:`mr-1 h-3.5 w-3.5`}),`自进化`]}),(0,U.jsxs)(gO,{value:`plugins`,className:`text-xs`,children:[(0,U.jsx)(gh,{className:`mr-1 h-3.5 w-3.5`}),`插件中心`]})]}),(0,U.jsxs)(_O,{value:`arm`,className:`mt-3`,children:[(0,U.jsxs)(Gf,{className:`mb-3 max-w-2xl`,children:[(0,U.jsxs)(Kf,{className:`pb-2`,children:[(0,U.jsxs)(qf,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(Mh,{className:`h-4 w-4 text-primary`}),`ARM 源`,a&&(0,U.jsx)(J,{variant:`outline`,className:`text-[10px] ${a.online?`text-success`:`text-warning`}`,children:a.online?`在线 · ${a.latency_ms}ms`:`不可达(回落本地库)`})]}),(0,U.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:`ARM 是可私有化部署的资源管理系统(助手档案 + 知识库)。可配置多个源——公司公库、客户私库、本地开发版——并随时切换当前源: 检索 / 下载 / 新建 / 发布 / 经验回流全部即时跟随;已下载的本地助手不受影响,并记住自己来自哪个源。`})]}),(0,U.jsxs)(Jf,{className:`space-y-3`,children:[r&&!r.arm.token_set&&r.arm.token_source===`none`&&(0,U.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/40 bg-warning/10 p-2.5 text-[11px] leading-relaxed text-warning`,children:[(0,U.jsx)(`span`,{className:`shrink-0`,children:`🔑`}),(0,U.jsxs)(`div`,{className:`flex-1`,children:[`当前源「`,r.arm.current_name,`」尚未配置访问令牌——匿名仅能浏览目录,`,(0,U.jsx)(`b`,{children:`下载 / 上岗 / 新建 / 发布 / 经验回流`}),`等操作会被 ARM 拒绝(401/403)。 请登录该 ARM 站点生成访问令牌(arm_pat_… 开头),点该源的编辑按钮粘贴保存。`,(0,U.jsx)(`a`,{href:r.arm.api_base,target:`_blank`,rel:`noreferrer`,className:`ml-1 underline underline-offset-2 hover:text-warning`,children:`打开 ARM 生成令牌 →`})]})]}),(0,U.jsx)(`div`,{className:`divide-y rounded-md border`,children:s.map(e=>{let t=p[e.id],n={runtime:`运行时配置`,env:`env ARM_API_TOKEN`,pat:`~/.arm PAT`,none:``}[e.token_source];return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-2 text-xs ${e.current?`bg-primary/5`:``}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.name}),e.current&&(0,U.jsx)(J,{className:`h-4 px-1 text-[9px]`,children:`当前`}),e.builtin&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,title:`内置默认源:地址/令牌留空时回落 env(ARM_API_BASE / ARM_API_TOKEN)、~/.arm PAT 与内网默认地址;不可删除`,children:`默认`}),t&&(0,U.jsx)(`span`,{className:`text-[10px] ${t.online?`text-success`:`text-warning`}`,children:pe(t)})]}),(0,U.jsxs)(`div`,{className:`truncate font-mono text-[10px] text-muted-foreground`,title:e.base,children:[e.base||`(未配置地址)`,e.builtin&&!e.base_runtime?` · 默认地址`:``]}),(0,U.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[`令牌:`,e.token_set?`${e.token_masked} · ${n}`:`未配置(匿名只读;下载/新建/发布会被拒)`]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[!e.current&&(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 text-[11px]`,disabled:d===e.id,onClick:()=>me(e),title:`设为当前源:大厅目录 / 下载 / 新建 / 发布 / 经验回流即时切换`,children:[(0,U.jsx)(Ap,{className:`mr-1 h-3 w-3`}),`设为当前`]}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,disabled:d===e.id,onClick:()=>he(e),title:`测试连接(不切换)`,children:(0,U.jsx)(ug,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,onClick:()=>u({mode:`edit`,id:e.id,name:e.name,base:e.base_runtime?e.base:``,token:``,builtin:e.builtin,clearToken:!1}),title:`编辑名称 / 地址 / 令牌`,children:(0,U.jsx)(Kh,{className:`h-3.5 w-3.5`})}),!e.builtin&&(0,U.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0 text-destructive hover:text-destructive`,disabled:d===e.id,onClick:()=>ge(e),title:`删除源(不影响已下载的本地助手)`,children:(0,U.jsx)(ng,{className:`h-3.5 w-3.5`})})]})]},e.id)})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(Y,{size:`sm`,className:`text-xs`,onClick:()=>u({mode:`add`,name:``,base:``,token:``,clearToken:!1}),children:[(0,U.jsx)(mh,{className:`mr-1 h-3.5 w-3.5`}),`添加 ARM 源`]}),(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`公库 / 私库并存:从一个源下载助手,在大厅切到另一个源后点卡片「发布」即可推送过去(同 id,身份不变)。`})]})]})]}),(0,U.jsx)(gg,{open:!!l,onOpenChange:e=>{!e&&d===null&&u(null)},children:(0,U.jsxs)(yg,{className:`max-w-md`,children:[(0,U.jsxs)(bg,{children:[(0,U.jsxs)(Sg,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(Mh,{className:`h-4 w-4 text-primary`}),l?.mode===`add`?`添加 ARM 源`:`编辑 ARM 源 · ${l?.name}`]}),(0,U.jsx)(Cg,{className:`text-[11px]`,children:`每个源使用自己的访问令牌——不会把一个站点的令牌发给另一个站点。`})]}),l&&(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`名称`}),(0,U.jsx)(wg,{value:l.name,onChange:e=>u({...l,name:e.target.value}),placeholder:`如 公司公库 / 客户私库 / 本地开发版`,className:`text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`站点地址(REST API 根地址)`}),(0,U.jsx)(wg,{value:l.base,onChange:e=>u({...l,base:e.target.value}),placeholder:l.builtin?`留空 = 回落 env / 内置默认(${(r?.arm.default_base||``).replace(/^https?:\/\//,``)})`:`如 http://localhost:3001 或 https://arm.customer.com`,className:`font-mono text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Tg,{className:`text-xs`,children:`访问令牌(arm_pat_…)`}),(0,U.jsx)(wg,{type:`password`,value:l.token,disabled:l.clearToken,onChange:e=>u({...l,token:e.target.value}),placeholder:l.mode===`edit`?`留空保持不变`:l.builtin?`留空 = 回落 env / ~/.arm PAT`:`留空 = 匿名只读`,className:`font-mono text-xs`}),l.mode===`edit`&&(0,U.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(MO,{checked:l.clearToken,onCheckedChange:e=>u({...l,clearToken:e,token:e?``:l.token})}),`清除已配置的令牌`,l.builtin?`(回落 env / PAT)`:`(转匿名只读)`]})]})]}),(0,U.jsxs)(xg,{children:[(0,U.jsx)(Y,{variant:`outline`,disabled:d!==null,onClick:()=>u(null),children:`取消`}),(0,U.jsx)(Y,{disabled:d!==null||!l?.name.trim()||!l?.builtin&&!l?.base.trim(),onClick:_e,children:d?`保存中…`:l?.mode===`add`?`添加并测试连接`:`保存`})]})]})})]}),(0,U.jsx)(_O,{value:`llm`,className:`mt-3`,children:(0,U.jsxs)(Gf,{className:`mb-3 max-w-2xl`,children:[(0,U.jsxs)(Kf,{className:`pb-2`,children:[(0,U.jsxs)(qf,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(wp,{className:`h-4 w-4 text-primary`}),`LLM 模型服务`,r&&(0,U.jsx)(J,{variant:`outline`,className:`text-[10px]`,children:r.llm.model})]}),(0,U.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:`OpenAI 兼容端点:缺省公司内网 bifrost 网关(内网开箱可用),可切换模型 / 自建网关 / 公有云端点。保存后新对话即时使用新模型,应用失败自动回滚。`})]}),(0,U.jsxs)(Jf,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`模型`,r&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:r.llm.model_runtime?`运行时配置`:`默认(.env)`})]}),(0,U.jsx)(wg,{value:h,onChange:e=>g(e.target.value),list:`llm-catalog`,placeholder:`如 def / glm-5.3 / 自定义名称`,className:`font-mono text-xs`}),(0,U.jsx)(`datalist`,{id:`llm-catalog`,children:(r?.llm.catalog||[]).map(e=>(0,U.jsx)(`option`,{value:e},e))})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`text-xs`,children:[`端点地址(留空 = `,r?.llm.default_base||`默认内网 bifrost`,`)`]}),(0,U.jsx)(wg,{value:_,onChange:e=>y(e.target.value),placeholder:`https://your-gateway/v1(OpenAI 兼容)`,className:`font-mono text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`API Key`,r&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:r.llm.key_set?`${r.llm.key_masked} · ${r.llm.key_source}`:`未配置`})]}),(0,U.jsx)(wg,{type:`password`,value:b,onChange:e=>x(e.target.value),placeholder:r?.llm.key_set?`已配置(留空保持不变)`:`sk-… / api key`,className:`font-mono text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`上下文窗口(token)`,r&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:r.llm.context_tokens_source===`runtime`?`运行时配置 ${r.llm.context_tokens}`:r.llm.context_tokens_source===`model`?`自动识别 ${r.llm.context_tokens}`:`默认 ${r.llm.default_context_tokens}`})]}),(0,U.jsx)(wg,{type:`number`,inputMode:`numeric`,min:4e3,max:2e6,step:1e3,value:S,onChange:e=>C(e.target.value),placeholder:`留空 = 按模型自动识别(未识别回落 ${r?.llm.default_context_tokens||128e3})`,className:`font-mono text-xs`}),(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`留空 = 按模型名自动识别(GLM-5.x / MiniMax-M3+ / GPT-4.1 / Gemini → 1M,GLM-4.6 / Claude → 200K,其余常见 128K 档)。会话历史超出窗口时自动丢弃最早轮次(保留当前轮);配大了也不怕——请求若仍报上下文超限,系统会自动收缩历史并重试一次,再失败会给出明确的调低指引。`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(Tg,{className:`flex items-center gap-2 text-xs`,children:[`视觉能力(对话附图)`,r&&(0,U.jsx)(J,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:r.llm.vision?`当前:支持看图`:`当前:不支持看图`})]}),(0,U.jsxs)(Eg,{value:w,onValueChange:e=>T(e),children:[(0,U.jsx)(Og,{className:`h-8 w-full text-xs data-[size=default]:h-8`,children:(0,U.jsx)(Dg,{})}),(0,U.jsxs)(kg,{children:[(0,U.jsxs)(Ag,{value:`auto`,className:`text-xs`,children:[`自动(按模型条目判定:`,r?.llm.vision_auto?`支持`:`不支持`,`)`]}),(0,U.jsx)(Ag,{value:`on`,className:`text-xs`,children:`强制开 — 自定义模型确认支持视觉时`}),(0,U.jsx)(Ag,{value:`off`,className:`text-xs`,children:`强制关 — 图片只存工作区,不送模型`})]})]}),(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`开:对话里粘贴/上传的图片随消息送给模型识别;关:图片仅保存到工作区供助手按路径处理。自定义模型名(如 def)按纯文本模板克隆、无法自动识别能力,请按实际选择。`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Y,{size:`sm`,className:`text-xs`,disabled:E,onClick:ve,children:E?`切换中…`:`保存并测试模型`}),O&&(0,U.jsx)(`span`,{className:`flex items-center gap-1 text-[11px] ${O.online?`text-success`:`text-warning`}`,children:O.online?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Bp,{className:`h-3.5 w-3.5`}),`探针通过 `,O.latency_ms,`ms:`,O.reply]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kp,{className:`h-3.5 w-3.5`}),`未通过:`,O.error]})})]})]})]})}),(0,U.jsx)(_O,{value:`scene`,className:`mt-3`,children:(0,U.jsxs)(Gf,{className:`mb-3 max-w-2xl`,children:[(0,U.jsxs)(Kf,{className:`pb-2`,children:[(0,U.jsxs)(qf,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(wm,{className:`h-4 w-4 text-primary`}),`场景画像`,r&&(0,U.jsx)(J,{variant:`outline`,className:`text-[10px] ${r.scene.length?`text-success`:``}`,children:r.scene.length?`已启用 · ${r.scene.length} 字`:`未配置(不注入)`})]}),(0,U.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[`平台级、全局一份的使用方场景描述(团队环境 / 系统清单 / 规范 / 联系人),作为常驻事实注入`,(0,U.jsx)(`b`,{children:`所有助手`}),`的上下文—— 助手不必每次重新探索环境。与知识检索互补(常驻事实 vs 按需检索)。⚠ 不放凭据:写"凭据在哪、找谁要"即可。`]})]}),(0,U.jsxs)(Jf,{className:`space-y-2`,children:[(0,U.jsx)(`textarea`,{value:A,onChange:e=>j(e.target.value),spellCheck:!1,rows:8,placeholder:`例如:
102
102
  · 团队负责公司内部系统的运维与研发提效
103
103
  · 系统:ARM(助手管理)、Nexus(nexus.aimstek.cn)、Jenkins、玄武环境、WMS
104
104
  · 服务器多为 root/统一密码策略,凭据找张三