@texturehq/edges 1.30.3 → 1.30.4

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 CHANGED
@@ -92,7 +92,7 @@ Valid keys: `+JSON.stringify(Object.keys(w),null," "));var E=B(G,S,F,K,X+"."+S,
92
92
  });
93
93
  }
94
94
  })();
95
- `}})]})}var Xi={prefix:String(Math.round(Math.random()*1e10)),current:0},df=Me__namespace.default.createContext(Xi),BC=Me__namespace.default.createContext(false);var zC=!!(typeof window<"u"&&window.document&&window.document.createElement),sd=new WeakMap;function VC(e=false){let t=Me.useContext(df),r=Me.useRef(null);if(r.current===null&&!e){var o,n;let a=(n=Me__namespace.default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||n===void 0||(o=n.ReactCurrentOwner)===null||o===void 0?void 0:o.current;if(a){let i=sd.get(a);i==null?sd.set(a,{id:t.current,state:a.memoizedState}):a.memoizedState!==i.state&&(t.current=i.id,sd.delete(a));}r.current=++t.current;}return r.current}function OC(e){let t=Me.useContext(df);t===Xi&&!zC&&process.env.NODE_ENV!=="production"&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let r=VC(!!e),o=t===Xi&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${t.prefix}`;return e||`${o}-${r}`}function HC(e){let t=Me__namespace.default.useId(),[r]=Me.useState($i()),o=r||process.env.NODE_ENV==="test"?"react-aria":`react-aria${Xi.prefix}`;return e||`${o}-${t}`}typeof Me__namespace.default.useId=="function"?HC:OC;function GC(){return false}function UC(){return true}function YC(e){return ()=>{}}function $i(){return typeof Me__namespace.default.useSyncExternalStore=="function"?Me__namespace.default.useSyncExternalStore(YC,GC,UC):Me.useContext(BC)}function uf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Qi(e,t,r){uf(e,t),t.set(e,r);}var KC=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),JC=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function cd(e){if(Intl.Locale){let r=new Intl.Locale(e).maximize(),o=typeof r.getTextInfo=="function"?r.getTextInfo():r.textInfo;if(o)return o.direction==="rtl";if(r.script)return KC.has(r.script)}let t=e.split("-")[0];return JC.has(t)}var mf=Symbol.for("react-aria.i18n.locale");function ff(){let e=typeof window<"u"&&window[mf]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:cd(e)?"rtl":"ltr"}}var dd=ff(),wa=new Set;function pf(){dd=ff();for(let e of wa)e(dd);}function gf(){let e=$i(),[t,r]=Me.useState(dd);return Me.useEffect(()=>(wa.size===0&&window.addEventListener("languagechange",pf),wa.add(r),()=>{wa.delete(r),wa.size===0&&window.removeEventListener("languagechange",pf);}),[]),e?{locale:typeof window<"u"&&window[mf]||"en-US",direction:"ltr"}:t}var $C=Me__namespace.default.createContext(null);function ud(){let e=gf();return Me.useContext($C)||e}function _i(e,t){return e-t*Math.floor(e/t)}var bf=1721426;function es(e,t,r,o){t=rs(e,t);let n=t-1,a=-2;return r<=2?a=0:ts(t)&&(a=-1),bf-1+365*n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400)+Math.floor((367*r-362)/12+a+o)}function ts(e){return e%4===0&&(e%100!==0||e%400===0)}function rs(e,t){return e==="BC"?1-t:t}function QC(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}var _C={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]},tr=class{fromJulianDay(t){let r=t,o=r-bf,n=Math.floor(o/146097),a=_i(o,146097),i=Math.floor(a/36524),s=_i(a,36524),c=Math.floor(s/1461),l=_i(s,1461),d=Math.floor(l/365),u=n*400+i*100+c*4+d+(i!==4&&d!==4?1:0),[m,p]=QC(u),g=r-es(m,p,1,1),f=2;r<es(m,p,3,1)?f=0:ts(p)&&(f=1);let b=Math.floor(((g+f)*12+373)/367),x=r-es(m,p,b,1)+1;return new Go(m,p,b,x)}toJulianDay(t){return es(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return _C[ts(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return ts(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return ["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year);}constructor(){this.identifier="gregory";}};function md(e,t){var r,o,n,a;return (a=(n=(r=e.isEqual)===null||r===void 0?void 0:r.call(e,t))!==null&&n!==void 0?n:(o=t.isEqual)===null||o===void 0?void 0:o.call(t,e))!==null&&a!==void 0?a:e.identifier===t.identifier}function fd(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function hf(e,t){return xf(e)-xf(t)}function xf(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}var pd=null;function Uo(){return pd==null&&(pd=new Intl.DateTimeFormat().resolvedOptions().timeZone),pd}function po(e){e=Ut(e,new tr);let t=rs(e.era,e.year);return Cf(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Cf(e,t,r,o,n,a,i){let s=new Date;return s.setUTCHours(o,n,a,i),s.setUTCFullYear(e,t-1,r),s.getTime()}function bd(e,t){if(t==="UTC")return 0;if(e>0&&t===Uo()&&true)return new Date(e).getTimezoneOffset()*-6e4;let{year:r,month:o,day:n,hour:a,minute:i,second:s}=Sf(e,t);return Cf(r,o,n,a,i,s,0)-Math.floor(e/1e3)*1e3}var yf=new Map;function Sf(e,t){let r=yf.get(t);r||(r=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:false,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),yf.set(t,r));let o=r.formatToParts(new Date(e)),n={};for(let a of o)a.type!=="literal"&&(n[a.type]=a.value);return {year:n.era==="BC"||n.era==="B"?-n.year+1:+n.year,month:+n.month,day:+n.day,hour:n.hour==="24"?0:+n.hour,minute:+n.minute,second:+n.second}}var vf=864e5;function tS(e,t,r,o){return (r===o?[r]:[r,o]).filter(a=>rS(e,t,a))}function rS(e,t,r){let o=Sf(r,t);return e.year===o.year&&e.month===o.month&&e.day===o.day&&e.hour===o.hour&&e.minute===o.minute&&e.second===o.second}function ur(e,t,r="compatible"){let o=Pr(e);if(t==="UTC")return po(o);if(t===Uo()&&r==="compatible"&&true){o=Ut(o,new tr);let c=new Date,l=rs(o.era,o.year);return c.setFullYear(l,o.month-1,o.day),c.setHours(o.hour,o.minute,o.second,o.millisecond),c.getTime()}let n=po(o),a=bd(n-vf,t),i=bd(n+vf,t),s=tS(o,t,n-a,n-i);if(s.length===1)return s[0];if(s.length>1)switch(r){case "compatible":case "earlier":return s[0];case "later":return s[s.length-1];case "reject":throw new RangeError("Multiple possible absolute times found")}switch(r){case "earlier":return Math.min(n-a,n-i);case "compatible":case "later":return Math.max(n-a,n-i);case "reject":throw new RangeError("No such absolute time found")}}function xd(e,t,r="compatible"){return new Date(ur(e,t,r))}function rr(e,t){let r=bd(e,t),o=new Date(e+r),n=o.getUTCFullYear(),a=o.getUTCMonth()+1,i=o.getUTCDate(),s=o.getUTCHours(),c=o.getUTCMinutes(),l=o.getUTCSeconds(),d=o.getUTCMilliseconds();return new Fn(n<1?"BC":"AD",n<1?-n+1:n,a,i,t,r,s,c,l,d)}function os(e,t){return rr(e.getTime(),t)}function Pr(e,t){let r=0,o=0,n=0,a=0;if("timeZone"in e)({hour:r,minute:o,second:n,millisecond:a}=e);else if("hour"in e&&true)return e;return new Na(e.calendar,e.era,e.year,e.month,e.day,r,o,n,a)}function Ut(e,t){if(md(e.calendar,t))return e;let r=t.fromJulianDay(e.calendar.toJulianDay(e)),o=e.copy();return o.calendar=t,o.era=r.era,o.year=r.year,o.month=r.month,o.day=r.day,Ur(o),o}function hd(e,t,r){if(e instanceof Fn)return e.timeZone===t?e:yd(e,t);let o=ur(e,t,r);return rr(o,t)}function wf(e){let t=po(e)-e.offset;return new Date(t)}function yd(e,t){let r=po(e)-e.offset;return Ut(rr(r,t),e.calendar)}var Ta=36e5;function Pa(e,t){let r=e.copy(),o="hour"in r?iS(r,t):0;vd(r,t.years||0),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e),r.month+=t.months||0,Cd(r),Nf(r),r.day+=(t.weeks||0)*7,r.day+=t.days||0,r.day+=o,nS(r),r.calendar.balanceDate&&r.calendar.balanceDate(r),r.year<1&&(r.year=1,r.month=1,r.day=1);let n=r.calendar.getYearsInEra(r);if(r.year>n){var a,i;let c=(a=(i=r.calendar).isInverseEra)===null||a===void 0?void 0:a.call(i,r);r.year=n,r.month=c?1:r.calendar.getMonthsInYear(r),r.day=c?1:r.calendar.getDaysInMonth(r);}r.month<1&&(r.month=1,r.day=1);let s=r.calendar.getMonthsInYear(r);return r.month>s&&(r.month=s,r.day=r.calendar.getDaysInMonth(r)),r.day=Math.max(1,Math.min(r.calendar.getDaysInMonth(r),r.day)),r}function vd(e,t){var r,o;!((r=(o=e.calendar).isInverseEra)===null||r===void 0)&&r.call(o,e)&&(t=-t),e.year+=t;}function Cd(e){for(;e.month<1;)vd(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,vd(e,1);}function nS(e){for(;e.day<1;)e.month--,Cd(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Cd(e);}function Nf(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day));}function Ur(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Nf(e);}function Tf(e){let t={};for(let r in e)typeof e[r]=="number"&&(t[r]=-e[r]);return t}function Sd(e,t){return Pa(e,Tf(t))}function as(e,t){let r=e.copy();return t.era!=null&&(r.era=t.era),t.year!=null&&(r.year=t.year),t.month!=null&&(r.month=t.month),t.day!=null&&(r.day=t.day),Ur(r),r}function ka(e,t){let r=e.copy();return t.hour!=null&&(r.hour=t.hour),t.minute!=null&&(r.minute=t.minute),t.second!=null&&(r.second=t.second),t.millisecond!=null&&(r.millisecond=t.millisecond),kf(r),r}function aS(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=ns(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=ns(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=ns(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=ns(e.hour,24),t}function kf(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23));}function ns(e,t){let r=e%t;return r<0&&(r+=t),r}function iS(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,aS(e)}function is(e,t,r,o){let n=e.copy();switch(t){case "era":{let s=e.calendar.getEras(),c=s.indexOf(e.era);if(c<0)throw new Error("Invalid era: "+e.era);c=Yr(c,r,0,s.length-1,o?.round),n.era=s[c],Ur(n);break}case "year":var a,i;!((a=(i=n.calendar).isInverseEra)===null||a===void 0)&&a.call(i,n)&&(r=-r),n.year=Yr(e.year,r,-1/0,9999,o?.round),n.year===-1/0&&(n.year=1),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e);break;case "month":n.month=Yr(e.month,r,1,e.calendar.getMonthsInYear(e),o?.round);break;case "day":n.day=Yr(e.day,r,1,e.calendar.getDaysInMonth(e),o?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(n),Ur(n),n}function wd(e,t,r,o){let n=e.copy();switch(t){case "hour":{let a=e.hour,i=0,s=23;if(o?.hourCycle===12){let c=a>=12;i=c?12:0,s=c?23:11;}n.hour=Yr(a,r,i,s,o?.round);break}case "minute":n.minute=Yr(e.minute,r,0,59,o?.round);break;case "second":n.second=Yr(e.second,r,0,59,o?.round);break;case "millisecond":n.millisecond=Yr(e.millisecond,r,0,999,o?.round);break;default:throw new Error("Unsupported field "+t)}return n}function Yr(e,t,r,o,n=false){if(n){e+=Math.sign(t),e<r&&(e=o);let a=Math.abs(t);t>0?e=Math.ceil(e/a)*a:e=Math.floor(e/a)*a,e>o&&(e=r);}else e+=t,e<r?e=o-(r-e-1):e>o&&(e=r+(e-o-1));return e}function Nd(e,t){let r;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let n=Pa(Pr(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});r=ur(n,e.timeZone);}else r=po(e)-e.offset;r+=t.milliseconds||0,r+=(t.seconds||0)*1e3,r+=(t.minutes||0)*6e4,r+=(t.hours||0)*36e5;let o=rr(r,e.timeZone);return Ut(o,e.calendar)}function Pf(e,t){return Nd(e,Tf(t))}function Rf(e,t,r,o){switch(t){case "hour":{let n=0,a=23;if(o?.hourCycle===12){let g=e.hour>=12;n=g?12:0,a=g?23:11;}let i=Pr(e),s=Ut(ka(i,{hour:n}),new tr),c=[ur(s,e.timeZone,"earlier"),ur(s,e.timeZone,"later")].filter(g=>rr(g,e.timeZone).day===s.day)[0],l=Ut(ka(i,{hour:a}),new tr),d=[ur(l,e.timeZone,"earlier"),ur(l,e.timeZone,"later")].filter(g=>rr(g,e.timeZone).day===l.day).pop(),u=po(e)-e.offset,m=Math.floor(u/Ta),p=u%Ta;return u=Yr(m,r,Math.floor(c/Ta),Math.floor(d/Ta),o?.round)*Ta+p,Ut(rr(u,e.timeZone),e.calendar)}case "minute":case "second":case "millisecond":return wd(e,t,r,o);case "era":case "year":case "month":case "day":{let n=is(Pr(e),t,r,o),a=ur(n,e.timeZone);return Ut(rr(a,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Df(e,t,r){let o=Pr(e),n=ka(as(o,t),t);if(n.compare(o)===0)return e;let a=ur(n,e.timeZone,r);return Ut(rr(a,e.timeZone),e.calendar)}var sS=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/;var lS=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Ra(e){let t=e.match(sS);if(!t)throw lS.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let r=new Go(Td(t[1],0,9999),Td(t[2],1,12),1);return r.day=Td(t[3],1,r.calendar.getDaysInMonth(r)),r}function Td(e,t,r){let o=Number(e);if(o<t||o>r)throw new RangeError(`Value out of range: ${t} <= ${o} <= ${r}`);return o}function Ef(e){return `${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function kd(e){let t=Ut(e,new tr),r;return t.era==="BC"?r=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):r=String(t.year).padStart(4,"0"),`${r}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Pd(e){return `${kd(e)}T${Ef(e)}`}function dS(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let r=Math.floor(e/36e5),o=Math.floor(e%36e5/6e4),n=Math.floor(e%36e5%6e4/1e3),a=`${t}${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`;return n!==0&&(a+=`:${String(n).padStart(2,"0")}`),a}function Mf(e){return `${Pd(e)}${dS(e.offset)}[${e.timeZone}]`}function Rd(e){let t=typeof e[0]=="object"?e.shift():new tr,r;if(typeof e[0]=="string")r=e.shift();else {let i=t.getEras();r=i[i.length-1];}let o=e.shift(),n=e.shift(),a=e.shift();return [t,r,o,n,a]}var uS=new WeakMap,Go=class e{copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day):new e(this.calendar,this.year,this.month,this.day)}add(t){return Pa(this,t)}subtract(t){return Sd(this,t)}set(t){return as(this,t)}cycle(t,r,o){return is(this,t,r,o)}toDate(t){return xd(this,t)}toString(){return kd(this)}compare(t){return fd(this,t)}constructor(...t){Qi(this,uS,{writable:true,value:void 0});let[r,o,n,a,i]=Rd(t);this.calendar=r,this.era=o,this.year=n,this.month=a,this.day=i,Ur(this);}};var pS=new WeakMap,Na=class e{copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return Pa(this,t)}subtract(t){return Sd(this,t)}set(t){return as(ka(this,t),t)}cycle(t,r,o){switch(t){case "era":case "year":case "month":case "day":return is(this,t,r,o);default:return wd(this,t,r,o)}}toDate(t,r){return xd(this,t,r)}toString(){return Pd(this)}compare(t){let r=fd(this,t);return r===0?hf(this,Pr(t)):r}constructor(...t){Qi(this,pS,{writable:true,value:void 0});let[r,o,n,a,i]=Rd(t);this.calendar=r,this.era=o,this.year=n,this.month=a,this.day=i,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Ur(this);}},mS=new WeakMap,Fn=class e{copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return Nd(this,t)}subtract(t){return Pf(this,t)}set(t,r){return Df(this,t,r)}cycle(t,r,o){return Rf(this,t,r,o)}toDate(){return wf(this)}toString(){return Mf(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-hd(t,this.timeZone).toDate().getTime()}constructor(...t){Qi(this,mS,{writable:true,value:void 0});let[r,o,n,a,i]=Rd(t),s=t.shift(),c=t.shift();this.calendar=r,this.era=o,this.year=n,this.month=a,this.day=i,this.timeZone=s,this.offset=c,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Ur(this);}};var Dd=new Map;function Ed(e){let{locale:t}=ud(),r=t+(e?Object.entries(e).sort((n,a)=>n[0]<a[0]?-1:1).join():"");if(Dd.has(r))return Dd.get(r);let o=new Intl.Collator(t,e);return Dd.set(r,o),o}function ss(e){let t=Ed({usage:"search",...e}),r=Me.useCallback((a,i)=>i.length===0?true:(a=a.normalize("NFC"),i=i.normalize("NFC"),t.compare(a.slice(0,i.length),i)===0),[t]),o=Me.useCallback((a,i)=>i.length===0?true:(a=a.normalize("NFC"),i=i.normalize("NFC"),t.compare(a.slice(-i.length),i)===0),[t]),n=Me.useCallback((a,i)=>{if(i.length===0)return true;a=a.normalize("NFC"),i=i.normalize("NFC");let s=0,c=i.length;for(;s+c<=a.length;s++){let l=a.slice(s,s+c);if(t.compare(i,l)===0)return true}return false},[t]);return Me.useMemo(()=>({startsWith:r,endsWith:o,contains:n}),[r,o,n])}var yS=({isEntering:e,isExiting:t,className:r})=>["max-w-[200px] group bg-slate-700 dark:bg-slate-600 border border-slate-800 dark:border-white/10 shadow-[inset_0_1px_0_0_theme(colors.gray.600)] dark:shadow-none text-white 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 Et({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)=>yS({...n,className:o})),children:[jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-slate-700 stroke-gray-800 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 dark:fill-slate-600 dark:stroke-white/10 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsxRuntime.jsx("path",{d:"M0 0 L4 4 L8 0"})})}),t]})]})}function nr(){let[e,t]=Me__namespace.default.useState(false),r=Me__namespace.default.useCallback((n,a)=>{t(true),a?.(n);},[]),o=Me__namespace.default.useCallback((n,a)=>{t(false),a?.(n);},[]);return {isFocused:e,handleFocus:r,handleBlur:o}}var ot=Me__namespace.default.forwardRef(({children:e,className:t},r)=>jsxRuntime.jsx("div",{ref:r,className:tailwindMerge.twMerge("relative w-full",t),children:e}));ot.displayName="InputWrapper";function Da({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-muted hover:text-text-body cursor-pointer",r),"aria-label":"Clear input",onMouseDown:o=>{o.preventDefault(),o.stopPropagation();},children:jsxRuntime.jsx(I,{name:"X",size:t==="sm"?16:20})})}function mo(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 Lf(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function vS(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 xt(e){let{isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:a="md",className:i}=e;return tailwindMerge.twMerge("w-full",mo({isInvalid:t,isDisabled:r,isFocused:o}),Lf({transparent:n,isDisabled:r}),Ae[a].text,Ae[a].height,Ae[a].padding,vS(a),i)}function CS(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",Lf({transparent:a,isDisabled:n}),Ae[t].height,mo({isFocused:r,isInvalid:o,isDisabled:n}),i)}function Ee({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(Ae[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-muted",children:jsxRuntime.jsx(I,{name:"Info",size:t==="sm"?16:20})}),d&&jsxRuntime.jsx("span",{className:"text-text-caption font-normal ml-1",children:o})]});return c&&l?jsxRuntime.jsx(Et,{content:l,children:u}):u}function Se({size:e="md",className:t,children:r,...o}){return jsxRuntime.jsx("div",{...o,className:tailwindMerge.twMerge("leading-[2.25] text-text-caption",Ae[e].text,t),children:r})}function pe({children:e,size:t="md",className:r}){return jsxRuntime.jsx("div",{role:"alert",className:tailwindMerge.twMerge(Ae[t].text,"text-feedback-error-text",r),children:e})}function cs({size:e="md",isInvalid:t,isDisabled:r,isFocused:o,transparent:n,className:a,...i}){return jsxRuntime.jsx("input",{className:xt({isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:e,className:a}),...i})}function If(e){let{children:t,...r}=e;return jsxRuntime.jsx("div",{...r,className:CS(e),children:typeof t=="function"?t(e):t})}function NS({children:e,...t}){return jsxRuntime.jsx(reactAriaComponents.ListBox,{...t,className:Ce(t.className,"outline-0"),children:e})}var zd=Me.createContext("md");function Of(){return Me.useContext(zd)}function Id(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-placeholder overflow-hidden text-ellipsis whitespace-nowrap ${Ae[e].text} ${t}`}function ES(){let e=Me__namespace.default.useCallback((r,o)=>{o?.(r);},[]),t=Me__namespace.default.useCallback((r,o)=>{o?.(r);},[]);return {handleFocus:e,handleBlur:t}}function Ko({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:b=false,placement:x="bottom start",shouldFlip:v=true,menuWidth:y="match",descriptionPlacement:C="below",useMobileTray:T=true,...P}){let[R,L]=Me.useState(null),[D,A]=Me.useState(null),[V,M]=Me.useState(false),w=c??R??l,{handleFocus:N,handleBlur:z}=ES(),{isMobile:W}=kt(),F=T&&W,K=Me__namespace.default.useMemo(()=>!i||!w||!n?null:Array.from(n).find(B=>B.id===w)??null,[i,w,n]),X=S=>{d&&S!==null&&d(S),d||L(S);},G=Me.useRef(null),U=Me.useRef(null),k=()=>{F&&M(!V);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.Select,{...P,selectedKey:w,defaultSelectedKey:l,onSelectionChange:X,placeholder:u,className:Ce(P.className,"group flex w-full flex-col"),ref:G,onOpenChange:S=>{F||(S&&U.current?A(U.current.offsetWidth):S||G.current?.blur());},children:({isDisabled:S,isInvalid:B,isOpen:E})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(Ee,{size:s,tooltip:p,description:C==="tooltip"||C==="inline"?t:void 0,descriptionPlacement:C,isRequired:g,children:e}),jsxRuntime.jsx(ot,{children:jsxRuntime.jsx("div",{ref:U,children:jsxRuntime.jsxs(Q,{variant:"unstyled",className:tailwindMerge.twMerge(xt({isInvalid:B||m&&!!r,isDisabled:S,isFocused:F?V:E,transparent:f,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:h=>N(h,P.onFocus),onBlur:h=>z(h,P.onBlur),onPress:F?k:void 0,"data-open":F?V:E,children:[i&&K?jsxRuntime.jsx("div",{className:Id(s),children:i(K)}):F&&w?jsxRuntime.jsx("div",{className:Id(s),children:n?Array.from(n).find(H=>H.id===w)?.label:String(w)}):jsxRuntime.jsx(reactAriaComponents.SelectValue,{className:Id(s)}),jsxRuntime.jsx(I,{name:"CaretDown","aria-hidden":true,className:tailwindMerge.twMerge("h-4 w-4 text-text-body group-disabled:text-gray-200 forced-colors:text-[ButtonText] transition-transform",(F?V:E)&&"rotate-180")})]})})}),b?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:m?jsxRuntime.jsx(pe,{size:s,className:"text-feedback-error-text",children:typeof r=="function"&&P.validationResult?r(P.validationResult):typeof r=="string"?r:null}):t&&C==="below"?jsxRuntime.jsx(Se,{size:s,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:m?jsxRuntime.jsx(pe,{size:s,className:"mt-1 text-feedback-error-text",children:typeof r=="function"&&P.validationResult?r(P.validationResult):typeof r=="string"?r:null}):t&&C==="below"?jsxRuntime.jsx(Se,{size:s,className:"mt-1",children:t}):null}),F?null:jsxRuntime.jsx(Ze,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:y==="match"&&D?`${D}px`:void 0,minWidth:y==="auto"&&D?`${D}px`:void 0,maxWidth:y==="auto"?"min(600px, 90vw)":void 0},placement:x,shouldFlip:v,children:jsxRuntime.jsx(zd.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?h=>jsxRuntime.jsx(Mt,{id:h.id,textValue:h.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(h)})},h.id):o})})})]})}),F&&jsxRuntime.jsx(Xe,{isOpen:V,onClose:()=>M(false),title:e??"Select an option",contentPadding:false,children:jsxRuntime.jsx(zd.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:w!=null?[w]:[],onSelectionChange:S=>{let B=Array.from(S)[0];B!=null&&(X(B),M(false));},children:a&&n?S=>jsxRuntime.jsx(Mt,{id:S.id,textValue:S.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(S)})},S.id):o})})})]})}function Mt({size:e,className:t,...r}){let o=Of(),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-body 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",Ae[n].paddingY,Ae[n].text,t)})}var WS=[],GS={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},US={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Wf={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},Od=(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 YS(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 KS(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 ms({label:e,staticItems:t=WS,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:b,showErrors:x=true,renderItem:v,renderLeftIcon:y,renderSection:C,autoFocus:T=false,reserveErrorSpace:P=false,hideChevron:R=false,useMobileTray:L=true,className:D}){let A=Me__namespace.default.useRef(null),V=Me__namespace.default.useRef(null),[M,w]=Me__namespace.default.useState(),[N,z]=Me.useState(()=>Od(o||n,t,r)),[W,F]=Me.useState(false),[K,X]=Me.useState(false),G=no(N),{contains:U}=ss({sensitivity:"base"}),[k,S]=Me.useState(),{isMobile:B}=kt(),E=L&&B,h=Ae[u].text,O=reactStately.useAsyncList({async load({signal:ie,filterText:ue=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(ue))return {items:[]};try{let ge;return i.requestType==="GraphQL"?ge=await KS(i,ue,ie):ge=await YS(i,ue,ie),S(ge.error),{items:ge.items}}catch(ge){return ge instanceof Error&&ge.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ge),S(ge instanceof Error?ge.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),H=i&&G!==""?O:null,j=false,oe=Me.useRef("");Me.useEffect(()=>{T&&F(true);},[T]),Me.useEffect(()=>{let ie=Od(o,t,r);ie!==N&&z(ie);},[o,t,r]),Me.useEffect(()=>{let ie=()=>{A.current&&w(A.current.offsetWidth);};return ie(),window.addEventListener("resize",ie),()=>window.removeEventListener("resize",ie)},[]),Me.useEffect(()=>{G===""?oe.current="":H&&G!==oe.current&&(oe.current=G,H.setFilterText(G));},[G,H]),j=Pi(!!H?.isLoading,300);let me=Me__namespace.default.useMemo(()=>{if(!E||!N)return H?H.items:t;let ie=H?H.items:t,ue=s||U;return ie.filter(ge=>ue(ge.name,N))},[E,N,H,t,s,U]),q=ie=>{let ue=Od(ie,t,r);z(ue),a&&a(ie);},ne=ie=>{z(ie);},Te=()=>{E&&X(true);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.ComboBox,{onSelectionChange:q,selectedKey:o||void 0,defaultSelectedKey:n||void 0,defaultItems:r?r.flatMap(ie=>ie.items):t,items:H?H.items:void 0,className:Ce(D,"group flex flex-col w-full"),menuTrigger:E?"manual":"focus",isDisabled:g,isInvalid:f||!!l,inputValue:N,onInputChange:ne,autoFocus:T&&!E,defaultFilter:s||U,"aria-label":e||c||"Autocomplete",children:ie=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(Ee,{size:u,tooltip:m,isRequired:p,children:e}),jsxRuntime.jsxs(ot,{ref:A,children:[y?jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:y(j)}):jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:j?jsxRuntime.jsx(Gr,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(I,{name:"MagnifyingGlass",className:`${GS[u]} text-text-muted`})}),jsxRuntime.jsx(reactAriaComponents.Input,{className:xt({isInvalid:f||!!l,isDisabled:g,isFocused:W||(E?K:ie.isOpen),size:u,className:tailwindMerge.twMerge(US[u],N&&!g||!R&&!N?"pr-10":"pr-3",E&&"cursor-pointer",D)}),placeholder:c,disabled:g,onFocus:ue=>{F(true),E&&(ue.currentTarget.blur(),Te());},onBlur:()=>{F(false);},onClick:E?Te:void 0,readOnly:E,"aria-label":e||c||"Autocomplete"}),N&&!g&&jsxRuntime.jsx(Da,{onClick:()=>{z(""),a?.(null);},size:u}),!R&&!N&&jsxRuntime.jsx(reactAriaComponents.Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":"Toggle menu",isDisabled:g,children:({isPressed:ue})=>jsxRuntime.jsx(I,{name:ue?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),P?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:x&&k?jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text",children:k}):x&&typeof l=="string"?jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text",children:l}):x&&typeof l=="function"&&b?jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text",children:l(b)}):d?jsxRuntime.jsx(Se,{size:u,children:d}):null}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d&&jsxRuntime.jsx(Se,{size:u,className:"mt-1",children:d}),x&&k&&jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text mt-1",children:k}),x&&typeof l=="string"&&jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text mt-1",children:l}),x&&typeof l=="function"&&b&&jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text mt-1",children:l(b)})]}),!E&&jsxRuntime.jsx(Ze,{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:M?`${M}px`:void 0},children:jsxRuntime.jsx(reactAriaComponents.ListBox,{className:`max-h-[300px] overflow-auto bg-background-input outline-none ${h}`,children:r?r.map(ue=>{let ge=ue.items.map($=>jsxRuntime.jsx(Mt,{id:$.id,textValue:$.name,size:u,className:`flex cursor-default items-center gap-2 px-3 ${Wf[u]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:v?v($):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[$.name,jsxRuntime.jsx(I,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},$.id));if(C){let $=C(ue,ge);return Me__namespace.default.isValidElement($)&&$.type===reactAriaComponents.ListBoxSection?$:jsxRuntime.jsx(reactAriaComponents.ListBoxSection,{children:$},ue.name)}return jsxRuntime.jsxs(reactAriaComponents.ListBoxSection,{children:[jsxRuntime.jsx(reactAriaComponents.Header,{className:"px-3 py-1 text-sm font-bold text-text-muted",children:ue.name}),ge]},ue.name)}):ue=>jsxRuntime.jsx(Mt,{id:ue.id,textValue:ue.name,size:u,className:`flex cursor-default items-center gap-2 px-3 ${Wf[u]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:v?v(ue):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ue.name,jsxRuntime.jsx(I,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},ue.id)})})]})}),E&&jsxRuntime.jsx(Xe,{isOpen:K,onClose:()=>X(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(ot,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:j?jsxRuntime.jsx(Gr,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(I,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-muted"})}),jsxRuntime.jsx("input",{ref:V,type:"text",value:N,onChange:ie=>ne(ie.target.value),placeholder:c,autoFocus:true,className:xt({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),N&&jsxRuntime.jsx(Da,{onClick:()=>{z(""),a?.(null);},size:"md"})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsx(reactAriaComponents.ListBox,{items:me,selectedKeys:o?[o]:[],selectionMode:"single",onSelectionChange:ie=>{let ue=Array.from(ie)[0];ue&&(q(ue),X(false));},className:"bg-background-input outline-none",children:ie=>jsxRuntime.jsx(Mt,{id:ie.id,textValue:ie.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:v?v(ie):ie.name},ie.id)})})]})})]})}function Jr({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]=Me.useState(false),f=Me.useCallback(()=>g(true),[]);Me.useEffect(()=>{g(false);},[e]);let b={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"},x={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"},v={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-muted border-border-muted",away:"bg-feedback-warning-background border-feedback-warning-border",busy:"bg-feedback-error-background border-feedback-error-border"},C={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"},T=s==="circle"?"rounded-full":"rounded-md",P=tailwindMerge.twMerge("relative inline-flex items-center justify-center overflow-hidden transition-opacity outline-none",b[i],T,a&&"cursor-pointer hover:opacity-80",u&&"ring-2 ring-background-surface",l),L=(()=>{if(r||o){let M=r?.[0]||"",w=o?.[0]||"";return (M+w).toUpperCase()}if(n){let M=n.split(" "),w=M[0]?.[0]||"",N=M[M.length-1]?.[0]||"";return w===N?w.toUpperCase():(w+N).toUpperCase()}return ""})(),D=()=>{let M={xs:14,sm:16,md:20,lg:24,xl:32}[i];switch(c){case "team":return jsxRuntime.jsx(lucideReact.Users,{size:M});case "organization":return jsxRuntime.jsx(lucideReact.Building2,{size:M});default:return jsxRuntime.jsx(lucideReact.User,{size:M})}},A=M=>{if(m)return c==="organization"?M?"organization-logo":"initials":M?"avatar":"initials"},V=()=>e&&!p?jsxRuntime.jsx("img",{src:e,alt:t||n||"Avatar",className:"h-full w-full object-cover",onError:f,"data-pii-type":A(true),"data-pii-entity":m}):L?jsxRuntime.jsx("span",{className:"font-semibold","data-pii-type":A(false),"data-pii-entity":m,children:L}):D();return jsxRuntime.jsxs("div",{className:"relative inline-block",children:[jsxRuntime.jsx("div",{"data-avatar":true,className:tailwindMerge.twMerge(P,!e||p?C[c]:""),onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,children:V()}),d&&jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("absolute border-2 border-background-surface",T,x[i],v[i],y[d]),"aria-label":`Status: ${d}`})]})}var _S={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-brand/10 text-action-brand",brand:"bg-action-brand/10 text-action-brand",secondary:"bg-action-default/10 text-action-default",neutral:"bg-background-muted text-text-muted",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"},e1={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"},t1={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"},r1={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 Je({children:e,variant:t="default",size:r="sm",shape:o="square",dot:n=false,dotPosition:a="left",dotPulse:i=false,className:s}){let c=n&&jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("rounded-full bg-current opacity-75",r1[r],i&&"animate-pulse"),"aria-hidden":"true"});return jsxRuntime.jsxs("span",{className:tailwindMerge.twMerge("inline-flex items-center gap-1.5 font-medium",e1[r],t1[o],_S[t],s),children:[n&&a==="left"&&c,e,n&&a==="right"&&c]})}var Ue=({href:e,children:t,className:r="",external:o=false,title:n,variant:a="default",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"}:{},y=`${`${d?"underline decoration-1 underline-offset-4 decoration-current":"hover:underline hover:decoration-1 hover:underline-offset-4 hover:decoration-current"} cursor-pointer`} ${{default:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",brand:"text-action-brand hover:text-action-brand-hover visited:text-action-brand",muted:"text-text-muted hover:text-text-muted visited:text-text-muted",unstyled:""}[a]} ${r}`,C=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t,l&&jsxRuntime.jsxs("span",{children:["\xA0","\u2192"]})]});return s?jsxRuntime.jsx("button",{type:"button",className:y,onClick:c,title:n,...g,children:C}):u&&e?jsxRuntime.jsx(u,{href:e,className:y,title:n,onClick:i,...f,...g,children:C}):jsxRuntime.jsx("a",{href:e||"#",className:y,...f,...g,title:n,onClick:i,children:C})};var p1={info:{subtle:{container:"bg-feedback-info-background border-l-4 border-l-feedback-info-border",iconColor:"text-feedback-info-icon",titleColor:"text-text-heading",bodyColor:"text-text-body"},bold:{container:"bg-feedback-info-icon border-feedback-info-icon",iconColor:"text-white",titleColor:"text-white",bodyColor:"text-white/90"},icon:lucideReact.Info},success:{subtle:{container:"bg-feedback-success-background border-l-4 border-l-feedback-success-border",iconColor:"text-feedback-success-icon",titleColor:"text-text-heading",bodyColor:"text-text-body"},bold:{container:"bg-feedback-success-icon border-feedback-success-icon",iconColor:"text-white",titleColor:"text-white",bodyColor:"text-white/90"},icon:lucideReact.CheckCircle},warning:{subtle:{container:"bg-feedback-warning-background border-l-4 border-l-feedback-warning-border",iconColor:"text-feedback-warning-icon",titleColor:"text-text-heading",bodyColor:"text-text-body"},bold:{container:"bg-feedback-warning-icon border-feedback-warning-icon",iconColor:"text-white",titleColor:"text-white",bodyColor:"text-white/90"},icon:lucideReact.AlertCircle},error:{subtle:{container:"bg-feedback-error-background border-l-4 border-l-feedback-error-border",iconColor:"text-feedback-error-icon",titleColor:"text-text-heading",bodyColor:"text-text-body"},bold:{container:"bg-feedback-error-icon border-feedback-error-icon",iconColor:"text-white",titleColor:"text-white",bodyColor:"text-white/90"},icon:lucideReact.XCircle},discovery:{subtle:{container:"bg-brand-light border-l-4 border-l-brand-primary",iconColor:"text-brand-primary",titleColor:"text-text-heading",bodyColor:"text-text-body"},bold:{container:"bg-brand-primary border-brand-primary",iconColor:"text-white",titleColor:"text-white",bodyColor:"text-white/90"},icon:lucideReact.Lightbulb}};function gs({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=p1[e],p=m[t],g=m.icon,f=!!(i||s),b=!!(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:[b&&jsxRuntime.jsxs("div",{className:"flex-1",children:[r&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("text-sm font-semibold leading-5",p.titleColor),children:r}),o&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("text-sm leading-5",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(Ue,{asButton:true,onPress:i.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-white hover:text-white/80":"",children:i.label}):jsxRuntime.jsx(Q,{size:"sm",variant:"default",onPress:i.onPress,className:t==="bold"?"bg-white text-text-heading hover:bg-white/90":"",children:i.label})),s&&(s.asLink?jsxRuntime.jsx(Ue,{asButton:true,onPress:s.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-white hover:text-white/80":"",children:s.label}):jsxRuntime.jsx(Q,{size:"sm",variant:"secondary",onPress:s.onPress,className:t==="bold"?"border-white/30 text-white hover:bg-white/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-black/10",p.iconColor,Oe()),"aria-label":"Dismiss banner",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]})}function Yf({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(gs,{...o,className:a})})})}function fo({value:e,children:t,className:r,size:o="sm",iconPosition:n="right"}){let[a,i]=Me.useState(false),l=jsxRuntime.jsx(Q,{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(I,{name:"Copy",size:o==="sm"?14:16})}),d=a?jsxRuntime.jsx(Et,{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 bs(e){let{children:t,maxWidth:r=600,className:o,...n}=e,{ref:a,width:i}=kn(),[s,c]=Me__namespace.default.useState(false),[l,d]=Me__namespace.default.useState(false),u=Me__namespace.default.useRef(false),m=Me__namespace.default.useMemo(()=>t&&!e.items&&typeof t!="function"?Me__namespace.default.Children.toArray(t):null,[t,e.items]);if(Me__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),b=g.map(x=>{if(Me__namespace.default.isValidElement(x)){let v=x.props;if(typeof v.children=="string")return {label:v.children,href:v.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(h1,{items:b}),f]})}return jsxRuntime.jsx(reactAriaComponents.Breadcrumbs,{...n,ref:a,className:tailwindMerge.twMerge("flex gap-2",l?"opacity-100":"opacity-0",o),children:t})}function h1({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(Ln,{items:t,align:"left",size:"sm",children:jsxRuntime.jsx(Q,{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-muted"})]})})}function xs(e){let{className:t,children:r,href:o,copyable:n,copyValue:a,...i}=e;return jsxRuntime.jsx(reactAriaComponents.Breadcrumb,{className:Ce(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(fo,{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-body sm:max-w-none",children:l})}):jsxRuntime.jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-body sm:max-w-none",children:l}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ue,{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-muted"})]})})}})}function R1({isSelected:e,isDisabled:t}){let r=[Oe,"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-onPrimary invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):r.push("text-text-body hover:bg-background-hover pressed:bg-background-selected"),r.join(" ")}function Bn({errorMessage:e,...t}){return jsxRuntime.jsxs(reactAriaComponents.Calendar,{...t,children:[jsxRuntime.jsx(hs,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(ys,{}),jsxRuntime.jsx(reactAriaComponents.CalendarGridBody,{children:r=>jsxRuntime.jsx(reactAriaComponents.CalendarCell,{date:r,className:({isSelected:o,isDisabled:n})=>`${R1({isSelected:o,isDisabled:n})} border-0`})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function hs(){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(Q,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsxRuntime.jsx(I,{name:"CaretRight","aria-hidden":true,size:t}):jsxRuntime.jsx(I,{name:"CaretLeft","aria-hidden":true,size:t})}),jsxRuntime.jsx(reactAriaComponents.Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-zinc-900 dark:text-zinc-200"}),jsxRuntime.jsx(Q,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsxRuntime.jsx(I,{name:"CaretLeft","aria-hidden":true,size:t}):jsxRuntime.jsx(I,{name:"CaretRight","aria-hidden":true,size:t})})]})}function ys(){return jsxRuntime.jsx(reactAriaComponents.CalendarGridHeader,{children:e=>jsxRuntime.jsx(reactAriaComponents.CalendarHeaderCell,{className:"text-xs font-semibold text-text-caption",children:e})})}var Xf=Me__namespace.createContext(null);function go(){let e=Me__namespace.useContext(Xf);if(!e)throw new Error("Carousel components must be used within a CarouselRoot");return e}function $f({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,b]=Me__namespace.useState(t),x=g?e:f,v=Me__namespace.useRef(null),[y,C]=Me__namespace.useState(0),[T,P]=Me__namespace.useState(typeof a=="boolean"?a:!!a),[R,L]=Me__namespace.useState(false),D=Me__namespace.useRef(null),A=Me__namespace.useRef(null),V=typeof a=="object"&&a!==null&&a.delay?a.delay:i;Me__namespace.useEffect(()=>{if(v.current){let h=Math.max(1,Math.floor(Number(l)||1)),O=v.current.children;if(O.length===0){C(0);return}let H=Math.ceil(O.length/h);C(H);}},[m,l]);let M=Me__namespace.useRef(-1);Me__namespace.useEffect(()=>{if(x!==M.current&&v.current){let h=Array.from(v.current.children);if(h.length===0)return;let O=x*l,H=Math.min(O,h.length-1),j=h[H];j&&typeof j.scrollIntoView=="function"&&(j.scrollIntoView({behavior:"smooth",block:o==="vertical"?"start":"nearest",inline:o==="horizontal"?"start":"nearest"}),M.current=x);}},[x,l,o]);let w=Me__namespace.useCallback(h=>{let O=h;n?O<0?O=y-1:O>=y&&(O=0):O=Math.max(0,Math.min(h,y-1)),g||b(O),r?.(O);},[g,n,r,y]),N=Me__namespace.useCallback(()=>{w(x+d);},[x,w,d]),z=Me__namespace.useCallback(()=>{w(x-d);},[x,w,d]),W=Me__namespace.useRef(N);Me__namespace.useEffect(()=>{W.current=N;},[N]);let F=y>0&&(n||x<y-1),K=y>0&&(n||x>0),X=Me__namespace.useCallback(()=>{P(h=>!h);},[]);Me__namespace.useEffect(()=>{if(T&&y>1)return D.current=setInterval(()=>{W.current();},V),()=>{D.current&&(clearInterval(D.current),D.current=null);}},[T,y,V]);let G=Me__namespace.useCallback(()=>{D.current&&(clearInterval(D.current),D.current=null);},[]),U=Me__namespace.useCallback(()=>{T&&y>1&&(D.current=setInterval(()=>{W.current();},V));},[T,y,V]),k=Me__namespace.useCallback(h=>{if(!s)return;L(true);let O="touches"in h&&h.touches&&h.touches.length>0?h.touches[0].clientX:"clientX"in h?h.clientX:0,H="touches"in h&&h.touches&&h.touches.length>0?h.touches[0].clientY:"clientY"in h?h.clientY:0;A.current={x:O,y:H};},[s]),S=Me__namespace.useCallback(h=>{if(!R||!A.current)return;let O="touches"in h&&h.touches&&h.touches.length>0?h.touches[0].clientX:"clientX"in h?h.clientX:0,H="touches"in h&&h.touches&&h.touches.length>0?h.touches[0].clientY:"clientY"in h?h.clientY:0,j=O-A.current.x,oe=H-A.current.y,me=50;o==="horizontal"&&Math.abs(j)>me?(j>0?z():N(),L(false),A.current=null):o==="vertical"&&Math.abs(oe)>me&&(oe>0?z():N(),L(false),A.current=null);},[R,o,N,z]),B=Me__namespace.useCallback(()=>{L(false),A.current=null;},[]),E={currentPage:x,totalPages:y,orientation:o,loop:n,spacing:c,slidesPerView:l,goToPage:w,goToNext:N,goToPrev:z,canGoNext:F,canGoPrev:K,isAutoplayActive:T,toggleAutoplay:X,itemsRef:v,isDragging:R,allowMouseDrag:s,handleDragStart:k,handleDragMove:S,handleDragEnd:B};return jsxRuntime.jsx(Xf.Provider,{value:E,children:jsxRuntime.jsx("div",{...p,className:tailwindMerge.twMerge("relative w-full",o==="vertical"?"h-full":"",u),onMouseEnter:G,onMouseLeave:U,children:m})})}function Qf({className:e,children:t,...r}){let{itemsRef:o,orientation:n,spacing:a,isDragging:i,allowMouseDrag:s,handleDragStart:c,handleDragMove:l,handleDragEnd:d}=go();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 _f({index:e,className:t,children:r,...o}){let{orientation:n,slidesPerView:a}=go();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 eg({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 tg({className:e,children:t,...r}){let{goToPrev:o,canGoPrev:n}=go();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-body 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(I,{name:"CaretLeft",size:"sm"})})}function rg({className:e,children:t,...r}){let{goToNext:o,canGoNext:n}=go();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-body 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(I,{name:"CaretRight",size:"sm"})})}function Jd({index:e,className:t,children:r,...o}){let{currentPage:n,goToPage:a}=go(),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 og({className:e,...t}){let{totalPages:r}=go();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(Jd,{index:n},n))})}function ng({className:e,children:t,...r}){let{isAutoplayActive:o,toggleAutoplay:n}=go();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-body 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(I,{name:o?"Pause":"Play",size:"sm"})})}function ag({className:e,...t}){let{currentPage:r,totalPages:o}=go();return jsxRuntime.jsxs("div",{...t,className:tailwindMerge.twMerge("text-sm text-text-muted tabular-nums",e),"aria-live":"polite","aria-atomic":"true",children:[r+1," / ",o]})}function jd(e){return jsxRuntime.jsxs(reactAriaComponents.CheckboxGroup,{...e,className:Ce(e.className,"flex flex-col gap-2"),children:[jsxRuntime.jsx(Ee,{children:e.label}),e.children,e.description&&jsxRuntime.jsx(Se,{children:e.description}),jsxRuntime.jsx(pe,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function F1({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-caption"}`}function B1({isSelected:e,isInvalid:t,isDisabled:r,isIndeterminate:o,variant:n="default"}){let a="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",i=n==="brand"?"focus:ring-action-brand":"focus:ring-action-default",s="";if(r)s="border-border-muted bg-background-muted";else if(t)s="border-feedback-error-border bg-feedback-error-background";else if(e||o){let c=n==="brand"?"action-brand":"action-default";s=`bg-${c} border-${c} hover:bg-${c}-hover hover:border-${c}-hover`;}else s="bg-background-input border-border-input hover:border-border-focus";return `${a} ${i} ${s}`}var ig="w-4 h-4 text-text-onPrimary group-disabled:text-text-disabled";function Zo(e){let{children:t,variant:r="default",...o}=e;return jsxRuntime.jsx(reactAriaComponents.Checkbox,{...o,className:reactAriaComponents.composeRenderProps(e.className,(n,a)=>`${F1(a)} ${n||""}`),children:n=>{let{isSelected:a,isIndeterminate:i,...s}=n,c=jsxRuntime.jsx("div",{className:B1({isSelected:a,isIndeterminate:i,variant:r,...s}),children:i?jsxRuntime.jsx(lucideReact.Minus,{"aria-hidden":true,className:ig}):a?jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":true,className:ig}):null});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,typeof t=="function"?t(n):t]})}})}var O1={default:"bg-background-muted text-action-default border border-border-muted hover:bg-background-hover",brand:"bg-action-brand/10 text-action-brand border border-action-brand/20 hover:bg-action-brand/15",secondary:"bg-background-input text-text-body border border-border-input hover:bg-background-hover",info:"bg-feedback-info-background text-feedback-info-text border border-feedback-info-border hover:bg-feedback-info-background/80"},H1={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"},W1="opacity-75 cursor-not-allowed pointer-events-none";function lg(e){let{variant:t,size:r,isDisabled:o,isClickable:n,className:a}=e,i=r==="xs"?"text-xs":Ae[r].text;return tailwindMerge.twMerge("inline-flex items-center justify-center rounded-full font-medium transition-colors","whitespace-nowrap select-none",H1[r],i,O1[t],n&&!o&&"cursor-pointer",o&&W1,a)}function Er({children:e,onRemove:t,size:r="md",variant:o="default",isRemovable:n=true,isDisabled:a=false,className:i,onClick:s}){let c=!!s&&!a,l=n&&t&&!a,d=f=>{f.stopPropagation(),f.preventDefault(),t&&!a&&t();},u=()=>{s&&!a&&s();},m=r==="xs"?10:r==="sm"?12:r==="md"?14:16,g=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate",children:e}),l?c?jsxRuntime.jsx("span",{onClick:d,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),d(f));},role:"button",tabIndex:0,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-black/10 transition-colors cursor-pointer","aria-label":"Remove",children:jsxRuntime.jsx(I,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):jsxRuntime.jsx("button",{type:"button",onClick:d,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-black/10 transition-colors cursor-pointer","aria-label":"Remove",tabIndex:-1,children:jsxRuntime.jsx(I,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):null]});return c?jsxRuntime.jsx("button",{type:"button",onClick:u,className:lg({variant:o,size:r,isDisabled:a,isClickable:c,className:i}),disabled:a,children:g}):jsxRuntime.jsx("span",{className:lg({variant:o,size:r,isDisabled:a,isClickable:c,className:i}),children:g})}function ug({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="default",showErrors:f=true,className:b}){let[x,v]=Me.useState(""),[y,C]=Me.useState([]),[T,P]=Me.useState(false),[R,L]=Me.useState(false),[D,A]=Me.useState(-1),V=no(x,300),M=Me.useRef(null),w=Me.useRef(null),{isFocused:N,handleFocus:z,handleBlur:W}=nr(),F=Me.useId(),K=Me.useCallback(E=>{if(!u||!E.trim())return;let h=E.trim();if(d.includes(h)){v(""),L(false),C([]),A(-1);return}u([...d,h]),v(""),L(false),C([]),A(-1),M.current?.focus();},[d,u]),X=Me.useCallback(E=>{u&&u(d.filter(h=>h!==E));},[d,u]);Me.useEffect(()=>{if(!p)return;let E=true;return (async()=>{let O=V.trim();if(!O){E&&(P(false),C([]),L(false));return}P(true);try{let H=await p(O);if(!E)return;C(H),L(!0);}catch(H){if(!E)return;console.error("Error fetching suggestions:",H),C([]),L(false);}finally{E&&P(false);}})(),()=>{E=false;}},[V,p]),Me.useEffect(()=>{if(p||!m)return;if(!V.trim()){C([]),L(false);return}let E=m.filter(h=>h.name.toLowerCase().includes(V.toLowerCase())).map(h=>h.id);C(E),L(E.length>0||V.trim().length>0);},[V,m,p]);let G=Me.useMemo(()=>{let E=y.filter(h=>!d.includes(h));return x.trim()&&!E.includes(x.trim())&&!d.includes(x.trim())?[...E,`Create tag: "${x.trim()}"`]:E},[y,x,d]),U=Me.useCallback(E=>{v(E.target.value),A(-1),E.target.value&&L(true);},[]),k=Me.useCallback(E=>{i||(E.startsWith("Create tag:")?K(x):K(E));},[K,x,i]),S=Me.useCallback(E=>{if(!i)switch(E.key){case "Enter":case ",":if(E.preventDefault(),D>=0&&D<G.length){let h=G[D];h.startsWith("Create tag:")?K(x):K(h);}else x.trim()&&K(x.trim());break;case "Backspace":!x&&d.length>0&&(E.preventDefault(),X(d[d.length-1]));break;case "ArrowDown":E.preventDefault(),R&&A(h=>h<G.length-1?h+1:h);break;case "ArrowUp":E.preventDefault(),R&&A(h=>h>0?h-1:-1);break;case "Escape":L(false),A(-1);break}},[i,x,d,G,D,R,K,X]);Me.useEffect(()=>{let E=h=>{w.current&&h.target instanceof Node&&!w.current.contains(h.target)&&L(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);let B=()=>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]",mo({isInvalid:s,isDisabled:i,isFocused:N}),"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:w,className:tailwindMerge.twMerge("relative flex flex-col gap-1",b),children:[e&&jsxRuntime.jsx(Ee,{size:o,tooltip:n,isRequired:a,children:e}),jsxRuntime.jsx(ot,{children:jsxRuntime.jsxs("div",{className:B(),onClick:()=>!i&&M.current?.focus(),children:[d.map(E=>jsxRuntime.jsx(Er,{variant:g,size:"xs",onRemove:()=>X(E),isDisabled:i,className:"shrink-0 max-h-full",children:E},E)),jsxRuntime.jsx("input",{ref:M,type:"text",role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":F,"aria-autocomplete":"list",value:x,onChange:U,onKeyDown:S,onFocus:E=>z(E),onBlur:E=>W(E),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-body text-sm placeholder:text-text-placeholder 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"}})]})}),R&&(x||G.length>0)&&jsxRuntime.jsx("div",{id:F,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:T?jsxRuntime.jsx("div",{className:"px-3 py-2 text-sm text-text-muted",children:"Loading..."}):G.length>0?G.map((E,h)=>jsxRuntime.jsx("div",{role:"option","aria-selected":h===D,className:tailwindMerge.twMerge("cursor-pointer px-3 py-2 text-sm transition-colors","hover:bg-background-hover",h===D&&"bg-background-selected",E.startsWith("Create tag:")&&"italic text-text-muted"),onClick:()=>k(E),children:E},E)):x&&jsxRuntime.jsx("div",{className:"px-3 py-2 text-sm text-text-muted",children:"No suggestions found"})}),t&&jsxRuntime.jsx(Se,{size:o,className:"mt-1",children:t}),f&&typeof r=="string"&&jsxRuntime.jsx(pe,{size:o,className:"text-feedback-error-text mt-1",children:r}),f&&typeof r=="function"&&c&&jsxRuntime.jsx(pe,{size:o,className:"text-feedback-error-text mt-1",children:r(c)})]})}var $1={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')},Q1={github:()=>import('ace-builds/src-noconflict/theme-github'),github_dark:()=>import('ace-builds/src-noconflict/theme-github_dark')},_1={"ext-language-tools":()=>import('ace-builds/src-noconflict/ext-language_tools')},Ia=new Set;async function Zd(e,t){Ia.has(e)||(await t(),Ia.add(e));}async function e2(e,t,r){await Promise.all([Zd(`language:${e}`,$1[e]),Zd(`theme:${t}`,Q1[t]),r?Zd("extension:language-tools",_1["ext-language-tools"]):void 0]);}function mg(e,t,r){let o=Ia.has(`language:${e}`)&&Ia.has(`theme:${t}`);return r?o&&Ia.has("extension:language-tools"):o}function fg({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=Me.useRef(null),[b,x]=Me.useState(()=>mg(o,n,!t)),v=Me.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 Me.useEffect(()=>{let y=false,C=!t;return mg(o,n,C)?(x(true),()=>{y=true;}):(x(false),e2(o,n,C).then(()=>{y||x(true);}).catch(T=>{y||x(true),console.error("Failed to load Ace editor resources",T);}),()=>{y=true;})},[o,t,n]),Me.useEffect(()=>{b&&f.current?.editor&&f.current.editor.resize();},[v,b]),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden rounded-md border border-border-input",s),style:{width:i,height:v},children:b?jsxRuntime.jsx(Z1__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 bg=Me__namespace.createContext({variant:"contained",density:"comfortable",showDividers:true}),xg=Me__namespace.createContext(null),a2={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"},gg={true:"divide-y divide-border-default",false:"gap-3"},i2={comfortable:"px-5 py-3",compact:"px-4 py-2.5"},s2={comfortable:"px-5 pt-0",compact:"px-4 pt-0"},l2={comfortable:"h-4 w-4",compact:"h-3.5 w-3.5"};function _d(){return Me__namespace.useContext(bg)}function c2(e){let t=Me__namespace.useContext(xg);if(!t)throw new Error(`${e} must be used within a <CollapseItem>`);return t}function d2({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 u2({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-body",c=t&&!e?"bg-background-hover":"",l=i2[r];return tailwindMerge.twMerge(i,Oe(),l,s,c,o==="plain"&&n?"px-0":"",a)}function p2({density:e,showDividers:t,className:r}){let o="text-text-body",n=s2[e];return tailwindMerge.twMerge(o,n,t?"":"rounded-b-lg",r)}function zn({variant:e="contained",density:t="comfortable",showDividers:r=true,className:o,...n}){let a=Me__namespace.useMemo(()=>({variant:e,density:t,showDividers:r}),[e,t,r]),i=tailwindMerge.twMerge("flex w-full flex-col",a2[e],r?gg.true:gg.false,e==="plain"&&r?"border-y border-border-default/60":"");return jsxRuntime.jsx(bg.Provider,{value:a,children:jsxRuntime.jsx(reactAriaComponents.DisclosureGroup,{...n,className:Ce(o,i)})})}function xo({className:e,children:t,...r}){let{variant:o,showDividers:n}=_d();return jsxRuntime.jsx(reactAriaComponents.Disclosure,{...r,className:reactAriaComponents.composeRenderProps(e,a=>d2({variant:o,showDividers:n,className:a})),children:a=>jsxRuntime.jsx(xg.Provider,{value:a,children:t})})}xo.displayName="CollapseItem";function ho({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=c2("CollapseHeader"),{density:m,variant:p,showDividers:g}=_d(),f=l2[m];return jsxRuntime.jsx(reactAriaComponents.Button,{...d,slot:"trigger","data-expanded":u.isExpanded?"true":void 0,className:reactAriaComponents.composeRenderProps(l,(b,x)=>u2({isDisabled:x.isDisabled??false,isPressed:x.isPressed??false,density:m,variant:p,showDividers:g,className:b})),children:b=>{let x=b.isDisabled??false,v=i?typeof n=="function"?n({isExpanded:u.isExpanded,isDisabled:x}):n??jsxRuntime.jsx(I,{name:"CaretDown",size:m==="compact"?"xs":"sm",weight:"bold","aria-hidden":"true",className:tailwindMerge.twMerge("text-text-muted transition-transform duration-200",u.isExpanded?"rotate-180":"rotate-0")}):null,y=v?jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("flex flex-shrink-0 items-center justify-center text-text-muted",f),"aria-hidden":"true",children:v}):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-muted",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-heading",children:e}),t&&jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:t})]}),o&&jsxRuntime.jsx("div",{className:"flex flex-shrink-0 items-center text-sm text-text-muted",children:o})]}),a==="end"&&y]})}})}ho.displayName="CollapseHeader";function yo({className:e,children:t,...r}){let{density:o,showDividers:n}=_d();return jsxRuntime.jsx(reactAriaComponents.DisclosurePanel,{...r,className:reactAriaComponents.composeRenderProps(e,a=>p2({density:o,showDividers:n,className:a})),children:t})}yo.displayName="CollapseContent";function Vn(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 tu(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 b2({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[b,x]=Me.useState(d||""),[v,y]=Me.useState(l||d||""),[C,T]=Me.useState(false),[P,R]=Me.useState(null),{isFocused:L,handleFocus:D,handleBlur:A}=nr(),V=l!==void 0?l:b;Me.useEffect(()=>{l!==void 0&&y(l);},[l]);let M=V?!Vn(V):false,w=Me.useCallback(W=>{if(y(W),Vn(W)){let F=tu(W);u?u(F):x(F);}else W===""&&(u?u(""):x(""));},[u]),N=Me.useCallback(W=>{let F=tu(W);y(F),u?u(F):x(F);},[u]),z=Me.useCallback(W=>{if(Vn(v)){let F=tu(v);y(F),u&&F!==V?u(F):!u&&F!==b&&x(F);}A(W,f.onBlur);},[v,V,b,u,A,f.onBlur]);return jsxRuntime.jsx(reactAriaComponents.TextField,{...f,isRequired:a,className:Ce(s,"group flex flex-col"),children:({isDisabled:W})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(Ee,{size:o,tooltip:n,isRequired:a,children:e}),jsxRuntime.jsx(ot,{children:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 relative",children:[jsxRuntime.jsx(cs,{size:o,disabled:W,type:"text",value:v,placeholder:m,onFocus:F=>D(F,f.onFocus),onBlur:z,onChange:F=>w(F.target.value),className:tailwindMerge.twMerge(xt({isInvalid:M,isDisabled:W,isFocused:L,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:Ae[o].height},children:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("w-6 h-6 rounded border shadow-sm",Vn(V)?"border-border-default":"border-border-default bg-background-muted"),style:Vn(V)?{backgroundColor:V}:void 0,"aria-hidden":"true",children:!Vn(V)&&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:R,children:jsxRuntime.jsx(Q,{variant:"secondary",size:o,icon:"Palette",onPress:()=>T(!C),isDisabled:W,className:"flex-shrink-0",children:"Pick"})})]})}),g?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsxRuntime.jsx(pe,{size:o,children:r}):typeof r=="function"&&c?jsxRuntime.jsx(pe,{size:o,children:r(c)}):t?jsxRuntime.jsx(Se,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&c?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r(c)}):t?jsxRuntime.jsx(Se,{size:o,className:"mt-1",children:t}):null}),C&&P&&jsxRuntime.jsx(Ze,{triggerRef:{current:P},isOpen:C,onOpenChange:T,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:V||"#000000",onChange:N,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:V||"#000000"}}),jsxRuntime.jsx("div",{className:"flex-1 text-text-body text-[length:var(--control-text-sm)] font-mono",children:V||"#000000"})]})]})})]})})}function vg({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(_t,{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-body",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=Ai(t);else if(!e&&r){let u=Ai(r);d=u?`Offline ${u}`:null;}}return jsxRuntime.jsxs("div",{className:"inline-flex flex-col gap-1",children:[jsxRuntime.jsx(Je,{variant:l,size:a,shape:i,dot:e,dotPulse:e,...s,children:c}),d&&jsxRuntime.jsx("span",{className:"text-xs text-text-muted",children:d})]})}function Sg({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(),b=({children:v,className:y})=>a?i?jsxRuntime.jsx(i,{href:a,className:y,children:v}):jsxRuntime.jsx(Ue,{href:a,variant:"unstyled",className:tailwindMerge.twMerge("hover:underline",y),asButton:false,children:v}):jsxRuntime.jsx("span",{className:y,children:v}),x=c==="vertical";return u?jsxRuntime.jsx(Le,{variant:s,className:tailwindMerge.twMerge("flex flex-col",m),children:jsxRuntime.jsx(Le.Content,{className:"flex items-center flex-1",children:jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("w-full",x?"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(x?"w-full text-center":"flex-1","space-y-2"),children:[jsxRuntime.jsx(J,{width:"70%",height:20,className:tailwindMerge.twMerge(x&&"mx-auto")}),jsxRuntime.jsx(J,{width:"100%",height:16,className:tailwindMerge.twMerge(x&&"mx-auto")})]})]})})}):jsxRuntime.jsx(Le,{variant:s,className:tailwindMerge.twMerge("group/card flex flex-col",m),children:jsxRuntime.jsx(Le.Content,{className:tailwindMerge.twMerge("flex items-center flex-1",a&&"cursor-pointer",p),children:jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("relative w-full",x?"flex flex-col items-center gap-4 text-center":"flex items-center gap-4"),children:[jsxRuntime.jsx(Jr,{firstName:e,lastName:t,src:n,size:"xl",variant:"user",shape:"square",className:"flex-shrink-0",piiEntity:g}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge(x?"w-full":"flex-1 min-w-0"),children:[a&&jsxRuntime.jsx(b,{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-heading 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",x&&"flex flex-col items-center"),children:[l&&r&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-text-body",children:[jsxRuntime.jsx(I,{name:"Envelope",size:16,className:"text-text-muted flex-shrink-0"}),jsxRuntime.jsx(Ue,{href:`mailto:${r}`,variant:"unstyled",className:tailwindMerge.twMerge("text-sm leading-relaxed text-text-body relative z-20",x?"":"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-body",children:[jsxRuntime.jsx(I,{name:"Phone",size:16,className:"text-text-muted flex-shrink-0"}),jsxRuntime.jsx(Ue,{href:`tel:${o}`,variant:"unstyled",className:tailwindMerge.twMerge("text-sm leading-relaxed text-text-body relative z-20",x?"":"truncate"),"data-pii-type":g?"phone":void 0,"data-pii-entity":g,children:Pn(o)})]})]})]})]})})})}function Ss({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 b=m??(n==="inline"?"circle":"square"),v={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(),T={strong:"font-semibold text-text-body",high:"font-semibold text-text-body",normal:"text-text-body",low:"text-text-muted"}[l],P=({children:R,className:L})=>i?s?jsxRuntime.jsx(s,{href:i,className:L,children:R}):jsxRuntime.jsx(Ue,{href:i,variant:c,className:tailwindMerge.twMerge("hover:underline",L),asButton:false,children:R}):jsxRuntime.jsx("span",{className:L,children:R});return p?n==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsx(J,{width:v.skeletonAvatar,height:v.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsxRuntime.jsx(J,{width:v.skeletonText,height:v.skeletonAvatar*.5})]}):jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsx(J,{width:v.skeletonAvatar,height:v.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(J,{width:v.skeletonText,height:16}),d&&jsxRuntime.jsx(J,{width:v.skeletonSecondary,height:12})]})]}):n==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsxs(P,{className:tailwindMerge.twMerge("flex items-center",v.gap),children:[jsxRuntime.jsx(Jr,{firstName:e,lastName:t,src:o,size:v.avatarSize,variant:"user",shape:b,className:"flex-shrink-0",piiEntity:f}),jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-body",T,v.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",v.gap,g),children:[jsxRuntime.jsx(Jr,{firstName:e,lastName:t,src:o,size:v.avatarSize,variant:"user",shape:b,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(P,{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-body",T,v.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-caption leading-normal truncate",v.secondaryTextSize),"data-pii-type":f?"email":void 0,"data-pii-entity":f,children:r})]})]})}var wg={duration:.5,ease:"easeInOut"},Co=Me.createContext(null),_o=()=>{let e=Me.useContext(Co);if(!e)throw new Error("useChartContext must be used within a ChartContextProvider");return e};var Ba=({data:e,color:t="var(--color-viz-default)"})=>{let r=Me.useId(),o=Me.useId(),{xScale:n,yScale:a,animationSettings:i}=_o(),s=n.range(),c=a.range();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsxs("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[jsxRuntime.jsx("stop",{offset:"50%",stopColor:t,stopOpacity:.1}),jsxRuntime.jsx("stop",{offset:"100%",stopColor:t,stopOpacity:0})]}),jsxRuntime.jsx("clipPath",{id:o,children:jsxRuntime.jsx("rect",{x:s[0],y:c[1],width:s[1]-s[0],height:c[0]-c[1]})})]}),jsxRuntime.jsx("g",{clipPath:`url(#${o})`,children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:i.duration,ease:i.ease},style:{transformOrigin:`0 ${c[0]}px`,transformBox:"fill-box",isolation:"isolate"},children:[jsxRuntime.jsx(shape.AreaClosed,{data:e,x:l=>n(l.xValue),y:l=>a(l.yValue),yScale:a,fill:`url(#${r})`,curve:curve.curveLinear}),jsxRuntime.jsx(shape.LinePath,{data:e,x:l=>n(l.xValue),y:l=>a(l.yValue),stroke:t,strokeWidth:3,curve:curve.curveLinear})]})})]})};var Hn=({data:e,color:t="var(--color-viz-default)",opacity:r=1,categoryColors:o={}})=>{let{xScale:n,yScale:a,animationSettings:i}=_o(),s=Me.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),b=a(p.yValue),x=a(0),v=Math.min(b,x),y=Math.abs(b-x),C=d[g+1],T=C?Math.abs(n(C.xValue)-f):m,P=p.category&&o[p.category]?o[p.category]:t;return jsxRuntime.jsx(shape.Bar,{x:f-T/2,y:v,width:T,height:y,fill:P,opacity:r,rx:1},p.xValue.getTime())})})})]})};var Mr=Dp(qg()),Xg=Dp(Zg());var U2=["top","left","transform","className","children","innerRef"];function pu(){return pu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);}return e},pu.apply(this,arguments)}function Y2(e,t){if(e==null)return {};var r={},o=Object.keys(e),n,a;for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&(r[n]=e[n]);return r}function za(e){var t=e.top,r=t===void 0?0:t,o=e.left,n=o===void 0?0:o,a=e.transform,i=e.className,s=e.children,c=e.innerRef,l=Y2(e,U2);return Me__namespace.default.createElement("g",pu({ref:c,className:(0, Xg.default)("visx-group",i),transform:a||"translate("+n+", "+r+")"},l),s)}za.propTypes={top:Mr.default.number,left:Mr.default.number,transform:Mr.default.string,className:Mr.default.string,children:Mr.default.node,innerRef:Mr.default.oneOfType([Mr.default.string,Mr.default.func,Mr.default.object])};var Ye={top:0,right:0,bottom:50,left:60};function qr(e={type:"number"}){let t=i=>{if(i==null)return "-";let s=Nr({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=Nr({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 mu=(e,t)=>{let r=d3Array.extent(e,o=>o.xValue);return scale.scaleTime({range:[Ye.left,t-Ye.right],domain:r,nice:true})},fu=(e,t,r)=>{let o=qr(r),n=d3Array.min(e,c=>c.yValue)||0,a=d3Array.max(e,c=>c.yValue)||0,i=o.min!==void 0?o.min:n>=0?0:n*1.1,s=o.max!==void 0?o.max:a<=0?0:a*1.1;return scale.scaleLinear({range:[t-Ye.bottom,Ye.top],domain:[i,s],nice:true})};function $2(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 Vs(e,t=12,r="system-ui"){return e.length===0?0:Math.max(...e.map(o=>$2(o,t,r)))}function Va(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Q2(e,t,r=12,o=false){if(!Va(t[0])||!Va(t[1]))return console.warn("ChartAxis: Invalid date in domain, skipping tick calculation"),[];let n=t[0].getTime(),i=t[1].getTime()-n;if(i===0||i<1e3)return [t[0]];let s=Gc({start:t[0],end:t[1]},{compact:o}),l=[t[0],new Date((t[0].getTime()+t[1].getTime())/2),t[1]].map(b=>s(b)),d=Vs(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]];for(let b=1;b<g-1;b++){let x=b/(g-1),v=n+i*x;f.push(new Date(v));}return f.push(t[1]),f}var _2=({top:e,scale:t,width:r})=>{let o=t.domain(),n=[o[0],o[o.length-1]],a=Va(n[0])&&Va(n[1]),i=r<400,s=a?n[0].getTime():0,c=a?n[1].getTime():0,l=Me.useMemo(()=>a?Gc({start:n[0],end:n[1]},{compact:i}):()=>"",[s,c,i,a]),d=Me.useMemo(()=>Q2(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 Va(m)?l(m):""},stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:(u,m,p)=>({fill:"var(--color-text-caption)",fontSize:12,textAnchor:m===0?"start":m===p.length-1?"end":"middle"}),rangePadding:0})};function Hs(e,t=12){let r=t*2.5,o=Math.floor(e/r);return Math.max(2,Math.min(6,o))}var ew=({left:e,scale:t,yFormatter:r,height:o})=>{let n=qr(r),a=Me.useMemo(()=>!o||o<=0?5:Hs(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:()=>({fill:"var(--color-text-caption)",fontSize:12,textAnchor:"end",dy:"0.33em"})})},tw=({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-caption)",fontSize:12,textAnchor:"middle",dy:"0.25em"})}),rw=({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-caption)",fontSize:12,textAnchor:"end",dx:"-0.25em",dy:"0.33em"})}),ow=({top:e,scale:t,yFormatter:r,width:o})=>{let n=qr(r),a=Me.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-caption)",fontSize:12,textAnchor:"middle",dy:"0.25em"})})},Ar={Bottom:_2,Left:ew,CategoryBottom:tw,CategoryLeft:rw,NumericBottom:ow};var Un=({data:e,formatter:t,label:r,categoryLabels:o})=>{if(!e)return null;let n=Me__namespace.default.useContext(Co),a=o??n?.categoryLabels,i=n?.xScale,s=qr(t),c=Me__namespace.default.useRef(null),[l,d]=Me__namespace.default.useState({x:0,y:0,translate:"translate(-50%, -100%)"});Me__namespace.default.useEffect(()=>{if(!c.current)return;let b=c.current.getBoundingClientRect(),x=window.innerHeight,v=window.innerWidth,y=e.x,C=e.y,T=e.position==="left"?"translate(calc(-100% - 16px), -50%)":"translate(16px, -50%)";e.position==="left"&&y-b.width-16<0?T="translate(16px, -50%)":e.position==="right"&&y+b.width+16>v&&(T="translate(calc(-100% - 16px), -50%)"),C-b.height/2<0?C=b.height/2:C+b.height/2>x&&(C=x-b.height/2),d({x:y,y:C,translate:T});},[e.x,e.y,e.position]);let u=i?.domain(),p=u&&u.length===2&&u.every(f=>f instanceof Date)?Om({start:u[0],end:u[1]}):null,g=r||(p&&e.xValue instanceof Date?p(e.xValue):String(e.xValue));return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,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:l.x,top:l.y,transform:l.translate},children:[jsxRuntime.jsx("div",{className:"mb-1 font-medium text-text-body",children:g}),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(f=>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-body",children:[f.label,":"]}),jsxRuntime.jsx("span",{className:"text-text-muted",children:s.format(f.value)})]}),f.category&&jsxRuntime.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-3 w-3",style:{backgroundColor:f.categoryColor||f.color,borderRadius:"1px"}}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:a?.[f.category]||f.category})]})]},f.label))}),(()=>{let f=e.series[e.series.length-1];return 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:f.color}}),jsxRuntime.jsx("span",{className:"font-medium text-text-body",children:f.label})]}),e.eventMetadata&&Object.keys(e.eventMetadata).length>0&&jsxRuntime.jsx("div",{className:"ml-4 mt-1 space-y-0.5 text-xs text-text-muted",children:Object.entries(e.eventMetadata).map(([b,x])=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"capitalize",children:[b,":"]}),jsxRuntime.jsx("span",{className:"font-medium",children:x})]},b))})]})})()]}):jsxRuntime.jsx("ul",{className:"list-none p-0",children:e.series.map(f=>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-body",children:[f.label,":"]}),jsxRuntime.jsx("span",{className:"text-text-muted",children:s.format(f.value)})]}),f.category&&jsxRuntime.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-3 w-3",style:{backgroundColor:f.categoryColor||f.color,borderRadius:"1px"}}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:a?.[f.category]||f.category})]})]},f.label))})]})})};var uw={top:20,right:20,bottom:50,left:60},ob=({data:e,width:t,height:r,margin:o=uw,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":b="Category bar chart",orientation:x="vertical",showTooltip:v=true})=>{let[y,C]=Me.useState(null),[T,P]=Me.useState(null),[R,L]=Me.useState(null),[D,A]=Me.useState(t??600),[V,M]=Me.useState(r??300),w=Me.useRef(null),N=p??y,z=Me.useId(),W=n||"var(--color-viz-default)";Me.useEffect(()=>{if(t!==void 0&&r!==void 0){A(t),M(r);return}if(!w.current)return;let k=new ResizeObserver(S=>{for(let B of S)t===void 0&&A(B.contentRect.width),r===void 0&&M(B.contentRect.height);});return k.observe(w.current),t===void 0&&A(w.current.offsetWidth),r===void 0&&M(w.current.offsetHeight||300),()=>{k.disconnect();}},[t,r]);let{xScale:F,yScale:K,innerWidth:X,innerHeight:G}=Me.useMemo(()=>{let k=D-o.left-o.right,S=V-o.top-o.bottom;if(x==="horizontal"){let E=d3Array.max(e,h=>h.value)||0;return {xScale:scale.scaleLinear({range:[0,k],domain:[0,E*1.1],nice:true}),yScale:scale.scaleBand({range:[0,S],domain:e.map(h=>h.label),padding:d}),innerWidth:k,innerHeight:S}}let B=d3Array.max(e,E=>E.value)||0;return {xScale:scale.scaleBand({range:[0,k],domain:e.map(E=>E.label),padding:d}),yScale:scale.scaleLinear({range:[S,0],domain:[0,B*1.1],nice:true}),innerWidth:k,innerHeight:S}},[e,D,V,o,d,x]);if(e.length===0)return jsxRuntime.jsx("div",{ref:w,className:tailwindMerge.twMerge("flex h-full min-h-[200px] w-full items-center justify-center rounded-lg border border-dashed border-gray-300 bg-background-surface text-sm font-medium text-text-muted dark:border-gray-700",g),style:r!==void 0?{height:r,...f}:f,children:"No data available"});let U=(k,S)=>{if(C(k),m?.(S,k),k!==null&&S){let B,E;if(x==="horizontal"){let O=F(S.value),H=K(S.label)||0,j=K.bandwidth();B=o.left+O,E=o.top+H+j/2;}else {let O=F,H=K,j=O(S.label)??0,oe=O.bandwidth(),me=H(S.value);B=o.left+j+oe/2,E=o.top+me;}let h=B>D/2;L(S.label),P({xValue:new Date,series:[{label:"Value",value:S.value,color:S.color||W}],x:B,y:E,position:h?"left":"right"});}else P(null),L(null);};return jsxRuntime.jsxs("div",{ref:w,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":b,role:"img",children:[jsxRuntime.jsxs("svg",{width:D,height:V,children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx(gradient.LinearGradient,{id:`${z}-bar`,from:W,to:W,toOpacity:.85})}),jsxRuntime.jsxs(za,{left:o.left,top:o.top,children:[i&&jsxRuntime.jsx("g",{className:"grid-lines",children:(x==="horizontal"?F.ticks(5):K.ticks(5)).map(k=>{let S=x==="horizontal"?0:K(k),B=x==="horizontal"?F(k):0;return jsxRuntime.jsx("line",{x1:x==="horizontal"?B:0,y1:x==="horizontal"?0:S,x2:x==="horizontal"?B:X,y2:x==="horizontal"?G:S,stroke:"var(--color-border-default)",strokeOpacity:.5,strokeDasharray:"2,3"},k)})}),e.map((k,S)=>{let B=N===S||N==null,E=k.color||`url(#${z}-bar)`;if(x==="horizontal"){let q=F(k.value),ne=K.bandwidth(),Te=K(k.label)||0;return jsxRuntime.jsx(framerMotion.motion.rect,{x:0,y:Te,width:q,height:ne,fill:E,rx:l,ry:l,initial:c?{width:0,opacity:.5}:void 0,animate:{width:q,opacity:B?1:.5},transition:{duration:.5,delay:S*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:u||m?"pointer":"default"},onMouseEnter:()=>U(S,k),onMouseLeave:()=>U(null,null),onClick:()=>u?.(k,S)},k.label)}let h=F,O=K,H=h.bandwidth(),j=h(k.label)??0,oe=O(k.value),me=Math.max(0,G-oe);return c?jsxRuntime.jsx(framerMotion.motion.rect,{x:j,width:H,fill:E,rx:l,ry:l,initial:{y:G,height:0,opacity:.5},animate:{y:oe,height:me,opacity:B?1:.5},transition:{duration:.5,delay:S*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:u||m?"pointer":"default"},onMouseEnter:()=>U(S,k),onMouseLeave:()=>U(null,null),onClick:()=>u?.(k,S)},k.label):jsxRuntime.jsx("rect",{x:j,y:oe,width:H,height:me,fill:E,rx:l,ry:l,opacity:B?1:.5,style:{cursor:u||m?"pointer":"default",transition:"opacity 150ms ease-out"},onMouseEnter:()=>U(S,k),onMouseLeave:()=>U(null,null),onClick:()=>u?.(k,S)},k.label)}),s&&x==="vertical"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ar.CategoryBottom,{top:G,scale:F}),jsxRuntime.jsx(Ar.Left,{left:0,scale:K,yFormatter:a,height:G})]}),s&&x==="horizontal"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ar.NumericBottom,{top:G,scale:F,yFormatter:a,width:X}),jsxRuntime.jsx(Ar.CategoryLeft,{left:0,scale:K})]})]})]}),v&&jsxRuntime.jsx(Un,{data:T,formatter:a,label:R??void 0})]})};var nb=({item:e})=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[jsxRuntime.jsx("div",{className:"h-3 w-3 shrink-0",style:{backgroundColor:e.fill,borderRadius:"1px"}}),jsxRuntime.jsx("span",{className:"text-sm text-text-caption whitespace-nowrap",children:e.category})]}),fw=({items:e})=>e.length===0?null:jsxRuntime.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:e.map(t=>jsxRuntime.jsx(nb,{item:t},t.category))}),Gs=({items:e,onExport:t,marginLeft:r=0,marginRight:o=0,isZoomed:n=false,onResetZoom:a})=>{let[i,s]=Me__namespace.default.useState(false),[c,l]=Me__namespace.default.useState(null),[d,u]=Me__namespace.default.useState(false),[m,p]=Me__namespace.default.useState(false),g=Me__namespace.default.useCallback(async b=>{s(true),l(b),p(false);try{await t(b);}catch(x){console.error("Export failed:",x);}finally{s(false),l(null);}},[t]),f=Me__namespace.default.useCallback(async b=>{await g(b);},[g]);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(fw,{items:e})}),jsxRuntime.jsx("div",{className:"sm:hidden flex items-center gap-3",children:e.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:()=>u(true),className:"text-sm text-text-muted hover:text-text-body transition-colors underline decoration-dotted underline-offset-4",children:"Legend"}),jsxRuntime.jsx(Xe,{isOpen:d,onClose:()=>u(false),title:"Legend",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-3 p-4",children:e.map(b=>jsxRuntime.jsx(nb,{item:b},b.category))})})]})}),jsxRuntime.jsxs("div",{className:"sm:hidden flex items-center gap-2 shrink-0",children:[n&&a&&jsxRuntime.jsx(Q,{variant:"secondary",size:"sm",onPress:a,children:jsxRuntime.jsx(I,{name:"ArrowsOut",size:16})}),jsxRuntime.jsx(Q,{variant:"secondary",size:"sm",onPress:()=>p(true),isDisabled:i,children:jsxRuntime.jsx(I,{name:"Export",size:16})}),jsxRuntime.jsx(Xe,{isOpen:m,onClose:()=>p(false),title:"Export Chart",contentPadding:false,children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("button",{onClick:()=>g("csv"),disabled:i,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(I,{name:"List",size:20,className:"text-text-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-body",children:c==="csv"?"Exporting...":"Export as CSV"})]}),jsxRuntime.jsxs("button",{onClick:()=>g("svg"),disabled:i,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(I,{name:"Code",size:20,className:"text-text-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-body",children:c==="svg"?"Exporting...":"Export as SVG"})]}),jsxRuntime.jsxs("button",{onClick:()=>g("png"),disabled:i,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(I,{name:"DownloadSimple",size:20,className:"text-text-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-body",children:c==="png"?"Exporting...":"Export as PNG"})]})]})})]}),jsxRuntime.jsxs("div",{className:"hidden sm:flex items-center gap-2 shrink-0",children:[n&&a&&jsxRuntime.jsxs(Q,{variant:"secondary",size:"sm",onPress:a,children:[jsxRuntime.jsx(I,{name:"ArrowsOut",size:16}),jsxRuntime.jsx("span",{className:"hidden sm:inline",children:"Reset Zoom"})]}),jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{children:[jsxRuntime.jsxs(Q,{variant:"secondary",size:"sm",isDisabled:i,children:[jsxRuntime.jsx(I,{name:"Export",size:16}),i?"Exporting...":"Export"]}),jsxRuntime.jsx(Ze,{placement:"top end",className:"min-w-48 p-1 bg-white dark:bg-gray-800 rounded-lg shadow-xl ring-1 ring-gray-200 dark:ring-gray-700",children:jsxRuntime.jsxs(reactAriaComponents.Menu,{onAction:f,className:"outline-none",children:[jsxRuntime.jsx(reactAriaComponents.MenuItem,{id:"csv",className:"flex items-center gap-2 px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 rounded cursor-pointer outline-none",isDisabled:i,children:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(I,{name:"List",size:14}),c==="csv"?"Exporting...":"Export as CSV"]})}),jsxRuntime.jsx(reactAriaComponents.MenuItem,{id:"svg",className:"flex items-center gap-2 px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 rounded cursor-pointer outline-none",isDisabled:i,children:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(I,{name:"Code",size:14}),c==="svg"?"Exporting...":"Export as SVG"]})}),jsxRuntime.jsx(reactAriaComponents.MenuItem,{id:"png",className:"flex items-center gap-2 px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 rounded cursor-pointer outline-none",isDisabled:i,children:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(I,{name:"DownloadSimple",size:14}),c==="png"?"Exporting...":"Export as PNG"]})})]})})]})]})]})};var bu=({data:e,seriesMetadata:t,width:r,height:o,onBrushChange:n,brushRegion:a,margin:i=Ye})=>{let s=Me.useRef(null),c=Me.useRef(false),l=Me.useMemo(()=>e.flat(),[e]),d=Me.useMemo(()=>({top:10,bottom:15,left:i.left,right:i.right}),[i]),u=r-d.left-d.right,m=Me.useMemo(()=>{if(l.length===0)return scale.scaleTime({domain:[new Date,new Date],range:[0,u]});let x=new Date(Math.min(...l.map(y=>y.xValue.getTime()))),v=new Date(Math.max(...l.map(y=>y.xValue.getTime())));return scale.scaleTime({domain:[x,v],range:[0,u]})},[l,u]),p=Me.useMemo(()=>{let x=l.length>0?Math.max(0,...l.map(v=>v.yValue)):1;return scale.scaleLinear({domain:[0,x],range:[o-d.bottom,d.top]})},[l,o]),g=x=>{if(c.current)return;if(!x){n(null);return}let{x0:v,x1:y}=x;if(v===y)return;let C=new Date(v),T=new Date(y);if(!(Number.isNaN(C.getTime())||Number.isNaN(T.getTime()))){if(l.length>0){let P=Math.min(...l.map(V=>V.xValue.getTime())),R=Math.max(...l.map(V=>V.xValue.getTime())),D=(R-P)*.05;if(Math.abs(C.getTime()-P)<D&&Math.abs(T.getTime()-R)<D){n(null);return}}n([C,T]);}},f=Me.useMemo(()=>{if(l.length!==0)return {start:{x:0,y:d.top},end:{x:u,y:o-d.bottom}}},[u,o,l]);Me.useEffect(()=>{if(!s.current||l.length===0)return;let x=s.current.state;if(x?.isBrushing||x?.activeHandle)return;let v=Math.min(...l.map(L=>L.xValue.getTime())),y=Math.max(...l.map(L=>L.xValue.getTime())),C=a?a[0]:new Date(v),T=a?a[1]:new Date(y),P=s.current.state?.extent;if(P){let L=m.invert(P.x0),D=m.invert(P.x1),A=Math.abs(L.getTime()-C.getTime()),V=Math.abs(D.getTime()-T.getTime());if(A<1e3&&V<1e3)return}c.current=true;let R=L=>{let D=s.current.getExtent({x:m(C),y:d.top},{x:m(T),y:o-d.bottom});return {...L,start:{y:D.y0,x:D.x0},end:{y:D.y1,x:D.x1},extent:D}};s.current.updateBrush(R),setTimeout(()=>{c.current=false;},50);},[a,m,o,l]);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-muted)",strokeWidth:1,orientation:["diagonal"]}),jsxRuntime.jsxs("g",{transform:`translate(${d.left}, 0)`,children:[e.map((x,v)=>jsxRuntime.jsx(shape.LinePath,{data:x,x:y=>m(y.xValue),y:y=>p(y.yValue),stroke:t[v]?.color||"var(--color-gray-500)",strokeWidth:1.5,opacity:.8},`brush-series-${v}`)),jsxRuntime.jsx(brush.Brush,{xScale:m,yScale:p,width:u,height:o-d.top-d.bottom,margin:{top:d.top,bottom:d.bottom,left:0,right:0},handleSize:8,innerRef:s,resizeTriggerAreas:["left","right"],brushDirection:"horizontal",initialBrushPosition:f,onChange:g,onClick:()=>n(null),selectedBoxStyle:b,useWindowMoveEvents:true})]})]})})};function cb(e){switch(e){case "command":return mt("--color-action-primary","#3b82f6");case "success":return mt("--color-feedback-success","#10b981");case "warning":return mt("--color-feedback-warning","#f59e0b");case "error":return mt("--color-feedback-error","#ef4444");case "alert":return mt("--color-feedback-warning","#f59e0b");default:return mt("--color-action-secondary","#6b7280")}}function Ys({events:e,color:t,showLabels:r=false}){let o=Me.useContext(Co),[n,a]=Me.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(x=>{let v=i(x.timestamp);return v>=Ye.left&&v<=i.range()[1]}),f=Me.useCallback((x,v)=>{a(v);let y=i(x.timestamp),C=y>(i.range()[1]-Ye.right-Ye.left)/2+Ye.left,T=[];d&&u&&d.forEach((P,R)=>{if(P.length===0)return;let L=d3Array.bisector(w=>w.xValue).left,D=L(P,x.timestamp),A=P[D-1],V=P[D],M;if(!A)M=V;else if(!V)M=A;else {let w=Math.abs(x.timestamp.getTime()-A.xValue.getTime()),N=Math.abs(x.timestamp.getTime()-V.xValue.getTime());M=w<N?A:V;}M&&u[R]&&T.push({label:u[R].label,value:M.yValue,color:u[R].color,type:m?.[R]||"line",...M.category&&{category:M.category,categoryColor:p?.[M.category]}});}),T.push({label:x.label,value:0,color:t||cb(x.type),type:"event"}),l.show({xValue:x.timestamp,series:T,x:y,y:T.length>1&&typeof T[0].value=="number"?s(T[0].value):c/2,position:C?"left":"right",isEvent:true,eventMetadata:x.metadata});},[i,s,c,l,t,d,u,m,p]),b=Me.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((x,v)=>{let y=i(x.timestamp),C=t||cb(x.type),T=n===v;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:y,y1:Ye.top,x2:y,y2:c-Ye.bottom,stroke:C,strokeWidth:T?3:2,strokeDasharray:"4 4",strokeOpacity:T?.9:.6,pointerEvents:"none"}),jsxRuntime.jsx("circle",{cx:y,cy:Ye.top,r:T?5:4,fill:C,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),jsxRuntime.jsx("circle",{cx:y,cy:c-Ye.bottom,r:T?5:4,fill:C,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),r&&jsxRuntime.jsx("text",{x:y,y:Ye.top-8,textAnchor:"middle",fill:"var(--color-text-caption)",fontSize:11,fontWeight:500,pointerEvents:"none",children:x.label}),jsxRuntime.jsx("rect",{x:y-10,y:Ye.top,width:20,height:c-Ye.top-Ye.bottom,fill:"transparent",style:{cursor:"pointer"},onMouseEnter:()=>f(x,v),onMouseLeave:b})]},`${x.timestamp.getTime()}-${v}`)})})}var Ya=({data:e,color:t="var(--color-viz-default)",strokeWidth:r=3,strokeDasharray:o})=>{let{xScale:n,yScale:a,animationSettings:i}=_o(),s=a.range();return jsxRuntime.jsx(framerMotion.motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:i.duration,ease:i.ease},style:{transformOrigin:`0 ${s[0]}px`,transformBox:"fill-box",isolation:"isolate"},children:jsxRuntime.jsx(shape.LinePath,{data:e,x:c=>n(c.xValue),y:c=>a(c.yValue),stroke:t,strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",curve:curve.curveLinear})})};var fb=e=>e.type===Ba||e.type===Ya||e.type===Hn,Fw=e=>e.type===Ys,Bw=d3Array.bisector(e=>e.xValue).left,zw=()=>jsxRuntime.jsx("div",{className:"flex h-full items-center justify-center",children:jsxRuntime.jsx("p",{className:"text-gray-500",children:"No data available"})}),Vw=()=>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"})]})]}),Ow=({parentWidth:e,parentHeight:t,yFormatter:r={type:"number"},isLoading:o=false,enableZoom:n=false,enableBrush:a=false,brushHeight:i=60,onZoomChange:s,children:c})=>{let[l,d]=Me.useState(null),[u,m]=Me.useState(null),p=Me.useRef(null),g=Me.useRef(0),f=Me.useRef(""),b=Me.useRef(null),{colorMode:x}=Rt(),v=Me.useMemo(()=>fa(),[x]),y=Me.useMemo(()=>Bc(),[x]),{datasets:C,seriesMetadata:T,categoryInfo:P,categoryColors:R,categoryLabels:L,hasBarSeries:D,firstBarSeriesIndex:A,seriesTypes:V}=Me.useMemo(()=>{let se=Me.Children.toArray(c).filter(ee=>Me.isValidElement(ee)&&fb(ee)),Ne=se.filter(ee=>ee.props.data).length,ze=se.some(ee=>ee.type===Hn),De=[],te=[],ce=[],_=null,Z=null,Y=null;se.forEach((ee,xe)=>{let he=ee.props;if(!he.data)return;De.push(he.data);let Lo=("color"in he&&he.color?he.color:void 0)||(Ne===1?y:v[xe%v.length]);te.push({label:"label"in he&&he.label||`Series ${De.length}`,color:Lo});let Sr=ee.type===Ba?"area":ee.type===Ya?"line":"bar";ce.push(Sr),"categoryColors"in he&&he.categoryColors&&(_=he.categoryColors),"categoryLabels"in he&&he.categoryLabels&&(Z=he.categoryLabels),ee.type===Hn&&Y===null&&(Y=De.length-1);});let ae=null;if(_){let ee=new Set;De.forEach(xe=>{xe.forEach(he=>{he.category&&ee.add(he.category);});}),ae=Array.from(ee).map(xe=>({label:Z?.[xe]||xe,color:_[xe]||"#6b7280"}));}return {datasets:De,seriesMetadata:te,categoryInfo:ae,categoryColors:_,categoryLabels:Z,hasBarSeries:ze,firstBarSeriesIndex:Y,seriesTypes:ce}},[c,y,v,x]),M=e,w=a?i+8:0,N=t-60-w,z=Math.max(100,N),W=Me.useMemo(()=>C.flat(),[C]),F=Me.useMemo(()=>{if(W.length===0)return null;let $=[...W].sort((se,Ne)=>se.xValue.getTime()-Ne.xValue.getTime());return [$[0].xValue,$[$.length-1].xValue]},[W]),K=u||F,X=Me.useMemo(()=>K?C.map(se=>se.filter(Ne=>Ne.xValue>=K[0]&&Ne.xValue<=K[1])):C,[C,K]);Me.useEffect(()=>{s&&s(u);},[u,s]);let G=Me.useMemo(()=>X.flat(),[X]),U=Me.useMemo(()=>fu(G,z,r),[G,z,r]),k=Me.useMemo(()=>{let $=z-Ye.top-Ye.bottom;return Hs($)},[z]),S=Me.useMemo(()=>{let $=qr(r),se=$.tickFormat||$.format,ze=U.ticks(k).map(ce=>se(ce)),De=Vs(ze,12,"system-ui"),te=Math.ceil(De)+12;return {...Ye,left:Math.max(te,30)}},[U,r,k]),B=Me.useMemo(()=>K?scale.scaleTime({domain:K,range:[S.left,M-S.right]}):mu(W,M),[K,W,M,S]),E=Me.useCallback($=>{if(!F)return;let{scaleX:se,translateX:Ne}=$,ze=M-S.left-S.right,[De,te]=F,ce=te.getTime()-De.getTime();if(ce<=0){m(null);return}let _=-Ne,Z=_+ze,Y=ze*se/ce,ae=_/Y,ee=Z/Y,xe=new Date(De.getTime()+ae),he=new Date(De.getTime()+ee),at=Math.abs(xe.getTime()-De.getTime()),Lo=Math.abs(he.getTime()-te.getTime()),Sr=ce*.02;at<Sr&&Lo<Sr?m(null):m([xe,he]);},[F,M,S]),h=Me.useCallback($=>{let{left:se}=p.current?.getBoundingClientRect()||{left:0},Ne=$.clientX-se;if($.timeStamp-(g.current||0)<16)return;g.current=$.timeStamp;let ze=B.invert(Ne),De=C.map((_,Z)=>{if(!_||_.length===0)return null;let Y=Bw(_,ze,1);if(Y===0)return {point:_[0],datasetIndex:Z};if(Y>=_.length)return {point:_[_.length-1],datasetIndex:Z};let ae=_[Y-1],ee=_[Y];if(!ae||!ee)return null;let xe=Math.abs(ae.xValue.getTime()-ze.getTime()),he=Math.abs(ee.xValue.getTime()-ze.getTime());return {point:xe<he?ae:ee,datasetIndex:Z}}).filter(_=>_!==null&&T[_.datasetIndex]!==void 0).map(({point:_,datasetIndex:Z})=>({label:T[Z].label,value:_.yValue,color:T[Z].color,point:_,type:V[Z]}));if(De.length===0){d(null);return}let te=B(De[0].point.xValue),ce=te>(M-S.right-S.left)/2+S.left;d({xValue:De[0].point.xValue,series:De.map(({label:_,value:Z,color:Y,point:ae,type:ee})=>({label:_,value:Z,color:Y,type:ee,category:ae.category,categoryColor:ae.category&&R?R[ae.category]:void 0})),x:te,y:U(De[0].value),position:ce?"left":"right"});},[C,X,T,V,B,U,M,R,S]),O=()=>{d(null);},H=Me.useCallback(()=>{m(null),b.current&&b.current.reset();},[]),j=Me.useCallback($=>{if(m($),b.current&&F){let[se,Ne]=F,ze=Ne.getTime()-se.getTime();if(ze<=0){b.current.reset();return}if(!$)b.current.reset();else {let[De,te]=$,ce=te.getTime()-De.getTime();if(ce<=0){b.current.reset();return}let _=ze/ce,Z=M-S.left-S.right,ae=-((De.getTime()-se.getTime())/ze)*Z*_;b.current.setTransformMatrix({scaleX:_,scaleY:1,translateX:ae,translateY:0,skewX:0,skewY:0});}}},[F,M,S]),oe={width:M,height:z,xScale:B,yScale:U,yFormatter:r,animationSettings:wg,tooltip:{data:l,show:d,hide:()=>d(null)},datasets:X,seriesMetadata:T,seriesTypes:V,categoryColors:R||void 0,categoryLabels:L||void 0},me=Me.Children.toArray(c),q=0,ne=[],Te=[];me.forEach($=>{if(!Me.isValidElement($)){ne.push($);return}if(Fw($))Te.push($);else if(fb($)){let se=q;q++;let Ne=$.props;ne.push(Me__namespace.default.cloneElement($,{...Ne,data:X[se]||Ne.data,color:T[se]?.color}));}else ne.push($);});let ie=(P||T).map($=>({category:$.label,fill:$.color})),ue=Lp({datasets:C,metadata:{xLabel:"Date",yLabel:"Value",seriesLabels:T.map($=>$.label),timestamp:true},svgRef:p});if(o)return jsxRuntime.jsx(Vw,{});if(C.length===0)return jsxRuntime.jsx(zw,{});let ge=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("title",{children:"Data chart visualization"}),jsxRuntime.jsx("g",{children:U.ticks(k).map($=>jsxRuntime.jsx(shape.Line,{from:{x:S.left,y:U($)},to:{x:M-S.right,y:U($)},stroke:"var(--color-border-muted)",strokeWidth:1},`grid-line-${$}`))}),ne,jsxRuntime.jsx(Ar.Bottom,{top:z-S.bottom,scale:B,width:M-S.left-S.right}),jsxRuntime.jsx(Ar.Left,{left:S.left,scale:U,yFormatter:r,height:z-S.top-S.bottom}),l&&!l.isEvent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D&&A!==null?(()=>{let $=X[A]??[];if($.length===0)return null;let se=[...$].sort((Y,ae)=>Y.xValue.getTime()-ae.xValue.getTime()),Ne=se.findIndex(Y=>Y.xValue.getTime()===l.xValue.getTime()),ze=se[Ne+1],De=se.length>1&&ze?ze.xValue.getTime()-l.xValue.getTime():15*6e4,te=Math.abs(B(new Date(l.xValue.getTime()+De))-B(l.xValue)),_=B(l.xValue)-te/2,Z=U.range();return jsxRuntime.jsx("rect",{x:_,y:Z[1],width:te,height:Z[0]-Z[1],className:"fill-background-muted",opacity:.5,pointerEvents:"none",style:{transition:"all 100ms ease-out"}})})():null,l.series.filter($=>$.type!=="bar").map($=>jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:B(l.xValue),cy:U($.value),r:8,fill:"white",stroke:$.color,strokeWidth:2,style:{transition:"all 100ms ease-out"}}),jsxRuntime.jsx("circle",{cx:B(l.xValue),cy:U($.value),r:4,fill:$.color,style:{transition:"all 100ms ease-out"}})]},`highlight-${$.label}`))]}),jsxRuntime.jsx("rect",{x:S.left,y:S.top,width:M-S.left-S.right,height:z-S.top-S.bottom,fill:"transparent",style:{cursor:n?"grab":"crosshair"},onMouseMove:h,onMouseLeave:O}),Te]});return jsxRuntime.jsx("div",{className:"relative flex h-full flex-col",children:jsxRuntime.jsxs(Co.Provider,{value:oe,children:[n?jsxRuntime.jsx(zoom.Zoom,{width:M,height:z,scaleXMin:1,scaleXMax:20,scaleYMin:1,scaleYMax:1,constrain:$=>{let{scaleX:se,translateX:Ne}=$,ze=Math.max(1,Math.min(20,se)),De=1,te=M-S.left-S.right,ce=0,_=te*(1-ze),Z=Math.max(_,Math.min(ce,Ne));return {...$,scaleX:ze,scaleY:De,translateX:Z,translateY:0}},children:$=>{if(b.current=$,$.transformMatrix){let{scaleX:se,translateX:Ne}=$.transformMatrix,ze=`${se.toFixed(4)}-${Ne.toFixed(2)}`;ze!==f.current&&(f.current=ze,setTimeout(()=>{E($.transformMatrix);},0));}return jsxRuntime.jsx("svg",{width:M,height:z,className:"overflow-visible",ref:se=>{p.current=se,$.containerRef.current!==se&&($.containerRef.current=se);},role:"img","aria-label":"Data chart",style:{cursor:$.isDragging?"grabbing":"grab",touchAction:"none"},onMouseDown:$.dragStart,onMouseMove:$.dragMove,onMouseUp:$.dragEnd,onMouseLeave:()=>{$.isDragging&&$.dragEnd();},onTouchStart:$.dragStart,onTouchMove:$.dragMove,onTouchEnd:$.dragEnd,children:ge})}}):jsxRuntime.jsx("svg",{width:M,height:z,className:"overflow-visible",ref:p,role:"img","aria-label":"Data chart",children:ge}),jsxRuntime.jsx(Un,{data:l,formatter:r}),a&&F&&jsxRuntime.jsx(bu,{data:C,seriesMetadata:T,width:M,height:i,onBrushChange:j,brushRegion:u,margin:S}),jsxRuntime.jsx(Gs,{onExport:ue,items:ie,marginLeft:0,marginRight:S.right,isZoomed:u!==null,onResetZoom:H})]})})},bb=responsive.withParentSize(Ow);var Kw=e=>e.toLocaleString(),Jw=e=>`${Math.round(e*100)}%`,vb=({data:e,width:t=800,height:r=400,padding:o=0,barGap:n=30,formatValue:a=Kw,formatPercentage:i=Jw,color:s,showScale:c=true,showOverallConversion:l=true,overallConversionLabel:d="Overall Conversion:",activeStageId:u,onStageClick:m,onStageHover:p,className:g,style:f,"aria-label":b="Funnel chart"})=>{let[x,v]=Me.useState(null),[y,C]=Me.useState(t),T=Me.useRef(null),P=u??x,R=Me.useId(),L=s||"var(--color-viz-default)";Me.useEffect(()=>{if(!T.current)return;let N=new ResizeObserver(z=>{for(let W of z)C(W.contentRect.width);});return N.observe(T.current),()=>{N.disconnect();}},[]);let{layout:D,overallConversion:A}=Me.useMemo(()=>{if(e.length===0)return {layout:[],overallConversion:0};let N=e[0].value,z=l?60:0,W=r-o*2-z,F=(e.length-1)*n,K=(W-F)/e.length,X=e.map((U,k)=>{let S=o+z+k*(K+n),B=N===0?0:U.value/N,E=B,h=k===0?null:e[k-1].value,O=h==null||h===0?0:1-U.value/h;return {stage:U,index:k,y:S,barHeight:K,widthPercent:B,conversionRate:E,dropOff:O}}),G=N===0?0:e[e.length-1].value/N;return {layout:X,overallConversion:G,maxValue:N}},[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-gray-300 bg-background-surface text-sm font-medium text-text-muted dark:border-gray-700",g),style:{width:t,height:r,...f},children:"No funnel data available"});let V=c?60:0,M=o+V,w=y-o*2-V;return jsxRuntime.jsx("div",{ref:T,className:tailwindMerge.twMerge("relative w-full overflow-hidden rounded-lg bg-background-surface",g),style:{height:r,...f},"aria-label":b,role:"img",children:jsxRuntime.jsxs("svg",{width:"100%",height:r,className:"relative",children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx(gradient.LinearGradient,{id:`${R}-bar`,from:L,to:L,toOpacity:.85}),jsxRuntime.jsx(gradient.LinearGradient,{id:`${R}-bg`,from:L,to:L,fromOpacity:.01,toOpacity:.15,x1:"0",y1:"0",x2:"1",y2:"0"})]}),l&&jsxRuntime.jsxs("text",{x:M,y:o+20,className:"fill-text-body text-sm font-medium",children:[jsxRuntime.jsx("tspan",{className:"fill-text-muted",children:d})," ",i(A)]}),c&&jsxRuntime.jsx("g",{children:D.map(N=>{let z=N.y+N.barHeight/2;return jsxRuntime.jsx("text",{x:o+V-12,y:z,textAnchor:"end",dominantBaseline:"middle",className:"fill-text-caption text-xs",children:i(N.conversionRate)},N.stage.id)})}),D.map(N=>{let z=P===N.stage.id,W=w*N.widthPercent;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:M,y:N.y,width:w,height:N.barHeight,fill:`url(#${R}-bg)`,rx:4}),jsxRuntime.jsx(framerMotion.motion.rect,{x:M,y:N.y,width:W,height:N.barHeight,fill:`url(#${R}-bar)`,rx:4,initial:{width:0},animate:{width:W},transition:{duration:.6,delay:N.index*.1,ease:"easeOut"},opacity:z||P==null?1:.5,style:{cursor:m||p?"pointer":"default",transition:"opacity 150ms ease"},onMouseEnter:()=>{v(N.stage.id),p?.(N.stage);},onMouseLeave:()=>{v(null),p?.(null);},onClick:()=>m?.(N.stage)}),jsxRuntime.jsx("rect",{x:M+10,y:N.y+N.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:M+16,y:N.y+N.barHeight/2+4,className:"fill-text-heading text-xs font-semibold",style:{pointerEvents:"none"},children:a(N.stage.value)}),jsxRuntime.jsxs("text",{x:M,y:N.y-8,className:"fill-text-muted text-xs",style:{pointerEvents:"none"},children:[jsxRuntime.jsx("tspan",{children:N.index+1})," ",N.stage.label]}),N.stage.secondaryValue&&jsxRuntime.jsx("text",{x:M+16,y:N.y-24,className:"fill-text-muted text-xs",style:{pointerEvents:"none"},children:N.stage.secondaryValue}),N.index>0&&N.dropOff>0&&jsxRuntime.jsxs("text",{x:M+w,y:N.y-8,textAnchor:"end",className:"fill-text-muted text-xs",children:[i(N.dropOff)," drop"]}),N.stage.annotation&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:M+W+8,y:N.y+8,width:60,height:24,rx:3,className:"fill-background-muted"}),jsxRuntime.jsx("text",{x:M+W+16,y:N.y+20,className:"fill-text-caption text-xs font-medium",children:N.stage.annotation})]})]},N.stage.id)})]})})};function jw(e,t,r){return {field:e,operator:t,value:r}}function qw(e,t="AND"){return {logic:t,conditions:e}}function Ka(){return {logic:"AND",conditions:[]}}function js(e){return !e||e.conditions.length===0?true:e.conditions.every(t=>"conditions"in t?js(t):false)}function Zw(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(x=>String(x.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":">",b=g.operator==="lte"?"\u2264":"<";a.push({id:`${i}-range`,label:l,value:`${f} ${p.value} and ${b} ${g.value}`});}else for(let f of u){let b;f.operator==="gte"?b="\u2265":f.operator==="gt"?b=">":f.operator==="lte"?b="\u2264":b="<",a.push({id:`${i}-${f.operator}`,label:l,value:`${b} ${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 So(e,t){let r=e||Ka();return {...r,conditions:[...r.conditions,t]}}function rn(e,t){if(!e)return Ka();let r=e.conditions.filter(o=>"conditions"in o?rn(o,t).conditions.length>0:o.field!==t);return {...e,conditions:r}}function on(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 Ja({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-muted whitespace-nowrap ${o}`,children:[e.toLocaleString()," ",a]})}var eN=e=>{let t=xt({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),r=[e.showSearchIcon?"pl-8":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return tailwindMerge.twMerge(t,r,e.className)};function ar({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[b,x]=Me__namespace.default.useState(false),{isFocused:v,handleFocus:y,handleBlur:C}=nr(),T=d==="password",P=Pi(p,300);return jsxRuntime.jsx(reactAriaComponents.TextField,{...f,isRequired:a,className:Ce(f.className,"group flex flex-col"),children:({isDisabled:R,isInvalid:L})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(Ee,{size:o,tooltip:n,description:g==="tooltip"||g==="inline"?t:void 0,descriptionPlacement:g,isRequired:a,children:e}),jsxRuntime.jsxs(ot,{children:[s&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-2 top-[45%] -translate-y-1/2 transform flex items-center z-10",children:P?jsxRuntime.jsx(Gr,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(I,{name:"MagnifyingGlass",className:`h-4 w-4 transition-colors ${v?"text-action-brand":"text-text-muted"}`})}),jsxRuntime.jsx(cs,{size:o,disabled:R,type:T?b?"text":"password":d,value:f.value,defaultValue:f.defaultValue,placeholder:f.placeholder,onFocus:D=>y(D,f.onFocus),onBlur:D=>C(D,f.onBlur),onChange:D=>f.onChange?.(D.target.value),className:eN({isInvalid:L,isDisabled:R,isFocused:v,size:o,transparent:i,showSearchIcon:s,isClearable:c,hasValue:!!f.value,isPassword:T,className:typeof f.className=="string"?f.className:void 0})}),c&&f.value&&!R&&jsxRuntime.jsx(Da,{onClick:()=>{l?l():f.onChange&&f.onChange("");},size:o}),T&&!R&&jsxRuntime.jsx("button",{type:"button",onClick:()=>x(!b),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":b?"Hide password":"Show password",onMouseDown:D=>{D.preventDefault(),D.stopPropagation();},children:jsxRuntime.jsx(I,{name:b?"EyeSlash":"Eye",size:o==="sm"?16:20,className:"text-text-body"})})]}),m?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsxRuntime.jsx(pe,{size:o,children:r}):typeof r=="function"&&u?jsxRuntime.jsx(pe,{size:o,children:r(u)}):t&&g==="below"?jsxRuntime.jsx(Se,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&u?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r(u)}):t&&g==="below"?jsxRuntime.jsx(Se,{size:o,className:"mt-1",children:t}):null})]})})}function nn({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(ar,{value:e,onChange:t,placeholder:o,showSearchIcon:true,isClearable:!!e&&!!r,onClear:r,size:n,"aria-label":o,reserveErrorSpace:false,isLoading:i})})}function ja({value:e,options:t,onChange:r,direction:o,onDirectionChange:n,showLabel:a=true,size:i="sm",className:s="",compact:c=false}){let[l,d]=Me.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(Q,{variant:"secondary",size:i,icon:"ArrowsDownUp","aria-label":`Sort by: ${m?.label||"Select"}`,onPress:()=>d(true)}),jsxRuntime.jsx(Xe,{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(Mt,{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-muted whitespace-nowrap",children:"Sort by:"}),jsxRuntime.jsx(Ko,{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(Q,{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 Tb({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:b,stickyTop:x="0",zIndex:v=10,className:y="",style:C}){let T=r.length>0;if(!(e||T||a||c||l||d||u||m||p||g||i))return null;let R=b?"sticky bg-background-surface":"",L=b?{top:x,zIndex:v}:{};return jsxRuntime.jsxs("div",{className:`@container flex flex-col gap-3 bg-background-surface py-3 border-b border-border-default ${R} ${y}`,style:{...C,...L},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(Ja,{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(ja,{value:c.value,options:c.options,onChange:c.onChange,showLabel:c.showLabel,direction:c.direction,onDirectionChange:c.onDirectionChange}),u?jsxRuntime.jsx(Q,{variant:"secondary",size:"sm",icon:"Columns",onClick:u,children:"Columns"}):m,T&&o&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.slice(0,s).map(D=>jsxRuntime.jsxs(Er,{variant:"brand",size:"sm",onRemove:()=>o(D.id),isRemovable:true,children:[D.label,": ",D.value]},D.id)),r.length>s&&a&&jsxRuntime.jsxs(Q,{variant:"ghost",size:"sm",onClick:a,className:"text-text-muted hover:text-text-body whitespace-nowrap",children:["+",r.length-s," more"]}),n&&jsxRuntime.jsx(Q,{variant:"ghost",size:"sm",onClick:n,className:"text-text-muted hover:text-text-body 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(D=>jsxRuntime.jsx(Q,{variant:D.variant||"secondary",size:"sm",icon:D.icon,onPress:D.onClick,isDisabled:D.disabled,children:D.label},D.id))}),e&&jsxRuntime.jsx("div",{className:"w-64",children:jsxRuntime.jsx(nn,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsxRuntime.jsx(Q,{variant:"secondary",size:"sm",icon:"Sliders",badgeNumber:r.length>0?r.length:void 0,onClick:a,children:"Filters"}),i&&jsxRuntime.jsx(Q,{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(Ln,{items:g.items.map(D=>({id:D.id,name:D.label,iconName:D.icon,variant:D.variant==="destructive"?"destructive":"default",disabled:D.disabled,onAction:D.onClick})),align:"left",size:"sm",children:jsxRuntime.jsx(Q,{variant:"secondary",size:"sm",icon:"DotsThreeVertical","aria-label":g.menuLabel||"Actions"})}),e&&jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsx(nn,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsxRuntime.jsx(Q,{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(Q,{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(Ja,{count:l.count,label:l.label,isLoading:l.isLoading})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:c&&jsxRuntime.jsx(ja,{value:c.value,options:c.options,onChange:c.onChange,showLabel:false,direction:c.direction,onDirectionChange:c.onDirectionChange,compact:f!=="desktop"})})]})]})]})}function kb({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(Q,{variant:"secondary",size:s,onClick:o,className:"whitespace-nowrap",children:[e.length," ",e.length===1?"filter":"filters"]}),b=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g&&jsxRuntime.jsx(Q,{variant:"secondary",size:s,icon:"Sliders",onClick:o,className:"whitespace-nowrap",children:"Filters"}),l&&d.map(v=>jsxRuntime.jsxs(Er,{variant:"secondary",size:s,onRemove:()=>t(v.id),isRemovable:true,children:[v.label,": ",v.value]},v.id)),l&&m&&o&&jsxRuntime.jsxs(Q,{variant:"ghost",size:s,onClick:o,className:"text-text-muted hover:text-text-body whitespace-nowrap",children:["+",u," more"]}),l&&r&&jsxRuntime.jsx(Q,{variant:"ghost",size:s,onClick:r,className:"text-text-muted hover:text-text-body whitespace-nowrap",children:"Clear all"})]}),x=a==="button"?f:b;return jsxRuntime.jsx("div",{className:`flex flex-wrap items-center gap-2 ${c}`,children:x})}function Rb({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]=Me.useState(false),f=b=>{m.onChange&&b&&m.onChange(b),g(false);};return jsxRuntime.jsxs(reactAriaComponents.DateField,{...m,isDisabled:i,isRequired:a,isInvalid:s,className:Ce(u,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(Ee,{size:o,tooltip:n,isRequired:a,children:e}),jsxRuntime.jsx(ot,{children:jsxRuntime.jsxs("div",{className:"relative w-full",children:[jsxRuntime.jsx(qa,{size:o,isDisabled:i,isInvalid:s,hasCalendar:c}),c&&!i&&jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:p,onOpenChange:g,children:[jsxRuntime.jsx(Q,{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-muted hover:text-text-body transition-colors","aria-label":"Open calendar",children:jsxRuntime.jsx(I,{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(Bn,{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(pe,{size:o,children:r}):typeof r=="function"&&d?jsxRuntime.jsx(pe,{size:o,children:r(d)}):t?jsxRuntime.jsx(Se,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&d?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r(d)}):t?jsxRuntime.jsx(Se,{size:o,className:"mt-1",children:t}):null})]})}function fN({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-placeholder italic":"text-text-body",t?"text-text-disabled cursor-not-allowed":"cursor-text",!t&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function qa({size:e="md",isDisabled:t,isInvalid:r,hasCalendar:o,className:n,...a}){return jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(mo({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:fN({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||t,size:e})})})}function CN({selectionState:e,isDisabled:t}){let r=`${Oe} w-full h-full flex items-center justify-center rounded-sm forced-color-adjust-none font-semibold`,o={none:"text-text-body group-hover:bg-background-muted group-pressed:bg-background-muted",middle:["bg-gray-100 dark:bg-zinc-700 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600 forced-colors:group-hover:bg-[Highlight]","group-invalid:group-hover:bg-red-200 forced-colors:group-invalid:group-hover:bg-[Mark]","group-pressed:bg-gray-200 dark:group-pressed:bg-zinc-600 forced-colors:group-pressed:bg-[Highlight] forced-colors:text-[HighlightText]","group-invalid:group-pressed:bg-red-300 forced-colors:group-invalid:group-pressed:bg-[Mark]"].join(" "),cap:"bg-zinc-900 dark:bg-zinc-100 text-white dark:text-zinc-900 group-invalid:bg-red-600 forced-colors:bg-[Highlight] forced-colors:group-invalid:bg-[Mark] forced-colors:text-white"},n=t?"text-textFaint dark:text-zinc-600 forced-colors:text-textFaint font-light":"";return [r,o[e],n].filter(Boolean).join(" ")}function qn({errorMessage:e,...t}){return jsxRuntime.jsxs(reactAriaComponents.RangeCalendar,{...t,children:[jsxRuntime.jsx(hs,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"w-full border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(ys,{}),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-gray-300 invalid:selected:bg-red-100 forced-colors:selected:bg-[Highlight] forced-colors:selected:text-white 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:CN({selectionState:n&&(a||i)?"cap":n?"middle":"none",isDisabled:c}),children:o})})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function Xs({label:e,description:t,errorMessage:r,...o}){return jsxRuntime.jsxs(reactAriaComponents.DateRangePicker,{...o,className:Ce(o.className,"group flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(Ee,{children:e}),jsxRuntime.jsxs(If,{className:"w-auto min-w-[208px]",children:[jsxRuntime.jsx(qa,{slot:"start",className:"px-2 py-1.5 text-sm"}),jsxRuntime.jsx("span",{"aria-hidden":"true",className:"text-gray-800 group-disabled:text-gray-200 dark:text-zinc-200 group-disabled:dark:text-zinc-600 forced-colors:text-[ButtonText] group-disabled:forced-colors:text-[GrayText]",children:"\u2013"}),jsxRuntime.jsx(qa,{slot:"end",className:"flex-1 px-2 py-1.5 text-sm"}),jsxRuntime.jsx(Q,{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(Se,{children:t}),typeof r=="string"?jsxRuntime.jsx(pe,{children:r}):null,jsxRuntime.jsx(Ze,{children:jsxRuntime.jsx(qn,{})})]})}var DN=e=>{let t=xt({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 Za({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=Me.useId(),{isFocused:m,handleFocus:p,handleBlur:g}=nr();return jsxRuntime.jsx(reactAriaComponents.NumberField,{...d,id:u,isRequired:a,className:Ce(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:b})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsxRuntime.jsx(Ee,{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:v=>p(v,d.onFocus),onBlur:v=>g(v,d.onBlur),className:DN({isInvalid:b||!!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(I,{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(I,{name:"CaretDown",size:14})})]})]})}),c?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:r?jsxRuntime.jsx(pe,{size:o,children:typeof r=="function"?r(s):r}):t&&l==="below"?jsxRuntime.jsx(Se,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:r?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:typeof r=="function"?r(s):r}):t&&l==="below"?jsxRuntime.jsx(Se,{size:o,className:"mt-1",children:t}):null})]})})}var Cu={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 AN({isSelected:e,isDisabled:t,variant:r="default",size:o="md"}){let n="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",a=Cu[o].track,i=Oe,s=r==="brand"?"focus-visible:outline-action-brand":"focus-visible:outline-action-default",c="";return e?r==="brand"?c="bg-action-brand forced-colors:!bg-[Highlight] group-pressed:bg-action-brand-hover":c="bg-action-default forced-colors:!bg-[Highlight] group-pressed:bg-action-default-hover":c="bg-gray-400 dark:bg-zinc-400 group-pressed:bg-gray-500 dark:group-pressed:bg-zinc-300",[n,a,i,s,c,t?"bg-gray-200 dark:bg-zinc-700 forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function LN({isSelected:e,isDisabled:t,size:r="md"}){let o="transform rounded-full bg-white dark:bg-zinc-900 outline-none shadow transition duration-200 ease-in-out",n=Cu[r].handle;return [o,n,e?"translate-x-[100%]":"translate-x-0",t?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function $s({children:e,variant:t="default",size:r="md",...o}){return jsxRuntime.jsx(reactAriaComponents.Switch,{...o,className:Ce(o.className,`group flex items-center gap-2 ${Cu[r].text} text-gray-800 transition disabled:text-gray-300 dark:text-zinc-200 dark:disabled:text-zinc-600 forced-colors:disabled:text-[GrayText]`),children:n=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:AN({...n,variant:t,size:r}),children:jsxRuntime.jsx("span",{className:LN({...n,size:r})})}),e]})})}function Ab(e){return new Intl.NumberFormat("en-US").format(e)}function Lb({isOpen:e,onClose:t,facetConfigs:r,facetCounts:o={},currentFilters:n,onApply:a,onClear:i,title:s="Filters",resultCount:c}){let[l,d]=Me.useState(n),[u,m]=Me.useState({}),[p,g]=Me.useState({}),[f,b]=Me.useState(null),{isMobile:x}=kt(),v=Me.useMemo(()=>r.some(h=>h.group),[r]),{groups:y,ungroupedFacets:C,facetsByGroup:T}=Me.useMemo(()=>{let h=new Set,O=[],H={};for(let j of r)j.group?(h.has(j.group)||(h.add(j.group),H[j.group]=[]),H[j.group].push(j)):O.push(j);return {groups:Array.from(h),ungroupedFacets:O,facetsByGroup:H}},[r]);Me.useEffect(()=>{e&&(d(n),m({}),g({}),b(!x&&y.length>0?y[0]:null));},[e,n,y,x]);let P=Me.useMemo(()=>!l||js(l)?0:on(l).length,[l]),R=()=>{a(l),t();},L=()=>{let h=Ka();d(h),i?i():a(h),t();},D=h=>{if(!l)return [];if(!on(l).includes(h))return [];let H=[];function j(oe){if(oe)for(let me of oe.conditions)"conditions"in me?j(me):me.field===h&&me.operator==="in"&&Array.isArray(me.value)&&H.push(...me.value.map(String));}return j(l),H},A=(h,O,H)=>{let j=rn(l,h);O!==void 0&&(j=So(j,{field:h,operator:"gte",value:O})),H!==void 0&&(j=So(j,{field:h,operator:"lte",value:H})),d(j);},V=h=>{if(!l)return;let O;function H(j){if(j)for(let oe of j.conditions)"conditions"in oe?H(oe):oe.field===h&&oe.operator==="eq"&&typeof oe.value=="boolean"&&(O=oe.value);}return H(l),O},M=(h,O)=>{let H=rn(l,h);O!==void 0&&(H=So(H,{field:h,operator:"eq",value:O})),d(H);},w=(h,O,H)=>{let j=rn(l,h);O&&(j=So(j,{field:h,operator:"gte",value:O.toString()})),H&&(j=So(j,{field:h,operator:"lte",value:H.toString()})),d(j);},N=h=>{let O=T[h]||[],H=l?on(l):[];return O.filter(j=>H.includes(j.field)).length},z="pr-9 bg-background-muted/50",W="border-t border-border-muted",F="text-sm font-medium text-brand-primary",K=h=>jsxRuntime.jsx("span",{className:F,children:h}),X=h=>{let O=o[h.field]||{},H=u[h.field]||"",j=[];h.values?j=h.values.map(q=>({value:String(q.value),label:q.label,count:O[String(q.value)]})):j=Object.entries(O).map(([q,ne])=>({value:q,label:q,count:ne}));let oe=j.length;if(H){let q=H.toLowerCase();j=j.filter(ne=>ne.label.toLowerCase().includes(q));}j.sort((q,ne)=>q.count!==void 0&&ne.count!==void 0&&ne.count!==q.count?ne.count-q.count:q.label.localeCompare(ne.label));let me=h.type||"string";if(me==="string"||!h.type){let q=D(h.field),ne=h.searchThreshold??10,Te=h.maxVisibleOptions??50,ie=p[h.field]??false,ue=ie||j.length<=Te?j:j.slice(0,Te),ge=j.length>Te&&!ie;return jsxRuntime.jsxs(xo,{id:h.field,children:[jsxRuntime.jsx(ho,{title:h.label,description:h.description,className:z,endContent:q.length>0?K(`${q.length} selected`):void 0}),jsxRuntime.jsx(yo,{className:W,children:jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 pb-4",children:[oe>ne&&jsxRuntime.jsx(nn,{value:H,onChange:$=>m(se=>({...se,[h.field]:$})),onClear:()=>m($=>({...$,[h.field]:""})),placeholder:`Search ${h.label.toLowerCase()}...`,size:"sm",className:"w-full !max-w-none pr-4"}),jsxRuntime.jsx(jd,{value:q,onChange:$=>{let se=rn(l,h.field);$.length>0&&(se=So(se,{field:h.field,operator:"in",value:$})),d(se);},children:jsxRuntime.jsx("div",{className:"space-y-1.5",children:ue.map($=>jsxRuntime.jsx("div",{className:"rounded-md py-2 pr-4 transition-colors hover:bg-background-hover",children:jsxRuntime.jsx(Zo,{value:$.value,children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-3 flex-1",children:[h.renderLabel?h.renderLabel($.value,$.label):jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-body",children:$.label}),$.count!==void 0&&jsxRuntime.jsx("span",{className:"text-xs font-medium text-text-muted tabular-nums",children:Ab($.count)})]})})},$.value))})}),ge&&jsxRuntime.jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxRuntime.jsxs(Q,{variant:"ghost",size:"sm",onPress:()=>g($=>({...$,[h.field]:true})),className:"w-full",children:["Show all ",j.length," options"]})}),ie&&j.length>Te&&jsxRuntime.jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxRuntime.jsx(Q,{variant:"ghost",size:"sm",onPress:()=>g($=>({...$,[h.field]:false})),className:"w-full",children:"Show less"})})]})})]},h.field)}if(me==="number"){let q,ne,Te=ue=>{if(ue)for(let ge of ue.conditions)"conditions"in ge?Te(ge):ge.field===h.field&&(ge.operator==="gte"&&typeof ge.value=="number"&&(q=ge.value),ge.operator==="lte"&&typeof ge.value=="number"&&(ne=ge.value));};Te(l);let ie=q!==void 0||ne!==void 0;return jsxRuntime.jsxs(xo,{id:h.field,children:[jsxRuntime.jsx(ho,{title:h.label,description:h.description,className:z,endContent:ie?K(q!==void 0&&ne!==void 0?`${q} - ${ne}`:q!==void 0?`\u2265 ${q}`:`\u2264 ${ne}`):void 0}),jsxRuntime.jsx(yo,{className:W,children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 pb-4",children:[jsxRuntime.jsx(Za,{label:"Min",value:q,onChange:ue=>A(h.field,ue,ne)},`${h.field}-min`),jsxRuntime.jsx(Za,{label:"Max",value:ne,onChange:ue=>A(h.field,q,ue)},`${h.field}-max`)]})})]},h.field)}if(me==="boolean"){let q=V(h.field);return jsxRuntime.jsxs(xo,{id:h.field,children:[jsxRuntime.jsx(ho,{title:h.label,description:h.description,className:z,endContent:q!==void 0?K(q?"Yes":"No"):void 0}),jsxRuntime.jsx(yo,{className:W,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-body",children:q!==void 0?q?"Enabled":"Disabled":"No filter applied"}),jsxRuntime.jsx($s,{size:"lg",isSelected:q??false,onChange:ne=>M(h.field,ne?true:void 0),children:q?"Yes":"No"})]})})]},h.field)}if(me==="date"){let q,ne,Te=se=>{if(se)for(let Ne of se.conditions)"conditions"in Ne?Te(Ne):Ne.field===h.field&&(Ne.operator==="gte"&&(q=String(Ne.value)),Ne.operator==="lte"&&(ne=String(Ne.value)));};Te(l);let ie=q!==void 0||ne!==void 0,ue=se=>{if(se)try{return /^\d{4}-\d{2}-\d{2}$/.test(se)?Ra(se):void 0}catch{return}},ge=ue(q),$=ue(ne);return jsxRuntime.jsxs(xo,{id:h.field,children:[jsxRuntime.jsx(ho,{title:h.label,description:h.description,className:z,endContent:ie?K("Date range selected"):void 0}),jsxRuntime.jsx(yo,{className:W,children:jsxRuntime.jsx("div",{className:"pt-4 pb-4",children:jsxRuntime.jsx(Xs,{label:"Date Range",value:ge&&$?{start:ge,end:$}:void 0,onChange:se=>{se?w(h.field,se.start,se.end):w(h.field,void 0,void 0);}})})})]},h.field)}return null},G=()=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[C.map(h=>{let H=(l?on(l):[]).includes(h.field);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(`__ungrouped__${h.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-body",children:h.label}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[H&&jsxRuntime.jsx("span",{className:F,children:"1 active"}),jsxRuntime.jsx(I,{name:"CaretRight",size:"sm",className:"text-text-muted"})]})]},h.field)}),y.map(h=>{let O=N(h);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(h),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-body",children:h}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[O>0&&jsxRuntime.jsxs("span",{className:F,children:[O," active"]}),jsxRuntime.jsx(I,{name:"CaretRight",size:"sm",className:"text-text-muted"})]})]},h)})]}),U=h=>{if(h.startsWith("__ungrouped__")){let H=h.replace("__ungrouped__",""),j=C.find(oe=>oe.field===H);return j?jsxRuntime.jsx(zn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[j.field],children:X(j)}):null}let O=T[h]||[];return O.length===0?null:jsxRuntime.jsx(zn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[O[0].field],children:O.map(H=>X(H))})},k=()=>{if(f){let h=f.startsWith("__ungrouped__")&&C.find(O=>O.field===f.replace("__ungrouped__",""))?.label||f;return jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(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(I,{name:"CaretLeft",size:"sm",className:"text-text-muted"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-body",children:h})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:U(f)})]})}return G()},S=()=>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:[C.map(h=>{let H=(l?on(l):[]).includes(h.field),j=f===`__ungrouped__${h.field}`;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(`__ungrouped__${h.field}`),className:`flex items-center justify-between w-full px-4 py-3 text-left border-b border-border-muted transition-colors ${j?"bg-brand-primary/10":"hover:bg-background-hover"}`,children:[jsxRuntime.jsx("span",{className:`text-sm truncate ${j?"font-semibold text-text-body":"font-medium text-text-body"}`,children:h.label}),H&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-brand-primary flex-shrink-0 ml-2"})]},h.field)}),y.map(h=>{let O=N(h),H=f===h;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(h),className:`flex items-center justify-between w-full px-4 py-3 text-left border-b border-border-muted transition-colors ${H?"bg-brand-primary/10":"hover:bg-background-hover"}`,children:[jsxRuntime.jsx("span",{className:`text-sm truncate ${H?"font-semibold text-text-body":"font-medium text-text-body"}`,children:h}),O>0&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-brand-primary flex-shrink-0 ml-2"})]},h)})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:f?U(f):jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-text-muted text-sm",children:"Select a category to view filters"})})]}),B=()=>jsxRuntime.jsx(zn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[r[0].field],children:r.map(h=>X(h))});return jsxRuntime.jsx(_t,{isOpen:e,onClose:t,title:v&&x&&f?f.startsWith("__ungrouped__")?C.find(h=>h.field===f.replace("__ungrouped__",""))?.label||s:f:P>0?`${s} (${P} active)`:s,hideCloseIcon:false,primaryAction:{label:"Apply filters",onPress:R,variant:"default"},secondaryAction:{label:"Clear all",onPress:L},maxWidth:v?"800px":"700px",height:"600px",mobileHeight:"85vh",contentPadding:false,footerContent:c!==void 0?jsxRuntime.jsxs("div",{className:"text-sm text-text-muted text-center",children:[jsxRuntime.jsx("span",{className:"font-semibold text-text-body",children:Ab(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-muted",children:"No filters available"})}):v?x?k():S():B()})}function wu(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 ir(e="normal",t){return tailwindMerge.twMerge({strong:"font-semibold text-text-body",high:"font-semibold text-text-body",normal:"text-text-body",low:"text-text-muted"}[e],t&&"hover:text-action-brand cursor-pointer transition-colors")}function ke(e="left",t){return tailwindMerge.twMerge("flex items-center gap-1 min-w-0 overflow-hidden",wu(e),t)}function el(e,t="\u2014"){return e==null||e===""?t:String(e)}var wo={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 Vt(e="normal"){return {strong:wo.lg,high:wo.lg,normal:wo.md,low:wo.sm}[e]}function ye(e,t){return typeof e=="function"?e(t):e}function Ib(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-green-100 text-green-800",error:"bg-red-100 text-red-800",warning:"bg-yellow-100 text-yellow-800",info:"bg-blue-100 text-blue-800",neutral:"bg-gray-100 text-gray-800"}[e])}function Fb(e){return e?"success":"neutral"}function tl(e,t=false){return t?e>0?"text-green-600":e<0?"text-red-600":"text-text-body":"text-text-body"}function Nu(e="hover",t="default"){let r={default:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",brand:"text-action-brand hover:text-action-brand-hover visited:text-action-brand",muted:"text-text-muted hover:text-text-muted visited:text-text-muted",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 Fr(e,t,r,o="hover",n="default",a,i){if(!t)return e;let s=typeof t=="function"&&r?t(r):t,c=Nu(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 Bb({row:e,context:t,actions:r,align:o="right",size:n="sm"}){let{isLoading:a}=t;if(a)return jsxRuntime.jsx(J,{className:wo.sm});let s=(typeof r=="function"?r(e):r).filter(l=>!ye(l.hidden,e));if(s.length===0)return null;let c=ke(o);return jsxRuntime.jsx("div",{className:c,children:s.map(l=>{let d=ye(l.disabled,e);return l.variant==="icon"||!l.label?jsxRuntime.jsx(Q,{variant:"icon",size:n,onPress:()=>{l.onClick(e);},isDisabled:d,"aria-label":l.label||l.id,children:jsxRuntime.jsx(I,{name:l.icon||"DotsThree",size:n==="sm"?16:20})},l.id):jsxRuntime.jsxs(Q,{variant:l.variant||"secondary",size:n,onPress:()=>{l.onClick(e);},isDisabled:d,children:[l.icon&&jsxRuntime.jsx(I,{name:l.icon,size:n==="sm"?14:16}),l.label]},l.id)})})}function Vb({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,b=(P,R)=>{if(!g||P.length<=g)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:P});let L=P.slice(0,g-1)+"\u2026";return jsxRuntime.jsx(Et,{content:R,children:jsxRuntime.jsx("span",{children:L})})};if(f)return jsxRuntime.jsx(J,{className:Vt("normal")});if(e==null||e==="")return jsxRuntime.jsx("div",{className:ke(d,"text-text-muted"),children:u});if(Array.isArray(e)&&e.length===0)return jsxRuntime.jsx("div",{className:ke(d,"text-text-muted"),children:u});let x=ke(d,m);if(Array.isArray(e)){let P=e.slice(0,p),R=e.slice(p),L=R.length>0;return jsxRuntime.jsx("div",{className:x,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[P.map((D,A)=>{let V=typeof o=="function"?o(D,t):o,M=typeof n=="function"?n(D,t):n!==void 0?n:String(D),w=typeof s=="function"?s(D,t):s,N=typeof l=="function"?l(D,t):l;return jsxRuntime.jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxRuntime.jsx(Je,{variant:V,size:a,shape:i,dot:w,dotPosition:c,dotPulse:N,children:b(M,M)})},A)}),L&&jsxRuntime.jsx(Et,{content:R.join(", "),children:jsxRuntime.jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxRuntime.jsxs(Je,{variant:"neutral",size:a,shape:i,children:["+",R.length]})})})]})})}let v=typeof o=="function"?o(e,t):o,y=typeof n=="function"?n(e,t):n!==void 0?n:String(e),C=typeof s=="function"?s(e,t):s,T=typeof l=="function"?l(e,t):l;return jsxRuntime.jsx("div",{className:x,children:jsxRuntime.jsx(Je,{variant:v,size:a,shape:i,dot:C,dotPosition:c,dotPulse:T,children:b(y,y)})})}function Ob({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:Vt(l)});let m=!!e;if(!m&&!s)return jsxRuntime.jsx("div",{className:ke(c,d)});let p=ke(c,d);switch(r){case "icon":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx(I,{name:m?a:i,size:16,className:m?"text-green-600":"text-gray-400"})});case "text":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx("span",{className:ir(l),children:m?o:n})});case "badge":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx(Je,{variant:m?"success":"neutral",size:"sm",children:m?o:n})});default:return null}}function Wb({row:e,context:t,firstName:r,lastName:o,email:n,avatarUrl:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:d="default",showEmail:u=false,badge:m,emphasis:p="normal",align:g="left",className:f,piiEntity:b}){let{isLoading:x}=t,v=ye(r,e),y=ye(o,e),C=ye(n,e),T=ye(a,e),P=ye(c,e),R=typeof m=="function"?m(e):m,L=ye(b,e),D=ke(g,f);return jsxRuntime.jsx("div",{className:D,children:jsxRuntime.jsx(Ss,{firstName:v,lastName:y,email:C,avatarUrl:T,layout:i,size:s,href:P,LinkComponent:l,linkVariant:d,showEmail:u,badge:R,emphasis:p,isLoading:x,piiEntity:L})})}function Gb({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 Ub({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:Vt(s)});if(!e)return jsxRuntime.jsx("div",{className:ke(i,"text-text-muted"),children:a});let m=e instanceof Date?e:new Date(e);if(isNaN(m.getTime()))return jsxRuntime.jsx("div",{className:ke(i,"text-text-muted"),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=UN(m);break;case "custom":p=n?m.toLocaleString("en-US",n):m.toISOString();break;default:p=m.toLocaleDateString();}let g=ke(i,tailwindMerge.twMerge(ir(s),d)),f=ye(c,t);return f?jsxRuntime.jsx("div",{className:g,children:Fr(p,f,t,l)}):jsxRuntime.jsx("div",{className:g,children:p})}function UN(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 rl({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}){let[f,b]=Me.useState(false),x=o||(r?KN(r):"DeviceMobile"),y={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],C=n&&!f&&u,P={strong:"font-semibold text-text-body",high:"font-semibold text-text-body",normal:"text-text-body",low:"text-text-muted"}[m],R=({children:L,className:D})=>s?c?jsxRuntime.jsx(c,{href:s,className:D,children:L}):jsxRuntime.jsx(Ue,{href:s,variant:l,className:tailwindMerge.twMerge("hover:underline",D),asButton:false,children:L}):jsxRuntime.jsx("span",{className:D,children:L});if(p)return a==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",y.gap,g),children:[jsxRuntime.jsx(J,{width:y.skeletonIcon,height:y.skeletonIcon,className:"flex-shrink-0 rounded"}),jsxRuntime.jsx(J,{width:y.skeletonText,height:y.skeletonIcon*.6})]}):jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",y.gap,g),children:[jsxRuntime.jsx(J,{width:y.skeletonIcon,height:y.skeletonIcon,className:"flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(J,{width:y.skeletonText,height:16}),jsxRuntime.jsx(J,{width:y.skeletonSecondary,height:12})]})]});if(a==="inline"){let L=`${e} ${t}`;return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",y.gap,g),children:[jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",y.logoSize),children:C?jsxRuntime.jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>b(true)}):jsxRuntime.jsx(I,{name:x,size:y.iconSize*.6,className:"text-text-muted"})}),jsxRuntime.jsx(R,{className:tailwindMerge.twMerge("truncate leading-normal hover:text-text-body",P,y.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:L})]})}return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center justify-start",y.gap,g),children:[u&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",y.logoSize),children:C?jsxRuntime.jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>b(true)}):jsxRuntime.jsx(I,{name:x,size:y.iconSize*.6,className:"text-text-muted"})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxRuntime.jsx(R,{className:tailwindMerge.twMerge("truncate leading-normal hover:text-text-body",P,y.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:e}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center gap-1.5 text-text-muted leading-normal",y.secondaryTextSize),children:[d&&jsxRuntime.jsx(I,{name:x,size:y.iconInTextSize,className:"flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate",children:t})]})]})]})}function KN(e){switch(e){case "battery":return "BatteryHigh";case "charger":return "ChargingStation";case "inverter":return "Power";case "thermostat":return "ThermometerSimple";case "vehicle":return "CarSimple";case "meter":return "Gauge";default:return "DeviceMobile"}}function Kb({row:e,context:t,manufacturer:r,model:o,deviceType:n,logoUrl:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:d="default",showDeviceTypeIcon:u=true,showLogo:m=true,emphasis:p="normal",align:g="left",className:f}){let{isLoading:b}=t,x=ye(r,e),v=ye(o,e),y=ye(n,e),C=ye(a,e),T=ye(c,e),P=ke(g,f);return jsxRuntime.jsx("div",{className:P,children:jsxRuntime.jsx(rl,{manufacturer:x,model:v,deviceType:y,logoUrl:C,layout:i,size:s,href:T,LinkComponent:l,linkVariant:d,showDeviceTypeIcon:u,showLogo:m,emphasis:p,isLoading:b})})}var PW={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},JN=["charging","discharging","heat","cool","on","connected"],jN={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 Tu(e){return JN.includes(e)}function ku(e){return jN[e]}function sn({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??ku(e),m=Tu(e);return jsxRuntime.jsxs(Je,{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(I,{name:r,size:n==="sm"?12:n==="md"?14:16}),u]})}var ZN={importing:"Importing",exporting:"Exporting"};function jb(e){return ZN[e]}function nl({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??jb(e),d=e==="exporting"?"ArrowUp":"ArrowDown",u=n==="sm"?12:n==="md"?14:16;return r?jsxRuntime.jsx(Je,{variant:e,size:n,shape:a,className:`w-6 justify-center ${s||""}`,...c,children:jsxRuntime.jsx(I,{name:d,size:u})}):jsxRuntime.jsx(Je,{variant:e,size:n,shape:a,className:i?`w-28 justify-center ${s||""}`:s,...c,children:l})}function al({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?Fo(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-body":"text-text-caption",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(sn,{state:e,label:t,icon:l,size:s,shape:c,fixedWidth:d}),n&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:n==="importing"||n==="exporting"?jsxRuntime.jsx(nl,{state:n,size:s,shape:c,fixedWidth:d,showIcon:u}):jsxRuntime.jsx(sn,{state:n,size:s,shape:c,fixedWidth:d})})]})}function qb({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 C={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"}[s],T=o!=null||n!=null;return jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(J,{className:"h-4 w-12"}),jsxRuntime.jsx(J,{className:`h-6 w-24 ${C}`}),jsxRuntime.jsx(J,{className:`h-6 w-20 ${C}`})]}):jsxRuntime.jsx(J,{className:`h-6 w-24 ${C}`})})}if(!e)return jsxRuntime.jsx("div",{className:ke(u,p),children:jsxRuntime.jsx("span",{className:"text-text-muted",children:"\u2014"})});let f=ye(o,t),b=ye(a,t),x=typeof c=="function"?c(e,t):c,v=ke(u,p);return f!=null||n?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(v),children:jsxRuntime.jsx(al,{state:e,stateLabel:x,metric:f,metricFormatter:n,secondaryState:b||void 0,size:i,shape:s,icon:l,fixedWidth:d,secondaryStateIconOnly:m,layout:"horizontal"})}):jsxRuntime.jsx("div",{className:v,children:jsxRuntime.jsx(sn,{state:e,label:x,icon:l,size:i,shape:s,fixedWidth:d})})}function Xb({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-muted"}){let{isLoading:u}=r;if(u)return jsxRuntime.jsx(J,{className:Vt(a)});let m=Nr({value:e,formatter:o,emptyText:l,emptyClassName:d}),p=ir(a),g=ke(n,tailwindMerge.twMerge(p,c)),f=jsxRuntime.jsx("div",{className:g,children:m}),b=ye(i,t);return b?Fr(f,b,t,s):f}var Ru=Me__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=Me.useMemo(()=>r===t?100:Math.max(0,Math.min(100,(e-t)/(r-t)*100)),[e,t,r]),f=Me.useMemo(()=>o==="auto"&&a?a.type==="diverging"&&a.center!==void 0?ba(e,t,r,a.center,a.scheme):ga(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 v=`calc((100% - ${u*(d-1)}px) / ${d})`,y=Math.ceil(g/100*d),C={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:C,children:Array.from({length:d}).map((T,P)=>{let R=P<y;return jsxRuntime.jsx("div",{className:"rounded-sm",style:{width:v,backgroundColor:R?f:n==="none"?"transparent":n,marginRight:P<d-1?`${u}px`:0}},P)})}),i&&jsxRuntime.jsx("span",{className:"text-sm text-text-body whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})}let b={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:b,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-body whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})});Ru.displayName="HorizontalBarCell";var Du=Me__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=b=>"xValue"in b?b.xValue:b.x,l=b=>"yValue"in b?b.yValue:b.y,d=a||100,u=i,{xScale:m,yScale:p,barWidth:g}=Me.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 b=d3Array.extent(s,R=>c(R)),x=d3Array.min(s,R=>l(R))??0,v=d3Array.max(s,R=>l(R))??0,y=x<0?x:0,C=scale.scaleTime({range:[0,d],domain:b}),T=scale.scaleLinear({range:[u,0],domain:[y,v*1.05]}),P=s.length>1?d/s.length*.8:8;return {xScale:C,yScale:T,barWidth:Math.max(2,P)}},[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((b,x)=>jsxRuntime.jsx("div",{className:"flex-1 animate-pulse bg-border-default rounded"},x))});if(!s||s.length===0)return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-text-muted 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((b,x)=>{let v=l(b),y=m(c(b)),C=p(v),T=Math.abs(f-C),P=b.category&&o?.[b.category]?o[b.category]:r;return jsxRuntime.jsx(shape.Bar,{x:y-g/2,y:v>=0?C:f,width:g,height:T,fill:P,rx:1},`bar-${x}`)})})});Du.displayName="MiniBarCell";function tx({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:Vt(l)});if(e==null||isNaN(Number(e)))return jsxRuntime.jsx("div",{className:ke(c,"text-text-muted"),children:s});let b=Number(e),x;switch(o){case "currency":x=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:n,maximumFractionDigits:n}).format(b);break;case "percent":x=new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:n,maximumFractionDigits:n}).format(b/100);break;case "compact":x=new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:n>0?1:0,maximumFractionDigits:n}).format(b);break;default:x=new Intl.NumberFormat("en-US",{minimumFractionDigits:n,maximumFractionDigits:n}).format(b);}let y=`${m&&b>0?"+":""}${x}`,C=p?tl(b,true):ir(l),T=ke(c,tailwindMerge.twMerge(C,g)),P=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[a&&jsxRuntime.jsx("span",{className:"text-text-muted",children:a}),jsxRuntime.jsx("span",{children:y}),i&&jsxRuntime.jsx("span",{className:"text-text-muted",children:i})]}),R=ye(d,t);return R?jsxRuntime.jsx("div",{className:T,children:Fr(P,R,t,u)}):jsxRuntime.jsx("div",{className:T,children:P})}var Eu=Me__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=Me.useMemo(()=>Math.max(0,Math.min(100,e)),[e]),d=Me.useMemo(()=>r==="auto"&&s?s.type==="diverging"&&s.center!==void 0?ba(e,0,100,s.center,s.scheme):ga(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 b=f<p,x=d;if(r==="auto"&&s&&b){let v=(f+1)/a*100;s.type==="diverging"&&s.center!==void 0?x=ba(v,0,100,s.center,s.scheme):x=ga(v,0,100,s.scheme);}return jsxRuntime.jsx("div",{className:"rounded-sm",style:{width:m,backgroundColor:b?x:o==="none"?"transparent":o,marginRight:f<a-1?`${i}px`:0}},f)})}),t&&jsxRuntime.jsxs("span",{className:"text-sm text-text-body 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-body whitespace-nowrap",children:[l.toFixed(0),"%"]})]})});Eu.displayName="PercentBarCell";function ox({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:ke(a),children:jsxRuntime.jsx(J,{className:"h-4 w-4 rounded"})});let s=ye(n,e),c=ke(a);return jsxRuntime.jsx("div",{className:c,children:jsxRuntime.jsx(Zo,{isSelected:r,onChange:l=>{o?.(e,l);},isDisabled:s,"aria-label":"Select row"})})}function ll({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],b={strong:"font-semibold text-text-body",high:"font-semibold text-text-body",normal:"text-text-body",low:"text-text-muted"}[l],x=[];t&&x.push(t),r&&o?x.push(`${r} ${o}`):r?x.push(r):o&&x.push(o);let v=x.join(", "),y=({children:T,className:P})=>i?s?jsxRuntime.jsx(s,{href:i,className:P,children:T}):jsxRuntime.jsx(Ue,{href:i,variant:c,className:tailwindMerge.twMerge("hover:underline",P),asButton:false,children:T}):jsxRuntime.jsx("span",{className:P,children:T});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(I,{name:"MapPin",size:g.iconSize,className:"text-text-muted flex-shrink-0"}),jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-body",b,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 C=()=>{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(I,{name:"MapPin",size:g.iconSize,className:"text-text-muted"})}),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-body",b,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})}),v&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("text-text-caption leading-normal truncate",g.secondaryTextSize),"data-pii-type":C(),"data-pii-entity":m,children:v})]})]})}function ax({row:e,context:t,streetAddress:r,city:o,state:n,postalCode:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:d="default",emphasis:u="normal",align:m="left",className:p,piiEntity:g}){let{isLoading:f}=t,b=ye(r,e),x=ye(o,e),v=ye(n,e),y=ye(a,e),C=ye(c,e),T=ye(g,e),P=ke(m,p);return jsxRuntime.jsx("div",{className:P,children:jsxRuntime.jsx(ll,{streetAddress:b,city:x,state:v,postalCode:y,layout:i,size:s,href:C,LinkComponent:l,linkVariant:d,emphasis:u,isLoading:f,piiEntity:T})})}var Mu=Me__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}=Me.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),b=d3Array.min(l,y=>y.yValue)||0,x=d3Array.max(l,y=>y.yValue)||0,v=(x-b)*.1||1;return {xScale:scale.scaleTime({range:[0,d],domain:f}),yScale:scale.scaleLinear({range:[u,0],domain:[b-v,x+v]})}},[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-muted 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})]})});Mu.displayName="SparklineCell";function cx({value:e,row:t,context:r,prefix:o,suffix:n,emptyText:a="\u2014",href:i,linkBehavior:s="hover",linkVariant:c="default",emphasis:l="normal",truncate:d=true,copyable:u=false,align:m="left",className:p,piiType:g,piiEntity:f}){let{isLoading:b}=r;if(b)return jsxRuntime.jsx(J,{className:Vt(l)});let x=el(e,a),v=ye(i,t),y=ye(f,t),C=x,T=false,P=false;if(d&&x&&typeof x=="string")if(typeof d=="boolean")P=true;else {let{position:N="end",length:z=16,ellipsis:W="...",tooltip:F=true}=d;if(x.length>z){switch(N){case "start":C=Bi(x,z);break;case "middle":C=Rn(x,z);break;case "end":C=zi(x,z,W);break}T=F;}}let R=g&&y?{"data-pii-type":g,"data-pii-entity":y}:{},L=Object.keys(R).length>0,D=jsxRuntime.jsx("span",{className:P?"truncate":"",...R,children:C}),A=T?jsxRuntime.jsx(Et,{content:L?jsxRuntime.jsx("span",{...R,children:String(x)}):String(x),children:D}):D,V=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o&&jsxRuntime.jsx("span",{className:"text-text-muted",children:o}),A,n&&jsxRuntime.jsx("span",{className:"text-text-muted",children:n})]}),M=V;if(u&&x&&x!==a){let N=typeof u=="function"?u(t):String(x);M=jsxRuntime.jsx(fo,{value:N,size:"sm",children:V});}if(v){let N=ke(m,p);return jsxRuntime.jsx("div",{className:N,children:Fr(M,v,t,s,c,l)})}let w=ke(m,tailwindMerge.twMerge(ir(l),p));return jsxRuntime.jsx("div",{className:w,children:M})}var NT={sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"},TT={sm:"hidden sm:grid",md:"hidden md:grid",lg:"hidden lg:grid",xl:"hidden xl:grid"};function cl(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function dl(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 pl({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=cl(e,u);return jsxRuntime.jsx("div",{className:"font-medium text-text-body [&>*]:!justify-start [&>*]:!text-left",children:dl(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=cl(e,u);return jsxRuntime.jsx("div",{className:"inline-flex",children:dl(m,e,u,l)},u.id)})})]}),s.length>0&&jsxRuntime.jsx("div",{className:"space-y-1",children:s.map(u=>{let m=cl(e,u),p=u.showLabel&&u.label;return jsxRuntime.jsxs("div",{className:"flex items-center text-sm text-text-muted",children:[u.icon&&jsxRuntime.jsx(I,{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:dl(m,e,u,l)})]},u.id)})})]})}function ml({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=cl(e,c),u=l===0;return jsxRuntime.jsxs("div",{children:[!u&&jsxRuntime.jsx("div",{className:"text-xs text-text-muted",children:c.label}),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(u?"font-medium text-text-body":"text-sm text-text-body","[&>*]:!justify-start [&>*]:!text-left"),children:dl(d,e,c,i)})]},c.id)})})})}function dx(e="md"){return {mobile:NT[e],desktop:TT[e]}}function ux({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 VT={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},OT={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"};function HT(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 WT({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,b=f?t.direction:null,x=n&&a,v={...HT(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",VT[i],OT[e.align||"left"],o&&"sticky top-0 z-10",x&&"sticky left-0 z-20 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",o&&x&&"z-30",e.sortable&&!s&&"hover:bg-background-hover",s&&"cursor-not-allowed opacity-60",f?"font-bold text-text-body":"font-medium text-text-muted",g&&"bg-background-hover"),style:v,role:"columnheader","aria-sort":f?b==="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(I,{name:b==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-body"}):jsxRuntime.jsx(I,{name:"CaretUpDown",size:12,className:"text-text-muted opacity-40"})})]})})}function mx({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 b=t.indexOf(g.id),x=t.indexOf(f.id);if(d.get(f.id)?.reorderable===false)return;let y=0;for(let R=0;R<t.length&&d.get(t[R])?.reorderable===false;R++)y=R+1;if(x<y)return;let C=Math.min(b,x),T=Math.max(b,x);for(let R=C;R<=T;R++){if(R===b)continue;if(d.get(t[R])?.reorderable===false)return}let P=sortable.arrayMove(t,b,x);r(P);}},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(WT,{column:p,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,isFirstColumn:g===0,density:s,isLoading:c},p.id))})})})}var Fu={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},Bu={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"},jT={full:"w-full",auto:"w-auto inline-block",contained:"w-full max-w-6xl mx-auto"},qT={auto:"table-auto",fixed:"table-fixed",responsive:"table-auto"};function zu(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 ZT(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function XT({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",Fu[i],Bu[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-body":"font-medium text-text-muted"),onClick:()=>!s&&e.sortable&&r(e.id),role:"columnheader","aria-sort":c?l==="asc"?"ascending":"descending":"none","aria-disabled":s,style:zu(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(I,{name:l==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-body"}):jsxRuntime.jsx(I,{name:"CaretUpDown",size:12,className:"text-text-muted opacity-40"})})]})})}function $T({column:e,row:t,rowIndex:r,columnIndex:o,isHovered:n,density:a="default",className:i,stickyFirstColumn:s}){let c=s&&o===0,l=ZT(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,b="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,b=m.trigger||"hover"),u=jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{...b==="hover"?{trigger:"longPress"}:{},children:[jsxRuntime.jsx("div",{className:"cursor-help",children:u}),jsxRuntime.jsx(Ze,{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?"":Fu[a],Bu[e.align||"left"],c&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",i),role:"cell",style:zu(e),children:u})}function QT({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?"":Fu[o],Bu[e.align||"left"],a&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),role:"cell",style:zu(e),children:s})}function _T(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 fx({columns:e,row:t,rowIndex:r,density:o="default",onClick:n,stickyFirstColumn:a}){let[i,s]=Me.useState(false),c=Me.useCallback(l=>{if(!n)return;let d=l.target,u=l.currentTarget;_T(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($T,{column:l,row:t,rowIndex:r,columnIndex:d,isHovered:i,density:o,className:n?"group-hover:bg-background-hover":"",stickyFirstColumn:a},l.id))})}function gx({columns:e,rowIndex:t,density:r="default",stickyFirstColumn:o}){return jsxRuntime.jsx("div",{className:"contents",role:"row",children:e.map((n,a)=>jsxRuntime.jsx(QT,{column:n,rowIndex:t,columnIndex:a,density:r,stickyFirstColumn:o},n.id))})}function bx({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:b,estimatedRowHeight:x,loadingIndicator:v,stickyHeader:y=false,stickyFirstColumn:C=false,onRowClick:T,getRowId:P,hideHeader:R=false,sortConfig:L,onSort:D,"aria-label":A,enableColumnReorder:V=false,columnOrder:M,onColumnOrderChange:w}){let[N,z]=Me.useState(null),W=L!==void 0,F=W?L:N,K=Me.useRef(null),X=Me.useMemo(()=>e.map(te=>te.id),[e]),[G,U]=Me.useState(X),k=M!==void 0,S=k?M:G;Me.useEffect(()=>{k||U(te=>{let ce=e.map(ee=>ee.id),_=new Set(ce),Z=new Set(te),Y=te.filter(ee=>_.has(ee)),ae=ce.filter(ee=>!Z.has(ee));return [...Y,...ae]});},[e,k]);let B=Me.useCallback(te=>{k||U(te),w?.(te);},[k,w]),E=Me.useMemo(()=>{if(!V&&!M)return e;let te=new Map(e.map(ce=>[ce.id,ce]));return S.map(ce=>te.get(ce)).filter(ce=>ce!==void 0)},[e,S,V,M]),h=g?ao({items:t,onLoadMore:g,hasMore:f,isLoading:u,loadingState:m,enableVirtualization:b,estimatedItemSize:x||(o==="compact"?40:o==="relaxed"?60:48),overscan:5}):null,O=h?.scrollRef??K,{loadMoreRef:H,virtualizer:j,virtualItems:oe,isLoadingMore:me,computedLoadingState:q}=h||{},{gridTemplateColumns:ne,totalMinWidth:Te}=Me.useMemo(()=>{let te=0;return {gridTemplateColumns:E.map(_=>{if(_.minWidth?te+=typeof _.minWidth=="number"?_.minWidth:0:_.width&&typeof _.width=="number"&&(te+=_.width),_.width)return typeof _.width=="number"?`${_.width}px`:_.width;if(_.flex)return `${_.flex}fr`;if(_.minWidth&&_.maxWidth){let Z=typeof _.minWidth=="number"?`${_.minWidth}px`:_.minWidth,Y=typeof _.maxWidth=="number"?`${_.maxWidth}px`:_.maxWidth;return `minmax(${Z}, ${Y})`}return _.minWidth?`minmax(${typeof _.minWidth=="number"?`${_.minWidth}px`:_.minWidth}, 1fr)`:_.maxWidth?`minmax(0, ${typeof _.maxWidth=="number"?`${_.maxWidth}px`:_.maxWidth})`:"1fr"}).join(" "),totalMinWidth:te}},[E]),ie=Me.useCallback(te=>{if(!e.find(Z=>Z.id===te)?.sortable)return;let _;F?.columnId===te?_={columnId:te,direction:F.direction==="asc"?"desc":"asc"}:_={columnId:te,direction:"asc"},W||z(_),D?.(_);},[e,F,D,W]),ue=q==="loading"||u&&t.length===0,ge={};a?(ge.height=typeof a=="number"?`${a}px`:a,ge.overflowY="auto"):i?(ge.maxHeight=typeof i=="number"?`${i}px`:i,ge.overflowY="auto"):g&&(ge.height="600px",ge.overflowY="auto");let $=tailwindMerge.twMerge(jT[n],!g&&(s==="responsive"?"overflow-x-auto scrollbar-visible":"overflow-auto scrollbar-visible"),r),se=dx(d),Ne=c!=="none",ze=(te,ce)=>Ne?c==="custom"&&l?l(te,ce):jsxRuntime.jsx(c==="cards"?ml:pl,{row:te,columns:E,density:o,isLoading:u,onClick:T?()=>T(te):void 0}):null,De=j?oe?.map(te=>({virtualItem:te,row:t[te.index],index:te.index}))||[]:t.map((te,ce)=>({row:te,index:ce,virtualItem:null}));return jsxRuntime.jsxs("div",{ref:O,className:$,style:{...ge,position:j?"relative":void 0},children:[jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("grid border-separate border-spacing-0",qT[s],n==="auto"?"inline-grid w-auto":"w-full",Ne&&se.desktop),role:"table","aria-label":A,style:{gridTemplateColumns:ne,minWidth:Te>0?`${Te}px`:void 0},children:[!R&&(V?jsxRuntime.jsx(mx,{columns:e,columnOrder:S,onColumnOrderChange:B,sortConfig:F,onSort:ie,stickyHeader:y,stickyFirstColumn:C,density:o,isLoading:ue}):jsxRuntime.jsx("div",{className:"contents",role:"rowgroup",children:E.map((te,ce)=>jsxRuntime.jsx(XT,{column:te,sortConfig:F,onSort:ie,stickyHeader:y,stickyFirstColumn:C,isFirstColumn:ce===0,density:o,isLoading:ue},te.id))})),j?jsxRuntime.jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1",height:`${j.getTotalSize()}px`,position:"relative"},role:"rowgroup",children:ue?Array.from({length:p}).map((te,ce)=>jsxRuntime.jsx("div",{className:"contents",children:jsxRuntime.jsx(gx,{columns:E,rowIndex:ce,density:o,stickyFirstColumn:C})},`loading-${ce}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[De.map(({row:te,index:ce,virtualItem:_})=>{if(!te||!_)return null;let Z=P?P(te):`row-${ce}`;return jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",display:"grid",gridTemplateColumns:ne,transform:`translateY(${_.start}px)`},"data-index":_.index,ref:j.measureElement,children:jsxRuntime.jsx(fx,{columns:E,row:te,rowIndex:ce,density:o,onClick:T,stickyFirstColumn:C})},Z)}),me&&jsxRuntime.jsx("div",{style:{position:"absolute",top:`${j.getTotalSize()}px`,left:0,width:"100%"},children:v||jsxRuntime.jsx(Qt,{state:"loading-more"})})]}):jsxRuntime.jsx("div",{className:"py-12 text-center text-text-muted",children:"No data available"})}):jsxRuntime.jsx("div",{className:"contents",role:"rowgroup",children:ue?Array.from({length:p}).map((te,ce)=>jsxRuntime.jsx(gx,{columns:E,rowIndex:ce,density:o,stickyFirstColumn:C},`loading-${ce}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[De.map(({row:te,index:ce})=>{if(!te)return null;let _=P?P(te):`row-${ce}`;return jsxRuntime.jsx(fx,{columns:E,row:te,rowIndex:ce,density:o,onClick:T,stickyFirstColumn:C},_)}),me&&jsxRuntime.jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1"},children:v||jsxRuntime.jsx(Qt,{state:"loading-more"})})]}):jsxRuntime.jsx("div",{className:"col-span-full py-12 text-center text-text-muted",role:"row",children:jsxRuntime.jsx("div",{role:"cell",children:"No data available"})})})]}),Ne&&jsxRuntime.jsx("div",{className:se.mobile,children:ue?Array.from({length:p}).map((te,ce)=>jsxRuntime.jsx(ux,{density:o},`mobile-loading-${ce}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[De.map(({row:te,index:ce})=>{if(!te)return null;let _=P?P(te):`mobile-row-${ce}`;return jsxRuntime.jsx("div",{className:"border-b border-border-default last:border-b-0",children:ze(te,ce)},_)}),me&&(v||jsxRuntime.jsx(Qt,{state:"loading-more"}))]}):jsxRuntime.jsx("div",{className:"py-12 text-center text-text-muted",children:"No data available"})}),g&&f&&!ue&&(j?jsxRuntime.jsx("div",{ref:H,style:{position:"absolute",top:`${j.getTotalSize()}px`,left:0,width:"100%",height:1}}):jsxRuntime.jsx("div",{ref:H,className:"h-px w-full"}))]})}function hx({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(Je,{variant:s[e],size:n,shape:a,dot:l,dotPulse:l,...i,children:d})}var tk={battery:"BatteryHigh",charger:"ChargingStation",thermostat:"ThermometerSimple",inverter:"Power",vehicle:"Car",meter:"Gauge",gateway:"WifiHigh",other:"Cube",unknown:"Question"},rk={battery:"Battery",charger:"Charger",thermostat:"Thermostat",inverter:"Inverter",vehicle:"Vehicle",meter:"Meter",gateway:"Gateway",other:"Other",unknown:"Unknown"};function vx({deviceType:e,iconName:t,size:r="md",showLabel:o=false,className:n}){let a=t||(e?tk[e]:"Question"),i=e?rk[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(I,{name:a,size:r}),o&&i&&jsxRuntime.jsx("span",{className:"text-xs text-text-muted",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,footerContent:g,contentPadding:f=true,maxWidth:b="400px"}){if(!s)return null;let x=t||r,v=m||p||g;return jsxRuntime.jsx(dr,{children:jsxRuntime.jsx(Wt,{isOpen:s,onOpenChange:y=>!y&&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(vt,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,hasBackArrow:true,onBack:i,onClose:d}):jsxRuntime.jsx(vt,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,onClose:d})),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-1 overflow-y-auto overscroll-contain",f?"px-6 py-6":"p-0"),children:e}),v&&jsxRuntime.jsx(co,{primaryAction:m,secondaryAction:p,footerContent:g})]})})})})}ei.displayName="Drawer";var sk={sm:"gap-4 px-6 py-8",md:"gap-5 px-8 py-12",lg:"gap-6 px-10 py-16"},lk={sm:"xs",md:"sm",lg:"md"},ck={sm:"text-sm leading-5",md:"text-sm leading-5",lg:"text-base leading-6"},dk={sm:"h-10 w-10",md:"h-12 w-12",lg:"h-16 w-16"},uk={sm:20,md:24,lg:32},pk={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"},mk={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 wx({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:mk[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(Q,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,href:o.href,children:o.label}):jsxRuntime.jsx(Q,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,children:o.label})),n&&jsxRuntime.jsx(Ue,{href:n.href||"#",variant:"muted",onPress:n.onPress,className:"text-sm",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-body",sk[i],pk[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-muted",dk[i]),children:jsxRuntime.jsx(I,{name:e,size:uk[i]})}),jsxRuntime.jsx(Dt,{size:lk[i],tag:"h2",className:"text-text-muted leading-tight",children:t}),r&&jsxRuntime.jsx("p",{className:tailwindMerge.twMerge("max-w-xs text-text-muted whitespace-pre-line",ck[i]),children:r}),f()]})}function Nx({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(Je,{variant:i[e],size:o,shape:n,...a,children:s[e]});return t?jsxRuntime.jsx(Et,{content:t,children:c}):c}function kx({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]=Me.useState(false),[m,p]=Me.useState(false),[g,f]=Me.useState(null),[b,x]=Me.useState(e),v=Me.useRef(null),y=async P=>{if(f(null),n&&P.size>n){f(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(c&&P.type.startsWith("image/")){let R=new FileReader;R.onloadend=()=>{x(R.result);},R.readAsDataURL(P);}if(i){p(true);try{let R=await i(P);x(R),r?.(R);}catch(R){f("Failed to upload file"),console.error("Upload error:",R);}finally{p(false);}}t?.(P,b);},C=async P=>{try{let R=P.items;if(R.length>0){let L=R[0];if(L.kind==="file"){let D=await L.getFile();D&&y(D);}}}catch(R){f("Failed to upload file"),console.error("Upload error:",R);}finally{u(false);}},T=()=>{x(void 0),f(null),t?.(null),r?.(""),v.current&&(v.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:C,onDropEnter:()=>u(true),onDropExit:()=>u(false),children:[b?jsxRuntime.jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[c&&(b.startsWith("data:image")||b.startsWith("http"))?jsxRuntime.jsx("img",{src:b,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-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:"File uploaded"})]}),!a&&jsxRuntime.jsx(Q,{variant:"icon",size:"sm",onPress:T,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-muted"}),jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-sm text-text-body",children:l}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-text-muted",children:o==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${o}`})]}),jsxRuntime.jsx(reactAriaComponents.FileTrigger,{acceptedFileTypes:o.split(","),onSelect:P=>{let R=Array.from(P||[]);R.length>0&&y(R[0]);},children:jsxRuntime.jsx(Q,{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-muted",children:"Uploading..."})]})})]}),g&&jsxRuntime.jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function Rx({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(Je,{variant:s,size:n,shape:a,...i,children:c})}function _n(e){return jsxRuntime.jsx(reactAriaComponents.Form,{validationBehavior:"aria",...e,className:tailwindMerge.twMerge("flex flex-col gap-6",e.className)})}function Ex({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]=Me.useState(false),m=Tt("(max-width: 767px)"),p=o!==void 0?o:d,g=Me.useCallback(v=>{n?n(v):u(v);},[n]);Me.useEffect(()=>{let v=y=>{(y.metaKey||y.ctrlKey)&&y.key==="k"&&(y.preventDefault(),g(!p)),y.key==="Escape"&&p&&g(false);};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[p,g]);let f=Me.useCallback(v=>{r?.(v);},[r]),b=jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-muted hover:text-text-body hover:bg-background-hover rounded-md transition-colors","aria-label":"Open search",children:[jsxRuntime.jsx(I,{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"})]})]}),x=a===null||Me.isValidElement(a)&&a.type===Me.Fragment&&!a.props.children;return m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!x&&(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:b})),jsxRuntime.jsx(Xe,{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(ar,{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})]})})]}):x?null:jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:p,onOpenChange:g,children:[a||b,jsxRuntime.jsx(Ze,{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(ar,{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 Lx({placeholder:e="Search...",value:t,onChange:r,isOpen:o,onOpenChange:n,children:a,maxHeight:i="400px",variant:s="default",className:c}){let[l,d]=Me.useState(false),u=Tt("(max-width: 767px)"),m=Me.useRef(null),p=Me.useRef(null),g=o!==void 0?o:l,f=Me.useCallback(A=>{n?n(A):d(A);},[n]);Me.useEffect(()=>{let A=V=>{(V.metaKey||V.ctrlKey)&&V.key==="k"&&(V.preventDefault(),f(!g)),V.key==="Escape"&&g&&f(false);};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[g,f]),Me.useEffect(()=>{g&&!u&&m.current&&setTimeout(()=>{m.current?.querySelector("input")?.focus();},0);},[g,u]),Me.useEffect(()=>{if(!g||u)return;let A=V=>{let M=V.target,w=m.current?.contains(M),N=p.current?.contains(M);!w&&!N&&f(false);};return document.addEventListener("mousedown",A,true),()=>document.removeEventListener("mousedown",A,true)},[g,u,f]);let b=A=>{r?.(A);},x=Me.useCallback(()=>{f(false);},[f]),v=Me.useCallback(()=>{r?.("");},[r]),[y,C]=Me.useState(null);Me.useEffect(()=>{if(g&&!u&&m.current){let A=null,V=()=>{let w=m.current?.getBoundingClientRect();w&&C({top:w.bottom+8,left:w.left,width:w.width});},M=()=>{A===null&&(A=requestAnimationFrame(()=>{V(),A=null;}));};return V(),window.addEventListener("resize",M),window.addEventListener("scroll",M,true),()=>{window.removeEventListener("resize",M),window.removeEventListener("scroll",M,true),A!==null&&cancelAnimationFrame(A);}}},[g,u]);let T=Me.useCallback(()=>{f(true);},[f]);if(u)return jsxRuntime.jsxs("div",{className:c,children:[jsxRuntime.jsx("button",{type:"button",onClick:T,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(I,{name:"MagnifyingGlass",size:"md"})}),jsxRuntime.jsxs(Xe,{isOpen:g,onClose:x,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(ar,{value:t,onChange:b,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:v,reserveErrorSpace:false,autoFocus:true})}),jsxRuntime.jsx(Q,{variant:"icon",onPress:x,"aria-label":"Close search",className:"flex-shrink-0",children:jsxRuntime.jsx(I,{name:"X",size:"md"})})]}),jsxRuntime.jsx("div",{className:"mt-4",children:a})]})]},"mobile");let P=A=>{let M=A.target.tagName==="INPUT";if(A.key==="ArrowDown"&&g&&M){A.preventDefault();let w=p.current?.querySelector("[data-search-result]");w&&w.focus();}},R=A=>{let V=A.target;if(!V.hasAttribute("data-search-result"))return;let w=Array.from(p.current?.querySelectorAll("[data-search-result]")||[]),N=w.indexOf(V);if(A.key==="ArrowDown"){A.preventDefault(),A.stopPropagation();let z=Math.min(N+1,w.length-1);w[z]?.focus();}else if(A.key==="ArrowUp")if(A.preventDefault(),A.stopPropagation(),N===0)m.current?.querySelector("input")?.focus();else {let z=Math.max(N-1,0);w[z]?.focus();}else A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),f(false),m.current?.querySelector("input")?.focus());},L=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:R,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,D=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:P,children:[jsxRuntime.jsx(ar,{value:t,onChange:b,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:D,onFocus:()=>f(true)}),L]},"desktop")}function Ix({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-muted mb-3",children:jsxRuntime.jsx(I,{name:r,size:48})}),jsxRuntime.jsx("p",{className:"text-base font-medium text-text-body mb-1",children:e}),t&&jsxRuntime.jsx("p",{className:"text-sm text-text-muted max-w-xs",children:t})]})}function Bx({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 Vx({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-heading",children:e}),!r&&t!==void 0&&jsxRuntime.jsx("span",{className:"text-xs text-text-muted",children:t}),r&&jsxRuntime.jsx("span",{className:"text-xs text-text-muted 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 Ox({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 b=document.querySelector('input[type="text"][placeholder*="Search"]');b&&b.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-body hover:bg-background-hover","focus-visible:bg-brand-light 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-muted",children:jsxRuntime.jsx(I,{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-heading truncate",children:t}),o&&jsxRuntime.jsx("span",{className:"text-xs text-text-muted flex-shrink-0",children:o})]}),r&&jsxRuntime.jsx("div",{className:"text-sm text-text-muted 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(I,{name:"ArrowRight",size:16,className:"text-text-muted"})})]})}function Hx({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 Gx({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:`
95
+ `}})]})}var Xi={prefix:String(Math.round(Math.random()*1e10)),current:0},df=Me__namespace.default.createContext(Xi),BC=Me__namespace.default.createContext(false);var zC=!!(typeof window<"u"&&window.document&&window.document.createElement),sd=new WeakMap;function VC(e=false){let t=Me.useContext(df),r=Me.useRef(null);if(r.current===null&&!e){var o,n;let a=(n=Me__namespace.default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||n===void 0||(o=n.ReactCurrentOwner)===null||o===void 0?void 0:o.current;if(a){let i=sd.get(a);i==null?sd.set(a,{id:t.current,state:a.memoizedState}):a.memoizedState!==i.state&&(t.current=i.id,sd.delete(a));}r.current=++t.current;}return r.current}function OC(e){let t=Me.useContext(df);t===Xi&&!zC&&process.env.NODE_ENV!=="production"&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let r=VC(!!e),o=t===Xi&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${t.prefix}`;return e||`${o}-${r}`}function HC(e){let t=Me__namespace.default.useId(),[r]=Me.useState($i()),o=r||process.env.NODE_ENV==="test"?"react-aria":`react-aria${Xi.prefix}`;return e||`${o}-${t}`}typeof Me__namespace.default.useId=="function"?HC:OC;function GC(){return false}function UC(){return true}function YC(e){return ()=>{}}function $i(){return typeof Me__namespace.default.useSyncExternalStore=="function"?Me__namespace.default.useSyncExternalStore(YC,GC,UC):Me.useContext(BC)}function uf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Qi(e,t,r){uf(e,t),t.set(e,r);}var KC=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),JC=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function cd(e){if(Intl.Locale){let r=new Intl.Locale(e).maximize(),o=typeof r.getTextInfo=="function"?r.getTextInfo():r.textInfo;if(o)return o.direction==="rtl";if(r.script)return KC.has(r.script)}let t=e.split("-")[0];return JC.has(t)}var mf=Symbol.for("react-aria.i18n.locale");function ff(){let e=typeof window<"u"&&window[mf]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:cd(e)?"rtl":"ltr"}}var dd=ff(),wa=new Set;function pf(){dd=ff();for(let e of wa)e(dd);}function gf(){let e=$i(),[t,r]=Me.useState(dd);return Me.useEffect(()=>(wa.size===0&&window.addEventListener("languagechange",pf),wa.add(r),()=>{wa.delete(r),wa.size===0&&window.removeEventListener("languagechange",pf);}),[]),e?{locale:typeof window<"u"&&window[mf]||"en-US",direction:"ltr"}:t}var $C=Me__namespace.default.createContext(null);function ud(){let e=gf();return Me.useContext($C)||e}function _i(e,t){return e-t*Math.floor(e/t)}var bf=1721426;function es(e,t,r,o){t=rs(e,t);let n=t-1,a=-2;return r<=2?a=0:ts(t)&&(a=-1),bf-1+365*n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400)+Math.floor((367*r-362)/12+a+o)}function ts(e){return e%4===0&&(e%100!==0||e%400===0)}function rs(e,t){return e==="BC"?1-t:t}function QC(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}var _C={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]},tr=class{fromJulianDay(t){let r=t,o=r-bf,n=Math.floor(o/146097),a=_i(o,146097),i=Math.floor(a/36524),s=_i(a,36524),c=Math.floor(s/1461),l=_i(s,1461),d=Math.floor(l/365),u=n*400+i*100+c*4+d+(i!==4&&d!==4?1:0),[m,p]=QC(u),g=r-es(m,p,1,1),f=2;r<es(m,p,3,1)?f=0:ts(p)&&(f=1);let b=Math.floor(((g+f)*12+373)/367),x=r-es(m,p,b,1)+1;return new Go(m,p,b,x)}toJulianDay(t){return es(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return _C[ts(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return ts(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return ["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year);}constructor(){this.identifier="gregory";}};function md(e,t){var r,o,n,a;return (a=(n=(r=e.isEqual)===null||r===void 0?void 0:r.call(e,t))!==null&&n!==void 0?n:(o=t.isEqual)===null||o===void 0?void 0:o.call(t,e))!==null&&a!==void 0?a:e.identifier===t.identifier}function fd(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function hf(e,t){return xf(e)-xf(t)}function xf(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}var pd=null;function Uo(){return pd==null&&(pd=new Intl.DateTimeFormat().resolvedOptions().timeZone),pd}function po(e){e=Ut(e,new tr);let t=rs(e.era,e.year);return Cf(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Cf(e,t,r,o,n,a,i){let s=new Date;return s.setUTCHours(o,n,a,i),s.setUTCFullYear(e,t-1,r),s.getTime()}function bd(e,t){if(t==="UTC")return 0;if(e>0&&t===Uo()&&true)return new Date(e).getTimezoneOffset()*-6e4;let{year:r,month:o,day:n,hour:a,minute:i,second:s}=Sf(e,t);return Cf(r,o,n,a,i,s,0)-Math.floor(e/1e3)*1e3}var yf=new Map;function Sf(e,t){let r=yf.get(t);r||(r=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:false,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),yf.set(t,r));let o=r.formatToParts(new Date(e)),n={};for(let a of o)a.type!=="literal"&&(n[a.type]=a.value);return {year:n.era==="BC"||n.era==="B"?-n.year+1:+n.year,month:+n.month,day:+n.day,hour:n.hour==="24"?0:+n.hour,minute:+n.minute,second:+n.second}}var vf=864e5;function tS(e,t,r,o){return (r===o?[r]:[r,o]).filter(a=>rS(e,t,a))}function rS(e,t,r){let o=Sf(r,t);return e.year===o.year&&e.month===o.month&&e.day===o.day&&e.hour===o.hour&&e.minute===o.minute&&e.second===o.second}function ur(e,t,r="compatible"){let o=Pr(e);if(t==="UTC")return po(o);if(t===Uo()&&r==="compatible"&&true){o=Ut(o,new tr);let c=new Date,l=rs(o.era,o.year);return c.setFullYear(l,o.month-1,o.day),c.setHours(o.hour,o.minute,o.second,o.millisecond),c.getTime()}let n=po(o),a=bd(n-vf,t),i=bd(n+vf,t),s=tS(o,t,n-a,n-i);if(s.length===1)return s[0];if(s.length>1)switch(r){case "compatible":case "earlier":return s[0];case "later":return s[s.length-1];case "reject":throw new RangeError("Multiple possible absolute times found")}switch(r){case "earlier":return Math.min(n-a,n-i);case "compatible":case "later":return Math.max(n-a,n-i);case "reject":throw new RangeError("No such absolute time found")}}function xd(e,t,r="compatible"){return new Date(ur(e,t,r))}function rr(e,t){let r=bd(e,t),o=new Date(e+r),n=o.getUTCFullYear(),a=o.getUTCMonth()+1,i=o.getUTCDate(),s=o.getUTCHours(),c=o.getUTCMinutes(),l=o.getUTCSeconds(),d=o.getUTCMilliseconds();return new Fn(n<1?"BC":"AD",n<1?-n+1:n,a,i,t,r,s,c,l,d)}function os(e,t){return rr(e.getTime(),t)}function Pr(e,t){let r=0,o=0,n=0,a=0;if("timeZone"in e)({hour:r,minute:o,second:n,millisecond:a}=e);else if("hour"in e&&true)return e;return new Na(e.calendar,e.era,e.year,e.month,e.day,r,o,n,a)}function Ut(e,t){if(md(e.calendar,t))return e;let r=t.fromJulianDay(e.calendar.toJulianDay(e)),o=e.copy();return o.calendar=t,o.era=r.era,o.year=r.year,o.month=r.month,o.day=r.day,Ur(o),o}function hd(e,t,r){if(e instanceof Fn)return e.timeZone===t?e:yd(e,t);let o=ur(e,t,r);return rr(o,t)}function wf(e){let t=po(e)-e.offset;return new Date(t)}function yd(e,t){let r=po(e)-e.offset;return Ut(rr(r,t),e.calendar)}var Ta=36e5;function Pa(e,t){let r=e.copy(),o="hour"in r?iS(r,t):0;vd(r,t.years||0),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e),r.month+=t.months||0,Cd(r),Nf(r),r.day+=(t.weeks||0)*7,r.day+=t.days||0,r.day+=o,nS(r),r.calendar.balanceDate&&r.calendar.balanceDate(r),r.year<1&&(r.year=1,r.month=1,r.day=1);let n=r.calendar.getYearsInEra(r);if(r.year>n){var a,i;let c=(a=(i=r.calendar).isInverseEra)===null||a===void 0?void 0:a.call(i,r);r.year=n,r.month=c?1:r.calendar.getMonthsInYear(r),r.day=c?1:r.calendar.getDaysInMonth(r);}r.month<1&&(r.month=1,r.day=1);let s=r.calendar.getMonthsInYear(r);return r.month>s&&(r.month=s,r.day=r.calendar.getDaysInMonth(r)),r.day=Math.max(1,Math.min(r.calendar.getDaysInMonth(r),r.day)),r}function vd(e,t){var r,o;!((r=(o=e.calendar).isInverseEra)===null||r===void 0)&&r.call(o,e)&&(t=-t),e.year+=t;}function Cd(e){for(;e.month<1;)vd(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,vd(e,1);}function nS(e){for(;e.day<1;)e.month--,Cd(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Cd(e);}function Nf(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day));}function Ur(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Nf(e);}function Tf(e){let t={};for(let r in e)typeof e[r]=="number"&&(t[r]=-e[r]);return t}function Sd(e,t){return Pa(e,Tf(t))}function as(e,t){let r=e.copy();return t.era!=null&&(r.era=t.era),t.year!=null&&(r.year=t.year),t.month!=null&&(r.month=t.month),t.day!=null&&(r.day=t.day),Ur(r),r}function ka(e,t){let r=e.copy();return t.hour!=null&&(r.hour=t.hour),t.minute!=null&&(r.minute=t.minute),t.second!=null&&(r.second=t.second),t.millisecond!=null&&(r.millisecond=t.millisecond),kf(r),r}function aS(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=ns(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=ns(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=ns(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=ns(e.hour,24),t}function kf(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23));}function ns(e,t){let r=e%t;return r<0&&(r+=t),r}function iS(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,aS(e)}function is(e,t,r,o){let n=e.copy();switch(t){case "era":{let s=e.calendar.getEras(),c=s.indexOf(e.era);if(c<0)throw new Error("Invalid era: "+e.era);c=Yr(c,r,0,s.length-1,o?.round),n.era=s[c],Ur(n);break}case "year":var a,i;!((a=(i=n.calendar).isInverseEra)===null||a===void 0)&&a.call(i,n)&&(r=-r),n.year=Yr(e.year,r,-1/0,9999,o?.round),n.year===-1/0&&(n.year=1),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e);break;case "month":n.month=Yr(e.month,r,1,e.calendar.getMonthsInYear(e),o?.round);break;case "day":n.day=Yr(e.day,r,1,e.calendar.getDaysInMonth(e),o?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(n),Ur(n),n}function wd(e,t,r,o){let n=e.copy();switch(t){case "hour":{let a=e.hour,i=0,s=23;if(o?.hourCycle===12){let c=a>=12;i=c?12:0,s=c?23:11;}n.hour=Yr(a,r,i,s,o?.round);break}case "minute":n.minute=Yr(e.minute,r,0,59,o?.round);break;case "second":n.second=Yr(e.second,r,0,59,o?.round);break;case "millisecond":n.millisecond=Yr(e.millisecond,r,0,999,o?.round);break;default:throw new Error("Unsupported field "+t)}return n}function Yr(e,t,r,o,n=false){if(n){e+=Math.sign(t),e<r&&(e=o);let a=Math.abs(t);t>0?e=Math.ceil(e/a)*a:e=Math.floor(e/a)*a,e>o&&(e=r);}else e+=t,e<r?e=o-(r-e-1):e>o&&(e=r+(e-o-1));return e}function Nd(e,t){let r;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let n=Pa(Pr(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});r=ur(n,e.timeZone);}else r=po(e)-e.offset;r+=t.milliseconds||0,r+=(t.seconds||0)*1e3,r+=(t.minutes||0)*6e4,r+=(t.hours||0)*36e5;let o=rr(r,e.timeZone);return Ut(o,e.calendar)}function Pf(e,t){return Nd(e,Tf(t))}function Rf(e,t,r,o){switch(t){case "hour":{let n=0,a=23;if(o?.hourCycle===12){let g=e.hour>=12;n=g?12:0,a=g?23:11;}let i=Pr(e),s=Ut(ka(i,{hour:n}),new tr),c=[ur(s,e.timeZone,"earlier"),ur(s,e.timeZone,"later")].filter(g=>rr(g,e.timeZone).day===s.day)[0],l=Ut(ka(i,{hour:a}),new tr),d=[ur(l,e.timeZone,"earlier"),ur(l,e.timeZone,"later")].filter(g=>rr(g,e.timeZone).day===l.day).pop(),u=po(e)-e.offset,m=Math.floor(u/Ta),p=u%Ta;return u=Yr(m,r,Math.floor(c/Ta),Math.floor(d/Ta),o?.round)*Ta+p,Ut(rr(u,e.timeZone),e.calendar)}case "minute":case "second":case "millisecond":return wd(e,t,r,o);case "era":case "year":case "month":case "day":{let n=is(Pr(e),t,r,o),a=ur(n,e.timeZone);return Ut(rr(a,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Df(e,t,r){let o=Pr(e),n=ka(as(o,t),t);if(n.compare(o)===0)return e;let a=ur(n,e.timeZone,r);return Ut(rr(a,e.timeZone),e.calendar)}var sS=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/;var lS=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Ra(e){let t=e.match(sS);if(!t)throw lS.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let r=new Go(Td(t[1],0,9999),Td(t[2],1,12),1);return r.day=Td(t[3],1,r.calendar.getDaysInMonth(r)),r}function Td(e,t,r){let o=Number(e);if(o<t||o>r)throw new RangeError(`Value out of range: ${t} <= ${o} <= ${r}`);return o}function Ef(e){return `${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function kd(e){let t=Ut(e,new tr),r;return t.era==="BC"?r=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):r=String(t.year).padStart(4,"0"),`${r}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Pd(e){return `${kd(e)}T${Ef(e)}`}function dS(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let r=Math.floor(e/36e5),o=Math.floor(e%36e5/6e4),n=Math.floor(e%36e5%6e4/1e3),a=`${t}${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`;return n!==0&&(a+=`:${String(n).padStart(2,"0")}`),a}function Mf(e){return `${Pd(e)}${dS(e.offset)}[${e.timeZone}]`}function Rd(e){let t=typeof e[0]=="object"?e.shift():new tr,r;if(typeof e[0]=="string")r=e.shift();else {let i=t.getEras();r=i[i.length-1];}let o=e.shift(),n=e.shift(),a=e.shift();return [t,r,o,n,a]}var uS=new WeakMap,Go=class e{copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day):new e(this.calendar,this.year,this.month,this.day)}add(t){return Pa(this,t)}subtract(t){return Sd(this,t)}set(t){return as(this,t)}cycle(t,r,o){return is(this,t,r,o)}toDate(t){return xd(this,t)}toString(){return kd(this)}compare(t){return fd(this,t)}constructor(...t){Qi(this,uS,{writable:true,value:void 0});let[r,o,n,a,i]=Rd(t);this.calendar=r,this.era=o,this.year=n,this.month=a,this.day=i,Ur(this);}};var pS=new WeakMap,Na=class e{copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return Pa(this,t)}subtract(t){return Sd(this,t)}set(t){return as(ka(this,t),t)}cycle(t,r,o){switch(t){case "era":case "year":case "month":case "day":return is(this,t,r,o);default:return wd(this,t,r,o)}}toDate(t,r){return xd(this,t,r)}toString(){return Pd(this)}compare(t){let r=fd(this,t);return r===0?hf(this,Pr(t)):r}constructor(...t){Qi(this,pS,{writable:true,value:void 0});let[r,o,n,a,i]=Rd(t);this.calendar=r,this.era=o,this.year=n,this.month=a,this.day=i,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Ur(this);}},mS=new WeakMap,Fn=class e{copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return Nd(this,t)}subtract(t){return Pf(this,t)}set(t,r){return Df(this,t,r)}cycle(t,r,o){return Rf(this,t,r,o)}toDate(){return wf(this)}toString(){return Mf(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-hd(t,this.timeZone).toDate().getTime()}constructor(...t){Qi(this,mS,{writable:true,value:void 0});let[r,o,n,a,i]=Rd(t),s=t.shift(),c=t.shift();this.calendar=r,this.era=o,this.year=n,this.month=a,this.day=i,this.timeZone=s,this.offset=c,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Ur(this);}};var Dd=new Map;function Ed(e){let{locale:t}=ud(),r=t+(e?Object.entries(e).sort((n,a)=>n[0]<a[0]?-1:1).join():"");if(Dd.has(r))return Dd.get(r);let o=new Intl.Collator(t,e);return Dd.set(r,o),o}function ss(e){let t=Ed({usage:"search",...e}),r=Me.useCallback((a,i)=>i.length===0?true:(a=a.normalize("NFC"),i=i.normalize("NFC"),t.compare(a.slice(0,i.length),i)===0),[t]),o=Me.useCallback((a,i)=>i.length===0?true:(a=a.normalize("NFC"),i=i.normalize("NFC"),t.compare(a.slice(-i.length),i)===0),[t]),n=Me.useCallback((a,i)=>{if(i.length===0)return true;a=a.normalize("NFC"),i=i.normalize("NFC");let s=0,c=i.length;for(;s+c<=a.length;s++){let l=a.slice(s,s+c);if(t.compare(i,l)===0)return true}return false},[t]);return Me.useMemo(()=>({startsWith:r,endsWith:o,contains:n}),[r,o,n])}var yS=({isEntering:e,isExiting:t,className:r})=>["max-w-[200px] group bg-slate-700 dark:bg-slate-600 border border-slate-800 dark:border-white/10 shadow-[inset_0_1px_0_0_theme(colors.gray.600)] dark:shadow-none text-white 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 Et({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)=>yS({...n,className:o})),children:[jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-slate-700 stroke-gray-800 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 dark:fill-slate-600 dark:stroke-white/10 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsxRuntime.jsx("path",{d:"M0 0 L4 4 L8 0"})})}),t]})]})}function nr(){let[e,t]=Me__namespace.default.useState(false),r=Me__namespace.default.useCallback((n,a)=>{t(true),a?.(n);},[]),o=Me__namespace.default.useCallback((n,a)=>{t(false),a?.(n);},[]);return {isFocused:e,handleFocus:r,handleBlur:o}}var ot=Me__namespace.default.forwardRef(({children:e,className:t},r)=>jsxRuntime.jsx("div",{ref:r,className:tailwindMerge.twMerge("relative w-full",t),children:e}));ot.displayName="InputWrapper";function Da({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-muted hover:text-text-body cursor-pointer",r),"aria-label":"Clear input",onMouseDown:o=>{o.preventDefault(),o.stopPropagation();},children:jsxRuntime.jsx(I,{name:"X",size:t==="sm"?16:20})})}function mo(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 Lf(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function vS(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 xt(e){let{isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:a="md",className:i}=e;return tailwindMerge.twMerge("w-full",mo({isInvalid:t,isDisabled:r,isFocused:o}),Lf({transparent:n,isDisabled:r}),Ae[a].text,Ae[a].height,Ae[a].padding,vS(a),i)}function CS(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",Lf({transparent:a,isDisabled:n}),Ae[t].height,mo({isFocused:r,isInvalid:o,isDisabled:n}),i)}function Ee({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(Ae[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-muted",children:jsxRuntime.jsx(I,{name:"Info",size:t==="sm"?16:20})}),d&&jsxRuntime.jsx("span",{className:"text-text-caption font-normal ml-1",children:o})]});return c&&l?jsxRuntime.jsx(Et,{content:l,children:u}):u}function Se({size:e="md",className:t,children:r,...o}){return jsxRuntime.jsx("div",{...o,className:tailwindMerge.twMerge("leading-[2.25] text-text-caption",Ae[e].text,t),children:r})}function pe({children:e,size:t="md",className:r}){return jsxRuntime.jsx("div",{role:"alert",className:tailwindMerge.twMerge(Ae[t].text,"text-feedback-error-text",r),children:e})}function cs({size:e="md",isInvalid:t,isDisabled:r,isFocused:o,transparent:n,className:a,...i}){return jsxRuntime.jsx("input",{className:xt({isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:e,className:a}),...i})}function If(e){let{children:t,...r}=e;return jsxRuntime.jsx("div",{...r,className:CS(e),children:typeof t=="function"?t(e):t})}function NS({children:e,...t}){return jsxRuntime.jsx(reactAriaComponents.ListBox,{...t,className:Ce(t.className,"outline-0"),children:e})}var zd=Me.createContext("md");function Of(){return Me.useContext(zd)}function Id(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-placeholder overflow-hidden text-ellipsis whitespace-nowrap ${Ae[e].text} ${t}`}function ES(){let e=Me__namespace.default.useCallback((r,o)=>{o?.(r);},[]),t=Me__namespace.default.useCallback((r,o)=>{o?.(r);},[]);return {handleFocus:e,handleBlur:t}}function Ko({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:b=false,placement:x="bottom start",shouldFlip:v=true,menuWidth:y="match",descriptionPlacement:C="below",useMobileTray:T=true,...P}){let[R,L]=Me.useState(null),[D,A]=Me.useState(null),[V,M]=Me.useState(false),w=c??R??l,{handleFocus:N,handleBlur:z}=ES(),{isMobile:W}=kt(),F=T&&W,K=Me__namespace.default.useMemo(()=>!i||!w||!n?null:Array.from(n).find(B=>B.id===w)??null,[i,w,n]),X=S=>{d&&S!==null&&d(S),d||L(S);},G=Me.useRef(null),U=Me.useRef(null),k=()=>{F&&M(!V);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.Select,{...P,selectedKey:w,defaultSelectedKey:l,onSelectionChange:X,placeholder:u,className:Ce(P.className,"group flex w-full flex-col"),ref:G,onOpenChange:S=>{F||(S&&U.current?A(U.current.offsetWidth):S||G.current?.blur());},children:({isDisabled:S,isInvalid:B,isOpen:E})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(Ee,{size:s,tooltip:p,description:C==="tooltip"||C==="inline"?t:void 0,descriptionPlacement:C,isRequired:g,children:e}),jsxRuntime.jsx(ot,{children:jsxRuntime.jsx("div",{ref:U,children:jsxRuntime.jsxs(Q,{variant:"unstyled",className:tailwindMerge.twMerge(xt({isInvalid:B||m&&!!r,isDisabled:S,isFocused:F?V:E,transparent:f,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:h=>N(h,P.onFocus),onBlur:h=>z(h,P.onBlur),onPress:F?k:void 0,"data-open":F?V:E,children:[i&&K?jsxRuntime.jsx("div",{className:Id(s),children:i(K)}):F&&w?jsxRuntime.jsx("div",{className:Id(s),children:n?Array.from(n).find(H=>H.id===w)?.label:String(w)}):jsxRuntime.jsx(reactAriaComponents.SelectValue,{className:Id(s)}),jsxRuntime.jsx(I,{name:"CaretDown","aria-hidden":true,className:tailwindMerge.twMerge("h-4 w-4 text-text-body group-disabled:text-gray-200 forced-colors:text-[ButtonText] transition-transform",(F?V:E)&&"rotate-180")})]})})}),b?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:m?jsxRuntime.jsx(pe,{size:s,className:"text-feedback-error-text",children:typeof r=="function"&&P.validationResult?r(P.validationResult):typeof r=="string"?r:null}):t&&C==="below"?jsxRuntime.jsx(Se,{size:s,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:m?jsxRuntime.jsx(pe,{size:s,className:"mt-1 text-feedback-error-text",children:typeof r=="function"&&P.validationResult?r(P.validationResult):typeof r=="string"?r:null}):t&&C==="below"?jsxRuntime.jsx(Se,{size:s,className:"mt-1",children:t}):null}),F?null:jsxRuntime.jsx(Ze,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:y==="match"&&D?`${D}px`:void 0,minWidth:y==="auto"&&D?`${D}px`:void 0,maxWidth:y==="auto"?"min(600px, 90vw)":void 0},placement:x,shouldFlip:v,children:jsxRuntime.jsx(zd.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?h=>jsxRuntime.jsx(Mt,{id:h.id,textValue:h.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(h)})},h.id):o})})})]})}),F&&jsxRuntime.jsx(Xe,{isOpen:V,onClose:()=>M(false),title:e??"Select an option",contentPadding:false,children:jsxRuntime.jsx(zd.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:w!=null?[w]:[],onSelectionChange:S=>{let B=Array.from(S)[0];B!=null&&(X(B),M(false));},children:a&&n?S=>jsxRuntime.jsx(Mt,{id:S.id,textValue:S.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(S)})},S.id):o})})})]})}function Mt({size:e,className:t,...r}){let o=Of(),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-body 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",Ae[n].paddingY,Ae[n].text,t)})}var WS=[],GS={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},US={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Wf={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},Od=(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 YS(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 KS(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 ms({label:e,staticItems:t=WS,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:b,showErrors:x=true,renderItem:v,renderLeftIcon:y,renderSection:C,autoFocus:T=false,reserveErrorSpace:P=false,hideChevron:R=false,useMobileTray:L=true,className:D}){let A=Me__namespace.default.useRef(null),V=Me__namespace.default.useRef(null),[M,w]=Me__namespace.default.useState(),[N,z]=Me.useState(()=>Od(o||n,t,r)),[W,F]=Me.useState(false),[K,X]=Me.useState(false),G=no(N),{contains:U}=ss({sensitivity:"base"}),[k,S]=Me.useState(),{isMobile:B}=kt(),E=L&&B,h=Ae[u].text,O=reactStately.useAsyncList({async load({signal:ie,filterText:ue=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(ue))return {items:[]};try{let ge;return i.requestType==="GraphQL"?ge=await KS(i,ue,ie):ge=await YS(i,ue,ie),S(ge.error),{items:ge.items}}catch(ge){return ge instanceof Error&&ge.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ge),S(ge instanceof Error?ge.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),H=i&&G!==""?O:null,j=false,oe=Me.useRef("");Me.useEffect(()=>{T&&F(true);},[T]),Me.useEffect(()=>{let ie=Od(o,t,r);ie!==N&&z(ie);},[o,t,r]),Me.useEffect(()=>{let ie=()=>{A.current&&w(A.current.offsetWidth);};return ie(),window.addEventListener("resize",ie),()=>window.removeEventListener("resize",ie)},[]),Me.useEffect(()=>{G===""?oe.current="":H&&G!==oe.current&&(oe.current=G,H.setFilterText(G));},[G,H]),j=Pi(!!H?.isLoading,300);let me=Me__namespace.default.useMemo(()=>{if(!E||!N)return H?H.items:t;let ie=H?H.items:t,ue=s||U;return ie.filter(ge=>ue(ge.name,N))},[E,N,H,t,s,U]),q=ie=>{let ue=Od(ie,t,r);z(ue),a&&a(ie);},ne=ie=>{z(ie);},Te=()=>{E&&X(true);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.ComboBox,{onSelectionChange:q,selectedKey:o||void 0,defaultSelectedKey:n||void 0,defaultItems:r?r.flatMap(ie=>ie.items):t,items:H?H.items:void 0,className:Ce(D,"group flex flex-col w-full"),menuTrigger:E?"manual":"focus",isDisabled:g,isInvalid:f||!!l,inputValue:N,onInputChange:ne,autoFocus:T&&!E,defaultFilter:s||U,"aria-label":e||c||"Autocomplete",children:ie=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(Ee,{size:u,tooltip:m,isRequired:p,children:e}),jsxRuntime.jsxs(ot,{ref:A,children:[y?jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:y(j)}):jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:j?jsxRuntime.jsx(Gr,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(I,{name:"MagnifyingGlass",className:`${GS[u]} text-text-muted`})}),jsxRuntime.jsx(reactAriaComponents.Input,{className:xt({isInvalid:f||!!l,isDisabled:g,isFocused:W||(E?K:ie.isOpen),size:u,className:tailwindMerge.twMerge(US[u],N&&!g||!R&&!N?"pr-10":"pr-3",E&&"cursor-pointer",D)}),placeholder:c,disabled:g,onFocus:ue=>{F(true),E&&(ue.currentTarget.blur(),Te());},onBlur:()=>{F(false);},onClick:E?Te:void 0,readOnly:E,"aria-label":e||c||"Autocomplete"}),N&&!g&&jsxRuntime.jsx(Da,{onClick:()=>{z(""),a?.(null);},size:u}),!R&&!N&&jsxRuntime.jsx(reactAriaComponents.Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":"Toggle menu",isDisabled:g,children:({isPressed:ue})=>jsxRuntime.jsx(I,{name:ue?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),P?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:x&&k?jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text",children:k}):x&&typeof l=="string"?jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text",children:l}):x&&typeof l=="function"&&b?jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text",children:l(b)}):d?jsxRuntime.jsx(Se,{size:u,children:d}):null}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d&&jsxRuntime.jsx(Se,{size:u,className:"mt-1",children:d}),x&&k&&jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text mt-1",children:k}),x&&typeof l=="string"&&jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text mt-1",children:l}),x&&typeof l=="function"&&b&&jsxRuntime.jsx(pe,{size:u,className:"text-feedback-error-text mt-1",children:l(b)})]}),!E&&jsxRuntime.jsx(Ze,{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:M?`${M}px`:void 0},children:jsxRuntime.jsx(reactAriaComponents.ListBox,{className:`max-h-[300px] overflow-auto bg-background-input outline-none ${h}`,children:r?r.map(ue=>{let ge=ue.items.map($=>jsxRuntime.jsx(Mt,{id:$.id,textValue:$.name,size:u,className:`flex cursor-default items-center gap-2 px-3 ${Wf[u]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:v?v($):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[$.name,jsxRuntime.jsx(I,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},$.id));if(C){let $=C(ue,ge);return Me__namespace.default.isValidElement($)&&$.type===reactAriaComponents.ListBoxSection?$:jsxRuntime.jsx(reactAriaComponents.ListBoxSection,{children:$},ue.name)}return jsxRuntime.jsxs(reactAriaComponents.ListBoxSection,{children:[jsxRuntime.jsx(reactAriaComponents.Header,{className:"px-3 py-1 text-sm font-bold text-text-muted",children:ue.name}),ge]},ue.name)}):ue=>jsxRuntime.jsx(Mt,{id:ue.id,textValue:ue.name,size:u,className:`flex cursor-default items-center gap-2 px-3 ${Wf[u]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:v?v(ue):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ue.name,jsxRuntime.jsx(I,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},ue.id)})})]})}),E&&jsxRuntime.jsx(Xe,{isOpen:K,onClose:()=>X(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(ot,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:j?jsxRuntime.jsx(Gr,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(I,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-muted"})}),jsxRuntime.jsx("input",{ref:V,type:"text",value:N,onChange:ie=>ne(ie.target.value),placeholder:c,autoFocus:true,className:xt({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),N&&jsxRuntime.jsx(Da,{onClick:()=>{z(""),a?.(null);},size:"md"})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsx(reactAriaComponents.ListBox,{items:me,selectedKeys:o?[o]:[],selectionMode:"single",onSelectionChange:ie=>{let ue=Array.from(ie)[0];ue&&(q(ue),X(false));},className:"bg-background-input outline-none",children:ie=>jsxRuntime.jsx(Mt,{id:ie.id,textValue:ie.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:v?v(ie):ie.name},ie.id)})})]})})]})}function Jr({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]=Me.useState(false),f=Me.useCallback(()=>g(true),[]);Me.useEffect(()=>{g(false);},[e]);let b={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"},x={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"},v={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-muted border-border-muted",away:"bg-feedback-warning-background border-feedback-warning-border",busy:"bg-feedback-error-background border-feedback-error-border"},C={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"},T=s==="circle"?"rounded-full":"rounded-md",P=tailwindMerge.twMerge("relative inline-flex items-center justify-center overflow-hidden transition-opacity outline-none",b[i],T,a&&"cursor-pointer hover:opacity-80",u&&"ring-2 ring-background-surface",l),L=(()=>{if(r||o){let M=r?.[0]||"",w=o?.[0]||"";return (M+w).toUpperCase()}if(n){let M=n.split(" "),w=M[0]?.[0]||"",N=M[M.length-1]?.[0]||"";return w===N?w.toUpperCase():(w+N).toUpperCase()}return ""})(),D=()=>{let M={xs:14,sm:16,md:20,lg:24,xl:32}[i];switch(c){case "team":return jsxRuntime.jsx(lucideReact.Users,{size:M});case "organization":return jsxRuntime.jsx(lucideReact.Building2,{size:M});default:return jsxRuntime.jsx(lucideReact.User,{size:M})}},A=M=>{if(m)return c==="organization"?M?"organization-logo":"initials":M?"avatar":"initials"},V=()=>e&&!p?jsxRuntime.jsx("img",{src:e,alt:t||n||"Avatar",className:"h-full w-full object-cover",onError:f,"data-pii-type":A(true),"data-pii-entity":m}):L?jsxRuntime.jsx("span",{className:"font-semibold","data-pii-type":A(false),"data-pii-entity":m,children:L}):D();return jsxRuntime.jsxs("div",{className:"relative inline-block",children:[jsxRuntime.jsx("div",{"data-avatar":true,className:tailwindMerge.twMerge(P,!e||p?C[c]:""),onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,children:V()}),d&&jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("absolute border-2 border-background-surface",T,x[i],v[i],y[d]),"aria-label":`Status: ${d}`})]})}var _S={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-brand/10 text-action-brand",brand:"bg-action-brand/10 text-action-brand",secondary:"bg-action-default/10 text-action-default",neutral:"bg-background-muted text-text-muted",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"},e1={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"},t1={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"},r1={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 Je({children:e,variant:t="default",size:r="sm",shape:o="square",dot:n=false,dotPosition:a="left",dotPulse:i=false,className:s}){let c=n&&jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("rounded-full bg-current opacity-75",r1[r],i&&"animate-pulse"),"aria-hidden":"true"});return jsxRuntime.jsxs("span",{className:tailwindMerge.twMerge("inline-flex items-center gap-1.5 font-medium",e1[r],t1[o],_S[t],s),children:[n&&a==="left"&&c,e,n&&a==="right"&&c]})}var Ue=({href:e,children:t,className:r="",external:o=false,title:n,variant:a="default",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"}:{},y=`${`${d?"underline decoration-1 underline-offset-4 decoration-current":"hover:underline hover:decoration-1 hover:underline-offset-4 hover:decoration-current"} cursor-pointer`} ${{default:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",brand:"text-action-brand hover:text-action-brand-hover visited:text-action-brand",muted:"text-text-muted hover:text-text-muted visited:text-text-muted",unstyled:""}[a]} ${r}`,C=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t,l&&jsxRuntime.jsxs("span",{children:["\xA0","\u2192"]})]});return s?jsxRuntime.jsx("button",{type:"button",className:y,onClick:c,title:n,...g,children:C}):u&&e?jsxRuntime.jsx(u,{href:e,className:y,title:n,onClick:i,...f,...g,children:C}):jsxRuntime.jsx("a",{href:e||"#",className:y,...f,...g,title:n,onClick:i,children:C})};var p1={info:{subtle:{container:"bg-feedback-info-background border-l-4 border-l-feedback-info-border",iconColor:"text-feedback-info-icon",titleColor:"text-text-heading",bodyColor:"text-text-body"},bold:{container:"bg-feedback-info-icon border-feedback-info-icon",iconColor:"text-white",titleColor:"text-white",bodyColor:"text-white/90"},icon:lucideReact.Info},success:{subtle:{container:"bg-feedback-success-background border-l-4 border-l-feedback-success-border",iconColor:"text-feedback-success-icon",titleColor:"text-text-heading",bodyColor:"text-text-body"},bold:{container:"bg-feedback-success-icon border-feedback-success-icon",iconColor:"text-white",titleColor:"text-white",bodyColor:"text-white/90"},icon:lucideReact.CheckCircle},warning:{subtle:{container:"bg-feedback-warning-background border-l-4 border-l-feedback-warning-border",iconColor:"text-feedback-warning-icon",titleColor:"text-text-heading",bodyColor:"text-text-body"},bold:{container:"bg-feedback-warning-icon border-feedback-warning-icon",iconColor:"text-white",titleColor:"text-white",bodyColor:"text-white/90"},icon:lucideReact.AlertCircle},error:{subtle:{container:"bg-feedback-error-background border-l-4 border-l-feedback-error-border",iconColor:"text-feedback-error-icon",titleColor:"text-text-heading",bodyColor:"text-text-body"},bold:{container:"bg-feedback-error-icon border-feedback-error-icon",iconColor:"text-white",titleColor:"text-white",bodyColor:"text-white/90"},icon:lucideReact.XCircle},discovery:{subtle:{container:"bg-brand-light border-l-4 border-l-brand-primary",iconColor:"text-brand-primary",titleColor:"text-text-heading",bodyColor:"text-text-body"},bold:{container:"bg-brand-primary border-brand-primary",iconColor:"text-white",titleColor:"text-white",bodyColor:"text-white/90"},icon:lucideReact.Lightbulb}};function gs({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=p1[e],p=m[t],g=m.icon,f=!!(i||s),b=!!(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:[b&&jsxRuntime.jsxs("div",{className:"flex-1",children:[r&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("text-sm font-semibold leading-5",p.titleColor),children:r}),o&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("text-sm leading-5",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(Ue,{asButton:true,onPress:i.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-white hover:text-white/80":"",children:i.label}):jsxRuntime.jsx(Q,{size:"sm",variant:"default",onPress:i.onPress,className:t==="bold"?"bg-white text-text-heading hover:bg-white/90":"",children:i.label})),s&&(s.asLink?jsxRuntime.jsx(Ue,{asButton:true,onPress:s.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-white hover:text-white/80":"",children:s.label}):jsxRuntime.jsx(Q,{size:"sm",variant:"secondary",onPress:s.onPress,className:t==="bold"?"border-white/30 text-white hover:bg-white/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-black/10",p.iconColor,Oe()),"aria-label":"Dismiss banner",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]})}function Yf({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(gs,{...o,className:a})})})}function fo({value:e,children:t,className:r,size:o="sm",iconPosition:n="right"}){let[a,i]=Me.useState(false),l=jsxRuntime.jsx(Q,{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(I,{name:"Copy",size:o==="sm"?14:16})}),d=a?jsxRuntime.jsx(Et,{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 bs(e){let{children:t,maxWidth:r=600,className:o,...n}=e,{ref:a,width:i}=kn(),[s,c]=Me__namespace.default.useState(false),[l,d]=Me__namespace.default.useState(false),u=Me__namespace.default.useRef(false),m=Me__namespace.default.useMemo(()=>t&&!e.items&&typeof t!="function"?Me__namespace.default.Children.toArray(t):null,[t,e.items]);if(Me__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),b=g.map(x=>{if(Me__namespace.default.isValidElement(x)){let v=x.props;if(typeof v.children=="string")return {label:v.children,href:v.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(h1,{items:b}),f]})}return jsxRuntime.jsx(reactAriaComponents.Breadcrumbs,{...n,ref:a,className:tailwindMerge.twMerge("flex gap-2",l?"opacity-100":"opacity-0",o),children:t})}function h1({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(Ln,{items:t,align:"left",size:"sm",children:jsxRuntime.jsx(Q,{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-muted"})]})})}function xs(e){let{className:t,children:r,href:o,copyable:n,copyValue:a,...i}=e;return jsxRuntime.jsx(reactAriaComponents.Breadcrumb,{className:Ce(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(fo,{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-body sm:max-w-none",children:l})}):jsxRuntime.jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-body sm:max-w-none",children:l}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ue,{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-muted"})]})})}})}function R1({isSelected:e,isDisabled:t}){let r=[Oe,"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-onPrimary invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):r.push("text-text-body hover:bg-background-hover pressed:bg-background-selected"),r.join(" ")}function Bn({errorMessage:e,...t}){return jsxRuntime.jsxs(reactAriaComponents.Calendar,{...t,children:[jsxRuntime.jsx(hs,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(ys,{}),jsxRuntime.jsx(reactAriaComponents.CalendarGridBody,{children:r=>jsxRuntime.jsx(reactAriaComponents.CalendarCell,{date:r,className:({isSelected:o,isDisabled:n})=>`${R1({isSelected:o,isDisabled:n})} border-0`})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function hs(){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(Q,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsxRuntime.jsx(I,{name:"CaretRight","aria-hidden":true,size:t}):jsxRuntime.jsx(I,{name:"CaretLeft","aria-hidden":true,size:t})}),jsxRuntime.jsx(reactAriaComponents.Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-zinc-900 dark:text-zinc-200"}),jsxRuntime.jsx(Q,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsxRuntime.jsx(I,{name:"CaretLeft","aria-hidden":true,size:t}):jsxRuntime.jsx(I,{name:"CaretRight","aria-hidden":true,size:t})})]})}function ys(){return jsxRuntime.jsx(reactAriaComponents.CalendarGridHeader,{children:e=>jsxRuntime.jsx(reactAriaComponents.CalendarHeaderCell,{className:"text-xs font-semibold text-text-caption",children:e})})}var Xf=Me__namespace.createContext(null);function go(){let e=Me__namespace.useContext(Xf);if(!e)throw new Error("Carousel components must be used within a CarouselRoot");return e}function $f({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,b]=Me__namespace.useState(t),x=g?e:f,v=Me__namespace.useRef(null),[y,C]=Me__namespace.useState(0),[T,P]=Me__namespace.useState(typeof a=="boolean"?a:!!a),[R,L]=Me__namespace.useState(false),D=Me__namespace.useRef(null),A=Me__namespace.useRef(null),V=typeof a=="object"&&a!==null&&a.delay?a.delay:i;Me__namespace.useEffect(()=>{if(v.current){let h=Math.max(1,Math.floor(Number(l)||1)),O=v.current.children;if(O.length===0){C(0);return}let H=Math.ceil(O.length/h);C(H);}},[m,l]);let M=Me__namespace.useRef(-1);Me__namespace.useEffect(()=>{if(x!==M.current&&v.current){let h=Array.from(v.current.children);if(h.length===0)return;let O=x*l,H=Math.min(O,h.length-1),j=h[H];j&&typeof j.scrollIntoView=="function"&&(j.scrollIntoView({behavior:"smooth",block:o==="vertical"?"start":"nearest",inline:o==="horizontal"?"start":"nearest"}),M.current=x);}},[x,l,o]);let w=Me__namespace.useCallback(h=>{let O=h;n?O<0?O=y-1:O>=y&&(O=0):O=Math.max(0,Math.min(h,y-1)),g||b(O),r?.(O);},[g,n,r,y]),N=Me__namespace.useCallback(()=>{w(x+d);},[x,w,d]),z=Me__namespace.useCallback(()=>{w(x-d);},[x,w,d]),W=Me__namespace.useRef(N);Me__namespace.useEffect(()=>{W.current=N;},[N]);let F=y>0&&(n||x<y-1),K=y>0&&(n||x>0),X=Me__namespace.useCallback(()=>{P(h=>!h);},[]);Me__namespace.useEffect(()=>{if(T&&y>1)return D.current=setInterval(()=>{W.current();},V),()=>{D.current&&(clearInterval(D.current),D.current=null);}},[T,y,V]);let G=Me__namespace.useCallback(()=>{D.current&&(clearInterval(D.current),D.current=null);},[]),U=Me__namespace.useCallback(()=>{T&&y>1&&(D.current=setInterval(()=>{W.current();},V));},[T,y,V]),k=Me__namespace.useCallback(h=>{if(!s)return;L(true);let O="touches"in h&&h.touches&&h.touches.length>0?h.touches[0].clientX:"clientX"in h?h.clientX:0,H="touches"in h&&h.touches&&h.touches.length>0?h.touches[0].clientY:"clientY"in h?h.clientY:0;A.current={x:O,y:H};},[s]),S=Me__namespace.useCallback(h=>{if(!R||!A.current)return;let O="touches"in h&&h.touches&&h.touches.length>0?h.touches[0].clientX:"clientX"in h?h.clientX:0,H="touches"in h&&h.touches&&h.touches.length>0?h.touches[0].clientY:"clientY"in h?h.clientY:0,j=O-A.current.x,oe=H-A.current.y,me=50;o==="horizontal"&&Math.abs(j)>me?(j>0?z():N(),L(false),A.current=null):o==="vertical"&&Math.abs(oe)>me&&(oe>0?z():N(),L(false),A.current=null);},[R,o,N,z]),B=Me__namespace.useCallback(()=>{L(false),A.current=null;},[]),E={currentPage:x,totalPages:y,orientation:o,loop:n,spacing:c,slidesPerView:l,goToPage:w,goToNext:N,goToPrev:z,canGoNext:F,canGoPrev:K,isAutoplayActive:T,toggleAutoplay:X,itemsRef:v,isDragging:R,allowMouseDrag:s,handleDragStart:k,handleDragMove:S,handleDragEnd:B};return jsxRuntime.jsx(Xf.Provider,{value:E,children:jsxRuntime.jsx("div",{...p,className:tailwindMerge.twMerge("relative w-full",o==="vertical"?"h-full":"",u),onMouseEnter:G,onMouseLeave:U,children:m})})}function Qf({className:e,children:t,...r}){let{itemsRef:o,orientation:n,spacing:a,isDragging:i,allowMouseDrag:s,handleDragStart:c,handleDragMove:l,handleDragEnd:d}=go();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 _f({index:e,className:t,children:r,...o}){let{orientation:n,slidesPerView:a}=go();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 eg({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 tg({className:e,children:t,...r}){let{goToPrev:o,canGoPrev:n}=go();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-body 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(I,{name:"CaretLeft",size:"sm"})})}function rg({className:e,children:t,...r}){let{goToNext:o,canGoNext:n}=go();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-body 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(I,{name:"CaretRight",size:"sm"})})}function Jd({index:e,className:t,children:r,...o}){let{currentPage:n,goToPage:a}=go(),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 og({className:e,...t}){let{totalPages:r}=go();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(Jd,{index:n},n))})}function ng({className:e,children:t,...r}){let{isAutoplayActive:o,toggleAutoplay:n}=go();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-body 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(I,{name:o?"Pause":"Play",size:"sm"})})}function ag({className:e,...t}){let{currentPage:r,totalPages:o}=go();return jsxRuntime.jsxs("div",{...t,className:tailwindMerge.twMerge("text-sm text-text-muted tabular-nums",e),"aria-live":"polite","aria-atomic":"true",children:[r+1," / ",o]})}function jd(e){return jsxRuntime.jsxs(reactAriaComponents.CheckboxGroup,{...e,className:Ce(e.className,"flex flex-col gap-2"),children:[jsxRuntime.jsx(Ee,{children:e.label}),e.children,e.description&&jsxRuntime.jsx(Se,{children:e.description}),jsxRuntime.jsx(pe,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function F1({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-caption"}`}function B1({isSelected:e,isInvalid:t,isDisabled:r,isIndeterminate:o,variant:n="default"}){let a="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",i=n==="brand"?"focus:ring-action-brand":"focus:ring-action-default",s="";if(r)s="border-border-muted bg-background-muted";else if(t)s="border-feedback-error-border bg-feedback-error-background";else if(e||o){let c=n==="brand"?"action-brand":"action-default";s=`bg-${c} border-${c} hover:bg-${c}-hover hover:border-${c}-hover`;}else s="bg-background-input border-border-input hover:border-border-focus";return `${a} ${i} ${s}`}var ig="w-4 h-4 text-text-onPrimary group-disabled:text-text-disabled";function Zo(e){let{children:t,variant:r="default",...o}=e;return jsxRuntime.jsx(reactAriaComponents.Checkbox,{...o,className:reactAriaComponents.composeRenderProps(e.className,(n,a)=>`${F1(a)} ${n||""}`),children:n=>{let{isSelected:a,isIndeterminate:i,...s}=n,c=jsxRuntime.jsx("div",{className:B1({isSelected:a,isIndeterminate:i,variant:r,...s}),children:i?jsxRuntime.jsx(lucideReact.Minus,{"aria-hidden":true,className:ig}):a?jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":true,className:ig}):null});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,typeof t=="function"?t(n):t]})}})}var O1={default:"bg-background-muted text-action-default border border-border-muted hover:bg-background-hover",brand:"bg-action-brand/10 text-action-brand border border-action-brand/20 hover:bg-action-brand/15",secondary:"bg-background-input text-text-body border border-border-input hover:bg-background-hover",info:"bg-feedback-info-background text-feedback-info-text border border-feedback-info-border hover:bg-feedback-info-background/80"},H1={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"},W1="opacity-75 cursor-not-allowed pointer-events-none";function lg(e){let{variant:t,size:r,isDisabled:o,isClickable:n,className:a}=e,i=r==="xs"?"text-xs":Ae[r].text;return tailwindMerge.twMerge("inline-flex items-center justify-center rounded-full font-medium transition-colors","whitespace-nowrap select-none",H1[r],i,O1[t],n&&!o&&"cursor-pointer",o&&W1,a)}function Er({children:e,onRemove:t,size:r="md",variant:o="default",isRemovable:n=true,isDisabled:a=false,className:i,onClick:s}){let c=!!s&&!a,l=n&&t&&!a,d=f=>{f.stopPropagation(),f.preventDefault(),t&&!a&&t();},u=()=>{s&&!a&&s();},m=r==="xs"?10:r==="sm"?12:r==="md"?14:16,g=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate",children:e}),l?c?jsxRuntime.jsx("span",{onClick:d,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),d(f));},role:"button",tabIndex:0,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-black/10 transition-colors cursor-pointer","aria-label":"Remove",children:jsxRuntime.jsx(I,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):jsxRuntime.jsx("button",{type:"button",onClick:d,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-black/10 transition-colors cursor-pointer","aria-label":"Remove",tabIndex:-1,children:jsxRuntime.jsx(I,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):null]});return c?jsxRuntime.jsx("button",{type:"button",onClick:u,className:lg({variant:o,size:r,isDisabled:a,isClickable:c,className:i}),disabled:a,children:g}):jsxRuntime.jsx("span",{className:lg({variant:o,size:r,isDisabled:a,isClickable:c,className:i}),children:g})}function ug({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="default",showErrors:f=true,className:b}){let[x,v]=Me.useState(""),[y,C]=Me.useState([]),[T,P]=Me.useState(false),[R,L]=Me.useState(false),[D,A]=Me.useState(-1),V=no(x,300),M=Me.useRef(null),w=Me.useRef(null),{isFocused:N,handleFocus:z,handleBlur:W}=nr(),F=Me.useId(),K=Me.useCallback(E=>{if(!u||!E.trim())return;let h=E.trim();if(d.includes(h)){v(""),L(false),C([]),A(-1);return}u([...d,h]),v(""),L(false),C([]),A(-1),M.current?.focus();},[d,u]),X=Me.useCallback(E=>{u&&u(d.filter(h=>h!==E));},[d,u]);Me.useEffect(()=>{if(!p)return;let E=true;return (async()=>{let O=V.trim();if(!O){E&&(P(false),C([]),L(false));return}P(true);try{let H=await p(O);if(!E)return;C(H),L(!0);}catch(H){if(!E)return;console.error("Error fetching suggestions:",H),C([]),L(false);}finally{E&&P(false);}})(),()=>{E=false;}},[V,p]),Me.useEffect(()=>{if(p||!m)return;if(!V.trim()){C([]),L(false);return}let E=m.filter(h=>h.name.toLowerCase().includes(V.toLowerCase())).map(h=>h.id);C(E),L(E.length>0||V.trim().length>0);},[V,m,p]);let G=Me.useMemo(()=>{let E=y.filter(h=>!d.includes(h));return x.trim()&&!E.includes(x.trim())&&!d.includes(x.trim())?[...E,`Create tag: "${x.trim()}"`]:E},[y,x,d]),U=Me.useCallback(E=>{v(E.target.value),A(-1),E.target.value&&L(true);},[]),k=Me.useCallback(E=>{i||(E.startsWith("Create tag:")?K(x):K(E));},[K,x,i]),S=Me.useCallback(E=>{if(!i)switch(E.key){case "Enter":case ",":if(E.preventDefault(),D>=0&&D<G.length){let h=G[D];h.startsWith("Create tag:")?K(x):K(h);}else x.trim()&&K(x.trim());break;case "Backspace":!x&&d.length>0&&(E.preventDefault(),X(d[d.length-1]));break;case "ArrowDown":E.preventDefault(),R&&A(h=>h<G.length-1?h+1:h);break;case "ArrowUp":E.preventDefault(),R&&A(h=>h>0?h-1:-1);break;case "Escape":L(false),A(-1);break}},[i,x,d,G,D,R,K,X]);Me.useEffect(()=>{let E=h=>{w.current&&h.target instanceof Node&&!w.current.contains(h.target)&&L(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);let B=()=>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]",mo({isInvalid:s,isDisabled:i,isFocused:N}),"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:w,className:tailwindMerge.twMerge("relative flex flex-col gap-1",b),children:[e&&jsxRuntime.jsx(Ee,{size:o,tooltip:n,isRequired:a,children:e}),jsxRuntime.jsx(ot,{children:jsxRuntime.jsxs("div",{className:B(),onClick:()=>!i&&M.current?.focus(),children:[d.map(E=>jsxRuntime.jsx(Er,{variant:g,size:"xs",onRemove:()=>X(E),isDisabled:i,className:"shrink-0 max-h-full",children:E},E)),jsxRuntime.jsx("input",{ref:M,type:"text",role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":F,"aria-autocomplete":"list",value:x,onChange:U,onKeyDown:S,onFocus:E=>z(E),onBlur:E=>W(E),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-body text-sm placeholder:text-text-placeholder 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"}})]})}),R&&(x||G.length>0)&&jsxRuntime.jsx("div",{id:F,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:T?jsxRuntime.jsx("div",{className:"px-3 py-2 text-sm text-text-muted",children:"Loading..."}):G.length>0?G.map((E,h)=>jsxRuntime.jsx("div",{role:"option","aria-selected":h===D,className:tailwindMerge.twMerge("cursor-pointer px-3 py-2 text-sm transition-colors","hover:bg-background-hover",h===D&&"bg-background-selected",E.startsWith("Create tag:")&&"italic text-text-muted"),onClick:()=>k(E),children:E},E)):x&&jsxRuntime.jsx("div",{className:"px-3 py-2 text-sm text-text-muted",children:"No suggestions found"})}),t&&jsxRuntime.jsx(Se,{size:o,className:"mt-1",children:t}),f&&typeof r=="string"&&jsxRuntime.jsx(pe,{size:o,className:"text-feedback-error-text mt-1",children:r}),f&&typeof r=="function"&&c&&jsxRuntime.jsx(pe,{size:o,className:"text-feedback-error-text mt-1",children:r(c)})]})}var $1={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')},Q1={github:()=>import('ace-builds/src-noconflict/theme-github'),github_dark:()=>import('ace-builds/src-noconflict/theme-github_dark')},_1={"ext-language-tools":()=>import('ace-builds/src-noconflict/ext-language_tools')},Ia=new Set;async function Zd(e,t){Ia.has(e)||(await t(),Ia.add(e));}async function e2(e,t,r){await Promise.all([Zd(`language:${e}`,$1[e]),Zd(`theme:${t}`,Q1[t]),r?Zd("extension:language-tools",_1["ext-language-tools"]):void 0]);}function mg(e,t,r){let o=Ia.has(`language:${e}`)&&Ia.has(`theme:${t}`);return r?o&&Ia.has("extension:language-tools"):o}function fg({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=Me.useRef(null),[b,x]=Me.useState(()=>mg(o,n,!t)),v=Me.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 Me.useEffect(()=>{let y=false,C=!t;return mg(o,n,C)?(x(true),()=>{y=true;}):(x(false),e2(o,n,C).then(()=>{y||x(true);}).catch(T=>{y||x(true),console.error("Failed to load Ace editor resources",T);}),()=>{y=true;})},[o,t,n]),Me.useEffect(()=>{b&&f.current?.editor&&f.current.editor.resize();},[v,b]),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden rounded-md border border-border-input",s),style:{width:i,height:v},children:b?jsxRuntime.jsx(Z1__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 bg=Me__namespace.createContext({variant:"contained",density:"comfortable",showDividers:true}),xg=Me__namespace.createContext(null),a2={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"},gg={true:"divide-y divide-border-default",false:"gap-3"},i2={comfortable:"px-5 py-3",compact:"px-4 py-2.5"},s2={comfortable:"px-5 pt-0",compact:"px-4 pt-0"},l2={comfortable:"h-4 w-4",compact:"h-3.5 w-3.5"};function _d(){return Me__namespace.useContext(bg)}function c2(e){let t=Me__namespace.useContext(xg);if(!t)throw new Error(`${e} must be used within a <CollapseItem>`);return t}function d2({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 u2({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-body",c=t&&!e?"bg-background-hover":"",l=i2[r];return tailwindMerge.twMerge(i,Oe(),l,s,c,o==="plain"&&n?"px-0":"",a)}function p2({density:e,showDividers:t,className:r}){let o="text-text-body",n=s2[e];return tailwindMerge.twMerge(o,n,t?"":"rounded-b-lg",r)}function zn({variant:e="contained",density:t="comfortable",showDividers:r=true,className:o,...n}){let a=Me__namespace.useMemo(()=>({variant:e,density:t,showDividers:r}),[e,t,r]),i=tailwindMerge.twMerge("flex w-full flex-col",a2[e],r?gg.true:gg.false,e==="plain"&&r?"border-y border-border-default/60":"");return jsxRuntime.jsx(bg.Provider,{value:a,children:jsxRuntime.jsx(reactAriaComponents.DisclosureGroup,{...n,className:Ce(o,i)})})}function xo({className:e,children:t,...r}){let{variant:o,showDividers:n}=_d();return jsxRuntime.jsx(reactAriaComponents.Disclosure,{...r,className:reactAriaComponents.composeRenderProps(e,a=>d2({variant:o,showDividers:n,className:a})),children:a=>jsxRuntime.jsx(xg.Provider,{value:a,children:t})})}xo.displayName="CollapseItem";function ho({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=c2("CollapseHeader"),{density:m,variant:p,showDividers:g}=_d(),f=l2[m];return jsxRuntime.jsx(reactAriaComponents.Button,{...d,slot:"trigger","data-expanded":u.isExpanded?"true":void 0,className:reactAriaComponents.composeRenderProps(l,(b,x)=>u2({isDisabled:x.isDisabled??false,isPressed:x.isPressed??false,density:m,variant:p,showDividers:g,className:b})),children:b=>{let x=b.isDisabled??false,v=i?typeof n=="function"?n({isExpanded:u.isExpanded,isDisabled:x}):n??jsxRuntime.jsx(I,{name:"CaretDown",size:m==="compact"?"xs":"sm",weight:"bold","aria-hidden":"true",className:tailwindMerge.twMerge("text-text-muted transition-transform duration-200",u.isExpanded?"rotate-180":"rotate-0")}):null,y=v?jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("flex flex-shrink-0 items-center justify-center text-text-muted",f),"aria-hidden":"true",children:v}):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-muted",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-heading",children:e}),t&&jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:t})]}),o&&jsxRuntime.jsx("div",{className:"flex flex-shrink-0 items-center text-sm text-text-muted",children:o})]}),a==="end"&&y]})}})}ho.displayName="CollapseHeader";function yo({className:e,children:t,...r}){let{density:o,showDividers:n}=_d();return jsxRuntime.jsx(reactAriaComponents.DisclosurePanel,{...r,className:reactAriaComponents.composeRenderProps(e,a=>p2({density:o,showDividers:n,className:a})),children:t})}yo.displayName="CollapseContent";function Vn(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 tu(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 b2({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[b,x]=Me.useState(d||""),[v,y]=Me.useState(l||d||""),[C,T]=Me.useState(false),[P,R]=Me.useState(null),{isFocused:L,handleFocus:D,handleBlur:A}=nr(),V=l!==void 0?l:b;Me.useEffect(()=>{l!==void 0&&y(l);},[l]);let M=V?!Vn(V):false,w=Me.useCallback(W=>{if(y(W),Vn(W)){let F=tu(W);u?u(F):x(F);}else W===""&&(u?u(""):x(""));},[u]),N=Me.useCallback(W=>{let F=tu(W);y(F),u?u(F):x(F);},[u]),z=Me.useCallback(W=>{if(Vn(v)){let F=tu(v);y(F),u&&F!==V?u(F):!u&&F!==b&&x(F);}A(W,f.onBlur);},[v,V,b,u,A,f.onBlur]);return jsxRuntime.jsx(reactAriaComponents.TextField,{...f,isRequired:a,className:Ce(s,"group flex flex-col"),children:({isDisabled:W})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(Ee,{size:o,tooltip:n,isRequired:a,children:e}),jsxRuntime.jsx(ot,{children:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 relative",children:[jsxRuntime.jsx(cs,{size:o,disabled:W,type:"text",value:v,placeholder:m,onFocus:F=>D(F,f.onFocus),onBlur:z,onChange:F=>w(F.target.value),className:tailwindMerge.twMerge(xt({isInvalid:M,isDisabled:W,isFocused:L,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:Ae[o].height},children:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("w-6 h-6 rounded border shadow-sm",Vn(V)?"border-border-default":"border-border-default bg-background-muted"),style:Vn(V)?{backgroundColor:V}:void 0,"aria-hidden":"true",children:!Vn(V)&&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:R,children:jsxRuntime.jsx(Q,{variant:"secondary",size:o,icon:"Palette",onPress:()=>T(!C),isDisabled:W,className:"flex-shrink-0",children:"Pick"})})]})}),g?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsxRuntime.jsx(pe,{size:o,children:r}):typeof r=="function"&&c?jsxRuntime.jsx(pe,{size:o,children:r(c)}):t?jsxRuntime.jsx(Se,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&c?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r(c)}):t?jsxRuntime.jsx(Se,{size:o,className:"mt-1",children:t}):null}),C&&P&&jsxRuntime.jsx(Ze,{triggerRef:{current:P},isOpen:C,onOpenChange:T,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:V||"#000000",onChange:N,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:V||"#000000"}}),jsxRuntime.jsx("div",{className:"flex-1 text-text-body text-[length:var(--control-text-sm)] font-mono",children:V||"#000000"})]})]})})]})})}function vg({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(_t,{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-body",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=Ai(t);else if(!e&&r){let u=Ai(r);d=u?`Offline ${u}`:null;}}return jsxRuntime.jsxs("div",{className:"inline-flex flex-col gap-1",children:[jsxRuntime.jsx(Je,{variant:l,size:a,shape:i,dot:e,dotPulse:e,...s,children:c}),d&&jsxRuntime.jsx("span",{className:"text-xs text-text-muted",children:d})]})}function Sg({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(),b=({children:v,className:y})=>a?i?jsxRuntime.jsx(i,{href:a,className:y,children:v}):jsxRuntime.jsx(Ue,{href:a,variant:"unstyled",className:tailwindMerge.twMerge("hover:underline",y),asButton:false,children:v}):jsxRuntime.jsx("span",{className:y,children:v}),x=c==="vertical";return u?jsxRuntime.jsx(Le,{variant:s,className:tailwindMerge.twMerge("flex flex-col",m),children:jsxRuntime.jsx(Le.Content,{className:"flex items-center flex-1",children:jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("w-full",x?"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(x?"w-full text-center":"flex-1","space-y-2"),children:[jsxRuntime.jsx(J,{width:"70%",height:20,className:tailwindMerge.twMerge(x&&"mx-auto")}),jsxRuntime.jsx(J,{width:"100%",height:16,className:tailwindMerge.twMerge(x&&"mx-auto")})]})]})})}):jsxRuntime.jsx(Le,{variant:s,className:tailwindMerge.twMerge("group/card flex flex-col",m),children:jsxRuntime.jsx(Le.Content,{className:tailwindMerge.twMerge("flex items-center flex-1",a&&"cursor-pointer",p),children:jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("relative w-full",x?"flex flex-col items-center gap-4 text-center":"flex items-center gap-4"),children:[jsxRuntime.jsx(Jr,{firstName:e,lastName:t,src:n,size:"xl",variant:"user",shape:"square",className:"flex-shrink-0",piiEntity:g}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge(x?"w-full":"flex-1 min-w-0"),children:[a&&jsxRuntime.jsx(b,{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-heading 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",x&&"flex flex-col items-center"),children:[l&&r&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-text-body",children:[jsxRuntime.jsx(I,{name:"Envelope",size:16,className:"text-text-muted flex-shrink-0"}),jsxRuntime.jsx(Ue,{href:`mailto:${r}`,variant:"unstyled",className:tailwindMerge.twMerge("text-sm leading-relaxed text-text-body relative z-20",x?"":"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-body",children:[jsxRuntime.jsx(I,{name:"Phone",size:16,className:"text-text-muted flex-shrink-0"}),jsxRuntime.jsx(Ue,{href:`tel:${o}`,variant:"unstyled",className:tailwindMerge.twMerge("text-sm leading-relaxed text-text-body relative z-20",x?"":"truncate"),"data-pii-type":g?"phone":void 0,"data-pii-entity":g,children:Pn(o)})]})]})]})]})})})}function Ss({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 b=m??(n==="inline"?"circle":"square"),v={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(),T={strong:"font-semibold text-text-body",high:"font-semibold text-text-body",normal:"text-text-body",low:"text-text-muted"}[l],P=({children:R,className:L})=>i?s?jsxRuntime.jsx(s,{href:i,className:L,children:R}):jsxRuntime.jsx(Ue,{href:i,variant:c,className:tailwindMerge.twMerge("hover:underline",L),asButton:false,children:R}):jsxRuntime.jsx("span",{className:L,children:R});return p?n==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsx(J,{width:v.skeletonAvatar,height:v.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsxRuntime.jsx(J,{width:v.skeletonText,height:v.skeletonAvatar*.5})]}):jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsx(J,{width:v.skeletonAvatar,height:v.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(J,{width:v.skeletonText,height:16}),d&&jsxRuntime.jsx(J,{width:v.skeletonSecondary,height:12})]})]}):n==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",v.gap,g),children:[jsxRuntime.jsxs(P,{className:tailwindMerge.twMerge("flex items-center",v.gap),children:[jsxRuntime.jsx(Jr,{firstName:e,lastName:t,src:o,size:v.avatarSize,variant:"user",shape:b,className:"flex-shrink-0",piiEntity:f}),jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-body",T,v.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",v.gap,g),children:[jsxRuntime.jsx(Jr,{firstName:e,lastName:t,src:o,size:v.avatarSize,variant:"user",shape:b,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(P,{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-body",T,v.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-caption leading-normal truncate",v.secondaryTextSize),"data-pii-type":f?"email":void 0,"data-pii-entity":f,children:r})]})]})}var wg={duration:.5,ease:"easeInOut"},Co=Me.createContext(null),_o=()=>{let e=Me.useContext(Co);if(!e)throw new Error("useChartContext must be used within a ChartContextProvider");return e};var Ba=({data:e,color:t="var(--color-viz-default)"})=>{let r=Me.useId(),o=Me.useId(),{xScale:n,yScale:a,animationSettings:i}=_o(),s=n.range(),c=a.range();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsxs("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[jsxRuntime.jsx("stop",{offset:"50%",stopColor:t,stopOpacity:.1}),jsxRuntime.jsx("stop",{offset:"100%",stopColor:t,stopOpacity:0})]}),jsxRuntime.jsx("clipPath",{id:o,children:jsxRuntime.jsx("rect",{x:s[0],y:c[1],width:s[1]-s[0],height:c[0]-c[1]})})]}),jsxRuntime.jsx("g",{clipPath:`url(#${o})`,children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:i.duration,ease:i.ease},style:{transformOrigin:`0 ${c[0]}px`,transformBox:"fill-box",isolation:"isolate"},children:[jsxRuntime.jsx(shape.AreaClosed,{data:e,x:l=>n(l.xValue),y:l=>a(l.yValue),yScale:a,fill:`url(#${r})`,curve:curve.curveLinear}),jsxRuntime.jsx(shape.LinePath,{data:e,x:l=>n(l.xValue),y:l=>a(l.yValue),stroke:t,strokeWidth:3,curve:curve.curveLinear})]})})]})};var Hn=({data:e,color:t="var(--color-viz-default)",opacity:r=1,categoryColors:o={}})=>{let{xScale:n,yScale:a,animationSettings:i}=_o(),s=Me.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),b=a(p.yValue),x=a(0),v=Math.min(b,x),y=Math.abs(b-x),C=d[g+1],T=C?Math.abs(n(C.xValue)-f):m,P=p.category&&o[p.category]?o[p.category]:t;return jsxRuntime.jsx(shape.Bar,{x:f-T/2,y:v,width:T,height:y,fill:P,opacity:r,rx:1},p.xValue.getTime())})})})]})};var Mr=Dp(qg()),Xg=Dp(Zg());var U2=["top","left","transform","className","children","innerRef"];function pu(){return pu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);}return e},pu.apply(this,arguments)}function Y2(e,t){if(e==null)return {};var r={},o=Object.keys(e),n,a;for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&(r[n]=e[n]);return r}function za(e){var t=e.top,r=t===void 0?0:t,o=e.left,n=o===void 0?0:o,a=e.transform,i=e.className,s=e.children,c=e.innerRef,l=Y2(e,U2);return Me__namespace.default.createElement("g",pu({ref:c,className:(0, Xg.default)("visx-group",i),transform:a||"translate("+n+", "+r+")"},l),s)}za.propTypes={top:Mr.default.number,left:Mr.default.number,transform:Mr.default.string,className:Mr.default.string,children:Mr.default.node,innerRef:Mr.default.oneOfType([Mr.default.string,Mr.default.func,Mr.default.object])};var Ye={top:0,right:0,bottom:50,left:60};function qr(e={type:"number"}){let t=i=>{if(i==null)return "-";let s=Nr({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=Nr({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 mu=(e,t)=>{let r=d3Array.extent(e,o=>o.xValue);return scale.scaleTime({range:[Ye.left,t-Ye.right],domain:r,nice:true})},fu=(e,t,r)=>{let o=qr(r),n=d3Array.min(e,c=>c.yValue)||0,a=d3Array.max(e,c=>c.yValue)||0,i=o.min!==void 0?o.min:n>=0?0:n*1.1,s=o.max!==void 0?o.max:a<=0?0:a*1.1;return scale.scaleLinear({range:[t-Ye.bottom,Ye.top],domain:[i,s],nice:true})};function $2(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 Vs(e,t=12,r="system-ui"){return e.length===0?0:Math.max(...e.map(o=>$2(o,t,r)))}function Va(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Q2(e,t,r=12,o=false){if(!Va(t[0])||!Va(t[1]))return console.warn("ChartAxis: Invalid date in domain, skipping tick calculation"),[];let n=t[0].getTime(),i=t[1].getTime()-n;if(i===0||i<1e3)return [t[0]];let s=Gc({start:t[0],end:t[1]},{compact:o}),l=[t[0],new Date((t[0].getTime()+t[1].getTime())/2),t[1]].map(b=>s(b)),d=Vs(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]];for(let b=1;b<g-1;b++){let x=b/(g-1),v=n+i*x;f.push(new Date(v));}return f.push(t[1]),f}var _2=({top:e,scale:t,width:r})=>{let o=t.domain(),n=[o[0],o[o.length-1]],a=Va(n[0])&&Va(n[1]),i=r<400,s=a?n[0].getTime():0,c=a?n[1].getTime():0,l=Me.useMemo(()=>a?Gc({start:n[0],end:n[1]},{compact:i}):()=>"",[s,c,i,a]),d=Me.useMemo(()=>Q2(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 Va(m)?l(m):""},stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:(u,m,p)=>({fill:"var(--color-text-caption)",fontSize:12,textAnchor:m===0?"start":m===p.length-1?"end":"middle"}),rangePadding:0})};function Hs(e,t=12){let r=t*2.5,o=Math.floor(e/r);return Math.max(2,Math.min(6,o))}var ew=({left:e,scale:t,yFormatter:r,height:o})=>{let n=qr(r),a=Me.useMemo(()=>!o||o<=0?5:Hs(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:()=>({fill:"var(--color-text-caption)",fontSize:12,textAnchor:"end",dy:"0.33em"})})},tw=({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-caption)",fontSize:12,textAnchor:"middle",dy:"0.25em"})}),rw=({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-caption)",fontSize:12,textAnchor:"end",dx:"-0.25em",dy:"0.33em"})}),ow=({top:e,scale:t,yFormatter:r,width:o})=>{let n=qr(r),a=Me.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-caption)",fontSize:12,textAnchor:"middle",dy:"0.25em"})})},Ar={Bottom:_2,Left:ew,CategoryBottom:tw,CategoryLeft:rw,NumericBottom:ow};var Un=({data:e,formatter:t,label:r,categoryLabels:o})=>{if(!e)return null;let n=Me__namespace.default.useContext(Co),a=o??n?.categoryLabels,i=n?.xScale,s=qr(t),c=Me__namespace.default.useRef(null),[l,d]=Me__namespace.default.useState({x:0,y:0,translate:"translate(-50%, -100%)"});Me__namespace.default.useEffect(()=>{if(!c.current)return;let b=c.current.getBoundingClientRect(),x=window.innerHeight,v=window.innerWidth,y=e.x,C=e.y,T=e.position==="left"?"translate(calc(-100% - 16px), -50%)":"translate(16px, -50%)";e.position==="left"&&y-b.width-16<0?T="translate(16px, -50%)":e.position==="right"&&y+b.width+16>v&&(T="translate(calc(-100% - 16px), -50%)"),C-b.height/2<0?C=b.height/2:C+b.height/2>x&&(C=x-b.height/2),d({x:y,y:C,translate:T});},[e.x,e.y,e.position]);let u=i?.domain(),p=u&&u.length===2&&u.every(f=>f instanceof Date)?Om({start:u[0],end:u[1]}):null,g=r||(p&&e.xValue instanceof Date?p(e.xValue):String(e.xValue));return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,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:l.x,top:l.y,transform:l.translate},children:[jsxRuntime.jsx("div",{className:"mb-1 font-medium text-text-body",children:g}),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(f=>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-body",children:[f.label,":"]}),jsxRuntime.jsx("span",{className:"text-text-muted",children:s.format(f.value)})]}),f.category&&jsxRuntime.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-3 w-3",style:{backgroundColor:f.categoryColor||f.color,borderRadius:"1px"}}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:a?.[f.category]||f.category})]})]},f.label))}),(()=>{let f=e.series[e.series.length-1];return 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:f.color}}),jsxRuntime.jsx("span",{className:"font-medium text-text-body",children:f.label})]}),e.eventMetadata&&Object.keys(e.eventMetadata).length>0&&jsxRuntime.jsx("div",{className:"ml-4 mt-1 space-y-0.5 text-xs text-text-muted",children:Object.entries(e.eventMetadata).map(([b,x])=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"capitalize",children:[b,":"]}),jsxRuntime.jsx("span",{className:"font-medium",children:x})]},b))})]})})()]}):jsxRuntime.jsx("ul",{className:"list-none p-0",children:e.series.map(f=>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-body",children:[f.label,":"]}),jsxRuntime.jsx("span",{className:"text-text-muted",children:s.format(f.value)})]}),f.category&&jsxRuntime.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-3 w-3",style:{backgroundColor:f.categoryColor||f.color,borderRadius:"1px"}}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:a?.[f.category]||f.category})]})]},f.label))})]})})};var uw={top:20,right:20,bottom:50,left:60},ob=({data:e,width:t,height:r,margin:o=uw,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":b="Category bar chart",orientation:x="vertical",showTooltip:v=true})=>{let[y,C]=Me.useState(null),[T,P]=Me.useState(null),[R,L]=Me.useState(null),[D,A]=Me.useState(t??600),[V,M]=Me.useState(r??300),w=Me.useRef(null),N=p??y,z=Me.useId(),W=n||"var(--color-viz-default)";Me.useEffect(()=>{if(t!==void 0&&r!==void 0){A(t),M(r);return}if(!w.current)return;let k=new ResizeObserver(S=>{for(let B of S)t===void 0&&A(B.contentRect.width),r===void 0&&M(B.contentRect.height);});return k.observe(w.current),t===void 0&&A(w.current.offsetWidth),r===void 0&&M(w.current.offsetHeight||300),()=>{k.disconnect();}},[t,r]);let{xScale:F,yScale:K,innerWidth:X,innerHeight:G}=Me.useMemo(()=>{let k=D-o.left-o.right,S=V-o.top-o.bottom;if(x==="horizontal"){let E=d3Array.max(e,h=>h.value)||0;return {xScale:scale.scaleLinear({range:[0,k],domain:[0,E*1.1],nice:true}),yScale:scale.scaleBand({range:[0,S],domain:e.map(h=>h.label),padding:d}),innerWidth:k,innerHeight:S}}let B=d3Array.max(e,E=>E.value)||0;return {xScale:scale.scaleBand({range:[0,k],domain:e.map(E=>E.label),padding:d}),yScale:scale.scaleLinear({range:[S,0],domain:[0,B*1.1],nice:true}),innerWidth:k,innerHeight:S}},[e,D,V,o,d,x]);if(e.length===0)return jsxRuntime.jsx("div",{ref:w,className:tailwindMerge.twMerge("flex h-full min-h-[200px] w-full items-center justify-center rounded-lg border border-dashed border-gray-300 bg-background-surface text-sm font-medium text-text-muted dark:border-gray-700",g),style:r!==void 0?{height:r,...f}:f,children:"No data available"});let U=(k,S)=>{if(C(k),m?.(S,k),k!==null&&S){let B,E;if(x==="horizontal"){let O=F(S.value),H=K(S.label)||0,j=K.bandwidth();B=o.left+O,E=o.top+H+j/2;}else {let O=F,H=K,j=O(S.label)??0,oe=O.bandwidth(),me=H(S.value);B=o.left+j+oe/2,E=o.top+me;}let h=B>D/2;L(S.label),P({xValue:new Date,series:[{label:"Value",value:S.value,color:S.color||W}],x:B,y:E,position:h?"left":"right"});}else P(null),L(null);};return jsxRuntime.jsxs("div",{ref:w,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":b,role:"img",children:[jsxRuntime.jsxs("svg",{width:D,height:V,children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx(gradient.LinearGradient,{id:`${z}-bar`,from:W,to:W,toOpacity:.85})}),jsxRuntime.jsxs(za,{left:o.left,top:o.top,children:[i&&jsxRuntime.jsx("g",{className:"grid-lines",children:(x==="horizontal"?F.ticks(5):K.ticks(5)).map(k=>{let S=x==="horizontal"?0:K(k),B=x==="horizontal"?F(k):0;return jsxRuntime.jsx("line",{x1:x==="horizontal"?B:0,y1:x==="horizontal"?0:S,x2:x==="horizontal"?B:X,y2:x==="horizontal"?G:S,stroke:"var(--color-border-default)",strokeOpacity:.5,strokeDasharray:"2,3"},k)})}),e.map((k,S)=>{let B=N===S||N==null,E=k.color||`url(#${z}-bar)`;if(x==="horizontal"){let q=F(k.value),ne=K.bandwidth(),Te=K(k.label)||0;return jsxRuntime.jsx(framerMotion.motion.rect,{x:0,y:Te,width:q,height:ne,fill:E,rx:l,ry:l,initial:c?{width:0,opacity:.5}:void 0,animate:{width:q,opacity:B?1:.5},transition:{duration:.5,delay:S*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:u||m?"pointer":"default"},onMouseEnter:()=>U(S,k),onMouseLeave:()=>U(null,null),onClick:()=>u?.(k,S)},k.label)}let h=F,O=K,H=h.bandwidth(),j=h(k.label)??0,oe=O(k.value),me=Math.max(0,G-oe);return c?jsxRuntime.jsx(framerMotion.motion.rect,{x:j,width:H,fill:E,rx:l,ry:l,initial:{y:G,height:0,opacity:.5},animate:{y:oe,height:me,opacity:B?1:.5},transition:{duration:.5,delay:S*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:u||m?"pointer":"default"},onMouseEnter:()=>U(S,k),onMouseLeave:()=>U(null,null),onClick:()=>u?.(k,S)},k.label):jsxRuntime.jsx("rect",{x:j,y:oe,width:H,height:me,fill:E,rx:l,ry:l,opacity:B?1:.5,style:{cursor:u||m?"pointer":"default",transition:"opacity 150ms ease-out"},onMouseEnter:()=>U(S,k),onMouseLeave:()=>U(null,null),onClick:()=>u?.(k,S)},k.label)}),s&&x==="vertical"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ar.CategoryBottom,{top:G,scale:F}),jsxRuntime.jsx(Ar.Left,{left:0,scale:K,yFormatter:a,height:G})]}),s&&x==="horizontal"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ar.NumericBottom,{top:G,scale:F,yFormatter:a,width:X}),jsxRuntime.jsx(Ar.CategoryLeft,{left:0,scale:K})]})]})]}),v&&jsxRuntime.jsx(Un,{data:T,formatter:a,label:R??void 0})]})};var nb=({item:e})=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[jsxRuntime.jsx("div",{className:"h-3 w-3 shrink-0",style:{backgroundColor:e.fill,borderRadius:"1px"}}),jsxRuntime.jsx("span",{className:"text-sm text-text-caption whitespace-nowrap",children:e.category})]}),fw=({items:e})=>e.length===0?null:jsxRuntime.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:e.map(t=>jsxRuntime.jsx(nb,{item:t},t.category))}),Gs=({items:e,onExport:t,marginLeft:r=0,marginRight:o=0,isZoomed:n=false,onResetZoom:a})=>{let[i,s]=Me__namespace.default.useState(false),[c,l]=Me__namespace.default.useState(null),[d,u]=Me__namespace.default.useState(false),[m,p]=Me__namespace.default.useState(false),g=Me__namespace.default.useCallback(async b=>{s(true),l(b),p(false);try{await t(b);}catch(x){console.error("Export failed:",x);}finally{s(false),l(null);}},[t]),f=Me__namespace.default.useCallback(async b=>{await g(b);},[g]);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(fw,{items:e})}),jsxRuntime.jsx("div",{className:"sm:hidden flex items-center gap-3",children:e.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:()=>u(true),className:"text-sm text-text-muted hover:text-text-body transition-colors underline decoration-dotted underline-offset-4",children:"Legend"}),jsxRuntime.jsx(Xe,{isOpen:d,onClose:()=>u(false),title:"Legend",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-3 p-4",children:e.map(b=>jsxRuntime.jsx(nb,{item:b},b.category))})})]})}),jsxRuntime.jsxs("div",{className:"sm:hidden flex items-center gap-2 shrink-0",children:[n&&a&&jsxRuntime.jsx(Q,{variant:"secondary",size:"sm",onPress:a,children:jsxRuntime.jsx(I,{name:"ArrowsOut",size:16})}),jsxRuntime.jsx(Q,{variant:"secondary",size:"sm",onPress:()=>p(true),isDisabled:i,children:jsxRuntime.jsx(I,{name:"Export",size:16})}),jsxRuntime.jsx(Xe,{isOpen:m,onClose:()=>p(false),title:"Export Chart",contentPadding:false,children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("button",{onClick:()=>g("csv"),disabled:i,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(I,{name:"List",size:20,className:"text-text-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-body",children:c==="csv"?"Exporting...":"Export as CSV"})]}),jsxRuntime.jsxs("button",{onClick:()=>g("svg"),disabled:i,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(I,{name:"Code",size:20,className:"text-text-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-body",children:c==="svg"?"Exporting...":"Export as SVG"})]}),jsxRuntime.jsxs("button",{onClick:()=>g("png"),disabled:i,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(I,{name:"DownloadSimple",size:20,className:"text-text-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-body",children:c==="png"?"Exporting...":"Export as PNG"})]})]})})]}),jsxRuntime.jsxs("div",{className:"hidden sm:flex items-center gap-2 shrink-0",children:[n&&a&&jsxRuntime.jsxs(Q,{variant:"secondary",size:"sm",onPress:a,children:[jsxRuntime.jsx(I,{name:"ArrowsOut",size:16}),jsxRuntime.jsx("span",{className:"hidden sm:inline",children:"Reset Zoom"})]}),jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{children:[jsxRuntime.jsxs(Q,{variant:"secondary",size:"sm",isDisabled:i,children:[jsxRuntime.jsx(I,{name:"Export",size:16}),i?"Exporting...":"Export"]}),jsxRuntime.jsx(Ze,{placement:"top end",className:"min-w-48 p-1 bg-white dark:bg-gray-800 rounded-lg shadow-xl ring-1 ring-gray-200 dark:ring-gray-700",children:jsxRuntime.jsxs(reactAriaComponents.Menu,{onAction:f,className:"outline-none",children:[jsxRuntime.jsx(reactAriaComponents.MenuItem,{id:"csv",className:"flex items-center gap-2 px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 rounded cursor-pointer outline-none",isDisabled:i,children:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(I,{name:"List",size:14}),c==="csv"?"Exporting...":"Export as CSV"]})}),jsxRuntime.jsx(reactAriaComponents.MenuItem,{id:"svg",className:"flex items-center gap-2 px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 rounded cursor-pointer outline-none",isDisabled:i,children:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(I,{name:"Code",size:14}),c==="svg"?"Exporting...":"Export as SVG"]})}),jsxRuntime.jsx(reactAriaComponents.MenuItem,{id:"png",className:"flex items-center gap-2 px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 rounded cursor-pointer outline-none",isDisabled:i,children:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(I,{name:"DownloadSimple",size:14}),c==="png"?"Exporting...":"Export as PNG"]})})]})})]})]})]})};var bu=({data:e,seriesMetadata:t,width:r,height:o,onBrushChange:n,brushRegion:a,margin:i=Ye})=>{let s=Me.useRef(null),c=Me.useRef(false),l=Me.useMemo(()=>e.flat(),[e]),d=Me.useMemo(()=>({top:10,bottom:15,left:i.left,right:i.right}),[i]),u=r-d.left-d.right,m=Me.useMemo(()=>{if(l.length===0)return scale.scaleTime({domain:[new Date,new Date],range:[0,u]});let x=new Date(Math.min(...l.map(y=>y.xValue.getTime()))),v=new Date(Math.max(...l.map(y=>y.xValue.getTime())));return scale.scaleTime({domain:[x,v],range:[0,u]})},[l,u]),p=Me.useMemo(()=>{let x=l.length>0?Math.max(0,...l.map(v=>v.yValue)):1;return scale.scaleLinear({domain:[0,x],range:[o-d.bottom,d.top]})},[l,o]),g=x=>{if(c.current)return;if(!x){n(null);return}let{x0:v,x1:y}=x;if(v===y)return;let C=new Date(v),T=new Date(y);if(!(Number.isNaN(C.getTime())||Number.isNaN(T.getTime()))){if(l.length>0){let P=Math.min(...l.map(V=>V.xValue.getTime())),R=Math.max(...l.map(V=>V.xValue.getTime())),D=(R-P)*.05;if(Math.abs(C.getTime()-P)<D&&Math.abs(T.getTime()-R)<D){n(null);return}}n([C,T]);}},f=Me.useMemo(()=>{if(l.length!==0)return {start:{x:0,y:d.top},end:{x:u,y:o-d.bottom}}},[u,o,l]);Me.useEffect(()=>{if(!s.current||l.length===0)return;let x=s.current.state;if(x?.isBrushing||x?.activeHandle)return;let v=Math.min(...l.map(L=>L.xValue.getTime())),y=Math.max(...l.map(L=>L.xValue.getTime())),C=a?a[0]:new Date(v),T=a?a[1]:new Date(y),P=s.current.state?.extent;if(P){let L=m.invert(P.x0),D=m.invert(P.x1),A=Math.abs(L.getTime()-C.getTime()),V=Math.abs(D.getTime()-T.getTime());if(A<1e3&&V<1e3)return}c.current=true;let R=L=>{let D=s.current.getExtent({x:m(C),y:d.top},{x:m(T),y:o-d.bottom});return {...L,start:{y:D.y0,x:D.x0},end:{y:D.y1,x:D.x1},extent:D}};s.current.updateBrush(R),setTimeout(()=>{c.current=false;},50);},[a,m,o,l]);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-muted)",strokeWidth:1,orientation:["diagonal"]}),jsxRuntime.jsxs("g",{transform:`translate(${d.left}, 0)`,children:[e.map((x,v)=>jsxRuntime.jsx(shape.LinePath,{data:x,x:y=>m(y.xValue),y:y=>p(y.yValue),stroke:t[v]?.color||"var(--color-gray-500)",strokeWidth:1.5,opacity:.8},`brush-series-${v}`)),jsxRuntime.jsx(brush.Brush,{xScale:m,yScale:p,width:u,height:o-d.top-d.bottom,margin:{top:d.top,bottom:d.bottom,left:0,right:0},handleSize:8,innerRef:s,resizeTriggerAreas:["left","right"],brushDirection:"horizontal",initialBrushPosition:f,onChange:g,onClick:()=>n(null),selectedBoxStyle:b,useWindowMoveEvents:true})]})]})})};function cb(e){switch(e){case "command":return mt("--color-action-primary","#3b82f6");case "success":return mt("--color-feedback-success","#10b981");case "warning":return mt("--color-feedback-warning","#f59e0b");case "error":return mt("--color-feedback-error","#ef4444");case "alert":return mt("--color-feedback-warning","#f59e0b");default:return mt("--color-action-secondary","#6b7280")}}function Ys({events:e,color:t,showLabels:r=false}){let o=Me.useContext(Co),[n,a]=Me.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(x=>{let v=i(x.timestamp);return v>=Ye.left&&v<=i.range()[1]}),f=Me.useCallback((x,v)=>{a(v);let y=i(x.timestamp),C=y>(i.range()[1]-Ye.right-Ye.left)/2+Ye.left,T=[];d&&u&&d.forEach((P,R)=>{if(P.length===0)return;let L=d3Array.bisector(w=>w.xValue).left,D=L(P,x.timestamp),A=P[D-1],V=P[D],M;if(!A)M=V;else if(!V)M=A;else {let w=Math.abs(x.timestamp.getTime()-A.xValue.getTime()),N=Math.abs(x.timestamp.getTime()-V.xValue.getTime());M=w<N?A:V;}M&&u[R]&&T.push({label:u[R].label,value:M.yValue,color:u[R].color,type:m?.[R]||"line",...M.category&&{category:M.category,categoryColor:p?.[M.category]}});}),T.push({label:x.label,value:0,color:t||cb(x.type),type:"event"}),l.show({xValue:x.timestamp,series:T,x:y,y:T.length>1&&typeof T[0].value=="number"?s(T[0].value):c/2,position:C?"left":"right",isEvent:true,eventMetadata:x.metadata});},[i,s,c,l,t,d,u,m,p]),b=Me.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((x,v)=>{let y=i(x.timestamp),C=t||cb(x.type),T=n===v;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:y,y1:Ye.top,x2:y,y2:c-Ye.bottom,stroke:C,strokeWidth:T?3:2,strokeDasharray:"4 4",strokeOpacity:T?.9:.6,pointerEvents:"none"}),jsxRuntime.jsx("circle",{cx:y,cy:Ye.top,r:T?5:4,fill:C,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),jsxRuntime.jsx("circle",{cx:y,cy:c-Ye.bottom,r:T?5:4,fill:C,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),r&&jsxRuntime.jsx("text",{x:y,y:Ye.top-8,textAnchor:"middle",fill:"var(--color-text-caption)",fontSize:11,fontWeight:500,pointerEvents:"none",children:x.label}),jsxRuntime.jsx("rect",{x:y-10,y:Ye.top,width:20,height:c-Ye.top-Ye.bottom,fill:"transparent",style:{cursor:"pointer"},onMouseEnter:()=>f(x,v),onMouseLeave:b})]},`${x.timestamp.getTime()}-${v}`)})})}var Ya=({data:e,color:t="var(--color-viz-default)",strokeWidth:r=3,strokeDasharray:o})=>{let{xScale:n,yScale:a,animationSettings:i}=_o(),s=a.range();return jsxRuntime.jsx(framerMotion.motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:i.duration,ease:i.ease},style:{transformOrigin:`0 ${s[0]}px`,transformBox:"fill-box",isolation:"isolate"},children:jsxRuntime.jsx(shape.LinePath,{data:e,x:c=>n(c.xValue),y:c=>a(c.yValue),stroke:t,strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",curve:curve.curveLinear})})};var fb=e=>e.type===Ba||e.type===Ya||e.type===Hn,Fw=e=>e.type===Ys,Bw=d3Array.bisector(e=>e.xValue).left,zw=()=>jsxRuntime.jsx("div",{className:"flex h-full items-center justify-center",children:jsxRuntime.jsx("p",{className:"text-gray-500",children:"No data available"})}),Vw=()=>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"})]})]}),Ow=({parentWidth:e,parentHeight:t,yFormatter:r={type:"number"},isLoading:o=false,enableZoom:n=false,enableBrush:a=false,brushHeight:i=60,onZoomChange:s,children:c})=>{let[l,d]=Me.useState(null),[u,m]=Me.useState(null),p=Me.useRef(null),g=Me.useRef(0),f=Me.useRef(""),b=Me.useRef(null),{colorMode:x}=Rt(),v=Me.useMemo(()=>fa(),[x]),y=Me.useMemo(()=>Bc(),[x]),{datasets:C,seriesMetadata:T,categoryInfo:P,categoryColors:R,categoryLabels:L,hasBarSeries:D,firstBarSeriesIndex:A,seriesTypes:V}=Me.useMemo(()=>{let se=Me.Children.toArray(c).filter(ee=>Me.isValidElement(ee)&&fb(ee)),Ne=se.filter(ee=>ee.props.data).length,ze=se.some(ee=>ee.type===Hn),De=[],te=[],ce=[],_=null,Z=null,Y=null;se.forEach((ee,xe)=>{let he=ee.props;if(!he.data)return;De.push(he.data);let Lo=("color"in he&&he.color?he.color:void 0)||(Ne===1?y:v[xe%v.length]);te.push({label:"label"in he&&he.label||`Series ${De.length}`,color:Lo});let Sr=ee.type===Ba?"area":ee.type===Ya?"line":"bar";ce.push(Sr),"categoryColors"in he&&he.categoryColors&&(_=he.categoryColors),"categoryLabels"in he&&he.categoryLabels&&(Z=he.categoryLabels),ee.type===Hn&&Y===null&&(Y=De.length-1);});let ae=null;if(_){let ee=new Set;De.forEach(xe=>{xe.forEach(he=>{he.category&&ee.add(he.category);});}),ae=Array.from(ee).map(xe=>({label:Z?.[xe]||xe,color:_[xe]||"#6b7280"}));}return {datasets:De,seriesMetadata:te,categoryInfo:ae,categoryColors:_,categoryLabels:Z,hasBarSeries:ze,firstBarSeriesIndex:Y,seriesTypes:ce}},[c,y,v,x]),M=e,w=a?i+8:0,N=t-60-w,z=Math.max(100,N),W=Me.useMemo(()=>C.flat(),[C]),F=Me.useMemo(()=>{if(W.length===0)return null;let $=[...W].sort((se,Ne)=>se.xValue.getTime()-Ne.xValue.getTime());return [$[0].xValue,$[$.length-1].xValue]},[W]),K=u||F,X=Me.useMemo(()=>K?C.map(se=>se.filter(Ne=>Ne.xValue>=K[0]&&Ne.xValue<=K[1])):C,[C,K]);Me.useEffect(()=>{s&&s(u);},[u,s]);let G=Me.useMemo(()=>X.flat(),[X]),U=Me.useMemo(()=>fu(G,z,r),[G,z,r]),k=Me.useMemo(()=>{let $=z-Ye.top-Ye.bottom;return Hs($)},[z]),S=Me.useMemo(()=>{let $=qr(r),se=$.tickFormat||$.format,ze=U.ticks(k).map(ce=>se(ce)),De=Vs(ze,12,"system-ui"),te=Math.ceil(De)+12;return {...Ye,left:Math.max(te,30)}},[U,r,k]),B=Me.useMemo(()=>K?scale.scaleTime({domain:K,range:[S.left,M-S.right]}):mu(W,M),[K,W,M,S]),E=Me.useCallback($=>{if(!F)return;let{scaleX:se,translateX:Ne}=$,ze=M-S.left-S.right,[De,te]=F,ce=te.getTime()-De.getTime();if(ce<=0){m(null);return}let _=-Ne,Z=_+ze,Y=ze*se/ce,ae=_/Y,ee=Z/Y,xe=new Date(De.getTime()+ae),he=new Date(De.getTime()+ee),at=Math.abs(xe.getTime()-De.getTime()),Lo=Math.abs(he.getTime()-te.getTime()),Sr=ce*.02;at<Sr&&Lo<Sr?m(null):m([xe,he]);},[F,M,S]),h=Me.useCallback($=>{let{left:se}=p.current?.getBoundingClientRect()||{left:0},Ne=$.clientX-se;if($.timeStamp-(g.current||0)<16)return;g.current=$.timeStamp;let ze=B.invert(Ne),De=C.map((_,Z)=>{if(!_||_.length===0)return null;let Y=Bw(_,ze,1);if(Y===0)return {point:_[0],datasetIndex:Z};if(Y>=_.length)return {point:_[_.length-1],datasetIndex:Z};let ae=_[Y-1],ee=_[Y];if(!ae||!ee)return null;let xe=Math.abs(ae.xValue.getTime()-ze.getTime()),he=Math.abs(ee.xValue.getTime()-ze.getTime());return {point:xe<he?ae:ee,datasetIndex:Z}}).filter(_=>_!==null&&T[_.datasetIndex]!==void 0).map(({point:_,datasetIndex:Z})=>({label:T[Z].label,value:_.yValue,color:T[Z].color,point:_,type:V[Z]}));if(De.length===0){d(null);return}let te=B(De[0].point.xValue),ce=te>(M-S.right-S.left)/2+S.left;d({xValue:De[0].point.xValue,series:De.map(({label:_,value:Z,color:Y,point:ae,type:ee})=>({label:_,value:Z,color:Y,type:ee,category:ae.category,categoryColor:ae.category&&R?R[ae.category]:void 0})),x:te,y:U(De[0].value),position:ce?"left":"right"});},[C,X,T,V,B,U,M,R,S]),O=()=>{d(null);},H=Me.useCallback(()=>{m(null),b.current&&b.current.reset();},[]),j=Me.useCallback($=>{if(m($),b.current&&F){let[se,Ne]=F,ze=Ne.getTime()-se.getTime();if(ze<=0){b.current.reset();return}if(!$)b.current.reset();else {let[De,te]=$,ce=te.getTime()-De.getTime();if(ce<=0){b.current.reset();return}let _=ze/ce,Z=M-S.left-S.right,ae=-((De.getTime()-se.getTime())/ze)*Z*_;b.current.setTransformMatrix({scaleX:_,scaleY:1,translateX:ae,translateY:0,skewX:0,skewY:0});}}},[F,M,S]),oe={width:M,height:z,xScale:B,yScale:U,yFormatter:r,animationSettings:wg,tooltip:{data:l,show:d,hide:()=>d(null)},datasets:X,seriesMetadata:T,seriesTypes:V,categoryColors:R||void 0,categoryLabels:L||void 0},me=Me.Children.toArray(c),q=0,ne=[],Te=[];me.forEach($=>{if(!Me.isValidElement($)){ne.push($);return}if(Fw($))Te.push($);else if(fb($)){let se=q;q++;let Ne=$.props;ne.push(Me__namespace.default.cloneElement($,{...Ne,data:X[se]||Ne.data,color:T[se]?.color}));}else ne.push($);});let ie=(P||T).map($=>({category:$.label,fill:$.color})),ue=Lp({datasets:C,metadata:{xLabel:"Date",yLabel:"Value",seriesLabels:T.map($=>$.label),timestamp:true},svgRef:p});if(o)return jsxRuntime.jsx(Vw,{});if(C.length===0)return jsxRuntime.jsx(zw,{});let ge=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("title",{children:"Data chart visualization"}),jsxRuntime.jsx("g",{children:U.ticks(k).map($=>jsxRuntime.jsx(shape.Line,{from:{x:S.left,y:U($)},to:{x:M-S.right,y:U($)},stroke:"var(--color-border-muted)",strokeWidth:1},`grid-line-${$}`))}),ne,jsxRuntime.jsx(Ar.Bottom,{top:z-S.bottom,scale:B,width:M-S.left-S.right}),jsxRuntime.jsx(Ar.Left,{left:S.left,scale:U,yFormatter:r,height:z-S.top-S.bottom}),l&&!l.isEvent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D&&A!==null?(()=>{let $=X[A]??[];if($.length===0)return null;let se=[...$].sort((Y,ae)=>Y.xValue.getTime()-ae.xValue.getTime()),Ne=se.findIndex(Y=>Y.xValue.getTime()===l.xValue.getTime()),ze=se[Ne+1],De=se.length>1&&ze?ze.xValue.getTime()-l.xValue.getTime():15*6e4,te=Math.abs(B(new Date(l.xValue.getTime()+De))-B(l.xValue)),_=B(l.xValue)-te/2,Z=U.range();return jsxRuntime.jsx("rect",{x:_,y:Z[1],width:te,height:Z[0]-Z[1],className:"fill-background-muted",opacity:.5,pointerEvents:"none",style:{transition:"all 100ms ease-out"}})})():null,l.series.filter($=>$.type!=="bar").map($=>jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:B(l.xValue),cy:U($.value),r:8,fill:"white",stroke:$.color,strokeWidth:2,style:{transition:"all 100ms ease-out"}}),jsxRuntime.jsx("circle",{cx:B(l.xValue),cy:U($.value),r:4,fill:$.color,style:{transition:"all 100ms ease-out"}})]},`highlight-${$.label}`))]}),jsxRuntime.jsx("rect",{x:S.left,y:S.top,width:M-S.left-S.right,height:z-S.top-S.bottom,fill:"transparent",style:{cursor:n?"grab":"crosshair"},onMouseMove:h,onMouseLeave:O}),Te]});return jsxRuntime.jsx("div",{className:"relative flex h-full flex-col",children:jsxRuntime.jsxs(Co.Provider,{value:oe,children:[n?jsxRuntime.jsx(zoom.Zoom,{width:M,height:z,scaleXMin:1,scaleXMax:20,scaleYMin:1,scaleYMax:1,constrain:$=>{let{scaleX:se,translateX:Ne}=$,ze=Math.max(1,Math.min(20,se)),De=1,te=M-S.left-S.right,ce=0,_=te*(1-ze),Z=Math.max(_,Math.min(ce,Ne));return {...$,scaleX:ze,scaleY:De,translateX:Z,translateY:0}},children:$=>{if(b.current=$,$.transformMatrix){let{scaleX:se,translateX:Ne}=$.transformMatrix,ze=`${se.toFixed(4)}-${Ne.toFixed(2)}`;ze!==f.current&&(f.current=ze,setTimeout(()=>{E($.transformMatrix);},0));}return jsxRuntime.jsx("svg",{width:M,height:z,className:"overflow-visible",ref:se=>{p.current=se,$.containerRef.current!==se&&($.containerRef.current=se);},role:"img","aria-label":"Data chart",style:{cursor:$.isDragging?"grabbing":"grab",touchAction:"none"},onMouseDown:$.dragStart,onMouseMove:$.dragMove,onMouseUp:$.dragEnd,onMouseLeave:()=>{$.isDragging&&$.dragEnd();},onTouchStart:$.dragStart,onTouchMove:$.dragMove,onTouchEnd:$.dragEnd,children:ge})}}):jsxRuntime.jsx("svg",{width:M,height:z,className:"overflow-visible",ref:p,role:"img","aria-label":"Data chart",children:ge}),jsxRuntime.jsx(Un,{data:l,formatter:r}),a&&F&&jsxRuntime.jsx(bu,{data:C,seriesMetadata:T,width:M,height:i,onBrushChange:j,brushRegion:u,margin:S}),jsxRuntime.jsx(Gs,{onExport:ue,items:ie,marginLeft:0,marginRight:S.right,isZoomed:u!==null,onResetZoom:H})]})})},bb=responsive.withParentSize(Ow);var Kw=e=>e.toLocaleString(),Jw=e=>`${Math.round(e*100)}%`,vb=({data:e,width:t=800,height:r=400,padding:o=0,barGap:n=30,formatValue:a=Kw,formatPercentage:i=Jw,color:s,showScale:c=true,showOverallConversion:l=true,overallConversionLabel:d="Overall Conversion:",activeStageId:u,onStageClick:m,onStageHover:p,className:g,style:f,"aria-label":b="Funnel chart"})=>{let[x,v]=Me.useState(null),[y,C]=Me.useState(t),T=Me.useRef(null),P=u??x,R=Me.useId(),L=s||"var(--color-viz-default)";Me.useEffect(()=>{if(!T.current)return;let N=new ResizeObserver(z=>{for(let W of z)C(W.contentRect.width);});return N.observe(T.current),()=>{N.disconnect();}},[]);let{layout:D,overallConversion:A}=Me.useMemo(()=>{if(e.length===0)return {layout:[],overallConversion:0};let N=e[0].value,z=l?60:0,W=r-o*2-z,F=(e.length-1)*n,K=(W-F)/e.length,X=e.map((U,k)=>{let S=o+z+k*(K+n),B=N===0?0:U.value/N,E=B,h=k===0?null:e[k-1].value,O=h==null||h===0?0:1-U.value/h;return {stage:U,index:k,y:S,barHeight:K,widthPercent:B,conversionRate:E,dropOff:O}}),G=N===0?0:e[e.length-1].value/N;return {layout:X,overallConversion:G,maxValue:N}},[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-gray-300 bg-background-surface text-sm font-medium text-text-muted dark:border-gray-700",g),style:{width:t,height:r,...f},children:"No funnel data available"});let V=c?60:0,M=o+V,w=y-o*2-V;return jsxRuntime.jsx("div",{ref:T,className:tailwindMerge.twMerge("relative w-full overflow-hidden rounded-lg bg-background-surface",g),style:{height:r,...f},"aria-label":b,role:"img",children:jsxRuntime.jsxs("svg",{width:"100%",height:r,className:"relative",children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx(gradient.LinearGradient,{id:`${R}-bar`,from:L,to:L,toOpacity:.85}),jsxRuntime.jsx(gradient.LinearGradient,{id:`${R}-bg`,from:L,to:L,fromOpacity:.01,toOpacity:.15,x1:"0",y1:"0",x2:"1",y2:"0"})]}),l&&jsxRuntime.jsxs("text",{x:M,y:o+20,className:"fill-text-body text-sm font-medium",children:[jsxRuntime.jsx("tspan",{className:"fill-text-muted",children:d})," ",i(A)]}),c&&jsxRuntime.jsx("g",{children:D.map(N=>{let z=N.y+N.barHeight/2;return jsxRuntime.jsx("text",{x:o+V-12,y:z,textAnchor:"end",dominantBaseline:"middle",className:"fill-text-caption text-xs",children:i(N.conversionRate)},N.stage.id)})}),D.map(N=>{let z=P===N.stage.id,W=w*N.widthPercent;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:M,y:N.y,width:w,height:N.barHeight,fill:`url(#${R}-bg)`,rx:4}),jsxRuntime.jsx(framerMotion.motion.rect,{x:M,y:N.y,width:W,height:N.barHeight,fill:`url(#${R}-bar)`,rx:4,initial:{width:0},animate:{width:W},transition:{duration:.6,delay:N.index*.1,ease:"easeOut"},opacity:z||P==null?1:.5,style:{cursor:m||p?"pointer":"default",transition:"opacity 150ms ease"},onMouseEnter:()=>{v(N.stage.id),p?.(N.stage);},onMouseLeave:()=>{v(null),p?.(null);},onClick:()=>m?.(N.stage)}),jsxRuntime.jsx("rect",{x:M+10,y:N.y+N.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:M+16,y:N.y+N.barHeight/2+4,className:"fill-text-heading text-xs font-semibold",style:{pointerEvents:"none"},children:a(N.stage.value)}),jsxRuntime.jsxs("text",{x:M,y:N.y-8,className:"fill-text-muted text-xs",style:{pointerEvents:"none"},children:[jsxRuntime.jsx("tspan",{children:N.index+1})," ",N.stage.label]}),N.stage.secondaryValue&&jsxRuntime.jsx("text",{x:M+16,y:N.y-24,className:"fill-text-muted text-xs",style:{pointerEvents:"none"},children:N.stage.secondaryValue}),N.index>0&&N.dropOff>0&&jsxRuntime.jsxs("text",{x:M+w,y:N.y-8,textAnchor:"end",className:"fill-text-muted text-xs",children:[i(N.dropOff)," drop"]}),N.stage.annotation&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:M+W+8,y:N.y+8,width:60,height:24,rx:3,className:"fill-background-muted"}),jsxRuntime.jsx("text",{x:M+W+16,y:N.y+20,className:"fill-text-caption text-xs font-medium",children:N.stage.annotation})]})]},N.stage.id)})]})})};function jw(e,t,r){return {field:e,operator:t,value:r}}function qw(e,t="AND"){return {logic:t,conditions:e}}function Ka(){return {logic:"AND",conditions:[]}}function js(e){return !e||e.conditions.length===0?true:e.conditions.every(t=>"conditions"in t?js(t):false)}function Zw(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(x=>String(x.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":">",b=g.operator==="lte"?"\u2264":"<";a.push({id:`${i}-range`,label:l,value:`${f} ${p.value} and ${b} ${g.value}`});}else for(let f of u){let b;f.operator==="gte"?b="\u2265":f.operator==="gt"?b=">":f.operator==="lte"?b="\u2264":b="<",a.push({id:`${i}-${f.operator}`,label:l,value:`${b} ${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 So(e,t){let r=e||Ka();return {...r,conditions:[...r.conditions,t]}}function rn(e,t){if(!e)return Ka();let r=e.conditions.filter(o=>"conditions"in o?rn(o,t).conditions.length>0:o.field!==t);return {...e,conditions:r}}function on(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 Ja({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-muted whitespace-nowrap ${o}`,children:[e.toLocaleString()," ",a]})}var eN=e=>{let t=xt({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),r=[e.showSearchIcon?"pl-8":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return tailwindMerge.twMerge(t,r,e.className)};function ar({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[b,x]=Me__namespace.default.useState(false),{isFocused:v,handleFocus:y,handleBlur:C}=nr(),T=d==="password",P=Pi(p,300);return jsxRuntime.jsx(reactAriaComponents.TextField,{...f,isRequired:a,className:Ce(f.className,"group flex flex-col"),children:({isDisabled:R,isInvalid:L})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(Ee,{size:o,tooltip:n,description:g==="tooltip"||g==="inline"?t:void 0,descriptionPlacement:g,isRequired:a,children:e}),jsxRuntime.jsxs(ot,{children:[s&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-2 top-[45%] -translate-y-1/2 transform flex items-center z-10",children:P?jsxRuntime.jsx(Gr,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(I,{name:"MagnifyingGlass",className:`h-4 w-4 transition-colors ${v?"text-action-brand":"text-text-muted"}`})}),jsxRuntime.jsx(cs,{size:o,disabled:R,type:T?b?"text":"password":d,value:f.value,defaultValue:f.defaultValue,placeholder:f.placeholder,onFocus:D=>y(D,f.onFocus),onBlur:D=>C(D,f.onBlur),onChange:D=>f.onChange?.(D.target.value),className:eN({isInvalid:L,isDisabled:R,isFocused:v,size:o,transparent:i,showSearchIcon:s,isClearable:c,hasValue:!!f.value,isPassword:T,className:typeof f.className=="string"?f.className:void 0})}),c&&f.value&&!R&&jsxRuntime.jsx(Da,{onClick:()=>{l?l():f.onChange&&f.onChange("");},size:o}),T&&!R&&jsxRuntime.jsx("button",{type:"button",onClick:()=>x(!b),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":b?"Hide password":"Show password",onMouseDown:D=>{D.preventDefault(),D.stopPropagation();},children:jsxRuntime.jsx(I,{name:b?"EyeSlash":"Eye",size:o==="sm"?16:20,className:"text-text-body"})})]}),m?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsxRuntime.jsx(pe,{size:o,children:r}):typeof r=="function"&&u?jsxRuntime.jsx(pe,{size:o,children:r(u)}):t&&g==="below"?jsxRuntime.jsx(Se,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&u?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r(u)}):t&&g==="below"?jsxRuntime.jsx(Se,{size:o,className:"mt-1",children:t}):null})]})})}function nn({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(ar,{value:e,onChange:t,placeholder:o,showSearchIcon:true,isClearable:!!e&&!!r,onClear:r,size:n,"aria-label":o,reserveErrorSpace:false,isLoading:i})})}function ja({value:e,options:t,onChange:r,direction:o,onDirectionChange:n,showLabel:a=true,size:i="sm",className:s="",compact:c=false}){let[l,d]=Me.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(Q,{variant:"secondary",size:i,icon:"ArrowsDownUp","aria-label":`Sort by: ${m?.label||"Select"}`,onPress:()=>d(true)}),jsxRuntime.jsx(Xe,{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(Mt,{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-muted whitespace-nowrap",children:"Sort by:"}),jsxRuntime.jsx(Ko,{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(Q,{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 Tb({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:b,stickyTop:x="0",zIndex:v=10,className:y="",style:C}){let T=r.length>0;if(!(e||T||a||c||l||d||u||m||p||g||i))return null;let R=b?"sticky bg-background-surface":"",L=b?{top:x,zIndex:v}:{};return jsxRuntime.jsxs("div",{className:`@container flex flex-col gap-3 bg-background-surface py-3 border-b border-border-default ${R} ${y}`,style:{...C,...L},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(Ja,{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(ja,{value:c.value,options:c.options,onChange:c.onChange,showLabel:c.showLabel,direction:c.direction,onDirectionChange:c.onDirectionChange}),u?jsxRuntime.jsx(Q,{variant:"secondary",size:"sm",icon:"Columns",onClick:u,children:"Columns"}):m,T&&o&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.slice(0,s).map(D=>jsxRuntime.jsxs(Er,{variant:"brand",size:"sm",onRemove:()=>o(D.id),isRemovable:true,children:[D.label,": ",D.value]},D.id)),r.length>s&&a&&jsxRuntime.jsxs(Q,{variant:"ghost",size:"sm",onClick:a,className:"text-text-muted hover:text-text-body whitespace-nowrap",children:["+",r.length-s," more"]}),n&&jsxRuntime.jsx(Q,{variant:"ghost",size:"sm",onClick:n,className:"text-text-muted hover:text-text-body 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(D=>jsxRuntime.jsx(Q,{variant:D.variant||"secondary",size:"sm",icon:D.icon,onPress:D.onClick,isDisabled:D.disabled,children:D.label},D.id))}),e&&jsxRuntime.jsx("div",{className:"w-64",children:jsxRuntime.jsx(nn,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsxRuntime.jsx(Q,{variant:"secondary",size:"sm",icon:"Sliders",badgeNumber:r.length>0?r.length:void 0,onClick:a,children:"Filters"}),i&&jsxRuntime.jsx(Q,{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(Ln,{items:g.items.map(D=>({id:D.id,name:D.label,iconName:D.icon,variant:D.variant==="destructive"?"destructive":"default",disabled:D.disabled,onAction:D.onClick})),align:"left",size:"sm",children:jsxRuntime.jsx(Q,{variant:"secondary",size:"sm",icon:"DotsThreeVertical","aria-label":g.menuLabel||"Actions"})}),e&&jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsx(nn,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsxRuntime.jsx(Q,{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(Q,{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(Ja,{count:l.count,label:l.label,isLoading:l.isLoading})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:c&&jsxRuntime.jsx(ja,{value:c.value,options:c.options,onChange:c.onChange,showLabel:false,direction:c.direction,onDirectionChange:c.onDirectionChange,compact:f!=="desktop"})})]})]})]})}function kb({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(Q,{variant:"secondary",size:s,onClick:o,className:"whitespace-nowrap",children:[e.length," ",e.length===1?"filter":"filters"]}),b=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g&&jsxRuntime.jsx(Q,{variant:"secondary",size:s,icon:"Sliders",onClick:o,className:"whitespace-nowrap",children:"Filters"}),l&&d.map(v=>jsxRuntime.jsxs(Er,{variant:"secondary",size:s,onRemove:()=>t(v.id),isRemovable:true,children:[v.label,": ",v.value]},v.id)),l&&m&&o&&jsxRuntime.jsxs(Q,{variant:"ghost",size:s,onClick:o,className:"text-text-muted hover:text-text-body whitespace-nowrap",children:["+",u," more"]}),l&&r&&jsxRuntime.jsx(Q,{variant:"ghost",size:s,onClick:r,className:"text-text-muted hover:text-text-body whitespace-nowrap",children:"Clear all"})]}),x=a==="button"?f:b;return jsxRuntime.jsx("div",{className:`flex flex-wrap items-center gap-2 ${c}`,children:x})}function Rb({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]=Me.useState(false),f=b=>{m.onChange&&b&&m.onChange(b),g(false);};return jsxRuntime.jsxs(reactAriaComponents.DateField,{...m,isDisabled:i,isRequired:a,isInvalid:s,className:Ce(u,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(Ee,{size:o,tooltip:n,isRequired:a,children:e}),jsxRuntime.jsx(ot,{children:jsxRuntime.jsxs("div",{className:"relative w-full",children:[jsxRuntime.jsx(qa,{size:o,isDisabled:i,isInvalid:s,hasCalendar:c}),c&&!i&&jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:p,onOpenChange:g,children:[jsxRuntime.jsx(Q,{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-muted hover:text-text-body transition-colors","aria-label":"Open calendar",children:jsxRuntime.jsx(I,{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(Bn,{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(pe,{size:o,children:r}):typeof r=="function"&&d?jsxRuntime.jsx(pe,{size:o,children:r(d)}):t?jsxRuntime.jsx(Se,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof r=="string"?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&d?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:r(d)}):t?jsxRuntime.jsx(Se,{size:o,className:"mt-1",children:t}):null})]})}function fN({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-placeholder italic":"text-text-body",t?"text-text-disabled cursor-not-allowed":"cursor-text",!t&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function qa({size:e="md",isDisabled:t,isInvalid:r,hasCalendar:o,className:n,...a}){return jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(mo({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:fN({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||t,size:e})})})}function CN({selectionState:e,isDisabled:t}){let r=`${Oe} w-full h-full flex items-center justify-center rounded-sm forced-color-adjust-none font-semibold`,o={none:"text-text-body group-hover:bg-background-muted group-pressed:bg-background-muted",middle:["bg-gray-100 dark:bg-zinc-700 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600 forced-colors:group-hover:bg-[Highlight]","group-invalid:group-hover:bg-red-200 forced-colors:group-invalid:group-hover:bg-[Mark]","group-pressed:bg-gray-200 dark:group-pressed:bg-zinc-600 forced-colors:group-pressed:bg-[Highlight] forced-colors:text-[HighlightText]","group-invalid:group-pressed:bg-red-300 forced-colors:group-invalid:group-pressed:bg-[Mark]"].join(" "),cap:"bg-zinc-900 dark:bg-zinc-100 text-white dark:text-zinc-900 group-invalid:bg-red-600 forced-colors:bg-[Highlight] forced-colors:group-invalid:bg-[Mark] forced-colors:text-white"},n=t?"text-textFaint dark:text-zinc-600 forced-colors:text-textFaint font-light":"";return [r,o[e],n].filter(Boolean).join(" ")}function qn({errorMessage:e,...t}){return jsxRuntime.jsxs(reactAriaComponents.RangeCalendar,{...t,children:[jsxRuntime.jsx(hs,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"w-full border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(ys,{}),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-gray-300 invalid:selected:bg-red-100 forced-colors:selected:bg-[Highlight] forced-colors:selected:text-white 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:CN({selectionState:n&&(a||i)?"cap":n?"middle":"none",isDisabled:c}),children:o})})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function Xs({label:e,description:t,errorMessage:r,...o}){return jsxRuntime.jsxs(reactAriaComponents.DateRangePicker,{...o,className:Ce(o.className,"group flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(Ee,{children:e}),jsxRuntime.jsxs(If,{className:"w-auto min-w-[208px]",children:[jsxRuntime.jsx(qa,{slot:"start",className:"px-2 py-1.5 text-sm"}),jsxRuntime.jsx("span",{"aria-hidden":"true",className:"text-gray-800 group-disabled:text-gray-200 dark:text-zinc-200 group-disabled:dark:text-zinc-600 forced-colors:text-[ButtonText] group-disabled:forced-colors:text-[GrayText]",children:"\u2013"}),jsxRuntime.jsx(qa,{slot:"end",className:"flex-1 px-2 py-1.5 text-sm"}),jsxRuntime.jsx(Q,{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(Se,{children:t}),typeof r=="string"?jsxRuntime.jsx(pe,{children:r}):null,jsxRuntime.jsx(Ze,{children:jsxRuntime.jsx(qn,{})})]})}var DN=e=>{let t=xt({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 Za({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=Me.useId(),{isFocused:m,handleFocus:p,handleBlur:g}=nr();return jsxRuntime.jsx(reactAriaComponents.NumberField,{...d,id:u,isRequired:a,className:Ce(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:b})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsxRuntime.jsx(Ee,{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:v=>p(v,d.onFocus),onBlur:v=>g(v,d.onBlur),className:DN({isInvalid:b||!!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(I,{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(I,{name:"CaretDown",size:14})})]})]})}),c?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:r?jsxRuntime.jsx(pe,{size:o,children:typeof r=="function"?r(s):r}):t&&l==="below"?jsxRuntime.jsx(Se,{size:o,children:t}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:r?jsxRuntime.jsx(pe,{size:o,className:"mt-1",children:typeof r=="function"?r(s):r}):t&&l==="below"?jsxRuntime.jsx(Se,{size:o,className:"mt-1",children:t}):null})]})})}var Cu={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 AN({isSelected:e,isDisabled:t,variant:r="default",size:o="md"}){let n="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",a=Cu[o].track,i=Oe,s=r==="brand"?"focus-visible:outline-action-brand":"focus-visible:outline-action-default",c="";return e?r==="brand"?c="bg-action-brand forced-colors:!bg-[Highlight] group-pressed:bg-action-brand-hover":c="bg-action-default forced-colors:!bg-[Highlight] group-pressed:bg-action-default-hover":c="bg-gray-400 dark:bg-zinc-400 group-pressed:bg-gray-500 dark:group-pressed:bg-zinc-300",[n,a,i,s,c,t?"bg-gray-200 dark:bg-zinc-700 forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function LN({isSelected:e,isDisabled:t,size:r="md"}){let o="transform rounded-full bg-white dark:bg-zinc-900 outline-none shadow transition duration-200 ease-in-out",n=Cu[r].handle;return [o,n,e?"translate-x-[100%]":"translate-x-0",t?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function $s({children:e,variant:t="default",size:r="md",...o}){return jsxRuntime.jsx(reactAriaComponents.Switch,{...o,className:Ce(o.className,`group flex items-center gap-2 ${Cu[r].text} text-gray-800 transition disabled:text-gray-300 dark:text-zinc-200 dark:disabled:text-zinc-600 forced-colors:disabled:text-[GrayText]`),children:n=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:AN({...n,variant:t,size:r}),children:jsxRuntime.jsx("span",{className:LN({...n,size:r})})}),e]})})}function Ab(e){return new Intl.NumberFormat("en-US").format(e)}function Lb({isOpen:e,onClose:t,facetConfigs:r,facetCounts:o={},currentFilters:n,onApply:a,onClear:i,title:s="Filters",resultCount:c}){let[l,d]=Me.useState(n),[u,m]=Me.useState({}),[p,g]=Me.useState({}),[f,b]=Me.useState(null),{isMobile:x}=kt(),v=Me.useMemo(()=>r.some(h=>h.group),[r]),{groups:y,ungroupedFacets:C,facetsByGroup:T}=Me.useMemo(()=>{let h=new Set,O=[],H={};for(let j of r)j.group?(h.has(j.group)||(h.add(j.group),H[j.group]=[]),H[j.group].push(j)):O.push(j);return {groups:Array.from(h),ungroupedFacets:O,facetsByGroup:H}},[r]);Me.useEffect(()=>{e&&(d(n),m({}),g({}),b(!x&&y.length>0?y[0]:null));},[e,n,y,x]);let P=Me.useMemo(()=>!l||js(l)?0:on(l).length,[l]),R=()=>{a(l),t();},L=()=>{let h=Ka();d(h),i?i():a(h),t();},D=h=>{if(!l)return [];if(!on(l).includes(h))return [];let H=[];function j(oe){if(oe)for(let me of oe.conditions)"conditions"in me?j(me):me.field===h&&me.operator==="in"&&Array.isArray(me.value)&&H.push(...me.value.map(String));}return j(l),H},A=(h,O,H)=>{let j=rn(l,h);O!==void 0&&(j=So(j,{field:h,operator:"gte",value:O})),H!==void 0&&(j=So(j,{field:h,operator:"lte",value:H})),d(j);},V=h=>{if(!l)return;let O;function H(j){if(j)for(let oe of j.conditions)"conditions"in oe?H(oe):oe.field===h&&oe.operator==="eq"&&typeof oe.value=="boolean"&&(O=oe.value);}return H(l),O},M=(h,O)=>{let H=rn(l,h);O!==void 0&&(H=So(H,{field:h,operator:"eq",value:O})),d(H);},w=(h,O,H)=>{let j=rn(l,h);O&&(j=So(j,{field:h,operator:"gte",value:O.toString()})),H&&(j=So(j,{field:h,operator:"lte",value:H.toString()})),d(j);},N=h=>{let O=T[h]||[],H=l?on(l):[];return O.filter(j=>H.includes(j.field)).length},z="pr-9 bg-background-muted/50",W="border-t border-border-muted",F="text-sm font-medium text-brand-primary",K=h=>jsxRuntime.jsx("span",{className:F,children:h}),X=h=>{let O=o[h.field]||{},H=u[h.field]||"",j=[];h.values?j=h.values.map(q=>({value:String(q.value),label:q.label,count:O[String(q.value)]})):j=Object.entries(O).map(([q,ne])=>({value:q,label:q,count:ne}));let oe=j.length;if(H){let q=H.toLowerCase();j=j.filter(ne=>ne.label.toLowerCase().includes(q));}j.sort((q,ne)=>q.count!==void 0&&ne.count!==void 0&&ne.count!==q.count?ne.count-q.count:q.label.localeCompare(ne.label));let me=h.type||"string";if(me==="string"||!h.type){let q=D(h.field),ne=h.searchThreshold??10,Te=h.maxVisibleOptions??50,ie=p[h.field]??false,ue=ie||j.length<=Te?j:j.slice(0,Te),ge=j.length>Te&&!ie;return jsxRuntime.jsxs(xo,{id:h.field,children:[jsxRuntime.jsx(ho,{title:h.label,description:h.description,className:z,endContent:q.length>0?K(`${q.length} selected`):void 0}),jsxRuntime.jsx(yo,{className:W,children:jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 pb-4",children:[oe>ne&&jsxRuntime.jsx(nn,{value:H,onChange:$=>m(se=>({...se,[h.field]:$})),onClear:()=>m($=>({...$,[h.field]:""})),placeholder:`Search ${h.label.toLowerCase()}...`,size:"sm",className:"w-full !max-w-none pr-4"}),jsxRuntime.jsx(jd,{value:q,onChange:$=>{let se=rn(l,h.field);$.length>0&&(se=So(se,{field:h.field,operator:"in",value:$})),d(se);},children:jsxRuntime.jsx("div",{className:"space-y-1.5",children:ue.map($=>jsxRuntime.jsx("div",{className:"rounded-md py-2 pr-4 transition-colors hover:bg-background-hover",children:jsxRuntime.jsx(Zo,{value:$.value,children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-3 flex-1",children:[h.renderLabel?h.renderLabel($.value,$.label):jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-body",children:$.label}),$.count!==void 0&&jsxRuntime.jsx("span",{className:"text-xs font-medium text-text-muted tabular-nums",children:Ab($.count)})]})})},$.value))})}),ge&&jsxRuntime.jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxRuntime.jsxs(Q,{variant:"ghost",size:"sm",onPress:()=>g($=>({...$,[h.field]:true})),className:"w-full",children:["Show all ",j.length," options"]})}),ie&&j.length>Te&&jsxRuntime.jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxRuntime.jsx(Q,{variant:"ghost",size:"sm",onPress:()=>g($=>({...$,[h.field]:false})),className:"w-full",children:"Show less"})})]})})]},h.field)}if(me==="number"){let q,ne,Te=ue=>{if(ue)for(let ge of ue.conditions)"conditions"in ge?Te(ge):ge.field===h.field&&(ge.operator==="gte"&&typeof ge.value=="number"&&(q=ge.value),ge.operator==="lte"&&typeof ge.value=="number"&&(ne=ge.value));};Te(l);let ie=q!==void 0||ne!==void 0;return jsxRuntime.jsxs(xo,{id:h.field,children:[jsxRuntime.jsx(ho,{title:h.label,description:h.description,className:z,endContent:ie?K(q!==void 0&&ne!==void 0?`${q} - ${ne}`:q!==void 0?`\u2265 ${q}`:`\u2264 ${ne}`):void 0}),jsxRuntime.jsx(yo,{className:W,children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 pb-4",children:[jsxRuntime.jsx(Za,{label:"Min",value:q,onChange:ue=>A(h.field,ue,ne)},`${h.field}-min`),jsxRuntime.jsx(Za,{label:"Max",value:ne,onChange:ue=>A(h.field,q,ue)},`${h.field}-max`)]})})]},h.field)}if(me==="boolean"){let q=V(h.field);return jsxRuntime.jsxs(xo,{id:h.field,children:[jsxRuntime.jsx(ho,{title:h.label,description:h.description,className:z,endContent:q!==void 0?K(q?"Yes":"No"):void 0}),jsxRuntime.jsx(yo,{className:W,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-body",children:q!==void 0?q?"Enabled":"Disabled":"No filter applied"}),jsxRuntime.jsx($s,{size:"lg",isSelected:q??false,onChange:ne=>M(h.field,ne?true:void 0),children:q?"Yes":"No"})]})})]},h.field)}if(me==="date"){let q,ne,Te=se=>{if(se)for(let Ne of se.conditions)"conditions"in Ne?Te(Ne):Ne.field===h.field&&(Ne.operator==="gte"&&(q=String(Ne.value)),Ne.operator==="lte"&&(ne=String(Ne.value)));};Te(l);let ie=q!==void 0||ne!==void 0,ue=se=>{if(se)try{return /^\d{4}-\d{2}-\d{2}$/.test(se)?Ra(se):void 0}catch{return}},ge=ue(q),$=ue(ne);return jsxRuntime.jsxs(xo,{id:h.field,children:[jsxRuntime.jsx(ho,{title:h.label,description:h.description,className:z,endContent:ie?K("Date range selected"):void 0}),jsxRuntime.jsx(yo,{className:W,children:jsxRuntime.jsx("div",{className:"pt-4 pb-4",children:jsxRuntime.jsx(Xs,{label:"Date Range",value:ge&&$?{start:ge,end:$}:void 0,onChange:se=>{se?w(h.field,se.start,se.end):w(h.field,void 0,void 0);}})})})]},h.field)}return null},G=()=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[C.map(h=>{let H=(l?on(l):[]).includes(h.field);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(`__ungrouped__${h.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-body",children:h.label}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[H&&jsxRuntime.jsx("span",{className:F,children:"1 active"}),jsxRuntime.jsx(I,{name:"CaretRight",size:"sm",className:"text-text-muted"})]})]},h.field)}),y.map(h=>{let O=N(h);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(h),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-body",children:h}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[O>0&&jsxRuntime.jsxs("span",{className:F,children:[O," active"]}),jsxRuntime.jsx(I,{name:"CaretRight",size:"sm",className:"text-text-muted"})]})]},h)})]}),U=h=>{if(h.startsWith("__ungrouped__")){let H=h.replace("__ungrouped__",""),j=C.find(oe=>oe.field===H);return j?jsxRuntime.jsx(zn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[j.field],children:X(j)}):null}let O=T[h]||[];return O.length===0?null:jsxRuntime.jsx(zn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[O[0].field],children:O.map(H=>X(H))})},k=()=>{if(f){let h=f.startsWith("__ungrouped__")&&C.find(O=>O.field===f.replace("__ungrouped__",""))?.label||f;return jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(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(I,{name:"CaretLeft",size:"sm",className:"text-text-muted"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-text-body",children:h})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:U(f)})]})}return G()},S=()=>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:[C.map(h=>{let H=(l?on(l):[]).includes(h.field),j=f===`__ungrouped__${h.field}`;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(`__ungrouped__${h.field}`),className:`flex items-center justify-between w-full px-4 py-3 text-left border-b border-border-muted transition-colors ${j?"bg-brand-primary/10":"hover:bg-background-hover"}`,children:[jsxRuntime.jsx("span",{className:`text-sm truncate ${j?"font-semibold text-text-body":"font-medium text-text-body"}`,children:h.label}),H&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-brand-primary flex-shrink-0 ml-2"})]},h.field)}),y.map(h=>{let O=N(h),H=f===h;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(h),className:`flex items-center justify-between w-full px-4 py-3 text-left border-b border-border-muted transition-colors ${H?"bg-brand-primary/10":"hover:bg-background-hover"}`,children:[jsxRuntime.jsx("span",{className:`text-sm truncate ${H?"font-semibold text-text-body":"font-medium text-text-body"}`,children:h}),O>0&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-brand-primary flex-shrink-0 ml-2"})]},h)})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:f?U(f):jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-text-muted text-sm",children:"Select a category to view filters"})})]}),B=()=>jsxRuntime.jsx(zn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[r[0].field],children:r.map(h=>X(h))});return jsxRuntime.jsx(_t,{isOpen:e,onClose:t,title:v&&x&&f?f.startsWith("__ungrouped__")?C.find(h=>h.field===f.replace("__ungrouped__",""))?.label||s:f:P>0?`${s} (${P} active)`:s,hideCloseIcon:false,primaryAction:{label:"Apply filters",onPress:R,variant:"default"},secondaryAction:{label:"Clear all",onPress:L},maxWidth:v?"800px":"700px",height:"600px",mobileHeight:"85vh",contentPadding:false,footerContent:c!==void 0?jsxRuntime.jsxs("div",{className:"text-sm text-text-muted text-center",children:[jsxRuntime.jsx("span",{className:"font-semibold text-text-body",children:Ab(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-muted",children:"No filters available"})}):v?x?k():S():B()})}function wu(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 ir(e="normal",t){return tailwindMerge.twMerge({strong:"font-semibold text-text-body",high:"font-semibold text-text-body",normal:"text-text-body",low:"text-text-muted"}[e],t&&"hover:text-action-brand cursor-pointer transition-colors")}function ke(e="left",t){return tailwindMerge.twMerge("flex items-center gap-1 min-w-0 overflow-hidden",wu(e),t)}function el(e,t="\u2014"){return e==null||e===""?t:String(e)}var wo={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 Vt(e="normal"){return {strong:wo.lg,high:wo.lg,normal:wo.md,low:wo.sm}[e]}function ye(e,t){return typeof e=="function"?e(t):e}function Ib(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-green-100 text-green-800",error:"bg-red-100 text-red-800",warning:"bg-yellow-100 text-yellow-800",info:"bg-blue-100 text-blue-800",neutral:"bg-gray-100 text-gray-800"}[e])}function Fb(e){return e?"success":"neutral"}function tl(e,t=false){return t?e>0?"text-green-600":e<0?"text-red-600":"text-text-body":"text-text-body"}function Nu(e="hover",t="default"){let r={default:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",brand:"text-action-brand hover:text-action-brand-hover visited:text-action-brand",muted:"text-text-muted hover:text-text-muted visited:text-text-muted",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 Fr(e,t,r,o="hover",n="default",a,i){if(!t)return e;let s=typeof t=="function"&&r?t(r):t,c=Nu(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 Bb({row:e,context:t,actions:r,align:o="right",size:n="sm"}){let{isLoading:a}=t;if(a)return jsxRuntime.jsx(J,{className:wo.sm});let s=(typeof r=="function"?r(e):r).filter(l=>!ye(l.hidden,e));if(s.length===0)return null;let c=ke(o);return jsxRuntime.jsx("div",{className:c,children:s.map(l=>{let d=ye(l.disabled,e);return l.variant==="icon"||!l.label?jsxRuntime.jsx(Q,{variant:"icon",size:n,onPress:()=>{l.onClick(e);},isDisabled:d,"aria-label":l.label||l.id,children:jsxRuntime.jsx(I,{name:l.icon||"DotsThree",size:n==="sm"?16:20})},l.id):jsxRuntime.jsxs(Q,{variant:l.variant||"secondary",size:n,onPress:()=>{l.onClick(e);},isDisabled:d,children:[l.icon&&jsxRuntime.jsx(I,{name:l.icon,size:n==="sm"?14:16}),l.label]},l.id)})})}function Vb({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,b=(P,R)=>{if(!g||P.length<=g)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:P});let L=P.slice(0,g-1)+"\u2026";return jsxRuntime.jsx(Et,{content:R,children:jsxRuntime.jsx("span",{children:L})})};if(f)return jsxRuntime.jsx(J,{className:Vt("normal")});if(e==null||e==="")return jsxRuntime.jsx("div",{className:ke(d,"text-text-muted"),children:u});if(Array.isArray(e)&&e.length===0)return jsxRuntime.jsx("div",{className:ke(d,"text-text-muted"),children:u});let x=ke(d,m);if(Array.isArray(e)){let P=e.slice(0,p),R=e.slice(p),L=R.length>0;return jsxRuntime.jsx("div",{className:x,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[P.map((D,A)=>{let V=typeof o=="function"?o(D,t):o,M=typeof n=="function"?n(D,t):n!==void 0?n:String(D),w=typeof s=="function"?s(D,t):s,N=typeof l=="function"?l(D,t):l;return jsxRuntime.jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxRuntime.jsx(Je,{variant:V,size:a,shape:i,dot:w,dotPosition:c,dotPulse:N,children:b(M,M)})},A)}),L&&jsxRuntime.jsx(Et,{content:R.join(", "),children:jsxRuntime.jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxRuntime.jsxs(Je,{variant:"neutral",size:a,shape:i,children:["+",R.length]})})})]})})}let v=typeof o=="function"?o(e,t):o,y=typeof n=="function"?n(e,t):n!==void 0?n:String(e),C=typeof s=="function"?s(e,t):s,T=typeof l=="function"?l(e,t):l;return jsxRuntime.jsx("div",{className:x,children:jsxRuntime.jsx(Je,{variant:v,size:a,shape:i,dot:C,dotPosition:c,dotPulse:T,children:b(y,y)})})}function Ob({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:Vt(l)});let m=!!e;if(!m&&!s)return jsxRuntime.jsx("div",{className:ke(c,d)});let p=ke(c,d);switch(r){case "icon":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx(I,{name:m?a:i,size:16,className:m?"text-green-600":"text-gray-400"})});case "text":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx("span",{className:ir(l),children:m?o:n})});case "badge":return jsxRuntime.jsx("div",{className:p,children:jsxRuntime.jsx(Je,{variant:m?"success":"neutral",size:"sm",children:m?o:n})});default:return null}}function Wb({row:e,context:t,firstName:r,lastName:o,email:n,avatarUrl:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:d="default",showEmail:u=false,badge:m,emphasis:p="normal",align:g="left",className:f,piiEntity:b}){let{isLoading:x}=t,v=ye(r,e),y=ye(o,e),C=ye(n,e),T=ye(a,e),P=ye(c,e),R=typeof m=="function"?m(e):m,L=ye(b,e),D=ke(g,f);return jsxRuntime.jsx("div",{className:D,children:jsxRuntime.jsx(Ss,{firstName:v,lastName:y,email:C,avatarUrl:T,layout:i,size:s,href:P,LinkComponent:l,linkVariant:d,showEmail:u,badge:R,emphasis:p,isLoading:x,piiEntity:L})})}function Gb({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 Ub({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:Vt(s)});if(!e)return jsxRuntime.jsx("div",{className:ke(i,"text-text-muted"),children:a});let m=e instanceof Date?e:new Date(e);if(isNaN(m.getTime()))return jsxRuntime.jsx("div",{className:ke(i,"text-text-muted"),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=UN(m);break;case "custom":p=n?m.toLocaleString("en-US",n):m.toISOString();break;default:p=m.toLocaleDateString();}let g=ke(i,tailwindMerge.twMerge(ir(s),d)),f=ye(c,t);return f?jsxRuntime.jsx("div",{className:g,children:Fr(p,f,t,l)}):jsxRuntime.jsx("div",{className:g,children:p})}function UN(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 rl({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}){let[f,b]=Me.useState(false),x=o||(r?KN(r):"DeviceMobile"),y={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],C=n&&!f&&u,P={strong:"font-semibold text-text-body",high:"font-semibold text-text-body",normal:"text-text-body",low:"text-text-muted"}[m],R=({children:L,className:D})=>s?c?jsxRuntime.jsx(c,{href:s,className:D,children:L}):jsxRuntime.jsx(Ue,{href:s,variant:l,className:tailwindMerge.twMerge("hover:underline",D),asButton:false,children:L}):jsxRuntime.jsx("span",{className:D,children:L});if(p)return a==="inline"?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",y.gap,g),children:[jsxRuntime.jsx(J,{width:y.skeletonIcon,height:y.skeletonIcon,className:"flex-shrink-0 rounded"}),jsxRuntime.jsx(J,{width:y.skeletonText,height:y.skeletonIcon*.6})]}):jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",y.gap,g),children:[jsxRuntime.jsx(J,{width:y.skeletonIcon,height:y.skeletonIcon,className:"flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(J,{width:y.skeletonText,height:16}),jsxRuntime.jsx(J,{width:y.skeletonSecondary,height:12})]})]});if(a==="inline"){let L=`${e} ${t}`;return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center",y.gap,g),children:[jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",y.logoSize),children:C?jsxRuntime.jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>b(true)}):jsxRuntime.jsx(I,{name:x,size:y.iconSize*.6,className:"text-text-muted"})}),jsxRuntime.jsx(R,{className:tailwindMerge.twMerge("truncate leading-normal hover:text-text-body",P,y.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:L})]})}return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center justify-start",y.gap,g),children:[u&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",y.logoSize),children:C?jsxRuntime.jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>b(true)}):jsxRuntime.jsx(I,{name:x,size:y.iconSize*.6,className:"text-text-muted"})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxRuntime.jsx(R,{className:tailwindMerge.twMerge("truncate leading-normal hover:text-text-body",P,y.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:e}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center gap-1.5 text-text-muted leading-normal",y.secondaryTextSize),children:[d&&jsxRuntime.jsx(I,{name:x,size:y.iconInTextSize,className:"flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate",children:t})]})]})]})}function KN(e){switch(e){case "battery":return "BatteryHigh";case "charger":return "ChargingStation";case "inverter":return "Power";case "thermostat":return "ThermometerSimple";case "vehicle":return "CarSimple";case "meter":return "Gauge";default:return "DeviceMobile"}}function Kb({row:e,context:t,manufacturer:r,model:o,deviceType:n,logoUrl:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:d="default",showDeviceTypeIcon:u=true,showLogo:m=true,emphasis:p="normal",align:g="left",className:f}){let{isLoading:b}=t,x=ye(r,e),v=ye(o,e),y=ye(n,e),C=ye(a,e),T=ye(c,e),P=ke(g,f);return jsxRuntime.jsx("div",{className:P,children:jsxRuntime.jsx(rl,{manufacturer:x,model:v,deviceType:y,logoUrl:C,layout:i,size:s,href:T,LinkComponent:l,linkVariant:d,showDeviceTypeIcon:u,showLogo:m,emphasis:p,isLoading:b})})}var PW={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},JN=["charging","discharging","heat","cool","on","connected"],jN={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 Tu(e){return JN.includes(e)}function ku(e){return jN[e]}function sn({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??ku(e),m=Tu(e);return jsxRuntime.jsxs(Je,{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(I,{name:r,size:n==="sm"?12:n==="md"?14:16}),u]})}var ZN={importing:"Importing",exporting:"Exporting"};function jb(e){return ZN[e]}function nl({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??jb(e),d=e==="exporting"?"ArrowUp":"ArrowDown",u=n==="sm"?12:n==="md"?14:16;return r?jsxRuntime.jsx(Je,{variant:e,size:n,shape:a,className:`w-6 justify-center ${s||""}`,...c,children:jsxRuntime.jsx(I,{name:d,size:u})}):jsxRuntime.jsx(Je,{variant:e,size:n,shape:a,className:i?`w-28 justify-center ${s||""}`:s,...c,children:l})}function al({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?Fo(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-body":"text-text-caption",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(sn,{state:e,label:t,icon:l,size:s,shape:c,fixedWidth:d}),n&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:n==="importing"||n==="exporting"?jsxRuntime.jsx(nl,{state:n,size:s,shape:c,fixedWidth:d,showIcon:u}):jsxRuntime.jsx(sn,{state:n,size:s,shape:c,fixedWidth:d})})]})}function qb({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 C={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"}[s],T=o!=null||n!=null;return jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(J,{className:"h-4 w-12"}),jsxRuntime.jsx(J,{className:`h-6 w-24 ${C}`}),jsxRuntime.jsx(J,{className:`h-6 w-20 ${C}`})]}):jsxRuntime.jsx(J,{className:`h-6 w-24 ${C}`})})}if(!e)return jsxRuntime.jsx("div",{className:ke(u,p),children:jsxRuntime.jsx("span",{className:"text-text-muted",children:"\u2014"})});let f=ye(o,t),b=ye(a,t),x=typeof c=="function"?c(e,t):c,v=ke(u,p);return f!=null||n?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(v),children:jsxRuntime.jsx(al,{state:e,stateLabel:x,metric:f,metricFormatter:n,secondaryState:b||void 0,size:i,shape:s,icon:l,fixedWidth:d,secondaryStateIconOnly:m,layout:"horizontal"})}):jsxRuntime.jsx("div",{className:v,children:jsxRuntime.jsx(sn,{state:e,label:x,icon:l,size:i,shape:s,fixedWidth:d})})}function Xb({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-muted"}){let{isLoading:u}=r;if(u)return jsxRuntime.jsx(J,{className:Vt(a)});let m=Nr({value:e,formatter:o,emptyText:l,emptyClassName:d}),p=ir(a),g=ke(n,tailwindMerge.twMerge(p,c)),f=jsxRuntime.jsx("div",{className:g,children:m}),b=ye(i,t);return b?Fr(f,b,t,s):f}var Ru=Me__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=Me.useMemo(()=>r===t?100:Math.max(0,Math.min(100,(e-t)/(r-t)*100)),[e,t,r]),f=Me.useMemo(()=>o==="auto"&&a?a.type==="diverging"&&a.center!==void 0?ba(e,t,r,a.center,a.scheme):ga(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 v=`calc((100% - ${u*(d-1)}px) / ${d})`,y=Math.ceil(g/100*d),C={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:C,children:Array.from({length:d}).map((T,P)=>{let R=P<y;return jsxRuntime.jsx("div",{className:"rounded-sm",style:{width:v,backgroundColor:R?f:n==="none"?"transparent":n,marginRight:P<d-1?`${u}px`:0}},P)})}),i&&jsxRuntime.jsx("span",{className:"text-sm text-text-body whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})}let b={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:b,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-body whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})});Ru.displayName="HorizontalBarCell";var Du=Me__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=b=>"xValue"in b?b.xValue:b.x,l=b=>"yValue"in b?b.yValue:b.y,d=a||100,u=i,{xScale:m,yScale:p,barWidth:g}=Me.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 b=d3Array.extent(s,R=>c(R)),x=d3Array.min(s,R=>l(R))??0,v=d3Array.max(s,R=>l(R))??0,y=x<0?x:0,C=scale.scaleTime({range:[0,d],domain:b}),T=scale.scaleLinear({range:[u,0],domain:[y,v*1.05]}),P=s.length>1?d/s.length*.8:8;return {xScale:C,yScale:T,barWidth:Math.max(2,P)}},[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((b,x)=>jsxRuntime.jsx("div",{className:"flex-1 animate-pulse bg-border-default rounded"},x))});if(!s||s.length===0)return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-text-muted 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((b,x)=>{let v=l(b),y=m(c(b)),C=p(v),T=Math.abs(f-C),P=b.category&&o?.[b.category]?o[b.category]:r;return jsxRuntime.jsx(shape.Bar,{x:y-g/2,y:v>=0?C:f,width:g,height:T,fill:P,rx:1},`bar-${x}`)})})});Du.displayName="MiniBarCell";function tx({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:Vt(l)});if(e==null||isNaN(Number(e)))return jsxRuntime.jsx("div",{className:ke(c,"text-text-muted"),children:s});let b=Number(e),x;switch(o){case "currency":x=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:n,maximumFractionDigits:n}).format(b);break;case "percent":x=new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:n,maximumFractionDigits:n}).format(b/100);break;case "compact":x=new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:n>0?1:0,maximumFractionDigits:n}).format(b);break;default:x=new Intl.NumberFormat("en-US",{minimumFractionDigits:n,maximumFractionDigits:n}).format(b);}let y=`${m&&b>0?"+":""}${x}`,C=p?tl(b,true):ir(l),T=ke(c,tailwindMerge.twMerge(C,g)),P=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[a&&jsxRuntime.jsx("span",{className:"text-text-muted",children:a}),jsxRuntime.jsx("span",{children:y}),i&&jsxRuntime.jsx("span",{className:"text-text-muted",children:i})]}),R=ye(d,t);return R?jsxRuntime.jsx("div",{className:T,children:Fr(P,R,t,u)}):jsxRuntime.jsx("div",{className:T,children:P})}var Eu=Me__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=Me.useMemo(()=>Math.max(0,Math.min(100,e)),[e]),d=Me.useMemo(()=>r==="auto"&&s?s.type==="diverging"&&s.center!==void 0?ba(e,0,100,s.center,s.scheme):ga(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 b=f<p,x=d;if(r==="auto"&&s&&b){let v=(f+1)/a*100;s.type==="diverging"&&s.center!==void 0?x=ba(v,0,100,s.center,s.scheme):x=ga(v,0,100,s.scheme);}return jsxRuntime.jsx("div",{className:"rounded-sm",style:{width:m,backgroundColor:b?x:o==="none"?"transparent":o,marginRight:f<a-1?`${i}px`:0}},f)})}),t&&jsxRuntime.jsxs("span",{className:"text-sm text-text-body 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-body whitespace-nowrap",children:[l.toFixed(0),"%"]})]})});Eu.displayName="PercentBarCell";function ox({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:ke(a),children:jsxRuntime.jsx(J,{className:"h-4 w-4 rounded"})});let s=ye(n,e),c=ke(a);return jsxRuntime.jsx("div",{className:c,children:jsxRuntime.jsx(Zo,{isSelected:r,onChange:l=>{o?.(e,l);},isDisabled:s,"aria-label":"Select row"})})}function ll({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],b={strong:"font-semibold text-text-body",high:"font-semibold text-text-body",normal:"text-text-body",low:"text-text-muted"}[l],x=[];t&&x.push(t),r&&o?x.push(`${r} ${o}`):r?x.push(r):o&&x.push(o);let v=x.join(", "),y=({children:T,className:P})=>i?s?jsxRuntime.jsx(s,{href:i,className:P,children:T}):jsxRuntime.jsx(Ue,{href:i,variant:c,className:tailwindMerge.twMerge("hover:underline",P),asButton:false,children:T}):jsxRuntime.jsx("span",{className:P,children:T});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(I,{name:"MapPin",size:g.iconSize,className:"text-text-muted flex-shrink-0"}),jsxRuntime.jsx("span",{className:tailwindMerge.twMerge("leading-normal truncate hover:text-text-body",b,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 C=()=>{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(I,{name:"MapPin",size:g.iconSize,className:"text-text-muted"})}),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-body",b,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})}),v&&jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("text-text-caption leading-normal truncate",g.secondaryTextSize),"data-pii-type":C(),"data-pii-entity":m,children:v})]})]})}function ax({row:e,context:t,streetAddress:r,city:o,state:n,postalCode:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:d="default",emphasis:u="normal",align:m="left",className:p,piiEntity:g}){let{isLoading:f}=t,b=ye(r,e),x=ye(o,e),v=ye(n,e),y=ye(a,e),C=ye(c,e),T=ye(g,e),P=ke(m,p);return jsxRuntime.jsx("div",{className:P,children:jsxRuntime.jsx(ll,{streetAddress:b,city:x,state:v,postalCode:y,layout:i,size:s,href:C,LinkComponent:l,linkVariant:d,emphasis:u,isLoading:f,piiEntity:T})})}var Mu=Me__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}=Me.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),b=d3Array.min(l,y=>y.yValue)||0,x=d3Array.max(l,y=>y.yValue)||0,v=(x-b)*.1||1;return {xScale:scale.scaleTime({range:[0,d],domain:f}),yScale:scale.scaleLinear({range:[u,0],domain:[b-v,x+v]})}},[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-muted 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})]})});Mu.displayName="SparklineCell";function cx({value:e,row:t,context:r,prefix:o,suffix:n,emptyText:a="\u2014",href:i,linkBehavior:s="hover",linkVariant:c="default",emphasis:l="normal",truncate:d=true,copyable:u=false,align:m="left",className:p,piiType:g,piiEntity:f}){let{isLoading:b}=r;if(b)return jsxRuntime.jsx(J,{className:Vt(l)});let x=el(e,a),v=ye(i,t),y=ye(f,t),C=x,T=false,P=false;if(d&&x&&typeof x=="string")if(typeof d=="boolean")P=true;else {let{position:N="end",length:z=16,ellipsis:W="...",tooltip:F=true}=d;if(x.length>z){switch(N){case "start":C=Bi(x,z);break;case "middle":C=Rn(x,z);break;case "end":C=zi(x,z,W);break}T=F;}}let R=g&&y?{"data-pii-type":g,"data-pii-entity":y}:{},L=Object.keys(R).length>0,D=jsxRuntime.jsx("span",{className:P?"truncate":"",...R,children:C}),A=T?jsxRuntime.jsx(Et,{content:L?jsxRuntime.jsx("span",{...R,children:String(x)}):String(x),children:D}):D,V=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o&&jsxRuntime.jsx("span",{className:"text-text-muted",children:o}),A,n&&jsxRuntime.jsx("span",{className:"text-text-muted",children:n})]}),M=V;if(u&&x&&x!==a){let N=typeof u=="function"?u(t):String(x);M=jsxRuntime.jsx(fo,{value:N,size:"sm",children:V});}if(v){let N=ke(m,p);return jsxRuntime.jsx("div",{className:N,children:Fr(M,v,t,s,c,l)})}let w=ke(m,tailwindMerge.twMerge(ir(l),p));return jsxRuntime.jsx("div",{className:w,children:M})}var NT={sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"},TT={sm:"hidden sm:grid",md:"hidden md:grid",lg:"hidden lg:grid",xl:"hidden xl:grid"};function cl(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function dl(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 pl({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=cl(e,u);return jsxRuntime.jsx("div",{className:"font-medium text-text-body [&>*]:!justify-start [&>*]:!text-left",children:dl(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=cl(e,u);return jsxRuntime.jsx("div",{className:"inline-flex",children:dl(m,e,u,l)},u.id)})})]}),s.length>0&&jsxRuntime.jsx("div",{className:"space-y-1",children:s.map(u=>{let m=cl(e,u),p=u.showLabel&&u.label;return jsxRuntime.jsxs("div",{className:"flex items-center text-sm text-text-muted",children:[u.icon&&jsxRuntime.jsx(I,{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:dl(m,e,u,l)})]},u.id)})})]})}function ml({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=cl(e,c),u=l===0;return jsxRuntime.jsxs("div",{children:[!u&&jsxRuntime.jsx("div",{className:"text-xs text-text-muted",children:c.label}),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(u?"font-medium text-text-body":"text-sm text-text-body","[&>*]:!justify-start [&>*]:!text-left"),children:dl(d,e,c,i)})]},c.id)})})})}function dx(e="md"){return {mobile:NT[e],desktop:TT[e]}}function ux({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 VT={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},OT={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"};function HT(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 WT({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,b=f?t.direction:null,x=n&&a,v={...HT(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",VT[i],OT[e.align||"left"],o&&"sticky top-0 z-10",x&&"sticky left-0 z-20 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",o&&x&&"z-30",e.sortable&&!s&&"hover:bg-background-hover",s&&"cursor-not-allowed opacity-60",f?"font-bold text-text-body":"font-medium text-text-muted",g&&"bg-background-hover"),style:v,role:"columnheader","aria-sort":f?b==="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(I,{name:b==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-body"}):jsxRuntime.jsx(I,{name:"CaretUpDown",size:12,className:"text-text-muted opacity-40"})})]})})}function mx({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 b=t.indexOf(g.id),x=t.indexOf(f.id);if(d.get(f.id)?.reorderable===false)return;let y=0;for(let R=0;R<t.length&&d.get(t[R])?.reorderable===false;R++)y=R+1;if(x<y)return;let C=Math.min(b,x),T=Math.max(b,x);for(let R=C;R<=T;R++){if(R===b)continue;if(d.get(t[R])?.reorderable===false)return}let P=sortable.arrayMove(t,b,x);r(P);}},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(WT,{column:p,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,isFirstColumn:g===0,density:s,isLoading:c},p.id))})})})}var Fu={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},Bu={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"},jT={full:"w-full",auto:"w-auto inline-block",contained:"w-full max-w-6xl mx-auto"},qT={auto:"table-auto",fixed:"table-fixed",responsive:"table-auto"};function zu(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 ZT(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function XT({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",Fu[i],Bu[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-body":"font-medium text-text-muted"),onClick:()=>!s&&e.sortable&&r(e.id),role:"columnheader","aria-sort":c?l==="asc"?"ascending":"descending":"none","aria-disabled":s,style:zu(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(I,{name:l==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-body"}):jsxRuntime.jsx(I,{name:"CaretUpDown",size:12,className:"text-text-muted opacity-40"})})]})})}function $T({column:e,row:t,rowIndex:r,columnIndex:o,isHovered:n,density:a="default",className:i,stickyFirstColumn:s}){let c=s&&o===0,l=ZT(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,b="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,b=m.trigger||"hover"),u=jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{...b==="hover"?{trigger:"longPress"}:{},children:[jsxRuntime.jsx("div",{className:"cursor-help",children:u}),jsxRuntime.jsx(Ze,{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?"":Fu[a],Bu[e.align||"left"],c&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",i),role:"cell",style:zu(e),children:u})}function QT({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?"":Fu[o],Bu[e.align||"left"],a&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),role:"cell",style:zu(e),children:s})}function _T(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 fx({columns:e,row:t,rowIndex:r,density:o="default",onClick:n,stickyFirstColumn:a}){let[i,s]=Me.useState(false),c=Me.useCallback(l=>{if(!n)return;let d=l.target,u=l.currentTarget;_T(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($T,{column:l,row:t,rowIndex:r,columnIndex:d,isHovered:i,density:o,className:n?"group-hover:bg-background-hover":"",stickyFirstColumn:a},l.id))})}function gx({columns:e,rowIndex:t,density:r="default",stickyFirstColumn:o}){return jsxRuntime.jsx("div",{className:"contents",role:"row",children:e.map((n,a)=>jsxRuntime.jsx(QT,{column:n,rowIndex:t,columnIndex:a,density:r,stickyFirstColumn:o},n.id))})}function bx({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:b,estimatedRowHeight:x,loadingIndicator:v,stickyHeader:y=false,stickyFirstColumn:C=false,onRowClick:T,getRowId:P,hideHeader:R=false,sortConfig:L,onSort:D,"aria-label":A,enableColumnReorder:V=false,columnOrder:M,onColumnOrderChange:w}){let[N,z]=Me.useState(null),W=L!==void 0,F=W?L:N,K=Me.useRef(null),X=Me.useMemo(()=>e.map(te=>te.id),[e]),[G,U]=Me.useState(X),k=M!==void 0,S=k?M:G;Me.useEffect(()=>{k||U(te=>{let ce=e.map(ee=>ee.id),_=new Set(ce),Z=new Set(te),Y=te.filter(ee=>_.has(ee)),ae=ce.filter(ee=>!Z.has(ee));return [...Y,...ae]});},[e,k]);let B=Me.useCallback(te=>{k||U(te),w?.(te);},[k,w]),E=Me.useMemo(()=>{if(!V&&!M)return e;let te=new Map(e.map(ce=>[ce.id,ce]));return S.map(ce=>te.get(ce)).filter(ce=>ce!==void 0)},[e,S,V,M]),h=g?ao({items:t,onLoadMore:g,hasMore:f,isLoading:u,loadingState:m,enableVirtualization:b,estimatedItemSize:x||(o==="compact"?40:o==="relaxed"?60:48),overscan:5}):null,O=h?.scrollRef??K,{loadMoreRef:H,virtualizer:j,virtualItems:oe,isLoadingMore:me,computedLoadingState:q}=h||{},{gridTemplateColumns:ne,totalMinWidth:Te}=Me.useMemo(()=>{let te=0;return {gridTemplateColumns:E.map(_=>{if(_.minWidth?te+=typeof _.minWidth=="number"?_.minWidth:0:_.width&&typeof _.width=="number"&&(te+=_.width),_.width)return typeof _.width=="number"?`${_.width}px`:_.width;if(_.flex)return `${_.flex}fr`;if(_.minWidth&&_.maxWidth){let Z=typeof _.minWidth=="number"?`${_.minWidth}px`:_.minWidth,Y=typeof _.maxWidth=="number"?`${_.maxWidth}px`:_.maxWidth;return `minmax(${Z}, ${Y})`}return _.minWidth?`minmax(${typeof _.minWidth=="number"?`${_.minWidth}px`:_.minWidth}, 1fr)`:_.maxWidth?`minmax(0, ${typeof _.maxWidth=="number"?`${_.maxWidth}px`:_.maxWidth})`:"1fr"}).join(" "),totalMinWidth:te}},[E]),ie=Me.useCallback(te=>{if(!e.find(Z=>Z.id===te)?.sortable)return;let _;F?.columnId===te?_={columnId:te,direction:F.direction==="asc"?"desc":"asc"}:_={columnId:te,direction:"asc"},W||z(_),D?.(_);},[e,F,D,W]),ue=q==="loading"||u&&t.length===0,ge={};a?(ge.height=typeof a=="number"?`${a}px`:a,ge.overflowY="auto"):i?(ge.maxHeight=typeof i=="number"?`${i}px`:i,ge.overflowY="auto"):g&&(ge.height="600px",ge.overflowY="auto");let $=tailwindMerge.twMerge(jT[n],!g&&(s==="responsive"?"overflow-x-auto scrollbar-visible":"overflow-auto scrollbar-visible"),r),se=dx(d),Ne=c!=="none",ze=(te,ce)=>Ne?c==="custom"&&l?l(te,ce):jsxRuntime.jsx(c==="cards"?ml:pl,{row:te,columns:E,density:o,isLoading:u,onClick:T?()=>T(te):void 0}):null,De=j?oe?.map(te=>({virtualItem:te,row:t[te.index],index:te.index}))||[]:t.map((te,ce)=>({row:te,index:ce,virtualItem:null}));return jsxRuntime.jsxs("div",{ref:O,className:$,style:{...ge,position:j?"relative":void 0},children:[jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("grid border-separate border-spacing-0",qT[s],n==="auto"?"inline-grid w-auto":"w-full",Ne&&se.desktop),role:"table","aria-label":A,style:{gridTemplateColumns:ne,minWidth:Te>0?`${Te}px`:void 0},children:[!R&&(V?jsxRuntime.jsx(mx,{columns:e,columnOrder:S,onColumnOrderChange:B,sortConfig:F,onSort:ie,stickyHeader:y,stickyFirstColumn:C,density:o,isLoading:ue}):jsxRuntime.jsx("div",{className:"contents",role:"rowgroup",children:E.map((te,ce)=>jsxRuntime.jsx(XT,{column:te,sortConfig:F,onSort:ie,stickyHeader:y,stickyFirstColumn:C,isFirstColumn:ce===0,density:o,isLoading:ue},te.id))})),j?jsxRuntime.jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1",height:`${j.getTotalSize()}px`,position:"relative"},role:"rowgroup",children:ue?Array.from({length:p}).map((te,ce)=>jsxRuntime.jsx("div",{className:"contents",children:jsxRuntime.jsx(gx,{columns:E,rowIndex:ce,density:o,stickyFirstColumn:C})},`loading-${ce}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[De.map(({row:te,index:ce,virtualItem:_})=>{if(!te||!_)return null;let Z=P?P(te):`row-${ce}`;return jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",display:"grid",gridTemplateColumns:ne,transform:`translateY(${_.start}px)`},"data-index":_.index,ref:j.measureElement,children:jsxRuntime.jsx(fx,{columns:E,row:te,rowIndex:ce,density:o,onClick:T,stickyFirstColumn:C})},Z)}),me&&jsxRuntime.jsx("div",{style:{position:"absolute",top:`${j.getTotalSize()}px`,left:0,width:"100%"},children:v||jsxRuntime.jsx(Qt,{state:"loading-more"})})]}):jsxRuntime.jsx("div",{className:"py-12 text-center text-text-muted",children:"No data available"})}):jsxRuntime.jsx("div",{className:"contents",role:"rowgroup",children:ue?Array.from({length:p}).map((te,ce)=>jsxRuntime.jsx(gx,{columns:E,rowIndex:ce,density:o,stickyFirstColumn:C},`loading-${ce}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[De.map(({row:te,index:ce})=>{if(!te)return null;let _=P?P(te):`row-${ce}`;return jsxRuntime.jsx(fx,{columns:E,row:te,rowIndex:ce,density:o,onClick:T,stickyFirstColumn:C},_)}),me&&jsxRuntime.jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1"},children:v||jsxRuntime.jsx(Qt,{state:"loading-more"})})]}):jsxRuntime.jsx("div",{className:"col-span-full py-12 text-center text-text-muted",role:"row",children:jsxRuntime.jsx("div",{role:"cell",children:"No data available"})})})]}),Ne&&jsxRuntime.jsx("div",{className:se.mobile,children:ue?Array.from({length:p}).map((te,ce)=>jsxRuntime.jsx(ux,{density:o},`mobile-loading-${ce}`)):t.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[De.map(({row:te,index:ce})=>{if(!te)return null;let _=P?P(te):`mobile-row-${ce}`;return jsxRuntime.jsx("div",{className:"border-b border-border-default last:border-b-0",children:ze(te,ce)},_)}),me&&(v||jsxRuntime.jsx(Qt,{state:"loading-more"}))]}):jsxRuntime.jsx("div",{className:"py-12 text-center text-text-muted",children:"No data available"})}),g&&f&&!ue&&(j?jsxRuntime.jsx("div",{ref:H,style:{position:"absolute",top:`${j.getTotalSize()}px`,left:0,width:"100%",height:1}}):jsxRuntime.jsx("div",{ref:H,className:"h-px w-full"}))]})}function hx({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(Je,{variant:s[e],size:n,shape:a,dot:l,dotPulse:l,...i,children:d})}var tk={battery:"BatteryHigh",charger:"ChargingStation",thermostat:"ThermometerSimple",inverter:"Power",vehicle:"Car",meter:"Gauge",gateway:"WifiHigh",other:"Cube",unknown:"Question"},rk={battery:"Battery",charger:"Charger",thermostat:"Thermostat",inverter:"Inverter",vehicle:"Vehicle",meter:"Meter",gateway:"Gateway",other:"Other",unknown:"Unknown"};function vx({deviceType:e,iconName:t,size:r="md",showLabel:o=false,className:n}){let a=t||(e?tk[e]:"Question"),i=e?rk[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(I,{name:a,size:r}),o&&i&&jsxRuntime.jsx("span",{className:"text-xs text-text-muted",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:b=true,maxWidth:x="400px"}){if(!s)return null;let v=t||r,y=m||p||g||f;return jsxRuntime.jsx(dr,{children:jsxRuntime.jsx(Wt,{isOpen:s,onOpenChange:C=>!C&&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:x,width:"100%"},children:[v&&(a&&i?jsxRuntime.jsx(vt,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,hasBackArrow:true,onBack:i,onClose:d}):jsxRuntime.jsx(vt,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,onClose:d})),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-1 overflow-y-auto overscroll-contain",b?"px-6 py-6":"p-0"),children:e}),y&&jsxRuntime.jsx(co,{primaryAction:m,secondaryAction:p,tertiaryAction:g,footerContent:f})]})})})})}ei.displayName="Drawer";var sk={sm:"gap-4 px-6 py-8",md:"gap-5 px-8 py-12",lg:"gap-6 px-10 py-16"},lk={sm:"xs",md:"sm",lg:"md"},ck={sm:"text-sm leading-5",md:"text-sm leading-5",lg:"text-base leading-6"},dk={sm:"h-10 w-10",md:"h-12 w-12",lg:"h-16 w-16"},uk={sm:20,md:24,lg:32},pk={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"},mk={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 wx({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:mk[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(Q,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,href:o.href,children:o.label}):jsxRuntime.jsx(Q,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,children:o.label})),n&&jsxRuntime.jsx(Ue,{href:n.href||"#",variant:"muted",onPress:n.onPress,className:"text-sm",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-body",sk[i],pk[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-muted",dk[i]),children:jsxRuntime.jsx(I,{name:e,size:uk[i]})}),jsxRuntime.jsx(Dt,{size:lk[i],tag:"h2",className:"text-text-muted leading-tight",children:t}),r&&jsxRuntime.jsx("p",{className:tailwindMerge.twMerge("max-w-xs text-text-muted whitespace-pre-line",ck[i]),children:r}),f()]})}function Nx({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(Je,{variant:i[e],size:o,shape:n,...a,children:s[e]});return t?jsxRuntime.jsx(Et,{content:t,children:c}):c}function kx({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]=Me.useState(false),[m,p]=Me.useState(false),[g,f]=Me.useState(null),[b,x]=Me.useState(e),v=Me.useRef(null),y=async P=>{if(f(null),n&&P.size>n){f(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(c&&P.type.startsWith("image/")){let R=new FileReader;R.onloadend=()=>{x(R.result);},R.readAsDataURL(P);}if(i){p(true);try{let R=await i(P);x(R),r?.(R);}catch(R){f("Failed to upload file"),console.error("Upload error:",R);}finally{p(false);}}t?.(P,b);},C=async P=>{try{let R=P.items;if(R.length>0){let L=R[0];if(L.kind==="file"){let D=await L.getFile();D&&y(D);}}}catch(R){f("Failed to upload file"),console.error("Upload error:",R);}finally{u(false);}},T=()=>{x(void 0),f(null),t?.(null),r?.(""),v.current&&(v.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:C,onDropEnter:()=>u(true),onDropExit:()=>u(false),children:[b?jsxRuntime.jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[c&&(b.startsWith("data:image")||b.startsWith("http"))?jsxRuntime.jsx("img",{src:b,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-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:"File uploaded"})]}),!a&&jsxRuntime.jsx(Q,{variant:"icon",size:"sm",onPress:T,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-muted"}),jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-sm text-text-body",children:l}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-text-muted",children:o==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${o}`})]}),jsxRuntime.jsx(reactAriaComponents.FileTrigger,{acceptedFileTypes:o.split(","),onSelect:P=>{let R=Array.from(P||[]);R.length>0&&y(R[0]);},children:jsxRuntime.jsx(Q,{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-muted",children:"Uploading..."})]})})]}),g&&jsxRuntime.jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function Rx({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(Je,{variant:s,size:n,shape:a,...i,children:c})}function _n(e){return jsxRuntime.jsx(reactAriaComponents.Form,{validationBehavior:"aria",...e,className:tailwindMerge.twMerge("flex flex-col gap-6",e.className)})}function Ex({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]=Me.useState(false),m=Tt("(max-width: 767px)"),p=o!==void 0?o:d,g=Me.useCallback(v=>{n?n(v):u(v);},[n]);Me.useEffect(()=>{let v=y=>{(y.metaKey||y.ctrlKey)&&y.key==="k"&&(y.preventDefault(),g(!p)),y.key==="Escape"&&p&&g(false);};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[p,g]);let f=Me.useCallback(v=>{r?.(v);},[r]),b=jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-muted hover:text-text-body hover:bg-background-hover rounded-md transition-colors","aria-label":"Open search",children:[jsxRuntime.jsx(I,{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"})]})]}),x=a===null||Me.isValidElement(a)&&a.type===Me.Fragment&&!a.props.children;return m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!x&&(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:b})),jsxRuntime.jsx(Xe,{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(ar,{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})]})})]}):x?null:jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:p,onOpenChange:g,children:[a||b,jsxRuntime.jsx(Ze,{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(ar,{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 Lx({placeholder:e="Search...",value:t,onChange:r,isOpen:o,onOpenChange:n,children:a,maxHeight:i="400px",variant:s="default",className:c}){let[l,d]=Me.useState(false),u=Tt("(max-width: 767px)"),m=Me.useRef(null),p=Me.useRef(null),g=o!==void 0?o:l,f=Me.useCallback(A=>{n?n(A):d(A);},[n]);Me.useEffect(()=>{let A=V=>{(V.metaKey||V.ctrlKey)&&V.key==="k"&&(V.preventDefault(),f(!g)),V.key==="Escape"&&g&&f(false);};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[g,f]),Me.useEffect(()=>{g&&!u&&m.current&&setTimeout(()=>{m.current?.querySelector("input")?.focus();},0);},[g,u]),Me.useEffect(()=>{if(!g||u)return;let A=V=>{let M=V.target,w=m.current?.contains(M),N=p.current?.contains(M);!w&&!N&&f(false);};return document.addEventListener("mousedown",A,true),()=>document.removeEventListener("mousedown",A,true)},[g,u,f]);let b=A=>{r?.(A);},x=Me.useCallback(()=>{f(false);},[f]),v=Me.useCallback(()=>{r?.("");},[r]),[y,C]=Me.useState(null);Me.useEffect(()=>{if(g&&!u&&m.current){let A=null,V=()=>{let w=m.current?.getBoundingClientRect();w&&C({top:w.bottom+8,left:w.left,width:w.width});},M=()=>{A===null&&(A=requestAnimationFrame(()=>{V(),A=null;}));};return V(),window.addEventListener("resize",M),window.addEventListener("scroll",M,true),()=>{window.removeEventListener("resize",M),window.removeEventListener("scroll",M,true),A!==null&&cancelAnimationFrame(A);}}},[g,u]);let T=Me.useCallback(()=>{f(true);},[f]);if(u)return jsxRuntime.jsxs("div",{className:c,children:[jsxRuntime.jsx("button",{type:"button",onClick:T,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(I,{name:"MagnifyingGlass",size:"md"})}),jsxRuntime.jsxs(Xe,{isOpen:g,onClose:x,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(ar,{value:t,onChange:b,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:v,reserveErrorSpace:false,autoFocus:true})}),jsxRuntime.jsx(Q,{variant:"icon",onPress:x,"aria-label":"Close search",className:"flex-shrink-0",children:jsxRuntime.jsx(I,{name:"X",size:"md"})})]}),jsxRuntime.jsx("div",{className:"mt-4",children:a})]})]},"mobile");let P=A=>{let M=A.target.tagName==="INPUT";if(A.key==="ArrowDown"&&g&&M){A.preventDefault();let w=p.current?.querySelector("[data-search-result]");w&&w.focus();}},R=A=>{let V=A.target;if(!V.hasAttribute("data-search-result"))return;let w=Array.from(p.current?.querySelectorAll("[data-search-result]")||[]),N=w.indexOf(V);if(A.key==="ArrowDown"){A.preventDefault(),A.stopPropagation();let z=Math.min(N+1,w.length-1);w[z]?.focus();}else if(A.key==="ArrowUp")if(A.preventDefault(),A.stopPropagation(),N===0)m.current?.querySelector("input")?.focus();else {let z=Math.max(N-1,0);w[z]?.focus();}else A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),f(false),m.current?.querySelector("input")?.focus());},L=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:R,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,D=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:P,children:[jsxRuntime.jsx(ar,{value:t,onChange:b,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:D,onFocus:()=>f(true)}),L]},"desktop")}function Ix({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-muted mb-3",children:jsxRuntime.jsx(I,{name:r,size:48})}),jsxRuntime.jsx("p",{className:"text-base font-medium text-text-body mb-1",children:e}),t&&jsxRuntime.jsx("p",{className:"text-sm text-text-muted max-w-xs",children:t})]})}function Bx({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 Vx({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-heading",children:e}),!r&&t!==void 0&&jsxRuntime.jsx("span",{className:"text-xs text-text-muted",children:t}),r&&jsxRuntime.jsx("span",{className:"text-xs text-text-muted 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 Ox({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 b=document.querySelector('input[type="text"][placeholder*="Search"]');b&&b.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-body hover:bg-background-hover","focus-visible:bg-brand-light 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-muted",children:jsxRuntime.jsx(I,{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-heading truncate",children:t}),o&&jsxRuntime.jsx("span",{className:"text-xs text-text-muted flex-shrink-0",children:o})]}),r&&jsxRuntime.jsx("div",{className:"text-sm text-text-muted 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(I,{name:"ArrowRight",size:16,className:"text-text-muted"})})]})}function Hx({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 Gx({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:`
96
96
  flex items-center gap-3 w-full px-4 py-2.5 rounded-lg
97
97
  transition-all duration-200 cursor-text
98
98
  ${{default:`