@rafal.lemieszewski/tide-ui 0.78.0 → 0.78.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -142,5 +142,5 @@ Defaulting to \`null\`.`}var nle=Jce,zct=ele;const Fct=Te("relative h-2 w-full r
|
|
|
142
142
|
To pick up a draggable item, press the space bar.
|
|
143
143
|
While dragging, use the arrow keys to move the item.
|
|
144
144
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
145
|
-
`},smt={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 cmt(e){let{announcements:t=smt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=imt}=e;const{announce:o,announcement:i}=rmt(),s=r0("DndLiveRegion"),[c,d]=w.useState(!1);if(w.useEffect(()=>{d(!0)},[]),amt(w.useMemo(()=>({onDragStart(h){let{active:m}=h;o(t.onDragStart({active:m}))},onDragMove(h){let{active:m,over:y}=h;t.onDragMove&&o(t.onDragMove({active:m,over:y}))},onDragOver(h){let{active:m,over:y}=h;o(t.onDragOver({active:m,over:y}))},onDragEnd(h){let{active:m,over:y}=h;o(t.onDragEnd({active:m,over:y}))},onDragCancel(h){let{active:m,over:y}=h;o(t.onDragCancel({active:m,over:y}))}}),[o,t])),!c)return null;const u=w.createElement(w.Fragment,null,w.createElement(tmt,{id:r,value:a.draggable}),w.createElement(nmt,{id:s,announcement:i}));return n?$r.createPortal(u,n):u}var on;(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"})(on||(on={}));function qE(){}function iX(e,t){return w.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function lmt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return w.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const la=Object.freeze({x:0,y:0});function dmt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function umt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function hmt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function pmt(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function sX(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}}const fmt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=sX(t,t.left,t.top),o=[];for(const i of r){const{id:s}=i,c=n.get(s);if(c){const d=dmt(sX(c),a);o.push({id:s,data:{droppableContainer:i,value:d}})}}return o.sort(umt)};function mmt(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),i=a-r,s=o-n;if(r<a&&n<o){const c=t.width*t.height,d=e.width*e.height,u=i*s,h=u/(c+d-u);return Number(h.toFixed(4))}return 0}const ymt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const o of r){const{id:i}=o,s=n.get(i);if(s){const c=mmt(s,t);c>0&&a.push({id:i,data:{droppableContainer:o,value:c}})}}return a.sort(hmt)};function gmt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function F1e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:la}function vmt(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return a.reduce((i,s)=>({...i,top:i.top+e*s.y,bottom:i.bottom+e*s.y,left:i.left+e*s.x,right:i.right+e*s.x}),{...n})}}const bmt=vmt(1);function xmt(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function kmt(e,t,n){const r=xmt(t);if(!r)return e;const{scaleX:a,scaleY:o,x:i,y:s}=r,c=e.left-i-(1-a)*parseFloat(n),d=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=a?e.width/a:e.width,h=o?e.height/o:e.height;return{width:u,height:h,top:d,right:c+u,bottom:d+h,left:c}}const wmt={ignoreTransform:!1};function T1(e,t){t===void 0&&(t=wmt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=sr(e).getComputedStyle(e);d&&(n=kmt(n,d,u))}const{top:r,left:a,width:o,height:i,bottom:s,right:c}=n;return{top:r,left:a,width:o,height:i,bottom:s,right:c}}function cX(e){return T1(e,{ignoreTransform:!0})}function Mmt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Cmt(e,t){return t===void 0&&(t=sr(e).getComputedStyle(e)),t.position==="fixed"}function Smt(e,t){t===void 0&&(t=sr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const o=t[a];return typeof o=="string"?n.test(o):!1})}function uq(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(cq(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!t0(a)||$1e(a)||n.includes(a))return n;const o=sr(e).getComputedStyle(a);return a!==e&&Smt(a,o)&&n.push(a),Cmt(a,o)?n:r(a.parentNode)}return e?r(e):n}function V1e(e){const[t]=uq(e,1);return t??null}function NT(e){return!UD||!e?null:O1(e)?e:sq(e)?cq(e)||e===$1(e).scrollingElement?window:t0(e)?e:null:null}function H1e(e){return O1(e)?e.scrollX:e.scrollLeft}function B1e(e){return O1(e)?e.scrollY:e.scrollTop}function wF(e){return{x:H1e(e),y:B1e(e)}}var gn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(gn||(gn={}));function q1e(e){return!UD||!e?!1:e===document.scrollingElement}function U1e(e){const t={x:0,y:0},n=q1e(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:a,isLeft:o,isBottom:i,isRight:s,maxScroll:r,minScroll:t}}const _mt={x:.2,y:.2};function Nmt(e,t,n,r,a){let{top:o,left:i,right:s,bottom:c}=n;r===void 0&&(r=10),a===void 0&&(a=_mt);const{isTop:d,isBottom:u,isLeft:h,isRight:m}=U1e(e),y={x:0,y:0},v={x:0,y:0},g={height:t.height*a.y,width:t.width*a.x};return!d&&o<=t.top+g.height?(y.y=gn.Backward,v.y=r*Math.abs((t.top+g.height-o)/g.height)):!u&&c>=t.bottom-g.height&&(y.y=gn.Forward,v.y=r*Math.abs((t.bottom-g.height-c)/g.height)),!m&&s>=t.right-g.width?(y.x=gn.Forward,v.x=r*Math.abs((t.right-g.width-s)/g.width)):!h&&i<=t.left+g.width&&(y.x=gn.Backward,v.x=r*Math.abs((t.left+g.width-i)/g.width)),{direction:y,speed:v}}function Imt(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function W1e(e){return e.reduce((t,n)=>Gu(t,wF(n)),la)}function jmt(e){return e.reduce((t,n)=>t+H1e(n),0)}function Lmt(e){return e.reduce((t,n)=>t+B1e(n),0)}function Amt(e,t){if(t===void 0&&(t=T1),!e)return;const{top:n,left:r,bottom:a,right:o}=t(e);V1e(e)&&(a<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Pmt=[["x",["left","right"],jmt],["y",["top","bottom"],Lmt]];class hq{constructor(t,n){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;const r=uq(n),a=W1e(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,i,s]of Pmt)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=s(r),u=a[o]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class jp{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Emt(e){const{EventTarget:t}=sr(e);return e instanceof t?e:$1(e)}function IT(e,t){const 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 Rr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Rr||(Rr={}));function lX(e){e.preventDefault()}function Rmt(e){e.stopPropagation()}var rt;(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"})(rt||(rt={}));const G1e={start:[rt.Space,rt.Enter],cancel:[rt.Esc],end:[rt.Space,rt.Enter,rt.Tab]},Dmt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case rt.Right:return{...n,x:n.x+25};case rt.Left:return{...n,x:n.x-25};case rt.Down:return{...n,y:n.y+25};case rt.Up:return{...n,y:n.y-25}}};class K1e{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new jp($1(n)),this.windowListeners=new jp(sr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Rr.Resize,this.handleCancel),this.windowListeners.add(Rr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Rr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Amt(r),n(la)}handleKeyDown(t){if(dq(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:o=G1e,coordinateGetter:i=Dmt,scrollBehavior:s="smooth"}=a,{code:c}=t;if(o.end.includes(c)){this.handleEnd(t);return}if(o.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,u=d?{x:d.left,y:d.top}:la;this.referenceCoordinates||(this.referenceCoordinates=u);const h=i(t,{active:n,context:r.current,currentCoordinates:u});if(h){const m=BE(h,u),y={x:0,y:0},{scrollableAncestors:v}=r.current;for(const g of v){const b=t.code,{isTop:x,isRight:k,isLeft:M,isBottom:C,maxScroll:S,minScroll:_}=U1e(g),N=Imt(g),I={x:Math.min(b===rt.Right?N.right-N.width/2:N.right,Math.max(b===rt.Right?N.left:N.left+N.width/2,h.x)),y:Math.min(b===rt.Down?N.bottom-N.height/2:N.bottom,Math.max(b===rt.Down?N.top:N.top+N.height/2,h.y))},A=b===rt.Right&&!k||b===rt.Left&&!M,T=b===rt.Down&&!C||b===rt.Up&&!x;if(A&&I.x!==h.x){const P=g.scrollLeft+m.x,F=b===rt.Right&&P<=S.x||b===rt.Left&&P>=_.x;if(F&&!m.y){g.scrollTo({left:P,behavior:s});return}F?y.x=g.scrollLeft-P:y.x=b===rt.Right?g.scrollLeft-S.x:g.scrollLeft-_.x,y.x&&g.scrollBy({left:-y.x,behavior:s});break}else if(T&&I.y!==h.y){const P=g.scrollTop+m.y,F=b===rt.Down&&P<=S.y||b===rt.Up&&P>=_.y;if(F&&!m.x){g.scrollTo({top:P,behavior:s});return}F?y.y=g.scrollTop-P:y.y=b===rt.Down?g.scrollTop-S.y:g.scrollTop-_.y,y.y&&g.scrollBy({top:-y.y,behavior:s});break}}this.handleMove(t,Gu(BE(h,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}K1e.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=G1e,onActivation:a}=t,{active:o}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const s=o.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),a?.({event:e.nativeEvent}),!0)}return!1}}];function dX(e){return!!(e&&"distance"in e)}function uX(e){return!!(e&&"delay"in e)}class pq{constructor(t,n,r){var a;r===void 0&&(r=Emt(t.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=t,this.events=n;const{event:o}=t,{target:i}=o;this.props=t,this.events=n,this.document=$1(i),this.documentListeners=new jp(this.document),this.listeners=new jp(r),this.windowListeners=new jp(sr(i)),this.initialCoordinates=(a=kF(o))!=null?a:la,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(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Rr.Resize,this.handleCancel),this.windowListeners.add(Rr.DragStart,lX),this.windowListeners.add(Rr.VisibilityChange,this.handleCancel),this.windowListeners.add(Rr.ContextMenu,lX),this.documentListeners.add(Rr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(uX(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(dX(n)){this.handlePending(n);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(t,n){const{active:r,onPending:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Rr.Click,Rmt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Rr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:o}=this,{onMove:i,options:{activationConstraint:s}}=o;if(!a)return;const c=(n=kF(t))!=null?n:la,d=BE(a,c);if(!r&&s){if(dX(s)){if(s.tolerance!=null&&IT(d,s.tolerance))return this.handleCancel();if(IT(d,s.distance))return this.handleStart()}if(uX(s)&&IT(d,s.tolerance))return this.handleCancel();this.handlePending(s,d);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===rt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Omt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Z1e extends pq{constructor(t){const{event:n}=t,r=$1(n.target);super(t,Omt,r)}}Z1e.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const $mt={move:{name:"mousemove"},end:{name:"mouseup"}};var MF;(function(e){e[e.RightClick=2]="RightClick"})(MF||(MF={}));class Y1e extends pq{constructor(t){super(t,$mt,$1(t.event.target))}}Y1e.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===MF.RightClick?!1:(r?.({event:n}),!0)}}];const jT={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class X1e extends pq{constructor(t){super(t,jT)}static setup(){return window.addEventListener(jT.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(jT.move.name,t)};function t(){}}}X1e.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r?.({event:n}),!0)}}];var Lp;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Lp||(Lp={}));var UE;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(UE||(UE={}));function Tmt(e){let{acceleration:t,activator:n=Lp.Pointer,canScroll:r,draggingRect:a,enabled:o,interval:i=5,order:s=UE.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:m}=e;const y=Fmt({delta:h,disabled:!o}),[v,g]=Yft(),b=w.useRef({x:0,y:0}),x=w.useRef({x:0,y:0}),k=w.useMemo(()=>{switch(n){case Lp.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Lp.DraggableRect:return a}},[n,a,c]),M=w.useRef(null),C=w.useCallback(()=>{const _=M.current;if(!_)return;const N=b.current.x*x.current.x,I=b.current.y*x.current.y;_.scrollBy(N,I)},[]),S=w.useMemo(()=>s===UE.TreeOrder?[...d].reverse():d,[s,d]);w.useEffect(()=>{if(!o||!d.length||!k){g();return}for(const _ of S){if(r?.(_)===!1)continue;const N=d.indexOf(_),I=u[N];if(!I)continue;const{direction:A,speed:T}=Nmt(_,I,k,t,m);for(const P of["x","y"])y[P][A[P]]||(T[P]=0,A[P]=0);if(T.x>0||T.y>0){g(),M.current=_,v(C,i),b.current=T,x.current=A;return}}b.current={x:0,y:0},x.current={x:0,y:0},g()},[t,C,r,g,o,i,JSON.stringify(k),JSON.stringify(y),v,d,S,u,JSON.stringify(m)])}const zmt={x:{[gn.Backward]:!1,[gn.Forward]:!1},y:{[gn.Backward]:!1,[gn.Forward]:!1}};function Fmt(e){let{delta:t,disabled:n}=e;const r=xF(t);return n0(a=>{if(n||!r||!a)return zmt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[gn.Backward]:a.x[gn.Backward]||o.x===-1,[gn.Forward]:a.x[gn.Forward]||o.x===1},y:{[gn.Backward]:a.y[gn.Backward]||o.y===-1,[gn.Forward]:a.y[gn.Forward]||o.y===1}}},[n,t,r])}function Vmt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return n0(a=>{var o;return t==null?null:(o=r??a)!=null?o:null},[r,t])}function Hmt(e,t){return w.useMemo(()=>e.reduce((n,r)=>{const{sensor:a}=r,o=a.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...o]},[]),[e,t])}var o2;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(o2||(o2={}));var CF;(function(e){e.Optimized="optimized"})(CF||(CF={}));const hX=new Map;function Bmt(e,t){let{dragging:n,dependencies:r,config:a}=t;const[o,i]=w.useState(null),{frequency:s,measure:c,strategy:d}=a,u=w.useRef(e),h=b(),m=r2(h),y=w.useCallback(function(x){x===void 0&&(x=[]),!m.current&&i(k=>k===null?x:k.concat(x.filter(M=>!k.includes(M))))},[m]),v=w.useRef(null),g=n0(x=>{if(h&&!n)return hX;if(!x||x===hX||u.current!==e||o!=null){const k=new Map;for(let M of e){if(!M)continue;if(o&&o.length>0&&!o.includes(M.id)&&M.rect.current){k.set(M.id,M.rect.current);continue}const C=M.node.current,S=C?new hq(c(C),C):null;M.rect.current=S,S&&k.set(M.id,S)}return k}return x},[e,o,n,h,c]);return w.useEffect(()=>{u.current=e},[e]),w.useEffect(()=>{h||y()},[n,h]),w.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),w.useEffect(()=>{h||typeof s!="number"||v.current!==null||(v.current=setTimeout(()=>{y(),v.current=null},s))},[s,h,y,...r]),{droppableRects:g,measureDroppableContainers:y,measuringScheduled:o!=null};function b(){switch(d){case o2.Always:return!1;case o2.BeforeDragging:return n;default:return!n}}}function J1e(e,t){return n0(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function qmt(e,t){return J1e(e,t)}function Umt(e){let{callback:t,disabled:n}=e;const r=lq(t),a=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return w.useEffect(()=>()=>a?.disconnect(),[a]),a}function WD(e){let{callback:t,disabled:n}=e;const r=lq(t),a=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return w.useEffect(()=>()=>a?.disconnect(),[a]),a}function Wmt(e){return new hq(T1(e),e)}function pX(e,t,n){t===void 0&&(t=Wmt);const[r,a]=w.useState(null);function o(){a(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const i=Umt({callback(c){if(e)for(const d of c){const{type:u,target:h}=d;if(u==="childList"&&h instanceof HTMLElement&&h.contains(e)){o();break}}}}),s=WD({callback:o});return Va(()=>{o(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),r}function Gmt(e){const t=J1e(e);return F1e(e,t)}const fX=[];function Kmt(e){const t=w.useRef(e),n=n0(r=>e?r&&r!==fX&&e&&t.current&&e.parentNode===t.current.parentNode?r:uq(e):fX,[e]);return w.useEffect(()=>{t.current=e},[e]),n}function Zmt(e){const[t,n]=w.useState(null),r=w.useRef(e),a=w.useCallback(o=>{const i=NT(o.target);i&&n(s=>s?(s.set(i,wF(i)),new Map(s)):null)},[]);return w.useEffect(()=>{const o=r.current;if(e!==o){i(o);const s=e.map(c=>{const d=NT(c);return d?(d.addEventListener("scroll",a,{passive:!0}),[d,wF(d)]):null}).filter(c=>c!=null);n(s.length?new Map(s):null),r.current=e}return()=>{i(e),i(o)};function i(s){s.forEach(c=>{const d=NT(c);d?.removeEventListener("scroll",a)})}},[a,e]),w.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>Gu(o,i),la):W1e(e):la,[e,t])}function mX(e,t){t===void 0&&(t=[]);const n=w.useRef(null);return w.useEffect(()=>{n.current=null},t),w.useEffect(()=>{const r=e!==la;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?BE(e,n.current):la}function Ymt(e){w.useEffect(()=>{if(!UD)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Xmt(e,t){return w.useMemo(()=>e.reduce((n,r)=>{let{eventName:a,handler:o}=r;return n[a]=i=>{o(i,t)},n},{}),[e,t])}function Q1e(e){return w.useMemo(()=>e?Mmt(e):null,[e])}const yX=[];function Jmt(e,t){t===void 0&&(t=T1);const[n]=e,r=Q1e(n?sr(n):null),[a,o]=w.useState(yX);function i(){o(()=>e.length?e.map(c=>q1e(c)?r:new hq(t(c),c)):yX)}const s=WD({callback:i});return Va(()=>{s?.disconnect(),i(),e.forEach(c=>s?.observe(c))},[e]),a}function Qmt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return t0(t)?t:e}function eyt(e){let{measure:t}=e;const[n,r]=w.useState(null),a=w.useCallback(d=>{for(const{target:u}of d)if(t0(u)){r(h=>{const m=t(u);return h?{...h,width:m.width,height:m.height}:m});break}},[t]),o=WD({callback:a}),i=w.useCallback(d=>{const u=Qmt(d);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[s,c]=HE(i);return w.useMemo(()=>({nodeRef:s,rect:n,setRef:c}),[n,s,c])}const tyt=[{sensor:Z1e,options:{}},{sensor:K1e,options:{}}],nyt={current:{}},CP={draggable:{measure:cX},droppable:{measure:cX,strategy:o2.WhileDragging,frequency:CF.Optimized},dragOverlay:{measure:T1}};class Ap extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const ryt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ap,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:qE},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:CP,measureDroppableContainers:qE,windowRect:null,measuringScheduled:!1},ayt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:qE,draggableNodes:new Map,over:null,measureDroppableContainers:qE},GD=w.createContext(ayt),ehe=w.createContext(ryt);function oyt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ap}}}function iyt(e,t){switch(t.type){case on.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case on.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 on.DragEnd:case on.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case on.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new Ap(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case on.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ap(e.droppable.containers);return i.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:i}}}case on.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const o=new Ap(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function syt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=w.useContext(GD),o=xF(r),i=xF(n?.id);return w.useEffect(()=>{if(!t&&!r&&o&&i!=null){if(!dq(o)||document.activeElement===o.target)return;const s=a.get(i);if(!s)return;const{activatorNode:c,node:d}=s;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const h=Qft(u);if(h){h.focus();break}}})}},[r,t,a,i,o]),null}function cyt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,o)=>o({transform:a,...r}),n):n}function lyt(e){return w.useMemo(()=>({draggable:{...CP.draggable,...e?.draggable},droppable:{...CP.droppable,...e?.droppable},dragOverlay:{...CP.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function dyt(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const o=w.useRef(!1),{x:i,y:s}=typeof a=="boolean"?{x:a,y:a}:a;Va(()=>{if(!i&&!s||!t){o.current=!1;return}if(o.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const u=n(d),h=F1e(u,r);if(i||(h.x=0),s||(h.y=0),o.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const m=V1e(d);m&&m.scrollBy({top:h.y,left:h.x})}},[t,i,s,r,n])}const the=w.createContext({...la,scaleX:1,scaleY:1});var hi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(hi||(hi={}));const uyt=w.memo(function(t){var n,r,a,o;let{id:i,accessibility:s,autoScroll:c=!0,children:d,sensors:u=tyt,collisionDetection:h=ymt,measuring:m,modifiers:y,...v}=t;const g=w.useReducer(iyt,void 0,oyt),[b,x]=g,[k,M]=omt(),[C,S]=w.useState(hi.Uninitialized),_=C===hi.Initialized,{draggable:{active:N,nodes:I,translate:A},droppable:{containers:T}}=b,P=N!=null?I.get(N):null,F=w.useRef({initial:null,translated:null}),U=w.useMemo(()=>{var ue;return N!=null?{id:N,data:(ue=P?.data)!=null?ue:nyt,rect:F}:null},[N,P]),W=w.useRef(null),[Z,L]=w.useState(null),[R,E]=w.useState(null),O=r2(v,Object.values(v)),J=r0("DndDescribedBy",i),K=w.useMemo(()=>T.getEnabled(),[T]),B=lyt(m),{droppableRects:$,measureDroppableContainers:G,measuringScheduled:z}=Bmt(K,{dragging:_,dependencies:[A.x,A.y],config:B.droppable}),H=Vmt(I,N),D=w.useMemo(()=>R?kF(R):null,[R]),Y=me(),V=qmt(H,B.draggable.measure);dyt({activeNode:N!=null?I.get(N):null,config:Y.layoutShiftCompensation,initialRect:V,measure:B.draggable.measure});const Q=pX(H,B.draggable.measure,V),ae=pX(H?H.parentElement:null),X=w.useRef({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:$,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ye=T.getNodeFor((n=X.current.over)==null?void 0:n.id),ie=eyt({measure:B.dragOverlay.measure}),Ee=(r=ie.nodeRef.current)!=null?r:H,Pe=_?(a=ie.rect)!=null?a:Q:null,Fe=!!(ie.nodeRef.current&&ie.rect),Ge=Gmt(Fe?null:Q),dt=Q1e(Ee?sr(Ee):null),mt=Kmt(_?ye??H:null),Ft=Jmt(mt),Xe=cyt(y,{transform:{x:A.x-Ge.x,y:A.y-Ge.y,scaleX:1,scaleY:1},activatorEvent:R,active:U,activeNodeRect:Q,containerNodeRect:ae,draggingNodeRect:Pe,over:X.current.over,overlayNodeRect:ie.rect,scrollableAncestors:mt,scrollableAncestorRects:Ft,windowRect:dt}),ne=D?Gu(D,A):null,Se=Zmt(mt),Ae=mX(Se),Ke=mX(Se,[Q]),tt=Gu(Xe,Ae),bt=Pe?bmt(Pe,Xe):null,Zt=U&&bt?h({active:U,collisionRect:bt,droppableRects:$,droppableContainers:K,pointerCoordinates:ne}):null,yt=pmt(Zt,"id"),[jt,Vt]=w.useState(null),Lt=Fe?Xe:Gu(Xe,Ke),cr=gmt(Lt,(o=jt?.rect)!=null?o:null,Q),lr=w.useRef(null),$t=w.useCallback((ue,Le)=>{let{sensor:ce,options:Re}=Le;if(W.current==null)return;const Ve=I.get(W.current);if(!Ve)return;const He=ue.nativeEvent,ot=new ce({active:W.current,activeNode:Ve,event:He,options:Re,context:X,onAbort(ze){if(!I.get(ze))return;const{onDragAbort:gt}=O.current,At={id:ze};gt?.(At),k({type:"onDragAbort",event:At})},onPending(ze,Ht,gt,At){if(!I.get(ze))return;const{onDragPending:Rn}=O.current,Kr={id:ze,constraint:Ht,initialCoordinates:gt,offset:At};Rn?.(Kr),k({type:"onDragPending",event:Kr})},onStart(ze){const Ht=W.current;if(Ht==null)return;const gt=I.get(Ht);if(!gt)return;const{onDragStart:At}=O.current,fa={activatorEvent:He,active:{id:Ht,data:gt.data,rect:F}};$r.unstable_batchedUpdates(()=>{At?.(fa),S(hi.Initializing),x({type:on.DragStart,initialCoordinates:ze,active:Ht}),k({type:"onDragStart",event:fa}),L(lr.current),E(He)})},onMove(ze){x({type:on.DragMove,coordinates:ze})},onEnd:qe(on.DragEnd),onCancel:qe(on.DragCancel)});lr.current=ot;function qe(ze){return async function(){const{active:gt,collisions:At,over:fa,scrollAdjustedTranslate:Rn}=X.current;let Kr=null;if(gt&&Rn){const{cancelDrop:Ti}=O.current;Kr={activatorEvent:He,active:gt,collisions:At,delta:Rn,over:fa},ze===on.DragEnd&&typeof Ti=="function"&&await Promise.resolve(Ti(Kr))&&(ze=on.DragCancel)}W.current=null,$r.unstable_batchedUpdates(()=>{x({type:ze}),S(hi.Uninitialized),Vt(null),L(null),E(null),lr.current=null;const Ti=ze===on.DragEnd?"onDragEnd":"onDragCancel";if(Kr){const z1=O.current[Ti];z1?.(Kr),k({type:Ti,event:Kr})}})}}},[I]),In=w.useCallback((ue,Le)=>(ce,Re)=>{const Ve=ce.nativeEvent,He=I.get(Re);if(W.current!==null||!He||Ve.dndKit||Ve.defaultPrevented)return;const ot={active:He};ue(ce,Le.options,ot)===!0&&(Ve.dndKit={capturedBy:Le.sensor},W.current=Re,$t(ce,Le))},[I,$t]),dr=Hmt(u,In);Ymt(u),Va(()=>{Q&&C===hi.Initializing&&S(hi.Initialized)},[Q,C]),w.useEffect(()=>{const{onDragMove:ue}=O.current,{active:Le,activatorEvent:ce,collisions:Re,over:Ve}=X.current;if(!Le||!ce)return;const He={active:Le,activatorEvent:ce,collisions:Re,delta:{x:tt.x,y:tt.y},over:Ve};$r.unstable_batchedUpdates(()=>{ue?.(He),k({type:"onDragMove",event:He})})},[tt.x,tt.y]),w.useEffect(()=>{const{active:ue,activatorEvent:Le,collisions:ce,droppableContainers:Re,scrollAdjustedTranslate:Ve}=X.current;if(!ue||W.current==null||!Le||!Ve)return;const{onDragOver:He}=O.current,ot=Re.get(yt),qe=ot&&ot.rect.current?{id:ot.id,rect:ot.rect.current,data:ot.data,disabled:ot.disabled}:null,ze={active:ue,activatorEvent:Le,collisions:ce,delta:{x:Ve.x,y:Ve.y},over:qe};$r.unstable_batchedUpdates(()=>{Vt(qe),He?.(ze),k({type:"onDragOver",event:ze})})},[yt]),Va(()=>{X.current={activatorEvent:R,active:U,activeNode:H,collisionRect:bt,collisions:Zt,droppableRects:$,draggableNodes:I,draggingNode:Ee,draggingNodeRect:Pe,droppableContainers:T,over:jt,scrollableAncestors:mt,scrollAdjustedTranslate:tt},F.current={initial:Pe,translated:bt}},[U,H,Zt,bt,I,Ee,Pe,$,T,jt,mt,tt]),Tmt({...Y,delta:A,draggingRect:bt,pointerCoordinates:ne,scrollableAncestors:mt,scrollableAncestorRects:Ft});const le=w.useMemo(()=>({active:U,activeNode:H,activeNodeRect:Q,activatorEvent:R,collisions:Zt,containerNodeRect:ae,dragOverlay:ie,draggableNodes:I,droppableContainers:T,droppableRects:$,over:jt,measureDroppableContainers:G,scrollableAncestors:mt,scrollableAncestorRects:Ft,measuringConfiguration:B,measuringScheduled:z,windowRect:dt}),[U,H,Q,R,Zt,ae,ie,I,T,$,jt,G,mt,Ft,B,z,dt]),xe=w.useMemo(()=>({activatorEvent:R,activators:dr,active:U,activeNodeRect:Q,ariaDescribedById:{draggable:J},dispatch:x,draggableNodes:I,over:jt,measureDroppableContainers:G}),[R,dr,U,Q,x,J,I,jt,G]);return w.createElement(z1e.Provider,{value:M},w.createElement(GD.Provider,{value:xe},w.createElement(ehe.Provider,{value:le},w.createElement(the.Provider,{value:cr},d)),w.createElement(syt,{disabled:s?.restoreFocus===!1})),w.createElement(cmt,{...s,hiddenTextDescribedById:J}));function me(){const ue=Z?.autoScrollEnabled===!1,Le=typeof c=="object"?c.enabled===!1:c===!1,ce=_&&!ue&&!Le;return typeof c=="object"?{...c,enabled:ce}:{enabled:ce}}}),hyt=w.createContext(null),gX="button",pyt="Draggable";function fyt(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const o=r0(pyt),{activators:i,activatorEvent:s,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:m}=w.useContext(GD),{role:y=gX,roleDescription:v="draggable",tabIndex:g=0}=a??{},b=c?.id===t,x=w.useContext(b?the:hyt),[k,M]=HE(),[C,S]=HE(),_=Xmt(i,t),N=r2(n);Va(()=>(h.set(t,{id:t,key:o,node:k,activatorNode:C,data:N}),()=>{const A=h.get(t);A&&A.key===o&&h.delete(t)}),[h,t]);const I=w.useMemo(()=>({role:y,tabIndex:g,"aria-disabled":r,"aria-pressed":b&&y===gX?!0:void 0,"aria-roledescription":v,"aria-describedby":u.draggable}),[r,y,g,b,v,u.draggable]);return{active:c,activatorEvent:s,activeNodeRect:d,attributes:I,isDragging:b,listeners:r?void 0:_,node:k,over:m,setNodeRef:M,setActivatorNodeRef:S,transform:x}}function myt(){return w.useContext(ehe)}const yyt="Droppable",gyt={timeout:25};function vyt(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const o=r0(yyt),{active:i,dispatch:s,over:c,measureDroppableContainers:d}=w.useContext(GD),u=w.useRef({disabled:n}),h=w.useRef(!1),m=w.useRef(null),y=w.useRef(null),{disabled:v,updateMeasurementsFor:g,timeout:b}={...gyt,...a},x=r2(g??r),k=w.useCallback(()=>{if(!h.current){h.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),y.current=null},b)},[b]),M=WD({callback:k,disabled:v||!i}),C=w.useCallback((I,A)=>{M&&(A&&(M.unobserve(A),h.current=!1),I&&M.observe(I))},[M]),[S,_]=HE(C),N=r2(t);return w.useEffect(()=>{!M||!S.current||(M.disconnect(),h.current=!1,M.observe(S.current))},[S,M]),w.useEffect(()=>(s({type:on.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:m,data:N}}),()=>s({type:on.UnregisterDroppable,key:o,id:r})),[r]),w.useEffect(()=>{n!==u.current.disabled&&(s({type:on.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,s]),{active:i,rect:m,isOver:c?.id===r,node:S,over:c,setNodeRef:_}}function fq(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function byt(e,t){return e.reduce((n,r,a)=>{const o=t.get(r);return o&&(n[a]=o),n},Array(e.length))}function af(e){return e!==null&&e>=0}function xyt(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 kyt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const of={scaleX:1,scaleY:1},wyt=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:a,overIndex:o,index:i}=e;const s=(t=n[a])!=null?t:r;if(!s)return null;const c=Myt(n,i,a);if(i===a){const d=n[o];return d?{x:a<o?d.left+d.width-(s.left+s.width):d.left-s.left,y:0,...of}:null}return i>a&&i<=o?{x:-s.width-c,y:0,...of}:i<a&&i>=o?{x:s.width+c,y:0,...of}:{x:0,y:0,...of}};function Myt(e,t,n){const r=e[t],a=e[t-1],o=e[t+1];return!r||!a&&!o?0:n<t?a?r.left-(a.left+a.width):o.left-(r.left+r.width):o?o.left-(r.left+r.width):r.left-(a.left+a.width)}const nhe=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e;const o=fq(t,r,n),i=t[a],s=o[a];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}},rhe="Sortable",ahe=w.createContext({activeIndex:-1,containerId:rhe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:nhe,disabled:{draggable:!1,droppable:!1}});function Cyt(e){let{children:t,id:n,items:r,strategy:a=nhe,disabled:o=!1}=e;const{active:i,dragOverlay:s,droppableRects:c,over:d,measureDroppableContainers:u}=myt(),h=r0(rhe,n),m=s.rect!==null,y=w.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),v=i!=null,g=i?y.indexOf(i.id):-1,b=d?y.indexOf(d.id):-1,x=w.useRef(y),k=!xyt(y,x.current),M=b!==-1&&g===-1||k,C=kyt(o);Va(()=>{k&&v&&u(y)},[k,y,v,u]),w.useEffect(()=>{x.current=y},[y]);const S=w.useMemo(()=>({activeIndex:g,containerId:h,disabled:C,disableTransforms:M,items:y,overIndex:b,useDragOverlay:m,sortedRects:byt(y,c),strategy:a}),[g,h,C.draggable,C.droppable,M,y,b,c,m,a]);return w.createElement(ahe.Provider,{value:S},t)}const Syt=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return fq(n,r,a).indexOf(t)},_yt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:o,newIndex:i,previousItems:s,previousContainerId:c,transition:d}=e;return!d||!r||s!==o&&a===i?!1:n?!0:i!==a&&t===c},Nyt={duration:200,easing:"ease"},ohe="transform",Iyt=a2.Transition.toString({property:ohe,duration:0,easing:"linear"}),jyt={roleDescription:"sortable"};function Lyt(e){let{disabled:t,index:n,node:r,rect:a}=e;const[o,i]=w.useState(null),s=w.useRef(n);return Va(()=>{if(!t&&n!==s.current&&r.current){const c=a.current;if(c){const d=T1(r.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&i(u)}}n!==s.current&&(s.current=n)},[t,n,r,a]),w.useEffect(()=>{o&&i(null)},[o]),o}function Ayt(e){let{animateLayoutChanges:t=_yt,attributes:n,disabled:r,data:a,getNewIndex:o=Syt,id:i,strategy:s,resizeObserverConfig:c,transition:d=Nyt}=e;const{items:u,containerId:h,activeIndex:m,disabled:y,disableTransforms:v,sortedRects:g,overIndex:b,useDragOverlay:x,strategy:k}=w.useContext(ahe),M=Pyt(r,y),C=u.indexOf(i),S=w.useMemo(()=>({sortable:{containerId:h,index:C,items:u},...a}),[h,a,C,u]),_=w.useMemo(()=>u.slice(u.indexOf(i)),[u,i]),{rect:N,node:I,isOver:A,setNodeRef:T}=vyt({id:i,data:S,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...c}}),{active:P,activatorEvent:F,activeNodeRect:U,attributes:W,setNodeRef:Z,listeners:L,isDragging:R,over:E,setActivatorNodeRef:O,transform:J}=fyt({id:i,data:S,attributes:{...jyt,...n},disabled:M.draggable}),K=Zft(T,Z),B=!!P,$=B&&!v&&af(m)&&af(b),G=!x&&R,z=G&&$?J:null,D=$?z??(s??k)({rects:g,activeNodeRect:U,activeIndex:m,overIndex:b,index:C}):null,Y=af(m)&&af(b)?o({id:i,items:u,activeIndex:m,overIndex:b}):C,V=P?.id,Q=w.useRef({activeId:V,items:u,newIndex:Y,containerId:h}),ae=u!==Q.current.items,X=t({active:P,containerId:h,isDragging:R,isSorting:B,id:i,index:C,items:u,newIndex:Q.current.newIndex,previousItems:Q.current.items,previousContainerId:Q.current.containerId,transition:d,wasDragging:Q.current.activeId!=null}),ye=Lyt({disabled:!X,index:C,node:I,rect:N});return w.useEffect(()=>{B&&Q.current.newIndex!==Y&&(Q.current.newIndex=Y),h!==Q.current.containerId&&(Q.current.containerId=h),u!==Q.current.items&&(Q.current.items=u)},[B,Y,h,u]),w.useEffect(()=>{if(V===Q.current.activeId)return;if(V!=null&&Q.current.activeId==null){Q.current.activeId=V;return}const Ee=setTimeout(()=>{Q.current.activeId=V},50);return()=>clearTimeout(Ee)},[V]),{active:P,activeIndex:m,attributes:W,data:S,rect:N,index:C,newIndex:Y,items:u,isOver:A,isSorting:B,isDragging:R,listeners:L,node:I,overIndex:b,over:E,setNodeRef:K,setActivatorNodeRef:O,setDroppableNodeRef:T,setDraggableNodeRef:Z,transform:ye??D,transition:ie()};function ie(){if(ye||ae&&Q.current.newIndex===C)return Iyt;if(!(G&&!dq(F)||!d)&&(B||X))return a2.Transition.toString({...d,property:ohe})}}function Pyt(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}rt.Down,rt.Right,rt.Up,rt.Left;function vX(e){if(e?.directionOptions)return e.directionOptions;if(e?.dataType)switch(e.dataType){case"text":return{asc:"A to Z",desc:"Z to A"};case"number":return{asc:"Ascending",desc:"Descending"};case"date":return{asc:"Oldest first",desc:"Newest first"};case"boolean":return{asc:"False first",desc:"True first"}}return{asc:"Ascending",desc:"Descending"}}function ihe({sortableColumns:e,selectedSortColumn:t,sortDirection:n="asc",onSortChange:r,onSortDirectionChange:a,groupableColumns:o,selectedGroupColumn:i,onGroupChange:s,columns:c,visibleColumns:d,onColumnVisibilityChange:u,align:h="end",triggerClassName:m}){const[y,v]=w.useState(""),[g,b]=w.useState(""),x=w.useId(),k=w.useId(),M=w.useId(),C=w.useCallback(L=>{const R=e.find(E=>E.id===L)?.label;b(`Sorting by ${R}`),r?.(L)},[e,r]),S=w.useCallback(L=>{const R=e.find(J=>J.id===t),E=vX(R),O=L==="asc"?E.asc:E.desc;b(`Sort direction: ${O}`),a?.(L)},[e,t,a]),_=w.useCallback(L=>{if(L==="none")b("Grouping cleared");else{const R=o.find(E=>E.id===L)?.label;b(`Grouping by ${R}`)}s?.(L)},[o,s]),N=w.useCallback((L,R)=>{const E=c.find(O=>O.id===L)?.label;b(R?`${E} column shown`:`${E} column hidden`),u?.(L,R)},[c,u]),I=e.length>0,A=o.length>0,T=c.length>0,P=I||A,F=w.useMemo(()=>e.find(L=>L.id===t),[e,t]),U=w.useMemo(()=>vX(F),[F]),W=w.useMemo(()=>{if(!y)return c;const L=y.toLowerCase();return c.filter(R=>R.label.toLowerCase().includes(L))},[c,y]),Z=c.length>=20;return l.jsxs(Ao,{children:[l.jsx(Fa,{asChild:!0,children:l.jsx(Oe,{size:"md",icon:"settings","aria-label":"Table settings",className:m})}),l.jsxs(za,{align:h,className:"w-72 max-w-[90vw]",children:[P&&l.jsx("div",{className:"p-3",children:l.jsxs("div",{className:"space-y-4",children:[I&&l.jsxs("div",{className:"space-y-2",role:"group","aria-labelledby":x,children:[l.jsx("h4",{id:x,className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Sorting"}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs(On,{value:t,onValueChange:C,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to sort"})}),l.jsx(Pn,{children:e.map(L=>l.jsx(wt,{value:L.id,children:L.label},L.id))})]}),t&&l.jsxs(On,{value:n,onValueChange:L=>S(L),children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{})}),l.jsxs(Pn,{children:[l.jsx(wt,{value:"asc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-narrow-wide",size:"sm"}),l.jsx("span",{children:U.asc})]})}),l.jsx(wt,{value:"desc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-wide-narrow",size:"sm"}),l.jsx("span",{children:U.desc})]})})]})]})]})]}),A&&l.jsxs("div",{className:"space-y-2",role:"group","aria-labelledby":k,children:[l.jsx("h4",{id:k,className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Grouping"}),l.jsxs(On,{value:i||"none",onValueChange:_,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to group by"})}),l.jsxs(Pn,{children:[l.jsx(wt,{value:"none",children:"None"}),o.map(L=>l.jsx(wt,{value:L.id,children:L.label},L.id))]})]})]})]})}),P&&T&&l.jsx(Jr,{}),T&&l.jsx("div",{className:"p-3",children:l.jsxs("div",{className:"space-y-2",role:"group","aria-labelledby":M,children:[l.jsx("h4",{id:M,className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Display columns"}),Z&&l.jsx(Fn,{type:"search",size:"sm",placeholder:"Search columns...","aria-label":"Search columns",value:y,onChange:L=>v(L.target.value)}),l.jsx("div",{className:"flex flex-wrap items-start justify-start gap-1 max-h-[190px] overflow-y-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-2 rounded-sm",role:W.length>15?"region":void 0,"aria-label":W.length>15?"Column visibility toggles, scrollable":void 0,tabIndex:W.length>15?0:void 0,children:W.map(L=>{const R=d.includes(L.id);return l.jsx(hD,{variant:"outline",size:"sm",pressed:R,"aria-label":R?`Hide ${L.label} column`:`Show ${L.label} column`,onPressedChange:E=>{N(L.id,E)},children:L.label},L.id)})})]})}),l.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:g})]})]})}function Eyt(e,t){const[n,r]=p.useState(e);return p.useEffect(()=>{const a=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(a)}},[e,t]),n}const Ru=p.memo(function({children:t,align:n="left"}){const r=p.useRef(null),[a,o]=p.useState(!1),[i,s]=p.useState("");return p.useEffect(()=>{const c=r.current;if(!c)return;let d;const u=()=>{clearTimeout(d),d=setTimeout(()=>{if(r.current){const m=r.current.scrollWidth>r.current.clientWidth,y=r.current.firstElementChild,v=y?y.scrollWidth>y.clientWidth:!1;o(m||v)}},150)};if(r.current){const m=r.current.scrollWidth>r.current.clientWidth,y=r.current.firstElementChild,v=y?y.scrollWidth>y.clientWidth:!1;o(m||v)}const h=new ResizeObserver(u);return h.observe(c),()=>{clearTimeout(d),h.disconnect()}},[t]),p.useEffect(()=>{r.current&&s(r.current.textContent||"")},[t]),a?l.jsxs(Dr,{children:[l.jsx(Or,{asChild:!0,children:l.jsx("div",{ref:r,className:j("min-w-0 overflow-hidden truncate [&>*]:truncate",n==="right"&&"text-right"),children:t})}),l.jsx(gr,{side:"top",className:"max-w-xs",children:i})]}):l.jsx("div",{ref:r,className:j("min-w-0 overflow-hidden truncate [&>*]:truncate",n==="right"&&"text-right"),children:t})}),bX=(e,t,n,r)=>{const a=e.getValue(t),o=a!=null?String(a):"",i=n.toLowerCase();return o.toLowerCase().includes(i)?!0:o.toLowerCase().split(" ").some(c=>c.startsWith(i))},Ryt=(e,t,n)=>{if(!n||n.length===0)return!0;const r=e.getValue(t);return n.includes(r)};function Dyt(e,t){for(const n of e){const r=typeof t=="function"?t(n.original):n.original?.[t];if(r!=null){if(typeof r=="number")return"number";if(r instanceof Date)return"date";if(typeof r=="string"){const a=Date.parse(r);return isNaN(a)?"string":"date"}return"unknown"}}return"unknown"}function xX(e){if(e.length===0)return"";const t=Math.min(...e),n=Math.max(...e);return t===n?String(t):`${t} – ${n}`}function Oyt(e){return e.length===0?"":`Avg: ${(e.reduce((r,a)=>r+a,0)/e.length).toFixed(2)}`}function $yt(e){return e.length===0?"":`Total: ${e.reduce((n,r)=>n+r,0)}`}function kX(e){return`${e} ${e===1?"item":"items"}`}function wX(e,t){if(e.length===0)return"";const r=new Set(e).size,a=r===1||t.endsWith("s")?t:t.endsWith("y")?t.slice(0,-1)+"ies":t+"s";return`${r} ${a.toLowerCase()}`}function Tyt(e){if(e.length===0)return"";const t=new Map;e.forEach(a=>t.set(a,(t.get(a)||0)+1));let n=0,r="";return t.forEach((a,o)=>{a>n&&(n=a,r=o)}),`${r} (${n})`}function MX(e){if(e.length===0)return"";const n=e.map(i=>i instanceof Date?i:new Date(i)).filter(i=>!isNaN(i.getTime()));if(n.length===0)return"";const r=new Date(Math.min(...n.map(i=>i.getTime()))),a=new Date(Math.max(...n.map(i=>i.getTime()))),o=i=>i.toISOString().split("T")[0];return r.getTime()===a.getTime()?o(r):`${o(r)} – ${o(a)}`}function CX(e,t,n){const r=e.columnDef;if(e.id===n||r?.meta?.renderInGroupedRows||r?.meta?.aggregation===!1)return null;if(typeof r?.meta?.aggregation=="function"){const u="accessorKey"in r?r.accessorKey:void 0;return r.meta.aggregation(t,u)}const a="accessorKey"in r?r.accessorKey:void 0,o="accessorFn"in r?r.accessorFn:void 0,i=a||o;if(!i)return null;const s=t.map(u=>typeof i=="function"?i(u.original,u.index):u.original?.[i]).filter(u=>u!=null);if(s.length===0)return null;const c=r?.meta?.aggregation;if(c&&typeof c=="string")switch(c){case"range":return xX(s);case"average":return Oyt(s);case"sum":return $yt(s);case"count":return kX(s.length);case"uniqueCount":return wX(s.map(String),r?.meta?.label||String(e.id));case"mostCommon":return Tyt(s.map(String));case"dateRange":return MX(s);default:return null}switch(Dyt(t,i)){case"number":return xX(s);case"string":return wX(s.map(String),r?.meta?.label||String(e.id));case"date":return MX(s);default:return kX(s.length)}}function SX({columns:e,rows:t,showRowBorder:n=!0,showCellBorder:r=!0,skipHeader:a=!1,enableResponsiveWrapper:o=!0}){const i=o?"h-4 w-full max-w-full":"h-4 w-[120px]",s=o?"h-4 w-full max-w-full":"h-4 w-[100px]";return l.jsxs(l.Fragment,{children:[!a&&l.jsx(rn,{showBorder:n,children:Array.from({length:e}).map((c,d)=>l.jsx(bi,{showBorder:r,className:"overflow-hidden",children:l.jsx(Mr,{className:i})},d))}),Array.from({length:t}).map((c,d)=>l.jsx(rn,{showBorder:n,children:Array.from({length:e}).map((u,h)=>l.jsx(Yn,{showBorder:r,showRowBorder:n,className:"text-body-sm overflow-hidden",children:l.jsx(Mr,{className:s})},h))},d))]})}const zyt=p.memo(function({title:t="No data",description:n="No items to display",action:r,customContent:a}){return a?l.jsx(l.Fragment,{children:a}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-[var(--space-xlg)] text-center",children:[l.jsx("p",{className:"text-body-medium-md text-[var(--color-text-primary)]",children:t}),n&&l.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)] mt-[var(--space-xsm)]",children:n}),r&&l.jsx(Oe,{variant:"primary",size:"sm",className:"mt-[var(--space-md)]",onClick:r.onClick,children:r.label})]})}),Fyt=p.memo(function({title:t="No results found",description:n="Try adjusting your search or filters",action:r,customContent:a}){return a?l.jsx(l.Fragment,{children:a}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-[var(--space-xlg)] text-center",children:[l.jsx("p",{className:"text-body-medium-md text-[var(--color-text-primary)]",children:t}),n&&l.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)] mt-[var(--space-xsm)]",children:n}),r&&l.jsx(Oe,{variant:"default",size:"sm",className:"mt-[var(--space-md)]",onClick:r.onClick,children:r.label})]})}),Vyt=p.memo(function({error:t,onRetry:n,customContent:r}){return r?l.jsx(l.Fragment,{children:r}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-[var(--space-xlg)] text-center",children:[l.jsx("p",{className:"text-body-medium-md text-[var(--color-text-primary)]",children:"Something went wrong"}),l.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)] mt-[var(--space-xsm)]",children:t?.message||"An error occurred while loading data"}),n&&l.jsx(Oe,{variant:"default",size:"sm",className:"mt-[var(--space-md)]",onClick:n,children:"Try again"})]})}),Hyt=p.memo(function(){return l.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px] overflow-hidden",children:l.jsx("div",{className:"h-full w-full bg-[var(--color-background-brand)] animate-pulse"})})}),Byt=p.memo(function({table:t,searchKey:n,searchPlaceholder:r="Search...",enableGlobalSearch:a=!1,globalSearchPlaceholder:o="Search all columns...",globalFilter:i="",onGlobalFilterChange:s,enableGlobalFaceting:c=!1,enableGrouping:d=!1,showSettingsMenu:u=!1,enableAutocomplete:h=!1,autocompleteSuggestions:m=[],autocompleteMinCharacters:y=2}){const v=t.getState().columnFilters.length>0||a&&i.length>0;return l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[a&&s&&l.jsx(l.Fragment,{children:h&&m.length>0?l.jsx(PB,{value:i,onValueChange:s,suggestions:m,placeholder:o,minCharacters:y,className:"h-8 w-[150px] lg:w-[250px]",onSelect:s}):l.jsx(Fn,{placeholder:o,value:i,onChange:g=>s(g.target.value),className:"h-8 w-[150px] lg:w-[250px]"})}),n&&!a&&l.jsx(Fn,{placeholder:r,value:t.getColumn(n)?.getFilterValue()??"",onChange:g=>t.getColumn(n)?.setFilterValue(g.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),t.getAllColumns().filter(g=>g.getCanFilter()&&g.columnDef.meta?.filterVariant).map(g=>l.jsx(Uyt,{column:g},g.id)),c&&l.jsx(qyt,{table:t}),v&&l.jsxs(Oe,{variant:"ghost",onClick:()=>{t.resetColumnFilters(),a&&s&&s("")},className:"h-8 px-2 lg:px-3",children:["Reset",l.jsx(oe,{name:"x",className:"ml-2 h-4 w-4"})]})]}),u&&l.jsx("div",{className:"flex items-center space-x-2",children:l.jsx(she,{table:t,enableGrouping:d})})]})}),qyt=p.memo(function({table:t}){const[n,r]=p.useState([]),a=t.getAllColumns().filter(s=>s.columnDef.meta?.filterOptions&&s.getCanFilter()),o=p.useMemo(()=>{const s=new Map;return a.forEach(c=>{const d=c.getFacetedUniqueValues(),u=c.columnDef.meta?.filterOptions||[],h=c.columnDef.meta?.label||c.columnDef.header;d.forEach((m,y)=>{const v=u.find(g=>g.value===y);if(v&&m>0){const g=`${h}:${y}`;s.set(g,{count:m,column:h,label:v.label})}})}),Array.from(s.entries()).map(([c,d])=>({key:c,value:c.split(":")[1],...d})).sort((c,d)=>d.count-c.count)},[a]),i=s=>{const c=n.includes(s)?n.filter(d=>d!==s):[...n,s];r(c),a.forEach(d=>{const u=d.columnDef.meta?.filterOptions||[],h=c.filter(m=>u.some(y=>y.value===m));h.length>0?d.columnDef.meta?.filterVariant==="multiselect"?d.setFilterValue(h):d.columnDef.meta?.filterVariant==="select"&&d.setFilterValue(h[0]):d.setFilterValue(void 0)})};return o.length===0?null:l.jsxs(Ur,{children:[l.jsx(sa,{asChild:!0,children:l.jsxs(Oe,{variant:"ghost",size:"sm",className:"h-8 border-dashed",children:[l.jsx(oe,{name:"filter",className:"mr-2 h-4 w-4"}),"Global Faceting",n.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mx-2 h-4 w-px bg-[var(--color-border-primary)]"}),l.jsxs(sn,{className:"rounded-sm px-1 font-normal",children:[n.length," selected"]})]})]})}),l.jsx(Sr,{className:"w-[300px] p-0",align:"start",children:l.jsxs($a,{children:[l.jsx(Ta,{placeholder:"Search values across all columns..."}),l.jsxs(qr,{children:[l.jsx(ia,{children:"No results found"}),l.jsx(nr,{children:o.map(s=>{const c=n.includes(s.value);return l.jsx(Cn,{onSelect:()=>i(s.value),children:l.jsxs("div",{className:"flex items-center justify-between flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Mi,{checked:c}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-body-sm",children:s.label}),l.jsxs("span",{className:"text-caption-sm text-[var(--color-text-secondary)]",children:["in ",s.column]})]})]}),l.jsx(sn,{className:"ml-auto text-caption-sm px-1 py-0",children:s.count})]})},s.key)})})]})]})})]})}),Uyt=p.memo(function({column:t}){const{filterVariant:n,filterOptions:r,label:a,placeholder:o}=t.columnDef.meta||{},i=t.getFilterValue(),s=t.getFacetedUniqueValues();if(n==="select"&&r)return l.jsxs(On,{value:i||"all",onValueChange:c=>t.setFilterValue(c==="all"?"":c),children:[l.jsx(An,{className:"h-8 w-[150px]",children:l.jsx(Xn,{placeholder:o||`Filter ${a}`})}),l.jsxs(Pn,{children:[l.jsxs(wt,{value:"all",children:["All ",a]}),r.map(c=>{const d=s.get(c.value)||0;return l.jsx(wt,{value:c.value,children:l.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[c.icon&&l.jsx(c.icon,{className:"h-4 w-4"}),c.label]}),d>0&&l.jsx(sn,{className:"ml-auto text-caption-sm px-1 py-0",children:d})]})},c.value)})]})]});if(n==="multiselect"&&r){const c=i||[];return l.jsxs(Ur,{children:[l.jsx(sa,{asChild:!0,children:l.jsxs(Oe,{variant:"ghost",size:"sm",className:"h-8 border-dashed",children:[l.jsx(oe,{name:"plus-circle",className:"mr-2 h-4 w-4"}),a,c.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mx-2 h-4 w-px bg-[var(--color-border-primary)]"}),l.jsx(sn,{className:"rounded-sm px-1 font-normal lg:hidden",children:c.length}),l.jsx("div",{className:"hidden space-x-1 lg:flex",children:c.length>2?l.jsxs(sn,{className:"rounded-sm px-1 font-normal",children:[c.length," selected"]}):r.filter(d=>c.includes(d.value)).map(d=>l.jsx(sn,{className:"rounded-sm px-1 font-normal",children:d.label},d.value))})]})]})}),l.jsx(Sr,{className:"w-[200px] p-0",align:"start",children:l.jsxs($a,{children:[l.jsx(Ta,{placeholder:o||`Search ${a}...`}),l.jsxs(qr,{children:[l.jsx(ia,{children:"No results found"}),l.jsx(nr,{children:r.map(d=>{const u=c.includes(d.value),h=s.get(d.value)||0;return l.jsx(Cn,{onSelect:()=>{const m=u?c.filter(y=>y!==d.value):[...c,d.value];t.setFilterValue(m.length?m:void 0)},children:l.jsxs("div",{className:"flex items-center justify-between flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Mi,{checked:u}),d.icon&&l.jsx(d.icon,{className:"h-4 w-4"}),l.jsx("span",{children:d.label})]}),h>0&&l.jsx(sn,{className:"ml-auto text-caption-sm px-1 py-0",children:h})]})},d.value)})})]})]})})]})}return n==="number"?l.jsx(Fn,{placeholder:o||`Filter ${a}...`,value:i||"",onChange:c=>t.setFilterValue(c.target.value),className:"h-8 w-[150px]",type:"number"}):l.jsx(Fn,{placeholder:o||`Filter ${a}...`,value:i||"",onChange:c=>t.setFilterValue(c.target.value),className:"h-8 w-[150px]"})}),Wyt=p.memo(function({header:t,enableColumnOrdering:n,children:r}){const{attributes:a,listeners:o,setNodeRef:i,transform:s,transition:c,isDragging:d}=Ayt({id:t.id,disabled:!n}),u={transform:a2.Translate.toString(s),transition:c,opacity:d?.5:1};return n?l.jsxs("div",{ref:i,style:u,className:j("relative flex items-center",d&&"z-50"),children:[l.jsx("div",{className:"flex-1",children:r}),n&&l.jsx("div",{className:"ml-2 p-1 !cursor-grab active:!cursor-grabbing hover:bg-[var(--color-background-neutral-subtlest-hovered)] rounded-sm transition-colors",...a,...o,children:l.jsx(oe,{name:"grip-vertical",className:"h-3 w-3 text-[var(--color-text-tertiary)]"})})]}):l.jsx(l.Fragment,{children:r})}),she=p.memo(function({table:t,enableGrouping:n=!1}){const r=t.getAllColumns().filter(b=>b.getCanSort()).map(b=>({id:b.id,label:b.columnDef.meta?.label||b.columnDef.header||b.id})),a=t.getAllColumns().filter(b=>b.getCanGroup?.()||b.columnDef.enableGrouping).map(b=>({id:b.id,label:b.columnDef.meta?.label||b.columnDef.header||b.id})),o=t.getAllColumns().filter(b=>typeof b.accessorFn<"u"&&b.getCanHide()).map(b=>({id:b.id,label:b.columnDef.meta?.label||b.columnDef.header||b.id})),i=o.filter(b=>t.getColumn(b.id)?.getIsVisible()).map(b=>b.id),s=t.getState().sorting[0],c=s?.id,d=s?.desc?"desc":"asc",h=t.getState().grouping[0]||"",m=b=>{t.setSorting([{id:b,desc:d==="desc"}])},y=b=>{s&&t.setSorting([{id:s.id,desc:b==="desc"}])},v=b=>{!b||b==="none"?t.setGrouping([]):t.setGrouping([b])},g=(b,x)=>{t.getColumn(b)?.toggleVisibility(x)};return l.jsx(ihe,{sortableColumns:r,selectedSortColumn:c,sortDirection:d,onSortChange:m,onSortDirectionChange:y,groupableColumns:n?a:[],selectedGroupColumn:h,onGroupChange:v,columns:o,visibleColumns:i,onColumnVisibilityChange:g})});p.memo(function({column:t,title:n,className:r}){const a=t.columnDef.meta?.align||"left",o=t.columnDef.meta?.truncate!==!1,i=t.getIsSorted();return t.getCanSort()?l.jsxs("div",{className:j("flex items-center gap-1",a==="right"&&"justify-end",i&&"!text-[var(--color-text-brand-bold)]",r),children:[i&&l.jsx(oe,{name:i==="desc"?"arrow-down-wide-narrow":"arrow-down-narrow-wide",className:"h-4 w-4 !text-[var(--color-icon-brand-bold)]"}),o?l.jsx(Ru,{align:a,children:l.jsx("span",{children:n})}):l.jsx("span",{children:n})]}):o?l.jsx(Ru,{align:a,children:l.jsx("div",{className:j(a==="right"?"text-right":"text-left",r),children:n})}):l.jsx("div",{className:j(a==="right"?"text-right":"text-left",r),children:n})});const Gyt=p.memo(function({table:t,enableGrouping:n=!1,hideChildrenForSingleItemGroups:r={},footerLabel:a,onNextPageHover:o,onPreviousPageHover:i,paginationVariant:s="full",pageSizeOptions:c=[10,25,50,100]}){const d=t.getState().pagination.pageIndex+1,u=t.getState().pagination.pageSize,h=n?t.getPrePaginationRowModel().rows.filter(g=>g.depth===0).length:t.getFilteredRowModel().rows.length,m=t.getFilteredSelectedRowModel().rows.length,y=g=>{t.setPageIndex(g-1)},v=g=>{t.setPageSize(g)};return l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("div",{className:"flex-1 text-body-sm text-[var(--color-text-secondary)]",children:a?l.jsxs("div",{className:"flex items-center gap-[var(--space-md)]",children:[a,m>0&&l.jsxs("span",{children:["· ",m," of ",h," row(s) selected"]})]}):m>0&&l.jsxs("span",{children:[m," of ",h," row(s) selected."]})}),l.jsx(rq,{variant:s,currentPage:d,totalItems:h,pageSize:u,onPageChange:y,onPageSizeChange:v,pageSizeOptions:c,onNextPageHover:o,onPreviousPageHover:i})]})}),Kyt=p.memo(function({onLoadMore:t,isLoading:n}){const r=p.useRef(null);return p.useEffect(()=>{const a=r.current;if(!a||n)return;const o=new IntersectionObserver(i=>{i[0].isIntersecting&&t()},{threshold:.1});return o.observe(a),()=>o.disconnect()},[t,n]),l.jsx("div",{ref:r,className:"flex justify-center py-[var(--space-md)] border-t border-[var(--color-border-primary-subtle)]",children:n&&l.jsx(fo,{size:"sm"})})});function Zyt(e){let t=0;const n=(r,a)=>{r.forEach(o=>{o.depth>t&&(t=o.depth),o.subRows&&o.subRows.length>0&&n(o.subRows)})};return n(e),t}function _X(e,t){const{enableGrouping:n,enableExpanding:r,nestedRowStyling:a,expandingRowColors:o,maxDepth:i}=t,s=e.depth,c=e.getIsGrouped?.(),d=e.getIsExpanded(),u=e.subRows&&e.subRows.length>0,h=u?d?"expanded":"collapsed":"leaf",m=()=>{let y=e;for(;y;){if(y.getIsExpanded())return!0;y=y.getParentRow?.()}return!1};if(a?.colors&&a.colors[s]!==void 0){const y=a.colors[s];if(typeof y=="string")return y;if(typeof y=="object"){if(h==="expanded"&&y.expanded)return y.expanded;if(h==="collapsed"&&y.collapsed)return y.collapsed;if(h==="leaf"&&y.leaf)return y.leaf;if(y.default)return y.default}}if(r&&!c&&o){const y=i-s;if(y===0&&o.children)return o.children;if(y>0){if(d&&o.expandedParent)return o.expandedParent;if(!d&&o.collapsedParent)return o.collapsedParent}}return c?d?"var(--blue-50)":"var(--color-background-neutral-subtlest)":n&&s===1?"var(--blue-25)":r&&!c?s===0&&(!u||!m())?"":(i-s)%2===0?"var(--blue-25)":"var(--blue-50)":""}function Yyt(e,t){if(t){if(t.heights&&t.heights[e]!==void 0)return t.heights[e];if(t.defaultHeight)return t.defaultHeight}}function NX(e,t,n,r,a,o){const i=e.groupingColumnId,s=a[i]??!1,c=o[i]??!1,u=s&&c&&e.subRows.length<=1?null:e.subRows.length>1?l.jsx("button",{tabIndex:-1,onClick:e.getToggleExpandedHandler(),className:"flex h-[var(--size-sm)] w-[var(--size-sm)] cursor-pointer items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",children:l.jsx(oe,{name:r?"chevron-down":"chevron-right",className:"h-3 w-3"})}):l.jsx("div",{className:"h-[var(--size-sm)] w-[var(--size-sm)]"}),h=e.subRows.length>1?l.jsx(sn,{appearance:"subtle",size:"sm",truncate:!1,children:e.subRows.length}):null;if(n){const m=t.getAllColumns().find(y=>y.id===n);if(m){const y=m.columnDef;if(y.aggregatedCell){const v=e.getAllCells().find(g=>g.column.id===n);return l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)] font-medium text-[var(--color-text-primary)]",children:[u,l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[v?Yo(y.aggregatedCell,v.getContext()):null,h]})]})}else{const v=e.subRows[0]?.original?.[n];return l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)] font-medium text-[var(--color-text-primary)]",children:[u,l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[l.jsx("span",{className:"font-medium",children:String(v)}),h]})]})}}}return l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)] font-medium text-[var(--color-text-primary)]",children:[u,l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[l.jsx("span",{className:"font-medium",children:String(e.getGroupingValue(e.groupingColumnId))}),h]})]})}function Xyt({columns:e,data:t,searchKey:n,searchPlaceholder:r,title:a,caption:o,className:i,stickyHeader:s=!1,stickyFirstColumn:c=!1,stickyLeftColumns:d=0,stickyRightColumns:u=0,enableResponsiveWrapper:h=!0,showScrollIndicators:m=!1,minTableWidth:y="900px",isLoading:v=!1,loadingBehavior:g="replace",loadingRowCount:b=10,borderStyle:x="both",defaultVerticalAlign:k="middle",enableGlobalSearch:M=!1,globalSearchPlaceholder:C="Search all columns...",enableAutocomplete:S=!1,globalSearchColumns:_,autocompleteMinCharacters:N=2,enableGlobalFaceting:I=!1,enableColumnResizing:A=!1,columnResizeMode:T="onChange",enableColumnResizePersistence:P=!1,enablePaginationPersistence:F=!1,storageKey:U="data-table-columns",enableExpanding:W=!1,getSubRows:Z,expandingRowColors:L,nestedRowStyling:R,enableGrouping:E=!1,groupedColumnMode:O=!1,enableManualGrouping:J=!1,groupDisplayColumn:K,hideChildrenForSingleItemGroups:B={},hideExpanderForSingleItemGroups:$={},enableRowPinning:G=!1,keepPinnedRows:z=!0,enableVirtualization:H=!1,nestedHeaders:D=[],enableNestedHeaders:Y=!1,enableColumnOrdering:V=!1,enableRowSelection:Q=!1,showHeader:ae=!0,showPagination:X=!0,paginationVariant:ye="full",pageSizeOptions:ie=[10,25,50,100],footerLabel:Ee,onTableReady:Pe,initialState:Fe,sorting:Ge,onSortingChange:dt,columnVisibility:mt,onColumnVisibilityChange:Ft,grouping:Xe,onGroupingChange:ne,columnOrder:Se,onColumnOrderChange:Ae,columnSizing:Ke,onColumnSizingChange:tt,pagination:bt,onPaginationChange:Zt,expanded:yt,onExpandedChange:jt,renderSectionHeaderRow:Vt,renderSubComponent:Lt,getRowCanExpand:cr,autoExpandChildren:lr=!1,onRowClick:$t,isRowClickable:In,clickableRowClassName:dr,groupPreservingSearch:le=!1,activeRowId:xe,activeRowClassName:me,getRowId:ue,onActiveRowChange:Le,onRowSelectionChange:ce,onNextPageHover:Re,onPreviousPageHover:Ve,onRowUpdate:He,onLoadMore:ot,hasMoreData:qe,isLoadingMore:ze,error:Ht,onRetry:gt,errorComponent:At,emptyState:fa,emptyStateTitle:Rn="No data",emptyStateDescription:Kr="No items to display",emptyStateAction:Ti,noResultsState:z1,noResultsTitle:Xhe="No results found",noResultsDescription:Jhe="Try adjusting your search or filters",noResultsAction:Qhe,isRefetching:epe=!1,manualSorting:Iq=!1,manualFiltering:jq=!1,manualPagination:o0=!1,rowCount:tpe,manualExpanding:Lq=!1,onLoadChildren:i0,expandingRowsLoading:s0,subComponentLoading:c0,onSubComponentLoad:su,expandingRowsError:Vgt,subComponentError:Aq,onExpandError:F1}){const l0=h||!!(d&&d>0)||!!(u&&u>0),[npe,rpe]=p.useState([]),[ape,ope]=p.useState({}),[ipe,spe]=p.useState(Fe?.grouping||[]),[cpe,lpe]=p.useState(()=>{const q=e.map(ee=>ee.id||ee.accessorKey||`column-${Math.random()}`);return Q?["select",...q]:q}),[dpe,upe]=p.useState(Ke||Fe?.columnSizing||{}),[hpe,ppe]=p.useState(()=>{if(F&&U){const q=localStorage.getItem(`${U}-pagination`);if(q)try{const ee=JSON.parse(q);if(typeof ee.pageIndex=="number"&&typeof ee.pageSize=="number")return ee}catch(ee){console.warn("Failed to parse saved pagination:",ee)}}return Fe?.pagination||{pageIndex:0,pageSize:10}}),[Pq,fpe]=p.useState([]),[cu,mpe]=p.useState({}),[QD,Eq]=p.useState(""),[ype,gpe]=p.useState(Fe?.expanded||{}),[vpe,bpe]=p.useState(Fe?.rowPinning||{top:[],bottom:[]}),[xpe,d0]=p.useState(""),[Ir,eO]=p.useState([-1,0]),tO=p.useRef(null),V1=p.useRef(new Map),H1=p.useRef(new Map);p.useEffect(()=>()=>{V1.current.forEach(q=>q.abort()),H1.current.forEach(q=>q.abort())},[]),p.useEffect(()=>{ce&&ce(cu)},[cu,ce]),p.useEffect(()=>{Le?.(xe)},[xe,Le]);const Rq=Ge!==void 0,Dq=mt!==void 0,Oq=Xe!==void 0,$q=Se!==void 0,Tq=Ke!==void 0,zq=bt!==void 0,nO=yt!==void 0,Fo=Rq?Ge:npe,kpe=Dq?mt:ape,Vo=Oq?Xe:ipe,B1=$q?Se:cpe,u0=Tq?Ke:dpe,ma=zq?bt:hpe,jr=nO?yt:ype,wpe=Rq?dt:rpe,Mpe=Dq?Ft:ope,Cpe=Oq?ne:spe,Fq=$q?Ae:lpe,Vq=Tq?tt:upe,Spe=zq?Zt:ppe,rO=p.useCallback(q=>{if(nO&&jt){if(typeof q=="object"&&q!==null&&!(q instanceof Function)&&Object.keys(q).length===0&&(yt===!0||typeof yt=="object"&&yt!==null&&Object.keys(yt).length>0))return;jt(q)}else gpe(q)},[nO,jt,yt]),_pe=p.useMemo(()=>b!==void 0&&b!==10?b:ma.pageSize,[b,ma.pageSize]),pn=Eyt(QD,300),Npe=p.useMemo(()=>{if(!S||!M)return[];const q=new Set;return t.forEach(ee=>{_&&_.length>0?_.forEach(re=>{const pe=ee[re];pe!=null&&String(pe).trim()!==""&&q.add(String(pe))}):Object.values(ee).forEach(re=>{re!=null&&String(re).trim()!==""&&q.add(String(re))})}),Array.from(q).sort()},[t,_,S,M]),Hq=p.useCallback((q,ee,re)=>{if(!q||!ee||ee.length===0)return()=>!0;const pe=q.toLowerCase(),ge=new Set;return re.forEach(ve=>{let $e=!1;for(const ut in ve){const _t=ve[ut];if(_t!=null&&String(_t).toLowerCase().includes(pe)){$e=!0;break}}$e&&ee.forEach(ut=>{const _t=ve[ut];_t!=null&&ge.add(String(_t))})}),ve=>{for(const $e of ee){const ut=ve.getValue($e);if(ut!=null&&ge.has(String(ut)))return!0}return!1}},[]);p.useEffect(()=>{if(P&&U){const q=localStorage.getItem(`${U}-sizing`);if(q)try{Vq(JSON.parse(q))}catch(ee){console.warn("Failed to parse saved column sizing:",ee)}}},[P,U]),p.useEffect(()=>{P&&U&&Object.keys(u0).length>0&&localStorage.setItem(`${U}-sizing`,JSON.stringify(u0))},[u0,P,U]),p.useEffect(()=>{F&&U&&localStorage.setItem(`${U}-pagination`,JSON.stringify(ma))},[ma,F,U]);const Ze=p.useMemo(()=>{switch(x){case"horizontal":return{showRowBorder:!0,showCellBorder:!1};case"vertical":return{showRowBorder:!1,showCellBorder:!0};case"both":return{showRowBorder:!0,showCellBorder:!0};case"none":return{showRowBorder:!1,showCellBorder:!1};default:return{showRowBorder:!0,showCellBorder:!0}}},[x]),aO=p.useCallback((q,ee)=>{if(!$t)return;const re=ee.target;if(!(re.tagName==="BUTTON"||re.tagName==="A"||re.tagName==="INPUT"||re.closest("button")||re.closest("a")||re.closest("input"))&&!(In&&!In(q))){if(!In&&q.getIsGrouped()){const ge=q.groupingColumnId;if(!((B[ge]??!1)&&q.subRows&&q.subRows.length===1))return}$t(q,ee)}},[$t,In,B]),zi=p.useCallback(q=>{if(!$t)return!1;if(In)return In(q);if(!q.getIsGrouped())return!0;const re=q.groupingColumnId;return(B[re]??!1)&&q.subRows&&q.subRows.length===1},[$t,In,B]),Bq=q=>q?"![box-shadow:inset_3px_0_0_0_var(--color-border-brand-bold),inset_0_-1px_0_0_var(--color-border-primary-medium)]":"![box-shadow:inset_3px_0_0_0_var(--color-border-brand-bold)]",h0=p.useCallback(q=>{if(!xe)return!1;const ee=ue?q.id:q.original?.id!==void 0?q.original.id:q.id;return String(ee)===String(xe)},[xe,ue]),q1=p.useMemo(()=>c?1:d||0,[c,d]),Fi=p.useMemo(()=>u||0,[u]),qq=p.useMemo(()=>{const q=new Set;return e.forEach(ee=>{if(ee.cell){const re=ee.id||ee.accessorKey;re&&q.add(String(re))}}),q},[e]),oO=p.useMemo(()=>{const q=e.map(ee=>{let re={...ee,...A&&!ee.minSize?{minSize:80}:{}};return ee.enableGrouping||ee.meta?.enableGrouping?{...re,enableGrouping:!0,getGroupingValue:pe=>{const ge=ee.accessorKey||ee.accessorFn;return typeof ge=="string"&&pe.original?pe.original[ge]:typeof ge=="function"&&pe.original?ge(pe.original):pe.getValue?.(ee.id)||pe[ge]||""}}:re});return Q?[{id:"select",size:48,minSize:48,maxSize:48,enableResizing:!1,header:({table:re})=>l.jsx(Mi,{tabIndex:-1,checked:re.getIsAllPageRowsSelected()||re.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:pe=>re.toggleAllPageRowsSelected(!!pe),"aria-label":"Select all"}),cell:({row:re})=>l.jsx(Mi,{tabIndex:-1,checked:re.getIsSelected(),onCheckedChange:pe=>re.toggleSelected(!!pe),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,enableGrouping:!1,meta:{label:"Select"}},...q]:q},[e,Q]),iO=p.useMemo(()=>t,[t]),Ipe=p.useMemo(()=>!le||!pn?bX:Hq(pn,Vo,iO),[le,pn,Vo,iO,Hq]),De=Kft({data:iO,columns:oO,getRowId:ue,filterFns:{fuzzy:bX,multiSelect:Ryt},state:{sorting:Fo,columnFilters:Pq,columnVisibility:kpe,rowSelection:cu,globalFilter:pn,columnSizing:u0,expanded:jr,grouping:Vo,rowPinning:vpe,columnOrder:B1,pagination:ma},manualSorting:Iq,manualFiltering:jq,manualPagination:o0,rowCount:tpe,enableRowSelection:Q,enableColumnPinning:!1,enableGlobalFilter:M,globalFilterFn:Ipe,enableColumnResizing:A,columnResizeMode:T,enableExpanding:W,getSubRows:Z,getRowCanExpand:cr,paginateExpandedRows:!1,autoResetPageIndex:!1,enableGrouping:E,groupedColumnMode:O,manualGrouping:J,enableRowPinning:G,keepPinnedRows:z,onRowSelectionChange:mpe,onSortingChange:wpe,onColumnFiltersChange:fpe,onColumnVisibilityChange:Mpe,onGlobalFilterChange:Eq,onColumnSizingChange:Vq,onExpandedChange:rO,onGroupingChange:Cpe,onRowPinningChange:bpe,onColumnOrderChange:Fq,onPaginationChange:Spe,getCoreRowModel:Eft(),getFilteredRowModel:jq?void 0:Fft(),getPaginationRowModel:o0||H?void 0:Bft(),getSortedRowModel:Iq?void 0:qft(),getExpandedRowModel:W?Rft():void 0,getGroupedRowModel:E?Vft():void 0,getFacetedRowModel:Tft(),getFacetedUniqueValues:zft(),getFacetedMinMaxValues:Dft()}),p0=p.useMemo(()=>Zyt(De.getRowModel().rows),[De.getRowModel().rows]),f0=p.useMemo(()=>{if(!E)return null;const q=new Map;return De.getGroupedRowModel?.()?.rows?.forEach(re=>{re.subRows&&re.subRows.length>0&&q.set(re.id,re.subRows)}),q},[E,De]),{flatVisibleRows:m0,rowIdToFlatIndex:Uq}=p.useMemo(()=>{const q=[],ee=new Map,re=ge=>{const ve=q.length;q.push(ge),ee.set(ge.id,ve),ge.getIsExpanded()&&(ge.subRows&&ge.subRows.length>0?ge.subRows:f0?.get(ge.id)||[]).forEach(re)};return De.getRowModel().rows.filter(ge=>Lt||ge.depth===0).forEach(re),{flatVisibleRows:q,rowIdToFlatIndex:ee}},[De,jr,f0,Lt]),Wq=p.useRef(void 0);p.useEffect(()=>{if(!E)return;const ee=De.getPrePaginationRowModel().rows.filter(ge=>ge.depth===0).length,re=ma.pageSize,pe=Math.max(1,Math.ceil(ee/re));Wq.current!==pe&&(Wq.current=pe,De.setPageCount(pe))},[E,ma.pageSize,Vo.join(","),De.getPrePaginationRowModel().rows.length]);const Gq=p.useRef({});p.useEffect(()=>{if(!lr)return;const q=De.getState().expanded,ee=Gq.current,re={...q};let pe=!1;De.getRowModel().rows.forEach(ge=>{const ve=ge.id,$e=q[ve]===!0,ut=ee[ve]===!0;$e&&!ut&&ge.subRows&&ge.subRows.length>0&&ge.subRows.forEach(_t=>{q[_t.id]!==!0&&(re[_t.id]=!0,pe=!0)})}),Gq.current=q,pe&&rO(re)},[jr,lr]);const Kq=p.useRef({});p.useEffect(()=>{if(!i0&&!su)return;const q=De.getState().expanded,ee=Kq.current;Object.keys(ee).forEach(re=>{const pe=ee[re],ge=q[re];if(pe&&!ge){const ve=V1.current.get(re);ve&&(ve.abort(),V1.current.delete(re));const $e=H1.current.get(re);$e&&($e.abort(),H1.current.delete(re))}}),Object.keys(q).forEach(re=>{const pe=q[re],ge=ee[re];if(pe&&!ge){const ve=De.getRow(re);if(!ve)return;if(i0&&Lq){const $e=ve.getIsGrouped()||ve.subRows&&ve.subRows.length===0&&ve.getCanExpand(),ut=s0?.[re]===!0,_t=ve.subRows&&ve.subRows.length>0;if($e&&!ut&&!_t){const se=new AbortController;V1.current.set(re,se),Promise.resolve(i0(ve)).catch(xt=>{xt?.name!=="AbortError"&&F1&&F1(ve,xt,"children")}).finally(()=>{V1.current.delete(re)})}}if(su&&Lt&&!ve.getIsGrouped()&&ve.depth===0&&!(c0?.[re]===!0)){const ut=new AbortController;H1.current.set(re,ut),Promise.resolve(su(ve)).catch(_t=>{_t?.name!=="AbortError"&&F1&&F1(ve,_t,"subComponent")}).finally(()=>{H1.current.delete(re)})}}}),Kq.current=q},[jr,i0,su,Lq,Lt,s0,c0,F1]),p.useEffect(()=>{if(!le||!pn||!E)return;const q={};De.getFilteredRowModel().rows.forEach(re=>{re.getIsGrouped()&&re.subRows&&re.subRows.length>0&&(q[re.id]=!0)}),rO(re=>{const pe=Object.keys(re).sort().join(","),ge=Object.keys(q).sort().join(",");return pe===ge?re:q})},[pn,le,E]);const Zq=p.useRef(Vo),Yq=p.useRef(Fo);p.useEffect(()=>{if(!o0)return;const q=JSON.stringify(Vo)!==JSON.stringify(Zq.current),ee=JSON.stringify(Fo)!==JSON.stringify(Yq.current);(q||ee)&&De.setPageIndex(0),Zq.current=Vo,Yq.current=Fo},[Vo,Fo,o0,De]),p.useEffect(()=>{Pe&&Pe(De)},[De,Pe]),p.useEffect(()=>{if(Fo.length>0){const q=Fo[0],ee=e.find(ge=>ge.id===q.id||ge.accessorKey===q.id),re=ee?.meta?.label||ee?.header||q.id,pe=q.desc?"descending":"ascending";d0(`Table sorted by ${re}, ${pe}`)}},[Fo,e]),p.useEffect(()=>{if(pn){const q=De.getFilteredRowModel().rows.length;d0(`${q} result${q!==1?"s":""} found for "${pn}"`)}},[pn,De]),p.useEffect(()=>{const q=Object.keys(cu).filter(ee=>cu[ee]).length;q>0&&d0(`${q} row${q!==1?"s":""} selected`)},[cu]),p.useEffect(()=>{const[q,ee]=Ir,re=m0.length,pe=De.getVisibleLeafColumns();let ge=q,ve=ee;q>=0&&q>=re&&(ge=Math.max(re-1,-1)),ee>=pe.length&&(ve=Math.max(pe.length-1,0)),(ge!==q||ve!==ee)&&eO([ge,ve])},[t.length,De,Ir,m0.length]),p.useEffect(()=>{const q=De.getPageCount();q>1&&d0(`Page ${ma.pageIndex+1} of ${q}`)},[ma.pageIndex,De]);const U1=p.useCallback((q,ee)=>{if(!ee||!q)return q;const re=q.toLowerCase(),pe=ee.toLowerCase(),ge=[];let ve=0,$e=re.indexOf(pe);for(;$e!==-1;)$e>ve&&ge.push(q.substring(ve,$e)),ge.push(l.jsx("span",{style:{backgroundColor:"#fef3c7",fontWeight:600,padding:"2px 0"},children:q.substring($e,$e+ee.length)},`highlight-${ve}-${$e}`)),ve=$e+ee.length,$e=re.indexOf(pe,ve);return ve<q.length&&ge.push(q.substring(ve)),l.jsx(l.Fragment,{children:ge})},[]),Ho=p.useCallback(q=>{if(q==null)return"";if(typeof q=="string"||typeof q=="number")return String(q);if(Array.isArray(q))return q.map(Ho).join("");if(p.isValidElement(q)){const ee=q;if(typeof ee.type=="function")try{if(ee.type.prototype?.isReactComponent)return Ho(ee.props.children);const pe=ee.type(ee.props);return Ho(pe)}catch{return Ho(ee.props.children)}return Ho(ee.props.children)}return""},[]),y0=p.useCallback((q,ee)=>ee?Ho(q).toLowerCase().includes(ee.toLowerCase()):!1,[Ho]),Ya=p.useCallback((q,ee)=>{if(!ee||q==null)return q;if(typeof q=="string")return U1(q,ee);if(typeof q=="number")return U1(String(q),ee);if(Array.isArray(q))return q.map((re,pe)=>l.jsx(p.Fragment,{children:Ya(re,ee)},pe));if(p.isValidElement(q)){const re=q;if(typeof re.type=="function")try{if(re.type.prototype?.isReactComponent){const ut=re.props.children;return p.cloneElement(re,{},Ya(ut,ee))}const $e=re.type(re.props);return Ya($e,ee)}catch{const{children:$e,...ut}=re.props;return $e==null?re:p.cloneElement(re,ut,Ya($e,ee))}if(re.props.children===void 0||re.props.children===null)return re;const{children:pe,...ge}=re.props;return p.cloneElement(re,ge,Ya(pe,ee))}return q},[U1]),lu=p.useCallback(q=>{if(!M||!pn)return Yo(q.column.columnDef.cell,q.getContext());if(qq.has(q.column.id)){const pe=Yo(q.column.columnDef.cell,q.getContext());return pe==null||!y0(pe,pn)?pe:Ya(pe,pn)}const re=q.getValue();if(typeof re=="string"||typeof re=="number"){const pe=String(re);return U1(pe,pn)}return Yo(q.column.columnDef.cell,q.getContext())},[M,pn,U1,qq,y0,Ya]),Xq=p.useCallback(q=>{if(!M||!pn)return Yo(q.column.columnDef.aggregatedCell,q.getContext());const ee=Yo(q.column.columnDef.aggregatedCell,q.getContext());return ee==null||!y0(ee,pn)?ee:Ya(ee,pn)},[M,pn,y0,Ya,Ho]),jpe=p.useRef(null),Lpe=lmt(iX(Y1e,{activationConstraint:{distance:8}}),iX(X1e,{activationConstraint:{delay:200,tolerance:8}})),[,Jq]=p.useState(null),Ape=q=>{V&&Jq(q.active.id)},Ppe=q=>{if(!V)return;const{active:ee,over:re}=q;if(Jq(null),ee.id!==re?.id&&re?.id){const pe=B1.findIndex(ve=>ve===ee.id),ge=B1.findIndex(ve=>ve===re?.id);if(pe!==-1&&ge!==-1){const ve=fq(B1,pe,ge);console.log("Column reorder:",{activeId:ee.id,overId:re.id,oldIndex:pe,newIndex:ge,oldOrder:B1,newOrder:ve}),Fq(ve)}}},Epe=p.useCallback(q=>{const[ee,re]=Ir,pe=De.getVisibleLeafColumns(),ge=m0,ve=pe.length,$e=ge.length,ut=-1,_t=$e-1;let se=ee,xt=re,Bt=!1;switch(q.key){case"ArrowRight":re<ve-1&&(xt=re+1,Bt=!0);break;case"ArrowLeft":re>0&&(xt=re-1,Bt=!0);break;case"ArrowDown":ee<_t&&(se=ee+1,Bt=!0);break;case"ArrowUp":ee>ut&&(se=ee-1,Bt=!0);break;case"Home":(q.ctrlKey||q.metaKey)&&(se=ut),xt=0,Bt=!0;break;case"End":(q.ctrlKey||q.metaKey)&&(se=_t),xt=ve-1,Bt=!0;break;case"PageDown":se=Math.min(ee+10,_t),Bt=!0;break;case"PageUp":se=Math.max(ee-10,ut),Bt=!0;break;case"Enter":case" ":if(ee===-1){const he=pe[re];he?.id==="select"&&Q&&q.key===" "?(De.toggleAllPageRowsSelected(),Bt=!0):he?.getCanSort()&&(he.toggleSorting(),Bt=!0)}else{const he=ge[ee];he&&((W||E)&&he.getCanExpand()?(he.toggleExpanded(),Bt=!0):Q&&q.key===" "&&(he.toggleSelected(),Bt=!0),!Bt&&q.key==="Enter"&&$t&&zi(he)&&(aO(he,q),Bt=!0))}break;case"Escape":document.activeElement instanceof HTMLElement&&document.activeElement.blur(),Bt=!0;break}if(Bt&&(q.preventDefault(),q.stopPropagation(),se!==ee||xt!==re)){eO([se,xt]);const he=se===-1?`[data-header-col="${xt}"]`:`[data-row="${se}"][data-col="${xt}"]`,nt=tO.current?.querySelector(he);nt&&nt.focus()}},[Ir,De,m0,W,E,Q]),Rpe=p.useCallback(q=>{tO.current?.contains(q.relatedTarget)||eO([-1,0])},[]),W1=p.useMemo(()=>{const q=De.getVisibleFlatColumns(),ee=new Map;let re=0;q.forEach((ge,ve)=>{const $e=ve<q1,ut=ve>=q.length-Fi,_t=$e&&ve===q1-1,se=ut&&ve===q.length-Fi;ee.set(ge.id,{isLeftSticky:$e,isRightSticky:ut,leftPosition:re,rightPosition:0,isRightmostLeftSticky:_t,isLeftmostRightSticky:se,columnIndex:ve}),re+=ge.getSize()});let pe=0;for(let ge=q.length-1;ge>=0;ge--){const ve=q[ge],$e=ee.get(ve.id);$e&&($e.rightPosition=pe),pe+=ve.getSize()}return{data:ee,allColumns:q}},[De.getVisibleFlatColumns(),q1,Fi]),G1=(q,ee=!1,re=!0)=>{if(!q||typeof q.getSize!="function")return{};const pe=W1.data.get(q.id);if(!pe||!pe.isLeftSticky&&!pe.isRightSticky)return{};const{isLeftSticky:ge,isRightSticky:ve,leftPosition:$e,rightPosition:ut,isRightmostLeftSticky:_t,isLeftmostRightSticky:se}=pe;if(ge){const xt={position:"sticky",left:`${$e}px`,...ee&&{backgroundColor:"var(--grey-25)"},width:`${q.getSize()}px`,minWidth:`${q.getSize()}px`,maxWidth:`${q.getSize()}px`};return _t&&ee?{...xt,backgroundImage:"linear-gradient(to right, var(--grey-25) calc(100% - 3px), var(--color-border-primary-medium) calc(100% - 3px), var(--color-border-primary-medium) 100%)",backgroundColor:"transparent"}:xt}if(ve){const xt={position:"sticky",right:`${ut}px`,...ee&&{backgroundColor:"var(--grey-25)"},width:`${q.getSize()}px`,minWidth:`${q.getSize()}px`,maxWidth:`${q.getSize()}px`};return se&&ee?{...xt,backgroundImage:"linear-gradient(to right, var(--color-border-primary-medium) 0, var(--color-border-primary-medium) 3px, var(--grey-25) 3px)",backgroundColor:"transparent"}:xt}return{}},Dpe=q=>{if(!q||typeof q.getSize!="function")return"";const ee=W1.data.get(q.id);return ee?ee.isRightmostLeftSticky?"border-r-[3px] border-[var(--color-border-primary-medium)]":ee.isLeftmostRightSticky?"border-l-[3px] border-[var(--color-border-primary-medium)]":"":""},sO=q=>{if(!q||typeof q.getSize!="function")return!1;const ee=W1.data.get(q.id);return ee?ee.isRightmostLeftSticky||ee.isLeftmostRightSticky:!1},cO=q=>{if(!q||typeof q.getSize!="function"||Fi===0)return!1;const ee=W1.data.get(q.id);return ee?ee.columnIndex===W1.allColumns.length-Fi-1:!1},Qq=(q,ee=!1)=>!A||!q.getCanResize()||!!Ze.showCellBorder?"":j(!ee&&["after:content-[''] after:absolute after:right-px after:top-1/2 after:-translate-y-1/2","after:w-[2px] after:h-[24px] after:rounded-[2px]","after:bg-[var(--color-border-primary-medium)]","after:opacity-0 hover:after:opacity-100","after:transition-opacity after:pointer-events-none after:z-10"],"before:content-[''] before:absolute before:left-[-3px] before:top-1/2 before:-translate-y-1/2","before:w-[2px] before:h-[24px] before:rounded-[2px]","before:bg-[var(--color-border-primary-medium)]","before:opacity-0 hover:before:opacity-100","before:transition-opacity before:pointer-events-none before:z-10");return l.jsx(L1,{children:l.jsx(uyt,{sensors:Lpe,collisionDetection:fmt,onDragStart:Ape,onDragEnd:Ppe,children:l.jsxs("div",{className:j("border border-[var(--color-border-primary-medium)] bg-[var(--color-surface-primary)] overflow-hidden rounded-lg",!X&&"border-b-0",i),children:[ae&&(a||M)&&l.jsxs("div",{className:"border-b border-[var(--color-border-primary-medium)] bg-[var(--color-surface-primary)] px-[var(--space-lg)] py-[var(--space-md)]",children:[a&&l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("h3",{className:"text-heading-sm font-semibold text-[var(--color-text-primary)]",children:a}),l.jsx(she,{table:De,enableGrouping:E})]}),l.jsx(Byt,{table:De,searchKey:n,searchPlaceholder:r,showSettingsMenu:!1,enableGlobalSearch:M,globalSearchPlaceholder:C,globalFilter:QD,onGlobalFilterChange:Eq,enableGlobalFaceting:I,enableGrouping:E,enableAutocomplete:S,autocompleteSuggestions:Npe,autocompleteMinCharacters:N})]}),l.jsxs("div",{ref:tO,onKeyDown:Epe,onFocus:Rpe,className:j("relative",l0&&["overflow-x-auto","scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[var(--color-border-primary-subtle)]","hover:scrollbar-thumb-[var(--color-border-primary)]","max-sm:scrollbar-none"]),children:[m&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute top-0 left-0 bottom-0 w-8 bg-gradient-to-r from-[var(--color-surface-primary)] to-transparent z-10 pointer-events-none opacity-0 transition-opacity"}),l.jsx("div",{className:"absolute top-0 right-0 bottom-0 w-8 bg-gradient-to-l from-[var(--color-surface-primary)] to-transparent z-10 pointer-events-none opacity-0 transition-opacity"})]}),l.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:xpe}),l.jsxs(FD,{ref:jpe,role:"grid","aria-label":o||a,"aria-rowcount":t.length,"aria-colcount":De.getVisibleLeafColumns().length,className:j("border-separate border-spacing-0",A&&"table-fixed"),style:{...l0&&{minWidth:y}},children:[l.jsx("colgroup",{children:De.getVisibleLeafColumns().map(q=>l.jsx("col",{style:{width:q.id==="select"?"48px":void 0}},q.id))}),l.jsx(VD,{className:j(s&&["sticky top-0 z-20","after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-[var(--color-border-primary-medium)]"],X&&"[&_tr:last-child]:border-b-0"),children:v?l.jsx(SX,{columns:De.getVisibleLeafColumns().length,rows:0,showRowBorder:Ze.showRowBorder,showCellBorder:Ze.showCellBorder,enableResponsiveWrapper:l0}):Y&&D&&D.length>0?l.jsxs(l.Fragment,{children:[l.jsx(rn,{showBorder:Ze.showRowBorder,children:D.map((q,ee)=>{const re=q.columns.length,pe=G1(q,!0,Ze.showRowBorder);return l.jsx(bi,{colSpan:re,showBorder:Ze.showCellBorder,className:j("text-center bg-[var(--color-background-neutral-subtlest)] font-medium border-b border-[var(--color-border-primary-medium)]",s&&"z-20",!ae&&ee===0&&"rounded-tl-lg",!ae&&ee===D.length-1&&"rounded-tr-lg",q.className),style:{...pe,...q.style},children:typeof q.header=="string"?l.jsx("span",{className:"text-body-strong-sm text-[var(--color-text-primary)]",children:q.header}):q.header},q.id)})}),l.jsx(rn,{showBorder:Ze.showRowBorder,children:De.getHeaderGroups()[0]?.headers.map((q,ee)=>{const re=G1(q.column,!0,Ze.showRowBorder),pe=q.column.columnDef.meta?.align||"left",ge=ee===De.getHeaderGroups()[0].headers.length-1,ve=sO(q.column);return l.jsx(bi,{scope:"col","aria-sort":q.column.getCanSort()?q.column.getIsSorted()?q.column.getIsSorted()==="desc"?"descending":"ascending":"none":void 0,"aria-colindex":ee+1,"data-header-col":ee,tabIndex:Ir[0]===-1&&Ir[1]===ee?0:-1,showBorder:ge||ve||cO(q.column)?!1:Ze.showCellBorder,className:j(s&&"z-20",(q1>0||Fi>0)&&"z-30",A&&"relative overflow-visible group",Qq(q.column,ge),"focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]"),style:{...re,...A&&!re.width?{width:q.column.getSize()}:{}},children:l.jsxs("div",{className:j(pe==="right"?"text-right":"text-left"),children:[q.isPlaceholder?null:Yo(q.column.columnDef.header,q.getContext()),A&&q.column.getCanResize()&&l.jsx("div",{onMouseDown:q.getResizeHandler(),onTouchStart:q.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none -mr-1",children:l.jsx("div",{className:j("absolute right-1 top-0 h-full w-1","hover:bg-[var(--color-border-primary-medium)] active:bg-[var(--color-border-primary-medium)]",q.column.getIsResizing()&&"bg-[var(--color-border-primary-medium)]")})})]})},q.id)})})]}):De.getHeaderGroups().map(q=>l.jsx(Cyt,{items:q.headers.map(ee=>ee.id),strategy:wyt,children:l.jsx(rn,{showBorder:Ze.showRowBorder,children:q.headers.map((ee,re)=>{const pe=G1(ee.column,!0,Ze.showRowBorder),ge=ee.column.columnDef.meta?.align||"left",ve=re===q.headers.length-1,$e=sO(ee.column);return l.jsx(bi,{scope:"col","aria-sort":ee.column.getCanSort()?ee.column.getIsSorted()?ee.column.getIsSorted()==="desc"?"descending":"ascending":"none":void 0,"aria-colindex":re+1,"data-header-col":re,tabIndex:Ir[0]===-1&&Ir[1]===re?0:-1,showBorder:ve||$e||cO(ee.column)?!1:Ze.showCellBorder,className:j(s&&"z-20",(q1>0||Fi>0)&&"z-30",A&&"relative overflow-visible group",V&&"group",!ae&&re===0&&"rounded-tl-lg",!ae&&re===q.headers.length-1&&"rounded-tr-lg",Qq(ee.column,ve),"focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]"),style:{...pe,...A&&!pe.width?{width:ee.column.getSize()}:{}},children:l.jsx(Wyt,{header:ee,enableColumnOrdering:V,children:l.jsxs("div",{className:j(ge==="right"?"text-right":"text-left"),children:[ee.isPlaceholder?null:Yo(ee.column.columnDef.header,ee.getContext()),A&&ee.column.getCanResize()&&l.jsx("div",{onMouseDown:ee.getResizeHandler(),onTouchStart:ee.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none -mr-1",children:l.jsx("div",{className:j("absolute right-1 top-0 h-full w-1","hover:bg-[var(--color-border-primary-medium)] active:bg-[var(--color-border-primary-medium)]",ee.column.getIsResizing()&&"bg-[var(--color-border-primary-medium)]")})})]})})},ee.id)})})},q.id))}),l.jsxs(HD,{children:[epe&&!v&&t.length>0&&l.jsx("tr",{className:"absolute top-0 left-0 right-0 z-50 h-0",children:l.jsx("td",{colSpan:De.getVisibleLeafColumns().length,className:"p-0",children:l.jsx(Hyt,{})})}),Ht?l.jsx(rn,{showBorder:!1,className:"h-[300px]",children:l.jsx(Yn,{colSpan:De.getVisibleLeafColumns().length,className:"text-center",showBorder:!1,showRowBorder:!1,verticalAlign:"middle",children:At||l.jsx(Vyt,{error:Ht,onRetry:gt})})}):v&&(g==="replace"||t.length===0)?l.jsx(SX,{columns:De.getVisibleLeafColumns().length,rows:_pe,showRowBorder:Ze.showRowBorder,showCellBorder:Ze.showCellBorder,skipHeader:!0,enableResponsiveWrapper:l0}):De.getRowModel().rows?.length?(()=>{if(!G||!z){const se=new Set,xt=De.getRowModel().rows.filter(he=>Lt||he.depth===0),Bt=(he,nt,Dn)=>{if(se.has(he.id))return null;se.add(he.id);const ur=Uq.get(he.id)??-1;return l.jsxs(p.Fragment,{children:[l.jsx(rn,{"data-state":he.getIsSelected()&&"selected",showBorder:Ze.showRowBorder,"aria-rowindex":ur+2,"aria-selected":Q?he.getIsSelected():void 0,"aria-expanded":he.getCanExpand()?he.getIsExpanded():void 0,className:j("group",he.getIsSelected()&&"bg-[var(--blue-25)]",he.getIsPinned()==="top"&&"!bg-[var(--color-background-neutral-selected)] !border-b-2 !border-[var(--color-border-primary-medium)]",he.getIsPinned()==="bottom"&&"!bg-[var(--color-background-neutral-selected)] !border-t-2 !border-[var(--color-border-primary-medium)]",(()=>{const qt=he.getIsGrouped?.()?"font-medium":"",ya=_X(he,{enableGrouping:E,enableExpanding:W,nestedRowStyling:R,expandingRowColors:L,maxDepth:p0});return j(ya?`bg-[${ya}]`:"",qt)})(),$t&&zi(he)&&(dr||"cursor-pointer hover:[background-image:linear-gradient(rgba(0,0,0,0.02),rgba(0,0,0,0.02))]")),style:{height:Yyt(he.depth,R)},onClick:$t&&zi(he)?We=>aO(he,We):void 0,role:"row","aria-label":$t&&zi(he)?`View details for row ${he.id}`:void 0,"aria-current":h0(he)?"true":void 0,children:he.getVisibleCells().map((We,qt)=>{const ya=G1(We.column,!1,Ze.showRowBorder),hr=qt===0,K1=W&&he.getCanExpand()||E&&he.getIsGrouped(),Xa=he.getIsExpanded(),Ja=he.depth,lO=E&&he.getIsGrouped();let Vi=Vt?.(he);if(Vi==null)for(const va of he.getVisibleCells()){const ba=va.column.columnDef.sectionHeaderCell;if(ba){const dO=ba(va.getContext());if(dO!=null){Vi=dO;break}}}const Qa=Vi!=null;if(Qa&&!hr)return null;const ga=E&&he.depth>0&&qt===0&&!Dn;return l.jsx(Yn,{role:"gridcell","aria-colindex":qt+1,"data-row":ur,"data-col":qt,tabIndex:Ir[0]===ur&&Ir[1]===qt?0:-1,showBorder:sO(We.column)||cO(We.column)?!1:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:We.column.columnDef.meta?.verticalAlign||k,colSpan:Qa?he.getVisibleCells().length:void 0,"data-section-header":Qa?!0:void 0,className:j(hr&&h0(he)&&(me||Bq(Ze.showRowBorder)),!Qa&&Dpe(We.column),Object.keys(ya).length>0&&["z-10",(()=>{const va=_X(he,{enableGrouping:E,enableExpanding:W,nestedRowStyling:R,expandingRowColors:L,maxDepth:p0});return va?`bg-[${va}]`:"bg-[var(--color-surface-primary)]"})()],Qa&&"bg-[var(--blue-50)]",ga&&"![box-shadow:none]","focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]"),style:{...ya,paddingLeft:hr&&Ja>0&&!Qa?`calc(var(--space-md) + ${Ja*20}px)`:void 0},children:Qa?Vi:lO?hr?NX(he,De,K,Xa,B,$):We.column.columnDef.meta?.renderInGroupedRows?lu(We):We.column.columnDef.aggregatedCell?Xq(We):(()=>{const va=CX(We.column,he.subRows,he.groupingColumnId);if(!va)return l.jsx("div",{});const ba=We.column.columnDef.meta?.align||"left";return l.jsx(Ru,{align:ba,children:l.jsx("span",{className:j("text-[var(--color-text-secondary)] text-body-sm",ba==="right"?"tabular-nums":""),children:va})})})():l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[hr&&K1&&l.jsx("button",{tabIndex:-1,onClick:he.getToggleExpandedHandler(),className:"flex h-[var(--size-sm)] w-[var(--size-sm)] cursor-pointer items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",children:l.jsx(oe,{name:Xa?"chevron-down":"chevron-right",className:"h-3 w-3"})}),hr&&G&&!lO&&l.jsxs("div",{className:"flex items-center gap-1",children:[he.getIsPinned()!=="top"&&l.jsx("button",{tabIndex:-1,onClick:()=>he.pin("top"),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Pin to top",children:l.jsx(oe,{name:"arrow-up-to-line",className:"h-3 w-3"})}),he.getIsPinned()!=="bottom"&&l.jsx("button",{tabIndex:-1,onClick:()=>he.pin("bottom"),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Pin to bottom",children:l.jsx(oe,{name:"arrow-down-to-line",className:"h-3 w-3"})}),he.getIsPinned()&&l.jsx("button",{tabIndex:-1,onClick:()=>he.pin(!1),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Unpin row",children:l.jsx(oe,{name:"x",className:"h-3 w-3"})})]}),hr&&!K1&&!G&&(W||E)&&l.jsx("div",{className:"h-[var(--size-sm)] w-[var(--size-sm)]"}),l.jsx("div",{className:"flex-1 min-w-0",children:E&&he.depth>0&&(We.column.id===he.getParentRow()?.groupingColumnId||We.column.id===K)?l.jsx("div",{}):We.column.columnDef.meta?.truncate!==!1?l.jsx(Ru,{align:We.column.columnDef.meta?.align,children:lu(We)}):lu(We)})]})},We.id)})}),s0?.[he.id]&&he.getIsExpanded()&&l.jsx(rn,{showBorder:Ze.showRowBorder,children:l.jsx(Yn,{colSpan:he.getVisibleCells().length,showBorder:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:k,className:"py-[var(--space-md)]",children:l.jsxs("div",{className:"flex items-center justify-center gap-[var(--space-sm)]",children:[l.jsx(fo,{size:"sm"}),l.jsx("span",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"Loading..."})]})})}),Lt&&he.getIsExpanded()&&he.depth===0&&l.jsx(rn,{showBorder:Ze.showRowBorder,children:l.jsx(Yn,{colSpan:he.getVisibleCells().length,showBorder:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:k,className:"p-0","data-section-header":!0,children:Aq?.[he.id]?l.jsxs("div",{className:"flex flex-col items-center justify-center py-[var(--space-lg)] gap-[var(--space-sm)]",children:[l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)] text-[var(--color-text-danger)]",children:[l.jsx(oe,{name:"alert-circle",className:"h-4 w-4"}),l.jsx("span",{className:"text-body-sm",children:Aq[he.id]?.message||"Failed to load details"})]}),su&&l.jsx("button",{onClick:()=>su(he),className:"text-body-sm text-[var(--color-text-brand)] hover:underline cursor-pointer",children:"Try again"})]}):c0?.[he.id]?l.jsxs("div",{className:"flex items-center justify-center py-[var(--space-lg)]",children:[l.jsx(fo,{size:"sm"}),l.jsx("span",{className:"ml-[var(--space-sm)] text-body-sm text-[var(--color-text-secondary)]",children:"Loading details..."})]}):Lt(he)})}),(()=>{if(Lt)return null;const We=he.subRows&&he.subRows.length>0?he.subRows:f0?.get(he.id)||[];if(We.length===0)return null;let qt=he.getIsExpanded();return!qt&&jr===!0&&he.getCanExpand()&&(qt=!0),!qt&&typeof jr=="object"&&jr!==null&&jr[he.id]&&(qt=!0),qt?We.map((ya,hr)=>Bt(ya,hr,hr===We.length-1)):null})()]},he.id)};return xt.map((he,nt)=>Bt(he,nt,nt===xt.length-1))}const q=De.getCoreRowModel().rows,ee=De.getRowModel().rows,re=q.filter(se=>se.getIsPinned()==="top"),pe=q.filter(se=>se.getIsPinned()==="bottom"),ge=ee.filter(se=>!se.getIsPinned()),ve=[...re,...ge,...pe],$e=new Set,ut=ve.filter(se=>Lt||se.depth===0),_t=(se,xt,Bt)=>{if($e.has(se.id))return null;$e.add(se.id);const he=Uq.get(se.id)??-1;return l.jsxs(p.Fragment,{children:[l.jsx(rn,{"data-state":se.getIsSelected()&&"selected",showBorder:Ze.showRowBorder,"aria-rowindex":he+2,className:j("group",se.getIsSelected()&&"bg-[var(--blue-25)]",se.getIsPinned()==="top"&&"!bg-[var(--color-background-neutral-selected)] !border-b-2 !border-[var(--color-border-primary-medium)]",se.getIsPinned()==="bottom"&&"!bg-[var(--color-background-neutral-selected)] !border-t-2 !border-[var(--color-border-primary-medium)]",se.getIsGrouped?.()&&se.getIsExpanded()&&"bg-[var(--blue-50)] font-medium",se.getIsGrouped?.()&&!se.getIsExpanded()&&"bg-[var(--color-background-neutral-subtlest)] font-medium",E&&se.depth===1&&"bg-[var(--blue-25)]",W&&!se.getIsGrouped?.()&&(()=>{const nt=se.subRows&&se.subRows.length>0,Dn=()=>{let qt=se;for(;qt;){if(qt.getIsExpanded())return!0;qt=qt.getParentRow?.()}return!1};if(se.depth===0&&(!nt||!Dn()))return"";const ur=p0-se.depth,We=ur%2===0?"bg-[var(--blue-25)]":"bg-[var(--blue-50)]";if(L){if(ur===0&&L.children)return`bg-[${L.children}]`;if(ur>0&&se.getIsExpanded()&&L.expandedParent)return`bg-[${L.expandedParent}]`;if(ur>0&&!se.getIsExpanded()&&L.collapsedParent)return`bg-[${L.collapsedParent}]`}return We})(),$t&&zi(se)&&(dr||"cursor-pointer hover:[background-image:linear-gradient(rgba(0,0,0,0.02),rgba(0,0,0,0.02))]")),onClick:$t&&zi(se)?nt=>aO(se,nt):void 0,role:"row","aria-label":$t&&zi(se)?`View details for row ${se.id}`:void 0,"aria-current":h0(se)?"true":void 0,children:se.getVisibleCells().map((nt,Dn)=>{const ur=G1(nt.column,!1,Ze.showRowBorder),We=Dn===0,qt=W&&se.getCanExpand()||E&&se.getIsGrouped(),ya=se.getIsExpanded(),hr=se.depth,K1=E&&se.getIsGrouped();let Xa=Vt?.(se);if(Xa==null)for(const Bo of se.getVisibleCells()){const qo=Bo.column.columnDef.sectionHeaderCell;if(qo){const ga=qo(Bo.getContext());if(ga!=null){Xa=ga;break}}}const Ja=Xa!=null;if(Ja&&!We)return null;const Qa=E&&se.depth>0&&Dn===0&&!Bt;return l.jsx(Yn,{role:"gridcell","aria-colindex":Dn+1,"data-row":he,"data-col":Dn,tabIndex:Ir[0]===he&&Ir[1]===Dn?0:-1,showBorder:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:nt.column.columnDef.meta?.verticalAlign||k,colSpan:Ja?se.getVisibleCells().length:void 0,className:j(We&&h0(se)&&(me||Bq(Ze.showRowBorder)),"focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]",Object.keys(ur).length>0&&["z-10",se.getIsGrouped?.()&&se.getIsExpanded()&&"bg-[var(--blue-50)]",se.getIsGrouped?.()&&!se.getIsExpanded()&&"bg-[var(--color-background-neutral-subtlest)]",E&&se.depth===1&&"bg-[var(--blue-25)]",W&&!se.getIsGrouped?.()&&(()=>{const Bo=se.subRows&&se.subRows.length>0,qo=()=>{let ba=se;for(;ba;){if(ba.getIsExpanded())return!0;ba=ba.getParentRow?.()}return!1};if(se.depth===0&&(!Bo||!qo()))return"";const ga=p0-se.depth,va=ga%2===0?"bg-[var(--blue-25)]":"bg-[var(--blue-50)]";if(L){if(ga===0&&L.children)return`bg-[${L.children}]`;if(ga>0&&se.getIsExpanded()&&L.expandedParent)return`bg-[${L.expandedParent}]`;if(ga>0&&!se.getIsExpanded()&&L.collapsedParent)return`bg-[${L.collapsedParent}]`}return va})(),!se.getIsGrouped?.()&&!(E&&se.depth===1)&&!W&&"bg-[var(--color-surface-primary)]"],Ja&&"bg-[var(--blue-50)]",Qa&&"![box-shadow:none]"),style:{...ur,width:nt.column.getSize(),...Ja?{height:"32px",padding:"0"}:{},paddingLeft:We&&hr>0&&!Ja?`calc(var(--space-md) + ${hr*20}px)`:void 0},children:Ja?Xa:K1?We?NX(se,De,K,ya,B,$):nt.column.columnDef.meta?.renderInGroupedRows?lu(nt):nt.column.columnDef.aggregatedCell?Xq(nt):(()=>{const Bo=CX(nt.column,se.subRows,se.groupingColumnId);if(!Bo)return l.jsx("div",{});const qo=nt.column.columnDef.meta?.align||"left";return l.jsx(Ru,{align:qo,children:l.jsx("span",{className:j("text-[var(--color-text-secondary)] text-body-sm",qo==="right"?"tabular-nums":""),children:Bo})})})():l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[We&&qt&&l.jsx("button",{onClick:se.getToggleExpandedHandler(),className:"flex h-[var(--size-sm)] w-[var(--size-sm)] cursor-pointer items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",children:l.jsx(oe,{name:ya?"chevron-down":"chevron-right",className:"h-3 w-3"})}),We&&G&&!K1&&l.jsxs("div",{className:"flex items-center gap-1",children:[se.getIsPinned()!=="top"&&l.jsx("button",{onClick:()=>se.pin("top"),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Pin to top",children:l.jsx(oe,{name:"arrow-up-to-line",className:"h-3 w-3"})}),se.getIsPinned()!=="bottom"&&l.jsx("button",{onClick:()=>se.pin("bottom"),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Pin to bottom",children:l.jsx(oe,{name:"arrow-down-to-line",className:"h-3 w-3"})}),se.getIsPinned()&&l.jsx("button",{onClick:()=>se.pin(!1),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Unpin row",children:l.jsx(oe,{name:"x",className:"h-3 w-3"})})]}),We&&!qt&&!G&&(W||E)&&l.jsx("div",{className:"h-[var(--size-sm)] w-[var(--size-sm)]"}),l.jsx("div",{className:"flex-1 min-w-0",children:E&&se.depth>0&&(nt.column.id===se.getParentRow()?.groupingColumnId||nt.column.id===K)?l.jsx("div",{}):nt.column.columnDef.meta?.truncate!==!1?l.jsx(Ru,{align:nt.column.columnDef.meta?.align,children:lu(nt)}):lu(nt)})]})},nt.id)})}),s0?.[se.id]&&se.getIsExpanded()&&l.jsx(rn,{showBorder:Ze.showRowBorder,children:l.jsx(Yn,{colSpan:se.getVisibleCells().length,showBorder:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:k,className:"py-[var(--space-md)]",children:l.jsxs("div",{className:"flex items-center justify-center gap-[var(--space-sm)]",children:[l.jsx(fo,{size:"sm"}),l.jsx("span",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"Loading..."})]})})}),Lt&&se.getIsExpanded()&&se.depth===0&&l.jsx(rn,{showBorder:Ze.showRowBorder,children:l.jsx(Yn,{colSpan:se.getVisibleCells().length,showBorder:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:k,className:"p-0","data-section-header":!0,children:c0?.[se.id]?l.jsxs("div",{className:"flex items-center justify-center py-[var(--space-lg)]",children:[l.jsx(fo,{size:"sm"}),l.jsx("span",{className:"ml-[var(--space-sm)] text-body-sm text-[var(--color-text-secondary)]",children:"Loading details..."})]}):Lt(se)})}),(()=>{if(Lt)return null;const nt=se.subRows&&se.subRows.length>0?se.subRows:f0?.get(se.id)||[];if(nt.length===0)return null;let Dn=se.getIsExpanded();return!Dn&&jr===!0&&se.getCanExpand()&&(Dn=!0),!Dn&&typeof jr=="object"&&jr!==null&&jr[se.id]&&(Dn=!0),Dn?nt.map((ur,We)=>_t(ur,We,We===nt.length-1)):null})()]},se.id)};return ut.map((se,xt)=>_t(se,xt,xt===ut.length-1))})():Pq.length>0||QD!==""?l.jsx(rn,{showBorder:!1,className:"h-[300px]",children:l.jsx(Yn,{colSpan:oO.length,className:"text-center",showBorder:!1,showRowBorder:!1,verticalAlign:"middle",children:z1||l.jsx(Fyt,{title:Xhe,description:Jhe,action:Qhe})})}):l.jsx(rn,{showBorder:!1,className:"h-[300px]",children:l.jsx(Yn,{colSpan:oO.length,className:"text-center",showBorder:!1,showRowBorder:!1,verticalAlign:"middle",children:fa||l.jsx(zyt,{title:Rn,description:Kr,action:Ti})})})]})]})]}),X&&l.jsx("div",{className:"bg-[var(--color-surface-primary)] px-[var(--space-lg)] py-[var(--space-md)]",children:l.jsx(Gyt,{table:De,enableGrouping:E,hideChildrenForSingleItemGroups:B,footerLabel:Ee,onNextPageHover:Re,onPreviousPageHover:Ve,paginationVariant:ye,pageSizeOptions:ie})}),ot&&qe&&l.jsx(Kyt,{onLoadMore:()=>ot(ma.pageIndex),isLoading:ze})]})})})}function Jyt(e){if(!e)return null;try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function Qyt(e,t){if(e)try{localStorage.setItem(e,JSON.stringify(t))}catch(n){console.warn("Failed to save settings to localStorage:",n)}}function IX(e="table",t=[]){return{viewMode:e,table:{sortDirection:"asc",visibleColumns:t.map(n=>n.id)},columns:{sortDirection:"asc"},folders:{sortDirection:"asc",showFoldersFirst:!1}}}function LT(e){if(e?.directionOptions)return e.directionOptions;if(e?.dataType)switch(e.dataType){case"text":return{asc:"A to Z",desc:"Z to A"};case"number":return{asc:"Ascending",desc:"Descending"};case"date":return{asc:"Oldest first",desc:"Newest first"};case"boolean":return{asc:"False first",desc:"True first"}}return{asc:"Ascending",desc:"Descending"}}const che=w.forwardRef(function({persistenceKey:t,defaultViewMode:n="table",sortableColumns:r=[],groupableColumns:a=[],columns:o=[],columnsSortableColumns:i,columnsGroupableColumns:s,foldersSortableColumns:c,align:d="end",triggerClassName:u},h){const[m,y]=w.useState(()=>{const K=Jyt(t);return K||IX(n,o)}),[v,g]=w.useState("");w.useImperativeHandle(h,()=>({getSettings:()=>m,reset:()=>{y(IX(n,o))}})),w.useEffect(()=>{Qyt(t,m)},[m,t]),w.useEffect(()=>{m.viewMode==="columns"&&!m.columns.groupColumn&&s&&s.length>0&&y(K=>({...K,columns:{...K.columns,groupColumn:s[0].id}}))},[m.viewMode,m.columns.groupColumn,s]);const b=r.length>0,x=a.length>0,k=o.length>0,M=(i?.length??0)>0,C=(s?.length??0)>0,S=(c?.length??0)>0,N=1+(S?1:0)+(C?1:0)>1,I=v?o.filter(K=>K.label.toLowerCase().includes(v.toLowerCase())):o,A=o.length>=20,T=K=>{y(B=>({...B,viewMode:K}))},P=K=>{y(B=>({...B,table:{...B.table,sortColumn:K}}))},F=K=>{y(B=>({...B,table:{...B.table,sortDirection:K}}))},U=K=>{y(B=>({...B,table:{...B.table,groupColumn:K==="none"?void 0:K}}))},W=(K,B)=>{y($=>({...$,table:{...$.table,visibleColumns:B?[...$.table.visibleColumns,K]:$.table.visibleColumns.filter(G=>G!==K)}}))},Z=K=>{y(B=>({...B,columns:{...B.columns,sortColumn:K}}))},L=K=>{y(B=>({...B,columns:{...B.columns,sortDirection:K}}))},R=K=>{y(B=>({...B,columns:{...B.columns,groupColumn:K==="none"?void 0:K}}))},E=K=>{y(B=>({...B,folders:{...B.folders,sortColumn:K}}))},O=K=>{y(B=>({...B,folders:{...B.folders,sortDirection:K}}))},J=K=>{y(B=>({...B,folders:{...B.folders,showFoldersFirst:K}}))};return l.jsxs(Ao,{children:[l.jsx(Fa,{asChild:!0,children:l.jsx(Oe,{size:"md",icon:"settings",className:u})}),l.jsxs(za,{align:d,className:"w-72 max-w-[90vw]",children:[N&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-3 pt-3 pb-2",children:[l.jsx("h3",{className:"text-label-sm text-[var(--color-text-tertiary)] mb-2",children:"View mode"}),l.jsx(ZH,{value:m.viewMode,onValueChange:T,children:l.jsxs(YH,{variant:"pilled",size:"sm",fullWidth:!0,children:[l.jsx(Sp,{variant:"pilled",size:"sm",fullWidth:!0,value:"table",children:"Table"}),S&&l.jsx(Sp,{variant:"pilled",size:"sm",fullWidth:!0,value:"folders",children:"Folders"}),C&&l.jsx(Sp,{variant:"pilled",size:"sm",fullWidth:!0,value:"columns",children:"Columns"})]})})]}),l.jsx(Jr,{})]}),l.jsxs("div",{className:"p-3",children:[m.viewMode==="table"&&l.jsxs("div",{className:"space-y-4",children:[b&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Sorting"}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs(On,{value:m.table.sortColumn,onValueChange:P,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to sort"})}),l.jsx(Pn,{children:r.map(K=>l.jsx(wt,{value:K.id,children:K.label},K.id))})]}),m.table.sortColumn&&l.jsxs(On,{value:m.table.sortDirection,onValueChange:K=>F(K),children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{})}),l.jsx(Pn,{children:(()=>{const K=r.find($=>$.id===m.table.sortColumn),B=LT(K);return l.jsxs(l.Fragment,{children:[l.jsx(wt,{value:"asc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-narrow-wide",size:"sm"}),l.jsx("span",{children:B.asc})]})}),l.jsx(wt,{value:"desc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-wide-narrow",size:"sm"}),l.jsx("span",{children:B.desc})]})})]})})()})]})]})]}),x&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Grouping"}),l.jsxs(On,{value:m.table.groupColumn||"none",onValueChange:U,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to group by"})}),l.jsxs(Pn,{children:[l.jsx(wt,{value:"none",children:"None"}),a.map(K=>l.jsx(wt,{value:K.id,children:K.label},K.id))]})]})]}),k&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Display columns"}),A&&l.jsx(Fn,{type:"search",size:"sm",placeholder:"Search columns...",value:v,onChange:K=>g(K.target.value)}),l.jsx("div",{className:"flex flex-wrap items-start justify-start gap-1 max-h-[190px] overflow-y-auto",children:I.map(K=>{const B=m.table.visibleColumns.includes(K.id);return l.jsx(hD,{variant:"outline",size:"sm",pressed:B,onPressedChange:$=>{W(K.id,$)},children:K.label},K.id)})})]})]}),m.viewMode==="folders"&&c&&c.length>0&&l.jsx(l.Fragment,{children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Sorting"}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs(On,{value:m.folders.sortColumn,onValueChange:E,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column"})}),l.jsx(Pn,{children:c.map(K=>l.jsx(wt,{value:K.id,children:K.label},K.id))})]}),m.folders.sortColumn&&l.jsxs(On,{value:m.folders.sortDirection,onValueChange:K=>O(K),children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{})}),l.jsx(Pn,{children:(()=>{const K=c.find($=>$.id===m.folders.sortColumn),B=LT(K);return l.jsxs(l.Fragment,{children:[l.jsx(wt,{value:"asc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-narrow-wide",size:"sm"}),l.jsx("span",{children:B.asc})]})}),l.jsx(wt,{value:"desc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-wide-narrow",size:"sm"}),l.jsx("span",{children:B.desc})]})})]})})()})]})]})]})}),m.viewMode==="columns"&&l.jsxs("div",{className:"space-y-4",children:[C&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Grouping"}),l.jsxs(On,{value:m.columns.groupColumn||"none",onValueChange:R,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to group by"})}),l.jsxs(Pn,{children:[l.jsx(wt,{value:"none",children:"None"}),s?.map(K=>l.jsx(wt,{value:K.id,children:K.label},K.id))]})]})]}),M&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Sorting"}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs(On,{value:m.columns.sortColumn,onValueChange:Z,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to sort"})}),l.jsx(Pn,{children:i?.map(K=>l.jsx(wt,{value:K.id,children:K.label},K.id))})]}),m.columns.sortColumn&&l.jsxs(On,{value:m.columns.sortDirection,onValueChange:K=>L(K),children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{})}),l.jsx(Pn,{children:(()=>{const K=i?.find($=>$.id===m.columns.sortColumn),B=LT(K);return l.jsxs(l.Fragment,{children:[l.jsx(wt,{value:"asc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-narrow-wide",size:"sm"}),l.jsx("span",{children:B.asc})]})}),l.jsx(wt,{value:"desc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-wide-narrow",size:"sm"}),l.jsx("span",{children:B.desc})]})})]})})()})]})]})]})]})]}),m.viewMode==="folders"&&l.jsxs(l.Fragment,{children:[l.jsx(Jr,{}),l.jsx("div",{className:"p-3",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(F2,{htmlFor:"folders-first",children:"Show folders first"}),l.jsx(WH,{id:"folders-first",checked:m.folders.showFoldersFirst,onCheckedChange:J})]})})]})]})]})});che.displayName="ViewModeMenu";function a0(){const e=new Date,t=e.getDay(),n=(t===0?-6:1)-t,r=new Date(e);return r.setDate(e.getDate()+n),r.setHours(0,0,0,0),r}function lhe(){const e=a0(),t=new Date(e);return t.setDate(e.getDate()+6),t.setHours(23,59,59,999),t}function dhe(){const e=new Date;return new Date(e.getFullYear(),e.getMonth(),1)}function uhe(){const e=new Date;return new Date(e.getFullYear(),e.getMonth()+1,0,23,59,59,999)}function hhe(){const e=new Date;return new Date(e.getFullYear(),0,1)}function phe(){const e=new Date;return new Date(e.getFullYear(),11,31,23,59,59,999)}function fhe(){const e=a0(),t=new Date(e);return t.setDate(e.getDate()-7),t}function mhe(){const e=a0(),t=new Date(e);return t.setDate(e.getDate()-1),t.setHours(23,59,59,999),t}function yhe(){const e=new Date;return new Date(e.getFullYear(),e.getMonth()-1,1)}function ghe(){const e=new Date;return new Date(e.getFullYear(),e.getMonth(),0,23,59,59,999)}function vhe(){const e=new Date;return new Date(e.getFullYear()-1,0,1)}function bhe(){const e=new Date;return new Date(e.getFullYear()-1,11,31,23,59,59,999)}function SP(e){const t=new Date,n=new Date(t);return n.setDate(t.getDate()-e),n.setHours(0,0,0,0),n}function _P(){const e=new Date;return e.setHours(23,59,59,999),e}function mq(){const e=new Date,t=Math.floor(e.getMonth()/3);return new Date(e.getFullYear(),t*3,1)}function xhe(){const e=new Date,t=Math.floor(e.getMonth()/3);return new Date(e.getFullYear(),t*3+3,0,23,59,59,999)}function yq(){const e=new Date,t=Math.floor(e.getMonth()/3),n=t===0?3:t-1,r=t===0?e.getFullYear()-1:e.getFullYear();return new Date(r,n*3,1)}function khe(){const e=new Date,t=Math.floor(e.getMonth()/3),n=t===0?3:t-1,r=t===0?e.getFullYear()-1:e.getFullYear();return new Date(r,n*3+3,0,23,59,59,999)}function SF(e){return`Q${Math.floor(e.getMonth()/3)+1} ${e.getFullYear()}`}function _F(e){switch(e){case"this-week":return[a0(),lhe()];case"this-month":return[dhe(),uhe()];case"this-year":return[hhe(),phe()];case"last-week":return[fhe(),mhe()];case"last-month":return[yhe(),ghe()];case"last-year":return[vhe(),bhe()];case"last-30-days":return[SP(30),_P()];case"last-90-days":return[SP(90),_P()];case"last-6-months":return[SP(180),_P()];case"this-quarter":return[mq(),xhe()];case"last-quarter":return[yq(),khe()];default:return}}function whe(e,t){const n={year:"numeric",month:"short",day:"numeric"},r=e.toLocaleDateString("en-US",n),a=t.toLocaleDateString("en-US",n);return`${r} - ${a}`}function Mhe(e){return{custom:"Custom","this-week":"This week","this-month":"This month","this-year":"This year","last-week":"Last week","last-month":"Last month","last-year":"Last year","last-30-days":"Last 30 days","last-90-days":"Last 90 days","last-6-months":"Last 6 months","this-quarter":`This quarter (${SF(mq())})`,"last-quarter":`Last quarter (${SF(yq())})`}[e]||e}const Che=["this-month","last-month","this-quarter","last-quarter","this-year","last-year","custom"],She=["this-week","last-week","last-30-days","last-90-days","this-month","last-month","custom"];function egt(e){let t=0;if(e.groups)for(const n of e.groups)for(const r of n.options)t++,r.children&&(t+=r.children.length);return e.options&&(t=e.options.length),t}const gq=p.memo(function({filter:t,value:n,onChange:r,onReset:a,autoFocusSearch:o=!0}){const[i,s]=p.useState(""),c=p.useDeferredValue(i),[d,u]=p.useState(""),[h,m]=p.useState(""),[y,v]=p.useState(null),[g,b]=p.useState(null),[x,k]=p.useState(!1),[M,C]=p.useState(new Date().getFullYear()),S=p.useMemo(()=>n?Array.isArray(n)?n.map(String):[String(n)]:[],[n]);p.useEffect(()=>{if(t.type==="number"&&t.rangeMode){const R=n;if(Array.isArray(R)){const[E,O]=R;u(E===-1/0?"":E?.toString()||""),m(O===1/0?"":O?.toString()||"")}else typeof R=="number"?(u(R.toString()),m("")):(u(""),m(""));v(null),b(null)}},[n,t.type,t.rangeMode]);const _=p.useMemo(()=>{const R=t.showSearch??"auto";if(R===!0)return!0;if(R===!1)return!1;const E=egt(t),O=t.searchThreshold??8;return E>=O},[t]),N=p.useMemo(()=>{if(t.groups){if(!c)return t.groups;const R=c.toLowerCase();return t.groups.map(E=>({...E,options:E.options.filter(O=>O.label.toLowerCase().includes(R)||O.children?.some(J=>J.label.toLowerCase().includes(R)))})).filter(E=>E.options.length>0)}if(t.options){const R=c?t.options.filter(E=>E.label.toLowerCase().includes(c.toLowerCase())):t.options;return R.length>0?[{label:t.label,options:R}]:[]}return[]},[t.groups,t.options,t.label,c]),I=R=>{if(t.type==="multiselect"){const E=S.includes(R)?S.filter(O=>O!==R):[...S,R];r(E.length>0?E:void 0)}else r(R===S[0]?void 0:R)},A=R=>{if(t.type!=="multiselect")return;const E=R.options.flatMap(J=>[J.value,...J.children?.map(K=>K.value)||[]]),O=S.filter(J=>!E.includes(J));r(O.length>0?O:void 0)},T=R=>{if(t.type!=="multiselect")return;const E=R.options.flatMap(J=>[J.value,...J.children?.map(K=>K.value)||[]]),O=Array.from(new Set([...S,...E]));r(O.length>0?O:void 0)},P=R=>{if(t.type!=="multiselect")return;const O=R.options.filter($=>!i||$.label.toLowerCase().includes(i.toLowerCase())).flatMap($=>{const G=$.value,z=$.children?.filter(H=>!i||H.label.toLowerCase().includes(i.toLowerCase())).map(H=>H.value)||[];return[G,...z]}),J=S.filter($=>!O.includes($)),K=O.filter($=>!S.includes($)),B=[...J,...K];r(B.length>0?B:void 0)},F=()=>{const R=d.trim(),E=h.trim();if(v(null),b(null),R===""&&E===""){r(void 0);return}const O=R===""?-1/0:parseFloat(R),J=E===""?1/0:parseFloat(E);if(R!==""&&isNaN(O)){v("Invalid minimum value");return}if(E!==""&&isNaN(J)){b("Invalid maximum value");return}if(O!==-1/0&&J!==1/0&&O>J){v("Minimum must be less than maximum"),b("Maximum must be more than minimum");return}r([O,J])},U=t.dateConfig?.granularity||"month",W=()=>t.dateConfig?.presets?t.dateConfig.presets:U==="day"?She:Che,Z=()=>{if(x)return"custom";const R=n;if(!R||!Array.isArray(R))return W().includes("all-time")?"all-time":"";for(const E of W()){if(E==="custom")continue;const O=_F(E);if(O&&O[0].getTime()===R[0].getTime()&&O[1].getTime()===R[1].getTime())return E}return"custom"},L=R=>{if(R==="custom"){k(!0);return}k(!1);const E=_F(R);r(E)};return l.jsxs("div",{className:"flex flex-col gap-[var(--space-2xlg)]",children:[_&&l.jsxs("div",{className:"relative",children:[l.jsx(oe,{name:"search",className:"absolute left-[var(--space-md)] top-1/2 -translate-y-1/2 h-[var(--size-xsm)] w-[var(--size-xsm)] text-[var(--color-text-tertiary)] pointer-events-none"}),l.jsx(Fn,{type:"text",size:"lg",placeholder:t.searchPlaceholder||`Search for a ${t.label.toLowerCase()}`,value:i,onChange:R=>s(R.target.value),className:"pl-[calc(var(--space-md)+var(--size-xsm)+var(--space-sm))]",autoFocus:o})]}),t.type==="number"&&t.rangeMode&&l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("div",{className:"text-body-medium-sm text-[var(--color-text-tertiary)]",children:t.label}),l.jsx("div",{className:"h-px w-full mb-[var(--space-sm)]",children:l.jsx("div",{"aria-hidden":"true",className:"border-[var(--color-border-primary-subtle)] border-[0px_0px_1px] border-solid h-px"})}),l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("label",{className:"text-label-md text-[var(--color-text-primary)]",children:"At least..."}),l.jsxs("div",{className:"relative",children:[t.numberConfig?.prefix&&l.jsx("span",{className:"absolute left-[var(--space-md)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none",children:t.numberConfig.prefix}),l.jsx(Fn,{type:"text",inputMode:"numeric",size:"lg",variant:y?"error":"default",value:d,onChange:R=>{u(R.target.value),v(null)},onBlur:F,onKeyDown:R=>{R.key==="Enter"&&F()},placeholder:t.numberConfig?.min?.toString()||"0.00",className:j(t.numberConfig?.prefix&&"pl-[calc(var(--space-lg)+var(--space-md))]",t.numberConfig?.suffix&&"pr-[calc(var(--space-lg)+var(--space-md))]")}),t.numberConfig?.suffix&&l.jsx("span",{className:"absolute right-[var(--space-md)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none",children:t.numberConfig.suffix})]}),y&&l.jsx("span",{className:"text-caption-sm text-[var(--color-text-error-bold)]",children:y})]}),l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("label",{className:"text-label-md text-[var(--color-text-primary)]",children:"No more than..."}),l.jsxs("div",{className:"relative",children:[t.numberConfig?.prefix&&l.jsx("span",{className:"absolute left-[var(--space-md)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none",children:t.numberConfig.prefix}),l.jsx(Fn,{type:"text",inputMode:"numeric",size:"lg",variant:g?"error":"default",value:h,onChange:R=>{m(R.target.value),b(null)},onBlur:F,onKeyDown:R=>{R.key==="Enter"&&F()},placeholder:t.numberConfig?.max?.toString()||"0.00",className:j(t.numberConfig?.prefix&&"pl-[calc(var(--space-lg)+var(--space-md))]",t.numberConfig?.suffix&&"pr-[calc(var(--space-lg)+var(--space-md))]")}),t.numberConfig?.suffix&&l.jsx("span",{className:"absolute right-[var(--space-md)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none",children:t.numberConfig.suffix})]}),g&&l.jsx("span",{className:"text-caption-sm text-[var(--color-text-error-bold)]",children:g})]}),a&&(d!==""||h!=="")&&l.jsx(Oe,{variant:"default",onClick:()=>{u(""),m(""),v(null),b(null),a()},className:"self-start",children:l.jsx("span",{className:"text-body-medium-sm",children:"Reset"})})]}),t.type==="date"&&t.rangeMode&&l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("div",{className:"text-body-medium-sm text-[var(--color-text-tertiary)]",children:t.label}),l.jsx("div",{className:"h-px w-full mb-[var(--space-sm)]",children:l.jsx("div",{"aria-hidden":"true",className:"border-[var(--color-border-primary-subtle)] border-[0px_0px_1px] border-solid h-px"})}),l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("label",{className:"text-label-md text-[var(--color-text-primary)]",children:"Date range"}),l.jsxs(On,{value:Z(),onValueChange:L,children:[l.jsx(An,{size:"lg",children:l.jsx(Xn,{placeholder:"Select date range..."})}),l.jsx(Pn,{children:W().map(R=>l.jsx(wt,{value:R,children:Mhe(R)},R))})]})]}),Z()==="custom"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)]",children:U==="day"?"Select start and end dates for custom range":"Select start and end months for custom range"}),U==="day"&&l.jsx(Z2,{mode:"range",selected:n&&Array.isArray(n)&&n.length===2?{from:n[0],to:n[1]}:void 0,onSelect:R=>{if(R?.from&&R?.to){const E=new Date(R.from);E.setHours(0,0,0,0);const O=new Date(R.to);O.setHours(23,59,59,999),r([E,O]),k(!1)}},numberOfMonths:2,disabled:t.dateConfig?.minDate||t.dateConfig?.maxDate?R=>!!(t.dateConfig?.minDate&&R<t.dateConfig.minDate||t.dateConfig?.maxDate&&R>t.dateConfig.maxDate):void 0}),U==="month"&&l.jsx(SB,{value:n,onChange:R=>{r(R),k(!1)},mode:"range",yearCount:2,size:"small",enableNavigation:!0,onYearNavigate:R=>C(R),minDate:t.dateConfig?.minDate,maxDate:t.dateConfig?.maxDate})]})]}),N.map((R,E)=>{const O=`filter-group-${E}-${R.label.replace(/\s+/g,"-").toLowerCase()}`;return l.jsxs("div",{role:"group","aria-labelledby":O,className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsxs("div",{className:"flex gap-[var(--space-sm)] items-start justify-start w-full",children:[l.jsx("div",{id:O,className:"flex-1 text-body-medium-sm text-[var(--color-text-tertiary)]",children:R.label}),a&&t.type==="multiselect"&&l.jsxs("div",{className:"flex gap-[var(--space-xsm)] items-center text-body-medium-sm text-[var(--color-text-brand-bold)]",children:[l.jsx("button",{onClick:()=>T(R),"aria-label":`Select all ${R.label} options`,className:"hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",children:"All"}),l.jsx("span",{className:"text-[var(--color-text-tertiary)]","aria-hidden":"true",children:"•"}),l.jsx("button",{onClick:()=>P(R),"aria-label":`Inverse selection in ${R.label}`,className:"hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",children:"Inverse"}),l.jsx("span",{className:"text-[var(--color-text-tertiary)]","aria-hidden":"true",children:"•"}),l.jsx("button",{onClick:()=>A(R),"aria-label":`Clear all ${R.label} selections`,className:"hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",children:"None"})]})]}),l.jsx("div",{className:"h-px w-full",children:l.jsx("div",{"aria-hidden":"true",className:"border-[var(--color-border-primary-subtle)] border-[0px_0px_1px] border-solid h-px"})}),t.type==="multiselect"?l.jsx("div",{className:"flex flex-col gap-[var(--space-sm)]",children:R.options.map(J=>l.jsxs(p.Fragment,{children:[l.jsxs("div",{className:"flex gap-[var(--space-sm)] h-[20px] items-center",children:[l.jsx(Mi,{id:`checkbox-${t.id}-${J.value}`,checked:S.includes(J.value),onCheckedChange:()=>I(J.value)}),l.jsx("label",{htmlFor:`checkbox-${t.id}-${J.value}`,className:"flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",children:J.label})]}),J.children&&J.children.map(K=>l.jsxs("div",{className:"flex gap-[var(--space-sm)] h-[20px] items-center pl-[var(--space-2xlg)]",children:[l.jsx(Mi,{id:`checkbox-${t.id}-${K.value}`,checked:S.includes(K.value),onCheckedChange:()=>I(K.value)}),l.jsx("label",{htmlFor:`checkbox-${t.id}-${K.value}`,className:"flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",children:K.label})]},K.value))]},J.value))}):l.jsx(NH,{value:S[0]||"",onValueChange:I,"aria-label":R.label,children:l.jsx("div",{className:"flex flex-col gap-[var(--space-sm)]",children:R.options.map(J=>l.jsxs(p.Fragment,{children:[l.jsxs("div",{className:"flex gap-[var(--space-sm)] h-[20px] items-center",children:[l.jsx(CE,{id:`radio-${t.id}-${J.value}`,value:J.value}),l.jsx("label",{htmlFor:`radio-${t.id}-${J.value}`,className:"flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",children:J.label})]}),J.children&&J.children.map(K=>l.jsxs("div",{className:"flex gap-[var(--space-sm)] h-[20px] items-center pl-[var(--space-2xlg)]",children:[l.jsx(CE,{id:`radio-${t.id}-${K.value}`,value:K.value}),l.jsx("label",{htmlFor:`radio-${t.id}-${K.value}`,className:"flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",children:K.label})]},K.value))]},J.value))})})]},R.label)})]})}),jX=p.memo(function({filter:t,isSelected:n,isPinned:r,valueCount:a,onSelect:o,onTogglePin:i,onPrefetch:s}){const c=t.icon,[d,u]=p.useState(!1);return l.jsxs("div",{id:`filter-option-${t.id}`,role:"option","aria-selected":n,"aria-label":`${t.label}${a?`, ${a} selected`:""}`,tabIndex:-1,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o())},onMouseEnter:()=>{u(!0),s?.()},onMouseLeave:()=>u(!1),className:j("group/item box-border flex gap-[var(--space-md)] h-[var(--size-md)] items-center justify-start px-[var(--space-lg)] py-[var(--space-sm)] relative rounded-md shrink-0 w-full cursor-pointer transition-colors","hover:bg-[var(--color-background-neutral-hovered)]",n&&"bg-[var(--color-background-blue-subtle-selected)] hover:bg-[var(--color-background-blue-subtle-selected-hovered)] group-focus-visible/listbox:ring-2 group-focus-visible/listbox:ring-[var(--ring-color)] group-focus-visible/listbox:ring-inset"),onClick:o,children:[l.jsxs("div",{className:"flex-1 flex gap-[var(--space-sm)] items-center justify-start min-w-0",children:[l.jsx(c,{className:j("h-[var(--size-2xsm)] w-[var(--size-2xsm)] shrink-0",n?"text-[var(--color-text-brand-bold)]":"text-[var(--color-text-primary)]")}),l.jsx("div",{className:j("truncate [&]:text-label-md",n?"text-[var(--color-text-brand-bold)]":"text-[var(--color-text-primary)]"),children:t.label}),a!==void 0&&a>0&&l.jsx(sn,{size:"sm",intent:n?"brand":"neutral",appearance:n||d?"bold":"subtle",children:a})]}),l.jsx("div",{className:"flex items-center gap-[var(--space-sm)] shrink-0",children:l.jsx(Oe,{variant:"ghost",size:"sm",tabIndex:-1,"aria-label":r?`Unpin ${t.label} filter`:`Pin ${t.label} filter`,"aria-pressed":r,onClick:h=>{h.stopPropagation(),i()},className:j("group/pin h-auto w-auto p-[var(--space-xsm)] transition-opacity",r?"opacity-100":"opacity-0 group-hover/item:opacity-100"),children:r?l.jsxs(l.Fragment,{children:[l.jsx(oe,{name:"pin","aria-hidden":"true",className:j("h-[12px] w-[12px] group-hover/pin:hidden",n?"text-[var(--color-text-brand-bold)]":"text-[var(--color-text-primary)]")}),l.jsx(oe,{name:"pin-off","aria-hidden":"true",className:j("h-[12px] w-[12px] hidden group-hover/pin:block",n?"text-[var(--color-text-brand-bold)]":"text-[var(--color-text-primary)]")})]}):l.jsx(oe,{name:"pin","aria-hidden":"true",className:j("h-[12px] w-[12px]",n?"text-[var(--color-text-brand-bold)]":"text-[var(--color-text-primary)]")})})})]})});function tgt({placeholder:e="Search for keyword...",onAddSearchTerm:t}){const[n,r]=p.useState(""),a=o=>{o.key==="Enter"&&n.trim()&&(o.preventDefault(),t(n.trim()),r(""))};return l.jsx("div",{className:"min-w-[200px] w-[280px]",children:l.jsx(Fn,{type:"search","aria-label":"Search filters by keyword",placeholder:e,value:n,onChange:o=>r(o.target.value),onKeyDown:a,size:"md"})})}function ngt({placeholder:e="Search for keyword...",onAddSearchTerm:t,suggestions:n,minCharacters:r}){const[a,o]=p.useState(""),i=(s,c)=>{t(s,c),o("")};return l.jsx("div",{className:"min-w-[200px] w-[280px]",children:l.jsx(PB,{value:a,onValueChange:o,onSelect:i,suggestions:n,placeholder:e,minCharacters:r})})}function _he({filters:e,pinnedFilters:t,activeFilters:n,onPinnedFiltersChange:r,onFilterChange:a,sidebarWidth:o=240}){const[i,s]=p.useState(e[0]?.id),[c,d]=p.useState("mouse"),u=p.useRef(null),h=p.useMemo(()=>e.map(k=>k.id),[e]),m=k=>{const M=h.indexOf(i);let C=M;switch(k.key){case"ArrowDown":k.preventDefault(),C=Math.min(M+1,h.length-1);break;case"ArrowUp":k.preventDefault(),C=Math.max(M-1,0);break;case"Home":k.preventDefault(),C=0;break;case"End":k.preventDefault(),C=h.length-1;break;default:return}C!==M&&(d("keyboard"),s(h[C]))},y=e.find(k=>k.id===i),v=p.useCallback(k=>{y&&a(y.id,k)},[y?.id,a]),g=p.useCallback(()=>{y&&a(y.id,void 0)},[y?.id,a]),b=k=>{const M=t.includes(k)?t.filter(C=>C!==k):[...t,k];r(M)},x=p.useMemo(()=>{const k={},M=[],C=[];return e.forEach(S=>{S.group?(k[S.group]||(k[S.group]=[],C.push(S.group)),k[S.group].push(S)):M.push(S)}),{grouped:k,ungrouped:M,groupOrder:C}},[e]);return l.jsx("div",{className:"bg-[var(--color-surface-primary)] relative rounded-md max-h-[480px] flex flex-col",children:l.jsxs("div",{className:"flex items-stretch justify-start min-h-0 overflow-hidden rounded-md flex-1",children:[l.jsx("div",{className:"bg-[var(--color-background-neutral-default)] relative shrink-0 border-r border-[var(--color-border-primary-subtle)] flex flex-col",style:{width:typeof o=="number"?`${o}px`:o},children:l.jsxs("div",{ref:u,role:"listbox","aria-label":"Filter categories","aria-orientation":"vertical","aria-activedescendant":i?`filter-option-${i}`:void 0,tabIndex:0,onKeyDown:m,className:"group/listbox box-border flex flex-col gap-[var(--space-sm)] p-[var(--space-sm)] overflow-y-auto focus-visible:outline-none",children:[x.ungrouped.map(k=>{const M=n[k.id],C=Array.isArray(M)?M.length:M!=null?1:0;return l.jsx(jX,{filter:k,isSelected:k.id===i,isPinned:t.includes(k.id),valueCount:C,onSelect:()=>{d("mouse"),s(k.id)},onTogglePin:()=>b(k.id)},k.id)}),x.groupOrder.map((k,M)=>{const C=x.grouped[k];return l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("div",{className:j("px-[var(--space-md)] pb-[var(--space-xsm)]",M===0&&x.ungrouped.length===0?"pt-0":"pt-[var(--space-md)]"),children:l.jsx("div",{className:"text-caption-sm text-[var(--color-text-tertiary)] tracking-[0.1px]",children:k})}),C.map(S=>{const _=n[S.id],N=Array.isArray(_)?_.length:_!=null?1:0;return l.jsx(jX,{filter:S,isSelected:S.id===i,isPinned:t.includes(S.id),valueCount:N,onSelect:()=>{d("mouse"),s(S.id)},onTogglePin:()=>b(S.id)},S.id)})]},k)})]})}),l.jsx("div",{className:"flex-1 box-border p-[var(--space-lg)] overflow-y-auto",children:y&&l.jsx(gq,{filter:y,value:n[y.id],onChange:v,onReset:g,autoFocusSearch:c==="mouse"})})]})})}function rgt({filters:e,pinnedFilters:t,activeFilters:n,onPinnedFiltersChange:r,onFilterChange:a,onFilterClear:o,onFilterReset:i,enableGlobalSearch:s=!1,globalSearchTerms:c=[],onGlobalSearchChange:d,globalSearchPlaceholder:u,enableAutocomplete:h=!1,autocompleteMinCharacters:m=2,hideReset:y=!1,hideFiltersButton:v=!1,actionButtons:g}){const[b,x]=p.useState(!1),[k,M]=p.useState(null),[C,S]=p.useState(""),_=p.useRef(n),N=p.useRef(c),I=p.useRef({}),A=p.useCallback((z,H)=>{const D=k;M(z?H:null),!z&&D===H&&setTimeout(()=>{I.current[H]?.focus()},0)},[k]);p.useEffect(()=>{const z=_.current,H=N.current,D=Object.keys(n).filter(X=>n[X]!==void 0&&n[X]!==null&&(!Array.isArray(n[X])||n[X].length>0)).length,Y=Object.keys(z).filter(X=>z[X]!==void 0&&z[X]!==null&&(!Array.isArray(z[X])||z[X].length>0)).length,V=c.length,Q=H.length;let ae="";if(D!==Y&&(D>Y?ae="Filter applied.":D<Y&&(ae="Filter removed.")),V!==Q&&(V>Q?ae=ae?`${ae} Search term added.`:"Search term added.":V<Q&&(ae=ae?`${ae} Search term removed.`:"Search term removed.")),ae){const X=D+V;X===0?ae="All filters cleared.":ae=`${ae} ${X} active filter${X!==1?"s":""}.`,S(ae)}_.current=n,N.current=c},[n,c]);const T=!v&&e.length>0,P=Object.keys(n).some(z=>n[z]!==void 0&&n[z]!==null),F=c.length>0,U=Object.keys(n).filter(z=>{const H=n[z];return H!=null&&(!Array.isArray(H)||H.length>0)}).length,W=(z,H)=>{if(!z.groups)return H;for(const D of z.groups)for(const Y of D.options){if(Y.value===H)return Y.label;if(Y.children){const V=Y.children.find(Q=>Q.value===H);if(V)return V.label}}return H},Z=(z,H,D)=>{const Y=D?.prefix||"",V=D?.suffix||"";return z===-1/0?`≤ ${Y}${H}${V}`:H===1/0?`≥ ${Y}${z}${V}`:`${Y}${z}${V} - ${Y}${H}${V}`},L=z=>{const H=n[z.id];if(!H||Array.isArray(H)&&H.length===0)return{type:"empty",icon:z.icon,content:z.label};if(z.type==="number"&&z.rangeMode&&Array.isArray(H)&&H.length===2){const[D,Y]=H,V=z.formatValue?.([D.toString(),Y.toString()],2)??Z(D,Y,z.numberConfig);return{type:"values",icon:z.icon,content:V}}if(z.type==="date"&&z.rangeMode&&Array.isArray(H)&&H.length===2){const[D,Y]=H,V=z.formatValue?.([D.toISOString(),Y.toISOString()],2)??whe(D,Y);return{type:"values",icon:z.icon,content:V}}if(Array.isArray(H))if(H.length<=3){const D=H.map(String),Y=z.formatValue?.(D,D.length)??D.map(V=>W(z,V)).join(", ");return{type:"values",icon:z.icon,content:Y}}else return{type:"count",icon:z.icon,label:z.label,count:H.length};return{type:"values",icon:z.icon,content:W(z,String(H))}},R=e.filter(z=>t.includes(z.id)),E=p.useMemo(()=>{const z=[];for(const H of e){const D=Y=>{z.push({normalizedLabel:Y.toLowerCase(),filterId:H.id,icon:H.icon})};if(H.groups)for(const Y of H.groups)for(const V of Y.options)D(V.label),V.children?.forEach(Q=>D(Q.label));H.options&&H.options.forEach(Y=>{D(Y.label),Y.children?.forEach(V=>D(V.label))})}return z},[e]),O=p.useCallback(z=>{if(!z)return null;const H=z.toLowerCase();for(const D of E)if(D.normalizedLabel.includes(H))return{filterId:D.filterId,icon:D.icon};return null},[E]),J=p.useMemo(()=>c.filter(H=>H&&typeof H=="string").map(H=>{if(H.includes("|")){const[Y,V]=H.split("|"),Q=e.find(ae=>ae.label===V);return{value:H,matchedFilter:Q?{filterId:Q.id,icon:Q.icon}:void 0}}const D=O(H);return{value:H,matchedFilter:D?{filterId:D.filterId,icon:D.icon}:void 0}}),[c,e,O]),K=p.useMemo(()=>{if(!h||!s)return[];const z=[];return e.forEach(H=>{H.groups?H.groups.forEach(D=>{D.options.forEach(Y=>{Y.label&&Y.value&&z.push({label:Y.label,value:Y.value,filterLabel:H.label,filterIcon:H.icon}),Y.children&&Y.children.forEach(V=>{V.label&&V.value&&z.push({label:V.label,value:V.value,filterLabel:H.label,filterIcon:H.icon})})})}):H.options&&H.options.forEach(D=>{D.label&&D.value&&z.push({label:D.label,value:D.value,filterLabel:H.label,filterIcon:H.icon}),D.children&&D.children.forEach(Y=>{Y.label&&Y.value&&z.push({label:Y.label,value:Y.value,filterLabel:H.label,filterIcon:H.icon})})})}),z.sort((H,D)=>{const Y=H.label.localeCompare(D.label);return Y!==0?Y:H.filterLabel.localeCompare(D.filterLabel)})},[e,h,s]),B=(z,H)=>{if(!d)return;const D=H?`${z}|${H}`:z;c.includes(D)||d([...c,D])},$=z=>{d&&d(c.filter(H=>H!==z))},G=()=>{i(),d&&F&&d([])};return l.jsxs("div",{className:"flex gap-[3px] items-center min-w-0",children:[l.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:C}),T&&l.jsxs(Ur,{open:b,onOpenChange:x,children:[l.jsx(sa,{asChild:!0,children:l.jsxs(Oe,{className:"h-[var(--size-md)] gap-[var(--space-xsm)]","aria-label":`Filters${U>0?`, ${U} active`:""}`,"aria-expanded":b,"aria-haspopup":"dialog",children:[l.jsx(oe,{name:"list-filter",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]","aria-hidden":"true"}),l.jsx("span",{className:"text-label-md",children:"Filters"}),U>0&&l.jsx(sn,{size:"sm",intent:"neutral",appearance:"subtle","aria-hidden":"true",children:U})]})}),l.jsx(Sr,{className:"w-[660px] p-0",align:"start",children:l.jsx(_he,{filters:e,pinnedFilters:t,activeFilters:n,onPinnedFiltersChange:r,onFilterChange:a})})]}),T&&R.length>0&&l.jsx(zn,{type:"dot",layout:"horizontal"}),R.length>0&&l.jsx("div",{className:"flex-1 min-w-0 flex gap-[7px] overflow-x-auto scrollbar-hide p-1",children:R.map(z=>{const H=L(z),D=H.type!=="empty",Y=H.icon;return l.jsx(L1,{children:l.jsxs(Dr,{children:[l.jsxs(Ur,{open:k===z.id,onOpenChange:V=>A(V,z.id),children:[l.jsx(Or,{asChild:!0,children:l.jsx(sa,{asChild:!0,children:l.jsxs("div",{ref:V=>{I.current[z.id]=V},role:"button",tabIndex:0,"aria-label":`${z.label}: ${H.type==="empty"?"not set, click to add filter":H.type==="count"?`${H.count} selected, click to edit`:`${H.content}, click to edit`}`,"aria-expanded":k===z.id,"aria-haspopup":"dialog",onKeyDown:V=>{(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),A(k!==z.id,z.id))},className:j("group/slot h-[var(--size-md)] rounded-lg flex items-center justify-center gap-[var(--space-sm)] transition-colors cursor-pointer flex-shrink-0","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-2",D?"bg-[var(--color-background-neutral-selected)] hover:bg-[var(--color-background-neutral-hovered)] px-[var(--space-md)] pr-[4px]":"border border-dashed border-[var(--color-border-primary-strong)] px-[var(--space-md)] pr-[var(--space-sm)] hover:border-[var(--grey-400)] active:bg-[var(--grey-25)]"),children:[l.jsx(Y,{className:j("h-[var(--size-2xsm)] w-[var(--size-2xsm)]",D?"text-[var(--color-icon-primary)]":"text-[var(--grey-400)] group-hover/slot:text-[var(--grey-500)]")}),H.type==="count"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"whitespace-nowrap [&]:text-label-md text-[var(--color-text-primary)]",children:H.label}),l.jsx(sn,{size:"sm",intent:"neutral",appearance:"bold",children:H.count})]}):l.jsx("span",{className:j("whitespace-nowrap [&]:text-label-md",D?"text-[var(--color-text-primary)]":"text-[var(--color-text-tertiary)] group-hover/slot:text-[var(--grey-500)]"),children:H.content}),D&&l.jsx(Oe,{variant:"ghost",size:"sm","aria-label":`Clear ${z.label} filter`,onClick:V=>{V.stopPropagation(),o(z.id)},onKeyDown:V=>{(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),V.stopPropagation(),o(z.id))},className:"h-auto w-auto p-[var(--space-xsm)]",children:l.jsx(oe,{name:"x",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]","aria-hidden":"true"})})]})})}),l.jsx(Sr,{className:j("p-[var(--space-lg)]",z.type==="date"?"w-[600px]":"w-[320px]"),align:"start",children:l.jsx(gq,{filter:z,value:n[z.id],onChange:V=>a(z.id,V),onReset:()=>o(z.id)})})]}),D&&H.type!=="count"&&l.jsx(gr,{side:"bottom",children:z.label})]})},z.id)})}),s&&(T||R.length>0)&&l.jsx(zn,{type:"line",layout:"horizontal",className:"mx-[var(--space-sm)]"}),s&&!h&&l.jsx(tgt,{placeholder:u,onAddSearchTerm:B}),s&&h&&l.jsx(ngt,{placeholder:u,onAddSearchTerm:B,suggestions:K,minCharacters:m}),J.map(z=>{const H=z.matchedFilter?.icon,D=z.value.includes("|")?z.value.split("|")[0]:z.value;return l.jsxs("div",{className:"h-[var(--size-md)] rounded-lg bg-[var(--color-background-neutral-selected)] hover:bg-[var(--color-background-neutral-hovered)] px-[var(--space-md)] pr-[4px] flex items-center gap-[var(--space-sm)] transition-colors",children:[H&&l.jsx(H,{className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)] text-[var(--color-icon-primary)]"}),l.jsx("span",{className:"whitespace-nowrap [&]:text-label-md text-[var(--color-text-primary)]",children:D}),l.jsx(Oe,{variant:"ghost",size:"sm","aria-label":`Remove search term: ${D}`,onClick:()=>$(z.value),className:"h-auto w-auto p-[var(--space-xsm)]",children:l.jsx(oe,{name:"x",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]","aria-hidden":"true"})})]},z.value)}),!y&&(P||F)&&l.jsx(zn,{type:"dot",layout:"horizontal"}),!y&&(P||F)&&l.jsx(Oe,{variant:"ghost",onClick:G,"aria-label":"Reset all filters and search terms",className:"h-[var(--size-md)] rounded-sm px-[var(--space-md)]",children:l.jsx("span",{className:"text-label-md",children:"Reset"})}),g&&l.jsx("div",{className:"flex-1"}),g]})}const NF=p.createContext(null);function iu(){const e=p.useContext(NF);if(!e)throw new Error("useBookmarksActions must be used within Bookmarks");return e}function sf({open:e,onOpenChange:t,mode:n,initialName:r="",onSave:a}){const[o,i]=p.useState(r);p.useEffect(()=>{e&&i(r)},[e,r]);const s=()=>{o.trim()&&(a(o.trim()),t(!1))};return l.jsx(vce,{open:e,onOpenChange:t,children:l.jsxs(lB,{children:[l.jsx(dB,{children:l.jsx(pB,{children:n==="create"?"Create bookmark":"Rename bookmark"})}),l.jsx(uB,{children:l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx(F2,{htmlFor:"bookmark-name",children:"Bookmark name"}),l.jsx(Fn,{id:"bookmark-name",value:o,onChange:c=>i(c.target.value),placeholder:"Enter bookmark name...",onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),s())},autoFocus:!0})]})}),l.jsxs(hB,{children:[l.jsx(Oe,{variant:"default",onClick:()=>t(!1),children:"Cancel"}),l.jsx(Oe,{variant:"primary",onClick:s,disabled:!o.trim(),children:n==="create"?"Create":"Save"})]})]})})}function agt({bookmarks:e,systemBookmarks:t,activeBookmarkId:n,onSelect:r,onRename:a,onDelete:o,onSetDefault:i}){const s=p.useMemo(()=>[...t,...e],[t,e]),c=p.useMemo(()=>s.find(u=>u.id===n),[s,n]),d=c?.type==="system";return l.jsxs(ZR,{children:[l.jsxs(On,{value:n,onValueChange:u=>{const h=s.find(m=>m.id===u);h&&r(h)},children:[l.jsxs(An,{className:j("!text-label-md relative z-0 h-[var(--size-md)] w-auto gap-[var(--space-xsm)] border border-[var(--color-border-action-outline)] bg-[var(--color-background-neutral-subtlest)] pr-[var(--space-md)] pl-[var(--space-sm)] text-[var(--color-text-primary)] hover:border-[var(--color-border-action-outline-hovered)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:shadow-sm focus:border-[var(--color-border-action-outline)] focus:ring-0 focus:outline-none focus-visible:z-10 focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-2 active:translate-y-px active:bg-[var(--grey-alpha-50)] active:shadow-xs data-[state=open]:ring-0",d?"rounded-md":"rounded-l-md !rounded-r-none !border-r-0"),children:[l.jsx(oe,{name:"bookmark",size:"md",color:"primary"}),c?.name||"Bookmarks"]}),l.jsxs(Pn,{align:"start",position:"popper",className:"min-w-[200px]",children:[t.length>0&&l.jsx(l.Fragment,{children:t.map(u=>l.jsx(wt,{value:u.id,children:l.jsx("div",{className:"flex items-center gap-[var(--space-sm)] pr-6",children:l.jsx("span",{children:u.name})})},u.id))}),t.length>0&&e.length>0&&l.jsx(tB,{}),e.length>0&&l.jsxs(Tse,{children:[l.jsx(eB,{children:"Custom Bookmarks"}),e.map(u=>l.jsx(wt,{value:u.id,children:l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)] pr-6",children:[l.jsx(oe,{name:"bookmark",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]"}),l.jsx("span",{className:"truncate",children:u.name}),u.isDefault&&l.jsx(oe,{name:"star",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)] flex-shrink-0 text-[var(--color-icon-warning-bold)]"})]})},u.id))]})]})]}),!d&&l.jsxs(Ao,{children:[l.jsx(Fa,{asChild:!0,children:l.jsx(Oe,{icon:"more-horizontal","aria-label":"Bookmark options",className:"!rounded-l-none rounded-r-md !border-l !border-l-[var(--color-border-action-outline)] focus:ring-0 data-[state=open]:ring-0"})}),l.jsxs(za,{align:"end",children:[l.jsxs(Sn,{onClick:u=>{if(d){u.preventDefault();return}a()},disabled:d,children:[l.jsx(oe,{name:"pencil",className:"mr-2 h-4 w-4"}),"Rename"]}),l.jsxs(Sn,{onClick:u=>{if(d){u.preventDefault();return}o()},disabled:d,destructive:!0,children:[l.jsx(oe,{name:"trash-2",className:"mr-2 h-4 w-4"}),"Delete"]}),!d&&l.jsxs(l.Fragment,{children:[l.jsx(Jr,{}),l.jsxs(Sn,{onClick:i,children:[l.jsx(oe,{name:(c?.isDefault,"star"),className:j("mr-2 h-4 w-4",c?.isDefault&&"text-[var(--color-icon-warning-bold)]")}),c?.isDefault?"Unset as Default":"Set as Default"]})]})]})]})]})}function ogt({onUpdate:e,onCreate:t}){return l.jsxs(Ao,{children:[l.jsx(Fa,{asChild:!0,children:l.jsxs(Oe,{variant:"ghost",className:"h-[var(--size-md)] gap-[var(--space-xsm)] px-[var(--space-md)] data-[state=open]:ring-0",children:[l.jsx("span",{className:"text-label-md",children:"Save"}),l.jsx(oe,{name:"chevron-down",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]"})]})}),l.jsxs(za,{align:"end",children:[l.jsx(Sn,{onClick:e,children:"Update bookmark"}),l.jsx(Sn,{onClick:t,children:"Create new bookmark"})]})]})}const Nhe=p.memo(p.forwardRef(({bookmark:e,isActive:t,isVisible:n=!0,index:r,totalTabs:a,onSelect:o,onRename:i,onDelete:s,onSetDefault:c,onNavigate:d,onNavigateFirst:u,onNavigateLast:h,onHover:m},y)=>{const v=e.type==="user",g=p.useCallback(()=>{o(e)},[o,e]),b=p.useCallback(()=>{m?.(e)},[m,e]),x=p.useCallback(()=>{i(e.id)},[i,e.id]),k=p.useCallback(()=>{s(e.id)},[s,e.id]),M=p.useCallback(C=>{switch(C.key){case"Enter":case" ":C.preventDefault(),o(e);break;case"ArrowRight":C.preventDefault(),d(r,1);break;case"ArrowLeft":C.preventDefault(),d(r,-1);break;case"Home":C.preventDefault(),u();break;case"End":C.preventDefault(),h();break}},[e,r,o,d,u,h]);return l.jsxs("div",{ref:y,role:"tab","aria-selected":t,"aria-posinset":r+1,"aria-setsize":a,tabIndex:t?0:-1,onClick:g,onKeyDown:M,onMouseEnter:b,className:j("group relative flex min-w-[160px] flex-shrink-0 cursor-pointer flex-col gap-[var(--space-xsm)] rounded-lg p-[var(--space-lg)] transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-brand-bold)] focus-visible:ring-offset-2",t?"bg-[var(--blue-50)] hover:bg-[var(--blue-50)]":"bg-[var(--color-background-neutral-default)] hover:bg-[var(--color-background-neutral-hovered)]",!n&&"pointer-events-none invisible absolute"),children:[l.jsxs("div",{className:"flex min-h-[var(--size-sm)] items-center justify-between gap-[var(--space-xsm)]",children:[l.jsxs("div",{className:"flex items-center gap-[var(--space-xsm)]",children:[v&&l.jsx(oe,{name:"bookmark",size:"sm",color:"secondary",className:"flex-shrink-0"}),l.jsx("div",{className:"text-body-md whitespace-nowrap text-[var(--color-text-primary)]",children:e.name})]}),v&&l.jsxs(Ao,{children:[l.jsx(Fa,{asChild:!0,children:l.jsx(Oe,{variant:"ghost",size:"sm","aria-label":`Options for ${e.name}`,className:"p-[var(--space-xsm)] opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",tabIndex:-1,onClick:C=>C.stopPropagation(),children:l.jsx(oe,{name:"more-horizontal",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]"})})}),l.jsxs(za,{align:"end",children:[l.jsxs(Sn,{onClick:C=>{C.stopPropagation(),x()},children:[l.jsx(oe,{name:"pencil",className:"mr-2 h-4 w-4"}),"Rename"]}),l.jsxs(Sn,{onClick:C=>{C.stopPropagation(),k()},destructive:!0,children:[l.jsx(oe,{name:"trash-2",className:"mr-2 h-4 w-4"}),"Delete"]})]})]})]}),l.jsx("div",{className:"text-heading-lg text-[var(--color-text-primary)]",children:e.isLoadingCount?l.jsx(Mr,{height:32,width:40}):e.count??" "})]})}));Nhe.displayName="BookmarkTab";function igt({bookmarks:e,systemBookmarks:t,activeBookmarkId:n,"aria-label":r="Bookmarks",onSelect:a,onRename:o,onDelete:i,onSetDefault:s,onBookmarkHover:c,onOverflowMenuChange:d}){const[u,h]=p.useState(!1),[m,y]=p.useState(null),v=p.useCallback(L=>{h(L),d?.(L)},[d]),[g,b]=p.useState(null),x=p.useRef(null),k=p.useRef(new Map),M=p.useMemo(()=>[...t,...e],[t,e]);p.useEffect(()=>{m&&!M.some(L=>L.id===m)&&y(null)},[M,m]),p.useEffect(()=>{if(!x.current||M.length===0)return;let L=null;const R=()=>{L&&clearTimeout(L),L=setTimeout(()=>{const O=x.current;if(!O||k.current.size<M.length)return;const J=O.offsetWidth,K=new Map;M.forEach(ae=>{const X=k.current.get(ae.id);X&&K.set(ae.id,X.offsetWidth)});const B=8,$=32,G=52;let z=0,H=0,D=!1;const Y=t.length,V=e.length>0,Q=Y>0&&V?Y:-1;for(let ae=0;ae<M.length;ae++){const X=M[ae],ye=K.get(X.id);if(ye===void 0)continue;ae===Q&&(D=!0,z+=$+B);const ie=z+ye+(H>0||D?B:0);if((ae<M.length-1?ie+B+G:ie)>J)break;z=ie,H++}H===0&&M.length>0&&(H=1),b(H)},100)};R();const E=new ResizeObserver(R);return E.observe(x.current),()=>{L&&clearTimeout(L),E.disconnect()}},[M,t.length,e.length]);const{visibleBookmarks:C,overflowBookmarks:S}=p.useMemo(()=>{if(g===null)return{visibleBookmarks:M,overflowBookmarks:[]};const L=M.slice(0,g),R=M.slice(g),E=m?R.find(O=>O.id===m):null;if(E&&L.length>0){const O=L[L.length-1],J=[...L.slice(0,-1),E],K=[O,...R.filter(B=>B.id!==m)];return{visibleBookmarks:J,overflowBookmarks:K}}return{visibleBookmarks:L,overflowBookmarks:R}},[M,g,m]),_=p.useCallback((L,R)=>{let E=L+R;E<0?E=C.length-1:E>=C.length&&(E=0);const O=C[E];O&&k.current.get(O.id)?.focus()},[C]),N=p.useCallback(L=>{a(L)},[a]),I=p.useCallback(()=>{const L=C[0];L&&k.current.get(L.id)?.focus()},[C]),A=p.useCallback(()=>{const L=C[C.length-1];L&&k.current.get(L.id)?.focus()},[C]),T=C.length,P=p.useMemo(()=>{for(let L=0;L<C.length-1;L++)if(C[L].type==="system"&&C[L+1].type==="user")return L;return-1},[C]),F=p.useCallback(L=>{C.some(E=>E.id===L.id)&&L.id!==m&&y(null),a(L)},[C,m,a]),U=p.useCallback(L=>{y(L.id),a(L),v(!1)},[a,v]),W=p.useMemo(()=>[...C,...S],[C,S]),Z=p.useMemo(()=>new Set(C.map(L=>L.id)),[C]);return l.jsxs("div",{ref:x,role:"tablist","aria-label":r,className:"flex items-center gap-[var(--space-sm)]",children:[W.map((L,R)=>{const E=Z.has(L.id),O=E?C.findIndex(K=>K.id===L.id):-1,J=E&&O===P;return l.jsxs(p.Fragment,{children:[l.jsx(Nhe,{ref:K=>{K?k.current.set(L.id,K):k.current.delete(L.id)},bookmark:L,isActive:n===L.id,isVisible:E,index:O>=0?O:R,totalTabs:T,onSelect:E?F:N,onRename:o,onDelete:i,onSetDefault:s,onNavigate:_,onNavigateFirst:I,onNavigateLast:A,onHover:c}),J&&l.jsx(zn,{type:"line",layout:"horizontal",className:"h-20 flex-shrink-0","aria-hidden":"true"})]},L.id)}),S.length>0&&l.jsxs(Ur,{open:u,onOpenChange:v,children:[l.jsx(sa,{asChild:!0,children:l.jsx("button",{"aria-label":`Show ${S.length} more bookmarks`,"aria-expanded":u,className:j("flex cursor-pointer flex-shrink-0 items-center justify-center rounded-lg border border-[var(--color-border-action-outline)] bg-transparent px-[var(--space-md)] transition-colors hover:bg-[var(--color-background-neutral-subtlest-hovered)]","min-h-[88px]","focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-brand-bold)] focus-visible:ring-offset-2"),children:l.jsx(oe,{name:"chevron-down",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]"})})}),l.jsx(Sr,{align:"end",side:"bottom",className:"w-[280px] p-[var(--space-sm)]",role:"menu","aria-label":"More bookmarks",children:l.jsx("div",{className:"flex flex-col",children:S.map(L=>{const R=n===L.id,E=L.type==="user";return l.jsxs("button",{role:"menuitem","aria-label":`Select ${L.name} bookmark${R?" (currently selected)":""}`,onClick:()=>U(L),className:j("text-body-md flex cursor-pointer items-center gap-[var(--space-sm)] rounded-md px-[var(--space-md)] py-[var(--space-sm)] text-left transition-colors","hover:bg-[var(--color-background-neutral-subtlest-hovered)]","focus:outline-none focus-visible:bg-[var(--color-background-neutral-subtlest-hovered)]"),children:[E&&l.jsx(oe,{name:"bookmark",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]","aria-hidden":"true"}),!E&&l.jsx("div",{className:"w-[var(--size-2xsm)]","aria-hidden":"true"}),l.jsxs("div",{className:"flex flex-1 items-center gap-[var(--space-xsm)]",children:[l.jsx("span",{className:"truncate",children:L.name}),(L.count!==void 0||L.isLoadingCount)&&l.jsx(sn,{size:"sm",intent:"neutral",appearance:"subtle",children:L.isLoadingCount?l.jsx(Mr,{height:16,width:24}):L.count})]}),L.isDefault&&l.jsx(oe,{name:"star",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)] text-[var(--color-icon-warning-bold)]","aria-hidden":"true"}),R&&l.jsx(oe,{name:"check",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)] text-[var(--color-icon-primary)]","aria-hidden":"true"})]},L.id)})})})]})]})}function vq({children:e}){return l.jsx(l.Fragment,{children:e})}function bq({children:e}){return l.jsx(l.Fragment,{children:e})}function xq({children:e}){return l.jsx(l.Fragment,{children:e})}function kq(){const{isDirty:e,handleRevert:t}=iu();return e?l.jsx(Oe,{variant:"ghost",onClick:t,className:"h-[var(--size-md)]",children:"Revert changes"}):null}function wq(){const{isDirty:e,isSystemBookmark:t,openCreateDialog:n}=iu();return!e||!t?null:l.jsx(Oe,{variant:"ghost",onClick:n,className:"h-[var(--size-md)]",children:"Create bookmark"})}function Ihe(){const{isDirty:e,isSystemBookmark:t,handleUpdate:n}=iu();return!e||t?null:l.jsx(Oe,{variant:"ghost",onClick:n,className:"h-[var(--size-md)]",children:"Update bookmark"})}function Mq(){const{isDirty:e,isSystemBookmark:t,handleRevert:n}=iu();return!e||!t?null:l.jsx(Oe,{variant:"ghost",onClick:n,className:"h-[var(--size-md)]",children:"Reset"})}function Cq(){const{isDirty:e,isSystemBookmark:t,handleUpdate:n,openCreateDialog:r}=iu();return!e||t?null:l.jsx(ogt,{onUpdate:n,onCreate:r})}function jhe(){const{isDirty:e,isSystemBookmark:t}=iu();return e?l.jsxs(l.Fragment,{children:[l.jsx(zn,{type:"dot",layout:"horizontal"}),t?l.jsxs(l.Fragment,{children:[l.jsx(Mq,{}),l.jsx(wq,{})]}):l.jsxs(l.Fragment,{children:[l.jsx(kq,{}),l.jsx(Cq,{})]})]}):null}function Za({variant:e,bookmarks:t,systemBookmarks:n,activeBookmarkId:r,isDirty:a,children:o,"aria-label":i="Bookmarks",onSelect:s,onRevert:c,onSave:d,onRename:u,onDelete:h,onSetDefault:m,onBookmarkHover:y,onOverflowMenuChange:v,onDialogChange:g}){const[b,x]=p.useState(!1),[k,M]=p.useState(!1),[C,S]=p.useState(),_=p.useCallback($=>{M($),g?.($?"create":null)},[g]),N=p.useCallback($=>{x($),g?.($?"rename":null)},[g]),I=p.useMemo(()=>[...n,...t],[n,t]),A=p.useMemo(()=>I.find($=>$.id===r),[I,r]),T=A?.type==="system",P=p.useCallback($=>{S($||r),N(!0)},[r,N]),F=p.useCallback(async $=>{C&&await u(C,$)},[C,u]),U=p.useCallback(async $=>{await d("create",$)},[d]),W=p.useCallback(async $=>{const G=$||r;G&&await h(G)},[r,h]),Z=p.useCallback(async $=>{const G=$||r;G&&await m(G)},[r,m]),L=p.useMemo(()=>I.find($=>$.id===C),[I,C]),{contentSlot:R,actionsSlot:E,settingsSlot:O}=p.useMemo(()=>{let $=null,G=null,z=null;const H=[];return p.Children.forEach(o,D=>{p.isValidElement(D)?D.type===vq?$=D.props.children:D.type===bq?G=D.props.children:D.type===xq?z=D.props.children:H.push(D):H.push(D)}),!$&&H.length>0&&($=H),{contentSlot:$,actionsSlot:G,settingsSlot:z}},[o]),J=p.useCallback(()=>_(!0),[_]),K=p.useCallback(()=>d("update"),[d]),B=p.useMemo(()=>({isDirty:a,isSystemBookmark:T,activeBookmark:A,openCreateDialog:J,openRenameDialog:P,handleRevert:c,handleUpdate:K,handleDelete:W,handleSetDefault:Z}),[a,T,A,J,P,c,K,W,Z]);return e==="tabs"?l.jsxs(NF.Provider,{value:B,children:[l.jsx(igt,{bookmarks:t,systemBookmarks:n,activeBookmarkId:r,"aria-label":i,onSelect:s,onRename:P,onDelete:W,onSetDefault:Z,onBookmarkHover:y,onOverflowMenuChange:v}),(R||E||O)&&l.jsxs("div",{className:"flex items-center",children:[l.jsxs("div",{className:"flex items-center gap-[7px] flex-1 min-w-0 overflow-hidden",children:[R&&l.jsx("div",{className:"flex items-center gap-[7px] min-w-0",children:R}),E&&l.jsx("div",{className:"flex items-center gap-[7px] flex-shrink-0",children:E})]}),O&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"w-[var(--space-md)]"}),l.jsx("div",{className:"flex-shrink-0",children:O})]})]}),l.jsx(sf,{open:k,onOpenChange:_,mode:"create",onSave:U}),l.jsx(sf,{open:b,onOpenChange:N,mode:"rename",initialName:L?.name,onSave:F})]}):l.jsxs(NF.Provider,{value:B,children:[l.jsxs("div",{className:"flex items-center gap-[var(--space-md)]",children:[l.jsx(agt,{bookmarks:t,systemBookmarks:n,activeBookmarkId:r,onSelect:s,onRename:()=>P(),onDelete:()=>W(),onSetDefault:()=>Z()}),l.jsxs("div",{className:"flex items-center gap-[7px] flex-1 min-w-0 overflow-hidden",children:[R&&l.jsx("div",{className:"flex items-center gap-[7px]",children:R}),E&&l.jsx("div",{className:"flex items-center gap-[7px] flex-shrink-0",children:E})]}),O&&l.jsx("div",{className:"flex-shrink-0",children:O})]}),l.jsx(sf,{open:k,onOpenChange:_,mode:"create",onSave:U}),l.jsx(sf,{open:b,onOpenChange:N,mode:"rename",initialName:L?.name,onSave:F})]})}Za.Content=vq;Za.Actions=bq;Za.Settings=xq;Za.DefaultActions=jhe;Za.RevertButton=kq;Za.CreateButton=wq;Za.SaveButton=Ihe;Za.ResetButton=Mq;Za.SaveDropdown=Cq;function sgt({title:e,description:t,data:n,config:r,columns:a,type:o,enableFiltering:i=!0,enableRowSelection:s=!0,onRowSelectionChange:c,onDataFilter:d,showTable:u=!0,tableClassName:h,chartClassName:m,enableRowFiltering:y=!1,className:v,...g}){const[b,x]=w.useState(new Set),[k,M]=w.useState(null),[C,S]=w.useState(null),[_,N]=w.useState(new Set),[I,A]=w.useState(!1),T=w.useMemo(()=>_.size>0?n.filter((O,J)=>_.has(J)):I&&b.size>0?n.filter((O,J)=>b.has(J)):n,[n,_,b,I]),P=w.useCallback((O,J)=>{if(J!==void 0&&O){const K=n.findIndex(B=>B===T[J]);S(K!==-1?K:null)}else S(null)},[n,T]),F=w.useCallback((O,J)=>{if(!i)return;const K=n.findIndex(G=>G===T[J]);if(K===-1)return;const B=new Set(_);B.has(K)?B.delete(K):B.add(K),N(B);const $=n.filter((G,z)=>B.has(z));d?.($)},[i,_,n,d,T]),U=w.useCallback(O=>{if(!s)return;const J=new Set(b);J.has(O)?J.delete(O):J.add(O),x(J),c?.(Array.from(J))},[s,b,c]),W=w.useCallback(O=>{M(O)},[]),Z=w.useCallback(()=>{x(new Set),N(new Set),M(null),S(null),A(!1),c?.([]),d?.([])},[c,d]),L=w.useCallback((O,J,K)=>{if(J.format)return J.format(O,K);switch(J.type){case"currency":return typeof O=="number"?`$${O.toLocaleString()}`:O;case"percentage":return typeof O=="number"?`${O}%`:O;case"number":return typeof O=="number"?O.toLocaleString():O;default:return O}},[]),R=k??C,E=w.useMemo(()=>{if(R!==null){const O=T.findIndex(J=>n[R]===J);return O!==-1?O:void 0}},[R,T,n]);return l.jsxs("div",{className:j("space-y-[var(--space-lg)]",v),children:[(e||t)&&l.jsxs("div",{className:"space-y-[var(--space-sm)]",children:[e&&l.jsx("h3",{className:"text-heading-md",children:e}),t&&l.jsx("p",{className:"text-body-md text-[var(--color-text-secondary)]",children:t})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[b.size>0&&l.jsxs(sn,{intent:"neutral",appearance:"subtle",size:"sm",children:[b.size," selected",I?" (filtered)":""]}),_.size>0&&l.jsxs(sn,{intent:"brand",appearance:"subtle",size:"sm",children:[_.size," chart filtered"]})]}),l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[y&&b.size>0&&l.jsxs(Oe,{size:"sm",variant:I?"default":"ghost",onClick:()=>A(!I),children:[l.jsx(oe,{name:"filter",size:"sm",className:"mr-[var(--space-xsm)]"}),"Filter selected"]}),(b.size>0||_.size>0||I)&&l.jsxs(Oe,{variant:"ghost",size:"sm",onClick:Z,children:[l.jsx(oe,{name:"x",size:"sm",className:"mr-[var(--space-sm)]"}),"Clear all"]})]})]}),l.jsx(Mp,{children:l.jsx(Cp,{className:"p-[var(--space-lg)]",children:l.jsx(yre,{...g,type:o,data:T,config:r,onDataPointClick:F,onDataPointHover:P,highlightedIndex:E,className:m})})}),u&&l.jsxs(Mp,{children:[l.jsx(wH,{children:l.jsxs(MH,{className:"text-heading-sm flex items-center justify-between",children:["Data Table",l.jsxs(sn,{intent:"neutral",appearance:"subtle",size:"sm",children:[T.length," rows"]})]})}),l.jsx(Cp,{children:l.jsx("div",{className:j("rounded-md border border-[var(--color-border-primary-subtle)]",h),children:l.jsxs(FD,{children:[l.jsx(VD,{children:l.jsx(rn,{children:a.map(O=>l.jsx(bi,{children:O.label},O.key))})}),l.jsx(HD,{children:T.map((O,J)=>{const K=n.indexOf(O),B=b.has(K),$=k===K||C===K;return l.jsx(rn,{onClick:()=>U(K),onMouseEnter:()=>W(K),onMouseLeave:()=>W(null),variant:B?"selected":"default",className:j("cursor-pointer transition-colors",$&&"bg-[var(--color-background-neutral-subtlest-hovered)]",s&&"hover:bg-[var(--color-background-neutral-subtlest-hovered)]"),children:a.map(G=>l.jsx(Yn,{children:L(O[G.key],G,O)},G.key))},K)})})]})})})]}),i&&l.jsx(Mp,{className:"border-[var(--color-border-info-bold)]",children:l.jsx(Cp,{className:"p-[var(--space-md)]",children:l.jsxs("div",{className:"flex items-start gap-[var(--space-sm)]",children:[l.jsx(oe,{name:"info",size:"sm",color:"information",className:"mt-1"}),l.jsxs("div",{className:"space-y-[var(--space-xsm)] text-body-sm text-[var(--color-text-secondary)]",children:[l.jsx("p",{children:l.jsx("strong",{children:"Interactive Features:"})}),l.jsxs("ul",{className:"list-disc list-inside space-y-[var(--space-xsm)]",children:[l.jsx("li",{children:"Click chart data points to filter the table"}),s&&l.jsx("li",{children:"Click table rows to select/deselect them"}),y&&s&&l.jsx("li",{children:'Use "Filter Selected" button to show only selected rows in the chart'}),l.jsx("li",{children:"Hover over chart or table to see corresponding data"}),l.jsx("li",{children:'Use "Clear All" to reset all filters and selections'})]})]})]})})})]})}const cgt=(e,t=[])=>{const n=Object.entries(e).map(([r,a])=>({key:r,label:a.label,type:"number"}));return[{key:"name",label:"Name",type:"text"},...n,...t]},KD=w.createContext(null);KD.displayName="PanelGroupContext";const Tt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Sq=10,$d=w.useLayoutEffect,LX=p.useId,lgt=typeof LX=="function"?LX:()=>null;let dgt=0;function _q(e=null){const t=lgt(),n=w.useRef(e||t||null);return n.current===null&&(n.current=""+dgt++),e??n.current}function Lhe({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:a,forwardedRef:o,id:i,maxSize:s,minSize:c,onCollapse:d,onExpand:u,onResize:h,order:m,style:y,tagName:v="div",...g}){const b=w.useContext(KD);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:k,getPanelSize:M,getPanelStyle:C,groupId:S,isPanelCollapsed:_,reevaluatePanelConstraints:N,registerPanel:I,resizePanel:A,unregisterPanel:T}=b,P=_q(i),F=w.useRef({callbacks:{onCollapse:d,onExpand:u,onResize:h},constraints:{collapsedSize:n,collapsible:r,defaultSize:a,maxSize:s,minSize:c},id:P,idIsFromProps:i!==void 0,order:m});w.useRef({didLogMissingDefaultSizeWarning:!1}),$d(()=>{const{callbacks:W,constraints:Z}=F.current,L={...Z};F.current.id=P,F.current.idIsFromProps=i!==void 0,F.current.order=m,W.onCollapse=d,W.onExpand=u,W.onResize=h,Z.collapsedSize=n,Z.collapsible=r,Z.defaultSize=a,Z.maxSize=s,Z.minSize=c,(L.collapsedSize!==Z.collapsedSize||L.collapsible!==Z.collapsible||L.maxSize!==Z.maxSize||L.minSize!==Z.minSize)&&N(F.current,L)}),$d(()=>{const W=F.current;return I(W),()=>{T(W)}},[m,P,I,T]),w.useImperativeHandle(o,()=>({collapse:()=>{x(F.current)},expand:W=>{k(F.current,W)},getId(){return P},getSize(){return M(F.current)},isCollapsed(){return _(F.current)},isExpanded(){return!_(F.current)},resize:W=>{A(F.current,W)}}),[x,k,M,_,P,A]);const U=C(F.current,a);return w.createElement(v,{...g,children:e,className:t,id:P,style:{...U,...y},[Tt.groupId]:S,[Tt.panel]:"",[Tt.panelCollapsible]:r||void 0,[Tt.panelId]:P,[Tt.panelSize]:parseFloat(""+U.flexGrow).toFixed(1)})}const Ahe=w.forwardRef((e,t)=>w.createElement(Lhe,{...e,forwardedRef:t}));Lhe.displayName="Panel";Ahe.displayName="forwardRef(Panel)";let IF=null,NP=-1,fi=null;function ugt(e,t,n){const r=(t&Ohe)!==0,a=(t&$he)!==0,o=(t&The)!==0,i=(t&zhe)!==0;if(t){if(r)return o?"se-resize":i?"ne-resize":"e-resize";if(a)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function hgt(){fi!==null&&(document.head.removeChild(fi),IF=null,fi=null,NP=-1)}function AT(e,t,n){var r,a;const o=ugt(e,t);if(IF!==o){if(IF=o,fi===null&&(fi=document.createElement("style"),document.head.appendChild(fi)),NP>=0){var i;(i=fi.sheet)===null||i===void 0||i.removeRule(NP)}NP=(r=(a=fi.sheet)===null||a===void 0?void 0:a.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function Phe(e){return e.type==="keydown"}function Ehe(e){return e.type.startsWith("pointer")}function Rhe(e){return e.type.startsWith("mouse")}function ZD(e){if(Ehe(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Rhe(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function pgt(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function fgt(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function mgt(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:EX(e),b:EX(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Be(r,"Stacking order can only be calculated for elements with a common ancestor");const a={a:PX(AX(n.a)),b:PX(AX(n.b))};if(a.a===a.b){const o=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let s=o.length;for(;s--;){const c=o[s];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(a.a-a.b)}const ygt=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ggt(e){var t;const n=getComputedStyle((t=Dhe(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function vgt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||ggt(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||ygt.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function AX(e){let t=e.length;for(;t--;){const n=e[t];if(Be(n,"Missing node"),vgt(n))return n}return null}function PX(e){return e&&Number(getComputedStyle(e).zIndex)||0}function EX(e){const t=[];for(;e;)t.push(e),e=Dhe(e);return t}function Dhe(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Ohe=1,$he=2,The=4,zhe=8,bgt=pgt()==="coarse";let na=[],Ku=!1,mi=new Map,YD=new Map;const i2=new Set;function xgt(e,t,n,r,a){var o;const{ownerDocument:i}=t,s={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:a},c=(o=mi.get(i))!==null&&o!==void 0?o:0;return mi.set(i,c+1),i2.add(s),WE(),function(){var u;YD.delete(e),i2.delete(s);const h=(u=mi.get(i))!==null&&u!==void 0?u:1;if(mi.set(i,h-1),WE(),h===1&&mi.delete(i),na.includes(s)){const m=na.indexOf(s);m>=0&&na.splice(m,1),XD(),a("up",!0,null)}}}function kgt(e){const{target:t}=e,{x:n,y:r}=ZD(e);Ku=!0,Nq({target:t,x:n,y:r}),WE(),na.length>0&&(GE("down",e),XD(),e.preventDefault(),Fhe(t)||e.stopImmediatePropagation())}function PT(e){const{x:t,y:n}=ZD(e);if(Ku&&e.type!=="pointerleave"&&e.buttons===0&&(Ku=!1,GE("up",e)),!Ku){const{target:r}=e;Nq({target:r,x:t,y:n})}GE("move",e),XD(),na.length>0&&e.preventDefault()}function ET(e){const{target:t}=e,{x:n,y:r}=ZD(e);YD.clear(),Ku=!1,na.length>0&&(e.preventDefault(),Fhe(t)||e.stopImmediatePropagation()),GE("up",e),Nq({target:t,x:n,y:r}),XD(),WE()}function Fhe(e){let t=e;for(;t;){if(t.hasAttribute(Tt.resizeHandle))return!0;t=t.parentElement}return!1}function Nq({target:e,x:t,y:n}){na.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),i2.forEach(a=>{const{element:o,hitAreaMargins:i}=a,s=o.getBoundingClientRect(),{bottom:c,left:d,right:u,top:h}=s,m=bgt?i.coarse:i.fine;if(t>=d-m&&t<=u+m&&n>=h-m&&n<=c+m){if(r!==null&&document.contains(r)&&o!==r&&!o.contains(r)&&!r.contains(o)&&mgt(r,o)>0){let v=r,g=!1;for(;v&&!v.contains(o);){if(fgt(v.getBoundingClientRect(),s)){g=!0;break}v=v.parentElement}if(g)return}na.push(a)}})}function RT(e,t){YD.set(e,t)}function XD(){let e=!1,t=!1;na.forEach(r=>{const{direction:a}=r;a==="horizontal"?e=!0:t=!0});let n=0;YD.forEach(r=>{n|=r}),e&&t?AT("intersection",n):e?AT("horizontal",n):t?AT("vertical",n):hgt()}let DT;function WE(){var e;(e=DT)===null||e===void 0||e.abort(),DT=new AbortController;const t={capture:!0,signal:DT.signal};i2.size&&(Ku?(na.length>0&&mi.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("contextmenu",ET,t),a.addEventListener("pointerleave",PT,t),a.addEventListener("pointermove",PT,t))}),mi.forEach((n,r)=>{const{body:a}=r;a.addEventListener("pointerup",ET,t),a.addEventListener("pointercancel",ET,t)})):mi.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("pointerdown",kgt,t),a.addEventListener("pointermove",PT,t))}))}function GE(e,t){i2.forEach(n=>{const{setResizeHandlerState:r}=n,a=na.includes(n);r(e,a,t)})}function wgt(){const[e,t]=w.useState(0);return w.useCallback(()=>t(n=>n+1),[])}function Be(e,t){if(!e)throw console.error(t),Error(t)}function Zd(e,t,n=Sq){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function uo(e,t,n=Sq){return Zd(e,t,n)===0}function fr(e,t,n){return Zd(e,t,n)===0}function Mgt(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const a=e[r],o=t[r];if(!fr(a,o,n))return!1}return!0}function Du({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Be(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:o,maxSize:i=100,minSize:s=0}=r;if(Zd(n,s)<0)if(o){const c=(a+s)/2;Zd(n,c)<0?n=a:n=s}else n=s;return n=Math.min(i,n),n=parseFloat(n.toFixed(Sq)),n}function bh({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:o}){if(fr(e,0))return t;const i=[...t],[s,c]=r;Be(s!=null,"Invalid first pivot index"),Be(c!=null,"Invalid second pivot index");let d=0;if(o==="keyboard"){{const h=e<0?c:s,m=n[h];Be(m,`Panel constraints not found for index ${h}`);const{collapsedSize:y=0,collapsible:v,minSize:g=0}=m;if(v){const b=t[h];if(Be(b!=null,`Previous layout not found for panel index ${h}`),fr(b,y)){const x=g-b;Zd(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}{const h=e<0?s:c,m=n[h];Be(m,`No panel constraints found for index ${h}`);const{collapsedSize:y=0,collapsible:v,minSize:g=0}=m;if(v){const b=t[h];if(Be(b!=null,`Previous layout not found for panel index ${h}`),fr(b,g)){const x=b-y;Zd(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}}{const h=e<0?1:-1;let m=e<0?c:s,y=0;for(;;){const g=t[m];Be(g!=null,`Previous layout not found for panel index ${m}`);const x=Du({panelConstraints:n,panelIndex:m,size:100})-g;if(y+=x,m+=h,m<0||m>=n.length)break}const v=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-v:v}{let m=e<0?s:c;for(;m>=0&&m<n.length;){const y=Math.abs(e)-Math.abs(d),v=t[m];Be(v!=null,`Previous layout not found for panel index ${m}`);const g=v-y,b=Du({panelConstraints:n,panelIndex:m,size:g});if(!fr(v,b)&&(d+=v-b,i[m]=b,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(Mgt(a,i))return a;{const h=e<0?c:s,m=t[h];Be(m!=null,`Previous layout not found for panel index ${h}`);const y=m+d,v=Du({panelConstraints:n,panelIndex:h,size:y});if(i[h]=v,!fr(v,y)){let g=y-v,x=e<0?c:s;for(;x>=0&&x<n.length;){const k=i[x];Be(k!=null,`Previous layout not found for panel index ${x}`);const M=k+g,C=Du({panelConstraints:n,panelIndex:x,size:M});if(fr(k,C)||(g-=C-k,i[x]=C),fr(g,0))break;e>0?x--:x++}}}const u=i.reduce((h,m)=>m+h,0);return fr(u,100)?i:a}function Cgt({layout:e,panelsArray:t,pivotIndices:n}){let r=0,a=100,o=0,i=0;const s=n[0];Be(s!=null,"No pivot index found"),t.forEach((h,m)=>{const{constraints:y}=h,{maxSize:v=100,minSize:g=0}=y;m===s?(r=g,a=v):(o+=g,i+=v)});const c=Math.min(a,100-o),d=Math.max(r,100-i),u=e[s];return{valueMax:c,valueMin:d,valueNow:u}}function s2(e,t=document){return Array.from(t.querySelectorAll(`[${Tt.resizeHandleId}][data-panel-group-id="${e}"]`))}function Vhe(e,t,n=document){const a=s2(e,n).findIndex(o=>o.getAttribute(Tt.resizeHandleId)===t);return a??null}function Hhe(e,t,n){const r=Vhe(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function Sgt(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function Bhe(e,t=document){if(Sgt(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function JD(e,t=document){const n=t.querySelector(`[${Tt.resizeHandleId}="${e}"]`);return n||null}function _gt(e,t,n,r=document){var a,o,i,s;const c=JD(t,r),d=s2(e,r),u=c?d.indexOf(c):-1,h=(a=(o=n[u])===null||o===void 0?void 0:o.id)!==null&&a!==void 0?a:null,m=(i=(s=n[u+1])===null||s===void 0?void 0:s.id)!==null&&i!==void 0?i:null;return[h,m]}function Ngt({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:a,panelGroupElement:o,setLayout:i}){w.useRef({didWarnAboutMissingResizeHandle:!1}),$d(()=>{if(!o)return;const s=s2(n,o);for(let c=0;c<a.length-1;c++){const{valueMax:d,valueMin:u,valueNow:h}=Cgt({layout:r,panelsArray:a,pivotIndices:[c,c+1]}),m=s[c];if(m!=null){const y=a[c];Be(y,`No panel data found for index "${c}"`),m.setAttribute("aria-controls",y.id),m.setAttribute("aria-valuemax",""+Math.round(d)),m.setAttribute("aria-valuemin",""+Math.round(u)),m.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{s.forEach((c,d)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[n,r,a,o]),w.useEffect(()=>{if(!o)return;const s=t.current;Be(s,"Eager values not found");const{panelDataArray:c}=s,d=Bhe(n,o);Be(d!=null,`No group found for id "${n}"`);const u=s2(n,o);Be(u,`No resize handles found for group id "${n}"`);const h=u.map(m=>{const y=m.getAttribute(Tt.resizeHandleId);Be(y,"Resize handle element has no handle id attribute");const[v,g]=_gt(n,y,c,o);if(v==null||g==null)return()=>{};const b=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const k=c.findIndex(M=>M.id===v);if(k>=0){const M=c[k];Be(M,`No panel data found for index ${k}`);const C=r[k],{collapsedSize:S=0,collapsible:_,minSize:N=0}=M.constraints;if(C!=null&&_){const I=bh({delta:fr(C,S)?N-S:S-C,initialLayout:r,panelConstraints:c.map(A=>A.constraints),pivotIndices:Hhe(n,y,o),prevLayout:r,trigger:"keyboard"});r!==I&&i(I)}}break}}};return m.addEventListener("keydown",b),()=>{m.removeEventListener("keydown",b)}});return()=>{h.forEach(m=>m())}},[o,e,t,n,r,a,i])}function RX(e,t){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 qhe(e,t){const n=e==="horizontal",{x:r,y:a}=ZD(t);return n?r:a}function Igt(e,t,n,r,a){const o=n==="horizontal",i=JD(t,a);Be(i,`No resize handle element found for id "${t}"`);const s=i.getAttribute(Tt.groupId);Be(s,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=r;const d=qhe(n,e),u=Bhe(s,a);Be(u,`No group element found for id "${s}"`);const h=u.getBoundingClientRect(),m=o?h.width:h.height;return(d-c)/m*100}function jgt(e,t,n,r,a,o){if(Phe(e)){const i=n==="horizontal";let s=0;e.shiftKey?s=100:a!=null?s=a:s=10;let c=0;switch(e.key){case"ArrowDown":c=i?0:s;break;case"ArrowLeft":c=i?-s:0;break;case"ArrowRight":c=i?s:0;break;case"ArrowUp":c=i?0:-s;break;case"End":c=100;break;case"Home":c=-100;break}return c}else return r==null?0:Igt(e,t,n,r,o)}function Lgt({panelDataArray:e}){const t=Array(e.length),n=e.map(o=>o.constraints);let r=0,a=100;for(let o=0;o<e.length;o++){const i=n[o];Be(i,`Panel constraints not found for index ${o}`);const{defaultSize:s}=i;s!=null&&(r++,t[o]=s,a-=s)}for(let o=0;o<e.length;o++){const i=n[o];Be(i,`Panel constraints not found for index ${o}`);const{defaultSize:s}=i;if(s!=null)continue;const c=e.length-r,d=a/c;r++,t[o]=d,a-=d}return t}function bu(e,t,n){t.forEach((r,a)=>{const o=e[a];Be(o,`Panel data not found for index ${a}`);const{callbacks:i,constraints:s,id:c}=o,{collapsedSize:d=0,collapsible:u}=s,h=n[c];if(h==null||r!==h){n[c]=r;const{onCollapse:m,onExpand:y,onResize:v}=i;v&&v(r,h),u&&(m||y)&&(y&&(h==null||uo(h,d))&&!uo(r,d)&&y(),m&&(h==null||!uo(h,d))&&uo(r,d)&&m())}})}function cf(e,t){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 Agt({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:a,precision:o=3}){const i=n[a];let s;return i==null?s=e!=null?e.toFixed(o):"1":r.length===1?s="1":s=i.toFixed(o),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function Pgt(e,t=10){let n=null;return(...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...a)},t)}}function DX(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Uhe(e){return`react-resizable-panels:${e}`}function Whe(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:a,order:o}=t;return a?r:o?`${o}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function Ghe(e,t){try{const n=Uhe(e),r=t.getItem(n);if(r){const a=JSON.parse(r);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function Egt(e,t,n){var r,a;const o=(r=Ghe(e,n))!==null&&r!==void 0?r:{},i=Whe(t);return(a=o[i])!==null&&a!==void 0?a:null}function Rgt(e,t,n,r,a){var o;const i=Uhe(e),s=Whe(t),c=(o=Ghe(e,a))!==null&&o!==void 0?o:{};c[s]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{a.setItem(i,JSON.stringify(c))}catch(d){console.error(d)}}function OX({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((o,i)=>o+i,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(o=>`${o}%`).join(", ")}`);if(!fr(r,100)&&n.length>0)for(let o=0;o<t.length;o++){const i=n[o];Be(i!=null,`No layout data found for index ${o}`);const s=100/r*i;n[o]=s}let a=0;for(let o=0;o<t.length;o++){const i=n[o];Be(i!=null,`No layout data found for index ${o}`);const s=Du({panelConstraints:t,panelIndex:o,size:i});i!=s&&(a+=i-s,n[o]=s)}if(!fr(a,0))for(let o=0;o<t.length;o++){const i=n[o];Be(i!=null,`No layout data found for index ${o}`);const s=i+a,c=Du({panelConstraints:t,panelIndex:o,size:s});if(i!==c&&(a-=c-i,n[o]=c,fr(a,0)))break}return n}const Dgt=100,xh={getItem:e=>(DX(xh),xh.getItem(e)),setItem:(e,t)=>{DX(xh),xh.setItem(e,t)}},$X={};function Khe({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:a,id:o=null,onLayout:i=null,keyboardResizeBy:s=null,storage:c=xh,style:d,tagName:u="div",...h}){const m=_q(o),y=w.useRef(null),[v,g]=w.useState(null),[b,x]=w.useState([]),k=wgt(),M=w.useRef({}),C=w.useRef(new Map),S=w.useRef(0),_=w.useRef({autoSaveId:e,direction:r,dragState:v,id:m,keyboardResizeBy:s,onLayout:i,storage:c}),N=w.useRef({layout:b,panelDataArray:[],panelDataArrayChanged:!1});w.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),w.useImperativeHandle(a,()=>({getId:()=>_.current.id,getLayout:()=>{const{layout:$}=N.current;return $},setLayout:$=>{const{onLayout:G}=_.current,{layout:z,panelDataArray:H}=N.current,D=OX({layout:$,panelConstraints:H.map(Y=>Y.constraints)});RX(z,D)||(x(D),N.current.layout=D,G&&G(D),bu(H,D,M.current))}}),[]),$d(()=>{_.current.autoSaveId=e,_.current.direction=r,_.current.dragState=v,_.current.id=m,_.current.onLayout=i,_.current.storage=c}),Ngt({committedValuesRef:_,eagerValuesRef:N,groupId:m,layout:b,panelDataArray:N.current.panelDataArray,setLayout:x,panelGroupElement:y.current}),w.useEffect(()=>{const{panelDataArray:$}=N.current;if(e){if(b.length===0||b.length!==$.length)return;let G=$X[e];G==null&&(G=Pgt(Rgt,Dgt),$X[e]=G);const z=[...$],H=new Map(C.current);G(e,z,H,b,c)}},[e,b,c]),w.useEffect(()=>{});const I=w.useCallback($=>{const{onLayout:G}=_.current,{layout:z,panelDataArray:H}=N.current;if($.constraints.collapsible){const D=H.map(ae=>ae.constraints),{collapsedSize:Y=0,panelSize:V,pivotIndices:Q}=qi(H,$,z);if(Be(V!=null,`Panel size not found for panel "${$.id}"`),!uo(V,Y)){C.current.set($.id,V);const X=Su(H,$)===H.length-1?V-Y:Y-V,ye=bh({delta:X,initialLayout:z,panelConstraints:D,pivotIndices:Q,prevLayout:z,trigger:"imperative-api"});cf(z,ye)||(x(ye),N.current.layout=ye,G&&G(ye),bu(H,ye,M.current))}}},[]),A=w.useCallback(($,G)=>{const{onLayout:z}=_.current,{layout:H,panelDataArray:D}=N.current;if($.constraints.collapsible){const Y=D.map(ie=>ie.constraints),{collapsedSize:V=0,panelSize:Q=0,minSize:ae=0,pivotIndices:X}=qi(D,$,H),ye=G??ae;if(uo(Q,V)){const ie=C.current.get($.id),Ee=ie!=null&&ie>=ye?ie:ye,Fe=Su(D,$)===D.length-1?Q-Ee:Ee-Q,Ge=bh({delta:Fe,initialLayout:H,panelConstraints:Y,pivotIndices:X,prevLayout:H,trigger:"imperative-api"});cf(H,Ge)||(x(Ge),N.current.layout=Ge,z&&z(Ge),bu(D,Ge,M.current))}}},[]),T=w.useCallback($=>{const{layout:G,panelDataArray:z}=N.current,{panelSize:H}=qi(z,$,G);return Be(H!=null,`Panel size not found for panel "${$.id}"`),H},[]),P=w.useCallback(($,G)=>{const{panelDataArray:z}=N.current,H=Su(z,$);return Agt({defaultSize:G,dragState:v,layout:b,panelData:z,panelIndex:H})},[v,b]),F=w.useCallback($=>{const{layout:G,panelDataArray:z}=N.current,{collapsedSize:H=0,collapsible:D,panelSize:Y}=qi(z,$,G);return Be(Y!=null,`Panel size not found for panel "${$.id}"`),D===!0&&uo(Y,H)},[]),U=w.useCallback($=>{const{layout:G,panelDataArray:z}=N.current,{collapsedSize:H=0,collapsible:D,panelSize:Y}=qi(z,$,G);return Be(Y!=null,`Panel size not found for panel "${$.id}"`),!D||Zd(Y,H)>0},[]),W=w.useCallback($=>{const{panelDataArray:G}=N.current;G.push($),G.sort((z,H)=>{const D=z.order,Y=H.order;return D==null&&Y==null?0:D==null?-1:Y==null?1:D-Y}),N.current.panelDataArrayChanged=!0,k()},[k]);$d(()=>{if(N.current.panelDataArrayChanged){N.current.panelDataArrayChanged=!1;const{autoSaveId:$,onLayout:G,storage:z}=_.current,{layout:H,panelDataArray:D}=N.current;let Y=null;if($){const Q=Egt($,D,z);Q&&(C.current=new Map(Object.entries(Q.expandToSizes)),Y=Q.layout)}Y==null&&(Y=Lgt({panelDataArray:D}));const V=OX({layout:Y,panelConstraints:D.map(Q=>Q.constraints)});RX(H,V)||(x(V),N.current.layout=V,G&&G(V),bu(D,V,M.current))}}),$d(()=>{const $=N.current;return()=>{$.layout=[]}},[]);const Z=w.useCallback($=>{let G=!1;const z=y.current;return z&&window.getComputedStyle(z,null).getPropertyValue("direction")==="rtl"&&(G=!0),function(D){D.preventDefault();const Y=y.current;if(!Y)return()=>null;const{direction:V,dragState:Q,id:ae,keyboardResizeBy:X,onLayout:ye}=_.current,{layout:ie,panelDataArray:Ee}=N.current,{initialLayout:Pe}=Q??{},Fe=Hhe(ae,$,Y);let Ge=jgt(D,$,V,Q,X,Y);const dt=V==="horizontal";dt&&G&&(Ge=-Ge);const mt=Ee.map(ne=>ne.constraints),Ft=bh({delta:Ge,initialLayout:Pe??ie,panelConstraints:mt,pivotIndices:Fe,prevLayout:ie,trigger:Phe(D)?"keyboard":"mouse-or-touch"}),Xe=!cf(ie,Ft);(Ehe(D)||Rhe(D))&&S.current!=Ge&&(S.current=Ge,!Xe&&Ge!==0?dt?RT($,Ge<0?Ohe:$he):RT($,Ge<0?The:zhe):RT($,0)),Xe&&(x(Ft),N.current.layout=Ft,ye&&ye(Ft),bu(Ee,Ft,M.current))}},[]),L=w.useCallback(($,G)=>{const{onLayout:z}=_.current,{layout:H,panelDataArray:D}=N.current,Y=D.map(ie=>ie.constraints),{panelSize:V,pivotIndices:Q}=qi(D,$,H);Be(V!=null,`Panel size not found for panel "${$.id}"`);const X=Su(D,$)===D.length-1?V-G:G-V,ye=bh({delta:X,initialLayout:H,panelConstraints:Y,pivotIndices:Q,prevLayout:H,trigger:"imperative-api"});cf(H,ye)||(x(ye),N.current.layout=ye,z&&z(ye),bu(D,ye,M.current))},[]),R=w.useCallback(($,G)=>{const{layout:z,panelDataArray:H}=N.current,{collapsedSize:D=0,collapsible:Y}=G,{collapsedSize:V=0,collapsible:Q,maxSize:ae=100,minSize:X=0}=$.constraints,{panelSize:ye}=qi(H,$,z);ye!=null&&(Y&&Q&&uo(ye,D)?uo(D,V)||L($,V):ye<X?L($,X):ye>ae&&L($,ae))},[L]),E=w.useCallback(($,G)=>{const{direction:z}=_.current,{layout:H}=N.current;if(!y.current)return;const D=JD($,y.current);Be(D,`Drag handle element not found for id "${$}"`);const Y=qhe(z,G);g({dragHandleId:$,dragHandleRect:D.getBoundingClientRect(),initialCursorPosition:Y,initialLayout:H})},[]),O=w.useCallback(()=>{g(null)},[]),J=w.useCallback($=>{const{panelDataArray:G}=N.current,z=Su(G,$);z>=0&&(G.splice(z,1),delete M.current[$.id],N.current.panelDataArrayChanged=!0,k())},[k]),K=w.useMemo(()=>({collapsePanel:I,direction:r,dragState:v,expandPanel:A,getPanelSize:T,getPanelStyle:P,groupId:m,isPanelCollapsed:F,isPanelExpanded:U,reevaluatePanelConstraints:R,registerPanel:W,registerResizeHandle:Z,resizePanel:L,startDragging:E,stopDragging:O,unregisterPanel:J,panelGroupElement:y.current}),[I,v,r,A,T,P,m,F,U,R,W,Z,L,E,O,J]),B={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return w.createElement(KD.Provider,{value:K},w.createElement(u,{...h,children:t,className:n,id:o,ref:y,style:{...B,...d},[Tt.group]:"",[Tt.groupDirection]:r,[Tt.groupId]:m}))}const Zhe=w.forwardRef((e,t)=>w.createElement(Khe,{...e,forwardedRef:t}));Khe.displayName="PanelGroup";Zhe.displayName="forwardRef(PanelGroup)";function Su(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function qi(e,t,n){const r=Su(e,t),o=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:o}}function Ogt({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){w.useEffect(()=>{if(e||n==null||r==null)return;const a=JD(t,r);if(a==null)return;const o=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),n(i);break}case"F6":{i.preventDefault();const s=a.getAttribute(Tt.groupId);Be(s,`No group element found for id "${s}"`);const c=s2(s,r),d=Vhe(s,t,r);Be(d!==null,`No resize element found for id "${t}"`);const u=i.shiftKey?d>0?d-1:c.length-1:d+1<c.length?d+1:0;c[u].focus();break}}};return a.addEventListener("keydown",o),()=>{a.removeEventListener("keydown",o)}},[r,e,t,n])}function Yhe({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:a,onBlur:o,onClick:i,onDragging:s,onFocus:c,onPointerDown:d,onPointerUp:u,style:h={},tabIndex:m=0,tagName:y="div",...v}){var g,b;const x=w.useRef(null),k=w.useRef({onClick:i,onDragging:s,onPointerDown:d,onPointerUp:u});w.useEffect(()=>{k.current.onClick=i,k.current.onDragging=s,k.current.onPointerDown=d,k.current.onPointerUp=u});const M=w.useContext(KD);if(M===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:C,groupId:S,registerResizeHandle:_,startDragging:N,stopDragging:I,panelGroupElement:A}=M,T=_q(a),[P,F]=w.useState("inactive"),[U,W]=w.useState(!1),[Z,L]=w.useState(null),R=w.useRef({state:P});$d(()=>{R.current.state=P}),w.useEffect(()=>{if(n)L(null);else{const K=_(T);L(()=>K)}},[n,T,_]);const E=(g=r?.coarse)!==null&&g!==void 0?g:15,O=(b=r?.fine)!==null&&b!==void 0?b:5;w.useEffect(()=>{if(n||Z==null)return;const K=x.current;Be(K,"Element ref not attached");let B=!1;return xgt(T,K,C,{coarse:E,fine:O},(G,z,H)=>{if(!z){F("inactive");return}switch(G){case"down":{F("drag"),B=!1,Be(H,'Expected event to be defined for "down" action'),N(T,H);const{onDragging:D,onPointerDown:Y}=k.current;D?.(!0),Y?.();break}case"move":{const{state:D}=R.current;B=!0,D!=="drag"&&F("hover"),Be(H,'Expected event to be defined for "move" action'),Z(H);break}case"up":{F("hover"),I();const{onClick:D,onDragging:Y,onPointerUp:V}=k.current;Y?.(!1),V?.(),B||D?.();break}}})},[E,C,n,O,_,T,Z,N,I]),Ogt({disabled:n,handleId:T,resizeHandler:Z,panelGroupElement:A});const J={touchAction:"none",userSelect:"none"};return w.createElement(y,{...v,children:e,className:t,id:a,onBlur:()=>{W(!1),o?.()},onFocus:()=>{W(!0),c?.()},ref:x,role:"separator",style:{...J,...h},tabIndex:m,[Tt.groupDirection]:C,[Tt.groupId]:S,[Tt.resizeHandle]:"",[Tt.resizeHandleActive]:P==="drag"?"pointer":U?"keyboard":void 0,[Tt.resizeHandleEnabled]:!n,[Tt.resizeHandleId]:T,[Tt.resizeHandleState]:P})}Yhe.displayName="PanelResizeHandle";const $gt=({className:e,...t})=>l.jsx(Zhe,{className:j("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),Tgt=Ahe,zgt=({withHandle:e,className:t,...n})=>l.jsx(Yhe,{className:j("relative flex w-px items-center justify-center bg-[var(--color-border-primary-subtle)] after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&l.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border border-[var(--color-border-primary-subtle)] bg-[var(--color-background-secondary)]",children:l.jsx(oe,{name:"grip-vertical",size:"sm",className:"text-[var(--color-icon-secondary)]"})})}),Fgt={colors:{primary:"var(--color-surface-primary)",secondary:"var(--color-surface-secondary)",textPrimary:"var(--color-text-primary)",textSecondary:"var(--color-text-secondary)",textBrand:"var(--color-text-brand-bold)",backgroundBrand:"var(--color-background-blue-bold)",backgroundBrandSelected:"var(--color-background-blue-subtle-selected)",borderPrimary:"var(--color-border-primary-subtle)",borderBrand:"var(--color-border-brand-bold)",borderFocus:"var(--color-border-focused)"},spacing:{xsm:"var(--space-xsm)",sm:"var(--space-sm)",md:"var(--space-md)",lg:"var(--space-lg)",xlg:"var(--space-xlg)"},sizing:{xsm:"var(--size-xsm)",sm:"var(--size-sm)",md:"var(--size-md)",lg:"var(--size-lg)",xlg:"var(--size-xlg)"}};exports.Accordion=Hst;exports.AccordionContent=ece;exports.AccordionItem=Jse;exports.AccordionTrigger=Qse;exports.ActivityLog=Eoe;exports.ActivityLogChevron=Toe;exports.ActivityLogContent=Doe;exports.ActivityLogDescription=Ooe;exports.ActivityLogHeader=Roe;exports.ActivityLogItem=AE;exports.ActivityLogSeparator=GH;exports.ActivityLogTime=$oe;exports.ActivityLogValue=zoe;exports.Alert=JX;exports.AlertDescription=eJ;exports.AlertDialog=wct;exports.AlertDialogAction=Bce;exports.AlertDialogBody=Vce;exports.AlertDialogCancel=qce;exports.AlertDialogContent=Tce;exports.AlertDialogFooter=Fce;exports.AlertDialogHeader=zce;exports.AlertDialogTitle=Hce;exports.AlertDialogTrigger=Mct;exports.AlertTitle=QX;exports.AppFrame=m0t;exports.AttributesChevron=Koe;exports.AttributesContent=Goe;exports.AttributesGroup=Hoe;exports.AttributesItem=Boe;exports.AttributesLabel=Uoe;exports.AttributesList=Foe;exports.AttributesRow=qoe;exports.AttributesSeparator=Voe;exports.AttributesValue=Woe;exports.AutocompleteSearch=PB;exports.Avatar=to;exports.AvatarFallback=ro;exports.AvatarGroup=jre;exports.AvatarImage=no;exports.Badge=sn;exports.Bookmarks=Za;exports.BookmarksActions=bq;exports.BookmarksContent=vq;exports.BookmarksCreateButton=wq;exports.BookmarksDefaultActions=jhe;exports.BookmarksResetButton=Mq;exports.BookmarksRevertButton=kq;exports.BookmarksSaveButton=Ihe;exports.BookmarksSaveDropdown=Cq;exports.BookmarksSettings=xq;exports.Breadcrumb=Qde;exports.BreadcrumbItem=tue;exports.BreadcrumbLink=nue;exports.BreadcrumbList=eue;exports.BreadcrumbPage=rue;exports.BreadcrumbSeparator=aue;exports.Button=Oe;exports.ButtonGroup=ZR;exports.ButtonGroupSeparator=Vre;exports.ButtonGroupText=Fre;exports.Calendar=Z2;exports.Card=Mp;exports.CardContent=Cp;exports.CardDescription=Hre;exports.CardFooter=Bre;exports.CardHeader=wH;exports.CardTitle=MH;exports.Chart=yre;exports.Checkbox=Mi;exports.Collapsible=xH;exports.CollapsibleContent=KR;exports.CollapsibleTrigger=GR;exports.Combobox=xpt;exports.CommandDialog=Yle;exports.CommandEmpty=ia;exports.CommandGroup=nr;exports.CommandInput=Ta;exports.CommandItem=Cn;exports.CommandList=qr;exports.CountryDropdown=Odt;exports.DEFAULT_DAY_PRESETS=She;exports.DEFAULT_MONTH_PRESETS=Che;exports.DataTable=Xyt;exports.DataTableSettingsMenu=ihe;exports.DatePicker=Dde;exports.DateRangePicker=Ode;exports.Dialog=vce;exports.DialogBody=uB;exports.DialogClose=ict;exports.DialogContent=lB;exports.DialogFooter=hB;exports.DialogHeader=dB;exports.DialogOverlay=cB;exports.DialogPortal=bce;exports.DialogTitle=pB;exports.DialogTrigger=oct;exports.Drawer=X2;exports.DrawerClose=DD;exports.DrawerContent=J2;exports.DrawerDescription=Jde;exports.DrawerFooter=Yde;exports.DrawerHeader=Zde;exports.DrawerOverlay=AB;exports.DrawerPortal=Kde;exports.DrawerTitle=Xde;exports.DrawerTrigger=RD;exports.DropdownMenu=Ao;exports.DropdownMenuContent=za;exports.DropdownMenuGroup=Z2t;exports.DropdownMenuItem=Sn;exports.DropdownMenuLabel=jd;exports.DropdownMenuSeparator=Jr;exports.DropdownMenuTrigger=Fa;exports.Editable=Bot;exports.EditableDisplay=Xoe;exports.EditableField=Joe;exports.EditableInput=Joe;exports.EditablePreview=Xoe;exports.Empty=Uce;exports.EmptyContent=Yce;exports.EmptyDescription=Zce;exports.EmptyHeader=Wce;exports.EmptyMedia=Gce;exports.EmptyTitle=Kce;exports.Field=aie;exports.FieldContent=oie;exports.FieldDescription=cie;exports.FieldError=die;exports.FieldGroup=nie;exports.FieldLabel=iie;exports.FieldLegend=tie;exports.FieldSeparator=lie;exports.FieldSet=Qoe;exports.FieldTitle=sie;exports.FileUpload=Bct;exports.FilterDropdownMenu=_he;exports.FilterPanelContent=gq;exports.Filters=rgt;exports.FixtureStatus=_oe;exports.Flag=kP;exports.FormControl=pie;exports.FormErrorMessage=mie;exports.FormField=uie;exports.FormHelperText=fie;exports.FormLabel=hie;exports.HoverCard=elt;exports.HoverCardContent=kle;exports.HoverCardTrigger=tlt;exports.Icon=oe;exports.Input=Fn;exports.InputGroup=bae;exports.InputGroupAddon=kae;exports.InputGroupButton=wae;exports.InputGroupInput=Cae;exports.InputGroupText=Mae;exports.InputGroupTextarea=Sae;exports.Kbd=Nd;exports.KbdGroup=dde;exports.Label=F2;exports.LinkedChart=sgt;exports.LoadingOverlay=Moe;exports.MonthPicker=SB;exports.MultiCombobox=kpt;exports.Pagination=rq;exports.Popover=Ur;exports.PopoverContent=Sr;exports.PopoverTrigger=sa;exports.Progress=yB;exports.ProgressDots=Soe;exports.Pulse=Coe;exports.RadioGroup=NH;exports.RadioGroupItem=CE;exports.ResizableHandle=zgt;exports.ResizablePanel=Tgt;exports.ResizablePanelGroup=$gt;exports.ScrollArea=xoe;exports.ScrollBar=BH;exports.Select=On;exports.SelectContent=Pn;exports.SelectGroup=Tse;exports.SelectItem=wt;exports.SelectLabel=eB;exports.SelectSeparator=tB;exports.SelectTrigger=An;exports.SelectValue=Xn;exports.Separator=zn;exports.Sheet=y0t;exports.SheetClose=v0t;exports.SheetContent=h1e;exports.SheetDescription=y1e;exports.SheetFooter=f1e;exports.SheetHeader=p1e;exports.SheetOverlay=nq;exports.SheetPortal=u1e;exports.SheetTitle=m1e;exports.SheetTrigger=g0t;exports.Sidebar=RB;exports.SidebarContent=due;exports.SidebarFooter=zB;exports.SidebarGroup=Lu;exports.SidebarGroupAction=uue;exports.SidebarGroupContent=Au;exports.SidebarGroupLabel=zE;exports.SidebarHeader=TB;exports.SidebarInput=iue;exports.SidebarInset=$B;exports.SidebarMenu=Pu;exports.SidebarMenuAction=hue;exports.SidebarMenuBadge=pue;exports.SidebarMenuButton=ui;exports.SidebarMenuItem=Eu;exports.SidebarMenuSkeleton=fue;exports.SidebarMenuSub=FB;exports.SidebarMenuSubButton=HB;exports.SidebarMenuSubItem=VB;exports.SidebarProvider=EB;exports.SidebarRail=OB;exports.SidebarSearchButton=sue;exports.SidebarSearchTrigger=cue;exports.SidebarSeparator=lue;exports.SidebarTrigger=DB;exports.Skeleton=Mr;exports.SkeletonAvatar=qH;exports.SkeletonButton=UH;exports.SkeletonCard=koe;exports.SkeletonTable=woe;exports.Slider=$le;exports.Spinner=fo;exports.Switch=WH;exports.Table=FD;exports.TableBody=HD;exports.TableCaption=w1e;exports.TableCell=Yn;exports.TableFooter=k1e;exports.TableGroupHeader=C1e;exports.TableHead=bi;exports.TableHeader=VD;exports.TableRow=rn;exports.TableSortHeader=M1e;exports.Tabs=ZH;exports.TabsContent=Lie;exports.TabsGroupLabel=Aie;exports.TabsList=YH;exports.TabsTrigger=Sp;exports.Tag=_p;exports.TagGroup=Tle;exports.TextLink=zse;exports.Textarea=IH;exports.Toaster=K0t;exports.Toggle=hD;exports.ToggleGroup=qie;exports.ToggleGroupItem=Uie;exports.Tooltip=Dr;exports.TooltipContent=gr;exports.TooltipProvider=L1;exports.TooltipTrigger=Or;exports.Tree=Fle;exports.ViewModeMenu=che;exports.avatarFallbackVariants=Ire;exports.avatarVariants=Nre;exports.buttonGroupVariants=zre;exports.calculatePresetRange=_F;exports.chartColorSchemes=Qo;exports.checkboxVariants=Xre;exports.cn=j;exports.createChartConfig=FSe;exports.createLinkedChartColumns=cgt;exports.designTokens=Fgt;exports.fieldLegendVariants=eie;exports.fieldVariants=rie;exports.formatDateRange=whe;exports.generateChartColors=zSe;exports.getDaysAgo=SP;exports.getLastMonthEnd=ghe;exports.getLastMonthStart=yhe;exports.getLastQuarterEnd=khe;exports.getLastQuarterStart=yq;exports.getLastWeekEnd=mhe;exports.getLastWeekStart=fhe;exports.getLastYearEnd=bhe;exports.getLastYearStart=vhe;exports.getPresetLabel=Mhe;exports.getQuarterLabel=SF;exports.getThisMonthEnd=uhe;exports.getThisMonthStart=dhe;exports.getThisQuarterEnd=xhe;exports.getThisQuarterStart=mq;exports.getThisWeekEnd=lhe;exports.getThisWeekStart=a0;exports.getThisYearEnd=phe;exports.getThisYearStart=hhe;exports.getToday=_P;exports.inputGroupAddonVariants=xae;exports.radioGroupItemVariants=vae;exports.radioGroupVariants=gae;exports.selectContentVariants=Ose;exports.selectItemVariants=$se;exports.selectTriggerVariants=Dse;exports.skeletonVariants=Yz;exports.statusConfig=Xz;exports.tableCellVariants=b1e;exports.tableHeaderVariants=x1e;exports.tableRowVariants=v1e;exports.tableVariants=g1e;exports.toast=O0t;exports.useBookmarksActions=iu;exports.useCountryData=$dt;exports.useIsDesktop=ED;exports.useMediaQuery=Uht;exports.useSidebar=D1;
|
|
145
|
+
`},smt={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 cmt(e){let{announcements:t=smt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=imt}=e;const{announce:o,announcement:i}=rmt(),s=r0("DndLiveRegion"),[c,d]=w.useState(!1);if(w.useEffect(()=>{d(!0)},[]),amt(w.useMemo(()=>({onDragStart(h){let{active:m}=h;o(t.onDragStart({active:m}))},onDragMove(h){let{active:m,over:y}=h;t.onDragMove&&o(t.onDragMove({active:m,over:y}))},onDragOver(h){let{active:m,over:y}=h;o(t.onDragOver({active:m,over:y}))},onDragEnd(h){let{active:m,over:y}=h;o(t.onDragEnd({active:m,over:y}))},onDragCancel(h){let{active:m,over:y}=h;o(t.onDragCancel({active:m,over:y}))}}),[o,t])),!c)return null;const u=w.createElement(w.Fragment,null,w.createElement(tmt,{id:r,value:a.draggable}),w.createElement(nmt,{id:s,announcement:i}));return n?$r.createPortal(u,n):u}var on;(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"})(on||(on={}));function qE(){}function iX(e,t){return w.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function lmt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return w.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const la=Object.freeze({x:0,y:0});function dmt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function umt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function hmt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function pmt(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function sX(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}}const fmt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=sX(t,t.left,t.top),o=[];for(const i of r){const{id:s}=i,c=n.get(s);if(c){const d=dmt(sX(c),a);o.push({id:s,data:{droppableContainer:i,value:d}})}}return o.sort(umt)};function mmt(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),i=a-r,s=o-n;if(r<a&&n<o){const c=t.width*t.height,d=e.width*e.height,u=i*s,h=u/(c+d-u);return Number(h.toFixed(4))}return 0}const ymt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const o of r){const{id:i}=o,s=n.get(i);if(s){const c=mmt(s,t);c>0&&a.push({id:i,data:{droppableContainer:o,value:c}})}}return a.sort(hmt)};function gmt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function F1e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:la}function vmt(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return a.reduce((i,s)=>({...i,top:i.top+e*s.y,bottom:i.bottom+e*s.y,left:i.left+e*s.x,right:i.right+e*s.x}),{...n})}}const bmt=vmt(1);function xmt(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function kmt(e,t,n){const r=xmt(t);if(!r)return e;const{scaleX:a,scaleY:o,x:i,y:s}=r,c=e.left-i-(1-a)*parseFloat(n),d=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=a?e.width/a:e.width,h=o?e.height/o:e.height;return{width:u,height:h,top:d,right:c+u,bottom:d+h,left:c}}const wmt={ignoreTransform:!1};function T1(e,t){t===void 0&&(t=wmt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=sr(e).getComputedStyle(e);d&&(n=kmt(n,d,u))}const{top:r,left:a,width:o,height:i,bottom:s,right:c}=n;return{top:r,left:a,width:o,height:i,bottom:s,right:c}}function cX(e){return T1(e,{ignoreTransform:!0})}function Mmt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Cmt(e,t){return t===void 0&&(t=sr(e).getComputedStyle(e)),t.position==="fixed"}function Smt(e,t){t===void 0&&(t=sr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const o=t[a];return typeof o=="string"?n.test(o):!1})}function uq(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(cq(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!t0(a)||$1e(a)||n.includes(a))return n;const o=sr(e).getComputedStyle(a);return a!==e&&Smt(a,o)&&n.push(a),Cmt(a,o)?n:r(a.parentNode)}return e?r(e):n}function V1e(e){const[t]=uq(e,1);return t??null}function NT(e){return!UD||!e?null:O1(e)?e:sq(e)?cq(e)||e===$1(e).scrollingElement?window:t0(e)?e:null:null}function H1e(e){return O1(e)?e.scrollX:e.scrollLeft}function B1e(e){return O1(e)?e.scrollY:e.scrollTop}function wF(e){return{x:H1e(e),y:B1e(e)}}var gn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(gn||(gn={}));function q1e(e){return!UD||!e?!1:e===document.scrollingElement}function U1e(e){const t={x:0,y:0},n=q1e(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:a,isLeft:o,isBottom:i,isRight:s,maxScroll:r,minScroll:t}}const _mt={x:.2,y:.2};function Nmt(e,t,n,r,a){let{top:o,left:i,right:s,bottom:c}=n;r===void 0&&(r=10),a===void 0&&(a=_mt);const{isTop:d,isBottom:u,isLeft:h,isRight:m}=U1e(e),y={x:0,y:0},v={x:0,y:0},g={height:t.height*a.y,width:t.width*a.x};return!d&&o<=t.top+g.height?(y.y=gn.Backward,v.y=r*Math.abs((t.top+g.height-o)/g.height)):!u&&c>=t.bottom-g.height&&(y.y=gn.Forward,v.y=r*Math.abs((t.bottom-g.height-c)/g.height)),!m&&s>=t.right-g.width?(y.x=gn.Forward,v.x=r*Math.abs((t.right-g.width-s)/g.width)):!h&&i<=t.left+g.width&&(y.x=gn.Backward,v.x=r*Math.abs((t.left+g.width-i)/g.width)),{direction:y,speed:v}}function Imt(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function W1e(e){return e.reduce((t,n)=>Gu(t,wF(n)),la)}function jmt(e){return e.reduce((t,n)=>t+H1e(n),0)}function Lmt(e){return e.reduce((t,n)=>t+B1e(n),0)}function Amt(e,t){if(t===void 0&&(t=T1),!e)return;const{top:n,left:r,bottom:a,right:o}=t(e);V1e(e)&&(a<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Pmt=[["x",["left","right"],jmt],["y",["top","bottom"],Lmt]];class hq{constructor(t,n){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;const r=uq(n),a=W1e(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,i,s]of Pmt)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=s(r),u=a[o]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class jp{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Emt(e){const{EventTarget:t}=sr(e);return e instanceof t?e:$1(e)}function IT(e,t){const 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 Rr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Rr||(Rr={}));function lX(e){e.preventDefault()}function Rmt(e){e.stopPropagation()}var rt;(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"})(rt||(rt={}));const G1e={start:[rt.Space,rt.Enter],cancel:[rt.Esc],end:[rt.Space,rt.Enter,rt.Tab]},Dmt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case rt.Right:return{...n,x:n.x+25};case rt.Left:return{...n,x:n.x-25};case rt.Down:return{...n,y:n.y+25};case rt.Up:return{...n,y:n.y-25}}};class K1e{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new jp($1(n)),this.windowListeners=new jp(sr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Rr.Resize,this.handleCancel),this.windowListeners.add(Rr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Rr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Amt(r),n(la)}handleKeyDown(t){if(dq(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:o=G1e,coordinateGetter:i=Dmt,scrollBehavior:s="smooth"}=a,{code:c}=t;if(o.end.includes(c)){this.handleEnd(t);return}if(o.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,u=d?{x:d.left,y:d.top}:la;this.referenceCoordinates||(this.referenceCoordinates=u);const h=i(t,{active:n,context:r.current,currentCoordinates:u});if(h){const m=BE(h,u),y={x:0,y:0},{scrollableAncestors:v}=r.current;for(const g of v){const b=t.code,{isTop:x,isRight:k,isLeft:M,isBottom:C,maxScroll:S,minScroll:_}=U1e(g),N=Imt(g),I={x:Math.min(b===rt.Right?N.right-N.width/2:N.right,Math.max(b===rt.Right?N.left:N.left+N.width/2,h.x)),y:Math.min(b===rt.Down?N.bottom-N.height/2:N.bottom,Math.max(b===rt.Down?N.top:N.top+N.height/2,h.y))},A=b===rt.Right&&!k||b===rt.Left&&!M,T=b===rt.Down&&!C||b===rt.Up&&!x;if(A&&I.x!==h.x){const P=g.scrollLeft+m.x,F=b===rt.Right&&P<=S.x||b===rt.Left&&P>=_.x;if(F&&!m.y){g.scrollTo({left:P,behavior:s});return}F?y.x=g.scrollLeft-P:y.x=b===rt.Right?g.scrollLeft-S.x:g.scrollLeft-_.x,y.x&&g.scrollBy({left:-y.x,behavior:s});break}else if(T&&I.y!==h.y){const P=g.scrollTop+m.y,F=b===rt.Down&&P<=S.y||b===rt.Up&&P>=_.y;if(F&&!m.x){g.scrollTo({top:P,behavior:s});return}F?y.y=g.scrollTop-P:y.y=b===rt.Down?g.scrollTop-S.y:g.scrollTop-_.y,y.y&&g.scrollBy({top:-y.y,behavior:s});break}}this.handleMove(t,Gu(BE(h,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}K1e.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=G1e,onActivation:a}=t,{active:o}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const s=o.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),a?.({event:e.nativeEvent}),!0)}return!1}}];function dX(e){return!!(e&&"distance"in e)}function uX(e){return!!(e&&"delay"in e)}class pq{constructor(t,n,r){var a;r===void 0&&(r=Emt(t.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=t,this.events=n;const{event:o}=t,{target:i}=o;this.props=t,this.events=n,this.document=$1(i),this.documentListeners=new jp(this.document),this.listeners=new jp(r),this.windowListeners=new jp(sr(i)),this.initialCoordinates=(a=kF(o))!=null?a:la,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(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Rr.Resize,this.handleCancel),this.windowListeners.add(Rr.DragStart,lX),this.windowListeners.add(Rr.VisibilityChange,this.handleCancel),this.windowListeners.add(Rr.ContextMenu,lX),this.documentListeners.add(Rr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(uX(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(dX(n)){this.handlePending(n);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(t,n){const{active:r,onPending:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Rr.Click,Rmt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Rr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:o}=this,{onMove:i,options:{activationConstraint:s}}=o;if(!a)return;const c=(n=kF(t))!=null?n:la,d=BE(a,c);if(!r&&s){if(dX(s)){if(s.tolerance!=null&&IT(d,s.tolerance))return this.handleCancel();if(IT(d,s.distance))return this.handleStart()}if(uX(s)&&IT(d,s.tolerance))return this.handleCancel();this.handlePending(s,d);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===rt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Omt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Z1e extends pq{constructor(t){const{event:n}=t,r=$1(n.target);super(t,Omt,r)}}Z1e.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const $mt={move:{name:"mousemove"},end:{name:"mouseup"}};var MF;(function(e){e[e.RightClick=2]="RightClick"})(MF||(MF={}));class Y1e extends pq{constructor(t){super(t,$mt,$1(t.event.target))}}Y1e.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===MF.RightClick?!1:(r?.({event:n}),!0)}}];const jT={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class X1e extends pq{constructor(t){super(t,jT)}static setup(){return window.addEventListener(jT.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(jT.move.name,t)};function t(){}}}X1e.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r?.({event:n}),!0)}}];var Lp;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Lp||(Lp={}));var UE;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(UE||(UE={}));function Tmt(e){let{acceleration:t,activator:n=Lp.Pointer,canScroll:r,draggingRect:a,enabled:o,interval:i=5,order:s=UE.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:m}=e;const y=Fmt({delta:h,disabled:!o}),[v,g]=Yft(),b=w.useRef({x:0,y:0}),x=w.useRef({x:0,y:0}),k=w.useMemo(()=>{switch(n){case Lp.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Lp.DraggableRect:return a}},[n,a,c]),M=w.useRef(null),C=w.useCallback(()=>{const _=M.current;if(!_)return;const N=b.current.x*x.current.x,I=b.current.y*x.current.y;_.scrollBy(N,I)},[]),S=w.useMemo(()=>s===UE.TreeOrder?[...d].reverse():d,[s,d]);w.useEffect(()=>{if(!o||!d.length||!k){g();return}for(const _ of S){if(r?.(_)===!1)continue;const N=d.indexOf(_),I=u[N];if(!I)continue;const{direction:A,speed:T}=Nmt(_,I,k,t,m);for(const P of["x","y"])y[P][A[P]]||(T[P]=0,A[P]=0);if(T.x>0||T.y>0){g(),M.current=_,v(C,i),b.current=T,x.current=A;return}}b.current={x:0,y:0},x.current={x:0,y:0},g()},[t,C,r,g,o,i,JSON.stringify(k),JSON.stringify(y),v,d,S,u,JSON.stringify(m)])}const zmt={x:{[gn.Backward]:!1,[gn.Forward]:!1},y:{[gn.Backward]:!1,[gn.Forward]:!1}};function Fmt(e){let{delta:t,disabled:n}=e;const r=xF(t);return n0(a=>{if(n||!r||!a)return zmt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[gn.Backward]:a.x[gn.Backward]||o.x===-1,[gn.Forward]:a.x[gn.Forward]||o.x===1},y:{[gn.Backward]:a.y[gn.Backward]||o.y===-1,[gn.Forward]:a.y[gn.Forward]||o.y===1}}},[n,t,r])}function Vmt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return n0(a=>{var o;return t==null?null:(o=r??a)!=null?o:null},[r,t])}function Hmt(e,t){return w.useMemo(()=>e.reduce((n,r)=>{const{sensor:a}=r,o=a.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...o]},[]),[e,t])}var o2;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(o2||(o2={}));var CF;(function(e){e.Optimized="optimized"})(CF||(CF={}));const hX=new Map;function Bmt(e,t){let{dragging:n,dependencies:r,config:a}=t;const[o,i]=w.useState(null),{frequency:s,measure:c,strategy:d}=a,u=w.useRef(e),h=b(),m=r2(h),y=w.useCallback(function(x){x===void 0&&(x=[]),!m.current&&i(k=>k===null?x:k.concat(x.filter(M=>!k.includes(M))))},[m]),v=w.useRef(null),g=n0(x=>{if(h&&!n)return hX;if(!x||x===hX||u.current!==e||o!=null){const k=new Map;for(let M of e){if(!M)continue;if(o&&o.length>0&&!o.includes(M.id)&&M.rect.current){k.set(M.id,M.rect.current);continue}const C=M.node.current,S=C?new hq(c(C),C):null;M.rect.current=S,S&&k.set(M.id,S)}return k}return x},[e,o,n,h,c]);return w.useEffect(()=>{u.current=e},[e]),w.useEffect(()=>{h||y()},[n,h]),w.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),w.useEffect(()=>{h||typeof s!="number"||v.current!==null||(v.current=setTimeout(()=>{y(),v.current=null},s))},[s,h,y,...r]),{droppableRects:g,measureDroppableContainers:y,measuringScheduled:o!=null};function b(){switch(d){case o2.Always:return!1;case o2.BeforeDragging:return n;default:return!n}}}function J1e(e,t){return n0(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function qmt(e,t){return J1e(e,t)}function Umt(e){let{callback:t,disabled:n}=e;const r=lq(t),a=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return w.useEffect(()=>()=>a?.disconnect(),[a]),a}function WD(e){let{callback:t,disabled:n}=e;const r=lq(t),a=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return w.useEffect(()=>()=>a?.disconnect(),[a]),a}function Wmt(e){return new hq(T1(e),e)}function pX(e,t,n){t===void 0&&(t=Wmt);const[r,a]=w.useState(null);function o(){a(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const i=Umt({callback(c){if(e)for(const d of c){const{type:u,target:h}=d;if(u==="childList"&&h instanceof HTMLElement&&h.contains(e)){o();break}}}}),s=WD({callback:o});return Va(()=>{o(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),r}function Gmt(e){const t=J1e(e);return F1e(e,t)}const fX=[];function Kmt(e){const t=w.useRef(e),n=n0(r=>e?r&&r!==fX&&e&&t.current&&e.parentNode===t.current.parentNode?r:uq(e):fX,[e]);return w.useEffect(()=>{t.current=e},[e]),n}function Zmt(e){const[t,n]=w.useState(null),r=w.useRef(e),a=w.useCallback(o=>{const i=NT(o.target);i&&n(s=>s?(s.set(i,wF(i)),new Map(s)):null)},[]);return w.useEffect(()=>{const o=r.current;if(e!==o){i(o);const s=e.map(c=>{const d=NT(c);return d?(d.addEventListener("scroll",a,{passive:!0}),[d,wF(d)]):null}).filter(c=>c!=null);n(s.length?new Map(s):null),r.current=e}return()=>{i(e),i(o)};function i(s){s.forEach(c=>{const d=NT(c);d?.removeEventListener("scroll",a)})}},[a,e]),w.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>Gu(o,i),la):W1e(e):la,[e,t])}function mX(e,t){t===void 0&&(t=[]);const n=w.useRef(null);return w.useEffect(()=>{n.current=null},t),w.useEffect(()=>{const r=e!==la;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?BE(e,n.current):la}function Ymt(e){w.useEffect(()=>{if(!UD)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Xmt(e,t){return w.useMemo(()=>e.reduce((n,r)=>{let{eventName:a,handler:o}=r;return n[a]=i=>{o(i,t)},n},{}),[e,t])}function Q1e(e){return w.useMemo(()=>e?Mmt(e):null,[e])}const yX=[];function Jmt(e,t){t===void 0&&(t=T1);const[n]=e,r=Q1e(n?sr(n):null),[a,o]=w.useState(yX);function i(){o(()=>e.length?e.map(c=>q1e(c)?r:new hq(t(c),c)):yX)}const s=WD({callback:i});return Va(()=>{s?.disconnect(),i(),e.forEach(c=>s?.observe(c))},[e]),a}function Qmt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return t0(t)?t:e}function eyt(e){let{measure:t}=e;const[n,r]=w.useState(null),a=w.useCallback(d=>{for(const{target:u}of d)if(t0(u)){r(h=>{const m=t(u);return h?{...h,width:m.width,height:m.height}:m});break}},[t]),o=WD({callback:a}),i=w.useCallback(d=>{const u=Qmt(d);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[s,c]=HE(i);return w.useMemo(()=>({nodeRef:s,rect:n,setRef:c}),[n,s,c])}const tyt=[{sensor:Z1e,options:{}},{sensor:K1e,options:{}}],nyt={current:{}},CP={draggable:{measure:cX},droppable:{measure:cX,strategy:o2.WhileDragging,frequency:CF.Optimized},dragOverlay:{measure:T1}};class Ap extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const ryt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ap,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:qE},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:CP,measureDroppableContainers:qE,windowRect:null,measuringScheduled:!1},ayt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:qE,draggableNodes:new Map,over:null,measureDroppableContainers:qE},GD=w.createContext(ayt),ehe=w.createContext(ryt);function oyt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ap}}}function iyt(e,t){switch(t.type){case on.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case on.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 on.DragEnd:case on.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case on.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new Ap(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case on.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ap(e.droppable.containers);return i.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:i}}}case on.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const o=new Ap(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function syt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=w.useContext(GD),o=xF(r),i=xF(n?.id);return w.useEffect(()=>{if(!t&&!r&&o&&i!=null){if(!dq(o)||document.activeElement===o.target)return;const s=a.get(i);if(!s)return;const{activatorNode:c,node:d}=s;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const h=Qft(u);if(h){h.focus();break}}})}},[r,t,a,i,o]),null}function cyt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,o)=>o({transform:a,...r}),n):n}function lyt(e){return w.useMemo(()=>({draggable:{...CP.draggable,...e?.draggable},droppable:{...CP.droppable,...e?.droppable},dragOverlay:{...CP.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function dyt(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const o=w.useRef(!1),{x:i,y:s}=typeof a=="boolean"?{x:a,y:a}:a;Va(()=>{if(!i&&!s||!t){o.current=!1;return}if(o.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const u=n(d),h=F1e(u,r);if(i||(h.x=0),s||(h.y=0),o.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const m=V1e(d);m&&m.scrollBy({top:h.y,left:h.x})}},[t,i,s,r,n])}const the=w.createContext({...la,scaleX:1,scaleY:1});var hi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(hi||(hi={}));const uyt=w.memo(function(t){var n,r,a,o;let{id:i,accessibility:s,autoScroll:c=!0,children:d,sensors:u=tyt,collisionDetection:h=ymt,measuring:m,modifiers:y,...v}=t;const g=w.useReducer(iyt,void 0,oyt),[b,x]=g,[k,M]=omt(),[C,S]=w.useState(hi.Uninitialized),_=C===hi.Initialized,{draggable:{active:N,nodes:I,translate:A},droppable:{containers:T}}=b,P=N!=null?I.get(N):null,F=w.useRef({initial:null,translated:null}),U=w.useMemo(()=>{var ue;return N!=null?{id:N,data:(ue=P?.data)!=null?ue:nyt,rect:F}:null},[N,P]),W=w.useRef(null),[Z,L]=w.useState(null),[R,E]=w.useState(null),O=r2(v,Object.values(v)),J=r0("DndDescribedBy",i),K=w.useMemo(()=>T.getEnabled(),[T]),B=lyt(m),{droppableRects:$,measureDroppableContainers:G,measuringScheduled:z}=Bmt(K,{dragging:_,dependencies:[A.x,A.y],config:B.droppable}),H=Vmt(I,N),D=w.useMemo(()=>R?kF(R):null,[R]),Y=me(),V=qmt(H,B.draggable.measure);dyt({activeNode:N!=null?I.get(N):null,config:Y.layoutShiftCompensation,initialRect:V,measure:B.draggable.measure});const Q=pX(H,B.draggable.measure,V),ae=pX(H?H.parentElement:null),X=w.useRef({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:$,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ye=T.getNodeFor((n=X.current.over)==null?void 0:n.id),ie=eyt({measure:B.dragOverlay.measure}),Ee=(r=ie.nodeRef.current)!=null?r:H,Pe=_?(a=ie.rect)!=null?a:Q:null,Fe=!!(ie.nodeRef.current&&ie.rect),Ge=Gmt(Fe?null:Q),dt=Q1e(Ee?sr(Ee):null),mt=Kmt(_?ye??H:null),Ft=Jmt(mt),Xe=cyt(y,{transform:{x:A.x-Ge.x,y:A.y-Ge.y,scaleX:1,scaleY:1},activatorEvent:R,active:U,activeNodeRect:Q,containerNodeRect:ae,draggingNodeRect:Pe,over:X.current.over,overlayNodeRect:ie.rect,scrollableAncestors:mt,scrollableAncestorRects:Ft,windowRect:dt}),ne=D?Gu(D,A):null,Se=Zmt(mt),Ae=mX(Se),Ke=mX(Se,[Q]),tt=Gu(Xe,Ae),bt=Pe?bmt(Pe,Xe):null,Zt=U&&bt?h({active:U,collisionRect:bt,droppableRects:$,droppableContainers:K,pointerCoordinates:ne}):null,yt=pmt(Zt,"id"),[jt,Vt]=w.useState(null),Lt=Fe?Xe:Gu(Xe,Ke),cr=gmt(Lt,(o=jt?.rect)!=null?o:null,Q),lr=w.useRef(null),$t=w.useCallback((ue,Le)=>{let{sensor:ce,options:Re}=Le;if(W.current==null)return;const Ve=I.get(W.current);if(!Ve)return;const He=ue.nativeEvent,ot=new ce({active:W.current,activeNode:Ve,event:He,options:Re,context:X,onAbort(ze){if(!I.get(ze))return;const{onDragAbort:gt}=O.current,At={id:ze};gt?.(At),k({type:"onDragAbort",event:At})},onPending(ze,Ht,gt,At){if(!I.get(ze))return;const{onDragPending:Rn}=O.current,Kr={id:ze,constraint:Ht,initialCoordinates:gt,offset:At};Rn?.(Kr),k({type:"onDragPending",event:Kr})},onStart(ze){const Ht=W.current;if(Ht==null)return;const gt=I.get(Ht);if(!gt)return;const{onDragStart:At}=O.current,fa={activatorEvent:He,active:{id:Ht,data:gt.data,rect:F}};$r.unstable_batchedUpdates(()=>{At?.(fa),S(hi.Initializing),x({type:on.DragStart,initialCoordinates:ze,active:Ht}),k({type:"onDragStart",event:fa}),L(lr.current),E(He)})},onMove(ze){x({type:on.DragMove,coordinates:ze})},onEnd:qe(on.DragEnd),onCancel:qe(on.DragCancel)});lr.current=ot;function qe(ze){return async function(){const{active:gt,collisions:At,over:fa,scrollAdjustedTranslate:Rn}=X.current;let Kr=null;if(gt&&Rn){const{cancelDrop:Ti}=O.current;Kr={activatorEvent:He,active:gt,collisions:At,delta:Rn,over:fa},ze===on.DragEnd&&typeof Ti=="function"&&await Promise.resolve(Ti(Kr))&&(ze=on.DragCancel)}W.current=null,$r.unstable_batchedUpdates(()=>{x({type:ze}),S(hi.Uninitialized),Vt(null),L(null),E(null),lr.current=null;const Ti=ze===on.DragEnd?"onDragEnd":"onDragCancel";if(Kr){const z1=O.current[Ti];z1?.(Kr),k({type:Ti,event:Kr})}})}}},[I]),In=w.useCallback((ue,Le)=>(ce,Re)=>{const Ve=ce.nativeEvent,He=I.get(Re);if(W.current!==null||!He||Ve.dndKit||Ve.defaultPrevented)return;const ot={active:He};ue(ce,Le.options,ot)===!0&&(Ve.dndKit={capturedBy:Le.sensor},W.current=Re,$t(ce,Le))},[I,$t]),dr=Hmt(u,In);Ymt(u),Va(()=>{Q&&C===hi.Initializing&&S(hi.Initialized)},[Q,C]),w.useEffect(()=>{const{onDragMove:ue}=O.current,{active:Le,activatorEvent:ce,collisions:Re,over:Ve}=X.current;if(!Le||!ce)return;const He={active:Le,activatorEvent:ce,collisions:Re,delta:{x:tt.x,y:tt.y},over:Ve};$r.unstable_batchedUpdates(()=>{ue?.(He),k({type:"onDragMove",event:He})})},[tt.x,tt.y]),w.useEffect(()=>{const{active:ue,activatorEvent:Le,collisions:ce,droppableContainers:Re,scrollAdjustedTranslate:Ve}=X.current;if(!ue||W.current==null||!Le||!Ve)return;const{onDragOver:He}=O.current,ot=Re.get(yt),qe=ot&&ot.rect.current?{id:ot.id,rect:ot.rect.current,data:ot.data,disabled:ot.disabled}:null,ze={active:ue,activatorEvent:Le,collisions:ce,delta:{x:Ve.x,y:Ve.y},over:qe};$r.unstable_batchedUpdates(()=>{Vt(qe),He?.(ze),k({type:"onDragOver",event:ze})})},[yt]),Va(()=>{X.current={activatorEvent:R,active:U,activeNode:H,collisionRect:bt,collisions:Zt,droppableRects:$,draggableNodes:I,draggingNode:Ee,draggingNodeRect:Pe,droppableContainers:T,over:jt,scrollableAncestors:mt,scrollAdjustedTranslate:tt},F.current={initial:Pe,translated:bt}},[U,H,Zt,bt,I,Ee,Pe,$,T,jt,mt,tt]),Tmt({...Y,delta:A,draggingRect:bt,pointerCoordinates:ne,scrollableAncestors:mt,scrollableAncestorRects:Ft});const le=w.useMemo(()=>({active:U,activeNode:H,activeNodeRect:Q,activatorEvent:R,collisions:Zt,containerNodeRect:ae,dragOverlay:ie,draggableNodes:I,droppableContainers:T,droppableRects:$,over:jt,measureDroppableContainers:G,scrollableAncestors:mt,scrollableAncestorRects:Ft,measuringConfiguration:B,measuringScheduled:z,windowRect:dt}),[U,H,Q,R,Zt,ae,ie,I,T,$,jt,G,mt,Ft,B,z,dt]),xe=w.useMemo(()=>({activatorEvent:R,activators:dr,active:U,activeNodeRect:Q,ariaDescribedById:{draggable:J},dispatch:x,draggableNodes:I,over:jt,measureDroppableContainers:G}),[R,dr,U,Q,x,J,I,jt,G]);return w.createElement(z1e.Provider,{value:M},w.createElement(GD.Provider,{value:xe},w.createElement(ehe.Provider,{value:le},w.createElement(the.Provider,{value:cr},d)),w.createElement(syt,{disabled:s?.restoreFocus===!1})),w.createElement(cmt,{...s,hiddenTextDescribedById:J}));function me(){const ue=Z?.autoScrollEnabled===!1,Le=typeof c=="object"?c.enabled===!1:c===!1,ce=_&&!ue&&!Le;return typeof c=="object"?{...c,enabled:ce}:{enabled:ce}}}),hyt=w.createContext(null),gX="button",pyt="Draggable";function fyt(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const o=r0(pyt),{activators:i,activatorEvent:s,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:m}=w.useContext(GD),{role:y=gX,roleDescription:v="draggable",tabIndex:g=0}=a??{},b=c?.id===t,x=w.useContext(b?the:hyt),[k,M]=HE(),[C,S]=HE(),_=Xmt(i,t),N=r2(n);Va(()=>(h.set(t,{id:t,key:o,node:k,activatorNode:C,data:N}),()=>{const A=h.get(t);A&&A.key===o&&h.delete(t)}),[h,t]);const I=w.useMemo(()=>({role:y,tabIndex:g,"aria-disabled":r,"aria-pressed":b&&y===gX?!0:void 0,"aria-roledescription":v,"aria-describedby":u.draggable}),[r,y,g,b,v,u.draggable]);return{active:c,activatorEvent:s,activeNodeRect:d,attributes:I,isDragging:b,listeners:r?void 0:_,node:k,over:m,setNodeRef:M,setActivatorNodeRef:S,transform:x}}function myt(){return w.useContext(ehe)}const yyt="Droppable",gyt={timeout:25};function vyt(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const o=r0(yyt),{active:i,dispatch:s,over:c,measureDroppableContainers:d}=w.useContext(GD),u=w.useRef({disabled:n}),h=w.useRef(!1),m=w.useRef(null),y=w.useRef(null),{disabled:v,updateMeasurementsFor:g,timeout:b}={...gyt,...a},x=r2(g??r),k=w.useCallback(()=>{if(!h.current){h.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),y.current=null},b)},[b]),M=WD({callback:k,disabled:v||!i}),C=w.useCallback((I,A)=>{M&&(A&&(M.unobserve(A),h.current=!1),I&&M.observe(I))},[M]),[S,_]=HE(C),N=r2(t);return w.useEffect(()=>{!M||!S.current||(M.disconnect(),h.current=!1,M.observe(S.current))},[S,M]),w.useEffect(()=>(s({type:on.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:m,data:N}}),()=>s({type:on.UnregisterDroppable,key:o,id:r})),[r]),w.useEffect(()=>{n!==u.current.disabled&&(s({type:on.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,s]),{active:i,rect:m,isOver:c?.id===r,node:S,over:c,setNodeRef:_}}function fq(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function byt(e,t){return e.reduce((n,r,a)=>{const o=t.get(r);return o&&(n[a]=o),n},Array(e.length))}function af(e){return e!==null&&e>=0}function xyt(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 kyt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const of={scaleX:1,scaleY:1},wyt=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:a,overIndex:o,index:i}=e;const s=(t=n[a])!=null?t:r;if(!s)return null;const c=Myt(n,i,a);if(i===a){const d=n[o];return d?{x:a<o?d.left+d.width-(s.left+s.width):d.left-s.left,y:0,...of}:null}return i>a&&i<=o?{x:-s.width-c,y:0,...of}:i<a&&i>=o?{x:s.width+c,y:0,...of}:{x:0,y:0,...of}};function Myt(e,t,n){const r=e[t],a=e[t-1],o=e[t+1];return!r||!a&&!o?0:n<t?a?r.left-(a.left+a.width):o.left-(r.left+r.width):o?o.left-(r.left+r.width):r.left-(a.left+a.width)}const nhe=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e;const o=fq(t,r,n),i=t[a],s=o[a];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}},rhe="Sortable",ahe=w.createContext({activeIndex:-1,containerId:rhe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:nhe,disabled:{draggable:!1,droppable:!1}});function Cyt(e){let{children:t,id:n,items:r,strategy:a=nhe,disabled:o=!1}=e;const{active:i,dragOverlay:s,droppableRects:c,over:d,measureDroppableContainers:u}=myt(),h=r0(rhe,n),m=s.rect!==null,y=w.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),v=i!=null,g=i?y.indexOf(i.id):-1,b=d?y.indexOf(d.id):-1,x=w.useRef(y),k=!xyt(y,x.current),M=b!==-1&&g===-1||k,C=kyt(o);Va(()=>{k&&v&&u(y)},[k,y,v,u]),w.useEffect(()=>{x.current=y},[y]);const S=w.useMemo(()=>({activeIndex:g,containerId:h,disabled:C,disableTransforms:M,items:y,overIndex:b,useDragOverlay:m,sortedRects:byt(y,c),strategy:a}),[g,h,C.draggable,C.droppable,M,y,b,c,m,a]);return w.createElement(ahe.Provider,{value:S},t)}const Syt=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return fq(n,r,a).indexOf(t)},_yt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:o,newIndex:i,previousItems:s,previousContainerId:c,transition:d}=e;return!d||!r||s!==o&&a===i?!1:n?!0:i!==a&&t===c},Nyt={duration:200,easing:"ease"},ohe="transform",Iyt=a2.Transition.toString({property:ohe,duration:0,easing:"linear"}),jyt={roleDescription:"sortable"};function Lyt(e){let{disabled:t,index:n,node:r,rect:a}=e;const[o,i]=w.useState(null),s=w.useRef(n);return Va(()=>{if(!t&&n!==s.current&&r.current){const c=a.current;if(c){const d=T1(r.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&i(u)}}n!==s.current&&(s.current=n)},[t,n,r,a]),w.useEffect(()=>{o&&i(null)},[o]),o}function Ayt(e){let{animateLayoutChanges:t=_yt,attributes:n,disabled:r,data:a,getNewIndex:o=Syt,id:i,strategy:s,resizeObserverConfig:c,transition:d=Nyt}=e;const{items:u,containerId:h,activeIndex:m,disabled:y,disableTransforms:v,sortedRects:g,overIndex:b,useDragOverlay:x,strategy:k}=w.useContext(ahe),M=Pyt(r,y),C=u.indexOf(i),S=w.useMemo(()=>({sortable:{containerId:h,index:C,items:u},...a}),[h,a,C,u]),_=w.useMemo(()=>u.slice(u.indexOf(i)),[u,i]),{rect:N,node:I,isOver:A,setNodeRef:T}=vyt({id:i,data:S,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...c}}),{active:P,activatorEvent:F,activeNodeRect:U,attributes:W,setNodeRef:Z,listeners:L,isDragging:R,over:E,setActivatorNodeRef:O,transform:J}=fyt({id:i,data:S,attributes:{...jyt,...n},disabled:M.draggable}),K=Zft(T,Z),B=!!P,$=B&&!v&&af(m)&&af(b),G=!x&&R,z=G&&$?J:null,D=$?z??(s??k)({rects:g,activeNodeRect:U,activeIndex:m,overIndex:b,index:C}):null,Y=af(m)&&af(b)?o({id:i,items:u,activeIndex:m,overIndex:b}):C,V=P?.id,Q=w.useRef({activeId:V,items:u,newIndex:Y,containerId:h}),ae=u!==Q.current.items,X=t({active:P,containerId:h,isDragging:R,isSorting:B,id:i,index:C,items:u,newIndex:Q.current.newIndex,previousItems:Q.current.items,previousContainerId:Q.current.containerId,transition:d,wasDragging:Q.current.activeId!=null}),ye=Lyt({disabled:!X,index:C,node:I,rect:N});return w.useEffect(()=>{B&&Q.current.newIndex!==Y&&(Q.current.newIndex=Y),h!==Q.current.containerId&&(Q.current.containerId=h),u!==Q.current.items&&(Q.current.items=u)},[B,Y,h,u]),w.useEffect(()=>{if(V===Q.current.activeId)return;if(V!=null&&Q.current.activeId==null){Q.current.activeId=V;return}const Ee=setTimeout(()=>{Q.current.activeId=V},50);return()=>clearTimeout(Ee)},[V]),{active:P,activeIndex:m,attributes:W,data:S,rect:N,index:C,newIndex:Y,items:u,isOver:A,isSorting:B,isDragging:R,listeners:L,node:I,overIndex:b,over:E,setNodeRef:K,setActivatorNodeRef:O,setDroppableNodeRef:T,setDraggableNodeRef:Z,transform:ye??D,transition:ie()};function ie(){if(ye||ae&&Q.current.newIndex===C)return Iyt;if(!(G&&!dq(F)||!d)&&(B||X))return a2.Transition.toString({...d,property:ohe})}}function Pyt(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}rt.Down,rt.Right,rt.Up,rt.Left;function vX(e){if(e?.directionOptions)return e.directionOptions;if(e?.dataType)switch(e.dataType){case"text":return{asc:"A to Z",desc:"Z to A"};case"number":return{asc:"Ascending",desc:"Descending"};case"date":return{asc:"Oldest first",desc:"Newest first"};case"boolean":return{asc:"False first",desc:"True first"}}return{asc:"Ascending",desc:"Descending"}}function ihe({sortableColumns:e,selectedSortColumn:t,sortDirection:n="asc",onSortChange:r,onSortDirectionChange:a,groupableColumns:o,selectedGroupColumn:i,onGroupChange:s,columns:c,visibleColumns:d,onColumnVisibilityChange:u,align:h="end",triggerClassName:m}){const[y,v]=w.useState(""),[g,b]=w.useState(""),x=w.useId(),k=w.useId(),M=w.useId(),C=w.useCallback(L=>{const R=e.find(E=>E.id===L)?.label;b(`Sorting by ${R}`),r?.(L)},[e,r]),S=w.useCallback(L=>{const R=e.find(J=>J.id===t),E=vX(R),O=L==="asc"?E.asc:E.desc;b(`Sort direction: ${O}`),a?.(L)},[e,t,a]),_=w.useCallback(L=>{if(L==="none")b("Grouping cleared");else{const R=o.find(E=>E.id===L)?.label;b(`Grouping by ${R}`)}s?.(L)},[o,s]),N=w.useCallback((L,R)=>{const E=c.find(O=>O.id===L)?.label;b(R?`${E} column shown`:`${E} column hidden`),u?.(L,R)},[c,u]),I=e.length>0,A=o.length>0,T=c.length>0,P=I||A,F=w.useMemo(()=>e.find(L=>L.id===t),[e,t]),U=w.useMemo(()=>vX(F),[F]),W=w.useMemo(()=>{if(!y)return c;const L=y.toLowerCase();return c.filter(R=>R.label.toLowerCase().includes(L))},[c,y]),Z=c.length>=20;return l.jsxs(Ao,{children:[l.jsx(Fa,{asChild:!0,children:l.jsx(Oe,{size:"md",icon:"settings","aria-label":"Table settings",className:m})}),l.jsxs(za,{align:h,className:"w-72 max-w-[90vw]",children:[P&&l.jsx("div",{className:"p-3",children:l.jsxs("div",{className:"space-y-4",children:[I&&l.jsxs("div",{className:"space-y-2",role:"group","aria-labelledby":x,children:[l.jsx("h4",{id:x,className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Sorting"}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs(On,{value:t,onValueChange:C,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to sort"})}),l.jsx(Pn,{children:e.map(L=>l.jsx(wt,{value:L.id,children:L.label},L.id))})]}),t&&l.jsxs(On,{value:n,onValueChange:L=>S(L),children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{})}),l.jsxs(Pn,{children:[l.jsx(wt,{value:"asc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-narrow-wide",size:"sm"}),l.jsx("span",{children:U.asc})]})}),l.jsx(wt,{value:"desc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-wide-narrow",size:"sm"}),l.jsx("span",{children:U.desc})]})})]})]})]})]}),A&&l.jsxs("div",{className:"space-y-2",role:"group","aria-labelledby":k,children:[l.jsx("h4",{id:k,className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Grouping"}),l.jsxs(On,{value:i||"none",onValueChange:_,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to group by"})}),l.jsxs(Pn,{children:[l.jsx(wt,{value:"none",children:"None"}),o.map(L=>l.jsx(wt,{value:L.id,children:L.label},L.id))]})]})]})]})}),P&&T&&l.jsx(Jr,{}),T&&l.jsx("div",{className:"p-3",children:l.jsxs("div",{className:"space-y-2",role:"group","aria-labelledby":M,children:[l.jsx("h4",{id:M,className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Display columns"}),Z&&l.jsx(Fn,{type:"search",size:"sm",placeholder:"Search columns...","aria-label":"Search columns",value:y,onChange:L=>v(L.target.value)}),l.jsx("div",{className:"flex flex-wrap items-start justify-start gap-1 max-h-[190px] overflow-y-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-2 rounded-sm",role:W.length>15?"region":void 0,"aria-label":W.length>15?"Column visibility toggles, scrollable":void 0,tabIndex:W.length>15?0:void 0,children:W.map(L=>{const R=d.includes(L.id);return l.jsx(hD,{variant:"outline",size:"sm",pressed:R,"aria-label":R?`Hide ${L.label} column`:`Show ${L.label} column`,onPressedChange:E=>{N(L.id,E)},children:L.label},L.id)})})]})}),l.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:g})]})]})}function Eyt(e,t){const[n,r]=p.useState(e);return p.useEffect(()=>{const a=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(a)}},[e,t]),n}const Ru=p.memo(function({children:t,align:n="left"}){const r=p.useRef(null),[a,o]=p.useState(!1),[i,s]=p.useState("");return p.useEffect(()=>{const c=r.current;if(!c)return;let d;const u=()=>{clearTimeout(d),d=setTimeout(()=>{if(r.current){const m=r.current.scrollWidth>r.current.clientWidth,y=r.current.firstElementChild,v=y?y.scrollWidth>y.clientWidth:!1;o(m||v)}},150)};if(r.current){const m=r.current.scrollWidth>r.current.clientWidth,y=r.current.firstElementChild,v=y?y.scrollWidth>y.clientWidth:!1;o(m||v)}const h=new ResizeObserver(u);return h.observe(c),()=>{clearTimeout(d),h.disconnect()}},[t]),p.useEffect(()=>{r.current&&s(r.current.textContent||"")},[t]),a?l.jsxs(Dr,{children:[l.jsx(Or,{asChild:!0,children:l.jsx("div",{ref:r,className:j("min-w-0 overflow-hidden truncate [&>*]:truncate",n==="right"&&"text-right"),children:t})}),l.jsx(gr,{side:"top",className:"max-w-xs",children:i})]}):l.jsx("div",{ref:r,className:j("min-w-0 overflow-hidden truncate [&>*]:truncate",n==="right"&&"text-right"),children:t})}),bX=(e,t,n,r)=>{const a=e.getValue(t),o=a!=null?String(a):"",i=n.toLowerCase();return o.toLowerCase().includes(i)?!0:o.toLowerCase().split(" ").some(c=>c.startsWith(i))},Ryt=(e,t,n)=>{if(!n||n.length===0)return!0;const r=e.getValue(t);return n.includes(r)};function Dyt(e,t){for(const n of e){const r=typeof t=="function"?t(n.original):n.original?.[t];if(r!=null){if(typeof r=="number")return"number";if(r instanceof Date)return"date";if(typeof r=="string"){const a=Date.parse(r);return isNaN(a)?"string":"date"}return"unknown"}}return"unknown"}function xX(e){if(e.length===0)return"";const t=Math.min(...e),n=Math.max(...e);return t===n?String(t):`${t} – ${n}`}function Oyt(e){return e.length===0?"":`Avg: ${(e.reduce((r,a)=>r+a,0)/e.length).toFixed(2)}`}function $yt(e){return e.length===0?"":`Total: ${e.reduce((n,r)=>n+r,0)}`}function kX(e){return`${e} ${e===1?"item":"items"}`}function wX(e,t){if(e.length===0)return"";const r=new Set(e).size,a=r===1||t.endsWith("s")?t:t.endsWith("y")?t.slice(0,-1)+"ies":t+"s";return`${r} ${a.toLowerCase()}`}function Tyt(e){if(e.length===0)return"";const t=new Map;e.forEach(a=>t.set(a,(t.get(a)||0)+1));let n=0,r="";return t.forEach((a,o)=>{a>n&&(n=a,r=o)}),`${r} (${n})`}function MX(e){if(e.length===0)return"";const n=e.map(i=>i instanceof Date?i:new Date(i)).filter(i=>!isNaN(i.getTime()));if(n.length===0)return"";const r=new Date(Math.min(...n.map(i=>i.getTime()))),a=new Date(Math.max(...n.map(i=>i.getTime()))),o=i=>i.toISOString().split("T")[0];return r.getTime()===a.getTime()?o(r):`${o(r)} – ${o(a)}`}function CX(e,t,n){const r=e.columnDef;if(e.id===n||r?.meta?.renderInGroupedRows||r?.meta?.aggregation===!1)return null;if(typeof r?.meta?.aggregation=="function"){const u="accessorKey"in r?r.accessorKey:void 0;return r.meta.aggregation(t,u)}const a="accessorKey"in r?r.accessorKey:void 0,o="accessorFn"in r?r.accessorFn:void 0,i=a||o;if(!i)return null;const s=t.map(u=>typeof i=="function"?i(u.original,u.index):u.original?.[i]).filter(u=>u!=null);if(s.length===0)return null;const c=r?.meta?.aggregation;if(c&&typeof c=="string")switch(c){case"range":return xX(s);case"average":return Oyt(s);case"sum":return $yt(s);case"count":return kX(s.length);case"uniqueCount":return wX(s.map(String),r?.meta?.label||String(e.id));case"mostCommon":return Tyt(s.map(String));case"dateRange":return MX(s);default:return null}switch(Dyt(t,i)){case"number":return xX(s);case"string":return wX(s.map(String),r?.meta?.label||String(e.id));case"date":return MX(s);default:return kX(s.length)}}function SX({columns:e,rows:t,showRowBorder:n=!0,showCellBorder:r=!0,skipHeader:a=!1,enableResponsiveWrapper:o=!0}){const i=o?"h-4 w-full max-w-full":"h-4 w-[120px]",s=o?"h-4 w-full max-w-full":"h-4 w-[100px]";return l.jsxs(l.Fragment,{children:[!a&&l.jsx(rn,{showBorder:n,children:Array.from({length:e}).map((c,d)=>l.jsx(bi,{showBorder:r,className:"overflow-hidden",children:l.jsx(Mr,{className:i})},d))}),Array.from({length:t}).map((c,d)=>l.jsx(rn,{showBorder:n,children:Array.from({length:e}).map((u,h)=>l.jsx(Yn,{showBorder:r,showRowBorder:n,className:"text-body-sm overflow-hidden",children:l.jsx(Mr,{className:s})},h))},d))]})}const zyt=p.memo(function({title:t="No data",description:n="No items to display",action:r,customContent:a}){return a?l.jsx(l.Fragment,{children:a}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-[var(--space-xlg)] text-center",children:[l.jsx("p",{className:"text-body-medium-md text-[var(--color-text-primary)]",children:t}),n&&l.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)] mt-[var(--space-xsm)]",children:n}),r&&l.jsx(Oe,{variant:"primary",size:"sm",className:"mt-[var(--space-md)]",onClick:r.onClick,children:r.label})]})}),Fyt=p.memo(function({title:t="No results found",description:n="Try adjusting your search or filters",action:r,customContent:a}){return a?l.jsx(l.Fragment,{children:a}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-[var(--space-xlg)] text-center",children:[l.jsx("p",{className:"text-body-medium-md text-[var(--color-text-primary)]",children:t}),n&&l.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)] mt-[var(--space-xsm)]",children:n}),r&&l.jsx(Oe,{variant:"default",size:"sm",className:"mt-[var(--space-md)]",onClick:r.onClick,children:r.label})]})}),Vyt=p.memo(function({error:t,onRetry:n,customContent:r}){return r?l.jsx(l.Fragment,{children:r}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-[var(--space-xlg)] text-center",children:[l.jsx("p",{className:"text-body-medium-md text-[var(--color-text-primary)]",children:"Something went wrong"}),l.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)] mt-[var(--space-xsm)]",children:t?.message||"An error occurred while loading data"}),n&&l.jsx(Oe,{variant:"default",size:"sm",className:"mt-[var(--space-md)]",onClick:n,children:"Try again"})]})}),Hyt=p.memo(function(){return l.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px] overflow-hidden",children:l.jsx("div",{className:"h-full w-full bg-[var(--color-background-brand)] animate-pulse"})})}),Byt=p.memo(function({table:t,searchKey:n,searchPlaceholder:r="Search...",enableGlobalSearch:a=!1,globalSearchPlaceholder:o="Search all columns...",globalFilter:i="",onGlobalFilterChange:s,enableGlobalFaceting:c=!1,enableGrouping:d=!1,showSettingsMenu:u=!1,enableAutocomplete:h=!1,autocompleteSuggestions:m=[],autocompleteMinCharacters:y=2}){const v=t.getState().columnFilters.length>0||a&&i.length>0;return l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[a&&s&&l.jsx(l.Fragment,{children:h&&m.length>0?l.jsx(PB,{value:i,onValueChange:s,suggestions:m,placeholder:o,minCharacters:y,className:"h-8 w-[150px] lg:w-[250px]",onSelect:s}):l.jsx(Fn,{placeholder:o,value:i,onChange:g=>s(g.target.value),className:"h-8 w-[150px] lg:w-[250px]"})}),n&&!a&&l.jsx(Fn,{placeholder:r,value:t.getColumn(n)?.getFilterValue()??"",onChange:g=>t.getColumn(n)?.setFilterValue(g.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),t.getAllColumns().filter(g=>g.getCanFilter()&&g.columnDef.meta?.filterVariant).map(g=>l.jsx(Uyt,{column:g},g.id)),c&&l.jsx(qyt,{table:t}),v&&l.jsxs(Oe,{variant:"ghost",onClick:()=>{t.resetColumnFilters(),a&&s&&s("")},className:"h-8 px-2 lg:px-3",children:["Reset",l.jsx(oe,{name:"x",className:"ml-2 h-4 w-4"})]})]}),u&&l.jsx("div",{className:"flex items-center space-x-2",children:l.jsx(she,{table:t,enableGrouping:d})})]})}),qyt=p.memo(function({table:t}){const[n,r]=p.useState([]),a=t.getAllColumns().filter(s=>s.columnDef.meta?.filterOptions&&s.getCanFilter()),o=p.useMemo(()=>{const s=new Map;return a.forEach(c=>{const d=c.getFacetedUniqueValues(),u=c.columnDef.meta?.filterOptions||[],h=c.columnDef.meta?.label||c.columnDef.header;d.forEach((m,y)=>{const v=u.find(g=>g.value===y);if(v&&m>0){const g=`${h}:${y}`;s.set(g,{count:m,column:h,label:v.label})}})}),Array.from(s.entries()).map(([c,d])=>({key:c,value:c.split(":")[1],...d})).sort((c,d)=>d.count-c.count)},[a]),i=s=>{const c=n.includes(s)?n.filter(d=>d!==s):[...n,s];r(c),a.forEach(d=>{const u=d.columnDef.meta?.filterOptions||[],h=c.filter(m=>u.some(y=>y.value===m));h.length>0?d.columnDef.meta?.filterVariant==="multiselect"?d.setFilterValue(h):d.columnDef.meta?.filterVariant==="select"&&d.setFilterValue(h[0]):d.setFilterValue(void 0)})};return o.length===0?null:l.jsxs(Ur,{children:[l.jsx(sa,{asChild:!0,children:l.jsxs(Oe,{variant:"ghost",size:"sm",className:"h-8 border-dashed",children:[l.jsx(oe,{name:"filter",className:"mr-2 h-4 w-4"}),"Global Faceting",n.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mx-2 h-4 w-px bg-[var(--color-border-primary)]"}),l.jsxs(sn,{className:"rounded-sm px-1 font-normal",children:[n.length," selected"]})]})]})}),l.jsx(Sr,{className:"w-[300px] p-0",align:"start",children:l.jsxs($a,{children:[l.jsx(Ta,{placeholder:"Search values across all columns..."}),l.jsxs(qr,{children:[l.jsx(ia,{children:"No results found"}),l.jsx(nr,{children:o.map(s=>{const c=n.includes(s.value);return l.jsx(Cn,{onSelect:()=>i(s.value),children:l.jsxs("div",{className:"flex items-center justify-between flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Mi,{checked:c}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-body-sm",children:s.label}),l.jsxs("span",{className:"text-caption-sm text-[var(--color-text-secondary)]",children:["in ",s.column]})]})]}),l.jsx(sn,{className:"ml-auto text-caption-sm px-1 py-0",children:s.count})]})},s.key)})})]})]})})]})}),Uyt=p.memo(function({column:t}){const{filterVariant:n,filterOptions:r,label:a,placeholder:o}=t.columnDef.meta||{},i=t.getFilterValue(),s=t.getFacetedUniqueValues();if(n==="select"&&r)return l.jsxs(On,{value:i||"all",onValueChange:c=>t.setFilterValue(c==="all"?"":c),children:[l.jsx(An,{className:"h-8 w-[150px]",children:l.jsx(Xn,{placeholder:o||`Filter ${a}`})}),l.jsxs(Pn,{children:[l.jsxs(wt,{value:"all",children:["All ",a]}),r.map(c=>{const d=s.get(c.value)||0;return l.jsx(wt,{value:c.value,children:l.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[c.icon&&l.jsx(c.icon,{className:"h-4 w-4"}),c.label]}),d>0&&l.jsx(sn,{className:"ml-auto text-caption-sm px-1 py-0",children:d})]})},c.value)})]})]});if(n==="multiselect"&&r){const c=i||[];return l.jsxs(Ur,{children:[l.jsx(sa,{asChild:!0,children:l.jsxs(Oe,{variant:"ghost",size:"sm",className:"h-8 border-dashed",children:[l.jsx(oe,{name:"plus-circle",className:"mr-2 h-4 w-4"}),a,c.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mx-2 h-4 w-px bg-[var(--color-border-primary)]"}),l.jsx(sn,{className:"rounded-sm px-1 font-normal lg:hidden",children:c.length}),l.jsx("div",{className:"hidden space-x-1 lg:flex",children:c.length>2?l.jsxs(sn,{className:"rounded-sm px-1 font-normal",children:[c.length," selected"]}):r.filter(d=>c.includes(d.value)).map(d=>l.jsx(sn,{className:"rounded-sm px-1 font-normal",children:d.label},d.value))})]})]})}),l.jsx(Sr,{className:"w-[200px] p-0",align:"start",children:l.jsxs($a,{children:[l.jsx(Ta,{placeholder:o||`Search ${a}...`}),l.jsxs(qr,{children:[l.jsx(ia,{children:"No results found"}),l.jsx(nr,{children:r.map(d=>{const u=c.includes(d.value),h=s.get(d.value)||0;return l.jsx(Cn,{onSelect:()=>{const m=u?c.filter(y=>y!==d.value):[...c,d.value];t.setFilterValue(m.length?m:void 0)},children:l.jsxs("div",{className:"flex items-center justify-between flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Mi,{checked:u}),d.icon&&l.jsx(d.icon,{className:"h-4 w-4"}),l.jsx("span",{children:d.label})]}),h>0&&l.jsx(sn,{className:"ml-auto text-caption-sm px-1 py-0",children:h})]})},d.value)})})]})]})})]})}return n==="number"?l.jsx(Fn,{placeholder:o||`Filter ${a}...`,value:i||"",onChange:c=>t.setFilterValue(c.target.value),className:"h-8 w-[150px]",type:"number"}):l.jsx(Fn,{placeholder:o||`Filter ${a}...`,value:i||"",onChange:c=>t.setFilterValue(c.target.value),className:"h-8 w-[150px]"})}),Wyt=p.memo(function({header:t,enableColumnOrdering:n,children:r}){const{attributes:a,listeners:o,setNodeRef:i,transform:s,transition:c,isDragging:d}=Ayt({id:t.id,disabled:!n}),u={transform:a2.Translate.toString(s),transition:c,opacity:d?.5:1};return n?l.jsxs("div",{ref:i,style:u,className:j("relative flex items-center",d&&"z-50"),children:[l.jsx("div",{className:"flex-1",children:r}),n&&l.jsx("div",{className:"ml-2 p-1 !cursor-grab active:!cursor-grabbing hover:bg-[var(--color-background-neutral-subtlest-hovered)] rounded-sm transition-colors",...a,...o,children:l.jsx(oe,{name:"grip-vertical",className:"h-3 w-3 text-[var(--color-text-tertiary)]"})})]}):l.jsx(l.Fragment,{children:r})}),she=p.memo(function({table:t,enableGrouping:n=!1}){const r=t.getAllColumns().filter(b=>b.getCanSort()).map(b=>({id:b.id,label:b.columnDef.meta?.label||b.columnDef.header||b.id})),a=t.getAllColumns().filter(b=>b.getCanGroup?.()||b.columnDef.enableGrouping).map(b=>({id:b.id,label:b.columnDef.meta?.label||b.columnDef.header||b.id})),o=t.getAllColumns().filter(b=>typeof b.accessorFn<"u"&&b.getCanHide()).map(b=>({id:b.id,label:b.columnDef.meta?.label||b.columnDef.header||b.id})),i=o.filter(b=>t.getColumn(b.id)?.getIsVisible()).map(b=>b.id),s=t.getState().sorting[0],c=s?.id,d=s?.desc?"desc":"asc",h=t.getState().grouping[0]||"",m=b=>{t.setSorting([{id:b,desc:d==="desc"}])},y=b=>{s&&t.setSorting([{id:s.id,desc:b==="desc"}])},v=b=>{!b||b==="none"?t.setGrouping([]):t.setGrouping([b])},g=(b,x)=>{t.getColumn(b)?.toggleVisibility(x)};return l.jsx(ihe,{sortableColumns:r,selectedSortColumn:c,sortDirection:d,onSortChange:m,onSortDirectionChange:y,groupableColumns:n?a:[],selectedGroupColumn:h,onGroupChange:v,columns:o,visibleColumns:i,onColumnVisibilityChange:g})});p.memo(function({column:t,title:n,className:r}){const a=t.columnDef.meta?.align||"left",o=t.columnDef.meta?.truncate!==!1,i=t.getIsSorted();return t.getCanSort()?l.jsxs("div",{className:j("flex items-center gap-1",a==="right"&&"justify-end",i&&"!text-[var(--color-text-brand-bold)]",r),children:[i&&l.jsx(oe,{name:i==="desc"?"arrow-down-wide-narrow":"arrow-down-narrow-wide",className:"h-4 w-4 !text-[var(--color-icon-brand-bold)]"}),o?l.jsx(Ru,{align:a,children:l.jsx("span",{children:n})}):l.jsx("span",{children:n})]}):o?l.jsx(Ru,{align:a,children:l.jsx("div",{className:j(a==="right"?"text-right":"text-left",r),children:n})}):l.jsx("div",{className:j(a==="right"?"text-right":"text-left",r),children:n})});const Gyt=p.memo(function({table:t,enableGrouping:n=!1,hideChildrenForSingleItemGroups:r={},footerLabel:a,onNextPageHover:o,onPreviousPageHover:i,paginationVariant:s="full",pageSizeOptions:c=[10,25,50,100]}){const d=t.getState().pagination.pageIndex+1,u=t.getState().pagination.pageSize,h=n&&!t.options.manualPagination?t.getPrePaginationRowModel().rows.filter(g=>g.depth===0).length:t.getRowCount(),m=t.getFilteredSelectedRowModel().rows.length,y=g=>{t.setPageIndex(g-1)},v=g=>{t.setPageSize(g)};return l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("div",{className:"flex-1 text-body-sm text-[var(--color-text-secondary)]",children:a?l.jsxs("div",{className:"flex items-center gap-[var(--space-md)]",children:[a,m>0&&l.jsxs("span",{children:["· ",m," of ",h," row(s) selected"]})]}):m>0&&l.jsxs("span",{children:[m," of ",h," row(s) selected."]})}),l.jsx(rq,{variant:s,currentPage:d,totalItems:h,pageSize:u,onPageChange:y,onPageSizeChange:v,pageSizeOptions:c,onNextPageHover:o,onPreviousPageHover:i})]})}),Kyt=p.memo(function({onLoadMore:t,isLoading:n}){const r=p.useRef(null);return p.useEffect(()=>{const a=r.current;if(!a||n)return;const o=new IntersectionObserver(i=>{i[0].isIntersecting&&t()},{threshold:.1});return o.observe(a),()=>o.disconnect()},[t,n]),l.jsx("div",{ref:r,className:"flex justify-center py-[var(--space-md)] border-t border-[var(--color-border-primary-subtle)]",children:n&&l.jsx(fo,{size:"sm"})})});function Zyt(e){let t=0;const n=(r,a)=>{r.forEach(o=>{o.depth>t&&(t=o.depth),o.subRows&&o.subRows.length>0&&n(o.subRows)})};return n(e),t}function _X(e,t){const{enableGrouping:n,enableExpanding:r,nestedRowStyling:a,expandingRowColors:o,maxDepth:i}=t,s=e.depth,c=e.getIsGrouped?.(),d=e.getIsExpanded(),u=e.subRows&&e.subRows.length>0,h=u?d?"expanded":"collapsed":"leaf",m=()=>{let y=e;for(;y;){if(y.getIsExpanded())return!0;y=y.getParentRow?.()}return!1};if(a?.colors&&a.colors[s]!==void 0){const y=a.colors[s];if(typeof y=="string")return y;if(typeof y=="object"){if(h==="expanded"&&y.expanded)return y.expanded;if(h==="collapsed"&&y.collapsed)return y.collapsed;if(h==="leaf"&&y.leaf)return y.leaf;if(y.default)return y.default}}if(r&&!c&&o){const y=i-s;if(y===0&&o.children)return o.children;if(y>0){if(d&&o.expandedParent)return o.expandedParent;if(!d&&o.collapsedParent)return o.collapsedParent}}return c?d?"var(--blue-50)":"var(--color-background-neutral-subtlest)":n&&s===1?"var(--blue-25)":r&&!c?s===0&&(!u||!m())?"":(i-s)%2===0?"var(--blue-25)":"var(--blue-50)":""}function Yyt(e,t){if(t){if(t.heights&&t.heights[e]!==void 0)return t.heights[e];if(t.defaultHeight)return t.defaultHeight}}function NX(e,t,n,r,a,o){const i=e.groupingColumnId,s=a[i]??!1,c=o[i]??!1,u=s&&c&&e.subRows.length<=1?null:e.subRows.length>1?l.jsx("button",{tabIndex:-1,onClick:e.getToggleExpandedHandler(),className:"flex h-[var(--size-sm)] w-[var(--size-sm)] cursor-pointer items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",children:l.jsx(oe,{name:r?"chevron-down":"chevron-right",className:"h-3 w-3"})}):l.jsx("div",{className:"h-[var(--size-sm)] w-[var(--size-sm)]"}),h=e.subRows.length>1?l.jsx(sn,{appearance:"subtle",size:"sm",truncate:!1,children:e.subRows.length}):null;if(n){const m=t.getAllColumns().find(y=>y.id===n);if(m){const y=m.columnDef;if(y.aggregatedCell){const v=e.getAllCells().find(g=>g.column.id===n);return l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)] font-medium text-[var(--color-text-primary)]",children:[u,l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[v?Yo(y.aggregatedCell,v.getContext()):null,h]})]})}else{const v=e.subRows[0]?.original?.[n];return l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)] font-medium text-[var(--color-text-primary)]",children:[u,l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[l.jsx("span",{className:"font-medium",children:String(v)}),h]})]})}}}return l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)] font-medium text-[var(--color-text-primary)]",children:[u,l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[l.jsx("span",{className:"font-medium",children:String(e.getGroupingValue(e.groupingColumnId))}),h]})]})}function Xyt({columns:e,data:t,searchKey:n,searchPlaceholder:r,title:a,caption:o,className:i,stickyHeader:s=!1,stickyFirstColumn:c=!1,stickyLeftColumns:d=0,stickyRightColumns:u=0,enableResponsiveWrapper:h=!0,showScrollIndicators:m=!1,minTableWidth:y="900px",isLoading:v=!1,loadingBehavior:g="replace",loadingRowCount:b=10,borderStyle:x="both",defaultVerticalAlign:k="middle",enableGlobalSearch:M=!1,globalSearchPlaceholder:C="Search all columns...",enableAutocomplete:S=!1,globalSearchColumns:_,autocompleteMinCharacters:N=2,enableGlobalFaceting:I=!1,enableColumnResizing:A=!1,columnResizeMode:T="onChange",enableColumnResizePersistence:P=!1,enablePaginationPersistence:F=!1,storageKey:U="data-table-columns",enableExpanding:W=!1,getSubRows:Z,expandingRowColors:L,nestedRowStyling:R,enableGrouping:E=!1,groupedColumnMode:O=!1,enableManualGrouping:J=!1,groupDisplayColumn:K,hideChildrenForSingleItemGroups:B={},hideExpanderForSingleItemGroups:$={},enableRowPinning:G=!1,keepPinnedRows:z=!0,enableVirtualization:H=!1,nestedHeaders:D=[],enableNestedHeaders:Y=!1,enableColumnOrdering:V=!1,enableRowSelection:Q=!1,showHeader:ae=!0,showPagination:X=!0,paginationVariant:ye="full",pageSizeOptions:ie=[10,25,50,100],footerLabel:Ee,onTableReady:Pe,initialState:Fe,sorting:Ge,onSortingChange:dt,columnVisibility:mt,onColumnVisibilityChange:Ft,grouping:Xe,onGroupingChange:ne,columnOrder:Se,onColumnOrderChange:Ae,columnSizing:Ke,onColumnSizingChange:tt,pagination:bt,onPaginationChange:Zt,expanded:yt,onExpandedChange:jt,renderSectionHeaderRow:Vt,renderSubComponent:Lt,getRowCanExpand:cr,autoExpandChildren:lr=!1,onRowClick:$t,isRowClickable:In,clickableRowClassName:dr,groupPreservingSearch:le=!1,activeRowId:xe,activeRowClassName:me,getRowId:ue,onActiveRowChange:Le,onRowSelectionChange:ce,onNextPageHover:Re,onPreviousPageHover:Ve,onRowUpdate:He,onLoadMore:ot,hasMoreData:qe,isLoadingMore:ze,error:Ht,onRetry:gt,errorComponent:At,emptyState:fa,emptyStateTitle:Rn="No data",emptyStateDescription:Kr="No items to display",emptyStateAction:Ti,noResultsState:z1,noResultsTitle:Xhe="No results found",noResultsDescription:Jhe="Try adjusting your search or filters",noResultsAction:Qhe,isRefetching:epe=!1,manualSorting:Iq=!1,manualFiltering:jq=!1,manualPagination:o0=!1,rowCount:tpe,manualExpanding:Lq=!1,onLoadChildren:i0,expandingRowsLoading:s0,subComponentLoading:c0,onSubComponentLoad:su,expandingRowsError:Vgt,subComponentError:Aq,onExpandError:F1}){const l0=h||!!(d&&d>0)||!!(u&&u>0),[npe,rpe]=p.useState([]),[ape,ope]=p.useState({}),[ipe,spe]=p.useState(Fe?.grouping||[]),[cpe,lpe]=p.useState(()=>{const q=e.map(ee=>ee.id||ee.accessorKey||`column-${Math.random()}`);return Q?["select",...q]:q}),[dpe,upe]=p.useState(Ke||Fe?.columnSizing||{}),[hpe,ppe]=p.useState(()=>{if(F&&U){const q=localStorage.getItem(`${U}-pagination`);if(q)try{const ee=JSON.parse(q);if(typeof ee.pageIndex=="number"&&typeof ee.pageSize=="number")return ee}catch(ee){console.warn("Failed to parse saved pagination:",ee)}}return Fe?.pagination||{pageIndex:0,pageSize:10}}),[Pq,fpe]=p.useState([]),[cu,mpe]=p.useState({}),[QD,Eq]=p.useState(""),[ype,gpe]=p.useState(Fe?.expanded||{}),[vpe,bpe]=p.useState(Fe?.rowPinning||{top:[],bottom:[]}),[xpe,d0]=p.useState(""),[Ir,eO]=p.useState([-1,0]),tO=p.useRef(null),V1=p.useRef(new Map),H1=p.useRef(new Map);p.useEffect(()=>()=>{V1.current.forEach(q=>q.abort()),H1.current.forEach(q=>q.abort())},[]),p.useEffect(()=>{ce&&ce(cu)},[cu,ce]),p.useEffect(()=>{Le?.(xe)},[xe,Le]);const Rq=Ge!==void 0,Dq=mt!==void 0,Oq=Xe!==void 0,$q=Se!==void 0,Tq=Ke!==void 0,zq=bt!==void 0,nO=yt!==void 0,Fo=Rq?Ge:npe,kpe=Dq?mt:ape,Vo=Oq?Xe:ipe,B1=$q?Se:cpe,u0=Tq?Ke:dpe,ma=zq?bt:hpe,jr=nO?yt:ype,wpe=Rq?dt:rpe,Mpe=Dq?Ft:ope,Cpe=Oq?ne:spe,Fq=$q?Ae:lpe,Vq=Tq?tt:upe,Spe=zq?Zt:ppe,rO=p.useCallback(q=>{if(nO&&jt){if(typeof q=="object"&&q!==null&&!(q instanceof Function)&&Object.keys(q).length===0&&(yt===!0||typeof yt=="object"&&yt!==null&&Object.keys(yt).length>0))return;jt(q)}else gpe(q)},[nO,jt,yt]),_pe=p.useMemo(()=>b!==void 0&&b!==10?b:ma.pageSize,[b,ma.pageSize]),pn=Eyt(QD,300),Npe=p.useMemo(()=>{if(!S||!M)return[];const q=new Set;return t.forEach(ee=>{_&&_.length>0?_.forEach(re=>{const pe=ee[re];pe!=null&&String(pe).trim()!==""&&q.add(String(pe))}):Object.values(ee).forEach(re=>{re!=null&&String(re).trim()!==""&&q.add(String(re))})}),Array.from(q).sort()},[t,_,S,M]),Hq=p.useCallback((q,ee,re)=>{if(!q||!ee||ee.length===0)return()=>!0;const pe=q.toLowerCase(),ge=new Set;return re.forEach(ve=>{let $e=!1;for(const ut in ve){const _t=ve[ut];if(_t!=null&&String(_t).toLowerCase().includes(pe)){$e=!0;break}}$e&&ee.forEach(ut=>{const _t=ve[ut];_t!=null&&ge.add(String(_t))})}),ve=>{for(const $e of ee){const ut=ve.getValue($e);if(ut!=null&&ge.has(String(ut)))return!0}return!1}},[]);p.useEffect(()=>{if(P&&U){const q=localStorage.getItem(`${U}-sizing`);if(q)try{Vq(JSON.parse(q))}catch(ee){console.warn("Failed to parse saved column sizing:",ee)}}},[P,U]),p.useEffect(()=>{P&&U&&Object.keys(u0).length>0&&localStorage.setItem(`${U}-sizing`,JSON.stringify(u0))},[u0,P,U]),p.useEffect(()=>{F&&U&&localStorage.setItem(`${U}-pagination`,JSON.stringify(ma))},[ma,F,U]);const Ze=p.useMemo(()=>{switch(x){case"horizontal":return{showRowBorder:!0,showCellBorder:!1};case"vertical":return{showRowBorder:!1,showCellBorder:!0};case"both":return{showRowBorder:!0,showCellBorder:!0};case"none":return{showRowBorder:!1,showCellBorder:!1};default:return{showRowBorder:!0,showCellBorder:!0}}},[x]),aO=p.useCallback((q,ee)=>{if(!$t)return;const re=ee.target;if(!(re.tagName==="BUTTON"||re.tagName==="A"||re.tagName==="INPUT"||re.closest("button")||re.closest("a")||re.closest("input"))&&!(In&&!In(q))){if(!In&&q.getIsGrouped()){const ge=q.groupingColumnId;if(!((B[ge]??!1)&&q.subRows&&q.subRows.length===1))return}$t(q,ee)}},[$t,In,B]),zi=p.useCallback(q=>{if(!$t)return!1;if(In)return In(q);if(!q.getIsGrouped())return!0;const re=q.groupingColumnId;return(B[re]??!1)&&q.subRows&&q.subRows.length===1},[$t,In,B]),Bq=q=>q?"![box-shadow:inset_3px_0_0_0_var(--color-border-brand-bold),inset_0_-1px_0_0_var(--color-border-primary-medium)]":"![box-shadow:inset_3px_0_0_0_var(--color-border-brand-bold)]",h0=p.useCallback(q=>{if(!xe)return!1;const ee=ue?q.id:q.original?.id!==void 0?q.original.id:q.id;return String(ee)===String(xe)},[xe,ue]),q1=p.useMemo(()=>c?1:d||0,[c,d]),Fi=p.useMemo(()=>u||0,[u]),qq=p.useMemo(()=>{const q=new Set;return e.forEach(ee=>{if(ee.cell){const re=ee.id||ee.accessorKey;re&&q.add(String(re))}}),q},[e]),oO=p.useMemo(()=>{const q=e.map(ee=>{let re={...ee,...A&&!ee.minSize?{minSize:80}:{}};return ee.enableGrouping||ee.meta?.enableGrouping?{...re,enableGrouping:!0,getGroupingValue:pe=>{const ge=ee.accessorKey||ee.accessorFn;return typeof ge=="string"&&pe.original?pe.original[ge]:typeof ge=="function"&&pe.original?ge(pe.original):pe.getValue?.(ee.id)||pe[ge]||""}}:re});return Q?[{id:"select",size:48,minSize:48,maxSize:48,enableResizing:!1,header:({table:re})=>l.jsx(Mi,{tabIndex:-1,checked:re.getIsAllPageRowsSelected()||re.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:pe=>re.toggleAllPageRowsSelected(!!pe),"aria-label":"Select all"}),cell:({row:re})=>l.jsx(Mi,{tabIndex:-1,checked:re.getIsSelected(),onCheckedChange:pe=>re.toggleSelected(!!pe),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,enableGrouping:!1,meta:{label:"Select"}},...q]:q},[e,Q]),iO=p.useMemo(()=>t,[t]),Ipe=p.useMemo(()=>!le||!pn?bX:Hq(pn,Vo,iO),[le,pn,Vo,iO,Hq]),De=Kft({data:iO,columns:oO,getRowId:ue,filterFns:{fuzzy:bX,multiSelect:Ryt},state:{sorting:Fo,columnFilters:Pq,columnVisibility:kpe,rowSelection:cu,globalFilter:pn,columnSizing:u0,expanded:jr,grouping:Vo,rowPinning:vpe,columnOrder:B1,pagination:ma},manualSorting:Iq,manualFiltering:jq,manualPagination:o0,rowCount:tpe,enableRowSelection:Q,enableColumnPinning:!1,enableGlobalFilter:M,globalFilterFn:Ipe,enableColumnResizing:A,columnResizeMode:T,enableExpanding:W,getSubRows:Z,getRowCanExpand:cr,paginateExpandedRows:!1,autoResetPageIndex:!1,enableGrouping:E,groupedColumnMode:O,manualGrouping:J,enableRowPinning:G,keepPinnedRows:z,onRowSelectionChange:mpe,onSortingChange:wpe,onColumnFiltersChange:fpe,onColumnVisibilityChange:Mpe,onGlobalFilterChange:Eq,onColumnSizingChange:Vq,onExpandedChange:rO,onGroupingChange:Cpe,onRowPinningChange:bpe,onColumnOrderChange:Fq,onPaginationChange:Spe,getCoreRowModel:Eft(),getFilteredRowModel:jq?void 0:Fft(),getPaginationRowModel:o0||H?void 0:Bft(),getSortedRowModel:Iq?void 0:qft(),getExpandedRowModel:W?Rft():void 0,getGroupedRowModel:E?Vft():void 0,getFacetedRowModel:Tft(),getFacetedUniqueValues:zft(),getFacetedMinMaxValues:Dft()}),p0=p.useMemo(()=>Zyt(De.getRowModel().rows),[De.getRowModel().rows]),f0=p.useMemo(()=>{if(!E)return null;const q=new Map;return De.getGroupedRowModel?.()?.rows?.forEach(re=>{re.subRows&&re.subRows.length>0&&q.set(re.id,re.subRows)}),q},[E,De]),{flatVisibleRows:m0,rowIdToFlatIndex:Uq}=p.useMemo(()=>{const q=[],ee=new Map,re=ge=>{const ve=q.length;q.push(ge),ee.set(ge.id,ve),ge.getIsExpanded()&&(ge.subRows&&ge.subRows.length>0?ge.subRows:f0?.get(ge.id)||[]).forEach(re)};return De.getRowModel().rows.filter(ge=>Lt||ge.depth===0).forEach(re),{flatVisibleRows:q,rowIdToFlatIndex:ee}},[De,jr,f0,Lt]),Wq=p.useRef(void 0);p.useEffect(()=>{if(!E)return;const ee=De.getPrePaginationRowModel().rows.filter(ge=>ge.depth===0).length,re=ma.pageSize,pe=Math.max(1,Math.ceil(ee/re));Wq.current!==pe&&(Wq.current=pe,De.setPageCount(pe))},[E,ma.pageSize,Vo.join(","),De.getPrePaginationRowModel().rows.length]);const Gq=p.useRef({});p.useEffect(()=>{if(!lr)return;const q=De.getState().expanded,ee=Gq.current,re={...q};let pe=!1;De.getRowModel().rows.forEach(ge=>{const ve=ge.id,$e=q[ve]===!0,ut=ee[ve]===!0;$e&&!ut&&ge.subRows&&ge.subRows.length>0&&ge.subRows.forEach(_t=>{q[_t.id]!==!0&&(re[_t.id]=!0,pe=!0)})}),Gq.current=q,pe&&rO(re)},[jr,lr]);const Kq=p.useRef({});p.useEffect(()=>{if(!i0&&!su)return;const q=De.getState().expanded,ee=Kq.current;Object.keys(ee).forEach(re=>{const pe=ee[re],ge=q[re];if(pe&&!ge){const ve=V1.current.get(re);ve&&(ve.abort(),V1.current.delete(re));const $e=H1.current.get(re);$e&&($e.abort(),H1.current.delete(re))}}),Object.keys(q).forEach(re=>{const pe=q[re],ge=ee[re];if(pe&&!ge){const ve=De.getRow(re);if(!ve)return;if(i0&&Lq){const $e=ve.getIsGrouped()||ve.subRows&&ve.subRows.length===0&&ve.getCanExpand(),ut=s0?.[re]===!0,_t=ve.subRows&&ve.subRows.length>0;if($e&&!ut&&!_t){const se=new AbortController;V1.current.set(re,se),Promise.resolve(i0(ve)).catch(xt=>{xt?.name!=="AbortError"&&F1&&F1(ve,xt,"children")}).finally(()=>{V1.current.delete(re)})}}if(su&&Lt&&!ve.getIsGrouped()&&ve.depth===0&&!(c0?.[re]===!0)){const ut=new AbortController;H1.current.set(re,ut),Promise.resolve(su(ve)).catch(_t=>{_t?.name!=="AbortError"&&F1&&F1(ve,_t,"subComponent")}).finally(()=>{H1.current.delete(re)})}}}),Kq.current=q},[jr,i0,su,Lq,Lt,s0,c0,F1]),p.useEffect(()=>{if(!le||!pn||!E)return;const q={};De.getFilteredRowModel().rows.forEach(re=>{re.getIsGrouped()&&re.subRows&&re.subRows.length>0&&(q[re.id]=!0)}),rO(re=>{const pe=Object.keys(re).sort().join(","),ge=Object.keys(q).sort().join(",");return pe===ge?re:q})},[pn,le,E]);const Zq=p.useRef(Vo),Yq=p.useRef(Fo);p.useEffect(()=>{if(!o0)return;const q=JSON.stringify(Vo)!==JSON.stringify(Zq.current),ee=JSON.stringify(Fo)!==JSON.stringify(Yq.current);(q||ee)&&De.setPageIndex(0),Zq.current=Vo,Yq.current=Fo},[Vo,Fo,o0,De]),p.useEffect(()=>{Pe&&Pe(De)},[De,Pe]),p.useEffect(()=>{if(Fo.length>0){const q=Fo[0],ee=e.find(ge=>ge.id===q.id||ge.accessorKey===q.id),re=ee?.meta?.label||ee?.header||q.id,pe=q.desc?"descending":"ascending";d0(`Table sorted by ${re}, ${pe}`)}},[Fo,e]),p.useEffect(()=>{if(pn){const q=De.getFilteredRowModel().rows.length;d0(`${q} result${q!==1?"s":""} found for "${pn}"`)}},[pn,De]),p.useEffect(()=>{const q=Object.keys(cu).filter(ee=>cu[ee]).length;q>0&&d0(`${q} row${q!==1?"s":""} selected`)},[cu]),p.useEffect(()=>{const[q,ee]=Ir,re=m0.length,pe=De.getVisibleLeafColumns();let ge=q,ve=ee;q>=0&&q>=re&&(ge=Math.max(re-1,-1)),ee>=pe.length&&(ve=Math.max(pe.length-1,0)),(ge!==q||ve!==ee)&&eO([ge,ve])},[t.length,De,Ir,m0.length]),p.useEffect(()=>{const q=De.getPageCount();q>1&&d0(`Page ${ma.pageIndex+1} of ${q}`)},[ma.pageIndex,De]);const U1=p.useCallback((q,ee)=>{if(!ee||!q)return q;const re=q.toLowerCase(),pe=ee.toLowerCase(),ge=[];let ve=0,$e=re.indexOf(pe);for(;$e!==-1;)$e>ve&&ge.push(q.substring(ve,$e)),ge.push(l.jsx("span",{style:{backgroundColor:"#fef3c7",fontWeight:600,padding:"2px 0"},children:q.substring($e,$e+ee.length)},`highlight-${ve}-${$e}`)),ve=$e+ee.length,$e=re.indexOf(pe,ve);return ve<q.length&&ge.push(q.substring(ve)),l.jsx(l.Fragment,{children:ge})},[]),Ho=p.useCallback(q=>{if(q==null)return"";if(typeof q=="string"||typeof q=="number")return String(q);if(Array.isArray(q))return q.map(Ho).join("");if(p.isValidElement(q)){const ee=q;if(typeof ee.type=="function")try{if(ee.type.prototype?.isReactComponent)return Ho(ee.props.children);const pe=ee.type(ee.props);return Ho(pe)}catch{return Ho(ee.props.children)}return Ho(ee.props.children)}return""},[]),y0=p.useCallback((q,ee)=>ee?Ho(q).toLowerCase().includes(ee.toLowerCase()):!1,[Ho]),Ya=p.useCallback((q,ee)=>{if(!ee||q==null)return q;if(typeof q=="string")return U1(q,ee);if(typeof q=="number")return U1(String(q),ee);if(Array.isArray(q))return q.map((re,pe)=>l.jsx(p.Fragment,{children:Ya(re,ee)},pe));if(p.isValidElement(q)){const re=q;if(typeof re.type=="function")try{if(re.type.prototype?.isReactComponent){const ut=re.props.children;return p.cloneElement(re,{},Ya(ut,ee))}const $e=re.type(re.props);return Ya($e,ee)}catch{const{children:$e,...ut}=re.props;return $e==null?re:p.cloneElement(re,ut,Ya($e,ee))}if(re.props.children===void 0||re.props.children===null)return re;const{children:pe,...ge}=re.props;return p.cloneElement(re,ge,Ya(pe,ee))}return q},[U1]),lu=p.useCallback(q=>{if(!M||!pn)return Yo(q.column.columnDef.cell,q.getContext());if(qq.has(q.column.id)){const pe=Yo(q.column.columnDef.cell,q.getContext());return pe==null||!y0(pe,pn)?pe:Ya(pe,pn)}const re=q.getValue();if(typeof re=="string"||typeof re=="number"){const pe=String(re);return U1(pe,pn)}return Yo(q.column.columnDef.cell,q.getContext())},[M,pn,U1,qq,y0,Ya]),Xq=p.useCallback(q=>{if(!M||!pn)return Yo(q.column.columnDef.aggregatedCell,q.getContext());const ee=Yo(q.column.columnDef.aggregatedCell,q.getContext());return ee==null||!y0(ee,pn)?ee:Ya(ee,pn)},[M,pn,y0,Ya,Ho]),jpe=p.useRef(null),Lpe=lmt(iX(Y1e,{activationConstraint:{distance:8}}),iX(X1e,{activationConstraint:{delay:200,tolerance:8}})),[,Jq]=p.useState(null),Ape=q=>{V&&Jq(q.active.id)},Ppe=q=>{if(!V)return;const{active:ee,over:re}=q;if(Jq(null),ee.id!==re?.id&&re?.id){const pe=B1.findIndex(ve=>ve===ee.id),ge=B1.findIndex(ve=>ve===re?.id);if(pe!==-1&&ge!==-1){const ve=fq(B1,pe,ge);console.log("Column reorder:",{activeId:ee.id,overId:re.id,oldIndex:pe,newIndex:ge,oldOrder:B1,newOrder:ve}),Fq(ve)}}},Epe=p.useCallback(q=>{const[ee,re]=Ir,pe=De.getVisibleLeafColumns(),ge=m0,ve=pe.length,$e=ge.length,ut=-1,_t=$e-1;let se=ee,xt=re,Bt=!1;switch(q.key){case"ArrowRight":re<ve-1&&(xt=re+1,Bt=!0);break;case"ArrowLeft":re>0&&(xt=re-1,Bt=!0);break;case"ArrowDown":ee<_t&&(se=ee+1,Bt=!0);break;case"ArrowUp":ee>ut&&(se=ee-1,Bt=!0);break;case"Home":(q.ctrlKey||q.metaKey)&&(se=ut),xt=0,Bt=!0;break;case"End":(q.ctrlKey||q.metaKey)&&(se=_t),xt=ve-1,Bt=!0;break;case"PageDown":se=Math.min(ee+10,_t),Bt=!0;break;case"PageUp":se=Math.max(ee-10,ut),Bt=!0;break;case"Enter":case" ":if(ee===-1){const he=pe[re];he?.id==="select"&&Q&&q.key===" "?(De.toggleAllPageRowsSelected(),Bt=!0):he?.getCanSort()&&(he.toggleSorting(),Bt=!0)}else{const he=ge[ee];he&&((W||E)&&he.getCanExpand()?(he.toggleExpanded(),Bt=!0):Q&&q.key===" "&&(he.toggleSelected(),Bt=!0),!Bt&&q.key==="Enter"&&$t&&zi(he)&&(aO(he,q),Bt=!0))}break;case"Escape":document.activeElement instanceof HTMLElement&&document.activeElement.blur(),Bt=!0;break}if(Bt&&(q.preventDefault(),q.stopPropagation(),se!==ee||xt!==re)){eO([se,xt]);const he=se===-1?`[data-header-col="${xt}"]`:`[data-row="${se}"][data-col="${xt}"]`,nt=tO.current?.querySelector(he);nt&&nt.focus()}},[Ir,De,m0,W,E,Q]),Rpe=p.useCallback(q=>{tO.current?.contains(q.relatedTarget)||eO([-1,0])},[]),W1=p.useMemo(()=>{const q=De.getVisibleFlatColumns(),ee=new Map;let re=0;q.forEach((ge,ve)=>{const $e=ve<q1,ut=ve>=q.length-Fi,_t=$e&&ve===q1-1,se=ut&&ve===q.length-Fi;ee.set(ge.id,{isLeftSticky:$e,isRightSticky:ut,leftPosition:re,rightPosition:0,isRightmostLeftSticky:_t,isLeftmostRightSticky:se,columnIndex:ve}),re+=ge.getSize()});let pe=0;for(let ge=q.length-1;ge>=0;ge--){const ve=q[ge],$e=ee.get(ve.id);$e&&($e.rightPosition=pe),pe+=ve.getSize()}return{data:ee,allColumns:q}},[De.getVisibleFlatColumns(),q1,Fi]),G1=(q,ee=!1,re=!0)=>{if(!q||typeof q.getSize!="function")return{};const pe=W1.data.get(q.id);if(!pe||!pe.isLeftSticky&&!pe.isRightSticky)return{};const{isLeftSticky:ge,isRightSticky:ve,leftPosition:$e,rightPosition:ut,isRightmostLeftSticky:_t,isLeftmostRightSticky:se}=pe;if(ge){const xt={position:"sticky",left:`${$e}px`,...ee&&{backgroundColor:"var(--grey-25)"},width:`${q.getSize()}px`,minWidth:`${q.getSize()}px`,maxWidth:`${q.getSize()}px`};return _t&&ee?{...xt,backgroundImage:"linear-gradient(to right, var(--grey-25) calc(100% - 3px), var(--color-border-primary-medium) calc(100% - 3px), var(--color-border-primary-medium) 100%)",backgroundColor:"transparent"}:xt}if(ve){const xt={position:"sticky",right:`${ut}px`,...ee&&{backgroundColor:"var(--grey-25)"},width:`${q.getSize()}px`,minWidth:`${q.getSize()}px`,maxWidth:`${q.getSize()}px`};return se&&ee?{...xt,backgroundImage:"linear-gradient(to right, var(--color-border-primary-medium) 0, var(--color-border-primary-medium) 3px, var(--grey-25) 3px)",backgroundColor:"transparent"}:xt}return{}},Dpe=q=>{if(!q||typeof q.getSize!="function")return"";const ee=W1.data.get(q.id);return ee?ee.isRightmostLeftSticky?"border-r-[3px] border-[var(--color-border-primary-medium)]":ee.isLeftmostRightSticky?"border-l-[3px] border-[var(--color-border-primary-medium)]":"":""},sO=q=>{if(!q||typeof q.getSize!="function")return!1;const ee=W1.data.get(q.id);return ee?ee.isRightmostLeftSticky||ee.isLeftmostRightSticky:!1},cO=q=>{if(!q||typeof q.getSize!="function"||Fi===0)return!1;const ee=W1.data.get(q.id);return ee?ee.columnIndex===W1.allColumns.length-Fi-1:!1},Qq=(q,ee=!1)=>!A||!q.getCanResize()||!!Ze.showCellBorder?"":j(!ee&&["after:content-[''] after:absolute after:right-px after:top-1/2 after:-translate-y-1/2","after:w-[2px] after:h-[24px] after:rounded-[2px]","after:bg-[var(--color-border-primary-medium)]","after:opacity-0 hover:after:opacity-100","after:transition-opacity after:pointer-events-none after:z-10"],"before:content-[''] before:absolute before:left-[-3px] before:top-1/2 before:-translate-y-1/2","before:w-[2px] before:h-[24px] before:rounded-[2px]","before:bg-[var(--color-border-primary-medium)]","before:opacity-0 hover:before:opacity-100","before:transition-opacity before:pointer-events-none before:z-10");return l.jsx(L1,{children:l.jsx(uyt,{sensors:Lpe,collisionDetection:fmt,onDragStart:Ape,onDragEnd:Ppe,children:l.jsxs("div",{className:j("border border-[var(--color-border-primary-medium)] bg-[var(--color-surface-primary)] overflow-hidden rounded-lg",!X&&"border-b-0",i),children:[ae&&(a||M)&&l.jsxs("div",{className:"border-b border-[var(--color-border-primary-medium)] bg-[var(--color-surface-primary)] px-[var(--space-lg)] py-[var(--space-md)]",children:[a&&l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("h3",{className:"text-heading-sm font-semibold text-[var(--color-text-primary)]",children:a}),l.jsx(she,{table:De,enableGrouping:E})]}),l.jsx(Byt,{table:De,searchKey:n,searchPlaceholder:r,showSettingsMenu:!1,enableGlobalSearch:M,globalSearchPlaceholder:C,globalFilter:QD,onGlobalFilterChange:Eq,enableGlobalFaceting:I,enableGrouping:E,enableAutocomplete:S,autocompleteSuggestions:Npe,autocompleteMinCharacters:N})]}),l.jsxs("div",{ref:tO,onKeyDown:Epe,onFocus:Rpe,className:j("relative",l0&&["overflow-x-auto","scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[var(--color-border-primary-subtle)]","hover:scrollbar-thumb-[var(--color-border-primary)]","max-sm:scrollbar-none"]),children:[m&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute top-0 left-0 bottom-0 w-8 bg-gradient-to-r from-[var(--color-surface-primary)] to-transparent z-10 pointer-events-none opacity-0 transition-opacity"}),l.jsx("div",{className:"absolute top-0 right-0 bottom-0 w-8 bg-gradient-to-l from-[var(--color-surface-primary)] to-transparent z-10 pointer-events-none opacity-0 transition-opacity"})]}),l.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:xpe}),l.jsxs(FD,{ref:jpe,role:"grid","aria-label":o||a,"aria-rowcount":t.length,"aria-colcount":De.getVisibleLeafColumns().length,className:j("border-separate border-spacing-0",A&&"table-fixed"),style:{...l0&&{minWidth:y}},children:[l.jsx("colgroup",{children:De.getVisibleLeafColumns().map(q=>l.jsx("col",{style:{width:q.id==="select"?"48px":void 0}},q.id))}),l.jsx(VD,{className:j(s&&["sticky top-0 z-20","after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-[var(--color-border-primary-medium)]"],X&&"[&_tr:last-child]:border-b-0"),children:v?l.jsx(SX,{columns:De.getVisibleLeafColumns().length,rows:0,showRowBorder:Ze.showRowBorder,showCellBorder:Ze.showCellBorder,enableResponsiveWrapper:l0}):Y&&D&&D.length>0?l.jsxs(l.Fragment,{children:[l.jsx(rn,{showBorder:Ze.showRowBorder,children:D.map((q,ee)=>{const re=q.columns.length,pe=G1(q,!0,Ze.showRowBorder);return l.jsx(bi,{colSpan:re,showBorder:Ze.showCellBorder,className:j("text-center bg-[var(--color-background-neutral-subtlest)] font-medium border-b border-[var(--color-border-primary-medium)]",s&&"z-20",!ae&&ee===0&&"rounded-tl-lg",!ae&&ee===D.length-1&&"rounded-tr-lg",q.className),style:{...pe,...q.style},children:typeof q.header=="string"?l.jsx("span",{className:"text-body-strong-sm text-[var(--color-text-primary)]",children:q.header}):q.header},q.id)})}),l.jsx(rn,{showBorder:Ze.showRowBorder,children:De.getHeaderGroups()[0]?.headers.map((q,ee)=>{const re=G1(q.column,!0,Ze.showRowBorder),pe=q.column.columnDef.meta?.align||"left",ge=ee===De.getHeaderGroups()[0].headers.length-1,ve=sO(q.column);return l.jsx(bi,{scope:"col","aria-sort":q.column.getCanSort()?q.column.getIsSorted()?q.column.getIsSorted()==="desc"?"descending":"ascending":"none":void 0,"aria-colindex":ee+1,"data-header-col":ee,tabIndex:Ir[0]===-1&&Ir[1]===ee?0:-1,showBorder:ge||ve||cO(q.column)?!1:Ze.showCellBorder,className:j(s&&"z-20",(q1>0||Fi>0)&&"z-30",A&&"relative overflow-visible group",Qq(q.column,ge),"focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]"),style:{...re,...A&&!re.width?{width:q.column.getSize()}:{}},children:l.jsxs("div",{className:j(pe==="right"?"text-right":"text-left"),children:[q.isPlaceholder?null:Yo(q.column.columnDef.header,q.getContext()),A&&q.column.getCanResize()&&l.jsx("div",{onMouseDown:q.getResizeHandler(),onTouchStart:q.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none -mr-1",children:l.jsx("div",{className:j("absolute right-1 top-0 h-full w-1","hover:bg-[var(--color-border-primary-medium)] active:bg-[var(--color-border-primary-medium)]",q.column.getIsResizing()&&"bg-[var(--color-border-primary-medium)]")})})]})},q.id)})})]}):De.getHeaderGroups().map(q=>l.jsx(Cyt,{items:q.headers.map(ee=>ee.id),strategy:wyt,children:l.jsx(rn,{showBorder:Ze.showRowBorder,children:q.headers.map((ee,re)=>{const pe=G1(ee.column,!0,Ze.showRowBorder),ge=ee.column.columnDef.meta?.align||"left",ve=re===q.headers.length-1,$e=sO(ee.column);return l.jsx(bi,{scope:"col","aria-sort":ee.column.getCanSort()?ee.column.getIsSorted()?ee.column.getIsSorted()==="desc"?"descending":"ascending":"none":void 0,"aria-colindex":re+1,"data-header-col":re,tabIndex:Ir[0]===-1&&Ir[1]===re?0:-1,showBorder:ve||$e||cO(ee.column)?!1:Ze.showCellBorder,className:j(s&&"z-20",(q1>0||Fi>0)&&"z-30",A&&"relative overflow-visible group",V&&"group",!ae&&re===0&&"rounded-tl-lg",!ae&&re===q.headers.length-1&&"rounded-tr-lg",Qq(ee.column,ve),"focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]"),style:{...pe,...A&&!pe.width?{width:ee.column.getSize()}:{}},children:l.jsx(Wyt,{header:ee,enableColumnOrdering:V,children:l.jsxs("div",{className:j(ge==="right"?"text-right":"text-left"),children:[ee.isPlaceholder?null:Yo(ee.column.columnDef.header,ee.getContext()),A&&ee.column.getCanResize()&&l.jsx("div",{onMouseDown:ee.getResizeHandler(),onTouchStart:ee.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none -mr-1",children:l.jsx("div",{className:j("absolute right-1 top-0 h-full w-1","hover:bg-[var(--color-border-primary-medium)] active:bg-[var(--color-border-primary-medium)]",ee.column.getIsResizing()&&"bg-[var(--color-border-primary-medium)]")})})]})})},ee.id)})})},q.id))}),l.jsxs(HD,{children:[epe&&!v&&t.length>0&&l.jsx("tr",{className:"absolute top-0 left-0 right-0 z-50 h-0",children:l.jsx("td",{colSpan:De.getVisibleLeafColumns().length,className:"p-0",children:l.jsx(Hyt,{})})}),Ht?l.jsx(rn,{showBorder:!1,className:"h-[300px]",children:l.jsx(Yn,{colSpan:De.getVisibleLeafColumns().length,className:"text-center",showBorder:!1,showRowBorder:!1,verticalAlign:"middle",children:At||l.jsx(Vyt,{error:Ht,onRetry:gt})})}):v&&(g==="replace"||t.length===0)?l.jsx(SX,{columns:De.getVisibleLeafColumns().length,rows:_pe,showRowBorder:Ze.showRowBorder,showCellBorder:Ze.showCellBorder,skipHeader:!0,enableResponsiveWrapper:l0}):De.getRowModel().rows?.length?(()=>{if(!G||!z){const se=new Set,xt=De.getRowModel().rows.filter(he=>Lt||he.depth===0),Bt=(he,nt,Dn)=>{if(se.has(he.id))return null;se.add(he.id);const ur=Uq.get(he.id)??-1;return l.jsxs(p.Fragment,{children:[l.jsx(rn,{"data-state":he.getIsSelected()&&"selected",showBorder:Ze.showRowBorder,"aria-rowindex":ur+2,"aria-selected":Q?he.getIsSelected():void 0,"aria-expanded":he.getCanExpand()?he.getIsExpanded():void 0,className:j("group",he.getIsSelected()&&"bg-[var(--blue-25)]",he.getIsPinned()==="top"&&"!bg-[var(--color-background-neutral-selected)] !border-b-2 !border-[var(--color-border-primary-medium)]",he.getIsPinned()==="bottom"&&"!bg-[var(--color-background-neutral-selected)] !border-t-2 !border-[var(--color-border-primary-medium)]",(()=>{const qt=he.getIsGrouped?.()?"font-medium":"",ya=_X(he,{enableGrouping:E,enableExpanding:W,nestedRowStyling:R,expandingRowColors:L,maxDepth:p0});return j(ya?`bg-[${ya}]`:"",qt)})(),$t&&zi(he)&&(dr||"cursor-pointer hover:[background-image:linear-gradient(rgba(0,0,0,0.02),rgba(0,0,0,0.02))]")),style:{height:Yyt(he.depth,R)},onClick:$t&&zi(he)?We=>aO(he,We):void 0,role:"row","aria-label":$t&&zi(he)?`View details for row ${he.id}`:void 0,"aria-current":h0(he)?"true":void 0,children:he.getVisibleCells().map((We,qt)=>{const ya=G1(We.column,!1,Ze.showRowBorder),hr=qt===0,K1=W&&he.getCanExpand()||E&&he.getIsGrouped(),Xa=he.getIsExpanded(),Ja=he.depth,lO=E&&he.getIsGrouped();let Vi=Vt?.(he);if(Vi==null)for(const va of he.getVisibleCells()){const ba=va.column.columnDef.sectionHeaderCell;if(ba){const dO=ba(va.getContext());if(dO!=null){Vi=dO;break}}}const Qa=Vi!=null;if(Qa&&!hr)return null;const ga=E&&he.depth>0&&qt===0&&!Dn;return l.jsx(Yn,{role:"gridcell","aria-colindex":qt+1,"data-row":ur,"data-col":qt,tabIndex:Ir[0]===ur&&Ir[1]===qt?0:-1,showBorder:sO(We.column)||cO(We.column)?!1:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:We.column.columnDef.meta?.verticalAlign||k,colSpan:Qa?he.getVisibleCells().length:void 0,"data-section-header":Qa?!0:void 0,className:j(hr&&h0(he)&&(me||Bq(Ze.showRowBorder)),!Qa&&Dpe(We.column),Object.keys(ya).length>0&&["z-10",(()=>{const va=_X(he,{enableGrouping:E,enableExpanding:W,nestedRowStyling:R,expandingRowColors:L,maxDepth:p0});return va?`bg-[${va}]`:"bg-[var(--color-surface-primary)]"})()],Qa&&"bg-[var(--blue-50)]",ga&&"![box-shadow:none]","focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]"),style:{...ya,paddingLeft:hr&&Ja>0&&!Qa?`calc(var(--space-md) + ${Ja*20}px)`:void 0},children:Qa?Vi:lO?hr?NX(he,De,K,Xa,B,$):We.column.columnDef.meta?.renderInGroupedRows?lu(We):We.column.columnDef.aggregatedCell?Xq(We):(()=>{const va=CX(We.column,he.subRows,he.groupingColumnId);if(!va)return l.jsx("div",{});const ba=We.column.columnDef.meta?.align||"left";return l.jsx(Ru,{align:ba,children:l.jsx("span",{className:j("text-[var(--color-text-secondary)] text-body-sm",ba==="right"?"tabular-nums":""),children:va})})})():l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[hr&&K1&&l.jsx("button",{tabIndex:-1,onClick:he.getToggleExpandedHandler(),className:"flex h-[var(--size-sm)] w-[var(--size-sm)] cursor-pointer items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",children:l.jsx(oe,{name:Xa?"chevron-down":"chevron-right",className:"h-3 w-3"})}),hr&&G&&!lO&&l.jsxs("div",{className:"flex items-center gap-1",children:[he.getIsPinned()!=="top"&&l.jsx("button",{tabIndex:-1,onClick:()=>he.pin("top"),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Pin to top",children:l.jsx(oe,{name:"arrow-up-to-line",className:"h-3 w-3"})}),he.getIsPinned()!=="bottom"&&l.jsx("button",{tabIndex:-1,onClick:()=>he.pin("bottom"),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Pin to bottom",children:l.jsx(oe,{name:"arrow-down-to-line",className:"h-3 w-3"})}),he.getIsPinned()&&l.jsx("button",{tabIndex:-1,onClick:()=>he.pin(!1),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Unpin row",children:l.jsx(oe,{name:"x",className:"h-3 w-3"})})]}),hr&&!K1&&!G&&(W||E)&&l.jsx("div",{className:"h-[var(--size-sm)] w-[var(--size-sm)]"}),l.jsx("div",{className:"flex-1 min-w-0",children:E&&he.depth>0&&(We.column.id===he.getParentRow()?.groupingColumnId||We.column.id===K)?l.jsx("div",{}):We.column.columnDef.meta?.truncate!==!1?l.jsx(Ru,{align:We.column.columnDef.meta?.align,children:lu(We)}):lu(We)})]})},We.id)})}),s0?.[he.id]&&he.getIsExpanded()&&l.jsx(rn,{showBorder:Ze.showRowBorder,children:l.jsx(Yn,{colSpan:he.getVisibleCells().length,showBorder:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:k,className:"py-[var(--space-md)]",children:l.jsxs("div",{className:"flex items-center justify-center gap-[var(--space-sm)]",children:[l.jsx(fo,{size:"sm"}),l.jsx("span",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"Loading..."})]})})}),Lt&&he.getIsExpanded()&&he.depth===0&&l.jsx(rn,{showBorder:Ze.showRowBorder,children:l.jsx(Yn,{colSpan:he.getVisibleCells().length,showBorder:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:k,className:"p-0","data-section-header":!0,children:Aq?.[he.id]?l.jsxs("div",{className:"flex flex-col items-center justify-center py-[var(--space-lg)] gap-[var(--space-sm)]",children:[l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)] text-[var(--color-text-danger)]",children:[l.jsx(oe,{name:"alert-circle",className:"h-4 w-4"}),l.jsx("span",{className:"text-body-sm",children:Aq[he.id]?.message||"Failed to load details"})]}),su&&l.jsx("button",{onClick:()=>su(he),className:"text-body-sm text-[var(--color-text-brand)] hover:underline cursor-pointer",children:"Try again"})]}):c0?.[he.id]?l.jsxs("div",{className:"flex items-center justify-center py-[var(--space-lg)]",children:[l.jsx(fo,{size:"sm"}),l.jsx("span",{className:"ml-[var(--space-sm)] text-body-sm text-[var(--color-text-secondary)]",children:"Loading details..."})]}):Lt(he)})}),(()=>{if(Lt)return null;const We=he.subRows&&he.subRows.length>0?he.subRows:f0?.get(he.id)||[];if(We.length===0)return null;let qt=he.getIsExpanded();return!qt&&jr===!0&&he.getCanExpand()&&(qt=!0),!qt&&typeof jr=="object"&&jr!==null&&jr[he.id]&&(qt=!0),qt?We.map((ya,hr)=>Bt(ya,hr,hr===We.length-1)):null})()]},he.id)};return xt.map((he,nt)=>Bt(he,nt,nt===xt.length-1))}const q=De.getCoreRowModel().rows,ee=De.getRowModel().rows,re=q.filter(se=>se.getIsPinned()==="top"),pe=q.filter(se=>se.getIsPinned()==="bottom"),ge=ee.filter(se=>!se.getIsPinned()),ve=[...re,...ge,...pe],$e=new Set,ut=ve.filter(se=>Lt||se.depth===0),_t=(se,xt,Bt)=>{if($e.has(se.id))return null;$e.add(se.id);const he=Uq.get(se.id)??-1;return l.jsxs(p.Fragment,{children:[l.jsx(rn,{"data-state":se.getIsSelected()&&"selected",showBorder:Ze.showRowBorder,"aria-rowindex":he+2,className:j("group",se.getIsSelected()&&"bg-[var(--blue-25)]",se.getIsPinned()==="top"&&"!bg-[var(--color-background-neutral-selected)] !border-b-2 !border-[var(--color-border-primary-medium)]",se.getIsPinned()==="bottom"&&"!bg-[var(--color-background-neutral-selected)] !border-t-2 !border-[var(--color-border-primary-medium)]",se.getIsGrouped?.()&&se.getIsExpanded()&&"bg-[var(--blue-50)] font-medium",se.getIsGrouped?.()&&!se.getIsExpanded()&&"bg-[var(--color-background-neutral-subtlest)] font-medium",E&&se.depth===1&&"bg-[var(--blue-25)]",W&&!se.getIsGrouped?.()&&(()=>{const nt=se.subRows&&se.subRows.length>0,Dn=()=>{let qt=se;for(;qt;){if(qt.getIsExpanded())return!0;qt=qt.getParentRow?.()}return!1};if(se.depth===0&&(!nt||!Dn()))return"";const ur=p0-se.depth,We=ur%2===0?"bg-[var(--blue-25)]":"bg-[var(--blue-50)]";if(L){if(ur===0&&L.children)return`bg-[${L.children}]`;if(ur>0&&se.getIsExpanded()&&L.expandedParent)return`bg-[${L.expandedParent}]`;if(ur>0&&!se.getIsExpanded()&&L.collapsedParent)return`bg-[${L.collapsedParent}]`}return We})(),$t&&zi(se)&&(dr||"cursor-pointer hover:[background-image:linear-gradient(rgba(0,0,0,0.02),rgba(0,0,0,0.02))]")),onClick:$t&&zi(se)?nt=>aO(se,nt):void 0,role:"row","aria-label":$t&&zi(se)?`View details for row ${se.id}`:void 0,"aria-current":h0(se)?"true":void 0,children:se.getVisibleCells().map((nt,Dn)=>{const ur=G1(nt.column,!1,Ze.showRowBorder),We=Dn===0,qt=W&&se.getCanExpand()||E&&se.getIsGrouped(),ya=se.getIsExpanded(),hr=se.depth,K1=E&&se.getIsGrouped();let Xa=Vt?.(se);if(Xa==null)for(const Bo of se.getVisibleCells()){const qo=Bo.column.columnDef.sectionHeaderCell;if(qo){const ga=qo(Bo.getContext());if(ga!=null){Xa=ga;break}}}const Ja=Xa!=null;if(Ja&&!We)return null;const Qa=E&&se.depth>0&&Dn===0&&!Bt;return l.jsx(Yn,{role:"gridcell","aria-colindex":Dn+1,"data-row":he,"data-col":Dn,tabIndex:Ir[0]===he&&Ir[1]===Dn?0:-1,showBorder:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:nt.column.columnDef.meta?.verticalAlign||k,colSpan:Ja?se.getVisibleCells().length:void 0,className:j(We&&h0(se)&&(me||Bq(Ze.showRowBorder)),"focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]",Object.keys(ur).length>0&&["z-10",se.getIsGrouped?.()&&se.getIsExpanded()&&"bg-[var(--blue-50)]",se.getIsGrouped?.()&&!se.getIsExpanded()&&"bg-[var(--color-background-neutral-subtlest)]",E&&se.depth===1&&"bg-[var(--blue-25)]",W&&!se.getIsGrouped?.()&&(()=>{const Bo=se.subRows&&se.subRows.length>0,qo=()=>{let ba=se;for(;ba;){if(ba.getIsExpanded())return!0;ba=ba.getParentRow?.()}return!1};if(se.depth===0&&(!Bo||!qo()))return"";const ga=p0-se.depth,va=ga%2===0?"bg-[var(--blue-25)]":"bg-[var(--blue-50)]";if(L){if(ga===0&&L.children)return`bg-[${L.children}]`;if(ga>0&&se.getIsExpanded()&&L.expandedParent)return`bg-[${L.expandedParent}]`;if(ga>0&&!se.getIsExpanded()&&L.collapsedParent)return`bg-[${L.collapsedParent}]`}return va})(),!se.getIsGrouped?.()&&!(E&&se.depth===1)&&!W&&"bg-[var(--color-surface-primary)]"],Ja&&"bg-[var(--blue-50)]",Qa&&"![box-shadow:none]"),style:{...ur,width:nt.column.getSize(),...Ja?{height:"32px",padding:"0"}:{},paddingLeft:We&&hr>0&&!Ja?`calc(var(--space-md) + ${hr*20}px)`:void 0},children:Ja?Xa:K1?We?NX(se,De,K,ya,B,$):nt.column.columnDef.meta?.renderInGroupedRows?lu(nt):nt.column.columnDef.aggregatedCell?Xq(nt):(()=>{const Bo=CX(nt.column,se.subRows,se.groupingColumnId);if(!Bo)return l.jsx("div",{});const qo=nt.column.columnDef.meta?.align||"left";return l.jsx(Ru,{align:qo,children:l.jsx("span",{className:j("text-[var(--color-text-secondary)] text-body-sm",qo==="right"?"tabular-nums":""),children:Bo})})})():l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[We&&qt&&l.jsx("button",{onClick:se.getToggleExpandedHandler(),className:"flex h-[var(--size-sm)] w-[var(--size-sm)] cursor-pointer items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",children:l.jsx(oe,{name:ya?"chevron-down":"chevron-right",className:"h-3 w-3"})}),We&&G&&!K1&&l.jsxs("div",{className:"flex items-center gap-1",children:[se.getIsPinned()!=="top"&&l.jsx("button",{onClick:()=>se.pin("top"),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Pin to top",children:l.jsx(oe,{name:"arrow-up-to-line",className:"h-3 w-3"})}),se.getIsPinned()!=="bottom"&&l.jsx("button",{onClick:()=>se.pin("bottom"),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Pin to bottom",children:l.jsx(oe,{name:"arrow-down-to-line",className:"h-3 w-3"})}),se.getIsPinned()&&l.jsx("button",{onClick:()=>se.pin(!1),className:"opacity-0 group-hover:opacity-100 flex h-[var(--size-sm)] w-[var(--size-sm)] items-center justify-center rounded-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",title:"Unpin row",children:l.jsx(oe,{name:"x",className:"h-3 w-3"})})]}),We&&!qt&&!G&&(W||E)&&l.jsx("div",{className:"h-[var(--size-sm)] w-[var(--size-sm)]"}),l.jsx("div",{className:"flex-1 min-w-0",children:E&&se.depth>0&&(nt.column.id===se.getParentRow()?.groupingColumnId||nt.column.id===K)?l.jsx("div",{}):nt.column.columnDef.meta?.truncate!==!1?l.jsx(Ru,{align:nt.column.columnDef.meta?.align,children:lu(nt)}):lu(nt)})]})},nt.id)})}),s0?.[se.id]&&se.getIsExpanded()&&l.jsx(rn,{showBorder:Ze.showRowBorder,children:l.jsx(Yn,{colSpan:se.getVisibleCells().length,showBorder:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:k,className:"py-[var(--space-md)]",children:l.jsxs("div",{className:"flex items-center justify-center gap-[var(--space-sm)]",children:[l.jsx(fo,{size:"sm"}),l.jsx("span",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"Loading..."})]})})}),Lt&&se.getIsExpanded()&&se.depth===0&&l.jsx(rn,{showBorder:Ze.showRowBorder,children:l.jsx(Yn,{colSpan:se.getVisibleCells().length,showBorder:Ze.showCellBorder,showRowBorder:Ze.showRowBorder,verticalAlign:k,className:"p-0","data-section-header":!0,children:c0?.[se.id]?l.jsxs("div",{className:"flex items-center justify-center py-[var(--space-lg)]",children:[l.jsx(fo,{size:"sm"}),l.jsx("span",{className:"ml-[var(--space-sm)] text-body-sm text-[var(--color-text-secondary)]",children:"Loading details..."})]}):Lt(se)})}),(()=>{if(Lt)return null;const nt=se.subRows&&se.subRows.length>0?se.subRows:f0?.get(se.id)||[];if(nt.length===0)return null;let Dn=se.getIsExpanded();return!Dn&&jr===!0&&se.getCanExpand()&&(Dn=!0),!Dn&&typeof jr=="object"&&jr!==null&&jr[se.id]&&(Dn=!0),Dn?nt.map((ur,We)=>_t(ur,We,We===nt.length-1)):null})()]},se.id)};return ut.map((se,xt)=>_t(se,xt,xt===ut.length-1))})():Pq.length>0||QD!==""?l.jsx(rn,{showBorder:!1,className:"h-[300px]",children:l.jsx(Yn,{colSpan:oO.length,className:"text-center",showBorder:!1,showRowBorder:!1,verticalAlign:"middle",children:z1||l.jsx(Fyt,{title:Xhe,description:Jhe,action:Qhe})})}):l.jsx(rn,{showBorder:!1,className:"h-[300px]",children:l.jsx(Yn,{colSpan:oO.length,className:"text-center",showBorder:!1,showRowBorder:!1,verticalAlign:"middle",children:fa||l.jsx(zyt,{title:Rn,description:Kr,action:Ti})})})]})]})]}),X&&l.jsx("div",{className:"bg-[var(--color-surface-primary)] px-[var(--space-lg)] py-[var(--space-md)]",children:l.jsx(Gyt,{table:De,enableGrouping:E,hideChildrenForSingleItemGroups:B,footerLabel:Ee,onNextPageHover:Re,onPreviousPageHover:Ve,paginationVariant:ye,pageSizeOptions:ie})}),ot&&qe&&l.jsx(Kyt,{onLoadMore:()=>ot(ma.pageIndex),isLoading:ze})]})})})}function Jyt(e){if(!e)return null;try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function Qyt(e,t){if(e)try{localStorage.setItem(e,JSON.stringify(t))}catch(n){console.warn("Failed to save settings to localStorage:",n)}}function IX(e="table",t=[]){return{viewMode:e,table:{sortDirection:"asc",visibleColumns:t.map(n=>n.id)},columns:{sortDirection:"asc"},folders:{sortDirection:"asc",showFoldersFirst:!1}}}function LT(e){if(e?.directionOptions)return e.directionOptions;if(e?.dataType)switch(e.dataType){case"text":return{asc:"A to Z",desc:"Z to A"};case"number":return{asc:"Ascending",desc:"Descending"};case"date":return{asc:"Oldest first",desc:"Newest first"};case"boolean":return{asc:"False first",desc:"True first"}}return{asc:"Ascending",desc:"Descending"}}const che=w.forwardRef(function({persistenceKey:t,defaultViewMode:n="table",sortableColumns:r=[],groupableColumns:a=[],columns:o=[],columnsSortableColumns:i,columnsGroupableColumns:s,foldersSortableColumns:c,align:d="end",triggerClassName:u},h){const[m,y]=w.useState(()=>{const K=Jyt(t);return K||IX(n,o)}),[v,g]=w.useState("");w.useImperativeHandle(h,()=>({getSettings:()=>m,reset:()=>{y(IX(n,o))}})),w.useEffect(()=>{Qyt(t,m)},[m,t]),w.useEffect(()=>{m.viewMode==="columns"&&!m.columns.groupColumn&&s&&s.length>0&&y(K=>({...K,columns:{...K.columns,groupColumn:s[0].id}}))},[m.viewMode,m.columns.groupColumn,s]);const b=r.length>0,x=a.length>0,k=o.length>0,M=(i?.length??0)>0,C=(s?.length??0)>0,S=(c?.length??0)>0,N=1+(S?1:0)+(C?1:0)>1,I=v?o.filter(K=>K.label.toLowerCase().includes(v.toLowerCase())):o,A=o.length>=20,T=K=>{y(B=>({...B,viewMode:K}))},P=K=>{y(B=>({...B,table:{...B.table,sortColumn:K}}))},F=K=>{y(B=>({...B,table:{...B.table,sortDirection:K}}))},U=K=>{y(B=>({...B,table:{...B.table,groupColumn:K==="none"?void 0:K}}))},W=(K,B)=>{y($=>({...$,table:{...$.table,visibleColumns:B?[...$.table.visibleColumns,K]:$.table.visibleColumns.filter(G=>G!==K)}}))},Z=K=>{y(B=>({...B,columns:{...B.columns,sortColumn:K}}))},L=K=>{y(B=>({...B,columns:{...B.columns,sortDirection:K}}))},R=K=>{y(B=>({...B,columns:{...B.columns,groupColumn:K==="none"?void 0:K}}))},E=K=>{y(B=>({...B,folders:{...B.folders,sortColumn:K}}))},O=K=>{y(B=>({...B,folders:{...B.folders,sortDirection:K}}))},J=K=>{y(B=>({...B,folders:{...B.folders,showFoldersFirst:K}}))};return l.jsxs(Ao,{children:[l.jsx(Fa,{asChild:!0,children:l.jsx(Oe,{size:"md",icon:"settings",className:u})}),l.jsxs(za,{align:d,className:"w-72 max-w-[90vw]",children:[N&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-3 pt-3 pb-2",children:[l.jsx("h3",{className:"text-label-sm text-[var(--color-text-tertiary)] mb-2",children:"View mode"}),l.jsx(ZH,{value:m.viewMode,onValueChange:T,children:l.jsxs(YH,{variant:"pilled",size:"sm",fullWidth:!0,children:[l.jsx(Sp,{variant:"pilled",size:"sm",fullWidth:!0,value:"table",children:"Table"}),S&&l.jsx(Sp,{variant:"pilled",size:"sm",fullWidth:!0,value:"folders",children:"Folders"}),C&&l.jsx(Sp,{variant:"pilled",size:"sm",fullWidth:!0,value:"columns",children:"Columns"})]})})]}),l.jsx(Jr,{})]}),l.jsxs("div",{className:"p-3",children:[m.viewMode==="table"&&l.jsxs("div",{className:"space-y-4",children:[b&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Sorting"}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs(On,{value:m.table.sortColumn,onValueChange:P,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to sort"})}),l.jsx(Pn,{children:r.map(K=>l.jsx(wt,{value:K.id,children:K.label},K.id))})]}),m.table.sortColumn&&l.jsxs(On,{value:m.table.sortDirection,onValueChange:K=>F(K),children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{})}),l.jsx(Pn,{children:(()=>{const K=r.find($=>$.id===m.table.sortColumn),B=LT(K);return l.jsxs(l.Fragment,{children:[l.jsx(wt,{value:"asc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-narrow-wide",size:"sm"}),l.jsx("span",{children:B.asc})]})}),l.jsx(wt,{value:"desc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-wide-narrow",size:"sm"}),l.jsx("span",{children:B.desc})]})})]})})()})]})]})]}),x&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Grouping"}),l.jsxs(On,{value:m.table.groupColumn||"none",onValueChange:U,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to group by"})}),l.jsxs(Pn,{children:[l.jsx(wt,{value:"none",children:"None"}),a.map(K=>l.jsx(wt,{value:K.id,children:K.label},K.id))]})]})]}),k&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Display columns"}),A&&l.jsx(Fn,{type:"search",size:"sm",placeholder:"Search columns...",value:v,onChange:K=>g(K.target.value)}),l.jsx("div",{className:"flex flex-wrap items-start justify-start gap-1 max-h-[190px] overflow-y-auto",children:I.map(K=>{const B=m.table.visibleColumns.includes(K.id);return l.jsx(hD,{variant:"outline",size:"sm",pressed:B,onPressedChange:$=>{W(K.id,$)},children:K.label},K.id)})})]})]}),m.viewMode==="folders"&&c&&c.length>0&&l.jsx(l.Fragment,{children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Sorting"}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs(On,{value:m.folders.sortColumn,onValueChange:E,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column"})}),l.jsx(Pn,{children:c.map(K=>l.jsx(wt,{value:K.id,children:K.label},K.id))})]}),m.folders.sortColumn&&l.jsxs(On,{value:m.folders.sortDirection,onValueChange:K=>O(K),children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{})}),l.jsx(Pn,{children:(()=>{const K=c.find($=>$.id===m.folders.sortColumn),B=LT(K);return l.jsxs(l.Fragment,{children:[l.jsx(wt,{value:"asc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-narrow-wide",size:"sm"}),l.jsx("span",{children:B.asc})]})}),l.jsx(wt,{value:"desc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-wide-narrow",size:"sm"}),l.jsx("span",{children:B.desc})]})})]})})()})]})]})]})}),m.viewMode==="columns"&&l.jsxs("div",{className:"space-y-4",children:[C&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Grouping"}),l.jsxs(On,{value:m.columns.groupColumn||"none",onValueChange:R,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to group by"})}),l.jsxs(Pn,{children:[l.jsx(wt,{value:"none",children:"None"}),s?.map(K=>l.jsx(wt,{value:K.id,children:K.label},K.id))]})]})]}),M&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-label-sm text-[var(--color-text-tertiary)]",children:"Sorting"}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs(On,{value:m.columns.sortColumn,onValueChange:Z,children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{placeholder:"Select column to sort"})}),l.jsx(Pn,{children:i?.map(K=>l.jsx(wt,{value:K.id,children:K.label},K.id))})]}),m.columns.sortColumn&&l.jsxs(On,{value:m.columns.sortDirection,onValueChange:K=>L(K),children:[l.jsx(An,{size:"sm",children:l.jsx(Xn,{})}),l.jsx(Pn,{children:(()=>{const K=i?.find($=>$.id===m.columns.sortColumn),B=LT(K);return l.jsxs(l.Fragment,{children:[l.jsx(wt,{value:"asc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-narrow-wide",size:"sm"}),l.jsx("span",{children:B.asc})]})}),l.jsx(wt,{value:"desc",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oe,{name:"arrow-down-wide-narrow",size:"sm"}),l.jsx("span",{children:B.desc})]})})]})})()})]})]})]})]})]}),m.viewMode==="folders"&&l.jsxs(l.Fragment,{children:[l.jsx(Jr,{}),l.jsx("div",{className:"p-3",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(F2,{htmlFor:"folders-first",children:"Show folders first"}),l.jsx(WH,{id:"folders-first",checked:m.folders.showFoldersFirst,onCheckedChange:J})]})})]})]})]})});che.displayName="ViewModeMenu";function a0(){const e=new Date,t=e.getDay(),n=(t===0?-6:1)-t,r=new Date(e);return r.setDate(e.getDate()+n),r.setHours(0,0,0,0),r}function lhe(){const e=a0(),t=new Date(e);return t.setDate(e.getDate()+6),t.setHours(23,59,59,999),t}function dhe(){const e=new Date;return new Date(e.getFullYear(),e.getMonth(),1)}function uhe(){const e=new Date;return new Date(e.getFullYear(),e.getMonth()+1,0,23,59,59,999)}function hhe(){const e=new Date;return new Date(e.getFullYear(),0,1)}function phe(){const e=new Date;return new Date(e.getFullYear(),11,31,23,59,59,999)}function fhe(){const e=a0(),t=new Date(e);return t.setDate(e.getDate()-7),t}function mhe(){const e=a0(),t=new Date(e);return t.setDate(e.getDate()-1),t.setHours(23,59,59,999),t}function yhe(){const e=new Date;return new Date(e.getFullYear(),e.getMonth()-1,1)}function ghe(){const e=new Date;return new Date(e.getFullYear(),e.getMonth(),0,23,59,59,999)}function vhe(){const e=new Date;return new Date(e.getFullYear()-1,0,1)}function bhe(){const e=new Date;return new Date(e.getFullYear()-1,11,31,23,59,59,999)}function SP(e){const t=new Date,n=new Date(t);return n.setDate(t.getDate()-e),n.setHours(0,0,0,0),n}function _P(){const e=new Date;return e.setHours(23,59,59,999),e}function mq(){const e=new Date,t=Math.floor(e.getMonth()/3);return new Date(e.getFullYear(),t*3,1)}function xhe(){const e=new Date,t=Math.floor(e.getMonth()/3);return new Date(e.getFullYear(),t*3+3,0,23,59,59,999)}function yq(){const e=new Date,t=Math.floor(e.getMonth()/3),n=t===0?3:t-1,r=t===0?e.getFullYear()-1:e.getFullYear();return new Date(r,n*3,1)}function khe(){const e=new Date,t=Math.floor(e.getMonth()/3),n=t===0?3:t-1,r=t===0?e.getFullYear()-1:e.getFullYear();return new Date(r,n*3+3,0,23,59,59,999)}function SF(e){return`Q${Math.floor(e.getMonth()/3)+1} ${e.getFullYear()}`}function _F(e){switch(e){case"this-week":return[a0(),lhe()];case"this-month":return[dhe(),uhe()];case"this-year":return[hhe(),phe()];case"last-week":return[fhe(),mhe()];case"last-month":return[yhe(),ghe()];case"last-year":return[vhe(),bhe()];case"last-30-days":return[SP(30),_P()];case"last-90-days":return[SP(90),_P()];case"last-6-months":return[SP(180),_P()];case"this-quarter":return[mq(),xhe()];case"last-quarter":return[yq(),khe()];default:return}}function whe(e,t){const n={year:"numeric",month:"short",day:"numeric"},r=e.toLocaleDateString("en-US",n),a=t.toLocaleDateString("en-US",n);return`${r} - ${a}`}function Mhe(e){return{custom:"Custom","this-week":"This week","this-month":"This month","this-year":"This year","last-week":"Last week","last-month":"Last month","last-year":"Last year","last-30-days":"Last 30 days","last-90-days":"Last 90 days","last-6-months":"Last 6 months","this-quarter":`This quarter (${SF(mq())})`,"last-quarter":`Last quarter (${SF(yq())})`}[e]||e}const Che=["this-month","last-month","this-quarter","last-quarter","this-year","last-year","custom"],She=["this-week","last-week","last-30-days","last-90-days","this-month","last-month","custom"];function egt(e){let t=0;if(e.groups)for(const n of e.groups)for(const r of n.options)t++,r.children&&(t+=r.children.length);return e.options&&(t=e.options.length),t}const gq=p.memo(function({filter:t,value:n,onChange:r,onReset:a,autoFocusSearch:o=!0}){const[i,s]=p.useState(""),c=p.useDeferredValue(i),[d,u]=p.useState(""),[h,m]=p.useState(""),[y,v]=p.useState(null),[g,b]=p.useState(null),[x,k]=p.useState(!1),[M,C]=p.useState(new Date().getFullYear()),S=p.useMemo(()=>n?Array.isArray(n)?n.map(String):[String(n)]:[],[n]);p.useEffect(()=>{if(t.type==="number"&&t.rangeMode){const R=n;if(Array.isArray(R)){const[E,O]=R;u(E===-1/0?"":E?.toString()||""),m(O===1/0?"":O?.toString()||"")}else typeof R=="number"?(u(R.toString()),m("")):(u(""),m(""));v(null),b(null)}},[n,t.type,t.rangeMode]);const _=p.useMemo(()=>{const R=t.showSearch??"auto";if(R===!0)return!0;if(R===!1)return!1;const E=egt(t),O=t.searchThreshold??8;return E>=O},[t]),N=p.useMemo(()=>{if(t.groups){if(!c)return t.groups;const R=c.toLowerCase();return t.groups.map(E=>({...E,options:E.options.filter(O=>O.label.toLowerCase().includes(R)||O.children?.some(J=>J.label.toLowerCase().includes(R)))})).filter(E=>E.options.length>0)}if(t.options){const R=c?t.options.filter(E=>E.label.toLowerCase().includes(c.toLowerCase())):t.options;return R.length>0?[{label:t.label,options:R}]:[]}return[]},[t.groups,t.options,t.label,c]),I=R=>{if(t.type==="multiselect"){const E=S.includes(R)?S.filter(O=>O!==R):[...S,R];r(E.length>0?E:void 0)}else r(R===S[0]?void 0:R)},A=R=>{if(t.type!=="multiselect")return;const E=R.options.flatMap(J=>[J.value,...J.children?.map(K=>K.value)||[]]),O=S.filter(J=>!E.includes(J));r(O.length>0?O:void 0)},T=R=>{if(t.type!=="multiselect")return;const E=R.options.flatMap(J=>[J.value,...J.children?.map(K=>K.value)||[]]),O=Array.from(new Set([...S,...E]));r(O.length>0?O:void 0)},P=R=>{if(t.type!=="multiselect")return;const O=R.options.filter($=>!i||$.label.toLowerCase().includes(i.toLowerCase())).flatMap($=>{const G=$.value,z=$.children?.filter(H=>!i||H.label.toLowerCase().includes(i.toLowerCase())).map(H=>H.value)||[];return[G,...z]}),J=S.filter($=>!O.includes($)),K=O.filter($=>!S.includes($)),B=[...J,...K];r(B.length>0?B:void 0)},F=()=>{const R=d.trim(),E=h.trim();if(v(null),b(null),R===""&&E===""){r(void 0);return}const O=R===""?-1/0:parseFloat(R),J=E===""?1/0:parseFloat(E);if(R!==""&&isNaN(O)){v("Invalid minimum value");return}if(E!==""&&isNaN(J)){b("Invalid maximum value");return}if(O!==-1/0&&J!==1/0&&O>J){v("Minimum must be less than maximum"),b("Maximum must be more than minimum");return}r([O,J])},U=t.dateConfig?.granularity||"month",W=()=>t.dateConfig?.presets?t.dateConfig.presets:U==="day"?She:Che,Z=()=>{if(x)return"custom";const R=n;if(!R||!Array.isArray(R))return W().includes("all-time")?"all-time":"";for(const E of W()){if(E==="custom")continue;const O=_F(E);if(O&&O[0].getTime()===R[0].getTime()&&O[1].getTime()===R[1].getTime())return E}return"custom"},L=R=>{if(R==="custom"){k(!0);return}k(!1);const E=_F(R);r(E)};return l.jsxs("div",{className:"flex flex-col gap-[var(--space-2xlg)]",children:[_&&l.jsxs("div",{className:"relative",children:[l.jsx(oe,{name:"search",className:"absolute left-[var(--space-md)] top-1/2 -translate-y-1/2 h-[var(--size-xsm)] w-[var(--size-xsm)] text-[var(--color-text-tertiary)] pointer-events-none"}),l.jsx(Fn,{type:"text",size:"lg",placeholder:t.searchPlaceholder||`Search for a ${t.label.toLowerCase()}`,value:i,onChange:R=>s(R.target.value),className:"pl-[calc(var(--space-md)+var(--size-xsm)+var(--space-sm))]",autoFocus:o})]}),t.type==="number"&&t.rangeMode&&l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("div",{className:"text-body-medium-sm text-[var(--color-text-tertiary)]",children:t.label}),l.jsx("div",{className:"h-px w-full mb-[var(--space-sm)]",children:l.jsx("div",{"aria-hidden":"true",className:"border-[var(--color-border-primary-subtle)] border-[0px_0px_1px] border-solid h-px"})}),l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("label",{className:"text-label-md text-[var(--color-text-primary)]",children:"At least..."}),l.jsxs("div",{className:"relative",children:[t.numberConfig?.prefix&&l.jsx("span",{className:"absolute left-[var(--space-md)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none",children:t.numberConfig.prefix}),l.jsx(Fn,{type:"text",inputMode:"numeric",size:"lg",variant:y?"error":"default",value:d,onChange:R=>{u(R.target.value),v(null)},onBlur:F,onKeyDown:R=>{R.key==="Enter"&&F()},placeholder:t.numberConfig?.min?.toString()||"0.00",className:j(t.numberConfig?.prefix&&"pl-[calc(var(--space-lg)+var(--space-md))]",t.numberConfig?.suffix&&"pr-[calc(var(--space-lg)+var(--space-md))]")}),t.numberConfig?.suffix&&l.jsx("span",{className:"absolute right-[var(--space-md)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none",children:t.numberConfig.suffix})]}),y&&l.jsx("span",{className:"text-caption-sm text-[var(--color-text-error-bold)]",children:y})]}),l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("label",{className:"text-label-md text-[var(--color-text-primary)]",children:"No more than..."}),l.jsxs("div",{className:"relative",children:[t.numberConfig?.prefix&&l.jsx("span",{className:"absolute left-[var(--space-md)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none",children:t.numberConfig.prefix}),l.jsx(Fn,{type:"text",inputMode:"numeric",size:"lg",variant:g?"error":"default",value:h,onChange:R=>{m(R.target.value),b(null)},onBlur:F,onKeyDown:R=>{R.key==="Enter"&&F()},placeholder:t.numberConfig?.max?.toString()||"0.00",className:j(t.numberConfig?.prefix&&"pl-[calc(var(--space-lg)+var(--space-md))]",t.numberConfig?.suffix&&"pr-[calc(var(--space-lg)+var(--space-md))]")}),t.numberConfig?.suffix&&l.jsx("span",{className:"absolute right-[var(--space-md)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none",children:t.numberConfig.suffix})]}),g&&l.jsx("span",{className:"text-caption-sm text-[var(--color-text-error-bold)]",children:g})]}),a&&(d!==""||h!=="")&&l.jsx(Oe,{variant:"default",onClick:()=>{u(""),m(""),v(null),b(null),a()},className:"self-start",children:l.jsx("span",{className:"text-body-medium-sm",children:"Reset"})})]}),t.type==="date"&&t.rangeMode&&l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("div",{className:"text-body-medium-sm text-[var(--color-text-tertiary)]",children:t.label}),l.jsx("div",{className:"h-px w-full mb-[var(--space-sm)]",children:l.jsx("div",{"aria-hidden":"true",className:"border-[var(--color-border-primary-subtle)] border-[0px_0px_1px] border-solid h-px"})}),l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("label",{className:"text-label-md text-[var(--color-text-primary)]",children:"Date range"}),l.jsxs(On,{value:Z(),onValueChange:L,children:[l.jsx(An,{size:"lg",children:l.jsx(Xn,{placeholder:"Select date range..."})}),l.jsx(Pn,{children:W().map(R=>l.jsx(wt,{value:R,children:Mhe(R)},R))})]})]}),Z()==="custom"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)]",children:U==="day"?"Select start and end dates for custom range":"Select start and end months for custom range"}),U==="day"&&l.jsx(Z2,{mode:"range",selected:n&&Array.isArray(n)&&n.length===2?{from:n[0],to:n[1]}:void 0,onSelect:R=>{if(R?.from&&R?.to){const E=new Date(R.from);E.setHours(0,0,0,0);const O=new Date(R.to);O.setHours(23,59,59,999),r([E,O]),k(!1)}},numberOfMonths:2,disabled:t.dateConfig?.minDate||t.dateConfig?.maxDate?R=>!!(t.dateConfig?.minDate&&R<t.dateConfig.minDate||t.dateConfig?.maxDate&&R>t.dateConfig.maxDate):void 0}),U==="month"&&l.jsx(SB,{value:n,onChange:R=>{r(R),k(!1)},mode:"range",yearCount:2,size:"small",enableNavigation:!0,onYearNavigate:R=>C(R),minDate:t.dateConfig?.minDate,maxDate:t.dateConfig?.maxDate})]})]}),N.map((R,E)=>{const O=`filter-group-${E}-${R.label.replace(/\s+/g,"-").toLowerCase()}`;return l.jsxs("div",{role:"group","aria-labelledby":O,className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsxs("div",{className:"flex gap-[var(--space-sm)] items-start justify-start w-full",children:[l.jsx("div",{id:O,className:"flex-1 text-body-medium-sm text-[var(--color-text-tertiary)]",children:R.label}),a&&t.type==="multiselect"&&l.jsxs("div",{className:"flex gap-[var(--space-xsm)] items-center text-body-medium-sm text-[var(--color-text-brand-bold)]",children:[l.jsx("button",{onClick:()=>T(R),"aria-label":`Select all ${R.label} options`,className:"hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",children:"All"}),l.jsx("span",{className:"text-[var(--color-text-tertiary)]","aria-hidden":"true",children:"•"}),l.jsx("button",{onClick:()=>P(R),"aria-label":`Inverse selection in ${R.label}`,className:"hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",children:"Inverse"}),l.jsx("span",{className:"text-[var(--color-text-tertiary)]","aria-hidden":"true",children:"•"}),l.jsx("button",{onClick:()=>A(R),"aria-label":`Clear all ${R.label} selections`,className:"hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",children:"None"})]})]}),l.jsx("div",{className:"h-px w-full",children:l.jsx("div",{"aria-hidden":"true",className:"border-[var(--color-border-primary-subtle)] border-[0px_0px_1px] border-solid h-px"})}),t.type==="multiselect"?l.jsx("div",{className:"flex flex-col gap-[var(--space-sm)]",children:R.options.map(J=>l.jsxs(p.Fragment,{children:[l.jsxs("div",{className:"flex gap-[var(--space-sm)] h-[20px] items-center",children:[l.jsx(Mi,{id:`checkbox-${t.id}-${J.value}`,checked:S.includes(J.value),onCheckedChange:()=>I(J.value)}),l.jsx("label",{htmlFor:`checkbox-${t.id}-${J.value}`,className:"flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",children:J.label})]}),J.children&&J.children.map(K=>l.jsxs("div",{className:"flex gap-[var(--space-sm)] h-[20px] items-center pl-[var(--space-2xlg)]",children:[l.jsx(Mi,{id:`checkbox-${t.id}-${K.value}`,checked:S.includes(K.value),onCheckedChange:()=>I(K.value)}),l.jsx("label",{htmlFor:`checkbox-${t.id}-${K.value}`,className:"flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",children:K.label})]},K.value))]},J.value))}):l.jsx(NH,{value:S[0]||"",onValueChange:I,"aria-label":R.label,children:l.jsx("div",{className:"flex flex-col gap-[var(--space-sm)]",children:R.options.map(J=>l.jsxs(p.Fragment,{children:[l.jsxs("div",{className:"flex gap-[var(--space-sm)] h-[20px] items-center",children:[l.jsx(CE,{id:`radio-${t.id}-${J.value}`,value:J.value}),l.jsx("label",{htmlFor:`radio-${t.id}-${J.value}`,className:"flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",children:J.label})]}),J.children&&J.children.map(K=>l.jsxs("div",{className:"flex gap-[var(--space-sm)] h-[20px] items-center pl-[var(--space-2xlg)]",children:[l.jsx(CE,{id:`radio-${t.id}-${K.value}`,value:K.value}),l.jsx("label",{htmlFor:`radio-${t.id}-${K.value}`,className:"flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",children:K.label})]},K.value))]},J.value))})})]},R.label)})]})}),jX=p.memo(function({filter:t,isSelected:n,isPinned:r,valueCount:a,onSelect:o,onTogglePin:i,onPrefetch:s}){const c=t.icon,[d,u]=p.useState(!1);return l.jsxs("div",{id:`filter-option-${t.id}`,role:"option","aria-selected":n,"aria-label":`${t.label}${a?`, ${a} selected`:""}`,tabIndex:-1,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o())},onMouseEnter:()=>{u(!0),s?.()},onMouseLeave:()=>u(!1),className:j("group/item box-border flex gap-[var(--space-md)] h-[var(--size-md)] items-center justify-start px-[var(--space-lg)] py-[var(--space-sm)] relative rounded-md shrink-0 w-full cursor-pointer transition-colors","hover:bg-[var(--color-background-neutral-hovered)]",n&&"bg-[var(--color-background-blue-subtle-selected)] hover:bg-[var(--color-background-blue-subtle-selected-hovered)] group-focus-visible/listbox:ring-2 group-focus-visible/listbox:ring-[var(--ring-color)] group-focus-visible/listbox:ring-inset"),onClick:o,children:[l.jsxs("div",{className:"flex-1 flex gap-[var(--space-sm)] items-center justify-start min-w-0",children:[l.jsx(c,{className:j("h-[var(--size-2xsm)] w-[var(--size-2xsm)] shrink-0",n?"text-[var(--color-text-brand-bold)]":"text-[var(--color-text-primary)]")}),l.jsx("div",{className:j("truncate [&]:text-label-md",n?"text-[var(--color-text-brand-bold)]":"text-[var(--color-text-primary)]"),children:t.label}),a!==void 0&&a>0&&l.jsx(sn,{size:"sm",intent:n?"brand":"neutral",appearance:n||d?"bold":"subtle",children:a})]}),l.jsx("div",{className:"flex items-center gap-[var(--space-sm)] shrink-0",children:l.jsx(Oe,{variant:"ghost",size:"sm",tabIndex:-1,"aria-label":r?`Unpin ${t.label} filter`:`Pin ${t.label} filter`,"aria-pressed":r,onClick:h=>{h.stopPropagation(),i()},className:j("group/pin h-auto w-auto p-[var(--space-xsm)] transition-opacity",r?"opacity-100":"opacity-0 group-hover/item:opacity-100"),children:r?l.jsxs(l.Fragment,{children:[l.jsx(oe,{name:"pin","aria-hidden":"true",className:j("h-[12px] w-[12px] group-hover/pin:hidden",n?"text-[var(--color-text-brand-bold)]":"text-[var(--color-text-primary)]")}),l.jsx(oe,{name:"pin-off","aria-hidden":"true",className:j("h-[12px] w-[12px] hidden group-hover/pin:block",n?"text-[var(--color-text-brand-bold)]":"text-[var(--color-text-primary)]")})]}):l.jsx(oe,{name:"pin","aria-hidden":"true",className:j("h-[12px] w-[12px]",n?"text-[var(--color-text-brand-bold)]":"text-[var(--color-text-primary)]")})})})]})});function tgt({placeholder:e="Search for keyword...",onAddSearchTerm:t}){const[n,r]=p.useState(""),a=o=>{o.key==="Enter"&&n.trim()&&(o.preventDefault(),t(n.trim()),r(""))};return l.jsx("div",{className:"min-w-[200px] w-[280px]",children:l.jsx(Fn,{type:"search","aria-label":"Search filters by keyword",placeholder:e,value:n,onChange:o=>r(o.target.value),onKeyDown:a,size:"md"})})}function ngt({placeholder:e="Search for keyword...",onAddSearchTerm:t,suggestions:n,minCharacters:r}){const[a,o]=p.useState(""),i=(s,c)=>{t(s,c),o("")};return l.jsx("div",{className:"min-w-[200px] w-[280px]",children:l.jsx(PB,{value:a,onValueChange:o,onSelect:i,suggestions:n,placeholder:e,minCharacters:r})})}function _he({filters:e,pinnedFilters:t,activeFilters:n,onPinnedFiltersChange:r,onFilterChange:a,sidebarWidth:o=240}){const[i,s]=p.useState(e[0]?.id),[c,d]=p.useState("mouse"),u=p.useRef(null),h=p.useMemo(()=>e.map(k=>k.id),[e]),m=k=>{const M=h.indexOf(i);let C=M;switch(k.key){case"ArrowDown":k.preventDefault(),C=Math.min(M+1,h.length-1);break;case"ArrowUp":k.preventDefault(),C=Math.max(M-1,0);break;case"Home":k.preventDefault(),C=0;break;case"End":k.preventDefault(),C=h.length-1;break;default:return}C!==M&&(d("keyboard"),s(h[C]))},y=e.find(k=>k.id===i),v=p.useCallback(k=>{y&&a(y.id,k)},[y?.id,a]),g=p.useCallback(()=>{y&&a(y.id,void 0)},[y?.id,a]),b=k=>{const M=t.includes(k)?t.filter(C=>C!==k):[...t,k];r(M)},x=p.useMemo(()=>{const k={},M=[],C=[];return e.forEach(S=>{S.group?(k[S.group]||(k[S.group]=[],C.push(S.group)),k[S.group].push(S)):M.push(S)}),{grouped:k,ungrouped:M,groupOrder:C}},[e]);return l.jsx("div",{className:"bg-[var(--color-surface-primary)] relative rounded-md max-h-[480px] flex flex-col",children:l.jsxs("div",{className:"flex items-stretch justify-start min-h-0 overflow-hidden rounded-md flex-1",children:[l.jsx("div",{className:"bg-[var(--color-background-neutral-default)] relative shrink-0 border-r border-[var(--color-border-primary-subtle)] flex flex-col",style:{width:typeof o=="number"?`${o}px`:o},children:l.jsxs("div",{ref:u,role:"listbox","aria-label":"Filter categories","aria-orientation":"vertical","aria-activedescendant":i?`filter-option-${i}`:void 0,tabIndex:0,onKeyDown:m,className:"group/listbox box-border flex flex-col gap-[var(--space-sm)] p-[var(--space-sm)] overflow-y-auto focus-visible:outline-none",children:[x.ungrouped.map(k=>{const M=n[k.id],C=Array.isArray(M)?M.length:M!=null?1:0;return l.jsx(jX,{filter:k,isSelected:k.id===i,isPinned:t.includes(k.id),valueCount:C,onSelect:()=>{d("mouse"),s(k.id)},onTogglePin:()=>b(k.id)},k.id)}),x.groupOrder.map((k,M)=>{const C=x.grouped[k];return l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx("div",{className:j("px-[var(--space-md)] pb-[var(--space-xsm)]",M===0&&x.ungrouped.length===0?"pt-0":"pt-[var(--space-md)]"),children:l.jsx("div",{className:"text-caption-sm text-[var(--color-text-tertiary)] tracking-[0.1px]",children:k})}),C.map(S=>{const _=n[S.id],N=Array.isArray(_)?_.length:_!=null?1:0;return l.jsx(jX,{filter:S,isSelected:S.id===i,isPinned:t.includes(S.id),valueCount:N,onSelect:()=>{d("mouse"),s(S.id)},onTogglePin:()=>b(S.id)},S.id)})]},k)})]})}),l.jsx("div",{className:"flex-1 box-border p-[var(--space-lg)] overflow-y-auto",children:y&&l.jsx(gq,{filter:y,value:n[y.id],onChange:v,onReset:g,autoFocusSearch:c==="mouse"})})]})})}function rgt({filters:e,pinnedFilters:t,activeFilters:n,onPinnedFiltersChange:r,onFilterChange:a,onFilterClear:o,onFilterReset:i,enableGlobalSearch:s=!1,globalSearchTerms:c=[],onGlobalSearchChange:d,globalSearchPlaceholder:u,enableAutocomplete:h=!1,autocompleteMinCharacters:m=2,hideReset:y=!1,hideFiltersButton:v=!1,actionButtons:g}){const[b,x]=p.useState(!1),[k,M]=p.useState(null),[C,S]=p.useState(""),_=p.useRef(n),N=p.useRef(c),I=p.useRef({}),A=p.useCallback((z,H)=>{const D=k;M(z?H:null),!z&&D===H&&setTimeout(()=>{I.current[H]?.focus()},0)},[k]);p.useEffect(()=>{const z=_.current,H=N.current,D=Object.keys(n).filter(X=>n[X]!==void 0&&n[X]!==null&&(!Array.isArray(n[X])||n[X].length>0)).length,Y=Object.keys(z).filter(X=>z[X]!==void 0&&z[X]!==null&&(!Array.isArray(z[X])||z[X].length>0)).length,V=c.length,Q=H.length;let ae="";if(D!==Y&&(D>Y?ae="Filter applied.":D<Y&&(ae="Filter removed.")),V!==Q&&(V>Q?ae=ae?`${ae} Search term added.`:"Search term added.":V<Q&&(ae=ae?`${ae} Search term removed.`:"Search term removed.")),ae){const X=D+V;X===0?ae="All filters cleared.":ae=`${ae} ${X} active filter${X!==1?"s":""}.`,S(ae)}_.current=n,N.current=c},[n,c]);const T=!v&&e.length>0,P=Object.keys(n).some(z=>n[z]!==void 0&&n[z]!==null),F=c.length>0,U=Object.keys(n).filter(z=>{const H=n[z];return H!=null&&(!Array.isArray(H)||H.length>0)}).length,W=(z,H)=>{if(!z.groups)return H;for(const D of z.groups)for(const Y of D.options){if(Y.value===H)return Y.label;if(Y.children){const V=Y.children.find(Q=>Q.value===H);if(V)return V.label}}return H},Z=(z,H,D)=>{const Y=D?.prefix||"",V=D?.suffix||"";return z===-1/0?`≤ ${Y}${H}${V}`:H===1/0?`≥ ${Y}${z}${V}`:`${Y}${z}${V} - ${Y}${H}${V}`},L=z=>{const H=n[z.id];if(!H||Array.isArray(H)&&H.length===0)return{type:"empty",icon:z.icon,content:z.label};if(z.type==="number"&&z.rangeMode&&Array.isArray(H)&&H.length===2){const[D,Y]=H,V=z.formatValue?.([D.toString(),Y.toString()],2)??Z(D,Y,z.numberConfig);return{type:"values",icon:z.icon,content:V}}if(z.type==="date"&&z.rangeMode&&Array.isArray(H)&&H.length===2){const[D,Y]=H,V=z.formatValue?.([D.toISOString(),Y.toISOString()],2)??whe(D,Y);return{type:"values",icon:z.icon,content:V}}if(Array.isArray(H))if(H.length<=3){const D=H.map(String),Y=z.formatValue?.(D,D.length)??D.map(V=>W(z,V)).join(", ");return{type:"values",icon:z.icon,content:Y}}else return{type:"count",icon:z.icon,label:z.label,count:H.length};return{type:"values",icon:z.icon,content:W(z,String(H))}},R=e.filter(z=>t.includes(z.id)),E=p.useMemo(()=>{const z=[];for(const H of e){const D=Y=>{z.push({normalizedLabel:Y.toLowerCase(),filterId:H.id,icon:H.icon})};if(H.groups)for(const Y of H.groups)for(const V of Y.options)D(V.label),V.children?.forEach(Q=>D(Q.label));H.options&&H.options.forEach(Y=>{D(Y.label),Y.children?.forEach(V=>D(V.label))})}return z},[e]),O=p.useCallback(z=>{if(!z)return null;const H=z.toLowerCase();for(const D of E)if(D.normalizedLabel.includes(H))return{filterId:D.filterId,icon:D.icon};return null},[E]),J=p.useMemo(()=>c.filter(H=>H&&typeof H=="string").map(H=>{if(H.includes("|")){const[Y,V]=H.split("|"),Q=e.find(ae=>ae.label===V);return{value:H,matchedFilter:Q?{filterId:Q.id,icon:Q.icon}:void 0}}const D=O(H);return{value:H,matchedFilter:D?{filterId:D.filterId,icon:D.icon}:void 0}}),[c,e,O]),K=p.useMemo(()=>{if(!h||!s)return[];const z=[];return e.forEach(H=>{H.groups?H.groups.forEach(D=>{D.options.forEach(Y=>{Y.label&&Y.value&&z.push({label:Y.label,value:Y.value,filterLabel:H.label,filterIcon:H.icon}),Y.children&&Y.children.forEach(V=>{V.label&&V.value&&z.push({label:V.label,value:V.value,filterLabel:H.label,filterIcon:H.icon})})})}):H.options&&H.options.forEach(D=>{D.label&&D.value&&z.push({label:D.label,value:D.value,filterLabel:H.label,filterIcon:H.icon}),D.children&&D.children.forEach(Y=>{Y.label&&Y.value&&z.push({label:Y.label,value:Y.value,filterLabel:H.label,filterIcon:H.icon})})})}),z.sort((H,D)=>{const Y=H.label.localeCompare(D.label);return Y!==0?Y:H.filterLabel.localeCompare(D.filterLabel)})},[e,h,s]),B=(z,H)=>{if(!d)return;const D=H?`${z}|${H}`:z;c.includes(D)||d([...c,D])},$=z=>{d&&d(c.filter(H=>H!==z))},G=()=>{i(),d&&F&&d([])};return l.jsxs("div",{className:"flex gap-[3px] items-center min-w-0",children:[l.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:C}),T&&l.jsxs(Ur,{open:b,onOpenChange:x,children:[l.jsx(sa,{asChild:!0,children:l.jsxs(Oe,{className:"h-[var(--size-md)] gap-[var(--space-xsm)]","aria-label":`Filters${U>0?`, ${U} active`:""}`,"aria-expanded":b,"aria-haspopup":"dialog",children:[l.jsx(oe,{name:"list-filter",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]","aria-hidden":"true"}),l.jsx("span",{className:"text-label-md",children:"Filters"}),U>0&&l.jsx(sn,{size:"sm",intent:"neutral",appearance:"subtle","aria-hidden":"true",children:U})]})}),l.jsx(Sr,{className:"w-[660px] p-0",align:"start",children:l.jsx(_he,{filters:e,pinnedFilters:t,activeFilters:n,onPinnedFiltersChange:r,onFilterChange:a})})]}),T&&R.length>0&&l.jsx(zn,{type:"dot",layout:"horizontal"}),R.length>0&&l.jsx("div",{className:"flex-1 min-w-0 flex gap-[7px] overflow-x-auto scrollbar-hide p-1",children:R.map(z=>{const H=L(z),D=H.type!=="empty",Y=H.icon;return l.jsx(L1,{children:l.jsxs(Dr,{children:[l.jsxs(Ur,{open:k===z.id,onOpenChange:V=>A(V,z.id),children:[l.jsx(Or,{asChild:!0,children:l.jsx(sa,{asChild:!0,children:l.jsxs("div",{ref:V=>{I.current[z.id]=V},role:"button",tabIndex:0,"aria-label":`${z.label}: ${H.type==="empty"?"not set, click to add filter":H.type==="count"?`${H.count} selected, click to edit`:`${H.content}, click to edit`}`,"aria-expanded":k===z.id,"aria-haspopup":"dialog",onKeyDown:V=>{(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),A(k!==z.id,z.id))},className:j("group/slot h-[var(--size-md)] rounded-lg flex items-center justify-center gap-[var(--space-sm)] transition-colors cursor-pointer flex-shrink-0","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-2",D?"bg-[var(--color-background-neutral-selected)] hover:bg-[var(--color-background-neutral-hovered)] px-[var(--space-md)] pr-[4px]":"border border-dashed border-[var(--color-border-primary-strong)] px-[var(--space-md)] pr-[var(--space-sm)] hover:border-[var(--grey-400)] active:bg-[var(--grey-25)]"),children:[l.jsx(Y,{className:j("h-[var(--size-2xsm)] w-[var(--size-2xsm)]",D?"text-[var(--color-icon-primary)]":"text-[var(--grey-400)] group-hover/slot:text-[var(--grey-500)]")}),H.type==="count"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"whitespace-nowrap [&]:text-label-md text-[var(--color-text-primary)]",children:H.label}),l.jsx(sn,{size:"sm",intent:"neutral",appearance:"bold",children:H.count})]}):l.jsx("span",{className:j("whitespace-nowrap [&]:text-label-md",D?"text-[var(--color-text-primary)]":"text-[var(--color-text-tertiary)] group-hover/slot:text-[var(--grey-500)]"),children:H.content}),D&&l.jsx(Oe,{variant:"ghost",size:"sm","aria-label":`Clear ${z.label} filter`,onClick:V=>{V.stopPropagation(),o(z.id)},onKeyDown:V=>{(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),V.stopPropagation(),o(z.id))},className:"h-auto w-auto p-[var(--space-xsm)]",children:l.jsx(oe,{name:"x",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]","aria-hidden":"true"})})]})})}),l.jsx(Sr,{className:j("p-[var(--space-lg)]",z.type==="date"?"w-[600px]":"w-[320px]"),align:"start",children:l.jsx(gq,{filter:z,value:n[z.id],onChange:V=>a(z.id,V),onReset:()=>o(z.id)})})]}),D&&H.type!=="count"&&l.jsx(gr,{side:"bottom",children:z.label})]})},z.id)})}),s&&(T||R.length>0)&&l.jsx(zn,{type:"line",layout:"horizontal",className:"mx-[var(--space-sm)]"}),s&&!h&&l.jsx(tgt,{placeholder:u,onAddSearchTerm:B}),s&&h&&l.jsx(ngt,{placeholder:u,onAddSearchTerm:B,suggestions:K,minCharacters:m}),J.map(z=>{const H=z.matchedFilter?.icon,D=z.value.includes("|")?z.value.split("|")[0]:z.value;return l.jsxs("div",{className:"h-[var(--size-md)] rounded-lg bg-[var(--color-background-neutral-selected)] hover:bg-[var(--color-background-neutral-hovered)] px-[var(--space-md)] pr-[4px] flex items-center gap-[var(--space-sm)] transition-colors",children:[H&&l.jsx(H,{className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)] text-[var(--color-icon-primary)]"}),l.jsx("span",{className:"whitespace-nowrap [&]:text-label-md text-[var(--color-text-primary)]",children:D}),l.jsx(Oe,{variant:"ghost",size:"sm","aria-label":`Remove search term: ${D}`,onClick:()=>$(z.value),className:"h-auto w-auto p-[var(--space-xsm)]",children:l.jsx(oe,{name:"x",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]","aria-hidden":"true"})})]},z.value)}),!y&&(P||F)&&l.jsx(zn,{type:"dot",layout:"horizontal"}),!y&&(P||F)&&l.jsx(Oe,{variant:"ghost",onClick:G,"aria-label":"Reset all filters and search terms",className:"h-[var(--size-md)] rounded-sm px-[var(--space-md)]",children:l.jsx("span",{className:"text-label-md",children:"Reset"})}),g&&l.jsx("div",{className:"flex-1"}),g]})}const NF=p.createContext(null);function iu(){const e=p.useContext(NF);if(!e)throw new Error("useBookmarksActions must be used within Bookmarks");return e}function sf({open:e,onOpenChange:t,mode:n,initialName:r="",onSave:a}){const[o,i]=p.useState(r);p.useEffect(()=>{e&&i(r)},[e,r]);const s=()=>{o.trim()&&(a(o.trim()),t(!1))};return l.jsx(vce,{open:e,onOpenChange:t,children:l.jsxs(lB,{children:[l.jsx(dB,{children:l.jsx(pB,{children:n==="create"?"Create bookmark":"Rename bookmark"})}),l.jsx(uB,{children:l.jsxs("div",{className:"flex flex-col gap-[var(--space-sm)]",children:[l.jsx(F2,{htmlFor:"bookmark-name",children:"Bookmark name"}),l.jsx(Fn,{id:"bookmark-name",value:o,onChange:c=>i(c.target.value),placeholder:"Enter bookmark name...",onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),s())},autoFocus:!0})]})}),l.jsxs(hB,{children:[l.jsx(Oe,{variant:"default",onClick:()=>t(!1),children:"Cancel"}),l.jsx(Oe,{variant:"primary",onClick:s,disabled:!o.trim(),children:n==="create"?"Create":"Save"})]})]})})}function agt({bookmarks:e,systemBookmarks:t,activeBookmarkId:n,onSelect:r,onRename:a,onDelete:o,onSetDefault:i}){const s=p.useMemo(()=>[...t,...e],[t,e]),c=p.useMemo(()=>s.find(u=>u.id===n),[s,n]),d=c?.type==="system";return l.jsxs(ZR,{children:[l.jsxs(On,{value:n,onValueChange:u=>{const h=s.find(m=>m.id===u);h&&r(h)},children:[l.jsxs(An,{className:j("!text-label-md relative z-0 h-[var(--size-md)] w-auto gap-[var(--space-xsm)] border border-[var(--color-border-action-outline)] bg-[var(--color-background-neutral-subtlest)] pr-[var(--space-md)] pl-[var(--space-sm)] text-[var(--color-text-primary)] hover:border-[var(--color-border-action-outline-hovered)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:shadow-sm focus:border-[var(--color-border-action-outline)] focus:ring-0 focus:outline-none focus-visible:z-10 focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-2 active:translate-y-px active:bg-[var(--grey-alpha-50)] active:shadow-xs data-[state=open]:ring-0",d?"rounded-md":"rounded-l-md !rounded-r-none !border-r-0"),children:[l.jsx(oe,{name:"bookmark",size:"md",color:"primary"}),c?.name||"Bookmarks"]}),l.jsxs(Pn,{align:"start",position:"popper",className:"min-w-[200px]",children:[t.length>0&&l.jsx(l.Fragment,{children:t.map(u=>l.jsx(wt,{value:u.id,children:l.jsx("div",{className:"flex items-center gap-[var(--space-sm)] pr-6",children:l.jsx("span",{children:u.name})})},u.id))}),t.length>0&&e.length>0&&l.jsx(tB,{}),e.length>0&&l.jsxs(Tse,{children:[l.jsx(eB,{children:"Custom Bookmarks"}),e.map(u=>l.jsx(wt,{value:u.id,children:l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)] pr-6",children:[l.jsx(oe,{name:"bookmark",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]"}),l.jsx("span",{className:"truncate",children:u.name}),u.isDefault&&l.jsx(oe,{name:"star",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)] flex-shrink-0 text-[var(--color-icon-warning-bold)]"})]})},u.id))]})]})]}),!d&&l.jsxs(Ao,{children:[l.jsx(Fa,{asChild:!0,children:l.jsx(Oe,{icon:"more-horizontal","aria-label":"Bookmark options",className:"!rounded-l-none rounded-r-md !border-l !border-l-[var(--color-border-action-outline)] focus:ring-0 data-[state=open]:ring-0"})}),l.jsxs(za,{align:"end",children:[l.jsxs(Sn,{onClick:u=>{if(d){u.preventDefault();return}a()},disabled:d,children:[l.jsx(oe,{name:"pencil",className:"mr-2 h-4 w-4"}),"Rename"]}),l.jsxs(Sn,{onClick:u=>{if(d){u.preventDefault();return}o()},disabled:d,destructive:!0,children:[l.jsx(oe,{name:"trash-2",className:"mr-2 h-4 w-4"}),"Delete"]}),!d&&l.jsxs(l.Fragment,{children:[l.jsx(Jr,{}),l.jsxs(Sn,{onClick:i,children:[l.jsx(oe,{name:(c?.isDefault,"star"),className:j("mr-2 h-4 w-4",c?.isDefault&&"text-[var(--color-icon-warning-bold)]")}),c?.isDefault?"Unset as Default":"Set as Default"]})]})]})]})]})}function ogt({onUpdate:e,onCreate:t}){return l.jsxs(Ao,{children:[l.jsx(Fa,{asChild:!0,children:l.jsxs(Oe,{variant:"ghost",className:"h-[var(--size-md)] gap-[var(--space-xsm)] px-[var(--space-md)] data-[state=open]:ring-0",children:[l.jsx("span",{className:"text-label-md",children:"Save"}),l.jsx(oe,{name:"chevron-down",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]"})]})}),l.jsxs(za,{align:"end",children:[l.jsx(Sn,{onClick:e,children:"Update bookmark"}),l.jsx(Sn,{onClick:t,children:"Create new bookmark"})]})]})}const Nhe=p.memo(p.forwardRef(({bookmark:e,isActive:t,isVisible:n=!0,index:r,totalTabs:a,onSelect:o,onRename:i,onDelete:s,onSetDefault:c,onNavigate:d,onNavigateFirst:u,onNavigateLast:h,onHover:m},y)=>{const v=e.type==="user",g=p.useCallback(()=>{o(e)},[o,e]),b=p.useCallback(()=>{m?.(e)},[m,e]),x=p.useCallback(()=>{i(e.id)},[i,e.id]),k=p.useCallback(()=>{s(e.id)},[s,e.id]),M=p.useCallback(C=>{switch(C.key){case"Enter":case" ":C.preventDefault(),o(e);break;case"ArrowRight":C.preventDefault(),d(r,1);break;case"ArrowLeft":C.preventDefault(),d(r,-1);break;case"Home":C.preventDefault(),u();break;case"End":C.preventDefault(),h();break}},[e,r,o,d,u,h]);return l.jsxs("div",{ref:y,role:"tab","aria-selected":t,"aria-posinset":r+1,"aria-setsize":a,tabIndex:t?0:-1,onClick:g,onKeyDown:M,onMouseEnter:b,className:j("group relative flex min-w-[160px] flex-shrink-0 cursor-pointer flex-col gap-[var(--space-xsm)] rounded-lg p-[var(--space-lg)] transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-brand-bold)] focus-visible:ring-offset-2",t?"bg-[var(--blue-50)] hover:bg-[var(--blue-50)]":"bg-[var(--color-background-neutral-default)] hover:bg-[var(--color-background-neutral-hovered)]",!n&&"pointer-events-none invisible absolute"),children:[l.jsxs("div",{className:"flex min-h-[var(--size-sm)] items-center justify-between gap-[var(--space-xsm)]",children:[l.jsxs("div",{className:"flex items-center gap-[var(--space-xsm)]",children:[v&&l.jsx(oe,{name:"bookmark",size:"sm",color:"secondary",className:"flex-shrink-0"}),l.jsx("div",{className:"text-body-md whitespace-nowrap text-[var(--color-text-primary)]",children:e.name})]}),v&&l.jsxs(Ao,{children:[l.jsx(Fa,{asChild:!0,children:l.jsx(Oe,{variant:"ghost",size:"sm","aria-label":`Options for ${e.name}`,className:"p-[var(--space-xsm)] opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",tabIndex:-1,onClick:C=>C.stopPropagation(),children:l.jsx(oe,{name:"more-horizontal",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]"})})}),l.jsxs(za,{align:"end",children:[l.jsxs(Sn,{onClick:C=>{C.stopPropagation(),x()},children:[l.jsx(oe,{name:"pencil",className:"mr-2 h-4 w-4"}),"Rename"]}),l.jsxs(Sn,{onClick:C=>{C.stopPropagation(),k()},destructive:!0,children:[l.jsx(oe,{name:"trash-2",className:"mr-2 h-4 w-4"}),"Delete"]})]})]})]}),l.jsx("div",{className:"text-heading-lg text-[var(--color-text-primary)]",children:e.isLoadingCount?l.jsx(Mr,{height:32,width:40}):e.count??" "})]})}));Nhe.displayName="BookmarkTab";function igt({bookmarks:e,systemBookmarks:t,activeBookmarkId:n,"aria-label":r="Bookmarks",onSelect:a,onRename:o,onDelete:i,onSetDefault:s,onBookmarkHover:c,onOverflowMenuChange:d}){const[u,h]=p.useState(!1),[m,y]=p.useState(null),v=p.useCallback(L=>{h(L),d?.(L)},[d]),[g,b]=p.useState(null),x=p.useRef(null),k=p.useRef(new Map),M=p.useMemo(()=>[...t,...e],[t,e]);p.useEffect(()=>{m&&!M.some(L=>L.id===m)&&y(null)},[M,m]),p.useEffect(()=>{if(!x.current||M.length===0)return;let L=null;const R=()=>{L&&clearTimeout(L),L=setTimeout(()=>{const O=x.current;if(!O||k.current.size<M.length)return;const J=O.offsetWidth,K=new Map;M.forEach(ae=>{const X=k.current.get(ae.id);X&&K.set(ae.id,X.offsetWidth)});const B=8,$=32,G=52;let z=0,H=0,D=!1;const Y=t.length,V=e.length>0,Q=Y>0&&V?Y:-1;for(let ae=0;ae<M.length;ae++){const X=M[ae],ye=K.get(X.id);if(ye===void 0)continue;ae===Q&&(D=!0,z+=$+B);const ie=z+ye+(H>0||D?B:0);if((ae<M.length-1?ie+B+G:ie)>J)break;z=ie,H++}H===0&&M.length>0&&(H=1),b(H)},100)};R();const E=new ResizeObserver(R);return E.observe(x.current),()=>{L&&clearTimeout(L),E.disconnect()}},[M,t.length,e.length]);const{visibleBookmarks:C,overflowBookmarks:S}=p.useMemo(()=>{if(g===null)return{visibleBookmarks:M,overflowBookmarks:[]};const L=M.slice(0,g),R=M.slice(g),E=m?R.find(O=>O.id===m):null;if(E&&L.length>0){const O=L[L.length-1],J=[...L.slice(0,-1),E],K=[O,...R.filter(B=>B.id!==m)];return{visibleBookmarks:J,overflowBookmarks:K}}return{visibleBookmarks:L,overflowBookmarks:R}},[M,g,m]),_=p.useCallback((L,R)=>{let E=L+R;E<0?E=C.length-1:E>=C.length&&(E=0);const O=C[E];O&&k.current.get(O.id)?.focus()},[C]),N=p.useCallback(L=>{a(L)},[a]),I=p.useCallback(()=>{const L=C[0];L&&k.current.get(L.id)?.focus()},[C]),A=p.useCallback(()=>{const L=C[C.length-1];L&&k.current.get(L.id)?.focus()},[C]),T=C.length,P=p.useMemo(()=>{for(let L=0;L<C.length-1;L++)if(C[L].type==="system"&&C[L+1].type==="user")return L;return-1},[C]),F=p.useCallback(L=>{C.some(E=>E.id===L.id)&&L.id!==m&&y(null),a(L)},[C,m,a]),U=p.useCallback(L=>{y(L.id),a(L),v(!1)},[a,v]),W=p.useMemo(()=>[...C,...S],[C,S]),Z=p.useMemo(()=>new Set(C.map(L=>L.id)),[C]);return l.jsxs("div",{ref:x,role:"tablist","aria-label":r,className:"flex items-center gap-[var(--space-sm)]",children:[W.map((L,R)=>{const E=Z.has(L.id),O=E?C.findIndex(K=>K.id===L.id):-1,J=E&&O===P;return l.jsxs(p.Fragment,{children:[l.jsx(Nhe,{ref:K=>{K?k.current.set(L.id,K):k.current.delete(L.id)},bookmark:L,isActive:n===L.id,isVisible:E,index:O>=0?O:R,totalTabs:T,onSelect:E?F:N,onRename:o,onDelete:i,onSetDefault:s,onNavigate:_,onNavigateFirst:I,onNavigateLast:A,onHover:c}),J&&l.jsx(zn,{type:"line",layout:"horizontal",className:"h-20 flex-shrink-0","aria-hidden":"true"})]},L.id)}),S.length>0&&l.jsxs(Ur,{open:u,onOpenChange:v,children:[l.jsx(sa,{asChild:!0,children:l.jsx("button",{"aria-label":`Show ${S.length} more bookmarks`,"aria-expanded":u,className:j("flex cursor-pointer flex-shrink-0 items-center justify-center rounded-lg border border-[var(--color-border-action-outline)] bg-transparent px-[var(--space-md)] transition-colors hover:bg-[var(--color-background-neutral-subtlest-hovered)]","min-h-[88px]","focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-brand-bold)] focus-visible:ring-offset-2"),children:l.jsx(oe,{name:"chevron-down",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]"})})}),l.jsx(Sr,{align:"end",side:"bottom",className:"w-[280px] p-[var(--space-sm)]",role:"menu","aria-label":"More bookmarks",children:l.jsx("div",{className:"flex flex-col",children:S.map(L=>{const R=n===L.id,E=L.type==="user";return l.jsxs("button",{role:"menuitem","aria-label":`Select ${L.name} bookmark${R?" (currently selected)":""}`,onClick:()=>U(L),className:j("text-body-md flex cursor-pointer items-center gap-[var(--space-sm)] rounded-md px-[var(--space-md)] py-[var(--space-sm)] text-left transition-colors","hover:bg-[var(--color-background-neutral-subtlest-hovered)]","focus:outline-none focus-visible:bg-[var(--color-background-neutral-subtlest-hovered)]"),children:[E&&l.jsx(oe,{name:"bookmark",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)]","aria-hidden":"true"}),!E&&l.jsx("div",{className:"w-[var(--size-2xsm)]","aria-hidden":"true"}),l.jsxs("div",{className:"flex flex-1 items-center gap-[var(--space-xsm)]",children:[l.jsx("span",{className:"truncate",children:L.name}),(L.count!==void 0||L.isLoadingCount)&&l.jsx(sn,{size:"sm",intent:"neutral",appearance:"subtle",children:L.isLoadingCount?l.jsx(Mr,{height:16,width:24}):L.count})]}),L.isDefault&&l.jsx(oe,{name:"star",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)] text-[var(--color-icon-warning-bold)]","aria-hidden":"true"}),R&&l.jsx(oe,{name:"check",className:"h-[var(--size-2xsm)] w-[var(--size-2xsm)] text-[var(--color-icon-primary)]","aria-hidden":"true"})]},L.id)})})})]})]})}function vq({children:e}){return l.jsx(l.Fragment,{children:e})}function bq({children:e}){return l.jsx(l.Fragment,{children:e})}function xq({children:e}){return l.jsx(l.Fragment,{children:e})}function kq(){const{isDirty:e,handleRevert:t}=iu();return e?l.jsx(Oe,{variant:"ghost",onClick:t,className:"h-[var(--size-md)]",children:"Revert changes"}):null}function wq(){const{isDirty:e,isSystemBookmark:t,openCreateDialog:n}=iu();return!e||!t?null:l.jsx(Oe,{variant:"ghost",onClick:n,className:"h-[var(--size-md)]",children:"Create bookmark"})}function Ihe(){const{isDirty:e,isSystemBookmark:t,handleUpdate:n}=iu();return!e||t?null:l.jsx(Oe,{variant:"ghost",onClick:n,className:"h-[var(--size-md)]",children:"Update bookmark"})}function Mq(){const{isDirty:e,isSystemBookmark:t,handleRevert:n}=iu();return!e||!t?null:l.jsx(Oe,{variant:"ghost",onClick:n,className:"h-[var(--size-md)]",children:"Reset"})}function Cq(){const{isDirty:e,isSystemBookmark:t,handleUpdate:n,openCreateDialog:r}=iu();return!e||t?null:l.jsx(ogt,{onUpdate:n,onCreate:r})}function jhe(){const{isDirty:e,isSystemBookmark:t}=iu();return e?l.jsxs(l.Fragment,{children:[l.jsx(zn,{type:"dot",layout:"horizontal"}),t?l.jsxs(l.Fragment,{children:[l.jsx(Mq,{}),l.jsx(wq,{})]}):l.jsxs(l.Fragment,{children:[l.jsx(kq,{}),l.jsx(Cq,{})]})]}):null}function Za({variant:e,bookmarks:t,systemBookmarks:n,activeBookmarkId:r,isDirty:a,children:o,"aria-label":i="Bookmarks",onSelect:s,onRevert:c,onSave:d,onRename:u,onDelete:h,onSetDefault:m,onBookmarkHover:y,onOverflowMenuChange:v,onDialogChange:g}){const[b,x]=p.useState(!1),[k,M]=p.useState(!1),[C,S]=p.useState(),_=p.useCallback($=>{M($),g?.($?"create":null)},[g]),N=p.useCallback($=>{x($),g?.($?"rename":null)},[g]),I=p.useMemo(()=>[...n,...t],[n,t]),A=p.useMemo(()=>I.find($=>$.id===r),[I,r]),T=A?.type==="system",P=p.useCallback($=>{S($||r),N(!0)},[r,N]),F=p.useCallback(async $=>{C&&await u(C,$)},[C,u]),U=p.useCallback(async $=>{await d("create",$)},[d]),W=p.useCallback(async $=>{const G=$||r;G&&await h(G)},[r,h]),Z=p.useCallback(async $=>{const G=$||r;G&&await m(G)},[r,m]),L=p.useMemo(()=>I.find($=>$.id===C),[I,C]),{contentSlot:R,actionsSlot:E,settingsSlot:O}=p.useMemo(()=>{let $=null,G=null,z=null;const H=[];return p.Children.forEach(o,D=>{p.isValidElement(D)?D.type===vq?$=D.props.children:D.type===bq?G=D.props.children:D.type===xq?z=D.props.children:H.push(D):H.push(D)}),!$&&H.length>0&&($=H),{contentSlot:$,actionsSlot:G,settingsSlot:z}},[o]),J=p.useCallback(()=>_(!0),[_]),K=p.useCallback(()=>d("update"),[d]),B=p.useMemo(()=>({isDirty:a,isSystemBookmark:T,activeBookmark:A,openCreateDialog:J,openRenameDialog:P,handleRevert:c,handleUpdate:K,handleDelete:W,handleSetDefault:Z}),[a,T,A,J,P,c,K,W,Z]);return e==="tabs"?l.jsxs(NF.Provider,{value:B,children:[l.jsx(igt,{bookmarks:t,systemBookmarks:n,activeBookmarkId:r,"aria-label":i,onSelect:s,onRename:P,onDelete:W,onSetDefault:Z,onBookmarkHover:y,onOverflowMenuChange:v}),(R||E||O)&&l.jsxs("div",{className:"flex items-center",children:[l.jsxs("div",{className:"flex items-center gap-[7px] flex-1 min-w-0 overflow-hidden",children:[R&&l.jsx("div",{className:"flex items-center gap-[7px] min-w-0",children:R}),E&&l.jsx("div",{className:"flex items-center gap-[7px] flex-shrink-0",children:E})]}),O&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"w-[var(--space-md)]"}),l.jsx("div",{className:"flex-shrink-0",children:O})]})]}),l.jsx(sf,{open:k,onOpenChange:_,mode:"create",onSave:U}),l.jsx(sf,{open:b,onOpenChange:N,mode:"rename",initialName:L?.name,onSave:F})]}):l.jsxs(NF.Provider,{value:B,children:[l.jsxs("div",{className:"flex items-center gap-[var(--space-md)]",children:[l.jsx(agt,{bookmarks:t,systemBookmarks:n,activeBookmarkId:r,onSelect:s,onRename:()=>P(),onDelete:()=>W(),onSetDefault:()=>Z()}),l.jsxs("div",{className:"flex items-center gap-[7px] flex-1 min-w-0 overflow-hidden",children:[R&&l.jsx("div",{className:"flex items-center gap-[7px]",children:R}),E&&l.jsx("div",{className:"flex items-center gap-[7px] flex-shrink-0",children:E})]}),O&&l.jsx("div",{className:"flex-shrink-0",children:O})]}),l.jsx(sf,{open:k,onOpenChange:_,mode:"create",onSave:U}),l.jsx(sf,{open:b,onOpenChange:N,mode:"rename",initialName:L?.name,onSave:F})]})}Za.Content=vq;Za.Actions=bq;Za.Settings=xq;Za.DefaultActions=jhe;Za.RevertButton=kq;Za.CreateButton=wq;Za.SaveButton=Ihe;Za.ResetButton=Mq;Za.SaveDropdown=Cq;function sgt({title:e,description:t,data:n,config:r,columns:a,type:o,enableFiltering:i=!0,enableRowSelection:s=!0,onRowSelectionChange:c,onDataFilter:d,showTable:u=!0,tableClassName:h,chartClassName:m,enableRowFiltering:y=!1,className:v,...g}){const[b,x]=w.useState(new Set),[k,M]=w.useState(null),[C,S]=w.useState(null),[_,N]=w.useState(new Set),[I,A]=w.useState(!1),T=w.useMemo(()=>_.size>0?n.filter((O,J)=>_.has(J)):I&&b.size>0?n.filter((O,J)=>b.has(J)):n,[n,_,b,I]),P=w.useCallback((O,J)=>{if(J!==void 0&&O){const K=n.findIndex(B=>B===T[J]);S(K!==-1?K:null)}else S(null)},[n,T]),F=w.useCallback((O,J)=>{if(!i)return;const K=n.findIndex(G=>G===T[J]);if(K===-1)return;const B=new Set(_);B.has(K)?B.delete(K):B.add(K),N(B);const $=n.filter((G,z)=>B.has(z));d?.($)},[i,_,n,d,T]),U=w.useCallback(O=>{if(!s)return;const J=new Set(b);J.has(O)?J.delete(O):J.add(O),x(J),c?.(Array.from(J))},[s,b,c]),W=w.useCallback(O=>{M(O)},[]),Z=w.useCallback(()=>{x(new Set),N(new Set),M(null),S(null),A(!1),c?.([]),d?.([])},[c,d]),L=w.useCallback((O,J,K)=>{if(J.format)return J.format(O,K);switch(J.type){case"currency":return typeof O=="number"?`$${O.toLocaleString()}`:O;case"percentage":return typeof O=="number"?`${O}%`:O;case"number":return typeof O=="number"?O.toLocaleString():O;default:return O}},[]),R=k??C,E=w.useMemo(()=>{if(R!==null){const O=T.findIndex(J=>n[R]===J);return O!==-1?O:void 0}},[R,T,n]);return l.jsxs("div",{className:j("space-y-[var(--space-lg)]",v),children:[(e||t)&&l.jsxs("div",{className:"space-y-[var(--space-sm)]",children:[e&&l.jsx("h3",{className:"text-heading-md",children:e}),t&&l.jsx("p",{className:"text-body-md text-[var(--color-text-secondary)]",children:t})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[b.size>0&&l.jsxs(sn,{intent:"neutral",appearance:"subtle",size:"sm",children:[b.size," selected",I?" (filtered)":""]}),_.size>0&&l.jsxs(sn,{intent:"brand",appearance:"subtle",size:"sm",children:[_.size," chart filtered"]})]}),l.jsxs("div",{className:"flex items-center gap-[var(--space-sm)]",children:[y&&b.size>0&&l.jsxs(Oe,{size:"sm",variant:I?"default":"ghost",onClick:()=>A(!I),children:[l.jsx(oe,{name:"filter",size:"sm",className:"mr-[var(--space-xsm)]"}),"Filter selected"]}),(b.size>0||_.size>0||I)&&l.jsxs(Oe,{variant:"ghost",size:"sm",onClick:Z,children:[l.jsx(oe,{name:"x",size:"sm",className:"mr-[var(--space-sm)]"}),"Clear all"]})]})]}),l.jsx(Mp,{children:l.jsx(Cp,{className:"p-[var(--space-lg)]",children:l.jsx(yre,{...g,type:o,data:T,config:r,onDataPointClick:F,onDataPointHover:P,highlightedIndex:E,className:m})})}),u&&l.jsxs(Mp,{children:[l.jsx(wH,{children:l.jsxs(MH,{className:"text-heading-sm flex items-center justify-between",children:["Data Table",l.jsxs(sn,{intent:"neutral",appearance:"subtle",size:"sm",children:[T.length," rows"]})]})}),l.jsx(Cp,{children:l.jsx("div",{className:j("rounded-md border border-[var(--color-border-primary-subtle)]",h),children:l.jsxs(FD,{children:[l.jsx(VD,{children:l.jsx(rn,{children:a.map(O=>l.jsx(bi,{children:O.label},O.key))})}),l.jsx(HD,{children:T.map((O,J)=>{const K=n.indexOf(O),B=b.has(K),$=k===K||C===K;return l.jsx(rn,{onClick:()=>U(K),onMouseEnter:()=>W(K),onMouseLeave:()=>W(null),variant:B?"selected":"default",className:j("cursor-pointer transition-colors",$&&"bg-[var(--color-background-neutral-subtlest-hovered)]",s&&"hover:bg-[var(--color-background-neutral-subtlest-hovered)]"),children:a.map(G=>l.jsx(Yn,{children:L(O[G.key],G,O)},G.key))},K)})})]})})})]}),i&&l.jsx(Mp,{className:"border-[var(--color-border-info-bold)]",children:l.jsx(Cp,{className:"p-[var(--space-md)]",children:l.jsxs("div",{className:"flex items-start gap-[var(--space-sm)]",children:[l.jsx(oe,{name:"info",size:"sm",color:"information",className:"mt-1"}),l.jsxs("div",{className:"space-y-[var(--space-xsm)] text-body-sm text-[var(--color-text-secondary)]",children:[l.jsx("p",{children:l.jsx("strong",{children:"Interactive Features:"})}),l.jsxs("ul",{className:"list-disc list-inside space-y-[var(--space-xsm)]",children:[l.jsx("li",{children:"Click chart data points to filter the table"}),s&&l.jsx("li",{children:"Click table rows to select/deselect them"}),y&&s&&l.jsx("li",{children:'Use "Filter Selected" button to show only selected rows in the chart'}),l.jsx("li",{children:"Hover over chart or table to see corresponding data"}),l.jsx("li",{children:'Use "Clear All" to reset all filters and selections'})]})]})]})})})]})}const cgt=(e,t=[])=>{const n=Object.entries(e).map(([r,a])=>({key:r,label:a.label,type:"number"}));return[{key:"name",label:"Name",type:"text"},...n,...t]},KD=w.createContext(null);KD.displayName="PanelGroupContext";const Tt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Sq=10,$d=w.useLayoutEffect,LX=p.useId,lgt=typeof LX=="function"?LX:()=>null;let dgt=0;function _q(e=null){const t=lgt(),n=w.useRef(e||t||null);return n.current===null&&(n.current=""+dgt++),e??n.current}function Lhe({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:a,forwardedRef:o,id:i,maxSize:s,minSize:c,onCollapse:d,onExpand:u,onResize:h,order:m,style:y,tagName:v="div",...g}){const b=w.useContext(KD);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:k,getPanelSize:M,getPanelStyle:C,groupId:S,isPanelCollapsed:_,reevaluatePanelConstraints:N,registerPanel:I,resizePanel:A,unregisterPanel:T}=b,P=_q(i),F=w.useRef({callbacks:{onCollapse:d,onExpand:u,onResize:h},constraints:{collapsedSize:n,collapsible:r,defaultSize:a,maxSize:s,minSize:c},id:P,idIsFromProps:i!==void 0,order:m});w.useRef({didLogMissingDefaultSizeWarning:!1}),$d(()=>{const{callbacks:W,constraints:Z}=F.current,L={...Z};F.current.id=P,F.current.idIsFromProps=i!==void 0,F.current.order=m,W.onCollapse=d,W.onExpand=u,W.onResize=h,Z.collapsedSize=n,Z.collapsible=r,Z.defaultSize=a,Z.maxSize=s,Z.minSize=c,(L.collapsedSize!==Z.collapsedSize||L.collapsible!==Z.collapsible||L.maxSize!==Z.maxSize||L.minSize!==Z.minSize)&&N(F.current,L)}),$d(()=>{const W=F.current;return I(W),()=>{T(W)}},[m,P,I,T]),w.useImperativeHandle(o,()=>({collapse:()=>{x(F.current)},expand:W=>{k(F.current,W)},getId(){return P},getSize(){return M(F.current)},isCollapsed(){return _(F.current)},isExpanded(){return!_(F.current)},resize:W=>{A(F.current,W)}}),[x,k,M,_,P,A]);const U=C(F.current,a);return w.createElement(v,{...g,children:e,className:t,id:P,style:{...U,...y},[Tt.groupId]:S,[Tt.panel]:"",[Tt.panelCollapsible]:r||void 0,[Tt.panelId]:P,[Tt.panelSize]:parseFloat(""+U.flexGrow).toFixed(1)})}const Ahe=w.forwardRef((e,t)=>w.createElement(Lhe,{...e,forwardedRef:t}));Lhe.displayName="Panel";Ahe.displayName="forwardRef(Panel)";let IF=null,NP=-1,fi=null;function ugt(e,t,n){const r=(t&Ohe)!==0,a=(t&$he)!==0,o=(t&The)!==0,i=(t&zhe)!==0;if(t){if(r)return o?"se-resize":i?"ne-resize":"e-resize";if(a)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function hgt(){fi!==null&&(document.head.removeChild(fi),IF=null,fi=null,NP=-1)}function AT(e,t,n){var r,a;const o=ugt(e,t);if(IF!==o){if(IF=o,fi===null&&(fi=document.createElement("style"),document.head.appendChild(fi)),NP>=0){var i;(i=fi.sheet)===null||i===void 0||i.removeRule(NP)}NP=(r=(a=fi.sheet)===null||a===void 0?void 0:a.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function Phe(e){return e.type==="keydown"}function Ehe(e){return e.type.startsWith("pointer")}function Rhe(e){return e.type.startsWith("mouse")}function ZD(e){if(Ehe(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Rhe(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function pgt(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function fgt(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function mgt(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:EX(e),b:EX(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Be(r,"Stacking order can only be calculated for elements with a common ancestor");const a={a:PX(AX(n.a)),b:PX(AX(n.b))};if(a.a===a.b){const o=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let s=o.length;for(;s--;){const c=o[s];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(a.a-a.b)}const ygt=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ggt(e){var t;const n=getComputedStyle((t=Dhe(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function vgt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||ggt(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||ygt.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function AX(e){let t=e.length;for(;t--;){const n=e[t];if(Be(n,"Missing node"),vgt(n))return n}return null}function PX(e){return e&&Number(getComputedStyle(e).zIndex)||0}function EX(e){const t=[];for(;e;)t.push(e),e=Dhe(e);return t}function Dhe(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Ohe=1,$he=2,The=4,zhe=8,bgt=pgt()==="coarse";let na=[],Ku=!1,mi=new Map,YD=new Map;const i2=new Set;function xgt(e,t,n,r,a){var o;const{ownerDocument:i}=t,s={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:a},c=(o=mi.get(i))!==null&&o!==void 0?o:0;return mi.set(i,c+1),i2.add(s),WE(),function(){var u;YD.delete(e),i2.delete(s);const h=(u=mi.get(i))!==null&&u!==void 0?u:1;if(mi.set(i,h-1),WE(),h===1&&mi.delete(i),na.includes(s)){const m=na.indexOf(s);m>=0&&na.splice(m,1),XD(),a("up",!0,null)}}}function kgt(e){const{target:t}=e,{x:n,y:r}=ZD(e);Ku=!0,Nq({target:t,x:n,y:r}),WE(),na.length>0&&(GE("down",e),XD(),e.preventDefault(),Fhe(t)||e.stopImmediatePropagation())}function PT(e){const{x:t,y:n}=ZD(e);if(Ku&&e.type!=="pointerleave"&&e.buttons===0&&(Ku=!1,GE("up",e)),!Ku){const{target:r}=e;Nq({target:r,x:t,y:n})}GE("move",e),XD(),na.length>0&&e.preventDefault()}function ET(e){const{target:t}=e,{x:n,y:r}=ZD(e);YD.clear(),Ku=!1,na.length>0&&(e.preventDefault(),Fhe(t)||e.stopImmediatePropagation()),GE("up",e),Nq({target:t,x:n,y:r}),XD(),WE()}function Fhe(e){let t=e;for(;t;){if(t.hasAttribute(Tt.resizeHandle))return!0;t=t.parentElement}return!1}function Nq({target:e,x:t,y:n}){na.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),i2.forEach(a=>{const{element:o,hitAreaMargins:i}=a,s=o.getBoundingClientRect(),{bottom:c,left:d,right:u,top:h}=s,m=bgt?i.coarse:i.fine;if(t>=d-m&&t<=u+m&&n>=h-m&&n<=c+m){if(r!==null&&document.contains(r)&&o!==r&&!o.contains(r)&&!r.contains(o)&&mgt(r,o)>0){let v=r,g=!1;for(;v&&!v.contains(o);){if(fgt(v.getBoundingClientRect(),s)){g=!0;break}v=v.parentElement}if(g)return}na.push(a)}})}function RT(e,t){YD.set(e,t)}function XD(){let e=!1,t=!1;na.forEach(r=>{const{direction:a}=r;a==="horizontal"?e=!0:t=!0});let n=0;YD.forEach(r=>{n|=r}),e&&t?AT("intersection",n):e?AT("horizontal",n):t?AT("vertical",n):hgt()}let DT;function WE(){var e;(e=DT)===null||e===void 0||e.abort(),DT=new AbortController;const t={capture:!0,signal:DT.signal};i2.size&&(Ku?(na.length>0&&mi.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("contextmenu",ET,t),a.addEventListener("pointerleave",PT,t),a.addEventListener("pointermove",PT,t))}),mi.forEach((n,r)=>{const{body:a}=r;a.addEventListener("pointerup",ET,t),a.addEventListener("pointercancel",ET,t)})):mi.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("pointerdown",kgt,t),a.addEventListener("pointermove",PT,t))}))}function GE(e,t){i2.forEach(n=>{const{setResizeHandlerState:r}=n,a=na.includes(n);r(e,a,t)})}function wgt(){const[e,t]=w.useState(0);return w.useCallback(()=>t(n=>n+1),[])}function Be(e,t){if(!e)throw console.error(t),Error(t)}function Zd(e,t,n=Sq){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function uo(e,t,n=Sq){return Zd(e,t,n)===0}function fr(e,t,n){return Zd(e,t,n)===0}function Mgt(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const a=e[r],o=t[r];if(!fr(a,o,n))return!1}return!0}function Du({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Be(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:o,maxSize:i=100,minSize:s=0}=r;if(Zd(n,s)<0)if(o){const c=(a+s)/2;Zd(n,c)<0?n=a:n=s}else n=s;return n=Math.min(i,n),n=parseFloat(n.toFixed(Sq)),n}function bh({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:o}){if(fr(e,0))return t;const i=[...t],[s,c]=r;Be(s!=null,"Invalid first pivot index"),Be(c!=null,"Invalid second pivot index");let d=0;if(o==="keyboard"){{const h=e<0?c:s,m=n[h];Be(m,`Panel constraints not found for index ${h}`);const{collapsedSize:y=0,collapsible:v,minSize:g=0}=m;if(v){const b=t[h];if(Be(b!=null,`Previous layout not found for panel index ${h}`),fr(b,y)){const x=g-b;Zd(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}{const h=e<0?s:c,m=n[h];Be(m,`No panel constraints found for index ${h}`);const{collapsedSize:y=0,collapsible:v,minSize:g=0}=m;if(v){const b=t[h];if(Be(b!=null,`Previous layout not found for panel index ${h}`),fr(b,g)){const x=b-y;Zd(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}}{const h=e<0?1:-1;let m=e<0?c:s,y=0;for(;;){const g=t[m];Be(g!=null,`Previous layout not found for panel index ${m}`);const x=Du({panelConstraints:n,panelIndex:m,size:100})-g;if(y+=x,m+=h,m<0||m>=n.length)break}const v=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-v:v}{let m=e<0?s:c;for(;m>=0&&m<n.length;){const y=Math.abs(e)-Math.abs(d),v=t[m];Be(v!=null,`Previous layout not found for panel index ${m}`);const g=v-y,b=Du({panelConstraints:n,panelIndex:m,size:g});if(!fr(v,b)&&(d+=v-b,i[m]=b,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(Mgt(a,i))return a;{const h=e<0?c:s,m=t[h];Be(m!=null,`Previous layout not found for panel index ${h}`);const y=m+d,v=Du({panelConstraints:n,panelIndex:h,size:y});if(i[h]=v,!fr(v,y)){let g=y-v,x=e<0?c:s;for(;x>=0&&x<n.length;){const k=i[x];Be(k!=null,`Previous layout not found for panel index ${x}`);const M=k+g,C=Du({panelConstraints:n,panelIndex:x,size:M});if(fr(k,C)||(g-=C-k,i[x]=C),fr(g,0))break;e>0?x--:x++}}}const u=i.reduce((h,m)=>m+h,0);return fr(u,100)?i:a}function Cgt({layout:e,panelsArray:t,pivotIndices:n}){let r=0,a=100,o=0,i=0;const s=n[0];Be(s!=null,"No pivot index found"),t.forEach((h,m)=>{const{constraints:y}=h,{maxSize:v=100,minSize:g=0}=y;m===s?(r=g,a=v):(o+=g,i+=v)});const c=Math.min(a,100-o),d=Math.max(r,100-i),u=e[s];return{valueMax:c,valueMin:d,valueNow:u}}function s2(e,t=document){return Array.from(t.querySelectorAll(`[${Tt.resizeHandleId}][data-panel-group-id="${e}"]`))}function Vhe(e,t,n=document){const a=s2(e,n).findIndex(o=>o.getAttribute(Tt.resizeHandleId)===t);return a??null}function Hhe(e,t,n){const r=Vhe(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function Sgt(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function Bhe(e,t=document){if(Sgt(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function JD(e,t=document){const n=t.querySelector(`[${Tt.resizeHandleId}="${e}"]`);return n||null}function _gt(e,t,n,r=document){var a,o,i,s;const c=JD(t,r),d=s2(e,r),u=c?d.indexOf(c):-1,h=(a=(o=n[u])===null||o===void 0?void 0:o.id)!==null&&a!==void 0?a:null,m=(i=(s=n[u+1])===null||s===void 0?void 0:s.id)!==null&&i!==void 0?i:null;return[h,m]}function Ngt({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:a,panelGroupElement:o,setLayout:i}){w.useRef({didWarnAboutMissingResizeHandle:!1}),$d(()=>{if(!o)return;const s=s2(n,o);for(let c=0;c<a.length-1;c++){const{valueMax:d,valueMin:u,valueNow:h}=Cgt({layout:r,panelsArray:a,pivotIndices:[c,c+1]}),m=s[c];if(m!=null){const y=a[c];Be(y,`No panel data found for index "${c}"`),m.setAttribute("aria-controls",y.id),m.setAttribute("aria-valuemax",""+Math.round(d)),m.setAttribute("aria-valuemin",""+Math.round(u)),m.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{s.forEach((c,d)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[n,r,a,o]),w.useEffect(()=>{if(!o)return;const s=t.current;Be(s,"Eager values not found");const{panelDataArray:c}=s,d=Bhe(n,o);Be(d!=null,`No group found for id "${n}"`);const u=s2(n,o);Be(u,`No resize handles found for group id "${n}"`);const h=u.map(m=>{const y=m.getAttribute(Tt.resizeHandleId);Be(y,"Resize handle element has no handle id attribute");const[v,g]=_gt(n,y,c,o);if(v==null||g==null)return()=>{};const b=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const k=c.findIndex(M=>M.id===v);if(k>=0){const M=c[k];Be(M,`No panel data found for index ${k}`);const C=r[k],{collapsedSize:S=0,collapsible:_,minSize:N=0}=M.constraints;if(C!=null&&_){const I=bh({delta:fr(C,S)?N-S:S-C,initialLayout:r,panelConstraints:c.map(A=>A.constraints),pivotIndices:Hhe(n,y,o),prevLayout:r,trigger:"keyboard"});r!==I&&i(I)}}break}}};return m.addEventListener("keydown",b),()=>{m.removeEventListener("keydown",b)}});return()=>{h.forEach(m=>m())}},[o,e,t,n,r,a,i])}function RX(e,t){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 qhe(e,t){const n=e==="horizontal",{x:r,y:a}=ZD(t);return n?r:a}function Igt(e,t,n,r,a){const o=n==="horizontal",i=JD(t,a);Be(i,`No resize handle element found for id "${t}"`);const s=i.getAttribute(Tt.groupId);Be(s,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=r;const d=qhe(n,e),u=Bhe(s,a);Be(u,`No group element found for id "${s}"`);const h=u.getBoundingClientRect(),m=o?h.width:h.height;return(d-c)/m*100}function jgt(e,t,n,r,a,o){if(Phe(e)){const i=n==="horizontal";let s=0;e.shiftKey?s=100:a!=null?s=a:s=10;let c=0;switch(e.key){case"ArrowDown":c=i?0:s;break;case"ArrowLeft":c=i?-s:0;break;case"ArrowRight":c=i?s:0;break;case"ArrowUp":c=i?0:-s;break;case"End":c=100;break;case"Home":c=-100;break}return c}else return r==null?0:Igt(e,t,n,r,o)}function Lgt({panelDataArray:e}){const t=Array(e.length),n=e.map(o=>o.constraints);let r=0,a=100;for(let o=0;o<e.length;o++){const i=n[o];Be(i,`Panel constraints not found for index ${o}`);const{defaultSize:s}=i;s!=null&&(r++,t[o]=s,a-=s)}for(let o=0;o<e.length;o++){const i=n[o];Be(i,`Panel constraints not found for index ${o}`);const{defaultSize:s}=i;if(s!=null)continue;const c=e.length-r,d=a/c;r++,t[o]=d,a-=d}return t}function bu(e,t,n){t.forEach((r,a)=>{const o=e[a];Be(o,`Panel data not found for index ${a}`);const{callbacks:i,constraints:s,id:c}=o,{collapsedSize:d=0,collapsible:u}=s,h=n[c];if(h==null||r!==h){n[c]=r;const{onCollapse:m,onExpand:y,onResize:v}=i;v&&v(r,h),u&&(m||y)&&(y&&(h==null||uo(h,d))&&!uo(r,d)&&y(),m&&(h==null||!uo(h,d))&&uo(r,d)&&m())}})}function cf(e,t){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 Agt({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:a,precision:o=3}){const i=n[a];let s;return i==null?s=e!=null?e.toFixed(o):"1":r.length===1?s="1":s=i.toFixed(o),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function Pgt(e,t=10){let n=null;return(...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...a)},t)}}function DX(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Uhe(e){return`react-resizable-panels:${e}`}function Whe(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:a,order:o}=t;return a?r:o?`${o}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function Ghe(e,t){try{const n=Uhe(e),r=t.getItem(n);if(r){const a=JSON.parse(r);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function Egt(e,t,n){var r,a;const o=(r=Ghe(e,n))!==null&&r!==void 0?r:{},i=Whe(t);return(a=o[i])!==null&&a!==void 0?a:null}function Rgt(e,t,n,r,a){var o;const i=Uhe(e),s=Whe(t),c=(o=Ghe(e,a))!==null&&o!==void 0?o:{};c[s]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{a.setItem(i,JSON.stringify(c))}catch(d){console.error(d)}}function OX({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((o,i)=>o+i,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(o=>`${o}%`).join(", ")}`);if(!fr(r,100)&&n.length>0)for(let o=0;o<t.length;o++){const i=n[o];Be(i!=null,`No layout data found for index ${o}`);const s=100/r*i;n[o]=s}let a=0;for(let o=0;o<t.length;o++){const i=n[o];Be(i!=null,`No layout data found for index ${o}`);const s=Du({panelConstraints:t,panelIndex:o,size:i});i!=s&&(a+=i-s,n[o]=s)}if(!fr(a,0))for(let o=0;o<t.length;o++){const i=n[o];Be(i!=null,`No layout data found for index ${o}`);const s=i+a,c=Du({panelConstraints:t,panelIndex:o,size:s});if(i!==c&&(a-=c-i,n[o]=c,fr(a,0)))break}return n}const Dgt=100,xh={getItem:e=>(DX(xh),xh.getItem(e)),setItem:(e,t)=>{DX(xh),xh.setItem(e,t)}},$X={};function Khe({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:a,id:o=null,onLayout:i=null,keyboardResizeBy:s=null,storage:c=xh,style:d,tagName:u="div",...h}){const m=_q(o),y=w.useRef(null),[v,g]=w.useState(null),[b,x]=w.useState([]),k=wgt(),M=w.useRef({}),C=w.useRef(new Map),S=w.useRef(0),_=w.useRef({autoSaveId:e,direction:r,dragState:v,id:m,keyboardResizeBy:s,onLayout:i,storage:c}),N=w.useRef({layout:b,panelDataArray:[],panelDataArrayChanged:!1});w.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),w.useImperativeHandle(a,()=>({getId:()=>_.current.id,getLayout:()=>{const{layout:$}=N.current;return $},setLayout:$=>{const{onLayout:G}=_.current,{layout:z,panelDataArray:H}=N.current,D=OX({layout:$,panelConstraints:H.map(Y=>Y.constraints)});RX(z,D)||(x(D),N.current.layout=D,G&&G(D),bu(H,D,M.current))}}),[]),$d(()=>{_.current.autoSaveId=e,_.current.direction=r,_.current.dragState=v,_.current.id=m,_.current.onLayout=i,_.current.storage=c}),Ngt({committedValuesRef:_,eagerValuesRef:N,groupId:m,layout:b,panelDataArray:N.current.panelDataArray,setLayout:x,panelGroupElement:y.current}),w.useEffect(()=>{const{panelDataArray:$}=N.current;if(e){if(b.length===0||b.length!==$.length)return;let G=$X[e];G==null&&(G=Pgt(Rgt,Dgt),$X[e]=G);const z=[...$],H=new Map(C.current);G(e,z,H,b,c)}},[e,b,c]),w.useEffect(()=>{});const I=w.useCallback($=>{const{onLayout:G}=_.current,{layout:z,panelDataArray:H}=N.current;if($.constraints.collapsible){const D=H.map(ae=>ae.constraints),{collapsedSize:Y=0,panelSize:V,pivotIndices:Q}=qi(H,$,z);if(Be(V!=null,`Panel size not found for panel "${$.id}"`),!uo(V,Y)){C.current.set($.id,V);const X=Su(H,$)===H.length-1?V-Y:Y-V,ye=bh({delta:X,initialLayout:z,panelConstraints:D,pivotIndices:Q,prevLayout:z,trigger:"imperative-api"});cf(z,ye)||(x(ye),N.current.layout=ye,G&&G(ye),bu(H,ye,M.current))}}},[]),A=w.useCallback(($,G)=>{const{onLayout:z}=_.current,{layout:H,panelDataArray:D}=N.current;if($.constraints.collapsible){const Y=D.map(ie=>ie.constraints),{collapsedSize:V=0,panelSize:Q=0,minSize:ae=0,pivotIndices:X}=qi(D,$,H),ye=G??ae;if(uo(Q,V)){const ie=C.current.get($.id),Ee=ie!=null&&ie>=ye?ie:ye,Fe=Su(D,$)===D.length-1?Q-Ee:Ee-Q,Ge=bh({delta:Fe,initialLayout:H,panelConstraints:Y,pivotIndices:X,prevLayout:H,trigger:"imperative-api"});cf(H,Ge)||(x(Ge),N.current.layout=Ge,z&&z(Ge),bu(D,Ge,M.current))}}},[]),T=w.useCallback($=>{const{layout:G,panelDataArray:z}=N.current,{panelSize:H}=qi(z,$,G);return Be(H!=null,`Panel size not found for panel "${$.id}"`),H},[]),P=w.useCallback(($,G)=>{const{panelDataArray:z}=N.current,H=Su(z,$);return Agt({defaultSize:G,dragState:v,layout:b,panelData:z,panelIndex:H})},[v,b]),F=w.useCallback($=>{const{layout:G,panelDataArray:z}=N.current,{collapsedSize:H=0,collapsible:D,panelSize:Y}=qi(z,$,G);return Be(Y!=null,`Panel size not found for panel "${$.id}"`),D===!0&&uo(Y,H)},[]),U=w.useCallback($=>{const{layout:G,panelDataArray:z}=N.current,{collapsedSize:H=0,collapsible:D,panelSize:Y}=qi(z,$,G);return Be(Y!=null,`Panel size not found for panel "${$.id}"`),!D||Zd(Y,H)>0},[]),W=w.useCallback($=>{const{panelDataArray:G}=N.current;G.push($),G.sort((z,H)=>{const D=z.order,Y=H.order;return D==null&&Y==null?0:D==null?-1:Y==null?1:D-Y}),N.current.panelDataArrayChanged=!0,k()},[k]);$d(()=>{if(N.current.panelDataArrayChanged){N.current.panelDataArrayChanged=!1;const{autoSaveId:$,onLayout:G,storage:z}=_.current,{layout:H,panelDataArray:D}=N.current;let Y=null;if($){const Q=Egt($,D,z);Q&&(C.current=new Map(Object.entries(Q.expandToSizes)),Y=Q.layout)}Y==null&&(Y=Lgt({panelDataArray:D}));const V=OX({layout:Y,panelConstraints:D.map(Q=>Q.constraints)});RX(H,V)||(x(V),N.current.layout=V,G&&G(V),bu(D,V,M.current))}}),$d(()=>{const $=N.current;return()=>{$.layout=[]}},[]);const Z=w.useCallback($=>{let G=!1;const z=y.current;return z&&window.getComputedStyle(z,null).getPropertyValue("direction")==="rtl"&&(G=!0),function(D){D.preventDefault();const Y=y.current;if(!Y)return()=>null;const{direction:V,dragState:Q,id:ae,keyboardResizeBy:X,onLayout:ye}=_.current,{layout:ie,panelDataArray:Ee}=N.current,{initialLayout:Pe}=Q??{},Fe=Hhe(ae,$,Y);let Ge=jgt(D,$,V,Q,X,Y);const dt=V==="horizontal";dt&&G&&(Ge=-Ge);const mt=Ee.map(ne=>ne.constraints),Ft=bh({delta:Ge,initialLayout:Pe??ie,panelConstraints:mt,pivotIndices:Fe,prevLayout:ie,trigger:Phe(D)?"keyboard":"mouse-or-touch"}),Xe=!cf(ie,Ft);(Ehe(D)||Rhe(D))&&S.current!=Ge&&(S.current=Ge,!Xe&&Ge!==0?dt?RT($,Ge<0?Ohe:$he):RT($,Ge<0?The:zhe):RT($,0)),Xe&&(x(Ft),N.current.layout=Ft,ye&&ye(Ft),bu(Ee,Ft,M.current))}},[]),L=w.useCallback(($,G)=>{const{onLayout:z}=_.current,{layout:H,panelDataArray:D}=N.current,Y=D.map(ie=>ie.constraints),{panelSize:V,pivotIndices:Q}=qi(D,$,H);Be(V!=null,`Panel size not found for panel "${$.id}"`);const X=Su(D,$)===D.length-1?V-G:G-V,ye=bh({delta:X,initialLayout:H,panelConstraints:Y,pivotIndices:Q,prevLayout:H,trigger:"imperative-api"});cf(H,ye)||(x(ye),N.current.layout=ye,z&&z(ye),bu(D,ye,M.current))},[]),R=w.useCallback(($,G)=>{const{layout:z,panelDataArray:H}=N.current,{collapsedSize:D=0,collapsible:Y}=G,{collapsedSize:V=0,collapsible:Q,maxSize:ae=100,minSize:X=0}=$.constraints,{panelSize:ye}=qi(H,$,z);ye!=null&&(Y&&Q&&uo(ye,D)?uo(D,V)||L($,V):ye<X?L($,X):ye>ae&&L($,ae))},[L]),E=w.useCallback(($,G)=>{const{direction:z}=_.current,{layout:H}=N.current;if(!y.current)return;const D=JD($,y.current);Be(D,`Drag handle element not found for id "${$}"`);const Y=qhe(z,G);g({dragHandleId:$,dragHandleRect:D.getBoundingClientRect(),initialCursorPosition:Y,initialLayout:H})},[]),O=w.useCallback(()=>{g(null)},[]),J=w.useCallback($=>{const{panelDataArray:G}=N.current,z=Su(G,$);z>=0&&(G.splice(z,1),delete M.current[$.id],N.current.panelDataArrayChanged=!0,k())},[k]),K=w.useMemo(()=>({collapsePanel:I,direction:r,dragState:v,expandPanel:A,getPanelSize:T,getPanelStyle:P,groupId:m,isPanelCollapsed:F,isPanelExpanded:U,reevaluatePanelConstraints:R,registerPanel:W,registerResizeHandle:Z,resizePanel:L,startDragging:E,stopDragging:O,unregisterPanel:J,panelGroupElement:y.current}),[I,v,r,A,T,P,m,F,U,R,W,Z,L,E,O,J]),B={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return w.createElement(KD.Provider,{value:K},w.createElement(u,{...h,children:t,className:n,id:o,ref:y,style:{...B,...d},[Tt.group]:"",[Tt.groupDirection]:r,[Tt.groupId]:m}))}const Zhe=w.forwardRef((e,t)=>w.createElement(Khe,{...e,forwardedRef:t}));Khe.displayName="PanelGroup";Zhe.displayName="forwardRef(PanelGroup)";function Su(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function qi(e,t,n){const r=Su(e,t),o=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:o}}function Ogt({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){w.useEffect(()=>{if(e||n==null||r==null)return;const a=JD(t,r);if(a==null)return;const o=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),n(i);break}case"F6":{i.preventDefault();const s=a.getAttribute(Tt.groupId);Be(s,`No group element found for id "${s}"`);const c=s2(s,r),d=Vhe(s,t,r);Be(d!==null,`No resize element found for id "${t}"`);const u=i.shiftKey?d>0?d-1:c.length-1:d+1<c.length?d+1:0;c[u].focus();break}}};return a.addEventListener("keydown",o),()=>{a.removeEventListener("keydown",o)}},[r,e,t,n])}function Yhe({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:a,onBlur:o,onClick:i,onDragging:s,onFocus:c,onPointerDown:d,onPointerUp:u,style:h={},tabIndex:m=0,tagName:y="div",...v}){var g,b;const x=w.useRef(null),k=w.useRef({onClick:i,onDragging:s,onPointerDown:d,onPointerUp:u});w.useEffect(()=>{k.current.onClick=i,k.current.onDragging=s,k.current.onPointerDown=d,k.current.onPointerUp=u});const M=w.useContext(KD);if(M===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:C,groupId:S,registerResizeHandle:_,startDragging:N,stopDragging:I,panelGroupElement:A}=M,T=_q(a),[P,F]=w.useState("inactive"),[U,W]=w.useState(!1),[Z,L]=w.useState(null),R=w.useRef({state:P});$d(()=>{R.current.state=P}),w.useEffect(()=>{if(n)L(null);else{const K=_(T);L(()=>K)}},[n,T,_]);const E=(g=r?.coarse)!==null&&g!==void 0?g:15,O=(b=r?.fine)!==null&&b!==void 0?b:5;w.useEffect(()=>{if(n||Z==null)return;const K=x.current;Be(K,"Element ref not attached");let B=!1;return xgt(T,K,C,{coarse:E,fine:O},(G,z,H)=>{if(!z){F("inactive");return}switch(G){case"down":{F("drag"),B=!1,Be(H,'Expected event to be defined for "down" action'),N(T,H);const{onDragging:D,onPointerDown:Y}=k.current;D?.(!0),Y?.();break}case"move":{const{state:D}=R.current;B=!0,D!=="drag"&&F("hover"),Be(H,'Expected event to be defined for "move" action'),Z(H);break}case"up":{F("hover"),I();const{onClick:D,onDragging:Y,onPointerUp:V}=k.current;Y?.(!1),V?.(),B||D?.();break}}})},[E,C,n,O,_,T,Z,N,I]),Ogt({disabled:n,handleId:T,resizeHandler:Z,panelGroupElement:A});const J={touchAction:"none",userSelect:"none"};return w.createElement(y,{...v,children:e,className:t,id:a,onBlur:()=>{W(!1),o?.()},onFocus:()=>{W(!0),c?.()},ref:x,role:"separator",style:{...J,...h},tabIndex:m,[Tt.groupDirection]:C,[Tt.groupId]:S,[Tt.resizeHandle]:"",[Tt.resizeHandleActive]:P==="drag"?"pointer":U?"keyboard":void 0,[Tt.resizeHandleEnabled]:!n,[Tt.resizeHandleId]:T,[Tt.resizeHandleState]:P})}Yhe.displayName="PanelResizeHandle";const $gt=({className:e,...t})=>l.jsx(Zhe,{className:j("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),Tgt=Ahe,zgt=({withHandle:e,className:t,...n})=>l.jsx(Yhe,{className:j("relative flex w-px items-center justify-center bg-[var(--color-border-primary-subtle)] after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&l.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border border-[var(--color-border-primary-subtle)] bg-[var(--color-background-secondary)]",children:l.jsx(oe,{name:"grip-vertical",size:"sm",className:"text-[var(--color-icon-secondary)]"})})}),Fgt={colors:{primary:"var(--color-surface-primary)",secondary:"var(--color-surface-secondary)",textPrimary:"var(--color-text-primary)",textSecondary:"var(--color-text-secondary)",textBrand:"var(--color-text-brand-bold)",backgroundBrand:"var(--color-background-blue-bold)",backgroundBrandSelected:"var(--color-background-blue-subtle-selected)",borderPrimary:"var(--color-border-primary-subtle)",borderBrand:"var(--color-border-brand-bold)",borderFocus:"var(--color-border-focused)"},spacing:{xsm:"var(--space-xsm)",sm:"var(--space-sm)",md:"var(--space-md)",lg:"var(--space-lg)",xlg:"var(--space-xlg)"},sizing:{xsm:"var(--size-xsm)",sm:"var(--size-sm)",md:"var(--size-md)",lg:"var(--size-lg)",xlg:"var(--size-xlg)"}};exports.Accordion=Hst;exports.AccordionContent=ece;exports.AccordionItem=Jse;exports.AccordionTrigger=Qse;exports.ActivityLog=Eoe;exports.ActivityLogChevron=Toe;exports.ActivityLogContent=Doe;exports.ActivityLogDescription=Ooe;exports.ActivityLogHeader=Roe;exports.ActivityLogItem=AE;exports.ActivityLogSeparator=GH;exports.ActivityLogTime=$oe;exports.ActivityLogValue=zoe;exports.Alert=JX;exports.AlertDescription=eJ;exports.AlertDialog=wct;exports.AlertDialogAction=Bce;exports.AlertDialogBody=Vce;exports.AlertDialogCancel=qce;exports.AlertDialogContent=Tce;exports.AlertDialogFooter=Fce;exports.AlertDialogHeader=zce;exports.AlertDialogTitle=Hce;exports.AlertDialogTrigger=Mct;exports.AlertTitle=QX;exports.AppFrame=m0t;exports.AttributesChevron=Koe;exports.AttributesContent=Goe;exports.AttributesGroup=Hoe;exports.AttributesItem=Boe;exports.AttributesLabel=Uoe;exports.AttributesList=Foe;exports.AttributesRow=qoe;exports.AttributesSeparator=Voe;exports.AttributesValue=Woe;exports.AutocompleteSearch=PB;exports.Avatar=to;exports.AvatarFallback=ro;exports.AvatarGroup=jre;exports.AvatarImage=no;exports.Badge=sn;exports.Bookmarks=Za;exports.BookmarksActions=bq;exports.BookmarksContent=vq;exports.BookmarksCreateButton=wq;exports.BookmarksDefaultActions=jhe;exports.BookmarksResetButton=Mq;exports.BookmarksRevertButton=kq;exports.BookmarksSaveButton=Ihe;exports.BookmarksSaveDropdown=Cq;exports.BookmarksSettings=xq;exports.Breadcrumb=Qde;exports.BreadcrumbItem=tue;exports.BreadcrumbLink=nue;exports.BreadcrumbList=eue;exports.BreadcrumbPage=rue;exports.BreadcrumbSeparator=aue;exports.Button=Oe;exports.ButtonGroup=ZR;exports.ButtonGroupSeparator=Vre;exports.ButtonGroupText=Fre;exports.Calendar=Z2;exports.Card=Mp;exports.CardContent=Cp;exports.CardDescription=Hre;exports.CardFooter=Bre;exports.CardHeader=wH;exports.CardTitle=MH;exports.Chart=yre;exports.Checkbox=Mi;exports.Collapsible=xH;exports.CollapsibleContent=KR;exports.CollapsibleTrigger=GR;exports.Combobox=xpt;exports.CommandDialog=Yle;exports.CommandEmpty=ia;exports.CommandGroup=nr;exports.CommandInput=Ta;exports.CommandItem=Cn;exports.CommandList=qr;exports.CountryDropdown=Odt;exports.DEFAULT_DAY_PRESETS=She;exports.DEFAULT_MONTH_PRESETS=Che;exports.DataTable=Xyt;exports.DataTableSettingsMenu=ihe;exports.DatePicker=Dde;exports.DateRangePicker=Ode;exports.Dialog=vce;exports.DialogBody=uB;exports.DialogClose=ict;exports.DialogContent=lB;exports.DialogFooter=hB;exports.DialogHeader=dB;exports.DialogOverlay=cB;exports.DialogPortal=bce;exports.DialogTitle=pB;exports.DialogTrigger=oct;exports.Drawer=X2;exports.DrawerClose=DD;exports.DrawerContent=J2;exports.DrawerDescription=Jde;exports.DrawerFooter=Yde;exports.DrawerHeader=Zde;exports.DrawerOverlay=AB;exports.DrawerPortal=Kde;exports.DrawerTitle=Xde;exports.DrawerTrigger=RD;exports.DropdownMenu=Ao;exports.DropdownMenuContent=za;exports.DropdownMenuGroup=Z2t;exports.DropdownMenuItem=Sn;exports.DropdownMenuLabel=jd;exports.DropdownMenuSeparator=Jr;exports.DropdownMenuTrigger=Fa;exports.Editable=Bot;exports.EditableDisplay=Xoe;exports.EditableField=Joe;exports.EditableInput=Joe;exports.EditablePreview=Xoe;exports.Empty=Uce;exports.EmptyContent=Yce;exports.EmptyDescription=Zce;exports.EmptyHeader=Wce;exports.EmptyMedia=Gce;exports.EmptyTitle=Kce;exports.Field=aie;exports.FieldContent=oie;exports.FieldDescription=cie;exports.FieldError=die;exports.FieldGroup=nie;exports.FieldLabel=iie;exports.FieldLegend=tie;exports.FieldSeparator=lie;exports.FieldSet=Qoe;exports.FieldTitle=sie;exports.FileUpload=Bct;exports.FilterDropdownMenu=_he;exports.FilterPanelContent=gq;exports.Filters=rgt;exports.FixtureStatus=_oe;exports.Flag=kP;exports.FormControl=pie;exports.FormErrorMessage=mie;exports.FormField=uie;exports.FormHelperText=fie;exports.FormLabel=hie;exports.HoverCard=elt;exports.HoverCardContent=kle;exports.HoverCardTrigger=tlt;exports.Icon=oe;exports.Input=Fn;exports.InputGroup=bae;exports.InputGroupAddon=kae;exports.InputGroupButton=wae;exports.InputGroupInput=Cae;exports.InputGroupText=Mae;exports.InputGroupTextarea=Sae;exports.Kbd=Nd;exports.KbdGroup=dde;exports.Label=F2;exports.LinkedChart=sgt;exports.LoadingOverlay=Moe;exports.MonthPicker=SB;exports.MultiCombobox=kpt;exports.Pagination=rq;exports.Popover=Ur;exports.PopoverContent=Sr;exports.PopoverTrigger=sa;exports.Progress=yB;exports.ProgressDots=Soe;exports.Pulse=Coe;exports.RadioGroup=NH;exports.RadioGroupItem=CE;exports.ResizableHandle=zgt;exports.ResizablePanel=Tgt;exports.ResizablePanelGroup=$gt;exports.ScrollArea=xoe;exports.ScrollBar=BH;exports.Select=On;exports.SelectContent=Pn;exports.SelectGroup=Tse;exports.SelectItem=wt;exports.SelectLabel=eB;exports.SelectSeparator=tB;exports.SelectTrigger=An;exports.SelectValue=Xn;exports.Separator=zn;exports.Sheet=y0t;exports.SheetClose=v0t;exports.SheetContent=h1e;exports.SheetDescription=y1e;exports.SheetFooter=f1e;exports.SheetHeader=p1e;exports.SheetOverlay=nq;exports.SheetPortal=u1e;exports.SheetTitle=m1e;exports.SheetTrigger=g0t;exports.Sidebar=RB;exports.SidebarContent=due;exports.SidebarFooter=zB;exports.SidebarGroup=Lu;exports.SidebarGroupAction=uue;exports.SidebarGroupContent=Au;exports.SidebarGroupLabel=zE;exports.SidebarHeader=TB;exports.SidebarInput=iue;exports.SidebarInset=$B;exports.SidebarMenu=Pu;exports.SidebarMenuAction=hue;exports.SidebarMenuBadge=pue;exports.SidebarMenuButton=ui;exports.SidebarMenuItem=Eu;exports.SidebarMenuSkeleton=fue;exports.SidebarMenuSub=FB;exports.SidebarMenuSubButton=HB;exports.SidebarMenuSubItem=VB;exports.SidebarProvider=EB;exports.SidebarRail=OB;exports.SidebarSearchButton=sue;exports.SidebarSearchTrigger=cue;exports.SidebarSeparator=lue;exports.SidebarTrigger=DB;exports.Skeleton=Mr;exports.SkeletonAvatar=qH;exports.SkeletonButton=UH;exports.SkeletonCard=koe;exports.SkeletonTable=woe;exports.Slider=$le;exports.Spinner=fo;exports.Switch=WH;exports.Table=FD;exports.TableBody=HD;exports.TableCaption=w1e;exports.TableCell=Yn;exports.TableFooter=k1e;exports.TableGroupHeader=C1e;exports.TableHead=bi;exports.TableHeader=VD;exports.TableRow=rn;exports.TableSortHeader=M1e;exports.Tabs=ZH;exports.TabsContent=Lie;exports.TabsGroupLabel=Aie;exports.TabsList=YH;exports.TabsTrigger=Sp;exports.Tag=_p;exports.TagGroup=Tle;exports.TextLink=zse;exports.Textarea=IH;exports.Toaster=K0t;exports.Toggle=hD;exports.ToggleGroup=qie;exports.ToggleGroupItem=Uie;exports.Tooltip=Dr;exports.TooltipContent=gr;exports.TooltipProvider=L1;exports.TooltipTrigger=Or;exports.Tree=Fle;exports.ViewModeMenu=che;exports.avatarFallbackVariants=Ire;exports.avatarVariants=Nre;exports.buttonGroupVariants=zre;exports.calculatePresetRange=_F;exports.chartColorSchemes=Qo;exports.checkboxVariants=Xre;exports.cn=j;exports.createChartConfig=FSe;exports.createLinkedChartColumns=cgt;exports.designTokens=Fgt;exports.fieldLegendVariants=eie;exports.fieldVariants=rie;exports.formatDateRange=whe;exports.generateChartColors=zSe;exports.getDaysAgo=SP;exports.getLastMonthEnd=ghe;exports.getLastMonthStart=yhe;exports.getLastQuarterEnd=khe;exports.getLastQuarterStart=yq;exports.getLastWeekEnd=mhe;exports.getLastWeekStart=fhe;exports.getLastYearEnd=bhe;exports.getLastYearStart=vhe;exports.getPresetLabel=Mhe;exports.getQuarterLabel=SF;exports.getThisMonthEnd=uhe;exports.getThisMonthStart=dhe;exports.getThisQuarterEnd=xhe;exports.getThisQuarterStart=mq;exports.getThisWeekEnd=lhe;exports.getThisWeekStart=a0;exports.getThisYearEnd=phe;exports.getThisYearStart=hhe;exports.getToday=_P;exports.inputGroupAddonVariants=xae;exports.radioGroupItemVariants=vae;exports.radioGroupVariants=gae;exports.selectContentVariants=Ose;exports.selectItemVariants=$se;exports.selectTriggerVariants=Dse;exports.skeletonVariants=Yz;exports.statusConfig=Xz;exports.tableCellVariants=b1e;exports.tableHeaderVariants=x1e;exports.tableRowVariants=v1e;exports.tableVariants=g1e;exports.toast=O0t;exports.useBookmarksActions=iu;exports.useCountryData=$dt;exports.useIsDesktop=ED;exports.useMediaQuery=Uht;exports.useSidebar=D1;
|
|
146
146
|
//# sourceMappingURL=index.cjs.js.map
|