@lacneu/atrium 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -161,4 +161,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
161
161
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
162
162
|
`},W4e={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function G4e(e){let{announcements:t=W4e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=U4e}=e,{announce:a,announcement:o}=B4e(),s=A6(`DndLiveRegion`),[c,l]=(0,N.useState)(!1);if((0,N.useEffect)(()=>{l(!0)},[]),V4e((0,N.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=N.createElement(N.Fragment,null,N.createElement(R4e,{id:r,value:i.draggable}),N.createElement(z4e,{id:s,announcement:o}));return n?(0,ls.createPortal)(u,n):u}var z6;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(z6||={});function B6(){}function V6(e,t){return(0,N.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function H6(){var e=[...arguments];return(0,N.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var U6=Object.freeze({x:0,y:0});function W6(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function K4e(e,t){let n=F6(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function G6(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function q4e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function K6(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function q6(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function J6(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var J4e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=J6(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=W6(J6(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(G6)},Y6=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=K6(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=K6(r),o=i.reduce((e,t,r)=>e+W6(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(G6)};function Y4e(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var X4e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Y4e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(q4e)};function Z4e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function X6(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:U6}function Q4e(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var $4e=Q4e(1);function Z6(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function e3e(e,t,n){let r=Z6(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var t3e={ignoreTransform:!1};function Q6(e,t){t===void 0&&(t=t3e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=v6(e).getComputedStyle(e);t&&(n=e3e(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function $6(e){return Q6(e,{ignoreTransform:!0})}function n3e(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function r3e(e,t){return t===void 0&&(t=v6(e).getComputedStyle(e)),t.position===`fixed`}function i3e(e,t){t===void 0&&(t=v6(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function e8(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(y6(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!b6(i)||x6(i)||n.includes(i))return n;let a=v6(e).getComputedStyle(i);return i!==e&&i3e(i,a)&&n.push(i),r3e(i,a)?n:r(i.parentNode)}return e?r(e):n}function t8(e){let[t]=e8(e,1);return t??null}function n8(e){return!h6||!e?null:g6(e)?e:_6(e)?y6(e)||e===S6(e).scrollingElement?window:b6(e)?e:null:null}function r8(e){return g6(e)?e.scrollX:e.scrollLeft}function i8(e){return g6(e)?e.scrollY:e.scrollTop}function a8(e){return{x:r8(e),y:i8(e)}}var o8;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(o8||={});function s8(e){return!h6||!e?!1:e===document.scrollingElement}function c8(e){let t={x:0,y:0},n=s8(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var a3e={x:.2,y:.2};function o3e(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=a3e);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=c8(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=o8.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=o8.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=o8.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=o8.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function s3e(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function l8(e){return e.reduce((e,t)=>M6(e,a8(t)),U6)}function c3e(e){return e.reduce((e,t)=>e+r8(t),0)}function l3e(e){return e.reduce((e,t)=>e+i8(t),0)}function u8(e,t){if(t===void 0&&(t=Q6),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);t8(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var u3e=[[`x`,[`left`,`right`],c3e],[`y`,[`top`,`bottom`],l3e]],d8=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=e8(t),r=l8(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of u3e)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},f8=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function d3e(e){let{EventTarget:t}=v6(e);return e instanceof t?e:S6(e)}function p8(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var m8;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(m8||={});function h8(e){e.preventDefault()}function f3e(e){e.stopPropagation()}var g8;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(g8||={});var _8={start:[g8.Space,g8.Enter],cancel:[g8.Esc],end:[g8.Space,g8.Enter,g8.Tab]},p3e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case g8.Right:return{...n,x:n.x+25};case g8.Left:return{...n,x:n.x-25};case g8.Down:return{...n,y:n.y+25};case g8.Up:return{...n,y:n.y-25}}},v8=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new f8(S6(t)),this.windowListeners=new f8(v6(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(m8.Resize,this.handleCancel),this.windowListeners.add(m8.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(m8.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&u8(n),t(U6)}handleKeyDown(e){if(P6(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=_8,coordinateGetter:a=p3e,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:U6;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=N6(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=c8(n),p=s3e(n),m={x:Math.min(i===g8.Right?p.right-p.width/2:p.right,Math.max(i===g8.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===g8.Down?p.bottom-p.height/2:p.bottom,Math.max(i===g8.Down?p.top:p.top+p.height/2,u.y))},h=i===g8.Right&&!s||i===g8.Left&&!c,g=i===g8.Down&&!l||i===g8.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===g8.Right&&e<=d.x||i===g8.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===g8.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===g8.Down&&e<=d.y||i===g8.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===g8.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,M6(N6(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};v8.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=_8,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function y8(e){return!!(e&&`distance`in e)}function b8(e){return!!(e&&`delay`in e)}var x8=class{constructor(e,t,n){n===void 0&&(n=d3e(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=S6(i),this.documentListeners=new f8(this.document),this.listeners=new f8(n),this.windowListeners=new f8(v6(i)),this.initialCoordinates=F6(r)??U6,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(m8.Resize,this.handleCancel),this.windowListeners.add(m8.DragStart,h8),this.windowListeners.add(m8.VisibilityChange,this.handleCancel),this.windowListeners.add(m8.ContextMenu,h8),this.documentListeners.add(m8.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(b8(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(y8(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(m8.Click,f3e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(m8.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=F6(e)??U6,s=N6(n,o);if(!t&&a){if(y8(a)){if(a.tolerance!=null&&p8(s,a.tolerance))return this.handleCancel();if(p8(s,a.distance))return this.handleStart()}if(b8(a)&&p8(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===g8.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},m3e={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},S8=class extends x8{constructor(e){let{event:t}=e,n=S6(t.target);super(e,m3e,n)}};S8.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var h3e={move:{name:`mousemove`},end:{name:`mouseup`}},C8;(function(e){e[e.RightClick=2]=`RightClick`})(C8||={});var g3e=class extends x8{constructor(e){super(e,h3e,S6(e.event.target))}};g3e.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===C8.RightClick?!1:(r?.({event:n}),!0)}}];var w8={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},_3e=class extends x8{constructor(e){super(e,w8)}static setup(){return window.addEventListener(w8.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(w8.move.name,e)};function e(){}}};_3e.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var T8;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(T8||={});var E8;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(E8||={});function v3e(e){let{acceleration:t,activator:n=T8.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=E8.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=b3e({delta:d,disabled:!a}),[m,h]=N4e(),g=(0,N.useRef)({x:0,y:0}),_=(0,N.useRef)({x:0,y:0}),v=(0,N.useMemo)(()=>{switch(n){case T8.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case T8.DraggableRect:return i}},[n,i,c]),y=(0,N.useRef)(null),b=(0,N.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,N.useMemo)(()=>s===E8.TreeOrder?[...l].reverse():l,[s,l]);(0,N.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=o3e(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var y3e={x:{[o8.Backward]:!1,[o8.Forward]:!1},y:{[o8.Backward]:!1,[o8.Forward]:!1}};function b3e(e){let{delta:t,disabled:n}=e,r=O6(t);return E6(e=>{if(n||!r||!e)return y3e;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[o8.Backward]:e.x[o8.Backward]||i.x===-1,[o8.Forward]:e.x[o8.Forward]||i.x===1},y:{[o8.Backward]:e.y[o8.Backward]||i.y===-1,[o8.Forward]:e.y[o8.Forward]||i.y===1}}},[n,t,r])}function x3e(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return E6(e=>t==null?null:r??e??null,[r,t])}function S3e(e,t){return(0,N.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var D8;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(D8||={});var O8;(function(e){e.Optimized=`optimized`})(O8||={});var k8=new Map;function C3e(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,N.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,N.useRef)(e),d=g(),f=T6(d),p=(0,N.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,N.useRef)(null),h=E6(t=>{if(d&&!n)return k8;if(!t||t===k8||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new d8(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,N.useEffect)(()=>{u.current=e},[e]),(0,N.useEffect)(()=>{d||p()},[n,d]),(0,N.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,N.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case D8.Always:return!1;case D8.BeforeDragging:return n;default:return!n}}}function A8(e,t){return E6(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function w3e(e,t){return A8(e,t)}function T3e(e){let{callback:t,disabled:n}=e,r=w6(t),i=(0,N.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,N.useEffect)(()=>()=>i?.disconnect(),[i]),i}function j8(e){let{callback:t,disabled:n}=e,r=w6(t),i=(0,N.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,N.useEffect)(()=>()=>i?.disconnect(),[i]),i}function E3e(e){return new d8(Q6(e),e)}function M8(e,t,n){t===void 0&&(t=E3e);let[r,i]=(0,N.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=T3e({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=j8({callback:a});return C6(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function D3e(e){return X6(e,A8(e))}var N8=[];function O3e(e){let t=(0,N.useRef)(e),n=E6(n=>e?n&&n!==N8&&e&&t.current&&e.parentNode===t.current.parentNode?n:e8(e):N8,[e]);return(0,N.useEffect)(()=>{t.current=e},[e]),n}function k3e(e){let[t,n]=(0,N.useState)(null),r=(0,N.useRef)(e),i=(0,N.useCallback)(e=>{let t=n8(e.target);t&&n(e=>e?(e.set(t,a8(t)),new Map(e)):null)},[]);return(0,N.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=n8(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,a8(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{n8(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,N.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>M6(e,t),U6):l8(e):U6,[e,t])}function P8(e,t){t===void 0&&(t=[]);let n=(0,N.useRef)(null);return(0,N.useEffect)(()=>{n.current=null},t),(0,N.useEffect)(()=>{let t=e!==U6;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?N6(e,n.current):U6}function A3e(e){(0,N.useEffect)(()=>{if(!h6)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function j3e(e,t){return(0,N.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function F8(e){return(0,N.useMemo)(()=>e?n3e(e):null,[e])}var I8=[];function M3e(e,t){t===void 0&&(t=Q6);let[n]=e,r=F8(n?v6(n):null),[i,a]=(0,N.useState)(I8);function o(){a(()=>e.length?e.map(e=>s8(e)?r:new d8(t(e),e)):I8)}let s=j8({callback:o});return C6(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function L8(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return b6(t)?t:e}function N3e(e){let{measure:t}=e,[n,r]=(0,N.useState)(null),i=j8({callback:(0,N.useCallback)(e=>{for(let{target:n}of e)if(b6(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=D6((0,N.useCallback)(e=>{let n=L8(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,N.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var P3e=[{sensor:S8,options:{}},{sensor:v8,options:{}}],F3e={current:{}},R8={draggable:{measure:$6},droppable:{measure:$6,strategy:D8.WhileDragging,frequency:O8.Optimized},dragOverlay:{measure:Q6}},z8=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},I3e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new z8,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:B6},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:R8,measureDroppableContainers:B6,windowRect:null,measuringScheduled:!1},B8={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:B6,draggableNodes:new Map,over:null,measureDroppableContainers:B6},V8=(0,N.createContext)(B8),H8=(0,N.createContext)(I3e);function L3e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new z8}}}function R3e(e,t){switch(t.type){case z6.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case z6.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case z6.DragEnd:case z6.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case z6.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new z8(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case z6.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new z8(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case z6.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new z8(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function z3e(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,N.useContext)(V8),a=O6(r),o=O6(n?.id);return(0,N.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!P6(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=I4e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function U8(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function B3e(e){return(0,N.useMemo)(()=>({draggable:{...R8.draggable,...e?.draggable},droppable:{...R8.droppable,...e?.droppable},dragOverlay:{...R8.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function V3e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,N.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;C6(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=X6(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=t8(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var W8=(0,N.createContext)({...U6,scaleX:1,scaleY:1}),G8;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(G8||={});var K8=(0,N.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=P3e,collisionDetection:o=X4e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,N.useReducer)(R3e,void 0,L3e),[f,p]=H4e(),[m,h]=(0,N.useState)(G8.Uninitialized),g=m===G8.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,N.useRef)({initial:null,translated:null}),C=(0,N.useMemo)(()=>_==null?null:{id:_,data:x?.data??F3e,rect:S},[_,x]),w=(0,N.useRef)(null),[T,E]=(0,N.useState)(null),[D,O]=(0,N.useState)(null),ee=T6(l,Object.values(l)),te=A6(`DndDescribedBy`,t),k=(0,N.useMemo)(()=>b.getEnabled(),[b]),A=B3e(s),{droppableRects:j,measureDroppableContainers:ne,measuringScheduled:re}=C3e(k,{dragging:g,dependencies:[y.x,y.y],config:A.droppable}),M=x3e(v,_),ie=(0,N.useMemo)(()=>D?F6(D):null,[D]),ae=Ie(),oe=w3e(M,A.draggable.measure);V3e({activeNode:_==null?null:v.get(_),config:ae.layoutShiftCompensation,initialRect:oe,measure:A.draggable.measure});let se=M8(M,A.draggable.measure,oe),ce=M8(M?M.parentElement:null),le=(0,N.useRef)({activatorEvent:null,active:null,activeNode:M,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ue=b.getNodeFor(le.current.over?.id),de=N3e({measure:A.dragOverlay.measure}),fe=de.nodeRef.current??M,pe=g?de.rect??se:null,me=!!(de.nodeRef.current&&de.rect),he=D3e(me?null:se),ge=F8(fe?v6(fe):null),_e=O3e(g?ue??M:null),ve=M3e(_e),ye=U8(c,{transform:{x:y.x-he.x,y:y.y-he.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:se,containerNodeRect:ce,draggingNodeRect:pe,over:le.current.over,overlayNodeRect:de.rect,scrollableAncestors:_e,scrollableAncestorRects:ve,windowRect:ge}),be=ie?M6(ie,y):null,xe=k3e(_e),Se=P8(xe),Ce=P8(xe,[se]),we=M6(ye,Se),Te=pe?$4e(pe,ye):null,Ee=C&&Te?o({active:C,collisionRect:Te,droppableRects:j,droppableContainers:k,pointerCoordinates:be}):null,De=q6(Ee,`id`),[Oe,ke]=(0,N.useState)(null),Ae=Z4e(me?ye:M6(ye,Ce),Oe?.rect??null,se),je=(0,N.useRef)(null),Me=(0,N.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;je.current=new n({active:w.current,activeNode:i,event:a,options:r,context:le,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=ee.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=ee.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=ee.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,ls.unstable_batchedUpdates)(()=>{r?.(i),h(G8.Initializing),d({type:z6.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(je.current),O(a)})},onMove(e){d({type:z6.DragMove,coordinates:e})},onEnd:o(z6.DragEnd),onCancel:o(z6.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=le.current,o=null;if(t&&i){let{cancelDrop:s}=ee.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===z6.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=z6.DragCancel)}w.current=null,(0,ls.unstable_batchedUpdates)(()=>{d({type:e}),h(G8.Uninitialized),ke(null),E(null),O(null),je.current=null;let t=e===z6.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=ee.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ne=S3e(a,(0,N.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Me(n,t))},[v,Me]));A3e(a),C6(()=>{se&&m===G8.Initializing&&h(G8.Initialized)},[se,m]),(0,N.useEffect)(()=>{let{onDragMove:e}=ee.current,{active:t,activatorEvent:n,collisions:r,over:i}=le.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:we.x,y:we.y},over:i};(0,ls.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[we.x,we.y]),(0,N.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=le.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=ee.current,o=r.get(De),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,ls.unstable_batchedUpdates)(()=>{ke(s),a?.(c),f({type:`onDragOver`,event:c})})},[De]),C6(()=>{le.current={activatorEvent:D,active:C,activeNode:M,collisionRect:Te,collisions:Ee,droppableRects:j,draggableNodes:v,draggingNode:fe,draggingNodeRect:pe,droppableContainers:b,over:Oe,scrollableAncestors:_e,scrollAdjustedTranslate:we},S.current={initial:pe,translated:Te}},[C,M,Ee,Te,v,fe,pe,j,b,Oe,_e,we]),v3e({...ae,delta:y,draggingRect:Te,pointerCoordinates:be,scrollableAncestors:_e,scrollableAncestorRects:ve});let Pe=(0,N.useMemo)(()=>({active:C,activeNode:M,activeNodeRect:se,activatorEvent:D,collisions:Ee,containerNodeRect:ce,dragOverlay:de,draggableNodes:v,droppableContainers:b,droppableRects:j,over:Oe,measureDroppableContainers:ne,scrollableAncestors:_e,scrollableAncestorRects:ve,measuringConfiguration:A,measuringScheduled:re,windowRect:ge}),[C,M,se,D,Ee,ce,de,v,b,j,Oe,ne,_e,ve,A,re,ge]),Fe=(0,N.useMemo)(()=>({activatorEvent:D,activators:Ne,active:C,activeNodeRect:se,ariaDescribedById:{draggable:te},dispatch:d,draggableNodes:v,over:Oe,measureDroppableContainers:ne}),[D,Ne,C,se,d,te,v,Oe,ne]);return N.createElement(R6.Provider,{value:p},N.createElement(V8.Provider,{value:Fe},N.createElement(H8.Provider,{value:Pe},N.createElement(W8.Provider,{value:Ae},i)),N.createElement(z3e,{disabled:n?.restoreFocus===!1})),N.createElement(G4e,{...n,hiddenTextDescribedById:te}));function Ie(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),H3e=(0,N.createContext)(null),q8=`button`,U3e=`Draggable`;function W3e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=A6(U3e),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,N.useContext)(V8),{role:p=q8,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,N.useContext)(g?W8:H3e),[v,y]=D6(),[b,x]=D6(),S=j3e(o,t),C=T6(n);return C6(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,N.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===q8?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function J8(){return(0,N.useContext)(H8)}var G3e=`Droppable`,K3e={timeout:25};function Y8(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=A6(G3e),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,N.useContext)(V8),u=(0,N.useRef)({disabled:n}),d=(0,N.useRef)(!1),f=(0,N.useRef)(null),p=(0,N.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...K3e,...i},_=T6(h??r),v=j8({callback:(0,N.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=D6((0,N.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=T6(t);return(0,N.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,N.useEffect)(()=>(s({type:z6.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:z6.UnregisterDroppable,key:a,id:r})),[r]),(0,N.useEffect)(()=>{n!==u.current.disabled&&(s({type:z6.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function q3e(e){let{animation:t,children:n}=e,[r,i]=(0,N.useState)(null),[a,o]=(0,N.useState)(null),s=O6(n);return!n&&!r&&s&&i(s),C6(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),N.createElement(N.Fragment,null,n,r?(0,N.cloneElement)(r,{ref:o}):null)}var J3e={x:0,y:0,scaleX:1,scaleY:1};function Y3e(e){let{children:t}=e;return N.createElement(V8.Provider,{value:B8},N.createElement(W8.Provider,{value:J3e},t))}var X3e={position:`fixed`,touchAction:`none`},Z3e=e=>P6(e)?`transform 250ms ease`:void 0,Q3e=(0,N.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Z3e}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...X3e,width:s.width,height:s.height,top:s.top,left:s.left,transform:I6.Transform.toString(d),transformOrigin:i&&r?K4e(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return N.createElement(n,{className:o,style:f,ref:t},a)}),$3e={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:I6.Transform.toString(t)},{transform:I6.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function e6e(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return w6((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=L8(a);if(!c)return;let{transform:l}=v6(a).getComputedStyle(a),u=Z6(l);if(!u)return;let d=typeof t==`function`?t:t6e(t);return u8(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function t6e(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...$3e,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var X8=0;function n6e(e){return(0,N.useMemo)(()=>{if(e!=null)return X8++,X8},[e])}var r6e=N.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=J8(),S=(0,N.useContext)(W8),C=n6e(d?.id),w=U8(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=A8(f),E=e6e({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return N.createElement(Y3e,null,N.createElement(q3e,{animation:E},d&&C?N.createElement(Q3e,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))}),i6e=e=>{let{transform:t}=e;return{...t,y:0}};function a6e(e,t,n){let r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}var o6e=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:a6e(n,t,i)},s6e=e=>{let{transform:t}=e;return{...t,x:0}};function Z8(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function c6e(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Q8(e){return e!==null&&e>=0}function l6e(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function u6e(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var $8={scaleX:1,scaleY:1},d6e=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=f6e(t,a,r);if(a===r){let e=t[i];return e?{x:r<i?e.left+e.width-(o.left+o.width):e.left-o.left,y:0,...$8}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...$8}:a<r&&a>=i?{x:o.width+s,y:0,...$8}:{x:0,y:0,...$8}};function f6e(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n<t?i?r.left-(i.left+i.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(i.left+i.width)}var e5=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Z8(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},t5={scaleX:1,scaleY:1},p6e=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...t5}:null}let s=n5(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...t5}:r<t&&r>=a?{x:0,y:o.height+s,...t5}:{x:0,y:0,...t5}};function n5(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var r5=`Sortable`,i5=N.createContext({activeIndex:-1,containerId:r5,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:e5,disabled:{draggable:!1,droppable:!1}});function a5(e){let{children:t,id:n,items:r,strategy:i=e5,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=J8(),d=A6(r5,n),f=s.rect!==null,p=(0,N.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,N.useRef)(p),v=!l6e(p,_.current),y=g!==-1&&h===-1||v,b=u6e(a);C6(()=>{v&&m&&u(p)},[v,p,m,u]),(0,N.useEffect)(()=>{_.current=p},[p]);let x=(0,N.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:c6e(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return N.createElement(i5.Provider,{value:x},t)}var m6e=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Z8(n,r,i).indexOf(t)},h6e=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},g6e={duration:200,easing:`ease`},o5=`transform`,_6e=I6.Transition.toString({property:o5,duration:0,easing:`linear`}),v6e={roleDescription:`sortable`};function y6e(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,N.useState)(null),s=(0,N.useRef)(n);return C6(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=Q6(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,N.useEffect)(()=>{a&&o(null)},[a]),a}function s5(e){let{animateLayoutChanges:t=h6e,attributes:n,disabled:r,data:i,getNewIndex:a=m6e,id:o,strategy:s,resizeObserverConfig:c,transition:l=g6e}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,N.useContext)(i5),y=b6e(r,p),b=u.indexOf(o),x=(0,N.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,N.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=Y8({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:ee,attributes:te,setNodeRef:k,listeners:A,isDragging:j,over:ne,setActivatorNodeRef:re,transform:M}=W3e({id:o,data:x,attributes:{...v6e,...n},disabled:y.draggable}),ie=M4e(E,k),ae=!!D,oe=ae&&!m&&Q8(f)&&Q8(g),se=!_&&j,ce=oe?(se&&oe?M:null)??(s??v)({rects:h,activeNodeRect:ee,activeIndex:f,overIndex:g,index:b}):null,le=Q8(f)&&Q8(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ue=D?.id,de=(0,N.useRef)({activeId:ue,items:u,newIndex:le,containerId:d}),fe=u!==de.current.items,pe=t({active:D,containerId:d,isDragging:j,isSorting:ae,id:o,index:b,items:u,newIndex:de.current.newIndex,previousItems:de.current.items,previousContainerId:de.current.containerId,transition:l,wasDragging:de.current.activeId!=null}),me=y6e({disabled:!pe,index:b,node:w,rect:C});return(0,N.useEffect)(()=>{ae&&de.current.newIndex!==le&&(de.current.newIndex=le),d!==de.current.containerId&&(de.current.containerId=d),u!==de.current.items&&(de.current.items=u)},[ae,le,d,u]),(0,N.useEffect)(()=>{if(ue===de.current.activeId)return;if(ue!=null&&de.current.activeId==null){de.current.activeId=ue;return}let e=setTimeout(()=>{de.current.activeId=ue},50);return()=>clearTimeout(e)},[ue]),{active:D,activeIndex:f,attributes:te,data:x,rect:C,index:b,newIndex:le,items:u,isOver:T,isSorting:ae,isDragging:j,listeners:A,node:w,overIndex:g,over:ne,setNodeRef:ie,setActivatorNodeRef:re,setDroppableNodeRef:E,setDraggableNodeRef:k,transform:me??ce,transition:he()};function he(){if(me||fe&&de.current.newIndex===b)return _6e;if(!(se&&!P6(O)||!l)&&(ae||pe))return I6.Transition.toString({...l,property:o5})}}function b6e(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function c5(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var x6e=[g8.Down,g8.Right,g8.Up,g8.Left],l5=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(x6e.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case g8.Down:r.top<a.top&&t.push(n);break;case g8.Up:r.top>a.top&&t.push(n);break;case g8.Left:r.left>a.left&&t.push(n);break;case g8.Right:r.left<a.left&&t.push(n);break}});let c=Y6({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=q6(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=e8(c).some((e,t)=>s[t]!==e),i=u5(e,t),a=S6e(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:N6(u,l)}}}};function u5(e,t){return!c5(e)||!c5(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function S6e(e,t){return!c5(e)||!c5(t)||!u5(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function d5({open:e,onOpenChange:t,title:n,description:r,children:i,onSubmit:a,submitLabel:o=`Enregistrer`,submitting:s=!1,canSubmit:c=!0}){let[l,u]=(0,N.useState)(!1),d=s||l;async function f(){if(!(!c||d))try{u(!0),await a()}finally{u(!1)}}return(0,I.jsx)(J3,{open:e,onOpenChange:t,children:(0,I.jsxs)(Y3,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,I.jsxs)(X3,{className:`border-b px-6 py-4`,children:[(0,I.jsx)(Q3,{children:n}),r?(0,I.jsx)($3,{children:r}):null]}),(0,I.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,I.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:i}),(0,I.jsxs)(Z3,{className:`border-t px-6 py-4`,children:[(0,I.jsxs)(X,{type:`submit`,disabled:!c||d,children:[d?(0,I.jsx)(Tm,{className:`size-4 animate-spin`}):null,o]}),(0,I.jsx)(X,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:`Annuler`})]})]})]})})}var C6e=P1(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 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/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function $({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,I.jsx)(n?wy:`span`,{"data-slot":`badge`,"data-variant":t,className:x1(C6e({variant:t}),e),...r})}function w6e(e){let t=new Map;for(let n of e){let e=t.get(n.instanceName);e||(e={instanceName:n.instanceName,kind:n.kind,agents:[]},t.set(n.instanceName,e)),e.agents.push(n)}let n=e=>(e.displayName??e.agentId).toLowerCase();for(let e of t.values())e.agents.sort((e,t)=>e.isDefault===t.isDefault?n(e).localeCompare(n(t)):e.isDefault?-1:1);let r=[...t.values()],i=e=>e.agents.some(e=>e.isDefault);return r.sort((e,t)=>i(e)===i(t)?e.instanceName.localeCompare(t.instanceName):i(e)?-1:1),r}function T6e(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.displayName,e.agentId,e.instanceName,e.model].filter(Boolean).some(e=>e.toLowerCase().includes(n))):e}function E6e({open:e,onOpenChange:t,agents:n,onPick:r}){let[i,a]=(0,N.useState)(``),o=(0,N.useMemo)(()=>w6e(T6e(n??[],i)),[n,i]);return(0,I.jsx)(G1,{open:e,onOpenChange:t,children:(0,I.jsxs)(K1,{className:`oc-agentpicker`,children:[(0,I.jsxs)(q1,{children:[(0,I.jsx)(Y1,{children:TPe()}),(0,I.jsx)(X1,{children:OPe()})]}),n===void 0?(0,I.jsx)(`p`,{className:`oc-agentpicker__hint`,children:jPe()}):n.length===0?(0,I.jsx)(`p`,{className:`oc-agentpicker__hint`,children:PPe()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(I1,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:LPe(),className:`oc-agentpicker__search`,"aria-label":BPe()}),(0,I.jsx)(`div`,{className:`oc-agentpicker__list`,role:`listbox`,children:o.map(e=>(0,I.jsxs)(`div`,{className:`oc-agentpicker__group`,children:[(0,I.jsxs)(`div`,{className:`oc-agentpicker__instance`,children:[(0,I.jsx)(jm,{size:13,"aria-hidden":!0}),(0,I.jsx)(`span`,{children:e.instanceName}),(0,I.jsx)($,{variant:`outline`,className:`oc-agentpicker__kind`,children:e.kind})]}),e.agents.map(e=>(0,I.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":!1,className:`oc-agentpicker__item`,onClick:()=>r(e.instanceName,e.agentId),disabled:e.state===`deleted`,title:e.state===`deleted`?UPe():void 0,children:[(0,I.jsx)(dm,{size:15,"aria-hidden":!0,className:`oc-agentpicker__icon`}),(0,I.jsxs)(`span`,{className:`oc-agentpicker__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,I.jsx)(`span`,{className:`oc-agentpicker__model`,children:e.model}):null,e.isDefault?(0,I.jsx)(Nm,{size:13,"aria-label":KPe(),className:`oc-agentpicker__default`}):null]},`${e.instanceName}/${e.agentId}`))]},e.instanceName))})]})]})})}var f5=6e4,p5=60*f5,m5=24*p5,h5=7*m5,g5=30*m5,_5=365*m5;function D6e(e,t){let n=t-e;if(n<f5)return`maintenant`;if(n<p5)return`${Math.floor(n/f5)}min`;if(n<m5)return`${Math.floor(n/p5)}h`;if(n<h5)return`${Math.floor(n/m5)}j`;if(n<g5)return`${Math.floor(n/h5)}sem`;if(n<_5)return`${Math.floor(n/g5)}mois`;let r=Math.floor(n/_5);return`${r}an${r>1?`s`:``}`}var v5=[{value:`red`,hue:`oklch(0.63 0.21 25)`},{value:`orange`,hue:`oklch(0.7 0.17 50)`},{value:`amber`,hue:`oklch(0.8 0.15 85)`},{value:`green`,hue:`oklch(0.7 0.16 150)`},{value:`teal`,hue:`oklch(0.7 0.12 190)`},{value:`blue`,hue:`oklch(0.62 0.19 250)`},{value:`violet`,hue:`oklch(0.6 0.2 300)`},{value:`pink`,hue:`oklch(0.7 0.2 350)`}],y5=e=>v5.find(t=>t.value===e)?.hue??null,b5=`project:none`,O6e=e=>`project:${e}`,x5=`oc.noproject.collapsed`;function k6e({activeChatId:e,onSelect:t}){let n=P(V.messages.listChats,{}),r=P(V.projects.listProjects,{}),i=P(V.me.getMe,{host:YO})?.ui?.effective,a=i?.showChatProvider??!0,o=i?.showChatAge??!0,s=new Set((n??[]).map(e=>e.providerKind).filter(e=>e!=null)),c=a&&s.size>1,[,l]=(0,N.useState)(0);(0,N.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>l(e=>e+1),6e4);return()=>window.clearInterval(e)},[o]);let u=F(V.chats.createChat),d=F(V.projects.createProject),f=F(V.projects.setProjectCollapsed),p=F(V.chats.reorderChat),m=F(V.chats.moveChatToProject),h=e0(),g=P(V.agents.listMyAgents),[_,v]=(0,N.useState)(!1);async function y(e,n){t(await u({title:`New chat`,instanceName:e,agentId:n}))}async function b(){let e=g;if(e&&e.length===1&&e[0].state!==`deleted`){await y(e[0].instanceName,e[0].agentId);return}v(!0)}let[x,S]=(0,N.useState)(null),C=(0,N.useRef)(!1);(0,N.useEffect)(()=>{!C.current&&n&&S(n)},[n]);let w=x??n??[],[T,E]=(0,N.useState)(null),[D,O]=(0,N.useState)(()=>localStorage.getItem(x5)===`1`);function ee(){O(e=>(localStorage.setItem(x5,e?`0`:`1`),!e))}let te=H6(V6(S8,{activationConstraint:{distance:4}}),V6(v8,{coordinateGetter:l5})),k=w.filter(e=>e.pinned),A=w.filter(e=>!e.pinned),j=e=>A.filter(t=>(t.projectId??null)===e);function ne(e){return w.find(t=>t._id===e)}async function re(e){E(null);let{active:t,over:n}=e;if(!n)return;let r=ne(String(t.id));if(!r)return;let i=String(n.id);if(i.startsWith(`project:`)){let e=i===b5?null:i.slice(8);if((r.projectId??null)===e)return;C.current=!0,S(t=>(t??w).map(t=>t._id===r._id?{...t,projectId:e}:t));try{await m({chatId:r._id,projectId:e})}finally{C.current=!1}return}let a=ne(i);if(!a||t.id===n.id)return;if((a.projectId??null)!==(r.projectId??null)||a.pinned!==r.pinned){if(r.pinned||a.pinned)return;C.current=!0,S(e=>(e??w).map(e=>e._id===r._id?{...e,projectId:a.projectId??null}:e));try{await m({chatId:r._id,projectId:a.projectId??null})}finally{C.current=!1}return}let o=a.pinned?k:j(a.projectId??null),s=o.map(e=>e._id),c=s.indexOf(r._id),l=s.indexOf(a._id);if(c<0||l<0)return;let u=[...o];u.splice(c,1),u.splice(l,0,r);let d=u[l-1]??null,f=u[l+1]??null;C.current=!0,S(e=>[...(e??w).filter(e=>!o.some(t=>t._id===e._id)),...u]);try{await p({chatId:r._id,prevKey:d?d.sortKey:null,nextKey:f?f.sortKey:null})}finally{C.current=!1}}let M=T?ne(T):null;return(0,I.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,I.jsx)(E6e,{open:_,onOpenChange:v,agents:g,onPick:(e,t)=>{v(!1),y(e,t)}}),(0,I.jsxs)(`div`,{className:`oc-sidebar__top`,children:[(0,I.jsxs)(X,{className:`flex-1 justify-start`,onClick:()=>void b(),children:[(0,I.jsx)(Om,{}),` `,rje()]}),(0,I.jsx)(X,{variant:`outline`,size:`icon`,"aria-label":u$(),onClick:async()=>{let e=await h({title:u$(),label:cje(),placeholder:dje(),confirmLabel:mje()});e&&await d({name:e})},children:(0,I.jsx)(Sm,{})})]}),(0,I.jsxs)(K8,{sensors:te,collisionDetection:Y6,modifiers:[s6e,o6e],onDragStart:e=>E(e.active.id),onDragCancel:()=>E(null),onDragEnd:re,children:[(0,I.jsxs)(`div`,{className:`oc-sidebar__scroll`,children:[k.length>0?(0,I.jsx)(S5,{label:_je(),chats:k,children:k.map(n=>(0,I.jsx)(w5,{chat:n,active:n._id===e,projects:r??[],onSelect:t,showProviderBadge:c},n._id))}):null,(r??[]).map(n=>{let i=j(n._id);return(0,I.jsx)(S5,{label:n.name,dropId:O6e(n._id),projectId:n._id,chats:i,collapsible:!0,collapsed:n.collapsed,onToggle:()=>void f({projectId:n._id,collapsed:!n.collapsed}),children:n.collapsed?null:i.length===0?(0,I.jsx)(`div`,{className:`oc-sidebar__empty`,children:bje()}):i.map(n=>(0,I.jsx)(w5,{chat:n,active:n._id===e,projects:r??[],onSelect:t,showProviderBadge:c},n._id))},n._id)}),(0,I.jsx)(S5,{label:Cje(),dropId:b5,chats:j(null),collapsible:!0,collapsed:D,onToggle:ee,children:D?null:j(null).map(n=>(0,I.jsx)(w5,{chat:n,active:n._id===e,projects:r??[],onSelect:t,showProviderBadge:c},n._id))})]}),(0,I.jsx)(r6e,{children:M?(0,I.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[(0,I.jsx)(Cm,{className:`size-3.5 opacity-60`}),y5(M.color)?(0,I.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:y5(M.color)}}):(0,I.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,I.jsx)(`span`,{className:`oc-chatitem__label`,children:M.title||d$()})]}):null})]})]})}function S5({label:e,dropId:t,projectId:n,chats:r,collapsible:i,collapsed:a,onToggle:o,children:s}){let c=F(V.projects.deleteProject),l=$1(),u=P(V.projects.projectChatCount,n?{projectId:n}:`skip`),{setNodeRef:d,isOver:f}=Y8({id:t??`static:${e}`});return(0,I.jsxs)(`div`,{ref:t?d:void 0,className:`oc-sidebar__group`+(f?` oc-sidebar__group--over`:``),children:[(0,I.jsxs)(`div`,{className:`oc-sidebar__group-head`+(i?` oc-sidebar__group-head--btn`:``),...i?{role:`button`,tabIndex:0,onClick:o,onKeyDown:e=>{i&&o&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())}}:{},children:[i?a?(0,I.jsx)(mm,{className:`size-3.5`}):(0,I.jsx)(pm,{className:`size-3.5`}):null,(0,I.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e}),n?(0,I.jsx)(`button`,{className:`oc-sidebar__group-del`,"aria-label":f$(),onClick:async t=>{t.stopPropagation();let r=u??0;await l({title:Aje({name:e}),description:r>0?Nje({count:r}):Ije(),confirmWord:p$(),confirmLabel:f$(),destructive:!0})&&await c({projectId:n})},children:(0,I.jsx)(Pm,{className:`size-3.5`})}):null]}),(0,I.jsx)(a5,{items:r.map(e=>e._id),strategy:p6e,children:s})]})}var C5={openclaw:`OpenClaw`,hermes:`Hermes`};function w5({chat:e,active:t,projects:n,onSelect:r,showProviderBadge:i}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=s5({id:e._id}),d=F(V.chats.renameChat),f=F(V.chats.deleteChat),p=F(V.chats.pinChat),m=F(V.chats.setChatColor),h=P(V.me.getMe,{host:YO})?.ui?.effective?.showChatAge??!0,g=$1(),[_,v]=(0,N.useState)(!1),[y,b]=(0,N.useState)(e.title??``),x={transform:I6.Transform.toString(c),transition:l,opacity:+!u},S=y5(e.color);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{ref:s,style:x,className:`oc-chatitem group/row`+(t?` oc-chatitem--active`:``),children:[(0,I.jsx)(`button`,{className:`oc-chatitem__grip`,"aria-label":Vje(),...a,...o,children:(0,I.jsx)(Cm,{className:`size-3.5`})}),S?(0,I.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:S}}):(0,I.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,I.jsx)(`button`,{className:`oc-chatitem__label`,onClick:()=>r(e._id),children:e.title||d$()}),i&&e.providerKind?(0,I.jsx)(`span`,{className:`oc-chatitem__bridge oc-chatitem__bridge--${e.providerKind} group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:mMe({provider:C5[e.providerKind]}),children:C5[e.providerKind]}):null,h?(0,I.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:new Date(e.updatedAt).toLocaleString(`fr-FR`),children:D6e(e.updatedAt,Date.now())}):null,(0,I.jsxs)(S1,{children:[(0,I.jsx)(C1,{asChild:!0,children:(0,I.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":Wje(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,I.jsx)(ym,{})})}),(0,I.jsxs)(w1,{align:`end`,className:`w-48`,children:[(0,I.jsxs)(T1,{onSelect:()=>{b(e.title??``),v(!0)},children:[(0,I.jsx)(Fee,{}),` `,qje()]}),(0,I.jsxs)(T1,{onSelect:()=>void p({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,I.jsx)(Lee,{}):(0,I.jsx)(Iee,{}),e.pinned?Xje():$je()]}),(0,I.jsx)(E1,{children:nMe()}),(0,I.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,I.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void m({chatId:e._id,color:null}),"aria-label":aMe(),children:`✕`}),v5.map(t=>(0,I.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void m({chatId:e._id,color:t.value})},t.value))]}),(0,I.jsx)(D1,{}),(0,I.jsxs)(T1,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await g({title:cMe(),description:dMe(),confirmLabel:p$(),destructive:!0})&&await f({chatId:e._id})})},children:[(0,I.jsx)(Pm,{}),` `,p$()]})]})]})]}),(0,I.jsx)(d5,{open:_,onOpenChange:v,title:_Me(),canSubmit:y.trim().length>0,onSubmit:async()=>{await d({chatId:e._id,title:y.trim()}),v(!1)},children:(0,I.jsx)(`div`,{className:`oc-form`,children:(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:bMe()}),(0,I.jsx)(I1,{value:y,onChange:e=>b(e.target.value),autoFocus:!0})]})})})]})}var T5=[`admin`,`user`,`pending`];function E5(){let e=P(V.me.authProviders)?.anonymous===!0,[t,n]=(0,N.useState)(!1),r=P(V.dev.listUsersDev,e?{}:`skip`),i=P(V.me.getImpersonation),a=F(V.dev.setMyRole),o=F(V.dev.setRole),s=F(V.admin.startImpersonation),c=F(V.admin.stopImpersonation);if(!e)return null;let l=r?.find(e=>e.isMe),u=l?.role===`admin`,d=i?.impersonating===!0,f=(r??[]).filter(e=>!e.isMe);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{type:`button`,className:`oc-devfab`,onClick:()=>n(!0),title:hAe(),children:[(0,I.jsx)(Rm,{size:13}),`DEV`]}),(0,I.jsx)(G1,{open:t,onOpenChange:n,children:(0,I.jsxs)(K1,{children:[(0,I.jsxs)(q1,{children:[(0,I.jsx)(Y1,{children:vAe()}),(0,I.jsx)(X1,{children:xAe()})]}),(0,I.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,I.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[wAe({canonical:l?.canonical??`…`}),` `,(0,I.jsx)($,{variant:`outline`,children:l?.role??`…`})]}),(0,I.jsx)(`div`,{className:`oc-devsw__roles`,children:T5.map(e=>(0,I.jsx)(X,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?DAe():e===`user`?AAe():NAe()},e))})]}),d?(0,I.jsxs)(`div`,{className:`oc-devsw__imp`,children:[IAe(),` `,(0,I.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,I.jsx)(X,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:zAe()})]}):null,(0,I.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,I.jsx)(`p`,{className:`oc-devsw__empty`,children:HAe()}):f.map(e=>(0,I.jsxs)(`div`,{className:`oc-devsw__row`,children:[(0,I.jsx)(`span`,{className:`oc-devsw__label`,children:e.name||e.email||e.canonical||e.userId.slice(0,8)}),(0,I.jsx)(`select`,{className:`oc-devsw__select`,value:e.role,disabled:!e.canonical,onChange:t=>e.canonical&&void o({canonical:e.canonical,role:t.target.value}),children:T5.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))}),(0,I.jsx)(X,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?JAe():ZAe():GAe(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:eje()})]},e.profileId))})]})})]})}function D5({label:e,mode:t,minimal:n=!1}){let{signOut:r}=Ir(),i=F(V.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(V.me.getMe,{host:YO});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(V.me.getMe,{host:YO},{...n,themeMode:t,resolvedThemeMode:r})}),a=t??`default`;return(0,I.jsxs)(S1,{children:[(0,I.jsx)(C1,{asChild:!0,children:(0,I.jsxs)(X,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,I.jsx)(pm,{className:`opacity-60`})]})}),(0,I.jsx)(w1,{align:`end`,className:`w-52`,children:n?(0,I.jsxs)(T1,{onClick:()=>void r(),children:[(0,I.jsx)(Em,{}),` `,Yk()]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(E1,{children:Pk()}),(0,I.jsxs)(aYe,{value:a,onValueChange:e=>void i({mode:e==="default"?null:e}),children:[(0,I.jsxs)(O1,{value:`light`,children:[(0,I.jsx)(Bee,{}),` `,Lk()]}),(0,I.jsxs)(O1,{value:`dark`,children:[(0,I.jsx)(jee,{}),` `,Bk()]}),(0,I.jsxs)(O1,{value:`system`,children:[(0,I.jsx)(Aee,{}),` `,Uk()]}),(0,I.jsx)(O1,{value:`default`,children:Kk()})]}),(0,I.jsx)(D1,{}),(0,I.jsxs)(T1,{onClick:()=>void r(),children:[(0,I.jsx)(Em,{}),` `,Yk()]})]})})]})}var A6e={altered_words:()=>WLe(),incorrect:()=>qLe(),incoherence:()=>XLe(),formatting:()=>$Le(),latency:()=>nRe(),api_error:()=>aRe(),other:()=>cRe()},j6e=e=>A6e[e]?.()??e,M6e={anomaly_open:Fm,anomaly_resolved:gm,feedback_reply:Dm};function N6e(e){return e.kind===`feedback_reply`?{title:RLe(),body:VLe()}:{title:e.title,body:e.body}}function P6e(){let e=P(V.notifications.myUnreadCount)??0,t=P(V.notifications.myNotifications),n=P(V.feedback.myFeedback),r=F(V.notifications.markRead),i=F(V.notifications.markAllRead),a=F(V.notifications.clearOne),o=F(V.notifications.clearAll),s=ss(),[c,l]=(0,N.useState)(!1),u=e=>{if(e.unread&&r({notificationId:e._id}),!e.href)return;if(l(!1),e.href.startsWith(`/chat/`)){s({to:`/chat/$chatId`,params:{chatId:e.href.slice(6)}});return}let[t,n]=e.href.split(`?`);s({to:t,search:Object.fromEntries(new URLSearchParams(n??``))})};return(0,I.jsxs)(S1,{open:c,onOpenChange:l,children:[(0,I.jsx)(C1,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?QIe({count:e}):tLe(),children:[(0,I.jsx)(um,{size:18,"aria-hidden":!0}),e>0?(0,I.jsx)(`span`,{className:`oc-bell__badge`,"aria-hidden":!0,children:e>9?`9+`:e}):null]})}),(0,I.jsxs)(w1,{align:`end`,className:`oc-notif`,children:[(0,I.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,I.jsx)(`span`,{children:iLe()}),t&&t.length>0?(0,I.jsxs)(`span`,{className:`oc-notif__bulk`,children:[(0,I.jsx)(`button`,{type:`button`,className:`oc-notif__act`,disabled:e===0,onClick:()=>void i({}),children:sLe()}),(0,I.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:uLe()})]}):null]}),t===void 0?(0,I.jsx)(`div`,{className:`oc-notif__empty`,children:jk()}):t.length===0?(0,I.jsx)(`div`,{className:`oc-notif__empty`,children:pLe()}):(0,I.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=M6e[e.kind]??um,{title:n,body:i}=N6e(e);return(0,I.jsxs)(`div`,{className:`oc-notif__item${e.unread?` is-unread`:``}${e.href?` is-link`:``}`,role:e.href?`button`:void 0,tabIndex:e.href?0:void 0,onClick:e.href?()=>u(e):void 0,children:[(0,I.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,I.jsx)(t,{size:14,className:`oc-notif__kind oc-notif__kind--${e.kind}`,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`oc-notif__title`,children:n}),(0,I.jsxs)(`span`,{className:`oc-notif__row-actions`,children:[e.unread?(0,I.jsx)(`button`,{type:`button`,title:h$(),"aria-label":h$(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,I.jsx)(fm,{size:13})}):null,(0,I.jsx)(`button`,{type:`button`,title:g$(),"aria-label":g$(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,I.jsx)(zm,{size:13})})]})]}),(0,I.jsx)(`p`,{className:`oc-notif__body`,children:i}),(0,I.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.createdAt).toLocaleString(q())})]},e._id)})}),n&&n.length>0?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`oc-notif__head oc-notif__head--sub`,children:bLe()}),(0,I.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,I.jsxs)(`div`,{className:`oc-notif__item`,children:[(0,I.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,I.jsx)(`span`,{className:`oc-notif__title`,children:j6e(e.category)}),(0,I.jsx)(`span`,{className:`oc-notif__status${e.answered?` is-answered`:``}`,children:e.answered?CLe():ELe()})]}),e.thread.length>0?(0,I.jsx)(`div`,{className:`oc-notif__thread`,children:e.thread.map((e,t)=>(0,I.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,I.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?kLe():MLe()}),(0,I.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,(0,I.jsx)(xs,{to:`/chat/$chatId`,params:{chatId:e.chatId},className:`oc-notif__link`,onClick:()=>l(!1),children:FLe()})]},e._id))})]}):null]})]})}var O5=2,F6e=180;function I6e(){let e=ss(),t=(0,N.useRef)(null),n=(0,N.useRef)(null),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(``),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(0);(0,N.useEffect)(()=>{let e=setTimeout(()=>c(a),F6e);return()=>clearTimeout(e)},[a]);let d=s.trim(),f=P(V.search.searchConversations,d.length>=O5?{query:d}:`skip`),p=f??[],m=d.length>=O5&&f===void 0;(0,N.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,N.useEffect)(()=>{r&&(o(``),c(``),u(0))},[r]),(0,N.useEffect)(()=>{u(0)},[f]),(0,N.useEffect)(()=>{(n.current?.querySelector(`[data-index="${l}"]`))?.scrollIntoView({block:`nearest`})},[l]);let h=(0,N.useCallback)(t=>{i(!1),e({to:`/chat/$chatId`,params:{chatId:t}})},[e]);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{type:`button`,className:`oc-search-trigger`,onClick:()=>i(!0),"aria-label":PNe(),children:[(0,I.jsx)(Am,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`oc-search-trigger__label`,children:LNe()}),(0,I.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:`⌘K`})]}),(0,I.jsx)(G1,{open:r,onOpenChange:i,children:(0,I.jsxs)(K1,{showCloseButton:!1,className:`oc-search-palette top-[12vh] translate-y-0 max-w-xl gap-0 overflow-hidden p-0`,onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,I.jsx)(Y1,{className:`sr-only`,children:BNe()}),(0,I.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,I.jsx)(Am,{className:`oc-search-palette__head-icon`,"aria-hidden":!0}),(0,I.jsx)(`input`,{ref:t,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,p.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=p[l];t&&h(t.chatId)}},placeholder:UNe(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":KNe()})]}),(0,I.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:d.length<O5?(0,I.jsx)(`div`,{className:`oc-search-palette__hint`,children:YNe({count:O5})}):m?(0,I.jsx)(`div`,{className:`oc-search-palette__hint`,children:QNe()}):p.length===0?(0,I.jsx)(`div`,{className:`oc-search-palette__hint`,children:tPe({term:d})}):p.map((e,t)=>(0,I.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:x1(`oc-search-result`,t===l&&`is-active`),onMouseMove:()=>u(t),onClick:()=>h(e.chatId),children:[(0,I.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,I.jsx)(wm,{size:15}):(0,I.jsx)(Dm,{size:15})}),(0,I.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,I.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||iPe()}),e.snippet?(0,I.jsx)(`span`,{className:`oc-search-result__snippet`,children:e.snippet}):null]}),(0,I.jsx)(`span`,{className:`oc-search-result__tag`,children:e.matchedIn===`title`?sPe():uPe()})]},e.chatId))}),(0,I.jsxs)(`div`,{className:`oc-search-palette__footer`,children:[(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`kbd`,{children:`↑`}),(0,I.jsx)(`kbd`,{children:`↓`}),` `,pPe()]}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`kbd`,{children:`↵`}),` `,gPe()]}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`kbd`,{children:yPe()}),` `,SPe()]})]})]})})]})}function k5({className:e,...t}){return(0,I.jsx)(xS,{"data-slot":`checkbox`,className:x1(`peer size-4 shrink-0 rounded-[4px] border border-input bg-background ring-offset-background transition-shadow outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground`,e),...t,children:(0,I.jsx)(CS,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current`,children:t.checked===`indeterminate`?(0,I.jsx)(kee,{className:`size-3.5`}):(0,I.jsx)(fm,{className:`size-3.5`})})})}function L6e({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=P(V.admin.listInstances,n?{}:`skip`),a=P(V.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null;return(0,I.jsx)(G1,{open:n,onOpenChange:r,children:(0,I.jsxs)(K1,{className:`oc-access`,children:[(0,I.jsxs)(q1,{children:[(0,I.jsx)(Y1,{children:ATe({user:t})}),(0,I.jsx)(X1,{children:NTe()})]}),(0,I.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:ITe()}):i.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:zTe()}):i.map(t=>(0,I.jsx)(R6e,{profileId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:o,defaultKey:s?`${s.instanceName}/${s.agentId}`:null},t._id))})]})})}function R6e({profileId:e,instanceName:t,kind:n,assigned:r,defaultKey:i}){let a=P(V.agents.listAgentsForInstance,{instanceName:t}),o=F(V.agents.assignAgent),s=F(V.agents.removeAgent),c=F(V.agents.setDefaultAgent),l=n0();if(!e)return null;let u=(a?.agents??[]).filter(e=>e.source===`discovered`),d=a?.discovery&&!a.discovery.lastPollOk;async function f(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(HTe(),e)}}async function p(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(GTe(),e)}}return(0,I.jsxs)(`div`,{className:`oc-access__group`,children:[(0,I.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,I.jsx)(jm,{size:13,"aria-hidden":!0}),(0,I.jsx)(`span`,{children:t}),(0,I.jsx)($,{variant:`outline`,className:`oc-access__kind`,children:n}),d?(0,I.jsx)($,{variant:`outline`,className:`oc-access__stale`,children:JTe()}):null]}),a===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:ZTe()}):u.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:d?rEe():eEe()}):u.map(e=>{let n=`${t}/${e.agentId}`,a=r.has(n),o=i===n,s=e.presentInLastOk===!1;return(0,I.jsxs)(`div`,{className:`oc-access__row`,children:[(0,I.jsx)(k5,{checked:a,disabled:s&&!a,onCheckedChange:()=>void f(e.agentId,a),"aria-label":oEe({name:e.displayName??e.agentId})}),(0,I.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,I.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,I.jsx)($,{variant:`outline`,className:`oc-access__gone`,children:lEe()}):null,a?o?(0,I.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":s$(),title:s$(),children:(0,I.jsx)(Nm,{size:14,fill:`currentColor`})}):(0,I.jsx)(X,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":c$(),title:c$(),onClick:()=>void p(e.agentId),children:(0,I.jsx)(Nm,{size:14})}):null]},e.agentId)})]})}function A5({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,I.jsx)(`table`,{"data-slot":`table`,className:x1(`w-full caption-bottom text-sm`,e),...t})})}function j5({className:e,...t}){return(0,I.jsx)(`thead`,{"data-slot":`table-header`,className:x1(`[&_tr]:border-b`,e),...t})}function M5({className:e,...t}){return(0,I.jsx)(`tbody`,{"data-slot":`table-body`,className:x1(`[&_tr:last-child]:border-0`,e),...t})}function N5({className:e,...t}){return(0,I.jsx)(`tr`,{"data-slot":`table-row`,className:x1(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function P5({className:e,...t}){return(0,I.jsx)(`th`,{"data-slot":`table-head`,className:x1(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function F5({className:e,...t}){return(0,I.jsx)(`td`,{"data-slot":`table-cell`,className:x1(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}function I5({title:e,rows:t,columns:n,rowActions:r,onAdd:i,addLabel:a=tFe(),bulkActions:o,emptyHint:s=iFe(),isExpanded:c,renderExpanded:l}){let[u,d]=(0,N.useState)(new Set),f=t??[],p=+!!o+n.length+ +!!r,m=f.length>0&&u.size===f.length,h=u.size>0&&!m;function g(){d(m?new Set:new Set(f.map(e=>e._id)))}function _(e){d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,I.jsxs)(`div`,{className:`oc-dt`,children:[(0,I.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,I.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,I.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[u.size>0&&o?o.map(e=>(0,I.jsxs)(X,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...u]),d(new Set)},children:[e.variant===`destructive`?(0,I.jsx)(Pm,{}):null,e.label,` (`,u.size,`)`]},e.label)):null,i?(0,I.jsxs)(X,{size:`sm`,onClick:i,children:[(0,I.jsx)(Om,{}),` `,a]}):null]})]}),t===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:sFe()}):f.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:s}):(0,I.jsxs)(A5,{children:[(0,I.jsx)(j5,{children:(0,I.jsxs)(N5,{children:[o?(0,I.jsx)(P5,{className:`w-8`,children:(0,I.jsx)(k5,{"aria-label":uFe(),checked:m?!0:h?`indeterminate`:!1,onCheckedChange:g})}):null,n.map(e=>(0,I.jsx)(P5,{className:e.className,children:e.header},e.header)),r?(0,I.jsx)(P5,{className:`w-8`}):null]})}),(0,I.jsx)(M5,{children:f.map(e=>{let t=r?.(e)??[],i=c?.(e)??!1;return(0,I.jsxs)(N.Fragment,{children:[(0,I.jsxs)(N5,{className:`group/row`,children:[o?(0,I.jsx)(F5,{children:(0,I.jsx)(k5,{"aria-label":pFe(),checked:u.has(e._id),onCheckedChange:()=>_(e._id)})}):null,n.map(t=>(0,I.jsx)(F5,{className:t.className,children:t.cell(e)},t.header)),r?(0,I.jsx)(F5,{children:t.length>0?(0,I.jsxs)(S1,{children:[(0,I.jsx)(C1,{asChild:!0,children:(0,I.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":gFe(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,I.jsx)(ym,{})})}),(0,I.jsx)(w1,{align:`end`,children:t.map((t,n)=>(0,I.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,I.jsx)(D1,{}):null,(0,I.jsx)(T1,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&l?(0,I.jsx)(N5,{className:`oc-dt__expansion`,children:(0,I.jsx)(F5,{colSpan:p,className:`oc-dt__expansion-cell`,children:l(e)})}):null]},e._id)})})]})]})}var L5={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function R5(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=L5[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function z5(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:R5(e.from,t)??t-L5.h,to:R5(e.to,t)??t}}var B5=[{label:GOe(),from:`now-5m`},{label:JOe(),from:`now-15m`},{label:ZOe(),from:`now-30m`},{label:eke(),from:`now-1h`},{label:rke(),from:`now-3h`},{label:oke(),from:`now-6h`},{label:lke(),from:`now-12h`},{label:fke(),from:`now-24h`},{label:hke(),from:`now-2d`},{label:vke(),from:`now-7d`},{label:xke(),from:`now-30d`},{label:wke(),from:`now-90d`}];function V5(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function z6e(e){if(e.kind===`relative`){let t=B5.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${V5(e.from)} → ${V5(e.to)}`}function H5(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function U5(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function B6e(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}function W5(e){let[t,n]=(0,N.useState)(0);return(0,N.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,N.useMemo)(()=>{let{from:t,to:n}=z5(e);return e.kind===`absolute`?{from:t,to:n}:{from:G5(t),to:G5(n)}},[e,t])}function G5(e){return Math.floor(e/6e4)*6e4}function K5({value:e,onChange:t}){let[n,r]=(0,N.useState)(!1),[i,a]=(0,N.useState)(``),o=z5(e),[s,c]=(0,N.useState)(()=>H5(o.from)),[l,u]=(0,N.useState)(()=>H5(o.to));function d(t){if(t){let t=z5(e);c(H5(t.from)),u(H5(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=U5(s),n=U5(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,N.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?B5:B5.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=U5(s)!==null&&U5(l)!==null;return(0,I.jsxs)(FT,{open:n,onOpenChange:d,children:[(0,I.jsx)(IT,{asChild:!0,children:(0,I.jsxs)(X,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,I.jsx)(Cee,{}),z6e(e)]})}),(0,I.jsx)(LT,{children:(0,I.jsx)(RT,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,I.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,I.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,I.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,I.jsx)(I1,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,I.jsx)(I1,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,I.jsx)(X,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,I.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,I.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,I.jsx)(Am,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,I.jsx)(I1,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,I.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,I.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,I.jsx)(`li`,{children:(0,I.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}var V6e=250;function q5({q:e,onQChange:t,searchPlaceholder:n=YPe(),children:r,timeRange:i,onTimeRangeChange:a,onReset:o,canReset:s=!0}){let[c,l]=(0,N.useState)(e);(0,N.useEffect)(()=>{l(e)},[e]);let u=(0,N.useRef)(null);function d(e){l(e),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>t(e),V6e)}(0,N.useEffect)(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]);function f(){u.current!==null&&window.clearTimeout(u.current),o()}return(0,I.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,I.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,I.jsx)(Am,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,I.jsx)(I1,{value:c,onChange:e=>d(e.target.value),placeholder:n,"aria-label":n})]}),r?(0,I.jsx)(`div`,{className:`oc-filterbar__quick`,children:r}):null,i&&a?(0,I.jsx)(K5,{value:i,onChange:a}):null,(0,I.jsxs)(X,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:f,disabled:!s,children:[(0,I.jsx)(km,{}),QPe()]})]})}var H6e=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:RMe()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],J5=1;function U6e(){return{id:J5++,field:``,op:`eq`,value:``}}function W6e(e){return e.map(e=>({id:J5++,field:e.field,op:e.op,value:String(e.value)}))}function Y5({fields:e,seed:t,onChange:n}){let r=(0,N.useRef)(t),i=!!(r.current&&r.current.length>0),[a,o]=(0,N.useState)(i),[s,c]=(0,N.useState)(()=>i?W6e(r.current):[]);function l(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:B6e(e.value)})))}function u(e,t){let n=s.map(n=>n.id===e?{...n,...t}:n);c(n),l(n)}function d(){c(e=>[...e,U6e()])}function f(e){let t=s.filter(t=>t.id!==e);c(t),l(t)}let p=s.filter(e=>e.field!==``&&e.value!==``).length;return(0,I.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":a,onClick:()=>o(e=>!e),children:[(0,I.jsx)(pm,{className:`oc-advfilter__chevron`+(a?` is-open`:``),"aria-hidden":!0}),VMe(),p>0?(0,I.jsx)(`span`,{className:`oc-advfilter__count`,children:p}):null]}),a?(0,I.jsxs)(`div`,{className:`oc-advfilter__body`,children:[s.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:WMe()}):(0,I.jsx)(`ul`,{className:`oc-advfilter__rows`,children:s.map(t=>(0,I.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,I.jsxs)(M3,{value:t.field||void 0,onValueChange:e=>u(t.id,{field:e}),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-40`,children:(0,I.jsx)(N3,{placeholder:qMe()})}),(0,I.jsx)(F3,{children:e.map(e=>(0,I.jsx)(Q,{value:e.value,children:e.label},e.value))})]}),(0,I.jsxs)(M3,{value:t.op,onValueChange:e=>u(t.id,{op:e}),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-28`,children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:H6e.map(e=>(0,I.jsx)(Q,{value:e.value,children:e.label},e.value))})]}),(0,I.jsx)(I1,{className:`oc-advfilter__value`,value:t.value,onChange:e=>u(t.id,{value:e.target.value}),placeholder:XMe()}),(0,I.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":$Me(),onClick:()=>f(t.id),children:(0,I.jsx)(zm,{})})]},t.id))}),(0,I.jsxs)(X,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:d,children:[(0,I.jsx)(Om,{}),nNe()]})]}):null]})}var G6e=[`eq`,`neq`,`contains`,`gt`,`gte`,`lt`,`lte`],X5=[50,100,200,500],Z5=`now-30d`,K6e=`now-24h`;function Q5(e,t,n=Z5,r=`now`){let i=e??n,a=t??r,o=Number(i),s=Number(a);return i!==``&&a!==``&&Number.isFinite(o)&&Number.isFinite(s)?{kind:`absolute`,from:o,to:s}:{kind:`relative`,from:i,to:a}}function $5(e){return e.kind===`absolute`?{from:String(e.from),to:String(e.to)}:{from:e.from,to:e.to}}function e7(e){if(e.length!==0)return JSON.stringify(e)}function t7(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e,r=t.field,i=t.op,a=t.value;typeof r!=`string`||r===``||typeof i!=`string`||!G6e.includes(i)||typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`||n.push({field:r,op:i,value:a})}return n}var n7=sp().optional(),r7=sp().optional(),i7=sp().optional(),a7=sp().optional().catch(void 0),q6e=Rp({q:n7,kind:sp().default(`all`).catch(`all`),limit:im().pipe(Bp([Kp(X5[0]),Kp(X5[1]),Kp(X5[2]),Kp(X5[3])])).catch(100),statusClass:Wp([`2xx`,`4xx`,`5xx`]).optional().catch(void 0),principalType:Wp([`user`,`service`,`system`]).optional().catch(void 0),direction:Wp([`inbound`,`outbound`,`internal`]).optional().catch(void 0),roleKey:a7,from:r7,to:r7,adv:i7}),J6e=Rp({q:n7,action:a7,impersonated:Wp([`yes`,`no`]).optional().catch(void 0),resource:a7,from:r7,to:r7,adv:i7}),Y6e=Rp({q:n7,status:Wp([`open`,`acknowledged`,`resolved`,`all`]).default(`open`).catch(`open`),severity:Wp([`info`,`warn`,`critical`]).optional().catch(void 0),kind:a7,from:r7,to:r7}),X6e=Rp({from:r7,to:r7}),Z6e=Rp({q:n7,status:Wp([`active`,`disabled`]).optional().catch(void 0)}),Q6e=Rp({q:n7,role:a7});Rp({q:n7,mode:Wp([`per-user`,`shared`]).optional().catch(void 0)});var $6e={kind:`relative`,from:Z5,to:`now`},o7=`__all__`,s7=[`users`,`groups`,`instances`,`bridge`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`],c7=[`groups`,`access`,`roles`,`integrations`,`instances`,`bridge`,`theme`,`feedbacks`,`files`,`agentFiles`,`preferences`,`chatDefaults`],l7={groups:`Groupes`,access:`Accès`,serviceAccounts:`Comptes de service`,roles:`Rôles`,traces:`Traces`,kpi:`KPI`,anomalies:`Anomalies`,integrations:`Intégrations`,feedbacks:`Feedbacks`,bridge:`Bridge`,files:`Fichiers`,agentFiles:`Fichiers d'agent`,theme:`Apparence`,preferences:`Préférences`},u7={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`},d7=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`];function f7(e){let t=new Set(e);return s7.filter(e=>t.has(u7[e]))}function p7(e){return`/settings/${e}`}function m7(e){let t=e.split(`/`)[2];return s7.includes(t)?t:void 0}var e8e={uiprefs:`preferences`};function t8e({granted:e,onToggle:t}){let n=new Set(e),r=d7.filter(e=>n.has(u7[e])).length;return(0,I.jsxs)(S1,{children:[(0,I.jsx)(C1,{asChild:!0,children:(0,I.jsx)(X,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?Pde():Lde({count:r})})}),(0,I.jsxs)(w1,{align:`start`,className:`w-52`,children:[(0,I.jsx)(E1,{children:Bde()}),d7.map(e=>{let r=u7[e];return(0,I.jsxs)(T1,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,I.jsx)(k5,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,I.jsx)(`span`,{children:l7[e]??e})]},e)})]})]})}function n8e(){let e=os({from:`/settings/users`}),t=ss({from:`/settings/users`}),n=e.q??``,r=e.role??o7,i=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),a=e=>void t({search:t=>({...t,role:e===o7?void 0:e})}),o=P(V.admin.listUsers,{filter:{q:n||void 0,role:r===o7?void 0:r}}),s=P(V.me.getMe,{host:YO}),c=F(V.admin.setRole),l=F(V.admin.setUserPermissions),u=F(V.admin.startImpersonation),d=F(V.admin.deleteUser),f=F(V.admin.setUserName),p=$1(),m=e0(),h=n0(),[g,_]=(0,N.useState)(null),v=(0,N.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of o??[])e.add(t.role);return[...e]},[o]),y=n!==``||r!==o7;function b(){t({search:{},replace:!0})}async function x(e){try{await c(e)}catch(e){h.error(Ude(),e)}}async function S(e){try{await l(e)}catch(e){h.error(Kde(),e)}}async function C(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await p({title:pfe(),description:gfe({user:t}),confirmWord:yfe(),confirmLabel:Sfe(),destructive:!0}))try{await d({profileId:e._id}),h.success(Ofe({user:t}))}catch(e){h.error(Tfe(),e)}}async function w(e){let t=e.email||e.name||e.userId.slice(0,8),n=await m({title:Pfe(),label:Lfe({user:t}),placeholder:Bfe(),defaultValue:e.name??``,confirmLabel:XQ()});if(n!==null)try{await f({profileId:e._id,name:n}),h.success(Ufe())}catch(e){h.error(Kfe(),e)}}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(q5,{q:n,onQChange:i,searchPlaceholder:Yde(),onReset:b,canReset:y,children:(0,I.jsxs)(M3,{value:r,onValueChange:a,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-36`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:o7,children:Qde()}),v.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]})}),(0,I.jsx)(I5,{title:tfe(),rows:o,emptyHint:ife(),rowActions:e=>{let t=[{label:jfe(),onSelect:()=>void w(e)}];return e.userId!==s?.userId&&t.push({label:sfe(),onSelect:()=>void u({profileId:e._id})},{label:ufe(),variant:`destructive`,onSelect:()=>void C(e)}),t},columns:[{header:Yfe(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,I.jsxs)(`div`,{className:`flex flex-col`,children:[(0,I.jsx)(`span`,{children:t}),n?(0,I.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})}},{header:Qfe(),cell:e=>(0,I.jsxs)(M3,{value:e.role,onValueChange:t=>void x({profileId:e._id,role:t}),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-28`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:`pending`,children:`pending`}),(0,I.jsx)(Q,{value:`user`,children:`user`}),(0,I.jsx)(Q,{value:`admin`,children:`admin`})]})]})},{header:tpe(),cell:e=>e.role===`admin`?(0,I.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:ipe()}):(0,I.jsx)(t8e,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),S({profileId:e._id,permissions:[...n]})}})},{header:JQ(),cell:e=>(0,I.jsx)(X,{variant:`outline`,size:`sm`,className:`h-8 font-normal`,onClick:()=>_({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)}),children:lpe()})}]}),(0,I.jsx)(L6e,{profileId:g?.profileId??null,userLabel:g?.label??``,open:g!==null,onOpenChange:e=>{e||_(null)}})]})}var h7={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`};function r8e(){let e=P(V.admin.listInstances,{}),t=F(V.admin.upsertInstance),n=F(V.admin.deleteInstance),r=n0(),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(h7),[c,l]=(0,N.useState)(null);async function u(){try{await t({name:o.name,gatewayUrl:o.gatewayUrl,bridgeUrl:o.bridgeUrl||void 0,displayName:o.displayName||void 0,kind:o.kind}),s(h7),a(!1)}catch(e){r.error(fpe(),e)}}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[hpe(),(0,I.jsx)(`strong`,{children:vpe()}),xpe()]}),(0,I.jsx)(I5,{title:wpe(),rows:e,addLabel:Dpe(),onAdd:()=>{s(h7),a(!0)},emptyHint:Ape(),columns:[{header:Npe(),cell:e=>e.name},{header:Ipe(),cell:e=>(0,I.jsx)($,{variant:`outline`,children:e.kind??`openclaw`})},{header:zpe(),cell:e=>e.gatewayUrl},{header:Hpe(),cell:e=>e.displayName??`—`},{header:JQ(),cell:e=>(0,I.jsx)(X,{variant:`outline`,size:`sm`,className:`h-8 font-normal`,onClick:()=>l(e.name),children:Gpe()})}],rowActions:e=>[{label:YQ(),variant:`destructive`,onSelect:()=>void n({instanceId:e._id})}],bulkActions:[{label:YQ(),variant:`destructive`,onSelect:e=>e.forEach(e=>void n({instanceId:e}))}]}),(0,I.jsx)(d5,{open:i,onOpenChange:a,title:Xpe(),description:$pe(),canSubmit:!!(o.name&&o.gatewayUrl),onSubmit:u,submitLabel:XQ(),children:(0,I.jsxs)(`div`,{className:`oc-form`,children:[(0,I.jsx)(g7,{label:ime(),children:(0,I.jsx)(I1,{value:o.name,onChange:e=>s({...o,name:e.target.value})})}),(0,I.jsx)(g7,{label:sme(),children:(0,I.jsxs)(M3,{value:o.kind,onValueChange:e=>s({...o,kind:e}),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-40`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:`openclaw`,children:`OpenClaw`}),(0,I.jsx)(Q,{value:`hermes`,children:`Hermes`})]})]})}),(0,I.jsx)(g7,{label:ume(),children:(0,I.jsx)(I1,{value:o.gatewayUrl,onChange:e=>s({...o,gatewayUrl:e.target.value})})}),(0,I.jsx)(g7,{label:pme(),children:(0,I.jsx)(I1,{value:o.bridgeUrl,placeholder:gme(),onChange:e=>s({...o,bridgeUrl:e.target.value})})}),(0,I.jsx)(g7,{label:yme(),children:(0,I.jsx)(I1,{value:o.displayName,onChange:e=>s({...o,displayName:e.target.value})})})]})}),(0,I.jsx)(i8e,{instanceName:c,open:c!==null,onOpenChange:e=>{e||l(null)}})]})}function i8e({instanceName:e,open:t,onOpenChange:n}){let r=P(V.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`);return(0,I.jsx)(G1,{open:t,onOpenChange:n,children:(0,I.jsxs)(K1,{children:[(0,I.jsxs)(q1,{children:[(0,I.jsx)(Y1,{children:Sme({name:e??``})}),(0,I.jsxs)(X1,{children:[Tme(),(0,I.jsx)(`code`,{children:`agents.list`}),Ome()]})]}),r===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:jme()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Pme():r.discovery.lastPollOk?Lme():Bme({error:r.discovery.error??`?`})}),r.agents.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:Ume()}):(0,I.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>(0,I.jsxs)(`div`,{className:`oc-access__row`,children:[(0,I.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,I.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,I.jsx)($,{variant:`outline`,children:Kme()}):null,e.presentInLastOk===!1?(0,I.jsx)($,{variant:`outline`,className:`oc-access__gone`,children:Yme()}):null]},e.agentId))})]})]})})}function g7({label:e,children:t}){return(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}var a8e=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function o8e(){let e=os({from:`/settings/audit`}),t=ss({from:`/settings/audit`}),n=e.q??``,r=e.action??o7,i=e.impersonated??o7,a=e.resource??o7,o=Q5(e.from,e.to),s=(0,N.useMemo)(()=>t7(e.adv),[e.adv]),{from:c,to:l}=W5(o),u=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,action:e===o7?void 0:e})}),f=e=>void t({search:t=>({...t,impersonated:e===o7?void 0:e})}),p=e=>void t({search:t=>({...t,resource:e===o7?void 0:e})}),m=e=>void t({search:t=>({...t,...$5(e)})}),h=e=>void t({search:t=>({...t,adv:e7(e)}),replace:!0}),g=P(V.admin.listAudit,{filter:{q:n||void 0,from:c,to:l,action:r===o7?void 0:r,resource:a===o7?void 0:a,impersonated:i===o7?void 0:i===`yes`,advanced:s.length>0?s:void 0}}),_=(0,N.useMemo)(()=>{let e=new Set;for(let t of g??[])e.add(t.action);return[...e].sort()},[g]),v=(0,N.useMemo)(()=>{let e=new Set;for(let t of g??[])t.resource&&e.add(t.resource);return[...e].sort()},[g]),y=n!==``||r!==o7||i!==o7||a!==o7||s.length>0||o.kind!==`relative`||o.from!==$6e.from;function b(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[Qme(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:the()})]}),(0,I.jsxs)(q5,{q:n,onQChange:u,searchPlaceholder:ihe(),timeRange:o,onTimeRangeChange:m,onReset:b,canReset:y,children:[(0,I.jsxs)(M3,{value:r,onValueChange:d,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-40`,children:(0,I.jsx)(N3,{placeholder:ZQ()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:o7,children:lhe()}),_.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(M3,{value:i,onValueChange:f,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-40`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:o7,children:fhe()}),(0,I.jsx)(Q,{value:`yes`,children:hhe()}),(0,I.jsx)(Q,{value:`no`,children:vhe()})]})]}),(0,I.jsxs)(M3,{value:a,onValueChange:p,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-40`,children:(0,I.jsx)(N3,{placeholder:QQ()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:o7,children:Che()}),v.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]})]}),(0,I.jsx)(Y5,{fields:a8e,seed:s,onChange:h}),(0,I.jsx)(I5,{title:Ehe(),rows:g,emptyHint:khe(),columns:[{header:Mhe(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`)},{header:ZQ(),cell:e=>e.action},{header:Fhe(),cell:e=>e.realLabel},{header:Rhe(),cell:e=>e.targetLabel??`—`},{header:QQ(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`}]})]})}var s8e={pending:x_e,user:w_e,admin:D_e,observer:A_e,agent:N_e};function _7(e){if(e.builtin){let t=s8e[e.key];if(t)return t()}return e.description}var v7=[{value:`never`,label:()=>QH(),days:null},{value:`30`,label:()=>tU(),days:30},{value:`90`,label:()=>iU(),days:90}],c8e=720*60*60*1e3,y7=`__all__`,b7={name:``,roleKey:``,description:``};function l8e(){let e=os({from:`/settings/serviceAccounts`}),t=ss({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??y7,[i,a]=(0,N.useState)(y7),o=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),s=e=>void t({search:t=>({...t,status:e===y7?void 0:e})}),c=P(V.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:i===y7?void 0:i,disabled:r===y7?void 0:r===`disabled`}}),l=P(V.apiKeys.listKeys,{}),u=P(V.apiKeys.listRoles,{}),d=F(V.apiKeys.createServiceAccount),f=F(V.apiKeys.updateServiceAccount),p=F(V.apiKeys.deleteServiceAccount),m=$n(V.apiKeys.mintApiKey),h=F(V.apiKeys.revokeApiKey),g=$1(),_=n0(),v=n!==``||i!==y7||r!==y7;function y(){a(y7),t({search:{},replace:!0})}let[b,x]=(0,N.useState)(!1),[S,C]=(0,N.useState)(b7),[w,T]=(0,N.useState)(null),[E,D]=(0,N.useState)(new Set),[O,ee]=(0,N.useState)(null),te=(0,N.useRef)(!1),[k,A]=(0,N.useState)(new Set),[j,ne]=(0,N.useState)({}),[re,M]=(0,N.useState)(null),ie=(0,N.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);function ae(e){D(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function oe(){try{w?(await f({serviceAccountId:w,name:S.name,roleKey:S.roleKey,description:S.description}),_.success(uV())):await d({name:S.name,roleKey:S.roleKey,description:S.description||void 0}),C(b7),T(null),x(!1)}catch(e){_.error(w?sV():iV(),e)}}function se(e){C({name:e.name,roleKey:e.roleKey,description:e.description??``}),T(e._id),x(!0)}async function ce(e){if(te.current)return;te.current=!0;let t=j[e._id]??`never`,n=v7.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;ee(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});M({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(pV(),e)}finally{te.current=!1,ee(null)}}async function le(e){if(await g({title:gV(),description:(0,I.jsxs)(I.Fragment,{children:[yV(),` `,(0,I.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,SV(),` `,(0,I.jsx)(`strong`,{children:TV()}),` `,OV()]}),confirmWord:e.name,confirmLabel:jV(),destructive:!0}))try{await p({serviceAccountId:e._id}),_.success(PV(),e.name)}catch(e){_.error(LV(),e)}}async function ue(e){if(await g({title:BV(),description:(0,I.jsxs)(I.Fragment,{children:[UV(),` `,(0,I.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,KV()]}),confirmLabel:YV(),destructive:!0})&&!k.has(e._id)){A(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){_.error(QV(),e)}finally{A(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:uz()}),(0,I.jsxs)(q5,{q:n,onQChange:o,searchPlaceholder:pz(),onReset:y,canReset:v,children:[(0,I.jsxs)(M3,{value:i,onValueChange:a,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-40`,children:(0,I.jsx)(N3,{placeholder:gz()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:y7,children:yz()}),(u??[]).map(e=>(0,I.jsx)(Q,{value:e.key,children:e.key},e._id))]})]}),(0,I.jsxs)(M3,{value:r,onValueChange:s,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-36`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:y7,children:Sz()}),(0,I.jsx)(Q,{value:`active`,children:Tz()}),(0,I.jsx)(Q,{value:`disabled`,children:Oz()})]})]})]}),(0,I.jsx)(I5,{title:jz(),rows:c,addLabel:Pz(),onAdd:()=>{C(b7),T(null),x(!0)},emptyHint:Lz(),isExpanded:e=>E.has(e._id),renderExpanded:e=>(0,I.jsx)(u8e,{account:e,keys:ie.get(e._id)??[],onRevoke:ue,revoking:k}),rowActions:e=>[{label:Yz(),onSelect:()=>se(e)},{label:Bz(),onSelect:()=>void ce(e)},{label:E.has(e._id)?Uz():Kz(),onSelect:()=>ae(e._id)},{label:Qz(),variant:`destructive`,onSelect:()=>void le(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,I.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":E.has(e._id)?tB():iB(),onClick:()=>ae(e._id),children:E.has(e._id)?(0,I.jsx)(pm,{}):(0,I.jsx)(mm,{})})},{header:sB(),cell:e=>(0,I.jsxs)(`div`,{className:`flex flex-col`,children:[(0,I.jsx)(`span`,{children:e.name}),e.description?(0,I.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:uB(),cell:e=>(0,I.jsx)($,{variant:`secondary`,children:e.roleKey})},{header:pB(),cell:e=>e.disabled?(0,I.jsx)($,{variant:`destructive`,children:Oz()}):(0,I.jsx)($,{variant:`outline`,children:Tz()})},{header:gB(),cell:e=>(0,I.jsxs)(M3,{value:j[e._id]??`never`,onValueChange:t=>ne(n=>({...n,[e._id]:t})),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-32`,children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:v7.map(e=>(0,I.jsx)(Q,{value:e.value,children:e.label()},e.value))})]})},{header:yB(),cell:e=>{let t=(ie.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,I.jsx)(`span`,{className:`oc-sa__keycount`,children:O===e._id?SB():TB({count:t})})}}]}),(0,I.jsx)(d5,{open:b,onOpenChange:e=>{x(e),e||T(null)},title:w?OB():LB(),description:w?jB():BB(),canSubmit:!!(S.name&&S.roleKey),onSubmit:oe,submitLabel:w?PB():UB(),children:(0,I.jsxs)(`div`,{className:`oc-form`,children:[(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:KB()}),(0,I.jsx)(I1,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:YB()}),(0,I.jsxs)(M3,{value:S.roleKey||void 0,onValueChange:e=>C({...S,roleKey:e}),children:[(0,I.jsx)(P3,{className:`w-full`,children:(0,I.jsx)(N3,{placeholder:QB()})}),(0,I.jsx)(F3,{children:(u??[]).map(e=>(0,I.jsxs)(Q,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===S.roleKey),t=e?_7(e):null;return t?(0,I.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:tV()}),(0,I.jsx)(I1,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})}),(0,I.jsx)(d8e,{minted:re,onClose:()=>M(null)})]})}function u8e({account:e,keys:t,onRevoke:n,revoking:r}){return(0,I.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,I.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[tH(),` `,(0,I.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:iH()}):(0,I.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,I.jsx)(`thead`,{children:(0,I.jsxs)(`tr`,{children:[(0,I.jsx)(`th`,{children:sH()}),(0,I.jsx)(`th`,{children:uH()}),(0,I.jsx)(`th`,{children:pH()}),(0,I.jsx)(`th`,{children:gH()}),(0,I.jsx)(`th`,{children:yH()}),(0,I.jsx)(`th`,{children:SH()}),(0,I.jsx)(`th`,{})]})}),(0,I.jsx)(`tbody`,{children:t.map(t=>(0,I.jsxs)(`tr`,{children:[(0,I.jsx)(`td`,{children:(0,I.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,I.jsx)(`td`,{children:(0,I.jsx)($,{variant:`secondary`,children:e.roleKey})}),(0,I.jsx)(`td`,{children:f8e(t.createdAt)}),(0,I.jsx)(`td`,{className:p8e(t.lastUsedAt)?`oc-sa__stale`:``,children:m8e(t.lastUsedAt)}),(0,I.jsx)(`td`,{children:h8e(t.expiresAt)}),(0,I.jsx)(`td`,{children:g8e(t)}),(0,I.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,I.jsx)(X,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?TH():OH()})})]},t._id))})]})]})}function d8e({minted:e,onClose:t}){let[n,r]=(0,N.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,I.jsx)(G1,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,I.jsxs)(K1,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,I.jsxs)(q1,{children:[(0,I.jsx)(Y1,{children:jH()}),(0,I.jsx)(X1,{children:PH({name:e.accountName})})]}),(0,I.jsx)(`div`,{className:`oc-sa__minted-warning`,children:LH()}),(0,I.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,I.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,I.jsxs)(X,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":BH(),children:[n?(0,I.jsx)(fm,{}):(0,I.jsx)(_m,{}),n?UH():KH()]})]}),(0,I.jsx)(J1,{children:(0,I.jsx)(X,{onClick:()=>{r(!1),t()},children:YH()})})]}):null})}function f8e(e){return new Date(e).toLocaleString(`fr-FR`)}function p8e(e){return e===null?!1:Date.now()-e>c8e}function m8e(e){return e===null?sU():new Date(e).toLocaleString(`fr-FR`)}function h8e(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function g8e(e){return e.disabled?(0,I.jsx)($,{variant:`destructive`,children:uU()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,I.jsx)($,{variant:`outline`,children:pU()}):(0,I.jsx)($,{variant:`outline`,children:gU()})}var x7=[{group:()=>Vhe(),keys:[{key:`traces.read`,label:()=>$Q()},{key:`traces.read.content`,label:()=>ige(),phi:!0},{key:`traces.write`,label:()=>e$()}]},{group:()=>Whe(),keys:[{key:`kpi.read`,label:()=>$Q()},{key:`kpi.write`,label:()=>e$()}]},{group:()=>qhe(),keys:[{key:`openclaw.query`,label:()=>lge()},{key:`anomalies.read`,label:()=>fge()},{key:`anomalies.report`,label:()=>hge()}]},{group:()=>Xhe(),keys:[{key:`chats.read`,label:()=>$Q()},{key:`selfheal`,label:()=>xge()}]},{group:()=>$he(),keys:[{key:`admin.manage`,label:()=>vge()}]}],_8e=x7.flatMap(e=>e.keys.map(e=>e.key));function S7(e){return e.includes(`*`)}var C7={key:``,name:``,description:``};function v8e(){let e=P(V.apiKeys.listRoles,{}),t=F(V.apiKeys.createRole),n=F(V.apiKeys.ensureRolesSeeded),r=F(V.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(V.apiKeys.listRoles,{});r&&e.setQuery(V.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),i=$1(),a=n0(),[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(C7),[u,d]=(0,N.useState)(new Set);(0,N.useEffect)(()=>{n({}).catch(e=>{a.error(Dge(),e)})},[n,a]);let f=e??[];async function p(e,t){if(S7(e.permissions)||u.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await i({title:Age({name:e.name}),description:Nge(),confirmLabel:Ige()}))){d(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){a.error(zge(),e)}finally{d(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function m(){try{await t({key:c.key,name:c.name,description:c.description||void 0,permissions:[]}),l(C7),s(!1)}catch(e){a.error(Hge(),e)}}let h=e===void 0,g=!h&&f.length===0;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[Gge(),` `,(0,I.jsx)(`code`,{children:`admin`}),` `,Jge(),` `,(0,I.jsx)(`code`,{children:`traces.read.content`}),` `,Zge()]}),(0,I.jsxs)(`div`,{className:`oc-dt`,children:[(0,I.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,I.jsx)(`h2`,{className:`oc-dt__title`,children:e_e()}),(0,I.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,I.jsx)(X,{size:`sm`,onClick:()=>{l(C7),s(!0)},children:r_e()})})]}),h?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:o_e()}):g?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:l_e()}):(0,I.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,I.jsxs)(`table`,{className:`oc-matrix`,children:[(0,I.jsxs)(`thead`,{children:[(0,I.jsxs)(`tr`,{children:[(0,I.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:f_e()}),x7.map(e=>(0,I.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,I.jsx)(`tr`,{children:x7.flatMap(e=>e.keys.map(e=>(0,I.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?wge({key:e.key}):e.key,children:[e.label(),e.phi?(0,I.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,I.jsx)(`tbody`,{children:f.map(e=>{let t=S7(e.permissions),n=u.has(e._id);return(0,I.jsxs)(`tr`,{children:[(0,I.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,I.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,I.jsx)(`span`,{children:e.name}),(0,I.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,I.jsxs)($,{variant:`outline`,className:`gap-1`,children:[(0,I.jsx)(Dee,{}),` `,h_e()]}):(0,I.jsx)($,{variant:`secondary`,children:v_e()})]}),_7(e)?(0,I.jsx)(`p`,{className:`oc-matrix__roledesc`,children:_7(e)}):null]}),_8e.map(r=>(0,I.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,I.jsx)(k5,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?I_e():n?z_e():r,onCheckedChange:()=>void p(e,r)})},r))]},e.key)})})]})})]}),(0,I.jsx)(d5,{open:o,onOpenChange:s,title:H_e(),description:G_e(),canSubmit:!!(c.key&&c.name),onSubmit:m,submitLabel:J_e(),children:(0,I.jsxs)(`div`,{className:`oc-form`,children:[(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:Z_e()}),(0,I.jsx)(I1,{value:c.key,placeholder:eve(),onChange:e=>l({...c,key:e.target.value})})]}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:rve()}),(0,I.jsx)(I1,{value:c.name,onChange:e=>l({...c,name:e.target.value})})]}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:ove()}),(0,I.jsx)(I1,{value:c.description,onChange:e=>l({...c,description:e.target.value})})]})]})})]})}function y8e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function b8e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function x8e(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function S8e(e){switch(e){case`admin`:return SVe();case`user`:return TVe();case`pending`:return OVe();default:return e}}function w7(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function T7(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}function C8e({className:e,orientation:t=`horizontal`,...n}){return(0,I.jsx)(Ale,{"data-slot":`tabs`,"data-orientation":t,className:x1(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var w8e=P1(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function T8e({className:e,variant:t=`default`,...n}){return(0,I.jsx)(jle,{"data-slot":`tabs-list`,"data-variant":t,className:x1(w8e({variant:t}),e),...n})}function E7({className:e,...t}){return(0,I.jsx)(Mle,{"data-slot":`tabs-trigger`,className:x1(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-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 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_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-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function D7({className:e,...t}){return(0,I.jsx)(Nle,{"data-slot":`tabs-content`,className:x1(`flex-1 text-sm outline-none`,e),...t})}var O7={name:``,description:``};function E8e(){let e=P(V.groups.listGroups,{}),t=F(V.groups.createGroup),n=F(V.groups.updateGroup),r=F(V.groups.deleteGroup),i=$1(),a=n0(),[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(null),[u,d]=(0,N.useState)(O7),[f,p]=(0,N.useState)(null);function m(){l(null),d(O7),s(!0)}function h(e){l(e),d({name:e.name,description:e.description??``}),s(!0)}async function g(){try{c?await n({groupId:c._id,name:u.name,description:u.description}):await t({name:u.name,description:u.description||void 0}),d(O7),l(null),s(!1)}catch(e){a.error(cHe(),e)}}async function _(e){if(await i({title:FBe({name:e.name}),description:RBe(),confirmWord:e.name,confirmLabel:VBe(),cancelLabel:_Be(),destructive:!0}))try{await r({groupId:e._id})}catch(e){a.error(dHe(),e)}}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Rze()}),(0,I.jsx)(I5,{title:Fze(),rows:e,addLabel:Vze(),onAdd:m,emptyHint:Wze(),columns:[{header:qze(),cell:e=>e.name},{header:Xze(),cell:e=>(0,I.jsxs)($,{variant:`outline`,className:`gap-1`,children:[(0,I.jsx)(Lm,{size:12,"aria-hidden":!0}),e.memberCount]})},{header:$ze(),cell:e=>(0,I.jsxs)($,{variant:`outline`,className:`gap-1`,children:[(0,I.jsx)(jm,{size:12,"aria-hidden":!0}),e.agentCount]})},{header:nBe(),cell:e=>(0,I.jsx)(X,{variant:`outline`,size:`sm`,className:`h-8 font-normal`,onClick:()=>p({groupId:e._id,name:e.name}),children:aBe()})}],rowActions:e=>[{label:cBe(),onSelect:()=>h(e)},{label:dBe(),variant:`destructive`,onSelect:()=>void _(e)}]}),(0,I.jsx)(d5,{open:o,onOpenChange:s,title:c?CBe():bBe(),description:EBe(),canSubmit:!!u.name.trim(),onSubmit:g,submitLabel:mBe(),children:(0,I.jsxs)(`div`,{className:`oc-form`,children:[(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:kBe()}),(0,I.jsx)(I1,{value:u.name,onChange:e=>d({...u,name:e.target.value})})]}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(`span`,{className:`oc-field__label`,children:MBe()}),(0,I.jsx)(I1,{value:u.description,onChange:e=>d({...u,description:e.target.value})})]})]})}),(0,I.jsx)(D8e,{groupId:f?.groupId??null,groupName:f?.name??``,open:f!==null,onOpenChange:e=>{e||p(null)}})]})}var k7=8;function A7({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,I.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,I.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,I.jsx)(vee,{size:14,"aria-hidden":!0}),pVe()]}),(0,I.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":yVe({page:e,pages:t}),children:[e,` / `,t]}),(0,I.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[gVe(),(0,I.jsx)(mm,{size:14,"aria-hidden":!0})]})]})}function D8e({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=P(V.groups.getGroup,n&&e?{groupId:e}:`skip`),a=P(V.admin.listInstances,n?{}:`skip`),o=P(V.admin.listUsers,n?{}:`skip`),s=F(V.groups.addMember),c=F(V.groups.removeMember),l=F(V.groups.bulkSetMembers),u=n0(),[d,f]=(0,N.useState)(``),[p,m]=(0,N.useState)(``),[h,g]=(0,N.useState)(`members`),[_,v]=(0,N.useState)(1),[y,b]=(0,N.useState)(new Set),x=(0,N.useRef)(null),S=(0,N.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),C=(0,N.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,N.useEffect)(()=>{f(``),m(``),g(`members`),v(1),x.current=null},[n,e]),(0,N.useEffect)(()=>{v(1)},[d]),(0,N.useEffect)(()=>{n&&i&&e&&x.current!==e&&(x.current=e,b(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let w=(0,N.useMemo)(()=>o?y8e(o,d,y):[],[o,d,y]);async function T(t,n){if(e)try{n?await c({groupId:e,userId:t}):await s({groupId:e,userId:t})}catch(e){u.error(C$(),e)}}let E=w7(w,e=>S.has(e.userId)),D=w.filter(e=>S.has(e.userId)).length,O=T7(w,_,k7);async function ee(){if(!e||w.length===0)return;let t=w.map(e=>e.userId);try{await l({groupId:e,userIds:t,member:E!==`all`})}catch(e){u.error(C$(),e)}}return(0,I.jsx)(G1,{open:n,onOpenChange:r,children:(0,I.jsxs)(K1,{className:`oc-access`,children:[(0,I.jsxs)(q1,{children:[(0,I.jsx)(Y1,{children:WBe({name:t})}),(0,I.jsx)(X1,{children:qBe()})]}),(0,I.jsxs)(C8e,{value:h,onValueChange:g,className:`oc-access__tabs`,children:[(0,I.jsxs)(T8e,{className:`w-full`,children:[(0,I.jsxs)(E7,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,I.jsx)(Lm,{size:13,"aria-hidden":!0}),XBe(),i?(0,I.jsx)($,{variant:`secondary`,className:`oc-access__tabcount`,children:S.size}):null]}),(0,I.jsxs)(E7,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,I.jsx)(jm,{size:13,"aria-hidden":!0}),nVe(),i?(0,I.jsx)($,{variant:`secondary`,className:`oc-access__tabcount`,children:C.size}):null]})]}),(0,I.jsx)(D7,{value:`members`,children:o===void 0||i===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:x$()}):o.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:HVe()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(I1,{value:d,onChange:e=>f(e.target.value),placeholder:$Be(),className:`oc-access__search`}),w.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:cVe()}):(0,I.jsxs)(I.Fragment,{children:[w.length>1?(0,I.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,I.jsx)(k5,{checked:E===`all`?!0:E===`some`?`indeterminate`:!1,onCheckedChange:()=>void ee(),"aria-label":b$()}),(0,I.jsx)(`span`,{className:`oc-access__label`,children:b$()}),(0,I.jsxs)($,{variant:`outline`,className:`oc-access__count`,children:[D,` / `,w.length]})]}):null,(0,I.jsx)(`div`,{className:`oc-access__list`,children:O.pageItems.map(e=>{let t=S.has(e.userId),n=x8e(e);return(0,I.jsxs)(`div`,{className:`oc-access__row`,children:[(0,I.jsx)(k5,{checked:t,onCheckedChange:()=>void T(e.userId,t),"aria-label":jVe({user:n.primary})}),(0,I.jsxs)(`span`,{className:`oc-access__who`,children:[(0,I.jsx)(`span`,{className:`oc-access__label`,children:n.primary}),n.secondary?(0,I.jsx)(`span`,{className:`oc-access__sub`,children:n.secondary}):null]}),(0,I.jsx)($,{variant:`outline`,className:`oc-access__role`,children:S8e(e.role)})]},e._id)})}),(0,I.jsx)(A7,{page:O.page,pageCount:O.pageCount,onPage:v})]})]})}),(0,I.jsx)(D7,{value:`agents`,children:a===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:x$()}):a.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:GVe()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(I1,{value:p,onChange:e=>m(e.target.value),placeholder:aVe(),className:`oc-access__search`}),(0,I.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,I.jsx)(O8e,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:C,query:p},`${e}-${t._id}`))})]})})]})]})})}function O8e({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=P(V.agents.listAgentsForInstance,{instanceName:t}),o=F(V.groups.assignAgentToGroup),s=F(V.groups.removeAgentFromGroup),c=F(V.groups.bulkSetGroupAgents),l=n0(),[u,d]=(0,N.useState)(1);if((0,N.useEffect)(()=>{d(1)},[i]),!e)return null;let f=b8e(a?.agents??[],i),p=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let m=f.filter(e=>e.presentInLastOk!==!1),h=w7(m,e=>r.has(`${t}/${e.agentId}`)),g=T7(f,u,k7);async function _(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(w$(),e)}}async function v(){if(m.length===0)return;let n=m.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:h!==`all`})}catch(e){l.error(w$(),e)}}return(0,I.jsxs)(`div`,{className:`oc-access__group`,children:[(0,I.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,I.jsx)(jm,{size:13,"aria-hidden":!0}),(0,I.jsx)(`span`,{children:t}),(0,I.jsx)($,{variant:`outline`,className:`oc-access__kind`,children:n}),p?(0,I.jsx)($,{variant:`outline`,className:`oc-access__stale`,children:eHe()}):null]}),a===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:zVe()}):f.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:p?ZVe():JVe()}):(0,I.jsxs)(I.Fragment,{children:[m.length>1?(0,I.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,I.jsx)(k5,{checked:h===`all`?!0:h===`some`?`indeterminate`:!1,onCheckedChange:()=>void v(),"aria-label":b$()}),(0,I.jsx)(`span`,{className:`oc-access__label`,children:b$()})]}):null,g.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,I.jsxs)(`div`,{className:`oc-access__row`,children:[(0,I.jsx)(k5,{checked:i,disabled:a&&!i,onCheckedChange:()=>void _(e.agentId,i),"aria-label":PVe({name:e.displayName??e.agentId})}),(0,I.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,I.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,I.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":S$(),title:S$(),children:(0,I.jsx)(Nm,{size:14,fill:`currentColor`})}):null,a?(0,I.jsx)($,{variant:`outline`,className:`oc-access__gone`,children:rHe()}):null]},e.agentId)}),(0,I.jsx)(A7,{page:g.page,pageCount:g.pageCount,onPage:d})]})]})}var k8e=[50,100,200,500],j7=`all`,M7=`__all__`,A8e=[`2xx`,`4xx`,`5xx`],j8e=[`user`,`service`,`system`],M8e=[`inbound`,`outbound`,`internal`],N8e={kind:`relative`,from:`now-30d`,to:`now`},P8e=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function F8e(){let e=os({from:`/settings/traces`}),t=ss({from:`/settings/traces`}),n=e.limit,r=e.kind,i=e.statusClass??M7,a=e.principalType??M7,o=e.direction??M7,s=e.roleKey??M7,c=e.q??``,l=Q5(e.from,e.to),u=(0,N.useMemo)(()=>t7(e.adv),[e.adv]),{from:d,to:f}=W5(l),[p,m]=(0,N.useState)(null),[h,g]=(0,N.useState)(null),_=e=>void t({search:t=>({...t,limit:e})}),v=e=>void t({search:t=>({...t,kind:e})}),y=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),b=e=>void t({search:t=>({...t,statusClass:e===M7?void 0:e})}),x=e=>void t({search:t=>({...t,principalType:e===M7?void 0:e})}),S=e=>void t({search:t=>({...t,direction:e===M7?void 0:e})}),C=e=>void t({search:t=>({...t,roleKey:e===M7?void 0:e})}),w=e=>void t({search:t=>({...t,...$5(e)})}),T=e=>void t({search:t=>({...t,adv:e7(e)}),replace:!0}),E=P(V.observability.listEvents,{limit:n}),D=P(V.observability.listEvents,{limit:n,kind:r===j7?void 0:r,filter:{q:c||void 0,from:d,to:f,statusClass:i===M7?void 0:i,principalType:a===M7?void 0:a,direction:o===M7?void 0:o,roleKey:s===M7?void 0:s,advanced:u.length>0?u:void 0}}),O=(0,N.useMemo)(()=>{let e=new Set;for(let t of E??[])e.add(t.kind);return[...e].sort()},[E]),ee=(0,N.useMemo)(()=>{let e=new Set;for(let t of E??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[E]),te=c!==``||i!==M7||a!==M7||o!==M7||s!==M7||u.length>0||l.kind!==`relative`||l.from!==N8e.from;function k(){t({search:{limit:100,kind:`all`},replace:!0})}let A=p?E?.filter(e=>e.correlationId===p):D;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[$xe(),(0,I.jsx)(`strong`,{children:nSe()}),aSe(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:cSe()})]}),(0,I.jsxs)(q5,{q:c,onQChange:y,searchPlaceholder:dSe(),timeRange:l,onTimeRangeChange:w,onReset:k,canReset:te,children:[(0,I.jsxs)(M3,{value:i,onValueChange:b,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-32`,children:(0,I.jsx)(N3,{placeholder:mSe()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:M7,children:_Se()}),A8e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(M3,{value:a,onValueChange:x,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-32`,children:(0,I.jsx)(N3,{placeholder:bSe()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:M7,children:CSe()}),j8e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(M3,{value:o,onValueChange:S,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-32`,children:(0,I.jsx)(N3,{placeholder:ESe()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:M7,children:kSe()}),M8e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(M3,{value:s,onValueChange:C,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-36`,children:(0,I.jsx)(N3,{placeholder:MSe()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:M7,children:FSe()}),ee.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(M3,{value:r,onValueChange:v,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-44`,children:(0,I.jsx)(N3,{placeholder:RSe()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:j7,children:VSe()}),O.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(M3,{value:String(n),onValueChange:e=>_(Number(e)),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-28`,children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:k8e.map(e=>(0,I.jsx)(Q,{value:String(e),children:WSe({count:e})},e))})]})]}),(0,I.jsx)(Y5,{fields:P8e,seed:u,onChange:T}),p?(0,I.jsx)(`div`,{className:`oc-traces__followline`,children:(0,I.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>m(null),title:qSe(),children:[(0,I.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[XSe(),(0,I.jsx)(`code`,{children:N7(p)})]}),(0,I.jsx)(zm,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`sr-only`,children:$Se()})]})}):null,(0,I.jsx)(I5,{title:nCe(),rows:A,emptyHint:p?aCe():cCe(),columns:[{header:dCe(),cell:e=>(0,I.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:mCe(),cell:e=>(0,I.jsx)($,{variant:`secondary`,children:e.kind})},{header:_Ce(),cell:e=>{let t=L8e(e);return t?(0,I.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,I.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":bCe(),children:`✓`})}},{header:CCe(),cell:e=>e.direction?(0,I.jsx)($,{variant:`outline`,children:e.direction}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ECe(),cell:e=>(0,I.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,I.jsx)($,{variant:`outline`,children:e.principalType}),e.principalId?(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:N7(e.principalId)}):null]})},{header:kCe(),cell:e=>e.roleKey?(0,I.jsx)($,{variant:`secondary`,children:e.roleKey}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:MCe(),cell:e=>e.route?(0,I.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,I.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:FCe(),cell:e=>e.status===null?(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,I.jsx)(`span`,{className:`oc-traces__status ${I8e(e.status)}`,children:e.status})},{header:RCe(),cell:e=>e.latencyMs===null?(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,I.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:VCe(),cell:e=>e.correlationId?(0,I.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:WCe(),onClick:()=>m(e.correlationId),children:N7(e.correlationId)}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:qCe(),cell:e=>e.meta?(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>g(e),children:XCe()}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,I.jsx)(R8e,{row:h,onClose:()=>g(null)})]})}function I8e(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function N7(e){return e.length>8?e.slice(0,8):e}function L8e(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function R8e({row:e,onClose:t}){let n=(0,N.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,I.jsx)(G1,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,I.jsxs)(K1,{className:`max-w-lg`,children:[(0,I.jsxs)(q1,{children:[(0,I.jsxs)(Y1,{className:`oc-traces__meta-title`,children:[$Ce(),` `,(0,I.jsx)(`code`,{children:e.kind}),(0,I.jsx)($,{variant:`outline`,children:nwe()})]}),(0,I.jsx)(X1,{children:awe()})]}),(0,I.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}function P7({className:e,size:t=`default`,...n}){return(0,I.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:x1(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function F7({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`card-header`,className:x1(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function I7({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`card-title`,className:x1(`font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function L7({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`card-description`,className:x1(`text-sm text-muted-foreground`,e),...t})}function R7({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`card-content`,className:x1(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function z8e({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`card-footer`,className:x1(`flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3`,e),...t})}var z7=[{metric:`api.calls`,label:Dke(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:Ake(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:Nke(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:Ike(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:zke(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:Hke(),unit:`/h`,group:`Assistant`,isError:!0}],B7=z7.length,B8e=[`API`,`OpenClaw`,`Chat`,`Assistant`],V8e=1e3,H8e=36e5;function U8e(e,t){let n=Math.max(1,Math.ceil((t-e)/H8e)),r=Math.min(n*B7,V8e);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/B7))}}function W8e(){let e=os({from:`/settings/kpi`}),t=ss({from:`/settings/kpi`}),n=Q5(e.from,e.to,K6e,`now`),r=e=>void t({search:t=>({...t,...$5(e)})}),{from:i,to:a}=W5(n),{rowLimit:o,buckets:s}=U8e(i,a),c=P(V.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),l=(0,N.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>s&&e.set(t,n.slice(n.length-s));return e},[c,s]),u=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[Gke(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:Jke()})]}),(0,I.jsx)(G8e,{value:n,onChange:r})]});return c===void 0?(0,I.jsxs)(I.Fragment,{children:[u,(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Zke()})]}):c.length===0?(0,I.jsxs)(I.Fragment,{children:[u,(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:eAe()})]}):(0,I.jsxs)(I.Fragment,{children:[u,B8e.map(e=>{let t=z7.filter(t=>t.group===e);return t.some(e=>(l.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(K8e,{config:e,series:l.get(e.metric)??[]},e.metric))})]},e):null})]})}function G8e({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(K5,{value:e,onChange:t})})}function K8e({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(P7,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(F7,{children:[(0,I.jsx)(I7,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(L7,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(R7,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:U7(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(J8e,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:rAe({value:W7(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:oAe()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:lAe({count:t.length})})]})]})]})}var V7=240,H7=48,q8e=1;function J8e({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=V7/e.length,a=Math.max(i-q8e,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${V7} ${H7}`,preserveAspectRatio:`none`,role:`img`,"aria-label":fAe({max:U7(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(H7-1):0,c=o*i,l=H7-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[W7(e.bucket),` · `,U7(e.value),` `,n]})},e.bucket)})})}function U7(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function W7(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}var G7={AGENT_NOT_FOUND:()=>({label:yFe(),hint:SFe()}),AUTH_TOKEN_MISMATCH:()=>({label:TFe(),hint:OFe()}),DEVICE_SIGNING_FAILED:()=>({label:jFe(),hint:PFe()}),SESSION_SCOPE_DENIED:()=>({label:LFe(),hint:BFe()}),GATEWAY_TIMEOUT:()=>({label:UFe(),hint:KFe()}),GATEWAY_DISCONNECTED:()=>({label:YFe(),hint:QFe()}),ATTACHMENT_TOO_LARGE:()=>({label:sIe(),hint:uIe()}),ATTACHMENT_REJECTED:()=>({label:pIe(),hint:gIe()}),BRIDGE_UNREACHABLE:()=>({label:tIe(),hint:iIe()}),INVALID_REQUEST:()=>({label:yIe(),hint:SIe()}),NOT_CONFIGURED:()=>({label:TIe(),hint:OIe()}),UNROUTED:()=>({label:jIe(),hint:PIe()}),UPSTREAM_ERROR:()=>({label:LIe(),hint:BIe()}),UNKNOWN:()=>({label:UIe(),hint:KIe()})};function K7(e){return e?G7[e]?.()??{label:e,hint:YIe()}:G7.UNKNOWN()}var q7=`__all__`,Y8e=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function X8e(e){return e===`open`?lve():e===`acknowledged`?fve():hve()}var Z8e=[`info`,`warn`,`critical`],Q8e=[`detector`,`agent`],$8e={kind:`relative`,from:`now-30d`,to:`now`},e5e=200,J7=`all`;function t5e(){let e=os({from:`/settings/anomalies`}),t=ss({from:`/settings/anomalies`}),n=e.q??``,r=e.status===J7?q7:e.status,i=e.severity??q7,a=e.kind??q7,[o,s]=(0,N.useState)(q7),c=Q5(e.from,e.to),{from:l,to:u}=W5(c),d=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),f=e=>void t({search:t=>({...t,status:e===q7?J7:e})}),p=e=>void t({search:t=>({...t,severity:e===q7?void 0:e})}),m=e=>void t({search:t=>({...t,kind:e===q7?void 0:e})}),h=e=>void t({search:t=>({...t,...$5(e)})}),g=$1(),_=n0(),v=F(V.anomalies.resolveAnomaly),y=(P(V.me.getMe,{host:YO})?.permissions??[]).includes(`admin.manage`),b=P(V.anomalies.listAnomalies,{limit:e5e,filter:{q:n||void 0,from:l,to:u,anomalyStatus:r===q7?void 0:r,severity:i===q7?void 0:i,source:o===q7?void 0:o,kind:a===q7?void 0:a}}),x=(0,N.useMemo)(()=>{let e=new Set;for(let t of b??[])e.add(t.kind);return[...e].sort()},[b]),S=n!==``||r!==`open`||i!==q7||o!==q7||a!==q7||c.kind!==`relative`||c.from!==$8e.from;function C(){s(q7),t({search:{status:`open`},replace:!0})}async function w(e){if(await g({title:vve(),description:(0,I.jsxs)(I.Fragment,{children:[xve(),` `,(0,I.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,wve(),` `,(0,I.jsx)(`strong`,{children:Dve()}),`.`,` `,Ave()]}),confirmLabel:Nve()}))try{await v({anomalyId:e._id,status:`resolved`}),_.success(Ive(),e.kind)}catch(e){_.error(zve(),e)}}async function T(e){try{await v({anomalyId:e._id,status:`acknowledged`}),_.success(Hve(),e.kind)}catch(e){_.error(Gve(),e)}}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[Jve(),` `,(0,I.jsx)(`strong`,{children:Zve()}),` `,eye(),` `,(0,I.jsx)(`strong`,{children:rye()}),` `,oye(),` `,(0,I.jsx)(`strong`,{children:lye()}),` `,fye(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:hye()})]}),(0,I.jsxs)(q5,{q:n,onQChange:d,searchPlaceholder:vye(),timeRange:c,onTimeRangeChange:h,onReset:C,canReset:S,children:[(0,I.jsxs)(M3,{value:r,onValueChange:f,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-36`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:q7,children:xye()}),Y8e.map(e=>(0,I.jsx)(Q,{value:e.value,children:X8e(e.value)},e.value))]})]}),(0,I.jsxs)(M3,{value:i,onValueChange:p,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-36`,children:(0,I.jsx)(N3,{placeholder:t$()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:q7,children:Eye()}),Z8e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(M3,{value:o,onValueChange:s,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-32`,children:(0,I.jsx)(N3,{placeholder:n$()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:q7,children:jye()}),Q8e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(M3,{value:a,onValueChange:m,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-36`,children:(0,I.jsx)(N3,{placeholder:r$()})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:q7,children:Iye()}),x.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]})]}),(0,I.jsx)(I5,{title:zye(),rows:b,emptyHint:r===`open`?Hye():Gye(),rowActions:e=>y&&e.status===`open`?[{label:Jye(),onSelect:()=>void w(e)},{label:Zye(),onSelect:()=>void T(e)}]:[],columns:[{header:ebe(),cell:e=>(0,I.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:r$(),cell:e=>(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind})},{header:t$(),cell:e=>(0,I.jsx)(i5e,{severity:e.severity})},{header:rbe(),cell:e=>(0,I.jsx)(a5e,{status:e.status})},{header:n$(),cell:e=>(0,I.jsx)($,{variant:`outline`,children:e.source})},{header:obe(),cell:e=>(0,I.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message})},{header:lbe(),cell:e=>(0,I.jsx)(r5e,{row:e})},{header:fbe(),cell:e=>e.correlationId?(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:o5e(e.correlationId)}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]})]})}function n5e(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function r5e({row:e}){let t=ss(),n=n5e(e);if(!n.dominantCode)return(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=K7(n.dominantCode),i=n.sampleCorrelationId;return(0,I.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,I.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,I.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,I.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,I.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,hbe()]}):null]})}function i5e({severity:e}){return(0,I.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function a5e({status:e}){return e===`open`?(0,I.jsx)($,{variant:`destructive`,children:vbe()}):e===`acknowledged`?(0,I.jsx)($,{variant:`secondary`,children:xbe()}):(0,I.jsx)($,{variant:`outline`,children:wbe()})}function o5e(e){return e.length>8?e.slice(0,8):e}function s5e(){let e=P(V.integrations.status.status,{}),t=F(V.admin.setIntegrationConfig),[n,r]=(0,N.useState)(null);if((0,N.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Pq()});let i=n,a=(e,t,n)=>r({...i,[e]:{...i[e],[t]:n}}),o=(e,n)=>void t({[e]:n});return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[Lq(),` `,(0,I.jsx)(`strong`,{children:Bq()}),` `,Uq()]}),(0,I.jsxs)(Y7,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,I.jsx)($,{variant:`secondary`,children:Kq()}):(0,I.jsx)($,{variant:`outline`,children:Yq()}):(0,I.jsx)($,{variant:`outline`,children:Qq()}),note:iJ(),children:[(0,I.jsx)(X7,{label:uJ(),children:(0,I.jsx)(I1,{value:i.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>a(`langfuse`,`host`,e.target.value),onBlur:()=>o(`langfuse`,{host:i.langfuse.host??``})})}),(0,I.jsx)(Z7,{label:SJ(),checked:i.langfuse.enabled??!0,onChange:e=>{a(`langfuse`,`enabled`,e),o(`langfuse`,{enabled:e})}})]}),(0,I.jsxs)(Y7,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,I.jsx)($,{variant:`secondary`,children:Kq()}):(0,I.jsx)($,{variant:`outline`,children:Yq()}):(0,I.jsx)($,{variant:`outline`,children:Qq()}),note:sJ(),children:[(0,I.jsx)(X7,{label:pJ(),children:(0,I.jsx)(I1,{value:i.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>a(`opik`,`baseUrl`,e.target.value),onBlur:()=>o(`opik`,{baseUrl:i.opik.baseUrl??``})})}),(0,I.jsx)(X7,{label:gJ(),children:(0,I.jsx)(I1,{value:i.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||yJ(),onChange:e=>a(`opik`,`workspace`,e.target.value),onBlur:()=>o(`opik`,{workspace:i.opik.workspace??``})})}),(0,I.jsx)(Z7,{label:SJ(),checked:i.opik.enabled??!0,onChange:e=>{a(`opik`,`enabled`,e),o(`opik`,{enabled:e})}})]}),(0,I.jsxs)(Y7,{title:TJ(),status:(0,I.jsx)($,{variant:`outline`,children:tJ()}),note:OJ(),children:[(0,I.jsx)(X7,{label:jJ(),children:(0,I.jsx)(Q7,{value:i.tts.auto??`off`,options:[[`off`,PJ()],[`always`,LJ()],[`inbound`,BJ()],[`tagged`,UJ()]],onChange:e=>{a(`tts`,`auto`,e),o(`tts`,{auto:e})}})}),(0,I.jsx)(X7,{label:KJ(),children:(0,I.jsx)(Q7,{value:i.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,YJ()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{a(`tts`,`provider`,e),o(`tts`,{provider:e})}})}),(0,I.jsx)(X7,{label:QJ(),children:(0,I.jsx)(I1,{value:i.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>a(`tts`,`model`,e.target.value),onBlur:()=>o(`tts`,{model:i.tts.model??``})})}),(0,I.jsx)(X7,{label:tY(),children:(0,I.jsx)(I1,{value:i.tts.voice??``,placeholder:iY(),onChange:e=>a(`tts`,`voice`,e.target.value),onBlur:()=>o(`tts`,{voice:i.tts.voice??``})})})]}),(0,I.jsxs)(Y7,{title:sY(),status:(0,I.jsx)($,{variant:`outline`,children:tJ()}),note:e.secrets.openai?uY():pY(),children:[(0,I.jsx)(Z7,{label:gY(),checked:i.talk.enabled??!1,onChange:e=>{a(`talk`,`enabled`,e),o(`talk`,{enabled:e})}}),(0,I.jsx)(X7,{label:yY(),children:(0,I.jsx)(Q7,{value:i.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{a(`talk`,`realtimeProvider`,e),o(`talk`,{realtimeProvider:e})}})}),(0,I.jsx)(X7,{label:SY(),children:(0,I.jsx)(I1,{value:i.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>a(`talk`,`realtimeModel`,e.target.value),onBlur:()=>o(`talk`,{realtimeModel:i.talk.realtimeModel??``})})}),(0,I.jsx)(X7,{label:tY(),children:(0,I.jsx)(I1,{value:i.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>a(`talk`,`voice`,e.target.value),onBlur:()=>o(`talk`,{voice:i.talk.voice??``})})}),(0,I.jsx)(X7,{label:TY(),children:(0,I.jsx)(Q7,{value:i.talk.transport??`webrtc`,options:[[`webrtc`,OY()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{a(`talk`,`transport`,e),o(`talk`,{transport:e})}})}),(0,I.jsx)(X7,{label:jY(),children:(0,I.jsx)(I1,{value:i.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>a(`talk`,`speechLocale`,e.target.value),onBlur:()=>o(`talk`,{speechLocale:i.talk.speechLocale??``})})}),(0,I.jsx)(Z7,{label:PY(),checked:i.talk.interruptOnSpeech??!0,onChange:e=>{a(`talk`,`interruptOnSpeech`,e),o(`talk`,{interruptOnSpeech:e})}})]}),(0,I.jsxs)(`section`,{className:`oc-int__section`,children:[(0,I.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,I.jsx)(`h3`,{className:`oc-uipa__h`,children:LY()}),(0,I.jsx)($,{variant:`outline`,children:BY()})]}),(0,I.jsxs)(`p`,{className:`oc-uipa__note`,children:[UY(),(0,I.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,I.jsx)(I5,{title:KY(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:YY(),columns:[{header:QY(),cell:e=>(0,I.jsx)($,{variant:`secondary`,children:e.vendor})},{header:tX(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`},{header:iX(),cell:e=>String(e.failureCount)},{header:sX(),cell:e=>e.lastErrorStatus??`—`},{header:uX(),cell:e=>e.lastError??`—`}]})]})}function Y7({title:e,status:t,note:n,children:r}){return(0,I.jsxs)(`section`,{className:`oc-int__section`,children:[(0,I.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,I.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,I.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,I.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function X7({label:e,children:t}){return(0,I.jsxs)(`label`,{className:`oc-int__field`,children:[(0,I.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Z7({label:e,checked:t,onChange:n}){return(0,I.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,I.jsx)(k5,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,I.jsx)(`span`,{children:e})]})}function Q7({value:e,options:t,onChange:n}){return(0,I.jsxs)(M3,{value:e,onValueChange:n,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-full`,children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:t.map(([e,t])=>(0,I.jsx)(Q,{value:e,children:t},e))})]})}var c5e={altered_words:()=>pX(),incorrect:()=>gX(),incoherence:()=>yX(),formatting:()=>SX(),latency:()=>TX(),api_error:()=>OX(),other:()=>jX()},$7=e=>c5e[e]?.()??e;function e9({matches:e,sourceWasOpen:t}){return t?e===!0?(0,I.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:LX()}):e===!1?(0,I.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:BX()}):(0,I.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,I.jsx)(`span`,{className:`oc-fbadmin__pill`,children:PX()})}function l5e({data:e}){let t=e.snapshot,n=F(V.feedback.respondToFeedback),[r,i]=(0,N.useState)(e.thread),[a,o]=(0,N.useState)(``),[s,c]=(0,N.useState)(!1);async function l(){let t=a.trim();if(!(!t||s)){c(!0);try{await n({feedbackId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),o(``)}finally{c(!1)}}}let u=[];try{u=t.contextJson?JSON.parse(t.contextJson):[]}catch{u=[]}return(0,I.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,I.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,I.jsx)(e9,{matches:t.displayedMatchesStored,sourceWasOpen:t.clientInfo?.sourceWasOpen??!1}),(0,I.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[$7(e.category),` · `,t.messageRole,t.isRegeneration?` · ${UX()}`:``,t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})]}),e.comment?(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:KX()}),(0,I.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:YX()}),r.length>0?(0,I.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,I.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,I.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?QX():tZ()}),(0,I.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,I.jsx)(`p`,{className:`oc-fbadmin__meta`,children:iZ()}),(0,I.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:sZ(),value:a,maxLength:2e3,rows:3,onChange:e=>o(e.target.value.slice(0,2e3))}),(0,I.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,I.jsx)(X,{size:`sm`,onClick:()=>void l(),disabled:!a.trim()||s,children:s?uZ():pZ()})})]}),(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:gZ()}),(0,I.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.messageText||yZ()})]}),t.clientInfo?.sourceWasOpen&&t.displayedText!==void 0?(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:SZ()}),(0,I.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.displayedText||yZ()})]}):null,t.promptText?(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:TZ()}),(0,I.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.promptText})]}):null,u.length>0?(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:OZ({count:t.contextCount??u.length,truncated:t.contextTruncated?jZ():``})}),(0,I.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:u.map((e,t)=>(0,I.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,I.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,I.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,t.outboxAvailable?(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:PZ()}),(0,I.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[t.outboxText??``,t.outboxStatus?`\n[status: ${t.outboxStatus}]`:``]})]}):null,t.clientInfo?.extensionsDetected&&t.clientInfo.extensionsDetected.length>0?(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:LZ()}),(0,I.jsx)(`div`,{className:`oc-fbadmin__row`,children:t.clientInfo.extensionsDetected.map(e=>(0,I.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:BZ()}),(0,I.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[t.clientInfo?.language,t.clientInfo?.timezone,t.clientInfo?.theme?UZ({theme:t.clientInfo.theme}):null,t.runId?`run ${t.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,t.clientInfo?.plugins&&t.clientInfo.plugins.length>0?(0,I.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[KZ(),` `,t.clientInfo.plugins.join(`, `),(0,I.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,YZ()]})]}):null,t.clientInfo?.userAgent?(0,I.jsx)(`span`,{className:`oc-fbadmin__ua`,children:t.clientInfo.userAgent}):null]})]})]})}function u5e(){let e=P(V.feedback.listForAdmin,{}),t=F(V.feedback.readSnapshot),n=F(V.feedback.deleteFeedback),r=$1(),[i,a]=(0,N.useState)(null),[o,s]=(0,N.useState)({});async function c(e){if(i===e._id){a(null);return}if(!o[e._id]){let n=await t({feedbackId:e._id});s(t=>({...t,[e._id]:n}))}a(e._id)}async function l(e){await r({title:Tde(),description:Ode(),confirmLabel:jde(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&a(null))}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[QZ(),` `,(0,I.jsx)(`strong`,{children:tQ()}),` `,iQ()]}),(0,I.jsx)(I5,{title:sQ(),rows:e,emptyHint:uQ(),isExpanded:e=>i===e._id&&!!o[e._id],renderExpanded:e=>o[e._id]?(0,I.jsx)(l5e,{data:o[e._id]}):null,columns:[{header:pQ(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`)},{header:gQ(),cell:e=>$7(e.category)},{header:yQ(),cell:e=>e.messageRole===`user`?SQ():TQ()},{header:OQ(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${jQ({operator:e.realOperatorEmail})}`:``)},{header:PQ(),cell:e=>(0,I.jsx)(e9,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen})},{header:LQ(),cell:e=>e.hasComment?`✎`:`—`},{header:BQ(),cell:e=>e.answered?(0,I.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:UQ()}):(0,I.jsx)(`span`,{className:`oc-fbadmin__pill`,children:KQ()})}],rowActions:e=>[{label:i===e._id?gde():yde(),onSelect:()=>void c(e)},{label:Sde(),onSelect:()=>void l(e),variant:`destructive`}]})]})}var t9=`all`;function n9(e){switch(e){case`image`:return Sj();case`audio`:return Tj();case`video`:return Oj();case`pdf`:return jj();case`document`:return Pj();case`archive`:return Lj();default:return Bj()}}function d5e(){let[e,t]=(0,N.useState)(t9),[n,r]=(0,N.useState)(t9),[i,a]=(0,N.useState)(t9),[o,s]=(0,N.useState)(t9),[c,l]=(0,N.useState)(null),u=F(V.files.softDelete),d=n0();function f(){t(t9),r(t9),a(t9),s(t9)}async function p(){let e=c;if(l(null),e)try{await u({fileId:e.id}),d.success(yM())}catch(e){d.error(SM(),e)}}let m=P(V.files.listMine,{direction:e===t9?void 0:e,chatId:n===t9?void 0:n,instanceName:i===t9?void 0:i,category:o===t9?void 0:o}),h=(0,N.useMemo)(()=>new Intl.DateTimeFormat(q(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(m===void 0)return(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()});let{files:g,facets:_,truncated:v,cap:y}=m,b=e!==t9||n!==t9||i!==t9||o!==t9;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:UA()}),(0,I.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,I.jsxs)(M3,{value:e,onValueChange:t,children:[(0,I.jsx)(P3,{size:`sm`,"aria-label":KA(),children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:t9,children:YA()}),(0,I.jsx)(Q,{value:`inbound`,children:QA()}),(0,I.jsx)(Q,{value:`outbound`,children:tj()})]})]}),(0,I.jsxs)(M3,{value:n,onValueChange:r,children:[(0,I.jsx)(P3,{size:`sm`,"aria-label":ij(),children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:t9,children:sj()}),_.chats.map(e=>(0,I.jsx)(Q,{value:e.id,children:e.title},e.id))]})]}),_.multiProvider?(0,I.jsxs)(M3,{value:i,onValueChange:a,children:[(0,I.jsx)(P3,{size:`sm`,"aria-label":uj(),children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:t9,children:pj()}),_.instances.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}):null,(0,I.jsxs)(M3,{value:o,onValueChange:s,children:[(0,I.jsx)(P3,{size:`sm`,"aria-label":gj(),children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:t9,children:yj()}),_.categories.map(e=>(0,I.jsx)(Q,{value:e,children:n9(e)},e))]})]}),b?(0,I.jsxs)(X,{variant:`ghost`,size:`sm`,onClick:f,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,I.jsx)(km,{size:14,"aria-hidden":!0}),uM()]}):null]}),g.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:b?LM():PM()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(A5,{children:[(0,I.jsx)(j5,{children:(0,I.jsxs)(N5,{children:[(0,I.jsx)(P5,{children:Uj()}),(0,I.jsx)(P5,{children:Kj()}),(0,I.jsx)(P5,{children:Yj()}),(0,I.jsx)(P5,{children:Qj()}),(0,I.jsx)(P5,{children:tM()}),(0,I.jsx)(P5,{className:`text-right`,children:iM()})]})}),(0,I.jsx)(M5,{children:g.map(e=>(0,I.jsxs)(N5,{children:[(0,I.jsx)(F5,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,I.jsx)(F5,{title:e.mimeType,children:n9(e.category)}),(0,I.jsx)(F5,{children:(0,I.jsx)($,{variant:`secondary`,children:e.direction===`inbound`?QA():tj()})}),(0,I.jsx)(F5,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,I.jsx)(F5,{className:`whitespace-nowrap text-muted-foreground`,children:h.format(e.createdAt)}),(0,I.jsx)(F5,{className:`text-right`,children:(0,I.jsxs)(S1,{children:[(0,I.jsx)(C1,{asChild:!0,children:(0,I.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":pM(),children:(0,I.jsx)(ym,{size:16})})}),(0,I.jsxs)(w1,{align:`end`,children:[e.url?(0,I.jsx)(T1,{asChild:!0,children:(0,I.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,I.jsx)(vm,{size:14}),sM()]})}):(0,I.jsxs)(T1,{disabled:!0,children:[(0,I.jsx)(vm,{size:14}),jM()]}),(0,I.jsxs)(T1,{variant:`destructive`,onSelect:()=>l({id:e._id,filename:e.filename}),children:[(0,I.jsx)(Pm,{size:14}),gM()]})]})]})})]},e._id))})]}),v?(0,I.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:BM({cap:y})}):null]}),(0,I.jsx)(L1,{open:c!==null,onOpenChange:e=>!e&&l(null),children:(0,I.jsxs)(R1,{children:[(0,I.jsxs)(z1,{children:[(0,I.jsx)(V1,{children:TM()}),(0,I.jsx)(H1,{children:OM()})]}),(0,I.jsxs)(B1,{children:[(0,I.jsx)(W1,{children:QW()}),(0,I.jsx)(U1,{onClick:()=>void p(),children:gM()})]})]})})]})}var r9=2e4,i9=6e4;function f5e(e){return typeof e!=`number`||e<=0?0:Math.round(e/r9*100)}function p5e(e){return e<=0?0:Math.round(e/i9*100)}function a9(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function o9(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var s9=3;function m5e(e,t){let n=new Map;for(let t of e.split(`
|
|
163
163
|
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
164
|
-
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<s9&&a.push(e)):t>0&&(i+=t,o.length<s9&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function h5e(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var c9=e=>typeof e==`string`?e:null;function l9(e){return/^\d+\.\d+\.\d+$/.test(e)?e.split(`.`).map(e=>Number.parseInt(e,10)):null}function g5e(e,t){let n=l9(e),r=l9(t);if(n===null||r===null)return null;for(let e=0;e<3;e++){let t=n[e]-r[e];if(t!==0)return t}return 0}function _5e(e,t){if(e===null||t===null)return!1;let n=g5e(t,e.min);return n!==null&&n>=0}function u9(e,t){let n={range:null,validatedVersions:[]};if(typeof e!=`object`||!e)return n;let r=e.providers;if(typeof r!=`object`||!r)return n;let i=r[t];if(typeof i!=`object`||!i)return n;let a=i,o=null;if(typeof a.supportedRange==`object`&&a.supportedRange!==null){let e=a.supportedRange,t=c9(e.min),n=c9(e.maxValidated);t!==null&&n!==null&&(o={min:t,maxValidated:n})}let s=Array.isArray(a.validatedVersions)?a.validatedVersions.filter(e=>typeof e==`string`):[];return{range:o,validatedVersions:s}}function d9(e,t){if(e.gatewayVersion===null)return`unknown`;if(e.versionBeyondValidated)return`beyond`;let{range:n}=u9(t,e.provider);return _5e(n,e.gatewayVersion)?`supported`:`unknown`}function f9(e){return e===`supported`?Kqe():e===`beyond`?Yqe():Qqe()}function p9(e){return e??M$()}function m9(e){return e===null?sJe():iJe({version:e})}function v5e(e,t){if(typeof e!=`object`||!e)return!1;let n=e.providers;return typeof n!=`object`||!n?!1:t in n}var h9=e=>`${e.instanceName}::${e.agentId}`;function y5e(){let e=P(V.me.getMe,{host:YO}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=P(V.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,N.useState)(null);(0,N.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=P(V.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=P(V.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),c=(0,N.useMemo)(()=>{if(e!==void 0){if(t)return i===null||o===void 0?r!==void 0&&r.length===0?[]:void 0:o.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(s!==void 0)return s.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,o,r,s]),[l,u]=(0,N.useState)(null);(0,N.useEffect)(()=>{!c||c.length===0||(!l||!c.some(e=>h9(e)===l))&&u(h9(c[0]))},[c,l]);let d=c?.find(e=>h9(e)===l)??null,f=$n(V.agentFiles.listAgentFiles),[p,m]=(0,N.useState)({status:`idle`}),h=d?.instanceName??null,g=d?.agentId??null,_=P(V.compat.forInstance,n&&h!==null?{instanceName:h}:`skip`),v=n&&h!==null?c4e(_,`agentFiles`):null,y=v===null?!1:v===`loading`?null:v.blocked,b=(0,N.useCallback)(async()=>{if(!(h===null||g===null)){m({status:`loading`});try{m({status:`done`,files:(await f({instanceName:h,agentId:g})).files})}catch{m({status:`error`})}}},[f,h,g]);(0,N.useEffect)(()=>{y===!1&&b()},[b,y]);let[x,S]=(0,N.useState)(null),C=q(),w=(0,N.useMemo)(()=>new Intl.NumberFormat(C,{maximumFractionDigits:0}),[C]);return e===void 0||c===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):(0,I.jsxs)(`div`,{className:`oc-afiles`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:HWe()}),(0,I.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,I.jsxs)(M3,{value:i??``,onValueChange:e=>a(e),children:[(0,I.jsx)(P3,{size:`sm`,"aria-label":GWe(),children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:(r??[]).map(e=>(0,I.jsx)(Q,{value:e.name,children:e.name},e.name))})]}):null,c.length>0?(0,I.jsxs)(M3,{value:l??``,onValueChange:e=>u(e),children:[(0,I.jsx)(P3,{size:`sm`,"aria-label":JWe(),children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:c.map(e=>(0,I.jsx)(Q,{value:h9(e),children:e.label},h9(e)))})]}):(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:ZWe()})]}),d===null?null:v===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):v!==null&&v.blocked?(0,I.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,I.jsx)(Fm,{size:14,"aria-hidden":!0}),` `,m9(v.gatewayVersion)]}):p.status===`loading`||p.status===`idle`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):p.status===`error`?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[rGe(),` `,(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:O$()})]}):p.files.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:eGe()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`oc-afiles__list`,children:p.files.map(e=>{let n=f5e(e.size),r=n>=80;return(0,I.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,I.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,I.jsx)($,{variant:`outline`,children:oGe()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`oc-afiles__size`,children:lGe({size:a9(e.size,C)})}),(0,I.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,I.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,I.jsx)(`span`,{className:`oc-afiles__pct`,children:fGe({pct:w.format(n)})}),r?(0,I.jsx)(Fm,{size:14,className:`oc-afiles__warn`,"aria-label":hGe()}):(0,I.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,I.jsx)(X,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>S(e),children:t?xGe():wGe()})]},e.name)})}),(0,I.jsx)(`p`,{className:`oc-afiles__budget`,children:vGe({used:a9(o9(p.files),C),total:a9(i9,C),pct:w.format(p5e(o9(p.files)))})})]}),x&&d?(0,I.jsx)(b5e,{instanceName:d.instanceName,agentId:d.agentId,name:x.name,isAdmin:t,onClose:()=>S(null),onSaved:()=>void b()}):null]})}function b5e({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=$n(V.agentFiles.getAgentFile),s=$n(V.agentFiles.setAgentFile),c=n0(),[l,u]=(0,N.useState)(null),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),[h,g]=(0,N.useState)(!1),[_,v]=(0,N.useState)(!1),[y,b]=(0,N.useState)(!1),[x,S]=(0,N.useState)(!1),C=(0,N.useCallback)(async r=>{f(!1);try{let i=await o({instanceName:e,agentId:t,name:n});u({content:i.content,updatedAtMs:i.updatedAtMs}),r||m(i.content),b(!1)}catch{f(!0)}},[o,e,t,n]);(0,N.useEffect)(()=>{C(!1)},[C]);async function w(){if(l!==null){v(!0),S(!1);try{await s({instanceName:e,agentId:t,name:n,content:p,baseUpdatedAtMs:l.updatedAtMs??void 0}),c.success(WGe({name:n})),a(),await C(!1)}catch(e){h5e(e)?b(!0):S(!0)}finally{v(!1)}}}let T=l!==null&&p!==l.content,E=(0,N.useMemo)(()=>l===null?null:m5e(l.content,p),[l,p]),D=p.length>r9,O=q(),ee=(0,N.useMemo)(()=>new Intl.NumberFormat(O),[O]);return(0,I.jsx)(G1,{open:!0,onOpenChange:e=>!e&&i(),children:(0,I.jsxs)(K1,{className:`oc-afiles__editor`,children:[(0,I.jsxs)(q1,{children:[(0,I.jsx)(Y1,{children:j$({name:n})}),(0,I.jsxs)(X1,{children:[kGe({agent:t,instance:e}),r?null:(0,I.jsxs)(I.Fragment,{children:[` · `,MGe()]})]})]}),d?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[XGe(),` `,(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void C(!1),children:O$()})]}):l===null?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`textarea`,{className:`oc-afiles__source`,value:p,readOnly:!r,spellCheck:!1,onChange:e=>m(e.target.value),"aria-label":j$({name:n})}),(0,I.jsx)(`p`,{className:`oc-afiles__hint`,children:FGe()}),y?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[$Ge(),` `,(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void C(!0),children:nKe()})]}):null,x?(0,I.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:qGe()}):null,(0,I.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,I.jsx)(`span`,{className:`oc-afiles__count${D?` is-over`:``}`,children:RGe({count:ee.format(p.length),max:ee.format(r9)})}),r?(0,I.jsx)(X,{size:`sm`,disabled:!T||_||y,onClick:()=>g(!0),children:_?D$():VGe()}):null]})]}),(0,I.jsx)(L1,{open:h,onOpenChange:g,children:(0,I.jsxs)(R1,{children:[(0,I.jsxs)(z1,{children:[(0,I.jsx)(V1,{children:aKe({name:n})}),(0,I.jsx)(H1,{children:cKe({agent:t})})]}),E?(0,I.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,I.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:dKe({added:E.added,removed:E.removed})}),E.sampleAdded.length>0?(0,I.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,I.jsx)(`span`,{className:`oc-afiles__diff-label`,children:mKe()}),E.sampleAdded.map((e,t)=>(0,I.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,E.sampleRemoved.length>0?(0,I.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,I.jsx)(`span`,{className:`oc-afiles__diff-label`,children:_Ke()}),E.sampleRemoved.map((e,t)=>(0,I.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,I.jsxs)(B1,{children:[(0,I.jsx)(W1,{children:QW()}),(0,I.jsx)(U1,{onClick:()=>void w(),children:bKe()})]})]})})]})})}var g9=[{id:`messages`,label:()=>gL()},{id:`composer`,label:()=>yL()},{id:`sidebar`,label:()=>SL()},{id:`other`,label:()=>TL()}],_9={showSource:{category:`messages`,label:()=>OL(),help:()=>jL()},showReport:{category:`messages`,label:()=>PL(),help:()=>LL()},copyAssistant:{category:`messages`,label:()=>BL()},copyUser:{category:`messages`,label:()=>UL()},showDelete:{category:`messages`,label:()=>KL()},showTools:{category:`messages`,label:()=>YL(),help:()=>QL()},voiceInput:{category:`composer`,label:()=>tR(),help:()=>iR()},showChatAge:{category:`sidebar`,label:()=>sR(),help:()=>uR()},showChatProvider:{category:`sidebar`,label:()=>pR(),help:()=>gR()}};function v9(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function x5e(e,t){let n=v9(t.trim()),r=new Map(g9.map(e=>[e.id,e.label()])),i=new Map(g9.map(e=>[e.id,[]]));for(let t of e){let e=_9[t],a=e?.category??`other`;n&&!v9(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return g9.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var S5e=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],C5e={voiceInput:`voiceInput`};function w5e(e){return S5e.includes(e)}function y9(e){return e===`admin`}function T5e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function E5e(e){return e===`on`?!0:e===`off`?!1:null}function D5e(e){return w5e(e)?C5e[e]:void 0}var O5e={voiceInput:()=>YR()};function k5e({prefKey:e,ui:t}){let n=F(V.admin.setUiPrefDefault),r=F(V.admin.setFeatureEnabled),i=D5e(e),a=i?O5e[e]?.():void 0;return(0,I.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,I.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,I.jsx)(`span`,{className:`oc-prefs__gov-label`,children:LR()}),(0,I.jsxs)(M3,{value:T5e(t.defaults[e]),onValueChange:t=>void n({key:e,value:E5e(t)}),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-36`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:`on`,children:tz()}),(0,I.jsx)(Q,{value:`off`,children:iz()}),(0,I.jsx)(Q,{value:`inherit`,children:sz()})]})]}),i?(0,I.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,I.jsx)(k5,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":BR()}),BR()]}):null]}),a?(0,I.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function A5e(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(!1),i=P(V.me.getMe,{host:YO}),a=i?.ui,o=y9(i?.role)&&n,s=F(V.me.setUiPref).withOptimisticUpdate(r0),c=(0,N.useMemo)(()=>a?x5e(Object.keys(a.effective),e):[],[a,e]);return a?(0,I.jsxs)(`div`,{className:`oc-prefs-panel`,children:[y9(i?.role)?(0,I.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,I.jsx)(k5,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":PR()}),PR()]}):null,o?(0,I.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,I.jsx)(`p`,{children:UR()}),(0,I.jsx)(`p`,{children:KR()}),(0,I.jsx)(`p`,{children:QR()})]}):null,(0,I.jsx)(I1,{value:e,onChange:e=>t(e.target.value),placeholder:yR(),"aria-label":yR(),className:`mb-2`}),c.length===0?(0,I.jsx)(`div`,{className:`oc-prefs__empty`,children:SR()}):(0,I.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,I.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,I.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=_9[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,I.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!i?` is-overridden`:``}`,children:[(0,I.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,I.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,I.jsx)(`span`,{className:`oc-prefs__lock`,children:TR()}):l?null:(0,I.jsx)(`span`,{className:`oc-prefs__def`,children:OR()})]}),r?(0,I.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,I.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,I.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:jR()}):null,(0,I.jsx)(k5,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t===!0}),"aria-label":n})]}),o?(0,I.jsx)(k5e,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,I.jsx)(`div`,{className:`oc-prefs__empty`,children:jk()})}function j5e(){let e=P(V.me.getMe,{host:YO}),t=F(V.me.setLocale),n=F(V.me.setMyName),r=n0(),i=e?.locale??`default`,a=e?.name??``,[o,s]=(0,N.useState)(null),c=o??a,l=c.trim()!==a.trim();async function u(){try{await n({name:c}),s(null),r.success(pA())}catch(e){r.error(gA(),e)}}return(0,I.jsxs)(`div`,{className:`oc-appearance`,children:[(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:tA()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:iA()})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(I1,{className:`max-w-xs`,value:c,maxLength:120,placeholder:sA(),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l&&(e.preventDefault(),u())}}),(0,I.jsx)(X,{size:`sm`,disabled:!l,onClick:()=>void u(),children:XQ()})]}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:uA()})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:yA()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:SA()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,I.jsx)(X,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?PA():e===`en`?LA():Kk()},e))}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:TA()})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:OA()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:jA()})]}),(0,I.jsx)(A5e,{})]})]})}var M5e=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N5e(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}function P5e(){let e=$n(V.agentFiles.getChatDefaults),t=$n(V.agentFiles.setChatDefaults),n=n0(),[r,i]=(0,N.useState)({status:`loading`}),[a,o]=(0,N.useState)({thinkingDefault:null,fastModeDefault:null}),[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(!1),d=l4e(P(V.compat.getBridgeCompat,{}),`configDefaults`),f=d===`loading`?null:d.blocked,p=(0,N.useCallback)(async()=>{i({status:`loading`});try{let t=N5e(await e({}));i({status:`done`,current:t}),o(t)}catch{i({status:`error`})}},[e]);(0,N.useEffect)(()=>{f===!1&&p()},[p,f]);let m=r.status===`done`?r.current:null,h=m!==null&&a.thinkingDefault!==null&&a.thinkingDefault!==m.thinkingDefault,g=m!==null&&a.fastModeDefault!==null&&a.fastModeDefault!==m.fastModeDefault,_=h||g;async function v(){u(!0);try{await t({...h?{thinkingDefault:a.thinkingDefault}:{},...g?{fastModeDefault:a.fastModeDefault}:{}}),n.success(qKe()),await p()}catch(e){n.error(XKe(),e)}finally{u(!1)}}let y=(0,N.useMemo)(()=>M5e.map(e=>({id:e,label:V3(e)})),[]),b=(0,N.useMemo)(()=>[{id:`fast`,label:k$()},{id:`standard`,label:A$()}],[]);return(0,I.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:EKe()}),d===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):d.blocked?(0,I.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,I.jsx)(Fm,{size:14,"aria-hidden":!0}),` `,m9(d.gatewayVersion)]}):r.status===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):r.status===`error`?(0,I.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[VKe(),` `,(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void p(),children:O$()})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,I.jsx)(`span`,{className:`oc-cdefaults__label`,children:kKe()}),(0,I.jsx)(K3,{options:y,value:a.thinkingDefault,onChange:e=>o({...a,thinkingDefault:e}),disabled:l}),(0,I.jsx)(`p`,{className:`oc-cdefaults__help`,children:MKe()})]}),(0,I.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,I.jsx)(`span`,{className:`oc-cdefaults__label`,children:FKe()}),(0,I.jsx)(K3,{options:b,value:a.fastModeDefault===null?null:a.fastModeDefault?`fast`:`standard`,onChange:e=>o({...a,fastModeDefault:e===`fast`}),disabled:l}),(0,I.jsx)(`p`,{className:`oc-cdefaults__help`,children:RKe()})]}),(0,I.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,I.jsx)(X,{size:`sm`,disabled:!_||l,onClick:()=>c(!0),children:l?D$():WKe()})}),(0,I.jsx)(`p`,{className:`oc-cdefaults__note`,children:$Ke()})]}),(0,I.jsx)(L1,{open:s,onOpenChange:c,children:(0,I.jsxs)(R1,{children:[(0,I.jsxs)(z1,{children:[(0,I.jsx)(V1,{children:nqe()}),(0,I.jsx)(H1,{children:aqe()})]}),(0,I.jsxs)(B1,{children:[(0,I.jsx)(W1,{children:QW()}),(0,I.jsx)(U1,{onClick:()=>void v(),children:cqe()})]})]})})]})}function F5e(e){return e===`user`?wze():y$({group:e.group})}function I5e(e){return e===`common`?kze():e===`owner`?Mze():y$({group:e.group})}function L5e(e){return e.name||e.email||e.userId.slice(0,8)}function R5e(){let e=P(V.admin.listUsers,{}),[t,n]=(0,N.useState)(``),r=P(V.introspect.introspectUser,t?{userId:t}:`skip`);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:XRe()}),(0,I.jsxs)(M3,{value:t,onValueChange:n,children:[(0,I.jsx)(P3,{size:`sm`,"aria-label":_$(),children:(0,I.jsx)(N3,{placeholder:_$()})}),(0,I.jsx)(F3,{children:(e??[]).map(e=>(0,I.jsx)(Q,{value:e.userId,children:L5e(e)},e._id))})]}),t===``?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:tze()}):r===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):(0,I.jsxs)(`div`,{className:`oc-introspect`,children:[(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:ize()}),(0,I.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,I.jsx)(`strong`,{children:r.user.label}),(0,I.jsx)($,{variant:`secondary`,children:r.role})]})]}),(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:sze()}),r.groups.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:v$()}):(0,I.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,I.jsx)($,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:uze()}),r.agents.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:v$()}):(0,I.jsx)(`ul`,{className:`oc-introspect__list`,children:r.agents.map(e=>(0,I.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,I.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,I.jsx)($,{variant:`default`,children:xze()}):null,(0,I.jsx)($,{variant:`outline`,children:F5e(e.via)}),(0,I.jsx)($,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:pze()}),r.charts.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:v$()}):(0,I.jsx)(`ul`,{className:`oc-introspect__list`,children:r.charts.map(e=>(0,I.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,I.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,I.jsx)($,{variant:`outline`,children:I5e(e.via)})]},e.key))})]}),(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:gze()}),r.permissions.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:v$()}):(0,I.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,I.jsx)($,{variant:`secondary`,children:e},e))})]})]})]})}function b9({delayDuration:e=0,...t}){return(0,I.jsx)(Xle,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function x9({...e}){return(0,I.jsx)(Zle,{"data-slot":`tooltip`,...e})}function S9({...e}){return(0,I.jsx)(Qle,{"data-slot":`tooltip-trigger`,...e})}function C9({className:e,sideOffset:t=0,children:n,...r}){return(0,I.jsx)($le,{children:(0,I.jsxs)(eue,{"data-slot":`tooltip-content`,sideOffset:t,className:x1(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,I.jsx)(tue,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var z5e=[`gateway-http`,`shared-fs`,`off`],B5e=[`inline`,`shared-fs`];He.object({mediaMode:He.optional(He.union(He.literal(`gateway-http`),He.literal(`shared-fs`),He.literal(`off`))),inboundMediaMode:He.optional(He.union(He.literal(`inline`),He.literal(`shared-fs`))),rehydration:He.optional(He.boolean()),mediaMaxMb:He.optional(He.number()),inboundAgentMount:He.optional(He.string()),outboundAgentMount:He.optional(He.string())});var w9={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function V5e(e,t){let n={},r=r=>{(e[r]!==w9[r]||t[r]!==void 0)&&(n[r]=e[r])};return r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`),n}function T9(e){return e.filter(e=>e.state===`error`)}function H5e(e){return e.reachable&&T9(e.targets).length===0}function U5e(e){return e.state===`error`&&e.lastErrorCode!==null}function W5e(e){return!!e.lastDownstreamRejectCode}function E9(e){return e.kind??`openclaw`}function G5e(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function K5e(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,E9(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(E9(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return G5e(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>E9(e)===r)}))}function q5e(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}function J5e(){return P(V.bridgeHealth.getBridgeHealth,{})}function Y5e(){let e=J5e(),t=P(V.compat.getBridgeCompat,{}),n=P(V.me.getMe,{host:YO})?.role===`admin`,r=P(V.admin.listInstances,n?{}:`skip`),i=ss(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=K5e(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&v5e(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,I.jsxs)(`div`,{className:`oc-bridge`,children:[(0,I.jsx)(X5e,{health:e,compat:t,onSeeAnomalies:a}),(0,I.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:YDe()}),o.map(e=>(0,I.jsx)(Z5e,{providerKey:e.key,connections:e.connections,compatTargets:e.compatTargets,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0,isAdmin:n},e.key)),l?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:tJe()}):null]})}function X5e({health:e,compat:t,onSeeAnomalies:n}){let r=t&&t!==null?(0,I.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:p9(t.bridgeVersion)}),` · `,_qe(),` `,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?M$():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:l$()});if(e===null)return(0,I.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:eOe()});let i=T9(e.targets),a=!e.reachable,o=H5e(e),s=o?`ok`:`error`,c=new Date(e.checkedAt).toLocaleString(`fr-FR`),l=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,I.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${s}`,children:[(0,I.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:o?(0,I.jsx)(gm,{size:22}):a?(0,I.jsx)(Vee,{size:22}):(0,I.jsx)(Fm,{size:22})}),(0,I.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,I.jsx)(`div`,{className:`oc-bridge-card__title`,children:o?rOe():a?oOe():lOe({count:i.length})}),(0,I.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,I.jsxs)(`span`,{children:[(0,I.jsx)(Ree,{size:12,"aria-hidden":!0}),` `,fOe({time:c})]}),l?(0,I.jsx)(`span`,{children:hOe({time:l})}):null,r]}),a?(0,I.jsx)(`p`,{className:`oc-bridge-card__hint`,children:K7(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,I.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:vOe()})]})}function Z5e({providerKey:e,connections:t,compatTargets:n,instances:r,manifest:i,compatStatus:a,compatReachable:o,isAdmin:s}){let c=i?u9(i,e):null,l=n.map(e=>d9(e,i)),u=l.includes(`beyond`)?`beyond`:l.length>0&&l.every(e=>e===`supported`)?`supported`:null;return(0,I.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,I.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,I.jsx)(jm,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,I.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q5e(e)}),u?(0,I.jsx)($,{variant:u===`beyond`?`destructive`:`secondary`,children:f9(u)}):null]}),(0,I.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:xOe({count:t.length})}),t.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:wOe()}):(0,I.jsx)(`div`,{className:`oc-bridge-targets`,children:t.map(e=>(0,I.jsx)(Q5e,{t:e},e.key))}),(0,I.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:dqe()}),(0,I.jsx)($5e,{support:c,compatStatus:a,compatReachable:o,manifest:i,compatTargets:n}),s&&r.length>0?(0,I.jsx)(e7e,{instances:r}):null]})}function Q5e({t:e}){let t=U5e(e)?K7(e.lastErrorCode):null,n=W5e(e)?K7(e.lastDownstreamRejectCode):null;return(0,I.jsxs)(`div`,{className:`oc-bridge-target oc-bridge-target--${e.state}`,children:[(0,I.jsxs)(`div`,{className:`oc-bridge-target__head`,children:[(0,I.jsxs)(`code`,{className:`oc-traces__mono`,children:[e.canonical,`/`,e.agentId]}),(0,I.jsx)(i7e,{state:e.state}),(0,I.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})]}),(0,I.jsxs)(`div`,{className:`oc-bridge-target__stats`,children:[DOe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts}),e.lastOkAt?AOe({time:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):``]}),t?(0,I.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,I.jsx)(`strong`,{children:t.label}),` `,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,I.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,I.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[NOe({label:n.label}),` `,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}function $5e({support:e,compatStatus:t,compatReachable:n,manifest:r,compatTargets:i}){return t===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:l$()}):t===`nodata`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:mqe()}):(0,I.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Sqe()}),r===null?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Tqe()}):(0,I.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,I.jsx)(`span`,{className:`oc-compat__label`,children:Oqe()}),e&&e.range!==null?(0,I.jsx)(`span`,{children:jqe({min:e.range.min,max:e.range.maxValidated})}):(0,I.jsx)(`span`,{children:M$()}),e?(0,I.jsx)(r7e,{versions:e.validatedVersions}):null]}),i.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Uqe()}):(0,I.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>{let t=d9(e,r);return(0,I.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.instanceName}),(0,I.jsx)(`span`,{className:`oc-compat__provider`,children:e.provider}),(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:p9(e.gatewayVersion)}),(0,I.jsx)($,{variant:t===`supported`?`secondary`:t===`beyond`?`destructive`:`outline`,children:f9(t)})]},e.instanceName)})})]})}function e7e({instances:e}){let[t,n]=(0,N.useState)(!1);return(0,I.jsxs)(`div`,{className:`oc-bridge-provider__config${t?` is-open`:``}`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__config-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,I.jsx)(pm,{size:14,"aria-hidden":!0}):(0,I.jsx)(mm,{size:14,"aria-hidden":!0}),gEe()]}),t?(0,I.jsx)(n7e,{instances:e}):null]})}function t7e({text:e}){return(0,I.jsx)(b9,{delayDuration:150,children:(0,I.jsxs)(x9,{children:[(0,I.jsx)(S9,{asChild:!0,children:(0,I.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,I.jsx)(xee,{"aria-hidden":!0})})}),(0,I.jsx)(C9,{className:`max-w-xs text-pretty`,children:e})]})})}function D9({label:e,help:t}){return(0,I.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,I.jsx)(t7e,{text:t})]})}function O9({label:e,result:t}){return t?t.checked?(0,I.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,I.jsx)(gm,{"aria-hidden":!0}):(0,I.jsx)(Fm,{"aria-hidden":!0}),(0,I.jsxs)(`span`,{children:[e,` — `,t.ok?LDe():t.detail]})]}):(0,I.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,BDe()]}):null}function n7e({instances:e}){let t=F(V.admin.upsertInstanceConfig),n=$n(V.bridge.validateMediaPaths),r=n0(),[i,a]=(0,N.useState)(null),[o,s]=(0,N.useState)({...w9}),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(!1),[f,p]=(0,N.useState)(null),m=o.inboundMediaMode===`shared-fs`,h=o.mediaMode===`shared-fs`,g=m||h;async function _(){if(!i)return;let t=e.find(e=>e._id===i);if(t){d(!0),p(null);try{p(await n({instanceName:t.name}))}catch(e){r.error(TDe(),e)}finally{d(!1)}}}function v(t){a(t);let n=e.find(e=>e._id===t)?.config??{};s({mediaMode:n.mediaMode??w9.mediaMode,inboundMediaMode:n.inboundMediaMode??w9.inboundMediaMode,rehydration:n.rehydration??w9.rehydration,mediaMaxMb:n.mediaMaxMb??w9.mediaMaxMb,inboundAgentMount:n.inboundAgentMount??w9.inboundAgentMount,outboundAgentMount:n.outboundAgentMount??w9.outboundAgentMount}),p(null)}async function y(){if(i){l(!0);try{await t({instanceId:i,config:V5e(o,e.find(e=>e._id===i)?.config??{})})}catch(e){r.error(UEe(),e)}finally{l(!1)}}}return(0,I.jsxs)(`div`,{className:`oc-bridge-config`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:yEe()}),(0,I.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:SEe(),help:KEe()}),(0,I.jsxs)(M3,{value:i??``,onValueChange:v,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-full sm:w-72`,children:(0,I.jsx)(N3,{placeholder:TEe()})}),(0,I.jsx)(F3,{children:e.map(e=>(0,I.jsx)(Q,{value:e._id,children:e.displayName??e.name},e._id))})]})]}),i!==null&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:OEe(),help:YEe()}),(0,I.jsxs)(M3,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-full`,children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:z5e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))})]})]}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:jEe(),help:QEe()}),(0,I.jsxs)(M3,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-full`,children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:B5e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))})]})]}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:PEe(),help:tDe()}),(0,I.jsx)(I1,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),g&&(0,I.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[m&&(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:sDe(),help:uDe()}),(0,I.jsx)(I1,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),h&&(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:pDe(),help:gDe()}),(0,I.jsx)(I1,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,I.jsxs)(`label`,{className:`oc-field--row`,children:[(0,I.jsx)(k5,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,I.jsx)(D9,{label:LEe(),help:iDe()})]}),g&&f!==null&&(0,I.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,I.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,I.jsx)(Fm,{"aria-hidden":!0}),KDe({reason:f.reason??`?`})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(O9,{label:jDe(),result:f.inbound}),(0,I.jsx)(O9,{label:PDe(),result:f.outbound}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:ODe()})]}):(0,I.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,I.jsx)(Fm,{"aria-hidden":!0}),UDe()]})}),(0,I.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[g&&(0,I.jsxs)(X,{variant:`outline`,size:`sm`,onClick:()=>void _(),disabled:u,children:[u?(0,I.jsx)(Tm,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?SDe():yDe()]}),(0,I.jsx)(X,{size:`sm`,onClick:()=>void y(),disabled:c,children:BEe()})]})]})]})]})}function r7e({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,I.jsxs)(k1,{children:[(0,I.jsx)(A1,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Pqe():Lqe({count:e.length}),(0,I.jsx)(pm,{size:13,"aria-hidden":!0})]})}),(0,I.jsxs)(j1,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,I.jsx)(`p`,{className:`oc-compat__versions-title`,children:Bqe()}),(0,I.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,I.jsx)($,{variant:`secondary`,children:e},e))})]})]})}function i7e({state:e}){return e===`connected`?(0,I.jsx)($,{variant:`secondary`,children:IOe()}):e===`error`?(0,I.jsx)($,{variant:`destructive`,children:zOe()}):(0,I.jsx)($,{variant:`outline`,children:HOe()})}var k9=[{id:`personal`,label:()=>AHe(),tabs:[`preferences`,`theme`,`files`]},{id:`agents`,label:()=>NHe(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`bridge`]},{id:`access`,label:()=>IHe(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`]},{id:`observability`,label:()=>zHe(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`integrations`]}],a7e=new Map(k9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function A9(e){let t=a7e.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function o7e(e,t){return e.find(e=>A9(e)===t)}k9.flatMap(e=>[...e.tabs]);function s7e(){let e=P(V.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.known?e.available?`ok`:`error`:`idle`,n=e.known?e.available?`${cNe()}${e.checkedAt?dNe({time:new Date(e.checkedAt).toLocaleTimeString(`fr-FR`)}):``}`:mNe({reason:e.reason??`?`}):aNe();return(0,I.jsx)(b9,{delayDuration:150,children:(0,I.jsxs)(x9,{children:[(0,I.jsx)(S9,{asChild:!0,children:(0,I.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${t}`,role:`img`,"aria-label":n})}),(0,I.jsx)(C9,{children:n})]})})}var c7e={users:()=>dRe(),groups:()=>WRe(),instances:()=>mRe(),bridge:()=>_Re(),serviceAccounts:()=>bRe(),roles:()=>CRe(),traces:()=>ERe(),kpi:()=>kRe(),anomalies:()=>MRe(),files:()=>BA(),agentFiles:()=>zWe(),preferences:()=>Qk(),chatDefaults:()=>CKe(),access:()=>qRe(),integrations:()=>FRe(),theme:()=>UM(),audit:()=>RRe(),feedbacks:()=>VRe()};function j9(e){let t=new Set(s7),n=new Set,r=[];for(let i of e??[])t.has(i)&&!n.has(i)&&(r.push(i),n.add(i));for(let e of s7)n.has(e)||r.push(e);return r}function l7e(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function u7e({tab:e,active:t}){let n=c7e[e]?.()??l7[e]??e,r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,I.jsx)(s7e,{}):null]});return c7.includes(e)?(0,I.jsx)(xs,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,I.jsx)(xs,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function d7e({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=s5({id:e});return(0,I.jsxs)(`div`,{ref:i,style:{transform:I6.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,I.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":vHe(),...n,...r,children:(0,I.jsx)(Cm,{size:14,"aria-hidden":!0})}),(0,I.jsx)(u7e,{tab:e,active:t})]})}function f7e(){let e=P(V.me.getMe,{host:YO}),t=F(V.me.setSettingsTabOrder),n=m7(Gs({select:e=>e.pathname})),r=n===void 0?void 0:A9(n),i=(0,N.useMemo)(()=>j9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,N.useState)(i);(0,N.useEffect)(()=>o(i),[i]);let s=(0,N.useMemo)(()=>new Set(f7(e?.permissions??[])),[e?.permissions]),c=(0,N.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&A9(e)===r),[a,s,r]),l=H6(V6(S8,{activationConstraint:{distance:5}}),V6(v8,{coordinateGetter:l5}));if(r===void 0||c.length===0)return null;let u=k9.find(e=>e.id===r);function d(e){let{active:n,over:r}=e;if(!r||n.id===r.id)return;let i=c.indexOf(n.id),s=c.indexOf(r.id);if(i<0||s<0)return;let l=l7e(a,Z8(c,i,s));o(l),t({order:l})}return(0,I.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,I.jsx)(K8,{sensors:l,collisionDetection:J4e,modifiers:[i6e],onDragEnd:d,children:(0,I.jsx)(a5,{items:c,strategy:d6e,children:c.map(e=>(0,I.jsx)(d7e,{tab:e,active:e===n},e))})})})}function p7e(){let e=P(V.me.getMe,{host:YO}),t=ss(),n=m7(Gs({select:e=>e.pathname})),r=n===void 0?void 0:A9(n),i=(0,N.useMemo)(()=>new Set(f7(e?.permissions??[])),[e?.permissions]),a=(0,N.useMemo)(()=>j9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=k9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=o7e(a,e.id);n&&t({to:p7(n)})}return(0,I.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":xHe(),children:[(0,I.jsx)(xs,{to:`/`,className:`oc-settings-nav__back`,children:wHe()}),(0,I.jsx)(`div`,{className:`oc-settings-nav__title`,children:DHe()}),(0,I.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,I.jsx)(`button`,{type:`button`,className:`oc-settings-nav__group`+(e.id===r?` is-active`:``),"aria-current":e.id===r?`true`:void 0,onClick:()=>s(e),children:e.label()},e.id))})]})}var m7e=12*1024*1024,h7e=480,g7e=160,_7e=.92;async function v7e(e,t={}){if(!e.type.startsWith(`image/`))throw Error(BF());if(e.size>m7e)throw Error(UF());let{source:n,width:r,height:i,cleanup:a}=await y7e(e);try{let a=e.type===`image/svg+xml`,o=Math.min(h7e/r,g7e/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(YF());if(u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c),t.invert){let e=u.getImageData(0,0,s,c),t=e.data;for(let e=0;e<t.length;e+=4)t[e]=255-t[e],t[e+1]=255-t[e+1],t[e+2]=255-t[e+2];u.putImageData(e,0,0)}let d=await N9(l,`image/webp`,_7e)??await N9(l,`image/png`);if(!d)throw Error(QF());return d}finally{a()}}async function y7e(e){if(e.type===`image/svg+xml`)return M9(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return M9(e)}async function M9(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(KF())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function N9(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var P9=`__all__`,F9={kind:`relative`,from:`now-24h`,to:`now`},b7e=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function I9({title:e,description:t,children:n}){return(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,I.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function x7e(e){return e===`light`?Lk():e===`dark`?Bk():Uk()}var S7e=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function C7e({tokens:e,mode:t}){let n=e.colors[t];return(0,I.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:S7e.map(e=>{let t=n[e];return(0,I.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function L9({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,I.jsxs)(`button`,{type:`button`,className:x1(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,I.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,I.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,I.jsx)(fm,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,I.jsx)(C7e,{tokens:r,mode:i}):(0,I.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,I.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,I.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]})}function w7e({selectedKey:e,resolvedMode:t}){let n=P(V.charts.listMyCharts),r=F(V.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:gN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:yN()})]}),(0,I.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,I.jsx)(L9,{selected:e===null,title:SN(),subtitle:TN(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?ON():n.via===`owner`?jN():PN({group:n.via.group});return(0,I.jsx)(L9,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key)},n.key)})]}),n!==void 0&&n.length===0?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:LN()}):null]})}function T7e(){let e=F(V.charts.importChart),[t,n]=(0,N.useState)(``),[r,i]=(0,N.useState)(``),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(KP())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(QP());return}let a;try{a=JSON.parse(r)}catch{o(KP());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!1)}}return(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:SP()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:TP()})]}),(0,I.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,I.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,I.jsx)(`span`,{className:`oc-chart-import__label`,children:OP()}),(0,I.jsx)(I1,{value:t,onChange:e=>n(e.target.value),placeholder:jP(),maxLength:60})]}),(0,I.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,I.jsx)(`span`,{className:`oc-chart-import__label`,children:PP()}),(0,I.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:LP(),rows:8,spellCheck:!1})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(X,{variant:`outline`,size:`sm`,asChild:!0,children:(0,I.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,I.jsx)(Im,{className:`size-4`}),BP(),(0,I.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,I.jsx)(X,{size:`sm`,disabled:l,onClick:()=>void f(),children:UP()})]}),a?(0,I.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,I.jsx)(`p`,{className:`oc-chart-import__ok`,children:YP()}):null]})]})}function E7e({chartKey:e,myGroups:t,restricted:n}){let r=F(V.charts.assignChartToGroup),i=F(V.charts.removeChartFromGroup),a=new Set((n??[]).map(e=>e.groupId)),o=t.filter(e=>!a.has(e.groupId));async function s(t){try{await r({groupId:t,chartKey:e})}catch{}}async function c(t){try{await i({groupId:t,chartKey:e})}catch{}}return(0,I.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,I.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:jI()}),(n??[]).map(e=>(0,I.jsxs)($,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,I.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":BI({group:e.name}),onClick:()=>void c(e.groupId),children:(0,I.jsx)(zm,{className:`size-3`})})]},e.groupId)),t.length===0?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:PI()}):o.length>0?(0,I.jsxs)(M3,{value:``,onValueChange:e=>void s(e),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-56`,children:(0,I.jsx)(N3,{placeholder:LI()})}),(0,I.jsx)(F3,{children:o.map(e=>(0,I.jsx)(Q,{value:e.groupId,children:e.name},e.groupId))})]}):null]})}function D7e({chart:e}){let t=$n(V.charts.setChartLogo),n=F(V.charts.removeChartLogo),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a=!1){if(e.chartId!==void 0){o(null),i(!0);try{let i=await(await v7e(r,{invert:a})).arrayBuffer();await t({chartId:e.chartId,bytes:i,mode:n})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),!0)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,I.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,I.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?yF():SF()}),(0,I.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,I.jsx)(`img`,{src:t,alt:``}):null}),(0,I.jsx)(X,{variant:`outline`,size:`sm`,asChild:!0,children:(0,I.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,I.jsx)(Im,{className:`size-4`}),t?OF():TF(),(0,I.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,I.jsx)(X,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:PF()}):null,t?(0,I.jsx)(X,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:jF()}):null]})}return(0,I.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,I.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:gF()}),(0,I.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,I.jsx)(f,{mode:`light`}),(0,I.jsx)(f,{mode:`dark`})]}),r?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:LF()}):null,a?(0,I.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function R9({chart:e}){let t=P(V.me.getMe,{host:YO}),n=F(V.charts.addChartDomain),r=F(V.charts.removeChartDomain),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,I.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,I.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:tI()}),(0,I.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,I.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:pI()}):u.map(e=>(0,I.jsxs)($,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,I.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":gI({domain:e}),onClick:()=>void f(e),children:(0,I.jsx)(zm,{className:`size-3`})})]},e))}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(I1,{value:i,onChange:e=>a(e.target.value),placeholder:sI(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,I.jsx)(X,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:uI()})]}),(0,I.jsx)(`span`,{className:`oc-show__desc`,children:iI()}),o?(0,I.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function O7e({chart:e,myGroups:t}){let n=F(V.charts.updateChart),r=F(V.charts.deleteChart),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(e.name),[c,l]=(0,N.useState)(()=>JSON.stringify(e.tokens,null,2)),[u,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(!1);function m(){s(e.name),l(JSON.stringify(e.tokens,null,2)),d(null),a(!0)}async function h(){if(e.chartId===void 0)return;d(null);let t;try{t=JSON.parse(c)}catch{d(KP());return}p(!0);try{await n({chartId:e.chartId,name:o.trim(),tokens:t}),a(!1)}catch(e){d(e instanceof Error?e.message:String(e))}finally{p(!1)}}async function g(){if(e.chartId!==void 0&&window.confirm(UI()))try{await r({chartId:e.chartId})}catch{}}return(0,I.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,I.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,I.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:i?null:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:m,children:uF()}),(0,I.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>void g(),children:pF()})]})})]}),i?(0,I.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,I.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,I.jsx)(`span`,{className:`oc-chart-import__label`,children:TI()}),(0,I.jsx)(I1,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,I.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,I.jsx)(`span`,{className:`oc-chart-import__label`,children:OI()}),(0,I.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),u?(0,I.jsx)(`p`,{className:`oc-chart-import__error`,children:u}):null,(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(X,{size:`sm`,disabled:f,onClick:()=>void h(),children:yI()}),(0,I.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:SI()})]})]}):null,(0,I.jsx)(D7e,{chart:e}),(0,I.jsx)(R9,{chart:e}),(0,I.jsx)(E7e,{chartKey:e.key,myGroups:t,restricted:e.restrictedToGroups})]})}function k7e(){let e=P(V.charts.listMyCharts),t=P(V.groups.listMyGroups,{}),n=(e??[]).filter(e=>e.via===`owner`);return(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:tF()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:iF()})]}),e!==void 0&&n.length===0?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:sF()}):(0,I.jsx)(`div`,{className:`oc-chart-mine-list`,children:n.map(e=>(0,I.jsx)(O7e,{chart:e,myGroups:t??[]},e.key))})]})}function A7e({chart:e,groups:t}){let n=F(V.charts.assignChartToGroup),r=F(V.charts.removeChartFromGroup),i=e.restrictedToGroups,a=new Set((i??[]).map(e=>e.groupId)),o=t.filter(e=>!a.has(e._id));async function s(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function c(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,I.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,I.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,I.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,I.jsx)($,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?sP():e.kind===`custom`&&e.scope===`personal`?tL():iP()}),e.isGlobalDefault?(0,I.jsx)($,{variant:`default`,children:uP()}):null]}),(0,I.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(i??[]).map(e=>(0,I.jsxs)($,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,I.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":yP({group:e.name}),onClick:()=>void c(e.groupId),children:(0,I.jsx)(zm,{className:`size-3`})})]},e.groupId)),o.length>0?(0,I.jsxs)(M3,{value:``,onValueChange:e=>void s(e),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-56`,children:(0,I.jsx)(N3,{placeholder:pP()})}),(0,I.jsx)(F3,{children:o.map(e=>(0,I.jsx)(Q,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:gP()}):null]})]})}function j7e({chart:e}){let t=F(V.charts.promoteChartToCommon),n=F(V.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(UI()))try{await n({chartId:e.chartId})}catch{}}return(0,I.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,I.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,I.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,I.jsx)($,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?iL():tL()}),e.ownerLabel?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:QI({owner:e.ownerLabel})}):null]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:sL()}):null,(0,I.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:uL()})]})]})}function M7e({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=F(V.admin.setDefaultThemeMode),i=F(V.admin.setDefaultLocale),a=F(V.charts.setDefaultChart),o=P(V.charts.listChartsAdmin),s=P(V.groups.listGroups,{}),c=e??`system`,l=t??`fr`;return(0,I.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:uN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:pN()})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:BN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:UN()})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(X,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:SN()}),tk.map(e=>(0,I.jsx)(X,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,I.jsx)(X,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:KN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:YN()})]}),(0,I.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,I.jsx)(A7e,{chart:e,groups:s??[]},e.key))})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:QN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:tP()})]}),(0,I.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,I.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,I.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,I.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,I.jsx)(R9,{chart:e})]},e.key))})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:KI()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:YI()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:pL()}):(0,I.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,I.jsx)(j7e,{chart:e},e.key))})})()]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:KM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:YM()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,I.jsx)(X,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:x7e(e)},e))})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:QM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:tN()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,I.jsx)(X,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?PA():LA()},e))}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:iN()})]})]})}function N7e(){let e=P(V.me.getMe,{host:YO}),t=nk(e?.resolvedThemeMode);return(0,I.jsxs)(`div`,{className:`oc-appearance`,children:[(0,I.jsx)(w7e,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,I.jsx)(T7e,{}),(0,I.jsx)(k7e,{}),e?.role===`admin`?(0,I.jsx)(M7e,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function P7e(){let[e,t]=(0,N.useState)(!0),[n,r]=(0,N.useState)(`per-user`),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(P9),[c,l]=(0,N.useState)(P9),[u,d]=(0,N.useState)(F9),f=i!==``||o!==P9||c!==P9;function p(){a(``),s(P9),l(P9),d(F9)}return(0,I.jsxs)(`div`,{className:`oc-show`,children:[(0,I.jsx)(N7e,{}),(0,I.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,I.jsx)(`summary`,{className:`oc-show__title`,children:sN()}),(0,I.jsxs)(I9,{title:`Buttons`,description:`Variants`,children:[(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(X,{children:`Default`}),(0,I.jsx)(X,{variant:`secondary`,children:`Secondary`}),(0,I.jsx)(X,{variant:`outline`,children:`Outline`}),(0,I.jsx)(X,{variant:`ghost`,children:`Ghost`}),(0,I.jsx)(X,{variant:`destructive`,children:`Destructive`}),(0,I.jsx)(X,{variant:`link`,children:`Link`})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(X,{size:`sm`,children:`Small`}),(0,I.jsx)(X,{children:`Default`}),(0,I.jsx)(X,{size:`lg`,children:`Large`}),(0,I.jsx)(X,{size:`icon`,"aria-label":`more`,children:(0,I.jsx)(ym,{})}),(0,I.jsx)(X,{disabled:!0,children:`Disabled`})]})]}),(0,I.jsx)(I9,{title:`Badges`,children:(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)($,{children:`Default`}),(0,I.jsx)($,{variant:`secondary`,children:`Secondary`}),(0,I.jsx)($,{variant:`outline`,children:`Outline`}),(0,I.jsx)($,{variant:`destructive`,children:`Destructive`})]})}),(0,I.jsx)(I9,{title:`Inputs & selection`,children:(0,I.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,I.jsx)(I1,{placeholder:`Text input…`}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsxs)(M3,{value:n,onValueChange:r,children:[(0,I.jsx)(P3,{className:`w-56`,children:(0,I.jsx)(N3,{placeholder:`Select…`})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,I.jsx)(Q,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,I.jsxs)(`label`,{className:`oc-show__check`,children:[(0,I.jsx)(k5,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,I.jsx)(I9,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,I.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,I.jsxs)(q5,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,I.jsxs)(M3,{value:o,onValueChange:s,children:[(0,I.jsx)(P3,{size:`sm`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:P9,children:`Toutes directions`}),(0,I.jsx)(Q,{value:`inbound`,children:`inbound`}),(0,I.jsx)(Q,{value:`outbound`,children:`outbound`}),(0,I.jsx)(Q,{value:`internal`,children:`internal`})]})]}),(0,I.jsxs)(M3,{value:c,onValueChange:l,children:[(0,I.jsx)(P3,{size:`sm`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:P9,children:`Toutes sévérités`}),(0,I.jsx)(Q,{value:`info`,children:`info`}),(0,I.jsx)(Q,{value:`warn`,children:`warn`}),(0,I.jsx)(Q,{value:`critical`,children:`critical`})]})]})]}),(0,I.jsx)(Y5,{fields:b7e,onChange:()=>{}}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,I.jsx)(K5,{value:u,onChange:d})]})]})}),(0,I.jsx)(I9,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,I.jsxs)(S1,{children:[(0,I.jsx)(C1,{asChild:!0,children:(0,I.jsx)(X,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,I.jsx)(ym,{})})}),(0,I.jsxs)(w1,{align:`start`,children:[(0,I.jsx)(E1,{children:`Actions`}),(0,I.jsx)(D1,{}),(0,I.jsx)(T1,{children:`Edit`}),(0,I.jsx)(T1,{children:`Duplicate`}),(0,I.jsx)(D1,{}),(0,I.jsx)(T1,{variant:`destructive`,children:`Delete`})]})]})}),(0,I.jsx)(I9,{title:`Card`,children:(0,I.jsxs)(P7,{className:`w-80`,children:[(0,I.jsxs)(F7,{children:[(0,I.jsx)(I7,{children:`Instance`}),(0,I.jsx)(L7,{children:`Non-secret metadata only.`})]}),(0,I.jsx)(R7,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,I.jsxs)(z8e,{className:`gap-2`,children:[(0,I.jsx)(X,{size:`sm`,children:`Save`}),(0,I.jsx)(X,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,I.jsx)(I9,{title:`Table`,children:(0,I.jsxs)(A5,{children:[(0,I.jsx)(j5,{children:(0,I.jsxs)(N5,{children:[(0,I.jsx)(P5,{className:`w-8`,children:(0,I.jsx)(k5,{"aria-label":`select all`})}),(0,I.jsx)(P5,{children:`Name`}),(0,I.jsx)(P5,{children:`Mode`}),(0,I.jsx)(P5,{className:`text-right`,children:`Status`}),(0,I.jsx)(P5,{className:`w-8`})]})}),(0,I.jsx)(M5,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,I.jsxs)(N5,{children:[(0,I.jsx)(F5,{children:(0,I.jsx)(k5,{"aria-label":`select ${e.n}`})}),(0,I.jsx)(F5,{className:`font-medium`,children:e.n}),(0,I.jsx)(F5,{children:(0,I.jsx)($,{variant:`secondary`,children:e.m})}),(0,I.jsx)(F5,{className:`text-right`,children:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,I.jsx)(fm,{className:`size-3.5`}),` `,e.s]})}),(0,I.jsx)(F5,{children:(0,I.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,I.jsx)(ym,{})})})]},e.n))})]})}),(0,I.jsx)(I9,{title:`App fragments`,description:`Chat-specific components`,children:(0,I.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,I.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,I.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,I.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,I.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,I.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,I.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,I.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,I.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,I.jsx)(`span`,{className:`oc-run-status__dot`}),(0,I.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}var z9=`oc.theme`;function B9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function V9(e){(0,N.useEffect)(()=>{let t=e??localStorage.getItem(z9)??`system`;if(localStorage.setItem(z9,t),B9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>B9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}function F7e(e){(0,N.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=q()}catch{t=void 0}t!==e&&xk(e)},[e])}var H9=`oc.sidebar.width`,U9=`oc.sidebar.collapsed`,W9=200,G9=520,I7e=260;function K9(e){return Math.min(G9,Math.max(W9,e))}function L7e(){let[e,t]=(0,N.useState)(()=>{let e=Number(localStorage.getItem(H9));return e?K9(e):I7e}),[n,r]=(0,N.useState)(()=>localStorage.getItem(U9)===`1`);(0,N.useEffect)(()=>{localStorage.setItem(H9,String(e))},[e]),(0,N.useEffect)(()=>{localStorage.setItem(U9,n?`1`:`0`)},[n]);let i=(0,N.useCallback)(()=>r(e=>!e),[]),a=(0,N.useRef)(!1);return{width:e,collapsed:n,toggleCollapsed:i,startResize:(0,N.useCallback)(n=>{n.preventDefault(),a.current=!0;let r=n.clientX,i=e,o=e=>{a.current&&t(K9(i+(e.clientX-r)))},s=()=>{a.current=!1,window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),document.body.style.cursor=``,document.body.style.userSelect=``};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[e]),MIN_WIDTH:W9,MAX_WIDTH:G9}}function R7e(){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(mr,{children:(0,I.jsx)(`div`,{className:`oc-boot`,children:a$()})}),(0,I.jsx)(pr,{children:(0,I.jsx)(B7e,{})}),(0,I.jsx)(fr,{children:(0,I.jsx)(pYe,{children:(0,I.jsx)(V7e,{})})})]})}function z7e(){return(0,I.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,I.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,I.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,I.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,I.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`})]})}function B7e(){let{signIn:e}=Ir();V9(void 0);let t=P(V.charts.brandForHost,{host:YO}),n=QO(YO),r=t??n??null,i=nk(void 0);ik(r?.tokens??null,i),(0,N.useEffect)(()=>{t&&$O(YO,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?ak(a,i):null,s=a?.label??`Atrium`,c=P(V.me.authProviders),[l,u]=(0,N.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(uwe())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.anonymous;return(0,I.jsxs)(`div`,{className:`oc-signin`,children:[(0,I.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,I.jsx)(`polyline`,{className:`oc-signin__line`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,vectorEffect:`non-scaling-stroke`}),(0,I.jsx)(`polyline`,{className:`oc-signin__pulse`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,pathLength:`100`,vectorEffect:`non-scaling-stroke`})]}),(0,I.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,I.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,I.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,I.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,I.jsx)(`h1`,{className:`oc-signin__title`,children:pwe()}),(0,I.jsx)(`p`,{className:`oc-signin__subtitle`,children:gwe()}),(0,I.jsx)(`div`,{className:`oc-signin__providers`,children:c?.google?(0,I.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,I.jsx)(z7e,{}),(0,I.jsx)(`span`,{children:ywe()})]}):null}),l?(0,I.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,I.jsx)(`p`,{className:`oc-signin__error`,children:Swe()}):null,c?.anonymous?(0,I.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:Twe()}):null]})]})}function V7e(){let e=P(V.me.getMe,{host:YO}),t=F(V.me.bootstrap),n=ss();(0,N.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),V9(e?.resolvedThemeMode);let r=nk(e?.resolvedThemeMode);ik(e?.resolvedChartTokens,r),F7e(e?.resolvedLocale);let i=(0,N.useRef)(null);if((0,N.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,I.jsx)(`div`,{className:`oc-boot`,children:a$()});let a=e.name||e.email||Owe();return e.role===`pending`?(0,I.jsxs)(`div`,{className:`oc-shell`,children:[(0,I.jsx)(q9,{}),(0,I.jsx)(E5,{}),(0,I.jsxs)(`header`,{className:`oc-topbar`,children:[(0,I.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,I.jsx)(J9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,I.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,I.jsx)(D5,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,I.jsxs)(`div`,{className:`oc-pending`,children:[(0,I.jsx)(`h1`,{className:`oc-pending__title`,children:jwe()}),(0,I.jsx)(`p`,{className:`oc-pending__body`,children:Pwe()})]})]}):(0,I.jsx)(U7e,{canOpenSettings:f7(e.permissions??[]).length>0,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function q9(){let e=P(V.me.getImpersonation),t=F(V.admin.stopImpersonation);return!e||!e.impersonating?null:(0,I.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,I.jsx)(bm,{className:`size-4 shrink-0`}),(0,I.jsxs)(`span`,{className:`oc-imp__text`,children:[Lwe(),` `,(0,I.jsx)(`strong`,{children:e.targetLabel}),Bwe(),(0,I.jsx)(`strong`,{children:e.realLabel}),Uwe()]}),(0,I.jsx)(X,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:Kwe()})]})}function J9({brand:e,resolvedThemeMode:t}){let n=nk(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=ak(e,n),[o,s]=(0,N.useState)(!1);return(0,N.useEffect)(()=>s(!1),[a]),(0,I.jsxs)(I.Fragment,{children:[a!==null&&!o?(0,I.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,I.jsx)(sk,{className:`oc-brand__logo`}):null,(0,I.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function H7e({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,I.jsxs)(`header`,{className:`oc-topbar`,children:[(0,I.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,I.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":i?Ywe():Qwe(),onClick:a,children:i?(0,I.jsx)(Nee,{}):(0,I.jsx)(Mee,{})}),(0,I.jsx)(xs,{to:`/`,className:`oc-topbar__brand`,children:(0,I.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,I.jsx)(`div`,{className:`oc-topbar__search`,children:(0,I.jsx)(I6e,{})}),(0,I.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,I.jsx)(P6e,{}),(0,I.jsx)(D5,{label:e,mode:t})]})]})}function U7e({canOpenSettings:e,userLabel:t,themeMode:n,resolvedThemeMode:r,brand:i}){let{width:a,collapsed:o,toggleCollapsed:s,startResize:c}=L7e(),l=zs(),u=as({strict:!1}),d=ss(),f=!!l({to:`/settings`,fuzzy:!0});return(0,I.jsxs)(`div`,{className:`oc-shell`,children:[(0,I.jsx)(q9,{}),(0,I.jsx)(E5,{}),(0,I.jsx)(H7e,{userLabel:t,themeMode:n,resolvedThemeMode:r,brand:i,collapsed:o,onToggleSidebar:s}),(0,I.jsxs)(`div`,{className:`oc-workspace`,children:[o?null:(0,I.jsxs)(`div`,{className:`oc-sidebar-col`,style:{width:a,flex:`0 0 ${a}px`},children:[f?(0,I.jsx)(p7e,{}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(k6e,{activeChatId:u.chatId??null,onSelect:e=>void d({to:`/chat/$chatId`,params:{chatId:e}})}),e?(0,I.jsx)(X,{variant:`ghost`,className:`m-2 justify-start`,asChild:!0,children:(0,I.jsx)(xs,{to:`/settings`,children:tTe()})}):null]}),(0,I.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:c,role:`separator`,"aria-orientation":`vertical`,"aria-label":iTe()})]}),(0,I.jsx)(`main`,{className:`oc-main`,children:(0,I.jsx)(Fs,{})})]})]})}function W7e(){let e=P(V.me.getMe,{host:YO}),t=ss(),n=Gs({select:e=>e.pathname}),r=(0,N.useMemo)(()=>e?f7(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,N.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,I.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:a$()});if(i)return null;let a=m7(n),o=a!==void 0&&!r.includes(a);return(0,I.jsxs)(`div`,{className:`oc-admin`,children:[(0,I.jsx)(f7e,{}),(0,I.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,I.jsx)(G7e,{}):(0,I.jsx)(Fs,{})})]})}function G7e(){return(0,I.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,I.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,I.jsx)(Fm,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:sTe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:uTe()})]})}function K7e(){let e=P(V.me.getMe,{host:YO}),t=ss();return(0,N.useEffect)(()=>{if(e===void 0)return;let n=f7(e.permissions??[]);t({to:n.length>0?p7(n[0]):`/`,replace:!0})},[e,t]),(0,I.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:a$()})}function q7e(){let{tab:e}=as({from:`/settings/$tab`});switch(e){case`groups`:return(0,I.jsx)(E8e,{});case`integrations`:return(0,I.jsx)(s5e,{});case`instances`:return(0,I.jsx)(r8e,{});case`bridge`:return(0,I.jsx)(Y5e,{});case`theme`:return(0,I.jsx)(P7e,{});case`feedbacks`:return(0,I.jsx)(u5e,{});case`files`:return(0,I.jsx)(d5e,{});case`agentFiles`:return(0,I.jsx)(y5e,{});case`preferences`:return(0,I.jsx)(j5e,{});case`chatDefaults`:return(0,I.jsx)(P5e,{});case`access`:return(0,I.jsx)(R5e,{});default:return(0,I.jsx)(v8e,{})}}function J7e(){let{chatId:e}=as({from:`/chat/$chatId`});return(0,I.jsx)(o6,{chatId:e})}function Y7e(){return(0,I.jsx)(o6,{chatId:null})}var Y9=Es({component:R7e}),X7e=ws({getParentRoute:()=>Y9,path:`/`,component:Y7e}),Z7e=ws({getParentRoute:()=>Y9,path:`chat/$chatId`,component:J7e}),X9=ws({getParentRoute:()=>Y9,path:`settings`,component:W7e}),Q7e=ws({getParentRoute:()=>X9,path:`/`,component:K7e}),$7e=ws({getParentRoute:()=>X9,path:`traces`,validateSearch:q6e,component:F8e}),e9e=ws({getParentRoute:()=>X9,path:`audit`,validateSearch:J6e,component:o8e}),t9e=ws({getParentRoute:()=>X9,path:`anomalies`,validateSearch:Y6e,component:t5e}),n9e=ws({getParentRoute:()=>X9,path:`kpi`,validateSearch:X6e,component:W8e}),r9e=ws({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:Z6e,component:l8e}),i9e=ws({getParentRoute:()=>X9,path:`users`,validateSearch:Q6e,component:n8e}),a9e=ws({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw ia({to:`/settings/$tab`,params:{tab:e8e.uiprefs},replace:!0})}}),o9e=ws({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:Wp([...c7]).catch(`roles`).parse(e.tab)}),component:q7e});function s9e({reset:e}){let t=ss();return(0,I.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,I.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,I.jsx)(Fm,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:pTe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:gTe()}),(0,I.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,I.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>e(),children:yTe()}),(0,I.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void t({to:`/`}),children:o$()})]})]})}function c9e(){let e=ss();return(0,I.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,I.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,I.jsx)(Tee,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:wTe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:DTe()}),(0,I.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,I.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:o$()})})]})}var Z9=Vs({routeTree:Y9.addChildren([X7e,Z7e,X9.addChildren([Q7e,$7e,e9e,t9e,n9e,r9e,i9e,a9e,o9e])]),defaultPreload:`intent`,defaultErrorComponent:s9e,defaultNotFoundComponent:c9e});async function l9e(){try{let e=await fetch(`/config.json`,{cache:`no-store`});if(e.ok){let t=(await e.json())?.convexUrl;if(typeof t==`string`&&t.trim())return t.trim()}}catch{}throw Error(`No Convex URL configured: serve /config.json {"convexUrl":"…"} (production) or set VITE_CONVEX_URL (local dev).`)}var u9e=()=>null;function Q9({children:e}){return(0,I.jsx)(`div`,{style:{display:`flex`,minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}var $9=_r.createRoot(document.getElementById(`root`));$9.render((0,I.jsx)(N.StrictMode,{children:(0,I.jsx)(Q9,{children:`Chargement…`})})),l9e().then(e=>{let t=new Yn(e);$9.render((0,I.jsx)(N.StrictMode,{children:(0,I.jsx)(Lr,{client:t,children:(0,I.jsxs)(uYe,{children:[(0,I.jsx)(q2e,{children:(0,I.jsx)(Ws,{router:Z9})}),(0,I.jsx)(N.Suspense,{fallback:null,children:(0,I.jsx)(u9e,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,I.jsx)(N.StrictMode,{children:(0,I.jsxs)(Q9,{children:[`Configuration manquante\xA0:`,` `,e instanceof Error?e.message:String(e)]})}))});
|
|
164
|
+
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<s9&&a.push(e)):t>0&&(i+=t,o.length<s9&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function h5e(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var c9=e=>typeof e==`string`?e:null;function l9(e){return/^\d+\.\d+\.\d+$/.test(e)?e.split(`.`).map(e=>Number.parseInt(e,10)):null}function g5e(e,t){let n=l9(e),r=l9(t);if(n===null||r===null)return null;for(let e=0;e<3;e++){let t=n[e]-r[e];if(t!==0)return t}return 0}function _5e(e,t){if(e===null||t===null)return!1;let n=g5e(t,e.min);return n!==null&&n>=0}function u9(e,t){let n={range:null,validatedVersions:[]};if(typeof e!=`object`||!e)return n;let r=e.providers;if(typeof r!=`object`||!r)return n;let i=r[t];if(typeof i!=`object`||!i)return n;let a=i,o=null;if(typeof a.supportedRange==`object`&&a.supportedRange!==null){let e=a.supportedRange,t=c9(e.min),n=c9(e.maxValidated);t!==null&&n!==null&&(o={min:t,maxValidated:n})}let s=Array.isArray(a.validatedVersions)?a.validatedVersions.filter(e=>typeof e==`string`):[];return{range:o,validatedVersions:s}}function d9(e,t){if(e.gatewayVersion===null)return`unknown`;if(e.versionBeyondValidated)return`beyond`;let{range:n}=u9(t,e.provider);return _5e(n,e.gatewayVersion)?`supported`:`unknown`}function f9(e){return e===`supported`?Kqe():e===`beyond`?Yqe():Qqe()}function p9(e){return e??M$()}function m9(e){return e===null?sJe():iJe({version:e})}function v5e(e,t){if(typeof e!=`object`||!e)return!1;let n=e.providers;return typeof n!=`object`||!n?!1:t in n}var h9=e=>`${e.instanceName}::${e.agentId}`;function y5e(){let e=P(V.me.getMe,{host:YO}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=P(V.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,N.useState)(null);(0,N.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=P(V.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=P(V.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),c=(0,N.useMemo)(()=>{if(e!==void 0){if(t)return i===null||o===void 0?r!==void 0&&r.length===0?[]:void 0:o.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(s!==void 0)return s.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,o,r,s]),[l,u]=(0,N.useState)(null);(0,N.useEffect)(()=>{!c||c.length===0||(!l||!c.some(e=>h9(e)===l))&&u(h9(c[0]))},[c,l]);let d=c?.find(e=>h9(e)===l)??null,f=$n(V.agentFiles.listAgentFiles),[p,m]=(0,N.useState)({status:`idle`}),h=d?.instanceName??null,g=d?.agentId??null,_=P(V.compat.forInstance,n&&h!==null?{instanceName:h}:`skip`),v=n&&h!==null?c4e(_,`agentFiles`):null,y=v===null?!1:v===`loading`?null:v.blocked,b=(0,N.useCallback)(async()=>{if(!(h===null||g===null)){m({status:`loading`});try{m({status:`done`,files:(await f({instanceName:h,agentId:g})).files})}catch{m({status:`error`})}}},[f,h,g]);(0,N.useEffect)(()=>{y===!1&&b()},[b,y]);let[x,S]=(0,N.useState)(null),C=q(),w=(0,N.useMemo)(()=>new Intl.NumberFormat(C,{maximumFractionDigits:0}),[C]);return e===void 0||c===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):(0,I.jsxs)(`div`,{className:`oc-afiles`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:HWe()}),(0,I.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,I.jsxs)(M3,{value:i??``,onValueChange:e=>a(e),children:[(0,I.jsx)(P3,{size:`sm`,"aria-label":GWe(),children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:(r??[]).map(e=>(0,I.jsx)(Q,{value:e.name,children:e.name},e.name))})]}):null,c.length>0?(0,I.jsxs)(M3,{value:l??``,onValueChange:e=>u(e),children:[(0,I.jsx)(P3,{size:`sm`,"aria-label":JWe(),children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:c.map(e=>(0,I.jsx)(Q,{value:h9(e),children:e.label},h9(e)))})]}):(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:ZWe()})]}),d===null?null:v===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):v!==null&&v.blocked?(0,I.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,I.jsx)(Fm,{size:14,"aria-hidden":!0}),` `,m9(v.gatewayVersion)]}):p.status===`loading`||p.status===`idle`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):p.status===`error`?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[rGe(),` `,(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:O$()})]}):p.files.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:eGe()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`oc-afiles__list`,children:p.files.map(e=>{let n=f5e(e.size),r=n>=80;return(0,I.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,I.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,I.jsx)($,{variant:`outline`,children:oGe()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`oc-afiles__size`,children:lGe({size:a9(e.size,C)})}),(0,I.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,I.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,I.jsx)(`span`,{className:`oc-afiles__pct`,children:fGe({pct:w.format(n)})}),r?(0,I.jsx)(Fm,{size:14,className:`oc-afiles__warn`,"aria-label":hGe()}):(0,I.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,I.jsx)(X,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>S(e),children:t?xGe():wGe()})]},e.name)})}),(0,I.jsx)(`p`,{className:`oc-afiles__budget`,children:vGe({used:a9(o9(p.files),C),total:a9(i9,C),pct:w.format(p5e(o9(p.files)))})})]}),x&&d?(0,I.jsx)(b5e,{instanceName:d.instanceName,agentId:d.agentId,name:x.name,isAdmin:t,onClose:()=>S(null),onSaved:()=>void b()}):null]})}function b5e({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=$n(V.agentFiles.getAgentFile),s=$n(V.agentFiles.setAgentFile),c=n0(),[l,u]=(0,N.useState)(null),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),[h,g]=(0,N.useState)(!1),[_,v]=(0,N.useState)(!1),[y,b]=(0,N.useState)(!1),[x,S]=(0,N.useState)(!1),C=(0,N.useCallback)(async r=>{f(!1);try{let i=await o({instanceName:e,agentId:t,name:n});u({content:i.content,updatedAtMs:i.updatedAtMs}),r||m(i.content),b(!1)}catch{f(!0)}},[o,e,t,n]);(0,N.useEffect)(()=>{C(!1)},[C]);async function w(){if(l!==null){v(!0),S(!1);try{await s({instanceName:e,agentId:t,name:n,content:p,baseUpdatedAtMs:l.updatedAtMs??void 0}),c.success(WGe({name:n})),a(),await C(!1)}catch(e){h5e(e)?b(!0):S(!0)}finally{v(!1)}}}let T=l!==null&&p!==l.content,E=(0,N.useMemo)(()=>l===null?null:m5e(l.content,p),[l,p]),D=p.length>r9,O=q(),ee=(0,N.useMemo)(()=>new Intl.NumberFormat(O),[O]);return(0,I.jsx)(G1,{open:!0,onOpenChange:e=>!e&&i(),children:(0,I.jsxs)(K1,{className:`oc-afiles__editor`,children:[(0,I.jsxs)(q1,{children:[(0,I.jsx)(Y1,{children:j$({name:n})}),(0,I.jsxs)(X1,{children:[kGe({agent:t,instance:e}),r?null:(0,I.jsxs)(I.Fragment,{children:[` · `,MGe()]})]})]}),d?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[XGe(),` `,(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void C(!1),children:O$()})]}):l===null?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`textarea`,{className:`oc-afiles__source`,value:p,readOnly:!r,spellCheck:!1,onChange:e=>m(e.target.value),"aria-label":j$({name:n})}),(0,I.jsx)(`p`,{className:`oc-afiles__hint`,children:FGe()}),y?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[$Ge(),` `,(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void C(!0),children:nKe()})]}):null,x?(0,I.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:qGe()}):null,(0,I.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,I.jsx)(`span`,{className:`oc-afiles__count${D?` is-over`:``}`,children:RGe({count:ee.format(p.length),max:ee.format(r9)})}),r?(0,I.jsx)(X,{size:`sm`,disabled:!T||_||y,onClick:()=>g(!0),children:_?D$():VGe()}):null]})]}),(0,I.jsx)(L1,{open:h,onOpenChange:g,children:(0,I.jsxs)(R1,{children:[(0,I.jsxs)(z1,{children:[(0,I.jsx)(V1,{children:aKe({name:n})}),(0,I.jsx)(H1,{children:cKe({agent:t})})]}),E?(0,I.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,I.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:dKe({added:E.added,removed:E.removed})}),E.sampleAdded.length>0?(0,I.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,I.jsx)(`span`,{className:`oc-afiles__diff-label`,children:mKe()}),E.sampleAdded.map((e,t)=>(0,I.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,E.sampleRemoved.length>0?(0,I.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,I.jsx)(`span`,{className:`oc-afiles__diff-label`,children:_Ke()}),E.sampleRemoved.map((e,t)=>(0,I.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,I.jsxs)(B1,{children:[(0,I.jsx)(W1,{children:QW()}),(0,I.jsx)(U1,{onClick:()=>void w(),children:bKe()})]})]})})]})})}var g9=[{id:`messages`,label:()=>gL()},{id:`composer`,label:()=>yL()},{id:`sidebar`,label:()=>SL()},{id:`other`,label:()=>TL()}],_9={showSource:{category:`messages`,label:()=>OL(),help:()=>jL()},showReport:{category:`messages`,label:()=>PL(),help:()=>LL()},copyAssistant:{category:`messages`,label:()=>BL()},copyUser:{category:`messages`,label:()=>UL()},showDelete:{category:`messages`,label:()=>KL()},showTools:{category:`messages`,label:()=>YL(),help:()=>QL()},voiceInput:{category:`composer`,label:()=>tR(),help:()=>iR()},showChatAge:{category:`sidebar`,label:()=>sR(),help:()=>uR()},showChatProvider:{category:`sidebar`,label:()=>pR(),help:()=>gR()}};function v9(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function x5e(e,t){let n=v9(t.trim()),r=new Map(g9.map(e=>[e.id,e.label()])),i=new Map(g9.map(e=>[e.id,[]]));for(let t of e){let e=_9[t],a=e?.category??`other`;n&&!v9(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return g9.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var S5e=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],C5e={voiceInput:`voiceInput`};function w5e(e){return S5e.includes(e)}function y9(e){return e===`admin`}function T5e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function E5e(e){return e===`on`?!0:e===`off`?!1:null}function D5e(e){return w5e(e)?C5e[e]:void 0}var O5e={voiceInput:()=>YR()};function k5e({prefKey:e,ui:t}){let n=F(V.admin.setUiPrefDefault),r=F(V.admin.setFeatureEnabled),i=D5e(e),a=i?O5e[e]?.():void 0;return(0,I.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,I.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,I.jsx)(`span`,{className:`oc-prefs__gov-label`,children:LR()}),(0,I.jsxs)(M3,{value:T5e(t.defaults[e]),onValueChange:t=>void n({key:e,value:E5e(t)}),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-36`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:`on`,children:tz()}),(0,I.jsx)(Q,{value:`off`,children:iz()}),(0,I.jsx)(Q,{value:`inherit`,children:sz()})]})]}),i?(0,I.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,I.jsx)(k5,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":BR()}),BR()]}):null]}),a?(0,I.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function A5e(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(!1),i=P(V.me.getMe,{host:YO}),a=i?.ui,o=y9(i?.role)&&n,s=F(V.me.setUiPref).withOptimisticUpdate(r0),c=(0,N.useMemo)(()=>a?x5e(Object.keys(a.effective),e):[],[a,e]);return a?(0,I.jsxs)(`div`,{className:`oc-prefs-panel`,children:[y9(i?.role)?(0,I.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,I.jsx)(k5,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":PR()}),PR()]}):null,o?(0,I.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,I.jsx)(`p`,{children:UR()}),(0,I.jsx)(`p`,{children:KR()}),(0,I.jsx)(`p`,{children:QR()})]}):null,(0,I.jsx)(I1,{value:e,onChange:e=>t(e.target.value),placeholder:yR(),"aria-label":yR(),className:`mb-2`}),c.length===0?(0,I.jsx)(`div`,{className:`oc-prefs__empty`,children:SR()}):(0,I.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,I.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,I.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=_9[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,I.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!i?` is-overridden`:``}`,children:[(0,I.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,I.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,I.jsx)(`span`,{className:`oc-prefs__lock`,children:TR()}):l?null:(0,I.jsx)(`span`,{className:`oc-prefs__def`,children:OR()})]}),r?(0,I.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,I.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,I.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:jR()}):null,(0,I.jsx)(k5,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t===!0}),"aria-label":n})]}),o?(0,I.jsx)(k5e,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,I.jsx)(`div`,{className:`oc-prefs__empty`,children:jk()})}function j5e(){let e=P(V.me.getMe,{host:YO}),t=F(V.me.setLocale),n=F(V.me.setMyName),r=n0(),i=e?.locale??`default`,a=e?.name??``,[o,s]=(0,N.useState)(null),c=o??a,l=c.trim()!==a.trim();async function u(){try{await n({name:c}),s(null),r.success(pA())}catch(e){r.error(gA(),e)}}return(0,I.jsxs)(`div`,{className:`oc-appearance`,children:[(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:tA()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:iA()})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(I1,{className:`max-w-xs`,value:c,maxLength:120,placeholder:sA(),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l&&(e.preventDefault(),u())}}),(0,I.jsx)(X,{size:`sm`,disabled:!l,onClick:()=>void u(),children:XQ()})]}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:uA()})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:yA()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:SA()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,I.jsx)(X,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?PA():e===`en`?LA():Kk()},e))}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:TA()})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:OA()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:jA()})]}),(0,I.jsx)(A5e,{})]})]})}var M5e=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N5e(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}function P5e(){let e=$n(V.agentFiles.getChatDefaults),t=$n(V.agentFiles.setChatDefaults),n=n0(),[r,i]=(0,N.useState)({status:`loading`}),[a,o]=(0,N.useState)({thinkingDefault:null,fastModeDefault:null}),[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(!1),d=l4e(P(V.compat.getBridgeCompat,{}),`configDefaults`),f=d===`loading`?null:d.blocked,p=(0,N.useCallback)(async()=>{i({status:`loading`});try{let t=N5e(await e({}));i({status:`done`,current:t}),o(t)}catch{i({status:`error`})}},[e]);(0,N.useEffect)(()=>{f===!1&&p()},[p,f]);let m=r.status===`done`?r.current:null,h=m!==null&&a.thinkingDefault!==null&&a.thinkingDefault!==m.thinkingDefault,g=m!==null&&a.fastModeDefault!==null&&a.fastModeDefault!==m.fastModeDefault,_=h||g;async function v(){u(!0);try{await t({...h?{thinkingDefault:a.thinkingDefault}:{},...g?{fastModeDefault:a.fastModeDefault}:{}}),n.success(qKe()),await p()}catch(e){n.error(XKe(),e)}finally{u(!1)}}let y=(0,N.useMemo)(()=>M5e.map(e=>({id:e,label:V3(e)})),[]),b=(0,N.useMemo)(()=>[{id:`fast`,label:k$()},{id:`standard`,label:A$()}],[]);return(0,I.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:EKe()}),d===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):d.blocked?(0,I.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,I.jsx)(Fm,{size:14,"aria-hidden":!0}),` `,m9(d.gatewayVersion)]}):r.status===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):r.status===`error`?(0,I.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[VKe(),` `,(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void p(),children:O$()})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,I.jsx)(`span`,{className:`oc-cdefaults__label`,children:kKe()}),(0,I.jsx)(K3,{options:y,value:a.thinkingDefault,onChange:e=>o({...a,thinkingDefault:e}),disabled:l}),(0,I.jsx)(`p`,{className:`oc-cdefaults__help`,children:MKe()})]}),(0,I.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,I.jsx)(`span`,{className:`oc-cdefaults__label`,children:FKe()}),(0,I.jsx)(K3,{options:b,value:a.fastModeDefault===null?null:a.fastModeDefault?`fast`:`standard`,onChange:e=>o({...a,fastModeDefault:e===`fast`}),disabled:l}),(0,I.jsx)(`p`,{className:`oc-cdefaults__help`,children:RKe()})]}),(0,I.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,I.jsx)(X,{size:`sm`,disabled:!_||l,onClick:()=>c(!0),children:l?D$():WKe()})}),(0,I.jsx)(`p`,{className:`oc-cdefaults__note`,children:$Ke()})]}),(0,I.jsx)(L1,{open:s,onOpenChange:c,children:(0,I.jsxs)(R1,{children:[(0,I.jsxs)(z1,{children:[(0,I.jsx)(V1,{children:nqe()}),(0,I.jsx)(H1,{children:aqe()})]}),(0,I.jsxs)(B1,{children:[(0,I.jsx)(W1,{children:QW()}),(0,I.jsx)(U1,{onClick:()=>void v(),children:cqe()})]})]})})]})}function F5e(e){return e===`user`?wze():y$({group:e.group})}function I5e(e){return e===`common`?kze():e===`owner`?Mze():y$({group:e.group})}function L5e(e){return e.name||e.email||e.userId.slice(0,8)}function R5e(){let e=P(V.admin.listUsers,{}),[t,n]=(0,N.useState)(``),r=P(V.introspect.introspectUser,t?{userId:t}:`skip`);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:XRe()}),(0,I.jsxs)(M3,{value:t,onValueChange:n,children:[(0,I.jsx)(P3,{size:`sm`,"aria-label":_$(),children:(0,I.jsx)(N3,{placeholder:_$()})}),(0,I.jsx)(F3,{children:(e??[]).map(e=>(0,I.jsx)(Q,{value:e.userId,children:L5e(e)},e._id))})]}),t===``?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:tze()}):r===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:jk()}):(0,I.jsxs)(`div`,{className:`oc-introspect`,children:[(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:ize()}),(0,I.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,I.jsx)(`strong`,{children:r.user.label}),(0,I.jsx)($,{variant:`secondary`,children:r.role})]})]}),(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:sze()}),r.groups.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:v$()}):(0,I.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,I.jsx)($,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:uze()}),r.agents.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:v$()}):(0,I.jsx)(`ul`,{className:`oc-introspect__list`,children:r.agents.map(e=>(0,I.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,I.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,I.jsx)($,{variant:`default`,children:xze()}):null,(0,I.jsx)($,{variant:`outline`,children:F5e(e.via)}),(0,I.jsx)($,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:pze()}),r.charts.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:v$()}):(0,I.jsx)(`ul`,{className:`oc-introspect__list`,children:r.charts.map(e=>(0,I.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,I.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,I.jsx)($,{variant:`outline`,children:I5e(e.via)})]},e.key))})]}),(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:gze()}),r.permissions.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:v$()}):(0,I.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,I.jsx)($,{variant:`secondary`,children:e},e))})]})]})]})}function b9({delayDuration:e=0,...t}){return(0,I.jsx)(Xle,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function x9({...e}){return(0,I.jsx)(Zle,{"data-slot":`tooltip`,...e})}function S9({...e}){return(0,I.jsx)(Qle,{"data-slot":`tooltip-trigger`,...e})}function C9({className:e,sideOffset:t=0,children:n,...r}){return(0,I.jsx)($le,{children:(0,I.jsxs)(eue,{"data-slot":`tooltip-content`,sideOffset:t,className:x1(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,I.jsx)(tue,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var z5e=[`gateway-http`,`shared-fs`,`off`],B5e=[`inline`,`shared-fs`];He.object({mediaMode:He.optional(He.union(He.literal(`gateway-http`),He.literal(`shared-fs`),He.literal(`off`))),inboundMediaMode:He.optional(He.union(He.literal(`inline`),He.literal(`shared-fs`))),rehydration:He.optional(He.boolean()),mediaMaxMb:He.optional(He.number()),inboundAgentMount:He.optional(He.string()),outboundAgentMount:He.optional(He.string())});var w9={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function V5e(e,t){let n={},r=r=>{(e[r]!==w9[r]||t[r]!==void 0)&&(n[r]=e[r])};return r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`),n}function T9(e){return e.filter(e=>e.state===`error`)}function H5e(e){return e.reachable&&T9(e.targets).length===0}function U5e(e){return e.state===`error`&&e.lastErrorCode!==null}function W5e(e){return!!e.lastDownstreamRejectCode}function E9(e){return e.kind??`openclaw`}function G5e(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function K5e(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,E9(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(E9(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return G5e(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>E9(e)===r)}))}function q5e(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}function J5e(){return P(V.bridgeHealth.getBridgeHealth,{})}function Y5e(){let e=J5e(),t=P(V.compat.getBridgeCompat,{}),n=P(V.me.getMe,{host:YO})?.role===`admin`,r=P(V.admin.listInstances,n?{}:`skip`),i=ss(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=K5e(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&v5e(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,I.jsxs)(`div`,{className:`oc-bridge`,children:[(0,I.jsx)(X5e,{health:e,compat:t,onSeeAnomalies:a}),(0,I.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:YDe()}),o.map(e=>(0,I.jsx)(Z5e,{providerKey:e.key,connections:e.connections,compatTargets:e.compatTargets,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0,isAdmin:n},e.key)),l?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:tJe()}):null]})}function X5e({health:e,compat:t,onSeeAnomalies:n}){let r=t&&t!==null?(0,I.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:p9(t.bridgeVersion)}),` · `,_qe(),` `,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?M$():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:l$()});if(e===null)return(0,I.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:eOe()});let i=T9(e.targets),a=!e.reachable,o=H5e(e),s=o?`ok`:`error`,c=new Date(e.checkedAt).toLocaleString(`fr-FR`),l=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,I.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${s}`,children:[(0,I.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:o?(0,I.jsx)(gm,{size:22}):a?(0,I.jsx)(Vee,{size:22}):(0,I.jsx)(Fm,{size:22})}),(0,I.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,I.jsx)(`div`,{className:`oc-bridge-card__title`,children:o?rOe():a?oOe():lOe({count:i.length})}),(0,I.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,I.jsxs)(`span`,{children:[(0,I.jsx)(Ree,{size:12,"aria-hidden":!0}),` `,fOe({time:c})]}),l?(0,I.jsx)(`span`,{children:hOe({time:l})}):null,r]}),a?(0,I.jsx)(`p`,{className:`oc-bridge-card__hint`,children:K7(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,I.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:vOe()})]})}function Z5e({providerKey:e,connections:t,compatTargets:n,instances:r,manifest:i,compatStatus:a,compatReachable:o,isAdmin:s}){let c=i?u9(i,e):null,l=n.map(e=>d9(e,i)),u=l.includes(`beyond`)?`beyond`:l.length>0&&l.every(e=>e===`supported`)?`supported`:null;return(0,I.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,I.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,I.jsx)(jm,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,I.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q5e(e)}),u?(0,I.jsx)($,{variant:u===`beyond`?`destructive`:`secondary`,children:f9(u)}):null]}),(0,I.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:xOe({count:t.length})}),t.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:wOe()}):(0,I.jsx)(`div`,{className:`oc-bridge-targets`,children:t.map(e=>(0,I.jsx)(Q5e,{t:e},e.key))}),(0,I.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:dqe()}),(0,I.jsx)($5e,{support:c,compatStatus:a,compatReachable:o,manifest:i,compatTargets:n}),s&&r.length>0?(0,I.jsx)(e7e,{instances:r}):null]})}function Q5e({t:e}){let t=U5e(e)?K7(e.lastErrorCode):null,n=W5e(e)?K7(e.lastDownstreamRejectCode):null;return(0,I.jsxs)(`div`,{className:`oc-bridge-target oc-bridge-target--${e.state}`,children:[(0,I.jsxs)(`div`,{className:`oc-bridge-target__head`,children:[(0,I.jsxs)(`code`,{className:`oc-traces__mono`,children:[e.canonical,`/`,e.agentId]}),(0,I.jsx)(i7e,{state:e.state}),(0,I.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})]}),(0,I.jsxs)(`div`,{className:`oc-bridge-target__stats`,children:[DOe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts}),e.lastOkAt?AOe({time:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):``]}),t?(0,I.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,I.jsx)(`strong`,{children:t.label}),` `,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,I.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,I.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[NOe({label:n.label}),` `,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}function $5e({support:e,compatStatus:t,compatReachable:n,manifest:r,compatTargets:i}){return t===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:l$()}):t===`nodata`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:mqe()}):(0,I.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Sqe()}),r===null?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Tqe()}):(0,I.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,I.jsx)(`span`,{className:`oc-compat__label`,children:Oqe()}),e&&e.range!==null?(0,I.jsx)(`span`,{children:jqe({min:e.range.min,max:e.range.maxValidated})}):(0,I.jsx)(`span`,{children:M$()}),e?(0,I.jsx)(r7e,{versions:e.validatedVersions}):null]}),i.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Uqe()}):(0,I.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>{let t=d9(e,r);return(0,I.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.instanceName}),(0,I.jsx)(`span`,{className:`oc-compat__provider`,children:e.provider}),(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:p9(e.gatewayVersion)}),(0,I.jsx)($,{variant:t===`supported`?`secondary`:t===`beyond`?`destructive`:`outline`,children:f9(t)})]},e.instanceName)})})]})}function e7e({instances:e}){let[t,n]=(0,N.useState)(!1);return(0,I.jsxs)(`div`,{className:`oc-bridge-provider__config${t?` is-open`:``}`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__config-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,I.jsx)(pm,{size:14,"aria-hidden":!0}):(0,I.jsx)(mm,{size:14,"aria-hidden":!0}),gEe()]}),t?(0,I.jsx)(n7e,{instances:e}):null]})}function t7e({text:e}){return(0,I.jsx)(b9,{delayDuration:150,children:(0,I.jsxs)(x9,{children:[(0,I.jsx)(S9,{asChild:!0,children:(0,I.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,I.jsx)(xee,{"aria-hidden":!0})})}),(0,I.jsx)(C9,{className:`max-w-xs text-pretty`,children:e})]})})}function D9({label:e,help:t}){return(0,I.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,I.jsx)(t7e,{text:t})]})}function O9({label:e,result:t}){return t?t.checked?(0,I.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,I.jsx)(gm,{"aria-hidden":!0}):(0,I.jsx)(Fm,{"aria-hidden":!0}),(0,I.jsxs)(`span`,{children:[e,` — `,t.ok?LDe():t.detail]})]}):(0,I.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,BDe()]}):null}function n7e({instances:e}){let t=F(V.admin.upsertInstanceConfig),n=$n(V.bridge.validateMediaPaths),r=n0(),[i,a]=(0,N.useState)(null),[o,s]=(0,N.useState)({...w9}),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(!1),[f,p]=(0,N.useState)(null),m=o.inboundMediaMode===`shared-fs`,h=o.mediaMode===`shared-fs`,g=m||h;async function _(){if(!i)return;let t=e.find(e=>e._id===i);if(t){d(!0),p(null);try{p(await n({instanceName:t.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){r.error(TDe(),e)}finally{d(!1)}}}function v(t){a(t);let n=e.find(e=>e._id===t)?.config??{};s({mediaMode:n.mediaMode??w9.mediaMode,inboundMediaMode:n.inboundMediaMode??w9.inboundMediaMode,rehydration:n.rehydration??w9.rehydration,mediaMaxMb:n.mediaMaxMb??w9.mediaMaxMb,inboundAgentMount:n.inboundAgentMount??w9.inboundAgentMount,outboundAgentMount:n.outboundAgentMount??w9.outboundAgentMount}),p(null)}async function y(){if(i){l(!0);try{await t({instanceId:i,config:V5e(o,e.find(e=>e._id===i)?.config??{})})}catch(e){r.error(UEe(),e)}finally{l(!1)}}}return(0,I.jsxs)(`div`,{className:`oc-bridge-config`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:yEe()}),(0,I.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:SEe(),help:KEe()}),(0,I.jsxs)(M3,{value:i??``,onValueChange:v,children:[(0,I.jsx)(P3,{size:`sm`,className:`w-full sm:w-72`,children:(0,I.jsx)(N3,{placeholder:TEe()})}),(0,I.jsx)(F3,{children:e.map(e=>(0,I.jsx)(Q,{value:e._id,children:e.displayName??e.name},e._id))})]})]}),i!==null&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:OEe(),help:YEe()}),(0,I.jsxs)(M3,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-full`,children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:z5e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))})]})]}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:jEe(),help:QEe()}),(0,I.jsxs)(M3,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-full`,children:(0,I.jsx)(N3,{})}),(0,I.jsx)(F3,{children:B5e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))})]})]}),(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:PEe(),help:tDe()}),(0,I.jsx)(I1,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),g&&(0,I.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[m&&(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:sDe(),help:uDe()}),(0,I.jsx)(I1,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),h&&(0,I.jsxs)(`label`,{className:`oc-field`,children:[(0,I.jsx)(D9,{label:pDe(),help:gDe()}),(0,I.jsx)(I1,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,I.jsxs)(`label`,{className:`oc-field--row`,children:[(0,I.jsx)(k5,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,I.jsx)(D9,{label:LEe(),help:iDe()})]}),g&&f!==null&&(0,I.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,I.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,I.jsx)(Fm,{"aria-hidden":!0}),KDe({reason:f.reason??`?`})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(O9,{label:jDe(),result:f.inbound}),(0,I.jsx)(O9,{label:PDe(),result:f.outbound}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:ODe()})]}):(0,I.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,I.jsx)(Fm,{"aria-hidden":!0}),UDe()]})}),(0,I.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[g&&(0,I.jsxs)(X,{variant:`outline`,size:`sm`,onClick:()=>void _(),disabled:u,children:[u?(0,I.jsx)(Tm,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?SDe():yDe()]}),(0,I.jsx)(X,{size:`sm`,onClick:()=>void y(),disabled:c,children:BEe()})]})]})]})]})}function r7e({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,I.jsxs)(k1,{children:[(0,I.jsx)(A1,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Pqe():Lqe({count:e.length}),(0,I.jsx)(pm,{size:13,"aria-hidden":!0})]})}),(0,I.jsxs)(j1,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,I.jsx)(`p`,{className:`oc-compat__versions-title`,children:Bqe()}),(0,I.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,I.jsx)($,{variant:`secondary`,children:e},e))})]})]})}function i7e({state:e}){return e===`connected`?(0,I.jsx)($,{variant:`secondary`,children:IOe()}):e===`error`?(0,I.jsx)($,{variant:`destructive`,children:zOe()}):(0,I.jsx)($,{variant:`outline`,children:HOe()})}var k9=[{id:`personal`,label:()=>AHe(),tabs:[`preferences`,`theme`,`files`]},{id:`agents`,label:()=>NHe(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`bridge`]},{id:`access`,label:()=>IHe(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`]},{id:`observability`,label:()=>zHe(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`integrations`]}],a7e=new Map(k9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function A9(e){let t=a7e.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function o7e(e,t){return e.find(e=>A9(e)===t)}k9.flatMap(e=>[...e.tabs]);function s7e(){let e=P(V.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.known?e.available?`ok`:`error`:`idle`,n=e.known?e.available?`${cNe()}${e.checkedAt?dNe({time:new Date(e.checkedAt).toLocaleTimeString(`fr-FR`)}):``}`:mNe({reason:e.reason??`?`}):aNe();return(0,I.jsx)(b9,{delayDuration:150,children:(0,I.jsxs)(x9,{children:[(0,I.jsx)(S9,{asChild:!0,children:(0,I.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${t}`,role:`img`,"aria-label":n})}),(0,I.jsx)(C9,{children:n})]})})}var c7e={users:()=>dRe(),groups:()=>WRe(),instances:()=>mRe(),bridge:()=>_Re(),serviceAccounts:()=>bRe(),roles:()=>CRe(),traces:()=>ERe(),kpi:()=>kRe(),anomalies:()=>MRe(),files:()=>BA(),agentFiles:()=>zWe(),preferences:()=>Qk(),chatDefaults:()=>CKe(),access:()=>qRe(),integrations:()=>FRe(),theme:()=>UM(),audit:()=>RRe(),feedbacks:()=>VRe()};function j9(e){let t=new Set(s7),n=new Set,r=[];for(let i of e??[])t.has(i)&&!n.has(i)&&(r.push(i),n.add(i));for(let e of s7)n.has(e)||r.push(e);return r}function l7e(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function u7e({tab:e,active:t}){let n=c7e[e]?.()??l7[e]??e,r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,I.jsx)(s7e,{}):null]});return c7.includes(e)?(0,I.jsx)(xs,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,I.jsx)(xs,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function d7e({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=s5({id:e});return(0,I.jsxs)(`div`,{ref:i,style:{transform:I6.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,I.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":vHe(),...n,...r,children:(0,I.jsx)(Cm,{size:14,"aria-hidden":!0})}),(0,I.jsx)(u7e,{tab:e,active:t})]})}function f7e(){let e=P(V.me.getMe,{host:YO}),t=F(V.me.setSettingsTabOrder),n=m7(Gs({select:e=>e.pathname})),r=n===void 0?void 0:A9(n),i=(0,N.useMemo)(()=>j9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,N.useState)(i);(0,N.useEffect)(()=>o(i),[i]);let s=(0,N.useMemo)(()=>new Set(f7(e?.permissions??[])),[e?.permissions]),c=(0,N.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&A9(e)===r),[a,s,r]),l=H6(V6(S8,{activationConstraint:{distance:5}}),V6(v8,{coordinateGetter:l5}));if(r===void 0||c.length===0)return null;let u=k9.find(e=>e.id===r);function d(e){let{active:n,over:r}=e;if(!r||n.id===r.id)return;let i=c.indexOf(n.id),s=c.indexOf(r.id);if(i<0||s<0)return;let l=l7e(a,Z8(c,i,s));o(l),t({order:l})}return(0,I.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,I.jsx)(K8,{sensors:l,collisionDetection:J4e,modifiers:[i6e],onDragEnd:d,children:(0,I.jsx)(a5,{items:c,strategy:d6e,children:c.map(e=>(0,I.jsx)(d7e,{tab:e,active:e===n},e))})})})}function p7e(){let e=P(V.me.getMe,{host:YO}),t=ss(),n=m7(Gs({select:e=>e.pathname})),r=n===void 0?void 0:A9(n),i=(0,N.useMemo)(()=>new Set(f7(e?.permissions??[])),[e?.permissions]),a=(0,N.useMemo)(()=>j9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=k9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=o7e(a,e.id);n&&t({to:p7(n)})}return(0,I.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":xHe(),children:[(0,I.jsx)(xs,{to:`/`,className:`oc-settings-nav__back`,children:wHe()}),(0,I.jsx)(`div`,{className:`oc-settings-nav__title`,children:DHe()}),(0,I.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,I.jsx)(`button`,{type:`button`,className:`oc-settings-nav__group`+(e.id===r?` is-active`:``),"aria-current":e.id===r?`true`:void 0,onClick:()=>s(e),children:e.label()},e.id))})]})}var m7e=12*1024*1024,h7e=480,g7e=160,_7e=.92;async function v7e(e,t={}){if(!e.type.startsWith(`image/`))throw Error(BF());if(e.size>m7e)throw Error(UF());let{source:n,width:r,height:i,cleanup:a}=await y7e(e);try{let a=e.type===`image/svg+xml`,o=Math.min(h7e/r,g7e/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(YF());if(u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c),t.invert){let e=u.getImageData(0,0,s,c),t=e.data;for(let e=0;e<t.length;e+=4)t[e]=255-t[e],t[e+1]=255-t[e+1],t[e+2]=255-t[e+2];u.putImageData(e,0,0)}let d=await N9(l,`image/webp`,_7e)??await N9(l,`image/png`);if(!d)throw Error(QF());return d}finally{a()}}async function y7e(e){if(e.type===`image/svg+xml`)return M9(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return M9(e)}async function M9(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(KF())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function N9(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var P9=`__all__`,F9={kind:`relative`,from:`now-24h`,to:`now`},b7e=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function I9({title:e,description:t,children:n}){return(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,I.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function x7e(e){return e===`light`?Lk():e===`dark`?Bk():Uk()}var S7e=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function C7e({tokens:e,mode:t}){let n=e.colors[t];return(0,I.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:S7e.map(e=>{let t=n[e];return(0,I.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function L9({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,I.jsxs)(`button`,{type:`button`,className:x1(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,I.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,I.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,I.jsx)(fm,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,I.jsx)(C7e,{tokens:r,mode:i}):(0,I.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,I.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,I.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]})}function w7e({selectedKey:e,resolvedMode:t}){let n=P(V.charts.listMyCharts),r=F(V.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:gN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:yN()})]}),(0,I.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,I.jsx)(L9,{selected:e===null,title:SN(),subtitle:TN(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?ON():n.via===`owner`?jN():PN({group:n.via.group});return(0,I.jsx)(L9,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key)},n.key)})]}),n!==void 0&&n.length===0?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:LN()}):null]})}function T7e(){let e=F(V.charts.importChart),[t,n]=(0,N.useState)(``),[r,i]=(0,N.useState)(``),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(KP())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(QP());return}let a;try{a=JSON.parse(r)}catch{o(KP());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!1)}}return(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:SP()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:TP()})]}),(0,I.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,I.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,I.jsx)(`span`,{className:`oc-chart-import__label`,children:OP()}),(0,I.jsx)(I1,{value:t,onChange:e=>n(e.target.value),placeholder:jP(),maxLength:60})]}),(0,I.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,I.jsx)(`span`,{className:`oc-chart-import__label`,children:PP()}),(0,I.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:LP(),rows:8,spellCheck:!1})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(X,{variant:`outline`,size:`sm`,asChild:!0,children:(0,I.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,I.jsx)(Im,{className:`size-4`}),BP(),(0,I.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,I.jsx)(X,{size:`sm`,disabled:l,onClick:()=>void f(),children:UP()})]}),a?(0,I.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,I.jsx)(`p`,{className:`oc-chart-import__ok`,children:YP()}):null]})]})}function E7e({chartKey:e,myGroups:t,restricted:n}){let r=F(V.charts.assignChartToGroup),i=F(V.charts.removeChartFromGroup),a=new Set((n??[]).map(e=>e.groupId)),o=t.filter(e=>!a.has(e.groupId));async function s(t){try{await r({groupId:t,chartKey:e})}catch{}}async function c(t){try{await i({groupId:t,chartKey:e})}catch{}}return(0,I.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,I.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:jI()}),(n??[]).map(e=>(0,I.jsxs)($,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,I.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":BI({group:e.name}),onClick:()=>void c(e.groupId),children:(0,I.jsx)(zm,{className:`size-3`})})]},e.groupId)),t.length===0?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:PI()}):o.length>0?(0,I.jsxs)(M3,{value:``,onValueChange:e=>void s(e),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-56`,children:(0,I.jsx)(N3,{placeholder:LI()})}),(0,I.jsx)(F3,{children:o.map(e=>(0,I.jsx)(Q,{value:e.groupId,children:e.name},e.groupId))})]}):null]})}function D7e({chart:e}){let t=$n(V.charts.setChartLogo),n=F(V.charts.removeChartLogo),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a=!1){if(e.chartId!==void 0){o(null),i(!0);try{let i=await(await v7e(r,{invert:a})).arrayBuffer();await t({chartId:e.chartId,bytes:i,mode:n})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),!0)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,I.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,I.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?yF():SF()}),(0,I.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,I.jsx)(`img`,{src:t,alt:``}):null}),(0,I.jsx)(X,{variant:`outline`,size:`sm`,asChild:!0,children:(0,I.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,I.jsx)(Im,{className:`size-4`}),t?OF():TF(),(0,I.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,I.jsx)(X,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:PF()}):null,t?(0,I.jsx)(X,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:jF()}):null]})}return(0,I.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,I.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:gF()}),(0,I.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,I.jsx)(f,{mode:`light`}),(0,I.jsx)(f,{mode:`dark`})]}),r?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:LF()}):null,a?(0,I.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function R9({chart:e}){let t=P(V.me.getMe,{host:YO}),n=F(V.charts.addChartDomain),r=F(V.charts.removeChartDomain),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,I.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,I.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:tI()}),(0,I.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,I.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:pI()}):u.map(e=>(0,I.jsxs)($,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,I.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":gI({domain:e}),onClick:()=>void f(e),children:(0,I.jsx)(zm,{className:`size-3`})})]},e))}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(I1,{value:i,onChange:e=>a(e.target.value),placeholder:sI(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,I.jsx)(X,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:uI()})]}),(0,I.jsx)(`span`,{className:`oc-show__desc`,children:iI()}),o?(0,I.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function O7e({chart:e,myGroups:t}){let n=F(V.charts.updateChart),r=F(V.charts.deleteChart),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(e.name),[c,l]=(0,N.useState)(()=>JSON.stringify(e.tokens,null,2)),[u,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(!1);function m(){s(e.name),l(JSON.stringify(e.tokens,null,2)),d(null),a(!0)}async function h(){if(e.chartId===void 0)return;d(null);let t;try{t=JSON.parse(c)}catch{d(KP());return}p(!0);try{await n({chartId:e.chartId,name:o.trim(),tokens:t}),a(!1)}catch(e){d(e instanceof Error?e.message:String(e))}finally{p(!1)}}async function g(){if(e.chartId!==void 0&&window.confirm(UI()))try{await r({chartId:e.chartId})}catch{}}return(0,I.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,I.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,I.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:i?null:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:m,children:uF()}),(0,I.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>void g(),children:pF()})]})})]}),i?(0,I.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,I.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,I.jsx)(`span`,{className:`oc-chart-import__label`,children:TI()}),(0,I.jsx)(I1,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,I.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,I.jsx)(`span`,{className:`oc-chart-import__label`,children:OI()}),(0,I.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),u?(0,I.jsx)(`p`,{className:`oc-chart-import__error`,children:u}):null,(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(X,{size:`sm`,disabled:f,onClick:()=>void h(),children:yI()}),(0,I.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:SI()})]})]}):null,(0,I.jsx)(D7e,{chart:e}),(0,I.jsx)(R9,{chart:e}),(0,I.jsx)(E7e,{chartKey:e.key,myGroups:t,restricted:e.restrictedToGroups})]})}function k7e(){let e=P(V.charts.listMyCharts),t=P(V.groups.listMyGroups,{}),n=(e??[]).filter(e=>e.via===`owner`);return(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:tF()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:iF()})]}),e!==void 0&&n.length===0?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:sF()}):(0,I.jsx)(`div`,{className:`oc-chart-mine-list`,children:n.map(e=>(0,I.jsx)(O7e,{chart:e,myGroups:t??[]},e.key))})]})}function A7e({chart:e,groups:t}){let n=F(V.charts.assignChartToGroup),r=F(V.charts.removeChartFromGroup),i=e.restrictedToGroups,a=new Set((i??[]).map(e=>e.groupId)),o=t.filter(e=>!a.has(e._id));async function s(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function c(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,I.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,I.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,I.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,I.jsx)($,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?sP():e.kind===`custom`&&e.scope===`personal`?tL():iP()}),e.isGlobalDefault?(0,I.jsx)($,{variant:`default`,children:uP()}):null]}),(0,I.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(i??[]).map(e=>(0,I.jsxs)($,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,I.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":yP({group:e.name}),onClick:()=>void c(e.groupId),children:(0,I.jsx)(zm,{className:`size-3`})})]},e.groupId)),o.length>0?(0,I.jsxs)(M3,{value:``,onValueChange:e=>void s(e),children:[(0,I.jsx)(P3,{size:`sm`,className:`w-56`,children:(0,I.jsx)(N3,{placeholder:pP()})}),(0,I.jsx)(F3,{children:o.map(e=>(0,I.jsx)(Q,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:gP()}):null]})]})}function j7e({chart:e}){let t=F(V.charts.promoteChartToCommon),n=F(V.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(UI()))try{await n({chartId:e.chartId})}catch{}}return(0,I.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,I.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,I.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,I.jsx)($,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?iL():tL()}),e.ownerLabel?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:QI({owner:e.ownerLabel})}):null]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,I.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:sL()}):null,(0,I.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:uL()})]})]})}function M7e({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=F(V.admin.setDefaultThemeMode),i=F(V.admin.setDefaultLocale),a=F(V.charts.setDefaultChart),o=P(V.charts.listChartsAdmin),s=P(V.groups.listGroups,{}),c=e??`system`,l=t??`fr`;return(0,I.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h2`,{className:`oc-show__title`,children:uN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:pN()})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:BN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:UN()})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(X,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:SN()}),tk.map(e=>(0,I.jsx)(X,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,I.jsx)(X,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:KN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:YN()})]}),(0,I.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,I.jsx)(A7e,{chart:e,groups:s??[]},e.key))})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:QN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:tP()})]}),(0,I.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,I.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,I.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,I.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,I.jsx)(R9,{chart:e})]},e.key))})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:KI()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:YI()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:pL()}):(0,I.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,I.jsx)(j7e,{chart:e},e.key))})})()]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:KM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:YM()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,I.jsx)(X,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:x7e(e)},e))})]}),(0,I.jsxs)(`section`,{className:`oc-show__section`,children:[(0,I.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,I.jsx)(`h3`,{className:`oc-show__title`,children:QM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:tN()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,I.jsx)(X,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?PA():LA()},e))}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:iN()})]})]})}function N7e(){let e=P(V.me.getMe,{host:YO}),t=nk(e?.resolvedThemeMode);return(0,I.jsxs)(`div`,{className:`oc-appearance`,children:[(0,I.jsx)(w7e,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,I.jsx)(T7e,{}),(0,I.jsx)(k7e,{}),e?.role===`admin`?(0,I.jsx)(M7e,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function P7e(){let[e,t]=(0,N.useState)(!0),[n,r]=(0,N.useState)(`per-user`),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(P9),[c,l]=(0,N.useState)(P9),[u,d]=(0,N.useState)(F9),f=i!==``||o!==P9||c!==P9;function p(){a(``),s(P9),l(P9),d(F9)}return(0,I.jsxs)(`div`,{className:`oc-show`,children:[(0,I.jsx)(N7e,{}),(0,I.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,I.jsx)(`summary`,{className:`oc-show__title`,children:sN()}),(0,I.jsxs)(I9,{title:`Buttons`,description:`Variants`,children:[(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(X,{children:`Default`}),(0,I.jsx)(X,{variant:`secondary`,children:`Secondary`}),(0,I.jsx)(X,{variant:`outline`,children:`Outline`}),(0,I.jsx)(X,{variant:`ghost`,children:`Ghost`}),(0,I.jsx)(X,{variant:`destructive`,children:`Destructive`}),(0,I.jsx)(X,{variant:`link`,children:`Link`})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(X,{size:`sm`,children:`Small`}),(0,I.jsx)(X,{children:`Default`}),(0,I.jsx)(X,{size:`lg`,children:`Large`}),(0,I.jsx)(X,{size:`icon`,"aria-label":`more`,children:(0,I.jsx)(ym,{})}),(0,I.jsx)(X,{disabled:!0,children:`Disabled`})]})]}),(0,I.jsx)(I9,{title:`Badges`,children:(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)($,{children:`Default`}),(0,I.jsx)($,{variant:`secondary`,children:`Secondary`}),(0,I.jsx)($,{variant:`outline`,children:`Outline`}),(0,I.jsx)($,{variant:`destructive`,children:`Destructive`})]})}),(0,I.jsx)(I9,{title:`Inputs & selection`,children:(0,I.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,I.jsx)(I1,{placeholder:`Text input…`}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsxs)(M3,{value:n,onValueChange:r,children:[(0,I.jsx)(P3,{className:`w-56`,children:(0,I.jsx)(N3,{placeholder:`Select…`})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,I.jsx)(Q,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,I.jsxs)(`label`,{className:`oc-show__check`,children:[(0,I.jsx)(k5,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,I.jsx)(I9,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,I.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,I.jsxs)(q5,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,I.jsxs)(M3,{value:o,onValueChange:s,children:[(0,I.jsx)(P3,{size:`sm`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:P9,children:`Toutes directions`}),(0,I.jsx)(Q,{value:`inbound`,children:`inbound`}),(0,I.jsx)(Q,{value:`outbound`,children:`outbound`}),(0,I.jsx)(Q,{value:`internal`,children:`internal`})]})]}),(0,I.jsxs)(M3,{value:c,onValueChange:l,children:[(0,I.jsx)(P3,{size:`sm`,children:(0,I.jsx)(N3,{})}),(0,I.jsxs)(F3,{children:[(0,I.jsx)(Q,{value:P9,children:`Toutes sévérités`}),(0,I.jsx)(Q,{value:`info`,children:`info`}),(0,I.jsx)(Q,{value:`warn`,children:`warn`}),(0,I.jsx)(Q,{value:`critical`,children:`critical`})]})]})]}),(0,I.jsx)(Y5,{fields:b7e,onChange:()=>{}}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,I.jsx)(K5,{value:u,onChange:d})]})]})}),(0,I.jsx)(I9,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,I.jsxs)(S1,{children:[(0,I.jsx)(C1,{asChild:!0,children:(0,I.jsx)(X,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,I.jsx)(ym,{})})}),(0,I.jsxs)(w1,{align:`start`,children:[(0,I.jsx)(E1,{children:`Actions`}),(0,I.jsx)(D1,{}),(0,I.jsx)(T1,{children:`Edit`}),(0,I.jsx)(T1,{children:`Duplicate`}),(0,I.jsx)(D1,{}),(0,I.jsx)(T1,{variant:`destructive`,children:`Delete`})]})]})}),(0,I.jsx)(I9,{title:`Card`,children:(0,I.jsxs)(P7,{className:`w-80`,children:[(0,I.jsxs)(F7,{children:[(0,I.jsx)(I7,{children:`Instance`}),(0,I.jsx)(L7,{children:`Non-secret metadata only.`})]}),(0,I.jsx)(R7,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,I.jsxs)(z8e,{className:`gap-2`,children:[(0,I.jsx)(X,{size:`sm`,children:`Save`}),(0,I.jsx)(X,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,I.jsx)(I9,{title:`Table`,children:(0,I.jsxs)(A5,{children:[(0,I.jsx)(j5,{children:(0,I.jsxs)(N5,{children:[(0,I.jsx)(P5,{className:`w-8`,children:(0,I.jsx)(k5,{"aria-label":`select all`})}),(0,I.jsx)(P5,{children:`Name`}),(0,I.jsx)(P5,{children:`Mode`}),(0,I.jsx)(P5,{className:`text-right`,children:`Status`}),(0,I.jsx)(P5,{className:`w-8`})]})}),(0,I.jsx)(M5,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,I.jsxs)(N5,{children:[(0,I.jsx)(F5,{children:(0,I.jsx)(k5,{"aria-label":`select ${e.n}`})}),(0,I.jsx)(F5,{className:`font-medium`,children:e.n}),(0,I.jsx)(F5,{children:(0,I.jsx)($,{variant:`secondary`,children:e.m})}),(0,I.jsx)(F5,{className:`text-right`,children:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,I.jsx)(fm,{className:`size-3.5`}),` `,e.s]})}),(0,I.jsx)(F5,{children:(0,I.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,I.jsx)(ym,{})})})]},e.n))})]})}),(0,I.jsx)(I9,{title:`App fragments`,description:`Chat-specific components`,children:(0,I.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,I.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,I.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,I.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,I.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,I.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,I.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,I.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,I.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,I.jsx)(`span`,{className:`oc-run-status__dot`}),(0,I.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}var z9=`oc.theme`;function B9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function V9(e){(0,N.useEffect)(()=>{let t=e??localStorage.getItem(z9)??`system`;if(localStorage.setItem(z9,t),B9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>B9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}function F7e(e){(0,N.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=q()}catch{t=void 0}t!==e&&xk(e)},[e])}var H9=`oc.sidebar.width`,U9=`oc.sidebar.collapsed`,W9=200,G9=520,I7e=260;function K9(e){return Math.min(G9,Math.max(W9,e))}function L7e(){let[e,t]=(0,N.useState)(()=>{let e=Number(localStorage.getItem(H9));return e?K9(e):I7e}),[n,r]=(0,N.useState)(()=>localStorage.getItem(U9)===`1`);(0,N.useEffect)(()=>{localStorage.setItem(H9,String(e))},[e]),(0,N.useEffect)(()=>{localStorage.setItem(U9,n?`1`:`0`)},[n]);let i=(0,N.useCallback)(()=>r(e=>!e),[]),a=(0,N.useRef)(!1);return{width:e,collapsed:n,toggleCollapsed:i,startResize:(0,N.useCallback)(n=>{n.preventDefault(),a.current=!0;let r=n.clientX,i=e,o=e=>{a.current&&t(K9(i+(e.clientX-r)))},s=()=>{a.current=!1,window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),document.body.style.cursor=``,document.body.style.userSelect=``};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[e]),MIN_WIDTH:W9,MAX_WIDTH:G9}}function R7e(){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(mr,{children:(0,I.jsx)(`div`,{className:`oc-boot`,children:a$()})}),(0,I.jsx)(pr,{children:(0,I.jsx)(B7e,{})}),(0,I.jsx)(fr,{children:(0,I.jsx)(pYe,{children:(0,I.jsx)(V7e,{})})})]})}function z7e(){return(0,I.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,I.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,I.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,I.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,I.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`})]})}function B7e(){let{signIn:e}=Ir();V9(void 0);let t=P(V.charts.brandForHost,{host:YO}),n=QO(YO),r=t??n??null,i=nk(void 0);ik(r?.tokens??null,i),(0,N.useEffect)(()=>{t&&$O(YO,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?ak(a,i):null,s=a?.label??`Atrium`,c=P(V.me.authProviders),[l,u]=(0,N.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(uwe())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.anonymous;return(0,I.jsxs)(`div`,{className:`oc-signin`,children:[(0,I.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,I.jsx)(`polyline`,{className:`oc-signin__line`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,vectorEffect:`non-scaling-stroke`}),(0,I.jsx)(`polyline`,{className:`oc-signin__pulse`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,pathLength:`100`,vectorEffect:`non-scaling-stroke`})]}),(0,I.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,I.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,I.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,I.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,I.jsx)(`h1`,{className:`oc-signin__title`,children:pwe()}),(0,I.jsx)(`p`,{className:`oc-signin__subtitle`,children:gwe()}),(0,I.jsx)(`div`,{className:`oc-signin__providers`,children:c?.google?(0,I.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,I.jsx)(z7e,{}),(0,I.jsx)(`span`,{children:ywe()})]}):null}),l?(0,I.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,I.jsx)(`p`,{className:`oc-signin__error`,children:Swe()}):null,c?.anonymous?(0,I.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:Twe()}):null]})]})}function V7e(){let e=P(V.me.getMe,{host:YO}),t=F(V.me.bootstrap),n=ss();(0,N.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),V9(e?.resolvedThemeMode);let r=nk(e?.resolvedThemeMode);ik(e?.resolvedChartTokens,r),F7e(e?.resolvedLocale);let i=(0,N.useRef)(null);if((0,N.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,I.jsx)(`div`,{className:`oc-boot`,children:a$()});let a=e.name||e.email||Owe();return e.role===`pending`?(0,I.jsxs)(`div`,{className:`oc-shell`,children:[(0,I.jsx)(q9,{}),(0,I.jsx)(E5,{}),(0,I.jsxs)(`header`,{className:`oc-topbar`,children:[(0,I.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,I.jsx)(J9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,I.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,I.jsx)(D5,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,I.jsxs)(`div`,{className:`oc-pending`,children:[(0,I.jsx)(`h1`,{className:`oc-pending__title`,children:jwe()}),(0,I.jsx)(`p`,{className:`oc-pending__body`,children:Pwe()})]})]}):(0,I.jsx)(U7e,{canOpenSettings:f7(e.permissions??[]).length>0,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function q9(){let e=P(V.me.getImpersonation),t=F(V.admin.stopImpersonation);return!e||!e.impersonating?null:(0,I.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,I.jsx)(bm,{className:`size-4 shrink-0`}),(0,I.jsxs)(`span`,{className:`oc-imp__text`,children:[Lwe(),` `,(0,I.jsx)(`strong`,{children:e.targetLabel}),Bwe(),(0,I.jsx)(`strong`,{children:e.realLabel}),Uwe()]}),(0,I.jsx)(X,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:Kwe()})]})}function J9({brand:e,resolvedThemeMode:t}){let n=nk(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=ak(e,n),[o,s]=(0,N.useState)(!1);return(0,N.useEffect)(()=>s(!1),[a]),(0,I.jsxs)(I.Fragment,{children:[a!==null&&!o?(0,I.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,I.jsx)(sk,{className:`oc-brand__logo`}):null,(0,I.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function H7e({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,I.jsxs)(`header`,{className:`oc-topbar`,children:[(0,I.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,I.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":i?Ywe():Qwe(),onClick:a,children:i?(0,I.jsx)(Nee,{}):(0,I.jsx)(Mee,{})}),(0,I.jsx)(xs,{to:`/`,className:`oc-topbar__brand`,children:(0,I.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,I.jsx)(`div`,{className:`oc-topbar__search`,children:(0,I.jsx)(I6e,{})}),(0,I.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,I.jsx)(P6e,{}),(0,I.jsx)(D5,{label:e,mode:t})]})]})}function U7e({canOpenSettings:e,userLabel:t,themeMode:n,resolvedThemeMode:r,brand:i}){let{width:a,collapsed:o,toggleCollapsed:s,startResize:c}=L7e(),l=zs(),u=as({strict:!1}),d=ss(),f=!!l({to:`/settings`,fuzzy:!0});return(0,I.jsxs)(`div`,{className:`oc-shell`,children:[(0,I.jsx)(q9,{}),(0,I.jsx)(E5,{}),(0,I.jsx)(H7e,{userLabel:t,themeMode:n,resolvedThemeMode:r,brand:i,collapsed:o,onToggleSidebar:s}),(0,I.jsxs)(`div`,{className:`oc-workspace`,children:[o?null:(0,I.jsxs)(`div`,{className:`oc-sidebar-col`,style:{width:a,flex:`0 0 ${a}px`},children:[f?(0,I.jsx)(p7e,{}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(k6e,{activeChatId:u.chatId??null,onSelect:e=>void d({to:`/chat/$chatId`,params:{chatId:e}})}),e?(0,I.jsx)(X,{variant:`ghost`,className:`m-2 justify-start`,asChild:!0,children:(0,I.jsx)(xs,{to:`/settings`,children:tTe()})}):null]}),(0,I.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:c,role:`separator`,"aria-orientation":`vertical`,"aria-label":iTe()})]}),(0,I.jsx)(`main`,{className:`oc-main`,children:(0,I.jsx)(Fs,{})})]})]})}function W7e(){let e=P(V.me.getMe,{host:YO}),t=ss(),n=Gs({select:e=>e.pathname}),r=(0,N.useMemo)(()=>e?f7(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,N.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,I.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:a$()});if(i)return null;let a=m7(n),o=a!==void 0&&!r.includes(a);return(0,I.jsxs)(`div`,{className:`oc-admin`,children:[(0,I.jsx)(f7e,{}),(0,I.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,I.jsx)(G7e,{}):(0,I.jsx)(Fs,{})})]})}function G7e(){return(0,I.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,I.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,I.jsx)(Fm,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:sTe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:uTe()})]})}function K7e(){let e=P(V.me.getMe,{host:YO}),t=ss();return(0,N.useEffect)(()=>{if(e===void 0)return;let n=f7(e.permissions??[]);t({to:n.length>0?p7(n[0]):`/`,replace:!0})},[e,t]),(0,I.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:a$()})}function q7e(){let{tab:e}=as({from:`/settings/$tab`});switch(e){case`groups`:return(0,I.jsx)(E8e,{});case`integrations`:return(0,I.jsx)(s5e,{});case`instances`:return(0,I.jsx)(r8e,{});case`bridge`:return(0,I.jsx)(Y5e,{});case`theme`:return(0,I.jsx)(P7e,{});case`feedbacks`:return(0,I.jsx)(u5e,{});case`files`:return(0,I.jsx)(d5e,{});case`agentFiles`:return(0,I.jsx)(y5e,{});case`preferences`:return(0,I.jsx)(j5e,{});case`chatDefaults`:return(0,I.jsx)(P5e,{});case`access`:return(0,I.jsx)(R5e,{});default:return(0,I.jsx)(v8e,{})}}function J7e(){let{chatId:e}=as({from:`/chat/$chatId`});return(0,I.jsx)(o6,{chatId:e})}function Y7e(){return(0,I.jsx)(o6,{chatId:null})}var Y9=Es({component:R7e}),X7e=ws({getParentRoute:()=>Y9,path:`/`,component:Y7e}),Z7e=ws({getParentRoute:()=>Y9,path:`chat/$chatId`,component:J7e}),X9=ws({getParentRoute:()=>Y9,path:`settings`,component:W7e}),Q7e=ws({getParentRoute:()=>X9,path:`/`,component:K7e}),$7e=ws({getParentRoute:()=>X9,path:`traces`,validateSearch:q6e,component:F8e}),e9e=ws({getParentRoute:()=>X9,path:`audit`,validateSearch:J6e,component:o8e}),t9e=ws({getParentRoute:()=>X9,path:`anomalies`,validateSearch:Y6e,component:t5e}),n9e=ws({getParentRoute:()=>X9,path:`kpi`,validateSearch:X6e,component:W8e}),r9e=ws({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:Z6e,component:l8e}),i9e=ws({getParentRoute:()=>X9,path:`users`,validateSearch:Q6e,component:n8e}),a9e=ws({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw ia({to:`/settings/$tab`,params:{tab:e8e.uiprefs},replace:!0})}}),o9e=ws({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:Wp([...c7]).catch(`roles`).parse(e.tab)}),component:q7e});function s9e({reset:e}){let t=ss();return(0,I.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,I.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,I.jsx)(Fm,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:pTe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:gTe()}),(0,I.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,I.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>e(),children:yTe()}),(0,I.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void t({to:`/`}),children:o$()})]})]})}function c9e(){let e=ss();return(0,I.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,I.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,I.jsx)(Tee,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:wTe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:DTe()}),(0,I.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,I.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:o$()})})]})}var Z9=Vs({routeTree:Y9.addChildren([X7e,Z7e,X9.addChildren([Q7e,$7e,e9e,t9e,n9e,r9e,i9e,a9e,o9e])]),defaultPreload:`intent`,defaultErrorComponent:s9e,defaultNotFoundComponent:c9e});async function l9e(){try{let e=await fetch(`/config.json`,{cache:`no-store`});if(e.ok){let t=(await e.json())?.convexUrl;if(typeof t==`string`&&t.trim())return t.trim()}}catch{}throw Error(`No Convex URL configured: serve /config.json {"convexUrl":"…"} (production) or set VITE_CONVEX_URL (local dev).`)}var u9e=()=>null;function Q9({children:e}){return(0,I.jsx)(`div`,{style:{display:`flex`,minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}var $9=_r.createRoot(document.getElementById(`root`));$9.render((0,I.jsx)(N.StrictMode,{children:(0,I.jsx)(Q9,{children:`Chargement…`})})),l9e().then(e=>{let t=new Yn(e);$9.render((0,I.jsx)(N.StrictMode,{children:(0,I.jsx)(Lr,{client:t,children:(0,I.jsxs)(uYe,{children:[(0,I.jsx)(q2e,{children:(0,I.jsx)(Ws,{router:Z9})}),(0,I.jsx)(N.Suspense,{fallback:null,children:(0,I.jsx)(u9e,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,I.jsx)(N.StrictMode,{children:(0,I.jsxs)(Q9,{children:[`Configuration manquante\xA0:`,` `,e instanceof Error?e.message:String(e)]})}))});
|
package/dist/index.html
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
document.documentElement.dataset.ambiance = a === "off" ? "off" : "on";
|
|
39
39
|
})();
|
|
40
40
|
</script>
|
|
41
|
-
<script type="module" crossorigin src="/assets/index-
|
|
41
|
+
<script type="module" crossorigin src="/assets/index-CbyPyGMP.js"></script>
|
|
42
42
|
<link rel="stylesheet" crossorigin href="/assets/index-ChPpQEKt.css">
|
|
43
43
|
</head>
|
|
44
44
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|