@texturehq/edges 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {TooltipTrigger,Tooltip,OverlayArrow,composeRenderProps,DialogTrigger,Menu,MenuItem,Modal,Dialog,Link,Button,useSlottedContext,PopoverContext,Popover,ModalOverlay,Checkbox,MenuTrigger,Select,SelectValue,ListBox,ListBoxItem,ComboBox,Input,ListBoxSection,Header,Breadcrumbs,Breadcrumb,Calendar,CalendarGrid,CalendarGridBody,CalendarCell,Text,useLocale,Heading,CalendarGridHeader,CalendarHeaderCell,CheckboxGroup,DisclosureGroup,Disclosure,DisclosurePanel,TextField,RangeCalendar,ToggleButton,DateField,DateInput,DateSegment,DateRangePicker,NumberField,Group as Group$1,Switch,DropZone,FileTrigger,Form,Meter,Tabs,TabList,Tab,TabPanel,ProgressBar,Radio,RadioGroup,TimeField}from'react-aria-components';export{DialogTrigger}from'react-aria-components';import*as Oe from'react';import Oe__default,{createContext,memo,forwardRef,useMemo,useId,useRef,useState,useEffect,useCallback,useImperativeHandle,Children,isValidElement,useContext,Component,cloneElement,useReducer,Fragment as Fragment$1,createElement,useLayoutEffect}from'react';import fv from'fuse.js';import {useVirtualizer}from'@tanstack/react-virtual';import zv from'papaparse';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import {DateTime}from'luxon';import {twMerge}from'tailwind-merge';import*as km from'@phosphor-icons/react';import*as nS from'@phosphor-icons/react/ssr';import {useFilter}from'react-aria';import {useAsyncList}from'react-stately';import {Minus,Check,Lightbulb,XCircle,AlertCircle,CheckCircle,Info,X,ChevronRight,ArrowUp,ArrowDown,CalendarIcon,Image as Image$1,Upload,AlertTriangle,User,Building2,Users}from'lucide-react';import {motion,AnimatePresence}from'framer-motion';import eN from'react-ace';import {HexColorPicker}from'react-colorful';import {curveLinear}from'@visx/curve';import {Bar,AreaClosed,LinePath,Line,Area}from'@visx/shape';import {LinearGradient}from'@visx/gradient';import {Group}from'@visx/group';import {scaleLinear,scaleTime,scaleBand}from'@visx/scale';import {bisector,extent,min,max}from'd3-array';import {Axis}from'@visx/axis';import {withParentSize}from'@visx/responsive';import {Zoom}from'@visx/zoom';import {Brush}from'@visx/brush';import {PatternLines}from'@visx/pattern';import {scaleTime as scaleTime$1}from'd3-scale';import {fromDate,getLocalTimeZone,parseDate}from'@internationalized/date';import {useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCenter}from'@dnd-kit/core';import {sortableKeyboardCoordinates,SortableContext,horizontalListSortingStrategy,arrayMove,useSortable}from'@dnd-kit/sortable';import {CSS}from'@dnd-kit/utilities';import {createPortal}from'react-dom';import cM,{AttributionControl,Marker,Popup,Source,Layer}from'react-map-gl';import {renderToStaticMarkup}from'react-dom/server';import ND from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import RD from'@tiptap/starter-kit';var nv=Object.create;var xc=Object.defineProperty;var av=Object.getOwnPropertyDescriptor;var iv=Object.getOwnPropertyNames;var sv=Object.getPrototypeOf,lv=Object.prototype.hasOwnProperty;var cv=(e,t,r)=>t in e?xc(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var dv=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var uv=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of iv(t))!lv.call(e,n)&&n!==r&&xc(e,n,{get:()=>t[n],enumerable:!(o=av(t,n))||o.enumerable});return e};var Ep=(e,t,r)=>(r=e!=null?nv(sv(e)):{},uv(xc(r,"default",{value:e,enumerable:true}),e));var Xa=(e,t,r)=>cv(e,typeof t!="symbol"?t+"":t,r);var wc=dv((Cc,Sc)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof Cc<"u"?t():(t(),e.FileSaver={});})(Cc,function(){function e(s,c){return typeof c>"u"?c={autoBom:false}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(s.type)?new Blob(["\uFEFF",s],{type:s.type}):s}function t(s,c,l){var d=new XMLHttpRequest;d.open("GET",s),d.responseType="blob",d.onload=function(){i(d.response,c,l);},d.onerror=function(){console.error("could not download file");},d.send();}function r(s){var c=new XMLHttpRequest;c.open("HEAD",s,false);try{c.send();}catch{}return 200<=c.status&&299>=c.status}function o(s){try{s.dispatchEvent(new MouseEvent("click"));}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",true,true,window,0,0,0,80,20,false,false,false,false,0,null),s.dispatchEvent(c);}}var n=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:void 0,a=n.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),i=n.saveAs||(typeof window!="object"||window!==n?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(s,c,l){var d=n.URL||n.webkitURL,u=document.createElement("a");c=c||s.name||"download",u.download=c,u.rel="noopener",typeof s=="string"?(u.href=s,u.origin===location.origin?o(u):r(u.href)?t(s,c,l):o(u,u.target="_blank")):(u.href=d.createObjectURL(s),setTimeout(function(){d.revokeObjectURL(u.href);},4e4),setTimeout(function(){o(u);},0));}:"msSaveOrOpenBlob"in navigator?function(s,c,l){if(c=c||s.name||"download",typeof s!="string")navigator.msSaveOrOpenBlob(e(s,l),c);else if(r(s))t(s,c,l);else {var d=document.createElement("a");d.href=s,d.target="_blank",setTimeout(function(){o(d);});}}:function(s,c,l,d){if(d=d||open("","_blank"),d&&(d.document.title=d.document.body.innerText="downloading..."),typeof s=="string")return t(s,c,l);var u=s.type==="application/octet-stream",m=/constructor/i.test(n.HTMLElement)||n.safari,p=/CriOS\/[\d]+/.test(navigator.userAgent);if((p||u&&m||a)&&typeof FileReader<"u"){var g=new FileReader;g.onloadend=function(){var b=g.result;b=p?b:b.replace(/^data:[^;]*;/,"data:attachment/file;"),d?d.location.href=b:location=b,d=null;},g.readAsDataURL(s);}else {var f=n.URL||n.webkitURL,x=f.createObjectURL(s);d?d.location=x:location.href=x,d=null,setTimeout(function(){f.revokeObjectURL(x);},4e4);}});n.saveAs=i.saveAs=i,typeof Sc<"u"&&(Sc.exports=i);});});function Yt(e,t=false){let[r,o]=useState(t);return useEffect(()=>{if(typeof window>"u")return;let n=window.matchMedia(e);o(n.matches);let a=i=>{o(i.matches);};return n.addEventListener("change",a),()=>{n.removeEventListener("change",a);}},[e]),r}var nn={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function Jt(e="base"){let t=Yt(`(min-width: ${nn.sm})`,e!=="base"),r=Yt(`(min-width: ${nn.md})`,["md","lg","xl","2xl"].includes(e)),o=Yt(`(min-width: ${nn.lg})`,["lg","xl","2xl"].includes(e)),n=Yt(`(min-width: ${nn.xl})`,["xl","2xl"].includes(e)),a=Yt(`(min-width: ${nn["2xl"]})`,e==="2xl"),i=!r,s=r,c="base";return a?c="2xl":n?c="xl":o?c="lg":r?c="md":t&&(c="sm"),{current:c,isSm:t,isMd:r,isLg:o,isXl:n,is2Xl:a,isMobile:i,isDesktop:s}}function ja(e,t){return t.split(".").reduce((r,o)=>r?.[o],e)}function gv(e,t){let r=ja(e,t.field),o=t.value;switch(t.operator){case "eq":return r===o;case "neq":return r!==o;case "in":return Array.isArray(o)?Array.isArray(r)?r.some(n=>o.includes(n)):o.includes(r):false;case "nin":return Array.isArray(o)?Array.isArray(r)?!r.some(n=>o.includes(n)):!o.includes(r):false;case "gt":return r instanceof Date&&typeof o=="string"?r>new Date(o):r>o;case "gte":return r instanceof Date&&typeof o=="string"?r>=new Date(o):r>=o;case "lt":return r instanceof Date&&typeof o=="string"?r<new Date(o):r<o;case "lte":return r instanceof Date&&typeof o=="string"?r<=new Date(o):r<=o;case "contains":return typeof r!="string"?false:r.toLowerCase().includes(String(o).toLowerCase());case "startsWith":return typeof r!="string"?false:r.toLowerCase().startsWith(String(o).toLowerCase());case "endsWith":return typeof r!="string"?false:r.toLowerCase().endsWith(String(o).toLowerCase());default:return false}}function Ap(e,t){if(t.conditions.length===0)return true;let r=t.conditions.map(o=>"conditions"in o?Ap(e,o):gv(e,o));return t.logic==="AND"?r.every(Boolean):r.some(Boolean)}function bv(e,t){return !t||t.conditions.length===0?e:e.filter(r=>Ap(r,t))}function xv(e,t,r){if(e==null&&t==null)return 0;if(e==null)return r==="asc"?1:-1;if(t==null)return r==="asc"?-1:1;if(e instanceof Date&&t instanceof Date){let o=e.getTime()-t.getTime();return r==="asc"?o:-o}if(typeof e=="string"&&typeof t=="string"){let o=e.toLowerCase().localeCompare(t.toLowerCase());return r==="asc"?o:-o}return e<t?r==="asc"?-1:1:e>t?r==="asc"?1:-1:0}function hv(e,t){return t?[...e].sort((r,o)=>{let n=ja(r,t.field),a=ja(o,t.field);return xv(n,a,t.direction)}):e}function yv(e,t){if(!t||!t.query.trim())return e;let{query:r,fields:o,fuzzy:n=true,threshold:a=.3}=t;if(n)return new fv(e,{keys:o,threshold:a,ignoreLocation:true,includeScore:true}).search(r).map(l=>l.item);let i=r.toLowerCase();return e.filter(s=>o.some(c=>{let l=ja(s,c);return l==null?false:String(l).toLowerCase().includes(i)}))}function vv(e,t){let r={};for(let o of t){if(r[o.field]={},o.values)for(let n of o.values)r[o.field][String(n.value)]=0;for(let n of e){let a=ja(n,o.field);if(a!=null)if(Array.isArray(a))for(let i of a){let s=String(i);r[o.field][s]=(r[o.field][s]||0)+1;}else {let i=String(a);r[o.field][i]=(r[o.field][i]||0)+1;}}}return r}function hc({data:e,filters:t,sort:r,search:o,facetConfigs:n=[]}){let a=yv(e,o||null);a=bv(a,t||null);let i=vv(a,n);return a=hv(a,r||null),{data:a,facetCounts:i,resultCount:a.length}}function Qi({data:e,filters:t,sort:r,search:o,facetConfigs:n=[]}){return useMemo(()=>hc({data:e,filters:t,sort:r,search:o,facetConfigs:n}),[e,t,r,o,n])}var yc=createContext(null);function Ip(e){let t=useContext(yc),r=useRef(null),o=e??r,[n,a]=useState(()=>t||{current:"xl",isSm:true,isMd:true,isLg:true,isXl:true,is2Xl:false,isMobile:false,isDesktop:true});return useEffect(()=>{if(t){a(t);return}let i=o.current;if(!i||typeof ResizeObserver>"u")return;let s=()=>{let l=i.offsetWidth,d=l>=640,u=l>=768,m=l>=1024,p=l>=1280,g=l>=1536,f="base";g?f="2xl":p?f="xl":m?f="lg":u?f="md":d&&(f="sm"),a({current:f,isSm:d,isMd:u,isLg:m,isXl:p,is2Xl:g,isMobile:!u,isDesktop:u});};s();let c=new ResizeObserver(s);return c.observe(i),()=>c.disconnect()},[t,o]),n}function Po(e,t=300){let[r,o]=useState(e);return useEffect(()=>{let n=setTimeout(()=>o(e),t);return ()=>clearTimeout(n)},[e,t]),r}function Zi({filters:e,sort:t,search:r,onStateChange:o,searchDebounce:n=300}){let a=Po(r,n),i=useRef(true);useEffect(()=>{if(i.current){i.current=false;return}o({filters:e,sort:t,search:a});},[e,t,a,o]);}function Fp(e){return e.mode==="client"?Qi({data:e.data,filters:e.filters,sort:e.sort,search:e.search,facetConfigs:e.facetConfigs}):(Zi({filters:e.filters,sort:e.sort,search:e.search,onStateChange:e.onStateChange,searchDebounce:e.searchDebounce}),{data:e.data,facetCounts:e.facetCounts||{},resultCount:e.resultCount??e.data.length})}function oa(){let[e,t]=useState({width:0,height:0}),r=useRef(null),o=useRef(void 0),n=useCallback(a=>{if(r.current&&(r.current.disconnect(),r.current=null),o.current&&(cancelAnimationFrame(o.current),o.current=void 0),!a){t({width:0,height:0});return}let i=a.getBoundingClientRect();t({width:i.width,height:i.height}),r.current=new ResizeObserver(s=>{o.current&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(c=>{for(let l of s){let{width:d,height:u}=l.contentRect;t(m=>m.width!==d||m.height!==u?{width:d,height:u}:m);}});}),r.current.observe(a);},[]);return useEffect(()=>()=>{o.current&&cancelAnimationFrame(o.current),r.current&&r.current.disconnect();},[]),{ref:n,width:e.width,height:e.height}}function Ro({items:e,onLoadMore:t,hasMore:r,isLoading:o=false,loadingState:n,enableVirtualization:a,estimatedItemSize:i=50,overscan:s=5,scrollElement:c,loadMoreThreshold:l=100}){let d=useRef(null),u=useRef(null),m=useRef(false),[p,g]=useState(0);useEffect(()=>{u.current&&(c||d.current)&&g(M=>M+1);},[c,e.length]);let f=n||(o?e.length===0?"loading":"loading-more":"idle"),x=f==="loading",b=f==="loading-more",h=a!==void 0?a:e.length>=100,y=useVirtualizer({count:e.length,getScrollElement:()=>c||d.current,estimateSize:()=>i,overscan:s}),v=h?y:null,S=h?y.getVirtualItems():[];useEffect(()=>{let M=u.current,k=c||d.current;if(!M||!k||!r||o||!t)return;let P=new IntersectionObserver(I=>{let[D]=I;D?.isIntersecting&&!m.current&&r&&t&&(m.current=true,Promise.resolve(t()).finally(()=>{m.current=false;}));},{root:k,rootMargin:`0px 0px ${l}px 0px`,threshold:0});return P.observe(M),()=>{P.disconnect();}},[r,o,t,c,l,p]);let N=useCallback((M,k)=>{v?v.scrollToIndex(M,k):d.current&&d.current.children[M]?.scrollIntoView({behavior:"smooth",block:k?.align||"start"});},[v]),w=useCallback(()=>{v?v.scrollToIndex(0,{align:"start"}):d.current&&d.current.scrollTo({top:0,behavior:"smooth"});},[v]);return {virtualizer:v,virtualItems:S,computedLoadingState:f,isInitialLoad:x,isLoadingMore:b,scrollRef:d,loadMoreRef:u,scrollToIndex:N,scrollToTop:w}}function _i(e,t){let[r,o]=useState(()=>{if(typeof window>"u")return t;try{let i=window.localStorage.getItem(e);return i?JSON.parse(i):t}catch(i){return console.error(`Error reading localStorage key "${e}":`,i),t}});useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(r));}catch(i){console.error(`Error writing to localStorage key "${e}":`,i);}},[e,r]);let n=useCallback(i=>{try{o(s=>i instanceof Function?i(s):i);}catch(s){console.error(`Error setting value for localStorage key "${e}":`,s);}},[e]),a=useCallback(()=>{try{typeof window<"u"&&window.localStorage.removeItem(e),o(t);}catch(i){console.error(`Error removing localStorage key "${e}":`,i);}},[e,t]);return [r,n,a]}var Hp=Ep(wc());function Ov(e,t,r=true){let o=e;if(r){let n=new Date().toISOString().replace(/[:.]/g,"-").slice(0,-5);return `${o}-${n}.${t}`}return `${o}.${t}`}function Hv(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function Wp(e,t){let r=Hv(t,e);return e.exportValue?e.exportValue(r,t)??"":r==null?"":r instanceof Date?r.toISOString():typeof r=="object"?JSON.stringify(r):r}function Nc(e){return e.filter(t=>t.exportable!==false)}function Gp(e){let t=e.map(n=>n.exportLabel||n.label),r=new Set,o=[];for(let n of t)r.has(n)?o.includes(n)||o.push(n):r.add(n);if(o.length>0)throw new Error(`Duplicate export headers found: ${o.join(", ")}. Use exportLabel to provide unique headers.`)}async function kc(e){let{columns:t,data:r,metadata:o={}}=e;try{let n=Nc(t);if(n.length===0)throw new Error("No exportable columns found");Gp(n);let a=r.map(l=>{let d={};for(let u of n){let m=u.exportLabel||u.label;d[m]=Wp(u,l);}return d}),i=zv.unparse(a,{header:!0,skipEmptyLines:!0}),s=new Blob([i],{type:"text/csv;charset=utf-8;"}),c=Ov(o.filename||"table-data","csv",o.timestamp!==!1);(0,Hp.saveAs)(s,c);}catch(n){throw new Error(`CSV export failed: ${n instanceof Error?n.message:"Unknown error"}`)}}function Wv(e){let{columns:t,data:r}=e,o=Nc(t);return Gp(o),r.map(n=>{let a={};for(let i of o){let s=i.exportLabel||i.label;a[s]=Wp(i,n);}return a})}function Gv(e){return Nc(e).map(t=>t.exportLabel||t.label)}function Up({columns:e,data:t,metadata:r}){let n=e.filter(i=>i.exportable!==false).length>0&&t.length>0;return {exportCSV:useCallback(async()=>{try{await kc({columns:e,data:t,metadata:r});}catch(i){throw console.error("Table export failed:",i),i}},[e,t,r]),canExport:n}}var Tc=class{constructor(){Xa(this,"formatters",new Map);}register(t,r){this.formatters.set(t,r);}format(t,r,...o){let n=this.formatters.get(t);return n?n(r,...o):(console.warn(`No formatter registered for key: ${t}`),null)}has(t){return this.formatters.has(t)}keys(){return Array.from(this.formatters.keys())}unregister(t){this.formatters.delete(t);}clear(){this.formatters.clear();}},ne=new Tc;var Mo=(e,t="Yes",r="No")=>e==null?null:e?t:r,Kv=e=>Mo(e,"Enabled","Disabled"),Yv=e=>Mo(e,"On","Off"),Jv=e=>Mo(e,"Active","Inactive"),Xv=e=>Mo(e,"True","False"),jv=e=>Mo(e,"\u2713","\u2717"),Do=e=>{if(e==null)return null;if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase().trim();return t==="true"||t==="yes"||t==="1"||t==="on"||t==="enabled"?true:t==="false"||t==="no"||t==="0"||t==="off"||t==="disabled"?false:null}return typeof e=="number"?e!==0:null},Kp=(e,t)=>{if(t.hideWhenNull&&e==null)return null;if(e==null)return t.nullText??null;let r=Do(e);return r===null?t.nullText??null:Mo(r,t.trueText??"Yes",t.falseText??"No")};ne.register("boolean",(e,t,r)=>{let o=Do(e);return o!==null?Mo(o,typeof t=="string"?t:"Yes",typeof r=="string"?r:"No"):null});ne.register("yesNo",e=>{let t=Do(e);return t!==null?Mo(t,"Yes","No"):null});ne.register("enabledDisabled",e=>{let t=Do(e);return t!==null?Kv(t):null});ne.register("onOff",e=>{let t=Do(e);return t!==null?Yv(t):null});ne.register("activeInactive",e=>{let t=Do(e);return t!==null?Jv(t):null});ne.register("trueFalse",e=>{let t=Do(e);return t!==null?Xv(t):null});ne.register("checkmark",e=>{let t=Do(e);return t!==null?jv(t):null});var pe=e=>e==null,Yp=(e,t=0)=>pe(e)?null:`${e.toFixed(t)}%`,Jp=(e,t=0)=>Yp(e,t)??"\u2014",qv=e=>pe(e)?null:Math.round(e).toString(),Qv=(e,t=1)=>pe(e)?null:e.toFixed(t),Zv=(e,t,r=true)=>{if(pe(e))return null;let o={useGrouping:r};return t!==void 0&&(o.minimumFractionDigits=t,o.maximumFractionDigits=t),new Intl.NumberFormat("en-US",o).format(e)},_v=(e,t="short")=>pe(e)?null:new Intl.NumberFormat("en-US",{notation:"compact",compactDisplay:t}).format(e),$v=(e,t=2)=>pe(e)?null:e.toExponential(t),Xp=(e,t="USD",r)=>{if(pe(e))return null;let o={style:"currency",currency:t,currencyDisplay:r?.currencyDisplay??"symbol",useGrouping:r?.thousandsSeparator??true};return r?.minimumFractionDigits!==void 0&&(o.minimumFractionDigits=r.minimumFractionDigits),r?.maximumFractionDigits!==void 0&&(o.maximumFractionDigits=r.maximumFractionDigits),new Intl.NumberFormat("en-US",o).format(e)},jp=(e,t)=>{if(t.hideWhenNull&&e==null||t.hideWhenZero&&e===0)return null;if(e==null)return t.nullText??null;let r=typeof e=="string"?parseFloat(e):Number(e);if(isNaN(r))return t.nullText??null;let o={useGrouping:t.thousandsSeparator??false};return t.decimals!==void 0&&(o.minimumFractionDigits=t.decimals,o.maximumFractionDigits=t.decimals),t.notation&&(o.notation=t.notation,t.notation==="compact"&&t.compactDisplay&&(o.compactDisplay=t.compactDisplay)),t.sign&&(o.signDisplay=t.sign),new Intl.NumberFormat("en-US",o).format(r)},qp=(e,t)=>{if(t.hideWhenNull&&e==null||t.hideWhenZero&&e===0)return null;if(e==null)return t.nullText??null;let r=typeof e=="string"?parseFloat(e):Number(e);return isNaN(r)?t.nullText??null:Xp(r,t.currency,t)};ne.register("percentage",(e,t)=>typeof e=="number"?Yp(e,typeof t=="number"?t:0):null);ne.register("integer",e=>typeof e=="number"?qv(e):null);ne.register("float",(e,t)=>typeof e=="number"?Qv(e,typeof t=="number"?t:1):null);ne.register("number",(e,t,r)=>{let o=typeof e=="string"?parseFloat(e):Number(e);return isNaN(o)?null:Zv(o,typeof t=="number"?t:void 0,typeof r=="boolean"?r:true)});ne.register("compact",(e,t)=>typeof e=="number"?_v(e,t==="long"?"long":"short"):null);ne.register("scientific",(e,t)=>typeof e=="number"?$v(e,typeof t=="number"?t:2):null);ne.register("currency",(e,t,r)=>typeof e=="number"?Xp(e,typeof t=="string"?t:"USD",typeof r=="object"&&r!==null?r:{}):null);function LE(e,t=1){return pe(e)?null:Math.abs(e)>=1e3?`${(e/1e3).toFixed(t)} MWh`:`${e.toFixed(t)} kWh`}function EE(e,t=1){return pe(e)?null:Math.abs(e)>=1e3?`${(e/1e3).toFixed(t)} MW`:`${e.toFixed(t)} kW`}function Xr({value:e,formatter:t,emptyClassName:r="text-text-secondary",emptyText:o="\u2014"}){if(e==null)return jsx("span",{className:r,children:o});if(typeof t=="function")return t(e);if(t&&typeof t=="object"){let n=Fr(e,t);return e instanceof Date&&n?jsx("time",{dateTime:e.toISOString(),title:e.toISOString(),children:n}):n||jsx("span",{className:r,children:o})}if(!t){if(typeof e=="string")return e;if(e instanceof Date){let n=Fr(e,{type:"date"});return jsx("time",{dateTime:e.toISOString(),title:e.toISOString(),children:n})}if(typeof e=="number")return Fr(e,{type:"number"});if(typeof e=="boolean")return Fr(e,{type:"boolean"})}return String(e)}function BE(e,t,r){return Oe__default.useCallback(o=>Xr({value:o,formatter:e,emptyClassName:t,emptyText:r}),[e,t,r])}var Pc=(e,t=0)=>{if(pe(e))return null;let r=e*1e3;return t===0?`${Math.round(r)} mA`:`${r.toFixed(t)} mA`},es=(e,t=1)=>pe(e)?null:`${e.toFixed(t)} A`,Rc=(e,t=2)=>pe(e)?null:`${(e/1e3).toFixed(t)} kA`,t0=(e,t)=>{if(pe(e))return null;let r=Math.abs(e);return r>=1e3?Rc(e,t??2):r<1?Pc(e,t??0):es(e,t??1)},Mc=(e,t)=>{if(t.hideWhenNull&&e==null||t.hideWhenZero&&e===0)return null;if(e==null)return t.nullText??null;let r=typeof e=="string"?parseFloat(e):Number(e);if(isNaN(r))return t.nullText??null;let o=t.decimals;if(t.unit)switch(t.unit){case "kA":return Rc(r,o??2);case "mA":return Pc(r,o??0);case "A":return es(r,o??1)}return t.autoScale!==false?t0(r,o):es(r,o??1)};ne.register("current",Mc);var WE=Pc,GE=es,UE=Rc;var an=e=>{if(e==null)return null;if(e instanceof Date)return DateTime.fromJSDate(e);if(typeof e=="string"){let t=DateTime.fromISO(e);return t.isValid?t:null}if(typeof e=="number"){let t=DateTime.fromMillis(e);return t.isValid?t:null}return null},r0=(e,t=false,r)=>{if(!e)return null;let o=an(e);if(!o)return "Invalid Date";let n=r?o.setZone(r):o;return t?n.toLocaleString(DateTime.DATETIME_SHORT):n.toLocaleString(DateTime.DATE_SHORT)},ts=e=>{if(!e)return null;let t=an(e);return t?t.toRelative():"Invalid Date"},o0=(e,t)=>{if(!e)return null;let r=an(e);return r?(t?r.setZone(t):r).toLocaleString(DateTime.DATETIME_MED_WITH_WEEKDAY):"Invalid Date"},n0=e=>{if(!e)return null;let t=an(e);return t?t.toISO():null},a0=(e,t,r)=>{if(!e)return null;let o=an(e);return o?(r?o.setZone(r):o).toFormat(t):"Invalid Date"},XE=e=>{let t=an(e);return t?{year:t.year,month:t.month,day:t.day,weekday:t.weekday,hour:t.hour,minute:t.minute,second:t.second,millisecond:t.millisecond,weekdayShort:t.weekdayShort,weekdayLong:t.weekdayLong,monthShort:t.monthShort,monthLong:t.monthLong}:null},Qp=(e,t)=>{if(t.hideWhenNull&&e==null)return null;if(e==null)return t.nullText??null;let r=an(e);if(!r)return t.nullText??"Invalid Date";let o=t.timezone?r.setZone(t.timezone):r;if(t.relative)return o.toRelative();if(t.format)return o.toFormat(t.format);if(t.dateStyle||t.timeStyle){let n={};if(t.dateStyle)switch(t.dateStyle){case "short":n.date=DateTime.DATE_SHORT;break;case "medium":n.date=DateTime.DATE_MED;break;case "long":n.date=DateTime.DATE_FULL;break;case "full":n.date=DateTime.DATE_HUGE;break}if(t.timeStyle)switch(t.timeStyle){case "short":n.time=DateTime.TIME_SIMPLE;break;case "medium":n.time=DateTime.TIME_WITH_SECONDS;break;case "long":case "full":n.time=DateTime.TIME_WITH_SHORT_OFFSET;break}if(n.date&&n.time)return o.toLocaleString({...n.date,...n.time});if(n.date)return o.toLocaleString(n.date);if(n.time)return o.toLocaleString(n.time)}return o.toLocaleString(DateTime.DATETIME_SHORT)};ne.register("date",(e,t,r)=>r0(e,typeof t=="boolean"?t:false,typeof r=="string"?r:void 0));ne.register("relativeTime",e=>ts(e));ne.register("fullDateTime",(e,t)=>o0(e,typeof t=="string"?t:void 0));ne.register("isoString",e=>n0(e));ne.register("customDateFormat",(e,t,r)=>typeof t=="string"?a0(e,t,typeof r=="string"?r:void 0):null);var Dc=(e,t=1)=>pe(e)?null:`${e.toFixed(t)} m`,i0=(e,t=1)=>pe(e)?null:`${(e*100).toFixed(t)} cm`,s0=(e,t=0)=>pe(e)?null:`${(e*1e3).toFixed(t)} mm`,Lc=(e,t=1)=>pe(e)?null:`${(e/1e3).toFixed(t)} km`,Ec=(e,t=0)=>pe(e)?null:`${e.toFixed(t)} ft`,l0=(e,t=1)=>pe(e)?null:`${e.toFixed(t)} in`,Ac=(e,t=1)=>pe(e)?null:`${e.toFixed(t)} mi`,Ic=(e,t=0)=>pe(e)?null:`${e.toFixed(t)} yd`,ZE=(e,t=1)=>pe(e)?null:`${e.toFixed(t)} nm`,_E=e=>e*3.28084,$E=e=>e/3.28084,eA=e=>e*1.60934,tA=e=>e/1.60934,rA=e=>e/5280,Zp=e=>e*5280,oA=e=>e/1609.34,nA=e=>e*1609.34,aA=e=>e*.9144,iA=e=>e/.9144,sA=e=>e*2.54,lA=e=>e/2.54,_p=(e,t=false,r=1)=>{if(pe(e))return null;let o=Math.abs(e);return t?o>=1e3?Lc(e,r):o<.01?s0(e,0):o<1?i0(e,r):Dc(e,r):o<.01?Ec(Zp(e),0):o<.1?Ic(Zp(e)/3,0):Ac(e,r)},$p=(e,t)=>{if(t.hideWhenNull&&e==null||t.hideWhenZero&&e===0)return null;if(e==null)return t.nullText??null;let r=typeof e=="string"?parseFloat(e):Number(e);if(isNaN(r))return t.nullText??null;let o=t.decimals??1;if(t.autoScale){let n=t.unit==="m"||t.unit==="km";return _p(r,n,o)}switch(t.unit){case "km":return Lc(r,o);case "ft":return Ec(r,o);case "mi":return Ac(r,o);case "yd":return Ic(r,o);default:return Dc(r,o)}};ne.register("miles",(e,t)=>typeof e=="number"?Ac(e,typeof t=="number"?t:1):null);ne.register("kilometers",(e,t)=>typeof e=="number"?Lc(e,typeof t=="number"?t:1):null);ne.register("meters",(e,t)=>typeof e=="number"?Dc(e,typeof t=="number"?t:1):null);ne.register("feet",(e,t)=>typeof e=="number"?Ec(e,typeof t=="number"?t:0):null);ne.register("yards",(e,t)=>typeof e=="number"?Ic(e,typeof t=="number"?t:0):null);ne.register("inches",(e,t)=>typeof e=="number"?l0(e,typeof t=="number"?t:1):null);ne.register("autoScaleDistance",(e,t,r)=>typeof e=="number"?_p(e,typeof t=="boolean"?t:false,typeof r=="number"?r:1):null);var Fc=(e,t=1)=>pe(e)?null:`${e.toFixed(t)} Wh`,Bc=(e,t=1)=>pe(e)?null:`${(e/1e3).toFixed(t)} kWh`,em=(e,t=1)=>pe(e)?null:`${(e/1e6).toFixed(t)} MWh`,tm=(e,t=1)=>pe(e)?null:`${(e/1e9).toFixed(t)} GWh`,Vc=e=>{let t=Math.abs(e);return t>=1e9?"GWh":t>=1e6?"MWh":t>=1e3?"kWh":"Wh"},rm=(e,t=1)=>{if(pe(e))return null;switch(Vc(e)){case "GWh":return tm(e,t);case "MWh":return em(e,t);case "kWh":return Bc(e,t);default:return Fc(e,t)}},zc={Wh:1,kWh:1e3,MWh:1e6,GWh:1e9},Oc=(e,t)=>{if(t.hideWhenNull&&e==null||t.hideWhenZero&&e===0)return null;if(e==null)return t.nullText??null;let r=typeof e=="string"?parseFloat(e):Number(e);if(isNaN(r))return t.nullText??null;let o=t.sourceUnit?r*zc[t.sourceUnit]:r,n=t.decimals??1;if(t.unit)switch(t.unit){case "GWh":return tm(o,n);case "MWh":return em(o,n);case "kWh":return Bc(o,n);case "Wh":return Fc(o,n)}return t.autoScale!==false?rm(o,n):Fc(o,n)};ne.register("kWh",e=>typeof e=="number"?Bc(e):null);ne.register("autoScaleEnergy",(e,t)=>typeof e=="number"?rm(e,typeof t=="number"?t:1):null);ne.register("energy",Oc);var rs=e=>{if(!e)return null;let t=e.replace(/\D/g,"");return t.length===10?t.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3"):t.length===11&&t.startsWith("1")?t.replace(/1(\d{3})(\d{3})(\d{4})/,"+1 ($1) $2-$3"):e},Hc=e=>{if(!e)return null;let t=e.replace(/[^\d+]/g,"");return t.startsWith("+")?t.length===12&&t.startsWith("+1")?t.replace(/\+1(\d{3})(\d{3})(\d{4})/,"+1 ($1) $2-$3"):t.length===13&&t.startsWith("+44")?t.replace(/\+44(\d{2})(\d{4})(\d{4})/,"+44 $1 $2 $3"):t.replace(/(\+\d{1,3})(\d{3,4})(\d{3,4})(\d{3,4})?/,"$1 $2 $3 $4").trim():rs(e)},na=e=>e?e.startsWith("+")||e.length>11?Hc(e):rs(e):null,om=(e,t)=>{if(t.hideWhenNull&&e==null)return null;if(e==null)return t.nullText??null;let r=String(e);if(t.international)return Hc(r);switch(t.country){case "US":case "CA":return rs(r);default:return na(r)}};ne.register("phoneNumber",e=>typeof e=="string"?na(e):null);ne.register("usPhone",e=>typeof e=="string"?rs(e):null);ne.register("internationalPhone",e=>typeof e=="string"?Hc(e):null);var os=(e,t=0)=>pe(e)?null:t===0?`${Math.round(e)} W`:`${e.toFixed(t)} W`,Wc=(e,t=1)=>pe(e)?null:`${(e/1e3).toFixed(t)} kW`,Gc=(e,t=1)=>pe(e)?null:`${(e/1e6).toFixed(t)} MW`,Uc=(e,t=2)=>pe(e)?null:`${(e/1e9).toFixed(t)} GW`,c0=(e,t)=>{if(pe(e))return null;let r=Math.abs(e);return r>=1e9?Uc(e,t??2):r>=1e6?Gc(e,t??1):r>=1e3?Wc(e,t??1):os(e,t??0)},Kc=(e,t)=>{if(t.hideWhenNull&&e==null||t.hideWhenZero&&e===0)return null;if(e==null)return t.nullText??null;let r=typeof e=="string"?parseFloat(e):Number(e);if(isNaN(r))return t.nullText??null;let o=t.decimals;if(t.unit)switch(t.unit){case "GW":return Uc(r,o??2);case "MW":return Gc(r,o??1);case "kW":return Wc(r,o??1);case "W":return os(r,o??0)}return t.autoScale!==false?c0(r,o):os(r,o??0)};ne.register("power",Kc);var xA=os,hA=Wc,yA=Gc,vA=Uc;var Yc=(e,t=1)=>pe(e)?null:`${(e*1e3).toFixed(t)} m\u03A9`,ns=(e,t=1)=>pe(e)?null:`${e.toFixed(t)} \u03A9`,nm=(e,t=1)=>pe(e)?null:`${(e/1e3).toFixed(t)} k\u03A9`,am=(e,t=2)=>pe(e)?null:`${(e/1e6).toFixed(t)} M\u03A9`,d0=(e,t)=>{if(pe(e))return null;let r=Math.abs(e);return r>=1e6?am(e,t??2):r>=1e3?nm(e,t??1):r<1?Yc(e,t??1):ns(e,t??1)},Jc=(e,t)=>{if(t.hideWhenNull&&e==null||t.hideWhenZero&&e===0)return null;if(e==null)return t.nullText??null;let r=typeof e=="string"?parseFloat(e):Number(e);if(isNaN(r))return t.nullText??null;let o=t.decimals;if(t.unit)switch(t.unit){case "M\u03A9":return am(r,o??2);case "k\u03A9":return nm(r,o??1);case "m\u03A9":return Yc(r,o??1);case "\u03A9":return ns(r,o??1)}return t.autoScale!==false?d0(r,o):ns(r,o??1)};ne.register("resistance",Jc);ne.register("ohms",e=>typeof e=="number"?ns(e):null);ne.register("milliohms",e=>typeof e=="number"?Yc(e):null);var im=e=>{switch(e){case "FAHRENHEIT":return "F";case "CELSIUS":return "C";case "KELVIN":return "K";default:return "F"}},sm=(e,t=0)=>pe(e)?null:`${e.toFixed(t)}\xB0F`,lm=(e,t=true,r=0)=>pe(e)?null:`${(t?(e-32)*(5/9):e).toFixed(r)}\xB0C`,cm=(e,t=true,r=0)=>pe(e)?null:`${(t?(e-32)*(5/9)+273.15:e+273.15).toFixed(r)}K`,u0=e=>e*9/5+32,p0=e=>(e-32)*(5/9),PA=e=>e+273.15,m0=e=>e-273.15,RA=e=>p0(e)+273.15,MA=e=>u0(m0(e)),dm=(e,t="F",r=0)=>{if(pe(e))return null;switch(typeof t=="string"&&t.length>1?im(t):t){case "C":return lm(e,true,r);case "K":return cm(e,true,r);default:return sm(e,r)}},um=(e,t)=>{if(t.hideWhenNull&&e==null)return null;if(e==null)return t.nullText??null;let r=typeof e=="string"?parseFloat(e):Number(e);if(isNaN(r))return t.nullText??null;let o=t.decimals??0,n=t.unit??"F";if(t.showUnit===false)switch(typeof n=="string"&&n.length>1?im(n):n){case "C":return ((r-32)*.5555555555555556).toFixed(o);case "K":return ((r-32)*.5555555555555556+273.15).toFixed(o);default:return r.toFixed(o)}return dm(r,n,o)};ne.register("temperature",(e,t,r)=>typeof e=="number"?dm(e,typeof t=="string"?t:"F",typeof r=="number"?r:0):null);ne.register("fahrenheit",(e,t)=>typeof e=="number"?sm(e,typeof t=="number"?t:0):null);ne.register("celsius",(e,t,r)=>typeof e=="number"?lm(e,typeof t=="boolean"?t:true,typeof r=="number"?r:0):null);ne.register("kelvin",(e,t,r)=>typeof e=="number"?cm(e,typeof t=="boolean"?t:true,typeof r=="number"?r:0):null);var f0=(e,t)=>!!(t.hideWhenNull&&e==null||t.hideWhenZero&&e===0),pm=e=>e?.toUpperCase()??"",mm=e=>e?.toLowerCase()??"",fm=e=>e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"",gm=e=>{if(!e)return "";let t=new Set(["a","an","the","and","but","or","for","nor","on","at","of","to","with","in","as","by"]);return e.toLowerCase().split(/\s+/).map((r,o)=>t.has(r)&&o!==0?r:r.charAt(0).toUpperCase()+r.slice(1)).join(" ")},bm=e=>e?e.split(/\s+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" "):"",xm=e=>e?e.charAt(0).toUpperCase()+e.slice(1):"",hm=e=>e?e.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase()).trim():"",ym=e=>e?e.toLowerCase().split("_").map(t=>xm(t)).join(" "):"",g0=e=>e?e.includes("_")?ym(e):e.toUpperCase()===e?xm(e.toLowerCase()):hm(e):"",aa=(e,t=16)=>{if(!e)return "";if(t<5||e.length<=t)return e;let r=t-3,o=Math.ceil(r/2),n=Math.floor(r/2);return `${e.slice(0,o)}...${e.slice(-n)}`},as=(e,t=8)=>e?e.length<=t?e:`...${e.slice(-t)}`:"",is=(e,t=16,r="...")=>e?e.length<=t?e:e.slice(0,t)+r:"",b0=e=>{if(!e)return "";let t=e.toString(),r=t.slice(-4),o=t.length-4;return o>0?"*".repeat(o)+r:t},vm=(e,t)=>{if(f0(e,t))return null;if(e==null)return t.nullText??null;let r=String(e);if(t.transform&&(Array.isArray(t.transform)?t.transform:[t.transform]).forEach(n=>{switch(n){case "uppercase":r=pm(r);break;case "lowercase":r=mm(r);break;case "capitalize":r=bm(r);break;case "titleCase":r=gm(r);break;case "sentenceCase":r=fm(r);break}}),t.truncate){let{length:o,position:n,ellipsis:a="..."}=t.truncate;switch(n){case "start":r=as(r,o);break;case "middle":r=aa(r,o);break;case "end":r=is(r,o,a);break}}return r};ne.register("uppercase",e=>pm(String(e)));ne.register("lowercase",e=>mm(String(e)));ne.register("sentenceCase",e=>fm(String(e)));ne.register("titleCase",e=>gm(String(e)));ne.register("capitalize",e=>bm(String(e)));ne.register("camelCaseToWords",e=>hm(String(e)));ne.register("snakeCaseToWords",e=>ym(String(e)));ne.register("enumToSentenceCase",e=>g0(String(e)));ne.register("truncateMiddle",(e,t)=>aa(String(e),typeof t=="number"?t:16));ne.register("truncateStart",(e,t)=>as(String(e),typeof t=="number"?t:8));ne.register("truncateEnd",(e,t,r)=>is(String(e),typeof t=="number"?t:16,typeof r=="string"?r:"..."));ne.register("secret",e=>b0(String(e)));var Xc=(e,t=0)=>{if(pe(e))return null;let r=e*1e3;return t===0?`${Math.round(r)} mV`:`${r.toFixed(t)} mV`},ss=(e,t=0)=>pe(e)?null:t===0?`${Math.round(e)} V`:`${e.toFixed(t)} V`,jc=(e,t=1)=>pe(e)?null:`${(e/1e3).toFixed(t)} kV`,x0=(e,t)=>{if(pe(e))return null;let r=Math.abs(e);return r>=1e3?jc(e,t??1):r<1?Xc(e,t??0):ss(e,t??0)},qc=(e,t)=>{if(t.hideWhenNull&&e==null||t.hideWhenZero&&e===0)return null;if(e==null)return t.nullText??null;let r=typeof e=="string"?parseFloat(e):Number(e);if(isNaN(r))return t.nullText??null;let o=t.decimals;if(t.unit)switch(t.unit){case "kV":return jc(r,o??1);case "mV":return Xc(r,o??0);case "V":return ss(r,o??0)}return t.autoScale!==false?x0(r,o):ss(r,o??0)};ne.register("voltage",qc);var FA=Xc,BA=ss,VA=jc;var h0=(e,t)=>{if(e==null)return t.nullText??null;if(t.hideWhenNull&&e===null)return null;let r=typeof e=="number"?e:Number(e);return Number.isNaN(r)?t.nullText??null:Jp(r,t.decimals??0)},Fr=(e,t)=>{switch(t.type){case "text":return vm(e,t);case "number":return jp(e,t);case "percentage":return h0(e,t);case "currency":return qp(e,t);case "date":return Qp(e,t);case "boolean":return Kp(e,t);case "energy":return Oc(e,t);case "power":return Kc(e,t);case "voltage":return qc(e,t);case "current":return Mc(e,t);case "resistance":return Jc(e,t);case "temperature":return um(e,t);case "distance":return $p(e,t);case "phone":return om(e,t);case "custom":{let r=t;return r.hideWhenNull&&e==null?null:e==null?r.nullText??null:r.formatter(e,r.options)}default:return e!=null?String(e):null}};var ia={power:"W",energy:"Wh",voltage:"V",current:"A",resistance:"\u03A9",distance:"m"},y0=new Set(["number","power","energy","voltage","current","resistance","temperature","distance","percentage"]);function Qc(e){if(!e)return null;switch(e.type){case "percentage":return "%";case "power":return e.unit??ia.power;case "energy":return e.unit??e.sourceUnit??ia.energy;case "voltage":return e.unit??ia.voltage;case "current":return e.unit??ia.current;case "resistance":return e.unit??ia.resistance;case "temperature":{let t=typeof e.unit=="string"?e.unit:"F";return t==="C"||t==="CELSIUS"?"\xB0C":t==="F"||t==="FAHRENHEIT"?"\xB0F":t==="K"||t==="KELVIN"?"K":t}case "distance":return e.unit??ia.distance;default:return null}}function Cm(e,t){if(!y0.has(t.type))return null;let r;if(typeof e=="number")r=e;else if(typeof e=="string"){let n=parseFloat(e);if(Number.isNaN(n))return null;r=n;}else return null;let o=Qc(t);if(o!==null){let n;if(t.type==="percentage")n=t;else if(t.type==="energy")n=t.unit?{...t,autoScale:false}:{...t,unit:t.sourceUnit??"Wh",autoScale:false};else if(t.type==="temperature")n={...t};else {let s=t.unit;n={...t,unit:s??o,autoScale:false};}let a=Fr(r,n);if(!a)return "";if(typeof a=="string"&&a.startsWith("device."))return null;let i=String(a);return i.endsWith(` ${o}`)?i.slice(0,-(o.length+1)):i.endsWith(o)?i.slice(0,-o.length):i}if(t.type==="number"){let n=Fr(r,t);return n?String(n):""}return String(r)}var e5=(e,t)=>({type:e,...t});function jt(...e){return e.filter(Boolean).join(" ")}var jr={displayXl:"text-display-xl",displayLg:"text-display-lg",displayMd:"text-display-md",displaySm:"text-display-sm",headingXl:"text-heading-xl",headingLg:"text-heading-lg",headingMd:"text-heading-md",headingSm:"text-heading-sm",bodyLg:"text-body-lg",bodyMd:"text-body-md",bodySm:"text-body-sm",labelLg:"text-label-lg",labelMd:"text-label-md",labelSm:"text-label-sm",code:"text-code",agent:"text-agent"};function pt(e,...t){return jt(jr[e],...t)}function ot(e,t){let r=forwardRef(({size:o=24,color:n="currentColor",className:a,mirrored:i,alt:s,...c},l)=>{let d=!!s||"aria-label"in c;return jsx("svg",{ref:l,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 256 256",fill:n,className:a,transform:i?"scale(-1, 1)":void 0,"aria-hidden":d?void 0:true,role:d?"img":void 0,"aria-label":s,...c,children:t})});return r.displayName=e,r}var ls=()=>jsxs(Fragment,{children:[jsx("path",{d:"M12 128h44M200 128h44",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"76",cy:"128",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("circle",{cx:"180",cy:"128",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"16"})]}),Sm=()=>jsx("path",{d:"M166 120 88 70",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),wm=()=>jsx("path",{d:"M162 122 92 128",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),Nm=()=>jsxs(Fragment,{children:[jsx("path",{d:"M112 85.7 A32 32 0 1 1 144 85.7",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"128",cy:"58",r:"8",fill:"currentColor",stroke:"none"})]}),S0=ot("TextureRecloser",jsxs(Fragment,{children:[jsx("rect",{x:"36",y:"36",width:"184",height:"184",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("text",{x:"128",y:"126",textAnchor:"middle",dominantBaseline:"central",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"140",fontWeight:"700",fill:"currentColor",stroke:"none",children:"R"})]})),w0=ot("TextureFuse",jsx("path",{d:"M20 128h72q18 -84 36 0q18 84 36 0h72",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})),N0=ot("TextureBreaker",jsxs(Fragment,{children:[jsx("rect",{x:"36",y:"36",width:"184",height:"184",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("text",{x:"128",y:"126",textAnchor:"middle",dominantBaseline:"central",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"140",fontWeight:"700",fill:"currentColor",stroke:"none",children:"B"})]})),k0=ot("TextureSource",jsxs(Fragment,{children:[jsx("path",{d:"M4 128h40M212 128h40",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"128",cy:"128",r:"84",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("path",{d:"M92 128q18 -84 36 0q18 84 36 0",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})]})),T0=ot("TextureCapacitor",jsx(Fragment,{children:jsx("path",{d:"M4 128h106M146 128h106M110 72v112M146 72v112",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"})})),P0=ot("TextureRegulator",jsxs(Fragment,{children:[jsx("circle",{cx:"128",cy:"128",r:"92",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("text",{x:"128",y:"126",textAnchor:"middle",dominantBaseline:"central",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"128",fontWeight:"700",fill:"currentColor",stroke:"none",children:"V"})]})),R0=ot("TextureSwitch",jsxs(Fragment,{children:[jsx(ls,{}),jsx(Sm,{})]})),M0=ot("TextureSwitchClosed",jsxs(Fragment,{children:[jsx(ls,{}),jsx(wm,{})]})),D0=ot("TextureSectionalizerOpen",jsxs(Fragment,{children:[jsx(ls,{}),jsx(Sm,{}),jsx(Nm,{})]})),L0=ot("TextureSectionalizerClosed",jsxs(Fragment,{children:[jsx(ls,{}),jsx(wm,{}),jsx(Nm,{})]})),E0=ot("TextureTransformer",jsxs(Fragment,{children:[jsx("path",{d:"M40 64H88A22 22 0 0 1 88 108A22 22 0 0 1 88 152A22 22 0 0 1 88 196H40",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M216 64H168A22 22 0 0 0 168 108A22 22 0 0 0 168 152A22 22 0 0 0 168 196H216",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})]})),sa={1:[128],2:[110,146],3:[92,128,164]},Zc=e=>jsx("path",{d:`M24 ${e}h208`,fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"},e),_c=e=>jsx("path",{d:`M24 ${e}h208`,fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",pathLength:100,strokeDasharray:"20 20"},e),A0=ot("TextureSinglePhaseOverheadLine",jsx(Fragment,{children:sa[1].map(Zc)})),I0=ot("TextureTwoPhaseOverheadLine",jsx(Fragment,{children:sa[2].map(Zc)})),F0=ot("TextureThreePhaseOverheadLine",jsx(Fragment,{children:sa[3].map(Zc)})),B0=ot("TextureSinglePhaseUndergroundLine",jsx(Fragment,{children:sa[1].map(_c)})),V0=ot("TextureTwoPhaseUndergroundLine",jsx(Fragment,{children:sa[2].map(_c)})),z0=ot("TextureThreePhaseUndergroundLine",jsx(Fragment,{children:sa[3].map(_c)})),O0=ot("TextureSupportStructure",jsx("circle",{cx:"128",cy:"128",r:"40",fill:"currentColor",stroke:"none"})),la={TextureRecloser:S0,TextureFuse:w0,TextureBreaker:N0,TextureSource:k0,TextureCapacitor:T0,TextureRegulator:P0,TextureSwitch:R0,TextureSwitchClosed:M0,TextureSectionalizerOpen:D0,TextureSectionalizerClosed:L0,TextureTransformer:E0,TextureSinglePhaseOverheadLine:A0,TextureTwoPhaseOverheadLine:I0,TextureThreePhaseOverheadLine:F0,TextureSinglePhaseUndergroundLine:B0,TextureTwoPhaseUndergroundLine:V0,TextureThreePhaseUndergroundLine:z0,TextureSupportStructure:O0};if(process.env.NODE_ENV==="development")for(let e of Object.keys(la))e in km&&console.error(`Custom icon "${e}" collides with a Phosphor icon of the same name. Rename it (use the "Texture" prefix) to keep the icon namespace unambiguous.`);var ca={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},V=memo(({name:e,size:t="md",color:r,weight:o="regular",className:n,ariaLabel:a,...i})=>{let s=la[e]??km[e];if(!s)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react or the custom icon registry`),null;let c=typeof t=="string"&&t in ca?ca[t]:t,l=twMerge("inline-block flex-shrink-0",!r&&"text-current",n);return jsx(s,{...i,size:c,color:r,weight:o,className:l,"aria-label":a||`${e} icon`,"data-testid":`icon-${e}`})});V.displayName="Icon";var H0=memo(({variant:e="subtle",shape:t="square",containerSize:r,containerClassName:o,size:n="md",className:a,name:i,color:s,weight:c,ariaLabel:l,ref:d,...u})=>{let m=typeof n=="string"&&n in ca?ca[n]:n,p=r?typeof r=="string"&&r in ca?ca[r]:r:m*1.75,g=twMerge("inline-flex items-center justify-center flex-shrink-0",t==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-background-muted",e==="solid"&&"bg-action-brand text-[color:var(--color-action-brand-text)]",e==="outline"&&"border-2 border-current",o);return jsx("div",{className:g,style:{width:p,height:p},children:jsx(V,{...u,name:i,size:n,color:s,weight:c,className:a,ariaLabel:l})})});H0.displayName="IconWithContainer";function sr({transparent:e=false,className:t,children:r,...o}){return jsx(ModalOverlay,{...o,className:composeRenderProps(t,(n,a)=>twMerge("fixed inset-0 z-50","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",e?"bg-transparent":["bg-gradient-to-br from-background-modal/20 via-background-modal/15 to-background-modal/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-background-modal/15"].join(" "),a.isEntering&&["animate-in fade-in","duration-300 ease-out"].join(" "),a.isExiting&&["animate-out fade-out","duration-200 ease-in"].join(" "),n)),children:r})}function Z0({isEntering:e,isExiting:t,className:r="",disableGroup:o=false}){let n=[!o&&"group","bg-background-surface","forced-colors:bg-[Canvas]","shadow-lg","rounded-[var(--control-border-radius)]","bg-clip-padding","border","border-border-default","outline-none"].filter(Boolean).join(" "),a=e?["animate-in","fade-in","placement-bottom:slide-in-from-top-1","placement-top:slide-in-from-bottom-1","placement-left:slide-in-from-right-1","placement-right:slide-in-from-left-1","ease-out","duration-200"].join(" "):"",i=t?["animate-out","fade-out","placement-bottom:slide-out-to-top-1","placement-top:slide-out-to-bottom-1","placement-left:slide-out-to-right-1","placement-right:slide-out-to-left-1","ease-in","duration-150"].join(" "):"";return [n,a,i,r].filter(Boolean).join(" ")}function nt({children:e,showArrow:t=false,withBackdrop:r=false,className:o,isDismissable:n=true,disableGroup:a=false,...i}){let c=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",l=t?12:8;l=c?l-6:l;let d=jsxs(Popover,{offset:l,...i,className:composeRenderProps(o,(u,m)=>Z0({...m,className:u,disableGroup:a})),children:[t&&jsx(OverlayArrow,{children:jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",className:"block fill-background-surface stroke-border-default stroke-1 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L6 6 L12 0"})})}),e]});return r?jsx(sr,{isDismissable:n,children:jsx(Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:n,children:d})}):d}function cs(e=true){let[t,r]=useState(null);return useEffect(()=>{if(!e){r(null);return}let o=typeof window<"u"?window.visualViewport:null;if(!o)return;let n=()=>{let a=Math.max(0,window.innerHeight-o.height-(o.offsetTop??0));r({height:o.height,keyboardOffset:a});};return n(),o.addEventListener("resize",n),o.addEventListener("scroll",n),()=>{o.removeEventListener("resize",n),o.removeEventListener("scroll",n);}},[e]),t}var rC={"--color-brand-primary":["--color-action-brand","--color-text-link-default","--action-brand-background"],"--color-brand-dark":["--color-action-brand-hover","--color-text-link-hover","--action-brand-hover"],"--color-action-brand":["--color-text-link-default","--action-brand-background"],"--color-action-brand-hover":["--color-text-link-hover","--action-brand-hover"]};function Rm(e){let t={...e};for(let[r,o]of Object.entries(rC))if(e[r])for(let n of o)e[n]||(t[n]=e[r]);return t}function Mm(e){return e.replace(/[{}<>]/g,"")}function Dm(e){return Object.entries(e).map(([t,r])=>`${Mm(t)}: ${Mm(r)};`).join(" ")}function Em({variables:e,darkVariables:t,children:r}){let n=useId().replace(/:/g,""),a=e&&Object.keys(e).length>0,i=t&&Object.keys(t).length>0;if(!a&&!i)return jsx(Fragment,{children:r});let s=a?Rm(e):null,c=i?Rm(t):null,l=s?`[data-brand-scope="${n}"] { ${Dm(s)} }`:"",d=c?`.theme-dark [data-brand-scope="${n}"] { ${Dm(c)} }`:"",u=[l,d].filter(Boolean).join(`
|
|
2
|
-
`);return jsxs(Fragment,{children:[jsx("style",{dangerouslySetInnerHTML:{__html:u}}),jsx("div",{"data-brand-scope":n,children:r})]})}var da=new Map,nC=8;function aC(e){if(!e.startsWith("var("))return e;let t=e.slice(4,e.lastIndexOf(")")).trim(),r=t.indexOf(",");return (r===-1?t:t.slice(0,r)).trim()}var Nt=(e,t="#000000")=>typeof window>"u"?t:Am(e,t,0);function Am(e,t,r){if(r>nC)return t;let o=e.startsWith("var(")?aC(e):e.startsWith("--")?e:`--${e}`;if(!e.startsWith("--")&&!e.startsWith("var(")&&!o.startsWith("--color-")&&(o=`--color-${o.slice(2)}`),da.has(o))return da.get(o);try{let n=document.body||document.documentElement,i=getComputedStyle(n).getPropertyValue(o).trim();if(i){if(i.startsWith("var(")){let l=Am(i,t,r+1);return da.set(o,l),l}return da.set(o,i),i}let s=document.createElement("div");s.style.color=`var(${o})`,document.body.appendChild(s);let c=getComputedStyle(s).color;return document.body.removeChild(s),c&&c!=="rgb(0, 0, 0)"?(da.set(o,c),c):t}catch(n){return console.warn(`Failed to resolve color for ${e}:`,n),t}}var ds=()=>{da.clear();},sn=()=>{let e=[];for(let t=1;t<=12;t++){let r=Nt(`--color-viz-categorical-${t}`,"");r&&e.push(r);}return e.length===0?Im():e},Im=()=>["#5424db","#d92361","#e86a00","#5d89ff","#9a47e2","#f24cb8","#0ba286","#9c28af","#036e45","#52a119","#ff513d","#046691"],Qa=()=>Nt("--color-viz-default","#444ae1"),iC=(e,t)=>{let r={},o=sn();return e.forEach((n,a)=>{t&&t[n]?r[n]=t[n]:r[n]=o[a%o.length];}),r},Fm=e=>{let t=e.match(/\d+/g);if(!t||t.length<3)return true;let[r,o,n]=t.map(Number);return (.299*r+.587*o+.114*n)/255>.5},sC=e=>Fm(e)?Nt("--color-text-primary","#333333"):Nt("--color-text-inverse","#ffffff"),Bm=(e,t)=>{if(!e||typeof e!="object")return console.warn("[Colors] Invalid GeoJSON data provided to extractUniqueValues"),[];if(!("type"in e)||e.type!=="FeatureCollection"&&e.type!=="Feature")return console.warn("[Colors] Data is not valid GeoJSON (missing type or invalid type)"),[];let r=new Set,o="features"in e?e.features:[e];if(!Array.isArray(o)||o.length===0)return console.warn("[Colors] No features found in GeoJSON data"),[];let n=0;return o.forEach(a=>{if(!(!a||typeof a!="object")&&a.properties&&t in a.properties){n++;let i=a.properties[t];i!=null&&r.add(i);}}),n===0&&console.warn(`[Colors] Property "${t}" not found on any features. Available properties: ${o[0]?.properties?Object.keys(o[0].properties).join(", "):"none"}`),Array.from(r).sort()},td=e=>{let t=sn(),r={};return e.forEach((o,n)=>{r[o]=t[n%t.length];}),r};var rd=(e,t)=>{if(!e||typeof e!="object")return console.warn("[Colors] Invalid GeoJSON data provided to extractNumericValues"),[];if(!("type"in e)||e.type!=="FeatureCollection"&&e.type!=="Feature")return console.warn("[Colors] Data is not valid GeoJSON (missing type or invalid type)"),[];let r="features"in e?e.features:[e];if(!Array.isArray(r)||r.length===0)return console.warn("[Colors] No features found in GeoJSON data"),[];let o=new Set,n=0;return r.forEach(a=>{if(!(!a||typeof a!="object")&&a.properties&&t in a.properties){n++;let i=a.properties[t];typeof i=="number"&&!isNaN(i)&&o.add(i);}}),n===0&&console.warn(`[Colors] Property "${t}" not found on any features. Available properties: ${r[0]?.properties?Object.keys(r[0].properties).join(", "):"none"}`),Array.from(o).sort((a,i)=>a-i)},od=e=>e.length===0?(console.warn("[Colors] Cannot calculate bounds from empty array"),{min:0,max:1}):{min:e[0],max:e[e.length-1]},Vm=(e,t)=>{if(typeof t=="number")return t;if(e.length===0)return console.warn("[Colors] Cannot calculate center from empty array, defaulting to 0"),0;if(t==="median"){let r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}return e.reduce((r,o)=>r+o,0)/e.length},nd=(e="viridis")=>{let o=`viz-sequential-${{redYellowGreen:"red-yellow-green"}[e]||e}`,n=[];for(let a=1;a<=10;a++){let i=`${o}-${a}`,s=Nt(i);n.push(s);}return n},ad=(e="redYellowBlue")=>{let o=`viz-diverging-${{orangeYellowSeafoam:"orange-yellow-seafoam",redYellowBlue:"red-yellow-blue",redBlue:"red-blue"}[e]||e}`,n=[];for(let a=1;a<=10;a++){let i=`${o}-${a}`,s=Nt(i);n.push(s);}return n},Za=(e,t,r,o="viridis")=>{let n=nd(o);if(e<=t)return n[0];if(e>=r)return n[n.length-1];if(t===r)return n[Math.floor(n.length/2)];let i=(e-t)/(r-t)*(n.length-1),s=Math.floor(i);return n[s]},_a=(e,t,r,o,n="redYellowBlue")=>{let a=ad(n),i=4;if(e<=t)return a[0];if(e>=r)return a[a.length-1];if(e===o||t===r)return a[i];if(e<o){let c=(e-t)/(o-t)*i,l=Math.floor(c);return a[Math.min(l,i)]}else {let s=(e-o)/(r-o),c=i+s*(a.length-1-i),l=Math.floor(c);return a[Math.min(l,a.length-1)]}};var id=createContext({mode:"system",colorMode:"light",isDarkTheme:false,toggleTheme:()=>{}}),It=()=>useContext(id);function pC(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Hm(){if(typeof window>"u")return "system";let e=localStorage.getItem("colorModePreference");return e==="light"||e==="dark"||e==="system"?e:"system"}function Wm(e){return e==="system"?pC():e}var Um=({children:e})=>{let[t,r]=useState(Hm),[o,n]=useState(()=>Wm(Hm())),a=o==="dark",i=useCallback(c=>{c==="dark"?(document.documentElement.classList.add("theme-dark"),document.body.classList.add("theme-dark")):(document.documentElement.classList.remove("theme-dark"),document.body.classList.remove("theme-dark")),ds();},[]);useEffect(()=>{ds();let c=Wm(t);if(n(c),i(c),t==="system"){let l=window.matchMedia("(prefers-color-scheme: dark)"),d=u=>{let m=u.matches?"dark":"light";n(m),i(m);};return l.addEventListener("change",d),()=>{l.removeEventListener("change",d);}}},[t,i]);let s=useCallback(()=>{r(c=>{let l=c==="system"?"light":c==="light"?"dark":"system";return localStorage.setItem("colorModePreference",l),l});},[]);return jsx(id.Provider,{value:{mode:t,colorMode:o,isDarkTheme:a,toggleTheme:s},children:e})};function cn(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function ln(e,t){return cn(e)?t.format(e):""}function Km(e){if(!cn(e.start)||!cn(e.end))return ()=>"";if((e.end.getTime()-e.start.getTime())/(1e3*60*60)<=720){let i=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});return s=>ln(s,i)}let r=e.start.getFullYear(),o=e.end.getFullYear(),n=r!==o,a=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...n&&{year:"numeric"}});return i=>ln(i,a)}var mC=864e5;function Ym(e,t){let r=t?.compact??false,o=e<5*mC,n=a=>{let i=a.getHours(),s=i>=12?"PM":"AM";return {displayHour:i%12||12,period:s}};return a=>{if(!cn(a))return "";let i=a.getHours()===0&&a.getMinutes()===0&&a.getSeconds()===0&&a.getMilliseconds()===0;if(i&&a.getDate()===1)return a.getMonth()===0?String(a.getFullYear()):a.toLocaleDateString("en",{month:"short"});if(i){let d=a.getDate();if(o){let u=a.toLocaleDateString("en",{weekday:"short"});return r?`${u.charAt(0)}${d}`:`${u} ${d}`}return r?`${a.getMonth()+1}/${d}`:`${a.toLocaleDateString("en",{month:"short"})} ${d}`}let{displayHour:s,period:c}=n(a);if(a.getMinutes()===0&&a.getSeconds()===0)return r?`${s}${c.charAt(0).toLowerCase()}`:`${s} ${c}`;let l=String(a.getMinutes()).padStart(2,"0");return r?`${s}:${l}${c.charAt(0).toLowerCase()}`:`${s}:${l} ${c}`}}function sd(e,t){if(!cn(e.start)||!cn(e.end))return ()=>"";let r=(e.end.getTime()-e.start.getTime())/(1e3*60*60),o=t?.compact??false,n=l=>d=>cn(d)?l(d):"";if(r<=24){if(o)return n(d=>{let u=d.getHours(),m=u>=12?"pm":"am";return `${u%12||12}${m}`});let l=new Intl.DateTimeFormat("en",{hour:"numeric",minute:"2-digit"});return d=>ln(d,l)}if(r<=48){if(o)return n(d=>{let u=d.getMonth()+1,m=d.getDate(),p=d.getHours(),g=p>=12?"p":"a",f=p%12||12;return `${u}/${m} ${f}${g}`});let l=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",hour:"numeric"});return d=>ln(d,l)}if(r<=168){if(o)return n(d=>{let u=d.getDate();return `${d.toLocaleDateString("en",{weekday:"short"}).charAt(0)}${u}`});let l=new Intl.DateTimeFormat("en",{weekday:"short",day:"numeric"});return d=>ln(d,l)}if(r<=720){if(o)return n(d=>{let u=d.getMonth()+1,m=d.getDate();return `${u}/${m}`});let l=new Intl.DateTimeFormat("en",{month:"short",day:"numeric"});return d=>ln(d,l)}let a=e.start.getFullYear(),i=e.end.getFullYear(),s=a!==i;if(o)return n(l=>{let d=l.getMonth()+1,u=l.getDate(),m=s?`/${l.getFullYear().toString().slice(-2)}`:"";return `${d}/${u}${m}`});let c=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",...s&&{year:"numeric"}});return l=>ln(l,c)}function Ye(e=false){return `${e?"outline outline-1 outline-border-input data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2":"outline-none data-[focus-visible]:outline data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2"}`}function ke(e,t){return composeRenderProps(e,r=>twMerge(t,r))}var We={sm:{text:"text-[length:var(--control-text-sm)]",height:"h-[var(--control-sm-height)]",padding:"px-[var(--control-padding-sm)]",paddingY:"py-[var(--control-gap-sm)]",gap:"gap-[var(--control-gap-sm)]"},md:{text:"text-[length:var(--control-text-md)]",height:"h-[var(--control-md-height)]",padding:"px-[var(--control-padding-md)]",paddingY:"py-[var(--control-gap-md)]",gap:"gap-[var(--control-gap-md)]"},lg:{text:"text-[length:var(--control-text-lg)]",height:"h-[var(--control-lg-height)]",padding:"px-[var(--control-padding-lg)]",paddingY:"py-[var(--control-gap-lg)]",gap:"gap-[var(--control-gap-lg)]"},xl:{text:"text-[length:var(--control-text-xl)]",height:"h-[var(--control-xl-height)]",padding:"px-[var(--control-padding-xl)]",paddingY:"py-[var(--control-gap-xl)]",gap:"gap-[var(--control-gap-xl)]"}};var hC="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",yC="bg-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",vC={primary:yC,secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border-2 border-border-muted hover:bg-action-secondary-hover forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-primary hover:bg-text-primary/5 forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace]",destructive:"bg-transparent text-feedback-error-text border-2 border-border-muted hover:bg-feedback-error-background/50 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[Mark]",link:"!text-action-primary hover:text-action-primary/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-primary hover:bg-background-hover hover:text-text-primary forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},Xm={full:"w-full",default:"w-fit"},CC="opacity-50 cursor-not-allowed pointer-events-none",SC="opacity-100 cursor-pointer",wC={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},NC={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function kC(e){return !e||e==="default"||e==="brand"?"primary":e}function TC(e){let{variant:t="primary",size:r="md",isDisabled:o,fullWidth:n=false,isLoading:a=false}=e,i=kC(t),s=i==="unstyled"?"":`${hC} ${vC[i]}`;i!=="unstyled"&&(s+=` ${We[r].text} ${We[r].height} ${We[r].padding} ${We[r].gap}`),o||a?s+=` ${CC}`:s+=` ${SC}`,n?s+=` ${Xm.full}`:s+=` ${Xm.default}`;let c=i==="primary"?"focus-visible:outline-action-primary":void 0;return [s,Ye(),c].filter(Boolean).join(" ")}function ee(e){let{icon:t,children:r,isLoading:o=false,loadingText:n,loadingIndicator:a,size:i="md",iconPosition:s="left",iconWeight:c,href:l,className:d,badgeNumber:u,badgeVariant:m="primary",badgePosition:p="top-right",style:g,target:f,rel:x,...b}=e,h=t?jsx(V,{name:t,size:i,weight:c}):null,y=jsxs(Fragment,{children:[s==="left"&&h,typeof r=="function"?null:r,s==="right"&&h]}),v=jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a||jsx(V,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:y}),n&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n})]}),S=(u??0)>0,N=twMerge(TC(e),d),w=l?{href:l,target:f,rel:x,...b}:{};if(l){let{onPress:k,onPressStart:P,onPressEnd:I,onPressChange:D,onPressUp:L,onAuxClick:R,onContextMenu:B,onDoubleClick:Y,...H}=b;Object.assign(w,H);}let M=l?jsx(Link,{...w,...o&&{"aria-busy":true},style:S?void 0:g,className:N,children:o?v:typeof r=="function"?(function(k){return jsxs(Fragment,{children:[s==="left"&&h,r(k),s==="right"&&h]})}):y}):jsx(Button,{...b,...o&&{"aria-busy":true},style:S?void 0:g,className:N,children:o?v:typeof r=="function"?(function(k){return jsxs(Fragment,{children:[s==="left"&&h,r(k),s==="right"&&h]})}):y});return S?jsxs("div",{className:twMerge("relative flex",d),style:g,children:[M,jsx("span",{className:`absolute ${wC[p]} flex h-5 w-5 items-center justify-center rounded-full ${NC[m]} text-xs font-medium`,"aria-label":`${u} items`,children:u})]}):M}function cd({action:e,defaultVariant:t,defaultSize:r="lg"}){let o=!!e.formId;return jsx(ee,{type:o?"submit":"button",form:o?e.formId:void 0,size:e.size||r,variant:e.variant||t,onPress:o?void 0:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})}function Eo({primaryAction:e,secondaryAction:t,tertiaryAction:r,footerContent:o}){let n=e||t||r;return !n&&!o?null:jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${o?"h-28":""}`,children:[o&&jsx("div",{className:"flex h-10 justify-center",children:o}),n&&jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsx("div",{children:r&&jsx(cd,{action:r,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[t&&jsx(cd,{action:t,defaultVariant:"secondary"}),e&&jsx(cd,{action:e,defaultVariant:"primary"})]})]})]})}var PC={heading:{sm:jr.headingSm,md:jr.headingMd,lg:jr.headingLg,xl:jr.headingXl},display:{sm:jr.displaySm,md:jr.displayMd,lg:jr.displayLg,xl:jr.displayXl}},RC={page:"h-16 leading-[62px]"};function qt({tag:e="h1",variant:t="heading",size:r="lg",height:o,className:n="",children:a}){let i=r==="xs"?"sm":r,s=PC[t][i],c=o?RC[o]:"";return jsx(e,{className:jt(s,"text-text-primary",c,n),children:a})}var zt=({title:e,onClose:t,hideCloseIcon:r=false,titleAlign:o="left",hasBackArrow:n=false,onBack:a,headerContent:i})=>jsxs("div",{className:twMerge("relative flex h-16 w-full flex-shrink-0 items-center justify-between border-b px-6",e&&"border-b",o==="center"?"justify-center":""),children:[n&&jsx(ee,{variant:"icon",onPress:a,className:"absolute left-6","aria-label":"Go back",children:jsx(V,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(qt,{size:"xs",children:e}),t&&!r&&jsx(ee,{variant:"icon",onPress:t,"aria-label":"Close dialog",children:jsx(V,{name:"X","data-testid":"close-button"})})]})]});var K=({width:e,height:t,variant:r="rect",animation:o="pulse",gradient:n=false,flex:a=false,stack:i,responsive:s,delay:c=0,adjustAnimationSpeedBasedOnWidth:l=false,ariaLabel:d,className:u,"data-testid":m})=>{let[p,g]=useState(c===0);if(useEffect(()=>{if(c>0){let S=setTimeout(()=>g(true),c);return ()=>clearTimeout(S)}},[c]),!p)return null;let f=n?"bg-gradient-to-r from-[var(--color-skeleton-base)] via-[var(--color-skeleton-highlight)] to-[var(--color-skeleton-base)]":"bg-[var(--color-skeleton-base)]",x=l&&e?(()=>{let S=typeof e=="number"?e:parseFloat(String(e));return isNaN(S)?"":`animation-duration-[${Math.max(.8,S/100)}s]`})():"",b=o==="pulse"?`animate-pulse ${x}`:o==="wave"?`relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-[var(--color-skeleton-wave)] before:to-transparent before:animate-wave ${x}`:"",h="rounded-sm";r==="circle"&&(h="rounded-full"),r==="text"&&(h="h-4 w-full rounded-sm");let y=a?"flex-1 min-w-0":"",v=s?Object.entries(s).map(([S,N])=>`${S}:w-[${N}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":m,children:i.map((S,N)=>jsx("div",{className:twMerge(f,b,h,y,v,u),style:{width:S,height:t}},N))}):jsx("div",{className:twMerge(f,b,h,y,v,u),style:{width:e,height:t},role:"presentation","aria-hidden":!d,"aria-label":d??void 0,"data-testid":m})},Qm=({count:e=1,children:t,className:r,"data-testid":o})=>jsx("div",{className:r,"data-testid":o,children:Array.from({length:e}).map((n,a)=>jsx("div",{children:t},a))});var IC={outlined:"bg-background-surface border border-border-default",elevated:"bg-background-surface border-0 shadow-md",filled:"bg-background-muted border-0",ghost:"bg-transparent border-0 shadow-none"},FC="rounded-lg",ud={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},BC={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function Ge({variant:e="outlined",className:t,children:r,isLoading:o=false,layout:n="default"}){return jsx("div",{className:twMerge("w-full overflow-hidden",IC[e],FC,n==="flex"&&"flex flex-col",t),"data-testid":"card",children:o?jsx(K,{width:"100%",height:"100%",className:"rounded-none"}):r})}function pd({title:e,subtitle:t,actions:r,className:o,isLoading:n=false}){return n?jsxs("div",{className:twMerge("p-6 pb-4",o),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx(K,{width:120,height:20}),jsx(K,{width:24,height:24})]}),t&&jsx(K,{width:200,height:16})]}):!e&&!t&&!r?null:jsx("div",{className:twMerge("p-6 pb-4",o),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsx("div",{className:"mb-1",children:typeof e=="string"?jsx(qt,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),t&&jsx("div",{className:pt("bodySm","text-text-secondary"),children:t})]}),r&&jsx("div",{className:"flex-shrink-0",children:r})]})})}function md({src:e,alt:t,aspectRatio:r="auto",className:o,children:n,isLoading:a=false}){return a?jsx("div",{className:twMerge("bg-background-muted",ud[r],o),children:jsx(K,{width:"100%",height:"100%"})}):n?jsx("div",{className:twMerge("overflow-hidden",ud[r],o),children:n}):e?jsx("div",{className:twMerge("overflow-hidden",ud[r],o),children:jsx("img",{src:e,alt:t||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function fd({className:e,children:t,isLoading:r=false,fill:o=false}){let a=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return r?jsx("div",{className:twMerge(a,o&&"flex-1 flex flex-col min-h-0",e),children:jsxs("div",{className:"space-y-2",children:[jsx(K,{width:"100%",height:16}),jsx(K,{width:"80%",height:16}),jsx(K,{width:"60%",height:16})]})}):t?jsx("div",{className:twMerge("px-6 py-4 text-text-primary",o&&"flex-1 flex flex-col min-h-0",e),children:t}):null}function gd({className:e,children:t,align:r="end",isLoading:o=false}){return o?jsxs("div",{className:twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsx(K,{width:80,height:32}),jsx(K,{width:60,height:32})]}):t?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",BC[r],e),children:t}):null}Ge.Header=pd;Ge.Media=md;Ge.Content=fd;Ge.Footer=gd;var Vr=class extends Component{constructor(){super(...arguments);Xa(this,"state",{hasError:false});Xa(this,"handleRetry",()=>{this.setState({hasError:false,error:void 0}),typeof window<"u"&&window.location.reload();});}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,o){console.error("Error Boundary caught an error:",r,o);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxs(Ge,{children:[this.props.title&&jsx(Ge.Header,{title:this.props.title}),jsx(Ge.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-action-default px-4 py-2 text-[color:var(--color-action-default-text)] hover:bg-action-default-hover",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var HC=.3,WC=.5;function at({children:e,title:t,headerContent:r,titleAlign:o="left",hideCloseIcon:n=false,hasBackArrow:a=false,onBack:i,isOpen:s,onClose:c,isDismissable:l=true,transparentOverlay:d=false,primaryAction:u,secondaryAction:m,footerContent:p,maxHeight:g="80vh",height:f,maxWidth:x="640px",contentPadding:b=true,showHandle:h=true,animationVariant:y="scale",className:v}){let[S,N]=useState(false),[w,M]=useState(0),[k,P]=useState(false),I=cs(s),D=I?.height??null,L=I?.keyboardOffset??0,R=useRef(null),B=useRef(null),Y=useRef(null),H=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let E=setTimeout(()=>{N(true),setTimeout(()=>N(false),600);},400);return ()=>clearTimeout(E)}},[s]),useEffect(()=>{s||(M(0),P(false),H.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),useEffect(()=>{let E=B.current;if(!E||!s)return;let O=null,A=C=>{let F=C.target;F&&["INPUT","TEXTAREA","SELECT"].includes(F.tagName)&&(O&&clearTimeout(O),O=setTimeout(()=>{F.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return E.addEventListener("focusin",A),()=>{E.removeEventListener("focusin",A),O&&clearTimeout(O);}},[s]);let W=useCallback(E=>{l&&(E.pointerType!=="touch"&&E.pointerType!=="pen"||(Y.current&&(clearTimeout(Y.current),Y.current=null),H.current={isDragging:true,startY:E.clientY,startTime:Date.now(),pointerId:E.pointerId},P(false),E.currentTarget.setPointerCapture(E.pointerId)));},[l]),Z=useCallback(E=>{let{isDragging:O,startY:A,pointerId:C}=H.current;if(!O||E.pointerId!==C)return;let F=E.clientY-A;M(Math.max(0,F));},[]),q=useCallback(E=>{let{isDragging:O,startY:A,startTime:C,pointerId:F}=H.current;if(!O||E.pointerId!==F)return;let z=E.clientY-A,G=Date.now()-C,oe=z/G;H.current={isDragging:false,startY:0,startTime:0,pointerId:null};let te=(R.current?.getBoundingClientRect().height??0)*HC;(z>te||oe>WC&&z>50)&&l?(c?.(),M(0)):(P(true),M(0),Y.current=setTimeout(()=>{P(false),Y.current=null;},200));},[l,c]);if(!s)return null;let Q=t||r,T=u||m||p;return jsx(Vr,{children:jsx(sr,{isOpen:s,onOpenChange:E=>{E||c?.();},isDismissable:l,transparent:d,style:{paddingBottom:L>0?`${L}px`:void 0,transition:"padding-bottom 0.25s ease-out"},className:"flex items-end justify-center p-0 sm:p-4",children:jsx(Modal,{className:"w-full max-w-full p-0 sm:p-2 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:l,children:jsx("div",{ref:R,className:twMerge("w-full",k&&"transition-transform duration-200"),style:{transform:w>0?`translateY(${w}px)`:void 0},children:jsxs(Dialog,{className:twMerge("relative flex w-full flex-col overflow-hidden","bg-background-surface","shadow-2xl shadow-black/30 dark:shadow-black/60","border-t border-x border-border-default/40","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0 focus:shadow-none","origin-bottom",y==="scale"?"animate-[tray-enter-scale_400ms_cubic-bezier(0.32,0.72,0,1)]":"animate-[tray-enter_400ms_cubic-bezier(0.32,0.72,0,1)]",y==="scale"?"data-[exiting]:animate-[tray-exit-scale_250ms_cubic-bezier(0.32,0,0.67,0)]":"data-[exiting]:animate-[tray-exit_250ms_cubic-bezier(0.32,0,0.67,0)]",v),style:{maxWidth:x,...f?{height:f}:{maxHeight:/\d/.test(g)?D!==null?`min(${g}, ${Math.max(D-8,0)}px, 100dvh)`:`min(${g}, 100dvh)`:g}},children:[h&&jsx("div",{className:"absolute top-0 left-0 right-0 h-8 z-10 flex justify-center items-start pt-2 touch-none cursor-grab active:cursor-grabbing",onPointerDown:W,onPointerMove:Z,onPointerUp:q,onPointerCancel:q,children:jsx("div",{className:twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",S&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),Q&&(a?jsx(zt,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n||!c,hasBackArrow:true,onBack:i??(()=>{}),onClose:c||(()=>{})}):jsx(zt,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n||!c,onClose:c||(()=>{})})),jsx("div",{ref:B,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",b?"p-4":"p-0"),children:e}),T&&jsx(Eo,{primaryAction:u,secondaryAction:m,footerContent:p})]})})})})})}at.displayName="Tray";function ma({children:e,items:t,className:r,align:o="left",textAlign:n="left",size:a="md",onAction:i,header:s,footer:c,useMobileTray:l=true,popoverClassName:d}){let[u,m]=useState(false),{isMobile:p}=Jt();if(l&&p){let f=Oe__default.isValidElement(e)?Oe__default.cloneElement(e,{onPress:()=>m(true)}):e,h=(y=>{if(typeof y=="string")return y;if(Oe__default.isValidElement(y)){let v=y.props;if(typeof v.children=="string")return v.children;if(Array.isArray(v.children))return v.children.find(N=>typeof N=="string")||""}return ""})(e)||"Actions";return jsxs(Fragment,{children:[jsx("div",{className:r,children:f}),jsx(at,{isOpen:u,onClose:()=>m(false),title:h,contentPadding:false,headerContent:s,footerContent:c,children:jsx("div",{className:"flex flex-col",children:t.map(y=>{let v=y.href&&!y.disabled?"a":"button";return jsxs(v,{...y.href&&!y.disabled?{href:y.href}:{},onClick:()=>{y.disabled||(y.onAction?y.onAction():i?.(y),m(false));},disabled:y.disabled,"data-testid":y.testId,className:twMerge("flex w-full items-center text-start transition-colors",!y.noPadding&&"px-6 py-3","border-b border-border-muted last:border-0",y.variant==="destructive"?"text-feedback-error-text hover:bg-feedback-error-background active:bg-feedback-error-background/80":"text-text-primary hover:bg-background-hover active:bg-background-hover/80",y.disabled&&"opacity-50 cursor-not-allowed"),children:[y.iconName&&jsx(V,{name:y.iconName,size:20,className:"mr-3 flex-shrink-0"}),jsx("div",{className:"flex flex-1 flex-col",children:y.render?y.render():jsxs(Fragment,{children:[jsx("span",{className:y.subtitle?"font-medium":"",children:y.name}),y.subtitle&&jsx("span",{className:"text-sm text-text-secondary",children:y.subtitle})]})})]},y.id)})})})]})}return jsx("div",{className:r,children:jsxs(MenuTrigger,{children:[e,jsx(nt,{className:twMerge("w-fit min-w-[180px] overflow-auto rounded-[var(--control-border-radius)] border border-border-default","bg-background-surface shadow-lg","animate-in fade-in zoom-in-97","duration-200 ease-out","data-[exiting]:animate-out data-[exiting]:fade-out data-[exiting]:zoom-out-97","data-[exiting]:duration-150 data-[exiting]:ease-in",o==="right"?"origin-top-right":"origin-top-left",d),placement:o==="right"?"bottom end":"bottom start",children:jsxs("div",{className:twMerge("flex min-w-[180px] flex-col gap-1",d),children:[s?jsx("div",{className:"px-3 pb-2 pt-3",children:s}):null,jsx(Menu,{className:"!outline-none",children:t.map(f=>jsx(JC,{id:f.id,href:f.href,onAction:()=>{f.onAction?f.onAction():i?.(f);},textAlign:n,size:a,iconName:f.iconName,isDisabled:f.disabled,variant:f.variant,subtitle:f.subtitle,render:f.render,noPadding:f.noPadding,"data-testid":f.testId,children:f.name},f.id))}),c?jsx("div",{className:"px-3 pb-3 pt-2",children:c}):null]})})]})})}function JC({textAlign:e="left",iconName:t,size:r="md",isDisabled:o,children:n,variant:a="default",subtitle:i,render:s,noPadding:c,...l}){let d={sm:"px-3 py-2 text-sm",md:i?"px-4 py-2.5 text-base":"px-4 py-2 text-base"},u="text-text-primary hover:bg-background-hover data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-primary data-[focus-visible]:ring-inset",m={primary:u,default:u,destructive:"text-feedback-error-text hover:bg-feedback-error-background data-[focused]:bg-feedback-error-background data-[focus-visible]:ring-2 data-[focus-visible]:ring-feedback-error-border data-[focus-visible]:ring-inset"};return s?jsx(MenuItem,{...l,isDisabled:o,className:twMerge("group box-border flex w-full cursor-pointer items-center rounded-sm outline-none transition-colors",!c&&d[r],m[a],e==="right"?"justify-end":"justify-start",o&&"pointer-events-none opacity-50"),children:s()}):jsxs(MenuItem,{...l,isDisabled:o,className:twMerge("group box-border flex w-full cursor-pointer items-center rounded-sm outline-none transition-colors",!c&&d[r],m[a],e==="right"?"justify-end":"justify-start",o&&"pointer-events-none opacity-50"),children:[t&&e==="left"&&jsx(V,{name:t,size:r==="sm"?16:20,className:"mr-3 flex-shrink-0"}),jsxs("div",{className:"flex flex-1 flex-col",children:[jsx("span",{className:i?"font-medium":"",children:n}),i&&jsx("span",{className:"text-sm text-text-secondary",children:i})]}),t&&e==="right"&&jsx(V,{name:t,size:r==="sm"?16:20,className:"ml-3 flex-shrink-0"})]})}var mo=({className:e,size:t=24,color:r="text-action-brand"})=>jsx("div",{className:twMerge("inline-block animate-spin rounded-full border-2 border-solid border-current border-r-transparent",r,e),style:{width:t,height:t},role:"status","aria-label":"loading",children:jsx("span",{className:"sr-only",children:"Loading..."})});function Cr({state:e,message:t,className:r,customIndicator:o}){if(e!=="loading-more")return null;let n=jsxs("div",{className:twMerge("flex items-center justify-center gap-2 py-4","text-text-secondary",r),"aria-label":t||"Loading",children:[jsx(mo,{size:20,color:"text-text-secondary"}),t&&jsx("span",{className:"text-sm","aria-hidden":"true",children:t})]});return o||n}var fa=createContext({variant:"timeline",size:"md"});function nf(){return useContext(fa)}function fs(e){return isValidElement(e)&&e.type===xs}function eS(e){return isValidElement(e)&&e.type===bs}function Cd({variant:e="timeline",size:t="md",className:r,children:o,items:n,renderItem:a,isLoading:i=false,loadingState:s,error:c=null,renderLoadingSkeleton:l,loadingSkeletonCount:d=5,emptyMessage:u="No activity found.",onLoadMore:m,hasMore:p=false,enableVirtualization:g,estimatedItemSize:f,loadingIndicator:x,height:b,maxHeight:h,...y}){let v=useRef(null),{isMobile:S}=Jt(),N=S?"stacked":e,w=n!==void 0&&a!==void 0,{scrollRef:M,loadMoreRef:k,virtualizer:P,virtualItems:I,isLoadingMore:D,computedLoadingState:L}=Ro({items:n||[],onLoadMore:w?m:void 0,hasMore:w?p:false,isLoading:i,loadingState:s,enableVirtualization:w?g:false,estimatedItemSize:f||(N==="stacked"?120:150),overscan:5}),R=w&&M?M:v,B=useMemo(()=>({variant:N,size:t}),[N,t]),Y=N==="timeline"?t==="sm"?"gap-4":"gap-6":"gap-0",H=N==="stacked"?"divide-y divide-border-subtle rounded-lg border border-border-subtle bg-background-surface":"",W={};if(w&&m&&(b?(W.height=typeof b=="number"?`${b}px`:b,W.overflowY="auto"):h?(W.maxHeight=typeof h=="number"?`${h}px`:h,W.overflowY="auto"):(W.height="600px",W.overflowY="auto")),w){let Q=L==="loading"||i&&(!n||n.length===0);if(Q){let E=l?jsx(Fragment,{children:Array.from({length:d}).map((O,A)=>jsx("div",{children:l()},`skeleton-${A}`))}):jsx(Fragment,{children:Array.from({length:d}).map((O,A)=>{let C=t==="sm"?"gap-2":"gap-3";if(N==="timeline"){let F=t==="sm"?"pt-3":"pt-4",z=t==="sm"?"p-3":"p-4";return jsxs("div",{className:"group relative grid items-start gap-4 grid-cols-[3rem_1fr]",children:[jsxs("div",{className:`relative flex h-full flex-col items-center ${F}`,children:[jsx(K,{width:32,height:32,variant:"circle"}),A<d-1&&jsx("span",{className:"absolute top-[2rem] left-1/2 w-0 border-l-2 border-dotted -translate-x-1/2 h-[calc(100%+2.5rem)] border-border-muted"})]}),jsxs("div",{className:`min-w-0 flex flex-col ${C} ${z} rounded-md border border-border-subtle bg-background-surface`,children:[jsxs("div",{className:"flex items-center justify-between gap-3",children:[jsx(K,{width:"50%",height:16}),jsx(K,{width:"15%",height:12})]}),jsx(K,{width:"85%",height:t==="sm"?14:15}),jsx(K,{width:"70%",height:t==="sm"?14:15})]})]},`skeleton-${A}`)}else return jsxs("div",{className:`flex flex-col ${t==="sm"?"px-3 py-3":"px-4 py-4"}`,children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(K,{width:24,height:24,variant:"circle"}),jsx(K,{width:"50%",height:16})]}),jsxs("div",{className:`mt-3 flex flex-col ${C}`,children:[jsx(K,{width:"85%",height:t==="sm"?14:15}),jsx(K,{width:"70%",height:t==="sm"?14:15}),jsx(K,{width:"20%",height:12})]})]},`skeleton-${A}`)})});return jsx(fa.Provider,{value:B,children:jsx("div",{ref:R,"data-slot":"feed","data-variant":N,className:twMerge("flex flex-col",Y,H,r),style:W,...y,children:E})})}if(c)return jsx(fa.Provider,{value:B,children:jsx("div",{ref:R,"data-slot":"feed","data-variant":N,className:twMerge("flex flex-col",Y,H,r),style:W,...y,children:jsx("div",{className:"p-4 text-center text-feedback-error-text",children:c})})});if(!n||n.length===0)return jsx(fa.Provider,{value:B,children:jsx("div",{ref:R,"data-slot":"feed","data-variant":N,className:twMerge("flex flex-col",Y,H,r),style:W,...y,children:jsx("div",{className:"p-4 text-center text-text-secondary",children:u})})});let T=P?I?.map(E=>({virtualItem:E,item:n[E.index],index:E.index}))||[]:n.map((E,O)=>({item:E,index:O,virtualItem:null}));return jsx(fa.Provider,{value:B,children:jsxs("div",{ref:R,"data-slot":"feed","data-variant":N,className:twMerge("flex flex-col",Y,H,r),style:{...W,position:P?"relative":void 0},...y,children:[P?jsxs("div",{style:{height:`${P.getTotalSize()}px`,position:"relative"},children:[T.map(({item:E,index:O,virtualItem:A})=>{if(!E||!A)return null;let C=a(E,O),F=N==="timeline"&&isValidElement(C)&&fs(C)?cloneElement(C,{showConnector:O!==n.length-1}):C;return jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${A.start}px)`},"data-index":A.index,ref:P.measureElement,children:F},`item-${O}`)}),D&&jsx("div",{style:{position:"absolute",top:`${P.getTotalSize()}px`,left:0,width:"100%"},children:x||jsx(Cr,{state:"loading-more"})})]}):jsxs(Fragment,{children:[T.map(({item:E,index:O})=>{let A=a(E,O);if(N==="timeline"&&isValidElement(A)&&fs(A)){let C=O===n.length-1;return jsx("div",{children:cloneElement(A,{showConnector:!C})},`item-${O}`)}return jsx("div",{children:A},`item-${O}`)}),D&&(x||jsx(Cr,{state:"loading-more"}))]}),m&&p&&!Q&&jsx("div",{ref:k,style:P?{position:"absolute",top:`${P.getTotalSize()}px`,left:0,width:"100%",height:1}:{height:1,width:"100%"}})]})})}let Z=Children.toArray(o),q=Z.map((Q,T)=>{if(fs(Q)){let E=Q.props.showConnector??(N==="timeline"&&T<Z.length-1),O=N==="timeline"&&T>0;return cloneElement(Q,{showConnector:E,showIncomingConnector:O})}if(eS(Q)){let E=T===Z.length-1;return cloneElement(Q,{__isLastGroup:E,__isFirstGroup:T===0})}return Q});return jsx(fa.Provider,{value:B,children:jsx("div",{"data-slot":"feed","data-variant":N,className:twMerge("flex flex-col",Y,H,r),...y,children:q})})}Cd.displayName="ActivityFeed";function bs(e){let{variant:t,size:r}=nf(),{title:o,description:n,actions:a,children:i,className:s,__isLastGroup:c=false,__isFirstGroup:l=false,...d}=e,u=Children.toArray(i),m=u.map((f,x)=>{if(fs(f)){let b=f.props.showConnector??(t==="timeline"&&!(c&&x===u.length-1));return cloneElement(f,{showConnector:b,showIncomingConnector:t==="timeline"&&!(l&&x===0)})}return f}),p=t==="timeline"?"pl-[3rem]":r==="sm"?"px-3":"px-4",g=r==="sm"?"gap-3":"gap-4";return jsxs("section",{"data-slot":"group",className:twMerge("flex flex-col",s),...d,children:[(o||n||a)&&jsxs("div",{className:twMerge("mb-2 flex flex-wrap items-end justify-between gap-2",p),children:[jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[o&&jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-text-secondary",children:o}),n&&jsx("span",{className:"text-sm text-text-secondary",children:n})]}),a&&jsx("div",{className:"flex flex-shrink-0 items-center gap-2",children:a})]}),jsx("div",{className:twMerge("flex flex-col",g),children:m})]})}bs.displayName="ActivityFeedGroup";var rf={neutral:"bg-background-muted text-text-secondary border-border-muted",brand:"bg-background-muted text-action-brand border-action-brand/30",success:"bg-background-muted text-feedback-success-text border-feedback-success-border/40",warning:"bg-background-muted text-feedback-warning-text border-feedback-warning-border/40",danger:"bg-background-muted text-feedback-error-text border-feedback-error-border/40",info:"bg-background-muted text-feedback-info-text border-feedback-info-border/40"},tS={neutral:"bg-background-subtle",brand:"bg-action-brand/5",success:"bg-feedback-success-background",warning:"bg-feedback-warning-background",danger:"bg-feedback-error-background",info:"bg-feedback-info-background"},rS={neutral:"border-border-muted",brand:"border-action-brand",success:"border-feedback-success-border",warning:"border-feedback-warning-border",danger:"border-feedback-error-border",info:"border-feedback-info-border"};function xs(e){let{variant:t,size:r}=nf(),{title:o,description:n,timestamp:a,meta:i,media:s,actions:c,visual:l,icon:d,iconWeight:u,tone:m="neutral",surface:p,isHighlighted:g=false,showConnector:f=true,hideIndicator:x=false,interactive:b,className:h,children:y,onKeyDown:v,showIncomingConnector:S,...N}=e,w=l??(d?jsx(V,{name:d,weight:u||"fill",className:"h-4 w-4"}):null),M=p??(t==="stacked"?"minimal":"subtle"),k=r==="sm"?"gap-2":"gap-3",P="text-xs text-text-secondary",I=r==="sm"?"text-sm":"text-[15px]",D="text-xs text-text-secondary",L=b??typeof N.onClick=="function",R=T=>{if(!L){v?.(T);return}T.key===" "?T.preventDefault():T.key==="Enter"&&(T.preventDefault(),T.currentTarget.click()),v?.(T);},B=T=>{L&&T.key===" "&&(T.preventDefault(),T.currentTarget.click());},Y=L?twMerge("group cursor-pointer",Ye()):void 0,W=jsxs("div",{"data-slot":"connector",className:twMerge("relative flex h-full flex-col items-center",M==="minimal"?r==="sm"?"pt-2":"pt-3":r==="sm"?"pt-3":"pt-4"),children:[jsx("span",{"data-slot":"indicator",className:twMerge("relative z-10 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border text-sm font-medium shadow-sm ring-2 ring-background-surface",rf[m]),children:w}),t==="timeline"&&f&&jsx("span",{"data-slot":"separator",className:"absolute top-[2rem] left-1/2 w-0 border-l-2 border-dotted -translate-x-1/2 h-[calc(100%+2.5rem)] border-border-muted"})]}),Z=g?twMerge(tS[m],M==="minimal"?"rounded-md border border-border-muted":rS[m]):"";if(t==="stacked")return jsxs("div",{"data-slot":"item","data-variant":"stacked",role:L?"button":void 0,tabIndex:L?0:void 0,className:twMerge("flex flex-col",r==="sm"?"px-3 py-3":"px-4 py-4",{minimal:"",subtle:"bg-background-subtle",solid:"bg-background-muted"}[M],Z,Y,L?"transition-colors hover:bg-background-subtle/80":"",h),onKeyDown:R,onKeyUp:B,...N,children:[jsxs("div",{className:"flex items-center gap-3",children:[!x&&jsx("span",{"data-slot":"indicator",className:twMerge("flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full border text-sm font-medium shadow-sm ring-2 ring-background-surface",rf[m]),children:w}),jsx("div",{"data-slot":"title",className:"min-w-0 flex-1 text-sm font-semibold text-text-primary",children:o})]}),jsxs("div",{"data-slot":"content",className:twMerge("mt-3 flex flex-col",k),children:[n&&jsx("div",{"data-slot":"description",className:twMerge("text-text-secondary",I),children:n}),i&&jsx("div",{className:D,children:i}),s&&jsx("div",{className:"flex flex-col gap-2 text-sm text-text-secondary",children:s}),y,c&&jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:c}),a&&jsx("div",{className:twMerge("-mt-1.5",P),children:a})]})]});let q=M==="minimal"?r==="sm"?"py-2":"py-3":r==="sm"?"p-3":"p-4",Q={minimal:"",subtle:"rounded-md border border-border-subtle bg-background-surface",solid:"rounded-md bg-background-muted shadow-sm"};return jsxs("div",{"data-slot":"item","data-variant":"timeline",role:L?"button":void 0,tabIndex:L?0:void 0,className:twMerge("group relative grid items-start gap-4 grid-cols-[3rem_1fr]",Y,h),onKeyDown:R,onKeyUp:B,...N,children:[x?jsx("div",{}):W,jsxs("div",{"data-slot":"content",className:twMerge("min-w-0 flex flex-col",k,q,Q[M],Z,L?"transition-colors group-hover:bg-background-subtle/70":""),children:[jsxs("div",{className:"flex items-center justify-between gap-3",children:[jsx("div",{"data-slot":"title",className:"min-w-0 flex-1 text-sm font-semibold text-text-primary",children:o}),a&&jsx("div",{className:twMerge("flex-shrink-0",P),children:a})]}),n&&jsx("div",{"data-slot":"description",className:twMerge("text-text-secondary",I),children:n}),i&&jsx("div",{className:D,children:i}),s&&jsx("div",{className:"flex flex-col gap-2 text-sm text-text-secondary",children:s}),y,c&&jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:c})]})]})}xs.displayName="ActivityItem";function Sr({isOpen:e,onClose:t,title:r,headerContent:o,titleAlign:n="left",hideCloseIcon:a=false,hasBackArrow:i=false,onBack:s,children:c,primaryAction:l,secondaryAction:d,tertiaryAction:u,footerContent:m,transparentOverlay:p=false,maxWidth:g="600px",minWidth:f="400px",maxHeight:x="85vh",height:b,mobileMaxHeight:h="90vh",mobileHeight:y,contentPadding:v=true,className:S}){let N=Yt("(max-width: 767px)"),w=cs(N&&e===void 0),M=w?.height??null,k=w?.keyboardOffset??0,P=useRef(null),I=useCallback(()=>{P.current&&P.current.scrollTop!==0&&(P.current.scrollTop=0);},[]),D=useRef(null),L=useRef(null);useEffect(()=>{let W=L.current;if(!W||!N)return;let Z=null,q=Q=>{let T=Q.target;T&&["INPUT","TEXTAREA","SELECT"].includes(T.tagName)&&(Z&&clearTimeout(Z),Z=setTimeout(()=>{T.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return W.addEventListener("focusin",q),()=>{W.removeEventListener("focusin",q),Z&&clearTimeout(Z);}},[N]);let R=useCallback(()=>{D.current&&D.current.scrollTop!==0&&(D.current.scrollTop=0);},[]);if(e===false)return null;let B=r||o,Y=l||d||u||m,H=e!==void 0;return N?H?jsx(at,{isOpen:e,onClose:t,title:r,headerContent:o,titleAlign:n,hideCloseIcon:a,hasBackArrow:i,onBack:s,primaryAction:l,secondaryAction:d,footerContent:m,transparentOverlay:p,maxHeight:h,height:y,maxWidth:g,contentPadding:v,showHandle:true,animationVariant:"scale",className:S,children:c}):jsx(Vr,{children:jsx(sr,{isDismissable:true,transparent:p,style:{paddingBottom:k>0?`${k}px`:void 0,transition:"padding-bottom 0.25s ease-out"},className:"flex items-end justify-center",children:jsx(Modal,{className:"w-full p-0 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxs(Dialog,{ref:P,onScroll:I,className:twMerge("relative flex w-full flex-col","bg-background-surface","shadow-2xl shadow-black/20","border-t border-x border-border-default/40","rounded-t-xl","overflow-hidden","animate-in slide-in-from-bottom","duration-300 ease-out","data-[exiting]:animate-out data-[exiting]:slide-out-to-bottom","data-[exiting]:duration-200 data-[exiting]:ease-in",S),style:{...y?{height:y}:{maxHeight:/\d/.test(h)?M!==null?`min(${h}, ${Math.max(M-8,0)}px, 100dvh)`:`min(${h}, 100dvh)`:h}},children:[jsx("div",{className:"flex justify-center pt-2",children:jsx("div",{className:"h-1.5 w-12 rounded-full bg-border-muted"})}),B&&(i?jsx(zt,{title:r,headerContent:o,titleAlign:n,hideCloseIcon:a||!t,hasBackArrow:true,onBack:s,onClose:t||(()=>{})}):jsx(zt,{title:r,headerContent:o,titleAlign:n,hideCloseIcon:a||!t,onClose:t||(()=>{})})),jsx("div",{ref:L,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",v?"px-6 py-6":"p-0"),children:c}),Y&&jsx(Eo,{primaryAction:l,secondaryAction:d,tertiaryAction:u,footerContent:m})]})})})}):jsx(Vr,{children:jsx(sr,{...H?{isOpen:e,onOpenChange:W=>{!W&&t&&t();}}:{},isDismissable:true,transparent:p,className:"flex items-center justify-center",children:jsx(Modal,{className:"w-full p-4 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",style:{maxWidth:g},children:jsxs(Dialog,{ref:D,onScroll:R,className:twMerge("relative flex w-full flex-col","bg-background-surface","shadow-2xl shadow-black/20","border border-border-default/50","rounded-md","overflow-hidden","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0","animate-in fade-in zoom-in-96 slide-in-from-bottom-2","duration-300 ease-out","data-[exiting]:animate-out data-[exiting]:fade-out data-[exiting]:zoom-out-95","data-[exiting]:duration-200 data-[exiting]:ease-in",S),style:{minWidth:f,...b?{height:b}:{maxHeight:x}},children:[B&&(i?jsx(zt,{title:r,headerContent:o,titleAlign:n,hideCloseIcon:a||!t,hasBackArrow:true,onBack:s,onClose:t||(()=>{})}):jsx(zt,{title:r,headerContent:o,titleAlign:n,hideCloseIcon:a||!t,onClose:t||(()=>{})})),jsx("div",{className:twMerge("flex-1 min-h-0 overflow-y-auto",v?"px-6 py-6":"p-0"),children:c}),Y&&jsx(Eo,{primaryAction:l,secondaryAction:d,tertiaryAction:u,footerContent:m})]})})})})}function uf({isOpen:e,onClose:t,title:r,message:o,confirmLabel:n="OK",confirmVariant:a="primary",maxWidth:i="400px",minWidth:s="320px"}){return jsx(Sr,{isOpen:e,onClose:t,title:r,maxWidth:i,minWidth:s,primaryAction:{label:n,onPress:t,variant:a},children:jsx("div",{className:"text-text-primary",children:o})})}var Ao={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},lr=memo(({name:e,size:t="md",color:r,weight:o="regular",className:n,ariaLabel:a,...i})=>{let s=nS[e];if(!s)return null;let c=typeof t=="string"?t in Ao?Ao[t]:Ao.md:t,l=twMerge("inline-block flex-shrink-0",!r&&"text-current",n);return jsx(s,{...i,size:c,color:r,weight:o,className:l,"aria-label":a||`${e} icon`,"data-testid":`icon-${e}`})});lr.displayName="IconSSR";var aS=memo(({variant:e="subtle",shape:t="square",containerSize:r,containerClassName:o,size:n="md",className:a,name:i,color:s,weight:c,ariaLabel:l,ref:d,...u})=>{let m=typeof n=="string"?n in Ao?Ao[n]:Ao.md:n,p=r?typeof r=="string"?r in Ao?Ao[r]:m*1.75:r:m*1.75,g=twMerge("inline-flex items-center justify-center flex-shrink-0",t==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-background-muted",e==="solid"&&"bg-action-brand text-[color:var(--color-action-brand-text)]",e==="outline"&&"border-2 border-current",o);return jsx("div",{className:g,style:{width:p,height:p},children:jsx(lr,{...u,name:i,size:n,color:s,weight:c,className:a,ariaLabel:l})})});aS.displayName="IconSSRWithContainer";var ga=({className:e,showWordmark:t=true,width:r,fill:o})=>{let n,a;if(o?o.startsWith("fill-")?a=o:n=o:e?a=e:n="var(--color-text-primary)",t){let c=r||270,l=c/270*80;return jsxs("svg",{width:c,height:l,viewBox:"0 0 270 80",xmlns:"http://www.w3.org/2000/svg",className:a,style:n?{fill:n}:void 0,children:[jsxs("g",{clipPath:"url(#clip0_796_283)",children:[jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.223654 20.2934C0.417233 19.8234 0.873598 19.517 1.37984 19.517H20.5909C21.282 19.517 21.8422 20.0798 21.8422 20.774V40.049C21.8422 40.5572 21.5375 41.0155 21.0702 41.2102C20.6028 41.405 20.0647 41.2977 19.7067 40.9385L0.495628 21.6635C0.137428 21.3041 0.030075 20.7633 0.223654 20.2934ZM4.40349 22.0311L19.3396 37.017V22.0311H4.40349Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 20.2934C38.8394 19.8234 39.2958 19.517 39.802 19.517H59.013C59.7041 19.517 60.2642 20.0798 60.2642 20.774V40.049C60.2642 40.5572 59.9597 41.0155 59.4923 41.2102C59.025 41.405 58.4867 41.2977 58.1289 40.9385L38.9178 21.6635C38.5595 21.3041 38.4522 20.7633 38.6458 20.2934ZM42.8255 22.0311L57.7618 37.017V22.0311H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4347 58.8447C19.6283 58.3747 20.0847 58.0685 20.5909 58.0685H39.802C40.493 58.0685 41.0532 58.6312 41.0532 59.3255V78.6005C41.0532 79.1087 40.7486 79.567 40.2813 79.7617C39.8139 79.9562 39.2757 79.849 38.9178 79.49L19.7067 60.215C19.3485 59.8555 19.2411 59.3147 19.4347 58.8447ZM23.6146 60.5825L38.5508 75.5682V60.5825H23.6146Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 58.1643C39.79 57.9695 40.3283 58.0768 40.6861 58.436L59.8972 77.711C60.2555 78.0703 60.3628 78.6113 60.1692 79.081C59.9756 79.551 59.5192 79.8575 59.013 79.8575H39.802C39.1109 79.8575 38.5508 79.2948 38.5508 78.6005V59.3255C38.5508 58.8173 38.8554 58.359 39.3227 58.1643ZM41.0532 62.3575V77.3433H55.9893L41.0532 62.3575Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 19.6129C39.79 19.4182 40.3283 19.5254 40.6861 19.8846L59.8972 39.1595C60.2555 39.519 60.3628 40.0598 60.1692 40.5298C59.9756 40.9995 59.5192 41.306 59.013 41.306H39.802C39.1109 41.306 38.5508 40.7433 38.5508 40.049V20.7741C38.5508 20.2658 38.8554 19.8075 39.3227 19.6129ZM41.0532 23.8061V38.792H55.9893L41.0532 23.8061Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 38.8885C39.79 38.694 40.3283 38.8012 40.6861 39.1602L59.8972 58.4352C60.2555 58.7945 60.3628 59.3355 60.1692 59.8055C59.9756 60.2752 59.5192 60.5817 59.013 60.5817H39.802C39.1109 60.5817 38.5508 60.019 38.5508 59.3247V40.0497C38.5508 39.5415 38.8554 39.0832 39.3227 38.8885ZM41.0532 43.0817V58.0675H55.9893L41.0532 43.0817Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 39.569C38.8394 39.0992 39.2958 38.7927 39.802 38.7927H59.013C59.7041 38.7927 60.2642 39.3555 60.2642 40.0497V59.3247C60.2642 59.833 59.9597 60.2912 59.4923 60.486C59.025 60.6805 58.4867 60.5732 58.1289 60.2142L38.9178 40.9392C38.5595 40.5797 38.4522 40.039 38.6458 39.569ZM42.8255 41.3067L57.7618 56.2927V41.3067H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 58.8447C38.8394 58.3747 39.2958 58.0685 39.802 58.0685H59.013C59.7041 58.0685 60.2642 58.6312 60.2642 59.3255V78.6005C60.2642 79.1087 59.9597 79.567 59.4923 79.7617C59.025 79.9562 58.4867 79.849 58.1289 79.49L38.9178 60.215C38.5595 59.8555 38.4522 59.3147 38.6458 58.8447ZM42.8255 60.5825L57.7618 75.5682V60.5825H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.5338 19.6129C59.0011 19.4182 59.5394 19.5254 59.8972 19.8846L79.1083 39.1595C79.4666 39.519 79.5739 40.0598 79.3803 40.5298C79.1867 40.9995 78.7303 41.306 78.2241 41.306H59.013C58.322 41.306 57.7618 40.7433 57.7618 40.049V20.7741C57.7618 20.2658 58.0664 19.8075 58.5338 19.6129ZM60.2643 23.8061V38.792H75.2006L60.2643 23.8061Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.5338 0.338803C59.0011 0.144135 59.5394 0.251385 59.8972 0.610565L79.1083 19.8855C79.4666 20.2449 79.5739 20.7857 79.3803 21.2556C79.1867 21.7256 78.7303 22.032 78.2241 22.032H59.013C58.322 22.032 57.7618 21.4692 57.7618 20.775V1.50003C57.7618 0.99174 58.0664 0.533468 58.5338 0.338803ZM60.2643 4.53208V19.5179H75.2006L60.2643 4.53208Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M57.8569 20.2934C58.0505 19.8234 58.5069 19.517 59.013 19.517H78.2241C78.9151 19.517 79.4753 20.0798 79.4753 20.774V40.049C79.4753 40.5572 79.1707 41.0155 78.7034 41.2102C78.236 41.405 77.6978 41.2977 77.3399 40.9385L58.1289 21.6635C57.7705 21.3041 57.6633 20.7633 57.8569 20.2934ZM62.0365 22.0311L76.9729 37.017V22.0311H62.0365Z"}),jsx("path",{d:"M269.838 49.4457H249.005C249.266 51.801 250.162 53.6985 251.695 55.1377C253.225 56.577 255.134 57.2967 257.416 57.2967C259.307 57.2967 260.887 56.8715 262.159 56.021C263.463 55.1377 264.408 53.9927 264.996 52.5862H269.251C268.502 54.9415 267.084 56.937 264.996 58.5725C262.943 60.208 260.414 61.026 257.416 61.026C255.069 61.026 252.917 60.4697 250.961 59.3575C249.037 58.2127 247.504 56.6587 246.363 54.696C245.255 52.7332 244.7 50.558 244.7 48.17C244.7 45.782 245.255 43.6067 246.363 41.644C247.504 39.6812 249.037 38.1437 250.961 37.0315C252.917 35.8867 255.069 35.3142 257.416 35.3142C259.73 35.3142 261.833 35.8702 263.724 36.9825C265.615 38.0947 267.098 39.6485 268.176 41.644C269.283 43.6395 269.838 45.913 269.838 48.4645V49.4457ZM257.416 39.0432C255.263 39.0432 253.439 39.6812 251.939 40.957C250.47 42.2327 249.542 43.9337 249.152 46.06H265.583C265.192 43.9992 264.262 42.3145 262.796 41.006C261.36 39.6975 259.568 39.0432 257.416 39.0432Z"}),jsx("path",{d:"M228.356 60.5352V35.8049H232.219V39.7794H232.464C233.05 38.5689 233.963 37.5712 235.202 36.7862C236.474 35.9684 237.974 35.5594 239.701 35.5594H243.125V39.4359H239.701C237.517 39.4359 235.757 40.1554 234.42 41.5949C233.083 43.0342 232.414 44.9152 232.414 47.2377V60.5352H228.356Z"}),jsx("path",{d:"M208.607 61.0259C205.64 61.0259 203.326 60.1262 201.663 58.3272C200 56.4952 199.169 53.8947 199.169 50.5252V35.8047H203.228V49.8874C203.228 52.2427 203.766 54.0744 204.842 55.3829C205.95 56.6587 207.532 57.2967 209.586 57.2967C211.02 57.2967 212.308 56.9694 213.449 56.3152C214.623 55.6284 215.536 54.6959 216.188 53.5184C216.84 52.3407 217.166 50.9997 217.166 49.4949V35.8047H221.225V60.5352H217.313V56.5607H217.068C216.286 57.9019 215.161 58.9814 213.694 59.7992C212.226 60.6169 210.531 61.0259 208.607 61.0259Z"}),jsx("path",{d:"M186.736 39.534V56.806H194.756V60.5352H182.677V39.534H177.199V35.8047H182.677V29.5732H186.736V35.8047H193.24V39.534H186.736Z"}),jsx("path",{d:"M156.585 60.5352H151.988L158.394 48.0227L152.33 35.8047H156.976L162.062 46.0599H165.388L170.474 35.8047H175.022L168.958 48.0227L175.365 60.5352H170.67L165.29 49.7892H162.013L156.585 60.5352Z"}),jsx("path",{d:"M150.138 49.1315H129.304C129.565 51.4867 130.461 53.3842 131.994 54.8235C133.526 56.2627 135.433 56.9825 137.715 56.9825C139.606 56.9825 141.188 56.5572 142.459 55.7067C143.763 54.8235 144.709 53.6785 145.296 52.272H149.551C148.801 54.6272 147.382 56.6227 145.296 58.2582C143.242 59.8937 140.715 60.7118 137.715 60.7118C135.368 60.7118 133.216 60.1555 131.26 59.0432C129.336 57.8985 127.804 56.3445 126.663 54.3817C125.554 52.419 125 50.2437 125 47.8557C125 45.4677 125.554 43.2925 126.663 41.3298C127.804 39.367 129.336 37.8295 131.26 36.7173C133.216 35.5725 135.368 35 137.715 35C140.03 35 142.133 35.556 144.024 36.6682C145.915 37.7805 147.399 39.3342 148.475 41.3298C149.583 43.3252 150.138 45.5987 150.138 48.1502V49.1315ZM137.715 38.729C135.564 38.729 133.738 39.367 132.238 40.6427C130.771 41.9185 129.842 43.6195 129.45 45.7458H145.883C145.491 43.685 144.562 42.0002 143.095 40.6917C141.661 39.3832 139.867 38.729 137.715 38.729Z"}),jsx("path",{d:"M116.961 60.5353H112.559V30.4072H101.164V26.1875H128.307V30.4072H116.961V60.5353Z"})]}),jsx("defs",{children:jsx("clipPath",{id:"clip0_796_283",children:jsx("rect",{width:"270",height:"80",fill:"white"})})})]})}let i=r||80;return jsxs("svg",{width:i,height:i,viewBox:"0 0 80 80",xmlns:"http://www.w3.org/2000/svg",className:a,style:n?{fill:n}:void 0,children:[jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.223654 20.2934C0.417233 19.8234 0.873598 19.517 1.37984 19.517H20.5909C21.282 19.517 21.8422 20.0798 21.8422 20.774V40.049C21.8422 40.5572 21.5375 41.0155 21.0702 41.2102C20.6028 41.405 20.0647 41.2977 19.7067 40.9385L0.495628 21.6635C0.137428 21.3041 0.030075 20.7633 0.223654 20.2934ZM4.40349 22.0311L19.3396 37.017V22.0311H4.40349Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 20.2934C38.8394 19.8234 39.2958 19.517 39.802 19.517H59.013C59.7041 19.517 60.2642 20.0798 60.2642 20.774V40.049C60.2642 40.5572 59.9597 41.0155 59.4923 41.2102C59.025 41.405 58.4867 41.2977 58.1289 40.9385L38.9178 21.6635C38.5595 21.3041 38.4522 20.7633 38.6458 20.2934ZM42.8255 22.0311L57.7618 37.017V22.0311H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4347 58.8447C19.6283 58.3747 20.0847 58.0685 20.5909 58.0685H39.802C40.493 58.0685 41.0532 58.6312 41.0532 59.3255V78.6005C41.0532 79.1087 40.7486 79.567 40.2813 79.7617C39.8139 79.9562 39.2757 79.849 38.9178 79.49L19.7067 60.215C19.3485 59.8555 19.2411 59.3147 19.4347 58.8447ZM23.6146 60.5825L38.5508 75.5682V60.5825H23.6146Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 58.1643C39.79 57.9695 40.3283 58.0768 40.6861 58.436L59.8972 77.711C60.2555 78.0703 60.3628 78.6113 60.1692 79.081C59.9756 79.551 59.5192 79.8575 59.013 79.8575H39.802C39.1109 79.8575 38.5508 79.2948 38.5508 78.6005V59.3255C38.5508 58.8173 38.8554 58.359 39.3227 58.1643ZM41.0532 62.3575V77.3433H55.9893L41.0532 62.3575Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 19.6129C39.79 19.4182 40.3283 19.5254 40.6861 19.8846L59.8972 39.1595C60.2555 39.519 60.3628 40.0598 60.1692 40.5298C59.9756 40.9995 59.5192 41.306 59.013 41.306H39.802C39.1109 41.306 38.5508 40.7433 38.5508 40.049V20.7741C38.5508 20.2658 38.8554 19.8075 39.3227 19.6129ZM41.0532 23.8061V38.792H55.9893L41.0532 23.8061Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 38.8885C39.79 38.694 40.3283 38.8012 40.6861 39.1602L59.8972 58.4352C60.2555 58.7945 60.3628 59.3355 60.1692 59.8055C59.9756 60.2752 59.5192 60.5817 59.013 60.5817H39.802C39.1109 60.5817 38.5508 60.019 38.5508 59.3247V40.0497C38.5508 39.5415 38.8554 39.0832 39.3227 38.8885ZM41.0532 43.0817V58.0675H55.9893L41.0532 43.0817Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 39.569C38.8394 39.0992 39.2958 38.7927 39.802 38.7927H59.013C59.7041 38.7927 60.2642 39.3555 60.2642 40.0497V59.3247C60.2642 59.833 59.9597 60.2912 59.4923 60.486C59.025 60.6805 58.4867 60.5732 58.1289 60.2142L38.9178 40.9392C38.5595 40.5797 38.4522 40.039 38.6458 39.569ZM42.8255 41.3067L57.7618 56.2927V41.3067H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 58.8447C38.8394 58.3747 39.2958 58.0685 39.802 58.0685H59.013C59.7041 58.0685 60.2642 58.6312 60.2642 59.3255V78.6005C60.2642 79.1087 59.9597 79.567 59.4923 79.7617C59.025 79.9562 58.4867 79.849 58.1289 79.49L38.9178 60.215C38.5595 59.8555 38.4522 59.3147 38.6458 58.8447ZM42.8255 60.5825L57.7618 75.5682V60.5825H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.5338 19.6129C59.0011 19.4182 59.5394 19.5254 59.8972 19.8846L79.1083 39.1595C79.4666 39.519 79.5739 40.0598 79.3803 40.5298C79.1867 40.9995 78.7303 41.306 78.2241 41.306H59.013C58.322 41.306 57.7618 40.7433 57.7618 40.049V20.7741C57.7618 20.2658 58.0664 19.8075 58.5338 19.6129ZM60.2643 23.8061V38.792H75.2006L60.2643 23.8061Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.5338 0.338803C59.0011 0.144135 59.5394 0.251385 59.8972 0.610565L79.1083 19.8855C79.4666 20.2449 79.5739 20.7857 79.3803 21.2556C79.1867 21.7256 78.7303 22.032 78.2241 22.032H59.013C58.322 22.032 57.7618 21.4692 57.7618 20.775V1.50003C57.7618 0.99174 58.0664 0.533468 58.5338 0.338803ZM60.2643 4.53208V19.5179H75.2006L60.2643 4.53208Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M57.8569 20.2934C58.0505 19.8234 58.5069 19.517 59.013 19.517H78.2241C78.9151 19.517 79.4753 20.0798 79.4753 20.774V40.049C79.4753 40.5572 79.1707 41.0155 78.7034 41.2102C78.236 41.405 77.6978 41.2977 77.3399 40.9385L58.1289 21.6635C57.7705 21.3041 57.6633 20.7633 57.8569 20.2934ZM62.0365 22.0311L76.9729 37.017V22.0311H62.0365Z"})]})};var ys=({topItems:e=[],bottomItems:t=[],bottomContent:r,logo:o,showLogo:n=true,linkComponent:a="a",className:i="",mobileMenuId:s="app-mobile-menu",sidebarCollapseId:c="app-sidebar-collapse"})=>{let l=p=>p.length>0&&"items"in p[0],d=p=>l(p)?p:[{id:"default-section",items:p}],u=(p,g,f)=>jsxs("div",{className:"space-y-0.5",children:[p.title&&jsx("div",{className:"px-6 py-1 text-xs font-medium text-text-secondary uppercase tracking-wider",children:p.title}),jsx("div",{className:"space-y-0.5",children:p.items.map(x=>m(x))}),g<f-1&&jsx("div",{className:"border-b border-border-subtle mx-6 my-2"})]},p.id),m=(p,g=false)=>{if(p.children&&p.children.length>0){let b=`category-${p.id}`;return jsxs("div",{className:"group/category",children:[jsx("input",{type:"checkbox",id:b,className:"peer/category hidden",defaultChecked:p.isExpanded,"aria-hidden":"true"}),jsxs("label",{htmlFor:b,className:"flex items-center gap-3 px-6 py-1 text-text-primary hover:bg-background-hover hover:text-text-primary cursor-pointer transition-all duration-200",children:[p.icon&&jsx("span",{className:"flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center transition-all duration-200",children:p.icon}),jsx("span",{className:"transition-all duration-200",children:p.label}),jsx("span",{className:"flex-1"}),jsx("svg",{className:"w-4 h-4 transform transition-transform duration-200 peer-checked/category:rotate-180 ml-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),jsx("div",{className:"hidden peer-checked/category:block bg-background-subtle border-l-2 border-border-subtle ml-6",children:p.children.map(h=>m(h,true))})]},p.id)}let f={href:p.href||"#",className:`flex items-center gap-3 transition-all duration-200 hover:bg-background-hover ${g?"pl-8 pr-6 py-1 text-sm":"px-6 py-1"} ${p.isActive?`bg-action-brand/10 text-action-brand ${g?"":"border-l-2 border-action-brand"}`:"text-text-primary hover:text-text-primary"}`,"aria-current":p.isActive?"page":void 0},x=jsxs(Fragment,{children:[p.icon&&!g&&jsx("span",{className:"flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center transition-all duration-200",children:p.icon}),jsx("span",{className:"transition-all duration-200",children:p.label})]});return a==="a"?jsx("a",{...f,children:x},p.id):jsx(a,{...f,children:x},p.id)};return jsxs("div",{className:`flex flex-col h-full ${i}`,children:[jsxs("div",{className:"flex items-center justify-between h-[60px] px-6 border-b border-border-default",children:[n&&jsx("div",{className:"relative top-[-1px] transition-all duration-200",children:o||jsx(ga,{showWordmark:true,width:120})}),jsx("label",{htmlFor:c,className:"hidden md:flex items-center justify-center w-8 h-8 rounded hover:bg-background-hover cursor-pointer transition-all duration-200 relative top-[-1px]","aria-label":"Collapse sidebar",children:jsx(lr,{name:"Sidebar",size:"sm"})}),jsx("label",{htmlFor:s,className:"md:hidden flex items-center justify-center w-8 h-8 rounded hover:bg-background-hover cursor-pointer transition-colors","aria-label":"Close menu",children:jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),jsxs("nav",{className:"flex-1 flex flex-col overflow-hidden",children:[e&&e.length>0&&jsx("div",{className:"flex-1 overflow-y-auto py-2 scrollbar-hide",children:d(e).map((p,g,f)=>u(p,g,f.length))}),t&&t.length>0&&jsx("div",{className:"flex-shrink-0 border-t bg-background-muted/30",children:jsx("div",{className:"mt-2 pb-2 space-y-0.5",children:t.map(p=>m(p))})}),r&&jsx("div",{className:"flex-shrink-0 border-t border-border-default",children:jsx("div",{children:r})})]})]})};function mn(e){return e.id??e.href??e.label}function kd(e,t,r=[]){for(let o of e){if(o.href===t||o.id===t)return o.children?.length&&o.pushOnSelect!==false?[...r,mn(o)]:r;if(o.children?.length){let n=kd(o.children,t,[...r,mn(o)]);if(n)return n}}return null}function bf(e,t){let r=[],o=e;for(let n of t){let a=o.find(i=>mn(i)===n);if(!a)break;r.push(a),o=a.children??[];}return r}function sS(e,t,r){let o=t.length>0?[...e,...t]:e,n=[{path:[],items:e,bottomItems:t.length>0?t:void 0}],a=bf(o,r),i=[];for(let s of a){if(!s.children?.length)break;i=[...i,mn(s)],n.push({path:i,parent:s,items:s.children});}return n}var lS=({href:e,...t})=>jsx("a",{href:e,...t}),ff=[];function cS(e){let t=[];for(let r of e){let o=r.items??[];o.length!==0&&(t.length>0&&t.push({id:`__divider__${r.id}`,label:"",divider:true}),r.title&&t.push({id:`__group__${r.id}`,label:r.title,groupLabel:true}),t.push(...o));}return t}function dS(e,t){if(process.env.NODE_ENV==="production"||t.length===0)return;let r=new Map;for(let o of e)o.id&&r.set(o.id,"id"),o.href&&!r.has(o.href)&&r.set(o.href,"href");for(let o of t){let n=null;o.id&&r.has(o.id)?n=r.get(o.id)==="id"?`id "${o.id}"`:`id "${o.id}" (matches an items \`href\`)`:o.href&&r.has(o.href)&&(n=r.get(o.href)==="href"?`href "${o.href}"`:`href "${o.href}" (matches an items \`id\`)`),n&&console.warn(`[StackNav] L1 ${n} appears in both \`items\` and \`bottomItems\`. Stack tokens and value lookups will resolve to the \`items\` entry, making the bottomItems entry unreachable. L1 ids and hrefs must be unique across both arrays.`);}}function uS(e){if(!e)return {};let t={};return e.background!==void 0&&(t["--edges-stack-nav-background"]=e.background),e.activeBackground!==void 0&&(t["--edges-stack-nav-row-active-background"]=e.activeBackground),e.activeColor!==void 0&&(t["--edges-stack-nav-row-active-color"]=e.activeColor),e.hoverBackground!==void 0&&(t["--edges-stack-nav-row-hover-background"]=e.hoverBackground),e.borderColor!==void 0&&(t["--edges-stack-nav-border-color"]=e.borderColor),t}function vs({items:e,groups:t,bottomItems:r,value:o,defaultStack:n,stack:a,onStackChange:i,onSelect:s,linkComponent:c=lS,showLogo:l=false,logo:d,header:u,footer:m,mobileMenuId:p,sidebarCollapseId:g,rootLabel:f,sticky:x=true,width:b=260,ariaLabel:h="Navigation",theme:y,animated:v=true,style:S,className:N}){process.env.NODE_ENV!=="production"&&t&&e&&console.warn("[StackNav] Both `items` and `groups` were provided. `groups` takes precedence and `items` is ignored.");let w=Oe.useMemo(()=>t?cS(t):e??ff,[t,e]),M=r??ff,k=Oe.useMemo(()=>M.length>0?[...w,...M]:w,[w,M]);Oe.useEffect(()=>{dS(w,M);},[w,M]);let[P,I]=Oe.useState(()=>a!==void 0?a:n!==void 0?n:o?kd(k,o)??[]:[]),D=a??P,L=Oe.useCallback(T=>{a===void 0&&I(T),i?.(T);},[a,i]),R=Oe.useRef(false);Oe.useEffect(()=>{if(a!==void 0||!R.current&&(R.current=true,n!==void 0)||!o)return;let T=kd(k,o);I(E=>{let O=T??[];return gS(E,O)?E:O});},[o,k,a,n]);let B=Oe.useMemo(()=>sS(w,M,D),[w,M,D]),Y=Oe.useCallback((T,E)=>{T.children?.length&&L([...E,mn(T)]);},[L]),H=Oe.useCallback(()=>{L(D.slice(0,-1));},[D,L]),W=Oe.useCallback((T,E)=>{let O=bf(k,D);if(s?.(E,O),!!E.children?.length){let C=B[B.length-1]?.path??[];Y(E,C);}E.href||T.preventDefault();},[k,D,s,Y,B]),Z=Oe.useCallback(T=>o?T.href===o||T.id===o:false,[o]),q=x?"sticky top-0 h-[100dvh]":"",Q={...b!=null?{width:b}:{},...uS(y),...S};return jsxs("aside",{role:"navigation","aria-label":h,"data-edges-stack-nav":"",className:twMerge("edges-stack-nav flex flex-col flex-shrink-0 overflow-hidden",v&&"edges-stack-nav--animated",q,N),style:Q,children:[l?jsxs("div",{className:"edges-stack-nav__logo",children:[jsx("div",{className:"relative top-[-1px]",children:d??jsx(ga,{showWordmark:true,width:120})}),g?jsx("label",{htmlFor:g,className:"hidden md:flex items-center justify-center w-8 h-8 rounded hover:bg-background-hover cursor-pointer transition-all duration-200 relative top-[-1px]","aria-label":"Collapse sidebar",children:jsx(lr,{name:"Sidebar",size:"sm"})}):null,p?jsx("label",{htmlFor:p,className:"md:hidden flex items-center justify-center w-8 h-8 rounded hover:bg-background-hover cursor-pointer transition-colors","aria-label":"Close menu",children:jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}):null]}):null,u?jsx("div",{className:"edges-stack-nav__header",children:u}):null,jsx("div",{className:"relative flex-1 overflow-hidden",children:B.map((T,E)=>{let O=T.path.length,A=E===B.length-1,C=E<B.length-1,F=O===0?"__root__":T.path.join("/");return jsx(pS,{pane:T,parentPath:T.path.slice(0,-1),depth:O,isTop:A,isAbove:C,rootLabel:f,LinkComponent:c,isActive:Z,onSelect:W,onBack:H,animated:v},F)})}),m?jsx("div",{className:"edges-stack-nav__footer",children:m}):null]})}function pS({pane:e,depth:t,isTop:r,isAbove:o,rootLabel:n,LinkComponent:a,isActive:i,onSelect:s,onBack:c,animated:l}){let d=r?"edges-stack-nav__pane--top":o?"edges-stack-nav__pane--above":"edges-stack-nav__pane--below";return jsxs("nav",{"aria-label":e.parent?.label??n??"Navigation","aria-hidden":r?void 0:true,inert:r?void 0:true,className:twMerge("edges-stack-nav__pane absolute inset-0 flex flex-col gap-px overflow-y-auto px-2 py-3",!l&&"edges-stack-nav__pane--instant",d),children:[t>0&&e.parent?jsxs("button",{type:"button",className:"edges-stack-nav__back edges-stack-nav__row flex w-full cursor-pointer items-center gap-2 rounded-sm border-0 bg-transparent px-3 py-2 mb-2 text-left text-sm font-semibold text-text-primary",onClick:c,"aria-label":`Back from ${e.parent.label}`,children:[jsx(fS,{}),jsx("span",{children:e.parent.label})]}):n?jsx("div",{className:"px-3 pb-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-text-secondary",children:n}):null,e.items.map(u=>jsx(gf,{item:u,LinkComponent:a,isActive:i(u),onSelect:s},mn(u))),e.bottomItems&&e.bottomItems.length>0?jsx("div",{className:"edges-stack-nav__bottom-items mt-auto flex flex-col gap-px pt-3",children:e.bottomItems.map(u=>jsx(gf,{item:u,LinkComponent:a,isActive:i(u),onSelect:s},mn(u)))}):null]})}function gf({item:e,LinkComponent:t,isActive:r,onSelect:o}){if(e.divider)return jsx("div",{className:"edges-stack-nav__divider my-2",role:"separator"});if(e.groupLabel)return jsx("div",{className:"px-3 pt-6 pb-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-text-secondary",children:e.label});let n=!!e.children?.length,a=twMerge("edges-stack-nav__row flex items-center justify-between gap-3 rounded-sm px-3 py-2 text-sm font-normal text-text-primary no-underline cursor-pointer text-left bg-transparent border-0 transition-colors",r&&"edges-stack-nav__row--active font-semibold"),i=jsxs(Fragment,{children:[jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.leading??e.icon?jsx("span",{className:"inline-flex items-center flex-shrink-0",children:e.leading??e.icon}):null,jsx("span",{className:"truncate",children:e.label})]}),jsxs("span",{className:"flex flex-shrink-0 items-center gap-2 text-text-secondary",children:[e.trailing,n?jsx(mS,{}):null]})]});return e.href?jsx(t,{href:e.href,"aria-label":e.ariaLabel,className:a,"aria-current":r?"page":void 0,onClick:s=>o(s,e),children:i}):jsx("button",{type:"button",className:a,"aria-label":e.ariaLabel,onClick:s=>{o(s,e);},children:i})}function mS(){return jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M4.5 3 7.5 6 4.5 9"})})}function fS(){return jsx("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M8.5 3 4.5 7 8.5 11"})})}function gS(e,t){if(e===t)return true;if(e.length!==t.length)return false;for(let r=0;r<e.length;r+=1)if(e[r]!==t[r])return false;return true}var ni=({rightContent:e,centerContent:t,showMobileMenu:r=true,avatar:o,showColorModeSwitcher:n=false,toggleTheme:a,isDarkThemeEnabled:i=false,colorMode:s,actions:c,className:l="",mobileMenuId:d="app-mobile-menu"})=>{let u=()=>{switch(s||(i?"dark":"light")){case "system":return jsx(lr,{name:"Monitor",size:"sm"});case "light":return jsx(lr,{name:"Sun",size:"sm"});case "dark":return jsx(lr,{name:"Moon",size:"sm"})}},m=()=>{switch(s||(i?"dark":"light")){case "system":return "Switch to light mode";case "light":return "Switch to dark mode";case "dark":return "Switch to system mode";default:return "Toggle theme"}};return jsx("header",{className:`h-[60px] bg-background-surface border-b ${l}`,children:jsxs("div",{className:"relative flex h-full items-center",children:[jsx("div",{className:"flex items-center h-full flex-shrink-0",children:r&&jsx("label",{htmlFor:d,className:"md:hidden cursor-pointer","aria-label":"Open menu",children:jsx("div",{className:"flex h-full w-14 flex-col items-center justify-center border-r hover:bg-background-hover transition-colors",children:jsx(lr,{name:"List",size:"sm"})})})}),t&&jsx("div",{className:"flex-1 flex justify-end md:justify-center md:px-4 min-w-0",children:jsx("div",{className:"w-full md:max-w-4xl min-w-0",children:t})}),!t&&jsx("div",{className:"flex-1"}),jsxs("div",{className:"flex items-center gap-4 pr-4 flex-shrink-0 ml-4",children:[e,n&&a&&jsx("button",{type:"button",onClick:a,className:"flex items-center justify-center w-8 h-8 rounded hover:bg-background-hover transition-colors","aria-label":m(),children:u()}),c,o&&jsx("div",{className:"flex items-center",children:o})]})]})})};function hf({sideNav:e,stackNav:t,topNav:r,children:o,contentPaddingX:n,contentPaddingY:a,showSidebarBorder:i=true,mainClassName:s,enableJsEnhancements:c=false}){let l="app-mobile-menu",d="app-sidebar-collapse";return useEffect(()=>{if(!c)return;let u=document.getElementById(d),m=document.getElementById(l),p=document.querySelector("[data-app-shell]"),g=document.getElementById("app-sidebar");if(!u||!p||!g)return;let f=null,x=false;try{let P=localStorage.getItem("sidebar-collapsed");P!==null&&(u.checked=P==="true");}catch{}let b=()=>{try{localStorage.setItem("sidebar-collapsed",String(u.checked));}catch{}u.checked?x=true:(f&&(clearTimeout(f),f=null),p.removeAttribute("data-peek"),x=false);};u.addEventListener("change",b);let h=P=>{P.key==="Escape"&&(m&&(m.checked=false),p.removeAttribute("data-peek"));};document.addEventListener("keydown",h);let y=null;m&&(y=()=>{document.body.style.overflow=m.checked?"hidden":"";},m.addEventListener("change",y));let v=P=>{let D=P.target.closest("a");D&&D.href&&window.innerWidth<768&&m&&setTimeout(()=>{m.checked=false,document.body.style.overflow="";},100);};g.addEventListener("click",v);let S=16,N=200,w=()=>{f&&(clearTimeout(f),f=null),p.getAttribute("data-peek")!=="true"&&p.setAttribute("data-peek","true");},M=()=>{f&&clearTimeout(f),f=setTimeout(()=>{p.removeAttribute("data-peek"),f=null;},N);},k=P=>{if(window.innerWidth<768||!u.checked)return;let I=g.contains(P.target);if(x&&!I&&(x=false),x)return;P.clientX<=S||I?w():p.getAttribute("data-peek")==="true"&&M();};return document.addEventListener("mousemove",k),()=>{u.removeEventListener("change",b),document.removeEventListener("keydown",h),m&&y&&m.removeEventListener("change",y),g.removeEventListener("click",v),document.removeEventListener("mousemove",k),f&&clearTimeout(f);}},[c,l,d]),jsxs("div",{className:"min-h-[100dvh] bg-background text-text-primary relative","data-app-shell":"",children:[jsx("input",{type:"checkbox",id:d,className:"sr-only peer/sidebar","aria-hidden":"true"}),jsx("a",{href:"#app-content",className:"sr-only focus:not-sr-only focus:absolute focus:left-4 focus:top-4 z-50 rounded px-3 py-2 bg-background-surface shadow",children:"Skip to content"}),jsx(ni,{...r,mobileMenuId:l,className:["sticky top-0 flex-shrink-0 z-30 md:hidden",r?.className].filter(Boolean).join(" ")}),jsxs("div",{className:"flex w-full h-[calc(100dvh-60px)] md:h-[100dvh] relative overflow-hidden",children:[jsx("input",{type:"checkbox",id:l,className:"sr-only peer/mobile","aria-hidden":"true"}),jsx("label",{htmlFor:l,className:"fixed inset-0 bg-background-modal z-[55] opacity-0 pointer-events-none peer-checked/mobile:opacity-100 peer-checked/mobile:pointer-events-auto transition-opacity md:hidden","aria-label":"Close menu"}),jsx("div",{"aria-hidden":"true","data-peek-zone":"",className:"hidden md:block fixed left-0 top-0 bottom-0 w-4 z-[70] pointer-events-none"}),jsx("label",{htmlFor:d,"data-expand-rail":"",className:"hidden fixed left-3 top-3 z-[75] items-center justify-center w-9 h-9 rounded-md bg-background-surface border border-border-default shadow-sm hover:bg-background-hover cursor-pointer transition-all duration-200","aria-label":"Expand sidebar",children:jsx(lr,{name:"Sidebar",size:"sm"})}),jsx("aside",{id:"app-sidebar","data-app-sidebar":"",className:["bg-background-surface","border-r border-border-default","transition-transform duration-300 ease-in-out md:transition-[transform,width] md:duration-300 md:ease-in-out","fixed md:relative","left-0 top-0 bottom-0","z-[60] md:z-10","w-full md:w-64","h-[100dvh] md:h-full","-translate-x-full","peer-checked/mobile:translate-x-0","md:translate-x-0",i?"":"!border-r-0",(t??e)?.className||""].filter(Boolean).join(" "),children:t?jsx(vs,{...t,mobileMenuId:l,sidebarCollapseId:d,sticky:false,width:null,className:["h-full !border-r-0",t.className].filter(Boolean).join(" ")}):jsx(ys,{...e,mobileMenuId:l,sidebarCollapseId:d,className:"h-full"})}),jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden",children:[jsx("div",{className:"sticky top-0 flex-shrink-0 hidden md:block z-20","data-top-nav-wrapper":"",children:jsx(ni,{...r,className:r?.className})}),jsx("main",{id:"app-content",className:["flex-1 overflow-y-auto overflow-x-hidden bg-background-body",n,a,s||""].join(" "),role:"main",children:o})]})]}),jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
2
|
+
`);return jsxs(Fragment,{children:[jsx("style",{dangerouslySetInnerHTML:{__html:u}}),jsx("div",{"data-brand-scope":n,children:r})]})}var da=new Map,nC=8;function aC(e){if(!e.startsWith("var("))return e;let t=e.slice(4,e.lastIndexOf(")")).trim(),r=t.indexOf(",");return (r===-1?t:t.slice(0,r)).trim()}var Nt=(e,t="#000000")=>typeof window>"u"?t:Am(e,t,0);function Am(e,t,r){if(r>nC)return t;let o=e.startsWith("var(")?aC(e):e.startsWith("--")?e:`--${e}`;if(!e.startsWith("--")&&!e.startsWith("var(")&&!o.startsWith("--color-")&&(o=`--color-${o.slice(2)}`),da.has(o))return da.get(o);try{let n=document.body||document.documentElement,i=getComputedStyle(n).getPropertyValue(o).trim();if(i){if(i.startsWith("var(")){let l=Am(i,t,r+1);return da.set(o,l),l}return da.set(o,i),i}let s=document.createElement("div");s.style.color=`var(${o})`,document.body.appendChild(s);let c=getComputedStyle(s).color;return document.body.removeChild(s),c&&c!=="rgb(0, 0, 0)"?(da.set(o,c),c):t}catch(n){return console.warn(`Failed to resolve color for ${e}:`,n),t}}var ds=()=>{da.clear();},sn=()=>{let e=[];for(let t=1;t<=12;t++){let r=Nt(`--color-viz-categorical-${t}`,"");r&&e.push(r);}return e.length===0?Im():e},Im=()=>["#5424db","#d92361","#e86a00","#5d89ff","#9a47e2","#f24cb8","#0ba286","#9c28af","#036e45","#52a119","#ff513d","#046691"],Qa=()=>Nt("--color-viz-default","#444ae1"),iC=(e,t)=>{let r={},o=sn();return e.forEach((n,a)=>{t&&t[n]?r[n]=t[n]:r[n]=o[a%o.length];}),r},Fm=e=>{let t=e.match(/\d+/g);if(!t||t.length<3)return true;let[r,o,n]=t.map(Number);return (.299*r+.587*o+.114*n)/255>.5},sC=e=>Fm(e)?Nt("--color-text-primary","#333333"):Nt("--color-text-inverse","#ffffff"),Bm=(e,t)=>{if(!e||typeof e!="object")return console.warn("[Colors] Invalid GeoJSON data provided to extractUniqueValues"),[];if(!("type"in e)||e.type!=="FeatureCollection"&&e.type!=="Feature")return console.warn("[Colors] Data is not valid GeoJSON (missing type or invalid type)"),[];let r=new Set,o="features"in e?e.features:[e];if(!Array.isArray(o)||o.length===0)return console.warn("[Colors] No features found in GeoJSON data"),[];let n=0;return o.forEach(a=>{if(!(!a||typeof a!="object")&&a.properties&&t in a.properties){n++;let i=a.properties[t];i!=null&&r.add(i);}}),n===0&&console.warn(`[Colors] Property "${t}" not found on any features. Available properties: ${o[0]?.properties?Object.keys(o[0].properties).join(", "):"none"}`),Array.from(r).sort()},td=e=>{let t=sn(),r={};return e.forEach((o,n)=>{r[o]=t[n%t.length];}),r};var rd=(e,t)=>{if(!e||typeof e!="object")return console.warn("[Colors] Invalid GeoJSON data provided to extractNumericValues"),[];if(!("type"in e)||e.type!=="FeatureCollection"&&e.type!=="Feature")return console.warn("[Colors] Data is not valid GeoJSON (missing type or invalid type)"),[];let r="features"in e?e.features:[e];if(!Array.isArray(r)||r.length===0)return console.warn("[Colors] No features found in GeoJSON data"),[];let o=new Set,n=0;return r.forEach(a=>{if(!(!a||typeof a!="object")&&a.properties&&t in a.properties){n++;let i=a.properties[t];typeof i=="number"&&!isNaN(i)&&o.add(i);}}),n===0&&console.warn(`[Colors] Property "${t}" not found on any features. Available properties: ${r[0]?.properties?Object.keys(r[0].properties).join(", "):"none"}`),Array.from(o).sort((a,i)=>a-i)},od=e=>e.length===0?(console.warn("[Colors] Cannot calculate bounds from empty array"),{min:0,max:1}):{min:e[0],max:e[e.length-1]},Vm=(e,t)=>{if(typeof t=="number")return t;if(e.length===0)return console.warn("[Colors] Cannot calculate center from empty array, defaulting to 0"),0;if(t==="median"){let r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}return e.reduce((r,o)=>r+o,0)/e.length},nd=(e="viridis")=>{let o=`viz-sequential-${{redYellowGreen:"red-yellow-green"}[e]||e}`,n=[];for(let a=1;a<=10;a++){let i=`${o}-${a}`,s=Nt(i);n.push(s);}return n},ad=(e="redYellowBlue")=>{let o=`viz-diverging-${{orangeYellowSeafoam:"orange-yellow-seafoam",redYellowBlue:"red-yellow-blue",redBlue:"red-blue"}[e]||e}`,n=[];for(let a=1;a<=10;a++){let i=`${o}-${a}`,s=Nt(i);n.push(s);}return n},Za=(e,t,r,o="viridis")=>{let n=nd(o);if(e<=t)return n[0];if(e>=r)return n[n.length-1];if(t===r)return n[Math.floor(n.length/2)];let i=(e-t)/(r-t)*(n.length-1),s=Math.floor(i);return n[s]},_a=(e,t,r,o,n="redYellowBlue")=>{let a=ad(n),i=4;if(e<=t)return a[0];if(e>=r)return a[a.length-1];if(e===o||t===r)return a[i];if(e<o){let c=(e-t)/(o-t)*i,l=Math.floor(c);return a[Math.min(l,i)]}else {let s=(e-o)/(r-o),c=i+s*(a.length-1-i),l=Math.floor(c);return a[Math.min(l,a.length-1)]}};var id=createContext({mode:"system",colorMode:"light",isDarkTheme:false,toggleTheme:()=>{}}),It=()=>useContext(id);function pC(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Hm(){if(typeof window>"u")return "system";let e=localStorage.getItem("colorModePreference");return e==="light"||e==="dark"||e==="system"?e:"system"}function Wm(e){return e==="system"?pC():e}var Um=({children:e})=>{let[t,r]=useState(Hm),[o,n]=useState(()=>Wm(Hm())),a=o==="dark",i=useCallback(c=>{c==="dark"?(document.documentElement.classList.add("theme-dark"),document.body.classList.add("theme-dark")):(document.documentElement.classList.remove("theme-dark"),document.body.classList.remove("theme-dark")),ds();},[]);useEffect(()=>{ds();let c=Wm(t);if(n(c),i(c),t==="system"){let l=window.matchMedia("(prefers-color-scheme: dark)"),d=u=>{let m=u.matches?"dark":"light";n(m),i(m);};return l.addEventListener("change",d),()=>{l.removeEventListener("change",d);}}},[t,i]);let s=useCallback(()=>{r(c=>{let l=c==="system"?"light":c==="light"?"dark":"system";return localStorage.setItem("colorModePreference",l),l});},[]);return jsx(id.Provider,{value:{mode:t,colorMode:o,isDarkTheme:a,toggleTheme:s},children:e})};function cn(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function ln(e,t){return cn(e)?t.format(e):""}function Km(e){if(!cn(e.start)||!cn(e.end))return ()=>"";if((e.end.getTime()-e.start.getTime())/(1e3*60*60)<=720){let i=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});return s=>ln(s,i)}let r=e.start.getFullYear(),o=e.end.getFullYear(),n=r!==o,a=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...n&&{year:"numeric"}});return i=>ln(i,a)}var mC=864e5;function Ym(e,t){let r=t?.compact??false,o=e<5*mC,n=a=>{let i=a.getHours(),s=i>=12?"PM":"AM";return {displayHour:i%12||12,period:s}};return a=>{if(!cn(a))return "";let i=a.getHours()===0&&a.getMinutes()===0&&a.getSeconds()===0&&a.getMilliseconds()===0;if(i&&a.getDate()===1)return a.getMonth()===0?String(a.getFullYear()):a.toLocaleDateString("en",{month:"short"});if(i){let d=a.getDate();if(o){let u=a.toLocaleDateString("en",{weekday:"short"});return r?`${u.charAt(0)}${d}`:`${u} ${d}`}return r?`${a.getMonth()+1}/${d}`:`${a.toLocaleDateString("en",{month:"short"})} ${d}`}let{displayHour:s,period:c}=n(a);if(a.getMinutes()===0&&a.getSeconds()===0)return r?`${s}${c.charAt(0).toLowerCase()}`:`${s} ${c}`;let l=String(a.getMinutes()).padStart(2,"0");return r?`${s}:${l}${c.charAt(0).toLowerCase()}`:`${s}:${l} ${c}`}}function sd(e,t){if(!cn(e.start)||!cn(e.end))return ()=>"";let r=(e.end.getTime()-e.start.getTime())/(1e3*60*60),o=t?.compact??false,n=l=>d=>cn(d)?l(d):"";if(r<=24){if(o)return n(d=>{let u=d.getHours(),m=u>=12?"pm":"am";return `${u%12||12}${m}`});let l=new Intl.DateTimeFormat("en",{hour:"numeric",minute:"2-digit"});return d=>ln(d,l)}if(r<=48){if(o)return n(d=>{let u=d.getMonth()+1,m=d.getDate(),p=d.getHours(),g=p>=12?"p":"a",f=p%12||12;return `${u}/${m} ${f}${g}`});let l=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",hour:"numeric"});return d=>ln(d,l)}if(r<=168){if(o)return n(d=>{let u=d.getDate();return `${d.toLocaleDateString("en",{weekday:"short"}).charAt(0)}${u}`});let l=new Intl.DateTimeFormat("en",{weekday:"short",day:"numeric"});return d=>ln(d,l)}if(r<=720){if(o)return n(d=>{let u=d.getMonth()+1,m=d.getDate();return `${u}/${m}`});let l=new Intl.DateTimeFormat("en",{month:"short",day:"numeric"});return d=>ln(d,l)}let a=e.start.getFullYear(),i=e.end.getFullYear(),s=a!==i;if(o)return n(l=>{let d=l.getMonth()+1,u=l.getDate(),m=s?`/${l.getFullYear().toString().slice(-2)}`:"";return `${d}/${u}${m}`});let c=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",...s&&{year:"numeric"}});return l=>ln(l,c)}function Ye(e=false){return `${e?"outline outline-1 outline-border-input data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2":"outline-none data-[focus-visible]:outline data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2"}`}function ke(e,t){return composeRenderProps(e,r=>twMerge(t,r))}var We={sm:{text:"text-[length:var(--control-text-sm)]",height:"h-[var(--control-sm-height)]",padding:"px-[var(--control-padding-sm)]",paddingY:"py-[var(--control-gap-sm)]",gap:"gap-[var(--control-gap-sm)]"},md:{text:"text-[length:var(--control-text-md)]",height:"h-[var(--control-md-height)]",padding:"px-[var(--control-padding-md)]",paddingY:"py-[var(--control-gap-md)]",gap:"gap-[var(--control-gap-md)]"},lg:{text:"text-[length:var(--control-text-lg)]",height:"h-[var(--control-lg-height)]",padding:"px-[var(--control-padding-lg)]",paddingY:"py-[var(--control-gap-lg)]",gap:"gap-[var(--control-gap-lg)]"},xl:{text:"text-[length:var(--control-text-xl)]",height:"h-[var(--control-xl-height)]",padding:"px-[var(--control-padding-xl)]",paddingY:"py-[var(--control-gap-xl)]",gap:"gap-[var(--control-gap-xl)]"}};var hC="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",yC="bg-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",vC={primary:yC,secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border-2 border-border-muted hover:bg-action-secondary-hover forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-primary hover:bg-text-primary/5 forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace]",destructive:"bg-transparent text-feedback-error-text border-2 border-border-muted hover:bg-feedback-error-background/50 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[Mark]",link:"!text-action-primary hover:text-action-primary/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-primary hover:bg-background-hover hover:text-text-primary forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},Xm={full:"w-full",default:"w-fit"},CC="opacity-50 cursor-not-allowed pointer-events-none",SC="opacity-100 cursor-pointer",wC={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},NC={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function kC(e){return !e||e==="default"||e==="brand"?"primary":e}function TC(e){let{variant:t="primary",size:r="md",isDisabled:o,fullWidth:n=false,isLoading:a=false}=e,i=kC(t),s=i==="unstyled"?"":`${hC} ${vC[i]}`;i!=="unstyled"&&(s+=` ${We[r].text} ${We[r].height} ${We[r].padding} ${We[r].gap}`),o||a?s+=` ${CC}`:s+=` ${SC}`,n?s+=` ${Xm.full}`:s+=` ${Xm.default}`;let c=i==="primary"?"focus-visible:outline-action-primary":void 0;return [s,Ye(),c].filter(Boolean).join(" ")}function ee(e){let{icon:t,children:r,isLoading:o=false,loadingText:n,loadingIndicator:a,size:i="md",iconPosition:s="left",iconWeight:c,href:l,className:d,badgeNumber:u,badgeVariant:m="primary",badgePosition:p="top-right",style:g,target:f,rel:x,...b}=e,h=t?jsx(V,{name:t,size:i,weight:c}):null,y=jsxs(Fragment,{children:[s==="left"&&h,typeof r=="function"?null:r,s==="right"&&h]}),v=jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a||jsx(V,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:y}),n&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n})]}),S=(u??0)>0,N=twMerge(TC(e),d),w=l?{href:l,target:f,rel:x,...b}:{};if(l){let{onPress:k,onPressStart:P,onPressEnd:I,onPressChange:D,onPressUp:L,onAuxClick:R,onContextMenu:B,onDoubleClick:Y,...H}=b;Object.assign(w,H);}let M=l?jsx(Link,{...w,...o&&{"aria-busy":true},style:S?void 0:g,className:N,children:o?v:typeof r=="function"?(function(k){return jsxs(Fragment,{children:[s==="left"&&h,r(k),s==="right"&&h]})}):y}):jsx(Button,{...b,...o&&{"aria-busy":true},style:S?void 0:g,className:N,children:o?v:typeof r=="function"?(function(k){return jsxs(Fragment,{children:[s==="left"&&h,r(k),s==="right"&&h]})}):y});return S?jsxs("div",{className:twMerge("relative flex",d),style:g,children:[M,jsx("span",{className:`absolute ${wC[p]} flex h-5 w-5 items-center justify-center rounded-full ${NC[m]} text-xs font-medium`,"aria-label":`${u} items`,children:u})]}):M}function cd({action:e,defaultVariant:t,defaultSize:r="lg"}){let o=!!e.formId;return jsx(ee,{type:o?"submit":"button",form:o?e.formId:void 0,size:e.size||r,variant:e.variant||t,onPress:o?void 0:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})}function Eo({primaryAction:e,secondaryAction:t,tertiaryAction:r,footerContent:o}){let n=e||t||r;return !n&&!o?null:jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${o?"h-28":""}`,children:[o&&jsx("div",{className:"flex h-10 justify-center",children:o}),n&&jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsx("div",{children:r&&jsx(cd,{action:r,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[t&&jsx(cd,{action:t,defaultVariant:"secondary"}),e&&jsx(cd,{action:e,defaultVariant:"primary"})]})]})]})}var PC={heading:{sm:jr.headingSm,md:jr.headingMd,lg:jr.headingLg,xl:jr.headingXl},display:{sm:jr.displaySm,md:jr.displayMd,lg:jr.displayLg,xl:jr.displayXl}},RC={page:"h-16 leading-[62px]"};function qt({tag:e="h1",variant:t="heading",size:r="lg",height:o,className:n="",children:a}){let i=r==="xs"?"sm":r,s=PC[t][i],c=o?RC[o]:"";return jsx(e,{className:jt(s,"text-text-primary",c,n),children:a})}var zt=({title:e,onClose:t,hideCloseIcon:r=false,titleAlign:o="left",hasBackArrow:n=false,onBack:a,headerContent:i})=>jsxs("div",{className:twMerge("relative flex h-16 w-full flex-shrink-0 items-center justify-between border-b px-6",e&&"border-b",o==="center"?"justify-center":""),children:[n&&jsx(ee,{variant:"icon",onPress:a,className:"absolute left-6","aria-label":"Go back",children:jsx(V,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(qt,{size:"xs",children:e}),t&&!r&&jsx(ee,{variant:"icon",onPress:t,"aria-label":"Close dialog",children:jsx(V,{name:"X","data-testid":"close-button"})})]})]});var K=({width:e,height:t,variant:r="rect",animation:o="pulse",gradient:n=false,flex:a=false,stack:i,responsive:s,delay:c=0,adjustAnimationSpeedBasedOnWidth:l=false,ariaLabel:d,className:u,"data-testid":m})=>{let[p,g]=useState(c===0);if(useEffect(()=>{if(c>0){let S=setTimeout(()=>g(true),c);return ()=>clearTimeout(S)}},[c]),!p)return null;let f=n?"bg-gradient-to-r from-[var(--color-skeleton-base)] via-[var(--color-skeleton-highlight)] to-[var(--color-skeleton-base)]":"bg-[var(--color-skeleton-base)]",x=l&&e?(()=>{let S=typeof e=="number"?e:parseFloat(String(e));return isNaN(S)?"":`animation-duration-[${Math.max(.8,S/100)}s]`})():"",b=o==="pulse"?`animate-pulse ${x}`:o==="wave"?`relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-[var(--color-skeleton-wave)] before:to-transparent before:animate-wave ${x}`:"",h="rounded-sm";r==="circle"&&(h="rounded-full"),r==="text"&&(h="h-4 w-full rounded-sm");let y=a?"flex-1 min-w-0":"",v=s?Object.entries(s).map(([S,N])=>`${S}:w-[${N}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":m,children:i.map((S,N)=>jsx("div",{className:twMerge(f,b,h,y,v,u),style:{width:S,height:t}},N))}):jsx("div",{className:twMerge(f,b,h,y,v,u),style:{width:e,height:t},role:"presentation","aria-hidden":!d,"aria-label":d??void 0,"data-testid":m})},Qm=({count:e=1,children:t,className:r,"data-testid":o})=>jsx("div",{className:r,"data-testid":o,children:Array.from({length:e}).map((n,a)=>jsx("div",{children:t},a))});var IC={outlined:"bg-background-surface border border-border-default",elevated:"bg-background-surface border-0 shadow-md",filled:"bg-background-muted border-0",ghost:"bg-transparent border-0 shadow-none"},FC="rounded-lg",ud={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},BC={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function Ge({variant:e="outlined",className:t,children:r,isLoading:o=false,layout:n="default"}){return jsx("div",{className:twMerge("w-full overflow-hidden",IC[e],FC,n==="flex"&&"flex flex-col",t),"data-testid":"card",children:o?jsx(K,{width:"100%",height:"100%",className:"rounded-none"}):r})}function pd({title:e,subtitle:t,actions:r,className:o,isLoading:n=false}){return n?jsxs("div",{className:twMerge("p-6 pb-4",o),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx(K,{width:120,height:20}),jsx(K,{width:24,height:24})]}),t&&jsx(K,{width:200,height:16})]}):!e&&!t&&!r?null:jsx("div",{className:twMerge("p-6 pb-4",o),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsx("div",{className:"mb-1",children:typeof e=="string"?jsx(qt,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),t&&jsx("div",{className:pt("bodySm","text-text-secondary"),children:t})]}),r&&jsx("div",{className:"flex-shrink-0",children:r})]})})}function md({src:e,alt:t,aspectRatio:r="auto",className:o,children:n,isLoading:a=false}){return a?jsx("div",{className:twMerge("bg-background-muted",ud[r],o),children:jsx(K,{width:"100%",height:"100%"})}):n?jsx("div",{className:twMerge("overflow-hidden",ud[r],o),children:n}):e?jsx("div",{className:twMerge("overflow-hidden",ud[r],o),children:jsx("img",{src:e,alt:t||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function fd({className:e,children:t,isLoading:r=false,fill:o=false}){let a=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return r?jsx("div",{className:twMerge(a,o&&"flex-1 flex flex-col min-h-0",e),children:jsxs("div",{className:"space-y-2",children:[jsx(K,{width:"100%",height:16}),jsx(K,{width:"80%",height:16}),jsx(K,{width:"60%",height:16})]})}):t?jsx("div",{className:twMerge("px-6 py-4 text-text-primary",o&&"flex-1 flex flex-col min-h-0",e),children:t}):null}function gd({className:e,children:t,align:r="end",isLoading:o=false}){return o?jsxs("div",{className:twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsx(K,{width:80,height:32}),jsx(K,{width:60,height:32})]}):t?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",BC[r],e),children:t}):null}Ge.Header=pd;Ge.Media=md;Ge.Content=fd;Ge.Footer=gd;var Vr=class extends Component{constructor(){super(...arguments);Xa(this,"state",{hasError:false});Xa(this,"handleRetry",()=>{this.setState({hasError:false,error:void 0}),typeof window<"u"&&window.location.reload();});}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,o){console.error("Error Boundary caught an error:",r,o);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxs(Ge,{children:[this.props.title&&jsx(Ge.Header,{title:this.props.title}),jsx(Ge.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-action-default px-4 py-2 text-[color:var(--color-action-default-text)] hover:bg-action-default-hover",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var HC=.3,WC=.5;function at({children:e,title:t,headerContent:r,titleAlign:o="left",hideCloseIcon:n=false,hasBackArrow:a=false,onBack:i,isOpen:s,onClose:c,isDismissable:l=true,transparentOverlay:d=false,primaryAction:u,secondaryAction:m,footerContent:p,maxHeight:g="80vh",height:f,maxWidth:x="640px",contentPadding:b=true,showHandle:h=true,animationVariant:y="scale",className:v}){let[S,N]=useState(false),[w,M]=useState(0),[k,P]=useState(false),I=cs(s),D=I?.height??null,L=I?.keyboardOffset??0,R=useRef(null),B=useRef(null),Y=useRef(null),H=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let E=setTimeout(()=>{N(true),setTimeout(()=>N(false),600);},400);return ()=>clearTimeout(E)}},[s]),useEffect(()=>{s||(M(0),P(false),H.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),useEffect(()=>{let E=B.current;if(!E||!s)return;let O=null,A=C=>{let F=C.target;F&&["INPUT","TEXTAREA","SELECT"].includes(F.tagName)&&(O&&clearTimeout(O),O=setTimeout(()=>{F.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return E.addEventListener("focusin",A),()=>{E.removeEventListener("focusin",A),O&&clearTimeout(O);}},[s]);let W=useCallback(E=>{l&&(E.pointerType!=="touch"&&E.pointerType!=="pen"||(Y.current&&(clearTimeout(Y.current),Y.current=null),H.current={isDragging:true,startY:E.clientY,startTime:Date.now(),pointerId:E.pointerId},P(false),E.currentTarget.setPointerCapture(E.pointerId)));},[l]),Z=useCallback(E=>{let{isDragging:O,startY:A,pointerId:C}=H.current;if(!O||E.pointerId!==C)return;let F=E.clientY-A;M(Math.max(0,F));},[]),q=useCallback(E=>{let{isDragging:O,startY:A,startTime:C,pointerId:F}=H.current;if(!O||E.pointerId!==F)return;let z=E.clientY-A,G=Date.now()-C,oe=z/G;H.current={isDragging:false,startY:0,startTime:0,pointerId:null};let te=(R.current?.getBoundingClientRect().height??0)*HC;(z>te||oe>WC&&z>50)&&l?(c?.(),M(0)):(P(true),M(0),Y.current=setTimeout(()=>{P(false),Y.current=null;},200));},[l,c]);if(!s)return null;let Q=t||r,T=u||m||p;return jsx(Vr,{children:jsx(sr,{isOpen:s,onOpenChange:E=>{E||c?.();},isDismissable:l,transparent:d,style:{paddingBottom:L>0?`${L}px`:void 0,transition:"padding-bottom 0.25s ease-out"},className:"flex items-end justify-center p-0 sm:p-4",children:jsx(Modal,{className:"w-full max-w-full p-0 sm:p-2 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:l,children:jsx("div",{ref:R,className:twMerge("w-full",k&&"transition-transform duration-200"),style:{transform:w>0?`translateY(${w}px)`:void 0},children:jsxs(Dialog,{className:twMerge("relative flex w-full flex-col overflow-hidden","bg-background-surface","shadow-2xl shadow-black/30 dark:shadow-black/60","border-t border-x border-border-default/40","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0 focus:shadow-none","origin-bottom",y==="scale"?"animate-[tray-enter-scale_400ms_cubic-bezier(0.32,0.72,0,1)]":"animate-[tray-enter_400ms_cubic-bezier(0.32,0.72,0,1)]",y==="scale"?"data-[exiting]:animate-[tray-exit-scale_250ms_cubic-bezier(0.32,0,0.67,0)]":"data-[exiting]:animate-[tray-exit_250ms_cubic-bezier(0.32,0,0.67,0)]",v),style:{maxWidth:x,...f?{height:f}:{maxHeight:/\d/.test(g)?D!==null?`min(${g}, ${Math.max(D-8,0)}px, 100dvh)`:`min(${g}, 100dvh)`:g}},children:[h&&jsx("div",{className:"absolute top-0 left-0 right-0 h-8 z-10 flex justify-center items-start pt-2 touch-none cursor-grab active:cursor-grabbing",onPointerDown:W,onPointerMove:Z,onPointerUp:q,onPointerCancel:q,children:jsx("div",{className:twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",S&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),Q&&(a?jsx(zt,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n||!c,hasBackArrow:true,onBack:i??(()=>{}),onClose:c||(()=>{})}):jsx(zt,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n||!c,onClose:c||(()=>{})})),jsx("div",{ref:B,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",b?"p-4":"p-0"),children:e}),T&&jsx(Eo,{primaryAction:u,secondaryAction:m,footerContent:p})]})})})})})}at.displayName="Tray";function ma({children:e,items:t,className:r,align:o="left",textAlign:n="left",size:a="md",onAction:i,header:s,footer:c,useMobileTray:l=true,popoverClassName:d}){let[u,m]=useState(false),{isMobile:p}=Jt();if(l&&p){let f=Oe__default.isValidElement(e)?Oe__default.cloneElement(e,{onPress:()=>m(true)}):e,h=(y=>{if(typeof y=="string")return y;if(Oe__default.isValidElement(y)){let v=y.props;if(typeof v.children=="string")return v.children;if(Array.isArray(v.children))return v.children.find(N=>typeof N=="string")||""}return ""})(e)||"Actions";return jsxs(Fragment,{children:[jsx("div",{className:r,children:f}),jsx(at,{isOpen:u,onClose:()=>m(false),title:h,contentPadding:false,headerContent:s,footerContent:c,children:jsx("div",{className:"flex flex-col",children:t.map(y=>{let v=y.href&&!y.disabled?"a":"button";return jsxs(v,{...y.href&&!y.disabled?{href:y.href}:{},onClick:()=>{y.disabled||(y.onAction?y.onAction():i?.(y),m(false));},disabled:y.disabled,"data-testid":y.testId,className:twMerge("flex w-full items-center text-start transition-colors",!y.noPadding&&"px-6 py-3","border-b border-border-muted last:border-0",y.variant==="destructive"?"text-feedback-error-text hover:bg-feedback-error-background active:bg-feedback-error-background/80":"text-text-primary hover:bg-background-hover active:bg-background-hover/80",y.disabled&&"opacity-50 cursor-not-allowed"),children:[y.iconName&&jsx(V,{name:y.iconName,size:20,className:"mr-3 flex-shrink-0"}),jsx("div",{className:"flex flex-1 flex-col",children:y.render?y.render():jsxs(Fragment,{children:[jsx("span",{className:y.subtitle?"font-medium":"",children:y.name}),y.subtitle&&jsx("span",{className:"text-sm text-text-secondary",children:y.subtitle})]})})]},y.id)})})})]})}return jsx("div",{className:r,children:jsxs(MenuTrigger,{children:[e,jsx(nt,{className:twMerge("w-fit min-w-[180px] overflow-auto rounded-[var(--control-border-radius)] border border-border-default","bg-background-surface shadow-lg","animate-in fade-in zoom-in-97","duration-200 ease-out","data-[exiting]:animate-out data-[exiting]:fade-out data-[exiting]:zoom-out-97","data-[exiting]:duration-150 data-[exiting]:ease-in",o==="right"?"origin-top-right":"origin-top-left",d),placement:o==="right"?"bottom end":"bottom start",children:jsxs("div",{className:twMerge("flex min-w-[180px] flex-col gap-1",d),children:[s?jsx("div",{className:"px-3 pb-2 pt-3",children:s}):null,jsx(Menu,{className:"!outline-none",children:t.map(f=>jsx(JC,{id:f.id,href:f.href,onAction:()=>{f.onAction?f.onAction():i?.(f);},textAlign:n,size:a,iconName:f.iconName,isDisabled:f.disabled,variant:f.variant,subtitle:f.subtitle,render:f.render,noPadding:f.noPadding,"data-testid":f.testId,children:f.name},f.id))}),c?jsx("div",{className:"px-3 pb-3 pt-2",children:c}):null]})})]})})}function JC({textAlign:e="left",iconName:t,size:r="md",isDisabled:o,children:n,variant:a="default",subtitle:i,render:s,noPadding:c,...l}){let d={sm:"px-3 py-2 text-sm",md:i?"px-4 py-2.5 text-base":"px-4 py-2 text-base"},u="text-text-primary hover:bg-background-hover data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-primary data-[focus-visible]:ring-inset",m={primary:u,default:u,destructive:"text-feedback-error-text hover:bg-feedback-error-background data-[focused]:bg-feedback-error-background data-[focus-visible]:ring-2 data-[focus-visible]:ring-feedback-error-border data-[focus-visible]:ring-inset"};return s?jsx(MenuItem,{...l,isDisabled:o,className:twMerge("group box-border flex w-full cursor-pointer items-center rounded-sm outline-none transition-colors",!c&&d[r],m[a],e==="right"?"justify-end":"justify-start",o&&"pointer-events-none opacity-50"),children:s()}):jsxs(MenuItem,{...l,isDisabled:o,className:twMerge("group box-border flex w-full cursor-pointer items-center rounded-sm outline-none transition-colors",!c&&d[r],m[a],e==="right"?"justify-end":"justify-start",o&&"pointer-events-none opacity-50"),children:[t&&e==="left"&&jsx(V,{name:t,size:r==="sm"?16:20,className:"mr-3 flex-shrink-0"}),jsxs("div",{className:"flex flex-1 flex-col",children:[jsx("span",{className:i?"font-medium":"",children:n}),i&&jsx("span",{className:"text-sm text-text-secondary",children:i})]}),t&&e==="right"&&jsx(V,{name:t,size:r==="sm"?16:20,className:"ml-3 flex-shrink-0"})]})}var mo=({className:e,size:t=24,color:r="text-action-brand"})=>jsx("div",{className:twMerge("inline-block animate-spin rounded-full border-2 border-solid border-current border-r-transparent",r,e),style:{width:t,height:t},role:"status","aria-label":"loading",children:jsx("span",{className:"sr-only",children:"Loading..."})});function Cr({state:e,message:t,className:r,customIndicator:o}){if(e!=="loading-more")return null;let n=jsxs("div",{className:twMerge("flex items-center justify-center gap-2 py-4","text-text-secondary",r),"aria-label":t||"Loading",children:[jsx(mo,{size:20,color:"text-text-secondary"}),t&&jsx("span",{className:"text-sm","aria-hidden":"true",children:t})]});return o||n}var fa=createContext({variant:"timeline",size:"md"});function nf(){return useContext(fa)}function fs(e){return isValidElement(e)&&e.type===xs}function eS(e){return isValidElement(e)&&e.type===bs}function Cd({variant:e="timeline",size:t="md",className:r,children:o,items:n,renderItem:a,isLoading:i=false,loadingState:s,error:c=null,renderLoadingSkeleton:l,loadingSkeletonCount:d=5,emptyMessage:u="No activity found.",onLoadMore:m,hasMore:p=false,enableVirtualization:g,estimatedItemSize:f,loadingIndicator:x,height:b,maxHeight:h,...y}){let v=useRef(null),{isMobile:S}=Jt(),N=S?"stacked":e,w=n!==void 0&&a!==void 0,{scrollRef:M,loadMoreRef:k,virtualizer:P,virtualItems:I,isLoadingMore:D,computedLoadingState:L}=Ro({items:n||[],onLoadMore:w?m:void 0,hasMore:w?p:false,isLoading:i,loadingState:s,enableVirtualization:w?g:false,estimatedItemSize:f||(N==="stacked"?120:150),overscan:5}),R=w&&M?M:v,B=useMemo(()=>({variant:N,size:t}),[N,t]),Y=N==="timeline"?t==="sm"?"gap-4":"gap-6":"gap-0",H=N==="stacked"?"divide-y divide-border-subtle rounded-lg border border-border-subtle bg-background-surface":"",W={};if(w&&m&&(b?(W.height=typeof b=="number"?`${b}px`:b,W.overflowY="auto"):h?(W.maxHeight=typeof h=="number"?`${h}px`:h,W.overflowY="auto"):(W.height="600px",W.overflowY="auto")),w){let Q=L==="loading"||i&&(!n||n.length===0);if(Q){let E=l?jsx(Fragment,{children:Array.from({length:d}).map((O,A)=>jsx("div",{children:l()},`skeleton-${A}`))}):jsx(Fragment,{children:Array.from({length:d}).map((O,A)=>{let C=t==="sm"?"gap-2":"gap-3";if(N==="timeline"){let F=t==="sm"?"pt-3":"pt-4",z=t==="sm"?"p-3":"p-4";return jsxs("div",{className:"group relative grid items-start gap-4 grid-cols-[3rem_1fr]",children:[jsxs("div",{className:`relative flex h-full flex-col items-center ${F}`,children:[jsx(K,{width:32,height:32,variant:"circle"}),A<d-1&&jsx("span",{className:"absolute top-[2rem] left-1/2 w-0 border-l-2 border-dotted -translate-x-1/2 h-[calc(100%+2.5rem)] border-border-muted"})]}),jsxs("div",{className:`min-w-0 flex flex-col ${C} ${z} rounded-md border border-border-subtle bg-background-surface`,children:[jsxs("div",{className:"flex items-center justify-between gap-3",children:[jsx(K,{width:"50%",height:16}),jsx(K,{width:"15%",height:12})]}),jsx(K,{width:"85%",height:t==="sm"?14:15}),jsx(K,{width:"70%",height:t==="sm"?14:15})]})]},`skeleton-${A}`)}else return jsxs("div",{className:`flex flex-col ${t==="sm"?"px-3 py-3":"px-4 py-4"}`,children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(K,{width:24,height:24,variant:"circle"}),jsx(K,{width:"50%",height:16})]}),jsxs("div",{className:`mt-3 flex flex-col ${C}`,children:[jsx(K,{width:"85%",height:t==="sm"?14:15}),jsx(K,{width:"70%",height:t==="sm"?14:15}),jsx(K,{width:"20%",height:12})]})]},`skeleton-${A}`)})});return jsx(fa.Provider,{value:B,children:jsx("div",{ref:R,"data-slot":"feed","data-variant":N,className:twMerge("flex flex-col",Y,H,r),style:W,...y,children:E})})}if(c)return jsx(fa.Provider,{value:B,children:jsx("div",{ref:R,"data-slot":"feed","data-variant":N,className:twMerge("flex flex-col",Y,H,r),style:W,...y,children:jsx("div",{className:"p-4 text-center text-feedback-error-text",children:c})})});if(!n||n.length===0)return jsx(fa.Provider,{value:B,children:jsx("div",{ref:R,"data-slot":"feed","data-variant":N,className:twMerge("flex flex-col",Y,H,r),style:W,...y,children:jsx("div",{className:"p-4 text-center text-text-secondary",children:u})})});let T=P?I?.map(E=>({virtualItem:E,item:n[E.index],index:E.index}))||[]:n.map((E,O)=>({item:E,index:O,virtualItem:null}));return jsx(fa.Provider,{value:B,children:jsxs("div",{ref:R,"data-slot":"feed","data-variant":N,className:twMerge("flex flex-col",Y,H,r),style:{...W,position:P?"relative":void 0},...y,children:[P?jsxs("div",{style:{height:`${P.getTotalSize()}px`,position:"relative"},children:[T.map(({item:E,index:O,virtualItem:A})=>{if(!E||!A)return null;let C=a(E,O),F=N==="timeline"&&isValidElement(C)&&fs(C)?cloneElement(C,{showConnector:O!==n.length-1}):C;return jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${A.start}px)`},"data-index":A.index,ref:P.measureElement,children:F},`item-${O}`)}),D&&jsx("div",{style:{position:"absolute",top:`${P.getTotalSize()}px`,left:0,width:"100%"},children:x||jsx(Cr,{state:"loading-more"})})]}):jsxs(Fragment,{children:[T.map(({item:E,index:O})=>{let A=a(E,O);if(N==="timeline"&&isValidElement(A)&&fs(A)){let C=O===n.length-1;return jsx("div",{children:cloneElement(A,{showConnector:!C})},`item-${O}`)}return jsx("div",{children:A},`item-${O}`)}),D&&(x||jsx(Cr,{state:"loading-more"}))]}),m&&p&&!Q&&jsx("div",{ref:k,style:P?{position:"absolute",top:`${P.getTotalSize()}px`,left:0,width:"100%",height:1}:{height:1,width:"100%"}})]})})}let Z=Children.toArray(o),q=Z.map((Q,T)=>{if(fs(Q)){let E=Q.props.showConnector??(N==="timeline"&&T<Z.length-1),O=N==="timeline"&&T>0;return cloneElement(Q,{showConnector:E,showIncomingConnector:O})}if(eS(Q)){let E=T===Z.length-1;return cloneElement(Q,{__isLastGroup:E,__isFirstGroup:T===0})}return Q});return jsx(fa.Provider,{value:B,children:jsx("div",{"data-slot":"feed","data-variant":N,className:twMerge("flex flex-col",Y,H,r),...y,children:q})})}Cd.displayName="ActivityFeed";function bs(e){let{variant:t,size:r}=nf(),{title:o,description:n,actions:a,children:i,className:s,__isLastGroup:c=false,__isFirstGroup:l=false,...d}=e,u=Children.toArray(i),m=u.map((f,x)=>{if(fs(f)){let b=f.props.showConnector??(t==="timeline"&&!(c&&x===u.length-1));return cloneElement(f,{showConnector:b,showIncomingConnector:t==="timeline"&&!(l&&x===0)})}return f}),p=t==="timeline"?"pl-[3rem]":r==="sm"?"px-3":"px-4",g=r==="sm"?"gap-3":"gap-4";return jsxs("section",{"data-slot":"group",className:twMerge("flex flex-col",s),...d,children:[(o||n||a)&&jsxs("div",{className:twMerge("mb-2 flex flex-wrap items-end justify-between gap-2",p),children:[jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[o&&jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-text-secondary",children:o}),n&&jsx("span",{className:"text-sm text-text-secondary",children:n})]}),a&&jsx("div",{className:"flex flex-shrink-0 items-center gap-2",children:a})]}),jsx("div",{className:twMerge("flex flex-col",g),children:m})]})}bs.displayName="ActivityFeedGroup";var rf={neutral:"bg-background-muted text-text-secondary border-border-muted",brand:"bg-background-muted text-action-brand border-action-brand/30",success:"bg-background-muted text-feedback-success-text border-feedback-success-border/40",warning:"bg-background-muted text-feedback-warning-text border-feedback-warning-border/40",danger:"bg-background-muted text-feedback-error-text border-feedback-error-border/40",info:"bg-background-muted text-feedback-info-text border-feedback-info-border/40"},tS={neutral:"bg-background-subtle",brand:"bg-action-brand/5",success:"bg-feedback-success-background",warning:"bg-feedback-warning-background",danger:"bg-feedback-error-background",info:"bg-feedback-info-background"},rS={neutral:"border-border-muted",brand:"border-action-brand",success:"border-feedback-success-border",warning:"border-feedback-warning-border",danger:"border-feedback-error-border",info:"border-feedback-info-border"};function xs(e){let{variant:t,size:r}=nf(),{title:o,description:n,timestamp:a,meta:i,media:s,actions:c,visual:l,icon:d,iconWeight:u,tone:m="neutral",surface:p,isHighlighted:g=false,showConnector:f=true,hideIndicator:x=false,interactive:b,className:h,children:y,onKeyDown:v,showIncomingConnector:S,...N}=e,w=l??(d?jsx(V,{name:d,weight:u||"fill",className:"h-4 w-4"}):null),M=p??(t==="stacked"?"minimal":"subtle"),k=r==="sm"?"gap-2":"gap-3",P="text-xs text-text-secondary",I=r==="sm"?"text-sm":"text-[15px]",D="text-xs text-text-secondary",L=b??typeof N.onClick=="function",R=T=>{if(!L){v?.(T);return}T.key===" "?T.preventDefault():T.key==="Enter"&&(T.preventDefault(),T.currentTarget.click()),v?.(T);},B=T=>{L&&T.key===" "&&(T.preventDefault(),T.currentTarget.click());},Y=L?twMerge("group cursor-pointer",Ye()):void 0,W=jsxs("div",{"data-slot":"connector",className:twMerge("relative flex h-full flex-col items-center",M==="minimal"?r==="sm"?"pt-2":"pt-3":r==="sm"?"pt-3":"pt-4"),children:[jsx("span",{"data-slot":"indicator",className:twMerge("relative z-10 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border text-sm font-medium shadow-sm ring-2 ring-background-surface",rf[m]),children:w}),t==="timeline"&&f&&jsx("span",{"data-slot":"separator",className:"absolute top-[2rem] left-1/2 w-0 border-l-2 border-dotted -translate-x-1/2 h-[calc(100%+2.5rem)] border-border-muted"})]}),Z=g?twMerge(tS[m],M==="minimal"?"rounded-md border border-border-muted":rS[m]):"";if(t==="stacked")return jsxs("div",{"data-slot":"item","data-variant":"stacked",role:L?"button":void 0,tabIndex:L?0:void 0,className:twMerge("flex flex-col",r==="sm"?"px-3 py-3":"px-4 py-4",{minimal:"",subtle:"bg-background-subtle",solid:"bg-background-muted"}[M],Z,Y,L?"transition-colors hover:bg-background-subtle/80":"",h),onKeyDown:R,onKeyUp:B,...N,children:[jsxs("div",{className:"flex items-center gap-3",children:[!x&&jsx("span",{"data-slot":"indicator",className:twMerge("flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full border text-sm font-medium shadow-sm ring-2 ring-background-surface",rf[m]),children:w}),jsx("div",{"data-slot":"title",className:"min-w-0 flex-1 text-sm font-semibold text-text-primary",children:o})]}),jsxs("div",{"data-slot":"content",className:twMerge("mt-3 flex flex-col",k),children:[n&&jsx("div",{"data-slot":"description",className:twMerge("text-text-secondary",I),children:n}),i&&jsx("div",{className:D,children:i}),s&&jsx("div",{className:"flex flex-col gap-2 text-sm text-text-secondary",children:s}),y,c&&jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:c}),a&&jsx("div",{className:twMerge("-mt-1.5",P),children:a})]})]});let q=M==="minimal"?r==="sm"?"py-2":"py-3":r==="sm"?"p-3":"p-4",Q={minimal:"",subtle:"rounded-md border border-border-subtle bg-background-surface",solid:"rounded-md bg-background-muted shadow-sm"};return jsxs("div",{"data-slot":"item","data-variant":"timeline",role:L?"button":void 0,tabIndex:L?0:void 0,className:twMerge("group relative grid items-start gap-4 grid-cols-[3rem_1fr]",Y,h),onKeyDown:R,onKeyUp:B,...N,children:[x?jsx("div",{}):W,jsxs("div",{"data-slot":"content",className:twMerge("min-w-0 flex flex-col",k,q,Q[M],Z,L?"transition-colors group-hover:bg-background-subtle/70":""),children:[jsxs("div",{className:"flex items-center justify-between gap-3",children:[jsx("div",{"data-slot":"title",className:"min-w-0 flex-1 text-sm font-semibold text-text-primary",children:o}),a&&jsx("div",{className:twMerge("flex-shrink-0",P),children:a})]}),n&&jsx("div",{"data-slot":"description",className:twMerge("text-text-secondary",I),children:n}),i&&jsx("div",{className:D,children:i}),s&&jsx("div",{className:"flex flex-col gap-2 text-sm text-text-secondary",children:s}),y,c&&jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:c})]})]})}xs.displayName="ActivityItem";function Sr({isOpen:e,onClose:t,title:r,headerContent:o,titleAlign:n="left",hideCloseIcon:a=false,hasBackArrow:i=false,onBack:s,children:c,primaryAction:l,secondaryAction:d,tertiaryAction:u,footerContent:m,transparentOverlay:p=false,maxWidth:g="600px",minWidth:f="400px",maxHeight:x="85vh",height:b,mobileMaxHeight:h="90vh",mobileHeight:y,contentPadding:v=true,className:S}){let N=Yt("(max-width: 767px)"),w=cs(N&&e===void 0),M=w?.height??null,k=w?.keyboardOffset??0,P=useRef(null),I=useCallback(()=>{P.current&&P.current.scrollTop!==0&&(P.current.scrollTop=0);},[]),D=useRef(null),L=useRef(null);useEffect(()=>{let W=L.current;if(!W||!N)return;let Z=null,q=Q=>{let T=Q.target;T&&["INPUT","TEXTAREA","SELECT"].includes(T.tagName)&&(Z&&clearTimeout(Z),Z=setTimeout(()=>{T.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return W.addEventListener("focusin",q),()=>{W.removeEventListener("focusin",q),Z&&clearTimeout(Z);}},[N]);let R=useCallback(()=>{D.current&&D.current.scrollTop!==0&&(D.current.scrollTop=0);},[]);if(e===false)return null;let B=r||o,Y=l||d||u||m,H=e!==void 0;return N?H?jsx(at,{isOpen:e,onClose:t,title:r,headerContent:o,titleAlign:n,hideCloseIcon:a,hasBackArrow:i,onBack:s,primaryAction:l,secondaryAction:d,footerContent:m,transparentOverlay:p,maxHeight:h,height:y,maxWidth:g,contentPadding:v,showHandle:true,animationVariant:"scale",className:S,children:c}):jsx(Vr,{children:jsx(sr,{isDismissable:true,transparent:p,style:{paddingBottom:k>0?`${k}px`:void 0,transition:"padding-bottom 0.25s ease-out"},className:"flex items-end justify-center",children:jsx(Modal,{className:"w-full p-0 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxs(Dialog,{ref:P,onScroll:I,className:twMerge("relative flex w-full flex-col","bg-background-surface","shadow-2xl shadow-black/20","border-t border-x border-border-default/40","rounded-t-xl","overflow-hidden","animate-in slide-in-from-bottom","duration-300 ease-out","data-[exiting]:animate-out data-[exiting]:slide-out-to-bottom","data-[exiting]:duration-200 data-[exiting]:ease-in",S),style:{...y?{height:y}:{maxHeight:/\d/.test(h)?M!==null?`min(${h}, ${Math.max(M-8,0)}px, 100dvh)`:`min(${h}, 100dvh)`:h}},children:[jsx("div",{className:"flex justify-center pt-2",children:jsx("div",{className:"h-1.5 w-12 rounded-full bg-border-muted"})}),B&&(i?jsx(zt,{title:r,headerContent:o,titleAlign:n,hideCloseIcon:a||!t,hasBackArrow:true,onBack:s,onClose:t||(()=>{})}):jsx(zt,{title:r,headerContent:o,titleAlign:n,hideCloseIcon:a||!t,onClose:t||(()=>{})})),jsx("div",{ref:L,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",v?"px-6 py-6":"p-0"),children:c}),Y&&jsx(Eo,{primaryAction:l,secondaryAction:d,tertiaryAction:u,footerContent:m})]})})})}):jsx(Vr,{children:jsx(sr,{...H?{isOpen:e,onOpenChange:W=>{!W&&t&&t();}}:{},isDismissable:true,transparent:p,className:"flex items-center justify-center",children:jsx(Modal,{className:"w-full p-4 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",style:{maxWidth:g},children:jsxs(Dialog,{ref:D,onScroll:R,className:twMerge("relative flex w-full flex-col","bg-background-surface","shadow-2xl shadow-black/20","border border-border-default/50","rounded-md","overflow-hidden","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0","animate-in fade-in zoom-in-96 slide-in-from-bottom-2","duration-300 ease-out","data-[exiting]:animate-out data-[exiting]:fade-out data-[exiting]:zoom-out-95","data-[exiting]:duration-200 data-[exiting]:ease-in",S),style:{minWidth:f,...b?{height:b}:{maxHeight:x}},children:[B&&(i?jsx(zt,{title:r,headerContent:o,titleAlign:n,hideCloseIcon:a||!t,hasBackArrow:true,onBack:s,onClose:t||(()=>{})}):jsx(zt,{title:r,headerContent:o,titleAlign:n,hideCloseIcon:a||!t,onClose:t||(()=>{})})),jsx("div",{className:twMerge("flex-1 min-h-0 overflow-y-auto",v?"px-6 py-6":"p-0"),children:c}),Y&&jsx(Eo,{primaryAction:l,secondaryAction:d,tertiaryAction:u,footerContent:m})]})})})})}function uf({isOpen:e,onClose:t,title:r,message:o,confirmLabel:n="OK",confirmVariant:a="primary",maxWidth:i="400px",minWidth:s="320px"}){return jsx(Sr,{isOpen:e,onClose:t,title:r,maxWidth:i,minWidth:s,primaryAction:{label:n,onPress:t,variant:a},children:jsx("div",{className:"text-text-primary",children:o})})}var Ao={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},lr=memo(({name:e,size:t="md",color:r,weight:o="regular",className:n,ariaLabel:a,...i})=>{let s=nS[e];if(!s)return null;let c=typeof t=="string"?t in Ao?Ao[t]:Ao.md:t,l=twMerge("inline-block flex-shrink-0",!r&&"text-current",n);return jsx(s,{...i,size:c,color:r,weight:o,className:l,"aria-label":a||`${e} icon`,"data-testid":`icon-${e}`})});lr.displayName="IconSSR";var aS=memo(({variant:e="subtle",shape:t="square",containerSize:r,containerClassName:o,size:n="md",className:a,name:i,color:s,weight:c,ariaLabel:l,ref:d,...u})=>{let m=typeof n=="string"?n in Ao?Ao[n]:Ao.md:n,p=r?typeof r=="string"?r in Ao?Ao[r]:m*1.75:r:m*1.75,g=twMerge("inline-flex items-center justify-center flex-shrink-0",t==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-background-muted",e==="solid"&&"bg-action-brand text-[color:var(--color-action-brand-text)]",e==="outline"&&"border-2 border-current",o);return jsx("div",{className:g,style:{width:p,height:p},children:jsx(lr,{...u,name:i,size:n,color:s,weight:c,className:a,ariaLabel:l})})});aS.displayName="IconSSRWithContainer";var ga=({className:e,showWordmark:t=true,width:r,fill:o})=>{let n,a;if(o?o.startsWith("fill-")?a=o:n=o:e?a=e:n="var(--color-text-primary)",t){let c=r||270,l=c/270*80;return jsxs("svg",{width:c,height:l,viewBox:"0 0 270 80",xmlns:"http://www.w3.org/2000/svg",className:a,style:n?{fill:n}:void 0,children:[jsxs("g",{clipPath:"url(#clip0_796_283)",children:[jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.223654 20.2934C0.417233 19.8234 0.873598 19.517 1.37984 19.517H20.5909C21.282 19.517 21.8422 20.0798 21.8422 20.774V40.049C21.8422 40.5572 21.5375 41.0155 21.0702 41.2102C20.6028 41.405 20.0647 41.2977 19.7067 40.9385L0.495628 21.6635C0.137428 21.3041 0.030075 20.7633 0.223654 20.2934ZM4.40349 22.0311L19.3396 37.017V22.0311H4.40349Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 20.2934C38.8394 19.8234 39.2958 19.517 39.802 19.517H59.013C59.7041 19.517 60.2642 20.0798 60.2642 20.774V40.049C60.2642 40.5572 59.9597 41.0155 59.4923 41.2102C59.025 41.405 58.4867 41.2977 58.1289 40.9385L38.9178 21.6635C38.5595 21.3041 38.4522 20.7633 38.6458 20.2934ZM42.8255 22.0311L57.7618 37.017V22.0311H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4347 58.8447C19.6283 58.3747 20.0847 58.0685 20.5909 58.0685H39.802C40.493 58.0685 41.0532 58.6312 41.0532 59.3255V78.6005C41.0532 79.1087 40.7486 79.567 40.2813 79.7617C39.8139 79.9562 39.2757 79.849 38.9178 79.49L19.7067 60.215C19.3485 59.8555 19.2411 59.3147 19.4347 58.8447ZM23.6146 60.5825L38.5508 75.5682V60.5825H23.6146Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 58.1643C39.79 57.9695 40.3283 58.0768 40.6861 58.436L59.8972 77.711C60.2555 78.0703 60.3628 78.6113 60.1692 79.081C59.9756 79.551 59.5192 79.8575 59.013 79.8575H39.802C39.1109 79.8575 38.5508 79.2948 38.5508 78.6005V59.3255C38.5508 58.8173 38.8554 58.359 39.3227 58.1643ZM41.0532 62.3575V77.3433H55.9893L41.0532 62.3575Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 19.6129C39.79 19.4182 40.3283 19.5254 40.6861 19.8846L59.8972 39.1595C60.2555 39.519 60.3628 40.0598 60.1692 40.5298C59.9756 40.9995 59.5192 41.306 59.013 41.306H39.802C39.1109 41.306 38.5508 40.7433 38.5508 40.049V20.7741C38.5508 20.2658 38.8554 19.8075 39.3227 19.6129ZM41.0532 23.8061V38.792H55.9893L41.0532 23.8061Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 38.8885C39.79 38.694 40.3283 38.8012 40.6861 39.1602L59.8972 58.4352C60.2555 58.7945 60.3628 59.3355 60.1692 59.8055C59.9756 60.2752 59.5192 60.5817 59.013 60.5817H39.802C39.1109 60.5817 38.5508 60.019 38.5508 59.3247V40.0497C38.5508 39.5415 38.8554 39.0832 39.3227 38.8885ZM41.0532 43.0817V58.0675H55.9893L41.0532 43.0817Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 39.569C38.8394 39.0992 39.2958 38.7927 39.802 38.7927H59.013C59.7041 38.7927 60.2642 39.3555 60.2642 40.0497V59.3247C60.2642 59.833 59.9597 60.2912 59.4923 60.486C59.025 60.6805 58.4867 60.5732 58.1289 60.2142L38.9178 40.9392C38.5595 40.5797 38.4522 40.039 38.6458 39.569ZM42.8255 41.3067L57.7618 56.2927V41.3067H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 58.8447C38.8394 58.3747 39.2958 58.0685 39.802 58.0685H59.013C59.7041 58.0685 60.2642 58.6312 60.2642 59.3255V78.6005C60.2642 79.1087 59.9597 79.567 59.4923 79.7617C59.025 79.9562 58.4867 79.849 58.1289 79.49L38.9178 60.215C38.5595 59.8555 38.4522 59.3147 38.6458 58.8447ZM42.8255 60.5825L57.7618 75.5682V60.5825H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.5338 19.6129C59.0011 19.4182 59.5394 19.5254 59.8972 19.8846L79.1083 39.1595C79.4666 39.519 79.5739 40.0598 79.3803 40.5298C79.1867 40.9995 78.7303 41.306 78.2241 41.306H59.013C58.322 41.306 57.7618 40.7433 57.7618 40.049V20.7741C57.7618 20.2658 58.0664 19.8075 58.5338 19.6129ZM60.2643 23.8061V38.792H75.2006L60.2643 23.8061Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.5338 0.338803C59.0011 0.144135 59.5394 0.251385 59.8972 0.610565L79.1083 19.8855C79.4666 20.2449 79.5739 20.7857 79.3803 21.2556C79.1867 21.7256 78.7303 22.032 78.2241 22.032H59.013C58.322 22.032 57.7618 21.4692 57.7618 20.775V1.50003C57.7618 0.99174 58.0664 0.533468 58.5338 0.338803ZM60.2643 4.53208V19.5179H75.2006L60.2643 4.53208Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M57.8569 20.2934C58.0505 19.8234 58.5069 19.517 59.013 19.517H78.2241C78.9151 19.517 79.4753 20.0798 79.4753 20.774V40.049C79.4753 40.5572 79.1707 41.0155 78.7034 41.2102C78.236 41.405 77.6978 41.2977 77.3399 40.9385L58.1289 21.6635C57.7705 21.3041 57.6633 20.7633 57.8569 20.2934ZM62.0365 22.0311L76.9729 37.017V22.0311H62.0365Z"}),jsx("path",{d:"M269.838 49.4457H249.005C249.266 51.801 250.162 53.6985 251.695 55.1377C253.225 56.577 255.134 57.2967 257.416 57.2967C259.307 57.2967 260.887 56.8715 262.159 56.021C263.463 55.1377 264.408 53.9927 264.996 52.5862H269.251C268.502 54.9415 267.084 56.937 264.996 58.5725C262.943 60.208 260.414 61.026 257.416 61.026C255.069 61.026 252.917 60.4697 250.961 59.3575C249.037 58.2127 247.504 56.6587 246.363 54.696C245.255 52.7332 244.7 50.558 244.7 48.17C244.7 45.782 245.255 43.6067 246.363 41.644C247.504 39.6812 249.037 38.1437 250.961 37.0315C252.917 35.8867 255.069 35.3142 257.416 35.3142C259.73 35.3142 261.833 35.8702 263.724 36.9825C265.615 38.0947 267.098 39.6485 268.176 41.644C269.283 43.6395 269.838 45.913 269.838 48.4645V49.4457ZM257.416 39.0432C255.263 39.0432 253.439 39.6812 251.939 40.957C250.47 42.2327 249.542 43.9337 249.152 46.06H265.583C265.192 43.9992 264.262 42.3145 262.796 41.006C261.36 39.6975 259.568 39.0432 257.416 39.0432Z"}),jsx("path",{d:"M228.356 60.5352V35.8049H232.219V39.7794H232.464C233.05 38.5689 233.963 37.5712 235.202 36.7862C236.474 35.9684 237.974 35.5594 239.701 35.5594H243.125V39.4359H239.701C237.517 39.4359 235.757 40.1554 234.42 41.5949C233.083 43.0342 232.414 44.9152 232.414 47.2377V60.5352H228.356Z"}),jsx("path",{d:"M208.607 61.0259C205.64 61.0259 203.326 60.1262 201.663 58.3272C200 56.4952 199.169 53.8947 199.169 50.5252V35.8047H203.228V49.8874C203.228 52.2427 203.766 54.0744 204.842 55.3829C205.95 56.6587 207.532 57.2967 209.586 57.2967C211.02 57.2967 212.308 56.9694 213.449 56.3152C214.623 55.6284 215.536 54.6959 216.188 53.5184C216.84 52.3407 217.166 50.9997 217.166 49.4949V35.8047H221.225V60.5352H217.313V56.5607H217.068C216.286 57.9019 215.161 58.9814 213.694 59.7992C212.226 60.6169 210.531 61.0259 208.607 61.0259Z"}),jsx("path",{d:"M186.736 39.534V56.806H194.756V60.5352H182.677V39.534H177.199V35.8047H182.677V29.5732H186.736V35.8047H193.24V39.534H186.736Z"}),jsx("path",{d:"M156.585 60.5352H151.988L158.394 48.0227L152.33 35.8047H156.976L162.062 46.0599H165.388L170.474 35.8047H175.022L168.958 48.0227L175.365 60.5352H170.67L165.29 49.7892H162.013L156.585 60.5352Z"}),jsx("path",{d:"M150.138 49.1315H129.304C129.565 51.4867 130.461 53.3842 131.994 54.8235C133.526 56.2627 135.433 56.9825 137.715 56.9825C139.606 56.9825 141.188 56.5572 142.459 55.7067C143.763 54.8235 144.709 53.6785 145.296 52.272H149.551C148.801 54.6272 147.382 56.6227 145.296 58.2582C143.242 59.8937 140.715 60.7118 137.715 60.7118C135.368 60.7118 133.216 60.1555 131.26 59.0432C129.336 57.8985 127.804 56.3445 126.663 54.3817C125.554 52.419 125 50.2437 125 47.8557C125 45.4677 125.554 43.2925 126.663 41.3298C127.804 39.367 129.336 37.8295 131.26 36.7173C133.216 35.5725 135.368 35 137.715 35C140.03 35 142.133 35.556 144.024 36.6682C145.915 37.7805 147.399 39.3342 148.475 41.3298C149.583 43.3252 150.138 45.5987 150.138 48.1502V49.1315ZM137.715 38.729C135.564 38.729 133.738 39.367 132.238 40.6427C130.771 41.9185 129.842 43.6195 129.45 45.7458H145.883C145.491 43.685 144.562 42.0002 143.095 40.6917C141.661 39.3832 139.867 38.729 137.715 38.729Z"}),jsx("path",{d:"M116.961 60.5353H112.559V30.4072H101.164V26.1875H128.307V30.4072H116.961V60.5353Z"})]}),jsx("defs",{children:jsx("clipPath",{id:"clip0_796_283",children:jsx("rect",{width:"270",height:"80",fill:"white"})})})]})}let i=r||80;return jsxs("svg",{width:i,height:i,viewBox:"0 0 80 80",xmlns:"http://www.w3.org/2000/svg",className:a,style:n?{fill:n}:void 0,children:[jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.223654 20.2934C0.417233 19.8234 0.873598 19.517 1.37984 19.517H20.5909C21.282 19.517 21.8422 20.0798 21.8422 20.774V40.049C21.8422 40.5572 21.5375 41.0155 21.0702 41.2102C20.6028 41.405 20.0647 41.2977 19.7067 40.9385L0.495628 21.6635C0.137428 21.3041 0.030075 20.7633 0.223654 20.2934ZM4.40349 22.0311L19.3396 37.017V22.0311H4.40349Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 20.2934C38.8394 19.8234 39.2958 19.517 39.802 19.517H59.013C59.7041 19.517 60.2642 20.0798 60.2642 20.774V40.049C60.2642 40.5572 59.9597 41.0155 59.4923 41.2102C59.025 41.405 58.4867 41.2977 58.1289 40.9385L38.9178 21.6635C38.5595 21.3041 38.4522 20.7633 38.6458 20.2934ZM42.8255 22.0311L57.7618 37.017V22.0311H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4347 58.8447C19.6283 58.3747 20.0847 58.0685 20.5909 58.0685H39.802C40.493 58.0685 41.0532 58.6312 41.0532 59.3255V78.6005C41.0532 79.1087 40.7486 79.567 40.2813 79.7617C39.8139 79.9562 39.2757 79.849 38.9178 79.49L19.7067 60.215C19.3485 59.8555 19.2411 59.3147 19.4347 58.8447ZM23.6146 60.5825L38.5508 75.5682V60.5825H23.6146Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 58.1643C39.79 57.9695 40.3283 58.0768 40.6861 58.436L59.8972 77.711C60.2555 78.0703 60.3628 78.6113 60.1692 79.081C59.9756 79.551 59.5192 79.8575 59.013 79.8575H39.802C39.1109 79.8575 38.5508 79.2948 38.5508 78.6005V59.3255C38.5508 58.8173 38.8554 58.359 39.3227 58.1643ZM41.0532 62.3575V77.3433H55.9893L41.0532 62.3575Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 19.6129C39.79 19.4182 40.3283 19.5254 40.6861 19.8846L59.8972 39.1595C60.2555 39.519 60.3628 40.0598 60.1692 40.5298C59.9756 40.9995 59.5192 41.306 59.013 41.306H39.802C39.1109 41.306 38.5508 40.7433 38.5508 40.049V20.7741C38.5508 20.2658 38.8554 19.8075 39.3227 19.6129ZM41.0532 23.8061V38.792H55.9893L41.0532 23.8061Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M39.3227 38.8885C39.79 38.694 40.3283 38.8012 40.6861 39.1602L59.8972 58.4352C60.2555 58.7945 60.3628 59.3355 60.1692 59.8055C59.9756 60.2752 59.5192 60.5817 59.013 60.5817H39.802C39.1109 60.5817 38.5508 60.019 38.5508 59.3247V40.0497C38.5508 39.5415 38.8554 39.0832 39.3227 38.8885ZM41.0532 43.0817V58.0675H55.9893L41.0532 43.0817Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 39.569C38.8394 39.0992 39.2958 38.7927 39.802 38.7927H59.013C59.7041 38.7927 60.2642 39.3555 60.2642 40.0497V59.3247C60.2642 59.833 59.9597 60.2912 59.4923 60.486C59.025 60.6805 58.4867 60.5732 58.1289 60.2142L38.9178 40.9392C38.5595 40.5797 38.4522 40.039 38.6458 39.569ZM42.8255 41.3067L57.7618 56.2927V41.3067H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.6458 58.8447C38.8394 58.3747 39.2958 58.0685 39.802 58.0685H59.013C59.7041 58.0685 60.2642 58.6312 60.2642 59.3255V78.6005C60.2642 79.1087 59.9597 79.567 59.4923 79.7617C59.025 79.9562 58.4867 79.849 58.1289 79.49L38.9178 60.215C38.5595 59.8555 38.4522 59.3147 38.6458 58.8447ZM42.8255 60.5825L57.7618 75.5682V60.5825H42.8255Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.5338 19.6129C59.0011 19.4182 59.5394 19.5254 59.8972 19.8846L79.1083 39.1595C79.4666 39.519 79.5739 40.0598 79.3803 40.5298C79.1867 40.9995 78.7303 41.306 78.2241 41.306H59.013C58.322 41.306 57.7618 40.7433 57.7618 40.049V20.7741C57.7618 20.2658 58.0664 19.8075 58.5338 19.6129ZM60.2643 23.8061V38.792H75.2006L60.2643 23.8061Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.5338 0.338803C59.0011 0.144135 59.5394 0.251385 59.8972 0.610565L79.1083 19.8855C79.4666 20.2449 79.5739 20.7857 79.3803 21.2556C79.1867 21.7256 78.7303 22.032 78.2241 22.032H59.013C58.322 22.032 57.7618 21.4692 57.7618 20.775V1.50003C57.7618 0.99174 58.0664 0.533468 58.5338 0.338803ZM60.2643 4.53208V19.5179H75.2006L60.2643 4.53208Z"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M57.8569 20.2934C58.0505 19.8234 58.5069 19.517 59.013 19.517H78.2241C78.9151 19.517 79.4753 20.0798 79.4753 20.774V40.049C79.4753 40.5572 79.1707 41.0155 78.7034 41.2102C78.236 41.405 77.6978 41.2977 77.3399 40.9385L58.1289 21.6635C57.7705 21.3041 57.6633 20.7633 57.8569 20.2934ZM62.0365 22.0311L76.9729 37.017V22.0311H62.0365Z"})]})};var ys=({topItems:e=[],bottomItems:t=[],bottomContent:r,logo:o,showLogo:n=true,linkComponent:a="a",className:i="",mobileMenuId:s="app-mobile-menu",sidebarCollapseId:c="app-sidebar-collapse"})=>{let l=p=>p.length>0&&"items"in p[0],d=p=>l(p)?p:[{id:"default-section",items:p}],u=(p,g,f)=>jsxs("div",{className:"space-y-0.5",children:[p.title&&jsx("div",{className:"px-6 py-1 text-xs font-medium text-text-secondary uppercase tracking-wider",children:p.title}),jsx("div",{className:"space-y-0.5",children:p.items.map(x=>m(x))}),g<f-1&&jsx("div",{className:"border-b border-border-subtle mx-6 my-2"})]},p.id),m=(p,g=false)=>{if(p.children&&p.children.length>0){let b=`category-${p.id}`;return jsxs("div",{className:"group/category",children:[jsx("input",{type:"checkbox",id:b,className:"peer/category hidden",defaultChecked:p.isExpanded,"aria-hidden":"true"}),jsxs("label",{htmlFor:b,className:"flex items-center gap-3 px-6 py-1 text-text-primary hover:bg-background-hover hover:text-text-primary cursor-pointer transition-all duration-200",children:[p.icon&&jsx("span",{className:"flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center transition-all duration-200",children:p.icon}),jsx("span",{className:"transition-all duration-200",children:p.label}),jsx("span",{className:"flex-1"}),jsx("svg",{className:"w-4 h-4 transform transition-transform duration-200 peer-checked/category:rotate-180 ml-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),jsx("div",{className:"hidden peer-checked/category:block bg-background-subtle border-l-2 border-border-subtle ml-6",children:p.children.map(h=>m(h,true))})]},p.id)}let f={href:p.href||"#",className:`flex items-center gap-3 transition-all duration-200 hover:bg-background-hover ${g?"pl-8 pr-6 py-1 text-sm":"px-6 py-1"} ${p.isActive?`bg-action-brand/10 text-action-brand ${g?"":"border-l-2 border-action-brand"}`:"text-text-primary hover:text-text-primary"}`,"aria-current":p.isActive?"page":void 0},x=jsxs(Fragment,{children:[p.icon&&!g&&jsx("span",{className:"flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center transition-all duration-200",children:p.icon}),jsx("span",{className:"transition-all duration-200",children:p.label})]});return a==="a"?jsx("a",{...f,children:x},p.id):jsx(a,{...f,children:x},p.id)};return jsxs("div",{className:`flex flex-col h-full ${i}`,children:[jsxs("div",{className:"flex items-center justify-between h-[60px] px-6 border-b border-border-default",children:[n&&jsx("div",{className:"relative top-[-1px] transition-all duration-200",children:o||jsx(ga,{showWordmark:true,width:120})}),jsx("label",{htmlFor:c,className:"hidden md:flex items-center justify-center w-8 h-8 rounded hover:bg-background-hover cursor-pointer transition-all duration-200 relative top-[-1px]","aria-label":"Collapse sidebar",children:jsx(lr,{name:"Sidebar",size:"sm"})}),jsx("label",{htmlFor:s,className:"md:hidden flex items-center justify-center w-8 h-8 rounded hover:bg-background-hover cursor-pointer transition-colors","aria-label":"Close menu",children:jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),jsxs("nav",{className:"flex-1 flex flex-col overflow-hidden",children:[e&&e.length>0&&jsx("div",{className:"flex-1 overflow-y-auto py-2 scrollbar-hide",children:d(e).map((p,g,f)=>u(p,g,f.length))}),t&&t.length>0&&jsx("div",{className:"flex-shrink-0 border-t bg-background-muted/30",children:jsx("div",{className:"mt-2 pb-2 space-y-0.5",children:t.map(p=>m(p))})}),r&&jsx("div",{className:"flex-shrink-0 border-t border-border-default",children:jsx("div",{children:r})})]})]})};function mn(e){return e.id??e.href??e.label}function kd(e,t,r=[]){for(let o of e){if(o.href===t||o.id===t)return o.children?.length&&o.pushOnSelect!==false?[...r,mn(o)]:r;if(o.children?.length){let n=kd(o.children,t,[...r,mn(o)]);if(n)return n}}return null}function bf(e,t){let r=[],o=e;for(let n of t){let a=o.find(i=>mn(i)===n);if(!a)break;r.push(a),o=a.children??[];}return r}function sS(e,t,r){let o=t.length>0?[...e,...t]:e,n=[{path:[],items:e,bottomItems:t.length>0?t:void 0}],a=bf(o,r),i=[];for(let s of a){if(!s.children?.length)break;i=[...i,mn(s)],n.push({path:i,parent:s,items:s.children});}return n}var lS=({href:e,...t})=>jsx("a",{href:e,...t}),ff=[];function cS(e){let t=[];for(let r of e){let o=r.items??[];o.length!==0&&(t.length>0&&t.push({id:`__divider__${r.id}`,label:"",divider:true}),r.title&&t.push({id:`__group__${r.id}`,label:r.title,groupLabel:true}),t.push(...o));}return t}function dS(e,t){if(process.env.NODE_ENV==="production"||t.length===0)return;let r=new Map;for(let o of e)o.id&&r.set(o.id,"id"),o.href&&!r.has(o.href)&&r.set(o.href,"href");for(let o of t){let n=null;o.id&&r.has(o.id)?n=r.get(o.id)==="id"?`id "${o.id}"`:`id "${o.id}" (matches an items \`href\`)`:o.href&&r.has(o.href)&&(n=r.get(o.href)==="href"?`href "${o.href}"`:`href "${o.href}" (matches an items \`id\`)`),n&&console.warn(`[StackNav] L1 ${n} appears in both \`items\` and \`bottomItems\`. Stack tokens and value lookups will resolve to the \`items\` entry, making the bottomItems entry unreachable. L1 ids and hrefs must be unique across both arrays.`);}}function uS(e){if(!e)return {};let t={};return e.background!==void 0&&(t["--edges-stack-nav-background"]=e.background),e.activeBackground!==void 0&&(t["--edges-stack-nav-row-active-background"]=e.activeBackground),e.activeColor!==void 0&&(t["--edges-stack-nav-row-active-color"]=e.activeColor),e.hoverBackground!==void 0&&(t["--edges-stack-nav-row-hover-background"]=e.hoverBackground),e.borderColor!==void 0&&(t["--edges-stack-nav-border-color"]=e.borderColor),t}function vs({items:e,groups:t,bottomItems:r,value:o,defaultStack:n,stack:a,onStackChange:i,onSelect:s,linkComponent:c=lS,showLogo:l=false,logo:d,header:u,footer:m,mobileMenuId:p,sidebarCollapseId:g,rootLabel:f,sticky:x=true,width:b=260,ariaLabel:h="Navigation",theme:y,animated:v=true,style:S,className:N}){process.env.NODE_ENV!=="production"&&t&&e&&console.warn("[StackNav] Both `items` and `groups` were provided. `groups` takes precedence and `items` is ignored.");let w=Oe.useMemo(()=>t?cS(t):e??ff,[t,e]),M=r??ff,k=Oe.useMemo(()=>M.length>0?[...w,...M]:w,[w,M]);Oe.useEffect(()=>{dS(w,M);},[w,M]);let[P,I]=Oe.useState(()=>a!==void 0?a:n!==void 0?n:o?kd(k,o)??[]:[]),D=a??P,L=Oe.useCallback(T=>{a===void 0&&I(T),i?.(T);},[a,i]),R=Oe.useRef(false);Oe.useEffect(()=>{if(a!==void 0||!R.current&&(R.current=true,n!==void 0)||!o)return;let T=kd(k,o);I(E=>{let O=T??[];return gS(E,O)?E:O});},[o,k,a,n]);let B=Oe.useMemo(()=>sS(w,M,D),[w,M,D]),Y=Oe.useCallback((T,E)=>{T.children?.length&&L([...E,mn(T)]);},[L]),H=Oe.useCallback(()=>{L(D.slice(0,-1));},[D,L]),W=Oe.useCallback((T,E)=>{let O=bf(k,D);if(s?.(E,O),!!E.children?.length){let C=B[B.length-1]?.path??[];Y(E,C);}E.href||T.preventDefault();},[k,D,s,Y,B]),Z=Oe.useCallback(T=>o?T.href===o||T.id===o:false,[o]),q=x?"sticky top-0 h-[100dvh]":"",Q={...b!=null?{width:b}:{},...uS(y),...S};return jsxs("aside",{role:"navigation","aria-label":h,"data-edges-stack-nav":"",className:twMerge("edges-stack-nav flex flex-col flex-shrink-0 overflow-hidden",v&&"edges-stack-nav--animated",q,N),style:Q,children:[l?jsxs("div",{className:"edges-stack-nav__logo",children:[jsx("div",{className:"relative top-[-1px]",children:d??jsx(ga,{showWordmark:true,width:120})}),g?jsx("label",{htmlFor:g,className:"hidden md:flex items-center justify-center w-8 h-8 rounded hover:bg-background-hover cursor-pointer transition-all duration-200 relative top-[-1px]","aria-label":"Collapse sidebar",children:jsx(lr,{name:"Sidebar",size:"sm"})}):null,p?jsx("label",{htmlFor:p,className:"md:hidden flex items-center justify-center w-8 h-8 rounded hover:bg-background-hover cursor-pointer transition-colors","aria-label":"Close menu",children:jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}):null]}):null,u?jsx("div",{className:"edges-stack-nav__header",children:u}):null,jsx("div",{className:"relative flex-1 overflow-hidden",children:B.map((T,E)=>{let O=T.path.length,A=E===B.length-1,C=E<B.length-1,F=O===0?"__root__":T.path.join("/");return jsx(pS,{pane:T,parentPath:T.path.slice(0,-1),depth:O,isTop:A,isAbove:C,rootLabel:f,LinkComponent:c,isActive:Z,onSelect:W,onBack:H,animated:v},F)})}),m?jsx("div",{className:"edges-stack-nav__footer",children:m}):null]})}function pS({pane:e,depth:t,isTop:r,isAbove:o,rootLabel:n,LinkComponent:a,isActive:i,onSelect:s,onBack:c,animated:l}){let d=r?"edges-stack-nav__pane--top":o?"edges-stack-nav__pane--above":"edges-stack-nav__pane--below";return jsxs("nav",{"aria-label":e.parent?.label??n??"Navigation","aria-hidden":r?void 0:true,inert:r?void 0:true,className:twMerge("edges-stack-nav__pane absolute inset-0 flex flex-col gap-px overflow-y-auto px-2 py-3",!l&&"edges-stack-nav__pane--instant",d),children:[t>0&&e.parent?jsxs("button",{type:"button",className:"edges-stack-nav__back edges-stack-nav__row flex w-full cursor-pointer items-center gap-2 rounded-sm border-0 bg-transparent px-3 py-2 mb-2 text-left text-sm font-semibold text-text-primary",onClick:c,"aria-label":`Back from ${e.parent.label}`,children:[jsx(fS,{}),jsx("span",{children:e.parent.label})]}):n?jsx("div",{className:"px-3 pb-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-text-secondary",children:n}):null,e.items.map(u=>jsx(gf,{item:u,LinkComponent:a,isActive:i(u),onSelect:s},mn(u))),e.bottomItems&&e.bottomItems.length>0?jsx("div",{className:"edges-stack-nav__bottom-items mt-auto flex flex-col gap-px pt-3",children:e.bottomItems.map(u=>jsx(gf,{item:u,LinkComponent:a,isActive:i(u),onSelect:s},mn(u)))}):null]})}function gf({item:e,LinkComponent:t,isActive:r,onSelect:o}){if(e.divider)return jsx("div",{className:"edges-stack-nav__divider my-2",role:"separator"});if(e.groupLabel)return jsx("div",{className:"px-3 pt-6 pb-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-text-secondary",children:e.label});let n=!!e.children?.length,a=twMerge("edges-stack-nav__row flex items-center justify-between gap-3 rounded-sm px-3 py-2 text-sm font-normal text-text-primary no-underline cursor-pointer text-left bg-transparent border-0 transition-colors",r&&"edges-stack-nav__row--active font-semibold"),i=jsxs(Fragment,{children:[jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.leading??e.icon?jsx("span",{className:"inline-flex items-center flex-shrink-0",children:e.leading??e.icon}):null,jsx("span",{className:"truncate",children:e.label})]}),jsxs("span",{className:"flex flex-shrink-0 items-center gap-2 text-text-secondary",children:[e.trailing,n?jsx(mS,{}):null]})]});return e.href?jsx(t,{href:e.href,"aria-label":e.ariaLabel,className:a,"aria-current":r?"page":void 0,onClick:s=>o(s,e),children:i}):jsx("button",{type:"button",className:a,"aria-label":e.ariaLabel,onClick:s=>{o(s,e);},children:i})}function mS(){return jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M4.5 3 7.5 6 4.5 9"})})}function fS(){return jsx("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M8.5 3 4.5 7 8.5 11"})})}function gS(e,t){if(e===t)return true;if(e.length!==t.length)return false;for(let r=0;r<e.length;r+=1)if(e[r]!==t[r])return false;return true}var ni=({rightContent:e,centerContent:t,showMobileMenu:r=true,avatar:o,showColorModeSwitcher:n=false,toggleTheme:a,isDarkThemeEnabled:i=false,colorMode:s,actions:c,className:l="",mobileMenuId:d="app-mobile-menu"})=>{let u=()=>{switch(s||(i?"dark":"light")){case "system":return jsx(lr,{name:"Monitor",size:"sm"});case "light":return jsx(lr,{name:"Sun",size:"sm"});case "dark":return jsx(lr,{name:"Moon",size:"sm"})}},m=()=>{switch(s||(i?"dark":"light")){case "system":return "Switch to light mode";case "light":return "Switch to dark mode";case "dark":return "Switch to system mode";default:return "Toggle theme"}};return jsx("header",{className:`h-[60px] bg-background-surface border-b ${l}`,children:jsxs("div",{className:"relative flex h-full items-center",children:[jsx("div",{className:"flex items-center h-full flex-shrink-0",children:r&&jsx("label",{htmlFor:d,className:"md:hidden cursor-pointer","aria-label":"Open menu",children:jsx("div",{className:"flex h-full w-14 flex-col items-center justify-center border-r hover:bg-background-hover transition-colors",children:jsx(lr,{name:"List",size:"sm"})})})}),t&&jsx("div",{className:"flex-1 flex justify-end md:justify-center md:px-4 min-w-0",children:jsx("div",{className:"w-full md:max-w-4xl min-w-0",children:t})}),!t&&jsx("div",{className:"flex-1"}),jsxs("div",{className:"flex items-center gap-4 pr-4 flex-shrink-0 ml-4",children:[e,n&&a&&jsx("button",{type:"button",onClick:a,className:"flex items-center justify-center w-8 h-8 rounded hover:bg-background-hover transition-colors","aria-label":m(),children:u()}),c,o&&jsx("div",{className:"flex items-center",children:o})]})]})})};function hf({sideNav:e,stackNav:t,topNav:r,children:o,contentPaddingX:n,contentPaddingY:a,showSidebarBorder:i=true,mainClassName:s,enableJsEnhancements:c=false}){let l="app-mobile-menu",d="app-sidebar-collapse";return useEffect(()=>{if(!c)return;let u=document.getElementById(d),m=document.getElementById(l),p=document.querySelector("[data-app-shell]"),g=document.getElementById("app-sidebar");if(!u||!p||!g)return;let f=null,x=false;try{let P=localStorage.getItem("sidebar-collapsed");P!==null&&(u.checked=P==="true");}catch{}let b=()=>{try{localStorage.setItem("sidebar-collapsed",String(u.checked));}catch{}u.checked?x=true:(f&&(clearTimeout(f),f=null),p.removeAttribute("data-peek"),x=false);};u.addEventListener("change",b);let h=P=>{P.key==="Escape"&&(m&&(m.checked=false),p.removeAttribute("data-peek"));};document.addEventListener("keydown",h);let y=null;m&&(y=()=>{document.body.style.overflow=m.checked?"hidden":"";},m.addEventListener("change",y));let v=P=>{let D=P.target.closest("a");D&&D.href&&window.innerWidth<768&&m&&setTimeout(()=>{m.checked=false,document.body.style.overflow="";},100);};g.addEventListener("click",v);let S=16,N=200,w=()=>{f&&(clearTimeout(f),f=null),p.getAttribute("data-peek")!=="true"&&p.setAttribute("data-peek","true");},M=()=>{f&&clearTimeout(f),f=setTimeout(()=>{p.removeAttribute("data-peek"),f=null;},N);},k=P=>{if(window.innerWidth<768||!u.checked)return;let I=g.contains(P.target);if(x&&!I&&(x=false),x)return;P.clientX<=S||I?w():p.getAttribute("data-peek")==="true"&&M();};return document.addEventListener("mousemove",k),()=>{u.removeEventListener("change",b),document.removeEventListener("keydown",h),m&&y&&m.removeEventListener("change",y),g.removeEventListener("click",v),document.removeEventListener("mousemove",k),f&&clearTimeout(f);}},[c,l,d]),jsxs("div",{className:"min-h-[100dvh] bg-background text-text-primary relative","data-app-shell":"",children:[jsx("input",{type:"checkbox",id:d,className:"sr-only peer/sidebar","aria-hidden":"true"}),jsx("a",{href:"#app-content",className:"sr-only focus:not-sr-only focus:absolute focus:left-4 focus:top-4 z-50 rounded px-3 py-2 bg-background-surface shadow",children:"Skip to content"}),jsx(ni,{...r,mobileMenuId:l,className:["sticky top-0 flex-shrink-0 z-30 md:hidden",r?.className].filter(Boolean).join(" ")}),jsxs("div",{className:"flex w-full h-[calc(100dvh-60px)] md:h-[100dvh] relative overflow-hidden",children:[jsx("input",{type:"checkbox",id:l,className:"sr-only peer/mobile","aria-hidden":"true"}),jsx("label",{htmlFor:l,className:"fixed inset-0 bg-background-modal z-[55] opacity-0 pointer-events-none peer-checked/mobile:opacity-100 peer-checked/mobile:pointer-events-auto transition-opacity md:hidden","aria-label":"Close menu"}),jsx("div",{"aria-hidden":"true","data-peek-zone":"",className:"hidden md:block fixed left-0 top-0 bottom-0 w-4 z-[70] pointer-events-none"}),jsx("label",{htmlFor:d,"data-expand-rail":"",className:"hidden fixed left-3 top-3 z-[75] items-center justify-center w-9 h-9 rounded-md bg-background-surface border border-border-default shadow-sm hover:bg-background-hover cursor-pointer transition-all duration-200","aria-label":"Expand sidebar",children:jsx(lr,{name:"Sidebar",size:"sm"})}),jsx("aside",{id:"app-sidebar","data-app-sidebar":"",className:["bg-background-surface","border-r border-border-default","transition-transform duration-300 ease-in-out md:transition-[transform,width] md:duration-300 md:ease-in-out","fixed md:relative","left-0 top-0 bottom-0","z-[60] md:z-10","w-full md:w-64","h-[100dvh] md:h-full","-translate-x-full","peer-checked/mobile:translate-x-0","md:translate-x-0",i?"":"!border-r-0",(t??e)?.className||""].filter(Boolean).join(" "),children:t?jsx(vs,{...t,mobileMenuId:l,sidebarCollapseId:d,sticky:false,width:null,className:["h-full !border-r-0",t.className].filter(Boolean).join(" ")}):jsx(ys,{...e,mobileMenuId:l,sidebarCollapseId:d,className:"h-full"})}),jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden",children:[jsx("div",{className:"sticky top-0 flex-shrink-0 hidden md:block z-20","data-top-nav-wrapper":"",children:jsx(ni,{...r,className:r?.className})}),jsx("main",{id:"app-content",className:["flex-1 overflow-y-auto overflow-x-hidden bg-background-body scrollbar-visible",n,a,s||""].join(" "),role:"main",children:o})]})]}),jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
3
3
|
@media (min-width: 768px) {
|
|
4
4
|
/* Collapsed: hide the rail offscreen, surface the floating expand
|
|
5
5
|
button, and let the edge zone receive hover events. */
|
|
@@ -24,7 +24,7 @@ import {TooltipTrigger,Tooltip,OverlayArrow,composeRenderProps,DialogTrigger,Men
|
|
|
24
24
|
z-index: 50;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
`}})]})}function Cs(e,t=300){let[r,o]=useState(false);return useEffect(()=>{if(e){let n=setTimeout(()=>{o(true);},t);return ()=>clearTimeout(n)}o(false);},[e,t]),r}var NS=({isEntering:e,isExiting:t,className:r})=>["max-w-[200px] group bg-action-default border border-action-default-hover text-[color:var(--color-action-default-text)] text-sm rounded-lg drop-shadow-lg will-change-transform px-3 py-1",e?"animate-in fade-in placement-bottom:slide-in-from-top-0.5 placement-top:slide-in-from-bottom-0.5 placement-left:slide-in-from-right-0.5 placement-right:slide-in-from-left-0.5 ease-out duration-200":"",t?"animate-out fade-out placement-bottom:slide-out-to-top-0.5 placement-top:slide-out-to-bottom-0.5 placement-left:slide-out-to-right-0.5 placement-right:slide-out-to-left-0.5 ease-in duration-150":"",r].filter(Boolean).join(" ");function Qt({children:e,content:t,...r}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...r,offset:10,className:composeRenderProps(r.className,(o,n)=>NS({...n,className:o})),children:[jsx(OverlayArrow,{children:jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-action-default stroke-action-default-hover group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L4 4 L8 0"})})}),t]})]})}function Nr(){let[e,t]=Oe__default.useState(false),r=Oe__default.useCallback((n,a)=>{t(true),a?.(n);},[]),o=Oe__default.useCallback((n,a)=>{t(false),a?.(n);},[]);return {isFocused:e,handleFocus:r,handleBlur:o}}var bt=Oe__default.forwardRef(({children:e,className:t},r)=>jsx("div",{ref:r,className:twMerge("relative w-full",t),children:e}));bt.displayName="InputWrapper";function ai({onClick:e,size:t="md",className:r}){return jsx("button",{type:"button",onClick:o=>{o.preventDefault(),o.stopPropagation(),e();},className:twMerge("absolute right-2 top-[48%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary cursor-pointer",r),"aria-label":"Clear input",onMouseDown:o=>{o.preventDefault(),o.stopPropagation();},children:jsx(V,{name:"X",size:t==="sm"?16:20})})}function Io(e){let{isInvalid:t,isDisabled:r,isFocused:o}=e,n="border rounded-[var(--control-border-radius)] !outline-none ";return r?`${n} border-border-muted`:t&&o?`${n} border-feedback-error-border shadow-[inset_0_0_0_1px_var(--color-feedback-error-border)]`:t?`${n} border-feedback-error-border`:o?`${n} border-border-focus shadow-[inset_0_0_0_1px_var(--color-border-focus)]`:`${n} border-border-input`}function vf(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function kS(e){return e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":""}function Ft(e){let{isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:a="md",className:i}=e;return twMerge("w-full",Io({isInvalid:t,isDisabled:r,isFocused:o}),vf({transparent:n,isDisabled:r}),We[a].text,We[a].height,We[a].padding,kS(a),i)}function TS(e){let{size:t="md",isFocusWithin:r,isInvalid:o,isDisabled:n,transparent:a,className:i}=e;return twMerge("group flex items-center rounded-[var(--control-border-radius)] overflow-hidden",vf({transparent:a,isDisabled:n}),We[t].height,Io({isFocused:r,isInvalid:o,isDisabled:n}),i)}function ze({children:e,size:t="md",tooltip:r,description:o,descriptionPlacement:n="below",isRequired:a,className:i,htmlFor:s}){let c=r||o&&n==="tooltip",l=r||o,d=o&&n==="inline",u=jsxs("label",{htmlFor:s,className:twMerge(We[t].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,a&&jsx("span",{children:"*"}),c&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(V,{name:"Info",size:t==="sm"?16:20})}),d&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:o})]});return c&&l?jsx(Qt,{content:l,children:u}):u}function Te({size:e="md",className:t,children:r,...o}){return jsx("div",{...o,className:twMerge("leading-[2.25] text-text-secondary",We[e].text,t),children:r})}function be({children:e,size:t="md",className:r}){return jsx("div",{role:"alert",className:twMerge(We[t].text,"text-feedback-error-text",r),children:e})}function ws({size:e="md",isInvalid:t,isDisabled:r,isFocused:o,transparent:n,className:a,...i}){return jsx("input",{className:Ft({isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:e,className:a}),...i})}function Cf(e){let{children:t,...r}=e;return jsx("div",{...r,className:TS(e),children:typeof t=="function"?t(e):t})}var Ad=createContext("md");function Tf(){return useContext(Ad)}function Dd(e="md"){let t=e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":"";return `flex-1 text-start data-[placeholder]:text-text-disabled overflow-hidden text-ellipsis whitespace-nowrap ${We[e].text} ${t}`}function ES(){let e=Oe__default.useCallback((r,o)=>{o?.(r);},[]),t=Oe__default.useCallback((r,o)=>{o?.(r);},[]);return {handleFocus:e,handleBlur:t}}function gn({label:e,description:t,errorMessage:r,children:o,items:n,renderItem:a,renderSelectedValue:i,size:s="md",selectedKey:c,defaultSelectedKey:l,onSelectionChange:d,placeholder:u,showErrors:m=false,tooltip:p,isRequired:g,transparent:f,reserveErrorSpace:x=false,placement:b="bottom start",shouldFlip:h=true,menuWidth:y="match",descriptionPlacement:v="below",useMobileTray:S=true,...N}){let[w,M]=useState(null),[k,P]=useState(null),[I,D]=useState(false),L=c??w??l,{handleFocus:R,handleBlur:B}=ES(),{isMobile:Y}=Jt(),H=S&&Y,W=Oe__default.useMemo(()=>!i||!L||!n?null:Array.from(n).find(O=>O.id===L)??null,[i,L,n]),Z=E=>{d&&E!==null&&d(E),d||M(E);},q=useRef(null),Q=useRef(null),T=()=>{H&&D(!I);};return jsxs(Fragment,{children:[jsx(Select,{...N,selectedKey:L,defaultSelectedKey:l,onSelectionChange:Z,placeholder:u,className:ke(N.className,"group flex w-full flex-col"),ref:q,onOpenChange:E=>{H||(E&&Q.current?P(Q.current.offsetWidth):E||q.current?.blur());},children:({isDisabled:E,isInvalid:O,isOpen:A})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(ze,{size:s,tooltip:p,description:v==="tooltip"||v==="inline"?t:void 0,descriptionPlacement:v,isRequired:g,children:e}),jsx(bt,{children:jsx("div",{ref:Q,children:jsxs(ee,{variant:"unstyled",className:twMerge(Ft({isInvalid:O||m&&!!r,isDisabled:E,isFocused:H?I:A,transparent:f,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:C=>R(C,N.onFocus),onBlur:C=>B(C,N.onBlur),onPress:H?T:void 0,"data-open":H?I:A,children:[i&&W?jsx("div",{className:Dd(s),children:i(W)}):H&&L?jsx("div",{className:Dd(s),children:n?Array.from(n).find(z=>z.id===L)?.label:String(L)}):jsx(SelectValue,{className:Dd(s)}),jsx(V,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] transition-transform",(H?I:A)&&"rotate-180")})]})})}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:m?jsx(be,{size:s,className:"text-feedback-error-text",children:typeof r=="function"&&N.validationResult?r(N.validationResult):typeof r=="string"?r:null}):t&&v==="below"?jsx(Te,{size:s,children:t}):null}):jsx(Fragment,{children:m?jsx(be,{size:s,className:"mt-1 text-feedback-error-text",children:typeof r=="function"&&N.validationResult?r(N.validationResult):typeof r=="string"?r:null}):t&&v==="below"?jsx(Te,{size:s,className:"mt-1",children:t}):null}),H?null:jsx(nt,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:y==="match"&&k?`${k}px`:void 0,minWidth:y==="auto"&&k?`${k}px`:void 0,maxWidth:y==="auto"?"min(600px, 90vw)":void 0},placement:b,shouldFlip:h,children:jsx(Ad.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:a&&n?C=>jsx(Zt,{id:C.id,textValue:C.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(C)})},C.id):o})})})]})}),H&&jsx(at,{isOpen:I,onClose:()=>D(false),title:e??"Select an option",contentPadding:false,children:jsx(Ad.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:L!=null?[L]:[],onSelectionChange:E=>{let O=Array.from(E)[0];O!=null&&(Z(O),D(false));},children:a&&n?E=>jsx(Zt,{id:E.id,textValue:E.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(E)})},E.id):o})})})]})}function Zt({size:e,className:t,...r}){let o=Tf(),n=e??o;return jsx(ListBoxItem,{...r,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-primary data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-default data-[focus-visible]:ring-inset data-[selected]:bg-background-selected data-[selected]:font-medium overflow-hidden",We[n].paddingY,We[n].text,t)})}var KS=[],YS={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},JS={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Rf={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},Fd=(e,t,r)=>{if(e==null||e==="")return "";let n=(r?r.flatMap(a=>a.items):t||[]).find(a=>a.id===e);return n?n.name:""};async function XS(e,t,r){try{let o=e.url.replace("{q}",t),n=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([c,l])=>{n.append(c,l.toString());});let a=`${o}${n.toString()?"?"+n.toString():""}`,i=await fetch(a,{method:"GET",headers:e.headers,signal:r});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let s=await i.json();return {items:e.transformResponse(s)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return {items:[]};console.error("Error in REST request:",o);let n=o instanceof Error?o.message:"Unknown error occurred";return {items:[],error:n}}}async function jS(e,t,r){try{let o=e.graphqlQuery.replace(`$${e.variableKey||"filter"}`,`"${t}"`),n=await fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:JSON.stringify({query:o}),signal:r});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);let a=await n.json();if(a.errors)throw new Error(a.errors[0]?.message||"GraphQL error occurred");return e.responsePath&&(a=e.responsePath.split(".").reduce((i,s)=>i?.[s],a)),{items:e.transformResponse(a)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return {items:[]};console.error("Error in GraphQL request:",o);let n=o instanceof Error?o.message:"Unknown error occurred";return {items:[],error:n}}}function Ts({label:e,staticItems:t=KS,sections:r,selectedKey:o,defaultSelectedKey:n,onSelectionChange:a,requestConfig:i,defaultFilter:s,placeholder:c,errorMessage:l,description:d,size:u="md",tooltip:m,isRequired:p,isDisabled:g,isInvalid:f,validationResult:x,showErrors:b=true,renderItem:h,renderLeftIcon:y,renderSection:v,autoFocus:S=false,reserveErrorSpace:N=false,hideChevron:w=false,useMobileTray:M=true,className:k}){let P=Oe__default.useRef(null),I=Oe__default.useRef(null),[D,L]=Oe__default.useState(),[R,B]=useState(()=>Fd(o||n,t,r)),[Y,H]=useState(false),[W,Z]=useState(false),q=Po(R),{contains:Q}=useFilter({sensitivity:"base"}),[T,E]=useState(),{isMobile:O}=Jt(),A=M&&O,C=We[u].text,F=useAsyncList({async load({signal:re,filterText:ie=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(ie))return {items:[]};try{let fe;return i.requestType==="GraphQL"?fe=await jS(i,ie,re):fe=await XS(i,ie,re),E(fe.error),{items:fe.items}}catch(fe){return fe instanceof Error&&fe.name==="AbortError"?{items:[]}:(console.error("Error loading items:",fe),E(fe instanceof Error?fe.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),z=i&&q!==""?F:null,G=false,oe=useRef("");useEffect(()=>{S&&H(true);},[S]),useEffect(()=>{let re=Fd(o,t,r);re!==R&&B(re);},[o,t,r]),useEffect(()=>{let re=()=>{P.current&&L(P.current.offsetWidth);};return re(),window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[]),useEffect(()=>{q===""?oe.current="":z&&q!==oe.current&&(oe.current=q,z.setFilterText(q));},[q,z]),G=Cs(!!z?.isLoading,300);let ue=Oe__default.useMemo(()=>{if(!A||!R)return z?z.items:t;let re=z?z.items:t,ie=s??(i?()=>true:Q);return re.filter(fe=>ie(fe.name,R))},[A,R,z,t,s,Q]),te=re=>{let ie=Fd(re,t,r);B(ie),a&&a(re);},le=re=>{B(re);},me=()=>{A&&Z(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:te,selectedKey:o||void 0,defaultSelectedKey:n||void 0,items:z?z.items:r?r.flatMap(re=>re.items):t,className:ke(k,"group flex flex-col w-full"),menuTrigger:A?"manual":i?"input":"focus",allowsEmptyCollection:!!i,isDisabled:g,isInvalid:f||!!l,inputValue:R,onInputChange:le,autoFocus:S&&!A,defaultFilter:s??(i?()=>true:Q),"aria-label":e||c||"Autocomplete",children:re=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(ze,{size:u,tooltip:m,isRequired:p,children:e}),jsxs(bt,{ref:P,children:[y?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:y(G)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:G?jsx(mo,{size:16,color:"text-text-secondary"}):jsx(V,{name:"MagnifyingGlass",className:`${YS[u]} text-text-secondary`})}),jsx(Input,{className:Ft({isInvalid:f||!!l,isDisabled:g,isFocused:Y||(A?W:re.isOpen),size:u,className:twMerge(JS[u],R&&!g||!w&&!R?"pr-10":"pr-3",A&&"cursor-pointer",k)}),placeholder:c,disabled:g,onFocus:ie=>{H(true),A&&(ie.currentTarget.blur(),me());},onBlur:()=>{H(false);},onClick:A?me:void 0,readOnly:A,"aria-label":e||c||"Autocomplete"}),R&&!g&&jsx(ai,{onClick:()=>{B(""),a?.(null);},size:u}),!w&&!R&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":"Toggle menu",isDisabled:g,children:({isPressed:ie})=>jsx(V,{name:ie?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),N?jsx("div",{className:"mt-1 min-h-[20px]",children:b&&T?jsx(be,{size:u,className:"text-feedback-error-text",children:T}):b&&typeof l=="string"?jsx(be,{size:u,className:"text-feedback-error-text",children:l}):b&&typeof l=="function"&&x?jsx(be,{size:u,className:"text-feedback-error-text",children:l(x)}):d?jsx(Te,{size:u,children:d}):null}):jsxs(Fragment,{children:[d&&jsx(Te,{size:u,className:"mt-1",children:d}),b&&T&&jsx(be,{size:u,className:"text-feedback-error-text mt-1",children:T}),b&&typeof l=="string"&&jsx(be,{size:u,className:"text-feedback-error-text mt-1",children:l}),b&&typeof l=="function"&&x&&jsx(be,{size:u,className:"text-feedback-error-text mt-1",children:l(x)})]}),!A&&jsx(nt,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm ring-1 ring-black/5 rounded-[var(--control-border-radius)]",style:{minWidth:D?`${D}px`:void 0,zIndex:9999},children:jsx(ListBox,{"aria-label":e||c||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${C}`,children:r?r.map(ie=>{let fe=ie.items.map(xe=>jsx(Zt,{id:xe.id,textValue:xe.name,size:u,className:`flex cursor-default items-center gap-2 px-3 ${Rf[u]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:h?h(xe):xe.name},xe.id));if(v){let xe=v(ie,fe);return Oe__default.isValidElement(xe)&&xe.type===ListBoxSection?xe:jsx(ListBoxSection,{children:xe},ie.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:ie.name}),fe]},ie.name)}):ie=>jsx(Zt,{id:ie.id,textValue:ie.name,size:u,className:`flex cursor-default items-center gap-2 px-3 ${Rf[u]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:h?h(ie):ie.name},ie.id)})})]})}),A&&jsx(at,{isOpen:W,onClose:()=>Z(false),title:e??c??"Search",contentPadding:false,height:"80vh",children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"p-4 border-b border-border-default",children:jsxs(bt,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:G?jsx(mo,{size:16,color:"text-text-secondary"}):jsx(V,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:I,type:"text",value:R,onChange:re=>le(re.target.value),placeholder:c,autoFocus:true,className:Ft({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),R&&jsx(ai,{onClick:()=>{B(""),a?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||c||"Suggestions",items:ue,selectedKeys:o?[o]:[],selectionMode:"single",onSelectionChange:re=>{let ie=Array.from(re)[0];ie&&(te(ie),Z(false));},className:"bg-background-input outline-none",children:re=>jsx(Zt,{id:re.id,textValue:re.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:h?h(re):re.name},re.id)})})]})})]})}function fo({src:e,alt:t,firstName:r,lastName:o,fullName:n,onClick:a,size:i="md",shape:s="circle",variant:c="user",className:l,status:d,bordered:u=false,piiEntity:m}){let[p,g]=useState(false),f=useCallback(()=>g(true),[]);useEffect(()=>{g(false);},[e]);let x={xs:"h-6 w-6 text-xs",sm:"h-8 w-8 text-sm",md:"h-10 w-10 text-base",lg:"h-12 w-12 text-lg",xl:"h-16 w-16 text-xl"},b={xs:"h-1.5 w-1.5",sm:"h-2 w-2",md:"h-2.5 w-2.5",lg:"h-3 w-3",xl:"h-4 w-4"},h={xs:"bottom-0 right-0",sm:"bottom-0 right-0",md:"bottom-0 right-0",lg:"bottom-0.5 right-0.5",xl:"bottom-1 right-1"},y={online:"bg-feedback-success-background border-feedback-success-border",offline:"bg-text-secondary border-border-muted",away:"bg-feedback-warning-background border-feedback-warning-border",busy:"bg-feedback-error-background border-feedback-error-border"},v={user:"bg-feedback-info-background text-feedback-info-text",team:"bg-feedback-info-background text-feedback-info-text",organization:"bg-feedback-success-background text-feedback-success-text"},S=s==="circle"?"rounded-full":"rounded-md",N=twMerge("relative inline-flex items-center justify-center overflow-hidden transition-opacity outline-none",x[i],S,a&&"cursor-pointer hover:opacity-80",u&&"ring-2 ring-background-surface",l),M=(()=>{if(r||o){let D=r?.[0]||"",L=o?.[0]||"";return (D+L).toUpperCase()}if(n){let D=n.split(" "),L=D[0]?.[0]||"",R=D[D.length-1]?.[0]||"";return L===R?L.toUpperCase():(L+R).toUpperCase()}return ""})(),k=()=>{let D={xs:14,sm:16,md:20,lg:24,xl:32}[i];switch(c){case "team":return jsx(Users,{size:D});case "organization":return jsx(Building2,{size:D});default:return jsx(User,{size:D})}},P=D=>{if(m)return c==="organization"?D?"organization-logo":"initials":D?"avatar":"initials"},I=()=>e&&!p?jsx("img",{src:e,alt:t||n||"Avatar",className:"h-full w-full object-cover",onError:f,"data-pii-type":P(true),"data-pii-entity":m}):M?jsx("span",{className:"font-semibold","data-pii-type":P(false),"data-pii-entity":m,children:M}):k();return jsxs("div",{className:"relative inline-block",children:[jsx("div",{"data-avatar":true,className:twMerge(N,!e||p?v[c]:""),onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,children:I()}),d&&jsx("span",{className:twMerge("absolute border-2 border-background-surface",S,b[i],h[i],y[d]),"aria-label":`Status: ${d}`})]})}var rw={default:"bg-feedback-info-background text-feedback-info-text",success:"bg-feedback-success-background text-feedback-success-text",error:"bg-feedback-error-background text-feedback-error-text",warning:"bg-feedback-warning-background text-feedback-warning-text",info:"bg-feedback-info-background text-feedback-info-text",primary:"bg-action-primary/10 text-action-primary border border-action-primary/20",brand:"bg-action-primary/10 text-action-primary border border-action-primary/20",secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border border-border-muted",neutral:"bg-background-muted text-text-secondary",charging:"bg-state-charging text-state-charging-text",discharging:"bg-state-discharging text-state-discharging-text",heat:"bg-state-heat text-state-heat-text",cool:"bg-state-cool text-state-cool-text",eco:"bg-state-eco text-state-eco-text",auto:"bg-state-auto text-state-auto-text",on:"bg-state-on text-state-on-text",off:"bg-state-off text-state-off-text",idle:"bg-state-idle text-state-idle-text",unknown:"bg-state-unknown text-state-unknown-text",connected:"bg-feedback-success-background text-feedback-success-text",disconnected:"bg-feedback-error-background text-feedback-error-text",importing:"bg-state-importing text-state-importing-text",exporting:"bg-state-exporting text-state-exporting-text"},ow={xs:"px-1.5 py-0.5 text-xs",sm:"px-2.5 py-1.5 text-xs",md:"px-3.5 py-2 text-sm",lg:"px-4 py-2.5 text-base"},nw={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"},aw={xs:"w-1 h-1",sm:"w-1.5 h-1.5",md:"w-2 h-2",lg:"w-2.5 h-2.5"};function tt({children:e,variant:t="default",size:r="sm",shape:o="square",dot:n=false,dotPosition:a="left",dotPulse:i=false,className:s}){let c=n&&jsx("span",{className:twMerge("rounded-full bg-current opacity-75",aw[r],i&&"animate-pulse"),"aria-hidden":"true"});return jsxs("span",{className:twMerge("inline-flex items-center gap-1.5 font-medium",ow[r],nw[o],rw[t],s),children:[n&&a==="left"&&c,e,n&&a==="right"&&c]})}var Qe=({href:e,children:t,className:r="",external:o=false,title:n,variant:a="secondary",onClick:i,asButton:s=false,onPress:c,showArrow:l=false,alwaysUnderlined:d=false,LinkComponent:u,"data-pii-type":m,"data-pii-entity":p})=>{let g={...m&&{"data-pii-type":m},...p&&{"data-pii-entity":p}},f=o?{target:"_blank",rel:"noopener noreferrer"}:{},v=`${`${d?"underline decoration-1 underline-offset-4 decoration-current":"hover:underline hover:decoration-1 hover:underline-offset-4 hover:decoration-current"} cursor-pointer`} ${{primary:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",secondary:"text-text-link-default hover:text-text-link-hover visited:text-text-link-default",muted:"text-text-secondary hover:text-text-secondary visited:text-text-secondary",unstyled:""}[a==="brand"?"primary":a==="default"?"secondary":a]} ${r}`,S=jsxs(Fragment,{children:[t,l&&jsxs("span",{children:["\xA0","\u2192"]})]});return s?jsx("button",{type:"button",className:v,onClick:c,title:n,...g,children:S}):u&&e?jsx(u,{href:e,className:v,title:n,onClick:i,...f,...g,children:S}):jsx("a",{href:e||"#",className:v,...f,...g,title:n,onClick:i,children:S})};var gw={info:{subtle:{container:"bg-feedback-info-background border-l-4 border-l-feedback-info-border",iconColor:"text-feedback-info-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-info-border border-feedback-info-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:Info},success:{subtle:{container:"bg-feedback-success-background border-l-4 border-l-feedback-success-border",iconColor:"text-feedback-success-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-success-border border-feedback-success-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:CheckCircle},warning:{subtle:{container:"bg-feedback-warning-background border-l-4 border-l-feedback-warning-border",iconColor:"text-feedback-warning-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-warning-border border-feedback-warning-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:AlertCircle},error:{subtle:{container:"bg-feedback-error-background border-l-4 border-l-feedback-error-border",iconColor:"text-feedback-error-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-error-border border-feedback-error-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:XCircle},discovery:{subtle:{container:"bg-background-muted border-l-4 border-l-action-brand",iconColor:"text-action-brand",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-action-brand border-action-brand",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:Lightbulb}};function Rs({variant:e="info",appearance:t="subtle",title:r,children:o,dismissible:n=false,onDismiss:a,primaryAction:i,secondaryAction:s,icon:c,hideIcon:l=false,className:d,testId:u}){let m=gw[e],p=m[t],g=m.icon,f=!!(i||s),x=!!(r||o);return jsxs("div",{className:twMerge("flex gap-3 rounded-sm border p-4",p.container,d),role:"region","aria-live":"polite","data-testid":u,children:[!l&&jsx("div",{className:twMerge("flex-shrink-0",p.iconColor),"aria-hidden":"true",children:c||jsx(g,{className:"h-5 w-5"})}),jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:[x&&jsxs("div",{className:"flex-1",children:[r&&jsx("div",{className:jt(pt("headingSm"),p.titleColor),children:r}),o&&jsx("div",{className:jt(pt("bodySm"),r?"mt-1":"",p.bodyColor),children:o})]}),f&&jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i&&(i.asLink?jsx(Qe,{asButton:true,onPress:i.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-text-inverse hover:text-text-inverse/80":"",children:i.label}):jsx(ee,{size:"sm",variant:"primary",onPress:i.onPress,className:t==="bold"?"bg-background-surface text-text-primary hover:bg-background-surface/90":"",children:i.label})),s&&(s.asLink?jsx(Qe,{asButton:true,onPress:s.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-text-inverse hover:text-text-inverse/80":"",children:s.label}):jsx(ee,{size:"sm",variant:"secondary",onPress:s.onPress,className:t==="bold"?"border-text-inverse/30 text-text-inverse hover:bg-text-inverse/10":"",children:s.label}))]})]}),n&&jsx("button",{type:"button",onClick:a,className:twMerge("flex h-8 w-8 flex-shrink-0 items-center justify-center self-start rounded-md transition-colors hover:bg-background-modal/10",p.iconColor,Ye()),"aria-label":"Dismiss banner",children:jsx(X,{className:"h-4 w-4"})})]})}function Ef({isOpen:e=true,position:t="sticky",className:r,...o}){let n=t==="fixed"?"fixed top-0 left-0 right-0 z-50":"sticky top-0 z-50",a=r?`${r} !rounded-none`:"!rounded-none";return jsx(AnimatePresence,{children:e&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:n,children:jsx(Rs,{...o,className:a})})})}function Fo({value:e,children:t,className:r,size:o="sm",iconPosition:n="right"}){let[a,i]=useState(false),l=jsx(ee,{variant:"icon",size:o,onPress:()=>{let u=e||(typeof t=="string"?t:"");navigator.clipboard.writeText(u),i(true),setTimeout(()=>{i(false);},2e3);},className:"!px-2 relative",style:{top:"0.5px"},children:jsx(V,{name:"Copy",size:o==="sm"?14:16})}),d=a?jsx(Qt,{content:"Copied!",children:l}):l;return jsxs("div",{className:twMerge("inline-flex items-center gap-0.5",r),children:[n==="left"&&d,t,n==="right"&&d]})}function Ms(e){let{children:t,maxWidth:r=600,className:o,...n}=e,{ref:a,width:i}=oa(),[s,c]=Oe__default.useState(false),[l,d]=Oe__default.useState(false),u=Oe__default.useRef(false),m=Oe__default.useMemo(()=>t&&!e.items&&typeof t!="function"?Oe__default.Children.toArray(t):null,[t,e.items]);if(Oe__default.useEffect(()=>{m&&m.length>=4&&i>0&&!u.current?(u.current=true,c(i>r),d(true)):(!m||m&&m.length<4)&&d(true);let p=setTimeout(()=>{l||d(true);},100);return ()=>clearTimeout(p)},[i,r,m,l]),m&&s&&m.length>=4){let p=m[0],g=m.slice(1,-2),f=m.slice(-2),x=g.map(b=>{if(Oe__default.isValidElement(b)){let h=b.props;if(typeof h.children=="string")return {label:h.children,href:h.href}}return {label:"..."}});return jsxs(Breadcrumbs,{...n,ref:a,className:twMerge("flex gap-2",l?"opacity-100":"opacity-0",o),children:[p,jsx(Cw,{items:x}),f]})}return jsx(Breadcrumbs,{...n,ref:a,className:twMerge("flex gap-2",l?"opacity-100":"opacity-0",o),children:t})}function Cw({items:e}){let t=e.map((r,o)=>({id:`breadcrumb-${o}`,name:r.label,href:r.href}));return jsx(Breadcrumb,{className:"flex items-center gap-2",children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(ma,{items:t,align:"left",size:"sm",children:jsx(ee,{variant:"icon",size:"sm",icon:"DotsThree","aria-label":"Show hidden breadcrumbs",className:"px-0.5"})}),jsx(ChevronRight,{className:"h-4 w-4 text-text-secondary"})]})})}function Ds(e){let{className:t,children:r,href:o,copyable:n,copyValue:a,...i}=e;return jsx(Breadcrumb,{className:ke(t,"flex items-center gap-2"),...i,children:s=>{let c=s.isCurrent,l=typeof r=="function"?r(s):r;return jsx(Fragment,{children:c?n?jsx(Fo,{value:a||(typeof l=="string"?l:void 0),size:"sm",iconPosition:"right",children:jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-primary sm:max-w-none",children:l})}):jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-primary sm:max-w-none",children:l}):jsxs(Fragment,{children:[jsx(Qe,{variant:"muted",href:o,className:"max-w-[150px] truncate sm:max-w-[300px] md:max-w-none",children:l}),jsx(ChevronRight,{className:"h-4 w-4 shrink-0 text-text-secondary"})]})})}})}function Lw({isSelected:e,isDisabled:t}){let r=[Ye,"w-9 h-9 text-sm cursor-default rounded-sm flex items-center justify-center forced-color-adjust-none font-semibold"];return t?r.push("text-text-disabled forced-colors:text-[GrayText]"):e?r.push("bg-action-default text-text-inverse invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):r.push("text-text-primary hover:bg-background-hover pressed:bg-background-selected"),r.join(" ")}function ba({errorMessage:e,...t}){return jsxs(Calendar,{...t,children:[jsx(Ls,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Es,{}),jsx(CalendarGridBody,{children:r=>jsx(CalendarCell,{date:r,className:({isSelected:o,isDisabled:n})=>`${Lw({isSelected:o,isDisabled:n})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function Ls(){let{direction:e}=useLocale(),t=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(ee,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(V,{name:"CaretRight","aria-hidden":true,size:t}):jsx(V,{name:"CaretLeft","aria-hidden":true,size:t})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsx(ee,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(V,{name:"CaretLeft","aria-hidden":true,size:t}):jsx(V,{name:"CaretRight","aria-hidden":true,size:t})})]})}function Es(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}var zf=Oe.createContext(null);function Bo(){let e=Oe.useContext(zf);if(!e)throw new Error("Carousel components must be used within a CarouselRoot");return e}function Of({page:e,defaultPage:t=0,onPageChange:r,orientation:o="horizontal",loop:n=false,autoplay:a=false,autoplayDelay:i=4e3,allowMouseDrag:s=false,spacing:c="1rem",slidesPerView:l=1,slidesPerMove:d=1,className:u,children:m,...p}){let g=e!==void 0,[f,x]=Oe.useState(t),b=g?e:f,h=Oe.useRef(null),[y,v]=Oe.useState(0),[S,N]=Oe.useState(typeof a=="boolean"?a:!!a),[w,M]=Oe.useState(false),k=Oe.useRef(null),P=Oe.useRef(null),I=typeof a=="object"&&a!==null&&a.delay?a.delay:i;Oe.useEffect(()=>{if(h.current){let C=Math.max(1,Math.floor(Number(l)||1)),F=h.current.children;if(F.length===0){v(0);return}let z=Math.ceil(F.length/C);v(z);}},[m,l]);let D=Oe.useRef(-1);Oe.useEffect(()=>{if(b!==D.current&&h.current){let C=Array.from(h.current.children);if(C.length===0)return;let F=b*l,z=Math.min(F,C.length-1),G=C[z];G&&typeof G.scrollIntoView=="function"&&(G.scrollIntoView({behavior:"smooth",block:o==="vertical"?"start":"nearest",inline:o==="horizontal"?"start":"nearest"}),D.current=b);}},[b,l,o]);let L=Oe.useCallback(C=>{let F=C;n?F<0?F=y-1:F>=y&&(F=0):F=Math.max(0,Math.min(C,y-1)),g||x(F),r?.(F);},[g,n,r,y]),R=Oe.useCallback(()=>{L(b+d);},[b,L,d]),B=Oe.useCallback(()=>{L(b-d);},[b,L,d]),Y=Oe.useRef(R);Oe.useEffect(()=>{Y.current=R;},[R]);let H=y>0&&(n||b<y-1),W=y>0&&(n||b>0),Z=Oe.useCallback(()=>{N(C=>!C);},[]);Oe.useEffect(()=>{if(S&&y>1)return k.current=setInterval(()=>{Y.current();},I),()=>{k.current&&(clearInterval(k.current),k.current=null);}},[S,y,I]);let q=Oe.useCallback(()=>{k.current&&(clearInterval(k.current),k.current=null);},[]),Q=Oe.useCallback(()=>{S&&y>1&&(k.current=setInterval(()=>{Y.current();},I));},[S,y,I]),T=Oe.useCallback(C=>{if(!s)return;M(true);let F="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientX:"clientX"in C?C.clientX:0,z="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientY:"clientY"in C?C.clientY:0;P.current={x:F,y:z};},[s]),E=Oe.useCallback(C=>{if(!w||!P.current)return;let F="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientX:"clientX"in C?C.clientX:0,z="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientY:"clientY"in C?C.clientY:0,G=F-P.current.x,oe=z-P.current.y,ue=50;o==="horizontal"&&Math.abs(G)>ue?(G>0?B():R(),M(false),P.current=null):o==="vertical"&&Math.abs(oe)>ue&&(oe>0?B():R(),M(false),P.current=null);},[w,o,R,B]),O=Oe.useCallback(()=>{M(false),P.current=null;},[]),A={currentPage:b,totalPages:y,orientation:o,loop:n,spacing:c,slidesPerView:l,goToPage:L,goToNext:R,goToPrev:B,canGoNext:H,canGoPrev:W,isAutoplayActive:S,toggleAutoplay:Z,itemsRef:h,isDragging:w,allowMouseDrag:s,handleDragStart:T,handleDragMove:E,handleDragEnd:O};return jsx(zf.Provider,{value:A,children:jsx("div",{...p,className:twMerge("relative w-full",o==="vertical"?"h-full":"",u),onMouseEnter:q,onMouseLeave:Q,children:m})})}function Hf({className:e,children:t,...r}){let{itemsRef:o,orientation:n,spacing:a,isDragging:i,allowMouseDrag:s,handleDragStart:c,handleDragMove:l,handleDragEnd:d}=Bo();return jsx("div",{ref:o,...r,className:twMerge("flex overflow-x-auto overflow-y-hidden snap-x snap-mandatory scrollbar-hide scroll-smooth",n==="vertical"&&"flex-col overflow-y-auto overflow-x-hidden snap-y",s&&i&&"cursor-grabbing select-none",s&&!i&&"cursor-grab",e),style:{gap:a,"--carousel-spacing":a,...r.style},onMouseDown:c,onMouseMove:l,onMouseUp:d,onMouseLeave:d,onTouchStart:c,onTouchMove:l,onTouchEnd:d,children:t})}function Wf({index:e,className:t,children:r,...o}){let{orientation:n,slidesPerView:a}=Bo();return jsx("div",{...o,"data-index":e,className:twMerge("shrink-0 snap-start",n==="horizontal"?"h-full":"w-full",t),style:{width:n==="horizontal"?`calc((100% - (${a-1} * var(--carousel-spacing, 1rem))) / ${a})`:void 0,height:n==="vertical"?`calc((100% - (${a-1} * var(--carousel-spacing, 1rem))) / ${a})`:void 0,...o.style},children:r})}function Gf({className:e,children:t,...r}){return jsx("div",{...r,className:twMerge("flex items-center justify-center gap-4 mt-4",e),children:t})}function Uf({className:e,children:t,...r}){let{goToPrev:o,canGoPrev:n}=Bo();return jsx("button",{type:"button",...r,onClick:a=>{o(),r.onClick?.(a);},disabled:!n||r.disabled,"aria-label":"Previous slide",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(V,{name:"CaretLeft",size:"sm"})})}function Kf({className:e,children:t,...r}){let{goToNext:o,canGoNext:n}=Bo();return jsx("button",{type:"button",...r,onClick:a=>{o(),r.onClick?.(a);},disabled:!n||r.disabled,"aria-label":"Next slide",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(V,{name:"CaretRight",size:"sm"})})}function Ud({index:e,className:t,children:r,...o}){let{currentPage:n,goToPage:a}=Bo(),i=n===e;return jsx("button",{type:"button",...o,onClick:s=>{a(e),o.onClick?.(s);},"aria-label":`Go to slide ${e+1}`,"aria-current":i,className:twMerge("h-2 rounded-full transition-all duration-200",i?"w-6 bg-action-brand":"w-2 bg-border-muted hover:bg-border-input","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",t),children:r})}function Yf({className:e,...t}){let{totalPages:r}=Bo();return jsx("div",{...t,className:twMerge("flex items-center gap-2",e),role:"group","aria-label":"Carousel indicators",children:Array.from({length:r},(o,n)=>jsx(Ud,{index:n},n))})}function Jf({className:e,children:t,...r}){let{isAutoplayActive:o,toggleAutoplay:n}=Bo();return jsx("button",{type:"button",...r,onClick:a=>{n(),r.onClick?.(a);},"aria-label":o?"Pause autoplay":"Start autoplay",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(V,{name:o?"Pause":"Play",size:"sm"})})}function Xf({className:e,...t}){let{currentPage:r,totalPages:o}=Bo();return jsxs("div",{...t,className:twMerge("text-sm text-text-secondary tabular-nums",e),"aria-live":"polite","aria-atomic":"true",children:[r+1," / ",o]})}var zw="focus:ring-action-primary",Ow="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function Kd(e){return jsxs(CheckboxGroup,{...e,className:ke(e.className,"flex flex-col gap-2"),children:[jsx(ze,{children:e.label}),e.children,e.description&&jsx(Te,{children:e.description}),jsx(be,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Hw({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function Ww({isSelected:e,isInvalid:t,isDisabled:r,isIndeterminate:o}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",a=zw,i="";return r?i="border-border-muted bg-background-muted":t?i="border-feedback-error-border bg-feedback-error-background":e||o?i=Ow:i="bg-background-input border-border-input hover:border-border-focus",`${n} ${a} ${i}`}var jf="w-4 h-4 text-current group-disabled:text-text-disabled";function vn(e){let{children:t,variant:r,...o}=e;return jsx(Checkbox,{...o,className:composeRenderProps(e.className,(n,a)=>`${Hw(a)} ${n||""}`),children:n=>{let{isSelected:a,isIndeterminate:i,...s}=n,c=jsx("div",{className:Ww({isSelected:a,isIndeterminate:i,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:jf}):a?jsx(Check,{"aria-hidden":true,className:jf}):null});return jsxs(Fragment,{children:[c,typeof t=="function"?t(n):t]})}})}var Kw={primary:"bg-action-primary/10 text-action-primary border border-action-primary/20 hover:bg-action-primary/15",secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border border-border-muted hover:bg-action-secondary-hover",info:"bg-feedback-info-background text-feedback-info-text border border-feedback-info-border hover:bg-feedback-info-background/80"};function Qf(e){return !e||e==="default"?"secondary":e==="brand"?"primary":e}var Yw={xs:"px-1.5 py-[2px] gap-0.5",sm:"px-2 py-1 gap-1",md:"px-3 py-1.5 gap-1.5",lg:"px-3 py-2 gap-2",xl:"px-4 py-2.5 gap-2"},Jw="opacity-75 cursor-not-allowed pointer-events-none";function Zf(e){let{variant:t,size:r,isDisabled:o,isClickable:n,className:a}=e,i=r==="xs"?"text-xs":We[r].text;return twMerge("inline-flex items-center justify-center rounded-full font-medium transition-colors","whitespace-nowrap select-none",Yw[r],i,Kw[t],n&&!o&&"cursor-pointer",o&&Jw,a)}function $r({children:e,onRemove:t,size:r="md",variant:o="secondary",isRemovable:n=true,isDisabled:a=false,className:i,onClick:s}){let c=!!s&&!a,l=n&&t&&!a,d=f=>{f.stopPropagation(),f.preventDefault(),t&&!a&&t();},u=()=>{s&&!a&&s();},m=r==="xs"?10:r==="sm"?12:r==="md"?14:16,g=jsxs(Fragment,{children:[jsx("span",{className:"truncate",children:e}),l?c?jsx("span",{onClick:d,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),d(f));},role:"button",tabIndex:0,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":"Remove",children:jsx(V,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):jsx("button",{type:"button",onClick:d,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":"Remove",tabIndex:-1,children:jsx(V,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):null]});return c?jsx("button",{type:"button",onClick:u,className:Zf({variant:Qf(o),size:r,isDisabled:a,isClickable:c,className:i}),disabled:a,children:g}):jsx("span",{className:Zf({variant:Qf(o),size:r,isDisabled:a,isClickable:c,className:i}),children:g})}function eg({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a=false,isDisabled:i=false,isInvalid:s=false,validationResult:c,placeholder:l="Add items...",selectedItems:d=[],onItemsChange:u,staticItems:m,fetchSuggestions:p,chipVariant:g="secondary",showErrors:f=true,className:x}){let[b,h]=useState(""),[y,v]=useState([]),[S,N]=useState(false),[w,M]=useState(false),[k,P]=useState(-1),I=Po(b,300),D=useRef(null),L=useRef(null),{isFocused:R,handleFocus:B,handleBlur:Y}=Nr(),H=useId(),W=useCallback(A=>{if(!u||!A.trim())return;let C=A.trim();if(d.includes(C)){h(""),M(false),v([]),P(-1);return}u([...d,C]),h(""),M(false),v([]),P(-1),D.current?.focus();},[d,u]),Z=useCallback(A=>{u&&u(d.filter(C=>C!==A));},[d,u]);useEffect(()=>{if(!p)return;let A=true;return (async()=>{let F=I.trim();if(!F){A&&(N(false),v([]),M(false));return}N(true);try{let z=await p(F);if(!A)return;v(z),M(!0);}catch(z){if(!A)return;console.error("Error fetching suggestions:",z),v([]),M(false);}finally{A&&N(false);}})(),()=>{A=false;}},[I,p]),useEffect(()=>{if(p||!m)return;if(!I.trim()){v([]),M(false);return}let A=m.filter(C=>C.name.toLowerCase().includes(I.toLowerCase())).map(C=>C.id);v(A),M(A.length>0||I.trim().length>0);},[I,m,p]);let q=useMemo(()=>{let A=y.filter(C=>!d.includes(C));return b.trim()&&!A.includes(b.trim())&&!d.includes(b.trim())?[...A,`Create tag: "${b.trim()}"`]:A},[y,b,d]),Q=useCallback(A=>{h(A.target.value),P(-1),A.target.value&&M(true);},[]),T=useCallback(A=>{i||(A.startsWith("Create tag:")?W(b):W(A));},[W,b,i]),E=useCallback(A=>{if(!i)switch(A.key){case "Enter":case ",":if(A.preventDefault(),k>=0&&k<q.length){let C=q[k];C.startsWith("Create tag:")?W(b):W(C);}else b.trim()&&W(b.trim());break;case "Backspace":!b&&d.length>0&&(A.preventDefault(),Z(d[d.length-1]));break;case "ArrowDown":A.preventDefault(),w&&P(C=>C<q.length-1?C+1:C);break;case "ArrowUp":A.preventDefault(),w&&P(C=>C>0?C-1:-1);break;case "Escape":M(false),P(-1);break}},[i,b,d,q,k,w,W,Z]);useEffect(()=>{let A=C=>{L.current&&C.target instanceof Node&&!L.current.contains(C.target)&&M(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);let O=()=>twMerge("flex items-center gap-1.5 rounded-md overflow-x-auto overflow-y-hidden","[&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",Io({isInvalid:s,isDisabled:i,isFocused:R}),"bg-background-input",o==="sm"&&"px-2 py-1 h-[32px]",o==="md"&&"px-2.5 py-1.5 h-[40px]",o==="lg"&&"px-3 py-2 h-[44px]",o==="xl"&&"px-3.5 py-2.5 h-[48px]",i&&"opacity-50 cursor-not-allowed bg-background-muted");return jsxs("div",{ref:L,className:twMerge("relative flex flex-col gap-1",x),children:[e&&jsx(ze,{size:o,tooltip:n,isRequired:a,children:e}),jsx(bt,{children:jsxs("div",{className:O(),onClick:()=>!i&&D.current?.focus(),children:[d.map(A=>jsx($r,{variant:g,size:"xs",onRemove:()=>Z(A),isDisabled:i,className:"shrink-0 max-h-full",children:A},A)),jsx("input",{ref:D,type:"text",role:"combobox","aria-expanded":w,"aria-haspopup":"listbox","aria-controls":H,"aria-autocomplete":"list",value:b,onChange:Q,onKeyDown:E,onFocus:A=>B(A),onBlur:A=>Y(A),placeholder:d.length===0?l:"",disabled:i,className:"flex-1 min-w-[120px] h-full !border-0 !outline-none !ring-0 bg-transparent text-text-primary text-sm placeholder:text-text-disabled disabled:cursor-not-allowed focus:!ring-0 focus:!outline-none focus:!border-0 focus-visible:!ring-0 focus-visible:!outline-none focus-visible:!border-0",style:{boxShadow:"none",WebkitAppearance:"none",appearance:"none",border:"none",outline:"none"}})]})}),w&&(b||q.length>0)&&jsx("div",{id:H,role:"listbox",className:twMerge("absolute z-50 mt-1 rounded-lg border border-border-default","max-h-60 overflow-auto bg-background-surface shadow-lg","left-0 right-0 top-full"),children:S?jsx("div",{className:"px-3 py-2 text-sm text-text-secondary",children:"Loading..."}):q.length>0?q.map((A,C)=>jsx("div",{role:"option","aria-selected":C===k,className:twMerge("cursor-pointer px-3 py-2 text-sm transition-colors","hover:bg-background-hover",C===k&&"bg-background-selected",A.startsWith("Create tag:")&&"italic text-text-secondary"),onClick:()=>T(A),children:A},A)):b&&jsx("div",{className:"px-3 py-2 text-sm text-text-secondary",children:"No suggestions found"})}),t&&jsx(Te,{size:o,className:"mt-1",children:t}),f&&typeof r=="string"&&jsx(be,{size:o,className:"text-feedback-error-text mt-1",children:r}),f&&typeof r=="function"&&c&&jsx(be,{size:o,className:"text-feedback-error-text mt-1",children:r(c)})]})}var rN={json:()=>import('ace-builds/src-noconflict/mode-json'),javascript:()=>import('ace-builds/src-noconflict/mode-javascript'),typescript:()=>import('ace-builds/src-noconflict/mode-typescript'),html:()=>import('ace-builds/src-noconflict/mode-html'),css:()=>import('ace-builds/src-noconflict/mode-css'),markdown:()=>import('ace-builds/src-noconflict/mode-markdown'),yaml:()=>import('ace-builds/src-noconflict/mode-yaml'),xml:()=>import('ace-builds/src-noconflict/mode-xml'),python:()=>import('ace-builds/src-noconflict/mode-python'),sql:()=>import('ace-builds/src-noconflict/mode-sql')},oN={github:()=>import('ace-builds/src-noconflict/theme-github'),github_dark:()=>import('ace-builds/src-noconflict/theme-github_dark')},nN={"ext-language-tools":()=>import('ace-builds/src-noconflict/ext-language_tools')},ci=new Set;async function Jd(e,t){ci.has(e)||(await t(),ci.add(e));}async function aN(e,t,r){await Promise.all([Jd(`language:${e}`,rN[e]),Jd(`theme:${t}`,oN[t]),r?Jd("extension:language-tools",nN["ext-language-tools"]):void 0]);}function rg(e,t,r){let o=ci.has(`language:${e}`)&&ci.has(`theme:${t}`);return r?o&&ci.has("extension:language-tools"):o}function og({value:e,readOnly:t=false,onChange:r,language:o="json",theme:n="github_dark",height:a,width:i="100%",className:s,lineHeight:c=19,minLines:l=3,maxLines:d=50,showLineNumbers:u=true,showGutter:m=true,fontSize:p=14,wrapEnabled:g=false}){let f=useRef(null),[x,b]=useState(()=>rg(o,n,!t)),h=useMemo(()=>{if(a)return a;let y=(e.match(/\n/g)||[]).length+1;return `${Math.max(l,Math.min(y,d))*c+10}px`},[e,a,c,l,d]);return useEffect(()=>{let y=false,v=!t;return rg(o,n,v)?(b(true),()=>{y=true;}):(b(false),aN(o,n,v).then(()=>{y||b(true);}).catch(S=>{y||b(true),console.error("Failed to load Ace editor resources",S);}),()=>{y=true;})},[o,t,n]),useEffect(()=>{x&&f.current?.editor&&f.current.editor.resize();},[h,x]),jsx("div",{className:twMerge("overflow-hidden rounded-md border border-border-input",s),style:{width:i,height:h},children:x?jsx(eN,{ref:f,mode:o,theme:n,value:e,onChange:r,readOnly:t,width:"100%",height:"100%",fontSize:p,showPrintMargin:false,showGutter:m,highlightActiveLine:!t,setOptions:{useWorker:true,showLineNumbers:u,tabSize:2,enableBasicAutocompletion:!t,enableLiveAutocompletion:!t,enableSnippets:!t,showFoldWidgets:true,wrap:g},editorProps:{$blockScrolling:true}}):jsx("div",{className:"flex h-full w-full items-center justify-center bg-surface-muted text-foreground-muted",children:"Loading editor\u2026"})})}var ag=Oe.createContext({variant:"contained",density:"comfortable",showDividers:true}),ig=Oe.createContext(null),dN={contained:"rounded-lg border border-border-default bg-background-surface overflow-hidden",bordered:"rounded-lg border border-border-default bg-background-surface",plain:"bg-transparent"},ng={true:"divide-y divide-border-default",false:"gap-3"},uN={comfortable:"px-5 py-3",compact:"px-4 py-2.5"},pN={comfortable:"px-5 pt-0",compact:"px-4 pt-0"},mN={comfortable:"h-4 w-4",compact:"h-3.5 w-3.5"};function Qd(){return Oe.useContext(ag)}function fN(e){let t=Oe.useContext(ig);if(!t)throw new Error(`${e} must be used within a <CollapseItem>`);return t}function gN({variant:e,showDividers:t,className:r}){let o="group/collapse-item w-full transition-colors",n={contained:"bg-background-surface",bordered:"bg-background-surface",plain:"bg-transparent"},a=t?"":"rounded-lg border border-border-default bg-background-surface overflow-hidden";return twMerge(o,n[e],a,r)}function bN({isDisabled:e,isPressed:t,density:r,variant:o,showDividers:n,className:a}){let i="group/collapse-header flex w-full items-start gap-4 text-left transition-colors duration-150",s=e?"cursor-not-allowed text-text-disabled":"cursor-pointer text-text-primary",c=t&&!e?"bg-background-hover":"",l=uN[r];return twMerge(i,Ye(),l,s,c,o==="plain"&&n?"px-0":"",a)}function xN({density:e,showDividers:t,className:r}){let o="text-text-primary",n=pN[e];return twMerge(o,n,t?"":"rounded-b-lg",r)}function xa({variant:e="contained",density:t="comfortable",showDividers:r=true,className:o,...n}){let a=Oe.useMemo(()=>({variant:e,density:t,showDividers:r}),[e,t,r]),i=twMerge("flex w-full flex-col",dN[e],r?ng.true:ng.false,e==="plain"&&r?"border-y border-border-default/60":"");return jsx(ag.Provider,{value:a,children:jsx(DisclosureGroup,{...n,className:ke(o,i)})})}function zo({className:e,children:t,...r}){let{variant:o,showDividers:n}=Qd();return jsx(Disclosure,{...r,className:composeRenderProps(e,a=>gN({variant:o,showDividers:n,className:a})),children:a=>jsx(ig.Provider,{value:a,children:t})})}zo.displayName="CollapseItem";function Oo({title:e,description:t,startContent:r,endContent:o,indicator:n,indicatorPosition:a="end",showIndicator:i=true,keepIndicatorSpace:s=false,children:c,className:l,...d}){let u=fN("CollapseHeader"),{density:m,variant:p,showDividers:g}=Qd(),f=mN[m];return jsx(Button,{...d,slot:"trigger","data-expanded":u.isExpanded?"true":void 0,className:composeRenderProps(l,(x,b)=>bN({isDisabled:b.isDisabled??false,isPressed:b.isPressed??false,density:m,variant:p,showDividers:g,className:x})),children:x=>{let b=x.isDisabled??false,h=i?typeof n=="function"?n({isExpanded:u.isExpanded,isDisabled:b}):n??jsx(V,{name:"CaretDown",size:m==="compact"?"xs":"sm",weight:"bold","aria-hidden":"true",className:twMerge("text-text-secondary transition-transform duration-200",u.isExpanded?"rotate-180":"rotate-0")}):null,y=h?jsx("span",{className:twMerge("flex flex-shrink-0 items-center justify-center text-text-secondary",f),"aria-hidden":"true",children:h}):s?jsx("span",{className:twMerge("flex flex-shrink-0 items-center justify-center",f),"aria-hidden":"true"}):null;return jsxs("div",{className:"flex w-full items-center gap-4",children:[a==="start"&&y,r&&jsx("div",{className:"flex flex-shrink-0 items-center text-text-secondary",children:r}),jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[c??jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1 text-left",children:[e&&jsx("span",{className:"truncate font-medium text-text-primary",children:e}),t&&jsx("span",{className:"text-sm text-text-secondary",children:t})]}),o&&jsx("div",{className:"flex flex-shrink-0 items-center text-sm text-text-secondary",children:o})]}),a==="end"&&y]})}})}Oo.displayName="CollapseHeader";function Ho({className:e,children:t,...r}){let{density:o,showDividers:n}=Qd();return jsx(DisclosurePanel,{...r,className:composeRenderProps(e,a=>xN({density:o,showDividers:n,className:a})),children:t})}Ho.displayName="CollapseContent";function ha(e){if(!e)return false;let t=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(t)}function _d(e){if(!e)return "";let t=e.startsWith("#")?e.slice(1):e;return t.length===3&&(t=t.split("").map(r=>r+r).join("")),`#${t.toUpperCase()}`}function CN({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,transparent:i,className:s,validationResult:c,value:l,defaultValue:d,onChange:u,placeholder:m="#000000",showColorSwatch:p=true,reserveErrorSpace:g=true,...f}){let[x,b]=useState(d||""),[h,y]=useState(l||d||""),[v,S]=useState(false),[N,w]=useState(null),{isFocused:M,handleFocus:k,handleBlur:P}=Nr(),I=l!==void 0?l:x;useEffect(()=>{l!==void 0&&y(l);},[l]);let D=I?!ha(I):false,L=useCallback(Y=>{if(y(Y),ha(Y)){let H=_d(Y);u?u(H):b(H);}else Y===""&&(u?u(""):b(""));},[u]),R=useCallback(Y=>{let H=_d(Y);y(H),u?u(H):b(H);},[u]),B=useCallback(Y=>{if(ha(h)){let H=_d(h);y(H),u&&H!==I?u(H):!u&&H!==x&&b(H);}P(Y,f.onBlur);},[h,I,x,u,P,f.onBlur]);return jsx(TextField,{...f,isRequired:a,className:ke(s,"group flex flex-col"),children:({isDisabled:Y})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(ze,{size:o,tooltip:n,isRequired:a,children:e}),jsx(bt,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(ws,{size:o,disabled:Y,type:"text",value:h,placeholder:m,onFocus:H=>k(H,f.onFocus),onBlur:B,onChange:H=>L(H.target.value),className:twMerge(Ft({isInvalid:D,isDisabled:Y,isFocused:M,size:o,transparent:i}),p?"pr-12":"pr-3","pl-3")}),p&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:We[o].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",ha(I)?"border-border-default":"border-border-default bg-background-muted"),style:ha(I)?{backgroundColor:I}:void 0,"aria-hidden":"true",children:!ha(I)&&jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsx("div",{ref:w,children:jsx(ee,{variant:"secondary",size:o,icon:"Palette",onPress:()=>S(!v),isDisabled:Y,className:"flex-shrink-0",children:"Pick"})})]})}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(be,{size:o,children:r}):typeof r=="function"&&c?jsx(be,{size:o,children:r(c)}):t?jsx(Te,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(be,{size:o,className:"mt-1",children:r}):typeof r=="function"&&c?jsx(be,{size:o,className:"mt-1",children:r(c)}):t?jsx(Te,{size:o,className:"mt-1",children:t}):null}),v&&N&&jsx(nt,{triggerRef:{current:N},isOpen:v,onOpenChange:S,placement:"bottom end",className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-lg p-4",children:jsxs("div",{className:"flex flex-col gap-4",children:[jsx(HexColorPicker,{color:I||"#000000",onChange:R,style:{width:"200px",height:"200px"}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:I||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:I||"#000000"})]})]})})]})})}function cg({isOpen:e,onClose:t,onConfirm:r,title:o,message:n,confirmLabel:a="Confirm",cancelLabel:i="Cancel",confirmVariant:s,isDestructive:c=false,isLoading:l=false,maxWidth:d="500px",minWidth:u="400px"}){return jsx(Sr,{isOpen:e,onClose:t,title:o,maxWidth:d,minWidth:u,primaryAction:{label:a,onPress:()=>{r();},variant:s??(c?"destructive":"primary"),isLoading:l},secondaryAction:{label:i,onPress:t,variant:"secondary",isDisabled:l},children:jsx("div",{className:"text-text-primary",children:n})})}function dg({isConnected:e,connectedAt:t,disconnectedAt:r,showTimestamp:o=false,isLoading:n,size:a="sm",shape:i="pill",...s}){if(n)return jsx(K,{className:"inline-flex h-6 w-24"});let c=e?"Connected":"Disconnected",l=e?"success":"neutral",d=null;if(o){if(e&&t)d=ts(t);else if(!e&&r){let u=ts(r);d=u?`Offline ${u}`:null;}}return jsxs("div",{className:"inline-flex flex-col gap-1",children:[jsx(tt,{variant:l,size:a,shape:i,dot:e,dotPulse:e,...s,children:c}),d&&jsx("span",{className:"text-xs text-text-secondary",children:d})]})}function ug({firstName:e,lastName:t,email:r,phone:o,avatarUrl:n,href:a,LinkComponent:i,variant:s="outlined",layout:c="horizontal",showEmail:l=true,showPhone:d=false,isLoading:u=false,className:m,contentClassName:p,piiEntity:g}){let f=`${e} ${t}`.trim(),x=({children:h,className:y})=>a?i?jsx(i,{href:a,className:y,children:h}):jsx(Qe,{href:a,variant:"unstyled",className:twMerge("hover:underline",y),asButton:false,children:h}):jsx("span",{className:y,children:h}),b=c==="vertical";return u?jsx(Ge,{variant:s,className:twMerge("flex flex-col",m),children:jsx(Ge.Content,{className:"flex items-center flex-1",children:jsxs("div",{className:twMerge("w-full",b?"flex flex-col items-center gap-4":"flex items-center gap-4"),children:[jsx(K,{width:56,height:56,className:"rounded flex-shrink-0"}),jsxs("div",{className:twMerge(b?"w-full text-center":"flex-1","space-y-2"),children:[jsx(K,{width:"70%",height:20,className:twMerge(b&&"mx-auto")}),jsx(K,{width:"100%",height:16,className:twMerge(b&&"mx-auto")})]})]})})}):jsx(Ge,{variant:s,className:twMerge("group/card flex flex-col",m),children:jsx(Ge.Content,{className:twMerge("flex items-center flex-1",a&&"cursor-pointer",p),children:jsxs("div",{className:twMerge("relative w-full",b?"flex flex-col items-center gap-4 text-center":"flex items-center gap-4"),children:[jsx(fo,{firstName:e,lastName:t,src:n,size:"xl",variant:"user",shape:"square",className:"flex-shrink-0",piiEntity:g}),jsxs("div",{className:twMerge(b?"w-full":"flex-1 min-w-0"),children:[a&&jsx(x,{className:"after:absolute after:inset-0",children:jsx("span",{className:"sr-only",children:f})}),jsx("span",{className:"text-lg font-semibold leading-tight text-text-primary block mb-1.5 group-hover/card:text-text-brand transition-colors","data-pii-type":g?"full-name":void 0,"data-pii-entity":g,children:f}),jsxs("div",{className:twMerge("space-y-0.5",b&&"flex flex-col items-center"),children:[l&&r&&jsxs("div",{className:"flex items-center gap-2.5 text-text-primary",children:[jsx(V,{name:"Envelope",size:16,className:"text-text-secondary flex-shrink-0"}),jsx(Qe,{href:`mailto:${r}`,variant:"unstyled",className:twMerge("text-sm leading-relaxed text-text-primary relative z-20",b?"":"truncate"),"data-pii-type":g?"email":void 0,"data-pii-entity":g,children:r})]}),d&&o&&jsxs("div",{className:"flex items-center gap-2.5 text-text-primary",children:[jsx(V,{name:"Phone",size:16,className:"text-text-secondary flex-shrink-0"}),jsx(Qe,{href:`tel:${o}`,variant:"unstyled",className:twMerge("text-sm leading-relaxed text-text-primary relative z-20",b?"":"truncate"),"data-pii-type":g?"phone":void 0,"data-pii-entity":g,children:na(o)})]})]})]})]})})})}function Fs({firstName:e,lastName:t,email:r,avatarUrl:o,layout:n="stacked",size:a="md",href:i,LinkComponent:s,linkVariant:c="unstyled",emphasis:l="normal",showEmail:d=false,badge:u,avatarShape:m,isLoading:p=false,className:g,piiEntity:f}){let x=m??(n==="inline"?"circle":"square"),h={xs:{avatarSize:"xs",gap:"gap-1.5",textSize:"text-xs",secondaryTextSize:"text-xs",skeletonAvatar:24,skeletonText:80,skeletonSecondary:60},sm:{avatarSize:"sm",gap:"gap-2",textSize:"text-sm",secondaryTextSize:"text-xs",skeletonAvatar:32,skeletonText:96,skeletonSecondary:72},md:{avatarSize:"md",gap:"gap-3",textSize:"text-base",secondaryTextSize:"text-sm",skeletonAvatar:40,skeletonText:128,skeletonSecondary:96},lg:{avatarSize:"lg",gap:"gap-3",textSize:"text-lg",secondaryTextSize:"text-base",skeletonAvatar:48,skeletonText:160,skeletonSecondary:120}}[a],y=`${e} ${t}`.trim(),S={strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[l],N=({children:w,className:M})=>i?s?jsx(s,{href:i,className:M,children:w}):jsx(Qe,{href:i,variant:c,className:twMerge("hover:underline",M),asButton:false,children:w}):jsx("span",{className:M,children:w});return p?n==="inline"?jsxs("div",{className:twMerge("flex items-center",h.gap,g),children:[jsx(K,{width:h.skeletonAvatar,height:h.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsx(K,{width:h.skeletonText,height:h.skeletonAvatar*.5})]}):jsxs("div",{className:twMerge("flex items-center",h.gap,g),children:[jsx(K,{width:h.skeletonAvatar,height:h.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx(K,{width:h.skeletonText,height:16}),d&&jsx(K,{width:h.skeletonSecondary,height:12})]})]}):n==="inline"?jsxs("div",{className:twMerge("flex items-center",h.gap,g),children:[jsxs(N,{className:twMerge("flex items-center",h.gap),children:[jsx(fo,{firstName:e,lastName:t,src:o,size:h.avatarSize,variant:"user",shape:x,className:"flex-shrink-0",piiEntity:f}),jsx("span",{className:twMerge("leading-normal truncate hover:text-text-primary",S,h.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),"data-pii-type":f?"full-name":void 0,"data-pii-entity":f,children:y})]}),u]}):jsxs("div",{className:twMerge("flex items-center justify-start",h.gap,g),children:[jsx(fo,{firstName:e,lastName:t,src:o,size:h.avatarSize,variant:"user",shape:x,className:"flex-shrink-0",piiEntity:f}),jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(N,{className:twMerge("leading-normal truncate hover:text-text-primary",S,h.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":f?"full-name":void 0,"data-pii-entity":f,children:y})}),u]}),d&&r&&jsx("div",{className:twMerge("text-text-secondary leading-normal truncate",h.secondaryTextSize),"data-pii-type":f?"email":void 0,"data-pii-entity":f,children:r})]})]})}function mg({children:e,className:t}){let r=useRef(null),[o,n]=useState({current:"base",isSm:false,isMd:false,isLg:false,isXl:false,is2Xl:false,isMobile:true,isDesktop:false});return useEffect(()=>{let a=r.current;if(!a||typeof ResizeObserver>"u")return;let i=()=>{let c=a.offsetWidth,l=c>=640,d=c>=768,u=c>=1024,m=c>=1280,p=c>=1536,g="base";p?g="2xl":m?g="xl":u?g="lg":d?g="md":l&&(g="sm"),n({current:g,isSm:l,isMd:d,isLg:u,isXl:m,is2Xl:p,isMobile:!d,isDesktop:d});};i();let s=new ResizeObserver(i);return s.observe(a),()=>s.disconnect()},[]),jsx(yc.Provider,{value:o,children:jsx("div",{ref:r,className:t,style:{width:"100%"},children:e})})}var Bs={duration:.5,ease:"easeInOut"},kr=createContext(null),Nn=()=>{let e=useContext(kr);if(!e)throw new Error("useChartContext must be used within a ChartContextProvider");return e};function Vs(e,t){if(t<=0||e.length<2)return e;let r=[e[0]];for(let o=1;o<e.length;o++)e[o].xValue.getTime()-e[o-1].xValue.getTime()>t&&r.push(null),r.push(e[o]);return r}var Go=({data:e,color:t="var(--color-viz-default)",baseline:r,fillOpacity:o=.1,showLine:n=true,maxGapMs:a,animate:i=true})=>{let s=useId(),c=useId(),{xScale:l,yScale:d,animationSettings:u}=Nn(),m=l.range(),p=d.range(),g=(y,v)=>typeof r=="function"?r(y,v):r??0,f=y=>y.chartYValue??y.yValue,x=a!=null?Vs(e,a):e,b={transformOrigin:`0 ${p[0]}px`,transformBox:"fill-box",isolation:"isolate"},h=jsxs(Fragment,{children:[r===void 0?jsx(AreaClosed,{data:x,x:y=>y?l(y.xValue):0,y:y=>y?d(f(y)):0,yScale:d,defined:y=>y!=null,fill:`url(#${s})`,curve:curveLinear}):jsx(Area,{data:x,x:y=>y?l(y.xValue):0,y0:(y,v)=>y?d(g(y,v)):0,y1:y=>y?d(f(y)):0,defined:y=>y!=null,fill:t,fillOpacity:o,curve:curveLinear}),n?jsx(LinePath,{data:x,x:y=>y?l(y.xValue):0,y:y=>y?d(f(y)):0,defined:y=>y!=null,stroke:t,strokeWidth:3,curve:curveLinear}):null]});return jsxs(Fragment,{children:[jsxs("defs",{children:[jsxs("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[jsx("stop",{offset:"50%",stopColor:t,stopOpacity:o}),jsx("stop",{offset:"100%",stopColor:t,stopOpacity:0})]}),i&&jsx("clipPath",{id:c,children:jsx("rect",{x:m[0],y:p[1],width:m[1]-m[0],height:p[0]-p[1]})})]}),i?jsx("g",{clipPath:`url(#${c})`,children:jsx(motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:u.duration,ease:u.ease},style:b,children:h})}):jsx("g",{style:b,children:h})]})};var Os=({data:e,color:t="var(--color-viz-default)",opacity:r=1,categoryColors:o={}})=>{let{xScale:n,yScale:a,animationSettings:i}=Nn(),s=useId(),c=n.range(),l=a.range(),d=[...e].sort((p,g)=>p.xValue.getTime()-g.xValue.getTime());if(d.length===0)return null;let u=d.length>1?d[1].xValue.getTime()-d[0].xValue.getTime():15*6e4,m=Math.abs(n(new Date(d[0].xValue.getTime()+u))-n(d[0].xValue));return jsxs(Fragment,{children:[jsx("defs",{children:jsx("clipPath",{id:s,children:jsx("rect",{x:c[0],y:l[1],width:c[1]-c[0],height:l[0]-l[1]})})}),jsx("g",{clipPath:`url(#${s})`,children:jsx(motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:i.duration,ease:i.ease},style:{transformOrigin:`0 ${a(0)}px`,isolation:"isolate"},children:d.map((p,g)=>{let f=n(p.xValue),x=p.chartYValue??p.yValue,b=p.baselineValue??0,h=a(x),y=a(b),v=Math.min(h,y),S=Math.abs(h-y),N=d[g+1],w=N?Math.abs(n(N.xValue)-f):m,M=p.category&&o[p.category]?o[p.category]:t;return jsx(Bar,{x:f-w/2,y:v,width:w,height:S,fill:M,opacity:r,rx:1},p.xValue.getTime())})})})]})};function GN(e){return e>=1e9?"GW":e>=1e6?"MW":e>=1e3?"kW":"W"}function UN(e){return e>=1e3?"kA":e<1?"mA":"A"}function KN(e){return e>=1e3?"kV":e<1?"mV":"V"}function YN(e){return e>=1e6?"M\u03A9":e>=1e3?"k\u03A9":e<1?"m\u03A9":"\u03A9"}function va(e,t){if(typeof e!="object"||e===null)return e;switch(e.type){case "energy":{if(e.unit||e.autoScale===false)return e;let r=e.sourceUnit?zc[e.sourceUnit]:1;return {...e,unit:Vc(t*r)}}case "power":return e.unit||e.autoScale===false?e:{...e,unit:GN(t)};case "current":return e.unit||e.autoScale===false?e:{...e,unit:UN(t)};case "voltage":return e.unit||e.autoScale===false?e:{...e,unit:KN(t)};case "resistance":return e.unit||e.autoScale===false?e:{...e,unit:YN(t)};default:return e}}var JN=e=>e.baselineValue??0,Ae={top:8,right:0,bottom:50,left:60};function Or(e={type:"number"}){let t=i=>{if(i==null)return "-";let s=Xr({value:i,formatter:e});if(s===null)return "-";if(typeof s=="string")return s;if(typeof s=="number")return s.toString();if(typeof s=="object"&&s!==null&&"props"in s){let c=d=>{if(d==null)return "";if(typeof d=="string")return d;if(typeof d=="number")return d.toString();if(typeof d=="object"&&"props"in d){let u=d.props;if(u?.children)return Array.isArray(u.children)?u.children.map(c).join(""):c(u.children)}return ""};return c(s)||i.toString()}return i.toString()},r=i=>{if(i==null)return "-";if(typeof e=="string"){let s=Xr({value:i,formatter:e});return s===null?"-":String(s)}if(typeof e=="object"&&e.type)switch(e.type){case "energy":case "power":case "voltage":case "current":case "resistance":case "temperature":case "distance":return t(i);case "currency":return t(i);default:return t(i)}return t(i)},o,n,a;return typeof e=="object"&&e.type&&e.type==="number"&&("min"in e&&(o=e.min),"max"in e&&(n=e.max)),{format:t,tickFormat:r,min:o,max:n,tickInterval:a}}var tu=(e,t)=>{let r=extent(e,o=>o.xValue);return scaleTime({range:[Ae.left,t-Ae.right],domain:r,nice:true})},ui=(e,t,r,o)=>{let n=Or(r);if(o)return scaleLinear({range:[t-Ae.bottom,Ae.top],domain:o,nice:true});let a=min(e,l=>Math.min(l.yValue,l.chartYValue??l.yValue))||0,i=max(e,l=>Math.max(l.yValue,l.chartYValue??l.yValue))||0,s=n.min!==void 0?n.min:a>=0?0:a*1.1,c=n.max!==void 0?n.max:i<=0?0:i*1.1;return scaleLinear({range:[t-Ae.bottom,Ae.top],domain:[s,c],nice:true})};function XN(e,t=12,r="system-ui"){if(typeof window>"u"||typeof document>"u")return e.length*(t*.6);let o=document.createElement("canvas"),n=null;try{n=o.getContext("2d");}catch{return e.length*(t*.6)}return n?(n.font=`${t}px ${r}`,n.measureText(e).width):e.length*(t*.6)}function Ca(e,t=12,r="system-ui"){return e.length===0?0:Math.max(...e.map(o=>XN(o,t,r)))}function pi(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function jN(e,t,r=12,o=false){if(!pi(t[0])||!pi(t[1]))return console.warn("ChartAxis: Invalid date in domain, skipping tick calculation"),[];let n=t[0].getTime(),a=t[1].getTime(),i=a-n;if(i===0||i<1e3)return [t[0]];let s=sd({start:t[0],end:t[1]},{compact:o}),l=[t[0],new Date((t[0].getTime()+t[1].getTime())/2),t[1]].map(h=>s(h)),d=Ca(l,r),m=d+d,p=Math.floor(e/m),g=Math.max(2,Math.min(8,p));if(g<=2)return [t[0],t[1]];let f=[t[0]],x=i/36e5,b;x<=1?b=6e4:x<=6?b=5*6e4:x<=48?b=60*6e4:x<=168?b=360*6e4:b=1440*6e4;for(let h=1;h<g-1;h++){let y=h/(g-1),v=n+i*y,S=Math.round(v/b)*b,N=f[f.length-1].getTime(),w=S>N?S:N+b;if(w>=a)break;f.push(new Date(w));}return f.push(t[1]),f}var qN=({top:e,scale:t,width:r})=>{let o=t.domain(),n=[o[0],o[o.length-1]],a=pi(n[0])&&pi(n[1]),i=r<400,s=a?n[0].getTime():0,c=a?n[1].getTime():0,l=useMemo(()=>a?sd({start:n[0],end:n[1]},{compact:i}):()=>"",[s,c,i,a]),d=useMemo(()=>jN(r,n,12,i),[r,s,c,i]);return d.length===0?null:jsx(Axis,{orientation:"bottom",top:e,scale:t,tickValues:d,tickFormat:u=>{let m=u;return pi(m)?l(m):""},stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:(u,m,p)=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:m===0?"start":m===p.length-1?"end":"middle"}),rangePadding:0})};function Sa(e,t=12){let r=t*2.5,o=Math.floor(e/r);return Math.max(2,Math.min(6,o))}var ru=12,QN=({left:e,scale:t,yFormatter:r,height:o})=>{let n=Or(r),a=useMemo(()=>!o||o<=0?5:Sa(o),[o]);return jsx(Axis,{orientation:"left",left:e,scale:t,numTicks:a,tickFormat:i=>(n.tickFormat||n.format)(i),stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:i=>{let s={fill:"var(--color-text-secondary)",fontSize:ru,textAnchor:"end"},c=t(i),[l,d]=t.range(),u=Math.min(l,d),m=Math.max(l,d);return c-u<ru/2?{...s,verticalAnchor:"start"}:m-c<ru/2?{...s,verticalAnchor:"end"}:{...s,dy:"0.33em"}}})},ZN=({top:e,scale:t})=>jsx(Axis,{orientation:"bottom",top:e,scale:t,stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"middle",dy:"0.25em"})}),_N=({left:e,scale:t})=>jsx(Axis,{orientation:"left",left:e,scale:t,stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"end",dx:"-0.25em",dy:"0.33em"})}),$N=({top:e,scale:t,yFormatter:r,width:o})=>{let n=Or(r),a=useMemo(()=>{if(!o||o<=0)return 5;let s=Math.floor(o/60);return Math.max(2,Math.min(8,s))},[o]);return jsx(Axis,{orientation:"bottom",top:e,scale:t,numTicks:a,tickFormat:i=>(n.tickFormat||n.format)(i),stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"middle",dy:"0.25em"})})},Tr={Bottom:qN,Left:QN,CategoryBottom:ZN,CategoryLeft:_N,NumericBottom:$N};var Uo=({data:e,formatter:t,label:r,categoryLabels:o})=>{if(!e)return null;let n=Oe__default.useContext(kr),a=o??n?.categoryLabels,i=n?.xScale,s=n?.width,c=n?.height,l=Or(t),d=h=>{if(h.baselineValue===void 0)return l.format(h.value);let y=Math.min(h.baselineValue,h.value),v=Math.max(h.baselineValue,h.value);return `${l.format(y)} \u2013 ${l.format(v)}`},u=Oe__default.useRef(null),[m,p]=Oe__default.useState({x:0,y:0,translate:"translate(-50%, -100%)"});Oe__default.useEffect(()=>{if(!u.current)return;let y=u.current.getBoundingClientRect(),v=s??window.innerWidth,S=c??window.innerHeight,N=e.x,w=e.y,M=16,k=e.x+y.width+M<=v,P=e.x-y.width-M>=0,I;e.position==="left"?I=P||!k:I=!k&&P;let D=I?"translate(calc(-100% - 16px), -50%)":"translate(16px, -50%)";if(!k&&!P){let L=v-e.x,R=e.x;L<=R?(N=v,D="translate(-100%, -50%)"):(N=0,D="translate(0, -50%)");}w-y.height/2<0?w=y.height/2:w+y.height/2>S&&(w=S-y.height/2),p({x:N,y:w,translate:D});},[e.x,e.y,e.position,s,c]);let g=i?.domain(),x=g&&g.length===2&&g.every(h=>h instanceof Date)?Km({start:g[0],end:g[1]}):null,b=r||(x&&e.xValue instanceof Date?x(e.xValue):String(e.xValue));return jsx(AnimatePresence,{children:jsxs(motion.div,{ref:u,role:"tooltip","aria-live":"polite",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},"data-testid":"tooltip",className:"pointer-events-none absolute z-50 rounded-lg bg-background-surface p-4 text-sm shadow-xl ring-1 ring-border-default whitespace-nowrap",style:{left:m.x,top:m.y,transform:m.translate},children:[jsx("div",{className:"mb-1 font-medium text-text-primary",children:b}),e.isEvent?jsxs("div",{className:"space-y-2",children:[e.series.length>1&&jsx("ul",{className:"list-none p-0 border-b border-border-default pb-2",children:e.series.slice(0,-1).map(h=>jsxs("li",{className:"py-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"font-medium text-text-primary",children:[h.label,":"]}),jsx("span",{className:"text-text-secondary",children:d(h)})]}),h.category&&jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsx("div",{className:"h-3 w-3",style:{backgroundColor:h.categoryColor||h.color,borderRadius:"1px"}}),jsx("span",{className:"text-sm text-text-secondary",children:a?.[h.category]||h.category})]}),h.extraTooltipRows&&h.extraTooltipRows.length>0&&jsx("div",{className:"mt-0.5 space-y-0.5",children:h.extraTooltipRows.map(y=>jsxs("div",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[jsxs("span",{children:[y.label,":"]}),jsx("span",{className:"font-medium text-text-primary",children:y.value})]},y.label))})]},h.label))}),(()=>{let h=e.series[e.series.length-1],y=e.eventItems?.length?e.eventItems:[{label:h.label,color:h.color,metadata:e.eventMetadata}];return jsx("div",{className:"space-y-2",children:y.map((v,S)=>jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:v.color}}),jsx("span",{className:"font-medium text-text-primary",children:v.label})]}),v.metadata&&Object.keys(v.metadata).length>0&&jsx("div",{className:"ml-4 mt-1 space-y-0.5 text-xs text-text-secondary",children:Object.entries(v.metadata).map(([N,w])=>jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"capitalize",children:[N,":"]}),jsx("span",{className:"font-medium",children:w})]},N))})]},`${v.label}-${S}`))})})()]}):jsx("ul",{className:"list-none p-0",children:e.series.map(h=>jsxs("li",{className:"py-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"font-medium text-text-primary",children:[h.label,":"]}),jsx("span",{className:"text-text-secondary",children:d(h)})]}),h.category&&jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsx("div",{className:"h-3 w-3",style:{backgroundColor:h.categoryColor||h.color,borderRadius:"1px"}}),jsx("span",{className:"text-sm text-text-secondary",children:a?.[h.category]||h.category})]}),h.extraTooltipRows&&h.extraTooltipRows.length>0&&jsx("div",{className:"mt-0.5 space-y-0.5",children:h.extraTooltipRows.map(y=>jsxs("div",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[jsxs("span",{children:[y.label,":"]}),jsx("span",{className:"font-medium text-text-primary",children:y.value})]},y.label))})]},h.label))})]})})};var lk={top:20,right:20,bottom:50,left:60},wg=({data:e,width:t,height:r,margin:o=lk,color:n,yFormatter:a={type:"number"},showGrid:i=true,showAxes:s=true,animate:c=true,barRadius:l=4,barPadding:d=.3,onBarClick:u,onBarHover:m,activeIndex:p,className:g,style:f,"aria-label":x="Category bar chart",orientation:b="vertical",showTooltip:h=true})=>{let[y,v]=useState(null),[S,N]=useState(null),[w,M]=useState(null),[k,P]=useState(t??600),[I,D]=useState(r??300),L=useRef(null),R=p??y,B=useId(),Y=n||"var(--color-viz-default)";useEffect(()=>{if(t!==void 0&&r!==void 0){P(t),D(r);return}if(!L.current)return;let T=new ResizeObserver(E=>{for(let O of E)t===void 0&&P(O.contentRect.width),r===void 0&&D(O.contentRect.height);});return T.observe(L.current),t===void 0&&P(L.current.offsetWidth),r===void 0&&D(L.current.offsetHeight||300),()=>{T.disconnect();}},[t,r]);let{xScale:H,yScale:W,innerWidth:Z,innerHeight:q}=useMemo(()=>{let T=k-o.left-o.right,E=I-o.top-o.bottom;if(b==="horizontal"){let A=max(e,C=>C.value)||0;return {xScale:scaleLinear({range:[0,T],domain:[0,A*1.1],nice:true}),yScale:scaleBand({range:[0,E],domain:e.map(C=>C.label),padding:d}),innerWidth:T,innerHeight:E}}let O=max(e,A=>A.value)||0;return {xScale:scaleBand({range:[0,T],domain:e.map(A=>A.label),padding:d}),yScale:scaleLinear({range:[E,0],domain:[0,O*1.1],nice:true}),innerWidth:T,innerHeight:E}},[e,k,I,o,d,b]);if(e.length===0)return jsx("div",{ref:L,className:twMerge("flex h-full min-h-[200px] w-full items-center justify-center rounded-lg border border-dashed border-border-default bg-background-surface text-sm font-medium text-text-secondary",g),style:r!==void 0?{height:r,...f}:f,children:"No data available"});let Q=(T,E)=>{if(v(T),m?.(E,T),T!==null&&E){let O,A;if(b==="horizontal"){let F=H(E.value),z=W(E.label)||0,G=W.bandwidth();O=o.left+F,A=o.top+z+G/2;}else {let F=H,z=W,G=F(E.label)??0,oe=F.bandwidth(),ue=z(E.value);O=o.left+G+oe/2,A=o.top+ue;}let C=O>k/2;M(E.label),N({xValue:new Date,series:[{label:"Value",value:E.value,color:E.color||Y}],x:O,y:A,position:C?"left":"right"});}else N(null),M(null);};return jsxs("div",{ref:L,className:twMerge("relative h-full w-full overflow-hidden rounded-lg bg-background-surface",g),style:r!==void 0?{height:r,...f}:f,"aria-label":x,role:"img",children:[jsxs("svg",{width:k,height:I,children:[jsx("defs",{children:jsx(LinearGradient,{id:`${B}-bar`,from:Y,to:Y,toOpacity:.85})}),jsxs(Group,{left:o.left,top:o.top,children:[i&&jsx("g",{className:"grid-lines",children:(b==="horizontal"?H.ticks(5):W.ticks(5)).map(T=>{let E=b==="horizontal"?0:W(T),O=b==="horizontal"?H(T):0;return jsx("line",{x1:b==="horizontal"?O:0,y1:b==="horizontal"?0:E,x2:b==="horizontal"?O:Z,y2:b==="horizontal"?q:E,stroke:"var(--color-border-default)",strokeOpacity:.5,strokeDasharray:"2,3"},T)})}),e.map((T,E)=>{let O=R===E||R==null,A=T.color||`url(#${B}-bar)`;if(b==="horizontal"){let te=H(T.value),le=W.bandwidth(),me=W(T.label)||0;return jsx(motion.rect,{x:0,y:me,width:te,height:le,fill:A,rx:l,ry:l,initial:c?{width:0,opacity:.5}:void 0,animate:{width:te,opacity:O?1:.5},transition:{duration:.5,delay:E*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:u||m?"pointer":"default"},onMouseEnter:()=>Q(E,T),onMouseLeave:()=>Q(null,null),onClick:()=>u?.(T,E)},T.label)}let C=H,F=W,z=C.bandwidth(),G=C(T.label)??0,oe=F(T.value),ue=Math.max(0,q-oe);return c?jsx(motion.rect,{x:G,width:z,fill:A,rx:l,ry:l,initial:{y:q,height:0,opacity:.5},animate:{y:oe,height:ue,opacity:O?1:.5},transition:{duration:.5,delay:E*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:u||m?"pointer":"default"},onMouseEnter:()=>Q(E,T),onMouseLeave:()=>Q(null,null),onClick:()=>u?.(T,E)},T.label):jsx("rect",{x:G,y:oe,width:z,height:ue,fill:A,rx:l,ry:l,opacity:O?1:.5,style:{cursor:u||m?"pointer":"default",transition:"opacity 150ms ease-out"},onMouseEnter:()=>Q(E,T),onMouseLeave:()=>Q(null,null),onClick:()=>u?.(T,E)},T.label)}),s&&b==="vertical"&&jsxs(Fragment,{children:[jsx(Tr.CategoryBottom,{top:q,scale:H}),jsx(Tr.Left,{left:0,scale:W,yFormatter:a,height:q})]}),s&&b==="horizontal"&&jsxs(Fragment,{children:[jsx(Tr.NumericBottom,{top:q,scale:H,yFormatter:a,width:Z}),jsx(Tr.CategoryLeft,{left:0,scale:W})]})]})]}),h&&jsx(Uo,{data:S,formatter:a,label:w??void 0})]})};var Ng=({item:e,onToggle:t})=>{let r=jsxs(Fragment,{children:[jsx("div",{className:"h-3 w-3 shrink-0",style:{backgroundColor:e.fill,borderRadius:"1px",opacity:e.isHidden?.35:1}}),jsx("span",{className:`text-sm whitespace-nowrap ${e.isHidden?"text-text-disabled line-through":"text-text-secondary"}`,children:e.category})]});return t?jsx("button",{type:"button",className:"flex items-center gap-2 shrink-0 rounded-sm focus:outline-none focus:ring-2 focus:ring-border-focus disabled:cursor-not-allowed disabled:opacity-60","aria-pressed":!e.isHidden,"aria-label":`${e.isHidden?"Show":"Hide"} ${e.category}`,disabled:e.isDisabled,onClick:()=>t(e.category),children:r}):jsx("div",{className:"flex items-center gap-2 shrink-0",children:r})},uk=({items:e,onToggle:t})=>e.length===0?null:jsx("div",{className:"flex items-center gap-3 flex-wrap",children:e.map(r=>jsx(Ng,{item:r,onToggle:t},r.category))}),Na=({items:e,onExport:t,marginLeft:r=0,marginRight:o=0,isZoomed:n=false,onResetZoom:a,onLegendItemToggle:i})=>{let[s,c]=Oe__default.useState(false),[l,d]=Oe__default.useState(null),[u,m]=Oe__default.useState(false),[p,g]=Oe__default.useState(false),f=Oe__default.useCallback(async b=>{c(true),d(b),g(false);try{await t(b);}catch(h){console.error("Export failed:",h);}finally{c(false),d(null);}},[t]),x=Oe__default.useCallback(async b=>{await f(b);},[f]);return jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 min-h-[32px]",style:{marginLeft:r,marginRight:o},children:[jsx("div",{className:"hidden sm:block flex-1 min-w-0",children:jsx(uk,{items:e,onToggle:i})}),jsx("div",{className:"sm:hidden flex items-center gap-3",children:e.length>0&&jsxs(Fragment,{children:[jsx("button",{onClick:()=>m(true),className:"text-sm text-text-secondary hover:text-text-primary transition-colors underline decoration-dotted underline-offset-4",children:"Legend"}),jsx(at,{isOpen:u,onClose:()=>m(false),title:"Legend",children:jsx("div",{className:"grid grid-cols-1 gap-3 p-4",children:e.map(b=>jsx(Ng,{item:b,onToggle:i},b.category))})})]})}),jsxs("div",{className:"sm:hidden flex items-center gap-2 shrink-0",children:[n&&a&&jsx(ee,{variant:"secondary",size:"sm",onPress:a,children:jsx(V,{name:"ArrowsOut",size:16})}),jsx(ee,{variant:"secondary",size:"sm",onPress:()=>g(true),isDisabled:s,children:jsx(V,{name:"Export",size:16})}),jsx(at,{isOpen:p,onClose:()=>g(false),title:"Export Chart",contentPadding:false,children:jsxs("div",{className:"flex flex-col",children:[jsxs("button",{onClick:()=>f("csv"),disabled:s,className:"flex items-center gap-3 px-6 py-4 text-left hover:bg-background-hover active:bg-background-muted transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[jsx(V,{name:"List",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:l==="csv"?"Exporting...":"Export as CSV"})]}),jsxs("button",{onClick:()=>f("svg"),disabled:s,className:"flex items-center gap-3 px-6 py-4 text-left hover:bg-background-hover active:bg-background-muted transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[jsx(V,{name:"Code",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:l==="svg"?"Exporting...":"Export as SVG"})]}),jsxs("button",{onClick:()=>f("png"),disabled:s,className:"flex items-center gap-3 px-6 py-4 text-left hover:bg-background-hover active:bg-background-muted transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[jsx(V,{name:"DownloadSimple",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:l==="png"?"Exporting...":"Export as PNG"})]})]})})]}),jsxs("div",{className:"hidden sm:flex items-center gap-2 shrink-0",children:[n&&a&&jsxs(ee,{variant:"secondary",size:"sm",onPress:a,children:[jsx(V,{name:"ArrowsOut",size:16}),jsx("span",{className:"hidden sm:inline",children:"Reset Zoom"})]}),jsxs(DialogTrigger,{children:[jsxs(ee,{variant:"secondary",size:"sm",isDisabled:s,children:[jsx(V,{name:"Export",size:16}),s?"Exporting...":"Export"]}),jsx(nt,{placement:"top end",className:"min-w-48 p-1 bg-background-surface rounded-lg shadow-xl ring-1 ring-border-default",children:jsxs(Menu,{onAction:x,className:"outline-none",children:[jsx(MenuItem,{id:"csv",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:s,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(V,{name:"List",size:14}),l==="csv"?"Exporting...":"Export as CSV"]})}),jsx(MenuItem,{id:"svg",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:s,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(V,{name:"Code",size:14}),l==="svg"?"Exporting...":"Export as SVG"]})}),jsx(MenuItem,{id:"png",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:s,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(V,{name:"DownloadSimple",size:14}),l==="png"?"Exporting...":"Export as PNG"]})})]})})]})]})]})};var Gs=Ep(wc());var Tg=["stroke","fill","color","stop-color","flood-color","lighting-color"],Pg=/var\s*\(/;function Rg(e,t){let r=[e,...Array.from(e.querySelectorAll("*"))],o=[t,...Array.from(t.querySelectorAll("*"))],n=Math.min(r.length,o.length);for(let a=0;a<n;a++){let i=r[a],s=o[a];if(!(i instanceof Element)||!(s instanceof Element))continue;let c=window.getComputedStyle(i);for(let l of Tg){let d=s.getAttribute(l);if(d&&Pg.test(d)){let u=c.getPropertyValue(l);u&&s.setAttribute(l,u.trim());}}if(s instanceof HTMLElement||s instanceof SVGElement)for(let l of Tg){let d=l,u=s.style.getPropertyValue(d);if(u&&Pg.test(u)){let m=c.getPropertyValue(d);m&&s.style.setProperty(d,m.trim());}}}}function nu(e,t,r=true){let o=e||"chart";if(r){let n=new Date().toISOString().replace(/[:.]/g,"-").slice(0,-5);return `${o}-${n}.${t}`}return `${o}.${t}`}async function au(e,t,r={},o){let n=Array.isArray(t[0])?t:[t];try{switch(e){case "csv":await mk(n,r);break;case "svg":await fk(o,r);break;case "png":await gk(o,r);break;default:throw new Error(`Unsupported export type: ${e}`)}}catch(a){throw console.error("Export failed:",a),new Error(`Failed to export chart as ${e}: ${a instanceof Error?a.message:"Unknown error"}`)}}async function mk(e,t){try{let r=t.yFormat?Qc(t.yFormat):null,o=t.yFormat,n=m=>{if(m==null||m==="")return "";if(!o)return typeof m=="number"?m:String(m);let p=Cm(m,o);return p===null?typeof m=="number"?m:String(m):p},a=new Map;e.forEach(m=>{m.forEach(p=>{let g=p.xValue.getTime();a.has(g)||a.set(g,p.xValue);});});let i=Array.from(a.values()).sort((m,p)=>m.getTime()-p.getTime()),s=e.map((m,p)=>{let g=t.seriesLabels?.[p]||`Series ${p+1}`;return r&&!g.includes(`(${r})`)?`${g} (${r})`:g}),c=i.map(m=>{let p={[t.xLabel||"Date"]:m.toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return e.forEach((g,f)=>{let x=s[f],b=g.find(h=>h.xValue.getTime()===m.getTime());p[x]=b?n(b.yValue):"",b?.category&&(p[`${x} Category`]=b.category);}),p}),l=zv.unparse(c,{header:!0,skipEmptyLines:!0}),d=new Blob([l],{type:"text/csv;charset=utf-8;"}),u=nu(t.filename||"chart-data","csv",t.timestamp!==!1);(0,Gs.saveAs)(d,u);}catch(r){throw new Error(`CSV export failed: ${r instanceof Error?r.message:"Unknown error"}`)}}async function fk(e,t){if(!e.current)throw new Error("SVG element not found");try{let r=e.current,o=r.cloneNode(!0);if(Rg(r,o),!o.querySelector("rect[data-background]")){let l=document.createElementNS("http://www.w3.org/2000/svg","rect");l.setAttribute("width",o.getAttribute("width")||"100%"),l.setAttribute("height",o.getAttribute("height")||"100%"),l.setAttribute("fill","white"),l.setAttribute("data-background","true"),o.insertBefore(l,o.firstChild);}let i=new XMLSerializer().serializeToString(o);i.includes("<?xml")||(i=`<?xml version="1.0" encoding="UTF-8"?>
|
|
27
|
+
`}})]})}function Cs(e,t=300){let[r,o]=useState(false);return useEffect(()=>{if(e){let n=setTimeout(()=>{o(true);},t);return ()=>clearTimeout(n)}o(false);},[e,t]),r}var NS=({isEntering:e,isExiting:t,className:r})=>["max-w-[200px] group bg-action-default border border-action-default-hover text-[color:var(--color-action-default-text)] text-sm rounded-lg drop-shadow-lg will-change-transform px-3 py-1",e?"animate-in fade-in placement-bottom:slide-in-from-top-0.5 placement-top:slide-in-from-bottom-0.5 placement-left:slide-in-from-right-0.5 placement-right:slide-in-from-left-0.5 ease-out duration-200":"",t?"animate-out fade-out placement-bottom:slide-out-to-top-0.5 placement-top:slide-out-to-bottom-0.5 placement-left:slide-out-to-right-0.5 placement-right:slide-out-to-left-0.5 ease-in duration-150":"",r].filter(Boolean).join(" ");function Qt({children:e,content:t,...r}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...r,offset:10,className:composeRenderProps(r.className,(o,n)=>NS({...n,className:o})),children:[jsx(OverlayArrow,{children:jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-action-default stroke-action-default-hover group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L4 4 L8 0"})})}),t]})]})}function Nr(){let[e,t]=Oe__default.useState(false),r=Oe__default.useCallback((n,a)=>{t(true),a?.(n);},[]),o=Oe__default.useCallback((n,a)=>{t(false),a?.(n);},[]);return {isFocused:e,handleFocus:r,handleBlur:o}}var bt=Oe__default.forwardRef(({children:e,className:t},r)=>jsx("div",{ref:r,className:twMerge("relative w-full",t),children:e}));bt.displayName="InputWrapper";function ai({onClick:e,size:t="md",className:r}){return jsx("button",{type:"button",onClick:o=>{o.preventDefault(),o.stopPropagation(),e();},className:twMerge("absolute right-2 top-[48%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary cursor-pointer",r),"aria-label":"Clear input",onMouseDown:o=>{o.preventDefault(),o.stopPropagation();},children:jsx(V,{name:"X",size:t==="sm"?16:20})})}function Io(e){let{isInvalid:t,isDisabled:r,isFocused:o}=e,n="border rounded-[var(--control-border-radius)] !outline-none ";return r?`${n} border-border-muted`:t&&o?`${n} border-feedback-error-border shadow-[inset_0_0_0_1px_var(--color-feedback-error-border)]`:t?`${n} border-feedback-error-border`:o?`${n} border-border-focus shadow-[inset_0_0_0_1px_var(--color-border-focus)]`:`${n} border-border-input`}function vf(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function kS(e){return e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":""}function Ft(e){let{isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:a="md",className:i}=e;return twMerge("w-full",Io({isInvalid:t,isDisabled:r,isFocused:o}),vf({transparent:n,isDisabled:r}),We[a].text,We[a].height,We[a].padding,kS(a),i)}function TS(e){let{size:t="md",isFocusWithin:r,isInvalid:o,isDisabled:n,transparent:a,className:i}=e;return twMerge("group flex items-center rounded-[var(--control-border-radius)] overflow-hidden",vf({transparent:a,isDisabled:n}),We[t].height,Io({isFocused:r,isInvalid:o,isDisabled:n}),i)}function ze({children:e,size:t="md",tooltip:r,description:o,descriptionPlacement:n="below",isRequired:a,className:i,htmlFor:s}){let c=r||o&&n==="tooltip",l=r||o,d=o&&n==="inline",u=jsxs("label",{htmlFor:s,className:twMerge(We[t].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,a&&jsx("span",{children:"*"}),c&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(V,{name:"Info",size:t==="sm"?16:20})}),d&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:o})]});return c&&l?jsx(Qt,{content:l,children:u}):u}function Te({size:e="md",className:t,children:r,...o}){return jsx("div",{...o,className:twMerge("leading-[2.25] text-text-secondary",We[e].text,t),children:r})}function be({children:e,size:t="md",className:r}){return jsx("div",{role:"alert",className:twMerge(We[t].text,"text-feedback-error-text",r),children:e})}function ws({size:e="md",isInvalid:t,isDisabled:r,isFocused:o,transparent:n,className:a,...i}){return jsx("input",{className:Ft({isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:e,className:a}),...i})}function Cf(e){let{children:t,...r}=e;return jsx("div",{...r,className:TS(e),children:typeof t=="function"?t(e):t})}var Ad=createContext("md");function Tf(){return useContext(Ad)}function Dd(e="md"){let t=e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":"";return `flex-1 text-start data-[placeholder]:text-text-disabled overflow-hidden text-ellipsis whitespace-nowrap ${We[e].text} ${t}`}function ES(){let e=Oe__default.useCallback((r,o)=>{o?.(r);},[]),t=Oe__default.useCallback((r,o)=>{o?.(r);},[]);return {handleFocus:e,handleBlur:t}}function gn({label:e,description:t,errorMessage:r,children:o,items:n,renderItem:a,renderSelectedValue:i,size:s="md",selectedKey:c,defaultSelectedKey:l,onSelectionChange:d,placeholder:u,showErrors:m=false,tooltip:p,isRequired:g,transparent:f,reserveErrorSpace:x=false,placement:b="bottom start",shouldFlip:h=true,menuWidth:y="match",descriptionPlacement:v="below",useMobileTray:S=true,...N}){let[w,M]=useState(null),[k,P]=useState(null),[I,D]=useState(false),L=c??w??l,{handleFocus:R,handleBlur:B}=ES(),{isMobile:Y}=Jt(),H=S&&Y,W=Oe__default.useMemo(()=>!i||!L||!n?null:Array.from(n).find(O=>O.id===L)??null,[i,L,n]),Z=E=>{d&&E!==null&&d(E),d||M(E);},q=useRef(null),Q=useRef(null),T=()=>{H&&D(!I);};return jsxs(Fragment,{children:[jsx(Select,{...N,selectedKey:L,defaultSelectedKey:l,onSelectionChange:Z,placeholder:u,className:ke(N.className,"group flex w-full flex-col"),ref:q,onOpenChange:E=>{H||(E&&Q.current?P(Q.current.offsetWidth):E||q.current?.blur());},children:({isDisabled:E,isInvalid:O,isOpen:A})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(ze,{size:s,tooltip:p,description:v==="tooltip"||v==="inline"?t:void 0,descriptionPlacement:v,isRequired:g,children:e}),jsx(bt,{children:jsx("div",{ref:Q,children:jsxs(ee,{variant:"unstyled",className:twMerge(Ft({isInvalid:O||m&&!!r,isDisabled:E,isFocused:H?I:A,transparent:f,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:C=>R(C,N.onFocus),onBlur:C=>B(C,N.onBlur),onPress:H?T:void 0,"data-open":H?I:A,children:[i&&W?jsx("div",{className:Dd(s),children:i(W)}):H&&L?jsx("div",{className:Dd(s),children:n?Array.from(n).find(z=>z.id===L)?.label:String(L)}):jsx(SelectValue,{className:Dd(s)}),jsx(V,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] transition-transform",(H?I:A)&&"rotate-180")})]})})}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:m?jsx(be,{size:s,className:"text-feedback-error-text",children:typeof r=="function"&&N.validationResult?r(N.validationResult):typeof r=="string"?r:null}):t&&v==="below"?jsx(Te,{size:s,children:t}):null}):jsx(Fragment,{children:m?jsx(be,{size:s,className:"mt-1 text-feedback-error-text",children:typeof r=="function"&&N.validationResult?r(N.validationResult):typeof r=="string"?r:null}):t&&v==="below"?jsx(Te,{size:s,className:"mt-1",children:t}):null}),H?null:jsx(nt,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:y==="match"&&k?`${k}px`:void 0,minWidth:y==="auto"&&k?`${k}px`:void 0,maxWidth:y==="auto"?"min(600px, 90vw)":void 0},placement:b,shouldFlip:h,children:jsx(Ad.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:a&&n?C=>jsx(Zt,{id:C.id,textValue:C.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(C)})},C.id):o})})})]})}),H&&jsx(at,{isOpen:I,onClose:()=>D(false),title:e??"Select an option",contentPadding:false,children:jsx(Ad.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:L!=null?[L]:[],onSelectionChange:E=>{let O=Array.from(E)[0];O!=null&&(Z(O),D(false));},children:a&&n?E=>jsx(Zt,{id:E.id,textValue:E.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(E)})},E.id):o})})})]})}function Zt({size:e,className:t,...r}){let o=Tf(),n=e??o;return jsx(ListBoxItem,{...r,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-primary data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-default data-[focus-visible]:ring-inset data-[selected]:bg-background-selected data-[selected]:font-medium overflow-hidden",We[n].paddingY,We[n].text,t)})}var KS=[],YS={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},JS={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Rf={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},Fd=(e,t,r)=>{if(e==null||e==="")return "";let n=(r?r.flatMap(a=>a.items):t||[]).find(a=>a.id===e);return n?n.name:""};async function XS(e,t,r){try{let o=e.url.replace("{q}",t),n=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([c,l])=>{n.append(c,l.toString());});let a=`${o}${n.toString()?"?"+n.toString():""}`,i=await fetch(a,{method:"GET",headers:e.headers,signal:r});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let s=await i.json();return {items:e.transformResponse(s)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return {items:[]};console.error("Error in REST request:",o);let n=o instanceof Error?o.message:"Unknown error occurred";return {items:[],error:n}}}async function jS(e,t,r){try{let o=e.graphqlQuery.replace(`$${e.variableKey||"filter"}`,`"${t}"`),n=await fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:JSON.stringify({query:o}),signal:r});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);let a=await n.json();if(a.errors)throw new Error(a.errors[0]?.message||"GraphQL error occurred");return e.responsePath&&(a=e.responsePath.split(".").reduce((i,s)=>i?.[s],a)),{items:e.transformResponse(a)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return {items:[]};console.error("Error in GraphQL request:",o);let n=o instanceof Error?o.message:"Unknown error occurred";return {items:[],error:n}}}function Ts({label:e,staticItems:t=KS,sections:r,selectedKey:o,defaultSelectedKey:n,onSelectionChange:a,requestConfig:i,defaultFilter:s,placeholder:c,errorMessage:l,description:d,size:u="md",tooltip:m,isRequired:p,isDisabled:g,isInvalid:f,validationResult:x,showErrors:b=true,renderItem:h,renderLeftIcon:y,renderSection:v,autoFocus:S=false,reserveErrorSpace:N=false,hideChevron:w=false,useMobileTray:M=true,className:k}){let P=Oe__default.useRef(null),I=Oe__default.useRef(null),[D,L]=Oe__default.useState(),[R,B]=useState(()=>Fd(o||n,t,r)),[Y,H]=useState(false),[W,Z]=useState(false),q=Po(R),{contains:Q}=useFilter({sensitivity:"base"}),[T,E]=useState(),{isMobile:O}=Jt(),A=M&&O,C=We[u].text,F=useAsyncList({async load({signal:re,filterText:ie=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(ie))return {items:[]};try{let fe;return i.requestType==="GraphQL"?fe=await jS(i,ie,re):fe=await XS(i,ie,re),E(fe.error),{items:fe.items}}catch(fe){return fe instanceof Error&&fe.name==="AbortError"?{items:[]}:(console.error("Error loading items:",fe),E(fe instanceof Error?fe.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),z=i&&q!==""?F:null,G=false,oe=useRef("");useEffect(()=>{S&&H(true);},[S]),useEffect(()=>{let re=Fd(o,t,r);re!==R&&B(re);},[o,t,r]),useEffect(()=>{let re=()=>{P.current&&L(P.current.offsetWidth);};return re(),window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[]),useEffect(()=>{q===""?oe.current="":z&&q!==oe.current&&(oe.current=q,z.setFilterText(q));},[q,z]),G=Cs(!!z?.isLoading,300);let ue=Oe__default.useMemo(()=>{if(!A||!R)return z?z.items:t;let re=z?z.items:t,ie=s??(i?()=>true:Q);return re.filter(fe=>ie(fe.name,R))},[A,R,z,t,s,Q]),te=re=>{let ie=Fd(re,t,r);B(ie),a&&a(re);},le=re=>{B(re);},me=()=>{A&&Z(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:te,selectedKey:o||void 0,defaultSelectedKey:n||void 0,items:z?z.items:r?r.flatMap(re=>re.items):t,className:ke(k,"group flex flex-col w-full"),menuTrigger:A?"manual":i?"input":"focus",allowsEmptyCollection:!!i,isDisabled:g,isInvalid:f||!!l,inputValue:R,onInputChange:le,autoFocus:S&&!A,defaultFilter:s??(i?()=>true:Q),"aria-label":e||c||"Autocomplete",children:re=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(ze,{size:u,tooltip:m,isRequired:p,children:e}),jsxs(bt,{ref:P,children:[y?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:y(G)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:G?jsx(mo,{size:16,color:"text-text-secondary"}):jsx(V,{name:"MagnifyingGlass",className:`${YS[u]} text-text-secondary`})}),jsx(Input,{className:Ft({isInvalid:f||!!l,isDisabled:g,isFocused:Y||(A?W:re.isOpen),size:u,className:twMerge(JS[u],R&&!g||!w&&!R?"pr-10":"pr-3",A&&"cursor-pointer",k)}),placeholder:c,disabled:g,onFocus:ie=>{H(true),A&&(ie.currentTarget.blur(),me());},onBlur:()=>{H(false);},onClick:A?me:void 0,readOnly:A,"aria-label":e||c||"Autocomplete"}),R&&!g&&jsx(ai,{onClick:()=>{B(""),a?.(null);},size:u}),!w&&!R&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":"Toggle menu",isDisabled:g,children:({isPressed:ie})=>jsx(V,{name:ie?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),N?jsx("div",{className:"mt-1 min-h-[20px]",children:b&&T?jsx(be,{size:u,className:"text-feedback-error-text",children:T}):b&&typeof l=="string"?jsx(be,{size:u,className:"text-feedback-error-text",children:l}):b&&typeof l=="function"&&x?jsx(be,{size:u,className:"text-feedback-error-text",children:l(x)}):d?jsx(Te,{size:u,children:d}):null}):jsxs(Fragment,{children:[d&&jsx(Te,{size:u,className:"mt-1",children:d}),b&&T&&jsx(be,{size:u,className:"text-feedback-error-text mt-1",children:T}),b&&typeof l=="string"&&jsx(be,{size:u,className:"text-feedback-error-text mt-1",children:l}),b&&typeof l=="function"&&x&&jsx(be,{size:u,className:"text-feedback-error-text mt-1",children:l(x)})]}),!A&&jsx(nt,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm ring-1 ring-black/5 rounded-[var(--control-border-radius)]",style:{minWidth:D?`${D}px`:void 0,zIndex:9999},children:jsx(ListBox,{"aria-label":e||c||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${C}`,children:r?r.map(ie=>{let fe=ie.items.map(xe=>jsx(Zt,{id:xe.id,textValue:xe.name,size:u,className:`flex cursor-default items-center gap-2 px-3 ${Rf[u]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:h?h(xe):xe.name},xe.id));if(v){let xe=v(ie,fe);return Oe__default.isValidElement(xe)&&xe.type===ListBoxSection?xe:jsx(ListBoxSection,{children:xe},ie.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:ie.name}),fe]},ie.name)}):ie=>jsx(Zt,{id:ie.id,textValue:ie.name,size:u,className:`flex cursor-default items-center gap-2 px-3 ${Rf[u]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:h?h(ie):ie.name},ie.id)})})]})}),A&&jsx(at,{isOpen:W,onClose:()=>Z(false),title:e??c??"Search",contentPadding:false,height:"80vh",children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"p-4 border-b border-border-default",children:jsxs(bt,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:G?jsx(mo,{size:16,color:"text-text-secondary"}):jsx(V,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:I,type:"text",value:R,onChange:re=>le(re.target.value),placeholder:c,autoFocus:true,className:Ft({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),R&&jsx(ai,{onClick:()=>{B(""),a?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||c||"Suggestions",items:ue,selectedKeys:o?[o]:[],selectionMode:"single",onSelectionChange:re=>{let ie=Array.from(re)[0];ie&&(te(ie),Z(false));},className:"bg-background-input outline-none",children:re=>jsx(Zt,{id:re.id,textValue:re.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:h?h(re):re.name},re.id)})})]})})]})}function fo({src:e,alt:t,firstName:r,lastName:o,fullName:n,onClick:a,size:i="md",shape:s="circle",variant:c="user",className:l,status:d,bordered:u=false,piiEntity:m}){let[p,g]=useState(false),f=useCallback(()=>g(true),[]);useEffect(()=>{g(false);},[e]);let x={xs:"h-6 w-6 text-xs",sm:"h-8 w-8 text-sm",md:"h-10 w-10 text-base",lg:"h-12 w-12 text-lg",xl:"h-16 w-16 text-xl"},b={xs:"h-1.5 w-1.5",sm:"h-2 w-2",md:"h-2.5 w-2.5",lg:"h-3 w-3",xl:"h-4 w-4"},h={xs:"bottom-0 right-0",sm:"bottom-0 right-0",md:"bottom-0 right-0",lg:"bottom-0.5 right-0.5",xl:"bottom-1 right-1"},y={online:"bg-feedback-success-background border-feedback-success-border",offline:"bg-text-secondary border-border-muted",away:"bg-feedback-warning-background border-feedback-warning-border",busy:"bg-feedback-error-background border-feedback-error-border"},v={user:"bg-feedback-info-background text-feedback-info-text",team:"bg-feedback-info-background text-feedback-info-text",organization:"bg-feedback-success-background text-feedback-success-text"},S=s==="circle"?"rounded-full":"rounded-md",N=twMerge("relative inline-flex items-center justify-center overflow-hidden transition-opacity outline-none",x[i],S,a&&"cursor-pointer hover:opacity-80",u&&"ring-2 ring-background-surface",l),M=(()=>{if(r||o){let D=r?.[0]||"",L=o?.[0]||"";return (D+L).toUpperCase()}if(n){let D=n.split(" "),L=D[0]?.[0]||"",R=D[D.length-1]?.[0]||"";return L===R?L.toUpperCase():(L+R).toUpperCase()}return ""})(),k=()=>{let D={xs:14,sm:16,md:20,lg:24,xl:32}[i];switch(c){case "team":return jsx(Users,{size:D});case "organization":return jsx(Building2,{size:D});default:return jsx(User,{size:D})}},P=D=>{if(m)return c==="organization"?D?"organization-logo":"initials":D?"avatar":"initials"},I=()=>e&&!p?jsx("img",{src:e,alt:t||n||"Avatar",className:"h-full w-full object-cover",onError:f,"data-pii-type":P(true),"data-pii-entity":m}):M?jsx("span",{className:"font-semibold","data-pii-type":P(false),"data-pii-entity":m,children:M}):k();return jsxs("div",{className:"relative inline-block",children:[jsx("div",{"data-avatar":true,className:twMerge(N,!e||p?v[c]:""),onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,children:I()}),d&&jsx("span",{className:twMerge("absolute border-2 border-background-surface",S,b[i],h[i],y[d]),"aria-label":`Status: ${d}`})]})}var rw={default:"bg-feedback-info-background text-feedback-info-text",success:"bg-feedback-success-background text-feedback-success-text",error:"bg-feedback-error-background text-feedback-error-text",warning:"bg-feedback-warning-background text-feedback-warning-text",info:"bg-feedback-info-background text-feedback-info-text",primary:"bg-action-primary/10 text-action-primary border border-action-primary/20",brand:"bg-action-primary/10 text-action-primary border border-action-primary/20",secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border border-border-muted",neutral:"bg-background-muted text-text-secondary",charging:"bg-state-charging text-state-charging-text",discharging:"bg-state-discharging text-state-discharging-text",heat:"bg-state-heat text-state-heat-text",cool:"bg-state-cool text-state-cool-text",eco:"bg-state-eco text-state-eco-text",auto:"bg-state-auto text-state-auto-text",on:"bg-state-on text-state-on-text",off:"bg-state-off text-state-off-text",idle:"bg-state-idle text-state-idle-text",unknown:"bg-state-unknown text-state-unknown-text",connected:"bg-feedback-success-background text-feedback-success-text",disconnected:"bg-feedback-error-background text-feedback-error-text",importing:"bg-state-importing text-state-importing-text",exporting:"bg-state-exporting text-state-exporting-text"},ow={xs:"px-1.5 py-0.5 text-xs",sm:"px-2.5 py-1.5 text-xs",md:"px-3.5 py-2 text-sm",lg:"px-4 py-2.5 text-base"},nw={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"},aw={xs:"w-1 h-1",sm:"w-1.5 h-1.5",md:"w-2 h-2",lg:"w-2.5 h-2.5"};function tt({children:e,variant:t="default",size:r="sm",shape:o="square",dot:n=false,dotPosition:a="left",dotPulse:i=false,className:s}){let c=n&&jsx("span",{className:twMerge("rounded-full bg-current opacity-75",aw[r],i&&"animate-pulse"),"aria-hidden":"true"});return jsxs("span",{className:twMerge("inline-flex items-center gap-1.5 font-medium",ow[r],nw[o],rw[t],s),children:[n&&a==="left"&&c,e,n&&a==="right"&&c]})}var Qe=({href:e,children:t,className:r="",external:o=false,title:n,variant:a="secondary",onClick:i,asButton:s=false,onPress:c,showArrow:l=false,alwaysUnderlined:d=false,LinkComponent:u,"data-pii-type":m,"data-pii-entity":p})=>{let g={...m&&{"data-pii-type":m},...p&&{"data-pii-entity":p}},f=o?{target:"_blank",rel:"noopener noreferrer"}:{},v=`${`${d?"underline decoration-1 underline-offset-4 decoration-current":"hover:underline hover:decoration-1 hover:underline-offset-4 hover:decoration-current"} cursor-pointer`} ${{primary:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",secondary:"text-text-link-default hover:text-text-link-hover visited:text-text-link-default",muted:"text-text-secondary hover:text-text-secondary visited:text-text-secondary",unstyled:""}[a==="brand"?"primary":a==="default"?"secondary":a]} ${r}`,S=jsxs(Fragment,{children:[t,l&&jsxs("span",{children:["\xA0","\u2192"]})]});return s?jsx("button",{type:"button",className:v,onClick:c,title:n,...g,children:S}):u&&e?jsx(u,{href:e,className:v,title:n,onClick:i,...f,...g,children:S}):jsx("a",{href:e||"#",className:v,...f,...g,title:n,onClick:i,children:S})};var gw={info:{subtle:{container:"bg-feedback-info-background border-l-4 border-l-feedback-info-border",iconColor:"text-feedback-info-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-info-border border-feedback-info-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:Info},success:{subtle:{container:"bg-feedback-success-background border-l-4 border-l-feedback-success-border",iconColor:"text-feedback-success-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-success-border border-feedback-success-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:CheckCircle},warning:{subtle:{container:"bg-feedback-warning-background border-l-4 border-l-feedback-warning-border",iconColor:"text-feedback-warning-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-warning-border border-feedback-warning-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:AlertCircle},error:{subtle:{container:"bg-feedback-error-background border-l-4 border-l-feedback-error-border",iconColor:"text-feedback-error-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-error-border border-feedback-error-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:XCircle},discovery:{subtle:{container:"bg-background-muted border-l-4 border-l-action-brand",iconColor:"text-action-brand",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-action-brand border-action-brand",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:Lightbulb}};function Rs({variant:e="info",appearance:t="subtle",title:r,children:o,dismissible:n=false,onDismiss:a,primaryAction:i,secondaryAction:s,icon:c,hideIcon:l=false,className:d,testId:u}){let m=gw[e],p=m[t],g=m.icon,f=!!(i||s),x=!!(r||o);return jsxs("div",{className:twMerge("flex gap-3 rounded-sm border p-4",p.container,d),role:"region","aria-live":"polite","data-testid":u,children:[!l&&jsx("div",{className:twMerge("flex-shrink-0",p.iconColor),"aria-hidden":"true",children:c||jsx(g,{className:"h-5 w-5"})}),jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:[x&&jsxs("div",{className:"flex-1",children:[r&&jsx("div",{className:jt(pt("headingSm"),p.titleColor),children:r}),o&&jsx("div",{className:jt(pt("bodySm"),r?"mt-1":"",p.bodyColor),children:o})]}),f&&jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i&&(i.asLink?jsx(Qe,{asButton:true,onPress:i.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-text-inverse hover:text-text-inverse/80":"",children:i.label}):jsx(ee,{size:"sm",variant:"primary",onPress:i.onPress,className:t==="bold"?"bg-background-surface text-text-primary hover:bg-background-surface/90":"",children:i.label})),s&&(s.asLink?jsx(Qe,{asButton:true,onPress:s.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-text-inverse hover:text-text-inverse/80":"",children:s.label}):jsx(ee,{size:"sm",variant:"secondary",onPress:s.onPress,className:t==="bold"?"border-text-inverse/30 text-text-inverse hover:bg-text-inverse/10":"",children:s.label}))]})]}),n&&jsx("button",{type:"button",onClick:a,className:twMerge("flex h-8 w-8 flex-shrink-0 items-center justify-center self-start rounded-md transition-colors hover:bg-background-modal/10",p.iconColor,Ye()),"aria-label":"Dismiss banner",children:jsx(X,{className:"h-4 w-4"})})]})}function Ef({isOpen:e=true,position:t="sticky",className:r,...o}){let n=t==="fixed"?"fixed top-0 left-0 right-0 z-50":"sticky top-0 z-50",a=r?`${r} !rounded-none`:"!rounded-none";return jsx(AnimatePresence,{children:e&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:n,children:jsx(Rs,{...o,className:a})})})}function Fo({value:e,children:t,className:r,size:o="sm",iconPosition:n="right"}){let[a,i]=useState(false),l=jsx(ee,{variant:"icon",size:o,onPress:()=>{let u=e||(typeof t=="string"?t:"");navigator.clipboard.writeText(u),i(true),setTimeout(()=>{i(false);},2e3);},className:"!px-2 relative",style:{top:"0.5px"},children:jsx(V,{name:"Copy",size:o==="sm"?14:16})}),d=a?jsx(Qt,{content:"Copied!",children:l}):l;return jsxs("div",{className:twMerge("inline-flex items-center gap-0.5",r),children:[n==="left"&&d,t,n==="right"&&d]})}function Ms(e){let{children:t,maxWidth:r=600,className:o,...n}=e,{ref:a,width:i}=oa(),[s,c]=Oe__default.useState(false),[l,d]=Oe__default.useState(false),u=Oe__default.useRef(false),m=Oe__default.useMemo(()=>t&&!e.items&&typeof t!="function"?Oe__default.Children.toArray(t):null,[t,e.items]);if(Oe__default.useEffect(()=>{m&&m.length>=4&&i>0&&!u.current?(u.current=true,c(i>r),d(true)):(!m||m&&m.length<4)&&d(true);let p=setTimeout(()=>{l||d(true);},100);return ()=>clearTimeout(p)},[i,r,m,l]),m&&s&&m.length>=4){let p=m[0],g=m.slice(1,-2),f=m.slice(-2),x=g.map(b=>{if(Oe__default.isValidElement(b)){let h=b.props;if(typeof h.children=="string")return {label:h.children,href:h.href}}return {label:"..."}});return jsxs(Breadcrumbs,{...n,ref:a,className:twMerge("flex gap-2",l?"opacity-100":"opacity-0",o),children:[p,jsx(Cw,{items:x}),f]})}return jsx(Breadcrumbs,{...n,ref:a,className:twMerge("flex gap-2",l?"opacity-100":"opacity-0",o),children:t})}function Cw({items:e}){let t=e.map((r,o)=>({id:`breadcrumb-${o}`,name:r.label,href:r.href}));return jsx(Breadcrumb,{className:"flex items-center gap-2",children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(ma,{items:t,align:"left",size:"sm",children:jsx(ee,{variant:"icon",size:"sm",icon:"DotsThree","aria-label":"Show hidden breadcrumbs",className:"px-0.5"})}),jsx(ChevronRight,{className:"h-4 w-4 text-text-secondary"})]})})}function Ds(e){let{className:t,children:r,href:o,copyable:n,copyValue:a,...i}=e;return jsx(Breadcrumb,{className:ke(t,"flex items-center gap-2"),...i,children:s=>{let c=s.isCurrent,l=typeof r=="function"?r(s):r;return jsx(Fragment,{children:c?n?jsx(Fo,{value:a||(typeof l=="string"?l:void 0),size:"sm",iconPosition:"right",children:jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-primary sm:max-w-none",children:l})}):jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-primary sm:max-w-none",children:l}):jsxs(Fragment,{children:[jsx(Qe,{variant:"muted",href:o,className:"max-w-[150px] truncate sm:max-w-[300px] md:max-w-none",children:l}),jsx(ChevronRight,{className:"h-4 w-4 shrink-0 text-text-secondary"})]})})}})}function Lw({isSelected:e,isDisabled:t}){let r=[Ye,"w-9 h-9 text-sm cursor-default rounded-sm flex items-center justify-center forced-color-adjust-none font-semibold"];return t?r.push("text-text-disabled forced-colors:text-[GrayText]"):e?r.push("bg-action-default text-text-inverse invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):r.push("text-text-primary hover:bg-background-hover pressed:bg-background-selected"),r.join(" ")}function ba({errorMessage:e,...t}){return jsxs(Calendar,{...t,children:[jsx(Ls,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Es,{}),jsx(CalendarGridBody,{children:r=>jsx(CalendarCell,{date:r,className:({isSelected:o,isDisabled:n})=>`${Lw({isSelected:o,isDisabled:n})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function Ls(){let{direction:e}=useLocale(),t=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(ee,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(V,{name:"CaretRight","aria-hidden":true,size:t}):jsx(V,{name:"CaretLeft","aria-hidden":true,size:t})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsx(ee,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(V,{name:"CaretLeft","aria-hidden":true,size:t}):jsx(V,{name:"CaretRight","aria-hidden":true,size:t})})]})}function Es(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}var zf=Oe.createContext(null);function Bo(){let e=Oe.useContext(zf);if(!e)throw new Error("Carousel components must be used within a CarouselRoot");return e}function Of({page:e,defaultPage:t=0,onPageChange:r,orientation:o="horizontal",loop:n=false,autoplay:a=false,autoplayDelay:i=4e3,allowMouseDrag:s=false,spacing:c="1rem",slidesPerView:l=1,slidesPerMove:d=1,className:u,children:m,...p}){let g=e!==void 0,[f,x]=Oe.useState(t),b=g?e:f,h=Oe.useRef(null),[y,v]=Oe.useState(0),[S,N]=Oe.useState(typeof a=="boolean"?a:!!a),[w,M]=Oe.useState(false),k=Oe.useRef(null),P=Oe.useRef(null),I=typeof a=="object"&&a!==null&&a.delay?a.delay:i;Oe.useEffect(()=>{if(h.current){let C=Math.max(1,Math.floor(Number(l)||1)),F=h.current.children;if(F.length===0){v(0);return}let z=Math.ceil(F.length/C);v(z);}},[m,l]);let D=Oe.useRef(-1);Oe.useEffect(()=>{if(b!==D.current&&h.current){let C=Array.from(h.current.children);if(C.length===0)return;let F=b*l,z=Math.min(F,C.length-1),G=C[z];G&&typeof G.scrollIntoView=="function"&&(G.scrollIntoView({behavior:"smooth",block:o==="vertical"?"start":"nearest",inline:o==="horizontal"?"start":"nearest"}),D.current=b);}},[b,l,o]);let L=Oe.useCallback(C=>{let F=C;n?F<0?F=y-1:F>=y&&(F=0):F=Math.max(0,Math.min(C,y-1)),g||x(F),r?.(F);},[g,n,r,y]),R=Oe.useCallback(()=>{L(b+d);},[b,L,d]),B=Oe.useCallback(()=>{L(b-d);},[b,L,d]),Y=Oe.useRef(R);Oe.useEffect(()=>{Y.current=R;},[R]);let H=y>0&&(n||b<y-1),W=y>0&&(n||b>0),Z=Oe.useCallback(()=>{N(C=>!C);},[]);Oe.useEffect(()=>{if(S&&y>1)return k.current=setInterval(()=>{Y.current();},I),()=>{k.current&&(clearInterval(k.current),k.current=null);}},[S,y,I]);let q=Oe.useCallback(()=>{k.current&&(clearInterval(k.current),k.current=null);},[]),Q=Oe.useCallback(()=>{S&&y>1&&(k.current=setInterval(()=>{Y.current();},I));},[S,y,I]),T=Oe.useCallback(C=>{if(!s)return;M(true);let F="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientX:"clientX"in C?C.clientX:0,z="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientY:"clientY"in C?C.clientY:0;P.current={x:F,y:z};},[s]),E=Oe.useCallback(C=>{if(!w||!P.current)return;let F="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientX:"clientX"in C?C.clientX:0,z="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientY:"clientY"in C?C.clientY:0,G=F-P.current.x,oe=z-P.current.y,ue=50;o==="horizontal"&&Math.abs(G)>ue?(G>0?B():R(),M(false),P.current=null):o==="vertical"&&Math.abs(oe)>ue&&(oe>0?B():R(),M(false),P.current=null);},[w,o,R,B]),O=Oe.useCallback(()=>{M(false),P.current=null;},[]),A={currentPage:b,totalPages:y,orientation:o,loop:n,spacing:c,slidesPerView:l,goToPage:L,goToNext:R,goToPrev:B,canGoNext:H,canGoPrev:W,isAutoplayActive:S,toggleAutoplay:Z,itemsRef:h,isDragging:w,allowMouseDrag:s,handleDragStart:T,handleDragMove:E,handleDragEnd:O};return jsx(zf.Provider,{value:A,children:jsx("div",{...p,className:twMerge("relative w-full",o==="vertical"?"h-full":"",u),onMouseEnter:q,onMouseLeave:Q,children:m})})}function Hf({className:e,children:t,...r}){let{itemsRef:o,orientation:n,spacing:a,isDragging:i,allowMouseDrag:s,handleDragStart:c,handleDragMove:l,handleDragEnd:d}=Bo();return jsx("div",{ref:o,...r,className:twMerge("flex overflow-x-auto overflow-y-hidden snap-x snap-mandatory scrollbar-hide scroll-smooth",n==="vertical"&&"flex-col overflow-y-auto overflow-x-hidden snap-y",s&&i&&"cursor-grabbing select-none",s&&!i&&"cursor-grab",e),style:{gap:a,"--carousel-spacing":a,...r.style},onMouseDown:c,onMouseMove:l,onMouseUp:d,onMouseLeave:d,onTouchStart:c,onTouchMove:l,onTouchEnd:d,children:t})}function Wf({index:e,className:t,children:r,...o}){let{orientation:n,slidesPerView:a}=Bo();return jsx("div",{...o,"data-index":e,className:twMerge("shrink-0 snap-start",n==="horizontal"?"h-full":"w-full",t),style:{width:n==="horizontal"?`calc((100% - (${a-1} * var(--carousel-spacing, 1rem))) / ${a})`:void 0,height:n==="vertical"?`calc((100% - (${a-1} * var(--carousel-spacing, 1rem))) / ${a})`:void 0,...o.style},children:r})}function Gf({className:e,children:t,...r}){return jsx("div",{...r,className:twMerge("flex items-center justify-center gap-4 mt-4",e),children:t})}function Uf({className:e,children:t,...r}){let{goToPrev:o,canGoPrev:n}=Bo();return jsx("button",{type:"button",...r,onClick:a=>{o(),r.onClick?.(a);},disabled:!n||r.disabled,"aria-label":"Previous slide",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(V,{name:"CaretLeft",size:"sm"})})}function Kf({className:e,children:t,...r}){let{goToNext:o,canGoNext:n}=Bo();return jsx("button",{type:"button",...r,onClick:a=>{o(),r.onClick?.(a);},disabled:!n||r.disabled,"aria-label":"Next slide",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(V,{name:"CaretRight",size:"sm"})})}function Ud({index:e,className:t,children:r,...o}){let{currentPage:n,goToPage:a}=Bo(),i=n===e;return jsx("button",{type:"button",...o,onClick:s=>{a(e),o.onClick?.(s);},"aria-label":`Go to slide ${e+1}`,"aria-current":i,className:twMerge("h-2 rounded-full transition-all duration-200",i?"w-6 bg-action-brand":"w-2 bg-border-muted hover:bg-border-input","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",t),children:r})}function Yf({className:e,...t}){let{totalPages:r}=Bo();return jsx("div",{...t,className:twMerge("flex items-center gap-2",e),role:"group","aria-label":"Carousel indicators",children:Array.from({length:r},(o,n)=>jsx(Ud,{index:n},n))})}function Jf({className:e,children:t,...r}){let{isAutoplayActive:o,toggleAutoplay:n}=Bo();return jsx("button",{type:"button",...r,onClick:a=>{n(),r.onClick?.(a);},"aria-label":o?"Pause autoplay":"Start autoplay",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(V,{name:o?"Pause":"Play",size:"sm"})})}function Xf({className:e,...t}){let{currentPage:r,totalPages:o}=Bo();return jsxs("div",{...t,className:twMerge("text-sm text-text-secondary tabular-nums",e),"aria-live":"polite","aria-atomic":"true",children:[r+1," / ",o]})}var zw="focus:ring-action-primary",Ow="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function Kd(e){return jsxs(CheckboxGroup,{...e,className:ke(e.className,"flex flex-col gap-2"),children:[jsx(ze,{children:e.label}),e.children,e.description&&jsx(Te,{children:e.description}),jsx(be,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Hw({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function Ww({isSelected:e,isInvalid:t,isDisabled:r,isIndeterminate:o}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",a=zw,i="";return r?i="border-border-muted bg-background-muted":t?i="border-feedback-error-border bg-feedback-error-background":e||o?i=Ow:i="bg-background-input border-border-input hover:border-border-focus",`${n} ${a} ${i}`}var jf="w-4 h-4 text-current group-disabled:text-text-disabled";function vn(e){let{children:t,variant:r,...o}=e;return jsx(Checkbox,{...o,className:composeRenderProps(e.className,(n,a)=>`${Hw(a)} ${n||""}`),children:n=>{let{isSelected:a,isIndeterminate:i,...s}=n,c=jsx("div",{className:Ww({isSelected:a,isIndeterminate:i,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:jf}):a?jsx(Check,{"aria-hidden":true,className:jf}):null});return jsxs(Fragment,{children:[c,typeof t=="function"?t(n):t]})}})}var Kw={primary:"bg-action-primary/10 text-action-primary border border-action-primary/20 hover:bg-action-primary/15",secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border border-border-muted hover:bg-action-secondary-hover",info:"bg-feedback-info-background text-feedback-info-text border border-feedback-info-border hover:bg-feedback-info-background/80"};function Qf(e){return !e||e==="default"?"secondary":e==="brand"?"primary":e}var Yw={xs:"px-1.5 py-[2px] gap-0.5",sm:"px-2 py-1 gap-1",md:"px-3 py-1.5 gap-1.5",lg:"px-3 py-2 gap-2",xl:"px-4 py-2.5 gap-2"},Jw="opacity-75 cursor-not-allowed pointer-events-none";function Zf(e){let{variant:t,size:r,isDisabled:o,isClickable:n,className:a}=e,i=r==="xs"?"text-xs":We[r].text;return twMerge("inline-flex items-center justify-center rounded-full font-medium transition-colors","whitespace-nowrap select-none",Yw[r],i,Kw[t],n&&!o&&"cursor-pointer",o&&Jw,a)}function $r({children:e,onRemove:t,size:r="md",variant:o="secondary",isRemovable:n=true,isDisabled:a=false,className:i,onClick:s}){let c=!!s&&!a,l=n&&t&&!a,d=f=>{f.stopPropagation(),f.preventDefault(),t&&!a&&t();},u=()=>{s&&!a&&s();},m=r==="xs"?10:r==="sm"?12:r==="md"?14:16,g=jsxs(Fragment,{children:[jsx("span",{className:"truncate",children:e}),l?c?jsx("span",{onClick:d,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),d(f));},role:"button",tabIndex:0,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":"Remove",children:jsx(V,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):jsx("button",{type:"button",onClick:d,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":"Remove",tabIndex:-1,children:jsx(V,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):null]});return c?jsx("button",{type:"button",onClick:u,className:Zf({variant:Qf(o),size:r,isDisabled:a,isClickable:c,className:i}),disabled:a,children:g}):jsx("span",{className:Zf({variant:Qf(o),size:r,isDisabled:a,isClickable:c,className:i}),children:g})}function eg({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a=false,isDisabled:i=false,isInvalid:s=false,validationResult:c,placeholder:l="Add items...",selectedItems:d=[],onItemsChange:u,staticItems:m,fetchSuggestions:p,chipVariant:g="secondary",showErrors:f=true,className:x}){let[b,h]=useState(""),[y,v]=useState([]),[S,N]=useState(false),[w,M]=useState(false),[k,P]=useState(-1),I=Po(b,300),D=useRef(null),L=useRef(null),{isFocused:R,handleFocus:B,handleBlur:Y}=Nr(),H=useId(),W=useCallback(A=>{if(!u||!A.trim())return;let C=A.trim();if(d.includes(C)){h(""),M(false),v([]),P(-1);return}u([...d,C]),h(""),M(false),v([]),P(-1),D.current?.focus();},[d,u]),Z=useCallback(A=>{u&&u(d.filter(C=>C!==A));},[d,u]);useEffect(()=>{if(!p)return;let A=true;return (async()=>{let F=I.trim();if(!F){A&&(N(false),v([]),M(false));return}N(true);try{let z=await p(F);if(!A)return;v(z),M(!0);}catch(z){if(!A)return;console.error("Error fetching suggestions:",z),v([]),M(false);}finally{A&&N(false);}})(),()=>{A=false;}},[I,p]),useEffect(()=>{if(p||!m)return;if(!I.trim()){v([]),M(false);return}let A=m.filter(C=>C.name.toLowerCase().includes(I.toLowerCase())).map(C=>C.id);v(A),M(A.length>0||I.trim().length>0);},[I,m,p]);let q=useMemo(()=>{let A=y.filter(C=>!d.includes(C));return b.trim()&&!A.includes(b.trim())&&!d.includes(b.trim())?[...A,`Create tag: "${b.trim()}"`]:A},[y,b,d]),Q=useCallback(A=>{h(A.target.value),P(-1),A.target.value&&M(true);},[]),T=useCallback(A=>{i||(A.startsWith("Create tag:")?W(b):W(A));},[W,b,i]),E=useCallback(A=>{if(!i)switch(A.key){case "Enter":case ",":if(A.preventDefault(),k>=0&&k<q.length){let C=q[k];C.startsWith("Create tag:")?W(b):W(C);}else b.trim()&&W(b.trim());break;case "Backspace":!b&&d.length>0&&(A.preventDefault(),Z(d[d.length-1]));break;case "ArrowDown":A.preventDefault(),w&&P(C=>C<q.length-1?C+1:C);break;case "ArrowUp":A.preventDefault(),w&&P(C=>C>0?C-1:-1);break;case "Escape":M(false),P(-1);break}},[i,b,d,q,k,w,W,Z]);useEffect(()=>{let A=C=>{L.current&&C.target instanceof Node&&!L.current.contains(C.target)&&M(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);let O=()=>twMerge("flex items-center gap-1.5 rounded-md overflow-x-auto overflow-y-hidden","[&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",Io({isInvalid:s,isDisabled:i,isFocused:R}),"bg-background-input",o==="sm"&&"px-2 py-1 h-[32px]",o==="md"&&"px-2.5 py-1.5 h-[40px]",o==="lg"&&"px-3 py-2 h-[44px]",o==="xl"&&"px-3.5 py-2.5 h-[48px]",i&&"opacity-50 cursor-not-allowed bg-background-muted");return jsxs("div",{ref:L,className:twMerge("relative flex flex-col gap-1",x),children:[e&&jsx(ze,{size:o,tooltip:n,isRequired:a,children:e}),jsx(bt,{children:jsxs("div",{className:O(),onClick:()=>!i&&D.current?.focus(),children:[d.map(A=>jsx($r,{variant:g,size:"xs",onRemove:()=>Z(A),isDisabled:i,className:"shrink-0 max-h-full",children:A},A)),jsx("input",{ref:D,type:"text",role:"combobox","aria-expanded":w,"aria-haspopup":"listbox","aria-controls":H,"aria-autocomplete":"list",value:b,onChange:Q,onKeyDown:E,onFocus:A=>B(A),onBlur:A=>Y(A),placeholder:d.length===0?l:"",disabled:i,className:"flex-1 min-w-[120px] h-full !border-0 !outline-none !ring-0 bg-transparent text-text-primary text-sm placeholder:text-text-disabled disabled:cursor-not-allowed focus:!ring-0 focus:!outline-none focus:!border-0 focus-visible:!ring-0 focus-visible:!outline-none focus-visible:!border-0",style:{boxShadow:"none",WebkitAppearance:"none",appearance:"none",border:"none",outline:"none"}})]})}),w&&(b||q.length>0)&&jsx("div",{id:H,role:"listbox",className:twMerge("absolute z-50 mt-1 rounded-lg border border-border-default","max-h-60 overflow-auto bg-background-surface shadow-lg","left-0 right-0 top-full"),children:S?jsx("div",{className:"px-3 py-2 text-sm text-text-secondary",children:"Loading..."}):q.length>0?q.map((A,C)=>jsx("div",{role:"option","aria-selected":C===k,className:twMerge("cursor-pointer px-3 py-2 text-sm transition-colors","hover:bg-background-hover",C===k&&"bg-background-selected",A.startsWith("Create tag:")&&"italic text-text-secondary"),onClick:()=>T(A),children:A},A)):b&&jsx("div",{className:"px-3 py-2 text-sm text-text-secondary",children:"No suggestions found"})}),t&&jsx(Te,{size:o,className:"mt-1",children:t}),f&&typeof r=="string"&&jsx(be,{size:o,className:"text-feedback-error-text mt-1",children:r}),f&&typeof r=="function"&&c&&jsx(be,{size:o,className:"text-feedback-error-text mt-1",children:r(c)})]})}var rN={json:()=>import('ace-builds/src-noconflict/mode-json'),javascript:()=>import('ace-builds/src-noconflict/mode-javascript'),typescript:()=>import('ace-builds/src-noconflict/mode-typescript'),html:()=>import('ace-builds/src-noconflict/mode-html'),css:()=>import('ace-builds/src-noconflict/mode-css'),markdown:()=>import('ace-builds/src-noconflict/mode-markdown'),yaml:()=>import('ace-builds/src-noconflict/mode-yaml'),xml:()=>import('ace-builds/src-noconflict/mode-xml'),python:()=>import('ace-builds/src-noconflict/mode-python'),sql:()=>import('ace-builds/src-noconflict/mode-sql')},oN={github:()=>import('ace-builds/src-noconflict/theme-github'),github_dark:()=>import('ace-builds/src-noconflict/theme-github_dark')},nN={"ext-language-tools":()=>import('ace-builds/src-noconflict/ext-language_tools')},ci=new Set;async function Jd(e,t){ci.has(e)||(await t(),ci.add(e));}async function aN(e,t,r){await Promise.all([Jd(`language:${e}`,rN[e]),Jd(`theme:${t}`,oN[t]),r?Jd("extension:language-tools",nN["ext-language-tools"]):void 0]);}function rg(e,t,r){let o=ci.has(`language:${e}`)&&ci.has(`theme:${t}`);return r?o&&ci.has("extension:language-tools"):o}function og({value:e,readOnly:t=false,onChange:r,language:o="json",theme:n="github_dark",height:a,width:i="100%",className:s,lineHeight:c=19,minLines:l=3,maxLines:d=50,showLineNumbers:u=true,showGutter:m=true,fontSize:p=14,wrapEnabled:g=false}){let f=useRef(null),[x,b]=useState(()=>rg(o,n,!t)),h=useMemo(()=>{if(a)return a;let y=(e.match(/\n/g)||[]).length+1;return `${Math.max(l,Math.min(y,d))*c+10}px`},[e,a,c,l,d]);return useEffect(()=>{let y=false,v=!t;return rg(o,n,v)?(b(true),()=>{y=true;}):(b(false),aN(o,n,v).then(()=>{y||b(true);}).catch(S=>{y||b(true),console.error("Failed to load Ace editor resources",S);}),()=>{y=true;})},[o,t,n]),useEffect(()=>{x&&f.current?.editor&&f.current.editor.resize();},[h,x]),jsx("div",{className:twMerge("overflow-hidden rounded-md border border-border-input",s),style:{width:i,height:h},children:x?jsx(eN,{ref:f,mode:o,theme:n,value:e,onChange:r,readOnly:t,width:"100%",height:"100%",fontSize:p,showPrintMargin:false,showGutter:m,highlightActiveLine:!t,setOptions:{useWorker:true,showLineNumbers:u,tabSize:2,enableBasicAutocompletion:!t,enableLiveAutocompletion:!t,enableSnippets:!t,showFoldWidgets:true,wrap:g},editorProps:{$blockScrolling:true}}):jsx("div",{className:"flex h-full w-full items-center justify-center bg-surface-muted text-foreground-muted",children:"Loading editor\u2026"})})}var ag=Oe.createContext({variant:"contained",density:"comfortable",showDividers:true}),ig=Oe.createContext(null),dN={contained:"rounded-lg border border-border-default bg-background-surface overflow-hidden",bordered:"rounded-lg border border-border-default bg-background-surface",plain:"bg-transparent"},ng={true:"divide-y divide-border-default",false:"gap-3"},uN={comfortable:"px-5 py-3",compact:"px-4 py-2.5"},pN={comfortable:"px-5 pt-0",compact:"px-4 pt-0"},mN={comfortable:"h-4 w-4",compact:"h-3.5 w-3.5"};function Qd(){return Oe.useContext(ag)}function fN(e){let t=Oe.useContext(ig);if(!t)throw new Error(`${e} must be used within a <CollapseItem>`);return t}function gN({variant:e,showDividers:t,className:r}){let o="group/collapse-item w-full transition-colors",n={contained:"bg-background-surface",bordered:"bg-background-surface",plain:"bg-transparent"},a=t?"":"rounded-lg border border-border-default bg-background-surface overflow-hidden";return twMerge(o,n[e],a,r)}function bN({isDisabled:e,isPressed:t,density:r,variant:o,showDividers:n,className:a}){let i="group/collapse-header flex w-full items-start gap-4 text-left transition-colors duration-150",s=e?"cursor-not-allowed text-text-disabled":"cursor-pointer text-text-primary",c=t&&!e?"bg-background-hover":"",l=uN[r];return twMerge(i,Ye(),l,s,c,o==="plain"&&n?"px-0":"",a)}function xN({density:e,showDividers:t,className:r}){let o="text-text-primary",n=pN[e];return twMerge(o,n,t?"":"rounded-b-lg",r)}function xa({variant:e="contained",density:t="comfortable",showDividers:r=true,className:o,...n}){let a=Oe.useMemo(()=>({variant:e,density:t,showDividers:r}),[e,t,r]),i=twMerge("flex w-full flex-col",dN[e],r?ng.true:ng.false,e==="plain"&&r?"border-y border-border-default/60":"");return jsx(ag.Provider,{value:a,children:jsx(DisclosureGroup,{...n,className:ke(o,i)})})}function zo({className:e,children:t,...r}){let{variant:o,showDividers:n}=Qd();return jsx(Disclosure,{...r,className:composeRenderProps(e,a=>gN({variant:o,showDividers:n,className:a})),children:a=>jsx(ig.Provider,{value:a,children:t})})}zo.displayName="CollapseItem";function Oo({title:e,description:t,startContent:r,endContent:o,indicator:n,indicatorPosition:a="end",showIndicator:i=true,keepIndicatorSpace:s=false,children:c,className:l,...d}){let u=fN("CollapseHeader"),{density:m,variant:p,showDividers:g}=Qd(),f=mN[m];return jsx(Button,{...d,slot:"trigger","data-expanded":u.isExpanded?"true":void 0,className:composeRenderProps(l,(x,b)=>bN({isDisabled:b.isDisabled??false,isPressed:b.isPressed??false,density:m,variant:p,showDividers:g,className:x})),children:x=>{let b=x.isDisabled??false,h=i?typeof n=="function"?n({isExpanded:u.isExpanded,isDisabled:b}):n??jsx(V,{name:"CaretDown",size:m==="compact"?"xs":"sm",weight:"bold","aria-hidden":"true",className:twMerge("text-text-secondary transition-transform duration-200",u.isExpanded?"rotate-180":"rotate-0")}):null,y=h?jsx("span",{className:twMerge("flex flex-shrink-0 items-center justify-center text-text-secondary",f),"aria-hidden":"true",children:h}):s?jsx("span",{className:twMerge("flex flex-shrink-0 items-center justify-center",f),"aria-hidden":"true"}):null;return jsxs("div",{className:"flex w-full items-center gap-4",children:[a==="start"&&y,r&&jsx("div",{className:"flex flex-shrink-0 items-center text-text-secondary",children:r}),jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[c??jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1 text-left",children:[e&&jsx("span",{className:"truncate font-medium text-text-primary",children:e}),t&&jsx("span",{className:"text-sm text-text-secondary",children:t})]}),o&&jsx("div",{className:"flex flex-shrink-0 items-center text-sm text-text-secondary",children:o})]}),a==="end"&&y]})}})}Oo.displayName="CollapseHeader";function Ho({className:e,children:t,...r}){let{density:o,showDividers:n}=Qd();return jsx(DisclosurePanel,{...r,className:composeRenderProps(e,a=>xN({density:o,showDividers:n,className:a})),children:t})}Ho.displayName="CollapseContent";function ha(e){if(!e)return false;let t=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(t)}function _d(e){if(!e)return "";let t=e.startsWith("#")?e.slice(1):e;return t.length===3&&(t=t.split("").map(r=>r+r).join("")),`#${t.toUpperCase()}`}function CN({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,transparent:i,className:s,validationResult:c,value:l,defaultValue:d,onChange:u,placeholder:m="#000000",showColorSwatch:p=true,reserveErrorSpace:g=true,...f}){let[x,b]=useState(d||""),[h,y]=useState(l||d||""),[v,S]=useState(false),[N,w]=useState(null),{isFocused:M,handleFocus:k,handleBlur:P}=Nr(),I=l!==void 0?l:x;useEffect(()=>{l!==void 0&&y(l);},[l]);let D=I?!ha(I):false,L=useCallback(Y=>{if(y(Y),ha(Y)){let H=_d(Y);u?u(H):b(H);}else Y===""&&(u?u(""):b(""));},[u]),R=useCallback(Y=>{let H=_d(Y);y(H),u?u(H):b(H);},[u]),B=useCallback(Y=>{if(ha(h)){let H=_d(h);y(H),u&&H!==I?u(H):!u&&H!==x&&b(H);}P(Y,f.onBlur);},[h,I,x,u,P,f.onBlur]);return jsx(TextField,{...f,isRequired:a,className:ke(s,"group flex flex-col"),children:({isDisabled:Y})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(ze,{size:o,tooltip:n,isRequired:a,children:e}),jsx(bt,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(ws,{size:o,disabled:Y,type:"text",value:h,placeholder:m,onFocus:H=>k(H,f.onFocus),onBlur:B,onChange:H=>L(H.target.value),className:twMerge(Ft({isInvalid:D,isDisabled:Y,isFocused:M,size:o,transparent:i}),p?"pr-12":"pr-3","pl-3")}),p&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:We[o].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",ha(I)?"border-border-default":"border-border-default bg-background-muted"),style:ha(I)?{backgroundColor:I}:void 0,"aria-hidden":"true",children:!ha(I)&&jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsx("div",{ref:w,children:jsx(ee,{variant:"secondary",size:o,icon:"Palette",onPress:()=>S(!v),isDisabled:Y,className:"flex-shrink-0",children:"Pick"})})]})}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(be,{size:o,children:r}):typeof r=="function"&&c?jsx(be,{size:o,children:r(c)}):t?jsx(Te,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(be,{size:o,className:"mt-1",children:r}):typeof r=="function"&&c?jsx(be,{size:o,className:"mt-1",children:r(c)}):t?jsx(Te,{size:o,className:"mt-1",children:t}):null}),v&&N&&jsx(nt,{triggerRef:{current:N},isOpen:v,onOpenChange:S,placement:"bottom end",className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-lg p-4",children:jsxs("div",{className:"flex flex-col gap-4",children:[jsx(HexColorPicker,{color:I||"#000000",onChange:R,style:{width:"200px",height:"200px"}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:I||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:I||"#000000"})]})]})})]})})}function cg({isOpen:e,onClose:t,onConfirm:r,title:o,message:n,confirmLabel:a="Confirm",cancelLabel:i="Cancel",confirmVariant:s,isDestructive:c=false,isLoading:l=false,maxWidth:d="500px",minWidth:u="400px"}){return jsx(Sr,{isOpen:e,onClose:t,title:o,maxWidth:d,minWidth:u,primaryAction:{label:a,onPress:()=>{r();},variant:s??(c?"destructive":"primary"),isLoading:l},secondaryAction:{label:i,onPress:t,variant:"secondary",isDisabled:l},children:jsx("div",{className:"text-text-primary",children:n})})}function dg({isConnected:e,connectedAt:t,disconnectedAt:r,showTimestamp:o=false,isLoading:n,size:a="sm",shape:i="pill",...s}){if(n)return jsx(K,{className:"inline-flex h-6 w-24"});let c=e?"Connected":"Disconnected",l=e?"success":"neutral",d=null;if(o){if(e&&t)d=ts(t);else if(!e&&r){let u=ts(r);d=u?`Offline ${u}`:null;}}return jsxs("div",{className:"inline-flex flex-col gap-1",children:[jsx(tt,{variant:l,size:a,shape:i,dot:e,dotPulse:e,...s,children:c}),d&&jsx("span",{className:"text-xs text-text-secondary",children:d})]})}function ug({firstName:e,lastName:t,email:r,phone:o,avatarUrl:n,href:a,LinkComponent:i,variant:s="outlined",layout:c="horizontal",showEmail:l=true,showPhone:d=false,isLoading:u=false,className:m,contentClassName:p,piiEntity:g}){let f=`${e} ${t}`.trim(),x=({children:h,className:y})=>a?i?jsx(i,{href:a,className:y,children:h}):jsx(Qe,{href:a,variant:"unstyled",className:twMerge("hover:underline",y),asButton:false,children:h}):jsx("span",{className:y,children:h}),b=c==="vertical";return u?jsx(Ge,{variant:s,className:twMerge("flex flex-col",m),children:jsx(Ge.Content,{className:"flex items-center flex-1",children:jsxs("div",{className:twMerge("w-full",b?"flex flex-col items-center gap-4":"flex items-center gap-4"),children:[jsx(K,{width:56,height:56,className:"rounded flex-shrink-0"}),jsxs("div",{className:twMerge(b?"w-full text-center":"flex-1","space-y-2"),children:[jsx(K,{width:"70%",height:20,className:twMerge(b&&"mx-auto")}),jsx(K,{width:"100%",height:16,className:twMerge(b&&"mx-auto")})]})]})})}):jsx(Ge,{variant:s,className:twMerge("group/card flex flex-col",m),children:jsx(Ge.Content,{className:twMerge("flex items-center flex-1",a&&"cursor-pointer",p),children:jsxs("div",{className:twMerge("relative w-full",b?"flex flex-col items-center gap-4 text-center":"flex items-center gap-4"),children:[jsx(fo,{firstName:e,lastName:t,src:n,size:"xl",variant:"user",shape:"square",className:"flex-shrink-0",piiEntity:g}),jsxs("div",{className:twMerge(b?"w-full":"flex-1 min-w-0"),children:[a&&jsx(x,{className:"after:absolute after:inset-0",children:jsx("span",{className:"sr-only",children:f})}),jsx("span",{className:"text-lg font-semibold leading-tight text-text-primary block mb-1.5 group-hover/card:text-text-brand transition-colors","data-pii-type":g?"full-name":void 0,"data-pii-entity":g,children:f}),jsxs("div",{className:twMerge("space-y-0.5",b&&"flex flex-col items-center"),children:[l&&r&&jsxs("div",{className:"flex items-center gap-2.5 text-text-primary",children:[jsx(V,{name:"Envelope",size:16,className:"text-text-secondary flex-shrink-0"}),jsx(Qe,{href:`mailto:${r}`,variant:"unstyled",className:twMerge("text-sm leading-relaxed text-text-primary relative z-20",b?"":"truncate"),"data-pii-type":g?"email":void 0,"data-pii-entity":g,children:r})]}),d&&o&&jsxs("div",{className:"flex items-center gap-2.5 text-text-primary",children:[jsx(V,{name:"Phone",size:16,className:"text-text-secondary flex-shrink-0"}),jsx(Qe,{href:`tel:${o}`,variant:"unstyled",className:twMerge("text-sm leading-relaxed text-text-primary relative z-20",b?"":"truncate"),"data-pii-type":g?"phone":void 0,"data-pii-entity":g,children:na(o)})]})]})]})]})})})}function Fs({firstName:e,lastName:t,email:r,avatarUrl:o,layout:n="stacked",size:a="md",href:i,LinkComponent:s,linkVariant:c="unstyled",emphasis:l="normal",showEmail:d=false,badge:u,avatarShape:m,isLoading:p=false,className:g,piiEntity:f}){let x=m??(n==="inline"?"circle":"square"),h={xs:{avatarSize:"xs",gap:"gap-1.5",textSize:"text-xs",secondaryTextSize:"text-xs",skeletonAvatar:24,skeletonText:80,skeletonSecondary:60},sm:{avatarSize:"sm",gap:"gap-2",textSize:"text-sm",secondaryTextSize:"text-xs",skeletonAvatar:32,skeletonText:96,skeletonSecondary:72},md:{avatarSize:"md",gap:"gap-3",textSize:"text-base",secondaryTextSize:"text-sm",skeletonAvatar:40,skeletonText:128,skeletonSecondary:96},lg:{avatarSize:"lg",gap:"gap-3",textSize:"text-lg",secondaryTextSize:"text-base",skeletonAvatar:48,skeletonText:160,skeletonSecondary:120}}[a],y=`${e} ${t}`.trim(),S={strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[l],N=({children:w,className:M})=>i?s?jsx(s,{href:i,className:M,children:w}):jsx(Qe,{href:i,variant:c,className:twMerge("hover:underline",M),asButton:false,children:w}):jsx("span",{className:M,children:w});return p?n==="inline"?jsxs("div",{className:twMerge("flex items-center",h.gap,g),children:[jsx(K,{width:h.skeletonAvatar,height:h.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsx(K,{width:h.skeletonText,height:h.skeletonAvatar*.5})]}):jsxs("div",{className:twMerge("flex items-center",h.gap,g),children:[jsx(K,{width:h.skeletonAvatar,height:h.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx(K,{width:h.skeletonText,height:16}),d&&jsx(K,{width:h.skeletonSecondary,height:12})]})]}):n==="inline"?jsxs("div",{className:twMerge("flex items-center",h.gap,g),children:[jsxs(N,{className:twMerge("flex items-center",h.gap),children:[jsx(fo,{firstName:e,lastName:t,src:o,size:h.avatarSize,variant:"user",shape:x,className:"flex-shrink-0",piiEntity:f}),jsx("span",{className:twMerge("leading-normal truncate hover:text-text-primary",S,h.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),"data-pii-type":f?"full-name":void 0,"data-pii-entity":f,children:y})]}),u]}):jsxs("div",{className:twMerge("flex items-center justify-start",h.gap,g),children:[jsx(fo,{firstName:e,lastName:t,src:o,size:h.avatarSize,variant:"user",shape:x,className:"flex-shrink-0",piiEntity:f}),jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(N,{className:twMerge("leading-normal truncate hover:text-text-primary",S,h.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":f?"full-name":void 0,"data-pii-entity":f,children:y})}),u]}),d&&r&&jsx("div",{className:twMerge("text-text-secondary leading-normal truncate",h.secondaryTextSize),"data-pii-type":f?"email":void 0,"data-pii-entity":f,children:r})]})]})}function mg({children:e,className:t}){let r=useRef(null),[o,n]=useState({current:"base",isSm:false,isMd:false,isLg:false,isXl:false,is2Xl:false,isMobile:true,isDesktop:false});return useEffect(()=>{let a=r.current;if(!a||typeof ResizeObserver>"u")return;let i=()=>{let c=a.offsetWidth,l=c>=640,d=c>=768,u=c>=1024,m=c>=1280,p=c>=1536,g="base";p?g="2xl":m?g="xl":u?g="lg":d?g="md":l&&(g="sm"),n({current:g,isSm:l,isMd:d,isLg:u,isXl:m,is2Xl:p,isMobile:!d,isDesktop:d});};i();let s=new ResizeObserver(i);return s.observe(a),()=>s.disconnect()},[]),jsx(yc.Provider,{value:o,children:jsx("div",{ref:r,className:t,style:{width:"100%"},children:e})})}var Bs={duration:.5,ease:"easeInOut"},kr=createContext(null),Nn=()=>{let e=useContext(kr);if(!e)throw new Error("useChartContext must be used within a ChartContextProvider");return e};function Vs(e,t){if(t<=0||e.length<2)return e;let r=[e[0]];for(let o=1;o<e.length;o++)e[o].xValue.getTime()-e[o-1].xValue.getTime()>t&&r.push(null),r.push(e[o]);return r}var Go=({data:e,color:t="var(--color-viz-default)",baseline:r,fillOpacity:o=.1,showLine:n=true,maxGapMs:a,animate:i=true})=>{let s=useId(),c=useId(),{xScale:l,yScale:d,animationSettings:u}=Nn(),m=l.range(),p=d.range(),g=(y,v)=>typeof r=="function"?r(y,v):r??0,f=y=>y.chartYValue??y.yValue,x=a!=null?Vs(e,a):e,b={transformOrigin:`0 ${p[0]}px`,transformBox:"fill-box",isolation:"isolate"},h=jsxs(Fragment,{children:[r===void 0?jsx(AreaClosed,{data:x,x:y=>y?l(y.xValue):0,y:y=>y?d(f(y)):0,yScale:d,defined:y=>y!=null,fill:`url(#${s})`,curve:curveLinear}):jsx(Area,{data:x,x:y=>y?l(y.xValue):0,y0:(y,v)=>y?d(g(y,v)):0,y1:y=>y?d(f(y)):0,defined:y=>y!=null,fill:t,fillOpacity:o,curve:curveLinear}),n?jsx(LinePath,{data:x,x:y=>y?l(y.xValue):0,y:y=>y?d(f(y)):0,defined:y=>y!=null,stroke:t,strokeWidth:3,curve:curveLinear}):null]});return jsxs(Fragment,{children:[jsxs("defs",{children:[jsxs("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[jsx("stop",{offset:"50%",stopColor:t,stopOpacity:o}),jsx("stop",{offset:"100%",stopColor:t,stopOpacity:0})]}),i&&jsx("clipPath",{id:c,children:jsx("rect",{x:m[0],y:p[1],width:m[1]-m[0],height:p[0]-p[1]})})]}),i?jsx("g",{clipPath:`url(#${c})`,children:jsx(motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:u.duration,ease:u.ease},style:b,children:h})}):jsx("g",{style:b,children:h})]})};var Os=({data:e,color:t="var(--color-viz-default)",opacity:r=1,categoryColors:o={}})=>{let{xScale:n,yScale:a,animationSettings:i}=Nn(),s=useId(),c=n.range(),l=a.range(),d=[...e].sort((p,g)=>p.xValue.getTime()-g.xValue.getTime());if(d.length===0)return null;let u=d.length>1?d[1].xValue.getTime()-d[0].xValue.getTime():15*6e4,m=Math.abs(n(new Date(d[0].xValue.getTime()+u))-n(d[0].xValue));return jsxs(Fragment,{children:[jsx("defs",{children:jsx("clipPath",{id:s,children:jsx("rect",{x:c[0],y:l[1],width:c[1]-c[0],height:l[0]-l[1]})})}),jsx("g",{clipPath:`url(#${s})`,children:jsx(motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:i.duration,ease:i.ease},style:{transformOrigin:`0 ${a(0)}px`,isolation:"isolate"},children:d.map((p,g)=>{let f=n(p.xValue),x=p.chartYValue??p.yValue,b=p.baselineValue??0,h=a(x),y=a(b),v=Math.min(h,y),S=Math.abs(h-y),N=d[g+1],w=N?Math.abs(n(N.xValue)-f):m,M=p.category&&o[p.category]?o[p.category]:t;return jsx(Bar,{x:f-w/2,y:v,width:w,height:S,fill:M,opacity:r,rx:1},p.xValue.getTime())})})})]})};function GN(e){return e>=1e9?"GW":e>=1e6?"MW":e>=1e3?"kW":"W"}function UN(e){return e>=1e3?"kA":e<1?"mA":"A"}function KN(e){return e>=1e3?"kV":e<1?"mV":"V"}function YN(e){return e>=1e6?"M\u03A9":e>=1e3?"k\u03A9":e<1?"m\u03A9":"\u03A9"}function va(e,t){if(typeof e!="object"||e===null)return e;switch(e.type){case "energy":{if(e.unit||e.autoScale===false)return e;let r=e.sourceUnit?zc[e.sourceUnit]:1;return {...e,unit:Vc(t*r)}}case "power":return e.unit||e.autoScale===false?e:{...e,unit:GN(t)};case "current":return e.unit||e.autoScale===false?e:{...e,unit:UN(t)};case "voltage":return e.unit||e.autoScale===false?e:{...e,unit:KN(t)};case "resistance":return e.unit||e.autoScale===false?e:{...e,unit:YN(t)};default:return e}}var JN=e=>e.baselineValue??0,Ae={top:8,right:0,bottom:50,left:60};function Or(e={type:"number"}){let t=i=>{if(i==null)return "-";let s=Xr({value:i,formatter:e});if(s===null)return "-";if(typeof s=="string")return s;if(typeof s=="number")return s.toString();if(typeof s=="object"&&s!==null&&"props"in s){let c=d=>{if(d==null)return "";if(typeof d=="string")return d;if(typeof d=="number")return d.toString();if(typeof d=="object"&&"props"in d){let u=d.props;if(u?.children)return Array.isArray(u.children)?u.children.map(c).join(""):c(u.children)}return ""};return c(s)||i.toString()}return i.toString()},r=i=>{if(i==null)return "-";if(typeof e=="string"){let s=Xr({value:i,formatter:e});return s===null?"-":String(s)}if(typeof e=="object"&&e.type)switch(e.type){case "energy":case "power":case "voltage":case "current":case "resistance":case "temperature":case "distance":return t(i);case "currency":return t(i);default:return t(i)}return t(i)},o,n,a;return typeof e=="object"&&e.type&&e.type==="number"&&("min"in e&&(o=e.min),"max"in e&&(n=e.max)),{format:t,tickFormat:r,min:o,max:n,tickInterval:a}}var tu=(e,t)=>{let r=extent(e,o=>o.xValue);return scaleTime({range:[Ae.left,t-Ae.right],domain:r,nice:true})},ui=(e,t,r,o)=>{let n=Or(r);if(o)return scaleLinear({range:[t-Ae.bottom,Ae.top],domain:o,nice:true});let a=min(e,l=>Math.min(l.yValue,l.chartYValue??l.yValue,l.baselineValue??l.yValue))||0,i=max(e,l=>Math.max(l.yValue,l.chartYValue??l.yValue,l.baselineValue??l.yValue))||0,s=n.min!==void 0?n.min:a>=0?0:a*1.1,c=n.max!==void 0?n.max:i<=0?0:i*1.1;return scaleLinear({range:[t-Ae.bottom,Ae.top],domain:[s,c],nice:true})};function XN(e,t=12,r="system-ui"){if(typeof window>"u"||typeof document>"u")return e.length*(t*.6);let o=document.createElement("canvas"),n=null;try{n=o.getContext("2d");}catch{return e.length*(t*.6)}return n?(n.font=`${t}px ${r}`,n.measureText(e).width):e.length*(t*.6)}function Ca(e,t=12,r="system-ui"){return e.length===0?0:Math.max(...e.map(o=>XN(o,t,r)))}function pi(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function jN(e,t,r=12,o=false){if(!pi(t[0])||!pi(t[1]))return console.warn("ChartAxis: Invalid date in domain, skipping tick calculation"),[];let n=t[0].getTime(),a=t[1].getTime(),i=a-n;if(i===0||i<1e3)return [t[0]];let s=sd({start:t[0],end:t[1]},{compact:o}),l=[t[0],new Date((t[0].getTime()+t[1].getTime())/2),t[1]].map(h=>s(h)),d=Ca(l,r),m=d+d,p=Math.floor(e/m),g=Math.max(2,Math.min(8,p));if(g<=2)return [t[0],t[1]];let f=[t[0]],x=i/36e5,b;x<=1?b=6e4:x<=6?b=5*6e4:x<=48?b=60*6e4:x<=168?b=360*6e4:b=1440*6e4;for(let h=1;h<g-1;h++){let y=h/(g-1),v=n+i*y,S=Math.round(v/b)*b,N=f[f.length-1].getTime(),w=S>N?S:N+b;if(w>=a)break;f.push(new Date(w));}return f.push(t[1]),f}var qN=({top:e,scale:t,width:r})=>{let o=t.domain(),n=[o[0],o[o.length-1]],a=pi(n[0])&&pi(n[1]),i=r<400,s=a?n[0].getTime():0,c=a?n[1].getTime():0,l=useMemo(()=>a?sd({start:n[0],end:n[1]},{compact:i}):()=>"",[s,c,i,a]),d=useMemo(()=>jN(r,n,12,i),[r,s,c,i]);return d.length===0?null:jsx(Axis,{orientation:"bottom",top:e,scale:t,tickValues:d,tickFormat:u=>{let m=u;return pi(m)?l(m):""},stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:(u,m,p)=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:m===0?"start":m===p.length-1?"end":"middle"}),rangePadding:0})};function Sa(e,t=12){let r=t*2.5,o=Math.floor(e/r);return Math.max(2,Math.min(6,o))}var ru=12,QN=({left:e,scale:t,yFormatter:r,height:o})=>{let n=Or(r),a=useMemo(()=>!o||o<=0?5:Sa(o),[o]);return jsx(Axis,{orientation:"left",left:e,scale:t,numTicks:a,tickFormat:i=>(n.tickFormat||n.format)(i),stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:i=>{let s={fill:"var(--color-text-secondary)",fontSize:ru,textAnchor:"end"},c=t(i),[l,d]=t.range(),u=Math.min(l,d),m=Math.max(l,d);return c-u<ru/2?{...s,verticalAnchor:"start"}:m-c<ru/2?{...s,verticalAnchor:"end"}:{...s,dy:"0.33em"}}})},ZN=({top:e,scale:t})=>jsx(Axis,{orientation:"bottom",top:e,scale:t,stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"middle",dy:"0.25em"})}),_N=({left:e,scale:t})=>jsx(Axis,{orientation:"left",left:e,scale:t,stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"end",dx:"-0.25em",dy:"0.33em"})}),$N=({top:e,scale:t,yFormatter:r,width:o})=>{let n=Or(r),a=useMemo(()=>{if(!o||o<=0)return 5;let s=Math.floor(o/60);return Math.max(2,Math.min(8,s))},[o]);return jsx(Axis,{orientation:"bottom",top:e,scale:t,numTicks:a,tickFormat:i=>(n.tickFormat||n.format)(i),stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"middle",dy:"0.25em"})})},Tr={Bottom:qN,Left:QN,CategoryBottom:ZN,CategoryLeft:_N,NumericBottom:$N};var Uo=({data:e,formatter:t,label:r,categoryLabels:o})=>{if(!e)return null;let n=Oe__default.useContext(kr),a=o??n?.categoryLabels,i=n?.xScale,s=n?.width,c=n?.height,l=Or(t),d=h=>{if(h.baselineValue===void 0)return l.format(h.value);let y=Math.min(h.baselineValue,h.value),v=Math.max(h.baselineValue,h.value);return `${l.format(y)} \u2013 ${l.format(v)}`},u=Oe__default.useRef(null),[m,p]=Oe__default.useState({x:0,y:0,translate:"translate(-50%, -100%)"});Oe__default.useEffect(()=>{if(!u.current)return;let y=u.current.getBoundingClientRect(),v=s??window.innerWidth,S=c??window.innerHeight,N=e.x,w=e.y,M=16,k=e.x+y.width+M<=v,P=e.x-y.width-M>=0,I;e.position==="left"?I=P||!k:I=!k&&P;let D=I?"translate(calc(-100% - 16px), -50%)":"translate(16px, -50%)";if(!k&&!P){let L=v-e.x,R=e.x;L<=R?(N=v,D="translate(-100%, -50%)"):(N=0,D="translate(0, -50%)");}w-y.height/2<0?w=y.height/2:w+y.height/2>S&&(w=S-y.height/2),p({x:N,y:w,translate:D});},[e.x,e.y,e.position,s,c]);let g=i?.domain(),x=g&&g.length===2&&g.every(h=>h instanceof Date)?Km({start:g[0],end:g[1]}):null,b=r||(x&&e.xValue instanceof Date?x(e.xValue):String(e.xValue));return jsx(AnimatePresence,{children:jsxs(motion.div,{ref:u,role:"tooltip","aria-live":"polite",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},"data-testid":"tooltip",className:"pointer-events-none absolute z-50 rounded-lg bg-background-surface p-4 text-sm shadow-xl ring-1 ring-border-default whitespace-nowrap",style:{left:m.x,top:m.y,transform:m.translate},children:[jsx("div",{className:"mb-1 font-medium text-text-primary",children:b}),e.isEvent?jsxs("div",{className:"space-y-2",children:[e.series.length>1&&jsx("ul",{className:"list-none p-0 border-b border-border-default pb-2",children:e.series.slice(0,-1).map(h=>jsxs("li",{className:"py-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"font-medium text-text-primary",children:[h.label,":"]}),jsx("span",{className:"text-text-secondary",children:d(h)})]}),h.category&&jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsx("div",{className:"h-3 w-3",style:{backgroundColor:h.categoryColor||h.color,borderRadius:"1px"}}),jsx("span",{className:"text-sm text-text-secondary",children:a?.[h.category]||h.category})]}),h.extraTooltipRows&&h.extraTooltipRows.length>0&&jsx("div",{className:"mt-0.5 space-y-0.5",children:h.extraTooltipRows.map(y=>jsxs("div",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[jsxs("span",{children:[y.label,":"]}),jsx("span",{className:"font-medium text-text-primary",children:y.value})]},y.label))})]},h.label))}),(()=>{let h=e.series[e.series.length-1],y=e.eventItems?.length?e.eventItems:[{label:h.label,color:h.color,metadata:e.eventMetadata}];return jsx("div",{className:"space-y-2",children:y.map((v,S)=>jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:v.color}}),jsx("span",{className:"font-medium text-text-primary",children:v.label})]}),v.metadata&&Object.keys(v.metadata).length>0&&jsx("div",{className:"ml-4 mt-1 space-y-0.5 text-xs text-text-secondary",children:Object.entries(v.metadata).map(([N,w])=>jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"capitalize",children:[N,":"]}),jsx("span",{className:"font-medium",children:w})]},N))})]},`${v.label}-${S}`))})})()]}):jsx("ul",{className:"list-none p-0",children:e.series.map(h=>jsxs("li",{className:"py-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"font-medium text-text-primary",children:[h.label,":"]}),jsx("span",{className:"text-text-secondary",children:d(h)})]}),h.category&&jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsx("div",{className:"h-3 w-3",style:{backgroundColor:h.categoryColor||h.color,borderRadius:"1px"}}),jsx("span",{className:"text-sm text-text-secondary",children:a?.[h.category]||h.category})]}),h.extraTooltipRows&&h.extraTooltipRows.length>0&&jsx("div",{className:"mt-0.5 space-y-0.5",children:h.extraTooltipRows.map(y=>jsxs("div",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[jsxs("span",{children:[y.label,":"]}),jsx("span",{className:"font-medium text-text-primary",children:y.value})]},y.label))})]},h.label))})]})})};var lk={top:20,right:20,bottom:50,left:60},wg=({data:e,width:t,height:r,margin:o=lk,color:n,yFormatter:a={type:"number"},showGrid:i=true,showAxes:s=true,animate:c=true,barRadius:l=4,barPadding:d=.3,onBarClick:u,onBarHover:m,activeIndex:p,className:g,style:f,"aria-label":x="Category bar chart",orientation:b="vertical",showTooltip:h=true})=>{let[y,v]=useState(null),[S,N]=useState(null),[w,M]=useState(null),[k,P]=useState(t??600),[I,D]=useState(r??300),L=useRef(null),R=p??y,B=useId(),Y=n||"var(--color-viz-default)";useEffect(()=>{if(t!==void 0&&r!==void 0){P(t),D(r);return}if(!L.current)return;let T=new ResizeObserver(E=>{for(let O of E)t===void 0&&P(O.contentRect.width),r===void 0&&D(O.contentRect.height);});return T.observe(L.current),t===void 0&&P(L.current.offsetWidth),r===void 0&&D(L.current.offsetHeight||300),()=>{T.disconnect();}},[t,r]);let{xScale:H,yScale:W,innerWidth:Z,innerHeight:q}=useMemo(()=>{let T=k-o.left-o.right,E=I-o.top-o.bottom;if(b==="horizontal"){let A=max(e,C=>C.value)||0;return {xScale:scaleLinear({range:[0,T],domain:[0,A*1.1],nice:true}),yScale:scaleBand({range:[0,E],domain:e.map(C=>C.label),padding:d}),innerWidth:T,innerHeight:E}}let O=max(e,A=>A.value)||0;return {xScale:scaleBand({range:[0,T],domain:e.map(A=>A.label),padding:d}),yScale:scaleLinear({range:[E,0],domain:[0,O*1.1],nice:true}),innerWidth:T,innerHeight:E}},[e,k,I,o,d,b]);if(e.length===0)return jsx("div",{ref:L,className:twMerge("flex h-full min-h-[200px] w-full items-center justify-center rounded-lg border border-dashed border-border-default bg-background-surface text-sm font-medium text-text-secondary",g),style:r!==void 0?{height:r,...f}:f,children:"No data available"});let Q=(T,E)=>{if(v(T),m?.(E,T),T!==null&&E){let O,A;if(b==="horizontal"){let F=H(E.value),z=W(E.label)||0,G=W.bandwidth();O=o.left+F,A=o.top+z+G/2;}else {let F=H,z=W,G=F(E.label)??0,oe=F.bandwidth(),ue=z(E.value);O=o.left+G+oe/2,A=o.top+ue;}let C=O>k/2;M(E.label),N({xValue:new Date,series:[{label:"Value",value:E.value,color:E.color||Y}],x:O,y:A,position:C?"left":"right"});}else N(null),M(null);};return jsxs("div",{ref:L,className:twMerge("relative h-full w-full overflow-hidden rounded-lg bg-background-surface",g),style:r!==void 0?{height:r,...f}:f,"aria-label":x,role:"img",children:[jsxs("svg",{width:k,height:I,children:[jsx("defs",{children:jsx(LinearGradient,{id:`${B}-bar`,from:Y,to:Y,toOpacity:.85})}),jsxs(Group,{left:o.left,top:o.top,children:[i&&jsx("g",{className:"grid-lines",children:(b==="horizontal"?H.ticks(5):W.ticks(5)).map(T=>{let E=b==="horizontal"?0:W(T),O=b==="horizontal"?H(T):0;return jsx("line",{x1:b==="horizontal"?O:0,y1:b==="horizontal"?0:E,x2:b==="horizontal"?O:Z,y2:b==="horizontal"?q:E,stroke:"var(--color-border-default)",strokeOpacity:.5,strokeDasharray:"2,3"},T)})}),e.map((T,E)=>{let O=R===E||R==null,A=T.color||`url(#${B}-bar)`;if(b==="horizontal"){let te=H(T.value),le=W.bandwidth(),me=W(T.label)||0;return jsx(motion.rect,{x:0,y:me,width:te,height:le,fill:A,rx:l,ry:l,initial:c?{width:0,opacity:.5}:void 0,animate:{width:te,opacity:O?1:.5},transition:{duration:.5,delay:E*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:u||m?"pointer":"default"},onMouseEnter:()=>Q(E,T),onMouseLeave:()=>Q(null,null),onClick:()=>u?.(T,E)},T.label)}let C=H,F=W,z=C.bandwidth(),G=C(T.label)??0,oe=F(T.value),ue=Math.max(0,q-oe);return c?jsx(motion.rect,{x:G,width:z,fill:A,rx:l,ry:l,initial:{y:q,height:0,opacity:.5},animate:{y:oe,height:ue,opacity:O?1:.5},transition:{duration:.5,delay:E*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:u||m?"pointer":"default"},onMouseEnter:()=>Q(E,T),onMouseLeave:()=>Q(null,null),onClick:()=>u?.(T,E)},T.label):jsx("rect",{x:G,y:oe,width:z,height:ue,fill:A,rx:l,ry:l,opacity:O?1:.5,style:{cursor:u||m?"pointer":"default",transition:"opacity 150ms ease-out"},onMouseEnter:()=>Q(E,T),onMouseLeave:()=>Q(null,null),onClick:()=>u?.(T,E)},T.label)}),s&&b==="vertical"&&jsxs(Fragment,{children:[jsx(Tr.CategoryBottom,{top:q,scale:H}),jsx(Tr.Left,{left:0,scale:W,yFormatter:a,height:q})]}),s&&b==="horizontal"&&jsxs(Fragment,{children:[jsx(Tr.NumericBottom,{top:q,scale:H,yFormatter:a,width:Z}),jsx(Tr.CategoryLeft,{left:0,scale:W})]})]})]}),h&&jsx(Uo,{data:S,formatter:a,label:w??void 0})]})};var Ng=({item:e,onToggle:t})=>{let r=jsxs(Fragment,{children:[jsx("div",{className:"h-3 w-3 shrink-0",style:{backgroundColor:e.fill,borderRadius:"1px",opacity:e.isHidden?.35:1}}),jsx("span",{className:`text-sm whitespace-nowrap ${e.isHidden?"text-text-disabled line-through":"text-text-secondary"}`,children:e.category})]});return t?jsx("button",{type:"button",className:"flex items-center gap-2 shrink-0 rounded-sm focus:outline-none focus:ring-2 focus:ring-border-focus disabled:cursor-not-allowed disabled:opacity-60","aria-pressed":!e.isHidden,"aria-label":`${e.isHidden?"Show":"Hide"} ${e.category}`,disabled:e.isDisabled,onClick:()=>t(e.category),children:r}):jsx("div",{className:"flex items-center gap-2 shrink-0",children:r})},uk=({items:e,onToggle:t})=>e.length===0?null:jsx("div",{className:"flex items-center gap-3 flex-wrap",children:e.map(r=>jsx(Ng,{item:r,onToggle:t},r.category))}),Na=({items:e,onExport:t,marginLeft:r=0,marginRight:o=0,isZoomed:n=false,onResetZoom:a,onLegendItemToggle:i})=>{let[s,c]=Oe__default.useState(false),[l,d]=Oe__default.useState(null),[u,m]=Oe__default.useState(false),[p,g]=Oe__default.useState(false),f=Oe__default.useCallback(async b=>{c(true),d(b),g(false);try{await t(b);}catch(h){console.error("Export failed:",h);}finally{c(false),d(null);}},[t]),x=Oe__default.useCallback(async b=>{await f(b);},[f]);return jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 min-h-[32px]",style:{marginLeft:r,marginRight:o},children:[jsx("div",{className:"hidden sm:block flex-1 min-w-0",children:jsx(uk,{items:e,onToggle:i})}),jsx("div",{className:"sm:hidden flex items-center gap-3",children:e.length>0&&jsxs(Fragment,{children:[jsx("button",{onClick:()=>m(true),className:"text-sm text-text-secondary hover:text-text-primary transition-colors underline decoration-dotted underline-offset-4",children:"Legend"}),jsx(at,{isOpen:u,onClose:()=>m(false),title:"Legend",children:jsx("div",{className:"grid grid-cols-1 gap-3 p-4",children:e.map(b=>jsx(Ng,{item:b,onToggle:i},b.category))})})]})}),jsxs("div",{className:"sm:hidden flex items-center gap-2 shrink-0",children:[n&&a&&jsx(ee,{variant:"secondary",size:"sm",onPress:a,children:jsx(V,{name:"ArrowsOut",size:16})}),jsx(ee,{variant:"secondary",size:"sm",onPress:()=>g(true),isDisabled:s,children:jsx(V,{name:"Export",size:16})}),jsx(at,{isOpen:p,onClose:()=>g(false),title:"Export Chart",contentPadding:false,children:jsxs("div",{className:"flex flex-col",children:[jsxs("button",{onClick:()=>f("csv"),disabled:s,className:"flex items-center gap-3 px-6 py-4 text-left hover:bg-background-hover active:bg-background-muted transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[jsx(V,{name:"List",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:l==="csv"?"Exporting...":"Export as CSV"})]}),jsxs("button",{onClick:()=>f("svg"),disabled:s,className:"flex items-center gap-3 px-6 py-4 text-left hover:bg-background-hover active:bg-background-muted transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[jsx(V,{name:"Code",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:l==="svg"?"Exporting...":"Export as SVG"})]}),jsxs("button",{onClick:()=>f("png"),disabled:s,className:"flex items-center gap-3 px-6 py-4 text-left hover:bg-background-hover active:bg-background-muted transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[jsx(V,{name:"DownloadSimple",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:l==="png"?"Exporting...":"Export as PNG"})]})]})})]}),jsxs("div",{className:"hidden sm:flex items-center gap-2 shrink-0",children:[n&&a&&jsxs(ee,{variant:"secondary",size:"sm",onPress:a,children:[jsx(V,{name:"ArrowsOut",size:16}),jsx("span",{className:"hidden sm:inline",children:"Reset Zoom"})]}),jsxs(DialogTrigger,{children:[jsxs(ee,{variant:"secondary",size:"sm",isDisabled:s,children:[jsx(V,{name:"Export",size:16}),s?"Exporting...":"Export"]}),jsx(nt,{placement:"top end",className:"min-w-48 p-1 bg-background-surface rounded-lg shadow-xl ring-1 ring-border-default",children:jsxs(Menu,{onAction:x,className:"outline-none",children:[jsx(MenuItem,{id:"csv",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:s,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(V,{name:"List",size:14}),l==="csv"?"Exporting...":"Export as CSV"]})}),jsx(MenuItem,{id:"svg",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:s,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(V,{name:"Code",size:14}),l==="svg"?"Exporting...":"Export as SVG"]})}),jsx(MenuItem,{id:"png",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:s,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(V,{name:"DownloadSimple",size:14}),l==="png"?"Exporting...":"Export as PNG"]})})]})})]})]})]})};var Gs=Ep(wc());var Tg=["stroke","fill","color","stop-color","flood-color","lighting-color"],Pg=/var\s*\(/;function Rg(e,t){let r=[e,...Array.from(e.querySelectorAll("*"))],o=[t,...Array.from(t.querySelectorAll("*"))],n=Math.min(r.length,o.length);for(let a=0;a<n;a++){let i=r[a],s=o[a];if(!(i instanceof Element)||!(s instanceof Element))continue;let c=window.getComputedStyle(i);for(let l of Tg){let d=s.getAttribute(l);if(d&&Pg.test(d)){let u=c.getPropertyValue(l);u&&s.setAttribute(l,u.trim());}}if(s instanceof HTMLElement||s instanceof SVGElement)for(let l of Tg){let d=l,u=s.style.getPropertyValue(d);if(u&&Pg.test(u)){let m=c.getPropertyValue(d);m&&s.style.setProperty(d,m.trim());}}}}function nu(e,t,r=true){let o=e||"chart";if(r){let n=new Date().toISOString().replace(/[:.]/g,"-").slice(0,-5);return `${o}-${n}.${t}`}return `${o}.${t}`}async function au(e,t,r={},o){let n=Array.isArray(t[0])?t:[t];try{switch(e){case "csv":await mk(n,r);break;case "svg":await fk(o,r);break;case "png":await gk(o,r);break;default:throw new Error(`Unsupported export type: ${e}`)}}catch(a){throw console.error("Export failed:",a),new Error(`Failed to export chart as ${e}: ${a instanceof Error?a.message:"Unknown error"}`)}}async function mk(e,t){try{let r=t.yFormat?Qc(t.yFormat):null,o=t.yFormat,n=m=>{if(m==null||m==="")return "";if(!o)return typeof m=="number"?m:String(m);let p=Cm(m,o);return p===null?typeof m=="number"?m:String(m):p},a=new Map;e.forEach(m=>{m.forEach(p=>{let g=p.xValue.getTime();a.has(g)||a.set(g,p.xValue);});});let i=Array.from(a.values()).sort((m,p)=>m.getTime()-p.getTime()),s=e.map((m,p)=>{let g=t.seriesLabels?.[p]||`Series ${p+1}`;return r&&!g.includes(`(${r})`)?`${g} (${r})`:g}),c=i.map(m=>{let p={[t.xLabel||"Date"]:m.toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return e.forEach((g,f)=>{let x=s[f],b=g.find(h=>h.xValue.getTime()===m.getTime());p[x]=b?n(b.yValue):"",b?.category&&(p[`${x} Category`]=b.category);}),p}),l=zv.unparse(c,{header:!0,skipEmptyLines:!0}),d=new Blob([l],{type:"text/csv;charset=utf-8;"}),u=nu(t.filename||"chart-data","csv",t.timestamp!==!1);(0,Gs.saveAs)(d,u);}catch(r){throw new Error(`CSV export failed: ${r instanceof Error?r.message:"Unknown error"}`)}}async function fk(e,t){if(!e.current)throw new Error("SVG element not found");try{let r=e.current,o=r.cloneNode(!0);if(Rg(r,o),!o.querySelector("rect[data-background]")){let l=document.createElementNS("http://www.w3.org/2000/svg","rect");l.setAttribute("width",o.getAttribute("width")||"100%"),l.setAttribute("height",o.getAttribute("height")||"100%"),l.setAttribute("fill","white"),l.setAttribute("data-background","true"),o.insertBefore(l,o.firstChild);}let i=new XMLSerializer().serializeToString(o);i.includes("<?xml")||(i=`<?xml version="1.0" encoding="UTF-8"?>
|
|
28
28
|
`+i),i.includes("xmlns=")||(i=i.replace("<svg",'<svg xmlns="http://www.w3.org/2000/svg"'));let s=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),c=nu(t.filename||"chart","svg",t.timestamp!==!1);(0,Gs.saveAs)(s,c);}catch(r){throw new Error(`SVG export failed: ${r instanceof Error?r.message:"Unknown error"}`)}}async function gk(e,t,r=2){if(!e.current)throw new Error("SVG element not found");let o="";try{let n=e.current,a=n.getBoundingClientRect(),i=n.cloneNode(!0);Rg(n,i),i.setAttribute("width",String(a.width)),i.setAttribute("height",String(a.height)),i.removeAttribute("transform");let s=i.getElementsByTagName("text");Array.from(s).forEach(m=>{m.style.fontFamily||(m.style.fontFamily="system-ui, -apple-system, sans-serif"),m.style.fontSize||(m.style.fontSize="12px");});let c=document.createElementNS("http://www.w3.org/2000/svg","rect");c.setAttribute("width",String(a.width)),c.setAttribute("height",String(a.height)),c.setAttribute("fill","white"),i.insertBefore(c,i.firstChild);let d=new XMLSerializer().serializeToString(i);d.includes("xmlns=")||(d=d.replace("<svg",'<svg xmlns="http://www.w3.org/2000/svg"'));let u=new Blob([d],{type:"image/svg+xml;charset=utf-8"});return o=URL.createObjectURL(u),new Promise((m,p)=>{let g=new Image,f=setTimeout(()=>{o&&URL.revokeObjectURL(o),p(new Error("Image loading timeout"));},1e4);g.onload=()=>{clearTimeout(f);try{let x=document.createElement("canvas");x.width=a.width*r,x.height=a.height*r;let b=x.getContext("2d");if(!b)throw new Error("Canvas context not available");b.imageSmoothingEnabled=!0,b.imageSmoothingQuality="high",b.scale(r,r),b.fillStyle="white",b.fillRect(0,0,a.width,a.height),b.drawImage(g,0,0,a.width,a.height),x.toBlob(h=>{if(h){let y=nu(t.filename||"chart","png",t.timestamp!==!1);(0,Gs.saveAs)(h,y),m();}else p(new Error("Failed to create PNG blob"));o&&URL.revokeObjectURL(o);},"image/png",1);}catch(x){o&&URL.revokeObjectURL(o),p(x);}},g.onerror=()=>{clearTimeout(f),o&&URL.revokeObjectURL(o),p(new Error("Failed to load SVG as image"));},g.src=o;})}catch(n){throw o&&URL.revokeObjectURL(o),new Error(`PNG export failed: ${n instanceof Error?n.message:"Unknown error"}`)}}function bk(e){if(typeof window>"u")return false;switch(e){case "csv":return true;case "svg":return typeof XMLSerializer<"u";case "png":return typeof HTMLCanvasElement<"u"&&typeof HTMLCanvasElement.prototype.toBlob=="function";default:return false}}function xk(e){return {csv:"CSV Spreadsheet",svg:"SVG Vector Image",png:"PNG Image"}[e]||"Unknown Format"}function Us({datasets:e,metadata:t,svgRef:r}){return useCallback(async o=>{try{await au(o,e,t,r);}catch(n){throw console.error("Chart export failed:",n),n}},[e,t,r])}var iu=({data:e,seriesMetadata:t,width:r,height:o,onBrushChange:n,brushRegion:a,margin:i=Ae,yDomain:s})=>{let c=useRef(null),l=useRef(false),d=useMemo(()=>e.flat(),[e]),u=useMemo(()=>({top:10,bottom:15,left:i.left,right:i.right}),[i]),m=r-u.left-u.right,p=useMemo(()=>{if(d.length===0)return scaleTime({domain:[new Date,new Date],range:[0,m]});let h=new Date(Math.min(...d.map(v=>v.xValue.getTime()))),y=new Date(Math.max(...d.map(v=>v.xValue.getTime())));return scaleTime({domain:[h,y],range:[0,m]})},[d,m]),g=useMemo(()=>{let h=d.length>0?Math.max(0,...d.map(y=>y.yValue)):1;return scaleLinear({domain:s??[0,h],range:[o-u.bottom,u.top]})},[d,o,s,u.top,u.bottom]),f=h=>{if(l.current)return;if(!h){n(null);return}let{x0:y,x1:v}=h;if(y===v)return;let S=new Date(y),N=new Date(v);if(!(Number.isNaN(S.getTime())||Number.isNaN(N.getTime()))){if(d.length>0){let w=Math.min(...d.map(D=>D.xValue.getTime())),M=Math.max(...d.map(D=>D.xValue.getTime())),P=(M-w)*.05;if(Math.abs(S.getTime()-w)<P&&Math.abs(N.getTime()-M)<P){n(null);return}}n([S,N]);}},x=useMemo(()=>{if(d.length!==0)return {start:{x:0,y:u.top},end:{x:m,y:o-u.bottom}}},[m,o,d]);useEffect(()=>{if(!c.current||d.length===0)return;let h=c.current.state;if(h?.isBrushing||h?.activeHandle)return;let y=Math.min(...d.map(k=>k.xValue.getTime())),v=Math.max(...d.map(k=>k.xValue.getTime())),S=a?a[0]:new Date(y),N=a?a[1]:new Date(v),w=c.current.state?.extent;if(w){let k=p.invert(w.x0),P=p.invert(w.x1),I=Math.abs(k.getTime()-S.getTime()),D=Math.abs(P.getTime()-N.getTime());if(I<1e3&&D<1e3)return}l.current=true;let M=k=>{let P=c.current.getExtent({x:p(S),y:u.top},{x:p(N),y:o-u.bottom});return {...k,start:{y:P.y0,x:P.x0},end:{y:P.y1,x:P.x1},extent:P}};c.current.updateBrush(M),setTimeout(()=>{l.current=false;},50);},[a,p,o,d]);let b={fill:"url(#brush_pattern)",fillOpacity:.15,stroke:"var(--color-border-focus)",strokeWidth:1.5,strokeOpacity:.3};return jsx("div",{className:"mt-2",children:jsxs("svg",{width:r,height:o,children:[jsx(PatternLines,{id:"brush_pattern",height:8,width:8,stroke:"var(--color-text-secondary)",strokeWidth:1,orientation:["diagonal"]}),jsxs("g",{transform:`translate(${u.left}, 0)`,children:[e.map((h,y)=>jsx(LinePath,{data:h,x:v=>p(v.xValue),y:v=>g(v.yValue),stroke:t[y]?.color||"var(--color-gray-500)",strokeWidth:1.5,opacity:.8},`brush-series-${y}`)),jsx(Brush,{xScale:p,yScale:g,width:m,height:o-u.top-u.bottom,margin:{top:u.top,bottom:u.bottom,left:0,right:0},handleSize:8,innerRef:c,resizeTriggerAreas:["left","right"],brushDirection:"horizontal",initialBrushPosition:x,onChange:f,onClick:()=>n(null),selectedBoxStyle:b,useWindowMoveEvents:true})]})]})})};function bo(e){switch(e){case "command":return Nt("--color-action-brand","#111111");case "success":return Nt("--color-feedback-success-border","#278a4a");case "warning":return Nt("--color-feedback-warning-border","#c88420");case "error":return Nt("--color-feedback-error-border","#c42d2d");case "alert":return Nt("--color-feedback-warning-border","#c88420");default:return Nt("--color-text-secondary","#525250")}}function Ys({events:e,color:t,showLabels:r=false}){let o=useContext(kr),[n,a]=useState(null);if(!o)return console.warn("ChartEventMarkers must be used within a ChartContainer"),null;let{xScale:i,yScale:s,height:c,tooltip:l,datasets:d,seriesMetadata:u,seriesTypes:m,categoryColors:p}=o,g=e.filter(b=>{let h=i(b.timestamp);return h>=Ae.left&&h<=i.range()[1]}),f=useCallback((b,h)=>{a(h);let y=i(b.timestamp),v=y>(i.range()[1]-Ae.right-Ae.left)/2+Ae.left,S=[];d&&u&&d.forEach((M,k)=>{if(M.length===0)return;let P=bisector(B=>B.xValue).left,I=P(M,b.timestamp),D=M[I-1],L=M[I],R;if(!D)R=L;else if(!L)R=D;else {let B=Math.abs(b.timestamp.getTime()-D.xValue.getTime()),Y=Math.abs(b.timestamp.getTime()-L.xValue.getTime());R=B<Y?D:L;}R&&u[k]&&S.push({label:u[k].label,value:R.yValue,color:u[k].color,type:m?.[k]||"line",...R.category&&{category:R.category,categoryColor:p?.[R.category]}});});let w=g.filter(M=>Math.abs(i(M.timestamp)-y)<=10).map(M=>({label:M.label,color:t||bo(M.type),metadata:M.metadata}));S.push({label:w.length>1?`${w.length} events`:b.label,value:0,color:t||bo(b.type),type:"event"}),l.show({xValue:b.timestamp,series:S,x:y,y:S.length>1&&typeof S[0].value=="number"?s(S[0].value):c/2,position:v?"left":"right",isEvent:true,eventMetadata:b.metadata,eventItems:w});},[i,s,c,l,t,d,u,m,p,g]),x=useCallback(()=>{a(null),l.hide();},[l]);return g.length===0?null:jsx("g",{className:"chart-event-markers","data-testid":"chart-event-markers",children:g.map((b,h)=>{let y=i(b.timestamp),v=t||bo(b.type),S=n===h;return jsxs("g",{children:[jsx("line",{x1:y,y1:Ae.top,x2:y,y2:c-Ae.bottom,stroke:v,strokeWidth:S?3:2,strokeDasharray:"4 4",strokeOpacity:S?.9:.6,pointerEvents:"none"}),jsx("circle",{cx:y,cy:Ae.top,r:S?5:4,fill:v,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),jsx("circle",{cx:y,cy:c-Ae.bottom,r:S?5:4,fill:v,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),r&&jsx("text",{x:y,y:Ae.top-8,textAnchor:"middle",fill:"var(--color-text-secondary)",fontSize:11,fontWeight:500,pointerEvents:"none",children:b.label}),jsx("rect",{x:y-10,y:Ae.top,width:20,height:c-Ae.top-Ae.bottom,fill:"transparent",style:{cursor:"pointer"},onMouseEnter:()=>f(b,h),onMouseLeave:x})]},`${b.timestamp.getTime()}-${h}`)})})}function Js({spans:e,opacity:t=.25,color:r}){let o=useContext(kr),[n,a]=useState(null),i=o?.xScale,s=o?.height,c=o?.tooltip,[l,d]=i?.domain()??[new Date(0),new Date(0)],[u,m]=i?.range()??[0,0],p=useCallback((S,N)=>{if(!i||!c)return;a(N);let w=S.start<l?l:S.start,M=S.end>d?d:S.end,k=(i(w)+i(M))/2,P=k>(m-u)/2+u,D=e.filter(L=>L.end>L.start&&L.start<S.end&&L.end>S.start).map(L=>({label:L.label,color:L.color??r??bo(L.type),metadata:L.metadata}));c.show({xValue:S.start,series:[{label:D.length>1?`${D.length} scheduled commands`:S.label,value:0,color:S.color??r??bo(S.type),type:"event"}],x:k,y:(s??0)/2,position:P?"left":"right",isEvent:true,eventMetadata:S.metadata,eventItems:D});},[i,s,c,r,l,d,u,m,e]),g=useCallback(()=>{a(null),c?.hide();},[c]);if(!o)return console.warn("ChartEventSpans must be used within a ChartContainer"),null;let{xScale:f,height:x}=o,b=Ae.top,y=x-Ae.bottom-b,v=e.filter(S=>S.end>S.start);return v.length===0?null:jsx("g",{className:"chart-event-spans","data-testid":"chart-event-spans",children:v.map((S,N)=>{let w=S.start<l?l:S.start,M=S.end>d?d:S.end;if(w>=d||M<=l)return null;let k=f(w),I=f(M)-k;if(I<=0)return null;let D=S.color??r??bo(S.type);return jsx("rect",{x:k,y:b,width:I,height:y,fill:D,fillOpacity:n===N?Math.min((t??.25)*1.8,1):t??.25,pointerEvents:"all",style:{cursor:"pointer"},onMouseEnter:()=>p(S,N),onMouseLeave:g},`${S.start.getTime()}-${S.end.getTime()}-${N}`)})})}var kn=({data:e,color:t="var(--color-viz-default)",strokeWidth:r=3,strokeDasharray:o,categoryColors:n={},maxGapMs:a,animate:i=true})=>{let{xScale:s,yScale:c,animationSettings:l}=Nn(),d=c.range(),u=Object.keys(n).length>0,m=h=>h.category?n[h.category]??t:t,p=h=>h.chartYValue??h.yValue,g=e.length===1?e[0]:void 0,f=a!=null?Vs(e,a):e,x=g?jsx("circle",{cx:s(g.xValue),cy:c(p(g)),r,fill:u?m(g):t}):u?e.slice(0,-1).map((h,y)=>{let v=e[y+1];return a!=null&&a>0&&v.xValue.getTime()-h.xValue.getTime()>a?null:jsx(LinePath,{data:[h,v],x:S=>s(S.xValue),y:S=>c(p(S)),stroke:m(h),strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",curve:curveLinear},`${h.xValue.getTime()}-${v.xValue.getTime()}`)}):jsx(LinePath,{data:f,x:h=>h?s(h.xValue):0,y:h=>h?c(p(h)):0,defined:h=>h!=null,stroke:t,strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",curve:curveLinear}),b={transformOrigin:`0 ${d[0]}px`,transformBox:"fill-box",isolation:"isolate"};return i?jsx(motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:l.duration,ease:l.ease},style:b,children:x}):jsx("g",{style:b,children:x})};var Hg=e=>e.type===Go||e.type===kn||e.type===Os,Vk=e=>e.type===Ys||e.type===Js,zk=(e,t,r)=>{if(!e.tooltipRange||e.baseline===void 0)return;let o=typeof e.baseline=="function"?e.baseline(t,r):e.baseline;return typeof o=="number"&&Number.isFinite(o)&&o!==t.yValue?o:void 0},Ok=bisector(e=>e.xValue).left,Hk=()=>jsx("div",{className:"flex h-full items-center justify-center",children:jsx("p",{className:"text-text-secondary",children:"No data available"})}),Wk=()=>jsxs("div",{className:"flex h-full flex-col gap-4 p-4",children:[jsx(K,{className:"h-full w-full"}),jsxs("div",{className:"flex gap-4",children:[jsx(K,{className:"h-4 w-24"}),jsx(K,{className:"h-4 w-24"})]})]}),Gk=({parentWidth:e,parentHeight:t,yFormatter:r={type:"number"},yDomain:o,referenceLines:n,isLoading:a=false,enableZoom:i=false,enableBrush:s=false,brushHeight:c=60,onZoomChange:l,zoomDomain:d,hiddenSeriesLabels:u,onHiddenSeriesChange:m,children:p})=>{let g=u!==void 0,f=d!==void 0,[x,b]=useState(null),[h,y]=useState(null),v=f?d:h,[S,N]=useState(()=>new Set),w=g?u:S,M=useRef(null),k=useId(),P=useRef(0),I=useRef(""),D=useRef(null),{colorMode:L}=It(),R=useMemo(()=>sn(),[L]),B=useMemo(()=>Qa(),[L]),{datasets:Y,seriesMetadata:H,categoryInfo:W,categoryColors:Z,categoryLabels:q,seriesTypes:Q}=useMemo(()=>{let de=Children.toArray(p).filter(De=>isValidElement(De)&&Hg(De)),Ie=de.filter(De=>De.props.data).length,Ne=[],Ve=[],$e=[],dt=null,Ee=null;de.forEach((De,yt)=>{let Pe=De.props;if(!Pe.data)return;Ne.push(Pe.data);let ra=("color"in Pe&&Pe.color?Pe.color:void 0)||(Ie===1?B:R[yt%R.length]),on=De.type===Go;Ve.push({label:"label"in Pe&&Pe.label||`Series ${Ne.length}`,color:ra,...on&&"baseline"in Pe&&Pe.baseline!==void 0?{baseline:Pe.baseline,tooltipRange:"tooltipRange"in Pe&&Pe.tooltipRange||false}:{}});let bc=on?"area":De.type===kn?"line":"bar";$e.push(bc),"categoryColors"in Pe&&Pe.categoryColors&&(dt=Pe.categoryColors),"categoryLabels"in Pe&&Pe.categoryLabels&&(Ee=Pe.categoryLabels);});let ut=null;if(dt){let De=new Set;Ne.forEach(yt=>{yt.forEach(Pe=>{Pe.category&&De.add(Pe.category);});}),ut=Array.from(De).map(yt=>({label:Ee?.[yt]||yt,color:dt[yt]||"#6b7280"}));}return {datasets:Ne,seriesMetadata:Ve,categoryInfo:ut,categoryColors:dt,categoryLabels:Ee,seriesTypes:$e}},[p,B,R,L]),T=e,E=s?c+8:0,O=t-60-E,A=Math.max(100,O),C=useCallback(J=>J?w.has(J):false,[w]),F=useMemo(()=>H.map((J,de)=>C(J.label)?null:de).filter(J=>J!==null),[H,C]),z=useMemo(()=>F.map(J=>Y[J]).filter(J=>!!J),[Y,F]),G=useMemo(()=>F.map(J=>H[J]).filter(J=>!!J),[H,F]),oe=useMemo(()=>F.map(J=>Q[J]).filter(J=>!!J),[Q,F]),ue=oe.findIndex(J=>J==="bar"),te=ue!==-1,le=useCallback((J,de)=>{let Ie=J.has(de);if(!Ie&&H.reduce(($e,dt)=>J.has(dt.label)||dt.label===de?$e:$e+1,0)<1)return J;let Ne=new Set(J);return Ie?Ne.delete(de):Ne.add(de),Ne},[H]),me=useCallback(J=>{if(g){let de=u;if(!de.has(J)&&H.reduce((Ve,$e)=>de.has($e.label)||$e.label===J?Ve:Ve+1,0)<1){b(null);return}m?.(Ne=>le(Ne,J));}else N(de=>le(de,J));b(null);},[g,u,m,H,le]),re=useMemo(()=>H.map(J=>J.label).join(""),[H]),ie=useRef(re);useEffect(()=>{ie.current!==re&&(ie.current=re,g||N(J=>J.size===0?J:new Set));},[re,g]);let fe=useMemo(()=>z.flat(),[z]),xe=useMemo(()=>{if(fe.length===0)return null;let J=[...fe].sort((de,Ie)=>de.xValue.getTime()-Ie.xValue.getTime());return [J[0].xValue,J[J.length-1].xValue]},[fe]),Ze=v||xe,Kt=useCallback(J=>{f?l?.(J):y(J);},[f,l]),ir=useMemo(()=>Ze?Y.map(de=>de.filter(Ie=>Ie.xValue>=Ze[0]&&Ie.xValue<=Ze[1])):Y,[Y,Ze]),j=useMemo(()=>F.map(J=>ir[J]??[]),[F,ir]);useEffect(()=>{l&&l(v);},[v,l]);let ae=useMemo(()=>F.flatMap(J=>ir[J]??[]),[ir,F]),_=useMemo(()=>ui(ae,A,r,o),[ae,A,r,o]),X=useRef(JSON.stringify(r)),U=useRef(null),ce=useMemo(()=>{let[J,de]=_.domain(),Ie=Math.max(Math.abs(J),Math.abs(de)),Ne=JSON.stringify(r);if(Ne!==X.current&&(X.current=Ne,U.current=null),U.current!==null)return U.current;if(Ie===0)return va(r,0);let Ve=va(r,Ie);return U.current=Ve,Ve},[_,r]),se=useMemo(()=>{let J=A-Ae.top-Ae.bottom;return Sa(J)},[A]),$=useMemo(()=>{let J=Or(ce),de=J.tickFormat||J.format,Ne=_.ticks(se).map(dt=>de(dt)),Ve=Ca(Ne,12,"system-ui"),$e=Math.ceil(Ve)+12;return {...Ae,left:Math.max($e,30),right:8}},[_,ce,se]),Se=useMemo(()=>Ze?scaleTime({domain:Ze,range:[$.left,T-$.right]}):tu(fe,T),[Ze,fe,T,$]),_e=useCallback(J=>{if(!xe)return;let{scaleX:de,translateX:Ie}=J,Ne=T-$.left-$.right,[Ve,$e]=xe,dt=$e.getTime()-Ve.getTime();if(dt<=0){Kt(null);return}let Ee=-Ie,ut=Ee+Ne,De=Ne*de/dt,yt=Ee/De,Pe=ut/De,rn=new Date(Ve.getTime()+yt),ra=new Date(Ve.getTime()+Pe),on=Math.abs(rn.getTime()-Ve.getTime()),bc=Math.abs(ra.getTime()-$e.getTime()),Lp=dt*.02;on<Lp&&bc<Lp?Kt(null):Kt([rn,ra]);},[xe,T,$,Kt]),Ir=useCallback(J=>{let{left:de}=M.current?.getBoundingClientRect()||{left:0},Ie=J.clientX-de;if(J.timeStamp-(P.current||0)<16)return;P.current=J.timeStamp;let Ne=Se.invert(Ie),Ve=j.map((Ee,ut)=>{if(!Ee||Ee.length===0)return null;let De=Ok(Ee,Ne,1);if(De===0)return {point:Ee[0],index:0,datasetIndex:ut};if(De>=Ee.length)return {point:Ee[Ee.length-1],index:Ee.length-1,datasetIndex:ut};let yt=Ee[De-1],Pe=Ee[De];if(!yt||!Pe)return null;let rn=Math.abs(yt.xValue.getTime()-Ne.getTime()),ra=Math.abs(Pe.xValue.getTime()-Ne.getTime()),on=rn<ra;return {point:on?yt:Pe,index:on?De-1:De,datasetIndex:ut}}).filter(Ee=>Ee!==null&&G[Ee.datasetIndex]!==void 0).map(({point:Ee,index:ut,datasetIndex:De})=>({label:G[De].label,value:Ee.yValue,baselineValue:zk(G[De],Ee,ut),color:G[De].color,point:Ee,type:oe[De]}));if(Ve.length===0){b(null);return}let $e=Se(Ve[0].point.xValue),dt=$e>(T-$.right-$.left)/2+$.left;b({xValue:Ve[0].point.xValue,series:Ve.map(({label:Ee,value:ut,baselineValue:De,color:yt,point:Pe,type:rn})=>({label:Ee,value:ut,...De!==void 0?{baselineValue:De}:{},chartY:Pe.chartYValue??ut,showMarker:Pe.showTooltipMarker??true,color:yt,type:rn,category:Pe.category,categoryColor:Pe.category&&Z?Z[Pe.category]:void 0,...Pe.extraTooltipRows&&Pe.extraTooltipRows.length>0?{extraTooltipRows:Pe.extraTooltipRows}:{}})),x:$e,y:_(Ve[0].point.chartYValue??Ve[0].value),position:dt?"left":"right"});},[j,G,oe,Se,_,T,Z,$]),po=()=>{b(null);},vr=useCallback(()=>{Kt(null),D.current&&D.current.reset();},[Kt]),ta=useCallback(J=>{if(!(D.current&&xe))return;let[de,Ie]=xe,Ne=Ie.getTime()-de.getTime();if(Ne<=0){D.current.reset();return}if(!J){D.current.reset();return}let[Ve,$e]=J,dt=$e.getTime()-Ve.getTime();if(dt<=0){D.current.reset();return}let Ee=Ne/dt,ut=T-$.left-$.right,yt=-((Ve.getTime()-de.getTime())/Ne)*ut*Ee;D.current.setTransformMatrix({scaleX:Ee,scaleY:1,translateX:yt,translateY:0,skewX:0,skewY:0});},[xe,T,$]),fc=useCallback(J=>{Kt(J),ta(J);},[Kt,ta]);useEffect(()=>{f&&ta(d??null);},[f,d,ta]);let _y={width:T,height:A,xScale:Se,yScale:_,yFormatter:ce,animationSettings:Bs,tooltip:{data:x,show:b,hide:()=>b(null)},datasets:j,seriesMetadata:G,seriesTypes:oe,categoryColors:Z||void 0,categoryLabels:q||void 0},$y=Children.toArray(p),Pp=0,Rp=[],Mp=[],gc=[];$y.forEach(J=>{if(!isValidElement(J)){gc.push(J);return}if(Vk(J))Mp.push(J);else if(Hg(J)){let de=Pp;Pp++;let Ie=J.props,Ne=H[de]?.label;if(C(Ne))return;Rp.push(Oe__default.cloneElement(J,{...Ie,data:ir[de]||Ie.data,color:H[de]?.color}));}else gc.push(J);});let ev=F.length,tv=(W||H).map(J=>{let de=!W&&C(J.label);return {category:J.label,fill:J.color,isHidden:de,isDisabled:!W&&!de&&ev<=1}}),rv=typeof r=="object"&&r!==null&&typeof r.type=="string",ov=Us({datasets:z,metadata:{xLabel:"Date",yLabel:"Value",seriesLabels:G.map(J=>J.label),timestamp:true,...rv?{yFormat:r}:{}},svgRef:M});if(a)return jsx(Wk,{});if(Y.length===0)return jsx(Hk,{});let Dp=jsxs(Fragment,{children:[jsx("title",{children:"Data chart visualization"}),jsx("g",{children:_.ticks(se).map(J=>{let de=Math.abs(J)<Number.EPSILON;return jsx(Line,{from:{x:$.left,y:_(J)},to:{x:T-$.right,y:_(J)},stroke:de?"var(--color-border-default)":"var(--color-border-muted)",strokeWidth:de?1.5:1},`grid-line-${J}`)})}),jsx("defs",{children:jsx("clipPath",{id:k,children:jsx("rect",{x:Se.range()[0],y:_.range()[1],width:Se.range()[1]-Se.range()[0],height:_.range()[0]-_.range()[1]})})}),jsx("g",{clipPath:`url(#${k})`,children:Rp}),gc,n&&n.length>0&&jsx("g",{children:n.map(J=>{let de=_(J.value),Ie=J.color??"var(--color-error-base)";return jsxs("g",{children:[jsx(Line,{from:{x:$.left,y:de},to:{x:T-$.right,y:de},stroke:Ie,strokeWidth:1.5,strokeDasharray:"6 4"}),J.label&&jsx("text",{x:T-$.right-4,y:de-4,textAnchor:"end",fontSize:11,fill:Ie,children:J.label})]},`ref-line-${J.value}`)})}),jsx(Tr.Bottom,{top:A-$.bottom,scale:Se,width:T-$.left-$.right}),jsx(Tr.Left,{left:$.left,scale:_,yFormatter:ce,height:A-$.top-$.bottom}),x&&!x.isEvent&&jsxs(Fragment,{children:[te?(()=>{let J=z[ue]??[];if(J.length===0)return null;let de=[...J].sort((De,yt)=>De.xValue.getTime()-yt.xValue.getTime()),Ie=de.findIndex(De=>De.xValue.getTime()===x.xValue.getTime()),Ne=de[Ie+1],Ve=de.length>1&&Ne?Ne.xValue.getTime()-x.xValue.getTime():15*6e4,$e=Math.abs(Se(new Date(x.xValue.getTime()+Ve))-Se(x.xValue)),Ee=Se(x.xValue)-$e/2,ut=_.range();return jsx("rect",{x:Ee,y:ut[1],width:$e,height:ut[0]-ut[1],className:"fill-background-muted",opacity:.5,pointerEvents:"none",style:{transition:"all 100ms ease-out"}})})():null,x.series.filter(J=>J.type!=="bar"&&J.showMarker!==false).map(J=>jsxs("g",{children:[jsx("circle",{cx:Se(x.xValue),cy:_(J.chartY??J.value),r:8,fill:"white",stroke:J.color,strokeWidth:2,style:{transition:"all 100ms ease-out"}}),jsx("circle",{cx:Se(x.xValue),cy:_(J.chartY??J.value),r:4,fill:J.color,style:{transition:"all 100ms ease-out"}})]},`highlight-${J.label}`))]}),jsx("rect",{x:$.left,y:$.top,width:T-$.left-$.right,height:A-$.top-$.bottom,fill:"transparent",style:{cursor:i?"grab":"crosshair",touchAction:"none"},onMouseMove:Ir,onMouseLeave:po}),Mp]});return jsx("div",{className:"relative flex h-full flex-col",children:jsxs(kr.Provider,{value:_y,children:[i?jsx(Zoom,{width:T,height:A,scaleXMin:1,scaleXMax:20,scaleYMin:1,scaleYMax:1,constrain:J=>{let{scaleX:de,translateX:Ie}=J,Ne=Math.max(1,Math.min(20,de)),Ve=1,$e=T-$.left-$.right,dt=0,Ee=$e*(1-Ne),ut=Math.max(Ee,Math.min(dt,Ie));return {...J,scaleX:Ne,scaleY:Ve,translateX:ut,translateY:0}},children:J=>{if(D.current=J,J.transformMatrix){let{scaleX:de,translateX:Ie}=J.transformMatrix,Ne=`${de.toFixed(4)}-${Ie.toFixed(2)}`;Ne!==I.current&&(I.current=Ne,setTimeout(()=>{_e(J.transformMatrix);},0));}return jsx("svg",{width:T,height:A,className:"overflow-visible",ref:de=>{M.current=de,J.containerRef.current!==de&&(J.containerRef.current=de);},role:"img","aria-label":"Data chart",style:{cursor:J.isDragging?"grabbing":"grab",touchAction:"none"},onMouseDown:J.dragStart,onMouseMove:J.dragMove,onMouseUp:J.dragEnd,onMouseLeave:()=>{J.isDragging&&J.dragEnd();},onTouchStart:J.dragStart,onTouchMove:J.dragMove,onTouchEnd:J.dragEnd,children:Dp})}}):jsx("svg",{width:T,height:A,className:"overflow-visible",ref:M,role:"img","aria-label":"Data chart",children:Dp}),jsx(Uo,{data:x,formatter:ce}),s&&xe&&jsx(iu,{data:z,seriesMetadata:G,width:T,height:c,onBrushChange:fc,brushRegion:v,margin:$,...o?{yDomain:o}:{}}),jsx(Na,{onExport:ov,items:tv,marginLeft:0,marginRight:$.right,isZoomed:v!==null,onResetZoom:vr,onLegendItemToggle:W?void 0:me})]})})},Gg=withParentSize(Gk);var jk=e=>e.toLocaleString(),qk=e=>`${Math.round(e*100)}%`,Jg=({data:e,width:t=800,height:r=400,padding:o=0,barGap:n=30,formatValue:a=jk,formatPercentage:i=qk,color:s,showScale:c=true,showOverallConversion:l=true,overallConversionLabel:d="Overall Conversion:",activeStageId:u,onStageClick:m,onStageHover:p,className:g,style:f,"aria-label":x="Funnel chart"})=>{let[b,h]=useState(null),[y,v]=useState(t),S=useRef(null),N=u??b,w=useId(),M=s||"var(--color-viz-default)";useEffect(()=>{if(!S.current)return;let R=new ResizeObserver(B=>{for(let Y of B)v(Y.contentRect.width);});return R.observe(S.current),()=>{R.disconnect();}},[]);let{layout:k,overallConversion:P}=useMemo(()=>{if(e.length===0)return {layout:[],overallConversion:0};let R=e[0].value,B=l?60:0,Y=r-o*2-B,H=(e.length-1)*n,W=(Y-H)/e.length,Z=e.map((Q,T)=>{let E=o+B+T*(W+n),O=R===0?0:Q.value/R,A=O,C=T===0?null:e[T-1].value,F=C==null||C===0?0:1-Q.value/C;return {stage:Q,index:T,y:E,barHeight:W,widthPercent:O,conversionRate:A,dropOff:F}}),q=R===0?0:e[e.length-1].value/R;return {layout:Z,overallConversion:q,maxValue:R}},[e,y,r,o,n,c,l]);if(e.length===0)return jsx("div",{className:twMerge("flex h-full min-h-[280px] w-full items-center justify-center rounded-lg border border-dashed border-border-default bg-background-surface text-sm font-medium text-text-secondary",g),style:{width:t,height:r,...f},children:"No funnel data available"});let I=c?60:0,D=o+I,L=y-o*2-I;return jsx("div",{ref:S,className:twMerge("relative w-full overflow-hidden rounded-lg bg-background-surface",g),style:{height:r,...f},"aria-label":x,role:"img",children:jsxs("svg",{width:"100%",height:r,className:"relative",children:[jsxs("defs",{children:[jsx(LinearGradient,{id:`${w}-bar`,from:M,to:M,toOpacity:.85}),jsx(LinearGradient,{id:`${w}-bg`,from:M,to:M,fromOpacity:.01,toOpacity:.15,x1:"0",y1:"0",x2:"1",y2:"0"})]}),l&&jsxs("text",{x:D,y:o+20,className:"fill-text-primary text-sm font-medium",children:[jsx("tspan",{className:"fill-text-secondary",children:d})," ",i(P)]}),c&&jsx("g",{children:k.map(R=>{let B=R.y+R.barHeight/2;return jsx("text",{x:o+I-12,y:B,textAnchor:"end",dominantBaseline:"middle",className:"fill-text-secondary text-xs",children:i(R.conversionRate)},R.stage.id)})}),k.map(R=>{let B=N===R.stage.id,Y=L*R.widthPercent;return jsxs("g",{children:[jsx("rect",{x:D,y:R.y,width:L,height:R.barHeight,fill:`url(#${w}-bg)`,rx:4}),jsx(motion.rect,{x:D,y:R.y,width:Y,height:R.barHeight,fill:`url(#${w}-bar)`,rx:4,initial:{width:0},animate:{width:Y},transition:{duration:.6,delay:R.index*.1,ease:"easeOut"},opacity:B||N==null?1:.5,style:{cursor:m||p?"pointer":"default",transition:"opacity 150ms ease"},onMouseEnter:()=>{h(R.stage.id),p?.(R.stage);},onMouseLeave:()=>{h(null),p?.(null);},onClick:()=>m?.(R.stage)}),jsx("rect",{x:D+10,y:R.y+R.barHeight/2-10,width:70,height:20,className:"fill-background-surface stroke-border-default",strokeWidth:1,rx:4,style:{pointerEvents:"none"}}),jsx("text",{x:D+16,y:R.y+R.barHeight/2+4,className:"fill-text-primary text-xs font-semibold",style:{pointerEvents:"none"},children:a(R.stage.value)}),jsxs("text",{x:D,y:R.y-8,className:"fill-text-secondary text-xs",style:{pointerEvents:"none"},children:[jsx("tspan",{children:R.index+1})," ",R.stage.label]}),R.stage.secondaryValue&&jsx("text",{x:D+16,y:R.y-24,className:"fill-text-secondary text-xs",style:{pointerEvents:"none"},children:R.stage.secondaryValue}),R.index>0&&R.dropOff>0&&jsxs("text",{x:D+L,y:R.y-8,textAnchor:"end",className:"fill-text-secondary text-xs",children:[i(R.dropOff)," drop"]}),R.stage.annotation&&jsxs("g",{children:[jsx("rect",{x:D+Y+8,y:R.y+8,width:60,height:24,rx:3,className:"fill-background-muted"}),jsx("text",{x:D+Y+16,y:R.y+20,className:"fill-text-secondary text-xs font-medium",children:R.stage.annotation})]})]},R.stage.id)})]})})};function Xg(){let e=new Map;return {publish(t,r){for(let[o,n]of e)o!==t&&n(r);},subscribe(t,r){return e.set(t,r),()=>{e.delete(t);}}}}var Zk=bisector(e=>e.xValue).left,_k=(e,t,r)=>{if(!e.tooltipRange||e.baseline===void 0)return;let o=typeof e.baseline=="function"?e.baseline(t,r):e.baseline;return typeof o=="number"&&Number.isFinite(o)&&o!==t.yValue?o:void 0};function jg(e){let{mouseX:t,datasets:r,seriesMetadata:o,seriesTypes:n,xScale:a,yScale:i,plotLeft:s,plotRight:c}=e,l=a.invert(t),d=r.map((p,g)=>{if(!p||p.length===0)return null;let f=Zk(p,l,1);if(f===0)return {point:p[0],index:0,datasetIndex:g};if(f>=p.length)return {point:p[p.length-1],index:p.length-1,datasetIndex:g};let x=p[f-1],b=p[f];if(!x||!b)return null;let h=Math.abs(x.xValue.getTime()-l.getTime()),y=Math.abs(b.xValue.getTime()-l.getTime()),v=h<y;return {point:v?x:b,index:v?f-1:f,datasetIndex:g}}).filter(p=>p!==null&&o[p.datasetIndex]!==void 0).map(({point:p,index:g,datasetIndex:f})=>({label:o[f].label,value:p.yValue,baselineValue:_k(o[f],p,g),color:o[f].color,point:p,type:n[f]}));if(d.length===0)return null;let u=a(d[0].point.xValue),m=u>(s+c)/2;return {xValue:d[0].point.xValue,series:d.map(({label:p,value:g,baselineValue:f,color:x,point:b,type:h})=>({label:p,value:g,...f!==void 0?{baselineValue:f}:{},chartY:b.chartYValue??g,showMarker:b.showTooltipMarker??true,color:x,type:h,...b.category!==void 0?{category:b.category}:{},...b.extraTooltipRows&&b.extraTooltipRows.length>0?{extraTooltipRows:b.extraTooltipRows}:{}})),x:u,y:i(d[0].point.chartYValue??d[0].value),position:m?"left":"right"}}var Qg=e=>e instanceof Date&&!Number.isNaN(e.getTime());function Xs(e,t,r){let[o,n]=useState(null);useImperativeHandle(r,()=>({setPreview:n}),[]);let[a,i]=e.range(),s=useMemo(()=>o?scaleTime$1().domain([new Date(o[0]),new Date(o[1])]).range([a,i]):e,[o,e,a,i]),c=s.domain(),l=c[0],d=c[c.length-1],u=Qg(l)&&Qg(d),m=t<400,p=Math.max(2,Math.min(8,Math.floor(t/(m?70:110)))),g=useMemo(()=>u?s.ticks(p):[],[s,p,u]);return {activeScale:s,ticks:g,start:l,end:d,valid:u,compact:m,rangeStart:a,rangeEnd:i}}var aT=6,Zg=20,du=forwardRef(({top:e,scale:t,width:r},o)=>{let{activeScale:n,ticks:a,start:i,end:s,valid:c,compact:l,rangeStart:d,rangeEnd:u}=Xs(t,r,o),m=a.length>=2?a[1].getTime()-a[0].getTime():s.getTime()-i.getTime(),p=useMemo(()=>c?Ym(m,{compact:l}):()=>"",[m,l,c]),g=useId(),f=Math.min(d,u),x=Math.abs(u-d);return jsxs("g",{children:[jsx("line",{x1:d,x2:u,y1:e,y2:e,stroke:"var(--color-border-muted)",strokeWidth:1}),a.length>0&&jsxs(Fragment,{children:[jsx("defs",{children:jsx("clipPath",{id:g,children:jsx("rect",{x:f,y:e-4,width:x,height:Zg+16})})}),jsx("g",{clipPath:`url(#${g})`,children:a.map(b=>jsxs("g",{transform:`translate(${n(b)},${e})`,children:[jsx("line",{x1:0,x2:0,y1:0,y2:aT,stroke:"var(--color-border-muted)",strokeWidth:1}),jsx("text",{x:0,y:Zg,textAnchor:"middle",fontSize:12,fill:"var(--color-text-secondary)",children:p(b)})]},b.getTime()))})]})]})});du.displayName="LiveTimeAxisBottom";var uu=forwardRef(({scale:e,width:t,top:r,bottom:o},n)=>{let{activeScale:a,ticks:i}=Xs(e,t,n);return jsx("g",{"aria-hidden":"true",children:i.map(s=>{let c=a(s);return jsx("line",{x1:c,x2:c,y1:r,y2:o,stroke:"var(--color-border-muted)",strokeWidth:1},s.getTime())})})});uu.displayName="LiveTimeGridlines";function js(e,t,r){let o=e[1]-e[0],n=t/Math.max(1,r)*o;return [e[0]-n,e[1]-n]}function $g(e,t,r){let o=e[1]-e[0],n=e[0]+t*o,a=o/r,i=n-t*a;return [i,i+a]}function pu(e,t,r=16,o=800){return t===1?e*r:t===2?e*o:e}var eb=(e,t,r,o,n)=>{let a=t!==1?$g(e,r,t):e;return o!==0&&(a=js(a,o,n)),a},tb=(e,t)=>{if(!t)return e;let r=e[1]-e[0];if(r>=t[1]-t[0])return [t[0],t[1]];let[o,n]=e;return n>t[1]&&(n=t[1],o=n-r),o<t[0]&&(o=t[0],n=o+r),[o,n]},cT=e=>typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(()=>e(0),0),dT=e=>{typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):clearTimeout(e);};function rb(e){let{groupRef:t}=e,r=useRef({xDomain:e.xDomain,plotWidthPx:e.plotWidthPx,plotLeftPx:e.plotLeftPx??0});r.current={xDomain:e.xDomain,plotWidthPx:e.plotWidthPx,plotLeftPx:e.plotLeftPx??0};let o=useRef(e.onCommit);o.current=e.onCommit;let n=useRef(e.panBoundsMs);n.current=e.panBoundsMs;let a=useRef(e.settleMs??140);a.current=e.settleMs??140;let i=useRef(e.zoomIntent??(D=>D.ctrlKey));i.current=e.zoomIntent??(D=>D.ctrlKey);let s=useRef(e.onGestureStart);s.current=e.onGestureStart;let c=useRef(e.onFramePreview);c.current=e.onFramePreview;let l=useRef(null),d=useRef({scale:1,cursorFrac:.5,panDxPx:0,timer:null}),u=useRef(null),m=useRef(null),p=useRef(false),g=useCallback((D,L,R)=>{m.current={translateX:D,scaleX:L,preview:R},u.current==null&&(u.current=cT(()=>{u.current=null;let B=m.current;B!=null&&(t.current?.setAttribute("transform",`translate(${B.translateX},0) scale(${B.scaleX},1)`),c.current?.(B.preview));}));},[t]),f=useCallback(()=>{u.current!=null&&(dT(u.current),u.current=null),m.current=null,t.current?.removeAttribute("transform"),c.current?.(null);},[t]),x=useCallback(()=>{p.current||(p.current=true,s.current?.());},[]),b=useCallback(()=>{p.current=false;},[]),h=useCallback(()=>{d.current.timer!=null&&(clearTimeout(d.current.timer),d.current.timer=null);},[]),y=useCallback(()=>{d.current={scale:1,cursorFrac:.5,panDxPx:0,timer:null};},[]),v=useCallback(()=>{let{xDomain:D,plotWidthPx:L}=r.current,{scale:R,cursorFrac:B,panDxPx:Y}=d.current;R===1&&Y===0||o.current(tb(eb(D,R,B,Y,L),n.current));},[]),S=useCallback(()=>{d.current.timer!=null&&(h(),v(),y(),f());},[h,v,y,f]),N=useCallback(D=>{S(),D.currentTarget.setPointerCapture?.(D.pointerId),l.current={startX:D.clientX,dxPx:0},x();},[S,x]),w=useCallback(D=>{if(!l.current)return;l.current.dxPx=D.clientX-l.current.startX;let{xDomain:L,plotWidthPx:R}=r.current;g(l.current.dxPx,1,js(L,l.current.dxPx,R));},[g]),M=useCallback(D=>{if(!l.current)return;let{dxPx:L}=l.current;l.current=null,f(),b(),L!==0&&o.current(tb(js(r.current.xDomain,L,r.current.plotWidthPx),n.current));},[f,b]),k=useCallback(()=>{l.current&&(l.current=null,f(),b());},[f,b]),P=useRef(null),I=useCallback(D=>{if(P.current?.(),P.current=null,!D)return;let L=R=>{if(l.current)return;let{plotWidthPx:B,plotLeftPx:Y}=r.current,H=pu(R.deltaY,R.deltaMode),W=pu(R.deltaX,R.deltaMode),Z=i.current(R);if(!Z&&W===0)return;if(R.preventDefault(),x(),Z){let E=Math.min(1,Math.max(0,(R.clientX-D.getBoundingClientRect().left)/Math.max(1,B)));d.current.scale*=Math.exp(-H/200),d.current.cursorFrac=E;}else d.current.panDxPx-=W;let{scale:q,cursorFrac:Q,panDxPx:T}=d.current;g((Y+Q*B)*(1-q)+T,q,eb(r.current.xDomain,q,Q,T,B)),h(),d.current.timer=setTimeout(()=>{v(),y(),f(),b();},a.current);};D.addEventListener("wheel",L,{passive:false}),P.current=()=>D.removeEventListener("wheel",L);},[g,f,h,v,y,x,b]);return useEffect(()=>()=>{P.current?.(),P.current=null,f(),d.current.timer!=null&&clearTimeout(d.current.timer);},[f]),{onPointerDown:N,onPointerMove:w,onPointerUp:M,onPointerCancel:k,wheelTargetRef:I,gestureActiveRef:p}}var sb=e=>e.type===Go||e.type===kn,bT=({children:e,viewport:t,panBounds:r,onViewportChange:o,onPlotWidthChange:n,yFormatter:a={type:"number"},yDomain:i,referenceLines:s,cameraSync:c,parentWidth:l=0,parentHeight:d=0})=>{let[u,m]=useState(null),p=useRef(null),g=useRef(0),f=useId(),x=useRef(null),b=useRef(null),h=useRef(null),{colorMode:y}=It(),v=useMemo(()=>sn(),[y]),S=useMemo(()=>Qa(),[y]),{datasets:N,seriesMetadata:w,seriesTypes:M}=useMemo(()=>{let j=Children.toArray(e).filter(ce=>isValidElement(ce)&&sb(ce)),ae=j.filter(ce=>ce.props.data).length,_=[],X=[],U=[];return j.forEach((ce,se)=>{let $=ce.props;if(!$.data)return;_.push($.data);let _e=("color"in $&&$.color?$.color:void 0)||(ae===1?S:v[se%v.length]),Ir=ce.type===Go;X.push({label:"label"in $&&$.label||`Series ${_.length}`,color:_e,...Ir&&"baseline"in $&&$.baseline!==void 0?{baseline:$.baseline,tooltipRange:"tooltipRange"in $&&$.tooltipRange||false}:{}}),U.push(Ir?"area":"line");}),{datasets:_,seriesMetadata:X,seriesTypes:U}},[e,S,v]),k=l,P=Math.max(100,d-60),I=useMemo(()=>[new Date(t.startMs),new Date(t.endMs)],[t.startMs,t.endMs]),D=useMemo(()=>{let j=N.flat(),ae=j.filter(_=>{let X=_.xValue.getTime();return X>=t.startMs&&X<=t.endMs});return ae.length>0?ae:j},[N,t.startMs,t.endMs]),L=useMemo(()=>{let j=ui(D,P,a,i);if(!i){let[ae,_]=j.domain();_>ae&&j.domain([ae,_+(_-ae)*.05]);}return j},[D,P,a,i]),R=useRef(JSON.stringify(a)),B=useRef(null),Y=useMemo(()=>{let[j,ae]=L.domain(),_=Math.max(Math.abs(j),Math.abs(ae)),X=JSON.stringify(a);if(X!==R.current&&(R.current=X,B.current=null),B.current!==null)return B.current;if(_===0)return va(a,0);let U=va(a,_);return B.current=U,U},[L,a]),H=useMemo(()=>{let j=P-Ae.top-Ae.bottom;return Sa(j)},[P]),W=useMemo(()=>{let j=Or(Y),ae=j.tickFormat||j.format,X=L.ticks(H).map(se=>ae(se)),U=Ca(X,12,"system-ui"),ce=Math.ceil(U)+12;return {...Ae,left:Math.max(ce,30)}},[L,Y,H]),Z=useMemo(()=>scaleTime({domain:I,range:[W.left,k-W.right]}),[I,k,W]),q=useMemo(()=>[t.startMs,t.endMs],[t.startMs,t.endMs]),Q=useMemo(()=>r?[r.startMs,r.endMs]:void 0,[r]),T=useCallback(j=>{o({startMs:j[0],endMs:j[1]});},[o]),E=k-W.left-W.right,O=useCallback(()=>m(null),[]),A=useRef({}),C=useRef(c);C.current=c;let F=useCallback(j=>{b.current?.setPreview(j),h.current?.setPreview(j),C.current?.publish(A.current,j);},[]),{onPointerDown:z,onPointerMove:G,onPointerUp:oe,onPointerCancel:ue,wheelTargetRef:te,gestureActiveRef:le}=rb({xDomain:q,plotWidthPx:E,plotLeftPx:W.left,groupRef:x,onCommit:T,onGestureStart:O,onFramePreview:F,...Q?{panBoundsMs:Q}:{}}),me=useRef({startMs:t.startMs,endMs:t.endMs,left:0,width:0});me.current={startMs:t.startMs,endMs:t.endMs,left:W.left,width:E},useEffect(()=>{if(!c)return;let j=()=>{x.current?.removeAttribute("transform"),b.current?.setPreview(null),h.current?.setPreview(null);},ae=X=>{if(le.current)return;if(X==null){j();return}let{startMs:U,endMs:ce,left:se,width:$}=me.current,Se=ce-U,_e=X[1]-X[0];if(Se<=0||_e<=0||$<=0)return;let Ir=Se/_e,po=se*(1-Ir)+(U-X[0])*$/_e;x.current?.setAttribute("transform",`translate(${po},0) scale(${Ir},1)`),b.current?.setPreview(X),h.current?.setPreview(X);},_=c.subscribe(A.current,ae);return ()=>{_(),le.current||j();}},[c,le]),useEffect(()=>{n?.(Math.max(0,k-W.left-W.right));},[k,W,n]);let re=useCallback(j=>{if(le.current)return;let{left:ae}=p.current?.getBoundingClientRect()||{left:0},_=j.clientX-ae;j.timeStamp-(g.current||0)<16||(g.current=j.timeStamp,m(jg({mouseX:_,datasets:N,seriesMetadata:w,seriesTypes:M,xScale:Z,yScale:L,plotLeft:W.left,plotRight:k-W.right})));},[N,w,M,Z,L,k,W,le]),ie=useCallback(()=>m(null),[]),fe={width:k,height:P,xScale:Z,yScale:L,yFormatter:Y,animationSettings:Bs,tooltip:{data:u,show:m,hide:()=>m(null)},datasets:N,seriesMetadata:w,seriesTypes:M},xe=0,Be=[];Children.toArray(e).forEach(j=>{if(!isValidElement(j)){Be.push(j);return}if(sb(j)){let ae=xe;xe++;let _=j.props;Be.push(Oe__default.cloneElement(j,{..._,color:w[ae]?.color,animate:false}));}else Be.push(j);});let Ze=w.map(j=>({category:j.label,fill:j.color})),Kt=Us({datasets:N,metadata:{xLabel:"Date",yLabel:"Value",seriesLabels:w.map(j=>j.label),timestamp:true},svgRef:p}),ir=jsxs(Fragment,{children:[jsx("title",{children:"Data chart visualization"}),jsx("g",{children:L.ticks(H).map(j=>{let ae=Math.abs(j)<Number.EPSILON;return jsx(Line,{from:{x:W.left,y:L(j)},to:{x:k-W.right,y:L(j)},stroke:ae?"var(--color-border-default)":"var(--color-border-muted)",strokeWidth:ae?1.5:1},`grid-line-${j}`)})}),jsx(uu,{ref:h,scale:Z,width:k-W.left-W.right,top:L.range()[1],bottom:L.range()[0]}),jsx("defs",{children:jsx("clipPath",{id:f,children:jsx("rect",{x:Z.range()[0],y:L.range()[1],width:Z.range()[1]-Z.range()[0],height:L.range()[0]-L.range()[1]})})}),jsx("g",{clipPath:`url(#${f})`,children:jsx("g",{"data-camera-plot-group":"",ref:x,children:Be})}),s&&s.length>0&&jsx("g",{children:s.map(j=>{let ae=L(j.value),_=j.color??"var(--color-error-base)";return jsxs("g",{children:[jsx(Line,{from:{x:W.left,y:ae},to:{x:k-W.right,y:ae},stroke:_,strokeWidth:1.5,strokeDasharray:"6 4"}),j.label&&jsx("text",{x:k-W.right-4,y:ae-4,textAnchor:"end",fontSize:11,fill:_,children:j.label})]},`ref-line-${j.value}`)})}),jsx(du,{ref:b,top:P-W.bottom,scale:Z,width:k-W.left-W.right}),jsx(Tr.Left,{left:W.left,scale:L,yFormatter:Y,height:P-W.top-W.bottom}),u&&!u.isEvent&&jsx(Fragment,{children:u.series.filter(j=>j.type!=="bar"&&j.showMarker!==false).map(j=>jsxs("g",{children:[jsx("circle",{cx:Z(u.xValue),cy:L(j.chartY??j.value),r:8,fill:"white",stroke:j.color,strokeWidth:2,style:{transition:"all 100ms ease-out"}}),jsx("circle",{cx:Z(u.xValue),cy:L(j.chartY??j.value),r:4,fill:j.color,style:{transition:"all 100ms ease-out"}})]},`highlight-${j.label}`))}),jsx("rect",{"data-camera-surface":"",x:W.left,y:W.top,width:k-W.left-W.right,height:P-W.top-W.bottom,fill:"transparent",style:{cursor:"grab",touchAction:"none"},onMouseMove:re,onMouseLeave:ie,onPointerDown:z,onPointerMove:G,onPointerUp:oe,onPointerCancel:ue,ref:te})]});return jsx("div",{className:"relative flex h-full flex-col",children:jsxs(kr.Provider,{value:fe,children:[jsx("svg",{width:k,height:P,className:"overflow-visible",ref:p,role:"img","aria-label":"Data chart",children:ir}),jsx(Uo,{data:u,formatter:Y}),jsx(Na,{onExport:Kt,items:Ze,marginLeft:0,marginRight:W.right})]})})},Qs=withParentSize(bT);function mu(e,t,r,o){if(r.length===0)throw new Error("tierForViewport: resolution ladder is empty");let n=[...r].sort((s,c)=>s.bucketMs-c.bucketMs),a=e/Math.max(1,t*o.targetPointsPerPx),i=Math.max(o.nativeMs,a);return n.find(s=>s.bucketMs>=i)??n[n.length-1]}function xT(e,t){return Math.floor(e/t.tileSpanMs)}function Ko(e,t,r){let o=xT(e.startMs,t)-r,n=Math.ceil(e.endMs/t.tileSpanMs)-1+r,a=[];for(let i=o;i<=n;i++)a.push({tierId:t.id,index:i,startMs:i*t.tileSpanMs,endMs:(i+1)*t.tileSpanMs});return a}var tr=(e,t)=>`${e}:${t}`;var cb={erroredTiles:0};function fu(e,t){let r=new Map,o=new Map,n=new Map,a=0;for(let d of e){let u=t.get(tr(d.tierId,d.index));if(u){if(u.status==="error"){a+=1;continue}if(u.data){for(let m of u.data.line)r.set(m.xValue.getTime(),m);for(let m of u.data.band??[])o.set(m.xValue.getTime(),m);for(let[m,p]of Object.entries(u.data.lines??{})){let g=n.get(m);g||(g=new Map,n.set(m,g));for(let f of p)g.set(f.xValue.getTime(),f);}}}}let i=(d,u)=>d.xValue.getTime()-u.xValue.getTime(),s=[...r.values()].sort(i),c=[...o.values()].sort(i),l=Object.fromEntries([...n.entries()].map(([d,u])=>[d,[...u.values()].sort(i)]));return {line:s,band:c,lines:l,coverage:{earliestMs:s.length?s[0].xValue.getTime():void 0,latestMs:s.length?s[s.length-1].xValue.getTime():void 0,erroredTiles:a}}}function hT(e,t,r){let o=Ko(e,t,0);return o.length===0?false:o.every(n=>{let a=r.get(tr(n.tierId,n.index));return a!=null&&(a.status==="loaded"||a.status==="empty")})}function db(e,t,r){return Ko(e,t,0).some(n=>{let a=r.get(tr(n.tierId,n.index));return a?.status==="loaded"&&(a.data?.line.length??0)>0})}function yT(e,t){if(!e.line.length)return false;let r=e.coverage.earliestMs,o=e.coverage.latestMs;return r==null||o==null?false:r<t.endMs&&o>t.startMs}function ub({viewport:e,targetTier:t,ladder:r,store:o,overscanTiles:n,prev:a}){let i=hT(e,t,o);if(i&&db(e,t,o)){let c=Ko(e,t,n),{line:l,band:d,lines:u,coverage:m}=fu(c,o);return {line:l,band:d,lines:u,renderTier:t,targetTier:t,isFallback:false,isStale:false,coverage:m}}let s=r.findIndex(c=>c.id===t.id);for(let c=s+1;c<r.length;c++){let l=r[c];if(db(e,l,o)){let d=Ko(e,l,n),{line:u,band:m,lines:p,coverage:g}=fu(d,o);return {line:u,band:m,lines:p,renderTier:l,targetTier:t,isFallback:true,isStale:false,coverage:g}}}if(i){let c=Ko(e,t,n),{line:l,band:d,lines:u,coverage:m}=fu(c,o);return {line:l,band:d,lines:u,renderTier:t,targetTier:t,isFallback:false,isStale:false,coverage:m}}return a?yT(a,e)?{...a,targetTier:t,isFallback:true,isStale:false}:{line:a.line,band:a.band,lines:a.lines,renderTier:null,targetTier:t,isFallback:true,isStale:true,coverage:cb}:{line:[],band:[],lines:{},renderTier:null,targetTier:t,isFallback:false,isStale:false,coverage:cb}}var pb=new Map;function mb(e,t){switch(t.type){case "reset":return new Map;case "request":{let r=new Map(e);for(let o of t.ids){let n=r.get(o);(!n||n.status==="error")&&r.set(o,{status:"loading"});}return r}case "fulfilled":{let r=new Map(e);return r.set(t.id,{status:t.data.line.length>0?"loaded":"empty",data:t.data}),r}case "failed":{let r=new Map(e);return r.set(t.id,{status:"error",error:t.error}),r}default:return e}}function gb({refs:e,refsKey:t,store:r,tier:o,viewport:n,fetchTile:a,dispatch:i,concurrency:s,maxFutureMs:c}){let l=useRef(e);l.current=e;let d=useRef(n);d.current=n;let u=useRef(new Map),m=useCallback(()=>{for(let p of u.current.values())p.ac.abort();u.current.clear();},[]);return useEffect(()=>{for(let[b,h]of u.current)h.tierId!==o.id&&(h.ac.abort(),u.current.delete(b));let p=l.current.filter(b=>{let h=tr(b.tierId,b.index),y=r.get(h);return y?y.status==="loading"&&!u.current.has(h):true}),g=(d.current.startMs+d.current.endMs)/2;p.sort((b,h)=>Math.abs((b.startMs+b.endMs)/2-g)-Math.abs((h.startMs+h.endMs)/2-g));let f=Math.max(0,s-u.current.size),x=p.slice(0,f);if(x.length!==0){i({type:"request",ids:x.map(b=>tr(b.tierId,b.index))});for(let b of x){let h=tr(b.tierId,b.index),y=new AbortController;u.current.set(h,{ac:y,tierId:b.tierId});let v=c!=null?Math.min(b.endMs,c):b.endMs;a(o,b.startMs,v,y.signal).then(S=>{y.signal.aborted||i({type:"fulfilled",id:h,data:S});}).catch(S=>{if(!y.signal.aborted){let N=S instanceof Error?S.message:String(S);i({type:"failed",id:h,error:new Error(`tile fetch failed (tile ${h}, tier ${o.id}): ${N}`)});}}).finally(()=>{u.current.delete(h);});}}},[t,r,a,o,i,s,c]),useEffect(()=>m,[m]),{abortAll:m}}var hb=1.3,ST=25e4,wT=3;function NT(e,t,r){let o=t.tileSpanMs/t.bucketMs,n=Math.max(1,Math.floor(ST/o/r));return Math.min(Math.max(1,Math.ceil(.5*e/t.tileSpanMs)),n)}function vb(e){let{fetchTile:t,ladder:r,nativeMs:o,viewport:n,widthPx:a,maxFutureMs:i,targetPointsPerPx:s=1,concurrency:c=3,tileCostSeriesCount:l=wT,resetKey:d}=e,u=useMemo(()=>({targetPointsPerPx:s,nativeMs:o}),[s,o]),[m,p]=useState(()=>mu(n.endMs-n.startMs,Math.max(1,a),r,u)),[g,f]=useReducer(mb,pb),x=useRef(n.endMs-n.startMs);useEffect(()=>{let B=n.endMs-n.startMs,Y=mu(B,Math.max(1,a),r,u);if(Y.id===m.id)return;let H=B/x.current;(H>hb||H<1/hb)&&(x.current=B,p(Y));},[n,a,r,m.id,u]);let b=n.endMs-n.startMs,h=useMemo(()=>NT(b,m,l),[b,m,l]),y=useMemo(()=>Ko(n,m,h),[n,m,h]),v=useMemo(()=>y.map(B=>tr(B.tierId,B.index)).join(","),[y]),S=useRef(y);S.current=y;let N=useRef(n);N.current=n;let w=useRef(g);w.current=g;let{abortAll:M}=gb({refs:y,refsKey:v,store:g,tier:m,viewport:n,fetchTile:t,dispatch:f,concurrency:c,...i!=null?{maxFutureMs:i}:{}}),k=useRef(null),P=useRef(false);useEffect(()=>{if(!P.current){P.current=true;return}M(),k.current=null,f({type:"reset"});},[M,d]);let I=useMemo(()=>S.current.map(B=>`${tr(B.tierId,B.index)}:${g.get(tr(B.tierId,B.index))?.status??"\u2205"}`).join("|"),[v,g]),D=useMemo(()=>{let B=ub({viewport:N.current,targetTier:m,ladder:r,store:w.current,overscanTiles:h,prev:k.current});return k.current=B,B},[I,m,r,h,n.startMs,n.endMs]),L=useMemo(()=>S.current.some(B=>w.current.get(tr(B.tierId,B.index))?.status==="loading"),[I]),R=useMemo(()=>{let B=S.current[0];return B?w.current.get(tr(B.tierId,B.index))?.status==="empty":false},[I]);return {tier:m,series:D,loading:L,atDataStart:R}}function bu(e){let{initialViewport:t,...r}=e,[o,n]=useState(t),a=vb({...r,viewport:o}),i=useCallback(c=>n(c),[]),s=useCallback(c=>n(c),[]);return {viewport:o,onViewportChange:i,jumpTo:s,...a}}var kT={sm:"gap-4 px-6 py-8",md:"gap-5 px-8 py-12",lg:"gap-6 px-10 py-16"},TT={sm:"xs",md:"sm",lg:"md"},PT={sm:pt("bodySm"),md:pt("bodySm"),lg:pt("bodyMd")},RT={sm:"h-10 w-10",md:"h-12 w-12",lg:"h-16 w-16"},MT={sm:20,md:24,lg:32},DT={center:"items-center text-center [&_.empty-state-actions]:justify-center [&_.empty-state-actions]:text-center",start:"items-start text-left [&_.empty-state-actions]:justify-start [&_.empty-state-actions]:text-left"},LT={mesh:"radial-gradient(at 20% 20%, rgba(68, 74, 225, 0.06) 0px, transparent 45%), radial-gradient(at 80% 80%, rgba(68, 74, 225, 0.045) 0px, transparent 45%), radial-gradient(at 50% 50%, rgba(68, 74, 225, 0.03) 0px, transparent 50%)","top-fade":"linear-gradient(to bottom, rgba(68, 74, 225, 0.06) 0%, rgba(68, 74, 225, 0.02) 60%, transparent 100%)",center:"radial-gradient(ellipse 600px 400px at center, rgba(68, 74, 225, 0.06) 0px, transparent 60%)",corners:"radial-gradient(at 0% 0%, rgba(68, 74, 225, 0.06) 0px, transparent 40%), radial-gradient(at 100% 100%, rgba(68, 74, 225, 0.045) 0px, transparent 40%)",bottom:"radial-gradient(ellipse 700px 300px at 50% 100%, rgba(68, 74, 225, 0.06) 0px, transparent 60%)",asymmetric:"radial-gradient(at 15% 30%, rgba(68, 74, 225, 0.06) 0px, transparent 45%), radial-gradient(at 85% 70%, rgba(68, 74, 225, 0.04) 0px, transparent 50%)"};function Zs({icon:e,title:t,description:r,primaryAction:o,secondaryAction:n,actions:a,size:i="md",alignment:s="center",variant:c="default",spotlightPattern:l="mesh",fullHeight:d=false,className:u}){let m=i==="sm"?"sm":"md",p=c==="spotlight",g=p?{background:LT[l]}:void 0,f=()=>a?jsx("div",{className:"empty-state-actions mt-2 flex flex-wrap items-center gap-3",children:a}):o||n?jsxs("div",{className:"empty-state-actions mt-2 flex flex-col gap-3",children:[o&&(o.href?jsx(ee,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,href:o.href,children:o.label}):jsx(ee,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,children:o.label})),n&&jsx(Qe,{href:n.href||"#",variant:"muted",onPress:n.onPress,className:pt("labelMd"),children:n.label})]}):null;return jsxs("section",{"data-testid":"empty-state",role:"status","aria-live":"polite",className:twMerge("flex w-full flex-col rounded-xl text-text-primary",kT[i],DT[s],d?"h-full justify-center":"",p?"relative overflow-hidden":"",u),style:g,children:[e&&jsx("div",{className:twMerge("flex items-center justify-center rounded-full border border-border-muted bg-background-muted text-text-secondary",RT[i]),children:jsx(V,{name:e,size:MT[i]})}),jsx(qt,{size:TT[i],tag:"h2",className:"text-text-secondary",children:t}),r&&jsx("p",{className:twMerge("max-w-xs text-text-secondary whitespace-pre-line",PT[i]),children:r}),f()]})}function VT({selectionState:e,isDisabled:t}){let r=`${Ye} w-full h-full flex items-center justify-center rounded-sm forced-color-adjust-none font-semibold`,o={none:"text-text-primary group-hover:bg-background-muted group-pressed:bg-background-muted",middle:["bg-background-selected group-hover:bg-background-muted forced-colors:group-hover:bg-[Highlight]","group-invalid:group-hover:bg-feedback-error-background forced-colors:group-invalid:group-hover:bg-[Mark]","group-pressed:bg-background-muted forced-colors:group-pressed:bg-[Highlight] forced-colors:text-[HighlightText]","group-invalid:group-pressed:bg-feedback-error-background forced-colors:group-invalid:group-pressed:bg-[Mark]"].join(" "),cap:"bg-action-default text-[color:var(--color-action-default-text)] group-invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:group-invalid:bg-[Mark] forced-colors:text-[HighlightText]"},n=t?"text-text-disabled forced-colors:text-text-disabled font-light":"";return [r,o[e],n].filter(Boolean).join(" ")}function Ra({errorMessage:e,...t}){return jsxs(RangeCalendar,{...t,children:[jsx(Ls,{}),jsxs(CalendarGrid,{className:"w-full border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Es,{}),jsx(CalendarGridBody,{children:r=>jsx(CalendarCell,{date:r,className:"selection-start:rounded-s-full selection-end:rounded-e-full [td:last-child_&]:rounded-e-end group h-9 w-9 cursor-default text-sm border-0 outside-month:text-text-disabled invalid:selected:bg-feedback-error-background forced-colors:selected:bg-[Highlight] forced-colors:selected:text-[HighlightText] forced-colors:invalid:selected:bg-[Mark] [td:first-child_&]:rounded-s-full [&]:border-0",children:({formattedDate:o,isSelected:n,isSelectionStart:a,isSelectionEnd:i,isFocusVisible:s,isDisabled:c})=>jsx("span",{className:VT({selectionState:n&&(a||i)?"cap":n?"middle":"none",isDisabled:c}),children:o})})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function wb(e){return e==="brand"?"primary":e==="default"||e==="secondary"||!e?"subtle":e}var OT={sm:"h-[var(--control-sm-height)] text-xs",md:"h-[var(--control-md-height)] text-sm",lg:"h-[var(--control-lg-height)] text-base",xl:"h-[var(--control-xl-height)] text-lg"},HT={sm:14,md:16,lg:18,xl:20},WT=({isSelected:e,isFirst:t,isLast:r,isDisabled:o,variant:n="subtle"})=>{let a=wb(n),i=a==="primary"?"focus-visible:outline-action-primary":"focus-visible:outline-[color:var(--color-action-secondary-text)]";return a==="subtle"?twMerge(Ye(),"focus-visible:outline-[color:var(--color-action-secondary-text)]","px-3 text-center transition cursor-pointer forced-color-adjust-none -ml-px first:ml-0 flex items-center justify-center h-full gap-2",e?"bg-background-muted text-text-primary font-medium forced-colors:!bg-[Highlight] forced-colors:!text-[HighlightText]":"text-text-secondary hover:bg-background-hover pressed:bg-background-hover forced-colors:!bg-[ButtonFace] forced-colors:!text-[ButtonText]",!r&&"border-r border-border-muted",o&&"bg-background-muted text-text-disabled forced-colors:!bg-[ButtonFace] forced-colors:!text-[GrayText] border-border-muted forced-colors:border-[GrayText] cursor-not-allowed"):twMerge(Ye(),i,"px-3 text-center transition cursor-pointer forced-color-adjust-none -ml-px first:ml-0 flex items-center justify-center h-full gap-2",e?"bg-action-primary text-[color:var(--color-action-primary-text)] font-semibold forced-colors:!bg-[Highlight] forced-colors:!text-[HighlightText]":"text-text-secondary hover:bg-background-hover pressed:bg-background-hover forced-colors:!bg-[ButtonFace] forced-colors:!text-[ButtonText] hover:font-semibold",!r&&"border-r border-border-muted",o&&"bg-background-muted text-text-disabled forced-colors:!bg-[ButtonFace] forced-colors:!text-[GrayText] border-border-muted forced-colors:border-[GrayText] cursor-not-allowed")};function $s({options:e,value:t,onChange:r,size:o="md",className:n,isDisabled:a,variant:i="subtle",iconOnly:s=false,"aria-label":c}){return jsx("div",{className:twMerge("inline-flex overflow-hidden rounded-[var(--control-border-radius)]",wb(i)==="subtle"?"border border-border-muted":"border-2 border-border-muted",OT[o],n),role:"group","aria-label":c,children:e.map((l,d)=>{let u=s&&!!l.icon;return jsxs(ToggleButton,{isSelected:t===l.id,onChange:()=>r(l.id),className:WT({isSelected:t===l.id,isFirst:d===0,isLast:d===e.length-1,isDisabled:a,variant:i}),isDisabled:a,"aria-label":l.label,children:[l.icon&&jsx(V,{name:l.icon,size:HT[o]}),u?jsx("span",{className:"sr-only",children:l.label}):jsx("span",{className:"inline-flex flex-col items-center after:content-[attr(data-label)] after:font-semibold after:h-0 after:overflow-hidden after:invisible","data-label":l.label,children:l.label})]},l.id)})})}function JT(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function vu(e){return JT(e)?e:(console.warn("Invalid date detected in TimeControls, using fallback:",e),new Date)}var Rb={FIVE_MINUTES:0,FIFTEEN_MINUTES:1,HOUR:2,DAY:3,WEEK:4,MONTH:5,YEAR:6},XT=[{id:"FIFTEEN_MINUTES",label:"15m"},{id:"HOUR",label:"1h"},{id:"DAY",label:"1d"},{id:"WEEK",label:"1w"}];function el({dateRange:e,onDateRangeChange:t,windowSize:r,onWindowSizeChange:o,showWindowSize:n=true,showRangeSelector:a=true,allowDatePicker:i=false,lockWindowSize:s=false,restrictToSingleDay:c=false,presetRanges:l=[],windowSizeOptions:d=XT,autoAdjustWindowSize:u=false,className:m}){let[p,g]=useState(0),f=useRef(null),[x,b]=useState(false),h=T=>{let O=(T.before.getTime()-T.after.getTime())/(1e3*60*60);return O<=24?"FIFTEEN_MINUTES":O<=72||O<=168?"HOUR":("DAY")};useEffect(()=>{if(u&&!x&&o){let T=h(e);o(T);}},[e,u,x,o]);let y=T=>l.find(E=>{let O=E.getRange();return Math.abs(O.after.getTime()-T.after.getTime())<1e3*60*60*24&&Math.abs(O.before.getTime()-T.before.getTime())<1e3*60*60*24})?.id,[v,S]=useState(()=>y(e)),N=vu(e.after),w=vu(e.before),M=new Date(w);M.setDate(M.getDate()-1);let k={start:fromDate(N,getLocalTimeZone()),end:fromDate(M,getLocalTimeZone())};useEffect(()=>{let T=new ResizeObserver(E=>{for(let O of E)g(O.contentRect.width);});return f.current&&T.observe(f.current),()=>{f.current&&T.unobserve(f.current);}},[]);let P=[...d].sort((T,E)=>Rb[T.id]-Rb[E.id]),I=T=>{let E=T.toString(),O=l.find(A=>A.id===E);O&&(S(E),b(false),t(O.getRange(),{presetId:E}));},D=T=>{if(T?.start&&T?.end){S(void 0);let E=new Date(T.start.year,T.start.month-1,T.start.day,0,0,0,0),O=new Date(T.end.year,T.end.month-1,T.end.day+1,0,0,0,0);t({after:E,before:O});}},L=T=>{if(T){S(void 0);let E=new Date(T.year,T.month-1,T.day,0,0,0,0),O=new Date(T.year,T.month-1,T.day+1,0,0,0,0);t({after:E,before:O});}},R=T=>{o&&(b(true),o(T.toString()));},B=()=>{if(l.length>0){let T=l[0];S(T.id),b(false),t(T.getRange(),{presetId:T.id});}},Y=(T,E=0)=>{let O=vu(T),A=new Date(O);return E!==0&&A.setDate(A.getDate()+E),A.toLocaleDateString("en-US")},H=P.map(T=>({id:T.id,label:T.label,value:T.id})),W=l.map(T=>({id:T.id,label:T.label,value:T.id})),Z=s?jsx("div",{className:"flex items-center rounded-md border border-border-muted bg-background-muted px-3 py-2 text-sm text-text-secondary",children:P.find(T=>T.id===r)?.label||r}):jsx(gn,{className:"w-full md:w-auto",selectedKey:r,onSelectionChange:R,items:H,size:"md","aria-label":"Select Window Size",children:T=>jsx(Zt,{id:T.id,"aria-label":T.label,size:"md",children:T.label},T.id)}),q=c?jsx("div",{className:"flex items-center",children:jsxs(DialogTrigger,{children:[jsxs(ee,{className:"border-l pl-2 pr-2 hover:border-border-default hover:bg-background-muted hover:text-text-link-hover",variant:"secondary",children:[jsx(V,{name:"CalendarBlank",size:18}),jsx("span",{className:"ml-2 hidden md:block",children:Y(e.after)})]}),jsx(nt,{className:"w-auto p-3",disableGroup:true,children:jsx(ba,{"aria-label":"Select date",value:parseDate(N.toISOString().split("T")[0]),onChange:L})})]})}):jsxs("div",{className:"flex items-center",children:[jsxs(DialogTrigger,{children:[jsxs(ee,{className:"rounded-r-none border-l pl-2 pr-2 hover:border-border-default hover:bg-background-muted hover:text-text-link-hover",variant:"secondary",children:[jsx(V,{name:"CalendarBlank",size:18}),!v&&jsx("span",{className:"ml-2 hidden md:block",children:`${Y(e.after)} - ${Y(e.before,-1)}`})]}),jsx(nt,{className:"w-auto p-3",disableGroup:true,children:jsx(Ra,{"aria-label":"Date range calendar",value:k,onChange:D})})]}),!v&&jsx(ee,{variant:"ghost",size:"md",onPress:B,children:"Reset"})]}),Q=p<600;return jsx("div",{ref:f,className:twMerge("flex w-full flex-wrap items-center justify-between gap-4",m),children:Q?jsxs("div",{className:"flex w-full justify-between",children:[jsxs("div",{className:"flex items-center",children:[i&&q,a&&v!==void 0&&jsx(gn,{selectedKey:v,onSelectionChange:I,items:W,size:"md","aria-label":"Select Date Range",children:T=>jsx(Zt,{id:T.id,size:"md",children:T.label},T.id)})]}),jsx("div",{className:"flex items-center",children:n&&r&&Z})]}):jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-4",children:[i&&q,a&&v!==void 0&&jsx($s,{options:l.map(T=>({id:T.id,label:T.label})),value:v,onChange:I,size:"sm",variant:"secondary","aria-label":"Select Date Range"})]}),jsx("div",{className:"flex items-center",children:n&&r&&Z})]})})}var _T=1440*60*1e3,$T=6e4,Dn=(e,t)=>({startMs:t-e*_T,endMs:t}),Ma=e=>({after:new Date(e.startMs),before:new Date(e.endMs)});function Mb({source:e,initialRange:t,viewportEnd:r,yFormatter:o,yDomain:n,referenceLines:a,emptyState:i,presetRanges:s,tierToWindow:c,windowSizeOptions:l,height:d=360,hint:u,dataBounds:m,children:p}){let[g,f]=useState(900),x=m?.endMs,[b,h]=useState(()=>x??Date.now());useEffect(()=>{if(x!=null){h(x);return}h(Date.now());let me=setInterval(()=>h(Date.now()),$T);return ()=>clearInterval(me)},[x]);let y=r?.getTime()??x,v=t?.days??30,S=useMemo(()=>Dn(v,y??Date.now()),[v,y]),N=b,w=useMemo(()=>({startMs:m?.startMs??0,endMs:b}),[m?.startMs,b]),M=me=>{let re=Math.min(me.endMs-me.startMs,w.endMs-w.startMs),ie=Math.max(Math.min(me.endMs,w.endMs),w.startMs+re);return {startMs:ie-re,endMs:ie}},[k,P]=useState(null),[I,D]=useState(null),L=k??S,R=bu({fetchTile:e.fetchTile,ladder:e.ladder,nativeMs:e.nativeMs,initialViewport:S,widthPx:g,maxFutureMs:N,tileCostSeriesCount:e.tileCostSeriesCount,resetKey:e.resetKey}),B=useMemo(()=>[{id:"5y",label:"5 years",getRange:()=>Ma(Dn(5*365,y??Date.now()))},{id:"year",label:"Year",getRange:()=>Ma(Dn(365,y??Date.now()))},{id:"month",label:"Month",getRange:()=>Ma(Dn(30,y??Date.now()))},{id:"week",label:"Week",getRange:()=>Ma(Dn(7,y??Date.now()))},{id:"day",label:"24h",getRange:()=>Ma(Dn(1,y??Date.now()))}],[y]),Y=s??B,H=()=>{if(I&&"presetId"in I){let me=Y.find(re=>re.id===I.presetId);if(me){let re=me.getRange();return {startMs:re.after.getTime(),endMs:re.before.getTime()}}}return I&&"range"in I?I.range:Dn(v,y??Date.now())},{line:W,coverage:Z,renderTier:q,targetTier:Q,isFallback:T,isStale:E}=R.series,O=q?q.bucketMs*1.5:0,A=me=>me==null?"\u2014":new Date(me).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),C=(me,re)=>{let ie=re-me<1728e5?{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"short",day:"numeric",year:"numeric"},fe=new Intl.DateTimeFormat("en-US",ie);return `${fe.format(new Date(me))} \u2013 ${fe.format(new Date(re))}`},F=R.viewport.startMs!==L.startMs||R.viewport.endMs!==L.endMs,z=E||R.loading&&Z.earliestMs==null,G=(R.viewport.endMs-R.viewport.startMs)*.03,oe=!z&&Z.earliestMs!=null&&Z.earliestMs>R.viewport.startMs+G,ue=!R.loading&&Z.earliestMs==null&&Z.latestMs==null&&W.length===0&&!E,te=p({series:R.series,gapMs:O}),le=isValidElement(te)&&te.type===Fragment$1?te.props.children:te;return jsxs("div",{className:"flex flex-col gap-3",children:[jsx(el,{dateRange:Ma(R.viewport),onDateRangeChange:(me,re)=>{let ie=M({startMs:me.after.getTime(),endMs:me.before.getTime()});D(re?.presetId?{presetId:re.presetId}:{range:ie}),P(ie),R.jumpTo(ie);},windowSize:c[Q.id],windowSizeOptions:l,lockWindowSize:true,presetRanges:Y}),jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-secondary",children:[jsxs("span",{children:["Window"," ",jsx("span",{className:"font-medium text-text-primary",children:C(R.viewport.startMs,R.viewport.endMs)})]}),jsx("span",{className:"text-text-tertiary",children:"\u2022"}),jsxs("span",{children:["Resolution ",jsx("span",{className:"font-medium text-text-primary",children:q?.id??Q.id}),T&&jsxs("span",{className:"text-text-tertiary",children:[" \xB7 loading ",Q.id]})]}),R.loading&&jsx("span",{className:"text-text-tertiary",children:"loading\u2026"}),oe&&jsxs("span",{className:"text-text-tertiary",children:["showing available history from ",A(Z.earliestMs)]}),!oe&&!z&&R.atDataStart&&jsx("span",{className:"text-text-tertiary",children:"no earlier data loaded"}),F&&jsx(ee,{variant:"ghost",size:"sm",onPress:()=>{let me=M(H());P(me),R.jumpTo(me);},children:"\u27F2 Reset"})]}),jsx("div",{className:"relative overflow-hidden rounded-md border border-border-subtle",style:{height:d},children:ue?jsx(Zs,{title:i.title,description:i.description}):jsxs(Fragment,{children:[jsx(Qs,{viewport:R.viewport,panBounds:w,onViewportChange:R.onViewportChange,onPlotWidthChange:f,...o&&{yFormatter:o},...n&&{yDomain:n},...a&&{referenceLines:a},children:le}),R.loading&&jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-0.5 animate-pulse bg-[var(--color-viz-categorical-1)] opacity-60"})]})}),u&&jsx("p",{className:"text-xs text-text-tertiary",children:u})]})}function vi({count:e,label:t="results",isLoading:r=false,className:o=""}){if(r)return jsx("div",{className:`flex items-center ${o}`,children:jsx(K,{width:80,height:16})});let n=t.endsWith("s")?t.slice(0,-1):t,a=e===1?n:t;return jsxs("div",{className:`text-sm text-text-secondary whitespace-nowrap ${o}`,children:[e.toLocaleString()," ",a]})}var a1=e=>{let t=Ft({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),r=[e.showSearchIcon?"":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return twMerge(t,r,e.className)};function Mr({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,transparent:i,showSearchIcon:s,isClearable:c,onClear:l,type:d,validationResult:u,reserveErrorSpace:m=true,isLoading:p=false,descriptionPlacement:g="below",...f}){let[x,b]=Oe__default.useState(false),{isFocused:h,handleFocus:y,handleBlur:v}=Nr(),S=d==="password",N=Cs(p,300);return jsx(TextField,{...f,isRequired:a,className:ke(f.className,"group flex flex-col"),children:({isDisabled:w,isInvalid:M})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(ze,{size:o,tooltip:n,description:g==="tooltip"||g==="inline"?t:void 0,descriptionPlacement:g,isRequired:a,children:e}),jsxs(bt,{children:[s&&jsx("div",{className:"pointer-events-none absolute top-1/2 -translate-y-1/2 transform flex items-center z-10",style:{left:9},children:(()=>{let k={sm:14,md:16,lg:18,xl:20}[o];return N?jsx(mo,{size:k,color:"text-text-secondary"}):jsx(V,{name:"MagnifyingGlass",size:k,className:`transition-colors ${h?"text-action-brand":"text-text-secondary"}`})})()}),jsx(ws,{size:o,disabled:w,type:S?x?"text":"password":d,name:f.name,autoComplete:f.autoComplete,value:f.value,defaultValue:f.defaultValue,placeholder:f.placeholder,onFocus:k=>y(k,f.onFocus),onBlur:k=>v(k,f.onBlur),onChange:k=>f.onChange?.(k.target.value),style:s?{paddingLeft:{sm:28,md:32,lg:36,xl:37}[o]}:void 0,className:a1({isInvalid:M,isDisabled:w,isFocused:h,size:o,transparent:i,showSearchIcon:s,isClearable:c,hasValue:!!f.value,isPassword:S,className:typeof f.className=="string"?f.className:void 0})}),c&&f.value&&!w&&jsx(ai,{onClick:()=>{l?l():f.onChange&&f.onChange("");},size:o}),S&&!w&&jsx("button",{type:"button",onClick:()=>b(!x),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":x?"Hide password":"Show password",onMouseDown:k=>{k.preventDefault(),k.stopPropagation();},children:jsx(V,{name:x?"EyeSlash":"Eye",size:o==="sm"?16:20,className:"text-text-primary"})})]}),m?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(be,{size:o,children:r}):typeof r=="function"&&u?jsx(be,{size:o,children:r(u)}):t&&g==="below"?jsx(Te,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(be,{size:o,className:"mt-1",children:r}):typeof r=="function"&&u?jsx(be,{size:o,className:"mt-1",children:r(u)}):t&&g==="below"?jsx(Te,{size:o,className:"mt-1",children:t}):null})]})})}function En({value:e,onChange:t,onClear:r,placeholder:o="Search...",size:n="sm",className:a="",isLoading:i=false}){return jsx("div",{className:`flex-1 min-w-0 sm:max-w-sm ${a}`,children:jsx(Mr,{value:e,onChange:t,placeholder:o,showSearchIcon:true,isClearable:!!e&&!!r,onClear:r,size:n,"aria-label":o,reserveErrorSpace:false,isLoading:i})})}function Ci({value:e,options:t,onChange:r,direction:o,onDirectionChange:n,showLabel:a=true,size:i="sm",className:s="",compact:c=false}){let[l,d]=useState(false),u=o!==void 0&&n!==void 0,m=t.find(p=>p.value===e);return c?jsxs("div",{className:`flex items-center gap-2 ${s}`,children:[jsx(ee,{variant:"secondary",size:i,icon:"ArrowsDownUp","aria-label":`Sort by: ${m?.label||"Select"}`,onPress:()=>d(true)}),jsx(at,{isOpen:l,onClose:()=>d(false),title:"Sort by",contentPadding:false,children:jsx(ListBox,{items:t.map(p=>({id:p.value,label:p.label,value:p.value})),className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:e?[e]:[],onSelectionChange:p=>{let g=Array.from(p)[0];g!=null&&(r(g),d(false));},children:p=>jsx(Zt,{id:p.id,textValue:p.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:p.label})},p.id)})})]}):jsxs("div",{className:`flex items-center gap-2 ${s}`,children:[a&&jsx("span",{className:"text-sm text-text-secondary whitespace-nowrap",children:"Sort by:"}),jsx(gn,{selectedKey:e,onSelectionChange:p=>r(p),size:i,className:"min-w-32",items:t.map(p=>({id:p.value,label:p.label,value:p.value})),renderItem:p=>p.label,"aria-label":"Sort by",reserveErrorSpace:false}),u&&jsx(ee,{variant:"ghost",size:i,onClick:()=>n(o==="asc"?"desc":"asc"),"aria-label":`Sort ${o==="asc"?"descending":"ascending"}`,className:"p-1.5",children:o==="asc"?jsx(ArrowUp,{className:"w-4 h-4"}):jsx(ArrowDown,{className:"w-4 h-4"})})]})}function Ib({search:e,searchMobileMode:t="expanded",filters:r=[],onRemoveFilter:o,onClearAllFilters:n,onManageFilters:a,exportControl:i,maxVisibleFilterChips:s=3,sort:c,resultsCount:l,leftControls:d,onManageColumns:u,columnPicker:m,customControls:p,actions:g,interactionMode:f="auto",sticky:x,stickyTop:b="0",zIndex:h=10,className:y="",style:v}){let S=r.length>0;if(!(e||S||a||c||l||d||u||m||p||g||i))return null;let w=x?"sticky bg-background-surface":"",M=x?{top:b,zIndex:h}:{};return jsxs("div",{className:`@container flex flex-col gap-3 bg-background-surface py-3 border-b border-border-default ${w} ${y}`,style:{...v,...M},children:[jsxs("div",{className:"hidden @[640px]:flex @[640px]:items-center @[640px]:justify-between @[640px]:gap-4",children:[jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[d,d&&l&&jsx("div",{className:"h-4 w-px bg-border-default"}),l&&jsx(vi,{count:l.count,label:l.label,isLoading:l.isLoading}),l&&c&&jsx("div",{className:"h-4 w-px bg-border-default"}),c&&jsx(Ci,{value:c.value,options:c.options,onChange:c.onChange,showLabel:c.showLabel,direction:c.direction,onDirectionChange:c.onDirectionChange}),u?jsx(ee,{variant:"secondary",size:"sm",icon:"Columns",onClick:u,children:"Columns"}):m,S&&o&&jsxs(Fragment,{children:[r.slice(0,s).map(k=>jsxs($r,{variant:"primary",size:"sm",onRemove:()=>o(k.id),isRemovable:true,children:[k.label,": ",k.value]},k.id)),r.length>s&&a&&jsxs(ee,{variant:"ghost",size:"sm",onClick:a,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:["+",r.length-s," more"]}),n&&jsx(ee,{variant:"ghost",size:"sm",onClick:n,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:"Clear all"})]})]}),jsx("div",{className:"flex items-center gap-3 flex-shrink-0",children:p||jsxs(Fragment,{children:[g&&g.items.length>0&&jsx(Fragment,{children:g.items.map(k=>jsx(ee,{variant:k.variant||"secondary",size:"sm",icon:k.icon,onPress:k.onClick,isDisabled:k.disabled,children:k.label},k.id))}),e&&jsx("div",{className:"w-64",children:jsx(En,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsx(ee,{variant:"secondary",size:"sm",icon:"Sliders",badgeNumber:r.length>0?r.length:void 0,onClick:a,children:"Filters"}),i&&jsx(ee,{variant:"secondary",size:"sm",icon:"Upload",onClick:i.onClick,isDisabled:i.isDisabled,children:i.label})]})})]}),jsxs("div",{className:"@[640px]:hidden",children:[jsx("div",{className:"flex flex-col gap-3 mb-3",children:jsx("div",{className:"flex items-center gap-3",children:p?jsx("div",{className:"flex-1",children:p}):jsxs(Fragment,{children:[g&&g.items.length>0&&jsx(ma,{items:g.items.map(k=>({id:k.id,name:k.label,iconName:k.icon,variant:k.variant==="destructive"?"destructive":"primary",disabled:k.disabled,onAction:k.onClick})),align:"left",size:"sm",children:jsx(ee,{variant:"secondary",size:"sm",icon:"DotsThreeVertical","aria-label":g.menuLabel||"Actions"})}),e&&jsx("div",{className:"flex-1",children:jsx(En,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsx(ee,{variant:"secondary",size:"sm",icon:"Sliders",badgeNumber:r.length>0?r.length:void 0,onClick:a,"aria-label":`Filters${r.length>0?` (${r.length} active)`:""}`}),i&&jsx(ee,{variant:"secondary",size:"sm",icon:"Upload",onClick:i.onClick,isDisabled:i.isDisabled,children:i.label})]})})}),jsxs("div",{className:"flex items-center justify-between gap-3",children:[jsxs("div",{className:"flex items-center gap-3",children:[d,l&&jsx(vi,{count:l.count,label:l.label,isLoading:l.isLoading})]}),jsx("div",{className:"flex items-center gap-2",children:c&&jsx(Ci,{value:c.value,options:c.options,onChange:c.onChange,showLabel:false,direction:c.direction,onDirectionChange:c.onDirectionChange,compact:f!=="desktop"})})]})]})]})}function Fb({filters:e,onRemove:t,onClearAll:r,onManageFilters:o,maxVisibleChips:n=3,mode:a="chips",showManageButton:i=true,size:s="sm",className:c=""}){let l=e.length>0,d=e.slice(0,n),u=Math.max(0,e.length-n),m=u>0,p=a==="button"&&!!o,g=a==="chips"&&i&&!!o;if(!l&&!p&&!g)return null;let f=p&&jsxs(ee,{variant:"secondary",size:s,onClick:o,className:"whitespace-nowrap",children:[e.length," ",e.length===1?"filter":"filters"]}),x=jsxs(Fragment,{children:[g&&jsx(ee,{variant:"secondary",size:s,icon:"Sliders",onClick:o,className:"whitespace-nowrap",children:"Filters"}),l&&d.map(h=>jsxs($r,{variant:"secondary",size:s,onRemove:()=>t(h.id),isRemovable:true,children:[h.label,": ",h.value]},h.id)),l&&m&&o&&jsxs(ee,{variant:"ghost",size:s,onClick:o,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:["+",u," more"]}),l&&r&&jsx(ee,{variant:"ghost",size:s,onClick:r,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:"Clear all"})]}),b=a==="button"?f:x;return jsx("div",{className:`flex flex-wrap items-center gap-2 ${c}`,children:b})}function p1(e,t,r){return {field:e,operator:t,value:r}}function m1(e,t="AND"){return {logic:t,conditions:e}}function Si(){return {logic:"AND",conditions:[]}}function nl(e){return !e||e.conditions.length===0?true:e.conditions.every(t=>"conditions"in t?nl(t):false)}function f1(e,t){if(!e)return [];let r=new Map(t?.map(i=>[i.field,i])),o=new Map;function n(i){if("conditions"in i)i.conditions.forEach(s=>n(s));else {let s=o.get(i.field)||[];s.push(i),o.set(i.field,s);}}e.conditions.forEach(i=>n(i));let a=[];for(let[i,s]of o.entries()){let c=r.get(i),l=c?.label||i,d=[],u=[],m=[];for(let p of s)p.operator==="in"&&Array.isArray(p.value)?d.push(...p.value):p.operator==="eq"?typeof p.value!="boolean"&&!Array.isArray(p.value)?d.push(p.value):m.push(p):["gte","gt","lte","lt"].includes(p.operator)?u.push({operator:p.operator,value:typeof p.value=="boolean"||Array.isArray(p.value)?String(p.value):p.value}):m.push(p);if(d.length>0){let g=Array.from(new Set(d)).map(f=>c?.values?.find(b=>String(b.value)===String(f))?.label??f);a.push({id:`${i}-in`,label:l,value:g.join(", ")});}if(u.length>0){let p=u.find(f=>f.operator==="gte"||f.operator==="gt"),g=u.find(f=>f.operator==="lte"||f.operator==="lt");if(p&&g){let f=p.operator==="gte"?"\u2265":">",x=g.operator==="lte"?"\u2264":"<";a.push({id:`${i}-range`,label:l,value:`${f} ${p.value} and ${x} ${g.value}`});}else for(let f of u){let x;f.operator==="gte"?x="\u2265":f.operator==="gt"?x=">":f.operator==="lte"?x="\u2264":x="<",a.push({id:`${i}-${f.operator}`,label:l,value:`${x} ${f.value}`});}}for(let p of m){let g;p.operator==="neq"?g=`\u2260 ${p.value}`:p.operator==="contains"?g=`contains "${p.value}"`:p.operator==="startsWith"?g=`starts with "${p.value}"`:p.operator==="endsWith"?g=`ends with "${p.value}"`:g=String(p.value),a.push({id:`${i}-${p.operator}`,label:l,value:g});}}return a}function Xo(e,t){let r=e||Si();return {...r,conditions:[...r.conditions,t]}}function An(e,t){if(!e)return Si();let r=e.conditions.filter(o=>"conditions"in o?An(o,t).conditions.length>0:o.field!==t);return {...e,conditions:r}}function In(e){if(!e)return [];let t=new Set;function r(o){"conditions"in o?o.conditions.forEach(r):t.add(o.field);}return e.conditions.forEach(r),Array.from(t)}function Vb({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,showCalendar:c=true,reserveErrorSpace:l=true,validationResult:d,className:u,...m}){let[p,g]=useState(false),f=x=>{m.onChange&&x&&m.onChange(x),g(false);};return jsxs(DateField,{...m,isDisabled:i,isRequired:a,isInvalid:s,className:ke(u,"flex flex-col gap-1"),children:[e&&jsx(ze,{size:o,tooltip:n,isRequired:a,children:e}),jsx(bt,{children:jsxs("div",{className:"relative w-full",children:[jsx(wi,{size:o,isDisabled:i,isInvalid:s,hasCalendar:c}),c&&!i&&jsxs(DialogTrigger,{isOpen:p,onOpenChange:g,children:[jsx(ee,{variant:"unstyled",className:"absolute right-2 top-1/2 -translate-y-1/2 flex h-8 w-8 items-center justify-center rounded hover:bg-background-hover text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open calendar",children:jsx(V,{name:"Calendar",size:18})}),jsx(Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsx(Dialog,{className:"p-4 outline-none",children:jsx(ba,{value:m.value,onChange:f,minValue:m.minValue,maxValue:m.maxValue,isDisabled:i,isReadOnly:m.isReadOnly,isDateUnavailable:m.isDateUnavailable})})})]})]})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(be,{size:o,children:r}):typeof r=="function"&&d?jsx(be,{size:o,children:r(d)}):t?jsx(Te,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(be,{size:o,className:"mt-1",children:r}):typeof r=="function"&&d?jsx(be,{size:o,className:"mt-1",children:r(d)}):t?jsx(Te,{size:o,className:"mt-1",children:t}):null})]})}function S1({isPlaceholder:e,isDisabled:t,size:r="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[r],e?"text-text-disabled italic":"text-text-primary",t?"text-text-disabled cursor-not-allowed":"cursor-text",!t&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function wi({size:e="md",isDisabled:t,isInvalid:r,hasCalendar:o,className:n,...a}){return jsx(DateInput,{className:twMerge(Io({isInvalid:r,isDisabled:t}),"px-3 py-2 flex items-center gap-0.5 w-full",o&&"pr-10",n),...a,children:i=>jsx(DateSegment,{segment:i,className:S1({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||t,size:e})})})}function al({label:e,description:t,errorMessage:r,...o}){return jsxs(DateRangePicker,{...o,className:ke(o.className,"group flex flex-col gap-1"),children:[e&&jsx(ze,{children:e}),jsxs(Cf,{className:"w-auto min-w-[208px]",children:[jsx(wi,{slot:"start",className:"px-2 py-1.5 text-sm"}),jsx("span",{"aria-hidden":"true",className:"text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] group-disabled:forced-colors:text-[GrayText]",children:"\u2013"}),jsx(wi,{slot:"end",className:"flex-1 px-2 py-1.5 text-sm"}),jsx(ee,{variant:"icon",className:"mr-1 w-6 rounded outline-offset-0",children:jsx(CalendarIcon,{"aria-hidden":true,className:"h-4 w-4"})})]}),t&&jsx(Te,{children:t}),typeof r=="string"?jsx(be,{children:r}):null,jsx(nt,{children:jsx(Ra,{})})]})}var L1=e=>{let t=Ft({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return twMerge(t,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function Ni({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,transparent:i,validationResult:s,reserveErrorSpace:c=true,descriptionPlacement:l="below",...d}){let u=useId(),{isFocused:m,handleFocus:p,handleBlur:g}=Nr();return jsx(NumberField,{...d,id:u,isRequired:a,className:ke(d.className,"group flex flex-col gap-1"),step:d.step??1,onChange:f=>{typeof f=="number"&&(d.maxValue!=null&&f>d.maxValue?d.onChange?.(d.maxValue):d.minValue!=null&&f<d.minValue?d.onChange?.(d.minValue):d.onChange?.(f));},isInvalid:!!r||typeof d.value=="number"&&(d.maxValue!=null&&d.value>d.maxValue||d.minValue!=null&&d.value<d.minValue),children:({isDisabled:f,isInvalid:x})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(ze,{size:o,tooltip:n,description:l==="tooltip"||l==="inline"?t:void 0,descriptionPlacement:l,isRequired:a,htmlFor:u,children:e}),jsx("div",{className:"relative",children:jsxs(Group$1,{className:"relative",children:[jsx(Input,{onFocus:h=>p(h,d.onFocus),onBlur:h=>g(h,d.onBlur),className:L1({isInvalid:x||!!r,isDisabled:f,isFocused:m,transparent:i,size:o,className:typeof d.className=="string"?d.className:void 0})}),jsxs("div",{className:"absolute inset-y-[2px] right-[2px] flex flex-col divide-y divide-border-default border-l border-border-default overflow-hidden rounded-r-[calc(var(--control-border-radius)-2px)]",children:[jsx(Button,{slot:"increment",isDisabled:f,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(V,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:f,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(V,{name:"CaretDown",size:14})})]})]})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:r?jsx(be,{size:o,children:typeof r=="function"?r(s):r}):t&&l==="below"?jsx(Te,{size:o,children:t}):null}):jsx(Fragment,{children:r?jsx(be,{size:o,className:"mt-1",children:typeof r=="function"?r(s):r}):t&&l==="below"?jsx(Te,{size:o,className:"mt-1",children:t}):null})]})})}var Tu={sm:{track:"h-4 w-7",handle:"h-3.5 w-3.5",text:"text-xs"},md:{track:"h-5 w-9",handle:"h-4 w-4",text:"text-sm"},lg:{track:"h-6 w-11",handle:"h-5 w-5",text:"text-base"},xl:{track:"h-7 w-14",handle:"h-6 w-6",text:"text-lg"}};function I1({isSelected:e,isDisabled:t,size:r="md"}){let o="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",n=Tu[r].track,a=Ye,i="focus-visible:outline-action-primary",s="";return e?s="bg-action-primary forced-colors:!bg-[Highlight] group-pressed:bg-action-primary-hover":s="bg-border-input group-pressed:bg-border-focus",[o,n,a,i,s,t?"bg-background-muted forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function F1({isSelected:e,isDisabled:t,size:r="md"}){let o="transform rounded-full bg-background-surface outline-none shadow transition duration-200 ease-in-out",n=Tu[r].handle;return [o,n,e?"translate-x-[100%]":"translate-x-0",t?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function il({children:e,variant:t="primary",size:r="md",...o}){return jsx(Switch,{...o,className:ke(o.className,`group flex items-center gap-2 ${Tu[r].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:n=>jsxs(Fragment,{children:[jsx("div",{className:I1({...n,size:r}),children:jsx("span",{className:F1({...n,size:r})})}),e]})})}function Hb(e){return new Intl.NumberFormat("en-US").format(e)}function Wb({isOpen:e,onClose:t,facetConfigs:r,facetCounts:o={},currentFilters:n,onApply:a,onClear:i,title:s="Filters",resultCount:c}){let[l,d]=useState(n),[u,m]=useState({}),[p,g]=useState({}),[f,x]=useState(null),{isMobile:b}=Jt(),h=useMemo(()=>r.some(C=>C.group),[r]),{groups:y,ungroupedFacets:v,facetsByGroup:S}=useMemo(()=>{let C=new Set,F=[],z={};for(let G of r)G.group?(C.has(G.group)||(C.add(G.group),z[G.group]=[]),z[G.group].push(G)):F.push(G);return {groups:Array.from(C),ungroupedFacets:F,facetsByGroup:z}},[r]);useEffect(()=>{e&&(d(n),m({}),g({}),x(!b&&y.length>0?y[0]:null));},[e,n,y,b]);let N=useMemo(()=>!l||nl(l)?0:In(l).length,[l]),w=()=>{a(l),t();},M=()=>{let C=Si();d(C),i?i():a(C),t();},k=C=>{if(!l)return [];if(!In(l).includes(C))return [];let z=[];function G(oe){if(oe)for(let ue of oe.conditions)"conditions"in ue?G(ue):ue.field===C&&ue.operator==="in"&&Array.isArray(ue.value)&&z.push(...ue.value.map(String));}return G(l),z},P=(C,F,z)=>{let G=An(l,C);F!==void 0&&(G=Xo(G,{field:C,operator:"gte",value:F})),z!==void 0&&(G=Xo(G,{field:C,operator:"lte",value:z})),d(G);},I=C=>{if(!l)return;let F;function z(G){if(G)for(let oe of G.conditions)"conditions"in oe?z(oe):oe.field===C&&oe.operator==="eq"&&typeof oe.value=="boolean"&&(F=oe.value);}return z(l),F},D=(C,F)=>{let z=An(l,C);F!==void 0&&(z=Xo(z,{field:C,operator:"eq",value:F})),d(z);},L=(C,F,z)=>{let G=An(l,C);F&&(G=Xo(G,{field:C,operator:"gte",value:F.toString()})),z&&(G=Xo(G,{field:C,operator:"lte",value:z.toString()})),d(G);},R=C=>{let F=S[C]||[],z=l?In(l):[];return F.filter(G=>z.includes(G.field)).length},B="pr-9 bg-background-muted/50",Y="border-t border-border-muted",H="text-sm font-medium text-text-link-default",W=C=>jsx("span",{className:H,children:C}),Z=C=>{let F=o[C.field]||{},z=u[C.field]||"",G=[];C.values?G=C.values.map(te=>({value:String(te.value),label:te.label,count:F[String(te.value)]})):G=Object.entries(F).map(([te,le])=>({value:te,label:te,count:le}));let oe=G.length;if(z){let te=z.toLowerCase();G=G.filter(le=>le.label.toLowerCase().includes(te));}G.sort((te,le)=>te.count!==void 0&&le.count!==void 0&&le.count!==te.count?le.count-te.count:te.label.localeCompare(le.label));let ue=C.type||"string";if(ue==="string"||!C.type){let te=k(C.field),le=C.searchThreshold??10,me=C.maxVisibleOptions??50,re=p[C.field]??false,ie=re||G.length<=me?G:G.slice(0,me),fe=G.length>me&&!re;return jsxs(zo,{id:C.field,children:[jsx(Oo,{title:C.label,description:C.description,className:B,endContent:te.length>0?W(`${te.length} selected`):void 0}),jsx(Ho,{className:Y,children:jsxs("div",{className:"space-y-4 pt-4 pb-4",children:[oe>le&&jsx(En,{value:z,onChange:xe=>m(Be=>({...Be,[C.field]:xe})),onClear:()=>m(xe=>({...xe,[C.field]:""})),placeholder:`Search ${C.label.toLowerCase()}...`,size:"sm",className:"w-full !max-w-none pr-4"}),jsx(Kd,{value:te,onChange:xe=>{let Be=An(l,C.field);xe.length>0&&(Be=Xo(Be,{field:C.field,operator:"in",value:xe})),d(Be);},children:jsx("div",{className:"space-y-1.5",children:ie.map(xe=>jsx("div",{className:"rounded-md py-2 pr-4 transition-colors hover:bg-background-hover",children:jsx(vn,{value:xe.value,children:jsxs("div",{className:"flex items-center justify-between gap-3 flex-1",children:[C.renderLabel?C.renderLabel(xe.value,xe.label):jsx("span",{className:"text-sm font-medium text-text-primary",children:xe.label}),xe.count!==void 0&&jsx("span",{className:"text-xs font-medium text-text-secondary tabular-nums",children:Hb(xe.count)})]})})},xe.value))})}),fe&&jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxs(ee,{variant:"ghost",size:"sm",onPress:()=>g(xe=>({...xe,[C.field]:true})),className:"w-full",children:["Show all ",G.length," options"]})}),re&&G.length>me&&jsx("div",{className:"pt-2 border-t border-border-muted",children:jsx(ee,{variant:"ghost",size:"sm",onPress:()=>g(xe=>({...xe,[C.field]:false})),className:"w-full",children:"Show less"})})]})})]},C.field)}if(ue==="number"){let te,le,me=ie=>{if(ie)for(let fe of ie.conditions)"conditions"in fe?me(fe):fe.field===C.field&&(fe.operator==="gte"&&typeof fe.value=="number"&&(te=fe.value),fe.operator==="lte"&&typeof fe.value=="number"&&(le=fe.value));};me(l);let re=te!==void 0||le!==void 0;return jsxs(zo,{id:C.field,children:[jsx(Oo,{title:C.label,description:C.description,className:B,endContent:re?W(te!==void 0&&le!==void 0?`${te} - ${le}`:te!==void 0?`\u2265 ${te}`:`\u2264 ${le}`):void 0}),jsx(Ho,{className:Y,children:jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 pb-4",children:[jsx(Ni,{label:"Min",value:te,onChange:ie=>P(C.field,ie,le)},`${C.field}-min`),jsx(Ni,{label:"Max",value:le,onChange:ie=>P(C.field,te,ie)},`${C.field}-max`)]})})]},C.field)}if(ue==="boolean"){let te=I(C.field);return jsxs(zo,{id:C.field,children:[jsx(Oo,{title:C.label,description:C.description,className:B,endContent:te!==void 0?W(te?"Yes":"No"):void 0}),jsx(Ho,{className:Y,children:jsxs("div",{className:"flex items-center justify-between pt-4 pb-4",children:[jsx("span",{className:"text-sm font-medium text-text-primary",children:te!==void 0?te?"Enabled":"Disabled":"No filter applied"}),jsx(il,{size:"lg",isSelected:te??false,onChange:le=>D(C.field,le?true:void 0),children:te?"Yes":"No"})]})})]},C.field)}if(ue==="date"){let te,le,me=Be=>{if(Be)for(let Ze of Be.conditions)"conditions"in Ze?me(Ze):Ze.field===C.field&&(Ze.operator==="gte"&&(te=String(Ze.value)),Ze.operator==="lte"&&(le=String(Ze.value)));};me(l);let re=te!==void 0||le!==void 0,ie=Be=>{if(Be)try{return /^\d{4}-\d{2}-\d{2}$/.test(Be)?parseDate(Be):void 0}catch{return}},fe=ie(te),xe=ie(le);return jsxs(zo,{id:C.field,children:[jsx(Oo,{title:C.label,description:C.description,className:B,endContent:re?W("Date range selected"):void 0}),jsx(Ho,{className:Y,children:jsx("div",{className:"pt-4 pb-4",children:jsx(al,{label:"Date Range",value:fe&&xe?{start:fe,end:xe}:void 0,onChange:Be=>{Be?L(C.field,Be.start,Be.end):L(C.field,void 0,void 0);}})})})]},C.field)}return null},q=()=>jsxs("div",{className:"flex flex-col",children:[v.map(C=>{let z=(l?In(l):[]).includes(C.field);return jsxs("button",{type:"button",onClick:()=>x(`__ungrouped__${C.field}`),className:"flex items-center justify-between px-6 py-3 text-left hover:bg-background-hover border-b border-border-muted transition-colors",children:[jsx("span",{className:"text-sm font-medium text-text-primary",children:C.label}),jsxs("div",{className:"flex items-center gap-2",children:[z&&jsx("span",{className:H,children:"1 active"}),jsx(V,{name:"CaretRight",size:"sm",className:"text-text-secondary"})]})]},C.field)}),y.map(C=>{let F=R(C);return jsxs("button",{type:"button",onClick:()=>x(C),className:"flex items-center justify-between px-6 py-3 text-left hover:bg-background-hover border-b border-border-muted transition-colors",children:[jsx("span",{className:"text-sm font-medium text-text-primary",children:C}),jsxs("div",{className:"flex items-center gap-2",children:[F>0&&jsxs("span",{className:H,children:[F," active"]}),jsx(V,{name:"CaretRight",size:"sm",className:"text-text-secondary"})]})]},C)})]}),Q=C=>{if(C.startsWith("__ungrouped__")){let z=C.replace("__ungrouped__",""),G=v.find(oe=>oe.field===z);return G?jsx(xa,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[G.field],children:Z(G)}):null}let F=S[C]||[];return F.length===0?null:jsx(xa,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[F[0].field],children:F.map(z=>Z(z))})},T=()=>{if(f){let C=f.startsWith("__ungrouped__")&&v.find(F=>F.field===f.replace("__ungrouped__",""))?.label||f;return jsxs("div",{className:"flex flex-col h-full",children:[jsxs("button",{type:"button",onClick:()=>x(null),className:"flex items-center gap-2 px-4 py-3 border-b border-border-muted hover:bg-background-hover transition-colors",children:[jsx(V,{name:"CaretLeft",size:"sm",className:"text-text-secondary"}),jsx("span",{className:"text-sm font-medium text-text-primary",children:C})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:Q(f)})]})}return q()},E=()=>jsxs("div",{className:"flex h-full",children:[jsxs("div",{className:"w-48 flex-shrink-0 border-r border-border-muted overflow-y-auto bg-background-muted/30",children:[v.map(C=>{let z=(l?In(l):[]).includes(C.field),G=f===`__ungrouped__${C.field}`;return jsxs("button",{type:"button",onClick:()=>x(`__ungrouped__${C.field}`),className:`flex items-center justify-between w-full px-4 py-3 text-left border-b border-border-muted transition-colors ${G?"bg-background-selected":"hover:bg-background-hover"}`,children:[jsx("span",{className:`text-sm truncate ${G?"font-semibold text-text-primary":"font-medium text-text-primary"}`,children:C.label}),z&&jsx("span",{className:"w-2 h-2 rounded-full bg-action-primary flex-shrink-0 ml-2"})]},C.field)}),y.map(C=>{let F=R(C),z=f===C;return jsxs("button",{type:"button",onClick:()=>x(C),className:`flex items-center justify-between w-full px-4 py-3 text-left border-b border-border-muted transition-colors ${z?"bg-background-selected":"hover:bg-background-hover"}`,children:[jsx("span",{className:`text-sm truncate ${z?"font-semibold text-text-primary":"font-medium text-text-primary"}`,children:C}),F>0&&jsx("span",{className:"w-2 h-2 rounded-full bg-action-primary flex-shrink-0 ml-2"})]},C)})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:f?Q(f):jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-sm",children:"Select a category to view filters"})})]}),O=()=>jsx(xa,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[r[0].field],children:r.map(C=>Z(C))});return jsx(Sr,{isOpen:e,onClose:t,title:h&&b&&f?f.startsWith("__ungrouped__")?v.find(C=>C.field===f.replace("__ungrouped__",""))?.label||s:f:N>0?`${s} (${N} active)`:s,hideCloseIcon:false,primaryAction:{label:"Apply filters",onPress:w,variant:"primary"},secondaryAction:{label:"Clear all",onPress:M},maxWidth:h?"800px":"700px",height:"600px",mobileHeight:"85vh",contentPadding:false,footerContent:c!==void 0?jsxs("div",{className:"text-sm text-text-secondary text-center",children:[jsx("span",{className:"font-semibold text-text-primary",children:Hb(c)})," ",c===1?"result":"results"," with current filters"]}):void 0,children:r.length===0?jsx("div",{className:"py-12 text-center",children:jsx("div",{className:"text-sm font-medium text-text-secondary",children:"No filters available"})}):h?b?T():E():O()})}function Ru(e="left"){switch(e){case "center":return "justify-center text-center";case "right":return "justify-end text-right";default:return "justify-start text-left"}}function Dr(e="normal",t){return twMerge({strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[e],t&&"hover:text-action-primary cursor-pointer transition-colors")}function Me(e="left",t){return twMerge("flex items-center gap-1 min-w-0 overflow-hidden",Ru(e),t)}function cl(e,t="\u2014"){return e==null||e===""?t:String(e)}var jo={xs:"h-4 w-12",sm:"h-4 w-20",md:"h-4 w-24",lg:"h-4 w-32",xl:"h-4 w-40"};function or(e="normal"){return {strong:jo.lg,high:jo.lg,normal:jo.md,low:jo.sm}[e]}function Ce(e,t){return typeof e=="function"?e(t):e}function Gb(e="neutral",t="sm"){return twMerge("inline-flex items-center rounded-full font-medium",t==="sm"?"px-2 py-0.5 text-xs":"px-2.5 py-1 text-sm",{success:"bg-feedback-success-background text-feedback-success-text",error:"bg-feedback-error-background text-feedback-error-text",warning:"bg-feedback-warning-background text-feedback-warning-text",info:"bg-feedback-info-background text-feedback-info-text",neutral:"bg-background-muted text-text-secondary"}[e])}function Ub(e){return e?"success":"neutral"}function dl(e,t=false){return t?e>0?"text-feedback-success-text":e<0?"text-feedback-error-text":"text-text-primary":"text-text-primary"}function Mu(e="hover",t="secondary"){let r={primary:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",secondary:"text-text-link-default hover:text-text-link-hover visited:text-text-link-default",default:"text-text-link-default hover:text-text-link-hover visited:text-text-link-default",brand:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",muted:"text-text-secondary hover:text-text-secondary visited:text-text-secondary",unstyled:""},o={visible:"underline underline-offset-4 decoration-1 cursor-pointer",hover:"hover:underline hover:underline-offset-4 hover:decoration-1 cursor-pointer transition-colors",none:"cursor-pointer"},n=r[t],a=o[e]||"";return `${n} ${a}`.trim()}function no(e,t,r,o="hover",n="secondary",a,i){if(!t)return e;let s=typeof t=="function"&&r?t(r):t,c=Mu(o,n);return jsx("a",{href:s,className:twMerge(c,a==="strong"||a==="high"?"font-semibold":"",i),onClick:d=>{d.metaKey||d.ctrlKey;},children:e})}function Kb({row:e,context:t,actions:r,align:o="right",size:n="sm"}){let{isLoading:a}=t;if(a)return jsx(K,{className:jo.sm});let s=(typeof r=="function"?r(e):r).filter(l=>!Ce(l.hidden,e));if(s.length===0)return null;let c=Me(o);return jsx("div",{className:c,children:s.map(l=>{let d=Ce(l.disabled,e);return l.variant==="icon"||!l.label?jsx(ee,{variant:"icon",size:n,onPress:()=>{l.onClick(e);},isDisabled:d,"aria-label":l.label||l.id,children:jsx(V,{name:l.icon||"DotsThree",size:n==="sm"?16:20})},l.id):jsxs(ee,{variant:l.variant||"secondary",size:n,onPress:()=>{l.onClick(e);},isDisabled:d,children:[l.icon&&jsx(V,{name:l.icon,size:n==="sm"?14:16}),l.label]},l.id)})})}function Jb({value:e,row:t,context:r,variant:o="default",label:n,size:a="sm",shape:i="square",dot:s,dotPosition:c="left",dotPulse:l,align:d="left",emptyText:u="\u2014",className:m,maxVisible:p=2,maxLabelLength:g}){let{isLoading:f}=r,x=(N,w)=>{if(!g||N.length<=g)return jsx(Fragment,{children:N});let M=N.slice(0,g-1)+"\u2026";return jsx(Qt,{content:w,children:jsx("span",{children:M})})};if(f)return jsx(K,{className:or("normal")});if(e==null||e==="")return jsx("div",{className:Me(d,"text-text-secondary"),children:u});if(Array.isArray(e)&&e.length===0)return jsx("div",{className:Me(d,"text-text-secondary"),children:u});let b=Me(d,m);if(Array.isArray(e)){let N=e.slice(0,p),w=e.slice(p),M=w.length>0;return jsx("div",{className:b,children:jsxs("div",{className:"flex items-center gap-1",children:[N.map((k,P)=>{let I=typeof o=="function"?o(k,t):o,D=typeof n=="function"?n(k,t):n!==void 0?n:String(k),L=typeof s=="function"?s(k,t):s,R=typeof l=="function"?l(k,t):l;return jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsx(tt,{variant:I,size:a,shape:i,dot:L,dotPosition:c,dotPulse:R,children:x(D,D)})},P)}),M&&jsx(Qt,{content:w.join(", "),children:jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxs(tt,{variant:"neutral",size:a,shape:i,children:["+",w.length]})})})]})})}let h=typeof o=="function"?o(e,t):o,y=typeof n=="function"?n(e,t):n!==void 0?n:String(e),v=typeof s=="function"?s(e,t):s,S=typeof l=="function"?l(e,t):l;return jsx("div",{className:b,children:jsx(tt,{variant:h,size:a,shape:i,dot:v,dotPosition:c,dotPulse:S,children:x(y,y)})})}function Xb({value:e,context:t,format:r="icon",trueText:o="Yes",falseText:n="No",trueIcon:a="Check",falseIcon:i="X",showFalse:s=true,align:c="center",emphasis:l="normal",className:d}){let{isLoading:u}=t;if(u)return jsx(K,{className:or(l)});let m=!!e;if(!m&&!s)return jsx("div",{className:Me(c,d)});let p=Me(c,d);switch(r){case "icon":return jsx("div",{className:p,children:jsx(V,{name:m?a:i,size:16,className:m?"text-feedback-success-text":"text-text-disabled"})});case "text":return jsx("div",{className:p,children:jsx("span",{className:Dr(l),children:m?o:n})});case "badge":return jsx("div",{className:p,children:jsx(tt,{variant:m?"success":"neutral",size:"sm",children:m?o:n})});default:return null}}function qb({row:e,context:t,firstName:r,lastName:o,email:n,avatarUrl:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:d="secondary",showEmail:u=false,badge:m,emphasis:p="normal",align:g="left",className:f,piiEntity:x}){let{isLoading:b}=t,h=Ce(r,e),y=Ce(o,e),v=Ce(n,e),S=Ce(a,e),N=Ce(c,e),w=typeof m=="function"?m(e):m,M=Ce(x,e),k=Me(g,f);return jsx("div",{className:k,children:jsx(Fs,{firstName:h,lastName:y,email:v,avatarUrl:S,layout:i,size:s,href:N,LinkComponent:l,linkVariant:d,showEmail:u,badge:w,emphasis:p,isLoading:b,piiEntity:M})})}function Qb({value:e,row:t,context:r,render:o,className:n}){let a=o(e,t,r);return jsx("div",{className:twMerge("h-full w-full",n),children:a})}function Zb({value:e,row:t,context:r,format:o="date",customFormat:n,emptyText:a="\u2014",align:i="left",emphasis:s="normal",href:c,linkBehavior:l="hover",className:d}){let{isLoading:u}=r;if(u)return jsx(K,{className:or(s)});if(!e)return jsx("div",{className:Me(i,"text-text-secondary"),children:a});let m=e instanceof Date?e:new Date(e);if(isNaN(m.getTime()))return jsx("div",{className:Me(i,"text-text-secondary"),children:a});let p;switch(o){case "date":p=m.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});break;case "time":p=m.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});break;case "datetime":p=m.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});break;case "relative":p=J1(m);break;case "custom":p=n?m.toLocaleString("en-US",n):m.toISOString();break;default:p=m.toLocaleDateString();}let g=Me(i,twMerge(Dr(s),d)),f=Ce(c,t);return f?jsx("div",{className:g,children:no(p,f,t,l)}):jsx("div",{className:g,children:p})}function J1(e){let r=new Date().getTime()-e.getTime(),o=Math.floor(r/1e3),n=Math.floor(o/60),a=Math.floor(n/60),i=Math.floor(a/24);return o<60?"just now":n<60?`${n} minute${n!==1?"s":""} ago`:a<24?`${a} hour${a!==1?"s":""} ago`:i<7?`${i} day${i!==1?"s":""} ago`:e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function ul({manufacturer:e,model:t,deviceType:r,deviceTypeIconName:o,logoUrl:n,layout:a="stacked",size:i="md",href:s,LinkComponent:c,linkVariant:l="unstyled",showDeviceTypeIcon:d=true,showLogo:u=true,emphasis:m="normal",isLoading:p=false,className:g,piiEntity:f}){let[x,b]=useState(false),h=o||(r?j1(r):"DeviceMobile"),v={xs:{iconSize:28,logoSize:"w-7 h-7",gap:"gap-1.5",textSize:"text-xs",secondaryTextSize:"text-xs",iconInTextSize:12,skeletonIcon:28,skeletonText:80,skeletonSecondary:60},sm:{iconSize:32,logoSize:"w-8 h-8",gap:"gap-2",textSize:"text-sm",secondaryTextSize:"text-xs",iconInTextSize:14,skeletonIcon:32,skeletonText:96,skeletonSecondary:72},md:{iconSize:32,logoSize:"w-9 h-9",gap:"gap-3",textSize:"text-base",secondaryTextSize:"text-sm",iconInTextSize:16,skeletonIcon:36,skeletonText:128,skeletonSecondary:96},lg:{iconSize:40,logoSize:"w-10 h-10",gap:"gap-3",textSize:"text-lg",secondaryTextSize:"text-base",iconInTextSize:18,skeletonIcon:40,skeletonText:160,skeletonSecondary:120}}[i],S=n&&!x&&u,w={strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[m],M=({children:k,className:P})=>s?c?jsx(c,{href:s,className:P,children:k}):jsx(Qe,{href:s,variant:l,className:twMerge("hover:underline",P),asButton:false,children:k}):jsx("span",{className:P,children:k});if(p)return a==="inline"?jsxs("div",{className:twMerge("flex items-center",v.gap,g),children:[jsx(K,{width:v.skeletonIcon,height:v.skeletonIcon,className:"flex-shrink-0 rounded"}),jsx(K,{width:v.skeletonText,height:v.skeletonIcon*.6})]}):jsxs("div",{className:twMerge("flex items-center",v.gap,g),children:[jsx(K,{width:v.skeletonIcon,height:v.skeletonIcon,className:"flex-shrink-0"}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx(K,{width:v.skeletonText,height:16}),jsx(K,{width:v.skeletonSecondary,height:12})]})]});if(a==="inline"){let k=`${e} ${t}`;return jsxs("div",{className:twMerge("flex items-center",v.gap,g),children:[jsx("div",{className:twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",v.logoSize),children:S?jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>b(true)}):jsx(V,{name:h,size:v.iconSize*.6,className:"text-text-secondary"})}),jsx(M,{className:twMerge("truncate leading-normal hover:text-text-primary",w,v.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:k})})]})}return jsxs("div",{className:twMerge("flex items-center justify-start",v.gap,g),children:[u&&jsx("div",{className:twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",v.logoSize),children:S?jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>b(true)}):jsx(V,{name:h,size:v.iconSize*.6,className:"text-text-secondary"})}),jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsx(M,{className:twMerge("truncate leading-normal hover:text-text-primary",w,v.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:e})}),jsxs("div",{className:twMerge("flex items-center gap-1.5 text-text-secondary leading-normal",v.secondaryTextSize),children:[d&&jsx(V,{name:h,size:v.iconInTextSize,className:"flex-shrink-0"}),jsx("span",{className:"truncate","data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:t})]})]})]})}function j1(e){switch(e){case "battery":return "BatteryHigh";case "charger":return "ChargingStation";case "inverter":return "Power";case "thermostat":return "ThermometerSimple";case "vehicle":return "CarSimple";case "water_heater":return "DropHalfBottom";case "meter":return "Gauge";default:return "DeviceMobile"}}function $b({row:e,context:t,manufacturer:r,model:o,deviceType:n,logoUrl:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:d="secondary",showDeviceTypeIcon:u=true,showLogo:m=true,emphasis:p="normal",align:g="left",className:f,piiEntity:x}){let{isLoading:b}=t,h=Ce(r,e),y=Ce(o,e),v=Ce(n,e),S=Ce(a,e),N=Ce(c,e),w=Ce(x,e),M=Me(g,f);return jsx("div",{className:M,children:jsx(ul,{manufacturer:h,model:y,deviceType:v,logoUrl:S,layout:i,size:s,href:N,LinkComponent:l,linkVariant:d,showDeviceTypeIcon:u,showLogo:m,emphasis:p,isLoading:b,piiEntity:w})})}var sU={charging:"percentage",discharging:"percentage",on:"kW",idle:void 0,off:void 0,heat:"temperature",cool:"temperature",auto:"temperature",eco:"temperature",unknown:void 0,connected:void 0,disconnected:void 0},q1=["charging","discharging","heat","cool","on","connected"],Q1={unknown:"Unknown",on:"On",off:"Off",idle:"Idle",charging:"Charging",discharging:"Discharging",heat:"Heating",eco:"Eco Mode",cool:"Cooling",auto:"Auto",connected:"Connected",disconnected:"Disconnected"};function Du(e){return q1.includes(e)}function Lu(e){return Q1[e]}function Bn({state:e,label:t,icon:r,isLoading:o,size:n="sm",shape:a="pill",dot:i,dotPulse:s,fixedWidth:c,className:l,...d}){if(o)return jsx(K,{className:"inline-flex h-6 w-20"});let u=t??Lu(e),m=Du(e);return jsxs(tt,{variant:e,size:n,shape:a,dot:i??m,dotPulse:s??m,className:c?`w-28 justify-center ${l||""}`:l,...d,children:[r&&jsx(V,{name:r,size:n==="sm"?12:n==="md"?14:16}),u]})}var _1={importing:"Importing",exporting:"Exporting"};function tx(e){return _1[e]}function ml({state:e,label:t,showIcon:r=false,isLoading:o,size:n="sm",shape:a="pill",fixedWidth:i,className:s,...c}){if(o)return jsx(K,{className:"inline-flex h-6 w-24"});let l=t??tx(e),d=e==="exporting"?"ArrowUp":"ArrowDown",u=n==="sm"?12:n==="md"?14:16;return r?jsx(tt,{variant:e,size:n,shape:a,className:`w-6 justify-center ${s||""}`,...c,children:jsx(V,{name:d,size:u})}):jsx(tt,{variant:e,size:n,shape:a,className:i?`w-28 justify-center ${s||""}`:s,...c,children:l})}function fl({state:e,stateLabel:t,metric:r,metricFormatter:o,secondaryState:n,layout:a="horizontal",isLoading:i,size:s="sm",shape:c="pill",icon:l,fixedWidth:d,secondaryStateIconOnly:u=false,className:m}){if(i)return jsx(K,{className:twMerge("inline-flex h-6 w-32",m)});let p=r!=null&&o?Fr(r,o):null,g=a==="horizontal",f=o&&!p;return jsxs("div",{className:twMerge("inline-flex items-center",g?"gap-2":"flex-col gap-1",m),children:[(p||f)&&jsx("span",{className:twMerge("font-medium inline-block",p?"text-text-primary":"text-text-secondary",s==="sm"&&"text-xs min-w-12",s==="md"&&"text-sm min-w-14",s==="lg"&&"text-base min-w-16"),children:p||"\u2014"}),jsx(Bn,{state:e,label:t,icon:l,size:s,shape:c,fixedWidth:d}),n&&jsx(Fragment,{children:n==="importing"||n==="exporting"?jsx(ml,{state:n,size:s,shape:c,fixedWidth:d,showIcon:u}):jsx(Bn,{state:n,size:s,shape:c,fixedWidth:d})})]})}function rx({value:e,row:t,context:r,metric:o,metricFormatter:n,secondaryState:a,size:i="sm",shape:s="pill",label:c,icon:l,fixedWidth:d=true,align:u="left",compact:m=false,className:p}){let{isLoading:g}=r;if(g){let v={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"}[s],S=o!=null||n!=null;return jsx("div",{className:"flex items-center gap-2",children:S?jsxs(Fragment,{children:[jsx(K,{className:"h-4 w-12"}),jsx(K,{className:`h-6 w-24 ${v}`}),jsx(K,{className:`h-6 w-20 ${v}`})]}):jsx(K,{className:`h-6 w-24 ${v}`})})}if(!e)return jsx("div",{className:Me(u,p),children:jsx("span",{className:"text-text-secondary",children:"\u2014"})});let f=Ce(o,t),x=Ce(a,t),b=typeof c=="function"?c(e,t):c,h=Me(u,p);return f!=null||n?jsx("div",{className:twMerge(h),children:jsx(fl,{state:e,stateLabel:b,metric:f,metricFormatter:n,secondaryState:x||void 0,size:i,shape:s,icon:l,fixedWidth:d,secondaryStateIconOnly:m,layout:"horizontal"})}):jsx("div",{className:h,children:jsx(Bn,{state:e,label:b,icon:l,size:i,shape:s,fixedWidth:d})})}function nx({value:e,row:t,context:r,formatter:o,align:n="left",emphasis:a="normal",href:i,linkBehavior:s="hover",className:c,emptyText:l="\u2014",emptyClassName:d="text-text-secondary"}){let{isLoading:u}=r;if(u)return jsx(K,{className:or(a)});let m=Xr({value:e,formatter:o,emptyText:l,emptyClassName:d}),p=Dr(a),g=Me(n,twMerge(p,c)),f=jsx("div",{className:g,children:m}),x=Ce(i,t);return x?no(f,x,t,s):f}var Au=Oe__default.memo(({value:e,min:t,max:r,color:o="var(--color-viz-default)",backgroundColor:n="var(--color-background-muted)",colorScale:a,showLabel:i=true,formatLabel:s,height:c=20,minWidth:l=4,segments:d,segmentGap:u=2,barWidth:m,context:p})=>{let g=useMemo(()=>r===t?100:Math.max(0,Math.min(100,(e-t)/(r-t)*100)),[e,t,r]),f=useMemo(()=>o==="auto"&&a?a.type==="diverging"&&a.center!==void 0?_a(e,t,r,a.center,a.scheme):Za(e,t,r,a.scheme):o,[o,a,e,t,r]);if(p.isLoading)return jsx("div",{className:"flex items-center gap-2 w-full",style:{height:c},children:jsx("div",{className:"h-full flex-1 animate-pulse bg-border-default rounded"})});if(d&&d>0){let h=`calc((100% - ${u*(d-1)}px) / ${d})`,y=Math.ceil(g/100*d),v={height:c,...m&&{width:typeof m=="number"?`${m}px`:m,flexShrink:0}};return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:`flex gap-0.5 ${m?"":"flex-1"}`,style:v,children:Array.from({length:d}).map((S,N)=>{let w=N<y;return jsx("div",{className:"rounded-sm",style:{width:h,backgroundColor:w?f:n==="none"?"transparent":n,marginRight:N<d-1?`${u}px`:0}},N)})}),i&&jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})}let x={height:c,backgroundColor:n==="none"?"transparent":n,...m&&{width:typeof m=="number"?`${m}px`:m,flexShrink:0}};return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:`relative rounded-sm ${m?"":"flex-1"}`,style:x,children:jsx("div",{className:"absolute left-0 top-0 h-full rounded-sm",style:{width:`${g}%`,minWidth:g>0?l:0,backgroundColor:f}})}),i&&jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})});Au.displayName="HorizontalBarCell";var Iu=Oe__default.memo(({value:e,data:t,color:r="var(--color-viz-default)",categoryColors:o,context:n,width:a,height:i=40})=>{let s=e||t||[],c=x=>"xValue"in x?x.xValue:x.x,l=x=>"yValue"in x?x.yValue:x.y,d=a||100,u=i,{xScale:m,yScale:p,barWidth:g}=useMemo(()=>{if(s.length===0)return {xScale:scaleTime({range:[0,d],domain:[new Date,new Date]}),yScale:scaleLinear({range:[u,0],domain:[0,1]}),barWidth:2};let x=extent(s,w=>c(w)),b=min(s,w=>l(w))??0,h=max(s,w=>l(w))??0,y=b<0?b:0,v=scaleTime({range:[0,d],domain:x}),S=scaleLinear({range:[u,0],domain:[y,h*1.05]}),N=s.length>1?d/s.length*.8:8;return {xScale:v,yScale:S,barWidth:Math.max(2,N)}},[s,d,u]);if(n.isLoading)return jsx("div",{className:"flex items-center gap-0.5",style:{width:d,height:u},children:Array.from({length:5}).map((x,b)=>jsx("div",{className:"flex-1 animate-pulse bg-border-default rounded"},b))});if(!s||s.length===0)return jsx("div",{className:"flex items-center justify-center text-text-secondary text-xs",style:{width:d,height:u},children:"No data"});let f=p(0);return jsx("svg",{width:d,height:u,children:s.map((x,b)=>{let h=l(x),y=m(c(x)),v=p(h),S=Math.abs(f-v),N=x.category&&o?.[x.category]?o[x.category]:r;return jsx(Bar,{x:y-g/2,y:h>=0?v:f,width:g,height:S,fill:N,rx:1},`bar-${b}`)})})});Iu.displayName="MiniBarCell";function cx({value:e,row:t,context:r,format:o="number",decimals:n=0,prefix:a,suffix:i,emptyText:s="\u2014",align:c="right",emphasis:l="normal",href:d,linkBehavior:u="hover",showPositiveSign:m=false,colorCode:p=false,className:g}){let{isLoading:f}=r;if(f)return jsx(K,{className:or(l)});if(e==null||isNaN(Number(e)))return jsx("div",{className:Me(c,"text-text-secondary"),children:s});let x=Number(e),b;switch(o){case "currency":b=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:n,maximumFractionDigits:n}).format(x);break;case "percent":b=new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:n,maximumFractionDigits:n}).format(x/100);break;case "compact":b=new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:n>0?1:0,maximumFractionDigits:n}).format(x);break;default:b=new Intl.NumberFormat("en-US",{minimumFractionDigits:n,maximumFractionDigits:n}).format(x);}let y=`${m&&x>0?"+":""}${b}`,v=p?dl(x,true):Dr(l),S=Me(c,twMerge(v,g)),N=jsxs(Fragment,{children:[a&&jsx("span",{className:"text-text-secondary",children:a}),jsx("span",{children:y}),i&&jsx("span",{className:"text-text-secondary",children:i})]}),w=Ce(d,t);return w?jsx("div",{className:S,children:no(N,w,t,u)}):jsx("div",{className:S,children:N})}var Fu=Oe__default.memo(({value:e,showLabel:t=true,color:r="var(--color-viz-categorical-1)",backgroundColor:o="var(--color-background-muted)",height:n=20,segments:a,segmentGap:i=2,colorScale:s,context:c})=>{let l=useMemo(()=>Math.max(0,Math.min(100,e)),[e]),d=useMemo(()=>r==="auto"&&s?s.type==="diverging"&&s.center!==void 0?_a(e,0,100,s.center,s.scheme):Za(e,0,100,s.scheme):r,[r,s,e]);if(c.isLoading)return jsx("div",{className:"flex items-center gap-2",style:{height:n},children:jsx("div",{className:"h-full w-full animate-pulse bg-border-default rounded"})});if(a&&a>0){let m=`calc((100% - ${i*(a-1)}px) / ${a})`,p=Math.ceil(l/100*a);return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:"flex gap-0.5 flex-1",style:{height:n},children:Array.from({length:a}).map((g,f)=>{let x=f<p,b=d;if(r==="auto"&&s&&x){let h=(f+1)/a*100;s.type==="diverging"&&s.center!==void 0?b=_a(h,0,100,s.center,s.scheme):b=Za(h,0,100,s.scheme);}return jsx("div",{className:"rounded-sm",style:{width:m,backgroundColor:x?b:o==="none"?"transparent":o,marginRight:f<a-1?`${i}px`:0}},f)})}),t&&jsxs("span",{className:"text-sm text-text-primary whitespace-nowrap",children:[l.toFixed(0),"%"]})]})}return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:"relative flex-1 rounded-sm",style:{height:n,backgroundColor:o==="none"?"transparent":o},children:jsx("div",{className:"absolute left-0 top-0 h-full rounded-sm transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})}),t&&jsxs("span",{className:"text-sm text-text-primary whitespace-nowrap",children:[l.toFixed(0),"%"]})]})});Fu.displayName="PercentBarCell";function ux({row:e,context:t,isSelected:r=false,onSelect:o,isDisabled:n=false,align:a="center"}){let{isLoading:i}=t;if(i)return jsx("div",{className:Me(a),children:jsx(K,{className:"h-4 w-4 rounded"})});let s=Ce(n,e),c=Me(a);return jsx("div",{className:c,children:jsx(vn,{isSelected:r,onChange:l=>{o?.(e,l);},isDisabled:s,"aria-label":"Select row"})})}function xl({streetAddress:e,city:t,state:r,postalCode:o,layout:n="stacked",size:a="md",href:i,LinkComponent:s,linkVariant:c="unstyled",emphasis:l="normal",isLoading:d=false,className:u,piiEntity:m}){let g={xs:{iconSize:16,iconContainerSize:"w-7 h-7",gap:"gap-1.5",textSize:"text-xs",secondaryTextSize:"text-xs",skeletonIconStacked:28,skeletonIconInline:16,skeletonText:80,skeletonSecondary:60},sm:{iconSize:20,iconContainerSize:"w-8 h-8",gap:"gap-2",textSize:"text-sm",secondaryTextSize:"text-xs",skeletonIconStacked:32,skeletonIconInline:20,skeletonText:96,skeletonSecondary:72},md:{iconSize:24,iconContainerSize:"w-9 h-9",gap:"gap-3",textSize:"text-base",secondaryTextSize:"text-sm",skeletonIconStacked:36,skeletonIconInline:24,skeletonText:128,skeletonSecondary:96},lg:{iconSize:28,iconContainerSize:"w-10 h-10",gap:"gap-3",textSize:"text-lg",secondaryTextSize:"text-base",skeletonIconStacked:40,skeletonIconInline:28,skeletonText:160,skeletonSecondary:120}}[a],x={strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[l],b=[];t&&b.push(t),r&&o?b.push(`${r} ${o}`):r?b.push(r):o&&b.push(o);let h=b.join(", "),y=({children:S,className:N})=>i?s?jsx(s,{href:i,className:N,children:S}):jsx(Qe,{href:i,variant:c,className:twMerge("hover:underline",N),asButton:false,children:S}):jsx("span",{className:N,children:S});if(d)return n==="inline"?jsxs("div",{className:twMerge("flex items-center",g.gap,u),children:[jsx(K,{width:g.skeletonIconInline,height:g.skeletonIconInline,className:"flex-shrink-0 rounded"}),jsx(K,{width:g.skeletonText,height:g.skeletonIconInline*.8})]}):jsxs("div",{className:twMerge("flex items-center",g.gap,u),children:[jsx(K,{width:g.skeletonIconStacked,height:g.skeletonIconStacked,className:"flex-shrink-0 rounded"}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx(K,{width:g.skeletonText,height:16}),jsx(K,{width:g.skeletonSecondary,height:12})]})]});if(n==="inline")return jsxs(y,{className:twMerge("flex items-center",g.gap,i&&"hover:bg-background-hover transition-colors",u),children:[jsx(V,{name:"MapPin",size:g.iconSize,className:"text-text-secondary flex-shrink-0"}),jsx("span",{className:twMerge("leading-normal truncate hover:text-text-primary",x,g.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),"data-pii-type":m?"address":void 0,"data-pii-entity":m,children:e})]});let v=()=>{if(m){if(t&&r&&o)return "city-state-zip";if(t&&r)return "city-state";if(t)return "city";if(r)return "state";if(o)return "postal-code"}};return jsxs("div",{className:twMerge("flex items-center justify-start",g.gap,u),children:[jsx("div",{className:twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",g.iconContainerSize),children:jsx(V,{name:"MapPin",size:g.iconSize,className:"text-text-secondary"})}),jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsx(y,{className:twMerge("leading-normal truncate hover:text-text-primary",x,g.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":m?"address":void 0,"data-pii-entity":m,children:e})}),h&&jsx("div",{className:twMerge("text-text-secondary leading-normal truncate",g.secondaryTextSize),"data-pii-type":v(),"data-pii-entity":m,children:h})]})]})}function mx({row:e,context:t,streetAddress:r,city:o,state:n,postalCode:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:d="secondary",emphasis:u="normal",align:m="left",className:p,piiEntity:g}){let{isLoading:f}=t,x=Ce(r,e),b=Ce(o,e),h=Ce(n,e),y=Ce(a,e),v=Ce(c,e),S=Ce(g,e),N=Me(m,p);return jsx("div",{className:N,children:jsx(xl,{streetAddress:x,city:b,state:h,postalCode:y,layout:i,size:s,href:v,LinkComponent:l,linkVariant:d,emphasis:u,isLoading:f,piiEntity:S})})}var Bu=Oe__default.memo(({value:e,data:t,type:r="line",color:o="var(--color-viz-default)",strokeWidth:n=2,categoryColors:a,context:i,width:s,height:c=40})=>{let l=e||t||[],d=s||100,u=c,{xScale:m,yScale:p}=useMemo(()=>{if(l.length===0)return {xScale:scaleTime({range:[0,d],domain:[new Date,new Date]}),yScale:scaleLinear({range:[u,0],domain:[0,1]})};let f=extent(l,y=>y.xValue),x=min(l,y=>y.yValue)||0,b=max(l,y=>y.yValue)||0,h=(b-x)*.1||1;return {xScale:scaleTime({range:[0,d],domain:f}),yScale:scaleLinear({range:[u,0],domain:[x-h,b+h]})}},[l,d,u]);if(i.isLoading)return jsx("div",{className:"flex items-center",style:{width:d,height:u},children:jsx("div",{className:"h-1 w-full animate-pulse bg-border-default rounded"})});if(!l||l.length===0)return jsx("div",{className:"flex items-center justify-center text-text-secondary text-xs",style:{width:d,height:u},children:"No data"});let g=a&&l[0]?.category&&a[l[0].category]?a[l[0].category]:o;return jsxs("svg",{width:d,height:u,className:"overflow-visible",children:[(r==="area"||r==="both")&&jsx(AreaClosed,{data:l,x:f=>m(f.xValue),y:f=>p(f.yValue),yScale:p,fill:g,fillOpacity:.15,curve:curveLinear}),(r==="line"||r==="both")&&jsx(LinePath,{data:l,x:f=>m(f.xValue),y:f=>p(f.yValue),stroke:g,strokeWidth:n,strokeLinecap:"round",curve:curveLinear})]})});Bu.displayName="SparklineCell";function xx({value:e,row:t,context:r,prefix:o,suffix:n,emptyText:a="\u2014",href:i,linkBehavior:s="hover",linkVariant:c="secondary",emphasis:l="normal",truncate:d=true,copyable:u=false,align:m="left",className:p,piiType:g,piiEntity:f}){let{isLoading:x}=r;if(x)return jsx(K,{className:or(l)});let b=cl(e,a),h=Ce(i,t),y=Ce(f,t),v=b,S=false,N=false;if(d&&b&&typeof b=="string")if(typeof d=="boolean")N=true;else {let{position:R="end",length:B=16,ellipsis:Y="...",tooltip:H=true}=d;if(b.length>B){switch(R){case "start":v=as(b,B);break;case "middle":v=aa(b,B);break;case "end":v=is(b,B,Y);break}S=H;}}let w=g&&y?{"data-pii-type":g,"data-pii-entity":y}:{},M=Object.keys(w).length>0,k=jsx("span",{className:N?"truncate":"",...w,children:v}),P=S?jsx(Qt,{content:M?jsx("span",{...w,children:String(b)}):String(b),children:k}):k,I=jsxs(Fragment,{children:[o&&jsx("span",{className:"text-text-secondary",children:o}),P,n&&jsx("span",{className:"text-text-secondary",children:n})]}),D=I;if(u&&b&&b!==a){let R=typeof u=="function"?u(t):String(b);D=jsx(Fo,{value:R,size:"sm",children:I});}if(h){let R=Me(m,p);return jsx("div",{className:R,children:no(D,h,t,s,c,l)})}let L=Me(m,twMerge(Dr(l),p));return jsx("div",{className:L,children:D})}var PP={sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"},RP={sm:"hidden sm:grid",md:"hidden md:grid",lg:"hidden lg:grid",xl:"hidden xl:grid"};function hl(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function yl(e,t,r,o){if(r.cell){let n=r.cell,a=typeof r.cellProps=="function"?r.cellProps(e,t):r.cellProps;return jsx(n,{value:e,row:t,context:o,...a})}return r.render?r.render(e,t,o):e?.toString()??"\u2014"}function Cl({row:e,columns:t,density:r,isLoading:o,onClick:n}){let a=t.filter(u=>u.mobile!==false).map(u=>{let m=u.mobile===false?null:u.mobile;return {...u,mobilePriority:m?.priority??2,mobileFormat:m?.format??"secondary",showLabel:m?.label??m?.format==="secondary",icon:m?.icon}}).sort((u,m)=>u.mobilePriority-m.mobilePriority),i=a.filter(u=>u.mobilePriority===1||u.mobileFormat==="primary"),s=a.filter(u=>u.mobilePriority===2&&u.mobileFormat!=="primary"),c=a.filter(u=>u.mobileFormat==="badge"),l={isLoading:!!o,rowIndex:0,columnIndex:0,density:r};return jsxs("div",{className:twMerge("border-b border-border-default bg-background-surface transition-colors",n&&"cursor-pointer hover:bg-background-hover active:bg-background-pressed",{compact:"px-3 py-2",default:"px-4 py-3",relaxed:"px-4 py-4"}[r]),onClick:n,role:n?"button":void 0,tabIndex:n?0:void 0,children:[i.length>0&&jsxs("div",{className:"mb-2 flex items-start justify-between",children:[jsx("div",{className:"flex-1",children:i.map(u=>{let m=hl(e,u);return jsx("div",{className:"font-medium text-text-primary [&>*]:!justify-start [&>*]:!text-left",children:yl(m,e,u,l)},u.id)})}),c.length>0&&jsx("div",{className:"ml-2 flex flex-wrap gap-1",children:c.map(u=>{let m=hl(e,u);return jsx("div",{className:"inline-flex",children:yl(m,e,u,l)},u.id)})})]}),s.length>0&&jsx("div",{className:"space-y-1",children:s.map(u=>{let m=hl(e,u),p=u.showLabel&&u.label;return jsxs("div",{className:"flex items-center text-sm text-text-secondary",children:[u.icon&&jsx(V,{name:u.icon,className:"mr-1.5 h-4 w-4 flex-shrink-0"}),p&&jsxs("span",{className:"mr-1 font-medium",children:[u.label,":"]}),jsx("span",{className:"truncate [&>*]:!justify-start [&>*]:!text-left",children:yl(m,e,u,l)})]},u.id)})})]})}function Sl({row:e,columns:t,density:r,isLoading:o,onClick:n}){let a=t.filter(c=>c.mobile!==false),i={isLoading:!!o,rowIndex:0,columnIndex:0,density:r};return jsx("div",{className:twMerge("border-b border-border-default bg-background-surface transition-colors",n&&"cursor-pointer hover:bg-background-hover active:bg-background-pressed",{compact:"px-3 py-2",default:"px-4 py-3",relaxed:"px-4 py-4"}[r]),onClick:n,role:n?"button":void 0,tabIndex:n?0:void 0,children:jsx("div",{className:"space-y-2",children:a.map((c,l)=>{let d=hl(e,c),u=l===0;return jsxs("div",{children:[!u&&jsx("div",{className:"text-xs text-text-secondary",children:c.label}),jsx("div",{className:twMerge(u?"font-medium text-text-primary":"text-sm text-text-primary","[&>*]:!justify-start [&>*]:!text-left"),children:yl(d,e,c,i)})]},c.id)})})})}function hx(e="md"){return {mobile:PP[e],desktop:RP[e]}}function yx({density:e}){return jsxs("div",{className:twMerge("border-b border-border-default bg-background-surface",{compact:"px-3 py-2",default:"px-4 py-3",relaxed:"px-4 py-4"}[e]),children:[jsx("div",{className:"mb-2 h-5 w-3/4 animate-pulse rounded bg-background-muted"}),jsxs("div",{className:"space-y-1",children:[jsx("div",{className:"h-4 w-1/2 animate-pulse rounded bg-background-muted"}),jsx("div",{className:"h-4 w-2/3 animate-pulse rounded bg-background-muted"})]})]})}var WP={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},GP={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"};function UP(e){let t={};return e.width!==void 0&&(t.width=typeof e.width=="number"?`${e.width}px`:e.width),e.minWidth!==void 0&&(t.minWidth=typeof e.minWidth=="number"?`${e.minWidth}px`:e.minWidth),e.maxWidth!==void 0&&(t.maxWidth=typeof e.maxWidth=="number"?`${e.maxWidth}px`:e.maxWidth),e.flex!==void 0&&(t.flex=`${e.flex} 1 0`),t}function KP({column:e,sortConfig:t,onSort:r,stickyHeader:o,stickyFirstColumn:n,isFirstColumn:a,density:i="default",isLoading:s=false}){let c=e.reorderable!==false,{attributes:l,listeners:d,setNodeRef:u,transform:m,transition:p,isDragging:g}=useSortable({id:e.id,disabled:!c||s}),f=t?.columnId===e.id,x=f?t.direction:null,b=n&&a,h={...UP(e),transform:CSS.Transform.toString(m),transition:p,opacity:g?.8:1,zIndex:g?50:void 0};return jsx("div",{ref:u,className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.sortable?"gap-2":"gap-1",WP[i],GP[e.align||"left"],o&&"sticky top-0 z-10",b&&"sticky left-0 z-20 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",o&&b&&"z-30",e.sortable&&!s&&"hover:bg-background-hover",s&&"cursor-not-allowed opacity-60",f?"font-bold text-text-primary":"font-medium text-text-secondary",g&&"bg-background-hover"),style:h,role:"columnheader","aria-sort":f?x==="asc"?"ascending":"descending":"none","aria-disabled":s,...l,...d,children:s?jsx(K,{className:"h-4 w-24"}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1 truncate cursor-pointer",onClick:()=>!s&&e.sortable&&r(e.id),children:e.label}),e.sortable&&jsx("button",{type:"button",className:"flex flex-shrink-0 cursor-pointer",onClick:()=>!s&&r(e.id),"aria-label":`Sort by ${e.label}`,children:f?jsx(V,{name:x==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-primary"}):jsx(V,{name:"CaretUpDown",size:12,className:"text-text-secondary opacity-40"})})]})})}function Cx({columns:e,columnOrder:t,onColumnOrderChange:r,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,density:s="default",isLoading:c=false}){let l=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:5}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),d=new Map(e.map(p=>[p.id,p])),u=p=>{let{active:g,over:f}=p;if(f&&g.id!==f.id){let x=t.indexOf(g.id),b=t.indexOf(f.id);if(d.get(f.id)?.reorderable===false)return;let y=0;for(let w=0;w<t.length&&d.get(t[w])?.reorderable===false;w++)y=w+1;if(b<y)return;let v=Math.min(x,b),S=Math.max(x,b);for(let w=v;w<=S;w++){if(w===x)continue;if(d.get(t[w])?.reorderable===false)return}let N=arrayMove(t,x,b);r(N);}},m=t.map(p=>d.get(p)).filter(p=>p!==void 0);return jsx(DndContext,{sensors:l,collisionDetection:closestCenter,onDragEnd:u,children:jsx(SortableContext,{items:t,strategy:horizontalListSortingStrategy,children:jsx("div",{className:"contents",role:"rowgroup",children:m.map((p,g)=>jsx(KP,{column:p,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,isFirstColumn:g===0,density:s,isLoading:c},p.id))})})})}var Hu={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},Wu={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"},QP={full:"w-full",auto:"w-auto inline-block",contained:"w-full max-w-6xl mx-auto"},ZP={auto:"table-auto",fixed:"table-fixed",responsive:"table-auto"};function Gu(e){let t={};return e.width!==void 0&&(t.width=typeof e.width=="number"?`${e.width}px`:e.width),e.minWidth!==void 0&&(t.minWidth=typeof e.minWidth=="number"?`${e.minWidth}px`:e.minWidth),e.maxWidth!==void 0&&(t.maxWidth=typeof e.maxWidth=="number"?`${e.maxWidth}px`:e.maxWidth),e.flex!==void 0&&(t.flex=`${e.flex} 1 0`),t}function _P(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function $P({column:e,sortConfig:t,onSort:r,stickyHeader:o,stickyFirstColumn:n,isFirstColumn:a,density:i="default",isLoading:s=false}){let c=t?.columnId===e.id,l=c?t.direction:null,d=n&&a;return jsx("div",{className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.sortable?"gap-2":"gap-1",Hu[i],Wu[e.align||"left"],o&&"sticky top-0 z-10",d&&"sticky left-0 z-20 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",o&&d&&"z-30",e.sortable&&!s&&"cursor-pointer hover:bg-background-hover",s&&"cursor-not-allowed opacity-60",c?"font-bold text-text-primary":"font-medium text-text-secondary"),onClick:()=>!s&&e.sortable&&r(e.id),role:"columnheader","aria-sort":c?l==="asc"?"ascending":"descending":"none","aria-disabled":s,style:Gu(e),children:s?jsx(K,{className:"h-4 w-24"}):jsxs(Fragment,{children:[jsx("span",{className:"truncate",children:e.label}),e.sortable&&jsx("div",{className:"flex flex-shrink-0",children:c?jsx(V,{name:l==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-primary"}):jsx(V,{name:"CaretUpDown",size:12,className:"text-text-secondary opacity-40"})})]})})}function e2({column:e,row:t,rowIndex:r,columnIndex:o,isHovered:n,density:a="default",className:i,stickyFirstColumn:s}){let c=s&&o===0,l=_P(t,e),d={isLoading:false,isHovered:n,rowIndex:r,columnIndex:o,density:a},u;if(e.cell){let m=e.cell,p=typeof e.cellProps=="function"?e.cellProps(l,t):e.cellProps;u=jsx(m,{value:l,row:t,context:d,...p});}else e.render?u=e.render(l,t,d):u=jsx("span",{className:"truncate",children:l?.toString()??""});if(e.popover){let m=e.popover,p,g="top",f=false,x="hover";typeof m=="string"?p=m:typeof m=="function"?p=m(l,t):(p=typeof m.content=="function"?m.content(l,t):m.content,g=m.placement||"top",f=m.showArrow??false,x=m.trigger||"hover"),u=jsxs(DialogTrigger,{...x==="hover"?{trigger:"longPress"}:{},children:[jsx("div",{className:"cursor-help",children:u}),jsx(nt,{placement:g,showArrow:f,children:jsx("div",{className:"p-2",children:p})})]});}return jsx("div",{className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.noCellPadding?"":Hu[a],Wu[e.align||"left"],c&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",i),role:"cell",style:Gu(e),children:u})}function t2({column:e,rowIndex:t,columnIndex:r,density:o="default",stickyFirstColumn:n}){let a=n&&r===0,i={isLoading:true,rowIndex:t,columnIndex:r,density:o},s;if(e.cell){let c=e.cell,l=typeof e.cellProps=="function"?e.cellProps(null,{}):e.cellProps;s=jsx(c,{value:null,row:{},context:i,...l});}else e.render?s=e.render(null,{},i):s=jsx(K,{className:"h-4 w-full max-w-[200px]"});return jsx("div",{className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.noCellPadding?"":Hu[o],Wu[e.align||"left"],a&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),role:"cell",style:Gu(e),children:s})}function r2(e,t){let r=new Set(["BUTTON","A","INPUT","SELECT","TEXTAREA"]),o=new Set(["button","link","checkbox","switch","menuitem","option"]),n=e;for(;n&&n!==t;){if(r.has(n.tagName))return true;let a=n.getAttribute("role");if(a&&o.has(a))return true;n=n.parentElement;}return false}function Sx({columns:e,row:t,rowIndex:r,density:o="default",onClick:n,stickyFirstColumn:a}){let[i,s]=useState(false),c=useCallback(l=>{if(!n)return;let d=l.target,u=l.currentTarget;r2(d,u)||n(t);},[n,t]);return jsx("div",{className:twMerge("contents group",n&&"cursor-pointer"),role:"row",onClick:c,onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),children:e.map((l,d)=>jsx(e2,{column:l,row:t,rowIndex:r,columnIndex:d,isHovered:i,density:o,className:n?"group-hover:bg-background-hover":"",stickyFirstColumn:a},l.id))})}function wx({columns:e,rowIndex:t,density:r="default",stickyFirstColumn:o}){return jsx("div",{className:"contents",role:"row",children:e.map((n,a)=>jsx(t2,{column:n,rowIndex:t,columnIndex:a,density:r,stickyFirstColumn:o},n.id))})}function Nx({columns:e,data:t,className:r,density:o="default",width:n="full",height:a,maxHeight:i,layout:s="auto",mobileRenderer:c="auto",customMobileRowRender:l,mobileBreakpoint:d="md",isLoading:u=false,loadingState:m,loadingRowCount:p=5,onLoadMore:g,hasMore:f=false,enableVirtualization:x,estimatedRowHeight:b,loadingIndicator:h,stickyHeader:y=false,stickyFirstColumn:v=false,onRowClick:S,getRowId:N,hideHeader:w=false,sortConfig:M,onSort:k,"aria-label":P,enableColumnReorder:I=false,columnOrder:D,onColumnOrderChange:L}){let[R,B]=useState(null),Y=M!==void 0,H=Y?M:R,W=useRef(null),Z=useMemo(()=>e.map(j=>j.id),[e]),[q,Q]=useState(Z),T=D!==void 0,E=T?D:q;useEffect(()=>{T||Q(j=>{let ae=e.map(se=>se.id),_=new Set(ae),X=new Set(j),U=j.filter(se=>_.has(se)),ce=ae.filter(se=>!X.has(se));return [...U,...ce]});},[e,T]);let O=useCallback(j=>{T||Q(j),L?.(j);},[T,L]),A=useMemo(()=>{if(!I&&!D)return e;let j=new Map(e.map(ae=>[ae.id,ae]));return E.map(ae=>j.get(ae)).filter(ae=>ae!==void 0)},[e,E,I,D]),C=g?Ro({items:t,onLoadMore:g,hasMore:f,isLoading:u,loadingState:m,enableVirtualization:x,estimatedItemSize:b||(o==="compact"?40:o==="relaxed"?60:48),overscan:5}):null,F=C?.scrollRef??W,{loadMoreRef:z,virtualizer:G,virtualItems:oe,isLoadingMore:ue,computedLoadingState:te}=C||{},{gridTemplateColumns:le,totalMinWidth:me}=useMemo(()=>{let j=0;return {gridTemplateColumns:A.map(_=>{if(_.minWidth?j+=typeof _.minWidth=="number"?_.minWidth:0:_.width&&typeof _.width=="number"&&(j+=_.width),_.width)return typeof _.width=="number"?`${_.width}px`:_.width;if(_.flex)return `${_.flex}fr`;if(_.minWidth&&_.maxWidth){let X=typeof _.minWidth=="number"?`${_.minWidth}px`:_.minWidth,U=typeof _.maxWidth=="number"?`${_.maxWidth}px`:_.maxWidth;return `minmax(${X}, ${U})`}return _.minWidth?`minmax(${typeof _.minWidth=="number"?`${_.minWidth}px`:_.minWidth}, 1fr)`:_.maxWidth?`minmax(0, ${typeof _.maxWidth=="number"?`${_.maxWidth}px`:_.maxWidth})`:"1fr"}).join(" "),totalMinWidth:j}},[A]),re=useCallback(j=>{if(!e.find(X=>X.id===j)?.sortable)return;let _;H?.columnId===j?_={columnId:j,direction:H.direction==="asc"?"desc":"asc"}:_={columnId:j,direction:"asc"},Y||B(_),k?.(_);},[e,H,k,Y]),ie=te==="loading"||u&&t.length===0,fe={};a?(fe.height=typeof a=="number"?`${a}px`:a,fe.overflowY="auto"):i?(fe.maxHeight=typeof i=="number"?`${i}px`:i,fe.overflowY="auto"):g&&(fe.height="600px",fe.overflowY="auto");let xe=twMerge(QP[n],!g&&(s==="responsive"?"overflow-x-auto scrollbar-visible":"overflow-auto scrollbar-visible"),r),Be=hx(d),Ze=c!=="none",Kt=(j,ae)=>Ze?c==="custom"&&l?l(j,ae):jsx(c==="cards"?Sl:Cl,{row:j,columns:A,density:o,isLoading:u,onClick:S?()=>S(j):void 0}):null,ir=G?oe?.map(j=>({virtualItem:j,row:t[j.index],index:j.index}))||[]:t.map((j,ae)=>({row:j,index:ae,virtualItem:null}));return jsxs("div",{ref:F,className:xe,style:{...fe,position:G?"relative":void 0},children:[jsxs("div",{className:twMerge("grid border-separate border-spacing-0",ZP[s],n==="auto"?"inline-grid w-auto":"w-full",Ze&&Be.desktop),role:"table","aria-label":P,style:{gridTemplateColumns:le,minWidth:me>0?`${me}px`:void 0},children:[!w&&(I?jsx(Cx,{columns:e,columnOrder:E,onColumnOrderChange:O,sortConfig:H,onSort:re,stickyHeader:y,stickyFirstColumn:v,density:o,isLoading:ie}):jsx("div",{className:"contents",role:"rowgroup",children:A.map((j,ae)=>jsx($P,{column:j,sortConfig:H,onSort:re,stickyHeader:y,stickyFirstColumn:v,isFirstColumn:ae===0,density:o,isLoading:ie},j.id))})),G?jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1",height:`${G.getTotalSize()}px`,position:"relative"},role:"rowgroup",children:ie?Array.from({length:p}).map((j,ae)=>jsx("div",{className:"contents",children:jsx(wx,{columns:A,rowIndex:ae,density:o,stickyFirstColumn:v})},`loading-${ae}`)):t.length>0?jsxs(Fragment,{children:[ir.map(({row:j,index:ae,virtualItem:_})=>{if(!j||!_)return null;let X=N?N(j):`row-${ae}`;return jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",display:"grid",gridTemplateColumns:le,transform:`translateY(${_.start}px)`},"data-index":_.index,ref:G.measureElement,children:jsx(Sx,{columns:A,row:j,rowIndex:ae,density:o,onClick:S,stickyFirstColumn:v})},X)}),ue&&jsx("div",{style:{position:"absolute",top:`${G.getTotalSize()}px`,left:0,width:"100%"},children:h||jsx(Cr,{state:"loading-more"})})]}):jsx("div",{className:"py-12 text-center text-text-secondary",children:"No data available"})}):jsx("div",{className:"contents",role:"rowgroup",children:ie?Array.from({length:p}).map((j,ae)=>jsx(wx,{columns:A,rowIndex:ae,density:o,stickyFirstColumn:v},`loading-${ae}`)):t.length>0?jsxs(Fragment,{children:[ir.map(({row:j,index:ae})=>{if(!j)return null;let _=N?N(j):`row-${ae}`;return jsx(Sx,{columns:A,row:j,rowIndex:ae,density:o,onClick:S,stickyFirstColumn:v},_)}),ue&&jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1"},children:h||jsx(Cr,{state:"loading-more"})})]}):jsx("div",{className:"col-span-full py-12 text-center text-text-secondary",role:"row",children:jsx("div",{role:"cell",children:"No data available"})})})]}),Ze&&jsx("div",{className:Be.mobile,children:ie?Array.from({length:p}).map((j,ae)=>jsx(yx,{density:o},`mobile-loading-${ae}`)):t.length>0?jsxs(Fragment,{children:[ir.map(({row:j,index:ae})=>{if(!j)return null;let _=N?N(j):`mobile-row-${ae}`;return jsx("div",{className:"border-b border-border-default last:border-b-0",children:Kt(j,ae)},_)}),ue&&(h||jsx(Cr,{state:"loading-more"}))]}):jsx("div",{className:"py-12 text-center text-text-secondary",children:"No data available"})}),g&&f&&!ie&&(G?jsx("div",{ref:z,style:{position:"absolute",top:`${G.getTotalSize()}px`,left:0,width:"100%",height:1}}):jsx("div",{ref:z,className:"h-px w-full"}))]})}function Tx({status:e,alertCount:t,showCount:r=false,isLoading:o,size:n="sm",shape:a="pill",...i}){if(o)return jsx(K,{className:"inline-flex h-6 w-20"});let s={healthy:"success",warning:"warning",error:"error",unknown:"neutral"},c={healthy:"Healthy",warning:"Warning",error:"Error",unknown:"Unknown"},l=e==="warning"||e==="error",d=r&&t?`${c[e]} (${t})`:c[e];return jsx(tt,{variant:s[e],size:n,shape:a,dot:l,dotPulse:l,...i,children:d})}var n2={battery:"BatteryHigh",charger:"ChargingStation",thermostat:"ThermometerSimple",inverter:"Power",vehicle:"Car",water_heater:"DropHalfBottom",meter:"Gauge",gateway:"WifiHigh",other:"Cube",unknown:"Question"},a2={battery:"Battery",charger:"Charger",thermostat:"Thermostat",inverter:"Inverter",vehicle:"Vehicle",water_heater:"Water Heater",meter:"Meter",gateway:"Gateway",other:"Other",unknown:"Unknown"};function Rx({deviceType:e,iconName:t,size:r="md",showLabel:o=false,className:n}){let a=t||(e?n2[e]:"Question"),i=e?a2[e]:void 0;return jsxs("div",{className:twMerge("inline-flex items-center",o?"flex-col gap-1":"gap-0",n),children:[jsx(V,{name:a,size:r}),o&&i&&jsx("span",{className:"text-xs text-text-secondary",children:i})]})}function Mi({children:e,title:t,headerContent:r,titleAlign:o="left",hideCloseIcon:n=false,hasBackArrow:a=false,onBack:i,isOpen:s,slideInFrom:c="right",transparentOverlay:l=false,onClose:d,className:u,primaryAction:m,secondaryAction:p,tertiaryAction:g,footerContent:f,contentPadding:x=true,maxWidth:b="400px"}){if(!s)return null;let h=t||r,y=m||p||g||f;return jsx(Vr,{children:jsx(sr,{isOpen:s,onOpenChange:v=>!v&&d?.(),isDismissable:true,transparent:l,children:jsx(Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxs(Dialog,{className:twMerge("fixed top-0 bottom-0 flex flex-col bg-background-surface shadow-xl overflow-hidden",c==="right"?"right-0":"left-0",c==="right"?"animate-in slide-in-from-right duration-300 ease-out":"animate-in slide-in-from-left duration-300 ease-out","data-[exiting]:animate-out",c==="right"?"data-[exiting]:slide-out-to-right":"data-[exiting]:slide-out-to-left","data-[exiting]:duration-200 data-[exiting]:ease-in","outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default focus-visible:outline-offset-0",u),style:{maxWidth:b,width:"100%"},children:[h&&(a&&i?jsx(zt,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,hasBackArrow:true,onBack:i,onClose:d}):jsx(zt,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,onClose:d})),jsx("div",{className:twMerge("flex-1 overflow-y-auto overscroll-contain",x?"px-6 py-6":"p-0"),children:e}),y&&jsx(Eo,{primaryAction:m,secondaryAction:p,tertiaryAction:g,footerContent:f})]})})})})}Mi.displayName="Drawer";function Dx({status:e,programName:t,isLoading:r,size:o="sm",shape:n="pill",...a}){if(r)return jsx(K,{className:"inline-flex h-6 w-20"});let i={enrolled:"success",eligible:"info",pending:"warning",not_eligible:"neutral",opted_out:"neutral"},s={enrolled:"Enrolled",eligible:"Eligible",pending:"Pending",not_eligible:"Not Eligible",opted_out:"Opted Out"},c=jsx(tt,{variant:i[e],size:o,shape:n,...a,children:s[e]});return t?jsx(Qt,{content:t,children:c}):c}function Ex({value:e,onChange:t,onUrlChange:r,accept:o="image/*",maxSize:n,isDisabled:a=false,onUpload:i,className:s,showPreview:c=true,placeholder:l="Drop files here or click to browse"}){let[d,u]=useState(false),[m,p]=useState(false),[g,f]=useState(null),[x,b]=useState(e),h=useRef(null),y=async N=>{if(f(null),n&&N.size>n){f(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(c&&N.type.startsWith("image/")){let w=new FileReader;w.onloadend=()=>{b(w.result);},w.readAsDataURL(N);}if(i){p(true);try{let w=await i(N);b(w),r?.(w);}catch(w){f("Failed to upload file"),console.error("Upload error:",w);}finally{p(false);}}t?.(N,x);},v=async N=>{try{let w=N.items;if(w.length>0){let M=w[0];if(M.kind==="file"){let k=await M.getFile();k&&y(k);}}}catch(w){f("Failed to upload file"),console.error("Upload error:",w);}finally{u(false);}},S=()=>{b(void 0),f(null),t?.(null),r?.(""),h.current&&(h.current.value="");};return jsxs("div",{className:twMerge("w-full",s),children:[jsxs(DropZone,{className:twMerge("relative flex min-h-[200px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",d?"border-action-brand bg-action-brand/5":"border-border-muted hover:border-border-default",a&&"pointer-events-none opacity-50",g&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:v,onDropEnter:()=>u(true),onDropExit:()=>u(false),children:[x?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[c&&(x.startsWith("data:image")||x.startsWith("http"))?jsx("img",{src:x,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx(Image$1,{className:"h-12 w-12 text-text-secondary"}),jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!a&&jsx(ee,{variant:"icon",size:"sm",onPress:S,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsx(X,{className:"h-4 w-4"})})]}):jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsx(Upload,{className:"h-12 w-12 text-text-secondary"}),jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-sm text-text-primary",children:l}),jsx("p",{className:"mt-1 text-xs text-text-secondary",children:o==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${o}`})]}),jsx(FileTrigger,{acceptedFileTypes:o.split(","),onSelect:N=>{let w=Array.from(N||[]);w.length>0&&y(w[0]);},children:jsx(ee,{variant:"secondary",size:"sm",isDisabled:a,children:"Choose File"})})]}),m&&jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),g&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function Ix({version:e,isLatest:t,updateAvailable:r,isLoading:o,size:n="sm",shape:a="rounded",...i}){if(o)return jsx(K,{className:"inline-flex h-6 w-16"});let s="neutral",c=e;return t?s="success":r&&(s="warning",c=`${e} (Update)`),jsx(tt,{variant:s,size:n,shape:a,...i,children:c})}function Ia(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Bx({placeholder:e="Search...",value:t,onChange:r,isOpen:o,onOpenChange:n,trigger:a,children:i,showShortcutHint:s=true,showInput:c=true,className:l}){let[d,u]=useState(false),m=Yt("(max-width: 767px)"),p=o!==void 0?o:d,g=useCallback(h=>{n?n(h):u(h);},[n]);useEffect(()=>{let h=y=>{(y.metaKey||y.ctrlKey)&&y.key==="k"&&(y.preventDefault(),g(!p)),y.key==="Escape"&&p&&g(false);};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[p,g]);let f=useCallback(h=>{r?.(h);},[r]),x=jsxs("button",{type:"button",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-secondary hover:text-text-primary hover:bg-background-hover rounded-md transition-colors","aria-label":"Open search",children:[jsx(V,{name:"MagnifyingGlass",size:18}),!m&&s&&jsxs("span",{className:"hidden md:flex items-center gap-1 text-xs",children:[jsx("kbd",{className:"px-1.5 py-0.5 bg-background-muted border border-border-muted rounded text-xs",children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{className:"px-1.5 py-0.5 bg-background-muted border border-border-muted rounded text-xs",children:"K"})]})]}),b=a===null||isValidElement(a)&&a.type===Fragment$1&&!a.props.children;return m?jsxs(Fragment,{children:[!b&&(a?jsx("button",{type:"button",onClick:()=>g(true),className:"appearance-none bg-transparent border-none p-0 cursor-pointer",children:a}):jsx("button",{type:"button",onClick:()=>g(true),className:"appearance-none bg-transparent border-none p-0 cursor-pointer",children:x})),jsx(at,{isOpen:p,onClose:()=>g(false),hideCloseIcon:false,contentPadding:false,maxHeight:"90vh",children:jsxs("div",{className:"flex flex-col h-full",children:[c&&jsx("div",{className:"p-4 border-b border-border-muted flex-shrink-0",children:jsx(Mr,{value:t,onChange:f,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:l,autoFocus:true})}),jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:i})]})})]}):b?null:jsxs(DialogTrigger,{isOpen:p,onOpenChange:g,children:[a||x,jsx(nt,{placement:"bottom",className:"w-[600px] max-w-[90vw] bg-background-surface shadow-xl border border-border-default rounded-lg overflow-hidden",children:jsxs("div",{className:"flex flex-col",children:[c&&jsx("div",{className:"p-4 border-b border-border-muted",children:jsx(Mr,{value:t,onChange:f,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:l,autoFocus:true})}),jsx("div",{className:"max-h-[500px] overflow-hidden",children:i})]})})]})}function Ox({placeholder:e="Search...",value:t,onChange:r,isOpen:o,onOpenChange:n,children:a,maxHeight:i="400px",variant:s="default",className:c}){let[l,d]=useState(false),u=Yt("(max-width: 767px)"),m=useRef(null),p=useRef(null),g=o!==void 0?o:l,f=useCallback(P=>{n?n(P):d(P);},[n]);useEffect(()=>{let P=I=>{(I.metaKey||I.ctrlKey)&&I.key==="k"&&(I.preventDefault(),f(!g)),I.key==="Escape"&&g&&f(false);};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[g,f]),useEffect(()=>{g&&!u&&m.current&&setTimeout(()=>{m.current?.querySelector("input")?.focus();},0);},[g,u]),useEffect(()=>{if(!g||u)return;let P=I=>{let D=I.target,L=m.current?.contains(D),R=p.current?.contains(D);!L&&!R&&f(false);};return document.addEventListener("mousedown",P,true),()=>document.removeEventListener("mousedown",P,true)},[g,u,f]);let x=P=>{r?.(P);},b=useCallback(()=>{f(false);},[f]),h=useCallback(()=>{r?.("");},[r]),[y,v]=useState(null);useEffect(()=>{if(g&&!u&&m.current){let P=null,I=()=>{let L=m.current?.getBoundingClientRect();L&&v({top:L.bottom+8,left:L.left,width:L.width});},D=()=>{P===null&&(P=requestAnimationFrame(()=>{I(),P=null;}));};return I(),window.addEventListener("resize",D),window.addEventListener("scroll",D,true),()=>{window.removeEventListener("resize",D),window.removeEventListener("scroll",D,true),P!==null&&cancelAnimationFrame(P);}}},[g,u]);let S=useCallback(()=>{f(true);},[f]);if(u)return jsxs("div",{className:c,children:[jsx("button",{type:"button",onClick:S,className:"flex items-center justify-center w-10 h-10 rounded-lg hover:bg-background-hover transition-colors","aria-label":"Open search",children:jsx(V,{name:"MagnifyingGlass",size:"md"})}),jsxs(at,{isOpen:g,onClose:b,contentPadding:false,height:"80vh",children:[jsxs("div",{className:"flex items-center gap-2 px-4 pt-4",children:[jsx("div",{className:"flex-1",children:jsx(Mr,{value:t,onChange:x,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:h,reserveErrorSpace:false,autoFocus:true})}),jsx(ee,{variant:"icon",onPress:b,"aria-label":"Close search",className:"flex-shrink-0",children:jsx(V,{name:"X",size:"md"})})]}),jsx("div",{className:"mt-4",children:a})]})]},"mobile");let N=P=>{let D=P.target.tagName==="INPUT";if(P.key==="ArrowDown"&&g&&D){P.preventDefault();let L=p.current?.querySelector("[data-search-result]");L&&L.focus();}},w=P=>{let I=P.target;if(!I.hasAttribute("data-search-result"))return;let L=Array.from(p.current?.querySelectorAll("[data-search-result]")||[]),R=L.indexOf(I);if(P.key==="ArrowDown"){P.preventDefault(),P.stopPropagation();let B=Math.min(R+1,L.length-1);L[B]?.focus();}else if(P.key==="ArrowUp")if(P.preventDefault(),P.stopPropagation(),R===0)m.current?.querySelector("input")?.focus();else {let B=Math.max(R-1,0);L[B]?.focus();}else P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),f(false),m.current?.querySelector("input")?.focus());},M=g&&y&&typeof document<"u"?createPortal(jsx("div",{ref:p,style:{position:"fixed",top:`${y.top}px`,left:`${y.left}px`,width:`${y.width}px`,zIndex:9999},role:"listbox",onKeyDown:w,children:jsx("div",{className:"bg-background-surface shadow-2xl border border-border-default rounded-lg overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:jsx("div",{className:"overflow-y-auto",style:{maxHeight:i},children:a})})}),document.body):null,k=s==="elevated"?"bg-background-muted/50 border-border-subtle/50 focus-within:bg-background-body focus-within:border-border-focus focus-within:shadow-md backdrop-blur-sm transition-all duration-200":"";return jsxs("div",{ref:m,className:`relative w-full ${c||""}`,onKeyDown:N,children:[jsx(Mr,{value:t,onChange:x,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:k,onFocus:()=>f(true)}),M]},"desktop")}function Hx({message:e="No results found",suggestion:t,icon:r="MagnifyingGlass",className:o=""}){return jsxs("div",{className:`flex flex-col items-center justify-center py-12 px-4 text-center ${o}`,children:[jsx("div",{className:"text-text-secondary mb-3",children:jsx(V,{name:r,size:48})}),jsx("p",{className:"text-base font-medium text-text-primary mb-1",children:e}),t&&jsx("p",{className:"text-sm text-text-secondary max-w-xs",children:t})]})}function Gx({count:e=3,className:t=""}){return jsx("div",{className:`flex flex-col ${t}`,children:Array.from({length:e}).map((r,o)=>jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[jsx(K,{width:20,height:20,variant:"circle"}),jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[jsx(K,{width:"60%",height:16}),jsx(K,{width:"40%",height:12})]}),jsx(K,{width:16,height:16})]},o))})}function Kx({title:e,count:t,isLoading:r,footer:o,children:n,className:a}){return jsxs("div",{className:twMerge("flex flex-col",a),children:[jsxs("div",{className:"flex items-baseline gap-1.5 px-4 pt-4 pb-2 border-t border-border-muted first:border-t-0",children:[jsx("h3",{className:"text-sm font-semibold text-text-primary",children:e}),!r&&t!==void 0&&jsx("span",{className:"text-xs text-text-secondary",children:t}),r&&jsx("span",{className:"text-xs text-text-secondary animate-pulse",children:"Loading..."})]}),jsx("div",{className:"flex flex-col",children:n}),o&&jsx("div",{className:"px-4 py-2 border-t border-border-subtle",children:o})]})}function Yx({id:e,title:t,subtitle:r,metadata:o,icon:n,customIcon:a,onSelect:i,isFocused:s=false,className:c,testId:l}){return jsxs("div",{role:"option",tabIndex:0,onClick:()=>{i?.(e);},onKeyDown:m=>{let p=m.currentTarget;switch(m.key){case "Enter":case " ":{m.preventDefault(),i?.(e);break}case "ArrowDown":{m.preventDefault();let g=Array.from(document.querySelectorAll("[data-search-result]")),f=g.indexOf(p);f!==-1&&f<g.length-1&&g[f+1].focus();break}case "ArrowUp":{m.preventDefault();let g=Array.from(document.querySelectorAll("[data-search-result]")),f=g.indexOf(p);if(f>0)g[f-1].focus();else {let x=document.querySelector('input[type="text"][placeholder*="Search"]');x&&x.focus();}break}case "Escape":{m.preventDefault();let g=document.querySelector('input[type="text"][placeholder*="Search"]');g&&g.focus();break}}},"data-testid":l,"data-search-result":true,className:twMerge("group flex items-center gap-3 px-4 py-3 cursor-pointer outline-none transition-colors","text-text-primary hover:bg-background-hover","focus-visible:bg-background-muted focus-visible:outline-none","data-[focused]:bg-background-hover",s&&"bg-background-hover",c),"data-focused":s||void 0,children:[a?jsx("div",{className:"flex-shrink-0",children:a}):n?jsx("div",{className:"flex-shrink-0 text-text-secondary",children:jsx(V,{name:n,size:20})}):null,jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-baseline gap-2",children:[jsx("span",{className:"font-medium text-text-primary truncate",children:t}),o&&jsx("span",{className:"text-xs text-text-secondary flex-shrink-0",children:o})]}),r&&jsx("div",{className:"text-sm text-text-secondary truncate mt-0.5",children:r})]}),jsx("div",{className:"flex-shrink-0 opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 group-data-[focused]:opacity-100 transition-opacity",children:jsx(V,{name:"ArrowRight",size:16,className:"text-text-secondary"})})]})}function Jx({children:e,maxHeight:t="400px",className:r}){return jsx("div",{className:twMerge("overflow-y-auto overscroll-contain","divide-y divide-border-muted",r),style:{maxHeight:t},children:e})}function jx({placeholder:e="Search...",onClick:t,showShortcut:r=true,variant:o="default",className:n=""}){let a=typeof navigator<"u"&&navigator.platform.includes("Mac");return jsxs("button",{type:"button",onClick:t,className:`
|
|
29
29
|
flex items-center gap-3 w-full px-4 py-2.5 rounded-lg
|
|
30
30
|
transition-all duration-200 cursor-text
|