@texturehq/edges 2.6.1 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
`}})]})}function Vo(e,t=300){let[r,o]=Oe.useState(e);return Oe.useEffect(()=>{let n=setTimeout(()=>o(e),t);return ()=>clearTimeout(n)},[e,t]),r}function Ss(e,t=300){let[r,o]=Oe.useState(false);return Oe.useEffect(()=>{if(e){let n=setTimeout(()=>{o(true);},t);return ()=>clearTimeout(n)}o(false);},[e,t]),r}var fS=({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 Zt({children:e,content:t,...r}){return jsxRuntime.jsxs(reactAriaComponents.TooltipTrigger,{delay:200,children:[e,jsxRuntime.jsxs(reactAriaComponents.Tooltip,{...r,offset:10,className:reactAriaComponents.composeRenderProps(r.className,(o,n)=>fS({...n,className:o})),children:[jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.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:jsxRuntime.jsx("path",{d:"M0 0 L4 4 L8 0"})})}),t]})]})}function Pr(){let[e,t]=Oe__namespace.default.useState(false),r=Oe__namespace.default.useCallback((n,a)=>{t(true),a?.(n);},[]),o=Oe__namespace.default.useCallback((n,a)=>{t(false),a?.(n);},[]);return {isFocused:e,handleFocus:r,handleBlur:o}}var yt=Oe__namespace.default.forwardRef(({children:e,className:t},r)=>jsxRuntime.jsx("div",{ref:r,className:tailwindMerge.twMerge("relative w-full",t),children:e}));yt.displayName="InputWrapper";function ni({onClick:e,size:t="md",className:r}){return jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.preventDefault(),o.stopPropagation(),e();},className:tailwindMerge.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:jsxRuntime.jsx(B,{name:"X",size:t==="sm"?16:20})})}function zo(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 hf(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function gS(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 zt(e){let{isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:a="md",className:i}=e;return tailwindMerge.twMerge("w-full",zo({isInvalid:t,isDisabled:r,isFocused:o}),hf({transparent:n,isDisabled:r}),Ge[a].text,Ge[a].height,Ge[a].padding,gS(a),i)}function bS(e){let{size:t="md",isFocusWithin:r,isInvalid:o,isDisabled:n,transparent:a,className:i}=e;return tailwindMerge.twMerge("group flex items-center rounded-[var(--control-border-radius)] overflow-hidden",hf({transparent:a,isDisabled:n}),Ge[t].height,zo({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=jsxRuntime.jsxs("label",{htmlFor:s,className:tailwindMerge.twMerge(Ge[t].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,a&&jsxRuntime.jsx("span",{children:"*"}),c&&jsxRuntime.jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsxRuntime.jsx(B,{name:"Info",size:t==="sm"?16:20})}),d&&jsxRuntime.jsx("span",{className:"text-text-secondary font-normal ml-1",children:o})]});return c&&l?jsxRuntime.jsx(Zt,{content:l,children:u}):u}function Te({size:e="md",className:t,children:r,...o}){return jsxRuntime.jsx("div",{...o,className:tailwindMerge.twMerge("leading-[2.25] text-text-secondary",Ge[e].text,t),children:r})}function be({children:e,size:t="md",className:r}){return jsxRuntime.jsx("div",{role:"alert",className:tailwindMerge.twMerge(Ge[t].text,"text-feedback-error-text",r),children:e})}function Ns({size:e="md",isInvalid:t,isDisabled:r,isFocused:o,transparent:n,className:a,...i}){return jsxRuntime.jsx("input",{className:zt({isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:e,className:a}),...i})}function yf(e){let{children:t,...r}=e;return jsxRuntime.jsx("div",{...r,className:bS(e),children:typeof t=="function"?t(e):t})}var Ad=Oe.createContext("md");function Nf(){return Oe.useContext(Ad)}function Ed(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 ${Ge[e].text} ${t}`}function SS(){let e=Oe__namespace.default.useCallback((r,o)=>{o?.(r);},[]),t=Oe__namespace.default.useCallback((r,o)=>{o?.(r);},[]);return {handleFocus:e,handleBlur:t}}function bo({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:h=false,placement:b="bottom start",shouldFlip:x=true,menuWidth:y="match",descriptionPlacement:v="below",useMobileTray:S=true,...w}){let[N,M]=Oe.useState(null),[k,T]=Oe.useState(null),[A,E]=Oe.useState(false),D=c??N??l,{handleFocus:R,handleBlur:H}=SS(),{isMobile:G}=Xt(),K=S&&G,W=Oe__namespace.default.useMemo(()=>!i||!D||!n?null:Array.from(n).find(Y=>Y.id===D)??null,[i,D,n]),q=L=>{d&&L!==null&&d(L),d||M(L);},j=Oe.useRef(null),Q=Oe.useRef(null),O=()=>{K&&E(!A);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.Select,{...w,selectedKey:D,defaultSelectedKey:l,onSelectionChange:q,placeholder:u,className:ke(w.className,"group flex w-full flex-col"),ref:j,onOpenChange:L=>{K||(L&&Q.current?T(Q.current.offsetWidth):L||j.current?.blur());},children:({isDisabled:L,isInvalid:Y,isOpen:P})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(ze,{size:s,tooltip:p,description:v==="tooltip"||v==="inline"?t:void 0,descriptionPlacement:v,isRequired:g,children:e}),jsxRuntime.jsx(yt,{children:jsxRuntime.jsx("div",{ref:Q,children:jsxRuntime.jsxs(_,{variant:"unstyled",className:tailwindMerge.twMerge(zt({isInvalid:Y||m&&!!r,isDisabled:L,isFocused:K?A:P,transparent:f,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:C=>R(C,w.onFocus),onBlur:C=>H(C,w.onBlur),onPress:K?O:void 0,"data-open":K?A:P,children:[i&&W?jsxRuntime.jsx("div",{className:Ed(s),children:i(W)}):K&&D?jsxRuntime.jsx("div",{className:Ed(s),children:n?Array.from(n).find(F=>F.id===D)?.label:String(D)}):jsxRuntime.jsx(reactAriaComponents.SelectValue,{className:Ed(s)}),jsxRuntime.jsx(B,{name:"CaretDown","aria-hidden":true,className:tailwindMerge.twMerge("h-4 w-4 text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] transition-transform",(K?A:P)&&"rotate-180")})]})})}),h?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:m?jsxRuntime.jsx(be,{size:s,className:"text-feedback-error-text",children:typeof r=="function"&&w.validationResult?r(w.validationResult):typeof r=="string"?r:null}):t&&v==="below"?jsxRuntime.jsx(Te,{size:s,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:m?jsxRuntime.jsx(be,{size:s,className:"mt-1 text-feedback-error-text",children:typeof r=="function"&&w.validationResult?r(w.validationResult):typeof r=="string"?r:null}):t&&v==="below"?jsxRuntime.jsx(Te,{size:s,className:"mt-1",children:t}):null}),K?null:jsxRuntime.jsx(lt,{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:x,children:jsxRuntime.jsx(Ad.Provider,{value:"md",children:jsxRuntime.jsx(reactAriaComponents.ListBox,{items:n,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:a&&n?C=>jsxRuntime.jsx(_t,{id:C.id,textValue:C.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(C)})},C.id):o})})})]})}),K&&jsxRuntime.jsx(ct,{isOpen:A,onClose:()=>E(false),title:e??"Select an option",contentPadding:false,children:jsxRuntime.jsx(Ad.Provider,{value:"md",children:jsxRuntime.jsx(reactAriaComponents.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:D!=null?[D]:[],onSelectionChange:L=>{let Y=Array.from(L)[0];Y!=null&&(q(Y),E(false));},children:a&&n?L=>jsxRuntime.jsx(_t,{id:L.id,textValue:L.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(L)})},L.id):o})})})]})}function _t({size:e,className:t,...r}){let o=Nf(),n=e??o;return jsxRuntime.jsx(reactAriaComponents.ListBoxItem,{...r,className:tailwindMerge.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",Ge[n].paddingY,Ge[n].text,t)})}var IS=[],FS={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},BS={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Tf={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 VS(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 zS(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 Ps({label:e,staticItems:t=IS,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:h,showErrors:b=true,renderItem:x,renderLeftIcon:y,renderSection:v,autoFocus:S=false,reserveErrorSpace:w=false,hideChevron:N=false,useMobileTray:M=true,className:k}){let T=Oe__namespace.default.useRef(null),A=Oe__namespace.default.useRef(null),[E,D]=Oe__namespace.default.useState(),[R,H]=Oe.useState(()=>Fd(o||n,t,r)),[G,K]=Oe.useState(false),[W,q]=Oe.useState(false),j=Vo(R),{contains:Q}=reactAria.useFilter({sensitivity:"base"}),[O,L]=Oe.useState(),{isMobile:Y}=Xt(),P=M&&Y,C=Ge[u].text,I=reactStately.useAsyncList({async load({signal:re,filterText:de=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(de))return {items:[]};try{let xe;return i.requestType==="GraphQL"?xe=await zS(i,de,re):xe=await VS(i,de,re),L(xe.error),{items:xe.items}}catch(xe){return xe instanceof Error&&xe.name==="AbortError"?{items:[]}:(console.error("Error loading items:",xe),L(xe instanceof Error?xe.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),F=i&&j!==""?I:null,U=false,$=Oe.useRef("");Oe.useEffect(()=>{S&&K(true);},[S]),Oe.useEffect(()=>{let re=Fd(o,t,r);re!==R&&H(re);},[o,t,r]),Oe.useEffect(()=>{let re=()=>{T.current&&D(T.current.offsetWidth);};return re(),window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[]),Oe.useEffect(()=>{j===""?$.current="":F&&j!==$.current&&($.current=j,F.setFilterText(j));},[j,F]),U=Ss(!!F?.isLoading,300);let ae=Oe__namespace.default.useMemo(()=>{if(!P||!R)return F?F.items:t;let re=F?F.items:t,de=s??(i?()=>true:Q);return re.filter(xe=>de(xe.name,R))},[P,R,F,t,s,Q]),Z=re=>{let de=Fd(re,t,r);H(de),a&&a(re);},ie=re=>{H(re);},fe=()=>{P&&q(true);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.ComboBox,{onSelectionChange:Z,selectedKey:o||void 0,defaultSelectedKey:n||void 0,items:F?F.items:r?r.flatMap(re=>re.items):t,className:ke(k,"group flex flex-col w-full"),menuTrigger:P?"manual":i?"input":"focus",allowsEmptyCollection:!!i,isDisabled:g,isInvalid:f||!!l,inputValue:R,onInputChange:ie,autoFocus:S&&!P,defaultFilter:s??(i?()=>true:Q),"aria-label":e||c||"Autocomplete",children:re=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(ze,{size:u,tooltip:m,isRequired:p,children:e}),jsxRuntime.jsxs(yt,{ref:T,children:[y?jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:y(U)}):jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:U?jsxRuntime.jsx(go,{size:16,color:"text-text-secondary"}):jsxRuntime.jsx(B,{name:"MagnifyingGlass",className:`${FS[u]} text-text-secondary`})}),jsxRuntime.jsx(reactAriaComponents.Input,{className:zt({isInvalid:f||!!l,isDisabled:g,isFocused:G||(P?W:re.isOpen),size:u,className:tailwindMerge.twMerge(BS[u],R&&!g||!N&&!R?"pr-10":"pr-3",P&&"cursor-pointer",k)}),placeholder:c,disabled:g,onFocus:de=>{K(true),P&&(de.currentTarget.blur(),fe());},onBlur:()=>{K(false);},onClick:P?fe:void 0,readOnly:P,"aria-label":e||c||"Autocomplete"}),R&&!g&&jsxRuntime.jsx(ni,{onClick:()=>{H(""),a?.(null);},size:u}),!N&&!R&&jsxRuntime.jsx(reactAriaComponents.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:de})=>jsxRuntime.jsx(B,{name:de?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),w?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:b&&O?jsxRuntime.jsx(be,{size:u,className:"text-feedback-error-text",children:O}):b&&typeof l=="string"?jsxRuntime.jsx(be,{size:u,className:"text-feedback-error-text",children:l}):b&&typeof l=="function"&&h?jsxRuntime.jsx(be,{size:u,className:"text-feedback-error-text",children:l(h)}):d?jsxRuntime.jsx(Te,{size:u,children:d}):null}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d&&jsxRuntime.jsx(Te,{size:u,className:"mt-1",children:d}),b&&O&&jsxRuntime.jsx(be,{size:u,className:"text-feedback-error-text mt-1",children:O}),b&&typeof l=="string"&&jsxRuntime.jsx(be,{size:u,className:"text-feedback-error-text mt-1",children:l}),b&&typeof l=="function"&&h&&jsxRuntime.jsx(be,{size:u,className:"text-feedback-error-text mt-1",children:l(h)})]}),!P&&jsxRuntime.jsx(lt,{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:E?`${E}px`:void 0,zIndex:9999},children:jsxRuntime.jsx(reactAriaComponents.ListBox,{"aria-label":e||c||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${C}`,children:r?r.map(de=>{let xe=de.items.map(he=>jsxRuntime.jsx(_t,{id:he.id,textValue:he.name,size:u,className:`flex cursor-default items-center gap-2 px-3 ${Tf[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:x?x(he):he.name},he.id));if(v){let he=v(de,xe);return Oe__namespace.default.isValidElement(he)&&he.type===reactAriaComponents.ListBoxSection?he:jsxRuntime.jsx(reactAriaComponents.ListBoxSection,{children:he},de.name)}return jsxRuntime.jsxs(reactAriaComponents.ListBoxSection,{children:[jsxRuntime.jsx(reactAriaComponents.Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:de.name}),xe]},de.name)}):de=>jsxRuntime.jsx(_t,{id:de.id,textValue:de.name,size:u,className:`flex cursor-default items-center gap-2 px-3 ${Tf[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:x?x(de):de.name},de.id)})})]})}),P&&jsxRuntime.jsx(ct,{isOpen:W,onClose:()=>q(false),title:e??c??"Search",contentPadding:false,height:"80vh",children:jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsx("div",{className:"p-4 border-b border-border-default",children:jsxRuntime.jsxs(yt,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:U?jsxRuntime.jsx(go,{size:16,color:"text-text-secondary"}):jsxRuntime.jsx(B,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsxRuntime.jsx("input",{ref:A,type:"text",value:R,onChange:re=>ie(re.target.value),placeholder:c,autoFocus:true,className:zt({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),R&&jsxRuntime.jsx(ni,{onClick:()=>{H(""),a?.(null);},size:"md"})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsx(reactAriaComponents.ListBox,{"aria-label":e||c||"Suggestions",items:ae,selectedKeys:o?[o]:[],selectionMode:"single",onSelectionChange:re=>{let de=Array.from(re)[0];de&&(Z(de),q(false));},className:"bg-background-input outline-none",children:re=>jsxRuntime.jsx(_t,{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:x?x(re):re.name},re.id)})})]})})]})}function xo({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]=Oe.useState(false),f=Oe.useCallback(()=>g(true),[]);Oe.useEffect(()=>{g(false);},[e]);let h={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"},x={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",w=tailwindMerge.twMerge("relative inline-flex items-center justify-center overflow-hidden transition-opacity outline-none",h[i],S,a&&"cursor-pointer hover:opacity-80",u&&"ring-2 ring-background-surface",l),M=(()=>{if(r||o){let E=r?.[0]||"",D=o?.[0]||"";return (E+D).toUpperCase()}if(n){let E=n.split(" "),D=E[0]?.[0]||"",R=E[E.length-1]?.[0]||"";return D===R?D.toUpperCase():(D+R).toUpperCase()}return ""})(),k=()=>{let E={xs:14,sm:16,md:20,lg:24,xl:32}[i];switch(c){case "team":return jsxRuntime.jsx(lucideReact.Users,{size:E});case "organization":return jsxRuntime.jsx(lucideReact.Building2,{size:E});default:return jsxRuntime.jsx(lucideReact.User,{size:E})}},T=E=>{if(m)return c==="organization"?E?"organization-logo":"initials":E?"avatar":"initials"},A=()=>e&&!p?jsxRuntime.jsx("img",{src:e,alt:t||n||"Avatar",className:"h-full w-full object-cover",onError:f,"data-pii-type":T(true),"data-pii-entity":m}):M?jsxRuntime.jsx("span",{className:"font-semibold","data-pii-type":T(false),"data-pii-entity":m,children:M}):k();return jsxRuntime.jsxs("div",{className:"relative inline-block",children:[jsxRuntime.jsx("div",{"data-avatar":true,className:tailwindMerge.twMerge(w,!e||p?v[c]:""),onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,children:A()}),d&&jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("absolute border-2 border-background-surface",S,b[i],x[i],y[d]),"aria-label":`Status: ${d}`})]})}var JS={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"},XS={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"},jS={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"},qS={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 nt({children:e,variant:t="default",size:r="sm",shape:o="square",dot:n=false,dotPosition:a="left",dotPulse:i=false,title:s,className:c}){let l=n&&jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("rounded-full bg-current opacity-75",qS[r],i&&"animate-pulse"),"aria-hidden":"true"});return jsxRuntime.jsxs("span",{title:s,className:tailwindMerge.twMerge("inline-flex items-center gap-1.5 font-medium",XS[r],jS[o],JS[t],c),children:[n&&a==="left"&&l,e,n&&a==="right"&&l]})}var Ze=({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=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t,l&&jsxRuntime.jsxs("span",{children:["\xA0","\u2192"]})]});return s?jsxRuntime.jsx("button",{type:"button",className:v,onClick:c,title:n,...g,children:S}):u&&e?jsxRuntime.jsx(u,{href:e,className:v,title:n,onClick:i,...f,...g,children:S}):jsxRuntime.jsx("a",{href:e||"#",className:v,...f,...g,title:n,onClick:i,children:S})};var aw={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:lucideReact.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:lucideReact.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:lucideReact.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:lucideReact.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:lucideReact.Lightbulb}};function Ms({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=aw[e],p=m[t],g=m.icon,f=!!(i||s),h=!!(r||o);return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex gap-3 rounded-sm border p-4",p.container,d),role:"region","aria-live":"polite","data-testid":u,children:[!l&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0",p.iconColor),"aria-hidden":"true",children:c||jsxRuntime.jsx(g,{className:"h-5 w-5"})}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:[h&&jsxRuntime.jsxs("div",{className:"flex-1",children:[r&&jsxRuntime.jsx("div",{className:jt(gt("headingSm"),p.titleColor),children:r}),o&&jsxRuntime.jsx("div",{className:jt(gt("bodySm"),r?"mt-1":"",p.bodyColor),children:o})]}),f&&jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i&&(i.asLink?jsxRuntime.jsx(Ze,{asButton:true,onPress:i.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-text-inverse hover:text-text-inverse/80":"",children:i.label}):jsxRuntime.jsx(_,{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?jsxRuntime.jsx(Ze,{asButton:true,onPress:s.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-text-inverse hover:text-text-inverse/80":"",children:s.label}):jsxRuntime.jsx(_,{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&&jsxRuntime.jsx("button",{type:"button",onClick:a,className:tailwindMerge.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,Je()),"aria-label":"Dismiss banner",children:jsxRuntime.jsx(lucideReact.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 jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Ms,{...o,className:a})})})}function xa(){let[e,t]=Oe.useState({width:0,height:0}),r=Oe.useRef(null),o=Oe.useRef(void 0),n=Oe.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 Oe.useEffect(()=>()=>{o.current&&cancelAnimationFrame(o.current),r.current&&r.current.disconnect();},[]),{ref:n,width:e.width,height:e.height}}function Oo({value:e,children:t,className:r,size:o="sm",iconPosition:n="right"}){let[a,i]=Oe.useState(false),l=jsxRuntime.jsx(_,{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:jsxRuntime.jsx(B,{name:"Copy",size:o==="sm"?14:16})}),d=a?jsxRuntime.jsx(Zt,{content:"Copied!",children:l}):l;return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("inline-flex items-center gap-0.5",r),children:[n==="left"&&d,t,n==="right"&&d]})}function Es(e){let{children:t,maxWidth:r=600,className:o,...n}=e,{ref:a,width:i}=xa(),[s,c]=Oe__namespace.default.useState(false),[l,d]=Oe__namespace.default.useState(false),u=Oe__namespace.default.useRef(false),m=Oe__namespace.default.useMemo(()=>t&&!e.items&&typeof t!="function"?Oe__namespace.default.Children.toArray(t):null,[t,e.items]);if(Oe__namespace.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),h=g.map(b=>{if(Oe__namespace.default.isValidElement(b)){let x=b.props;if(typeof x.children=="string")return {label:x.children,href:x.href}}return {label:"..."}});return jsxRuntime.jsxs(reactAriaComponents.Breadcrumbs,{...n,ref:a,className:tailwindMerge.twMerge("flex gap-2",l?"opacity-100":"opacity-0",o),children:[p,jsxRuntime.jsx(fw,{items:h}),f]})}return jsxRuntime.jsx(reactAriaComponents.Breadcrumbs,{...n,ref:a,className:tailwindMerge.twMerge("flex gap-2",l?"opacity-100":"opacity-0",o),children:t})}function fw({items:e}){let t=e.map((r,o)=>({id:`breadcrumb-${o}`,name:r.label,href:r.href}));return jsxRuntime.jsx(reactAriaComponents.Breadcrumb,{className:"flex items-center gap-2",children:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(fa,{items:t,align:"left",size:"sm",children:jsxRuntime.jsx(_,{variant:"icon",size:"sm",icon:"DotsThree","aria-label":"Show hidden breadcrumbs",className:"px-0.5"})}),jsxRuntime.jsx(lucideReact.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 jsxRuntime.jsx(reactAriaComponents.Breadcrumb,{className:ke(t,"flex items-center gap-2"),...i,children:s=>{let c=s.isCurrent,l=typeof r=="function"?r(s):r;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?n?jsxRuntime.jsx(Oo,{value:a||(typeof l=="string"?l:void 0),size:"sm",iconPosition:"right",children:jsxRuntime.jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-primary sm:max-w-none",children:l})}):jsxRuntime.jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-primary sm:max-w-none",children:l}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ze,{variant:"muted",href:o,className:"max-w-[150px] truncate sm:max-w-[300px] md:max-w-none",children:l}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-4 w-4 shrink-0 text-text-secondary"})]})})}})}function Nw({isSelected:e,isDisabled:t}){let r=[Je,"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 ha({errorMessage:e,...t}){return jsxRuntime.jsxs(reactAriaComponents.Calendar,{...t,children:[jsxRuntime.jsx(Ls,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(As,{}),jsxRuntime.jsx(reactAriaComponents.CalendarGridBody,{children:r=>jsxRuntime.jsx(reactAriaComponents.CalendarCell,{date:r,className:({isSelected:o,isDisabled:n})=>`${Nw({isSelected:o,isDisabled:n})} border-0`})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function Ls(){let{direction:e}=reactAriaComponents.useLocale(),t=18;return jsxRuntime.jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsxRuntime.jsx(_,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsxRuntime.jsx(B,{name:"CaretRight","aria-hidden":true,size:t}):jsxRuntime.jsx(B,{name:"CaretLeft","aria-hidden":true,size:t})}),jsxRuntime.jsx(reactAriaComponents.Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsxRuntime.jsx(_,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsxRuntime.jsx(B,{name:"CaretLeft","aria-hidden":true,size:t}):jsxRuntime.jsx(B,{name:"CaretRight","aria-hidden":true,size:t})})]})}function As(){return jsxRuntime.jsx(reactAriaComponents.CalendarGridHeader,{children:e=>jsxRuntime.jsx(reactAriaComponents.CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}var Vf=Oe__namespace.createContext(null);function Ho(){let e=Oe__namespace.useContext(Vf);if(!e)throw new Error("Carousel components must be used within a CarouselRoot");return e}function zf({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,h]=Oe__namespace.useState(t),b=g?e:f,x=Oe__namespace.useRef(null),[y,v]=Oe__namespace.useState(0),[S,w]=Oe__namespace.useState(typeof a=="boolean"?a:!!a),[N,M]=Oe__namespace.useState(false),k=Oe__namespace.useRef(null),T=Oe__namespace.useRef(null),A=typeof a=="object"&&a!==null&&a.delay?a.delay:i;Oe__namespace.useEffect(()=>{if(x.current){let C=Math.max(1,Math.floor(Number(l)||1)),I=x.current.children;if(I.length===0){v(0);return}let F=Math.ceil(I.length/C);v(F);}},[m,l]);let E=Oe__namespace.useRef(-1);Oe__namespace.useEffect(()=>{if(b!==E.current&&x.current){let C=Array.from(x.current.children);if(C.length===0)return;let I=b*l,F=Math.min(I,C.length-1),U=C[F];U&&typeof U.scrollIntoView=="function"&&(U.scrollIntoView({behavior:"smooth",block:o==="vertical"?"start":"nearest",inline:o==="horizontal"?"start":"nearest"}),E.current=b);}},[b,l,o]);let D=Oe__namespace.useCallback(C=>{let I=C;n?I<0?I=y-1:I>=y&&(I=0):I=Math.max(0,Math.min(C,y-1)),g||h(I),r?.(I);},[g,n,r,y]),R=Oe__namespace.useCallback(()=>{D(b+d);},[b,D,d]),H=Oe__namespace.useCallback(()=>{D(b-d);},[b,D,d]),G=Oe__namespace.useRef(R);Oe__namespace.useEffect(()=>{G.current=R;},[R]);let K=y>0&&(n||b<y-1),W=y>0&&(n||b>0),q=Oe__namespace.useCallback(()=>{w(C=>!C);},[]);Oe__namespace.useEffect(()=>{if(S&&y>1)return k.current=setInterval(()=>{G.current();},A),()=>{k.current&&(clearInterval(k.current),k.current=null);}},[S,y,A]);let j=Oe__namespace.useCallback(()=>{k.current&&(clearInterval(k.current),k.current=null);},[]),Q=Oe__namespace.useCallback(()=>{S&&y>1&&(k.current=setInterval(()=>{G.current();},A));},[S,y,A]),O=Oe__namespace.useCallback(C=>{if(!s)return;M(true);let I="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientX:"clientX"in C?C.clientX:0,F="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientY:"clientY"in C?C.clientY:0;T.current={x:I,y:F};},[s]),L=Oe__namespace.useCallback(C=>{if(!N||!T.current)return;let I="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientX:"clientX"in C?C.clientX:0,F="touches"in C&&C.touches&&C.touches.length>0?C.touches[0].clientY:"clientY"in C?C.clientY:0,U=I-T.current.x,$=F-T.current.y,ae=50;o==="horizontal"&&Math.abs(U)>ae?(U>0?H():R(),M(false),T.current=null):o==="vertical"&&Math.abs($)>ae&&($>0?H():R(),M(false),T.current=null);},[N,o,R,H]),Y=Oe__namespace.useCallback(()=>{M(false),T.current=null;},[]),P={currentPage:b,totalPages:y,orientation:o,loop:n,spacing:c,slidesPerView:l,goToPage:D,goToNext:R,goToPrev:H,canGoNext:K,canGoPrev:W,isAutoplayActive:S,toggleAutoplay:q,itemsRef:x,isDragging:N,allowMouseDrag:s,handleDragStart:O,handleDragMove:L,handleDragEnd:Y};return jsxRuntime.jsx(Vf.Provider,{value:P,children:jsxRuntime.jsx("div",{...p,className:tailwindMerge.twMerge("relative w-full",o==="vertical"?"h-full":"",u),onMouseEnter:j,onMouseLeave:Q,children:m})})}function Of({className:e,children:t,...r}){let{itemsRef:o,orientation:n,spacing:a,isDragging:i,allowMouseDrag:s,handleDragStart:c,handleDragMove:l,handleDragEnd:d}=Ho();return jsxRuntime.jsx("div",{ref:o,...r,className:tailwindMerge.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 Hf({index:e,className:t,children:r,...o}){let{orientation:n,slidesPerView:a}=Ho();return jsxRuntime.jsx("div",{...o,"data-index":e,className:tailwindMerge.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 Wf({className:e,children:t,...r}){return jsxRuntime.jsx("div",{...r,className:tailwindMerge.twMerge("flex items-center justify-center gap-4 mt-4",e),children:t})}function Gf({className:e,children:t,...r}){let{goToPrev:o,canGoPrev:n}=Ho();return jsxRuntime.jsx("button",{type:"button",...r,onClick:a=>{o(),r.onClick?.(a);},disabled:!n||r.disabled,"aria-label":"Previous slide",className:tailwindMerge.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||jsxRuntime.jsx(B,{name:"CaretLeft",size:"sm"})})}function Uf({className:e,children:t,...r}){let{goToNext:o,canGoNext:n}=Ho();return jsxRuntime.jsx("button",{type:"button",...r,onClick:a=>{o(),r.onClick?.(a);},disabled:!n||r.disabled,"aria-label":"Next slide",className:tailwindMerge.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||jsxRuntime.jsx(B,{name:"CaretRight",size:"sm"})})}function Ud({index:e,className:t,children:r,...o}){let{currentPage:n,goToPage:a}=Ho(),i=n===e;return jsxRuntime.jsx("button",{type:"button",...o,onClick:s=>{a(e),o.onClick?.(s);},"aria-label":`Go to slide ${e+1}`,"aria-current":i,className:tailwindMerge.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 Kf({className:e,...t}){let{totalPages:r}=Ho();return jsxRuntime.jsx("div",{...t,className:tailwindMerge.twMerge("flex items-center gap-2",e),role:"group","aria-label":"Carousel indicators",children:Array.from({length:r},(o,n)=>jsxRuntime.jsx(Ud,{index:n},n))})}function Yf({className:e,children:t,...r}){let{isAutoplayActive:o,toggleAutoplay:n}=Ho();return jsxRuntime.jsx("button",{type:"button",...r,onClick:a=>{n(),r.onClick?.(a);},"aria-label":o?"Pause autoplay":"Start autoplay",className:tailwindMerge.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||jsxRuntime.jsx(B,{name:o?"Pause":"Play",size:"sm"})})}function Jf({className:e,...t}){let{currentPage:r,totalPages:o}=Ho();return jsxRuntime.jsxs("div",{...t,className:tailwindMerge.twMerge("text-sm text-text-secondary tabular-nums",e),"aria-live":"polite","aria-atomic":"true",children:[r+1," / ",o]})}var Dw="focus:ring-action-primary",Lw="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 jsxRuntime.jsxs(reactAriaComponents.CheckboxGroup,{...e,className:ke(e.className,"flex flex-col gap-2"),children:[jsxRuntime.jsx(ze,{children:e.label}),e.children,e.description&&jsxRuntime.jsx(Te,{children:e.description}),jsxRuntime.jsx(be,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Aw({isDisabled:e}){return `relative flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function Iw({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=Dw,i="";return r?i="border-border-muted bg-background-muted":t?i="border-feedback-error-border bg-feedback-error-background":e||o?i=Lw:i="bg-background-input border-border-input hover:border-border-focus",`${n} ${a} ${i}`}var Xf="w-4 h-4 text-current group-disabled:text-text-disabled";function Sn(e){let{children:t,variant:r,...o}=e;return jsxRuntime.jsx(reactAriaComponents.Checkbox,{...o,className:reactAriaComponents.composeRenderProps(e.className,(n,a)=>`${Aw(a)} ${n||""}`),children:n=>{let{isSelected:a,isIndeterminate:i,...s}=n,c=jsxRuntime.jsx("div",{className:Iw({isSelected:a,isIndeterminate:i,...s}),children:i?jsxRuntime.jsx(lucideReact.Minus,{"aria-hidden":true,className:Xf}):a?jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":true,className:Xf}):null});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,typeof t=="function"?t(n):t]})}})}var Vw={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 zw={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"},Ow="opacity-75 cursor-not-allowed pointer-events-none";function Qf(e){let{variant:t,size:r,isDisabled:o,isClickable:n,className:a}=e,i=r==="xs"?"text-xs":Ge[r].text;return tailwindMerge.twMerge("inline-flex items-center justify-center rounded-full font-medium transition-colors","whitespace-nowrap select-none",zw[r],i,Vw[t],n&&!o&&"cursor-pointer",o&&Ow,a)}function eo({children:e,onRemove:t,removeLabel:r="Remove",size:o="md",variant:n="secondary",isRemovable:a=true,isDisabled:i=false,className:s,onClick:c}){let l=!!c&&!i,d=a&&t&&!i,u=h=>{h.stopPropagation(),h.preventDefault(),t&&!i&&t();},m=()=>{c&&!i&&c();},p=o==="xs"?10:o==="sm"?12:o==="md"?14:16,f=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate",children:e}),d?l?jsxRuntime.jsx("span",{onClick:u,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u(h));},role:"button",tabIndex:0,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":r,title:r,children:jsxRuntime.jsx(B,{name:"X",size:p,className:"text-current opacity-70 hover:opacity-100"})}):jsxRuntime.jsx("button",{type:"button",onClick:u,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":r,title:r,tabIndex:-1,children:jsxRuntime.jsx(B,{name:"X",size:p,className:"text-current opacity-70 hover:opacity-100"})}):null]});return l?jsxRuntime.jsx("button",{type:"button",onClick:m,className:Qf({variant:qf(n),size:o,isDisabled:i,isClickable:l,className:s}),disabled:i,children:f}):jsxRuntime.jsx("span",{className:Qf({variant:qf(n),size:o,isDisabled:i,isClickable:l,className:s}),children:f})}function $f({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:h}){let[b,x]=Oe.useState(""),[y,v]=Oe.useState([]),[S,w]=Oe.useState(false),[N,M]=Oe.useState(false),[k,T]=Oe.useState(-1),A=Vo(b,300),E=Oe.useRef(null),D=Oe.useRef(null),{isFocused:R,handleFocus:H,handleBlur:G}=Pr(),K=Oe.useId(),W=Oe.useCallback(P=>{if(!u||!P.trim())return;let C=P.trim();if(d.includes(C)){x(""),M(false),v([]),T(-1);return}u([...d,C]),x(""),M(false),v([]),T(-1),E.current?.focus();},[d,u]),q=Oe.useCallback(P=>{u&&u(d.filter(C=>C!==P));},[d,u]);Oe.useEffect(()=>{if(!p)return;let P=true;return (async()=>{let I=A.trim();if(!I){P&&(w(false),v([]),M(false));return}w(true);try{let F=await p(I);if(!P)return;v(F),M(!0);}catch(F){if(!P)return;console.error("Error fetching suggestions:",F),v([]),M(false);}finally{P&&w(false);}})(),()=>{P=false;}},[A,p]),Oe.useEffect(()=>{if(p||!m)return;if(!A.trim()){v([]),M(false);return}let P=m.filter(C=>C.name.toLowerCase().includes(A.toLowerCase())).map(C=>C.id);v(P),M(P.length>0||A.trim().length>0);},[A,m,p]);let j=Oe.useMemo(()=>{let P=y.filter(C=>!d.includes(C));return b.trim()&&!P.includes(b.trim())&&!d.includes(b.trim())?[...P,`Create tag: "${b.trim()}"`]:P},[y,b,d]),Q=Oe.useCallback(P=>{x(P.target.value),T(-1),P.target.value&&M(true);},[]),O=Oe.useCallback(P=>{i||(P.startsWith("Create tag:")?W(b):W(P));},[W,b,i]),L=Oe.useCallback(P=>{if(!i)switch(P.key){case "Enter":case ",":if(P.preventDefault(),k>=0&&k<j.length){let C=j[k];C.startsWith("Create tag:")?W(b):W(C);}else b.trim()&&W(b.trim());break;case "Backspace":!b&&d.length>0&&(P.preventDefault(),q(d[d.length-1]));break;case "ArrowDown":P.preventDefault(),N&&T(C=>C<j.length-1?C+1:C);break;case "ArrowUp":P.preventDefault(),N&&T(C=>C>0?C-1:-1);break;case "Escape":M(false),T(-1);break}},[i,b,d,j,k,N,W,q]);Oe.useEffect(()=>{let P=C=>{D.current&&C.target instanceof Node&&!D.current.contains(C.target)&&M(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);let Y=()=>tailwindMerge.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]",zo({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 jsxRuntime.jsxs("div",{ref:D,className:tailwindMerge.twMerge("relative flex flex-col gap-1",h),children:[e&&jsxRuntime.jsx(ze,{size:o,tooltip:n,isRequired:a,children:e}),jsxRuntime.jsx(yt,{children:jsxRuntime.jsxs("div",{className:Y(),onClick:()=>!i&&E.current?.focus(),children:[d.map(P=>jsxRuntime.jsx(eo,{variant:g,size:"xs",onRemove:()=>q(P),isDisabled:i,className:"shrink-0 max-h-full",children:P},P)),jsxRuntime.jsx("input",{ref:E,type:"text",role:"combobox","aria-expanded":N,"aria-haspopup":"listbox","aria-controls":K,"aria-autocomplete":"list",value:b,onChange:Q,onKeyDown:L,onFocus:P=>H(P),onBlur:P=>G(P),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"}})]})}),N&&(b||j.length>0)&&jsxRuntime.jsx("div",{id:K,role:"listbox",className:tailwindMerge.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?jsxRuntime.jsx("div",{className:"px-3 py-2 text-sm text-text-secondary",children:"Loading..."}):j.length>0?j.map((P,C)=>jsxRuntime.jsx("div",{role:"option","aria-selected":C===k,className:tailwindMerge.twMerge("cursor-pointer px-3 py-2 text-sm transition-colors","hover:bg-background-hover",C===k&&"bg-background-selected",P.startsWith("Create tag:")&&"italic text-text-secondary"),onClick:()=>O(P),children:P},P)):b&&jsxRuntime.jsx("div",{className:"px-3 py-2 text-sm text-text-secondary",children:"No suggestions found"})}),t&&jsxRuntime.jsx(Te,{size:o,className:"mt-1",children:t}),f&&typeof r=="string"&&jsxRuntime.jsx(be,{size:o,className:"text-feedback-error-text mt-1",children:r}),f&&typeof r=="function"&&c&&jsxRuntime.jsx(be,{size:o,className:"text-feedback-error-text mt-1",children:r(c)})]})}var qw={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')},Qw={github:()=>import('ace-builds/src-noconflict/theme-github'),github_dark:()=>import('ace-builds/src-noconflict/theme-github_dark')},Zw={"ext-language-tools":()=>import('ace-builds/src-noconflict/ext-language_tools')},li=new Set;async function Jd(e,t){li.has(e)||(await t(),li.add(e));}async function _w(e,t,r){await Promise.all([Jd(`language:${e}`,qw[e]),Jd(`theme:${t}`,Qw[t]),r?Jd("extension:language-tools",Zw["ext-language-tools"]):void 0]);}function tg(e,t,r){let o=li.has(`language:${e}`)&&li.has(`theme:${t}`);return r?o&&li.has("extension:language-tools"):o}function rg({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=Oe.useRef(null),[h,b]=Oe.useState(()=>tg(o,n,!t)),x=Oe.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 Oe.useEffect(()=>{let y=false,v=!t;return tg(o,n,v)?(b(true),()=>{y=true;}):(b(false),_w(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]),Oe.useEffect(()=>{h&&f.current?.editor&&f.current.editor.resize();},[x,h]),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden rounded-md border border-border-input",s),style:{width:i,height:x},children:h?jsxRuntime.jsx(Xw__default.default,{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}}):jsxRuntime.jsx("div",{className:"flex h-full w-full items-center justify-center bg-surface-muted text-foreground-muted",children:"Loading editor\u2026"})})}var ng=Oe__namespace.createContext({variant:"contained",density:"comfortable",showDividers:true}),ag=Oe__namespace.createContext(null),oN={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"},og={true:"divide-y divide-border-default",false:"gap-3"},nN={comfortable:"px-5 py-3",compact:"px-4 py-2.5"},aN={comfortable:"px-5 pt-0",compact:"px-4 pt-0"},iN={comfortable:"h-4 w-4",compact:"h-3.5 w-3.5"};function Qd(){return Oe__namespace.useContext(ng)}function sN(e){let t=Oe__namespace.useContext(ag);if(!t)throw new Error(`${e} must be used within a <CollapseItem>`);return t}function lN({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 tailwindMerge.twMerge(o,n[e],a,r)}function cN({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=nN[r];return tailwindMerge.twMerge(i,Je(),l,s,c,o==="plain"&&n?"px-0":"",a)}function dN({density:e,showDividers:t,className:r}){let o="text-text-primary",n=aN[e];return tailwindMerge.twMerge(o,n,t?"":"rounded-b-lg",r)}function ya({variant:e="contained",density:t="comfortable",showDividers:r=true,className:o,...n}){let a=Oe__namespace.useMemo(()=>({variant:e,density:t,showDividers:r}),[e,t,r]),i=tailwindMerge.twMerge("flex w-full flex-col",oN[e],r?og.true:og.false,e==="plain"&&r?"border-y border-border-default/60":"");return jsxRuntime.jsx(ng.Provider,{value:a,children:jsxRuntime.jsx(reactAriaComponents.DisclosureGroup,{...n,className:ke(o,i)})})}function Go({className:e,children:t,...r}){let{variant:o,showDividers:n}=Qd();return jsxRuntime.jsx(reactAriaComponents.Disclosure,{...r,className:reactAriaComponents.composeRenderProps(e,a=>lN({variant:o,showDividers:n,className:a})),children:a=>jsxRuntime.jsx(ag.Provider,{value:a,children:t})})}Go.displayName="CollapseItem";function Uo({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=sN("CollapseHeader"),{density:m,variant:p,showDividers:g}=Qd(),f=iN[m];return jsxRuntime.jsx(reactAriaComponents.Button,{...d,slot:"trigger","data-expanded":u.isExpanded?"true":void 0,className:reactAriaComponents.composeRenderProps(l,(h,b)=>cN({isDisabled:b.isDisabled??false,isPressed:b.isPressed??false,density:m,variant:p,showDividers:g,className:h})),children:h=>{let b=h.isDisabled??false,x=i?typeof n=="function"?n({isExpanded:u.isExpanded,isDisabled:b}):n??jsxRuntime.jsx(B,{name:"CaretDown",size:m==="compact"?"xs":"sm",weight:"bold","aria-hidden":"true",className:tailwindMerge.twMerge("text-text-secondary transition-transform duration-200",u.isExpanded?"rotate-180":"rotate-0")}):null,y=x?jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("flex flex-shrink-0 items-center justify-center text-text-secondary",f),"aria-hidden":"true",children:x}):s?jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("flex flex-shrink-0 items-center justify-center",f),"aria-hidden":"true"}):null;return jsxRuntime.jsxs("div",{className:"flex w-full items-center gap-4",children:[a==="start"&&y,r&&jsxRuntime.jsx("div",{className:"flex flex-shrink-0 items-center text-text-secondary",children:r}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[c??jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1 text-left",children:[e&&jsxRuntime.jsx("span",{className:"truncate font-medium text-text-primary",children:e}),t&&jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:t})]}),o&&jsxRuntime.jsx("div",{className:"flex flex-shrink-0 items-center text-sm text-text-secondary",children:o})]}),a==="end"&&y]})}})}Uo.displayName="CollapseHeader";function Ko({className:e,children:t,...r}){let{density:o,showDividers:n}=Qd();return jsxRuntime.jsx(reactAriaComponents.DisclosurePanel,{...r,className:reactAriaComponents.composeRenderProps(e,a=>dN({density:o,showDividers:n,className:a})),children:t})}Ko.displayName="CollapseContent";function va(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 fN({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[h,b]=Oe.useState(d||""),[x,y]=Oe.useState(l||d||""),[v,S]=Oe.useState(false),[w,N]=Oe.useState(null),{isFocused:M,handleFocus:k,handleBlur:T}=Pr(),A=l!==void 0?l:h;Oe.useEffect(()=>{l!==void 0&&y(l);},[l]);let E=A?!va(A):false,D=Oe.useCallback(G=>{if(y(G),va(G)){let K=_d(G);u?u(K):b(K);}else G===""&&(u?u(""):b(""));},[u]),R=Oe.useCallback(G=>{let K=_d(G);y(K),u?u(K):b(K);},[u]),H=Oe.useCallback(G=>{if(va(x)){let K=_d(x);y(K),u&&K!==A?u(K):!u&&K!==h&&b(K);}T(G,f.onBlur);},[x,A,h,u,T,f.onBlur]);return jsxRuntime.jsx(reactAriaComponents.TextField,{...f,isRequired:a,className:ke(s,"group flex flex-col"),children:({isDisabled:G})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(ze,{size:o,tooltip:n,isRequired:a,children:e}),jsxRuntime.jsx(yt,{children:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 relative",children:[jsxRuntime.jsx(Ns,{size:o,disabled:G,type:"text",value:x,placeholder:m,onFocus:K=>k(K,f.onFocus),onBlur:H,onChange:K=>D(K.target.value),className:tailwindMerge.twMerge(zt({isInvalid:E,isDisabled:G,isFocused:M,size:o,transparent:i}),p?"pr-12":"pr-3","pl-3")}),p&&jsxRuntime.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:Ge[o].height},children:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("w-6 h-6 rounded border shadow-sm",va(A)?"border-border-default":"border-border-default bg-background-muted"),style:va(A)?{backgroundColor:A}:void 0,"aria-hidden":"true",children:!va(A)&&jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsxRuntime.jsx("div",{ref:N,children:jsxRuntime.jsx(_,{variant:"secondary",size:o,icon:"Palette",onPress:()=>S(!v),isDisabled:G,className:"flex-shrink-0",children:"Pick"})})]})}),g?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsxRuntime.jsx(be,{size:o,children:r}):typeof r=="function"&&c?jsxRuntime.jsx(be,{size:o,children:r(c)}):t?jsxRuntime.jsx(Te,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:r}):typeof r=="function"&&c?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:r(c)}):t?jsxRuntime.jsx(Te,{size:o,className:"mt-1",children:t}):null}),v&&w&&jsxRuntime.jsx(lt,{triggerRef:{current:w},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:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsx(reactColorful.HexColorPicker,{color:A||"#000000",onChange:R,style:{width:"200px",height:"200px"}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:A||"#000000"}}),jsxRuntime.jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:A||"#000000"})]})]})})]})})}function lg({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 jsxRuntime.jsx(kr,{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:jsxRuntime.jsx("div",{className:"text-text-primary",children:n})})}function cg({isConnected:e,connectedAt:t,disconnectedAt:r,showTimestamp:o=false,isLoading:n,size:a="sm",shape:i="pill",...s}){if(n)return jsxRuntime.jsx(J,{className:"inline-flex h-6 w-24"});let c=e?"Connected":"Disconnected",l=e?"success":"neutral",d=null;if(o){if(e&&t)d=as(t);else if(!e&&r){let u=as(r);d=u?`Offline ${u}`:null;}}return jsxRuntime.jsxs("div",{className:"inline-flex flex-col gap-1",children:[jsxRuntime.jsx(nt,{variant:l,size:a,shape:i,dot:e,dotPulse:e,...s,children:c}),d&&jsxRuntime.jsx("span",{className:"text-xs text-text-secondary",children:d})]})}function dg({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(),h=({children:x,className:y})=>a?i?jsxRuntime.jsx(i,{href:a,className:y,children:x}):jsxRuntime.jsx(Ze,{href:a,variant:"unstyled",className:tailwindMerge.twMerge("hover:underline",y),asButton:false,children:x}):jsxRuntime.jsx("span",{className:y,children:x}),b=c==="vertical";return u?jsxRuntime.jsx(Ue,{variant:s,className:tailwindMerge.twMerge("flex flex-col",m),children:jsxRuntime.jsx(Ue.Content,{className:"flex items-center flex-1",children:jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("w-full",b?"flex flex-col items-center gap-4":"flex items-center gap-4"),children:[jsxRuntime.jsx(J,{width:56,height:56,className:"rounded flex-shrink-0"}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge(b?"w-full text-center":"flex-1","space-y-2"),children:[jsxRuntime.jsx(J,{width:"70%",height:20,className:tailwindMerge.twMerge(b&&"mx-auto")}),jsxRuntime.jsx(J,{width:"100%",height:16,className:tailwindMerge.twMerge(b&&"mx-auto")})]})]})})}):jsxRuntime.jsx(Ue,{variant:s,className:tailwindMerge.twMerge("group/card flex flex-col",m),children:jsxRuntime.jsx(Ue.Content,{className:tailwindMerge.twMerge("flex items-center flex-1",a&&"cursor-pointer",p),children:jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("relative w-full",b?"flex flex-col items-center gap-4 text-center":"flex items-center gap-4"),children:[jsxRuntime.jsx(xo,{firstName:e,lastName:t,src:n,size:"xl",variant:"user",shape:"square",className:"flex-shrink-0",piiEntity:g}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge(b?"w-full":"flex-1 min-w-0"),children:[a&&jsxRuntime.jsx(h,{className:"after:absolute after:inset-0",children:jsxRuntime.jsx("span",{className:"sr-only",children:f})}),jsxRuntime.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}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("space-y-0.5",b&&"flex flex-col items-center"),children:[l&&r&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-text-primary",children:[jsxRuntime.jsx(B,{name:"Envelope",size:16,className:"text-text-secondary flex-shrink-0"}),jsxRuntime.jsx(Ze,{href:`mailto:${r}`,variant:"unstyled",className:tailwindMerge.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&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-text-primary",children:[jsxRuntime.jsx(B,{name:"Phone",size:16,className:"text-text-secondary flex-shrink-0"}),jsxRuntime.jsx(Ze,{href:`tel:${o}`,variant:"unstyled",className:tailwindMerge.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:ca(o)})]})]})]})]})})})}function Bs({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 h=m??(n==="inline"?"circle":"square"),x={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],w=({children:N,className:M})=>i?s?jsxRuntime.jsx(s,{href:i,className:M,children:N}):jsxRuntime.jsx(Ze,{href:i,variant:c,className:tailwindMerge.twMerge("hover:underline",M),asButton:false,children:N}):jsxRuntime.jsx("span",{className:M,children:N});return p?n==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",x.gap,g),children:[jsxRuntime.jsx(J,{width:x.skeletonAvatar,height:x.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsxRuntime.jsx(J,{width:x.skeletonText,height:x.skeletonAvatar*.5})]}):jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",x.gap,g),children:[jsxRuntime.jsx(J,{width:x.skeletonAvatar,height:x.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(J,{width:x.skeletonText,height:16}),d&&jsxRuntime.jsx(J,{width:x.skeletonSecondary,height:12})]})]}):n==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",x.gap,g),children:[jsxRuntime.jsxs(w,{className:tailwindMerge.twMerge("flex items-center",x.gap),children:[jsxRuntime.jsx(xo,{firstName:e,lastName:t,src:o,size:x.avatarSize,variant:"user",shape:h,className:"flex-shrink-0",piiEntity:f}),jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-primary",S,x.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]}):jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center justify-start",x.gap,g),children:[jsxRuntime.jsx(xo,{firstName:e,lastName:t,src:o,size:x.avatarSize,variant:"user",shape:h,className:"flex-shrink-0",piiEntity:f}),jsxRuntime.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(w,{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-primary",S,x.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsxRuntime.jsx("span",{"data-pii-type":f?"full-name":void 0,"data-pii-entity":f,children:y})}),u]}),d&&r&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("text-text-secondary leading-normal truncate",x.secondaryTextSize),"data-pii-type":f?"email":void 0,"data-pii-entity":f,children:r})]})]})}var eu=Oe.createContext(null);function ug(e){let t=Oe.useContext(eu),r=Oe.useRef(null),o=e??r,[n,a]=Oe.useState(()=>t||{current:"xl",isSm:true,isMd:true,isLg:true,isXl:true,is2Xl:false,isMobile:false,isDesktop:true});return Oe.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 mg({children:e,className:t}){let r=Oe.useRef(null),[o,n]=Oe.useState({current:"base",isSm:false,isMd:false,isLg:false,isXl:false,is2Xl:false,isMobile:true,isDesktop:false});return Oe.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()},[]),jsxRuntime.jsx(eu.Provider,{value:o,children:jsxRuntime.jsx("div",{ref:r,className:t,style:{width:"100%"},children:e})})}var Vs={duration:.5,ease:"easeInOut"},Rr=Oe.createContext(null),Tn=()=>{let e=Oe.useContext(Rr);if(!e)throw new Error("useChartContext must be used within a ChartContextProvider");return e};function zs(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 Jo=({data:e,color:t="var(--color-viz-default)",baseline:r,fillOpacity:o=.1,showLine:n=true,maxGapMs:a,animate:i=true})=>{let s=Oe.useId(),c=Oe.useId(),{xScale:l,yScale:d,animationSettings:u}=Tn(),m=l.range(),p=d.range(),g=(v,S)=>typeof r=="function"?r(v,S):r??0,f=v=>v.chartYValue??v.yValue,h=a!=null?zs(e,a):e,b=i?void 0:"non-scaling-stroke",x={transformOrigin:`0 ${p[0]}px`,transformBox:"fill-box",isolation:"isolate"},y=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r===void 0?jsxRuntime.jsx(shape.AreaClosed,{data:h,x:v=>v?l(v.xValue):0,y:v=>v?d(f(v)):0,yScale:d,defined:v=>v!=null,fill:`url(#${s})`,curve:curve.curveLinear}):jsxRuntime.jsx(shape.Area,{data:h,x:v=>v?l(v.xValue):0,y0:(v,S)=>v?d(g(v,S)):0,y1:v=>v?d(f(v)):0,defined:v=>v!=null,fill:t,fillOpacity:o,curve:curve.curveLinear}),n?jsxRuntime.jsx(shape.LinePath,{data:h,x:v=>v?l(v.xValue):0,y:v=>v?d(f(v)):0,defined:v=>v!=null,stroke:t,strokeWidth:3,vectorEffect:b,curve:curve.curveLinear}):null]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsxs("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[jsxRuntime.jsx("stop",{offset:"50%",stopColor:t,stopOpacity:o}),jsxRuntime.jsx("stop",{offset:"100%",stopColor:t,stopOpacity:0})]}),i&&jsxRuntime.jsx("clipPath",{id:c,children:jsxRuntime.jsx("rect",{x:m[0],y:p[1],width:m[1]-m[0],height:p[0]-p[1]})})]}),i?jsxRuntime.jsx("g",{clipPath:`url(#${c})`,children:jsxRuntime.jsx(framerMotion.motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:u.duration,ease:u.ease},style:x,children:y})}):jsxRuntime.jsx("g",{style:x,children:y})]})};var Hs=({data:e,color:t="var(--color-viz-default)",opacity:r=1,categoryColors:o={}})=>{let{xScale:n,yScale:a,animationSettings:i}=Tn(),s=Oe.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 jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("clipPath",{id:s,children:jsxRuntime.jsx("rect",{x:c[0],y:l[1],width:c[1]-c[0],height:l[0]-l[1]})})}),jsxRuntime.jsx("g",{clipPath:`url(#${s})`,children:jsxRuntime.jsx(framerMotion.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),h=p.chartYValue??p.yValue,b=p.baselineValue??0,x=a(h),y=a(b),v=Math.min(x,y),S=Math.abs(x-y),w=d[g+1],N=w?Math.abs(n(w.xValue)-f):m,M=p.category&&o[p.category]?o[p.category]:t;return jsxRuntime.jsx(shape.Bar,{x:f-N/2,y:v,width:N,height:S,fill:M,opacity:r,rx:1},p.xValue.getTime())})})})]})};function HN(e){return e>=1e9?"GW":e>=1e6?"MW":e>=1e3?"kW":"W"}function WN(e){return e>=1e3?"kA":e<1?"mA":"A"}function GN(e){return e>=1e3?"kV":e<1?"mV":"V"}function UN(e){return e>=1e6?"M\u03A9":e>=1e3?"k\u03A9":e<1?"m\u03A9":"\u03A9"}function Sa(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?Xc[e.sourceUnit]:1;return {...e,unit:Jc(t*r)}}case "power":return e.unit||e.autoScale===false?e:{...e,unit:HN(t)};case "current":return e.unit||e.autoScale===false?e:{...e,unit:WN(t)};case "voltage":return e.unit||e.autoScale===false?e:{...e,unit:GN(t)};case "resistance":return e.unit||e.autoScale===false?e:{...e,unit:UN(t)};default:return e}}var KN=e=>e.baselineValue??0,Ie={top:8,right:0,bottom:50,left:60};function Hr(e={type:"number"}){let t=i=>{if(i==null)return "-";let s=jr({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=jr({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 ru=(e,t)=>{let r=d3Array.extent(e,o=>o.xValue);return scale.scaleTime({range:[Ie.left,t-Ie.right],domain:r,nice:true})},di=(e,t,r,o)=>{let n=Hr(r);if(o)return scale.scaleLinear({range:[t-Ie.bottom,Ie.top],domain:o,nice:true});let a=d3Array.min(e,l=>Math.min(l.yValue,l.chartYValue??l.yValue,l.baselineValue??l.yValue))||0,i=d3Array.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 scale.scaleLinear({range:[t-Ie.bottom,Ie.top],domain:[s,c],nice:true})};function YN(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 wa(e,t=12,r="system-ui"){return e.length===0?0:Math.max(...e.map(o=>YN(o,t,r)))}function ui(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function JN(e,t,r=12,o=false){if(!ui(t[0])||!ui(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=id({start:t[0],end:t[1]},{compact:o}),l=[t[0],new Date((t[0].getTime()+t[1].getTime())/2),t[1]].map(x=>s(x)),d=wa(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]],h=i/36e5,b;h<=1?b=6e4:h<=6?b=5*6e4:h<=48?b=60*6e4:h<=168?b=360*6e4:b=1440*6e4;for(let x=1;x<g-1;x++){let y=x/(g-1),v=n+i*y,S=Math.round(v/b)*b,w=f[f.length-1].getTime(),N=S>w?S:w+b;if(N>=a)break;f.push(new Date(N));}return f.push(t[1]),f}var XN=({top:e,scale:t,width:r})=>{let o=t.domain(),n=[o[0],o[o.length-1]],a=ui(n[0])&&ui(n[1]),i=r<400,s=a?n[0].getTime():0,c=a?n[1].getTime():0,l=Oe.useMemo(()=>a?id({start:n[0],end:n[1]},{compact:i}):()=>"",[s,c,i,a]),d=Oe.useMemo(()=>JN(r,n,12,i),[r,s,c,i]);return d.length===0?null:jsxRuntime.jsx(axis.Axis,{orientation:"bottom",top:e,scale:t,tickValues:d,tickFormat:u=>{let m=u;return ui(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 Na(e,t=12){let r=t*2.5,o=Math.floor(e/r);return Math.max(2,Math.min(6,o))}var ou=12,jN=({left:e,scale:t,yFormatter:r,height:o})=>{let n=Hr(r),a=Oe.useMemo(()=>!o||o<=0?5:Na(o),[o]);return jsxRuntime.jsx(axis.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:ou,textAnchor:"end"},c=t(i),[l,d]=t.range(),u=Math.min(l,d),m=Math.max(l,d);return c-u<ou/2?{...s,verticalAnchor:"start"}:m-c<ou/2?{...s,verticalAnchor:"end"}:{...s,dy:"0.33em"}}})},qN=({top:e,scale:t})=>jsxRuntime.jsx(axis.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"})}),QN=({left:e,scale:t})=>jsxRuntime.jsx(axis.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"})}),ZN=({top:e,scale:t,yFormatter:r,width:o})=>{let n=Hr(r),a=Oe.useMemo(()=>{if(!o||o<=0)return 5;let s=Math.floor(o/60);return Math.max(2,Math.min(8,s))},[o]);return jsxRuntime.jsx(axis.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"})})},Mr={Bottom:XN,Left:jN,CategoryBottom:qN,CategoryLeft:QN,NumericBottom:ZN};var Xo=({data:e,formatter:t,label:r,categoryLabels:o})=>{if(!e)return null;let n=Oe__namespace.default.useContext(Rr),a=o??n?.categoryLabels,i=n?.xScale,s=n?.width,c=n?.height,l=Hr(t),d=x=>{if(x.baselineValue===void 0)return l.format(x.value);let y=Math.min(x.baselineValue,x.value),v=Math.max(x.baselineValue,x.value);return `${l.format(y)} \u2013 ${l.format(v)}`},u=Oe__namespace.default.useRef(null),[m,p]=Oe__namespace.default.useState({x:0,y:0,translate:"translate(-50%, -100%)"});Oe__namespace.default.useEffect(()=>{if(!u.current)return;let y=u.current.getBoundingClientRect(),v=s??window.innerWidth,S=c??window.innerHeight,w=e.x,N=e.y,M=16,k=e.x+y.width+M<=v,T=e.x-y.width-M>=0,A;e.position==="left"?A=T||!k:A=!k&&T;let E=A?"translate(calc(-100% - 16px), -50%)":"translate(16px, -50%)";if(!k&&!T){let D=v-e.x,R=e.x;D<=R?(w=v,E="translate(-100%, -50%)"):(w=0,E="translate(0, -50%)");}N-y.height/2<0?N=y.height/2:N+y.height/2>S&&(N=S-y.height/2),p({x:w,y:N,translate:E});},[e.x,e.y,e.position,s,c]);let g=i?.domain(),h=g&&g.length===2&&g.every(x=>x instanceof Date)?Hm({start:g[0],end:g[1]}):null,b=r||(h&&e.xValue instanceof Date?h(e.xValue):String(e.xValue));return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsx("div",{className:"mb-1 font-medium text-text-primary",children:b}),e.isEvent?jsxRuntime.jsxs("div",{className:"space-y-2",children:[e.series.length>1&&jsxRuntime.jsx("ul",{className:"list-none p-0 border-b border-border-default pb-2",children:e.series.slice(0,-1).map(x=>jsxRuntime.jsxs("li",{className:"py-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"font-medium text-text-primary",children:[x.label,":"]}),jsxRuntime.jsx("span",{className:"text-text-secondary",children:d(x)})]}),x.category&&jsxRuntime.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-3 w-3",style:{backgroundColor:x.categoryColor||x.color,borderRadius:"1px"}}),jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:a?.[x.category]||x.category})]}),x.extraTooltipRows&&x.extraTooltipRows.length>0&&jsxRuntime.jsx("div",{className:"mt-0.5 space-y-0.5",children:x.extraTooltipRows.map(y=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[jsxRuntime.jsxs("span",{children:[y.label,":"]}),jsxRuntime.jsx("span",{className:"font-medium text-text-primary",children:y.value})]},y.label))})]},x.label))}),(()=>{let x=e.series[e.series.length-1],y=e.eventItems?.length?e.eventItems:[{label:x.label,color:x.color,metadata:e.eventMetadata}];return jsxRuntime.jsx("div",{className:"space-y-2",children:y.map((v,S)=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:v.color}}),jsxRuntime.jsx("span",{className:"font-medium text-text-primary",children:v.label})]}),v.metadata&&Object.keys(v.metadata).length>0&&jsxRuntime.jsx("div",{className:"ml-4 mt-1 space-y-0.5 text-xs text-text-secondary",children:Object.entries(v.metadata).map(([w,N])=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"capitalize",children:[w,":"]}),jsxRuntime.jsx("span",{className:"font-medium",children:N})]},w))})]},`${v.label}-${S}`))})})()]}):jsxRuntime.jsx("ul",{className:"list-none p-0",children:e.series.map(x=>jsxRuntime.jsxs("li",{className:"py-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"font-medium text-text-primary",children:[x.label,":"]}),jsxRuntime.jsx("span",{className:"text-text-secondary",children:d(x)})]}),x.category&&jsxRuntime.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-3 w-3",style:{backgroundColor:x.categoryColor||x.color,borderRadius:"1px"}}),jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:a?.[x.category]||x.category})]}),x.extraTooltipRows&&x.extraTooltipRows.length>0&&jsxRuntime.jsx("div",{className:"mt-0.5 space-y-0.5",children:x.extraTooltipRows.map(y=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[jsxRuntime.jsxs("span",{children:[y.label,":"]}),jsxRuntime.jsx("span",{className:"font-medium text-text-primary",children:y.value})]},y.label))})]},x.label))})]})})};var ik={top:20,right:20,bottom:50,left:60},wg=({data:e,width:t,height:r,margin:o=ik,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":h="Category bar chart",orientation:b="vertical",showTooltip:x=true})=>{let[y,v]=Oe.useState(null),[S,w]=Oe.useState(null),[N,M]=Oe.useState(null),[k,T]=Oe.useState(t??600),[A,E]=Oe.useState(r??300),D=Oe.useRef(null),R=p??y,H=Oe.useId(),G=n||"var(--color-viz-default)";Oe.useEffect(()=>{if(t!==void 0&&r!==void 0){T(t),E(r);return}if(!D.current)return;let O=new ResizeObserver(L=>{for(let Y of L)t===void 0&&T(Y.contentRect.width),r===void 0&&E(Y.contentRect.height);});return O.observe(D.current),t===void 0&&T(D.current.offsetWidth),r===void 0&&E(D.current.offsetHeight||300),()=>{O.disconnect();}},[t,r]);let{xScale:K,yScale:W,innerWidth:q,innerHeight:j}=Oe.useMemo(()=>{let O=k-o.left-o.right,L=A-o.top-o.bottom;if(b==="horizontal"){let P=d3Array.max(e,C=>C.value)||0;return {xScale:scale.scaleLinear({range:[0,O],domain:[0,P*1.1],nice:true}),yScale:scale.scaleBand({range:[0,L],domain:e.map(C=>C.label),padding:d}),innerWidth:O,innerHeight:L}}let Y=d3Array.max(e,P=>P.value)||0;return {xScale:scale.scaleBand({range:[0,O],domain:e.map(P=>P.label),padding:d}),yScale:scale.scaleLinear({range:[L,0],domain:[0,Y*1.1],nice:true}),innerWidth:O,innerHeight:L}},[e,k,A,o,d,b]);if(e.length===0)return jsxRuntime.jsx("div",{ref:D,className:tailwindMerge.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=(O,L)=>{if(v(O),m?.(L,O),O!==null&&L){let Y,P;if(b==="horizontal"){let I=K(L.value),F=W(L.label)||0,U=W.bandwidth();Y=o.left+I,P=o.top+F+U/2;}else {let I=K,F=W,U=I(L.label)??0,$=I.bandwidth(),ae=F(L.value);Y=o.left+U+$/2,P=o.top+ae;}let C=Y>k/2;M(L.label),w({xValue:new Date,series:[{label:"Value",value:L.value,color:L.color||G}],x:Y,y:P,position:C?"left":"right"});}else w(null),M(null);};return jsxRuntime.jsxs("div",{ref:D,className:tailwindMerge.twMerge("relative h-full w-full overflow-hidden rounded-lg bg-background-surface",g),style:r!==void 0?{height:r,...f}:f,"aria-label":h,role:"img",children:[jsxRuntime.jsxs("svg",{width:k,height:A,children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx(gradient.LinearGradient,{id:`${H}-bar`,from:G,to:G,toOpacity:.85})}),jsxRuntime.jsxs(group.Group,{left:o.left,top:o.top,children:[i&&jsxRuntime.jsx("g",{className:"grid-lines",children:(b==="horizontal"?K.ticks(5):W.ticks(5)).map(O=>{let L=b==="horizontal"?0:W(O),Y=b==="horizontal"?K(O):0;return jsxRuntime.jsx("line",{x1:b==="horizontal"?Y:0,y1:b==="horizontal"?0:L,x2:b==="horizontal"?Y:q,y2:b==="horizontal"?j:L,stroke:"var(--color-border-default)",strokeOpacity:.5,strokeDasharray:"2,3"},O)})}),e.map((O,L)=>{let Y=R===L||R==null,P=O.color||`url(#${H}-bar)`;if(b==="horizontal"){let Z=K(O.value),ie=W.bandwidth(),fe=W(O.label)||0;return jsxRuntime.jsx(framerMotion.motion.rect,{x:0,y:fe,width:Z,height:ie,fill:P,rx:l,ry:l,initial:c?{width:0,opacity:.5}:void 0,animate:{width:Z,opacity:Y?1:.5},transition:{duration:.5,delay:L*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:u||m?"pointer":"default"},onMouseEnter:()=>Q(L,O),onMouseLeave:()=>Q(null,null),onClick:()=>u?.(O,L)},O.label)}let C=K,I=W,F=C.bandwidth(),U=C(O.label)??0,$=I(O.value),ae=Math.max(0,j-$);return c?jsxRuntime.jsx(framerMotion.motion.rect,{x:U,width:F,fill:P,rx:l,ry:l,initial:{y:j,height:0,opacity:.5},animate:{y:$,height:ae,opacity:Y?1:.5},transition:{duration:.5,delay:L*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:u||m?"pointer":"default"},onMouseEnter:()=>Q(L,O),onMouseLeave:()=>Q(null,null),onClick:()=>u?.(O,L)},O.label):jsxRuntime.jsx("rect",{x:U,y:$,width:F,height:ae,fill:P,rx:l,ry:l,opacity:Y?1:.5,style:{cursor:u||m?"pointer":"default",transition:"opacity 150ms ease-out"},onMouseEnter:()=>Q(L,O),onMouseLeave:()=>Q(null,null),onClick:()=>u?.(O,L)},O.label)}),s&&b==="vertical"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Mr.CategoryBottom,{top:j,scale:K}),jsxRuntime.jsx(Mr.Left,{left:0,scale:W,yFormatter:a,height:j})]}),s&&b==="horizontal"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Mr.NumericBottom,{top:j,scale:K,yFormatter:a,width:q}),jsxRuntime.jsx(Mr.CategoryLeft,{left:0,scale:W})]})]})]}),x&&jsxRuntime.jsx(Xo,{data:S,formatter:a,label:N??void 0})]})};var Ng=({item:e,onToggle:t})=>{let r=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-3 w-3 shrink-0",style:{backgroundColor:e.fill,borderRadius:"1px",opacity:e.isHidden?.35:1}}),jsxRuntime.jsx("span",{className:`text-sm whitespace-nowrap ${e.isHidden?"text-text-disabled line-through":"text-text-secondary"}`,children:e.category})]});return t?jsxRuntime.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}):jsxRuntime.jsx("div",{className:"flex items-center gap-2 shrink-0",children:r})},ck=({items:e,onToggle:t})=>e.length===0?null:jsxRuntime.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:e.map(r=>jsxRuntime.jsx(Ng,{item:r,onToggle:t},r.category))}),Ta=({items:e,onExport:t,marginLeft:r=0,marginRight:o=0,isZoomed:n=false,onResetZoom:a,onLegendItemToggle:i})=>{let[s,c]=Oe__namespace.default.useState(false),[l,d]=Oe__namespace.default.useState(null),[u,m]=Oe__namespace.default.useState(false),[p,g]=Oe__namespace.default.useState(false),f=Oe__namespace.default.useCallback(async b=>{c(true),d(b),g(false);try{await t(b);}catch(x){console.error("Export failed:",x);}finally{c(false),d(null);}},[t]),h=Oe__namespace.default.useCallback(async b=>{await f(b);},[f]);return jsxRuntime.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 min-h-[32px]",style:{marginLeft:r,marginRight:o},children:[jsxRuntime.jsx("div",{className:"hidden sm:block flex-1 min-w-0",children:jsxRuntime.jsx(ck,{items:e,onToggle:i})}),jsxRuntime.jsx("div",{className:"sm:hidden flex items-center gap-3",children:e.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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"}),jsxRuntime.jsx(ct,{isOpen:u,onClose:()=>m(false),title:"Legend",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-3 p-4",children:e.map(b=>jsxRuntime.jsx(Ng,{item:b,onToggle:i},b.category))})})]})}),jsxRuntime.jsxs("div",{className:"sm:hidden flex items-center gap-2 shrink-0",children:[n&&a&&jsxRuntime.jsx(_,{variant:"secondary",size:"sm",onPress:a,children:jsxRuntime.jsx(B,{name:"ArrowsOut",size:16})}),jsxRuntime.jsx(_,{variant:"secondary",size:"sm",onPress:()=>g(true),isDisabled:s,children:jsxRuntime.jsx(B,{name:"Export",size:16})}),jsxRuntime.jsx(ct,{isOpen:p,onClose:()=>g(false),title:"Export Chart",contentPadding:false,children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.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:[jsxRuntime.jsx(B,{name:"List",size:20,className:"text-text-secondary"}),jsxRuntime.jsx("span",{className:"text-sm text-text-primary",children:l==="csv"?"Exporting...":"Export as CSV"})]}),jsxRuntime.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:[jsxRuntime.jsx(B,{name:"Code",size:20,className:"text-text-secondary"}),jsxRuntime.jsx("span",{className:"text-sm text-text-primary",children:l==="svg"?"Exporting...":"Export as SVG"})]}),jsxRuntime.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:[jsxRuntime.jsx(B,{name:"DownloadSimple",size:20,className:"text-text-secondary"}),jsxRuntime.jsx("span",{className:"text-sm text-text-primary",children:l==="png"?"Exporting...":"Export as PNG"})]})]})})]}),jsxRuntime.jsxs("div",{className:"hidden sm:flex items-center gap-2 shrink-0",children:[n&&a&&jsxRuntime.jsxs(_,{variant:"secondary",size:"sm",onPress:a,children:[jsxRuntime.jsx(B,{name:"ArrowsOut",size:16}),jsxRuntime.jsx("span",{className:"hidden sm:inline",children:"Reset Zoom"})]}),jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{children:[jsxRuntime.jsxs(_,{variant:"secondary",size:"sm",isDisabled:s,children:[jsxRuntime.jsx(B,{name:"Export",size:16}),s?"Exporting...":"Export"]}),jsxRuntime.jsx(lt,{placement:"top end",className:"min-w-48 p-1 bg-background-surface rounded-lg shadow-xl ring-1 ring-border-default",children:jsxRuntime.jsxs(reactAriaComponents.Menu,{onAction:h,className:"outline-none",children:[jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(B,{name:"List",size:14}),l==="csv"?"Exporting...":"Export as CSV"]})}),jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(B,{name:"Code",size:14}),l==="svg"?"Exporting...":"Export as SVG"]})}),jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(B,{name:"DownloadSimple",size:14}),l==="png"?"Exporting...":"Export as PNG"]})})]})})]})]})]})};var Us=Op(su());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 lu(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 cu(e,t,r={},o){let n=Array.isArray(t[0])?t:[t];try{switch(e){case "csv":await uk(n,r);break;case "svg":await pk(o,r);break;case "png":await mk(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 uk(e,t){try{let r=t.yFormat?ad(t.yFormat):null,o=t.yFormat,n=m=>{if(m==null||m==="")return "";if(!o)return typeof m=="number"?m:String(m);let p=Om(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 h=s[f],b=g.find(x=>x.xValue.getTime()===m.getTime());p[h]=b?n(b.yValue):"",b?.category&&(p[`${h} Category`]=b.category);}),p}),l=dk__default.default.unparse(c,{header:!0,skipEmptyLines:!0}),d=new Blob([l],{type:"text/csv;charset=utf-8;"}),u=lu(t.filename||"chart-data","csv",t.timestamp!==!1);(0,Us.saveAs)(d,u);}catch(r){throw new Error(`CSV export failed: ${r instanceof Error?r.message:"Unknown error"}`)}}async function pk(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
|
-
`+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=lu(t.filename||"chart","svg",t.timestamp!==!1);(0,Us.saveAs)(s,c);}catch(r){throw new Error(`SVG export failed: ${r instanceof Error?r.message:"Unknown error"}`)}}async function mk(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 h=document.createElement("canvas");h.width=a.width*r,h.height=a.height*r;let b=h.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),h.toBlob(x=>{if(x){let y=lu(t.filename||"chart","png",t.timestamp!==!1);(0,Us.saveAs)(x,y),m();}else p(new Error("Failed to create PNG blob"));o&&URL.revokeObjectURL(o);},"image/png",1);}catch(h){o&&URL.revokeObjectURL(o),p(h);}},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 fk(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 gk(e){return {csv:"CSV Spreadsheet",svg:"SVG Vector Image",png:"PNG Image"}[e]||"Unknown Format"}function Ks({datasets:e,metadata:t,svgRef:r}){return Oe.useCallback(async o=>{try{await cu(o,e,t,r);}catch(n){throw console.error("Chart export failed:",n),n}},[e,t,r])}var du=({data:e,seriesMetadata:t,width:r,height:o,onBrushChange:n,brushRegion:a,margin:i=Ie,yDomain:s})=>{let c=Oe.useRef(null),l=Oe.useRef(false),d=Oe.useMemo(()=>e.flat(),[e]),u=Oe.useMemo(()=>({top:10,bottom:15,left:i.left,right:i.right}),[i]),m=r-u.left-u.right,p=Oe.useMemo(()=>{if(d.length===0)return scale.scaleTime({domain:[new Date,new Date],range:[0,m]});let x=new Date(Math.min(...d.map(v=>v.xValue.getTime()))),y=new Date(Math.max(...d.map(v=>v.xValue.getTime())));return scale.scaleTime({domain:[x,y],range:[0,m]})},[d,m]),g=Oe.useMemo(()=>{let x=d.length>0?Math.max(0,...d.map(y=>y.yValue)):1;return scale.scaleLinear({domain:s??[0,x],range:[o-u.bottom,u.top]})},[d,o,s,u.top,u.bottom]),f=x=>{if(l.current)return;if(!x){n(null);return}let{x0:y,x1:v}=x;if(y===v)return;let S=new Date(y),w=new Date(v);if(!(Number.isNaN(S.getTime())||Number.isNaN(w.getTime()))){if(d.length>0){let N=Math.min(...d.map(E=>E.xValue.getTime())),M=Math.max(...d.map(E=>E.xValue.getTime())),T=(M-N)*.05;if(Math.abs(S.getTime()-N)<T&&Math.abs(w.getTime()-M)<T){n(null);return}}n([S,w]);}},h=Oe.useMemo(()=>{if(d.length!==0)return {start:{x:0,y:u.top},end:{x:m,y:o-u.bottom}}},[m,o,d]);Oe.useEffect(()=>{if(!c.current||d.length===0)return;let x=c.current.state;if(x?.isBrushing||x?.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),w=a?a[1]:new Date(v),N=c.current.state?.extent;if(N){let k=p.invert(N.x0),T=p.invert(N.x1),A=Math.abs(k.getTime()-S.getTime()),E=Math.abs(T.getTime()-w.getTime());if(A<1e3&&E<1e3)return}l.current=true;let M=k=>{let T=c.current.getExtent({x:p(S),y:u.top},{x:p(w),y:o-u.bottom});return {...k,start:{y:T.y0,x:T.x0},end:{y:T.y1,x:T.x1},extent:T}};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 jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsxs("svg",{width:r,height:o,children:[jsxRuntime.jsx(pattern.PatternLines,{id:"brush_pattern",height:8,width:8,stroke:"var(--color-text-secondary)",strokeWidth:1,orientation:["diagonal"]}),jsxRuntime.jsxs("g",{transform:`translate(${u.left}, 0)`,children:[e.map((x,y)=>jsxRuntime.jsx(shape.LinePath,{data:x,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}`)),jsxRuntime.jsx(brush.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:h,onChange:f,onClick:()=>n(null),selectedBoxStyle:b,useWindowMoveEvents:true})]})]})})};function yo(e){switch(e){case "command":return Pt("--color-action-brand","#111111");case "success":return Pt("--color-feedback-success-border","#278a4a");case "warning":return Pt("--color-feedback-warning-border","#c88420");case "error":return Pt("--color-feedback-error-border","#c42d2d");case "alert":return Pt("--color-feedback-warning-border","#c88420");default:return Pt("--color-text-secondary","#525250")}}function Js({events:e,color:t,showLabels:r=false}){let o=Oe.useContext(Rr),[n,a]=Oe.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 x=i(b.timestamp);return x>=Ie.left&&x<=i.range()[1]}),f=Oe.useCallback((b,x)=>{a(x);let y=i(b.timestamp),v=y>(i.range()[1]-Ie.right-Ie.left)/2+Ie.left,S=[];d&&u&&d.forEach((M,k)=>{if(M.length===0)return;let T=d3Array.bisector(H=>H.xValue).left,A=T(M,b.timestamp),E=M[A-1],D=M[A],R;if(!E)R=D;else if(!D)R=E;else {let H=Math.abs(b.timestamp.getTime()-E.xValue.getTime()),G=Math.abs(b.timestamp.getTime()-D.xValue.getTime());R=H<G?E:D;}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 N=g.filter(M=>Math.abs(i(M.timestamp)-y)<=10).map(M=>({label:M.label,color:t||yo(M.type),metadata:M.metadata}));S.push({label:N.length>1?`${N.length} events`:b.label,value:0,color:t||yo(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:N});},[i,s,c,l,t,d,u,m,p,g]),h=Oe.useCallback(()=>{a(null),l.hide();},[l]);return g.length===0?null:jsxRuntime.jsx("g",{className:"chart-event-markers","data-testid":"chart-event-markers",children:g.map((b,x)=>{let y=i(b.timestamp),v=t||yo(b.type),S=n===x;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:y,y1:Ie.top,x2:y,y2:c-Ie.bottom,stroke:v,strokeWidth:S?3:2,strokeDasharray:"4 4",strokeOpacity:S?.9:.6,pointerEvents:"none"}),jsxRuntime.jsx("circle",{cx:y,cy:Ie.top,r:S?5:4,fill:v,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),jsxRuntime.jsx("circle",{cx:y,cy:c-Ie.bottom,r:S?5:4,fill:v,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),r&&jsxRuntime.jsx("text",{x:y,y:Ie.top-8,textAnchor:"middle",fill:"var(--color-text-secondary)",fontSize:11,fontWeight:500,pointerEvents:"none",children:b.label}),jsxRuntime.jsx("rect",{x:y-10,y:Ie.top,width:20,height:c-Ie.top-Ie.bottom,fill:"transparent",style:{cursor:"pointer"},onMouseEnter:()=>f(b,x),onMouseLeave:h})]},`${b.timestamp.getTime()}-${x}`)})})}function Xs({spans:e,opacity:t=.25,color:r}){let o=Oe.useContext(Rr),[n,a]=Oe.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=Oe.useCallback((S,w)=>{if(!i||!c)return;a(w);let N=S.start<l?l:S.start,M=S.end>d?d:S.end,k=(i(N)+i(M))/2,T=k>(m-u)/2+u,E=e.filter(D=>D.end>D.start&&D.start<S.end&&D.end>S.start).map(D=>({label:D.label,color:D.color??r??yo(D.type),metadata:D.metadata}));c.show({xValue:S.start,series:[{label:E.length>1?`${E.length} scheduled commands`:S.label,value:0,color:S.color??r??yo(S.type),type:"event"}],x:k,y:(s??0)/2,position:T?"left":"right",isEvent:true,eventMetadata:S.metadata,eventItems:E});},[i,s,c,r,l,d,u,m,e]),g=Oe.useCallback(()=>{a(null),c?.hide();},[c]);if(!o)return console.warn("ChartEventSpans must be used within a ChartContainer"),null;let{xScale:f,height:h}=o,b=Ie.top,y=h-Ie.bottom-b,v=e.filter(S=>S.end>S.start);return v.length===0?null:jsxRuntime.jsx("g",{className:"chart-event-spans","data-testid":"chart-event-spans",children:v.map((S,w)=>{let N=S.start<l?l:S.start,M=S.end>d?d:S.end;if(N>=d||M<=l)return null;let k=f(N),A=f(M)-k;if(A<=0)return null;let E=S.color??r??yo(S.type);return jsxRuntime.jsx("rect",{x:k,y:b,width:A,height:y,fill:E,fillOpacity:n===w?Math.min((t??.25)*1.8,1):t??.25,pointerEvents:"all",style:{cursor:"pointer"},onMouseEnter:()=>p(S,w),onMouseLeave:g},`${S.start.getTime()}-${S.end.getTime()}-${w}`)})})}var Pn=({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}=Tn(),d=c.range(),u=Object.keys(n).length>0,m=y=>y.category?n[y.category]??t:t,p=y=>y.chartYValue??y.yValue,g=e.length===1?e[0]:void 0,f=a!=null?zs(e,a):e,h=i?void 0:"non-scaling-stroke",b=g?jsxRuntime.jsx("circle",{cx:s(g.xValue),cy:c(p(g)),r,fill:u?m(g):t}):u?e.slice(0,-1).map((y,v)=>{let S=e[v+1];return a!=null&&a>0&&S.xValue.getTime()-y.xValue.getTime()>a?null:jsxRuntime.jsx(shape.LinePath,{data:[y,S],x:w=>s(w.xValue),y:w=>c(p(w)),stroke:m(y),strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",vectorEffect:h,curve:curve.curveLinear},`${y.xValue.getTime()}-${S.xValue.getTime()}`)}):jsxRuntime.jsx(shape.LinePath,{data:f,x:y=>y?s(y.xValue):0,y:y=>y?c(p(y)):0,defined:y=>y!=null,stroke:t,strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",vectorEffect:h,curve:curve.curveLinear}),x={transformOrigin:`0 ${d[0]}px`,transformBox:"fill-box",isolation:"isolate"};return i?jsxRuntime.jsx(framerMotion.motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:l.duration,ease:l.ease},style:x,children:b}):jsxRuntime.jsx("g",{style:x,children:b})};var Hg=e=>e.type===Jo||e.type===Pn||e.type===Hs,Fk=e=>e.type===Js||e.type===Xs,Bk=(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},Vk=d3Array.bisector(e=>e.xValue).left,zk=()=>jsxRuntime.jsx("div",{className:"flex h-full items-center justify-center",children:jsxRuntime.jsx("p",{className:"text-text-secondary",children:"No data available"})}),Ok=()=>jsxRuntime.jsxs("div",{className:"flex h-full flex-col gap-4 p-4",children:[jsxRuntime.jsx(J,{className:"h-full w-full"}),jsxRuntime.jsxs("div",{className:"flex gap-4",children:[jsxRuntime.jsx(J,{className:"h-4 w-24"}),jsxRuntime.jsx(J,{className:"h-4 w-24"})]})]}),Hk=({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,hideBottomBar:p=false,children:g})=>{let f=u!==void 0,h=d!==void 0,[b,x]=Oe.useState(null),[y,v]=Oe.useState(null),S=h?d:y,[w,N]=Oe.useState(()=>new Set),M=f?u:w,k=Oe.useRef(null),T=Oe.useId(),A=Oe.useRef(0),E=Oe.useRef(""),D=Oe.useRef(null),{colorMode:R}=Vt(),H=Oe.useMemo(()=>cn(),[R]),G=Oe.useMemo(()=>qa(),[R]),{datasets:K,seriesMetadata:W,categoryInfo:q,categoryColors:j,categoryLabels:Q,seriesTypes:O}=Oe.useMemo(()=>{let pe=Oe.Children.toArray(g).filter(De=>Oe.isValidElement(De)&&Hg(De)),Fe=pe.filter(De=>De.props.data).length,Ne=[],Ve=[],tt=[],mt=null,Ae=null;pe.forEach((De,St)=>{let Pe=De.props;if(!Pe.data)return;Ne.push(Pe.data);let na=("color"in Pe&&Pe.color?Pe.color:void 0)||(Fe===1?G:H[St%H.length]),sn=De.type===Jo;Ve.push({label:"label"in Pe&&Pe.label||`Series ${Ne.length}`,color:na,...sn&&"baseline"in Pe&&Pe.baseline!==void 0?{baseline:Pe.baseline,tooltipRange:"tooltipRange"in Pe&&Pe.tooltipRange||false}:{}});let wc=sn?"area":De.type===Pn?"line":"bar";tt.push(wc),"categoryColors"in Pe&&Pe.categoryColors&&(mt=Pe.categoryColors),"categoryLabels"in Pe&&Pe.categoryLabels&&(Ae=Pe.categoryLabels);});let ft=null;if(mt){let De=new Set;Ne.forEach(St=>{St.forEach(Pe=>{Pe.category&&De.add(Pe.category);});}),ft=Array.from(De).map(St=>({label:Ae?.[St]||St,color:mt[St]||"#6b7280"}));}return {datasets:Ne,seriesMetadata:Ve,categoryInfo:ft,categoryColors:mt,categoryLabels:Ae,seriesTypes:tt}},[g,G,H,R]),L=e,Y=p?0:60,P=s?c+8:0,C=t-Y-P,I=Math.max(100,C),F=Oe.useCallback(X=>X?M.has(X):false,[M]),U=Oe.useMemo(()=>W.map((X,pe)=>F(X.label)?null:pe).filter(X=>X!==null),[W,F]),$=Oe.useMemo(()=>U.map(X=>K[X]).filter(X=>!!X),[K,U]),ae=Oe.useMemo(()=>U.map(X=>W[X]).filter(X=>!!X),[W,U]),Z=Oe.useMemo(()=>U.map(X=>O[X]).filter(X=>!!X),[O,U]),ie=Z.findIndex(X=>X==="bar"),fe=ie!==-1,re=Oe.useCallback((X,pe)=>{let Fe=X.has(pe);if(!Fe&&W.reduce((tt,mt)=>X.has(mt.label)||mt.label===pe?tt:tt+1,0)<1)return X;let Ne=new Set(X);return Fe?Ne.delete(pe):Ne.add(pe),Ne},[W]),de=Oe.useCallback(X=>{if(f){let pe=u;if(!pe.has(X)&&W.reduce((Ve,tt)=>pe.has(tt.label)||tt.label===X?Ve:Ve+1,0)<1){x(null);return}m?.(Ne=>re(Ne,X));}else N(pe=>re(pe,X));x(null);},[f,u,m,W,re]),xe=Oe.useMemo(()=>W.map(X=>X.label).join(""),[W]),he=Oe.useRef(xe);Oe.useEffect(()=>{he.current!==xe&&(he.current=xe,f||N(X=>X.size===0?X:new Set));},[xe,f]);let Ee=Oe.useMemo(()=>$.flat(),[$]),$e=Oe.useMemo(()=>{if(Ee.length===0)return null;let X=[...Ee].sort((pe,Fe)=>pe.xValue.getTime()-Fe.xValue.getTime());return [X[0].xValue,X[X.length-1].xValue]},[Ee]),lr=S||$e,ee=Oe.useCallback(X=>{h?l?.(X):v(X);},[h,l]),te=Oe.useMemo(()=>lr?K.map(pe=>pe.filter(Fe=>Fe.xValue>=lr[0]&&Fe.xValue<=lr[1])):K,[K,lr]),ne=Oe.useMemo(()=>U.map(X=>te[X]??[]),[U,te]);Oe.useEffect(()=>{l&&l(S);},[S,l]);let V=Oe.useMemo(()=>U.flatMap(X=>te[X]??[]),[te,U]),z=Oe.useMemo(()=>di(V,I,r,o),[V,I,r,o]),le=Oe.useRef(JSON.stringify(r)),se=Oe.useRef(null),ce=Oe.useMemo(()=>{let[X,pe]=z.domain(),Fe=Math.max(Math.abs(X),Math.abs(pe)),Ne=JSON.stringify(r);if(Ne!==le.current&&(le.current=Ne,se.current=null),se.current!==null)return se.current;if(Fe===0)return Sa(r,0);let Ve=Sa(r,Fe);return se.current=Ve,Ve},[z,r]),We=Oe.useMemo(()=>{let X=I-Ie.top-Ie.bottom;return Na(X)},[I]),ue=Oe.useMemo(()=>{let X=Hr(ce),pe=X.tickFormat||X.format,Ne=z.ticks(We).map(mt=>pe(mt)),Ve=wa(Ne,12,"system-ui"),tt=Math.ceil(Ve)+12;return {...Ie,left:Math.max(tt,30),right:8}},[z,ce,We]),et=Oe.useMemo(()=>lr?scale.scaleTime({domain:lr,range:[ue.left,L-ue.right]}):ru(Ee,L),[lr,Ee,L,ue]),fo=Oe.useCallback(X=>{if(!$e)return;let{scaleX:pe,translateX:Fe}=X,Ne=L-ue.left-ue.right,[Ve,tt]=$e,mt=tt.getTime()-Ve.getTime();if(mt<=0){ee(null);return}let Ae=-Fe,ft=Ae+Ne,De=Ne*pe/mt,St=Ae/De,Pe=ft/De,an=new Date(Ve.getTime()+St),na=new Date(Ve.getTime()+Pe),sn=Math.abs(an.getTime()-Ve.getTime()),wc=Math.abs(na.getTime()-tt.getTime()),zp=mt*.02;sn<zp&&wc<zp?ee(null):ee([an,na]);},[$e,L,ue,ee]),Sr=Oe.useCallback(X=>{let{left:pe}=k.current?.getBoundingClientRect()||{left:0},Fe=X.clientX-pe;if(X.timeStamp-(A.current||0)<16)return;A.current=X.timeStamp;let Ne=et.invert(Fe),Ve=ne.map((Ae,ft)=>{if(!Ae||Ae.length===0)return null;let De=Vk(Ae,Ne,1);if(De===0)return {point:Ae[0],index:0,datasetIndex:ft};if(De>=Ae.length)return {point:Ae[Ae.length-1],index:Ae.length-1,datasetIndex:ft};let St=Ae[De-1],Pe=Ae[De];if(!St||!Pe)return null;let an=Math.abs(St.xValue.getTime()-Ne.getTime()),na=Math.abs(Pe.xValue.getTime()-Ne.getTime()),sn=an<na;return {point:sn?St:Pe,index:sn?De-1:De,datasetIndex:ft}}).filter(Ae=>Ae!==null&&ae[Ae.datasetIndex]!==void 0).map(({point:Ae,index:ft,datasetIndex:De})=>({label:ae[De].label,value:Ae.yValue,baselineValue:Bk(ae[De],Ae,ft),color:ae[De].color,point:Ae,type:Z[De]}));if(Ve.length===0){x(null);return}let tt=et(Ve[0].point.xValue),mt=tt>(L-ue.right-ue.left)/2+ue.left;x({xValue:Ve[0].point.xValue,series:Ve.map(({label:Ae,value:ft,baselineValue:De,color:St,point:Pe,type:an})=>({label:Ae,value:ft,...De!==void 0?{baselineValue:De}:{},chartY:Pe.chartYValue??ft,showMarker:Pe.showTooltipMarker??true,color:St,type:an,category:Pe.category,categoryColor:Pe.category&&j?j[Pe.category]:void 0,...Pe.extraTooltipRows&&Pe.extraTooltipRows.length>0?{extraTooltipRows:Pe.extraTooltipRows}:{}})),x:tt,y:z(Ve[0].point.chartYValue??Ve[0].value),position:mt?"left":"right"});},[ne,ae,Z,et,z,L,j,ue]),vc=()=>{x(null);},Cc=Oe.useCallback(()=>{ee(null),D.current&&D.current.reset();},[ee]),$i=Oe.useCallback(X=>{if(!(D.current&&$e))return;let[pe,Fe]=$e,Ne=Fe.getTime()-pe.getTime();if(Ne<=0){D.current.reset();return}if(!X){D.current.reset();return}let[Ve,tt]=X,mt=tt.getTime()-Ve.getTime();if(mt<=0){D.current.reset();return}let Ae=Ne/mt,ft=L-ue.left-ue.right,St=-((Ve.getTime()-pe.getTime())/Ne)*ft*Ae;D.current.setTransformMatrix({scaleX:Ae,scaleY:1,translateX:St,translateY:0,skewX:0,skewY:0});},[$e,L,ue]),pv=Oe.useCallback(X=>{ee(X),$i(X);},[ee,$i]);Oe.useEffect(()=>{h&&$i(d??null);},[h,d,$i]);let mv={width:L,height:I,xScale:et,yScale:z,yFormatter:ce,animationSettings:Vs,tooltip:{data:b,show:x,hide:()=>x(null)},datasets:ne,seriesMetadata:ae,seriesTypes:Z,categoryColors:j||void 0,categoryLabels:Q||void 0},fv=Oe.Children.toArray(g),Ip=0,Fp=[],Bp=[],Sc=[];fv.forEach(X=>{if(!Oe.isValidElement(X)){Sc.push(X);return}if(Fk(X))Bp.push(X);else if(Hg(X)){let pe=Ip;Ip++;let Fe=X.props,Ne=W[pe]?.label;if(F(Ne))return;Fp.push(Oe__namespace.default.cloneElement(X,{...Fe,data:te[pe]||Fe.data,color:W[pe]?.color}));}else Sc.push(X);});let gv=U.length,bv=(q||W).map(X=>{let pe=!q&&F(X.label);return {category:X.label,fill:X.color,isHidden:pe,isDisabled:!q&&!pe&&gv<=1}}),xv=typeof r=="object"&&r!==null&&typeof r.type=="string",hv=Ks({datasets:$,metadata:{xLabel:"Date",yLabel:"Value",seriesLabels:ae.map(X=>X.label),timestamp:true,...xv?{yFormat:r}:{}},svgRef:k});if(a)return jsxRuntime.jsx(Ok,{});if(K.length===0)return jsxRuntime.jsx(zk,{});let Vp=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("title",{children:"Data chart visualization"}),jsxRuntime.jsx("g",{children:z.ticks(We).map(X=>{let pe=Math.abs(X)<Number.EPSILON;return jsxRuntime.jsx(shape.Line,{from:{x:ue.left,y:z(X)},to:{x:L-ue.right,y:z(X)},stroke:pe?"var(--color-border-default)":"var(--color-border-muted)",strokeWidth:pe?1.5:1},`grid-line-${X}`)})}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("clipPath",{id:T,children:jsxRuntime.jsx("rect",{x:et.range()[0],y:z.range()[1],width:et.range()[1]-et.range()[0],height:z.range()[0]-z.range()[1]})})}),jsxRuntime.jsx("g",{clipPath:`url(#${T})`,children:Fp}),Sc,n&&n.length>0&&jsxRuntime.jsx("g",{children:n.map(X=>{let pe=z(X.value),Fe=X.color??"var(--color-error-base)";return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx(shape.Line,{from:{x:ue.left,y:pe},to:{x:L-ue.right,y:pe},stroke:Fe,strokeWidth:1.5,strokeDasharray:"6 4"}),X.label&&jsxRuntime.jsx("text",{x:L-ue.right-4,y:pe-4,textAnchor:"end",fontSize:11,fill:Fe,children:X.label})]},`ref-line-${X.value}`)})}),jsxRuntime.jsx(Mr.Bottom,{top:I-ue.bottom,scale:et,width:L-ue.left-ue.right}),jsxRuntime.jsx(Mr.Left,{left:ue.left,scale:z,yFormatter:ce,height:I-ue.top-ue.bottom}),b&&!b.isEvent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[fe?(()=>{let X=$[ie]??[];if(X.length===0)return null;let pe=[...X].sort((De,St)=>De.xValue.getTime()-St.xValue.getTime()),Fe=pe.findIndex(De=>De.xValue.getTime()===b.xValue.getTime()),Ne=pe[Fe+1],Ve=pe.length>1&&Ne?Ne.xValue.getTime()-b.xValue.getTime():15*6e4,tt=Math.abs(et(new Date(b.xValue.getTime()+Ve))-et(b.xValue)),Ae=et(b.xValue)-tt/2,ft=z.range();return jsxRuntime.jsx("rect",{x:Ae,y:ft[1],width:tt,height:ft[0]-ft[1],className:"fill-background-muted",opacity:.5,pointerEvents:"none",style:{transition:"all 100ms ease-out"}})})():null,b.series.filter(X=>X.type!=="bar"&&X.showMarker!==false).map(X=>jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:et(b.xValue),cy:z(X.chartY??X.value),r:8,fill:"white",stroke:X.color,strokeWidth:2,style:{transition:"all 100ms ease-out"}}),jsxRuntime.jsx("circle",{cx:et(b.xValue),cy:z(X.chartY??X.value),r:4,fill:X.color,style:{transition:"all 100ms ease-out"}})]},`highlight-${X.label}`))]}),jsxRuntime.jsx("rect",{x:ue.left,y:ue.top,width:L-ue.left-ue.right,height:I-ue.top-ue.bottom,fill:"transparent",style:{cursor:i?"grab":"crosshair",touchAction:"none"},onMouseMove:Sr,onMouseLeave:vc}),Bp]});return jsxRuntime.jsx("div",{className:"relative flex h-full flex-col",children:jsxRuntime.jsxs(Rr.Provider,{value:mv,children:[i?jsxRuntime.jsx(zoom.Zoom,{width:L,height:I,scaleXMin:1,scaleXMax:20,scaleYMin:1,scaleYMax:1,constrain:X=>{let{scaleX:pe,translateX:Fe}=X,Ne=Math.max(1,Math.min(20,pe)),Ve=1,tt=L-ue.left-ue.right,mt=0,Ae=tt*(1-Ne),ft=Math.max(Ae,Math.min(mt,Fe));return {...X,scaleX:Ne,scaleY:Ve,translateX:ft,translateY:0}},children:X=>{if(D.current=X,X.transformMatrix){let{scaleX:pe,translateX:Fe}=X.transformMatrix,Ne=`${pe.toFixed(4)}-${Fe.toFixed(2)}`;Ne!==E.current&&(E.current=Ne,setTimeout(()=>{fo(X.transformMatrix);},0));}return jsxRuntime.jsx("svg",{width:L,height:I,className:"overflow-visible",ref:pe=>{k.current=pe,X.containerRef.current!==pe&&(X.containerRef.current=pe);},role:"img","aria-label":"Data chart",style:{cursor:X.isDragging?"grabbing":"grab",touchAction:"none"},onMouseDown:X.dragStart,onMouseMove:X.dragMove,onMouseUp:X.dragEnd,onMouseLeave:()=>{X.isDragging&&X.dragEnd();},onTouchStart:X.dragStart,onTouchMove:X.dragMove,onTouchEnd:X.dragEnd,children:Vp})}}):jsxRuntime.jsx("svg",{width:L,height:I,className:"overflow-visible",ref:k,role:"img","aria-label":"Data chart",children:Vp}),jsxRuntime.jsx(Xo,{data:b,formatter:ce}),s&&$e&&jsxRuntime.jsx(du,{data:$,seriesMetadata:ae,width:L,height:c,onBrushChange:pv,brushRegion:S,margin:ue,...o?{yDomain:o}:{}}),!p&&jsxRuntime.jsx(Ta,{onExport:hv,items:bv,marginLeft:0,marginRight:ue.right,isZoomed:S!==null,onResetZoom:Cc,onLegendItemToggle:q?void 0:de})]})})},Gg=responsive.withParentSize(Hk);var Jk=e=>e.toLocaleString(),Xk=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=Xk,color:s,showScale:c=true,showOverallConversion:l=true,overallConversionLabel:d="Overall Conversion:",activeStageId:u,onStageClick:m,onStageHover:p,className:g,style:f,"aria-label":h="Funnel chart"})=>{let[b,x]=Oe.useState(null),[y,v]=Oe.useState(t),S=Oe.useRef(null),w=u??b,N=Oe.useId(),M=s||"var(--color-viz-default)";Oe.useEffect(()=>{if(!S.current)return;let R=new ResizeObserver(H=>{for(let G of H)v(G.contentRect.width);});return R.observe(S.current),()=>{R.disconnect();}},[]);let{layout:k,overallConversion:T}=Oe.useMemo(()=>{if(e.length===0)return {layout:[],overallConversion:0};let R=e[0].value,H=l?60:0,G=r-o*2-H,K=(e.length-1)*n,W=(G-K)/e.length,q=e.map((Q,O)=>{let L=o+H+O*(W+n),Y=R===0?0:Q.value/R,P=Y,C=O===0?null:e[O-1].value,I=C==null||C===0?0:1-Q.value/C;return {stage:Q,index:O,y:L,barHeight:W,widthPercent:Y,conversionRate:P,dropOff:I}}),j=R===0?0:e[e.length-1].value/R;return {layout:q,overallConversion:j,maxValue:R}},[e,y,r,o,n,c,l]);if(e.length===0)return jsxRuntime.jsx("div",{className:tailwindMerge.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 A=c?60:0,E=o+A,D=y-o*2-A;return jsxRuntime.jsx("div",{ref:S,className:tailwindMerge.twMerge("relative w-full overflow-hidden rounded-lg bg-background-surface",g),style:{height:r,...f},"aria-label":h,role:"img",children:jsxRuntime.jsxs("svg",{width:"100%",height:r,className:"relative",children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx(gradient.LinearGradient,{id:`${N}-bar`,from:M,to:M,toOpacity:.85}),jsxRuntime.jsx(gradient.LinearGradient,{id:`${N}-bg`,from:M,to:M,fromOpacity:.01,toOpacity:.15,x1:"0",y1:"0",x2:"1",y2:"0"})]}),l&&jsxRuntime.jsxs("text",{x:E,y:o+20,className:"fill-text-primary text-sm font-medium",children:[jsxRuntime.jsx("tspan",{className:"fill-text-secondary",children:d})," ",i(T)]}),c&&jsxRuntime.jsx("g",{children:k.map(R=>{let H=R.y+R.barHeight/2;return jsxRuntime.jsx("text",{x:o+A-12,y:H,textAnchor:"end",dominantBaseline:"middle",className:"fill-text-secondary text-xs",children:i(R.conversionRate)},R.stage.id)})}),k.map(R=>{let H=w===R.stage.id,G=D*R.widthPercent;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:E,y:R.y,width:D,height:R.barHeight,fill:`url(#${N}-bg)`,rx:4}),jsxRuntime.jsx(framerMotion.motion.rect,{x:E,y:R.y,width:G,height:R.barHeight,fill:`url(#${N}-bar)`,rx:4,initial:{width:0},animate:{width:G},transition:{duration:.6,delay:R.index*.1,ease:"easeOut"},opacity:H||w==null?1:.5,style:{cursor:m||p?"pointer":"default",transition:"opacity 150ms ease"},onMouseEnter:()=>{x(R.stage.id),p?.(R.stage);},onMouseLeave:()=>{x(null),p?.(null);},onClick:()=>m?.(R.stage)}),jsxRuntime.jsx("rect",{x:E+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"}}),jsxRuntime.jsx("text",{x:E+16,y:R.y+R.barHeight/2+4,className:"fill-text-primary text-xs font-semibold",style:{pointerEvents:"none"},children:a(R.stage.value)}),jsxRuntime.jsxs("text",{x:E,y:R.y-8,className:"fill-text-secondary text-xs",style:{pointerEvents:"none"},children:[jsxRuntime.jsx("tspan",{children:R.index+1})," ",R.stage.label]}),R.stage.secondaryValue&&jsxRuntime.jsx("text",{x:E+16,y:R.y-24,className:"fill-text-secondary text-xs",style:{pointerEvents:"none"},children:R.stage.secondaryValue}),R.index>0&&R.dropOff>0&&jsxRuntime.jsxs("text",{x:E+D,y:R.y-8,textAnchor:"end",className:"fill-text-secondary text-xs",children:[i(R.dropOff)," drop"]}),R.stage.annotation&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:E+G+8,y:R.y+8,width:60,height:24,rx:3,className:"fill-background-muted"}),jsxRuntime.jsx("text",{x:E+G+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 qk=d3Array.bisector(e=>e.xValue).left,Qk=(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=qk(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 h=p[f-1],b=p[f];if(!h||!b)return null;let x=Math.abs(h.xValue.getTime()-l.getTime()),y=Math.abs(b.xValue.getTime()-l.getTime()),v=x<y;return {point:v?h: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:Qk(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:h,point:b,type:x})=>({label:p,value:g,...f!==void 0?{baselineValue:f}:{},chartY:b.chartYValue??g,showMarker:b.showTooltipMarker??true,color:h,type:x,...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 Zg=e=>e instanceof Date&&!Number.isNaN(e.getTime()),eT=160;function js(e,t,r){let[o,n]=Oe.useState(null);Oe.useImperativeHandle(r,()=>({setPreview:n}),[]);let[a,i]=e.range(),s=Oe.useMemo(()=>o?d3Scale.scaleTime().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=Zg(l)&&Zg(d),m=t<400,p=Math.max(2,Math.min(8,Math.floor(t/(m?70:110)))),g=Oe.useMemo(()=>{if(!u)return [];let f=i-a;if(f<=0)return s.ticks(p);let[h,b]=s.domain(),x=h.getTime(),y=b.getTime(),v=(y-x)/f,S=Math.min(eT,f),w=S*v,N=d3Scale.scaleTime().domain([new Date(x-w),new Date(y+w)]).range([a-S,i+S]),M=d3Time.timeTickInterval(h,b,p);if(M)return N.ticks(M);let k=Math.max(2,Math.round(p*(f+2*S)/f));return N.ticks(k)},[s,p,u,a,i]);return {activeScale:s,ticks:g,start:l,end:d,valid:u,compact:m,rangeStart:a,rangeEnd:i}}var nT=6,_g=20,fu=Oe.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}=js(t,r,o),m=a.length>=2?a[1].getTime()-a[0].getTime():s.getTime()-i.getTime(),p=Oe.useMemo(()=>c?Wm(m,{compact:l}):()=>"",[m,l,c]),g=Oe.useId(),f=Math.min(d,u),h=Math.abs(u-d);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:d,x2:u,y1:e,y2:e,stroke:"var(--color-border-muted)",strokeWidth:1}),a.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("clipPath",{id:g,children:jsxRuntime.jsx("rect",{x:f,y:e-4,width:h,height:_g+16})})}),jsxRuntime.jsx("g",{clipPath:`url(#${g})`,children:a.map(b=>jsxRuntime.jsxs("g",{transform:`translate(${n(b)},${e})`,children:[jsxRuntime.jsx("line",{x1:0,x2:0,y1:0,y2:nT,stroke:"var(--color-border-muted)",strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:_g,textAnchor:"middle",fontSize:12,fill:"var(--color-text-secondary)",children:p(b)})]},b.getTime()))})]})]})});fu.displayName="LiveTimeAxisBottom";var gu=Oe.forwardRef(({scale:e,width:t,top:r,bottom:o},n)=>{let{activeScale:a,ticks:i,rangeStart:s,rangeEnd:c}=js(e,t,n),l=Oe.useId(),d=Math.min(s,c),u=Math.abs(c-s);return jsxRuntime.jsxs("g",{"aria-hidden":"true",children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("clipPath",{id:l,children:jsxRuntime.jsx("rect",{x:d,y:r,width:u,height:o-r})})}),jsxRuntime.jsx("g",{clipPath:`url(#${l})`,children:i.map(m=>{let p=a(m);return jsxRuntime.jsx("line",{x1:p,x2:p,y1:r,y2:o,stroke:"var(--color-border-muted)",strokeWidth:1},m.getTime())})})]})});gu.displayName="LiveTimeGridlines";function qs(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 bu(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=qs(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]},dT=e=>typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(()=>e(0),0),uT=e=>{typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):clearTimeout(e);};function rb(e){let{groupRef:t}=e,r=Oe.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=Oe.useRef(e.onCommit);o.current=e.onCommit;let n=Oe.useRef(e.panBoundsMs);n.current=e.panBoundsMs;let a=Oe.useRef(e.settleMs??140);a.current=e.settleMs??140;let i=Oe.useRef(e.zoomIntent??(E=>E.ctrlKey));i.current=e.zoomIntent??(E=>E.ctrlKey);let s=Oe.useRef(e.onGestureStart);s.current=e.onGestureStart;let c=Oe.useRef(e.onFramePreview);c.current=e.onFramePreview;let l=Oe.useRef(null),d=Oe.useRef({scale:1,cursorFrac:.5,panDxPx:0,timer:null}),u=Oe.useRef(null),m=Oe.useRef(null),p=Oe.useRef(false),g=Oe.useCallback((E,D,R)=>{m.current={translateX:E,scaleX:D,preview:R},u.current==null&&(u.current=dT(()=>{u.current=null;let H=m.current;H!=null&&(t.current?.setAttribute("transform",`translate(${H.translateX},0) scale(${H.scaleX},1)`),c.current?.(H.preview));}));},[t]),f=Oe.useCallback(()=>{u.current!=null&&(uT(u.current),u.current=null),m.current=null,t.current?.removeAttribute("transform"),c.current?.(null);},[t]),h=Oe.useCallback(()=>{p.current||(p.current=true,s.current?.());},[]),b=Oe.useCallback(()=>{p.current=false;},[]),x=Oe.useCallback(()=>{d.current.timer!=null&&(clearTimeout(d.current.timer),d.current.timer=null);},[]),y=Oe.useCallback(()=>{d.current={scale:1,cursorFrac:.5,panDxPx:0,timer:null};},[]),v=Oe.useCallback(()=>{let{xDomain:E,plotWidthPx:D}=r.current,{scale:R,cursorFrac:H,panDxPx:G}=d.current;R===1&&G===0||o.current(tb(eb(E,R,H,G,D),n.current));},[]),S=Oe.useCallback(()=>{d.current.timer!=null&&(x(),v(),y(),f());},[x,v,y,f]),w=Oe.useCallback(E=>{S(),E.currentTarget.setPointerCapture?.(E.pointerId),l.current={startX:E.clientX,dxPx:0},h();},[S,h]),N=Oe.useCallback(E=>{if(!l.current)return;l.current.dxPx=E.clientX-l.current.startX;let{xDomain:D,plotWidthPx:R}=r.current;g(l.current.dxPx,1,qs(D,l.current.dxPx,R));},[g]),M=Oe.useCallback(E=>{if(!l.current)return;let{dxPx:D}=l.current;l.current=null,f(),b(),D!==0&&o.current(tb(qs(r.current.xDomain,D,r.current.plotWidthPx),n.current));},[f,b]),k=Oe.useCallback(()=>{l.current&&(l.current=null,f(),b());},[f,b]),T=Oe.useRef(null),A=Oe.useCallback(E=>{if(T.current?.(),T.current=null,!E)return;let D=R=>{if(l.current)return;let{plotWidthPx:H,plotLeftPx:G}=r.current,K=bu(R.deltaY,R.deltaMode),W=bu(R.deltaX,R.deltaMode),q=i.current(R);if(!q&&W===0)return;if(R.preventDefault(),h(),q){let L=Math.min(1,Math.max(0,(R.clientX-E.getBoundingClientRect().left)/Math.max(1,H)));d.current.scale*=Math.exp(-K/200),d.current.cursorFrac=L;}else d.current.panDxPx-=W;let{scale:j,cursorFrac:Q,panDxPx:O}=d.current;g((G+Q*H)*(1-j)+O,j,eb(r.current.xDomain,j,Q,O,H)),x(),d.current.timer=setTimeout(()=>{v(),y(),f(),b();},a.current);};E.addEventListener("wheel",D,{passive:false}),T.current=()=>E.removeEventListener("wheel",D);},[g,f,x,v,y,h,b]);return Oe.useEffect(()=>()=>{T.current?.(),T.current=null,f(),d.current.timer!=null&&clearTimeout(d.current.timer);},[f]),{onPointerDown:w,onPointerMove:N,onPointerUp:M,onPointerCancel:k,wheelTargetRef:A,gestureActiveRef:p}}var ib=e=>e.type===Jo||e.type===Pn,xT=({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]=Oe.useState(null),p=Oe.useRef(null),g=Oe.useRef(0),f=Oe.useId(),h=Oe.useRef(null),b=Oe.useRef(null),x=Oe.useRef(null),{colorMode:y}=Vt(),v=Oe.useMemo(()=>cn(),[y]),S=Oe.useMemo(()=>qa(),[y]),{datasets:w,seriesMetadata:N,seriesTypes:M}=Oe.useMemo(()=>{let ee=Oe.Children.toArray(e).filter(le=>Oe.isValidElement(le)&&ib(le)),te=ee.filter(le=>le.props.data).length,ne=[],V=[],z=[];return ee.forEach((le,se)=>{let ce=le.props;if(!ce.data)return;ne.push(ce.data);let ue=("color"in ce&&ce.color?ce.color:void 0)||(te===1?S:v[se%v.length]),et=le.type===Jo;V.push({label:"label"in ce&&ce.label||`Series ${ne.length}`,color:ue,...et&&"baseline"in ce&&ce.baseline!==void 0?{baseline:ce.baseline,tooltipRange:"tooltipRange"in ce&&ce.tooltipRange||false}:{}}),z.push(et?"area":"line");}),{datasets:ne,seriesMetadata:V,seriesTypes:z}},[e,S,v]),k=l,T=Math.max(100,d-60),A=Oe.useMemo(()=>[new Date(t.startMs),new Date(t.endMs)],[t.startMs,t.endMs]),E=Oe.useMemo(()=>{let ee=w.flat(),te=ee.filter(ne=>{let V=ne.xValue.getTime();return V>=t.startMs&&V<=t.endMs});return te.length>0?te:ee},[w,t.startMs,t.endMs]),D=Oe.useMemo(()=>{let ee=di(E,T,a,i);if(!i){let[te,ne]=ee.domain();ne>te&&ee.domain([te,ne+(ne-te)*.05]);}return ee},[E,T,a,i]),R=Oe.useRef(JSON.stringify(a)),H=Oe.useRef(null),G=Oe.useMemo(()=>{let[ee,te]=D.domain(),ne=Math.max(Math.abs(ee),Math.abs(te)),V=JSON.stringify(a);if(V!==R.current&&(R.current=V,H.current=null),H.current!==null)return H.current;if(ne===0)return Sa(a,0);let z=Sa(a,ne);return H.current=z,z},[D,a]),K=Oe.useMemo(()=>{let ee=T-Ie.top-Ie.bottom;return Na(ee)},[T]),W=Oe.useMemo(()=>{let ee=Hr(G),te=ee.tickFormat||ee.format,V=D.ticks(K).map(se=>te(se)),z=wa(V,12,"system-ui"),le=Math.ceil(z)+12;return {...Ie,left:Math.max(le,30)}},[D,G,K]),q=Oe.useMemo(()=>scale.scaleTime({domain:A,range:[W.left,k-W.right]}),[A,k,W]),j=Oe.useMemo(()=>[t.startMs,t.endMs],[t.startMs,t.endMs]),Q=Oe.useMemo(()=>r?[r.startMs,r.endMs]:void 0,[r]),O=Oe.useCallback(ee=>{o({startMs:ee[0],endMs:ee[1]});},[o]),L=k-W.left-W.right,Y=Oe.useCallback(()=>m(null),[]),P=Oe.useRef({}),C=Oe.useRef(c);C.current=c;let I=Oe.useCallback(ee=>{b.current?.setPreview(ee),x.current?.setPreview(ee),C.current?.publish(P.current,ee);},[]),{onPointerDown:F,onPointerMove:U,onPointerUp:$,onPointerCancel:ae,wheelTargetRef:Z,gestureActiveRef:ie}=rb({xDomain:j,plotWidthPx:L,plotLeftPx:W.left,groupRef:h,onCommit:O,onGestureStart:Y,onFramePreview:I,...Q?{panBoundsMs:Q}:{}}),fe=Oe.useRef({startMs:t.startMs,endMs:t.endMs,left:0,width:0});fe.current={startMs:t.startMs,endMs:t.endMs,left:W.left,width:L},Oe.useEffect(()=>{if(!c)return;let ee=()=>{h.current?.removeAttribute("transform"),b.current?.setPreview(null),x.current?.setPreview(null);},te=V=>{if(ie.current)return;if(V==null){ee();return}let{startMs:z,endMs:le,left:se,width:ce}=fe.current,We=le-z,ue=V[1]-V[0];if(We<=0||ue<=0||ce<=0)return;let et=We/ue,fo=se*(1-et)+(z-V[0])*ce/ue;h.current?.setAttribute("transform",`translate(${fo},0) scale(${et},1)`),b.current?.setPreview(V),x.current?.setPreview(V);},ne=c.subscribe(P.current,te);return ()=>{ne(),ie.current||ee();}},[c,ie]),Oe.useEffect(()=>{n?.(Math.max(0,k-W.left-W.right));},[k,W,n]);let re=Oe.useCallback(ee=>{if(ie.current)return;let{left:te}=p.current?.getBoundingClientRect()||{left:0},ne=ee.clientX-te;ee.timeStamp-(g.current||0)<16||(g.current=ee.timeStamp,m(jg({mouseX:ne,datasets:w,seriesMetadata:N,seriesTypes:M,xScale:q,yScale:D,plotLeft:W.left,plotRight:k-W.right})));},[w,N,M,q,D,k,W,ie]),de=Oe.useCallback(()=>m(null),[]),xe={width:k,height:T,xScale:q,yScale:D,yFormatter:G,animationSettings:Vs,tooltip:{data:u,show:m,hide:()=>m(null)},datasets:w,seriesMetadata:N,seriesTypes:M},he=0,Ee=[];Oe.Children.toArray(e).forEach(ee=>{if(!Oe.isValidElement(ee)){Ee.push(ee);return}if(ib(ee)){let te=he;he++;let ne=ee.props;Ee.push(Oe__namespace.default.cloneElement(ee,{...ne,color:N[te]?.color,animate:false}));}else Ee.push(ee);});let $e=N.map(ee=>({category:ee.label,fill:ee.color})),Eo=Ks({datasets:w,metadata:{xLabel:"Date",yLabel:"Value",seriesLabels:N.map(ee=>ee.label),timestamp:true},svgRef:p}),lr=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("title",{children:"Data chart visualization"}),jsxRuntime.jsx("g",{children:D.ticks(K).map(ee=>{let te=Math.abs(ee)<Number.EPSILON;return jsxRuntime.jsx(shape.Line,{from:{x:W.left,y:D(ee)},to:{x:k-W.right,y:D(ee)},stroke:te?"var(--color-border-default)":"var(--color-border-muted)",strokeWidth:te?1.5:1},`grid-line-${ee}`)})}),jsxRuntime.jsx(gu,{ref:x,scale:q,width:k-W.left-W.right,top:D.range()[1],bottom:D.range()[0]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("clipPath",{id:f,children:jsxRuntime.jsx("rect",{x:q.range()[0],y:D.range()[1],width:q.range()[1]-q.range()[0],height:D.range()[0]-D.range()[1]})})}),jsxRuntime.jsx("g",{clipPath:`url(#${f})`,children:jsxRuntime.jsx("g",{"data-camera-plot-group":"",ref:h,children:Ee})}),s&&s.length>0&&jsxRuntime.jsx("g",{children:s.map(ee=>{let te=D(ee.value),ne=ee.color??"var(--color-error-base)";return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx(shape.Line,{from:{x:W.left,y:te},to:{x:k-W.right,y:te},stroke:ne,strokeWidth:1.5,strokeDasharray:"6 4"}),ee.label&&jsxRuntime.jsx("text",{x:k-W.right-4,y:te-4,textAnchor:"end",fontSize:11,fill:ne,children:ee.label})]},`ref-line-${ee.value}`)})}),jsxRuntime.jsx(fu,{ref:b,top:T-W.bottom,scale:q,width:k-W.left-W.right}),jsxRuntime.jsx(Mr.Left,{left:W.left,scale:D,yFormatter:G,height:T-W.top-W.bottom}),u&&!u.isEvent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(shape.Line,{"data-testid":"chart-hover-crosshair",from:{x:q(u.xValue),y:D.range()[1]},to:{x:q(u.xValue),y:D.range()[0]},stroke:"var(--color-text-secondary)",strokeWidth:1,strokeDasharray:"3 3",opacity:.7}),u.series.filter(ee=>ee.type!=="bar"&&ee.showMarker!==false).map(ee=>jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:q(u.xValue),cy:D(ee.chartY??ee.value),r:8,fill:"white",stroke:ee.color,strokeWidth:2,style:{transition:"all 100ms ease-out"}}),jsxRuntime.jsx("circle",{cx:q(u.xValue),cy:D(ee.chartY??ee.value),r:4,fill:ee.color,style:{transition:"all 100ms ease-out"}})]},`highlight-${ee.label}`))]}),jsxRuntime.jsx("rect",{"data-camera-surface":"",x:W.left,y:W.top,width:k-W.left-W.right,height:T-W.top-W.bottom,fill:"transparent",style:{cursor:"grab",touchAction:"none"},onMouseMove:re,onMouseLeave:de,onPointerDown:F,onPointerMove:U,onPointerUp:$,onPointerCancel:ae,ref:Z})]});return jsxRuntime.jsx("div",{className:"relative flex h-full flex-col",children:jsxRuntime.jsxs(Rr.Provider,{value:xe,children:[jsxRuntime.jsx("svg",{width:k,height:T,className:"overflow-visible",ref:p,role:"img","aria-label":"Data chart",children:lr}),jsxRuntime.jsx(Xo,{data:u,formatter:G}),jsxRuntime.jsx(Ta,{onExport:Eo,items:$e,marginLeft:0,marginRight:W.right})]})})},Qs=responsive.withParentSize(xT);function Zs(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 hT(e,t){return Math.floor(e/t.tileSpanMs)}function jo(e,t,r){let o=hT(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 rr=(e,t)=>`${e}:${t}`;var lb={erroredTiles:0};function hu(e,t){let r=new Map,o=new Map,n=new Map,a=0;for(let d of e){let u=t.get(rr(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 yT(e,t,r){let o=jo(e,t,0);return o.length===0?false:o.every(n=>{let a=r.get(rr(n.tierId,n.index));return a!=null&&(a.status==="loaded"||a.status==="empty")})}function cb(e,t,r){return jo(e,t,0).some(n=>{let a=r.get(rr(n.tierId,n.index));return a?.status==="loaded"&&(a.data?.line.length??0)>0})}function vT(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 db({viewport:e,targetTier:t,ladder:r,store:o,overscanTiles:n,prev:a}){let i=yT(e,t,o);if(i&&cb(e,t,o)){let c=jo(e,t,n),{line:l,band:d,lines:u,coverage:m}=hu(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(cb(e,l,o)){let d=jo(e,l,n),{line:u,band:m,lines:p,coverage:g}=hu(d,o);return {line:u,band:m,lines:p,renderTier:l,targetTier:t,isFallback:true,isStale:false,coverage:g}}}if(i){let c=jo(e,t,n),{line:l,band:d,lines:u,coverage:m}=hu(c,o);return {line:l,band:d,lines:u,renderTier:t,targetTier:t,isFallback:false,isStale:false,coverage:m}}return a?vT(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:lb}:{line:[],band:[],lines:{},renderTier:null,targetTier:t,isFallback:false,isStale:false,coverage:lb}}var ub=new Map;function pb(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 fb({refs:e,refsKey:t,store:r,tier:o,viewport:n,fetchTile:a,dispatch:i,concurrency:s,maxFutureMs:c}){let l=Oe.useRef(e);l.current=e;let d=Oe.useRef(n);d.current=n;let u=Oe.useRef(new Map),m=Oe.useCallback(()=>{for(let p of u.current.values())p.ac.abort();u.current.clear();},[]);return Oe.useEffect(()=>{for(let[b,x]of u.current)x.tierId!==o.id&&(x.ac.abort(),u.current.delete(b));let p=l.current.filter(b=>{let x=rr(b.tierId,b.index),y=r.get(x);return y?y.status==="loading"&&!u.current.has(x):true}),g=(d.current.startMs+d.current.endMs)/2;p.sort((b,x)=>Math.abs((b.startMs+b.endMs)/2-g)-Math.abs((x.startMs+x.endMs)/2-g));let f=Math.max(0,s-u.current.size),h=p.slice(0,f);if(h.length!==0){i({type:"request",ids:h.map(b=>rr(b.tierId,b.index))});for(let b of h){let x=rr(b.tierId,b.index),y=new AbortController;u.current.set(x,{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:x,data:S});}).catch(S=>{if(!y.signal.aborted){let w=S instanceof Error?S.message:String(S);i({type:"failed",id:x,error:new Error(`tile fetch failed (tile ${x}, tier ${o.id}): ${w}`)});}}).finally(()=>{u.current.delete(x);});}}},[t,r,a,o,i,s,c]),Oe.useEffect(()=>m,[m]),{abortAll:m}}var xb=1.3,wT=25e4,NT=3;function kT(e,t,r){let o=t.tileSpanMs/t.bucketMs,n=Math.max(1,Math.floor(wT/o/r));return Math.min(Math.max(1,Math.ceil(.5*e/t.tileSpanMs)),n)}function yb(e){let{fetchTile:t,ladder:r,nativeMs:o,viewport:n,widthPx:a,maxFutureMs:i,targetPointsPerPx:s=1,concurrency:c=3,tileCostSeriesCount:l=NT,resetKey:d}=e,u=Oe.useMemo(()=>({targetPointsPerPx:s,nativeMs:o}),[s,o]),[m,p]=Oe.useState(()=>Zs(n.endMs-n.startMs,Math.max(1,a),r,u)),[g,f]=Oe.useReducer(pb,ub),h=Oe.useRef(n.endMs-n.startMs),b=Oe.useRef(u);Oe.useEffect(()=>{let G=n.endMs-n.startMs,K=Zs(G,Math.max(1,a),r,u);if(K.id===m.id){b.current=u;return}let q=Zs(G,Math.max(1,a),r,b.current).id!==K.id,j=G/h.current;(q||j>xb||j<1/xb)&&(h.current=G,b.current=u,p(K));},[n,a,r,m.id,u]);let x=n.endMs-n.startMs,y=Oe.useMemo(()=>kT(x,m,l),[x,m,l]),v=Oe.useMemo(()=>jo(n,m,y),[n,m,y]),S=Oe.useMemo(()=>v.map(G=>rr(G.tierId,G.index)).join(","),[v]),w=Oe.useRef(v);w.current=v;let N=Oe.useRef(n);N.current=n;let M=Oe.useRef(g);M.current=g;let{abortAll:k}=fb({refs:v,refsKey:S,store:g,tier:m,viewport:n,fetchTile:t,dispatch:f,concurrency:c,...i!=null?{maxFutureMs:i}:{}}),T=Oe.useRef(null),A=Oe.useRef(false);Oe.useEffect(()=>{if(!A.current){A.current=true;return}k(),T.current=null,f({type:"reset"});},[k,d]);let E=Oe.useMemo(()=>w.current.map(G=>`${rr(G.tierId,G.index)}:${g.get(rr(G.tierId,G.index))?.status??"\u2205"}`).join("|"),[S,g]),D=Oe.useMemo(()=>{let G=db({viewport:N.current,targetTier:m,ladder:r,store:M.current,overscanTiles:y,prev:T.current});return T.current=G,G},[E,m,r,y,n.startMs,n.endMs]),R=Oe.useMemo(()=>w.current.some(G=>M.current.get(rr(G.tierId,G.index))?.status==="loading"),[E]),H=Oe.useMemo(()=>{let G=w.current[0];return G?M.current.get(rr(G.tierId,G.index))?.status==="empty":false},[E]);return {tier:m,series:D,loading:R,atDataStart:H}}function vu(e){let{initialViewport:t,...r}=e,[o,n]=Oe.useState(t),a=yb({...r,viewport:o}),i=Oe.useCallback(c=>n(c),[]),s=Oe.useCallback(c=>n(c),[]);return {viewport:o,onViewportChange:i,jumpTo:s,...a}}var TT={sm:"gap-4 px-6 py-8",md:"gap-5 px-8 py-12",lg:"gap-6 px-10 py-16"},PT={sm:"xs",md:"sm",lg:"md"},RT={sm:gt("bodySm"),md:gt("bodySm"),lg:gt("bodyMd")},MT={sm:"h-10 w-10",md:"h-12 w-12",lg:"h-16 w-16"},ET={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 _s({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?jsxRuntime.jsx("div",{className:"empty-state-actions mt-2 flex flex-wrap items-center gap-3",children:a}):o||n?jsxRuntime.jsxs("div",{className:"empty-state-actions mt-2 flex flex-col gap-3",children:[o&&(o.href?jsxRuntime.jsx(_,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,href:o.href,children:o.label}):jsxRuntime.jsx(_,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,children:o.label})),n&&jsxRuntime.jsx(Ze,{href:n.href||"#",variant:"muted",onPress:n.onPress,className:gt("labelMd"),children:n.label})]}):null;return jsxRuntime.jsxs("section",{"data-testid":"empty-state",role:"status","aria-live":"polite",className:tailwindMerge.twMerge("flex w-full flex-col rounded-xl text-text-primary",TT[i],DT[s],d?"h-full justify-center":"",p?"relative overflow-hidden":"",u),style:g,children:[e&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex items-center justify-center rounded-full border border-border-muted bg-background-muted text-text-secondary",MT[i]),children:jsxRuntime.jsx(B,{name:e,size:ET[i]})}),jsxRuntime.jsx(Qt,{size:PT[i],tag:"h2",className:"text-text-secondary",children:t}),r&&jsxRuntime.jsx("p",{className:tailwindMerge.twMerge("max-w-xs text-text-secondary whitespace-pre-line",RT[i]),children:r}),f()]})}var AT=[{id:"5y",label:"5 years",days:1825},{id:"year",label:"Year",days:365},{id:"month",label:"Month",days:30},{id:"week",label:"Week",days:7},{id:"day",label:"24h",days:1}];function $s(e=Date.now){return AT.map(({id:t,label:r,days:o})=>({id:t,label:r,getRange:()=>{let n=e();return {after:new Date(n-o*864e5),before:new Date(n)}}}))}function OT({selectionState:e,isDisabled:t}){let r=`${Je} 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 Ma({errorMessage:e,...t}){return jsxRuntime.jsxs(reactAriaComponents.RangeCalendar,{...t,children:[jsxRuntime.jsx(Ls,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"w-full border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(As,{}),jsxRuntime.jsx(reactAriaComponents.CalendarGridBody,{children:r=>jsxRuntime.jsx(reactAriaComponents.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})=>jsxRuntime.jsx("span",{className:OT({selectionState:n&&(a||i)?"cap":n?"middle":"none",isDisabled:c}),children:o})})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function Sb(e){return e==="brand"?"primary":e==="default"||e==="secondary"||!e?"subtle":e}var WT={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"},GT={sm:14,md:16,lg:18,xl:20},UT=({isSelected:e,isFirst:t,isLast:r,isDisabled:o,variant:n="subtle"})=>{let a=Sb(n),i=a==="primary"?"focus-visible:outline-action-primary":"focus-visible:outline-[color:var(--color-action-secondary-text)]";return a==="subtle"?tailwindMerge.twMerge(Je(),"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"):tailwindMerge.twMerge(Je(),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 tl({options:e,value:t,onChange:r,size:o="md",className:n,isDisabled:a,variant:i="subtle",iconOnly:s=false,"aria-label":c}){return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("inline-flex overflow-hidden rounded-[var(--control-border-radius)]",Sb(i)==="subtle"?"border border-border-muted":"border-2 border-border-muted",WT[o],n),role:"group","aria-label":c,children:e.map((l,d)=>{let u=s&&!!l.icon;return jsxRuntime.jsxs(reactAriaComponents.ToggleButton,{isSelected:t===l.id,onChange:()=>r(l.id),className:UT({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&&jsxRuntime.jsx(B,{name:l.icon,size:GT[o]}),u?jsxRuntime.jsx("span",{className:"sr-only",children:l.label}):jsxRuntime.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 XT(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Nu(e){return XT(e)?e:(console.warn("Invalid date detected in TimeControls, using fallback:",e),new Date)}var Rb=120*1e3,jT=.02,Mb={FIVE_MINUTES:0,FIFTEEN_MINUTES:1,HOUR:2,DAY:3,WEEK:4,MONTH:5,YEAR:6},qT=[{id:"FIFTEEN_MINUTES",label:"15m"},{id:"HOUR",label:"1h"},{id:"DAY",label:"1d"},{id:"WEEK",label:"1w"}];function rl({dateRange:e,onDateRangeChange:t,windowSize:r,onWindowSizeChange:o,showWindowSize:n=true,showRangeSelector:a=true,allowDatePicker:i=false,lockWindowSize:s=false,showReset:c=true,restrictToSingleDay:l=false,presetRanges:d=[],windowSizeOptions:u=qT,autoAdjustWindowSize:m=false,className:p}){let[g,f]=Oe.useState(0),h=Oe.useRef(null),[b,x]=Oe.useState(false),[y,v]=Oe.useState(null),S=P=>{let I=(P.before.getTime()-P.after.getTime())/(1e3*60*60);return I<=24?"FIFTEEN_MINUTES":I<=72||I<=168?"HOUR":("DAY")};Oe.useEffect(()=>{if(m&&!b&&o){let P=S(e);o(P);}},[e,m,b,o]);let w=P=>{let C;for(let I of d){let F=I.getRange(),U=(F.before.getTime()-F.after.getTime())*jT,$=Math.abs(F.after.getTime()-P.after.getTime()),ae=Math.abs(F.before.getTime()-P.before.getTime());if($>U||ae>U)continue;let Z=$+ae;(!C||Z<C.distance)&&(C={id:I.id,distance:Z});}return C?.id},N=y&&d.some(P=>P.id===y.id)&&Math.abs(y.after-e.after.getTime())<=Rb&&Math.abs(y.before-e.before.getTime())<=Rb?y.id:w(e),M=Nu(e.after),k=Nu(e.before),T=new Date(k);T.setDate(T.getDate()-1);let A={start:date.fromDate(M,date.getLocalTimeZone()),end:date.fromDate(T,date.getLocalTimeZone())};Oe.useEffect(()=>{let P=new ResizeObserver(C=>{for(let I of C)f(I.contentRect.width);});return h.current&&P.observe(h.current),()=>{h.current&&P.unobserve(h.current);}},[]);let E=[...u].sort((P,C)=>Mb[P.id]-Mb[C.id]),D=P=>{let C=P.toString(),I=d.find(F=>F.id===C);if(I){let F=I.getRange();v({id:C,after:F.after.getTime(),before:F.before.getTime()}),x(false),t(F,{presetId:C});}},R=P=>{if(P?.start&&P?.end){v(null);let C=new Date(P.start.year,P.start.month-1,P.start.day,0,0,0,0),I=new Date(P.end.year,P.end.month-1,P.end.day+1,0,0,0,0);t({after:C,before:I});}},H=P=>{if(P){v(null);let C=new Date(P.year,P.month-1,P.day,0,0,0,0),I=new Date(P.year,P.month-1,P.day+1,0,0,0,0);t({after:C,before:I});}},G=P=>{o&&(x(true),o(P.toString()));},K=()=>{d.length>0&&D(d[0].id);},W=(P,C=0)=>{let I=Nu(P),F=new Date(I);return C!==0&&F.setDate(F.getDate()+C),F.toLocaleDateString("en-US")},q=E.map(P=>({id:P.id,label:P.label,value:P.id})),j=d.map(P=>({id:P.id,label:P.label,value:P.id})),Q=s?jsxRuntime.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:E.find(P=>P.id===r)?.label||r}):jsxRuntime.jsx(bo,{className:"w-full md:w-auto",selectedKey:r,onSelectionChange:G,items:q,size:"md","aria-label":"Select Window Size",children:P=>jsxRuntime.jsx(_t,{id:P.id,"aria-label":P.label,size:"md",children:P.label},P.id)}),O=c&&!N&&d.length>0,L=l?jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{children:[jsxRuntime.jsxs(_,{className:"border-l pl-2 pr-2 hover:border-border-default hover:bg-background-muted hover:text-text-link-hover",variant:"secondary",children:[jsxRuntime.jsx(B,{name:"CalendarBlank",size:18}),jsxRuntime.jsx("span",{className:"ml-2 hidden md:block",children:W(e.after)})]}),jsxRuntime.jsx(lt,{className:"w-auto p-3",disableGroup:true,children:jsxRuntime.jsx(ha,{"aria-label":"Select date",value:date.parseDate(M.toISOString().split("T")[0]),onChange:H})})]})}):jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{children:[jsxRuntime.jsxs(_,{className:tailwindMerge.twMerge("border-l pl-2 pr-2 hover:border-border-default hover:bg-background-muted hover:text-text-link-hover",O&&"rounded-r-none"),variant:"secondary",children:[jsxRuntime.jsx(B,{name:"CalendarBlank",size:18}),!N&&jsxRuntime.jsx("span",{className:"ml-2 hidden md:block",children:`${W(e.after)} - ${W(e.before,-1)}`})]}),jsxRuntime.jsx(lt,{className:"w-auto p-3",disableGroup:true,children:jsxRuntime.jsx(Ma,{"aria-label":"Date range calendar",value:A,onChange:R})})]}),O&&jsxRuntime.jsx(_,{variant:"ghost",size:"md",onPress:K,children:"Reset"})]}),Y=g<600;return jsxRuntime.jsx("div",{ref:h,className:tailwindMerge.twMerge("flex w-full flex-wrap items-center justify-between gap-4",p),children:Y?jsxRuntime.jsxs("div",{className:"flex w-full justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[i&&L,a&&d.length>0&&jsxRuntime.jsx(bo,{selectedKey:N??"",onSelectionChange:D,items:j,size:"md","aria-label":"Select Date Range",children:P=>jsxRuntime.jsx(_t,{id:P.id,size:"md",children:P.label},P.id)})]}),jsxRuntime.jsx("div",{className:"flex items-center",children:n&&r&&Q})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[i&&L,a&&d.length>0&&jsxRuntime.jsx(tl,{options:d.map(P=>({id:P.id,label:P.label})),value:N??"",onChange:D,size:"sm",variant:"secondary","aria-label":"Select Date Range"})]}),jsxRuntime.jsx("div",{className:"flex items-center",children:n&&r&&Q})]})})}var e1=1440*60*1e3,t1=6e4,Eb=(e,t)=>({startMs:t-e*e1,endMs:t}),r1=e=>({after:new Date(e.startMs),before:new Date(e.endMs)});function Db({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]=Oe.useState(900),h=m?.endMs,[b,x]=Oe.useState(()=>h??Date.now());Oe.useEffect(()=>{if(h!=null){x(h);return}x(Date.now());let fe=setInterval(()=>x(Date.now()),t1);return ()=>clearInterval(fe)},[h]);let y=r?.getTime()??h,v=t?.days??30,S=Oe.useMemo(()=>Eb(v,y??Date.now()),[v,y]),w=b,N=Oe.useMemo(()=>({startMs:m?.startMs??0,endMs:b}),[m?.startMs,b]),M=fe=>{let re=Math.min(fe.endMs-fe.startMs,N.endMs-N.startMs),de=Math.max(Math.min(fe.endMs,N.endMs),N.startMs+re);return {startMs:de-re,endMs:de}},[k,T]=Oe.useState(null),[A,E]=Oe.useState(null),D=k??S,R=vu({fetchTile:e.fetchTile,ladder:e.ladder,nativeMs:e.nativeMs,initialViewport:S,widthPx:g,maxFutureMs:w,tileCostSeriesCount:e.tileCostSeriesCount,resetKey:e.resetKey}),H=Oe.useMemo(()=>$s(()=>y??Date.now()),[y]),G=s??H,K=()=>{if(A&&"presetId"in A){let fe=G.find(re=>re.id===A.presetId);if(fe){let re=fe.getRange();return {startMs:re.after.getTime(),endMs:re.before.getTime()}}}return A&&"range"in A?A.range:Eb(v,y??Date.now())},{line:W,coverage:q,renderTier:j,targetTier:Q,isFallback:O,isStale:L}=R.series,Y=j?j.bucketMs*1.5:0,P=fe=>fe==null?"\u2014":new Date(fe).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),C=(fe,re)=>{let de=re-fe<1728e5?{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"short",day:"numeric",year:"numeric"},xe=new Intl.DateTimeFormat("en-US",de);return `${xe.format(new Date(fe))} \u2013 ${xe.format(new Date(re))}`},I=R.viewport.startMs!==D.startMs||R.viewport.endMs!==D.endMs,F=L||R.loading&&q.earliestMs==null,U=(R.viewport.endMs-R.viewport.startMs)*.03,$=!F&&q.earliestMs!=null&&q.earliestMs>R.viewport.startMs+U,ae=!R.loading&&q.earliestMs==null&&q.latestMs==null&&W.length===0&&!L,Z=p({series:R.series,gapMs:Y}),ie=Oe.isValidElement(Z)&&Z.type===Oe.Fragment?Z.props.children:Z;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-3",children:[jsxRuntime.jsx(rl,{dateRange:r1(R.viewport),onDateRangeChange:(fe,re)=>{let de=M({startMs:fe.after.getTime(),endMs:fe.before.getTime()});E(re?.presetId?{presetId:re.presetId}:{range:de}),T(de),R.jumpTo(de);},windowSize:c[Q.id],windowSizeOptions:l,lockWindowSize:true,presetRanges:G,allowDatePicker:true,showReset:false}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-secondary",children:[jsxRuntime.jsxs("span",{children:["Window"," ",jsxRuntime.jsx("span",{className:"font-medium text-text-primary",children:C(R.viewport.startMs,R.viewport.endMs)})]}),jsxRuntime.jsx("span",{className:"text-text-tertiary",children:"\u2022"}),jsxRuntime.jsxs("span",{children:["Resolution ",jsxRuntime.jsx("span",{className:"font-medium text-text-primary",children:j?.id??Q.id}),O&&jsxRuntime.jsxs("span",{className:"text-text-tertiary",children:[" \xB7 loading ",Q.id]})]}),R.loading&&jsxRuntime.jsx("span",{className:"text-text-tertiary",children:"loading\u2026"}),$&&jsxRuntime.jsxs("span",{className:"text-text-tertiary",children:["showing available history from ",P(q.earliestMs)]}),!$&&!F&&R.atDataStart&&jsxRuntime.jsx("span",{className:"text-text-tertiary",children:"no earlier data loaded"}),I&&jsxRuntime.jsx(_,{variant:"ghost",size:"sm",onPress:()=>{let fe=M(K());T(fe),R.jumpTo(fe);},children:"\u27F2 Reset"})]}),jsxRuntime.jsx("div",{className:"relative overflow-hidden rounded-md border border-border-subtle",style:{height:d},children:ae?jsxRuntime.jsx(_s,{title:i.title,description:i.description}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Qs,{viewport:R.viewport,panBounds:N,onViewportChange:R.onViewportChange,onPlotWidthChange:f,...o&&{yFormatter:o},...n&&{yDomain:n},...a&&{referenceLines:a},children:ie}),R.loading&&jsxRuntime.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&&jsxRuntime.jsx("p",{className:"text-xs text-text-tertiary",children:u})]})}function Ci({count:e,label:t="results",isLoading:r=false,className:o=""}){if(r)return jsxRuntime.jsx("div",{className:`flex items-center ${o}`,children:jsxRuntime.jsx(J,{width:80,height:16})});let n=t.endsWith("s")?t.slice(0,-1):t,a=e===1?n:t;return jsxRuntime.jsxs("div",{className:`text-sm text-text-secondary whitespace-nowrap ${o}`,children:[e.toLocaleString()," ",a]})}var l1=e=>{let t=zt({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 tailwindMerge.twMerge(t,r,e.className)};function Lr({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[h,b]=Oe__namespace.default.useState(false),{isFocused:x,handleFocus:y,handleBlur:v}=Pr(),S=d==="password",w=Ss(p,300);return jsxRuntime.jsx(reactAriaComponents.TextField,{...f,isRequired:a,className:ke(f.className,"group flex flex-col"),children:({isDisabled:N,isInvalid:M})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(ze,{size:o,tooltip:n,description:g==="tooltip"||g==="inline"?t:void 0,descriptionPlacement:g,isRequired:a,children:e}),jsxRuntime.jsxs(yt,{children:[s&&jsxRuntime.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 w?jsxRuntime.jsx(go,{size:k,color:"text-text-secondary"}):jsxRuntime.jsx(B,{name:"MagnifyingGlass",size:k,className:`transition-colors ${x?"text-action-brand":"text-text-secondary"}`})})()}),jsxRuntime.jsx(Ns,{size:o,disabled:N,type:S?h?"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:l1({isInvalid:M,isDisabled:N,isFocused:x,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&&!N&&jsxRuntime.jsx(ni,{onClick:()=>{l?l():f.onChange&&f.onChange("");},size:o}),S&&!N&&jsxRuntime.jsx("button",{type:"button",onClick:()=>b(!h),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":h?"Hide password":"Show password",onMouseDown:k=>{k.preventDefault(),k.stopPropagation();},children:jsxRuntime.jsx(B,{name:h?"EyeSlash":"Eye",size:o==="sm"?16:20,className:"text-text-primary"})})]}),m?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsxRuntime.jsx(be,{size:o,children:r}):typeof r=="function"&&u?jsxRuntime.jsx(be,{size:o,children:r(u)}):t&&g==="below"?jsxRuntime.jsx(Te,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:r}):typeof r=="function"&&u?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:r(u)}):t&&g==="below"?jsxRuntime.jsx(Te,{size:o,className:"mt-1",children:t}):null})]})})}function In({value:e,onChange:t,onClear:r,placeholder:o="Search...",size:n="sm",className:a="",isLoading:i=false}){return jsxRuntime.jsx("div",{className:`flex-1 min-w-0 sm:max-w-sm ${a}`,children:jsxRuntime.jsx(Lr,{value:e,onChange:t,placeholder:o,showSearchIcon:true,isClearable:!!e&&!!r,onClear:r,size:n,"aria-label":o,reserveErrorSpace:false,isLoading:i})})}function Si({value:e,options:t,onChange:r,direction:o,onDirectionChange:n,showLabel:a=true,size:i="sm",className:s="",compact:c=false}){let[l,d]=Oe.useState(false),u=o!==void 0&&n!==void 0,m=t.find(p=>p.value===e);return c?jsxRuntime.jsxs("div",{className:`flex items-center gap-2 ${s}`,children:[jsxRuntime.jsx(_,{variant:"secondary",size:i,icon:"ArrowsDownUp","aria-label":`Sort by: ${m?.label||"Select"}`,onPress:()=>d(true)}),jsxRuntime.jsx(ct,{isOpen:l,onClose:()=>d(false),title:"Sort by",contentPadding:false,children:jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.jsx(_t,{id:p.id,textValue:p.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:p.label})},p.id)})})]}):jsxRuntime.jsxs("div",{className:`flex items-center gap-2 ${s}`,children:[a&&jsxRuntime.jsx("span",{className:"text-sm text-text-secondary whitespace-nowrap",children:"Sort by:"}),jsxRuntime.jsx(bo,{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&&jsxRuntime.jsx(_,{variant:"ghost",size:i,onClick:()=>n(o==="asc"?"desc":"asc"),"aria-label":`Sort ${o==="asc"?"descending":"ascending"}`,className:"p-1.5",children:o==="asc"?jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"})})]})}function Bb({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:h,stickyTop:b="0",zIndex:x=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 N=h?"sticky bg-background-surface":"",M=h?{top:b,zIndex:x}:{};return jsxRuntime.jsxs("div",{className:`@container flex flex-col gap-3 bg-background-surface py-3 border-b border-border-default ${N} ${y}`,style:{...v,...M},children:[jsxRuntime.jsxs("div",{className:"hidden @[640px]:flex @[640px]:items-center @[640px]:justify-between @[640px]:gap-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[d,d&&l&&jsxRuntime.jsx("div",{className:"h-4 w-px bg-border-default"}),l&&jsxRuntime.jsx(Ci,{count:l.count,label:l.label,isLoading:l.isLoading}),l&&c&&jsxRuntime.jsx("div",{className:"h-4 w-px bg-border-default"}),c&&jsxRuntime.jsx(Si,{value:c.value,options:c.options,onChange:c.onChange,showLabel:c.showLabel,direction:c.direction,onDirectionChange:c.onDirectionChange}),u?jsxRuntime.jsx(_,{variant:"secondary",size:"sm",icon:"Columns",onClick:u,children:"Columns"}):m,S&&o&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.slice(0,s).map(k=>jsxRuntime.jsxs(eo,{variant:"primary",size:"sm",onRemove:()=>o(k.id),isRemovable:true,children:[k.label,": ",k.value]},k.id)),r.length>s&&a&&jsxRuntime.jsxs(_,{variant:"ghost",size:"sm",onClick:a,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:["+",r.length-s," more"]}),n&&jsxRuntime.jsx(_,{variant:"ghost",size:"sm",onClick:n,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:"Clear all"})]})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-3 flex-shrink-0",children:p||jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g&&g.items.length>0&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:g.items.map(k=>jsxRuntime.jsx(_,{variant:k.variant||"secondary",size:"sm",icon:k.icon,onPress:k.onClick,isDisabled:k.disabled,children:k.label},k.id))}),e&&jsxRuntime.jsx("div",{className:"w-64",children:jsxRuntime.jsx(In,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsxRuntime.jsx(_,{variant:"secondary",size:"sm",icon:"Sliders",badgeNumber:r.length>0?r.length:void 0,onClick:a,children:"Filters"}),i&&jsxRuntime.jsx(_,{variant:"secondary",size:"sm",icon:"Upload",onClick:i.onClick,isDisabled:i.isDisabled,children:i.label})]})})]}),jsxRuntime.jsxs("div",{className:"@[640px]:hidden",children:[jsxRuntime.jsx("div",{className:"flex flex-col gap-3 mb-3",children:jsxRuntime.jsx("div",{className:"flex items-center gap-3",children:p?jsxRuntime.jsx("div",{className:"flex-1",children:p}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g&&g.items.length>0&&jsxRuntime.jsx(fa,{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:jsxRuntime.jsx(_,{variant:"secondary",size:"sm",icon:"DotsThreeVertical","aria-label":g.menuLabel||"Actions"})}),e&&jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsx(In,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsxRuntime.jsx(_,{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&&jsxRuntime.jsx(_,{variant:"secondary",size:"sm",icon:"Upload",onClick:i.onClick,isDisabled:i.isDisabled,children:i.label})]})})}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d,l&&jsxRuntime.jsx(Ci,{count:l.count,label:l.label,isLoading:l.isLoading})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:c&&jsxRuntime.jsx(Si,{value:c.value,options:c.options,onChange:c.onChange,showLabel:false,direction:c.direction,onDirectionChange:c.onDirectionChange,compact:f!=="desktop"})})]})]})]})}function Vb({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&&jsxRuntime.jsxs(_,{variant:"secondary",size:s,onClick:o,className:"whitespace-nowrap",children:[e.length," ",e.length===1?"filter":"filters"]}),h=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g&&jsxRuntime.jsx(_,{variant:"secondary",size:s,icon:"Sliders",onClick:o,className:"whitespace-nowrap",children:"Filters"}),l&&d.map(x=>jsxRuntime.jsxs(eo,{variant:"secondary",size:s,onRemove:()=>t(x.id),isRemovable:true,children:[x.label,": ",x.value]},x.id)),l&&m&&o&&jsxRuntime.jsxs(_,{variant:"ghost",size:s,onClick:o,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:["+",u," more"]}),l&&r&&jsxRuntime.jsx(_,{variant:"ghost",size:s,onClick:r,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:"Clear all"})]}),b=a==="button"?f:h;return jsxRuntime.jsx("div",{className:`flex flex-wrap items-center gap-2 ${c}`,children:b})}function g1(e,t,r){return {field:e,operator:t,value:r}}function b1(e,t="AND"){return {logic:t,conditions:e}}function wi(){return {logic:"AND",conditions:[]}}function il(e){return !e||e.conditions.length===0?true:e.conditions.every(t=>"conditions"in t?il(t):false)}function x1(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":">",h=g.operator==="lte"?"\u2264":"<";a.push({id:`${i}-range`,label:l,value:`${f} ${p.value} and ${h} ${g.value}`});}else for(let f of u){let h;f.operator==="gte"?h="\u2265":f.operator==="gt"?h=">":f.operator==="lte"?h="\u2264":h="<",a.push({id:`${i}-${f.operator}`,label:l,value:`${h} ${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 Zo(e,t){let r=e||wi();return {...r,conditions:[...r.conditions,t]}}function Fn(e,t){if(!e)return wi();let r=e.conditions.filter(o=>"conditions"in o?Fn(o,t).conditions.length>0:o.field!==t);return {...e,conditions:r}}function Bn(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 Ob({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]=Oe.useState(false),f=h=>{m.onChange&&h&&m.onChange(h),g(false);};return jsxRuntime.jsxs(reactAriaComponents.DateField,{...m,isDisabled:i,isRequired:a,isInvalid:s,className:ke(u,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(ze,{size:o,tooltip:n,isRequired:a,children:e}),jsxRuntime.jsx(yt,{children:jsxRuntime.jsxs("div",{className:"relative w-full",children:[jsxRuntime.jsx(Ni,{size:o,isDisabled:i,isInvalid:s,hasCalendar:c}),c&&!i&&jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:p,onOpenChange:g,children:[jsxRuntime.jsx(_,{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:jsxRuntime.jsx(B,{name:"Calendar",size:18})}),jsxRuntime.jsx(reactAriaComponents.Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsxRuntime.jsx(reactAriaComponents.Dialog,{className:"p-4 outline-none",children:jsxRuntime.jsx(ha,{value:m.value,onChange:f,minValue:m.minValue,maxValue:m.maxValue,isDisabled:i,isReadOnly:m.isReadOnly,isDateUnavailable:m.isDateUnavailable})})})]})]})}),l?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsxRuntime.jsx(be,{size:o,children:r}):typeof r=="function"&&d?jsxRuntime.jsx(be,{size:o,children:r(d)}):t?jsxRuntime.jsx(Te,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:r}):typeof r=="function"&&d?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:r(d)}):t?jsxRuntime.jsx(Te,{size:o,className:"mt-1",children:t}):null})]})}function k1({isPlaceholder:e,isDisabled:t,size:r="md"}){return tailwindMerge.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 Ni({size:e="md",isDisabled:t,isInvalid:r,hasCalendar:o,className:n,...a}){return jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(zo({isInvalid:r,isDisabled:t}),"px-3 py-2 flex items-center gap-0.5 w-full",o&&"pr-10",n),...a,children:i=>jsxRuntime.jsx(reactAriaComponents.DateSegment,{segment:i,className:k1({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||t,size:e})})})}function sl({label:e,description:t,errorMessage:r,...o}){return jsxRuntime.jsxs(reactAriaComponents.DateRangePicker,{...o,className:ke(o.className,"group flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(ze,{children:e}),jsxRuntime.jsxs(yf,{className:"w-auto min-w-[208px]",children:[jsxRuntime.jsx(Ni,{slot:"start",className:"px-2 py-1.5 text-sm"}),jsxRuntime.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"}),jsxRuntime.jsx(Ni,{slot:"end",className:"flex-1 px-2 py-1.5 text-sm"}),jsxRuntime.jsx(_,{variant:"icon",className:"mr-1 w-6 rounded outline-offset-0",children:jsxRuntime.jsx(lucideReact.CalendarIcon,{"aria-hidden":true,className:"h-4 w-4"})})]}),t&&jsxRuntime.jsx(Te,{children:t}),typeof r=="string"?jsxRuntime.jsx(be,{children:r}):null,jsxRuntime.jsx(lt,{children:jsxRuntime.jsx(Ma,{})})]})}var I1=e=>{let t=zt({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return tailwindMerge.twMerge(t,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function ki({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=Oe.useId(),{isFocused:m,handleFocus:p,handleBlur:g}=Pr();return jsxRuntime.jsx(reactAriaComponents.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:h})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsxRuntime.jsx(ze,{size:o,tooltip:n,description:l==="tooltip"||l==="inline"?t:void 0,descriptionPlacement:l,isRequired:a,htmlFor:u,children:e}),jsxRuntime.jsx("div",{className:"relative",children:jsxRuntime.jsxs(reactAriaComponents.Group,{className:"relative",children:[jsxRuntime.jsx(reactAriaComponents.Input,{onFocus:x=>p(x,d.onFocus),onBlur:x=>g(x,d.onBlur),className:I1({isInvalid:h||!!r,isDisabled:f,isFocused:m,transparent:i,size:o,className:typeof d.className=="string"?d.className:void 0})}),jsxRuntime.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:[jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(B,{name:"CaretUp",size:14})}),jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(B,{name:"CaretDown",size:14})})]})]})}),c?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:r?jsxRuntime.jsx(be,{size:o,children:typeof r=="function"?r(s):r}):t&&l==="below"?jsxRuntime.jsx(Te,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:r?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:typeof r=="function"?r(s):r}):t&&l==="below"?jsxRuntime.jsx(Te,{size:o,className:"mt-1",children:t}):null})]})})}var Eu={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 V1({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=Eu[r].track,a=Je,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 z1({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=Eu[r].handle;return [o,n,e?"translate-x-[100%]":"translate-x-0",t?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function ll({children:e,variant:t="primary",size:r="md",...o}){return jsxRuntime.jsx(reactAriaComponents.Switch,{...o,className:ke(o.className,`relative group flex items-center gap-2 ${Eu[r].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:n=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:V1({...n,size:r}),children:jsxRuntime.jsx("span",{className:z1({...n,size:r})})}),e]})})}function Gb(e){return new Intl.NumberFormat("en-US").format(e)}function Ub({isOpen:e,onClose:t,facetConfigs:r,facetCounts:o={},currentFilters:n,onApply:a,onClear:i,title:s="Filters",resultCount:c}){let[l,d]=Oe.useState(n),[u,m]=Oe.useState({}),[p,g]=Oe.useState({}),[f,h]=Oe.useState(null),{isMobile:b}=Xt(),x=Oe.useMemo(()=>r.some(C=>C.group),[r]),{groups:y,ungroupedFacets:v,facetsByGroup:S}=Oe.useMemo(()=>{let C=new Set,I=[],F={};for(let U of r)U.group?(C.has(U.group)||(C.add(U.group),F[U.group]=[]),F[U.group].push(U)):I.push(U);return {groups:Array.from(C),ungroupedFacets:I,facetsByGroup:F}},[r]);Oe.useEffect(()=>{e&&(d(n),m({}),g({}),h(!b&&y.length>0?y[0]:null));},[e,n,y,b]);let w=Oe.useMemo(()=>!l||il(l)?0:Bn(l).length,[l]),N=()=>{a(l),t();},M=()=>{let C=wi();d(C),i?i():a(C),t();},k=C=>{if(!l)return [];if(!Bn(l).includes(C))return [];let F=[];function U($){if($)for(let ae of $.conditions)"conditions"in ae?U(ae):ae.field===C&&ae.operator==="in"&&Array.isArray(ae.value)&&F.push(...ae.value.map(String));}return U(l),F},T=(C,I,F)=>{let U=Fn(l,C);I!==void 0&&(U=Zo(U,{field:C,operator:"gte",value:I})),F!==void 0&&(U=Zo(U,{field:C,operator:"lte",value:F})),d(U);},A=C=>{if(!l)return;let I;function F(U){if(U)for(let $ of U.conditions)"conditions"in $?F($):$.field===C&&$.operator==="eq"&&typeof $.value=="boolean"&&(I=$.value);}return F(l),I},E=(C,I)=>{let F=Fn(l,C);I!==void 0&&(F=Zo(F,{field:C,operator:"eq",value:I})),d(F);},D=(C,I,F)=>{let U=Fn(l,C);I&&(U=Zo(U,{field:C,operator:"gte",value:I.toString()})),F&&(U=Zo(U,{field:C,operator:"lte",value:F.toString()})),d(U);},R=C=>{let I=S[C]||[],F=l?Bn(l):[];return I.filter(U=>F.includes(U.field)).length},H="pr-9 bg-background-muted/50",G="border-t border-border-muted",K="text-sm font-medium text-text-link-default",W=C=>jsxRuntime.jsx("span",{className:K,children:C}),q=C=>{let I=o[C.field]||{},F=u[C.field]||"",U=[];C.values?U=C.values.map(Z=>({value:String(Z.value),label:Z.label,count:I[String(Z.value)]})):U=Object.entries(I).map(([Z,ie])=>({value:Z,label:Z,count:ie}));let $=U.length;if(F){let Z=F.toLowerCase();U=U.filter(ie=>ie.label.toLowerCase().includes(Z));}U.sort((Z,ie)=>Z.count!==void 0&&ie.count!==void 0&&ie.count!==Z.count?ie.count-Z.count:Z.label.localeCompare(ie.label));let ae=C.type||"string";if(ae==="string"||!C.type){let Z=k(C.field),ie=C.searchThreshold??10,fe=C.maxVisibleOptions??50,re=p[C.field]??false,de=re||U.length<=fe?U:U.slice(0,fe),xe=U.length>fe&&!re;return jsxRuntime.jsxs(Go,{id:C.field,children:[jsxRuntime.jsx(Uo,{title:C.label,description:C.description,className:H,endContent:Z.length>0?W(`${Z.length} selected`):void 0}),jsxRuntime.jsx(Ko,{className:G,children:jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 pb-4",children:[$>ie&&jsxRuntime.jsx(In,{value:F,onChange:he=>m(Ee=>({...Ee,[C.field]:he})),onClear:()=>m(he=>({...he,[C.field]:""})),placeholder:`Search ${C.label.toLowerCase()}...`,size:"sm",className:"w-full !max-w-none pr-4"}),jsxRuntime.jsx(Kd,{value:Z,onChange:he=>{let Ee=Fn(l,C.field);he.length>0&&(Ee=Zo(Ee,{field:C.field,operator:"in",value:he})),d(Ee);},children:jsxRuntime.jsx("div",{className:"space-y-1.5",children:de.map(he=>jsxRuntime.jsx("div",{className:"rounded-md py-2 pr-4 transition-colors hover:bg-background-hover",children:jsxRuntime.jsx(Sn,{value:he.value,children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-3 flex-1",children:[C.renderLabel?C.renderLabel(he.value,he.label):jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-primary",children:he.label}),he.count!==void 0&&jsxRuntime.jsx("span",{className:"text-xs font-medium text-text-secondary tabular-nums",children:Gb(he.count)})]})})},he.value))})}),xe&&jsxRuntime.jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxRuntime.jsxs(_,{variant:"ghost",size:"sm",onPress:()=>g(he=>({...he,[C.field]:true})),className:"w-full",children:["Show all ",U.length," options"]})}),re&&U.length>fe&&jsxRuntime.jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxRuntime.jsx(_,{variant:"ghost",size:"sm",onPress:()=>g(he=>({...he,[C.field]:false})),className:"w-full",children:"Show less"})})]})})]},C.field)}if(ae==="number"){let Z,ie,fe=de=>{if(de)for(let xe of de.conditions)"conditions"in xe?fe(xe):xe.field===C.field&&(xe.operator==="gte"&&typeof xe.value=="number"&&(Z=xe.value),xe.operator==="lte"&&typeof xe.value=="number"&&(ie=xe.value));};fe(l);let re=Z!==void 0||ie!==void 0;return jsxRuntime.jsxs(Go,{id:C.field,children:[jsxRuntime.jsx(Uo,{title:C.label,description:C.description,className:H,endContent:re?W(Z!==void 0&&ie!==void 0?`${Z} - ${ie}`:Z!==void 0?`\u2265 ${Z}`:`\u2264 ${ie}`):void 0}),jsxRuntime.jsx(Ko,{className:G,children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 pb-4",children:[jsxRuntime.jsx(ki,{label:"Min",value:Z,onChange:de=>T(C.field,de,ie)},`${C.field}-min`),jsxRuntime.jsx(ki,{label:"Max",value:ie,onChange:de=>T(C.field,Z,de)},`${C.field}-max`)]})})]},C.field)}if(ae==="boolean"){let Z=A(C.field);return jsxRuntime.jsxs(Go,{id:C.field,children:[jsxRuntime.jsx(Uo,{title:C.label,description:C.description,className:H,endContent:Z!==void 0?W(Z?"Yes":"No"):void 0}),jsxRuntime.jsx(Ko,{className:G,children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4 pb-4",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-primary",children:Z!==void 0?Z?"Enabled":"Disabled":"No filter applied"}),jsxRuntime.jsx(ll,{size:"lg",isSelected:Z??false,onChange:ie=>E(C.field,ie?true:void 0),children:Z?"Yes":"No"})]})})]},C.field)}if(ae==="date"){let Z,ie,fe=Ee=>{if(Ee)for(let $e of Ee.conditions)"conditions"in $e?fe($e):$e.field===C.field&&($e.operator==="gte"&&(Z=String($e.value)),$e.operator==="lte"&&(ie=String($e.value)));};fe(l);let re=Z!==void 0||ie!==void 0,de=Ee=>{if(Ee)try{return /^\d{4}-\d{2}-\d{2}$/.test(Ee)?date.parseDate(Ee):void 0}catch{return}},xe=de(Z),he=de(ie);return jsxRuntime.jsxs(Go,{id:C.field,children:[jsxRuntime.jsx(Uo,{title:C.label,description:C.description,className:H,endContent:re?W("Date range selected"):void 0}),jsxRuntime.jsx(Ko,{className:G,children:jsxRuntime.jsx("div",{className:"pt-4 pb-4",children:jsxRuntime.jsx(sl,{label:"Date Range",value:xe&&he?{start:xe,end:he}:void 0,onChange:Ee=>{Ee?D(C.field,Ee.start,Ee.end):D(C.field,void 0,void 0);}})})})]},C.field)}return null},j=()=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[v.map(C=>{let F=(l?Bn(l):[]).includes(C.field);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>h(`__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:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-primary",children:C.label}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[F&&jsxRuntime.jsx("span",{className:K,children:"1 active"}),jsxRuntime.jsx(B,{name:"CaretRight",size:"sm",className:"text-text-secondary"})]})]},C.field)}),y.map(C=>{let I=R(C);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>h(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:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-primary",children:C}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[I>0&&jsxRuntime.jsxs("span",{className:K,children:[I," active"]}),jsxRuntime.jsx(B,{name:"CaretRight",size:"sm",className:"text-text-secondary"})]})]},C)})]}),Q=C=>{if(C.startsWith("__ungrouped__")){let F=C.replace("__ungrouped__",""),U=v.find($=>$.field===F);return U?jsxRuntime.jsx(ya,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[U.field],children:q(U)}):null}let I=S[C]||[];return I.length===0?null:jsxRuntime.jsx(ya,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[I[0].field],children:I.map(F=>q(F))})},O=()=>{if(f){let C=f.startsWith("__ungrouped__")&&v.find(I=>I.field===f.replace("__ungrouped__",""))?.label||f;return jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>h(null),className:"flex items-center gap-2 px-4 py-3 border-b border-border-muted hover:bg-background-hover transition-colors",children:[jsxRuntime.jsx(B,{name:"CaretLeft",size:"sm",className:"text-text-secondary"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-primary",children:C})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:Q(f)})]})}return j()},L=()=>jsxRuntime.jsxs("div",{className:"flex h-full",children:[jsxRuntime.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 F=(l?Bn(l):[]).includes(C.field),U=f===`__ungrouped__${C.field}`;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>h(`__ungrouped__${C.field}`),className:`flex items-center justify-between w-full px-4 py-3 text-left border-b border-border-muted transition-colors ${U?"bg-background-selected":"hover:bg-background-hover"}`,children:[jsxRuntime.jsx("span",{className:`text-sm truncate ${U?"font-semibold text-text-primary":"font-medium text-text-primary"}`,children:C.label}),F&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-action-primary flex-shrink-0 ml-2"})]},C.field)}),y.map(C=>{let I=R(C),F=f===C;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>h(C),className:`flex items-center justify-between w-full px-4 py-3 text-left border-b border-border-muted transition-colors ${F?"bg-background-selected":"hover:bg-background-hover"}`,children:[jsxRuntime.jsx("span",{className:`text-sm truncate ${F?"font-semibold text-text-primary":"font-medium text-text-primary"}`,children:C}),I>0&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-action-primary flex-shrink-0 ml-2"})]},C)})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:f?Q(f):jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-sm",children:"Select a category to view filters"})})]}),Y=()=>jsxRuntime.jsx(ya,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[r[0].field],children:r.map(C=>q(C))});return jsxRuntime.jsx(kr,{isOpen:e,onClose:t,title:x&&b&&f?f.startsWith("__ungrouped__")?v.find(C=>C.field===f.replace("__ungrouped__",""))?.label||s:f:w>0?`${s} (${w} active)`:s,hideCloseIcon:false,primaryAction:{label:"Apply filters",onPress:N,variant:"primary"},secondaryAction:{label:"Clear all",onPress:M},maxWidth:x?"800px":"700px",height:"600px",mobileHeight:"85vh",contentPadding:false,footerContent:c!==void 0?jsxRuntime.jsxs("div",{className:"text-sm text-text-secondary text-center",children:[jsxRuntime.jsx("span",{className:"font-semibold text-text-primary",children:Gb(c)})," ",c===1?"result":"results"," with current filters"]}):void 0,children:r.length===0?jsxRuntime.jsx("div",{className:"py-12 text-center",children:jsxRuntime.jsx("div",{className:"text-sm font-medium text-text-secondary",children:"No filters available"})}):x?b?O():L():Y()})}function Lu(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 Ar(e="normal",t){return tailwindMerge.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 tailwindMerge.twMerge("flex items-center gap-1 min-w-0 overflow-hidden",Lu(e),t)}function ul(e,t="\u2014"){return e==null||e===""?t:String(e)}var _o={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 nr(e="normal"){return {strong:_o.lg,high:_o.lg,normal:_o.md,low:_o.sm}[e]}function Se(e,t){return typeof e=="function"?e(t):e}function Kb(e="neutral",t="sm"){return tailwindMerge.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 Yb(e){return e?"success":"neutral"}function pl(e,t=false){return t?e>0?"text-feedback-success-text":e<0?"text-feedback-error-text":"text-text-primary":"text-text-primary"}function Au(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 ao(e,t,r,o="hover",n="secondary",a,i){if(!t)return e;let s=typeof t=="function"&&r?t(r):t,c=Au(o,n);return jsxRuntime.jsx("a",{href:s,className:tailwindMerge.twMerge(c,a==="strong"||a==="high"?"font-semibold":"",i),onClick:d=>{d.metaKey||d.ctrlKey;},children:e})}function Jb({row:e,context:t,actions:r,align:o="right",size:n="sm"}){let{isLoading:a}=t;if(a)return jsxRuntime.jsx(J,{className:_o.sm});let s=(typeof r=="function"?r(e):r).filter(l=>!Se(l.hidden,e));if(s.length===0)return null;let c=Me(o);return jsxRuntime.jsx("div",{className:c,children:s.map(l=>{let d=Se(l.disabled,e);return l.variant==="icon"||!l.label?jsxRuntime.jsx(_,{variant:"icon",size:n,onPress:()=>{l.onClick(e);},isDisabled:d,"aria-label":l.label||l.id,children:jsxRuntime.jsx(B,{name:l.icon||"DotsThree",size:n==="sm"?16:20})},l.id):jsxRuntime.jsxs(_,{variant:l.variant||"secondary",size:n,onPress:()=>{l.onClick(e);},isDisabled:d,children:[l.icon&&jsxRuntime.jsx(B,{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,h=(w,N)=>{if(!g||w.length<=g)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:w});let M=w.slice(0,g-1)+"\u2026";return jsxRuntime.jsx(Zt,{content:N,children:jsxRuntime.jsx("span",{children:M})})};if(f)return jsxRuntime.jsx(J,{className:nr("normal")});if(e==null||e==="")return jsxRuntime.jsx("div",{className:Me(d,"text-text-secondary"),children:u});if(Array.isArray(e)&&e.length===0)return jsxRuntime.jsx("div",{className:Me(d,"text-text-secondary"),children:u});let b=Me(d,m);if(Array.isArray(e)){let w=e.slice(0,p),N=e.slice(p),M=N.length>0;return jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[w.map((k,T)=>{let A=typeof o=="function"?o(k,t):o,E=typeof n=="function"?n(k,t):n!==void 0?n:String(k),D=typeof s=="function"?s(k,t):s,R=typeof l=="function"?l(k,t):l;return jsxRuntime.jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxRuntime.jsx(nt,{variant:A,size:a,shape:i,dot:D,dotPosition:c,dotPulse:R,children:h(E,E)})},T)}),M&&jsxRuntime.jsx(Zt,{content:N.join(", "),children:jsxRuntime.jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxRuntime.jsxs(nt,{variant:"neutral",size:a,shape:i,children:["+",N.length]})})})]})})}let x=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 jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsx(nt,{variant:x,size:a,shape:i,dot:v,dotPosition:c,dotPulse:S,children:h(y,y)})})}function qb({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 jsxRuntime.jsx(J,{className:nr(l)});let m=!!e;if(!m&&!s)return jsxRuntime.jsx("div",{className:Me(c,d)});let p=Me(c,d);switch(r){case "icon":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx(B,{name:m?a:i,size:16,className:m?"text-feedback-success-text":"text-text-disabled"})});case "text":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx("span",{className:Ar(l),children:m?o:n})});case "badge":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx(nt,{variant:m?"success":"neutral",size:"sm",children:m?o:n})});default:return null}}function Zb({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:h}){let{isLoading:b}=t,x=Se(r,e),y=Se(o,e),v=Se(n,e),S=Se(a,e),w=Se(c,e),N=typeof m=="function"?m(e):m,M=Se(h,e),k=Me(g,f);return jsxRuntime.jsx("div",{className:k,children:jsxRuntime.jsx(Bs,{firstName:x,lastName:y,email:v,avatarUrl:S,layout:i,size:s,href:w,LinkComponent:l,linkVariant:d,showEmail:u,badge:N,emphasis:p,isLoading:b,piiEntity:M})})}function _b({value:e,row:t,context:r,render:o,className:n}){let a=o(e,t,r);return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("h-full w-full",n),children:a})}function $b({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 jsxRuntime.jsx(J,{className:nr(s)});if(!e)return jsxRuntime.jsx("div",{className:Me(i,"text-text-secondary"),children:a});let m=e instanceof Date?e:new Date(e);if(isNaN(m.getTime()))return jsxRuntime.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=q1(m);break;case "custom":p=n?m.toLocaleString("en-US",n):m.toISOString();break;default:p=m.toLocaleDateString();}let g=Me(i,tailwindMerge.twMerge(Ar(s),d)),f=Se(c,t);return f?jsxRuntime.jsx("div",{className:g,children:ao(p,f,t,l)}):jsxRuntime.jsx("div",{className:g,children:p})}function q1(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 ml({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[h,b]=Oe.useState(false),x=o||(r?Z1(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&&!h&&u,N={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:T})=>s?c?jsxRuntime.jsx(c,{href:s,className:T,children:k}):jsxRuntime.jsx(Ze,{href:s,variant:l,className:tailwindMerge.twMerge("hover:underline",T),asButton:false,children:k}):jsxRuntime.jsx("span",{className:T,children:k});if(p)return a==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsx(J,{width:v.skeletonIcon,height:v.skeletonIcon,className:"flex-shrink-0 rounded"}),jsxRuntime.jsx(J,{width:v.skeletonText,height:v.skeletonIcon*.6})]}):jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsx(J,{width:v.skeletonIcon,height:v.skeletonIcon,className:"flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(J,{width:v.skeletonText,height:16}),jsxRuntime.jsx(J,{width:v.skeletonSecondary,height:12})]})]});if(a==="inline"){let k=`${e} ${t}`;return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",v.logoSize),children:S?jsxRuntime.jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>b(true)}):jsxRuntime.jsx(B,{name:x,size:v.iconSize*.6,className:"text-text-secondary"})}),jsxRuntime.jsx(M,{className:tailwindMerge.twMerge("truncate leading-normal hover:text-text-primary",N,v.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsxRuntime.jsx("span",{"data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:k})})]})}return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center justify-start",v.gap,g),children:[u&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",v.logoSize),children:S?jsxRuntime.jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>b(true)}):jsxRuntime.jsx(B,{name:x,size:v.iconSize*.6,className:"text-text-secondary"})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxRuntime.jsx(M,{className:tailwindMerge.twMerge("truncate leading-normal hover:text-text-primary",N,v.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsxRuntime.jsx("span",{"data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:e})}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center gap-1.5 text-text-secondary leading-normal",v.secondaryTextSize),children:[d&&jsxRuntime.jsx(B,{name:x,size:v.iconInTextSize,className:"flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate","data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:t})]})]})]})}function Z1(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 tx({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:h}){let{isLoading:b}=t,x=Se(r,e),y=Se(o,e),v=Se(n,e),S=Se(a,e),w=Se(c,e),N=Se(h,e),M=Me(g,f);return jsxRuntime.jsx("div",{className:M,children:jsxRuntime.jsx(ml,{manufacturer:x,model:y,deviceType:v,logoUrl:S,layout:i,size:s,href:w,LinkComponent:l,linkVariant:d,showDeviceTypeIcon:u,showLogo:m,emphasis:p,isLoading:b,piiEntity:N})})}var xU={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},_1=["charging","discharging","heat","cool","on","connected"],$1={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 Iu(e){return _1.includes(e)}function Fu(e){return $1[e]}function zn({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 jsxRuntime.jsx(J,{className:"inline-flex h-6 w-20"});let u=t??Fu(e),m=Iu(e);return jsxRuntime.jsxs(nt,{variant:e,size:n,shape:a,dot:i??m,dotPulse:s??m,className:c?`w-28 justify-center ${l||""}`:l,...d,children:[r&&jsxRuntime.jsx(B,{name:r,size:n==="sm"?12:n==="md"?14:16}),u]})}var tP={importing:"Importing",exporting:"Exporting"};function ox(e){return tP[e]}function gl({state:e,label:t,showIcon:r=false,isLoading:o,size:n="sm",shape:a="pill",fixedWidth:i,className:s,...c}){if(o)return jsxRuntime.jsx(J,{className:"inline-flex h-6 w-24"});let l=t??ox(e),d=e==="exporting"?"ArrowUp":"ArrowDown",u=n==="sm"?12:n==="md"?14:16;return r?jsxRuntime.jsx(nt,{variant:e,size:n,shape:a,className:`w-6 justify-center ${s||""}`,...c,children:jsxRuntime.jsx(B,{name:d,size:u})}):jsxRuntime.jsx(nt,{variant:e,size:n,shape:a,className:i?`w-28 justify-center ${s||""}`:s,...c,children:l})}function bl({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 jsxRuntime.jsx(J,{className:tailwindMerge.twMerge("inline-flex h-6 w-32",m)});let p=r!=null&&o?Vr(r,o):null,g=a==="horizontal",f=o&&!p;return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("inline-flex items-center",g?"gap-2":"flex-col gap-1",m),children:[(p||f)&&jsxRuntime.jsx("span",{className:tailwindMerge.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"}),jsxRuntime.jsx(zn,{state:e,label:t,icon:l,size:s,shape:c,fixedWidth:d}),n&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:n==="importing"||n==="exporting"?jsxRuntime.jsx(gl,{state:n,size:s,shape:c,fixedWidth:d,showIcon:u}):jsxRuntime.jsx(zn,{state:n,size:s,shape:c,fixedWidth:d})})]})}function nx({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 jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(J,{className:"h-4 w-12"}),jsxRuntime.jsx(J,{className:`h-6 w-24 ${v}`}),jsxRuntime.jsx(J,{className:`h-6 w-20 ${v}`})]}):jsxRuntime.jsx(J,{className:`h-6 w-24 ${v}`})})}if(!e)return jsxRuntime.jsx("div",{className:Me(u,p),children:jsxRuntime.jsx("span",{className:"text-text-secondary",children:"\u2014"})});let f=Se(o,t),h=Se(a,t),b=typeof c=="function"?c(e,t):c,x=Me(u,p);return f!=null||n?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(x),children:jsxRuntime.jsx(bl,{state:e,stateLabel:b,metric:f,metricFormatter:n,secondaryState:h||void 0,size:i,shape:s,icon:l,fixedWidth:d,secondaryStateIconOnly:m,layout:"horizontal"})}):jsxRuntime.jsx("div",{className:x,children:jsxRuntime.jsx(zn,{state:e,label:b,icon:l,size:i,shape:s,fixedWidth:d})})}function ix({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 jsxRuntime.jsx(J,{className:nr(a)});let m=jr({value:e,formatter:o,emptyText:l,emptyClassName:d}),p=Ar(a),g=Me(n,tailwindMerge.twMerge(p,c)),f=jsxRuntime.jsx("div",{className:g,children:m}),h=Se(i,t);return h?ao(f,h,t,s):f}var Vu=Oe__namespace.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=Oe.useMemo(()=>r===t?100:Math.max(0,Math.min(100,(e-t)/(r-t)*100)),[e,t,r]),f=Oe.useMemo(()=>o==="auto"&&a?a.type==="diverging"&&a.center!==void 0?Za(e,t,r,a.center,a.scheme):Qa(e,t,r,a.scheme):o,[o,a,e,t,r]);if(p.isLoading)return jsxRuntime.jsx("div",{className:"flex items-center gap-2 w-full",style:{height:c},children:jsxRuntime.jsx("div",{className:"h-full flex-1 animate-pulse bg-border-default rounded"})});if(d&&d>0){let x=`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 jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:`flex gap-0.5 ${m?"":"flex-1"}`,style:v,children:Array.from({length:d}).map((S,w)=>{let N=w<y;return jsxRuntime.jsx("div",{className:"rounded-sm",style:{width:x,backgroundColor:N?f:n==="none"?"transparent":n,marginRight:w<d-1?`${u}px`:0}},w)})}),i&&jsxRuntime.jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})}let h={height:c,backgroundColor:n==="none"?"transparent":n,...m&&{width:typeof m=="number"?`${m}px`:m,flexShrink:0}};return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:`relative rounded-sm ${m?"":"flex-1"}`,style:h,children:jsxRuntime.jsx("div",{className:"absolute left-0 top-0 h-full rounded-sm",style:{width:`${g}%`,minWidth:g>0?l:0,backgroundColor:f}})}),i&&jsxRuntime.jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})});Vu.displayName="HorizontalBarCell";var zu=Oe__namespace.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=h=>"xValue"in h?h.xValue:h.x,l=h=>"yValue"in h?h.yValue:h.y,d=a||100,u=i,{xScale:m,yScale:p,barWidth:g}=Oe.useMemo(()=>{if(s.length===0)return {xScale:scale.scaleTime({range:[0,d],domain:[new Date,new Date]}),yScale:scale.scaleLinear({range:[u,0],domain:[0,1]}),barWidth:2};let h=d3Array.extent(s,N=>c(N)),b=d3Array.min(s,N=>l(N))??0,x=d3Array.max(s,N=>l(N))??0,y=b<0?b:0,v=scale.scaleTime({range:[0,d],domain:h}),S=scale.scaleLinear({range:[u,0],domain:[y,x*1.05]}),w=s.length>1?d/s.length*.8:8;return {xScale:v,yScale:S,barWidth:Math.max(2,w)}},[s,d,u]);if(n.isLoading)return jsxRuntime.jsx("div",{className:"flex items-center gap-0.5",style:{width:d,height:u},children:Array.from({length:5}).map((h,b)=>jsxRuntime.jsx("div",{className:"flex-1 animate-pulse bg-border-default rounded"},b))});if(!s||s.length===0)return jsxRuntime.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 jsxRuntime.jsx("svg",{width:d,height:u,children:s.map((h,b)=>{let x=l(h),y=m(c(h)),v=p(x),S=Math.abs(f-v),w=h.category&&o?.[h.category]?o[h.category]:r;return jsxRuntime.jsx(shape.Bar,{x:y-g/2,y:x>=0?v:f,width:g,height:S,fill:w,rx:1},`bar-${b}`)})})});zu.displayName="MiniBarCell";function ux({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 jsxRuntime.jsx(J,{className:nr(l)});if(e==null||isNaN(Number(e)))return jsxRuntime.jsx("div",{className:Me(c,"text-text-secondary"),children:s});let h=Number(e),b;switch(o){case "currency":b=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:n,maximumFractionDigits:n}).format(h);break;case "percent":b=new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:n,maximumFractionDigits:n}).format(h/100);break;case "compact":b=new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:n>0?1:0,maximumFractionDigits:n}).format(h);break;default:b=new Intl.NumberFormat("en-US",{minimumFractionDigits:n,maximumFractionDigits:n}).format(h);}let y=`${m&&h>0?"+":""}${b}`,v=p?pl(h,true):Ar(l),S=Me(c,tailwindMerge.twMerge(v,g)),w=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[a&&jsxRuntime.jsx("span",{className:"text-text-secondary",children:a}),jsxRuntime.jsx("span",{children:y}),i&&jsxRuntime.jsx("span",{className:"text-text-secondary",children:i})]}),N=Se(d,t);return N?jsxRuntime.jsx("div",{className:S,children:ao(w,N,t,u)}):jsxRuntime.jsx("div",{className:S,children:w})}var Ou=Oe__namespace.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=Oe.useMemo(()=>Math.max(0,Math.min(100,e)),[e]),d=Oe.useMemo(()=>r==="auto"&&s?s.type==="diverging"&&s.center!==void 0?Za(e,0,100,s.center,s.scheme):Qa(e,0,100,s.scheme):r,[r,s,e]);if(c.isLoading)return jsxRuntime.jsx("div",{className:"flex items-center gap-2",style:{height:n},children:jsxRuntime.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 jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex gap-0.5 flex-1",style:{height:n},children:Array.from({length:a}).map((g,f)=>{let h=f<p,b=d;if(r==="auto"&&s&&h){let x=(f+1)/a*100;s.type==="diverging"&&s.center!==void 0?b=Za(x,0,100,s.center,s.scheme):b=Qa(x,0,100,s.scheme);}return jsxRuntime.jsx("div",{className:"rounded-sm",style:{width:m,backgroundColor:h?b:o==="none"?"transparent":o,marginRight:f<a-1?`${i}px`:0}},f)})}),t&&jsxRuntime.jsxs("span",{className:"text-sm text-text-primary whitespace-nowrap",children:[l.toFixed(0),"%"]})]})}return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"relative flex-1 rounded-sm",style:{height:n,backgroundColor:o==="none"?"transparent":o},children:jsxRuntime.jsx("div",{className:"absolute left-0 top-0 h-full rounded-sm transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})}),t&&jsxRuntime.jsxs("span",{className:"text-sm text-text-primary whitespace-nowrap",children:[l.toFixed(0),"%"]})]})});Ou.displayName="PercentBarCell";function mx({row:e,context:t,isSelected:r=false,onSelect:o,isDisabled:n=false,align:a="center"}){let{isLoading:i}=t;if(i)return jsxRuntime.jsx("div",{className:Me(a),children:jsxRuntime.jsx(J,{className:"h-4 w-4 rounded"})});let s=Se(n,e),c=Me(a);return jsxRuntime.jsx("div",{className:c,children:jsxRuntime.jsx(Sn,{isSelected:r,onChange:l=>{o?.(e,l);},isDisabled:s,"aria-label":"Select row"})})}function yl({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],h={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 x=b.join(", "),y=({children:S,className:w})=>i?s?jsxRuntime.jsx(s,{href:i,className:w,children:S}):jsxRuntime.jsx(Ze,{href:i,variant:c,className:tailwindMerge.twMerge("hover:underline",w),asButton:false,children:S}):jsxRuntime.jsx("span",{className:w,children:S});if(d)return n==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",g.gap,u),children:[jsxRuntime.jsx(J,{width:g.skeletonIconInline,height:g.skeletonIconInline,className:"flex-shrink-0 rounded"}),jsxRuntime.jsx(J,{width:g.skeletonText,height:g.skeletonIconInline*.8})]}):jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",g.gap,u),children:[jsxRuntime.jsx(J,{width:g.skeletonIconStacked,height:g.skeletonIconStacked,className:"flex-shrink-0 rounded"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(J,{width:g.skeletonText,height:16}),jsxRuntime.jsx(J,{width:g.skeletonSecondary,height:12})]})]});if(n==="inline")return jsxRuntime.jsxs(y,{className:tailwindMerge.twMerge("flex items-center",g.gap,i&&"hover:bg-background-hover transition-colors",u),children:[jsxRuntime.jsx(B,{name:"MapPin",size:g.iconSize,className:"text-text-secondary flex-shrink-0"}),jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-primary",h,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 jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center justify-start",g.gap,u),children:[jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",g.iconContainerSize),children:jsxRuntime.jsx(B,{name:"MapPin",size:g.iconSize,className:"text-text-secondary"})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxRuntime.jsx(y,{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-primary",h,g.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsxRuntime.jsx("span",{"data-pii-type":m?"address":void 0,"data-pii-entity":m,children:e})}),x&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("text-text-secondary leading-normal truncate",g.secondaryTextSize),"data-pii-type":v(),"data-pii-entity":m,children:x})]})]})}function gx({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,h=Se(r,e),b=Se(o,e),x=Se(n,e),y=Se(a,e),v=Se(c,e),S=Se(g,e),w=Me(m,p);return jsxRuntime.jsx("div",{className:w,children:jsxRuntime.jsx(yl,{streetAddress:h,city:b,state:x,postalCode:y,layout:i,size:s,href:v,LinkComponent:l,linkVariant:d,emphasis:u,isLoading:f,piiEntity:S})})}var Hu=Oe__namespace.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}=Oe.useMemo(()=>{if(l.length===0)return {xScale:scale.scaleTime({range:[0,d],domain:[new Date,new Date]}),yScale:scale.scaleLinear({range:[u,0],domain:[0,1]})};let f=d3Array.extent(l,y=>y.xValue),h=d3Array.min(l,y=>y.yValue)||0,b=d3Array.max(l,y=>y.yValue)||0,x=(b-h)*.1||1;return {xScale:scale.scaleTime({range:[0,d],domain:f}),yScale:scale.scaleLinear({range:[u,0],domain:[h-x,b+x]})}},[l,d,u]);if(i.isLoading)return jsxRuntime.jsx("div",{className:"flex items-center",style:{width:d,height:u},children:jsxRuntime.jsx("div",{className:"h-1 w-full animate-pulse bg-border-default rounded"})});if(!l||l.length===0)return jsxRuntime.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 jsxRuntime.jsxs("svg",{width:d,height:u,className:"overflow-visible",children:[(r==="area"||r==="both")&&jsxRuntime.jsx(shape.AreaClosed,{data:l,x:f=>m(f.xValue),y:f=>p(f.yValue),yScale:p,fill:g,fillOpacity:.15,curve:curve.curveLinear}),(r==="line"||r==="both")&&jsxRuntime.jsx(shape.LinePath,{data:l,x:f=>m(f.xValue),y:f=>p(f.yValue),stroke:g,strokeWidth:n,strokeLinecap:"round",curve:curve.curveLinear})]})});Hu.displayName="SparklineCell";function yx({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:h}=r;if(h)return jsxRuntime.jsx(J,{className:nr(l)});let b=ul(e,a),x=Se(i,t),y=Se(f,t),v=b,S=false,w=false;if(d&&b&&typeof b=="string")if(typeof d=="boolean")w=true;else {let{position:R="end",length:H=16,ellipsis:G="...",tooltip:K=true}=d;if(b.length>H){switch(R){case "start":v=cs(b,H);break;case "middle":v=da(b,H);break;case "end":v=ds(b,H,G);break}S=K;}}let N=g&&y?{"data-pii-type":g,"data-pii-entity":y}:{},M=Object.keys(N).length>0,k=jsxRuntime.jsx("span",{className:w?"truncate":"",...N,children:v}),T=S?jsxRuntime.jsx(Zt,{content:M?jsxRuntime.jsx("span",{...N,children:String(b)}):String(b),children:k}):k,A=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o&&jsxRuntime.jsx("span",{className:"text-text-secondary",children:o}),T,n&&jsxRuntime.jsx("span",{className:"text-text-secondary",children:n})]}),E=A;if(u&&b&&b!==a){let R=typeof u=="function"?u(t):String(b);E=jsxRuntime.jsx(Oo,{value:R,size:"sm",children:A});}if(x){let R=Me(m,p);return jsxRuntime.jsx("div",{className:R,children:ao(E,x,t,s,c,l)})}let D=Me(m,tailwindMerge.twMerge(Ar(l),p));return jsxRuntime.jsx("div",{className:D,children:E})}var EP={sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"},DP={sm:"hidden sm:grid",md:"hidden md:grid",lg:"hidden lg:grid",xl:"hidden xl:grid"};function vl(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function Cl(e,t,r,o){if(r.cell){let n=r.cell,a=typeof r.cellProps=="function"?r.cellProps(e,t):r.cellProps;return jsxRuntime.jsx(n,{value:e,row:t,context:o,...a})}return r.render?r.render(e,t,o):e?.toString()??"\u2014"}function wl({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 jsxRuntime.jsxs("div",{className:tailwindMerge.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&&jsxRuntime.jsxs("div",{className:"mb-2 flex items-start justify-between",children:[jsxRuntime.jsx("div",{className:"flex-1",children:i.map(u=>{let m=vl(e,u);return jsxRuntime.jsx("div",{className:"font-medium text-text-primary [&>*]:!justify-start [&>*]:!text-left",children:Cl(m,e,u,l)},u.id)})}),c.length>0&&jsxRuntime.jsx("div",{className:"ml-2 flex flex-wrap gap-1",children:c.map(u=>{let m=vl(e,u);return jsxRuntime.jsx("div",{className:"inline-flex",children:Cl(m,e,u,l)},u.id)})})]}),s.length>0&&jsxRuntime.jsx("div",{className:"space-y-1",children:s.map(u=>{let m=vl(e,u),p=u.showLabel&&u.label;return jsxRuntime.jsxs("div",{className:"flex items-center text-sm text-text-secondary",children:[u.icon&&jsxRuntime.jsx(B,{name:u.icon,className:"mr-1.5 h-4 w-4 flex-shrink-0"}),p&&jsxRuntime.jsxs("span",{className:"mr-1 font-medium",children:[u.label,":"]}),jsxRuntime.jsx("span",{className:"truncate [&>*]:!justify-start [&>*]:!text-left",children:Cl(m,e,u,l)})]},u.id)})})]})}function Nl({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 jsxRuntime.jsx("div",{className:tailwindMerge.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:jsxRuntime.jsx("div",{className:"space-y-2",children:a.map((c,l)=>{let d=vl(e,c),u=l===0;return jsxRuntime.jsxs("div",{children:[!u&&jsxRuntime.jsx("div",{className:"text-xs text-text-secondary",children:c.label}),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(u?"font-medium text-text-primary":"text-sm text-text-primary","[&>*]:!justify-start [&>*]:!text-left"),children:Cl(d,e,c,i)})]},c.id)})})})}function vx(e="md"){return {mobile:EP[e],desktop:DP[e]}}function Cx({density:e}){return jsxRuntime.jsxs("div",{className:tailwindMerge.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:[jsxRuntime.jsx("div",{className:"mb-2 h-5 w-3/4 animate-pulse rounded bg-background-muted"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-4 w-1/2 animate-pulse rounded bg-background-muted"}),jsxRuntime.jsx("div",{className:"h-4 w-2/3 animate-pulse rounded bg-background-muted"})]})]})}var KP={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},YP={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"};function JP(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 XP({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}=sortable.useSortable({id:e.id,disabled:!c||s}),f=t?.columnId===e.id,h=f?t.direction:null,b=n&&a,x={...JP(e),transform:utilities.CSS.Transform.toString(m),transition:p,opacity:g?.8:1,zIndex:g?50:void 0};return jsxRuntime.jsx("div",{ref:u,className:tailwindMerge.twMerge("flex items-center border-b border-border-default bg-background-surface",e.sortable?"gap-2":"gap-1",KP[i],YP[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:x,role:"columnheader","aria-sort":f?h==="asc"?"ascending":"descending":"none","aria-disabled":s,...l,...d,children:s?jsxRuntime.jsx(J,{className:"h-4 w-24"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1 truncate cursor-pointer",onClick:()=>!s&&e.sortable&&r(e.id),children:e.label}),e.sortable&&jsxRuntime.jsx("button",{type:"button",className:"flex flex-shrink-0 cursor-pointer",onClick:()=>!s&&r(e.id),"aria-label":`Sort by ${e.label}`,children:f?jsxRuntime.jsx(B,{name:h==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-primary"}):jsxRuntime.jsx(B,{name:"CaretUpDown",size:12,className:"text-text-secondary opacity-40"})})]})})}function wx({columns:e,columnOrder:t,onColumnOrderChange:r,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,density:s="default",isLoading:c=false}){let l=core.useSensors(core.useSensor(core.PointerSensor,{activationConstraint:{distance:5}}),core.useSensor(core.KeyboardSensor,{coordinateGetter:sortable.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 h=t.indexOf(g.id),b=t.indexOf(f.id);if(d.get(f.id)?.reorderable===false)return;let y=0;for(let N=0;N<t.length&&d.get(t[N])?.reorderable===false;N++)y=N+1;if(b<y)return;let v=Math.min(h,b),S=Math.max(h,b);for(let N=v;N<=S;N++){if(N===h)continue;if(d.get(t[N])?.reorderable===false)return}let w=sortable.arrayMove(t,h,b);r(w);}},m=t.map(p=>d.get(p)).filter(p=>p!==void 0);return jsxRuntime.jsx(core.DndContext,{sensors:l,collisionDetection:core.closestCenter,onDragEnd:u,children:jsxRuntime.jsx(sortable.SortableContext,{items:t,strategy:sortable.horizontalListSortingStrategy,children:jsxRuntime.jsx("div",{className:"contents",role:"rowgroup",children:m.map((p,g)=>jsxRuntime.jsx(XP,{column:p,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,isFirstColumn:g===0,density:s,isLoading:c},p.id))})})})}var Ku={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},Yu={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"},$P={full:"w-full",auto:"w-auto inline-block",contained:"w-full max-w-6xl mx-auto"},e2={auto:"table-auto",fixed:"table-fixed",responsive:"table-auto"};function Ju(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 t2(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function r2({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 jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex items-center border-b border-border-default bg-background-surface",e.sortable?"gap-2":"gap-1",Ku[i],Yu[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:Ju(e),children:s?jsxRuntime.jsx(J,{className:"h-4 w-24"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate",children:e.label}),e.sortable&&jsxRuntime.jsx("div",{className:"flex flex-shrink-0",children:c?jsxRuntime.jsx(B,{name:l==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-primary"}):jsxRuntime.jsx(B,{name:"CaretUpDown",size:12,className:"text-text-secondary opacity-40"})})]})})}function o2({column:e,row:t,rowIndex:r,columnIndex:o,isHovered:n,density:a="default",className:i,stickyFirstColumn:s}){let c=s&&o===0,l=t2(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=jsxRuntime.jsx(m,{value:l,row:t,context:d,...p});}else e.render?u=e.render(l,t,d):u=jsxRuntime.jsx("span",{className:"truncate",children:l?.toString()??""});if(e.popover){let m=e.popover,p,g="top",f=false,h="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,h=m.trigger||"hover"),u=jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{...h==="hover"?{trigger:"longPress"}:{},children:[jsxRuntime.jsx("div",{className:"cursor-help",children:u}),jsxRuntime.jsx(lt,{placement:g,showArrow:f,children:jsxRuntime.jsx("div",{className:"p-2",children:p})})]});}return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex items-center border-b border-border-default bg-background-surface",e.noCellPadding?"":Ku[a],Yu[e.align||"left"],c&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",i),role:"cell",style:Ju(e),children:u})}function n2({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=jsxRuntime.jsx(c,{value:null,row:{},context:i,...l});}else e.render?s=e.render(null,{},i):s=jsxRuntime.jsx(J,{className:"h-4 w-full max-w-[200px]"});return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex items-center border-b border-border-default bg-background-surface",e.noCellPadding?"":Ku[o],Yu[e.align||"left"],a&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),role:"cell",style:Ju(e),children:s})}function a2(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 Nx({columns:e,row:t,rowIndex:r,density:o="default",onClick:n,stickyFirstColumn:a}){let[i,s]=Oe.useState(false),c=Oe.useCallback(l=>{if(!n)return;let d=l.target,u=l.currentTarget;a2(d,u)||n(t);},[n,t]);return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("contents group",n&&"cursor-pointer"),role:"row",onClick:c,onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),children:e.map((l,d)=>jsxRuntime.jsx(o2,{column:l,row:t,rowIndex:r,columnIndex:d,isHovered:i,density:o,className:n?"group-hover:bg-background-hover":"",stickyFirstColumn:a},l.id))})}function kx({columns:e,rowIndex:t,density:r="default",stickyFirstColumn:o}){return jsxRuntime.jsx("div",{className:"contents",role:"row",children:e.map((n,a)=>jsxRuntime.jsx(n2,{column:n,rowIndex:t,columnIndex:a,density:r,stickyFirstColumn:o},n.id))})}function Tx({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:h,estimatedRowHeight:b,loadingIndicator:x,stickyHeader:y=false,stickyFirstColumn:v=false,onRowClick:S,getRowId:w,hideHeader:N=false,sortConfig:M,onSort:k,"aria-label":T,enableColumnReorder:A=false,columnOrder:E,onColumnOrderChange:D}){let[R,H]=Oe.useState(null),G=M!==void 0,K=G?M:R,W=Oe.useRef(null),q=Oe.useMemo(()=>e.map(te=>te.id),[e]),[j,Q]=Oe.useState(q),O=E!==void 0,L=O?E:j;Oe.useEffect(()=>{O||Q(te=>{let ne=e.map(ce=>ce.id),V=new Set(ne),z=new Set(te),le=te.filter(ce=>V.has(ce)),se=ne.filter(ce=>!z.has(ce));return [...le,...se]});},[e,O]);let Y=Oe.useCallback(te=>{O||Q(te),D?.(te);},[O,D]),P=Oe.useMemo(()=>{if(!A&&!E)return e;let te=new Map(e.map(ne=>[ne.id,ne]));return L.map(ne=>te.get(ne)).filter(ne=>ne!==void 0)},[e,L,A,E]),C=Fo({items:t,onLoadMore:g,hasMore:f,isLoading:u,loadingState:m,enableVirtualization:h,estimatedItemSize:b||(o==="compact"?40:o==="relaxed"?60:48),overscan:5}),I=g?C:null,F=I?.scrollRef??W,{loadMoreRef:U,virtualizer:$,virtualItems:ae,isLoadingMore:Z,computedLoadingState:ie}=I||{},{gridTemplateColumns:fe,totalMinWidth:re}=Oe.useMemo(()=>{let te=0;return {gridTemplateColumns:P.map(V=>{if(V.minWidth?te+=typeof V.minWidth=="number"?V.minWidth:0:V.width&&typeof V.width=="number"&&(te+=V.width),V.width)return typeof V.width=="number"?`${V.width}px`:V.width;if(V.flex)return `${V.flex}fr`;if(V.minWidth&&V.maxWidth){let z=typeof V.minWidth=="number"?`${V.minWidth}px`:V.minWidth,le=typeof V.maxWidth=="number"?`${V.maxWidth}px`:V.maxWidth;return `minmax(${z}, ${le})`}return V.minWidth?`minmax(${typeof V.minWidth=="number"?`${V.minWidth}px`:V.minWidth}, 1fr)`:V.maxWidth?`minmax(0, ${typeof V.maxWidth=="number"?`${V.maxWidth}px`:V.maxWidth})`:"1fr"}).join(" "),totalMinWidth:te}},[P]),de=Oe.useCallback(te=>{if(!e.find(z=>z.id===te)?.sortable)return;let V;K?.columnId===te?V={columnId:te,direction:K.direction==="asc"?"desc":"asc"}:V={columnId:te,direction:"asc"},G||H(V),k?.(V);},[e,K,k,G]),xe=ie==="loading"||u&&t.length===0,he={};a?(he.height=typeof a=="number"?`${a}px`:a,he.overflowY="auto"):i?(he.maxHeight=typeof i=="number"?`${i}px`:i,he.overflowY="auto"):g&&(he.height="600px",he.overflowY="auto");let Ee=tailwindMerge.twMerge($P[n],!g&&(s==="responsive"?"overflow-x-auto scrollbar-visible":"overflow-auto scrollbar-visible"),r),$e=vx(d),Eo=c!=="none",lr=(te,ne)=>Eo?c==="custom"&&l?l(te,ne):jsxRuntime.jsx(c==="cards"?Nl:wl,{row:te,columns:P,density:o,isLoading:u,onClick:S?()=>S(te):void 0}):null,ee=$?ae?.map(te=>({virtualItem:te,row:t[te.index],index:te.index}))||[]:t.map((te,ne)=>({row:te,index:ne,virtualItem:null}));return jsxRuntime.jsxs("div",{ref:F,className:Ee,style:{...he,position:$?"relative":void 0},children:[jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("grid border-separate border-spacing-0",e2[s],n==="auto"?"inline-grid w-auto":"w-full",Eo&&$e.desktop),role:"table","aria-label":T,style:{gridTemplateColumns:fe,minWidth:re>0?`${re}px`:void 0},children:[!N&&(A?jsxRuntime.jsx(wx,{columns:e,columnOrder:L,onColumnOrderChange:Y,sortConfig:K,onSort:de,stickyHeader:y,stickyFirstColumn:v,density:o,isLoading:xe}):jsxRuntime.jsx("div",{className:"contents",role:"rowgroup",children:P.map((te,ne)=>jsxRuntime.jsx(r2,{column:te,sortConfig:K,onSort:de,stickyHeader:y,stickyFirstColumn:v,isFirstColumn:ne===0,density:o,isLoading:xe},te.id))})),$?jsxRuntime.jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1",height:`${$.getTotalSize()}px`,position:"relative"},role:"rowgroup",children:xe?Array.from({length:p}).map((te,ne)=>jsxRuntime.jsx("div",{className:"contents",children:jsxRuntime.jsx(kx,{columns:P,rowIndex:ne,density:o,stickyFirstColumn:v})},`loading-${ne}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ee.map(({row:te,index:ne,virtualItem:V})=>{if(!te||!V)return null;let z=w?w(te):`row-${ne}`;return jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",display:"grid",gridTemplateColumns:fe,transform:`translateY(${V.start}px)`},"data-index":V.index,ref:$.measureElement,children:jsxRuntime.jsx(Nx,{columns:P,row:te,rowIndex:ne,density:o,onClick:S,stickyFirstColumn:v})},z)}),Z&&jsxRuntime.jsx("div",{style:{position:"absolute",top:`${$.getTotalSize()}px`,left:0,width:"100%"},children:x||jsxRuntime.jsx(Nr,{state:"loading-more"})})]}):jsxRuntime.jsx("div",{className:"py-12 text-center text-text-secondary",children:"No data available"})}):jsxRuntime.jsx("div",{className:"contents",role:"rowgroup",children:xe?Array.from({length:p}).map((te,ne)=>jsxRuntime.jsx(kx,{columns:P,rowIndex:ne,density:o,stickyFirstColumn:v},`loading-${ne}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ee.map(({row:te,index:ne})=>{if(!te)return null;let V=w?w(te):`row-${ne}`;return jsxRuntime.jsx(Nx,{columns:P,row:te,rowIndex:ne,density:o,onClick:S,stickyFirstColumn:v},V)}),Z&&jsxRuntime.jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1"},children:x||jsxRuntime.jsx(Nr,{state:"loading-more"})})]}):jsxRuntime.jsx("div",{className:"col-span-full py-12 text-center text-text-secondary",role:"row",children:jsxRuntime.jsx("div",{role:"cell",children:"No data available"})})})]}),Eo&&jsxRuntime.jsx("div",{className:$e.mobile,children:xe?Array.from({length:p}).map((te,ne)=>jsxRuntime.jsx(Cx,{density:o},`mobile-loading-${ne}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ee.map(({row:te,index:ne})=>{if(!te)return null;let V=w?w(te):`mobile-row-${ne}`;return jsxRuntime.jsx("div",{className:"border-b border-border-default last:border-b-0",children:lr(te,ne)},V)}),Z&&(x||jsxRuntime.jsx(Nr,{state:"loading-more"}))]}):jsxRuntime.jsx("div",{className:"py-12 text-center text-text-secondary",children:"No data available"})}),g&&f&&!xe&&($?jsxRuntime.jsx("div",{ref:U,style:{position:"absolute",top:`${$.getTotalSize()}px`,left:0,width:"100%",height:1}}):jsxRuntime.jsx("div",{ref:U,className:"h-px w-full"}))]})}function Rx({status:e,alertCount:t,showCount:r=false,isLoading:o,size:n="sm",shape:a="pill",...i}){if(o)return jsxRuntime.jsx(J,{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 jsxRuntime.jsx(nt,{variant:s[e],size:n,shape:a,dot:l,dotPulse:l,...i,children:d})}var s2={battery:"BatteryHigh",charger:"ChargingStation",thermostat:"ThermometerSimple",inverter:"Power",vehicle:"Car",water_heater:"DropHalfBottom",meter:"Gauge",gateway:"WifiHigh",other:"Cube",unknown:"Question"},l2={battery:"Battery",charger:"Charger",thermostat:"Thermostat",inverter:"Inverter",vehicle:"Vehicle",water_heater:"Water Heater",meter:"Meter",gateway:"Gateway",other:"Other",unknown:"Unknown"};function Ex({deviceType:e,iconName:t,size:r="md",showLabel:o=false,className:n}){let a=t||(e?s2[e]:"Question"),i=e?l2[e]:void 0;return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("inline-flex items-center",o?"flex-col gap-1":"gap-0",n),children:[jsxRuntime.jsx(B,{name:a,size:r}),o&&i&&jsxRuntime.jsx("span",{className:"text-xs text-text-secondary",children:i})]})}function Ei({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:h=true,maxWidth:b="400px"}){if(!s)return null;let x=t||r,y=m||p||g||f;return jsxRuntime.jsx(zr,{children:jsxRuntime.jsx(cr,{isOpen:s,onOpenChange:v=>!v&&d?.(),isDismissable:true,transparent:l,children:jsxRuntime.jsx(reactAriaComponents.Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxRuntime.jsxs(reactAriaComponents.Dialog,{className:tailwindMerge.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:[x&&(a&&i?jsxRuntime.jsx(Ht,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,hasBackArrow:true,onBack:i,onClose:d}):jsxRuntime.jsx(Ht,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,onClose:d})),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-1 overflow-y-auto overscroll-contain",h?"px-6 py-6":"p-0"),children:e}),y&&jsxRuntime.jsx(Io,{primaryAction:m,secondaryAction:p,tertiaryAction:g,footerContent:f})]})})})})}Ei.displayName="Drawer";function Lx({status:e,programName:t,isLoading:r,size:o="sm",shape:n="pill",...a}){if(r)return jsxRuntime.jsx(J,{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=jsxRuntime.jsx(nt,{variant:i[e],size:o,shape:n,...a,children:s[e]});return t?jsxRuntime.jsx(Zt,{content:t,children:c}):c}function Ix({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]=Oe.useState(false),[m,p]=Oe.useState(false),[g,f]=Oe.useState(null),[h,b]=Oe.useState(e),x=Oe.useRef(null),y=async w=>{if(f(null),n&&w.size>n){f(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(c&&w.type.startsWith("image/")){let N=new FileReader;N.onloadend=()=>{b(N.result);},N.readAsDataURL(w);}if(i){p(true);try{let N=await i(w);b(N),r?.(N);}catch(N){f("Failed to upload file"),console.error("Upload error:",N);}finally{p(false);}}t?.(w,h);},v=async w=>{try{let N=w.items;if(N.length>0){let M=N[0];if(M.kind==="file"){let k=await M.getFile();k&&y(k);}}}catch(N){f("Failed to upload file"),console.error("Upload error:",N);}finally{u(false);}},S=()=>{b(void 0),f(null),t?.(null),r?.(""),x.current&&(x.current.value="");};return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("w-full",s),children:[jsxRuntime.jsxs(reactAriaComponents.DropZone,{className:tailwindMerge.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:[h?jsxRuntime.jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[c&&(h.startsWith("data:image")||h.startsWith("http"))?jsxRuntime.jsx("img",{src:h,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Image,{className:"h-12 w-12 text-text-secondary"}),jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!a&&jsxRuntime.jsx(_,{variant:"icon",size:"sm",onPress:S,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsxRuntime.jsx(lucideReact.Upload,{className:"h-12 w-12 text-text-secondary"}),jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-sm text-text-primary",children:l}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:o==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${o}`})]}),jsxRuntime.jsx(reactAriaComponents.FileTrigger,{acceptedFileTypes:o.split(","),onSelect:w=>{let N=Array.from(w||[]);N.length>0&&y(N[0]);},children:jsxRuntime.jsx(_,{variant:"secondary",size:"sm",isDisabled:a,children:"Choose File"})})]}),m&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),g&&jsxRuntime.jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function Bx({version:e,isLatest:t,updateAvailable:r,isLoading:o,size:n="sm",shape:a="rounded",...i}){if(o)return jsxRuntime.jsx(J,{className:"inline-flex h-6 w-16"});let s="neutral",c=e;return t?s="success":r&&(s="warning",c=`${e} (Update)`),jsxRuntime.jsx(nt,{variant:s,size:n,shape:a,...i,children:c})}function Ia(e){return jsxRuntime.jsx(reactAriaComponents.Form,{validationBehavior:"aria",...e,className:tailwindMerge.twMerge("flex flex-col gap-6",e.className)})}function zx({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]=Oe.useState(false),m=Jt("(max-width: 767px)"),p=o!==void 0?o:d,g=Oe.useCallback(x=>{n?n(x):u(x);},[n]);Oe.useEffect(()=>{let x=y=>{(y.metaKey||y.ctrlKey)&&y.key==="k"&&(y.preventDefault(),g(!p)),y.key==="Escape"&&p&&g(false);};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[p,g]);let f=Oe.useCallback(x=>{r?.(x);},[r]),h=jsxRuntime.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:[jsxRuntime.jsx(B,{name:"MagnifyingGlass",size:18}),!m&&s&&jsxRuntime.jsxs("span",{className:"hidden md:flex items-center gap-1 text-xs",children:[jsxRuntime.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"}),jsxRuntime.jsx("kbd",{className:"px-1.5 py-0.5 bg-background-muted border border-border-muted rounded text-xs",children:"K"})]})]}),b=a===null||Oe.isValidElement(a)&&a.type===Oe.Fragment&&!a.props.children;return m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!b&&(a?jsxRuntime.jsx("button",{type:"button",onClick:()=>g(true),className:"appearance-none bg-transparent border-none p-0 cursor-pointer",children:a}):jsxRuntime.jsx("button",{type:"button",onClick:()=>g(true),className:"appearance-none bg-transparent border-none p-0 cursor-pointer",children:h})),jsxRuntime.jsx(ct,{isOpen:p,onClose:()=>g(false),hideCloseIcon:false,contentPadding:false,maxHeight:"90vh",children:jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[c&&jsxRuntime.jsx("div",{className:"p-4 border-b border-border-muted flex-shrink-0",children:jsxRuntime.jsx(Lr,{value:t,onChange:f,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:l,autoFocus:true})}),jsxRuntime.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:i})]})})]}):b?null:jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:p,onOpenChange:g,children:[a||h,jsxRuntime.jsx(lt,{placement:"bottom",className:"w-[600px] max-w-[90vw] bg-background-surface shadow-xl border border-border-default rounded-lg overflow-hidden",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[c&&jsxRuntime.jsx("div",{className:"p-4 border-b border-border-muted",children:jsxRuntime.jsx(Lr,{value:t,onChange:f,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:l,autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[500px] overflow-hidden",children:i})]})})]})}function Wx({placeholder:e="Search...",value:t,onChange:r,isOpen:o,onOpenChange:n,children:a,maxHeight:i="400px",variant:s="default",className:c}){let[l,d]=Oe.useState(false),u=Jt("(max-width: 767px)"),m=Oe.useRef(null),p=Oe.useRef(null),g=o!==void 0?o:l,f=Oe.useCallback(T=>{n?n(T):d(T);},[n]);Oe.useEffect(()=>{let T=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),f(!g)),A.key==="Escape"&&g&&f(false);};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[g,f]),Oe.useEffect(()=>{g&&!u&&m.current&&setTimeout(()=>{m.current?.querySelector("input")?.focus();},0);},[g,u]),Oe.useEffect(()=>{if(!g||u)return;let T=A=>{let E=A.target,D=m.current?.contains(E),R=p.current?.contains(E);!D&&!R&&f(false);};return document.addEventListener("mousedown",T,true),()=>document.removeEventListener("mousedown",T,true)},[g,u,f]);let h=T=>{r?.(T);},b=Oe.useCallback(()=>{f(false);},[f]),x=Oe.useCallback(()=>{r?.("");},[r]),[y,v]=Oe.useState(null);Oe.useEffect(()=>{if(g&&!u&&m.current){let T=null,A=()=>{let D=m.current?.getBoundingClientRect();D&&v({top:D.bottom+8,left:D.left,width:D.width});},E=()=>{T===null&&(T=requestAnimationFrame(()=>{A(),T=null;}));};return A(),window.addEventListener("resize",E),window.addEventListener("scroll",E,true),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,true),T!==null&&cancelAnimationFrame(T);}}},[g,u]);let S=Oe.useCallback(()=>{f(true);},[f]);if(u)return jsxRuntime.jsxs("div",{className:c,children:[jsxRuntime.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:jsxRuntime.jsx(B,{name:"MagnifyingGlass",size:"md"})}),jsxRuntime.jsxs(ct,{isOpen:g,onClose:b,contentPadding:false,height:"80vh",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-4 pt-4",children:[jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsx(Lr,{value:t,onChange:h,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:x,reserveErrorSpace:false,autoFocus:true})}),jsxRuntime.jsx(_,{variant:"icon",onPress:b,"aria-label":"Close search",className:"flex-shrink-0",children:jsxRuntime.jsx(B,{name:"X",size:"md"})})]}),jsxRuntime.jsx("div",{className:"mt-4",children:a})]})]},"mobile");let w=T=>{let E=T.target.tagName==="INPUT";if(T.key==="ArrowDown"&&g&&E){T.preventDefault();let D=p.current?.querySelector("[data-search-result]");D&&D.focus();}},N=T=>{let A=T.target;if(!A.hasAttribute("data-search-result"))return;let D=Array.from(p.current?.querySelectorAll("[data-search-result]")||[]),R=D.indexOf(A);if(T.key==="ArrowDown"){T.preventDefault(),T.stopPropagation();let H=Math.min(R+1,D.length-1);D[H]?.focus();}else if(T.key==="ArrowUp")if(T.preventDefault(),T.stopPropagation(),R===0)m.current?.querySelector("input")?.focus();else {let H=Math.max(R-1,0);D[H]?.focus();}else T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),f(false),m.current?.querySelector("input")?.focus());},M=g&&y&&typeof document<"u"?reactDom.createPortal(jsxRuntime.jsx("div",{ref:p,style:{position:"fixed",top:`${y.top}px`,left:`${y.left}px`,width:`${y.width}px`,zIndex:9999},role:"listbox",onKeyDown:N,children:jsxRuntime.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:jsxRuntime.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 jsxRuntime.jsxs("div",{ref:m,className:`relative w-full ${c||""}`,onKeyDown:w,children:[jsxRuntime.jsx(Lr,{value:t,onChange:h,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:k,onFocus:()=>f(true)}),M]},"desktop")}function Gx({message:e="No results found",suggestion:t,icon:r="MagnifyingGlass",className:o=""}){return jsxRuntime.jsxs("div",{className:`flex flex-col items-center justify-center py-12 px-4 text-center ${o}`,children:[jsxRuntime.jsx("div",{className:"text-text-secondary mb-3",children:jsxRuntime.jsx(B,{name:r,size:48})}),jsxRuntime.jsx("p",{className:"text-base font-medium text-text-primary mb-1",children:e}),t&&jsxRuntime.jsx("p",{className:"text-sm text-text-secondary max-w-xs",children:t})]})}function Kx({count:e=3,className:t=""}){return jsxRuntime.jsx("div",{className:`flex flex-col ${t}`,children:Array.from({length:e}).map((r,o)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[jsxRuntime.jsx(J,{width:20,height:20,variant:"circle"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[jsxRuntime.jsx(J,{width:"60%",height:16}),jsxRuntime.jsx(J,{width:"40%",height:12})]}),jsxRuntime.jsx(J,{width:16,height:16})]},o))})}function Jx({title:e,count:t,isLoading:r,footer:o,children:n,className:a}){return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex flex-col",a),children:[jsxRuntime.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:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:e}),!r&&t!==void 0&&jsxRuntime.jsx("span",{className:"text-xs text-text-secondary",children:t}),r&&jsxRuntime.jsx("span",{className:"text-xs text-text-secondary animate-pulse",children:"Loading..."})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:n}),o&&jsxRuntime.jsx("div",{className:"px-4 py-2 border-t border-border-subtle",children:o})]})}function Xx({id:e,title:t,subtitle:r,metadata:o,icon:n,customIcon:a,onSelect:i,isFocused:s=false,className:c,testId:l}){return jsxRuntime.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 h=document.querySelector('input[type="text"][placeholder*="Search"]');h&&h.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:tailwindMerge.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?jsxRuntime.jsx("div",{className:"flex-shrink-0",children:a}):n?jsxRuntime.jsx("div",{className:"flex-shrink-0 text-text-secondary",children:jsxRuntime.jsx(B,{name:n,size:20})}):null,jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-baseline gap-2",children:[jsxRuntime.jsx("span",{className:"font-medium text-text-primary truncate",children:t}),o&&jsxRuntime.jsx("span",{className:"text-xs text-text-secondary flex-shrink-0",children:o})]}),r&&jsxRuntime.jsx("div",{className:"text-sm text-text-secondary truncate mt-0.5",children:r})]}),jsxRuntime.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:jsxRuntime.jsx(B,{name:"ArrowRight",size:16,className:"text-text-secondary"})})]})}function jx({children:e,maxHeight:t="400px",className:r}){return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-y-auto overscroll-contain","divide-y divide-border-muted",r),style:{maxHeight:t},children:e})}function Qx({placeholder:e="Search...",onClick:t,showShortcut:r=true,variant:o="default",className:n=""}){let a=typeof navigator<"u"&&navigator.platform.includes("Mac");return jsxRuntime.jsxs("button",{type:"button",onClick:t,className:`
|
|
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=lu(t.filename||"chart","svg",t.timestamp!==!1);(0,Us.saveAs)(s,c);}catch(r){throw new Error(`SVG export failed: ${r instanceof Error?r.message:"Unknown error"}`)}}async function mk(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 h=document.createElement("canvas");h.width=a.width*r,h.height=a.height*r;let b=h.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),h.toBlob(x=>{if(x){let y=lu(t.filename||"chart","png",t.timestamp!==!1);(0,Us.saveAs)(x,y),m();}else p(new Error("Failed to create PNG blob"));o&&URL.revokeObjectURL(o);},"image/png",1);}catch(h){o&&URL.revokeObjectURL(o),p(h);}},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 fk(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 gk(e){return {csv:"CSV Spreadsheet",svg:"SVG Vector Image",png:"PNG Image"}[e]||"Unknown Format"}function Ks({datasets:e,metadata:t,svgRef:r}){return Oe.useCallback(async o=>{try{await cu(o,e,t,r);}catch(n){throw console.error("Chart export failed:",n),n}},[e,t,r])}var du=({data:e,seriesMetadata:t,width:r,height:o,onBrushChange:n,brushRegion:a,margin:i=Ie,yDomain:s})=>{let c=Oe.useRef(null),l=Oe.useRef(false),d=Oe.useMemo(()=>e.flat(),[e]),u=Oe.useMemo(()=>({top:10,bottom:15,left:i.left,right:i.right}),[i]),m=r-u.left-u.right,p=Oe.useMemo(()=>{if(d.length===0)return scale.scaleTime({domain:[new Date,new Date],range:[0,m]});let x=new Date(Math.min(...d.map(v=>v.xValue.getTime()))),y=new Date(Math.max(...d.map(v=>v.xValue.getTime())));return scale.scaleTime({domain:[x,y],range:[0,m]})},[d,m]),g=Oe.useMemo(()=>{let x=d.length>0?Math.max(0,...d.map(y=>y.yValue)):1;return scale.scaleLinear({domain:s??[0,x],range:[o-u.bottom,u.top]})},[d,o,s,u.top,u.bottom]),f=x=>{if(l.current)return;if(!x){n(null);return}let{x0:y,x1:v}=x;if(y===v)return;let S=new Date(y),w=new Date(v);if(!(Number.isNaN(S.getTime())||Number.isNaN(w.getTime()))){if(d.length>0){let N=Math.min(...d.map(E=>E.xValue.getTime())),M=Math.max(...d.map(E=>E.xValue.getTime())),T=(M-N)*.05;if(Math.abs(S.getTime()-N)<T&&Math.abs(w.getTime()-M)<T){n(null);return}}n([S,w]);}},h=Oe.useMemo(()=>{if(d.length!==0)return {start:{x:0,y:u.top},end:{x:m,y:o-u.bottom}}},[m,o,d]);Oe.useEffect(()=>{if(!c.current||d.length===0)return;let x=c.current.state;if(x?.isBrushing||x?.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),w=a?a[1]:new Date(v),N=c.current.state?.extent;if(N){let k=p.invert(N.x0),T=p.invert(N.x1),A=Math.abs(k.getTime()-S.getTime()),E=Math.abs(T.getTime()-w.getTime());if(A<1e3&&E<1e3)return}l.current=true;let M=k=>{let T=c.current.getExtent({x:p(S),y:u.top},{x:p(w),y:o-u.bottom});return {...k,start:{y:T.y0,x:T.x0},end:{y:T.y1,x:T.x1},extent:T}};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 jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsxs("svg",{width:r,height:o,children:[jsxRuntime.jsx(pattern.PatternLines,{id:"brush_pattern",height:8,width:8,stroke:"var(--color-text-secondary)",strokeWidth:1,orientation:["diagonal"]}),jsxRuntime.jsxs("g",{transform:`translate(${u.left}, 0)`,children:[e.map((x,y)=>jsxRuntime.jsx(shape.LinePath,{data:x,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}`)),jsxRuntime.jsx(brush.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:h,onChange:f,onClick:()=>n(null),selectedBoxStyle:b,useWindowMoveEvents:true})]})]})})};function yo(e){switch(e){case "command":return Pt("--color-action-brand","#111111");case "success":return Pt("--color-feedback-success-border","#278a4a");case "warning":return Pt("--color-feedback-warning-border","#c88420");case "error":return Pt("--color-feedback-error-border","#c42d2d");case "alert":return Pt("--color-feedback-warning-border","#c88420");default:return Pt("--color-text-secondary","#525250")}}function Js({events:e,color:t,showLabels:r=false}){let o=Oe.useContext(Rr),[n,a]=Oe.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 x=i(b.timestamp);return x>=Ie.left&&x<=i.range()[1]}),f=Oe.useCallback((b,x)=>{a(x);let y=i(b.timestamp),v=y>(i.range()[1]-Ie.right-Ie.left)/2+Ie.left,S=[];d&&u&&d.forEach((M,k)=>{if(M.length===0)return;let T=d3Array.bisector(H=>H.xValue).left,A=T(M,b.timestamp),E=M[A-1],D=M[A],R;if(!E)R=D;else if(!D)R=E;else {let H=Math.abs(b.timestamp.getTime()-E.xValue.getTime()),G=Math.abs(b.timestamp.getTime()-D.xValue.getTime());R=H<G?E:D;}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 N=g.filter(M=>Math.abs(i(M.timestamp)-y)<=10).map(M=>({label:M.label,color:t||yo(M.type),metadata:M.metadata}));S.push({label:N.length>1?`${N.length} events`:b.label,value:0,color:t||yo(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:N});},[i,s,c,l,t,d,u,m,p,g]),h=Oe.useCallback(()=>{a(null),l.hide();},[l]);return g.length===0?null:jsxRuntime.jsx("g",{className:"chart-event-markers","data-testid":"chart-event-markers",children:g.map((b,x)=>{let y=i(b.timestamp),v=t||yo(b.type),S=n===x;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:y,y1:Ie.top,x2:y,y2:c-Ie.bottom,stroke:v,strokeWidth:S?3:2,strokeDasharray:"4 4",strokeOpacity:S?.9:.6,pointerEvents:"none"}),jsxRuntime.jsx("circle",{cx:y,cy:Ie.top,r:S?5:4,fill:v,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),jsxRuntime.jsx("circle",{cx:y,cy:c-Ie.bottom,r:S?5:4,fill:v,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),r&&jsxRuntime.jsx("text",{x:y,y:Ie.top-8,textAnchor:"middle",fill:"var(--color-text-secondary)",fontSize:11,fontWeight:500,pointerEvents:"none",children:b.label}),jsxRuntime.jsx("rect",{x:y-10,y:Ie.top,width:20,height:c-Ie.top-Ie.bottom,fill:"transparent",style:{cursor:"pointer"},onMouseEnter:()=>f(b,x),onMouseLeave:h})]},`${b.timestamp.getTime()}-${x}`)})})}function Xs({spans:e,opacity:t=.25,color:r}){let o=Oe.useContext(Rr),[n,a]=Oe.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=Oe.useCallback((S,w)=>{if(!i||!c)return;a(w);let N=S.start<l?l:S.start,M=S.end>d?d:S.end,k=(i(N)+i(M))/2,T=k>(m-u)/2+u,E=e.filter(D=>D.end>D.start&&D.start<S.end&&D.end>S.start).map(D=>({label:D.label,color:D.color??r??yo(D.type),metadata:D.metadata}));c.show({xValue:S.start,series:[{label:E.length>1?`${E.length} scheduled commands`:S.label,value:0,color:S.color??r??yo(S.type),type:"event"}],x:k,y:(s??0)/2,position:T?"left":"right",isEvent:true,eventMetadata:S.metadata,eventItems:E});},[i,s,c,r,l,d,u,m,e]),g=Oe.useCallback(()=>{a(null),c?.hide();},[c]);if(!o)return console.warn("ChartEventSpans must be used within a ChartContainer"),null;let{xScale:f,height:h}=o,b=Ie.top,y=h-Ie.bottom-b,v=e.filter(S=>S.end>S.start);return v.length===0?null:jsxRuntime.jsx("g",{className:"chart-event-spans","data-testid":"chart-event-spans",children:v.map((S,w)=>{let N=S.start<l?l:S.start,M=S.end>d?d:S.end;if(N>=d||M<=l)return null;let k=f(N),A=f(M)-k;if(A<=0)return null;let E=S.color??r??yo(S.type);return jsxRuntime.jsx("rect",{x:k,y:b,width:A,height:y,fill:E,fillOpacity:n===w?Math.min((t??.25)*1.8,1):t??.25,pointerEvents:"all",style:{cursor:"pointer"},onMouseEnter:()=>p(S,w),onMouseLeave:g},`${S.start.getTime()}-${S.end.getTime()}-${w}`)})})}var Pn=({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}=Tn(),d=c.range(),u=Object.keys(n).length>0,m=y=>y.category?n[y.category]??t:t,p=y=>y.chartYValue??y.yValue,g=e.length===1?e[0]:void 0,f=a!=null?zs(e,a):e,h=i?void 0:"non-scaling-stroke",b=g?jsxRuntime.jsx("circle",{cx:s(g.xValue),cy:c(p(g)),r,fill:u?m(g):t}):u?e.slice(0,-1).map((y,v)=>{let S=e[v+1];return a!=null&&a>0&&S.xValue.getTime()-y.xValue.getTime()>a?null:jsxRuntime.jsx(shape.LinePath,{data:[y,S],x:w=>s(w.xValue),y:w=>c(p(w)),stroke:m(y),strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",vectorEffect:h,curve:curve.curveLinear},`${y.xValue.getTime()}-${S.xValue.getTime()}`)}):jsxRuntime.jsx(shape.LinePath,{data:f,x:y=>y?s(y.xValue):0,y:y=>y?c(p(y)):0,defined:y=>y!=null,stroke:t,strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",vectorEffect:h,curve:curve.curveLinear}),x={transformOrigin:`0 ${d[0]}px`,transformBox:"fill-box",isolation:"isolate"};return i?jsxRuntime.jsx(framerMotion.motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:l.duration,ease:l.ease},style:x,children:b}):jsxRuntime.jsx("g",{style:x,children:b})};var Hg=e=>e.type===Jo||e.type===Pn||e.type===Hs,Fk=e=>e.type===Js||e.type===Xs,Bk=(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},Vk=d3Array.bisector(e=>e.xValue).left,zk=()=>jsxRuntime.jsx("div",{className:"flex h-full items-center justify-center",children:jsxRuntime.jsx("p",{className:"text-text-secondary",children:"No data available"})}),Ok=()=>jsxRuntime.jsxs("div",{className:"flex h-full flex-col gap-4 p-4",children:[jsxRuntime.jsx(J,{className:"h-full w-full"}),jsxRuntime.jsxs("div",{className:"flex gap-4",children:[jsxRuntime.jsx(J,{className:"h-4 w-24"}),jsxRuntime.jsx(J,{className:"h-4 w-24"})]})]}),Hk=({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,hideBottomBar:p=false,children:g})=>{let f=u!==void 0,h=d!==void 0,[b,x]=Oe.useState(null),[y,v]=Oe.useState(null),S=h?d:y,[w,N]=Oe.useState(()=>new Set),M=f?u:w,k=Oe.useRef(null),T=Oe.useId(),A=Oe.useRef(0),E=Oe.useRef(""),D=Oe.useRef(null),{colorMode:R}=Vt(),H=Oe.useMemo(()=>cn(),[R]),G=Oe.useMemo(()=>qa(),[R]),{datasets:K,seriesMetadata:W,categoryInfo:q,categoryColors:j,categoryLabels:Q,seriesTypes:O}=Oe.useMemo(()=>{let pe=Oe.Children.toArray(g).filter(De=>Oe.isValidElement(De)&&Hg(De)),Fe=pe.filter(De=>De.props.data).length,Ne=[],Ve=[],tt=[],mt=null,Ae=null;pe.forEach((De,St)=>{let Pe=De.props;if(!Pe.data)return;Ne.push(Pe.data);let na=("color"in Pe&&Pe.color?Pe.color:void 0)||(Fe===1?G:H[St%H.length]),sn=De.type===Jo;Ve.push({label:"label"in Pe&&Pe.label||`Series ${Ne.length}`,color:na,...sn&&"baseline"in Pe&&Pe.baseline!==void 0?{baseline:Pe.baseline,tooltipRange:"tooltipRange"in Pe&&Pe.tooltipRange||false}:{}});let wc=sn?"area":De.type===Pn?"line":"bar";tt.push(wc),"categoryColors"in Pe&&Pe.categoryColors&&(mt=Pe.categoryColors),"categoryLabels"in Pe&&Pe.categoryLabels&&(Ae=Pe.categoryLabels);});let ft=null;if(mt){let De=new Set;Ne.forEach(St=>{St.forEach(Pe=>{Pe.category&&De.add(Pe.category);});}),ft=Array.from(De).map(St=>({label:Ae?.[St]||St,color:mt[St]||"#6b7280"}));}return {datasets:Ne,seriesMetadata:Ve,categoryInfo:ft,categoryColors:mt,categoryLabels:Ae,seriesTypes:tt}},[g,G,H,R]),L=e,Y=p?0:60,P=s?c+8:0,C=t-Y-P,I=Math.max(100,C),F=Oe.useCallback(X=>X?M.has(X):false,[M]),U=Oe.useMemo(()=>W.map((X,pe)=>F(X.label)?null:pe).filter(X=>X!==null),[W,F]),$=Oe.useMemo(()=>U.map(X=>K[X]).filter(X=>!!X),[K,U]),ae=Oe.useMemo(()=>U.map(X=>W[X]).filter(X=>!!X),[W,U]),Z=Oe.useMemo(()=>U.map(X=>O[X]).filter(X=>!!X),[O,U]),ie=Z.findIndex(X=>X==="bar"),fe=ie!==-1,re=Oe.useCallback((X,pe)=>{let Fe=X.has(pe);if(!Fe&&W.reduce((tt,mt)=>X.has(mt.label)||mt.label===pe?tt:tt+1,0)<1)return X;let Ne=new Set(X);return Fe?Ne.delete(pe):Ne.add(pe),Ne},[W]),de=Oe.useCallback(X=>{if(f){let pe=u;if(!pe.has(X)&&W.reduce((Ve,tt)=>pe.has(tt.label)||tt.label===X?Ve:Ve+1,0)<1){x(null);return}m?.(Ne=>re(Ne,X));}else N(pe=>re(pe,X));x(null);},[f,u,m,W,re]),xe=Oe.useMemo(()=>W.map(X=>X.label).join(""),[W]),he=Oe.useRef(xe);Oe.useEffect(()=>{he.current!==xe&&(he.current=xe,f||N(X=>X.size===0?X:new Set));},[xe,f]);let Ee=Oe.useMemo(()=>$.flat(),[$]),$e=Oe.useMemo(()=>{if(Ee.length===0)return null;let X=[...Ee].sort((pe,Fe)=>pe.xValue.getTime()-Fe.xValue.getTime());return [X[0].xValue,X[X.length-1].xValue]},[Ee]),lr=S||$e,ee=Oe.useCallback(X=>{h?l?.(X):v(X);},[h,l]),te=Oe.useMemo(()=>lr?K.map(pe=>pe.filter(Fe=>Fe.xValue>=lr[0]&&Fe.xValue<=lr[1])):K,[K,lr]),ne=Oe.useMemo(()=>U.map(X=>te[X]??[]),[U,te]);Oe.useEffect(()=>{l&&l(S);},[S,l]);let V=Oe.useMemo(()=>U.flatMap(X=>te[X]??[]),[te,U]),z=Oe.useMemo(()=>di(V,I,r,o),[V,I,r,o]),le=Oe.useRef(JSON.stringify(r)),se=Oe.useRef(null),ce=Oe.useMemo(()=>{let[X,pe]=z.domain(),Fe=Math.max(Math.abs(X),Math.abs(pe)),Ne=JSON.stringify(r);if(Ne!==le.current&&(le.current=Ne,se.current=null),se.current!==null)return se.current;if(Fe===0)return Sa(r,0);let Ve=Sa(r,Fe);return se.current=Ve,Ve},[z,r]),We=Oe.useMemo(()=>{let X=I-Ie.top-Ie.bottom;return Na(X)},[I]),ue=Oe.useMemo(()=>{let X=Hr(ce),pe=X.tickFormat||X.format,Ne=z.ticks(We).map(mt=>pe(mt)),Ve=wa(Ne,12,"system-ui"),tt=Math.ceil(Ve)+12;return {...Ie,left:Math.max(tt,30),right:8}},[z,ce,We]),et=Oe.useMemo(()=>lr?scale.scaleTime({domain:lr,range:[ue.left,L-ue.right]}):ru(Ee,L),[lr,Ee,L,ue]),fo=Oe.useCallback(X=>{if(!$e)return;let{scaleX:pe,translateX:Fe}=X,Ne=L-ue.left-ue.right,[Ve,tt]=$e,mt=tt.getTime()-Ve.getTime();if(mt<=0){ee(null);return}let Ae=-Fe,ft=Ae+Ne,De=Ne*pe/mt,St=Ae/De,Pe=ft/De,an=new Date(Ve.getTime()+St),na=new Date(Ve.getTime()+Pe),sn=Math.abs(an.getTime()-Ve.getTime()),wc=Math.abs(na.getTime()-tt.getTime()),zp=mt*.02;sn<zp&&wc<zp?ee(null):ee([an,na]);},[$e,L,ue,ee]),Sr=Oe.useCallback(X=>{let{left:pe}=k.current?.getBoundingClientRect()||{left:0},Fe=X.clientX-pe;if(X.timeStamp-(A.current||0)<16)return;A.current=X.timeStamp;let Ne=et.invert(Fe),Ve=ne.map((Ae,ft)=>{if(!Ae||Ae.length===0)return null;let De=Vk(Ae,Ne,1);if(De===0)return {point:Ae[0],index:0,datasetIndex:ft};if(De>=Ae.length)return {point:Ae[Ae.length-1],index:Ae.length-1,datasetIndex:ft};let St=Ae[De-1],Pe=Ae[De];if(!St||!Pe)return null;let an=Math.abs(St.xValue.getTime()-Ne.getTime()),na=Math.abs(Pe.xValue.getTime()-Ne.getTime()),sn=an<na;return {point:sn?St:Pe,index:sn?De-1:De,datasetIndex:ft}}).filter(Ae=>Ae!==null&&ae[Ae.datasetIndex]!==void 0).map(({point:Ae,index:ft,datasetIndex:De})=>({label:ae[De].label,value:Ae.yValue,baselineValue:Bk(ae[De],Ae,ft),color:ae[De].color,point:Ae,type:Z[De]}));if(Ve.length===0){x(null);return}let tt=et(Ve[0].point.xValue),mt=tt>(L-ue.right-ue.left)/2+ue.left;x({xValue:Ve[0].point.xValue,series:Ve.map(({label:Ae,value:ft,baselineValue:De,color:St,point:Pe,type:an})=>({label:Ae,value:ft,...De!==void 0?{baselineValue:De}:{},chartY:Pe.chartYValue??ft,showMarker:Pe.showTooltipMarker??true,color:St,type:an,category:Pe.category,categoryColor:Pe.category&&j?j[Pe.category]:void 0,...Pe.extraTooltipRows&&Pe.extraTooltipRows.length>0?{extraTooltipRows:Pe.extraTooltipRows}:{}})),x:tt,y:z(Ve[0].point.chartYValue??Ve[0].value),position:mt?"left":"right"});},[ne,ae,Z,et,z,L,j,ue]),vc=()=>{x(null);},Cc=Oe.useCallback(()=>{ee(null),D.current&&D.current.reset();},[ee]),$i=Oe.useCallback(X=>{if(!(D.current&&$e))return;let[pe,Fe]=$e,Ne=Fe.getTime()-pe.getTime();if(Ne<=0){D.current.reset();return}if(!X){D.current.reset();return}let[Ve,tt]=X,mt=tt.getTime()-Ve.getTime();if(mt<=0){D.current.reset();return}let Ae=Ne/mt,ft=L-ue.left-ue.right,St=-((Ve.getTime()-pe.getTime())/Ne)*ft*Ae;D.current.setTransformMatrix({scaleX:Ae,scaleY:1,translateX:St,translateY:0,skewX:0,skewY:0});},[$e,L,ue]),pv=Oe.useCallback(X=>{ee(X),$i(X);},[ee,$i]);Oe.useEffect(()=>{h&&$i(d??null);},[h,d,$i]);let mv={width:L,height:I,xScale:et,yScale:z,yFormatter:ce,animationSettings:Vs,tooltip:{data:b,show:x,hide:()=>x(null)},datasets:ne,seriesMetadata:ae,seriesTypes:Z,categoryColors:j||void 0,categoryLabels:Q||void 0},fv=Oe.Children.toArray(g),Ip=0,Fp=[],Bp=[],Sc=[];fv.forEach(X=>{if(!Oe.isValidElement(X)){Sc.push(X);return}if(Fk(X))Bp.push(X);else if(Hg(X)){let pe=Ip;Ip++;let Fe=X.props,Ne=W[pe]?.label;if(F(Ne))return;Fp.push(Oe__namespace.default.cloneElement(X,{...Fe,data:te[pe]||Fe.data,color:W[pe]?.color}));}else Sc.push(X);});let gv=U.length,bv=(q||W).map(X=>{let pe=!q&&F(X.label);return {category:X.label,fill:X.color,isHidden:pe,isDisabled:!q&&!pe&&gv<=1}}),xv=typeof r=="object"&&r!==null&&typeof r.type=="string",hv=Ks({datasets:$,metadata:{xLabel:"Date",yLabel:"Value",seriesLabels:ae.map(X=>X.label),timestamp:true,...xv?{yFormat:r}:{}},svgRef:k});if(a)return jsxRuntime.jsx(Ok,{});if(K.length===0)return jsxRuntime.jsx(zk,{});let Vp=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("title",{children:"Data chart visualization"}),jsxRuntime.jsx("g",{children:z.ticks(We).map(X=>{let pe=Math.abs(X)<Number.EPSILON;return jsxRuntime.jsx(shape.Line,{from:{x:ue.left,y:z(X)},to:{x:L-ue.right,y:z(X)},stroke:pe?"var(--color-border-default)":"var(--color-border-muted)",strokeWidth:pe?1.5:1},`grid-line-${X}`)})}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("clipPath",{id:T,children:jsxRuntime.jsx("rect",{x:et.range()[0],y:z.range()[1],width:et.range()[1]-et.range()[0],height:z.range()[0]-z.range()[1]})})}),jsxRuntime.jsx("g",{clipPath:`url(#${T})`,children:Fp}),Sc,n&&n.length>0&&jsxRuntime.jsx("g",{children:n.map(X=>{let pe=z(X.value),Fe=X.color??"var(--color-error-base)";return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx(shape.Line,{from:{x:ue.left,y:pe},to:{x:L-ue.right,y:pe},stroke:Fe,strokeWidth:1.5,strokeDasharray:"6 4"}),X.label&&jsxRuntime.jsx("text",{x:L-ue.right-4,y:pe-4,textAnchor:"end",fontSize:11,fill:Fe,children:X.label})]},`ref-line-${X.value}`)})}),jsxRuntime.jsx(Mr.Bottom,{top:I-ue.bottom,scale:et,width:L-ue.left-ue.right}),jsxRuntime.jsx(Mr.Left,{left:ue.left,scale:z,yFormatter:ce,height:I-ue.top-ue.bottom}),b&&!b.isEvent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[fe?(()=>{let X=$[ie]??[];if(X.length===0)return null;let pe=[...X].sort((De,St)=>De.xValue.getTime()-St.xValue.getTime()),Fe=pe.findIndex(De=>De.xValue.getTime()===b.xValue.getTime()),Ne=pe[Fe+1],Ve=pe.length>1&&Ne?Ne.xValue.getTime()-b.xValue.getTime():15*6e4,tt=Math.abs(et(new Date(b.xValue.getTime()+Ve))-et(b.xValue)),Ae=et(b.xValue)-tt/2,ft=z.range();return jsxRuntime.jsx("rect",{x:Ae,y:ft[1],width:tt,height:ft[0]-ft[1],className:"fill-background-muted",opacity:.5,pointerEvents:"none",style:{transition:"all 100ms ease-out"}})})():null,b.series.filter(X=>X.type!=="bar"&&X.showMarker!==false).map(X=>jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:et(b.xValue),cy:z(X.chartY??X.value),r:8,fill:"white",stroke:X.color,strokeWidth:2,style:{transition:"all 100ms ease-out"}}),jsxRuntime.jsx("circle",{cx:et(b.xValue),cy:z(X.chartY??X.value),r:4,fill:X.color,style:{transition:"all 100ms ease-out"}})]},`highlight-${X.label}`))]}),jsxRuntime.jsx("rect",{x:ue.left,y:ue.top,width:L-ue.left-ue.right,height:I-ue.top-ue.bottom,fill:"transparent",style:{cursor:i?"grab":"crosshair",touchAction:"none"},onMouseMove:Sr,onMouseLeave:vc}),Bp]});return jsxRuntime.jsx("div",{className:"relative flex h-full flex-col",children:jsxRuntime.jsxs(Rr.Provider,{value:mv,children:[i?jsxRuntime.jsx(zoom.Zoom,{width:L,height:I,scaleXMin:1,scaleXMax:20,scaleYMin:1,scaleYMax:1,constrain:X=>{let{scaleX:pe,translateX:Fe}=X,Ne=Math.max(1,Math.min(20,pe)),Ve=1,tt=L-ue.left-ue.right,mt=0,Ae=tt*(1-Ne),ft=Math.max(Ae,Math.min(mt,Fe));return {...X,scaleX:Ne,scaleY:Ve,translateX:ft,translateY:0}},children:X=>{if(D.current=X,X.transformMatrix){let{scaleX:pe,translateX:Fe}=X.transformMatrix,Ne=`${pe.toFixed(4)}-${Fe.toFixed(2)}`;Ne!==E.current&&(E.current=Ne,setTimeout(()=>{fo(X.transformMatrix);},0));}return jsxRuntime.jsx("svg",{width:L,height:I,className:"overflow-visible",ref:pe=>{k.current=pe,X.containerRef.current!==pe&&(X.containerRef.current=pe);},role:"img","aria-label":"Data chart",style:{cursor:X.isDragging?"grabbing":"grab",touchAction:"none"},onMouseDown:X.dragStart,onMouseMove:X.dragMove,onMouseUp:X.dragEnd,onMouseLeave:()=>{X.isDragging&&X.dragEnd();},onTouchStart:X.dragStart,onTouchMove:X.dragMove,onTouchEnd:X.dragEnd,children:Vp})}}):jsxRuntime.jsx("svg",{width:L,height:I,className:"overflow-visible",ref:k,role:"img","aria-label":"Data chart",children:Vp}),jsxRuntime.jsx(Xo,{data:b,formatter:ce}),s&&$e&&jsxRuntime.jsx(du,{data:$,seriesMetadata:ae,width:L,height:c,onBrushChange:pv,brushRegion:S,margin:ue,...o?{yDomain:o}:{}}),!p&&jsxRuntime.jsx(Ta,{onExport:hv,items:bv,marginLeft:0,marginRight:ue.right,isZoomed:S!==null,onResetZoom:Cc,onLegendItemToggle:q?void 0:de})]})})},Gg=responsive.withParentSize(Hk);var Jk=e=>e.toLocaleString(),Xk=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=Xk,color:s,showScale:c=true,showOverallConversion:l=true,overallConversionLabel:d="Overall Conversion:",activeStageId:u,onStageClick:m,onStageHover:p,className:g,style:f,"aria-label":h="Funnel chart"})=>{let[b,x]=Oe.useState(null),[y,v]=Oe.useState(t),S=Oe.useRef(null),w=u??b,N=Oe.useId(),M=s||"var(--color-viz-default)";Oe.useEffect(()=>{if(!S.current)return;let R=new ResizeObserver(H=>{for(let G of H)v(G.contentRect.width);});return R.observe(S.current),()=>{R.disconnect();}},[]);let{layout:k,overallConversion:T}=Oe.useMemo(()=>{if(e.length===0)return {layout:[],overallConversion:0};let R=e[0].value,H=l?60:0,G=r-o*2-H,K=(e.length-1)*n,W=(G-K)/e.length,q=e.map((Q,O)=>{let L=o+H+O*(W+n),Y=R===0?0:Q.value/R,P=Y,C=O===0?null:e[O-1].value,I=C==null||C===0?0:1-Q.value/C;return {stage:Q,index:O,y:L,barHeight:W,widthPercent:Y,conversionRate:P,dropOff:I}}),j=R===0?0:e[e.length-1].value/R;return {layout:q,overallConversion:j,maxValue:R}},[e,y,r,o,n,c,l]);if(e.length===0)return jsxRuntime.jsx("div",{className:tailwindMerge.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 A=c?60:0,E=o+A,D=y-o*2-A;return jsxRuntime.jsx("div",{ref:S,className:tailwindMerge.twMerge("relative w-full overflow-hidden rounded-lg bg-background-surface",g),style:{height:r,...f},"aria-label":h,role:"img",children:jsxRuntime.jsxs("svg",{width:"100%",height:r,className:"relative",children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx(gradient.LinearGradient,{id:`${N}-bar`,from:M,to:M,toOpacity:.85}),jsxRuntime.jsx(gradient.LinearGradient,{id:`${N}-bg`,from:M,to:M,fromOpacity:.01,toOpacity:.15,x1:"0",y1:"0",x2:"1",y2:"0"})]}),l&&jsxRuntime.jsxs("text",{x:E,y:o+20,className:"fill-text-primary text-sm font-medium",children:[jsxRuntime.jsx("tspan",{className:"fill-text-secondary",children:d})," ",i(T)]}),c&&jsxRuntime.jsx("g",{children:k.map(R=>{let H=R.y+R.barHeight/2;return jsxRuntime.jsx("text",{x:o+A-12,y:H,textAnchor:"end",dominantBaseline:"middle",className:"fill-text-secondary text-xs",children:i(R.conversionRate)},R.stage.id)})}),k.map(R=>{let H=w===R.stage.id,G=D*R.widthPercent;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:E,y:R.y,width:D,height:R.barHeight,fill:`url(#${N}-bg)`,rx:4}),jsxRuntime.jsx(framerMotion.motion.rect,{x:E,y:R.y,width:G,height:R.barHeight,fill:`url(#${N}-bar)`,rx:4,initial:{width:0},animate:{width:G},transition:{duration:.6,delay:R.index*.1,ease:"easeOut"},opacity:H||w==null?1:.5,style:{cursor:m||p?"pointer":"default",transition:"opacity 150ms ease"},onMouseEnter:()=>{x(R.stage.id),p?.(R.stage);},onMouseLeave:()=>{x(null),p?.(null);},onClick:()=>m?.(R.stage)}),jsxRuntime.jsx("rect",{x:E+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"}}),jsxRuntime.jsx("text",{x:E+16,y:R.y+R.barHeight/2+4,className:"fill-text-primary text-xs font-semibold",style:{pointerEvents:"none"},children:a(R.stage.value)}),jsxRuntime.jsxs("text",{x:E,y:R.y-8,className:"fill-text-secondary text-xs",style:{pointerEvents:"none"},children:[jsxRuntime.jsx("tspan",{children:R.index+1})," ",R.stage.label]}),R.stage.secondaryValue&&jsxRuntime.jsx("text",{x:E+16,y:R.y-24,className:"fill-text-secondary text-xs",style:{pointerEvents:"none"},children:R.stage.secondaryValue}),R.index>0&&R.dropOff>0&&jsxRuntime.jsxs("text",{x:E+D,y:R.y-8,textAnchor:"end",className:"fill-text-secondary text-xs",children:[i(R.dropOff)," drop"]}),R.stage.annotation&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:E+G+8,y:R.y+8,width:60,height:24,rx:3,className:"fill-background-muted"}),jsxRuntime.jsx("text",{x:E+G+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 qk=d3Array.bisector(e=>e.xValue).left,Qk=(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=qk(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 h=p[f-1],b=p[f];if(!h||!b)return null;let x=Math.abs(h.xValue.getTime()-l.getTime()),y=Math.abs(b.xValue.getTime()-l.getTime()),v=x<y;return {point:v?h: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:Qk(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:h,point:b,type:x})=>({label:p,value:g,...f!==void 0?{baselineValue:f}:{},chartY:b.chartYValue??g,showMarker:b.showTooltipMarker??true,color:h,type:x,...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 Zg=e=>e instanceof Date&&!Number.isNaN(e.getTime()),eT=160;function js(e,t,r){let[o,n]=Oe.useState(null);Oe.useImperativeHandle(r,()=>({setPreview:n}),[]);let[a,i]=e.range(),s=Oe.useMemo(()=>o?d3Scale.scaleTime().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=Zg(l)&&Zg(d),m=t<400,p=Math.max(2,Math.min(8,Math.floor(t/(m?70:110)))),g=Oe.useMemo(()=>{if(!u)return [];let f=i-a;if(f<=0)return s.ticks(p);let[h,b]=s.domain(),x=h.getTime(),y=b.getTime(),v=(y-x)/f,S=Math.min(eT,f),w=S*v,N=d3Scale.scaleTime().domain([new Date(x-w),new Date(y+w)]).range([a-S,i+S]),M=d3Time.timeTickInterval(h,b,p);if(M)return N.ticks(M);let k=Math.max(2,Math.round(p*(f+2*S)/f));return N.ticks(k)},[s,p,u,a,i]);return {activeScale:s,ticks:g,start:l,end:d,valid:u,compact:m,rangeStart:a,rangeEnd:i}}var nT=6,_g=20,fu=Oe.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}=js(t,r,o),m=a.length>=2?a[1].getTime()-a[0].getTime():s.getTime()-i.getTime(),p=Oe.useMemo(()=>c?Wm(m,{compact:l}):()=>"",[m,l,c]),g=Oe.useId(),f=Math.min(d,u),h=Math.abs(u-d);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:d,x2:u,y1:e,y2:e,stroke:"var(--color-border-muted)",strokeWidth:1}),a.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("clipPath",{id:g,children:jsxRuntime.jsx("rect",{x:f,y:e-4,width:h,height:_g+16})})}),jsxRuntime.jsx("g",{clipPath:`url(#${g})`,children:a.map(b=>jsxRuntime.jsxs("g",{transform:`translate(${n(b)},${e})`,children:[jsxRuntime.jsx("line",{x1:0,x2:0,y1:0,y2:nT,stroke:"var(--color-border-muted)",strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:_g,textAnchor:"middle",fontSize:12,fill:"var(--color-text-secondary)",children:p(b)})]},b.getTime()))})]})]})});fu.displayName="LiveTimeAxisBottom";var gu=Oe.forwardRef(({scale:e,width:t,top:r,bottom:o},n)=>{let{activeScale:a,ticks:i,rangeStart:s,rangeEnd:c}=js(e,t,n),l=Oe.useId(),d=Math.min(s,c),u=Math.abs(c-s);return jsxRuntime.jsxs("g",{"aria-hidden":"true",children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("clipPath",{id:l,children:jsxRuntime.jsx("rect",{x:d,y:r,width:u,height:o-r})})}),jsxRuntime.jsx("g",{clipPath:`url(#${l})`,children:i.map(m=>{let p=a(m);return jsxRuntime.jsx("line",{x1:p,x2:p,y1:r,y2:o,stroke:"var(--color-border-muted)",strokeWidth:1},m.getTime())})})]})});gu.displayName="LiveTimeGridlines";function qs(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 bu(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=qs(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]},dT=e=>typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(()=>e(0),0),uT=e=>{typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):clearTimeout(e);};function rb(e){let{groupRef:t}=e,r=Oe.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=Oe.useRef(e.onCommit);o.current=e.onCommit;let n=Oe.useRef(e.panBoundsMs);n.current=e.panBoundsMs;let a=Oe.useRef(e.settleMs??140);a.current=e.settleMs??140;let i=Oe.useRef(e.zoomIntent??(E=>E.ctrlKey));i.current=e.zoomIntent??(E=>E.ctrlKey);let s=Oe.useRef(e.onGestureStart);s.current=e.onGestureStart;let c=Oe.useRef(e.onFramePreview);c.current=e.onFramePreview;let l=Oe.useRef(null),d=Oe.useRef({scale:1,cursorFrac:.5,panDxPx:0,timer:null}),u=Oe.useRef(null),m=Oe.useRef(null),p=Oe.useRef(false),g=Oe.useCallback((E,D,R)=>{m.current={translateX:E,scaleX:D,preview:R},u.current==null&&(u.current=dT(()=>{u.current=null;let H=m.current;H!=null&&(t.current?.setAttribute("transform",`translate(${H.translateX},0) scale(${H.scaleX},1)`),c.current?.(H.preview));}));},[t]),f=Oe.useCallback(()=>{u.current!=null&&(uT(u.current),u.current=null),m.current=null,t.current?.removeAttribute("transform"),c.current?.(null);},[t]),h=Oe.useCallback(()=>{p.current||(p.current=true,s.current?.());},[]),b=Oe.useCallback(()=>{p.current=false;},[]),x=Oe.useCallback(()=>{d.current.timer!=null&&(clearTimeout(d.current.timer),d.current.timer=null);},[]),y=Oe.useCallback(()=>{d.current={scale:1,cursorFrac:.5,panDxPx:0,timer:null};},[]),v=Oe.useCallback(()=>{let{xDomain:E,plotWidthPx:D}=r.current,{scale:R,cursorFrac:H,panDxPx:G}=d.current;R===1&&G===0||o.current(tb(eb(E,R,H,G,D),n.current));},[]),S=Oe.useCallback(()=>{d.current.timer!=null&&(x(),v(),y(),f());},[x,v,y,f]),w=Oe.useCallback(E=>{S(),E.currentTarget.setPointerCapture?.(E.pointerId),l.current={startX:E.clientX,dxPx:0},h();},[S,h]),N=Oe.useCallback(E=>{if(!l.current)return;l.current.dxPx=E.clientX-l.current.startX;let{xDomain:D,plotWidthPx:R}=r.current;g(l.current.dxPx,1,qs(D,l.current.dxPx,R));},[g]),M=Oe.useCallback(E=>{if(!l.current)return;let{dxPx:D}=l.current;l.current=null,f(),b(),D!==0&&o.current(tb(qs(r.current.xDomain,D,r.current.plotWidthPx),n.current));},[f,b]),k=Oe.useCallback(()=>{l.current&&(l.current=null,f(),b());},[f,b]),T=Oe.useRef(null),A=Oe.useCallback(E=>{if(T.current?.(),T.current=null,!E)return;let D=R=>{if(l.current)return;let{plotWidthPx:H,plotLeftPx:G}=r.current,K=bu(R.deltaY,R.deltaMode),W=bu(R.deltaX,R.deltaMode),q=i.current(R);if(!q&&W===0)return;if(R.preventDefault(),h(),q){let L=Math.min(1,Math.max(0,(R.clientX-E.getBoundingClientRect().left)/Math.max(1,H)));d.current.scale*=Math.exp(-K/200),d.current.cursorFrac=L;}else d.current.panDxPx-=W;let{scale:j,cursorFrac:Q,panDxPx:O}=d.current;g((G+Q*H)*(1-j)+O,j,eb(r.current.xDomain,j,Q,O,H)),x(),d.current.timer=setTimeout(()=>{v(),y(),f(),b();},a.current);};E.addEventListener("wheel",D,{passive:false}),T.current=()=>E.removeEventListener("wheel",D);},[g,f,x,v,y,h,b]);return Oe.useEffect(()=>()=>{T.current?.(),T.current=null,f(),d.current.timer!=null&&clearTimeout(d.current.timer);},[f]),{onPointerDown:w,onPointerMove:N,onPointerUp:M,onPointerCancel:k,wheelTargetRef:A,gestureActiveRef:p}}var ib=e=>e.type===Jo||e.type===Pn,xT=({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]=Oe.useState(null),p=Oe.useRef(null),g=Oe.useRef(0),f=Oe.useId(),h=Oe.useRef(null),b=Oe.useRef(null),x=Oe.useRef(null),{colorMode:y}=Vt(),v=Oe.useMemo(()=>cn(),[y]),S=Oe.useMemo(()=>qa(),[y]),{datasets:w,seriesMetadata:N,seriesTypes:M}=Oe.useMemo(()=>{let ee=Oe.Children.toArray(e).filter(le=>Oe.isValidElement(le)&&ib(le)),te=ee.filter(le=>le.props.data).length,ne=[],V=[],z=[];return ee.forEach((le,se)=>{let ce=le.props;if(!ce.data)return;ne.push(ce.data);let ue=("color"in ce&&ce.color?ce.color:void 0)||(te===1?S:v[se%v.length]),et=le.type===Jo;V.push({label:"label"in ce&&ce.label||`Series ${ne.length}`,color:ue,...et&&"baseline"in ce&&ce.baseline!==void 0?{baseline:ce.baseline,tooltipRange:"tooltipRange"in ce&&ce.tooltipRange||false}:{}}),z.push(et?"area":"line");}),{datasets:ne,seriesMetadata:V,seriesTypes:z}},[e,S,v]),k=l,T=Math.max(100,d-60),A=Oe.useMemo(()=>[new Date(t.startMs),new Date(t.endMs)],[t.startMs,t.endMs]),E=Oe.useMemo(()=>{let ee=w.flat(),te=ee.filter(ne=>{let V=ne.xValue.getTime();return V>=t.startMs&&V<=t.endMs});return te.length>0?te:ee},[w,t.startMs,t.endMs]),D=Oe.useMemo(()=>{let ee=di(E,T,a,i);if(!i){let[te,ne]=ee.domain();ne>te&&ee.domain([te,ne+(ne-te)*.05]);}return ee},[E,T,a,i]),R=Oe.useRef(JSON.stringify(a)),H=Oe.useRef(null),G=Oe.useMemo(()=>{let[ee,te]=D.domain(),ne=Math.max(Math.abs(ee),Math.abs(te)),V=JSON.stringify(a);if(V!==R.current&&(R.current=V,H.current=null),H.current!==null)return H.current;if(ne===0)return Sa(a,0);let z=Sa(a,ne);return H.current=z,z},[D,a]),K=Oe.useMemo(()=>{let ee=T-Ie.top-Ie.bottom;return Na(ee)},[T]),W=Oe.useMemo(()=>{let ee=Hr(G),te=ee.tickFormat||ee.format,V=D.ticks(K).map(se=>te(se)),z=wa(V,12,"system-ui"),le=Math.ceil(z)+12;return {...Ie,left:Math.max(le,30)}},[D,G,K]),q=Oe.useMemo(()=>scale.scaleTime({domain:A,range:[W.left,k-W.right]}),[A,k,W]),j=Oe.useMemo(()=>[t.startMs,t.endMs],[t.startMs,t.endMs]),Q=Oe.useMemo(()=>r?[r.startMs,r.endMs]:void 0,[r]),O=Oe.useCallback(ee=>{o({startMs:ee[0],endMs:ee[1]});},[o]),L=k-W.left-W.right,Y=Oe.useCallback(()=>m(null),[]),P=Oe.useRef({}),C=Oe.useRef(c);C.current=c;let I=Oe.useCallback(ee=>{b.current?.setPreview(ee),x.current?.setPreview(ee),C.current?.publish(P.current,ee);},[]),{onPointerDown:F,onPointerMove:U,onPointerUp:$,onPointerCancel:ae,wheelTargetRef:Z,gestureActiveRef:ie}=rb({xDomain:j,plotWidthPx:L,plotLeftPx:W.left,groupRef:h,onCommit:O,onGestureStart:Y,onFramePreview:I,...Q?{panBoundsMs:Q}:{}}),fe=Oe.useRef({startMs:t.startMs,endMs:t.endMs,left:0,width:0});fe.current={startMs:t.startMs,endMs:t.endMs,left:W.left,width:L},Oe.useEffect(()=>{if(!c)return;let ee=()=>{h.current?.removeAttribute("transform"),b.current?.setPreview(null),x.current?.setPreview(null);},te=V=>{if(ie.current)return;if(V==null){ee();return}let{startMs:z,endMs:le,left:se,width:ce}=fe.current,We=le-z,ue=V[1]-V[0];if(We<=0||ue<=0||ce<=0)return;let et=We/ue,fo=se*(1-et)+(z-V[0])*ce/ue;h.current?.setAttribute("transform",`translate(${fo},0) scale(${et},1)`),b.current?.setPreview(V),x.current?.setPreview(V);},ne=c.subscribe(P.current,te);return ()=>{ne(),ie.current||ee();}},[c,ie]),Oe.useEffect(()=>{n?.(Math.max(0,k-W.left-W.right));},[k,W,n]);let re=Oe.useCallback(ee=>{if(ie.current)return;let{left:te}=p.current?.getBoundingClientRect()||{left:0},ne=ee.clientX-te;ee.timeStamp-(g.current||0)<16||(g.current=ee.timeStamp,m(jg({mouseX:ne,datasets:w,seriesMetadata:N,seriesTypes:M,xScale:q,yScale:D,plotLeft:W.left,plotRight:k-W.right})));},[w,N,M,q,D,k,W,ie]),de=Oe.useCallback(()=>m(null),[]),xe={width:k,height:T,xScale:q,yScale:D,yFormatter:G,animationSettings:Vs,tooltip:{data:u,show:m,hide:()=>m(null)},datasets:w,seriesMetadata:N,seriesTypes:M},he=0,Ee=[];Oe.Children.toArray(e).forEach(ee=>{if(!Oe.isValidElement(ee)){Ee.push(ee);return}if(ib(ee)){let te=he;he++;let ne=ee.props;Ee.push(Oe__namespace.default.cloneElement(ee,{...ne,color:N[te]?.color,animate:false}));}else Ee.push(ee);});let $e=N.map(ee=>({category:ee.label,fill:ee.color})),Eo=Ks({datasets:w,metadata:{xLabel:"Date",yLabel:"Value",seriesLabels:N.map(ee=>ee.label),timestamp:true},svgRef:p}),lr=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("title",{children:"Data chart visualization"}),jsxRuntime.jsx("g",{children:D.ticks(K).map(ee=>{let te=Math.abs(ee)<Number.EPSILON;return jsxRuntime.jsx(shape.Line,{from:{x:W.left,y:D(ee)},to:{x:k-W.right,y:D(ee)},stroke:te?"var(--color-border-default)":"var(--color-border-muted)",strokeWidth:te?1.5:1},`grid-line-${ee}`)})}),jsxRuntime.jsx(gu,{ref:x,scale:q,width:k-W.left-W.right,top:D.range()[1],bottom:D.range()[0]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("clipPath",{id:f,children:jsxRuntime.jsx("rect",{x:q.range()[0],y:D.range()[1],width:q.range()[1]-q.range()[0],height:D.range()[0]-D.range()[1]})})}),jsxRuntime.jsx("g",{clipPath:`url(#${f})`,children:jsxRuntime.jsx("g",{"data-camera-plot-group":"",ref:h,children:Ee})}),s&&s.length>0&&jsxRuntime.jsx("g",{children:s.map(ee=>{let te=D(ee.value),ne=ee.color??"var(--color-error-base)";return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx(shape.Line,{from:{x:W.left,y:te},to:{x:k-W.right,y:te},stroke:ne,strokeWidth:1.5,strokeDasharray:"6 4"}),ee.label&&jsxRuntime.jsx("text",{x:k-W.right-4,y:te-4,textAnchor:"end",fontSize:11,fill:ne,children:ee.label})]},`ref-line-${ee.value}`)})}),jsxRuntime.jsx(fu,{ref:b,top:T-W.bottom,scale:q,width:k-W.left-W.right}),jsxRuntime.jsx(Mr.Left,{left:W.left,scale:D,yFormatter:G,height:T-W.top-W.bottom}),u&&!u.isEvent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(shape.Line,{"data-testid":"chart-hover-crosshair",from:{x:q(u.xValue),y:D.range()[1]},to:{x:q(u.xValue),y:D.range()[0]},stroke:"var(--color-text-secondary)",strokeWidth:1,strokeDasharray:"3 3",opacity:.7}),u.series.filter(ee=>ee.type!=="bar"&&ee.showMarker!==false).map(ee=>jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:q(u.xValue),cy:D(ee.chartY??ee.value),r:8,fill:"white",stroke:ee.color,strokeWidth:2,style:{transition:"all 100ms ease-out"}}),jsxRuntime.jsx("circle",{cx:q(u.xValue),cy:D(ee.chartY??ee.value),r:4,fill:ee.color,style:{transition:"all 100ms ease-out"}})]},`highlight-${ee.label}`))]}),jsxRuntime.jsx("rect",{"data-camera-surface":"",x:W.left,y:W.top,width:k-W.left-W.right,height:T-W.top-W.bottom,fill:"transparent",style:{cursor:"grab",touchAction:"none"},onMouseMove:re,onMouseLeave:de,onPointerDown:F,onPointerMove:U,onPointerUp:$,onPointerCancel:ae,ref:Z})]});return jsxRuntime.jsx("div",{className:"relative flex h-full flex-col",children:jsxRuntime.jsxs(Rr.Provider,{value:xe,children:[jsxRuntime.jsx("svg",{width:k,height:T,className:"overflow-visible",ref:p,role:"img","aria-label":"Data chart",children:lr}),jsxRuntime.jsx(Xo,{data:u,formatter:G}),jsxRuntime.jsx(Ta,{onExport:Eo,items:$e,marginLeft:0,marginRight:W.right})]})})},Qs=responsive.withParentSize(xT);function Zs(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 hT(e,t){return Math.floor(e/t.tileSpanMs)}function jo(e,t,r){let o=hT(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 rr=(e,t)=>`${e}:${t}`;var lb={erroredTiles:0};function hu(e,t){let r=new Map,o=new Map,n=new Map,a=0;for(let d of e){let u=t.get(rr(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 yT(e,t,r){let o=jo(e,t,0);return o.length===0?false:o.every(n=>{let a=r.get(rr(n.tierId,n.index));return a!=null&&(a.status==="loaded"||a.status==="empty")})}function cb(e,t,r){return jo(e,t,0).some(n=>{let a=r.get(rr(n.tierId,n.index));return a?.status==="loaded"&&(a.data?.line.length??0)>0})}function vT(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 db({viewport:e,targetTier:t,ladder:r,store:o,overscanTiles:n,prev:a}){let i=yT(e,t,o);if(i&&cb(e,t,o)){let c=jo(e,t,n),{line:l,band:d,lines:u,coverage:m}=hu(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(cb(e,l,o)){let d=jo(e,l,n),{line:u,band:m,lines:p,coverage:g}=hu(d,o);return {line:u,band:m,lines:p,renderTier:l,targetTier:t,isFallback:true,isStale:false,coverage:g}}}if(i){let c=jo(e,t,n),{line:l,band:d,lines:u,coverage:m}=hu(c,o);return {line:l,band:d,lines:u,renderTier:t,targetTier:t,isFallback:false,isStale:false,coverage:m}}return a?vT(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:lb}:{line:[],band:[],lines:{},renderTier:null,targetTier:t,isFallback:false,isStale:false,coverage:lb}}var ub=new Map;function pb(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 fb({refs:e,refsKey:t,store:r,tier:o,viewport:n,fetchTile:a,dispatch:i,concurrency:s,maxFutureMs:c}){let l=Oe.useRef(e);l.current=e;let d=Oe.useRef(n);d.current=n;let u=Oe.useRef(new Map),m=Oe.useCallback(()=>{for(let p of u.current.values())p.ac.abort();u.current.clear();},[]);return Oe.useEffect(()=>{for(let[b,x]of u.current)x.tierId!==o.id&&(x.ac.abort(),u.current.delete(b));let p=l.current.filter(b=>{let x=rr(b.tierId,b.index),y=r.get(x);return y?y.status==="loading"&&!u.current.has(x):true}),g=(d.current.startMs+d.current.endMs)/2;p.sort((b,x)=>Math.abs((b.startMs+b.endMs)/2-g)-Math.abs((x.startMs+x.endMs)/2-g));let f=Math.max(0,s-u.current.size),h=p.slice(0,f);if(h.length!==0){i({type:"request",ids:h.map(b=>rr(b.tierId,b.index))});for(let b of h){let x=rr(b.tierId,b.index),y=new AbortController;u.current.set(x,{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:x,data:S});}).catch(S=>{if(!y.signal.aborted){let w=S instanceof Error?S.message:String(S);i({type:"failed",id:x,error:new Error(`tile fetch failed (tile ${x}, tier ${o.id}): ${w}`)});}}).finally(()=>{u.current.delete(x);});}}},[t,r,a,o,i,s,c]),Oe.useEffect(()=>m,[m]),{abortAll:m}}var xb=1.3,wT=25e4,NT=3;function kT(e,t,r){let o=t.tileSpanMs/t.bucketMs,n=Math.max(1,Math.floor(wT/o/r));return Math.min(Math.max(1,Math.ceil(.5*e/t.tileSpanMs)),n)}function yb(e){let{fetchTile:t,ladder:r,nativeMs:o,viewport:n,widthPx:a,maxFutureMs:i,targetPointsPerPx:s=1,concurrency:c=3,tileCostSeriesCount:l=NT,resetKey:d}=e,u=Oe.useMemo(()=>({targetPointsPerPx:s,nativeMs:o}),[s,o]),[m,p]=Oe.useState(()=>Zs(n.endMs-n.startMs,Math.max(1,a),r,u)),[g,f]=Oe.useReducer(pb,ub),h=Oe.useRef(n.endMs-n.startMs),b=Oe.useRef(u);Oe.useEffect(()=>{let G=n.endMs-n.startMs,K=Zs(G,Math.max(1,a),r,u);if(K.id===m.id){b.current=u;return}let q=Zs(G,Math.max(1,a),r,b.current).id!==K.id,j=G/h.current;(q||j>xb||j<1/xb)&&(h.current=G,b.current=u,p(K));},[n,a,r,m.id,u]);let x=n.endMs-n.startMs,y=Oe.useMemo(()=>kT(x,m,l),[x,m,l]),v=Oe.useMemo(()=>jo(n,m,y),[n,m,y]),S=Oe.useMemo(()=>v.map(G=>rr(G.tierId,G.index)).join(","),[v]),w=Oe.useRef(v);w.current=v;let N=Oe.useRef(n);N.current=n;let M=Oe.useRef(g);M.current=g;let{abortAll:k}=fb({refs:v,refsKey:S,store:g,tier:m,viewport:n,fetchTile:t,dispatch:f,concurrency:c,...i!=null?{maxFutureMs:i}:{}}),T=Oe.useRef(null),A=Oe.useRef(false);Oe.useEffect(()=>{if(!A.current){A.current=true;return}k(),T.current=null,f({type:"reset"});},[k,d]);let E=Oe.useMemo(()=>w.current.map(G=>`${rr(G.tierId,G.index)}:${g.get(rr(G.tierId,G.index))?.status??"\u2205"}`).join("|"),[S,g]),D=Oe.useMemo(()=>{let G=db({viewport:N.current,targetTier:m,ladder:r,store:M.current,overscanTiles:y,prev:T.current});return T.current=G,G},[E,m,r,y,n.startMs,n.endMs]),R=Oe.useMemo(()=>w.current.some(G=>M.current.get(rr(G.tierId,G.index))?.status==="loading"),[E]),H=Oe.useMemo(()=>{let G=w.current[0];return G?M.current.get(rr(G.tierId,G.index))?.status==="empty":false},[E]);return {tier:m,series:D,loading:R,atDataStart:H}}function vu(e){let{initialViewport:t,...r}=e,[o,n]=Oe.useState(t),a=yb({...r,viewport:o}),i=Oe.useCallback(c=>n(c),[]),s=Oe.useCallback(c=>n(c),[]);return {viewport:o,onViewportChange:i,jumpTo:s,...a}}var TT={sm:"gap-4 px-6 py-8",md:"gap-5 px-8 py-12",lg:"gap-6 px-10 py-16"},PT={sm:"xs",md:"sm",lg:"md"},RT={sm:gt("bodySm"),md:gt("bodySm"),lg:gt("bodyMd")},MT={sm:"h-10 w-10",md:"h-12 w-12",lg:"h-16 w-16"},ET={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 _s({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?jsxRuntime.jsx("div",{className:"empty-state-actions mt-2 flex flex-wrap items-center gap-3",children:a}):o||n?jsxRuntime.jsxs("div",{className:"empty-state-actions mt-2 flex flex-col gap-3",children:[o&&(o.href?jsxRuntime.jsx(_,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,href:o.href,children:o.label}):jsxRuntime.jsx(_,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,children:o.label})),n&&jsxRuntime.jsx(Ze,{href:n.href||"#",variant:"muted",onPress:n.onPress,className:gt("labelMd"),children:n.label})]}):null;return jsxRuntime.jsxs("section",{"data-testid":"empty-state",role:"status","aria-live":"polite",className:tailwindMerge.twMerge("flex w-full flex-col rounded-xl text-text-primary",TT[i],DT[s],d?"h-full justify-center":"",p?"relative overflow-hidden":"",u),style:g,children:[e&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex items-center justify-center rounded-full border border-border-muted bg-background-muted text-text-secondary",MT[i]),children:jsxRuntime.jsx(B,{name:e,size:ET[i]})}),jsxRuntime.jsx(Qt,{size:PT[i],tag:"h2",className:"text-text-secondary",children:t}),r&&jsxRuntime.jsx("p",{className:tailwindMerge.twMerge("max-w-xs text-text-secondary whitespace-pre-line",RT[i]),children:r}),f()]})}var AT=[{id:"5y",label:"5 years",days:1825},{id:"year",label:"Year",days:365},{id:"month",label:"Month",days:30},{id:"week",label:"Week",days:7},{id:"day",label:"24h",days:1}];function $s(e=Date.now){return AT.map(({id:t,label:r,days:o})=>({id:t,label:r,getRange:()=>{let n=e();return {after:new Date(n-o*864e5),before:new Date(n)}}}))}function OT({selectionState:e,isDisabled:t}){let r=`${Je} 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 Ma({errorMessage:e,...t}){return jsxRuntime.jsxs(reactAriaComponents.RangeCalendar,{...t,children:[jsxRuntime.jsx(Ls,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"w-full border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(As,{}),jsxRuntime.jsx(reactAriaComponents.CalendarGridBody,{children:r=>jsxRuntime.jsx(reactAriaComponents.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})=>jsxRuntime.jsx("span",{className:OT({selectionState:n&&(a||i)?"cap":n?"middle":"none",isDisabled:c}),children:o})})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function Sb(e){return e==="brand"?"primary":e==="default"||e==="secondary"||!e?"subtle":e}var WT={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"},GT={sm:14,md:16,lg:18,xl:20},UT=({isSelected:e,isFirst:t,isLast:r,isDisabled:o,variant:n="subtle"})=>{let a=Sb(n),i=a==="primary"?"focus-visible:outline-action-primary":"focus-visible:outline-[color:var(--color-action-secondary-text)]";return a==="subtle"?tailwindMerge.twMerge(Je(),"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"):tailwindMerge.twMerge(Je(),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 tl({options:e,value:t,onChange:r,size:o="md",className:n,isDisabled:a,variant:i="subtle",iconOnly:s=false,"aria-label":c}){return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("inline-flex overflow-hidden rounded-[var(--control-border-radius)]",Sb(i)==="subtle"?"border border-border-muted":"border-2 border-border-muted",WT[o],n),role:"group","aria-label":c,children:e.map((l,d)=>{let u=s&&!!l.icon;return jsxRuntime.jsxs(reactAriaComponents.ToggleButton,{isSelected:t===l.id,onChange:()=>r(l.id),className:UT({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&&jsxRuntime.jsx(B,{name:l.icon,size:GT[o]}),u?jsxRuntime.jsx("span",{className:"sr-only",children:l.label}):jsxRuntime.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 XT(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Nu(e){return XT(e)?e:(console.warn("Invalid date detected in TimeControls, using fallback:",e),new Date)}var Rb=120*1e3,jT=.02,Mb={FIVE_MINUTES:0,FIFTEEN_MINUTES:1,HOUR:2,DAY:3,WEEK:4,MONTH:5,YEAR:6},qT=[{id:"FIFTEEN_MINUTES",label:"15m"},{id:"HOUR",label:"1h"},{id:"DAY",label:"1d"},{id:"WEEK",label:"1w"}];function rl({dateRange:e,onDateRangeChange:t,windowSize:r,onWindowSizeChange:o,showWindowSize:n=true,showRangeSelector:a=true,allowDatePicker:i=false,lockWindowSize:s=false,showReset:c=true,restrictToSingleDay:l=false,presetRanges:d=[],windowSizeOptions:u=qT,autoAdjustWindowSize:m=false,className:p}){let[g,f]=Oe.useState(0),h=Oe.useRef(null),[b,x]=Oe.useState(false),[y,v]=Oe.useState(null),S=P=>{let I=(P.before.getTime()-P.after.getTime())/(1e3*60*60);return I<=24?"FIFTEEN_MINUTES":I<=72||I<=168?"HOUR":("DAY")};Oe.useEffect(()=>{if(m&&!b&&o){let P=S(e);o(P);}},[e,m,b,o]);let w=P=>{let C;for(let I of d){let F=I.getRange(),U=(F.before.getTime()-F.after.getTime())*jT,$=Math.abs(F.after.getTime()-P.after.getTime()),ae=Math.abs(F.before.getTime()-P.before.getTime());if($>U||ae>U)continue;let Z=$+ae;(!C||Z<C.distance)&&(C={id:I.id,distance:Z});}return C?.id},N=y&&d.some(P=>P.id===y.id)&&Math.abs(y.after-e.after.getTime())<=Rb&&Math.abs(y.before-e.before.getTime())<=Rb?y.id:w(e),M=Nu(e.after),k=Nu(e.before),T=new Date(k.getTime()-1),A={start:date.fromDate(M,date.getLocalTimeZone()),end:date.fromDate(T,date.getLocalTimeZone())};Oe.useEffect(()=>{let P=new ResizeObserver(C=>{for(let I of C)f(I.contentRect.width);});return h.current&&P.observe(h.current),()=>{h.current&&P.unobserve(h.current);}},[]);let E=[...u].sort((P,C)=>Mb[P.id]-Mb[C.id]),D=P=>{let C=P.toString(),I=d.find(F=>F.id===C);if(I){let F=I.getRange();v({id:C,after:F.after.getTime(),before:F.before.getTime()}),x(false),t(F,{presetId:C});}},R=P=>{if(P?.start&&P?.end){v(null);let C=new Date(P.start.year,P.start.month-1,P.start.day,0,0,0,0),I=new Date(P.end.year,P.end.month-1,P.end.day+1,0,0,0,0);t({after:C,before:I});}},H=P=>{if(P){v(null);let C=new Date(P.year,P.month-1,P.day,0,0,0,0),I=new Date(P.year,P.month-1,P.day+1,0,0,0,0);t({after:C,before:I});}},G=P=>{o&&(x(true),o(P.toString()));},K=()=>{d.length>0&&D(d[0].id);},W=P=>Nu(P).toLocaleDateString("en-US"),q=E.map(P=>({id:P.id,label:P.label,value:P.id})),j=d.map(P=>({id:P.id,label:P.label,value:P.id})),Q=s?jsxRuntime.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:E.find(P=>P.id===r)?.label||r}):jsxRuntime.jsx(bo,{className:"w-full md:w-auto",selectedKey:r,onSelectionChange:G,items:q,size:"md","aria-label":"Select Window Size",children:P=>jsxRuntime.jsx(_t,{id:P.id,"aria-label":P.label,size:"md",children:P.label},P.id)}),O=c&&!N&&d.length>0,L=l?jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{children:[jsxRuntime.jsxs(_,{className:"border-l pl-2 pr-2 hover:border-border-default hover:bg-background-muted hover:text-text-link-hover",variant:"secondary",children:[jsxRuntime.jsx(B,{name:"CalendarBlank",size:18}),jsxRuntime.jsx("span",{className:"ml-2 hidden md:block",children:W(e.after)})]}),jsxRuntime.jsx(lt,{className:"w-auto p-3",disableGroup:true,children:jsxRuntime.jsx(ha,{"aria-label":"Select date",value:date.parseDate(M.toISOString().split("T")[0]),onChange:H})})]})}):jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{children:[jsxRuntime.jsxs(_,{className:tailwindMerge.twMerge("border-l pl-2 pr-2 hover:border-border-default hover:bg-background-muted hover:text-text-link-hover",O&&"rounded-r-none"),variant:"secondary",children:[jsxRuntime.jsx(B,{name:"CalendarBlank",size:18}),!N&&jsxRuntime.jsx("span",{className:"ml-2 hidden md:block",children:`${W(e.after)} - ${W(T)}`})]}),jsxRuntime.jsx(lt,{className:"w-auto p-3",disableGroup:true,children:jsxRuntime.jsx(Ma,{"aria-label":"Date range calendar",value:A,onChange:R})})]}),O&&jsxRuntime.jsx(_,{variant:"ghost",size:"md",onPress:K,children:"Reset"})]}),Y=g<600;return jsxRuntime.jsx("div",{ref:h,className:tailwindMerge.twMerge("flex w-full flex-wrap items-center justify-between gap-4",p),children:Y?jsxRuntime.jsxs("div",{className:"flex w-full justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[i&&L,a&&d.length>0&&jsxRuntime.jsx(bo,{selectedKey:N??"",onSelectionChange:D,items:j,size:"md","aria-label":"Select Date Range",children:P=>jsxRuntime.jsx(_t,{id:P.id,size:"md",children:P.label},P.id)})]}),jsxRuntime.jsx("div",{className:"flex items-center",children:n&&r&&Q})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[i&&L,a&&d.length>0&&jsxRuntime.jsx(tl,{options:d.map(P=>({id:P.id,label:P.label})),value:N??"",onChange:D,size:"sm",variant:"secondary","aria-label":"Select Date Range"})]}),jsxRuntime.jsx("div",{className:"flex items-center",children:n&&r&&Q})]})})}var e1=1440*60*1e3,t1=6e4,Eb=(e,t)=>({startMs:t-e*e1,endMs:t}),r1=e=>({after:new Date(e.startMs),before:new Date(e.endMs)});function Db({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]=Oe.useState(900),h=m?.endMs,[b,x]=Oe.useState(()=>h??Date.now());Oe.useEffect(()=>{if(h!=null){x(h);return}x(Date.now());let fe=setInterval(()=>x(Date.now()),t1);return ()=>clearInterval(fe)},[h]);let y=r?.getTime()??h,v=t?.days??30,S=Oe.useMemo(()=>Eb(v,y??Date.now()),[v,y]),w=b,N=Oe.useMemo(()=>({startMs:m?.startMs??0,endMs:b}),[m?.startMs,b]),M=fe=>{let re=Math.min(fe.endMs-fe.startMs,N.endMs-N.startMs),de=Math.max(Math.min(fe.endMs,N.endMs),N.startMs+re);return {startMs:de-re,endMs:de}},[k,T]=Oe.useState(null),[A,E]=Oe.useState(null),D=k??S,R=vu({fetchTile:e.fetchTile,ladder:e.ladder,nativeMs:e.nativeMs,initialViewport:S,widthPx:g,maxFutureMs:w,tileCostSeriesCount:e.tileCostSeriesCount,resetKey:e.resetKey}),H=Oe.useMemo(()=>$s(()=>y??Date.now()),[y]),G=s??H,K=()=>{if(A&&"presetId"in A){let fe=G.find(re=>re.id===A.presetId);if(fe){let re=fe.getRange();return {startMs:re.after.getTime(),endMs:re.before.getTime()}}}return A&&"range"in A?A.range:Eb(v,y??Date.now())},{line:W,coverage:q,renderTier:j,targetTier:Q,isFallback:O,isStale:L}=R.series,Y=j?j.bucketMs*1.5:0,P=fe=>fe==null?"\u2014":new Date(fe).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),C=(fe,re)=>{let de=re-fe<1728e5?{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"short",day:"numeric",year:"numeric"},xe=new Intl.DateTimeFormat("en-US",de);return `${xe.format(new Date(fe))} \u2013 ${xe.format(new Date(re))}`},I=R.viewport.startMs!==D.startMs||R.viewport.endMs!==D.endMs,F=L||R.loading&&q.earliestMs==null,U=(R.viewport.endMs-R.viewport.startMs)*.03,$=!F&&q.earliestMs!=null&&q.earliestMs>R.viewport.startMs+U,ae=!R.loading&&q.earliestMs==null&&q.latestMs==null&&W.length===0&&!L,Z=p({series:R.series,gapMs:Y}),ie=Oe.isValidElement(Z)&&Z.type===Oe.Fragment?Z.props.children:Z;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-3",children:[jsxRuntime.jsx(rl,{dateRange:r1(R.viewport),onDateRangeChange:(fe,re)=>{let de=M({startMs:fe.after.getTime(),endMs:fe.before.getTime()});E(re?.presetId?{presetId:re.presetId}:{range:de}),T(de),R.jumpTo(de);},windowSize:c[Q.id],windowSizeOptions:l,lockWindowSize:true,presetRanges:G,allowDatePicker:true,showReset:false}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-secondary",children:[jsxRuntime.jsxs("span",{children:["Window"," ",jsxRuntime.jsx("span",{className:"font-medium text-text-primary",children:C(R.viewport.startMs,R.viewport.endMs)})]}),jsxRuntime.jsx("span",{className:"text-text-tertiary",children:"\u2022"}),jsxRuntime.jsxs("span",{children:["Resolution ",jsxRuntime.jsx("span",{className:"font-medium text-text-primary",children:j?.id??Q.id}),O&&jsxRuntime.jsxs("span",{className:"text-text-tertiary",children:[" \xB7 loading ",Q.id]})]}),R.loading&&jsxRuntime.jsx("span",{className:"text-text-tertiary",children:"loading\u2026"}),$&&jsxRuntime.jsxs("span",{className:"text-text-tertiary",children:["showing available history from ",P(q.earliestMs)]}),!$&&!F&&R.atDataStart&&jsxRuntime.jsx("span",{className:"text-text-tertiary",children:"no earlier data loaded"}),I&&jsxRuntime.jsx(_,{variant:"ghost",size:"sm",onPress:()=>{let fe=M(K());T(fe),R.jumpTo(fe);},children:"\u27F2 Reset"})]}),jsxRuntime.jsx("div",{className:"relative overflow-hidden rounded-md border border-border-subtle",style:{height:d},children:ae?jsxRuntime.jsx(_s,{title:i.title,description:i.description}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Qs,{viewport:R.viewport,panBounds:N,onViewportChange:R.onViewportChange,onPlotWidthChange:f,...o&&{yFormatter:o},...n&&{yDomain:n},...a&&{referenceLines:a},children:ie}),R.loading&&jsxRuntime.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&&jsxRuntime.jsx("p",{className:"text-xs text-text-tertiary",children:u})]})}function Ci({count:e,label:t="results",isLoading:r=false,className:o=""}){if(r)return jsxRuntime.jsx("div",{className:`flex items-center ${o}`,children:jsxRuntime.jsx(J,{width:80,height:16})});let n=t.endsWith("s")?t.slice(0,-1):t,a=e===1?n:t;return jsxRuntime.jsxs("div",{className:`text-sm text-text-secondary whitespace-nowrap ${o}`,children:[e.toLocaleString()," ",a]})}var l1=e=>{let t=zt({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 tailwindMerge.twMerge(t,r,e.className)};function Lr({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[h,b]=Oe__namespace.default.useState(false),{isFocused:x,handleFocus:y,handleBlur:v}=Pr(),S=d==="password",w=Ss(p,300);return jsxRuntime.jsx(reactAriaComponents.TextField,{...f,isRequired:a,className:ke(f.className,"group flex flex-col"),children:({isDisabled:N,isInvalid:M})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(ze,{size:o,tooltip:n,description:g==="tooltip"||g==="inline"?t:void 0,descriptionPlacement:g,isRequired:a,children:e}),jsxRuntime.jsxs(yt,{children:[s&&jsxRuntime.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 w?jsxRuntime.jsx(go,{size:k,color:"text-text-secondary"}):jsxRuntime.jsx(B,{name:"MagnifyingGlass",size:k,className:`transition-colors ${x?"text-action-brand":"text-text-secondary"}`})})()}),jsxRuntime.jsx(Ns,{size:o,disabled:N,type:S?h?"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:l1({isInvalid:M,isDisabled:N,isFocused:x,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&&!N&&jsxRuntime.jsx(ni,{onClick:()=>{l?l():f.onChange&&f.onChange("");},size:o}),S&&!N&&jsxRuntime.jsx("button",{type:"button",onClick:()=>b(!h),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":h?"Hide password":"Show password",onMouseDown:k=>{k.preventDefault(),k.stopPropagation();},children:jsxRuntime.jsx(B,{name:h?"EyeSlash":"Eye",size:o==="sm"?16:20,className:"text-text-primary"})})]}),m?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsxRuntime.jsx(be,{size:o,children:r}):typeof r=="function"&&u?jsxRuntime.jsx(be,{size:o,children:r(u)}):t&&g==="below"?jsxRuntime.jsx(Te,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:r}):typeof r=="function"&&u?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:r(u)}):t&&g==="below"?jsxRuntime.jsx(Te,{size:o,className:"mt-1",children:t}):null})]})})}function In({value:e,onChange:t,onClear:r,placeholder:o="Search...",size:n="sm",className:a="",isLoading:i=false}){return jsxRuntime.jsx("div",{className:`flex-1 min-w-0 sm:max-w-sm ${a}`,children:jsxRuntime.jsx(Lr,{value:e,onChange:t,placeholder:o,showSearchIcon:true,isClearable:!!e&&!!r,onClear:r,size:n,"aria-label":o,reserveErrorSpace:false,isLoading:i})})}function Si({value:e,options:t,onChange:r,direction:o,onDirectionChange:n,showLabel:a=true,size:i="sm",className:s="",compact:c=false}){let[l,d]=Oe.useState(false),u=o!==void 0&&n!==void 0,m=t.find(p=>p.value===e);return c?jsxRuntime.jsxs("div",{className:`flex items-center gap-2 ${s}`,children:[jsxRuntime.jsx(_,{variant:"secondary",size:i,icon:"ArrowsDownUp","aria-label":`Sort by: ${m?.label||"Select"}`,onPress:()=>d(true)}),jsxRuntime.jsx(ct,{isOpen:l,onClose:()=>d(false),title:"Sort by",contentPadding:false,children:jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.jsx(_t,{id:p.id,textValue:p.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:p.label})},p.id)})})]}):jsxRuntime.jsxs("div",{className:`flex items-center gap-2 ${s}`,children:[a&&jsxRuntime.jsx("span",{className:"text-sm text-text-secondary whitespace-nowrap",children:"Sort by:"}),jsxRuntime.jsx(bo,{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&&jsxRuntime.jsx(_,{variant:"ghost",size:i,onClick:()=>n(o==="asc"?"desc":"asc"),"aria-label":`Sort ${o==="asc"?"descending":"ascending"}`,className:"p-1.5",children:o==="asc"?jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"})})]})}function Bb({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:h,stickyTop:b="0",zIndex:x=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 N=h?"sticky bg-background-surface":"",M=h?{top:b,zIndex:x}:{};return jsxRuntime.jsxs("div",{className:`@container flex flex-col gap-3 bg-background-surface py-3 border-b border-border-default ${N} ${y}`,style:{...v,...M},children:[jsxRuntime.jsxs("div",{className:"hidden @[640px]:flex @[640px]:items-center @[640px]:justify-between @[640px]:gap-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[d,d&&l&&jsxRuntime.jsx("div",{className:"h-4 w-px bg-border-default"}),l&&jsxRuntime.jsx(Ci,{count:l.count,label:l.label,isLoading:l.isLoading}),l&&c&&jsxRuntime.jsx("div",{className:"h-4 w-px bg-border-default"}),c&&jsxRuntime.jsx(Si,{value:c.value,options:c.options,onChange:c.onChange,showLabel:c.showLabel,direction:c.direction,onDirectionChange:c.onDirectionChange}),u?jsxRuntime.jsx(_,{variant:"secondary",size:"sm",icon:"Columns",onClick:u,children:"Columns"}):m,S&&o&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.slice(0,s).map(k=>jsxRuntime.jsxs(eo,{variant:"primary",size:"sm",onRemove:()=>o(k.id),isRemovable:true,children:[k.label,": ",k.value]},k.id)),r.length>s&&a&&jsxRuntime.jsxs(_,{variant:"ghost",size:"sm",onClick:a,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:["+",r.length-s," more"]}),n&&jsxRuntime.jsx(_,{variant:"ghost",size:"sm",onClick:n,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:"Clear all"})]})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-3 flex-shrink-0",children:p||jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g&&g.items.length>0&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:g.items.map(k=>jsxRuntime.jsx(_,{variant:k.variant||"secondary",size:"sm",icon:k.icon,onPress:k.onClick,isDisabled:k.disabled,children:k.label},k.id))}),e&&jsxRuntime.jsx("div",{className:"w-64",children:jsxRuntime.jsx(In,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsxRuntime.jsx(_,{variant:"secondary",size:"sm",icon:"Sliders",badgeNumber:r.length>0?r.length:void 0,onClick:a,children:"Filters"}),i&&jsxRuntime.jsx(_,{variant:"secondary",size:"sm",icon:"Upload",onClick:i.onClick,isDisabled:i.isDisabled,children:i.label})]})})]}),jsxRuntime.jsxs("div",{className:"@[640px]:hidden",children:[jsxRuntime.jsx("div",{className:"flex flex-col gap-3 mb-3",children:jsxRuntime.jsx("div",{className:"flex items-center gap-3",children:p?jsxRuntime.jsx("div",{className:"flex-1",children:p}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g&&g.items.length>0&&jsxRuntime.jsx(fa,{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:jsxRuntime.jsx(_,{variant:"secondary",size:"sm",icon:"DotsThreeVertical","aria-label":g.menuLabel||"Actions"})}),e&&jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsx(In,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsxRuntime.jsx(_,{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&&jsxRuntime.jsx(_,{variant:"secondary",size:"sm",icon:"Upload",onClick:i.onClick,isDisabled:i.isDisabled,children:i.label})]})})}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d,l&&jsxRuntime.jsx(Ci,{count:l.count,label:l.label,isLoading:l.isLoading})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:c&&jsxRuntime.jsx(Si,{value:c.value,options:c.options,onChange:c.onChange,showLabel:false,direction:c.direction,onDirectionChange:c.onDirectionChange,compact:f!=="desktop"})})]})]})]})}function Vb({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&&jsxRuntime.jsxs(_,{variant:"secondary",size:s,onClick:o,className:"whitespace-nowrap",children:[e.length," ",e.length===1?"filter":"filters"]}),h=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g&&jsxRuntime.jsx(_,{variant:"secondary",size:s,icon:"Sliders",onClick:o,className:"whitespace-nowrap",children:"Filters"}),l&&d.map(x=>jsxRuntime.jsxs(eo,{variant:"secondary",size:s,onRemove:()=>t(x.id),isRemovable:true,children:[x.label,": ",x.value]},x.id)),l&&m&&o&&jsxRuntime.jsxs(_,{variant:"ghost",size:s,onClick:o,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:["+",u," more"]}),l&&r&&jsxRuntime.jsx(_,{variant:"ghost",size:s,onClick:r,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:"Clear all"})]}),b=a==="button"?f:h;return jsxRuntime.jsx("div",{className:`flex flex-wrap items-center gap-2 ${c}`,children:b})}function g1(e,t,r){return {field:e,operator:t,value:r}}function b1(e,t="AND"){return {logic:t,conditions:e}}function wi(){return {logic:"AND",conditions:[]}}function il(e){return !e||e.conditions.length===0?true:e.conditions.every(t=>"conditions"in t?il(t):false)}function x1(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":">",h=g.operator==="lte"?"\u2264":"<";a.push({id:`${i}-range`,label:l,value:`${f} ${p.value} and ${h} ${g.value}`});}else for(let f of u){let h;f.operator==="gte"?h="\u2265":f.operator==="gt"?h=">":f.operator==="lte"?h="\u2264":h="<",a.push({id:`${i}-${f.operator}`,label:l,value:`${h} ${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 Zo(e,t){let r=e||wi();return {...r,conditions:[...r.conditions,t]}}function Fn(e,t){if(!e)return wi();let r=e.conditions.filter(o=>"conditions"in o?Fn(o,t).conditions.length>0:o.field!==t);return {...e,conditions:r}}function Bn(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 Ob({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]=Oe.useState(false),f=h=>{m.onChange&&h&&m.onChange(h),g(false);};return jsxRuntime.jsxs(reactAriaComponents.DateField,{...m,isDisabled:i,isRequired:a,isInvalid:s,className:ke(u,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(ze,{size:o,tooltip:n,isRequired:a,children:e}),jsxRuntime.jsx(yt,{children:jsxRuntime.jsxs("div",{className:"relative w-full",children:[jsxRuntime.jsx(Ni,{size:o,isDisabled:i,isInvalid:s,hasCalendar:c}),c&&!i&&jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:p,onOpenChange:g,children:[jsxRuntime.jsx(_,{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:jsxRuntime.jsx(B,{name:"Calendar",size:18})}),jsxRuntime.jsx(reactAriaComponents.Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsxRuntime.jsx(reactAriaComponents.Dialog,{className:"p-4 outline-none",children:jsxRuntime.jsx(ha,{value:m.value,onChange:f,minValue:m.minValue,maxValue:m.maxValue,isDisabled:i,isReadOnly:m.isReadOnly,isDateUnavailable:m.isDateUnavailable})})})]})]})}),l?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsxRuntime.jsx(be,{size:o,children:r}):typeof r=="function"&&d?jsxRuntime.jsx(be,{size:o,children:r(d)}):t?jsxRuntime.jsx(Te,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:r}):typeof r=="function"&&d?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:r(d)}):t?jsxRuntime.jsx(Te,{size:o,className:"mt-1",children:t}):null})]})}function k1({isPlaceholder:e,isDisabled:t,size:r="md"}){return tailwindMerge.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 Ni({size:e="md",isDisabled:t,isInvalid:r,hasCalendar:o,className:n,...a}){return jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(zo({isInvalid:r,isDisabled:t}),"px-3 py-2 flex items-center gap-0.5 w-full",o&&"pr-10",n),...a,children:i=>jsxRuntime.jsx(reactAriaComponents.DateSegment,{segment:i,className:k1({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||t,size:e})})})}function sl({label:e,description:t,errorMessage:r,...o}){return jsxRuntime.jsxs(reactAriaComponents.DateRangePicker,{...o,className:ke(o.className,"group flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(ze,{children:e}),jsxRuntime.jsxs(yf,{className:"w-auto min-w-[208px]",children:[jsxRuntime.jsx(Ni,{slot:"start",className:"px-2 py-1.5 text-sm"}),jsxRuntime.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"}),jsxRuntime.jsx(Ni,{slot:"end",className:"flex-1 px-2 py-1.5 text-sm"}),jsxRuntime.jsx(_,{variant:"icon",className:"mr-1 w-6 rounded outline-offset-0",children:jsxRuntime.jsx(lucideReact.CalendarIcon,{"aria-hidden":true,className:"h-4 w-4"})})]}),t&&jsxRuntime.jsx(Te,{children:t}),typeof r=="string"?jsxRuntime.jsx(be,{children:r}):null,jsxRuntime.jsx(lt,{children:jsxRuntime.jsx(Ma,{})})]})}var I1=e=>{let t=zt({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return tailwindMerge.twMerge(t,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function ki({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=Oe.useId(),{isFocused:m,handleFocus:p,handleBlur:g}=Pr();return jsxRuntime.jsx(reactAriaComponents.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:h})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsxRuntime.jsx(ze,{size:o,tooltip:n,description:l==="tooltip"||l==="inline"?t:void 0,descriptionPlacement:l,isRequired:a,htmlFor:u,children:e}),jsxRuntime.jsx("div",{className:"relative",children:jsxRuntime.jsxs(reactAriaComponents.Group,{className:"relative",children:[jsxRuntime.jsx(reactAriaComponents.Input,{onFocus:x=>p(x,d.onFocus),onBlur:x=>g(x,d.onBlur),className:I1({isInvalid:h||!!r,isDisabled:f,isFocused:m,transparent:i,size:o,className:typeof d.className=="string"?d.className:void 0})}),jsxRuntime.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:[jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(B,{name:"CaretUp",size:14})}),jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(B,{name:"CaretDown",size:14})})]})]})}),c?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:r?jsxRuntime.jsx(be,{size:o,children:typeof r=="function"?r(s):r}):t&&l==="below"?jsxRuntime.jsx(Te,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:r?jsxRuntime.jsx(be,{size:o,className:"mt-1",children:typeof r=="function"?r(s):r}):t&&l==="below"?jsxRuntime.jsx(Te,{size:o,className:"mt-1",children:t}):null})]})})}var Eu={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 V1({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=Eu[r].track,a=Je,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 z1({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=Eu[r].handle;return [o,n,e?"translate-x-[100%]":"translate-x-0",t?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function ll({children:e,variant:t="primary",size:r="md",...o}){return jsxRuntime.jsx(reactAriaComponents.Switch,{...o,className:ke(o.className,`relative group flex items-center gap-2 ${Eu[r].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:n=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:V1({...n,size:r}),children:jsxRuntime.jsx("span",{className:z1({...n,size:r})})}),e]})})}function Gb(e){return new Intl.NumberFormat("en-US").format(e)}function Ub({isOpen:e,onClose:t,facetConfigs:r,facetCounts:o={},currentFilters:n,onApply:a,onClear:i,title:s="Filters",resultCount:c}){let[l,d]=Oe.useState(n),[u,m]=Oe.useState({}),[p,g]=Oe.useState({}),[f,h]=Oe.useState(null),{isMobile:b}=Xt(),x=Oe.useMemo(()=>r.some(C=>C.group),[r]),{groups:y,ungroupedFacets:v,facetsByGroup:S}=Oe.useMemo(()=>{let C=new Set,I=[],F={};for(let U of r)U.group?(C.has(U.group)||(C.add(U.group),F[U.group]=[]),F[U.group].push(U)):I.push(U);return {groups:Array.from(C),ungroupedFacets:I,facetsByGroup:F}},[r]);Oe.useEffect(()=>{e&&(d(n),m({}),g({}),h(!b&&y.length>0?y[0]:null));},[e,n,y,b]);let w=Oe.useMemo(()=>!l||il(l)?0:Bn(l).length,[l]),N=()=>{a(l),t();},M=()=>{let C=wi();d(C),i?i():a(C),t();},k=C=>{if(!l)return [];if(!Bn(l).includes(C))return [];let F=[];function U($){if($)for(let ae of $.conditions)"conditions"in ae?U(ae):ae.field===C&&ae.operator==="in"&&Array.isArray(ae.value)&&F.push(...ae.value.map(String));}return U(l),F},T=(C,I,F)=>{let U=Fn(l,C);I!==void 0&&(U=Zo(U,{field:C,operator:"gte",value:I})),F!==void 0&&(U=Zo(U,{field:C,operator:"lte",value:F})),d(U);},A=C=>{if(!l)return;let I;function F(U){if(U)for(let $ of U.conditions)"conditions"in $?F($):$.field===C&&$.operator==="eq"&&typeof $.value=="boolean"&&(I=$.value);}return F(l),I},E=(C,I)=>{let F=Fn(l,C);I!==void 0&&(F=Zo(F,{field:C,operator:"eq",value:I})),d(F);},D=(C,I,F)=>{let U=Fn(l,C);I&&(U=Zo(U,{field:C,operator:"gte",value:I.toString()})),F&&(U=Zo(U,{field:C,operator:"lte",value:F.toString()})),d(U);},R=C=>{let I=S[C]||[],F=l?Bn(l):[];return I.filter(U=>F.includes(U.field)).length},H="pr-9 bg-background-muted/50",G="border-t border-border-muted",K="text-sm font-medium text-text-link-default",W=C=>jsxRuntime.jsx("span",{className:K,children:C}),q=C=>{let I=o[C.field]||{},F=u[C.field]||"",U=[];C.values?U=C.values.map(Z=>({value:String(Z.value),label:Z.label,count:I[String(Z.value)]})):U=Object.entries(I).map(([Z,ie])=>({value:Z,label:Z,count:ie}));let $=U.length;if(F){let Z=F.toLowerCase();U=U.filter(ie=>ie.label.toLowerCase().includes(Z));}U.sort((Z,ie)=>Z.count!==void 0&&ie.count!==void 0&&ie.count!==Z.count?ie.count-Z.count:Z.label.localeCompare(ie.label));let ae=C.type||"string";if(ae==="string"||!C.type){let Z=k(C.field),ie=C.searchThreshold??10,fe=C.maxVisibleOptions??50,re=p[C.field]??false,de=re||U.length<=fe?U:U.slice(0,fe),xe=U.length>fe&&!re;return jsxRuntime.jsxs(Go,{id:C.field,children:[jsxRuntime.jsx(Uo,{title:C.label,description:C.description,className:H,endContent:Z.length>0?W(`${Z.length} selected`):void 0}),jsxRuntime.jsx(Ko,{className:G,children:jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 pb-4",children:[$>ie&&jsxRuntime.jsx(In,{value:F,onChange:he=>m(Ee=>({...Ee,[C.field]:he})),onClear:()=>m(he=>({...he,[C.field]:""})),placeholder:`Search ${C.label.toLowerCase()}...`,size:"sm",className:"w-full !max-w-none pr-4"}),jsxRuntime.jsx(Kd,{value:Z,onChange:he=>{let Ee=Fn(l,C.field);he.length>0&&(Ee=Zo(Ee,{field:C.field,operator:"in",value:he})),d(Ee);},children:jsxRuntime.jsx("div",{className:"space-y-1.5",children:de.map(he=>jsxRuntime.jsx("div",{className:"rounded-md py-2 pr-4 transition-colors hover:bg-background-hover",children:jsxRuntime.jsx(Sn,{value:he.value,children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-3 flex-1",children:[C.renderLabel?C.renderLabel(he.value,he.label):jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-primary",children:he.label}),he.count!==void 0&&jsxRuntime.jsx("span",{className:"text-xs font-medium text-text-secondary tabular-nums",children:Gb(he.count)})]})})},he.value))})}),xe&&jsxRuntime.jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxRuntime.jsxs(_,{variant:"ghost",size:"sm",onPress:()=>g(he=>({...he,[C.field]:true})),className:"w-full",children:["Show all ",U.length," options"]})}),re&&U.length>fe&&jsxRuntime.jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxRuntime.jsx(_,{variant:"ghost",size:"sm",onPress:()=>g(he=>({...he,[C.field]:false})),className:"w-full",children:"Show less"})})]})})]},C.field)}if(ae==="number"){let Z,ie,fe=de=>{if(de)for(let xe of de.conditions)"conditions"in xe?fe(xe):xe.field===C.field&&(xe.operator==="gte"&&typeof xe.value=="number"&&(Z=xe.value),xe.operator==="lte"&&typeof xe.value=="number"&&(ie=xe.value));};fe(l);let re=Z!==void 0||ie!==void 0;return jsxRuntime.jsxs(Go,{id:C.field,children:[jsxRuntime.jsx(Uo,{title:C.label,description:C.description,className:H,endContent:re?W(Z!==void 0&&ie!==void 0?`${Z} - ${ie}`:Z!==void 0?`\u2265 ${Z}`:`\u2264 ${ie}`):void 0}),jsxRuntime.jsx(Ko,{className:G,children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 pb-4",children:[jsxRuntime.jsx(ki,{label:"Min",value:Z,onChange:de=>T(C.field,de,ie)},`${C.field}-min`),jsxRuntime.jsx(ki,{label:"Max",value:ie,onChange:de=>T(C.field,Z,de)},`${C.field}-max`)]})})]},C.field)}if(ae==="boolean"){let Z=A(C.field);return jsxRuntime.jsxs(Go,{id:C.field,children:[jsxRuntime.jsx(Uo,{title:C.label,description:C.description,className:H,endContent:Z!==void 0?W(Z?"Yes":"No"):void 0}),jsxRuntime.jsx(Ko,{className:G,children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4 pb-4",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-primary",children:Z!==void 0?Z?"Enabled":"Disabled":"No filter applied"}),jsxRuntime.jsx(ll,{size:"lg",isSelected:Z??false,onChange:ie=>E(C.field,ie?true:void 0),children:Z?"Yes":"No"})]})})]},C.field)}if(ae==="date"){let Z,ie,fe=Ee=>{if(Ee)for(let $e of Ee.conditions)"conditions"in $e?fe($e):$e.field===C.field&&($e.operator==="gte"&&(Z=String($e.value)),$e.operator==="lte"&&(ie=String($e.value)));};fe(l);let re=Z!==void 0||ie!==void 0,de=Ee=>{if(Ee)try{return /^\d{4}-\d{2}-\d{2}$/.test(Ee)?date.parseDate(Ee):void 0}catch{return}},xe=de(Z),he=de(ie);return jsxRuntime.jsxs(Go,{id:C.field,children:[jsxRuntime.jsx(Uo,{title:C.label,description:C.description,className:H,endContent:re?W("Date range selected"):void 0}),jsxRuntime.jsx(Ko,{className:G,children:jsxRuntime.jsx("div",{className:"pt-4 pb-4",children:jsxRuntime.jsx(sl,{label:"Date Range",value:xe&&he?{start:xe,end:he}:void 0,onChange:Ee=>{Ee?D(C.field,Ee.start,Ee.end):D(C.field,void 0,void 0);}})})})]},C.field)}return null},j=()=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[v.map(C=>{let F=(l?Bn(l):[]).includes(C.field);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>h(`__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:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-primary",children:C.label}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[F&&jsxRuntime.jsx("span",{className:K,children:"1 active"}),jsxRuntime.jsx(B,{name:"CaretRight",size:"sm",className:"text-text-secondary"})]})]},C.field)}),y.map(C=>{let I=R(C);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>h(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:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-primary",children:C}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[I>0&&jsxRuntime.jsxs("span",{className:K,children:[I," active"]}),jsxRuntime.jsx(B,{name:"CaretRight",size:"sm",className:"text-text-secondary"})]})]},C)})]}),Q=C=>{if(C.startsWith("__ungrouped__")){let F=C.replace("__ungrouped__",""),U=v.find($=>$.field===F);return U?jsxRuntime.jsx(ya,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[U.field],children:q(U)}):null}let I=S[C]||[];return I.length===0?null:jsxRuntime.jsx(ya,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[I[0].field],children:I.map(F=>q(F))})},O=()=>{if(f){let C=f.startsWith("__ungrouped__")&&v.find(I=>I.field===f.replace("__ungrouped__",""))?.label||f;return jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>h(null),className:"flex items-center gap-2 px-4 py-3 border-b border-border-muted hover:bg-background-hover transition-colors",children:[jsxRuntime.jsx(B,{name:"CaretLeft",size:"sm",className:"text-text-secondary"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-primary",children:C})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:Q(f)})]})}return j()},L=()=>jsxRuntime.jsxs("div",{className:"flex h-full",children:[jsxRuntime.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 F=(l?Bn(l):[]).includes(C.field),U=f===`__ungrouped__${C.field}`;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>h(`__ungrouped__${C.field}`),className:`flex items-center justify-between w-full px-4 py-3 text-left border-b border-border-muted transition-colors ${U?"bg-background-selected":"hover:bg-background-hover"}`,children:[jsxRuntime.jsx("span",{className:`text-sm truncate ${U?"font-semibold text-text-primary":"font-medium text-text-primary"}`,children:C.label}),F&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-action-primary flex-shrink-0 ml-2"})]},C.field)}),y.map(C=>{let I=R(C),F=f===C;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>h(C),className:`flex items-center justify-between w-full px-4 py-3 text-left border-b border-border-muted transition-colors ${F?"bg-background-selected":"hover:bg-background-hover"}`,children:[jsxRuntime.jsx("span",{className:`text-sm truncate ${F?"font-semibold text-text-primary":"font-medium text-text-primary"}`,children:C}),I>0&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-action-primary flex-shrink-0 ml-2"})]},C)})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:f?Q(f):jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-sm",children:"Select a category to view filters"})})]}),Y=()=>jsxRuntime.jsx(ya,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[r[0].field],children:r.map(C=>q(C))});return jsxRuntime.jsx(kr,{isOpen:e,onClose:t,title:x&&b&&f?f.startsWith("__ungrouped__")?v.find(C=>C.field===f.replace("__ungrouped__",""))?.label||s:f:w>0?`${s} (${w} active)`:s,hideCloseIcon:false,primaryAction:{label:"Apply filters",onPress:N,variant:"primary"},secondaryAction:{label:"Clear all",onPress:M},maxWidth:x?"800px":"700px",height:"600px",mobileHeight:"85vh",contentPadding:false,footerContent:c!==void 0?jsxRuntime.jsxs("div",{className:"text-sm text-text-secondary text-center",children:[jsxRuntime.jsx("span",{className:"font-semibold text-text-primary",children:Gb(c)})," ",c===1?"result":"results"," with current filters"]}):void 0,children:r.length===0?jsxRuntime.jsx("div",{className:"py-12 text-center",children:jsxRuntime.jsx("div",{className:"text-sm font-medium text-text-secondary",children:"No filters available"})}):x?b?O():L():Y()})}function Lu(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 Ar(e="normal",t){return tailwindMerge.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 tailwindMerge.twMerge("flex items-center gap-1 min-w-0 overflow-hidden",Lu(e),t)}function ul(e,t="\u2014"){return e==null||e===""?t:String(e)}var _o={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 nr(e="normal"){return {strong:_o.lg,high:_o.lg,normal:_o.md,low:_o.sm}[e]}function Se(e,t){return typeof e=="function"?e(t):e}function Kb(e="neutral",t="sm"){return tailwindMerge.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 Yb(e){return e?"success":"neutral"}function pl(e,t=false){return t?e>0?"text-feedback-success-text":e<0?"text-feedback-error-text":"text-text-primary":"text-text-primary"}function Au(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 ao(e,t,r,o="hover",n="secondary",a,i){if(!t)return e;let s=typeof t=="function"&&r?t(r):t,c=Au(o,n);return jsxRuntime.jsx("a",{href:s,className:tailwindMerge.twMerge(c,a==="strong"||a==="high"?"font-semibold":"",i),onClick:d=>{d.metaKey||d.ctrlKey;},children:e})}function Jb({row:e,context:t,actions:r,align:o="right",size:n="sm"}){let{isLoading:a}=t;if(a)return jsxRuntime.jsx(J,{className:_o.sm});let s=(typeof r=="function"?r(e):r).filter(l=>!Se(l.hidden,e));if(s.length===0)return null;let c=Me(o);return jsxRuntime.jsx("div",{className:c,children:s.map(l=>{let d=Se(l.disabled,e);return l.variant==="icon"||!l.label?jsxRuntime.jsx(_,{variant:"icon",size:n,onPress:()=>{l.onClick(e);},isDisabled:d,"aria-label":l.label||l.id,children:jsxRuntime.jsx(B,{name:l.icon||"DotsThree",size:n==="sm"?16:20})},l.id):jsxRuntime.jsxs(_,{variant:l.variant||"secondary",size:n,onPress:()=>{l.onClick(e);},isDisabled:d,children:[l.icon&&jsxRuntime.jsx(B,{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,h=(w,N)=>{if(!g||w.length<=g)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:w});let M=w.slice(0,g-1)+"\u2026";return jsxRuntime.jsx(Zt,{content:N,children:jsxRuntime.jsx("span",{children:M})})};if(f)return jsxRuntime.jsx(J,{className:nr("normal")});if(e==null||e==="")return jsxRuntime.jsx("div",{className:Me(d,"text-text-secondary"),children:u});if(Array.isArray(e)&&e.length===0)return jsxRuntime.jsx("div",{className:Me(d,"text-text-secondary"),children:u});let b=Me(d,m);if(Array.isArray(e)){let w=e.slice(0,p),N=e.slice(p),M=N.length>0;return jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[w.map((k,T)=>{let A=typeof o=="function"?o(k,t):o,E=typeof n=="function"?n(k,t):n!==void 0?n:String(k),D=typeof s=="function"?s(k,t):s,R=typeof l=="function"?l(k,t):l;return jsxRuntime.jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxRuntime.jsx(nt,{variant:A,size:a,shape:i,dot:D,dotPosition:c,dotPulse:R,children:h(E,E)})},T)}),M&&jsxRuntime.jsx(Zt,{content:N.join(", "),children:jsxRuntime.jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxRuntime.jsxs(nt,{variant:"neutral",size:a,shape:i,children:["+",N.length]})})})]})})}let x=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 jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsx(nt,{variant:x,size:a,shape:i,dot:v,dotPosition:c,dotPulse:S,children:h(y,y)})})}function qb({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 jsxRuntime.jsx(J,{className:nr(l)});let m=!!e;if(!m&&!s)return jsxRuntime.jsx("div",{className:Me(c,d)});let p=Me(c,d);switch(r){case "icon":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx(B,{name:m?a:i,size:16,className:m?"text-feedback-success-text":"text-text-disabled"})});case "text":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx("span",{className:Ar(l),children:m?o:n})});case "badge":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx(nt,{variant:m?"success":"neutral",size:"sm",children:m?o:n})});default:return null}}function Zb({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:h}){let{isLoading:b}=t,x=Se(r,e),y=Se(o,e),v=Se(n,e),S=Se(a,e),w=Se(c,e),N=typeof m=="function"?m(e):m,M=Se(h,e),k=Me(g,f);return jsxRuntime.jsx("div",{className:k,children:jsxRuntime.jsx(Bs,{firstName:x,lastName:y,email:v,avatarUrl:S,layout:i,size:s,href:w,LinkComponent:l,linkVariant:d,showEmail:u,badge:N,emphasis:p,isLoading:b,piiEntity:M})})}function _b({value:e,row:t,context:r,render:o,className:n}){let a=o(e,t,r);return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("h-full w-full",n),children:a})}function $b({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 jsxRuntime.jsx(J,{className:nr(s)});if(!e)return jsxRuntime.jsx("div",{className:Me(i,"text-text-secondary"),children:a});let m=e instanceof Date?e:new Date(e);if(isNaN(m.getTime()))return jsxRuntime.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=q1(m);break;case "custom":p=n?m.toLocaleString("en-US",n):m.toISOString();break;default:p=m.toLocaleDateString();}let g=Me(i,tailwindMerge.twMerge(Ar(s),d)),f=Se(c,t);return f?jsxRuntime.jsx("div",{className:g,children:ao(p,f,t,l)}):jsxRuntime.jsx("div",{className:g,children:p})}function q1(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 ml({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[h,b]=Oe.useState(false),x=o||(r?Z1(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&&!h&&u,N={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:T})=>s?c?jsxRuntime.jsx(c,{href:s,className:T,children:k}):jsxRuntime.jsx(Ze,{href:s,variant:l,className:tailwindMerge.twMerge("hover:underline",T),asButton:false,children:k}):jsxRuntime.jsx("span",{className:T,children:k});if(p)return a==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsx(J,{width:v.skeletonIcon,height:v.skeletonIcon,className:"flex-shrink-0 rounded"}),jsxRuntime.jsx(J,{width:v.skeletonText,height:v.skeletonIcon*.6})]}):jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsx(J,{width:v.skeletonIcon,height:v.skeletonIcon,className:"flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(J,{width:v.skeletonText,height:16}),jsxRuntime.jsx(J,{width:v.skeletonSecondary,height:12})]})]});if(a==="inline"){let k=`${e} ${t}`;return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",v.logoSize),children:S?jsxRuntime.jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>b(true)}):jsxRuntime.jsx(B,{name:x,size:v.iconSize*.6,className:"text-text-secondary"})}),jsxRuntime.jsx(M,{className:tailwindMerge.twMerge("truncate leading-normal hover:text-text-primary",N,v.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsxRuntime.jsx("span",{"data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:k})})]})}return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center justify-start",v.gap,g),children:[u&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",v.logoSize),children:S?jsxRuntime.jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>b(true)}):jsxRuntime.jsx(B,{name:x,size:v.iconSize*.6,className:"text-text-secondary"})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxRuntime.jsx(M,{className:tailwindMerge.twMerge("truncate leading-normal hover:text-text-primary",N,v.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsxRuntime.jsx("span",{"data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:e})}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center gap-1.5 text-text-secondary leading-normal",v.secondaryTextSize),children:[d&&jsxRuntime.jsx(B,{name:x,size:v.iconInTextSize,className:"flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate","data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:t})]})]})]})}function Z1(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 tx({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:h}){let{isLoading:b}=t,x=Se(r,e),y=Se(o,e),v=Se(n,e),S=Se(a,e),w=Se(c,e),N=Se(h,e),M=Me(g,f);return jsxRuntime.jsx("div",{className:M,children:jsxRuntime.jsx(ml,{manufacturer:x,model:y,deviceType:v,logoUrl:S,layout:i,size:s,href:w,LinkComponent:l,linkVariant:d,showDeviceTypeIcon:u,showLogo:m,emphasis:p,isLoading:b,piiEntity:N})})}var xU={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},_1=["charging","discharging","heat","cool","on","connected"],$1={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 Iu(e){return _1.includes(e)}function Fu(e){return $1[e]}function zn({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 jsxRuntime.jsx(J,{className:"inline-flex h-6 w-20"});let u=t??Fu(e),m=Iu(e);return jsxRuntime.jsxs(nt,{variant:e,size:n,shape:a,dot:i??m,dotPulse:s??m,className:c?`w-28 justify-center ${l||""}`:l,...d,children:[r&&jsxRuntime.jsx(B,{name:r,size:n==="sm"?12:n==="md"?14:16}),u]})}var tP={importing:"Importing",exporting:"Exporting"};function ox(e){return tP[e]}function gl({state:e,label:t,showIcon:r=false,isLoading:o,size:n="sm",shape:a="pill",fixedWidth:i,className:s,...c}){if(o)return jsxRuntime.jsx(J,{className:"inline-flex h-6 w-24"});let l=t??ox(e),d=e==="exporting"?"ArrowUp":"ArrowDown",u=n==="sm"?12:n==="md"?14:16;return r?jsxRuntime.jsx(nt,{variant:e,size:n,shape:a,className:`w-6 justify-center ${s||""}`,...c,children:jsxRuntime.jsx(B,{name:d,size:u})}):jsxRuntime.jsx(nt,{variant:e,size:n,shape:a,className:i?`w-28 justify-center ${s||""}`:s,...c,children:l})}function bl({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 jsxRuntime.jsx(J,{className:tailwindMerge.twMerge("inline-flex h-6 w-32",m)});let p=r!=null&&o?Vr(r,o):null,g=a==="horizontal",f=o&&!p;return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("inline-flex items-center",g?"gap-2":"flex-col gap-1",m),children:[(p||f)&&jsxRuntime.jsx("span",{className:tailwindMerge.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"}),jsxRuntime.jsx(zn,{state:e,label:t,icon:l,size:s,shape:c,fixedWidth:d}),n&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:n==="importing"||n==="exporting"?jsxRuntime.jsx(gl,{state:n,size:s,shape:c,fixedWidth:d,showIcon:u}):jsxRuntime.jsx(zn,{state:n,size:s,shape:c,fixedWidth:d})})]})}function nx({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 jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(J,{className:"h-4 w-12"}),jsxRuntime.jsx(J,{className:`h-6 w-24 ${v}`}),jsxRuntime.jsx(J,{className:`h-6 w-20 ${v}`})]}):jsxRuntime.jsx(J,{className:`h-6 w-24 ${v}`})})}if(!e)return jsxRuntime.jsx("div",{className:Me(u,p),children:jsxRuntime.jsx("span",{className:"text-text-secondary",children:"\u2014"})});let f=Se(o,t),h=Se(a,t),b=typeof c=="function"?c(e,t):c,x=Me(u,p);return f!=null||n?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(x),children:jsxRuntime.jsx(bl,{state:e,stateLabel:b,metric:f,metricFormatter:n,secondaryState:h||void 0,size:i,shape:s,icon:l,fixedWidth:d,secondaryStateIconOnly:m,layout:"horizontal"})}):jsxRuntime.jsx("div",{className:x,children:jsxRuntime.jsx(zn,{state:e,label:b,icon:l,size:i,shape:s,fixedWidth:d})})}function ix({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 jsxRuntime.jsx(J,{className:nr(a)});let m=jr({value:e,formatter:o,emptyText:l,emptyClassName:d}),p=Ar(a),g=Me(n,tailwindMerge.twMerge(p,c)),f=jsxRuntime.jsx("div",{className:g,children:m}),h=Se(i,t);return h?ao(f,h,t,s):f}var Vu=Oe__namespace.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=Oe.useMemo(()=>r===t?100:Math.max(0,Math.min(100,(e-t)/(r-t)*100)),[e,t,r]),f=Oe.useMemo(()=>o==="auto"&&a?a.type==="diverging"&&a.center!==void 0?Za(e,t,r,a.center,a.scheme):Qa(e,t,r,a.scheme):o,[o,a,e,t,r]);if(p.isLoading)return jsxRuntime.jsx("div",{className:"flex items-center gap-2 w-full",style:{height:c},children:jsxRuntime.jsx("div",{className:"h-full flex-1 animate-pulse bg-border-default rounded"})});if(d&&d>0){let x=`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 jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:`flex gap-0.5 ${m?"":"flex-1"}`,style:v,children:Array.from({length:d}).map((S,w)=>{let N=w<y;return jsxRuntime.jsx("div",{className:"rounded-sm",style:{width:x,backgroundColor:N?f:n==="none"?"transparent":n,marginRight:w<d-1?`${u}px`:0}},w)})}),i&&jsxRuntime.jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})}let h={height:c,backgroundColor:n==="none"?"transparent":n,...m&&{width:typeof m=="number"?`${m}px`:m,flexShrink:0}};return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:`relative rounded-sm ${m?"":"flex-1"}`,style:h,children:jsxRuntime.jsx("div",{className:"absolute left-0 top-0 h-full rounded-sm",style:{width:`${g}%`,minWidth:g>0?l:0,backgroundColor:f}})}),i&&jsxRuntime.jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})});Vu.displayName="HorizontalBarCell";var zu=Oe__namespace.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=h=>"xValue"in h?h.xValue:h.x,l=h=>"yValue"in h?h.yValue:h.y,d=a||100,u=i,{xScale:m,yScale:p,barWidth:g}=Oe.useMemo(()=>{if(s.length===0)return {xScale:scale.scaleTime({range:[0,d],domain:[new Date,new Date]}),yScale:scale.scaleLinear({range:[u,0],domain:[0,1]}),barWidth:2};let h=d3Array.extent(s,N=>c(N)),b=d3Array.min(s,N=>l(N))??0,x=d3Array.max(s,N=>l(N))??0,y=b<0?b:0,v=scale.scaleTime({range:[0,d],domain:h}),S=scale.scaleLinear({range:[u,0],domain:[y,x*1.05]}),w=s.length>1?d/s.length*.8:8;return {xScale:v,yScale:S,barWidth:Math.max(2,w)}},[s,d,u]);if(n.isLoading)return jsxRuntime.jsx("div",{className:"flex items-center gap-0.5",style:{width:d,height:u},children:Array.from({length:5}).map((h,b)=>jsxRuntime.jsx("div",{className:"flex-1 animate-pulse bg-border-default rounded"},b))});if(!s||s.length===0)return jsxRuntime.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 jsxRuntime.jsx("svg",{width:d,height:u,children:s.map((h,b)=>{let x=l(h),y=m(c(h)),v=p(x),S=Math.abs(f-v),w=h.category&&o?.[h.category]?o[h.category]:r;return jsxRuntime.jsx(shape.Bar,{x:y-g/2,y:x>=0?v:f,width:g,height:S,fill:w,rx:1},`bar-${b}`)})})});zu.displayName="MiniBarCell";function ux({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 jsxRuntime.jsx(J,{className:nr(l)});if(e==null||isNaN(Number(e)))return jsxRuntime.jsx("div",{className:Me(c,"text-text-secondary"),children:s});let h=Number(e),b;switch(o){case "currency":b=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:n,maximumFractionDigits:n}).format(h);break;case "percent":b=new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:n,maximumFractionDigits:n}).format(h/100);break;case "compact":b=new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:n>0?1:0,maximumFractionDigits:n}).format(h);break;default:b=new Intl.NumberFormat("en-US",{minimumFractionDigits:n,maximumFractionDigits:n}).format(h);}let y=`${m&&h>0?"+":""}${b}`,v=p?pl(h,true):Ar(l),S=Me(c,tailwindMerge.twMerge(v,g)),w=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[a&&jsxRuntime.jsx("span",{className:"text-text-secondary",children:a}),jsxRuntime.jsx("span",{children:y}),i&&jsxRuntime.jsx("span",{className:"text-text-secondary",children:i})]}),N=Se(d,t);return N?jsxRuntime.jsx("div",{className:S,children:ao(w,N,t,u)}):jsxRuntime.jsx("div",{className:S,children:w})}var Ou=Oe__namespace.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=Oe.useMemo(()=>Math.max(0,Math.min(100,e)),[e]),d=Oe.useMemo(()=>r==="auto"&&s?s.type==="diverging"&&s.center!==void 0?Za(e,0,100,s.center,s.scheme):Qa(e,0,100,s.scheme):r,[r,s,e]);if(c.isLoading)return jsxRuntime.jsx("div",{className:"flex items-center gap-2",style:{height:n},children:jsxRuntime.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 jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex gap-0.5 flex-1",style:{height:n},children:Array.from({length:a}).map((g,f)=>{let h=f<p,b=d;if(r==="auto"&&s&&h){let x=(f+1)/a*100;s.type==="diverging"&&s.center!==void 0?b=Za(x,0,100,s.center,s.scheme):b=Qa(x,0,100,s.scheme);}return jsxRuntime.jsx("div",{className:"rounded-sm",style:{width:m,backgroundColor:h?b:o==="none"?"transparent":o,marginRight:f<a-1?`${i}px`:0}},f)})}),t&&jsxRuntime.jsxs("span",{className:"text-sm text-text-primary whitespace-nowrap",children:[l.toFixed(0),"%"]})]})}return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"relative flex-1 rounded-sm",style:{height:n,backgroundColor:o==="none"?"transparent":o},children:jsxRuntime.jsx("div",{className:"absolute left-0 top-0 h-full rounded-sm transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})}),t&&jsxRuntime.jsxs("span",{className:"text-sm text-text-primary whitespace-nowrap",children:[l.toFixed(0),"%"]})]})});Ou.displayName="PercentBarCell";function mx({row:e,context:t,isSelected:r=false,onSelect:o,isDisabled:n=false,align:a="center"}){let{isLoading:i}=t;if(i)return jsxRuntime.jsx("div",{className:Me(a),children:jsxRuntime.jsx(J,{className:"h-4 w-4 rounded"})});let s=Se(n,e),c=Me(a);return jsxRuntime.jsx("div",{className:c,children:jsxRuntime.jsx(Sn,{isSelected:r,onChange:l=>{o?.(e,l);},isDisabled:s,"aria-label":"Select row"})})}function yl({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],h={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 x=b.join(", "),y=({children:S,className:w})=>i?s?jsxRuntime.jsx(s,{href:i,className:w,children:S}):jsxRuntime.jsx(Ze,{href:i,variant:c,className:tailwindMerge.twMerge("hover:underline",w),asButton:false,children:S}):jsxRuntime.jsx("span",{className:w,children:S});if(d)return n==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",g.gap,u),children:[jsxRuntime.jsx(J,{width:g.skeletonIconInline,height:g.skeletonIconInline,className:"flex-shrink-0 rounded"}),jsxRuntime.jsx(J,{width:g.skeletonText,height:g.skeletonIconInline*.8})]}):jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",g.gap,u),children:[jsxRuntime.jsx(J,{width:g.skeletonIconStacked,height:g.skeletonIconStacked,className:"flex-shrink-0 rounded"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(J,{width:g.skeletonText,height:16}),jsxRuntime.jsx(J,{width:g.skeletonSecondary,height:12})]})]});if(n==="inline")return jsxRuntime.jsxs(y,{className:tailwindMerge.twMerge("flex items-center",g.gap,i&&"hover:bg-background-hover transition-colors",u),children:[jsxRuntime.jsx(B,{name:"MapPin",size:g.iconSize,className:"text-text-secondary flex-shrink-0"}),jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-primary",h,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 jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center justify-start",g.gap,u),children:[jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",g.iconContainerSize),children:jsxRuntime.jsx(B,{name:"MapPin",size:g.iconSize,className:"text-text-secondary"})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxRuntime.jsx(y,{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-primary",h,g.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsxRuntime.jsx("span",{"data-pii-type":m?"address":void 0,"data-pii-entity":m,children:e})}),x&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("text-text-secondary leading-normal truncate",g.secondaryTextSize),"data-pii-type":v(),"data-pii-entity":m,children:x})]})]})}function gx({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,h=Se(r,e),b=Se(o,e),x=Se(n,e),y=Se(a,e),v=Se(c,e),S=Se(g,e),w=Me(m,p);return jsxRuntime.jsx("div",{className:w,children:jsxRuntime.jsx(yl,{streetAddress:h,city:b,state:x,postalCode:y,layout:i,size:s,href:v,LinkComponent:l,linkVariant:d,emphasis:u,isLoading:f,piiEntity:S})})}var Hu=Oe__namespace.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}=Oe.useMemo(()=>{if(l.length===0)return {xScale:scale.scaleTime({range:[0,d],domain:[new Date,new Date]}),yScale:scale.scaleLinear({range:[u,0],domain:[0,1]})};let f=d3Array.extent(l,y=>y.xValue),h=d3Array.min(l,y=>y.yValue)||0,b=d3Array.max(l,y=>y.yValue)||0,x=(b-h)*.1||1;return {xScale:scale.scaleTime({range:[0,d],domain:f}),yScale:scale.scaleLinear({range:[u,0],domain:[h-x,b+x]})}},[l,d,u]);if(i.isLoading)return jsxRuntime.jsx("div",{className:"flex items-center",style:{width:d,height:u},children:jsxRuntime.jsx("div",{className:"h-1 w-full animate-pulse bg-border-default rounded"})});if(!l||l.length===0)return jsxRuntime.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 jsxRuntime.jsxs("svg",{width:d,height:u,className:"overflow-visible",children:[(r==="area"||r==="both")&&jsxRuntime.jsx(shape.AreaClosed,{data:l,x:f=>m(f.xValue),y:f=>p(f.yValue),yScale:p,fill:g,fillOpacity:.15,curve:curve.curveLinear}),(r==="line"||r==="both")&&jsxRuntime.jsx(shape.LinePath,{data:l,x:f=>m(f.xValue),y:f=>p(f.yValue),stroke:g,strokeWidth:n,strokeLinecap:"round",curve:curve.curveLinear})]})});Hu.displayName="SparklineCell";function yx({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:h}=r;if(h)return jsxRuntime.jsx(J,{className:nr(l)});let b=ul(e,a),x=Se(i,t),y=Se(f,t),v=b,S=false,w=false;if(d&&b&&typeof b=="string")if(typeof d=="boolean")w=true;else {let{position:R="end",length:H=16,ellipsis:G="...",tooltip:K=true}=d;if(b.length>H){switch(R){case "start":v=cs(b,H);break;case "middle":v=da(b,H);break;case "end":v=ds(b,H,G);break}S=K;}}let N=g&&y?{"data-pii-type":g,"data-pii-entity":y}:{},M=Object.keys(N).length>0,k=jsxRuntime.jsx("span",{className:w?"truncate":"",...N,children:v}),T=S?jsxRuntime.jsx(Zt,{content:M?jsxRuntime.jsx("span",{...N,children:String(b)}):String(b),children:k}):k,A=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o&&jsxRuntime.jsx("span",{className:"text-text-secondary",children:o}),T,n&&jsxRuntime.jsx("span",{className:"text-text-secondary",children:n})]}),E=A;if(u&&b&&b!==a){let R=typeof u=="function"?u(t):String(b);E=jsxRuntime.jsx(Oo,{value:R,size:"sm",children:A});}if(x){let R=Me(m,p);return jsxRuntime.jsx("div",{className:R,children:ao(E,x,t,s,c,l)})}let D=Me(m,tailwindMerge.twMerge(Ar(l),p));return jsxRuntime.jsx("div",{className:D,children:E})}var EP={sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"},DP={sm:"hidden sm:grid",md:"hidden md:grid",lg:"hidden lg:grid",xl:"hidden xl:grid"};function vl(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function Cl(e,t,r,o){if(r.cell){let n=r.cell,a=typeof r.cellProps=="function"?r.cellProps(e,t):r.cellProps;return jsxRuntime.jsx(n,{value:e,row:t,context:o,...a})}return r.render?r.render(e,t,o):e?.toString()??"\u2014"}function wl({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 jsxRuntime.jsxs("div",{className:tailwindMerge.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&&jsxRuntime.jsxs("div",{className:"mb-2 flex items-start justify-between",children:[jsxRuntime.jsx("div",{className:"flex-1",children:i.map(u=>{let m=vl(e,u);return jsxRuntime.jsx("div",{className:"font-medium text-text-primary [&>*]:!justify-start [&>*]:!text-left",children:Cl(m,e,u,l)},u.id)})}),c.length>0&&jsxRuntime.jsx("div",{className:"ml-2 flex flex-wrap gap-1",children:c.map(u=>{let m=vl(e,u);return jsxRuntime.jsx("div",{className:"inline-flex",children:Cl(m,e,u,l)},u.id)})})]}),s.length>0&&jsxRuntime.jsx("div",{className:"space-y-1",children:s.map(u=>{let m=vl(e,u),p=u.showLabel&&u.label;return jsxRuntime.jsxs("div",{className:"flex items-center text-sm text-text-secondary",children:[u.icon&&jsxRuntime.jsx(B,{name:u.icon,className:"mr-1.5 h-4 w-4 flex-shrink-0"}),p&&jsxRuntime.jsxs("span",{className:"mr-1 font-medium",children:[u.label,":"]}),jsxRuntime.jsx("span",{className:"truncate [&>*]:!justify-start [&>*]:!text-left",children:Cl(m,e,u,l)})]},u.id)})})]})}function Nl({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 jsxRuntime.jsx("div",{className:tailwindMerge.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:jsxRuntime.jsx("div",{className:"space-y-2",children:a.map((c,l)=>{let d=vl(e,c),u=l===0;return jsxRuntime.jsxs("div",{children:[!u&&jsxRuntime.jsx("div",{className:"text-xs text-text-secondary",children:c.label}),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(u?"font-medium text-text-primary":"text-sm text-text-primary","[&>*]:!justify-start [&>*]:!text-left"),children:Cl(d,e,c,i)})]},c.id)})})})}function vx(e="md"){return {mobile:EP[e],desktop:DP[e]}}function Cx({density:e}){return jsxRuntime.jsxs("div",{className:tailwindMerge.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:[jsxRuntime.jsx("div",{className:"mb-2 h-5 w-3/4 animate-pulse rounded bg-background-muted"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-4 w-1/2 animate-pulse rounded bg-background-muted"}),jsxRuntime.jsx("div",{className:"h-4 w-2/3 animate-pulse rounded bg-background-muted"})]})]})}var KP={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},YP={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"};function JP(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 XP({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}=sortable.useSortable({id:e.id,disabled:!c||s}),f=t?.columnId===e.id,h=f?t.direction:null,b=n&&a,x={...JP(e),transform:utilities.CSS.Transform.toString(m),transition:p,opacity:g?.8:1,zIndex:g?50:void 0};return jsxRuntime.jsx("div",{ref:u,className:tailwindMerge.twMerge("flex items-center border-b border-border-default bg-background-surface",e.sortable?"gap-2":"gap-1",KP[i],YP[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:x,role:"columnheader","aria-sort":f?h==="asc"?"ascending":"descending":"none","aria-disabled":s,...l,...d,children:s?jsxRuntime.jsx(J,{className:"h-4 w-24"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1 truncate cursor-pointer",onClick:()=>!s&&e.sortable&&r(e.id),children:e.label}),e.sortable&&jsxRuntime.jsx("button",{type:"button",className:"flex flex-shrink-0 cursor-pointer",onClick:()=>!s&&r(e.id),"aria-label":`Sort by ${e.label}`,children:f?jsxRuntime.jsx(B,{name:h==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-primary"}):jsxRuntime.jsx(B,{name:"CaretUpDown",size:12,className:"text-text-secondary opacity-40"})})]})})}function wx({columns:e,columnOrder:t,onColumnOrderChange:r,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,density:s="default",isLoading:c=false}){let l=core.useSensors(core.useSensor(core.PointerSensor,{activationConstraint:{distance:5}}),core.useSensor(core.KeyboardSensor,{coordinateGetter:sortable.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 h=t.indexOf(g.id),b=t.indexOf(f.id);if(d.get(f.id)?.reorderable===false)return;let y=0;for(let N=0;N<t.length&&d.get(t[N])?.reorderable===false;N++)y=N+1;if(b<y)return;let v=Math.min(h,b),S=Math.max(h,b);for(let N=v;N<=S;N++){if(N===h)continue;if(d.get(t[N])?.reorderable===false)return}let w=sortable.arrayMove(t,h,b);r(w);}},m=t.map(p=>d.get(p)).filter(p=>p!==void 0);return jsxRuntime.jsx(core.DndContext,{sensors:l,collisionDetection:core.closestCenter,onDragEnd:u,children:jsxRuntime.jsx(sortable.SortableContext,{items:t,strategy:sortable.horizontalListSortingStrategy,children:jsxRuntime.jsx("div",{className:"contents",role:"rowgroup",children:m.map((p,g)=>jsxRuntime.jsx(XP,{column:p,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,isFirstColumn:g===0,density:s,isLoading:c},p.id))})})})}var Ku={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},Yu={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"},$P={full:"w-full",auto:"w-auto inline-block",contained:"w-full max-w-6xl mx-auto"},e2={auto:"table-auto",fixed:"table-fixed",responsive:"table-auto"};function Ju(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 t2(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function r2({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 jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex items-center border-b border-border-default bg-background-surface",e.sortable?"gap-2":"gap-1",Ku[i],Yu[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:Ju(e),children:s?jsxRuntime.jsx(J,{className:"h-4 w-24"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate",children:e.label}),e.sortable&&jsxRuntime.jsx("div",{className:"flex flex-shrink-0",children:c?jsxRuntime.jsx(B,{name:l==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-primary"}):jsxRuntime.jsx(B,{name:"CaretUpDown",size:12,className:"text-text-secondary opacity-40"})})]})})}function o2({column:e,row:t,rowIndex:r,columnIndex:o,isHovered:n,density:a="default",className:i,stickyFirstColumn:s}){let c=s&&o===0,l=t2(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=jsxRuntime.jsx(m,{value:l,row:t,context:d,...p});}else e.render?u=e.render(l,t,d):u=jsxRuntime.jsx("span",{className:"truncate",children:l?.toString()??""});if(e.popover){let m=e.popover,p,g="top",f=false,h="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,h=m.trigger||"hover"),u=jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{...h==="hover"?{trigger:"longPress"}:{},children:[jsxRuntime.jsx("div",{className:"cursor-help",children:u}),jsxRuntime.jsx(lt,{placement:g,showArrow:f,children:jsxRuntime.jsx("div",{className:"p-2",children:p})})]});}return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex items-center border-b border-border-default bg-background-surface",e.noCellPadding?"":Ku[a],Yu[e.align||"left"],c&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",i),role:"cell",style:Ju(e),children:u})}function n2({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=jsxRuntime.jsx(c,{value:null,row:{},context:i,...l});}else e.render?s=e.render(null,{},i):s=jsxRuntime.jsx(J,{className:"h-4 w-full max-w-[200px]"});return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex items-center border-b border-border-default bg-background-surface",e.noCellPadding?"":Ku[o],Yu[e.align||"left"],a&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),role:"cell",style:Ju(e),children:s})}function a2(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 Nx({columns:e,row:t,rowIndex:r,density:o="default",onClick:n,stickyFirstColumn:a}){let[i,s]=Oe.useState(false),c=Oe.useCallback(l=>{if(!n)return;let d=l.target,u=l.currentTarget;a2(d,u)||n(t);},[n,t]);return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("contents group",n&&"cursor-pointer"),role:"row",onClick:c,onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),children:e.map((l,d)=>jsxRuntime.jsx(o2,{column:l,row:t,rowIndex:r,columnIndex:d,isHovered:i,density:o,className:n?"group-hover:bg-background-hover":"",stickyFirstColumn:a},l.id))})}function kx({columns:e,rowIndex:t,density:r="default",stickyFirstColumn:o}){return jsxRuntime.jsx("div",{className:"contents",role:"row",children:e.map((n,a)=>jsxRuntime.jsx(n2,{column:n,rowIndex:t,columnIndex:a,density:r,stickyFirstColumn:o},n.id))})}function Tx({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:h,estimatedRowHeight:b,loadingIndicator:x,stickyHeader:y=false,stickyFirstColumn:v=false,onRowClick:S,getRowId:w,hideHeader:N=false,sortConfig:M,onSort:k,"aria-label":T,enableColumnReorder:A=false,columnOrder:E,onColumnOrderChange:D}){let[R,H]=Oe.useState(null),G=M!==void 0,K=G?M:R,W=Oe.useRef(null),q=Oe.useMemo(()=>e.map(te=>te.id),[e]),[j,Q]=Oe.useState(q),O=E!==void 0,L=O?E:j;Oe.useEffect(()=>{O||Q(te=>{let ne=e.map(ce=>ce.id),V=new Set(ne),z=new Set(te),le=te.filter(ce=>V.has(ce)),se=ne.filter(ce=>!z.has(ce));return [...le,...se]});},[e,O]);let Y=Oe.useCallback(te=>{O||Q(te),D?.(te);},[O,D]),P=Oe.useMemo(()=>{if(!A&&!E)return e;let te=new Map(e.map(ne=>[ne.id,ne]));return L.map(ne=>te.get(ne)).filter(ne=>ne!==void 0)},[e,L,A,E]),C=Fo({items:t,onLoadMore:g,hasMore:f,isLoading:u,loadingState:m,enableVirtualization:h,estimatedItemSize:b||(o==="compact"?40:o==="relaxed"?60:48),overscan:5}),I=g?C:null,F=I?.scrollRef??W,{loadMoreRef:U,virtualizer:$,virtualItems:ae,isLoadingMore:Z,computedLoadingState:ie}=I||{},{gridTemplateColumns:fe,totalMinWidth:re}=Oe.useMemo(()=>{let te=0;return {gridTemplateColumns:P.map(V=>{if(V.minWidth?te+=typeof V.minWidth=="number"?V.minWidth:0:V.width&&typeof V.width=="number"&&(te+=V.width),V.width)return typeof V.width=="number"?`${V.width}px`:V.width;if(V.flex)return `${V.flex}fr`;if(V.minWidth&&V.maxWidth){let z=typeof V.minWidth=="number"?`${V.minWidth}px`:V.minWidth,le=typeof V.maxWidth=="number"?`${V.maxWidth}px`:V.maxWidth;return `minmax(${z}, ${le})`}return V.minWidth?`minmax(${typeof V.minWidth=="number"?`${V.minWidth}px`:V.minWidth}, 1fr)`:V.maxWidth?`minmax(0, ${typeof V.maxWidth=="number"?`${V.maxWidth}px`:V.maxWidth})`:"1fr"}).join(" "),totalMinWidth:te}},[P]),de=Oe.useCallback(te=>{if(!e.find(z=>z.id===te)?.sortable)return;let V;K?.columnId===te?V={columnId:te,direction:K.direction==="asc"?"desc":"asc"}:V={columnId:te,direction:"asc"},G||H(V),k?.(V);},[e,K,k,G]),xe=ie==="loading"||u&&t.length===0,he={};a?(he.height=typeof a=="number"?`${a}px`:a,he.overflowY="auto"):i?(he.maxHeight=typeof i=="number"?`${i}px`:i,he.overflowY="auto"):g&&(he.height="600px",he.overflowY="auto");let Ee=tailwindMerge.twMerge($P[n],!g&&(s==="responsive"?"overflow-x-auto scrollbar-visible":"overflow-auto scrollbar-visible"),r),$e=vx(d),Eo=c!=="none",lr=(te,ne)=>Eo?c==="custom"&&l?l(te,ne):jsxRuntime.jsx(c==="cards"?Nl:wl,{row:te,columns:P,density:o,isLoading:u,onClick:S?()=>S(te):void 0}):null,ee=$?ae?.map(te=>({virtualItem:te,row:t[te.index],index:te.index}))||[]:t.map((te,ne)=>({row:te,index:ne,virtualItem:null}));return jsxRuntime.jsxs("div",{ref:F,className:Ee,style:{...he,position:$?"relative":void 0},children:[jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("grid border-separate border-spacing-0",e2[s],n==="auto"?"inline-grid w-auto":"w-full",Eo&&$e.desktop),role:"table","aria-label":T,style:{gridTemplateColumns:fe,minWidth:re>0?`${re}px`:void 0},children:[!N&&(A?jsxRuntime.jsx(wx,{columns:e,columnOrder:L,onColumnOrderChange:Y,sortConfig:K,onSort:de,stickyHeader:y,stickyFirstColumn:v,density:o,isLoading:xe}):jsxRuntime.jsx("div",{className:"contents",role:"rowgroup",children:P.map((te,ne)=>jsxRuntime.jsx(r2,{column:te,sortConfig:K,onSort:de,stickyHeader:y,stickyFirstColumn:v,isFirstColumn:ne===0,density:o,isLoading:xe},te.id))})),$?jsxRuntime.jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1",height:`${$.getTotalSize()}px`,position:"relative"},role:"rowgroup",children:xe?Array.from({length:p}).map((te,ne)=>jsxRuntime.jsx("div",{className:"contents",children:jsxRuntime.jsx(kx,{columns:P,rowIndex:ne,density:o,stickyFirstColumn:v})},`loading-${ne}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ee.map(({row:te,index:ne,virtualItem:V})=>{if(!te||!V)return null;let z=w?w(te):`row-${ne}`;return jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",display:"grid",gridTemplateColumns:fe,transform:`translateY(${V.start}px)`},"data-index":V.index,ref:$.measureElement,children:jsxRuntime.jsx(Nx,{columns:P,row:te,rowIndex:ne,density:o,onClick:S,stickyFirstColumn:v})},z)}),Z&&jsxRuntime.jsx("div",{style:{position:"absolute",top:`${$.getTotalSize()}px`,left:0,width:"100%"},children:x||jsxRuntime.jsx(Nr,{state:"loading-more"})})]}):jsxRuntime.jsx("div",{className:"py-12 text-center text-text-secondary",children:"No data available"})}):jsxRuntime.jsx("div",{className:"contents",role:"rowgroup",children:xe?Array.from({length:p}).map((te,ne)=>jsxRuntime.jsx(kx,{columns:P,rowIndex:ne,density:o,stickyFirstColumn:v},`loading-${ne}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ee.map(({row:te,index:ne})=>{if(!te)return null;let V=w?w(te):`row-${ne}`;return jsxRuntime.jsx(Nx,{columns:P,row:te,rowIndex:ne,density:o,onClick:S,stickyFirstColumn:v},V)}),Z&&jsxRuntime.jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1"},children:x||jsxRuntime.jsx(Nr,{state:"loading-more"})})]}):jsxRuntime.jsx("div",{className:"col-span-full py-12 text-center text-text-secondary",role:"row",children:jsxRuntime.jsx("div",{role:"cell",children:"No data available"})})})]}),Eo&&jsxRuntime.jsx("div",{className:$e.mobile,children:xe?Array.from({length:p}).map((te,ne)=>jsxRuntime.jsx(Cx,{density:o},`mobile-loading-${ne}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ee.map(({row:te,index:ne})=>{if(!te)return null;let V=w?w(te):`mobile-row-${ne}`;return jsxRuntime.jsx("div",{className:"border-b border-border-default last:border-b-0",children:lr(te,ne)},V)}),Z&&(x||jsxRuntime.jsx(Nr,{state:"loading-more"}))]}):jsxRuntime.jsx("div",{className:"py-12 text-center text-text-secondary",children:"No data available"})}),g&&f&&!xe&&($?jsxRuntime.jsx("div",{ref:U,style:{position:"absolute",top:`${$.getTotalSize()}px`,left:0,width:"100%",height:1}}):jsxRuntime.jsx("div",{ref:U,className:"h-px w-full"}))]})}function Rx({status:e,alertCount:t,showCount:r=false,isLoading:o,size:n="sm",shape:a="pill",...i}){if(o)return jsxRuntime.jsx(J,{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 jsxRuntime.jsx(nt,{variant:s[e],size:n,shape:a,dot:l,dotPulse:l,...i,children:d})}var s2={battery:"BatteryHigh",charger:"ChargingStation",thermostat:"ThermometerSimple",inverter:"Power",vehicle:"Car",water_heater:"DropHalfBottom",meter:"Gauge",gateway:"WifiHigh",other:"Cube",unknown:"Question"},l2={battery:"Battery",charger:"Charger",thermostat:"Thermostat",inverter:"Inverter",vehicle:"Vehicle",water_heater:"Water Heater",meter:"Meter",gateway:"Gateway",other:"Other",unknown:"Unknown"};function Ex({deviceType:e,iconName:t,size:r="md",showLabel:o=false,className:n}){let a=t||(e?s2[e]:"Question"),i=e?l2[e]:void 0;return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("inline-flex items-center",o?"flex-col gap-1":"gap-0",n),children:[jsxRuntime.jsx(B,{name:a,size:r}),o&&i&&jsxRuntime.jsx("span",{className:"text-xs text-text-secondary",children:i})]})}function Ei({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:h=true,maxWidth:b="400px"}){if(!s)return null;let x=t||r,y=m||p||g||f;return jsxRuntime.jsx(zr,{children:jsxRuntime.jsx(cr,{isOpen:s,onOpenChange:v=>!v&&d?.(),isDismissable:true,transparent:l,children:jsxRuntime.jsx(reactAriaComponents.Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxRuntime.jsxs(reactAriaComponents.Dialog,{className:tailwindMerge.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:[x&&(a&&i?jsxRuntime.jsx(Ht,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,hasBackArrow:true,onBack:i,onClose:d}):jsxRuntime.jsx(Ht,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,onClose:d})),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-1 overflow-y-auto overscroll-contain",h?"px-6 py-6":"p-0"),children:e}),y&&jsxRuntime.jsx(Io,{primaryAction:m,secondaryAction:p,tertiaryAction:g,footerContent:f})]})})})})}Ei.displayName="Drawer";function Lx({status:e,programName:t,isLoading:r,size:o="sm",shape:n="pill",...a}){if(r)return jsxRuntime.jsx(J,{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=jsxRuntime.jsx(nt,{variant:i[e],size:o,shape:n,...a,children:s[e]});return t?jsxRuntime.jsx(Zt,{content:t,children:c}):c}function Ix({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]=Oe.useState(false),[m,p]=Oe.useState(false),[g,f]=Oe.useState(null),[h,b]=Oe.useState(e),x=Oe.useRef(null),y=async w=>{if(f(null),n&&w.size>n){f(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(c&&w.type.startsWith("image/")){let N=new FileReader;N.onloadend=()=>{b(N.result);},N.readAsDataURL(w);}if(i){p(true);try{let N=await i(w);b(N),r?.(N);}catch(N){f("Failed to upload file"),console.error("Upload error:",N);}finally{p(false);}}t?.(w,h);},v=async w=>{try{let N=w.items;if(N.length>0){let M=N[0];if(M.kind==="file"){let k=await M.getFile();k&&y(k);}}}catch(N){f("Failed to upload file"),console.error("Upload error:",N);}finally{u(false);}},S=()=>{b(void 0),f(null),t?.(null),r?.(""),x.current&&(x.current.value="");};return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("w-full",s),children:[jsxRuntime.jsxs(reactAriaComponents.DropZone,{className:tailwindMerge.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:[h?jsxRuntime.jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[c&&(h.startsWith("data:image")||h.startsWith("http"))?jsxRuntime.jsx("img",{src:h,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Image,{className:"h-12 w-12 text-text-secondary"}),jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!a&&jsxRuntime.jsx(_,{variant:"icon",size:"sm",onPress:S,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsxRuntime.jsx(lucideReact.Upload,{className:"h-12 w-12 text-text-secondary"}),jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-sm text-text-primary",children:l}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:o==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${o}`})]}),jsxRuntime.jsx(reactAriaComponents.FileTrigger,{acceptedFileTypes:o.split(","),onSelect:w=>{let N=Array.from(w||[]);N.length>0&&y(N[0]);},children:jsxRuntime.jsx(_,{variant:"secondary",size:"sm",isDisabled:a,children:"Choose File"})})]}),m&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),g&&jsxRuntime.jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function Bx({version:e,isLatest:t,updateAvailable:r,isLoading:o,size:n="sm",shape:a="rounded",...i}){if(o)return jsxRuntime.jsx(J,{className:"inline-flex h-6 w-16"});let s="neutral",c=e;return t?s="success":r&&(s="warning",c=`${e} (Update)`),jsxRuntime.jsx(nt,{variant:s,size:n,shape:a,...i,children:c})}function Ia(e){return jsxRuntime.jsx(reactAriaComponents.Form,{validationBehavior:"aria",...e,className:tailwindMerge.twMerge("flex flex-col gap-6",e.className)})}function zx({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]=Oe.useState(false),m=Jt("(max-width: 767px)"),p=o!==void 0?o:d,g=Oe.useCallback(x=>{n?n(x):u(x);},[n]);Oe.useEffect(()=>{let x=y=>{(y.metaKey||y.ctrlKey)&&y.key==="k"&&(y.preventDefault(),g(!p)),y.key==="Escape"&&p&&g(false);};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[p,g]);let f=Oe.useCallback(x=>{r?.(x);},[r]),h=jsxRuntime.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:[jsxRuntime.jsx(B,{name:"MagnifyingGlass",size:18}),!m&&s&&jsxRuntime.jsxs("span",{className:"hidden md:flex items-center gap-1 text-xs",children:[jsxRuntime.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"}),jsxRuntime.jsx("kbd",{className:"px-1.5 py-0.5 bg-background-muted border border-border-muted rounded text-xs",children:"K"})]})]}),b=a===null||Oe.isValidElement(a)&&a.type===Oe.Fragment&&!a.props.children;return m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!b&&(a?jsxRuntime.jsx("button",{type:"button",onClick:()=>g(true),className:"appearance-none bg-transparent border-none p-0 cursor-pointer",children:a}):jsxRuntime.jsx("button",{type:"button",onClick:()=>g(true),className:"appearance-none bg-transparent border-none p-0 cursor-pointer",children:h})),jsxRuntime.jsx(ct,{isOpen:p,onClose:()=>g(false),hideCloseIcon:false,contentPadding:false,maxHeight:"90vh",children:jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[c&&jsxRuntime.jsx("div",{className:"p-4 border-b border-border-muted flex-shrink-0",children:jsxRuntime.jsx(Lr,{value:t,onChange:f,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:l,autoFocus:true})}),jsxRuntime.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:i})]})})]}):b?null:jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:p,onOpenChange:g,children:[a||h,jsxRuntime.jsx(lt,{placement:"bottom",className:"w-[600px] max-w-[90vw] bg-background-surface shadow-xl border border-border-default rounded-lg overflow-hidden",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[c&&jsxRuntime.jsx("div",{className:"p-4 border-b border-border-muted",children:jsxRuntime.jsx(Lr,{value:t,onChange:f,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:l,autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[500px] overflow-hidden",children:i})]})})]})}function Wx({placeholder:e="Search...",value:t,onChange:r,isOpen:o,onOpenChange:n,children:a,maxHeight:i="400px",variant:s="default",className:c}){let[l,d]=Oe.useState(false),u=Jt("(max-width: 767px)"),m=Oe.useRef(null),p=Oe.useRef(null),g=o!==void 0?o:l,f=Oe.useCallback(T=>{n?n(T):d(T);},[n]);Oe.useEffect(()=>{let T=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),f(!g)),A.key==="Escape"&&g&&f(false);};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[g,f]),Oe.useEffect(()=>{g&&!u&&m.current&&setTimeout(()=>{m.current?.querySelector("input")?.focus();},0);},[g,u]),Oe.useEffect(()=>{if(!g||u)return;let T=A=>{let E=A.target,D=m.current?.contains(E),R=p.current?.contains(E);!D&&!R&&f(false);};return document.addEventListener("mousedown",T,true),()=>document.removeEventListener("mousedown",T,true)},[g,u,f]);let h=T=>{r?.(T);},b=Oe.useCallback(()=>{f(false);},[f]),x=Oe.useCallback(()=>{r?.("");},[r]),[y,v]=Oe.useState(null);Oe.useEffect(()=>{if(g&&!u&&m.current){let T=null,A=()=>{let D=m.current?.getBoundingClientRect();D&&v({top:D.bottom+8,left:D.left,width:D.width});},E=()=>{T===null&&(T=requestAnimationFrame(()=>{A(),T=null;}));};return A(),window.addEventListener("resize",E),window.addEventListener("scroll",E,true),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,true),T!==null&&cancelAnimationFrame(T);}}},[g,u]);let S=Oe.useCallback(()=>{f(true);},[f]);if(u)return jsxRuntime.jsxs("div",{className:c,children:[jsxRuntime.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:jsxRuntime.jsx(B,{name:"MagnifyingGlass",size:"md"})}),jsxRuntime.jsxs(ct,{isOpen:g,onClose:b,contentPadding:false,height:"80vh",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-4 pt-4",children:[jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsx(Lr,{value:t,onChange:h,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:x,reserveErrorSpace:false,autoFocus:true})}),jsxRuntime.jsx(_,{variant:"icon",onPress:b,"aria-label":"Close search",className:"flex-shrink-0",children:jsxRuntime.jsx(B,{name:"X",size:"md"})})]}),jsxRuntime.jsx("div",{className:"mt-4",children:a})]})]},"mobile");let w=T=>{let E=T.target.tagName==="INPUT";if(T.key==="ArrowDown"&&g&&E){T.preventDefault();let D=p.current?.querySelector("[data-search-result]");D&&D.focus();}},N=T=>{let A=T.target;if(!A.hasAttribute("data-search-result"))return;let D=Array.from(p.current?.querySelectorAll("[data-search-result]")||[]),R=D.indexOf(A);if(T.key==="ArrowDown"){T.preventDefault(),T.stopPropagation();let H=Math.min(R+1,D.length-1);D[H]?.focus();}else if(T.key==="ArrowUp")if(T.preventDefault(),T.stopPropagation(),R===0)m.current?.querySelector("input")?.focus();else {let H=Math.max(R-1,0);D[H]?.focus();}else T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),f(false),m.current?.querySelector("input")?.focus());},M=g&&y&&typeof document<"u"?reactDom.createPortal(jsxRuntime.jsx("div",{ref:p,style:{position:"fixed",top:`${y.top}px`,left:`${y.left}px`,width:`${y.width}px`,zIndex:9999},role:"listbox",onKeyDown:N,children:jsxRuntime.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:jsxRuntime.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 jsxRuntime.jsxs("div",{ref:m,className:`relative w-full ${c||""}`,onKeyDown:w,children:[jsxRuntime.jsx(Lr,{value:t,onChange:h,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:k,onFocus:()=>f(true)}),M]},"desktop")}function Gx({message:e="No results found",suggestion:t,icon:r="MagnifyingGlass",className:o=""}){return jsxRuntime.jsxs("div",{className:`flex flex-col items-center justify-center py-12 px-4 text-center ${o}`,children:[jsxRuntime.jsx("div",{className:"text-text-secondary mb-3",children:jsxRuntime.jsx(B,{name:r,size:48})}),jsxRuntime.jsx("p",{className:"text-base font-medium text-text-primary mb-1",children:e}),t&&jsxRuntime.jsx("p",{className:"text-sm text-text-secondary max-w-xs",children:t})]})}function Kx({count:e=3,className:t=""}){return jsxRuntime.jsx("div",{className:`flex flex-col ${t}`,children:Array.from({length:e}).map((r,o)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[jsxRuntime.jsx(J,{width:20,height:20,variant:"circle"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[jsxRuntime.jsx(J,{width:"60%",height:16}),jsxRuntime.jsx(J,{width:"40%",height:12})]}),jsxRuntime.jsx(J,{width:16,height:16})]},o))})}function Jx({title:e,count:t,isLoading:r,footer:o,children:n,className:a}){return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex flex-col",a),children:[jsxRuntime.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:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:e}),!r&&t!==void 0&&jsxRuntime.jsx("span",{className:"text-xs text-text-secondary",children:t}),r&&jsxRuntime.jsx("span",{className:"text-xs text-text-secondary animate-pulse",children:"Loading..."})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:n}),o&&jsxRuntime.jsx("div",{className:"px-4 py-2 border-t border-border-subtle",children:o})]})}function Xx({id:e,title:t,subtitle:r,metadata:o,icon:n,customIcon:a,onSelect:i,isFocused:s=false,className:c,testId:l}){return jsxRuntime.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 h=document.querySelector('input[type="text"][placeholder*="Search"]');h&&h.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:tailwindMerge.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?jsxRuntime.jsx("div",{className:"flex-shrink-0",children:a}):n?jsxRuntime.jsx("div",{className:"flex-shrink-0 text-text-secondary",children:jsxRuntime.jsx(B,{name:n,size:20})}):null,jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-baseline gap-2",children:[jsxRuntime.jsx("span",{className:"font-medium text-text-primary truncate",children:t}),o&&jsxRuntime.jsx("span",{className:"text-xs text-text-secondary flex-shrink-0",children:o})]}),r&&jsxRuntime.jsx("div",{className:"text-sm text-text-secondary truncate mt-0.5",children:r})]}),jsxRuntime.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:jsxRuntime.jsx(B,{name:"ArrowRight",size:16,className:"text-text-secondary"})})]})}function jx({children:e,maxHeight:t="400px",className:r}){return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-y-auto overscroll-contain","divide-y divide-border-muted",r),style:{maxHeight:t},children:e})}function Qx({placeholder:e="Search...",onClick:t,showShortcut:r=true,variant:o="default",className:n=""}){let a=typeof navigator<"u"&&navigator.platform.includes("Mac");return jsxRuntime.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
|
|
31
31
|
${{default:`
|