@texturehq/edges 1.34.0 → 1.34.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -92,7 +92,7 @@ Valid keys: `+JSON.stringify(Object.keys(N),null," "));var M=B(G,w,F,K,X+"."+w,
92
92
  });
93
93
  }
94
94
  })();
95
- `}})]})}var ts={prefix:String(Math.round(Math.random()*1e10)),current:0},hf=Ee__default.createContext(ts),nS=Ee__default.createContext(false);var aS=!!(typeof window<"u"&&window.document&&window.document.createElement),fd=new WeakMap;function iS(e=false){let t=useContext(hf),r=useRef(null);if(r.current===null&&!e){var o,n;let a=(n=Ee__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=fd.get(a);i==null?fd.set(a,{id:t.current,state:a.memoizedState}):a.memoizedState!==i.state&&(t.current=i.id,fd.delete(a));}r.current=++t.current;}return r.current}function sS(e){let t=useContext(hf);t===ts&&!aS&&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=iS(!!e),o=t===ts&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${t.prefix}`;return e||`${o}-${r}`}function lS(e){let t=Ee__default.useId(),[r]=useState(rs()),o=r||process.env.NODE_ENV==="test"?"react-aria":`react-aria${ts.prefix}`;return e||`${o}-${t}`}typeof Ee__default.useId=="function"?lS:sS;function dS(){return false}function uS(){return true}function pS(e){return ()=>{}}function rs(){return typeof Ee__default.useSyncExternalStore=="function"?Ee__default.useSyncExternalStore(pS,dS,uS):useContext(nS)}function yf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function os(e,t,r){yf(e,t),t.set(e,r);}var mS=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),fS=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function bd(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 mS.has(r.script)}let t=e.split("-")[0];return fS.has(t)}var Cf=Symbol.for("react-aria.i18n.locale");function Sf(){let e=typeof window<"u"&&window[Cf]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:bd(e)?"rtl":"ltr"}}var xd=Sf(),Ma=new Set;function vf(){xd=Sf();for(let e of Ma)e(xd);}function wf(){let e=rs(),[t,r]=useState(xd);return useEffect(()=>(Ma.size===0&&window.addEventListener("languagechange",vf),Ma.add(r),()=>{Ma.delete(r),Ma.size===0&&window.removeEventListener("languagechange",vf);}),[]),e?{locale:typeof window<"u"&&window[Cf]||"en-US",direction:"ltr"}:t}var yS=Ee__default.createContext(null);function hd(){let e=wf();return useContext(yS)||e}function ns(e,t){return e-t*Math.floor(e/t)}var Nf=1721426;function as(e,t,r,o){t=ss(e,t);let n=t-1,a=-2;return r<=2?a=0:is(t)&&(a=-1),Nf-1+365*n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400)+Math.floor((367*r-362)/12+a+o)}function is(e){return e%4===0&&(e%100!==0||e%400===0)}function ss(e,t){return e==="BC"?1-t:t}function vS(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}var CS={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]},nr=class{fromJulianDay(t){let r=t,o=r-Nf,n=Math.floor(o/146097),a=ns(o,146097),i=Math.floor(a/36524),s=ns(a,36524),c=Math.floor(s/1461),l=ns(s,1461),u=Math.floor(l/365),d=n*400+i*100+c*4+u+(i!==4&&u!==4?1:0),[m,p]=vS(d),g=r-as(m,p,1,1),f=2;r<as(m,p,3,1)?f=0:is(p)&&(f=1);let b=Math.floor(((g+f)*12+373)/367),x=r-as(m,p,b,1)+1;return new Jo(m,p,b,x)}toJulianDay(t){return as(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return CS[is(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return is(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 vd(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 Cd(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function kf(e,t){return Tf(e)-Tf(t)}function Tf(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}var yd=null;function jo(){return yd==null&&(yd=new Intl.DateTimeFormat().resolvedOptions().timeZone),yd}function bo(e){e=Kt(e,new nr);let t=ss(e.era,e.year);return Df(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Df(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 wd(e,t){if(t==="UTC")return 0;if(e>0&&t===jo()&&true)return new Date(e).getTimezoneOffset()*-6e4;let{year:r,month:o,day:n,hour:a,minute:i,second:s}=Mf(e,t);return Df(r,o,n,a,i,s,0)-Math.floor(e/1e3)*1e3}var Pf=new Map;function Mf(e,t){let r=Pf.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"}),Pf.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 Rf=864e5;function wS(e,t,r,o){return (r===o?[r]:[r,o]).filter(a=>NS(e,t,a))}function NS(e,t,r){let o=Mf(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 fr(e,t,r="compatible"){let o=Mr(e);if(t==="UTC")return bo(o);if(t===jo()&&r==="compatible"&&true){o=Kt(o,new nr);let c=new Date,l=ss(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=bo(o),a=wd(n-Rf,t),i=wd(n+Rf,t),s=wS(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 Nd(e,t,r="compatible"){return new Date(fr(e,t,r))}function ar(e,t){let r=wd(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(),u=o.getUTCMilliseconds();return new Hn(n<1?"BC":"AD",n<1?-n+1:n,a,i,t,r,s,c,l,u)}function ls(e,t){return ar(e.getTime(),t)}function Mr(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 Ea(e.calendar,e.era,e.year,e.month,e.day,r,o,n,a)}function Kt(e,t){if(vd(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,Jr(o),o}function Td(e,t,r){if(e instanceof Hn)return e.timeZone===t?e:kd(e,t);let o=fr(e,t,r);return ar(o,t)}function Ef(e){let t=bo(e)-e.offset;return new Date(t)}function kd(e,t){let r=bo(e)-e.offset;return Kt(ar(r,t),e.calendar)}var La=36e5;function Ia(e,t){let r=e.copy(),o="hour"in r?RS(r,t):0;Pd(r,t.years||0),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e),r.month+=t.months||0,Rd(r),Lf(r),r.day+=(t.weeks||0)*7,r.day+=t.days||0,r.day+=o,kS(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 Pd(e,t){var r,o;!((r=(o=e.calendar).isInverseEra)===null||r===void 0)&&r.call(o,e)&&(t=-t),e.year+=t;}function Rd(e){for(;e.month<1;)Pd(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Pd(e,1);}function kS(e){for(;e.day<1;)e.month--,Rd(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Rd(e);}function Lf(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 Jr(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Lf(e);}function Af(e){let t={};for(let r in e)typeof e[r]=="number"&&(t[r]=-e[r]);return t}function Dd(e,t){return Ia(e,Af(t))}function ds(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),Jr(r),r}function Aa(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),If(r),r}function PS(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=cs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=cs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=cs(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=cs(e.hour,24),t}function If(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 cs(e,t){let r=e%t;return r<0&&(r+=t),r}function RS(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,PS(e)}function us(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=jr(c,r,0,s.length-1,o?.round),n.era=s[c],Jr(n);break}case "year":var a,i;!((a=(i=n.calendar).isInverseEra)===null||a===void 0)&&a.call(i,n)&&(r=-r),n.year=jr(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=jr(e.month,r,1,e.calendar.getMonthsInYear(e),o?.round);break;case "day":n.day=jr(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),Jr(n),n}function Md(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=jr(a,r,i,s,o?.round);break}case "minute":n.minute=jr(e.minute,r,0,59,o?.round);break;case "second":n.second=jr(e.second,r,0,59,o?.round);break;case "millisecond":n.millisecond=jr(e.millisecond,r,0,999,o?.round);break;default:throw new Error("Unsupported field "+t)}return n}function jr(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 Ed(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=Ia(Mr(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});r=fr(n,e.timeZone);}else r=bo(e)-e.offset;r+=t.milliseconds||0,r+=(t.seconds||0)*1e3,r+=(t.minutes||0)*6e4,r+=(t.hours||0)*36e5;let o=ar(r,e.timeZone);return Kt(o,e.calendar)}function Ff(e,t){return Ed(e,Af(t))}function Bf(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=Mr(e),s=Kt(Aa(i,{hour:n}),new nr),c=[fr(s,e.timeZone,"earlier"),fr(s,e.timeZone,"later")].filter(g=>ar(g,e.timeZone).day===s.day)[0],l=Kt(Aa(i,{hour:a}),new nr),u=[fr(l,e.timeZone,"earlier"),fr(l,e.timeZone,"later")].filter(g=>ar(g,e.timeZone).day===l.day).pop(),d=bo(e)-e.offset,m=Math.floor(d/La),p=d%La;return d=jr(m,r,Math.floor(c/La),Math.floor(u/La),o?.round)*La+p,Kt(ar(d,e.timeZone),e.calendar)}case "minute":case "second":case "millisecond":return Md(e,t,r,o);case "era":case "year":case "month":case "day":{let n=us(Mr(e),t,r,o),a=fr(n,e.timeZone);return Kt(ar(a,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Vf(e,t,r){let o=Mr(e),n=Aa(ds(o,t),t);if(n.compare(o)===0)return e;let a=fr(n,e.timeZone,r);return Kt(ar(a,e.timeZone),e.calendar)}var DS=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/;var MS=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Fa(e){let t=e.match(DS);if(!t)throw MS.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let r=new Jo(Ld(t[1],0,9999),Ld(t[2],1,12),1);return r.day=Ld(t[3],1,r.calendar.getDaysInMonth(r)),r}function Ld(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 zf(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 Ad(e){let t=Kt(e,new nr),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 Id(e){return `${Ad(e)}T${zf(e)}`}function LS(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 Of(e){return `${Id(e)}${LS(e.offset)}[${e.timeZone}]`}function Fd(e){let t=typeof e[0]=="object"?e.shift():new nr,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 AS=new WeakMap,Jo=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 Ia(this,t)}subtract(t){return Dd(this,t)}set(t){return ds(this,t)}cycle(t,r,o){return us(this,t,r,o)}toDate(t){return Nd(this,t)}toString(){return Ad(this)}compare(t){return Cd(this,t)}constructor(...t){os(this,AS,{writable:true,value:void 0});let[r,o,n,a,i]=Fd(t);this.calendar=r,this.era=o,this.year=n,this.month=a,this.day=i,Jr(this);}};var IS=new WeakMap,Ea=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 Ia(this,t)}subtract(t){return Dd(this,t)}set(t){return ds(Aa(this,t),t)}cycle(t,r,o){switch(t){case "era":case "year":case "month":case "day":return us(this,t,r,o);default:return Md(this,t,r,o)}}toDate(t,r){return Nd(this,t,r)}toString(){return Id(this)}compare(t){let r=Cd(this,t);return r===0?kf(this,Mr(t)):r}constructor(...t){os(this,IS,{writable:true,value:void 0});let[r,o,n,a,i]=Fd(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,Jr(this);}},FS=new WeakMap,Hn=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 Ed(this,t)}subtract(t){return Ff(this,t)}set(t,r){return Vf(this,t,r)}cycle(t,r,o){return Bf(this,t,r,o)}toDate(){return Ef(this)}toString(){return Of(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-Td(t,this.timeZone).toDate().getTime()}constructor(...t){os(this,FS,{writable:true,value:void 0});let[r,o,n,a,i]=Fd(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,Jr(this);}};var Bd=new Map;function Vd(e){let{locale:t}=hd(),r=t+(e?Object.entries(e).sort((n,a)=>n[0]<a[0]?-1:1).join():"");if(Bd.has(r))return Bd.get(r);let o=new Intl.Collator(t,e);return Bd.set(r,o),o}function ps(e){let t=Vd({usage:"search",...e}),r=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=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=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 useMemo(()=>({startsWith:r,endsWith:o,contains:n}),[r,o,n])}var WS=({isEntering:e,isExiting:t,className:r})=>["max-w-[200px] group bg-action-default border border-action-default-hover text-[color:var(--color-action-default-text)] text-sm rounded-lg drop-shadow-lg will-change-transform px-3 py-1",e?"animate-in fade-in placement-bottom:slide-in-from-top-0.5 placement-top:slide-in-from-bottom-0.5 placement-left:slide-in-from-right-0.5 placement-right:slide-in-from-left-0.5 ease-out duration-200":"",t?"animate-out fade-out placement-bottom:slide-out-to-top-0.5 placement-top:slide-out-to-bottom-0.5 placement-left:slide-out-to-right-0.5 placement-right:slide-out-to-left-0.5 ease-in duration-150":"",r].filter(Boolean).join(" ");function Lt({children:e,content:t,...r}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...r,offset:10,className:composeRenderProps(r.className,(o,n)=>WS({...n,className:o})),children:[jsx(OverlayArrow,{children:jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-action-default stroke-action-default-hover group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L4 4 L8 0"})})}),t]})]})}function sr(){let[e,t]=Ee__default.useState(false),r=Ee__default.useCallback((n,a)=>{t(true),a?.(n);},[]),o=Ee__default.useCallback((n,a)=>{t(false),a?.(n);},[]);return {isFocused:e,handleFocus:r,handleBlur:o}}var nt=Ee__default.forwardRef(({children:e,className:t},r)=>jsx("div",{ref:r,className:twMerge("relative w-full",t),children:e}));nt.displayName="InputWrapper";function Ba({onClick:e,size:t="md",className:r}){return jsx("button",{type:"button",onClick:o=>{o.preventDefault(),o.stopPropagation(),e();},className:twMerge("absolute right-2 top-[48%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary cursor-pointer",r),"aria-label":"Clear input",onMouseDown:o=>{o.preventDefault(),o.stopPropagation();},children:jsx(I,{name:"X",size:t==="sm"?16:20})})}function xo(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 Wf(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function GS(e){return e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":""}function ht(e){let{isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:a="md",className:i}=e;return twMerge("w-full",xo({isInvalid:t,isDisabled:r,isFocused:o}),Wf({transparent:n,isDisabled:r}),Le[a].text,Le[a].height,Le[a].padding,GS(a),i)}function US(e){let{size:t="md",isFocusWithin:r,isInvalid:o,isDisabled:n,transparent:a,className:i}=e;return twMerge("group flex items-center rounded-[var(--control-border-radius)] overflow-hidden",Wf({transparent:a,isDisabled:n}),Le[t].height,xo({isFocused:r,isInvalid:o,isDisabled:n}),i)}function Me({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,u=o&&n==="inline",d=jsxs("label",{htmlFor:s,className:twMerge(Le[t].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,a&&jsx("span",{children:"*"}),c&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(I,{name:"Info",size:t==="sm"?16:20})}),u&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:o})]});return c&&l?jsx(Lt,{content:l,children:d}):d}function Se({size:e="md",className:t,children:r,...o}){return jsx("div",{...o,className:twMerge("leading-[2.25] text-text-secondary",Le[e].text,t),children:r})}function pe({children:e,size:t="md",className:r}){return jsx("div",{role:"alert",className:twMerge(Le[t].text,"text-feedback-error-text",r),children:e})}function fs({size:e="md",isInvalid:t,isDisabled:r,isFocused:o,transparent:n,className:a,...i}){return jsx("input",{className:ht({isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:e,className:a}),...i})}function Gf(e){let{children:t,...r}=e;return jsx("div",{...r,className:US(e),children:typeof t=="function"?t(e):t})}function JS({children:e,...t}){return jsx(ListBox,{...t,className:Ce(t.className,"outline-0"),children:e})}var Yd=createContext("md");function jf(){return useContext(Yd)}function Wd(e="md"){let t=e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":"";return `flex-1 text-start data-[placeholder]:text-text-disabled overflow-hidden text-ellipsis whitespace-nowrap ${Le[e].text} ${t}`}function QS(){let e=Ee__default.useCallback((r,o)=>{o?.(r);},[]),t=Ee__default.useCallback((r,o)=>{o?.(r);},[]);return {handleFocus:e,handleBlur:t}}function Zo({label:e,description:t,errorMessage:r,children:o,items:n,renderItem:a,renderSelectedValue:i,size:s="md",selectedKey:c,defaultSelectedKey:l,onSelectionChange:u,placeholder:d,showErrors:m=false,tooltip:p,isRequired:g,transparent:f,reserveErrorSpace:b=false,placement:x="bottom start",shouldFlip:v=true,menuWidth:C="match",descriptionPlacement:y="below",useMobileTray:S=true,...k}){let[R,E]=useState(null),[D,L]=useState(null),[V,A]=useState(false),N=c??R??l,{handleFocus:T,handleBlur:z}=QS(),{isMobile:W}=Pt(),F=S&&W,K=Ee__default.useMemo(()=>!i||!N||!n?null:Array.from(n).find(B=>B.id===N)??null,[i,N,n]),X=w=>{u&&w!==null&&u(w),u||E(w);},G=useRef(null),Y=useRef(null),P=()=>{F&&A(!V);};return jsxs(Fragment,{children:[jsx(Select,{...k,selectedKey:N,defaultSelectedKey:l,onSelectionChange:X,placeholder:d,className:Ce(k.className,"group flex w-full flex-col"),ref:G,onOpenChange:w=>{F||(w&&Y.current?L(Y.current.offsetWidth):w||G.current?.blur());},children:({isDisabled:w,isInvalid:B,isOpen:M})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(Me,{size:s,tooltip:p,description:y==="tooltip"||y==="inline"?t:void 0,descriptionPlacement:y,isRequired:g,children:e}),jsx(nt,{children:jsx("div",{ref:Y,children:jsxs(Q,{variant:"unstyled",className:twMerge(ht({isInvalid:B||m&&!!r,isDisabled:w,isFocused:F?V:M,transparent:f,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:h=>T(h,k.onFocus),onBlur:h=>z(h,k.onBlur),onPress:F?P:void 0,"data-open":F?V:M,children:[i&&K?jsx("div",{className:Wd(s),children:i(K)}):F&&N?jsx("div",{className:Wd(s),children:n?Array.from(n).find(H=>H.id===N)?.label:String(N)}):jsx(SelectValue,{className:Wd(s)}),jsx(I,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] transition-transform",(F?V:M)&&"rotate-180")})]})})}),b?jsx("div",{className:"mt-1 min-h-[20px]",children:m?jsx(pe,{size:s,className:"text-feedback-error-text",children:typeof r=="function"&&k.validationResult?r(k.validationResult):typeof r=="string"?r:null}):t&&y==="below"?jsx(Se,{size:s,children:t}):null}):jsx(Fragment,{children:m?jsx(pe,{size:s,className:"mt-1 text-feedback-error-text",children:typeof r=="function"&&k.validationResult?r(k.validationResult):typeof r=="string"?r:null}):t&&y==="below"?jsx(Se,{size:s,className:"mt-1",children:t}):null}),F?null:jsx(Ze,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:C==="match"&&D?`${D}px`:void 0,minWidth:C==="auto"&&D?`${D}px`:void 0,maxWidth:C==="auto"?"min(600px, 90vw)":void 0},placement:x,shouldFlip:v,children:jsx(Yd.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:a&&n?h=>jsx(At,{id:h.id,textValue:h.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(h)})},h.id):o})})})]})}),F&&jsx(Xe,{isOpen:V,onClose:()=>A(false),title:e??"Select an option",contentPadding:false,children:jsx(Yd.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:N!=null?[N]:[],onSelectionChange:w=>{let B=Array.from(w)[0];B!=null&&(X(B),A(false));},children:a&&n?w=>jsx(At,{id:w.id,textValue:w.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(w)})},w.id):o})})})]})}function At({size:e,className:t,...r}){let o=jf(),n=e??o;return jsx(ListBoxItem,{...r,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-primary data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-default data-[focus-visible]:ring-inset data-[selected]:bg-background-selected data-[selected]:font-medium overflow-hidden",Le[n].paddingY,Le[n].text,t)})}var c1=[],d1={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},u1={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Zf={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},Jd=(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 p1(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 m1(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 hs({label:e,staticItems:t=c1,sections:r,selectedKey:o,defaultSelectedKey:n,onSelectionChange:a,requestConfig:i,defaultFilter:s,placeholder:c,errorMessage:l,description:u,size:d="md",tooltip:m,isRequired:p,isDisabled:g,isInvalid:f,validationResult:b,showErrors:x=true,renderItem:v,renderLeftIcon:C,renderSection:y,autoFocus:S=false,reserveErrorSpace:k=false,hideChevron:R=false,useMobileTray:E=true,className:D}){let L=Ee__default.useRef(null),V=Ee__default.useRef(null),[A,N]=Ee__default.useState(),[T,z]=useState(()=>Jd(o||n,t,r)),[W,F]=useState(false),[K,X]=useState(false),G=lo(T),{contains:Y}=ps({sensitivity:"base"}),[P,w]=useState(),{isMobile:B}=Pt(),M=E&&B,h=Le[d].text,O=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 m1(i,ue,ie):ge=await p1(i,ue,ie),w(ge.error),{items:ge.items}}catch(ge){return ge instanceof Error&&ge.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ge),w(ge instanceof Error?ge.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),H=i&&G!==""?O:null,j=false,oe=useRef("");useEffect(()=>{S&&F(true);},[S]),useEffect(()=>{let ie=Jd(o,t,r);ie!==T&&z(ie);},[o,t,r]),useEffect(()=>{let ie=()=>{L.current&&N(L.current.offsetWidth);};return ie(),window.addEventListener("resize",ie),()=>window.removeEventListener("resize",ie)},[]),useEffect(()=>{G===""?oe.current="":H&&G!==oe.current&&(oe.current=G,H.setFilterText(G));},[G,H]),j=Li(!!H?.isLoading,300);let me=Ee__default.useMemo(()=>{if(!M||!T)return H?H.items:t;let ie=H?H.items:t,ue=s||Y;return ie.filter(ge=>ue(ge.name,T))},[M,T,H,t,s,Y]),Z=ie=>{let ue=Jd(ie,t,r);z(ue),a&&a(ie);},ne=ie=>{z(ie);},Te=()=>{M&&X(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:Z,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:M?"manual":"focus",isDisabled:g,isInvalid:f||!!l,inputValue:T,onInputChange:ne,autoFocus:S&&!M,defaultFilter:s||Y,"aria-label":e||c||"Autocomplete",children:ie=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(Me,{size:d,tooltip:m,isRequired:p,children:e}),jsxs(nt,{ref:L,children:[C?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:C(j)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:j?jsx(Kr,{size:16,color:"text-text-secondary"}):jsx(I,{name:"MagnifyingGlass",className:`${d1[d]} text-text-secondary`})}),jsx(Input,{className:ht({isInvalid:f||!!l,isDisabled:g,isFocused:W||(M?K:ie.isOpen),size:d,className:twMerge(u1[d],T&&!g||!R&&!T?"pr-10":"pr-3",M&&"cursor-pointer",D)}),placeholder:c,disabled:g,onFocus:ue=>{F(true),M&&(ue.currentTarget.blur(),Te());},onBlur:()=>{F(false);},onClick:M?Te:void 0,readOnly:M,"aria-label":e||c||"Autocomplete"}),T&&!g&&jsx(Ba,{onClick:()=>{z(""),a?.(null);},size:d}),!R&&!T&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":"Toggle menu",isDisabled:g,children:({isPressed:ue})=>jsx(I,{name:ue?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),k?jsx("div",{className:"mt-1 min-h-[20px]",children:x&&P?jsx(pe,{size:d,className:"text-feedback-error-text",children:P}):x&&typeof l=="string"?jsx(pe,{size:d,className:"text-feedback-error-text",children:l}):x&&typeof l=="function"&&b?jsx(pe,{size:d,className:"text-feedback-error-text",children:l(b)}):u?jsx(Se,{size:d,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(Se,{size:d,className:"mt-1",children:u}),x&&P&&jsx(pe,{size:d,className:"text-feedback-error-text mt-1",children:P}),x&&typeof l=="string"&&jsx(pe,{size:d,className:"text-feedback-error-text mt-1",children:l}),x&&typeof l=="function"&&b&&jsx(pe,{size:d,className:"text-feedback-error-text mt-1",children:l(b)})]}),!M&&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:A?`${A}px`:void 0},children:jsx(ListBox,{"aria-label":e||c||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${h}`,children:r?r.map(ue=>{let ge=ue.items.map($=>jsx(At,{id:$.id,textValue:$.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${Zf[d]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:v?v($):jsxs(Fragment,{children:[$.name,jsx(I,{name:"X",className:"ml-auto h-4 w-4 text-text-secondary opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},$.id));if(y){let $=y(ue,ge);return Ee__default.isValidElement($)&&$.type===ListBoxSection?$:jsx(ListBoxSection,{children:$},ue.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:ue.name}),ge]},ue.name)}):ue=>jsx(At,{id:ue.id,textValue:ue.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${Zf[d]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:v?v(ue):jsxs(Fragment,{children:[ue.name,jsx(I,{name:"X",className:"ml-auto h-4 w-4 text-text-secondary opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},ue.id)})})]})}),M&&jsx(Xe,{isOpen:K,onClose:()=>X(false),title:e??c??"Search",contentPadding:false,height:"80vh",children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"p-4 border-b border-border-default",children:jsxs(nt,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:j?jsx(Kr,{size:16,color:"text-text-secondary"}):jsx(I,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:V,type:"text",value:T,onChange:ie=>ne(ie.target.value),placeholder:c,autoFocus:true,className:ht({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),T&&jsx(Ba,{onClick:()=>{z(""),a?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||c||"Suggestions",items:me,selectedKeys:o?[o]:[],selectionMode:"single",onSelectionChange:ie=>{let ue=Array.from(ie)[0];ue&&(Z(ue),X(false));},className:"bg-background-input outline-none",children:ie=>jsx(At,{id:ie.id,textValue:ie.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:v?v(ie):ie.name},ie.id)})})]})})]})}function Zr({src:e,alt:t,firstName:r,lastName:o,fullName:n,onClick:a,size:i="md",shape:s="circle",variant:c="user",className:l,status:u,bordered:d=false,piiEntity:m}){let[p,g]=useState(false),f=useCallback(()=>g(true),[]);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"},C={online:"bg-feedback-success-background border-feedback-success-border",offline:"bg-text-secondary border-border-muted",away:"bg-feedback-warning-background border-feedback-warning-border",busy:"bg-feedback-error-background border-feedback-error-border"},y={user:"bg-feedback-info-background text-feedback-info-text",team:"bg-feedback-info-background text-feedback-info-text",organization:"bg-feedback-success-background text-feedback-success-text"},S=s==="circle"?"rounded-full":"rounded-md",k=twMerge("relative inline-flex items-center justify-center overflow-hidden transition-opacity outline-none",b[i],S,a&&"cursor-pointer hover:opacity-80",d&&"ring-2 ring-background-surface",l),E=(()=>{if(r||o){let A=r?.[0]||"",N=o?.[0]||"";return (A+N).toUpperCase()}if(n){let A=n.split(" "),N=A[0]?.[0]||"",T=A[A.length-1]?.[0]||"";return N===T?N.toUpperCase():(N+T).toUpperCase()}return ""})(),D=()=>{let A={xs:14,sm:16,md:20,lg:24,xl:32}[i];switch(c){case "team":return jsx(Users,{size:A});case "organization":return jsx(Building2,{size:A});default:return jsx(User,{size:A})}},L=A=>{if(m)return c==="organization"?A?"organization-logo":"initials":A?"avatar":"initials"},V=()=>e&&!p?jsx("img",{src:e,alt:t||n||"Avatar",className:"h-full w-full object-cover",onError:f,"data-pii-type":L(true),"data-pii-entity":m}):E?jsx("span",{className:"font-semibold","data-pii-type":L(false),"data-pii-entity":m,children:E}):D();return jsxs("div",{className:"relative inline-block",children:[jsx("div",{"data-avatar":true,className:twMerge(k,!e||p?y[c]:""),onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,children:V()}),u&&jsx("span",{className:twMerge("absolute border-2 border-background-surface",S,x[i],v[i],C[u]),"aria-label":`Status: ${u}`})]})}var C1={default:"bg-feedback-info-background text-feedback-info-text",success:"bg-feedback-success-background text-feedback-success-text",error:"bg-feedback-error-background text-feedback-error-text",warning:"bg-feedback-warning-background text-feedback-warning-text",info:"bg-feedback-info-background text-feedback-info-text",primary:"bg-action-primary/10 text-action-primary border border-action-primary/20",brand:"bg-action-primary/10 text-action-primary border border-action-primary/20",secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border border-border-muted",neutral:"bg-background-muted text-text-secondary",charging:"bg-state-charging text-state-charging-text",discharging:"bg-state-discharging text-state-discharging-text",heat:"bg-state-heat text-state-heat-text",cool:"bg-state-cool text-state-cool-text",eco:"bg-state-eco text-state-eco-text",auto:"bg-state-auto text-state-auto-text",on:"bg-state-on text-state-on-text",off:"bg-state-off text-state-off-text",idle:"bg-state-idle text-state-idle-text",unknown:"bg-state-unknown text-state-unknown-text",connected:"bg-feedback-success-background text-feedback-success-text",disconnected:"bg-feedback-error-background text-feedback-error-text",importing:"bg-state-importing text-state-importing-text",exporting:"bg-state-exporting text-state-exporting-text"},S1={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"},w1={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"},N1={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&&jsx("span",{className:twMerge("rounded-full bg-current opacity-75",N1[r],i&&"animate-pulse"),"aria-hidden":"true"});return jsxs("span",{className:twMerge("inline-flex items-center gap-1.5 font-medium",S1[r],w1[o],C1[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="secondary",onClick:i,asButton:s=false,onPress:c,showArrow:l=false,alwaysUnderlined:u=false,LinkComponent:d,"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=`${`${u?"underline decoration-1 underline-offset-4 decoration-current":"hover:underline hover:decoration-1 hover:underline-offset-4 hover:decoration-current"} cursor-pointer`} ${{primary:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",secondary:"text-text-link-default hover:text-text-link-hover visited:text-text-link-default",muted:"text-text-secondary hover:text-text-secondary visited:text-text-secondary",unstyled:""}[a==="brand"?"primary":a==="default"?"secondary":a]} ${r}`,S=jsxs(Fragment,{children:[t,l&&jsxs("span",{children:["\xA0","\u2192"]})]});return s?jsx("button",{type:"button",className:y,onClick:c,title:n,...g,children:S}):d&&e?jsx(d,{href:e,className:y,title:n,onClick:i,...f,...g,children:S}):jsx("a",{href:e||"#",className:y,...f,...g,title:n,onClick:i,children:S})};var I1={info:{subtle:{container:"bg-feedback-info-background border-l-4 border-l-feedback-info-border",iconColor:"text-feedback-info-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-info-border border-feedback-info-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:Info},success:{subtle:{container:"bg-feedback-success-background border-l-4 border-l-feedback-success-border",iconColor:"text-feedback-success-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-success-border border-feedback-success-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:CheckCircle},warning:{subtle:{container:"bg-feedback-warning-background border-l-4 border-l-feedback-warning-border",iconColor:"text-feedback-warning-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-warning-border border-feedback-warning-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:AlertCircle},error:{subtle:{container:"bg-feedback-error-background border-l-4 border-l-feedback-error-border",iconColor:"text-feedback-error-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-error-border border-feedback-error-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:XCircle},discovery:{subtle:{container:"bg-background-muted border-l-4 border-l-action-brand",iconColor:"text-action-brand",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-action-brand border-action-brand",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:Lightbulb}};function vs({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:u,testId:d}){let m=I1[e],p=m[t],g=m.icon,f=!!(i||s),b=!!(r||o);return jsxs("div",{className:twMerge("flex gap-3 rounded-sm border p-4",p.container,u),role:"region","aria-live":"polite","data-testid":d,children:[!l&&jsx("div",{className:twMerge("flex-shrink-0",p.iconColor),"aria-hidden":"true",children:c||jsx(g,{className:"h-5 w-5"})}),jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:[b&&jsxs("div",{className:"flex-1",children:[r&&jsx("div",{className:Dt(et("headingSm"),p.titleColor),children:r}),o&&jsx("div",{className:Dt(et("bodySm"),r?"mt-1":"",p.bodyColor),children:o})]}),f&&jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i&&(i.asLink?jsx(Ue,{asButton:true,onPress:i.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-text-inverse hover:text-text-inverse/80":"",children:i.label}):jsx(Q,{size:"sm",variant:"primary",onPress:i.onPress,className:t==="bold"?"bg-background-surface text-text-primary hover:bg-background-surface/90":"",children:i.label})),s&&(s.asLink?jsx(Ue,{asButton:true,onPress:s.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-text-inverse hover:text-text-inverse/80":"",children:s.label}):jsx(Q,{size:"sm",variant:"secondary",onPress:s.onPress,className:t==="bold"?"border-text-inverse/30 text-text-inverse hover:bg-text-inverse/10":"",children:s.label}))]})]}),n&&jsx("button",{type:"button",onClick:a,className:twMerge("flex h-8 w-8 flex-shrink-0 items-center justify-center self-start rounded-md transition-colors hover:bg-background-modal/10",p.iconColor,Oe()),"aria-label":"Dismiss banner",children:jsx(X,{className:"h-4 w-4"})})]})}function Qf({isOpen:e=true,position:t="sticky",className:r,...o}){let n=t==="fixed"?"fixed top-0 left-0 right-0 z-50":"sticky top-0 z-50",a=r?`${r} !rounded-none`:"!rounded-none";return jsx(AnimatePresence,{children:e&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:n,children:jsx(vs,{...o,className:a})})})}function ho({value:e,children:t,className:r,size:o="sm",iconPosition:n="right"}){let[a,i]=useState(false),l=jsx(Q,{variant:"icon",size:o,onPress:()=>{let d=e||(typeof t=="string"?t:"");navigator.clipboard.writeText(d),i(true),setTimeout(()=>{i(false);},2e3);},className:"!px-2 relative",style:{top:"0.5px"},children:jsx(I,{name:"Copy",size:o==="sm"?14:16})}),u=a?jsx(Lt,{content:"Copied!",children:l}):l;return jsxs("div",{className:twMerge("inline-flex items-center gap-0.5",r),children:[n==="left"&&u,t,n==="right"&&u]})}function Cs(e){let{children:t,maxWidth:r=600,className:o,...n}=e,{ref:a,width:i}=En(),[s,c]=Ee__default.useState(false),[l,u]=Ee__default.useState(false),d=Ee__default.useRef(false),m=Ee__default.useMemo(()=>t&&!e.items&&typeof t!="function"?Ee__default.Children.toArray(t):null,[t,e.items]);if(Ee__default.useEffect(()=>{m&&m.length>=4&&i>0&&!d.current?(d.current=true,c(i>r),u(true)):(!m||m&&m.length<4)&&u(true);let p=setTimeout(()=>{l||u(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(Ee__default.isValidElement(x)){let v=x.props;if(typeof v.children=="string")return {label:v.children,href:v.href}}return {label:"..."}});return jsxs(Breadcrumbs,{...n,ref:a,className:twMerge("flex gap-2",l?"opacity-100":"opacity-0",o),children:[p,jsx(H1,{items:b}),f]})}return jsx(Breadcrumbs,{...n,ref:a,className: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 jsx(Breadcrumb,{className:"flex items-center gap-2",children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(zn,{items:t,align:"left",size:"sm",children:jsx(Q,{variant:"icon",size:"sm",icon:"DotsThree","aria-label":"Show hidden breadcrumbs",className:"px-0.5"})}),jsx(ChevronRight,{className:"h-4 w-4 text-text-secondary"})]})})}function Ss(e){let{className:t,children:r,href:o,copyable:n,copyValue:a,...i}=e;return jsx(Breadcrumb,{className:Ce(t,"flex items-center gap-2"),...i,children:s=>{let c=s.isCurrent,l=typeof r=="function"?r(s):r;return jsx(Fragment,{children:c?n?jsx(ho,{value:a||(typeof l=="string"?l:void 0),size:"sm",iconPosition:"right",children:jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-primary sm:max-w-none",children:l})}):jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-primary sm:max-w-none",children:l}):jsxs(Fragment,{children:[jsx(Ue,{variant:"muted",href:o,className:"max-w-[150px] truncate sm:max-w-[300px] md:max-w-none",children:l}),jsx(ChevronRight,{className:"h-4 w-4 shrink-0 text-text-secondary"})]})})}})}function X1({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-inverse invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):r.push("text-text-primary hover:bg-background-hover pressed:bg-background-selected"),r.join(" ")}function Wn({errorMessage:e,...t}){return jsxs(Calendar,{...t,children:[jsx(ws,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Ns,{}),jsx(CalendarGridBody,{children:r=>jsx(CalendarCell,{date:r,className:({isSelected:o,isDisabled:n})=>`${X1({isSelected:o,isDisabled:n})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function ws(){let{direction:e}=useLocale(),t=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(Q,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(I,{name:"CaretRight","aria-hidden":true,size:t}):jsx(I,{name:"CaretLeft","aria-hidden":true,size:t})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsx(Q,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(I,{name:"CaretLeft","aria-hidden":true,size:t}):jsx(I,{name:"CaretRight","aria-hidden":true,size:t})})]})}function Ns(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}var ng=Ee.createContext(null);function yo(){let e=Ee.useContext(ng);if(!e)throw new Error("Carousel components must be used within a CarouselRoot");return e}function ag({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:u=1,className:d,children:m,...p}){let g=e!==void 0,[f,b]=Ee.useState(t),x=g?e:f,v=Ee.useRef(null),[C,y]=Ee.useState(0),[S,k]=Ee.useState(typeof a=="boolean"?a:!!a),[R,E]=Ee.useState(false),D=Ee.useRef(null),L=Ee.useRef(null),V=typeof a=="object"&&a!==null&&a.delay?a.delay:i;Ee.useEffect(()=>{if(v.current){let h=Math.max(1,Math.floor(Number(l)||1)),O=v.current.children;if(O.length===0){y(0);return}let H=Math.ceil(O.length/h);y(H);}},[m,l]);let A=Ee.useRef(-1);Ee.useEffect(()=>{if(x!==A.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"}),A.current=x);}},[x,l,o]);let N=Ee.useCallback(h=>{let O=h;n?O<0?O=C-1:O>=C&&(O=0):O=Math.max(0,Math.min(h,C-1)),g||b(O),r?.(O);},[g,n,r,C]),T=Ee.useCallback(()=>{N(x+u);},[x,N,u]),z=Ee.useCallback(()=>{N(x-u);},[x,N,u]),W=Ee.useRef(T);Ee.useEffect(()=>{W.current=T;},[T]);let F=C>0&&(n||x<C-1),K=C>0&&(n||x>0),X=Ee.useCallback(()=>{k(h=>!h);},[]);Ee.useEffect(()=>{if(S&&C>1)return D.current=setInterval(()=>{W.current();},V),()=>{D.current&&(clearInterval(D.current),D.current=null);}},[S,C,V]);let G=Ee.useCallback(()=>{D.current&&(clearInterval(D.current),D.current=null);},[]),Y=Ee.useCallback(()=>{S&&C>1&&(D.current=setInterval(()=>{W.current();},V));},[S,C,V]),P=Ee.useCallback(h=>{if(!s)return;E(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;L.current={x:O,y:H};},[s]),w=Ee.useCallback(h=>{if(!R||!L.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-L.current.x,oe=H-L.current.y,me=50;o==="horizontal"&&Math.abs(j)>me?(j>0?z():T(),E(false),L.current=null):o==="vertical"&&Math.abs(oe)>me&&(oe>0?z():T(),E(false),L.current=null);},[R,o,T,z]),B=Ee.useCallback(()=>{E(false),L.current=null;},[]),M={currentPage:x,totalPages:C,orientation:o,loop:n,spacing:c,slidesPerView:l,goToPage:N,goToNext:T,goToPrev:z,canGoNext:F,canGoPrev:K,isAutoplayActive:S,toggleAutoplay:X,itemsRef:v,isDragging:R,allowMouseDrag:s,handleDragStart:P,handleDragMove:w,handleDragEnd:B};return jsx(ng.Provider,{value:M,children:jsx("div",{...p,className:twMerge("relative w-full",o==="vertical"?"h-full":"",d),onMouseEnter:G,onMouseLeave:Y,children:m})})}function ig({className:e,children:t,...r}){let{itemsRef:o,orientation:n,spacing:a,isDragging:i,allowMouseDrag:s,handleDragStart:c,handleDragMove:l,handleDragEnd:u}=yo();return jsx("div",{ref:o,...r,className:twMerge("flex overflow-x-auto overflow-y-hidden snap-x snap-mandatory scrollbar-hide scroll-smooth",n==="vertical"&&"flex-col overflow-y-auto overflow-x-hidden snap-y",s&&i&&"cursor-grabbing select-none",s&&!i&&"cursor-grab",e),style:{gap:a,"--carousel-spacing":a,...r.style},onMouseDown:c,onMouseMove:l,onMouseUp:u,onMouseLeave:u,onTouchStart:c,onTouchMove:l,onTouchEnd:u,children:t})}function sg({index:e,className:t,children:r,...o}){let{orientation:n,slidesPerView:a}=yo();return jsx("div",{...o,"data-index":e,className:twMerge("shrink-0 snap-start",n==="horizontal"?"h-full":"w-full",t),style:{width:n==="horizontal"?`calc((100% - (${a-1} * var(--carousel-spacing, 1rem))) / ${a})`:void 0,height:n==="vertical"?`calc((100% - (${a-1} * var(--carousel-spacing, 1rem))) / ${a})`:void 0,...o.style},children:r})}function lg({className:e,children:t,...r}){return jsx("div",{...r,className:twMerge("flex items-center justify-center gap-4 mt-4",e),children:t})}function cg({className:e,children:t,...r}){let{goToPrev:o,canGoPrev:n}=yo();return jsx("button",{type:"button",...r,onClick:a=>{o(),r.onClick?.(a);},disabled:!n||r.disabled,"aria-label":"Previous slide",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(I,{name:"CaretLeft",size:"sm"})})}function dg({className:e,children:t,...r}){let{goToNext:o,canGoNext:n}=yo();return jsx("button",{type:"button",...r,onClick:a=>{o(),r.onClick?.(a);},disabled:!n||r.disabled,"aria-label":"Next slide",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(I,{name:"CaretRight",size:"sm"})})}function eu({index:e,className:t,children:r,...o}){let{currentPage:n,goToPage:a}=yo(),i=n===e;return jsx("button",{type:"button",...o,onClick:s=>{a(e),o.onClick?.(s);},"aria-label":`Go to slide ${e+1}`,"aria-current":i,className:twMerge("h-2 rounded-full transition-all duration-200",i?"w-6 bg-action-brand":"w-2 bg-border-muted hover:bg-border-input","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",t),children:r})}function ug({className:e,...t}){let{totalPages:r}=yo();return jsx("div",{...t,className:twMerge("flex items-center gap-2",e),role:"group","aria-label":"Carousel indicators",children:Array.from({length:r},(o,n)=>jsx(eu,{index:n},n))})}function pg({className:e,children:t,...r}){let{isAutoplayActive:o,toggleAutoplay:n}=yo();return jsx("button",{type:"button",...r,onClick:a=>{n(),r.onClick?.(a);},"aria-label":o?"Pause autoplay":"Start autoplay",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(I,{name:o?"Pause":"Play",size:"sm"})})}function mg({className:e,...t}){let{currentPage:r,totalPages:o}=yo();return jsxs("div",{...t,className:twMerge("text-sm text-text-secondary tabular-nums",e),"aria-live":"polite","aria-atomic":"true",children:[r+1," / ",o]})}var o2="focus:ring-action-primary",n2="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function tu(e){return jsxs(CheckboxGroup,{...e,className:Ce(e.className,"flex flex-col gap-2"),children:[jsx(Me,{children:e.label}),e.children,e.description&&jsx(Se,{children:e.description}),jsx(pe,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function a2({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function i2({isSelected:e,isInvalid:t,isDisabled:r,isIndeterminate:o}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",a=o2,i="";return r?i="border-border-muted bg-background-muted":t?i="border-feedback-error-border bg-feedback-error-background":e||o?i=n2:i="bg-background-input border-border-input hover:border-border-focus",`${n} ${a} ${i}`}var fg="w-4 h-4 text-current group-disabled:text-text-disabled";function _o(e){let{children:t,variant:r,...o}=e;return jsx(Checkbox,{...o,className:composeRenderProps(e.className,(n,a)=>`${a2(a)} ${n||""}`),children:n=>{let{isSelected:a,isIndeterminate:i,...s}=n,c=jsx("div",{className:i2({isSelected:a,isIndeterminate:i,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:fg}):a?jsx(Check,{"aria-hidden":true,className:fg}):null});return jsxs(Fragment,{children:[c,typeof t=="function"?t(n):t]})}})}var c2={primary:"bg-action-primary/10 text-action-primary border border-action-primary/20 hover:bg-action-primary/15",secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border border-border-muted hover:bg-action-secondary-hover",info:"bg-feedback-info-background text-feedback-info-text border border-feedback-info-border hover:bg-feedback-info-background/80"};function bg(e){return !e||e==="default"?"secondary":e==="brand"?"primary":e}var d2={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"},u2="opacity-75 cursor-not-allowed pointer-events-none";function xg(e){let{variant:t,size:r,isDisabled:o,isClickable:n,className:a}=e,i=r==="xs"?"text-xs":Le[r].text;return twMerge("inline-flex items-center justify-center rounded-full font-medium transition-colors","whitespace-nowrap select-none",d2[r],i,c2[t],n&&!o&&"cursor-pointer",o&&u2,a)}function Ar({children:e,onRemove:t,size:r="md",variant:o="secondary",isRemovable:n=true,isDisabled:a=false,className:i,onClick:s}){let c=!!s&&!a,l=n&&t&&!a,u=f=>{f.stopPropagation(),f.preventDefault(),t&&!a&&t();},d=()=>{s&&!a&&s();},m=r==="xs"?10:r==="sm"?12:r==="md"?14:16,g=jsxs(Fragment,{children:[jsx("span",{className:"truncate",children:e}),l?c?jsx("span",{onClick:u,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u(f));},role:"button",tabIndex:0,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":"Remove",children:jsx(I,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):jsx("button",{type:"button",onClick:u,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":"Remove",tabIndex:-1,children:jsx(I,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):null]});return c?jsx("button",{type:"button",onClick:d,className:xg({variant:bg(o),size:r,isDisabled:a,isClickable:c,className:i}),disabled:a,children:g}):jsx("span",{className:xg({variant:bg(o),size:r,isDisabled:a,isClickable:c,className:i}),children:g})}function vg({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:u=[],onItemsChange:d,staticItems:m,fetchSuggestions:p,chipVariant:g="secondary",showErrors:f=true,className:b}){let[x,v]=useState(""),[C,y]=useState([]),[S,k]=useState(false),[R,E]=useState(false),[D,L]=useState(-1),V=lo(x,300),A=useRef(null),N=useRef(null),{isFocused:T,handleFocus:z,handleBlur:W}=sr(),F=useId(),K=useCallback(M=>{if(!d||!M.trim())return;let h=M.trim();if(u.includes(h)){v(""),E(false),y([]),L(-1);return}d([...u,h]),v(""),E(false),y([]),L(-1),A.current?.focus();},[u,d]),X=useCallback(M=>{d&&d(u.filter(h=>h!==M));},[u,d]);useEffect(()=>{if(!p)return;let M=true;return (async()=>{let O=V.trim();if(!O){M&&(k(false),y([]),E(false));return}k(true);try{let H=await p(O);if(!M)return;y(H),E(!0);}catch(H){if(!M)return;console.error("Error fetching suggestions:",H),y([]),E(false);}finally{M&&k(false);}})(),()=>{M=false;}},[V,p]),useEffect(()=>{if(p||!m)return;if(!V.trim()){y([]),E(false);return}let M=m.filter(h=>h.name.toLowerCase().includes(V.toLowerCase())).map(h=>h.id);y(M),E(M.length>0||V.trim().length>0);},[V,m,p]);let G=useMemo(()=>{let M=C.filter(h=>!u.includes(h));return x.trim()&&!M.includes(x.trim())&&!u.includes(x.trim())?[...M,`Create tag: "${x.trim()}"`]:M},[C,x,u]),Y=useCallback(M=>{v(M.target.value),L(-1),M.target.value&&E(true);},[]),P=useCallback(M=>{i||(M.startsWith("Create tag:")?K(x):K(M));},[K,x,i]),w=useCallback(M=>{if(!i)switch(M.key){case "Enter":case ",":if(M.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&&u.length>0&&(M.preventDefault(),X(u[u.length-1]));break;case "ArrowDown":M.preventDefault(),R&&L(h=>h<G.length-1?h+1:h);break;case "ArrowUp":M.preventDefault(),R&&L(h=>h>0?h-1:-1);break;case "Escape":E(false),L(-1);break}},[i,x,u,G,D,R,K,X]);useEffect(()=>{let M=h=>{N.current&&h.target instanceof Node&&!N.current.contains(h.target)&&E(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]);let B=()=>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]",xo({isInvalid:s,isDisabled:i,isFocused:T}),"bg-background-input",o==="sm"&&"px-2 py-1 h-[32px]",o==="md"&&"px-2.5 py-1.5 h-[40px]",o==="lg"&&"px-3 py-2 h-[44px]",o==="xl"&&"px-3.5 py-2.5 h-[48px]",i&&"opacity-50 cursor-not-allowed bg-background-muted");return jsxs("div",{ref:N,className:twMerge("relative flex flex-col gap-1",b),children:[e&&jsx(Me,{size:o,tooltip:n,isRequired:a,children:e}),jsx(nt,{children:jsxs("div",{className:B(),onClick:()=>!i&&A.current?.focus(),children:[u.map(M=>jsx(Ar,{variant:g,size:"xs",onRemove:()=>X(M),isDisabled:i,className:"shrink-0 max-h-full",children:M},M)),jsx("input",{ref:A,type:"text",role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":F,"aria-autocomplete":"list",value:x,onChange:Y,onKeyDown:w,onFocus:M=>z(M),onBlur:M=>W(M),placeholder:u.length===0?l:"",disabled:i,className:"flex-1 min-w-[120px] h-full !border-0 !outline-none !ring-0 bg-transparent text-text-primary text-sm placeholder:text-text-disabled disabled:cursor-not-allowed focus:!ring-0 focus:!outline-none focus:!border-0 focus-visible:!ring-0 focus-visible:!outline-none focus-visible:!border-0",style:{boxShadow:"none",WebkitAppearance:"none",appearance:"none",border:"none",outline:"none"}})]})}),R&&(x||G.length>0)&&jsx("div",{id:F,role:"listbox",className:twMerge("absolute z-50 mt-1 rounded-lg border border-border-default","max-h-60 overflow-auto bg-background-surface shadow-lg","left-0 right-0 top-full"),children:S?jsx("div",{className:"px-3 py-2 text-sm text-text-secondary",children:"Loading..."}):G.length>0?G.map((M,h)=>jsx("div",{role:"option","aria-selected":h===D,className:twMerge("cursor-pointer px-3 py-2 text-sm transition-colors","hover:bg-background-hover",h===D&&"bg-background-selected",M.startsWith("Create tag:")&&"italic text-text-secondary"),onClick:()=>P(M),children:M},M)):x&&jsx("div",{className:"px-3 py-2 text-sm text-text-secondary",children:"No suggestions found"})}),t&&jsx(Se,{size:o,className:"mt-1",children:t}),f&&typeof r=="string"&&jsx(pe,{size:o,className:"text-feedback-error-text mt-1",children:r}),f&&typeof r=="function"&&c&&jsx(pe,{size:o,className:"text-feedback-error-text mt-1",children:r(c)})]})}var C2={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')},S2={github:()=>import('ace-builds/src-noconflict/theme-github'),github_dark:()=>import('ace-builds/src-noconflict/theme-github_dark')},w2={"ext-language-tools":()=>import('ace-builds/src-noconflict/ext-language_tools')},Ha=new Set;async function ou(e,t){Ha.has(e)||(await t(),Ha.add(e));}async function N2(e,t,r){await Promise.all([ou(`language:${e}`,C2[e]),ou(`theme:${t}`,S2[t]),r?ou("extension:language-tools",w2["ext-language-tools"]):void 0]);}function Sg(e,t,r){let o=Ha.has(`language:${e}`)&&Ha.has(`theme:${t}`);return r?o&&Ha.has("extension:language-tools"):o}function wg({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:u=50,showLineNumbers:d=true,showGutter:m=true,fontSize:p=14,wrapEnabled:g=false}){let f=useRef(null),[b,x]=useState(()=>Sg(o,n,!t)),v=useMemo(()=>{if(a)return a;let C=(e.match(/\n/g)||[]).length+1;return `${Math.max(l,Math.min(C,u))*c+10}px`},[e,a,c,l,u]);return useEffect(()=>{let C=false,y=!t;return Sg(o,n,y)?(x(true),()=>{C=true;}):(x(false),N2(o,n,y).then(()=>{C||x(true);}).catch(S=>{C||x(true),console.error("Failed to load Ace editor resources",S);}),()=>{C=true;})},[o,t,n]),useEffect(()=>{b&&f.current?.editor&&f.current.editor.resize();},[v,b]),jsx("div",{className:twMerge("overflow-hidden rounded-md border border-border-input",s),style:{width:i,height:v},children:b?jsx(y2,{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:d,tabSize:2,enableBasicAutocompletion:!t,enableLiveAutocompletion:!t,enableSnippets:!t,showFoldWidgets:true,wrap:g},editorProps:{$blockScrolling:true}}):jsx("div",{className:"flex h-full w-full items-center justify-center bg-surface-muted text-foreground-muted",children:"Loading editor\u2026"})})}var Tg=Ee.createContext({variant:"contained",density:"comfortable",showDividers:true}),kg=Ee.createContext(null),D2={contained:"rounded-lg border border-border-default bg-background-surface overflow-hidden",bordered:"rounded-lg border border-border-default bg-background-surface",plain:"bg-transparent"},Ng={true:"divide-y divide-border-default",false:"gap-3"},M2={comfortable:"px-5 py-3",compact:"px-4 py-2.5"},E2={comfortable:"px-5 pt-0",compact:"px-4 pt-0"},L2={comfortable:"h-4 w-4",compact:"h-3.5 w-3.5"};function su(){return Ee.useContext(Tg)}function A2(e){let t=Ee.useContext(kg);if(!t)throw new Error(`${e} must be used within a <CollapseItem>`);return t}function I2({variant:e,showDividers:t,className:r}){let o="group/collapse-item w-full transition-colors",n={contained:"bg-background-surface",bordered:"bg-background-surface",plain:"bg-transparent"},a=t?"":"rounded-lg border border-border-default bg-background-surface overflow-hidden";return twMerge(o,n[e],a,r)}function F2({isDisabled:e,isPressed:t,density:r,variant:o,showDividers:n,className:a}){let i="group/collapse-header flex w-full items-start gap-4 text-left transition-colors duration-150",s=e?"cursor-not-allowed text-text-disabled":"cursor-pointer text-text-primary",c=t&&!e?"bg-background-hover":"",l=M2[r];return twMerge(i,Oe(),l,s,c,o==="plain"&&n?"px-0":"",a)}function B2({density:e,showDividers:t,className:r}){let o="text-text-primary",n=E2[e];return twMerge(o,n,t?"":"rounded-b-lg",r)}function Gn({variant:e="contained",density:t="comfortable",showDividers:r=true,className:o,...n}){let a=Ee.useMemo(()=>({variant:e,density:t,showDividers:r}),[e,t,r]),i=twMerge("flex w-full flex-col",D2[e],r?Ng.true:Ng.false,e==="plain"&&r?"border-y border-border-default/60":"");return jsx(Tg.Provider,{value:a,children:jsx(DisclosureGroup,{...n,className:Ce(o,i)})})}function Co({className:e,children:t,...r}){let{variant:o,showDividers:n}=su();return jsx(Disclosure,{...r,className:composeRenderProps(e,a=>I2({variant:o,showDividers:n,className:a})),children:a=>jsx(kg.Provider,{value:a,children:t})})}Co.displayName="CollapseItem";function So({title:e,description:t,startContent:r,endContent:o,indicator:n,indicatorPosition:a="end",showIndicator:i=true,keepIndicatorSpace:s=false,children:c,className:l,...u}){let d=A2("CollapseHeader"),{density:m,variant:p,showDividers:g}=su(),f=L2[m];return jsx(Button,{...u,slot:"trigger","data-expanded":d.isExpanded?"true":void 0,className:composeRenderProps(l,(b,x)=>F2({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:d.isExpanded,isDisabled:x}):n??jsx(I,{name:"CaretDown",size:m==="compact"?"xs":"sm",weight:"bold","aria-hidden":"true",className:twMerge("text-text-secondary transition-transform duration-200",d.isExpanded?"rotate-180":"rotate-0")}):null,C=v?jsx("span",{className:twMerge("flex flex-shrink-0 items-center justify-center text-text-secondary",f),"aria-hidden":"true",children:v}):s?jsx("span",{className:twMerge("flex flex-shrink-0 items-center justify-center",f),"aria-hidden":"true"}):null;return jsxs("div",{className:"flex w-full items-center gap-4",children:[a==="start"&&C,r&&jsx("div",{className:"flex flex-shrink-0 items-center text-text-secondary",children:r}),jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[c??jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1 text-left",children:[e&&jsx("span",{className:"truncate font-medium text-text-primary",children:e}),t&&jsx("span",{className:"text-sm text-text-secondary",children:t})]}),o&&jsx("div",{className:"flex flex-shrink-0 items-center text-sm text-text-secondary",children:o})]}),a==="end"&&C]})}})}So.displayName="CollapseHeader";function wo({className:e,children:t,...r}){let{density:o,showDividers:n}=su();return jsx(DisclosurePanel,{...r,className:composeRenderProps(e,a=>B2({density:o,showDividers:n,className:a})),children:t})}wo.displayName="CollapseContent";function Un(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 cu(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 H2({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,transparent:i,className:s,validationResult:c,value:l,defaultValue:u,onChange:d,placeholder:m="#000000",showColorSwatch:p=true,reserveErrorSpace:g=true,...f}){let[b,x]=useState(u||""),[v,C]=useState(l||u||""),[y,S]=useState(false),[k,R]=useState(null),{isFocused:E,handleFocus:D,handleBlur:L}=sr(),V=l!==void 0?l:b;useEffect(()=>{l!==void 0&&C(l);},[l]);let A=V?!Un(V):false,N=useCallback(W=>{if(C(W),Un(W)){let F=cu(W);d?d(F):x(F);}else W===""&&(d?d(""):x(""));},[d]),T=useCallback(W=>{let F=cu(W);C(F),d?d(F):x(F);},[d]),z=useCallback(W=>{if(Un(v)){let F=cu(v);C(F),d&&F!==V?d(F):!d&&F!==b&&x(F);}L(W,f.onBlur);},[v,V,b,d,L,f.onBlur]);return jsx(TextField,{...f,isRequired:a,className:Ce(s,"group flex flex-col"),children:({isDisabled:W})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(Me,{size:o,tooltip:n,isRequired:a,children:e}),jsx(nt,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(fs,{size:o,disabled:W,type:"text",value:v,placeholder:m,onFocus:F=>D(F,f.onFocus),onBlur:z,onChange:F=>N(F.target.value),className:twMerge(ht({isInvalid:A,isDisabled:W,isFocused:E,size:o,transparent:i}),p?"pr-12":"pr-3","pl-3")}),p&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:Le[o].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",Un(V)?"border-border-default":"border-border-default bg-background-muted"),style:Un(V)?{backgroundColor:V}:void 0,"aria-hidden":"true",children:!Un(V)&&jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsx("div",{ref:R,children:jsx(Q,{variant:"secondary",size:o,icon:"Palette",onPress:()=>S(!y),isDisabled:W,className:"flex-shrink-0",children:"Pick"})})]})}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(pe,{size:o,children:r}):typeof r=="function"&&c?jsx(pe,{size:o,children:r(c)}):t?jsx(Se,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&c?jsx(pe,{size:o,className:"mt-1",children:r(c)}):t?jsx(Se,{size:o,className:"mt-1",children:t}):null}),y&&k&&jsx(Ze,{triggerRef:{current:k},isOpen:y,onOpenChange:S,placement:"bottom end",className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-lg p-4",children:jsxs("div",{className:"flex flex-col gap-4",children:[jsx(HexColorPicker,{color:V||"#000000",onChange:T,style:{width:"200px",height:"200px"}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:V||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:V||"#000000"})]})]})})]})})}function Dg({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:u="500px",minWidth:d="400px"}){return jsx(rr,{isOpen:e,onClose:t,title:o,maxWidth:u,minWidth:d,primaryAction:{label:a,onPress:()=>{r();},variant:s??(c?"destructive":"primary"),isLoading:l},secondaryAction:{label:i,onPress:t,variant:"secondary",isDisabled:l},children:jsx("div",{className:"text-text-primary",children:n})})}function Mg({isConnected:e,connectedAt:t,disconnectedAt:r,showTimestamp:o=false,isLoading:n,size:a="sm",shape:i="pill",...s}){if(n)return jsx(J,{className:"inline-flex h-6 w-24"});let c=e?"Connected":"Disconnected",l=e?"success":"neutral",u=null;if(o){if(e&&t)u=Vi(t);else if(!e&&r){let d=Vi(r);u=d?`Offline ${d}`:null;}}return jsxs("div",{className:"inline-flex flex-col gap-1",children:[jsx(Je,{variant:l,size:a,shape:i,dot:e,dotPulse:e,...s,children:c}),u&&jsx("span",{className:"text-xs text-text-secondary",children:u})]})}function Eg({firstName:e,lastName:t,email:r,phone:o,avatarUrl:n,href:a,LinkComponent:i,variant:s="outlined",layout:c="horizontal",showEmail:l=true,showPhone:u=false,isLoading:d=false,className:m,contentClassName:p,piiEntity:g}){let f=`${e} ${t}`.trim(),b=({children:v,className:C})=>a?i?jsx(i,{href:a,className:C,children:v}):jsx(Ue,{href:a,variant:"unstyled",className:twMerge("hover:underline",C),asButton:false,children:v}):jsx("span",{className:C,children:v}),x=c==="vertical";return d?jsx(Ae,{variant:s,className:twMerge("flex flex-col",m),children:jsx(Ae.Content,{className:"flex items-center flex-1",children:jsxs("div",{className:twMerge("w-full",x?"flex flex-col items-center gap-4":"flex items-center gap-4"),children:[jsx(J,{width:56,height:56,className:"rounded flex-shrink-0"}),jsxs("div",{className:twMerge(x?"w-full text-center":"flex-1","space-y-2"),children:[jsx(J,{width:"70%",height:20,className:twMerge(x&&"mx-auto")}),jsx(J,{width:"100%",height:16,className:twMerge(x&&"mx-auto")})]})]})})}):jsx(Ae,{variant:s,className:twMerge("group/card flex flex-col",m),children:jsx(Ae.Content,{className:twMerge("flex items-center flex-1",a&&"cursor-pointer",p),children:jsxs("div",{className:twMerge("relative w-full",x?"flex flex-col items-center gap-4 text-center":"flex items-center gap-4"),children:[jsx(Zr,{firstName:e,lastName:t,src:n,size:"xl",variant:"user",shape:"square",className:"flex-shrink-0",piiEntity:g}),jsxs("div",{className:twMerge(x?"w-full":"flex-1 min-w-0"),children:[a&&jsx(b,{className:"after:absolute after:inset-0",children:jsx("span",{className:"sr-only",children:f})}),jsx("span",{className:"text-lg font-semibold leading-tight text-text-primary block mb-1.5 group-hover/card:text-text-brand transition-colors","data-pii-type":g?"full-name":void 0,"data-pii-entity":g,children:f}),jsxs("div",{className:twMerge("space-y-0.5",x&&"flex flex-col items-center"),children:[l&&r&&jsxs("div",{className:"flex items-center gap-2.5 text-text-primary",children:[jsx(I,{name:"Envelope",size:16,className:"text-text-secondary flex-shrink-0"}),jsx(Ue,{href:`mailto:${r}`,variant:"unstyled",className:twMerge("text-sm leading-relaxed text-text-primary relative z-20",x?"":"truncate"),"data-pii-type":g?"email":void 0,"data-pii-entity":g,children:r})]}),u&&o&&jsxs("div",{className:"flex items-center gap-2.5 text-text-primary",children:[jsx(I,{name:"Phone",size:16,className:"text-text-secondary flex-shrink-0"}),jsx(Ue,{href:`tel:${o}`,variant:"unstyled",className:twMerge("text-sm leading-relaxed text-text-primary relative z-20",x?"":"truncate"),"data-pii-type":g?"phone":void 0,"data-pii-entity":g,children:Ln(o)})]})]})]})]})})})}function Ps({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:u=false,badge:d,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],C=`${e} ${t}`.trim(),S={strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[l],k=({children:R,className:E})=>i?s?jsx(s,{href:i,className:E,children:R}):jsx(Ue,{href:i,variant:c,className:twMerge("hover:underline",E),asButton:false,children:R}):jsx("span",{className:E,children:R});return p?n==="inline"?jsxs("div",{className:twMerge("flex items-center",v.gap,g),children:[jsx(J,{width:v.skeletonAvatar,height:v.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsx(J,{width:v.skeletonText,height:v.skeletonAvatar*.5})]}):jsxs("div",{className:twMerge("flex items-center",v.gap,g),children:[jsx(J,{width:v.skeletonAvatar,height:v.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx(J,{width:v.skeletonText,height:16}),u&&jsx(J,{width:v.skeletonSecondary,height:12})]})]}):n==="inline"?jsxs("div",{className:twMerge("flex items-center",v.gap,g),children:[jsxs(k,{className:twMerge("flex items-center",v.gap),children:[jsx(Zr,{firstName:e,lastName:t,src:o,size:v.avatarSize,variant:"user",shape:b,className:"flex-shrink-0",piiEntity:f}),jsx("span",{className:twMerge("leading-normal truncate hover:text-text-primary",S,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:C})]}),d]}):jsxs("div",{className:twMerge("flex items-center justify-start",v.gap,g),children:[jsx(Zr,{firstName:e,lastName:t,src:o,size:v.avatarSize,variant:"user",shape:b,className:"flex-shrink-0",piiEntity:f}),jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(k,{className:twMerge("leading-normal truncate hover:text-text-primary",S,v.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":f?"full-name":void 0,"data-pii-entity":f,children:C})}),d]}),u&&r&&jsx("div",{className:twMerge("text-text-secondary leading-normal truncate",v.secondaryTextSize),"data-pii-type":f?"email":void 0,"data-pii-entity":f,children:r})]})]})}var Lg={duration:.5,ease:"easeInOut"},To=createContext(null),on=()=>{let e=useContext(To);if(!e)throw new Error("useChartContext must be used within a ChartContextProvider");return e};var Ga=({data:e,color:t="var(--color-viz-default)"})=>{let r=useId(),o=useId(),{xScale:n,yScale:a,animationSettings:i}=on(),s=n.range(),c=a.range();return jsxs(Fragment,{children:[jsxs("defs",{children:[jsxs("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[jsx("stop",{offset:"50%",stopColor:t,stopOpacity:.1}),jsx("stop",{offset:"100%",stopColor:t,stopOpacity:0})]}),jsx("clipPath",{id:o,children:jsx("rect",{x:s[0],y:c[1],width:s[1]-s[0],height:c[0]-c[1]})})]}),jsx("g",{clipPath:`url(#${o})`,children:jsxs(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:[jsx(AreaClosed,{data:e,x:l=>n(l.xValue),y:l=>a(l.yValue),yScale:a,fill:`url(#${r})`,curve:curveLinear}),jsx(LinePath,{data:e,x:l=>n(l.xValue),y:l=>a(l.yValue),stroke:t,strokeWidth:3,curve:curveLinear})]})})]})};var Kn=({data:e,color:t="var(--color-viz-default)",opacity:r=1,categoryColors:o={}})=>{let{xScale:n,yScale:a,animationSettings:i}=on(),s=useId(),c=n.range(),l=a.range(),u=[...e].sort((p,g)=>p.xValue.getTime()-g.xValue.getTime());if(u.length===0)return null;let d=u.length>1?u[1].xValue.getTime()-u[0].xValue.getTime():15*6e4,m=Math.abs(n(new Date(u[0].xValue.getTime()+d))-n(u[0].xValue));return jsxs(Fragment,{children:[jsx("defs",{children:jsx("clipPath",{id:s,children:jsx("rect",{x:c[0],y:l[1],width:c[1]-c[0],height:l[0]-l[1]})})}),jsx("g",{clipPath:`url(#${s})`,children:jsx(motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:i.duration,ease:i.ease},style:{transformOrigin:`0 ${a(0)}px`,isolation:"isolate"},children:u.map((p,g)=>{let f=n(p.xValue),b=a(p.yValue),x=a(0),v=Math.min(b,x),C=Math.abs(b-x),y=u[g+1],S=y?Math.abs(n(y.xValue)-f):m,k=p.category&&o[p.category]?o[p.category]:t;return jsx(Bar,{x:f-S/2,y:v,width:S,height:C,fill:k,opacity:r,rx:1},p.xValue.getTime())})})})]})};var Ir=Vp(ob()),ab=Vp(nb());var mw=["top","left","transform","className","children","innerRef"];function vu(){return vu=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},vu.apply(this,arguments)}function fw(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 Ua(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=fw(e,mw);return Ee__default.createElement("g",vu({ref:c,className:(0, ab.default)("visx-group",i),transform:a||"translate("+n+", "+r+")"},l),s)}Ua.propTypes={top:Ir.default.number,left:Ir.default.number,transform:Ir.default.string,className:Ir.default.string,children:Ir.default.node,innerRef:Ir.default.oneOfType([Ir.default.string,Ir.default.func,Ir.default.object])};var Ye={top:0,right:0,bottom:50,left:60};function $r(e={type:"number"}){let t=i=>{if(i==null)return "-";let s=kr({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=u=>{if(u==null)return "";if(typeof u=="string")return u;if(typeof u=="number")return u.toString();if(typeof u=="object"&&"props"in u){let d=u.props;if(d?.children)return Array.isArray(d.children)?d.children.map(c).join(""):c(d.children)}return ""};return c(s)||i.toString()}return i.toString()},r=i=>{if(i==null)return "-";if(typeof e=="string"){let s=kr({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 Cu=(e,t)=>{let r=extent(e,o=>o.xValue);return scaleTime({range:[Ye.left,t-Ye.right],domain:r,nice:true})},Su=(e,t,r)=>{let o=$r(r),n=min(e,c=>c.yValue)||0,a=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 scaleLinear({range:[t-Ye.bottom,Ye.top],domain:[i,s],nice:true})};function Cw(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 Us(e,t=12,r="system-ui"){return e.length===0?0:Math.max(...e.map(o=>Cw(o,t,r)))}function Ya(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Sw(e,t,r=12,o=false){if(!Ya(t[0])||!Ya(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=Zc({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)),u=Us(l,r),m=u+u,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 ww=({top:e,scale:t,width:r})=>{let o=t.domain(),n=[o[0],o[o.length-1]],a=Ya(n[0])&&Ya(n[1]),i=r<400,s=a?n[0].getTime():0,c=a?n[1].getTime():0,l=useMemo(()=>a?Zc({start:n[0],end:n[1]},{compact:i}):()=>"",[s,c,i,a]),u=useMemo(()=>Sw(r,n,12,i),[r,s,c,i]);return u.length===0?null:jsx(Axis,{orientation:"bottom",top:e,scale:t,tickValues:u,tickFormat:d=>{let m=d;return Ya(m)?l(m):""},stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:(d,m,p)=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:m===0?"start":m===p.length-1?"end":"middle"}),rangePadding:0})};function Ks(e,t=12){let r=t*2.5,o=Math.floor(e/r);return Math.max(2,Math.min(6,o))}var Nw=({left:e,scale:t,yFormatter:r,height:o})=>{let n=$r(r),a=useMemo(()=>!o||o<=0?5:Ks(o),[o]);return jsx(Axis,{orientation:"left",left:e,scale:t,numTicks:a,tickFormat:i=>(n.tickFormat||n.format)(i),stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"end",dy:"0.33em"})})},Tw=({top:e,scale:t})=>jsx(Axis,{orientation:"bottom",top:e,scale:t,stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"middle",dy:"0.25em"})}),kw=({left:e,scale:t})=>jsx(Axis,{orientation:"left",left:e,scale:t,stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"end",dx:"-0.25em",dy:"0.33em"})}),Pw=({top:e,scale:t,yFormatter:r,width:o})=>{let n=$r(r),a=useMemo(()=>{if(!o||o<=0)return 5;let s=Math.floor(o/60);return Math.max(2,Math.min(8,s))},[o]);return jsx(Axis,{orientation:"bottom",top:e,scale:t,numTicks:a,tickFormat:i=>(n.tickFormat||n.format)(i),stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"middle",dy:"0.25em"})})},Fr={Bottom:ww,Left:Nw,CategoryBottom:Tw,CategoryLeft:kw,NumericBottom:Pw};var qn=({data:e,formatter:t,label:r,categoryLabels:o})=>{if(!e)return null;let n=Ee__default.useContext(To),a=o??n?.categoryLabels,i=n?.xScale,s=$r(t),c=Ee__default.useRef(null),[l,u]=Ee__default.useState({x:0,y:0,translate:"translate(-50%, -100%)"});Ee__default.useEffect(()=>{if(!c.current)return;let b=c.current.getBoundingClientRect(),x=window.innerHeight,v=window.innerWidth,C=e.x,y=e.y,S=e.position==="left"?"translate(calc(-100% - 16px), -50%)":"translate(16px, -50%)";e.position==="left"&&C-b.width-16<0?S="translate(16px, -50%)":e.position==="right"&&C+b.width+16>v&&(S="translate(calc(-100% - 16px), -50%)"),y-b.height/2<0?y=b.height/2:y+b.height/2>x&&(y=x-b.height/2),u({x:C,y,translate:S});},[e.x,e.y,e.position]);let d=i?.domain(),p=d&&d.length===2&&d.every(f=>f instanceof Date)?jm({start:d[0],end:d[1]}):null,g=r||(p&&e.xValue instanceof Date?p(e.xValue):String(e.xValue));return jsx(AnimatePresence,{children:jsxs(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:[jsx("div",{className:"mb-1 font-medium text-text-primary",children:g}),e.isEvent?jsxs("div",{className:"space-y-2",children:[e.series.length>1&&jsx("ul",{className:"list-none p-0 border-b border-border-default pb-2",children:e.series.slice(0,-1).map(f=>jsxs("li",{className:"py-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"font-medium text-text-primary",children:[f.label,":"]}),jsx("span",{className:"text-text-secondary",children:s.format(f.value)})]}),f.category&&jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsx("div",{className:"h-3 w-3",style:{backgroundColor:f.categoryColor||f.color,borderRadius:"1px"}}),jsx("span",{className:"text-sm text-text-secondary",children:a?.[f.category]||f.category})]})]},f.label))}),(()=>{let f=e.series[e.series.length-1];return jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:f.color}}),jsx("span",{className:"font-medium text-text-primary",children:f.label})]}),e.eventMetadata&&Object.keys(e.eventMetadata).length>0&&jsx("div",{className:"ml-4 mt-1 space-y-0.5 text-xs text-text-secondary",children:Object.entries(e.eventMetadata).map(([b,x])=>jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"capitalize",children:[b,":"]}),jsx("span",{className:"font-medium",children:x})]},b))})]})})()]}):jsx("ul",{className:"list-none p-0",children:e.series.map(f=>jsxs("li",{className:"py-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"font-medium text-text-primary",children:[f.label,":"]}),jsx("span",{className:"text-text-secondary",children:s.format(f.value)})]}),f.category&&jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsx("div",{className:"h-3 w-3",style:{backgroundColor:f.categoryColor||f.color,borderRadius:"1px"}}),jsx("span",{className:"text-sm text-text-secondary",children:a?.[f.category]||f.category})]})]},f.label))})]})})};var Fw={top:20,right:20,bottom:50,left:60},pb=({data:e,width:t,height:r,margin:o=Fw,color:n,yFormatter:a={type:"number"},showGrid:i=true,showAxes:s=true,animate:c=true,barRadius:l=4,barPadding:u=.3,onBarClick:d,onBarHover:m,activeIndex:p,className:g,style:f,"aria-label":b="Category bar chart",orientation:x="vertical",showTooltip:v=true})=>{let[C,y]=useState(null),[S,k]=useState(null),[R,E]=useState(null),[D,L]=useState(t??600),[V,A]=useState(r??300),N=useRef(null),T=p??C,z=useId(),W=n||"var(--color-viz-default)";useEffect(()=>{if(t!==void 0&&r!==void 0){L(t),A(r);return}if(!N.current)return;let P=new ResizeObserver(w=>{for(let B of w)t===void 0&&L(B.contentRect.width),r===void 0&&A(B.contentRect.height);});return P.observe(N.current),t===void 0&&L(N.current.offsetWidth),r===void 0&&A(N.current.offsetHeight||300),()=>{P.disconnect();}},[t,r]);let{xScale:F,yScale:K,innerWidth:X,innerHeight:G}=useMemo(()=>{let P=D-o.left-o.right,w=V-o.top-o.bottom;if(x==="horizontal"){let M=max(e,h=>h.value)||0;return {xScale:scaleLinear({range:[0,P],domain:[0,M*1.1],nice:true}),yScale:scaleBand({range:[0,w],domain:e.map(h=>h.label),padding:u}),innerWidth:P,innerHeight:w}}let B=max(e,M=>M.value)||0;return {xScale:scaleBand({range:[0,P],domain:e.map(M=>M.label),padding:u}),yScale:scaleLinear({range:[w,0],domain:[0,B*1.1],nice:true}),innerWidth:P,innerHeight:w}},[e,D,V,o,u,x]);if(e.length===0)return jsx("div",{ref:N,className:twMerge("flex h-full min-h-[200px] w-full items-center justify-center rounded-lg border border-dashed border-border-default bg-background-surface text-sm font-medium text-text-secondary",g),style:r!==void 0?{height:r,...f}:f,children:"No data available"});let Y=(P,w)=>{if(y(P),m?.(w,P),P!==null&&w){let B,M;if(x==="horizontal"){let O=F(w.value),H=K(w.label)||0,j=K.bandwidth();B=o.left+O,M=o.top+H+j/2;}else {let O=F,H=K,j=O(w.label)??0,oe=O.bandwidth(),me=H(w.value);B=o.left+j+oe/2,M=o.top+me;}let h=B>D/2;E(w.label),k({xValue:new Date,series:[{label:"Value",value:w.value,color:w.color||W}],x:B,y:M,position:h?"left":"right"});}else k(null),E(null);};return jsxs("div",{ref:N,className:twMerge("relative h-full w-full overflow-hidden rounded-lg bg-background-surface",g),style:r!==void 0?{height:r,...f}:f,"aria-label":b,role:"img",children:[jsxs("svg",{width:D,height:V,children:[jsx("defs",{children:jsx(LinearGradient,{id:`${z}-bar`,from:W,to:W,toOpacity:.85})}),jsxs(Ua,{left:o.left,top:o.top,children:[i&&jsx("g",{className:"grid-lines",children:(x==="horizontal"?F.ticks(5):K.ticks(5)).map(P=>{let w=x==="horizontal"?0:K(P),B=x==="horizontal"?F(P):0;return jsx("line",{x1:x==="horizontal"?B:0,y1:x==="horizontal"?0:w,x2:x==="horizontal"?B:X,y2:x==="horizontal"?G:w,stroke:"var(--color-border-default)",strokeOpacity:.5,strokeDasharray:"2,3"},P)})}),e.map((P,w)=>{let B=T===w||T==null,M=P.color||`url(#${z}-bar)`;if(x==="horizontal"){let Z=F(P.value),ne=K.bandwidth(),Te=K(P.label)||0;return jsx(motion.rect,{x:0,y:Te,width:Z,height:ne,fill:M,rx:l,ry:l,initial:c?{width:0,opacity:.5}:void 0,animate:{width:Z,opacity:B?1:.5},transition:{duration:.5,delay:w*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:d||m?"pointer":"default"},onMouseEnter:()=>Y(w,P),onMouseLeave:()=>Y(null,null),onClick:()=>d?.(P,w)},P.label)}let h=F,O=K,H=h.bandwidth(),j=h(P.label)??0,oe=O(P.value),me=Math.max(0,G-oe);return c?jsx(motion.rect,{x:j,width:H,fill:M,rx:l,ry:l,initial:{y:G,height:0,opacity:.5},animate:{y:oe,height:me,opacity:B?1:.5},transition:{duration:.5,delay:w*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:d||m?"pointer":"default"},onMouseEnter:()=>Y(w,P),onMouseLeave:()=>Y(null,null),onClick:()=>d?.(P,w)},P.label):jsx("rect",{x:j,y:oe,width:H,height:me,fill:M,rx:l,ry:l,opacity:B?1:.5,style:{cursor:d||m?"pointer":"default",transition:"opacity 150ms ease-out"},onMouseEnter:()=>Y(w,P),onMouseLeave:()=>Y(null,null),onClick:()=>d?.(P,w)},P.label)}),s&&x==="vertical"&&jsxs(Fragment,{children:[jsx(Fr.CategoryBottom,{top:G,scale:F}),jsx(Fr.Left,{left:0,scale:K,yFormatter:a,height:G})]}),s&&x==="horizontal"&&jsxs(Fragment,{children:[jsx(Fr.NumericBottom,{top:G,scale:F,yFormatter:a,width:X}),jsx(Fr.CategoryLeft,{left:0,scale:K})]})]})]}),v&&jsx(qn,{data:S,formatter:a,label:R??void 0})]})};var mb=({item:e})=>jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[jsx("div",{className:"h-3 w-3 shrink-0",style:{backgroundColor:e.fill,borderRadius:"1px"}}),jsx("span",{className:"text-sm text-text-secondary whitespace-nowrap",children:e.category})]}),zw=({items:e})=>e.length===0?null:jsx("div",{className:"flex items-center gap-3 flex-wrap",children:e.map(t=>jsx(mb,{item:t},t.category))}),js=({items:e,onExport:t,marginLeft:r=0,marginRight:o=0,isZoomed:n=false,onResetZoom:a})=>{let[i,s]=Ee__default.useState(false),[c,l]=Ee__default.useState(null),[u,d]=Ee__default.useState(false),[m,p]=Ee__default.useState(false),g=Ee__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=Ee__default.useCallback(async b=>{await g(b);},[g]);return jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 min-h-[32px]",style:{marginLeft:r,marginRight:o},children:[jsx("div",{className:"hidden sm:block flex-1 min-w-0",children:jsx(zw,{items:e})}),jsx("div",{className:"sm:hidden flex items-center gap-3",children:e.length>0&&jsxs(Fragment,{children:[jsx("button",{onClick:()=>d(true),className:"text-sm text-text-secondary hover:text-text-primary transition-colors underline decoration-dotted underline-offset-4",children:"Legend"}),jsx(Xe,{isOpen:u,onClose:()=>d(false),title:"Legend",children:jsx("div",{className:"grid grid-cols-1 gap-3 p-4",children:e.map(b=>jsx(mb,{item:b},b.category))})})]})}),jsxs("div",{className:"sm:hidden flex items-center gap-2 shrink-0",children:[n&&a&&jsx(Q,{variant:"secondary",size:"sm",onPress:a,children:jsx(I,{name:"ArrowsOut",size:16})}),jsx(Q,{variant:"secondary",size:"sm",onPress:()=>p(true),isDisabled:i,children:jsx(I,{name:"Export",size:16})}),jsx(Xe,{isOpen:m,onClose:()=>p(false),title:"Export Chart",contentPadding:false,children:jsxs("div",{className:"flex flex-col",children:[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:[jsx(I,{name:"List",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:c==="csv"?"Exporting...":"Export as CSV"})]}),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:[jsx(I,{name:"Code",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:c==="svg"?"Exporting...":"Export as SVG"})]}),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:[jsx(I,{name:"DownloadSimple",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:c==="png"?"Exporting...":"Export as PNG"})]})]})})]}),jsxs("div",{className:"hidden sm:flex items-center gap-2 shrink-0",children:[n&&a&&jsxs(Q,{variant:"secondary",size:"sm",onPress:a,children:[jsx(I,{name:"ArrowsOut",size:16}),jsx("span",{className:"hidden sm:inline",children:"Reset Zoom"})]}),jsxs(DialogTrigger,{children:[jsxs(Q,{variant:"secondary",size:"sm",isDisabled:i,children:[jsx(I,{name:"Export",size:16}),i?"Exporting...":"Export"]}),jsx(Ze,{placement:"top end",className:"min-w-48 p-1 bg-background-surface rounded-lg shadow-xl ring-1 ring-border-default",children:jsxs(Menu,{onAction:f,className:"outline-none",children:[jsx(MenuItem,{id:"csv",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:i,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(I,{name:"List",size:14}),c==="csv"?"Exporting...":"Export as CSV"]})}),jsx(MenuItem,{id:"svg",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:i,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(I,{name:"Code",size:14}),c==="svg"?"Exporting...":"Export as SVG"]})}),jsx(MenuItem,{id:"png",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:i,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(I,{name:"DownloadSimple",size:14}),c==="png"?"Exporting...":"Export as PNG"]})})]})})]})]})]})};var Nu=({data:e,seriesMetadata:t,width:r,height:o,onBrushChange:n,brushRegion:a,margin:i=Ye})=>{let s=useRef(null),c=useRef(false),l=useMemo(()=>e.flat(),[e]),u=useMemo(()=>({top:10,bottom:15,left:i.left,right:i.right}),[i]),d=r-u.left-u.right,m=useMemo(()=>{if(l.length===0)return scaleTime({domain:[new Date,new Date],range:[0,d]});let x=new Date(Math.min(...l.map(C=>C.xValue.getTime()))),v=new Date(Math.max(...l.map(C=>C.xValue.getTime())));return scaleTime({domain:[x,v],range:[0,d]})},[l,d]),p=useMemo(()=>{let x=l.length>0?Math.max(0,...l.map(v=>v.yValue)):1;return scaleLinear({domain:[0,x],range:[o-u.bottom,u.top]})},[l,o]),g=x=>{if(c.current)return;if(!x){n(null);return}let{x0:v,x1:C}=x;if(v===C)return;let y=new Date(v),S=new Date(C);if(!(Number.isNaN(y.getTime())||Number.isNaN(S.getTime()))){if(l.length>0){let k=Math.min(...l.map(V=>V.xValue.getTime())),R=Math.max(...l.map(V=>V.xValue.getTime())),D=(R-k)*.05;if(Math.abs(y.getTime()-k)<D&&Math.abs(S.getTime()-R)<D){n(null);return}}n([y,S]);}},f=useMemo(()=>{if(l.length!==0)return {start:{x:0,y:u.top},end:{x:d,y:o-u.bottom}}},[d,o,l]);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(E=>E.xValue.getTime())),C=Math.max(...l.map(E=>E.xValue.getTime())),y=a?a[0]:new Date(v),S=a?a[1]:new Date(C),k=s.current.state?.extent;if(k){let E=m.invert(k.x0),D=m.invert(k.x1),L=Math.abs(E.getTime()-y.getTime()),V=Math.abs(D.getTime()-S.getTime());if(L<1e3&&V<1e3)return}c.current=true;let R=E=>{let D=s.current.getExtent({x:m(y),y:u.top},{x:m(S),y:o-u.bottom});return {...E,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 jsx("div",{className:"mt-2",children:jsxs("svg",{width:r,height:o,children:[jsx(PatternLines,{id:"brush_pattern",height:8,width:8,stroke:"var(--color-text-secondary)",strokeWidth:1,orientation:["diagonal"]}),jsxs("g",{transform:`translate(${u.left}, 0)`,children:[e.map((x,v)=>jsx(LinePath,{data:x,x:C=>m(C.xValue),y:C=>p(C.yValue),stroke:t[v]?.color||"var(--color-gray-500)",strokeWidth:1.5,opacity:.8},`brush-series-${v}`)),jsx(Brush,{xScale:m,yScale:p,width:d,height:o-u.top-u.bottom,margin:{top:u.top,bottom:u.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 hb(e){switch(e){case "command":return ft("--color-action-brand","#111111");case "success":return ft("--color-feedback-success-border","#278a4a");case "warning":return ft("--color-feedback-warning-border","#c88420");case "error":return ft("--color-feedback-error-border","#c42d2d");case "alert":return ft("--color-feedback-warning-border","#c88420");default:return ft("--color-text-secondary","#525250")}}function Zs({events:e,color:t,showLabels:r=false}){let o=useContext(To),[n,a]=useState(null);if(!o)return console.warn("ChartEventMarkers must be used within a ChartContainer"),null;let{xScale:i,yScale:s,height:c,tooltip:l,datasets:u,seriesMetadata:d,seriesTypes:m,categoryColors:p}=o,g=e.filter(x=>{let v=i(x.timestamp);return v>=Ye.left&&v<=i.range()[1]}),f=useCallback((x,v)=>{a(v);let C=i(x.timestamp),y=C>(i.range()[1]-Ye.right-Ye.left)/2+Ye.left,S=[];u&&d&&u.forEach((k,R)=>{if(k.length===0)return;let E=bisector(N=>N.xValue).left,D=E(k,x.timestamp),L=k[D-1],V=k[D],A;if(!L)A=V;else if(!V)A=L;else {let N=Math.abs(x.timestamp.getTime()-L.xValue.getTime()),T=Math.abs(x.timestamp.getTime()-V.xValue.getTime());A=N<T?L:V;}A&&d[R]&&S.push({label:d[R].label,value:A.yValue,color:d[R].color,type:m?.[R]||"line",...A.category&&{category:A.category,categoryColor:p?.[A.category]}});}),S.push({label:x.label,value:0,color:t||hb(x.type),type:"event"}),l.show({xValue:x.timestamp,series:S,x:C,y:S.length>1&&typeof S[0].value=="number"?s(S[0].value):c/2,position:y?"left":"right",isEvent:true,eventMetadata:x.metadata});},[i,s,c,l,t,u,d,m,p]),b=useCallback(()=>{a(null),l.hide();},[l]);return g.length===0?null:jsx("g",{className:"chart-event-markers","data-testid":"chart-event-markers",children:g.map((x,v)=>{let C=i(x.timestamp),y=t||hb(x.type),S=n===v;return jsxs("g",{children:[jsx("line",{x1:C,y1:Ye.top,x2:C,y2:c-Ye.bottom,stroke:y,strokeWidth:S?3:2,strokeDasharray:"4 4",strokeOpacity:S?.9:.6,pointerEvents:"none"}),jsx("circle",{cx:C,cy:Ye.top,r:S?5:4,fill:y,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),jsx("circle",{cx:C,cy:c-Ye.bottom,r:S?5:4,fill:y,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),r&&jsx("text",{x:C,y:Ye.top-8,textAnchor:"middle",fill:"var(--color-text-secondary)",fontSize:11,fontWeight:500,pointerEvents:"none",children:x.label}),jsx("rect",{x:C-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 Xa=({data:e,color:t="var(--color-viz-default)",strokeWidth:r=3,strokeDasharray:o,categoryColors:n={}})=>{let{xScale:a,yScale:i,animationSettings:s}=on(),c=i.range(),l=Object.keys(n).length>0,u=m=>m.category?n[m.category]??t:t,d=e.length===1?e[0]:void 0;return jsx(motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:s.duration,ease:s.ease},style:{transformOrigin:`0 ${c[0]}px`,transformBox:"fill-box",isolation:"isolate"},children:d?jsx("circle",{cx:a(d.xValue),cy:i(d.yValue),r,fill:l?u(d):t}):l?e.slice(0,-1).map((m,p)=>{let g=e[p+1];return jsx(LinePath,{data:[m,g],x:f=>a(f.xValue),y:f=>i(f.yValue),stroke:u(m),strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",curve:curveLinear},`${m.xValue.getTime()}-${g.xValue.getTime()}`)}):jsx(LinePath,{data:e,x:m=>a(m.xValue),y:m=>i(m.yValue),stroke:t,strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",curve:curveLinear})})};var Nb=e=>e.type===Ga||e.type===Xa||e.type===Kn,oN=e=>e.type===Zs,nN=bisector(e=>e.xValue).left,aN=()=>jsx("div",{className:"flex h-full items-center justify-center",children:jsx("p",{className:"text-text-secondary",children:"No data available"})}),iN=()=>jsxs("div",{className:"flex h-full flex-col gap-4 p-4",children:[jsx(J,{className:"h-full w-full"}),jsxs("div",{className:"flex gap-4",children:[jsx(J,{className:"h-4 w-24"}),jsx(J,{className:"h-4 w-24"})]})]}),sN=({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,u]=useState(null),[d,m]=useState(null),p=useRef(null),g=useRef(0),f=useRef(""),b=useRef(null),{colorMode:x}=Mt(),v=useMemo(()=>Ca(),[x]),C=useMemo(()=>Uc(),[x]),{datasets:y,seriesMetadata:S,categoryInfo:k,categoryColors:R,categoryLabels:E,hasBarSeries:D,firstBarSeriesIndex:L,seriesTypes:V}=useMemo(()=>{let se=Children.toArray(c).filter(ee=>isValidElement(ee)&&Nb(ee)),Ne=se.filter(ee=>ee.props.data).length,Ve=se.some(ee=>ee.type===Kn),De=[],te=[],ce=[],_=null,q=null,U=null;se.forEach((ee,be)=>{let he=ee.props;if(!he.data)return;De.push(he.data);let Vo=("color"in he&&he.color?he.color:void 0)||(Ne===1?C:v[be%v.length]);te.push({label:"label"in he&&he.label||`Series ${De.length}`,color:Vo});let Nr=ee.type===Ga?"area":ee.type===Xa?"line":"bar";ce.push(Nr),"categoryColors"in he&&he.categoryColors&&(_=he.categoryColors),"categoryLabels"in he&&he.categoryLabels&&(q=he.categoryLabels),ee.type===Kn&&U===null&&(U=De.length-1);});let ae=null;if(_){let ee=new Set;De.forEach(be=>{be.forEach(he=>{he.category&&ee.add(he.category);});}),ae=Array.from(ee).map(be=>({label:q?.[be]||be,color:_[be]||"#6b7280"}));}return {datasets:De,seriesMetadata:te,categoryInfo:ae,categoryColors:_,categoryLabels:q,hasBarSeries:Ve,firstBarSeriesIndex:U,seriesTypes:ce}},[c,C,v,x]),A=e,N=a?i+8:0,T=t-60-N,z=Math.max(100,T),W=useMemo(()=>y.flat(),[y]),F=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=d||F,X=useMemo(()=>K?y.map(se=>se.filter(Ne=>Ne.xValue>=K[0]&&Ne.xValue<=K[1])):y,[y,K]);useEffect(()=>{s&&s(d);},[d,s]);let G=useMemo(()=>X.flat(),[X]),Y=useMemo(()=>Su(G,z,r),[G,z,r]),P=useMemo(()=>{let $=z-Ye.top-Ye.bottom;return Ks($)},[z]),w=useMemo(()=>{let $=$r(r),se=$.tickFormat||$.format,Ve=Y.ticks(P).map(ce=>se(ce)),De=Us(Ve,12,"system-ui"),te=Math.ceil(De)+12;return {...Ye,left:Math.max(te,30)}},[Y,r,P]),B=useMemo(()=>K?scaleTime({domain:K,range:[w.left,A-w.right]}):Cu(W,A),[K,W,A,w]),M=useCallback($=>{if(!F)return;let{scaleX:se,translateX:Ne}=$,Ve=A-w.left-w.right,[De,te]=F,ce=te.getTime()-De.getTime();if(ce<=0){m(null);return}let _=-Ne,q=_+Ve,U=Ve*se/ce,ae=_/U,ee=q/U,be=new Date(De.getTime()+ae),he=new Date(De.getTime()+ee),st=Math.abs(be.getTime()-De.getTime()),Vo=Math.abs(he.getTime()-te.getTime()),Nr=ce*.02;st<Nr&&Vo<Nr?m(null):m([be,he]);},[F,A,w]),h=useCallback($=>{let{left:se}=p.current?.getBoundingClientRect()||{left:0},Ne=$.clientX-se;if($.timeStamp-(g.current||0)<16)return;g.current=$.timeStamp;let Ve=B.invert(Ne),De=y.map((_,q)=>{if(!_||_.length===0)return null;let U=nN(_,Ve,1);if(U===0)return {point:_[0],datasetIndex:q};if(U>=_.length)return {point:_[_.length-1],datasetIndex:q};let ae=_[U-1],ee=_[U];if(!ae||!ee)return null;let be=Math.abs(ae.xValue.getTime()-Ve.getTime()),he=Math.abs(ee.xValue.getTime()-Ve.getTime());return {point:be<he?ae:ee,datasetIndex:q}}).filter(_=>_!==null&&S[_.datasetIndex]!==void 0).map(({point:_,datasetIndex:q})=>({label:S[q].label,value:_.yValue,color:S[q].color,point:_,type:V[q]}));if(De.length===0){u(null);return}let te=B(De[0].point.xValue),ce=te>(A-w.right-w.left)/2+w.left;u({xValue:De[0].point.xValue,series:De.map(({label:_,value:q,color:U,point:ae,type:ee})=>({label:_,value:q,color:U,type:ee,category:ae.category,categoryColor:ae.category&&R?R[ae.category]:void 0})),x:te,y:Y(De[0].value),position:ce?"left":"right"});},[y,X,S,V,B,Y,A,R,w]),O=()=>{u(null);},H=useCallback(()=>{m(null),b.current&&b.current.reset();},[]),j=useCallback($=>{if(m($),b.current&&F){let[se,Ne]=F,Ve=Ne.getTime()-se.getTime();if(Ve<=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 _=Ve/ce,q=A-w.left-w.right,ae=-((De.getTime()-se.getTime())/Ve)*q*_;b.current.setTransformMatrix({scaleX:_,scaleY:1,translateX:ae,translateY:0,skewX:0,skewY:0});}}},[F,A,w]),oe={width:A,height:z,xScale:B,yScale:Y,yFormatter:r,animationSettings:Lg,tooltip:{data:l,show:u,hide:()=>u(null)},datasets:X,seriesMetadata:S,seriesTypes:V,categoryColors:R||void 0,categoryLabels:E||void 0},me=Children.toArray(c),Z=0,ne=[],Te=[];me.forEach($=>{if(!isValidElement($)){ne.push($);return}if(oN($))Te.push($);else if(Nb($)){let se=Z;Z++;let Ne=$.props;ne.push(Ee__default.cloneElement($,{...Ne,data:X[se]||Ne.data,color:S[se]?.color}));}else ne.push($);});let ie=(k||S).map($=>({category:$.label,fill:$.color})),ue=Wp({datasets:y,metadata:{xLabel:"Date",yLabel:"Value",seriesLabels:S.map($=>$.label),timestamp:true},svgRef:p});if(o)return jsx(iN,{});if(y.length===0)return jsx(aN,{});let ge=jsxs(Fragment,{children:[jsx("title",{children:"Data chart visualization"}),jsx("g",{children:Y.ticks(P).map($=>jsx(Line,{from:{x:w.left,y:Y($)},to:{x:A-w.right,y:Y($)},stroke:"var(--color-border-muted)",strokeWidth:1},`grid-line-${$}`))}),ne,jsx(Fr.Bottom,{top:z-w.bottom,scale:B,width:A-w.left-w.right}),jsx(Fr.Left,{left:w.left,scale:Y,yFormatter:r,height:z-w.top-w.bottom}),l&&!l.isEvent&&jsxs(Fragment,{children:[D&&L!==null?(()=>{let $=X[L]??[];if($.length===0)return null;let se=[...$].sort((U,ae)=>U.xValue.getTime()-ae.xValue.getTime()),Ne=se.findIndex(U=>U.xValue.getTime()===l.xValue.getTime()),Ve=se[Ne+1],De=se.length>1&&Ve?Ve.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,q=Y.range();return jsx("rect",{x:_,y:q[1],width:te,height:q[0]-q[1],className:"fill-background-muted",opacity:.5,pointerEvents:"none",style:{transition:"all 100ms ease-out"}})})():null,l.series.filter($=>$.type!=="bar").map($=>jsxs("g",{children:[jsx("circle",{cx:B(l.xValue),cy:Y($.value),r:8,fill:"white",stroke:$.color,strokeWidth:2,style:{transition:"all 100ms ease-out"}}),jsx("circle",{cx:B(l.xValue),cy:Y($.value),r:4,fill:$.color,style:{transition:"all 100ms ease-out"}})]},`highlight-${$.label}`))]}),jsx("rect",{x:w.left,y:w.top,width:A-w.left-w.right,height:z-w.top-w.bottom,fill:"transparent",style:{cursor:n?"grab":"crosshair"},onMouseMove:h,onMouseLeave:O}),Te]});return jsx("div",{className:"relative flex h-full flex-col",children:jsxs(To.Provider,{value:oe,children:[n?jsx(Zoom,{width:A,height:z,scaleXMin:1,scaleXMax:20,scaleYMin:1,scaleYMax:1,constrain:$=>{let{scaleX:se,translateX:Ne}=$,Ve=Math.max(1,Math.min(20,se)),De=1,te=A-w.left-w.right,ce=0,_=te*(1-Ve),q=Math.max(_,Math.min(ce,Ne));return {...$,scaleX:Ve,scaleY:De,translateX:q,translateY:0}},children:$=>{if(b.current=$,$.transformMatrix){let{scaleX:se,translateX:Ne}=$.transformMatrix,Ve=`${se.toFixed(4)}-${Ne.toFixed(2)}`;Ve!==f.current&&(f.current=Ve,setTimeout(()=>{M($.transformMatrix);},0));}return jsx("svg",{width:A,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})}}):jsx("svg",{width:A,height:z,className:"overflow-visible",ref:p,role:"img","aria-label":"Data chart",children:ge}),jsx(qn,{data:l,formatter:r}),a&&F&&jsx(Nu,{data:y,seriesMetadata:S,width:A,height:i,onBrushChange:j,brushRegion:d,margin:w}),jsx(js,{onExport:ue,items:ie,marginLeft:0,marginRight:w.right,isZoomed:d!==null,onResetZoom:H})]})})},kb=withParentSize(sN);var mN=e=>e.toLocaleString(),fN=e=>`${Math.round(e*100)}%`,Mb=({data:e,width:t=800,height:r=400,padding:o=0,barGap:n=30,formatValue:a=mN,formatPercentage:i=fN,color:s,showScale:c=true,showOverallConversion:l=true,overallConversionLabel:u="Overall Conversion:",activeStageId:d,onStageClick:m,onStageHover:p,className:g,style:f,"aria-label":b="Funnel chart"})=>{let[x,v]=useState(null),[C,y]=useState(t),S=useRef(null),k=d??x,R=useId(),E=s||"var(--color-viz-default)";useEffect(()=>{if(!S.current)return;let T=new ResizeObserver(z=>{for(let W of z)y(W.contentRect.width);});return T.observe(S.current),()=>{T.disconnect();}},[]);let{layout:D,overallConversion:L}=useMemo(()=>{if(e.length===0)return {layout:[],overallConversion:0};let T=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((Y,P)=>{let w=o+z+P*(K+n),B=T===0?0:Y.value/T,M=B,h=P===0?null:e[P-1].value,O=h==null||h===0?0:1-Y.value/h;return {stage:Y,index:P,y:w,barHeight:K,widthPercent:B,conversionRate:M,dropOff:O}}),G=T===0?0:e[e.length-1].value/T;return {layout:X,overallConversion:G,maxValue:T}},[e,C,r,o,n,c,l]);if(e.length===0)return jsx("div",{className:twMerge("flex h-full min-h-[280px] w-full items-center justify-center rounded-lg border border-dashed border-border-default bg-background-surface text-sm font-medium text-text-secondary",g),style:{width:t,height:r,...f},children:"No funnel data available"});let V=c?60:0,A=o+V,N=C-o*2-V;return jsx("div",{ref:S,className:twMerge("relative w-full overflow-hidden rounded-lg bg-background-surface",g),style:{height:r,...f},"aria-label":b,role:"img",children:jsxs("svg",{width:"100%",height:r,className:"relative",children:[jsxs("defs",{children:[jsx(LinearGradient,{id:`${R}-bar`,from:E,to:E,toOpacity:.85}),jsx(LinearGradient,{id:`${R}-bg`,from:E,to:E,fromOpacity:.01,toOpacity:.15,x1:"0",y1:"0",x2:"1",y2:"0"})]}),l&&jsxs("text",{x:A,y:o+20,className:"fill-text-primary text-sm font-medium",children:[jsx("tspan",{className:"fill-text-secondary",children:u})," ",i(L)]}),c&&jsx("g",{children:D.map(T=>{let z=T.y+T.barHeight/2;return jsx("text",{x:o+V-12,y:z,textAnchor:"end",dominantBaseline:"middle",className:"fill-text-secondary text-xs",children:i(T.conversionRate)},T.stage.id)})}),D.map(T=>{let z=k===T.stage.id,W=N*T.widthPercent;return jsxs("g",{children:[jsx("rect",{x:A,y:T.y,width:N,height:T.barHeight,fill:`url(#${R}-bg)`,rx:4}),jsx(motion.rect,{x:A,y:T.y,width:W,height:T.barHeight,fill:`url(#${R}-bar)`,rx:4,initial:{width:0},animate:{width:W},transition:{duration:.6,delay:T.index*.1,ease:"easeOut"},opacity:z||k==null?1:.5,style:{cursor:m||p?"pointer":"default",transition:"opacity 150ms ease"},onMouseEnter:()=>{v(T.stage.id),p?.(T.stage);},onMouseLeave:()=>{v(null),p?.(null);},onClick:()=>m?.(T.stage)}),jsx("rect",{x:A+10,y:T.y+T.barHeight/2-10,width:70,height:20,className:"fill-background-surface stroke-border-default",strokeWidth:1,rx:4,style:{pointerEvents:"none"}}),jsx("text",{x:A+16,y:T.y+T.barHeight/2+4,className:"fill-text-primary text-xs font-semibold",style:{pointerEvents:"none"},children:a(T.stage.value)}),jsxs("text",{x:A,y:T.y-8,className:"fill-text-secondary text-xs",style:{pointerEvents:"none"},children:[jsx("tspan",{children:T.index+1})," ",T.stage.label]}),T.stage.secondaryValue&&jsx("text",{x:A+16,y:T.y-24,className:"fill-text-secondary text-xs",style:{pointerEvents:"none"},children:T.stage.secondaryValue}),T.index>0&&T.dropOff>0&&jsxs("text",{x:A+N,y:T.y-8,textAnchor:"end",className:"fill-text-secondary text-xs",children:[i(T.dropOff)," drop"]}),T.stage.annotation&&jsxs("g",{children:[jsx("rect",{x:A+W+8,y:T.y+8,width:60,height:24,rx:3,className:"fill-background-muted"}),jsx("text",{x:A+W+16,y:T.y+20,className:"fill-text-secondary text-xs font-medium",children:T.stage.annotation})]})]},T.stage.id)})]})})};function gN(e,t,r){return {field:e,operator:t,value:r}}function bN(e,t="AND"){return {logic:t,conditions:e}}function $a(){return {logic:"AND",conditions:[]}}function _s(e){return !e||e.conditions.length===0?true:e.conditions.every(t=>"conditions"in t?_s(t):false)}function xN(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,u=[],d=[],m=[];for(let p of s)p.operator==="in"&&Array.isArray(p.value)?u.push(...p.value):p.operator==="eq"?typeof p.value!="boolean"&&!Array.isArray(p.value)?u.push(p.value):m.push(p):["gte","gt","lte","lt"].includes(p.operator)?d.push({operator:p.operator,value:typeof p.value=="boolean"||Array.isArray(p.value)?String(p.value):p.value}):m.push(p);if(u.length>0){let g=Array.from(new Set(u)).map(f=>c?.values?.find(x=>String(x.value)===String(f))?.label??f);a.push({id:`${i}-in`,label:l,value:g.join(", ")});}if(d.length>0){let p=d.find(f=>f.operator==="gte"||f.operator==="gt"),g=d.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 d){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 ko(e,t){let r=e||$a();return {...r,conditions:[...r.conditions,t]}}function sn(e,t){if(!e)return $a();let r=e.conditions.filter(o=>"conditions"in o?sn(o,t).conditions.length>0:o.field!==t);return {...e,conditions:r}}function ln(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 Qa({count:e,label:t="results",isLoading:r=false,className:o=""}){if(r)return jsx("div",{className:`flex items-center ${o}`,children:jsx(J,{width:80,height:16})});let n=t.endsWith("s")?t.slice(0,-1):t,a=e===1?n:t;return jsxs("div",{className:`text-sm text-text-secondary whitespace-nowrap ${o}`,children:[e.toLocaleString()," ",a]})}var SN=e=>{let t=ht({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 twMerge(t,r,e.className)};function lr({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,transparent:i,showSearchIcon:s,isClearable:c,onClear:l,type:u,validationResult:d,reserveErrorSpace:m=true,isLoading:p=false,descriptionPlacement:g="below",...f}){let[b,x]=Ee__default.useState(false),{isFocused:v,handleFocus:C,handleBlur:y}=sr(),S=u==="password",k=Li(p,300);return jsx(TextField,{...f,isRequired:a,className:Ce(f.className,"group flex flex-col"),children:({isDisabled:R,isInvalid:E})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(Me,{size:o,tooltip:n,description:g==="tooltip"||g==="inline"?t:void 0,descriptionPlacement:g,isRequired:a,children:e}),jsxs(nt,{children:[s&&jsx("div",{className:"pointer-events-none absolute left-2 top-[45%] -translate-y-1/2 transform flex items-center z-10",children:k?jsx(Kr,{size:16,color:"text-text-secondary"}):jsx(I,{name:"MagnifyingGlass",className:`h-4 w-4 transition-colors ${v?"text-action-brand":"text-text-secondary"}`})}),jsx(fs,{size:o,disabled:R,type:S?b?"text":"password":u,value:f.value,defaultValue:f.defaultValue,placeholder:f.placeholder,onFocus:D=>C(D,f.onFocus),onBlur:D=>y(D,f.onBlur),onChange:D=>f.onChange?.(D.target.value),className:SN({isInvalid:E,isDisabled:R,isFocused:v,size:o,transparent:i,showSearchIcon:s,isClearable:c,hasValue:!!f.value,isPassword:S,className:typeof f.className=="string"?f.className:void 0})}),c&&f.value&&!R&&jsx(Ba,{onClick:()=>{l?l():f.onChange&&f.onChange("");},size:o}),S&&!R&&jsx("button",{type:"button",onClick:()=>x(!b),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":b?"Hide password":"Show password",onMouseDown:D=>{D.preventDefault(),D.stopPropagation();},children:jsx(I,{name:b?"EyeSlash":"Eye",size:o==="sm"?16:20,className:"text-text-primary"})})]}),m?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(pe,{size:o,children:r}):typeof r=="function"&&d?jsx(pe,{size:o,children:r(d)}):t&&g==="below"?jsx(Se,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&d?jsx(pe,{size:o,className:"mt-1",children:r(d)}):t&&g==="below"?jsx(Se,{size:o,className:"mt-1",children:t}):null})]})})}function cn({value:e,onChange:t,onClear:r,placeholder:o="Search...",size:n="sm",className:a="",isLoading:i=false}){return jsx("div",{className:`flex-1 min-w-0 sm:max-w-sm ${a}`,children:jsx(lr,{value:e,onChange:t,placeholder:o,showSearchIcon:true,isClearable:!!e&&!!r,onClear:r,size:n,"aria-label":o,reserveErrorSpace:false,isLoading:i})})}function _a({value:e,options:t,onChange:r,direction:o,onDirectionChange:n,showLabel:a=true,size:i="sm",className:s="",compact:c=false}){let[l,u]=useState(false),d=o!==void 0&&n!==void 0,m=t.find(p=>p.value===e);return c?jsxs("div",{className:`flex items-center gap-2 ${s}`,children:[jsx(Q,{variant:"secondary",size:i,icon:"ArrowsDownUp","aria-label":`Sort by: ${m?.label||"Select"}`,onPress:()=>u(true)}),jsx(Xe,{isOpen:l,onClose:()=>u(false),title:"Sort by",contentPadding:false,children:jsx(ListBox,{items:t.map(p=>({id:p.value,label:p.label,value:p.value})),className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:e?[e]:[],onSelectionChange:p=>{let g=Array.from(p)[0];g!=null&&(r(g),u(false));},children:p=>jsx(At,{id:p.id,textValue:p.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:p.label})},p.id)})})]}):jsxs("div",{className:`flex items-center gap-2 ${s}`,children:[a&&jsx("span",{className:"text-sm text-text-secondary whitespace-nowrap",children:"Sort by:"}),jsx(Zo,{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}),d&&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"?jsx(ArrowUp,{className:"w-4 h-4"}):jsx(ArrowDown,{className:"w-4 h-4"})})]})}function Fb({search:e,searchMobileMode:t="expanded",filters:r=[],onRemoveFilter:o,onClearAllFilters:n,onManageFilters:a,exportControl:i,maxVisibleFilterChips:s=3,sort:c,resultsCount:l,leftControls:u,onManageColumns:d,columnPicker:m,customControls:p,actions:g,interactionMode:f="auto",sticky:b,stickyTop:x="0",zIndex:v=10,className:C="",style:y}){let S=r.length>0;if(!(e||S||a||c||l||u||d||m||p||g||i))return null;let R=b?"sticky bg-background-surface":"",E=b?{top:x,zIndex:v}:{};return jsxs("div",{className:`@container flex flex-col gap-3 bg-background-surface py-3 border-b border-border-default ${R} ${C}`,style:{...y,...E},children:[jsxs("div",{className:"hidden @[640px]:flex @[640px]:items-center @[640px]:justify-between @[640px]:gap-4",children:[jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[u,u&&l&&jsx("div",{className:"h-4 w-px bg-border-default"}),l&&jsx(Qa,{count:l.count,label:l.label,isLoading:l.isLoading}),l&&c&&jsx("div",{className:"h-4 w-px bg-border-default"}),c&&jsx(_a,{value:c.value,options:c.options,onChange:c.onChange,showLabel:c.showLabel,direction:c.direction,onDirectionChange:c.onDirectionChange}),d?jsx(Q,{variant:"secondary",size:"sm",icon:"Columns",onClick:d,children:"Columns"}):m,S&&o&&jsxs(Fragment,{children:[r.slice(0,s).map(D=>jsxs(Ar,{variant:"primary",size:"sm",onRemove:()=>o(D.id),isRemovable:true,children:[D.label,": ",D.value]},D.id)),r.length>s&&a&&jsxs(Q,{variant:"ghost",size:"sm",onClick:a,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:["+",r.length-s," more"]}),n&&jsx(Q,{variant:"ghost",size:"sm",onClick:n,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:"Clear all"})]})]}),jsx("div",{className:"flex items-center gap-3 flex-shrink-0",children:p||jsxs(Fragment,{children:[g&&g.items.length>0&&jsx(Fragment,{children:g.items.map(D=>jsx(Q,{variant:D.variant||"secondary",size:"sm",icon:D.icon,onPress:D.onClick,isDisabled:D.disabled,children:D.label},D.id))}),e&&jsx("div",{className:"w-64",children:jsx(cn,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsx(Q,{variant:"secondary",size:"sm",icon:"Sliders",badgeNumber:r.length>0?r.length:void 0,onClick:a,children:"Filters"}),i&&jsx(Q,{variant:"secondary",size:"sm",icon:"Upload",onClick:i.onClick,isDisabled:i.isDisabled,children:i.label})]})})]}),jsxs("div",{className:"@[640px]:hidden",children:[jsx("div",{className:"flex flex-col gap-3 mb-3",children:jsx("div",{className:"flex items-center gap-3",children:p?jsx("div",{className:"flex-1",children:p}):jsxs(Fragment,{children:[g&&g.items.length>0&&jsx(zn,{items:g.items.map(D=>({id:D.id,name:D.label,iconName:D.icon,variant:D.variant==="destructive"?"destructive":"primary",disabled:D.disabled,onAction:D.onClick})),align:"left",size:"sm",children:jsx(Q,{variant:"secondary",size:"sm",icon:"DotsThreeVertical","aria-label":g.menuLabel||"Actions"})}),e&&jsx("div",{className:"flex-1",children:jsx(cn,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&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&&jsx(Q,{variant:"secondary",size:"sm",icon:"Upload",onClick:i.onClick,isDisabled:i.isDisabled,children:i.label})]})})}),jsxs("div",{className:"flex items-center justify-between gap-3",children:[jsxs("div",{className:"flex items-center gap-3",children:[u,l&&jsx(Qa,{count:l.count,label:l.label,isLoading:l.isLoading})]}),jsx("div",{className:"flex items-center gap-2",children:c&&jsx(_a,{value:c.value,options:c.options,onChange:c.onChange,showLabel:false,direction:c.direction,onDirectionChange:c.onDirectionChange,compact:f!=="desktop"})})]})]})]})}function Bb({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,u=e.slice(0,n),d=Math.max(0,e.length-n),m=d>0,p=a==="button"&&!!o,g=a==="chips"&&i&&!!o;if(!l&&!p&&!g)return null;let f=p&&jsxs(Q,{variant:"secondary",size:s,onClick:o,className:"whitespace-nowrap",children:[e.length," ",e.length===1?"filter":"filters"]}),b=jsxs(Fragment,{children:[g&&jsx(Q,{variant:"secondary",size:s,icon:"Sliders",onClick:o,className:"whitespace-nowrap",children:"Filters"}),l&&u.map(v=>jsxs(Ar,{variant:"secondary",size:s,onRemove:()=>t(v.id),isRemovable:true,children:[v.label,": ",v.value]},v.id)),l&&m&&o&&jsxs(Q,{variant:"ghost",size:s,onClick:o,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:["+",d," more"]}),l&&r&&jsx(Q,{variant:"ghost",size:s,onClick:r,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:"Clear all"})]}),x=a==="button"?f:b;return jsx("div",{className:`flex flex-wrap items-center gap-2 ${c}`,children:x})}function zb({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,showCalendar:c=true,reserveErrorSpace:l=true,validationResult:u,className:d,...m}){let[p,g]=useState(false),f=b=>{m.onChange&&b&&m.onChange(b),g(false);};return jsxs(DateField,{...m,isDisabled:i,isRequired:a,isInvalid:s,className:Ce(d,"flex flex-col gap-1"),children:[e&&jsx(Me,{size:o,tooltip:n,isRequired:a,children:e}),jsx(nt,{children:jsxs("div",{className:"relative w-full",children:[jsx(ei,{size:o,isDisabled:i,isInvalid:s,hasCalendar:c}),c&&!i&&jsxs(DialogTrigger,{isOpen:p,onOpenChange:g,children:[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-secondary hover:text-text-primary transition-colors","aria-label":"Open calendar",children:jsx(I,{name:"Calendar",size:18})}),jsx(Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsx(Dialog,{className:"p-4 outline-none",children:jsx(Wn,{value:m.value,onChange:f,minValue:m.minValue,maxValue:m.maxValue,isDisabled:i,isReadOnly:m.isReadOnly,isDateUnavailable:m.isDateUnavailable})})})]})]})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(pe,{size:o,children:r}):typeof r=="function"&&u?jsx(pe,{size:o,children:r(u)}):t?jsx(Se,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&u?jsx(pe,{size:o,className:"mt-1",children:r(u)}):t?jsx(Se,{size:o,className:"mt-1",children:t}):null})]})}function BN({isPlaceholder:e,isDisabled:t,size:r="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[r],e?"text-text-disabled italic":"text-text-primary",t?"text-text-disabled cursor-not-allowed":"cursor-text",!t&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function ei({size:e="md",isDisabled:t,isInvalid:r,hasCalendar:o,className:n,...a}){return jsx(DateInput,{className:twMerge(xo({isInvalid:r,isDisabled:t}),"px-3 py-2 flex items-center gap-0.5 w-full",o&&"pr-10",n),...a,children:i=>jsx(DateSegment,{segment:i,className:BN({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||t,size:e})})})}function UN({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-primary group-hover:bg-background-muted group-pressed:bg-background-muted",middle:["bg-background-selected group-hover:bg-background-muted forced-colors:group-hover:bg-[Highlight]","group-invalid:group-hover:bg-feedback-error-background forced-colors:group-invalid:group-hover:bg-[Mark]","group-pressed:bg-background-muted forced-colors:group-pressed:bg-[Highlight] forced-colors:text-[HighlightText]","group-invalid:group-pressed:bg-feedback-error-background forced-colors:group-invalid:group-pressed:bg-[Mark]"].join(" "),cap:"bg-action-default text-[color:var(--color-action-default-text)] group-invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:group-invalid:bg-[Mark] forced-colors:text-[HighlightText]"},n=t?"text-text-disabled forced-colors:text-text-disabled font-light":"";return [r,o[e],n].filter(Boolean).join(" ")}function _n({errorMessage:e,...t}){return jsxs(RangeCalendar,{...t,children:[jsx(ws,{}),jsxs(CalendarGrid,{className:"w-full border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Ns,{}),jsx(CalendarGridBody,{children:r=>jsx(CalendarCell,{date:r,className:"selection-start:rounded-s-full selection-end:rounded-e-full [td:last-child_&]:rounded-e-end group h-9 w-9 cursor-default text-sm border-0 outside-month:text-text-disabled invalid:selected:bg-feedback-error-background forced-colors:selected:bg-[Highlight] forced-colors:selected:text-[HighlightText] forced-colors:invalid:selected:bg-[Mark] [td:first-child_&]:rounded-s-full [&]:border-0",children:({formattedDate:o,isSelected:n,isSelectionStart:a,isSelectionEnd:i,isFocusVisible:s,isDisabled:c})=>jsx("span",{className:UN({selectionState:n&&(a||i)?"cap":n?"middle":"none",isDisabled:c}),children:o})})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function rl({label:e,description:t,errorMessage:r,...o}){return jsxs(DateRangePicker,{...o,className:Ce(o.className,"group flex flex-col gap-1"),children:[e&&jsx(Me,{children:e}),jsxs(Gf,{className:"w-auto min-w-[208px]",children:[jsx(ei,{slot:"start",className:"px-2 py-1.5 text-sm"}),jsx("span",{"aria-hidden":"true",className:"text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] group-disabled:forced-colors:text-[GrayText]",children:"\u2013"}),jsx(ei,{slot:"end",className:"flex-1 px-2 py-1.5 text-sm"}),jsx(Q,{variant:"icon",className:"mr-1 w-6 rounded outline-offset-0",children:jsx(CalendarIcon,{"aria-hidden":true,className:"h-4 w-4"})})]}),t&&jsx(Se,{children:t}),typeof r=="string"?jsx(pe,{children:r}):null,jsx(Ze,{children:jsx(_n,{})})]})}var $N=e=>{let t=ht({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return twMerge(t,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function ti({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,transparent:i,validationResult:s,reserveErrorSpace:c=true,descriptionPlacement:l="below",...u}){let d=useId(),{isFocused:m,handleFocus:p,handleBlur:g}=sr();return jsx(NumberField,{...u,id:d,isRequired:a,className:Ce(u.className,"group flex flex-col gap-1"),step:u.step??1,onChange:f=>{typeof f=="number"&&(u.maxValue!=null&&f>u.maxValue?u.onChange?.(u.maxValue):u.minValue!=null&&f<u.minValue?u.onChange?.(u.minValue):u.onChange?.(f));},isInvalid:!!r||typeof u.value=="number"&&(u.maxValue!=null&&u.value>u.maxValue||u.minValue!=null&&u.value<u.minValue),children:({isDisabled:f,isInvalid:b})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(Me,{size:o,tooltip:n,description:l==="tooltip"||l==="inline"?t:void 0,descriptionPlacement:l,isRequired:a,htmlFor:d,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:v=>p(v,u.onFocus),onBlur:v=>g(v,u.onBlur),className:$N({isInvalid:b||!!r,isDisabled:f,isFocused:m,transparent:i,size:o,className:typeof u.className=="string"?u.className:void 0})}),jsxs("div",{className:"absolute inset-y-[2px] right-[2px] flex flex-col divide-y divide-border-default border-l border-border-default overflow-hidden rounded-r-[calc(var(--control-border-radius)-2px)]",children:[jsx(Button,{slot:"increment",isDisabled:f,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(I,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:f,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(I,{name:"CaretDown",size:14})})]})]})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:r?jsx(pe,{size:o,children:typeof r=="function"?r(s):r}):t&&l==="below"?jsx(Se,{size:o,children:t}):null}):jsx(Fragment,{children:r?jsx(pe,{size:o,className:"mt-1",children:typeof r=="function"?r(s):r}):t&&l==="below"?jsx(Se,{size:o,className:"mt-1",children:t}):null})]})})}var Du={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 eT({isSelected:e,isDisabled:t,size:r="md"}){let o="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",n=Du[r].track,a=Oe,i="focus-visible:outline-action-primary",s="";return e?s="bg-action-primary forced-colors:!bg-[Highlight] group-pressed:bg-action-primary-hover":s="bg-border-input group-pressed:bg-border-focus",[o,n,a,i,s,t?"bg-background-muted forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function tT({isSelected:e,isDisabled:t,size:r="md"}){let o="transform rounded-full bg-background-surface outline-none shadow transition duration-200 ease-in-out",n=Du[r].handle;return [o,n,e?"translate-x-[100%]":"translate-x-0",t?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function ol({children:e,variant:t="primary",size:r="md",...o}){return jsx(Switch,{...o,className:Ce(o.className,`group flex items-center gap-2 ${Du[r].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:n=>jsxs(Fragment,{children:[jsx("div",{className:eT({...n,size:r}),children:jsx("span",{className:tT({...n,size:r})})}),e]})})}function Gb(e){return new Intl.NumberFormat("en-US").format(e)}function Ub({isOpen:e,onClose:t,facetConfigs:r,facetCounts:o={},currentFilters:n,onApply:a,onClear:i,title:s="Filters",resultCount:c}){let[l,u]=useState(n),[d,m]=useState({}),[p,g]=useState({}),[f,b]=useState(null),{isMobile:x}=Pt(),v=useMemo(()=>r.some(h=>h.group),[r]),{groups:C,ungroupedFacets:y,facetsByGroup:S}=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]);useEffect(()=>{e&&(u(n),m({}),g({}),b(!x&&C.length>0?C[0]:null));},[e,n,C,x]);let k=useMemo(()=>!l||_s(l)?0:ln(l).length,[l]),R=()=>{a(l),t();},E=()=>{let h=$a();u(h),i?i():a(h),t();},D=h=>{if(!l)return [];if(!ln(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},L=(h,O,H)=>{let j=sn(l,h);O!==void 0&&(j=ko(j,{field:h,operator:"gte",value:O})),H!==void 0&&(j=ko(j,{field:h,operator:"lte",value:H})),u(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},A=(h,O)=>{let H=sn(l,h);O!==void 0&&(H=ko(H,{field:h,operator:"eq",value:O})),u(H);},N=(h,O,H)=>{let j=sn(l,h);O&&(j=ko(j,{field:h,operator:"gte",value:O.toString()})),H&&(j=ko(j,{field:h,operator:"lte",value:H.toString()})),u(j);},T=h=>{let O=S[h]||[],H=l?ln(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-text-link-default",K=h=>jsx("span",{className:F,children:h}),X=h=>{let O=o[h.field]||{},H=d[h.field]||"",j=[];h.values?j=h.values.map(Z=>({value:String(Z.value),label:Z.label,count:O[String(Z.value)]})):j=Object.entries(O).map(([Z,ne])=>({value:Z,label:Z,count:ne}));let oe=j.length;if(H){let Z=H.toLowerCase();j=j.filter(ne=>ne.label.toLowerCase().includes(Z));}j.sort((Z,ne)=>Z.count!==void 0&&ne.count!==void 0&&ne.count!==Z.count?ne.count-Z.count:Z.label.localeCompare(ne.label));let me=h.type||"string";if(me==="string"||!h.type){let Z=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 jsxs(Co,{id:h.field,children:[jsx(So,{title:h.label,description:h.description,className:z,endContent:Z.length>0?K(`${Z.length} selected`):void 0}),jsx(wo,{className:W,children:jsxs("div",{className:"space-y-4 pt-4 pb-4",children:[oe>ne&&jsx(cn,{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"}),jsx(tu,{value:Z,onChange:$=>{let se=sn(l,h.field);$.length>0&&(se=ko(se,{field:h.field,operator:"in",value:$})),u(se);},children:jsx("div",{className:"space-y-1.5",children:ue.map($=>jsx("div",{className:"rounded-md py-2 pr-4 transition-colors hover:bg-background-hover",children:jsx(_o,{value:$.value,children:jsxs("div",{className:"flex items-center justify-between gap-3 flex-1",children:[h.renderLabel?h.renderLabel($.value,$.label):jsx("span",{className:"text-sm font-medium text-text-primary",children:$.label}),$.count!==void 0&&jsx("span",{className:"text-xs font-medium text-text-secondary tabular-nums",children:Gb($.count)})]})})},$.value))})}),ge&&jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxs(Q,{variant:"ghost",size:"sm",onPress:()=>g($=>({...$,[h.field]:true})),className:"w-full",children:["Show all ",j.length," options"]})}),ie&&j.length>Te&&jsx("div",{className:"pt-2 border-t border-border-muted",children:jsx(Q,{variant:"ghost",size:"sm",onPress:()=>g($=>({...$,[h.field]:false})),className:"w-full",children:"Show less"})})]})})]},h.field)}if(me==="number"){let Z,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"&&(Z=ge.value),ge.operator==="lte"&&typeof ge.value=="number"&&(ne=ge.value));};Te(l);let ie=Z!==void 0||ne!==void 0;return jsxs(Co,{id:h.field,children:[jsx(So,{title:h.label,description:h.description,className:z,endContent:ie?K(Z!==void 0&&ne!==void 0?`${Z} - ${ne}`:Z!==void 0?`\u2265 ${Z}`:`\u2264 ${ne}`):void 0}),jsx(wo,{className:W,children:jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 pb-4",children:[jsx(ti,{label:"Min",value:Z,onChange:ue=>L(h.field,ue,ne)},`${h.field}-min`),jsx(ti,{label:"Max",value:ne,onChange:ue=>L(h.field,Z,ue)},`${h.field}-max`)]})})]},h.field)}if(me==="boolean"){let Z=V(h.field);return jsxs(Co,{id:h.field,children:[jsx(So,{title:h.label,description:h.description,className:z,endContent:Z!==void 0?K(Z?"Yes":"No"):void 0}),jsx(wo,{className:W,children:jsxs("div",{className:"flex items-center justify-between pt-4 pb-4",children:[jsx("span",{className:"text-sm font-medium text-text-primary",children:Z!==void 0?Z?"Enabled":"Disabled":"No filter applied"}),jsx(ol,{size:"lg",isSelected:Z??false,onChange:ne=>A(h.field,ne?true:void 0),children:Z?"Yes":"No"})]})})]},h.field)}if(me==="date"){let Z,ne,Te=se=>{if(se)for(let Ne of se.conditions)"conditions"in Ne?Te(Ne):Ne.field===h.field&&(Ne.operator==="gte"&&(Z=String(Ne.value)),Ne.operator==="lte"&&(ne=String(Ne.value)));};Te(l);let ie=Z!==void 0||ne!==void 0,ue=se=>{if(se)try{return /^\d{4}-\d{2}-\d{2}$/.test(se)?Fa(se):void 0}catch{return}},ge=ue(Z),$=ue(ne);return jsxs(Co,{id:h.field,children:[jsx(So,{title:h.label,description:h.description,className:z,endContent:ie?K("Date range selected"):void 0}),jsx(wo,{className:W,children:jsx("div",{className:"pt-4 pb-4",children:jsx(rl,{label:"Date Range",value:ge&&$?{start:ge,end:$}:void 0,onChange:se=>{se?N(h.field,se.start,se.end):N(h.field,void 0,void 0);}})})})]},h.field)}return null},G=()=>jsxs("div",{className:"flex flex-col",children:[y.map(h=>{let H=(l?ln(l):[]).includes(h.field);return 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:[jsx("span",{className:"text-sm font-medium text-text-primary",children:h.label}),jsxs("div",{className:"flex items-center gap-2",children:[H&&jsx("span",{className:F,children:"1 active"}),jsx(I,{name:"CaretRight",size:"sm",className:"text-text-secondary"})]})]},h.field)}),C.map(h=>{let O=T(h);return 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:[jsx("span",{className:"text-sm font-medium text-text-primary",children:h}),jsxs("div",{className:"flex items-center gap-2",children:[O>0&&jsxs("span",{className:F,children:[O," active"]}),jsx(I,{name:"CaretRight",size:"sm",className:"text-text-secondary"})]})]},h)})]}),Y=h=>{if(h.startsWith("__ungrouped__")){let H=h.replace("__ungrouped__",""),j=y.find(oe=>oe.field===H);return j?jsx(Gn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[j.field],children:X(j)}):null}let O=S[h]||[];return O.length===0?null:jsx(Gn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[O[0].field],children:O.map(H=>X(H))})},P=()=>{if(f){let h=f.startsWith("__ungrouped__")&&y.find(O=>O.field===f.replace("__ungrouped__",""))?.label||f;return jsxs("div",{className:"flex flex-col h-full",children:[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:[jsx(I,{name:"CaretLeft",size:"sm",className:"text-text-secondary"}),jsx("span",{className:"text-sm font-medium text-text-primary",children:h})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:Y(f)})]})}return G()},w=()=>jsxs("div",{className:"flex h-full",children:[jsxs("div",{className:"w-48 flex-shrink-0 border-r border-border-muted overflow-y-auto bg-background-muted/30",children:[y.map(h=>{let H=(l?ln(l):[]).includes(h.field),j=f===`__ungrouped__${h.field}`;return 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-background-selected":"hover:bg-background-hover"}`,children:[jsx("span",{className:`text-sm truncate ${j?"font-semibold text-text-primary":"font-medium text-text-primary"}`,children:h.label}),H&&jsx("span",{className:"w-2 h-2 rounded-full bg-action-primary flex-shrink-0 ml-2"})]},h.field)}),C.map(h=>{let O=T(h),H=f===h;return 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-background-selected":"hover:bg-background-hover"}`,children:[jsx("span",{className:`text-sm truncate ${H?"font-semibold text-text-primary":"font-medium text-text-primary"}`,children:h}),O>0&&jsx("span",{className:"w-2 h-2 rounded-full bg-action-primary flex-shrink-0 ml-2"})]},h)})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:f?Y(f):jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-sm",children:"Select a category to view filters"})})]}),B=()=>jsx(Gn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[r[0].field],children:r.map(h=>X(h))});return jsx(rr,{isOpen:e,onClose:t,title:v&&x&&f?f.startsWith("__ungrouped__")?y.find(h=>h.field===f.replace("__ungrouped__",""))?.label||s:f:k>0?`${s} (${k} active)`:s,hideCloseIcon:false,primaryAction:{label:"Apply filters",onPress:R,variant:"primary"},secondaryAction:{label:"Clear all",onPress:E},maxWidth:v?"800px":"700px",height:"600px",mobileHeight:"85vh",contentPadding:false,footerContent:c!==void 0?jsxs("div",{className:"text-sm text-text-secondary text-center",children:[jsx("span",{className:"font-semibold text-text-primary",children:Gb(c)})," ",c===1?"result":"results"," with current filters"]}):void 0,children:r.length===0?jsx("div",{className:"py-12 text-center",children:jsx("div",{className:"text-sm font-medium text-text-secondary",children:"No filters available"})}):v?x?P():w():B()})}function Eu(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 cr(e="normal",t){return twMerge({strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[e],t&&"hover:text-action-primary cursor-pointer transition-colors")}function ke(e="left",t){return twMerge("flex items-center gap-1 min-w-0 overflow-hidden",Eu(e),t)}function il(e,t="\u2014"){return e==null||e===""?t:String(e)}var Po={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 Ht(e="normal"){return {strong:Po.lg,high:Po.lg,normal:Po.md,low:Po.sm}[e]}function ye(e,t){return typeof e=="function"?e(t):e}function Yb(e="neutral",t="sm"){return twMerge("inline-flex items-center rounded-full font-medium",t==="sm"?"px-2 py-0.5 text-xs":"px-2.5 py-1 text-sm",{success:"bg-feedback-success-background text-feedback-success-text",error:"bg-feedback-error-background text-feedback-error-text",warning:"bg-feedback-warning-background text-feedback-warning-text",info:"bg-feedback-info-background text-feedback-info-text",neutral:"bg-background-muted text-text-secondary"}[e])}function Kb(e){return e?"success":"neutral"}function sl(e,t=false){return t?e>0?"text-feedback-success-text":e<0?"text-feedback-error-text":"text-text-primary":"text-text-primary"}function Lu(e="hover",t="secondary"){let r={primary:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",secondary:"text-text-link-default hover:text-text-link-hover visited:text-text-link-default",default:"text-text-link-default hover:text-text-link-hover visited:text-text-link-default",brand:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",muted:"text-text-secondary hover:text-text-secondary visited:text-text-secondary",unstyled:""},o={visible:"underline underline-offset-4 decoration-1 cursor-pointer",hover:"hover:underline hover:underline-offset-4 hover:decoration-1 cursor-pointer transition-colors",none:"cursor-pointer"},n=r[t],a=o[e]||"";return `${n} ${a}`.trim()}function zr(e,t,r,o="hover",n="secondary",a,i){if(!t)return e;let s=typeof t=="function"&&r?t(r):t,c=Lu(o,n);return jsx("a",{href:s,className:twMerge(c,a==="strong"||a==="high"?"font-semibold":"",i),onClick:u=>{u.metaKey||u.ctrlKey;},children:e})}function Jb({row:e,context:t,actions:r,align:o="right",size:n="sm"}){let{isLoading:a}=t;if(a)return jsx(J,{className:Po.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 jsx("div",{className:c,children:s.map(l=>{let u=ye(l.disabled,e);return l.variant==="icon"||!l.label?jsx(Q,{variant:"icon",size:n,onPress:()=>{l.onClick(e);},isDisabled:u,"aria-label":l.label||l.id,children:jsx(I,{name:l.icon||"DotsThree",size:n==="sm"?16:20})},l.id):jsxs(Q,{variant:l.variant||"secondary",size:n,onPress:()=>{l.onClick(e);},isDisabled:u,children:[l.icon&&jsx(I,{name:l.icon,size:n==="sm"?14:16}),l.label]},l.id)})})}function qb({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:u="left",emptyText:d="\u2014",className:m,maxVisible:p=2,maxLabelLength:g}){let{isLoading:f}=r,b=(k,R)=>{if(!g||k.length<=g)return jsx(Fragment,{children:k});let E=k.slice(0,g-1)+"\u2026";return jsx(Lt,{content:R,children:jsx("span",{children:E})})};if(f)return jsx(J,{className:Ht("normal")});if(e==null||e==="")return jsx("div",{className:ke(u,"text-text-secondary"),children:d});if(Array.isArray(e)&&e.length===0)return jsx("div",{className:ke(u,"text-text-secondary"),children:d});let x=ke(u,m);if(Array.isArray(e)){let k=e.slice(0,p),R=e.slice(p),E=R.length>0;return jsx("div",{className:x,children:jsxs("div",{className:"flex items-center gap-1",children:[k.map((D,L)=>{let V=typeof o=="function"?o(D,t):o,A=typeof n=="function"?n(D,t):n!==void 0?n:String(D),N=typeof s=="function"?s(D,t):s,T=typeof l=="function"?l(D,t):l;return jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsx(Je,{variant:V,size:a,shape:i,dot:N,dotPosition:c,dotPulse:T,children:b(A,A)})},L)}),E&&jsx(Lt,{content:R.join(", "),children:jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxs(Je,{variant:"neutral",size:a,shape:i,children:["+",R.length]})})})]})})}let v=typeof o=="function"?o(e,t):o,C=typeof n=="function"?n(e,t):n!==void 0?n:String(e),y=typeof s=="function"?s(e,t):s,S=typeof l=="function"?l(e,t):l;return jsx("div",{className:x,children:jsx(Je,{variant:v,size:a,shape:i,dot:y,dotPosition:c,dotPulse:S,children:b(C,C)})})}function Zb({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:u}){let{isLoading:d}=t;if(d)return jsx(J,{className:Ht(l)});let m=!!e;if(!m&&!s)return jsx("div",{className:ke(c,u)});let p=ke(c,u);switch(r){case "icon":return jsx("div",{className:p,children:jsx(I,{name:m?a:i,size:16,className:m?"text-feedback-success-text":"text-text-disabled"})});case "text":return jsx("div",{className:p,children:jsx("span",{className:cr(l),children:m?o:n})});case "badge":return jsx("div",{className:p,children:jsx(Je,{variant:m?"success":"neutral",size:"sm",children:m?o:n})});default:return null}}function $b({row:e,context:t,firstName:r,lastName:o,email:n,avatarUrl:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:u="secondary",showEmail:d=false,badge:m,emphasis:p="normal",align:g="left",className:f,piiEntity:b}){let{isLoading:x}=t,v=ye(r,e),C=ye(o,e),y=ye(n,e),S=ye(a,e),k=ye(c,e),R=typeof m=="function"?m(e):m,E=ye(b,e),D=ke(g,f);return jsx("div",{className:D,children:jsx(Ps,{firstName:v,lastName:C,email:y,avatarUrl:S,layout:i,size:s,href:k,LinkComponent:l,linkVariant:u,showEmail:d,badge:R,emphasis:p,isLoading:x,piiEntity:E})})}function Qb({value:e,row:t,context:r,render:o,className:n}){let a=o(e,t,r);return jsx("div",{className:twMerge("h-full w-full",n),children:a})}function _b({value:e,row:t,context:r,format:o="date",customFormat:n,emptyText:a="\u2014",align:i="left",emphasis:s="normal",href:c,linkBehavior:l="hover",className:u}){let{isLoading:d}=r;if(d)return jsx(J,{className:Ht(s)});if(!e)return jsx("div",{className:ke(i,"text-text-secondary"),children:a});let m=e instanceof Date?e:new Date(e);if(isNaN(m.getTime()))return jsx("div",{className:ke(i,"text-text-secondary"),children:a});let p;switch(o){case "date":p=m.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});break;case "time":p=m.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});break;case "datetime":p=m.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});break;case "relative":p=uT(m);break;case "custom":p=n?m.toLocaleString("en-US",n):m.toISOString();break;default:p=m.toLocaleDateString();}let g=ke(i,twMerge(cr(s),u)),f=ye(c,t);return f?jsx("div",{className:g,children:zr(p,f,t,l)}):jsx("div",{className:g,children:p})}function uT(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 ll({manufacturer:e,model:t,deviceType:r,deviceTypeIconName:o,logoUrl:n,layout:a="stacked",size:i="md",href:s,LinkComponent:c,linkVariant:l="unstyled",showDeviceTypeIcon:u=true,showLogo:d=true,emphasis:m="normal",isLoading:p=false,className:g,piiEntity:f}){let[b,x]=useState(false),v=o||(r?mT(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],S=n&&!b&&d,R={strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[m],E=({children:D,className:L})=>s?c?jsx(c,{href:s,className:L,children:D}):jsx(Ue,{href:s,variant:l,className:twMerge("hover:underline",L),asButton:false,children:D}):jsx("span",{className:L,children:D});if(p)return a==="inline"?jsxs("div",{className:twMerge("flex items-center",y.gap,g),children:[jsx(J,{width:y.skeletonIcon,height:y.skeletonIcon,className:"flex-shrink-0 rounded"}),jsx(J,{width:y.skeletonText,height:y.skeletonIcon*.6})]}):jsxs("div",{className:twMerge("flex items-center",y.gap,g),children:[jsx(J,{width:y.skeletonIcon,height:y.skeletonIcon,className:"flex-shrink-0"}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx(J,{width:y.skeletonText,height:16}),jsx(J,{width:y.skeletonSecondary,height:12})]})]});if(a==="inline"){let D=`${e} ${t}`;return jsxs("div",{className:twMerge("flex items-center",y.gap,g),children:[jsx("div",{className:twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",y.logoSize),children:S?jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>x(true)}):jsx(I,{name:v,size:y.iconSize*.6,className:"text-text-secondary"})}),jsx(E,{className:twMerge("truncate leading-normal hover:text-text-primary",R,y.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:D})})]})}return jsxs("div",{className:twMerge("flex items-center justify-start",y.gap,g),children:[d&&jsx("div",{className:twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",y.logoSize),children:S?jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>x(true)}):jsx(I,{name:v,size:y.iconSize*.6,className:"text-text-secondary"})}),jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsx(E,{className:twMerge("truncate leading-normal hover:text-text-primary",R,y.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:e})}),jsxs("div",{className:twMerge("flex items-center gap-1.5 text-text-secondary leading-normal",y.secondaryTextSize),children:[u&&jsx(I,{name:v,size:y.iconInTextSize,className:"flex-shrink-0"}),jsx("span",{className:"truncate","data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:t})]})]})]})}function mT(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 tx({row:e,context:t,manufacturer:r,model:o,deviceType:n,logoUrl:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:u="secondary",showDeviceTypeIcon:d=true,showLogo:m=true,emphasis:p="normal",align:g="left",className:f,piiEntity:b}){let{isLoading:x}=t,v=ye(r,e),C=ye(o,e),y=ye(n,e),S=ye(a,e),k=ye(c,e),R=ye(b,e),E=ke(g,f);return jsx("div",{className:E,children:jsx(ll,{manufacturer:v,model:C,deviceType:y,logoUrl:S,layout:i,size:s,href:k,LinkComponent:l,linkVariant:u,showDeviceTypeIcon:d,showLogo:m,emphasis:p,isLoading:x,piiEntity:R})})}var fG={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},fT=["charging","discharging","heat","cool","on","connected"],gT={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 Au(e){return fT.includes(e)}function Iu(e){return gT[e]}function un({state:e,label:t,icon:r,isLoading:o,size:n="sm",shape:a="pill",dot:i,dotPulse:s,fixedWidth:c,className:l,...u}){if(o)return jsx(J,{className:"inline-flex h-6 w-20"});let d=t??Iu(e),m=Au(e);return jsxs(Je,{variant:e,size:n,shape:a,dot:i??m,dotPulse:s??m,className:c?`w-28 justify-center ${l||""}`:l,...u,children:[r&&jsx(I,{name:r,size:n==="sm"?12:n==="md"?14:16}),d]})}var xT={importing:"Importing",exporting:"Exporting"};function ox(e){return xT[e]}function dl({state:e,label:t,showIcon:r=false,isLoading:o,size:n="sm",shape:a="pill",fixedWidth:i,className:s,...c}){if(o)return jsx(J,{className:"inline-flex h-6 w-24"});let l=t??ox(e),u=e==="exporting"?"ArrowUp":"ArrowDown",d=n==="sm"?12:n==="md"?14:16;return r?jsx(Je,{variant:e,size:n,shape:a,className:`w-6 justify-center ${s||""}`,...c,children:jsx(I,{name:u,size:d})}):jsx(Je,{variant:e,size:n,shape:a,className:i?`w-28 justify-center ${s||""}`:s,...c,children:l})}function ul({state:e,stateLabel:t,metric:r,metricFormatter:o,secondaryState:n,layout:a="horizontal",isLoading:i,size:s="sm",shape:c="pill",icon:l,fixedWidth:u,secondaryStateIconOnly:d=false,className:m}){if(i)return jsx(J,{className:twMerge("inline-flex h-6 w-32",m)});let p=r!=null&&o?Oo(r,o):null,g=a==="horizontal",f=o&&!p;return jsxs("div",{className:twMerge("inline-flex items-center",g?"gap-2":"flex-col gap-1",m),children:[(p||f)&&jsx("span",{className:twMerge("font-medium inline-block",p?"text-text-primary":"text-text-secondary",s==="sm"&&"text-xs min-w-12",s==="md"&&"text-sm min-w-14",s==="lg"&&"text-base min-w-16"),children:p||"\u2014"}),jsx(un,{state:e,label:t,icon:l,size:s,shape:c,fixedWidth:u}),n&&jsx(Fragment,{children:n==="importing"||n==="exporting"?jsx(dl,{state:n,size:s,shape:c,fixedWidth:u,showIcon:d}):jsx(un,{state:n,size:s,shape:c,fixedWidth:u})})]})}function nx({value:e,row:t,context:r,metric:o,metricFormatter:n,secondaryState:a,size:i="sm",shape:s="pill",label:c,icon:l,fixedWidth:u=true,align:d="left",compact:m=false,className:p}){let{isLoading:g}=r;if(g){let y={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"}[s],S=o!=null||n!=null;return jsx("div",{className:"flex items-center gap-2",children:S?jsxs(Fragment,{children:[jsx(J,{className:"h-4 w-12"}),jsx(J,{className:`h-6 w-24 ${y}`}),jsx(J,{className:`h-6 w-20 ${y}`})]}):jsx(J,{className:`h-6 w-24 ${y}`})})}if(!e)return jsx("div",{className:ke(d,p),children:jsx("span",{className:"text-text-secondary",children:"\u2014"})});let f=ye(o,t),b=ye(a,t),x=typeof c=="function"?c(e,t):c,v=ke(d,p);return f!=null||n?jsx("div",{className:twMerge(v),children:jsx(ul,{state:e,stateLabel:x,metric:f,metricFormatter:n,secondaryState:b||void 0,size:i,shape:s,icon:l,fixedWidth:u,secondaryStateIconOnly:m,layout:"horizontal"})}):jsx("div",{className:v,children:jsx(un,{state:e,label:x,icon:l,size:i,shape:s,fixedWidth:u})})}function ix({value:e,row:t,context:r,formatter:o,align:n="left",emphasis:a="normal",href:i,linkBehavior:s="hover",className:c,emptyText:l="\u2014",emptyClassName:u="text-text-secondary"}){let{isLoading:d}=r;if(d)return jsx(J,{className:Ht(a)});let m=kr({value:e,formatter:o,emptyText:l,emptyClassName:u}),p=cr(a),g=ke(n,twMerge(p,c)),f=jsx("div",{className:g,children:m}),b=ye(i,t);return b?zr(f,b,t,s):f}var Bu=Ee__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:u,segmentGap:d=2,barWidth:m,context:p})=>{let g=useMemo(()=>r===t?100:Math.max(0,Math.min(100,(e-t)/(r-t)*100)),[e,t,r]),f=useMemo(()=>o==="auto"&&a?a.type==="diverging"&&a.center!==void 0?wa(e,t,r,a.center,a.scheme):Sa(e,t,r,a.scheme):o,[o,a,e,t,r]);if(p.isLoading)return jsx("div",{className:"flex items-center gap-2 w-full",style:{height:c},children:jsx("div",{className:"h-full flex-1 animate-pulse bg-border-default rounded"})});if(u&&u>0){let v=`calc((100% - ${d*(u-1)}px) / ${u})`,C=Math.ceil(g/100*u),y={height:c,...m&&{width:typeof m=="number"?`${m}px`:m,flexShrink:0}};return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:`flex gap-0.5 ${m?"":"flex-1"}`,style:y,children:Array.from({length:u}).map((S,k)=>{let R=k<C;return jsx("div",{className:"rounded-sm",style:{width:v,backgroundColor:R?f:n==="none"?"transparent":n,marginRight:k<u-1?`${d}px`:0}},k)})}),i&&jsx("span",{className:"text-sm text-text-primary 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 jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:`relative rounded-sm ${m?"":"flex-1"}`,style:b,children:jsx("div",{className:"absolute left-0 top-0 h-full rounded-sm",style:{width:`${g}%`,minWidth:g>0?l:0,backgroundColor:f}})}),i&&jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})});Bu.displayName="HorizontalBarCell";var Vu=Ee__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,u=a||100,d=i,{xScale:m,yScale:p,barWidth:g}=useMemo(()=>{if(s.length===0)return {xScale:scaleTime({range:[0,u],domain:[new Date,new Date]}),yScale:scaleLinear({range:[d,0],domain:[0,1]}),barWidth:2};let b=extent(s,R=>c(R)),x=min(s,R=>l(R))??0,v=max(s,R=>l(R))??0,C=x<0?x:0,y=scaleTime({range:[0,u],domain:b}),S=scaleLinear({range:[d,0],domain:[C,v*1.05]}),k=s.length>1?u/s.length*.8:8;return {xScale:y,yScale:S,barWidth:Math.max(2,k)}},[s,u,d]);if(n.isLoading)return jsx("div",{className:"flex items-center gap-0.5",style:{width:u,height:d},children:Array.from({length:5}).map((b,x)=>jsx("div",{className:"flex-1 animate-pulse bg-border-default rounded"},x))});if(!s||s.length===0)return jsx("div",{className:"flex items-center justify-center text-text-secondary text-xs",style:{width:u,height:d},children:"No data"});let f=p(0);return jsx("svg",{width:u,height:d,children:s.map((b,x)=>{let v=l(b),C=m(c(b)),y=p(v),S=Math.abs(f-y),k=b.category&&o?.[b.category]?o[b.category]:r;return jsx(Bar,{x:C-g/2,y:v>=0?y:f,width:g,height:S,fill:k,rx:1},`bar-${x}`)})})});Vu.displayName="MiniBarCell";function ux({value:e,row:t,context:r,format:o="number",decimals:n=0,prefix:a,suffix:i,emptyText:s="\u2014",align:c="right",emphasis:l="normal",href:u,linkBehavior:d="hover",showPositiveSign:m=false,colorCode:p=false,className:g}){let{isLoading:f}=r;if(f)return jsx(J,{className:Ht(l)});if(e==null||isNaN(Number(e)))return jsx("div",{className:ke(c,"text-text-secondary"),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 C=`${m&&b>0?"+":""}${x}`,y=p?sl(b,true):cr(l),S=ke(c,twMerge(y,g)),k=jsxs(Fragment,{children:[a&&jsx("span",{className:"text-text-secondary",children:a}),jsx("span",{children:C}),i&&jsx("span",{className:"text-text-secondary",children:i})]}),R=ye(u,t);return R?jsx("div",{className:S,children:zr(k,R,t,d)}):jsx("div",{className:S,children:k})}var zu=Ee__default.memo(({value:e,showLabel:t=true,color:r="var(--color-viz-categorical-1)",backgroundColor:o="var(--color-background-muted)",height:n=20,segments:a,segmentGap:i=2,colorScale:s,context:c})=>{let l=useMemo(()=>Math.max(0,Math.min(100,e)),[e]),u=useMemo(()=>r==="auto"&&s?s.type==="diverging"&&s.center!==void 0?wa(e,0,100,s.center,s.scheme):Sa(e,0,100,s.scheme):r,[r,s,e]);if(c.isLoading)return jsx("div",{className:"flex items-center gap-2",style:{height:n},children:jsx("div",{className:"h-full w-full animate-pulse bg-border-default rounded"})});if(a&&a>0){let m=`calc((100% - ${i*(a-1)}px) / ${a})`,p=Math.ceil(l/100*a);return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:"flex gap-0.5 flex-1",style:{height:n},children:Array.from({length:a}).map((g,f)=>{let b=f<p,x=u;if(r==="auto"&&s&&b){let v=(f+1)/a*100;s.type==="diverging"&&s.center!==void 0?x=wa(v,0,100,s.center,s.scheme):x=Sa(v,0,100,s.scheme);}return jsx("div",{className:"rounded-sm",style:{width:m,backgroundColor:b?x:o==="none"?"transparent":o,marginRight:f<a-1?`${i}px`:0}},f)})}),t&&jsxs("span",{className:"text-sm text-text-primary whitespace-nowrap",children:[l.toFixed(0),"%"]})]})}return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:"relative flex-1 rounded-sm",style:{height:n,backgroundColor:o==="none"?"transparent":o},children:jsx("div",{className:"absolute left-0 top-0 h-full rounded-sm transition-all duration-300",style:{width:`${l}%`,backgroundColor:u}})}),t&&jsxs("span",{className:"text-sm text-text-primary whitespace-nowrap",children:[l.toFixed(0),"%"]})]})});zu.displayName="PercentBarCell";function mx({row:e,context:t,isSelected:r=false,onSelect:o,isDisabled:n=false,align:a="center"}){let{isLoading:i}=t;if(i)return jsx("div",{className:ke(a),children:jsx(J,{className:"h-4 w-4 rounded"})});let s=ye(n,e),c=ke(a);return jsx("div",{className:c,children:jsx(_o,{isSelected:r,onChange:l=>{o?.(e,l);},isDisabled:s,"aria-label":"Select row"})})}function fl({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:u=false,className:d,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-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[l],x=[];t&&x.push(t),r&&o?x.push(`${r} ${o}`):r?x.push(r):o&&x.push(o);let v=x.join(", "),C=({children:S,className:k})=>i?s?jsx(s,{href:i,className:k,children:S}):jsx(Ue,{href:i,variant:c,className:twMerge("hover:underline",k),asButton:false,children:S}):jsx("span",{className:k,children:S});if(u)return n==="inline"?jsxs("div",{className:twMerge("flex items-center",g.gap,d),children:[jsx(J,{width:g.skeletonIconInline,height:g.skeletonIconInline,className:"flex-shrink-0 rounded"}),jsx(J,{width:g.skeletonText,height:g.skeletonIconInline*.8})]}):jsxs("div",{className:twMerge("flex items-center",g.gap,d),children:[jsx(J,{width:g.skeletonIconStacked,height:g.skeletonIconStacked,className:"flex-shrink-0 rounded"}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx(J,{width:g.skeletonText,height:16}),jsx(J,{width:g.skeletonSecondary,height:12})]})]});if(n==="inline")return jsxs(C,{className:twMerge("flex items-center",g.gap,i&&"hover:bg-background-hover transition-colors",d),children:[jsx(I,{name:"MapPin",size:g.iconSize,className:"text-text-secondary flex-shrink-0"}),jsx("span",{className:twMerge("leading-normal truncate hover:text-text-primary",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 y=()=>{if(m){if(t&&r&&o)return "city-state-zip";if(t&&r)return "city-state";if(t)return "city";if(r)return "state";if(o)return "postal-code"}};return jsxs("div",{className:twMerge("flex items-center justify-start",g.gap,d),children:[jsx("div",{className:twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",g.iconContainerSize),children:jsx(I,{name:"MapPin",size:g.iconSize,className:"text-text-secondary"})}),jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsx(C,{className:twMerge("leading-normal truncate hover:text-text-primary",b,g.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":m?"address":void 0,"data-pii-entity":m,children:e})}),v&&jsx("div",{className:twMerge("text-text-secondary leading-normal truncate",g.secondaryTextSize),"data-pii-type":y(),"data-pii-entity":m,children:v})]})]})}function gx({row:e,context:t,streetAddress:r,city:o,state:n,postalCode:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:u="secondary",emphasis:d="normal",align:m="left",className:p,piiEntity:g}){let{isLoading:f}=t,b=ye(r,e),x=ye(o,e),v=ye(n,e),C=ye(a,e),y=ye(c,e),S=ye(g,e),k=ke(m,p);return jsx("div",{className:k,children:jsx(fl,{streetAddress:b,city:x,state:v,postalCode:C,layout:i,size:s,href:y,LinkComponent:l,linkVariant:u,emphasis:d,isLoading:f,piiEntity:S})})}var Ou=Ee__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||[],u=s||100,d=c,{xScale:m,yScale:p}=useMemo(()=>{if(l.length===0)return {xScale:scaleTime({range:[0,u],domain:[new Date,new Date]}),yScale:scaleLinear({range:[d,0],domain:[0,1]})};let f=extent(l,C=>C.xValue),b=min(l,C=>C.yValue)||0,x=max(l,C=>C.yValue)||0,v=(x-b)*.1||1;return {xScale:scaleTime({range:[0,u],domain:f}),yScale:scaleLinear({range:[d,0],domain:[b-v,x+v]})}},[l,u,d]);if(i.isLoading)return jsx("div",{className:"flex items-center",style:{width:u,height:d},children:jsx("div",{className:"h-1 w-full animate-pulse bg-border-default rounded"})});if(!l||l.length===0)return jsx("div",{className:"flex items-center justify-center text-text-secondary text-xs",style:{width:u,height:d},children:"No data"});let g=a&&l[0]?.category&&a[l[0].category]?a[l[0].category]:o;return jsxs("svg",{width:u,height:d,className:"overflow-visible",children:[(r==="area"||r==="both")&&jsx(AreaClosed,{data:l,x:f=>m(f.xValue),y:f=>p(f.yValue),yScale:p,fill:g,fillOpacity:.15,curve:curveLinear}),(r==="line"||r==="both")&&jsx(LinePath,{data:l,x:f=>m(f.xValue),y:f=>p(f.yValue),stroke:g,strokeWidth:n,strokeLinecap:"round",curve:curveLinear})]})});Ou.displayName="SparklineCell";function yx({value:e,row:t,context:r,prefix:o,suffix:n,emptyText:a="\u2014",href:i,linkBehavior:s="hover",linkVariant:c="secondary",emphasis:l="normal",truncate:u=true,copyable:d=false,align:m="left",className:p,piiType:g,piiEntity:f}){let{isLoading:b}=r;if(b)return jsx(J,{className:Ht(l)});let x=il(e,a),v=ye(i,t),C=ye(f,t),y=x,S=false,k=false;if(u&&x&&typeof x=="string")if(typeof u=="boolean")k=true;else {let{position:T="end",length:z=16,ellipsis:W="...",tooltip:F=true}=u;if(x.length>z){switch(T){case "start":y=Wi(x,z);break;case "middle":y=An(x,z);break;case "end":y=Gi(x,z,W);break}S=F;}}let R=g&&C?{"data-pii-type":g,"data-pii-entity":C}:{},E=Object.keys(R).length>0,D=jsx("span",{className:k?"truncate":"",...R,children:y}),L=S?jsx(Lt,{content:E?jsx("span",{...R,children:String(x)}):String(x),children:D}):D,V=jsxs(Fragment,{children:[o&&jsx("span",{className:"text-text-secondary",children:o}),L,n&&jsx("span",{className:"text-text-secondary",children:n})]}),A=V;if(d&&x&&x!==a){let T=typeof d=="function"?d(t):String(x);A=jsx(ho,{value:T,size:"sm",children:V});}if(v){let T=ke(m,p);return jsx("div",{className:T,children:zr(A,v,t,s,c,l)})}let N=ke(m,twMerge(cr(l),p));return jsx("div",{className:N,children:A})}var JT={sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"},jT={sm:"hidden sm:grid",md:"hidden md:grid",lg:"hidden lg:grid",xl:"hidden xl:grid"};function gl(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function bl(e,t,r,o){if(r.cell){let n=r.cell,a=typeof r.cellProps=="function"?r.cellProps(e,t):r.cellProps;return jsx(n,{value:e,row:t,context:o,...a})}return r.render?r.render(e,t,o):e?.toString()??"\u2014"}function hl({row:e,columns:t,density:r,isLoading:o,onClick:n}){let a=t.filter(d=>d.mobile!==false).map(d=>{let m=d.mobile===false?null:d.mobile;return {...d,mobilePriority:m?.priority??2,mobileFormat:m?.format??"secondary",showLabel:m?.label??m?.format==="secondary",icon:m?.icon}}).sort((d,m)=>d.mobilePriority-m.mobilePriority),i=a.filter(d=>d.mobilePriority===1||d.mobileFormat==="primary"),s=a.filter(d=>d.mobilePriority===2&&d.mobileFormat!=="primary"),c=a.filter(d=>d.mobileFormat==="badge"),l={isLoading:!!o,rowIndex:0,columnIndex:0,density:r};return jsxs("div",{className:twMerge("border-b border-border-default bg-background-surface transition-colors",n&&"cursor-pointer hover:bg-background-hover active:bg-background-pressed",{compact:"px-3 py-2",default:"px-4 py-3",relaxed:"px-4 py-4"}[r]),onClick:n,role:n?"button":void 0,tabIndex:n?0:void 0,children:[i.length>0&&jsxs("div",{className:"mb-2 flex items-start justify-between",children:[jsx("div",{className:"flex-1",children:i.map(d=>{let m=gl(e,d);return jsx("div",{className:"font-medium text-text-primary [&>*]:!justify-start [&>*]:!text-left",children:bl(m,e,d,l)},d.id)})}),c.length>0&&jsx("div",{className:"ml-2 flex flex-wrap gap-1",children:c.map(d=>{let m=gl(e,d);return jsx("div",{className:"inline-flex",children:bl(m,e,d,l)},d.id)})})]}),s.length>0&&jsx("div",{className:"space-y-1",children:s.map(d=>{let m=gl(e,d),p=d.showLabel&&d.label;return jsxs("div",{className:"flex items-center text-sm text-text-secondary",children:[d.icon&&jsx(I,{name:d.icon,className:"mr-1.5 h-4 w-4 flex-shrink-0"}),p&&jsxs("span",{className:"mr-1 font-medium",children:[d.label,":"]}),jsx("span",{className:"truncate [&>*]:!justify-start [&>*]:!text-left",children:bl(m,e,d,l)})]},d.id)})})]})}function yl({row:e,columns:t,density:r,isLoading:o,onClick:n}){let a=t.filter(c=>c.mobile!==false),i={isLoading:!!o,rowIndex:0,columnIndex:0,density:r};return jsx("div",{className:twMerge("border-b border-border-default bg-background-surface transition-colors",n&&"cursor-pointer hover:bg-background-hover active:bg-background-pressed",{compact:"px-3 py-2",default:"px-4 py-3",relaxed:"px-4 py-4"}[r]),onClick:n,role:n?"button":void 0,tabIndex:n?0:void 0,children:jsx("div",{className:"space-y-2",children:a.map((c,l)=>{let u=gl(e,c),d=l===0;return jsxs("div",{children:[!d&&jsx("div",{className:"text-xs text-text-secondary",children:c.label}),jsx("div",{className:twMerge(d?"font-medium text-text-primary":"text-sm text-text-primary","[&>*]:!justify-start [&>*]:!text-left"),children:bl(u,e,c,i)})]},c.id)})})})}function vx(e="md"){return {mobile:JT[e],desktop:jT[e]}}function Cx({density:e}){return jsxs("div",{className:twMerge("border-b border-border-default bg-background-surface",{compact:"px-3 py-2",default:"px-4 py-3",relaxed:"px-4 py-4"}[e]),children:[jsx("div",{className:"mb-2 h-5 w-3/4 animate-pulse rounded bg-background-muted"}),jsxs("div",{className:"space-y-1",children:[jsx("div",{className:"h-4 w-1/2 animate-pulse rounded bg-background-muted"}),jsx("div",{className:"h-4 w-2/3 animate-pulse rounded bg-background-muted"})]})]})}var ik={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},sk={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"};function lk(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 ck({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:u,setNodeRef:d,transform:m,transition:p,isDragging:g}=useSortable({id:e.id,disabled:!c||s}),f=t?.columnId===e.id,b=f?t.direction:null,x=n&&a,v={...lk(e),transform:CSS.Transform.toString(m),transition:p,opacity:g?.8:1,zIndex:g?50:void 0};return jsx("div",{ref:d,className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.sortable?"gap-2":"gap-1",ik[i],sk[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-primary":"font-medium text-text-secondary",g&&"bg-background-hover"),style:v,role:"columnheader","aria-sort":f?b==="asc"?"ascending":"descending":"none","aria-disabled":s,...l,...u,children:s?jsx(J,{className:"h-4 w-24"}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1 truncate cursor-pointer",onClick:()=>!s&&e.sortable&&r(e.id),children:e.label}),e.sortable&&jsx("button",{type:"button",className:"flex flex-shrink-0 cursor-pointer",onClick:()=>!s&&r(e.id),"aria-label":`Sort by ${e.label}`,children:f?jsx(I,{name:b==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-primary"}):jsx(I,{name:"CaretUpDown",size:12,className:"text-text-secondary opacity-40"})})]})})}function wx({columns:e,columnOrder:t,onColumnOrderChange:r,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,density:s="default",isLoading:c=false}){let l=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:5}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),u=new Map(e.map(p=>[p.id,p])),d=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(u.get(f.id)?.reorderable===false)return;let C=0;for(let R=0;R<t.length&&u.get(t[R])?.reorderable===false;R++)C=R+1;if(x<C)return;let y=Math.min(b,x),S=Math.max(b,x);for(let R=y;R<=S;R++){if(R===b)continue;if(u.get(t[R])?.reorderable===false)return}let k=arrayMove(t,b,x);r(k);}},m=t.map(p=>u.get(p)).filter(p=>p!==void 0);return jsx(DndContext,{sensors:l,collisionDetection:closestCenter,onDragEnd:d,children:jsx(SortableContext,{items:t,strategy:horizontalListSortingStrategy,children:jsx("div",{className:"contents",role:"rowgroup",children:m.map((p,g)=>jsx(ck,{column:p,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,isFirstColumn:g===0,density:s,isLoading:c},p.id))})})})}var Uu={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},Yu={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"},gk={full:"w-full",auto:"w-auto inline-block",contained:"w-full max-w-6xl mx-auto"},bk={auto:"table-auto",fixed:"table-fixed",responsive:"table-auto"};function Ku(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 xk(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function hk({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,u=n&&a;return jsx("div",{className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.sortable?"gap-2":"gap-1",Uu[i],Yu[e.align||"left"],o&&"sticky top-0 z-10",u&&"sticky left-0 z-20 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",o&&u&&"z-30",e.sortable&&!s&&"cursor-pointer hover:bg-background-hover",s&&"cursor-not-allowed opacity-60",c?"font-bold text-text-primary":"font-medium text-text-secondary"),onClick:()=>!s&&e.sortable&&r(e.id),role:"columnheader","aria-sort":c?l==="asc"?"ascending":"descending":"none","aria-disabled":s,style:Ku(e),children:s?jsx(J,{className:"h-4 w-24"}):jsxs(Fragment,{children:[jsx("span",{className:"truncate",children:e.label}),e.sortable&&jsx("div",{className:"flex flex-shrink-0",children:c?jsx(I,{name:l==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-primary"}):jsx(I,{name:"CaretUpDown",size:12,className:"text-text-secondary opacity-40"})})]})})}function yk({column:e,row:t,rowIndex:r,columnIndex:o,isHovered:n,density:a="default",className:i,stickyFirstColumn:s}){let c=s&&o===0,l=xk(t,e),u={isLoading:false,isHovered:n,rowIndex:r,columnIndex:o,density:a},d;if(e.cell){let m=e.cell,p=typeof e.cellProps=="function"?e.cellProps(l,t):e.cellProps;d=jsx(m,{value:l,row:t,context:u,...p});}else e.render?d=e.render(l,t,u):d=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"),d=jsxs(DialogTrigger,{...b==="hover"?{trigger:"longPress"}:{},children:[jsx("div",{className:"cursor-help",children:d}),jsx(Ze,{placement:g,showArrow:f,children:jsx("div",{className:"p-2",children:p})})]});}return jsx("div",{className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.noCellPadding?"":Uu[a],Yu[e.align||"left"],c&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",i),role:"cell",style:Ku(e),children:d})}function vk({column:e,rowIndex:t,columnIndex:r,density:o="default",stickyFirstColumn:n}){let a=n&&r===0,i={isLoading:true,rowIndex:t,columnIndex:r,density:o},s;if(e.cell){let c=e.cell,l=typeof e.cellProps=="function"?e.cellProps(null,{}):e.cellProps;s=jsx(c,{value:null,row:{},context:i,...l});}else e.render?s=e.render(null,{},i):s=jsx(J,{className:"h-4 w-full max-w-[200px]"});return jsx("div",{className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.noCellPadding?"":Uu[o],Yu[e.align||"left"],a&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),role:"cell",style:Ku(e),children:s})}function Ck(e,t){let r=new Set(["BUTTON","A","INPUT","SELECT","TEXTAREA"]),o=new Set(["button","link","checkbox","switch","menuitem","option"]),n=e;for(;n&&n!==t;){if(r.has(n.tagName))return true;let a=n.getAttribute("role");if(a&&o.has(a))return true;n=n.parentElement;}return false}function Nx({columns:e,row:t,rowIndex:r,density:o="default",onClick:n,stickyFirstColumn:a}){let[i,s]=useState(false),c=useCallback(l=>{if(!n)return;let u=l.target,d=l.currentTarget;Ck(u,d)||n(t);},[n,t]);return jsx("div",{className:twMerge("contents group",n&&"cursor-pointer"),role:"row",onClick:c,onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),children:e.map((l,u)=>jsx(yk,{column:l,row:t,rowIndex:r,columnIndex:u,isHovered:i,density:o,className:n?"group-hover:bg-background-hover":"",stickyFirstColumn:a},l.id))})}function Tx({columns:e,rowIndex:t,density:r="default",stickyFirstColumn:o}){return jsx("div",{className:"contents",role:"row",children:e.map((n,a)=>jsx(vk,{column:n,rowIndex:t,columnIndex:a,density:r,stickyFirstColumn:o},n.id))})}function kx({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:u="md",isLoading:d=false,loadingState:m,loadingRowCount:p=5,onLoadMore:g,hasMore:f=false,enableVirtualization:b,estimatedRowHeight:x,loadingIndicator:v,stickyHeader:C=false,stickyFirstColumn:y=false,onRowClick:S,getRowId:k,hideHeader:R=false,sortConfig:E,onSort:D,"aria-label":L,enableColumnReorder:V=false,columnOrder:A,onColumnOrderChange:N}){let[T,z]=useState(null),W=E!==void 0,F=W?E:T,K=useRef(null),X=useMemo(()=>e.map(te=>te.id),[e]),[G,Y]=useState(X),P=A!==void 0,w=P?A:G;useEffect(()=>{P||Y(te=>{let ce=e.map(ee=>ee.id),_=new Set(ce),q=new Set(te),U=te.filter(ee=>_.has(ee)),ae=ce.filter(ee=>!q.has(ee));return [...U,...ae]});},[e,P]);let B=useCallback(te=>{P||Y(te),N?.(te);},[P,N]),M=useMemo(()=>{if(!V&&!A)return e;let te=new Map(e.map(ce=>[ce.id,ce]));return w.map(ce=>te.get(ce)).filter(ce=>ce!==void 0)},[e,w,V,A]),h=g?co({items:t,onLoadMore:g,hasMore:f,isLoading:d,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:Z}=h||{},{gridTemplateColumns:ne,totalMinWidth:Te}=useMemo(()=>{let te=0;return {gridTemplateColumns:M.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 q=typeof _.minWidth=="number"?`${_.minWidth}px`:_.minWidth,U=typeof _.maxWidth=="number"?`${_.maxWidth}px`:_.maxWidth;return `minmax(${q}, ${U})`}return _.minWidth?`minmax(${typeof _.minWidth=="number"?`${_.minWidth}px`:_.minWidth}, 1fr)`:_.maxWidth?`minmax(0, ${typeof _.maxWidth=="number"?`${_.maxWidth}px`:_.maxWidth})`:"1fr"}).join(" "),totalMinWidth:te}},[M]),ie=useCallback(te=>{if(!e.find(q=>q.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=Z==="loading"||d&&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 $=twMerge(gk[n],!g&&(s==="responsive"?"overflow-x-auto scrollbar-visible":"overflow-auto scrollbar-visible"),r),se=vx(u),Ne=c!=="none",Ve=(te,ce)=>Ne?c==="custom"&&l?l(te,ce):jsx(c==="cards"?yl:hl,{row:te,columns:M,density:o,isLoading:d,onClick:S?()=>S(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 jsxs("div",{ref:O,className:$,style:{...ge,position:j?"relative":void 0},children:[jsxs("div",{className:twMerge("grid border-separate border-spacing-0",bk[s],n==="auto"?"inline-grid w-auto":"w-full",Ne&&se.desktop),role:"table","aria-label":L,style:{gridTemplateColumns:ne,minWidth:Te>0?`${Te}px`:void 0},children:[!R&&(V?jsx(wx,{columns:e,columnOrder:w,onColumnOrderChange:B,sortConfig:F,onSort:ie,stickyHeader:C,stickyFirstColumn:y,density:o,isLoading:ue}):jsx("div",{className:"contents",role:"rowgroup",children:M.map((te,ce)=>jsx(hk,{column:te,sortConfig:F,onSort:ie,stickyHeader:C,stickyFirstColumn:y,isFirstColumn:ce===0,density:o,isLoading:ue},te.id))})),j?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)=>jsx("div",{className:"contents",children:jsx(Tx,{columns:M,rowIndex:ce,density:o,stickyFirstColumn:y})},`loading-${ce}`)):t.length>0?jsxs(Fragment,{children:[De.map(({row:te,index:ce,virtualItem:_})=>{if(!te||!_)return null;let q=k?k(te):`row-${ce}`;return 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:jsx(Nx,{columns:M,row:te,rowIndex:ce,density:o,onClick:S,stickyFirstColumn:y})},q)}),me&&jsx("div",{style:{position:"absolute",top:`${j.getTotalSize()}px`,left:0,width:"100%"},children:v||jsx(tr,{state:"loading-more"})})]}):jsx("div",{className:"py-12 text-center text-text-secondary",children:"No data available"})}):jsx("div",{className:"contents",role:"rowgroup",children:ue?Array.from({length:p}).map((te,ce)=>jsx(Tx,{columns:M,rowIndex:ce,density:o,stickyFirstColumn:y},`loading-${ce}`)):t.length>0?jsxs(Fragment,{children:[De.map(({row:te,index:ce})=>{if(!te)return null;let _=k?k(te):`row-${ce}`;return jsx(Nx,{columns:M,row:te,rowIndex:ce,density:o,onClick:S,stickyFirstColumn:y},_)}),me&&jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1"},children:v||jsx(tr,{state:"loading-more"})})]}):jsx("div",{className:"col-span-full py-12 text-center text-text-secondary",role:"row",children:jsx("div",{role:"cell",children:"No data available"})})})]}),Ne&&jsx("div",{className:se.mobile,children:ue?Array.from({length:p}).map((te,ce)=>jsx(Cx,{density:o},`mobile-loading-${ce}`)):t.length>0?jsxs(Fragment,{children:[De.map(({row:te,index:ce})=>{if(!te)return null;let _=k?k(te):`mobile-row-${ce}`;return jsx("div",{className:"border-b border-border-default last:border-b-0",children:Ve(te,ce)},_)}),me&&(v||jsx(tr,{state:"loading-more"}))]}):jsx("div",{className:"py-12 text-center text-text-secondary",children:"No data available"})}),g&&f&&!ue&&(j?jsx("div",{ref:H,style:{position:"absolute",top:`${j.getTotalSize()}px`,left:0,width:"100%",height:1}}):jsx("div",{ref:H,className:"h-px w-full"}))]})}function Rx({status:e,alertCount:t,showCount:r=false,isLoading:o,size:n="sm",shape:a="pill",...i}){if(o)return 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",u=r&&t?`${c[e]} (${t})`:c[e];return jsx(Je,{variant:s[e],size:n,shape:a,dot:l,dotPulse:l,...i,children:u})}var wk={battery:"BatteryHigh",charger:"ChargingStation",thermostat:"ThermometerSimple",inverter:"Power",vehicle:"Car",meter:"Gauge",gateway:"WifiHigh",other:"Cube",unknown:"Question"},Nk={battery:"Battery",charger:"Charger",thermostat:"Thermostat",inverter:"Inverter",vehicle:"Vehicle",meter:"Meter",gateway:"Gateway",other:"Other",unknown:"Unknown"};function Mx({deviceType:e,iconName:t,size:r="md",showLabel:o=false,className:n}){let a=t||(e?wk[e]:"Question"),i=e?Nk[e]:void 0;return jsxs("div",{className:twMerge("inline-flex items-center",o?"flex-col gap-1":"gap-0",n),children:[jsx(I,{name:a,size:r}),o&&i&&jsx("span",{className:"text-xs text-text-secondary",children:i})]})}function ii({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:u,className:d,primaryAction:m,secondaryAction:p,tertiaryAction:g,footerContent:f,contentPadding:b=true,maxWidth:x="400px"}){if(!s)return null;let v=t||r,C=m||p||g||f;return jsx(mr,{children:jsx(Ut,{isOpen:s,onOpenChange:y=>!y&&u?.(),isDismissable:true,transparent:l,children:jsx(Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxs(Dialog,{className:twMerge("fixed top-0 bottom-0 flex flex-col bg-background-surface shadow-xl overflow-hidden",c==="right"?"right-0":"left-0",c==="right"?"animate-in slide-in-from-right duration-300 ease-out":"animate-in slide-in-from-left duration-300 ease-out","data-[exiting]:animate-out",c==="right"?"data-[exiting]:slide-out-to-right":"data-[exiting]:slide-out-to-left","data-[exiting]:duration-200 data-[exiting]:ease-in","outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default focus-visible:outline-offset-0",d),style:{maxWidth:x,width:"100%"},children:[v&&(a&&i?jsx(Ct,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,hasBackArrow:true,onBack:i,onClose:u}):jsx(Ct,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,onClose:u})),jsx("div",{className:twMerge("flex-1 overflow-y-auto overscroll-contain",b?"px-6 py-6":"p-0"),children:e}),C&&jsx(fo,{primaryAction:m,secondaryAction:p,tertiaryAction:g,footerContent:f})]})})})})}ii.displayName="Drawer";var Dk={sm:"gap-4 px-6 py-8",md:"gap-5 px-8 py-12",lg:"gap-6 px-10 py-16"},Mk={sm:"xs",md:"sm",lg:"md"},Ek={sm:et("bodySm"),md:et("bodySm"),lg:et("bodyMd")},Lk={sm:"h-10 w-10",md:"h-12 w-12",lg:"h-16 w-16"},Ak={sm:20,md:24,lg:32},Ik={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"},Fk={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 Ax({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:u=false,className:d}){let m=i==="sm"?"sm":"md",p=c==="spotlight",g=p?{background:Fk[l]}:void 0,f=()=>a?jsx("div",{className:"empty-state-actions mt-2 flex flex-wrap items-center gap-3",children:a}):o||n?jsxs("div",{className:"empty-state-actions mt-2 flex flex-col gap-3",children:[o&&(o.href?jsx(Q,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,href:o.href,children:o.label}):jsx(Q,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,children:o.label})),n&&jsx(Ue,{href:n.href||"#",variant:"muted",onPress:n.onPress,className:et("labelMd"),children:n.label})]}):null;return jsxs("section",{"data-testid":"empty-state",role:"status","aria-live":"polite",className:twMerge("flex w-full flex-col rounded-xl text-text-primary",Dk[i],Ik[s],u?"h-full justify-center":"",p?"relative overflow-hidden":"",d),style:g,children:[e&&jsx("div",{className:twMerge("flex items-center justify-center rounded-full border border-border-muted bg-background-muted text-text-secondary",Lk[i]),children:jsx(I,{name:e,size:Ak[i]})}),jsx(Et,{size:Mk[i],tag:"h2",className:"text-text-secondary",children:t}),r&&jsx("p",{className:twMerge("max-w-xs text-text-secondary whitespace-pre-line",Ek[i]),children:r}),f()]})}function Ix({status:e,programName:t,isLoading:r,size:o="sm",shape:n="pill",...a}){if(r)return 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=jsx(Je,{variant:i[e],size:o,shape:n,...a,children:s[e]});return t?jsx(Lt,{content:t,children:c}):c}function Bx({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[u,d]=useState(false),[m,p]=useState(false),[g,f]=useState(null),[b,x]=useState(e),v=useRef(null),C=async k=>{if(f(null),n&&k.size>n){f(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(c&&k.type.startsWith("image/")){let R=new FileReader;R.onloadend=()=>{x(R.result);},R.readAsDataURL(k);}if(i){p(true);try{let R=await i(k);x(R),r?.(R);}catch(R){f("Failed to upload file"),console.error("Upload error:",R);}finally{p(false);}}t?.(k,b);},y=async k=>{try{let R=k.items;if(R.length>0){let E=R[0];if(E.kind==="file"){let D=await E.getFile();D&&C(D);}}}catch(R){f("Failed to upload file"),console.error("Upload error:",R);}finally{d(false);}},S=()=>{x(void 0),f(null),t?.(null),r?.(""),v.current&&(v.current.value="");};return jsxs("div",{className:twMerge("w-full",s),children:[jsxs(DropZone,{className:twMerge("relative flex min-h-[200px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",u?"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:y,onDropEnter:()=>d(true),onDropExit:()=>d(false),children:[b?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[c&&(b.startsWith("data:image")||b.startsWith("http"))?jsx("img",{src:b,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx(Image$1,{className:"h-12 w-12 text-text-secondary"}),jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!a&&jsx(Q,{variant:"icon",size:"sm",onPress:S,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsx(X,{className:"h-4 w-4"})})]}):jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsx(Upload,{className:"h-12 w-12 text-text-secondary"}),jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-sm text-text-primary",children:l}),jsx("p",{className:"mt-1 text-xs text-text-secondary",children:o==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${o}`})]}),jsx(FileTrigger,{acceptedFileTypes:o.split(","),onSelect:k=>{let R=Array.from(k||[]);R.length>0&&C(R[0]);},children:jsx(Q,{variant:"secondary",size:"sm",isDisabled:a,children:"Choose File"})})]}),m&&jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),g&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function zx({version:e,isLatest:t,updateAvailable:r,isLoading:o,size:n="sm",shape:a="rounded",...i}){if(o)return jsx(J,{className:"inline-flex h-6 w-16"});let s="neutral",c=e;return t?s="success":r&&(s="warning",c=`${e} (Update)`),jsx(Je,{variant:s,size:n,shape:a,...i,children:c})}function na(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Hx({placeholder:e="Search...",value:t,onChange:r,isOpen:o,onOpenChange:n,trigger:a,children:i,showShortcutHint:s=true,showInput:c=true,className:l}){let[u,d]=useState(false),m=kt("(max-width: 767px)"),p=o!==void 0?o:u,g=useCallback(v=>{n?n(v):d(v);},[n]);useEffect(()=>{let v=C=>{(C.metaKey||C.ctrlKey)&&C.key==="k"&&(C.preventDefault(),g(!p)),C.key==="Escape"&&p&&g(false);};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[p,g]);let f=useCallback(v=>{r?.(v);},[r]),b=jsxs("button",{type:"button",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-secondary hover:text-text-primary hover:bg-background-hover rounded-md transition-colors","aria-label":"Open search",children:[jsx(I,{name:"MagnifyingGlass",size:18}),!m&&s&&jsxs("span",{className:"hidden md:flex items-center gap-1 text-xs",children:[jsx("kbd",{className:"px-1.5 py-0.5 bg-background-muted border border-border-muted rounded text-xs",children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{className:"px-1.5 py-0.5 bg-background-muted border border-border-muted rounded text-xs",children:"K"})]})]}),x=a===null||isValidElement(a)&&a.type===Fragment$1&&!a.props.children;return m?jsxs(Fragment,{children:[!x&&(a?jsx("button",{type:"button",onClick:()=>g(true),className:"appearance-none bg-transparent border-none p-0 cursor-pointer",children:a}):jsx("button",{type:"button",onClick:()=>g(true),className:"appearance-none bg-transparent border-none p-0 cursor-pointer",children:b})),jsx(Xe,{isOpen:p,onClose:()=>g(false),hideCloseIcon:false,contentPadding:false,maxHeight:"90vh",children:jsxs("div",{className:"flex flex-col h-full",children:[c&&jsx("div",{className:"p-4 border-b border-border-muted flex-shrink-0",children:jsx(lr,{value:t,onChange:f,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:l,autoFocus:true})}),jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:i})]})})]}):x?null:jsxs(DialogTrigger,{isOpen:p,onOpenChange:g,children:[a||b,jsx(Ze,{placement:"bottom",className:"w-[600px] max-w-[90vw] bg-background-surface shadow-xl border border-border-default rounded-lg overflow-hidden",children:jsxs("div",{className:"flex flex-col",children:[c&&jsx("div",{className:"p-4 border-b border-border-muted",children:jsx(lr,{value:t,onChange:f,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:l,autoFocus:true})}),jsx("div",{className:"max-h-[500px] overflow-hidden",children:i})]})})]})}function Ux({placeholder:e="Search...",value:t,onChange:r,isOpen:o,onOpenChange:n,children:a,maxHeight:i="400px",variant:s="default",className:c}){let[l,u]=useState(false),d=kt("(max-width: 767px)"),m=useRef(null),p=useRef(null),g=o!==void 0?o:l,f=useCallback(L=>{n?n(L):u(L);},[n]);useEffect(()=>{let L=V=>{(V.metaKey||V.ctrlKey)&&V.key==="k"&&(V.preventDefault(),f(!g)),V.key==="Escape"&&g&&f(false);};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[g,f]),useEffect(()=>{g&&!d&&m.current&&setTimeout(()=>{m.current?.querySelector("input")?.focus();},0);},[g,d]),useEffect(()=>{if(!g||d)return;let L=V=>{let A=V.target,N=m.current?.contains(A),T=p.current?.contains(A);!N&&!T&&f(false);};return document.addEventListener("mousedown",L,true),()=>document.removeEventListener("mousedown",L,true)},[g,d,f]);let b=L=>{r?.(L);},x=useCallback(()=>{f(false);},[f]),v=useCallback(()=>{r?.("");},[r]),[C,y]=useState(null);useEffect(()=>{if(g&&!d&&m.current){let L=null,V=()=>{let N=m.current?.getBoundingClientRect();N&&y({top:N.bottom+8,left:N.left,width:N.width});},A=()=>{L===null&&(L=requestAnimationFrame(()=>{V(),L=null;}));};return V(),window.addEventListener("resize",A),window.addEventListener("scroll",A,true),()=>{window.removeEventListener("resize",A),window.removeEventListener("scroll",A,true),L!==null&&cancelAnimationFrame(L);}}},[g,d]);let S=useCallback(()=>{f(true);},[f]);if(d)return jsxs("div",{className:c,children:[jsx("button",{type:"button",onClick:S,className:"flex items-center justify-center w-10 h-10 rounded-lg hover:bg-background-hover transition-colors","aria-label":"Open search",children:jsx(I,{name:"MagnifyingGlass",size:"md"})}),jsxs(Xe,{isOpen:g,onClose:x,contentPadding:false,height:"80vh",children:[jsxs("div",{className:"flex items-center gap-2 px-4 pt-4",children:[jsx("div",{className:"flex-1",children:jsx(lr,{value:t,onChange:b,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:v,reserveErrorSpace:false,autoFocus:true})}),jsx(Q,{variant:"icon",onPress:x,"aria-label":"Close search",className:"flex-shrink-0",children:jsx(I,{name:"X",size:"md"})})]}),jsx("div",{className:"mt-4",children:a})]})]},"mobile");let k=L=>{let A=L.target.tagName==="INPUT";if(L.key==="ArrowDown"&&g&&A){L.preventDefault();let N=p.current?.querySelector("[data-search-result]");N&&N.focus();}},R=L=>{let V=L.target;if(!V.hasAttribute("data-search-result"))return;let N=Array.from(p.current?.querySelectorAll("[data-search-result]")||[]),T=N.indexOf(V);if(L.key==="ArrowDown"){L.preventDefault(),L.stopPropagation();let z=Math.min(T+1,N.length-1);N[z]?.focus();}else if(L.key==="ArrowUp")if(L.preventDefault(),L.stopPropagation(),T===0)m.current?.querySelector("input")?.focus();else {let z=Math.max(T-1,0);N[z]?.focus();}else L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),f(false),m.current?.querySelector("input")?.focus());},E=g&&C&&typeof document<"u"?createPortal(jsx("div",{ref:p,style:{position:"fixed",top:`${C.top}px`,left:`${C.left}px`,width:`${C.width}px`,zIndex:9999},role:"listbox",onKeyDown:R,children:jsx("div",{className:"bg-background-surface shadow-2xl border border-border-default rounded-lg overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:jsx("div",{className:"overflow-y-auto",style:{maxHeight:i},children:a})})}),document.body):null,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 jsxs("div",{ref:m,className:`relative w-full ${c||""}`,onKeyDown:k,children:[jsx(lr,{value:t,onChange:b,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:D,onFocus:()=>f(true)}),E]},"desktop")}function Yx({message:e="No results found",suggestion:t,icon:r="MagnifyingGlass",className:o=""}){return jsxs("div",{className:`flex flex-col items-center justify-center py-12 px-4 text-center ${o}`,children:[jsx("div",{className:"text-text-secondary mb-3",children:jsx(I,{name:r,size:48})}),jsx("p",{className:"text-base font-medium text-text-primary mb-1",children:e}),t&&jsx("p",{className:"text-sm text-text-secondary max-w-xs",children:t})]})}function Jx({count:e=3,className:t=""}){return jsx("div",{className:`flex flex-col ${t}`,children:Array.from({length:e}).map((r,o)=>jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[jsx(J,{width:20,height:20,variant:"circle"}),jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[jsx(J,{width:"60%",height:16}),jsx(J,{width:"40%",height:12})]}),jsx(J,{width:16,height:16})]},o))})}function qx({title:e,count:t,isLoading:r,footer:o,children:n,className:a}){return jsxs("div",{className:twMerge("flex flex-col",a),children:[jsxs("div",{className:"flex items-baseline gap-1.5 px-4 pt-4 pb-2 border-t border-border-muted first:border-t-0",children:[jsx("h3",{className:"text-sm font-semibold text-text-primary",children:e}),!r&&t!==void 0&&jsx("span",{className:"text-xs text-text-secondary",children:t}),r&&jsx("span",{className:"text-xs text-text-secondary animate-pulse",children:"Loading..."})]}),jsx("div",{className:"flex flex-col",children:n}),o&&jsx("div",{className:"px-4 py-2 border-t border-border-subtle",children:o})]})}function Zx({id:e,title:t,subtitle:r,metadata:o,icon:n,customIcon:a,onSelect:i,isFocused:s=false,className:c,testId:l}){return jsxs("div",{role:"option",tabIndex:0,onClick:()=>{i?.(e);},onKeyDown:m=>{let p=m.currentTarget;switch(m.key){case "Enter":case " ":{m.preventDefault(),i?.(e);break}case "ArrowDown":{m.preventDefault();let g=Array.from(document.querySelectorAll("[data-search-result]")),f=g.indexOf(p);f!==-1&&f<g.length-1&&g[f+1].focus();break}case "ArrowUp":{m.preventDefault();let g=Array.from(document.querySelectorAll("[data-search-result]")),f=g.indexOf(p);if(f>0)g[f-1].focus();else {let 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:twMerge("group flex items-center gap-3 px-4 py-3 cursor-pointer outline-none transition-colors","text-text-primary hover:bg-background-hover","focus-visible:bg-background-muted focus-visible:outline-none","data-[focused]:bg-background-hover",s&&"bg-background-hover",c),"data-focused":s||void 0,children:[a?jsx("div",{className:"flex-shrink-0",children:a}):n?jsx("div",{className:"flex-shrink-0 text-text-secondary",children:jsx(I,{name:n,size:20})}):null,jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-baseline gap-2",children:[jsx("span",{className:"font-medium text-text-primary truncate",children:t}),o&&jsx("span",{className:"text-xs text-text-secondary flex-shrink-0",children:o})]}),r&&jsx("div",{className:"text-sm text-text-secondary truncate mt-0.5",children:r})]}),jsx("div",{className:"flex-shrink-0 opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 group-data-[focused]:opacity-100 transition-opacity",children:jsx(I,{name:"ArrowRight",size:16,className:"text-text-secondary"})})]})}function Xx({children:e,maxHeight:t="400px",className:r}){return jsx("div",{className:twMerge("overflow-y-auto overscroll-contain","divide-y divide-border-muted",r),style:{maxHeight:t},children:e})}function Qx({placeholder:e="Search...",onClick:t,showShortcut:r=true,variant:o="default",className:n=""}){let a=typeof navigator<"u"&&navigator.platform.includes("Mac");return jsxs("button",{type:"button",onClick:t,className:`
95
+ `}})]})}var ts={prefix:String(Math.round(Math.random()*1e10)),current:0},hf=Ee__default.createContext(ts),nS=Ee__default.createContext(false);var aS=!!(typeof window<"u"&&window.document&&window.document.createElement),fd=new WeakMap;function iS(e=false){let t=useContext(hf),r=useRef(null);if(r.current===null&&!e){var o,n;let a=(n=Ee__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=fd.get(a);i==null?fd.set(a,{id:t.current,state:a.memoizedState}):a.memoizedState!==i.state&&(t.current=i.id,fd.delete(a));}r.current=++t.current;}return r.current}function sS(e){let t=useContext(hf);t===ts&&!aS&&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=iS(!!e),o=t===ts&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${t.prefix}`;return e||`${o}-${r}`}function lS(e){let t=Ee__default.useId(),[r]=useState(rs()),o=r||process.env.NODE_ENV==="test"?"react-aria":`react-aria${ts.prefix}`;return e||`${o}-${t}`}typeof Ee__default.useId=="function"?lS:sS;function dS(){return false}function uS(){return true}function pS(e){return ()=>{}}function rs(){return typeof Ee__default.useSyncExternalStore=="function"?Ee__default.useSyncExternalStore(pS,dS,uS):useContext(nS)}function yf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function os(e,t,r){yf(e,t),t.set(e,r);}var mS=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),fS=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function bd(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 mS.has(r.script)}let t=e.split("-")[0];return fS.has(t)}var Cf=Symbol.for("react-aria.i18n.locale");function Sf(){let e=typeof window<"u"&&window[Cf]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:bd(e)?"rtl":"ltr"}}var xd=Sf(),Ma=new Set;function vf(){xd=Sf();for(let e of Ma)e(xd);}function wf(){let e=rs(),[t,r]=useState(xd);return useEffect(()=>(Ma.size===0&&window.addEventListener("languagechange",vf),Ma.add(r),()=>{Ma.delete(r),Ma.size===0&&window.removeEventListener("languagechange",vf);}),[]),e?{locale:typeof window<"u"&&window[Cf]||"en-US",direction:"ltr"}:t}var yS=Ee__default.createContext(null);function hd(){let e=wf();return useContext(yS)||e}function ns(e,t){return e-t*Math.floor(e/t)}var Nf=1721426;function as(e,t,r,o){t=ss(e,t);let n=t-1,a=-2;return r<=2?a=0:is(t)&&(a=-1),Nf-1+365*n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400)+Math.floor((367*r-362)/12+a+o)}function is(e){return e%4===0&&(e%100!==0||e%400===0)}function ss(e,t){return e==="BC"?1-t:t}function vS(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}var CS={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]},nr=class{fromJulianDay(t){let r=t,o=r-Nf,n=Math.floor(o/146097),a=ns(o,146097),i=Math.floor(a/36524),s=ns(a,36524),c=Math.floor(s/1461),l=ns(s,1461),u=Math.floor(l/365),d=n*400+i*100+c*4+u+(i!==4&&u!==4?1:0),[m,p]=vS(d),g=r-as(m,p,1,1),f=2;r<as(m,p,3,1)?f=0:is(p)&&(f=1);let b=Math.floor(((g+f)*12+373)/367),x=r-as(m,p,b,1)+1;return new Jo(m,p,b,x)}toJulianDay(t){return as(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return CS[is(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return is(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 vd(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 Cd(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function kf(e,t){return Tf(e)-Tf(t)}function Tf(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}var yd=null;function jo(){return yd==null&&(yd=new Intl.DateTimeFormat().resolvedOptions().timeZone),yd}function bo(e){e=Kt(e,new nr);let t=ss(e.era,e.year);return Df(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Df(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 wd(e,t){if(t==="UTC")return 0;if(e>0&&t===jo()&&true)return new Date(e).getTimezoneOffset()*-6e4;let{year:r,month:o,day:n,hour:a,minute:i,second:s}=Mf(e,t);return Df(r,o,n,a,i,s,0)-Math.floor(e/1e3)*1e3}var Pf=new Map;function Mf(e,t){let r=Pf.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"}),Pf.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 Rf=864e5;function wS(e,t,r,o){return (r===o?[r]:[r,o]).filter(a=>NS(e,t,a))}function NS(e,t,r){let o=Mf(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 fr(e,t,r="compatible"){let o=Mr(e);if(t==="UTC")return bo(o);if(t===jo()&&r==="compatible"&&true){o=Kt(o,new nr);let c=new Date,l=ss(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=bo(o),a=wd(n-Rf,t),i=wd(n+Rf,t),s=wS(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 Nd(e,t,r="compatible"){return new Date(fr(e,t,r))}function ar(e,t){let r=wd(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(),u=o.getUTCMilliseconds();return new Hn(n<1?"BC":"AD",n<1?-n+1:n,a,i,t,r,s,c,l,u)}function ls(e,t){return ar(e.getTime(),t)}function Mr(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 Ea(e.calendar,e.era,e.year,e.month,e.day,r,o,n,a)}function Kt(e,t){if(vd(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,Jr(o),o}function Td(e,t,r){if(e instanceof Hn)return e.timeZone===t?e:kd(e,t);let o=fr(e,t,r);return ar(o,t)}function Ef(e){let t=bo(e)-e.offset;return new Date(t)}function kd(e,t){let r=bo(e)-e.offset;return Kt(ar(r,t),e.calendar)}var La=36e5;function Ia(e,t){let r=e.copy(),o="hour"in r?RS(r,t):0;Pd(r,t.years||0),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e),r.month+=t.months||0,Rd(r),Lf(r),r.day+=(t.weeks||0)*7,r.day+=t.days||0,r.day+=o,kS(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 Pd(e,t){var r,o;!((r=(o=e.calendar).isInverseEra)===null||r===void 0)&&r.call(o,e)&&(t=-t),e.year+=t;}function Rd(e){for(;e.month<1;)Pd(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Pd(e,1);}function kS(e){for(;e.day<1;)e.month--,Rd(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Rd(e);}function Lf(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 Jr(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Lf(e);}function Af(e){let t={};for(let r in e)typeof e[r]=="number"&&(t[r]=-e[r]);return t}function Dd(e,t){return Ia(e,Af(t))}function ds(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),Jr(r),r}function Aa(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),If(r),r}function PS(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=cs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=cs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=cs(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=cs(e.hour,24),t}function If(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 cs(e,t){let r=e%t;return r<0&&(r+=t),r}function RS(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,PS(e)}function us(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=jr(c,r,0,s.length-1,o?.round),n.era=s[c],Jr(n);break}case "year":var a,i;!((a=(i=n.calendar).isInverseEra)===null||a===void 0)&&a.call(i,n)&&(r=-r),n.year=jr(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=jr(e.month,r,1,e.calendar.getMonthsInYear(e),o?.round);break;case "day":n.day=jr(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),Jr(n),n}function Md(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=jr(a,r,i,s,o?.round);break}case "minute":n.minute=jr(e.minute,r,0,59,o?.round);break;case "second":n.second=jr(e.second,r,0,59,o?.round);break;case "millisecond":n.millisecond=jr(e.millisecond,r,0,999,o?.round);break;default:throw new Error("Unsupported field "+t)}return n}function jr(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 Ed(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=Ia(Mr(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});r=fr(n,e.timeZone);}else r=bo(e)-e.offset;r+=t.milliseconds||0,r+=(t.seconds||0)*1e3,r+=(t.minutes||0)*6e4,r+=(t.hours||0)*36e5;let o=ar(r,e.timeZone);return Kt(o,e.calendar)}function Ff(e,t){return Ed(e,Af(t))}function Bf(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=Mr(e),s=Kt(Aa(i,{hour:n}),new nr),c=[fr(s,e.timeZone,"earlier"),fr(s,e.timeZone,"later")].filter(g=>ar(g,e.timeZone).day===s.day)[0],l=Kt(Aa(i,{hour:a}),new nr),u=[fr(l,e.timeZone,"earlier"),fr(l,e.timeZone,"later")].filter(g=>ar(g,e.timeZone).day===l.day).pop(),d=bo(e)-e.offset,m=Math.floor(d/La),p=d%La;return d=jr(m,r,Math.floor(c/La),Math.floor(u/La),o?.round)*La+p,Kt(ar(d,e.timeZone),e.calendar)}case "minute":case "second":case "millisecond":return Md(e,t,r,o);case "era":case "year":case "month":case "day":{let n=us(Mr(e),t,r,o),a=fr(n,e.timeZone);return Kt(ar(a,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Vf(e,t,r){let o=Mr(e),n=Aa(ds(o,t),t);if(n.compare(o)===0)return e;let a=fr(n,e.timeZone,r);return Kt(ar(a,e.timeZone),e.calendar)}var DS=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/;var MS=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Fa(e){let t=e.match(DS);if(!t)throw MS.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let r=new Jo(Ld(t[1],0,9999),Ld(t[2],1,12),1);return r.day=Ld(t[3],1,r.calendar.getDaysInMonth(r)),r}function Ld(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 zf(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 Ad(e){let t=Kt(e,new nr),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 Id(e){return `${Ad(e)}T${zf(e)}`}function LS(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 Of(e){return `${Id(e)}${LS(e.offset)}[${e.timeZone}]`}function Fd(e){let t=typeof e[0]=="object"?e.shift():new nr,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 AS=new WeakMap,Jo=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 Ia(this,t)}subtract(t){return Dd(this,t)}set(t){return ds(this,t)}cycle(t,r,o){return us(this,t,r,o)}toDate(t){return Nd(this,t)}toString(){return Ad(this)}compare(t){return Cd(this,t)}constructor(...t){os(this,AS,{writable:true,value:void 0});let[r,o,n,a,i]=Fd(t);this.calendar=r,this.era=o,this.year=n,this.month=a,this.day=i,Jr(this);}};var IS=new WeakMap,Ea=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 Ia(this,t)}subtract(t){return Dd(this,t)}set(t){return ds(Aa(this,t),t)}cycle(t,r,o){switch(t){case "era":case "year":case "month":case "day":return us(this,t,r,o);default:return Md(this,t,r,o)}}toDate(t,r){return Nd(this,t,r)}toString(){return Id(this)}compare(t){let r=Cd(this,t);return r===0?kf(this,Mr(t)):r}constructor(...t){os(this,IS,{writable:true,value:void 0});let[r,o,n,a,i]=Fd(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,Jr(this);}},FS=new WeakMap,Hn=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 Ed(this,t)}subtract(t){return Ff(this,t)}set(t,r){return Vf(this,t,r)}cycle(t,r,o){return Bf(this,t,r,o)}toDate(){return Ef(this)}toString(){return Of(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-Td(t,this.timeZone).toDate().getTime()}constructor(...t){os(this,FS,{writable:true,value:void 0});let[r,o,n,a,i]=Fd(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,Jr(this);}};var Bd=new Map;function Vd(e){let{locale:t}=hd(),r=t+(e?Object.entries(e).sort((n,a)=>n[0]<a[0]?-1:1).join():"");if(Bd.has(r))return Bd.get(r);let o=new Intl.Collator(t,e);return Bd.set(r,o),o}function ps(e){let t=Vd({usage:"search",...e}),r=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=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=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 useMemo(()=>({startsWith:r,endsWith:o,contains:n}),[r,o,n])}var WS=({isEntering:e,isExiting:t,className:r})=>["max-w-[200px] group bg-action-default border border-action-default-hover text-[color:var(--color-action-default-text)] text-sm rounded-lg drop-shadow-lg will-change-transform px-3 py-1",e?"animate-in fade-in placement-bottom:slide-in-from-top-0.5 placement-top:slide-in-from-bottom-0.5 placement-left:slide-in-from-right-0.5 placement-right:slide-in-from-left-0.5 ease-out duration-200":"",t?"animate-out fade-out placement-bottom:slide-out-to-top-0.5 placement-top:slide-out-to-bottom-0.5 placement-left:slide-out-to-right-0.5 placement-right:slide-out-to-left-0.5 ease-in duration-150":"",r].filter(Boolean).join(" ");function Lt({children:e,content:t,...r}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...r,offset:10,className:composeRenderProps(r.className,(o,n)=>WS({...n,className:o})),children:[jsx(OverlayArrow,{children:jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-action-default stroke-action-default-hover group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L4 4 L8 0"})})}),t]})]})}function sr(){let[e,t]=Ee__default.useState(false),r=Ee__default.useCallback((n,a)=>{t(true),a?.(n);},[]),o=Ee__default.useCallback((n,a)=>{t(false),a?.(n);},[]);return {isFocused:e,handleFocus:r,handleBlur:o}}var nt=Ee__default.forwardRef(({children:e,className:t},r)=>jsx("div",{ref:r,className:twMerge("relative w-full",t),children:e}));nt.displayName="InputWrapper";function Ba({onClick:e,size:t="md",className:r}){return jsx("button",{type:"button",onClick:o=>{o.preventDefault(),o.stopPropagation(),e();},className:twMerge("absolute right-2 top-[48%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary cursor-pointer",r),"aria-label":"Clear input",onMouseDown:o=>{o.preventDefault(),o.stopPropagation();},children:jsx(I,{name:"X",size:t==="sm"?16:20})})}function xo(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 Wf(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function GS(e){return e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":""}function ht(e){let{isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:a="md",className:i}=e;return twMerge("w-full",xo({isInvalid:t,isDisabled:r,isFocused:o}),Wf({transparent:n,isDisabled:r}),Le[a].text,Le[a].height,Le[a].padding,GS(a),i)}function US(e){let{size:t="md",isFocusWithin:r,isInvalid:o,isDisabled:n,transparent:a,className:i}=e;return twMerge("group flex items-center rounded-[var(--control-border-radius)] overflow-hidden",Wf({transparent:a,isDisabled:n}),Le[t].height,xo({isFocused:r,isInvalid:o,isDisabled:n}),i)}function Me({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,u=o&&n==="inline",d=jsxs("label",{htmlFor:s,className:twMerge(Le[t].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,a&&jsx("span",{children:"*"}),c&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(I,{name:"Info",size:t==="sm"?16:20})}),u&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:o})]});return c&&l?jsx(Lt,{content:l,children:d}):d}function Se({size:e="md",className:t,children:r,...o}){return jsx("div",{...o,className:twMerge("leading-[2.25] text-text-secondary",Le[e].text,t),children:r})}function pe({children:e,size:t="md",className:r}){return jsx("div",{role:"alert",className:twMerge(Le[t].text,"text-feedback-error-text",r),children:e})}function fs({size:e="md",isInvalid:t,isDisabled:r,isFocused:o,transparent:n,className:a,...i}){return jsx("input",{className:ht({isInvalid:t,isDisabled:r,isFocused:o,transparent:n,size:e,className:a}),...i})}function Gf(e){let{children:t,...r}=e;return jsx("div",{...r,className:US(e),children:typeof t=="function"?t(e):t})}function JS({children:e,...t}){return jsx(ListBox,{...t,className:Ce(t.className,"outline-0"),children:e})}var Yd=createContext("md");function jf(){return useContext(Yd)}function Wd(e="md"){let t=e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":"";return `flex-1 text-start data-[placeholder]:text-text-disabled overflow-hidden text-ellipsis whitespace-nowrap ${Le[e].text} ${t}`}function QS(){let e=Ee__default.useCallback((r,o)=>{o?.(r);},[]),t=Ee__default.useCallback((r,o)=>{o?.(r);},[]);return {handleFocus:e,handleBlur:t}}function Zo({label:e,description:t,errorMessage:r,children:o,items:n,renderItem:a,renderSelectedValue:i,size:s="md",selectedKey:c,defaultSelectedKey:l,onSelectionChange:u,placeholder:d,showErrors:m=false,tooltip:p,isRequired:g,transparent:f,reserveErrorSpace:b=false,placement:x="bottom start",shouldFlip:v=true,menuWidth:C="match",descriptionPlacement:y="below",useMobileTray:S=true,...k}){let[R,E]=useState(null),[D,L]=useState(null),[V,A]=useState(false),N=c??R??l,{handleFocus:T,handleBlur:z}=QS(),{isMobile:W}=Pt(),F=S&&W,K=Ee__default.useMemo(()=>!i||!N||!n?null:Array.from(n).find(B=>B.id===N)??null,[i,N,n]),X=w=>{u&&w!==null&&u(w),u||E(w);},G=useRef(null),Y=useRef(null),P=()=>{F&&A(!V);};return jsxs(Fragment,{children:[jsx(Select,{...k,selectedKey:N,defaultSelectedKey:l,onSelectionChange:X,placeholder:d,className:Ce(k.className,"group flex w-full flex-col"),ref:G,onOpenChange:w=>{F||(w&&Y.current?L(Y.current.offsetWidth):w||G.current?.blur());},children:({isDisabled:w,isInvalid:B,isOpen:M})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(Me,{size:s,tooltip:p,description:y==="tooltip"||y==="inline"?t:void 0,descriptionPlacement:y,isRequired:g,children:e}),jsx(nt,{children:jsx("div",{ref:Y,children:jsxs(Q,{variant:"unstyled",className:twMerge(ht({isInvalid:B||m&&!!r,isDisabled:w,isFocused:F?V:M,transparent:f,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:h=>T(h,k.onFocus),onBlur:h=>z(h,k.onBlur),onPress:F?P:void 0,"data-open":F?V:M,children:[i&&K?jsx("div",{className:Wd(s),children:i(K)}):F&&N?jsx("div",{className:Wd(s),children:n?Array.from(n).find(H=>H.id===N)?.label:String(N)}):jsx(SelectValue,{className:Wd(s)}),jsx(I,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] transition-transform",(F?V:M)&&"rotate-180")})]})})}),b?jsx("div",{className:"mt-1 min-h-[20px]",children:m?jsx(pe,{size:s,className:"text-feedback-error-text",children:typeof r=="function"&&k.validationResult?r(k.validationResult):typeof r=="string"?r:null}):t&&y==="below"?jsx(Se,{size:s,children:t}):null}):jsx(Fragment,{children:m?jsx(pe,{size:s,className:"mt-1 text-feedback-error-text",children:typeof r=="function"&&k.validationResult?r(k.validationResult):typeof r=="string"?r:null}):t&&y==="below"?jsx(Se,{size:s,className:"mt-1",children:t}):null}),F?null:jsx(Ze,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:C==="match"&&D?`${D}px`:void 0,minWidth:C==="auto"&&D?`${D}px`:void 0,maxWidth:C==="auto"?"min(600px, 90vw)":void 0},placement:x,shouldFlip:v,children:jsx(Yd.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:a&&n?h=>jsx(At,{id:h.id,textValue:h.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(h)})},h.id):o})})})]})}),F&&jsx(Xe,{isOpen:V,onClose:()=>A(false),title:e??"Select an option",contentPadding:false,children:jsx(Yd.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:N!=null?[N]:[],onSelectionChange:w=>{let B=Array.from(w)[0];B!=null&&(X(B),A(false));},children:a&&n?w=>jsx(At,{id:w.id,textValue:w.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(w)})},w.id):o})})})]})}function At({size:e,className:t,...r}){let o=jf(),n=e??o;return jsx(ListBoxItem,{...r,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-primary data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-default data-[focus-visible]:ring-inset data-[selected]:bg-background-selected data-[selected]:font-medium overflow-hidden",Le[n].paddingY,Le[n].text,t)})}var c1=[],d1={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},u1={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Zf={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},Jd=(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 p1(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 m1(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 hs({label:e,staticItems:t=c1,sections:r,selectedKey:o,defaultSelectedKey:n,onSelectionChange:a,requestConfig:i,defaultFilter:s,placeholder:c,errorMessage:l,description:u,size:d="md",tooltip:m,isRequired:p,isDisabled:g,isInvalid:f,validationResult:b,showErrors:x=true,renderItem:v,renderLeftIcon:C,renderSection:y,autoFocus:S=false,reserveErrorSpace:k=false,hideChevron:R=false,useMobileTray:E=true,className:D}){let L=Ee__default.useRef(null),V=Ee__default.useRef(null),[A,N]=Ee__default.useState(),[T,z]=useState(()=>Jd(o||n,t,r)),[W,F]=useState(false),[K,X]=useState(false),G=lo(T),{contains:Y}=ps({sensitivity:"base"}),[P,w]=useState(),{isMobile:B}=Pt(),M=E&&B,h=Le[d].text,O=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 m1(i,ue,ie):ge=await p1(i,ue,ie),w(ge.error),{items:ge.items}}catch(ge){return ge instanceof Error&&ge.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ge),w(ge instanceof Error?ge.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),H=i&&G!==""?O:null,j=false,oe=useRef("");useEffect(()=>{S&&F(true);},[S]),useEffect(()=>{let ie=Jd(o,t,r);ie!==T&&z(ie);},[o,t,r]),useEffect(()=>{let ie=()=>{L.current&&N(L.current.offsetWidth);};return ie(),window.addEventListener("resize",ie),()=>window.removeEventListener("resize",ie)},[]),useEffect(()=>{G===""?oe.current="":H&&G!==oe.current&&(oe.current=G,H.setFilterText(G));},[G,H]),j=Li(!!H?.isLoading,300);let me=Ee__default.useMemo(()=>{if(!M||!T)return H?H.items:t;let ie=H?H.items:t,ue=s||Y;return ie.filter(ge=>ue(ge.name,T))},[M,T,H,t,s,Y]),Z=ie=>{let ue=Jd(ie,t,r);z(ue),a&&a(ie);},ne=ie=>{z(ie);},Te=()=>{M&&X(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:Z,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:M?"manual":"focus",isDisabled:g,isInvalid:f||!!l,inputValue:T,onInputChange:ne,autoFocus:S&&!M,defaultFilter:s||Y,"aria-label":e||c||"Autocomplete",children:ie=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(Me,{size:d,tooltip:m,isRequired:p,children:e}),jsxs(nt,{ref:L,children:[C?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:C(j)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:j?jsx(Kr,{size:16,color:"text-text-secondary"}):jsx(I,{name:"MagnifyingGlass",className:`${d1[d]} text-text-secondary`})}),jsx(Input,{className:ht({isInvalid:f||!!l,isDisabled:g,isFocused:W||(M?K:ie.isOpen),size:d,className:twMerge(u1[d],T&&!g||!R&&!T?"pr-10":"pr-3",M&&"cursor-pointer",D)}),placeholder:c,disabled:g,onFocus:ue=>{F(true),M&&(ue.currentTarget.blur(),Te());},onBlur:()=>{F(false);},onClick:M?Te:void 0,readOnly:M,"aria-label":e||c||"Autocomplete"}),T&&!g&&jsx(Ba,{onClick:()=>{z(""),a?.(null);},size:d}),!R&&!T&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":"Toggle menu",isDisabled:g,children:({isPressed:ue})=>jsx(I,{name:ue?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),k?jsx("div",{className:"mt-1 min-h-[20px]",children:x&&P?jsx(pe,{size:d,className:"text-feedback-error-text",children:P}):x&&typeof l=="string"?jsx(pe,{size:d,className:"text-feedback-error-text",children:l}):x&&typeof l=="function"&&b?jsx(pe,{size:d,className:"text-feedback-error-text",children:l(b)}):u?jsx(Se,{size:d,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(Se,{size:d,className:"mt-1",children:u}),x&&P&&jsx(pe,{size:d,className:"text-feedback-error-text mt-1",children:P}),x&&typeof l=="string"&&jsx(pe,{size:d,className:"text-feedback-error-text mt-1",children:l}),x&&typeof l=="function"&&b&&jsx(pe,{size:d,className:"text-feedback-error-text mt-1",children:l(b)})]}),!M&&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:A?`${A}px`:void 0},children:jsx(ListBox,{"aria-label":e||c||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${h}`,children:r?r.map(ue=>{let ge=ue.items.map($=>jsx(At,{id:$.id,textValue:$.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${Zf[d]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:v?v($):jsxs(Fragment,{children:[$.name,jsx(I,{name:"X",className:"ml-auto h-4 w-4 text-text-secondary opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},$.id));if(y){let $=y(ue,ge);return Ee__default.isValidElement($)&&$.type===ListBoxSection?$:jsx(ListBoxSection,{children:$},ue.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:ue.name}),ge]},ue.name)}):ue=>jsx(At,{id:ue.id,textValue:ue.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${Zf[d]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:v?v(ue):jsxs(Fragment,{children:[ue.name,jsx(I,{name:"X",className:"ml-auto h-4 w-4 text-text-secondary opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},ue.id)})})]})}),M&&jsx(Xe,{isOpen:K,onClose:()=>X(false),title:e??c??"Search",contentPadding:false,height:"80vh",children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"p-4 border-b border-border-default",children:jsxs(nt,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:j?jsx(Kr,{size:16,color:"text-text-secondary"}):jsx(I,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:V,type:"text",value:T,onChange:ie=>ne(ie.target.value),placeholder:c,autoFocus:true,className:ht({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),T&&jsx(Ba,{onClick:()=>{z(""),a?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||c||"Suggestions",items:me,selectedKeys:o?[o]:[],selectionMode:"single",onSelectionChange:ie=>{let ue=Array.from(ie)[0];ue&&(Z(ue),X(false));},className:"bg-background-input outline-none",children:ie=>jsx(At,{id:ie.id,textValue:ie.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:v?v(ie):ie.name},ie.id)})})]})})]})}function Zr({src:e,alt:t,firstName:r,lastName:o,fullName:n,onClick:a,size:i="md",shape:s="circle",variant:c="user",className:l,status:u,bordered:d=false,piiEntity:m}){let[p,g]=useState(false),f=useCallback(()=>g(true),[]);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"},C={online:"bg-feedback-success-background border-feedback-success-border",offline:"bg-text-secondary border-border-muted",away:"bg-feedback-warning-background border-feedback-warning-border",busy:"bg-feedback-error-background border-feedback-error-border"},y={user:"bg-feedback-info-background text-feedback-info-text",team:"bg-feedback-info-background text-feedback-info-text",organization:"bg-feedback-success-background text-feedback-success-text"},S=s==="circle"?"rounded-full":"rounded-md",k=twMerge("relative inline-flex items-center justify-center overflow-hidden transition-opacity outline-none",b[i],S,a&&"cursor-pointer hover:opacity-80",d&&"ring-2 ring-background-surface",l),E=(()=>{if(r||o){let A=r?.[0]||"",N=o?.[0]||"";return (A+N).toUpperCase()}if(n){let A=n.split(" "),N=A[0]?.[0]||"",T=A[A.length-1]?.[0]||"";return N===T?N.toUpperCase():(N+T).toUpperCase()}return ""})(),D=()=>{let A={xs:14,sm:16,md:20,lg:24,xl:32}[i];switch(c){case "team":return jsx(Users,{size:A});case "organization":return jsx(Building2,{size:A});default:return jsx(User,{size:A})}},L=A=>{if(m)return c==="organization"?A?"organization-logo":"initials":A?"avatar":"initials"},V=()=>e&&!p?jsx("img",{src:e,alt:t||n||"Avatar",className:"h-full w-full object-cover",onError:f,"data-pii-type":L(true),"data-pii-entity":m}):E?jsx("span",{className:"font-semibold","data-pii-type":L(false),"data-pii-entity":m,children:E}):D();return jsxs("div",{className:"relative inline-block",children:[jsx("div",{"data-avatar":true,className:twMerge(k,!e||p?y[c]:""),onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,children:V()}),u&&jsx("span",{className:twMerge("absolute border-2 border-background-surface",S,x[i],v[i],C[u]),"aria-label":`Status: ${u}`})]})}var C1={default:"bg-feedback-info-background text-feedback-info-text",success:"bg-feedback-success-background text-feedback-success-text",error:"bg-feedback-error-background text-feedback-error-text",warning:"bg-feedback-warning-background text-feedback-warning-text",info:"bg-feedback-info-background text-feedback-info-text",primary:"bg-action-primary/10 text-action-primary border border-action-primary/20",brand:"bg-action-primary/10 text-action-primary border border-action-primary/20",secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border border-border-muted",neutral:"bg-background-muted text-text-secondary",charging:"bg-state-charging text-state-charging-text",discharging:"bg-state-discharging text-state-discharging-text",heat:"bg-state-heat text-state-heat-text",cool:"bg-state-cool text-state-cool-text",eco:"bg-state-eco text-state-eco-text",auto:"bg-state-auto text-state-auto-text",on:"bg-state-on text-state-on-text",off:"bg-state-off text-state-off-text",idle:"bg-state-idle text-state-idle-text",unknown:"bg-state-unknown text-state-unknown-text",connected:"bg-feedback-success-background text-feedback-success-text",disconnected:"bg-feedback-error-background text-feedback-error-text",importing:"bg-state-importing text-state-importing-text",exporting:"bg-state-exporting text-state-exporting-text"},S1={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"},w1={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"},N1={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&&jsx("span",{className:twMerge("rounded-full bg-current opacity-75",N1[r],i&&"animate-pulse"),"aria-hidden":"true"});return jsxs("span",{className:twMerge("inline-flex items-center gap-1.5 font-medium",S1[r],w1[o],C1[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="secondary",onClick:i,asButton:s=false,onPress:c,showArrow:l=false,alwaysUnderlined:u=false,LinkComponent:d,"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=`${`${u?"underline decoration-1 underline-offset-4 decoration-current":"hover:underline hover:decoration-1 hover:underline-offset-4 hover:decoration-current"} cursor-pointer`} ${{primary:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",secondary:"text-text-link-default hover:text-text-link-hover visited:text-text-link-default",muted:"text-text-secondary hover:text-text-secondary visited:text-text-secondary",unstyled:""}[a==="brand"?"primary":a==="default"?"secondary":a]} ${r}`,S=jsxs(Fragment,{children:[t,l&&jsxs("span",{children:["\xA0","\u2192"]})]});return s?jsx("button",{type:"button",className:y,onClick:c,title:n,...g,children:S}):d&&e?jsx(d,{href:e,className:y,title:n,onClick:i,...f,...g,children:S}):jsx("a",{href:e||"#",className:y,...f,...g,title:n,onClick:i,children:S})};var I1={info:{subtle:{container:"bg-feedback-info-background border-l-4 border-l-feedback-info-border",iconColor:"text-feedback-info-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-info-border border-feedback-info-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:Info},success:{subtle:{container:"bg-feedback-success-background border-l-4 border-l-feedback-success-border",iconColor:"text-feedback-success-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-success-border border-feedback-success-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:CheckCircle},warning:{subtle:{container:"bg-feedback-warning-background border-l-4 border-l-feedback-warning-border",iconColor:"text-feedback-warning-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-warning-border border-feedback-warning-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:AlertCircle},error:{subtle:{container:"bg-feedback-error-background border-l-4 border-l-feedback-error-border",iconColor:"text-feedback-error-border",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-feedback-error-border border-feedback-error-border",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:XCircle},discovery:{subtle:{container:"bg-background-muted border-l-4 border-l-action-brand",iconColor:"text-action-brand",titleColor:"text-text-primary",bodyColor:"text-text-primary"},bold:{container:"bg-action-brand border-action-brand",iconColor:"text-text-inverse",titleColor:"text-text-inverse",bodyColor:"text-text-inverse/90"},icon:Lightbulb}};function vs({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:u,testId:d}){let m=I1[e],p=m[t],g=m.icon,f=!!(i||s),b=!!(r||o);return jsxs("div",{className:twMerge("flex gap-3 rounded-sm border p-4",p.container,u),role:"region","aria-live":"polite","data-testid":d,children:[!l&&jsx("div",{className:twMerge("flex-shrink-0",p.iconColor),"aria-hidden":"true",children:c||jsx(g,{className:"h-5 w-5"})}),jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:[b&&jsxs("div",{className:"flex-1",children:[r&&jsx("div",{className:Dt(et("headingSm"),p.titleColor),children:r}),o&&jsx("div",{className:Dt(et("bodySm"),r?"mt-1":"",p.bodyColor),children:o})]}),f&&jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i&&(i.asLink?jsx(Ue,{asButton:true,onPress:i.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-text-inverse hover:text-text-inverse/80":"",children:i.label}):jsx(Q,{size:"sm",variant:"primary",onPress:i.onPress,className:t==="bold"?"bg-background-surface text-text-primary hover:bg-background-surface/90":"",children:i.label})),s&&(s.asLink?jsx(Ue,{asButton:true,onPress:s.onPress,variant:t==="bold"?"unstyled":"default",className:t==="bold"?"text-text-inverse hover:text-text-inverse/80":"",children:s.label}):jsx(Q,{size:"sm",variant:"secondary",onPress:s.onPress,className:t==="bold"?"border-text-inverse/30 text-text-inverse hover:bg-text-inverse/10":"",children:s.label}))]})]}),n&&jsx("button",{type:"button",onClick:a,className:twMerge("flex h-8 w-8 flex-shrink-0 items-center justify-center self-start rounded-md transition-colors hover:bg-background-modal/10",p.iconColor,Oe()),"aria-label":"Dismiss banner",children:jsx(X,{className:"h-4 w-4"})})]})}function Qf({isOpen:e=true,position:t="sticky",className:r,...o}){let n=t==="fixed"?"fixed top-0 left-0 right-0 z-50":"sticky top-0 z-50",a=r?`${r} !rounded-none`:"!rounded-none";return jsx(AnimatePresence,{children:e&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:n,children:jsx(vs,{...o,className:a})})})}function ho({value:e,children:t,className:r,size:o="sm",iconPosition:n="right"}){let[a,i]=useState(false),l=jsx(Q,{variant:"icon",size:o,onPress:()=>{let d=e||(typeof t=="string"?t:"");navigator.clipboard.writeText(d),i(true),setTimeout(()=>{i(false);},2e3);},className:"!px-2 relative",style:{top:"0.5px"},children:jsx(I,{name:"Copy",size:o==="sm"?14:16})}),u=a?jsx(Lt,{content:"Copied!",children:l}):l;return jsxs("div",{className:twMerge("inline-flex items-center gap-0.5",r),children:[n==="left"&&u,t,n==="right"&&u]})}function Cs(e){let{children:t,maxWidth:r=600,className:o,...n}=e,{ref:a,width:i}=En(),[s,c]=Ee__default.useState(false),[l,u]=Ee__default.useState(false),d=Ee__default.useRef(false),m=Ee__default.useMemo(()=>t&&!e.items&&typeof t!="function"?Ee__default.Children.toArray(t):null,[t,e.items]);if(Ee__default.useEffect(()=>{m&&m.length>=4&&i>0&&!d.current?(d.current=true,c(i>r),u(true)):(!m||m&&m.length<4)&&u(true);let p=setTimeout(()=>{l||u(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(Ee__default.isValidElement(x)){let v=x.props;if(typeof v.children=="string")return {label:v.children,href:v.href}}return {label:"..."}});return jsxs(Breadcrumbs,{...n,ref:a,className:twMerge("flex gap-2",l?"opacity-100":"opacity-0",o),children:[p,jsx(H1,{items:b}),f]})}return jsx(Breadcrumbs,{...n,ref:a,className: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 jsx(Breadcrumb,{className:"flex items-center gap-2",children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(zn,{items:t,align:"left",size:"sm",children:jsx(Q,{variant:"icon",size:"sm",icon:"DotsThree","aria-label":"Show hidden breadcrumbs",className:"px-0.5"})}),jsx(ChevronRight,{className:"h-4 w-4 text-text-secondary"})]})})}function Ss(e){let{className:t,children:r,href:o,copyable:n,copyValue:a,...i}=e;return jsx(Breadcrumb,{className:Ce(t,"flex items-center gap-2"),...i,children:s=>{let c=s.isCurrent,l=typeof r=="function"?r(s):r;return jsx(Fragment,{children:c?n?jsx(ho,{value:a||(typeof l=="string"?l:void 0),size:"sm",iconPosition:"right",children:jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-primary sm:max-w-none",children:l})}):jsx("span",{className:"max-w-[200px] truncate font-semibold text-text-primary sm:max-w-none",children:l}):jsxs(Fragment,{children:[jsx(Ue,{variant:"muted",href:o,className:"max-w-[150px] truncate sm:max-w-[300px] md:max-w-none",children:l}),jsx(ChevronRight,{className:"h-4 w-4 shrink-0 text-text-secondary"})]})})}})}function X1({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-inverse invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):r.push("text-text-primary hover:bg-background-hover pressed:bg-background-selected"),r.join(" ")}function Wn({errorMessage:e,...t}){return jsxs(Calendar,{...t,children:[jsx(ws,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Ns,{}),jsx(CalendarGridBody,{children:r=>jsx(CalendarCell,{date:r,className:({isSelected:o,isDisabled:n})=>`${X1({isSelected:o,isDisabled:n})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function ws(){let{direction:e}=useLocale(),t=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(Q,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(I,{name:"CaretRight","aria-hidden":true,size:t}):jsx(I,{name:"CaretLeft","aria-hidden":true,size:t})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsx(Q,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(I,{name:"CaretLeft","aria-hidden":true,size:t}):jsx(I,{name:"CaretRight","aria-hidden":true,size:t})})]})}function Ns(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}var ng=Ee.createContext(null);function yo(){let e=Ee.useContext(ng);if(!e)throw new Error("Carousel components must be used within a CarouselRoot");return e}function ag({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:u=1,className:d,children:m,...p}){let g=e!==void 0,[f,b]=Ee.useState(t),x=g?e:f,v=Ee.useRef(null),[C,y]=Ee.useState(0),[S,k]=Ee.useState(typeof a=="boolean"?a:!!a),[R,E]=Ee.useState(false),D=Ee.useRef(null),L=Ee.useRef(null),V=typeof a=="object"&&a!==null&&a.delay?a.delay:i;Ee.useEffect(()=>{if(v.current){let h=Math.max(1,Math.floor(Number(l)||1)),O=v.current.children;if(O.length===0){y(0);return}let H=Math.ceil(O.length/h);y(H);}},[m,l]);let A=Ee.useRef(-1);Ee.useEffect(()=>{if(x!==A.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"}),A.current=x);}},[x,l,o]);let N=Ee.useCallback(h=>{let O=h;n?O<0?O=C-1:O>=C&&(O=0):O=Math.max(0,Math.min(h,C-1)),g||b(O),r?.(O);},[g,n,r,C]),T=Ee.useCallback(()=>{N(x+u);},[x,N,u]),z=Ee.useCallback(()=>{N(x-u);},[x,N,u]),W=Ee.useRef(T);Ee.useEffect(()=>{W.current=T;},[T]);let F=C>0&&(n||x<C-1),K=C>0&&(n||x>0),X=Ee.useCallback(()=>{k(h=>!h);},[]);Ee.useEffect(()=>{if(S&&C>1)return D.current=setInterval(()=>{W.current();},V),()=>{D.current&&(clearInterval(D.current),D.current=null);}},[S,C,V]);let G=Ee.useCallback(()=>{D.current&&(clearInterval(D.current),D.current=null);},[]),Y=Ee.useCallback(()=>{S&&C>1&&(D.current=setInterval(()=>{W.current();},V));},[S,C,V]),P=Ee.useCallback(h=>{if(!s)return;E(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;L.current={x:O,y:H};},[s]),w=Ee.useCallback(h=>{if(!R||!L.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-L.current.x,oe=H-L.current.y,me=50;o==="horizontal"&&Math.abs(j)>me?(j>0?z():T(),E(false),L.current=null):o==="vertical"&&Math.abs(oe)>me&&(oe>0?z():T(),E(false),L.current=null);},[R,o,T,z]),B=Ee.useCallback(()=>{E(false),L.current=null;},[]),M={currentPage:x,totalPages:C,orientation:o,loop:n,spacing:c,slidesPerView:l,goToPage:N,goToNext:T,goToPrev:z,canGoNext:F,canGoPrev:K,isAutoplayActive:S,toggleAutoplay:X,itemsRef:v,isDragging:R,allowMouseDrag:s,handleDragStart:P,handleDragMove:w,handleDragEnd:B};return jsx(ng.Provider,{value:M,children:jsx("div",{...p,className:twMerge("relative w-full",o==="vertical"?"h-full":"",d),onMouseEnter:G,onMouseLeave:Y,children:m})})}function ig({className:e,children:t,...r}){let{itemsRef:o,orientation:n,spacing:a,isDragging:i,allowMouseDrag:s,handleDragStart:c,handleDragMove:l,handleDragEnd:u}=yo();return jsx("div",{ref:o,...r,className:twMerge("flex overflow-x-auto overflow-y-hidden snap-x snap-mandatory scrollbar-hide scroll-smooth",n==="vertical"&&"flex-col overflow-y-auto overflow-x-hidden snap-y",s&&i&&"cursor-grabbing select-none",s&&!i&&"cursor-grab",e),style:{gap:a,"--carousel-spacing":a,...r.style},onMouseDown:c,onMouseMove:l,onMouseUp:u,onMouseLeave:u,onTouchStart:c,onTouchMove:l,onTouchEnd:u,children:t})}function sg({index:e,className:t,children:r,...o}){let{orientation:n,slidesPerView:a}=yo();return jsx("div",{...o,"data-index":e,className:twMerge("shrink-0 snap-start",n==="horizontal"?"h-full":"w-full",t),style:{width:n==="horizontal"?`calc((100% - (${a-1} * var(--carousel-spacing, 1rem))) / ${a})`:void 0,height:n==="vertical"?`calc((100% - (${a-1} * var(--carousel-spacing, 1rem))) / ${a})`:void 0,...o.style},children:r})}function lg({className:e,children:t,...r}){return jsx("div",{...r,className:twMerge("flex items-center justify-center gap-4 mt-4",e),children:t})}function cg({className:e,children:t,...r}){let{goToPrev:o,canGoPrev:n}=yo();return jsx("button",{type:"button",...r,onClick:a=>{o(),r.onClick?.(a);},disabled:!n||r.disabled,"aria-label":"Previous slide",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(I,{name:"CaretLeft",size:"sm"})})}function dg({className:e,children:t,...r}){let{goToNext:o,canGoNext:n}=yo();return jsx("button",{type:"button",...r,onClick:a=>{o(),r.onClick?.(a);},disabled:!n||r.disabled,"aria-label":"Next slide",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(I,{name:"CaretRight",size:"sm"})})}function eu({index:e,className:t,children:r,...o}){let{currentPage:n,goToPage:a}=yo(),i=n===e;return jsx("button",{type:"button",...o,onClick:s=>{a(e),o.onClick?.(s);},"aria-label":`Go to slide ${e+1}`,"aria-current":i,className:twMerge("h-2 rounded-full transition-all duration-200",i?"w-6 bg-action-brand":"w-2 bg-border-muted hover:bg-border-input","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",t),children:r})}function ug({className:e,...t}){let{totalPages:r}=yo();return jsx("div",{...t,className:twMerge("flex items-center gap-2",e),role:"group","aria-label":"Carousel indicators",children:Array.from({length:r},(o,n)=>jsx(eu,{index:n},n))})}function pg({className:e,children:t,...r}){let{isAutoplayActive:o,toggleAutoplay:n}=yo();return jsx("button",{type:"button",...r,onClick:a=>{n(),r.onClick?.(a);},"aria-label":o?"Pause autoplay":"Start autoplay",className:twMerge("inline-flex items-center justify-center rounded-md","h-10 w-10","bg-background-input border border-border-input","text-text-primary hover:bg-background-muted","transition-colors duration-200","focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default",e),children:t||jsx(I,{name:o?"Pause":"Play",size:"sm"})})}function mg({className:e,...t}){let{currentPage:r,totalPages:o}=yo();return jsxs("div",{...t,className:twMerge("text-sm text-text-secondary tabular-nums",e),"aria-live":"polite","aria-atomic":"true",children:[r+1," / ",o]})}var o2="focus:ring-action-primary",n2="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function tu(e){return jsxs(CheckboxGroup,{...e,className:Ce(e.className,"flex flex-col gap-2"),children:[jsx(Me,{children:e.label}),e.children,e.description&&jsx(Se,{children:e.description}),jsx(pe,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function a2({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function i2({isSelected:e,isInvalid:t,isDisabled:r,isIndeterminate:o}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",a=o2,i="";return r?i="border-border-muted bg-background-muted":t?i="border-feedback-error-border bg-feedback-error-background":e||o?i=n2:i="bg-background-input border-border-input hover:border-border-focus",`${n} ${a} ${i}`}var fg="w-4 h-4 text-current group-disabled:text-text-disabled";function _o(e){let{children:t,variant:r,...o}=e;return jsx(Checkbox,{...o,className:composeRenderProps(e.className,(n,a)=>`${a2(a)} ${n||""}`),children:n=>{let{isSelected:a,isIndeterminate:i,...s}=n,c=jsx("div",{className:i2({isSelected:a,isIndeterminate:i,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:fg}):a?jsx(Check,{"aria-hidden":true,className:fg}):null});return jsxs(Fragment,{children:[c,typeof t=="function"?t(n):t]})}})}var c2={primary:"bg-action-primary/10 text-action-primary border border-action-primary/20 hover:bg-action-primary/15",secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border border-border-muted hover:bg-action-secondary-hover",info:"bg-feedback-info-background text-feedback-info-text border border-feedback-info-border hover:bg-feedback-info-background/80"};function bg(e){return !e||e==="default"?"secondary":e==="brand"?"primary":e}var d2={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"},u2="opacity-75 cursor-not-allowed pointer-events-none";function xg(e){let{variant:t,size:r,isDisabled:o,isClickable:n,className:a}=e,i=r==="xs"?"text-xs":Le[r].text;return twMerge("inline-flex items-center justify-center rounded-full font-medium transition-colors","whitespace-nowrap select-none",d2[r],i,c2[t],n&&!o&&"cursor-pointer",o&&u2,a)}function Ar({children:e,onRemove:t,size:r="md",variant:o="secondary",isRemovable:n=true,isDisabled:a=false,className:i,onClick:s}){let c=!!s&&!a,l=n&&t&&!a,u=f=>{f.stopPropagation(),f.preventDefault(),t&&!a&&t();},d=()=>{s&&!a&&s();},m=r==="xs"?10:r==="sm"?12:r==="md"?14:16,g=jsxs(Fragment,{children:[jsx("span",{className:"truncate",children:e}),l?c?jsx("span",{onClick:u,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u(f));},role:"button",tabIndex:0,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":"Remove",children:jsx(I,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):jsx("button",{type:"button",onClick:u,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":"Remove",tabIndex:-1,children:jsx(I,{name:"X",size:m,className:"text-current opacity-70 hover:opacity-100"})}):null]});return c?jsx("button",{type:"button",onClick:d,className:xg({variant:bg(o),size:r,isDisabled:a,isClickable:c,className:i}),disabled:a,children:g}):jsx("span",{className:xg({variant:bg(o),size:r,isDisabled:a,isClickable:c,className:i}),children:g})}function vg({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:u=[],onItemsChange:d,staticItems:m,fetchSuggestions:p,chipVariant:g="secondary",showErrors:f=true,className:b}){let[x,v]=useState(""),[C,y]=useState([]),[S,k]=useState(false),[R,E]=useState(false),[D,L]=useState(-1),V=lo(x,300),A=useRef(null),N=useRef(null),{isFocused:T,handleFocus:z,handleBlur:W}=sr(),F=useId(),K=useCallback(M=>{if(!d||!M.trim())return;let h=M.trim();if(u.includes(h)){v(""),E(false),y([]),L(-1);return}d([...u,h]),v(""),E(false),y([]),L(-1),A.current?.focus();},[u,d]),X=useCallback(M=>{d&&d(u.filter(h=>h!==M));},[u,d]);useEffect(()=>{if(!p)return;let M=true;return (async()=>{let O=V.trim();if(!O){M&&(k(false),y([]),E(false));return}k(true);try{let H=await p(O);if(!M)return;y(H),E(!0);}catch(H){if(!M)return;console.error("Error fetching suggestions:",H),y([]),E(false);}finally{M&&k(false);}})(),()=>{M=false;}},[V,p]),useEffect(()=>{if(p||!m)return;if(!V.trim()){y([]),E(false);return}let M=m.filter(h=>h.name.toLowerCase().includes(V.toLowerCase())).map(h=>h.id);y(M),E(M.length>0||V.trim().length>0);},[V,m,p]);let G=useMemo(()=>{let M=C.filter(h=>!u.includes(h));return x.trim()&&!M.includes(x.trim())&&!u.includes(x.trim())?[...M,`Create tag: "${x.trim()}"`]:M},[C,x,u]),Y=useCallback(M=>{v(M.target.value),L(-1),M.target.value&&E(true);},[]),P=useCallback(M=>{i||(M.startsWith("Create tag:")?K(x):K(M));},[K,x,i]),w=useCallback(M=>{if(!i)switch(M.key){case "Enter":case ",":if(M.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&&u.length>0&&(M.preventDefault(),X(u[u.length-1]));break;case "ArrowDown":M.preventDefault(),R&&L(h=>h<G.length-1?h+1:h);break;case "ArrowUp":M.preventDefault(),R&&L(h=>h>0?h-1:-1);break;case "Escape":E(false),L(-1);break}},[i,x,u,G,D,R,K,X]);useEffect(()=>{let M=h=>{N.current&&h.target instanceof Node&&!N.current.contains(h.target)&&E(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]);let B=()=>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]",xo({isInvalid:s,isDisabled:i,isFocused:T}),"bg-background-input",o==="sm"&&"px-2 py-1 h-[32px]",o==="md"&&"px-2.5 py-1.5 h-[40px]",o==="lg"&&"px-3 py-2 h-[44px]",o==="xl"&&"px-3.5 py-2.5 h-[48px]",i&&"opacity-50 cursor-not-allowed bg-background-muted");return jsxs("div",{ref:N,className:twMerge("relative flex flex-col gap-1",b),children:[e&&jsx(Me,{size:o,tooltip:n,isRequired:a,children:e}),jsx(nt,{children:jsxs("div",{className:B(),onClick:()=>!i&&A.current?.focus(),children:[u.map(M=>jsx(Ar,{variant:g,size:"xs",onRemove:()=>X(M),isDisabled:i,className:"shrink-0 max-h-full",children:M},M)),jsx("input",{ref:A,type:"text",role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":F,"aria-autocomplete":"list",value:x,onChange:Y,onKeyDown:w,onFocus:M=>z(M),onBlur:M=>W(M),placeholder:u.length===0?l:"",disabled:i,className:"flex-1 min-w-[120px] h-full !border-0 !outline-none !ring-0 bg-transparent text-text-primary text-sm placeholder:text-text-disabled disabled:cursor-not-allowed focus:!ring-0 focus:!outline-none focus:!border-0 focus-visible:!ring-0 focus-visible:!outline-none focus-visible:!border-0",style:{boxShadow:"none",WebkitAppearance:"none",appearance:"none",border:"none",outline:"none"}})]})}),R&&(x||G.length>0)&&jsx("div",{id:F,role:"listbox",className:twMerge("absolute z-50 mt-1 rounded-lg border border-border-default","max-h-60 overflow-auto bg-background-surface shadow-lg","left-0 right-0 top-full"),children:S?jsx("div",{className:"px-3 py-2 text-sm text-text-secondary",children:"Loading..."}):G.length>0?G.map((M,h)=>jsx("div",{role:"option","aria-selected":h===D,className:twMerge("cursor-pointer px-3 py-2 text-sm transition-colors","hover:bg-background-hover",h===D&&"bg-background-selected",M.startsWith("Create tag:")&&"italic text-text-secondary"),onClick:()=>P(M),children:M},M)):x&&jsx("div",{className:"px-3 py-2 text-sm text-text-secondary",children:"No suggestions found"})}),t&&jsx(Se,{size:o,className:"mt-1",children:t}),f&&typeof r=="string"&&jsx(pe,{size:o,className:"text-feedback-error-text mt-1",children:r}),f&&typeof r=="function"&&c&&jsx(pe,{size:o,className:"text-feedback-error-text mt-1",children:r(c)})]})}var C2={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')},S2={github:()=>import('ace-builds/src-noconflict/theme-github'),github_dark:()=>import('ace-builds/src-noconflict/theme-github_dark')},w2={"ext-language-tools":()=>import('ace-builds/src-noconflict/ext-language_tools')},Ha=new Set;async function ou(e,t){Ha.has(e)||(await t(),Ha.add(e));}async function N2(e,t,r){await Promise.all([ou(`language:${e}`,C2[e]),ou(`theme:${t}`,S2[t]),r?ou("extension:language-tools",w2["ext-language-tools"]):void 0]);}function Sg(e,t,r){let o=Ha.has(`language:${e}`)&&Ha.has(`theme:${t}`);return r?o&&Ha.has("extension:language-tools"):o}function wg({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:u=50,showLineNumbers:d=true,showGutter:m=true,fontSize:p=14,wrapEnabled:g=false}){let f=useRef(null),[b,x]=useState(()=>Sg(o,n,!t)),v=useMemo(()=>{if(a)return a;let C=(e.match(/\n/g)||[]).length+1;return `${Math.max(l,Math.min(C,u))*c+10}px`},[e,a,c,l,u]);return useEffect(()=>{let C=false,y=!t;return Sg(o,n,y)?(x(true),()=>{C=true;}):(x(false),N2(o,n,y).then(()=>{C||x(true);}).catch(S=>{C||x(true),console.error("Failed to load Ace editor resources",S);}),()=>{C=true;})},[o,t,n]),useEffect(()=>{b&&f.current?.editor&&f.current.editor.resize();},[v,b]),jsx("div",{className:twMerge("overflow-hidden rounded-md border border-border-input",s),style:{width:i,height:v},children:b?jsx(y2,{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:d,tabSize:2,enableBasicAutocompletion:!t,enableLiveAutocompletion:!t,enableSnippets:!t,showFoldWidgets:true,wrap:g},editorProps:{$blockScrolling:true}}):jsx("div",{className:"flex h-full w-full items-center justify-center bg-surface-muted text-foreground-muted",children:"Loading editor\u2026"})})}var Tg=Ee.createContext({variant:"contained",density:"comfortable",showDividers:true}),kg=Ee.createContext(null),D2={contained:"rounded-lg border border-border-default bg-background-surface overflow-hidden",bordered:"rounded-lg border border-border-default bg-background-surface",plain:"bg-transparent"},Ng={true:"divide-y divide-border-default",false:"gap-3"},M2={comfortable:"px-5 py-3",compact:"px-4 py-2.5"},E2={comfortable:"px-5 pt-0",compact:"px-4 pt-0"},L2={comfortable:"h-4 w-4",compact:"h-3.5 w-3.5"};function su(){return Ee.useContext(Tg)}function A2(e){let t=Ee.useContext(kg);if(!t)throw new Error(`${e} must be used within a <CollapseItem>`);return t}function I2({variant:e,showDividers:t,className:r}){let o="group/collapse-item w-full transition-colors",n={contained:"bg-background-surface",bordered:"bg-background-surface",plain:"bg-transparent"},a=t?"":"rounded-lg border border-border-default bg-background-surface overflow-hidden";return twMerge(o,n[e],a,r)}function F2({isDisabled:e,isPressed:t,density:r,variant:o,showDividers:n,className:a}){let i="group/collapse-header flex w-full items-start gap-4 text-left transition-colors duration-150",s=e?"cursor-not-allowed text-text-disabled":"cursor-pointer text-text-primary",c=t&&!e?"bg-background-hover":"",l=M2[r];return twMerge(i,Oe(),l,s,c,o==="plain"&&n?"px-0":"",a)}function B2({density:e,showDividers:t,className:r}){let o="text-text-primary",n=E2[e];return twMerge(o,n,t?"":"rounded-b-lg",r)}function Gn({variant:e="contained",density:t="comfortable",showDividers:r=true,className:o,...n}){let a=Ee.useMemo(()=>({variant:e,density:t,showDividers:r}),[e,t,r]),i=twMerge("flex w-full flex-col",D2[e],r?Ng.true:Ng.false,e==="plain"&&r?"border-y border-border-default/60":"");return jsx(Tg.Provider,{value:a,children:jsx(DisclosureGroup,{...n,className:Ce(o,i)})})}function Co({className:e,children:t,...r}){let{variant:o,showDividers:n}=su();return jsx(Disclosure,{...r,className:composeRenderProps(e,a=>I2({variant:o,showDividers:n,className:a})),children:a=>jsx(kg.Provider,{value:a,children:t})})}Co.displayName="CollapseItem";function So({title:e,description:t,startContent:r,endContent:o,indicator:n,indicatorPosition:a="end",showIndicator:i=true,keepIndicatorSpace:s=false,children:c,className:l,...u}){let d=A2("CollapseHeader"),{density:m,variant:p,showDividers:g}=su(),f=L2[m];return jsx(Button,{...u,slot:"trigger","data-expanded":d.isExpanded?"true":void 0,className:composeRenderProps(l,(b,x)=>F2({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:d.isExpanded,isDisabled:x}):n??jsx(I,{name:"CaretDown",size:m==="compact"?"xs":"sm",weight:"bold","aria-hidden":"true",className:twMerge("text-text-secondary transition-transform duration-200",d.isExpanded?"rotate-180":"rotate-0")}):null,C=v?jsx("span",{className:twMerge("flex flex-shrink-0 items-center justify-center text-text-secondary",f),"aria-hidden":"true",children:v}):s?jsx("span",{className:twMerge("flex flex-shrink-0 items-center justify-center",f),"aria-hidden":"true"}):null;return jsxs("div",{className:"flex w-full items-center gap-4",children:[a==="start"&&C,r&&jsx("div",{className:"flex flex-shrink-0 items-center text-text-secondary",children:r}),jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[c??jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1 text-left",children:[e&&jsx("span",{className:"truncate font-medium text-text-primary",children:e}),t&&jsx("span",{className:"text-sm text-text-secondary",children:t})]}),o&&jsx("div",{className:"flex flex-shrink-0 items-center text-sm text-text-secondary",children:o})]}),a==="end"&&C]})}})}So.displayName="CollapseHeader";function wo({className:e,children:t,...r}){let{density:o,showDividers:n}=su();return jsx(DisclosurePanel,{...r,className:composeRenderProps(e,a=>B2({density:o,showDividers:n,className:a})),children:t})}wo.displayName="CollapseContent";function Un(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 cu(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 H2({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,transparent:i,className:s,validationResult:c,value:l,defaultValue:u,onChange:d,placeholder:m="#000000",showColorSwatch:p=true,reserveErrorSpace:g=true,...f}){let[b,x]=useState(u||""),[v,C]=useState(l||u||""),[y,S]=useState(false),[k,R]=useState(null),{isFocused:E,handleFocus:D,handleBlur:L}=sr(),V=l!==void 0?l:b;useEffect(()=>{l!==void 0&&C(l);},[l]);let A=V?!Un(V):false,N=useCallback(W=>{if(C(W),Un(W)){let F=cu(W);d?d(F):x(F);}else W===""&&(d?d(""):x(""));},[d]),T=useCallback(W=>{let F=cu(W);C(F),d?d(F):x(F);},[d]),z=useCallback(W=>{if(Un(v)){let F=cu(v);C(F),d&&F!==V?d(F):!d&&F!==b&&x(F);}L(W,f.onBlur);},[v,V,b,d,L,f.onBlur]);return jsx(TextField,{...f,isRequired:a,className:Ce(s,"group flex flex-col"),children:({isDisabled:W})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(Me,{size:o,tooltip:n,isRequired:a,children:e}),jsx(nt,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(fs,{size:o,disabled:W,type:"text",value:v,placeholder:m,onFocus:F=>D(F,f.onFocus),onBlur:z,onChange:F=>N(F.target.value),className:twMerge(ht({isInvalid:A,isDisabled:W,isFocused:E,size:o,transparent:i}),p?"pr-12":"pr-3","pl-3")}),p&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:Le[o].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",Un(V)?"border-border-default":"border-border-default bg-background-muted"),style:Un(V)?{backgroundColor:V}:void 0,"aria-hidden":"true",children:!Un(V)&&jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsx("div",{ref:R,children:jsx(Q,{variant:"secondary",size:o,icon:"Palette",onPress:()=>S(!y),isDisabled:W,className:"flex-shrink-0",children:"Pick"})})]})}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(pe,{size:o,children:r}):typeof r=="function"&&c?jsx(pe,{size:o,children:r(c)}):t?jsx(Se,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&c?jsx(pe,{size:o,className:"mt-1",children:r(c)}):t?jsx(Se,{size:o,className:"mt-1",children:t}):null}),y&&k&&jsx(Ze,{triggerRef:{current:k},isOpen:y,onOpenChange:S,placement:"bottom end",className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-lg p-4",children:jsxs("div",{className:"flex flex-col gap-4",children:[jsx(HexColorPicker,{color:V||"#000000",onChange:T,style:{width:"200px",height:"200px"}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:V||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:V||"#000000"})]})]})})]})})}function Dg({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:u="500px",minWidth:d="400px"}){return jsx(rr,{isOpen:e,onClose:t,title:o,maxWidth:u,minWidth:d,primaryAction:{label:a,onPress:()=>{r();},variant:s??(c?"destructive":"primary"),isLoading:l},secondaryAction:{label:i,onPress:t,variant:"secondary",isDisabled:l},children:jsx("div",{className:"text-text-primary",children:n})})}function Mg({isConnected:e,connectedAt:t,disconnectedAt:r,showTimestamp:o=false,isLoading:n,size:a="sm",shape:i="pill",...s}){if(n)return jsx(J,{className:"inline-flex h-6 w-24"});let c=e?"Connected":"Disconnected",l=e?"success":"neutral",u=null;if(o){if(e&&t)u=Vi(t);else if(!e&&r){let d=Vi(r);u=d?`Offline ${d}`:null;}}return jsxs("div",{className:"inline-flex flex-col gap-1",children:[jsx(Je,{variant:l,size:a,shape:i,dot:e,dotPulse:e,...s,children:c}),u&&jsx("span",{className:"text-xs text-text-secondary",children:u})]})}function Eg({firstName:e,lastName:t,email:r,phone:o,avatarUrl:n,href:a,LinkComponent:i,variant:s="outlined",layout:c="horizontal",showEmail:l=true,showPhone:u=false,isLoading:d=false,className:m,contentClassName:p,piiEntity:g}){let f=`${e} ${t}`.trim(),b=({children:v,className:C})=>a?i?jsx(i,{href:a,className:C,children:v}):jsx(Ue,{href:a,variant:"unstyled",className:twMerge("hover:underline",C),asButton:false,children:v}):jsx("span",{className:C,children:v}),x=c==="vertical";return d?jsx(Ae,{variant:s,className:twMerge("flex flex-col",m),children:jsx(Ae.Content,{className:"flex items-center flex-1",children:jsxs("div",{className:twMerge("w-full",x?"flex flex-col items-center gap-4":"flex items-center gap-4"),children:[jsx(J,{width:56,height:56,className:"rounded flex-shrink-0"}),jsxs("div",{className:twMerge(x?"w-full text-center":"flex-1","space-y-2"),children:[jsx(J,{width:"70%",height:20,className:twMerge(x&&"mx-auto")}),jsx(J,{width:"100%",height:16,className:twMerge(x&&"mx-auto")})]})]})})}):jsx(Ae,{variant:s,className:twMerge("group/card flex flex-col",m),children:jsx(Ae.Content,{className:twMerge("flex items-center flex-1",a&&"cursor-pointer",p),children:jsxs("div",{className:twMerge("relative w-full",x?"flex flex-col items-center gap-4 text-center":"flex items-center gap-4"),children:[jsx(Zr,{firstName:e,lastName:t,src:n,size:"xl",variant:"user",shape:"square",className:"flex-shrink-0",piiEntity:g}),jsxs("div",{className:twMerge(x?"w-full":"flex-1 min-w-0"),children:[a&&jsx(b,{className:"after:absolute after:inset-0",children:jsx("span",{className:"sr-only",children:f})}),jsx("span",{className:"text-lg font-semibold leading-tight text-text-primary block mb-1.5 group-hover/card:text-text-brand transition-colors","data-pii-type":g?"full-name":void 0,"data-pii-entity":g,children:f}),jsxs("div",{className:twMerge("space-y-0.5",x&&"flex flex-col items-center"),children:[l&&r&&jsxs("div",{className:"flex items-center gap-2.5 text-text-primary",children:[jsx(I,{name:"Envelope",size:16,className:"text-text-secondary flex-shrink-0"}),jsx(Ue,{href:`mailto:${r}`,variant:"unstyled",className:twMerge("text-sm leading-relaxed text-text-primary relative z-20",x?"":"truncate"),"data-pii-type":g?"email":void 0,"data-pii-entity":g,children:r})]}),u&&o&&jsxs("div",{className:"flex items-center gap-2.5 text-text-primary",children:[jsx(I,{name:"Phone",size:16,className:"text-text-secondary flex-shrink-0"}),jsx(Ue,{href:`tel:${o}`,variant:"unstyled",className:twMerge("text-sm leading-relaxed text-text-primary relative z-20",x?"":"truncate"),"data-pii-type":g?"phone":void 0,"data-pii-entity":g,children:Ln(o)})]})]})]})]})})})}function Ps({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:u=false,badge:d,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],C=`${e} ${t}`.trim(),S={strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[l],k=({children:R,className:E})=>i?s?jsx(s,{href:i,className:E,children:R}):jsx(Ue,{href:i,variant:c,className:twMerge("hover:underline",E),asButton:false,children:R}):jsx("span",{className:E,children:R});return p?n==="inline"?jsxs("div",{className:twMerge("flex items-center",v.gap,g),children:[jsx(J,{width:v.skeletonAvatar,height:v.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsx(J,{width:v.skeletonText,height:v.skeletonAvatar*.5})]}):jsxs("div",{className:twMerge("flex items-center",v.gap,g),children:[jsx(J,{width:v.skeletonAvatar,height:v.skeletonAvatar,className:"flex-shrink-0 rounded-full"}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx(J,{width:v.skeletonText,height:16}),u&&jsx(J,{width:v.skeletonSecondary,height:12})]})]}):n==="inline"?jsxs("div",{className:twMerge("flex items-center",v.gap,g),children:[jsxs(k,{className:twMerge("flex items-center",v.gap),children:[jsx(Zr,{firstName:e,lastName:t,src:o,size:v.avatarSize,variant:"user",shape:b,className:"flex-shrink-0",piiEntity:f}),jsx("span",{className:twMerge("leading-normal truncate hover:text-text-primary",S,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:C})]}),d]}):jsxs("div",{className:twMerge("flex items-center justify-start",v.gap,g),children:[jsx(Zr,{firstName:e,lastName:t,src:o,size:v.avatarSize,variant:"user",shape:b,className:"flex-shrink-0",piiEntity:f}),jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(k,{className:twMerge("leading-normal truncate hover:text-text-primary",S,v.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":f?"full-name":void 0,"data-pii-entity":f,children:C})}),d]}),u&&r&&jsx("div",{className:twMerge("text-text-secondary leading-normal truncate",v.secondaryTextSize),"data-pii-type":f?"email":void 0,"data-pii-entity":f,children:r})]})]})}var Lg={duration:.5,ease:"easeInOut"},To=createContext(null),on=()=>{let e=useContext(To);if(!e)throw new Error("useChartContext must be used within a ChartContextProvider");return e};var Ga=({data:e,color:t="var(--color-viz-default)"})=>{let r=useId(),o=useId(),{xScale:n,yScale:a,animationSettings:i}=on(),s=n.range(),c=a.range();return jsxs(Fragment,{children:[jsxs("defs",{children:[jsxs("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[jsx("stop",{offset:"50%",stopColor:t,stopOpacity:.1}),jsx("stop",{offset:"100%",stopColor:t,stopOpacity:0})]}),jsx("clipPath",{id:o,children:jsx("rect",{x:s[0],y:c[1],width:s[1]-s[0],height:c[0]-c[1]})})]}),jsx("g",{clipPath:`url(#${o})`,children:jsxs(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:[jsx(AreaClosed,{data:e,x:l=>n(l.xValue),y:l=>a(l.yValue),yScale:a,fill:`url(#${r})`,curve:curveLinear}),jsx(LinePath,{data:e,x:l=>n(l.xValue),y:l=>a(l.yValue),stroke:t,strokeWidth:3,curve:curveLinear})]})})]})};var Kn=({data:e,color:t="var(--color-viz-default)",opacity:r=1,categoryColors:o={}})=>{let{xScale:n,yScale:a,animationSettings:i}=on(),s=useId(),c=n.range(),l=a.range(),u=[...e].sort((p,g)=>p.xValue.getTime()-g.xValue.getTime());if(u.length===0)return null;let d=u.length>1?u[1].xValue.getTime()-u[0].xValue.getTime():15*6e4,m=Math.abs(n(new Date(u[0].xValue.getTime()+d))-n(u[0].xValue));return jsxs(Fragment,{children:[jsx("defs",{children:jsx("clipPath",{id:s,children:jsx("rect",{x:c[0],y:l[1],width:c[1]-c[0],height:l[0]-l[1]})})}),jsx("g",{clipPath:`url(#${s})`,children:jsx(motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:i.duration,ease:i.ease},style:{transformOrigin:`0 ${a(0)}px`,isolation:"isolate"},children:u.map((p,g)=>{let f=n(p.xValue),b=a(p.yValue),x=a(0),v=Math.min(b,x),C=Math.abs(b-x),y=u[g+1],S=y?Math.abs(n(y.xValue)-f):m,k=p.category&&o[p.category]?o[p.category]:t;return jsx(Bar,{x:f-S/2,y:v,width:S,height:C,fill:k,opacity:r,rx:1},p.xValue.getTime())})})})]})};var Ir=Vp(ob()),ab=Vp(nb());var mw=["top","left","transform","className","children","innerRef"];function vu(){return vu=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},vu.apply(this,arguments)}function fw(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 Ua(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=fw(e,mw);return Ee__default.createElement("g",vu({ref:c,className:(0, ab.default)("visx-group",i),transform:a||"translate("+n+", "+r+")"},l),s)}Ua.propTypes={top:Ir.default.number,left:Ir.default.number,transform:Ir.default.string,className:Ir.default.string,children:Ir.default.node,innerRef:Ir.default.oneOfType([Ir.default.string,Ir.default.func,Ir.default.object])};var Ye={top:0,right:0,bottom:50,left:60};function $r(e={type:"number"}){let t=i=>{if(i==null)return "-";let s=kr({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=u=>{if(u==null)return "";if(typeof u=="string")return u;if(typeof u=="number")return u.toString();if(typeof u=="object"&&"props"in u){let d=u.props;if(d?.children)return Array.isArray(d.children)?d.children.map(c).join(""):c(d.children)}return ""};return c(s)||i.toString()}return i.toString()},r=i=>{if(i==null)return "-";if(typeof e=="string"){let s=kr({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 Cu=(e,t)=>{let r=extent(e,o=>o.xValue);return scaleTime({range:[Ye.left,t-Ye.right],domain:r,nice:true})},Su=(e,t,r)=>{let o=$r(r),n=min(e,c=>c.yValue)||0,a=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 scaleLinear({range:[t-Ye.bottom,Ye.top],domain:[i,s],nice:true})};function Cw(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 Us(e,t=12,r="system-ui"){return e.length===0?0:Math.max(...e.map(o=>Cw(o,t,r)))}function Ya(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Sw(e,t,r=12,o=false){if(!Ya(t[0])||!Ya(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=Zc({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)),u=Us(l,r),m=u+u,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 ww=({top:e,scale:t,width:r})=>{let o=t.domain(),n=[o[0],o[o.length-1]],a=Ya(n[0])&&Ya(n[1]),i=r<400,s=a?n[0].getTime():0,c=a?n[1].getTime():0,l=useMemo(()=>a?Zc({start:n[0],end:n[1]},{compact:i}):()=>"",[s,c,i,a]),u=useMemo(()=>Sw(r,n,12,i),[r,s,c,i]);return u.length===0?null:jsx(Axis,{orientation:"bottom",top:e,scale:t,tickValues:u,tickFormat:d=>{let m=d;return Ya(m)?l(m):""},stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:(d,m,p)=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:m===0?"start":m===p.length-1?"end":"middle"}),rangePadding:0})};function Ks(e,t=12){let r=t*2.5,o=Math.floor(e/r);return Math.max(2,Math.min(6,o))}var Nw=({left:e,scale:t,yFormatter:r,height:o})=>{let n=$r(r),a=useMemo(()=>!o||o<=0?5:Ks(o),[o]);return jsx(Axis,{orientation:"left",left:e,scale:t,numTicks:a,tickFormat:i=>(n.tickFormat||n.format)(i),stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"end",dy:"0.33em"})})},Tw=({top:e,scale:t})=>jsx(Axis,{orientation:"bottom",top:e,scale:t,stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"middle",dy:"0.25em"})}),kw=({left:e,scale:t})=>jsx(Axis,{orientation:"left",left:e,scale:t,stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"end",dx:"-0.25em",dy:"0.33em"})}),Pw=({top:e,scale:t,yFormatter:r,width:o})=>{let n=$r(r),a=useMemo(()=>{if(!o||o<=0)return 5;let s=Math.floor(o/60);return Math.max(2,Math.min(8,s))},[o]);return jsx(Axis,{orientation:"bottom",top:e,scale:t,numTicks:a,tickFormat:i=>(n.tickFormat||n.format)(i),stroke:"var(--color-border-muted)",tickStroke:"var(--color-border-muted)",tickLabelProps:()=>({fill:"var(--color-text-secondary)",fontSize:12,textAnchor:"middle",dy:"0.25em"})})},Fr={Bottom:ww,Left:Nw,CategoryBottom:Tw,CategoryLeft:kw,NumericBottom:Pw};var qn=({data:e,formatter:t,label:r,categoryLabels:o})=>{if(!e)return null;let n=Ee__default.useContext(To),a=o??n?.categoryLabels,i=n?.xScale,s=$r(t),c=Ee__default.useRef(null),[l,u]=Ee__default.useState({x:0,y:0,translate:"translate(-50%, -100%)"});Ee__default.useEffect(()=>{if(!c.current)return;let b=c.current.getBoundingClientRect(),x=window.innerHeight,v=window.innerWidth,C=e.x,y=e.y,S=e.position==="left"?"translate(calc(-100% - 16px), -50%)":"translate(16px, -50%)";e.position==="left"&&C-b.width-16<0?S="translate(16px, -50%)":e.position==="right"&&C+b.width+16>v&&(S="translate(calc(-100% - 16px), -50%)"),y-b.height/2<0?y=b.height/2:y+b.height/2>x&&(y=x-b.height/2),u({x:C,y,translate:S});},[e.x,e.y,e.position]);let d=i?.domain(),p=d&&d.length===2&&d.every(f=>f instanceof Date)?jm({start:d[0],end:d[1]}):null,g=r||(p&&e.xValue instanceof Date?p(e.xValue):String(e.xValue));return jsx(AnimatePresence,{children:jsxs(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:[jsx("div",{className:"mb-1 font-medium text-text-primary",children:g}),e.isEvent?jsxs("div",{className:"space-y-2",children:[e.series.length>1&&jsx("ul",{className:"list-none p-0 border-b border-border-default pb-2",children:e.series.slice(0,-1).map(f=>jsxs("li",{className:"py-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"font-medium text-text-primary",children:[f.label,":"]}),jsx("span",{className:"text-text-secondary",children:s.format(f.value)})]}),f.category&&jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsx("div",{className:"h-3 w-3",style:{backgroundColor:f.categoryColor||f.color,borderRadius:"1px"}}),jsx("span",{className:"text-sm text-text-secondary",children:a?.[f.category]||f.category})]})]},f.label))}),(()=>{let f=e.series[e.series.length-1];return jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:f.color}}),jsx("span",{className:"font-medium text-text-primary",children:f.label})]}),e.eventMetadata&&Object.keys(e.eventMetadata).length>0&&jsx("div",{className:"ml-4 mt-1 space-y-0.5 text-xs text-text-secondary",children:Object.entries(e.eventMetadata).map(([b,x])=>jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"capitalize",children:[b,":"]}),jsx("span",{className:"font-medium",children:x})]},b))})]})})()]}):jsx("ul",{className:"list-none p-0",children:e.series.map(f=>jsxs("li",{className:"py-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"font-medium text-text-primary",children:[f.label,":"]}),jsx("span",{className:"text-text-secondary",children:s.format(f.value)})]}),f.category&&jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[jsx("div",{className:"h-3 w-3",style:{backgroundColor:f.categoryColor||f.color,borderRadius:"1px"}}),jsx("span",{className:"text-sm text-text-secondary",children:a?.[f.category]||f.category})]})]},f.label))})]})})};var Fw={top:20,right:20,bottom:50,left:60},pb=({data:e,width:t,height:r,margin:o=Fw,color:n,yFormatter:a={type:"number"},showGrid:i=true,showAxes:s=true,animate:c=true,barRadius:l=4,barPadding:u=.3,onBarClick:d,onBarHover:m,activeIndex:p,className:g,style:f,"aria-label":b="Category bar chart",orientation:x="vertical",showTooltip:v=true})=>{let[C,y]=useState(null),[S,k]=useState(null),[R,E]=useState(null),[D,L]=useState(t??600),[V,A]=useState(r??300),N=useRef(null),T=p??C,z=useId(),W=n||"var(--color-viz-default)";useEffect(()=>{if(t!==void 0&&r!==void 0){L(t),A(r);return}if(!N.current)return;let P=new ResizeObserver(w=>{for(let B of w)t===void 0&&L(B.contentRect.width),r===void 0&&A(B.contentRect.height);});return P.observe(N.current),t===void 0&&L(N.current.offsetWidth),r===void 0&&A(N.current.offsetHeight||300),()=>{P.disconnect();}},[t,r]);let{xScale:F,yScale:K,innerWidth:X,innerHeight:G}=useMemo(()=>{let P=D-o.left-o.right,w=V-o.top-o.bottom;if(x==="horizontal"){let M=max(e,h=>h.value)||0;return {xScale:scaleLinear({range:[0,P],domain:[0,M*1.1],nice:true}),yScale:scaleBand({range:[0,w],domain:e.map(h=>h.label),padding:u}),innerWidth:P,innerHeight:w}}let B=max(e,M=>M.value)||0;return {xScale:scaleBand({range:[0,P],domain:e.map(M=>M.label),padding:u}),yScale:scaleLinear({range:[w,0],domain:[0,B*1.1],nice:true}),innerWidth:P,innerHeight:w}},[e,D,V,o,u,x]);if(e.length===0)return jsx("div",{ref:N,className:twMerge("flex h-full min-h-[200px] w-full items-center justify-center rounded-lg border border-dashed border-border-default bg-background-surface text-sm font-medium text-text-secondary",g),style:r!==void 0?{height:r,...f}:f,children:"No data available"});let Y=(P,w)=>{if(y(P),m?.(w,P),P!==null&&w){let B,M;if(x==="horizontal"){let O=F(w.value),H=K(w.label)||0,j=K.bandwidth();B=o.left+O,M=o.top+H+j/2;}else {let O=F,H=K,j=O(w.label)??0,oe=O.bandwidth(),me=H(w.value);B=o.left+j+oe/2,M=o.top+me;}let h=B>D/2;E(w.label),k({xValue:new Date,series:[{label:"Value",value:w.value,color:w.color||W}],x:B,y:M,position:h?"left":"right"});}else k(null),E(null);};return jsxs("div",{ref:N,className:twMerge("relative h-full w-full overflow-hidden rounded-lg bg-background-surface",g),style:r!==void 0?{height:r,...f}:f,"aria-label":b,role:"img",children:[jsxs("svg",{width:D,height:V,children:[jsx("defs",{children:jsx(LinearGradient,{id:`${z}-bar`,from:W,to:W,toOpacity:.85})}),jsxs(Ua,{left:o.left,top:o.top,children:[i&&jsx("g",{className:"grid-lines",children:(x==="horizontal"?F.ticks(5):K.ticks(5)).map(P=>{let w=x==="horizontal"?0:K(P),B=x==="horizontal"?F(P):0;return jsx("line",{x1:x==="horizontal"?B:0,y1:x==="horizontal"?0:w,x2:x==="horizontal"?B:X,y2:x==="horizontal"?G:w,stroke:"var(--color-border-default)",strokeOpacity:.5,strokeDasharray:"2,3"},P)})}),e.map((P,w)=>{let B=T===w||T==null,M=P.color||`url(#${z}-bar)`;if(x==="horizontal"){let Z=F(P.value),ne=K.bandwidth(),Te=K(P.label)||0;return jsx(motion.rect,{x:0,y:Te,width:Z,height:ne,fill:M,rx:l,ry:l,initial:c?{width:0,opacity:.5}:void 0,animate:{width:Z,opacity:B?1:.5},transition:{duration:.5,delay:w*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:d||m?"pointer":"default"},onMouseEnter:()=>Y(w,P),onMouseLeave:()=>Y(null,null),onClick:()=>d?.(P,w)},P.label)}let h=F,O=K,H=h.bandwidth(),j=h(P.label)??0,oe=O(P.value),me=Math.max(0,G-oe);return c?jsx(motion.rect,{x:j,width:H,fill:M,rx:l,ry:l,initial:{y:G,height:0,opacity:.5},animate:{y:oe,height:me,opacity:B?1:.5},transition:{duration:.5,delay:w*.05,ease:"easeOut",opacity:{duration:.15,delay:0}},style:{cursor:d||m?"pointer":"default"},onMouseEnter:()=>Y(w,P),onMouseLeave:()=>Y(null,null),onClick:()=>d?.(P,w)},P.label):jsx("rect",{x:j,y:oe,width:H,height:me,fill:M,rx:l,ry:l,opacity:B?1:.5,style:{cursor:d||m?"pointer":"default",transition:"opacity 150ms ease-out"},onMouseEnter:()=>Y(w,P),onMouseLeave:()=>Y(null,null),onClick:()=>d?.(P,w)},P.label)}),s&&x==="vertical"&&jsxs(Fragment,{children:[jsx(Fr.CategoryBottom,{top:G,scale:F}),jsx(Fr.Left,{left:0,scale:K,yFormatter:a,height:G})]}),s&&x==="horizontal"&&jsxs(Fragment,{children:[jsx(Fr.NumericBottom,{top:G,scale:F,yFormatter:a,width:X}),jsx(Fr.CategoryLeft,{left:0,scale:K})]})]})]}),v&&jsx(qn,{data:S,formatter:a,label:R??void 0})]})};var mb=({item:e})=>jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[jsx("div",{className:"h-3 w-3 shrink-0",style:{backgroundColor:e.fill,borderRadius:"1px"}}),jsx("span",{className:"text-sm text-text-secondary whitespace-nowrap",children:e.category})]}),zw=({items:e})=>e.length===0?null:jsx("div",{className:"flex items-center gap-3 flex-wrap",children:e.map(t=>jsx(mb,{item:t},t.category))}),js=({items:e,onExport:t,marginLeft:r=0,marginRight:o=0,isZoomed:n=false,onResetZoom:a})=>{let[i,s]=Ee__default.useState(false),[c,l]=Ee__default.useState(null),[u,d]=Ee__default.useState(false),[m,p]=Ee__default.useState(false),g=Ee__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=Ee__default.useCallback(async b=>{await g(b);},[g]);return jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 min-h-[32px]",style:{marginLeft:r,marginRight:o},children:[jsx("div",{className:"hidden sm:block flex-1 min-w-0",children:jsx(zw,{items:e})}),jsx("div",{className:"sm:hidden flex items-center gap-3",children:e.length>0&&jsxs(Fragment,{children:[jsx("button",{onClick:()=>d(true),className:"text-sm text-text-secondary hover:text-text-primary transition-colors underline decoration-dotted underline-offset-4",children:"Legend"}),jsx(Xe,{isOpen:u,onClose:()=>d(false),title:"Legend",children:jsx("div",{className:"grid grid-cols-1 gap-3 p-4",children:e.map(b=>jsx(mb,{item:b},b.category))})})]})}),jsxs("div",{className:"sm:hidden flex items-center gap-2 shrink-0",children:[n&&a&&jsx(Q,{variant:"secondary",size:"sm",onPress:a,children:jsx(I,{name:"ArrowsOut",size:16})}),jsx(Q,{variant:"secondary",size:"sm",onPress:()=>p(true),isDisabled:i,children:jsx(I,{name:"Export",size:16})}),jsx(Xe,{isOpen:m,onClose:()=>p(false),title:"Export Chart",contentPadding:false,children:jsxs("div",{className:"flex flex-col",children:[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:[jsx(I,{name:"List",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:c==="csv"?"Exporting...":"Export as CSV"})]}),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:[jsx(I,{name:"Code",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:c==="svg"?"Exporting...":"Export as SVG"})]}),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:[jsx(I,{name:"DownloadSimple",size:20,className:"text-text-secondary"}),jsx("span",{className:"text-sm text-text-primary",children:c==="png"?"Exporting...":"Export as PNG"})]})]})})]}),jsxs("div",{className:"hidden sm:flex items-center gap-2 shrink-0",children:[n&&a&&jsxs(Q,{variant:"secondary",size:"sm",onPress:a,children:[jsx(I,{name:"ArrowsOut",size:16}),jsx("span",{className:"hidden sm:inline",children:"Reset Zoom"})]}),jsxs(DialogTrigger,{children:[jsxs(Q,{variant:"secondary",size:"sm",isDisabled:i,children:[jsx(I,{name:"Export",size:16}),i?"Exporting...":"Export"]}),jsx(Ze,{placement:"top end",className:"min-w-48 p-1 bg-background-surface rounded-lg shadow-xl ring-1 ring-border-default",children:jsxs(Menu,{onAction:f,className:"outline-none",children:[jsx(MenuItem,{id:"csv",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:i,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(I,{name:"List",size:14}),c==="csv"?"Exporting...":"Export as CSV"]})}),jsx(MenuItem,{id:"svg",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:i,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(I,{name:"Code",size:14}),c==="svg"?"Exporting...":"Export as SVG"]})}),jsx(MenuItem,{id:"png",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-primary rounded cursor-pointer hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 focus-visible:ring-offset-background-surface data-[focused]:bg-background-hover data-[focused]:ring-2 data-[focused]:ring-border-focus data-[focused]:ring-offset-1 data-[focused]:ring-offset-background-surface",isDisabled:i,children:jsxs("span",{className:"flex items-center gap-2",children:[jsx(I,{name:"DownloadSimple",size:14}),c==="png"?"Exporting...":"Export as PNG"]})})]})})]})]})]})};var Nu=({data:e,seriesMetadata:t,width:r,height:o,onBrushChange:n,brushRegion:a,margin:i=Ye})=>{let s=useRef(null),c=useRef(false),l=useMemo(()=>e.flat(),[e]),u=useMemo(()=>({top:10,bottom:15,left:i.left,right:i.right}),[i]),d=r-u.left-u.right,m=useMemo(()=>{if(l.length===0)return scaleTime({domain:[new Date,new Date],range:[0,d]});let x=new Date(Math.min(...l.map(C=>C.xValue.getTime()))),v=new Date(Math.max(...l.map(C=>C.xValue.getTime())));return scaleTime({domain:[x,v],range:[0,d]})},[l,d]),p=useMemo(()=>{let x=l.length>0?Math.max(0,...l.map(v=>v.yValue)):1;return scaleLinear({domain:[0,x],range:[o-u.bottom,u.top]})},[l,o]),g=x=>{if(c.current)return;if(!x){n(null);return}let{x0:v,x1:C}=x;if(v===C)return;let y=new Date(v),S=new Date(C);if(!(Number.isNaN(y.getTime())||Number.isNaN(S.getTime()))){if(l.length>0){let k=Math.min(...l.map(V=>V.xValue.getTime())),R=Math.max(...l.map(V=>V.xValue.getTime())),D=(R-k)*.05;if(Math.abs(y.getTime()-k)<D&&Math.abs(S.getTime()-R)<D){n(null);return}}n([y,S]);}},f=useMemo(()=>{if(l.length!==0)return {start:{x:0,y:u.top},end:{x:d,y:o-u.bottom}}},[d,o,l]);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(E=>E.xValue.getTime())),C=Math.max(...l.map(E=>E.xValue.getTime())),y=a?a[0]:new Date(v),S=a?a[1]:new Date(C),k=s.current.state?.extent;if(k){let E=m.invert(k.x0),D=m.invert(k.x1),L=Math.abs(E.getTime()-y.getTime()),V=Math.abs(D.getTime()-S.getTime());if(L<1e3&&V<1e3)return}c.current=true;let R=E=>{let D=s.current.getExtent({x:m(y),y:u.top},{x:m(S),y:o-u.bottom});return {...E,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 jsx("div",{className:"mt-2",children:jsxs("svg",{width:r,height:o,children:[jsx(PatternLines,{id:"brush_pattern",height:8,width:8,stroke:"var(--color-text-secondary)",strokeWidth:1,orientation:["diagonal"]}),jsxs("g",{transform:`translate(${u.left}, 0)`,children:[e.map((x,v)=>jsx(LinePath,{data:x,x:C=>m(C.xValue),y:C=>p(C.yValue),stroke:t[v]?.color||"var(--color-gray-500)",strokeWidth:1.5,opacity:.8},`brush-series-${v}`)),jsx(Brush,{xScale:m,yScale:p,width:d,height:o-u.top-u.bottom,margin:{top:u.top,bottom:u.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 hb(e){switch(e){case "command":return ft("--color-action-brand","#111111");case "success":return ft("--color-feedback-success-border","#278a4a");case "warning":return ft("--color-feedback-warning-border","#c88420");case "error":return ft("--color-feedback-error-border","#c42d2d");case "alert":return ft("--color-feedback-warning-border","#c88420");default:return ft("--color-text-secondary","#525250")}}function Zs({events:e,color:t,showLabels:r=false}){let o=useContext(To),[n,a]=useState(null);if(!o)return console.warn("ChartEventMarkers must be used within a ChartContainer"),null;let{xScale:i,yScale:s,height:c,tooltip:l,datasets:u,seriesMetadata:d,seriesTypes:m,categoryColors:p}=o,g=e.filter(x=>{let v=i(x.timestamp);return v>=Ye.left&&v<=i.range()[1]}),f=useCallback((x,v)=>{a(v);let C=i(x.timestamp),y=C>(i.range()[1]-Ye.right-Ye.left)/2+Ye.left,S=[];u&&d&&u.forEach((k,R)=>{if(k.length===0)return;let E=bisector(N=>N.xValue).left,D=E(k,x.timestamp),L=k[D-1],V=k[D],A;if(!L)A=V;else if(!V)A=L;else {let N=Math.abs(x.timestamp.getTime()-L.xValue.getTime()),T=Math.abs(x.timestamp.getTime()-V.xValue.getTime());A=N<T?L:V;}A&&d[R]&&S.push({label:d[R].label,value:A.yValue,color:d[R].color,type:m?.[R]||"line",...A.category&&{category:A.category,categoryColor:p?.[A.category]}});}),S.push({label:x.label,value:0,color:t||hb(x.type),type:"event"}),l.show({xValue:x.timestamp,series:S,x:C,y:S.length>1&&typeof S[0].value=="number"?s(S[0].value):c/2,position:y?"left":"right",isEvent:true,eventMetadata:x.metadata});},[i,s,c,l,t,u,d,m,p]),b=useCallback(()=>{a(null),l.hide();},[l]);return g.length===0?null:jsx("g",{className:"chart-event-markers","data-testid":"chart-event-markers",children:g.map((x,v)=>{let C=i(x.timestamp),y=t||hb(x.type),S=n===v;return jsxs("g",{children:[jsx("line",{x1:C,y1:Ye.top,x2:C,y2:c-Ye.bottom,stroke:y,strokeWidth:S?3:2,strokeDasharray:"4 4",strokeOpacity:S?.9:.6,pointerEvents:"none"}),jsx("circle",{cx:C,cy:Ye.top,r:S?5:4,fill:y,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),jsx("circle",{cx:C,cy:c-Ye.bottom,r:S?5:4,fill:y,stroke:"var(--color-background-surface)",strokeWidth:2,pointerEvents:"none"}),r&&jsx("text",{x:C,y:Ye.top-8,textAnchor:"middle",fill:"var(--color-text-secondary)",fontSize:11,fontWeight:500,pointerEvents:"none",children:x.label}),jsx("rect",{x:C-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 Xa=({data:e,color:t="var(--color-viz-default)",strokeWidth:r=3,strokeDasharray:o,categoryColors:n={}})=>{let{xScale:a,yScale:i,animationSettings:s}=on(),c=i.range(),l=Object.keys(n).length>0,u=m=>m.category?n[m.category]??t:t,d=e.length===1?e[0]:void 0;return jsx(motion.g,{initial:{scaleY:0},animate:{scaleY:1},transition:{duration:s.duration,ease:s.ease},style:{transformOrigin:`0 ${c[0]}px`,transformBox:"fill-box",isolation:"isolate"},children:d?jsx("circle",{cx:a(d.xValue),cy:i(d.yValue),r,fill:l?u(d):t}):l?e.slice(0,-1).map((m,p)=>{let g=e[p+1];return jsx(LinePath,{data:[m,g],x:f=>a(f.xValue),y:f=>i(f.yValue),stroke:u(m),strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",curve:curveLinear},`${m.xValue.getTime()}-${g.xValue.getTime()}`)}):jsx(LinePath,{data:e,x:m=>a(m.xValue),y:m=>i(m.yValue),stroke:t,strokeWidth:r,strokeDasharray:o,strokeLinecap:"round",curve:curveLinear})})};var Nb=e=>e.type===Ga||e.type===Xa||e.type===Kn,oN=e=>e.type===Zs,nN=bisector(e=>e.xValue).left,aN=()=>jsx("div",{className:"flex h-full items-center justify-center",children:jsx("p",{className:"text-text-secondary",children:"No data available"})}),iN=()=>jsxs("div",{className:"flex h-full flex-col gap-4 p-4",children:[jsx(J,{className:"h-full w-full"}),jsxs("div",{className:"flex gap-4",children:[jsx(J,{className:"h-4 w-24"}),jsx(J,{className:"h-4 w-24"})]})]}),sN=({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,u]=useState(null),[d,m]=useState(null),p=useRef(null),g=useRef(0),f=useRef(""),b=useRef(null),{colorMode:x}=Mt(),v=useMemo(()=>Ca(),[x]),C=useMemo(()=>Uc(),[x]),{datasets:y,seriesMetadata:S,categoryInfo:k,categoryColors:R,categoryLabels:E,hasBarSeries:D,firstBarSeriesIndex:L,seriesTypes:V}=useMemo(()=>{let se=Children.toArray(c).filter(ee=>isValidElement(ee)&&Nb(ee)),Ne=se.filter(ee=>ee.props.data).length,Ve=se.some(ee=>ee.type===Kn),De=[],te=[],ce=[],_=null,q=null,U=null;se.forEach((ee,be)=>{let he=ee.props;if(!he.data)return;De.push(he.data);let Vo=("color"in he&&he.color?he.color:void 0)||(Ne===1?C:v[be%v.length]);te.push({label:"label"in he&&he.label||`Series ${De.length}`,color:Vo});let Nr=ee.type===Ga?"area":ee.type===Xa?"line":"bar";ce.push(Nr),"categoryColors"in he&&he.categoryColors&&(_=he.categoryColors),"categoryLabels"in he&&he.categoryLabels&&(q=he.categoryLabels),ee.type===Kn&&U===null&&(U=De.length-1);});let ae=null;if(_){let ee=new Set;De.forEach(be=>{be.forEach(he=>{he.category&&ee.add(he.category);});}),ae=Array.from(ee).map(be=>({label:q?.[be]||be,color:_[be]||"#6b7280"}));}return {datasets:De,seriesMetadata:te,categoryInfo:ae,categoryColors:_,categoryLabels:q,hasBarSeries:Ve,firstBarSeriesIndex:U,seriesTypes:ce}},[c,C,v,x]),A=e,N=a?i+8:0,T=t-60-N,z=Math.max(100,T),W=useMemo(()=>y.flat(),[y]),F=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=d||F,X=useMemo(()=>K?y.map(se=>se.filter(Ne=>Ne.xValue>=K[0]&&Ne.xValue<=K[1])):y,[y,K]);useEffect(()=>{s&&s(d);},[d,s]);let G=useMemo(()=>X.flat(),[X]),Y=useMemo(()=>Su(G,z,r),[G,z,r]),P=useMemo(()=>{let $=z-Ye.top-Ye.bottom;return Ks($)},[z]),w=useMemo(()=>{let $=$r(r),se=$.tickFormat||$.format,Ve=Y.ticks(P).map(ce=>se(ce)),De=Us(Ve,12,"system-ui"),te=Math.ceil(De)+12;return {...Ye,left:Math.max(te,30)}},[Y,r,P]),B=useMemo(()=>K?scaleTime({domain:K,range:[w.left,A-w.right]}):Cu(W,A),[K,W,A,w]),M=useCallback($=>{if(!F)return;let{scaleX:se,translateX:Ne}=$,Ve=A-w.left-w.right,[De,te]=F,ce=te.getTime()-De.getTime();if(ce<=0){m(null);return}let _=-Ne,q=_+Ve,U=Ve*se/ce,ae=_/U,ee=q/U,be=new Date(De.getTime()+ae),he=new Date(De.getTime()+ee),st=Math.abs(be.getTime()-De.getTime()),Vo=Math.abs(he.getTime()-te.getTime()),Nr=ce*.02;st<Nr&&Vo<Nr?m(null):m([be,he]);},[F,A,w]),h=useCallback($=>{let{left:se}=p.current?.getBoundingClientRect()||{left:0},Ne=$.clientX-se;if($.timeStamp-(g.current||0)<16)return;g.current=$.timeStamp;let Ve=B.invert(Ne),De=y.map((_,q)=>{if(!_||_.length===0)return null;let U=nN(_,Ve,1);if(U===0)return {point:_[0],datasetIndex:q};if(U>=_.length)return {point:_[_.length-1],datasetIndex:q};let ae=_[U-1],ee=_[U];if(!ae||!ee)return null;let be=Math.abs(ae.xValue.getTime()-Ve.getTime()),he=Math.abs(ee.xValue.getTime()-Ve.getTime());return {point:be<he?ae:ee,datasetIndex:q}}).filter(_=>_!==null&&S[_.datasetIndex]!==void 0).map(({point:_,datasetIndex:q})=>({label:S[q].label,value:_.yValue,color:S[q].color,point:_,type:V[q]}));if(De.length===0){u(null);return}let te=B(De[0].point.xValue),ce=te>(A-w.right-w.left)/2+w.left;u({xValue:De[0].point.xValue,series:De.map(({label:_,value:q,color:U,point:ae,type:ee})=>({label:_,value:q,color:U,type:ee,category:ae.category,categoryColor:ae.category&&R?R[ae.category]:void 0})),x:te,y:Y(De[0].value),position:ce?"left":"right"});},[y,X,S,V,B,Y,A,R,w]),O=()=>{u(null);},H=useCallback(()=>{m(null),b.current&&b.current.reset();},[]),j=useCallback($=>{if(m($),b.current&&F){let[se,Ne]=F,Ve=Ne.getTime()-se.getTime();if(Ve<=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 _=Ve/ce,q=A-w.left-w.right,ae=-((De.getTime()-se.getTime())/Ve)*q*_;b.current.setTransformMatrix({scaleX:_,scaleY:1,translateX:ae,translateY:0,skewX:0,skewY:0});}}},[F,A,w]),oe={width:A,height:z,xScale:B,yScale:Y,yFormatter:r,animationSettings:Lg,tooltip:{data:l,show:u,hide:()=>u(null)},datasets:X,seriesMetadata:S,seriesTypes:V,categoryColors:R||void 0,categoryLabels:E||void 0},me=Children.toArray(c),Z=0,ne=[],Te=[];me.forEach($=>{if(!isValidElement($)){ne.push($);return}if(oN($))Te.push($);else if(Nb($)){let se=Z;Z++;let Ne=$.props;ne.push(Ee__default.cloneElement($,{...Ne,data:X[se]||Ne.data,color:S[se]?.color}));}else ne.push($);});let ie=(k||S).map($=>({category:$.label,fill:$.color})),ue=Wp({datasets:y,metadata:{xLabel:"Date",yLabel:"Value",seriesLabels:S.map($=>$.label),timestamp:true},svgRef:p});if(o)return jsx(iN,{});if(y.length===0)return jsx(aN,{});let ge=jsxs(Fragment,{children:[jsx("title",{children:"Data chart visualization"}),jsx("g",{children:Y.ticks(P).map($=>jsx(Line,{from:{x:w.left,y:Y($)},to:{x:A-w.right,y:Y($)},stroke:"var(--color-border-muted)",strokeWidth:1},`grid-line-${$}`))}),ne,jsx(Fr.Bottom,{top:z-w.bottom,scale:B,width:A-w.left-w.right}),jsx(Fr.Left,{left:w.left,scale:Y,yFormatter:r,height:z-w.top-w.bottom}),l&&!l.isEvent&&jsxs(Fragment,{children:[D&&L!==null?(()=>{let $=X[L]??[];if($.length===0)return null;let se=[...$].sort((U,ae)=>U.xValue.getTime()-ae.xValue.getTime()),Ne=se.findIndex(U=>U.xValue.getTime()===l.xValue.getTime()),Ve=se[Ne+1],De=se.length>1&&Ve?Ve.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,q=Y.range();return jsx("rect",{x:_,y:q[1],width:te,height:q[0]-q[1],className:"fill-background-muted",opacity:.5,pointerEvents:"none",style:{transition:"all 100ms ease-out"}})})():null,l.series.filter($=>$.type!=="bar").map($=>jsxs("g",{children:[jsx("circle",{cx:B(l.xValue),cy:Y($.value),r:8,fill:"white",stroke:$.color,strokeWidth:2,style:{transition:"all 100ms ease-out"}}),jsx("circle",{cx:B(l.xValue),cy:Y($.value),r:4,fill:$.color,style:{transition:"all 100ms ease-out"}})]},`highlight-${$.label}`))]}),jsx("rect",{x:w.left,y:w.top,width:A-w.left-w.right,height:z-w.top-w.bottom,fill:"transparent",style:{cursor:n?"grab":"crosshair"},onMouseMove:h,onMouseLeave:O}),Te]});return jsx("div",{className:"relative flex h-full flex-col",children:jsxs(To.Provider,{value:oe,children:[n?jsx(Zoom,{width:A,height:z,scaleXMin:1,scaleXMax:20,scaleYMin:1,scaleYMax:1,constrain:$=>{let{scaleX:se,translateX:Ne}=$,Ve=Math.max(1,Math.min(20,se)),De=1,te=A-w.left-w.right,ce=0,_=te*(1-Ve),q=Math.max(_,Math.min(ce,Ne));return {...$,scaleX:Ve,scaleY:De,translateX:q,translateY:0}},children:$=>{if(b.current=$,$.transformMatrix){let{scaleX:se,translateX:Ne}=$.transformMatrix,Ve=`${se.toFixed(4)}-${Ne.toFixed(2)}`;Ve!==f.current&&(f.current=Ve,setTimeout(()=>{M($.transformMatrix);},0));}return jsx("svg",{width:A,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})}}):jsx("svg",{width:A,height:z,className:"overflow-visible",ref:p,role:"img","aria-label":"Data chart",children:ge}),jsx(qn,{data:l,formatter:r}),a&&F&&jsx(Nu,{data:y,seriesMetadata:S,width:A,height:i,onBrushChange:j,brushRegion:d,margin:w}),jsx(js,{onExport:ue,items:ie,marginLeft:0,marginRight:w.right,isZoomed:d!==null,onResetZoom:H})]})})},kb=withParentSize(sN);var mN=e=>e.toLocaleString(),fN=e=>`${Math.round(e*100)}%`,Mb=({data:e,width:t=800,height:r=400,padding:o=0,barGap:n=30,formatValue:a=mN,formatPercentage:i=fN,color:s,showScale:c=true,showOverallConversion:l=true,overallConversionLabel:u="Overall Conversion:",activeStageId:d,onStageClick:m,onStageHover:p,className:g,style:f,"aria-label":b="Funnel chart"})=>{let[x,v]=useState(null),[C,y]=useState(t),S=useRef(null),k=d??x,R=useId(),E=s||"var(--color-viz-default)";useEffect(()=>{if(!S.current)return;let T=new ResizeObserver(z=>{for(let W of z)y(W.contentRect.width);});return T.observe(S.current),()=>{T.disconnect();}},[]);let{layout:D,overallConversion:L}=useMemo(()=>{if(e.length===0)return {layout:[],overallConversion:0};let T=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((Y,P)=>{let w=o+z+P*(K+n),B=T===0?0:Y.value/T,M=B,h=P===0?null:e[P-1].value,O=h==null||h===0?0:1-Y.value/h;return {stage:Y,index:P,y:w,barHeight:K,widthPercent:B,conversionRate:M,dropOff:O}}),G=T===0?0:e[e.length-1].value/T;return {layout:X,overallConversion:G,maxValue:T}},[e,C,r,o,n,c,l]);if(e.length===0)return jsx("div",{className:twMerge("flex h-full min-h-[280px] w-full items-center justify-center rounded-lg border border-dashed border-border-default bg-background-surface text-sm font-medium text-text-secondary",g),style:{width:t,height:r,...f},children:"No funnel data available"});let V=c?60:0,A=o+V,N=C-o*2-V;return jsx("div",{ref:S,className:twMerge("relative w-full overflow-hidden rounded-lg bg-background-surface",g),style:{height:r,...f},"aria-label":b,role:"img",children:jsxs("svg",{width:"100%",height:r,className:"relative",children:[jsxs("defs",{children:[jsx(LinearGradient,{id:`${R}-bar`,from:E,to:E,toOpacity:.85}),jsx(LinearGradient,{id:`${R}-bg`,from:E,to:E,fromOpacity:.01,toOpacity:.15,x1:"0",y1:"0",x2:"1",y2:"0"})]}),l&&jsxs("text",{x:A,y:o+20,className:"fill-text-primary text-sm font-medium",children:[jsx("tspan",{className:"fill-text-secondary",children:u})," ",i(L)]}),c&&jsx("g",{children:D.map(T=>{let z=T.y+T.barHeight/2;return jsx("text",{x:o+V-12,y:z,textAnchor:"end",dominantBaseline:"middle",className:"fill-text-secondary text-xs",children:i(T.conversionRate)},T.stage.id)})}),D.map(T=>{let z=k===T.stage.id,W=N*T.widthPercent;return jsxs("g",{children:[jsx("rect",{x:A,y:T.y,width:N,height:T.barHeight,fill:`url(#${R}-bg)`,rx:4}),jsx(motion.rect,{x:A,y:T.y,width:W,height:T.barHeight,fill:`url(#${R}-bar)`,rx:4,initial:{width:0},animate:{width:W},transition:{duration:.6,delay:T.index*.1,ease:"easeOut"},opacity:z||k==null?1:.5,style:{cursor:m||p?"pointer":"default",transition:"opacity 150ms ease"},onMouseEnter:()=>{v(T.stage.id),p?.(T.stage);},onMouseLeave:()=>{v(null),p?.(null);},onClick:()=>m?.(T.stage)}),jsx("rect",{x:A+10,y:T.y+T.barHeight/2-10,width:70,height:20,className:"fill-background-surface stroke-border-default",strokeWidth:1,rx:4,style:{pointerEvents:"none"}}),jsx("text",{x:A+16,y:T.y+T.barHeight/2+4,className:"fill-text-primary text-xs font-semibold",style:{pointerEvents:"none"},children:a(T.stage.value)}),jsxs("text",{x:A,y:T.y-8,className:"fill-text-secondary text-xs",style:{pointerEvents:"none"},children:[jsx("tspan",{children:T.index+1})," ",T.stage.label]}),T.stage.secondaryValue&&jsx("text",{x:A+16,y:T.y-24,className:"fill-text-secondary text-xs",style:{pointerEvents:"none"},children:T.stage.secondaryValue}),T.index>0&&T.dropOff>0&&jsxs("text",{x:A+N,y:T.y-8,textAnchor:"end",className:"fill-text-secondary text-xs",children:[i(T.dropOff)," drop"]}),T.stage.annotation&&jsxs("g",{children:[jsx("rect",{x:A+W+8,y:T.y+8,width:60,height:24,rx:3,className:"fill-background-muted"}),jsx("text",{x:A+W+16,y:T.y+20,className:"fill-text-secondary text-xs font-medium",children:T.stage.annotation})]})]},T.stage.id)})]})})};function gN(e,t,r){return {field:e,operator:t,value:r}}function bN(e,t="AND"){return {logic:t,conditions:e}}function $a(){return {logic:"AND",conditions:[]}}function _s(e){return !e||e.conditions.length===0?true:e.conditions.every(t=>"conditions"in t?_s(t):false)}function xN(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,u=[],d=[],m=[];for(let p of s)p.operator==="in"&&Array.isArray(p.value)?u.push(...p.value):p.operator==="eq"?typeof p.value!="boolean"&&!Array.isArray(p.value)?u.push(p.value):m.push(p):["gte","gt","lte","lt"].includes(p.operator)?d.push({operator:p.operator,value:typeof p.value=="boolean"||Array.isArray(p.value)?String(p.value):p.value}):m.push(p);if(u.length>0){let g=Array.from(new Set(u)).map(f=>c?.values?.find(x=>String(x.value)===String(f))?.label??f);a.push({id:`${i}-in`,label:l,value:g.join(", ")});}if(d.length>0){let p=d.find(f=>f.operator==="gte"||f.operator==="gt"),g=d.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 d){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 ko(e,t){let r=e||$a();return {...r,conditions:[...r.conditions,t]}}function sn(e,t){if(!e)return $a();let r=e.conditions.filter(o=>"conditions"in o?sn(o,t).conditions.length>0:o.field!==t);return {...e,conditions:r}}function ln(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 Qa({count:e,label:t="results",isLoading:r=false,className:o=""}){if(r)return jsx("div",{className:`flex items-center ${o}`,children:jsx(J,{width:80,height:16})});let n=t.endsWith("s")?t.slice(0,-1):t,a=e===1?n:t;return jsxs("div",{className:`text-sm text-text-secondary whitespace-nowrap ${o}`,children:[e.toLocaleString()," ",a]})}var SN=e=>{let t=ht({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),r=[e.showSearchIcon?"":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return twMerge(t,r,e.className)};function lr({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,transparent:i,showSearchIcon:s,isClearable:c,onClear:l,type:u,validationResult:d,reserveErrorSpace:m=true,isLoading:p=false,descriptionPlacement:g="below",...f}){let[b,x]=Ee__default.useState(false),{isFocused:v,handleFocus:C,handleBlur:y}=sr(),S=u==="password",k=Li(p,300);return jsx(TextField,{...f,isRequired:a,className:Ce(f.className,"group flex flex-col"),children:({isDisabled:R,isInvalid:E})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(Me,{size:o,tooltip:n,description:g==="tooltip"||g==="inline"?t:void 0,descriptionPlacement:g,isRequired:a,children:e}),jsxs(nt,{children:[s&&jsx("div",{className:"pointer-events-none absolute top-1/2 -translate-y-1/2 transform flex items-center z-10",style:{left:9},children:(()=>{let D={sm:14,md:16,lg:18,xl:20}[o];return k?jsx(Kr,{size:D,color:"text-text-secondary"}):jsx(I,{name:"MagnifyingGlass",size:D,className:`transition-colors ${v?"text-action-brand":"text-text-secondary"}`})})()}),jsx(fs,{size:o,disabled:R,type:S?b?"text":"password":u,value:f.value,defaultValue:f.defaultValue,placeholder:f.placeholder,onFocus:D=>C(D,f.onFocus),onBlur:D=>y(D,f.onBlur),onChange:D=>f.onChange?.(D.target.value),style:s?{paddingLeft:{sm:28,md:32,lg:36,xl:37}[o]}:void 0,className:SN({isInvalid:E,isDisabled:R,isFocused:v,size:o,transparent:i,showSearchIcon:s,isClearable:c,hasValue:!!f.value,isPassword:S,className:typeof f.className=="string"?f.className:void 0})}),c&&f.value&&!R&&jsx(Ba,{onClick:()=>{l?l():f.onChange&&f.onChange("");},size:o}),S&&!R&&jsx("button",{type:"button",onClick:()=>x(!b),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":b?"Hide password":"Show password",onMouseDown:D=>{D.preventDefault(),D.stopPropagation();},children:jsx(I,{name:b?"EyeSlash":"Eye",size:o==="sm"?16:20,className:"text-text-primary"})})]}),m?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(pe,{size:o,children:r}):typeof r=="function"&&d?jsx(pe,{size:o,children:r(d)}):t&&g==="below"?jsx(Se,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&d?jsx(pe,{size:o,className:"mt-1",children:r(d)}):t&&g==="below"?jsx(Se,{size:o,className:"mt-1",children:t}):null})]})})}function cn({value:e,onChange:t,onClear:r,placeholder:o="Search...",size:n="sm",className:a="",isLoading:i=false}){return jsx("div",{className:`flex-1 min-w-0 sm:max-w-sm ${a}`,children:jsx(lr,{value:e,onChange:t,placeholder:o,showSearchIcon:true,isClearable:!!e&&!!r,onClear:r,size:n,"aria-label":o,reserveErrorSpace:false,isLoading:i})})}function _a({value:e,options:t,onChange:r,direction:o,onDirectionChange:n,showLabel:a=true,size:i="sm",className:s="",compact:c=false}){let[l,u]=useState(false),d=o!==void 0&&n!==void 0,m=t.find(p=>p.value===e);return c?jsxs("div",{className:`flex items-center gap-2 ${s}`,children:[jsx(Q,{variant:"secondary",size:i,icon:"ArrowsDownUp","aria-label":`Sort by: ${m?.label||"Select"}`,onPress:()=>u(true)}),jsx(Xe,{isOpen:l,onClose:()=>u(false),title:"Sort by",contentPadding:false,children:jsx(ListBox,{items:t.map(p=>({id:p.value,label:p.label,value:p.value})),className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:e?[e]:[],onSelectionChange:p=>{let g=Array.from(p)[0];g!=null&&(r(g),u(false));},children:p=>jsx(At,{id:p.id,textValue:p.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:p.label})},p.id)})})]}):jsxs("div",{className:`flex items-center gap-2 ${s}`,children:[a&&jsx("span",{className:"text-sm text-text-secondary whitespace-nowrap",children:"Sort by:"}),jsx(Zo,{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}),d&&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"?jsx(ArrowUp,{className:"w-4 h-4"}):jsx(ArrowDown,{className:"w-4 h-4"})})]})}function Fb({search:e,searchMobileMode:t="expanded",filters:r=[],onRemoveFilter:o,onClearAllFilters:n,onManageFilters:a,exportControl:i,maxVisibleFilterChips:s=3,sort:c,resultsCount:l,leftControls:u,onManageColumns:d,columnPicker:m,customControls:p,actions:g,interactionMode:f="auto",sticky:b,stickyTop:x="0",zIndex:v=10,className:C="",style:y}){let S=r.length>0;if(!(e||S||a||c||l||u||d||m||p||g||i))return null;let R=b?"sticky bg-background-surface":"",E=b?{top:x,zIndex:v}:{};return jsxs("div",{className:`@container flex flex-col gap-3 bg-background-surface py-3 border-b border-border-default ${R} ${C}`,style:{...y,...E},children:[jsxs("div",{className:"hidden @[640px]:flex @[640px]:items-center @[640px]:justify-between @[640px]:gap-4",children:[jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[u,u&&l&&jsx("div",{className:"h-4 w-px bg-border-default"}),l&&jsx(Qa,{count:l.count,label:l.label,isLoading:l.isLoading}),l&&c&&jsx("div",{className:"h-4 w-px bg-border-default"}),c&&jsx(_a,{value:c.value,options:c.options,onChange:c.onChange,showLabel:c.showLabel,direction:c.direction,onDirectionChange:c.onDirectionChange}),d?jsx(Q,{variant:"secondary",size:"sm",icon:"Columns",onClick:d,children:"Columns"}):m,S&&o&&jsxs(Fragment,{children:[r.slice(0,s).map(D=>jsxs(Ar,{variant:"primary",size:"sm",onRemove:()=>o(D.id),isRemovable:true,children:[D.label,": ",D.value]},D.id)),r.length>s&&a&&jsxs(Q,{variant:"ghost",size:"sm",onClick:a,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:["+",r.length-s," more"]}),n&&jsx(Q,{variant:"ghost",size:"sm",onClick:n,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:"Clear all"})]})]}),jsx("div",{className:"flex items-center gap-3 flex-shrink-0",children:p||jsxs(Fragment,{children:[g&&g.items.length>0&&jsx(Fragment,{children:g.items.map(D=>jsx(Q,{variant:D.variant||"secondary",size:"sm",icon:D.icon,onPress:D.onClick,isDisabled:D.disabled,children:D.label},D.id))}),e&&jsx("div",{className:"w-64",children:jsx(cn,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&jsx(Q,{variant:"secondary",size:"sm",icon:"Sliders",badgeNumber:r.length>0?r.length:void 0,onClick:a,children:"Filters"}),i&&jsx(Q,{variant:"secondary",size:"sm",icon:"Upload",onClick:i.onClick,isDisabled:i.isDisabled,children:i.label})]})})]}),jsxs("div",{className:"@[640px]:hidden",children:[jsx("div",{className:"flex flex-col gap-3 mb-3",children:jsx("div",{className:"flex items-center gap-3",children:p?jsx("div",{className:"flex-1",children:p}):jsxs(Fragment,{children:[g&&g.items.length>0&&jsx(zn,{items:g.items.map(D=>({id:D.id,name:D.label,iconName:D.icon,variant:D.variant==="destructive"?"destructive":"primary",disabled:D.disabled,onAction:D.onClick})),align:"left",size:"sm",children:jsx(Q,{variant:"secondary",size:"sm",icon:"DotsThreeVertical","aria-label":g.menuLabel||"Actions"})}),e&&jsx("div",{className:"flex-1",children:jsx(cn,{value:e.value,onChange:e.onChange,onClear:e.onClear,placeholder:e.placeholder,isLoading:e.isLoading})}),a&&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&&jsx(Q,{variant:"secondary",size:"sm",icon:"Upload",onClick:i.onClick,isDisabled:i.isDisabled,children:i.label})]})})}),jsxs("div",{className:"flex items-center justify-between gap-3",children:[jsxs("div",{className:"flex items-center gap-3",children:[u,l&&jsx(Qa,{count:l.count,label:l.label,isLoading:l.isLoading})]}),jsx("div",{className:"flex items-center gap-2",children:c&&jsx(_a,{value:c.value,options:c.options,onChange:c.onChange,showLabel:false,direction:c.direction,onDirectionChange:c.onDirectionChange,compact:f!=="desktop"})})]})]})]})}function Bb({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,u=e.slice(0,n),d=Math.max(0,e.length-n),m=d>0,p=a==="button"&&!!o,g=a==="chips"&&i&&!!o;if(!l&&!p&&!g)return null;let f=p&&jsxs(Q,{variant:"secondary",size:s,onClick:o,className:"whitespace-nowrap",children:[e.length," ",e.length===1?"filter":"filters"]}),b=jsxs(Fragment,{children:[g&&jsx(Q,{variant:"secondary",size:s,icon:"Sliders",onClick:o,className:"whitespace-nowrap",children:"Filters"}),l&&u.map(v=>jsxs(Ar,{variant:"secondary",size:s,onRemove:()=>t(v.id),isRemovable:true,children:[v.label,": ",v.value]},v.id)),l&&m&&o&&jsxs(Q,{variant:"ghost",size:s,onClick:o,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:["+",d," more"]}),l&&r&&jsx(Q,{variant:"ghost",size:s,onClick:r,className:"text-text-secondary hover:text-text-primary whitespace-nowrap",children:"Clear all"})]}),x=a==="button"?f:b;return jsx("div",{className:`flex flex-wrap items-center gap-2 ${c}`,children:x})}function zb({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,showCalendar:c=true,reserveErrorSpace:l=true,validationResult:u,className:d,...m}){let[p,g]=useState(false),f=b=>{m.onChange&&b&&m.onChange(b),g(false);};return jsxs(DateField,{...m,isDisabled:i,isRequired:a,isInvalid:s,className:Ce(d,"flex flex-col gap-1"),children:[e&&jsx(Me,{size:o,tooltip:n,isRequired:a,children:e}),jsx(nt,{children:jsxs("div",{className:"relative w-full",children:[jsx(ei,{size:o,isDisabled:i,isInvalid:s,hasCalendar:c}),c&&!i&&jsxs(DialogTrigger,{isOpen:p,onOpenChange:g,children:[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-secondary hover:text-text-primary transition-colors","aria-label":"Open calendar",children:jsx(I,{name:"Calendar",size:18})}),jsx(Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsx(Dialog,{className:"p-4 outline-none",children:jsx(Wn,{value:m.value,onChange:f,minValue:m.minValue,maxValue:m.maxValue,isDisabled:i,isReadOnly:m.isReadOnly,isDateUnavailable:m.isDateUnavailable})})})]})]})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(pe,{size:o,children:r}):typeof r=="function"&&u?jsx(pe,{size:o,children:r(u)}):t?jsx(Se,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&u?jsx(pe,{size:o,className:"mt-1",children:r(u)}):t?jsx(Se,{size:o,className:"mt-1",children:t}):null})]})}function BN({isPlaceholder:e,isDisabled:t,size:r="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[r],e?"text-text-disabled italic":"text-text-primary",t?"text-text-disabled cursor-not-allowed":"cursor-text",!t&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function ei({size:e="md",isDisabled:t,isInvalid:r,hasCalendar:o,className:n,...a}){return jsx(DateInput,{className:twMerge(xo({isInvalid:r,isDisabled:t}),"px-3 py-2 flex items-center gap-0.5 w-full",o&&"pr-10",n),...a,children:i=>jsx(DateSegment,{segment:i,className:BN({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||t,size:e})})})}function UN({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-primary group-hover:bg-background-muted group-pressed:bg-background-muted",middle:["bg-background-selected group-hover:bg-background-muted forced-colors:group-hover:bg-[Highlight]","group-invalid:group-hover:bg-feedback-error-background forced-colors:group-invalid:group-hover:bg-[Mark]","group-pressed:bg-background-muted forced-colors:group-pressed:bg-[Highlight] forced-colors:text-[HighlightText]","group-invalid:group-pressed:bg-feedback-error-background forced-colors:group-invalid:group-pressed:bg-[Mark]"].join(" "),cap:"bg-action-default text-[color:var(--color-action-default-text)] group-invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:group-invalid:bg-[Mark] forced-colors:text-[HighlightText]"},n=t?"text-text-disabled forced-colors:text-text-disabled font-light":"";return [r,o[e],n].filter(Boolean).join(" ")}function _n({errorMessage:e,...t}){return jsxs(RangeCalendar,{...t,children:[jsx(ws,{}),jsxs(CalendarGrid,{className:"w-full border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Ns,{}),jsx(CalendarGridBody,{children:r=>jsx(CalendarCell,{date:r,className:"selection-start:rounded-s-full selection-end:rounded-e-full [td:last-child_&]:rounded-e-end group h-9 w-9 cursor-default text-sm border-0 outside-month:text-text-disabled invalid:selected:bg-feedback-error-background forced-colors:selected:bg-[Highlight] forced-colors:selected:text-[HighlightText] forced-colors:invalid:selected:bg-[Mark] [td:first-child_&]:rounded-s-full [&]:border-0",children:({formattedDate:o,isSelected:n,isSelectionStart:a,isSelectionEnd:i,isFocusVisible:s,isDisabled:c})=>jsx("span",{className:UN({selectionState:n&&(a||i)?"cap":n?"middle":"none",isDisabled:c}),children:o})})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function rl({label:e,description:t,errorMessage:r,...o}){return jsxs(DateRangePicker,{...o,className:Ce(o.className,"group flex flex-col gap-1"),children:[e&&jsx(Me,{children:e}),jsxs(Gf,{className:"w-auto min-w-[208px]",children:[jsx(ei,{slot:"start",className:"px-2 py-1.5 text-sm"}),jsx("span",{"aria-hidden":"true",className:"text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] group-disabled:forced-colors:text-[GrayText]",children:"\u2013"}),jsx(ei,{slot:"end",className:"flex-1 px-2 py-1.5 text-sm"}),jsx(Q,{variant:"icon",className:"mr-1 w-6 rounded outline-offset-0",children:jsx(CalendarIcon,{"aria-hidden":true,className:"h-4 w-4"})})]}),t&&jsx(Se,{children:t}),typeof r=="string"?jsx(pe,{children:r}):null,jsx(Ze,{children:jsx(_n,{})})]})}var $N=e=>{let t=ht({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return twMerge(t,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function ti({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,transparent:i,validationResult:s,reserveErrorSpace:c=true,descriptionPlacement:l="below",...u}){let d=useId(),{isFocused:m,handleFocus:p,handleBlur:g}=sr();return jsx(NumberField,{...u,id:d,isRequired:a,className:Ce(u.className,"group flex flex-col gap-1"),step:u.step??1,onChange:f=>{typeof f=="number"&&(u.maxValue!=null&&f>u.maxValue?u.onChange?.(u.maxValue):u.minValue!=null&&f<u.minValue?u.onChange?.(u.minValue):u.onChange?.(f));},isInvalid:!!r||typeof u.value=="number"&&(u.maxValue!=null&&u.value>u.maxValue||u.minValue!=null&&u.value<u.minValue),children:({isDisabled:f,isInvalid:b})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(Me,{size:o,tooltip:n,description:l==="tooltip"||l==="inline"?t:void 0,descriptionPlacement:l,isRequired:a,htmlFor:d,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:v=>p(v,u.onFocus),onBlur:v=>g(v,u.onBlur),className:$N({isInvalid:b||!!r,isDisabled:f,isFocused:m,transparent:i,size:o,className:typeof u.className=="string"?u.className:void 0})}),jsxs("div",{className:"absolute inset-y-[2px] right-[2px] flex flex-col divide-y divide-border-default border-l border-border-default overflow-hidden rounded-r-[calc(var(--control-border-radius)-2px)]",children:[jsx(Button,{slot:"increment",isDisabled:f,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(I,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:f,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(I,{name:"CaretDown",size:14})})]})]})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:r?jsx(pe,{size:o,children:typeof r=="function"?r(s):r}):t&&l==="below"?jsx(Se,{size:o,children:t}):null}):jsx(Fragment,{children:r?jsx(pe,{size:o,className:"mt-1",children:typeof r=="function"?r(s):r}):t&&l==="below"?jsx(Se,{size:o,className:"mt-1",children:t}):null})]})})}var Du={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 eT({isSelected:e,isDisabled:t,size:r="md"}){let o="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",n=Du[r].track,a=Oe,i="focus-visible:outline-action-primary",s="";return e?s="bg-action-primary forced-colors:!bg-[Highlight] group-pressed:bg-action-primary-hover":s="bg-border-input group-pressed:bg-border-focus",[o,n,a,i,s,t?"bg-background-muted forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function tT({isSelected:e,isDisabled:t,size:r="md"}){let o="transform rounded-full bg-background-surface outline-none shadow transition duration-200 ease-in-out",n=Du[r].handle;return [o,n,e?"translate-x-[100%]":"translate-x-0",t?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function ol({children:e,variant:t="primary",size:r="md",...o}){return jsx(Switch,{...o,className:Ce(o.className,`group flex items-center gap-2 ${Du[r].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:n=>jsxs(Fragment,{children:[jsx("div",{className:eT({...n,size:r}),children:jsx("span",{className:tT({...n,size:r})})}),e]})})}function Gb(e){return new Intl.NumberFormat("en-US").format(e)}function Ub({isOpen:e,onClose:t,facetConfigs:r,facetCounts:o={},currentFilters:n,onApply:a,onClear:i,title:s="Filters",resultCount:c}){let[l,u]=useState(n),[d,m]=useState({}),[p,g]=useState({}),[f,b]=useState(null),{isMobile:x}=Pt(),v=useMemo(()=>r.some(h=>h.group),[r]),{groups:C,ungroupedFacets:y,facetsByGroup:S}=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]);useEffect(()=>{e&&(u(n),m({}),g({}),b(!x&&C.length>0?C[0]:null));},[e,n,C,x]);let k=useMemo(()=>!l||_s(l)?0:ln(l).length,[l]),R=()=>{a(l),t();},E=()=>{let h=$a();u(h),i?i():a(h),t();},D=h=>{if(!l)return [];if(!ln(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},L=(h,O,H)=>{let j=sn(l,h);O!==void 0&&(j=ko(j,{field:h,operator:"gte",value:O})),H!==void 0&&(j=ko(j,{field:h,operator:"lte",value:H})),u(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},A=(h,O)=>{let H=sn(l,h);O!==void 0&&(H=ko(H,{field:h,operator:"eq",value:O})),u(H);},N=(h,O,H)=>{let j=sn(l,h);O&&(j=ko(j,{field:h,operator:"gte",value:O.toString()})),H&&(j=ko(j,{field:h,operator:"lte",value:H.toString()})),u(j);},T=h=>{let O=S[h]||[],H=l?ln(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-text-link-default",K=h=>jsx("span",{className:F,children:h}),X=h=>{let O=o[h.field]||{},H=d[h.field]||"",j=[];h.values?j=h.values.map(Z=>({value:String(Z.value),label:Z.label,count:O[String(Z.value)]})):j=Object.entries(O).map(([Z,ne])=>({value:Z,label:Z,count:ne}));let oe=j.length;if(H){let Z=H.toLowerCase();j=j.filter(ne=>ne.label.toLowerCase().includes(Z));}j.sort((Z,ne)=>Z.count!==void 0&&ne.count!==void 0&&ne.count!==Z.count?ne.count-Z.count:Z.label.localeCompare(ne.label));let me=h.type||"string";if(me==="string"||!h.type){let Z=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 jsxs(Co,{id:h.field,children:[jsx(So,{title:h.label,description:h.description,className:z,endContent:Z.length>0?K(`${Z.length} selected`):void 0}),jsx(wo,{className:W,children:jsxs("div",{className:"space-y-4 pt-4 pb-4",children:[oe>ne&&jsx(cn,{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"}),jsx(tu,{value:Z,onChange:$=>{let se=sn(l,h.field);$.length>0&&(se=ko(se,{field:h.field,operator:"in",value:$})),u(se);},children:jsx("div",{className:"space-y-1.5",children:ue.map($=>jsx("div",{className:"rounded-md py-2 pr-4 transition-colors hover:bg-background-hover",children:jsx(_o,{value:$.value,children:jsxs("div",{className:"flex items-center justify-between gap-3 flex-1",children:[h.renderLabel?h.renderLabel($.value,$.label):jsx("span",{className:"text-sm font-medium text-text-primary",children:$.label}),$.count!==void 0&&jsx("span",{className:"text-xs font-medium text-text-secondary tabular-nums",children:Gb($.count)})]})})},$.value))})}),ge&&jsx("div",{className:"pt-2 border-t border-border-muted",children:jsxs(Q,{variant:"ghost",size:"sm",onPress:()=>g($=>({...$,[h.field]:true})),className:"w-full",children:["Show all ",j.length," options"]})}),ie&&j.length>Te&&jsx("div",{className:"pt-2 border-t border-border-muted",children:jsx(Q,{variant:"ghost",size:"sm",onPress:()=>g($=>({...$,[h.field]:false})),className:"w-full",children:"Show less"})})]})})]},h.field)}if(me==="number"){let Z,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"&&(Z=ge.value),ge.operator==="lte"&&typeof ge.value=="number"&&(ne=ge.value));};Te(l);let ie=Z!==void 0||ne!==void 0;return jsxs(Co,{id:h.field,children:[jsx(So,{title:h.label,description:h.description,className:z,endContent:ie?K(Z!==void 0&&ne!==void 0?`${Z} - ${ne}`:Z!==void 0?`\u2265 ${Z}`:`\u2264 ${ne}`):void 0}),jsx(wo,{className:W,children:jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 pb-4",children:[jsx(ti,{label:"Min",value:Z,onChange:ue=>L(h.field,ue,ne)},`${h.field}-min`),jsx(ti,{label:"Max",value:ne,onChange:ue=>L(h.field,Z,ue)},`${h.field}-max`)]})})]},h.field)}if(me==="boolean"){let Z=V(h.field);return jsxs(Co,{id:h.field,children:[jsx(So,{title:h.label,description:h.description,className:z,endContent:Z!==void 0?K(Z?"Yes":"No"):void 0}),jsx(wo,{className:W,children:jsxs("div",{className:"flex items-center justify-between pt-4 pb-4",children:[jsx("span",{className:"text-sm font-medium text-text-primary",children:Z!==void 0?Z?"Enabled":"Disabled":"No filter applied"}),jsx(ol,{size:"lg",isSelected:Z??false,onChange:ne=>A(h.field,ne?true:void 0),children:Z?"Yes":"No"})]})})]},h.field)}if(me==="date"){let Z,ne,Te=se=>{if(se)for(let Ne of se.conditions)"conditions"in Ne?Te(Ne):Ne.field===h.field&&(Ne.operator==="gte"&&(Z=String(Ne.value)),Ne.operator==="lte"&&(ne=String(Ne.value)));};Te(l);let ie=Z!==void 0||ne!==void 0,ue=se=>{if(se)try{return /^\d{4}-\d{2}-\d{2}$/.test(se)?Fa(se):void 0}catch{return}},ge=ue(Z),$=ue(ne);return jsxs(Co,{id:h.field,children:[jsx(So,{title:h.label,description:h.description,className:z,endContent:ie?K("Date range selected"):void 0}),jsx(wo,{className:W,children:jsx("div",{className:"pt-4 pb-4",children:jsx(rl,{label:"Date Range",value:ge&&$?{start:ge,end:$}:void 0,onChange:se=>{se?N(h.field,se.start,se.end):N(h.field,void 0,void 0);}})})})]},h.field)}return null},G=()=>jsxs("div",{className:"flex flex-col",children:[y.map(h=>{let H=(l?ln(l):[]).includes(h.field);return 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:[jsx("span",{className:"text-sm font-medium text-text-primary",children:h.label}),jsxs("div",{className:"flex items-center gap-2",children:[H&&jsx("span",{className:F,children:"1 active"}),jsx(I,{name:"CaretRight",size:"sm",className:"text-text-secondary"})]})]},h.field)}),C.map(h=>{let O=T(h);return 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:[jsx("span",{className:"text-sm font-medium text-text-primary",children:h}),jsxs("div",{className:"flex items-center gap-2",children:[O>0&&jsxs("span",{className:F,children:[O," active"]}),jsx(I,{name:"CaretRight",size:"sm",className:"text-text-secondary"})]})]},h)})]}),Y=h=>{if(h.startsWith("__ungrouped__")){let H=h.replace("__ungrouped__",""),j=y.find(oe=>oe.field===H);return j?jsx(Gn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[j.field],children:X(j)}):null}let O=S[h]||[];return O.length===0?null:jsx(Gn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[O[0].field],children:O.map(H=>X(H))})},P=()=>{if(f){let h=f.startsWith("__ungrouped__")&&y.find(O=>O.field===f.replace("__ungrouped__",""))?.label||f;return jsxs("div",{className:"flex flex-col h-full",children:[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:[jsx(I,{name:"CaretLeft",size:"sm",className:"text-text-secondary"}),jsx("span",{className:"text-sm font-medium text-text-primary",children:h})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:Y(f)})]})}return G()},w=()=>jsxs("div",{className:"flex h-full",children:[jsxs("div",{className:"w-48 flex-shrink-0 border-r border-border-muted overflow-y-auto bg-background-muted/30",children:[y.map(h=>{let H=(l?ln(l):[]).includes(h.field),j=f===`__ungrouped__${h.field}`;return 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-background-selected":"hover:bg-background-hover"}`,children:[jsx("span",{className:`text-sm truncate ${j?"font-semibold text-text-primary":"font-medium text-text-primary"}`,children:h.label}),H&&jsx("span",{className:"w-2 h-2 rounded-full bg-action-primary flex-shrink-0 ml-2"})]},h.field)}),C.map(h=>{let O=T(h),H=f===h;return 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-background-selected":"hover:bg-background-hover"}`,children:[jsx("span",{className:`text-sm truncate ${H?"font-semibold text-text-primary":"font-medium text-text-primary"}`,children:h}),O>0&&jsx("span",{className:"w-2 h-2 rounded-full bg-action-primary flex-shrink-0 ml-2"})]},h)})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:f?Y(f):jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-sm",children:"Select a category to view filters"})})]}),B=()=>jsx(Gn,{variant:"contained",density:"comfortable",showDividers:true,defaultExpandedKeys:[r[0].field],children:r.map(h=>X(h))});return jsx(rr,{isOpen:e,onClose:t,title:v&&x&&f?f.startsWith("__ungrouped__")?y.find(h=>h.field===f.replace("__ungrouped__",""))?.label||s:f:k>0?`${s} (${k} active)`:s,hideCloseIcon:false,primaryAction:{label:"Apply filters",onPress:R,variant:"primary"},secondaryAction:{label:"Clear all",onPress:E},maxWidth:v?"800px":"700px",height:"600px",mobileHeight:"85vh",contentPadding:false,footerContent:c!==void 0?jsxs("div",{className:"text-sm text-text-secondary text-center",children:[jsx("span",{className:"font-semibold text-text-primary",children:Gb(c)})," ",c===1?"result":"results"," with current filters"]}):void 0,children:r.length===0?jsx("div",{className:"py-12 text-center",children:jsx("div",{className:"text-sm font-medium text-text-secondary",children:"No filters available"})}):v?x?P():w():B()})}function Eu(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 cr(e="normal",t){return twMerge({strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[e],t&&"hover:text-action-primary cursor-pointer transition-colors")}function ke(e="left",t){return twMerge("flex items-center gap-1 min-w-0 overflow-hidden",Eu(e),t)}function il(e,t="\u2014"){return e==null||e===""?t:String(e)}var Po={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 Ht(e="normal"){return {strong:Po.lg,high:Po.lg,normal:Po.md,low:Po.sm}[e]}function ye(e,t){return typeof e=="function"?e(t):e}function Yb(e="neutral",t="sm"){return twMerge("inline-flex items-center rounded-full font-medium",t==="sm"?"px-2 py-0.5 text-xs":"px-2.5 py-1 text-sm",{success:"bg-feedback-success-background text-feedback-success-text",error:"bg-feedback-error-background text-feedback-error-text",warning:"bg-feedback-warning-background text-feedback-warning-text",info:"bg-feedback-info-background text-feedback-info-text",neutral:"bg-background-muted text-text-secondary"}[e])}function Kb(e){return e?"success":"neutral"}function sl(e,t=false){return t?e>0?"text-feedback-success-text":e<0?"text-feedback-error-text":"text-text-primary":"text-text-primary"}function Lu(e="hover",t="secondary"){let r={primary:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",secondary:"text-text-link-default hover:text-text-link-hover visited:text-text-link-default",default:"text-text-link-default hover:text-text-link-hover visited:text-text-link-default",brand:"text-action-primary hover:text-action-primary-hover visited:text-action-primary",muted:"text-text-secondary hover:text-text-secondary visited:text-text-secondary",unstyled:""},o={visible:"underline underline-offset-4 decoration-1 cursor-pointer",hover:"hover:underline hover:underline-offset-4 hover:decoration-1 cursor-pointer transition-colors",none:"cursor-pointer"},n=r[t],a=o[e]||"";return `${n} ${a}`.trim()}function zr(e,t,r,o="hover",n="secondary",a,i){if(!t)return e;let s=typeof t=="function"&&r?t(r):t,c=Lu(o,n);return jsx("a",{href:s,className:twMerge(c,a==="strong"||a==="high"?"font-semibold":"",i),onClick:u=>{u.metaKey||u.ctrlKey;},children:e})}function Jb({row:e,context:t,actions:r,align:o="right",size:n="sm"}){let{isLoading:a}=t;if(a)return jsx(J,{className:Po.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 jsx("div",{className:c,children:s.map(l=>{let u=ye(l.disabled,e);return l.variant==="icon"||!l.label?jsx(Q,{variant:"icon",size:n,onPress:()=>{l.onClick(e);},isDisabled:u,"aria-label":l.label||l.id,children:jsx(I,{name:l.icon||"DotsThree",size:n==="sm"?16:20})},l.id):jsxs(Q,{variant:l.variant||"secondary",size:n,onPress:()=>{l.onClick(e);},isDisabled:u,children:[l.icon&&jsx(I,{name:l.icon,size:n==="sm"?14:16}),l.label]},l.id)})})}function qb({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:u="left",emptyText:d="\u2014",className:m,maxVisible:p=2,maxLabelLength:g}){let{isLoading:f}=r,b=(k,R)=>{if(!g||k.length<=g)return jsx(Fragment,{children:k});let E=k.slice(0,g-1)+"\u2026";return jsx(Lt,{content:R,children:jsx("span",{children:E})})};if(f)return jsx(J,{className:Ht("normal")});if(e==null||e==="")return jsx("div",{className:ke(u,"text-text-secondary"),children:d});if(Array.isArray(e)&&e.length===0)return jsx("div",{className:ke(u,"text-text-secondary"),children:d});let x=ke(u,m);if(Array.isArray(e)){let k=e.slice(0,p),R=e.slice(p),E=R.length>0;return jsx("div",{className:x,children:jsxs("div",{className:"flex items-center gap-1",children:[k.map((D,L)=>{let V=typeof o=="function"?o(D,t):o,A=typeof n=="function"?n(D,t):n!==void 0?n:String(D),N=typeof s=="function"?s(D,t):s,T=typeof l=="function"?l(D,t):l;return jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsx(Je,{variant:V,size:a,shape:i,dot:N,dotPosition:c,dotPulse:T,children:b(A,A)})},L)}),E&&jsx(Lt,{content:R.join(", "),children:jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:jsxs(Je,{variant:"neutral",size:a,shape:i,children:["+",R.length]})})})]})})}let v=typeof o=="function"?o(e,t):o,C=typeof n=="function"?n(e,t):n!==void 0?n:String(e),y=typeof s=="function"?s(e,t):s,S=typeof l=="function"?l(e,t):l;return jsx("div",{className:x,children:jsx(Je,{variant:v,size:a,shape:i,dot:y,dotPosition:c,dotPulse:S,children:b(C,C)})})}function Zb({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:u}){let{isLoading:d}=t;if(d)return jsx(J,{className:Ht(l)});let m=!!e;if(!m&&!s)return jsx("div",{className:ke(c,u)});let p=ke(c,u);switch(r){case "icon":return jsx("div",{className:p,children:jsx(I,{name:m?a:i,size:16,className:m?"text-feedback-success-text":"text-text-disabled"})});case "text":return jsx("div",{className:p,children:jsx("span",{className:cr(l),children:m?o:n})});case "badge":return jsx("div",{className:p,children:jsx(Je,{variant:m?"success":"neutral",size:"sm",children:m?o:n})});default:return null}}function $b({row:e,context:t,firstName:r,lastName:o,email:n,avatarUrl:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:u="secondary",showEmail:d=false,badge:m,emphasis:p="normal",align:g="left",className:f,piiEntity:b}){let{isLoading:x}=t,v=ye(r,e),C=ye(o,e),y=ye(n,e),S=ye(a,e),k=ye(c,e),R=typeof m=="function"?m(e):m,E=ye(b,e),D=ke(g,f);return jsx("div",{className:D,children:jsx(Ps,{firstName:v,lastName:C,email:y,avatarUrl:S,layout:i,size:s,href:k,LinkComponent:l,linkVariant:u,showEmail:d,badge:R,emphasis:p,isLoading:x,piiEntity:E})})}function Qb({value:e,row:t,context:r,render:o,className:n}){let a=o(e,t,r);return jsx("div",{className:twMerge("h-full w-full",n),children:a})}function _b({value:e,row:t,context:r,format:o="date",customFormat:n,emptyText:a="\u2014",align:i="left",emphasis:s="normal",href:c,linkBehavior:l="hover",className:u}){let{isLoading:d}=r;if(d)return jsx(J,{className:Ht(s)});if(!e)return jsx("div",{className:ke(i,"text-text-secondary"),children:a});let m=e instanceof Date?e:new Date(e);if(isNaN(m.getTime()))return jsx("div",{className:ke(i,"text-text-secondary"),children:a});let p;switch(o){case "date":p=m.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});break;case "time":p=m.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});break;case "datetime":p=m.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});break;case "relative":p=uT(m);break;case "custom":p=n?m.toLocaleString("en-US",n):m.toISOString();break;default:p=m.toLocaleDateString();}let g=ke(i,twMerge(cr(s),u)),f=ye(c,t);return f?jsx("div",{className:g,children:zr(p,f,t,l)}):jsx("div",{className:g,children:p})}function uT(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 ll({manufacturer:e,model:t,deviceType:r,deviceTypeIconName:o,logoUrl:n,layout:a="stacked",size:i="md",href:s,LinkComponent:c,linkVariant:l="unstyled",showDeviceTypeIcon:u=true,showLogo:d=true,emphasis:m="normal",isLoading:p=false,className:g,piiEntity:f}){let[b,x]=useState(false),v=o||(r?mT(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],S=n&&!b&&d,R={strong:"font-semibold text-text-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[m],E=({children:D,className:L})=>s?c?jsx(c,{href:s,className:L,children:D}):jsx(Ue,{href:s,variant:l,className:twMerge("hover:underline",L),asButton:false,children:D}):jsx("span",{className:L,children:D});if(p)return a==="inline"?jsxs("div",{className:twMerge("flex items-center",y.gap,g),children:[jsx(J,{width:y.skeletonIcon,height:y.skeletonIcon,className:"flex-shrink-0 rounded"}),jsx(J,{width:y.skeletonText,height:y.skeletonIcon*.6})]}):jsxs("div",{className:twMerge("flex items-center",y.gap,g),children:[jsx(J,{width:y.skeletonIcon,height:y.skeletonIcon,className:"flex-shrink-0"}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx(J,{width:y.skeletonText,height:16}),jsx(J,{width:y.skeletonSecondary,height:12})]})]});if(a==="inline"){let D=`${e} ${t}`;return jsxs("div",{className:twMerge("flex items-center",y.gap,g),children:[jsx("div",{className:twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",y.logoSize),children:S?jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>x(true)}):jsx(I,{name:v,size:y.iconSize*.6,className:"text-text-secondary"})}),jsx(E,{className:twMerge("truncate leading-normal hover:text-text-primary",R,y.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:D})})]})}return jsxs("div",{className:twMerge("flex items-center justify-start",y.gap,g),children:[d&&jsx("div",{className:twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",y.logoSize),children:S?jsx("img",{src:n,alt:`${e} logo`,className:"w-full h-full object-contain",onError:()=>x(true)}):jsx(I,{name:v,size:y.iconSize*.6,className:"text-text-secondary"})}),jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsx(E,{className:twMerge("truncate leading-normal hover:text-text-primary",R,y.textSize,s&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:e})}),jsxs("div",{className:twMerge("flex items-center gap-1.5 text-text-secondary leading-normal",y.secondaryTextSize),children:[u&&jsx(I,{name:v,size:y.iconInTextSize,className:"flex-shrink-0"}),jsx("span",{className:"truncate","data-pii-type":f?"device-name":void 0,"data-pii-entity":f,children:t})]})]})]})}function mT(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 tx({row:e,context:t,manufacturer:r,model:o,deviceType:n,logoUrl:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:u="secondary",showDeviceTypeIcon:d=true,showLogo:m=true,emphasis:p="normal",align:g="left",className:f,piiEntity:b}){let{isLoading:x}=t,v=ye(r,e),C=ye(o,e),y=ye(n,e),S=ye(a,e),k=ye(c,e),R=ye(b,e),E=ke(g,f);return jsx("div",{className:E,children:jsx(ll,{manufacturer:v,model:C,deviceType:y,logoUrl:S,layout:i,size:s,href:k,LinkComponent:l,linkVariant:u,showDeviceTypeIcon:d,showLogo:m,emphasis:p,isLoading:x,piiEntity:R})})}var fG={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},fT=["charging","discharging","heat","cool","on","connected"],gT={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 Au(e){return fT.includes(e)}function Iu(e){return gT[e]}function un({state:e,label:t,icon:r,isLoading:o,size:n="sm",shape:a="pill",dot:i,dotPulse:s,fixedWidth:c,className:l,...u}){if(o)return jsx(J,{className:"inline-flex h-6 w-20"});let d=t??Iu(e),m=Au(e);return jsxs(Je,{variant:e,size:n,shape:a,dot:i??m,dotPulse:s??m,className:c?`w-28 justify-center ${l||""}`:l,...u,children:[r&&jsx(I,{name:r,size:n==="sm"?12:n==="md"?14:16}),d]})}var xT={importing:"Importing",exporting:"Exporting"};function ox(e){return xT[e]}function dl({state:e,label:t,showIcon:r=false,isLoading:o,size:n="sm",shape:a="pill",fixedWidth:i,className:s,...c}){if(o)return jsx(J,{className:"inline-flex h-6 w-24"});let l=t??ox(e),u=e==="exporting"?"ArrowUp":"ArrowDown",d=n==="sm"?12:n==="md"?14:16;return r?jsx(Je,{variant:e,size:n,shape:a,className:`w-6 justify-center ${s||""}`,...c,children:jsx(I,{name:u,size:d})}):jsx(Je,{variant:e,size:n,shape:a,className:i?`w-28 justify-center ${s||""}`:s,...c,children:l})}function ul({state:e,stateLabel:t,metric:r,metricFormatter:o,secondaryState:n,layout:a="horizontal",isLoading:i,size:s="sm",shape:c="pill",icon:l,fixedWidth:u,secondaryStateIconOnly:d=false,className:m}){if(i)return jsx(J,{className:twMerge("inline-flex h-6 w-32",m)});let p=r!=null&&o?Oo(r,o):null,g=a==="horizontal",f=o&&!p;return jsxs("div",{className:twMerge("inline-flex items-center",g?"gap-2":"flex-col gap-1",m),children:[(p||f)&&jsx("span",{className:twMerge("font-medium inline-block",p?"text-text-primary":"text-text-secondary",s==="sm"&&"text-xs min-w-12",s==="md"&&"text-sm min-w-14",s==="lg"&&"text-base min-w-16"),children:p||"\u2014"}),jsx(un,{state:e,label:t,icon:l,size:s,shape:c,fixedWidth:u}),n&&jsx(Fragment,{children:n==="importing"||n==="exporting"?jsx(dl,{state:n,size:s,shape:c,fixedWidth:u,showIcon:d}):jsx(un,{state:n,size:s,shape:c,fixedWidth:u})})]})}function nx({value:e,row:t,context:r,metric:o,metricFormatter:n,secondaryState:a,size:i="sm",shape:s="pill",label:c,icon:l,fixedWidth:u=true,align:d="left",compact:m=false,className:p}){let{isLoading:g}=r;if(g){let y={pill:"rounded-full",rounded:"rounded-lg",square:"rounded-sm"}[s],S=o!=null||n!=null;return jsx("div",{className:"flex items-center gap-2",children:S?jsxs(Fragment,{children:[jsx(J,{className:"h-4 w-12"}),jsx(J,{className:`h-6 w-24 ${y}`}),jsx(J,{className:`h-6 w-20 ${y}`})]}):jsx(J,{className:`h-6 w-24 ${y}`})})}if(!e)return jsx("div",{className:ke(d,p),children:jsx("span",{className:"text-text-secondary",children:"\u2014"})});let f=ye(o,t),b=ye(a,t),x=typeof c=="function"?c(e,t):c,v=ke(d,p);return f!=null||n?jsx("div",{className:twMerge(v),children:jsx(ul,{state:e,stateLabel:x,metric:f,metricFormatter:n,secondaryState:b||void 0,size:i,shape:s,icon:l,fixedWidth:u,secondaryStateIconOnly:m,layout:"horizontal"})}):jsx("div",{className:v,children:jsx(un,{state:e,label:x,icon:l,size:i,shape:s,fixedWidth:u})})}function ix({value:e,row:t,context:r,formatter:o,align:n="left",emphasis:a="normal",href:i,linkBehavior:s="hover",className:c,emptyText:l="\u2014",emptyClassName:u="text-text-secondary"}){let{isLoading:d}=r;if(d)return jsx(J,{className:Ht(a)});let m=kr({value:e,formatter:o,emptyText:l,emptyClassName:u}),p=cr(a),g=ke(n,twMerge(p,c)),f=jsx("div",{className:g,children:m}),b=ye(i,t);return b?zr(f,b,t,s):f}var Bu=Ee__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:u,segmentGap:d=2,barWidth:m,context:p})=>{let g=useMemo(()=>r===t?100:Math.max(0,Math.min(100,(e-t)/(r-t)*100)),[e,t,r]),f=useMemo(()=>o==="auto"&&a?a.type==="diverging"&&a.center!==void 0?wa(e,t,r,a.center,a.scheme):Sa(e,t,r,a.scheme):o,[o,a,e,t,r]);if(p.isLoading)return jsx("div",{className:"flex items-center gap-2 w-full",style:{height:c},children:jsx("div",{className:"h-full flex-1 animate-pulse bg-border-default rounded"})});if(u&&u>0){let v=`calc((100% - ${d*(u-1)}px) / ${u})`,C=Math.ceil(g/100*u),y={height:c,...m&&{width:typeof m=="number"?`${m}px`:m,flexShrink:0}};return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:`flex gap-0.5 ${m?"":"flex-1"}`,style:y,children:Array.from({length:u}).map((S,k)=>{let R=k<C;return jsx("div",{className:"rounded-sm",style:{width:v,backgroundColor:R?f:n==="none"?"transparent":n,marginRight:k<u-1?`${d}px`:0}},k)})}),i&&jsx("span",{className:"text-sm text-text-primary 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 jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:`relative rounded-sm ${m?"":"flex-1"}`,style:b,children:jsx("div",{className:"absolute left-0 top-0 h-full rounded-sm",style:{width:`${g}%`,minWidth:g>0?l:0,backgroundColor:f}})}),i&&jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:s?s(e):e.toLocaleString()})]})});Bu.displayName="HorizontalBarCell";var Vu=Ee__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,u=a||100,d=i,{xScale:m,yScale:p,barWidth:g}=useMemo(()=>{if(s.length===0)return {xScale:scaleTime({range:[0,u],domain:[new Date,new Date]}),yScale:scaleLinear({range:[d,0],domain:[0,1]}),barWidth:2};let b=extent(s,R=>c(R)),x=min(s,R=>l(R))??0,v=max(s,R=>l(R))??0,C=x<0?x:0,y=scaleTime({range:[0,u],domain:b}),S=scaleLinear({range:[d,0],domain:[C,v*1.05]}),k=s.length>1?u/s.length*.8:8;return {xScale:y,yScale:S,barWidth:Math.max(2,k)}},[s,u,d]);if(n.isLoading)return jsx("div",{className:"flex items-center gap-0.5",style:{width:u,height:d},children:Array.from({length:5}).map((b,x)=>jsx("div",{className:"flex-1 animate-pulse bg-border-default rounded"},x))});if(!s||s.length===0)return jsx("div",{className:"flex items-center justify-center text-text-secondary text-xs",style:{width:u,height:d},children:"No data"});let f=p(0);return jsx("svg",{width:u,height:d,children:s.map((b,x)=>{let v=l(b),C=m(c(b)),y=p(v),S=Math.abs(f-y),k=b.category&&o?.[b.category]?o[b.category]:r;return jsx(Bar,{x:C-g/2,y:v>=0?y:f,width:g,height:S,fill:k,rx:1},`bar-${x}`)})})});Vu.displayName="MiniBarCell";function ux({value:e,row:t,context:r,format:o="number",decimals:n=0,prefix:a,suffix:i,emptyText:s="\u2014",align:c="right",emphasis:l="normal",href:u,linkBehavior:d="hover",showPositiveSign:m=false,colorCode:p=false,className:g}){let{isLoading:f}=r;if(f)return jsx(J,{className:Ht(l)});if(e==null||isNaN(Number(e)))return jsx("div",{className:ke(c,"text-text-secondary"),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 C=`${m&&b>0?"+":""}${x}`,y=p?sl(b,true):cr(l),S=ke(c,twMerge(y,g)),k=jsxs(Fragment,{children:[a&&jsx("span",{className:"text-text-secondary",children:a}),jsx("span",{children:C}),i&&jsx("span",{className:"text-text-secondary",children:i})]}),R=ye(u,t);return R?jsx("div",{className:S,children:zr(k,R,t,d)}):jsx("div",{className:S,children:k})}var zu=Ee__default.memo(({value:e,showLabel:t=true,color:r="var(--color-viz-categorical-1)",backgroundColor:o="var(--color-background-muted)",height:n=20,segments:a,segmentGap:i=2,colorScale:s,context:c})=>{let l=useMemo(()=>Math.max(0,Math.min(100,e)),[e]),u=useMemo(()=>r==="auto"&&s?s.type==="diverging"&&s.center!==void 0?wa(e,0,100,s.center,s.scheme):Sa(e,0,100,s.scheme):r,[r,s,e]);if(c.isLoading)return jsx("div",{className:"flex items-center gap-2",style:{height:n},children:jsx("div",{className:"h-full w-full animate-pulse bg-border-default rounded"})});if(a&&a>0){let m=`calc((100% - ${i*(a-1)}px) / ${a})`,p=Math.ceil(l/100*a);return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:"flex gap-0.5 flex-1",style:{height:n},children:Array.from({length:a}).map((g,f)=>{let b=f<p,x=u;if(r==="auto"&&s&&b){let v=(f+1)/a*100;s.type==="diverging"&&s.center!==void 0?x=wa(v,0,100,s.center,s.scheme):x=Sa(v,0,100,s.scheme);}return jsx("div",{className:"rounded-sm",style:{width:m,backgroundColor:b?x:o==="none"?"transparent":o,marginRight:f<a-1?`${i}px`:0}},f)})}),t&&jsxs("span",{className:"text-sm text-text-primary whitespace-nowrap",children:[l.toFixed(0),"%"]})]})}return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:"relative flex-1 rounded-sm",style:{height:n,backgroundColor:o==="none"?"transparent":o},children:jsx("div",{className:"absolute left-0 top-0 h-full rounded-sm transition-all duration-300",style:{width:`${l}%`,backgroundColor:u}})}),t&&jsxs("span",{className:"text-sm text-text-primary whitespace-nowrap",children:[l.toFixed(0),"%"]})]})});zu.displayName="PercentBarCell";function mx({row:e,context:t,isSelected:r=false,onSelect:o,isDisabled:n=false,align:a="center"}){let{isLoading:i}=t;if(i)return jsx("div",{className:ke(a),children:jsx(J,{className:"h-4 w-4 rounded"})});let s=ye(n,e),c=ke(a);return jsx("div",{className:c,children:jsx(_o,{isSelected:r,onChange:l=>{o?.(e,l);},isDisabled:s,"aria-label":"Select row"})})}function fl({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:u=false,className:d,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-primary",high:"font-semibold text-text-primary",normal:"text-text-primary",low:"text-text-secondary"}[l],x=[];t&&x.push(t),r&&o?x.push(`${r} ${o}`):r?x.push(r):o&&x.push(o);let v=x.join(", "),C=({children:S,className:k})=>i?s?jsx(s,{href:i,className:k,children:S}):jsx(Ue,{href:i,variant:c,className:twMerge("hover:underline",k),asButton:false,children:S}):jsx("span",{className:k,children:S});if(u)return n==="inline"?jsxs("div",{className:twMerge("flex items-center",g.gap,d),children:[jsx(J,{width:g.skeletonIconInline,height:g.skeletonIconInline,className:"flex-shrink-0 rounded"}),jsx(J,{width:g.skeletonText,height:g.skeletonIconInline*.8})]}):jsxs("div",{className:twMerge("flex items-center",g.gap,d),children:[jsx(J,{width:g.skeletonIconStacked,height:g.skeletonIconStacked,className:"flex-shrink-0 rounded"}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx(J,{width:g.skeletonText,height:16}),jsx(J,{width:g.skeletonSecondary,height:12})]})]});if(n==="inline")return jsxs(C,{className:twMerge("flex items-center",g.gap,i&&"hover:bg-background-hover transition-colors",d),children:[jsx(I,{name:"MapPin",size:g.iconSize,className:"text-text-secondary flex-shrink-0"}),jsx("span",{className:twMerge("leading-normal truncate hover:text-text-primary",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 y=()=>{if(m){if(t&&r&&o)return "city-state-zip";if(t&&r)return "city-state";if(t)return "city";if(r)return "state";if(o)return "postal-code"}};return jsxs("div",{className:twMerge("flex items-center justify-start",g.gap,d),children:[jsx("div",{className:twMerge("flex-shrink-0 flex items-center justify-center rounded border border-border-muted",g.iconContainerSize),children:jsx(I,{name:"MapPin",size:g.iconSize,className:"text-text-secondary"})}),jsxs("div",{className:"flex flex-col items-start min-w-0",children:[jsx(C,{className:twMerge("leading-normal truncate hover:text-text-primary",b,g.textSize,i&&"hover:underline hover:decoration-1 hover:underline-offset-4"),children:jsx("span",{"data-pii-type":m?"address":void 0,"data-pii-entity":m,children:e})}),v&&jsx("div",{className:twMerge("text-text-secondary leading-normal truncate",g.secondaryTextSize),"data-pii-type":y(),"data-pii-entity":m,children:v})]})]})}function gx({row:e,context:t,streetAddress:r,city:o,state:n,postalCode:a,layout:i="stacked",size:s="sm",href:c,LinkComponent:l,linkVariant:u="secondary",emphasis:d="normal",align:m="left",className:p,piiEntity:g}){let{isLoading:f}=t,b=ye(r,e),x=ye(o,e),v=ye(n,e),C=ye(a,e),y=ye(c,e),S=ye(g,e),k=ke(m,p);return jsx("div",{className:k,children:jsx(fl,{streetAddress:b,city:x,state:v,postalCode:C,layout:i,size:s,href:y,LinkComponent:l,linkVariant:u,emphasis:d,isLoading:f,piiEntity:S})})}var Ou=Ee__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||[],u=s||100,d=c,{xScale:m,yScale:p}=useMemo(()=>{if(l.length===0)return {xScale:scaleTime({range:[0,u],domain:[new Date,new Date]}),yScale:scaleLinear({range:[d,0],domain:[0,1]})};let f=extent(l,C=>C.xValue),b=min(l,C=>C.yValue)||0,x=max(l,C=>C.yValue)||0,v=(x-b)*.1||1;return {xScale:scaleTime({range:[0,u],domain:f}),yScale:scaleLinear({range:[d,0],domain:[b-v,x+v]})}},[l,u,d]);if(i.isLoading)return jsx("div",{className:"flex items-center",style:{width:u,height:d},children:jsx("div",{className:"h-1 w-full animate-pulse bg-border-default rounded"})});if(!l||l.length===0)return jsx("div",{className:"flex items-center justify-center text-text-secondary text-xs",style:{width:u,height:d},children:"No data"});let g=a&&l[0]?.category&&a[l[0].category]?a[l[0].category]:o;return jsxs("svg",{width:u,height:d,className:"overflow-visible",children:[(r==="area"||r==="both")&&jsx(AreaClosed,{data:l,x:f=>m(f.xValue),y:f=>p(f.yValue),yScale:p,fill:g,fillOpacity:.15,curve:curveLinear}),(r==="line"||r==="both")&&jsx(LinePath,{data:l,x:f=>m(f.xValue),y:f=>p(f.yValue),stroke:g,strokeWidth:n,strokeLinecap:"round",curve:curveLinear})]})});Ou.displayName="SparklineCell";function yx({value:e,row:t,context:r,prefix:o,suffix:n,emptyText:a="\u2014",href:i,linkBehavior:s="hover",linkVariant:c="secondary",emphasis:l="normal",truncate:u=true,copyable:d=false,align:m="left",className:p,piiType:g,piiEntity:f}){let{isLoading:b}=r;if(b)return jsx(J,{className:Ht(l)});let x=il(e,a),v=ye(i,t),C=ye(f,t),y=x,S=false,k=false;if(u&&x&&typeof x=="string")if(typeof u=="boolean")k=true;else {let{position:T="end",length:z=16,ellipsis:W="...",tooltip:F=true}=u;if(x.length>z){switch(T){case "start":y=Wi(x,z);break;case "middle":y=An(x,z);break;case "end":y=Gi(x,z,W);break}S=F;}}let R=g&&C?{"data-pii-type":g,"data-pii-entity":C}:{},E=Object.keys(R).length>0,D=jsx("span",{className:k?"truncate":"",...R,children:y}),L=S?jsx(Lt,{content:E?jsx("span",{...R,children:String(x)}):String(x),children:D}):D,V=jsxs(Fragment,{children:[o&&jsx("span",{className:"text-text-secondary",children:o}),L,n&&jsx("span",{className:"text-text-secondary",children:n})]}),A=V;if(d&&x&&x!==a){let T=typeof d=="function"?d(t):String(x);A=jsx(ho,{value:T,size:"sm",children:V});}if(v){let T=ke(m,p);return jsx("div",{className:T,children:zr(A,v,t,s,c,l)})}let N=ke(m,twMerge(cr(l),p));return jsx("div",{className:N,children:A})}var JT={sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"},jT={sm:"hidden sm:grid",md:"hidden md:grid",lg:"hidden lg:grid",xl:"hidden xl:grid"};function gl(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function bl(e,t,r,o){if(r.cell){let n=r.cell,a=typeof r.cellProps=="function"?r.cellProps(e,t):r.cellProps;return jsx(n,{value:e,row:t,context:o,...a})}return r.render?r.render(e,t,o):e?.toString()??"\u2014"}function hl({row:e,columns:t,density:r,isLoading:o,onClick:n}){let a=t.filter(d=>d.mobile!==false).map(d=>{let m=d.mobile===false?null:d.mobile;return {...d,mobilePriority:m?.priority??2,mobileFormat:m?.format??"secondary",showLabel:m?.label??m?.format==="secondary",icon:m?.icon}}).sort((d,m)=>d.mobilePriority-m.mobilePriority),i=a.filter(d=>d.mobilePriority===1||d.mobileFormat==="primary"),s=a.filter(d=>d.mobilePriority===2&&d.mobileFormat!=="primary"),c=a.filter(d=>d.mobileFormat==="badge"),l={isLoading:!!o,rowIndex:0,columnIndex:0,density:r};return jsxs("div",{className:twMerge("border-b border-border-default bg-background-surface transition-colors",n&&"cursor-pointer hover:bg-background-hover active:bg-background-pressed",{compact:"px-3 py-2",default:"px-4 py-3",relaxed:"px-4 py-4"}[r]),onClick:n,role:n?"button":void 0,tabIndex:n?0:void 0,children:[i.length>0&&jsxs("div",{className:"mb-2 flex items-start justify-between",children:[jsx("div",{className:"flex-1",children:i.map(d=>{let m=gl(e,d);return jsx("div",{className:"font-medium text-text-primary [&>*]:!justify-start [&>*]:!text-left",children:bl(m,e,d,l)},d.id)})}),c.length>0&&jsx("div",{className:"ml-2 flex flex-wrap gap-1",children:c.map(d=>{let m=gl(e,d);return jsx("div",{className:"inline-flex",children:bl(m,e,d,l)},d.id)})})]}),s.length>0&&jsx("div",{className:"space-y-1",children:s.map(d=>{let m=gl(e,d),p=d.showLabel&&d.label;return jsxs("div",{className:"flex items-center text-sm text-text-secondary",children:[d.icon&&jsx(I,{name:d.icon,className:"mr-1.5 h-4 w-4 flex-shrink-0"}),p&&jsxs("span",{className:"mr-1 font-medium",children:[d.label,":"]}),jsx("span",{className:"truncate [&>*]:!justify-start [&>*]:!text-left",children:bl(m,e,d,l)})]},d.id)})})]})}function yl({row:e,columns:t,density:r,isLoading:o,onClick:n}){let a=t.filter(c=>c.mobile!==false),i={isLoading:!!o,rowIndex:0,columnIndex:0,density:r};return jsx("div",{className:twMerge("border-b border-border-default bg-background-surface transition-colors",n&&"cursor-pointer hover:bg-background-hover active:bg-background-pressed",{compact:"px-3 py-2",default:"px-4 py-3",relaxed:"px-4 py-4"}[r]),onClick:n,role:n?"button":void 0,tabIndex:n?0:void 0,children:jsx("div",{className:"space-y-2",children:a.map((c,l)=>{let u=gl(e,c),d=l===0;return jsxs("div",{children:[!d&&jsx("div",{className:"text-xs text-text-secondary",children:c.label}),jsx("div",{className:twMerge(d?"font-medium text-text-primary":"text-sm text-text-primary","[&>*]:!justify-start [&>*]:!text-left"),children:bl(u,e,c,i)})]},c.id)})})})}function vx(e="md"){return {mobile:JT[e],desktop:jT[e]}}function Cx({density:e}){return jsxs("div",{className:twMerge("border-b border-border-default bg-background-surface",{compact:"px-3 py-2",default:"px-4 py-3",relaxed:"px-4 py-4"}[e]),children:[jsx("div",{className:"mb-2 h-5 w-3/4 animate-pulse rounded bg-background-muted"}),jsxs("div",{className:"space-y-1",children:[jsx("div",{className:"h-4 w-1/2 animate-pulse rounded bg-background-muted"}),jsx("div",{className:"h-4 w-2/3 animate-pulse rounded bg-background-muted"})]})]})}var ik={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},sk={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"};function lk(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 ck({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:u,setNodeRef:d,transform:m,transition:p,isDragging:g}=useSortable({id:e.id,disabled:!c||s}),f=t?.columnId===e.id,b=f?t.direction:null,x=n&&a,v={...lk(e),transform:CSS.Transform.toString(m),transition:p,opacity:g?.8:1,zIndex:g?50:void 0};return jsx("div",{ref:d,className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.sortable?"gap-2":"gap-1",ik[i],sk[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-primary":"font-medium text-text-secondary",g&&"bg-background-hover"),style:v,role:"columnheader","aria-sort":f?b==="asc"?"ascending":"descending":"none","aria-disabled":s,...l,...u,children:s?jsx(J,{className:"h-4 w-24"}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1 truncate cursor-pointer",onClick:()=>!s&&e.sortable&&r(e.id),children:e.label}),e.sortable&&jsx("button",{type:"button",className:"flex flex-shrink-0 cursor-pointer",onClick:()=>!s&&r(e.id),"aria-label":`Sort by ${e.label}`,children:f?jsx(I,{name:b==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-primary"}):jsx(I,{name:"CaretUpDown",size:12,className:"text-text-secondary opacity-40"})})]})})}function wx({columns:e,columnOrder:t,onColumnOrderChange:r,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,density:s="default",isLoading:c=false}){let l=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:5}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),u=new Map(e.map(p=>[p.id,p])),d=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(u.get(f.id)?.reorderable===false)return;let C=0;for(let R=0;R<t.length&&u.get(t[R])?.reorderable===false;R++)C=R+1;if(x<C)return;let y=Math.min(b,x),S=Math.max(b,x);for(let R=y;R<=S;R++){if(R===b)continue;if(u.get(t[R])?.reorderable===false)return}let k=arrayMove(t,b,x);r(k);}},m=t.map(p=>u.get(p)).filter(p=>p!==void 0);return jsx(DndContext,{sensors:l,collisionDetection:closestCenter,onDragEnd:d,children:jsx(SortableContext,{items:t,strategy:horizontalListSortingStrategy,children:jsx("div",{className:"contents",role:"rowgroup",children:m.map((p,g)=>jsx(ck,{column:p,sortConfig:o,onSort:n,stickyHeader:a,stickyFirstColumn:i,isFirstColumn:g===0,density:s,isLoading:c},p.id))})})})}var Uu={compact:"py-1.5 px-3 text-sm",default:"py-3 px-4 text-sm",relaxed:"py-4 px-4 text-base"},Yu={left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"},gk={full:"w-full",auto:"w-auto inline-block",contained:"w-full max-w-6xl mx-auto"},bk={auto:"table-auto",fixed:"table-fixed",responsive:"table-auto"};function Ku(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 xk(e,t){return t.accessor?typeof t.accessor=="function"?t.accessor(e):e[t.accessor]:null}function hk({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,u=n&&a;return jsx("div",{className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.sortable?"gap-2":"gap-1",Uu[i],Yu[e.align||"left"],o&&"sticky top-0 z-10",u&&"sticky left-0 z-20 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",o&&u&&"z-30",e.sortable&&!s&&"cursor-pointer hover:bg-background-hover",s&&"cursor-not-allowed opacity-60",c?"font-bold text-text-primary":"font-medium text-text-secondary"),onClick:()=>!s&&e.sortable&&r(e.id),role:"columnheader","aria-sort":c?l==="asc"?"ascending":"descending":"none","aria-disabled":s,style:Ku(e),children:s?jsx(J,{className:"h-4 w-24"}):jsxs(Fragment,{children:[jsx("span",{className:"truncate",children:e.label}),e.sortable&&jsx("div",{className:"flex flex-shrink-0",children:c?jsx(I,{name:l==="asc"?"CaretUp":"CaretDown",size:14,weight:"bold",className:"text-text-primary"}):jsx(I,{name:"CaretUpDown",size:12,className:"text-text-secondary opacity-40"})})]})})}function yk({column:e,row:t,rowIndex:r,columnIndex:o,isHovered:n,density:a="default",className:i,stickyFirstColumn:s}){let c=s&&o===0,l=xk(t,e),u={isLoading:false,isHovered:n,rowIndex:r,columnIndex:o,density:a},d;if(e.cell){let m=e.cell,p=typeof e.cellProps=="function"?e.cellProps(l,t):e.cellProps;d=jsx(m,{value:l,row:t,context:u,...p});}else e.render?d=e.render(l,t,u):d=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"),d=jsxs(DialogTrigger,{...b==="hover"?{trigger:"longPress"}:{},children:[jsx("div",{className:"cursor-help",children:d}),jsx(Ze,{placement:g,showArrow:f,children:jsx("div",{className:"p-2",children:p})})]});}return jsx("div",{className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.noCellPadding?"":Uu[a],Yu[e.align||"left"],c&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]",i),role:"cell",style:Ku(e),children:d})}function vk({column:e,rowIndex:t,columnIndex:r,density:o="default",stickyFirstColumn:n}){let a=n&&r===0,i={isLoading:true,rowIndex:t,columnIndex:r,density:o},s;if(e.cell){let c=e.cell,l=typeof e.cellProps=="function"?e.cellProps(null,{}):e.cellProps;s=jsx(c,{value:null,row:{},context:i,...l});}else e.render?s=e.render(null,{},i):s=jsx(J,{className:"h-4 w-full max-w-[200px]"});return jsx("div",{className:twMerge("flex items-center border-b border-border-default bg-background-surface",e.noCellPadding?"":Uu[o],Yu[e.align||"left"],a&&"sticky left-0 z-10 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),role:"cell",style:Ku(e),children:s})}function Ck(e,t){let r=new Set(["BUTTON","A","INPUT","SELECT","TEXTAREA"]),o=new Set(["button","link","checkbox","switch","menuitem","option"]),n=e;for(;n&&n!==t;){if(r.has(n.tagName))return true;let a=n.getAttribute("role");if(a&&o.has(a))return true;n=n.parentElement;}return false}function Nx({columns:e,row:t,rowIndex:r,density:o="default",onClick:n,stickyFirstColumn:a}){let[i,s]=useState(false),c=useCallback(l=>{if(!n)return;let u=l.target,d=l.currentTarget;Ck(u,d)||n(t);},[n,t]);return jsx("div",{className:twMerge("contents group",n&&"cursor-pointer"),role:"row",onClick:c,onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),children:e.map((l,u)=>jsx(yk,{column:l,row:t,rowIndex:r,columnIndex:u,isHovered:i,density:o,className:n?"group-hover:bg-background-hover":"",stickyFirstColumn:a},l.id))})}function Tx({columns:e,rowIndex:t,density:r="default",stickyFirstColumn:o}){return jsx("div",{className:"contents",role:"row",children:e.map((n,a)=>jsx(vk,{column:n,rowIndex:t,columnIndex:a,density:r,stickyFirstColumn:o},n.id))})}function kx({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:u="md",isLoading:d=false,loadingState:m,loadingRowCount:p=5,onLoadMore:g,hasMore:f=false,enableVirtualization:b,estimatedRowHeight:x,loadingIndicator:v,stickyHeader:C=false,stickyFirstColumn:y=false,onRowClick:S,getRowId:k,hideHeader:R=false,sortConfig:E,onSort:D,"aria-label":L,enableColumnReorder:V=false,columnOrder:A,onColumnOrderChange:N}){let[T,z]=useState(null),W=E!==void 0,F=W?E:T,K=useRef(null),X=useMemo(()=>e.map(te=>te.id),[e]),[G,Y]=useState(X),P=A!==void 0,w=P?A:G;useEffect(()=>{P||Y(te=>{let ce=e.map(ee=>ee.id),_=new Set(ce),q=new Set(te),U=te.filter(ee=>_.has(ee)),ae=ce.filter(ee=>!q.has(ee));return [...U,...ae]});},[e,P]);let B=useCallback(te=>{P||Y(te),N?.(te);},[P,N]),M=useMemo(()=>{if(!V&&!A)return e;let te=new Map(e.map(ce=>[ce.id,ce]));return w.map(ce=>te.get(ce)).filter(ce=>ce!==void 0)},[e,w,V,A]),h=g?co({items:t,onLoadMore:g,hasMore:f,isLoading:d,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:Z}=h||{},{gridTemplateColumns:ne,totalMinWidth:Te}=useMemo(()=>{let te=0;return {gridTemplateColumns:M.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 q=typeof _.minWidth=="number"?`${_.minWidth}px`:_.minWidth,U=typeof _.maxWidth=="number"?`${_.maxWidth}px`:_.maxWidth;return `minmax(${q}, ${U})`}return _.minWidth?`minmax(${typeof _.minWidth=="number"?`${_.minWidth}px`:_.minWidth}, 1fr)`:_.maxWidth?`minmax(0, ${typeof _.maxWidth=="number"?`${_.maxWidth}px`:_.maxWidth})`:"1fr"}).join(" "),totalMinWidth:te}},[M]),ie=useCallback(te=>{if(!e.find(q=>q.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=Z==="loading"||d&&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 $=twMerge(gk[n],!g&&(s==="responsive"?"overflow-x-auto scrollbar-visible":"overflow-auto scrollbar-visible"),r),se=vx(u),Ne=c!=="none",Ve=(te,ce)=>Ne?c==="custom"&&l?l(te,ce):jsx(c==="cards"?yl:hl,{row:te,columns:M,density:o,isLoading:d,onClick:S?()=>S(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 jsxs("div",{ref:O,className:$,style:{...ge,position:j?"relative":void 0},children:[jsxs("div",{className:twMerge("grid border-separate border-spacing-0",bk[s],n==="auto"?"inline-grid w-auto":"w-full",Ne&&se.desktop),role:"table","aria-label":L,style:{gridTemplateColumns:ne,minWidth:Te>0?`${Te}px`:void 0},children:[!R&&(V?jsx(wx,{columns:e,columnOrder:w,onColumnOrderChange:B,sortConfig:F,onSort:ie,stickyHeader:C,stickyFirstColumn:y,density:o,isLoading:ue}):jsx("div",{className:"contents",role:"rowgroup",children:M.map((te,ce)=>jsx(hk,{column:te,sortConfig:F,onSort:ie,stickyHeader:C,stickyFirstColumn:y,isFirstColumn:ce===0,density:o,isLoading:ue},te.id))})),j?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)=>jsx("div",{className:"contents",children:jsx(Tx,{columns:M,rowIndex:ce,density:o,stickyFirstColumn:y})},`loading-${ce}`)):t.length>0?jsxs(Fragment,{children:[De.map(({row:te,index:ce,virtualItem:_})=>{if(!te||!_)return null;let q=k?k(te):`row-${ce}`;return 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:jsx(Nx,{columns:M,row:te,rowIndex:ce,density:o,onClick:S,stickyFirstColumn:y})},q)}),me&&jsx("div",{style:{position:"absolute",top:`${j.getTotalSize()}px`,left:0,width:"100%"},children:v||jsx(tr,{state:"loading-more"})})]}):jsx("div",{className:"py-12 text-center text-text-secondary",children:"No data available"})}):jsx("div",{className:"contents",role:"rowgroup",children:ue?Array.from({length:p}).map((te,ce)=>jsx(Tx,{columns:M,rowIndex:ce,density:o,stickyFirstColumn:y},`loading-${ce}`)):t.length>0?jsxs(Fragment,{children:[De.map(({row:te,index:ce})=>{if(!te)return null;let _=k?k(te):`row-${ce}`;return jsx(Nx,{columns:M,row:te,rowIndex:ce,density:o,onClick:S,stickyFirstColumn:y},_)}),me&&jsx("div",{className:"col-span-full",style:{gridColumn:"1 / -1"},children:v||jsx(tr,{state:"loading-more"})})]}):jsx("div",{className:"col-span-full py-12 text-center text-text-secondary",role:"row",children:jsx("div",{role:"cell",children:"No data available"})})})]}),Ne&&jsx("div",{className:se.mobile,children:ue?Array.from({length:p}).map((te,ce)=>jsx(Cx,{density:o},`mobile-loading-${ce}`)):t.length>0?jsxs(Fragment,{children:[De.map(({row:te,index:ce})=>{if(!te)return null;let _=k?k(te):`mobile-row-${ce}`;return jsx("div",{className:"border-b border-border-default last:border-b-0",children:Ve(te,ce)},_)}),me&&(v||jsx(tr,{state:"loading-more"}))]}):jsx("div",{className:"py-12 text-center text-text-secondary",children:"No data available"})}),g&&f&&!ue&&(j?jsx("div",{ref:H,style:{position:"absolute",top:`${j.getTotalSize()}px`,left:0,width:"100%",height:1}}):jsx("div",{ref:H,className:"h-px w-full"}))]})}function Rx({status:e,alertCount:t,showCount:r=false,isLoading:o,size:n="sm",shape:a="pill",...i}){if(o)return 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",u=r&&t?`${c[e]} (${t})`:c[e];return jsx(Je,{variant:s[e],size:n,shape:a,dot:l,dotPulse:l,...i,children:u})}var wk={battery:"BatteryHigh",charger:"ChargingStation",thermostat:"ThermometerSimple",inverter:"Power",vehicle:"Car",meter:"Gauge",gateway:"WifiHigh",other:"Cube",unknown:"Question"},Nk={battery:"Battery",charger:"Charger",thermostat:"Thermostat",inverter:"Inverter",vehicle:"Vehicle",meter:"Meter",gateway:"Gateway",other:"Other",unknown:"Unknown"};function Mx({deviceType:e,iconName:t,size:r="md",showLabel:o=false,className:n}){let a=t||(e?wk[e]:"Question"),i=e?Nk[e]:void 0;return jsxs("div",{className:twMerge("inline-flex items-center",o?"flex-col gap-1":"gap-0",n),children:[jsx(I,{name:a,size:r}),o&&i&&jsx("span",{className:"text-xs text-text-secondary",children:i})]})}function ii({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:u,className:d,primaryAction:m,secondaryAction:p,tertiaryAction:g,footerContent:f,contentPadding:b=true,maxWidth:x="400px"}){if(!s)return null;let v=t||r,C=m||p||g||f;return jsx(mr,{children:jsx(Ut,{isOpen:s,onOpenChange:y=>!y&&u?.(),isDismissable:true,transparent:l,children:jsx(Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxs(Dialog,{className:twMerge("fixed top-0 bottom-0 flex flex-col bg-background-surface shadow-xl overflow-hidden",c==="right"?"right-0":"left-0",c==="right"?"animate-in slide-in-from-right duration-300 ease-out":"animate-in slide-in-from-left duration-300 ease-out","data-[exiting]:animate-out",c==="right"?"data-[exiting]:slide-out-to-right":"data-[exiting]:slide-out-to-left","data-[exiting]:duration-200 data-[exiting]:ease-in","outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default focus-visible:outline-offset-0",d),style:{maxWidth:x,width:"100%"},children:[v&&(a&&i?jsx(Ct,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,hasBackArrow:true,onBack:i,onClose:u}):jsx(Ct,{title:t,headerContent:r,titleAlign:o,hideCloseIcon:n,onClose:u})),jsx("div",{className:twMerge("flex-1 overflow-y-auto overscroll-contain",b?"px-6 py-6":"p-0"),children:e}),C&&jsx(fo,{primaryAction:m,secondaryAction:p,tertiaryAction:g,footerContent:f})]})})})})}ii.displayName="Drawer";var Dk={sm:"gap-4 px-6 py-8",md:"gap-5 px-8 py-12",lg:"gap-6 px-10 py-16"},Mk={sm:"xs",md:"sm",lg:"md"},Ek={sm:et("bodySm"),md:et("bodySm"),lg:et("bodyMd")},Lk={sm:"h-10 w-10",md:"h-12 w-12",lg:"h-16 w-16"},Ak={sm:20,md:24,lg:32},Ik={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"},Fk={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 Ax({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:u=false,className:d}){let m=i==="sm"?"sm":"md",p=c==="spotlight",g=p?{background:Fk[l]}:void 0,f=()=>a?jsx("div",{className:"empty-state-actions mt-2 flex flex-wrap items-center gap-3",children:a}):o||n?jsxs("div",{className:"empty-state-actions mt-2 flex flex-col gap-3",children:[o&&(o.href?jsx(Q,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,href:o.href,children:o.label}):jsx(Q,{variant:"secondary",size:m,onPress:o.onPress,isDisabled:o.isDisabled,isLoading:o.isLoading,children:o.label})),n&&jsx(Ue,{href:n.href||"#",variant:"muted",onPress:n.onPress,className:et("labelMd"),children:n.label})]}):null;return jsxs("section",{"data-testid":"empty-state",role:"status","aria-live":"polite",className:twMerge("flex w-full flex-col rounded-xl text-text-primary",Dk[i],Ik[s],u?"h-full justify-center":"",p?"relative overflow-hidden":"",d),style:g,children:[e&&jsx("div",{className:twMerge("flex items-center justify-center rounded-full border border-border-muted bg-background-muted text-text-secondary",Lk[i]),children:jsx(I,{name:e,size:Ak[i]})}),jsx(Et,{size:Mk[i],tag:"h2",className:"text-text-secondary",children:t}),r&&jsx("p",{className:twMerge("max-w-xs text-text-secondary whitespace-pre-line",Ek[i]),children:r}),f()]})}function Ix({status:e,programName:t,isLoading:r,size:o="sm",shape:n="pill",...a}){if(r)return 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=jsx(Je,{variant:i[e],size:o,shape:n,...a,children:s[e]});return t?jsx(Lt,{content:t,children:c}):c}function Bx({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[u,d]=useState(false),[m,p]=useState(false),[g,f]=useState(null),[b,x]=useState(e),v=useRef(null),C=async k=>{if(f(null),n&&k.size>n){f(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(c&&k.type.startsWith("image/")){let R=new FileReader;R.onloadend=()=>{x(R.result);},R.readAsDataURL(k);}if(i){p(true);try{let R=await i(k);x(R),r?.(R);}catch(R){f("Failed to upload file"),console.error("Upload error:",R);}finally{p(false);}}t?.(k,b);},y=async k=>{try{let R=k.items;if(R.length>0){let E=R[0];if(E.kind==="file"){let D=await E.getFile();D&&C(D);}}}catch(R){f("Failed to upload file"),console.error("Upload error:",R);}finally{d(false);}},S=()=>{x(void 0),f(null),t?.(null),r?.(""),v.current&&(v.current.value="");};return jsxs("div",{className:twMerge("w-full",s),children:[jsxs(DropZone,{className:twMerge("relative flex min-h-[200px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",u?"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:y,onDropEnter:()=>d(true),onDropExit:()=>d(false),children:[b?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[c&&(b.startsWith("data:image")||b.startsWith("http"))?jsx("img",{src:b,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx(Image$1,{className:"h-12 w-12 text-text-secondary"}),jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!a&&jsx(Q,{variant:"icon",size:"sm",onPress:S,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsx(X,{className:"h-4 w-4"})})]}):jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsx(Upload,{className:"h-12 w-12 text-text-secondary"}),jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-sm text-text-primary",children:l}),jsx("p",{className:"mt-1 text-xs text-text-secondary",children:o==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${o}`})]}),jsx(FileTrigger,{acceptedFileTypes:o.split(","),onSelect:k=>{let R=Array.from(k||[]);R.length>0&&C(R[0]);},children:jsx(Q,{variant:"secondary",size:"sm",isDisabled:a,children:"Choose File"})})]}),m&&jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),g&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function zx({version:e,isLatest:t,updateAvailable:r,isLoading:o,size:n="sm",shape:a="rounded",...i}){if(o)return jsx(J,{className:"inline-flex h-6 w-16"});let s="neutral",c=e;return t?s="success":r&&(s="warning",c=`${e} (Update)`),jsx(Je,{variant:s,size:n,shape:a,...i,children:c})}function na(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Hx({placeholder:e="Search...",value:t,onChange:r,isOpen:o,onOpenChange:n,trigger:a,children:i,showShortcutHint:s=true,showInput:c=true,className:l}){let[u,d]=useState(false),m=kt("(max-width: 767px)"),p=o!==void 0?o:u,g=useCallback(v=>{n?n(v):d(v);},[n]);useEffect(()=>{let v=C=>{(C.metaKey||C.ctrlKey)&&C.key==="k"&&(C.preventDefault(),g(!p)),C.key==="Escape"&&p&&g(false);};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[p,g]);let f=useCallback(v=>{r?.(v);},[r]),b=jsxs("button",{type:"button",className:"flex items-center gap-2 px-3 py-2 text-sm text-text-secondary hover:text-text-primary hover:bg-background-hover rounded-md transition-colors","aria-label":"Open search",children:[jsx(I,{name:"MagnifyingGlass",size:18}),!m&&s&&jsxs("span",{className:"hidden md:flex items-center gap-1 text-xs",children:[jsx("kbd",{className:"px-1.5 py-0.5 bg-background-muted border border-border-muted rounded text-xs",children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{className:"px-1.5 py-0.5 bg-background-muted border border-border-muted rounded text-xs",children:"K"})]})]}),x=a===null||isValidElement(a)&&a.type===Fragment$1&&!a.props.children;return m?jsxs(Fragment,{children:[!x&&(a?jsx("button",{type:"button",onClick:()=>g(true),className:"appearance-none bg-transparent border-none p-0 cursor-pointer",children:a}):jsx("button",{type:"button",onClick:()=>g(true),className:"appearance-none bg-transparent border-none p-0 cursor-pointer",children:b})),jsx(Xe,{isOpen:p,onClose:()=>g(false),hideCloseIcon:false,contentPadding:false,maxHeight:"90vh",children:jsxs("div",{className:"flex flex-col h-full",children:[c&&jsx("div",{className:"p-4 border-b border-border-muted flex-shrink-0",children:jsx(lr,{value:t,onChange:f,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:l,autoFocus:true})}),jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:i})]})})]}):x?null:jsxs(DialogTrigger,{isOpen:p,onOpenChange:g,children:[a||b,jsx(Ze,{placement:"bottom",className:"w-[600px] max-w-[90vw] bg-background-surface shadow-xl border border-border-default rounded-lg overflow-hidden",children:jsxs("div",{className:"flex flex-col",children:[c&&jsx("div",{className:"p-4 border-b border-border-muted",children:jsx(lr,{value:t,onChange:f,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:l,autoFocus:true})}),jsx("div",{className:"max-h-[500px] overflow-hidden",children:i})]})})]})}function Ux({placeholder:e="Search...",value:t,onChange:r,isOpen:o,onOpenChange:n,children:a,maxHeight:i="400px",variant:s="default",className:c}){let[l,u]=useState(false),d=kt("(max-width: 767px)"),m=useRef(null),p=useRef(null),g=o!==void 0?o:l,f=useCallback(L=>{n?n(L):u(L);},[n]);useEffect(()=>{let L=V=>{(V.metaKey||V.ctrlKey)&&V.key==="k"&&(V.preventDefault(),f(!g)),V.key==="Escape"&&g&&f(false);};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[g,f]),useEffect(()=>{g&&!d&&m.current&&setTimeout(()=>{m.current?.querySelector("input")?.focus();},0);},[g,d]),useEffect(()=>{if(!g||d)return;let L=V=>{let A=V.target,N=m.current?.contains(A),T=p.current?.contains(A);!N&&!T&&f(false);};return document.addEventListener("mousedown",L,true),()=>document.removeEventListener("mousedown",L,true)},[g,d,f]);let b=L=>{r?.(L);},x=useCallback(()=>{f(false);},[f]),v=useCallback(()=>{r?.("");},[r]),[C,y]=useState(null);useEffect(()=>{if(g&&!d&&m.current){let L=null,V=()=>{let N=m.current?.getBoundingClientRect();N&&y({top:N.bottom+8,left:N.left,width:N.width});},A=()=>{L===null&&(L=requestAnimationFrame(()=>{V(),L=null;}));};return V(),window.addEventListener("resize",A),window.addEventListener("scroll",A,true),()=>{window.removeEventListener("resize",A),window.removeEventListener("scroll",A,true),L!==null&&cancelAnimationFrame(L);}}},[g,d]);let S=useCallback(()=>{f(true);},[f]);if(d)return jsxs("div",{className:c,children:[jsx("button",{type:"button",onClick:S,className:"flex items-center justify-center w-10 h-10 rounded-lg hover:bg-background-hover transition-colors","aria-label":"Open search",children:jsx(I,{name:"MagnifyingGlass",size:"md"})}),jsxs(Xe,{isOpen:g,onClose:x,contentPadding:false,height:"80vh",children:[jsxs("div",{className:"flex items-center gap-2 px-4 pt-4",children:[jsx("div",{className:"flex-1",children:jsx(lr,{value:t,onChange:b,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:v,reserveErrorSpace:false,autoFocus:true})}),jsx(Q,{variant:"icon",onPress:x,"aria-label":"Close search",className:"flex-shrink-0",children:jsx(I,{name:"X",size:"md"})})]}),jsx("div",{className:"mt-4",children:a})]})]},"mobile");let k=L=>{let A=L.target.tagName==="INPUT";if(L.key==="ArrowDown"&&g&&A){L.preventDefault();let N=p.current?.querySelector("[data-search-result]");N&&N.focus();}},R=L=>{let V=L.target;if(!V.hasAttribute("data-search-result"))return;let N=Array.from(p.current?.querySelectorAll("[data-search-result]")||[]),T=N.indexOf(V);if(L.key==="ArrowDown"){L.preventDefault(),L.stopPropagation();let z=Math.min(T+1,N.length-1);N[z]?.focus();}else if(L.key==="ArrowUp")if(L.preventDefault(),L.stopPropagation(),T===0)m.current?.querySelector("input")?.focus();else {let z=Math.max(T-1,0);N[z]?.focus();}else L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),f(false),m.current?.querySelector("input")?.focus());},E=g&&C&&typeof document<"u"?createPortal(jsx("div",{ref:p,style:{position:"fixed",top:`${C.top}px`,left:`${C.left}px`,width:`${C.width}px`,zIndex:9999},role:"listbox",onKeyDown:R,children:jsx("div",{className:"bg-background-surface shadow-2xl border border-border-default rounded-lg overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:jsx("div",{className:"overflow-y-auto",style:{maxHeight:i},children:a})})}),document.body):null,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 jsxs("div",{ref:m,className:`relative w-full ${c||""}`,onKeyDown:k,children:[jsx(lr,{value:t,onChange:b,placeholder:e,showSearchIcon:true,isClearable:!!t,onClear:()=>r?.(""),reserveErrorSpace:false,className:D,onFocus:()=>f(true)}),E]},"desktop")}function Yx({message:e="No results found",suggestion:t,icon:r="MagnifyingGlass",className:o=""}){return jsxs("div",{className:`flex flex-col items-center justify-center py-12 px-4 text-center ${o}`,children:[jsx("div",{className:"text-text-secondary mb-3",children:jsx(I,{name:r,size:48})}),jsx("p",{className:"text-base font-medium text-text-primary mb-1",children:e}),t&&jsx("p",{className:"text-sm text-text-secondary max-w-xs",children:t})]})}function Jx({count:e=3,className:t=""}){return jsx("div",{className:`flex flex-col ${t}`,children:Array.from({length:e}).map((r,o)=>jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[jsx(J,{width:20,height:20,variant:"circle"}),jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[jsx(J,{width:"60%",height:16}),jsx(J,{width:"40%",height:12})]}),jsx(J,{width:16,height:16})]},o))})}function qx({title:e,count:t,isLoading:r,footer:o,children:n,className:a}){return jsxs("div",{className:twMerge("flex flex-col",a),children:[jsxs("div",{className:"flex items-baseline gap-1.5 px-4 pt-4 pb-2 border-t border-border-muted first:border-t-0",children:[jsx("h3",{className:"text-sm font-semibold text-text-primary",children:e}),!r&&t!==void 0&&jsx("span",{className:"text-xs text-text-secondary",children:t}),r&&jsx("span",{className:"text-xs text-text-secondary animate-pulse",children:"Loading..."})]}),jsx("div",{className:"flex flex-col",children:n}),o&&jsx("div",{className:"px-4 py-2 border-t border-border-subtle",children:o})]})}function Zx({id:e,title:t,subtitle:r,metadata:o,icon:n,customIcon:a,onSelect:i,isFocused:s=false,className:c,testId:l}){return jsxs("div",{role:"option",tabIndex:0,onClick:()=>{i?.(e);},onKeyDown:m=>{let p=m.currentTarget;switch(m.key){case "Enter":case " ":{m.preventDefault(),i?.(e);break}case "ArrowDown":{m.preventDefault();let g=Array.from(document.querySelectorAll("[data-search-result]")),f=g.indexOf(p);f!==-1&&f<g.length-1&&g[f+1].focus();break}case "ArrowUp":{m.preventDefault();let g=Array.from(document.querySelectorAll("[data-search-result]")),f=g.indexOf(p);if(f>0)g[f-1].focus();else {let 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:twMerge("group flex items-center gap-3 px-4 py-3 cursor-pointer outline-none transition-colors","text-text-primary hover:bg-background-hover","focus-visible:bg-background-muted focus-visible:outline-none","data-[focused]:bg-background-hover",s&&"bg-background-hover",c),"data-focused":s||void 0,children:[a?jsx("div",{className:"flex-shrink-0",children:a}):n?jsx("div",{className:"flex-shrink-0 text-text-secondary",children:jsx(I,{name:n,size:20})}):null,jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-baseline gap-2",children:[jsx("span",{className:"font-medium text-text-primary truncate",children:t}),o&&jsx("span",{className:"text-xs text-text-secondary flex-shrink-0",children:o})]}),r&&jsx("div",{className:"text-sm text-text-secondary truncate mt-0.5",children:r})]}),jsx("div",{className:"flex-shrink-0 opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 group-data-[focused]:opacity-100 transition-opacity",children:jsx(I,{name:"ArrowRight",size:16,className:"text-text-secondary"})})]})}function Xx({children:e,maxHeight:t="400px",className:r}){return jsx("div",{className:twMerge("overflow-y-auto overscroll-contain","divide-y divide-border-muted",r),style:{maxHeight:t},children:e})}function Qx({placeholder:e="Search...",onClick:t,showShortcut:r=true,variant:o="default",className:n=""}){let a=typeof navigator<"u"&&navigator.platform.includes("Mac");return jsxs("button",{type:"button",onClick:t,className:`
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:`
@@ -111,7 +111,7 @@ Valid keys: `+JSON.stringify(Object.keys(N),null," "));var M=B(G,w,F,K,X+"."+w,
111
111
  `;return}else B.tagName;}for(let B=0;B<w.childNodes.length;B++)P(w.childNodes[B]);};return P(G),Y},[]),T=useCallback((G,Y)=>{let P=document.createTreeWalker(G,NodeFilter.SHOW_TEXT,{acceptNode:O=>{let H=O.parentElement;return H&&H.closest("[data-chip-id]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),w=P.nextNode(),B=Math.max(0,Y);for(;w;){let O=w.nodeValue||"";if(O.length>=B){let H=document.createRange();H.setStart(w,B),H.collapse(true);let j=window.getSelection();j?.removeAllRanges(),j?.addRange(H);return}B-=O.length,w=P.nextNode();}let M=window.getSelection(),h=document.createRange();h.selectNodeContents(G),h.collapse(false),M?.removeAllRanges(),M?.addRange(h);},[]);useEffect(()=>{R.current&&!m&&R.current.textContent!==""&&(R.current.textContent="");},[m]),useLayoutEffect(()=>{if(R.current){if(m===""){if(E)try{R.current.focus({preventScroll:!0}),T(R.current,0);}catch{}return}if(A.current!=null)try{T(R.current,A.current);}finally{A.current=null;}}},[m,T,E]);let z=useCallback((G,Y)=>{if(p?.(G),G===""){v?.();return}if(b&&x&&Y!==void 0){let P=G.slice(0,Y),w=typeof b=="string"?new RegExp(`\\${b}([^\\s]*)$`):b,B=P.match(w);if(B){let M=B[1]||"",h=Y-B[0].length;x({query:M,position:Y,startIndex:h});}else v?.();}},[p,b,x,v]),W=useCallback(G=>{if(!f||!p)return;let Y=g.filter(w=>w.id!==G);f(Y);let P=m.replace(new RegExp(`\\{\\{${G}\\}\\}`,"g"),"");p(P);},[g,f,m,p]),F=useCallback(G=>C?C(G,()=>W(G.id)):jsx(Ar,{variant:y,size:V,onRemove:c?void 0:()=>W(G.id),isDisabled:c,className:"py-0.5 px-1.5 gap-1 text-xs leading-none rounded-md",children:G.label},G.id),[C,y,V,W,c]),K=()=>{let G=ht({isInvalid:s,isDisabled:c,isFocused:E,transparent:i,size:o}),Y=`min-h-[100px] py-2 px-3 ${c?"resize-none":l?"resize-y":"resize-none"}`,P=twMerge("focus:outline-none overflow-auto","[&_[data-chip-id]::selection]:bg-action-primary/20","[&:empty]:before:content-[attr(data-placeholder)] [&:empty]:before:text-text-disabled [&:empty]:before:pointer-events-none");return twMerge(G,Y,P,u)},X=()=>m?m.split(/(\{\{[^}]+\}\})/g).map((Y,P)=>{let w=Y.match(/\{\{([^}]+)\}\}/);if(w){let B=w[1],M=g.find(h=>h.id===B);if(M)return jsx("span",{className:"inline-block align-baseline cursor-pointer",contentEditable:false,suppressContentEditableWarning:true,"data-chip-id":B,style:{userSelect:"none",verticalAlign:"baseline",lineHeight:"1"},onClick:h=>{h.preventDefault();let O=window.getSelection(),H=document.createRange();H.selectNode(h.currentTarget),O?.removeAllRanges(),O?.addRange(H);},children:F(M)},`chip-${B}-${P}`)}return Y.includes(`
112
112
  `)?Y.split(`
113
113
  `).map((B,M)=>jsxs(Ee__default.Fragment,{children:[B,M<Y.split(`
114
- `).length-1&&jsx("br",{})]},`line-${P}-${M}`)):Y}):null;return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(Me,{size:o,tooltip:n,isRequired:a,children:e}),jsx(nt,{children:jsx("div",{ref:R,contentEditable:!c,suppressContentEditableWarning:true,onInput:G=>{if(c)return;let Y=G.target,P=Y.querySelector("[data-chip-id]")!==null,w;if(P?(w=N(Y),w=w.replace(/(\{\{[^}]+\}\})\s{2,}/g,"$1 ").replace(/\s{2,}(\{\{[^}]+\}\})/g," $1")):w=Y.textContent||"",w===""){try{let h=document.createRange();h.selectNodeContents(Y),h.collapse(!0);let O=window.getSelection();O?.removeAllRanges(),O?.addRange(h),A.current=0;}catch{}z("",0);return}if(w===m)return;let B=window.getSelection(),M=0;if(B&&B.rangeCount>0)try{let h=B.getRangeAt(0);if(P){let O=0,H=!1,j=oe=>{if(H)return !0;if(oe===h.startContainer)return O+=h.startOffset,H=!0,!0;if(oe.nodeType===Node.TEXT_NODE){if(!oe.parentElement?.closest("[data-chip-id]")){if(oe.contains(h.startContainer))return O+=h.startOffset,H=!0,!0;O+=(oe.textContent||"").length;}}else if(oe.nodeType===Node.ELEMENT_NODE){let me=oe;if(me.hasAttribute("data-chip-id")){if(me.contains(h.startContainer)||me===h.startContainer){let ne=me.getAttribute("data-chip-id");return O+=`{{${ne}}}`.length,H=!0,!0}let Z=me.getAttribute("data-chip-id");return O+=`{{${Z}}}`.length,!1}else if(me.tagName==="BR")return me===h.startContainer?(H=!0,!0):(O+=1,!1)}for(let me=0;me<oe.childNodes.length;me++)if(j(oe.childNodes[me]))return !0;return !1};j(Y),M=O;}else {let O=document.createRange();O.setStart(Y,0),O.setEnd(h.startContainer,h.startOffset),M=O.toString().length;}}catch{M=w.length;}A.current=M,z(w,M);},onKeyDown:G=>{if(c)return;let Y=window.getSelection();if(!(!Y||Y.rangeCount===0))try{let P=Y.getRangeAt(0),w=P.commonAncestorContainer;if(G.key==="ArrowLeft"||G.key==="ArrowRight"){let B=w.nodeType===Node.TEXT_NODE?w.parentElement?.closest("[data-chip-id]"):w.closest("[data-chip-id]");if(B){G.preventDefault();try{let M=document.createRange(),h=window.getSelection();G.key==="ArrowLeft"?M.setStartBefore(B):M.setStartAfter(B),M.collapse(!0),h?.removeAllRanges(),h?.addRange(M);}catch{}}}if(G.key==="Backspace"){let B=null;if(B=(w.nodeType===Node.TEXT_NODE?w.parentElement?.closest("[data-chip-id]"):w.closest("[data-chip-id]"))||null,!B)if(w.nodeType===Node.TEXT_NODE){let M=w;if(P.startOffset===0&&M.parentElement){let h=M.previousSibling;if(h&&h.nodeType===Node.ELEMENT_NODE){let O=h.closest("[data-chip-id]");O&&(B=O);}}}else {let M=w;if(P.startOffset>0){let h=M.childNodes[P.startOffset-1];if(h&&h.nodeType===Node.ELEMENT_NODE){let O=h.closest("[data-chip-id]");O&&(B=O);}}}if(B){G.preventDefault(),G.stopPropagation();let M=B.getAttribute("data-chip-id");if(!M)return;let h=`{{${M}}}`,O=m.indexOf(h);if(O!==-1){let H=m.slice(0,O)+m.slice(O+h.length),j=g.filter(oe=>oe.id!==M);A.current=O;try{window.getSelection()?.removeAllRanges();}catch{}f?.(j),p?.(H);}}}}catch{}},onFocus:G=>{c||(k.onFocus&&k.onFocus(G),D(G));},onBlur:G=>{c||(k.onBlur&&k.onBlur(G),L(G));},className:K(),style:{whiteSpace:"pre-wrap",wordBreak:"break-word",...k.style},"data-placeholder":k.placeholder,children:X()},m===""?"empty":"content")}),t&&jsx(Se,{size:o,className:"mt-3",children:t}),typeof r=="string"&&jsx(pe,{size:o,className:"mt-1",children:r}),typeof r=="function"&&d&&jsx(pe,{size:o,className:"mt-1",children:r(d)})]})})}function TR(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Ap(e){return TR(e)?e:(console.warn("Invalid date detected in TimeControls, using fallback:",e),new Date)}var ev={FIFTEEN_MINUTES:1,HOUR:2,DAY:3,WEEK:4,MONTH:5,YEAR:6},kR=[{id:"FIFTEEN_MINUTES",label:"15m"},{id:"HOUR",label:"1h"},{id:"DAY",label:"1d"},{id:"WEEK",label:"1w"}];function tv({dateRange:e,onDateRangeChange:t,windowSize:r,onWindowSizeChange:o,showWindowSize:n=true,showRangeSelector:a=true,allowDatePicker:i=false,lockWindowSize:s=false,restrictToSingleDay:c=false,presetRanges:l=[],windowSizeOptions:u=kR,autoAdjustWindowSize:d=false,className:m}){let[p,g]=useState(0),f=useRef(null),[b,x]=useState(false),v=P=>{let B=(P.before.getTime()-P.after.getTime())/(1e3*60*60);return B<=24?"FIFTEEN_MINUTES":B<=72||B<=168?"HOUR":("DAY")};useEffect(()=>{if(d&&!b&&o){let P=v(e);o(P);}},[e,d,b,o]);let C=P=>l.find(w=>{let B=w.getRange();return Math.abs(B.after.getTime()-P.after.getTime())<1e3*60*60*24&&Math.abs(B.before.getTime()-P.before.getTime())<1e3*60*60*24})?.id,[y,S]=useState(()=>C(e)),k=Ap(e.after),R=Ap(e.before),E=new Date(R);E.setDate(E.getDate()-1);let D={start:ls(k,jo()),end:ls(E,jo())};useEffect(()=>{let P=new ResizeObserver(w=>{for(let B of w)g(B.contentRect.width);});return f.current&&P.observe(f.current),()=>{f.current&&P.unobserve(f.current);}},[]);let L=[...u].sort((P,w)=>ev[P.id]-ev[w.id]),V=P=>{let w=P.toString(),B=l.find(M=>M.id===w);B&&(S(w),x(false),t(B.getRange()));},A=P=>{if(P?.start&&P?.end){S(void 0);let w=new Date(P.start.year,P.start.month-1,P.start.day,0,0,0,0),B=new Date(P.end.year,P.end.month-1,P.end.day+1,0,0,0,0);t({after:w,before:B});}},N=P=>{if(P){S(void 0);let w=new Date(P.year,P.month-1,P.day,0,0,0,0),B=new Date(P.year,P.month-1,P.day+1,0,0,0,0);t({after:w,before:B});}},T=P=>{o&&(x(true),o(P.toString()));},z=()=>{if(l.length>0){let P=l[0];S(P.id),x(false),t(P.getRange());}},W=(P,w=0)=>{let B=Ap(P),M=new Date(B);return w!==0&&M.setDate(M.getDate()+w),M.toLocaleDateString("en-US")},F=L.map(P=>({id:P.id,label:P.label,value:P.id})),K=l.map(P=>({id:P.id,label:P.label,value:P.id})),X=s?jsx("div",{className:"flex items-center rounded-md border border-border-muted bg-background-muted px-3 py-2 text-sm text-text-secondary",children:L.find(P=>P.id===r)?.label||r}):jsx(Zo,{className:"w-full md:w-auto",selectedKey:r,onSelectionChange:T,items:F,size:"md","aria-label":"Select Window Size",children:P=>jsx(At,{id:P.id,"aria-label":P.label,size:"md",children:P.label},P.id)}),G=c?jsx("div",{className:"flex items-center",children:jsxs(DialogTrigger,{children:[jsxs(Q,{className:"border-l pl-2 pr-2 hover:border-border-default hover:bg-background-muted hover:text-text-link-hover",variant:"secondary",children:[jsx(I,{name:"CalendarBlank",size:18}),jsx("span",{className:"ml-2 hidden md:block",children:W(e.after)})]}),jsx(Ze,{className:"w-auto p-3",disableGroup:true,children:jsx(Wn,{"aria-label":"Select date",value:Fa(k.toISOString().split("T")[0]),onChange:N})})]})}):jsxs("div",{className:"flex items-center",children:[jsxs(DialogTrigger,{children:[jsxs(Q,{className:"rounded-r-none border-l pl-2 pr-2 hover:border-border-default hover:bg-background-muted hover:text-text-link-hover",variant:"secondary",children:[jsx(I,{name:"CalendarBlank",size:18}),!y&&jsx("span",{className:"ml-2 hidden md:block",children:`${W(e.after)} - ${W(e.before,-1)}`})]}),jsx(Ze,{className:"w-auto p-3",disableGroup:true,children:jsx(_n,{"aria-label":"Date range calendar",value:D,onChange:A})})]}),!y&&jsx(Q,{variant:"ghost",size:"md",onPress:z,children:"Reset"})]}),Y=p<600;return jsx("div",{ref:f,className:twMerge("flex w-full flex-wrap items-center justify-between gap-4",m),children:Y?jsxs("div",{className:"flex w-full justify-between",children:[jsxs("div",{className:"flex items-center",children:[i&&G,a&&y!==void 0&&jsx(Zo,{selectedKey:y,onSelectionChange:V,items:K,size:"md","aria-label":"Select Date Range",children:P=>jsx(At,{id:P.id,size:"md",children:P.label},P.id)})]}),jsx("div",{className:"flex items-center",children:n&&r&&X})]}):jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-4",children:[i&&G,a&&y!==void 0&&jsx(sc,{options:l.map(P=>({id:P.id,label:P.label})),value:y,onChange:V,size:"sm",variant:"secondary","aria-label":"Select Date Range"})]}),jsx("div",{className:"flex items-center",children:n&&r&&X})]})})}function ER({isPlaceholder:e,isDisabled:t,size:r="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[r],e?"text-text-disabled italic":"text-text-primary",t?"text-text-disabled cursor-not-allowed":"cursor-text",!t&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function ov({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,reserveErrorSpace:c=true,validationResult:l,className:u,descriptionPlacement:d="below",...m}){return jsxs(TimeField,{...m,isDisabled:i,isRequired:a,isInvalid:s,className:Ce(u,"flex flex-col gap-1"),children:[e&&jsx(Me,{size:o,tooltip:n,description:d==="tooltip"||d==="inline"?t:void 0,descriptionPlacement:d,isRequired:a,children:e}),jsx(nt,{children:jsx(DateInput,{className:twMerge(xo({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:p=>jsx(DateSegment,{segment:p,className:ER({isPlaceholder:p.isPlaceholder,isDisabled:!p.isEditable||i,size:o})})})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(pe,{size:o,children:r}):typeof r=="function"&&l?jsx(pe,{size:o,children:r(l)}):t&&d==="below"?jsx(Se,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&l?jsx(pe,{size:o,className:"mt-1",children:r(l)}):t&&d==="below"?jsx(Se,{size:o,className:"mt-1",children:t}):null})]})}function nv({children:e,className:t=""}){return jsx("div",{className:`flex flex-col ${t}`.trim(),role:"list",children:e})}function av({children:e,variant:t="default",icon:r,label:o,isLast:n=false,className:a=""}){let s={default:{dot:"bg-border-default border-border-default",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary"},active:{dot:"bg-text-primary border-text-primary",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary font-medium"},muted:{dot:"bg-border-muted border-border-muted",line:"bg-border-muted",label:"text-text-secondary",content:"text-text-secondary"},success:{dot:"bg-feedback-success-border border-feedback-success-border",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary"},error:{dot:"bg-feedback-error-border border-feedback-error-border",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary"},warning:{dot:"bg-feedback-warning-border border-feedback-warning-border",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary"},info:{dot:"bg-feedback-info-border border-feedback-info-border",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary"}}[t];return jsxs("div",{className:`flex gap-3 ${a}`.trim(),role:"listitem",children:[jsxs("div",{className:"flex flex-col items-center",style:{width:"20px"},children:[jsx("div",{className:`flex items-center justify-center rounded-full border-2 ${s.dot}`,style:{width:"20px",height:"20px",flexShrink:0},children:r&&jsx(I,{name:r,size:12,className:"text-background-body"})}),!n&&jsx("div",{className:`w-0.5 flex-1 ${s.line}`,style:{minHeight:"24px"}})]}),jsxs("div",{className:"flex-1 pb-6",children:[o&&jsx("div",{className:`text-xs mb-1 ${s.label}`,children:o}),jsx("div",{className:`text-sm ${s.content}`,children:e})]})]})}function BR(e){return "primary"}var VR="flex font-medium justify-center items-center gap-2 text-center transition whitespace-nowrap box-border",iv={primary:{selected:"bg-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",unselected:"bg-transparent text-action-primary border-2 border-border-muted hover:bg-text-primary/[0.05] forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]"}},zR="opacity-[--control-hover-opacity] cursor-not-allowed pointer-events-none grayscale",OR="opacity-100 cursor-pointer",HR={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},WR={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-action-destructive text-[color:var(--color-action-destructive-text)]"};function GR(e){let{variant:t="primary",size:r="md",isDisabled:o,isSelected:n,borderRadius:a,borderRight:i,borderLeft:s}=e,c=BR(),l=`${VR} ${n?iv[c].selected:iv[c].unselected}`;return l+=` ${Le[r].text} ${Le[r].height} ${Le[r].padding} ${Le[r].gap}`,l+=` ${o?zR:OR}`,a==="left"&&(l+=" rounded-l-sm"),a==="right"&&(l+=" rounded-r-sm"),i&&(l+=" border-r"),s&&(l+=" border-l"),l+=` ${Oe()}`,(l+=" focus-visible:outline-action-primary"),twMerge(l)}function lv(e){let{className:t,children:r,onPress:o,icon:n,iconPosition:a="left",iconWeight:i,isLoading:s=false,loadingText:c,loadingIndicator:l,size:u="md",badgeNumber:d,badgeVariant:m="primary",badgePosition:p="top-right",...g}=e,f=n?jsx(I,{name:n,size:u,weight:i}):null,b=()=>{let v=jsxs(Fragment,{children:[a==="left"&&f,r,a==="right"&&f]});return s?jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l||jsx(I,{name:"CircleNotch",size:u,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:v}),c&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:c})]}):v},x=jsx(ToggleButton,{onPress:o,...g,className:twMerge(GR(e),t),"aria-busy":s,children:b()});return d&&d>0?jsxs("div",{className:"relative",children:[x,jsx("span",{className:`absolute ${HR[p]} flex h-5 w-5 items-center justify-center rounded-full ${WR[m]} text-xs`,"aria-label":`${d} items`,children:d})]}):x}var Ri={app:{icon:"AppWindow",label:{singular:"App",plural:"Apps"},description:"Workspace and integration apps"},site:{icon:"MapPin",label:{singular:"Site",plural:"Sites"},description:"Physical locations with energy systems"},device:{icon:"ShareNetwork",label:{singular:"Device",plural:"Devices"},description:"Connected energy devices"},customer:{icon:"Users",label:{singular:"Customer",plural:"Customers"},description:"End customers and site owners"},contact:{icon:"Users",label:{singular:"Contact",plural:"Contacts"},description:"Contact persons"},program:{icon:"ClipboardText",label:{singular:"Program",plural:"Programs"},description:"Demand response and VPP programs"},workflow:{icon:"FlowArrow",label:{singular:"Workflow",plural:"Workflows"},description:"Automated workflows and rules"},collection:{icon:"Stack",label:{singular:"Collection",plural:"Collections"},description:"Grouped entities"},board:{icon:"SquaresFour",label:{singular:"Board",plural:"Boards"},description:"Dashboard and monitoring boards"},report:{icon:"ChartLine",label:{singular:"Report",plural:"Reports"},description:"Analytics and reports"},event:{icon:"ClockCounterClockwise",label:{singular:"Event",plural:"Events"},description:"System events and activity"},alert:{icon:"Warning",label:{singular:"Alert",plural:"Alerts"},description:"Notifications and alerts"},command:{icon:"Play",label:{singular:"Command",plural:"Commands"},description:"Device commands and control"}};function YR(e){return Ri[e]}function KR(e){return Ri[e].icon}function JR(e,t=false){return t?Ri[e].label.plural:Ri[e].label.singular}function jR({formId:e="dialog-form",onSubmit:t,primaryLabel:r="Save",secondaryLabel:o="Cancel",onCancel:n,primaryVariant:a,secondaryVariant:i="secondary",children:s,title:c,...l}){return jsx(rr,{title:c,primaryAction:{label:r,onPress:()=>{let d=document.getElementById(e);d&&d.requestSubmit();},variant:a},secondaryAction:n?{label:o,onPress:n,variant:i}:void 0,...l,children:jsx(na,{id:e,onSubmit:t,children:s})})}function qR({formId:e="drawer-form",onSubmit:t,primaryLabel:r="Save",secondaryLabel:o="Cancel",onCancel:n,primaryVariant:a,secondaryVariant:i="secondary",children:s,...c}){return jsx(ii,{primaryAction:{label:r,onPress:()=>{let u=document.getElementById(e);u&&u.requestSubmit();},variant:a},secondaryAction:n?{label:o,onPress:n,variant:i}:void 0,...c,children:jsx(na,{id:e,onSubmit:t,className:"mt-2",children:s})})}function XR({align:e="end",className:t,...r}){return jsx("div",{...r,className:twMerge("flex gap-2",e==="start"?"justify-start":e==="between"?"justify-between":"justify-end",t)})}var _R={sm:"gap-2",md:"gap-4",lg:"gap-6"};function e3(e){if(!e)return "";let t=e.base?`grid-cols-${e.base}`:"",r=e.md?`md:grid-cols-${e.md}`:"",o=e.lg?`lg:grid-cols-${e.lg}`:"";return [t,r,o].filter(Boolean).join(" ")}function t3({cols:e={base:1},gap:t="lg",className:r,...o}){return jsx("div",{...o,className:twMerge("grid",e3(e),_R[t],r)})}function n3({title:e,description:t,showDivider:r,className:o,children:n,...a}){return jsxs("section",{...a,className:twMerge("flex flex-col",o),children:[(e||t)&&jsxs("div",{className:"flex flex-col gap-1 mb-6",children:[typeof e=="string"?jsx(Et,{tag:"h3",size:"sm",children:e}):e,t?jsx(Se,{size:"lg",children:t}):null]}),jsx("div",{className:"flex flex-col gap-6",children:n}),r&&jsx("hr",{className:"mt-2 border-border-muted"})]})}function a3(){return jsx("hr",{className:"border-border-muted"})}function i3({steps:e,currentStepId:t,onStepClick:r,className:o}){let n=e.findIndex(a=>a.id===t);return jsx("nav",{"aria-label":"Progress",className:twMerge("w-full",o),children:jsx("div",{className:"relative mb-12",children:jsx("ol",{className:"relative flex items-start justify-between",children:e.map((a,i)=>{let s=a.id===t,c=i<n,l=r&&(c||s);return jsxs("li",{className:"relative flex flex-col items-center",style:{flex:`1 1 ${100/e.length}%`},children:[jsx("button",{type:"button",disabled:!l,onClick:()=>l&&r?.(a.id),className:twMerge("relative z-10 flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full border-2 transition-colors bg-background-body",c&&"border-action-primary bg-action-primary text-text-inverse hover:bg-action-primary/90",s&&"border-action-primary bg-background-body text-action-primary",!c&&!s&&"border-border-default bg-background-body text-text-secondary",l&&"cursor-pointer",!l&&"cursor-default"),"aria-current":s?"step":void 0,children:c?jsx(I,{name:"Check",size:20,weight:"bold"}):jsx("span",{className:"text-sm font-semibold",children:i+1})}),i<e.length-1&&jsx("div",{className:"absolute top-5 h-0.5 transition-colors",style:{left:"50%",width:"100%",marginLeft:"20px",backgroundColor:i<n?"var(--color-action-primary)":"var(--color-border-default)"}}),jsxs("div",{className:"mt-3 flex flex-col items-center text-center w-32",children:[jsx("span",{className:twMerge("text-sm font-medium",s&&"text-text-default",c&&"text-text-primary",!s&&!c&&"text-text-secondary"),children:a.title}),a.description&&jsx("span",{className:"mt-1 text-xs text-text-secondary",children:a.description})]})]},a.id)})})})})}function l3({formId:e,show:t,isSubmitting:r,onCancel:o,primaryLabel:n="Save changes",secondaryLabel:a="Cancel",className:i}){return t?jsx("div",{className:twMerge("fixed inset-x-0 bottom-0 z-40 border-t border-border-muted bg-background-surface/95 backdrop-blur supports-[backdrop-filter]:bg-background-surface/70",i),children:jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsx("div",{className:"text-sm text-text-secondary",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(Q,{variant:"secondary",onPress:o,children:a}),jsx(Q,{type:"submit",form:e,isDisabled:!!r,children:r?"Saving...":n})]})]})}):null}function c3({when:e,message:t="You have unsaved changes. Leave anyway?"}){return Ee.useEffect(()=>{if(!e)return;let r=o=>(o.preventDefault(),o.returnValue=t,t);return window.addEventListener("beforeunload",r),()=>window.removeEventListener("beforeunload",r)},[e,t]),null}function d3({steps:e,initialStepId:t,canNavigate:r}){if(e.length===0)throw new Error("useWizard: steps array cannot be empty");let[o,n]=Ee.useState(t||e[0].id),a=e.findIndex(d=>d.id===o),i=a>0,s=a<e.length-1,c=async d=>d===o?true:r&&!await r(o,d)?false:(n(d),true);return {steps:e,currentStepId:o,setCurrentStepId:c,next:async()=>!s||a===-1?false:c(e[a+1].id),prev:async()=>!i||a===-1?false:c(e[a-1].id),hasNext:s,hasPrev:i,stepIndex:a}}function Are(e){switch(e){case "charging":case "on":return "success";case "discharging":return "warning";case "heat":case "cool":return "info";case "off":case "idle":case "eco":case "auto":return "neutral";default:return "neutral"}}/*! Bundled license information:
114
+ `).length-1&&jsx("br",{})]},`line-${P}-${M}`)):Y}):null;return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(Me,{size:o,tooltip:n,isRequired:a,children:e}),jsx(nt,{children:jsx("div",{ref:R,contentEditable:!c,suppressContentEditableWarning:true,onInput:G=>{if(c)return;let Y=G.target,P=Y.querySelector("[data-chip-id]")!==null,w;if(P?(w=N(Y),w=w.replace(/(\{\{[^}]+\}\})\s{2,}/g,"$1 ").replace(/\s{2,}(\{\{[^}]+\}\})/g," $1")):w=Y.textContent||"",w===""){try{let h=document.createRange();h.selectNodeContents(Y),h.collapse(!0);let O=window.getSelection();O?.removeAllRanges(),O?.addRange(h),A.current=0;}catch{}z("",0);return}if(w===m)return;let B=window.getSelection(),M=0;if(B&&B.rangeCount>0)try{let h=B.getRangeAt(0);if(P){let O=0,H=!1,j=oe=>{if(H)return !0;if(oe===h.startContainer)return O+=h.startOffset,H=!0,!0;if(oe.nodeType===Node.TEXT_NODE){if(!oe.parentElement?.closest("[data-chip-id]")){if(oe.contains(h.startContainer))return O+=h.startOffset,H=!0,!0;O+=(oe.textContent||"").length;}}else if(oe.nodeType===Node.ELEMENT_NODE){let me=oe;if(me.hasAttribute("data-chip-id")){if(me.contains(h.startContainer)||me===h.startContainer){let ne=me.getAttribute("data-chip-id");return O+=`{{${ne}}}`.length,H=!0,!0}let Z=me.getAttribute("data-chip-id");return O+=`{{${Z}}}`.length,!1}else if(me.tagName==="BR")return me===h.startContainer?(H=!0,!0):(O+=1,!1)}for(let me=0;me<oe.childNodes.length;me++)if(j(oe.childNodes[me]))return !0;return !1};j(Y),M=O;}else {let O=document.createRange();O.setStart(Y,0),O.setEnd(h.startContainer,h.startOffset),M=O.toString().length;}}catch{M=w.length;}A.current=M,z(w,M);},onKeyDown:G=>{if(c)return;let Y=window.getSelection();if(!(!Y||Y.rangeCount===0))try{let P=Y.getRangeAt(0),w=P.commonAncestorContainer;if(G.key==="ArrowLeft"||G.key==="ArrowRight"){let B=w.nodeType===Node.TEXT_NODE?w.parentElement?.closest("[data-chip-id]"):w.closest("[data-chip-id]");if(B){G.preventDefault();try{let M=document.createRange(),h=window.getSelection();G.key==="ArrowLeft"?M.setStartBefore(B):M.setStartAfter(B),M.collapse(!0),h?.removeAllRanges(),h?.addRange(M);}catch{}}}if(G.key==="Backspace"){let B=null;if(B=(w.nodeType===Node.TEXT_NODE?w.parentElement?.closest("[data-chip-id]"):w.closest("[data-chip-id]"))||null,!B)if(w.nodeType===Node.TEXT_NODE){let M=w;if(P.startOffset===0&&M.parentElement){let h=M.previousSibling;if(h&&h.nodeType===Node.ELEMENT_NODE){let O=h.closest("[data-chip-id]");O&&(B=O);}}}else {let M=w;if(P.startOffset>0){let h=M.childNodes[P.startOffset-1];if(h&&h.nodeType===Node.ELEMENT_NODE){let O=h.closest("[data-chip-id]");O&&(B=O);}}}if(B){G.preventDefault(),G.stopPropagation();let M=B.getAttribute("data-chip-id");if(!M)return;let h=`{{${M}}}`,O=m.indexOf(h);if(O!==-1){let H=m.slice(0,O)+m.slice(O+h.length),j=g.filter(oe=>oe.id!==M);A.current=O;try{window.getSelection()?.removeAllRanges();}catch{}f?.(j),p?.(H);}}}}catch{}},onFocus:G=>{c||(k.onFocus&&k.onFocus(G),D(G));},onBlur:G=>{c||(k.onBlur&&k.onBlur(G),L(G));},className:K(),style:{whiteSpace:"pre-wrap",wordBreak:"break-word",...k.style},"data-placeholder":k.placeholder,children:X()},m===""?"empty":"content")}),t&&jsx(Se,{size:o,className:"mt-3",children:t}),typeof r=="string"&&jsx(pe,{size:o,className:"mt-1",children:r}),typeof r=="function"&&d&&jsx(pe,{size:o,className:"mt-1",children:r(d)})]})})}function TR(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Ap(e){return TR(e)?e:(console.warn("Invalid date detected in TimeControls, using fallback:",e),new Date)}var ev={FIFTEEN_MINUTES:1,HOUR:2,DAY:3,WEEK:4,MONTH:5,YEAR:6},kR=[{id:"FIFTEEN_MINUTES",label:"15m"},{id:"HOUR",label:"1h"},{id:"DAY",label:"1d"},{id:"WEEK",label:"1w"}];function tv({dateRange:e,onDateRangeChange:t,windowSize:r,onWindowSizeChange:o,showWindowSize:n=true,showRangeSelector:a=true,allowDatePicker:i=false,lockWindowSize:s=false,restrictToSingleDay:c=false,presetRanges:l=[],windowSizeOptions:u=kR,autoAdjustWindowSize:d=false,className:m}){let[p,g]=useState(0),f=useRef(null),[b,x]=useState(false),v=P=>{let B=(P.before.getTime()-P.after.getTime())/(1e3*60*60);return B<=24?"FIFTEEN_MINUTES":B<=72||B<=168?"HOUR":("DAY")};useEffect(()=>{if(d&&!b&&o){let P=v(e);o(P);}},[e,d,b,o]);let C=P=>l.find(w=>{let B=w.getRange();return Math.abs(B.after.getTime()-P.after.getTime())<1e3*60*60*24&&Math.abs(B.before.getTime()-P.before.getTime())<1e3*60*60*24})?.id,[y,S]=useState(()=>C(e)),k=Ap(e.after),R=Ap(e.before),E=new Date(R);E.setDate(E.getDate()-1);let D={start:ls(k,jo()),end:ls(E,jo())};useEffect(()=>{let P=new ResizeObserver(w=>{for(let B of w)g(B.contentRect.width);});return f.current&&P.observe(f.current),()=>{f.current&&P.unobserve(f.current);}},[]);let L=[...u].sort((P,w)=>ev[P.id]-ev[w.id]),V=P=>{let w=P.toString(),B=l.find(M=>M.id===w);B&&(S(w),x(false),t(B.getRange()));},A=P=>{if(P?.start&&P?.end){S(void 0);let w=new Date(P.start.year,P.start.month-1,P.start.day,0,0,0,0),B=new Date(P.end.year,P.end.month-1,P.end.day+1,0,0,0,0);t({after:w,before:B});}},N=P=>{if(P){S(void 0);let w=new Date(P.year,P.month-1,P.day,0,0,0,0),B=new Date(P.year,P.month-1,P.day+1,0,0,0,0);t({after:w,before:B});}},T=P=>{o&&(x(true),o(P.toString()));},z=()=>{if(l.length>0){let P=l[0];S(P.id),x(false),t(P.getRange());}},W=(P,w=0)=>{let B=Ap(P),M=new Date(B);return w!==0&&M.setDate(M.getDate()+w),M.toLocaleDateString("en-US")},F=L.map(P=>({id:P.id,label:P.label,value:P.id})),K=l.map(P=>({id:P.id,label:P.label,value:P.id})),X=s?jsx("div",{className:"flex items-center rounded-md border border-border-muted bg-background-muted px-3 py-2 text-sm text-text-secondary",children:L.find(P=>P.id===r)?.label||r}):jsx(Zo,{className:"w-full md:w-auto",selectedKey:r,onSelectionChange:T,items:F,size:"md","aria-label":"Select Window Size",children:P=>jsx(At,{id:P.id,"aria-label":P.label,size:"md",children:P.label},P.id)}),G=c?jsx("div",{className:"flex items-center",children:jsxs(DialogTrigger,{children:[jsxs(Q,{className:"border-l pl-2 pr-2 hover:border-border-default hover:bg-background-muted hover:text-text-link-hover",variant:"secondary",children:[jsx(I,{name:"CalendarBlank",size:18}),jsx("span",{className:"ml-2 hidden md:block",children:W(e.after)})]}),jsx(Ze,{className:"w-auto p-3",disableGroup:true,children:jsx(Wn,{"aria-label":"Select date",value:Fa(k.toISOString().split("T")[0]),onChange:N})})]})}):jsxs("div",{className:"flex items-center",children:[jsxs(DialogTrigger,{children:[jsxs(Q,{className:"rounded-r-none border-l pl-2 pr-2 hover:border-border-default hover:bg-background-muted hover:text-text-link-hover",variant:"secondary",children:[jsx(I,{name:"CalendarBlank",size:18}),!y&&jsx("span",{className:"ml-2 hidden md:block",children:`${W(e.after)} - ${W(e.before,-1)}`})]}),jsx(Ze,{className:"w-auto p-3",disableGroup:true,children:jsx(_n,{"aria-label":"Date range calendar",value:D,onChange:A})})]}),!y&&jsx(Q,{variant:"ghost",size:"md",onPress:z,children:"Reset"})]}),Y=p<600;return jsx("div",{ref:f,className:twMerge("flex w-full flex-wrap items-center justify-between gap-4",m),children:Y?jsxs("div",{className:"flex w-full justify-between",children:[jsxs("div",{className:"flex items-center",children:[i&&G,a&&y!==void 0&&jsx(Zo,{selectedKey:y,onSelectionChange:V,items:K,size:"md","aria-label":"Select Date Range",children:P=>jsx(At,{id:P.id,size:"md",children:P.label},P.id)})]}),jsx("div",{className:"flex items-center",children:n&&r&&X})]}):jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-4",children:[i&&G,a&&y!==void 0&&jsx(sc,{options:l.map(P=>({id:P.id,label:P.label})),value:y,onChange:V,size:"sm",variant:"secondary","aria-label":"Select Date Range"})]}),jsx("div",{className:"flex items-center",children:n&&r&&X})]})})}function ER({isPlaceholder:e,isDisabled:t,size:r="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[r],e?"text-text-disabled italic":"text-text-primary",t?"text-text-disabled cursor-not-allowed":"cursor-text",!t&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function ov({label:e,description:t,errorMessage:r,size:o="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,reserveErrorSpace:c=true,validationResult:l,className:u,descriptionPlacement:d="below",...m}){return jsxs(TimeField,{...m,isDisabled:i,isRequired:a,isInvalid:s,className:Ce(u,"flex flex-col gap-1"),children:[e&&jsx(Me,{size:o,tooltip:n,description:d==="tooltip"||d==="inline"?t:void 0,descriptionPlacement:d,isRequired:a,children:e}),jsx(nt,{children:jsx(DateInput,{className:twMerge(xo({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:p=>jsx(DateSegment,{segment:p,className:ER({isPlaceholder:p.isPlaceholder,isDisabled:!p.isEditable||i,size:o})})})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof r=="string"?jsx(pe,{size:o,children:r}):typeof r=="function"&&l?jsx(pe,{size:o,children:r(l)}):t&&d==="below"?jsx(Se,{size:o,children:t}):null}):jsx(Fragment,{children:typeof r=="string"?jsx(pe,{size:o,className:"mt-1",children:r}):typeof r=="function"&&l?jsx(pe,{size:o,className:"mt-1",children:r(l)}):t&&d==="below"?jsx(Se,{size:o,className:"mt-1",children:t}):null})]})}function nv({children:e,className:t=""}){return jsx("div",{className:`flex flex-col ${t}`.trim(),role:"list",children:e})}function av({children:e,variant:t="default",icon:r,label:o,isLast:n=false,className:a=""}){let s={default:{dot:"bg-border-default border-border-default",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary"},active:{dot:"bg-text-primary border-text-primary",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary font-medium"},muted:{dot:"bg-border-muted border-border-muted",line:"bg-border-muted",label:"text-text-secondary",content:"text-text-secondary"},success:{dot:"bg-feedback-success-border border-feedback-success-border",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary"},error:{dot:"bg-feedback-error-border border-feedback-error-border",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary"},warning:{dot:"bg-feedback-warning-border border-feedback-warning-border",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary"},info:{dot:"bg-feedback-info-border border-feedback-info-border",line:"bg-border-default",label:"text-text-secondary",content:"text-text-primary"}}[t];return jsxs("div",{className:`flex gap-3 ${a}`.trim(),role:"listitem",children:[jsxs("div",{className:"flex flex-col items-center",style:{width:"20px"},children:[jsx("div",{className:`flex items-center justify-center rounded-full border-2 ${s.dot}`,style:{width:"20px",height:"20px",flexShrink:0},children:r&&jsx(I,{name:r,size:12,className:"text-background-body"})}),!n&&jsx("div",{className:`w-0.5 flex-1 ${s.line}`,style:{minHeight:"24px"}})]}),jsxs("div",{className:"flex-1 pb-6",children:[o&&jsx("div",{className:`text-xs mb-1 ${s.label}`,children:o}),jsx("div",{className:`text-sm ${s.content}`,children:e})]})]})}function BR(e){return "primary"}var VR="flex font-medium justify-center items-center gap-2 text-center transition whitespace-nowrap box-border",iv={primary:{selected:"bg-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",unselected:"bg-transparent text-action-primary border-2 border-border-muted hover:bg-text-primary/[0.05] forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]"}},zR="opacity-[--control-hover-opacity] cursor-not-allowed pointer-events-none grayscale",OR="opacity-100 cursor-pointer",HR={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},WR={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-action-destructive text-[color:var(--color-action-destructive-text)]"};function GR(e){let{variant:t="primary",size:r="md",isDisabled:o,isSelected:n,borderRadius:a,borderRight:i,borderLeft:s}=e,c=BR(),l=`${VR} ${n?iv[c].selected:iv[c].unselected}`;return l+=` ${Le[r].text} ${Le[r].height} ${Le[r].padding} ${Le[r].gap}`,l+=` ${o?zR:OR}`,a==="left"&&(l+=" rounded-l-sm"),a==="right"&&(l+=" rounded-r-sm"),i&&(l+=" border-r"),s&&(l+=" border-l"),l+=` ${Oe()}`,(l+=" focus-visible:outline-action-primary"),twMerge(l)}function lv(e){let{className:t,children:r,onPress:o,icon:n,iconPosition:a="left",iconWeight:i,isLoading:s=false,loadingText:c,loadingIndicator:l,size:u="md",badgeNumber:d,badgeVariant:m="primary",badgePosition:p="top-right",...g}=e,f=n?jsx(I,{name:n,size:u,weight:i}):null,b=()=>{let v=jsxs(Fragment,{children:[a==="left"&&f,r,a==="right"&&f]});return s?jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l||jsx(I,{name:"CircleNotch",size:u,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:v}),c&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:c})]}):v},x=jsx(ToggleButton,{onPress:o,...g,className:twMerge(GR(e),t),"aria-busy":s,children:b()});return d&&d>0?jsxs("div",{className:"relative",children:[x,jsx("span",{className:`absolute ${HR[p]} flex h-5 w-5 items-center justify-center rounded-full ${WR[m]} text-xs`,"aria-label":`${d} items`,children:d})]}):x}var Ri={app:{icon:"AppWindow",label:{singular:"App",plural:"Apps"},description:"Workspace and integration apps"},site:{icon:"MapPin",label:{singular:"Site",plural:"Sites"},description:"Physical locations with energy systems"},device:{icon:"ShareNetwork",label:{singular:"Device",plural:"Devices"},description:"Connected energy devices"},customer:{icon:"Users",label:{singular:"Customer",plural:"Customers"},description:"End customers and site owners"},contact:{icon:"Users",label:{singular:"Contact",plural:"Contacts"},description:"Contact persons"},program:{icon:"ClipboardText",label:{singular:"Program",plural:"Programs"},description:"Demand response and VPP programs"},workflow:{icon:"FlowArrow",label:{singular:"Workflow",plural:"Workflows"},description:"Automated workflows and rules"},collection:{icon:"Stack",label:{singular:"Collection",plural:"Collections"},description:"Grouped entities"},board:{icon:"SquaresFour",label:{singular:"Board",plural:"Boards"},description:"Dashboard and monitoring boards"},report:{icon:"ChartLine",label:{singular:"Report",plural:"Reports"},description:"Analytics and reports"},event:{icon:"ClockCounterClockwise",label:{singular:"Event",plural:"Events"},description:"System events and activity"},alert:{icon:"Warning",label:{singular:"Alert",plural:"Alerts"},description:"Notifications and alerts"},monitor:{icon:"Pulse",label:{singular:"Monitor",plural:"Monitors"},description:"Threshold and status monitors"},command:{icon:"Play",label:{singular:"Command",plural:"Commands"},description:"Device commands and control"}};function YR(e){return Ri[e]}function KR(e){return Ri[e].icon}function JR(e,t=false){return t?Ri[e].label.plural:Ri[e].label.singular}function jR({formId:e="dialog-form",onSubmit:t,primaryLabel:r="Save",secondaryLabel:o="Cancel",onCancel:n,primaryVariant:a,secondaryVariant:i="secondary",children:s,title:c,...l}){return jsx(rr,{title:c,primaryAction:{label:r,onPress:()=>{let d=document.getElementById(e);d&&d.requestSubmit();},variant:a},secondaryAction:n?{label:o,onPress:n,variant:i}:void 0,...l,children:jsx(na,{id:e,onSubmit:t,children:s})})}function qR({formId:e="drawer-form",onSubmit:t,primaryLabel:r="Save",secondaryLabel:o="Cancel",onCancel:n,primaryVariant:a,secondaryVariant:i="secondary",children:s,...c}){return jsx(ii,{primaryAction:{label:r,onPress:()=>{let u=document.getElementById(e);u&&u.requestSubmit();},variant:a},secondaryAction:n?{label:o,onPress:n,variant:i}:void 0,...c,children:jsx(na,{id:e,onSubmit:t,className:"mt-2",children:s})})}function XR({align:e="end",className:t,...r}){return jsx("div",{...r,className:twMerge("flex gap-2",e==="start"?"justify-start":e==="between"?"justify-between":"justify-end",t)})}var _R={sm:"gap-2",md:"gap-4",lg:"gap-6"};function e3(e){if(!e)return "";let t=e.base?`grid-cols-${e.base}`:"",r=e.md?`md:grid-cols-${e.md}`:"",o=e.lg?`lg:grid-cols-${e.lg}`:"";return [t,r,o].filter(Boolean).join(" ")}function t3({cols:e={base:1},gap:t="lg",className:r,...o}){return jsx("div",{...o,className:twMerge("grid",e3(e),_R[t],r)})}function n3({title:e,description:t,showDivider:r,className:o,children:n,...a}){return jsxs("section",{...a,className:twMerge("flex flex-col",o),children:[(e||t)&&jsxs("div",{className:"flex flex-col gap-1 mb-6",children:[typeof e=="string"?jsx(Et,{tag:"h3",size:"sm",children:e}):e,t?jsx(Se,{size:"lg",children:t}):null]}),jsx("div",{className:"flex flex-col gap-6",children:n}),r&&jsx("hr",{className:"mt-2 border-border-muted"})]})}function a3(){return jsx("hr",{className:"border-border-muted"})}function i3({steps:e,currentStepId:t,onStepClick:r,className:o}){let n=e.findIndex(a=>a.id===t);return jsx("nav",{"aria-label":"Progress",className:twMerge("w-full",o),children:jsx("div",{className:"relative mb-12",children:jsx("ol",{className:"relative flex items-start justify-between",children:e.map((a,i)=>{let s=a.id===t,c=i<n,l=r&&(c||s);return jsxs("li",{className:"relative flex flex-col items-center",style:{flex:`1 1 ${100/e.length}%`},children:[jsx("button",{type:"button",disabled:!l,onClick:()=>l&&r?.(a.id),className:twMerge("relative z-10 flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full border-2 transition-colors bg-background-body",c&&"border-action-primary bg-action-primary text-text-inverse hover:bg-action-primary/90",s&&"border-action-primary bg-background-body text-action-primary",!c&&!s&&"border-border-default bg-background-body text-text-secondary",l&&"cursor-pointer",!l&&"cursor-default"),"aria-current":s?"step":void 0,children:c?jsx(I,{name:"Check",size:20,weight:"bold"}):jsx("span",{className:"text-sm font-semibold",children:i+1})}),i<e.length-1&&jsx("div",{className:"absolute top-5 h-0.5 transition-colors",style:{left:"50%",width:"100%",marginLeft:"20px",backgroundColor:i<n?"var(--color-action-primary)":"var(--color-border-default)"}}),jsxs("div",{className:"mt-3 flex flex-col items-center text-center w-32",children:[jsx("span",{className:twMerge("text-sm font-medium",s&&"text-text-default",c&&"text-text-primary",!s&&!c&&"text-text-secondary"),children:a.title}),a.description&&jsx("span",{className:"mt-1 text-xs text-text-secondary",children:a.description})]})]},a.id)})})})})}function l3({formId:e,show:t,isSubmitting:r,onCancel:o,primaryLabel:n="Save changes",secondaryLabel:a="Cancel",className:i}){return t?jsx("div",{className:twMerge("fixed inset-x-0 bottom-0 z-40 border-t border-border-muted bg-background-surface/95 backdrop-blur supports-[backdrop-filter]:bg-background-surface/70",i),children:jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsx("div",{className:"text-sm text-text-secondary",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(Q,{variant:"secondary",onPress:o,children:a}),jsx(Q,{type:"submit",form:e,isDisabled:!!r,children:r?"Saving...":n})]})]})}):null}function c3({when:e,message:t="You have unsaved changes. Leave anyway?"}){return Ee.useEffect(()=>{if(!e)return;let r=o=>(o.preventDefault(),o.returnValue=t,t);return window.addEventListener("beforeunload",r),()=>window.removeEventListener("beforeunload",r)},[e,t]),null}function d3({steps:e,initialStepId:t,canNavigate:r}){if(e.length===0)throw new Error("useWizard: steps array cannot be empty");let[o,n]=Ee.useState(t||e[0].id),a=e.findIndex(d=>d.id===o),i=a>0,s=a<e.length-1,c=async d=>d===o?true:r&&!await r(o,d)?false:(n(d),true);return {steps:e,currentStepId:o,setCurrentStepId:c,next:async()=>!s||a===-1?false:c(e[a+1].id),prev:async()=>!i||a===-1?false:c(e[a-1].id),hasNext:s,hasPrev:i,stepIndex:a}}function Are(e){switch(e){case "charging":case "on":return "success";case "discharging":return "warning";case "heat":case "cool":return "info";case "off":case "idle":case "eco":case "auto":return "neutral";default:return "neutral"}}/*! Bundled license information:
115
115
 
116
116
  react-is/cjs/react-is.production.min.js:
117
117
  (** @license React v16.13.1