tokentracker-cli 0.3.0 → 0.3.5

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.
@@ -0,0 +1,12 @@
1
+ import{r as m,u as bn,i as Ng,a as nt,g as Ig,b as yr,c as br,d as Wt,e as Ei,f as ks,h as fo,j as ia,k as cr,t as xt,l as _,T as Fg,m as b,n as Te,o as Bn,p as id,q as ad,s as he,N as ld,v as ts,w as ns,x as pn,y as Ve,z as Hr,E as Nn,A as jg,B as sn,C as Vl,D as ut,F as cd,G as vt,H as At,I as mn,J as or,K as Ae,L as on,M as _l,O as aa,P as la,Q as ur,R as In,S as Lg,U as ud,V as Vg,W as rs,X as ho,Y as dd,Z as _g,_ as fd,$ as Wg,a0 as hd,a1 as md,a2 as q,a3 as ca,a4 as pd,a5 as Bg,a6 as $g,a7 as Yg,a8 as Hg,a9 as Ug,aa as Gg,ab as Kg,ac as zg,ad as Qt,ae as qg,af as Xg,ag as Io}from"./main-DSjEYl46.js";import{g as Zg,a as ua,b as Qg,c as Jg,d as ey,e as Fo,f as ty,r as ny,h as Wl,i as ry,j as sy,t as oy,s as iy}from"./vibeusage-api-B9iVLrJk.js";const ay=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ly=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Bl=e=>{const t=ly(e);return t.charAt(0).toUpperCase()+t.slice(1)},gd=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),cy=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var uy={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const dy=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...a},l)=>m.createElement("svg",{ref:l,...uy,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:gd("lucide",s),...!o&&!cy(a)&&{"aria-hidden":"true"},...a},[...i.map(([c,u])=>m.createElement(c,u)),...Array.isArray(o)?o:[o]]));const fy=(e,t)=>{const n=m.forwardRef(({className:r,...s},o)=>m.createElement(dy,{ref:o,iconNode:t,className:gd(`lucide-${ay(Bl(e))}`,`lucide-${e}`,r),...s}));return n.displayName=Bl(e),n};const hy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],my=fy("info",hy),py=500,gy={style:{transition:"none"}},yd="data-base-ui-click-trigger",yy={fallbackAxisSide:"end"},by={clipPath:"inset(50%)",position:"fixed",top:0,left:0},xy=[];function da(e){m.useEffect(e,xy)}const Rr=0;class gn{static create(){return new gn}currentId=Rr;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Rr,n()},t)}isStarted(){return this.currentId!==Rr}clear=()=>{this.currentId!==Rr&&(clearTimeout(this.currentId),this.currentId=Rr)};disposeEffect=()=>this.clear}function Vn(){const e=bn(gn.create).current;return da(e.disposeEffect),e}function $n(e){return e?.ownerDocument||document}const xr=typeof navigator<"u",jo=Sy(),bd=Cy(),xd=Ty(),vy=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),vd=jo.platform==="MacIntel"&&jo.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(jo.platform),wy=xr&&/apple/i.test(navigator.vendor),Mi=xr&&/android/i.test(bd)||/android/i.test(xd);xr&&bd.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const ky=xd.includes("jsdom/");function Sy(){if(!xr)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function Ty(){if(!xr)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function Cy(){if(!xr)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const Di="data-base-ui-focusable",wd="active",kd="selected",Sd="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Qn(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function we(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Ng(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function dt(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Ct(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Ey(e){return e.matches("html,body")}function qe(e){return e?.ownerDocument||document}function Td(e){return nt(e)&&e.matches(Sd)}function $l(e){return e?e.getAttribute("role")==="combobox"&&Td(e):!1}function Pi(e){return e?e.hasAttribute(Di)?e:e.querySelector(`[${Di}]`)||e:null}function Fn(e,t,n=!0){return e.filter(s=>s.parentId===t&&(!n||s.context?.open)).flatMap(s=>[s,...Fn(e,s.id,n)])}function Yl(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(o=>o.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function My(e){e.preventDefault(),e.stopPropagation()}function Dy(e){return"nativeEvent"in e}function Py(e){return e.mozInputSource===0&&e.isTrusted?!0:Mi&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ry(e){return ky?!1:!Mi&&e.width===0&&e.height===0||Mi&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function dr(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Cd(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const Oy=["top","right","bottom","left"],fr=Math.min,ft=Math.max,Gs=Math.round,Ss=Math.floor,Ht=e=>({x:e,y:e}),Ay={left:"right",right:"left",bottom:"top",top:"bottom"};function Ri(e,t,n){return ft(e,fr(t,n))}function nn(e,t){return typeof e=="function"?e(t):e}function it(e){return e.split("-")[0]}function xn(e){return e.split("-")[1]}function fa(e){return e==="x"?"y":"x"}function ha(e){return e==="y"?"height":"width"}function yt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ma(e){return fa(yt(e))}function Ny(e,t,n){n===void 0&&(n=!1);const r=xn(e),s=ma(e),o=ha(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Ks(i)),[i,Ks(i)]}function Iy(e){const t=Ks(e);return[Oi(e),t,Oi(t)]}function Oi(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Hl=["left","right"],Ul=["right","left"],Fy=["top","bottom"],jy=["bottom","top"];function Ly(e,t,n){switch(e){case"top":case"bottom":return n?t?Ul:Hl:t?Hl:Ul;case"left":case"right":return t?Fy:jy;default:return[]}}function Vy(e,t,n,r){const s=xn(e);let o=Ly(it(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(Oi)))),o}function Ks(e){const t=it(e);return Ay[t]+e.slice(t.length)}function _y(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ed(e){return typeof e!="number"?_y(e):{top:e,right:e,bottom:e,left:e}}function zs(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}var Wy=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],qs=Wy.join(","),Md=typeof Element>"u",hr=Md?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Xs=!Md&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},Zs=function(t,n){var r;n===void 0&&(n=!0);var s=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),o=s===""||s==="true",i=o||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):Zs(t.parentNode));return i},By=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Dd=function(t,n,r){if(Zs(t))return[];var s=Array.prototype.slice.apply(t.querySelectorAll(qs));return n&&hr.call(t,qs)&&s.unshift(t),s=s.filter(r),s},Qs=function(t,n,r){for(var s=[],o=Array.from(t);o.length;){var i=o.shift();if(!Zs(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=Qs(l,!0,r);r.flatten?s.push.apply(s,c):s.push({scopeParent:i,candidates:c})}else{var u=hr.call(i,qs);u&&r.filter(i)&&(n||!t.includes(i))&&s.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),f=!Zs(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&f){var h=Qs(d===!0?i.children:d.children,!0,r);r.flatten?s.push.apply(s,h):s.push({scopeParent:i,candidates:h})}else o.unshift.apply(o,i.children)}}return s},Pd=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Rd=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||By(t))&&!Pd(t)?0:t.tabIndex},$y=function(t,n){var r=Rd(t);return r<0&&n&&!Pd(t)?0:r},Yy=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Od=function(t){return t.tagName==="INPUT"},Hy=function(t){return Od(t)&&t.type==="hidden"},Uy=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Gy=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Ky=function(t){if(!t.name)return!0;var n=t.form||Xs(t),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},s;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")s=r(window.CSS.escape(t.name));else try{s=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var o=Gy(s,t.form);return!o||o===t},zy=function(t){return Od(t)&&t.type==="radio"},qy=function(t){return zy(t)&&!Ky(t)},Xy=function(t){var n,r=t&&Xs(t),s=(n=r)===null||n===void 0?void 0:n.host,o=!1;if(r&&r!==t){var i,a,l;for(o=!!((i=s)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(s)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!o&&s;){var c,u,d;r=Xs(s),s=(c=r)===null||c===void 0?void 0:c.host,o=!!((u=s)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(s))}}return o},Gl=function(t){var n=t.getBoundingClientRect(),r=n.width,s=n.height;return r===0&&s===0},Zy=function(t,n){var r=n.displayCheck,s=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var o=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}if(getComputedStyle(t).visibility==="hidden")return!0;var i=hr.call(t,"details>summary:first-of-type"),a=i?t.parentElement:t;if(hr.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof s=="function"){for(var l=t;t;){var c=t.parentElement,u=Xs(t);if(c&&!c.shadowRoot&&s(c)===!0)return Gl(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=l}if(Xy(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Gl(t);return!1},Qy=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var s=n.children.item(r);if(s.tagName==="LEGEND")return hr.call(n,"fieldset[disabled] *")?!0:!s.contains(t)}return!0}n=n.parentElement}return!1},Ai=function(t,n){return!(n.disabled||Hy(n)||Zy(n,t)||Uy(n)||Qy(n))},Ni=function(t,n){return!(qy(n)||Rd(n)<0||!Ai(t,n))},Jy=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ad=function(t){var n=[],r=[];return t.forEach(function(s,o){var i=!!s.scopeParent,a=i?s.scopeParent:s,l=$y(a,i),c=i?Ad(s.candidates):a;l===0?i?n.push.apply(n,c):n.push(a):r.push({documentOrder:o,tabIndex:l,item:s,isScope:i,content:c})}),r.sort(Yy).reduce(function(s,o){return o.isScope?s.push.apply(s,o.content):s.push(o.content),s},[]).concat(n)},ss=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Qs([t],n.includeContainer,{filter:Ni.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Jy}):r=Dd(t,n.includeContainer,Ni.bind(null,n)),Ad(r)},eb=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Qs([t],n.includeContainer,{filter:Ai.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Dd(t,n.includeContainer,Ai.bind(null,n)),r},Nd=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return hr.call(t,qs)===!1?!1:Ni(n,t)};const vr=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Id(e,t){const n=ss(e,vr()),r=n.length;if(r===0)return;const s=Qn(qe(e)),o=n.indexOf(s),i=o===-1?t===1?0:r-1:o+t;return n[i]}function pa(e){return Id(qe(e).body,1)||e}function Fd(e){return Id(qe(e).body,-1)||e}function jd(e,t){if(!e)return null;const n=ss(qe(e).body,vr()),r=n.length;if(r===0)return null;const s=n.indexOf(e);if(s===-1)return null;const o=(s+t+r)%r;return n[o]}function tb(e){return jd(e,1)}function nb(e){return jd(e,-1)}function ir(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!we(n,r)}function rb(e){ss(e,vr()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Kl(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function sb({baseUrl:e,accessToken:t,guestAllowed:n=!1,weeks:r=52,weekStartsOn:s="sun",cacheKey:o,timeZone:i,tzOffsetMinutes:a,now:l}={}){const c=m.useMemo(()=>Ig({weeks:r,weekStartsOn:s,now:l}),[l,r,s]),[u,d]=m.useState([]),[f,h]=m.useState(null),[p,g]=m.useState("edge"),[y,w]=m.useState(!1),[x,v]=m.useState(null),k=yr(),S=br(t),C=!n,M=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),D=m.useMemo(()=>{if(!o)return null;const j=fo({timeZone:i,offsetMinutes:a});return`vibeusage.heatmap.${o}.${r}.${s}.${j}`},[o,i,a,r,s]),F=m.useCallback(()=>{if(!D||typeof window>"u")return null;try{const j=window.localStorage.getItem(D);if(!j)return null;const N=JSON.parse(j);return!N||!N.heatmap?null:N}catch{return null}},[D]),T=m.useCallback(j=>{if(!(!D||typeof window>"u"))try{window.localStorage.setItem(D,JSON.stringify(j))}catch{}},[D]),R=m.useCallback(()=>{if(!(!D||typeof window>"u"))try{window.localStorage.removeItem(D)}catch{}},[D]),A=m.useCallback(async()=>{const j=await Wt(t);if(!(!j&&!k&&!M)){w(!0),v(null);try{try{const P=await Zg({baseUrl:e,accessToken:j,weeks:r,to:c.to,weekStartsOn:s,timeZone:i,tzOffsetMinutes:a}),I=Array.isArray(P?.weeks)?P.weeks:[];if(!I.length&&C){const W=F();if(W?.heatmap){h(W.heatmap),d(W.daily||[]),g("cache");return}}if(!I.some(W=>(Array.isArray(W)?W:[]).some(Q=>Q&&Number.isFinite(Number(Q.level))))&&I.length){const W=[];for(const Y of I)for(const $ of Array.isArray(Y)?Y:[])$?.day&&W.push({day:$.day,total_tokens:$.total_tokens??$.value??0,billable_total_tokens:$.billable_total_tokens??$.value??$.total_tokens??0});const Q=Ei({dailyRows:W,weeks:r,to:P?.to||c.to,weekStartsOn:s});d(W),h({...Q,week_starts_on:s,active_days:W.filter(Y=>Number(Y?.billable_total_tokens??Y?.total_tokens)>0).length,streak_days:ks({dailyRows:W,to:P?.to||c.to})}),g("client"),C?T({heatmap:{...Q,week_starts_on:s,active_days:W.filter(Y=>Number(Y?.billable_total_tokens??Y?.total_tokens)>0).length,streak_days:ks({dailyRows:W,to:P?.to||c.to})},daily:W,fetchedAt:new Date().toISOString()}):R();return}h(P||null),d([]),g("edge"),P&&C?T({heatmap:P,daily:[],fetchedAt:new Date().toISOString()}):C||R();return}catch(P){const I=P,B=I?.status??I?.statusCode;if(B===401||B===403)throw P}const N=await ua({baseUrl:e,accessToken:j,from:c.from,to:c.to,timeZone:i,tzOffsetMinutes:a}),V=Array.isArray(N?.data)?N.data:[];d(V);const U=Ei({dailyRows:V,weeks:r,to:c.to,weekStartsOn:s});h({...U,week_starts_on:s,active_days:V.filter(P=>Number(P?.billable_total_tokens??P?.total_tokens)>0).length,streak_days:ks({dailyRows:V,to:c.to})}),g("client"),C?T({heatmap:{...U,week_starts_on:s,active_days:V.filter(P=>Number(P?.billable_total_tokens??P?.total_tokens)>0).length,streak_days:ks({dailyRows:V,to:c.to})},daily:V,fetchedAt:new Date().toISOString()}):R()}catch(N){if(C){const V=F();if(V?.heatmap)h(V.heatmap),d(V.daily||[]),g("cache"),v(null);else{const U=N;v(U?.message||String(U)),d([]),h(null),g("edge")}}else{const V=N;v(V?.message||String(V)),d([]),h(null),g("edge")}}finally{w(!1)}}},[t,e,k,n,C,c.from,c.to,F,S,i,a,s,r,R,T,M]);return m.useEffect(()=>{if(!S&&!n&&!k&&!M){d([]),w(!1),v(null),h(null),g("edge");return}if(!C)R(),d([]),v(null),h(null),g("edge");else{const j=F();j?.heatmap&&(h(j.heatmap),d(j.daily||[]),g("cache"))}A()},[t,k,F,A,S,n,C,R,M]),{range:c,daily:u,heatmap:f,source:k?"mock":p==="client"?"edge":p,loading:y,error:x,refresh:A}}function ob({baseUrl:e,accessToken:t,limit:n=3,from:r,to:s,source:o,timeZone:i,tzOffsetMinutes:a}={}){const[l,c]=m.useState([]),[u,d]=m.useState(!1),[f,h]=m.useState(null),p=yr(),g=br(t),y=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),w=m.useCallback(async()=>{const x=await Wt(t);if(!x&&!p&&!y){c([]),h(null),d(!1);return}d(!0),h(null);try{const v=await Qg({baseUrl:e,accessToken:x,limit:n,from:r,to:s,source:o,timeZone:i,tzOffsetMinutes:a});c(Array.isArray(v?.entries)?v.entries:[])}catch(v){const k=v?.message||String(v);h(k),c([])}finally{d(!1)}},[t,e,r,n,p,o,i,s,a,y]);return m.useEffect(()=>{if(!g&&!p&&!y){c([]),h(null),d(!1);return}w()},[p,w,g,y]),{entries:l,loading:u,error:f,refresh:w}}const ib=24;function ab({baseUrl:e,accessToken:t,guestAllowed:n=!1,period:r,from:s,to:o,months:i=ib,cacheKey:a,timeZone:l,tzOffsetMinutes:c,now:u,sharedRows:d,sharedRange:f}={}){const[h,p]=m.useState([]),[g,y]=m.useState(()=>({from:s,to:o})),[w,x]=m.useState("edge"),[v,k]=m.useState(null),[S,C]=m.useState(!1),[M,D]=m.useState(null),F=yr(),T=br(t),R=!n,A=Array.isArray(d),E=f?.from||s,j=f?.to||o,N=m.useMemo(()=>r==="day"?"hourly":r==="total"?"monthly":"daily",[r]),V=(()=>{if(!a)return null;const Y=lb(e)||"default",$=fo({timeZone:l,offsetMinutes:c});if(N==="hourly")return`vibeusage.trend.${a}.${Y}.hourly.${o||s||"day"}.${$}`;if(N==="monthly")return`vibeusage.trend.${a}.${Y}.monthly.${i}.${o||"today"}.${$}`;const z=`${s||""}.${o||""}`;return`vibeusage.trend.${a}.${Y}.daily.${z}.${$}`})(),U=m.useCallback(()=>{if(!V||typeof window>"u")return null;try{const Y=window.localStorage.getItem(V);if(!Y)return null;const $=JSON.parse(Y);return!$||!Array.isArray($.rows)?null:$}catch{return null}},[V]),P=m.useCallback(Y=>{if(!(!V||typeof window>"u"))try{window.localStorage.setItem(V,JSON.stringify(Y))}catch{}},[V]),I=m.useCallback(()=>{if(!(!V||typeof window>"u"))try{window.localStorage.removeItem(V)}catch{}},[V]),B=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),W=m.useCallback(async()=>{if(A){p(Array.isArray(d)?d:[]),y({from:E,to:j}),x("shared"),k(null),C(!1),D(null);return}const Y=await Wt(t);if(!(!Y&&!F&&!B)){C(!0),D(null);try{let $;N==="hourly"?$=await Jg({baseUrl:e,accessToken:Y,day:o||s,timeZone:l,tzOffsetMinutes:c}):N==="monthly"?$=await ey({baseUrl:e,accessToken:Y,months:i,to:o,timeZone:l,tzOffsetMinutes:c}):$=await ua({baseUrl:e,accessToken:Y,from:s,to:o,timeZone:l,tzOffsetMinutes:c});const z=$?.from||s||$?.day||null,Z=$?.to||o||$?.day||null;let ce=Array.isArray($?.data)?$.data:[];N==="daily"?ce=Vo(ce,z||s,Z||o,{timeZone:l,offsetMinutes:c,now:u}):N==="hourly"?ce=_o(ce,{timeZone:l,offsetMinutes:c,now:u}):N==="monthly"&&(ce=Wo(ce,{timeZone:l,offsetMinutes:c,now:u}));const Se=new Date().toISOString();p(ce),y({from:z,to:Z}),x("edge"),k(Se),R?P({rows:ce,from:z,to:Z,mode:N,fetchedAt:Se}):I()}catch($){if(R){const z=U();if(z?.rows){let Z=N==="daily"?Vo(z.rows||[],z.from||s,z.to||o,{timeZone:l,offsetMinutes:c,now:u}):Array.isArray(z.rows)?z.rows:[];N==="hourly"?Z=_o(Z,{timeZone:l,offsetMinutes:c,now:u}):N==="monthly"&&(Z=Wo(Z,{timeZone:l,offsetMinutes:c,now:u})),p(Z),y({from:z.from||s,to:z.to||o}),x("cache"),k(z.fetchedAt||null),D(null)}else{p([]),y({from:s,to:o}),x("edge"),k(null);const Z=$;D(Z?.message||String(Z))}}else{p([]),y({from:s,to:o}),x("edge"),k(null);const z=$;D(z?.message||String(z))}}finally{C(!1)}}},[t,e,s,F,n,R,N,i,U,T,A,E,d,j,l,o,c,u,I,P,B]);m.useEffect(()=>{if(A){p(Array.isArray(d)?d:[]),y({from:E,to:j}),x("shared"),k(null),C(!1),D(null);return}if(!T&&!n&&!F&&!B){p([]),y({from:s,to:o}),D(null),C(!1),x("edge"),k(null);return}if(!R)I(),p([]),y({from:s,to:o}),D(null),x("edge"),k(null);else{const Y=U();if(Y?.rows){let $=N==="daily"?Vo(Y.rows||[],Y.from||s,Y.to||o,{timeZone:l,offsetMinutes:c,now:u}):Array.isArray(Y.rows)?Y.rows:[];N==="hourly"?$=_o($,{timeZone:l,offsetMinutes:c,now:u}):N==="monthly"&&($=Wo($,{timeZone:l,offsetMinutes:c,now:u})),p($),y({from:Y.from||s,to:Y.to||o}),x("cache"),k(Y.fetchedAt||null)}}W()},[t,F,U,W,A,E,d,j,T,n,R,I,B]);const Q=F?"mock":w;return{rows:h,from:g.from||s,to:g.to||o,source:Q,fetchedAt:v,loading:S,error:M,refresh:W}}function lb(e){try{return new URL(e).host}catch{return null}}function Lo(e){if(!e)return null;const t=String(e).trim(),n=t.split("-");if(n.length!==3)return null;const r=Number(n[0]),s=Number(n[1])-1,o=Number(n[2]);if(!Number.isFinite(r)||!Number.isFinite(s)||!Number.isFinite(o))return null;const i=new Date(Date.UTC(r,s,o));return Number.isFinite(i.getTime())&&cr(i)===t?i:null}function cb(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function Vo(e,t,n,{timeZone:r,offsetMinutes:s,now:o}={}){const i=Lo(t),a=Lo(n);if(!i||!a||a<i)return Array.isArray(e)?e:[];const l=o instanceof Date&&Number.isFinite(o.getTime())?o:new Date,c=ia({timeZone:r,offsetMinutes:s,date:l}),u=Lo(c),d=u?u.getTime():l.getTime(),f=new Map;for(const p of e||[])p?.day&&f.set(p.day,p);const h=[];for(let p=i;p<=a;p=cb(p,1)){const g=cr(p),y=f.get(g),w=p.getTime()>d;if(y){h.push({...y,missing:!1,future:w});continue}h.push({day:g,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!w,future:w})}return h}function _o(e,{timeZone:t,offsetMinutes:n,now:r}={}){if(!Array.isArray(e))return[];const s=Ld({timeZone:t,offsetMinutes:n,now:r});return s?e.map(o=>{const i=o?.hour||o?.label||"",a=ub(i);if(!a)return{...o,future:!1};const l=a.dayNum>s.dayNum||a.dayNum===s.dayNum&&a.slot>s.slot;return{...o,future:l}}):e}function Wo(e,{timeZone:t,offsetMinutes:n,now:r}={}){if(!Array.isArray(e))return[];const s=Ld({timeZone:t,offsetMinutes:n,now:r});return s?e.map(o=>{const i=o?.month||o?.label||"",a=db(i);if(!a)return{...o,future:!1};const l=a.year>s.year||a.year===s.year&&a.month>s.month;return{...o,future:l}}):e}function Ld({timeZone:e,offsetMinutes:t,now:n}={}){const r=n instanceof Date&&Number.isFinite(n.getTime())?n:new Date;if(e&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const f=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(r).reduce((x,v)=>(v.type&&v.value&&(x[v.type]=v.value),x),{}),h=Number(f.year),p=Number(f.month),g=Number(f.day),y=Number(f.hour),w=Number(f.minute);if(Number.isFinite(h)&&Number.isFinite(p)&&Number.isFinite(g)&&Number.isFinite(y)&&Number.isFinite(w)){const x=y*2+(w>=30?1:0);return{year:h,month:p,day:g,hour:y,minute:w,dayNum:h*1e4+p*100+g,slot:x}}}catch{}if(Number.isFinite(t)){const u=new Date(r.getTime()+t*60*1e3),d=u.getUTCFullYear(),f=u.getUTCMonth()+1,h=u.getUTCDate(),p=u.getUTCHours(),g=u.getUTCMinutes(),y=p*2+(g>=30?1:0);return{year:d,month:f,day:h,hour:p,minute:g,dayNum:d*1e4+f*100+h,slot:y}}const s=r.getFullYear(),o=r.getMonth()+1,i=r.getDate(),a=r.getHours(),l=r.getMinutes(),c=a*2+(l>=30?1:0);return{year:s,month:o,day:i,hour:a,minute:l,dayNum:s*1e4+o*100+i,slot:c}}function ub(e){if(!e)return null;const t=String(e).trim(),[n,r]=t.split("T");if(!n||!r)return null;const s=n.split("-");if(s.length!==3)return null;const o=Number(s[0]),i=Number(s[1]),a=Number(s[2]);if(!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(a))return null;const l=r.split(":"),c=Number(l[0]),u=Number(l[1]);if(!Number.isFinite(c)||c<0||c>23||!Number.isFinite(u)||u<0||u>59)return null;const d=c*2+(u>=30?1:0);return{dayNum:o*1e4+i*100+a,slot:d}}function db(e){if(!e)return null;const n=String(e).trim().split("-");if(n.length!==2)return null;const r=Number(n[0]),s=Number(n[1]);return!Number.isFinite(r)||!Number.isFinite(s)||s<1||s>12?null:{year:r,month:s}}function zl({baseUrl:e,accessToken:t,guestAllowed:n=!1,from:r,to:s,includeDaily:o=!0,cacheKey:i,timeZone:a,tzOffsetMinutes:l,now:c}={}){const[u,d]=m.useState([]),[f,h]=m.useState(null),[p,g]=m.useState(null),[y,w]=m.useState("edge"),[x,v]=m.useState(null),[k,S]=m.useState(!1),[C,M]=m.useState(null),D=yr(),F=br(t),T=!n,R=(()=>{if(!i)return null;const P=fb(e)||"default",I=o?"daily":"summary",B=fo({timeZone:a,offsetMinutes:l});return`vibeusage.usage.${i}.${P}.${r}.${s}.${I}.${B}`})(),A=m.useCallback(()=>{if(!R||typeof window>"u")return null;try{const P=window.localStorage.getItem(R);if(!P)return null;const I=JSON.parse(P);return!I||!I.summary?null:I}catch{return null}},[R]),E=m.useCallback(P=>{if(!(!R||typeof window>"u"))try{window.localStorage.setItem(R,JSON.stringify(P))}catch{}},[R]),j=m.useCallback(()=>{if(!(!R||typeof window>"u"))try{window.localStorage.removeItem(R)}catch{}},[R]),N=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),V=m.useCallback(async()=>{const P=await Wt(t);if(!(!P&&!D&&!N)){S(!0),M(null);try{let I=null,B=null;if(o){const[z,Z]=await Promise.allSettled([ua({baseUrl:e,accessToken:P,from:r,to:s,timeZone:a,tzOffsetMinutes:l}),Fo({baseUrl:e,accessToken:P,from:r,to:s,timeZone:a,tzOffsetMinutes:l,rolling:!0})]);if(z.status==="rejected")throw z.reason;I=z.value,B=Z.status==="fulfilled"?Z.value:null}else B=await Fo({baseUrl:e,accessToken:P,from:r,to:s,timeZone:a,tzOffsetMinutes:l,rolling:!0});let W=o&&Array.isArray(I?.data)?I.data:[];o&&(W=$o(W,r,s,{timeZone:a,offsetMinutes:l,now:c}));let Q=B?.totals||I?.summary?.totals||null,Y=B?.rolling||I?.summary?.rolling||null;if(o&&!Q&&!B)try{const z=await Fo({baseUrl:e,accessToken:P,from:r,to:s,timeZone:a,tzOffsetMinutes:l,rolling:!0});Q=z?.totals||null,Y=z?.rolling||Y}catch{}const $=new Date().toISOString();d(W),h(Q),g(Y),w("edge"),v($),Q&&T?E({summary:Q,rolling:Y,daily:W,from:r,to:s,includeDaily:o,fetchedAt:$}):T||j()}catch(I){if(T){const B=A();if(B?.summary){h(B.summary),g(B.rolling||null);const W=Array.isArray(B.daily)?B.daily:[],Q=o?$o(W,B.from||r,B.to||s,{timeZone:a,offsetMinutes:l,now:c}):W;d(Q),w("cache"),v(B.fetchedAt||null),M(null)}else{const W=I;M(W?.message||String(W)),d([]),h(null),g(null),w("edge"),v(null)}}else{const B=I;M(B?.message||String(B)),d([]),h(null),g(null),w("edge"),v(null)}}finally{S(!1)}}},[t,e,r,o,D,n,T,c,A,F,a,s,l,j,E,N]);return m.useEffect(()=>{const P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!F&&!n&&!D&&!P){d([]),h(null),g(null),M(null),S(!1),w("edge"),v(null);return}if(!T)j(),d([]),h(null),g(null),M(null),w("edge"),v(null);else{const I=A();if(I?.summary){h(I.summary),g(I.rolling||null);const B=Array.isArray(I.daily)?I.daily:[],W=o?$o(B,I.from||r,I.to||s,{timeZone:a,offsetMinutes:l,now:c}):B;d(W),w("cache"),v(I.fetchedAt||null)}}V()},[t,D,A,V,F,n,T,j,N]),{daily:u,summary:f,rolling:p,source:D?"mock":y,fetchedAt:x,loading:k,error:C,refresh:V}}function fb(e){try{return new URL(e).host}catch{return null}}function Bo(e){if(!e)return null;const t=String(e).trim(),n=t.split("-");if(n.length!==3)return null;const r=Number(n[0]),s=Number(n[1])-1,o=Number(n[2]);if(!Number.isFinite(r)||!Number.isFinite(s)||!Number.isFinite(o))return null;const i=new Date(Date.UTC(r,s,o));return Number.isFinite(i.getTime())&&cr(i)===t?i:null}function hb(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function $o(e,t,n,{timeZone:r,offsetMinutes:s,now:o}={}){const i=Bo(t),a=Bo(n);if(!i||!a||a<i)return Array.isArray(e)?e:[];const l=o instanceof Date&&Number.isFinite(o.getTime())?o:new Date,c=ia({timeZone:r,offsetMinutes:s,date:l}),u=Bo(c),d=u?u.getTime():l.getTime(),f=new Map;for(const p of e||[])p?.day&&f.set(p.day,p);const h=[];for(let p=i;p<=a;p=hb(p,1)){const g=cr(p),y=f.get(g),w=p.getTime()>d;if(y){h.push({...y,missing:!1,future:w});continue}h.push({day:g,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!w,future:w})}return h}function mb({baseUrl:e,accessToken:t,guestAllowed:n=!1,from:r,to:s,cacheKey:o,timeZone:i,tzOffsetMinutes:a}={}){const[l,c]=m.useState(null),[u,d]=m.useState("edge"),[f,h]=m.useState(!1),[p,g]=m.useState(null),y=yr(),w=br(t),x=!n,v=m.useMemo(()=>{if(!o)return null;const T=pb(e)||"default",R=fo({timeZone:i,offsetMinutes:a});return`vibeusage.modelBreakdown.${o}.${T}.${r}.${s}.${R}`},[e,o,r,i,s,a]),k=m.useCallback(()=>{if(!v||typeof window>"u")return null;try{const T=window.localStorage.getItem(v);if(!T)return null;const R=JSON.parse(T);return!R||!R.breakdown?null:R}catch{return null}},[v]),S=m.useCallback(T=>{if(!(!v||typeof window>"u"))try{window.localStorage.setItem(v,JSON.stringify(T))}catch{}},[v]),C=m.useCallback(()=>{if(!(!v||typeof window>"u"))try{window.localStorage.removeItem(v)}catch{}},[v]),M=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),D=m.useCallback(async()=>{const T=await Wt(t);if(!(!T&&!y&&!M)){h(!0),g(null);try{const R=await ty({baseUrl:e,accessToken:T,from:r,to:s,timeZone:i,tzOffsetMinutes:a});c(R||null),d("edge"),R&&x?S({breakdown:R,fetchedAt:new Date().toISOString()}):x||C()}catch(R){if(x){const A=k();if(A?.breakdown)c(A.breakdown),d("cache"),g(null);else{c(null),d("edge");const E=R;g(E?.message||String(E))}}else{c(null),d("edge");const A=R;g(A?.message||String(A))}}finally{h(!1)}}},[t,e,r,y,n,x,k,i,s,w,a,C,S,M]);return m.useEffect(()=>{if(!w&&!n&&!y&&!M){c(null),d("edge"),g(null),h(!1);return}if(!x)C(),c(null),d("edge"),g(null);else{const T=k();T?.breakdown&&(c(T.breakdown),d("cache"))}D()},[t,y,k,D,w,n,x,C,M]),{breakdown:l,source:y?"mock":u,loading:f,error:p,refresh:D}}function pb(e){try{return new URL(e).host}catch{return null}}const Vd=new Set(["day","hour","month"]);function gb(e){return Vd.has(e)}function ql(e){if(e==null)return null;const t=String(e).trim();if(!/^[0-9]+$/.test(t))return null;const n=t.replace(/^0+/,"");return n.length===0?"0":n}function yb(e,t){const n=ql(e),r=ql(t);if(n&&r)return n.length!==r.length?n.length<r.length?-1:1:n===r?0:n<r?-1:1;const s=xt(e),o=xt(t);return s==null&&o==null?0:s==null?1:o==null?-1:s===o?0:s<o?-1:1}function bb(e,t){const n=typeof e=="string"?e:String(e||""),r=typeof t=="string"?t:String(t||"");return n===r?0:n<r?-1:1}function xb(e){if(!e)return null;const n=String(e).trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!n)return null;const r=Number(n[1]),s=Number(n[2]),o=Number(n[3]);if(!Number.isFinite(r)||!Number.isFinite(s)||!Number.isFinite(o))return null;const i=new Date(Date.UTC(r,s-1,o));return!Number.isFinite(i.getTime())||i.getUTCFullYear()!==r||i.getUTCMonth()+1!==s||i.getUTCDate()!==o?null:i.getTime()}function vb(e){if(!e)return null;const n=String(e).trim().match(/^(\d{4})-(\d{2})$/);if(!n)return null;const r=Number(n[1]),s=Number(n[2]);if(!Number.isFinite(r)||!Number.isFinite(s)||s<1||s>12)return null;const o=new Date(Date.UTC(r,s-1,1));return Number.isFinite(o.getTime())?o.getTime():null}function wb(e){if(!e)return null;const n=String(e).trim().match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?Z?$/);if(!n)return null;const r=Number(n[1]),s=Number(n[2]),o=Number(n[3]),i=Number(n[4]),a=Number(n[5]),l=Number(n[6]||0);if(!Number.isFinite(r)||!Number.isFinite(s)||!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(l)||s<1||s>12||o<1||o>31||i<0||i>23||a<0||a>59||l<0||l>59)return null;const c=new Date(Date.UTC(r,s-1,o,i,a,l));return Number.isFinite(c.getTime())?c.getTime():null}function kb(e,t,n){const r=n==="hour"?wb:n==="month"?vb:xb,s=r(e),o=r(t);return s!=null&&o!=null?s===o?0:s<o?-1:1:bb(e,t)}function _d(e,{key:t,dir:n}){const r=n==="asc"?1:-1,s=Array.isArray(e)?e:[],o=Vd.has(t)?(a,l)=>kb(a,l,t):yb,i=a=>t==="total_tokens"&&a?.billable_total_tokens!=null?a.billable_total_tokens:a?.[t];return s.map((a,l)=>({row:a,index:l})).sort((a,l)=>{const c=i(a.row),u=i(l.row),d=c==null,f=u==null;if(d&&f)return a.index-l.index;if(d)return 1;if(f)return-1;const h=o(c,u);return h!==0?h*r:a.index-l.index}).map(a=>a.row)}const Sb=[{key:"day",label:_("daily.sort.date.label"),title:_("daily.sort.date.title")},{key:"total_tokens",label:_("daily.sort.total.label"),title:_("daily.sort.total.title")},{key:"input_tokens",label:_("daily.sort.input.label"),title:_("daily.sort.input.title")},{key:"output_tokens",label:_("daily.sort.output.label"),title:_("daily.sort.output.title")},{key:"cached_input_tokens",label:_("daily.sort.cached.label"),title:_("daily.sort.cached.title")},{key:"reasoning_output_tokens",label:_("daily.sort.reasoning.label"),title:_("daily.sort.reasoning.title")},{key:"conversation_count",label:_("daily.sort.conversations.label"),title:_("daily.sort.conversations.title")}];function Xl(e){const t=gb(e)?e:"day";return Sb.map((n,r)=>r===0?{...n,key:t}:n)}function Zl(e,{key:t,dir:n}){return _d(e,{key:t,dir:n})}const Js=12,Tb=["total_tokens","billable_total_tokens","input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens"];function Cb(e){if(typeof e=="bigint")return e!==0n;if(typeof e=="number")return Number.isFinite(e)&&e!==0;if(e==null)return!1;const t=String(e).trim();if(!t||!/^-?\d+$/.test(t))return!1;const n=t.startsWith("-")?t.slice(1):t;return/[1-9]/.test(n)}function Eb(e){return Tb.some(t=>Cb(e?.[t]))}function Mb(e){const t=Array.isArray(e)?e:[];if(!t.length)return[];const n=_d(t,{key:"month",dir:"asc"}),r=n.findIndex(s=>s?.month&&Eb(s));return r===-1?t:n.slice(r)}function Db(e,t,n=Js){const r=Array.isArray(e)?e:[],s=Number.isFinite(n)&&n>0?n:Js,i=(Number.isFinite(t)&&t>=0?Math.floor(t):0)*s;return r.slice(i,i+s)}function Pb({publicMode:e,screenshotMode:t,forceInstall:n,accessEnabled:r,heatmapLoading:s,activeDays:o,hasActiveDeviceToken:i}={}){return e||t?!1:n?!0:r&&!s&&o===0&&!i}function Wd(e){if(typeof e!="string")return null;const t=e.trim();return t?t.toLowerCase():null}function Rb(e){const t=Wd(e?.model_id);return t||null}function Bd(e,t){return e?.model?String(e.model):t}function Ob(e,{copyFn:t}={}){const n=typeof t=="function"?t:i=>i,s=(Array.isArray(e?.sources)?e.sources:[]).map(i=>{const a=xt(i?.totals?.billable_total_tokens??i?.totals?.total_tokens)??0,l=xt(i?.totals?.total_cost_usd)??0;return{source:i?.source,totalTokens:Number.isFinite(a)?a:0,totalCost:Number.isFinite(l)?l:0,models:Array.isArray(i?.models)?i.models:[]}}).filter(i=>i.totalTokens>0);if(!s.length)return[];const o=s.reduce((i,a)=>i+a.totalTokens,0);return typeof e?.pricing?.pricing_mode=="string"&&e.pricing.pricing_mode.toUpperCase(),s.slice().sort((i,a)=>a.totalTokens-i.totalTokens).map(i=>{const a=i.source?String(i.source).toUpperCase():n("shared.placeholder.short"),l=o>0?i.totalTokens/o*100:0,c=Number.isFinite(l)?l.toFixed(1):"0.0",u=i.models.map(d=>{const f=xt(d?.totals?.billable_total_tokens??d?.totals?.total_tokens)??0;if(!Number.isFinite(f)||f<=0)return null;const h=i.totalTokens>0?Math.round(f/i.totalTokens*1e3)/10:0,p=Bd(d,n("shared.placeholder.short")),g=Rb(d),y=i.totalCost>0&&i.totalTokens>0?f/i.totalTokens*i.totalCost:null;return{id:g,name:p,share:h,usage:f,cost:y}}).filter(Boolean);return{label:a,totalPercent:String(c),usd:i.totalCost,usage:i.totalTokens,models:u}})}function Ab(e,{limit:t=3,copyFn:n}={}){const r=typeof n=="function"?n:f=>f,s=Array.isArray(e?.sources)?e.sources:[];if(!s.length)return[];const o=new Map,i=new Map,a=new Map;let l=0;for(const f of s){const h=Array.isArray(f?.models)?f.models:[];for(const p of h){const g=xt(p?.totals?.billable_total_tokens)??0;if(!Number.isFinite(g)||g<=0)continue;l+=g;const y=Bd(p,r("shared.placeholder.short")),w=Wd(y);if(!w)continue;o.set(w,(o.get(w)||0)+g);const x=a.get(w)||0;g>=x&&(a.set(w,g),i.set(w,y))}}if(!o.size)return[];const c=Array.from(o.values()).reduce((f,h)=>f+h,0),u=l>0?l:c,d=Number.isFinite(t)?Math.max(0,Math.floor(t)):3;return Array.from(o.entries()).map(([f,h])=>{const p=u>0?(h/u*100).toFixed(1):"0.0";return{id:f,name:i.get(f)||r("shared.placeholder.short"),tokens:h,percent:String(p)}}).sort((f,h)=>h.tokens!==f.tokens?h.tokens-f.tokens:String(f.name).localeCompare(String(h.name))).slice(0,d)}function ga(){const e=m.useContext(Fg);if(e===null)throw new Error("useTheme must be used within a ThemeProvider");return e}const En=12,Or=3,Yo=26,Nb=["#ecfdf5","#a7f3d0","#6ee7b7","#34d399","#10b981"],Ib=["#064e3b","#065f46","#059669","#10b981","#34d399"],Fb=[_("heatmap.month.jan"),_("heatmap.month.feb"),_("heatmap.month.mar"),_("heatmap.month.apr"),_("heatmap.month.may"),_("heatmap.month.jun"),_("heatmap.month.jul"),_("heatmap.month.aug"),_("heatmap.month.sep"),_("heatmap.month.oct"),_("heatmap.month.nov"),_("heatmap.month.dec")];function jb(e){if(typeof e=="bigint")return e.toLocaleString();if(typeof e=="number")return Number.isFinite(e)?Math.round(e).toLocaleString():"0";if(typeof e=="string"){const t=Number(e);return Number.isFinite(t)?Math.round(t).toLocaleString():e}return"0"}function Lb(e){if(typeof e!="string")return null;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;const n=new Date(Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3])));return Number.isFinite(n.getTime())?n:null}function $d(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function Vb(e,t){return Math.floor((Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())-Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))/864e5)}function _b(e,t){const n=t==="mon"?1:0,r=e.getUTCDay();return $d(e,-((r-n+7)%7))}function Wb(e,t,n){if(!e)return[];const r=Lb(t)||new Date,s=[];for(let c=11;c>=0;c-=1)s.push(new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()-c,1)));const o=_b(r,n),i=$d(o,-(e-1)*7),a=[],l=new Set;for(const c of s){const u=Math.floor(Vb(i,c)/7);u<0||u>=e||l.has(u)||(l.add(u),a.push({label:Fb[c.getUTCMonth()],index:u}))}return a}function Bb({heatmap:e,timeZoneLabel:t,timeZoneShortLabel:n,hideLegend:r=!1}){const{resolvedTheme:s}=ga(),i=s==="dark"?Ib:Nb,a=m.useRef(null);m.useEffect(()=>{const p=a.current;p&&(p.scrollLeft=p.scrollWidth)},[e?.weeks]);const l=e?.week_starts_on==="mon"?"mon":"sun",c=m.useMemo(()=>{const p=Array.isArray(e?.weeks)?e.weeks:[];if(!p.length)return{weeks:[]};const g=[];for(const y of p)for(const w of Array.isArray(y)?y:[])w?.day&&g.push({day:w.day,total_tokens:w.total_tokens??w.value??0,billable_total_tokens:w.billable_total_tokens??w.value??w.total_tokens??0});return Ei({dailyRows:g,weeks:Math.max(52,p.length),to:e?.to,weekStartsOn:l})},[e?.to,e?.weeks,l]),u=c?.weeks||[],d=l==="mon"?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(p=>_(`heatmap.day.${p.toLowerCase()}`)):["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(p=>_(`heatmap.day.${p.toLowerCase()}`)),f=m.useMemo(()=>Wb(u.length,c?.to,l),[c?.to,u.length,l]);if(!u.length)return b.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:_("heatmap.empty")});const h=Yo+u.length*En+Math.max(0,u.length-1)*Or;return b.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[b.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[b.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:_("heatmap.title")}),b.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400",children:n||_("heatmap.legend.utc")})]}),b.jsx("div",{ref:a,className:"overflow-x-auto overflow-y-hidden heatmap-scroll-thin",children:b.jsxs("div",{style:{minWidth:h},children:[b.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:`${Yo}px repeat(${u.length}, ${En}px)`,columnGap:Or},children:[b.jsx("span",{}),f.map(p=>b.jsx("span",{style:{gridColumnStart:p.index+2},className:"whitespace-nowrap",children:p.label},`${p.label}-${p.index}`))]}),b.jsxs("div",{className:"grid",style:{gridTemplateColumns:`${Yo}px repeat(${u.length}, ${En}px)`,columnGap:Or},children:[b.jsx("div",{className:"grid text-[10px] text-oai-gray-400 dark:text-oai-gray-400 sticky left-0 bg-white dark:bg-oai-gray-900 pr-2",style:{gridTemplateRows:`repeat(7, ${En}px)`,rowGap:Or},children:d.map(p=>b.jsx("span",{className:"leading-none",children:p},p))}),b.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${En}px)`,gap:Or},children:u.map((p,g)=>(Array.isArray(p)?p:[]).map((y,w)=>{if(!y)return null;const x=y.day||`e-${g}-${w}`,v=Number(y.level)||0,k=i[v]||i[0],S=t||n||_("heatmap.legend.utc");return b.jsx("span",{title:_("heatmap.tooltip",{day:y.day,value:jb(y.value),unit:_("heatmap.unit.tokens"),tz:S}),className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10",style:{width:En,height:En,background:k}},x)}))})]})]})}),!r&&b.jsxs("div",{className:"flex items-center justify-center gap-2 mt-3",children:[b.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:_("heatmap.legend.less")}),b.jsx("div",{className:"flex gap-0.5",children:i.map((p,g)=>b.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:p}},g))}),b.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:_("heatmap.legend.more")})]})]})}const $b={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Yd={...$b,position:"fixed",top:0,left:0};function Bt(e){const t=bn(Yb,e).current;return t.next=e,Te(t.effect),t}function Yb(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var eo=Symbol("NOT_FOUND");function Hb(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Ub(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Gb(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Ql=e=>Array.isArray(e)?e:[e];function Kb(e){const t=Array.isArray(e[0])?e[0]:e;return Gb(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function zb(e,t){const n=[],{length:r}=e;for(let s=0;s<r;s++)n.push(e[s].apply(null,t));return n}function qb(e){let t;return{get(n){return t&&e(t.key,n)?t.value:eo},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Xb(e,t){let n=[];function r(a){const l=n.findIndex(c=>t(a,c.key));if(l>-1){const c=n[l];return l>0&&(n.splice(l,1),n.unshift(c)),c.value}return eo}function s(a,l){r(a)===eo&&(n.unshift({key:a,value:l}),n.length>e&&n.pop())}function o(){return n}function i(){n=[]}return{get:r,put:s,getEntries:o,clear:i}}var Zb=(e,t)=>e===t;function Qb(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:s}=n;for(let o=0;o<s;o++)if(!e(n[o],r[o]))return!1;return!0}}function Jb(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=Zb,maxSize:s=1,resultEqualityCheck:o}=n,i=Qb(r);let a=0;const l=s<=1?qb(i):Xb(s,i);function c(){let u=l.get(arguments);if(u===eo){if(u=e.apply(null,arguments),a++,o){const f=l.getEntries().find(h=>o(h.value,u));f&&(u=f.value,a!==0&&a--)}l.put(arguments,u)}return u}return c.clearCache=()=>{l.clear(),c.resetResultsCount()},c.resultsCount=()=>a,c.resetResultsCount=()=>{a=0},c}var e0=class{constructor(e){this.value=e}deref(){return this.value}},t0=typeof WeakRef<"u"?WeakRef:e0,n0=0,Jl=1;function Ts(){return{s:n0,v:void 0,o:null,p:null}}function Hd(e,t={}){let n=Ts();const{resultEqualityCheck:r}=t;let s,o=0;function i(){let a=n;const{length:l}=arguments;for(let d=0,f=l;d<f;d++){const h=arguments[d];if(typeof h=="function"||typeof h=="object"&&h!==null){let p=a.o;p===null&&(a.o=p=new WeakMap);const g=p.get(h);g===void 0?(a=Ts(),p.set(h,a)):a=g}else{let p=a.p;p===null&&(a.p=p=new Map);const g=p.get(h);g===void 0?(a=Ts(),p.set(h,a)):a=g}}const c=a;let u;if(a.s===Jl)u=a.v;else if(u=e.apply(null,arguments),o++,r){const d=s?.deref?.()??s;d!=null&&r(d,u)&&(u=d,o!==0&&o--),s=typeof u=="object"&&u!==null||typeof u=="function"?new t0(u):u}return c.s=Jl,c.v=u,u}return i.clearCache=()=>{n=Ts(),i.resetResultsCount()},i.resultsCount=()=>o,i.resetResultsCount=()=>{o=0},i}function Ud(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...s)=>{let o=0,i=0,a,l={},c=s.pop();typeof c=="object"&&(l=c,c=s.pop()),Hb(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:d,memoizeOptions:f=[],argsMemoize:h=Hd,argsMemoizeOptions:p=[]}=u,g=Ql(f),y=Ql(p),w=Kb(s),x=d(function(){return o++,c.apply(null,arguments)},...g),v=h(function(){i++;const S=zb(w,arguments);return a=x.apply(null,S),a},...y);return Object.assign(v,{resultFunc:c,memoizedResultFunc:x,dependencies:w,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>a,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:d,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var r0=Ud(Hd),s0=Object.assign((e,t=r0)=>{Ub(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(o=>e[o]);return t(r,(...o)=>o.reduce((i,a,l)=>(i[n[l]]=a,i),{}))},{withTypes:()=>s0});Ud({memoize:Jb,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const pe=(e,t,n,r,s,o,...i)=>{if(i.length>0)throw new Error(Bn(1));let a;if(e)a=e;else throw new Error("Missing arguments");return a};var Ho={exports:{}},Uo={};var ec;function o0(){if(ec)return Uo;ec=1;var e=id();function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),g=p[0].inst,y=p[1];return o(function(){g.value=h,g.getSnapshot=f,l(g)&&y({inst:g})},[d,h,f]),s(function(){return l(g)&&y({inst:g}),d(function(){l(g)&&y({inst:g})})},[d]),i(h),h}function l(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Uo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Uo}var tc;function Gd(){return tc||(tc=1,Ho.exports=o0()),Ho.exports}var i0=Gd(),Go={exports:{}},Ko={};var nc;function a0(){if(nc)return Ko;nc=1;var e=id(),t=Gd();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Ko.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function w(C){if(!x){if(x=!0,v=C,C=f(C),h!==void 0&&g.hasValue){var M=g.value;if(h(M,C))return k=M}return k=C}if(M=k,r(v,C))return M;var D=f(C);return h!==void 0&&h(M,D)?(v=C,M):(v=C,k=D)}var x=!1,v,k,S=d===void 0?null:d;return[function(){return w(u())},S===null?void 0:function(){return w(S())}]},[u,d,f,h]);var y=s(c,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=y},[y]),l(y),y},Ko}var rc;function l0(){return rc||(rc=1,Go.exports=a0()),Go.exports}var c0=l0();const u0=ad(19),d0=u0?h0:m0;function f0(e,t,n,r,s){return d0(e,t,n,r,s)}function h0(e,t,n,r,s){const o=m.useCallback(()=>t(e.getSnapshot(),n,r,s),[e,t,n,r,s]);return i0.useSyncExternalStore(e.subscribe,o,o)}function m0(e,t,n,r,s){return c0.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,o=>t(o,n,r,s))}class Vr{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){Vr.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||Vr.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};Vr.prototype.setState.call(this,t)}}class ya extends Vr{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}controlledValues=new Map;useSyncedValue(t,n){m.useDebugValue(t),Te(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;Te(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);Te(()=>{n.update(t)},[n,...r])}useControlledProp(t,n,r){m.useDebugValue(t);const s=this,o=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,o),!o&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})),Te(()=>{o&&!Object.is(s.state[t],n)&&super.setState({...s.state,[t]:n})},[s,t,n,r,o])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.update(n)}setState(t){const n={...t};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.setState({...this.state,...n})}select=(t,n,r,s)=>{const o=this.selectors[t];return o(this.state,n,r,s)};useState=(t,n,r,s)=>{m.useDebugValue(t);const o=this.selectors[t];return f0(this,o,n,r,s)};useContextCallback(t,n){m.useDebugValue(t);const r=he(n??ld);this.context[t]=r}useStateSetter(t){const n=m.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let s=r(this.state);return n(s,s,this),this.subscribe(o=>{const i=r(o);if(!Object.is(s,i)){const a=s;s=i,n(i,a,this)}})}}const Cs=null;class p0{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<n.length;s+=1)n[s]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Es=new p0;class Vt{static create(){return new Vt}static request(t){return Es.request(t)}static cancel(t){return Es.cancel(t)}currentId=Cs;request(t){this.cancel(),this.currentId=Es.request(()=>{this.currentId=Cs,t()})}cancel=()=>{this.currentId!==Cs&&(Es.cancel(this.currentId),this.currentId=Cs)};disposeEffect=()=>this.cancel}function ba(){const e=bn(Vt.create).current;return da(e.disposeEffect),e}function Kd(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class g0{nodesRef={current:[]};events=Kd();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const zd=m.createContext(null),qd=m.createContext(null),Yn=()=>m.useContext(zd)?.id||null,wr=e=>{const t=m.useContext(qd);return e??t};function y0(e){const t=ts(),n=wr(e),r=Yn();return Te(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function b0(e){const{children:t,id:n}=e,r=Yn();return b.jsx(zd.Provider,{value:m.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function x0(e){const{children:t,externalTree:n}=e,r=bn(()=>n??new g0).current;return b.jsx(qd.Provider,{value:r,children:t})}function Ur(e){return`data-base-ui-${e}`}function zo(e,t,n){if(n&&!dr(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}const mr=m.forwardRef(function(t,n){const[r,s]=m.useState();Te(()=>{wy&&s("button")},[]);const o={tabIndex:0,role:r};return b.jsx("span",{...t,ref:n,style:Yd,"aria-hidden":r?void 0:!0,...o,"data-base-ui-focus-guard":""})});let sc=0;function qo(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:s=!1}=t;r&&cancelAnimationFrame(sc);const o=()=>e?.focus({preventScroll:n});s?o():sc=requestAnimationFrame(o)}const ar={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function oc(e){return e==="inert"?ar.inert:e==="aria-hidden"?ar["aria-hidden"]:ar.none}let Ms=new WeakSet,Ds={},Xo=0;const Xd=e=>e&&(e.host||Xd(e.parentNode)),v0=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=Xd(n);return e.contains(r)?r:null}).filter(n=>n!=null);function w0(e,t,n,r){const s="data-base-ui-inert",o=r?"inert":n?"aria-hidden":null,i=v0(t,e),a=new Set,l=new Set(i),c=[];Ds[s]||(Ds[s]=new WeakMap);const u=Ds[s];i.forEach(d),f(t),a.clear();function d(h){!h||a.has(h)||(a.add(h),h.parentNode&&d(h.parentNode))}function f(h){!h||l.has(h)||[].forEach.call(h.children,p=>{if(ns(p)!=="script")if(a.has(p))f(p);else{const g=o?p.getAttribute(o):null,y=g!==null&&g!=="false",w=oc(o),x=(w.get(p)||0)+1,v=(u.get(p)||0)+1;w.set(p,x),u.set(p,v),c.push(p),x===1&&y&&Ms.add(p),v===1&&p.setAttribute(s,""),!y&&o&&p.setAttribute(o,o==="inert"?"":"true")}})}return Xo+=1,()=>{c.forEach(h=>{const p=oc(o),y=(p.get(h)||0)-1,w=(u.get(h)||0)-1;p.set(h,y),u.set(h,w),y||(!Ms.has(h)&&o&&h.removeAttribute(o),Ms.delete(h)),w||h.removeAttribute(s)}),Xo-=1,Xo||(ar.inert=new WeakMap,ar["aria-hidden"]=new WeakMap,ar.none=new WeakMap,Ms=new WeakSet,Ds={})}}function k0(e,t=!1,n=!1){const r=qe(e[0]).body;return w0(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const Zd=m.createContext(null),Qd=()=>m.useContext(Zd),S0=Ur("portal");function T0(e={}){const{ref:t,container:n,componentProps:r=Nn,elementProps:s,elementState:o}=e,i=ts(),l=Qd()?.portalNode,[c,u]=m.useState(null),[d,f]=m.useState(null),h=he(w=>{w!==null&&f(w)}),p=m.useRef(null);Te(()=>{if(n===null){p.current&&(p.current=null,f(null),u(null));return}if(i==null)return;const w=(n&&(jg(n)?n:n.current))??l??document.body;if(w==null){p.current&&(p.current=null,f(null),u(null));return}p.current!==w&&(p.current=w,f(null),u(w))},[n,l,i]);const g=sn("div",r,{ref:[t,h],state:o,props:[{id:i,[S0]:""},s]});return{portalNode:d,portalSubtree:c&&g?pn.createPortal(g,c):null}}const Jd=m.forwardRef(function(t,n){const{children:r,container:s,className:o,render:i,renderGuards:a,...l}=t,{portalNode:c,portalSubtree:u}=T0({container:s,ref:n,componentProps:t,elementProps:l}),d=m.useRef(null),f=m.useRef(null),h=m.useRef(null),p=m.useRef(null),[g,y]=m.useState(null),w=g?.modal,x=g?.open,v=typeof a=="boolean"?a:!!g&&!g.modal&&g.open&&!!c;m.useEffect(()=>{if(!c||w)return;function S(C){c&&C.relatedTarget&&ir(C)&&(C.type==="focusin"?Kl:rb)(c)}return c.addEventListener("focusin",S,!0),c.addEventListener("focusout",S,!0),()=>{c.removeEventListener("focusin",S,!0),c.removeEventListener("focusout",S,!0)}},[c,w]),m.useEffect(()=>{!c||x||Kl(c)},[x,c]);const k=m.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:h,afterInsideRef:p,portalNode:c,setFocusManagerState:y}),[c]);return b.jsxs(m.Fragment,{children:[u,b.jsxs(Zd.Provider,{value:k,children:[v&&c&&b.jsx(mr,{"data-type":"outside",ref:d,onFocus:S=>{if(ir(S,c))h.current?.focus();else{const C=g?g.domReference:null;Fd(C)?.focus()}}}),v&&c&&b.jsx("span",{"aria-owns":c.id,style:by}),c&&pn.createPortal(r,c),v&&c&&b.jsx(mr,{"data-type":"outside",ref:f,onFocus:S=>{if(ir(S,c))p.current?.focus();else{const C=g?g.domReference:null;pa(C)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,Ve(Hr,S.nativeEvent))}}})]})]})});function Jt(e){return e==null?e:"current"in e?e.current:e}function C0(e,t){const n=vt(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const ic=20;let fn=[];function xa(){fn=fn.filter(e=>e.isConnected)}function E0(e){xa(),e&&ns(e)!=="body"&&(fn.push(e),fn.length>ic&&(fn=fn.slice(-ic)))}function Zo(){return xa(),fn[fn.length-1]}function M0(e){if(!e)return null;const t=vr();return Nd(e,t)?e:ss(e,t)[0]||e}function D0(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():At(e).display!=="none"}function ac(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=vr(),s=eb(e,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return Nd(i,n)||i.hasAttribute("data-tabindex")&&!a.startsWith("-")}),o=e.getAttribute("tabindex");t.current.includes("floating")||s.length===0?o!=="0"&&e.setAttribute("tabindex","0"):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function ef(e){const{context:t,children:n,disabled:r=!1,order:s=["content"],initialFocus:o=!0,returnFocus:i=!0,restoreFocus:a=!1,modal:l=!0,closeOnFocusOut:c=!0,openInteractionType:u="",getInsideElements:d=()=>[],nextFocusableElement:f,previousFocusableElement:h,beforeContentFocusGuardRef:p,externalTree:g}=e,y="rootStore"in t?t.rootStore:t,w=y.useState("open"),x=y.useState("domReferenceElement"),v=y.useState("floatingElement"),{events:k,dataRef:S}=y.context,C=he(()=>S.current.floatingContext?.nodeId),M=he(d),D=o===!1,F=$l(x)&&D,T=Bt(s),R=Bt(o),A=Bt(i),E=Bt(u),j=wr(g),N=Qd(),V=m.useRef(null),U=m.useRef(null),P=m.useRef(!1),I=m.useRef(!1),B=m.useRef(!1),W=m.useRef(-1),Q=m.useRef(""),Y=m.useRef(""),$=m.useRef(null),z=m.useRef(null),Z=Vl($,p,N?.beforeInsideRef),ce=Vl(z,N?.afterInsideRef),Se=Vn(),Re=Vn(),Ee=ba(),Je=N!=null,L=Pi(v),ue=he((H=L)=>H?ss(H,vr()):[]),te=he(H=>{const se=ue(H);return T.current.map(()=>se).filter(Boolean).flat()});m.useEffect(()=>{if(r||!l)return;function H(ie){ie.key==="Tab"&&we(L,Qn(qe(L)))&&ue().length===0&&!F&&My(ie)}const se=qe(L);return se.addEventListener("keydown",H),()=>{se.removeEventListener("keydown",H)}},[r,x,L,l,T,F,ue,te]),m.useEffect(()=>{if(r||!v)return;function H(se){const ie=dt(se),ge=ue().indexOf(ie);ge!==-1&&(W.current=ge)}return v.addEventListener("focusin",H),()=>{v.removeEventListener("focusin",H)}},[r,v,ue]),m.useEffect(()=>{if(r||!w)return;const H=qe(L);function se(){B.current=!1}function ie(ge){const J=dt(ge),ne=we(v,J)||we(x,J)||we(N?.portalNode,J);B.current=!ne,Y.current=ge.pointerType||"keyboard"}function me(){Y.current="keyboard"}return H.addEventListener("pointerdown",ie,!0),H.addEventListener("pointerup",se,!0),H.addEventListener("pointercancel",se,!0),H.addEventListener("keydown",me,!0),()=>{H.removeEventListener("pointerdown",ie,!0),H.removeEventListener("pointerup",se,!0),H.removeEventListener("pointercancel",se,!0),H.removeEventListener("keydown",me,!0)}},[r,v,x,L,w,N]),m.useEffect(()=>{if(r||!c)return;function H(){I.current=!0,Re.start(0,()=>{I.current=!1})}function se(J){const ne=J.relatedTarget,Ie=J.currentTarget,be=dt(J);queueMicrotask(()=>{const _e=C(),Ge=y.context.triggerElements,ot=ne?.hasAttribute(Ur("focus-guard"))&&[$.current,z.current,N?.beforeInsideRef.current,N?.afterInsideRef.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,Jt(h),Jt(f)].includes(ne),Oe=!(we(x,ne)||we(v,ne)||we(ne,v)||we(N?.portalNode,ne)||ne!=null&&Ge.hasElement(ne)||Ge.hasMatchingElement(ye=>we(ye,ne))||ot||j&&(Fn(j.nodesRef.current,_e).find(ye=>we(ye.context?.elements.floating,ne)||we(ye.context?.elements.domReference,ne))||Yl(j.nodesRef.current,_e).find(ye=>[ye.context?.elements.floating,Pi(ye.context?.elements.floating)].includes(ne)||ye.context?.elements.domReference===ne)));if(Ie===x&&L&&ac(L,T),a&&Ie!==x&&!D0(be)&&Qn(qe(L))===qe(L).body){if(nt(L)&&(L.focus(),a==="popup")){Ee.request(()=>{L.focus()});return}const ye=W.current,Fe=ue(),$e=Fe[ye]||Fe[Fe.length-1]||L;nt($e)&&$e.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(F||!l)&&ne&&Oe&&!I.current&&(F||ne!==Zo())&&(P.current=!0,y.setOpen(!1,Ve(Hr,J)))})}function ie(){B.current||(S.current.insideReactTree=!0,Se.start(0,()=>{S.current.insideReactTree=!1}))}const me=nt(x)?x:null,ge=[];if(!(!v&&!me))return me&&(me.addEventListener("focusout",se),me.addEventListener("pointerdown",H),ge.push(()=>{me.removeEventListener("focusout",se),me.removeEventListener("pointerdown",H)})),v&&(v.addEventListener("focusout",se),N&&(v.addEventListener("focusout",ie,!0),ge.push(()=>{v.removeEventListener("focusout",ie,!0)})),ge.push(()=>{v.removeEventListener("focusout",se)})),()=>{ge.forEach(J=>{J()})}},[r,x,v,L,l,j,N,y,c,a,ue,F,C,T,S,Se,Re,Ee,f,h]),m.useEffect(()=>{if(r||!v||!w)return;const H=Array.from(N?.portalNode?.querySelectorAll(`[${Ur("portal")}]`)||[]),ie=(j?Yl(j.nodesRef.current,C()):[]).find(J=>$l(J.context?.elements.domReference||null))?.context?.elements.domReference,me=[v,ie,...H,...M(),V.current,U.current,$.current,z.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,Jt(h),Jt(f),F?x:null].filter(J=>J!=null),ge=k0(me,l||F);return()=>{ge()}},[w,r,x,v,l,T,N,F,j,C,M,f,h]),Te(()=>{if(!w||r||!nt(L))return;const H=qe(L),se=Qn(H);queueMicrotask(()=>{const ie=te(L),me=R.current,ge=typeof me=="function"?me(E.current||""):me;if(ge===void 0||ge===!1)return;let J;ge===!0||ge===null?J=ie[0]||L:J=Jt(ge),J=J||ie[0]||L,!we(L,se)&&qo(J,{preventScroll:J===L})})},[r,w,L,D,te,R,E]),Te(()=>{if(r||!L)return;const H=qe(L),se=Qn(H);E0(se);function ie(J){if(J.open||(Q.current=C0(J.nativeEvent,Y.current)),J.reason===ut&&J.nativeEvent.type==="mouseleave"&&(P.current=!0),J.reason===cd)if(J.nested)P.current=!1;else if(Py(J.nativeEvent)||Ry(J.nativeEvent))P.current=!1;else{let ne=!1;document.createElement("div").focus({get preventScroll(){return ne=!0,!1}}),ne?P.current=!1:P.current=!0}}k.on("openchange",ie);const me=H.createElement("span");me.setAttribute("tabindex","-1"),me.setAttribute("aria-hidden","true"),Object.assign(me.style,Yd),Je&&x&&x.insertAdjacentElement("afterend",me);function ge(){const J=A.current;let ne=typeof J=="function"?J(Q.current):J;if(ne===void 0||ne===!1)return null;if(ne===null&&(ne=!0),typeof ne=="boolean"){const be=x||Zo();return be&&be.isConnected?be:me}const Ie=x||Zo()||me;return Jt(ne)||Ie}return()=>{k.off("openchange",ie);const J=Qn(H),ne=we(v,J)||j&&Fn(j.nodesRef.current,C(),!1).some(be=>we(be.context?.elements.floating,J)),Ie=ge();queueMicrotask(()=>{const be=M0(Ie),_e=typeof A.current!="boolean";A.current&&!P.current&&nt(be)&&(!(!_e&&be!==J&&J!==H.body)||ne)&&be.focus({preventScroll:!0}),me.remove()})}},[r,v,L,A,S,k,j,Je,x,C]),m.useEffect(()=>{queueMicrotask(()=>{P.current=!1})},[r]),m.useEffect(()=>{if(r||!w)return;function H(ie){dt(ie)?.closest(`[${yd}]`)&&(I.current=!0)}const se=qe(L);return se.addEventListener("pointerdown",H,!0),()=>{se.removeEventListener("pointerdown",H,!0)}},[r,w,L]),Te(()=>{if(!r&&N)return N.setFocusManagerState({modal:l,closeOnFocusOut:c,open:w,onOpenChange:y.setOpen,domReference:x}),()=>{N.setFocusManagerState(null)}},[r,N,l,w,y,c,x]),Te(()=>{if(!(r||!L))return ac(L,T),()=>{queueMicrotask(xa)}},[r,L,T]);const Me=!r&&(l?!F:!0)&&(Je||l);return b.jsxs(m.Fragment,{children:[Me&&b.jsx(mr,{"data-type":"inside",ref:Z,onFocus:H=>{if(l){const se=te();qo(se[se.length-1])}else N?.portalNode&&(P.current=!1,ir(H,N.portalNode)?pa(x)?.focus():Jt(h??N.beforeOutsideRef)?.focus())}}),n,Me&&b.jsx(mr,{"data-type":"inside",ref:ce,onFocus:H=>{l?qo(te()[0]):N?.portalNode&&(c&&(P.current=!0),ir(H,N.portalNode)?Fd(x)?.focus():Jt(f??N.afterOutsideRef)?.focus())}})]})}function P0(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:s=!0,event:o="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:l=!0,touchOpenDelay:c=0}=t,u=m.useRef(void 0),d=ba(),f=Vn(),h=m.useMemo(()=>({onPointerDown(p){u.current=p.pointerType},onMouseDown(p){const g=u.current,y=p.nativeEvent,w=n.select("open");if(p.button!==0||o==="click"||dr(g,!0)&&a)return;const x=r.current.openEvent,v=x?.type,k=n.select("domReferenceElement")!==p.currentTarget,S=w&&k||!(w&&i&&(!(x&&l)||v==="click"||v==="mousedown"));if(Td(y.target)){const M=Ve(mn,y,y.target);S&&g==="touch"&&c>0?f.start(c,()=>{n.setOpen(!0,M)}):n.setOpen(S,M);return}const C=p.currentTarget;d.request(()=>{const M=Ve(mn,y,C);S&&g==="touch"&&c>0?f.start(c,()=>{n.setOpen(!0,M)}):n.setOpen(S,M)})},onClick(p){if(o==="mousedown-only")return;const g=u.current;if(o==="mousedown"&&g){u.current=void 0;return}if(dr(g,!0)&&a)return;const y=n.select("open"),w=r.current.openEvent,x=n.select("domReferenceElement")!==p.currentTarget,v=y&&x||!(y&&i&&(!(w&&l)||Cd(w))),k=Ve(mn,p.nativeEvent,p.currentTarget);v&&g==="touch"&&c>0?f.start(c,()=>{n.setOpen(!0,k)}):n.setOpen(v,k)},onKeyDown(){u.current=void 0}}),[r,o,a,n,l,i,d,f,c]);return m.useMemo(()=>s?{reference:h}:Nn,[s,h])}function lc(e,t,n){let{reference:r,floating:s}=e;const o=yt(t),i=ma(t),a=ha(i),l=it(t),c=o==="y",u=r.x+r.width/2-s.width/2,d=r.y+r.height/2-s.height/2,f=r[a]/2-s[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-s.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-s.width,y:d};break;default:h={x:r.x,y:r.y}}switch(xn(t)){case"start":h[i]-=f*(n&&c?-1:1);break;case"end":h[i]+=f*(n&&c?-1:1);break}return h}async function R0(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=nn(t,e),p=Ed(h),y=a[f?d==="floating"?"reference":"floating":d],w=zs(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=d==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),k=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},S=zs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:v,strategy:l}):x);return{top:(w.top-S.top+p.top)/k.y,bottom:(S.bottom-w.bottom+p.bottom)/k.y,left:(w.left-S.left+p.left)/k.x,right:(S.right-w.right+p.right)/k.x}}const O0=50,A0=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:R0},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:d}=lc(c,r,l),f=r,h=0;const p={};for(let g=0;g<o.length;g++){const y=o[g];if(!y)continue;const{name:w,fn:x}=y,{x:v,y:k,data:S,reset:C}=await x({x:u,y:d,initialPlacement:r,placement:f,strategy:s,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=v??u,d=k??d,p[w]={...p[w],...S},C&&h<O0&&(h++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(c=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:u,y:d}=lc(c,f,l)),g=-1)}return{x:u,y:d,placement:f,strategy:s,middlewareData:p}},N0=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=nn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=it(s),x=yt(a),v=it(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=f||(v||!g?[Ks(a)]:Iy(a)),C=p!=="none";!f&&C&&S.push(...Vy(a,g,p,k));const M=[a,...S],D=await l.detectOverflow(t,y),F=[];let T=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&F.push(D[w]),d){const j=Ny(s,i,k);F.push(D[j[0]],D[j[1]])}if(T=[...T,{placement:s,overflows:F}],!F.every(j=>j<=0)){var R,A;const j=(((R=o.flip)==null?void 0:R.index)||0)+1,N=M[j];if(N&&(!(d==="alignment"?x!==yt(N):!1)||T.every(P=>yt(P.placement)===x?P.overflows[0]>0:!0)))return{data:{index:j,overflows:T},reset:{placement:N}};let V=(A=T.filter(U=>U.overflows[0]<=0).sort((U,P)=>U.overflows[1]-P.overflows[1])[0])==null?void 0:A.placement;if(!V)switch(h){case"bestFit":{var E;const U=(E=T.filter(P=>{if(C){const I=yt(P.placement);return I===x||I==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(I=>I>0).reduce((I,B)=>I+B,0)]).sort((P,I)=>P[1]-I[1])[0])==null?void 0:E[0];U&&(V=U);break}case"initialPlacement":V=a;break}if(s!==V)return{reset:{placement:V}}}return{}}}};function cc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uc(e){return Oy.some(t=>e[t]>=0)}const I0=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=nn(e,t);switch(s){case"referenceHidden":{const i=await r.detectOverflow(t,{...o,elementContext:"reference"}),a=cc(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:uc(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),a=cc(i,n.floating);return{data:{escapedOffsets:a,escaped:uc(a)}}}default:return{}}}}},tf=new Set(["left","top"]);async function F0(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=it(n),a=xn(n),l=yt(n)==="y",c=tf.has(i)?-1:1,u=o&&l?-1:1,d=nn(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const j0=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:a}=t,l=await F0(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:o+l.y,data:{...l,placement:i}}}}},L0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:w=>{let{x,y:v}=w;return{x,y:v}}},...c}=nn(e,t),u={x:n,y:r},d=await o.detectOverflow(t,c),f=yt(it(s)),h=fa(f);let p=u[h],g=u[f];if(i){const w=h==="y"?"top":"left",x=h==="y"?"bottom":"right",v=p+d[w],k=p-d[x];p=Ri(v,p,k)}if(a){const w=f==="y"?"top":"left",x=f==="y"?"bottom":"right",v=g+d[w],k=g-d[x];g=Ri(v,g,k)}const y=l.fn({...t,[h]:p,[f]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:i,[f]:a}}}}}},V0=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=nn(e,t),u={x:n,y:r},d=yt(s),f=fa(d);let h=u[f],p=u[d];const g=nn(a,t),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const v=f==="y"?"height":"width",k=o.reference[f]-o.floating[v]+y.mainAxis,S=o.reference[f]+o.reference[v]-y.mainAxis;h<k?h=k:h>S&&(h=S)}if(c){var w,x;const v=f==="y"?"width":"height",k=tf.has(it(s)),S=o.reference[d]-o.floating[v]+(k&&((w=i.offset)==null?void 0:w[d])||0)+(k?0:y.crossAxis),C=o.reference[d]+o.reference[v]+(k?0:((x=i.offset)==null?void 0:x[d])||0)-(k?y.crossAxis:0);p<S?p=S:p>C&&(p=C)}return{[f]:h,[d]:p}}}},_0=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:a}=t,{apply:l=()=>{},...c}=nn(e,t),u=await i.detectOverflow(t,c),d=it(s),f=xn(s),h=yt(s)==="y",{width:p,height:g}=o.floating;let y,w;d==="top"||d==="bottom"?(y=d,w=f===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(w=d,y=f==="end"?"top":"bottom");const x=g-u.top-u.bottom,v=p-u.left-u.right,k=fr(g-u[y],x),S=fr(p-u[w],v),C=!t.middlewareData.shift;let M=k,D=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(D=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=x),C&&!f){const T=ft(u.left,0),R=ft(u.right,0),A=ft(u.top,0),E=ft(u.bottom,0);h?D=p-2*(T!==0||R!==0?T+R:ft(u.left,u.right)):M=g-2*(A!==0||E!==0?A+E:ft(u.top,u.bottom))}await l({...t,availableWidth:D,availableHeight:M});const F=await i.getDimensions(a.floating);return p!==F.width||g!==F.height?{reset:{rects:!0}}:{}}}};function nf(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=nt(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=Gs(n)!==o||Gs(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function va(e){return Ae(e)?e:e.contextElement}function lr(e){const t=va(e);if(!nt(t))return Ht(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=nf(t);let i=(o?Gs(n.width):n.width)/r,a=(o?Gs(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const W0=Ht(0);function rf(e){const t=vt(e);return!aa()||!t.visualViewport?W0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function B0(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==vt(e)?!1:t}function _n(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=va(e);let i=Ht(1);t&&(r?Ae(r)&&(i=lr(r)):i=lr(e));const a=B0(o,n,r)?rf(o):Ht(0);let l=(s.left+a.x)/i.x,c=(s.top+a.y)/i.y,u=s.width/i.x,d=s.height/i.y;if(o){const f=vt(o),h=r&&Ae(r)?vt(r):r;let p=f,g=_l(p);for(;g&&r&&h!==p;){const y=lr(g),w=g.getBoundingClientRect(),x=At(g),v=w.left+(g.clientLeft+parseFloat(x.paddingLeft))*y.x,k=w.top+(g.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,d*=y.y,l+=v,c+=k,p=vt(g),g=_l(p)}}return zs({width:u,height:d,x:l,y:c})}function mo(e,t){const n=ho(e).scrollLeft;return t?t.left+n:_n(on(e)).left+n}function sf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-mo(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function $0(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=on(r),a=t?la(t.floating):!1;if(r===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Ht(1);const u=Ht(0),d=nt(r);if((d||!d&&!o)&&((ns(r)!=="body"||rs(i))&&(l=ho(r)),d)){const h=_n(r);c=lr(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=i&&!d&&!o?sf(i,l):Ht(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function Y0(e){return Array.from(e.getClientRects())}function H0(e){const t=on(e),n=ho(e),r=e.ownerDocument.body,s=ft(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=ft(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+mo(e);const a=-n.scrollTop;return At(r).direction==="rtl"&&(i+=ft(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:a}}const dc=25;function U0(e,t){const n=vt(e),r=on(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,a=0,l=0;if(s){o=s.width,i=s.height;const u=aa();(!u||u&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const c=mo(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=dc&&(o-=p)}else c<=dc&&(o+=c);return{width:o,height:i,x:a,y:l}}function G0(e,t){const n=_n(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=nt(e)?lr(e):Ht(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,l=s*o.x,c=r*o.y;return{width:i,height:a,x:l,y:c}}function fc(e,t,n){let r;if(t==="viewport")r=U0(e,n);else if(t==="document")r=H0(on(e));else if(Ae(t))r=G0(t,n);else{const s=rf(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return zs(r)}function of(e,t){const n=ur(e);return n===t||!Ae(n)||In(n)?!1:At(n).position==="fixed"||of(n,t)}function K0(e,t){const n=t.get(e);if(n)return n;let r=or(e,[],!1).filter(a=>Ae(a)&&ns(a)!=="body"),s=null;const o=At(e).position==="fixed";let i=o?ur(e):e;for(;Ae(i)&&!In(i);){const a=At(i),l=ud(i);!l&&a.position==="fixed"&&(s=null),(o?!l&&!s:!l&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||rs(i)&&!l&&of(e,i))?r=r.filter(u=>u!==i):s=a,i=ur(i)}return t.set(e,r),r}function z0(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?la(t)?[]:K0(t,this._c):[].concat(n),r],a=fc(t,i[0],s);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<i.length;f++){const h=fc(t,i[f],s);l=ft(h.top,l),c=fr(h.right,c),u=fr(h.bottom,u),d=ft(h.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function q0(e){const{width:t,height:n}=nf(e);return{width:t,height:n}}function X0(e,t,n){const r=nt(t),s=on(t),o=n==="fixed",i=_n(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Ht(0);function c(){l.x=mo(s)}if(r||!r&&!o)if((ns(t)!=="body"||rs(s))&&(a=ho(t)),r){const h=_n(t,!0,o,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else s&&c();o&&!r&&s&&c();const u=s&&!r&&!o?sf(s,a):Ht(0),d=i.left+a.scrollLeft-l.x-u.x,f=i.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:i.width,height:i.height}}function Qo(e){return At(e).position==="static"}function hc(e,t){if(!nt(e)||At(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return on(e)===n&&(n=n.ownerDocument.body),n}function af(e,t){const n=vt(e);if(la(e))return n;if(!nt(e)){let s=ur(e);for(;s&&!In(s);){if(Ae(s)&&!Qo(s))return s;s=ur(s)}return n}let r=hc(e,t);for(;r&&Lg(r)&&Qo(r);)r=hc(r,t);return r&&In(r)&&Qo(r)&&!ud(r)?n:r||Vg(e)||n}const Z0=async function(e){const t=this.getOffsetParent||af,n=this.getDimensions,r=await n(e.floating);return{reference:X0(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Q0(e){return At(e).direction==="rtl"}const J0={convertOffsetParentRelativeRectToViewportRelativeRect:$0,getDocumentElement:on,getClippingRect:z0,getOffsetParent:af,getElementRects:Z0,getClientRects:Y0,getDimensions:q0,getScale:lr,isElement:Ae,isRTL:Q0};function lf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ex(e,t){let n=null,r;const s=on(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(a||t(),!f||!h)return;const p=Ss(d),g=Ss(s.clientWidth-(u+f)),y=Ss(s.clientHeight-(d+h)),w=Ss(u),v={rootMargin:-p+"px "+-g+"px "+-y+"px "+-w+"px",threshold:ft(0,fr(1,l))||1};let k=!0;function S(C){const M=C[0].intersectionRatio;if(M!==l){if(!k)return i();M?i(!1,M):r=setTimeout(()=>{i(!1,1e-7)},1e3)}M===1&&!lf(c,e.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(S,{...v,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,v)}n.observe(e)}return i(!0),o}function mc(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=va(e),u=s||o?[...c?or(c):[],...t?or(t):[]]:[];u.forEach(w=>{s&&w.addEventListener("scroll",n,{passive:!0}),o&&w.addEventListener("resize",n)});const d=c&&a?ex(c,n):null;let f=-1,h=null;i&&(h=new ResizeObserver(w=>{let[x]=w;x&&x.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let p,g=l?_n(e):null;l&&y();function y(){const w=_n(e);g&&!lf(g,w)&&n(),g=w,p=requestAnimationFrame(y)}return n(),()=>{var w;u.forEach(x=>{s&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),d?.(),(w=h)==null||w.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const tx=j0,nx=L0,rx=N0,sx=_0,ox=I0,ix=V0,ax=(e,t,n)=>{const r=new Map,s={platform:J0,...n},o={...s.platform,_c:r};return A0(e,t,{...s,platform:o})};var lx=typeof document<"u",cx=function(){},Fs=lx?m.useLayoutEffect:cx;function to(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!to(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!to(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function cf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pc(e,t){const n=cf(e);return Math.round(t*n)/n}function Jo(e){const t=m.useRef(e);return Fs(()=>{t.current=e}),t}function ux(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=m.useState(r);to(f,r)||h(r);const[p,g]=m.useState(null),[y,w]=m.useState(null),x=m.useCallback(P=>{P!==C.current&&(C.current=P,g(P))},[]),v=m.useCallback(P=>{P!==M.current&&(M.current=P,w(P))},[]),k=o||p,S=i||y,C=m.useRef(null),M=m.useRef(null),D=m.useRef(u),F=l!=null,T=Jo(l),R=Jo(s),A=Jo(c),E=m.useCallback(()=>{if(!C.current||!M.current)return;const P={placement:t,strategy:n,middleware:f};R.current&&(P.platform=R.current),ax(C.current,M.current,P).then(I=>{const B={...I,isPositioned:A.current!==!1};j.current&&!to(D.current,B)&&(D.current=B,pn.flushSync(()=>{d(B)}))})},[f,t,n,R,A]);Fs(()=>{c===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,d(P=>({...P,isPositioned:!1})))},[c]);const j=m.useRef(!1);Fs(()=>(j.current=!0,()=>{j.current=!1}),[]),Fs(()=>{if(k&&(C.current=k),S&&(M.current=S),k&&S){if(T.current)return T.current(k,S,E);E()}},[k,S,E,T,F]);const N=m.useMemo(()=>({reference:C,floating:M,setReference:x,setFloating:v}),[x,v]),V=m.useMemo(()=>({reference:k,floating:S}),[k,S]),U=m.useMemo(()=>{const P={position:n,left:0,top:0};if(!V.floating)return P;const I=pc(V.floating,u.x),B=pc(V.floating,u.y);return a?{...P,transform:"translate("+I+"px, "+B+"px)",...cf(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:B}},[n,a,V.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:E,refs:N,elements:V,floatingStyles:U}),[u,E,N,V,U])}const dx=(e,t)=>{const n=tx(e);return{name:n.name,fn:n.fn,options:[e,t]}},fx=(e,t)=>{const n=nx(e);return{name:n.name,fn:n.fn,options:[e,t]}},hx=(e,t)=>({fn:ix(e).fn,options:[e,t]}),mx=(e,t)=>{const n=rx(e);return{name:n.name,fn:n.fn,options:[e,t]}},px=(e,t)=>{const n=sx(e);return{name:n.name,fn:n.fn,options:[e,t]}},gx=(e,t)=>{const n=ox(e);return{name:n.name,fn:n.fn,options:[e,t]}},yx={intentional:"onClick",sloppy:"onPointerDown"};function bx(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function uf(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingElement"),o=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:a,dataRef:l}=n.context,{enabled:c=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:f="sloppy",referencePress:h=!1,referencePressEvent:p="sloppy",ancestorScroll:g=!1,bubbles:y,externalTree:w}=t,x=wr(w),v=he(typeof d=="function"?d:()=>!1),k=typeof d=="function"?v:d,S=m.useRef(!1),{escapeKey:C,outsidePress:M}=bx(y),D=m.useRef(null),F=Vn(),T=Vn(),R=he(()=>{T.clear(),l.current.insideReactTree=!1}),A=m.useRef(!1),E=m.useRef(""),j=he(L=>{E.current=L.pointerType}),N=he(()=>{const L=E.current,ue=L==="pen"||!L?"mouse":L,te=typeof f=="function"?f():f;return typeof te=="string"?te:te[ue]}),V=he(L=>{if(!r||!c||!u||L.key!=="Escape"||A.current)return;const ue=l.current.floatingContext?.nodeId,te=x?Fn(x.nodesRef.current,ue):[];if(!C&&te.length>0){let se=!0;if(te.forEach(ie=>{ie.context?.open&&!ie.context.dataRef.current.__escapeKeyBubbles&&(se=!1)}),!se)return}const Me=Dy(L)?L.nativeEvent:L,H=Ve(dd,Me);n.setOpen(!1,H),!C&&!H.isPropagationAllowed&&L.stopPropagation()}),U=he(L=>{const ue=N();return ue==="intentional"&&L.type!=="click"||ue==="sloppy"&&L.type==="click"}),P=he(()=>{l.current.insideReactTree=!0,T.start(0,R)}),I=he((L,ue=!1)=>{if(U(L)){R();return}if(l.current.insideReactTree){R();return}if(N()==="intentional"&&ue||typeof k=="function"&&!k(L))return;const te=dt(L),Me=`[${Ur("inert")}]`,H=qe(n.select("floatingElement")).querySelectorAll(Me),se=n.context.triggerElements;if(te&&(se.hasElement(te)||se.hasMatchingElement(ne=>we(ne,te))))return;let ie=Ae(te)?te:null;for(;ie&&!In(ie);){const ne=ur(ie);if(In(ne)||!Ae(ne))break;ie=ne}if(H.length&&Ae(te)&&!Ey(te)&&!we(te,n.select("floatingElement"))&&Array.from(H).every(ne=>!we(ie,ne)))return;if(nt(te)&&!("touches"in L)){const ne=In(te),Ie=At(te),be=/auto|scroll/,_e=ne||be.test(Ie.overflowX),Ge=ne||be.test(Ie.overflowY),ot=_e&&te.clientWidth>0&&te.scrollWidth>te.clientWidth,Oe=Ge&&te.clientHeight>0&&te.scrollHeight>te.clientHeight,ye=Ie.direction==="rtl",Fe=Oe&&(ye?L.offsetX<=te.offsetWidth-te.clientWidth:L.offsetX>te.clientWidth),$e=ot&&L.offsetY>te.clientHeight;if(Fe||$e)return}const me=l.current.floatingContext?.nodeId,ge=x&&Fn(x.nodesRef.current,me).some(ne=>Ct(L,ne.context?.elements.floating));if(Ct(L,n.select("floatingElement"))||Ct(L,n.select("domReferenceElement"))||ge)return;const J=x?Fn(x.nodesRef.current,me):[];if(J.length>0){let ne=!0;if(J.forEach(Ie=>{Ie.context?.open&&!Ie.context.dataRef.current.__outsidePressBubbles&&(ne=!1)}),!ne)return}n.setOpen(!1,Ve(cd,L)),R()}),B=he(L=>{N()!=="sloppy"||L.pointerType==="touch"||!n.select("open")||!c||Ct(L,n.select("floatingElement"))||Ct(L,n.select("domReferenceElement"))||I(L)}),W=he(L=>{if(N()!=="sloppy"||!n.select("open")||!c||Ct(L,n.select("floatingElement"))||Ct(L,n.select("domReferenceElement")))return;const ue=L.touches[0];ue&&(D.current={startTime:Date.now(),startX:ue.clientX,startY:ue.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},F.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}),Q=he(L=>{const ue=dt(L);function te(){W(L),ue?.removeEventListener(L.type,te)}ue?.addEventListener(L.type,te)}),Y=he(L=>{const ue=S.current;if(S.current=!1,F.clear(),L.type==="mousedown"&&D.current&&!D.current.dismissOnMouseDown)return;const te=dt(L);function Me(){L.type==="pointerdown"?B(L):I(L,ue),te?.removeEventListener(L.type,Me)}te?.addEventListener(L.type,Me)}),$=he(L=>{if(N()!=="sloppy"||!D.current||Ct(L,n.select("floatingElement"))||Ct(L,n.select("domReferenceElement")))return;const ue=L.touches[0];if(!ue)return;const te=Math.abs(ue.clientX-D.current.startX),Me=Math.abs(ue.clientY-D.current.startY),H=Math.sqrt(te*te+Me*Me);H>5&&(D.current.dismissOnTouchEnd=!0),H>10&&(I(L),F.clear(),D.current=null)}),z=he(L=>{const ue=dt(L);function te(){$(L),ue?.removeEventListener(L.type,te)}ue?.addEventListener(L.type,te)}),Z=he(L=>{N()!=="sloppy"||!D.current||Ct(L,n.select("floatingElement"))||Ct(L,n.select("domReferenceElement"))||(D.current.dismissOnTouchEnd&&I(L),F.clear(),D.current=null)}),ce=he(L=>{const ue=dt(L);function te(){Z(L),ue?.removeEventListener(L.type,te)}ue?.addEventListener(L.type,te)});m.useEffect(()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=C,l.current.__outsidePressBubbles=M;const L=new gn;function ue(ie){n.setOpen(!1,Ve(_g,ie))}function te(){L.clear(),A.current=!0}function Me(){L.start(aa()?5:0,()=>{A.current=!1})}const H=qe(s);H.addEventListener("pointerdown",j,!0),u&&(H.addEventListener("keydown",V),H.addEventListener("compositionstart",te),H.addEventListener("compositionend",Me)),k&&(H.addEventListener("click",Y,!0),H.addEventListener("pointerdown",Y,!0),H.addEventListener("touchstart",Q,!0),H.addEventListener("touchmove",z,!0),H.addEventListener("touchend",ce,!0),H.addEventListener("mousedown",Y,!0));let se=[];return g&&(Ae(i)&&(se=or(i)),Ae(s)&&(se=se.concat(or(s))),!Ae(o)&&o&&o.contextElement&&(se=se.concat(or(o.contextElement)))),se=se.filter(ie=>ie!==H.defaultView?.visualViewport),se.forEach(ie=>{ie.addEventListener("scroll",ue,{passive:!0})}),()=>{H.removeEventListener("pointerdown",j,!0),u&&(H.removeEventListener("keydown",V),H.removeEventListener("compositionstart",te),H.removeEventListener("compositionend",Me)),k&&(H.removeEventListener("click",Y,!0),H.removeEventListener("pointerdown",Y,!0),H.removeEventListener("touchstart",Q,!0),H.removeEventListener("touchmove",z,!0),H.removeEventListener("touchend",ce,!0),H.removeEventListener("mousedown",Y,!0)),se.forEach(ie=>{ie.removeEventListener("scroll",ue)}),L.clear(),S.current=!1}},[l,s,o,i,u,k,r,a,g,c,C,M,V,I,Y,B,Q,z,ce,j,n]),m.useEffect(R,[k,R]);const Se=m.useMemo(()=>({onKeyDown:V,...h&&{[yx[p]]:L=>{n.setOpen(!1,Ve(mn,L.nativeEvent))},...p!=="intentional"&&{onClick(L){n.setOpen(!1,Ve(mn,L.nativeEvent))}}}}),[V,n,h,p]),Re=he(L=>{const ue=dt(L.nativeEvent);!we(n.select("floatingElement"),ue)||L.button!==0||(S.current=!0)}),Ee=he(L=>{!r||!c||L.button!==0||(S.current=!0)}),Je=m.useMemo(()=>({onKeyDown:V,onPointerDown:Re,onMouseDown:Re,onMouseUp:Re,onClickCapture:P,onMouseDownCapture(L){P(),Ee(L)},onPointerDownCapture(L){P(),Ee(L)},onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[V,Re,P,Ee]);return m.useMemo(()=>c?{reference:Se,floating:Je,trigger:Se}:{},[c,Se,Je])}const xx={open:pe(e=>e.open),domReferenceElement:pe(e=>e.domReferenceElement),referenceElement:pe(e=>e.positionReference??e.referenceElement),floatingElement:pe(e=>e.floatingElement),floatingId:pe(e=>e.floatingId)};class wa extends ya{constructor(t){const{nested:n,noEmit:r,onOpenChange:s,triggerElements:o,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:Kd(),nested:n,noEmit:r,triggerElements:o},xx)}setOpen=(t,n)=>{if((!t||!this.state.open||Cd(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(t,n)}}function vx(e,t=!1,n=!1){const[r,s]=m.useState(e&&t?"idle":void 0),[o,i]=m.useState(e);return e&&!o&&(i(!0),s("starting")),!e&&o&&r!=="ending"&&!n&&s("ending"),!e&&!o&&r==="ending"&&s(void 0),Te(()=>{if(!e&&o&&r!=="ending"&&n){const a=Vt.request(()=>{s("ending")});return()=>{Vt.cancel(a)}}},[e,o,r,n]),Te(()=>{if(!e||t)return;const a=Vt.request(()=>{s(void 0)});return()=>{Vt.cancel(a)}},[t,e]),Te(()=>{if(!e||!t)return;e&&o&&r!=="idle"&&s("starting");const a=Vt.request(()=>{s("idle")});return()=>{Vt.cancel(a)}},[t,e,o,s,r]),m.useMemo(()=>({mounted:o,setMounted:i,transitionStatus:r}),[o,r])}let Gr=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const wx={[Gr.startingStyle]:""},kx={[Gr.endingStyle]:""},po={transitionStatus(e){return e==="starting"?wx:e==="ending"?kx:null}};function df(e,t=!1,n=!0){const r=ba();return he((s,o=null)=>{r.cancel();function i(){pn.flushSync(s)}const a=Jt(e);if(a==null)return;const l=a;if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)s();else{let c=function(){const d=Gr.startingStyle;if(!l.hasAttribute(d)){r.request(u);return}const f=new MutationObserver(()=>{l.hasAttribute(d)||(f.disconnect(),u())});f.observe(l,{attributes:!0,attributeFilter:[d]}),o?.addEventListener("abort",()=>f.disconnect(),{once:!0})},u=function(){Promise.all(l.getAnimations().map(d=>d.finished)).then(()=>{o?.aborted||i()}).catch(()=>{const d=l.getAnimations();if(n){if(o?.aborted)return;i()}else d.length>0&&d.some(f=>f.pending||f.playState!=="finished")&&u()})};if(t){c();return}r.request(u)}})}function ka(e){const{enabled:t=!0,open:n,ref:r,onComplete:s}=e,o=he(s),i=df(r,n,!1);m.useEffect(()=>{if(!t)return;const a=new AbortController;return i(o,a.signal),()=>{a.abort()}},[t,n,o,i])}function Sx(e,t){const n=m.useRef(null),r=m.useRef(null);return m.useCallback(s=>{if(e!==void 0){if(n.current!==null){const o=n.current,i=r.current,a=t.context.triggerElements.getById(o);i&&a===i&&t.context.triggerElements.delete(o),n.current=null,r.current=null}s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s))}},[t,e])}function Tx(e,t,n,r){const s=n.useState("isMountedByTrigger",e),o=Sx(e,n),i=he(a=>{if(o(a),!a||!n.select("open"))return;const l=n.select("activeTriggerId");if(l===e){n.update({activeTriggerElement:a,...r});return}l==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...r})});return Te(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:s}}function ff(e){const t=e.useState("open");Te(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,s]=n.value;e.update({activeTriggerId:r,activeTriggerElement:s})}}},[t,e])}function hf(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=vx(e);t.useSyncedValues({mounted:r,transitionStatus:o});const i=he(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return ka({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:o}}class go{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elements.delete(r),this.elements.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function Cx(){return new wa({open:!1,floatingElement:null,referenceElement:null,triggerElements:new go,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function mf(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:Cx(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:Nn,inactiveTriggerProps:Nn,popupProps:Nn}}const pf={open:pe(e=>e.open),mounted:pe(e=>e.mounted),transitionStatus:pe(e=>e.transitionStatus),floatingRootContext:pe(e=>e.floatingRootContext),preventUnmountingOnClose:pe(e=>e.preventUnmountingOnClose),payload:pe(e=>e.payload),activeTriggerId:pe(e=>e.activeTriggerId),activeTriggerElement:pe(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:pe((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:pe((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:pe((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:pe((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:pe(e=>e.popupProps),popupElement:pe(e=>e.popupElement),positionerElement:pe(e=>e.positionerElement)};function Ex(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=ts(),o=Yn()!=null,i=bn(()=>new wa({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new go,floatingId:s,nested:o,noEmit:e.noEmit||!1})).current;return Te(()=>{const a={open:t,floatingId:s};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=Ae(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,s,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=o,i.context.noEmit=e.noEmit||!1,i}function Mx(e={}){const{nodeId:t,externalTree:n}=e,r=Ex(e),s=e.rootContext||r,o={reference:s.useState("referenceElement"),floating:s.useState("floatingElement"),domReference:s.useState("domReferenceElement")},[i,a]=m.useState(null),l=m.useRef(null),c=wr(n);Te(()=>{o.domReference&&(l.current=o.domReference)},[o.domReference]);const u=ux({...e,elements:{...o,...i&&{reference:i}}}),d=m.useCallback(M=>{const D=Ae(M)?{getBoundingClientRect:()=>M.getBoundingClientRect(),getClientRects:()=>M.getClientRects(),contextElement:M}:M;a(D),u.refs.setReference(D)},[u.refs]),[f,h]=m.useState(null),[p,g]=m.useState(null);s.useSyncedValue("referenceElement",f),s.useSyncedValue("domReferenceElement",Ae(f)?f:null),s.useSyncedValue("floatingElement",p);const y=m.useCallback(M=>{(Ae(M)||M===null)&&(l.current=M,h(M)),(Ae(u.refs.reference.current)||u.refs.reference.current===null||M!==null&&!Ae(M))&&u.refs.setReference(M)},[u.refs,h]),w=m.useCallback(M=>{g(M),u.refs.setFloating(M)},[u.refs]),x=m.useMemo(()=>({...u.refs,setReference:y,setFloating:w,setPositionReference:d,domReference:l}),[u.refs,y,w,d]),v=m.useMemo(()=>({...u.elements,domReference:o.domReference}),[u.elements,o.domReference]),k=s.useState("open"),S=s.useState("floatingId"),C=m.useMemo(()=>({...u,dataRef:s.context.dataRef,open:k,onOpenChange:s.setOpen,events:s.context.events,floatingId:S,refs:x,elements:v,nodeId:t,rootStore:s}),[u,x,v,t,s,k,S]);return Te(()=>{s.context.dataRef.current.floatingContext=C;const M=c?.nodesRef.current.find(D=>D.id===t);M&&(M.context=C)}),m.useMemo(()=>({...u,context:C,refs:x,elements:v,rootStore:s}),[u,x,v,C,s])}function gf(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:s}=e,o=ts(),i=Yn()!=null,a=t.useState("open"),l=t.useState("activeTriggerElement"),c=t.useState(r?"popupElement":"positionerElement"),u=t.context.triggerElements,d=bn(()=>new wa({open:a,referenceElement:l,floatingElement:c,triggerElements:u,onOpenChange:s,floatingId:o,nested:i,noEmit:n})).current;return Te(()=>{const f={open:a,floatingId:o,referenceElement:l,floatingElement:c};Ae(l)&&(f.domReferenceElement=l),d.state.positionReference===d.state.referenceElement&&(f.positionReference=l),d.update(f)},[a,o,l,c,d]),d.context.onOpenChange=s,d.context.nested=i,d.context.noEmit=n,d}const Ii=Ur("safe-polygon"),Dx=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Sd}`;function Px(e){return e?!!e.closest(Dx):!1}function yf(e){const t=m.useRef(void 0),n=m.useRef(!1),r=m.useRef(void 0),s=m.useRef(!0),o=m.useRef(!1),i=m.useRef(()=>{}),a=m.useRef(!1),l=Vn(),c=Vn(),u=m.useRef(void 0);return m.useMemo(()=>{const d=e.context.dataRef.current;return d.hoverInteractionState||(d.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:s,performedPointerEventsMutationRef:o,unbindMouseMoveRef:i,restTimeoutPendingRef:a,openChangeTimeout:l,restTimeout:c,handleCloseOptionsRef:u}),d.hoverInteractionState},[e,t,n,r,s,o,i,a,l,c,u])}const Rx=new Set(["click","mousedown"]);function Ox(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingElement"),o=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:l=0,externalTree:c}=t,{pointerTypeRef:u,interactedInsideRef:d,handlerRef:f,performedPointerEventsMutationRef:h,unbindMouseMoveRef:p,restTimeoutPendingRef:g,openChangeTimeout:y,handleCloseOptionsRef:w}=yf(n),x=wr(c),v=Yn(),k=he(()=>d.current?!0:i.current.openEvent?Rx.has(i.current.openEvent.type):!1),S=he(()=>{const T=i.current.openEvent?.type;return T?.includes("mouse")&&T!=="mousedown"}),C=m.useCallback((T,R=!0)=>{const A=Ax(l,u.current);A&&!f.current?y.start(A,()=>n.setOpen(!1,Ve(ut,T))):R&&(y.clear(),n.setOpen(!1,Ve(ut,T)))},[l,f,n,u,y]),M=he(()=>{p.current(),f.current=void 0}),D=he(()=>{if(h.current){const T=qe(s).body;T.style.pointerEvents="",T.removeAttribute(Ii),h.current=!1}}),F=he(T=>{const R=dt(T);if(!Px(R)){d.current=!1;return}d.current=!0});Te(()=>{r||(u.current=void 0,g.current=!1,d.current=!1,M(),D())},[r,u,g,d,M,D]),m.useEffect(()=>()=>{M()},[M]),m.useEffect(()=>D,[D]),Te(()=>{if(a&&r&&w.current?.blockPointerEvents&&S()&&Ae(o)&&s){h.current=!0;const T=qe(s).body;T.setAttribute(Ii,"");const R=o,A=s,E=x?.nodesRef.current.find(j=>j.id===v)?.context?.elements.floating;return E&&(E.style.pointerEvents=""),T.style.pointerEvents="none",R.style.pointerEvents="auto",A.style.pointerEvents="auto",()=>{T.style.pointerEvents="",R.style.pointerEvents="",A.style.pointerEvents=""}}},[a,r,o,s,w,S,x,v,h]),m.useEffect(()=>{if(!a)return;function T(j){if(k()||!i.current.floatingContext||!n.select("open"))return;const N=n.context.triggerElements;j.relatedTarget&&N.hasElement(j.relatedTarget)||(D(),M(),k()||C(j))}function R(j){y.clear(),D(),f.current?.(j),M()}function A(j){k()||C(j,!1)}const E=s;return E&&(E.addEventListener("mouseleave",T),E.addEventListener("mouseenter",R),E.addEventListener("mouseleave",A),E.addEventListener("pointerdown",F,!0)),()=>{E&&(E.removeEventListener("mouseleave",T),E.removeEventListener("mouseenter",R),E.removeEventListener("mouseleave",A),E.removeEventListener("pointerdown",F,!0))}})}function Ax(e,t){return t&&!dr(t)?0:typeof e=="function"?e():e}function ei(e){return typeof e=="function"?e():e}const Nx={current:null};function Ix(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:s}=n.context,{enabled:o=!0,delay:i=0,handleClose:a=null,mouseOnly:l=!1,restMs:c=0,move:u=!0,triggerElementRef:d=Nx,externalTree:f,isActiveTrigger:h=!0}=t,p=wr(f),{pointerTypeRef:g,interactedInsideRef:y,handlerRef:w,blockMouseMoveRef:x,performedPointerEventsMutationRef:v,unbindMouseMoveRef:k,restTimeoutPendingRef:S,openChangeTimeout:C,restTimeout:M,handleCloseOptionsRef:D}=yf(n),F=Bt(a),T=Bt(i),R=Bt(c);h&&(D.current=F.current?.__options);const A=he(()=>y.current?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),E=m.useCallback((U,P=!0)=>{const I=zo(T.current,"close",g.current);I&&!w.current?C.start(I,()=>n.setOpen(!1,Ve(ut,U))):P&&(C.clear(),n.setOpen(!1,Ve(ut,U)))},[T,w,n,g,C]),j=he(()=>{k.current(),w.current=void 0}),N=he(()=>{if(v.current){const U=qe(n.select("domReferenceElement")).body;U.style.pointerEvents="",U.removeAttribute(Ii),v.current=!1}});m.useEffect(()=>{if(!o)return;function U(P){P.open||(C.clear(),M.clear(),x.current=!0,S.current=!1)}return s.on("openchange",U),()=>{s.off("openchange",U)}},[o,s,C,M,x,S]);const V=he(U=>{if(A()||!r.current.floatingContext)return;const P=n.context.triggerElements;if(U.relatedTarget&&P.hasElement(U.relatedTarget))return;const I=d.current;F.current?.({...r.current.floatingContext,tree:p,x:U.clientX,y:U.clientY,onClose(){N(),j(),!A()&&I===n.select("domReferenceElement")&&E(U)}})(U)});return m.useEffect(()=>{if(!o)return;const U=d.current??(h?n.select("domReferenceElement"):null);if(!Ae(U))return;function P(W){if(C.clear(),x.current=!1,l&&!dr(g.current)||ei(R.current)>0&&!zo(T.current,"open"))return;const Q=zo(T.current,"open",g.current),Y=n.select("domReferenceElement"),$=n.context.triggerElements,z=($.hasElement(W.target)||$.hasMatchingElement(Re=>we(Re,W.target)))&&(!Y||!we(Y,W.target)),Z=W.currentTarget??null,ce=n.select("open"),Se=!ce||z;z&&ce?n.setOpen(!0,Ve(ut,W,Z)):Q?C.start(Q,()=>{Se&&n.setOpen(!0,Ve(ut,W,Z))}):Se&&n.setOpen(!0,Ve(ut,W,Z))}function I(W){if(A()){N();return}k.current();const Q=n.select("domReferenceElement"),Y=qe(Q);M.clear(),S.current=!1;const $=n.context.triggerElements;if(W.relatedTarget&&$.hasElement(W.relatedTarget))return;if(F.current&&r.current.floatingContext){n.select("open")||C.clear();const Z=d.current;w.current=F.current({...r.current.floatingContext,tree:p,x:W.clientX,y:W.clientY,onClose(){N(),j(),!A()&&Z===n.select("domReferenceElement")&&E(W,!0)}});const ce=w.current;ce(W),Y.addEventListener("mousemove",ce),k.current=()=>{Y.removeEventListener("mousemove",ce)};return}(g.current!=="touch"||!we(n.select("floatingElement"),W.relatedTarget))&&E(W)}function B(W){V(W)}return n.select("open")&&U.addEventListener("mouseleave",B),u&&U.addEventListener("mousemove",P,{once:!0}),U.addEventListener("mouseenter",P),U.addEventListener("mouseleave",I),()=>{U.removeEventListener("mouseleave",B),u&&U.removeEventListener("mousemove",P),U.removeEventListener("mouseenter",P),U.removeEventListener("mouseleave",I)}},[j,N,x,r,T,E,n,o,F,V,h,A,l,u,g,R,M,S,C,d,p,k,w]),m.useMemo(()=>{function U(P){g.current=P.pointerType}return{onPointerDown:U,onPointerEnter:U,onMouseMove(P){const{nativeEvent:I}=P,B=P.currentTarget,W=n.select("domReferenceElement"),Q=n.context.triggerElements,Y=n.select("open"),$=(Q.hasElement(P.target)||Q.hasMatchingElement(Z=>we(Z,P.target)))&&(!W||!we(W,P.target));if(l&&!dr(g.current)||Y&&!$||ei(R.current)===0||!$&&S.current&&P.movementX**2+P.movementY**2<2)return;M.clear();function z(){if(S.current=!1,A())return;const Z=n.select("open");!x.current&&(!Z||$)&&n.setOpen(!0,Ve(ut,I,B))}g.current==="touch"?pn.flushSync(()=>{z()}):$&&Y?z():(S.current=!0,M.start(ei(R.current),z))}}},[x,A,l,n,g,R,M,S])}function Sa(e=[]){const t=e.map(c=>c?.reference),n=e.map(c=>c?.floating),r=e.map(c=>c?.item),s=e.map(c=>c?.trigger),o=m.useCallback(c=>Ps(c,e,"reference"),t),i=m.useCallback(c=>Ps(c,e,"floating"),n),a=m.useCallback(c=>Ps(c,e,"item"),r),l=m.useCallback(c=>Ps(c,e,"trigger"),s);return m.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:a,getTriggerProps:l}),[o,i,a,l])}function Ps(e,t,n){const r=new Map,s=n==="item",o={};n==="floating"&&(o.tabIndex=-1,o[Di]="");for(const i in e)s&&e&&(i===wd||i===kd)||(o[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const l=t[i]?.[n];typeof l=="function"?a=e?l(e):null:a=l,a&&gc(o,a,s,r)}return gc(o,e,s,r),o}function gc(e,t,n,r){for(const s in t){const o=t[s];n&&(s===wd||s===kd)||(s.startsWith("on")?(r.has(s)||r.set(s,[]),typeof o=="function"&&(r.get(s)?.push(o),e[s]=(...i)=>r.get(s)?.map(a=>a(...i)).find(a=>a!==void 0))):e[s]=o)}}const Fx=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function bf(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingId"),o=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{enabled:a=!0,role:l="dialog"}=t,c=ts(),u=o?.id||c,d=m.useMemo(()=>Pi(i)?.id||s,[i,s]),f=Fx.get(l)??l,p=Yn()!=null,g=m.useMemo(()=>f==="tooltip"||l==="label"?Nn:{"aria-haspopup":f==="alertdialog"?"dialog":f,"aria-expanded":"false",...f==="listbox"&&{role:"combobox"},...f==="menu"&&p&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[f,p,l]),y=m.useMemo(()=>f==="tooltip"||l==="label"?{[`aria-${l==="label"?"labelledby":"describedby"}`]:r?d:void 0}:{...g,"aria-expanded":r?"true":"false","aria-controls":r?d:void 0,...f==="menu"&&{id:u}},[f,d,r,u,l,g]),w=m.useMemo(()=>{const v={id:d,...f&&{role:f}};return f==="tooltip"||l==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":u}}},[f,d,u,l]),x=m.useCallback(({active:v,selected:k})=>{const S={role:"option",...v&&{id:`${d}-fui-option`}};switch(l){case"select":case"combobox":return{...S,"aria-selected":k}}return{}},[d,l]);return m.useMemo(()=>a?{reference:y,floating:w,item:x,trigger:g}:{},[a,y,w,g,x])}function yc(e,t){const[n,r]=e;let s=!1;const o=t.length;for(let i=0,a=o-1;i<o;a=i++){const[l,c]=t[i]||[0,0],[u,d]=t[a]||[0,0];c>=r!=d>=r&&n<=(u-l)*(r-c)/(d-c)+l&&(s=!s)}return s}function jx(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Lx(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,s=new gn;let o=!1,i=null,a=null,l=typeof performance<"u"?performance.now():0;function c(d,f){const h=performance.now(),p=h-l;if(i===null||a===null||p===0)return i=d,a=f,l=h,null;const g=d-i,y=f-a,x=Math.sqrt(g*g+y*y)/p;return i=d,a=f,l=h,x}const u=({x:d,y:f,placement:h,elements:p,onClose:g,nodeId:y,tree:w})=>function(v){function k(){s.clear(),g()}if(s.clear(),!p.domReference||!p.floating||h==null||d==null||f==null)return;const{clientX:S,clientY:C}=v,M=[S,C],D=dt(v),F=v.type==="mouseleave",T=we(p.floating,D),R=we(p.domReference,D),A=p.domReference.getBoundingClientRect(),E=p.floating.getBoundingClientRect(),j=h.split("-")[0],N=d>E.right-E.width/2,V=f>E.bottom-E.height/2,U=jx(M,A),P=E.width>A.width,I=E.height>A.height,B=(P?A:E).left,W=(P?A:E).right,Q=(I?A:E).top,Y=(I?A:E).bottom;if(T&&(o=!0,!F))return;if(R&&(o=!1),R&&!F){o=!0;return}if(F&&Ae(v.relatedTarget)&&we(p.floating,v.relatedTarget)||w&&Fn(w.nodesRef.current,y).some(({context:Z})=>Z?.open))return;if(j==="top"&&f>=A.bottom-1||j==="bottom"&&f<=A.top+1||j==="left"&&d>=A.right-1||j==="right"&&d<=A.left+1)return k();let $=[];switch(j){case"top":$=[[B,A.top+1],[B,E.bottom-1],[W,E.bottom-1],[W,A.top+1]];break;case"bottom":$=[[B,E.top+1],[B,A.bottom-1],[W,A.bottom-1],[W,E.top+1]];break;case"left":$=[[E.right-1,Y],[E.right-1,Q],[A.left+1,Q],[A.left+1,Y]];break;case"right":$=[[A.right-1,Y],[A.right-1,Q],[E.left+1,Q],[E.left+1,Y]];break}function z([Z,ce]){switch(j){case"top":{const Se=[P?Z+t/2:N?Z+t*4:Z-t*4,ce+t+1],Re=[P?Z-t/2:N?Z+t*4:Z-t*4,ce+t+1],Ee=[[E.left,N||P?E.bottom-t:E.top],[E.right,N?P?E.bottom-t:E.top:E.bottom-t]];return[Se,Re,...Ee]}case"bottom":{const Se=[P?Z+t/2:N?Z+t*4:Z-t*4,ce-t],Re=[P?Z-t/2:N?Z+t*4:Z-t*4,ce-t],Ee=[[E.left,N||P?E.top+t:E.bottom],[E.right,N?P?E.top+t:E.bottom:E.top+t]];return[Se,Re,...Ee]}case"left":{const Se=[Z+t+1,I?ce+t/2:V?ce+t*4:ce-t*4],Re=[Z+t+1,I?ce-t/2:V?ce+t*4:ce-t*4];return[...[[V||I?E.right-t:E.left,E.top],[V?I?E.right-t:E.left:E.right-t,E.bottom]],Se,Re]}case"right":{const Se=[Z-t,I?ce+t/2:V?ce+t*4:ce-t*4],Re=[Z-t,I?ce-t/2:V?ce+t*4:ce-t*4],Ee=[[V||I?E.left+t:E.right,E.top],[V?I?E.left+t:E.right:E.left+t,E.bottom]];return[Se,Re,...Ee]}default:return[]}}if(!yc([S,C],$)){if(o&&!U)return k();if(!F&&r){const Z=c(v.clientX,v.clientY);if(Z!==null&&Z<.1)return k()}yc([S,C],z([d,f]))?!o&&r&&s.start(40,k):k()}};return u.__options={blockPointerEvents:n},u}function Vx(e){const t=m.useRef(""),n=m.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:m.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s&&e(s,s.pointerType),e(s,t.current),t.current=""},[e]),onPointerDown:n}}function xf(e){const[t,n]=m.useState(null),r=he((a,l)=>{e||n(l||(vd?"touch":""))}),s=m.useCallback(()=>{n(null)},[]),{onClick:o,onPointerDown:i}=Vx(r);return m.useMemo(()=>({openMethod:t,reset:s,triggerProps:{onClick:o,onPointerDown:i}}),[t,s,o,i])}let Pt=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Gr.startingStyle]="startingStyle",e[e.endingStyle=Gr.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),Fi=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const _x={[Fi.popupOpen]:""},Wx={[Fi.popupOpen]:"",[Fi.pressed]:""},Bx={[Pt.open]:""},$x={[Pt.closed]:""},Yx={[Pt.anchorHidden]:""},Hx={open(e){return e?_x:null}},Ux={open(e){return e?Wx:null}},os={open(e){return e?Bx:$x},anchorHidden(e){return e?Yx:null}};function vf(e){return ad(19)?e:e?"true":void 0}let bc={},xc={},vc="";function Gx(e){if(typeof document>"u")return!1;const t=$n(e);return vt(t).innerWidth-t.documentElement.clientWidth>0}function Kx(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=$n(e).documentElement,s={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY};r.style.scrollbarGutter="stable",r.style.overflowY="scroll";const o=r.offsetWidth;r.style.overflowY="hidden";const i=r.offsetWidth;return Object.assign(r.style,s),o===i}function zx(e){const t=$n(e),n=t.documentElement,r=t.body,s=rs(n)?n:r,o=s.style.overflow;return s.style.overflow="hidden",()=>{s.style.overflow=o}}function qx(e){const t=$n(e),n=t.documentElement,r=t.body,s=vt(n);let o=0,i=0,a=!1;const l=Vt.create();if(vy&&(s.visualViewport?.scale??1)!==1)return()=>{};function c(){const f=s.getComputedStyle(n),h=s.getComputedStyle(r),y=(f.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,bc={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},vc=n.style.scrollBehavior,xc={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const w=n.scrollHeight>n.clientHeight,x=n.scrollWidth>n.clientWidth,v=f.overflowY==="scroll"||h.overflowY==="scroll",k=f.overflowX==="scroll"||h.overflowX==="scroll",S=Math.max(0,s.innerWidth-r.clientWidth),C=Math.max(0,s.innerHeight-r.clientHeight),M=parseFloat(h.marginTop)+parseFloat(h.marginBottom),D=parseFloat(h.marginLeft)+parseFloat(h.marginRight),F=rs(n)?n:r;if(a=Kx(e),a){n.style.scrollbarGutter=y,F.style.overflowY="hidden",F.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(w||v)&&(n.style.overflowY="scroll"),(x||k)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:M||C?`calc(100dvh - ${M+C}px)`:"100dvh",width:D||S?`calc(100vw - ${D+S}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function u(){Object.assign(n.style,bc),Object.assign(r.style,xc),a||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=vc)}function d(){u(),l.request(c)}return c(),s.addEventListener("resize",d),()=>{l.cancel(),u(),typeof s.removeEventListener=="function"&&s.removeEventListener("resize",d)}}class Xx{lockCount=0;restore=null;timeoutLock=gn.create();timeoutUnlock=gn.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=$n(t).documentElement,s=vt(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=ld;return}const o=vd||!Gx(t);this.restore=o?zx(t):qx(t)}}const Zx=new Xx;function wf(e=!0,t=null){Te(()=>{if(e)return Zx.acquire(t)},[e,t])}const Qx=m.createContext(void 0);function Jx(){return m.useContext(Qx)?.direction??"ltr"}const ev=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:u=0,offsetParent:d="real"}=nn(e,t)||{};if(c==null)return{};const f=Ed(u),h={x:n,y:r},p=ma(s),g=ha(p),y=await i.getDimensions(c),w=p==="y",x=w?"top":"left",v=w?"bottom":"right",k=w?"clientHeight":"clientWidth",S=o.reference[g]+o.reference[p]-h[p]-o.floating[g],C=h[p]-o.reference[p],M=d==="real"?await i.getOffsetParent?.(c):a.floating;let D=a.floating[k]||o.floating[g];(!D||!await i.isElement?.(M))&&(D=a.floating[k]||o.floating[g]);const F=S/2-C/2,T=D/2-y[g]/2-1,R=Math.min(f[x],T),A=Math.min(f[v],T),E=R,j=D-y[g]-A,N=D/2-y[g]/2+F,V=Ri(E,N,j),U=!l.arrow&&xn(s)!=null&&N!==V&&o.reference[g]/2-(N<E?R:A)-y[g]/2<0,P=U?N<E?N-E:N-j:0;return{[p]:h[p]+P,data:{[p]:V,centerOffset:N-V-P,...U&&{alignmentOffset:P}},reset:U}}}),tv=(e,t)=>({...ev(e),options:[e,t]}),nv={name:"hide",async fn(e){const{width:t,height:n,x:r,y:s}=e.rects.reference,o=t===0&&n===0&&r===0&&s===0;return{data:{referenceHidden:(await gx().fn(e)).data?.referenceHidden||o}}}},js={sideX:"left",sideY:"top"},rv={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:s},platform:o,strategy:i,placement:a}=e,l=vt(s),c=l.getComputedStyle(s);if(!(c.transitionDuration!=="0s"&&c.transitionDuration!==""))return{x:t,y:n,data:js};const d=await o.getOffsetParent?.(s);let f={width:0,height:0};if(i==="fixed"&&l?.visualViewport)f={width:l.visualViewport.width,height:l.visualViewport.height};else if(d===l){const x=$n(s);f={width:x.documentElement.clientWidth,height:x.documentElement.clientHeight}}else await o.isElement?.(d)&&(f=await o.getDimensions(d));const h=it(a);let p=t,g=n;h==="left"&&(p=f.width-(t+r.width)),h==="top"&&(g=f.height-(n+r.height));const y=h==="left"?"right":js.sideX,w=h==="top"?"bottom":js.sideY;return{x:p,y:g,data:{sideX:y,sideY:w}}}};function kf(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function wc(e,t,n){const{rects:r,placement:s}=e;return{side:kf(t,it(s),n),align:xn(s)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function sv(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:l=5,sticky:c=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:h,mounted:p,collisionAvoidance:g,shiftCrossAxis:y=!1,nodeId:w,adaptiveOrigin:x,lazyFlip:v=!1,externalTree:k}=e,[S,C]=m.useState(null);!p&&S!==null&&C(null);const M=g.side||"flip",D=g.align||"flip",F=g.fallbackAxisSide||"end",T=typeof t=="function"?t:void 0,R=he(T),A=T?R:t,E=Bt(t),N=Jx()==="rtl",V=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":N?"left":"right","inline-start":N?"right":"left"}[r],U=o==="center"?V:`${V}-${o}`;let P=l;const I=1,B=r==="bottom"?I:0,W=r==="top"?I:0,Q=r==="right"?I:0,Y=r==="left"?I:0;typeof P=="number"?P={top:P+B,right:P+Y,bottom:P+W,left:P+Q}:P&&(P={top:(P.top||0)+B,right:(P.right||0)+Y,bottom:(P.bottom||0)+W,left:(P.left||0)+Q});const $={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:P},z=m.useRef(null),Z=Bt(s),ce=Bt(i),Ee=[dx(De=>{const Ye=wc(De,r,N),re=typeof Z.current=="function"?Z.current(Ye):Z.current,G=typeof ce.current=="function"?ce.current(Ye):ce.current;return{mainAxis:re,crossAxis:G,alignmentAxis:G}},[typeof s!="function"?s:0,typeof i!="function"?i:0,N,r])],Je=D==="none"&&M!=="shift",L=!Je&&(c||y||M==="shift"),ue=M==="none"?null:mx({...$,padding:{top:P.top+I,right:P.right+I,bottom:P.bottom+I,left:P.left+I},mainAxis:!y&&M==="flip",crossAxis:D==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),te=Je?null:fx(De=>{const Ye=$n(De.elements.floating).documentElement;return{...$,rootBoundary:y?{x:0,y:0,width:Ye.clientWidth,height:Ye.clientHeight}:void 0,mainAxis:D!=="none",crossAxis:L,limiter:c||y?void 0:hx(re=>{if(!z.current)return{};const{width:G,height:oe}=z.current.getBoundingClientRect(),de=yt(it(re.placement)),xe=de==="y"?G:oe,fe=de==="y"?P.left+P.right:P.top+P.bottom;return{offset:xe/2+fe/2}})}},[$,c,y,P,D]);M==="shift"||D==="shift"||o==="center"?Ee.push(te,ue):Ee.push(ue,te),Ee.push(px({...$,apply({elements:{floating:De},rects:{reference:Ye},availableWidth:re,availableHeight:G}){Object.entries({"--available-width":`${re}px`,"--available-height":`${G}px`,"--anchor-width":`${Ye.width}px`,"--anchor-height":`${Ye.height}px`}).forEach(([oe,de])=>{De.style.setProperty(oe,de)})}}),tv(()=>({element:z.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(De){const{elements:Ye,middlewareData:re,placement:G,rects:oe,y:de}=De,xe=it(G),fe=yt(xe),It=z.current,wn=re.arrow?.x||0,kn=re.arrow?.y||0,ln=It?.clientWidth||0,cn=It?.clientHeight||0,zt=wn+ln/2,Er=kn+cn/2,Ft=Math.abs(re.shift?.y||0),tt=oe.reference.height/2,Sn=typeof s=="function"?s(wc(De,r,N)):s,ps=Ft>Sn,Co={top:`${zt}px calc(100% + ${Sn}px)`,bottom:`${zt}px ${-Sn}px`,left:`calc(100% + ${Sn}px) ${Er}px`,right:`${-Sn}px ${Er}px`}[xe],lt=`${zt}px ${oe.reference.y+tt-de}px`;return Ye.floating.style.setProperty("--transform-origin",L&&fe==="y"&&ps?lt:Co),{}}},nv,x),Te(()=>{!p&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[p,h]);const Me=m.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:H,elements:se,x:ie,y:me,middlewareData:ge,update:J,placement:ne,context:Ie,isPositioned:be,floatingStyles:_e}=Mx({rootContext:h,placement:U,middleware:Ee,strategy:n,whileElementsMounted:f?void 0:(...De)=>mc(...De,Me),nodeId:w,externalTree:k}),{sideX:Ge,sideY:ot}=ge.adaptiveOrigin||js,Oe=be?n:"fixed",ye=m.useMemo(()=>x?{position:Oe,[Ge]:ie,[ot]:me}:{position:Oe,..._e},[x,Oe,Ge,ie,ot,me,_e]),Fe=m.useRef(null);Te(()=>{if(!p)return;const De=E.current,Ye=typeof De=="function"?De():De,G=(kc(Ye)?Ye.current:Ye)||null||null;G!==Fe.current&&(H.setPositionReference(G),Fe.current=G)},[p,H,A,E]),m.useEffect(()=>{if(!p)return;const De=E.current;typeof De!="function"&&kc(De)&&De.current!==Fe.current&&(H.setPositionReference(De.current),Fe.current=De.current)},[p,H,A,E]),m.useEffect(()=>{if(f&&p&&se.domReference&&se.floating)return mc(se.domReference,se.floating,J,Me)},[f,p,se,J,Me]);const $e=it(ne),Nt=kf(r,$e,N),kt=xn(ne)||"center",et=!!ge.hide?.referenceHidden;Te(()=>{v&&p&&be&&C($e)},[v,p,be,$e]);const an=m.useMemo(()=>({position:"absolute",top:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),at=ge.arrow?.centerOffset!==0;return m.useMemo(()=>({positionerStyles:ye,arrowStyles:an,arrowRef:z,arrowUncentered:at,side:Nt,align:kt,physicalSide:$e,anchorHidden:et,refs:H,context:Ie,isPositioned:be,update:J}),[ye,an,z,at,Nt,kt,$e,et,H,Ie,be,J])}function kc(e){return e!=null&&"current"in e}const Sf=m.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r?.getBoundingClientRect();o=`polygon(
2
+ 0% 0%,
3
+ 100% 0%,
4
+ 100% 100%,
5
+ 0% 100%,
6
+ 0% 0%,
7
+ ${i.left}px ${i.top}px,
8
+ ${i.left}px ${i.bottom}px,
9
+ ${i.right}px ${i.bottom}px,
10
+ ${i.right}px ${i.top}px,
11
+ ${i.left}px ${i.top}px
12
+ )`}return b.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})}),ov=m.createContext(void 0);function iv(e){return m.useContext(ov)}const Tf="ArrowUp",Cf="ArrowDown",Ef="ArrowLeft",Mf="ArrowRight",Df="Home",Pf="End",av=new Set([Ef,Mf]),lv=new Set([Tf,Cf]),cv=new Set([...av,...lv]);[...cv];const Rf=new Set([Tf,Cf,Ef,Mf,Df,Pf]);function Of(e){return e==="starting"?gy:Nn}const Af=m.createContext({});function Ta(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const uv=typeof window<"u",Nf=uv?m.useLayoutEffect:m.useEffect,Ca=m.createContext(null);function Ea(e,t){e.indexOf(t)===-1&&e.push(t)}function no(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Gt=(e,t,n)=>n>t?t:n<e?e:n;let Ma=()=>{};const yn={},If=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ff(e){return typeof e=="object"&&e!==null}const jf=e=>/^0[^.\s]+$/u.test(e);function Lf(e){let t;return()=>(t===void 0&&(t=e()),t)}const wt=e=>e,dv=(e,t)=>n=>t(e(n)),is=(...e)=>e.reduce(dv),Kr=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Da{constructor(){this.subscriptions=[]}add(t){return Ea(this.subscriptions,t),()=>no(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let o=0;o<s;o++){const i=this.subscriptions[o];i&&i(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const mt=e=>e*1e3,bt=e=>e/1e3;function Vf(e,t){return t?e*(1e3/t):0}const _f=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,fv=1e-7,hv=12;function mv(e,t,n,r,s){let o,i,a=0;do i=t+(n-t)/2,o=_f(i,r,s)-e,o>0?n=i:t=i;while(Math.abs(o)>fv&&++a<hv);return i}function as(e,t,n,r){if(e===t&&n===r)return wt;const s=o=>mv(o,0,1,e,n);return o=>o===0||o===1?o:_f(s(o),t,r)}const Wf=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Bf=e=>t=>1-e(1-t),$f=as(.33,1.53,.69,.99),Pa=Bf($f),Yf=Wf(Pa),Hf=e=>e>=1?1:(e*=2)<1?.5*Pa(e):.5*(2-Math.pow(2,-10*(e-1))),Ra=e=>1-Math.sin(Math.acos(e)),Uf=Bf(Ra),Gf=Wf(Ra),pv=as(.42,0,1,1),gv=as(0,0,.58,1),Kf=as(.42,0,.58,1),yv=e=>Array.isArray(e)&&typeof e[0]!="number",zf=e=>Array.isArray(e)&&typeof e[0]=="number",bv={linear:wt,easeIn:pv,easeInOut:Kf,easeOut:gv,circIn:Ra,circInOut:Gf,circOut:Uf,backIn:Pa,backInOut:Yf,backOut:$f,anticipate:Hf},xv=e=>typeof e=="string",Sc=e=>{if(zf(e)){Ma(e.length===4);const[t,n,r,s]=e;return as(t,n,r,s)}else if(xv(e))return bv[e];return e},Rs=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function vv(e,t){let n=new Set,r=new Set,s=!1,o=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){i.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&s?n:r;return d&&i.add(u),p.add(u),u},cancel:u=>{r.delete(u),i.delete(u)},process:u=>{if(a=u,s){o=!0;return}s=!0;const d=n;n=r,r=d,n.forEach(l),n.clear(),s=!1,o&&(o=!1,c.process(u))}};return c}const wv=40;function qf(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,i=Rs.reduce((v,k)=>(v[k]=vv(o),v),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:f,render:h,postRender:p}=i,g=()=>{const v=yn.useManualTiming,k=v?s.timestamp:performance.now();n=!1,v||(s.delta=r?1e3/60:Math.max(Math.min(k-s.timestamp,wv),1)),s.timestamp=k,s.isProcessing=!0,a.process(s),l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),p.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(g))},y=()=>{n=!0,r=!0,s.isProcessing||e(g)};return{schedule:Rs.reduce((v,k)=>{const S=i[k];return v[k]=(C,M=!1,D=!1)=>(n||y(),S.schedule(C,M,D)),v},{}),cancel:v=>{for(let k=0;k<Rs.length;k++)i[Rs[k]].cancel(v)},state:s,steps:i}}const{schedule:ke,cancel:rn,state:Ze,steps:ti}=qf(typeof requestAnimationFrame<"u"?requestAnimationFrame:wt,!0);let Ls;function kv(){Ls=void 0}const rt={now:()=>(Ls===void 0&&rt.set(Ze.isProcessing||yn.useManualTiming?Ze.timestamp:performance.now()),Ls),set:e=>{Ls=e,queueMicrotask(kv)}},Xf=e=>t=>typeof t=="string"&&t.startsWith(e),Zf=Xf("--"),Sv=Xf("var(--"),Oa=e=>Sv(e)?Tv.test(e.split("/*")[0].trim()):!1,Tv=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Tc(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const kr={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},zr={...kr,transform:e=>Gt(0,1,e)},Os={...kr,default:1},_r=e=>Math.round(e*1e5)/1e5,Aa=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Cv(e){return e==null}const Ev=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Na=(e,t)=>n=>!!(typeof n=="string"&&Ev.test(n)&&n.startsWith(e)||t&&!Cv(n)&&Object.prototype.hasOwnProperty.call(n,t)),Qf=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,o,i,a]=r.match(Aa);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(i),alpha:a!==void 0?parseFloat(a):1}},Mv=e=>Gt(0,255,e),ni={...kr,transform:e=>Math.round(Mv(e))},Rn={test:Na("rgb","red"),parse:Qf("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+ni.transform(e)+", "+ni.transform(t)+", "+ni.transform(n)+", "+_r(zr.transform(r))+")"};function Dv(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const ji={test:Na("#"),parse:Dv,transform:Rn.transform},ls=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),dn=ls("deg"),Ut=ls("%"),ee=ls("px"),Pv=ls("vh"),Rv=ls("vw"),Cc={...Ut,parse:e=>Ut.parse(e)/100,transform:e=>Ut.transform(e*100)},tr={test:Na("hsl","hue"),parse:Qf("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ut.transform(_r(t))+", "+Ut.transform(_r(n))+", "+_r(zr.transform(r))+")"},He={test:e=>Rn.test(e)||ji.test(e)||tr.test(e),parse:e=>Rn.test(e)?Rn.parse(e):tr.test(e)?tr.parse(e):ji.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Rn.transform(e):tr.transform(e),getAnimatableNone:e=>{const t=He.parse(e);return t.alpha=0,He.transform(t)}},Ov=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Av(e){return isNaN(e)&&typeof e=="string"&&(e.match(Aa)?.length||0)+(e.match(Ov)?.length||0)>0}const Jf="number",eh="color",Nv="var",Iv="var(",Ec="${}",Fv=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function pr(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let o=0;const a=t.replace(Fv,l=>(He.test(l)?(r.color.push(o),s.push(eh),n.push(He.parse(l))):l.startsWith(Iv)?(r.var.push(o),s.push(Nv),n.push(l)):(r.number.push(o),s.push(Jf),n.push(parseFloat(l))),++o,Ec)).split(Ec);return{values:n,split:a,indexes:r,types:s}}function jv(e){return pr(e).values}function th({split:e,types:t}){const n=e.length;return r=>{let s="";for(let o=0;o<n;o++)if(s+=e[o],r[o]!==void 0){const i=t[o];i===Jf?s+=_r(r[o]):i===eh?s+=He.transform(r[o]):s+=r[o]}return s}}function Lv(e){return th(pr(e))}const Vv=e=>typeof e=="number"?0:He.test(e)?He.getAnimatableNone(e):e,_v=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:Vv(e);function Wv(e){const t=pr(e);return th(t)(t.values.map((r,s)=>_v(r,t.split[s])))}const Ot={test:Av,parse:jv,createTransformer:Lv,getAnimatableNone:Wv};function ri(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Bv({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,o=0,i=0;if(!t)s=o=i=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;s=ri(l,a,e+1/3),o=ri(l,a,e),i=ri(l,a,e-1/3)}return{red:Math.round(s*255),green:Math.round(o*255),blue:Math.round(i*255),alpha:r}}function ro(e,t){return n=>n>0?t:e}const Ne=(e,t,n)=>e+(t-e)*n,si=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},$v=[ji,Rn,tr],Yv=e=>$v.find(t=>t.test(e));function Mc(e){const t=Yv(e);if(!t)return!1;let n=t.parse(e);return t===tr&&(n=Bv(n)),n}const Dc=(e,t)=>{const n=Mc(e),r=Mc(t);if(!n||!r)return ro(e,t);const s={...n};return o=>(s.red=si(n.red,r.red,o),s.green=si(n.green,r.green,o),s.blue=si(n.blue,r.blue,o),s.alpha=Ne(n.alpha,r.alpha,o),Rn.transform(s))},Li=new Set(["none","hidden"]);function Hv(e,t){return Li.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Uv(e,t){return n=>Ne(e,t,n)}function Ia(e){return typeof e=="number"?Uv:typeof e=="string"?Oa(e)?ro:He.test(e)?Dc:zv:Array.isArray(e)?nh:typeof e=="object"?He.test(e)?Dc:Gv:ro}function nh(e,t){const n=[...e],r=n.length,s=e.map((o,i)=>Ia(o)(o,t[i]));return o=>{for(let i=0;i<r;i++)n[i]=s[i](o);return n}}function Gv(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=Ia(e[s])(e[s],t[s]));return s=>{for(const o in r)n[o]=r[o](s);return n}}function Kv(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const o=t.types[s],i=e.indexes[o][r[o]],a=e.values[i]??0;n[s]=a,r[o]++}return n}const zv=(e,t)=>{const n=Ot.createTransformer(t),r=pr(e),s=pr(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Li.has(e)&&!s.values.length||Li.has(t)&&!r.values.length?Hv(e,t):is(nh(Kv(r,s),s.values),n):ro(e,t)};function rh(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Ne(e,t,n):Ia(e)(e,t)}const qv=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ke.update(t,n),stop:()=>rn(t),now:()=>Ze.isProcessing?Ze.timestamp:rt.now()}},sh=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let o=0;o<s;o++)r+=Math.round(e(o/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},so=2e4;function Fa(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<so;)t+=n,r=e.next(t);return t>=so?1/0:t}function Xv(e,t=100,n){const r=n({...e,keyframes:[0,t]}),s=Math.min(Fa(r),so);return{type:"keyframes",ease:o=>r.next(s*o).value/t,duration:bt(s)}}const Be={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Vi(e,t){return e*Math.sqrt(1-t*t)}const Zv=12;function Qv(e,t,n){let r=n;for(let s=1;s<Zv;s++)r=r-e(r)/t(r);return r}const oi=.001;function Jv({duration:e=Be.duration,bounce:t=Be.bounce,velocity:n=Be.velocity,mass:r=Be.mass}){let s,o,i=1-t;i=Gt(Be.minDamping,Be.maxDamping,i),e=Gt(Be.minDuration,Be.maxDuration,bt(e)),i<1?(s=c=>{const u=c*i,d=u*e,f=u-n,h=Vi(c,i),p=Math.exp(-d);return oi-f/h*p},o=c=>{const d=c*i*e,f=d*n+n,h=Math.pow(i,2)*Math.pow(c,2)*e,p=Math.exp(-d),g=Vi(Math.pow(c,2),i);return(-s(c)+oi>0?-1:1)*((f-h)*p)/g}):(s=c=>{const u=Math.exp(-c*e),d=(c-n)*e+1;return-oi+u*d},o=c=>{const u=Math.exp(-c*e),d=(n-c)*(e*e);return u*d});const a=5/e,l=Qv(s,o,a);if(e=mt(e),isNaN(l))return{stiffness:Be.stiffness,damping:Be.damping,duration:e};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:i*2*Math.sqrt(r*c),duration:e}}}const ew=["duration","bounce"],tw=["stiffness","damping","mass"];function Pc(e,t){return t.some(n=>e[n]!==void 0)}function nw(e){let t={velocity:Be.velocity,stiffness:Be.stiffness,damping:Be.damping,mass:Be.mass,isResolvedFromDuration:!1,...e};if(!Pc(e,tw)&&Pc(e,ew))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,o=2*Gt(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:Be.mass,stiffness:s,damping:o}}else{const n=Jv({...e,velocity:0});t={...t,...n,mass:Be.mass},t.isResolvedFromDuration=!0}return t}function oo(e=Be.visualDuration,t=Be.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const o=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:d,velocity:f,isResolvedFromDuration:h}=nw({...n,velocity:-bt(n.velocity||0)}),p=f||0,g=c/(2*Math.sqrt(l*u)),y=i-o,w=bt(Math.sqrt(l/u)),x=Math.abs(y)<5;r||(r=x?Be.restSpeed.granular:Be.restSpeed.default),s||(s=x?Be.restDelta.granular:Be.restDelta.default);let v,k,S,C,M,D;if(g<1)S=Vi(w,g),C=(p+g*w*y)/S,v=T=>{const R=Math.exp(-g*w*T);return i-R*(C*Math.sin(S*T)+y*Math.cos(S*T))},M=g*w*C+y*S,D=g*w*y-C*S,k=T=>Math.exp(-g*w*T)*(M*Math.sin(S*T)+D*Math.cos(S*T));else if(g===1){v=R=>i-Math.exp(-w*R)*(y+(p+w*y)*R);const T=p+w*y;k=R=>Math.exp(-w*R)*(w*T*R-p)}else{const T=w*Math.sqrt(g*g-1);v=j=>{const N=Math.exp(-g*w*j),V=Math.min(T*j,300);return i-N*((p+g*w*y)*Math.sinh(V)+T*y*Math.cosh(V))/T};const R=(p+g*w*y)/T,A=g*w*R-y*T,E=g*w*y-R*T;k=j=>{const N=Math.exp(-g*w*j),V=Math.min(T*j,300);return N*(A*Math.sinh(V)+E*Math.cosh(V))}}const F={calculatedDuration:h&&d||null,velocity:T=>mt(k(T)),next:T=>{if(!h&&g<1){const A=Math.exp(-g*w*T),E=Math.sin(S*T),j=Math.cos(S*T),N=i-A*(C*E+y*j),V=mt(A*(M*E+D*j));return a.done=Math.abs(V)<=r&&Math.abs(i-N)<=s,a.value=a.done?i:N,a}const R=v(T);if(h)a.done=T>=d;else{const A=mt(k(T));a.done=Math.abs(A)<=r&&Math.abs(i-R)<=s}return a.value=a.done?i:R,a},toString:()=>{const T=Math.min(Fa(F),so),R=sh(A=>F.next(T*A).value,T,30);return T+"ms "+R},toTransition:()=>{}};return F}oo.applyToOptions=e=>{const t=Xv(e,100,oo);return e.ease=t.ease,e.duration=mt(t.duration),e.type="keyframes",e};const rw=5;function oh(e,t,n){const r=Math.max(t-rw,0);return Vf(n-e(r),t-r)}function _i({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:i,min:a,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],f={done:!1,value:d},h=D=>a!==void 0&&D<a||l!==void 0&&D>l,p=D=>a===void 0?l:l===void 0||Math.abs(a-D)<Math.abs(l-D)?a:l;let g=n*t;const y=d+g,w=i===void 0?y:i(y);w!==y&&(g=w-d);const x=D=>-g*Math.exp(-D/r),v=D=>w+x(D),k=D=>{const F=x(D),T=v(D);f.done=Math.abs(F)<=c,f.value=f.done?w:T};let S,C;const M=D=>{h(f.value)&&(S=D,C=oo({keyframes:[f.value,p(f.value)],velocity:oh(v,D,f.value),damping:s,stiffness:o,restDelta:c,restSpeed:u}))};return M(0),{calculatedDuration:null,next:D=>{let F=!1;return!C&&S===void 0&&(F=!0,k(D),M(D)),S!==void 0&&D>=S?C.next(D-S):(!F&&k(D),f)}}}function sw(e,t,n){const r=[],s=n||yn.mix||rh,o=e.length-1;for(let i=0;i<o;i++){let a=s(e[i],e[i+1]);if(t){const l=Array.isArray(t)?t[i]||wt:t;a=is(l,a)}r.push(a)}return r}function ih(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const o=e.length;if(Ma(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=sw(t,r,s),l=a.length,c=u=>{if(i&&u<e[0])return t[0];let d=0;if(l>1)for(;d<e.length-2&&!(u<e[d+1]);d++);const f=Kr(e[d],e[d+1],u);return a[d](f)};return n?u=>c(Gt(e[0],e[o-1],u)):c}function ow(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Kr(0,t,r);e.push(Ne(n,1,s))}}function iw(e){const t=[0];return ow(t,e.length-1),t}function aw(e,t){return e.map(n=>n*t)}function lw(e,t){return e.map(()=>t||Kf).splice(0,e.length-1)}function Wr({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=yv(r)?r.map(Sc):Sc(r),o={done:!1,value:t[0]},i=aw(n&&n.length===t.length?n:iw(t),e),a=ih(i,t,{ease:Array.isArray(s)?s:lw(t,s)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}const cw=e=>e!==null;function yo(e,{repeat:t,repeatType:n="loop"},r,s=1){const o=e.filter(cw),a=s<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!a||r===void 0?o[a]:r}const uw={decay:_i,inertia:_i,tween:Wr,keyframes:Wr,spring:oo};function ah(e){typeof e.type=="string"&&(e.type=uw[e.type])}class ja{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const dw=e=>e/100;class qr extends ja{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==rt.now()&&this.tick(rt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;ah(t);const{type:n=Wr,repeat:r=0,repeatDelay:s=0,repeatType:o,velocity:i=0}=t;let{keyframes:a}=t;const l=n||Wr;l!==Wr&&typeof a[0]!="number"&&(this.mixKeyframes=is(dw,rh(a[0],a[1])),a=[0,100]);const c=l({...t,keyframes:a});o==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-i})),c.calculatedDuration===null&&(c.calculatedDuration=Fa(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=c}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:s,mixKeyframes:o,mirroredGenerator:i,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:c=0,keyframes:u,repeat:d,repeatType:f,repeatDelay:h,type:p,onUpdate:g,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const w=this.currentTime-c*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?w<0:w>s;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let v=this.currentTime,k=r;if(d){const D=Math.min(this.currentTime,s)/a;let F=Math.floor(D),T=D%1;!T&&D>=1&&(T=1),T===1&&F--,F=Math.min(F,d+1),F%2&&(f==="reverse"?(T=1-T,h&&(T-=h/a)):f==="mirror"&&(k=i)),v=Gt(0,1,T)*a}let S;x?(this.delayState.value=u[0],S=this.delayState):S=k.next(v),o&&!x&&(S.value=o(S.value));let{done:C}=S;!x&&l!==null&&(C=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const M=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return M&&p!==_i&&(S.value=yo(u,this.options,y,this.speed)),g&&g(S.value),M&&this.finish(),S}then(t,n){return this.finished.then(t,n)}get duration(){return bt(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+bt(t)}get time(){return bt(this.currentTime)}set time(t){t=mt(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return oh(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(rt.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=bt(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=qv,startTime:n}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(rt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function fw(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const On=e=>e*180/Math.PI,Wi=e=>{const t=On(Math.atan2(e[1],e[0]));return Bi(t)},hw={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Wi,rotateZ:Wi,skewX:e=>On(Math.atan(e[1])),skewY:e=>On(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Bi=e=>(e=e%360,e<0&&(e+=360),e),Rc=Wi,Oc=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Ac=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),mw={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Oc,scaleY:Ac,scale:e=>(Oc(e)+Ac(e))/2,rotateX:e=>Bi(On(Math.atan2(e[6],e[5]))),rotateY:e=>Bi(On(Math.atan2(-e[2],e[0]))),rotateZ:Rc,rotate:Rc,skewX:e=>On(Math.atan(e[4])),skewY:e=>On(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function $i(e){return e.includes("scale")?1:0}function Yi(e,t){if(!e||e==="none")return $i(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=mw,s=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=hw,s=a}if(!s)return $i(t);const o=r[t],i=s[1].split(",").map(gw);return typeof o=="function"?o(i):i[o]}const pw=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Yi(n,t)};function gw(e){return parseFloat(e.trim())}const Sr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Tr=new Set(Sr),Nc=e=>e===kr||e===ee,yw=new Set(["x","y","z"]),bw=Sr.filter(e=>!yw.has(e));function xw(e){const t=[];return bw.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const hn={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const s=e.max-e.min;return r==="border-box"?s:s-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const s=e.max-e.min;return r==="border-box"?s:s-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Yi(t,"x"),y:(e,{transform:t})=>Yi(t,"y")};hn.translateX=hn.x;hn.translateY=hn.y;const jn=new Set;let Hi=!1,Ui=!1,Gi=!1;function lh(){if(Ui){const e=Array.from(jn).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=xw(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([o,i])=>{r.getValue(o)?.set(i)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Ui=!1,Hi=!1,jn.forEach(e=>e.complete(Gi)),jn.clear()}function ch(){jn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ui=!0)})}function vw(){Gi=!0,ch(),lh(),Gi=!1}class La{constructor(t,n,r,s,o,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=o,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(jn.add(this),Hi||(Hi=!0,ke.read(ch),ke.resolveKeyframes(lh))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;if(t[0]===null){const o=s?.get(),i=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const a=r.readValue(n,i);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=i),s&&o===void 0&&s.set(t[0])}fw(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),jn.delete(this)}cancel(){this.state==="scheduled"&&(jn.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const ww=e=>e.startsWith("--");function uh(e,t,n){ww(t)?e.style.setProperty(t,n):e.style[t]=n}const kw={};function dh(e,t){const n=Lf(e);return()=>kw[t]??n()}const Sw=dh(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),fh=dh(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),jr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ic={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:jr([0,.65,.55,1]),circOut:jr([.55,0,1,.45]),backIn:jr([.31,.01,.66,-.59]),backOut:jr([.33,1.53,.69,.99])};function hh(e,t){if(e)return typeof e=="function"?fh()?sh(e,t):"ease-out":zf(e)?jr(e):Array.isArray(e)?e.map(n=>hh(n,t)||Ic.easeOut):Ic[e]}function Tw(e,t,n,{delay:r=0,duration:s=300,repeat:o=0,repeatType:i="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=hh(a,s);Array.isArray(d)&&(u.easing=d);const f={delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:i==="reverse"?"alternate":"normal"};return c&&(f.pseudoElement=c),e.animate(u,f)}function mh(e){return typeof e=="function"&&"applyToOptions"in e}function Cw({type:e,...t}){return mh(e)&&fh()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class ph extends ja{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:s,pseudoElement:o,allowFlatten:i=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!o,this.allowFlatten=i,this.options=t,Ma(typeof t.type!="string");const c=Cw(t);this.animation=Tw(n,r,s,c,o),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const u=yo(s,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(u),uh(n,r,u),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return bt(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+bt(t)}get time(){return bt(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=mt(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Sw()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),wt):s(this)}}const gh={anticipate:Hf,backInOut:Yf,circInOut:Gf};function Ew(e){return e in gh}function Mw(e){typeof e.ease=="string"&&Ew(e.ease)&&(e.ease=gh[e.ease])}const ii=10;class Dw extends ph{constructor(t){Mw(t),ah(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:s,element:o,...i}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new qr({...i,autoplay:!1}),l=Math.max(ii,rt.now()-this.startTime),c=Gt(0,ii,l-ii),u=a.sample(l).value,{name:d}=this.options;o&&d&&uh(o,d,u),n.setWithVelocity(a.sample(Math.max(0,l-c)).value,u,c),a.stop()}}const Fc=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ot.test(e)||e==="0")&&!e.startsWith("url("));function Pw(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Rw(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],i=Fc(s,t),a=Fc(o,t);return!i||!a?!1:Pw(e)||(n==="spring"||mh(n))&&r}function Ki(e){e.duration=0,e.type="keyframes"}const yh=new Set(["opacity","clipPath","filter","transform"]),Ow=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Aw(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&Ow.test(e[t]))return!0;return!1}const Nw=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Iw=Lf(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Fw(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:s,damping:o,type:i,keyframes:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return Iw()&&n&&(yh.has(n)||Nw.has(n)&&Aw(a))&&(n!=="transform"||!u)&&!c&&!r&&s!=="mirror"&&o!==0&&i!=="inertia"}const jw=40;class Lw extends ja{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:o=0,repeatType:i="loop",keyframes:a,name:l,motionValue:c,element:u,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=rt.now();const f={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:o,repeatType:i,name:l,motionValue:c,element:u,...d},h=u?.KeyframeResolver||La;this.keyframeResolver=new h(a,(p,g,y)=>this.onKeyframesResolved(p,g,f,!y),l,c,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,r,s){this.keyframeResolver=void 0;const{name:o,type:i,velocity:a,delay:l,isHandoff:c,onUpdate:u}=r;this.resolvedAt=rt.now();let d=!0;Rw(t,o,i,a)||(d=!1,(yn.instantAnimations||!l)&&u?.(yo(t,r,n)),t[0]=t[t.length-1],Ki(r),r.repeat=0);const h={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>jw?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},p=d&&!c&&Fw(h),g=h.motionValue?.owner?.current;let y;if(p)try{y=new Dw({...h,element:g})}catch{y=new qr(h)}else y=new qr(h);y.finished.then(()=>{this.notifyFinished()}).catch(wt),this.pendingTimeline&&(this.stopTimeline=y.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=y}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),vw()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function bh(e,t,n,r=0,s=1){const o=Array.from(e).sort((c,u)=>c.sortNodePosition(u)).indexOf(t),i=e.size,a=(i-1)*r;return typeof n=="function"?n(o,i):s===1?o*r:a-o*r}const Vw=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _w(e){const t=Vw.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function xh(e,t,n=1){const[r,s]=_w(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const i=o.trim();return If(i)?parseFloat(i):i}return Oa(s)?xh(s,t,n+1):s}const Ww={type:"spring",stiffness:500,damping:25,restSpeed:10},Bw=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),$w={type:"keyframes",duration:.8},Yw={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Hw=(e,{keyframes:t})=>t.length>2?$w:Tr.has(e)?e.startsWith("scale")?Bw(t[1]):Ww:Yw;function vh(e,t){if(e?.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Va(e,t){const n=e?.[t]??e?.default??e;return n!==e?vh(n,e):n}const Uw=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function Gw(e){for(const t in e)if(!Uw.has(t))return!0;return!1}const _a=(e,t,n,r={},s,o)=>i=>{const a=Va(r,e)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-mt(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-c,onUpdate:f=>{t.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{i(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:s};Gw(a)||Object.assign(u,Hw(e,u)),u.duration&&(u.duration=mt(u.duration)),u.repeatDelay&&(u.repeatDelay=mt(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Ki(u),u.delay===0&&(d=!0)),(yn.instantAnimations||yn.skipAnimations||s?.shouldSkipAnimations)&&(d=!0,Ki(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,d&&!o&&t.get()!==void 0){const f=yo(u.keyframes,a);if(f!==void 0){ke.update(()=>{u.onUpdate(f),u.onComplete()});return}}return a.isSync?new qr(u):new Lw(u)};function jc(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Wa(e,t,n,r){if(typeof t=="function"){const[s,o]=jc(r);t=t(n!==void 0?n:e.custom,s,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,o]=jc(r);t=t(n!==void 0?n:e.custom,s,o)}return t}function Ln(e,t,n){const r=e.getProps();return Wa(r,t,n!==void 0?n:r.custom,e)}const wh=new Set(["width","height","top","left","right","bottom",...Sr]),Lc=30,Kw=e=>!isNaN(parseFloat(e)),Br={current:void 0};class zw{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const s=rt.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=rt.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Kw(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Da);const r=this.events[t].add(n);return t==="change"?()=>{r(),ke.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return Br.current&&Br.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=rt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Lc)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Lc);return Vf(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Wn(e,t){return new zw(e,t)}const zi=e=>Array.isArray(e);function qw(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Wn(n))}function Xw(e){return zi(e)?e[e.length-1]||0:e}function Zw(e,t){const n=Ln(e,t);let{transitionEnd:r={},transition:s={},...o}=n||{};o={...o,...r};for(const i in o){const a=Xw(o[i]);qw(e,i,a)}}const Xe=e=>!!(e&&e.getVelocity);function Qw(e){return!!(Xe(e)&&e.add)}function qi(e,t){const n=e.getValue("willChange");if(Qw(n))return n.add(t);if(!n&&yn.WillChange){const r=new yn.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Ba(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Jw="framerAppearId",kh="data-"+Ba(Jw);function Sh(e){return e.props[kh]}function ek({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Th(e,t,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:o,transitionEnd:i,...a}=t;const l=e.getDefaultTransition();o=o?vh(o,l):l;const c=o?.reduceMotion;r&&(o=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const f in a){const h=e.getValue(f,e.latestValues[f]??null),p=a[f];if(p===void 0||d&&ek(d,f))continue;const g={delay:n,...Va(o||{},f)},y=h.get();if(y!==void 0&&!h.isAnimating()&&!Array.isArray(p)&&p===y&&!g.velocity){ke.update(()=>h.set(p));continue}let w=!1;if(window.MotionHandoffAnimation){const k=Sh(e);if(k){const S=window.MotionHandoffAnimation(k,f,ke);S!==null&&(g.startTime=S,w=!0)}}qi(e,f);const x=c??e.shouldReduceMotion;h.start(_a(f,h,p,x&&wh.has(f)?{type:!1}:g,e,w));const v=h.animation;v&&u.push(v)}if(i){const f=()=>ke.update(()=>{i&&Zw(e,i)});u.length?Promise.all(u).then(f):f()}return u}function Xi(e,t,n={}){const r=Ln(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const o=r?()=>Promise.all(Th(e,r,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:u,staggerDirection:d}=s;return tk(e,t,l,c,u,d,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[l,c]=a==="beforeChildren"?[o,i]:[i,o];return l().then(()=>c())}else return Promise.all([o(),i(n.delay)])}function tk(e,t,n=0,r=0,s=0,o=1,i){const a=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),a.push(Xi(l,t,{...i,delay:n+(typeof r=="function"?0:r)+bh(e.variantChildren,l,r,s,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}function nk(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(o=>Xi(e,o,n));r=Promise.all(s)}else if(typeof t=="string")r=Xi(e,t,n);else{const s=typeof t=="function"?Ln(e,t,n.custom):t;r=Promise.all(Th(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const rk={test:e=>e==="auto",parse:e=>e},Ch=e=>t=>t.test(e),Eh=[kr,ee,Ut,dn,Rv,Pv,rk],Vc=e=>Eh.find(Ch(e));function sk(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||jf(e):!0}const ok=new Set(["brightness","contrast","saturate","opacity"]);function ik(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Aa)||[];if(!r)return e;const s=n.replace(r,"");let o=ok.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+s+")"}const ak=/\b([a-z-]*)\(.*?\)/gu,Zi={...Ot,getAnimatableNone:e=>{const t=e.match(ak);return t?t.map(ik).join(" "):e}},Qi={...Ot,getAnimatableNone:e=>{const t=Ot.parse(e);return Ot.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},_c={...kr,transform:Math.round},lk={rotate:dn,rotateX:dn,rotateY:dn,rotateZ:dn,scale:Os,scaleX:Os,scaleY:Os,scaleZ:Os,skew:dn,skewX:dn,skewY:dn,distance:ee,translateX:ee,translateY:ee,translateZ:ee,x:ee,y:ee,z:ee,perspective:ee,transformPerspective:ee,opacity:zr,originX:Cc,originY:Cc,originZ:ee},$a={borderWidth:ee,borderTopWidth:ee,borderRightWidth:ee,borderBottomWidth:ee,borderLeftWidth:ee,borderRadius:ee,borderTopLeftRadius:ee,borderTopRightRadius:ee,borderBottomRightRadius:ee,borderBottomLeftRadius:ee,width:ee,maxWidth:ee,height:ee,maxHeight:ee,top:ee,right:ee,bottom:ee,left:ee,inset:ee,insetBlock:ee,insetBlockStart:ee,insetBlockEnd:ee,insetInline:ee,insetInlineStart:ee,insetInlineEnd:ee,padding:ee,paddingTop:ee,paddingRight:ee,paddingBottom:ee,paddingLeft:ee,paddingBlock:ee,paddingBlockStart:ee,paddingBlockEnd:ee,paddingInline:ee,paddingInlineStart:ee,paddingInlineEnd:ee,margin:ee,marginTop:ee,marginRight:ee,marginBottom:ee,marginLeft:ee,marginBlock:ee,marginBlockStart:ee,marginBlockEnd:ee,marginInline:ee,marginInlineStart:ee,marginInlineEnd:ee,fontSize:ee,backgroundPositionX:ee,backgroundPositionY:ee,...lk,zIndex:_c,fillOpacity:zr,strokeOpacity:zr,numOctaves:_c},ck={...$a,color:He,backgroundColor:He,outlineColor:He,fill:He,stroke:He,borderColor:He,borderTopColor:He,borderRightColor:He,borderBottomColor:He,borderLeftColor:He,filter:Zi,WebkitFilter:Zi,mask:Qi,WebkitMask:Qi},Mh=e=>ck[e],uk=new Set([Zi,Qi]);function Dh(e,t){let n=Mh(e);return uk.has(n)||(n=Ot),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const dk=new Set(["auto","none","0"]);function fk(e,t,n){let r=0,s;for(;r<e.length&&!s;){const o=e[r];typeof o=="string"&&!dk.has(o)&&pr(o).values.length&&(s=e[r]),r++}if(s&&n)for(const o of t)e[o]=Dh(n,s)}class hk extends La{constructor(t,n,r,s,o){super(t,n,r,s,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let d=t[u];if(typeof d=="string"&&(d=d.trim(),Oa(d))){const f=xh(d,n.current);f!==void 0&&(t[u]=f),u===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!wh.has(r)||t.length!==2)return;const[s,o]=t,i=Vc(s),a=Vc(o),l=Tc(s),c=Tc(o);if(l!==c&&hn[r]){this.needsMeasurement=!0;return}if(i!==a)if(Nc(i)&&Nc(a))for(let u=0;u<t.length;u++){const d=t[u];typeof d=="string"&&(t[u]=parseFloat(d))}else hn[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)(t[s]===null||sk(t[s]))&&r.push(s);r.length&&fk(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=hn[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const s=t.getValue(n);s&&s.jump(this.measuredOrigin,!1);const o=r.length-1,i=r[o];r[o]=hn[n](t.measureViewportBox(),window.getComputedStyle(t.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),this.removedTransforms?.length&&this.removedTransforms.forEach(([a,l])=>{t.getValue(a).set(l)}),this.resolveNoneKeyframes()}}function Ph(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const s=n?.[e]??r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(r=>r!=null)}const Rh=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function mk(e){return Ff(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Ya}=qf(queueMicrotask,!1),Dt={x:!1,y:!1};function Oh(){return Dt.x||Dt.y}function pk(e){return e==="x"||e==="y"?Dt[e]?null:(Dt[e]=!0,()=>{Dt[e]=!1}):Dt.x||Dt.y?null:(Dt.x=Dt.y=!0,()=>{Dt.x=Dt.y=!1})}function Ah(e,t){const n=Ph(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function gk(e){return!(e.pointerType==="touch"||Oh())}function yk(e,t,n={}){const[r,s,o]=Ah(e,n);return r.forEach(i=>{let a=!1,l=!1,c;const u=()=>{i.removeEventListener("pointerleave",p)},d=y=>{c&&(c(y),c=void 0),u()},f=y=>{a=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,d(y))},h=()=>{a=!0,window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",f,s)},p=y=>{if(y.pointerType!=="touch"){if(a){l=!0;return}d(y)}},g=y=>{if(!gk(y))return;l=!1;const w=t(i,y);typeof w=="function"&&(c=w,i.addEventListener("pointerleave",p,s))};i.addEventListener("pointerenter",g,s),i.addEventListener("pointerdown",h,s)}),o}const Nh=(e,t)=>t?e===t?!0:Nh(e,t.parentElement):!1,Ha=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,bk=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function xk(e){return bk.has(e.tagName)||e.isContentEditable===!0}const vk=new Set(["INPUT","SELECT","TEXTAREA"]);function wk(e){return vk.has(e.tagName)||e.isContentEditable===!0}const Vs=new WeakSet;function Wc(e){return t=>{t.key==="Enter"&&e(t)}}function ai(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const kk=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Wc(()=>{if(Vs.has(n))return;ai(n,"down");const s=Wc(()=>{ai(n,"up")}),o=()=>ai(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Bc(e){return Ha(e)&&!Oh()}const $c=new WeakSet;function Sk(e,t,n={}){const[r,s,o]=Ah(e,n),i=a=>{const l=a.currentTarget;if(!Bc(a)||$c.has(a))return;Vs.add(l),n.stopPropagation&&$c.add(a);const c=t(l,a),u=(h,p)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",f),Vs.has(l)&&Vs.delete(l),Bc(h)&&typeof c=="function"&&c(h,{success:p})},d=h=>{u(h,l===window||l===document||n.useGlobalTarget||Nh(l,h.target))},f=h=>{u(h,!1)};window.addEventListener("pointerup",d,s),window.addEventListener("pointercancel",f,s)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",i,s),mk(a)&&(a.addEventListener("focus",c=>kk(c,s)),!xk(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),o}function Ua(e){return Ff(e)&&"ownerSVGElement"in e}const _s=new WeakMap;let Ws;const Ih=(e,t,n)=>(r,s)=>s&&s[0]?s[0][e+"Size"]:Ua(r)&&"getBBox"in r?r.getBBox()[t]:r[n],Tk=Ih("inline","width","offsetWidth"),Ck=Ih("block","height","offsetHeight");function Ek({target:e,borderBoxSize:t}){_s.get(e)?.forEach(n=>{n(e,{get width(){return Tk(e,t)},get height(){return Ck(e,t)}})})}function Mk(e){e.forEach(Ek)}function Dk(){typeof ResizeObserver>"u"||(Ws=new ResizeObserver(Mk))}function Pk(e,t){Ws||Dk();const n=Ph(e);return n.forEach(r=>{let s=_s.get(r);s||(s=new Set,_s.set(r,s)),s.add(t),Ws?.observe(r)}),()=>{n.forEach(r=>{const s=_s.get(r);s?.delete(t),s?.size||Ws?.unobserve(r)})}}const Bs=new Set;let nr;function Rk(){nr=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Bs.forEach(t=>t(e))},window.addEventListener("resize",nr)}function Ok(e){return Bs.add(e),nr||Rk(),()=>{Bs.delete(e),!Bs.size&&typeof nr=="function"&&(window.removeEventListener("resize",nr),nr=void 0)}}function Yc(e,t){return typeof e=="function"?Ok(e):Pk(e,t)}function Ak(e){return Ua(e)&&e.tagName==="svg"}function Nk(...e){const t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],s=e[1+n],o=e[2+n],i=e[3+n],a=ih(s,o,i);return t?a(r):a}function Ik(e,t,n={}){const r=e.get();let s=null,o=r,i;const a=typeof r=="string"?r.replace(/[\d.-]/g,""):void 0,l=()=>{s&&(s.stop(),s=null),e.animation=void 0},c=()=>{const d=Hc(e.get()),f=Hc(o);if(d===f){l();return}const h=s?s.getGeneratorVelocity():e.getVelocity();l(),s=new qr({keyframes:[d,f],velocity:h,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:i})},u=()=>{c(),e.animation=s??void 0,e.events.animationStart?.notify(),s?.then(()=>{e.animation=void 0,e.events.animationComplete?.notify()})};if(e.attach((d,f)=>{o=d,i=h=>f(li(h,a)),ke.postRender(u)},l),Xe(t)){let d=n.skipInitialAnimation===!0;const f=t.on("change",p=>{d?(d=!1,e.jump(li(p,a),!1)):e.set(li(p,a))}),h=e.on("destroy",f);return()=>{f(),h()}}return l}function li(e,t){return t?e+t:e}function Hc(e){return typeof e=="number"?e:parseFloat(e)}const Fk=[...Eh,He,Ot],jk=e=>Fk.find(Ch(e)),Uc=()=>({translate:0,scale:1,origin:0,originPoint:0}),rr=()=>({x:Uc(),y:Uc()}),Gc=()=>({min:0,max:0}),ze=()=>({x:Gc(),y:Gc()}),Lk=new WeakMap;function bo(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Xr(e){return typeof e=="string"||Array.isArray(e)}const Ga=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ka=["initial",...Ga];function xo(e){return bo(e.animate)||Ka.some(t=>Xr(e[t]))}function Fh(e){return!!(xo(e)||e.variants)}function Vk(e,t,n){for(const r in t){const s=t[r],o=n[r];if(Xe(s))e.addValue(r,s);else if(Xe(o))e.addValue(r,Wn(s,{owner:e}));else if(o!==s)if(e.hasValue(r)){const i=e.getValue(r);i.liveStyle===!0?i.jump(s):i.hasAnimated||i.set(s)}else{const i=e.getStaticValue(r);e.addValue(r,Wn(i!==void 0?i:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const io={current:null},za={current:!1},_k=typeof window<"u";function jh(){if(za.current=!0,!!_k)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>io.current=e.matches;e.addEventListener("change",t),t()}else io.current=!1}const Kc=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let ao={};function Lh(e){ao=e}function Wk(){return ao}class Bk{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,skipAnimations:o,blockInitialAnimation:i,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=La,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=rt.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,ke.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=a;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=o,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=xo(n),this.isVariantNode=Fh(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const h in f){const p=f[h];c[h]!==void 0&&Xe(p)&&p.set(c[h])}}mount(t){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=t,Lk.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(za.current||jh(),this.shouldReduceMotion=io.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),rn(this.notifyUpdate),rn(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&yh.has(t)&&this.current instanceof HTMLElement){const{factory:i,keyframes:a,times:l,ease:c,duration:u}=n.accelerate,d=new ph({element:this.current,name:t,keyframes:a,times:l,ease:c,duration:mt(u)}),f=i(d);this.valueSubscriptions.set(t,()=>{f(),d.cancel()});return}const r=Tr.has(t);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&ke.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in ao){const n=ao[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ze()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<Kc.length;r++){const s=Kc[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const o="on"+s,i=t[o];i&&(this.propEventSubscriptions[s]=this.on(s,i))}this.prevMotionValues=Vk(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Wn(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(If(r)||jf(r))?r=parseFloat(r):!jk(r)&&Ot.test(n)&&(r=Dh(t,n)),this.setBaseTarget(t,Xe(r)?r.get():r)),Xe(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=Wa(this.props,n,this.presenceContext?.custom);o&&(r=o[t])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Xe(s)?s:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Da),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Ya.render(this.render)}}class Vh extends Bk{constructor(){super(...arguments),this.KeyframeResolver=hk}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Xe(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class vn{constructor(t){this.isMounted=!1,this.node=t}update(){}}function _h({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function $k({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Yk(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function ci(e){return e===void 0||e===1}function Ji({scale:e,scaleX:t,scaleY:n}){return!ci(e)||!ci(t)||!ci(n)}function Dn(e){return Ji(e)||Wh(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Wh(e){return zc(e.x)||zc(e.y)}function zc(e){return e&&e!=="0%"}function lo(e,t,n){const r=e-n,s=t*r;return n+s}function qc(e,t,n,r,s){return s!==void 0&&(e=lo(e,s,r)),lo(e,n,r)+t}function ea(e,t=0,n=1,r,s){e.min=qc(e.min,t,n,r,s),e.max=qc(e.max,t,n,r,s)}function Bh(e,{x:t,y:n}){ea(e.x,t.translate,t.scale,t.originPoint),ea(e.y,n.translate,n.scale,n.originPoint)}const Xc=.999999999999,Zc=1.0000000000001;function Hk(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let o,i;for(let a=0;a<s;a++){o=n[a],i=o.projectionDelta;const{visualElement:l}=o.options;l&&l.props.style&&l.props.style.display==="contents"||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(_t(e.x,-o.scroll.offset.x),_t(e.y,-o.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,Bh(e,i)),r&&Dn(o.latestValues)&&$s(e,o.latestValues,o.layout?.layoutBox))}t.x<Zc&&t.x>Xc&&(t.x=1),t.y<Zc&&t.y>Xc&&(t.y=1)}function _t(e,t){e.min+=t,e.max+=t}function Qc(e,t,n,r,s=.5){const o=Ne(e.min,e.max,s);ea(e,t,n,o,r)}function Jc(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function $s(e,t,n){const r=n??e;Qc(e.x,Jc(t.x,r.x),t.scaleX,t.scale,t.originX),Qc(e.y,Jc(t.y,r.y),t.scaleY,t.scale,t.originY)}function $h(e,t){return _h(Yk(e.getBoundingClientRect(),t))}function Uk(e,t,n){const r=$h(e,n),{scroll:s}=t;return s&&(_t(r.x,s.offset.x),_t(r.y,s.offset.y)),r}const Gk={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Kk=Sr.length;function zk(e,t,n){let r="",s=!0;for(let o=0;o<Kk;o++){const i=Sr[o],a=e[i];if(a===void 0)continue;let l=!0;if(typeof a=="number")l=a===(i.startsWith("scale")?1:0);else{const c=parseFloat(a);l=i.startsWith("scale")?c===1:c===0}if(!l||n){const c=Rh(a,$a[i]);if(!l){s=!1;const u=Gk[i]||i;r+=`${u}(${c}) `}n&&(t[i]=c)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function qa(e,t,n){const{style:r,vars:s,transformOrigin:o}=e;let i=!1,a=!1;for(const l in t){const c=t[l];if(Tr.has(l)){i=!0;continue}else if(Zf(l)){s[l]=c;continue}else{const u=Rh(c,$a[l]);l.startsWith("origin")?(a=!0,o[l]=u):r[l]=u}}if(t.transform||(i||n?r.transform=zk(t,e.transform,n):r.transform&&(r.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=o;r.transformOrigin=`${l} ${c} ${u}`}}function Yh(e,{style:t,vars:n},r,s){const o=e.style;let i;for(i in t)o[i]=t[i];s?.applyProjectionStyles(o,r);for(i in n)o.setProperty(i,n[i])}function eu(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Ar={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ee.test(e))e=parseFloat(e);else return e;const n=eu(e,t.target.x),r=eu(e,t.target.y);return`${n}% ${r}%`}},qk={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Ot.parse(e);if(s.length>5)return r;const o=Ot.createTransformer(e),i=typeof s[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;s[0+i]/=a,s[1+i]/=l;const c=Ne(a,l,.5);return typeof s[2+i]=="number"&&(s[2+i]/=c),typeof s[3+i]=="number"&&(s[3+i]/=c),o(s)}},ta={borderRadius:{...Ar,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ar,borderTopRightRadius:Ar,borderBottomLeftRadius:Ar,borderBottomRightRadius:Ar,boxShadow:qk};function Hh(e,{layout:t,layoutId:n}){return Tr.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!ta[e]||e==="opacity")}function Xa(e,t,n){const r=e.style,s=t?.style,o={};if(!r)return o;for(const i in r)(Xe(r[i])||s&&Xe(s[i])||Hh(i,e)||n?.getValue(i)?.liveStyle!==void 0)&&(o[i]=r[i]);return o}function Xk(e){return window.getComputedStyle(e)}class Zk extends Vh{constructor(){super(...arguments),this.type="html",this.renderInstance=Yh}readValueFromInstance(t,n){if(Tr.has(n))return this.projection?.isProjecting?$i(n):pw(t,n);{const r=Xk(t),s=(Zf(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return $h(t,n)}build(t,n,r){qa(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return Xa(t,n,r)}}const Qk={offset:"stroke-dashoffset",array:"stroke-dasharray"},Jk={offset:"strokeDashoffset",array:"strokeDasharray"};function eS(e,t,n=1,r=0,s=!0){e.pathLength=1;const o=s?Qk:Jk;e[o.offset]=`${-r}`,e[o.array]=`${t} ${n}`}const tS=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Uh(e,{attrX:t,attrY:n,attrScale:r,pathLength:s,pathSpacing:o=1,pathOffset:i=0,...a},l,c,u){if(qa(e,a,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??"fill-box",delete d.transformBox);for(const h of tS)d[h]!==void 0&&(f[h]=d[h],delete d[h]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),s!==void 0&&eS(d,s,o,i,!1)}const Gh=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Kh=e=>typeof e=="string"&&e.toLowerCase()==="svg";function nS(e,t,n,r){Yh(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(Gh.has(s)?s:Ba(s),t.attrs[s])}function zh(e,t,n){const r=Xa(e,t,n);for(const s in e)if(Xe(e[s])||Xe(t[s])){const o=Sr.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[o]=e[s]}return r}class rS extends Vh{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ze}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Tr.has(n)){const r=Mh(n);return r&&r.default||0}return n=Gh.has(n)?n:Ba(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return zh(t,n,r)}build(t,n,r){Uh(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,s){nS(t,n,r,s)}mount(t){this.isSVGTag=Kh(t.tagName),super.mount(t)}}const sS=Ka.length;function qh(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?qh(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<sS;n++){const r=Ka[n],s=e.props[r];(Xr(s)||s===!1)&&(t[r]=s)}return t}function Xh(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const oS=[...Ga].reverse(),iS=Ga.length;function aS(e){return t=>Promise.all(t.map(({animation:n,options:r})=>nk(e,n,r)))}function lS(e){let t=aS(e),n=tu(),r=!0,s=!1;const o=c=>(u,d)=>{const f=Ln(e,d,c==="exit"?e.presenceContext?.custom:void 0);if(f){const{transition:h,transitionEnd:p,...g}=f;u={...u,...g,...p}}return u};function i(c){t=c(e)}function a(c){const{props:u}=e,d=qh(e.parent)||{},f=[],h=new Set;let p={},g=1/0;for(let w=0;w<iS;w++){const x=oS[w],v=n[x],k=u[x]!==void 0?u[x]:d[x],S=Xr(k),C=x===c?v.isActive:null;C===!1&&(g=w);let M=k===d[x]&&k!==u[x]&&S;if(M&&(r||s)&&e.manuallyAnimateOnMount&&(M=!1),v.protectedKeys={...p},!v.isActive&&C===null||!k&&!v.prevProp||bo(k)||typeof k=="boolean")continue;if(x==="exit"&&v.isActive&&C!==!0){v.prevResolvedValues&&(p={...p,...v.prevResolvedValues});continue}const D=cS(v.prevProp,k);let F=D||x===c&&v.isActive&&!M&&S||w>g&&S,T=!1;const R=Array.isArray(k)?k:[k];let A=R.reduce(o(x),{});C===!1&&(A={});const{prevResolvedValues:E={}}=v,j={...E,...A},N=P=>{F=!0,h.has(P)&&(T=!0,h.delete(P)),v.needsAnimating[P]=!0;const I=e.getValue(P);I&&(I.liveStyle=!1)};for(const P in j){const I=A[P],B=E[P];if(p.hasOwnProperty(P))continue;let W=!1;zi(I)&&zi(B)?W=!Xh(I,B):W=I!==B,W?I!=null?N(P):h.add(P):I!==void 0&&h.has(P)?N(P):v.protectedKeys[P]=!0}v.prevProp=k,v.prevResolvedValues=A,v.isActive&&(p={...p,...A}),(r||s)&&e.blockInitialAnimation&&(F=!1);const V=M&&D;F&&(!V||T)&&f.push(...R.map(P=>{const I={type:x};if(typeof P=="string"&&(r||s)&&!V&&e.manuallyAnimateOnMount&&e.parent){const{parent:B}=e,W=Ln(B,P);if(B.enteringChildren&&W){const{delayChildren:Q}=W.transition||{};I.delay=bh(B.enteringChildren,e,Q)}}return{animation:P,options:I}}))}if(h.size){const w={};if(typeof u.initial!="boolean"){const x=Ln(e,Array.isArray(u.initial)?u.initial[0]:u.initial);x&&x.transition&&(w.transition=x.transition)}h.forEach(x=>{const v=e.getBaseTarget(x),k=e.getValue(x);k&&(k.liveStyle=!0),w[x]=v??null}),f.push({animation:w})}let y=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(y=!1),r=!1,s=!1,y?t(f):Promise.resolve()}function l(c,u){if(n[c].isActive===u)return Promise.resolve();e.variantChildren?.forEach(f=>f.animationState?.setActive(c,u)),n[c].isActive=u;const d=a(c);for(const f in n)n[f].protectedKeys={};return d}return{animateChanges:a,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=tu(),s=!0}}}function cS(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Xh(t,e):!1}function Mn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function tu(){return{animate:Mn(!0),whileInView:Mn(),whileHover:Mn(),whileTap:Mn(),whileDrag:Mn(),whileFocus:Mn(),exit:Mn()}}function na(e,t){e.min=t.min,e.max=t.max}function Et(e,t){na(e.x,t.x),na(e.y,t.y)}function nu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const Zh=1e-4,uS=1-Zh,dS=1+Zh,Qh=.01,fS=0-Qh,hS=0+Qh;function st(e){return e.max-e.min}function mS(e,t,n){return Math.abs(e-t)<=n}function ru(e,t,n,r=.5){e.origin=r,e.originPoint=Ne(t.min,t.max,e.origin),e.scale=st(n)/st(t),e.translate=Ne(n.min,n.max,e.origin)-e.originPoint,(e.scale>=uS&&e.scale<=dS||isNaN(e.scale))&&(e.scale=1),(e.translate>=fS&&e.translate<=hS||isNaN(e.translate))&&(e.translate=0)}function $r(e,t,n,r){ru(e.x,t.x,n.x,r?r.originX:void 0),ru(e.y,t.y,n.y,r?r.originY:void 0)}function su(e,t,n,r=0){const s=r?Ne(n.min,n.max,r):n.min;e.min=s+t.min,e.max=e.min+st(t)}function pS(e,t,n,r){su(e.x,t.x,n.x,r?.x),su(e.y,t.y,n.y,r?.y)}function ou(e,t,n,r=0){const s=r?Ne(n.min,n.max,r):n.min;e.min=t.min-s,e.max=e.min+st(t)}function co(e,t,n,r){ou(e.x,t.x,n.x,r?.x),ou(e.y,t.y,n.y,r?.y)}function iu(e,t,n,r,s){return e-=t,e=lo(e,1/n,r),s!==void 0&&(e=lo(e,1/s,r)),e}function gS(e,t=0,n=1,r=.5,s,o=e,i=e){if(Ut.test(t)&&(t=parseFloat(t),t=Ne(i.min,i.max,t/100)-i.min),typeof t!="number")return;let a=Ne(o.min,o.max,r);e===o&&(a-=t),e.min=iu(e.min,t,n,a,s),e.max=iu(e.max,t,n,a,s)}function au(e,t,[n,r,s],o,i){gS(e,t[n],t[r],t[s],t.scale,o,i)}const yS=["x","scaleX","originX"],bS=["y","scaleY","originY"];function lu(e,t,n,r){au(e.x,t,yS,n?n.x:void 0,r?r.x:void 0),au(e.y,t,bS,n?n.y:void 0,r?r.y:void 0)}function cu(e){return e.translate===0&&e.scale===1}function Jh(e){return cu(e.x)&&cu(e.y)}function uu(e,t){return e.min===t.min&&e.max===t.max}function xS(e,t){return uu(e.x,t.x)&&uu(e.y,t.y)}function du(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function em(e,t){return du(e.x,t.x)&&du(e.y,t.y)}function fu(e){return st(e.x)/st(e.y)}function hu(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function jt(e){return[e("x"),e("y")]}function vS(e,t,n){let r="";const s=e.x.translate/t.x,o=e.y.translate/t.y,i=n?.z||0;if((s||o||i)&&(r=`translate3d(${s}px, ${o}px, ${i}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,rotateX:d,rotateY:f,skewX:h,skewY:p}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),d&&(r+=`rotateX(${d}deg) `),f&&(r+=`rotateY(${f}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const tm=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],wS=tm.length,mu=e=>typeof e=="string"?parseFloat(e):e,pu=e=>typeof e=="number"||ee.test(e);function kS(e,t,n,r,s,o){s?(e.opacity=Ne(0,n.opacity??1,SS(r)),e.opacityExit=Ne(t.opacity??1,0,TS(r))):o&&(e.opacity=Ne(t.opacity??1,n.opacity??1,r));for(let i=0;i<wS;i++){const a=tm[i];let l=gu(t,a),c=gu(n,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||pu(l)===pu(c)?(e[a]=Math.max(Ne(mu(l),mu(c),r),0),(Ut.test(c)||Ut.test(l))&&(e[a]+="%")):e[a]=c}(t.rotate||n.rotate)&&(e.rotate=Ne(t.rotate||0,n.rotate||0,r))}function gu(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const SS=nm(0,.5,Uf),TS=nm(.5,.95,wt);function nm(e,t,n){return r=>r<e?0:r>t?1:n(Kr(e,t,r))}function CS(e,t,n){const r=Xe(e)?e:Wn(e);return r.start(_a("",r,t,n)),r.animation}function Zr(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const ES=(e,t)=>e.depth-t.depth;class MS{constructor(){this.children=[],this.isDirty=!1}add(t){Ea(this.children,t),this.isDirty=!0}remove(t){no(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(ES),this.isDirty=!1,this.children.forEach(t)}}function DS(e,t){const n=rt.now(),r=({timestamp:s})=>{const o=s-n;o>=t&&(rn(r),e(o-t))};return ke.setup(r,!0),()=>rn(r)}function Ys(e){return Xe(e)?e.get():e}class PS{constructor(){this.members=[]}add(t){Ea(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const s=r.instance;(!s||s.isConnected===!1)&&!r.snapshot&&(no(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(no(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){for(let n=this.members.indexOf(t)-1;n>=0;n--){const r=this.members[n];if(r.isPresent!==!1&&r.instance?.isConnected!==!1)return this.promote(r),!0}return!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:s}=r.options,{layoutDependency:o}=t.options;(s===void 0||s!==o)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const Hs={hasAnimatedSinceResize:!0,hasEverUpdated:!1},ui=["","X","Y","Z"],RS=1e3;let OS=0;function di(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function rm(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Sh(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ke,!(s||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&rm(r)}function sm({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(i={},a=t?.()){this.id=OS++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(IS),this.nodes.forEach(WS),this.nodes.forEach(BS),this.nodes.forEach(FS)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new MS)}addEventListener(i,a){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Da),this.eventHandlers.get(i).add(a)}notifyListeners(i,...a){const l=this.eventHandlers.get(i);l&&l.notify(...a)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=Ua(i)&&!Ak(i),this.instance=i;const{layoutId:a,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),e){let u,d=0;const f=()=>this.root.updateBlockedByResize=!1;ke.read(()=>{d=window.innerWidth}),e(i,()=>{const h=window.innerWidth;h!==d&&(d=h,this.root.updateBlockedByResize=!0,u&&u(),u=DS(f,250),Hs.hasAnimatedSinceResize&&(Hs.hasAnimatedSinceResize=!1,this.nodes.forEach(xu)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:f,layout:h})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||c.getDefaultTransition()||GS,{onLayoutAnimationStart:g,onLayoutAnimationComplete:y}=c.getProps(),w=!this.targetLayout||!em(this.targetLayout,h),x=!d&&f;if(this.options.layoutRoot||this.resumeFrom||x||d&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const v={...Va(p,"layout"),onPlay:g,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v),this.setAnimationOrigin(u,x)}else d||xu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=h})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),rn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach($S),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&rm(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const d=this.path[u];d.shouldResetTransform=!0,(typeof d.latestValues.x=="string"||typeof d.latestValues.y=="string")&&(d.isLayoutDirty=!0),d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(LS),this.nodes.forEach(yu);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(bu);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(VS),this.nodes.forEach(_S),this.nodes.forEach(AS),this.nodes.forEach(NS)):this.nodes.forEach(bu),this.clearAllSnapshots();const a=rt.now();Ze.delta=Gt(0,1e3/60,a-Ze.timestamp),Ze.timestamp=a,Ze.isProcessing=!0,ti.update.process(Ze),ti.preRender.process(Ze),ti.render.process(Ze),Ze.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ya.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(jS),this.sharedNodes.forEach(YS)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ke.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ke.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!st(this.snapshot.measuredBox.x)&&!st(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=ze()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(a=!1),a&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!s)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!Jh(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;i&&this.instance&&(a||Dn(this.latestValues)||u)&&(s(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return i&&(l=this.removeTransform(l)),KS(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:i}=this.options;if(!i)return ze();const a=i.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(zS))){const{scroll:c}=this.root;c&&(_t(a.x,c.offset.x),_t(a.y,c.offset.y))}return a}removeElementScroll(i){const a=ze();if(Et(a,i),this.scroll?.wasRoot)return a;for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:d}=c;c!==this.root&&u&&d.layoutScroll&&(u.wasRoot&&Et(a,i),_t(a.x,u.offset.x),_t(a.y,u.offset.y))}return a}applyTransform(i,a=!1,l){const c=l||ze();Et(c,i);for(let u=0;u<this.path.length;u++){const d=this.path[u];!a&&d.options.layoutScroll&&d.scroll&&d!==d.root&&(_t(c.x,-d.scroll.offset.x),_t(c.y,-d.scroll.offset.y)),Dn(d.latestValues)&&$s(c,d.latestValues,d.layout?.layoutBox)}return Dn(this.latestValues)&&$s(c,this.latestValues,this.layout?.layoutBox),c}removeTransform(i){const a=ze();Et(a,i);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!Dn(c.latestValues))continue;let u;c.instance&&(Ji(c.latestValues)&&c.updateSnapshot(),u=ze(),Et(u,c.measurePageBox())),lu(a,c.latestValues,c.snapshot?.layoutBox,u)}return Dn(this.latestValues)&&lu(a,this.latestValues),a}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ze.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(i||l&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:d}=this.options;if(!this.layout||!(u||d))return;this.resolvedRelativeTargetAt=Ze.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ze(),this.targetWithTransforms=ze()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),pS(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Et(this.target,this.layout.layoutBox),Bh(this.target,this.targetDelta)):Et(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Ji(this.parent.latestValues)||Wh(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(i,a,l){this.relativeParent=i,this.linkedParentVersion=i.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ze(),this.relativeTargetOrigin=ze(),co(this.relativeTargetOrigin,a,l,this.options.layoutAnchor||void 0),Et(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const i=this.getLead(),a=!!this.resumingFrom||this!==i;let l=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ze.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;Et(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,f=this.treeScale.y;Hk(this.layoutCorrected,this.treeScale,this.path,a),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=ze());const{target:h}=i;if(!h){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(nu(this.prevProjectionDelta.x,this.projectionDelta.x),nu(this.prevProjectionDelta.y,this.projectionDelta.y)),$r(this.projectionDelta,this.layoutCorrected,h,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==f||!hu(this.projectionDelta.x,this.prevProjectionDelta.x)||!hu(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",h))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){if(this.options.visualElement?.scheduleRender(),i){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=rr(),this.projectionDelta=rr(),this.projectionDeltaWithTransform=rr()}setAnimationOrigin(i,a=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},d=rr();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const f=ze(),h=l?l.source:void 0,p=this.layout?this.layout.source:void 0,g=h!==p,y=this.getStack(),w=!y||y.members.length<=1,x=!!(g&&!w&&this.options.crossfade===!0&&!this.path.some(US));this.animationProgress=0;let v;this.mixTargetDelta=k=>{const S=k/1e3;vu(d.x,i.x,S),vu(d.y,i.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(co(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),HS(this.relativeTarget,this.relativeTargetOrigin,f,S),v&&xS(this.relativeTarget,v)&&(this.isProjectionDirty=!1),v||(v=ze()),Et(v,this.relativeTarget)),g&&(this.animationValues=u,kS(u,c,this.latestValues,S,x,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(rn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ke.update(()=>{Hs.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Wn(0)),this.motionValue.jump(0,!1),this.currentAnimation=CS(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),i.onUpdate&&i.onUpdate(a)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(RS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=i;if(!(!a||!l||!c)){if(this!==i&&this.layout&&c&&om(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||ze();const d=st(this.layout.layoutBox.x);l.x.min=i.target.x.min,l.x.max=l.x.min+d;const f=st(this.layout.layoutBox.y);l.y.min=i.target.y.min,l.y.max=l.y.min+f}Et(a,l),$s(a,u),$r(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(i,a){this.sharedNodes.has(i)||this.sharedNodes.set(i,new PS),this.sharedNodes.get(i).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){const{layoutId:i}=this.options;return i?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:i}=this.options;return i?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),i&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let a=!1;const{latestValues:l}=i;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&di("z",i,c,this.animationValues);for(let u=0;u<ui.length;u++)di(`rotate${ui[u]}`,i,c,this.animationValues),di(`skew${ui[u]}`,i,c,this.animationValues);i.render();for(const u in c)i.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);i.scheduleRender()}applyProjectionStyles(i,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=Ys(a?.pointerEvents)||"",i.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=Ys(a?.pointerEvents)||""),this.hasProjected&&!Dn(this.latestValues)&&(i.transform=l?l({},""):"none",this.hasProjected=!1);return}i.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let d=vS(this.projectionDeltaWithTransform,this.treeScale,u);l&&(d=l(u,d)),i.transform=d;const{x:f,y:h}=this.projectionDelta;i.transformOrigin=`${f.origin*100}% ${h.origin*100}% 0`,c.animationValues?i.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:i.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const p in ta){if(u[p]===void 0)continue;const{correct:g,applyTo:y,isCSSVariable:w}=ta[p],x=d==="none"?u[p]:g(u[p],c);if(y){const v=y.length;for(let k=0;k<v;k++)i[y[k]]=x}else w?this.options.visualElement.renderState.vars[p]=x:i[p]=x}this.options.layoutId&&(i.pointerEvents=c===this?Ys(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>i.currentAnimation?.stop()),this.root.nodes.forEach(yu),this.root.sharedNodes.clear()}}}function AS(e){e.updateLayout()}function NS(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:s}=e.options,o=t.source!==e.layout.source;if(s==="size")jt(u=>{const d=o?t.measuredBox[u]:t.layoutBox[u],f=st(d);d.min=n[u].min,d.max=d.min+f});else if(s==="x"||s==="y"){const u=s==="x"?"y":"x";na(o?t.measuredBox[u]:t.layoutBox[u],n[u])}else om(s,t.layoutBox,n)&&jt(u=>{const d=o?t.measuredBox[u]:t.layoutBox[u],f=st(n[u]);d.max=d.min+f,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+f)});const i=rr();$r(i,n,t.layoutBox);const a=rr();o?$r(a,e.applyTransform(r,!0),t.measuredBox):$r(a,n,t.layoutBox);const l=!Jh(i);let c=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:d,layout:f}=u;if(d&&f){const h=e.options.layoutAnchor||void 0,p=ze();co(p,t.layoutBox,d.layoutBox,h);const g=ze();co(g,n,f.layoutBox,h),em(p,g)||(c=!0),u.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=p,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:i,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function IS(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function FS(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function jS(e){e.clearSnapshot()}function yu(e){e.clearMeasurements()}function LS(e){e.isLayoutDirty=!0,e.updateLayout()}function bu(e){e.isLayoutDirty=!1}function VS(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function _S(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function xu(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function WS(e){e.resolveTargetDelta()}function BS(e){e.calcProjection()}function $S(e){e.resetSkewAndRotation()}function YS(e){e.removeLeadSnapshot()}function vu(e,t,n){e.translate=Ne(t.translate,0,n),e.scale=Ne(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function wu(e,t,n,r){e.min=Ne(t.min,n.min,r),e.max=Ne(t.max,n.max,r)}function HS(e,t,n,r){wu(e.x,t.x,n.x,r),wu(e.y,t.y,n.y,r)}function US(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const GS={duration:.45,ease:[.4,0,.1,1]},ku=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Su=ku("applewebkit/")&&!ku("chrome/")?Math.round:wt;function Tu(e){e.min=Su(e.min),e.max=Su(e.max)}function KS(e){Tu(e.x),Tu(e.y)}function om(e,t,n){return e==="position"||e==="preserve-aspect"&&!mS(fu(t),fu(n),.2)}function zS(e){return e!==e.root&&e.scroll?.wasRoot}const qS=sm({attachResizeListener:(e,t)=>Zr(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),fi={current:void 0},im=sm({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!fi.current){const e=new qS({});e.mount(window),e.setOptions({layoutScroll:!0}),fi.current=e}return fi.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),vo=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function XS(e=!0){const t=m.useContext(Ca);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,o=m.useId();m.useEffect(()=>{if(e)return s(o)},[e]);const i=m.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,i]:[!0]}const am=m.createContext({strict:!1}),Cu={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Eu=!1;function ZS(){if(Eu)return;const e={};for(const t in Cu)e[t]={isEnabled:n=>Cu[t].some(r=>!!n[r])};Lh(e),Eu=!0}function lm(){return ZS(),Wk()}function QS(e){const t=lm();for(const n in e)t[n]={...t[n],...e[n]};Lh(t)}const JS=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function uo(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||JS.has(e)}let cm=e=>!uo(e);function eT(e){typeof e=="function"&&(cm=t=>t.startsWith("on")?!uo(t):e(t))}try{eT(require("@emotion/is-prop-valid").default)}catch{}function tT(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||Xe(e[s])||(cm(s)||n===!0&&uo(s)||!t&&!uo(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}const wo=m.createContext({});function nT(e,t){if(xo(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Xr(n)?n:void 0,animate:Xr(r)?r:void 0}}return e.inherit!==!1?t:{}}function rT(e){const{initial:t,animate:n}=nT(e,m.useContext(wo));return m.useMemo(()=>({initial:t,animate:n}),[Mu(t),Mu(n)])}function Mu(e){return Array.isArray(e)?e.join(" "):e}const Za=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function um(e,t,n){for(const r in t)!Xe(t[r])&&!Hh(r,n)&&(e[r]=t[r])}function sT({transformTemplate:e},t){return m.useMemo(()=>{const n=Za();return qa(n,t,e),Object.assign({},n.vars,n.style)},[t])}function oT(e,t){const n=e.style||{},r={};return um(r,n,e),Object.assign(r,sT(e,t)),r}function iT(e,t){const n={},r=oT(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const dm=()=>({...Za(),attrs:{}});function aT(e,t,n,r){const s=m.useMemo(()=>{const o=dm();return Uh(o,t,Kh(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};um(o,e.style,e),s.style={...o,...s.style}}return s}const lT=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Qa(e){return typeof e!="string"||e.includes("-")?!1:!!(lT.indexOf(e)>-1||/[A-Z]/u.test(e))}function cT(e,t,n,{latestValues:r},s,o=!1,i){const l=(i??Qa(e)?aT:iT)(t,r,s,e),c=tT(t,typeof e=="string",o),u=e!==m.Fragment?{...c,...l,ref:n}:{},{children:d}=t,f=m.useMemo(()=>Xe(d)?d.get():d,[d]);return m.createElement(e,{...u,children:f})}function uT({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:dT(n,r,s,e),renderState:t()}}function dT(e,t,n,r){const s={},o=r(e,{});for(const f in o)s[f]=Ys(o[f]);let{initial:i,animate:a}=e;const l=xo(e),c=Fh(e);t&&c&&!l&&e.inherit!==!1&&(i===void 0&&(i=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||i===!1;const d=u?a:i;if(d&&typeof d!="boolean"&&!bo(d)){const f=Array.isArray(d)?d:[d];for(let h=0;h<f.length;h++){const p=Wa(e,f[h]);if(p){const{transitionEnd:g,transition:y,...w}=p;for(const x in w){let v=w[x];if(Array.isArray(v)){const k=u?v.length-1:0;v=v[k]}v!==null&&(s[x]=v)}for(const x in g)s[x]=g[x]}}}return s}const fm=e=>(t,n)=>{const r=m.useContext(wo),s=m.useContext(Ca),o=()=>uT(e,t,r,s);return n?o():Ta(o)},fT=fm({scrapeMotionValuesFromProps:Xa,createRenderState:Za}),hT=fm({scrapeMotionValuesFromProps:zh,createRenderState:dm}),mT=Symbol.for("motionComponentSymbol");function pT(e,t,n){const r=m.useRef(n);m.useInsertionEffect(()=>{r.current=n});const s=m.useRef(null);return m.useCallback(o=>{o&&e.onMount?.(o);const i=r.current;if(typeof i=="function")if(o){const a=i(o);typeof a=="function"&&(s.current=a)}else s.current?(s.current(),s.current=null):i(o);else i&&(i.current=o);t&&(o?t.mount(o):t.unmount())},[t])}const hm=m.createContext({});function Jn(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function gT(e,t,n,r,s,o){const{visualElement:i}=m.useContext(wo),a=m.useContext(am),l=m.useContext(Ca),c=m.useContext(vo),u=c.reducedMotion,d=c.skipAnimations,f=m.useRef(null),h=m.useRef(!1);r=r||a.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:i,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:o}),h.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const p=f.current,g=m.useContext(hm);p&&!p.projection&&s&&(p.type==="html"||p.type==="svg")&&yT(f.current,n,s,g);const y=m.useRef(!1);m.useInsertionEffect(()=>{p&&y.current&&p.update(n,l)});const w=n[kh],x=m.useRef(!!w&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(w)&&window.MotionHasOptimisedAnimation?.(w));return Nf(()=>{h.current=!0,p&&(y.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),x.current&&p.animationState&&p.animationState.animateChanges())}),m.useEffect(()=>{p&&(!x.current&&p.animationState&&p.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(w)}),x.current=!1),p.enteringChildren=void 0)}),p}function yT(e,t,n,r){const{layoutId:s,layout:o,drag:i,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:mm(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!i||a&&Jn(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function mm(e){if(e)return e.options.allowProjection!==!1?e.projection:mm(e.parent)}function hi(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&QS(r);const o=n?n==="svg":Qa(e),i=o?hT:fT;function a(c,u){let d;const f={...m.useContext(vo),...c,layoutId:bT(c)},{isStatic:h}=f,p=rT(c),g=i(c,h);if(!h&&typeof window<"u"){xT();const y=vT(f);d=y.MeasureLayout,p.visualElement=gT(e,g,f,s,y.ProjectionNode,o)}return b.jsxs(wo.Provider,{value:p,children:[d&&p.visualElement?b.jsx(d,{visualElement:p.visualElement,...f}):null,cT(e,c,pT(g,p.visualElement,u),g,h,t,o)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=m.forwardRef(a);return l[mT]=e,l}function bT({layoutId:e}){const t=m.useContext(Af).id;return t&&e!==void 0?t+"-"+e:e}function xT(e,t){m.useContext(am).strict}function vT(e){const t=lm(),{drag:n,layout:r}=t;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n?.isEnabled(e)||r?.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function wT(e,t){if(typeof Proxy>"u")return hi;const n=new Map,r=(o,i)=>hi(o,i,e,t),s=(o,i)=>r(o,i);return new Proxy(s,{get:(o,i)=>i==="create"?r:(n.has(i)||n.set(i,hi(i,void 0,e,t)),n.get(i))})}const kT=(e,t)=>t.isSVG??Qa(e)?new rS(t):new Zk(t,{allowProjection:e!==m.Fragment});class ST extends vn{constructor(t){super(t),t.animationState||(t.animationState=lS(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();bo(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let TT=0;class CT extends vn{constructor(){super(...arguments),this.id=TT++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:o,custom:i}=this.node.getProps();if(typeof o=="string"){const a=Ln(this.node,o,i);if(a){const{transition:l,transitionEnd:c,...u}=a;for(const d in u)this.node.getValue(d)?.jump(u[d])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const ET={animation:{Feature:ST},exit:{Feature:CT}};function cs(e){return{point:{x:e.pageX,y:e.pageY}}}const MT=e=>t=>Ha(t)&&e(t,cs(t));function Yr(e,t,n,r){return Zr(e,t,MT(n),r)}const pm=({current:e})=>e?e.ownerDocument.defaultView:null,Du=(e,t)=>Math.abs(e-t);function DT(e,t){const n=Du(e.x,t.x),r=Du(e.y,t.y);return Math.sqrt(n**2+r**2)}const Pu=new Set(["auto","scroll"]);class gm{constructor(t,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:o=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=h=>{this.handleScroll(h.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=As(this.lastRawMoveEventInfo,this.transformPagePoint));const h=mi(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=DT(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!g)return;const{point:y}=h,{timestamp:w}=Ze;this.history.push({...y,timestamp:w});const{onStart:x,onMove:v}=this.handlers;p||(x&&x(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,h)},this.handlePointerMove=(h,p)=>{this.lastMoveEvent=h,this.lastRawMoveEventInfo=p,this.lastMoveEventInfo=As(p,this.transformPagePoint),ke.update(this.updatePoint,!0)},this.handlePointerUp=(h,p)=>{this.end();const{onEnd:g,onSessionEnd:y,resumeAnimation:w}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=mi(h.type==="pointercancel"?this.lastMoveEventInfo:As(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(h,x),y&&y(h,x)},!Ha(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=s||window;const l=cs(t),c=As(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=Ze;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(t,mi(c,this.history)),this.removeListeners=is(Yr(this.contextWindow,"pointermove",this.handlePointerMove),Yr(this.contextWindow,"pointerup",this.handlePointerUp),Yr(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(Pu.has(r.overflowX)||Pu.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},o={x:s.x-n.x,y:s.y-n.y};o.x===0&&o.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(t,s),ke.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),rn(this.updatePoint)}}function As(e,t){return t?{point:t(e.point)}:e}function Ru(e,t){return{x:e.x-t.x,y:e.y-t.y}}function mi({point:e},t){return{point:e,delta:Ru(e,ym(t)),offset:Ru(e,PT(t)),velocity:RT(t,.1)}}function PT(e){return e[0]}function ym(e){return e[e.length-1]}function RT(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=ym(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>mt(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&s.timestamp-r.timestamp>mt(t)*2&&(r=e[1]);const o=bt(s.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const i={x:(s.x-r.x)/o,y:(s.y-r.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function OT(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Ne(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Ne(n,e,r.max):Math.min(e,n)),e}function Ou(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function AT(e,{top:t,left:n,bottom:r,right:s}){return{x:Ou(e.x,n,s),y:Ou(e.y,t,r)}}function Au(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function NT(e,t){return{x:Au(e.x,t.x),y:Au(e.y,t.y)}}function IT(e,t){let n=.5;const r=st(e),s=st(t);return s>r?n=Kr(t.min,t.max-r,e.min):r>s&&(n=Kr(e.min,e.max-s,t.min)),Gt(0,1,n)}function FT(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ra=.35;function jT(e=ra){return e===!1?e=0:e===!0&&(e=ra),{x:Nu(e,"left","right"),y:Nu(e,"top","bottom")}}function Nu(e,t,n){return{min:Iu(e,t),max:Iu(e,n)}}function Iu(e,t){return typeof e=="number"?e:e[t]||0}const LT=new WeakMap;class VT{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ze(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const o=d=>{n&&this.snapToCursor(cs(d).point),this.stopAnimation()},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:g}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=pk(h),!this.openDragLock))return;this.latestPointerEvent=d,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),jt(w=>{let x=this.getAxisMotionValue(w).get()||0;if(Ut.test(x)){const{projection:v}=this.visualElement;if(v&&v.layout){const k=v.layout.layoutBox[w];k&&(x=st(k)*(parseFloat(x)/100))}}this.originPoint[w]=x}),g&&ke.update(()=>g(d,f),!1,!0),qi(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f;const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:g,onDrag:y}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:w}=f;if(p&&this.currentDirection===null){this.currentDirection=WT(w),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,w),this.updateAxis("y",f.point,w),this.visualElement.render(),y&&ke.update(()=>y(d,f),!1,!0)},l=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f,this.stop(d,f),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:d}=this.getProps();(d||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new gm(t,{onSessionStart:o,onStart:i,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:pm(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,s=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!s||!r)return;const{velocity:i}=s;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&ke.postRender(()=>a(r,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Ns(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=OT(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;t&&Jn(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=AT(r.layoutBox,t):this.constraints=!1,this.elastic=jT(n),s!==this.constraints&&!Jn(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&jt(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=FT(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Jn(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=Uk(r,s.root,this.visualElement.getTransformPagePoint());let i=NT(s.layout.layoutBox,o);if(n){const a=n($k(i));this.hasMutatedConstraints=!!a,a&&(i=_h(a))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=jt(u=>{if(!Ns(u,n,this.currentDirection))return;let d=l&&l[u]||{};(i===!0||i===u)&&(d={min:0,max:0});const f=s?200:1e6,h=s?40:1e7,p={type:"inertia",velocity:r?t[u]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(u,p)});return Promise.all(c).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return qi(this.visualElement,t),r.start(_a(t,r,0,n,this.visualElement,!1))}stopAnimation(){jt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){jt(n=>{const{drag:r}=this.getProps();if(!Ns(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(n);if(s&&s.layout){const{min:i,max:a}=s.layout.layoutBox[n],l=o.get()||0;o.set(t[n]-Ne(i,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Jn(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};jt(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const l=a.get();s[i]=IT({min:l,max:l},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),jt(i=>{if(!Ns(i,t,null))return;const a=this.getAxisMotionValue(i),{min:l,max:c}=this.constraints[i];a.set(Ne(l,c,s[i]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;LT.set(this.visualElement,this);const t=this.visualElement.current,n=Yr(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps(),f=c.target,h=f!==t&&wk(f);u&&d&&!h&&this.start(c)});let r;const s=()=>{const{dragConstraints:c}=this.getProps();Jn(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=_T(t,c.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,i=o.addEventListener("measure",s);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),ke.read(s);const a=Zr(window,"resize",()=>this.scalePositionWithinConstraints()),l=o.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(jt(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())}));return()=>{a(),n(),i(),l&&l(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:i=ra,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function Fu(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function _T(e,t,n){const r=Yc(e,Fu(n)),s=Yc(t,Fu(n));return()=>{r(),s()}}function Ns(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function WT(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class BT extends vn{constructor(t){super(t),this.removeGroupControls=wt,this.removeListeners=wt,this.controls=new VT(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||wt}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const pi=e=>(t,n)=>{e&&ke.update(()=>e(t,n),!1,!0)};class $T extends vn{constructor(){super(...arguments),this.removePointerDownListener=wt}onPointerDown(t){this.session=new gm(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:pm(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:pi(t),onStart:pi(n),onMove:pi(r),onEnd:(o,i)=>{delete this.session,s&&ke.postRender(()=>s(o,i))}}}mount(){this.removePointerDownListener=Yr(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let gi=!1;class YT extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),r&&r.register&&s&&r.register(o),gi&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Hs.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:o}=this.props,{projection:i}=r;return i&&(i.isPresent=o,t.layoutDependency!==n&&i.setOptions({...i.options,layoutDependency:n}),gi=!0,s||t.layoutDependency!==n||n===void 0||t.isPresent!==o?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||ke.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),Ya.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;gi=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function bm(e){const[t,n]=XS(),r=m.useContext(Af);return b.jsx(YT,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(hm),isPresent:t,safeToRemove:n})}const HT={pan:{Feature:$T},drag:{Feature:BT,ProjectionNode:im,MeasureLayout:bm}};function ju(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,o=r[s];o&&ke.postRender(()=>o(t,cs(t)))}class UT extends vn{mount(){const{current:t}=this.node;t&&(this.unmount=yk(t,(n,r)=>(ju(this.node,r,"Start"),s=>ju(this.node,s,"End"))))}unmount(){}}class GT extends vn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=is(Zr(this.node.current,"focus",()=>this.onFocus()),Zr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Lu(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),o=r[s];o&&ke.postRender(()=>o(t,cs(t)))}class KT extends vn{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=Sk(t,(s,o)=>(Lu(this.node,o,"Start"),(i,{success:a})=>Lu(this.node,i,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:r?.tap===!1})}unmount(){}}const sa=new WeakMap,yi=new WeakMap,zT=e=>{const t=sa.get(e.target);t&&t(e)},qT=e=>{e.forEach(zT)};function XT({root:e,...t}){const n=e||document;yi.has(n)||yi.set(n,{});const r=yi.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(qT,{root:e,...t})),r[s]}function ZT(e,t,n){const r=XT(t);return sa.set(e,n),r.observe(e),()=>{sa.delete(e),r.unobserve(e)}}const QT={some:0,all:1};class JT extends vn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:o}=t,i={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:QT[s]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,o&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:d}=this.node.getProps(),f=c?u:d;f&&f(l)};this.stopObserver=ZT(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(eC(t,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function eC({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const tC={inView:{Feature:JT},tap:{Feature:KT},focus:{Feature:GT},hover:{Feature:UT}},nC={layout:{ProjectionNode:im,MeasureLayout:bm}},rC={...ET,...tC,...HT,...nC},ht=wT(rC,kT);function Ja(e){const t=Ta(()=>Wn(e)),{isStatic:n}=m.useContext(vo);if(n){const[,r]=m.useState(e);m.useEffect(()=>t.on("change",r),[])}return t}function xm(e,t){const n=Ja(t()),r=()=>n.set(t());return r(),Nf(()=>{const s=()=>ke.preRender(r,!1,!0),o=e.map(i=>i.on("change",s));return()=>{o.forEach(i=>i()),rn(r)}}),n}function sC(e){Br.current=[],e();const t=xm(Br.current,e);return Br.current=void 0,t}function vm(e,t,n,r){if(typeof e=="function")return sC(e);const o=typeof t=="function"?t:Nk(t,n,r),i=Array.isArray(e)?Vu(e,o):Vu([e],([l])=>o(l)),a=Array.isArray(e)?void 0:e.accelerate;return a&&!a.isTransformed&&typeof t!="function"&&Array.isArray(n)&&r?.clamp!==!1&&(i.accelerate={...a,times:t,keyframes:n,isTransformed:!0}),i}function Vu(e,t){const n=Ta(()=>[]);return xm(e,()=>{n.length=0;const r=e.length;for(let s=0;s<r;s++)n[s]=e[s].get();return t(n)})}function oC(e,t={}){const{isStatic:n}=m.useContext(vo),r=()=>Xe(e)?e.get():e;if(n)return vm(r);const s=Ja(r());return m.useInsertionEffect(()=>Ik(s,e,t),[s,JSON.stringify(t)]),s}function iC(e,t={}){return oC(e,{type:"spring",...t})}function us(){!za.current&&jh();const[e]=m.useState(io.current);return e}function Qr({children:e,variant:t="primary",size:n="md",onClick:r,disabled:s=!1,className:o="",as:i="button",...a}){const l="inline-flex items-center justify-center font-medium transition-all duration-200 rounded-md focus:outline-none focus:ring-2 focus:ring-oai-blue/30 active:scale-[0.98] active:duration-100",c={primary:"bg-oai-black dark:bg-oai-white text-white dark:text-oai-black border border-transparent hover:bg-oai-gray-800 dark:hover:bg-oai-gray-200 active:bg-oai-gray-900 dark:active:bg-oai-gray-300 disabled:bg-oai-gray-300 dark:disabled:bg-oai-gray-700 disabled:text-oai-gray-500 dark:disabled:text-oai-gray-400 focus:ring-oai-brand/30 transition-colors duration-200",secondary:"bg-oai-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white border border-oai-gray-300 dark:border-oai-gray-700 hover:border-oai-brand hover:text-oai-brand active:bg-oai-gray-50 dark:active:bg-oai-gray-800 active:border-oai-brand-dark disabled:text-oai-gray-400 dark:disabled:text-oai-gray-500 disabled:border-oai-gray-200 dark:disabled:border-oai-gray-700 focus:ring-oai-brand/30 transition-colors duration-200",ghost:"bg-transparent text-oai-gray-600 dark:text-oai-gray-300 border border-transparent hover:text-oai-brand hover:bg-oai-brand-50/50 dark:hover:bg-oai-brand-950/30 active:bg-oai-brand-50 dark:active:bg-oai-brand-900/50 disabled:text-oai-gray-400 dark:disabled:text-oai-gray-500 focus:ring-oai-brand/30 transition-colors duration-200"},u={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},d=s?"cursor-not-allowed opacity-60":"cursor-pointer",f=`${l} ${c[t]} ${u[n]} ${d} ${o}`;return b.jsx(i,{className:f,onClick:r,disabled:s,...a,children:e})}function ko({children:e,title:t,subtitle:n,className:r="",bodyClassName:s=""}){return b.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 transition-colors duration-200 ${r}`,children:[(t||n)&&b.jsxs("div",{className:"px-5 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 transition-colors duration-200",children:[t&&b.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide transition-colors duration-200",children:t}),n&&b.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-1 transition-colors duration-200",children:n})]}),b.jsx("div",{className:`p-5 ${s}`,children:e})]})}function aC({theme:e,onToggle:t,className:n="",size:r=36,iconSize:s=20}){const o=us(),i=e==="dark",a=()=>{t?.(i?"light":"dark")},l={width:r,height:r,borderRadius:8,background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--oai-gray-600)",transition:"background-color 150ms ease, color 150ms ease"},c={backgroundColor:"var(--oai-gray-100)",color:"var(--oai-black)"},u=()=>b.jsxs("svg",{"aria-hidden":"true",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("circle",{cx:"12",cy:"12",r:"4"}),b.jsx("path",{d:"M12 2v2"}),b.jsx("path",{d:"M12 20v2"}),b.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),b.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),b.jsx("path",{d:"M2 12h2"}),b.jsx("path",{d:"M20 12h2"}),b.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),b.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]}),d=()=>b.jsx("svg",{"aria-hidden":"true",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})});return o?b.jsx("button",{type:"button","aria-label":i?"Switch to light mode":"Switch to dark mode",onClick:a,className:`oai-button-ghost oai-button-sm ${n}`,style:{...l,width:r,height:r,padding:0},title:i?"切换到亮色模式":"切换到暗色模式",onMouseEnter:f=>{f.currentTarget.style.backgroundColor=c.backgroundColor,f.currentTarget.style.color=c.color},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent",f.currentTarget.style.color="var(--oai-gray-600)"},children:i?b.jsx(d,{}):b.jsx(u,{})}):b.jsx(ht.button,{type:"button","aria-label":i?"Switch to light mode":"Switch to dark mode",onClick:a,className:`oai-button-ghost oai-button-sm ${n}`,style:{...l,width:r,height:r,padding:0},title:i?"切换到亮色模式":"切换到暗色模式",whileHover:{backgroundColor:"var(--oai-gray-100)",color:"var(--oai-black)"},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:25},children:b.jsx(ht.div,{initial:{scale:.8,opacity:0,rotate:-20},animate:{scale:1,opacity:1,rotate:0},exit:{scale:.8,opacity:0,rotate:20},transition:{type:"spring",stiffness:400,damping:25},children:i?b.jsx(d,{}):b.jsx(u,{})},i?"moon":"sun")})}function lC(){return b.jsxs("div",{className:"flex items-center gap-2.5",children:[b.jsx("div",{className:"w-8 h-8 rounded-lg bg-oai-black dark:bg-oai-white flex items-center justify-center",children:b.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-oai-white dark:text-oai-black",children:[b.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),b.jsx("path",{d:"M2 17l10 5 10-5M2 12l10 5 10-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),b.jsx("span",{className:"text-base font-semibold text-oai-black dark:text-oai-white leading-tight",children:"Token Tracker"})]})}function cC({children:e,header:t,footer:n,className:r="",hideHeader:s=!1,hideFooter:o=!1}){const{resolvedTheme:i,toggleTheme:a}=ga();return b.jsxs("div",{className:`min-h-screen bg-oai-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-sans flex flex-col transition-colors duration-200 ${r}`,children:[!s&&b.jsxs("header",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 flex items-center justify-between transition-colors duration-200",children:[b.jsx(lC,{}),b.jsx("div",{className:"flex-1 flex justify-center",children:t}),b.jsx(aC,{theme:i,onToggle:a})]}),b.jsx("main",{className:"flex-1 px-6 py-6",children:e}),!o&&n&&b.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 mt-auto transition-colors duration-200",children:n})]})}function uC({children:e,variant:t="info",size:n="md",className:r=""}){const s="inline-flex items-center font-medium",o={success:"bg-oai-brand-100 dark:bg-oai-brand-900/30 text-oai-brand-700 dark:text-oai-brand-400 rounded-full",warning:"bg-oai-amber-50 dark:bg-oai-amber-900/30 text-oai-amber-dark dark:text-oai-amber-400 rounded-full",error:"bg-red-50 dark:bg-red-900/30 text-red-600 dark:text-red-400 rounded-full",info:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 rounded-full",secondary:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-500 dark:text-oai-gray-300 rounded-md"},i={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm"},a=`${s} ${o[t]} ${i[n]} ${r}`.trim();return b.jsx("span",{className:a,children:e})}var dC={};function fC(e,t){return e==="."?{width:"0.34ch",justifyContent:"center",marginInline:"-0.04ch"}:e===","?{width:"0.08ch",justifyContent:"center",marginInline:"-0.30ch"}:{width:"0.72ch",justifyContent:"flex-start",paddingLeft:"0.04ch",height:t}}function hC({mv:e,digit:t,height:n}){const r=vm(e,s=>{const o=(s%10+10)%10,i=(10+t-o)%10;let a=i*n;return i>5&&(a-=10*n),a});return b.jsx(ht.span,{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",y:r},children:t})}function mC(e){const t=Math.round(e),n=1e-9*Math.max(1,Math.abs(e));return Math.abs(e-t)<n?t:e}function pC(e,t){const n=e/t;return Math.floor(mC(n))}function gC(e){const t=String(e??""),n=Array.from(t),r=n.indexOf(".");let s=n.filter((a,l)=>/\d/.test(a)&&(r===-1||l<r)).length,o=0,i=!1;return n.map(a=>{if(!/\d/.test(a))return a==="."&&(i=!0),a;if(!i){const l=10**Math.max(s-1,0);return s-=1,l}return o+=1,10**-o})}function yC({place:e,value:t,height:n,digitStyle:r,shouldReduceMotion:s}){if(typeof e!="number"){const l=fC(e,n);return b.jsx("span",{"data-counter-token":"static",className:"relative inline-flex items-center justify-center",style:{height:n,...l,...r},children:e})}const o=pC(t,e),i=Ja(0),a=iC(i,{stiffness:220,damping:26,mass:.8});return m.useEffect(()=>{i.set(o)},[i,o]),s?b.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex items-center justify-center overflow-hidden",style:{height:n,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...r},children:Math.abs(o)%10}):b.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex overflow-hidden",style:{height:n,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...r},children:Array.from({length:10},(l,c)=>b.jsx(hC,{mv:a,digit:c,height:n},c))})}function bC({value:e,displayValue:t,fontSize:n=72,padding:r=0,places:s,gap:o=6,borderRadius:i=4,horizontalPadding:a=0,textColor:l="inherit",fontWeight:c="inherit",containerStyle:u,counterStyle:d,digitStyle:f,gradientHeight:h=14,gradientFrom:p="rgba(255,255,255,0.95)",gradientTo:g="rgba(255,255,255,0)",topGradientStyle:y,bottomGradientStyle:w}){const x=String(t??e??""),v=m.useMemo(()=>Array.isArray(s)&&s.length?s:gC(x),[s,x]),k=typeof navigator<"u"&&/jsdom/i.test(navigator.userAgent||"")||typeof process<"u"&&dC?.VITEST==="true",S=us()||k,C=Number.isFinite(Number(e))?Math.abs(Number(e)):0,M=n+r;return S?b.jsx("span",{"data-counter-root":"true",style:{display:"inline-flex",alignItems:"center",color:l,fontSize:n,fontWeight:c,lineHeight:1,...u,...d},children:x}):b.jsxs("span",{"data-counter-root":"true",style:{position:"relative",display:"inline-block",...u},children:[b.jsx("span",{style:{fontSize:n,display:"flex",gap:o,overflow:"hidden",borderRadius:i,paddingLeft:a,paddingRight:a,lineHeight:1,color:l,fontWeight:c,...d},children:v.map((D,F)=>b.jsx(yC,{place:D,value:C,height:M,digitStyle:f,shouldReduceMotion:S},`${String(D)}-${F}`))}),b.jsxs("span",{style:{pointerEvents:"none",position:"absolute",inset:0,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[b.jsx("span",{style:y??{height:h,background:`linear-gradient(to bottom, ${p}, ${g})`}}),b.jsx("span",{style:w??{height:h,background:`linear-gradient(to top, ${p}, ${g})`}})]})]})}const wm=m.createContext(void 0);function Hn(e){const t=m.useContext(wm);if(e===!1&&t===void 0)throw new Error(Bn(27));return t}const xC={...os,...po},vC=m.forwardRef(function(t,n){const{render:r,className:s,forceRender:o=!1,...i}=t,{store:a}=Hn(),l=a.useState("open"),c=a.useState("nested"),u=a.useState("mounted"),d=a.useState("transitionStatus"),f=m.useMemo(()=>({open:l,transitionStatus:d}),[l,d]);return sn("div",t,{state:f,ref:[a.context.backdropRef,n],stateAttributesMapping:xC,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:o||!c})}),_u=m.forwardRef(function(t,n){const{render:r,className:s,disabled:o=!1,nativeButton:i=!0,...a}=t,{store:l}=Hn(),c=l.useState("open");function u(p){c&&l.setOpen(!1,Ve(Wg,p.nativeEvent))}const{getButtonProps:d,buttonRef:f}=fd({disabled:o,native:i}),h=m.useMemo(()=>({disabled:o}),[o]);return sn("button",t,{state:h,ref:[n,f],props:[{onClick:u},a,d]})});let wC=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),kC=(function(e){return e[e.open=Pt.open]="open",e[e.closed=Pt.closed]="closed",e[e.startingStyle=Pt.startingStyle]="startingStyle",e[e.endingStyle=Pt.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const km=m.createContext(void 0);function Sm(){const e=m.useContext(km);if(e===void 0)throw new Error(Bn(26));return e}const SC={...os,...po,nestedDialogOpen(e){return e?{[kC.nestedDialogOpen]:""}:null}},TC=m.forwardRef(function(t,n){const{className:r,finalFocus:s,initialFocus:o,render:i,...a}=t,{store:l}=Hn(),c=l.useState("descriptionElementId"),u=l.useState("disablePointerDismissal"),d=l.useState("floatingRootContext"),f=l.useState("popupProps"),h=l.useState("modal"),p=l.useState("mounted"),g=l.useState("nested"),y=l.useState("nestedOpenDialogCount"),w=l.useState("open"),x=l.useState("openMethod"),v=l.useState("titleElementId"),k=l.useState("transitionStatus"),S=l.useState("role");Sm(),ka({open:w,ref:l.context.popupRef,onComplete(){w&&l.context.onOpenChangeComplete?.(!0)}});function C(R){return R==="touch"?l.context.popupRef.current:!0}const M=o===void 0?C:o,D=y>0,F=m.useMemo(()=>({open:w,nested:g,transitionStatus:k,nestedDialogOpen:D}),[w,g,k,D]),T=sn("div",t,{state:F,props:[f,{"aria-labelledby":v??void 0,"aria-describedby":c??void 0,role:S,tabIndex:-1,hidden:!p,onKeyDown(R){Rf.has(R.key)&&R.stopPropagation()},style:{[wC.nestedDialogs]:y}},a],ref:[n,l.context.popupRef,l.useStateSetter("popupElement")],stateAttributesMapping:SC});return b.jsx(ef,{context:d,openInteractionType:x,disabled:!p,closeOnFocusOut:!u,initialFocus:M,returnFocus:s,modal:h!==!1,restoreFocus:"popup",children:T})}),CC=m.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t,{store:o}=Hn(),i=o.useState("mounted"),a=o.useState("modal"),l=o.useState("open");return i||r?b.jsx(km.Provider,{value:r,children:b.jsxs(Jd,{ref:n,...s,children:[i&&a===!0&&b.jsx(Sf,{ref:o.context.internalBackdropRef,inert:vf(!l)}),t.children]})}):null});function EC(e){const{store:t,parentContext:n,actionsRef:r}=e,s=t.useState("open"),o=t.useState("disablePointerDismissal"),i=t.useState("modal"),a=t.useState("popupElement"),{openMethod:l,triggerProps:c,reset:u}=xf(s);ff(t);const{forceUnmount:d}=hf(s,t,()=>{u()}),f=he(T=>{const R=Ve(T);return R.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},R}),h=m.useCallback(()=>{t.setOpen(!1,f(hd))},[t,f]);m.useImperativeHandle(r,()=>({unmount:d,close:h}),[d,h]);const p=gf({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[g,y]=m.useState(0),w=g===0,x=bf(p),v=uf(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(T){if("button"in T&&T.button!==0||"touches"in T&&T.touches.length!==1)return!1;const R=dt(T);if(w&&!o){const A=R;return i&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===A||t.context.backdropRef.current===A||we(A,a)&&!A?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:w});wf(s&&i===!0,a);const{getReferenceProps:k,getFloatingProps:S,getTriggerProps:C}=Sa([x,v]);t.useContextCallback("onNestedDialogOpen",T=>{y(T+1)}),t.useContextCallback("onNestedDialogClose",()=>{y(0)}),m.useEffect(()=>(n?.onNestedDialogOpen&&s&&n.onNestedDialogOpen(g),n?.onNestedDialogClose&&!s&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&s&&n.onNestedDialogClose()}),[s,n,g]);const M=m.useMemo(()=>k(c),[k,c]),D=m.useMemo(()=>C(c),[C,c]),F=m.useMemo(()=>S(),[S]);t.useSyncedValues({openMethod:l,activeTriggerProps:M,inactiveTriggerProps:D,popupProps:F,floatingRootContext:p,nestedOpenDialogCount:g})}const MC={...pf,modal:pe(e=>e.modal),nested:pe(e=>e.nested),nestedOpenDialogCount:pe(e=>e.nestedOpenDialogCount),disablePointerDismissal:pe(e=>e.disablePointerDismissal),openMethod:pe(e=>e.openMethod),descriptionElementId:pe(e=>e.descriptionElementId),titleElementId:pe(e=>e.titleElementId),viewportElement:pe(e=>e.viewportElement),role:pe(e=>e.role)};class DC extends ya{constructor(t){super(PC(t),{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),triggerElements:new go,onOpenChange:void 0,onOpenChangeComplete:void 0},MC)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const r={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",r);const s={open:t},o=n.trigger?.id??null;(o||t)&&(s.activeTriggerId=o,s.activeTriggerElement=n.trigger??null),this.update(s)}}function PC(e={}){return{...mf(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function RC(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:o,disablePointerDismissal:i=!1,modal:a=!0,actionsRef:l,handle:c,triggerId:u,defaultTriggerId:d=null}=e,f=Hn(!0),h=!!f,p=bn(()=>c?.store??new DC({open:n??r,activeTriggerId:u!==void 0?u:d,modal:a,disablePointerDismissal:i,nested:h})).current;p.useControlledProp("open",n,r),p.useControlledProp("activeTriggerId",u,d),p.useSyncedValues({disablePointerDismissal:i,nested:h,modal:a}),p.useContextCallback("onOpenChange",s),p.useContextCallback("onOpenChangeComplete",o);const g=p.useState("payload");EC({store:p,actionsRef:l,parentContext:f?.store.context});const y=m.useMemo(()=>({store:p}),[p]);return b.jsx(wm.Provider,{value:y,children:typeof t=="function"?t({payload:g}):t})}let Wu=(function(e){return e[e.open=Pt.open]="open",e[e.closed=Pt.closed]="closed",e[e.startingStyle=Pt.startingStyle]="startingStyle",e[e.endingStyle=Pt.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const OC={...os,...po,nested(e){return e?{[Wu.nested]:""}:null},nestedDialogOpen(e){return e?{[Wu.nestedDialogOpen]:""}:null}},AC=m.forwardRef(function(t,n){const{className:r,render:s,children:o,...i}=t,a=Sm(),{store:l}=Hn(),c=l.useState("open"),u=l.useState("nested"),d=l.useState("transitionStatus"),f=l.useState("nestedOpenDialogCount"),h=l.useState("mounted"),p=f>0,g=m.useMemo(()=>({open:c,nested:u,transitionStatus:d,nestedDialogOpen:p}),[c,u,d,p]);return sn("div",t,{enabled:a||h,state:g,ref:[n,l.useStateSetter("viewportElement")],stateAttributesMapping:OC,props:[{role:"presentation",hidden:!h,children:o},i]})}),NC=m.forwardRef(function(t,n){const{render:r,className:s,id:o,...i}=t,{store:a}=Hn(),l=md(o);return a.useSyncedValueWithCleanup("titleElementId",l),sn("h2",t,{ref:n,props:[{id:l},i]})});function Bu(e){if(!Number.isFinite(e))return _("shared.placeholder.short");const t=ca(e.toFixed(6));return t==="-"?_("shared.placeholder.short"):t}function IC(e){return!Number.isFinite(e)||e<=0?null:e<.01?"<$0.01":ca(e.toFixed(2))}const FC=q.memo(function({isOpen:t,onClose:n,fleetData:r=[]}){if(!t)return null;const s=_("shared.unit.percent"),o=(Array.isArray(r)?r:[]).map(l=>{const c=xt(l?.usd),u=Number.isFinite(c)?c:0,d=Array.isArray(l?.models)?l.models:[];return{label:l?.label?String(l.label):"",usdValue:u,usdLabel:Bu(u),models:d.map(f=>{const h=xt(f?.share),p=Number.isFinite(h)?`${h}${s}`:_("shared.placeholder.short"),g=xt(f?.cost),y=IC(g);return{id:f?.id?String(f.id):"",name:f?.name?String(f.name):"",shareLabel:p,costLabel:y}})}}),i=o.reduce((l,c)=>l+c.usdValue,0),a=Bu(i);return b.jsx(RC,{open:t,onOpenChange:l=>{l||n?.()},children:b.jsxs(CC,{children:[b.jsx(vC,{className:"cost-modal-backdrop","data-cost-analysis-backdrop":"true"}),b.jsx(AC,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:b.jsxs(TC,{className:"cost-modal-popup w-full max-w-xl rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-oai-lg overflow-hidden",children:[b.jsxs("div",{className:"px-6 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 flex items-center justify-between",children:[b.jsx(NC,{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:_("dashboard.cost_breakdown.title")}),b.jsx(_u,{type:"button",className:"w-7 h-7 flex items-center justify-center rounded-md text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-gray-600 dark:hover:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors","aria-label":_("dashboard.cost_breakdown.close"),children:"✕"})]}),b.jsxs("div",{className:"px-6 py-6 text-center border-b border-oai-gray-100 dark:border-oai-gray-800",children:[b.jsx("div",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400 uppercase tracking-wide mb-2",children:_("dashboard.cost_breakdown.total_label")}),b.jsx("div",{className:"text-3xl font-bold text-oai-brand tabular-nums tracking-tight",children:a})]}),b.jsx("div",{className:"px-6 py-4 max-h-[45vh] overflow-y-auto oai-scrollbar",children:b.jsx("div",{className:"space-y-5",children:o.map((l,c)=>b.jsxs("div",{children:[b.jsxs("div",{className:"flex justify-between items-baseline pb-2 mb-2 border-b border-oai-gray-100 dark:border-oai-gray-800",children:[b.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white",children:l.label}),b.jsx("span",{className:"text-sm font-semibold text-oai-brand tabular-nums",children:l.usdLabel})]}),b.jsx("div",{className:"space-y-1",children:l.models.map((u,d)=>{const f=u?.id||`${u.name}-${d}`;return b.jsxs("div",{className:"flex justify-between items-center py-1 text-xs",children:[b.jsxs("span",{className:"text-oai-gray-600 dark:text-oai-gray-300",children:[u.name,b.jsx("span",{className:"ml-1.5 text-oai-gray-400 dark:text-oai-gray-500 tabular-nums",children:u.shareLabel})]}),u.costLabel?b.jsx("span",{className:"text-oai-gray-600 dark:text-oai-gray-300 font-medium tabular-nums",children:u.costLabel}):null]},f)})})]},`${l.label}-${c}`))})}),b.jsxs("div",{className:"px-6 py-4 border-t border-oai-gray-200 dark:border-oai-gray-800 flex justify-between items-center",children:[b.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500",children:_("dashboard.cost_breakdown.footer")}),b.jsx(_u,{render:b.jsx(Qr,{variant:"secondary",size:"sm"}),children:_("dashboard.cost_breakdown.close")})]})]})})]})})});function jC({projectEntries:e=[],projectLimit:t=3,onProjectLimitChange:n,copy:r,hasDetailsActual:s,dailyEmptyPrefix:o,installSyncCmd:i,dailyEmptySuffix:a,detailsColumns:l,ariaSortFor:c,toggleSort:u,sortIconFor:d,pagedDetails:f,dailyBreakdownRows:h=[],dailyBreakdownColumns:p=[],dailyBreakdownAriaSortFor:g,dailyBreakdownSortIconFor:y,dailyBreakdownDateKey:w="day",detailsDateKey:x,renderDetailDate:v,renderDailyBreakdownDate:k,renderDetailCell:S,DETAILS_PAGED_PERIODS:C,period:M,detailsPageCount:D,detailsPage:F,setDetailsPage:T}){const[R,A]=m.useState("daily");return b.jsxs(ko,{children:[b.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[b.jsxs("div",{role:"tablist","aria-label":"Data view",className:"flex gap-1",children:[b.jsx("button",{role:"tab","aria-selected":R==="daily",type:"button",onClick:()=>A("daily"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${R==="daily"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:r("dashboard.daily.title")}),b.jsx("button",{role:"tab","aria-selected":R==="projects",type:"button",onClick:()=>A("projects"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${R==="projects"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:r("dashboard.projects.title")})]}),R==="projects"&&b.jsxs("select",{"aria-label":"Number of projects to display",value:t,onChange:E=>n?.(Number(E.target.value)),className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded px-2 py-1 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 focus:border-oai-brand dark:focus:border-oai-brand focus:outline-none transition-colors",children:[b.jsx("option",{value:3,children:r("dashboard.projects.limit_top_3")}),b.jsx("option",{value:6,children:r("dashboard.projects.limit_top_6")}),b.jsx("option",{value:10,children:r("dashboard.projects.limit_top_10")})]})]}),R==="projects"&&b.jsx("div",{className:"space-y-1",children:e.slice(0,t).map(E=>b.jsxs("a",{href:E?.project_ref||"#",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-2 rounded-lg hover:oai-bg-elevated transition-colors",children:[b.jsx("div",{className:"w-8 h-8 rounded-md oai-bg-elevated flex items-center justify-center oai-text-caption font-medium text-oai-gray-500 dark:text-oai-gray-300",children:(E?.project_key?.[0]||"?").toUpperCase()}),b.jsx("div",{className:"min-w-0 flex-1",children:b.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white truncate",children:E?.project_key||E?.project_ref?.split("/")?.pop()||"—"})}),b.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:E?.billable_total_tokens?.toLocaleString?.()||E?.total_tokens?.toLocaleString?.()||"—"})]},E?.project_key||E?.project_ref))}),R==="daily"&&b.jsxs("div",{children:[h?.length===0?b.jsxs("div",{className:"oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 mb-4",children:[o,b.jsx("code",{className:"mx-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 oai-bg-elevated px-1.5 py-0.5 font-mono oai-text-caption",children:i}),a]}):b.jsx("div",{className:"overflow-auto max-h-[320px] -mx-4 oai-scrollbar",children:b.jsxs("table",{className:"w-full border-collapse",children:[b.jsx("thead",{className:"sticky top-0 z-10",children:b.jsx("tr",{className:"border-b border-oai-gray-200 dark:border-oai-gray-700",children:p.map(E=>b.jsx("th",{"aria-sort":g?.(E.key)||"none",className:"text-left p-0 bg-white dark:bg-oai-gray-900",children:b.jsx("button",{type:"button",onClick:()=>u(E.key),className:"flex w-full items-center justify-start px-4 py-2 text-left oai-text-caption font-semibold text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white transition-colors",children:b.jsxs("span",{className:"inline-flex items-center gap-1",children:[b.jsx("span",{children:E.label}),b.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-400",children:y?.(E.key)||""})]})})},E.key))})}),b.jsx("tbody",{children:h.map(E=>b.jsxs("tr",{className:`border-b border-oai-gray-100 dark:border-oai-gray-800 last:border-b-0 hover:bg-oai-gray-50/50 dark:hover:bg-oai-gray-800/50 transition-colors ${E.missing?"text-oai-gray-400 dark:text-oai-gray-400":E.future?"text-oai-gray-300 dark:text-oai-gray-600":"text-oai-black dark:text-oai-white"}`,children:[b.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300",children:k?k(E):v(E)}),b.jsx("td",{className:"px-4 py-2 oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:S(E,"total_tokens")}),b.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(E,"input_tokens")}),b.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(E,"output_tokens")}),b.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(E,"cached_input_tokens")}),b.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(E,"reasoning_output_tokens")}),b.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(E,"conversation_count")})]},String(E?.[w]||E?.day||E?.hour||E?.month||"")))})]})}),R!=="daily"&&C.has(M)&&D>1?b.jsxs("div",{className:"mt-3 flex items-center justify-between oai-text-caption",children:[b.jsx("button",{type:"button",onClick:()=>T(E=>Math.max(0,E-1)),disabled:F===0,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r("details.pagination.prev")}),b.jsxs("span",{className:"oai-text-muted",children:[F+1," / ",D]}),b.jsx("button",{type:"button",onClick:()=>T(E=>Math.min(D-1,E+1)),disabled:F+1>=D,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r("details.pagination.next")})]}):null]})]})}function sr({children:e,delay:t=0,duration:n=.4,y:r=20,className:s="",once:o=!0}){return us()?b.jsx("div",{className:s,children:e}):b.jsx(ht.div,{initial:{opacity:0,y:r},animate:{opacity:1,y:0},transition:{duration:n,delay:t,ease:[.25,.1,.25,1]},className:s,children:e})}function Us(e){return typeof e!="string"?"":e.trim()}function $u(e){const t=Us(e);return t?t.split(/[_\-\s]+/).filter(Boolean).map(n=>n.slice(0,1).toUpperCase()+n.slice(1).toLowerCase()).join(" "):""}function LC(e){if(!Array.isArray(e))return[];const t=new Map;for(const n of e){if(!n||typeof n!="object")continue;const r=Us(n.tool),s=Us(n.planType)||Us(n.plan_type);if(!r||!s)continue;const o=$u(r)||r,i=$u(s)||s;t.set(`${r.toLowerCase()}::${s.toLowerCase()}`,{tool:o,plan:i})}return Array.from(t.values())}function VC({period:e="month",rankLabel:t,streakDays:n,subscriptions:r=[],periodConversations:s,rolling:o,topModels:i=[],className:a=""}){const l=_("shared.placeholder.short"),c=_("shared.unit.percent"),u=t??_("identity_card.rank_placeholder"),d=Number.isFinite(Number(n))?Number(n):0,f=d?_("identity_card.streak_value",{days:d}):_("identity_card.rank_placeholder"),h=LC(r),p={thousandSuffix:_("shared.unit.thousand_abbrev"),millionSuffix:_("shared.unit.million_abbrev"),billionSuffix:_("shared.unit.billion_abbrev")},g=x=>{if(x==null)return l;const v=pd(x,p);return v==="-"?l:v},y=(()=>{switch(e){case"day":return"today convs";case"week":return"week convs";case"month":return"month convs";case"total":return"all convs";default:return"convs"}})(),w=i.slice(0,3);return b.jsx(sr,{delay:.1,children:b.jsxs(ko,{className:`h-full ${a}`,children:[b.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[b.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[b.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:g(o?.last_7d?.totals?.billable_total_tokens)}),b.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:"7d"})]}),b.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[b.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:g(o?.last_30d?.totals?.billable_total_tokens)}),b.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:"30d"})]}),b.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[b.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:g(o?.last_30d?.avg_per_active_day)}),b.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:"avg"})]}),b.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[b.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:g(s)}),b.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:y})]})]}),w.length>0&&b.jsx("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800",children:w.map((x,v)=>{const k=x?.name?String(x.name):l,S=x?.percent?String(x.percent):"",C=v===w.length-1,M=v+1;return b.jsxs("div",{className:`flex items-center py-2 ${C?"":"border-b border-oai-gray-50 dark:border-oai-gray-800"}`,children:[b.jsx("span",{className:"w-5 h-5 flex items-center justify-center rounded-full bg-oai-gray-100 dark:bg-oai-gray-800 text-[10px] font-semibold text-oai-gray-500 dark:text-oai-gray-300 flex-shrink-0",children:M}),b.jsx("span",{className:"flex-1 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate px-2.5",title:k,children:k}),b.jsxs("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums flex-shrink-0",children:[S,c]})]},x.id||k)})}),h.length>0&&b.jsx("div",{className:"mt-3 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex flex-wrap gap-1.5",children:h.map((x,v)=>b.jsxs(uC,{variant:"secondary",size:"sm",children:[x.tool," ",x.plan]},`${x.tool}:${x.plan}:${v}`))}),b.jsxs("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex items-center justify-between text-xs text-oai-gray-400 dark:text-oai-gray-400",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("span",{children:_("identity_card.rank_label")}),b.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:u})]}),b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx("span",{children:_("identity_card.streak_label")}),b.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:f})]})]})]})})}const Tm=m.createContext(void 0);function ds(e){const t=m.useContext(Tm);if(t===void 0&&!e)throw new Error(Bn(47));return t}function _C(){return{...mf(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const WC={...pf,disabled:pe(e=>e.disabled),instantType:pe(e=>e.instantType),openMethod:pe(e=>e.openMethod),openChangeReason:pe(e=>e.openChangeReason),modal:pe(e=>e.modal),stickIfOpen:pe(e=>e.stickIfOpen),titleElementId:pe(e=>e.titleElementId),descriptionElementId:pe(e=>e.descriptionElementId),openOnHover:pe(e=>e.openOnHover),closeDelay:pe(e=>e.closeDelay),hasViewport:pe(e=>e.hasViewport)};class el extends ya{constructor(t){const n={..._C(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new gn,triggerElements:new go},WC)}setOpen=(t,n)=>{const r=n.reason===ut,s=n.reason===mn&&n.event.detail===0,o=!t&&(n.reason===dd||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const i={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",i);const l=()=>{const c={open:t,openChangeReason:n.reason},u=n.trigger?.id??null;(u||t)&&(c.activeTriggerId=u,c.activeTriggerElement=n.trigger??null),this.update(c)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(py,()=>{this.set("stickIfOpen",!1)}),pn.flushSync(l)):l(),s||o?this.set("instantType",s?"click":"dismiss"):n.reason===Hr?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const r=bn(()=>new el(n)).current,s=t??r;return da(r.disposeEffect),s}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function Yu({props:e}){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:o,modal:i=!1,handle:a,triggerId:l,defaultTriggerId:c=null}=e,u=el.useStore(a?.store,{open:n??r,modal:i,activeTriggerId:l!==void 0?l:c});u.useControlledProp("open",n,r),u.useControlledProp("activeTriggerId",l,c);const d=u.useState("open"),f=u.useState("positionerElement"),h=u.useState("payload"),p=u.useState("openChangeReason");u.useContextCallback("onOpenChange",s),u.useContextCallback("onOpenChangeComplete",o);const{openMethod:g,triggerProps:y,reset:w}=xf(d);ff(u);const{forceUnmount:x}=hf(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),w()});wf(d&&i===!0&&p!==ut&&g!=="touch",f),m.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);const v=m.useCallback(N=>{const V=Ve(N);return V.preventUnmountOnClose=()=>{u.set("preventUnmountingOnClose",!0)},V},[u]),k=m.useCallback(()=>{u.setOpen(!1,v(hd))},[u,v]);m.useImperativeHandle(e.actionsRef,()=>({unmount:x,close:k}),[x,k]);const S=gf({popupStore:u,onOpenChange:u.setOpen}),C=uf(S,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),M=bf(S),{getReferenceProps:D,getFloatingProps:F,getTriggerProps:T}=Sa([C,M]),R=m.useMemo(()=>D(y),[D,y]),A=m.useMemo(()=>T(y),[T,y]),E=m.useMemo(()=>F(),[F]);u.useSyncedValues({modal:i,openMethod:g,activeTriggerProps:R,inactiveTriggerProps:A,popupProps:E,floatingRootContext:S,nested:Yn()!=null});const j=m.useMemo(()=>({store:u}),[u]);return b.jsx(Tm.Provider,{value:j,children:typeof t=="function"?t({payload:h}):t})}function BC(e){return ds(!0)?b.jsx(Yu,{props:e}):b.jsx(x0,{children:b.jsx(Yu,{props:e})})}const $C=300,YC=m.forwardRef(function(t,n){const{render:r,className:s,disabled:o=!1,nativeButton:i=!0,handle:a,payload:l,openOnHover:c=!1,delay:u=$C,closeDelay:d=0,id:f,...h}=t,p=ds(!0),g=a?.store??p?.store;if(!g)throw new Error(Bn(74));const y=md(f),w=g.useState("isTriggerActive",y),x=g.useState("floatingRootContext"),v=g.useState("isOpenedByTrigger",y),k=m.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=Tx(y,k,g,{payload:l,disabled:o,openOnHover:c,closeDelay:d}),M=g.useState("openChangeReason"),D=g.useState("stickIfOpen"),F=g.useState("openMethod"),T=Ix(x,{enabled:x!=null&&c&&(F!=="touch"||M!==mn),mouseOnly:!0,move:!1,handleClose:Lx(),restMs:u,delay:{close:d},triggerElementRef:k,isActiveTrigger:w}),R=P0(x,{enabled:x!=null,stickIfOpen:D}),A=Sa([R]),E=g.useState("triggerProps",C),j=m.useMemo(()=>({disabled:o,open:v}),[o,v]),{getButtonProps:N,buttonRef:V}=fd({disabled:o,native:i}),U=m.useMemo(()=>({open(Q){return Q&&M===mn?Ux.open(Q):Hx.open(Q)}}),[M]),P=sn("button",t,{state:j,ref:[V,n,S,k],props:[A.getReferenceProps(),T,E,{[yd]:"",id:y},h,N],stateAttributesMapping:U}),I=m.useRef(null),B=he(Q=>{pn.flushSync(()=>{g.setOpen(!1,Ve(Hr,Q.nativeEvent,Q.currentTarget))}),nb(I.current)?.focus()}),W=he(Q=>{const Y=g.select("positionerElement");if(Y&&ir(Q,Y))g.context.beforeContentFocusGuardRef.current?.focus();else{pn.flushSync(()=>{g.setOpen(!1,Ve(Hr,Q.nativeEvent,Q.currentTarget))});let $=tb(g.context.triggerFocusTargetRef.current||k.current);for(;$!==null&&we(Y,$);){const z=$;if($=pa($),$===z)break}$?.focus()}});return w?b.jsxs(m.Fragment,{children:[b.jsx(mr,{ref:I,onFocus:B}),b.jsx(m.Fragment,{children:P},y),b.jsx(mr,{ref:g.context.triggerFocusTargetRef,onFocus:W})]}):b.jsx(m.Fragment,{children:P},y)}),Cm=m.createContext(void 0);function HC(){const e=m.useContext(Cm);if(e===void 0)throw new Error(Bn(45));return e}const UC=m.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t,{store:o}=ds();return o.useState("mounted")||r?b.jsx(Cm.Provider,{value:r,children:b.jsx(Jd,{ref:n,...s,renderGuards:!1})}):null}),Em=m.createContext(void 0);function GC(){const e=m.useContext(Em);if(!e)throw new Error(Bn(46));return e}const KC=m.forwardRef(function(t,n){const{render:r,className:s,anchor:o,positionMethod:i="absolute",side:a="bottom",align:l="center",sideOffset:c=0,alignOffset:u=0,collisionBoundary:d="clipping-ancestors",collisionPadding:f=5,arrowPadding:h=5,sticky:p=!1,disableAnchorTracking:g=!1,collisionAvoidance:y=yy,...w}=t,{store:x}=ds(),v=HC(),k=y0(),S=x.useState("floatingRootContext"),C=x.useState("mounted"),M=x.useState("open"),D=x.useState("openChangeReason"),F=x.useState("activeTriggerElement"),T=x.useState("modal"),R=x.useState("positionerElement"),A=x.useState("instantType"),E=x.useState("transitionStatus"),j=x.useState("hasViewport"),N=m.useRef(null),V=df(R,!1,!1),U=sv({anchor:o,floatingRootContext:S,positionMethod:i,mounted:C,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:h,collisionBoundary:d,collisionPadding:f,sticky:p,disableAnchorTracking:g,keepMounted:v,nodeId:k,collisionAvoidance:y,adaptiveOrigin:j?rv:void 0}),P=m.useMemo(()=>{const $={};return M||($.pointerEvents="none"),{role:"presentation",hidden:!C,style:{...U.positionerStyles,...$}}},[M,C,U.positionerStyles]),I=m.useMemo(()=>({props:P,...U}),[P,U]),B=S?.select("domReferenceElement");Te(()=>{const $=B,z=N.current;if($&&(N.current=$),z&&$&&$!==z){x.set("instantType",void 0);const Z=new AbortController;return V(()=>{x.set("instantType","trigger-change")},Z.signal),()=>{Z.abort()}}},[B,V,x]);const W=m.useMemo(()=>({open:M,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:A}),[M,I.side,I.align,I.anchorHidden,A]),Q=m.useCallback($=>{x.set("positionerElement",$)},[x]),Y=sn("div",t,{state:W,props:[I.props,Of(E),w],ref:[n,Q],stateAttributesMapping:os});return b.jsxs(Em.Provider,{value:I,children:[C&&T===!0&&D!==ut&&b.jsx(Sf,{ref:x.context.internalBackdropRef,inert:vf(!M),cutout:F}),b.jsx(b0,{id:k,children:Y})]})}),zC={...os,...po},qC=m.forwardRef(function(t,n){const{className:r,render:s,initialFocus:o,finalFocus:i,...a}=t,{store:l}=ds(),c=GC(),u=iv()!=null,d=l.useState("open"),f=l.useState("openMethod"),h=l.useState("instantType"),p=l.useState("transitionStatus"),g=l.useState("popupProps"),y=l.useState("titleElementId"),w=l.useState("descriptionElementId"),x=l.useState("modal"),v=l.useState("mounted"),k=l.useState("openChangeReason"),S=l.useState("activeTriggerElement"),C=l.useState("floatingRootContext");ka({open:d,ref:l.context.popupRef,onComplete(){d&&l.context.onOpenChangeComplete?.(!0)}});const M=l.useState("disabled"),D=l.useState("openOnHover"),F=l.useState("closeDelay");Ox(C,{enabled:D&&!M,closeDelay:F});function T(N){return N==="touch"?l.context.popupRef.current:!0}const R=o===void 0?T:o,A=m.useMemo(()=>({open:d,side:c.side,align:c.align,instant:h,transitionStatus:p}),[d,c.side,c.align,h,p]),E=m.useCallback(N=>{l.set("popupElement",N)},[l]),j=sn("div",t,{state:A,ref:[n,l.context.popupRef,E],props:[g,{"aria-labelledby":y,"aria-describedby":w,onKeyDown(N){u&&Rf.has(N.key)&&N.stopPropagation()}},Of(p),a],stateAttributesMapping:zC});return b.jsx(ef,{context:C,openInteractionType:f,modal:x==="trap-focus",disabled:!v||k===ut,initialFocus:R,returnFocus:i,restoreFocus:"popup",previousFocusableElement:nt(S)?S:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:j})});function XC(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const ZC={},Lr={};function An(e,t){try{const r=(ZC[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return r in Lr?Lr[r]:Hu(r,r.split(":"))}catch{if(e in Lr)return Lr[e];const n=e?.match(QC);return n?Hu(e,n.slice(1)):NaN}}const QC=/([+-]\d\d):?(\d\d)?/;function Hu(e,t){const n=+(t[0]||0),r=+(t[1]||0),s=+(t[2]||0)/60;return Lr[e]=n*60+r>0?n*60+r+s:n*60-r-s}class $t extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(An(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),Mm(this),oa(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new $t(...n,t):new $t(Date.now(),t)}withTimeZone(t){return new $t(+this,t)}getTimezoneOffset(){const t=-An(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),oa(this),+this}[Symbol.for("constructDateFrom")](t){return new $t(+new Date(t),this.timeZone)}}const Uu=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Uu.test(e))return;const t=e.replace(Uu,"$1UTC");$t.prototype[t]&&(e.startsWith("get")?$t.prototype[e]=function(){return this.internal[t]()}:($t.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),JC(this),+this},$t.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),oa(this),+this}))});function oa(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-An(e.timeZone,e)*60))}function JC(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),Mm(e)}function Mm(e){const t=An(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+e).getTimezoneOffset(),o=-new Date(+r).getTimezoneOffset(),i=s-o,a=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();i&&a&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+i);const l=s-n;l&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+l);const c=new Date(+e);c.setUTCSeconds(0);const u=s>0?c.getSeconds():(c.getSeconds()-60)%60,d=Math.round(-(An(e.timeZone,e)*60))%60;(d||u)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+d),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+d+u));const f=An(e.timeZone,e),h=f>0?Math.floor(f):Math.ceil(f),g=-new Date(+e).getTimezoneOffset()-h,y=h!==n,w=g-l;if(y&&w){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+w);const x=An(e.timeZone,e),v=x>0?Math.floor(x):Math.ceil(x),k=h-v;k&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+k),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+k))}}class Qe extends $t{static tz(t,...n){return n.length?new Qe(...n,t):new Qe(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),s=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,s]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${t} GMT${n}${r}${s} (${XC(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),s=String(Math.abs(t)%60).padStart(2,"0");return[n,r,s]}withTimeZone(t){return new Qe(+this,t)}[Symbol.for("constructDateFrom")](t){return new Qe(+new Date(t),this.timeZone)}}const Dm=6048e5,eE=864e5,Gu=Symbol.for("constructDateFrom");function Ue(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Gu in e?e[Gu](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ce(e,t){return Ue(t||e,e)}function Pm(e,t,n){const r=Ce(e,n?.in);return isNaN(t)?Ue(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function Rm(e,t,n){const r=Ce(e,n?.in);if(isNaN(t))return Ue(e,NaN);if(!t)return r;const s=r.getDate(),o=Ue(e,r.getTime());o.setMonth(r.getMonth()+t+1,0);const i=o.getDate();return s>=i?o:(r.setFullYear(o.getFullYear(),o.getMonth(),s),r)}let tE={};function fs(){return tE}function gr(e,t){const n=fs(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Ce(e,t?.in),o=s.getDay(),i=(o<r?7:0)+o-r;return s.setDate(s.getDate()-i),s.setHours(0,0,0,0),s}function Jr(e,t){return gr(e,{...t,weekStartsOn:1})}function Om(e,t){const n=Ce(e,t?.in),r=n.getFullYear(),s=Ue(n,0);s.setFullYear(r+1,0,4),s.setHours(0,0,0,0);const o=Jr(s),i=Ue(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const a=Jr(i);return n.getTime()>=o.getTime()?r+1:n.getTime()>=a.getTime()?r:r-1}function Ku(e){const t=Ce(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Cr(e,...t){const n=Ue.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function es(e,t){const n=Ce(e,t?.in);return n.setHours(0,0,0,0),n}function tl(e,t,n){const[r,s]=Cr(n?.in,e,t),o=es(r),i=es(s),a=+o-Ku(o),l=+i-Ku(i);return Math.round((a-l)/eE)}function nE(e,t){const n=Om(e,t),r=Ue(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Jr(r)}function rE(e,t,n){return Pm(e,t*7,n)}function sE(e,t,n){return Rm(e,t*12,n)}function oE(e,t){let n,r=t?.in;return e.forEach(s=>{!r&&typeof s=="object"&&(r=Ue.bind(null,s));const o=Ce(s,r);(!n||n<o||isNaN(+o))&&(n=o)}),Ue(r,n||NaN)}function iE(e,t){let n,r=t?.in;return e.forEach(s=>{!r&&typeof s=="object"&&(r=Ue.bind(null,s));const o=Ce(s,r);(!n||n>o||isNaN(+o))&&(n=o)}),Ue(r,n||NaN)}function aE(e,t,n){const[r,s]=Cr(n?.in,e,t);return+es(r)==+es(s)}function Am(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function lE(e){return!(!Am(e)&&typeof e!="number"||isNaN(+Ce(e)))}function Nm(e,t,n){const[r,s]=Cr(n?.in,e,t),o=r.getFullYear()-s.getFullYear(),i=r.getMonth()-s.getMonth();return o*12+i}function cE(e,t){const n=Ce(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Im(e,t){const[n,r]=Cr(e,t.start,t.end);return{start:n,end:r}}function uE(e,t){const{start:n,end:r}=Im(t?.in,e);let s=+n>+r;const o=s?+n:+r,i=s?r:n;i.setHours(0,0,0,0),i.setDate(1);let a=1;const l=[];for(;+i<=o;)l.push(Ue(n,i)),i.setMonth(i.getMonth()+a);return s?l.reverse():l}function dE(e,t){const n=Ce(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function fE(e,t){const n=Ce(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function Fm(e,t){const n=Ce(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function hE(e,t){const{start:n,end:r}=Im(t?.in,e);let s=+n>+r;const o=s?+n:+r,i=s?r:n;i.setHours(0,0,0,0),i.setMonth(0,1);let a=1;const l=[];for(;+i<=o;)l.push(Ue(n,i)),i.setFullYear(i.getFullYear()+a);return s?l.reverse():l}function jm(e,t){const n=fs(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Ce(e,t?.in),o=s.getDay(),i=(o<r?-7:0)+6-(o-r);return s.setDate(s.getDate()+i),s.setHours(23,59,59,999),s}function mE(e,t){return jm(e,{...t,weekStartsOn:1})}const pE={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},gE=(e,t,n)=>{let r;const s=pE[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function bi(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const yE={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},bE={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},xE={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},vE={date:bi({formats:yE,defaultWidth:"full"}),time:bi({formats:bE,defaultWidth:"full"}),dateTime:bi({formats:xE,defaultWidth:"full"})},wE={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},kE=(e,t,n,r)=>wE[e];function Nr(e){return(t,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,a=n?.width?String(n.width):i;s=e.formattingValues[a]||e.formattingValues[i]}else{const i=e.defaultWidth,a=n?.width?String(n.width):e.defaultWidth;s=e.values[a]||e.values[i]}const o=e.argumentCallback?e.argumentCallback(t):t;return s[o]}}const SE={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},TE={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},CE={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},EE={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ME={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},DE={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},PE=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},RE={ordinalNumber:PE,era:Nr({values:SE,defaultWidth:"wide"}),quarter:Nr({values:TE,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Nr({values:CE,defaultWidth:"wide"}),day:Nr({values:EE,defaultWidth:"wide"}),dayPeriod:Nr({values:ME,defaultWidth:"wide",formattingValues:DE,defaultFormattingWidth:"wide"})};function Ir(e){return(t,n={})=>{const r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(s);if(!o)return null;const i=o[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?AE(a,d=>d.test(i)):OE(a,d=>d.test(i));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(i.length);return{value:c,rest:u}}}function OE(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function AE(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function NE(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],o=t.match(e.parsePattern);if(!o)return null;let i=e.valueCallback?e.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;const a=t.slice(s.length);return{value:i,rest:a}}}const IE=/^(\d+)(th|st|nd|rd)?/i,FE=/\d+/i,jE={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},LE={any:[/^b/i,/^(a|c)/i]},VE={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},_E={any:[/1/i,/2/i,/3/i,/4/i]},WE={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},BE={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},$E={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},YE={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},HE={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},UE={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},GE={ordinalNumber:NE({matchPattern:IE,parsePattern:FE,valueCallback:e=>parseInt(e,10)}),era:Ir({matchPatterns:jE,defaultMatchWidth:"wide",parsePatterns:LE,defaultParseWidth:"any"}),quarter:Ir({matchPatterns:VE,defaultMatchWidth:"wide",parsePatterns:_E,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ir({matchPatterns:WE,defaultMatchWidth:"wide",parsePatterns:BE,defaultParseWidth:"any"}),day:Ir({matchPatterns:$E,defaultMatchWidth:"wide",parsePatterns:YE,defaultParseWidth:"any"}),dayPeriod:Ir({matchPatterns:HE,defaultMatchWidth:"any",parsePatterns:UE,defaultParseWidth:"any"})},er={code:"en-US",formatDistance:gE,formatLong:vE,formatRelative:kE,localize:RE,match:GE,options:{weekStartsOn:0,firstWeekContainsDate:1}};function KE(e,t){const n=Ce(e,t?.in);return tl(n,Fm(n))+1}function nl(e,t){const n=Ce(e,t?.in),r=+Jr(n)-+nE(n);return Math.round(r/Dm)+1}function Lm(e,t){const n=Ce(e,t?.in),r=n.getFullYear(),s=fs(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=Ue(t?.in||e,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const a=gr(i,t),l=Ue(t?.in||e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=gr(l,t);return+n>=+a?r+1:+n>=+c?r:r-1}function zE(e,t){const n=fs(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=Lm(e,t),o=Ue(t?.in||e,0);return o.setFullYear(s,0,r),o.setHours(0,0,0,0),gr(o,t)}function rl(e,t){const n=Ce(e,t?.in),r=+gr(n,t)-+zE(n,t);return Math.round(r/Dm)+1}function ve(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const un={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return ve(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ve(n+1,2)},d(e,t){return ve(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(e,t){return ve(e.getHours()%12||12,t.length)},H(e,t){return ve(e.getHours(),t.length)},m(e,t){return ve(e.getMinutes(),t.length)},s(e,t){return ve(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return ve(s,t.length)}},Xn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},zu={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return un.y(e,t)},Y:function(e,t,n,r){const s=Lm(e,r),o=s>0?s:1-s;if(t==="YY"){const i=o%100;return ve(i,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):ve(o,t.length)},R:function(e,t){const n=Om(e);return ve(n,t.length)},u:function(e,t){const n=e.getFullYear();return ve(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return ve(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return ve(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return un.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return ve(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const s=rl(e,r);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):ve(s,t.length)},I:function(e,t,n){const r=nl(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):ve(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):un.d(e,t)},D:function(e,t,n){const r=KE(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):ve(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const s=e.getDay(),o=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return ve(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const s=e.getDay(),o=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return ve(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),s=r===0?7:r;switch(t){case"i":return String(s);case"ii":return ve(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let s;switch(r===12?s=Xn.noon:r===0?s=Xn.midnight:s=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let s;switch(r>=17?s=Xn.evening:r>=12?s=Xn.afternoon:r>=4?s=Xn.morning:s=Xn.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return un.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):un.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):ve(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):ve(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):un.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):un.s(e,t)},S:function(e,t){return un.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return Xu(r);case"XXXX":case"XX":return Pn(r);default:return Pn(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return Xu(r);case"xxxx":case"xx":return Pn(r);default:return Pn(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+qu(r,":");default:return"GMT"+Pn(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+qu(r,":");default:return"GMT"+Pn(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return ve(r,t.length)},T:function(e,t,n){return ve(+e,t.length)}};function qu(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),o=r%60;return o===0?n+String(s):n+String(s)+t+ve(o,2)}function Xu(e,t){return e%60===0?(e>0?"-":"+")+ve(Math.abs(e)/60,2):Pn(e,t)}function Pn(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=ve(Math.trunc(r/60),2),o=ve(r%60,2);return n+s+t+o}const Zu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Vm=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},qE=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return Zu(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Zu(r,t)).replace("{{time}}",Vm(s,t))},XE={p:Vm,P:qE},ZE=/^D+$/,QE=/^Y+$/,JE=["D","DD","YY","YYYY"];function eM(e){return ZE.test(e)}function tM(e){return QE.test(e)}function nM(e,t,n){const r=rM(e,t,n);if(console.warn(r),JE.includes(e))throw new RangeError(r)}function rM(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const sM=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,oM=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,iM=/^'([^]*?)'?$/,aM=/''/g,lM=/[a-zA-Z]/;function Yt(e,t,n){const r=fs(),s=n?.locale??r.locale??er,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=Ce(e,n?.in);if(!lE(a))throw new RangeError("Invalid time value");let l=t.match(oM).map(u=>{const d=u[0];if(d==="p"||d==="P"){const f=XE[d];return f(u,s.formatLong)}return u}).join("").match(sM).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:cM(u)};if(zu[d])return{isToken:!0,value:u};if(d.match(lM))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});s.localize.preprocessor&&(l=s.localize.preprocessor(a,l));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:s};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!n?.useAdditionalWeekYearTokens&&tM(d)||!n?.useAdditionalDayOfYearTokens&&eM(d))&&nM(d,t,String(e));const f=zu[d[0]];return f(a,d,s.localize,c)}).join("")}function cM(e){const t=e.match(iM);return t?t[1].replace(aM,"'"):e}function uM(e,t){const n=Ce(e,t?.in),r=n.getFullYear(),s=n.getMonth(),o=Ue(n,0);return o.setFullYear(r,s+1,0),o.setHours(0,0,0,0),o.getDate()}function dM(e,t){return Ce(e,t?.in).getMonth()}function fM(e,t){return Ce(e,t?.in).getFullYear()}function hM(e,t){return+Ce(e)>+Ce(t)}function mM(e,t){return+Ce(e)<+Ce(t)}function pM(e,t,n){const[r,s]=Cr(n?.in,e,t);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function gM(e,t,n){const[r,s]=Cr(n?.in,e,t);return r.getFullYear()===s.getFullYear()}function yM(e,t,n){const r=Ce(e,n?.in),s=r.getFullYear(),o=r.getDate(),i=Ue(e,0);i.setFullYear(s,t,15),i.setHours(0,0,0,0);const a=uM(i);return r.setMonth(t,Math.min(o,a)),r}function bM(e,t,n){const r=Ce(e,n?.in);return isNaN(+r)?Ue(e,NaN):(r.setFullYear(t),r)}const Qu=5,xM=4;function vM(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,s=t.addDays(e,-r+1),o=t.addDays(s,Qu*7-1);return t.getMonth(e)===t.getMonth(o)?Qu:xM}function _m(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function wM(e,t){const n=_m(e,t),r=vM(e,t);return t.addDays(n,r*7-1)}const Wm={...er,labels:{labelDayButton:(e,t,n,r)=>{let s;r&&typeof r.format=="function"?s=r.format.bind(r):s=(i,a)=>Yt(i,a,{locale:er,...n});let o=s(e,"PPPP");return t.today&&(o=`Today, ${o}`),t.selected&&(o=`${o}, selected`),o},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(s,o)=>Yt(s,o,{locale:er,...t}),r(e,"LLLL yyyy")},labelGridcell:(e,t,n,r)=>{let s;r&&typeof r.format=="function"?s=r.format.bind(r):s=(i,a)=>Yt(i,a,{locale:er,...n});let o=s(e,"PPPP");return t?.today&&(o=`Today, ${o}`),o},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(s,o)=>Yt(s,o,{locale:er,...t}),r(e,"cccc")}}};class pt{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Qe.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,o)=>this.overrides?.newDate?this.overrides.newDate(r,s,o):this.options.timeZone?new Qe(r,s,o,this.options.timeZone):new Date(r,s,o),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):Pm(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):Rm(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):rE(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):sE(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):tl(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):Nm(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):uE(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):hE(r),o=new Set(s.map(a=>this.getYear(a)));if(o.size===s.length)return s;const i=[];return o.forEach(a=>{i.push(new Date(a,0,1))}),i},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):wM(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):mE(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):cE(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):jm(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):fE(r),this.format=(r,s,o)=>{const i=this.overrides?.format?this.overrides.format(r,s,this.options):Yt(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(i):i},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):nl(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):dM(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):fM(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):rl(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):hM(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):mM(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):Am(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):aE(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):pM(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):gM(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):oE(r),this.min=r=>this.overrides?.min?this.overrides.min(r):iE(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):yM(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):bM(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):_m(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):es(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Jr(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):dE(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):gr(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):Fm(r),this.options={locale:Wm,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&pt.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:s}=this.options,o=n?.code;if(o&&pt.yearFirstLocales.has(o))try{return new Intl.DateTimeFormat(o,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(t)}catch{}const i=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,i)}}pt.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Kt=new pt;class Bm{constructor(t,n,r=Kt){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r,this.isoDate=r.format(t,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class kM{constructor(t,n){this.date=t,this.weeks=n}}class SM{constructor(t,n){this.days=n,this.weekNumber=t}}function TM(e){return q.createElement("button",{...e})}function CM(e){return q.createElement("span",{...e})}function EM(e){const{size:t=24,orientation:n="left",className:r}=e;return q.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&q.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&q.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&q.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&q.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function MM(e){const{day:t,modifiers:n,...r}=e;return q.createElement("td",{...r})}function DM(e){const{day:t,modifiers:n,...r}=e,s=q.useRef(null);return q.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),q.createElement("button",{ref:s,...r})}var ae;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(ae||(ae={}));var Le;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(Le||(Le={}));var Rt;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(Rt||(Rt={}));var ct;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(ct||(ct={}));function PM(e){const{options:t,className:n,components:r,classNames:s,...o}=e,i=[s[ae.Dropdown],n].join(" "),a=t?.find(({value:l})=>l===o.value);return q.createElement("span",{"data-disabled":o.disabled,className:s[ae.DropdownRoot]},q.createElement(r.Select,{className:i,...o},t?.map(({value:l,label:c,disabled:u})=>q.createElement(r.Option,{key:l,value:l,disabled:u},c))),q.createElement("span",{className:s[ae.CaptionLabel],"aria-hidden":!0},a?.label,q.createElement(r.Chevron,{orientation:"down",size:18,className:s[ae.Chevron]})))}function RM(e){return q.createElement("div",{...e})}function OM(e){return q.createElement("div",{...e})}function AM(e){const{calendarMonth:t,displayIndex:n,...r}=e;return q.createElement("div",{...r},e.children)}function NM(e){const{calendarMonth:t,displayIndex:n,...r}=e;return q.createElement("div",{...r})}function IM(e){return q.createElement("table",{...e})}function FM(e){return q.createElement("div",{...e})}const $m=m.createContext(void 0);function hs(){const e=m.useContext($m);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function jM(e){const{components:t}=hs();return q.createElement(t.Dropdown,{...e})}function LM(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:s,...o}=e,{components:i,classNames:a,labels:{labelPrevious:l,labelNext:c}}=hs(),u=m.useCallback(f=>{s&&n?.(f)},[s,n]),d=m.useCallback(f=>{r&&t?.(f)},[r,t]);return q.createElement("nav",{...o},q.createElement(i.PreviousMonthButton,{type:"button",className:a[ae.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":l(r),onClick:d},q.createElement(i.Chevron,{disabled:r?void 0:!0,className:a[ae.Chevron],orientation:"left"})),q.createElement(i.NextMonthButton,{type:"button",className:a[ae.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":c(s),onClick:u},q.createElement(i.Chevron,{disabled:s?void 0:!0,orientation:"right",className:a[ae.Chevron]})))}function VM(e){const{components:t}=hs();return q.createElement(t.Button,{...e})}function _M(e){return q.createElement("option",{...e})}function WM(e){const{components:t}=hs();return q.createElement(t.Button,{...e})}function BM(e){const{rootRef:t,...n}=e;return q.createElement("div",{...n,ref:t})}function $M(e){return q.createElement("select",{...e})}function YM(e){const{week:t,...n}=e;return q.createElement("tr",{...n})}function HM(e){return q.createElement("th",{...e})}function UM(e){return q.createElement("thead",{"aria-hidden":!0},q.createElement("tr",{...e}))}function GM(e){const{week:t,...n}=e;return q.createElement("th",{...n})}function KM(e){return q.createElement("th",{...e})}function zM(e){return q.createElement("tbody",{...e})}function qM(e){const{components:t}=hs();return q.createElement(t.Dropdown,{...e})}const XM=Object.freeze(Object.defineProperty({__proto__:null,Button:TM,CaptionLabel:CM,Chevron:EM,Day:MM,DayButton:DM,Dropdown:PM,DropdownNav:RM,Footer:OM,Month:AM,MonthCaption:NM,MonthGrid:IM,Months:FM,MonthsDropdown:jM,Nav:LM,NextMonthButton:VM,Option:_M,PreviousMonthButton:WM,Root:BM,Select:$M,Week:YM,WeekNumber:GM,WeekNumberHeader:KM,Weekday:HM,Weekdays:UM,Weeks:zM,YearsDropdown:qM},Symbol.toStringTag,{value:"Module"}));function en(e,t,n=!1,r=Kt){let{from:s,to:o}=e;const{differenceInCalendarDays:i,isSameDay:a}=r;return s&&o?(i(o,s)<0&&([s,o]=[o,s]),i(t,s)>=(n?1:0)&&i(o,t)>=(n?1:0)):!n&&o?a(o,t):!n&&s?a(s,t):!1}function sl(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function So(e){return!!(e&&typeof e=="object"&&"from"in e)}function ol(e){return!!(e&&typeof e=="object"&&"after"in e)}function il(e){return!!(e&&typeof e=="object"&&"before"in e)}function Ym(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Hm(e,t){return Array.isArray(e)&&e.every(t.isDate)}function tn(e,t,n=Kt){const r=Array.isArray(t)?t:[t],{isSameDay:s,differenceInCalendarDays:o,isAfter:i}=n;return r.some(a=>{if(typeof a=="boolean")return a;if(n.isDate(a))return s(e,a);if(Hm(a,n))return a.some(l=>s(e,l));if(So(a))return en(a,e,!1,n);if(Ym(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(e.getDay()):a.dayOfWeek===e.getDay();if(sl(a)){const l=o(a.before,e),c=o(a.after,e),u=l>0,d=c<0;return i(a.before,a.after)?d&&u:u||d}return ol(a)?o(e,a.after)>0:il(a)?o(a.before,e)>0:typeof a=="function"?a(e):!1})}function ZM(e,t,n,r,s){const{disabled:o,hidden:i,modifiers:a,showOutsideDays:l,broadcastCalendar:c,today:u=s.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:h,isBefore:p,endOfMonth:g,isAfter:y}=s,w=n&&h(n),x=r&&g(r),v={[Le.focused]:[],[Le.outside]:[],[Le.disabled]:[],[Le.hidden]:[],[Le.today]:[]},k={};for(const S of e){const{date:C,displayMonth:M}=S,D=!!(M&&!f(C,M)),F=!!(w&&p(C,w)),T=!!(x&&y(C,x)),R=!!(o&&tn(C,o,s)),A=!!(i&&tn(C,i,s))||F||T||!c&&!l&&D||c&&l===!1&&D,E=d(C,u);D&&v.outside.push(S),R&&v.disabled.push(S),A&&v.hidden.push(S),E&&v.today.push(S),a&&Object.keys(a).forEach(j=>{const N=a?.[j];N&&tn(C,N,s)&&(k[j]?k[j].push(S):k[j]=[S])})}return S=>{const C={[Le.focused]:!1,[Le.disabled]:!1,[Le.hidden]:!1,[Le.outside]:!1,[Le.today]:!1},M={};for(const D in v){const F=v[D];C[D]=F.some(T=>T===S)}for(const D in k)M[D]=k[D].some(F=>F===S);return{...C,...M}}}function QM(e,t,n={}){return Object.entries(e).filter(([,s])=>s===!0).reduce((s,[o])=>(n[o]?s.push(n[o]):t[Le[o]]?s.push(t[Le[o]]):t[Rt[o]]&&s.push(t[Rt[o]]),s),[t[ae.Day]])}function JM(e){return{...XM,...e}}function eD(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function tD(){const e={};for(const t in ae)e[ae[t]]=`rdp-${ae[t]}`;for(const t in Le)e[Le[t]]=`rdp-${Le[t]}`;for(const t in Rt)e[Rt[t]]=`rdp-${Rt[t]}`;for(const t in ct)e[ct[t]]=`rdp-${ct[t]}`;return e}function Um(e,t,n){return(n??new pt(t)).formatMonthYear(e)}const nD=Um;function rD(e,t,n){return(n??new pt(t)).format(e,"d")}function sD(e,t=Kt){return t.format(e,"LLLL")}function oD(e,t,n){return(n??new pt(t)).format(e,"cccccc")}function iD(e,t=Kt){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function aD(){return""}function Gm(e,t=Kt){return t.format(e,"yyyy")}const lD=Gm,cD=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Um,formatDay:rD,formatMonthCaption:nD,formatMonthDropdown:sD,formatWeekNumber:iD,formatWeekNumberHeader:aD,formatWeekdayName:oD,formatYearCaption:lD,formatYearDropdown:Gm},Symbol.toStringTag,{value:"Module"}));function uD(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...cD,...e}}function al(e,t,n,r){let s=(r??new pt(n)).format(e,"PPPP");return t.today&&(s=`Today, ${s}`),t.selected&&(s=`${s}, selected`),s}const dD=al;function ll(e,t,n){return(n??new pt(t)).formatMonthYear(e)}const fD=ll;function Km(e,t,n,r){let s=(r??new pt(n)).format(e,"PPPP");return t?.today&&(s=`Today, ${s}`),s}function zm(e){return"Choose the Month"}function qm(){return""}const hD="Go to the Next Month";function Xm(e,t){return hD}function Zm(e){return"Go to the Previous Month"}function Qm(e,t,n){return(n??new pt(t)).format(e,"cccc")}function Jm(e,t){return`Week ${e}`}function ep(e){return"Week Number"}function tp(e){return"Choose the Year"}const mD=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:fD,labelDay:dD,labelDayButton:al,labelGrid:ll,labelGridcell:Km,labelMonthDropdown:zm,labelNav:qm,labelNext:Xm,labelPrevious:Zm,labelWeekNumber:Jm,labelWeekNumberHeader:ep,labelWeekday:Qm,labelYearDropdown:tp},Symbol.toStringTag,{value:"Module"})),Mt=(e,t,n)=>t||(n?typeof n=="function"?n:(...r)=>n:e);function pD(e,t){const n=t.locale?.labels??{};return{...mD,...e??{},labelDayButton:Mt(al,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:Mt(zm,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Mt(Xm,e?.labelNext,n.labelNext),labelPrevious:Mt(Zm,e?.labelPrevious,n.labelPrevious),labelWeekNumber:Mt(Jm,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Mt(tp,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:Mt(ll,e?.labelGrid,n.labelGrid),labelGridcell:Mt(Km,e?.labelGridcell,n.labelGridcell),labelNav:Mt(qm,e?.labelNav,n.labelNav),labelWeekNumberHeader:Mt(ep,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Mt(Qm,e?.labelWeekday,n.labelWeekday)}}function gD(e,t,n,r,s){const{startOfMonth:o,startOfYear:i,endOfYear:a,eachMonthOfInterval:l,getMonth:c}=s;return l({start:i(e),end:a(e)}).map(f=>{const h=r.formatMonthDropdown(f,s),p=c(f),g=t&&f<o(t)||n&&f>o(n)||!1;return{value:p,label:h,disabled:g}})}function yD(e,t={},n={}){let r={...t?.[ae.Day]};return Object.entries(e).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function bD(e,t,n,r){const s=r??e.today(),o=n?e.startOfBroadcastWeek(s,e):t?e.startOfISOWeek(s):e.startOfWeek(s),i=[];for(let a=0;a<7;a++){const l=e.addDays(o,a);i.push(l)}return i}function xD(e,t,n,r,s=!1){if(!e||!t)return;const{startOfYear:o,endOfYear:i,eachYearOfInterval:a,getYear:l}=r,c=o(e),u=i(t),d=a({start:c,end:u});return s&&d.reverse(),d.map(f=>{const h=n.formatYearDropdown(f,r);return{value:l(f),label:h,disabled:!1}})}function vD(e,t={}){const{weekStartsOn:n,locale:r}=t,s=n??r?.options?.weekStartsOn??0,o=a=>{const l=typeof a=="number"||typeof a=="string"?new Date(a):a;return new Qe(l.getFullYear(),l.getMonth(),l.getDate(),12,0,0,e)},i=a=>{const l=o(a);return new Date(l.getFullYear(),l.getMonth(),l.getDate(),0,0,0,0)};return{today:()=>o(Qe.tz(e)),newDate:(a,l,c)=>new Qe(a,l,c,12,0,0,e),startOfDay:a=>o(a),startOfWeek:(a,l)=>{const c=o(a),u=l?.weekStartsOn??s,d=(c.getDay()-u+7)%7;return c.setDate(c.getDate()-d),c},startOfISOWeek:a=>{const l=o(a),c=(l.getDay()-1+7)%7;return l.setDate(l.getDate()-c),l},startOfMonth:a=>{const l=o(a);return l.setDate(1),l},startOfYear:a=>{const l=o(a);return l.setMonth(0,1),l},endOfWeek:(a,l)=>{const c=o(a),f=(((l?.weekStartsOn??s)+6)%7-c.getDay()+7)%7;return c.setDate(c.getDate()+f),c},endOfISOWeek:a=>{const l=o(a),c=(7-l.getDay())%7;return l.setDate(l.getDate()+c),l},endOfMonth:a=>{const l=o(a);return l.setMonth(l.getMonth()+1,0),l},endOfYear:a=>{const l=o(a);return l.setMonth(11,31),l},eachMonthOfInterval:a=>{const l=o(a.start),c=o(a.end),u=[],d=new Qe(l.getFullYear(),l.getMonth(),1,12,0,0,e),f=c.getFullYear()*12+c.getMonth();for(;d.getFullYear()*12+d.getMonth()<=f;)u.push(new Qe(d,e)),d.setMonth(d.getMonth()+1,1);return u},addDays:(a,l)=>{const c=o(a);return c.setDate(c.getDate()+l),c},addWeeks:(a,l)=>{const c=o(a);return c.setDate(c.getDate()+l*7),c},addMonths:(a,l)=>{const c=o(a);return c.setMonth(c.getMonth()+l),c},addYears:(a,l)=>{const c=o(a);return c.setFullYear(c.getFullYear()+l),c},eachYearOfInterval:a=>{const l=o(a.start),c=o(a.end),u=[],d=new Qe(l.getFullYear(),0,1,12,0,0,e);for(;d.getFullYear()<=c.getFullYear();)u.push(new Qe(d,e)),d.setFullYear(d.getFullYear()+1,0,1);return u},getWeek:(a,l)=>{const c=i(a);return rl(c,{weekStartsOn:l?.weekStartsOn??s,firstWeekContainsDate:l?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:a=>{const l=i(a);return nl(l)},differenceInCalendarDays:(a,l)=>{const c=i(a),u=i(l);return tl(c,u)},differenceInCalendarMonths:(a,l)=>{const c=i(a),u=i(l);return Nm(c,u)}}}const ms=e=>e instanceof HTMLElement?e:null,xi=e=>[...e.querySelectorAll("[data-animated-month]")??[]],wD=e=>ms(e.querySelector("[data-animated-month]")),vi=e=>ms(e.querySelector("[data-animated-caption]")),wi=e=>ms(e.querySelector("[data-animated-weeks]")),kD=e=>ms(e.querySelector("[data-animated-nav]")),SD=e=>ms(e.querySelector("[data-animated-weekdays]"));function TD(e,t,{classNames:n,months:r,focused:s,dateLib:o}){const i=m.useRef(null),a=m.useRef(r),l=m.useRef(!1);m.useLayoutEffect(()=>{const c=a.current;if(a.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||c.length===0||r.length!==c.length)return;const u=o.isSameMonth(r[0].date,c[0].date),d=o.isAfter(r[0].date,c[0].date),f=d?n[ct.caption_after_enter]:n[ct.caption_before_enter],h=d?n[ct.weeks_after_enter]:n[ct.weeks_before_enter],p=i.current,g=e.current.cloneNode(!0);if(g instanceof HTMLElement?(xi(g).forEach(v=>{if(!(v instanceof HTMLElement))return;const k=wD(v);k&&v.contains(k)&&v.removeChild(k);const S=vi(v);S&&S.classList.remove(f);const C=wi(v);C&&C.classList.remove(h)}),i.current=g):i.current=null,l.current||u||s)return;const y=p instanceof HTMLElement?xi(p):[],w=xi(e.current);if(w?.every(x=>x instanceof HTMLElement)&&y&&y.every(x=>x instanceof HTMLElement)){l.current=!0,e.current.style.isolation="isolate";const x=kD(e.current);x&&(x.style.zIndex="1"),w.forEach((v,k)=>{const S=y[k];if(!S)return;v.style.position="relative",v.style.overflow="hidden";const C=vi(v);C&&C.classList.add(f);const M=wi(v);M&&M.classList.add(h);const D=()=>{l.current=!1,e.current&&(e.current.style.isolation=""),x&&(x.style.zIndex=""),C&&C.classList.remove(f),M&&M.classList.remove(h),v.style.position="",v.style.overflow="",v.contains(S)&&v.removeChild(S)};S.style.pointerEvents="none",S.style.position="absolute",S.style.overflow="hidden",S.setAttribute("aria-hidden","true");const F=SD(S);F&&(F.style.opacity="0");const T=vi(S);T&&(T.classList.add(d?n[ct.caption_before_exit]:n[ct.caption_after_exit]),T.addEventListener("animationend",D));const R=wi(S);R&&R.classList.add(d?n[ct.weeks_before_exit]:n[ct.weeks_after_exit]),v.insertBefore(S,v.firstChild)})}})}function CD(e,t,n,r){const s=e[0],o=e[e.length-1],{ISOWeek:i,fixedWeeks:a,broadcastCalendar:l}=n??{},{addDays:c,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:h,endOfMonth:p,endOfWeek:g,isAfter:y,startOfBroadcastWeek:w,startOfISOWeek:x,startOfWeek:v}=r,k=l?w(s,r):i?x(s):v(s),S=l?f(o):i?h(p(o)):g(p(o)),C=t&&(l?f(t):i?h(t):g(t)),M=C&&y(S,C)?C:S,D=u(M,k),F=d(o,s)+1,T=[];for(let E=0;E<=D;E++){const j=c(k,E);T.push(j)}const A=(l?35:42)*F;if(a&&T.length<A){const E=A-T.length;for(let j=0;j<E;j++){const N=c(T[T.length-1],1);T.push(N)}}return T}function ED(e){const t=[];return e.reduce((n,r)=>{const s=r.weeks.reduce((o,i)=>o.concat(i.days.slice()),t.slice());return n.concat(s.slice())},t.slice())}function MD(e,t,n,r){const{numberOfMonths:s=1}=n,o=[];for(let i=0;i<s;i++){const a=r.addMonths(e,i);if(t&&a>t)break;o.push(a)}return o}function Ju(e,t,n,r){const{month:s,defaultMonth:o,today:i=r.today(),numberOfMonths:a=1}=e;let l=s||o||i;const{differenceInCalendarMonths:c,addMonths:u,startOfMonth:d}=r;if(n&&c(n,l)<a-1){const f=-1*(a-1);l=u(n,f)}return t&&c(l,t)<0&&(l=t),d(l)}function DD(e,t,n,r){const{addDays:s,endOfBroadcastWeek:o,endOfISOWeek:i,endOfMonth:a,endOfWeek:l,getISOWeek:c,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:h}=r,p=e.reduce((g,y)=>{const w=n.broadcastCalendar?d(y,r):n.ISOWeek?f(y):h(y),x=n.broadcastCalendar?o(y):n.ISOWeek?i(a(y)):l(a(y)),v=t.filter(M=>M>=w&&M<=x),k=n.broadcastCalendar?35:42;if(n.fixedWeeks&&v.length<k){const M=t.filter(D=>{const F=k-v.length;return D>x&&D<=s(x,F)});v.push(...M)}const S=v.reduce((M,D)=>{const F=n.ISOWeek?c(D):u(D),T=M.find(A=>A.weekNumber===F),R=new Bm(D,y,r);return T?T.days.push(R):M.push(new SM(F,[R])),M},[]),C=new kM(y,S);return g.push(C),g},[]);return n.reverseMonths?p.reverse():p}function PD(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:s,startOfDay:o,startOfMonth:i,endOfMonth:a,addYears:l,endOfYear:c,newDate:u,today:d}=t,{fromYear:f,toYear:h,fromMonth:p,toMonth:g}=e;!n&&p&&(n=p),!n&&f&&(n=t.newDate(f,0,1)),!r&&g&&(r=g),!r&&h&&(r=u(h,11,31));const y=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=i(n):f?n=u(f,0,1):!n&&y&&(n=s(l(e.today??d(),-100))),r?r=a(r):h?r=u(h,11,31):!r&&y&&(r=c(e.today??d())),[n&&o(n),r&&o(r)]}function RD(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:o=1}=n,{startOfMonth:i,addMonths:a,differenceInCalendarMonths:l}=r,c=s?o:1,u=i(e);if(!t)return a(u,c);if(!(l(t,e)<o))return a(u,c)}function OD(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:o}=n,{startOfMonth:i,addMonths:a,differenceInCalendarMonths:l}=r,c=s?o??1:1,u=i(e);if(!t)return a(u,-c);if(!(l(u,t)<=0))return a(u,-c)}function AD(e){const t=[];return e.reduce((n,r)=>n.concat(r.weeks.slice()),t.slice())}function To(e,t){const[n,r]=m.useState(e);return[t===void 0?n:t,r]}function ND(e,t){const[n,r]=PD(e,t),{startOfMonth:s,endOfMonth:o}=t,i=Ju(e,n,r,t),[a,l]=To(i,e.month?i:void 0);m.useEffect(()=>{const k=Ju(e,n,r,t);l(k)},[e.timeZone]);const{months:c,weeks:u,days:d,previousMonth:f,nextMonth:h}=m.useMemo(()=>{const k=MD(a,r,{numberOfMonths:e.numberOfMonths},t),S=CD(k,e.endMonth?o(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),C=DD(k,S,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),M=AD(C),D=ED(C),F=OD(a,n,e,t),T=RD(a,r,e,t);return{months:C,weeks:M,days:D,previousMonth:F,nextMonth:T}},[t,a.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:p,onMonthChange:g}=e,y=k=>u.some(S=>S.days.some(C=>C.isEqualTo(k))),w=k=>{if(p)return;let S=s(k);n&&S<s(n)&&(S=s(n)),r&&S>s(r)&&(S=s(r)),l(S),g?.(S)};return{months:c,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:h,goToMonth:w,goToDay:k=>{y(k)||w(k.date)}}}var Lt;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Lt||(Lt={}));function ed(e){return!e[Le.disabled]&&!e[Le.hidden]&&!e[Le.outside]}function ID(e,t,n,r){let s,o=-1;for(const i of e){const a=t(i);ed(a)&&(a[Le.focused]&&o<Lt.FocusedModifier?(s=i,o=Lt.FocusedModifier):r?.isEqualTo(i)&&o<Lt.LastFocused?(s=i,o=Lt.LastFocused):n(i.date)&&o<Lt.Selected?(s=i,o=Lt.Selected):a[Le.today]&&o<Lt.Today&&(s=i,o=Lt.Today))}return s||(s=e.find(i=>ed(t(i)))),s}function FD(e,t,n,r,s,o,i){const{ISOWeek:a,broadcastCalendar:l}=o,{addDays:c,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:h,endOfISOWeek:p,endOfWeek:g,max:y,min:w,startOfBroadcastWeek:x,startOfISOWeek:v,startOfWeek:k}=i;let C={day:c,week:d,month:u,year:f,startOfWeek:M=>l?x(M,i):a?v(M):k(M),endOfWeek:M=>l?h(M):a?p(M):g(M)}[e](n,t==="after"?1:-1);return t==="before"&&r?C=y([r,C]):t==="after"&&s&&(C=w([s,C])),C}function np(e,t,n,r,s,o,i,a=0){if(a>365)return;const l=FD(e,t,n.date,r,s,o,i),c=!!(o.disabled&&tn(l,o.disabled,i)),u=!!(o.hidden&&tn(l,o.hidden,i)),d=l,f=new Bm(l,d,i);return!c&&!u?f:np(e,t,f,r,s,o,i,a+1)}function jD(e,t,n,r,s){const{autoFocus:o}=e,[i,a]=m.useState(),l=ID(t.days,n,r||(()=>!1),i),[c,u]=m.useState(o?l:void 0);return{isFocusTarget:g=>!!l?.isEqualTo(g),setFocused:u,focused:c,blur:()=>{a(c),u(void 0)},moveFocus:(g,y)=>{if(!c)return;const w=np(g,y,c,t.navStart,t.navEnd,e,s);w&&(e.disableNavigation&&!t.days.some(v=>v.isEqualTo(w))||(t.goToDay(w),u(w)))}}}function LD(e,t){const{selected:n,required:r,onSelect:s}=e,[o,i]=To(n,s?n:void 0),a=s?n:o,{isSameDay:l}=t,c=h=>a?.some(p=>l(p,h))??!1,{min:u,max:d}=e;return{selected:a,select:(h,p,g)=>{let y=[...a??[]];if(c(h)){if(a?.length===u||r&&a?.length===1)return;y=a?.filter(w=>!l(w,h))}else a?.length===d?y=[h]:y=[...y,h];return s||i(y),s?.(y,h,p,g),y},isSelected:c}}function VD(e,t,n=0,r=0,s=!1,o=Kt){const{from:i,to:a}=t||{},{isSameDay:l,isAfter:c,isBefore:u}=o;let d;if(!i&&!a)d={from:e,to:n>0?void 0:e};else if(i&&!a)l(i,e)?n===0?d={from:i,to:e}:s?d={from:i,to:void 0}:d=void 0:u(e,i)?d={from:e,to:i}:d={from:i,to:e};else if(i&&a)if(l(i,e)&&l(a,e))s?d={from:i,to:a}:d=void 0;else if(l(i,e))d={from:i,to:n>0?void 0:e};else if(l(a,e))d={from:e,to:n>0?void 0:e};else if(u(e,i))d={from:e,to:a};else if(c(e,i))d={from:i,to:e};else if(c(e,a))d={from:i,to:e};else throw new Error("Invalid range");if(d?.from&&d?.to){const f=o.differenceInCalendarDays(d.to,d.from);r>0&&f>r?d={from:e,to:void 0}:n>1&&f<n&&(d={from:e,to:void 0})}return d}function _D(e,t,n=Kt){const r=Array.isArray(t)?t:[t];let s=e.from;const o=n.differenceInCalendarDays(e.to,e.from),i=Math.min(o,6);for(let a=0;a<=i;a++){if(r.includes(s.getDay()))return!0;s=n.addDays(s,1)}return!1}function td(e,t,n=Kt){return en(e,t.from,!1,n)||en(e,t.to,!1,n)||en(t,e.from,!1,n)||en(t,e.to,!1,n)}function WD(e,t,n=Kt){const r=Array.isArray(t)?t:[t];if(r.filter(a=>typeof a!="function").some(a=>typeof a=="boolean"?a:n.isDate(a)?en(e,a,!1,n):Hm(a,n)?a.some(l=>en(e,l,!1,n)):So(a)?a.from&&a.to?td(e,{from:a.from,to:a.to},n):!1:Ym(a)?_D(e,a.dayOfWeek,n):sl(a)?n.isAfter(a.before,a.after)?td(e,{from:n.addDays(a.after,1),to:n.addDays(a.before,-1)},n):tn(e.from,a,n)||tn(e.to,a,n):ol(a)||il(a)?tn(e.from,a,n)||tn(e.to,a,n):!1))return!0;const i=r.filter(a=>typeof a=="function");if(i.length){let a=e.from;const l=n.differenceInCalendarDays(e.to,e.from);for(let c=0;c<=l;c++){if(i.some(u=>u(a)))return!0;a=n.addDays(a,1)}}return!1}function BD(e,t){const{disabled:n,excludeDisabled:r,resetOnSelect:s,selected:o,required:i,onSelect:a}=e,[l,c]=To(o,a?o:void 0),u=a?o:l;return{selected:u,select:(h,p,g)=>{const{min:y,max:w}=e;let x;if(h){const v=u?.from,k=u?.to,S=!!v&&!!k,C=!!v&&!!k&&t.isSameDay(v,k)&&t.isSameDay(h,v);s&&(S||!u?.from)?!i&&C?x=void 0:x={from:h,to:void 0}:x=VD(h,u,y,w,i,t)}return r&&n&&x?.from&&x.to&&WD({from:x.from,to:x.to},n,t)&&(x.from=h,x.to=void 0),a||c(x),a?.(x,h,p,g),x},isSelected:h=>u&&en(u,h,!1,t)}}function $D(e,t){const{selected:n,required:r,onSelect:s}=e,[o,i]=To(n,s?n:void 0),a=s?n:o,{isSameDay:l}=t;return{selected:a,select:(d,f,h)=>{let p=d;return!r&&a&&a&&l(d,a)&&(p=void 0),s||i(p),s?.(p,d,f,h),p},isSelected:d=>a?l(a,d):!1}}function YD(e,t){const n=$D(e,t),r=LD(e,t),s=BD(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function gt(e,t){return e instanceof Qe&&e.timeZone===t?e:new Qe(e,t)}function Zn(e,t,n){return gt(e,t)}function nd(e,t,n){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Zn(e,t):Array.isArray(e)?e.map(r=>r instanceof Date?Zn(r,t):r):So(e)?{...e,from:e.from?gt(e.from,t):e.from,to:e.to?gt(e.to,t):e.to}:sl(e)?{before:Zn(e.before,t),after:Zn(e.after,t)}:ol(e)?{after:Zn(e.after,t)}:il(e)?{before:Zn(e.before,t)}:e}function ki(e,t,n){return e&&(Array.isArray(e)?e.map(r=>nd(r,t)):nd(e,t))}function HD(e){let t=e;const n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&(t.today=gt(t.today,n)),t.month&&(t.month=gt(t.month,n)),t.defaultMonth&&(t.defaultMonth=gt(t.defaultMonth,n)),t.startMonth&&(t.startMonth=gt(t.startMonth,n)),t.endMonth&&(t.endMonth=gt(t.endMonth,n)),t.mode==="single"&&t.selected?t.selected=gt(t.selected,n):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(re=>gt(re,n)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?gt(t.selected.from,n):t.selected.from,to:t.selected.to?gt(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=ki(t.disabled,n)),t.hidden!==void 0&&(t.hidden=ki(t.hidden,n)),t.modifiers)){const re={};Object.keys(t.modifiers).forEach(G=>{re[G]=ki(t.modifiers?.[G],n)}),t.modifiers=re}const{components:r,formatters:s,labels:o,dateLib:i,locale:a,classNames:l}=m.useMemo(()=>{const re={...Wm,...t.locale},G=t.broadcastCalendar?1:t.weekStartsOn,oe=t.noonSafe&&t.timeZone?vD(t.timeZone,{weekStartsOn:G,locale:re}):void 0,de=t.dateLib&&oe?{...oe,...t.dateLib}:t.dateLib??oe,xe=new pt({locale:re,weekStartsOn:G,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},de);return{dateLib:xe,components:JM(t.components),formatters:uD(t.formatters),labels:pD(t.labels,xe.options),locale:re,classNames:{...tD(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:i.today()});const{captionLayout:c,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:h,onDayClick:p,onDayFocus:g,onDayKeyDown:y,onDayMouseEnter:w,onDayMouseLeave:x,onNextClick:v,onPrevClick:k,showWeekNumber:S,styles:C}=t,{formatCaption:M,formatDay:D,formatMonthDropdown:F,formatWeekNumber:T,formatWeekNumberHeader:R,formatWeekdayName:A,formatYearDropdown:E}=s,j=ND(t,i),{days:N,months:V,navStart:U,navEnd:P,previousMonth:I,nextMonth:B,goToMonth:W}=j,Q=ZM(N,t,U,P,i),{isSelected:Y,select:$,selected:z}=YD(t,i)??{},{blur:Z,focused:ce,isFocusTarget:Se,moveFocus:Re,setFocused:Ee}=jD(t,j,Q,Y??(()=>!1),i),{labelDayButton:Je,labelGridcell:L,labelGrid:ue,labelMonthDropdown:te,labelNav:Me,labelPrevious:H,labelNext:se,labelWeekday:ie,labelWeekNumber:me,labelWeekNumberHeader:ge,labelYearDropdown:J}=o,ne=m.useMemo(()=>bD(i,t.ISOWeek,t.broadcastCalendar,t.today),[i,t.ISOWeek,t.broadcastCalendar,t.today]),Ie=u!==void 0||p!==void 0,be=m.useCallback(()=>{I&&(W(I),k?.(I))},[I,W,k]),_e=m.useCallback(()=>{B&&(W(B),v?.(B))},[W,B,v]),Ge=m.useCallback((re,G)=>oe=>{oe.preventDefault(),oe.stopPropagation(),Ee(re),!G.disabled&&($?.(re.date,G,oe),p?.(re.date,G,oe))},[$,p,Ee]),ot=m.useCallback((re,G)=>oe=>{Ee(re),g?.(re.date,G,oe)},[g,Ee]),Oe=m.useCallback((re,G)=>oe=>{Z(),h?.(re.date,G,oe)},[Z,h]),ye=m.useCallback((re,G)=>oe=>{const de={ArrowLeft:[oe.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[oe.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[oe.shiftKey?"year":"week","after"],ArrowUp:[oe.shiftKey?"year":"week","before"],PageUp:[oe.shiftKey?"year":"month","before"],PageDown:[oe.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(de[oe.key]){oe.preventDefault(),oe.stopPropagation();const[xe,fe]=de[oe.key];Re(xe,fe)}y?.(re.date,G,oe)},[Re,y,t.dir]),Fe=m.useCallback((re,G)=>oe=>{w?.(re.date,G,oe)},[w]),$e=m.useCallback((re,G)=>oe=>{x?.(re.date,G,oe)},[x]),Nt=m.useCallback(re=>G=>{const oe=Number(G.target.value),de=i.setMonth(i.startOfMonth(re),oe);W(de)},[i,W]),kt=m.useCallback(re=>G=>{const oe=Number(G.target.value),de=i.setYear(i.startOfMonth(re),oe);W(de)},[i,W]),{className:et,style:an}=m.useMemo(()=>({className:[l[ae.Root],t.className].filter(Boolean).join(" "),style:{...C?.[ae.Root],...t.style}}),[l,t.className,t.style,C]),at=eD(t),De=m.useRef(null);TD(De,!!t.animate,{classNames:l,months:V,focused:ce,dateLib:i});const Ye={dayPickerProps:t,selected:z,select:$,isSelected:Y,months:V,nextMonth:B,previousMonth:I,goToMonth:W,getModifiers:Q,components:r,classNames:l,styles:C,labels:o,formatters:s};return q.createElement($m.Provider,{value:Ye},q.createElement(r.Root,{rootRef:t.animate?De:void 0,className:et,style:an,dir:t.dir,id:t.id,lang:t.lang??a.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...at},q.createElement(r.Months,{className:l[ae.Months],style:C?.[ae.Months]},!t.hideNavigation&&!d&&q.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[ae.Nav],style:C?.[ae.Nav],"aria-label":Me(),onPreviousClick:be,onNextClick:_e,previousMonth:I,nextMonth:B}),V.map((re,G)=>q.createElement(r.Month,{"data-animated-month":t.animate?"true":void 0,className:l[ae.Month],style:C?.[ae.Month],key:G,displayIndex:G,calendarMonth:re},d==="around"&&!t.hideNavigation&&G===0&&q.createElement(r.PreviousMonthButton,{type:"button",className:l[ae.PreviousMonthButton],tabIndex:I?void 0:-1,"aria-disabled":I?void 0:!0,"aria-label":H(I),onClick:be,"data-animated-button":t.animate?"true":void 0},q.createElement(r.Chevron,{disabled:I?void 0:!0,className:l[ae.Chevron],orientation:t.dir==="rtl"?"right":"left"})),q.createElement(r.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:l[ae.MonthCaption],style:C?.[ae.MonthCaption],calendarMonth:re,displayIndex:G},c?.startsWith("dropdown")?q.createElement(r.DropdownNav,{className:l[ae.Dropdowns],style:C?.[ae.Dropdowns]},(()=>{const oe=c==="dropdown"||c==="dropdown-months"?q.createElement(r.MonthsDropdown,{key:"month",className:l[ae.MonthsDropdown],"aria-label":te(),classNames:l,components:r,disabled:!!t.disableNavigation,onChange:Nt(re.date),options:gD(re.date,U,P,s,i),style:C?.[ae.Dropdown],value:i.getMonth(re.date)}):q.createElement("span",{key:"month"},F(re.date,i)),de=c==="dropdown"||c==="dropdown-years"?q.createElement(r.YearsDropdown,{key:"year",className:l[ae.YearsDropdown],"aria-label":J(i.options),classNames:l,components:r,disabled:!!t.disableNavigation,onChange:kt(re.date),options:xD(U,P,s,i,!!t.reverseYears),style:C?.[ae.Dropdown],value:i.getYear(re.date)}):q.createElement("span",{key:"year"},E(re.date,i));return i.getMonthYearOrder()==="year-first"?[de,oe]:[oe,de]})(),q.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},M(re.date,i.options,i))):q.createElement(r.CaptionLabel,{className:l[ae.CaptionLabel],role:"status","aria-live":"polite"},M(re.date,i.options,i))),d==="around"&&!t.hideNavigation&&G===f-1&&q.createElement(r.NextMonthButton,{type:"button",className:l[ae.NextMonthButton],tabIndex:B?void 0:-1,"aria-disabled":B?void 0:!0,"aria-label":se(B),onClick:_e,"data-animated-button":t.animate?"true":void 0},q.createElement(r.Chevron,{disabled:B?void 0:!0,className:l[ae.Chevron],orientation:t.dir==="rtl"?"left":"right"})),G===f-1&&d==="after"&&!t.hideNavigation&&q.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[ae.Nav],style:C?.[ae.Nav],"aria-label":Me(),onPreviousClick:be,onNextClick:_e,previousMonth:I,nextMonth:B}),q.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":ue(re.date,i.options,i)||void 0,className:l[ae.MonthGrid],style:C?.[ae.MonthGrid]},!t.hideWeekdays&&q.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:l[ae.Weekdays],style:C?.[ae.Weekdays]},S&&q.createElement(r.WeekNumberHeader,{"aria-label":ge(i.options),className:l[ae.WeekNumberHeader],style:C?.[ae.WeekNumberHeader],scope:"col"},R()),ne.map(oe=>q.createElement(r.Weekday,{"aria-label":ie(oe,i.options,i),className:l[ae.Weekday],key:String(oe),style:C?.[ae.Weekday],scope:"col"},A(oe,i.options,i)))),q.createElement(r.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:l[ae.Weeks],style:C?.[ae.Weeks]},re.weeks.map(oe=>q.createElement(r.Week,{className:l[ae.Week],key:oe.weekNumber,style:C?.[ae.Week],week:oe},S&&q.createElement(r.WeekNumber,{week:oe,style:C?.[ae.WeekNumber],"aria-label":me(oe.weekNumber,{locale:a}),className:l[ae.WeekNumber],scope:"row",role:"rowheader"},T(oe.weekNumber,i)),oe.days.map(de=>{const{date:xe}=de,fe=Q(de);if(fe[Le.focused]=!fe.hidden&&!!ce?.isEqualTo(de),fe[Rt.selected]=Y?.(xe)||fe.selected,So(z)){const{from:ln,to:cn}=z;fe[Rt.range_start]=!!(ln&&cn&&i.isSameDay(xe,ln)),fe[Rt.range_end]=!!(ln&&cn&&i.isSameDay(xe,cn)),fe[Rt.range_middle]=en(z,xe,!0,i)}const It=yD(fe,C,t.modifiersStyles),wn=QM(fe,l,t.modifiersClassNames),kn=!Ie&&!fe.hidden?L(xe,fe,i.options,i):void 0;return q.createElement(r.Day,{key:`${de.isoDate}_${de.displayMonthId}`,day:de,modifiers:fe,className:wn.join(" "),style:It,role:"gridcell","aria-selected":fe.selected||void 0,"aria-label":kn,"data-day":de.isoDate,"data-month":de.outside?de.dateMonthId:void 0,"data-selected":fe.selected||void 0,"data-disabled":fe.disabled||void 0,"data-hidden":fe.hidden||void 0,"data-outside":de.outside||void 0,"data-focused":fe.focused||void 0,"data-today":fe.today||void 0},!fe.hidden&&Ie?q.createElement(r.DayButton,{className:l[ae.DayButton],style:C?.[ae.DayButton],type:"button",day:de,modifiers:fe,disabled:!fe.focused&&fe.disabled||void 0,"aria-disabled":fe.focused&&fe.disabled||void 0,tabIndex:Se(de)?0:-1,"aria-label":Je(xe,fe,i.options,i),onClick:Ge(de,fe),onBlur:Oe(de,fe),onFocus:ot(de,fe),onKeyDown:ye(de,fe),onMouseEnter:Fe(de,fe),onMouseLeave:$e(de,fe)},D(xe,i.options,i)):!fe.hidden&&D(de.date,i.options,i))})))))))),t.footer&&q.createElement(r.Footer,{className:l[ae.Footer],style:C?.[ae.Footer],role:"status","aria-live":"polite"},t.footer)))}function rd(e){if(!e)return"";const t=e.split("-");if(t.length!==3)return e;const n=new Date(Number(t[0]),Number(t[1])-1,Number(t[2]));return Number.isFinite(n.getTime())?Yt(n,"MMM d"):e}function UD({from:e,to:t,onApply:n,onCancel:r}){const s=m.useMemo(()=>{const c={from:void 0,to:void 0};if(e){const u=e.split("-");c.from=new Date(Number(u[0]),Number(u[1])-1,Number(u[2]))}if(t){const u=t.split("-");c.to=new Date(Number(u[0]),Number(u[1])-1,Number(u[2]))}return c},[e,t]),[o,i]=m.useState(s),a=()=>{if(!o?.from)return;const c=Yt(o.from,"yyyy-MM-dd"),u=o.to?Yt(o.to,"yyyy-MM-dd"):c;n?.(c,u)},l=!!o?.from;return b.jsxs("div",{className:"p-4",children:[b.jsx(HD,{mode:"range",selected:o,onSelect:i,numberOfMonths:2,showOutsideDays:!1,classNames:{root:"rdp-oai",months:"flex gap-4",month:"space-y-3",month_caption:"flex justify-center items-center h-8",caption_label:"text-sm font-medium text-oai-black dark:text-oai-white",nav:"flex items-center justify-between absolute inset-x-0 top-0 px-2",button_previous:"inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",button_next:"inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",chevron:"w-4 h-4",month_grid:"border-collapse",weekdays:"flex",weekday:"w-9 text-center text-xs font-medium text-oai-gray-400 dark:text-oai-gray-500 py-1",week:"flex",day:"w-9 h-9 text-center text-sm p-0 relative",day_button:"w-full h-full inline-flex items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 text-oai-black dark:text-oai-white cursor-pointer rdp-day-btn",today:"font-bold",selected:"rdp-selected",range_start:"rdp-selected rdp-range-start",range_end:"rdp-selected rdp-range-end",range_middle:"rdp-range-mid",outside:"text-oai-gray-300 dark:text-oai-gray-600",disabled:"text-oai-gray-300 dark:text-oai-gray-600 cursor-not-allowed",hidden:"invisible"},styles:{months:{position:"relative"}}}),b.jsxs("div",{className:"flex items-center justify-end gap-2 mt-4 pt-3 border-t border-oai-gray-200 dark:border-oai-gray-700",children:[l&&o.from&&b.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mr-auto",children:[Yt(o.from,"MMM d, yyyy"),o.to&&o.to.getTime()!==o.from.getTime()?` — ${Yt(o.to,"MMM d, yyyy")}`:""]}),b.jsx(Qr,{variant:"secondary",size:"sm",onClick:r,children:"Cancel"}),b.jsx(Qr,{variant:"primary",size:"sm",onClick:a,disabled:!l,children:"Apply"})]})]})}function GD(e){return Array.isArray(e)?e.map(t=>typeof t=="string"?{key:t,label:t.toUpperCase()}:{key:t.key,label:t.label||String(t.key).toUpperCase()}):[]}function KD(e){if(typeof e!="string")return null;const t=e.replace(/,/g,"").match(/-?\d+(?:\.\d+)?/);if(!t)return null;const n=Number(t[0]);return Number.isFinite(n)?n:null}const zD={CODEX:"#10b981",CLAUDE:"#8b5cf6",OPENCODE:"#f59e0b",GEMINI:"#3b82f6"};function Si(e,t){const n=e?.toUpperCase?.()||"";return zD[n]||`hsl(${150+t*40}, 60%, 45%)`}function qD({loading:e,onClick:t}){const n=us();return b.jsx(Qr,{variant:"secondary",size:"sm",disabled:e,onClick:t,"aria-label":"Refresh data",className:"w-8 p-0",children:b.jsx(ht.span,{"aria-hidden":"true",animate:e?{rotate:360}:{rotate:0},transition:e&&!n?{duration:1,repeat:1/0,ease:"linear"}:{duration:.3},style:{display:"inline-block"},children:"↻"})})}function XD({period:e,periods:t,onPeriodChange:n,summaryValue:r,summaryLabel:s,summaryCostValue:o,onCostInfo:i,fleetData:a=[],onRefresh:l,loading:c,className:u="",customFrom:d,customTo:f,onCustomRangeApply:h,customRangeOpen:p,onCustomRangeOpenChange:g}){const y=GD(t),w=KD(String(r??"")),x=w!=null,[v,k]=m.useState(null),{resolvedTheme:S}=ga(),C=S==="dark",M=C?"rgba(10,10,10,0.98)":"rgba(255,255,255,0.96)",D=C?"rgba(10,10,10,0)":"rgba(255,255,255,0)",F=a.filter(T=>T.models?.length>0);return b.jsx(sr,{delay:.2,children:b.jsxs(ko,{className:u,children:[b.jsxs("div",{className:"flex items-center justify-between gap-3 mb-6",children:[b.jsx("div",{role:"tablist","aria-label":"Time period",className:"flex gap-1",children:y.map(T=>{const R=e===T.key,A=`text-xs font-medium px-3 py-1.5 rounded-md transition-colors ${R?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800"}`;if(T.key==="custom"){const E=R&&d&&f?`${rd(d)} — ${rd(f)}`:T.label;return b.jsxs(BC,{open:p,onOpenChange:j=>{j?n?.("custom"):g?.(j)},children:[b.jsx(YC,{render:b.jsx("button",{role:"tab","aria-selected":R,type:"button",className:A}),children:E}),b.jsx(UC,{children:b.jsx(KC,{sideOffset:8,side:"bottom",align:"start",className:"!z-[9999]",children:b.jsx(qC,{className:"bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded-xl shadow-lg",children:b.jsx(UD,{from:d,to:f,onApply:h,onCancel:()=>g?.(!1)})})})})]},"custom")}return b.jsx("button",{role:"tab","aria-selected":R,type:"button",className:A,onClick:()=>n?.(T.key),children:T.label},T.key)})}),l&&b.jsx(qD,{loading:c,onClick:l})]}),b.jsxs("div",{className:"text-center mb-8",children:[b.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wider mb-3",children:s}),b.jsx("div",{className:"text-6xl md:text-7xl font-bold text-oai-black dark:text-oai-white tracking-tight tabular-nums",children:x?b.jsx(bC,{value:w,displayValue:r,fontSize:72,padding:6,gap:1,textColor:"var(--oai-black, #111827)",fontWeight:700,gradientHeight:C?0:8,gradientFrom:M,gradientTo:D,counterStyle:{paddingLeft:0,paddingRight:0,gap:0},digitStyle:{width:"0.88ch"}}):r}),o&&b.jsx("div",{className:"flex items-center justify-center gap-2 mt-4",children:i?b.jsxs("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1.5 text-xl font-bold text-oai-brand hover:text-oai-brand-dark dark:hover:text-oai-brand-light transition-colors cursor-pointer","aria-label":"View cost breakdown",children:[o,b.jsx(my,{size:16,strokeWidth:2,className:"text-oai-gray-400 dark:text-oai-gray-500"})]}):b.jsx("span",{className:"text-xl font-bold text-oai-brand",children:o})})]}),F.length>0&&b.jsxs("div",{className:"space-y-6",children:[b.jsx("div",{role:"img","aria-label":`Provider distribution: ${F.map(T=>`${T.label} ${T.totalPercent}%`).join(", ")}`,className:"h-1.5 w-full bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden flex",children:F.map((T,R)=>{const A=Si(T.label,R);return b.jsx(ht.div,{initial:{width:0},animate:{width:`${T.totalPercent}%`},transition:{duration:.6,delay:.3+R*.1},className:"h-full",style:{backgroundColor:A},title:`${T.label}: ${T.totalPercent}%`},T.label)})}),b.jsx("div",{className:"flex flex-wrap gap-3",children:F.map((T,R)=>{const A=Si(T.label,R),E=v===T.label;return b.jsxs("button",{"aria-expanded":E,"aria-controls":`provider-details-${T.label}`,"aria-label":`${T.label}: ${T.totalPercent}%. Click to ${E?"collapse":"expand"} details`,onClick:()=>k(E?null:T.label),className:`flex-1 min-w-[140px] text-left p-3 rounded-lg border transition-colors duration-200 ${E?"border-oai-gray-300 dark:border-oai-gray-600 bg-oai-gray-50 dark:bg-oai-gray-800":"border-oai-gray-200 dark:border-oai-gray-700 hover:border-oai-gray-300 dark:hover:border-oai-gray-600"}`,children:[b.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[b.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:A}}),b.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:T.label})]}),b.jsxs("div",{className:"text-lg font-semibold text-oai-black dark:text-oai-white tabular-nums",children:[T.totalPercent,"%"]}),b.jsxs("div",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:[T.models.length," models"]})]},T.label)})}),v&&b.jsx("div",{id:`provider-details-${v}`,role:"region","aria-label":`${v} model details`,className:"border border-oai-gray-200 dark:border-oai-gray-700 rounded-lg p-4 bg-oai-gray-50/30 dark:bg-oai-gray-800/30 overflow-hidden",children:F.filter(T=>T.label===v).map(T=>{const R=Si(T.label,0),A=[...T.models].sort((E,j)=>(j.share||0)-(E.share||0));return b.jsxs("div",{children:[b.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[b.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:R}}),b.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:T.label}),b.jsxs("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400",children:[T.totalPercent,"%"]})]}),b.jsx("div",{className:"space-y-2",children:A.map(E=>b.jsx("div",{className:"flex items-center gap-3",children:b.jsxs("div",{className:"flex-1 min-w-0",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[b.jsx("span",{className:"text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate",children:E.name}),b.jsxs("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white tabular-nums shrink-0",children:[E.share,"%"]})]}),b.jsx("div",{className:"h-1 bg-oai-gray-200 dark:bg-oai-gray-700 rounded-full overflow-hidden",children:b.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${E.share}%`,backgroundColor:R,opacity:.7}})})]})},E.id||E.name))})]},T.label)})})]})]})})}function sd(e,t){if(!Array.isArray(e)||e.length===0)return 0;if(e.length===1)return e[0];const n=(e.length-1)*t,r=Math.floor(n),s=Math.ceil(n);if(r===s)return e[r];const o=n-r;return e[r]+(e[s]-e[r])*o}function ZD(e){const t=Array.isArray(e)?e.filter(s=>Number.isFinite(s)&&s>0).sort((s,o)=>s-o):[];if(t.length===0)return{rawMax:0,effectiveMax:1,clippedValues:Array.isArray(e)?e.map(()=>0):[]};const n=t.at(-1)??0;let r=n;if(t.length>=4){const s=sd(t,.25),o=sd(t,.75),i=Math.max(o-s,0),a=o+i*1.5;n>a&&(r=Math.max(a,o,1))}return{rawMax:n,effectiveMax:Math.max(r,1),clippedValues:Array.isArray(e)?e.map(s=>!Number.isFinite(s)||s<=0?0:Math.min(s,Math.max(r,1))):[]}}function QD({value:e,displayValue:t,scale:n,index:r,row:s,totalBars:o}){const i=us(),a=n.effectiveMax>0?t/n.effectiveMax*100:0,l=`${Math.max(a,2)}%`,c=s?.missing,u=s?.future,d=o<=7?"6px":o<=14?"4px":"3px";return b.jsx(ht.div,{className:"group relative flex-1 self-stretch",initial:{opacity:0,scaleY:0},animate:{opacity:1,scaleY:1},transition:{duration:i?0:.3,delay:i?0:r*.02,ease:[.25,.1,.25,1]},style:{originY:1},children:b.jsxs("div",{className:"absolute inset-x-0 bottom-0",style:{height:l},children:[b.jsx("div",{"data-trend-bar":"true",className:"h-full w-full cursor-pointer transition-all duration-200 group-hover:brightness-110",style:{minHeight:e>0?"4px":"2px",opacity:c||u?.2:1,borderRadius:`${d} ${d} 0 0`,background:e>0?"#10b981":"var(--oai-gray-100)"},title:`${e.toLocaleString()}`}),b.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-oai-black text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-20",children:e.toLocaleString()})]})})}function JD({rows:e,from:t,to:n,period:r,timeZoneLabel:s,showTimeZoneLabel:o=!0,className:i=""}){const a=Array.isArray(e)&&e.length?e:[],l=a.map(u=>{if(u?.missing||u?.future)return 0;const d=u?.billable_total_tokens??u?.total_tokens??u?.value;if(d==null)return 0;const f=Number(d);return Number.isFinite(f)?f:0}),c=ZD(l);return b.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 ${i}`,children:[b.jsxs("div",{className:"mb-3",children:[b.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:_("trend.monitor.label")}),o&&s&&b.jsx("p",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:s})]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"relative",children:[b.jsx("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none",children:[0,25,50,75,100].map(u=>b.jsx("div",{className:"w-full border-t border-oai-gray-100 dark:border-oai-gray-800",style:{top:`${100-u}%`}},u))}),b.jsx("div",{className:"h-40 flex items-end gap-1 relative z-0",children:l.length>0?l.map((u,d)=>b.jsx(QD,{value:u,displayValue:c.clippedValues[d]??0,scale:c,index:d,row:a[d],totalBars:l.length},d)):b.jsx("div",{className:"flex-1 h-full flex items-center justify-center",children:b.jsx("p",{className:"text-sm text-oai-gray-400 dark:text-oai-gray-400",children:"No data yet"})})})]}),t&&n&&b.jsxs("div",{className:"flex justify-between text-xs text-oai-gray-500 dark:text-oai-gray-300 font-medium pt-2 border-t border-oai-gray-100 dark:border-oai-gray-800",children:[b.jsx("span",{children:t}),b.jsx("span",{children:n})]})]})]})}function e1(e){const{copy:t,screenshotMode:n,publicViewInvalid:r,publicViewInvalidTitle:s,publicViewInvalidBody:o,showExpiredGate:i,showAuthGate:a,screenshotTitleLine1:l,screenshotTitleLine2:c,identityDisplayName:u,identityStartDate:d,activeDays:f,identitySubscriptions:h,identityScrambleDurationMs:p,projectUsageEntries:g,projectUsageLimit:y,setProjectUsageLimit:w,topModels:x,signedIn:v,publicMode:k,shouldShowInstall:S,installPrompt:C,handleCopyInstall:M,installCopied:D,installInitCmdDisplay:F,publicViewTitle:T,handleTogglePublicView:R,publicViewBusy:A,publicViewEnabled:E,publicViewCopyButtonLabel:j,handleCopyPublicView:N,trendRowsForDisplay:V,trendFromForDisplay:U,trendToForDisplay:P,period:I,trendTimeZoneLabel:B,activityHeatmapBlock:W,isCapturing:Q,handleShareToX:Y,screenshotTwitterButton:$,screenshotTwitterHint:z,periodsForDisplay:Z,setSelectedPeriod:ce,customFrom:Se,customTo:Re,onCustomRangeApply:Ee,customRangeOpen:Je,onCustomRangeOpenChange:L,summaryLabel:ue,summaryValue:te,summaryCostValue:Me,summaryConversationsValue:H,rollingUsage:se,costInfoEnabled:ie,openCostModal:me,costModalOpen:ge,closeCostModal:J,allowBreakdownToggle:ne,refreshAll:Ie,usageLoadingState:be,fleetData:_e,hasDetailsActual:Ge,dailyEmptyPrefix:ot,installSyncCmd:Oe,dailyEmptySuffix:ye,detailsColumns:Fe,ariaSortFor:$e,toggleSort:Nt,sortIconFor:kt,pagedDetails:et,dailyBreakdownRows:an,dailyBreakdownColumns:at,dailyBreakdownAriaSortFor:De,dailyBreakdownSortIconFor:Ye,dailyBreakdownDateKey:re,detailsDateKey:G,renderDetailDate:oe,renderDailyBreakdownDate:de,renderDetailCell:xe,DETAILS_PAGED_PERIODS:fe,detailsPageCount:It,detailsPage:wn,setDetailsPage:kn}=e;return b.jsxs(b.Fragment,{children:[b.jsxs(cC,{hideHeader:n,header:null,footer:n?null:null,className:n?"screenshot-mode":"",children:[r?b.jsx("div",{className:"mb-6",children:b.jsx(ko,{title:s,className:"border-oai-gray-200 dark:border-oai-gray-800",children:b.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-0",children:o})})}):null,i||a?null:b.jsx(b.Fragment,{children:b.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[b.jsxs("div",{className:"lg:col-span-4 flex flex-col gap-4 min-w-0",children:[n?b.jsx("div",{className:"flex items-start justify-between gap-4",children:b.jsxs("div",{className:"flex flex-col gap-1",children:[b.jsx("span",{className:"text-3xl md:text-4xl font-semibold text-oai-black dark:text-oai-white tracking-tight leading-none",children:l}),b.jsx("span",{className:"text-2xl md:text-3xl font-semibold text-oai-black dark:text-oai-white tracking-tight leading-none",children:c})]})}):null,b.jsx(VC,{title:t("dashboard.identity.title"),subtitle:t("dashboard.identity.subtitle"),period:I,rankLabel:d??t("identity_card.rank_placeholder"),streakDays:f,subscriptions:h,periodConversations:H,rolling:se,topModels:x}),S?b.jsx(sr,{delay:.25,children:b.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-3",children:[b.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 mb-1.5",children:C}),b.jsxs(ht.button,{onClick:M,whileHover:{scale:1.01},whileTap:{scale:.99},className:"w-full flex items-center justify-between px-3 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 rounded-lg transition-colors",children:[b.jsx("code",{className:"text-xs font-mono text-oai-gray-700 dark:text-oai-gray-300",children:F}),b.jsx(ht.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-oai-brand",children:D?"Copied ✓":"Copy"},D?"copied":"copy")]})]})}):null,!n&&v&&!k?b.jsx(sr,{delay:.3,children:b.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-3 flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(ht.button,{type:"button",onClick:R,disabled:A,whileTap:{scale:.95},className:`relative inline-flex h-4 w-7 items-center px-0.5 transition-colors rounded-full ${E?"bg-oai-brand":"bg-oai-gray-300 dark:bg-oai-gray-600"} disabled:opacity-50`,children:b.jsx(ht.span,{initial:!1,animate:{x:E?12:0},transition:{type:"spring",stiffness:500,damping:30},className:"inline-block h-3 w-3 bg-white rounded-full"})}),b.jsx(ht.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:E?"Public":"Private"},E?"public":"private")]}),b.jsx(ht.button,{onClick:N,disabled:!E||A,whileHover:{scale:E?1.05:1},whileTap:{scale:E?.95:1},className:"text-xs text-oai-brand hover:text-oai-brand-dark disabled:text-oai-gray-300 dark:disabled:text-oai-gray-600 transition-colors",children:j})]})}):null,W&&b.jsx(sr,{delay:.4,children:W}),n?null:b.jsx(JD,{rows:V,from:U,to:P,period:I,timeZoneLabel:B,showTimeZoneLabel:!1}),n?b.jsxs("div",{className:"mt-4 flex flex-col items-center gap-2","data-screenshot-exclude":"true",style:Q?{display:"none"}:void 0,children:[b.jsx(Qr,{type:"button",onClick:Y,variant:"primary",size:"lg",disabled:Q,children:$}),b.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300",children:z})]}):null]}),b.jsxs("div",{className:"lg:col-span-8 flex flex-col gap-4 min-w-0",children:[b.jsx(XD,{period:I,periods:Z,onPeriodChange:ce,summaryLabel:ue,summaryValue:te,summaryCostValue:Me,onCostInfo:ie?me:null,fleetData:_e,onRefresh:n?null:Ie,loading:be,customFrom:Se,customTo:Re,onCustomRangeApply:Ee,customRangeOpen:Je,onCustomRangeOpenChange:L}),n?null:b.jsx(sr,{delay:.5,children:b.jsx(jC,{projectEntries:g,projectLimit:y,onProjectLimitChange:w,copy:t,hasDetailsActual:Ge,dailyEmptyPrefix:ot,installSyncCmd:Oe,dailyEmptySuffix:ye,detailsColumns:Fe,ariaSortFor:$e,toggleSort:Nt,sortIconFor:kt,pagedDetails:et,dailyBreakdownRows:an,dailyBreakdownColumns:at,dailyBreakdownAriaSortFor:De,dailyBreakdownSortIconFor:Ye,dailyBreakdownDateKey:re,detailsDateKey:G,renderDetailDate:oe,renderDailyBreakdownDate:de,renderDetailCell:xe,DETAILS_PAGED_PERIODS:fe,period:I,detailsPageCount:It,detailsPage:wn,setDetailsPage:kn})})]})]})})]}),b.jsx(FC,{isOpen:ge,onClose:J,fleetData:_e})]})}const t1=["day","week","month","total","custom"],Ti=new Set(["day","hour","month"]),Fr=new Set(["day","total","custom"]);function Ci(e,t){if(typeof t=="number"&&t>0)return!0;if(typeof e=="bigint")return e>0n;if(typeof e=="number")return Number.isFinite(e)&&e>0;if(typeof e=="string"){const n=e.trim();if(!n)return!1;if(/^[0-9]+$/.test(n))try{return BigInt(n)>0n}catch{return!1}const r=Number(n);return Number.isFinite(r)&&r>0}return!1}function Is(e){return e?e?.billable_total_tokens??e?.total_tokens:null}function od(e){return e?e?.billable_total_tokens??e?.value??e?.total_tokens:null}function n1(e){if(typeof e!="string"||!e)return null;const t=e.split("-");if(t.length!==3)return null;const n=Number(t[0]),r=Number(t[1])-1,s=Number(t[2]);if(!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(s))return null;const o=new Date(Date.UTC(n,r,s));return Number.isFinite(o.getTime())?o:null}function r1(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function s1(e){return e?e==="www.tokentracker.cc":!1}function o1(){if(typeof window>"u")return!1;const e=new URLSearchParams(window.location.search),t=String(e.get("force_install")||"").toLowerCase();return t!=="1"&&t!=="true"?!1:!s1(window.location.hostname)}function d1({baseUrl:e,auth:t,signedIn:n,sessionSoftExpired:r,signOut:s,publicMode:o=!1,publicToken:i=null,signInUrl:a="/sign-in",signUpUrl:l="/sign-up"}){const[c,u]=m.useState(!1),[d,f]=m.useState(null),[h,p]=m.useState(null),[g,y]=m.useState(!1),[w,x]=m.useState(null),[v,k]=m.useState(0),[S,C]=m.useState(0),[M,D]=m.useState(!1),[F,T]=m.useState(null),[R,A]=m.useState(!1),[E,j]=m.useState(!1),[N,V]=m.useState(!1),[U,P]=m.useState(null),[I,B]=m.useState(null),[W,Q]=m.useState(null),[Y,$]=m.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(max-width: 640px)").matches),z=m.useMemo(()=>typeof window>"u"?!1:Bg(window.location.search),[]),Z=m.useMemo(()=>o1(),[]),[ce,Se]=m.useState(!1),Re=2200,[Ee,Je]=m.useState(!0),[L,ue]=m.useState(!1),[te,Me]=m.useState(!1),[H,se]=m.useState(!1),ie=yr(),me=n&&!r,ge=m.useMemo(()=>me&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,me]),J=me?ge:null,ne=o?$g(i):J,Ie=n||ie||o,be=me&&br(J),_e=n&&r&&!o;m.useEffect(()=>{if(!n||ie){f(null),p(null),y(!1),x(null);return}if(o)return;if(!be){f(null),p(null),y(!1),x(null);return}let O=!0;const K=()=>{f(null),p(null),y(!1),x(null)};return y(!0),x(null),(async()=>{let X=null;try{X=await Wt(J)}catch{X=null}if(O){if(!X){K();return}try{const le=await ny({baseUrl:e,accessToken:X});if(!O)return;f(typeof le?.link_code=="string"?le.link_code:null),p(typeof le?.expires_at=="string"?le.expires_at:null)}catch(le){if(!O)return;f(null),p(null),x(le?.message||"Failed to load link code")}finally{if(!O)return;y(!1)}}})(),()=>{O=!1}},[e,ie,n,o,be,J,S]),m.useEffect(()=>{if(!n||ie||o){D(!1),T(null),A(!1),j(!1),V(!1);return}if(!be){D(!1),T(null),A(!1),j(!1),V(!1);return}let O=!0;return A(!0),(async()=>{let K=null;try{K=await Wt(J)}catch{K=null}if(O){if(!K){D(!1),T(null),A(!1);return}try{const X=await Wl({baseUrl:e,accessToken:K});if(!O)return;const le=!!X?.enabled;D(le),T(X?.share_token||null)}catch{if(!O)return;D(!1),T(null)}finally{if(!O)return;A(!1)}}})(),()=>{O=!1}},[e,ie,n,o,be,J]),m.useEffect(()=>{if(!o){P(null),B(null);return}if(!i){P(null),B(null);return}P(null),B(null);let O=!0;return ry({baseUrl:e,accessToken:i}).then(K=>{O&&(P(typeof K?.display_name=="string"?K.display_name:null),B(typeof K?.avatar_url=="string"?K.avatar_url:null))}).catch(()=>{O&&(P(null),B(null))}),()=>{O=!1}},[e,o,i]);const Ge=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");m.useEffect(()=>{if(!Ge&&(!n||ie||o)){Q(null);return}if(!Ge&&!be){Q(null);return}let O=!0;return(async()=>{let K=null;try{K=await Wt(J)}catch{K=null}if(O){if(!K&&!Ge){Q(null);return}try{const X=await sy({baseUrl:e,accessToken:K});if(!O)return;Q(X&&typeof X=="object"?X:null)}catch{if(!O)return;Q(null)}}})(),()=>{O=!1}},[be,e,J,ie,o,n]);const ot=m.useMemo(()=>{if(!h)return!1;const O=Date.parse(h);if(!Number.isFinite(O))return!1;const K=v||Date.now();return O<=K},[h,v]);m.useEffect(()=>{!n||ie||o||!h||!ot||g||(f(null),p(null),x(null),C(O=>O+1))},[ot,h,g,ie,n]),m.useEffect(()=>{if(!h||o)return;const O=Date.parse(h);if(!Number.isFinite(O))return;const K=Date.now();if(k(K),O<=K)return;const X=window.setTimeout(()=>k(Date.now()),O-K),le=()=>{typeof document>"u"||document.visibilityState==="visible"&&k(Date.now())};return typeof document<"u"&&document.addEventListener("visibilitychange",le),window.addEventListener("focus",le),()=>{window.clearTimeout(X),typeof document<"u"&&document.removeEventListener("visibilitychange",le),window.removeEventListener("focus",le)}},[h]),m.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const O=window.matchMedia("(max-width: 640px)"),K=()=>$(O.matches);return K(),O.addEventListener?(O.addEventListener("change",K),()=>O.removeEventListener("change",K)):(O.addListener(K),()=>O.removeListener(K))},[]);const Oe=m.useMemo(()=>Yg(),[]),ye=m.useMemo(()=>Hg(),[]),Fe=m.useMemo(()=>Ug(),[]),$e=o?null:t?.userId||t?.email||"default",[Nt,kt]=m.useState("month"),[et,an]=m.useState(null),[at,De]=m.useState(null),[Ye,re]=m.useState(!1),G=z?"total":Nt,oe=m.useMemo(()=>G==="custom"&&et&&at?{from:et,to:at}:Gg(G,{timeZone:Oe,offsetMinutes:ye,now:Fe}),[Fe,G,Oe,ye,et,at]),de=oe.from,xe=oe.to,fe=m.useMemo(()=>Kg({timeZone:Oe,offsetMinutes:ye}),[Oe,ye]),It=m.useMemo(()=>zg({timeZone:Oe,offsetMinutes:ye}),[Oe,ye]),wn=m.useMemo(()=>`Local time (${It})`,[It]),kn=Oe,ln=ye,cn=fe,zt=m.useMemo(()=>ia({timeZone:Oe,offsetMinutes:ye,date:Fe||new Date}),[Fe,Oe,ye]),Er=m.useMemo(()=>{const O=n1(zt)||new Date,K=r1(O,-29);return{from:cr(K),to:cr(O)}},[zt]),{daily:Ft,summary:tt,rolling:Sn,source:ps,loading:Co,error:lt,refresh:cl}=zl({baseUrl:e,accessToken:ne,guestAllowed:_e,from:de,to:xe,includeDaily:G!=="total",cacheKey:$e,timeZone:Oe,tzOffsetMinutes:ye,now:Fe}),{daily:ul,loading:rp,refresh:dl}=zl({baseUrl:e,accessToken:ne,guestAllowed:_e,from:Er.from,to:Er.to,includeDaily:!0,cacheKey:$e?`${$e}.daily-breakdown`:"daily-breakdown",timeZone:Oe,tzOffsetMinutes:ye,now:Fe}),{breakdown:Tn,loading:sp,refresh:fl}=mb({baseUrl:e,accessToken:ne,guestAllowed:_e,from:de,to:xe,cacheKey:$e,timeZone:Oe,tzOffsetMinutes:ye}),[hl,op]=m.useState(3),{entries:ip,loading:ap,refresh:ml}=ob({baseUrl:e,accessToken:ne,limit:hl,from:de,to:xe,timeZone:Oe,tzOffsetMinutes:ye}),pl=G==="week"||G==="month",gs=G==="week"||G==="month",gl=m.useMemo(()=>Ft.filter(O=>O?.future?!1:!O?.day||!zt?!0:String(O.day)<=String(zt)),[Ft,zt]),{rows:qt,from:lp,to:cp,loading:up,refresh:yl}=ab({baseUrl:e,accessToken:ne,guestAllowed:_e,period:G,from:de,to:xe,months:24,cacheKey:$e,timeZone:kn,tzOffsetMinutes:ln,now:Fe,sharedRows:pl?Ft:null,sharedRange:pl?{from:de,to:xe}:null}),{daily:Un,heatmap:Xt,loading:bl,refresh:xl}=sb({baseUrl:e,accessToken:ne,guestAllowed:_e,weeks:52,cacheKey:$e,timeZone:Oe,tzOffsetMinutes:ye,now:Fe}),St=m.useMemo(()=>G==="day"?"hour":G==="total"?"month":"day",[G]),dp=m.useMemo(()=>Xl(St),[St]),ys="day",fp=m.useMemo(()=>Xl(ys),[]),[Tt,vl]=m.useState(()=>({key:"day",dir:"desc"}));m.useEffect(()=>{vl(O=>!Ti.has(O.key)||O.key===St?O:{key:St,dir:O.dir})},[St]);const Gn=m.useMemo(()=>Ti.has(Tt.key)&&Tt.key!==St?{...Tt,key:St}:Tt,[St,Tt]),bs=m.useMemo(()=>{if(G==="day")return Array.isArray(qt)?qt.filter(X=>X?.hour&&!X?.future):[];if(G==="total"){const X=Array.isArray(qt)?qt.filter(le=>le?.month&&!le?.future):[];return Mb(X)}const O=gl;return!O.some(X=>!X?.missing&&!X?.future)&&Ft.length>0?Ft.filter(X=>!X?.future).slice(-30).filter(X=>X?.day):O},[G,qt,gl,Ft]),Mr=m.useMemo(()=>Zl(bs,Gn),[bs,Gn]),hp=m.useMemo(()=>bs.some(O=>!O?.missing&&!O?.future),[bs]),Eo=m.useMemo(()=>{if(!Fr.has(G))return 1;const O=Math.ceil(Mr.length/Js);return O>0?O:1},[G,Mr.length]),[Mo,xs]=m.useState(0);m.useEffect(()=>{if(!Fr.has(G)){xs(0);return}xs(O=>Math.min(O,Eo-1))},[Eo,G]),m.useEffect(()=>{Fr.has(G)&&xs(0)},[G,Tt.dir,Tt.key]);const mp=m.useMemo(()=>Fr.has(G)?Db(Mr,Mo,Js):Mr,[Mo,G,Mr]),wl=m.useMemo(()=>ul.filter(O=>!O?.future&&O?.day).slice(-30),[ul]),Kn=m.useMemo(()=>Ti.has(Tt.key)?{...Tt,key:ys}:Tt,[Tt]),pp=m.useMemo(()=>Zl(wl,Kn),[wl,Kn]),gp=m.useMemo(()=>gs?Ft:G==="day"?Array.isArray(qt)?qt.filter(O=>O?.hour):[]:qt,[Ft,G,qt,gs]),yp=gs?de:lp,bp=gs?xe:cp;function xp(O,K){return O?.future?"—":O?.missing?_("shared.status.unsynced"):K==="total_tokens"?Qt(Is(O)):Qt(O?.[K])}function vp(O){const K=O?.[St];if(K==null)return"";const X=String(K);if(St==="hour"){const[le,je]=X.split("T");if(le&&je)return`${le} ${je.slice(0,5)}`}return X}function wp(O){const K=O?.[ys];return K==null?"":String(K)}function kp(O){vl(K=>K.key===O?{key:O,dir:K.dir==="asc"?"desc":"asc"}:{key:O,dir:"desc"})}function Sp(O){return Gn.key!==O?"none":Gn.dir==="asc"?"ascending":"descending"}function Tp(O){return Gn.key!==O?"":Gn.dir==="asc"?"▲":"▼"}function Cp(O){return Kn.key!==O?"none":Kn.dir==="asc"?"ascending":"descending"}function Ep(O){return Kn.key!==O?"":Kn.dir==="asc"?"▲":"▼"}const kl=m.useMemo(()=>{if(!n&&!ie&&!o&&!Ge)return 0;const O=Number(Xt?.active_days);if(Number.isFinite(O))return O;let K=0;const X=new Set,le=(Pe,We,Ke)=>{typeof Pe!="string"||!Pe||X.has(Pe)||Ci(We,Ke)&&(X.add(Pe),K+=1)};if(Array.isArray(Un))for(const Pe of Un)le(Pe?.day,Is(Pe));const je=Array.isArray(Xt?.weeks)?Xt.weeks:[];for(const Pe of je)for(const We of Array.isArray(Pe)?Pe:[]){const Ke=od(We);le(We?.day,Ke,We?.level)}return K},[n,ie,Xt?.active_days,Xt?.weeks,Un]),[Sl,Tl]=m.useState("month"),Mp=m.useCallback(O=>{O==="custom"?(Tl(K=>K==="custom"?"month":K),kt(K=>et&&at?"custom":K),re(!0)):(kt(O),Tl(O),re(!1))},[et,at]),Dp=m.useCallback((O,K)=>{an(O),De(K),kt("custom"),re(!1)},[]),Pp=m.useCallback(O=>{re(O),!O&&Nt==="custom"&&!et&&kt(Sl)},[Nt,et,Sl]),Cl=m.useCallback(async()=>{await Promise.all([cl(),xl(),yl(),fl(),ml(),dl()])},[dl,xl,fl,ml,yl,cl]),Rp=m.useCallback(async()=>{se(!0);try{Ge&&await oy(),await Cl()}catch(O){console.error("[DashboardPage] Refresh failed:",O)}finally{se(!1)}},[Ge,Cl]),Op=H||Co||rp||bl||up||sp||ap,Ap=m.useMemo(()=>_("shared.data_source",{source:String(ps||"edge").toUpperCase()}),[ps]),Np=m.useMemo(()=>{if(!o||!lt)return!1;if((typeof lt=="object"&&lt?lt?.status??lt?.statusCode:null)===401)return!0;const K=typeof lt=="string"?lt:String(lt?.message||lt||"");return/unauthorized|invalid|token|revoked|401/i.test(K)},[o,lt]),vs=m.useMemo(()=>typeof t?.name!="string"?"":t.name.trim(),[t?.name]),El=m.useMemo(()=>typeof U!="string"?"":U.trim(),[U]),Ml=m.useMemo(()=>!vs||vs.includes("@")?_("dashboard.identity.fallback"):vs,[vs]),Dl=m.useMemo(()=>Ml.replace(/[^a-zA-Z0-9._-]/g,"_"),[Ml]),Ip=m.useMemo(()=>o?El||_("dashboard.identity.fallback"):Dl,[Dl,El,o]),Fp=m.useMemo(()=>{let O=null;const K=le=>{typeof le!="string"||!le||(!O||le<O)&&(O=le)};if(Array.isArray(Un))for(const le of Un)le?.day&&Ci(Is(le))&&K(le.day);const X=Array.isArray(Xt?.weeks)?Xt.weeks:[];for(const le of X)for(const je of Array.isArray(le)?le:[]){if(!je?.day)continue;const Pe=od(je),We=je?.level;Ci(Pe,We)&&K(je.day)}return O},[Xt?.weeks,Un]),jp=m.useMemo(()=>o?[]:(Array.isArray(W?.subscriptions?.items)?W.subscriptions.items:[]).map(X=>{const le=typeof X?.tool=="string"?X.tool.trim():"",Pe=(typeof X?.plan_type=="string"?X.plan_type:typeof X?.planType=="string"?X.planType:"").trim();return!le||!Pe?null:{tool:le,planType:Pe,provider:typeof X?.provider=="string"?X.provider.trim():"",product:typeof X?.product=="string"?X.product.trim():"",rateLimitTier:typeof X?.rate_limit_tier=="string"?X.rate_limit_tier.trim():typeof X?.rateLimitTier=="string"?X.rateLimitTier.trim():""}}).filter(Boolean).slice(0,6),[o,W]),Lp=b.jsx(Bb,{heatmap:Xt,timeZoneLabel:fe,timeZoneShortLabel:It,hideLegend:z,defaultToLatestMonth:z}),Vp=m.useMemo(()=>`${de}..${xe}`,[de,G,xe]),_p=_("usage.summary.total"),zn=Is(tt),Pl=_("shared.unit.thousand_abbrev"),Rl=_("shared.unit.million_abbrev"),Ol=_("shared.unit.billion_abbrev"),ws=xt(zn),Al=Y&&ws!=null&&Math.abs(ws)>=1e9,Wp=m.useMemo(()=>Al?pd(ws,{thousandSuffix:Pl,millionSuffix:Rl,billionSuffix:Ol,decimals:1}):Qt(zn),[Ol,Rl,zn,ws,Pl,Al]),Bp=_("dashboard.core_index.collapse_label"),$p=_("dashboard.core_index.expand_label"),Yp=_("dashboard.core_index.collapse_aria"),Hp=_("dashboard.core_index.expand_aria"),Up=!z,Gp=_("dashboard.screenshot.title_line1"),Kp=_("dashboard.screenshot.title_line2"),zp=_("dashboard.screenshot.twitter_label"),qp=_("dashboard.screenshot.twitter_button"),Xp=_("dashboard.screenshot.twitter_hint"),qn=_("shared.placeholder.short"),Do=m.useMemo(()=>{const O=Array.isArray(Tn?.sources)?Tn.sources:[];let K=null,X=0;for(const We of O){const Ke=xt(We?.totals?.billable_total_tokens??We?.totals?.total_tokens);!Number.isFinite(Ke)||Ke<=0||Ke>X&&(X=Ke,K=We)}let le=qn,je=qn,Pe="0.0";if(K&&X>0){le=K?.source?String(K.source).toUpperCase():qn;const We=Array.isArray(K?.models)?K.models:[];let Ke=0;for(const Zt of We){const Pr=xt(Zt?.totals?.billable_total_tokens??Zt?.totals?.total_tokens);!Number.isFinite(Pr)||Pr<=0||Pr>Ke&&(Ke=Pr,je=Zt?.model?String(Zt.model):qn)}Ke>0&&(Pe=(Ke/X*100).toFixed(1))}return{agentName:le,modelName:je,modelPercent:Pe}},[Tn,qn]),Nl=Qt(zn),Il=_("dashboard.screenshot.twitter_text",{total_tokens:Nl==="-"?qn:Nl,agent_name:Do.agentName,model_name:Do.modelName,model_percent:Do.modelPercent}),Po=m.useMemo(()=>{if(typeof window>"u")return"";const O=new URL("https://twitter.com/intent/tweet");return O.searchParams.set("text",Il),O.toString()},[Il]),Fl=m.useCallback(async()=>{if(typeof window>"u")return null;const O=async()=>{const We=performance.now();for(;performance.now()-We<2e3;){const Ke=document.querySelector("[data-heatmap-scroll='true']");if(!Ke||Ke.dataset.latestMonthReady==="true")return;await new Promise(Zt=>requestAnimationFrame(Zt))}},K=document.querySelector("#root")||document.body,X=document.documentElement,{scrollWidth:le,scrollHeight:je}=document.documentElement;X?.classList.add("screenshot-capture"),document.body?.classList.add("screenshot-capture"),await new Promise(Pe=>requestAnimationFrame(Pe)),await O();try{const{toBlob:Pe,toPng:We}=await qg(async()=>{const{toBlob:Cn,toPng:Ag}=await import("./index-BeoRn2gJ.js");return{toBlob:Cn,toPng:Ag}},[]),Ke=await Pe(K,{backgroundColor:"#050505",pixelRatio:2,cacheBust:!0,width:le,height:je,style:{width:`${le}px`,height:`${je}px`},filter:Cn=>!(Cn instanceof HTMLElement)||Cn.dataset?.screenshotExclude!=="true"});if(Ke)return Ke;const Zt=await We(K,{backgroundColor:"#050505",pixelRatio:2,cacheBust:!0,width:le,height:je,style:{width:`${le}px`,height:`${je}px`},filter:Cn=>!(Cn instanceof HTMLElement)||Cn.dataset?.screenshotExclude!=="true"});return Zt?await(await fetch(Zt)).blob():null}finally{X?.classList.remove("screenshot-capture"),document.body?.classList.remove("screenshot-capture")}},[]),Zp=m.useCallback(async()=>{if(typeof window>"u"||ce)return;Se(!0);const O=navigator?.userAgent||"",K=/iP(hone|od|ad)/i.test(O),X=/Safari/i.test(O)&&!/Chrome|Chromium|Edg|OPR|CriOS|FxiOS/i.test(O),le=typeof navigator<"u"&&!!navigator.clipboard?.write&&typeof window<"u"&&!!window.ClipboardItem;let Pe=!le||K||X;try{const We=await Fl();We&&le&&(typeof document<"u"&&!document.hasFocus()&&window.focus?.(),Pe=await Xg(We))}catch(We){console.error("Failed to capture screenshot",We)}finally{if(Se(!1),!Pe){console.warn("Failed to write screenshot to clipboard.");return}Po&&(window.location.href=Po)}},[Fl,ce,Po]),Qp=m.useMemo(()=>z?[]:t1,[z]),Jp=m.useMemo(()=>[{label:_("usage.metric.total"),value:Qt(zn),valueClassName:"text-white"},{label:_("usage.metric.input"),value:Qt(tt?.input_tokens)},{label:_("usage.metric.output"),value:Qt(tt?.output_tokens)},{label:_("usage.metric.cached_input"),value:Qt(tt?.cached_input_tokens)},{label:_("usage.metric.reasoning_output"),value:Qt(tt?.reasoning_output_tokens)}],[tt?.cached_input_tokens,tt?.input_tokens,tt?.output_tokens,tt?.reasoning_output_tokens,zn]),Ro=m.useMemo(()=>{const O=ca(tt?.total_cost_usd);return!O||O==="-"||O.startsWith("$")?O:`$${O}`},[tt?.total_cost_usd]),eg=m.useMemo(()=>tt?.conversation_count??null,[tt?.conversation_count]),jl=m.useMemo(()=>Ob(Tn,{copyFn:_}),[Tn]),tg=m.useMemo(()=>Ab(Tn,{limit:3,copyFn:_}),[Tn]),ng=m.useCallback(()=>u(!0),[]),rg=m.useCallback(()=>u(!1),[]),sg=Ro&&Ro!=="-"&&jl.length>0,Dr=_("dashboard.install.cmd.init"),Oo=ot?null:d,Ao=Oo?_("dashboard.install.cmd.init_link_code",{link_code:Oo}):Dr,og=Dr,ig=_("dashboard.install.cmd.sync"),ag=Oo?_("dashboard.install.copy"):_("dashboard.install.copy_base"),lg=_("dashboard.install.copied");_("dashboard.session_expired.copy_label"),_("dashboard.session_expired.copied");const cg=!!(W?.install?.has_active_device_token??W?.install?.hasActiveDeviceToken),ug=Pb({publicMode:o,screenshotMode:z,forceInstall:Z,accessEnabled:Ie,heatmapLoading:bl,activeDays:kl,hasActiveDeviceToken:cg}),dg=_("dashboard.install.prompt"),fg=_("dashboard.public_view.title"),hg=_("dashboard.public_view.status.enabled"),mg=_("dashboard.public_view.status.disabled"),pg=_("dashboard.public_view.action.copy"),gg=_("dashboard.public_view.action.copied"),yg=_("dashboard.public_view.action.enable"),bg=_("dashboard.public_view.action.disable"),xg=_("dashboard.public_view.invalid.title"),vg=_("dashboard.public_view.invalid.body"),wg=R||E,kg=M?hg:mg,Ll=m.useMemo(()=>!F||typeof window>"u"?"":new URL(`/share/${F}`,window.location.origin).toString(),[F]),Sg=N?gg:pg,Tg=M?bg:yg,Cg=m.useCallback(async()=>{!Ao||!await Io(Ao)||(ue(!0),window.setTimeout(()=>ue(!1),2e3))},[Ao]);m.useCallback(async()=>{!Dr||!await Io(Dr)||(Me(!0),window.setTimeout(()=>Me(!1),2e3))},[Dr]);const Eg=m.useCallback(async()=>{if(E||!M)return;let O=Ll;if(!O){j(!0);try{const X=await Wt(J);if(!X){j(!1);return}const le=await Wl({baseUrl:e,accessToken:X}),je=typeof le?.share_token=="string"?le.share_token:null;T(je),je&&typeof window<"u"&&(O=new URL(`/share/${je}`,window.location.origin).toString())}catch{}finally{j(!1)}}!O||!await Io(O)||(V(!0),window.setTimeout(()=>V(!1),2e3))},[J,e,E,M,Ll]),Mg=m.useCallback(async()=>{if(!E){V(!1),j(!0);try{const O=await Wt(J);if(!O){j(!1);return}const X=await iy({baseUrl:e,accessToken:O,enabled:!M}),le=!!X?.enabled;D(le),T(X?.share_token||null)}catch{}finally{j(!1)}}},[J,e,E,M]),No=m.useMemo(()=>_("dashboard.daily.empty",{cmd:"{{cmd}}"}),[]),[Dg,Pg]=m.useMemo(()=>{const O=No.split("{{cmd}}");return O.length===1?[No,""]:[O[0],O.slice(1).join("{{cmd}}")]},[No]),Rg=r&&!o,Og=!n&&!ie&&!r&&!Ge&&!o;return b.jsx(e1,{copy:_,screenshotMode:z,publicViewInvalid:Np,publicViewInvalidTitle:xg,publicViewInvalidBody:vg,showExpiredGate:Rg,showAuthGate:Og,screenshotTitleLine1:Gp,screenshotTitleLine2:Kp,identityDisplayName:Ip,identityStartDate:Fp,activeDays:kl,identitySubscriptions:jp,identityScrambleDurationMs:Re,projectUsageEntries:ip,projectUsageLimit:hl,setProjectUsageLimit:op,topModels:tg,signedIn:n,publicMode:o,shouldShowInstall:ug,installPrompt:dg,handleCopyInstall:Cg,installCopied:L,installCopiedLabel:lg,installCopyLabel:ag,installInitCmdDisplay:og,linkCodeLoading:g,linkCodeError:w,publicViewTitle:fg,handleTogglePublicView:Mg,publicViewBusy:wg,publicViewEnabled:M,publicViewToggleLabel:Tg,publicViewStatusLabel:kg,publicViewCopyButtonLabel:Sg,handleCopyPublicView:Eg,trendRowsForDisplay:gp,trendFromForDisplay:yp,trendToForDisplay:bp,period:G,trendTimeZoneLabel:cn,activityHeatmapBlock:Lp,isCapturing:ce,handleShareToX:Zp,screenshotTwitterLabel:zp,screenshotTwitterButton:qp,screenshotTwitterHint:Xp,periodsForDisplay:Qp,setSelectedPeriod:Mp,customFrom:et,customTo:at,onCustomRangeApply:Dp,customRangeOpen:Ye,onCustomRangeOpenChange:Pp,metricsRows:Jp,summaryLabel:_p,summaryValue:Wp,summaryCostValue:Ro,summaryConversationsValue:eg,rollingUsage:Sn,costInfoEnabled:sg,openCostModal:ng,allowBreakdownToggle:Up,coreIndexCollapsed:Ee,setCoreIndexCollapsed:Je,coreIndexCollapseLabel:Bp,coreIndexExpandLabel:$p,coreIndexCollapseAria:Yp,coreIndexExpandAria:Hp,refreshAll:Rp,usageLoadingState:Op,usageError:lt,rangeLabel:Vp,timeZoneRangeLabel:wn,usageSourceLabel:Ap,fleetData:jl,hasDetailsActual:hp,dailyEmptyPrefix:Dg,installSyncCmd:ig,dailyEmptySuffix:Pg,detailsColumns:dp,ariaSortFor:Sp,toggleSort:kp,sortIconFor:Tp,pagedDetails:mp,dailyBreakdownRows:pp,dailyBreakdownColumns:fp,dailyBreakdownAriaSortFor:Cp,dailyBreakdownSortIconFor:Ep,dailyBreakdownDateKey:ys,detailsDateKey:St,renderDetailDate:vp,renderDailyBreakdownDate:wp,renderDetailCell:xp,DETAILS_PAGED_PERIODS:Fr,detailsPageCount:Eo,detailsPage:Mo,setDetailsPage:xs,costModalOpen:c,closeCostModal:rg})}export{d1 as DashboardPage};