tokentracker-cli 0.3.9 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dashboard/dist/assets/DashboardPage-CSL_afwz.js +20 -0
- package/dashboard/dist/assets/{LandingExtras-B9IdYCfA.js → LandingExtras-C8i8_OxM.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-DW7CMnjR.js → LeaderboardPage-T8OluU3F.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-mAuhFhYv.js → LeaderboardProfilePage-D5ICOqlT.js} +1 -1
- package/dashboard/dist/assets/{MatrixRain-Bfjc_8I0.js → MatrixRain-DNKwhCXo.js} +1 -1
- package/dashboard/dist/assets/{MatrixShell-BpQQnI5A.js → MatrixShell-BZu61EY7.js} +1 -1
- package/dashboard/dist/assets/main-CmTD1xm_.css +1 -0
- package/dashboard/dist/assets/{main-DFYFVRqg.js → main-DGPBnxuf.js} +4 -4
- package/dashboard/dist/assets/{vibeusage-api-BGa0zUOb.js → vibeusage-api-BpxQVR5V.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/dashboard/dist/assets/DashboardPage-4iRwUaHk.js +0 -12
- package/dashboard/dist/assets/main-ByQlanyj.css +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{r as h,u as bn,i as _g,a as rt,g as Wg,b as yr,c as br,d as Bt,e as Oi,f as Ts,h as go,j as da,k as cr,t as xt,l as _,T as Bg,m as y,n as Te,o as $n,p as hd,q as md,s as he,N as pd,v as ts,w as ns,x as pn,y as Le,z as Hr,E as jn,A as $g,B as on,C as Yl,D as dt,F as gd,G as vt,H as At,I as mn,J as or,K as Ae,L as an,M as Hl,O as fa,P as ha,Q as ur,R as In,S as Yg,U as yd,V as Hg,W as rs,X as yo,Y as bd,Z as Ug,_ as xd,$ as Gg,a0 as vd,a1 as wd,a2 as q,a3 as ma,a4 as kd,a5 as Kg,a6 as zg,a7 as qg,a8 as Xg,a9 as Zg,aa as Qg,ab as Jg,ac as ey,ad as Jt,ae as ty,af as ny,ag as Vo}from"./main-DGPBnxuf.js";import{g as ry,a as pa,b as sy,c as oy,d as iy,e as _o,f as ay,r as ly,h as Ul,i as cy,j as uy,t as dy,s as fy}from"./vibeusage-api-BpxQVR5V.js";const hy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),my=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Gl=e=>{const t=my(e);return t.charAt(0).toUpperCase()+t.slice(1)},Sd=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),py=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var gy={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 yy=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...a},l)=>h.createElement("svg",{ref:l,...gy,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Sd("lucide",s),...!o&&!py(a)&&{"aria-hidden":"true"},...a},[...i.map(([c,u])=>h.createElement(c,u)),...Array.isArray(o)?o:[o]]));const by=(e,t)=>{const n=h.forwardRef(({className:r,...s},o)=>h.createElement(yy,{ref:o,iconNode:t,className:Sd(`lucide-${hy(Gl(e))}`,`lucide-${e}`,r),...s}));return n.displayName=Gl(e),n};const xy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],vy=by("info",xy),wy=500,ky={style:{transition:"none"}},Td="data-base-ui-click-trigger",Sy={fallbackAxisSide:"end"},Ty={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Cy=[];function ga(e){h.useEffect(e,Cy)}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 _n(){const e=bn(gn.create).current;return ga(e.disposeEffect),e}function Yn(e){return e?.ownerDocument||document}const xr=typeof navigator<"u",Wo=Py(),Cd=Oy(),Ed=Ry(),Ey=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Md=Wo.platform==="MacIntel"&&Wo.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Wo.platform),My=xr&&/apple/i.test(navigator.vendor),Ai=xr&&/android/i.test(Cd)||/android/i.test(Ed);xr&&Cd.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const Dy=Ed.includes("jsdom/");function Py(){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 Ry(){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 Oy(){if(!xr)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const Ni="data-base-ui-focusable",Dd="active",Pd="selected",Rd="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Jn(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&&_g(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function ft(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 Ay(e){return e.matches("html,body")}function qe(e){return e?.ownerDocument||document}function Od(e){return rt(e)&&e.matches(Rd)}function Kl(e){return e?e.getAttribute("role")==="combobox"&&Od(e):!1}function ji(e){return e?e.hasAttribute(Ni)?e:e.querySelector(`[${Ni}]`)||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 zl(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 Ny(e){e.preventDefault(),e.stopPropagation()}function jy(e){return"nativeEvent"in e}function Iy(e){return e.mozInputSource===0&&e.isTrusted?!0:Ai&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Fy(e){return Dy?!1:!Ai&&e.width===0&&e.height===0||Ai&&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 Ad(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const Ly=["top","right","bottom","left"],fr=Math.min,ht=Math.max,Xs=Math.round,Cs=Math.floor,Ut=e=>({x:e,y:e}),Vy={left:"right",right:"left",bottom:"top",top:"bottom"};function Ii(e,t,n){return ht(e,fr(t,n))}function rn(e,t){return typeof e=="function"?e(t):e}function at(e){return e.split("-")[0]}function xn(e){return e.split("-")[1]}function ya(e){return e==="x"?"y":"x"}function ba(e){return e==="y"?"height":"width"}function yt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function xa(e){return ya(yt(e))}function _y(e,t,n){n===void 0&&(n=!1);const r=xn(e),s=xa(e),o=ba(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Zs(i)),[i,Zs(i)]}function Wy(e){const t=Zs(e);return[Fi(e),t,Fi(t)]}function Fi(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ql=["left","right"],Xl=["right","left"],By=["top","bottom"],$y=["bottom","top"];function Yy(e,t,n){switch(e){case"top":case"bottom":return n?t?Xl:ql:t?ql:Xl;case"left":case"right":return t?By:$y;default:return[]}}function Hy(e,t,n,r){const s=xn(e);let o=Yy(at(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(Fi)))),o}function Zs(e){const t=at(e);return Vy[t]+e.slice(t.length)}function Uy(e){return{top:0,right:0,bottom:0,left:0,...e}}function Nd(e){return typeof e!="number"?Uy(e):{top:e,right:e,bottom:e,left:e}}function Qs(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 Gy=["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] *)"],Js=Gy.join(","),jd=typeof Element>"u",hr=jd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,eo=!jd&&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},to=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]"):to(t.parentNode));return i},Ky=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Id=function(t,n,r){if(to(t))return[];var s=Array.prototype.slice.apply(t.querySelectorAll(Js));return n&&hr.call(t,Js)&&s.unshift(t),s=s.filter(r),s},no=function(t,n,r){for(var s=[],o=Array.from(t);o.length;){var i=o.shift();if(!to(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=no(l,!0,r);r.flatten?s.push.apply(s,c):s.push({scopeParent:i,candidates:c})}else{var u=hr.call(i,Js);u&&r.filter(i)&&(n||!t.includes(i))&&s.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),f=!to(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&f){var m=no(d===!0?i.children:d.children,!0,r);r.flatten?s.push.apply(s,m):s.push({scopeParent:i,candidates:m})}else o.unshift.apply(o,i.children)}}return s},Fd=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Ld=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Ky(t))&&!Fd(t)?0:t.tabIndex},zy=function(t,n){var r=Ld(t);return r<0&&n&&!Fd(t)?0:r},qy=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Vd=function(t){return t.tagName==="INPUT"},Xy=function(t){return Vd(t)&&t.type==="hidden"},Zy=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Qy=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Jy=function(t){if(!t.name)return!0;var n=t.form||eo(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=Qy(s,t.form);return!o||o===t},eb=function(t){return Vd(t)&&t.type==="radio"},tb=function(t){return eb(t)&&!Jy(t)},nb=function(t){var n,r=t&&eo(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=eo(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},Zl=function(t){var n=t.getBoundingClientRect(),r=n.width,s=n.height;return r===0&&s===0},rb=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=eo(t);if(c&&!c.shadowRoot&&s(c)===!0)return Zl(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=l}if(nb(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Zl(t);return!1},sb=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},Li=function(t,n){return!(n.disabled||Xy(n)||rb(n,t)||Zy(n)||sb(n))},Vi=function(t,n){return!(tb(n)||Ld(n)<0||!Li(t,n))},ob=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},_d=function(t){var n=[],r=[];return t.forEach(function(s,o){var i=!!s.scopeParent,a=i?s.scopeParent:s,l=zy(a,i),c=i?_d(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(qy).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=no([t],n.includeContainer,{filter:Vi.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ob}):r=Id(t,n.includeContainer,Vi.bind(null,n)),_d(r)},ib=function(t,n){n=n||{};var r;return n.getShadowRoot?r=no([t],n.includeContainer,{filter:Li.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Id(t,n.includeContainer,Li.bind(null,n)),r},Wd=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return hr.call(t,Js)===!1?!1:Vi(n,t)};const vr=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Bd(e,t){const n=ss(e,vr()),r=n.length;if(r===0)return;const s=Jn(qe(e)),o=n.indexOf(s),i=o===-1?t===1?0:r-1:o+t;return n[i]}function va(e){return Bd(qe(e).body,1)||e}function $d(e){return Bd(qe(e).body,-1)||e}function Yd(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 ab(e){return Yd(e,1)}function lb(e){return Yd(e,-1)}function ir(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!we(n,r)}function cb(e){ss(e,vr()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Ql(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 ub({baseUrl:e,accessToken:t,guestAllowed:n=!1,weeks:r=52,weekStartsOn:s="sun",cacheKey:o,timeZone:i,tzOffsetMinutes:a,now:l}={}){const c=h.useMemo(()=>Wg({weeks:r,weekStartsOn:s,now:l}),[l,r,s]),[u,d]=h.useState([]),[f,m]=h.useState(null),[p,g]=h.useState("edge"),[b,w]=h.useState(!1),[x,v]=h.useState(null),k=yr(),S=br(t),C=!n,D=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),E=h.useMemo(()=>{if(!o)return null;const I=go({timeZone:i,offsetMinutes:a});return`vibeusage.heatmap.${o}.${r}.${s}.${I}`},[o,i,a,r,s]),O=h.useCallback(()=>{if(!E||typeof window>"u")return null;try{const I=window.localStorage.getItem(E);if(!I)return null;const j=JSON.parse(I);return!j||!j.heatmap?null:j}catch{return null}},[E]),T=h.useCallback(I=>{if(!(!E||typeof window>"u"))try{window.localStorage.setItem(E,JSON.stringify(I))}catch{}},[E]),R=h.useCallback(()=>{if(!(!E||typeof window>"u"))try{window.localStorage.removeItem(E)}catch{}},[E]),A=h.useCallback(async()=>{const I=await Bt(t);if(!(!I&&!k&&!D)){w(!0),v(null);try{try{const P=await ry({baseUrl:e,accessToken:I,weeks:r,to:c.to,weekStartsOn:s,timeZone:i,tzOffsetMinutes:a}),F=Array.isArray(P?.weeks)?P.weeks:[];if(!F.length&&C){const B=O();if(B?.heatmap){m(B.heatmap),d(B.daily||[]),g("cache");return}}if(!F.some(B=>(Array.isArray(B)?B:[]).some(Q=>Q&&Number.isFinite(Number(Q.level))))&&F.length){const B=[];for(const Y of F)for(const $ of Array.isArray(Y)?Y:[])$?.day&&B.push({day:$.day,total_tokens:$.total_tokens??$.value??0,billable_total_tokens:$.billable_total_tokens??$.value??$.total_tokens??0});const Q=Oi({dailyRows:B,weeks:r,to:P?.to||c.to,weekStartsOn:s});d(B),m({...Q,week_starts_on:s,active_days:B.filter(Y=>Number(Y?.billable_total_tokens??Y?.total_tokens)>0).length,streak_days:Ts({dailyRows:B,to:P?.to||c.to})}),g("client"),C?T({heatmap:{...Q,week_starts_on:s,active_days:B.filter(Y=>Number(Y?.billable_total_tokens??Y?.total_tokens)>0).length,streak_days:Ts({dailyRows:B,to:P?.to||c.to})},daily:B,fetchedAt:new Date().toISOString()}):R();return}m(P||null),d([]),g("edge"),P&&C?T({heatmap:P,daily:[],fetchedAt:new Date().toISOString()}):C||R();return}catch(P){const F=P,W=F?.status??F?.statusCode;if(W===401||W===403)throw P}const j=await pa({baseUrl:e,accessToken:I,from:c.from,to:c.to,timeZone:i,tzOffsetMinutes:a}),V=Array.isArray(j?.data)?j.data:[];d(V);const U=Oi({dailyRows:V,weeks:r,to:c.to,weekStartsOn:s});m({...U,week_starts_on:s,active_days:V.filter(P=>Number(P?.billable_total_tokens??P?.total_tokens)>0).length,streak_days:Ts({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:Ts({dailyRows:V,to:c.to})},daily:V,fetchedAt:new Date().toISOString()}):R()}catch(j){if(C){const V=O();if(V?.heatmap)m(V.heatmap),d(V.daily||[]),g("cache"),v(null);else{const U=j;v(U?.message||String(U)),d([]),m(null),g("edge")}}else{const V=j;v(V?.message||String(V)),d([]),m(null),g("edge")}}finally{w(!1)}}},[t,e,k,n,C,c.from,c.to,O,S,i,a,s,r,R,T,D]);return h.useEffect(()=>{if(!S&&!n&&!k&&!D){d([]),w(!1),v(null),m(null),g("edge");return}if(!C)R(),d([]),v(null),m(null),g("edge");else{const I=O();I?.heatmap&&(m(I.heatmap),d(I.daily||[]),g("cache"))}A()},[t,k,O,A,S,n,C,R,D]),{range:c,daily:u,heatmap:f,source:k?"mock":p==="client"?"edge":p,loading:b,error:x,refresh:A}}function db({baseUrl:e,accessToken:t,limit:n=3,from:r,to:s,source:o,timeZone:i,tzOffsetMinutes:a}={}){const[l,c]=h.useState([]),[u,d]=h.useState(!1),[f,m]=h.useState(null),p=yr(),g=br(t),b=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),w=h.useCallback(async()=>{const x=await Bt(t);if(!x&&!p&&!b){c([]),m(null),d(!1);return}d(!0),m(null);try{const v=await sy({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);m(k),c([])}finally{d(!1)}},[t,e,r,n,p,o,i,s,a,b]);return h.useEffect(()=>{if(!g&&!p&&!b){c([]),m(null),d(!1);return}w()},[p,w,g,b]),{entries:l,loading:u,error:f,refresh:w}}const fb=24;function hb({baseUrl:e,accessToken:t,guestAllowed:n=!1,period:r,from:s,to:o,months:i=fb,cacheKey:a,timeZone:l,tzOffsetMinutes:c,now:u,sharedRows:d,sharedRange:f}={}){const[m,p]=h.useState([]),[g,b]=h.useState(()=>({from:s,to:o})),[w,x]=h.useState("edge"),[v,k]=h.useState(null),[S,C]=h.useState(!1),[D,E]=h.useState(null),O=yr(),T=br(t),R=!n,A=Array.isArray(d),M=f?.from||s,I=f?.to||o,j=h.useMemo(()=>r==="day"?"hourly":r==="total"?"monthly":"daily",[r]),V=(()=>{if(!a)return null;const Y=mb(e)||"default",$=go({timeZone:l,offsetMinutes:c});if(j==="hourly")return`vibeusage.trend.${a}.${Y}.hourly.${o||s||"day"}.${$}`;if(j==="monthly")return`vibeusage.trend.${a}.${Y}.monthly.${i}.${o||"today"}.${$}`;const z=`${s||""}.${o||""}`;return`vibeusage.trend.${a}.${Y}.daily.${z}.${$}`})(),U=h.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=h.useCallback(Y=>{if(!(!V||typeof window>"u"))try{window.localStorage.setItem(V,JSON.stringify(Y))}catch{}},[V]),F=h.useCallback(()=>{if(!(!V||typeof window>"u"))try{window.localStorage.removeItem(V)}catch{}},[V]),W=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),B=h.useCallback(async()=>{if(A){p(Array.isArray(d)?d:[]),b({from:M,to:I}),x("shared"),k(null),C(!1),E(null);return}const Y=await Bt(t);if(!(!Y&&!O&&!W)){C(!0),E(null);try{let $;j==="hourly"?$=await oy({baseUrl:e,accessToken:Y,day:o||s,timeZone:l,tzOffsetMinutes:c}):j==="monthly"?$=await iy({baseUrl:e,accessToken:Y,months:i,to:o,timeZone:l,tzOffsetMinutes:c}):$=await pa({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:[];j==="daily"?ce=$o(ce,z||s,Z||o,{timeZone:l,offsetMinutes:c,now:u}):j==="hourly"?ce=Yo(ce,{timeZone:l,offsetMinutes:c,now:u}):j==="monthly"&&(ce=Ho(ce,{timeZone:l,offsetMinutes:c,now:u}));const Se=new Date().toISOString();p(ce),b({from:z,to:Z}),x("edge"),k(Se),R?P({rows:ce,from:z,to:Z,mode:j,fetchedAt:Se}):F()}catch($){if(R){const z=U();if(z?.rows){let Z=j==="daily"?$o(z.rows||[],z.from||s,z.to||o,{timeZone:l,offsetMinutes:c,now:u}):Array.isArray(z.rows)?z.rows:[];j==="hourly"?Z=Yo(Z,{timeZone:l,offsetMinutes:c,now:u}):j==="monthly"&&(Z=Ho(Z,{timeZone:l,offsetMinutes:c,now:u})),p(Z),b({from:z.from||s,to:z.to||o}),x("cache"),k(z.fetchedAt||null),E(null)}else{p([]),b({from:s,to:o}),x("edge"),k(null);const Z=$;E(Z?.message||String(Z))}}else{p([]),b({from:s,to:o}),x("edge"),k(null);const z=$;E(z?.message||String(z))}}finally{C(!1)}}},[t,e,s,O,n,R,j,i,U,T,A,M,d,I,l,o,c,u,F,P,W]);h.useEffect(()=>{if(A){p(Array.isArray(d)?d:[]),b({from:M,to:I}),x("shared"),k(null),C(!1),E(null);return}if(!T&&!n&&!O&&!W){p([]),b({from:s,to:o}),E(null),C(!1),x("edge"),k(null);return}if(!R)F(),p([]),b({from:s,to:o}),E(null),x("edge"),k(null);else{const Y=U();if(Y?.rows){let $=j==="daily"?$o(Y.rows||[],Y.from||s,Y.to||o,{timeZone:l,offsetMinutes:c,now:u}):Array.isArray(Y.rows)?Y.rows:[];j==="hourly"?$=Yo($,{timeZone:l,offsetMinutes:c,now:u}):j==="monthly"&&($=Ho($,{timeZone:l,offsetMinutes:c,now:u})),p($),b({from:Y.from||s,to:Y.to||o}),x("cache"),k(Y.fetchedAt||null)}}B()},[t,O,U,B,A,M,d,I,T,n,R,F,W]);const Q=O?"mock":w;return{rows:m,from:g.from||s,to:g.to||o,source:Q,fetchedAt:v,loading:S,error:D,refresh:B}}function mb(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 pb(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=da({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 m=[];for(let p=i;p<=a;p=pb(p,1)){const g=cr(p),b=f.get(g),w=p.getTime()>d;if(b){m.push({...b,missing:!1,future:w});continue}m.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 m}function Yo(e,{timeZone:t,offsetMinutes:n,now:r}={}){if(!Array.isArray(e))return[];const s=Hd({timeZone:t,offsetMinutes:n,now:r});return s?e.map(o=>{const i=o?.hour||o?.label||"",a=gb(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 Ho(e,{timeZone:t,offsetMinutes:n,now:r}={}){if(!Array.isArray(e))return[];const s=Hd({timeZone:t,offsetMinutes:n,now:r});return s?e.map(o=>{const i=o?.month||o?.label||"",a=yb(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 Hd({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),{}),m=Number(f.year),p=Number(f.month),g=Number(f.day),b=Number(f.hour),w=Number(f.minute);if(Number.isFinite(m)&&Number.isFinite(p)&&Number.isFinite(g)&&Number.isFinite(b)&&Number.isFinite(w)){const x=b*2+(w>=30?1:0);return{year:m,month:p,day:g,hour:b,minute:w,dayNum:m*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,m=u.getUTCDate(),p=u.getUTCHours(),g=u.getUTCMinutes(),b=p*2+(g>=30?1:0);return{year:d,month:f,day:m,hour:p,minute:g,dayNum:d*1e4+f*100+m,slot:b}}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 gb(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 yb(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 Jl({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]=h.useState([]),[f,m]=h.useState(null),[p,g]=h.useState(null),[b,w]=h.useState("edge"),[x,v]=h.useState(null),[k,S]=h.useState(!1),[C,D]=h.useState(null),E=yr(),O=br(t),T=!n,R=(()=>{if(!i)return null;const P=bb(e)||"default",F=o?"daily":"summary",W=go({timeZone:a,offsetMinutes:l});return`vibeusage.usage.${i}.${P}.${r}.${s}.${F}.${W}`})(),A=h.useCallback(()=>{if(!R||typeof window>"u")return null;try{const P=window.localStorage.getItem(R);if(!P)return null;const F=JSON.parse(P);return!F||!F.summary?null:F}catch{return null}},[R]),M=h.useCallback(P=>{if(!(!R||typeof window>"u"))try{window.localStorage.setItem(R,JSON.stringify(P))}catch{}},[R]),I=h.useCallback(()=>{if(!(!R||typeof window>"u"))try{window.localStorage.removeItem(R)}catch{}},[R]),j=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),V=h.useCallback(async()=>{const P=await Bt(t);if(!(!P&&!E&&!j)){S(!0),D(null);try{let F=null,W=null;if(o){const[z,Z]=await Promise.allSettled([pa({baseUrl:e,accessToken:P,from:r,to:s,timeZone:a,tzOffsetMinutes:l}),_o({baseUrl:e,accessToken:P,from:r,to:s,timeZone:a,tzOffsetMinutes:l,rolling:!0})]);if(z.status==="rejected")throw z.reason;F=z.value,W=Z.status==="fulfilled"?Z.value:null}else W=await _o({baseUrl:e,accessToken:P,from:r,to:s,timeZone:a,tzOffsetMinutes:l,rolling:!0});let B=o&&Array.isArray(F?.data)?F.data:[];o&&(B=Go(B,r,s,{timeZone:a,offsetMinutes:l,now:c}));let Q=W?.totals||F?.summary?.totals||null,Y=W?.rolling||F?.summary?.rolling||null;if(o&&!Q&&!W)try{const z=await _o({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(B),m(Q),g(Y),w("edge"),v($),Q&&T?M({summary:Q,rolling:Y,daily:B,from:r,to:s,includeDaily:o,fetchedAt:$}):T||I()}catch(F){if(T){const W=A();if(W?.summary){m(W.summary),g(W.rolling||null);const B=Array.isArray(W.daily)?W.daily:[],Q=o?Go(B,W.from||r,W.to||s,{timeZone:a,offsetMinutes:l,now:c}):B;d(Q),w("cache"),v(W.fetchedAt||null),D(null)}else{const B=F;D(B?.message||String(B)),d([]),m(null),g(null),w("edge"),v(null)}}else{const W=F;D(W?.message||String(W)),d([]),m(null),g(null),w("edge"),v(null)}}finally{S(!1)}}},[t,e,r,o,E,n,T,c,A,O,a,s,l,I,M,j]);return h.useEffect(()=>{const P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!O&&!n&&!E&&!P){d([]),m(null),g(null),D(null),S(!1),w("edge"),v(null);return}if(!T)I(),d([]),m(null),g(null),D(null),w("edge"),v(null);else{const F=A();if(F?.summary){m(F.summary),g(F.rolling||null);const W=Array.isArray(F.daily)?F.daily:[],B=o?Go(W,F.from||r,F.to||s,{timeZone:a,offsetMinutes:l,now:c}):W;d(B),w("cache"),v(F.fetchedAt||null)}}V()},[t,E,A,V,O,n,T,I,j]),{daily:u,summary:f,rolling:p,source:E?"mock":b,fetchedAt:x,loading:k,error:C,refresh:V}}function bb(e){try{return new URL(e).host}catch{return null}}function Uo(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 xb(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function Go(e,t,n,{timeZone:r,offsetMinutes:s,now:o}={}){const i=Uo(t),a=Uo(n);if(!i||!a||a<i)return Array.isArray(e)?e:[];const l=o instanceof Date&&Number.isFinite(o.getTime())?o:new Date,c=da({timeZone:r,offsetMinutes:s,date:l}),u=Uo(c),d=u?u.getTime():l.getTime(),f=new Map;for(const p of e||[])p?.day&&f.set(p.day,p);const m=[];for(let p=i;p<=a;p=xb(p,1)){const g=cr(p),b=f.get(g),w=p.getTime()>d;if(b){m.push({...b,missing:!1,future:w});continue}m.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 m}function vb({baseUrl:e,accessToken:t,guestAllowed:n=!1,from:r,to:s,cacheKey:o,timeZone:i,tzOffsetMinutes:a}={}){const[l,c]=h.useState(null),[u,d]=h.useState("edge"),[f,m]=h.useState(!1),[p,g]=h.useState(null),b=yr(),w=br(t),x=!n,v=h.useMemo(()=>{if(!o)return null;const T=wb(e)||"default",R=go({timeZone:i,offsetMinutes:a});return`vibeusage.modelBreakdown.${o}.${T}.${r}.${s}.${R}`},[e,o,r,i,s,a]),k=h.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=h.useCallback(T=>{if(!(!v||typeof window>"u"))try{window.localStorage.setItem(v,JSON.stringify(T))}catch{}},[v]),C=h.useCallback(()=>{if(!(!v||typeof window>"u"))try{window.localStorage.removeItem(v)}catch{}},[v]),D=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),E=h.useCallback(async()=>{const T=await Bt(t);if(!(!T&&!b&&!D)){m(!0),g(null);try{const R=await ay({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 M=R;g(M?.message||String(M))}}else{c(null),d("edge");const A=R;g(A?.message||String(A))}}finally{m(!1)}}},[t,e,r,b,n,x,k,i,s,w,a,C,S,D]);return h.useEffect(()=>{if(!w&&!n&&!b&&!D){c(null),d("edge"),g(null),m(!1);return}if(!x)C(),c(null),d("edge"),g(null);else{const T=k();T?.breakdown&&(c(T.breakdown),d("cache"))}E()},[t,b,k,E,w,n,x,C,D]),{breakdown:l,source:b?"mock":u,loading:f,error:p,refresh:E}}function wb(e){try{return new URL(e).host}catch{return null}}const Ud=new Set(["day","hour","month"]);function kb(e){return Ud.has(e)}function ec(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 Sb(e,t){const n=ec(e),r=ec(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 Tb(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 Cb(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 Eb(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 Mb(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 Db(e,t,n){const r=n==="hour"?Mb:n==="month"?Eb:Cb,s=r(e),o=r(t);return s!=null&&o!=null?s===o?0:s<o?-1:1:Tb(e,t)}function Gd(e,{key:t,dir:n}){const r=n==="asc"?1:-1,s=Array.isArray(e)?e:[],o=Ud.has(t)?(a,l)=>Db(a,l,t):Sb,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 m=o(c,u);return m!==0?m*r:a.index-l.index}).map(a=>a.row)}const Pb=[{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 tc(e){const t=kb(e)?e:"day";return Pb.map((n,r)=>r===0?{...n,key:t}:n)}function nc(e,{key:t,dir:n}){return Gd(e,{key:t,dir:n})}const ro=12,Rb=["total_tokens","billable_total_tokens","input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens"];function Ob(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 Ab(e){return Rb.some(t=>Ob(e?.[t]))}function Nb(e){const t=Array.isArray(e)?e:[];if(!t.length)return[];const n=Gd(t,{key:"month",dir:"asc"}),r=n.findIndex(s=>s?.month&&Ab(s));return r===-1?t:n.slice(r)}function jb(e,t,n=ro){const r=Array.isArray(e)?e:[],s=Number.isFinite(n)&&n>0?n:ro,i=(Number.isFinite(t)&&t>=0?Math.floor(t):0)*s;return r.slice(i,i+s)}function Ib({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 Kd(e){if(typeof e!="string")return null;const t=e.trim();return t?t.toLowerCase():null}function Fb(e){const t=Kd(e?.model_id);return t||null}function zd(e,t){return e?.model?String(e.model):t}function Lb(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 m=i.totalTokens>0?Math.round(f/i.totalTokens*1e3)/10:0,p=zd(d,n("shared.placeholder.short")),g=Fb(d),b=i.totalCost>0&&i.totalTokens>0?f/i.totalTokens*i.totalCost:null;return{id:g,name:p,share:m,usage:f,cost:b}}).filter(Boolean);return{label:a,totalPercent:String(c),usd:i.totalCost,usage:i.totalTokens,models:u}})}function Vb(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 m=Array.isArray(f?.models)?f.models:[];for(const p of m){const g=xt(p?.totals?.billable_total_tokens)??0;if(!Number.isFinite(g)||g<=0)continue;l+=g;const b=zd(p,r("shared.placeholder.short")),w=Kd(b);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,b))}}if(!o.size)return[];const c=Array.from(o.values()).reduce((f,m)=>f+m,0),u=l>0?l:c,d=Number.isFinite(t)?Math.max(0,Math.floor(t)):3;return Array.from(o.entries()).map(([f,m])=>{const p=u>0?(m/u*100).toFixed(1):"0.0";return{id:f,name:i.get(f)||r("shared.placeholder.short"),tokens:m,percent:String(p)}}).sort((f,m)=>m.tokens!==f.tokens?m.tokens-f.tokens:String(f.name).localeCompare(String(m.name))).slice(0,d)}function wa(){const e=h.useContext(Bg);if(e===null)throw new Error("useTheme must be used within a ThemeProvider");return e}const En=12,Or=3,Ko=26,_b=["#ecfdf5","#a7f3d0","#6ee7b7","#34d399","#10b981"],Wb=["#064e3b","#065f46","#059669","#10b981","#34d399"],Bb=[_("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 $b(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 Yb(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 qd(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function Hb(e,t){return Math.floor((Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())-Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))/864e5)}function Ub(e,t){const n=t==="mon"?1:0,r=e.getUTCDay();return qd(e,-((r-n+7)%7))}function Gb(e,t,n){if(!e)return[];const r=Yb(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=Ub(r,n),i=qd(o,-(e-1)*7),a=[],l=new Set;for(const c of s){const u=Math.floor(Hb(i,c)/7);u<0||u>=e||l.has(u)||(l.add(u),a.push({label:Bb[c.getUTCMonth()],index:u}))}return a}function Kb({heatmap:e,timeZoneLabel:t,timeZoneShortLabel:n,hideLegend:r=!1}){const{resolvedTheme:s}=wa(),i=s==="dark"?Wb:_b,a=h.useRef(null);h.useEffect(()=>{const p=a.current;p&&(p.scrollLeft=p.scrollWidth)},[e?.weeks]);const l=e?.week_starts_on==="mon"?"mon":"sun",c=h.useMemo(()=>{const p=Array.isArray(e?.weeks)?e.weeks:[];if(!p.length)return{weeks:[]};const g=[];for(const b of p)for(const w of Array.isArray(b)?b:[])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 Oi({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=h.useMemo(()=>Gb(u.length,c?.to,l),[c?.to,u.length,l]);if(!u.length)return y.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:_("heatmap.empty")});const m=Ko+u.length*En+Math.max(0,u.length-1)*Or;return y.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:[y.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[y.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:_("heatmap.title")}),y.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400",children:n||_("heatmap.legend.utc")})]}),y.jsx("div",{ref:a,className:"overflow-x-auto overflow-y-hidden heatmap-scroll-thin",children:y.jsxs("div",{style:{minWidth:m},children:[y.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:`${Ko}px repeat(${u.length}, ${En}px)`,columnGap:Or},children:[y.jsx("span",{}),f.map(p=>y.jsx("span",{style:{gridColumnStart:p.index+2},className:"whitespace-nowrap",children:p.label},`${p.label}-${p.index}`))]}),y.jsxs("div",{className:"grid",style:{gridTemplateColumns:`${Ko}px repeat(${u.length}, ${En}px)`,columnGap:Or},children:[y.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=>y.jsx("span",{className:"leading-none",children:p},p))}),y.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${En}px)`,gap:Or},children:u.map((p,g)=>(Array.isArray(p)?p:[]).map((b,w)=>{if(!b)return null;const x=b.day||`e-${g}-${w}`,v=Number(b.level)||0,k=i[v]||i[0],S=t||n||_("heatmap.legend.utc");return y.jsx("span",{title:_("heatmap.tooltip",{day:b.day,value:$b(b.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&&y.jsxs("div",{className:"flex items-center justify-center gap-2 mt-3",children:[y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:_("heatmap.legend.less")}),y.jsx("div",{className:"flex gap-0.5",children:i.map((p,g)=>y.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:p}},g))}),y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:_("heatmap.legend.more")})]})]})}const zb={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Xd={...zb,position:"fixed",top:0,left:0};function $t(e){const t=bn(qb,e).current;return t.next=e,Te(t.effect),t}function qb(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var so=Symbol("NOT_FOUND");function Xb(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Zb(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Qb(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 rc=e=>Array.isArray(e)?e:[e];function Jb(e){const t=Array.isArray(e[0])?e[0]:e;return Qb(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function e0(e,t){const n=[],{length:r}=e;for(let s=0;s<r;s++)n.push(e[s].apply(null,t));return n}function t0(e){let t;return{get(n){return t&&e(t.key,n)?t.value:so},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function n0(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 so}function s(a,l){r(a)===so&&(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 r0=(e,t)=>e===t;function s0(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 o0(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=r0,maxSize:s=1,resultEqualityCheck:o}=n,i=s0(r);let a=0;const l=s<=1?t0(i):n0(s,i);function c(){let u=l.get(arguments);if(u===so){if(u=e.apply(null,arguments),a++,o){const f=l.getEntries().find(m=>o(m.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 i0=class{constructor(e){this.value=e}deref(){return this.value}},a0=typeof WeakRef<"u"?WeakRef:i0,l0=0,sc=1;function Es(){return{s:l0,v:void 0,o:null,p:null}}function Zd(e,t={}){let n=Es();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 m=arguments[d];if(typeof m=="function"||typeof m=="object"&&m!==null){let p=a.o;p===null&&(a.o=p=new WeakMap);const g=p.get(m);g===void 0?(a=Es(),p.set(m,a)):a=g}else{let p=a.p;p===null&&(a.p=p=new Map);const g=p.get(m);g===void 0?(a=Es(),p.set(m,a)):a=g}}const c=a;let u;if(a.s===sc)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 a0(u):u}return c.s=sc,c.v=u,u}return i.clearCache=()=>{n=Es(),i.resetResultsCount()},i.resultsCount=()=>o,i.resetResultsCount=()=>{o=0},i}function Qd(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()),Xb(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:d,memoizeOptions:f=[],argsMemoize:m=Zd,argsMemoizeOptions:p=[]}=u,g=rc(f),b=rc(p),w=Jb(s),x=d(function(){return o++,c.apply(null,arguments)},...g),v=m(function(){i++;const S=e0(w,arguments);return a=x.apply(null,S),a},...b);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:m})};return Object.assign(r,{withTypes:()=>r}),r}var c0=Qd(Zd),u0=Object.assign((e,t=c0)=>{Zb(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:()=>u0});Qd({memoize:o0,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const pe=(e,t,n,r,s,o,...i)=>{if(i.length>0)throw new Error($n(1));let a;if(e)a=e;else throw new Error("Missing arguments");return a};var zo={exports:{}},qo={};var oc;function d0(){if(oc)return qo;oc=1;var e=hd();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 m=f(),p=r({inst:{value:m,getSnapshot:f}}),g=p[0].inst,b=p[1];return o(function(){g.value=m,g.getSnapshot=f,l(g)&&b({inst:g})},[d,m,f]),s(function(){return l(g)&&b({inst:g}),d(function(){l(g)&&b({inst:g})})},[d]),i(m),m}function l(d){var f=d.getSnapshot;d=d.value;try{var m=f();return!n(d,m)}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 qo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,qo}var ic;function Jd(){return ic||(ic=1,zo.exports=d0()),zo.exports}var f0=Jd(),Xo={exports:{}},Zo={};var ac;function h0(){if(ac)return Zo;ac=1;var e=hd(),t=Jd();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 Zo.useSyncExternalStoreWithSelector=function(c,u,d,f,m){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),m!==void 0&&g.hasValue){var D=g.value;if(m(D,C))return k=D}return k=C}if(D=k,r(v,C))return D;var E=f(C);return m!==void 0&&m(D,E)?(v=C,D):(v=C,k=E)}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,m]);var b=s(c,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},Zo}var lc;function m0(){return lc||(lc=1,Xo.exports=h0()),Xo.exports}var p0=m0();const g0=md(19),y0=g0?x0:v0;function b0(e,t,n,r,s){return y0(e,t,n,r,s)}function x0(e,t,n,r,s){const o=h.useCallback(()=>t(e.getSnapshot(),n,r,s),[e,t,n,r,s]);return f0.useSyncExternalStore(e.subscribe,o,o)}function v0(e,t,n,r,s){return p0.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 ka extends Vr{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}controlledValues=new Map;useSyncedValue(t,n){h.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){h.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)=>{h.useDebugValue(t);const o=this.selectors[t];return b0(this,o,n,r,s)};useContextCallback(t,n){h.useDebugValue(t);const r=he(n??pd);this.context[t]=r}useStateSetter(t){const n=h.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 Ms=null;class w0{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 Ds=new w0;class _t{static create(){return new _t}static request(t){return Ds.request(t)}static cancel(t){return Ds.cancel(t)}currentId=Ms;request(t){this.cancel(),this.currentId=Ds.request(()=>{this.currentId=Ms,t()})}cancel=()=>{this.currentId!==Ms&&(Ds.cancel(this.currentId),this.currentId=Ms)};disposeEffect=()=>this.cancel}function Sa(){const e=bn(_t.create).current;return ga(e.disposeEffect),e}function ef(){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 k0{nodesRef={current:[]};events=ef();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 tf=h.createContext(null),nf=h.createContext(null),Hn=()=>h.useContext(tf)?.id||null,wr=e=>{const t=h.useContext(nf);return e??t};function S0(e){const t=ts(),n=wr(e),r=Hn();return Te(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function T0(e){const{children:t,id:n}=e,r=Hn();return y.jsx(tf.Provider,{value:h.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function C0(e){const{children:t,externalTree:n}=e,r=bn(()=>n??new k0).current;return y.jsx(nf.Provider,{value:r,children:t})}function Ur(e){return`data-base-ui-${e}`}function Qo(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=h.forwardRef(function(t,n){const[r,s]=h.useState();Te(()=>{My&&s("button")},[]);const o={tabIndex:0,role:r};return y.jsx("span",{...t,ref:n,style:Xd,"aria-hidden":r?void 0:!0,...o,"data-base-ui-focus-guard":""})});let cc=0;function Jo(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:s=!1}=t;r&&cancelAnimationFrame(cc);const o=()=>e?.focus({preventScroll:n});s?o():cc=requestAnimationFrame(o)}const ar={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function uc(e){return e==="inert"?ar.inert:e==="aria-hidden"?ar["aria-hidden"]:ar.none}let Ps=new WeakSet,Rs={},ei=0;const rf=e=>e&&(e.host||rf(e.parentNode)),E0=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=rf(n);return e.contains(r)?r:null}).filter(n=>n!=null);function M0(e,t,n,r){const s="data-base-ui-inert",o=r?"inert":n?"aria-hidden":null,i=E0(t,e),a=new Set,l=new Set(i),c=[];Rs[s]||(Rs[s]=new WeakMap);const u=Rs[s];i.forEach(d),f(t),a.clear();function d(m){!m||a.has(m)||(a.add(m),m.parentNode&&d(m.parentNode))}function f(m){!m||l.has(m)||[].forEach.call(m.children,p=>{if(ns(p)!=="script")if(a.has(p))f(p);else{const g=o?p.getAttribute(o):null,b=g!==null&&g!=="false",w=uc(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&&b&&Ps.add(p),v===1&&p.setAttribute(s,""),!b&&o&&p.setAttribute(o,o==="inert"?"":"true")}})}return ei+=1,()=>{c.forEach(m=>{const p=uc(o),b=(p.get(m)||0)-1,w=(u.get(m)||0)-1;p.set(m,b),u.set(m,w),b||(!Ps.has(m)&&o&&m.removeAttribute(o),Ps.delete(m)),w||m.removeAttribute(s)}),ei-=1,ei||(ar.inert=new WeakMap,ar["aria-hidden"]=new WeakMap,ar.none=new WeakMap,Ps=new WeakSet,Rs={})}}function D0(e,t=!1,n=!1){const r=qe(e[0]).body;return M0(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const sf=h.createContext(null),of=()=>h.useContext(sf),P0=Ur("portal");function R0(e={}){const{ref:t,container:n,componentProps:r=jn,elementProps:s,elementState:o}=e,i=ts(),l=of()?.portalNode,[c,u]=h.useState(null),[d,f]=h.useState(null),m=he(w=>{w!==null&&f(w)}),p=h.useRef(null);Te(()=>{if(n===null){p.current&&(p.current=null,f(null),u(null));return}if(i==null)return;const w=(n&&($g(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=on("div",r,{ref:[t,m],state:o,props:[{id:i,[P0]:""},s]});return{portalNode:d,portalSubtree:c&&g?pn.createPortal(g,c):null}}const af=h.forwardRef(function(t,n){const{children:r,container:s,className:o,render:i,renderGuards:a,...l}=t,{portalNode:c,portalSubtree:u}=R0({container:s,ref:n,componentProps:t,elementProps:l}),d=h.useRef(null),f=h.useRef(null),m=h.useRef(null),p=h.useRef(null),[g,b]=h.useState(null),w=g?.modal,x=g?.open,v=typeof a=="boolean"?a:!!g&&!g.modal&&g.open&&!!c;h.useEffect(()=>{if(!c||w)return;function S(C){c&&C.relatedTarget&&ir(C)&&(C.type==="focusin"?Ql:cb)(c)}return c.addEventListener("focusin",S,!0),c.addEventListener("focusout",S,!0),()=>{c.removeEventListener("focusin",S,!0),c.removeEventListener("focusout",S,!0)}},[c,w]),h.useEffect(()=>{!c||x||Ql(c)},[x,c]);const k=h.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:m,afterInsideRef:p,portalNode:c,setFocusManagerState:b}),[c]);return y.jsxs(h.Fragment,{children:[u,y.jsxs(sf.Provider,{value:k,children:[v&&c&&y.jsx(mr,{"data-type":"outside",ref:d,onFocus:S=>{if(ir(S,c))m.current?.focus();else{const C=g?g.domReference:null;$d(C)?.focus()}}}),v&&c&&y.jsx("span",{"aria-owns":c.id,style:Ty}),c&&pn.createPortal(r,c),v&&c&&y.jsx(mr,{"data-type":"outside",ref:f,onFocus:S=>{if(ir(S,c))p.current?.focus();else{const C=g?g.domReference:null;va(C)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,Le(Hr,S.nativeEvent))}}})]})]})});function en(e){return e==null?e:"current"in e?e.current:e}function O0(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 dc=20;let fn=[];function Ta(){fn=fn.filter(e=>e.isConnected)}function A0(e){Ta(),e&&ns(e)!=="body"&&(fn.push(e),fn.length>dc&&(fn=fn.slice(-dc)))}function ti(){return Ta(),fn[fn.length-1]}function N0(e){if(!e)return null;const t=vr();return Wd(e,t)?e:ss(e,t)[0]||e}function j0(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():At(e).display!=="none"}function fc(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=vr(),s=ib(e,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return Wd(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 lf(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:m,beforeContentFocusGuardRef:p,externalTree:g}=e,b="rootStore"in t?t.rootStore:t,w=b.useState("open"),x=b.useState("domReferenceElement"),v=b.useState("floatingElement"),{events:k,dataRef:S}=b.context,C=he(()=>S.current.floatingContext?.nodeId),D=he(d),E=o===!1,O=Kl(x)&&E,T=$t(s),R=$t(o),A=$t(i),M=$t(u),I=wr(g),j=of(),V=h.useRef(null),U=h.useRef(null),P=h.useRef(!1),F=h.useRef(!1),W=h.useRef(!1),B=h.useRef(-1),Q=h.useRef(""),Y=h.useRef(""),$=h.useRef(null),z=h.useRef(null),Z=Yl($,p,j?.beforeInsideRef),ce=Yl(z,j?.afterInsideRef),Se=_n(),Re=_n(),Ee=Sa(),et=j!=null,L=ji(v),ue=he((H=L)=>H?ss(H,vr()):[]),te=he(H=>{const se=ue(H);return T.current.map(()=>se).filter(Boolean).flat()});h.useEffect(()=>{if(r||!l)return;function H(ie){ie.key==="Tab"&&we(L,Jn(qe(L)))&&ue().length===0&&!O&&Ny(ie)}const se=qe(L);return se.addEventListener("keydown",H),()=>{se.removeEventListener("keydown",H)}},[r,x,L,l,T,O,ue,te]),h.useEffect(()=>{if(r||!v)return;function H(se){const ie=ft(se),ge=ue().indexOf(ie);ge!==-1&&(B.current=ge)}return v.addEventListener("focusin",H),()=>{v.removeEventListener("focusin",H)}},[r,v,ue]),h.useEffect(()=>{if(r||!w)return;const H=qe(L);function se(){W.current=!1}function ie(ge){const J=ft(ge),ne=we(v,J)||we(x,J)||we(j?.portalNode,J);W.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,j]),h.useEffect(()=>{if(r||!c)return;function H(){F.current=!0,Re.start(0,()=>{F.current=!1})}function se(J){const ne=J.relatedTarget,Ve=J.currentTarget,be=ft(J);queueMicrotask(()=>{const Be=C(),$e=b.context.triggerElements,it=ne?.hasAttribute(Ur("focus-guard"))&&[$.current,z.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,en(m),en(f)].includes(ne),Oe=!(we(x,ne)||we(v,ne)||we(ne,v)||we(j?.portalNode,ne)||ne!=null&&$e.hasElement(ne)||$e.hasMatchingElement(ye=>we(ye,ne))||it||I&&(Fn(I.nodesRef.current,Be).find(ye=>we(ye.context?.elements.floating,ne)||we(ye.context?.elements.domReference,ne))||zl(I.nodesRef.current,Be).find(ye=>[ye.context?.elements.floating,ji(ye.context?.elements.floating)].includes(ne)||ye.context?.elements.domReference===ne)));if(Ve===x&&L&&fc(L,T),a&&Ve!==x&&!j0(be)&&Jn(qe(L))===qe(L).body){if(rt(L)&&(L.focus(),a==="popup")){Ee.request(()=>{L.focus()});return}const ye=B.current,je=ue(),Ye=je[ye]||je[je.length-1]||L;rt(Ye)&&Ye.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(O||!l)&&ne&&Oe&&!F.current&&(O||ne!==ti())&&(P.current=!0,b.setOpen(!1,Le(Hr,J)))})}function ie(){W.current||(S.current.insideReactTree=!0,Se.start(0,()=>{S.current.insideReactTree=!1}))}const me=rt(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),j&&(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,I,j,b,c,a,ue,O,C,T,S,Se,Re,Ee,f,m]),h.useEffect(()=>{if(r||!v||!w)return;const H=Array.from(j?.portalNode?.querySelectorAll(`[${Ur("portal")}]`)||[]),ie=(I?zl(I.nodesRef.current,C()):[]).find(J=>Kl(J.context?.elements.domReference||null))?.context?.elements.domReference,me=[v,ie,...H,...D(),V.current,U.current,$.current,z.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,en(m),en(f),O?x:null].filter(J=>J!=null),ge=D0(me,l||O);return()=>{ge()}},[w,r,x,v,l,T,j,O,I,C,D,f,m]),Te(()=>{if(!w||r||!rt(L))return;const H=qe(L),se=Jn(H);queueMicrotask(()=>{const ie=te(L),me=R.current,ge=typeof me=="function"?me(M.current||""):me;if(ge===void 0||ge===!1)return;let J;ge===!0||ge===null?J=ie[0]||L:J=en(ge),J=J||ie[0]||L,!we(L,se)&&Jo(J,{preventScroll:J===L})})},[r,w,L,E,te,R,M]),Te(()=>{if(r||!L)return;const H=qe(L),se=Jn(H);A0(se);function ie(J){if(J.open||(Q.current=O0(J.nativeEvent,Y.current)),J.reason===dt&&J.nativeEvent.type==="mouseleave"&&(P.current=!0),J.reason===gd)if(J.nested)P.current=!1;else if(Iy(J.nativeEvent)||Fy(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,Xd),et&&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||ti();return be&&be.isConnected?be:me}const Ve=x||ti()||me;return en(ne)||Ve}return()=>{k.off("openchange",ie);const J=Jn(H),ne=we(v,J)||I&&Fn(I.nodesRef.current,C(),!1).some(be=>we(be.context?.elements.floating,J)),Ve=ge();queueMicrotask(()=>{const be=N0(Ve),Be=typeof A.current!="boolean";A.current&&!P.current&&rt(be)&&(!(!Be&&be!==J&&J!==H.body)||ne)&&be.focus({preventScroll:!0}),me.remove()})}},[r,v,L,A,S,k,I,et,x,C]),h.useEffect(()=>{queueMicrotask(()=>{P.current=!1})},[r]),h.useEffect(()=>{if(r||!w)return;function H(ie){ft(ie)?.closest(`[${Td}]`)&&(F.current=!0)}const se=qe(L);return se.addEventListener("pointerdown",H,!0),()=>{se.removeEventListener("pointerdown",H,!0)}},[r,w,L]),Te(()=>{if(!r&&j)return j.setFocusManagerState({modal:l,closeOnFocusOut:c,open:w,onOpenChange:b.setOpen,domReference:x}),()=>{j.setFocusManagerState(null)}},[r,j,l,w,b,c,x]),Te(()=>{if(!(r||!L))return fc(L,T),()=>{queueMicrotask(Ta)}},[r,L,T]);const Me=!r&&(l?!O:!0)&&(et||l);return y.jsxs(h.Fragment,{children:[Me&&y.jsx(mr,{"data-type":"inside",ref:Z,onFocus:H=>{if(l){const se=te();Jo(se[se.length-1])}else j?.portalNode&&(P.current=!1,ir(H,j.portalNode)?va(x)?.focus():en(m??j.beforeOutsideRef)?.focus())}}),n,Me&&y.jsx(mr,{"data-type":"inside",ref:ce,onFocus:H=>{l?Jo(te()[0]):j?.portalNode&&(c&&(P.current=!0),ir(H,j.portalNode)?$d(x)?.focus():en(f??j.afterOutsideRef)?.focus())}})]})}function I0(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=h.useRef(void 0),d=Sa(),f=_n(),m=h.useMemo(()=>({onPointerDown(p){u.current=p.pointerType},onMouseDown(p){const g=u.current,b=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(Od(b.target)){const D=Le(mn,b,b.target);S&&g==="touch"&&c>0?f.start(c,()=>{n.setOpen(!0,D)}):n.setOpen(S,D);return}const C=p.currentTarget;d.request(()=>{const D=Le(mn,b,C);S&&g==="touch"&&c>0?f.start(c,()=>{n.setOpen(!0,D)}):n.setOpen(S,D)})},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 b=n.select("open"),w=r.current.openEvent,x=n.select("domReferenceElement")!==p.currentTarget,v=b&&x||!(b&&i&&(!(w&&l)||Ad(w))),k=Le(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 h.useMemo(()=>s?{reference:m}:jn,[s,m])}function hc(e,t,n){let{reference:r,floating:s}=e;const o=yt(t),i=xa(t),a=ba(i),l=at(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 m;switch(l){case"top":m={x:u,y:r.y-s.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-s.width,y:d};break;default:m={x:r.x,y:r.y}}switch(xn(t)){case"start":m[i]-=f*(n&&c?-1:1);break;case"end":m[i]+=f*(n&&c?-1:1);break}return m}async function F0(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:m=0}=rn(t,e),p=Nd(m),b=a[f?d==="floating"?"reference":"floating":d],w=Qs(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(b)))==null||n?b:b.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=Qs(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 L0=50,V0=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:F0},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}=hc(c,r,l),f=r,m=0;const p={};for(let g=0;g<o.length;g++){const b=o[g];if(!b)continue;const{name:w,fn:x}=b,{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&&m<L0&&(m++,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}=hc(c,f,l)),g=-1)}return{x:u,y:d,placement:f,strategy:s,middlewareData:p}},_0=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:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...b}=rn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=at(s),x=yt(a),v=at(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=f||(v||!g?[Zs(a)]:Wy(a)),C=p!=="none";!f&&C&&S.push(...Hy(a,g,p,k));const D=[a,...S],E=await l.detectOverflow(t,b),O=[];let T=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&O.push(E[w]),d){const I=_y(s,i,k);O.push(E[I[0]],E[I[1]])}if(T=[...T,{placement:s,overflows:O}],!O.every(I=>I<=0)){var R,A;const I=(((R=o.flip)==null?void 0:R.index)||0)+1,j=D[I];if(j&&(!(d==="alignment"?x!==yt(j):!1)||T.every(P=>yt(P.placement)===x?P.overflows[0]>0:!0)))return{data:{index:I,overflows:T},reset:{placement:j}};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(m){case"bestFit":{var M;const U=(M=T.filter(P=>{if(C){const F=yt(P.placement);return F===x||F==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(F=>F>0).reduce((F,W)=>F+W,0)]).sort((P,F)=>P[1]-F[1])[0])==null?void 0:M[0];U&&(V=U);break}case"initialPlacement":V=a;break}if(s!==V)return{reset:{placement:V}}}return{}}}};function mc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pc(e){return Ly.some(t=>e[t]>=0)}const W0=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=rn(e,t);switch(s){case"referenceHidden":{const i=await r.detectOverflow(t,{...o,elementContext:"reference"}),a=mc(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:pc(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),a=mc(i,n.floating);return{data:{escapedOffsets:a,escaped:pc(a)}}}default:return{}}}}},cf=new Set(["left","top"]);async function B0(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=at(n),a=xn(n),l=yt(n)==="y",c=cf.has(i)?-1:1,u=o&&l?-1:1,d=rn(t,e);let{mainAxis:f,crossAxis:m,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"&&(m=a==="end"?p*-1:p),l?{x:m*u,y:f*c}:{x:f*c,y:m*u}}const $0=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 B0(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}}}}},Y0=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}=rn(e,t),u={x:n,y:r},d=await o.detectOverflow(t,c),f=yt(at(s)),m=ya(f);let p=u[m],g=u[f];if(i){const w=m==="y"?"top":"left",x=m==="y"?"bottom":"right",v=p+d[w],k=p-d[x];p=Ii(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=Ii(v,g,k)}const b=l.fn({...t,[m]:p,[f]:g});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[m]:i,[f]:a}}}}}},H0=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}=rn(e,t),u={x:n,y:r},d=yt(s),f=ya(d);let m=u[f],p=u[d];const g=rn(a,t),b=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]+b.mainAxis,S=o.reference[f]+o.reference[v]-b.mainAxis;m<k?m=k:m>S&&(m=S)}if(c){var w,x;const v=f==="y"?"width":"height",k=cf.has(at(s)),S=o.reference[d]-o.floating[v]+(k&&((w=i.offset)==null?void 0:w[d])||0)+(k?0:b.crossAxis),C=o.reference[d]+o.reference[v]+(k?0:((x=i.offset)==null?void 0:x[d])||0)-(k?b.crossAxis:0);p<S?p=S:p>C&&(p=C)}return{[f]:m,[d]:p}}}},U0=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}=rn(e,t),u=await i.detectOverflow(t,c),d=at(s),f=xn(s),m=yt(s)==="y",{width:p,height:g}=o.floating;let b,w;d==="top"||d==="bottom"?(b=d,w=f===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(w=d,b=f==="end"?"top":"bottom");const x=g-u.top-u.bottom,v=p-u.left-u.right,k=fr(g-u[b],x),S=fr(p-u[w],v),C=!t.middlewareData.shift;let D=k,E=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(E=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=x),C&&!f){const T=ht(u.left,0),R=ht(u.right,0),A=ht(u.top,0),M=ht(u.bottom,0);m?E=p-2*(T!==0||R!==0?T+R:ht(u.left,u.right)):D=g-2*(A!==0||M!==0?A+M:ht(u.top,u.bottom))}await l({...t,availableWidth:E,availableHeight:D});const O=await i.getDimensions(a.floating);return p!==O.width||g!==O.height?{reset:{rects:!0}}:{}}}};function uf(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=rt(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=Xs(n)!==o||Xs(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function Ca(e){return Ae(e)?e:e.contextElement}function lr(e){const t=Ca(e);if(!rt(t))return Ut(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=uf(t);let i=(o?Xs(n.width):n.width)/r,a=(o?Xs(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const G0=Ut(0);function df(e){const t=vt(e);return!fa()||!t.visualViewport?G0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function K0(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==vt(e)?!1:t}function Wn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=Ca(e);let i=Ut(1);t&&(r?Ae(r)&&(i=lr(r)):i=lr(e));const a=K0(o,n,r)?df(o):Ut(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),m=r&&Ae(r)?vt(r):r;let p=f,g=Hl(p);for(;g&&r&&m!==p;){const b=lr(g),w=g.getBoundingClientRect(),x=At(g),v=w.left+(g.clientLeft+parseFloat(x.paddingLeft))*b.x,k=w.top+(g.clientTop+parseFloat(x.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,d*=b.y,l+=v,c+=k,p=vt(g),g=Hl(p)}}return Qs({width:u,height:d,x:l,y:c})}function bo(e,t){const n=yo(e).scrollLeft;return t?t.left+n:Wn(an(e)).left+n}function ff(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-bo(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function z0(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=an(r),a=t?ha(t.floating):!1;if(r===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Ut(1);const u=Ut(0),d=rt(r);if((d||!d&&!o)&&((ns(r)!=="body"||rs(i))&&(l=yo(r)),d)){const m=Wn(r);c=lr(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const f=i&&!d&&!o?ff(i,l):Ut(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 q0(e){return Array.from(e.getClientRects())}function X0(e){const t=an(e),n=yo(e),r=e.ownerDocument.body,s=ht(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=ht(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+bo(e);const a=-n.scrollTop;return At(r).direction==="rtl"&&(i+=ht(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:a}}const gc=25;function Z0(e,t){const n=vt(e),r=an(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=fa();(!u||u&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const c=bo(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),m=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-m);p<=gc&&(o-=p)}else c<=gc&&(o+=c);return{width:o,height:i,x:a,y:l}}function Q0(e,t){const n=Wn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=rt(e)?lr(e):Ut(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 yc(e,t,n){let r;if(t==="viewport")r=Z0(e,n);else if(t==="document")r=X0(an(e));else if(Ae(t))r=Q0(t,n);else{const s=df(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Qs(r)}function hf(e,t){const n=ur(e);return n===t||!Ae(n)||In(n)?!1:At(n).position==="fixed"||hf(n,t)}function J0(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=yd(i);!l&&a.position==="fixed"&&(s=null),(o?!l&&!s:!l&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||rs(i)&&!l&&hf(e,i))?r=r.filter(u=>u!==i):s=a,i=ur(i)}return t.set(e,r),r}function ex(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?ha(t)?[]:J0(t,this._c):[].concat(n),r],a=yc(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 m=yc(t,i[f],s);l=ht(m.top,l),c=fr(m.right,c),u=fr(m.bottom,u),d=ht(m.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function tx(e){const{width:t,height:n}=uf(e);return{width:t,height:n}}function nx(e,t,n){const r=rt(t),s=an(t),o=n==="fixed",i=Wn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Ut(0);function c(){l.x=bo(s)}if(r||!r&&!o)if((ns(t)!=="body"||rs(s))&&(a=yo(t)),r){const m=Wn(t,!0,o,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else s&&c();o&&!r&&s&&c();const u=s&&!r&&!o?ff(s,a):Ut(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 ni(e){return At(e).position==="static"}function bc(e,t){if(!rt(e)||At(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return an(e)===n&&(n=n.ownerDocument.body),n}function mf(e,t){const n=vt(e);if(ha(e))return n;if(!rt(e)){let s=ur(e);for(;s&&!In(s);){if(Ae(s)&&!ni(s))return s;s=ur(s)}return n}let r=bc(e,t);for(;r&&Yg(r)&&ni(r);)r=bc(r,t);return r&&In(r)&&ni(r)&&!yd(r)?n:r||Hg(e)||n}const rx=async function(e){const t=this.getOffsetParent||mf,n=this.getDimensions,r=await n(e.floating);return{reference:nx(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sx(e){return At(e).direction==="rtl"}const ox={convertOffsetParentRelativeRectToViewportRelativeRect:z0,getDocumentElement:an,getClippingRect:ex,getOffsetParent:mf,getElementRects:rx,getClientRects:q0,getDimensions:tx,getScale:lr,isElement:Ae,isRTL:sx};function pf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ix(e,t){let n=null,r;const s=an(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:m}=c;if(a||t(),!f||!m)return;const p=Cs(d),g=Cs(s.clientWidth-(u+f)),b=Cs(s.clientHeight-(d+m)),w=Cs(u),v={rootMargin:-p+"px "+-g+"px "+-b+"px "+-w+"px",threshold:ht(0,fr(1,l))||1};let k=!0;function S(C){const D=C[0].intersectionRatio;if(D!==l){if(!k)return i();D?i(!1,D):r=setTimeout(()=>{i(!1,1e-7)},1e3)}D===1&&!pf(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 xc(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=Ca(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?ix(c,n):null;let f=-1,m=null;i&&(m=new ResizeObserver(w=>{let[x]=w;x&&x.target===c&&m&&t&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),c&&!l&&m.observe(c),t&&m.observe(t));let p,g=l?Wn(e):null;l&&b();function b(){const w=Wn(e);g&&!pf(g,w)&&n(),g=w,p=requestAnimationFrame(b)}return n(),()=>{var w;u.forEach(x=>{s&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),d?.(),(w=m)==null||w.disconnect(),m=null,l&&cancelAnimationFrame(p)}}const ax=$0,lx=Y0,cx=_0,ux=U0,dx=W0,fx=H0,hx=(e,t,n)=>{const r=new Map,s={platform:ox,...n},o={...s.platform,_c:r};return V0(e,t,{...s,platform:o})};var mx=typeof document<"u",px=function(){},Vs=mx?h.useLayoutEffect:px;function oo(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(!oo(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)&&!oo(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function gf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vc(e,t){const n=gf(e);return Math.round(t*n)/n}function ri(e){const t=h.useRef(e);return Vs(()=>{t.current=e}),t}function gx(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]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=h.useState(r);oo(f,r)||m(r);const[p,g]=h.useState(null),[b,w]=h.useState(null),x=h.useCallback(P=>{P!==C.current&&(C.current=P,g(P))},[]),v=h.useCallback(P=>{P!==D.current&&(D.current=P,w(P))},[]),k=o||p,S=i||b,C=h.useRef(null),D=h.useRef(null),E=h.useRef(u),O=l!=null,T=ri(l),R=ri(s),A=ri(c),M=h.useCallback(()=>{if(!C.current||!D.current)return;const P={placement:t,strategy:n,middleware:f};R.current&&(P.platform=R.current),hx(C.current,D.current,P).then(F=>{const W={...F,isPositioned:A.current!==!1};I.current&&!oo(E.current,W)&&(E.current=W,pn.flushSync(()=>{d(W)}))})},[f,t,n,R,A]);Vs(()=>{c===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(P=>({...P,isPositioned:!1})))},[c]);const I=h.useRef(!1);Vs(()=>(I.current=!0,()=>{I.current=!1}),[]),Vs(()=>{if(k&&(C.current=k),S&&(D.current=S),k&&S){if(T.current)return T.current(k,S,M);M()}},[k,S,M,T,O]);const j=h.useMemo(()=>({reference:C,floating:D,setReference:x,setFloating:v}),[x,v]),V=h.useMemo(()=>({reference:k,floating:S}),[k,S]),U=h.useMemo(()=>{const P={position:n,left:0,top:0};if(!V.floating)return P;const F=vc(V.floating,u.x),W=vc(V.floating,u.y);return a?{...P,transform:"translate("+F+"px, "+W+"px)",...gf(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:W}},[n,a,V.floating,u.x,u.y]);return h.useMemo(()=>({...u,update:M,refs:j,elements:V,floatingStyles:U}),[u,M,j,V,U])}const yx=(e,t)=>{const n=ax(e);return{name:n.name,fn:n.fn,options:[e,t]}},bx=(e,t)=>{const n=lx(e);return{name:n.name,fn:n.fn,options:[e,t]}},xx=(e,t)=>({fn:fx(e).fn,options:[e,t]}),vx=(e,t)=>{const n=cx(e);return{name:n.name,fn:n.fn,options:[e,t]}},wx=(e,t)=>{const n=ux(e);return{name:n.name,fn:n.fn,options:[e,t]}},kx=(e,t)=>{const n=dx(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sx={intentional:"onClick",sloppy:"onPointerDown"};function Tx(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function yf(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:m=!1,referencePressEvent:p="sloppy",ancestorScroll:g=!1,bubbles:b,externalTree:w}=t,x=wr(w),v=he(typeof d=="function"?d:()=>!1),k=typeof d=="function"?v:d,S=h.useRef(!1),{escapeKey:C,outsidePress:D}=Tx(b),E=h.useRef(null),O=_n(),T=_n(),R=he(()=>{T.clear(),l.current.insideReactTree=!1}),A=h.useRef(!1),M=h.useRef(""),I=he(L=>{M.current=L.pointerType}),j=he(()=>{const L=M.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=jy(L)?L.nativeEvent:L,H=Le(bd,Me);n.setOpen(!1,H),!C&&!H.isPropagationAllowed&&L.stopPropagation()}),U=he(L=>{const ue=j();return ue==="intentional"&&L.type!=="click"||ue==="sloppy"&&L.type==="click"}),P=he(()=>{l.current.insideReactTree=!0,T.start(0,R)}),F=he((L,ue=!1)=>{if(U(L)){R();return}if(l.current.insideReactTree){R();return}if(j()==="intentional"&&ue||typeof k=="function"&&!k(L))return;const te=ft(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)&&!Ay(te)&&!we(te,n.select("floatingElement"))&&Array.from(H).every(ne=>!we(ie,ne)))return;if(rt(te)&&!("touches"in L)){const ne=In(te),Ve=At(te),be=/auto|scroll/,Be=ne||be.test(Ve.overflowX),$e=ne||be.test(Ve.overflowY),it=Be&&te.clientWidth>0&&te.scrollWidth>te.clientWidth,Oe=$e&&te.clientHeight>0&&te.scrollHeight>te.clientHeight,ye=Ve.direction==="rtl",je=Oe&&(ye?L.offsetX<=te.offsetWidth-te.clientWidth:L.offsetX>te.clientWidth),Ye=it&&L.offsetY>te.clientHeight;if(je||Ye)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(Ve=>{Ve.context?.open&&!Ve.context.dataRef.current.__outsidePressBubbles&&(ne=!1)}),!ne)return}n.setOpen(!1,Le(gd,L)),R()}),W=he(L=>{j()!=="sloppy"||L.pointerType==="touch"||!n.select("open")||!c||Ct(L,n.select("floatingElement"))||Ct(L,n.select("domReferenceElement"))||F(L)}),B=he(L=>{if(j()!=="sloppy"||!n.select("open")||!c||Ct(L,n.select("floatingElement"))||Ct(L,n.select("domReferenceElement")))return;const ue=L.touches[0];ue&&(E.current={startTime:Date.now(),startX:ue.clientX,startY:ue.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}),Q=he(L=>{const ue=ft(L);function te(){B(L),ue?.removeEventListener(L.type,te)}ue?.addEventListener(L.type,te)}),Y=he(L=>{const ue=S.current;if(S.current=!1,O.clear(),L.type==="mousedown"&&E.current&&!E.current.dismissOnMouseDown)return;const te=ft(L);function Me(){L.type==="pointerdown"?W(L):F(L,ue),te?.removeEventListener(L.type,Me)}te?.addEventListener(L.type,Me)}),$=he(L=>{if(j()!=="sloppy"||!E.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-E.current.startX),Me=Math.abs(ue.clientY-E.current.startY),H=Math.sqrt(te*te+Me*Me);H>5&&(E.current.dismissOnTouchEnd=!0),H>10&&(F(L),O.clear(),E.current=null)}),z=he(L=>{const ue=ft(L);function te(){$(L),ue?.removeEventListener(L.type,te)}ue?.addEventListener(L.type,te)}),Z=he(L=>{j()!=="sloppy"||!E.current||Ct(L,n.select("floatingElement"))||Ct(L,n.select("domReferenceElement"))||(E.current.dismissOnTouchEnd&&F(L),O.clear(),E.current=null)}),ce=he(L=>{const ue=ft(L);function te(){Z(L),ue?.removeEventListener(L.type,te)}ue?.addEventListener(L.type,te)});h.useEffect(()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=C,l.current.__outsidePressBubbles=D;const L=new gn;function ue(ie){n.setOpen(!1,Le(Ug,ie))}function te(){L.clear(),A.current=!0}function Me(){L.start(fa()?5:0,()=>{A.current=!1})}const H=qe(s);H.addEventListener("pointerdown",I,!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",I,!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,D,V,F,Y,W,Q,z,ce,I,n]),h.useEffect(R,[k,R]);const Se=h.useMemo(()=>({onKeyDown:V,...m&&{[Sx[p]]:L=>{n.setOpen(!1,Le(mn,L.nativeEvent))},...p!=="intentional"&&{onClick(L){n.setOpen(!1,Le(mn,L.nativeEvent))}}}}),[V,n,m,p]),Re=he(L=>{const ue=ft(L.nativeEvent);!we(n.select("floatingElement"),ue)||L.button!==0||(S.current=!0)}),Ee=he(L=>{!r||!c||L.button!==0||(S.current=!0)}),et=h.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 h.useMemo(()=>c?{reference:Se,floating:et,trigger:Se}:{},[c,Se,et])}const Cx={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 Ea extends ka{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:ef(),nested:n,noEmit:r,triggerElements:o},Cx)}setOpen=(t,n)=>{if((!t||!this.state.open||Ad(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 Ex(e,t=!1,n=!1){const[r,s]=h.useState(e&&t?"idle":void 0),[o,i]=h.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=_t.request(()=>{s("ending")});return()=>{_t.cancel(a)}}},[e,o,r,n]),Te(()=>{if(!e||t)return;const a=_t.request(()=>{s(void 0)});return()=>{_t.cancel(a)}},[t,e]),Te(()=>{if(!e||!t)return;e&&o&&r!=="idle"&&s("starting");const a=_t.request(()=>{s("idle")});return()=>{_t.cancel(a)}},[t,e,o,s,r]),h.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 Mx={[Gr.startingStyle]:""},Dx={[Gr.endingStyle]:""},xo={transitionStatus(e){return e==="starting"?Mx:e==="ending"?Dx:null}};function bf(e,t=!1,n=!0){const r=Sa();return he((s,o=null)=>{r.cancel();function i(){pn.flushSync(s)}const a=en(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 Ma(e){const{enabled:t=!0,open:n,ref:r,onComplete:s}=e,o=he(s),i=bf(r,n,!1);h.useEffect(()=>{if(!t)return;const a=new AbortController;return i(o,a.signal),()=>{a.abort()}},[t,n,o,i])}function Px(e,t){const n=h.useRef(null),r=h.useRef(null);return h.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 Rx(e,t,n,r){const s=n.useState("isMountedByTrigger",e),o=Px(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 xf(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 vf(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=Ex(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 Ma({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:o}}class vo{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 Ox(){return new Ea({open:!1,floatingElement:null,referenceElement:null,triggerElements:new vo,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function wf(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:Ox(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:jn,inactiveTriggerProps:jn,popupProps:jn}}const kf={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 Ax(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=ts(),o=Hn()!=null,i=bn(()=>new Ea({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new vo,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 Nx(e={}){const{nodeId:t,externalTree:n}=e,r=Ax(e),s=e.rootContext||r,o={reference:s.useState("referenceElement"),floating:s.useState("floatingElement"),domReference:s.useState("domReferenceElement")},[i,a]=h.useState(null),l=h.useRef(null),c=wr(n);Te(()=>{o.domReference&&(l.current=o.domReference)},[o.domReference]);const u=gx({...e,elements:{...o,...i&&{reference:i}}}),d=h.useCallback(D=>{const E=Ae(D)?{getBoundingClientRect:()=>D.getBoundingClientRect(),getClientRects:()=>D.getClientRects(),contextElement:D}:D;a(E),u.refs.setReference(E)},[u.refs]),[f,m]=h.useState(null),[p,g]=h.useState(null);s.useSyncedValue("referenceElement",f),s.useSyncedValue("domReferenceElement",Ae(f)?f:null),s.useSyncedValue("floatingElement",p);const b=h.useCallback(D=>{(Ae(D)||D===null)&&(l.current=D,m(D)),(Ae(u.refs.reference.current)||u.refs.reference.current===null||D!==null&&!Ae(D))&&u.refs.setReference(D)},[u.refs,m]),w=h.useCallback(D=>{g(D),u.refs.setFloating(D)},[u.refs]),x=h.useMemo(()=>({...u.refs,setReference:b,setFloating:w,setPositionReference:d,domReference:l}),[u.refs,b,w,d]),v=h.useMemo(()=>({...u.elements,domReference:o.domReference}),[u.elements,o.domReference]),k=s.useState("open"),S=s.useState("floatingId"),C=h.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 D=c?.nodesRef.current.find(E=>E.id===t);D&&(D.context=C)}),h.useMemo(()=>({...u,context:C,refs:x,elements:v,rootStore:s}),[u,x,v,C,s])}function Sf(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:s}=e,o=ts(),i=Hn()!=null,a=t.useState("open"),l=t.useState("activeTriggerElement"),c=t.useState(r?"popupElement":"positionerElement"),u=t.context.triggerElements,d=bn(()=>new Ea({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 _i=Ur("safe-polygon"),jx=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Rd}`;function Ix(e){return e?!!e.closest(jx):!1}function Tf(e){const t=h.useRef(void 0),n=h.useRef(!1),r=h.useRef(void 0),s=h.useRef(!0),o=h.useRef(!1),i=h.useRef(()=>{}),a=h.useRef(!1),l=_n(),c=_n(),u=h.useRef(void 0);return h.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 Fx=new Set(["click","mousedown"]);function Lx(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:m,unbindMouseMoveRef:p,restTimeoutPendingRef:g,openChangeTimeout:b,handleCloseOptionsRef:w}=Tf(n),x=wr(c),v=Hn(),k=he(()=>d.current?!0:i.current.openEvent?Fx.has(i.current.openEvent.type):!1),S=he(()=>{const T=i.current.openEvent?.type;return T?.includes("mouse")&&T!=="mousedown"}),C=h.useCallback((T,R=!0)=>{const A=Vx(l,u.current);A&&!f.current?b.start(A,()=>n.setOpen(!1,Le(dt,T))):R&&(b.clear(),n.setOpen(!1,Le(dt,T)))},[l,f,n,u,b]),D=he(()=>{p.current(),f.current=void 0}),E=he(()=>{if(m.current){const T=qe(s).body;T.style.pointerEvents="",T.removeAttribute(_i),m.current=!1}}),O=he(T=>{const R=ft(T);if(!Ix(R)){d.current=!1;return}d.current=!0});Te(()=>{r||(u.current=void 0,g.current=!1,d.current=!1,D(),E())},[r,u,g,d,D,E]),h.useEffect(()=>()=>{D()},[D]),h.useEffect(()=>E,[E]),Te(()=>{if(a&&r&&w.current?.blockPointerEvents&&S()&&Ae(o)&&s){m.current=!0;const T=qe(s).body;T.setAttribute(_i,"");const R=o,A=s,M=x?.nodesRef.current.find(I=>I.id===v)?.context?.elements.floating;return M&&(M.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,m]),h.useEffect(()=>{if(!a)return;function T(I){if(k()||!i.current.floatingContext||!n.select("open"))return;const j=n.context.triggerElements;I.relatedTarget&&j.hasElement(I.relatedTarget)||(E(),D(),k()||C(I))}function R(I){b.clear(),E(),f.current?.(I),D()}function A(I){k()||C(I,!1)}const M=s;return M&&(M.addEventListener("mouseleave",T),M.addEventListener("mouseenter",R),M.addEventListener("mouseleave",A),M.addEventListener("pointerdown",O,!0)),()=>{M&&(M.removeEventListener("mouseleave",T),M.removeEventListener("mouseenter",R),M.removeEventListener("mouseleave",A),M.removeEventListener("pointerdown",O,!0))}})}function Vx(e,t){return t&&!dr(t)?0:typeof e=="function"?e():e}function si(e){return typeof e=="function"?e():e}const _x={current:null};function Wx(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=_x,externalTree:f,isActiveTrigger:m=!0}=t,p=wr(f),{pointerTypeRef:g,interactedInsideRef:b,handlerRef:w,blockMouseMoveRef:x,performedPointerEventsMutationRef:v,unbindMouseMoveRef:k,restTimeoutPendingRef:S,openChangeTimeout:C,restTimeout:D,handleCloseOptionsRef:E}=Tf(n),O=$t(a),T=$t(i),R=$t(c);m&&(E.current=O.current?.__options);const A=he(()=>b.current?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),M=h.useCallback((U,P=!0)=>{const F=Qo(T.current,"close",g.current);F&&!w.current?C.start(F,()=>n.setOpen(!1,Le(dt,U))):P&&(C.clear(),n.setOpen(!1,Le(dt,U)))},[T,w,n,g,C]),I=he(()=>{k.current(),w.current=void 0}),j=he(()=>{if(v.current){const U=qe(n.select("domReferenceElement")).body;U.style.pointerEvents="",U.removeAttribute(_i),v.current=!1}});h.useEffect(()=>{if(!o)return;function U(P){P.open||(C.clear(),D.clear(),x.current=!0,S.current=!1)}return s.on("openchange",U),()=>{s.off("openchange",U)}},[o,s,C,D,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 F=d.current;O.current?.({...r.current.floatingContext,tree:p,x:U.clientX,y:U.clientY,onClose(){j(),I(),!A()&&F===n.select("domReferenceElement")&&M(U)}})(U)});return h.useEffect(()=>{if(!o)return;const U=d.current??(m?n.select("domReferenceElement"):null);if(!Ae(U))return;function P(B){if(C.clear(),x.current=!1,l&&!dr(g.current)||si(R.current)>0&&!Qo(T.current,"open"))return;const Q=Qo(T.current,"open",g.current),Y=n.select("domReferenceElement"),$=n.context.triggerElements,z=($.hasElement(B.target)||$.hasMatchingElement(Re=>we(Re,B.target)))&&(!Y||!we(Y,B.target)),Z=B.currentTarget??null,ce=n.select("open"),Se=!ce||z;z&&ce?n.setOpen(!0,Le(dt,B,Z)):Q?C.start(Q,()=>{Se&&n.setOpen(!0,Le(dt,B,Z))}):Se&&n.setOpen(!0,Le(dt,B,Z))}function F(B){if(A()){j();return}k.current();const Q=n.select("domReferenceElement"),Y=qe(Q);D.clear(),S.current=!1;const $=n.context.triggerElements;if(B.relatedTarget&&$.hasElement(B.relatedTarget))return;if(O.current&&r.current.floatingContext){n.select("open")||C.clear();const Z=d.current;w.current=O.current({...r.current.floatingContext,tree:p,x:B.clientX,y:B.clientY,onClose(){j(),I(),!A()&&Z===n.select("domReferenceElement")&&M(B,!0)}});const ce=w.current;ce(B),Y.addEventListener("mousemove",ce),k.current=()=>{Y.removeEventListener("mousemove",ce)};return}(g.current!=="touch"||!we(n.select("floatingElement"),B.relatedTarget))&&M(B)}function W(B){V(B)}return n.select("open")&&U.addEventListener("mouseleave",W),u&&U.addEventListener("mousemove",P,{once:!0}),U.addEventListener("mouseenter",P),U.addEventListener("mouseleave",F),()=>{U.removeEventListener("mouseleave",W),u&&U.removeEventListener("mousemove",P),U.removeEventListener("mouseenter",P),U.removeEventListener("mouseleave",F)}},[I,j,x,r,T,M,n,o,O,V,m,A,l,u,g,R,D,S,C,d,p,k,w]),h.useMemo(()=>{function U(P){g.current=P.pointerType}return{onPointerDown:U,onPointerEnter:U,onMouseMove(P){const{nativeEvent:F}=P,W=P.currentTarget,B=n.select("domReferenceElement"),Q=n.context.triggerElements,Y=n.select("open"),$=(Q.hasElement(P.target)||Q.hasMatchingElement(Z=>we(Z,P.target)))&&(!B||!we(B,P.target));if(l&&!dr(g.current)||Y&&!$||si(R.current)===0||!$&&S.current&&P.movementX**2+P.movementY**2<2)return;D.clear();function z(){if(S.current=!1,A())return;const Z=n.select("open");!x.current&&(!Z||$)&&n.setOpen(!0,Le(dt,F,W))}g.current==="touch"?pn.flushSync(()=>{z()}):$&&Y?z():(S.current=!0,D.start(si(R.current),z))}}},[x,A,l,n,g,R,D,S])}function Da(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=h.useCallback(c=>Os(c,e,"reference"),t),i=h.useCallback(c=>Os(c,e,"floating"),n),a=h.useCallback(c=>Os(c,e,"item"),r),l=h.useCallback(c=>Os(c,e,"trigger"),s);return h.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:a,getTriggerProps:l}),[o,i,a,l])}function Os(e,t,n){const r=new Map,s=n==="item",o={};n==="floating"&&(o.tabIndex=-1,o[Ni]="");for(const i in e)s&&e&&(i===Dd||i===Pd)||(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&&wc(o,a,s,r)}return wc(o,e,s,r),o}function wc(e,t,n,r){for(const s in t){const o=t[s];n&&(s===Dd||s===Pd)||(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 Bx=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Cf(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=h.useMemo(()=>ji(i)?.id||s,[i,s]),f=Bx.get(l)??l,p=Hn()!=null,g=h.useMemo(()=>f==="tooltip"||l==="label"?jn:{"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]),b=h.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=h.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=h.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 h.useMemo(()=>a?{reference:b,floating:w,item:x,trigger:g}:{},[a,b,w,g,x])}function kc(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 $x(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Yx(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 m=performance.now(),p=m-l;if(i===null||a===null||p===0)return i=d,a=f,l=m,null;const g=d-i,b=f-a,x=Math.sqrt(g*g+b*b)/p;return i=d,a=f,l=m,x}const u=({x:d,y:f,placement:m,elements:p,onClose:g,nodeId:b,tree:w})=>function(v){function k(){s.clear(),g()}if(s.clear(),!p.domReference||!p.floating||m==null||d==null||f==null)return;const{clientX:S,clientY:C}=v,D=[S,C],E=ft(v),O=v.type==="mouseleave",T=we(p.floating,E),R=we(p.domReference,E),A=p.domReference.getBoundingClientRect(),M=p.floating.getBoundingClientRect(),I=m.split("-")[0],j=d>M.right-M.width/2,V=f>M.bottom-M.height/2,U=$x(D,A),P=M.width>A.width,F=M.height>A.height,W=(P?A:M).left,B=(P?A:M).right,Q=(F?A:M).top,Y=(F?A:M).bottom;if(T&&(o=!0,!O))return;if(R&&(o=!1),R&&!O){o=!0;return}if(O&&Ae(v.relatedTarget)&&we(p.floating,v.relatedTarget)||w&&Fn(w.nodesRef.current,b).some(({context:Z})=>Z?.open))return;if(I==="top"&&f>=A.bottom-1||I==="bottom"&&f<=A.top+1||I==="left"&&d>=A.right-1||I==="right"&&d<=A.left+1)return k();let $=[];switch(I){case"top":$=[[W,A.top+1],[W,M.bottom-1],[B,M.bottom-1],[B,A.top+1]];break;case"bottom":$=[[W,M.top+1],[W,A.bottom-1],[B,A.bottom-1],[B,M.top+1]];break;case"left":$=[[M.right-1,Y],[M.right-1,Q],[A.left+1,Q],[A.left+1,Y]];break;case"right":$=[[A.right-1,Y],[A.right-1,Q],[M.left+1,Q],[M.left+1,Y]];break}function z([Z,ce]){switch(I){case"top":{const Se=[P?Z+t/2:j?Z+t*4:Z-t*4,ce+t+1],Re=[P?Z-t/2:j?Z+t*4:Z-t*4,ce+t+1],Ee=[[M.left,j||P?M.bottom-t:M.top],[M.right,j?P?M.bottom-t:M.top:M.bottom-t]];return[Se,Re,...Ee]}case"bottom":{const Se=[P?Z+t/2:j?Z+t*4:Z-t*4,ce-t],Re=[P?Z-t/2:j?Z+t*4:Z-t*4,ce-t],Ee=[[M.left,j||P?M.top+t:M.bottom],[M.right,j?P?M.top+t:M.bottom:M.top+t]];return[Se,Re,...Ee]}case"left":{const Se=[Z+t+1,F?ce+t/2:V?ce+t*4:ce-t*4],Re=[Z+t+1,F?ce-t/2:V?ce+t*4:ce-t*4];return[...[[V||F?M.right-t:M.left,M.top],[V?F?M.right-t:M.left:M.right-t,M.bottom]],Se,Re]}case"right":{const Se=[Z-t,F?ce+t/2:V?ce+t*4:ce-t*4],Re=[Z-t,F?ce-t/2:V?ce+t*4:ce-t*4],Ee=[[V||F?M.left+t:M.right,M.top],[V?F?M.left+t:M.right:M.left+t,M.bottom]];return[Se,Re,...Ee]}default:return[]}}if(!kc([S,C],$)){if(o&&!U)return k();if(!O&&r){const Z=c(v.clientX,v.clientY);if(Z!==null&&Z<.1)return k()}kc([S,C],z([d,f]))?!o&&r&&s.start(40,k):k()}};return u.__options={blockPointerEvents:n},u}function Hx(e){const t=h.useRef(""),n=h.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:h.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 Ef(e){const[t,n]=h.useState(null),r=he((a,l)=>{e||n(l||(Md?"touch":""))}),s=h.useCallback(()=>{n(null)},[]),{onClick:o,onPointerDown:i}=Hx(r);return h.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})({}),Wi=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Ux={[Wi.popupOpen]:""},Gx={[Wi.popupOpen]:"",[Wi.pressed]:""},Kx={[Pt.open]:""},zx={[Pt.closed]:""},qx={[Pt.anchorHidden]:""},Xx={open(e){return e?Ux:null}},Zx={open(e){return e?Gx:null}},os={open(e){return e?Kx:zx},anchorHidden(e){return e?qx:null}};function Mf(e){return md(19)?e:e?"true":void 0}let Sc={},Tc={},Cc="";function Qx(e){if(typeof document>"u")return!1;const t=Yn(e);return vt(t).innerWidth-t.documentElement.clientWidth>0}function Jx(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=Yn(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 ev(e){const t=Yn(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 tv(e){const t=Yn(e),n=t.documentElement,r=t.body,s=vt(n);let o=0,i=0,a=!1;const l=_t.create();if(Ey&&(s.visualViewport?.scale??1)!==1)return()=>{};function c(){const f=s.getComputedStyle(n),m=s.getComputedStyle(r),b=(f.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Sc={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Cc=n.style.scrollBehavior,Tc={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"||m.overflowY==="scroll",k=f.overflowX==="scroll"||m.overflowX==="scroll",S=Math.max(0,s.innerWidth-r.clientWidth),C=Math.max(0,s.innerHeight-r.clientHeight),D=parseFloat(m.marginTop)+parseFloat(m.marginBottom),E=parseFloat(m.marginLeft)+parseFloat(m.marginRight),O=rs(n)?n:r;if(a=Jx(e),a){n.style.scrollbarGutter=b,O.style.overflowY="hidden",O.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:b,overflowY:"hidden",overflowX:"hidden"}),(w||v)&&(n.style.overflowY="scroll"),(x||k)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:D||C?`calc(100dvh - ${D+C}px)`:"100dvh",width:E||S?`calc(100vw - ${E+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,Sc),Object.assign(r.style,Tc),a||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Cc)}function d(){u(),l.request(c)}return c(),s.addEventListener("resize",d),()=>{l.cancel(),u(),typeof s.removeEventListener=="function"&&s.removeEventListener("resize",d)}}class nv{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=Yn(t).documentElement,s=vt(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=pd;return}const o=Md||!Qx(t);this.restore=o?ev(t):tv(t)}}const rv=new nv;function Df(e=!0,t=null){Te(()=>{if(e)return rv.acquire(t)},[e,t])}const sv=h.createContext(void 0);function ov(){return h.useContext(sv)?.direction??"ltr"}const iv=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"}=rn(e,t)||{};if(c==null)return{};const f=Nd(u),m={x:n,y:r},p=xa(s),g=ba(p),b=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]-m[p]-o.floating[g],C=m[p]-o.reference[p],D=d==="real"?await i.getOffsetParent?.(c):a.floating;let E=a.floating[k]||o.floating[g];(!E||!await i.isElement?.(D))&&(E=a.floating[k]||o.floating[g]);const O=S/2-C/2,T=E/2-b[g]/2-1,R=Math.min(f[x],T),A=Math.min(f[v],T),M=R,I=E-b[g]-A,j=E/2-b[g]/2+O,V=Ii(M,j,I),U=!l.arrow&&xn(s)!=null&&j!==V&&o.reference[g]/2-(j<M?R:A)-b[g]/2<0,P=U?j<M?j-M:j-I:0;return{[p]:m[p]+P,data:{[p]:V,centerOffset:j-V-P,...U&&{alignmentOffset:P}},reset:U}}}),av=(e,t)=>({...iv(e),options:[e,t]}),lv={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 kx().fn(e)).data?.referenceHidden||o}}}},_s={sideX:"left",sideY:"top"},cv={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:_s};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=Yn(s);f={width:x.documentElement.clientWidth,height:x.documentElement.clientHeight}}else await o.isElement?.(d)&&(f=await o.getDimensions(d));const m=at(a);let p=t,g=n;m==="left"&&(p=f.width-(t+r.width)),m==="top"&&(g=f.height-(n+r.height));const b=m==="left"?"right":_s.sideX,w=m==="top"?"bottom":_s.sideY;return{x:p,y:g,data:{sideX:b,sideY:w}}}};function Pf(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 Ec(e,t,n){const{rects:r,placement:s}=e;return{side:Pf(t,at(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 uv(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:m,mounted:p,collisionAvoidance:g,shiftCrossAxis:b=!1,nodeId:w,adaptiveOrigin:x,lazyFlip:v=!1,externalTree:k}=e,[S,C]=h.useState(null);!p&&S!==null&&C(null);const D=g.side||"flip",E=g.align||"flip",O=g.fallbackAxisSide||"end",T=typeof t=="function"?t:void 0,R=he(T),A=T?R:t,M=$t(t),j=ov()==="rtl",V=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":j?"left":"right","inline-start":j?"right":"left"}[r],U=o==="center"?V:`${V}-${o}`;let P=l;const F=1,W=r==="bottom"?F:0,B=r==="top"?F:0,Q=r==="right"?F:0,Y=r==="left"?F:0;typeof P=="number"?P={top:P+W,right:P+Y,bottom:P+B,left:P+Q}:P&&(P={top:(P.top||0)+W,right:(P.right||0)+Y,bottom:(P.bottom||0)+B,left:(P.left||0)+Q});const $={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:P},z=h.useRef(null),Z=$t(s),ce=$t(i),Ee=[yx(De=>{const He=Ec(De,r,j),re=typeof Z.current=="function"?Z.current(He):Z.current,G=typeof ce.current=="function"?ce.current(He):ce.current;return{mainAxis:re,crossAxis:G,alignmentAxis:G}},[typeof s!="function"?s:0,typeof i!="function"?i:0,j,r])],et=E==="none"&&D!=="shift",L=!et&&(c||b||D==="shift"),ue=D==="none"?null:vx({...$,padding:{top:P.top+F,right:P.right+F,bottom:P.bottom+F,left:P.left+F},mainAxis:!b&&D==="flip",crossAxis:E==="flip"?"alignment":!1,fallbackAxisSideDirection:O}),te=et?null:bx(De=>{const He=Yn(De.elements.floating).documentElement;return{...$,rootBoundary:b?{x:0,y:0,width:He.clientWidth,height:He.clientHeight}:void 0,mainAxis:E!=="none",crossAxis:L,limiter:c||b?void 0:xx(re=>{if(!z.current)return{};const{width:G,height:oe}=z.current.getBoundingClientRect(),de=yt(at(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,b,P,E]);D==="shift"||E==="shift"||o==="center"?Ee.push(te,ue):Ee.push(ue,te),Ee.push(wx({...$,apply({elements:{floating:De},rects:{reference:He},availableWidth:re,availableHeight:G}){Object.entries({"--available-width":`${re}px`,"--available-height":`${G}px`,"--anchor-width":`${He.width}px`,"--anchor-height":`${He.height}px`}).forEach(([oe,de])=>{De.style.setProperty(oe,de)})}}),av(()=>({element:z.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(De){const{elements:He,middlewareData:re,placement:G,rects:oe,y:de}=De,xe=at(G),fe=yt(xe),jt=z.current,wn=re.arrow?.x||0,kn=re.arrow?.y||0,qt=jt?.clientWidth||0,cn=jt?.clientHeight||0,It=wn+qt/2,Er=kn+cn/2,Ft=Math.abs(re.shift?.y||0),nt=oe.reference.height/2,Sn=typeof s=="function"?s(Ec(De,r,j)):s,ys=Ft>Sn,Po={top:`${It}px calc(100% + ${Sn}px)`,bottom:`${It}px ${-Sn}px`,left:`calc(100% + ${Sn}px) ${Er}px`,right:`${-Sn}px ${Er}px`}[xe],ct=`${It}px ${oe.reference.y+nt-de}px`;return He.floating.style.setProperty("--transform-origin",L&&fe==="y"&&ys?ct:Po),{}}},lv,x),Te(()=>{!p&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[p,m]);const Me=h.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:Ve,isPositioned:be,floatingStyles:Be}=Nx({rootContext:m,placement:U,middleware:Ee,strategy:n,whileElementsMounted:f?void 0:(...De)=>xc(...De,Me),nodeId:w,externalTree:k}),{sideX:$e,sideY:it}=ge.adaptiveOrigin||_s,Oe=be?n:"fixed",ye=h.useMemo(()=>x?{position:Oe,[$e]:ie,[it]:me}:{position:Oe,...Be},[x,Oe,$e,ie,it,me,Be]),je=h.useRef(null);Te(()=>{if(!p)return;const De=M.current,He=typeof De=="function"?De():De,G=(Mc(He)?He.current:He)||null||null;G!==je.current&&(H.setPositionReference(G),je.current=G)},[p,H,A,M]),h.useEffect(()=>{if(!p)return;const De=M.current;typeof De!="function"&&Mc(De)&&De.current!==je.current&&(H.setPositionReference(De.current),je.current=De.current)},[p,H,A,M]),h.useEffect(()=>{if(f&&p&&se.domReference&&se.floating)return xc(se.domReference,se.floating,J,Me)},[f,p,se,J,Me]);const Ye=at(ne),Nt=Pf(r,Ye,j),kt=xn(ne)||"center",tt=!!ge.hide?.referenceHidden;Te(()=>{v&&p&&be&&C(Ye)},[v,p,be,Ye]);const ln=h.useMemo(()=>({position:"absolute",top:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),lt=ge.arrow?.centerOffset!==0;return h.useMemo(()=>({positionerStyles:ye,arrowStyles:ln,arrowRef:z,arrowUncentered:lt,side:Nt,align:kt,physicalSide:Ye,anchorHidden:tt,refs:H,context:Ve,isPositioned:be,update:J}),[ye,ln,z,lt,Nt,kt,Ye,tt,H,Ve,be,J])}function Mc(e){return e!=null&&"current"in e}const Rf=h.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 y.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})}),dv=h.createContext(void 0);function fv(e){return h.useContext(dv)}const Of="ArrowUp",Af="ArrowDown",Nf="ArrowLeft",jf="ArrowRight",If="Home",Ff="End",hv=new Set([Nf,jf]),mv=new Set([Of,Af]),pv=new Set([...hv,...mv]);[...pv];const Lf=new Set([Of,Af,Nf,jf,If,Ff]);function Vf(e){return e==="starting"?ky:jn}const Pa=h.createContext({});function is(e){const t=h.useRef(null);return t.current===null&&(t.current=e()),t.current}const gv=typeof window<"u",Ra=gv?h.useLayoutEffect:h.useEffect,wo=h.createContext(null);function Oa(e,t){e.indexOf(t)===-1&&e.push(t)}function io(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Kt=(e,t,n)=>n>t?t:n<e?e:n;let Aa=()=>{};const yn={},_f=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Wf(e){return typeof e=="object"&&e!==null}const Bf=e=>/^0[^.\s]+$/u.test(e);function $f(e){let t;return()=>(t===void 0&&(t=e()),t)}const wt=e=>e,yv=(e,t)=>n=>t(e(n)),as=(...e)=>e.reduce(yv),Kr=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Na{constructor(){this.subscriptions=[]}add(t){return Oa(this.subscriptions,t),()=>io(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 Yf(e,t){return t?e*(1e3/t):0}const Hf=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,bv=1e-7,xv=12;function vv(e,t,n,r,s){let o,i,a=0;do i=t+(n-t)/2,o=Hf(i,r,s)-e,o>0?n=i:t=i;while(Math.abs(o)>bv&&++a<xv);return i}function ls(e,t,n,r){if(e===t&&n===r)return wt;const s=o=>vv(o,0,1,e,n);return o=>o===0||o===1?o:Hf(s(o),t,r)}const Uf=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Gf=e=>t=>1-e(1-t),Kf=ls(.33,1.53,.69,.99),ja=Gf(Kf),zf=Uf(ja),qf=e=>e>=1?1:(e*=2)<1?.5*ja(e):.5*(2-Math.pow(2,-10*(e-1))),Ia=e=>1-Math.sin(Math.acos(e)),Xf=Gf(Ia),Zf=Uf(Ia),wv=ls(.42,0,1,1),kv=ls(0,0,.58,1),Qf=ls(.42,0,.58,1),Sv=e=>Array.isArray(e)&&typeof e[0]!="number",Jf=e=>Array.isArray(e)&&typeof e[0]=="number",Tv={linear:wt,easeIn:wv,easeInOut:Qf,easeOut:kv,circIn:Ia,circInOut:Zf,circOut:Xf,backIn:ja,backInOut:zf,backOut:Kf,anticipate:qf},Cv=e=>typeof e=="string",Dc=e=>{if(Jf(e)){Aa(e.length===4);const[t,n,r,s]=e;return ls(t,n,r,s)}else if(Cv(e))return Tv[e];return e},As=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Ev(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 Mv=40;function eh(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,i=As.reduce((v,k)=>(v[k]=Ev(o),v),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:f,render:m,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,Mv),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),m.process(s),p.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(g))},b=()=>{n=!0,r=!0,s.isProcessing||e(g)};return{schedule:As.reduce((v,k)=>{const S=i[k];return v[k]=(C,D=!1,E=!1)=>(n||b(),S.schedule(C,D,E)),v},{}),cancel:v=>{for(let k=0;k<As.length;k++)i[As[k]].cancel(v)},state:s,steps:i}}const{schedule:ke,cancel:sn,state:Ze,steps:oi}=eh(typeof requestAnimationFrame<"u"?requestAnimationFrame:wt,!0);let Ws;function Dv(){Ws=void 0}const st={now:()=>(Ws===void 0&&st.set(Ze.isProcessing||yn.useManualTiming?Ze.timestamp:performance.now()),Ws),set:e=>{Ws=e,queueMicrotask(Dv)}},th=e=>t=>typeof t=="string"&&t.startsWith(e),nh=th("--"),Pv=th("var(--"),Fa=e=>Pv(e)?Rv.test(e.split("/*")[0].trim()):!1,Rv=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Pc(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=>Kt(0,1,e)},Ns={...kr,default:1},_r=e=>Math.round(e*1e5)/1e5,La=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ov(e){return e==null}const Av=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Va=(e,t)=>n=>!!(typeof n=="string"&&Av.test(n)&&n.startsWith(e)||t&&!Ov(n)&&Object.prototype.hasOwnProperty.call(n,t)),rh=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,o,i,a]=r.match(La);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(i),alpha:a!==void 0?parseFloat(a):1}},Nv=e=>Kt(0,255,e),ii={...kr,transform:e=>Math.round(Nv(e))},On={test:Va("rgb","red"),parse:rh("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+ii.transform(e)+", "+ii.transform(t)+", "+ii.transform(n)+", "+_r(zr.transform(r))+")"};function jv(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 Bi={test:Va("#"),parse:jv,transform:On.transform},cs=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),dn=cs("deg"),Gt=cs("%"),ee=cs("px"),Iv=cs("vh"),Fv=cs("vw"),Rc={...Gt,parse:e=>Gt.parse(e)/100,transform:e=>Gt.transform(e*100)},nr={test:Va("hsl","hue"),parse:rh("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Gt.transform(_r(t))+", "+Gt.transform(_r(n))+", "+_r(zr.transform(r))+")"},Ue={test:e=>On.test(e)||Bi.test(e)||nr.test(e),parse:e=>On.test(e)?On.parse(e):nr.test(e)?nr.parse(e):Bi.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?On.transform(e):nr.transform(e),getAnimatableNone:e=>{const t=Ue.parse(e);return t.alpha=0,Ue.transform(t)}},Lv=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Vv(e){return isNaN(e)&&typeof e=="string"&&(e.match(La)?.length||0)+(e.match(Lv)?.length||0)>0}const sh="number",oh="color",_v="var",Wv="var(",Oc="${}",Bv=/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(Bv,l=>(Ue.test(l)?(r.color.push(o),s.push(oh),n.push(Ue.parse(l))):l.startsWith(Wv)?(r.var.push(o),s.push(_v),n.push(l)):(r.number.push(o),s.push(sh),n.push(parseFloat(l))),++o,Oc)).split(Oc);return{values:n,split:a,indexes:r,types:s}}function $v(e){return pr(e).values}function ih({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===sh?s+=_r(r[o]):i===oh?s+=Ue.transform(r[o]):s+=r[o]}return s}}function Yv(e){return ih(pr(e))}const Hv=e=>typeof e=="number"?0:Ue.test(e)?Ue.getAnimatableNone(e):e,Uv=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:Hv(e);function Gv(e){const t=pr(e);return ih(t)(t.values.map((r,s)=>Uv(r,t.split[s])))}const Ot={test:Vv,parse:$v,createTransformer:Yv,getAnimatableNone:Gv};function ai(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 Kv({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=ai(l,a,e+1/3),o=ai(l,a,e),i=ai(l,a,e-1/3)}return{red:Math.round(s*255),green:Math.round(o*255),blue:Math.round(i*255),alpha:r}}function ao(e,t){return n=>n>0?t:e}const Ne=(e,t,n)=>e+(t-e)*n,li=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},zv=[Bi,On,nr],qv=e=>zv.find(t=>t.test(e));function Ac(e){const t=qv(e);if(!t)return!1;let n=t.parse(e);return t===nr&&(n=Kv(n)),n}const Nc=(e,t)=>{const n=Ac(e),r=Ac(t);if(!n||!r)return ao(e,t);const s={...n};return o=>(s.red=li(n.red,r.red,o),s.green=li(n.green,r.green,o),s.blue=li(n.blue,r.blue,o),s.alpha=Ne(n.alpha,r.alpha,o),On.transform(s))},$i=new Set(["none","hidden"]);function Xv(e,t){return $i.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Zv(e,t){return n=>Ne(e,t,n)}function _a(e){return typeof e=="number"?Zv:typeof e=="string"?Fa(e)?ao:Ue.test(e)?Nc:ew:Array.isArray(e)?ah:typeof e=="object"?Ue.test(e)?Nc:Qv:ao}function ah(e,t){const n=[...e],r=n.length,s=e.map((o,i)=>_a(o)(o,t[i]));return o=>{for(let i=0;i<r;i++)n[i]=s[i](o);return n}}function Qv(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=_a(e[s])(e[s],t[s]));return s=>{for(const o in r)n[o]=r[o](s);return n}}function Jv(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 ew=(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?$i.has(e)&&!s.values.length||$i.has(t)&&!r.values.length?Xv(e,t):as(ah(Jv(r,s),s.values),n):ao(e,t)};function lh(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Ne(e,t,n):_a(e)(e,t)}const tw=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ke.update(t,n),stop:()=>sn(t),now:()=>Ze.isProcessing?Ze.timestamp:st.now()}},ch=(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)})`},lo=2e4;function Wa(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<lo;)t+=n,r=e.next(t);return t>=lo?1/0:t}function nw(e,t=100,n){const r=n({...e,keyframes:[0,t]}),s=Math.min(Wa(r),lo);return{type:"keyframes",ease:o=>r.next(s*o).value/t,duration:bt(s)}}const We={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 Yi(e,t){return e*Math.sqrt(1-t*t)}const rw=12;function sw(e,t,n){let r=n;for(let s=1;s<rw;s++)r=r-e(r)/t(r);return r}const ci=.001;function ow({duration:e=We.duration,bounce:t=We.bounce,velocity:n=We.velocity,mass:r=We.mass}){let s,o,i=1-t;i=Kt(We.minDamping,We.maxDamping,i),e=Kt(We.minDuration,We.maxDuration,bt(e)),i<1?(s=c=>{const u=c*i,d=u*e,f=u-n,m=Yi(c,i),p=Math.exp(-d);return ci-f/m*p},o=c=>{const d=c*i*e,f=d*n+n,m=Math.pow(i,2)*Math.pow(c,2)*e,p=Math.exp(-d),g=Yi(Math.pow(c,2),i);return(-s(c)+ci>0?-1:1)*((f-m)*p)/g}):(s=c=>{const u=Math.exp(-c*e),d=(c-n)*e+1;return-ci+u*d},o=c=>{const u=Math.exp(-c*e),d=(n-c)*(e*e);return u*d});const a=5/e,l=sw(s,o,a);if(e=mt(e),isNaN(l))return{stiffness:We.stiffness,damping:We.damping,duration:e};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:i*2*Math.sqrt(r*c),duration:e}}}const iw=["duration","bounce"],aw=["stiffness","damping","mass"];function jc(e,t){return t.some(n=>e[n]!==void 0)}function lw(e){let t={velocity:We.velocity,stiffness:We.stiffness,damping:We.damping,mass:We.mass,isResolvedFromDuration:!1,...e};if(!jc(e,aw)&&jc(e,iw))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,o=2*Kt(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:We.mass,stiffness:s,damping:o}}else{const n=ow({...e,velocity:0});t={...t,...n,mass:We.mass},t.isResolvedFromDuration=!0}return t}function co(e=We.visualDuration,t=We.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:m}=lw({...n,velocity:-bt(n.velocity||0)}),p=f||0,g=c/(2*Math.sqrt(l*u)),b=i-o,w=bt(Math.sqrt(l/u)),x=Math.abs(b)<5;r||(r=x?We.restSpeed.granular:We.restSpeed.default),s||(s=x?We.restDelta.granular:We.restDelta.default);let v,k,S,C,D,E;if(g<1)S=Yi(w,g),C=(p+g*w*b)/S,v=T=>{const R=Math.exp(-g*w*T);return i-R*(C*Math.sin(S*T)+b*Math.cos(S*T))},D=g*w*C+b*S,E=g*w*b-C*S,k=T=>Math.exp(-g*w*T)*(D*Math.sin(S*T)+E*Math.cos(S*T));else if(g===1){v=R=>i-Math.exp(-w*R)*(b+(p+w*b)*R);const T=p+w*b;k=R=>Math.exp(-w*R)*(w*T*R-p)}else{const T=w*Math.sqrt(g*g-1);v=I=>{const j=Math.exp(-g*w*I),V=Math.min(T*I,300);return i-j*((p+g*w*b)*Math.sinh(V)+T*b*Math.cosh(V))/T};const R=(p+g*w*b)/T,A=g*w*R-b*T,M=g*w*b-R*T;k=I=>{const j=Math.exp(-g*w*I),V=Math.min(T*I,300);return j*(A*Math.sinh(V)+M*Math.cosh(V))}}const O={calculatedDuration:m&&d||null,velocity:T=>mt(k(T)),next:T=>{if(!m&&g<1){const A=Math.exp(-g*w*T),M=Math.sin(S*T),I=Math.cos(S*T),j=i-A*(C*M+b*I),V=mt(A*(D*M+E*I));return a.done=Math.abs(V)<=r&&Math.abs(i-j)<=s,a.value=a.done?i:j,a}const R=v(T);if(m)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(Wa(O),lo),R=ch(A=>O.next(T*A).value,T,30);return T+"ms "+R},toTransition:()=>{}};return O}co.applyToOptions=e=>{const t=nw(e,100,co);return e.ease=t.ease,e.duration=mt(t.duration),e.type="keyframes",e};const cw=5;function uh(e,t,n){const r=Math.max(t-cw,0);return Yf(n-e(r),t-r)}function Hi({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},m=E=>a!==void 0&&E<a||l!==void 0&&E>l,p=E=>a===void 0?l:l===void 0||Math.abs(a-E)<Math.abs(l-E)?a:l;let g=n*t;const b=d+g,w=i===void 0?b:i(b);w!==b&&(g=w-d);const x=E=>-g*Math.exp(-E/r),v=E=>w+x(E),k=E=>{const O=x(E),T=v(E);f.done=Math.abs(O)<=c,f.value=f.done?w:T};let S,C;const D=E=>{m(f.value)&&(S=E,C=co({keyframes:[f.value,p(f.value)],velocity:uh(v,E,f.value),damping:s,stiffness:o,restDelta:c,restSpeed:u}))};return D(0),{calculatedDuration:null,next:E=>{let O=!1;return!C&&S===void 0&&(O=!0,k(E),D(E)),S!==void 0&&E>=S?C.next(E-S):(!O&&k(E),f)}}}function uw(e,t,n){const r=[],s=n||yn.mix||lh,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=as(l,a)}r.push(a)}return r}function dh(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const o=e.length;if(Aa(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=uw(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(Kt(e[0],e[o-1],u)):c}function dw(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 fw(e){const t=[0];return dw(t,e.length-1),t}function hw(e,t){return e.map(n=>n*t)}function mw(e,t){return e.map(()=>t||Qf).splice(0,e.length-1)}function Wr({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=Sv(r)?r.map(Dc):Dc(r),o={done:!1,value:t[0]},i=hw(n&&n.length===t.length?n:fw(t),e),a=dh(i,t,{ease:Array.isArray(s)?s:mw(t,s)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}const pw=e=>e!==null;function ko(e,{repeat:t,repeatType:n="loop"},r,s=1){const o=e.filter(pw),a=s<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!a||r===void 0?o[a]:r}const gw={decay:Hi,inertia:Hi,tween:Wr,keyframes:Wr,spring:co};function fh(e){typeof e.type=="string"&&(e.type=gw[e.type])}class Ba{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 yw=e=>e/100;class qr extends Ba{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!==st.now()&&this.tick(st.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;fh(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=as(yw,lh(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=Wa(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:m,type:p,onUpdate:g,finalKeyframe:b}=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 E=Math.min(this.currentTime,s)/a;let O=Math.floor(E),T=E%1;!T&&E>=1&&(T=1),T===1&&O--,O=Math.min(O,d+1),O%2&&(f==="reverse"?(T=1-T,m&&(T-=m/a)):f==="mirror"&&(k=i)),v=Kt(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 D=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return D&&p!==Hi&&(S.value=ko(u,this.options,b,this.speed)),g&&g(S.value),D&&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 uh(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(st.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=bt(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=tw,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(st.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 bw(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const An=e=>e*180/Math.PI,Ui=e=>{const t=An(Math.atan2(e[1],e[0]));return Gi(t)},xw={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ui,rotateZ:Ui,skewX:e=>An(Math.atan(e[1])),skewY:e=>An(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Gi=e=>(e=e%360,e<0&&(e+=360),e),Ic=Ui,Fc=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Lc=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),vw={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Fc,scaleY:Lc,scale:e=>(Fc(e)+Lc(e))/2,rotateX:e=>Gi(An(Math.atan2(e[6],e[5]))),rotateY:e=>Gi(An(Math.atan2(-e[2],e[0]))),rotateZ:Ic,rotate:Ic,skewX:e=>An(Math.atan(e[4])),skewY:e=>An(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Ki(e){return e.includes("scale")?1:0}function zi(e,t){if(!e||e==="none")return Ki(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=vw,s=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=xw,s=a}if(!s)return Ki(t);const o=r[t],i=s[1].split(",").map(kw);return typeof o=="function"?o(i):i[o]}const ww=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return zi(n,t)};function kw(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),Vc=e=>e===kr||e===ee,Sw=new Set(["x","y","z"]),Tw=Sr.filter(e=>!Sw.has(e));function Cw(e){const t=[];return Tw.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})=>zi(t,"x"),y:(e,{transform:t})=>zi(t,"y")};hn.translateX=hn.x;hn.translateY=hn.y;const Ln=new Set;let qi=!1,Xi=!1,Zi=!1;function hh(){if(Xi){const e=Array.from(Ln).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=Cw(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)})}Xi=!1,qi=!1,Ln.forEach(e=>e.complete(Zi)),Ln.clear()}function mh(){Ln.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Xi=!0)})}function Ew(){Zi=!0,mh(),hh(),Zi=!1}class $a{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?(Ln.add(this),qi||(qi=!0,ke.read(mh),ke.resolveKeyframes(hh))):(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])}bw(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ln.delete(this)}cancel(){this.state==="scheduled"&&(Ln.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Mw=e=>e.startsWith("--");function ph(e,t,n){Mw(t)?e.style.setProperty(t,n):e.style[t]=n}const Dw={};function gh(e,t){const n=$f(e);return()=>Dw[t]??n()}const Pw=gh(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),yh=gh(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Fr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,_c={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Fr([0,.65,.55,1]),circOut:Fr([.55,0,1,.45]),backIn:Fr([.31,.01,.66,-.59]),backOut:Fr([.33,1.53,.69,.99])};function bh(e,t){if(e)return typeof e=="function"?yh()?ch(e,t):"ease-out":Jf(e)?Fr(e):Array.isArray(e)?e.map(n=>bh(n,t)||_c.easeOut):_c[e]}function Rw(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=bh(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 xh(e){return typeof e=="function"&&"applyToOptions"in e}function Ow({type:e,...t}){return xh(e)&&yh()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class vh extends Ba{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,Aa(typeof t.type!="string");const c=Ow(t);this.animation=Rw(n,r,s,c,o),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const u=ko(s,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(u),ph(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&&Pw()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),wt):s(this)}}const wh={anticipate:qf,backInOut:zf,circInOut:Zf};function Aw(e){return e in wh}function Nw(e){typeof e.ease=="string"&&Aw(e.ease)&&(e.ease=wh[e.ease])}const ui=10;class jw extends vh{constructor(t){Nw(t),fh(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(ui,st.now()-this.startTime),c=Kt(0,ui,l-ui),u=a.sample(l).value,{name:d}=this.options;o&&d&&ph(o,d,u),n.setWithVelocity(a.sample(Math.max(0,l-c)).value,u,c),a.stop()}}const Wc=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ot.test(e)||e==="0")&&!e.startsWith("url("));function Iw(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 Fw(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=Wc(s,t),a=Wc(o,t);return!i||!a?!1:Iw(e)||(n==="spring"||xh(n))&&r}function Qi(e){e.duration=0,e.type="keyframes"}const kh=new Set(["opacity","clipPath","filter","transform"]),Lw=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Vw(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&Lw.test(e[t]))return!0;return!1}const _w=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Ww=$f(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Bw(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 Ww()&&n&&(kh.has(n)||_w.has(n)&&Vw(a))&&(n!=="transform"||!u)&&!c&&!r&&s!=="mirror"&&o!==0&&i!=="inertia"}const $w=40;class Yw extends Ba{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=st.now();const f={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:o,repeatType:i,name:l,motionValue:c,element:u,...d},m=u?.KeyframeResolver||$a;this.keyframeResolver=new m(a,(p,g,b)=>this.onKeyframesResolved(p,g,f,!b),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=st.now();let d=!0;Fw(t,o,i,a)||(d=!1,(yn.instantAnimations||!l)&&u?.(ko(t,r,n)),t[0]=t[t.length-1],Qi(r),r.repeat=0);const m={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>$w?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},p=d&&!c&&Bw(m),g=m.motionValue?.owner?.current;let b;if(p)try{b=new jw({...m,element:g})}catch{b=new qr(m)}else b=new qr(m);b.finished.then(()=>{this.notifyFinished()}).catch(wt),this.pendingTimeline&&(this.stopTimeline=b.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=b}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(),Ew()),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 Sh(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 Hw=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Uw(e){const t=Hw.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function Th(e,t,n=1){const[r,s]=Uw(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const i=o.trim();return _f(i)?parseFloat(i):i}return Fa(s)?Th(s,t,n+1):s}const Gw={type:"spring",stiffness:500,damping:25,restSpeed:10},Kw=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),zw={type:"keyframes",duration:.8},qw={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Xw=(e,{keyframes:t})=>t.length>2?zw:Tr.has(e)?e.startsWith("scale")?Kw(t[1]):Gw:qw;function Ch(e,t){if(e?.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Ya(e,t){const n=e?.[t]??e?.default??e;return n!==e?Ch(n,e):n}const Zw=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function Qw(e){for(const t in e)if(!Zw.has(t))return!0;return!1}const Ha=(e,t,n,r={},s,o)=>i=>{const a=Ya(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};Qw(a)||Object.assign(u,Xw(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)&&(Qi(u),u.delay===0&&(d=!0)),(yn.instantAnimations||yn.skipAnimations||s?.shouldSkipAnimations)&&(d=!0,Qi(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,d&&!o&&t.get()!==void 0){const f=ko(u.keyframes,a);if(f!==void 0){ke.update(()=>{u.onUpdate(f),u.onComplete()});return}}return a.isSync?new qr(u):new Yw(u)};function Bc(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Ua(e,t,n,r){if(typeof t=="function"){const[s,o]=Bc(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]=Bc(r);t=t(n!==void 0?n:e.custom,s,o)}return t}function Vn(e,t,n){const r=e.getProps();return Ua(r,t,n!==void 0?n:r.custom,e)}const Eh=new Set(["width","height","top","left","right","bottom",...Sr]),$c=30,Jw=e=>!isNaN(parseFloat(e)),Br={current:void 0};class ek{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const s=st.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=st.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Jw(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 Na);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=st.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>$c)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,$c);return Yf(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 Bn(e,t){return new ek(e,t)}const Ji=e=>Array.isArray(e);function tk(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Bn(n))}function nk(e){return Ji(e)?e[e.length-1]||0:e}function rk(e,t){const n=Vn(e,t);let{transitionEnd:r={},transition:s={},...o}=n||{};o={...o,...r};for(const i in o){const a=nk(o[i]);tk(e,i,a)}}const Xe=e=>!!(e&&e.getVelocity);function sk(e){return!!(Xe(e)&&e.add)}function ea(e,t){const n=e.getValue("willChange");if(sk(n))return n.add(t);if(!n&&yn.WillChange){const r=new yn.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Ga(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const ok="framerAppearId",Mh="data-"+Ga(ok);function Dh(e){return e.props[Mh]}function ik({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Ph(e,t,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:o,transitionEnd:i,...a}=t;const l=e.getDefaultTransition();o=o?Ch(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 m=e.getValue(f,e.latestValues[f]??null),p=a[f];if(p===void 0||d&&ik(d,f))continue;const g={delay:n,...Ya(o||{},f)},b=m.get();if(b!==void 0&&!m.isAnimating()&&!Array.isArray(p)&&p===b&&!g.velocity){ke.update(()=>m.set(p));continue}let w=!1;if(window.MotionHandoffAnimation){const k=Dh(e);if(k){const S=window.MotionHandoffAnimation(k,f,ke);S!==null&&(g.startTime=S,w=!0)}}ea(e,f);const x=c??e.shouldReduceMotion;m.start(Ha(f,m,p,x&&Eh.has(f)?{type:!1}:g,e,w));const v=m.animation;v&&u.push(v)}if(i){const f=()=>ke.update(()=>{i&&rk(e,i)});u.length?Promise.all(u).then(f):f()}return u}function ta(e,t,n={}){const r=Vn(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(Ph(e,r,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:u,staggerDirection:d}=s;return ak(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 ak(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(ta(l,t,{...i,delay:n+(typeof r=="function"?0:r)+Sh(e.variantChildren,l,r,s,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}function lk(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(o=>ta(e,o,n));r=Promise.all(s)}else if(typeof t=="string")r=ta(e,t,n);else{const s=typeof t=="function"?Vn(e,t,n.custom):t;r=Promise.all(Ph(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const ck={test:e=>e==="auto",parse:e=>e},Rh=e=>t=>t.test(e),Oh=[kr,ee,Gt,dn,Fv,Iv,ck],Yc=e=>Oh.find(Rh(e));function uk(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Bf(e):!0}const dk=new Set(["brightness","contrast","saturate","opacity"]);function fk(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(La)||[];if(!r)return e;const s=n.replace(r,"");let o=dk.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+s+")"}const hk=/\b([a-z-]*)\(.*?\)/gu,na={...Ot,getAnimatableNone:e=>{const t=e.match(hk);return t?t.map(fk).join(" "):e}},ra={...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))}},Hc={...kr,transform:Math.round},mk={rotate:dn,rotateX:dn,rotateY:dn,rotateZ:dn,scale:Ns,scaleX:Ns,scaleY:Ns,scaleZ:Ns,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:Rc,originY:Rc,originZ:ee},Ka={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,...mk,zIndex:Hc,fillOpacity:zr,strokeOpacity:zr,numOctaves:Hc},pk={...Ka,color:Ue,backgroundColor:Ue,outlineColor:Ue,fill:Ue,stroke:Ue,borderColor:Ue,borderTopColor:Ue,borderRightColor:Ue,borderBottomColor:Ue,borderLeftColor:Ue,filter:na,WebkitFilter:na,mask:ra,WebkitMask:ra},Ah=e=>pk[e],gk=new Set([na,ra]);function Nh(e,t){let n=Ah(e);return gk.has(n)||(n=Ot),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const yk=new Set(["auto","none","0"]);function bk(e,t,n){let r=0,s;for(;r<e.length&&!s;){const o=e[r];typeof o=="string"&&!yk.has(o)&&pr(o).values.length&&(s=e[r]),r++}if(s&&n)for(const o of t)e[o]=Nh(n,s)}class xk extends $a{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(),Fa(d))){const f=Th(d,n.current);f!==void 0&&(t[u]=f),u===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!Eh.has(r)||t.length!==2)return;const[s,o]=t,i=Yc(s),a=Yc(o),l=Pc(s),c=Pc(o);if(l!==c&&hn[r]){this.needsMeasurement=!0;return}if(i!==a)if(Vc(i)&&Vc(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||uk(t[s]))&&r.push(s);r.length&&bk(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 jh(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 Ih=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Bs(e){return Wf(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:za}=eh(queueMicrotask,!1),Dt={x:!1,y:!1};function Fh(){return Dt.x||Dt.y}function vk(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 Lh(e,t){const n=jh(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function wk(e){return!(e.pointerType==="touch"||Fh())}function kk(e,t,n={}){const[r,s,o]=Lh(e,n);return r.forEach(i=>{let a=!1,l=!1,c;const u=()=>{i.removeEventListener("pointerleave",p)},d=b=>{c&&(c(b),c=void 0),u()},f=b=>{a=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,d(b))},m=()=>{a=!0,window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",f,s)},p=b=>{if(b.pointerType!=="touch"){if(a){l=!0;return}d(b)}},g=b=>{if(!wk(b))return;l=!1;const w=t(i,b);typeof w=="function"&&(c=w,i.addEventListener("pointerleave",p,s))};i.addEventListener("pointerenter",g,s),i.addEventListener("pointerdown",m,s)}),o}const Vh=(e,t)=>t?e===t?!0:Vh(e,t.parentElement):!1,qa=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Sk=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Tk(e){return Sk.has(e.tagName)||e.isContentEditable===!0}const Ck=new Set(["INPUT","SELECT","TEXTAREA"]);function Ek(e){return Ck.has(e.tagName)||e.isContentEditable===!0}const $s=new WeakSet;function Uc(e){return t=>{t.key==="Enter"&&e(t)}}function di(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Mk=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Uc(()=>{if($s.has(n))return;di(n,"down");const s=Uc(()=>{di(n,"up")}),o=()=>di(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 Gc(e){return qa(e)&&!Fh()}const Kc=new WeakSet;function Dk(e,t,n={}){const[r,s,o]=Lh(e,n),i=a=>{const l=a.currentTarget;if(!Gc(a)||Kc.has(a))return;$s.add(l),n.stopPropagation&&Kc.add(a);const c=t(l,a),u=(m,p)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",f),$s.has(l)&&$s.delete(l),Gc(m)&&typeof c=="function"&&c(m,{success:p})},d=m=>{u(m,l===window||l===document||n.useGlobalTarget||Vh(l,m.target))},f=m=>{u(m,!1)};window.addEventListener("pointerup",d,s),window.addEventListener("pointercancel",f,s)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",i,s),Bs(a)&&(a.addEventListener("focus",c=>Mk(c,s)),!Tk(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),o}function Xa(e){return Wf(e)&&"ownerSVGElement"in e}const Ys=new WeakMap;let Hs;const _h=(e,t,n)=>(r,s)=>s&&s[0]?s[0][e+"Size"]:Xa(r)&&"getBBox"in r?r.getBBox()[t]:r[n],Pk=_h("inline","width","offsetWidth"),Rk=_h("block","height","offsetHeight");function Ok({target:e,borderBoxSize:t}){Ys.get(e)?.forEach(n=>{n(e,{get width(){return Pk(e,t)},get height(){return Rk(e,t)}})})}function Ak(e){e.forEach(Ok)}function Nk(){typeof ResizeObserver>"u"||(Hs=new ResizeObserver(Ak))}function jk(e,t){Hs||Nk();const n=jh(e);return n.forEach(r=>{let s=Ys.get(r);s||(s=new Set,Ys.set(r,s)),s.add(t),Hs?.observe(r)}),()=>{n.forEach(r=>{const s=Ys.get(r);s?.delete(t),s?.size||Hs?.unobserve(r)})}}const Us=new Set;let rr;function Ik(){rr=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Us.forEach(t=>t(e))},window.addEventListener("resize",rr)}function Fk(e){return Us.add(e),rr||Ik(),()=>{Us.delete(e),!Us.size&&typeof rr=="function"&&(window.removeEventListener("resize",rr),rr=void 0)}}function zc(e,t){return typeof e=="function"?Fk(e):jk(e,t)}function Lk(e){return Xa(e)&&e.tagName==="svg"}function Vk(...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=dh(s,o,i);return t?a(r):a}function _k(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=qc(e.get()),f=qc(o);if(d===f){l();return}const m=s?s.getGeneratorVelocity():e.getVelocity();l(),s=new qr({keyframes:[d,f],velocity:m,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=m=>f(fi(m,a)),ke.postRender(u)},l),Xe(t)){let d=n.skipInitialAnimation===!0;const f=t.on("change",p=>{d?(d=!1,e.jump(fi(p,a),!1)):e.set(fi(p,a))}),m=e.on("destroy",f);return()=>{f(),m()}}return l}function fi(e,t){return t?e+t:e}function qc(e){return typeof e=="number"?e:parseFloat(e)}const Wk=[...Oh,Ue,Ot],Bk=e=>Wk.find(Rh(e)),Xc=()=>({translate:0,scale:1,origin:0,originPoint:0}),sr=()=>({x:Xc(),y:Xc()}),Zc=()=>({min:0,max:0}),ze=()=>({x:Zc(),y:Zc()}),$k=new WeakMap;function So(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Xr(e){return typeof e=="string"||Array.isArray(e)}const Za=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Qa=["initial",...Za];function To(e){return So(e.animate)||Qa.some(t=>Xr(e[t]))}function Wh(e){return!!(To(e)||e.variants)}function Yk(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,Bn(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,Bn(i!==void 0?i:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const uo={current:null},Ja={current:!1},Hk=typeof window<"u";function Bh(){if(Ja.current=!0,!!Hk)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>uo.current=e.matches;e.addEventListener("change",t),t()}else uo.current=!1}const Qc=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let fo={};function $h(e){fo=e}function Uk(){return fo}class Gk{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=$a,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 m=st.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,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=To(n),this.isVariantNode=Wh(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in f){const p=f[m];c[m]!==void 0&&Xe(p)&&p.set(c[m])}}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,$k.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:(Ja.current||Bh(),this.shouldReduceMotion=uo.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(),sn(this.notifyUpdate),sn(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&&kh.has(t)&&this.current instanceof HTMLElement){const{factory:i,keyframes:a,times:l,ease:c,duration:u}=n.accelerate,d=new vh({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 fo){const n=fo[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<Qc.length;r++){const s=Qc[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=Yk(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=Bn(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"&&(_f(r)||Bf(r))?r=parseFloat(r):!Bk(r)&&Ot.test(n)&&(r=Nh(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=Ua(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 Na),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){za.render(this.render)}}class Yh extends Gk{constructor(){super(...arguments),this.KeyframeResolver=xk}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 Hh({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Kk({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function zk(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 hi(e){return e===void 0||e===1}function sa({scale:e,scaleX:t,scaleY:n}){return!hi(e)||!hi(t)||!hi(n)}function Dn(e){return sa(e)||Uh(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Uh(e){return Jc(e.x)||Jc(e.y)}function Jc(e){return e&&e!=="0%"}function ho(e,t,n){const r=e-n,s=t*r;return n+s}function eu(e,t,n,r,s){return s!==void 0&&(e=ho(e,s,r)),ho(e,n,r)+t}function oa(e,t=0,n=1,r,s){e.min=eu(e.min,t,n,r,s),e.max=eu(e.max,t,n,r,s)}function Gh(e,{x:t,y:n}){oa(e.x,t.translate,t.scale,t.originPoint),oa(e.y,n.translate,n.scale,n.originPoint)}const tu=.999999999999,nu=1.0000000000001;function qk(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&&(Wt(e.x,-o.scroll.offset.x),Wt(e.y,-o.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,Gh(e,i)),r&&Dn(o.latestValues)&&Gs(e,o.latestValues,o.layout?.layoutBox))}t.x<nu&&t.x>tu&&(t.x=1),t.y<nu&&t.y>tu&&(t.y=1)}function Wt(e,t){e.min+=t,e.max+=t}function ru(e,t,n,r,s=.5){const o=Ne(e.min,e.max,s);oa(e,t,n,o,r)}function su(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Gs(e,t,n){const r=n??e;ru(e.x,su(t.x,r.x),t.scaleX,t.scale,t.originX),ru(e.y,su(t.y,r.y),t.scaleY,t.scale,t.originY)}function Kh(e,t){return Hh(zk(e.getBoundingClientRect(),t))}function Xk(e,t,n){const r=Kh(e,n),{scroll:s}=t;return s&&(Wt(r.x,s.offset.x),Wt(r.y,s.offset.y)),r}const Zk={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Qk=Sr.length;function Jk(e,t,n){let r="",s=!0;for(let o=0;o<Qk;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=Ih(a,Ka[i]);if(!l){s=!1;const u=Zk[i]||i;r+=`${u}(${c}) `}n&&(t[i]=c)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function el(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(nh(l)){s[l]=c;continue}else{const u=Ih(c,Ka[l]);l.startsWith("origin")?(a=!0,o[l]=u):r[l]=u}}if(t.transform||(i||n?r.transform=Jk(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 zh(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 ou(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=ou(e,t.target.x),r=ou(e,t.target.y);return`${n}% ${r}%`}},eS={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)}},ia={borderRadius:{...Ar,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ar,borderTopRightRadius:Ar,borderBottomLeftRadius:Ar,borderBottomRightRadius:Ar,boxShadow:eS};function qh(e,{layout:t,layoutId:n}){return Tr.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!ia[e]||e==="opacity")}function tl(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])||qh(i,e)||n?.getValue(i)?.liveStyle!==void 0)&&(o[i]=r[i]);return o}function tS(e){return window.getComputedStyle(e)}class nS extends Yh{constructor(){super(...arguments),this.type="html",this.renderInstance=zh}readValueFromInstance(t,n){if(Tr.has(n))return this.projection?.isProjecting?Ki(n):ww(t,n);{const r=tS(t),s=(nh(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Kh(t,n)}build(t,n,r){el(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return tl(t,n,r)}}const rS={offset:"stroke-dashoffset",array:"stroke-dasharray"},sS={offset:"strokeDashoffset",array:"strokeDasharray"};function oS(e,t,n=1,r=0,s=!0){e.pathLength=1;const o=s?rS:sS;e[o.offset]=`${-r}`,e[o.array]=`${t} ${n}`}const iS=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Xh(e,{attrX:t,attrY:n,attrScale:r,pathLength:s,pathSpacing:o=1,pathOffset:i=0,...a},l,c,u){if(el(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 m of iS)d[m]!==void 0&&(f[m]=d[m],delete d[m]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),s!==void 0&&oS(d,s,o,i,!1)}const Zh=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"]),Qh=e=>typeof e=="string"&&e.toLowerCase()==="svg";function aS(e,t,n,r){zh(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(Zh.has(s)?s:Ga(s),t.attrs[s])}function Jh(e,t,n){const r=tl(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 lS extends Yh{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=Ah(n);return r&&r.default||0}return n=Zh.has(n)?n:Ga(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Jh(t,n,r)}build(t,n,r){Xh(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,s){aS(t,n,r,s)}mount(t){this.isSVGTag=Qh(t.tagName),super.mount(t)}}const cS=Qa.length;function em(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?em(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<cS;n++){const r=Qa[n],s=e.props[r];(Xr(s)||s===!1)&&(t[r]=s)}return t}function tm(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 uS=[...Za].reverse(),dS=Za.length;function fS(e){return t=>Promise.all(t.map(({animation:n,options:r})=>lk(e,n,r)))}function hS(e){let t=fS(e),n=iu(),r=!0,s=!1;const o=c=>(u,d)=>{const f=Vn(e,d,c==="exit"?e.presenceContext?.custom:void 0);if(f){const{transition:m,transitionEnd:p,...g}=f;u={...u,...g,...p}}return u};function i(c){t=c(e)}function a(c){const{props:u}=e,d=em(e.parent)||{},f=[],m=new Set;let p={},g=1/0;for(let w=0;w<dS;w++){const x=uS[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 D=k===d[x]&&k!==u[x]&&S;if(D&&(r||s)&&e.manuallyAnimateOnMount&&(D=!1),v.protectedKeys={...p},!v.isActive&&C===null||!k&&!v.prevProp||So(k)||typeof k=="boolean")continue;if(x==="exit"&&v.isActive&&C!==!0){v.prevResolvedValues&&(p={...p,...v.prevResolvedValues});continue}const E=mS(v.prevProp,k);let O=E||x===c&&v.isActive&&!D&&S||w>g&&S,T=!1;const R=Array.isArray(k)?k:[k];let A=R.reduce(o(x),{});C===!1&&(A={});const{prevResolvedValues:M={}}=v,I={...M,...A},j=P=>{O=!0,m.has(P)&&(T=!0,m.delete(P)),v.needsAnimating[P]=!0;const F=e.getValue(P);F&&(F.liveStyle=!1)};for(const P in I){const F=A[P],W=M[P];if(p.hasOwnProperty(P))continue;let B=!1;Ji(F)&&Ji(W)?B=!tm(F,W):B=F!==W,B?F!=null?j(P):m.add(P):F!==void 0&&m.has(P)?j(P):v.protectedKeys[P]=!0}v.prevProp=k,v.prevResolvedValues=A,v.isActive&&(p={...p,...A}),(r||s)&&e.blockInitialAnimation&&(O=!1);const V=D&&E;O&&(!V||T)&&f.push(...R.map(P=>{const F={type:x};if(typeof P=="string"&&(r||s)&&!V&&e.manuallyAnimateOnMount&&e.parent){const{parent:W}=e,B=Vn(W,P);if(W.enteringChildren&&B){const{delayChildren:Q}=B.transition||{};F.delay=Sh(W.enteringChildren,e,Q)}}return{animation:P,options:F}}))}if(m.size){const w={};if(typeof u.initial!="boolean"){const x=Vn(e,Array.isArray(u.initial)?u.initial[0]:u.initial);x&&x.transition&&(w.transition=x.transition)}m.forEach(x=>{const v=e.getBaseTarget(x),k=e.getValue(x);k&&(k.liveStyle=!0),w[x]=v??null}),f.push({animation:w})}let b=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),r=!1,s=!1,b?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=iu(),s=!0}}}function mS(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!tm(t,e):!1}function Mn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function iu(){return{animate:Mn(!0),whileInView:Mn(),whileHover:Mn(),whileTap:Mn(),whileDrag:Mn(),whileFocus:Mn(),exit:Mn()}}function aa(e,t){e.min=t.min,e.max=t.max}function Et(e,t){aa(e.x,t.x),aa(e.y,t.y)}function au(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const nm=1e-4,pS=1-nm,gS=1+nm,rm=.01,yS=0-rm,bS=0+rm;function ot(e){return e.max-e.min}function xS(e,t,n){return Math.abs(e-t)<=n}function lu(e,t,n,r=.5){e.origin=r,e.originPoint=Ne(t.min,t.max,e.origin),e.scale=ot(n)/ot(t),e.translate=Ne(n.min,n.max,e.origin)-e.originPoint,(e.scale>=pS&&e.scale<=gS||isNaN(e.scale))&&(e.scale=1),(e.translate>=yS&&e.translate<=bS||isNaN(e.translate))&&(e.translate=0)}function $r(e,t,n,r){lu(e.x,t.x,n.x,r?r.originX:void 0),lu(e.y,t.y,n.y,r?r.originY:void 0)}function cu(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+ot(t)}function vS(e,t,n,r){cu(e.x,t.x,n.x,r?.x),cu(e.y,t.y,n.y,r?.y)}function uu(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+ot(t)}function mo(e,t,n,r){uu(e.x,t.x,n.x,r?.x),uu(e.y,t.y,n.y,r?.y)}function du(e,t,n,r,s){return e-=t,e=ho(e,1/n,r),s!==void 0&&(e=ho(e,1/s,r)),e}function wS(e,t=0,n=1,r=.5,s,o=e,i=e){if(Gt.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=du(e.min,t,n,a,s),e.max=du(e.max,t,n,a,s)}function fu(e,t,[n,r,s],o,i){wS(e,t[n],t[r],t[s],t.scale,o,i)}const kS=["x","scaleX","originX"],SS=["y","scaleY","originY"];function hu(e,t,n,r){fu(e.x,t,kS,n?n.x:void 0,r?r.x:void 0),fu(e.y,t,SS,n?n.y:void 0,r?r.y:void 0)}function mu(e){return e.translate===0&&e.scale===1}function sm(e){return mu(e.x)&&mu(e.y)}function pu(e,t){return e.min===t.min&&e.max===t.max}function TS(e,t){return pu(e.x,t.x)&&pu(e.y,t.y)}function gu(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function om(e,t){return gu(e.x,t.x)&&gu(e.y,t.y)}function yu(e){return ot(e.x)/ot(e.y)}function bu(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Lt(e){return[e("x"),e("y")]}function CS(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:m,skewY:p}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),d&&(r+=`rotateX(${d}deg) `),f&&(r+=`rotateY(${f}deg) `),m&&(r+=`skewX(${m}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 im=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],ES=im.length,xu=e=>typeof e=="string"?parseFloat(e):e,vu=e=>typeof e=="number"||ee.test(e);function MS(e,t,n,r,s,o){s?(e.opacity=Ne(0,n.opacity??1,DS(r)),e.opacityExit=Ne(t.opacity??1,0,PS(r))):o&&(e.opacity=Ne(t.opacity??1,n.opacity??1,r));for(let i=0;i<ES;i++){const a=im[i];let l=wu(t,a),c=wu(n,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||vu(l)===vu(c)?(e[a]=Math.max(Ne(xu(l),xu(c),r),0),(Gt.test(c)||Gt.test(l))&&(e[a]+="%")):e[a]=c}(t.rotate||n.rotate)&&(e.rotate=Ne(t.rotate||0,n.rotate||0,r))}function wu(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const DS=am(0,.5,Xf),PS=am(.5,.95,wt);function am(e,t,n){return r=>r<e?0:r>t?1:n(Kr(e,t,r))}function RS(e,t,n){const r=Xe(e)?e:Bn(e);return r.start(Ha("",r,t,n)),r.animation}function Zr(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const OS=(e,t)=>e.depth-t.depth;class AS{constructor(){this.children=[],this.isDirty=!1}add(t){Oa(this.children,t),this.isDirty=!0}remove(t){io(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(OS),this.isDirty=!1,this.children.forEach(t)}}function NS(e,t){const n=st.now(),r=({timestamp:s})=>{const o=s-n;o>=t&&(sn(r),e(o-t))};return ke.setup(r,!0),()=>sn(r)}function Ks(e){return Xe(e)?e.get():e}class jS{constructor(){this.members=[]}add(t){Oa(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&&(io(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(io(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 zs={hasAnimatedSinceResize:!0,hasEverUpdated:!1},mi=["","X","Y","Z"],IS=1e3;let FS=0;function pi(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function lm(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Dh(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&&lm(r)}function cm({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(i={},a=t?.()){this.id=FS++,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(_S),this.nodes.forEach(US),this.nodes.forEach(GS),this.nodes.forEach(WS)},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 AS)}addEventListener(i,a){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Na),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=Xa(i)&&!Lk(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 m=window.innerWidth;m!==d&&(d=m,this.root.updateBlockedByResize=!0,u&&u(),u=NS(f,250),zs.hasAnimatedSinceResize&&(zs.hasAnimatedSinceResize=!1,this.nodes.forEach(Tu)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:f,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||c.getDefaultTransition()||ZS,{onLayoutAnimationStart:g,onLayoutAnimationComplete:b}=c.getProps(),w=!this.targetLayout||!om(this.targetLayout,m),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={...Ya(p,"layout"),onPlay:g,onComplete:b};(c.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v),this.setAnimationOrigin(u,x)}else d||Tu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}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(),sn(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(KS),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&&lm(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($S),this.nodes.forEach(ku);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Su);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(YS),this.nodes.forEach(HS),this.nodes.forEach(LS),this.nodes.forEach(VS)):this.nodes.forEach(Su),this.clearAllSnapshots();const a=st.now();Ze.delta=Kt(0,1e3/60,a-Ze.timestamp),Ze.timestamp=a,Ze.isProcessing=!0,oi.update.process(Ze),oi.preRender.process(Ze),oi.render.process(Ze),Ze.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,za.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(BS),this.sharedNodes.forEach(zS)}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&&!ot(this.snapshot.measuredBox.x)&&!ot(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&&!sm(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)),QS(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(JS))){const{scroll:c}=this.root;c&&(Wt(a.x,c.offset.x),Wt(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),Wt(a.x,u.offset.x),Wt(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&&(Wt(c.x,-d.scroll.offset.x),Wt(c.y,-d.scroll.offset.y)),Dn(d.latestValues)&&Gs(c,d.latestValues,d.layout?.layoutBox)}return Dn(this.latestValues)&&Gs(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&&(sa(c.latestValues)&&c.updateSnapshot(),u=ze(),Et(u,c.measurePageBox())),hu(a,c.latestValues,c.snapshot?.layoutBox,u)}return Dn(this.latestValues)&&hu(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(),vS(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),Gh(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||sa(this.parent.latestValues)||Uh(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(),mo(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;qk(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:m}=i;if(!m){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(au(this.prevProjectionDelta.x,this.projectionDelta.x),au(this.prevProjectionDelta.y,this.projectionDelta.y)),$r(this.projectionDelta,this.layoutCorrected,m,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==f||!bu(this.projectionDelta.x,this.prevProjectionDelta.x)||!bu(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m))}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=sr(),this.projectionDelta=sr(),this.projectionDeltaWithTransform=sr()}setAnimationOrigin(i,a=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},d=sr();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const f=ze(),m=l?l.source:void 0,p=this.layout?this.layout.source:void 0,g=m!==p,b=this.getStack(),w=!b||b.members.length<=1,x=!!(g&&!w&&this.options.crossfade===!0&&!this.path.some(XS));this.animationProgress=0;let v;this.mixTargetDelta=k=>{const S=k/1e3;Cu(d.x,i.x,S),Cu(d.y,i.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(mo(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),qS(this.relativeTarget,this.relativeTargetOrigin,f,S),v&&TS(this.relativeTarget,v)&&(this.isProjectionDirty=!1),v||(v=ze()),Et(v,this.relativeTarget)),g&&(this.animationValues=u,MS(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&&(sn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ke.update(()=>{zs.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Bn(0)),this.motionValue.jump(0,!1),this.currentAnimation=RS(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(IS),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&&um(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||ze();const d=ot(this.layout.layoutBox.x);l.x.min=i.target.x.min,l.x.max=l.x.min+d;const f=ot(this.layout.layoutBox.y);l.y.min=i.target.y.min,l.y.max=l.y.min+f}Et(a,l),Gs(a,u),$r(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(i,a){this.sharedNodes.has(i)||this.sharedNodes.set(i,new jS),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&&pi("z",i,c,this.animationValues);for(let u=0;u<mi.length;u++)pi(`rotate${mi[u]}`,i,c,this.animationValues),pi(`skew${mi[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=Ks(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=Ks(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=CS(this.projectionDeltaWithTransform,this.treeScale,u);l&&(d=l(u,d)),i.transform=d;const{x:f,y:m}=this.projectionDelta;i.transformOrigin=`${f.origin*100}% ${m.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 ia){if(u[p]===void 0)continue;const{correct:g,applyTo:b,isCSSVariable:w}=ia[p],x=d==="none"?u[p]:g(u[p],c);if(b){const v=b.length;for(let k=0;k<v;k++)i[b[k]]=x}else w?this.options.visualElement.renderState.vars[p]=x:i[p]=x}this.options.layoutId&&(i.pointerEvents=c===this?Ks(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>i.currentAnimation?.stop()),this.root.nodes.forEach(ku),this.root.sharedNodes.clear()}}}function LS(e){e.updateLayout()}function VS(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")Lt(u=>{const d=o?t.measuredBox[u]:t.layoutBox[u],f=ot(d);d.min=n[u].min,d.max=d.min+f});else if(s==="x"||s==="y"){const u=s==="x"?"y":"x";aa(o?t.measuredBox[u]:t.layoutBox[u],n[u])}else um(s,t.layoutBox,n)&&Lt(u=>{const d=o?t.measuredBox[u]:t.layoutBox[u],f=ot(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=sr();$r(i,n,t.layoutBox);const a=sr();o?$r(a,e.applyTransform(r,!0),t.measuredBox):$r(a,n,t.layoutBox);const l=!sm(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 m=e.options.layoutAnchor||void 0,p=ze();mo(p,t.layoutBox,d.layoutBox,m);const g=ze();mo(g,n,f.layoutBox,m),om(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 _S(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 WS(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function BS(e){e.clearSnapshot()}function ku(e){e.clearMeasurements()}function $S(e){e.isLayoutDirty=!0,e.updateLayout()}function Su(e){e.isLayoutDirty=!1}function YS(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function HS(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Tu(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function US(e){e.resolveTargetDelta()}function GS(e){e.calcProjection()}function KS(e){e.resetSkewAndRotation()}function zS(e){e.removeLeadSnapshot()}function Cu(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 Eu(e,t,n,r){e.min=Ne(t.min,n.min,r),e.max=Ne(t.max,n.max,r)}function qS(e,t,n,r){Eu(e.x,t.x,n.x,r),Eu(e.y,t.y,n.y,r)}function XS(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const ZS={duration:.45,ease:[.4,0,.1,1]},Mu=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Du=Mu("applewebkit/")&&!Mu("chrome/")?Math.round:wt;function Pu(e){e.min=Du(e.min),e.max=Du(e.max)}function QS(e){Pu(e.x),Pu(e.y)}function um(e,t,n){return e==="position"||e==="preserve-aspect"&&!xS(yu(t),yu(n),.2)}function JS(e){return e!==e.root&&e.scroll?.wasRoot}const eT=cm({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}),gi={current:void 0},dm=cm({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!gi.current){const e=new eT({});e.mount(window),e.setOptions({layoutScroll:!0}),gi.current=e}return gi.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),us=h.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Ru(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function tT(...e){return t=>{let n=!1;const r=e.map(s=>{const o=Ru(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Ru(e[s],null)}}}}function nT(...e){return h.useCallback(tT(...e),e)}class rT extends h.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Bs(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,s=Bs(r)&&r.offsetWidth||0,o=Bs(r)&&r.offsetHeight||0,i=getComputedStyle(n),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=n.offsetTop,a.left=n.offsetLeft,a.right=s-a.width-a.left,a.bottom=o-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}}function sT({children:e,isPresent:t,anchorX:n,anchorY:r,root:s,pop:o}){const i=h.useId(),a=h.useRef(null),l=h.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:c}=h.useContext(us),u=e.props?.ref??e?.ref,d=nT(a,u);return h.useInsertionEffect(()=>{const{width:f,height:m,top:p,left:g,right:b,bottom:w}=l.current;if(t||o===!1||!a.current||!f||!m)return;const x=n==="left"?`left: ${g}`:`right: ${b}`,v=r==="bottom"?`bottom: ${w}`:`top: ${p}`;a.current.dataset.motionPopId=i;const k=document.createElement("style");c&&(k.nonce=c);const S=s??document.head;return S.appendChild(k),k.sheet&&k.sheet.insertRule(`
|
|
13
|
+
[data-motion-pop-id="${i}"] {
|
|
14
|
+
position: absolute !important;
|
|
15
|
+
width: ${f}px !important;
|
|
16
|
+
height: ${m}px !important;
|
|
17
|
+
${x}px !important;
|
|
18
|
+
${v}px !important;
|
|
19
|
+
}
|
|
20
|
+
`),()=>{a.current?.removeAttribute("data-motion-pop-id"),S.contains(k)&&S.removeChild(k)}},[t]),y.jsx(rT,{isPresent:t,childRef:a,sizeRef:l,pop:o,children:o===!1?e:h.cloneElement(e,{ref:d})})}const oT=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:o,mode:i,anchorX:a,anchorY:l,root:c})=>{const u=is(iT),d=h.useId();let f=!0,m=h.useMemo(()=>(f=!1,{id:d,initial:t,isPresent:n,custom:s,onExitComplete:p=>{u.set(p,!0);for(const g of u.values())if(!g)return;r&&r()},register:p=>(u.set(p,!1),()=>u.delete(p))}),[n,u,r]);return o&&f&&(m={...m}),h.useMemo(()=>{u.forEach((p,g)=>u.set(g,!1))},[n]),h.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=y.jsx(sT,{pop:i==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:c,children:e}),y.jsx(wo.Provider,{value:m,children:e})};function iT(){return new Map}function fm(e=!0){const t=h.useContext(wo);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,o=h.useId();h.useEffect(()=>{if(e)return s(o)},[e]);const i=h.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,i]:[!0]}const js=e=>e.key||"";function Ou(e){const t=[];return h.Children.forEach(e,n=>{h.isValidElement(n)&&t.push(n)}),t}const aT=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:o="sync",propagate:i=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[u,d]=fm(i),f=h.useMemo(()=>Ou(e),[e]),m=i&&!u?[]:f.map(js),p=h.useRef(!0),g=h.useRef(f),b=is(()=>new Map),w=h.useRef(new Set),[x,v]=h.useState(f),[k,S]=h.useState(f);Ra(()=>{p.current=!1,g.current=f;for(let E=0;E<k.length;E++){const O=js(k[E]);m.includes(O)?(b.delete(O),w.current.delete(O)):b.get(O)!==!0&&b.set(O,!1)}},[k,m.length,m.join("-")]);const C=[];if(f!==x){let E=[...f];for(let O=0;O<k.length;O++){const T=k[O],R=js(T);m.includes(R)||(E.splice(O,0,T),C.push(T))}return o==="wait"&&C.length&&(E=C),S(Ou(E)),v(f),null}const{forceRender:D}=h.useContext(Pa);return y.jsx(y.Fragment,{children:k.map(E=>{const O=js(E),T=i&&!u?!1:f===k||m.includes(O),R=()=>{if(w.current.has(O))return;if(b.has(O))w.current.add(O),b.set(O,!0);else return;let A=!0;b.forEach(M=>{M||(A=!1)}),A&&(D?.(),S(g.current),i&&d?.(),r&&r())};return y.jsx(oT,{isPresent:T,initial:!p.current||n?void 0:!1,custom:t,presenceAffectsLayout:s,mode:o,root:c,onExitComplete:T?void 0:R,anchorX:a,anchorY:l,children:E},O)})})},hm=h.createContext({strict:!1}),Au={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 Nu=!1;function lT(){if(Nu)return;const e={};for(const t in Au)e[t]={isEnabled:n=>Au[t].some(r=>!!n[r])};$h(e),Nu=!0}function mm(){return lT(),Uk()}function cT(e){const t=mm();for(const n in e)t[n]={...t[n],...e[n]};$h(t)}const uT=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 po(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||uT.has(e)}let pm=e=>!po(e);function dT(e){typeof e=="function"&&(pm=t=>t.startsWith("on")?!po(t):e(t))}try{dT(require("@emotion/is-prop-valid").default)}catch{}function fT(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||Xe(e[s])||(pm(s)||n===!0&&po(s)||!t&&!po(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}const Co=h.createContext({});function hT(e,t){if(To(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 mT(e){const{initial:t,animate:n}=hT(e,h.useContext(Co));return h.useMemo(()=>({initial:t,animate:n}),[ju(t),ju(n)])}function ju(e){return Array.isArray(e)?e.join(" "):e}const nl=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function gm(e,t,n){for(const r in t)!Xe(t[r])&&!qh(r,n)&&(e[r]=t[r])}function pT({transformTemplate:e},t){return h.useMemo(()=>{const n=nl();return el(n,t,e),Object.assign({},n.vars,n.style)},[t])}function gT(e,t){const n=e.style||{},r={};return gm(r,n,e),Object.assign(r,pT(e,t)),r}function yT(e,t){const n={},r=gT(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 ym=()=>({...nl(),attrs:{}});function bT(e,t,n,r){const s=h.useMemo(()=>{const o=ym();return Xh(o,t,Qh(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};gm(o,e.style,e),s.style={...o,...s.style}}return s}const xT=["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 rl(e){return typeof e!="string"||e.includes("-")?!1:!!(xT.indexOf(e)>-1||/[A-Z]/u.test(e))}function vT(e,t,n,{latestValues:r},s,o=!1,i){const l=(i??rl(e)?bT:yT)(t,r,s,e),c=fT(t,typeof e=="string",o),u=e!==h.Fragment?{...c,...l,ref:n}:{},{children:d}=t,f=h.useMemo(()=>Xe(d)?d.get():d,[d]);return h.createElement(e,{...u,children:f})}function wT({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:kT(n,r,s,e),renderState:t()}}function kT(e,t,n,r){const s={},o=r(e,{});for(const f in o)s[f]=Ks(o[f]);let{initial:i,animate:a}=e;const l=To(e),c=Wh(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"&&!So(d)){const f=Array.isArray(d)?d:[d];for(let m=0;m<f.length;m++){const p=Ua(e,f[m]);if(p){const{transitionEnd:g,transition:b,...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 bm=e=>(t,n)=>{const r=h.useContext(Co),s=h.useContext(wo),o=()=>wT(e,t,r,s);return n?o():is(o)},ST=bm({scrapeMotionValuesFromProps:tl,createRenderState:nl}),TT=bm({scrapeMotionValuesFromProps:Jh,createRenderState:ym}),CT=Symbol.for("motionComponentSymbol");function ET(e,t,n){const r=h.useRef(n);h.useInsertionEffect(()=>{r.current=n});const s=h.useRef(null);return h.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 xm=h.createContext({});function er(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function MT(e,t,n,r,s,o){const{visualElement:i}=h.useContext(Co),a=h.useContext(hm),l=h.useContext(wo),c=h.useContext(us),u=c.reducedMotion,d=c.skipAnimations,f=h.useRef(null),m=h.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}),m.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const p=f.current,g=h.useContext(xm);p&&!p.projection&&s&&(p.type==="html"||p.type==="svg")&&DT(f.current,n,s,g);const b=h.useRef(!1);h.useInsertionEffect(()=>{p&&b.current&&p.update(n,l)});const w=n[Mh],x=h.useRef(!!w&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(w)&&window.MotionHasOptimisedAnimation?.(w));return Ra(()=>{m.current=!0,p&&(b.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),x.current&&p.animationState&&p.animationState.animateChanges())}),h.useEffect(()=>{p&&(!x.current&&p.animationState&&p.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(w)}),x.current=!1),p.enteringChildren=void 0)}),p}function DT(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:vm(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!i||a&&er(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function vm(e){if(e)return e.options.allowProjection!==!1?e.projection:vm(e.parent)}function yi(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&cT(r);const o=n?n==="svg":rl(e),i=o?TT:ST;function a(c,u){let d;const f={...h.useContext(us),...c,layoutId:PT(c)},{isStatic:m}=f,p=mT(c),g=i(c,m);if(!m&&typeof window<"u"){RT();const b=OT(f);d=b.MeasureLayout,p.visualElement=MT(e,g,f,s,b.ProjectionNode,o)}return y.jsxs(Co.Provider,{value:p,children:[d&&p.visualElement?y.jsx(d,{visualElement:p.visualElement,...f}):null,vT(e,c,ET(g,p.visualElement,u),g,m,t,o)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=h.forwardRef(a);return l[CT]=e,l}function PT({layoutId:e}){const t=h.useContext(Pa).id;return t&&e!==void 0?t+"-"+e:e}function RT(e,t){h.useContext(hm).strict}function OT(e){const t=mm(),{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 AT(e,t){if(typeof Proxy>"u")return yi;const n=new Map,r=(o,i)=>yi(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,yi(i,void 0,e,t)),n.get(i))})}const NT=(e,t)=>t.isSVG??rl(e)?new lS(t):new nS(t,{allowProjection:e!==h.Fragment});class jT extends vn{constructor(t){super(t),t.animationState||(t.animationState=hS(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();So(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 IT=0;class FT extends vn{constructor(){super(...arguments),this.id=IT++,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=Vn(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 LT={animation:{Feature:jT},exit:{Feature:FT}};function ds(e){return{point:{x:e.pageX,y:e.pageY}}}const VT=e=>t=>qa(t)&&e(t,ds(t));function Yr(e,t,n,r){return Zr(e,t,VT(n),r)}const wm=({current:e})=>e?e.ownerDocument.defaultView:null,Iu=(e,t)=>Math.abs(e-t);function _T(e,t){const n=Iu(e.x,t.x),r=Iu(e.y,t.y);return Math.sqrt(n**2+r**2)}const Fu=new Set(["auto","scroll"]);class km{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=m=>{this.handleScroll(m.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Is(this.lastRawMoveEventInfo,this.transformPagePoint));const m=bi(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=_T(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!g)return;const{point:b}=m,{timestamp:w}=Ze;this.history.push({...b,timestamp:w});const{onStart:x,onMove:v}=this.handlers;p||(x&&x(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,m)},this.handlePointerMove=(m,p)=>{this.lastMoveEvent=m,this.lastRawMoveEventInfo=p,this.lastMoveEventInfo=Is(p,this.transformPagePoint),ke.update(this.updatePoint,!0)},this.handlePointerUp=(m,p)=>{this.end();const{onEnd:g,onSessionEnd:b,resumeAnimation:w}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=bi(m.type==="pointercancel"?this.lastMoveEventInfo:Is(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(m,x),b&&b(m,x)},!qa(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=s||window;const l=ds(t),c=Is(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=Ze;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(t,bi(c,this.history)),this.removeListeners=as(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);(Fu.has(r.overflowX)||Fu.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(),sn(this.updatePoint)}}function Is(e,t){return t?{point:t(e.point)}:e}function Lu(e,t){return{x:e.x-t.x,y:e.y-t.y}}function bi({point:e},t){return{point:e,delta:Lu(e,Sm(t)),offset:Lu(e,WT(t)),velocity:BT(t,.1)}}function WT(e){return e[0]}function Sm(e){return e[e.length-1]}function BT(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=Sm(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 $T(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 Vu(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 YT(e,{top:t,left:n,bottom:r,right:s}){return{x:Vu(e.x,n,s),y:Vu(e.y,t,r)}}function _u(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 HT(e,t){return{x:_u(e.x,t.x),y:_u(e.y,t.y)}}function UT(e,t){let n=.5;const r=ot(e),s=ot(t);return s>r?n=Kr(t.min,t.max-r,e.min):r>s&&(n=Kr(e.min,e.max-s,t.min)),Kt(0,1,n)}function GT(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 la=.35;function KT(e=la){return e===!1?e=0:e===!0&&(e=la),{x:Wu(e,"left","right"),y:Wu(e,"top","bottom")}}function Wu(e,t,n){return{min:Bu(e,t),max:Bu(e,n)}}function Bu(e,t){return typeof e=="number"?e:e[t]||0}const zT=new WeakMap;class qT{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(ds(d).point),this.stopAnimation()},i=(d,f)=>{const{drag:m,dragPropagation:p,onDragStart:g}=this.getProps();if(m&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=vk(m),!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),Lt(w=>{let x=this.getAxisMotionValue(w).get()||0;if(Gt.test(x)){const{projection:v}=this.visualElement;if(v&&v.layout){const k=v.layout.layoutBox[w];k&&(x=ot(k)*(parseFloat(x)/100))}}this.originPoint[w]=x}),g&&ke.update(()=>g(d,f),!1,!0),ea(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f;const{dragPropagation:m,dragDirectionLock:p,onDirectionLock:g,onDrag:b}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:w}=f;if(p&&this.currentDirection===null){this.currentDirection=ZT(w),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,w),this.updateAxis("y",f.point,w),this.visualElement.render(),b&&ke.update(()=>b(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 km(t,{onSessionStart:o,onStart:i,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:wm(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||!Fs(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=$T(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&&er(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=YT(r.layoutBox,t):this.constraints=!1,this.elastic=KT(n),s!==this.constraints&&!er(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Lt(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=GT(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!er(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=Xk(r,s.root,this.visualElement.getTransformPagePoint());let i=HT(s.layout.layoutBox,o);if(n){const a=n(Kk(i));this.hasMutatedConstraints=!!a,a&&(i=Hh(a))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Lt(u=>{if(!Fs(u,n,this.currentDirection))return;let d=l&&l[u]||{};(i===!0||i===u)&&(d={min:0,max:0});const f=s?200:1e6,m=s?40:1e7,p={type:"inertia",velocity:r?t[u]:0,bounceStiffness:f,bounceDamping:m,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 ea(this.visualElement,t),r.start(Ha(t,r,0,n,this.visualElement,!1))}stopAnimation(){Lt(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){Lt(n=>{const{drag:r}=this.getProps();if(!Fs(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(!er(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Lt(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const l=a.get();s[i]=UT({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(),Lt(i=>{if(!Fs(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;zT.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,m=f!==t&&Ek(f);u&&d&&!m&&this.start(c)});let r;const s=()=>{const{dragConstraints:c}=this.getProps();er(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=XT(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&&(Lt(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=la,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function $u(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function XT(e,t,n){const r=zc(e,$u(n)),s=zc(t,$u(n));return()=>{r(),s()}}function Fs(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function ZT(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class QT extends vn{constructor(t){super(t),this.removeGroupControls=wt,this.removeListeners=wt,this.controls=new qT(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 xi=e=>(t,n)=>{e&&ke.update(()=>e(t,n),!1,!0)};class JT extends vn{constructor(){super(...arguments),this.removePointerDownListener=wt}onPointerDown(t){this.session=new km(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:wm(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:xi(t),onStart:xi(n),onMove:xi(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 vi=!1;class eC extends h.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),vi&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),zs.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}),vi=!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(),za.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;vi=!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 Tm(e){const[t,n]=fm(),r=h.useContext(Pa);return y.jsx(eC,{...e,layoutGroup:r,switchLayoutGroup:h.useContext(xm),isPresent:t,safeToRemove:n})}const tC={pan:{Feature:JT},drag:{Feature:QT,ProjectionNode:dm,MeasureLayout:Tm}};function Yu(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,ds(t)))}class nC extends vn{mount(){const{current:t}=this.node;t&&(this.unmount=kk(t,(n,r)=>(Yu(this.node,r,"Start"),s=>Yu(this.node,s,"End"))))}unmount(){}}class rC 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=as(Zr(this.node.current,"focus",()=>this.onFocus()),Zr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Hu(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,ds(t)))}class sC extends vn{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=Dk(t,(s,o)=>(Hu(this.node,o,"Start"),(i,{success:a})=>Hu(this.node,i,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:r?.tap===!1})}unmount(){}}const ca=new WeakMap,wi=new WeakMap,oC=e=>{const t=ca.get(e.target);t&&t(e)},iC=e=>{e.forEach(oC)};function aC({root:e,...t}){const n=e||document;wi.has(n)||wi.set(n,{});const r=wi.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(iC,{root:e,...t})),r[s]}function lC(e,t,n){const r=aC(t);return ca.set(e,n),r.observe(e),()=>{ca.delete(e),r.unobserve(e)}}const cC={some:0,all:1};class uC 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:cC[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=lC(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(dC(t,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function dC({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const fC={inView:{Feature:uC},tap:{Feature:sC},focus:{Feature:rC},hover:{Feature:nC}},hC={layout:{ProjectionNode:dm,MeasureLayout:Tm}},mC={...LT,...fC,...tC,...hC},Je=AT(mC,NT);function sl(e){const t=is(()=>Bn(e)),{isStatic:n}=h.useContext(us);if(n){const[,r]=h.useState(e);h.useEffect(()=>t.on("change",r),[])}return t}function Cm(e,t){const n=sl(t()),r=()=>n.set(t());return r(),Ra(()=>{const s=()=>ke.preRender(r,!1,!0),o=e.map(i=>i.on("change",s));return()=>{o.forEach(i=>i()),sn(r)}}),n}function pC(e){Br.current=[],e();const t=Cm(Br.current,e);return Br.current=void 0,t}function Em(e,t,n,r){if(typeof e=="function")return pC(e);const o=typeof t=="function"?t:Vk(t,n,r),i=Array.isArray(e)?Uu(e,o):Uu([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 Uu(e,t){const n=is(()=>[]);return Cm(e,()=>{n.length=0;const r=e.length;for(let s=0;s<r;s++)n[s]=e[s].get();return t(n)})}function gC(e,t={}){const{isStatic:n}=h.useContext(us),r=()=>Xe(e)?e.get():e;if(n)return Em(r);const s=sl(r());return h.useInsertionEffect(()=>_k(s,e,t),[s,JSON.stringify(t)]),s}function yC(e,t={}){return gC(e,{type:"spring",...t})}function fs(){!Ja.current&&Bh();const[e]=h.useState(uo.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 y.jsx(i,{className:f,onClick:r,disabled:s,...a,children:e})}function Eo({children:e,title:t,subtitle:n,className:r="",bodyClassName:s=""}){return y.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)&&y.jsxs("div",{className:"px-5 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 transition-colors duration-200",children:[t&&y.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&&y.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-1 transition-colors duration-200",children:n})]}),y.jsx("div",{className:`p-5 ${s}`,children:e})]})}function bC({theme:e,onToggle:t,className:n="",size:r=36,iconSize:s=20}){const o=fs(),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=()=>y.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:[y.jsx("circle",{cx:"12",cy:"12",r:"4"}),y.jsx("path",{d:"M12 2v2"}),y.jsx("path",{d:"M12 20v2"}),y.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),y.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),y.jsx("path",{d:"M2 12h2"}),y.jsx("path",{d:"M20 12h2"}),y.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),y.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]}),d=()=>y.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:y.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})});return o?y.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?y.jsx(d,{}):y.jsx(u,{})}):y.jsx(Je.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:y.jsx(Je.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?y.jsx(d,{}):y.jsx(u,{})},i?"moon":"sun")})}function xC(){return y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx("div",{className:"w-8 h-8 rounded-lg bg-oai-black dark:bg-oai-white flex items-center justify-center",children:y.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-oai-white dark:text-oai-black",children:[y.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),y.jsx("path",{d:"M2 17l10 5 10-5M2 12l10 5 10-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),y.jsx("span",{className:"text-base font-semibold text-oai-black dark:text-oai-white leading-tight",children:"Token Tracker"})]})}function vC({children:e,header:t,footer:n,className:r="",hideHeader:s=!1,hideFooter:o=!1}){const{resolvedTheme:i,toggleTheme:a}=wa();return y.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&&y.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:[y.jsx(xC,{}),y.jsx("div",{className:"flex-1 flex justify-center",children:t}),y.jsx(bC,{theme:i,onToggle:a})]}),y.jsx("main",{className:"flex-1 px-6 py-6",children:e}),!o&&n&&y.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 wC({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 y.jsx("span",{className:a,children:e})}var kC={};function SC(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 TC({mv:e,digit:t,height:n}){const r=Em(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 y.jsx(Je.span,{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",y:r},children:t})}function CC(e){const t=Math.round(e),n=1e-9*Math.max(1,Math.abs(e));return Math.abs(e-t)<n?t:e}function EC(e,t){const n=e/t;return Math.floor(CC(n))}function MC(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 DC({place:e,value:t,height:n,digitStyle:r,shouldReduceMotion:s}){if(typeof e!="number"){const l=SC(e,n);return y.jsx("span",{"data-counter-token":"static",className:"relative inline-flex items-center justify-center",style:{height:n,...l,...r},children:e})}const o=EC(t,e),i=sl(0),a=yC(i,{stiffness:220,damping:26,mass:.8});return h.useEffect(()=>{i.set(o)},[i,o]),s?y.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}):y.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)=>y.jsx(TC,{mv:a,digit:c,height:n},c))})}function PC({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:m=14,gradientFrom:p="rgba(255,255,255,0.95)",gradientTo:g="rgba(255,255,255,0)",topGradientStyle:b,bottomGradientStyle:w}){const x=String(t??e??""),v=h.useMemo(()=>Array.isArray(s)&&s.length?s:MC(x),[s,x]),k=typeof navigator<"u"&&/jsdom/i.test(navigator.userAgent||"")||typeof process<"u"&&kC?.VITEST==="true",S=fs()||k,C=Number.isFinite(Number(e))?Math.abs(Number(e)):0,D=n+r;return S?y.jsx("span",{"data-counter-root":"true",style:{display:"inline-flex",alignItems:"center",color:l,fontSize:n,fontWeight:c,lineHeight:1,...u,...d},children:x}):y.jsxs("span",{"data-counter-root":"true",style:{position:"relative",display:"inline-block",...u},children:[y.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((E,O)=>y.jsx(DC,{place:E,value:C,height:D,digitStyle:f,shouldReduceMotion:S},`${String(E)}-${O}`))}),y.jsxs("span",{style:{pointerEvents:"none",position:"absolute",inset:0,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[y.jsx("span",{style:b??{height:m,background:`linear-gradient(to bottom, ${p}, ${g})`}}),y.jsx("span",{style:w??{height:m,background:`linear-gradient(to top, ${p}, ${g})`}})]})]})}const Mm=h.createContext(void 0);function Un(e){const t=h.useContext(Mm);if(e===!1&&t===void 0)throw new Error($n(27));return t}const RC={...os,...xo},OC=h.forwardRef(function(t,n){const{render:r,className:s,forceRender:o=!1,...i}=t,{store:a}=Un(),l=a.useState("open"),c=a.useState("nested"),u=a.useState("mounted"),d=a.useState("transitionStatus"),f=h.useMemo(()=>({open:l,transitionStatus:d}),[l,d]);return on("div",t,{state:f,ref:[a.context.backdropRef,n],stateAttributesMapping:RC,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:o||!c})}),Gu=h.forwardRef(function(t,n){const{render:r,className:s,disabled:o=!1,nativeButton:i=!0,...a}=t,{store:l}=Un(),c=l.useState("open");function u(p){c&&l.setOpen(!1,Le(Gg,p.nativeEvent))}const{getButtonProps:d,buttonRef:f}=xd({disabled:o,native:i}),m=h.useMemo(()=>({disabled:o}),[o]);return on("button",t,{state:m,ref:[n,f],props:[{onClick:u},a,d]})});let AC=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),NC=(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 Dm=h.createContext(void 0);function Pm(){const e=h.useContext(Dm);if(e===void 0)throw new Error($n(26));return e}const jC={...os,...xo,nestedDialogOpen(e){return e?{[NC.nestedDialogOpen]:""}:null}},IC=h.forwardRef(function(t,n){const{className:r,finalFocus:s,initialFocus:o,render:i,...a}=t,{store:l}=Un(),c=l.useState("descriptionElementId"),u=l.useState("disablePointerDismissal"),d=l.useState("floatingRootContext"),f=l.useState("popupProps"),m=l.useState("modal"),p=l.useState("mounted"),g=l.useState("nested"),b=l.useState("nestedOpenDialogCount"),w=l.useState("open"),x=l.useState("openMethod"),v=l.useState("titleElementId"),k=l.useState("transitionStatus"),S=l.useState("role");Pm(),Ma({open:w,ref:l.context.popupRef,onComplete(){w&&l.context.onOpenChangeComplete?.(!0)}});function C(R){return R==="touch"?l.context.popupRef.current:!0}const D=o===void 0?C:o,E=b>0,O=h.useMemo(()=>({open:w,nested:g,transitionStatus:k,nestedDialogOpen:E}),[w,g,k,E]),T=on("div",t,{state:O,props:[f,{"aria-labelledby":v??void 0,"aria-describedby":c??void 0,role:S,tabIndex:-1,hidden:!p,onKeyDown(R){Lf.has(R.key)&&R.stopPropagation()},style:{[AC.nestedDialogs]:b}},a],ref:[n,l.context.popupRef,l.useStateSetter("popupElement")],stateAttributesMapping:jC});return y.jsx(lf,{context:d,openInteractionType:x,disabled:!p,closeOnFocusOut:!u,initialFocus:D,returnFocus:s,modal:m!==!1,restoreFocus:"popup",children:T})}),FC=h.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t,{store:o}=Un(),i=o.useState("mounted"),a=o.useState("modal"),l=o.useState("open");return i||r?y.jsx(Dm.Provider,{value:r,children:y.jsxs(af,{ref:n,...s,children:[i&&a===!0&&y.jsx(Rf,{ref:o.context.internalBackdropRef,inert:Mf(!l)}),t.children]})}):null});function LC(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}=Ef(s);xf(t);const{forceUnmount:d}=vf(s,t,()=>{u()}),f=he(T=>{const R=Le(T);return R.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},R}),m=h.useCallback(()=>{t.setOpen(!1,f(vd))},[t,f]);h.useImperativeHandle(r,()=>({unmount:d,close:m}),[d,m]);const p=Sf({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[g,b]=h.useState(0),w=g===0,x=Cf(p),v=yf(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=ft(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});Df(s&&i===!0,a);const{getReferenceProps:k,getFloatingProps:S,getTriggerProps:C}=Da([x,v]);t.useContextCallback("onNestedDialogOpen",T=>{b(T+1)}),t.useContextCallback("onNestedDialogClose",()=>{b(0)}),h.useEffect(()=>(n?.onNestedDialogOpen&&s&&n.onNestedDialogOpen(g),n?.onNestedDialogClose&&!s&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&s&&n.onNestedDialogClose()}),[s,n,g]);const D=h.useMemo(()=>k(c),[k,c]),E=h.useMemo(()=>C(c),[C,c]),O=h.useMemo(()=>S(),[S]);t.useSyncedValues({openMethod:l,activeTriggerProps:D,inactiveTriggerProps:E,popupProps:O,floatingRootContext:p,nestedOpenDialogCount:g})}const VC={...kf,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 _C extends ka{constructor(t){super(WC(t),{popupRef:h.createRef(),backdropRef:h.createRef(),internalBackdropRef:h.createRef(),triggerElements:new vo,onOpenChange:void 0,onOpenChangeComplete:void 0},VC)}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 WC(e={}){return{...wf(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function BC(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=Un(!0),m=!!f,p=bn(()=>c?.store??new _C({open:n??r,activeTriggerId:u!==void 0?u:d,modal:a,disablePointerDismissal:i,nested:m})).current;p.useControlledProp("open",n,r),p.useControlledProp("activeTriggerId",u,d),p.useSyncedValues({disablePointerDismissal:i,nested:m,modal:a}),p.useContextCallback("onOpenChange",s),p.useContextCallback("onOpenChangeComplete",o);const g=p.useState("payload");LC({store:p,actionsRef:l,parentContext:f?.store.context});const b=h.useMemo(()=>({store:p}),[p]);return y.jsx(Mm.Provider,{value:b,children:typeof t=="function"?t({payload:g}):t})}let Ku=(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 $C={...os,...xo,nested(e){return e?{[Ku.nested]:""}:null},nestedDialogOpen(e){return e?{[Ku.nestedDialogOpen]:""}:null}},YC=h.forwardRef(function(t,n){const{className:r,render:s,children:o,...i}=t,a=Pm(),{store:l}=Un(),c=l.useState("open"),u=l.useState("nested"),d=l.useState("transitionStatus"),f=l.useState("nestedOpenDialogCount"),m=l.useState("mounted"),p=f>0,g=h.useMemo(()=>({open:c,nested:u,transitionStatus:d,nestedDialogOpen:p}),[c,u,d,p]);return on("div",t,{enabled:a||m,state:g,ref:[n,l.useStateSetter("viewportElement")],stateAttributesMapping:$C,props:[{role:"presentation",hidden:!m,children:o},i]})}),HC=h.forwardRef(function(t,n){const{render:r,className:s,id:o,...i}=t,{store:a}=Un(),l=wd(o);return a.useSyncedValueWithCleanup("titleElementId",l),on("h2",t,{ref:n,props:[{id:l},i]})});function zu(e){if(!Number.isFinite(e))return _("shared.placeholder.short");const t=ma(e.toFixed(6));return t==="-"?_("shared.placeholder.short"):t}function UC(e){return!Number.isFinite(e)||e<=0?null:e<.01?"<$0.01":ma(e.toFixed(2))}const GC=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:zu(u),models:d.map(f=>{const m=xt(f?.share),p=Number.isFinite(m)?`${m}${s}`:_("shared.placeholder.short"),g=xt(f?.cost),b=UC(g);return{id:f?.id?String(f.id):"",name:f?.name?String(f.name):"",shareLabel:p,costLabel:b}})}}),i=o.reduce((l,c)=>l+c.usdValue,0),a=zu(i);return y.jsx(BC,{open:t,onOpenChange:l=>{l||n?.()},children:y.jsxs(FC,{children:[y.jsx(OC,{className:"cost-modal-backdrop","data-cost-analysis-backdrop":"true"}),y.jsx(YC,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:y.jsxs(IC,{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:[y.jsxs("div",{className:"px-6 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 flex items-center justify-between",children:[y.jsx(HC,{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:_("dashboard.cost_breakdown.title")}),y.jsx(Gu,{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:"✕"})]}),y.jsxs("div",{className:"px-6 py-6 text-center border-b border-oai-gray-100 dark:border-oai-gray-800",children:[y.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")}),y.jsx("div",{className:"text-3xl font-bold text-oai-brand tabular-nums tracking-tight",children:a})]}),y.jsx("div",{className:"px-6 py-4 max-h-[45vh] overflow-y-auto oai-scrollbar",children:y.jsx("div",{className:"space-y-5",children:o.map((l,c)=>y.jsxs("div",{children:[y.jsxs("div",{className:"flex justify-between items-baseline pb-2 mb-2 border-b border-oai-gray-100 dark:border-oai-gray-800",children:[y.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white",children:l.label}),y.jsx("span",{className:"text-sm font-semibold text-oai-brand tabular-nums",children:l.usdLabel})]}),y.jsx("div",{className:"space-y-1",children:l.models.map((u,d)=>{const f=u?.id||`${u.name}-${d}`;return y.jsxs("div",{className:"flex justify-between items-center py-1 text-xs",children:[y.jsxs("span",{className:"text-oai-gray-600 dark:text-oai-gray-300",children:[u.name,y.jsx("span",{className:"ml-1.5 text-oai-gray-400 dark:text-oai-gray-500 tabular-nums",children:u.shareLabel})]}),u.costLabel?y.jsx("span",{className:"text-oai-gray-600 dark:text-oai-gray-300 font-medium tabular-nums",children:u.costLabel}):null]},f)})})]},`${l.label}-${c}`))})}),y.jsxs("div",{className:"px-6 py-4 border-t border-oai-gray-200 dark:border-oai-gray-800 flex justify-between items-center",children:[y.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500",children:_("dashboard.cost_breakdown.footer")}),y.jsx(Gu,{render:y.jsx(Qr,{variant:"secondary",size:"sm"}),children:_("dashboard.cost_breakdown.close")})]})]})})]})})});function KC({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:m=[],dailyBreakdownColumns:p=[],dailyBreakdownAriaSortFor:g,dailyBreakdownSortIconFor:b,dailyBreakdownDateKey:w="day",detailsDateKey:x,renderDetailDate:v,renderDailyBreakdownDate:k,renderDetailCell:S,DETAILS_PAGED_PERIODS:C,period:D,detailsPageCount:E,detailsPage:O,setDetailsPage:T}){const[R,A]=h.useState("daily");return y.jsxs(Eo,{children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[y.jsxs("div",{role:"tablist","aria-label":"Data view",className:"flex gap-1",children:[y.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")}),y.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"&&y.jsxs("select",{"aria-label":"Number of projects to display",value:t,onChange:M=>n?.(Number(M.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:[y.jsx("option",{value:3,children:r("dashboard.projects.limit_top_3")}),y.jsx("option",{value:6,children:r("dashboard.projects.limit_top_6")}),y.jsx("option",{value:10,children:r("dashboard.projects.limit_top_10")})]})]}),R==="projects"&&y.jsx("div",{className:"space-y-1",children:e.slice(0,t).map(M=>y.jsxs("a",{href:M?.project_ref||"#",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-2 rounded-lg hover:oai-bg-elevated transition-colors",children:[y.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:(M?.project_key?.[0]||"?").toUpperCase()}),y.jsx("div",{className:"min-w-0 flex-1",children:y.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white truncate",children:M?.project_key||M?.project_ref?.split("/")?.pop()||"—"})}),y.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:M?.billable_total_tokens?.toLocaleString?.()||M?.total_tokens?.toLocaleString?.()||"—"})]},M?.project_key||M?.project_ref))}),R==="daily"&&y.jsxs("div",{children:[m?.length===0?y.jsxs("div",{className:"oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 mb-4",children:[o,y.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]}):y.jsx("div",{className:"overflow-auto max-h-[384px] -mx-4 oai-scrollbar",children:y.jsxs("table",{className:"w-full border-collapse",children:[y.jsx("thead",{className:"sticky top-0 z-10",children:y.jsx("tr",{className:"border-b border-oai-gray-200 dark:border-oai-gray-700",children:p.map(M=>y.jsx("th",{"aria-sort":g?.(M.key)||"none",className:"text-left p-0 bg-white dark:bg-oai-gray-900",children:y.jsx("button",{type:"button",onClick:()=>u(M.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:y.jsxs("span",{className:"inline-flex items-center gap-1",children:[y.jsx("span",{children:M.label}),y.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-400",children:b?.(M.key)||""})]})})},M.key))})}),y.jsx("tbody",{children:m.map(M=>y.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 ${M.missing?"text-oai-gray-400 dark:text-oai-gray-400":M.future?"text-oai-gray-300 dark:text-oai-gray-600":"text-oai-black dark:text-oai-white"}`,children:[y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300",children:k?k(M):v(M)}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:S(M,"total_tokens")}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(M,"input_tokens")}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(M,"output_tokens")}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(M,"cached_input_tokens")}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(M,"reasoning_output_tokens")}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(M,"conversation_count")})]},String(M?.[w]||M?.day||M?.hour||M?.month||"")))})]})}),R!=="daily"&&C.has(D)&&E>1?y.jsxs("div",{className:"mt-3 flex items-center justify-between oai-text-caption",children:[y.jsx("button",{type:"button",onClick:()=>T(M=>Math.max(0,M-1)),disabled:O===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")}),y.jsxs("span",{className:"oai-text-muted",children:[O+1," / ",E]}),y.jsx("button",{type:"button",onClick:()=>T(M=>Math.min(E-1,M+1)),disabled:O+1>=E,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 Rn({children:e,delay:t=0,duration:n=.4,y:r=20,className:s="",once:o=!0}){return fs()?y.jsx("div",{className:s,children:e}):y.jsx(Je.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 qs(e){return typeof e!="string"?"":e.trim()}function qu(e){const t=qs(e);return t?t.split(/[_\-\s]+/).filter(Boolean).map(n=>n.slice(0,1).toUpperCase()+n.slice(1).toLowerCase()).join(" "):""}function zC(e){if(!Array.isArray(e))return[];const t=new Map;for(const n of e){if(!n||typeof n!="object")continue;const r=qs(n.tool),s=qs(n.planType)||qs(n.plan_type);if(!r||!s)continue;const o=qu(r)||r,i=qu(s)||s;t.set(`${r.toLowerCase()}::${s.toLowerCase()}`,{tool:o,plan:i})}return Array.from(t.values())}function qC({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"),m=zC(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=kd(x,p);return v==="-"?l:v},b=(()=>{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 y.jsx(Rn,{delay:.1,children:y.jsxs(Eo,{className:`h-full ${a}`,children:[y.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[y.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:[y.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)}),y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:"7d"})]}),y.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:[y.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)}),y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:"30d"})]}),y.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:[y.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)}),y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:"avg"})]}),y.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:[y.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:g(s)}),y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:b})]})]}),w.length>0&&y.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,D=v+1;return y.jsxs("div",{className:`flex items-center py-2 ${C?"":"border-b border-oai-gray-50 dark:border-oai-gray-800"}`,children:[y.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:D}),y.jsx("span",{className:"flex-1 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate px-2.5",title:k,children:k}),y.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)})}),m.length>0&&y.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:m.map((x,v)=>y.jsxs(wC,{variant:"secondary",size:"sm",children:[x.tool," ",x.plan]},`${x.tool}:${x.plan}:${v}`))}),y.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:[y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx("span",{children:_("identity_card.rank_label")}),y.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:u})]}),y.jsxs("div",{className:"flex items-center gap-1",children:[y.jsx("span",{children:_("identity_card.streak_label")}),y.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:f})]})]})]})})}const Rm=h.createContext(void 0);function hs(e){const t=h.useContext(Rm);if(t===void 0&&!e)throw new Error($n(47));return t}function XC(){return{...wf(),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 ZC={...kf,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 ol extends ka{constructor(t){const n={...XC(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:h.createRef(),backdropRef:h.createRef(),internalBackdropRef:h.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:h.createRef(),beforeContentFocusGuardRef:h.createRef(),stickIfOpenTimeout:new gn,triggerElements:new vo},ZC)}setOpen=(t,n)=>{const r=n.reason===dt,s=n.reason===mn&&n.event.detail===0,o=!t&&(n.reason===bd||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(wy,()=>{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 ol(n)).current,s=t??r;return ga(r.disposeEffect),s}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function Xu({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=ol.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"),m=u.useState("payload"),p=u.useState("openChangeReason");u.useContextCallback("onOpenChange",s),u.useContextCallback("onOpenChangeComplete",o);const{openMethod:g,triggerProps:b,reset:w}=Ef(d);xf(u);const{forceUnmount:x}=vf(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),w()});Df(d&&i===!0&&p!==dt&&g!=="touch",f),h.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);const v=h.useCallback(j=>{const V=Le(j);return V.preventUnmountOnClose=()=>{u.set("preventUnmountingOnClose",!0)},V},[u]),k=h.useCallback(()=>{u.setOpen(!1,v(vd))},[u,v]);h.useImperativeHandle(e.actionsRef,()=>({unmount:x,close:k}),[x,k]);const S=Sf({popupStore:u,onOpenChange:u.setOpen}),C=yf(S,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),D=Cf(S),{getReferenceProps:E,getFloatingProps:O,getTriggerProps:T}=Da([C,D]),R=h.useMemo(()=>E(b),[E,b]),A=h.useMemo(()=>T(b),[T,b]),M=h.useMemo(()=>O(),[O]);u.useSyncedValues({modal:i,openMethod:g,activeTriggerProps:R,inactiveTriggerProps:A,popupProps:M,floatingRootContext:S,nested:Hn()!=null});const I=h.useMemo(()=>({store:u}),[u]);return y.jsx(Rm.Provider,{value:I,children:typeof t=="function"?t({payload:m}):t})}function QC(e){return hs(!0)?y.jsx(Xu,{props:e}):y.jsx(C0,{children:y.jsx(Xu,{props:e})})}const JC=300,eE=h.forwardRef(function(t,n){const{render:r,className:s,disabled:o=!1,nativeButton:i=!0,handle:a,payload:l,openOnHover:c=!1,delay:u=JC,closeDelay:d=0,id:f,...m}=t,p=hs(!0),g=a?.store??p?.store;if(!g)throw new Error($n(74));const b=wd(f),w=g.useState("isTriggerActive",b),x=g.useState("floatingRootContext"),v=g.useState("isOpenedByTrigger",b),k=h.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=Rx(b,k,g,{payload:l,disabled:o,openOnHover:c,closeDelay:d}),D=g.useState("openChangeReason"),E=g.useState("stickIfOpen"),O=g.useState("openMethod"),T=Wx(x,{enabled:x!=null&&c&&(O!=="touch"||D!==mn),mouseOnly:!0,move:!1,handleClose:Yx(),restMs:u,delay:{close:d},triggerElementRef:k,isActiveTrigger:w}),R=I0(x,{enabled:x!=null,stickIfOpen:E}),A=Da([R]),M=g.useState("triggerProps",C),I=h.useMemo(()=>({disabled:o,open:v}),[o,v]),{getButtonProps:j,buttonRef:V}=xd({disabled:o,native:i}),U=h.useMemo(()=>({open(Q){return Q&&D===mn?Zx.open(Q):Xx.open(Q)}}),[D]),P=on("button",t,{state:I,ref:[V,n,S,k],props:[A.getReferenceProps(),T,M,{[Td]:"",id:b},m,j],stateAttributesMapping:U}),F=h.useRef(null),W=he(Q=>{pn.flushSync(()=>{g.setOpen(!1,Le(Hr,Q.nativeEvent,Q.currentTarget))}),lb(F.current)?.focus()}),B=he(Q=>{const Y=g.select("positionerElement");if(Y&&ir(Q,Y))g.context.beforeContentFocusGuardRef.current?.focus();else{pn.flushSync(()=>{g.setOpen(!1,Le(Hr,Q.nativeEvent,Q.currentTarget))});let $=ab(g.context.triggerFocusTargetRef.current||k.current);for(;$!==null&&we(Y,$);){const z=$;if($=va($),$===z)break}$?.focus()}});return w?y.jsxs(h.Fragment,{children:[y.jsx(mr,{ref:F,onFocus:W}),y.jsx(h.Fragment,{children:P},b),y.jsx(mr,{ref:g.context.triggerFocusTargetRef,onFocus:B})]}):y.jsx(h.Fragment,{children:P},b)}),Om=h.createContext(void 0);function tE(){const e=h.useContext(Om);if(e===void 0)throw new Error($n(45));return e}const nE=h.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t,{store:o}=hs();return o.useState("mounted")||r?y.jsx(Om.Provider,{value:r,children:y.jsx(af,{ref:n,...s,renderGuards:!1})}):null}),Am=h.createContext(void 0);function rE(){const e=h.useContext(Am);if(!e)throw new Error($n(46));return e}const sE=h.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:m=5,sticky:p=!1,disableAnchorTracking:g=!1,collisionAvoidance:b=Sy,...w}=t,{store:x}=hs(),v=tE(),k=S0(),S=x.useState("floatingRootContext"),C=x.useState("mounted"),D=x.useState("open"),E=x.useState("openChangeReason"),O=x.useState("activeTriggerElement"),T=x.useState("modal"),R=x.useState("positionerElement"),A=x.useState("instantType"),M=x.useState("transitionStatus"),I=x.useState("hasViewport"),j=h.useRef(null),V=bf(R,!1,!1),U=uv({anchor:o,floatingRootContext:S,positionMethod:i,mounted:C,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:m,collisionBoundary:d,collisionPadding:f,sticky:p,disableAnchorTracking:g,keepMounted:v,nodeId:k,collisionAvoidance:b,adaptiveOrigin:I?cv:void 0}),P=h.useMemo(()=>{const $={};return D||($.pointerEvents="none"),{role:"presentation",hidden:!C,style:{...U.positionerStyles,...$}}},[D,C,U.positionerStyles]),F=h.useMemo(()=>({props:P,...U}),[P,U]),W=S?.select("domReferenceElement");Te(()=>{const $=W,z=j.current;if($&&(j.current=$),z&&$&&$!==z){x.set("instantType",void 0);const Z=new AbortController;return V(()=>{x.set("instantType","trigger-change")},Z.signal),()=>{Z.abort()}}},[W,V,x]);const B=h.useMemo(()=>({open:D,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:A}),[D,F.side,F.align,F.anchorHidden,A]),Q=h.useCallback($=>{x.set("positionerElement",$)},[x]),Y=on("div",t,{state:B,props:[F.props,Vf(M),w],ref:[n,Q],stateAttributesMapping:os});return y.jsxs(Am.Provider,{value:F,children:[C&&T===!0&&E!==dt&&y.jsx(Rf,{ref:x.context.internalBackdropRef,inert:Mf(!D),cutout:O}),y.jsx(T0,{id:k,children:Y})]})}),oE={...os,...xo},iE=h.forwardRef(function(t,n){const{className:r,render:s,initialFocus:o,finalFocus:i,...a}=t,{store:l}=hs(),c=rE(),u=fv()!=null,d=l.useState("open"),f=l.useState("openMethod"),m=l.useState("instantType"),p=l.useState("transitionStatus"),g=l.useState("popupProps"),b=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");Ma({open:d,ref:l.context.popupRef,onComplete(){d&&l.context.onOpenChangeComplete?.(!0)}});const D=l.useState("disabled"),E=l.useState("openOnHover"),O=l.useState("closeDelay");Lx(C,{enabled:E&&!D,closeDelay:O});function T(j){return j==="touch"?l.context.popupRef.current:!0}const R=o===void 0?T:o,A=h.useMemo(()=>({open:d,side:c.side,align:c.align,instant:m,transitionStatus:p}),[d,c.side,c.align,m,p]),M=h.useCallback(j=>{l.set("popupElement",j)},[l]),I=on("div",t,{state:A,ref:[n,l.context.popupRef,M],props:[g,{"aria-labelledby":b,"aria-describedby":w,onKeyDown(j){u&&Lf.has(j.key)&&j.stopPropagation()}},Vf(p),a],stateAttributesMapping:oE});return y.jsx(lf,{context:C,openInteractionType:f,modal:x==="trap-focus",disabled:!v||k===dt,initialFocus:R,returnFocus:i,restoreFocus:"popup",previousFocusableElement:rt(S)?S:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:I})});function aE(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 lE={},Lr={};function Nn(e,t){try{const r=(lE[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return r in Lr?Lr[r]:Zu(r,r.split(":"))}catch{if(e in Lr)return Lr[e];const n=e?.match(cE);return n?Zu(e,n.slice(1)):NaN}}const cE=/([+-]\d\d):?(\d\d)?/;function Zu(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 Yt extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Nn(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)),Nm(this),ua(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new Yt(...n,t):new Yt(Date.now(),t)}withTimeZone(t){return new Yt(+this,t)}getTimezoneOffset(){const t=-Nn(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),ua(this),+this}[Symbol.for("constructDateFrom")](t){return new Yt(+new Date(t),this.timeZone)}}const Qu=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Qu.test(e))return;const t=e.replace(Qu,"$1UTC");Yt.prototype[t]&&(e.startsWith("get")?Yt.prototype[e]=function(){return this.internal[t]()}:(Yt.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),uE(this),+this},Yt.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),ua(this),+this}))});function ua(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Nn(e.timeZone,e)*60))}function uE(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()),Nm(e)}function Nm(e){const t=Nn(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(-(Nn(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=Nn(e.timeZone,e),m=f>0?Math.floor(f):Math.ceil(f),g=-new Date(+e).getTimezoneOffset()-m,b=m!==n,w=g-l;if(b&&w){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+w);const x=Nn(e.timeZone,e),v=x>0?Math.floor(x):Math.ceil(x),k=m-v;k&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+k),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+k))}}class Qe extends Yt{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} (${aE(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 jm=6048e5,dE=864e5,Ju=Symbol.for("constructDateFrom");function Ge(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Ju in e?e[Ju](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ce(e,t){return Ge(t||e,e)}function Im(e,t,n){const r=Ce(e,n?.in);return isNaN(t)?Ge(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function Fm(e,t,n){const r=Ce(e,n?.in);if(isNaN(t))return Ge(e,NaN);if(!t)return r;const s=r.getDate(),o=Ge(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 fE={};function ms(){return fE}function gr(e,t){const n=ms(),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 Lm(e,t){const n=Ce(e,t?.in),r=n.getFullYear(),s=Ge(n,0);s.setFullYear(r+1,0,4),s.setHours(0,0,0,0);const o=Jr(s),i=Ge(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 ed(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=Ge.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 il(e,t,n){const[r,s]=Cr(n?.in,e,t),o=es(r),i=es(s),a=+o-ed(o),l=+i-ed(i);return Math.round((a-l)/dE)}function hE(e,t){const n=Lm(e,t),r=Ge(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Jr(r)}function mE(e,t,n){return Im(e,t*7,n)}function pE(e,t,n){return Fm(e,t*12,n)}function gE(e,t){let n,r=t?.in;return e.forEach(s=>{!r&&typeof s=="object"&&(r=Ge.bind(null,s));const o=Ce(s,r);(!n||n<o||isNaN(+o))&&(n=o)}),Ge(r,n||NaN)}function yE(e,t){let n,r=t?.in;return e.forEach(s=>{!r&&typeof s=="object"&&(r=Ge.bind(null,s));const o=Ce(s,r);(!n||n>o||isNaN(+o))&&(n=o)}),Ge(r,n||NaN)}function bE(e,t,n){const[r,s]=Cr(n?.in,e,t);return+es(r)==+es(s)}function Vm(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function xE(e){return!(!Vm(e)&&typeof e!="number"||isNaN(+Ce(e)))}function _m(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 vE(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 Wm(e,t){const[n,r]=Cr(e,t.start,t.end);return{start:n,end:r}}function wE(e,t){const{start:n,end:r}=Wm(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(Ge(n,i)),i.setMonth(i.getMonth()+a);return s?l.reverse():l}function kE(e,t){const n=Ce(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function SE(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 Bm(e,t){const n=Ce(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function TE(e,t){const{start:n,end:r}=Wm(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(Ge(n,i)),i.setFullYear(i.getFullYear()+a);return s?l.reverse():l}function $m(e,t){const n=ms(),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 CE(e,t){return $m(e,{...t,weekStartsOn:1})}const EE={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"}},ME=(e,t,n)=>{let r;const s=EE[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 ki(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const DE={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},PE={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},RE={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},OE={date:ki({formats:DE,defaultWidth:"full"}),time:ki({formats:PE,defaultWidth:"full"}),dateTime:ki({formats:RE,defaultWidth:"full"})},AE={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},NE=(e,t,n,r)=>AE[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 jE={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},IE={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},FE={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"]},LE={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"]},VE={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"}},_E={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"}},WE=(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"},BE={ordinalNumber:WE,era:Nr({values:jE,defaultWidth:"wide"}),quarter:Nr({values:IE,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Nr({values:FE,defaultWidth:"wide"}),day:Nr({values:LE,defaultWidth:"wide"}),dayPeriod:Nr({values:VE,defaultWidth:"wide",formattingValues:_E,defaultFormattingWidth:"wide"})};function jr(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)?YE(a,d=>d.test(i)):$E(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 $E(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function YE(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function HE(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 UE=/^(\d+)(th|st|nd|rd)?/i,GE=/\d+/i,KE={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},zE={any:[/^b/i,/^(a|c)/i]},qE={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},XE={any:[/1/i,/2/i,/3/i,/4/i]},ZE={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},QE={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]},JE={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},eM={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]},tM={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},nM={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}},rM={ordinalNumber:HE({matchPattern:UE,parsePattern:GE,valueCallback:e=>parseInt(e,10)}),era:jr({matchPatterns:KE,defaultMatchWidth:"wide",parsePatterns:zE,defaultParseWidth:"any"}),quarter:jr({matchPatterns:qE,defaultMatchWidth:"wide",parsePatterns:XE,defaultParseWidth:"any",valueCallback:e=>e+1}),month:jr({matchPatterns:ZE,defaultMatchWidth:"wide",parsePatterns:QE,defaultParseWidth:"any"}),day:jr({matchPatterns:JE,defaultMatchWidth:"wide",parsePatterns:eM,defaultParseWidth:"any"}),dayPeriod:jr({matchPatterns:tM,defaultMatchWidth:"any",parsePatterns:nM,defaultParseWidth:"any"})},tr={code:"en-US",formatDistance:ME,formatLong:OE,formatRelative:NE,localize:BE,match:rM,options:{weekStartsOn:0,firstWeekContainsDate:1}};function sM(e,t){const n=Ce(e,t?.in);return il(n,Bm(n))+1}function al(e,t){const n=Ce(e,t?.in),r=+Jr(n)-+hE(n);return Math.round(r/jm)+1}function Ym(e,t){const n=Ce(e,t?.in),r=n.getFullYear(),s=ms(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=Ge(t?.in||e,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const a=gr(i,t),l=Ge(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 oM(e,t){const n=ms(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=Ym(e,t),o=Ge(t?.in||e,0);return o.setFullYear(s,0,r),o.setHours(0,0,0,0),gr(o,t)}function ll(e,t){const n=Ce(e,t?.in),r=+gr(n,t)-+oM(n,t);return Math.round(r/jm)+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)}},Zn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},td={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=Ym(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=Lm(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=ll(e,r);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):ve(s,t.length)},I:function(e,t,n){const r=al(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=sM(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=Zn.noon:r===0?s=Zn.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=Zn.evening:r>=12?s=Zn.afternoon:r>=4?s=Zn.morning:s=Zn.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 rd(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 rd(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"+nd(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"+nd(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 nd(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 rd(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 sd=(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"})}},Hm=(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"})}},iM=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return sd(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}}",sd(r,t)).replace("{{time}}",Hm(s,t))},aM={p:Hm,P:iM},lM=/^D+$/,cM=/^Y+$/,uM=["D","DD","YY","YYYY"];function dM(e){return lM.test(e)}function fM(e){return cM.test(e)}function hM(e,t,n){const r=mM(e,t,n);if(console.warn(r),uM.includes(e))throw new RangeError(r)}function mM(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 pM=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,gM=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,yM=/^'([^]*?)'?$/,bM=/''/g,xM=/[a-zA-Z]/;function Ht(e,t,n){const r=ms(),s=n?.locale??r.locale??tr,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(!xE(a))throw new RangeError("Invalid time value");let l=t.match(gM).map(u=>{const d=u[0];if(d==="p"||d==="P"){const f=aM[d];return f(u,s.formatLong)}return u}).join("").match(pM).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:vM(u)};if(td[d])return{isToken:!0,value:u};if(d.match(xM))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&&fM(d)||!n?.useAdditionalDayOfYearTokens&&dM(d))&&hM(d,t,String(e));const f=td[d[0]];return f(a,d,s.localize,c)}).join("")}function vM(e){const t=e.match(yM);return t?t[1].replace(bM,"'"):e}function wM(e,t){const n=Ce(e,t?.in),r=n.getFullYear(),s=n.getMonth(),o=Ge(n,0);return o.setFullYear(r,s+1,0),o.setHours(0,0,0,0),o.getDate()}function kM(e,t){return Ce(e,t?.in).getMonth()}function SM(e,t){return Ce(e,t?.in).getFullYear()}function TM(e,t){return+Ce(e)>+Ce(t)}function CM(e,t){return+Ce(e)<+Ce(t)}function EM(e,t,n){const[r,s]=Cr(n?.in,e,t);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function MM(e,t,n){const[r,s]=Cr(n?.in,e,t);return r.getFullYear()===s.getFullYear()}function DM(e,t,n){const r=Ce(e,n?.in),s=r.getFullYear(),o=r.getDate(),i=Ge(e,0);i.setFullYear(s,t,15),i.setHours(0,0,0,0);const a=wM(i);return r.setMonth(t,Math.min(o,a)),r}function PM(e,t,n){const r=Ce(e,n?.in);return isNaN(+r)?Ge(e,NaN):(r.setFullYear(t),r)}const od=5,RM=4;function OM(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,s=t.addDays(e,-r+1),o=t.addDays(s,od*7-1);return t.getMonth(e)===t.getMonth(o)?od:RM}function Um(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 AM(e,t){const n=Um(e,t),r=OM(e,t);return t.addDays(n,r*7-1)}const Gm={...tr,labels:{labelDayButton:(e,t,n,r)=>{let s;r&&typeof r.format=="function"?s=r.format.bind(r):s=(i,a)=>Ht(i,a,{locale:tr,...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)=>Ht(s,o,{locale:tr,...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)=>Ht(i,a,{locale:tr,...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)=>Ht(s,o,{locale:tr,...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):Im(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):Fm(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):mE(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):pE(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):il(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):_m(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):wE(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):TE(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):AM(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):CE(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):vE(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):$m(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):SE(r),this.format=(r,s,o)=>{const i=this.overrides?.format?this.overrides.format(r,s,this.options):Ht(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):al(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):kM(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):SM(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):ll(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):TM(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):CM(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):Vm(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):bE(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):EM(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):MM(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):gE(r),this.min=r=>this.overrides?.min?this.overrides.min(r):yE(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):DM(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):PM(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Um(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):kE(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):Bm(r),this.options={locale:Gm,...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 zt=new pt;class Km{constructor(t,n,r=zt){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 NM{constructor(t,n){this.date=t,this.weeks=n}}class jM{constructor(t,n){this.days=n,this.weekNumber=t}}function IM(e){return q.createElement("button",{...e})}function FM(e){return q.createElement("span",{...e})}function LM(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 VM(e){const{day:t,modifiers:n,...r}=e;return q.createElement("td",{...r})}function _M(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 Fe;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(Fe||(Fe={}));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 ut;(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"})(ut||(ut={}));function WM(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 BM(e){return q.createElement("div",{...e})}function $M(e){return q.createElement("div",{...e})}function YM(e){const{calendarMonth:t,displayIndex:n,...r}=e;return q.createElement("div",{...r},e.children)}function HM(e){const{calendarMonth:t,displayIndex:n,...r}=e;return q.createElement("div",{...r})}function UM(e){return q.createElement("table",{...e})}function GM(e){return q.createElement("div",{...e})}const zm=h.createContext(void 0);function ps(){const e=h.useContext(zm);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function KM(e){const{components:t}=ps();return q.createElement(t.Dropdown,{...e})}function zM(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:s,...o}=e,{components:i,classNames:a,labels:{labelPrevious:l,labelNext:c}}=ps(),u=h.useCallback(f=>{s&&n?.(f)},[s,n]),d=h.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 qM(e){const{components:t}=ps();return q.createElement(t.Button,{...e})}function XM(e){return q.createElement("option",{...e})}function ZM(e){const{components:t}=ps();return q.createElement(t.Button,{...e})}function QM(e){const{rootRef:t,...n}=e;return q.createElement("div",{...n,ref:t})}function JM(e){return q.createElement("select",{...e})}function e1(e){const{week:t,...n}=e;return q.createElement("tr",{...n})}function t1(e){return q.createElement("th",{...e})}function n1(e){return q.createElement("thead",{"aria-hidden":!0},q.createElement("tr",{...e}))}function r1(e){const{week:t,...n}=e;return q.createElement("th",{...n})}function s1(e){return q.createElement("th",{...e})}function o1(e){return q.createElement("tbody",{...e})}function i1(e){const{components:t}=ps();return q.createElement(t.Dropdown,{...e})}const a1=Object.freeze(Object.defineProperty({__proto__:null,Button:IM,CaptionLabel:FM,Chevron:LM,Day:VM,DayButton:_M,Dropdown:WM,DropdownNav:BM,Footer:$M,Month:YM,MonthCaption:HM,MonthGrid:UM,Months:GM,MonthsDropdown:KM,Nav:zM,NextMonthButton:qM,Option:XM,PreviousMonthButton:ZM,Root:QM,Select:JM,Week:e1,WeekNumber:r1,WeekNumberHeader:s1,Weekday:t1,Weekdays:n1,Weeks:o1,YearsDropdown:i1},Symbol.toStringTag,{value:"Module"}));function tn(e,t,n=!1,r=zt){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 cl(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Mo(e){return!!(e&&typeof e=="object"&&"from"in e)}function ul(e){return!!(e&&typeof e=="object"&&"after"in e)}function dl(e){return!!(e&&typeof e=="object"&&"before"in e)}function qm(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Xm(e,t){return Array.isArray(e)&&e.every(t.isDate)}function nn(e,t,n=zt){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(Xm(a,n))return a.some(l=>s(e,l));if(Mo(a))return tn(a,e,!1,n);if(qm(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(e.getDay()):a.dayOfWeek===e.getDay();if(cl(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 ul(a)?o(e,a.after)>0:dl(a)?o(a.before,e)>0:typeof a=="function"?a(e):!1})}function l1(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:m,isBefore:p,endOfMonth:g,isAfter:b}=s,w=n&&m(n),x=r&&g(r),v={[Fe.focused]:[],[Fe.outside]:[],[Fe.disabled]:[],[Fe.hidden]:[],[Fe.today]:[]},k={};for(const S of e){const{date:C,displayMonth:D}=S,E=!!(D&&!f(C,D)),O=!!(w&&p(C,w)),T=!!(x&&b(C,x)),R=!!(o&&nn(C,o,s)),A=!!(i&&nn(C,i,s))||O||T||!c&&!l&&E||c&&l===!1&&E,M=d(C,u);E&&v.outside.push(S),R&&v.disabled.push(S),A&&v.hidden.push(S),M&&v.today.push(S),a&&Object.keys(a).forEach(I=>{const j=a?.[I];j&&nn(C,j,s)&&(k[I]?k[I].push(S):k[I]=[S])})}return S=>{const C={[Fe.focused]:!1,[Fe.disabled]:!1,[Fe.hidden]:!1,[Fe.outside]:!1,[Fe.today]:!1},D={};for(const E in v){const O=v[E];C[E]=O.some(T=>T===S)}for(const E in k)D[E]=k[E].some(O=>O===S);return{...C,...D}}}function c1(e,t,n={}){return Object.entries(e).filter(([,s])=>s===!0).reduce((s,[o])=>(n[o]?s.push(n[o]):t[Fe[o]]?s.push(t[Fe[o]]):t[Rt[o]]&&s.push(t[Rt[o]]),s),[t[ae.Day]])}function u1(e){return{...a1,...e}}function d1(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 f1(){const e={};for(const t in ae)e[ae[t]]=`rdp-${ae[t]}`;for(const t in Fe)e[Fe[t]]=`rdp-${Fe[t]}`;for(const t in Rt)e[Rt[t]]=`rdp-${Rt[t]}`;for(const t in ut)e[ut[t]]=`rdp-${ut[t]}`;return e}function Zm(e,t,n){return(n??new pt(t)).formatMonthYear(e)}const h1=Zm;function m1(e,t,n){return(n??new pt(t)).format(e,"d")}function p1(e,t=zt){return t.format(e,"LLLL")}function g1(e,t,n){return(n??new pt(t)).format(e,"cccccc")}function y1(e,t=zt){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function b1(){return""}function Qm(e,t=zt){return t.format(e,"yyyy")}const x1=Qm,v1=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Zm,formatDay:m1,formatMonthCaption:h1,formatMonthDropdown:p1,formatWeekNumber:y1,formatWeekNumberHeader:b1,formatWeekdayName:g1,formatYearCaption:x1,formatYearDropdown:Qm},Symbol.toStringTag,{value:"Module"}));function w1(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...v1,...e}}function fl(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 k1=fl;function hl(e,t,n){return(n??new pt(t)).formatMonthYear(e)}const S1=hl;function Jm(e,t,n,r){let s=(r??new pt(n)).format(e,"PPPP");return t?.today&&(s=`Today, ${s}`),s}function ep(e){return"Choose the Month"}function tp(){return""}const T1="Go to the Next Month";function np(e,t){return T1}function rp(e){return"Go to the Previous Month"}function sp(e,t,n){return(n??new pt(t)).format(e,"cccc")}function op(e,t){return`Week ${e}`}function ip(e){return"Week Number"}function ap(e){return"Choose the Year"}const C1=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:S1,labelDay:k1,labelDayButton:fl,labelGrid:hl,labelGridcell:Jm,labelMonthDropdown:ep,labelNav:tp,labelNext:np,labelPrevious:rp,labelWeekNumber:op,labelWeekNumberHeader:ip,labelWeekday:sp,labelYearDropdown:ap},Symbol.toStringTag,{value:"Module"})),Mt=(e,t,n)=>t||(n?typeof n=="function"?n:(...r)=>n:e);function E1(e,t){const n=t.locale?.labels??{};return{...C1,...e??{},labelDayButton:Mt(fl,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:Mt(ep,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Mt(np,e?.labelNext,n.labelNext),labelPrevious:Mt(rp,e?.labelPrevious,n.labelPrevious),labelWeekNumber:Mt(op,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Mt(ap,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:Mt(hl,e?.labelGrid,n.labelGrid),labelGridcell:Mt(Jm,e?.labelGridcell,n.labelGridcell),labelNav:Mt(tp,e?.labelNav,n.labelNav),labelWeekNumberHeader:Mt(ip,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Mt(sp,e?.labelWeekday,n.labelWeekday)}}function M1(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 m=r.formatMonthDropdown(f,s),p=c(f),g=t&&f<o(t)||n&&f>o(n)||!1;return{value:p,label:m,disabled:g}})}function D1(e,t={},n={}){let r={...t?.[ae.Day]};return Object.entries(e).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function P1(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 R1(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 m=n.formatYearDropdown(f,r);return{value:l(f),label:m,disabled:!1}})}function O1(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 ll(c,{weekStartsOn:l?.weekStartsOn??s,firstWeekContainsDate:l?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:a=>{const l=i(a);return al(l)},differenceInCalendarDays:(a,l)=>{const c=i(a),u=i(l);return il(c,u)},differenceInCalendarMonths:(a,l)=>{const c=i(a),u=i(l);return _m(c,u)}}}const gs=e=>e instanceof HTMLElement?e:null,Si=e=>[...e.querySelectorAll("[data-animated-month]")??[]],A1=e=>gs(e.querySelector("[data-animated-month]")),Ti=e=>gs(e.querySelector("[data-animated-caption]")),Ci=e=>gs(e.querySelector("[data-animated-weeks]")),N1=e=>gs(e.querySelector("[data-animated-nav]")),j1=e=>gs(e.querySelector("[data-animated-weekdays]"));function I1(e,t,{classNames:n,months:r,focused:s,dateLib:o}){const i=h.useRef(null),a=h.useRef(r),l=h.useRef(!1);h.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[ut.caption_after_enter]:n[ut.caption_before_enter],m=d?n[ut.weeks_after_enter]:n[ut.weeks_before_enter],p=i.current,g=e.current.cloneNode(!0);if(g instanceof HTMLElement?(Si(g).forEach(v=>{if(!(v instanceof HTMLElement))return;const k=A1(v);k&&v.contains(k)&&v.removeChild(k);const S=Ti(v);S&&S.classList.remove(f);const C=Ci(v);C&&C.classList.remove(m)}),i.current=g):i.current=null,l.current||u||s)return;const b=p instanceof HTMLElement?Si(p):[],w=Si(e.current);if(w?.every(x=>x instanceof HTMLElement)&&b&&b.every(x=>x instanceof HTMLElement)){l.current=!0,e.current.style.isolation="isolate";const x=N1(e.current);x&&(x.style.zIndex="1"),w.forEach((v,k)=>{const S=b[k];if(!S)return;v.style.position="relative",v.style.overflow="hidden";const C=Ti(v);C&&C.classList.add(f);const D=Ci(v);D&&D.classList.add(m);const E=()=>{l.current=!1,e.current&&(e.current.style.isolation=""),x&&(x.style.zIndex=""),C&&C.classList.remove(f),D&&D.classList.remove(m),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 O=j1(S);O&&(O.style.opacity="0");const T=Ti(S);T&&(T.classList.add(d?n[ut.caption_before_exit]:n[ut.caption_after_exit]),T.addEventListener("animationend",E));const R=Ci(S);R&&R.classList.add(d?n[ut.weeks_before_exit]:n[ut.weeks_after_exit]),v.insertBefore(S,v.firstChild)})}})}function F1(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:m,endOfMonth:p,endOfWeek:g,isAfter:b,startOfBroadcastWeek:w,startOfISOWeek:x,startOfWeek:v}=r,k=l?w(s,r):i?x(s):v(s),S=l?f(o):i?m(p(o)):g(p(o)),C=t&&(l?f(t):i?m(t):g(t)),D=C&&b(S,C)?C:S,E=u(D,k),O=d(o,s)+1,T=[];for(let M=0;M<=E;M++){const I=c(k,M);T.push(I)}const A=(l?35:42)*O;if(a&&T.length<A){const M=A-T.length;for(let I=0;I<M;I++){const j=c(T[T.length-1],1);T.push(j)}}return T}function L1(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 V1(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 id(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 _1(e,t,n,r){const{addDays:s,endOfBroadcastWeek:o,endOfISOWeek:i,endOfMonth:a,endOfWeek:l,getISOWeek:c,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:m}=r,p=e.reduce((g,b)=>{const w=n.broadcastCalendar?d(b,r):n.ISOWeek?f(b):m(b),x=n.broadcastCalendar?o(b):n.ISOWeek?i(a(b)):l(a(b)),v=t.filter(D=>D>=w&&D<=x),k=n.broadcastCalendar?35:42;if(n.fixedWeeks&&v.length<k){const D=t.filter(E=>{const O=k-v.length;return E>x&&E<=s(x,O)});v.push(...D)}const S=v.reduce((D,E)=>{const O=n.ISOWeek?c(E):u(E),T=D.find(A=>A.weekNumber===O),R=new Km(E,b,r);return T?T.days.push(R):D.push(new jM(O,[R])),D},[]),C=new NM(b,S);return g.push(C),g},[]);return n.reverseMonths?p.reverse():p}function W1(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:m,fromMonth:p,toMonth:g}=e;!n&&p&&(n=p),!n&&f&&(n=t.newDate(f,0,1)),!r&&g&&(r=g),!r&&m&&(r=u(m,11,31));const b=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=i(n):f?n=u(f,0,1):!n&&b&&(n=s(l(e.today??d(),-100))),r?r=a(r):m?r=u(m,11,31):!r&&b&&(r=c(e.today??d())),[n&&o(n),r&&o(r)]}function B1(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 $1(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 Y1(e){const t=[];return e.reduce((n,r)=>n.concat(r.weeks.slice()),t.slice())}function Do(e,t){const[n,r]=h.useState(e);return[t===void 0?n:t,r]}function H1(e,t){const[n,r]=W1(e,t),{startOfMonth:s,endOfMonth:o}=t,i=id(e,n,r,t),[a,l]=Do(i,e.month?i:void 0);h.useEffect(()=>{const k=id(e,n,r,t);l(k)},[e.timeZone]);const{months:c,weeks:u,days:d,previousMonth:f,nextMonth:m}=h.useMemo(()=>{const k=V1(a,r,{numberOfMonths:e.numberOfMonths},t),S=F1(k,e.endMonth?o(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),C=_1(k,S,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),D=Y1(C),E=L1(C),O=$1(a,n,e,t),T=B1(a,r,e,t);return{months:C,weeks:D,days:E,previousMonth:O,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,b=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:m,goToMonth:w,goToDay:k=>{b(k)||w(k.date)}}}var Vt;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Vt||(Vt={}));function ad(e){return!e[Fe.disabled]&&!e[Fe.hidden]&&!e[Fe.outside]}function U1(e,t,n,r){let s,o=-1;for(const i of e){const a=t(i);ad(a)&&(a[Fe.focused]&&o<Vt.FocusedModifier?(s=i,o=Vt.FocusedModifier):r?.isEqualTo(i)&&o<Vt.LastFocused?(s=i,o=Vt.LastFocused):n(i.date)&&o<Vt.Selected?(s=i,o=Vt.Selected):a[Fe.today]&&o<Vt.Today&&(s=i,o=Vt.Today))}return s||(s=e.find(i=>ad(t(i)))),s}function G1(e,t,n,r,s,o,i){const{ISOWeek:a,broadcastCalendar:l}=o,{addDays:c,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:m,endOfISOWeek:p,endOfWeek:g,max:b,min:w,startOfBroadcastWeek:x,startOfISOWeek:v,startOfWeek:k}=i;let C={day:c,week:d,month:u,year:f,startOfWeek:D=>l?x(D,i):a?v(D):k(D),endOfWeek:D=>l?m(D):a?p(D):g(D)}[e](n,t==="after"?1:-1);return t==="before"&&r?C=b([r,C]):t==="after"&&s&&(C=w([s,C])),C}function lp(e,t,n,r,s,o,i,a=0){if(a>365)return;const l=G1(e,t,n.date,r,s,o,i),c=!!(o.disabled&&nn(l,o.disabled,i)),u=!!(o.hidden&&nn(l,o.hidden,i)),d=l,f=new Km(l,d,i);return!c&&!u?f:lp(e,t,f,r,s,o,i,a+1)}function K1(e,t,n,r,s){const{autoFocus:o}=e,[i,a]=h.useState(),l=U1(t.days,n,r||(()=>!1),i),[c,u]=h.useState(o?l:void 0);return{isFocusTarget:g=>!!l?.isEqualTo(g),setFocused:u,focused:c,blur:()=>{a(c),u(void 0)},moveFocus:(g,b)=>{if(!c)return;const w=lp(g,b,c,t.navStart,t.navEnd,e,s);w&&(e.disableNavigation&&!t.days.some(v=>v.isEqualTo(w))||(t.goToDay(w),u(w)))}}}function z1(e,t){const{selected:n,required:r,onSelect:s}=e,[o,i]=Do(n,s?n:void 0),a=s?n:o,{isSameDay:l}=t,c=m=>a?.some(p=>l(p,m))??!1,{min:u,max:d}=e;return{selected:a,select:(m,p,g)=>{let b=[...a??[]];if(c(m)){if(a?.length===u||r&&a?.length===1)return;b=a?.filter(w=>!l(w,m))}else a?.length===d?b=[m]:b=[...b,m];return s||i(b),s?.(b,m,p,g),b},isSelected:c}}function q1(e,t,n=0,r=0,s=!1,o=zt){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 X1(e,t,n=zt){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 ld(e,t,n=zt){return tn(e,t.from,!1,n)||tn(e,t.to,!1,n)||tn(t,e.from,!1,n)||tn(t,e.to,!1,n)}function Z1(e,t,n=zt){const r=Array.isArray(t)?t:[t];if(r.filter(a=>typeof a!="function").some(a=>typeof a=="boolean"?a:n.isDate(a)?tn(e,a,!1,n):Xm(a,n)?a.some(l=>tn(e,l,!1,n)):Mo(a)?a.from&&a.to?ld(e,{from:a.from,to:a.to},n):!1:qm(a)?X1(e,a.dayOfWeek,n):cl(a)?n.isAfter(a.before,a.after)?ld(e,{from:n.addDays(a.after,1),to:n.addDays(a.before,-1)},n):nn(e.from,a,n)||nn(e.to,a,n):ul(a)||dl(a)?nn(e.from,a,n)||nn(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 Q1(e,t){const{disabled:n,excludeDisabled:r,resetOnSelect:s,selected:o,required:i,onSelect:a}=e,[l,c]=Do(o,a?o:void 0),u=a?o:l;return{selected:u,select:(m,p,g)=>{const{min:b,max:w}=e;let x;if(m){const v=u?.from,k=u?.to,S=!!v&&!!k,C=!!v&&!!k&&t.isSameDay(v,k)&&t.isSameDay(m,v);s&&(S||!u?.from)?!i&&C?x=void 0:x={from:m,to:void 0}:x=q1(m,u,b,w,i,t)}return r&&n&&x?.from&&x.to&&Z1({from:x.from,to:x.to},n,t)&&(x.from=m,x.to=void 0),a||c(x),a?.(x,m,p,g),x},isSelected:m=>u&&tn(u,m,!1,t)}}function J1(e,t){const{selected:n,required:r,onSelect:s}=e,[o,i]=Do(n,s?n:void 0),a=s?n:o,{isSameDay:l}=t;return{selected:a,select:(d,f,m)=>{let p=d;return!r&&a&&a&&l(d,a)&&(p=void 0),s||i(p),s?.(p,d,f,m),p},isSelected:d=>a?l(a,d):!1}}function eD(e,t){const n=J1(e,t),r=z1(e,t),s=Q1(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 Qn(e,t,n){return gt(e,t)}function cd(e,t,n){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Qn(e,t):Array.isArray(e)?e.map(r=>r instanceof Date?Qn(r,t):r):Mo(e)?{...e,from:e.from?gt(e.from,t):e.from,to:e.to?gt(e.to,t):e.to}:cl(e)?{before:Qn(e.before,t),after:Qn(e.after,t)}:ul(e)?{after:Qn(e.after,t)}:dl(e)?{before:Qn(e.before,t)}:e}function Ei(e,t,n){return e&&(Array.isArray(e)?e.map(r=>cd(r,t)):cd(e,t))}function tD(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=Ei(t.disabled,n)),t.hidden!==void 0&&(t.hidden=Ei(t.hidden,n)),t.modifiers)){const re={};Object.keys(t.modifiers).forEach(G=>{re[G]=Ei(t.modifiers?.[G],n)}),t.modifiers=re}const{components:r,formatters:s,labels:o,dateLib:i,locale:a,classNames:l}=h.useMemo(()=>{const re={...Gm,...t.locale},G=t.broadcastCalendar?1:t.weekStartsOn,oe=t.noonSafe&&t.timeZone?O1(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:u1(t.components),formatters:w1(t.formatters),labels:E1(t.labels,xe.options),locale:re,classNames:{...f1(),...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:m,onDayClick:p,onDayFocus:g,onDayKeyDown:b,onDayMouseEnter:w,onDayMouseLeave:x,onNextClick:v,onPrevClick:k,showWeekNumber:S,styles:C}=t,{formatCaption:D,formatDay:E,formatMonthDropdown:O,formatWeekNumber:T,formatWeekNumberHeader:R,formatWeekdayName:A,formatYearDropdown:M}=s,I=H1(t,i),{days:j,months:V,navStart:U,navEnd:P,previousMonth:F,nextMonth:W,goToMonth:B}=I,Q=l1(j,t,U,P,i),{isSelected:Y,select:$,selected:z}=eD(t,i)??{},{blur:Z,focused:ce,isFocusTarget:Se,moveFocus:Re,setFocused:Ee}=K1(t,I,Q,Y??(()=>!1),i),{labelDayButton:et,labelGridcell:L,labelGrid:ue,labelMonthDropdown:te,labelNav:Me,labelPrevious:H,labelNext:se,labelWeekday:ie,labelWeekNumber:me,labelWeekNumberHeader:ge,labelYearDropdown:J}=o,ne=h.useMemo(()=>P1(i,t.ISOWeek,t.broadcastCalendar,t.today),[i,t.ISOWeek,t.broadcastCalendar,t.today]),Ve=u!==void 0||p!==void 0,be=h.useCallback(()=>{F&&(B(F),k?.(F))},[F,B,k]),Be=h.useCallback(()=>{W&&(B(W),v?.(W))},[B,W,v]),$e=h.useCallback((re,G)=>oe=>{oe.preventDefault(),oe.stopPropagation(),Ee(re),!G.disabled&&($?.(re.date,G,oe),p?.(re.date,G,oe))},[$,p,Ee]),it=h.useCallback((re,G)=>oe=>{Ee(re),g?.(re.date,G,oe)},[g,Ee]),Oe=h.useCallback((re,G)=>oe=>{Z(),m?.(re.date,G,oe)},[Z,m]),ye=h.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)}b?.(re.date,G,oe)},[Re,b,t.dir]),je=h.useCallback((re,G)=>oe=>{w?.(re.date,G,oe)},[w]),Ye=h.useCallback((re,G)=>oe=>{x?.(re.date,G,oe)},[x]),Nt=h.useCallback(re=>G=>{const oe=Number(G.target.value),de=i.setMonth(i.startOfMonth(re),oe);B(de)},[i,B]),kt=h.useCallback(re=>G=>{const oe=Number(G.target.value),de=i.setYear(i.startOfMonth(re),oe);B(de)},[i,B]),{className:tt,style:ln}=h.useMemo(()=>({className:[l[ae.Root],t.className].filter(Boolean).join(" "),style:{...C?.[ae.Root],...t.style}}),[l,t.className,t.style,C]),lt=d1(t),De=h.useRef(null);I1(De,!!t.animate,{classNames:l,months:V,focused:ce,dateLib:i});const He={dayPickerProps:t,selected:z,select:$,isSelected:Y,months:V,nextMonth:W,previousMonth:F,goToMonth:B,getModifiers:Q,components:r,classNames:l,styles:C,labels:o,formatters:s};return q.createElement(zm.Provider,{value:He},q.createElement(r.Root,{rootRef:t.animate?De:void 0,className:tt,style:ln,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"],...lt},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:Be,previousMonth:F,nextMonth:W}),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:F?void 0:-1,"aria-disabled":F?void 0:!0,"aria-label":H(F),onClick:be,"data-animated-button":t.animate?"true":void 0},q.createElement(r.Chevron,{disabled:F?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:M1(re.date,U,P,s,i),style:C?.[ae.Dropdown],value:i.getMonth(re.date)}):q.createElement("span",{key:"month"},O(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:R1(U,P,s,i,!!t.reverseYears),style:C?.[ae.Dropdown],value:i.getYear(re.date)}):q.createElement("span",{key:"year"},M(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"}},D(re.date,i.options,i))):q.createElement(r.CaptionLabel,{className:l[ae.CaptionLabel],role:"status","aria-live":"polite"},D(re.date,i.options,i))),d==="around"&&!t.hideNavigation&&G===f-1&&q.createElement(r.NextMonthButton,{type:"button",className:l[ae.NextMonthButton],tabIndex:W?void 0:-1,"aria-disabled":W?void 0:!0,"aria-label":se(W),onClick:Be,"data-animated-button":t.animate?"true":void 0},q.createElement(r.Chevron,{disabled:W?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:Be,previousMonth:F,nextMonth:W}),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[Fe.focused]=!fe.hidden&&!!ce?.isEqualTo(de),fe[Rt.selected]=Y?.(xe)||fe.selected,Mo(z)){const{from:qt,to:cn}=z;fe[Rt.range_start]=!!(qt&&cn&&i.isSameDay(xe,qt)),fe[Rt.range_end]=!!(qt&&cn&&i.isSameDay(xe,cn)),fe[Rt.range_middle]=tn(z,xe,!0,i)}const jt=D1(fe,C,t.modifiersStyles),wn=c1(fe,l,t.modifiersClassNames),kn=!Ve&&!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:jt,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&&Ve?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":et(xe,fe,i.options,i),onClick:$e(de,fe),onBlur:Oe(de,fe),onFocus:it(de,fe),onKeyDown:ye(de,fe),onMouseEnter:je(de,fe),onMouseLeave:Ye(de,fe)},E(xe,i.options,i)):!fe.hidden&&E(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 ud(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())?Ht(n,"MMM d"):e}function nD({from:e,to:t,onApply:n,onCancel:r}){const s=h.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]=h.useState(s),a=()=>{if(!o?.from)return;const c=Ht(o.from,"yyyy-MM-dd"),u=o.to?Ht(o.to,"yyyy-MM-dd"):c;n?.(c,u)},l=!!o?.from;return y.jsxs("div",{className:"p-4",children:[y.jsx(tD,{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"}}}),y.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&&y.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mr-auto",children:[Ht(o.from,"MMM d, yyyy"),o.to&&o.to.getTime()!==o.from.getTime()?` — ${Ht(o.to,"MMM d, yyyy")}`:""]}),y.jsx(Qr,{variant:"secondary",size:"sm",onClick:r,children:"Cancel"}),y.jsx(Qr,{variant:"primary",size:"sm",onClick:a,disabled:!l,children:"Apply"})]})]})}function rD(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 sD(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 oD={CODEX:"#10b981",CLAUDE:"#8b5cf6",OPENCODE:"#f59e0b",GEMINI:"#3b82f6"};function Mi(e,t){const n=e?.toUpperCase?.()||"";return oD[n]||`hsl(${150+t*40}, 60%, 45%)`}function iD({loading:e,onClick:t}){const n=fs();return y.jsx(Qr,{variant:"secondary",size:"sm",disabled:e,onClick:t,"aria-label":"Refresh data",className:"w-8 p-0",children:y.jsx(Je.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 aD({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:m,customRangeOpen:p,onCustomRangeOpenChange:g}){const b=rD(t),w=sD(String(r??"")),x=w!=null,[v,k]=h.useState(null),{resolvedTheme:S}=wa(),C=S==="dark",D=C?"rgba(10,10,10,0.98)":"rgba(255,255,255,0.96)",E=C?"rgba(10,10,10,0)":"rgba(255,255,255,0)",O=a.filter(T=>T.models?.length>0);return y.jsx(Rn,{delay:.2,children:y.jsxs(Eo,{className:u,children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 mb-6",children:[y.jsx("div",{role:"tablist","aria-label":"Time period",className:"flex gap-1",children:b.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 M=R&&d&&f?`${ud(d)} — ${ud(f)}`:T.label;return y.jsxs(QC,{open:p,onOpenChange:I=>{I?n?.("custom"):g?.(I)},children:[y.jsx(eE,{render:y.jsx("button",{role:"tab","aria-selected":R,type:"button",className:A}),children:M}),y.jsx(nE,{children:y.jsx(sE,{sideOffset:8,side:"bottom",align:"start",className:"!z-[9999]",children:y.jsx(iE,{className:"bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded-xl shadow-lg",children:y.jsx(nD,{from:d,to:f,onApply:m,onCancel:()=>g?.(!1)})})})})]},"custom")}return y.jsx("button",{role:"tab","aria-selected":R,type:"button",className:A,onClick:()=>n?.(T.key),children:T.label},T.key)})}),l&&y.jsx(iD,{loading:c,onClick:l})]}),y.jsxs("div",{className:"text-center mb-8",children:[y.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wider mb-3",children:s}),y.jsx("div",{className:"text-6xl md:text-7xl font-bold text-oai-black dark:text-oai-white tracking-tight tabular-nums",children:x?y.jsx(PC,{value:w,displayValue:r,fontSize:72,padding:6,gap:1,textColor:"var(--oai-black, #111827)",fontWeight:700,gradientHeight:C?0:8,gradientFrom:D,gradientTo:E,counterStyle:{paddingLeft:0,paddingRight:0,gap:0},digitStyle:{width:"0.88ch"}}):r}),o&&y.jsx("div",{className:"flex items-center justify-center gap-2 mt-4",children:i?y.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,y.jsx(vy,{size:16,strokeWidth:2,className:"text-oai-gray-400 dark:text-oai-gray-500"})]}):y.jsx("span",{className:"text-xl font-bold text-oai-brand",children:o})})]}),O.length>0&&y.jsxs("div",{className:"space-y-6",children:[y.jsx("div",{role:"img","aria-label":`Provider distribution: ${O.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:O.map((T,R)=>{const A=Mi(T.label,R);return y.jsx(Je.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)})}),y.jsx("div",{className:"flex flex-wrap gap-3",children:O.map((T,R)=>{const A=Mi(T.label,R),M=v===T.label;return y.jsxs("button",{"aria-expanded":M,"aria-controls":`provider-details-${T.label}`,"aria-label":`${T.label}: ${T.totalPercent}%. Click to ${M?"collapse":"expand"} details`,onClick:()=>k(M?null:T.label),className:`flex-1 min-w-[140px] text-left p-3 rounded-lg border transition-colors duration-200 ${M?"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:[y.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[y.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:A}}),y.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:T.label})]}),y.jsxs("div",{className:"text-lg font-semibold text-oai-black dark:text-oai-white tabular-nums",children:[T.totalPercent,"%"]}),y.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&&y.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:O.filter(T=>T.label===v).map(T=>{const R=Mi(T.label,0),A=[...T.models].sort((M,I)=>(I.share||0)-(M.share||0));return y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[y.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:R}}),y.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:T.label}),y.jsxs("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400",children:[T.totalPercent,"%"]})]}),y.jsx("div",{className:"space-y-2",children:A.map(M=>y.jsx("div",{className:"flex items-center gap-3",children:y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[y.jsx("span",{className:"text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate",children:M.name}),y.jsxs("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white tabular-nums shrink-0",children:[M.share,"%"]})]}),y.jsx("div",{className:"h-1 bg-oai-gray-200 dark:bg-oai-gray-700 rounded-full overflow-hidden",children:y.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${M.share}%`,backgroundColor:R,opacity:.7}})})]})},M.id||M.name))})]},T.label)})})]})]})})}function dd(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 lD(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=dd(t,.25),o=dd(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 cD({value:e,displayValue:t,scale:n,index:r,row:s,totalBars:o}){const i=fs(),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 y.jsx(Je.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:y.jsxs("div",{className:"absolute inset-x-0 bottom-0",style:{height:l},children:[y.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()}`}),y.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 uD({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=lD(l);return y.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:[y.jsxs("div",{className:"mb-3",children:[y.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&&y.jsx("p",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:s})]}),y.jsxs("div",{className:"space-y-3",children:[y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none",children:[0,25,50,75,100].map(u=>y.jsx("div",{className:"w-full border-t border-oai-gray-100 dark:border-oai-gray-800",style:{top:`${100-u}%`}},u))}),y.jsx("div",{className:"h-40 flex items-end gap-1 relative z-0",children:l.length>0?l.map((u,d)=>y.jsx(cD,{value:u,displayValue:c.clippedValues[d]??0,scale:c,index:d,row:a[d],totalBars:l.length},d)):y.jsx("div",{className:"flex-1 h-full flex items-center justify-center",children:y.jsx("p",{className:"text-sm text-oai-gray-400 dark:text-oai-gray-400",children:"No data yet"})})})]}),t&&n&&y.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:[y.jsx("span",{children:t}),y.jsx("span",{children:n})]})]})]})}const Di="macAppBannerDismissed",dD="https://github.com/mm7894215/tokentracker/releases/latest";function fD({size:e=48,className:t=""}){const n=e/16,[r,s]=h.useState(!1);h.useEffect(()=>{const a=()=>{const c=2500+Math.random()*3e3;return setTimeout(()=>{s(!0),setTimeout(()=>{s(!1),a()},120)},c)},l=a();return()=>clearTimeout(l)},[]);const o="#DE886D",i="#000000";return y.jsxs("svg",{width:15*n,height:10*n,viewBox:"0 5.5 15 10",className:t,style:{imageRendering:"pixelated"},children:[y.jsx("rect",{x:"2",y:"6",width:"11",height:"7",fill:o}),y.jsx("rect",{x:"0",y:"9",width:"2",height:"2",fill:o}),y.jsx("rect",{x:"13",y:"9",width:"2",height:"2",fill:o}),y.jsx("rect",{x:"3",y:"13",width:"1",height:"2",fill:o}),y.jsx("rect",{x:"5",y:"13",width:"1",height:"2",fill:o}),y.jsx("rect",{x:"9",y:"13",width:"1",height:"2",fill:o}),y.jsx("rect",{x:"11",y:"13",width:"1",height:"2",fill:o}),y.jsx("rect",{x:"3",y:"15",width:"9",height:"1",fill:"#000",opacity:"0.12"}),r?y.jsxs(y.Fragment,{children:[y.jsx("rect",{x:"4",y:"9",width:"1",height:"0.4",fill:i}),y.jsx("rect",{x:"10",y:"9",width:"1",height:"0.4",fill:i})]}):y.jsxs(y.Fragment,{children:[y.jsx("rect",{x:"4",y:"8",width:"1",height:"2",fill:i}),y.jsx("rect",{x:"10",y:"8",width:"1",height:"2",fill:i})]})]})}function hD(){const[e,t]=h.useState(()=>{try{return localStorage.getItem(Di)==="1"?!0:new URLSearchParams(window.location.search).get("from")==="menubar"?(localStorage.setItem(Di,"1"),!0):!1}catch{return!1}}),n=h.useCallback(()=>{t(!0);try{localStorage.setItem(Di,"1")}catch{}},[]);return e?null:y.jsx(aT,{children:y.jsx(Je.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.3},className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4",children:y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx(Je.div,{animate:{y:[0,-2,0]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut"},className:"flex-shrink-0",children:y.jsx(fD,{size:44})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("div",{className:"text-sm font-medium text-oai-gray-900 dark:text-oai-white",children:"Try the Menu Bar App"}),y.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-0.5",children:"Always-on stats with Clawd companion"})]}),y.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[y.jsxs(Je.a,{href:dD,target:"_blank",rel:"noopener noreferrer",whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-oai-gray-900 dark:bg-oai-white dark:text-oai-gray-900 rounded-md hover:opacity-90 transition-opacity",children:["Download",y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:y.jsx("path",{d:"M6 2v6m0 0L3.5 5.5M6 8l2.5-2.5M2 10h8",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),y.jsx("button",{onClick:n,className:"p-1 text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-300 transition-colors","aria-label":"Dismiss",children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("path",{d:"M4 4l6 6m0-6L4 10",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})})]})]})})})}function mD(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:m,identityScrambleDurationMs:p,projectUsageEntries:g,projectUsageLimit:b,setProjectUsageLimit:w,topModels:x,signedIn:v,publicMode:k,isLocalMode:S,shouldShowInstall:C,installPrompt:D,handleCopyInstall:E,installCopied:O,installInitCmdDisplay:T,publicViewTitle:R,handleTogglePublicView:A,publicViewBusy:M,publicViewEnabled:I,publicViewCopyButtonLabel:j,handleCopyPublicView:V,trendRowsForDisplay:U,trendFromForDisplay:P,trendToForDisplay:F,period:W,trendTimeZoneLabel:B,activityHeatmapBlock:Q,isCapturing:Y,handleShareToX:$,screenshotTwitterButton:z,screenshotTwitterHint:Z,periodsForDisplay:ce,setSelectedPeriod:Se,customFrom:Re,customTo:Ee,onCustomRangeApply:et,customRangeOpen:L,onCustomRangeOpenChange:ue,summaryLabel:te,summaryValue:Me,summaryCostValue:H,summaryConversationsValue:se,rollingUsage:ie,costInfoEnabled:me,openCostModal:ge,costModalOpen:J,closeCostModal:ne,allowBreakdownToggle:Ve,refreshAll:be,usageLoadingState:Be,fleetData:$e,hasDetailsActual:it,dailyEmptyPrefix:Oe,installSyncCmd:ye,dailyEmptySuffix:je,detailsColumns:Ye,ariaSortFor:Nt,toggleSort:kt,sortIconFor:tt,pagedDetails:ln,dailyBreakdownRows:lt,dailyBreakdownColumns:De,dailyBreakdownAriaSortFor:He,dailyBreakdownSortIconFor:re,dailyBreakdownDateKey:G,detailsDateKey:oe,renderDetailDate:de,renderDailyBreakdownDate:xe,renderDetailCell:fe,DETAILS_PAGED_PERIODS:jt,detailsPageCount:wn,detailsPage:kn,setDetailsPage:qt}=e;return y.jsxs(y.Fragment,{children:[y.jsxs(vC,{hideHeader:n,header:null,footer:n?null:null,className:n?"screenshot-mode":"",children:[r?y.jsx("div",{className:"mb-6",children:y.jsx(Eo,{title:s,className:"border-oai-gray-200 dark:border-oai-gray-800",children:y.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-0",children:o})})}):null,i||a?null:y.jsx(y.Fragment,{children:y.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[y.jsxs("div",{className:"lg:col-span-4 flex flex-col gap-4 min-w-0",children:[n?y.jsx("div",{className:"flex items-start justify-between gap-4",children:y.jsxs("div",{className:"flex flex-col gap-1",children:[y.jsx("span",{className:"text-3xl md:text-4xl font-semibold text-oai-black dark:text-oai-white tracking-tight leading-none",children:l}),y.jsx("span",{className:"text-2xl md:text-3xl font-semibold text-oai-black dark:text-oai-white tracking-tight leading-none",children:c})]})}):null,S?y.jsx(Rn,{delay:.1,children:y.jsx(hD,{})}):null,y.jsx(qC,{title:t("dashboard.identity.title"),subtitle:t("dashboard.identity.subtitle"),period:W,rankLabel:d??t("identity_card.rank_placeholder"),streakDays:f,subscriptions:m,periodConversations:se,rolling:ie,topModels:x}),C?y.jsx(Rn,{delay:.25,children:y.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:[y.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 mb-1.5",children:D}),y.jsxs(Je.button,{onClick:E,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:[y.jsx("code",{className:"text-xs font-mono text-oai-gray-700 dark:text-oai-gray-300",children:T}),y.jsx(Je.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-oai-brand",children:O?"Copied ✓":"Copy"},O?"copied":"copy")]})]})}):null,!n&&v&&!k?y.jsx(Rn,{delay:.3,children:y.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:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Je.button,{type:"button",onClick:A,disabled:M,whileTap:{scale:.95},className:`relative inline-flex h-4 w-7 items-center px-0.5 transition-colors rounded-full ${I?"bg-oai-brand":"bg-oai-gray-300 dark:bg-oai-gray-600"} disabled:opacity-50`,children:y.jsx(Je.span,{initial:!1,animate:{x:I?12:0},transition:{type:"spring",stiffness:500,damping:30},className:"inline-block h-3 w-3 bg-white rounded-full"})}),y.jsx(Je.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:I?"Public":"Private"},I?"public":"private")]}),y.jsx(Je.button,{onClick:V,disabled:!I||M,whileHover:{scale:I?1.05:1},whileTap:{scale:I?.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,Q&&y.jsx(Rn,{delay:.4,children:Q}),n?null:y.jsx(uD,{rows:U,from:P,to:F,period:W,timeZoneLabel:B,showTimeZoneLabel:!1}),n?y.jsxs("div",{className:"mt-4 flex flex-col items-center gap-2","data-screenshot-exclude":"true",style:Y?{display:"none"}:void 0,children:[y.jsx(Qr,{type:"button",onClick:$,variant:"primary",size:"lg",disabled:Y,children:z}),y.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300",children:Z})]}):null]}),y.jsxs("div",{className:"lg:col-span-8 flex flex-col gap-4 min-w-0",children:[y.jsx(aD,{period:W,periods:ce,onPeriodChange:Se,summaryLabel:te,summaryValue:Me,summaryCostValue:H,onCostInfo:me?ge:null,fleetData:$e,onRefresh:n?null:be,loading:Be,customFrom:Re,customTo:Ee,onCustomRangeApply:et,customRangeOpen:L,onCustomRangeOpenChange:ue}),n?null:y.jsx(Rn,{delay:.5,children:y.jsx(KC,{projectEntries:g,projectLimit:b,onProjectLimitChange:w,copy:t,hasDetailsActual:it,dailyEmptyPrefix:Oe,installSyncCmd:ye,dailyEmptySuffix:je,detailsColumns:Ye,ariaSortFor:Nt,toggleSort:kt,sortIconFor:tt,pagedDetails:ln,dailyBreakdownRows:lt,dailyBreakdownColumns:De,dailyBreakdownAriaSortFor:He,dailyBreakdownSortIconFor:re,dailyBreakdownDateKey:G,detailsDateKey:oe,renderDetailDate:de,renderDailyBreakdownDate:xe,renderDetailCell:fe,DETAILS_PAGED_PERIODS:jt,period:W,detailsPageCount:wn,detailsPage:kn,setDetailsPage:qt})})]})]})})]}),y.jsx(GC,{isOpen:J,onClose:ne,fleetData:$e})]})}const pD=["day","week","month","total","custom"],Pi=new Set(["day","hour","month"]),Ir=new Set(["day","total","custom"]);function Ri(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 Ls(e){return e?e?.billable_total_tokens??e?.total_tokens:null}function fd(e){return e?e?.billable_total_tokens??e?.value??e?.total_tokens:null}function gD(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 yD(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function bD(e){return e?e==="www.tokentracker.cc":!1}function xD(){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:!bD(window.location.hostname)}function CD({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]=h.useState(!1),[d,f]=h.useState(null),[m,p]=h.useState(null),[g,b]=h.useState(!1),[w,x]=h.useState(null),[v,k]=h.useState(0),[S,C]=h.useState(0),[D,E]=h.useState(!1),[O,T]=h.useState(null),[R,A]=h.useState(!1),[M,I]=h.useState(!1),[j,V]=h.useState(!1),[U,P]=h.useState(null),[F,W]=h.useState(null),[B,Q]=h.useState(null),[Y,$]=h.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(max-width: 640px)").matches),z=h.useMemo(()=>typeof window>"u"?!1:Kg(window.location.search),[]),Z=h.useMemo(()=>xD(),[]),[ce,Se]=h.useState(!1),Re=2200,[Ee,et]=h.useState(!0),[L,ue]=h.useState(!1),[te,Me]=h.useState(!1),[H,se]=h.useState(!1),ie=yr(),me=n&&!r,ge=h.useMemo(()=>me&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,me]),J=me?ge:null,ne=o?zg(i):J,Ve=n||ie||o,be=me&&br(J),Be=n&&r&&!o;h.useEffect(()=>{if(!n||ie){f(null),p(null),b(!1),x(null);return}if(o)return;if(!be){f(null),p(null),b(!1),x(null);return}let N=!0;const K=()=>{f(null),p(null),b(!1),x(null)};return b(!0),x(null),(async()=>{let X=null;try{X=await Bt(J)}catch{X=null}if(N){if(!X){K();return}try{const le=await ly({baseUrl:e,accessToken:X});if(!N)return;f(typeof le?.link_code=="string"?le.link_code:null),p(typeof le?.expires_at=="string"?le.expires_at:null)}catch(le){if(!N)return;f(null),p(null),x(le?.message||"Failed to load link code")}finally{if(!N)return;b(!1)}}})(),()=>{N=!1}},[e,ie,n,o,be,J,S]),h.useEffect(()=>{if(!n||ie||o){E(!1),T(null),A(!1),I(!1),V(!1);return}if(!be){E(!1),T(null),A(!1),I(!1),V(!1);return}let N=!0;return A(!0),(async()=>{let K=null;try{K=await Bt(J)}catch{K=null}if(N){if(!K){E(!1),T(null),A(!1);return}try{const X=await Ul({baseUrl:e,accessToken:K});if(!N)return;const le=!!X?.enabled;E(le),T(X?.share_token||null)}catch{if(!N)return;E(!1),T(null)}finally{if(!N)return;A(!1)}}})(),()=>{N=!1}},[e,ie,n,o,be,J]),h.useEffect(()=>{if(!o){P(null),W(null);return}if(!i){P(null),W(null);return}P(null),W(null);let N=!0;return cy({baseUrl:e,accessToken:i}).then(K=>{N&&(P(typeof K?.display_name=="string"?K.display_name:null),W(typeof K?.avatar_url=="string"?K.avatar_url:null))}).catch(()=>{N&&(P(null),W(null))}),()=>{N=!1}},[e,o,i]);const $e=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");h.useEffect(()=>{if(!$e&&(!n||ie||o)){Q(null);return}if(!$e&&!be){Q(null);return}let N=!0;return(async()=>{let K=null;try{K=await Bt(J)}catch{K=null}if(N){if(!K&&!$e){Q(null);return}try{const X=await uy({baseUrl:e,accessToken:K});if(!N)return;Q(X&&typeof X=="object"?X:null)}catch{if(!N)return;Q(null)}}})(),()=>{N=!1}},[be,e,J,ie,o,n]);const it=h.useMemo(()=>{if(!m)return!1;const N=Date.parse(m);if(!Number.isFinite(N))return!1;const K=v||Date.now();return N<=K},[m,v]);h.useEffect(()=>{!n||ie||o||!m||!it||g||(f(null),p(null),x(null),C(N=>N+1))},[it,m,g,ie,n]),h.useEffect(()=>{if(!m||o)return;const N=Date.parse(m);if(!Number.isFinite(N))return;const K=Date.now();if(k(K),N<=K)return;const X=window.setTimeout(()=>k(Date.now()),N-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)}},[m]),h.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const N=window.matchMedia("(max-width: 640px)"),K=()=>$(N.matches);return K(),N.addEventListener?(N.addEventListener("change",K),()=>N.removeEventListener("change",K)):(N.addListener(K),()=>N.removeListener(K))},[]);const Oe=h.useMemo(()=>qg(),[]),ye=h.useMemo(()=>Xg(),[]),je=h.useMemo(()=>Zg(),[]),Ye=o?null:t?.userId||t?.email||"default",[Nt,kt]=h.useState("month"),[tt,ln]=h.useState(null),[lt,De]=h.useState(null),[He,re]=h.useState(!1),G=z?"total":Nt,oe=h.useMemo(()=>G==="custom"&&tt&<?{from:tt,to:lt}:Qg(G,{timeZone:Oe,offsetMinutes:ye,now:je}),[je,G,Oe,ye,tt,lt]),de=oe.from,xe=oe.to,fe=h.useMemo(()=>Jg({timeZone:Oe,offsetMinutes:ye}),[Oe,ye]),jt=h.useMemo(()=>ey({timeZone:Oe,offsetMinutes:ye}),[Oe,ye]),wn=h.useMemo(()=>`Local time (${jt})`,[jt]),kn=Oe,qt=ye,cn=fe,It=h.useMemo(()=>da({timeZone:Oe,offsetMinutes:ye,date:je||new Date}),[je,Oe,ye]),Er=h.useMemo(()=>{const N=gD(It)||new Date,K=yD(N,-29);return{from:cr(K),to:cr(N)}},[It]),{daily:Ft,summary:nt,rolling:Sn,source:ys,loading:Po,error:ct,refresh:ml}=Jl({baseUrl:e,accessToken:ne,guestAllowed:Be,from:de,to:xe,includeDaily:G!=="total",cacheKey:Ye,timeZone:Oe,tzOffsetMinutes:ye,now:je}),{daily:pl,loading:cp,refresh:gl}=Jl({baseUrl:e,accessToken:ne,guestAllowed:Be,from:Er.from,to:Er.to,includeDaily:!0,cacheKey:Ye?`${Ye}.daily-breakdown`:"daily-breakdown",timeZone:Oe,tzOffsetMinutes:ye,now:je}),{breakdown:Tn,loading:up,refresh:yl}=vb({baseUrl:e,accessToken:ne,guestAllowed:Be,from:de,to:xe,cacheKey:Ye,timeZone:Oe,tzOffsetMinutes:ye}),[bl,dp]=h.useState(3),{entries:fp,loading:hp,refresh:xl}=db({baseUrl:e,accessToken:ne,limit:bl,from:de,to:xe,timeZone:Oe,tzOffsetMinutes:ye}),vl=G==="week"||G==="month",bs=G==="week"||G==="month",wl=h.useMemo(()=>Ft.filter(N=>N?.future?!1:!N?.day||!It?!0:String(N.day)<=String(It)),[Ft,It]),{rows:Xt,from:mp,to:pp,loading:gp,refresh:kl}=hb({baseUrl:e,accessToken:ne,guestAllowed:Be,period:G,from:de,to:xe,months:24,cacheKey:Ye,timeZone:kn,tzOffsetMinutes:qt,now:je,sharedRows:vl?Ft:null,sharedRange:vl?{from:de,to:xe}:null}),{daily:Gn,heatmap:Zt,loading:Sl,refresh:Tl}=ub({baseUrl:e,accessToken:ne,guestAllowed:Be,weeks:52,cacheKey:Ye,timeZone:Oe,tzOffsetMinutes:ye,now:je}),St=h.useMemo(()=>G==="day"?"hour":G==="total"?"month":"day",[G]),yp=h.useMemo(()=>tc(St),[St]),xs="day",bp=h.useMemo(()=>tc(xs),[]),[Tt,Cl]=h.useState(()=>({key:"day",dir:"desc"}));h.useEffect(()=>{Cl(N=>!Pi.has(N.key)||N.key===St?N:{key:St,dir:N.dir})},[St]);const Kn=h.useMemo(()=>Pi.has(Tt.key)&&Tt.key!==St?{...Tt,key:St}:Tt,[St,Tt]),vs=h.useMemo(()=>{if(G==="day")return Array.isArray(Xt)?Xt.filter(X=>X?.hour&&!X?.future):[];if(G==="total"){const X=Array.isArray(Xt)?Xt.filter(le=>le?.month&&!le?.future):[];return Nb(X)}const N=wl;return!N.some(X=>!X?.missing&&!X?.future)&&Ft.length>0?Ft.filter(X=>!X?.future).slice(-30).filter(X=>X?.day):N},[G,Xt,wl,Ft]),Mr=h.useMemo(()=>nc(vs,Kn),[vs,Kn]),xp=h.useMemo(()=>vs.some(N=>!N?.missing&&!N?.future),[vs]),Ro=h.useMemo(()=>{if(!Ir.has(G))return 1;const N=Math.ceil(Mr.length/ro);return N>0?N:1},[G,Mr.length]),[Oo,ws]=h.useState(0);h.useEffect(()=>{if(!Ir.has(G)){ws(0);return}ws(N=>Math.min(N,Ro-1))},[Ro,G]),h.useEffect(()=>{Ir.has(G)&&ws(0)},[G,Tt.dir,Tt.key]);const vp=h.useMemo(()=>Ir.has(G)?jb(Mr,Oo,ro):Mr,[Oo,G,Mr]),El=h.useMemo(()=>pl.filter(N=>!N?.future&&N?.day).slice(-30),[pl]),zn=h.useMemo(()=>Pi.has(Tt.key)?{...Tt,key:xs}:Tt,[Tt]),wp=h.useMemo(()=>nc(El,zn),[El,zn]),kp=h.useMemo(()=>bs?Ft:G==="day"?Array.isArray(Xt)?Xt.filter(N=>N?.hour):[]:Xt,[Ft,G,Xt,bs]),Sp=bs?de:mp,Tp=bs?xe:pp;function Cp(N,K){return N?.future?"—":N?.missing?_("shared.status.unsynced"):K==="total_tokens"?Jt(Ls(N)):Jt(N?.[K])}function Ep(N){const K=N?.[St];if(K==null)return"";const X=String(K);if(St==="hour"){const[le,Ie]=X.split("T");if(le&&Ie)return`${le} ${Ie.slice(0,5)}`}return X}function Mp(N){const K=N?.[xs];return K==null?"":String(K)}function Dp(N){Cl(K=>K.key===N?{key:N,dir:K.dir==="asc"?"desc":"asc"}:{key:N,dir:"desc"})}function Pp(N){return Kn.key!==N?"none":Kn.dir==="asc"?"ascending":"descending"}function Rp(N){return Kn.key!==N?"":Kn.dir==="asc"?"▲":"▼"}function Op(N){return zn.key!==N?"none":zn.dir==="asc"?"ascending":"descending"}function Ap(N){return zn.key!==N?"":zn.dir==="asc"?"▲":"▼"}const Ml=h.useMemo(()=>{if(!n&&!ie&&!o&&!$e)return 0;const N=Number(Zt?.active_days);if(Number.isFinite(N))return N;let K=0;const X=new Set,le=(Pe,_e,Ke)=>{typeof Pe!="string"||!Pe||X.has(Pe)||Ri(_e,Ke)&&(X.add(Pe),K+=1)};if(Array.isArray(Gn))for(const Pe of Gn)le(Pe?.day,Ls(Pe));const Ie=Array.isArray(Zt?.weeks)?Zt.weeks:[];for(const Pe of Ie)for(const _e of Array.isArray(Pe)?Pe:[]){const Ke=fd(_e);le(_e?.day,Ke,_e?.level)}return K},[n,ie,Zt?.active_days,Zt?.weeks,Gn]),[Dl,Pl]=h.useState("month"),Np=h.useCallback(N=>{N==="custom"?(Pl(K=>K==="custom"?"month":K),kt(K=>tt&<?"custom":K),re(!0)):(kt(N),Pl(N),re(!1))},[tt,lt]),jp=h.useCallback((N,K)=>{ln(N),De(K),kt("custom"),re(!1)},[]),Ip=h.useCallback(N=>{re(N),!N&&Nt==="custom"&&!tt&&kt(Dl)},[Nt,tt,Dl]),Rl=h.useCallback(async()=>{await Promise.all([ml(),Tl(),kl(),yl(),xl(),gl()])},[gl,Tl,yl,xl,kl,ml]),Fp=h.useCallback(async()=>{se(!0);try{$e&&await dy(),await Rl()}catch(N){console.error("[DashboardPage] Refresh failed:",N)}finally{se(!1)}},[$e,Rl]),Lp=H||Po||cp||Sl||gp||up||hp,Vp=h.useMemo(()=>_("shared.data_source",{source:String(ys||"edge").toUpperCase()}),[ys]),_p=h.useMemo(()=>{if(!o||!ct)return!1;if((typeof ct=="object"&&ct?ct?.status??ct?.statusCode:null)===401)return!0;const K=typeof ct=="string"?ct:String(ct?.message||ct||"");return/unauthorized|invalid|token|revoked|401/i.test(K)},[o,ct]),ks=h.useMemo(()=>typeof t?.name!="string"?"":t.name.trim(),[t?.name]),Ol=h.useMemo(()=>typeof U!="string"?"":U.trim(),[U]),Al=h.useMemo(()=>!ks||ks.includes("@")?_("dashboard.identity.fallback"):ks,[ks]),Nl=h.useMemo(()=>Al.replace(/[^a-zA-Z0-9._-]/g,"_"),[Al]),Wp=h.useMemo(()=>o?Ol||_("dashboard.identity.fallback"):Nl,[Nl,Ol,o]),Bp=h.useMemo(()=>{let N=null;const K=le=>{typeof le!="string"||!le||(!N||le<N)&&(N=le)};if(Array.isArray(Gn))for(const le of Gn)le?.day&&Ri(Ls(le))&&K(le.day);const X=Array.isArray(Zt?.weeks)?Zt.weeks:[];for(const le of X)for(const Ie of Array.isArray(le)?le:[]){if(!Ie?.day)continue;const Pe=fd(Ie),_e=Ie?.level;Ri(Pe,_e)&&K(Ie.day)}return N},[Zt?.weeks,Gn]),$p=h.useMemo(()=>o?[]:(Array.isArray(B?.subscriptions?.items)?B.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,B]),Yp=y.jsx(Kb,{heatmap:Zt,timeZoneLabel:fe,timeZoneShortLabel:jt,hideLegend:z,defaultToLatestMonth:z}),Hp=h.useMemo(()=>`${de}..${xe}`,[de,G,xe]),Up=_("usage.summary.total"),qn=Ls(nt),jl=_("shared.unit.thousand_abbrev"),Il=_("shared.unit.million_abbrev"),Fl=_("shared.unit.billion_abbrev"),Ss=xt(qn),Ll=Y&&Ss!=null&&Math.abs(Ss)>=1e9,Gp=h.useMemo(()=>Ll?kd(Ss,{thousandSuffix:jl,millionSuffix:Il,billionSuffix:Fl,decimals:1}):Jt(qn),[Fl,Il,qn,Ss,jl,Ll]),Kp=_("dashboard.core_index.collapse_label"),zp=_("dashboard.core_index.expand_label"),qp=_("dashboard.core_index.collapse_aria"),Xp=_("dashboard.core_index.expand_aria"),Zp=!z,Qp=_("dashboard.screenshot.title_line1"),Jp=_("dashboard.screenshot.title_line2"),eg=_("dashboard.screenshot.twitter_label"),tg=_("dashboard.screenshot.twitter_button"),ng=_("dashboard.screenshot.twitter_hint"),Xn=_("shared.placeholder.short"),Ao=h.useMemo(()=>{const N=Array.isArray(Tn?.sources)?Tn.sources:[];let K=null,X=0;for(const _e of N){const Ke=xt(_e?.totals?.billable_total_tokens??_e?.totals?.total_tokens);!Number.isFinite(Ke)||Ke<=0||Ke>X&&(X=Ke,K=_e)}let le=Xn,Ie=Xn,Pe="0.0";if(K&&X>0){le=K?.source?String(K.source).toUpperCase():Xn;const _e=Array.isArray(K?.models)?K.models:[];let Ke=0;for(const Qt of _e){const Pr=xt(Qt?.totals?.billable_total_tokens??Qt?.totals?.total_tokens);!Number.isFinite(Pr)||Pr<=0||Pr>Ke&&(Ke=Pr,Ie=Qt?.model?String(Qt.model):Xn)}Ke>0&&(Pe=(Ke/X*100).toFixed(1))}return{agentName:le,modelName:Ie,modelPercent:Pe}},[Tn,Xn]),Vl=Jt(qn),_l=_("dashboard.screenshot.twitter_text",{total_tokens:Vl==="-"?Xn:Vl,agent_name:Ao.agentName,model_name:Ao.modelName,model_percent:Ao.modelPercent}),No=h.useMemo(()=>{if(typeof window>"u")return"";const N=new URL("https://twitter.com/intent/tweet");return N.searchParams.set("text",_l),N.toString()},[_l]),Wl=h.useCallback(async()=>{if(typeof window>"u")return null;const N=async()=>{const _e=performance.now();for(;performance.now()-_e<2e3;){const Ke=document.querySelector("[data-heatmap-scroll='true']");if(!Ke||Ke.dataset.latestMonthReady==="true")return;await new Promise(Qt=>requestAnimationFrame(Qt))}},K=document.querySelector("#root")||document.body,X=document.documentElement,{scrollWidth:le,scrollHeight:Ie}=document.documentElement;X?.classList.add("screenshot-capture"),document.body?.classList.add("screenshot-capture"),await new Promise(Pe=>requestAnimationFrame(Pe)),await N();try{const{toBlob:Pe,toPng:_e}=await ty(async()=>{const{toBlob:Cn,toPng:Vg}=await import("./index-BeoRn2gJ.js");return{toBlob:Cn,toPng:Vg}},[]),Ke=await Pe(K,{backgroundColor:"#050505",pixelRatio:2,cacheBust:!0,width:le,height:Ie,style:{width:`${le}px`,height:`${Ie}px`},filter:Cn=>!(Cn instanceof HTMLElement)||Cn.dataset?.screenshotExclude!=="true"});if(Ke)return Ke;const Qt=await _e(K,{backgroundColor:"#050505",pixelRatio:2,cacheBust:!0,width:le,height:Ie,style:{width:`${le}px`,height:`${Ie}px`},filter:Cn=>!(Cn instanceof HTMLElement)||Cn.dataset?.screenshotExclude!=="true"});return Qt?await(await fetch(Qt)).blob():null}finally{X?.classList.remove("screenshot-capture"),document.body?.classList.remove("screenshot-capture")}},[]),rg=h.useCallback(async()=>{if(typeof window>"u"||ce)return;Se(!0);const N=navigator?.userAgent||"",K=/iP(hone|od|ad)/i.test(N),X=/Safari/i.test(N)&&!/Chrome|Chromium|Edg|OPR|CriOS|FxiOS/i.test(N),le=typeof navigator<"u"&&!!navigator.clipboard?.write&&typeof window<"u"&&!!window.ClipboardItem;let Pe=!le||K||X;try{const _e=await Wl();_e&&le&&(typeof document<"u"&&!document.hasFocus()&&window.focus?.(),Pe=await ny(_e))}catch(_e){console.error("Failed to capture screenshot",_e)}finally{if(Se(!1),!Pe){console.warn("Failed to write screenshot to clipboard.");return}No&&(window.location.href=No)}},[Wl,ce,No]),sg=h.useMemo(()=>z?[]:pD,[z]),og=h.useMemo(()=>[{label:_("usage.metric.total"),value:Jt(qn),valueClassName:"text-white"},{label:_("usage.metric.input"),value:Jt(nt?.input_tokens)},{label:_("usage.metric.output"),value:Jt(nt?.output_tokens)},{label:_("usage.metric.cached_input"),value:Jt(nt?.cached_input_tokens)},{label:_("usage.metric.reasoning_output"),value:Jt(nt?.reasoning_output_tokens)}],[nt?.cached_input_tokens,nt?.input_tokens,nt?.output_tokens,nt?.reasoning_output_tokens,qn]),jo=h.useMemo(()=>{const N=ma(nt?.total_cost_usd);return!N||N==="-"||N.startsWith("$")?N:`$${N}`},[nt?.total_cost_usd]),ig=h.useMemo(()=>nt?.conversation_count??null,[nt?.conversation_count]),Bl=h.useMemo(()=>Lb(Tn,{copyFn:_}),[Tn]),ag=h.useMemo(()=>Vb(Tn,{limit:3,copyFn:_}),[Tn]),lg=h.useCallback(()=>u(!0),[]),cg=h.useCallback(()=>u(!1),[]),ug=jo&&jo!=="-"&&Bl.length>0,Dr=_("dashboard.install.cmd.init"),Io=it?null:d,Fo=Io?_("dashboard.install.cmd.init_link_code",{link_code:Io}):Dr,dg=Dr,fg=_("dashboard.install.cmd.sync"),hg=Io?_("dashboard.install.copy"):_("dashboard.install.copy_base"),mg=_("dashboard.install.copied");_("dashboard.session_expired.copy_label"),_("dashboard.session_expired.copied");const pg=!!(B?.install?.has_active_device_token??B?.install?.hasActiveDeviceToken),gg=Ib({publicMode:o,screenshotMode:z,forceInstall:Z,accessEnabled:Ve,heatmapLoading:Sl,activeDays:Ml,hasActiveDeviceToken:pg}),yg=_("dashboard.install.prompt"),bg=_("dashboard.public_view.title"),xg=_("dashboard.public_view.status.enabled"),vg=_("dashboard.public_view.status.disabled"),wg=_("dashboard.public_view.action.copy"),kg=_("dashboard.public_view.action.copied"),Sg=_("dashboard.public_view.action.enable"),Tg=_("dashboard.public_view.action.disable"),Cg=_("dashboard.public_view.invalid.title"),Eg=_("dashboard.public_view.invalid.body"),Mg=R||M,Dg=D?xg:vg,$l=h.useMemo(()=>!O||typeof window>"u"?"":new URL(`/share/${O}`,window.location.origin).toString(),[O]),Pg=j?kg:wg,Rg=D?Tg:Sg,Og=h.useCallback(async()=>{!Fo||!await Vo(Fo)||(ue(!0),window.setTimeout(()=>ue(!1),2e3))},[Fo]);h.useCallback(async()=>{!Dr||!await Vo(Dr)||(Me(!0),window.setTimeout(()=>Me(!1),2e3))},[Dr]);const Ag=h.useCallback(async()=>{if(M||!D)return;let N=$l;if(!N){I(!0);try{const X=await Bt(J);if(!X){I(!1);return}const le=await Ul({baseUrl:e,accessToken:X}),Ie=typeof le?.share_token=="string"?le.share_token:null;T(Ie),Ie&&typeof window<"u"&&(N=new URL(`/share/${Ie}`,window.location.origin).toString())}catch{}finally{I(!1)}}!N||!await Vo(N)||(V(!0),window.setTimeout(()=>V(!1),2e3))},[J,e,M,D,$l]),Ng=h.useCallback(async()=>{if(!M){V(!1),I(!0);try{const N=await Bt(J);if(!N){I(!1);return}const X=await fy({baseUrl:e,accessToken:N,enabled:!D}),le=!!X?.enabled;E(le),T(X?.share_token||null)}catch{}finally{I(!1)}}},[J,e,M,D]),Lo=h.useMemo(()=>_("dashboard.daily.empty",{cmd:"{{cmd}}"}),[]),[jg,Ig]=h.useMemo(()=>{const N=Lo.split("{{cmd}}");return N.length===1?[Lo,""]:[N[0],N.slice(1).join("{{cmd}}")]},[Lo]),Fg=r&&!o,Lg=!n&&!ie&&!r&&!$e&&!o;return y.jsx(mD,{copy:_,screenshotMode:z,publicViewInvalid:_p,publicViewInvalidTitle:Cg,publicViewInvalidBody:Eg,showExpiredGate:Fg,showAuthGate:Lg,screenshotTitleLine1:Qp,screenshotTitleLine2:Jp,identityDisplayName:Wp,identityStartDate:Bp,activeDays:Ml,identitySubscriptions:$p,identityScrambleDurationMs:Re,projectUsageEntries:fp,projectUsageLimit:bl,setProjectUsageLimit:dp,topModels:ag,signedIn:n,publicMode:o,isLocalMode:$e,shouldShowInstall:gg,installPrompt:yg,handleCopyInstall:Og,installCopied:L,installCopiedLabel:mg,installCopyLabel:hg,installInitCmdDisplay:dg,linkCodeLoading:g,linkCodeError:w,publicViewTitle:bg,handleTogglePublicView:Ng,publicViewBusy:Mg,publicViewEnabled:D,publicViewToggleLabel:Rg,publicViewStatusLabel:Dg,publicViewCopyButtonLabel:Pg,handleCopyPublicView:Ag,trendRowsForDisplay:kp,trendFromForDisplay:Sp,trendToForDisplay:Tp,period:G,trendTimeZoneLabel:cn,activityHeatmapBlock:Yp,isCapturing:ce,handleShareToX:rg,screenshotTwitterLabel:eg,screenshotTwitterButton:tg,screenshotTwitterHint:ng,periodsForDisplay:sg,setSelectedPeriod:Np,customFrom:tt,customTo:lt,onCustomRangeApply:jp,customRangeOpen:He,onCustomRangeOpenChange:Ip,metricsRows:og,summaryLabel:Up,summaryValue:Gp,summaryCostValue:jo,summaryConversationsValue:ig,rollingUsage:Sn,costInfoEnabled:ug,openCostModal:lg,allowBreakdownToggle:Zp,coreIndexCollapsed:Ee,setCoreIndexCollapsed:et,coreIndexCollapseLabel:Kp,coreIndexExpandLabel:zp,coreIndexCollapseAria:qp,coreIndexExpandAria:Xp,refreshAll:Fp,usageLoadingState:Lp,usageError:ct,rangeLabel:Hp,timeZoneRangeLabel:wn,usageSourceLabel:Vp,fleetData:Bl,hasDetailsActual:xp,dailyEmptyPrefix:jg,installSyncCmd:fg,dailyEmptySuffix:Ig,detailsColumns:yp,ariaSortFor:Pp,toggleSort:Dp,sortIconFor:Rp,pagedDetails:vp,dailyBreakdownRows:wp,dailyBreakdownColumns:bp,dailyBreakdownAriaSortFor:Op,dailyBreakdownSortIconFor:Ap,dailyBreakdownDateKey:xs,detailsDateKey:St,renderDetailDate:Ep,renderDailyBreakdownDate:Mp,renderDetailCell:Cp,DETAILS_PAGED_PERIODS:Ir,detailsPageCount:Ro,detailsPage:Oo,setDetailsPage:ws,costModalOpen:c,closeCostModal:cg})}export{CD as DashboardPage};
|