@lacneu/atrium 0.1.4 → 0.1.5

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
  `},yQe={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 bQe(e){let{announcements:t=yQe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=vQe}=e,{announce:a,announcement:o}=hQe(),s=Y6(`DndLiveRegion`),[c,l]=(0,N.useState)(!1);if((0,N.useEffect)(()=>{l(!0)},[]),gQe((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(pQe,{id:r,value:i.draggable}),N.createElement(mQe,{id:s,announcement:o}));return n?(0,Uo.createPortal)(u,n):u}var i8;(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`})(i8||={});function a8(){}function o8(e,t){return(0,N.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function s8(){var e=[...arguments];return(0,N.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var c8=Object.freeze({x:0,y:0});function l8(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function xQe(e,t){let n=e8(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 u8(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function SQe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function d8(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 f8(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function p8(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 CQe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=p8(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=l8(p8(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(u8)},m8=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=d8(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=d8(r),o=i.reduce((e,t,r)=>e+l8(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(u8)};function wQe(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 TQe=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=wQe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(SQe)};function EQe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function h8(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:c8}function DQe(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 OQe=DQe(1);function g8(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 kQe(e,t,n){let r=g8(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 AQe={ignoreTransform:!1};function _8(e,t){t===void 0&&(t=AQe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=L6(e).getComputedStyle(e);t&&(n=kQe(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 v8(e){return _8(e,{ignoreTransform:!0})}function jQe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function MQe(e,t){return t===void 0&&(t=L6(e).getComputedStyle(e)),t.position===`fixed`}function NQe(e,t){t===void 0&&(t=L6(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 y8(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(R6(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!z6(i)||B6(i)||n.includes(i))return n;let a=L6(e).getComputedStyle(i);return i!==e&&NQe(i,a)&&n.push(i),MQe(i,a)?n:r(i.parentNode)}return e?r(e):n}function b8(e){let[t]=y8(e,1);return t??null}function x8(e){return!P6||!e?null:F6(e)?e:I6(e)?R6(e)||e===V6(e).scrollingElement?window:z6(e)?e:null:null}function S8(e){return F6(e)?e.scrollX:e.scrollLeft}function C8(e){return F6(e)?e.scrollY:e.scrollTop}function w8(e){return{x:S8(e),y:C8(e)}}var T8;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(T8||={});function E8(e){return!P6||!e?!1:e===document.scrollingElement}function D8(e){let t={x:0,y:0},n=E8(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 PQe={x:.2,y:.2};function FQe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=PQe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=D8(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=T8.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=T8.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=T8.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=T8.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function IQe(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 O8(e){return e.reduce((e,t)=>Z6(e,w8(t)),c8)}function LQe(e){return e.reduce((e,t)=>e+S8(t),0)}function RQe(e){return e.reduce((e,t)=>e+C8(t),0)}function k8(e,t){if(t===void 0&&(t=_8),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);b8(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var zQe=[[`x`,[`left`,`right`],LQe],[`y`,[`top`,`bottom`],RQe]],A8=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=y8(t),r=O8(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of zQe)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})}},j8=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 BQe(e){let{EventTarget:t}=L6(e);return e instanceof t?e:V6(e)}function M8(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 N8;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(N8||={});function P8(e){e.preventDefault()}function VQe(e){e.stopPropagation()}var F8;(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`})(F8||={});var I8={start:[F8.Space,F8.Enter],cancel:[F8.Esc],end:[F8.Space,F8.Enter,F8.Tab]},HQe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case F8.Right:return{...n,x:n.x+25};case F8.Left:return{...n,x:n.x-25};case F8.Down:return{...n,y:n.y+25};case F8.Up:return{...n,y:n.y-25}}},L8=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 j8(V6(t)),this.windowListeners=new j8(L6(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(N8.Resize,this.handleCancel),this.windowListeners.add(N8.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(N8.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&k8(n),t(c8)}handleKeyDown(e){if($6(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=I8,coordinateGetter:a=HQe,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}:c8;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Q6(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}=D8(n),p=IQe(n),m={x:Math.min(i===F8.Right?p.right-p.width/2:p.right,Math.max(i===F8.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===F8.Down?p.bottom-p.height/2:p.bottom,Math.max(i===F8.Down?p.top:p.top+p.height/2,u.y))},h=i===F8.Right&&!s||i===F8.Left&&!c,g=i===F8.Down&&!l||i===F8.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===F8.Right&&e<=d.x||i===F8.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===F8.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===F8.Down&&e<=d.y||i===F8.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===F8.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Z6(Q6(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()}};L8.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=I8,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 R8(e){return!!(e&&`distance`in e)}function z8(e){return!!(e&&`delay`in e)}var B8=class{constructor(e,t,n){n===void 0&&(n=BQe(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=V6(i),this.documentListeners=new j8(this.document),this.listeners=new j8(n),this.windowListeners=new j8(L6(i)),this.initialCoordinates=e8(r)??c8,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(N8.Resize,this.handleCancel),this.windowListeners.add(N8.DragStart,P8),this.windowListeners.add(N8.VisibilityChange,this.handleCancel),this.windowListeners.add(N8.ContextMenu,P8),this.documentListeners.add(N8.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(z8(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(R8(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(N8.Click,VQe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(N8.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=e8(e)??c8,s=Q6(n,o);if(!t&&a){if(R8(a)){if(a.tolerance!=null&&M8(s,a.tolerance))return this.handleCancel();if(M8(s,a.distance))return this.handleStart()}if(z8(a)&&M8(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===F8.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},UQe={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},V8=class extends B8{constructor(e){let{event:t}=e,n=V6(t.target);super(e,UQe,n)}};V8.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 WQe={move:{name:`mousemove`},end:{name:`mouseup`}},H8;(function(e){e[e.RightClick=2]=`RightClick`})(H8||={});var GQe=class extends B8{constructor(e){super(e,WQe,V6(e.event.target))}};GQe.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===H8.RightClick?!1:(r?.({event:n}),!0)}}];var U8={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},KQe=class extends B8{constructor(e){super(e,U8)}static setup(){return window.addEventListener(U8.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(U8.move.name,e)};function e(){}}};KQe.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 W8;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(W8||={});var G8;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(G8||={});function qQe(e){let{acceleration:t,activator:n=W8.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=G8.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=YQe({delta:d,disabled:!a}),[m,h]=cQe(),g=(0,N.useRef)({x:0,y:0}),_=(0,N.useRef)({x:0,y:0}),v=(0,N.useMemo)(()=>{switch(n){case W8.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case W8.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===G8.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}=FQe(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 JQe={x:{[T8.Backward]:!1,[T8.Forward]:!1},y:{[T8.Backward]:!1,[T8.Forward]:!1}};function YQe(e){let{delta:t,disabled:n}=e,r=q6(t);return G6(e=>{if(n||!r||!e)return JQe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[T8.Backward]:e.x[T8.Backward]||i.x===-1,[T8.Forward]:e.x[T8.Forward]||i.x===1},y:{[T8.Backward]:e.y[T8.Backward]||i.y===-1,[T8.Forward]:e.y[T8.Forward]||i.y===1}}},[n,t,r])}function XQe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return G6(e=>t==null?null:r??e??null,[r,t])}function ZQe(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 K8;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(K8||={});var q8;(function(e){e.Optimized=`optimized`})(q8||={});var J8=new Map;function QQe(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=W6(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=G6(t=>{if(d&&!n)return J8;if(!t||t===J8||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 A8(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 K8.Always:return!1;case K8.BeforeDragging:return n;default:return!n}}}function Y8(e,t){return G6(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function $Qe(e,t){return Y8(e,t)}function e$e(e){let{callback:t,disabled:n}=e,r=U6(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 X8(e){let{callback:t,disabled:n}=e,r=U6(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 t$e(e){return new A8(_8(e),e)}function Z8(e,t,n){t===void 0&&(t=t$e);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=e$e({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=X8({callback:a});return H6(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function n$e(e){return h8(e,Y8(e))}var Q8=[];function r$e(e){let t=(0,N.useRef)(e),n=G6(n=>e?n&&n!==Q8&&e&&t.current&&e.parentNode===t.current.parentNode?n:y8(e):Q8,[e]);return(0,N.useEffect)(()=>{t.current=e},[e]),n}function i$e(e){let[t,n]=(0,N.useState)(null),r=(0,N.useRef)(e),i=(0,N.useCallback)(e=>{let t=x8(e.target);t&&n(e=>e?(e.set(t,w8(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=x8(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,w8(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=>{x8(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,N.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Z6(e,t),c8):O8(e):c8,[e,t])}function $8(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!==c8;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Q6(e,n.current):c8}function a$e(e){(0,N.useEffect)(()=>{if(!P6)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 o$e(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 e5(e){return(0,N.useMemo)(()=>e?jQe(e):null,[e])}var t5=[];function s$e(e,t){t===void 0&&(t=_8);let[n]=e,r=e5(n?L6(n):null),[i,a]=(0,N.useState)(t5);function o(){a(()=>e.length?e.map(e=>E8(e)?r:new A8(t(e),e)):t5)}let s=X8({callback:o});return H6(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function n5(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return z6(t)?t:e}function c$e(e){let{measure:t}=e,[n,r]=(0,N.useState)(null),i=X8({callback:(0,N.useCallback)(e=>{for(let{target:n}of e)if(z6(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=K6((0,N.useCallback)(e=>{let n=n5(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 l$e=[{sensor:V8,options:{}},{sensor:L8,options:{}}],u$e={current:{}},r5={draggable:{measure:v8},droppable:{measure:v8,strategy:K8.WhileDragging,frequency:q8.Optimized},dragOverlay:{measure:_8}},i5=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}},d$e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new i5,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:a8},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:r5,measureDroppableContainers:a8,windowRect:null,measuringScheduled:!1},a5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:a8,draggableNodes:new Map,over:null,measureDroppableContainers:a8},o5=(0,N.createContext)(a5),s5=(0,N.createContext)(d$e);function f$e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new i5}}}function p$e(e,t){switch(t.type){case i8.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case i8.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 i8.DragEnd:case i8.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case i8.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new i5(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case i8.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 i5(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case i8.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new i5(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function m$e(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,N.useContext)(o5),a=q6(r),o=q6(n?.id);return(0,N.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!$6(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=dQe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function c5(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function h$e(e){return(0,N.useMemo)(()=>({draggable:{...r5.draggable,...e?.draggable},droppable:{...r5.droppable,...e?.droppable},dragOverlay:{...r5.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function g$e(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;H6(()=>{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=h8(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=b8(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var l5=(0,N.createContext)({...c8,scaleX:1,scaleY:1}),u5;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(u5||={});var d5=(0,N.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=l$e,collisionDetection:o=TQe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,N.useReducer)(p$e,void 0,f$e),[f,p]=_Qe(),[m,h]=(0,N.useState)(u5.Uninitialized),g=m===u5.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??u$e,rect:S},[_,x]),w=(0,N.useRef)(null),[T,E]=(0,N.useState)(null),[D,O]=(0,N.useState)(null),ee=W6(l,Object.values(l)),te=Y6(`DndDescribedBy`,t),k=(0,N.useMemo)(()=>b.getEnabled(),[b]),A=h$e(s),{droppableRects:j,measureDroppableContainers:ne,measuringScheduled:re}=QQe(k,{dragging:g,dependencies:[y.x,y.y],config:A.droppable}),M=XQe(v,_),ie=(0,N.useMemo)(()=>D?e8(D):null,[D]),ae=Ie(),oe=$Qe(M,A.draggable.measure);g$e({activeNode:_==null?null:v.get(_),config:ae.layoutShiftCompensation,initialRect:oe,measure:A.draggable.measure});let se=Z8(M,A.draggable.measure,oe),ce=Z8(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=c$e({measure:A.dragOverlay.measure}),fe=de.nodeRef.current??M,pe=g?de.rect??se:null,me=!!(de.nodeRef.current&&de.rect),he=n$e(me?null:se),ge=e5(fe?L6(fe):null),_e=r$e(g?ue??M:null),ve=s$e(_e),ye=c5(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?Z6(ie,y):null,xe=i$e(_e),Se=$8(xe),Ce=$8(xe,[se]),we=Z6(ye,Se),Te=pe?OQe(pe,ye):null,Ee=C&&Te?o({active:C,collisionRect:Te,droppableRects:j,droppableContainers:k,pointerCoordinates:be}):null,De=f8(Ee,`id`),[Oe,ke]=(0,N.useState)(null),Ae=EQe(me?ye:Z6(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,Uo.unstable_batchedUpdates)(()=>{r?.(i),h(u5.Initializing),d({type:i8.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(je.current),O(a)})},onMove(e){d({type:i8.DragMove,coordinates:e})},onEnd:o(i8.DragEnd),onCancel:o(i8.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===i8.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=i8.DragCancel)}w.current=null,(0,Uo.unstable_batchedUpdates)(()=>{d({type:e}),h(u5.Uninitialized),ke(null),E(null),O(null),je.current=null;let t=e===i8.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=ee.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ne=ZQe(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]));a$e(a),H6(()=>{se&&m===u5.Initializing&&h(u5.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,Uo.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,Uo.unstable_batchedUpdates)(()=>{ke(s),a?.(c),f({type:`onDragOver`,event:c})})},[De]),H6(()=>{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]),qQe({...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(r8.Provider,{value:p},N.createElement(o5.Provider,{value:Fe},N.createElement(s5.Provider,{value:Pe},N.createElement(l5.Provider,{value:Ae},i)),N.createElement(m$e,{disabled:n?.restoreFocus===!1})),N.createElement(bQe,{...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}}}),_$e=(0,N.createContext)(null),f5=`button`,v$e=`Draggable`;function y$e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Y6(v$e),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,N.useContext)(o5),{role:p=f5,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,N.useContext)(g?l5:_$e),[v,y]=K6(),[b,x]=K6(),S=o$e(o,t),C=W6(n);return H6(()=>(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===f5?!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 p5(){return(0,N.useContext)(s5)}var b$e=`Droppable`,x$e={timeout:25};function m5(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Y6(b$e),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,N.useContext)(o5),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}={...x$e,...i},_=W6(h??r),v=X8({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]=K6((0,N.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=W6(t);return(0,N.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,N.useEffect)(()=>(s({type:i8.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:i8.UnregisterDroppable,key:a,id:r})),[r]),(0,N.useEffect)(()=>{n!==u.current.disabled&&(s({type:i8.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 S$e(e){let{animation:t,children:n}=e,[r,i]=(0,N.useState)(null),[a,o]=(0,N.useState)(null),s=q6(n);return!n&&!r&&s&&i(s),H6(()=>{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 C$e={x:0,y:0,scaleX:1,scaleY:1};function w$e(e){let{children:t}=e;return N.createElement(o5.Provider,{value:a5},N.createElement(l5.Provider,{value:C$e},t))}var T$e={position:`fixed`,touchAction:`none`},E$e=e=>$6(e)?`transform 250ms ease`:void 0,D$e=(0,N.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=E$e}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...T$e,width:s.width,height:s.height,top:s.top,left:s.left,transform:t8.Transform.toString(d),transformOrigin:i&&r?xQe(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return N.createElement(n,{className:o,style:f,ref:t},a)}),O$e={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:t8.Transform.toString(t)},{transform:t8.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 k$e(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return U6((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=n5(a);if(!c)return;let{transform:l}=L6(a).getComputedStyle(a),u=g8(l);if(!u)return;let d=typeof t==`function`?t:A$e(t);return k8(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 A$e(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...O$e,...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 h5=0;function j$e(e){return(0,N.useMemo)(()=>{if(e!=null)return h5++,h5},[e])}var M$e=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}=p5(),S=(0,N.useContext)(l5),C=j$e(d?.id),w=c5(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=Y8(f),E=k$e({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return N.createElement(w$e,null,N.createElement(S$e,{animation:E},d&&C?N.createElement(D$e,{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))}),N$e=e=>{let{transform:t}=e;return{...t,y:0}};function P$e(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 F$e=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:P$e(n,t,i)},I$e=e=>{let{transform:t}=e;return{...t,x:0}};function g5(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function L$e(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function _5(e){return e!==null&&e>=0}function R$e(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 z$e(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var v5={scaleX:1,scaleY:1},B$e=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=V$e(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,...v5}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...v5}:a<r&&a>=i?{x:o.width+s,y:0,...v5}:{x:0,y:0,...v5}};function V$e(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 y5=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=g5(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}},b5={scaleX:1,scaleY:1},H$e=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,...b5}:null}let s=U$e(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...b5}:r<t&&r>=a?{x:0,y:o.height+s,...b5}:{x:0,y:0,...b5}};function U$e(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 x5=`Sortable`,S5=N.createContext({activeIndex:-1,containerId:x5,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:y5,disabled:{draggable:!1,droppable:!1}});function C5(e){let{children:t,id:n,items:r,strategy:i=y5,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=p5(),d=Y6(x5,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=!R$e(p,_.current),y=g!==-1&&h===-1||v,b=z$e(a);H6(()=>{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:L$e(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return N.createElement(S5.Provider,{value:x},t)}var W$e=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return g5(n,r,i).indexOf(t)},G$e=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},K$e={duration:200,easing:`ease`},w5=`transform`,T5=t8.Transition.toString({property:w5,duration:0,easing:`linear`}),q$e={roleDescription:`sortable`};function J$e(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,N.useState)(null),s=(0,N.useRef)(n);return H6(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=_8(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 E5(e){let{animateLayoutChanges:t=G$e,attributes:n,disabled:r,data:i,getNewIndex:a=W$e,id:o,strategy:s,resizeObserverConfig:c,transition:l=K$e}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,N.useContext)(S5),y=Y$e(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}=m5({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}=y$e({id:o,data:x,attributes:{...q$e,...n},disabled:y.draggable}),ie=sQe(E,k),ae=!!D,oe=ae&&!m&&_5(f)&&_5(g),se=!_&&j,ce=oe?(se&&oe?M:null)??(s??v)({rects:h,activeNodeRect:ee,activeIndex:f,overIndex:g,index:b}):null,le=_5(f)&&_5(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=J$e({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 T5;if(!(se&&!$6(O)||!l)&&(ae||pe))return t8.Transition.toString({...l,property:w5})}}function Y$e(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function D5(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 X$e=[F8.Down,F8.Right,F8.Up,F8.Left],O5=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(X$e.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 F8.Down:r.top<a.top&&t.push(n);break;case F8.Up:r.top>a.top&&t.push(n);break;case F8.Left:r.left>a.left&&t.push(n);break;case F8.Right:r.left<a.left&&t.push(n);break}});let c=m8({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=f8(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=y8(c).some((e,t)=>s[t]!==e),i=k5(e,t),a=Z$e(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:Q6(u,l)}}}};function k5(e,t){return!D5(e)||!D5(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Z$e(e,t){return!D5(e)||!D5(t)||!k5(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function A5({open:e,onOpenChange:t,title:n,description:r,children:i,onSubmit:a,submitLabel:o=`Enregistrer`,submitting:s=!1,canSubmit:c=!0}){return(0,I.jsx)(m6,{open:e,onOpenChange:t,children:(0,I.jsxs)(h6,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,I.jsxs)(g6,{className:`border-b px-6 py-4`,children:[(0,I.jsx)(v6,{children:n}),r?(0,I.jsx)(y6,{children:r}):null]}),(0,I.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),c&&!s&&a()},children:[(0,I.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:i}),(0,I.jsxs)(_6,{className:`border-t px-6 py-4`,children:[(0,I.jsx)(Y,{type:`submit`,disabled:!c||s,children:o}),(0,I.jsx)(Y,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:`Annuler`})]})]})]})})}var Q$e=e0(`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?yy:`span`,{"data-slot":`badge`,"data-variant":t,className:V1(Q$e({variant:t}),e),...r})}function $$e(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 e1e(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 t1e({open:e,onOpenChange:t,agents:n,onPick:r}){let[i,a]=(0,N.useState)(``),o=(0,N.useMemo)(()=>$$e(e1e(n??[],i)),[n,i]);return(0,I.jsx)(d0,{open:e,onOpenChange:t,children:(0,I.jsxs)(f0,{className:`oc-agentpicker`,children:[(0,I.jsxs)(p0,{children:[(0,I.jsx)(h0,{children:Uke()}),(0,I.jsx)(g0,{children:Kke()})]}),n===void 0?(0,I.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Yke()}):n.length===0?(0,I.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Qke()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n0,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:tAe(),className:`oc-agentpicker__search`,"aria-label":iAe()}),(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)(wm,{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`?sAe():void 0,children:[(0,I.jsx)(om,{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)(Em,{size:13,"aria-label":uAe(),className:`oc-agentpicker__default`}):null]},`${e.instanceName}/${e.agentId}`))]},e.instanceName))})]})]})})}var j5=6e4,M5=60*j5,N5=24*M5,P5=7*N5,F5=30*N5,I5=365*N5;function n1e(e,t){let n=t-e;if(n<j5)return`maintenant`;if(n<M5)return`${Math.floor(n/j5)}min`;if(n<N5)return`${Math.floor(n/M5)}h`;if(n<P5)return`${Math.floor(n/N5)}j`;if(n<F5)return`${Math.floor(n/P5)}sem`;if(n<I5)return`${Math.floor(n/F5)}mois`;let r=Math.floor(n/I5);return`${r}an${r>1?`s`:``}`}var L5=[{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)`}],R5=e=>L5.find(t=>t.value===e)?.hue??null,z5=`project:none`,r1e=e=>`project:${e}`,B5=`oc.noproject.collapsed`;function i1e({activeChatId:e,onSelect:t}){let n=P(B.messages.listChats,{}),r=P(B.projects.listProjects,{}),i=P(B.me.getMe)?.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(B.chats.createChat),d=F(B.projects.createProject),f=F(B.projects.setProjectCollapsed),p=F(B.chats.reorderChat),m=F(B.chats.moveChatToProject),h=b0(),g=P(B.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(B5)===`1`);function ee(){O(e=>(localStorage.setItem(B5,e?`0`:`1`),!e))}let te=s8(o8(V8,{activationConstraint:{distance:4}}),o8(L8,{coordinateGetter:O5})),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===z5?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)(t1e,{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)(Y,{className:`flex-1 justify-start`,onClick:()=>void b(),children:[(0,I.jsx)(xm,{}),` `,xEe()]}),(0,I.jsx)(Y,{variant:`outline`,size:`icon`,"aria-label":F$(),onClick:async()=>{let e=await h({title:F$(),label:EEe(),placeholder:kEe(),confirmLabel:MEe()});e&&await d({name:e})},children:(0,I.jsx)(dee,{})})]}),(0,I.jsxs)(d5,{sensors:te,collisionDetection:m8,modifiers:[I$e,F$e],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)(V5,{label:FEe(),chats:k,children:k.map(n=>(0,I.jsx)(U5,{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)(V5,{label:n.name,dropId:r1e(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:REe()}):i.map(n=>(0,I.jsx)(U5,{chat:n,active:n._id===e,projects:r??[],onSelect:t,showProviderBadge:c},n._id))},n._id)}),(0,I.jsx)(V5,{label:VEe(),dropId:z5,chats:j(null),collapsible:!0,collapsed:D,onToggle:ee,children:D?null:j(null).map(n=>(0,I.jsx)(U5,{chat:n,active:n._id===e,projects:r??[],onSelect:t,showProviderBadge:c},n._id))})]}),(0,I.jsx)(M$e,{children:M?(0,I.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[(0,I.jsx)(gm,{className:`size-3.5 opacity-60`}),R5(M.color)?(0,I.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:R5(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||I$()})]}):null})]})]})}function V5({label:e,dropId:t,projectId:n,chats:r,collapsible:i,collapsed:a,onToggle:o,children:s}){let c=F(B.projects.deleteProject),l=y0(),u=P(B.projects.projectChatCount,n?{projectId:n}:`skip`),{setNodeRef:d,isOver:f}=m5({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)(lm,{className:`size-3.5`}):(0,I.jsx)(cm,{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":L$(),onClick:async t=>{t.stopPropagation();let r=u??0;await l({title:JEe({name:e}),description:r>0?ZEe({count:r}):eDe(),confirmWord:R$(),confirmLabel:L$(),destructive:!0})&&await c({projectId:n})},children:(0,I.jsx)(Dm,{className:`size-3.5`})}):null]}),(0,I.jsx)(C5,{items:r.map(e=>e._id),strategy:H$e,children:s})]})}var H5={openclaw:`OpenClaw`,hermes:`Hermes`};function U5({chat:e,active:t,projects:n,onSelect:r,showProviderBadge:i}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=E5({id:e._id}),d=F(B.chats.renameChat),f=F(B.chats.deleteChat),p=F(B.chats.pinChat),m=F(B.chats.setChatColor),h=P(B.me.getMe)?.ui?.effective?.showChatAge??!0,g=y0(),[_,v]=(0,N.useState)(!1),[y,b]=(0,N.useState)(e.title??``),x={transform:t8.Transform.toString(c),transition:l,opacity:+!u},S=R5(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":aDe(),...a,...o,children:(0,I.jsx)(gm,{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||I$()}),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:MDe({provider:H5[e.providerKind]}),children:H5[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:n1e(e.updatedAt,Date.now())}):null,(0,I.jsxs)(H1,{children:[(0,I.jsx)(U1,{asChild:!0,children:(0,I.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":cDe(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,I.jsx)(hm,{})})}),(0,I.jsxs)(W1,{align:`end`,className:`w-48`,children:[(0,I.jsxs)(G1,{onSelect:()=>{b(e.title??``),v(!0)},children:[(0,I.jsx)(xee,{}),` `,dDe()]}),(0,I.jsxs)(G1,{onSelect:()=>void p({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,I.jsx)(Cee,{}):(0,I.jsx)(See,{}),e.pinned?mDe():_De()]}),(0,I.jsx)(K1,{children:bDe()}),(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":CDe(),children:`✕`}),L5.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)(q1,{}),(0,I.jsxs)(G1,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await g({title:EDe(),description:kDe(),confirmLabel:R$(),destructive:!0})&&await f({chatId:e._id})})},children:[(0,I.jsx)(Dm,{}),` `,R$()]})]})]})]}),(0,I.jsx)(A5,{open:_,onOpenChange:v,title:FDe(),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:RDe()}),(0,I.jsx)(n0,{value:y,onChange:e=>b(e.target.value),autoFocus:!0})]})})})]})}var W5=[`admin`,`user`,`pending`];function G5(){let e=P(B.me.authProviders)?.anonymous===!0,[t,n]=(0,N.useState)(!1),r=P(B.dev.listUsersDev,e?{}:`skip`),i=P(B.me.getImpersonation),a=F(B.dev.setMyRole),o=F(B.dev.setRole),s=F(B.admin.startImpersonation),c=F(B.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:NTe(),children:[(0,I.jsx)(Am,{size:13}),`DEV`]}),(0,I.jsx)(d0,{open:t,onOpenChange:n,children:(0,I.jsxs)(f0,{children:[(0,I.jsxs)(p0,{children:[(0,I.jsx)(h0,{children:ITe()}),(0,I.jsx)(g0,{children:zTe()})]}),(0,I.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,I.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[HTe({canonical:l?.canonical??`…`}),` `,(0,I.jsx)($,{variant:`outline`,children:l?.role??`…`})]}),(0,I.jsx)(`div`,{className:`oc-devsw__roles`,children:W5.map(e=>(0,I.jsx)(Y,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?GTe():e===`user`?JTe():ZTe()},e))})]}),d?(0,I.jsxs)(`div`,{className:`oc-devsw__imp`,children:[eEe(),` `,(0,I.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,I.jsx)(Y,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:rEe()})]}):null,(0,I.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,I.jsx)(`p`,{className:`oc-devsw__empty`,children:oEe()}):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:W5.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))}),(0,I.jsx)(Y,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?fEe():hEe():lEe(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:vEe()})]},e.profileId))})]})})]})}function K5({label:e,mode:t,minimal:n=!1}){let{signOut:r}=gr(),i=F(B.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(B.me.getMe,{});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(B.me.getMe,{},{...n,themeMode:t,resolvedThemeMode:r})}),a=t??`default`;return(0,I.jsxs)(H1,{children:[(0,I.jsx)(U1,{asChild:!0,children:(0,I.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,I.jsx)(cm,{className:`opacity-60`})]})}),(0,I.jsx)(W1,{align:`end`,className:`w-52`,children:n?(0,I.jsxs)(G1,{onClick:()=>void r(),children:[(0,I.jsx)(vm,{}),` `,_k()]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(K1,{children:nk()}),(0,I.jsxs)(IUe,{value:a,onValueChange:e=>void i({mode:e==="default"?null:e}),children:[(0,I.jsxs)(J1,{value:`light`,children:[(0,I.jsx)(Eee,{}),` `,ak()]}),(0,I.jsxs)(J1,{value:`dark`,children:[(0,I.jsx)(_ee,{}),` `,ck()]}),(0,I.jsxs)(J1,{value:`system`,children:[(0,I.jsx)(gee,{}),` `,dk()]}),(0,I.jsx)(J1,{value:`default`,children:mk()})]}),(0,I.jsx)(q1,{}),(0,I.jsxs)(G1,{onClick:()=>void r(),children:[(0,I.jsx)(vm,{}),` `,_k()]})]})})]})}var a1e={altered_words:()=>XMe(),incorrect:()=>$Me(),incoherence:()=>nNe(),formatting:()=>aNe(),latency:()=>cNe(),api_error:()=>dNe(),other:()=>mNe()},o1e=e=>a1e[e]?.()??e,s1e={anomaly_open:Om,anomaly_resolved:dm,feedback_reply:ym};function c1e(e){return e.kind===`feedback_reply`?{title:WMe(),body:qMe()}:{title:e.title,body:e.body}}function l1e(){let e=P(B.notifications.myUnreadCount)??0,t=P(B.notifications.myNotifications),n=P(B.feedback.myFeedback),r=F(B.notifications.markRead),i=F(B.notifications.markAllRead),a=F(B.notifications.clearOne),o=F(B.notifications.clearAll),s=Vo(),[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)(H1,{open:c,onOpenChange:l,children:[(0,I.jsx)(U1,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?iMe({count:e}):sMe(),children:[(0,I.jsx)(am,{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:uMe()}),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:pMe()}),(0,I.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:gMe()})]}):null]}),t===void 0?(0,I.jsx)(`div`,{className:`oc-notif__empty`,children:$O()}):t.length===0?(0,I.jsx)(`div`,{className:`oc-notif__empty`,children:yMe()}):(0,I.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=s1e[e.kind]??am,{title:n,body:i}=c1e(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:B$(),"aria-label":B$(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,I.jsx)(sm,{size:13})}):null,(0,I.jsx)(`button`,{type:`button`,title:V$(),"aria-label":V$(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,I.jsx)(jm,{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(K())})]},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:EMe()}),(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:o1e(e.category)}),(0,I.jsx)(`span`,{className:`oc-notif__status${e.answered?` is-answered`:``}`,children:e.answered?kMe():MMe()})]}),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`?FMe():RMe()}),(0,I.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,(0,I.jsx)(ts,{to:`/chat/$chatId`,params:{chatId:e.chatId},className:`oc-notif__link`,onClick:()=>l(!1),children:VMe()})]},e._id))})]}):null]})]})}var q5=2,u1e=180;function d1e(){let e=Vo(),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),u1e);return()=>clearTimeout(e)},[a]);let d=s.trim(),f=P(B.search.searchConversations,d.length>=q5?{query:d}:`skip`),p=f??[],m=d.length>=q5&&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":QOe(),children:[(0,I.jsx)(Cm,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`oc-search-trigger__label`,children:tke()}),(0,I.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:`⌘K`})]}),(0,I.jsx)(d0,{open:r,onOpenChange:i,children:(0,I.jsxs)(f0,{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)(h0,{className:`sr-only`,children:ike()}),(0,I.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,I.jsx)(Cm,{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:ske(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":uke()})]}),(0,I.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:d.length<q5?(0,I.jsx)(`div`,{className:`oc-search-palette__hint`,children:pke({count:q5})}):m?(0,I.jsx)(`div`,{className:`oc-search-palette__hint`,children:gke()}):p.length===0?(0,I.jsx)(`div`,{className:`oc-search-palette__hint`,children:yke({term:d})}):p.map((e,t)=>(0,I.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:V1(`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)(fee,{size:15}):(0,I.jsx)(ym,{size:15})}),(0,I.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,I.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||Ske()}),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`?Tke():Oke()})]},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:`↓`}),` `,jke()]}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`kbd`,{children:`↵`}),` `,Pke()]}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`kbd`,{children:Lke()}),` `,Bke()]})]})]})})]})}function J5({className:e,...t}){return(0,I.jsx)(gS,{"data-slot":`checkbox`,className:V1(`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)(vS,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current`,children:t.checked===`indeterminate`?(0,I.jsx)(hee,{className:`size-3.5`}):(0,I.jsx)(sm,{className:`size-3.5`})})})}function f1e({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=P(B.admin.listInstances,n?{}:`skip`),a=P(B.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)(d0,{open:n,onOpenChange:r,children:(0,I.jsxs)(f0,{className:`oc-access`,children:[(0,I.jsxs)(p0,{children:[(0,I.jsx)(h0,{children:jSe({user:t})}),(0,I.jsx)(g0,{children:PSe()})]}),(0,I.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:LSe()}):i.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:BSe()}):i.map(t=>(0,I.jsx)(p1e,{profileId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:o,defaultKey:s?`${s.instanceName}/${s.agentId}`:null},t._id))})]})})}function p1e({profileId:e,instanceName:t,kind:n,assigned:r,defaultKey:i}){let a=P(B.agents.listAgentsForInstance,{instanceName:t}),o=F(B.agents.assignAgent),s=F(B.agents.removeAgent),c=F(B.agents.setDefaultAgent),l=S0();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(USe(),e)}}async function p(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(KSe(),e)}}return(0,I.jsxs)(`div`,{className:`oc-access__group`,children:[(0,I.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,I.jsx)(wm,{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:YSe()}):null]}),a===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:QSe()}):u.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:d?iCe():tCe()}):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)(J5,{checked:a,disabled:s&&!a,onCheckedChange:()=>void f(e.agentId,a),"aria-label":sCe({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:uCe()}):null,a?o?(0,I.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":j$(),title:j$(),children:(0,I.jsx)(Em,{size:14,fill:`currentColor`})}):(0,I.jsx)(Y,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":M$(),title:M$(),onClick:()=>void p(e.agentId),children:(0,I.jsx)(Em,{size:14})}):null]},e.agentId)})]})}function Y5({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:V1(`w-full caption-bottom text-sm`,e),...t})})}function X5({className:e,...t}){return(0,I.jsx)(`thead`,{"data-slot":`table-header`,className:V1(`[&_tr]:border-b`,e),...t})}function Z5({className:e,...t}){return(0,I.jsx)(`tbody`,{"data-slot":`table-body`,className:V1(`[&_tr:last-child]:border-0`,e),...t})}function Q5({className:e,...t}){return(0,I.jsx)(`tr`,{"data-slot":`table-row`,className:V1(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function $5({className:e,...t}){return(0,I.jsx)(`th`,{"data-slot":`table-head`,className:V1(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function e7({className:e,...t}){return(0,I.jsx)(`td`,{"data-slot":`table-cell`,className:V1(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}function t7({title:e,rows:t,columns:n,rowActions:r,onAdd:i,addLabel:a=yAe(),bulkActions:o,emptyHint:s=SAe(),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)(Y,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...u]),d(new Set)},children:[e.variant===`destructive`?(0,I.jsx)(Dm,{}):null,e.label,` (`,u.size,`)`]},e.label)):null,i?(0,I.jsxs)(Y,{size:`sm`,onClick:i,children:[(0,I.jsx)(xm,{}),` `,a]}):null]})]}),t===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:TAe()}):f.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:s}):(0,I.jsxs)(Y5,{children:[(0,I.jsx)(X5,{children:(0,I.jsxs)(Q5,{children:[o?(0,I.jsx)($5,{className:`w-8`,children:(0,I.jsx)(J5,{"aria-label":OAe(),checked:m?!0:h?`indeterminate`:!1,onCheckedChange:g})}):null,n.map(e=>(0,I.jsx)($5,{className:e.className,children:e.header},e.header)),r?(0,I.jsx)($5,{className:`w-8`}):null]})}),(0,I.jsx)(Z5,{children:f.map(e=>{let t=r?.(e)??[],i=c?.(e)??!1;return(0,I.jsxs)(N.Fragment,{children:[(0,I.jsxs)(Q5,{className:`group/row`,children:[o?(0,I.jsx)(e7,{children:(0,I.jsx)(J5,{"aria-label":jAe(),checked:u.has(e._id),onCheckedChange:()=>_(e._id)})}):null,n.map(t=>(0,I.jsx)(e7,{className:t.className,children:t.cell(e)},t.header)),r?(0,I.jsx)(e7,{children:t.length>0?(0,I.jsxs)(H1,{children:[(0,I.jsx)(U1,{asChild:!0,children:(0,I.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":PAe(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,I.jsx)(hm,{})})}),(0,I.jsx)(W1,{align:`end`,children:t.map((t,n)=>(0,I.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,I.jsx)(q1,{}):null,(0,I.jsx)(G1,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&l?(0,I.jsx)(Q5,{className:`oc-dt__expansion`,children:(0,I.jsx)(e7,{colSpan:p,className:`oc-dt__expansion-cell`,children:l(e)})}):null]},e._id)})})]})]})}var n7={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function r7(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=n7[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function i7(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:r7(e.from,t)??t-n7.h,to:r7(e.to,t)??t}}var a7=[{label:lwe(),from:`now-5m`},{label:fwe(),from:`now-15m`},{label:hwe(),from:`now-30m`},{label:vwe(),from:`now-1h`},{label:xwe(),from:`now-3h`},{label:wwe(),from:`now-6h`},{label:Dwe(),from:`now-12h`},{label:Awe(),from:`now-24h`},{label:Nwe(),from:`now-2d`},{label:Iwe(),from:`now-7d`},{label:zwe(),from:`now-30d`},{label:Hwe(),from:`now-90d`}];function o7(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function m1e(e){if(e.kind===`relative`){let t=a7.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${o7(e.from)} → ${o7(e.to)}`}function s7(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 c7(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function h1e(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}function l7(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}=i7(e);return e.kind===`absolute`?{from:t,to:n}:{from:u7(t),to:u7(n)}},[e,t])}function u7(e){return Math.floor(e/6e4)*6e4}function d7({value:e,onChange:t}){let[n,r]=(0,N.useState)(!1),[i,a]=(0,N.useState)(``),o=i7(e),[s,c]=(0,N.useState)(()=>s7(o.from)),[l,u]=(0,N.useState)(()=>s7(o.to));function d(t){if(t){let t=i7(e);c(s7(t.from)),u(s7(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=c7(s),n=c7(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===``?a7:a7.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=c7(s)!==null&&c7(l)!==null;return(0,I.jsxs)(OT,{open:n,onOpenChange:d,children:[(0,I.jsx)(kT,{asChild:!0,children:(0,I.jsxs)(Y,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,I.jsx)(oee,{}),m1e(e)]})}),(0,I.jsx)(AT,{children:(0,I.jsx)(jT,{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)(n0,{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)(n0,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,I.jsx)(Y,{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)(Cm,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,I.jsx)(n0,{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 g1e=250;function f7({q:e,onQChange:t,searchPlaceholder:n=pAe(),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),g1e)}(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)(Cm,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,I.jsx)(n0,{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)(d7,{value:i,onChange:a}):null,(0,I.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:f,disabled:!s,children:[(0,I.jsx)(Sm,{}),gAe()]})]})}var _1e=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:nOe()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],p7=1;function v1e(){return{id:p7++,field:``,op:`eq`,value:``}}function y1e(e){return e.map(e=>({id:p7++,field:e.field,op:e.op,value:String(e.value)}))}function m7({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?y1e(r.current):[]);function l(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:h1e(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,v1e()])}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)(cm,{className:`oc-advfilter__chevron`+(a?` is-open`:``),"aria-hidden":!0}),aOe(),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:cOe()}):(0,I.jsx)(`ul`,{className:`oc-advfilter__rows`,children:s.map(t=>(0,I.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,I.jsxs)(Q3,{value:t.field||void 0,onValueChange:e=>u(t.id,{field:e}),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-40`,children:(0,I.jsx)($3,{placeholder:dOe()})}),(0,I.jsx)(t6,{children:e.map(e=>(0,I.jsx)(Q,{value:e.value,children:e.label},e.value))})]}),(0,I.jsxs)(Q3,{value:t.op,onValueChange:e=>u(t.id,{op:e}),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-28`,children:(0,I.jsx)($3,{})}),(0,I.jsx)(t6,{children:_1e.map(e=>(0,I.jsx)(Q,{value:e.value,children:e.label},e.value))})]}),(0,I.jsx)(n0,{className:`oc-advfilter__value`,value:t.value,onChange:e=>u(t.id,{value:e.target.value}),placeholder:mOe()}),(0,I.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":_Oe(),onClick:()=>f(t.id),children:(0,I.jsx)(jm,{})})]},t.id))}),(0,I.jsxs)(Y,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:d,children:[(0,I.jsx)(xm,{}),bOe()]})]}):null]})}var b1e=[`eq`,`neq`,`contains`,`gt`,`gte`,`lt`,`lte`],h7=[50,100,200,500],g7=`now-30d`,x1e=`now-24h`;function _7(e,t,n=g7,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 v7(e){return e.kind===`absolute`?{from:String(e.from),to:String(e.to)}:{from:e.from,to:e.to}}function y7(e){if(e.length!==0)return JSON.stringify(e)}function b7(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`||!b1e.includes(i)||typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`||n.push({field:r,op:i,value:a})}return n}var x7=Hf().optional(),S7=Hf().optional(),C7=Hf().optional(),w7=Hf().optional().catch(void 0),S1e=yp({q:x7,kind:Hf().default(`all`).catch(`all`),limit:Zp().pipe(xp([Dp(h7[0]),Dp(h7[1]),Dp(h7[2]),Dp(h7[3])])).catch(100),statusClass:Tp([`2xx`,`4xx`,`5xx`]).optional().catch(void 0),principalType:Tp([`user`,`service`,`system`]).optional().catch(void 0),direction:Tp([`inbound`,`outbound`,`internal`]).optional().catch(void 0),roleKey:w7,from:S7,to:S7,adv:C7}),C1e=yp({q:x7,action:w7,impersonated:Tp([`yes`,`no`]).optional().catch(void 0),resource:w7,from:S7,to:S7,adv:C7}),w1e=yp({q:x7,status:Tp([`open`,`acknowledged`,`resolved`,`all`]).default(`open`).catch(`open`),severity:Tp([`info`,`warn`,`critical`]).optional().catch(void 0),kind:w7,from:S7,to:S7}),T1e=yp({from:S7,to:S7}),E1e=yp({q:x7,status:Tp([`active`,`disabled`]).optional().catch(void 0)}),D1e=yp({q:x7,role:w7});yp({q:x7,mode:Tp([`per-user`,`shared`]).optional().catch(void 0)});var O1e={kind:`relative`,from:g7,to:`now`},T7=`__all__`,E7=[`users`,`groups`,`instances`,`bridge`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`],D7=[`groups`,`access`,`roles`,`integrations`,`instances`,`bridge`,`theme`,`feedbacks`,`files`,`agentFiles`,`preferences`,`chatDefaults`],O7={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`},k7={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`},A7=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`];function j7(e){let t=new Set(e);return E7.filter(e=>t.has(k7[e]))}function M7(e){return`/settings/${e}`}function N7(e){let t=e.split(`/`)[2];return E7.includes(t)?t:void 0}var k1e={uiprefs:`preferences`};function A1e({granted:e,onToggle:t}){let n=new Set(e),r=A7.filter(e=>n.has(k7[e])).length;return(0,I.jsxs)(H1,{children:[(0,I.jsx)(U1,{asChild:!0,children:(0,I.jsx)(Y,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?_Z():bZ({count:r})})}),(0,I.jsxs)(W1,{align:`start`,className:`w-52`,children:[(0,I.jsx)(K1,{children:CZ()}),A7.map(e=>{let r=k7[e];return(0,I.jsxs)(G1,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,I.jsx)(J5,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,I.jsx)(`span`,{children:O7[e]??e})]},e)})]})]})}function j1e(){let e=Bo({from:`/settings/users`}),t=Vo({from:`/settings/users`}),n=e.q??``,r=e.role??T7,i=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),a=e=>void t({search:t=>({...t,role:e===T7?void 0:e})}),o=P(B.admin.listUsers,{filter:{q:n||void 0,role:r===T7?void 0:r}}),s=P(B.me.getMe),c=F(B.admin.setRole),l=F(B.admin.setUserPermissions),u=F(B.admin.startImpersonation),d=F(B.admin.deleteUser),f=F(B.admin.setUserName),p=y0(),m=b0(),h=S0(),[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!==T7;function b(){t({search:{},replace:!0})}async function x(e){try{await c(e)}catch(e){h.error(EZ(),e)}}async function S(e){try{await l(e)}catch(e){h.error(kZ(),e)}}async function C(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await p({title:XZ(),description:$Z({user:t}),confirmWord:nQ(),confirmLabel:aQ(),destructive:!0}))try{await d({profileId:e._id}),h.success(dQ({user:t}))}catch(e){h.error(cQ(),e)}}async function w(e){let t=e.email||e.name||e.userId.slice(0,8),n=await m({title:_Q(),label:bQ({user:t}),placeholder:CQ(),defaultValue:e.name??``,confirmLabel:b$()});if(n!==null)try{await f({profileId:e._id,name:n}),h.success(EQ())}catch(e){h.error(kQ(),e)}}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(f7,{q:n,onQChange:i,searchPlaceholder:MZ(),onReset:b,canReset:y,children:(0,I.jsxs)(Q3,{value:r,onValueChange:a,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-36`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:T7,children:FZ()}),v.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]})}),(0,I.jsx)(t7,{title:RZ(),rows:o,emptyHint:VZ(),rowActions:e=>{let t=[{label:mQ(),onSelect:()=>void w(e)}];return e.userId!==s?.userId&&t.push({label:WZ(),onSelect:()=>void u({profileId:e._id})},{label:qZ(),variant:`destructive`,onSelect:()=>void C(e)}),t},columns:[{header:MQ(),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:FQ(),cell:e=>(0,I.jsxs)(Q3,{value:e.role,onValueChange:t=>void x({profileId:e._id,role:t}),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-28`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{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:RQ(),cell:e=>e.role===`admin`?(0,I.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:VQ()}):(0,I.jsx)(A1e,{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:WQ(),cell:e=>(0,I.jsx)(Y,{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:qQ()})}]}),(0,I.jsx)(f1e,{profileId:g?.profileId??null,userLabel:g?.label??``,open:g!==null,onOpenChange:e=>{e||_(null)}})]})}var P7={name:``,gatewayUrl:``,displayName:``,kind:`openclaw`};function M1e(){let e=P(B.admin.listInstances,{}),t=F(B.admin.upsertInstance),n=F(B.admin.deleteInstance),r=S0(),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(P7),[c,l]=(0,N.useState)(null);async function u(){try{await t({name:o.name,gatewayUrl:o.gatewayUrl,displayName:o.displayName||void 0,kind:o.kind}),s(P7),a(!1)}catch(e){r.error(XQ(),e)}}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[$Q(),(0,I.jsx)(`strong`,{children:n$()}),a$()]}),(0,I.jsx)(t7,{title:c$(),rows:e,addLabel:d$(),onAdd:()=>{s(P7),a(!0)},emptyHint:m$(),columns:[{header:_$(),cell:e=>e.name},{header:Kue(),cell:e=>(0,I.jsx)($,{variant:`outline`,children:e.kind??`openclaw`})},{header:Yue(),cell:e=>e.gatewayUrl},{header:Que(),cell:e=>e.displayName??`—`},{header:WQ(),cell:e=>(0,I.jsx)(Y,{variant:`outline`,size:`sm`,className:`h-8 font-normal`,onClick:()=>l(e.name),children:tde()})}],rowActions:e=>[{label:y$(),variant:`destructive`,onSelect:()=>void n({instanceId:e._id})}],bulkActions:[{label:y$(),variant:`destructive`,onSelect:e=>e.forEach(e=>void n({instanceId:e}))}]}),(0,I.jsx)(A5,{open:i,onOpenChange:a,title:ode(),description:lde(),canSubmit:!!(o.name&&o.gatewayUrl),onSubmit:u,submitLabel:b$(),children:(0,I.jsxs)(`div`,{className:`oc-form`,children:[(0,I.jsx)(F7,{label:mde(),children:(0,I.jsx)(n0,{value:o.name,onChange:e=>s({...o,name:e.target.value})})}),(0,I.jsx)(F7,{label:_de(),children:(0,I.jsxs)(Q3,{value:o.kind,onValueChange:e=>s({...o,kind:e}),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-40`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:`openclaw`,children:`OpenClaw`}),(0,I.jsx)(Q,{value:`hermes`,children:`Hermes`})]})]})}),(0,I.jsx)(F7,{label:bde(),children:(0,I.jsx)(n0,{value:o.gatewayUrl,onChange:e=>s({...o,gatewayUrl:e.target.value})})}),(0,I.jsx)(F7,{label:Cde(),children:(0,I.jsx)(n0,{value:o.displayName,onChange:e=>s({...o,displayName:e.target.value})})})]})}),(0,I.jsx)(N1e,{instanceName:c,open:c!==null,onOpenChange:e=>{e||l(null)}})]})}function N1e({instanceName:e,open:t,onOpenChange:n}){let r=P(B.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`);return(0,I.jsx)(d0,{open:t,onOpenChange:n,children:(0,I.jsxs)(f0,{children:[(0,I.jsxs)(p0,{children:[(0,I.jsx)(h0,{children:Ede({name:e??``})}),(0,I.jsxs)(g0,{children:[kde(),(0,I.jsx)(`code`,{children:`agents.list`}),Mde()]})]}),r===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:Fde()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Rde():r.discovery.lastPollOk?Vde():Wde({error:r.discovery.error??`?`})}),r.agents.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:qde()}):(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:Xde()}):null,e.presentInLastOk===!1?(0,I.jsx)($,{variant:`outline`,className:`oc-access__gone`,children:$de()}):null]},e.agentId))})]})]})})}function F7({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 P1e=[{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 F1e(){let e=Bo({from:`/settings/audit`}),t=Vo({from:`/settings/audit`}),n=e.q??``,r=e.action??T7,i=e.impersonated??T7,a=e.resource??T7,o=_7(e.from,e.to),s=(0,N.useMemo)(()=>b7(e.adv),[e.adv]),{from:c,to:l}=l7(o),u=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,action:e===T7?void 0:e})}),f=e=>void t({search:t=>({...t,impersonated:e===T7?void 0:e})}),p=e=>void t({search:t=>({...t,resource:e===T7?void 0:e})}),m=e=>void t({search:t=>({...t,...v7(e)})}),h=e=>void t({search:t=>({...t,adv:y7(e)}),replace:!0}),g=P(B.admin.listAudit,{filter:{q:n||void 0,from:c,to:l,action:r===T7?void 0:r,resource:a===T7?void 0:a,impersonated:i===T7?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!==T7||i!==T7||a!==T7||s.length>0||o.kind!==`relative`||o.from!==O1e.from;function b(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[nfe(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:afe()})]}),(0,I.jsxs)(f7,{q:n,onQChange:u,searchPlaceholder:cfe(),timeRange:o,onTimeRangeChange:m,onReset:b,canReset:y,children:[(0,I.jsxs)(Q3,{value:r,onValueChange:d,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-40`,children:(0,I.jsx)($3,{placeholder:x$()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:T7,children:pfe()}),_.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(Q3,{value:i,onValueChange:f,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-40`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:T7,children:gfe()}),(0,I.jsx)(Q,{value:`yes`,children:yfe()}),(0,I.jsx)(Q,{value:`no`,children:Sfe()})]})]}),(0,I.jsxs)(Q3,{value:a,onValueChange:p,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-40`,children:(0,I.jsx)($3,{placeholder:S$()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:T7,children:Dfe()}),v.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]})]}),(0,I.jsx)(m7,{fields:P1e,seed:s,onChange:h}),(0,I.jsx)(t7,{title:Afe(),rows:g,emptyHint:Nfe(),columns:[{header:Ife(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`)},{header:x$(),cell:e=>e.action},{header:zfe(),cell:e=>e.realLabel},{header:Hfe(),cell:e=>e.targetLabel??`—`},{header:S$(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`}]})]})}var I1e={pending:Sme,user:Tme,admin:Ome,observer:jme,agent:Pme};function I7(e){if(e.builtin){let t=I1e[e.key];if(t)return t()}return e.description}var L7=[{value:`never`,label:()=>dV(),days:null},{value:`30`,label:()=>mV(),days:30},{value:`90`,label:()=>_V(),days:90}],L1e=720*60*60*1e3,R7=`__all__`,z7={name:``,roleKey:``,description:``};function R1e(){let e=Bo({from:`/settings/serviceAccounts`}),t=Vo({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??R7,[i,a]=(0,N.useState)(R7),o=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),s=e=>void t({search:t=>({...t,status:e===R7?void 0:e})}),c=P(B.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:i===R7?void 0:i,disabled:r===R7?void 0:r===`disabled`}}),l=P(B.apiKeys.listKeys,{}),u=P(B.apiKeys.listRoles,{}),d=F(B.apiKeys.createServiceAccount),f=F(B.apiKeys.updateServiceAccount),p=F(B.apiKeys.deleteServiceAccount),m=Nn(B.apiKeys.mintApiKey),h=F(B.apiKeys.revokeApiKey),g=y0(),_=S0(),v=n!==``||i!==R7||r!==R7;function y(){a(R7),t({search:{},replace:!0})}let[b,x]=(0,N.useState)(!1),[S,C]=(0,N.useState)(z7),[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(Cz())):await d({name:S.name,roleKey:S.roleKey,description:S.description||void 0}),C(z7),T(null),x(!1)}catch(e){_.error(w?bz():_z(),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=L7.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(Ez(),e)}finally{te.current=!1,ee(null)}}async function le(e){if(await g({title:kz(),description:(0,I.jsxs)(I.Fragment,{children:[Mz(),` `,(0,I.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Fz(),` `,(0,I.jsx)(`strong`,{children:Rz()}),` `,Vz()]}),confirmWord:e.name,confirmLabel:Wz(),destructive:!0}))try{await p({serviceAccountId:e._id}),_.success(qz(),e.name)}catch(e){_.error(Xz(),e)}}async function ue(e){if(await g({title:$z(),description:(0,I.jsxs)(I.Fragment,{children:[nB(),` `,(0,I.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,aB()]}),confirmLabel:cB(),destructive:!0})&&!k.has(e._id)){A(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){_.error(dB(),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:CL()}),(0,I.jsxs)(f7,{q:n,onQChange:o,searchPlaceholder:EL(),onReset:y,canReset:v,children:[(0,I.jsxs)(Q3,{value:i,onValueChange:a,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-40`,children:(0,I.jsx)($3,{placeholder:kL()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:R7,children:ML()}),(u??[]).map(e=>(0,I.jsx)(Q,{value:e.key,children:e.key},e._id))]})]}),(0,I.jsxs)(Q3,{value:r,onValueChange:s,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-36`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:R7,children:FL()}),(0,I.jsx)(Q,{value:`active`,children:RL()}),(0,I.jsx)(Q,{value:`disabled`,children:VL()})]})]})]}),(0,I.jsx)(t7,{title:WL(),rows:c,addLabel:qL(),onAdd:()=>{C(z7),T(null),x(!0)},emptyHint:XL(),isExpanded:e=>E.has(e._id),renderExpanded:e=>(0,I.jsx)(z1e,{account:e,keys:ie.get(e._id)??[],onRevoke:ue,revoking:k}),rowActions:e=>[{label:cR(),onSelect:()=>se(e)},{label:$L(),onSelect:()=>void ce(e)},{label:E.has(e._id)?nR():aR(),onSelect:()=>ae(e._id)},{label:dR(),variant:`destructive`,onSelect:()=>void le(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,I.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":E.has(e._id)?mR():_R(),onClick:()=>ae(e._id),children:E.has(e._id)?(0,I.jsx)(cm,{}):(0,I.jsx)(lm,{})})},{header:bR(),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:CR(),cell:e=>(0,I.jsx)($,{variant:`secondary`,children:e.roleKey})},{header:ER(),cell:e=>e.disabled?(0,I.jsx)($,{variant:`destructive`,children:VL()}):(0,I.jsx)($,{variant:`outline`,children:RL()})},{header:kR(),cell:e=>(0,I.jsxs)(Q3,{value:j[e._id]??`never`,onValueChange:t=>ne(n=>({...n,[e._id]:t})),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-32`,children:(0,I.jsx)($3,{})}),(0,I.jsx)(t6,{children:L7.map(e=>(0,I.jsx)(Q,{value:e.value,children:e.label()},e.value))})]})},{header:MR(),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?FR():RR({count:t})})}}]}),(0,I.jsx)(A5,{open:b,onOpenChange:e=>{x(e),e||T(null)},title:w?VR():XR(),description:w?WR():$R(),canSubmit:!!(S.name&&S.roleKey),onSubmit:oe,submitLabel:w?qR():nz(),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:az()}),(0,I.jsx)(n0,{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:cz()}),(0,I.jsxs)(Q3,{value:S.roleKey||void 0,onValueChange:e=>C({...S,roleKey:e}),children:[(0,I.jsx)(e6,{className:`w-full`,children:(0,I.jsx)($3,{placeholder:dz()})}),(0,I.jsx)(t6,{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?I7(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:mz()}),(0,I.jsx)(n0,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})}),(0,I.jsx)(B1e,{minted:re,onClose:()=>M(null)})]})}function z1e({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:[mB(),` `,(0,I.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_B()}):(0,I.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,I.jsx)(`thead`,{children:(0,I.jsxs)(`tr`,{children:[(0,I.jsx)(`th`,{children:bB()}),(0,I.jsx)(`th`,{children:CB()}),(0,I.jsx)(`th`,{children:EB()}),(0,I.jsx)(`th`,{children:kB()}),(0,I.jsx)(`th`,{children:MB()}),(0,I.jsx)(`th`,{children:FB()}),(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:V1e(t.createdAt)}),(0,I.jsx)(`td`,{className:H1e(t.lastUsedAt)?`oc-sa__stale`:``,children:U1e(t.lastUsedAt)}),(0,I.jsx)(`td`,{children:W1e(t.expiresAt)}),(0,I.jsx)(`td`,{children:G1e(t)}),(0,I.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,I.jsx)(Y,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?RB():VB()})})]},t._id))})]})]})}function B1e({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)(d0,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,I.jsxs)(f0,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,I.jsxs)(p0,{children:[(0,I.jsx)(h0,{children:WB()}),(0,I.jsx)(g0,{children:qB({name:e.accountName})})]}),(0,I.jsx)(`div`,{className:`oc-sa__minted-warning`,children:XB()}),(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)(Y,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":$B(),children:[n?(0,I.jsx)(sm,{}):(0,I.jsx)(pm,{}),n?nV():aV()]})]}),(0,I.jsx)(m0,{children:(0,I.jsx)(Y,{onClick:()=>{r(!1),t()},children:cV()})})]}):null})}function V1e(e){return new Date(e).toLocaleString(`fr-FR`)}function H1e(e){return e===null?!1:Date.now()-e>L1e}function U1e(e){return e===null?bV():new Date(e).toLocaleString(`fr-FR`)}function W1e(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function G1e(e){return e.disabled?(0,I.jsx)($,{variant:`destructive`,children:CV()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,I.jsx)($,{variant:`outline`,children:EV()}):(0,I.jsx)($,{variant:`outline`,children:kV()})}var B7=[{group:()=>Gfe(),keys:[{key:`traces.read`,label:()=>C$()},{key:`traces.read.content`,label:()=>cpe(),phi:!0},{key:`traces.write`,label:()=>w$()}]},{group:()=>Jfe(),keys:[{key:`kpi.read`,label:()=>C$()},{key:`kpi.write`,label:()=>w$()}]},{group:()=>Zfe(),keys:[{key:`openclaw.query`,label:()=>ppe()},{key:`anomalies.read`,label:()=>gpe()},{key:`anomalies.report`,label:()=>ype()}]},{group:()=>epe(),keys:[{key:`chats.read`,label:()=>C$()}]},{group:()=>rpe(),keys:[{key:`admin.manage`,label:()=>Spe()}]}],K1e=B7.flatMap(e=>e.keys.map(e=>e.key));function V7(e){return e.includes(`*`)}var H7={key:``,name:``,description:``};function q1e(){let e=P(B.apiKeys.listRoles,{}),t=F(B.apiKeys.createRole),n=F(B.apiKeys.ensureRolesSeeded),r=F(B.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(B.apiKeys.listRoles,{});r&&e.setQuery(B.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),i=y0(),a=S0(),[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(H7),[u,d]=(0,N.useState)(new Set);(0,N.useEffect)(()=>{n({}).catch(e=>{a.error(Ope(),e)})},[n,a]);let f=e??[];async function p(e,t){if(V7(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:jpe({name:e.name}),description:Ppe(),confirmLabel:Lpe()}))){d(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){a.error(Bpe(),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(H7),s(!1)}catch(e){a.error(Upe(),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:[Kpe(),` `,(0,I.jsx)(`code`,{children:`admin`}),` `,Ype(),` `,(0,I.jsx)(`code`,{children:`traces.read.content`}),` `,Qpe()]}),(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:tme()}),(0,I.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,I.jsx)(Y,{size:`sm`,onClick:()=>{l(H7),s(!0)},children:ime()})})]}),h?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:sme()}):g?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:ume()}):(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:pme()}),B7.map(e=>(0,I.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,I.jsx)(`tr`,{children:B7.flatMap(e=>e.keys.map(e=>(0,I.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?Tpe({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=V7(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)(mee,{}),` `,gme()]}):(0,I.jsx)($,{variant:`secondary`,children:yme()})]}),I7(e)?(0,I.jsx)(`p`,{className:`oc-matrix__roledesc`,children:I7(e)}):null]}),K1e.map(r=>(0,I.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,I.jsx)(J5,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?Lme():n?Bme():r,onCheckedChange:()=>void p(e,r)})},r))]},e.key)})})]})})]}),(0,I.jsx)(A5,{open:o,onOpenChange:s,title:Ume(),description:Kme(),canSubmit:!!(c.key&&c.name),onSubmit:m,submitLabel:Yme(),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:Qme()}),(0,I.jsx)(n0,{value:c.key,placeholder:the(),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:ihe()}),(0,I.jsx)(n0,{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:she()}),(0,I.jsx)(n0,{value:c.description,onChange:e=>l({...c,description:e.target.value})})]})]})})]})}var U7={name:``,description:``};function J1e(){let e=P(B.groups.listGroups,{}),t=F(B.groups.createGroup),n=F(B.groups.updateGroup),r=F(B.groups.deleteGroup),i=y0(),a=S0(),[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(null),[u,d]=(0,N.useState)(U7),[f,p]=(0,N.useState)(null);function m(){l(null),d(U7),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(U7),l(null),s(!1)}catch(e){a.error(IIe(),e)}}async function _(e){if(await i({title:VFe({name:e.name}),description:WFe(),confirmWord:e.name,confirmLabel:qFe(),cancelLabel:CFe(),destructive:!0}))try{await r({groupId:e._id})}catch(e){a.error(zIe(),e)}}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:WPe()}),(0,I.jsx)(t7,{title:VPe(),rows:e,addLabel:qPe(),onAdd:m,emptyHint:XPe(),columns:[{header:$Pe(),cell:e=>e.name},{header:nFe(),cell:e=>(0,I.jsxs)($,{variant:`outline`,className:`gap-1`,children:[(0,I.jsx)(km,{size:12,"aria-hidden":!0}),e.memberCount]})},{header:aFe(),cell:e=>(0,I.jsxs)($,{variant:`outline`,className:`gap-1`,children:[(0,I.jsx)(wm,{size:12,"aria-hidden":!0}),e.agentCount]})},{header:cFe(),cell:e=>(0,I.jsx)(Y,{variant:`outline`,size:`sm`,className:`h-8 font-normal`,onClick:()=>p({groupId:e._id,name:e.name}),children:dFe()})}],rowActions:e=>[{label:mFe(),onSelect:()=>h(e)},{label:_Fe(),variant:`destructive`,onSelect:()=>void _(e)}]}),(0,I.jsx)(A5,{open:o,onOpenChange:s,title:c?kFe():EFe(),description:MFe(),canSubmit:!!u.name.trim(),onSubmit:g,submitLabel:bFe(),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:FFe()}),(0,I.jsx)(n0,{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:RFe()}),(0,I.jsx)(n0,{value:u.description,onChange:e=>d({...u,description:e.target.value})})]})]})}),(0,I.jsx)(Y1e,{groupId:f?.groupId??null,groupName:f?.name??``,open:f!==null,onOpenChange:e=>{e||p(null)}})]})}function Y1e({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=P(B.groups.getGroup,n&&e?{groupId:e}:`skip`),a=P(B.admin.listInstances,n?{}:`skip`),o=P(B.admin.listUsers,n?{}:`skip`),s=F(B.groups.addMember),c=F(B.groups.removeMember),l=S0(),u=(0,N.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),d=(0,N.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);async function f(t,n){if(e)try{n?await c({groupId:e,userId:t}):await s({groupId:e,userId:t})}catch(e){l.error(HIe(),e)}}return(0,I.jsx)(d0,{open:n,onOpenChange:r,children:(0,I.jsxs)(f0,{className:`oc-access`,children:[(0,I.jsxs)(p0,{children:[(0,I.jsx)(h0,{children:XFe({name:t})}),(0,I.jsx)(g0,{children:$Fe()})]}),(0,I.jsxs)(`div`,{className:`oc-access__group`,children:[(0,I.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,I.jsx)(km,{size:13,"aria-hidden":!0}),(0,I.jsx)(`span`,{children:nIe()})]}),o===void 0||i===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:G$()}):o.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:gIe()}):(0,I.jsx)(`div`,{className:`oc-access__list`,children:o.map(e=>{let t=u.has(e.userId),n=e.email||e.name||e.canonical||e.userId.slice(0,8);return(0,I.jsxs)(`div`,{className:`oc-access__row`,children:[(0,I.jsx)(J5,{checked:t,onCheckedChange:()=>void f(e.userId,t),"aria-label":aIe({user:n})}),(0,I.jsx)(`span`,{className:`oc-access__label`,children:n})]},e._id)})})]}),(0,I.jsx)(`div`,{className:`oc-access__list`,children:a===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:G$()}):a.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:yIe()}):a.map(t=>(0,I.jsx)(X1e,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:d},t._id))})]})})}function X1e({groupId:e,instanceName:t,kind:n,assigned:r}){let i=P(B.agents.listAgentsForInstance,{instanceName:t}),a=F(B.groups.assignAgentToGroup),o=F(B.groups.removeAgentFromGroup),s=S0();if(!e)return null;let c=(i?.agents??[]).filter(e=>e.source===`discovered`),l=i?.discovery&&!i.discovery.lastPollOk;async function u(n,r){try{r?await o({groupId:e,instanceName:t,agentId:n}):await a({groupId:e,instanceName:t,agentId:n})}catch(e){s.error(GIe(),e)}}return(0,I.jsxs)(`div`,{className:`oc-access__group`,children:[(0,I.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,I.jsx)(wm,{size:13,"aria-hidden":!0}),(0,I.jsx)(`span`,{children:t}),(0,I.jsx)($,{variant:`outline`,className:`oc-access__kind`,children:n}),l?(0,I.jsx)($,{variant:`outline`,className:`oc-access__stale`,children:OIe()}):null]}),i===void 0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:pIe()}):c.length===0?(0,I.jsx)(`p`,{className:`oc-access__hint`,children:l?TIe():SIe()}):c.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)(J5,{checked:i,disabled:a&&!i,onCheckedChange:()=>void u(e.agentId,i),"aria-label":cIe({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":K$(),title:K$(),children:(0,I.jsx)(Em,{size:14,fill:`currentColor`})}):null,a?(0,I.jsx)($,{variant:`outline`,className:`oc-access__gone`,children:jIe()}):null]},e.agentId)})]})}var Z1e=[50,100,200,500],W7=`all`,G7=`__all__`,Q1e=[`2xx`,`4xx`,`5xx`],$1e=[`user`,`service`,`system`],e0e=[`inbound`,`outbound`,`internal`],t0e={kind:`relative`,from:`now-30d`,to:`now`},n0e=[{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 r0e(){let e=Bo({from:`/settings/traces`}),t=Vo({from:`/settings/traces`}),n=e.limit,r=e.kind,i=e.statusClass??G7,a=e.principalType??G7,o=e.direction??G7,s=e.roleKey??G7,c=e.q??``,l=_7(e.from,e.to),u=(0,N.useMemo)(()=>b7(e.adv),[e.adv]),{from:d,to:f}=l7(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===G7?void 0:e})}),x=e=>void t({search:t=>({...t,principalType:e===G7?void 0:e})}),S=e=>void t({search:t=>({...t,direction:e===G7?void 0:e})}),C=e=>void t({search:t=>({...t,roleKey:e===G7?void 0:e})}),w=e=>void t({search:t=>({...t,...v7(e)})}),T=e=>void t({search:t=>({...t,adv:y7(e)}),replace:!0}),E=P(B.observability.listEvents,{limit:n}),D=P(B.observability.listEvents,{limit:n,kind:r===W7?void 0:r,filter:{q:c||void 0,from:d,to:f,statusClass:i===G7?void 0:i,principalType:a===G7?void 0:a,direction:o===G7?void 0:o,roleKey:s===G7?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!==G7||a!==G7||o!==G7||s!==G7||u.length>0||l.kind!==`relative`||l.from!==t0e.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:[eye(),(0,I.jsx)(`strong`,{children:rye()}),oye(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:lye()})]}),(0,I.jsxs)(f7,{q:c,onQChange:y,searchPlaceholder:fye(),timeRange:l,onTimeRangeChange:w,onReset:k,canReset:te,children:[(0,I.jsxs)(Q3,{value:i,onValueChange:b,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-32`,children:(0,I.jsx)($3,{placeholder:hye()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:G7,children:vye()}),Q1e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(Q3,{value:a,onValueChange:x,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-32`,children:(0,I.jsx)($3,{placeholder:xye()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:G7,children:wye()}),$1e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(Q3,{value:o,onValueChange:S,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-32`,children:(0,I.jsx)($3,{placeholder:Dye()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:G7,children:Aye()}),e0e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(Q3,{value:s,onValueChange:C,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-36`,children:(0,I.jsx)($3,{placeholder:Nye()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:G7,children:Iye()}),ee.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(Q3,{value:r,onValueChange:v,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-44`,children:(0,I.jsx)($3,{placeholder:zye()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:W7,children:Hye()}),O.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(Q3,{value:String(n),onValueChange:e=>_(Number(e)),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-28`,children:(0,I.jsx)($3,{})}),(0,I.jsx)(t6,{children:Z1e.map(e=>(0,I.jsx)(Q,{value:String(e),children:Gye({count:e})},e))})]})]}),(0,I.jsx)(m7,{fields:n0e,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:Jye(),children:[(0,I.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Zye(),(0,I.jsx)(`code`,{children:K7(p)})]}),(0,I.jsx)(jm,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`sr-only`,children:ebe()})]})}):null,(0,I.jsx)(t7,{title:rbe(),rows:A,emptyHint:p?obe():lbe(),columns:[{header:fbe(),cell:e=>(0,I.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:hbe(),cell:e=>(0,I.jsx)($,{variant:`secondary`,children:e.kind})},{header:vbe(),cell:e=>{let t=a0e(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":xbe(),children:`✓`})}},{header:wbe(),cell:e=>e.direction?(0,I.jsx)($,{variant:`outline`,children:e.direction}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Dbe(),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:K7(e.principalId)}):null]})},{header:Abe(),cell:e=>e.roleKey?(0,I.jsx)($,{variant:`secondary`,children:e.roleKey}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Nbe(),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:Ibe(),cell:e=>e.status===null?(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,I.jsx)(`span`,{className:`oc-traces__status ${i0e(e.status)}`,children:e.status})},{header:zbe(),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:Hbe(),cell:e=>e.correlationId?(0,I.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:Gbe(),onClick:()=>m(e.correlationId),children:K7(e.correlationId)}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Jbe(),cell:e=>e.meta?(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>g(e),children:Zbe()}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,I.jsx)(o0e,{row:h,onClose:()=>g(null)})]})}function i0e(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 K7(e){return e.length>8?e.slice(0,8):e}function a0e(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 o0e({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)(d0,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,I.jsxs)(f0,{className:`max-w-lg`,children:[(0,I.jsxs)(p0,{children:[(0,I.jsxs)(h0,{className:`oc-traces__meta-title`,children:[exe(),` `,(0,I.jsx)(`code`,{children:e.kind}),(0,I.jsx)($,{variant:`outline`,children:rxe()})]}),(0,I.jsx)(g0,{children:oxe()})]}),(0,I.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}function q7({className:e,size:t=`default`,...n}){return(0,I.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:V1(`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 J7({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`card-header`,className:V1(`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 Y7({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`card-title`,className:V1(`font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function X7({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`card-description`,className:V1(`text-sm text-muted-foreground`,e),...t})}function Z7({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`card-content`,className:V1(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function s0e({className:e,...t}){return(0,I.jsx)(`div`,{"data-slot":`card-footer`,className:V1(`flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3`,e),...t})}var Q7=[{metric:`api.calls`,label:Gwe(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:Jwe(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:Zwe(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:eTe(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:rTe(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:oTe(),unit:`/h`,group:`Assistant`,isError:!0}],$7=Q7.length,c0e=[`API`,`OpenClaw`,`Chat`,`Assistant`],l0e=1e3,u0e=36e5;function d0e(e,t){let n=Math.max(1,Math.ceil((t-e)/u0e)),r=Math.min(n*$7,l0e);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/$7))}}function f0e(){let e=Bo({from:`/settings/kpi`}),t=Vo({from:`/settings/kpi`}),n=_7(e.from,e.to,x1e,`now`),r=e=>void t({search:t=>({...t,...v7(e)})}),{from:i,to:a}=l7(n),{rowLimit:o,buckets:s}=d0e(i,a),c=P(B.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:[lTe(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:fTe()})]}),(0,I.jsx)(p0e,{value:n,onChange:r})]});return c===void 0?(0,I.jsxs)(I.Fragment,{children:[u,(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:hTe()})]}):c.length===0?(0,I.jsxs)(I.Fragment,{children:[u,(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:vTe()})]}):(0,I.jsxs)(I.Fragment,{children:[u,c0e.map(e=>{let t=Q7.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)(m0e,{config:e,series:l.get(e.metric)??[]},e.metric))})]},e):null})]})}function p0e({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(d7,{value:e,onChange:t})})}function m0e({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(q7,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(J7,{children:[(0,I.jsx)(Y7,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(X7,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(Z7,{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:n9(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(g0e,{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:xTe({value:r9(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:wTe()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:DTe({count:t.length})})]})]})]})}var e9=240,t9=48,h0e=1;function g0e({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=e9/e.length,a=Math.max(i-h0e,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${e9} ${t9}`,preserveAspectRatio:`none`,role:`img`,"aria-label":ATe({max:n9(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(t9-1):0,c=o*i,l=t9-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:[r9(e.bucket),` · `,n9(e.value),` `,n]})},e.bucket)})})}function n9(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function r9(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 i9={AGENT_NOT_FOUND:()=>({label:LAe(),hint:BAe()}),AUTH_TOKEN_MISMATCH:()=>({label:UAe(),hint:KAe()}),DEVICE_SIGNING_FAILED:()=>({label:YAe(),hint:QAe()}),SESSION_SCOPE_DENIED:()=>({label:tje(),hint:ije()}),GATEWAY_TIMEOUT:()=>({label:sje(),hint:uje()}),GATEWAY_DISCONNECTED:()=>({label:pje(),hint:gje()}),BRIDGE_UNREACHABLE:()=>({label:yje(),hint:Sje()}),INVALID_REQUEST:()=>({label:Tje(),hint:Oje()}),NOT_CONFIGURED:()=>({label:jje(),hint:Pje()}),UNROUTED:()=>({label:Lje(),hint:Bje()}),UPSTREAM_ERROR:()=>({label:Uje(),hint:Kje()}),UNKNOWN:()=>({label:Yje(),hint:Qje()})};function a9(e){return e?i9[e]?.()??{label:e,hint:tMe()}:i9.UNKNOWN()}var o9=`__all__`,_0e=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function v0e(e){return e===`open`?uhe():e===`acknowledged`?phe():ghe()}var y0e=[`info`,`warn`,`critical`],b0e=[`detector`,`agent`],x0e={kind:`relative`,from:`now-30d`,to:`now`},S0e=200,s9=`all`;function C0e(){let e=Bo({from:`/settings/anomalies`}),t=Vo({from:`/settings/anomalies`}),n=e.q??``,r=e.status===s9?o9:e.status,i=e.severity??o9,a=e.kind??o9,[o,s]=(0,N.useState)(o9),c=_7(e.from,e.to),{from:l,to:u}=l7(c),d=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),f=e=>void t({search:t=>({...t,status:e===o9?s9:e})}),p=e=>void t({search:t=>({...t,severity:e===o9?void 0:e})}),m=e=>void t({search:t=>({...t,kind:e===o9?void 0:e})}),h=e=>void t({search:t=>({...t,...v7(e)})}),g=y0(),_=S0(),v=F(B.anomalies.resolveAnomaly),y=(P(B.me.getMe)?.permissions??[]).includes(`admin.manage`),b=P(B.anomalies.listAnomalies,{limit:S0e,filter:{q:n||void 0,from:l,to:u,anomalyStatus:r===o9?void 0:r,severity:i===o9?void 0:i,source:o===o9?void 0:o,kind:a===o9?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!==o9||o!==o9||a!==o9||c.kind!==`relative`||c.from!==x0e.from;function C(){s(o9),t({search:{status:`open`},replace:!0})}async function w(e){if(await g({title:yhe(),description:(0,I.jsxs)(I.Fragment,{children:[She(),` `,(0,I.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,The(),` `,(0,I.jsx)(`strong`,{children:Ohe()}),`.`,` `,jhe()]}),confirmLabel:Phe()}))try{await v({anomalyId:e._id,status:`resolved`}),_.success(Lhe(),e.kind)}catch(e){_.error(Bhe(),e)}}async function T(e){try{await v({anomalyId:e._id,status:`acknowledged`}),_.success(Uhe(),e.kind)}catch(e){_.error(Khe(),e)}}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[Yhe(),` `,(0,I.jsx)(`strong`,{children:Qhe()}),` `,tge(),` `,(0,I.jsx)(`strong`,{children:ige()}),` `,sge(),` `,(0,I.jsx)(`strong`,{children:uge()}),` `,pge(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:gge()})]}),(0,I.jsxs)(f7,{q:n,onQChange:d,searchPlaceholder:yge(),timeRange:c,onTimeRangeChange:h,onReset:C,canReset:S,children:[(0,I.jsxs)(Q3,{value:r,onValueChange:f,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-36`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:o9,children:Sge()}),_0e.map(e=>(0,I.jsx)(Q,{value:e.value,children:v0e(e.value)},e.value))]})]}),(0,I.jsxs)(Q3,{value:i,onValueChange:p,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-36`,children:(0,I.jsx)($3,{placeholder:T$()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:o9,children:Dge()}),y0e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(Q3,{value:o,onValueChange:s,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-32`,children:(0,I.jsx)($3,{placeholder:E$()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:o9,children:Mge()}),b0e.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}),(0,I.jsxs)(Q3,{value:a,onValueChange:m,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-36`,children:(0,I.jsx)($3,{placeholder:D$()})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:o9,children:Lge()}),x.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]})]}),(0,I.jsx)(t7,{title:Bge(),rows:b,emptyHint:r===`open`?Uge():Kge(),rowActions:e=>y&&e.status===`open`?[{label:Yge(),onSelect:()=>void w(e)},{label:Qge(),onSelect:()=>void T(e)}]:[],columns:[{header:t_e(),cell:e=>(0,I.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:D$(),cell:e=>(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind})},{header:T$(),cell:e=>(0,I.jsx)(E0e,{severity:e.severity})},{header:i_e(),cell:e=>(0,I.jsx)(D0e,{status:e.status})},{header:E$(),cell:e=>(0,I.jsx)($,{variant:`outline`,children:e.source})},{header:s_e(),cell:e=>(0,I.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message})},{header:u_e(),cell:e=>(0,I.jsx)(T0e,{row:e})},{header:p_e(),cell:e=>e.correlationId?(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:O0e(e.correlationId)}):(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]})]})}function w0e(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 T0e({row:e}){let t=Vo(),n=w0e(e);if(!n.dominantCode)return(0,I.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=a9(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:[`↗ `,g_e()]}):null]})}function E0e({severity:e}){return(0,I.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function D0e({status:e}){return e===`open`?(0,I.jsx)($,{variant:`destructive`,children:y_e()}):e===`acknowledged`?(0,I.jsx)($,{variant:`secondary`,children:S_e()}):(0,I.jsx)($,{variant:`outline`,children:T_e()})}function O0e(e){return e.length>8?e.slice(0,8):e}function k0e(){let e=P(B.integrations.status.status,{}),t=F(B.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:RG()});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:[VG(),` `,(0,I.jsx)(`strong`,{children:WG()}),` `,qG()]}),(0,I.jsxs)(c9,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,I.jsx)($,{variant:`secondary`,children:XG()}):(0,I.jsx)($,{variant:`outline`,children:$G()}):(0,I.jsx)($,{variant:`outline`,children:nK()}),note:cK(),children:[(0,I.jsx)(l9,{label:mK(),children:(0,I.jsx)(n0,{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)(u9,{label:EK(),checked:i.langfuse.enabled??!0,onChange:e=>{a(`langfuse`,`enabled`,e),o(`langfuse`,{enabled:e})}})]}),(0,I.jsxs)(c9,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,I.jsx)($,{variant:`secondary`,children:XG()}):(0,I.jsx)($,{variant:`outline`,children:$G()}):(0,I.jsx)($,{variant:`outline`,children:nK()}),note:dK(),children:[(0,I.jsx)(l9,{label:_K(),children:(0,I.jsx)(n0,{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)(l9,{label:bK(),children:(0,I.jsx)(n0,{value:i.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||CK(),onChange:e=>a(`opik`,`workspace`,e.target.value),onBlur:()=>o(`opik`,{workspace:i.opik.workspace??``})})}),(0,I.jsx)(u9,{label:EK(),checked:i.opik.enabled??!0,onChange:e=>{a(`opik`,`enabled`,e),o(`opik`,{enabled:e})}})]}),(0,I.jsxs)(c9,{title:kK(),status:(0,I.jsx)($,{variant:`outline`,children:aK()}),note:MK(),children:[(0,I.jsx)(l9,{label:FK(),children:(0,I.jsx)(d9,{value:i.tts.auto??`off`,options:[[`off`,RK()],[`always`,VK()],[`inbound`,WK()],[`tagged`,qK()]],onChange:e=>{a(`tts`,`auto`,e),o(`tts`,{auto:e})}})}),(0,I.jsx)(l9,{label:XK(),children:(0,I.jsx)(d9,{value:i.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,$K()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{a(`tts`,`provider`,e),o(`tts`,{provider:e})}})}),(0,I.jsx)(l9,{label:nq(),children:(0,I.jsx)(n0,{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)(l9,{label:aq(),children:(0,I.jsx)(n0,{value:i.tts.voice??``,placeholder:cq(),onChange:e=>a(`tts`,`voice`,e.target.value),onBlur:()=>o(`tts`,{voice:i.tts.voice??``})})})]}),(0,I.jsxs)(c9,{title:dq(),status:(0,I.jsx)($,{variant:`outline`,children:aK()}),note:e.secrets.openai?mq():_q(),children:[(0,I.jsx)(u9,{label:bq(),checked:i.talk.enabled??!1,onChange:e=>{a(`talk`,`enabled`,e),o(`talk`,{enabled:e})}}),(0,I.jsx)(l9,{label:Cq(),children:(0,I.jsx)(d9,{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)(l9,{label:Eq(),children:(0,I.jsx)(n0,{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)(l9,{label:aq(),children:(0,I.jsx)(n0,{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)(l9,{label:kq(),children:(0,I.jsx)(d9,{value:i.talk.transport??`webrtc`,options:[[`webrtc`,Mq()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{a(`talk`,`transport`,e),o(`talk`,{transport:e})}})}),(0,I.jsx)(l9,{label:Fq(),children:(0,I.jsx)(n0,{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)(u9,{label:Rq(),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:Vq()}),(0,I.jsx)($,{variant:`outline`,children:Wq()})]}),(0,I.jsxs)(`p`,{className:`oc-uipa__note`,children:[qq(),(0,I.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,I.jsx)(t7,{title:Xq(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:$q(),columns:[{header:nJ(),cell:e=>(0,I.jsx)($,{variant:`secondary`,children:e.vendor})},{header:aJ(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`},{header:cJ(),cell:e=>String(e.failureCount)},{header:dJ(),cell:e=>e.lastErrorStatus??`—`},{header:mJ(),cell:e=>e.lastError??`—`}]})]})}function c9({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 l9({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 u9({label:e,checked:t,onChange:n}){return(0,I.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,I.jsx)(J5,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,I.jsx)(`span`,{children:e})]})}function d9({value:e,options:t,onChange:n}){return(0,I.jsxs)(Q3,{value:e,onValueChange:n,children:[(0,I.jsx)(e6,{size:`sm`,className:`w-full`,children:(0,I.jsx)($3,{})}),(0,I.jsx)(t6,{children:t.map(([e,t])=>(0,I.jsx)(Q,{value:e,children:t},e))})]})}var A0e={altered_words:()=>_J(),incorrect:()=>bJ(),incoherence:()=>CJ(),formatting:()=>EJ(),latency:()=>kJ(),api_error:()=>MJ(),other:()=>FJ()},f9=e=>A0e[e]?.()??e;function p9({matches:e,sourceWasOpen:t}){return t?e===!0?(0,I.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:VJ()}):e===!1?(0,I.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:WJ()}):(0,I.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,I.jsx)(`span`,{className:`oc-fbadmin__pill`,children:RJ()})}function j0e({data:e}){let t=e.snapshot,n=F(B.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)(p9,{matches:t.displayedMatchesStored,sourceWasOpen:t.clientInfo?.sourceWasOpen??!1}),(0,I.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[f9(e.category),` · `,t.messageRole,t.isRegeneration?` · ${qJ()}`:``,t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})]}),e.comment?(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:XJ()}),(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:$J()}),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`?nY():aY()}),(0,I.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,I.jsx)(`p`,{className:`oc-fbadmin__meta`,children:cY()}),(0,I.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:dY(),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)(Y,{size:`sm`,onClick:()=>void l(),disabled:!a.trim()||s,children:s?mY():_Y()})})]}),(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:bY()}),(0,I.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.messageText||CY()})]}),t.clientInfo?.sourceWasOpen&&t.displayedText!==void 0?(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:EY()}),(0,I.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.displayedText||CY()})]}):null,t.promptText?(0,I.jsxs)(`section`,{children:[(0,I.jsx)(`h4`,{className:`oc-fbadmin__h`,children:kY()}),(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:MY({count:t.contextCount??u.length,truncated:t.contextTruncated?FY():``})}),(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:RY()}),(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:VY()}),(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:WY()}),(0,I.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[t.clientInfo?.language,t.clientInfo?.timezone,t.clientInfo?.theme?qY({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:[XY(),` `,t.clientInfo.plugins.join(`, `),(0,I.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,$Y()]})]}):null,t.clientInfo?.userAgent?(0,I.jsx)(`span`,{className:`oc-fbadmin__ua`,children:t.clientInfo.userAgent}):null]})]})]})}function M0e(){let e=P(B.feedback.listForAdmin,{}),t=F(B.feedback.readSnapshot),n=F(B.feedback.deleteFeedback),r=y0(),[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:cZ(),description:dZ(),confirmLabel:mZ(),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:[nX(),` `,(0,I.jsx)(`strong`,{children:aX()}),` `,cX()]}),(0,I.jsx)(t7,{title:dX(),rows:e,emptyHint:mX(),isExpanded:e=>i===e._id&&!!o[e._id],renderExpanded:e=>o[e._id]?(0,I.jsx)(j0e,{data:o[e._id]}):null,columns:[{header:_X(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`)},{header:bX(),cell:e=>f9(e.category)},{header:CX(),cell:e=>e.messageRole===`user`?EX():kX()},{header:MX(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${FX({operator:e.realOperatorEmail})}`:``)},{header:RX(),cell:e=>(0,I.jsx)(p9,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen})},{header:VX(),cell:e=>e.hasComment?`✎`:`—`},{header:WX(),cell:e=>e.answered?(0,I.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:qX()}):(0,I.jsx)(`span`,{className:`oc-fbadmin__pill`,children:XX()})}],rowActions:e=>[{label:i===e._id?$X():nZ(),onSelect:()=>void c(e)},{label:aZ(),onSelect:()=>void l(e),variant:`destructive`}]})]})}var m9=`all`;function h9(e){switch(e){case`image`:return WA();case`audio`:return qA();case`video`:return XA();case`pdf`:return $A();case`document`:return nj();case`archive`:return aj();default:return cj()}}function N0e(){let[e,t]=(0,N.useState)(m9),[n,r]=(0,N.useState)(m9),[i,a]=(0,N.useState)(m9),[o,s]=(0,N.useState)(m9),[c,l]=(0,N.useState)(null),u=F(B.files.softDelete),d=S0();function f(){t(m9),r(m9),a(m9),s(m9)}async function p(){let e=c;if(l(null),e)try{await u({fileId:e.id}),d.success(Vj())}catch(e){d.error(Wj(),e)}}let m=P(B.files.listMine,{direction:e===m9?void 0:e,chatId:n===m9?void 0:n,instanceName:i===m9?void 0:i,category:o===m9?void 0:o}),h=(0,N.useMemo)(()=>new Intl.DateTimeFormat(K(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(m===void 0)return(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()});let{files:g,facets:_,truncated:v,cap:y}=m,b=e!==m9||n!==m9||i!==m9||o!==m9;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:dA()}),(0,I.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,I.jsxs)(Q3,{value:e,onValueChange:t,children:[(0,I.jsx)(e6,{size:`sm`,"aria-label":mA(),children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:m9,children:_A()}),(0,I.jsx)(Q,{value:`inbound`,children:bA()}),(0,I.jsx)(Q,{value:`outbound`,children:CA()})]})]}),(0,I.jsxs)(Q3,{value:n,onValueChange:r,children:[(0,I.jsx)(e6,{size:`sm`,"aria-label":EA(),children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:m9,children:kA()}),_.chats.map(e=>(0,I.jsx)(Q,{value:e.id,children:e.title},e.id))]})]}),_.multiProvider?(0,I.jsxs)(Q3,{value:i,onValueChange:a,children:[(0,I.jsx)(e6,{size:`sm`,"aria-label":MA(),children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:m9,children:FA()}),_.instances.map(e=>(0,I.jsx)(Q,{value:e,children:e},e))]})]}):null,(0,I.jsxs)(Q3,{value:o,onValueChange:s,children:[(0,I.jsx)(e6,{size:`sm`,"aria-label":RA(),children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:m9,children:VA()}),_.categories.map(e=>(0,I.jsx)(Q,{value:e,children:h9(e)},e))]})]}),b?(0,I.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:f,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,I.jsx)(Sm,{size:14,"aria-hidden":!0}),Mj()]}):null]}),g.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:b?aM():nM()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(Y5,{children:[(0,I.jsx)(X5,{children:(0,I.jsxs)(Q5,{children:[(0,I.jsx)($5,{children:dj()}),(0,I.jsx)($5,{children:mj()}),(0,I.jsx)($5,{children:_j()}),(0,I.jsx)($5,{children:bj()}),(0,I.jsx)($5,{children:Cj()}),(0,I.jsx)($5,{className:`text-right`,children:Ej()})]})}),(0,I.jsx)(Z5,{children:g.map(e=>(0,I.jsxs)(Q5,{children:[(0,I.jsx)(e7,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,I.jsx)(e7,{title:e.mimeType,children:h9(e.category)}),(0,I.jsx)(e7,{children:(0,I.jsx)($,{variant:`secondary`,children:e.direction===`inbound`?bA():CA()})}),(0,I.jsx)(e7,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,I.jsx)(e7,{className:`whitespace-nowrap text-muted-foreground`,children:h.format(e.createdAt)}),(0,I.jsx)(e7,{className:`text-right`,children:(0,I.jsxs)(H1,{children:[(0,I.jsx)(U1,{asChild:!0,children:(0,I.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":Fj(),children:(0,I.jsx)(hm,{size:16})})}),(0,I.jsxs)(W1,{align:`end`,children:[e.url?(0,I.jsx)(G1,{asChild:!0,children:(0,I.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,I.jsx)(mm,{size:14}),kj()]})}):(0,I.jsxs)(G1,{disabled:!0,children:[(0,I.jsx)(mm,{size:14}),$j()]}),(0,I.jsxs)(G1,{variant:`destructive`,onSelect:()=>l({id:e._id,filename:e.filename}),children:[(0,I.jsx)(Dm,{size:14}),Rj()]})]})]})})]},e._id))})]}),v?(0,I.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:cM({cap:y})}):null]}),(0,I.jsx)(r0,{open:c!==null,onOpenChange:e=>!e&&l(null),children:(0,I.jsxs)(i0,{children:[(0,I.jsxs)(a0,{children:[(0,I.jsx)(s0,{children:qj()}),(0,I.jsx)(c0,{children:Xj()})]}),(0,I.jsxs)(o0,{children:[(0,I.jsx)(u0,{children:dU()}),(0,I.jsx)(l0,{onClick:()=>void p(),children:Rj()})]})]})})]})}var g9=2e4,_9=6e4;function P0e(e){return typeof e!=`number`||e<=0?0:Math.round(e/g9*100)}function F0e(e){return e<=0?0:Math.round(e/_9*100)}function v9(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function y9(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var b9=3;function I0e(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<b9&&a.push(e)):t>0&&(i+=t,o.length<b9&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function L0e(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var x9=e=>typeof e==`string`?e:null;function S9(e){return/^\d+\.\d+\.\d+$/.test(e)?e.split(`.`).map(e=>Number.parseInt(e,10)):null}function R0e(e,t){let n=S9(e),r=S9(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 z0e(e,t){if(e===null||t===null)return!1;let n=R0e(t,e.min);return n!==null&&n>=0}function C9(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=x9(e.min),n=x9(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 B0e(e,t){if(e.gatewayVersion===null)return`unknown`;if(e.versionBeyondValidated)return`beyond`;let{range:n}=C9(t,e.provider);return z0e(n,e.gatewayVersion)?`supported`:`unknown`}function V0e(e){return e===`supported`?THe():e===`beyond`?OHe():jHe()}function w9(e){return e??e1()}function T9(e){return e===null?BHe():LHe({version:e})}function H0e(e,t){if(typeof e!=`object`||!e)return!1;let n=e.providers;return typeof n!=`object`||!n?!1:t in n}var E9=e=>`${e.instanceName}::${e.agentId}`;function U0e(){let e=P(B.me.getMe),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=P(B.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(B.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=P(B.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=>E9(e)===l))&&u(E9(c[0]))},[c,l]);let d=c?.find(e=>E9(e)===l)??null,f=Nn(B.agentFiles.listAgentFiles),[p,m]=(0,N.useState)({status:`idle`}),h=d?.instanceName??null,g=d?.agentId??null,_=P(B.compat.forInstance,n&&h!==null?{instanceName:h}:`skip`),v=n&&h!==null?LZe(_,`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=K(),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:$O()}):(0,I.jsxs)(`div`,{className:`oc-afiles`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:vze()}),(0,I.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,I.jsxs)(Q3,{value:i??``,onValueChange:e=>a(e),children:[(0,I.jsx)(e6,{size:`sm`,"aria-label":xze(),children:(0,I.jsx)($3,{})}),(0,I.jsx)(t6,{children:(r??[]).map(e=>(0,I.jsx)(Q,{value:e.name,children:e.name},e.name))})]}):null,c.length>0?(0,I.jsxs)(Q3,{value:l??``,onValueChange:e=>u(e),children:[(0,I.jsx)(e6,{size:`sm`,"aria-label":wze(),children:(0,I.jsx)($3,{})}),(0,I.jsx)(t6,{children:c.map(e=>(0,I.jsx)(Q,{value:E9(e),children:e.label},E9(e)))})]}):(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Dze()})]}),d===null?null:v===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):v!==null&&v.blocked?(0,I.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,I.jsx)(Om,{size:14,"aria-hidden":!0}),` `,T9(v.gatewayVersion)]}):p.status===`loading`||p.status===`idle`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):p.status===`error`?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[Nze(),` `,(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:X$()})]}):p.files.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Aze()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`oc-afiles__list`,children:p.files.map(e=>{let n=P0e(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:Ize()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`oc-afiles__size`,children:zze({size:v9(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:Hze({pct:w.format(n)})}),r?(0,I.jsx)(Om,{size:14,className:`oc-afiles__warn`,"aria-label":Gze()}):(0,I.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,I.jsx)(Y,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>S(e),children:t?Zze():eBe()})]},e.name)})}),(0,I.jsx)(`p`,{className:`oc-afiles__budget`,children:Jze({used:v9(y9(p.files),C),total:v9(_9,C),pct:w.format(F0e(y9(p.files)))})})]}),x&&d?(0,I.jsx)(W0e,{instanceName:d.instanceName,agentId:d.agentId,name:x.name,isAdmin:t,onClose:()=>S(null),onSaved:()=>void b()}):null]})}function W0e({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=Nn(B.agentFiles.getAgentFile),s=Nn(B.agentFiles.setAgentFile),c=S0(),[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(bBe({name:n})),a(),await C(!1)}catch(e){L0e(e)?b(!0):S(!0)}finally{v(!1)}}}let T=l!==null&&p!==l.content,E=(0,N.useMemo)(()=>l===null?null:I0e(l.content,p),[l,p]),D=p.length>g9,O=K(),ee=(0,N.useMemo)(()=>new Intl.NumberFormat(O),[O]);return(0,I.jsx)(d0,{open:!0,onOpenChange:e=>!e&&i(),children:(0,I.jsxs)(f0,{className:`oc-afiles__editor`,children:[(0,I.jsxs)(p0,{children:[(0,I.jsx)(h0,{children:$$({name:n})}),(0,I.jsxs)(g0,{children:[aBe({agent:t,instance:e}),r?null:(0,I.jsxs)(I.Fragment,{children:[` · `,cBe()]})]})]}),d?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[EBe(),` `,(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void C(!1),children:X$()})]}):l===null?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):(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":$$({name:n})}),(0,I.jsx)(`p`,{className:`oc-afiles__hint`,children:dBe()}),y?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[kBe(),` `,(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void C(!0),children:MBe()})]}):null,x?(0,I.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:CBe()}):null,(0,I.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,I.jsx)(`span`,{className:`oc-afiles__count${D?` is-over`:``}`,children:mBe({count:ee.format(p.length),max:ee.format(g9)})}),r?(0,I.jsx)(Y,{size:`sm`,disabled:!T||_||y,onClick:()=>g(!0),children:_?Y$():_Be()}):null]})]}),(0,I.jsx)(r0,{open:h,onOpenChange:g,children:(0,I.jsxs)(i0,{children:[(0,I.jsxs)(a0,{children:[(0,I.jsx)(s0,{children:FBe({name:n})}),(0,I.jsx)(c0,{children:RBe({agent:t})})]}),E?(0,I.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,I.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:VBe({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:WBe()}),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:qBe()}),E.sampleRemoved.map((e,t)=>(0,I.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,I.jsxs)(o0,{children:[(0,I.jsx)(u0,{children:dU()}),(0,I.jsx)(l0,{onClick:()=>void w(),children:XBe()})]})]})})]})})}var D9=[{id:`messages`,label:()=>kF()},{id:`composer`,label:()=>MF()},{id:`sidebar`,label:()=>FF()},{id:`other`,label:()=>RF()}],O9={showSource:{category:`messages`,label:()=>VF(),help:()=>WF()},showReport:{category:`messages`,label:()=>qF(),help:()=>XF()},copyAssistant:{category:`messages`,label:()=>$F()},copyUser:{category:`messages`,label:()=>nI()},showDelete:{category:`messages`,label:()=>aI()},showTools:{category:`messages`,label:()=>cI(),help:()=>dI()},voiceInput:{category:`composer`,label:()=>mI(),help:()=>_I()},showChatAge:{category:`sidebar`,label:()=>bI(),help:()=>CI()},showChatProvider:{category:`sidebar`,label:()=>EI(),help:()=>kI()}};function k9(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function G0e(e,t){let n=k9(t.trim()),r=new Map(D9.map(e=>[e.id,e.label()])),i=new Map(D9.map(e=>[e.id,[]]));for(let t of e){let e=O9[t],a=e?.category??`other`;n&&!k9(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return D9.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var K0e=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],q0e={voiceInput:`voiceInput`};function J0e(e){return K0e.includes(e)}function A9(e){return e===`admin`}function Y0e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function X0e(e){return e===`on`?!0:e===`off`?!1:null}function Z0e(e){return J0e(e)?q0e[e]:void 0}var Q0e={voiceInput:()=>cL()};function $0e({prefKey:e,ui:t}){let n=F(B.admin.setUiPrefDefault),r=F(B.admin.setFeatureEnabled),i=Z0e(e),a=i?Q0e[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:XI()}),(0,I.jsxs)(Q3,{value:Y0e(t.defaults[e]),onValueChange:t=>void n({key:e,value:X0e(t)}),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-36`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:`on`,children:mL()}),(0,I.jsx)(Q,{value:`off`,children:_L()}),(0,I.jsx)(Q,{value:`inherit`,children:bL()})]})]}),i?(0,I.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,I.jsx)(J5,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":$I()}),$I()]}):null]}),a?(0,I.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function e2e(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(!1),i=P(B.me.getMe,{}),a=i?.ui,o=A9(i?.role)&&n,s=F(B.me.setUiPref).withOptimisticUpdate(w0),c=(0,N.useMemo)(()=>a?G0e(Object.keys(a.effective),e):[],[a,e]);return a?(0,I.jsxs)(`div`,{className:`oc-prefs-panel`,children:[A9(i?.role)?(0,I.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,I.jsx)(J5,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":qI()}),qI()]}):null,o?(0,I.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,I.jsx)(`p`,{children:nL()}),(0,I.jsx)(`p`,{children:aL()}),(0,I.jsx)(`p`,{children:dL()})]}):null,(0,I.jsx)(n0,{value:e,onChange:e=>t(e.target.value),placeholder:MI(),"aria-label":MI(),className:`mb-2`}),c.length===0?(0,I.jsx)(`div`,{className:`oc-prefs__empty`,children:FI()}):(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=O9[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:RI()}):l?null:(0,I.jsx)(`span`,{className:`oc-prefs__def`,children:VI()})]}),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:WI()}):null,(0,I.jsx)(J5,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t===!0}),"aria-label":n})]}),o?(0,I.jsx)($0e,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,I.jsx)(`div`,{className:`oc-prefs__empty`,children:$O()})}function t2e(){let e=P(B.me.getMe,{}),t=F(B.me.setLocale),n=F(B.me.setMyName),r=S0(),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(Fk())}catch(e){r.error(Rk(),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:Ck()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:Ek()})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(n0,{className:`max-w-xs`,value:c,maxLength:120,placeholder:kk(),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l&&(e.preventDefault(),u())}}),(0,I.jsx)(Y,{size:`sm`,disabled:!l,onClick:()=>void u(),children:b$()})]}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:Mk()})]}),(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:Vk()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:Wk()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,I.jsx)(Y,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?nA():e===`en`?aA():mk()},e))}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:qk()})]}),(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:Xk()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:$k()})]}),(0,I.jsx)(e2e,{})]})]})}var n2e=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function r2e(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 i2e(){let e=Nn(B.agentFiles.getChatDefaults),t=Nn(B.agentFiles.setChatDefaults),n=S0(),[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=RZe(P(B.compat.getBridgeCompat,{}),`configDefaults`),f=d===`loading`?null:d.blocked,p=(0,N.useCallback)(async()=>{i({status:`loading`});try{let t=r2e(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(CVe()),await p()}catch(e){n.error(EVe(),e)}finally{u(!1)}}let y=(0,N.useMemo)(()=>n2e.map(e=>({id:e,label:s6(e)})),[]),b=(0,N.useMemo)(()=>[{id:`fast`,label:Z$()},{id:`standard`,label:Q$()}],[]);return(0,I.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:nVe()}),d===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):d.blocked?(0,I.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,I.jsx)(Om,{size:14,"aria-hidden":!0}),` `,T9(d.gatewayVersion)]}):r.status===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):r.status===`error`?(0,I.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[_Ve(),` `,(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void p(),children:X$()})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,I.jsx)(`span`,{className:`oc-cdefaults__label`,children:aVe()}),(0,I.jsx)(f6,{options:y,value:a.thinkingDefault,onChange:e=>o({...a,thinkingDefault:e}),disabled:l}),(0,I.jsx)(`p`,{className:`oc-cdefaults__help`,children:cVe()})]}),(0,I.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,I.jsx)(`span`,{className:`oc-cdefaults__label`,children:dVe()}),(0,I.jsx)(f6,{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:mVe()})]}),(0,I.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,I.jsx)(Y,{size:`sm`,disabled:!_||l,onClick:()=>c(!0),children:l?Y$():bVe()})}),(0,I.jsx)(`p`,{className:`oc-cdefaults__note`,children:kVe()})]}),(0,I.jsx)(r0,{open:s,onOpenChange:c,children:(0,I.jsxs)(i0,{children:[(0,I.jsxs)(a0,{children:[(0,I.jsx)(s0,{children:MVe()}),(0,I.jsx)(c0,{children:FVe()})]}),(0,I.jsxs)(o0,{children:[(0,I.jsx)(u0,{children:dU()}),(0,I.jsx)(l0,{onClick:()=>void v(),children:RVe()})]})]})})]})}function a2e(e){return e===`user`?APe():W$({group:e.group})}function o2e(e){return e===`common`?FPe():e===`owner`?RPe():W$({group:e.group})}function s2e(e){return e.name||e.email||e.userId.slice(0,8)}function c2e(){let e=P(B.admin.listUsers,{}),[t,n]=(0,N.useState)(``),r=P(B.introspect.introspectUser,t?{userId:t}:`skip`);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:nPe()}),(0,I.jsxs)(Q3,{value:t,onValueChange:n,children:[(0,I.jsx)(e6,{size:`sm`,"aria-label":H$(),children:(0,I.jsx)($3,{placeholder:H$()})}),(0,I.jsx)(t6,{children:(e??[]).map(e=>(0,I.jsx)(Q,{value:e.userId,children:s2e(e)},e._id))})]}),t===``?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:sPe()}):r===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):(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:uPe()}),(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:pPe()}),r.groups.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:U$()}):(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:gPe()}),r.agents.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:U$()}):(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:DPe()}):null,(0,I.jsx)($,{variant:`outline`,children:a2e(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:yPe()}),r.charts.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:U$()}):(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:o2e(e.via)})]},e.key))})]}),(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:SPe()}),r.permissions.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:U$()}):(0,I.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,I.jsx)($,{variant:`secondary`,children:e},e))})]})]})]})}function l2e(){return P(B.bridgeHealth.getBridgeHealth,{})}function u2e(){let e=l2e(),t=Vo();return(0,I.jsxs)(`div`,{className:`oc-bridge`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_Ce()}),e===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:N$()}):e===null?(0,I.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:SCe()}):(0,I.jsx)(m2e,{health:e,onSeeAnomalies:()=>void t({to:`/settings/anomalies`,search:{status:`open`}})}),(0,I.jsx)(d2e,{})]})}function d2e(){let e=P(B.compat.getBridgeCompat,{});return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`oc-bridge__section`,children:VVe()}),e===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:N$()}):e===null?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:WVe()}):(0,I.jsx)(f2e,{data:e})]})}function f2e({data:e}){let t=C9(e.compat,`openclaw`);return(0,I.jsxs)(`div`,{className:`oc-compat`,children:[(0,I.jsxs)(`div`,{className:`oc-compat__meta`,children:[(0,I.jsxs)(`span`,{children:[qVe(),` `,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:w9(e.bridgeVersion)})]}),(0,I.jsxs)(`span`,{children:[XVe(),` `,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.protocolVersion===null?e1():String(e.protocolVersion)})]}),(0,I.jsx)(`span`,{children:P$({time:new Date(e.fetchedAt).toLocaleString(`fr-FR`)})})]}),e.reachable?null:(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:tHe()}),e.compat===null?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:iHe()}):(0,I.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,I.jsx)(`span`,{className:`oc-compat__label`,children:sHe()}),t.range===null?(0,I.jsx)(`span`,{children:e1()}):(0,I.jsx)(`span`,{children:uHe({min:t.range.min,max:t.range.maxValidated})}),(0,I.jsx)(p2e,{versions:t.validatedVersions})]}),e.targets.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:SHe()}):(0,I.jsx)(`div`,{className:`oc-compat__targets`,children:e.targets.map(t=>{let n=B0e(t,e.compat);return(0,I.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:t.instanceName}),(0,I.jsx)(`span`,{className:`oc-compat__provider`,children:t.provider}),(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:w9(t.gatewayVersion)}),(0,I.jsx)($,{variant:n===`supported`?`secondary`:n===`beyond`?`destructive`:`outline`,children:V0e(n)})]},t.instanceName)})}),H0e(e.compat,`hermes`)?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:PHe()}):null]})}function p2e({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,I.jsxs)(Y1,{children:[(0,I.jsx)(X1,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?pHe():gHe({count:e.length}),(0,I.jsx)(cm,{size:13,"aria-hidden":!0})]})}),(0,I.jsxs)(Z1,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,I.jsx)(`p`,{className:`oc-compat__versions-title`,children:yHe()}),(0,I.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,I.jsx)($,{variant:`secondary`,children:e},e))})]})]})}function m2e({health:e,onSeeAnomalies:t}){let n=e.targets.filter(e=>e.state===`error`),r=!e.reachable,i=e.reachable&&n.length===0,a=i?`ok`:`error`,o=new Date(e.checkedAt).toLocaleString(`fr-FR`),s=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${a}`,children:[(0,I.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:i?(0,I.jsx)(dm,{size:22}):r?(0,I.jsx)(Oee,{size:22}):(0,I.jsx)(Om,{size:22})}),(0,I.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,I.jsx)(`div`,{className:`oc-bridge-card__title`,children:i?TCe():r?OCe():jCe({count:n.length})}),(0,I.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,I.jsxs)(`span`,{children:[(0,I.jsx)(wee,{size:12,"aria-hidden":!0}),` `,P$({time:o})]}),s?(0,I.jsx)(`span`,{children:ICe({time:s})}):null]}),r?(0,I.jsx)(`p`,{className:`oc-bridge-card__hint`,children:a9(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,I.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:t,children:zCe()})]}),(0,I.jsx)(`h3`,{className:`oc-bridge__section`,children:HCe({count:e.targets.length})}),e.targets.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:GCe()}):(0,I.jsx)(`div`,{className:`oc-bridge-targets`,children:e.targets.map(e=>{let t=e.lastErrorCode?a9(e.lastErrorCode):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)(h2e,{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:[JCe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts}),e.lastOkAt?ZCe({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]},e.key)})})]})}function h2e({state:e}){return e===`connected`?(0,I.jsx)($,{variant:`secondary`,children:ewe()}):e===`error`?(0,I.jsx)($,{variant:`destructive`,children:rwe()}):(0,I.jsx)($,{variant:`outline`,children:owe()})}var j9=[{id:`personal`,label:()=>oLe(),tabs:[`preferences`,`theme`,`files`]},{id:`agents`,label:()=>lLe(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`bridge`]},{id:`access`,label:()=>fLe(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`]},{id:`observability`,label:()=>hLe(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`integrations`]}],g2e=new Map(j9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function M9(e){let t=g2e.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function _2e(e,t){return e.find(e=>M9(e)===t)}j9.flatMap(e=>[...e.tabs]);function v2e({delayDuration:e=0,...t}){return(0,I.jsx)(kle,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function y2e({...e}){return(0,I.jsx)(Ale,{"data-slot":`tooltip`,...e})}function b2e({...e}){return(0,I.jsx)(jle,{"data-slot":`tooltip-trigger`,...e})}function x2e({className:e,sideOffset:t=0,children:n,...r}){return(0,I.jsx)(Mle,{children:(0,I.jsxs)(Nle,{"data-slot":`tooltip-content`,sideOffset:t,className:V1(`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)(Ple,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function S2e(){let e=P(B.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.known?e.available?`ok`:`error`:`idle`,n=e.known?e.available?`${EOe()}${e.checkedAt?kOe({time:new Date(e.checkedAt).toLocaleTimeString(`fr-FR`)}):``}`:MOe({reason:e.reason??`?`}):COe();return(0,I.jsx)(v2e,{delayDuration:150,children:(0,I.jsxs)(y2e,{children:[(0,I.jsx)(b2e,{asChild:!0,children:(0,I.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${t}`,role:`img`,"aria-label":n})}),(0,I.jsx)(x2e,{children:n})]})})}var C2e={users:()=>_Ne(),groups:()=>XNe(),instances:()=>bNe(),bridge:()=>CNe(),serviceAccounts:()=>ENe(),roles:()=>kNe(),traces:()=>MNe(),kpi:()=>FNe(),anomalies:()=>RNe(),files:()=>cA(),agentFiles:()=>hze(),preferences:()=>bk(),chatDefaults:()=>$Be(),access:()=>$Ne(),integrations:()=>VNe(),theme:()=>dM(),audit:()=>WNe(),feedbacks:()=>qNe()};function N9(e){let t=new Set(E7),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 E7)n.has(e)||r.push(e);return r}function w2e(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function T2e({tab:e,active:t}){let n=C2e[e]?.()??O7[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)(S2e,{}):null]});return D7.includes(e)?(0,I.jsx)(ts,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,I.jsx)(ts,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function E2e({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=E5({id:e});return(0,I.jsxs)(`div`,{ref:i,style:{transform:t8.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":JIe(),...n,...r,children:(0,I.jsx)(gm,{size:14,"aria-hidden":!0})}),(0,I.jsx)(T2e,{tab:e,active:t})]})}function D2e(){let e=P(B.me.getMe),t=F(B.me.setSettingsTabOrder),n=N7(Ts({select:e=>e.pathname})),r=n===void 0?void 0:M9(n),i=(0,N.useMemo)(()=>N9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,N.useState)(i);(0,N.useEffect)(()=>o(i),[i]);let s=(0,N.useMemo)(()=>new Set(j7(e?.permissions??[])),[e?.permissions]),c=(0,N.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&M9(e)===r),[a,s,r]),l=s8(o8(V8,{activationConstraint:{distance:5}}),o8(L8,{coordinateGetter:O5}));if(r===void 0||c.length===0)return null;let u=j9.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=w2e(a,g5(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)(d5,{sensors:l,collisionDetection:CQe,modifiers:[N$e],onDragEnd:d,children:(0,I.jsx)(C5,{items:c,strategy:B$e,children:c.map(e=>(0,I.jsx)(E2e,{tab:e,active:e===n},e))})})})}function O2e(){let e=P(B.me.getMe),t=Vo(),n=N7(Ts({select:e=>e.pathname})),r=n===void 0?void 0:M9(n),i=(0,N.useMemo)(()=>new Set(j7(e?.permissions??[])),[e?.permissions]),a=(0,N.useMemo)(()=>N9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=j9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=_2e(a,e.id);n&&t({to:M7(n)})}return(0,I.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":ZIe(),children:[(0,I.jsx)(ts,{to:`/`,className:`oc-settings-nav__back`,children:eLe()}),(0,I.jsx)(`div`,{className:`oc-settings-nav__title`,children:rLe()}),(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 k2e=`background.foreground.card.card-foreground.popover.popover-foreground.primary.primary-foreground.secondary.secondary-foreground.muted.muted-foreground.accent.accent-foreground.destructive.destructive-foreground.border.input.ring.chart-1.chart-2.chart-3.chart-4.chart-5.sidebar.sidebar-foreground.sidebar-primary.sidebar-primary-foreground.sidebar-accent.sidebar-accent-foreground.sidebar-border.sidebar-ring`.split(`.`),P9=[{key:`ocean`,name:`Ocean`,tokens:{colors:{light:{background:`oklch(0.985 0.012 230)`,foreground:`oklch(0.22 0.04 245)`,card:`oklch(0.995 0.008 230)`,"card-foreground":`oklch(0.22 0.04 245)`,popover:`oklch(0.995 0.008 230)`,"popover-foreground":`oklch(0.22 0.04 245)`,primary:`oklch(0.55 0.13 235)`,"primary-foreground":`oklch(0.99 0.01 230)`,secondary:`oklch(0.93 0.03 220)`,"secondary-foreground":`oklch(0.28 0.05 240)`,muted:`oklch(0.94 0.02 225)`,"muted-foreground":`oklch(0.5 0.04 235)`,accent:`oklch(0.9 0.05 200)`,"accent-foreground":`oklch(0.28 0.06 230)`,border:`oklch(0.88 0.03 225)`,input:`oklch(0.88 0.03 225)`,ring:`oklch(0.55 0.13 235)`,"chart-1":`oklch(0.6 0.13 235)`,"chart-2":`oklch(0.65 0.12 200)`,"chart-3":`oklch(0.55 0.1 260)`,"chart-4":`oklch(0.7 0.11 180)`,"chart-5":`oklch(0.5 0.12 215)`,sidebar:`oklch(0.96 0.02 228)`,"sidebar-foreground":`oklch(0.24 0.04 245)`,"sidebar-primary":`oklch(0.55 0.13 235)`,"sidebar-primary-foreground":`oklch(0.99 0.01 230)`,"sidebar-accent":`oklch(0.9 0.05 200)`,"sidebar-accent-foreground":`oklch(0.28 0.06 230)`,"sidebar-border":`oklch(0.87 0.03 225)`,"sidebar-ring":`oklch(0.55 0.13 235)`},dark:{background:`oklch(0.2 0.03 245)`,foreground:`oklch(0.95 0.02 225)`,card:`oklch(0.25 0.04 245)`,"card-foreground":`oklch(0.95 0.02 225)`,popover:`oklch(0.25 0.04 245)`,"popover-foreground":`oklch(0.95 0.02 225)`,primary:`oklch(0.7 0.12 230)`,"primary-foreground":`oklch(0.18 0.04 245)`,secondary:`oklch(0.3 0.04 240)`,"secondary-foreground":`oklch(0.95 0.02 225)`,muted:`oklch(0.3 0.03 242)`,"muted-foreground":`oklch(0.72 0.04 228)`,accent:`oklch(0.4 0.07 210)`,"accent-foreground":`oklch(0.96 0.02 220)`,border:`oklch(0.35 0.03 242)`,input:`oklch(0.35 0.03 242)`,ring:`oklch(0.7 0.12 230)`,"chart-1":`oklch(0.7 0.13 230)`,"chart-2":`oklch(0.72 0.12 195)`,"chart-3":`oklch(0.65 0.11 260)`,"chart-4":`oklch(0.76 0.1 180)`,"chart-5":`oklch(0.62 0.12 215)`,sidebar:`oklch(0.23 0.04 246)`,"sidebar-foreground":`oklch(0.95 0.02 225)`,"sidebar-primary":`oklch(0.7 0.12 230)`,"sidebar-primary-foreground":`oklch(0.18 0.04 245)`,"sidebar-accent":`oklch(0.4 0.07 210)`,"sidebar-accent-foreground":`oklch(0.96 0.02 220)`,"sidebar-border":`oklch(0.34 0.03 242)`,"sidebar-ring":`oklch(0.7 0.12 230)`}},radius:`0.75rem`,fontSans:`ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif`}},{key:`forest`,name:`Forest`,tokens:{colors:{light:{background:`oklch(0.985 0.012 130)`,foreground:`oklch(0.24 0.04 145)`,card:`oklch(0.995 0.008 130)`,"card-foreground":`oklch(0.24 0.04 145)`,popover:`oklch(0.995 0.008 130)`,"popover-foreground":`oklch(0.24 0.04 145)`,primary:`oklch(0.52 0.12 150)`,"primary-foreground":`oklch(0.99 0.01 130)`,secondary:`oklch(0.93 0.04 130)`,"secondary-foreground":`oklch(0.3 0.05 150)`,muted:`oklch(0.94 0.03 135)`,"muted-foreground":`oklch(0.5 0.04 145)`,accent:`oklch(0.9 0.06 115)`,"accent-foreground":`oklch(0.3 0.06 150)`,border:`oklch(0.88 0.03 135)`,input:`oklch(0.88 0.03 135)`,ring:`oklch(0.52 0.12 150)`,"chart-1":`oklch(0.58 0.13 150)`,"chart-2":`oklch(0.68 0.12 120)`,"chart-3":`oklch(0.6 0.11 95)`,"chart-4":`oklch(0.55 0.1 175)`,"chart-5":`oklch(0.5 0.12 140)`,sidebar:`oklch(0.96 0.02 132)`,"sidebar-foreground":`oklch(0.26 0.04 145)`,"sidebar-primary":`oklch(0.52 0.12 150)`,"sidebar-primary-foreground":`oklch(0.99 0.01 130)`,"sidebar-accent":`oklch(0.9 0.06 115)`,"sidebar-accent-foreground":`oklch(0.3 0.06 150)`,"sidebar-border":`oklch(0.87 0.03 135)`,"sidebar-ring":`oklch(0.52 0.12 150)`},dark:{background:`oklch(0.2 0.03 150)`,foreground:`oklch(0.95 0.02 130)`,card:`oklch(0.25 0.04 150)`,"card-foreground":`oklch(0.95 0.02 130)`,popover:`oklch(0.25 0.04 150)`,"popover-foreground":`oklch(0.95 0.02 130)`,primary:`oklch(0.68 0.13 145)`,"primary-foreground":`oklch(0.18 0.04 150)`,secondary:`oklch(0.3 0.04 148)`,"secondary-foreground":`oklch(0.95 0.02 130)`,muted:`oklch(0.3 0.03 150)`,"muted-foreground":`oklch(0.72 0.04 135)`,accent:`oklch(0.4 0.07 120)`,"accent-foreground":`oklch(0.96 0.02 125)`,border:`oklch(0.35 0.03 148)`,input:`oklch(0.35 0.03 148)`,ring:`oklch(0.68 0.13 145)`,"chart-1":`oklch(0.68 0.14 148)`,"chart-2":`oklch(0.74 0.12 120)`,"chart-3":`oklch(0.68 0.11 95)`,"chart-4":`oklch(0.62 0.1 175)`,"chart-5":`oklch(0.6 0.12 140)`,sidebar:`oklch(0.23 0.04 150)`,"sidebar-foreground":`oklch(0.95 0.02 130)`,"sidebar-primary":`oklch(0.68 0.13 145)`,"sidebar-primary-foreground":`oklch(0.18 0.04 150)`,"sidebar-accent":`oklch(0.4 0.07 120)`,"sidebar-accent-foreground":`oklch(0.96 0.02 125)`,"sidebar-border":`oklch(0.34 0.03 148)`,"sidebar-ring":`oklch(0.68 0.13 145)`}},radius:`0.375rem`,fontSans:`Georgia, Cambria, 'Times New Roman', Times, serif`}},{key:`dusk`,name:`Dusk`,tokens:{colors:{light:{background:`oklch(0.985 0.012 300)`,foreground:`oklch(0.24 0.05 300)`,card:`oklch(0.995 0.008 300)`,"card-foreground":`oklch(0.24 0.05 300)`,popover:`oklch(0.995 0.008 300)`,"popover-foreground":`oklch(0.24 0.05 300)`,primary:`oklch(0.55 0.16 300)`,"primary-foreground":`oklch(0.99 0.01 300)`,secondary:`oklch(0.93 0.04 310)`,"secondary-foreground":`oklch(0.3 0.06 300)`,muted:`oklch(0.94 0.03 305)`,"muted-foreground":`oklch(0.5 0.05 300)`,accent:`oklch(0.9 0.07 70)`,"accent-foreground":`oklch(0.32 0.08 60)`,border:`oklch(0.88 0.03 305)`,input:`oklch(0.88 0.03 305)`,ring:`oklch(0.55 0.16 300)`,"chart-1":`oklch(0.58 0.17 300)`,"chart-2":`oklch(0.7 0.15 70)`,"chart-3":`oklch(0.55 0.15 330)`,"chart-4":`oklch(0.65 0.14 35)`,"chart-5":`oklch(0.5 0.16 280)`,sidebar:`oklch(0.96 0.02 303)`,"sidebar-foreground":`oklch(0.26 0.05 300)`,"sidebar-primary":`oklch(0.55 0.16 300)`,"sidebar-primary-foreground":`oklch(0.99 0.01 300)`,"sidebar-accent":`oklch(0.9 0.07 70)`,"sidebar-accent-foreground":`oklch(0.32 0.08 60)`,"sidebar-border":`oklch(0.87 0.03 305)`,"sidebar-ring":`oklch(0.55 0.16 300)`},dark:{background:`oklch(0.2 0.04 300)`,foreground:`oklch(0.95 0.02 305)`,card:`oklch(0.25 0.05 300)`,"card-foreground":`oklch(0.95 0.02 305)`,popover:`oklch(0.25 0.05 300)`,"popover-foreground":`oklch(0.95 0.02 305)`,primary:`oklch(0.72 0.15 300)`,"primary-foreground":`oklch(0.18 0.04 300)`,secondary:`oklch(0.3 0.05 305)`,"secondary-foreground":`oklch(0.95 0.02 305)`,muted:`oklch(0.3 0.04 303)`,"muted-foreground":`oklch(0.72 0.05 305)`,accent:`oklch(0.45 0.1 65)`,"accent-foreground":`oklch(0.96 0.02 70)`,border:`oklch(0.35 0.04 303)`,input:`oklch(0.35 0.04 303)`,ring:`oklch(0.72 0.15 300)`,"chart-1":`oklch(0.72 0.16 300)`,"chart-2":`oklch(0.78 0.14 70)`,"chart-3":`oklch(0.68 0.15 330)`,"chart-4":`oklch(0.72 0.13 35)`,"chart-5":`oklch(0.64 0.16 280)`,sidebar:`oklch(0.23 0.05 300)`,"sidebar-foreground":`oklch(0.95 0.02 305)`,"sidebar-primary":`oklch(0.72 0.15 300)`,"sidebar-primary-foreground":`oklch(0.18 0.04 300)`,"sidebar-accent":`oklch(0.45 0.1 65)`,"sidebar-accent-foreground":`oklch(0.96 0.02 70)`,"sidebar-border":`oklch(0.34 0.04 303)`,"sidebar-ring":`oklch(0.72 0.15 300)`}},radius:`1rem`,fontSans:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`}}];new Set(P9.map(e=>e.key));function F9(e){let t=e??localStorage.getItem(`oc.theme`)??`system`,n=()=>t===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:t,[r,i]=(0,N.useState)(n);return(0,N.useEffect)(()=>{if(i(n()),t!==`system`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>i(e.matches?`dark`:`light`);return e.addEventListener(`change`,r),()=>e.removeEventListener(`change`,r)},[t]),r}function A2e(e,t){let n=document.documentElement.style,r=e?.colors[t];for(let e of k2e){let t=r?.[e];t===void 0?n.removeProperty(`--`+e):n.setProperty(`--`+e,t)}e?.radius===void 0?n.removeProperty(`--radius`):n.setProperty(`--radius`,e.radius),e?.fontSans===void 0?n.removeProperty(`--ui-font-sans`):n.setProperty(`--ui-font-sans`,e.fontSans),e?.fontMono===void 0?n.removeProperty(`--ui-font-mono`):n.setProperty(`--ui-font-mono`,e.fontMono)}function j2e(e,t){(0,N.useEffect)(()=>{A2e(e??null,t)},[e,t])}var I9=`__all__`,L9={kind:`relative`,from:`now-24h`,to:`now`},M2e=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function R9({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 N2e(e){return e===`light`?ak():e===`dark`?ck():dk()}var P2e=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function F2e({tokens:e,mode:t}){let n=e.colors[t];return(0,I.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:P2e.map(e=>{let t=n[e];return(0,I.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function z9({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,I.jsxs)(`button`,{type:`button`,className:V1(`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)(sm,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,I.jsx)(F2e,{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 I2e({selectedKey:e,resolvedMode:t}){let n=P(B.charts.listMyCharts),r=F(B.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:RM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:VM()})]}),(0,I.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,I.jsx)(z9,{selected:e===null,title:WM(),subtitle:qM(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?XM():n.via===`owner`?$M():nN({group:n.via.group});return(0,I.jsx)(z9,{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:aN()}):null]})}function L2e(){let e=F(B.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(cP())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(mP());return}let a;try{a=JSON.parse(r)}catch{o(cP());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:RN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:VN()})]}),(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:WN()}),(0,I.jsx)(n0,{value:t,onChange:e=>n(e.target.value),placeholder:qN(),maxLength:60})]}),(0,I.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,I.jsx)(`span`,{className:`oc-chart-import__label`,children:XN()}),(0,I.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:$N(),rows:8,spellCheck:!1})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(Y,{variant:`outline`,size:`sm`,asChild:!0,children:(0,I.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,I.jsx)(Dee,{className:`size-4`}),nP(),(0,I.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,I.jsx)(Y,{size:`sm`,disabled:l,onClick:()=>void f(),children:aP()})]}),a?(0,I.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,I.jsx)(`p`,{className:`oc-chart-import__ok`,children:dP()}):null]})]})}function R2e({chartKey:e,myGroups:t,restricted:n}){let r=F(B.charts.assignChartToGroup),i=F(B.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:WP()}),(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":$P({group:e.name}),onClick:()=>void c(e.groupId),children:(0,I.jsx)(jm,{className:`size-3`})})]},e.groupId)),t.length===0?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:qP()}):o.length>0?(0,I.jsxs)(Q3,{value:``,onValueChange:e=>void s(e),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-56`,children:(0,I.jsx)($3,{placeholder:XP()})}),(0,I.jsx)(t6,{children:o.map(e=>(0,I.jsx)(Q,{value:e.groupId,children:e.name},e.groupId))})]}):null]})}function z2e({chart:e,myGroups:t}){let n=F(B.charts.updateChart),r=F(B.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(cP());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(nF()))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)(Y,{variant:`outline`,size:`sm`,onClick:m,children:EP()}),(0,I.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>void g(),children:kP()})]})})]}),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:RP()}),(0,I.jsx)(n0,{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:VP()}),(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)(Y,{size:`sm`,disabled:f,onClick:()=>void h(),children:MP()}),(0,I.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:FP()})]})]}):null,(0,I.jsx)(R2e,{chartKey:e.key,myGroups:t,restricted:e.restrictedToGroups})]})}function B2e(){let e=P(B.charts.listMyCharts),t=P(B.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:_P()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:bP()})]}),e!==void 0&&n.length===0?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:CP()}):(0,I.jsx)(`div`,{className:`oc-chart-mine-list`,children:n.map(e=>(0,I.jsx)(z2e,{chart:e,myGroups:t??[]},e.key))})]})}function V2e({chart:e,groups:t}){let n=F(B.charts.assignChartToGroup),r=F(B.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?CN():e.kind===`custom`&&e.scope===`personal`?mF():bN()}),e.isGlobalDefault?(0,I.jsx)($,{variant:`default`,children:EN()}):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":FN({group:e.name}),onClick:()=>void c(e.groupId),children:(0,I.jsx)(jm,{className:`size-3`})})]},e.groupId)),o.length>0?(0,I.jsxs)(Q3,{value:``,onValueChange:e=>void s(e),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-56`,children:(0,I.jsx)($3,{placeholder:kN()})}),(0,I.jsx)(t6,{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:MN()}):null]})]})}function H2e({chart:e}){let t=F(B.charts.promoteChartToCommon),n=F(B.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(nF()))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`?_F():mF()}),e.ownerLabel?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:dF({owner:e.ownerLabel})}):null]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:bF()}):null,(0,I.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:CF()})]})]})}function U2e({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=F(B.admin.setDefaultThemeMode),i=F(B.admin.setDefaultLocale),a=F(B.charts.setDefaultChart),o=P(B.charts.listChartsAdmin),s=P(B.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:MM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:FM()})]}),(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:cN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:dN()})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(Y,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:WM()}),P9.map(e=>(0,I.jsx)(Y,{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)(Y,{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:mN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:_N()})]}),(0,I.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,I.jsx)(V2e,{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:aF()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:cF()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:EF()}):(0,I.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,I.jsx)(H2e,{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:mM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:_M()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,I.jsx)(Y,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:N2e(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:bM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:CM()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,I.jsx)(Y,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?nA():aA()},e))}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:EM()})]})]})}function W2e(){let e=P(B.me.getMe),t=F9(e?.resolvedThemeMode);return(0,I.jsxs)(`div`,{className:`oc-appearance`,children:[(0,I.jsx)(I2e,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,I.jsx)(L2e,{}),(0,I.jsx)(B2e,{}),e?.role===`admin`?(0,I.jsx)(U2e,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function G2e(){let[e,t]=(0,N.useState)(!0),[n,r]=(0,N.useState)(`per-user`),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(I9),[c,l]=(0,N.useState)(I9),[u,d]=(0,N.useState)(L9),f=i!==``||o!==I9||c!==I9;function p(){a(``),s(I9),l(I9),d(L9)}return(0,I.jsxs)(`div`,{className:`oc-show`,children:[(0,I.jsx)(W2e,{}),(0,I.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,I.jsx)(`summary`,{className:`oc-show__title`,children:kM()}),(0,I.jsxs)(R9,{title:`Buttons`,description:`Variants`,children:[(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(Y,{children:`Default`}),(0,I.jsx)(Y,{variant:`secondary`,children:`Secondary`}),(0,I.jsx)(Y,{variant:`outline`,children:`Outline`}),(0,I.jsx)(Y,{variant:`ghost`,children:`Ghost`}),(0,I.jsx)(Y,{variant:`destructive`,children:`Destructive`}),(0,I.jsx)(Y,{variant:`link`,children:`Link`})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(Y,{size:`sm`,children:`Small`}),(0,I.jsx)(Y,{children:`Default`}),(0,I.jsx)(Y,{size:`lg`,children:`Large`}),(0,I.jsx)(Y,{size:`icon`,"aria-label":`more`,children:(0,I.jsx)(hm,{})}),(0,I.jsx)(Y,{disabled:!0,children:`Disabled`})]})]}),(0,I.jsx)(R9,{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)(R9,{title:`Inputs & selection`,children:(0,I.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,I.jsx)(n0,{placeholder:`Text input…`}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsxs)(Q3,{value:n,onValueChange:r,children:[(0,I.jsx)(e6,{className:`w-56`,children:(0,I.jsx)($3,{placeholder:`Select…`})}),(0,I.jsxs)(t6,{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)(J5,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,I.jsx)(R9,{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)(f7,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,I.jsxs)(Q3,{value:o,onValueChange:s,children:[(0,I.jsx)(e6,{size:`sm`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:I9,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)(Q3,{value:c,onValueChange:l,children:[(0,I.jsx)(e6,{size:`sm`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:I9,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)(m7,{fields:M2e,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)(d7,{value:u,onChange:d})]})]})}),(0,I.jsx)(R9,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,I.jsxs)(H1,{children:[(0,I.jsx)(U1,{asChild:!0,children:(0,I.jsx)(Y,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,I.jsx)(hm,{})})}),(0,I.jsxs)(W1,{align:`start`,children:[(0,I.jsx)(K1,{children:`Actions`}),(0,I.jsx)(q1,{}),(0,I.jsx)(G1,{children:`Edit`}),(0,I.jsx)(G1,{children:`Duplicate`}),(0,I.jsx)(q1,{}),(0,I.jsx)(G1,{variant:`destructive`,children:`Delete`})]})]})}),(0,I.jsx)(R9,{title:`Card`,children:(0,I.jsxs)(q7,{className:`w-80`,children:[(0,I.jsxs)(J7,{children:[(0,I.jsx)(Y7,{children:`Instance`}),(0,I.jsx)(X7,{children:`Non-secret metadata only.`})]}),(0,I.jsx)(Z7,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,I.jsxs)(s0e,{className:`gap-2`,children:[(0,I.jsx)(Y,{size:`sm`,children:`Save`}),(0,I.jsx)(Y,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,I.jsx)(R9,{title:`Table`,children:(0,I.jsxs)(Y5,{children:[(0,I.jsx)(X5,{children:(0,I.jsxs)(Q5,{children:[(0,I.jsx)($5,{className:`w-8`,children:(0,I.jsx)(J5,{"aria-label":`select all`})}),(0,I.jsx)($5,{children:`Name`}),(0,I.jsx)($5,{children:`Mode`}),(0,I.jsx)($5,{className:`text-right`,children:`Status`}),(0,I.jsx)($5,{className:`w-8`})]})}),(0,I.jsx)(Z5,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,I.jsxs)(Q5,{children:[(0,I.jsx)(e7,{children:(0,I.jsx)(J5,{"aria-label":`select ${e.n}`})}),(0,I.jsx)(e7,{className:`font-medium`,children:e.n}),(0,I.jsx)(e7,{children:(0,I.jsx)($,{variant:`secondary`,children:e.m})}),(0,I.jsx)(e7,{className:`text-right`,children:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,I.jsx)(sm,{className:`size-3.5`}),` `,e.s]})}),(0,I.jsx)(e7,{children:(0,I.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,I.jsx)(hm,{})})})]},e.n))})]})}),(0,I.jsx)(R9,{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 B9=`oc.theme`;function V9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function H9(e){(0,N.useEffect)(()=>{let t=e??localStorage.getItem(B9)??`system`;if(localStorage.setItem(B9,t),V9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>V9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}function K2e(e){(0,N.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=K()}catch{t=void 0}t!==e&&KO(e)},[e])}var U9=`oc.sidebar.width`,W9=`oc.sidebar.collapsed`,G9=200,K9=520,q2e=260;function q9(e){return Math.min(K9,Math.max(G9,e))}function J2e(){let[e,t]=(0,N.useState)(()=>{let e=Number(localStorage.getItem(U9));return e?q9(e):q2e}),[n,r]=(0,N.useState)(()=>localStorage.getItem(W9)===`1`);(0,N.useEffect)(()=>{localStorage.setItem(U9,String(e))},[e]),(0,N.useEffect)(()=>{localStorage.setItem(W9,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(q9(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:G9,MAX_WIDTH:K9}}function Y2e(){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Jn,{children:(0,I.jsx)(`div`,{className:`oc-boot`,children:k$()})}),(0,I.jsx)(qn,{children:(0,I.jsx)(Z2e,{})}),(0,I.jsx)(Kn,{children:(0,I.jsx)(WUe,{children:(0,I.jsx)(Q2e,{})})})]})}function X2e(){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 Z2e(){let{signIn:e}=gr();H9(void 0);let t=P(B.me.authProviders),[n,r]=(0,N.useState)(null);async function i(t){r(null);try{await e(t)}catch{r(dxe())}}let a=t!==void 0&&!t.google&&!t.microsoft&&!t.anonymous;return(0,I.jsxs)(`div`,{className:`oc-signin`,children:[(0,I.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 560`,preserveAspectRatio:`xMidYMid slice`,"aria-hidden":`true`,children:[(0,I.jsx)(`polyline`,{className:`oc-signin__line`,points:`0,300 520,300 562,170 605,440 650,235 700,300 1200,300`,vectorEffect:`non-scaling-stroke`}),(0,I.jsx)(`polyline`,{className:`oc-signin__pulse`,points:`0,300 520,300 562,170 605,440 650,235 700,300 1200,300`,pathLength:`100`,vectorEffect:`non-scaling-stroke`})]}),(0,I.jsx)(`div`,{className:`oc-signin__brand`,children:(0,I.jsx)(`span`,{className:`oc-signin__wordmark`,children:`Atrium`})}),(0,I.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,I.jsx)(`h1`,{className:`oc-signin__title`,children:mxe()}),(0,I.jsx)(`p`,{className:`oc-signin__subtitle`,children:_xe()}),(0,I.jsx)(`div`,{className:`oc-signin__providers`,children:t?.google?(0,I.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void i(`google`),children:[(0,I.jsx)(X2e,{}),(0,I.jsx)(`span`,{children:bxe()})]}):null}),n?(0,I.jsx)(`p`,{className:`oc-signin__error`,children:n}):null,a?(0,I.jsx)(`p`,{className:`oc-signin__error`,children:Cxe()}):null,t?.anonymous?(0,I.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:Exe()}):null]})]})}function Q2e(){let e=P(B.me.getMe),t=F(B.me.bootstrap),n=Vo();(0,N.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),H9(e?.resolvedThemeMode);let r=F9(e?.resolvedThemeMode);j2e(e?.resolvedChartTokens,r),K2e(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:k$()});let a=e.name||e.email||kxe();return e.role===`pending`?(0,I.jsxs)(`div`,{className:`oc-shell`,children:[(0,I.jsx)(J9,{}),(0,I.jsx)(G5,{}),(0,I.jsxs)(`header`,{className:`oc-topbar`,children:[(0,I.jsx)(`span`,{className:`oc-topbar__brand`,children:`OpenClaw`}),(0,I.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,I.jsx)(K5,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,I.jsxs)(`div`,{className:`oc-pending`,children:[(0,I.jsx)(`h1`,{className:`oc-pending__title`,children:Mxe()}),(0,I.jsx)(`p`,{className:`oc-pending__body`,children:Fxe()})]})]}):(0,I.jsx)(e4e,{canOpenSettings:j7(e.permissions??[]).length>0,userLabel:a,themeMode:e.themeMode},e.userId)}function J9(){let e=P(B.me.getImpersonation),t=F(B.admin.stopImpersonation);return!e||!e.impersonating?null:(0,I.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,I.jsx)(lee,{className:`size-4 shrink-0`}),(0,I.jsxs)(`span`,{className:`oc-imp__text`,children:[Rxe(),` `,(0,I.jsx)(`strong`,{children:e.targetLabel}),Vxe(),(0,I.jsx)(`strong`,{children:e.realLabel}),Wxe()]}),(0,I.jsx)(Y,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:qxe()})]})}function $2e({userLabel:e,themeMode:t,collapsed:n,onToggleSidebar:r}){return(0,I.jsxs)(`header`,{className:`oc-topbar`,children:[(0,I.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,I.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":n?Xxe():$xe(),onClick:r,children:n?(0,I.jsx)(yee,{}):(0,I.jsx)(vee,{})}),(0,I.jsx)(ts,{to:`/`,className:`oc-topbar__brand`,children:`OpenClaw`})]}),(0,I.jsx)(`div`,{className:`oc-topbar__search`,children:(0,I.jsx)(d1e,{})}),(0,I.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,I.jsx)(l1e,{}),(0,I.jsx)(K5,{label:e,mode:t})]})]})}function e4e({canOpenSettings:e,userLabel:t,themeMode:n}){let{width:r,collapsed:i,toggleCollapsed:a,startResize:o}=J2e(),s=ys(),c=zo({strict:!1}),l=Vo(),u=!!s({to:`/settings`,fuzzy:!0});return(0,I.jsxs)(`div`,{className:`oc-shell`,children:[(0,I.jsx)(J9,{}),(0,I.jsx)(G5,{}),(0,I.jsx)($2e,{userLabel:t,themeMode:n,collapsed:i,onToggleSidebar:a}),(0,I.jsxs)(`div`,{className:`oc-workspace`,children:[i?null:(0,I.jsxs)(`div`,{className:`oc-sidebar-col`,style:{width:r,flex:`0 0 ${r}px`},children:[u?(0,I.jsx)(O2e,{}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i1e,{activeChatId:c.chatId??null,onSelect:e=>void l({to:`/chat/$chatId`,params:{chatId:e}})}),e?(0,I.jsx)(Y,{variant:`ghost`,className:`m-2 justify-start`,asChild:!0,children:(0,I.jsx)(ts,{to:`/settings`,children:nSe()})}):null]}),(0,I.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:o,role:`separator`,"aria-orientation":`vertical`,"aria-label":aSe()})]}),(0,I.jsx)(`main`,{className:`oc-main`,children:(0,I.jsx)(hs,{})})]})]})}function t4e(){let e=P(B.me.getMe),t=Vo(),n=Ts({select:e=>e.pathname}),r=(0,N.useMemo)(()=>e?j7(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:k$()});if(i)return null;let a=N7(n),o=a!==void 0&&!r.includes(a);return(0,I.jsxs)(`div`,{className:`oc-admin`,children:[(0,I.jsx)(D2e,{}),(0,I.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,I.jsx)(n4e,{}):(0,I.jsx)(hs,{})})]})}function n4e(){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)(Om,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:cSe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:dSe()})]})}function r4e(){let e=P(B.me.getMe),t=Vo();return(0,N.useEffect)(()=>{if(e===void 0)return;let n=j7(e.permissions??[]);t({to:n.length>0?M7(n[0]):`/`,replace:!0})},[e,t]),(0,I.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:k$()})}function i4e(){let{tab:e}=zo({from:`/settings/$tab`});switch(e){case`groups`:return(0,I.jsx)(J1e,{});case`integrations`:return(0,I.jsx)(k0e,{});case`instances`:return(0,I.jsx)(M1e,{});case`bridge`:return(0,I.jsx)(u2e,{});case`theme`:return(0,I.jsx)(G2e,{});case`feedbacks`:return(0,I.jsx)(M0e,{});case`files`:return(0,I.jsx)(N0e,{});case`agentFiles`:return(0,I.jsx)(U0e,{});case`preferences`:return(0,I.jsx)(t2e,{});case`chatDefaults`:return(0,I.jsx)(i2e,{});case`access`:return(0,I.jsx)(c2e,{});default:return(0,I.jsx)(q1e,{})}}function a4e(){let{chatId:e}=zo({from:`/chat/$chatId`});return(0,I.jsx)(T6,{chatId:e})}function o4e(){return(0,I.jsx)(T6,{chatId:null})}var Y9=os({component:Y2e}),s4e=is({getParentRoute:()=>Y9,path:`/`,component:o4e}),c4e=is({getParentRoute:()=>Y9,path:`chat/$chatId`,component:a4e}),X9=is({getParentRoute:()=>Y9,path:`settings`,component:t4e}),l4e=is({getParentRoute:()=>X9,path:`/`,component:r4e}),u4e=is({getParentRoute:()=>X9,path:`traces`,validateSearch:S1e,component:r0e}),d4e=is({getParentRoute:()=>X9,path:`audit`,validateSearch:C1e,component:F1e}),f4e=is({getParentRoute:()=>X9,path:`anomalies`,validateSearch:w1e,component:C0e}),p4e=is({getParentRoute:()=>X9,path:`kpi`,validateSearch:T1e,component:f0e}),m4e=is({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:E1e,component:R1e}),h4e=is({getParentRoute:()=>X9,path:`users`,validateSearch:D1e,component:j1e}),g4e=is({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw Ri({to:`/settings/$tab`,params:{tab:k1e.uiprefs},replace:!0})}}),_4e=is({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:Tp([...D7]).catch(`roles`).parse(e.tab)}),component:i4e});function v4e({reset:e}){let t=Vo();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)(Om,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:mSe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:_Se()}),(0,I.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,I.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>e(),children:bSe()}),(0,I.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void t({to:`/`}),children:A$()})]})]})}function y4e(){let e=Vo();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)(cee,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:TSe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:OSe()}),(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:A$()})})]})}var Z9=xs({routeTree:Y9.addChildren([s4e,c4e,X9.addChildren([l4e,u4e,d4e,f4e,p4e,m4e,h4e,g4e,_4e])]),defaultPreload:`intent`,defaultErrorComponent:v4e,defaultNotFoundComponent:y4e});async function b4e(){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 x4e=()=>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=Zn.createRoot(document.getElementById(`root`));$9.render((0,I.jsx)(N.StrictMode,{children:(0,I.jsx)(Q9,{children:`Chargement…`})})),b4e().then(e=>{let t=new kn(e);$9.render((0,I.jsx)(N.StrictMode,{children:(0,I.jsx)(_r,{client:t,children:(0,I.jsxs)(VUe,{children:[(0,I.jsx)(SZe,{children:(0,I.jsx)(ws,{router:Z9})}),(0,I.jsx)(N.Suspense,{fallback:null,children:(0,I.jsx)(x4e,{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<b9&&a.push(e)):t>0&&(i+=t,o.length<b9&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function L0e(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var x9=e=>typeof e==`string`?e:null;function S9(e){return/^\d+\.\d+\.\d+$/.test(e)?e.split(`.`).map(e=>Number.parseInt(e,10)):null}function R0e(e,t){let n=S9(e),r=S9(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 z0e(e,t){if(e===null||t===null)return!1;let n=R0e(t,e.min);return n!==null&&n>=0}function C9(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=x9(e.min),n=x9(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 B0e(e,t){if(e.gatewayVersion===null)return`unknown`;if(e.versionBeyondValidated)return`beyond`;let{range:n}=C9(t,e.provider);return z0e(n,e.gatewayVersion)?`supported`:`unknown`}function V0e(e){return e===`supported`?THe():e===`beyond`?OHe():jHe()}function w9(e){return e??e1()}function T9(e){return e===null?BHe():LHe({version:e})}function H0e(e,t){if(typeof e!=`object`||!e)return!1;let n=e.providers;return typeof n!=`object`||!n?!1:t in n}var E9=e=>`${e.instanceName}::${e.agentId}`;function U0e(){let e=P(B.me.getMe),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=P(B.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(B.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=P(B.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=>E9(e)===l))&&u(E9(c[0]))},[c,l]);let d=c?.find(e=>E9(e)===l)??null,f=Nn(B.agentFiles.listAgentFiles),[p,m]=(0,N.useState)({status:`idle`}),h=d?.instanceName??null,g=d?.agentId??null,_=P(B.compat.forInstance,n&&h!==null?{instanceName:h}:`skip`),v=n&&h!==null?LZe(_,`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=K(),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:$O()}):(0,I.jsxs)(`div`,{className:`oc-afiles`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:vze()}),(0,I.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,I.jsxs)(Q3,{value:i??``,onValueChange:e=>a(e),children:[(0,I.jsx)(e6,{size:`sm`,"aria-label":xze(),children:(0,I.jsx)($3,{})}),(0,I.jsx)(t6,{children:(r??[]).map(e=>(0,I.jsx)(Q,{value:e.name,children:e.name},e.name))})]}):null,c.length>0?(0,I.jsxs)(Q3,{value:l??``,onValueChange:e=>u(e),children:[(0,I.jsx)(e6,{size:`sm`,"aria-label":wze(),children:(0,I.jsx)($3,{})}),(0,I.jsx)(t6,{children:c.map(e=>(0,I.jsx)(Q,{value:E9(e),children:e.label},E9(e)))})]}):(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Dze()})]}),d===null?null:v===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):v!==null&&v.blocked?(0,I.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,I.jsx)(Om,{size:14,"aria-hidden":!0}),` `,T9(v.gatewayVersion)]}):p.status===`loading`||p.status===`idle`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):p.status===`error`?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[Nze(),` `,(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:X$()})]}):p.files.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:Aze()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`oc-afiles__list`,children:p.files.map(e=>{let n=P0e(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:Ize()}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`oc-afiles__size`,children:zze({size:v9(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:Hze({pct:w.format(n)})}),r?(0,I.jsx)(Om,{size:14,className:`oc-afiles__warn`,"aria-label":Gze()}):(0,I.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,I.jsx)(Y,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>S(e),children:t?Zze():eBe()})]},e.name)})}),(0,I.jsx)(`p`,{className:`oc-afiles__budget`,children:Jze({used:v9(y9(p.files),C),total:v9(_9,C),pct:w.format(F0e(y9(p.files)))})})]}),x&&d?(0,I.jsx)(W0e,{instanceName:d.instanceName,agentId:d.agentId,name:x.name,isAdmin:t,onClose:()=>S(null),onSaved:()=>void b()}):null]})}function W0e({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=Nn(B.agentFiles.getAgentFile),s=Nn(B.agentFiles.setAgentFile),c=S0(),[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(bBe({name:n})),a(),await C(!1)}catch(e){L0e(e)?b(!0):S(!0)}finally{v(!1)}}}let T=l!==null&&p!==l.content,E=(0,N.useMemo)(()=>l===null?null:I0e(l.content,p),[l,p]),D=p.length>g9,O=K(),ee=(0,N.useMemo)(()=>new Intl.NumberFormat(O),[O]);return(0,I.jsx)(d0,{open:!0,onOpenChange:e=>!e&&i(),children:(0,I.jsxs)(f0,{className:`oc-afiles__editor`,children:[(0,I.jsxs)(p0,{children:[(0,I.jsx)(h0,{children:$$({name:n})}),(0,I.jsxs)(g0,{children:[aBe({agent:t,instance:e}),r?null:(0,I.jsxs)(I.Fragment,{children:[` · `,cBe()]})]})]}),d?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[EBe(),` `,(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void C(!1),children:X$()})]}):l===null?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):(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":$$({name:n})}),(0,I.jsx)(`p`,{className:`oc-afiles__hint`,children:dBe()}),y?(0,I.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[kBe(),` `,(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void C(!0),children:MBe()})]}):null,x?(0,I.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:CBe()}):null,(0,I.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,I.jsx)(`span`,{className:`oc-afiles__count${D?` is-over`:``}`,children:mBe({count:ee.format(p.length),max:ee.format(g9)})}),r?(0,I.jsx)(Y,{size:`sm`,disabled:!T||_||y,onClick:()=>g(!0),children:_?Y$():_Be()}):null]})]}),(0,I.jsx)(r0,{open:h,onOpenChange:g,children:(0,I.jsxs)(i0,{children:[(0,I.jsxs)(a0,{children:[(0,I.jsx)(s0,{children:FBe({name:n})}),(0,I.jsx)(c0,{children:RBe({agent:t})})]}),E?(0,I.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,I.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:VBe({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:WBe()}),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:qBe()}),E.sampleRemoved.map((e,t)=>(0,I.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,I.jsxs)(o0,{children:[(0,I.jsx)(u0,{children:dU()}),(0,I.jsx)(l0,{onClick:()=>void w(),children:XBe()})]})]})})]})})}var D9=[{id:`messages`,label:()=>kF()},{id:`composer`,label:()=>MF()},{id:`sidebar`,label:()=>FF()},{id:`other`,label:()=>RF()}],O9={showSource:{category:`messages`,label:()=>VF(),help:()=>WF()},showReport:{category:`messages`,label:()=>qF(),help:()=>XF()},copyAssistant:{category:`messages`,label:()=>$F()},copyUser:{category:`messages`,label:()=>nI()},showDelete:{category:`messages`,label:()=>aI()},showTools:{category:`messages`,label:()=>cI(),help:()=>dI()},voiceInput:{category:`composer`,label:()=>mI(),help:()=>_I()},showChatAge:{category:`sidebar`,label:()=>bI(),help:()=>CI()},showChatProvider:{category:`sidebar`,label:()=>EI(),help:()=>kI()}};function k9(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function G0e(e,t){let n=k9(t.trim()),r=new Map(D9.map(e=>[e.id,e.label()])),i=new Map(D9.map(e=>[e.id,[]]));for(let t of e){let e=O9[t],a=e?.category??`other`;n&&!k9(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return D9.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var K0e=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],q0e={voiceInput:`voiceInput`};function J0e(e){return K0e.includes(e)}function A9(e){return e===`admin`}function Y0e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function X0e(e){return e===`on`?!0:e===`off`?!1:null}function Z0e(e){return J0e(e)?q0e[e]:void 0}var Q0e={voiceInput:()=>cL()};function $0e({prefKey:e,ui:t}){let n=F(B.admin.setUiPrefDefault),r=F(B.admin.setFeatureEnabled),i=Z0e(e),a=i?Q0e[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:XI()}),(0,I.jsxs)(Q3,{value:Y0e(t.defaults[e]),onValueChange:t=>void n({key:e,value:X0e(t)}),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-36`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:`on`,children:mL()}),(0,I.jsx)(Q,{value:`off`,children:_L()}),(0,I.jsx)(Q,{value:`inherit`,children:bL()})]})]}),i?(0,I.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,I.jsx)(J5,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":$I()}),$I()]}):null]}),a?(0,I.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function e2e(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(!1),i=P(B.me.getMe,{}),a=i?.ui,o=A9(i?.role)&&n,s=F(B.me.setUiPref).withOptimisticUpdate(w0),c=(0,N.useMemo)(()=>a?G0e(Object.keys(a.effective),e):[],[a,e]);return a?(0,I.jsxs)(`div`,{className:`oc-prefs-panel`,children:[A9(i?.role)?(0,I.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,I.jsx)(J5,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":qI()}),qI()]}):null,o?(0,I.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,I.jsx)(`p`,{children:nL()}),(0,I.jsx)(`p`,{children:aL()}),(0,I.jsx)(`p`,{children:dL()})]}):null,(0,I.jsx)(n0,{value:e,onChange:e=>t(e.target.value),placeholder:MI(),"aria-label":MI(),className:`mb-2`}),c.length===0?(0,I.jsx)(`div`,{className:`oc-prefs__empty`,children:FI()}):(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=O9[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:RI()}):l?null:(0,I.jsx)(`span`,{className:`oc-prefs__def`,children:VI()})]}),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:WI()}):null,(0,I.jsx)(J5,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t===!0}),"aria-label":n})]}),o?(0,I.jsx)($0e,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,I.jsx)(`div`,{className:`oc-prefs__empty`,children:$O()})}function t2e(){let e=P(B.me.getMe,{}),t=F(B.me.setLocale),n=F(B.me.setMyName),r=S0(),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(Fk())}catch(e){r.error(Rk(),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:Ck()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:Ek()})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(n0,{className:`max-w-xs`,value:c,maxLength:120,placeholder:kk(),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l&&(e.preventDefault(),u())}}),(0,I.jsx)(Y,{size:`sm`,disabled:!l,onClick:()=>void u(),children:b$()})]}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:Mk()})]}),(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:Vk()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:Wk()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,I.jsx)(Y,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?nA():e===`en`?aA():mk()},e))}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:qk()})]}),(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:Xk()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:$k()})]}),(0,I.jsx)(e2e,{})]})]})}var n2e=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function r2e(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 i2e(){let e=Nn(B.agentFiles.getChatDefaults),t=Nn(B.agentFiles.setChatDefaults),n=S0(),[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=RZe(P(B.compat.getBridgeCompat,{}),`configDefaults`),f=d===`loading`?null:d.blocked,p=(0,N.useCallback)(async()=>{i({status:`loading`});try{let t=r2e(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(CVe()),await p()}catch(e){n.error(EVe(),e)}finally{u(!1)}}let y=(0,N.useMemo)(()=>n2e.map(e=>({id:e,label:s6(e)})),[]),b=(0,N.useMemo)(()=>[{id:`fast`,label:Z$()},{id:`standard`,label:Q$()}],[]);return(0,I.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:nVe()}),d===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):d.blocked?(0,I.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,I.jsx)(Om,{size:14,"aria-hidden":!0}),` `,T9(d.gatewayVersion)]}):r.status===`loading`?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):r.status===`error`?(0,I.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[_Ve(),` `,(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void p(),children:X$()})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,I.jsx)(`span`,{className:`oc-cdefaults__label`,children:aVe()}),(0,I.jsx)(f6,{options:y,value:a.thinkingDefault,onChange:e=>o({...a,thinkingDefault:e}),disabled:l}),(0,I.jsx)(`p`,{className:`oc-cdefaults__help`,children:cVe()})]}),(0,I.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,I.jsx)(`span`,{className:`oc-cdefaults__label`,children:dVe()}),(0,I.jsx)(f6,{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:mVe()})]}),(0,I.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,I.jsx)(Y,{size:`sm`,disabled:!_||l,onClick:()=>c(!0),children:l?Y$():bVe()})}),(0,I.jsx)(`p`,{className:`oc-cdefaults__note`,children:kVe()})]}),(0,I.jsx)(r0,{open:s,onOpenChange:c,children:(0,I.jsxs)(i0,{children:[(0,I.jsxs)(a0,{children:[(0,I.jsx)(s0,{children:MVe()}),(0,I.jsx)(c0,{children:FVe()})]}),(0,I.jsxs)(o0,{children:[(0,I.jsx)(u0,{children:dU()}),(0,I.jsx)(l0,{onClick:()=>void v(),children:RVe()})]})]})})]})}function a2e(e){return e===`user`?APe():W$({group:e.group})}function o2e(e){return e===`common`?FPe():e===`owner`?RPe():W$({group:e.group})}function s2e(e){return e.name||e.email||e.userId.slice(0,8)}function c2e(){let e=P(B.admin.listUsers,{}),[t,n]=(0,N.useState)(``),r=P(B.introspect.introspectUser,t?{userId:t}:`skip`);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:nPe()}),(0,I.jsxs)(Q3,{value:t,onValueChange:n,children:[(0,I.jsx)(e6,{size:`sm`,"aria-label":H$(),children:(0,I.jsx)($3,{placeholder:H$()})}),(0,I.jsx)(t6,{children:(e??[]).map(e=>(0,I.jsx)(Q,{value:e.userId,children:s2e(e)},e._id))})]}),t===``?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:sPe()}):r===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:$O()}):(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:uPe()}),(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:pPe()}),r.groups.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:U$()}):(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:gPe()}),r.agents.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:U$()}):(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:DPe()}):null,(0,I.jsx)($,{variant:`outline`,children:a2e(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:yPe()}),r.charts.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:U$()}):(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:o2e(e.via)})]},e.key))})]}),(0,I.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,I.jsx)(`h3`,{className:`oc-introspect__title`,children:SPe()}),r.permissions.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:U$()}):(0,I.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,I.jsx)($,{variant:`secondary`,children:e},e))})]})]})]})}function l2e(){return P(B.bridgeHealth.getBridgeHealth,{})}function u2e(){let e=l2e(),t=Vo();return(0,I.jsxs)(`div`,{className:`oc-bridge`,children:[(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_Ce()}),e===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:N$()}):e===null?(0,I.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:SCe()}):(0,I.jsx)(m2e,{health:e,onSeeAnomalies:()=>void t({to:`/settings/anomalies`,search:{status:`open`}})}),(0,I.jsx)(d2e,{})]})}function d2e(){let e=P(B.compat.getBridgeCompat,{});return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`oc-bridge__section`,children:VVe()}),e===void 0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:N$()}):e===null?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:WVe()}):(0,I.jsx)(f2e,{data:e})]})}function f2e({data:e}){let t=C9(e.compat,`openclaw`);return(0,I.jsxs)(`div`,{className:`oc-compat`,children:[(0,I.jsxs)(`div`,{className:`oc-compat__meta`,children:[(0,I.jsxs)(`span`,{children:[qVe(),` `,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:w9(e.bridgeVersion)})]}),(0,I.jsxs)(`span`,{children:[XVe(),` `,(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:e.protocolVersion===null?e1():String(e.protocolVersion)})]}),(0,I.jsx)(`span`,{children:P$({time:new Date(e.fetchedAt).toLocaleString(`fr-FR`)})})]}),e.reachable?null:(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:tHe()}),e.compat===null?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:iHe()}):(0,I.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,I.jsx)(`span`,{className:`oc-compat__label`,children:sHe()}),t.range===null?(0,I.jsx)(`span`,{children:e1()}):(0,I.jsx)(`span`,{children:uHe({min:t.range.min,max:t.range.maxValidated})}),(0,I.jsx)(p2e,{versions:t.validatedVersions})]}),e.targets.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:SHe()}):(0,I.jsx)(`div`,{className:`oc-compat__targets`,children:e.targets.map(t=>{let n=B0e(t,e.compat);return(0,I.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:t.instanceName}),(0,I.jsx)(`span`,{className:`oc-compat__provider`,children:t.provider}),(0,I.jsx)(`code`,{className:`oc-traces__mono`,children:w9(t.gatewayVersion)}),(0,I.jsx)($,{variant:n===`supported`?`secondary`:n===`beyond`?`destructive`:`outline`,children:V0e(n)})]},t.instanceName)})}),H0e(e.compat,`hermes`)?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:PHe()}):null]})}function p2e({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,I.jsxs)(Y1,{children:[(0,I.jsx)(X1,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?pHe():gHe({count:e.length}),(0,I.jsx)(cm,{size:13,"aria-hidden":!0})]})}),(0,I.jsxs)(Z1,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,I.jsx)(`p`,{className:`oc-compat__versions-title`,children:yHe()}),(0,I.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,I.jsx)($,{variant:`secondary`,children:e},e))})]})]})}function m2e({health:e,onSeeAnomalies:t}){let n=e.targets.filter(e=>e.state===`error`),r=!e.reachable,i=e.reachable&&n.length===0,a=i?`ok`:`error`,o=new Date(e.checkedAt).toLocaleString(`fr-FR`),s=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${a}`,children:[(0,I.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:i?(0,I.jsx)(dm,{size:22}):r?(0,I.jsx)(Oee,{size:22}):(0,I.jsx)(Om,{size:22})}),(0,I.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,I.jsx)(`div`,{className:`oc-bridge-card__title`,children:i?TCe():r?OCe():jCe({count:n.length})}),(0,I.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,I.jsxs)(`span`,{children:[(0,I.jsx)(wee,{size:12,"aria-hidden":!0}),` `,P$({time:o})]}),s?(0,I.jsx)(`span`,{children:ICe({time:s})}):null]}),r?(0,I.jsx)(`p`,{className:`oc-bridge-card__hint`,children:a9(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,I.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:t,children:zCe()})]}),(0,I.jsx)(`h3`,{className:`oc-bridge__section`,children:HCe({count:e.targets.length})}),e.targets.length===0?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:GCe()}):(0,I.jsx)(`div`,{className:`oc-bridge-targets`,children:e.targets.map(e=>{let t=e.lastErrorCode?a9(e.lastErrorCode):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)(h2e,{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:[JCe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts}),e.lastOkAt?ZCe({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]},e.key)})})]})}function h2e({state:e}){return e===`connected`?(0,I.jsx)($,{variant:`secondary`,children:ewe()}):e===`error`?(0,I.jsx)($,{variant:`destructive`,children:rwe()}):(0,I.jsx)($,{variant:`outline`,children:owe()})}var j9=[{id:`personal`,label:()=>oLe(),tabs:[`preferences`,`theme`,`files`]},{id:`agents`,label:()=>lLe(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`bridge`]},{id:`access`,label:()=>fLe(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`]},{id:`observability`,label:()=>hLe(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`integrations`]}],g2e=new Map(j9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function M9(e){let t=g2e.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function _2e(e,t){return e.find(e=>M9(e)===t)}j9.flatMap(e=>[...e.tabs]);function v2e({delayDuration:e=0,...t}){return(0,I.jsx)(kle,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function y2e({...e}){return(0,I.jsx)(Ale,{"data-slot":`tooltip`,...e})}function b2e({...e}){return(0,I.jsx)(jle,{"data-slot":`tooltip-trigger`,...e})}function x2e({className:e,sideOffset:t=0,children:n,...r}){return(0,I.jsx)(Mle,{children:(0,I.jsxs)(Nle,{"data-slot":`tooltip-content`,sideOffset:t,className:V1(`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)(Ple,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function S2e(){let e=P(B.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.known?e.available?`ok`:`error`:`idle`,n=e.known?e.available?`${EOe()}${e.checkedAt?kOe({time:new Date(e.checkedAt).toLocaleTimeString(`fr-FR`)}):``}`:MOe({reason:e.reason??`?`}):COe();return(0,I.jsx)(v2e,{delayDuration:150,children:(0,I.jsxs)(y2e,{children:[(0,I.jsx)(b2e,{asChild:!0,children:(0,I.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${t}`,role:`img`,"aria-label":n})}),(0,I.jsx)(x2e,{children:n})]})})}var C2e={users:()=>_Ne(),groups:()=>XNe(),instances:()=>bNe(),bridge:()=>CNe(),serviceAccounts:()=>ENe(),roles:()=>kNe(),traces:()=>MNe(),kpi:()=>FNe(),anomalies:()=>RNe(),files:()=>cA(),agentFiles:()=>hze(),preferences:()=>bk(),chatDefaults:()=>$Be(),access:()=>$Ne(),integrations:()=>VNe(),theme:()=>dM(),audit:()=>WNe(),feedbacks:()=>qNe()};function N9(e){let t=new Set(E7),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 E7)n.has(e)||r.push(e);return r}function w2e(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function T2e({tab:e,active:t}){let n=C2e[e]?.()??O7[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)(S2e,{}):null]});return D7.includes(e)?(0,I.jsx)(ts,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,I.jsx)(ts,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function E2e({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=E5({id:e});return(0,I.jsxs)(`div`,{ref:i,style:{transform:t8.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":JIe(),...n,...r,children:(0,I.jsx)(gm,{size:14,"aria-hidden":!0})}),(0,I.jsx)(T2e,{tab:e,active:t})]})}function D2e(){let e=P(B.me.getMe),t=F(B.me.setSettingsTabOrder),n=N7(Ts({select:e=>e.pathname})),r=n===void 0?void 0:M9(n),i=(0,N.useMemo)(()=>N9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,N.useState)(i);(0,N.useEffect)(()=>o(i),[i]);let s=(0,N.useMemo)(()=>new Set(j7(e?.permissions??[])),[e?.permissions]),c=(0,N.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&M9(e)===r),[a,s,r]),l=s8(o8(V8,{activationConstraint:{distance:5}}),o8(L8,{coordinateGetter:O5}));if(r===void 0||c.length===0)return null;let u=j9.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=w2e(a,g5(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)(d5,{sensors:l,collisionDetection:CQe,modifiers:[N$e],onDragEnd:d,children:(0,I.jsx)(C5,{items:c,strategy:B$e,children:c.map(e=>(0,I.jsx)(E2e,{tab:e,active:e===n},e))})})})}function O2e(){let e=P(B.me.getMe),t=Vo(),n=N7(Ts({select:e=>e.pathname})),r=n===void 0?void 0:M9(n),i=(0,N.useMemo)(()=>new Set(j7(e?.permissions??[])),[e?.permissions]),a=(0,N.useMemo)(()=>N9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=j9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=_2e(a,e.id);n&&t({to:M7(n)})}return(0,I.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":ZIe(),children:[(0,I.jsx)(ts,{to:`/`,className:`oc-settings-nav__back`,children:eLe()}),(0,I.jsx)(`div`,{className:`oc-settings-nav__title`,children:rLe()}),(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 k2e=`background.foreground.card.card-foreground.popover.popover-foreground.primary.primary-foreground.secondary.secondary-foreground.muted.muted-foreground.accent.accent-foreground.destructive.destructive-foreground.border.input.ring.chart-1.chart-2.chart-3.chart-4.chart-5.sidebar.sidebar-foreground.sidebar-primary.sidebar-primary-foreground.sidebar-accent.sidebar-accent-foreground.sidebar-border.sidebar-ring`.split(`.`),P9=[{key:`ocean`,name:`Ocean`,tokens:{colors:{light:{background:`oklch(0.985 0.012 230)`,foreground:`oklch(0.22 0.04 245)`,card:`oklch(0.995 0.008 230)`,"card-foreground":`oklch(0.22 0.04 245)`,popover:`oklch(0.995 0.008 230)`,"popover-foreground":`oklch(0.22 0.04 245)`,primary:`oklch(0.55 0.13 235)`,"primary-foreground":`oklch(0.99 0.01 230)`,secondary:`oklch(0.93 0.03 220)`,"secondary-foreground":`oklch(0.28 0.05 240)`,muted:`oklch(0.94 0.02 225)`,"muted-foreground":`oklch(0.5 0.04 235)`,accent:`oklch(0.9 0.05 200)`,"accent-foreground":`oklch(0.28 0.06 230)`,border:`oklch(0.88 0.03 225)`,input:`oklch(0.88 0.03 225)`,ring:`oklch(0.55 0.13 235)`,"chart-1":`oklch(0.6 0.13 235)`,"chart-2":`oklch(0.65 0.12 200)`,"chart-3":`oklch(0.55 0.1 260)`,"chart-4":`oklch(0.7 0.11 180)`,"chart-5":`oklch(0.5 0.12 215)`,sidebar:`oklch(0.96 0.02 228)`,"sidebar-foreground":`oklch(0.24 0.04 245)`,"sidebar-primary":`oklch(0.55 0.13 235)`,"sidebar-primary-foreground":`oklch(0.99 0.01 230)`,"sidebar-accent":`oklch(0.9 0.05 200)`,"sidebar-accent-foreground":`oklch(0.28 0.06 230)`,"sidebar-border":`oklch(0.87 0.03 225)`,"sidebar-ring":`oklch(0.55 0.13 235)`},dark:{background:`oklch(0.2 0.03 245)`,foreground:`oklch(0.95 0.02 225)`,card:`oklch(0.25 0.04 245)`,"card-foreground":`oklch(0.95 0.02 225)`,popover:`oklch(0.25 0.04 245)`,"popover-foreground":`oklch(0.95 0.02 225)`,primary:`oklch(0.7 0.12 230)`,"primary-foreground":`oklch(0.18 0.04 245)`,secondary:`oklch(0.3 0.04 240)`,"secondary-foreground":`oklch(0.95 0.02 225)`,muted:`oklch(0.3 0.03 242)`,"muted-foreground":`oklch(0.72 0.04 228)`,accent:`oklch(0.4 0.07 210)`,"accent-foreground":`oklch(0.96 0.02 220)`,border:`oklch(0.35 0.03 242)`,input:`oklch(0.35 0.03 242)`,ring:`oklch(0.7 0.12 230)`,"chart-1":`oklch(0.7 0.13 230)`,"chart-2":`oklch(0.72 0.12 195)`,"chart-3":`oklch(0.65 0.11 260)`,"chart-4":`oklch(0.76 0.1 180)`,"chart-5":`oklch(0.62 0.12 215)`,sidebar:`oklch(0.23 0.04 246)`,"sidebar-foreground":`oklch(0.95 0.02 225)`,"sidebar-primary":`oklch(0.7 0.12 230)`,"sidebar-primary-foreground":`oklch(0.18 0.04 245)`,"sidebar-accent":`oklch(0.4 0.07 210)`,"sidebar-accent-foreground":`oklch(0.96 0.02 220)`,"sidebar-border":`oklch(0.34 0.03 242)`,"sidebar-ring":`oklch(0.7 0.12 230)`}},radius:`0.75rem`,fontSans:`ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif`}},{key:`forest`,name:`Forest`,tokens:{colors:{light:{background:`oklch(0.985 0.012 130)`,foreground:`oklch(0.24 0.04 145)`,card:`oklch(0.995 0.008 130)`,"card-foreground":`oklch(0.24 0.04 145)`,popover:`oklch(0.995 0.008 130)`,"popover-foreground":`oklch(0.24 0.04 145)`,primary:`oklch(0.52 0.12 150)`,"primary-foreground":`oklch(0.99 0.01 130)`,secondary:`oklch(0.93 0.04 130)`,"secondary-foreground":`oklch(0.3 0.05 150)`,muted:`oklch(0.94 0.03 135)`,"muted-foreground":`oklch(0.5 0.04 145)`,accent:`oklch(0.9 0.06 115)`,"accent-foreground":`oklch(0.3 0.06 150)`,border:`oklch(0.88 0.03 135)`,input:`oklch(0.88 0.03 135)`,ring:`oklch(0.52 0.12 150)`,"chart-1":`oklch(0.58 0.13 150)`,"chart-2":`oklch(0.68 0.12 120)`,"chart-3":`oklch(0.6 0.11 95)`,"chart-4":`oklch(0.55 0.1 175)`,"chart-5":`oklch(0.5 0.12 140)`,sidebar:`oklch(0.96 0.02 132)`,"sidebar-foreground":`oklch(0.26 0.04 145)`,"sidebar-primary":`oklch(0.52 0.12 150)`,"sidebar-primary-foreground":`oklch(0.99 0.01 130)`,"sidebar-accent":`oklch(0.9 0.06 115)`,"sidebar-accent-foreground":`oklch(0.3 0.06 150)`,"sidebar-border":`oklch(0.87 0.03 135)`,"sidebar-ring":`oklch(0.52 0.12 150)`},dark:{background:`oklch(0.2 0.03 150)`,foreground:`oklch(0.95 0.02 130)`,card:`oklch(0.25 0.04 150)`,"card-foreground":`oklch(0.95 0.02 130)`,popover:`oklch(0.25 0.04 150)`,"popover-foreground":`oklch(0.95 0.02 130)`,primary:`oklch(0.68 0.13 145)`,"primary-foreground":`oklch(0.18 0.04 150)`,secondary:`oklch(0.3 0.04 148)`,"secondary-foreground":`oklch(0.95 0.02 130)`,muted:`oklch(0.3 0.03 150)`,"muted-foreground":`oklch(0.72 0.04 135)`,accent:`oklch(0.4 0.07 120)`,"accent-foreground":`oklch(0.96 0.02 125)`,border:`oklch(0.35 0.03 148)`,input:`oklch(0.35 0.03 148)`,ring:`oklch(0.68 0.13 145)`,"chart-1":`oklch(0.68 0.14 148)`,"chart-2":`oklch(0.74 0.12 120)`,"chart-3":`oklch(0.68 0.11 95)`,"chart-4":`oklch(0.62 0.1 175)`,"chart-5":`oklch(0.6 0.12 140)`,sidebar:`oklch(0.23 0.04 150)`,"sidebar-foreground":`oklch(0.95 0.02 130)`,"sidebar-primary":`oklch(0.68 0.13 145)`,"sidebar-primary-foreground":`oklch(0.18 0.04 150)`,"sidebar-accent":`oklch(0.4 0.07 120)`,"sidebar-accent-foreground":`oklch(0.96 0.02 125)`,"sidebar-border":`oklch(0.34 0.03 148)`,"sidebar-ring":`oklch(0.68 0.13 145)`}},radius:`0.375rem`,fontSans:`Georgia, Cambria, 'Times New Roman', Times, serif`}},{key:`dusk`,name:`Dusk`,tokens:{colors:{light:{background:`oklch(0.985 0.012 300)`,foreground:`oklch(0.24 0.05 300)`,card:`oklch(0.995 0.008 300)`,"card-foreground":`oklch(0.24 0.05 300)`,popover:`oklch(0.995 0.008 300)`,"popover-foreground":`oklch(0.24 0.05 300)`,primary:`oklch(0.55 0.16 300)`,"primary-foreground":`oklch(0.99 0.01 300)`,secondary:`oklch(0.93 0.04 310)`,"secondary-foreground":`oklch(0.3 0.06 300)`,muted:`oklch(0.94 0.03 305)`,"muted-foreground":`oklch(0.5 0.05 300)`,accent:`oklch(0.9 0.07 70)`,"accent-foreground":`oklch(0.32 0.08 60)`,border:`oklch(0.88 0.03 305)`,input:`oklch(0.88 0.03 305)`,ring:`oklch(0.55 0.16 300)`,"chart-1":`oklch(0.58 0.17 300)`,"chart-2":`oklch(0.7 0.15 70)`,"chart-3":`oklch(0.55 0.15 330)`,"chart-4":`oklch(0.65 0.14 35)`,"chart-5":`oklch(0.5 0.16 280)`,sidebar:`oklch(0.96 0.02 303)`,"sidebar-foreground":`oklch(0.26 0.05 300)`,"sidebar-primary":`oklch(0.55 0.16 300)`,"sidebar-primary-foreground":`oklch(0.99 0.01 300)`,"sidebar-accent":`oklch(0.9 0.07 70)`,"sidebar-accent-foreground":`oklch(0.32 0.08 60)`,"sidebar-border":`oklch(0.87 0.03 305)`,"sidebar-ring":`oklch(0.55 0.16 300)`},dark:{background:`oklch(0.2 0.04 300)`,foreground:`oklch(0.95 0.02 305)`,card:`oklch(0.25 0.05 300)`,"card-foreground":`oklch(0.95 0.02 305)`,popover:`oklch(0.25 0.05 300)`,"popover-foreground":`oklch(0.95 0.02 305)`,primary:`oklch(0.72 0.15 300)`,"primary-foreground":`oklch(0.18 0.04 300)`,secondary:`oklch(0.3 0.05 305)`,"secondary-foreground":`oklch(0.95 0.02 305)`,muted:`oklch(0.3 0.04 303)`,"muted-foreground":`oklch(0.72 0.05 305)`,accent:`oklch(0.45 0.1 65)`,"accent-foreground":`oklch(0.96 0.02 70)`,border:`oklch(0.35 0.04 303)`,input:`oklch(0.35 0.04 303)`,ring:`oklch(0.72 0.15 300)`,"chart-1":`oklch(0.72 0.16 300)`,"chart-2":`oklch(0.78 0.14 70)`,"chart-3":`oklch(0.68 0.15 330)`,"chart-4":`oklch(0.72 0.13 35)`,"chart-5":`oklch(0.64 0.16 280)`,sidebar:`oklch(0.23 0.05 300)`,"sidebar-foreground":`oklch(0.95 0.02 305)`,"sidebar-primary":`oklch(0.72 0.15 300)`,"sidebar-primary-foreground":`oklch(0.18 0.04 300)`,"sidebar-accent":`oklch(0.45 0.1 65)`,"sidebar-accent-foreground":`oklch(0.96 0.02 70)`,"sidebar-border":`oklch(0.34 0.04 303)`,"sidebar-ring":`oklch(0.72 0.15 300)`}},radius:`1rem`,fontSans:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`}}];new Set(P9.map(e=>e.key));function F9(e){let t=e??localStorage.getItem(`oc.theme`)??`system`,n=()=>t===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:t,[r,i]=(0,N.useState)(n);return(0,N.useEffect)(()=>{if(i(n()),t!==`system`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>i(e.matches?`dark`:`light`);return e.addEventListener(`change`,r),()=>e.removeEventListener(`change`,r)},[t]),r}function A2e(e,t){let n=document.documentElement.style,r=e?.colors[t];for(let e of k2e){let t=r?.[e];t===void 0?n.removeProperty(`--`+e):n.setProperty(`--`+e,t)}e?.radius===void 0?n.removeProperty(`--radius`):n.setProperty(`--radius`,e.radius),e?.fontSans===void 0?n.removeProperty(`--ui-font-sans`):n.setProperty(`--ui-font-sans`,e.fontSans),e?.fontMono===void 0?n.removeProperty(`--ui-font-mono`):n.setProperty(`--ui-font-mono`,e.fontMono)}function j2e(e,t){(0,N.useEffect)(()=>{A2e(e??null,t)},[e,t])}var I9=`__all__`,L9={kind:`relative`,from:`now-24h`,to:`now`},M2e=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function R9({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 N2e(e){return e===`light`?ak():e===`dark`?ck():dk()}var P2e=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function F2e({tokens:e,mode:t}){let n=e.colors[t];return(0,I.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:P2e.map(e=>{let t=n[e];return(0,I.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function z9({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,I.jsxs)(`button`,{type:`button`,className:V1(`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)(sm,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,I.jsx)(F2e,{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 I2e({selectedKey:e,resolvedMode:t}){let n=P(B.charts.listMyCharts),r=F(B.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:RM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:VM()})]}),(0,I.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,I.jsx)(z9,{selected:e===null,title:WM(),subtitle:qM(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?XM():n.via===`owner`?$M():nN({group:n.via.group});return(0,I.jsx)(z9,{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:aN()}):null]})}function L2e(){let e=F(B.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(cP())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(mP());return}let a;try{a=JSON.parse(r)}catch{o(cP());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:RN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:VN()})]}),(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:WN()}),(0,I.jsx)(n0,{value:t,onChange:e=>n(e.target.value),placeholder:qN(),maxLength:60})]}),(0,I.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,I.jsx)(`span`,{className:`oc-chart-import__label`,children:XN()}),(0,I.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:$N(),rows:8,spellCheck:!1})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(Y,{variant:`outline`,size:`sm`,asChild:!0,children:(0,I.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,I.jsx)(Dee,{className:`size-4`}),nP(),(0,I.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,I.jsx)(Y,{size:`sm`,disabled:l,onClick:()=>void f(),children:aP()})]}),a?(0,I.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,I.jsx)(`p`,{className:`oc-chart-import__ok`,children:dP()}):null]})]})}function R2e({chartKey:e,myGroups:t,restricted:n}){let r=F(B.charts.assignChartToGroup),i=F(B.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:WP()}),(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":$P({group:e.name}),onClick:()=>void c(e.groupId),children:(0,I.jsx)(jm,{className:`size-3`})})]},e.groupId)),t.length===0?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:qP()}):o.length>0?(0,I.jsxs)(Q3,{value:``,onValueChange:e=>void s(e),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-56`,children:(0,I.jsx)($3,{placeholder:XP()})}),(0,I.jsx)(t6,{children:o.map(e=>(0,I.jsx)(Q,{value:e.groupId,children:e.name},e.groupId))})]}):null]})}function z2e({chart:e,myGroups:t}){let n=F(B.charts.updateChart),r=F(B.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(cP());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(nF()))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)(Y,{variant:`outline`,size:`sm`,onClick:m,children:EP()}),(0,I.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>void g(),children:kP()})]})})]}),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:RP()}),(0,I.jsx)(n0,{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:VP()}),(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)(Y,{size:`sm`,disabled:f,onClick:()=>void h(),children:MP()}),(0,I.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:FP()})]})]}):null,(0,I.jsx)(R2e,{chartKey:e.key,myGroups:t,restricted:e.restrictedToGroups})]})}function B2e(){let e=P(B.charts.listMyCharts),t=P(B.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:_P()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:bP()})]}),e!==void 0&&n.length===0?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:CP()}):(0,I.jsx)(`div`,{className:`oc-chart-mine-list`,children:n.map(e=>(0,I.jsx)(z2e,{chart:e,myGroups:t??[]},e.key))})]})}function V2e({chart:e,groups:t}){let n=F(B.charts.assignChartToGroup),r=F(B.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?CN():e.kind===`custom`&&e.scope===`personal`?mF():bN()}),e.isGlobalDefault?(0,I.jsx)($,{variant:`default`,children:EN()}):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":FN({group:e.name}),onClick:()=>void c(e.groupId),children:(0,I.jsx)(jm,{className:`size-3`})})]},e.groupId)),o.length>0?(0,I.jsxs)(Q3,{value:``,onValueChange:e=>void s(e),children:[(0,I.jsx)(e6,{size:`sm`,className:`w-56`,children:(0,I.jsx)($3,{placeholder:kN()})}),(0,I.jsx)(t6,{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:MN()}):null]})]})}function H2e({chart:e}){let t=F(B.charts.promoteChartToCommon),n=F(B.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(nF()))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`?_F():mF()}),e.ownerLabel?(0,I.jsx)(`span`,{className:`oc-show__desc`,children:dF({owner:e.ownerLabel})}):null]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,I.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:bF()}):null,(0,I.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:CF()})]})]})}function U2e({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=F(B.admin.setDefaultThemeMode),i=F(B.admin.setDefaultLocale),a=F(B.charts.setDefaultChart),o=P(B.charts.listChartsAdmin),s=P(B.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:MM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:FM()})]}),(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:cN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:dN()})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(Y,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:WM()}),P9.map(e=>(0,I.jsx)(Y,{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)(Y,{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:mN()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:_N()})]}),(0,I.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,I.jsx)(V2e,{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:aF()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:cF()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,I.jsx)(`p`,{className:`oc-show__desc`,children:EF()}):(0,I.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,I.jsx)(H2e,{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:mM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:_M()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,I.jsx)(Y,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:N2e(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:bM()}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:CM()})]}),(0,I.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,I.jsx)(Y,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?nA():aA()},e))}),(0,I.jsx)(`p`,{className:`oc-show__desc`,children:EM()})]})]})}function W2e(){let e=P(B.me.getMe),t=F9(e?.resolvedThemeMode);return(0,I.jsxs)(`div`,{className:`oc-appearance`,children:[(0,I.jsx)(I2e,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,I.jsx)(L2e,{}),(0,I.jsx)(B2e,{}),e?.role===`admin`?(0,I.jsx)(U2e,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function G2e(){let[e,t]=(0,N.useState)(!0),[n,r]=(0,N.useState)(`per-user`),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(I9),[c,l]=(0,N.useState)(I9),[u,d]=(0,N.useState)(L9),f=i!==``||o!==I9||c!==I9;function p(){a(``),s(I9),l(I9),d(L9)}return(0,I.jsxs)(`div`,{className:`oc-show`,children:[(0,I.jsx)(W2e,{}),(0,I.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,I.jsx)(`summary`,{className:`oc-show__title`,children:kM()}),(0,I.jsxs)(R9,{title:`Buttons`,description:`Variants`,children:[(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(Y,{children:`Default`}),(0,I.jsx)(Y,{variant:`secondary`,children:`Secondary`}),(0,I.jsx)(Y,{variant:`outline`,children:`Outline`}),(0,I.jsx)(Y,{variant:`ghost`,children:`Ghost`}),(0,I.jsx)(Y,{variant:`destructive`,children:`Destructive`}),(0,I.jsx)(Y,{variant:`link`,children:`Link`})]}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsx)(Y,{size:`sm`,children:`Small`}),(0,I.jsx)(Y,{children:`Default`}),(0,I.jsx)(Y,{size:`lg`,children:`Large`}),(0,I.jsx)(Y,{size:`icon`,"aria-label":`more`,children:(0,I.jsx)(hm,{})}),(0,I.jsx)(Y,{disabled:!0,children:`Disabled`})]})]}),(0,I.jsx)(R9,{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)(R9,{title:`Inputs & selection`,children:(0,I.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,I.jsx)(n0,{placeholder:`Text input…`}),(0,I.jsxs)(`div`,{className:`oc-show__row`,children:[(0,I.jsxs)(Q3,{value:n,onValueChange:r,children:[(0,I.jsx)(e6,{className:`w-56`,children:(0,I.jsx)($3,{placeholder:`Select…`})}),(0,I.jsxs)(t6,{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)(J5,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,I.jsx)(R9,{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)(f7,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,I.jsxs)(Q3,{value:o,onValueChange:s,children:[(0,I.jsx)(e6,{size:`sm`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:I9,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)(Q3,{value:c,onValueChange:l,children:[(0,I.jsx)(e6,{size:`sm`,children:(0,I.jsx)($3,{})}),(0,I.jsxs)(t6,{children:[(0,I.jsx)(Q,{value:I9,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)(m7,{fields:M2e,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)(d7,{value:u,onChange:d})]})]})}),(0,I.jsx)(R9,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,I.jsxs)(H1,{children:[(0,I.jsx)(U1,{asChild:!0,children:(0,I.jsx)(Y,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,I.jsx)(hm,{})})}),(0,I.jsxs)(W1,{align:`start`,children:[(0,I.jsx)(K1,{children:`Actions`}),(0,I.jsx)(q1,{}),(0,I.jsx)(G1,{children:`Edit`}),(0,I.jsx)(G1,{children:`Duplicate`}),(0,I.jsx)(q1,{}),(0,I.jsx)(G1,{variant:`destructive`,children:`Delete`})]})]})}),(0,I.jsx)(R9,{title:`Card`,children:(0,I.jsxs)(q7,{className:`w-80`,children:[(0,I.jsxs)(J7,{children:[(0,I.jsx)(Y7,{children:`Instance`}),(0,I.jsx)(X7,{children:`Non-secret metadata only.`})]}),(0,I.jsx)(Z7,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,I.jsxs)(s0e,{className:`gap-2`,children:[(0,I.jsx)(Y,{size:`sm`,children:`Save`}),(0,I.jsx)(Y,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,I.jsx)(R9,{title:`Table`,children:(0,I.jsxs)(Y5,{children:[(0,I.jsx)(X5,{children:(0,I.jsxs)(Q5,{children:[(0,I.jsx)($5,{className:`w-8`,children:(0,I.jsx)(J5,{"aria-label":`select all`})}),(0,I.jsx)($5,{children:`Name`}),(0,I.jsx)($5,{children:`Mode`}),(0,I.jsx)($5,{className:`text-right`,children:`Status`}),(0,I.jsx)($5,{className:`w-8`})]})}),(0,I.jsx)(Z5,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,I.jsxs)(Q5,{children:[(0,I.jsx)(e7,{children:(0,I.jsx)(J5,{"aria-label":`select ${e.n}`})}),(0,I.jsx)(e7,{className:`font-medium`,children:e.n}),(0,I.jsx)(e7,{children:(0,I.jsx)($,{variant:`secondary`,children:e.m})}),(0,I.jsx)(e7,{className:`text-right`,children:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,I.jsx)(sm,{className:`size-3.5`}),` `,e.s]})}),(0,I.jsx)(e7,{children:(0,I.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,I.jsx)(hm,{})})})]},e.n))})]})}),(0,I.jsx)(R9,{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 B9=`oc.theme`;function V9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function H9(e){(0,N.useEffect)(()=>{let t=e??localStorage.getItem(B9)??`system`;if(localStorage.setItem(B9,t),V9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>V9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}function K2e(e){(0,N.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=K()}catch{t=void 0}t!==e&&KO(e)},[e])}var U9=`oc.sidebar.width`,W9=`oc.sidebar.collapsed`,G9=200,K9=520,q2e=260;function q9(e){return Math.min(K9,Math.max(G9,e))}function J2e(){let[e,t]=(0,N.useState)(()=>{let e=Number(localStorage.getItem(U9));return e?q9(e):q2e}),[n,r]=(0,N.useState)(()=>localStorage.getItem(W9)===`1`);(0,N.useEffect)(()=>{localStorage.setItem(U9,String(e))},[e]),(0,N.useEffect)(()=>{localStorage.setItem(W9,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(q9(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:G9,MAX_WIDTH:K9}}function Y2e(){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Jn,{children:(0,I.jsx)(`div`,{className:`oc-boot`,children:k$()})}),(0,I.jsx)(qn,{children:(0,I.jsx)(Z2e,{})}),(0,I.jsx)(Kn,{children:(0,I.jsx)(WUe,{children:(0,I.jsx)(Q2e,{})})})]})}function X2e(){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 Z2e(){let{signIn:e}=gr();H9(void 0);let t=P(B.me.authProviders),[n,r]=(0,N.useState)(null);async function i(t){r(null);try{await e(t)}catch{r(dxe())}}let a=t!==void 0&&!t.google&&!t.microsoft&&!t.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.jsx)(`div`,{className:`oc-signin__brand`,children:(0,I.jsx)(`span`,{className:`oc-signin__wordmark`,children:`Atrium`})}),(0,I.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,I.jsx)(`h1`,{className:`oc-signin__title`,children:mxe()}),(0,I.jsx)(`p`,{className:`oc-signin__subtitle`,children:_xe()}),(0,I.jsx)(`div`,{className:`oc-signin__providers`,children:t?.google?(0,I.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void i(`google`),children:[(0,I.jsx)(X2e,{}),(0,I.jsx)(`span`,{children:bxe()})]}):null}),n?(0,I.jsx)(`p`,{className:`oc-signin__error`,children:n}):null,a?(0,I.jsx)(`p`,{className:`oc-signin__error`,children:Cxe()}):null,t?.anonymous?(0,I.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:Exe()}):null]})]})}function Q2e(){let e=P(B.me.getMe),t=F(B.me.bootstrap),n=Vo();(0,N.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),H9(e?.resolvedThemeMode);let r=F9(e?.resolvedThemeMode);j2e(e?.resolvedChartTokens,r),K2e(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:k$()});let a=e.name||e.email||kxe();return e.role===`pending`?(0,I.jsxs)(`div`,{className:`oc-shell`,children:[(0,I.jsx)(J9,{}),(0,I.jsx)(G5,{}),(0,I.jsxs)(`header`,{className:`oc-topbar`,children:[(0,I.jsx)(`span`,{className:`oc-topbar__brand`,children:`OpenClaw`}),(0,I.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,I.jsx)(K5,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,I.jsxs)(`div`,{className:`oc-pending`,children:[(0,I.jsx)(`h1`,{className:`oc-pending__title`,children:Mxe()}),(0,I.jsx)(`p`,{className:`oc-pending__body`,children:Fxe()})]})]}):(0,I.jsx)(e4e,{canOpenSettings:j7(e.permissions??[]).length>0,userLabel:a,themeMode:e.themeMode},e.userId)}function J9(){let e=P(B.me.getImpersonation),t=F(B.admin.stopImpersonation);return!e||!e.impersonating?null:(0,I.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,I.jsx)(lee,{className:`size-4 shrink-0`}),(0,I.jsxs)(`span`,{className:`oc-imp__text`,children:[Rxe(),` `,(0,I.jsx)(`strong`,{children:e.targetLabel}),Vxe(),(0,I.jsx)(`strong`,{children:e.realLabel}),Wxe()]}),(0,I.jsx)(Y,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:qxe()})]})}function $2e({userLabel:e,themeMode:t,collapsed:n,onToggleSidebar:r}){return(0,I.jsxs)(`header`,{className:`oc-topbar`,children:[(0,I.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,I.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":n?Xxe():$xe(),onClick:r,children:n?(0,I.jsx)(yee,{}):(0,I.jsx)(vee,{})}),(0,I.jsx)(ts,{to:`/`,className:`oc-topbar__brand`,children:`OpenClaw`})]}),(0,I.jsx)(`div`,{className:`oc-topbar__search`,children:(0,I.jsx)(d1e,{})}),(0,I.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,I.jsx)(l1e,{}),(0,I.jsx)(K5,{label:e,mode:t})]})]})}function e4e({canOpenSettings:e,userLabel:t,themeMode:n}){let{width:r,collapsed:i,toggleCollapsed:a,startResize:o}=J2e(),s=ys(),c=zo({strict:!1}),l=Vo(),u=!!s({to:`/settings`,fuzzy:!0});return(0,I.jsxs)(`div`,{className:`oc-shell`,children:[(0,I.jsx)(J9,{}),(0,I.jsx)(G5,{}),(0,I.jsx)($2e,{userLabel:t,themeMode:n,collapsed:i,onToggleSidebar:a}),(0,I.jsxs)(`div`,{className:`oc-workspace`,children:[i?null:(0,I.jsxs)(`div`,{className:`oc-sidebar-col`,style:{width:r,flex:`0 0 ${r}px`},children:[u?(0,I.jsx)(O2e,{}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i1e,{activeChatId:c.chatId??null,onSelect:e=>void l({to:`/chat/$chatId`,params:{chatId:e}})}),e?(0,I.jsx)(Y,{variant:`ghost`,className:`m-2 justify-start`,asChild:!0,children:(0,I.jsx)(ts,{to:`/settings`,children:nSe()})}):null]}),(0,I.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:o,role:`separator`,"aria-orientation":`vertical`,"aria-label":aSe()})]}),(0,I.jsx)(`main`,{className:`oc-main`,children:(0,I.jsx)(hs,{})})]})]})}function t4e(){let e=P(B.me.getMe),t=Vo(),n=Ts({select:e=>e.pathname}),r=(0,N.useMemo)(()=>e?j7(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:k$()});if(i)return null;let a=N7(n),o=a!==void 0&&!r.includes(a);return(0,I.jsxs)(`div`,{className:`oc-admin`,children:[(0,I.jsx)(D2e,{}),(0,I.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,I.jsx)(n4e,{}):(0,I.jsx)(hs,{})})]})}function n4e(){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)(Om,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:cSe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:dSe()})]})}function r4e(){let e=P(B.me.getMe),t=Vo();return(0,N.useEffect)(()=>{if(e===void 0)return;let n=j7(e.permissions??[]);t({to:n.length>0?M7(n[0]):`/`,replace:!0})},[e,t]),(0,I.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:k$()})}function i4e(){let{tab:e}=zo({from:`/settings/$tab`});switch(e){case`groups`:return(0,I.jsx)(J1e,{});case`integrations`:return(0,I.jsx)(k0e,{});case`instances`:return(0,I.jsx)(M1e,{});case`bridge`:return(0,I.jsx)(u2e,{});case`theme`:return(0,I.jsx)(G2e,{});case`feedbacks`:return(0,I.jsx)(M0e,{});case`files`:return(0,I.jsx)(N0e,{});case`agentFiles`:return(0,I.jsx)(U0e,{});case`preferences`:return(0,I.jsx)(t2e,{});case`chatDefaults`:return(0,I.jsx)(i2e,{});case`access`:return(0,I.jsx)(c2e,{});default:return(0,I.jsx)(q1e,{})}}function a4e(){let{chatId:e}=zo({from:`/chat/$chatId`});return(0,I.jsx)(T6,{chatId:e})}function o4e(){return(0,I.jsx)(T6,{chatId:null})}var Y9=os({component:Y2e}),s4e=is({getParentRoute:()=>Y9,path:`/`,component:o4e}),c4e=is({getParentRoute:()=>Y9,path:`chat/$chatId`,component:a4e}),X9=is({getParentRoute:()=>Y9,path:`settings`,component:t4e}),l4e=is({getParentRoute:()=>X9,path:`/`,component:r4e}),u4e=is({getParentRoute:()=>X9,path:`traces`,validateSearch:S1e,component:r0e}),d4e=is({getParentRoute:()=>X9,path:`audit`,validateSearch:C1e,component:F1e}),f4e=is({getParentRoute:()=>X9,path:`anomalies`,validateSearch:w1e,component:C0e}),p4e=is({getParentRoute:()=>X9,path:`kpi`,validateSearch:T1e,component:f0e}),m4e=is({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:E1e,component:R1e}),h4e=is({getParentRoute:()=>X9,path:`users`,validateSearch:D1e,component:j1e}),g4e=is({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw Ri({to:`/settings/$tab`,params:{tab:k1e.uiprefs},replace:!0})}}),_4e=is({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:Tp([...D7]).catch(`roles`).parse(e.tab)}),component:i4e});function v4e({reset:e}){let t=Vo();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)(Om,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:mSe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:_Se()}),(0,I.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,I.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>e(),children:bSe()}),(0,I.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void t({to:`/`}),children:A$()})]})]})}function y4e(){let e=Vo();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)(cee,{size:28})}),(0,I.jsx)(`h2`,{className:`oc-route-error__title`,children:TSe()}),(0,I.jsx)(`p`,{className:`oc-route-error__body`,children:OSe()}),(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:A$()})})]})}var Z9=xs({routeTree:Y9.addChildren([s4e,c4e,X9.addChildren([l4e,u4e,d4e,f4e,p4e,m4e,h4e,g4e,_4e])]),defaultPreload:`intent`,defaultErrorComponent:v4e,defaultNotFoundComponent:y4e});async function b4e(){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 x4e=()=>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=Zn.createRoot(document.getElementById(`root`));$9.render((0,I.jsx)(N.StrictMode,{children:(0,I.jsx)(Q9,{children:`Chargement…`})})),b4e().then(e=>{let t=new kn(e);$9.render((0,I.jsx)(N.StrictMode,{children:(0,I.jsx)(_r,{client:t,children:(0,I.jsxs)(VUe,{children:[(0,I.jsx)(SZe,{children:(0,I.jsx)(ws,{router:Z9})}),(0,I.jsx)(N.Suspense,{fallback:null,children:(0,I.jsx)(x4e,{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-CdbIdR6H.js"></script>
41
+ <script type="module" crossorigin src="/assets/index-DsX2sNM6.js"></script>
42
42
  <link rel="stylesheet" crossorigin href="/assets/index-BNcoqeyn.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.1.4",
3
+ "version": "0.1.5",
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",