1import{g as qc,f as kt,b as bt,j as i,bS as Uc,bT as Zc,bU as Kc,bV as Xc,bW as Jc,bX as Qc,e as li,E as ui,bY as el,a0 as tl,I as qn,J as di,k as hi,Z as fi,aa as nl,r as Y,bZ as rl,i as ga,L as ol,Y as al,aC as pi,aD as jo,b_ as mi,b$ as wa,aF as sl,aH as il,aG as cl,u as ll,aQ as He,aO as ut,aP as nt,aN as Rt,az as Re,ac as W,b5 as Ke,R as N,c0 as ul,aM as $o,aR as dl,aT as Pt,aX as hl,B as No,b8 as Ue,aK as zt,bp as fl,X as pl,b9 as ml,aI as tt,b4 as dn,b0 as _t,aS as gl,aw as wl,aV as vl,aU as xl,bc as yl,c1 as kl,aJ as Vo,c2 as Cn}from"./index-0DxIl0MM.js";import{c as Cl,m as Sl,g as bl,a as At,d as xe,p as Al,u as Tl,b as va,e as jl,f as Gt,C as gi,i as Nl,H as Il,h as Sn,j as fr,k as bn,w as xa,l as Ml,n as Dn,o as _l,q as Go,M as K,T as wi,r as Fl,Q as ya,s as Io,t as Un,v as Dl,x as El,F as Ll,y as en,z as Yl,A as wt,B as wn,D as vi,E as xi,G as Rl,I as Pl,J as Ol,K as yi,L as vn,N as ki,O as Ci,R as Si,S as zl,U as bi,V as Ai,W as Pn,X as qo,Y as Xe,Z as Uo,_ as Wl,$ as Hl,a0 as Bl,a1 as Zo,a2 as ve,a3 as Ti,a4 as ji,a5 as Ni,a6 as Zn,a7 as On,a8 as $l,a9 as Ii,aa as Vl,ab as Mi,ac as Gl,ad as ql,ae as Ul,af as Zl,ag as Kl,ah as Xl,ai as Jl,aj as Ql,ak as eu,al as tu,am as Kn,an as _i,ao as zn,ap as nu,aq as ru,ar as ou,as as au,at as su,au as iu,av as cu,aw as lu,ax as uu,ay as du,az as hu,aA as fu,aB as pu,aC as Fi,aD as mu,aE as gu,aF as wu,aG as vu,aH as xu,aI as yu,aJ as ku,aK as Cu,aL as Su,aM as bu,aN as Ko,aO as Au,aP as Tu,aQ as ju,aR as Nu,aS as Iu,aT as Mu,aU as _u,aV as Fu,aW as Du,aX as Eu,aY as Lu,aZ as Yu,a_ as Ru,a$ as Pu,b0 as Ou}from"./PowerCenter-Levnk4it.js";import{u as zu,s as Wu,B as Di,L as Xo,a as Hu,T as Bu,d as $u,c as Vu,b as Gu}from"./TooltipWithBounds-DoJ2-0B7.js";import{u as qu,d as Uu,I as En,A as et,T as R,f as re,g as Ei}from"./SignInPage-B2tg9Krb.js";import{I as Zu,C as Ku}from"./Circle-OUH8Y6-N.js";import{I as Xu}from"./IconChevronDown-Dkhs_jHC.js";import{c as Li,g as ka,a as Ju,u as Qu,S as ed,b as td,T as nd,d as Ca,e as jt,f as Sa,h as An,i as Tn,j as rd,k as od,l as ad,M as sd,I as Yi,s as id,G as qt,P as cd,m as ld,L as ud}from"./localPoint-CtiEe9qF.js";import{c as xt,u as Ri}from"./index-BWVm2kpR.js";import{C as It,e as dd,O as hd}from"./OverviewChart-DyHvXTcp.js";import{i as fd}from"./index-EIvJocwB.js";import{c as Mo}from"./capitalizeFirstLetter-DwBwOzx6.js";import{g as pd,I as Pi,A as md,a as ba,s as gd,b as wd}from"./ActivityCard-d-XU-L1_.js";import{n as Jo,m as Oi}from"./user-BFA3j88n.js";import{F as vd,a as pr}from"./FileSelector-B_xh-W6T.js";import{u as xd}from"./index-B9oxBF71.js";import"./PublicRoute-B4rFMP24.js";import"./AuthPage-BlErbFvd.js";import"./index-nP3HLDlB.js";import"./get-auto-contrast-value-Da6zqqWm.js";var Tt={root:"m_f11b401e",header:"m_5a7c2c9",content:"m_b8a05bbd",inner:"m_31cd769a"};const[yd,tn]=qc("Drawer component was not found in tree"),Xn=kt((e,t)=>{const n=bt("DrawerBody",null,e),{classNames:r,className:o,style:a,styles:s,vars:c,...l}=n,u=tn();return i.jsx(Uc,{ref:t,...u.getStyles("body",{classNames:r,style:a,styles:s,className:o}),...l})});Xn.classes=Tt;Xn.displayName="@mantine/core/DrawerBody";const Jn=kt((e,t)=>{const n=bt("DrawerCloseButton",null,e),{classNames:r,className:o,style:a,styles:s,vars:c,...l}=n,u=tn();return i.jsx(Zc,{ref:t,...u.getStyles("close",{classNames:r,style:a,styles:s,className:o}),...l})});Jn.classes=Tt;Jn.displayName="@mantine/core/DrawerCloseButton";const Qn=kt((e,t)=>{const n=bt("DrawerContent",null,e),{classNames:r,className:o,style:a,styles:s,vars:c,children:l,radius:u,__hidden:h,...p}=n,f=tn(),k=f.scrollAreaComponent||Kc;return i.jsx(Xc,{...f.getStyles("content",{className:o,style:a,styles:s,classNames:r}),innerProps:f.getStyles("inner",{className:o,style:a,styles:s,classNames:r}),ref:t,...p,radius:u||f.radius||0,"data-hidden":h||void 0,children:i.jsx(k,{style:{height:"calc(100vh - var(--drawer-offset) * 2)"},children:l})})});Qn.classes=Tt;Qn.displayName="@mantine/core/DrawerContent";const er=kt((e,t)=>{const n=bt("DrawerHeader",null,e),{classNames:r,className:o,style:a,styles:s,vars:c,...l}=n,u=tn();return i.jsx(Jc,{ref:t,...u.getStyles("header",{classNames:r,style:a,styles:s,className:o}),...l})});er.classes=Tt;er.displayName="@mantine/core/DrawerHeader";const tr=kt((e,t)=>{const n=bt("DrawerOverlay",null,e),{classNames:r,className:o,style:a,styles:s,vars:c,...l}=n,u=tn();return i.jsx(Qc,{ref:t,...u.getStyles("overlay",{classNames:r,style:a,styles:s,className:o}),...l})});tr.classes=Tt;tr.displayName="@mantine/core/DrawerOverlay";function kd(e){switch(e){case"top":return"flex-start";case"bottom":return"flex-end";default:return}}function Cd(e){if(e==="top"||e==="bottom")return"0 0 calc(100% - var(--drawer-offset, 0rem) * 2)"}const Sd={top:"slide-down",bottom:"slide-up",left:"slide-right",right:"slide-left"},bd={top:"slide-down",bottom:"slide-up",right:"slide-right",left:"slide-left"},Ad={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:qn("modal"),position:"left"},Td=di((e,{position:t,size:n,offset:r})=>({root:{"--drawer-size":fi(n,"drawer-size"),"--drawer-flex":Cd(t),"--drawer-height":t==="left"||t==="right"?void 0:"var(--drawer-size)","--drawer-align":kd(t),"--drawer-justify":t==="right"?"flex-end":void 0,"--drawer-offset":hi(r)}})),nr=kt((e,t)=>{const n=bt("DrawerRoot",Ad,e),{classNames:r,className:o,style:a,styles:s,unstyled:c,vars:l,scrollAreaComponent:u,position:h,transitionProps:p,radius:f,attributes:k,...S}=n,{dir:C}=li(),y=ui({name:"Drawer",classes:Tt,props:n,className:o,style:a,classNames:r,styles:s,unstyled:c,attributes:k,vars:l,varsResolver:Td}),m=(C==="rtl"?bd:Sd)[h];return i.jsx(yd,{value:{scrollAreaComponent:u,getStyles:y,radius:f},children:i.jsx(el,{ref:t,...y("root"),transitionProps:{transition:m,...p},"data-offset-scrollbars":u===tl.Autosize||void 0,unstyled:c,...S})})});nr.classes=Tt;nr.displayName="@mantine/core/DrawerRoot";const[jd,Nd]=nl();function zi({children:e}){const[t,n]=Y.useState([]),[r,o]=Y.useState(qn("modal"));return i.jsx(jd,{value:{stack:t,addModal:(a,s)=>{n(c=>[...new Set([...c,a])]),o(c=>typeof s=="number"&&typeof c=="number"?Math.max(c,s):c)},removeModal:a=>n(s=>s.filter(c=>c!==a)),getZIndex:a=>"calc(".concat(r," + ").concat(t.indexOf(a)," + 1)"),currentId:t[t.length-1],maxZIndex:r},children:e})}zi.displayName="@mantine/core/DrawerStack";const rr=kt((e,t)=>{const n=bt("DrawerTitle",null,e),{classNames:r,className:o,style:a,styles:s,vars:c,...l}=n,u=tn();return i.jsx(rl,{ref:t,...u.getStyles("title",{classNames:r,style:a,styles:s,className:o}),...l})});rr.classes=Tt;rr.displayName="@mantine/core/DrawerTitle";const Id={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:qn("modal"),withOverlay:!0,withCloseButton:!0},pt=kt((e,t)=>{const{title:n,withOverlay:r,overlayProps:o,withCloseButton:a,closeButtonProps:s,children:c,opened:l,stackId:u,zIndex:h,...p}=bt("Drawer",Id,e),f=Nd(),k=!!n||a,S=f&&u?{closeOnEscape:f.currentId===u,trapFocus:f.currentId===u,zIndex:f.getZIndex(u)}:{},C=r===!1?!1:u&&f?f.currentId===u:l;return Y.useEffect(()=>{f&&u&&(l?f.addModal(u,h||qn("modal")):f.removeModal(u))},[l,u,h]),i.jsxs(nr,{ref:t,opened:l,zIndex:f&&u?f.getZIndex(u):h,...p,...S,children:[r&&i.jsx(tr,{visible:C,transitionProps:f&&u?{duration:0}:void 0,...o}),i.jsxs(Qn,{__hidden:f&&u&&l?u!==f.currentId:!1,children:[k&&i.jsxs(er,{children:[n&&i.jsx(rr,{children:n}),a&&i.jsx(Jn,{...s})]}),i.jsx(Xn,{children:c})]})]})});pt.classes=Tt;pt.displayName="@mantine/core/Drawer";pt.Root=nr;pt.Overlay=tr;pt.Content=Qn;pt.Body=Xn;pt.Header=er;pt.Title=rr;pt.CloseButton=Jn;pt.Stack=zi;function Md(e){return"TouchEvent"in window&&e instanceof window.TouchEvent?e.touches[0].clientX:e.clientX}const _d=di((e,{size:t,color:n,thumbSize:r,radius:o})=>({root:{"--slider-size":fi(t,"slider-size"),"--slider-color":n?al(n,e):void 0,"--slider-radius":o===void 0?void 0:ol(o),"--slider-thumb-size":r!==void 0?hi(r):"calc(var(--slider-size) * 2)"}})),Fd={min:0,max:100,minRange:10,step:1,marks:[],label:e=>e,labelTransitionProps:{transition:"fade",duration:0}
1,labelAlwaysOn:!1,showLabelOnHover:!0,disabled:!1,pushOnOverlap:!0,scale:e=>e,size:"md",maxRange:1/0},an=kt((e,t)=>{const n=bt("RangeSlider",Fd,e),{classNames:r,styles:o,value:a,onChange:s,onChangeEnd:c,size:l,min:u,max:h,domain:p,minRange:f,maxRange:k,step:S,precision:C,defaultValue:y,name:m,marks:d,label:g,labelTransitionProps:w,labelAlwaysOn:v,thumbFromLabel:x,thumbToLabel:b,showLabelOnHover:A,thumbChildren:T,disabled:I,unstyled:M,scale:F,inverted:P,className:B,style:E,vars:H,hiddenInputProps:te,restrictToMarks:me,thumbProps:fe,pushOnOverlap:Q,attributes:le,...we}=n,ue=ui({name:"RangeSlider",props:n,classes:Li,classNames:r,className:B,styles:o,style:E,attributes:le,vars:H,varsResolver:_d,unstyled:M}),oe=Y.useRef(null),{dir:Ce}=li(),[G,j]=Y.useState(-1),[L,V]=Y.useState(!1),[U,ye]=qu({value:a,defaultValue:y,finalValue:[u,h],onChange:s}),O=Y.useRef(U),be=Y.useRef([]),ze=Y.useRef(null),qe=Y.useRef(void 0),[Z,se]=p||[u,h],de=[ka({value:U[0],min:Z,max:se}),ka({value:U[1],min:Z,max:se})],Ae=C!=null?C:Ju(S),Qe=J=>{ye(J),O.current=J};Y.useEffect(()=>{Array.isArray(a)&&(O.current=a)},Array.isArray(a)?[a[0],a[1]]:[null,null]);const We=(J,$,Fe)=>{if($===-1)return;const ie=[...O.current];if(me&&d){const Pe=rd(J,d.map(Gc=>Gc.value)),rn=ie[$];ie[$]=Pe;const $t=$===0?1:0,pa=od(d),ma=ad(d);Pe===pa&&ie[$t]===pa||Pe===ma&&ie[$t]===ma?ie[$]=rn:Pe===ie[$t]&&(rn>ie[$t]?ie[$t]=Tn(Pe,d):ie[$t]=An(Pe,d))}else{const Pe=Cl(J,u,h);ie[$]=Pe,$===0&&(Pe>ie[1]-(f-1e-9)&&(Q?ie[1]=Math.min(J+f,h):ie[$]=O.current[$]),Pe>(h-(f-1e-9)||u)&&(ie[$]=O.current[$]),ie[1]-J>k&&(Q?ie[1]=J+k:ie[$]=O.current[$])),$===1&&(Pe<ie[0]+f&&(Q?ie[0]=Math.max(J-f,u):ie[$]=O.current[$]),Pe<ie[0]+f&&(ie[$]=O.current[$]),Pe-ie[0]>k&&(Q?ie[0]=J-k:ie[$]=O.current[$]))}if(ie[0]=jt(ie[0],Ae),ie[1]=jt(ie[1],Ae),ie[0]>ie[1]){const Pe=ie[0];ie[0]=ie[1],ie[1]=Pe}Qe(ie),Fe&&(c==null||c(O.current))},$e=J=>{if(!I&&qe.current!==void 0){const $=Sa({value:J,min:Z,max:se,step:S,precision:Ae});We($,qe.current,!1)}},{ref:pe,active:Ne}=Qu(({x:J})=>$e(J),{onScrubEnd:()=>!I&&(c==null?void 0:c(O.current))},Ce);function je(J){qe.current=J}const Ee=J=>{if(oe.current){oe.current.focus();const $=oe.current.getBoundingClientRect(),Fe=Md(J.nativeEvent),ie=Sa({value:Fe-$.left,max:h,min:u,step:S,containerWidth:$.width}),Pe=Math.abs(U[0]-ie)>Math.abs(U[1]-ie)?1:0,rn=Ce==="ltr"?Pe:Pe===1?0:1;qe.current=rn}},X=()=>G!==1&&G!==0?(j(0),0):G,_e=J=>{if(!I)switch(J.key){case"ArrowUp":{J.preventDefault();const $=X();be.current[$].focus();const Fe=me&&d?An(O.current[$],d):Math.min(Math.max(O.current[$]+S,u),h);We(jt(Fe,Ae),$,!0);break}case"ArrowRight":{J.preventDefault();const $=X();be.current[$].focus();const Fe=me&&d?(Ce==="rtl"?Tn:An)(O.current[$],d):Math.min(Math.max(Ce==="rtl"?O.current[$]-S:O.current[$]+S,u),h);We(jt(Fe,Ae),$,!0);break}case"ArrowDown":{J.preventDefault();const $=X();be.current[$].focus();const Fe=me&&d?Tn(O.current[$],d):Math.min(Math.max(O.current[$]-S,u),h);We(jt(Fe,Ae),$,!0);break}case"ArrowLeft":{J.preventDefault();const $=X();be.current[$].focus();const Fe=me&&d?(Ce==="rtl"?An:Tn)(O.current[$],d):Math.min(Math.max(Ce==="rtl"?O.current[$]+S:O.current[$]-S,u),h);We(jt(Fe,Ae),$,!0);break}}},Le={max:h,min:u,size:l,labelTransitionProps:w,labelAlwaysOn:v,onBlur:()=>j(-1)},lt=Array.isArray(T);return i.jsx(ed,{value:{getStyles:ue},children:i.jsxs(td,{...we,size:l,ref:ga(t,ze),disabled:I,onMouseDownCapture:()=>{var J;return(J=ze.current)==null?void 0:J.focus()},onKeyDownCapture:()=>{var J,$,Fe;($=(J=be.current[0])==null?void 0:J.parentElement)!=null&&$.contains(document.activeElement)||(Fe=be.current[0])==null||Fe.focus()},children:[i.jsxs(nd,{offset:de[0],marksOffset:U[0],filled:de[1]-de[0],marks:d,inverted:P,min:Z,max:se,value:U[1],disabled:I,containerProps:{ref:ga(oe,pe),onMouseEnter:A?()=>V(!0):void 0,onMouseLeave:A?()=>V(!1):void 0,onTouchStartCapture:Ee,onTouchEndCapture:()=>{qe.current=-1},onMouseDownCapture:Ee,onMouseUpCapture:()=>{qe.current=-1},onKeyDownCapture:_e},children:[i.jsx(Ca,{...Le,value:F(U[0]),position:de[0],dragging:Ne,label:typeof g=="function"?g(jt(F(U[0]),Ae)):g,ref:J=>{J&&(be.current[0]=J)},thumbLabel:x,onMouseDown:()=>je(0),onFocus:()=>
1j(0),showLabelOnHover:A,isHovered:L,disabled:I,...fe==null?void 0:fe(0),children:lt?T[0]:T}),i.jsx(Ca,{...Le,thumbLabel:b,value:F(U[1]),position:de[1],dragging:Ne,label:typeof g=="function"?g(jt(F(U[1]),Ae)):g,ref:J=>{J&&(be.current[1]=J)},onMouseDown:()=>je(1),onFocus:()=>j(1),showLabelOnHover:A,isHovered:L,disabled:I,...fe==null?void 0:fe(1),children:lt?T[1]:T})]}),i.jsx("input",{type:"hidden",name:"".concat(m,"_from"),value:U[0],...te}),i.jsx("input",{type:"hidden",name:"".concat(m,"_to"),value:U[1],...te})]})})});an.classes=Li;an.displayName="@mantine/core/RangeSlider";function Dd(e,t){pi(2,arguments);var n=jo(e),r=mi(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function Ed(e,t){pi(2,arguments);var n=jo(e),r=jo(t);return n.getTime()>r.getTime()}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Ld=e=>{if(e==="feet")return"ft";if(e==="meters")return"m";throw new Error('Received unexpected unit of measurement. Use "feet" or "meters"')};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Yd=(e,t)=>{const n=Sl(e,t),r=Ld(t);return"".concat(n.toFixed()," ").concat(r)};function Rd(e,t){var n=Wd(t);return n.formatToParts?Od(n,e):zd(n,e)}var Pd={year:0,month:1,day:2,hour:3,minute:4,second:5};function Od(e,t){for(var n=e.formatToParts(t),r=[],o=0;o<n.length;o++){var a=Pd[n[o].type];a>=0&&(r[a]=parseInt(n[o].value,10))}return r}function zd(e,t){var n=e.format(t).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[r[3],r[1],r[2],r[4],r[5],r[6]]}var mr={};function Wd(e){if(!mr[e]){var t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n=t==="06/25/2014, 00:00:00"||t==="â06â/â25â/â2014â â00â:â00â:â00";mr[e]=n?new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return mr[e]}var Aa=36e5,Hd=6e4,gr={timezoneZ:/^(Z)$/,timezoneHH:/^([+-])(\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Wi(e,t,n){var r,o;if(r=gr.timezoneZ.exec(e),r)return 0;var a;if(r=gr.timezoneHH.exec(e),r)return a=parseInt(r[2],10),Ta()?(o=a*Aa,r[1]==="+"?-o:o):NaN;if(r=gr.timezoneHHMM.exec(e),r){a=parseInt(r[2],10);var s=parseInt(r[3],10);return Ta(a,s)?(o=a*Aa+s*Hd,r[1]==="+"?-o:o):NaN}if(Vd(e)){t=new Date(t||Date.now());var c=n?t:Bd(t),l=_o(c,e),u=n?l:$d(t,l,e);return-u}return 0}function Bd(e){return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()))}function _o(e,t){var n=Rd(e,t),r=Date.UTC(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5]),o=e.getTime(),a=o%1e3;return o-=a>=0?a:1e3+a,r-o}function $d(e,t,n){var r=e.getTime(),o=r-t,a=_o(new Date(o),n);if(t===a)return t;o-=a-t;var s=_o(new Date(o),n);return a===s?a:Math.max(a,s)}function Ta(e,t){return!(t!=null&&(t<0||t>59))}function Vd(e){try{return Intl.DateTimeFormat(void 0,{timeZone:e}),!0}catch(t){return!1}}var wr=36e5,ja=6e4,Gd=2,Be={dateTimeDelimeter:/[T ]/,plainTime:/:/,timeZoneDelimeter:/[Z ]/i,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timezone:/([Z+-].*| UTC|(?:[a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?))$/};function Hi(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);var n={},r=n.additionalDigits==null?Gd:mi(n.additionalDigits);if(r!==2&&r!==1&&r!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var o=qd(e),a=Ud(o.date,r),s=a.year,c=a.restDateString,l=Zd(c,s);if(isNaN(l))return new Date(NaN);if(l){var u=l.getTime(),h=0,p;if(o.time&&(h=Kd(o.time),isNaN(h)))return new Date(NaN);if(o.timezone||n.timeZone){if(p=Wi(o.timezone||n.timeZone,new Date(u+h)),isNaN(p))return new Date(NaN)}else p=wa(new Date(u+h)),p=wa(new Date(u+h+p));return new Date(u+h+p)}else return new Date(NaN)}function qd(e){var t={},n=e.split(Be.dateTimeDelimeter),r;if(Be.plainTime.test(n[0])?(t.date=null,r=n[0]):(t.date=n[0],r=n[1],t.timezone=n[2],Be.timeZoneDelimeter.test(t.date)&&(t.date=e.split(Be.timeZoneDelimeter)[0],r=e.substr(t.date.length,e.length))),r){var o=Be.timezone.exec(r);
1o?(t.time=r.replace(o[1],""),t.timezone=o[1]):t.time=r}return t}function Ud(e,t){var n=Be.YYY[t],r=Be.YYYYY[t],o;if(o=Be.YYYY.exec(e)||r.exec(e),o){var a=o[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(o=Be.YY.exec(e)||n.exec(e),o){var s=o[1];return{year:parseInt(s,10)*100,restDateString:e.slice(s.length)}}return{year:null}}function Zd(e,t){if(t===null)return null;var n,r,o,a;if(e.length===0)return r=new Date(0),r.setUTCFullYear(t),r;if(n=Be.MM.exec(e),n)return r=new Date(0),o=parseInt(n[1],10)-1,Ia(t,o)?(r.setUTCFullYear(t,o),r):new Date(NaN);if(n=Be.DDD.exec(e),n){r=new Date(0);var s=parseInt(n[1],10);return Qd(t,s)?(r.setUTCFullYear(t,0,s),r):new Date(NaN)}if(n=Be.MMDD.exec(e),n){r=new Date(0),o=parseInt(n[1],10)-1;var c=parseInt(n[2],10);return Ia(t,o,c)?(r.setUTCFullYear(t,o,c),r):new Date(NaN)}if(n=Be.Www.exec(e),n)return a=parseInt(n[1],10)-1,Ma(t,a)?Na(t,a):new Date(NaN);if(n=Be.WwwD.exec(e),n){a=parseInt(n[1],10)-1;var l=parseInt(n[2],10)-1;return Ma(t,a,l)?Na(t,a,l):new Date(NaN)}return null}function Kd(e){var t,n,r;if(t=Be.HH.exec(e),t)return n=parseFloat(t[1].replace(",",".")),vr(n)?n%24*wr:NaN;if(t=Be.HHMM.exec(e),t)return n=parseInt(t[1],10),r=parseFloat(t[2].replace(",",".")),vr(n,r)?n%24*wr+r*ja:NaN;if(t=Be.HHMMSS.exec(e),t){n=parseInt(t[1],10),r=parseInt(t[2],10);var o=parseFloat(t[3].replace(",","."));return vr(n,r,o)?n%24*wr+r*ja+o*1e3:NaN}return null}function Na(e,t,n){t=t||0,n=n||0;var r=new Date(0);r.setUTCFullYear(e,0,4);var o=r.getUTCDay()||7,a=t*7+n+1-o;return r.setUTCDate(r.getUTCDate()+a),r}var Xd=[31,28,31,30,31,30,31,31,30,31,30,31],Jd=[31,29,31,30,31,30,31,31,30,31,30,31];function Bi(e){return e%400===0||e%4===0&&e%100!==0}function Ia(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;var r=Bi(e);if(r&&n>Jd[t]||!r&&n>Xd[t])return!1}return!0}function Qd(e,t){if(t<1)return!1;var n=Bi(e);return!(n&&t>366||!n&&t>365)}function Ma(e,t,n){return!(t<0||t>52||n!=null&&(n<0||n>6))}function vr(e,t,n){return!(e!=null&&(e<0||e>=25)||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}function e1(e,t,n){var r=Hi(e,n),o=Wi(t,r,!0)||0,a=new Date(r.getTime()-o),s=new Date(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds());return s}const t1=Object.freeze(Object.defineProperty({__proto__:null,toDate:Hi,utcToZonedTime:e1},Symbol.toStringTag,{value:"Module"}));globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const{utcToZonedTime:_a}=t1;function n1(e,t){const n=_a(new Date,t.time_zone),r=Dd(_a(e.date,t.time_zone),1);return Ed(n,r)}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Qo(e,t){return e.goal_power?e.goal_power:t?e.goal_time?t.power_range.target:t.power_range_suggested.target:0}function $i(e,t){return e.goal_time?e.goal_time:t?t.time_range.target:0}function r1(e,t){if(!t)return!1;const n=Qo(e,t);return Math.abs(n-t.power_range_suggested.target)>5}function o1(e,t){var n,r,o,a,s,c,l,u;sl(1,arguments);var h=bl(),p=il((n=(r=(o=(a=t==null?void 0:t.weekStartsOn)!==null&&a!==void 0?a:t==null||(s=t.locale)===null||s===void 0||(c=s.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&o!==void 0?o:h.weekStartsOn)!==null&&r!==void 0?r:(l=h.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&n!==void 0?n:0);if(!(p>=0&&p<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=cl(e),k=f.getDay(),S=(k<p?7:0)+k-p;return f.setDate(f.getDate()-S),f.setHours(0,0,0,0),f}const a1=[["path",{d:"M12 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M4 6l8 0",key:"svg-1"}],["path",{d:"M16 6l4 0",key:"svg-2"}],["path",{d:"M6 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-3"}],["path",{d:"M4 12l2 0",key:"svg-4"}],["path",{d:"M10 12l10 0",key:"svg-5"}],["path",{d:"M15 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-6"}],["path",{d:"M4 18l11 0",key:"svg-7"}],["path",{d:"M19 18l1 0",key:"svg-8"}]],s1=At("outline","adjustments-horizontal","AdjustmentsHorizontal",a1);const i1=[["path",{d:"M19 4v16h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12",key:"svg-0"}],["path",{d:"M19 16h-12a2 2 0 0 0 -2 2",key:"svg-1"}],["path",{d:"M9 8h6",key:"svg-2"}]],ea=At("outline","book-2","Book2",i1);const c1=[["path",{d:"M7 7l5 5l5 -5",key:"svg-0"}],["path",{d:"M7 13l5 5l5 -5",key:"svg-1"}]],l1=At("outline","chevrons-down","ChevronsDown",c1);const u1=[["path",{d:"M7 11l5 -5l5 5",key:"svg-0"}],["path",{d:"M7 17l5 -5l5 5",key:"svg-1"}]],d1=At("outline","chevrons-up","ChevronsUp",u1);const h1=[["path",{d:"M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666",key:"svg-0"}],["path",{d:"M4.012 16.737a2 2 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}],["path",{d:"M11 14h6",key:"svg-2"}],["path",{d:"M14 11v6",key:"svg-3"}]],f1=At("outline","copy-plus","CopyPlus",h1);const p1=[["path",{d:"M6 4h11a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-11a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1m3 0v18",key:"svg-0"}],["path",{d:"M13 8l2 0",key:"svg-1"}],["path",{d:"M13 12l2 0",key:"svg-2"}]],m1=At("outline","notebook","Notebook",p1);const g1=[["path",{d:"M6 6a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -12",key:"svg-0"}],["path",{d:"M14 6a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -12",key:"svg-1"}]],w1=At("outline","player-pause","PlayerPause",g1);const v1=[["path",{d:"M7 4v16l13 -8l-13 -8",key:"svg-0"}]],x1=At("outline","player-play","PlayerPlay",v1);const y1=[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 9l5 -5l5 5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]],k1=At("outline","upload","Upload",y1);function C1(e){if(e===null)return null;const t=new Date(e);return Number.isNaN(t.getTime())||!e?null:xe(t).format("YYYY-MM-DD")}function S1({date:e,maxDate:t,minDate:n}){return!(e==null||Number.isNaN(new Date(e).getTime())||t&&xe(e).isAfter(t,"date")||n&&xe(e).isBefore(n,"date"))}const b1={valueFormat:"MMMM D, YYYY",fixOnBlur:!0,size:"sm"},ta=kt((e,t)=>{const n=Uu("DateInput",b1,e),{inputProps:r,wrapperProps:o,value:a,defaultValue:s,onChange:c,clearable:l,clearButtonProps:u,popoverProps:h,getDayProps:p,locale:f,valueFormat:k,dateParser:S,minDate:C,maxDate:y,fixOnBlur:m,onFocus:d,onBlur:g,onClick:w,onKeyDown:v,readOnly:x,name:b,form:A,rightSection:T,unstyled:I,classNames:M,styles:F,allowDeselect:P,date:B,defaultDate:E,onDateChange:H,getMonthControlProps:te,getYearControlProps:me,disabled:fe,...Q}=n,le=Y.useRef(null),we=Y.useRef(null),[ue,oe]=Y.useState(!1),{calendarProps:Ce,others:G}=Al(Q),j=Tl(),V=S||(X=>{const _e=xe(X,k,j.getLocale(f)).toDate();return Number.isNaN(_e.getTime())?C1(X):xe(_e).format("YYYY-MM-DD")}
1),U=P!==void 0?P:l,ye=X=>X?xe(X).locale(j.getLocale(f)).format(k):"",[O,be,ze]=va({type:"default",value:a,defaultValue:s,onChange:c}),[qe,Z]=va({type:"default",value:B,defaultValue:s||E,onChange:H});Y.useEffect(()=>{ze&&a!==null&&Z(a)},[ze,a]);const[se,de]=Y.useState(ye(O));Y.useEffect(()=>{de(ye(O))},[j.getLocale(f)]);const Ae=X=>{const _e=X.currentTarget.value;if(de(_e),oe(!0),_e.trim()===""&&(P||l))be(null);else{const Le=V(_e);Le&&S1({date:Le,minDate:C,maxDate:y})&&(be(Le),Z(Le))}},Qe=X=>{g==null||g(X),oe(!1),m&&de(ye(O))},We=X=>{d==null||d(X),oe(!0)},$e=X=>{w==null||w(X),oe(!0)},pe=X=>{X.key==="Escape"&&oe(!1),v==null||v(X)},Ne=X=>({...p==null?void 0:p(X),selected:xe(O).isSame(X,"day"),onClick:_e=>{var lt,J;(J=p==null?void 0:(lt=p(X)).onClick)==null||J.call(lt,_e);const Le=U&&xe(O).isSame(X,"day")?null:X;be(Le),!ze&&Le&&de(ye(Le)),oe(!1)}}),je=i.jsx(En.ClearButton,{onClick:()=>{be(null),!ze&&de(""),oe(!1)},unstyled:I,...u}),Ee=l&&!!O&&!x&&!fe;return ll(()=>{O!==void 0&&!ue&&de(ye(O))},[O]),jl(()=>oe(!1),void 0,[le.current,we.current]),i.jsxs(i.Fragment,{children:[i.jsx(En.Wrapper,{...o,__staticSelector:"DateInput",ref:le,children:i.jsxs(Gt,{opened:ue,trapFocus:!1,position:"bottom-start",disabled:x||fe,withRoles:!1,unstyled:I,...h,children:[i.jsx(Gt.Target,{children:i.jsx(En,{"data-dates-input":!0,"data-read-only":x||void 0,autoComplete:"off",ref:t,value:se,onChange:Ae,onBlur:Qe,onFocus:We,onClick:$e,onKeyDown:pe,readOnly:x,rightSection:T,__clearSection:je,__clearable:Ee,...r,...G,disabled:fe,__staticSelector:"DateInput"})}),i.jsx(Gt.Dropdown,{onMouseDown:X=>X.preventDefault(),"data-dates-dropdown":!0,ref:we,children:i.jsx(gi,{__staticSelector:"DateInput",...Ce,classNames:M,styles:F,unstyled:I,__preventFocus:!0,minDate:C,maxDate:y,locale:f,getDayProps:Ne,size:r.size,date:qe,onDateChange:Z,getMonthControlProps:X=>({selected:typeof O=="string"?Nl(X,O):!1,...te==null?void 0:te(X)}),getYearControlProps:X=>({selected:typeof O=="string"?xe(X).isSame(O,"year"):!1,...me==null?void 0:me(X)}),attributes:o.attributes})})]})}),i.jsx(Il,{name:b,form:A,value:O,type:"default"})]})});ta.classes={...En.classes,...gi.classes};ta.displayName="@mantine/dates/DateInput";var Fa=Array.prototype.slice;function Da(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function Vi(e,t){this._context=e,this._k=(1-t)/6}Vi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Da(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Da(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const A1=(function e(t){function n(r){return new Vi(r,t)}return n.tension=function(r){return e(+r)},n})(0);function Zt(e,t){if((s=e.length)>1)for(var n=1,r,o,a=e[t[0]],s,c=a.length;n<s;++n)for(o=a,a=e[t[n]],r=0;r<c;++r)a[r][1]+=a[r][0]=isNaN(o[r][1])?o[r][0]:o[r][1]}function Kt(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function T1(e,t){return e[t]}function j1(){var e=Sn([]),t=Kt,n=Zt,r=T1;function o(a){var s=e.apply(this,arguments),c,l=a.length,u=s.length,h=new Array(u),p;for(c=0;c<u;++c){for(var f=s[c],k=h[c]=new Array(l),S=0,C;S<l;++S)k[S]=C=[0,+r(a[S],f,S,a)],C.data=a[S];k.key=f}for(c=0,p=t(h);c<u;++c)h[p[c]].index=c;return n(h,p),h}return o.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Sn(Fa.call(a)),o):e},o.value=function(a){return arguments.length?(r=typeof a=="function"?a:Sn(+a),o):r},o.order=function(a){return arguments.length?(t=a==null?Kt:typeof a=="function"?a:Sn(Fa.call(a)),o):t},o.offset=function(a){return arguments.length?(n=a==null?Zt:a,o):n},o}function N1(e,t){if((r=e.length)>0){for(var n,r,o=0,a=e[0].length,s;o<a;++o){for(s=n=0;n<r;++n)s+=e[n][o][1]||0;if(s)for(n=0;n<r;++n)e[n][o][1]/=s}Zt(e,t)}}function I1(e,t){if((l=e.length)>0)for(var n,r=0,o,a,s,c,l,u=e[t[0]].length;r<u;++r)for(s=c=0,n=0;n<l;++n)(a=(o=e[t[n]][r])[1]-o[0])>0?(o[0]=s,o[1]=s+=a):a<0?(o[1]=c,o[0]=c+=a):(o[0]=0,o[1]=a)}function M1(e,t){if((o=e.length)>0){for(var n=0,r=e[t[0]],o,a=r.length;n<a;++n){for(var s=0,c=0;s<o;++s)c+=e[s][n][1]||0;r[n][1]+=r[n][0]=-c/2}Zt(e,t)}}function _1(e,t){if(!(!((s=e.length)>0)||!((a=(o=e[t[0]]).length)>0))){for(var n=0,r=1,o,a,s;r<a;++r){for(var c=0,l=0,u=0;c<s;++c){for(var h=e[t[c]],p=h[r][1]||0,f=h[r-1][1]||0,k=(p-f)/2,S=0;S<c;++S){var C=e[t[S]],y=C[r][1]||0,m=C[r-1][1]||0;k+=y-m}l+=p,u+=k*p}
1o[r-1][1]+=o[r-1][0]=n,l&&(n-=u/l)}o[r-1][1]+=o[r-1][0]=n,Zt(e,t)}}function F1(e){var t=e.map(D1);return Kt(e).sort(function(n,r){return t[n]-t[r]})}function D1(e){for(var t=-1,n=0,r=e.length,o,a=-1/0;++t<r;)(o=+e[t][1])>a&&(a=o,n=t);return n}function Gi(e){var t=e.map(qi);return Kt(e).sort(function(n,r){return t[n]-t[r]})}function qi(e){for(var t=0,n=-1,r=e.length,o;++n<r;)(o=+e[n][1])&&(t+=o);return t}function E1(e){return Gi(e).reverse()}function L1(e){var t=e.length,n,r,o=e.map(qi),a=F1(e),s=0,c=0,l=[],u=[];for(n=0;n<t;++n)r=a[n],s<c?(s+=o[r],l.push(r)):(c+=o[r],u.push(r));return u.reverse().concat(l)}function Y1(e){return Kt(e).reverse()}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const R1="yyyy-MM-dd";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const P1=()=>Y.useMemo(()=>{const e=He("monthly");e.debugLabel="calendarViewAtom";const t=He("");t.debugLabel="openedSeeMoreInDayAtom";const n=He(G=>{const j=G(bn);return xe().tz(j)});n.debugLabel="todayAtom";const r=He(0);r.debugLabel="monthlyVisibleStartIndexAtom";const o=He(G=>{var O;const j=G(bn),{byWeek:L}=G(u),V=G(r),ye=(O=L[V+0])==null?void 0:O.at(-1);return!ye||!j||V===0?xe.tz(new Date,j):xe.tz(ye,j).startOf("month")});o.debugLabel="monthlyActiveMonthDateAtom";const a=He(0);a.debugLabel="baseWeeklyVisibleIndexAtom";const s=He(G=>{const j=G(a),L=G(h);return j||L},(G,j,L)=>{j(a,L)});s.debugLabel="weeklyVisibleIndexAtom";const c=He(0);c.debugLabel="weeklyVisibleStartIndexAtom";const l=He(G=>{const j=G(bn),{byWeek:L}=G(u),V=G(s),U=L[V][0];return!U||!j||V===0?xe.tz(new Date,j):xe.tz(U,j).startOf("month")});l.debugLabel="weeklyActiveDateAtom";const u=He(G=>{G(xa);const j=G(bn);return Ml(void 0,void 0,void 0,j)});u.debugLabel="calendarDatesAtom";const h=He(G=>{const{byWeek:j}=G(u),L=G(n);return Dn(L.format("YYYY-MM-DD"),j)});h.debugLabel="todayIndexInWeekAtom";const p=He(null,(G,j)=>{const L=G(h);j(C,null),j(s,L)});p.debugLabel="goToTodayAtom";const f=He(G=>{const{byDay:j}=G(u),L=G(n),V=o1(L.toDate(),{weekStartsOn:G(xa)});return j.findIndex(U=>U===_l(V,R1))});f.debugLabel="todayIndexInDayAtom";const S=He({min:0,max:0});S.debugLabel="fetchRangeIndexesAtom";const C=He(null);C.debugLabel="scrollDirectionAtom";const y=fr("SHOW_WEEKLY_RUNNING_GRAPH",!1);y.debugLabel="showWeeklyRunningGraphAtom";const m=He(!1);m.debugLabel="toolsDrawerOpenedAtom";const d=He("trainingPlans");d.debugLabel="toolsDrawerActiveOptionAtom";const g=fr("SHOW_WEEK_NUMBERS",!0);g.debugLabel="showWeekNumbersAtom";const w=fr("EXPAND_ALL_CARDS",!0);return w.debugLabel="expandAllCardsAtom",{useCalendarView:()=>Rt(e),useFetchRangeIndexes:()=>Rt(S),useToday:()=>nt(n),useMonthlyVisibleStartIndex:()=>nt(r),useMonthlyActiveMonthDate:()=>nt(o),useWeeklyVisibleIndex:()=>nt(s),useWeeklyActiveDate:()=>nt(l),useCalendarWeekDates:()=>nt(u).byWeek,useCalendarDayDates:()=>nt(u).byDay,useTodayIndexInWeek:()=>nt(h),useTodayIndexInDay:()=>nt(f),useShowWeekNumbers:()=>Rt(g),useScrollDirection:()=>nt(C),useOpenedSeeMoreInDay:()=>nt(t),useExpandAllCards:()=>Rt(w),useShowWeeklyRunningGraph:()=>Rt(y),useToolsDrawerOpened:()=>Rt(m),useToolsDrawerActiveOption:()=>Rt(d),useGoToPrevWeek:()=>{const G=ut(C),j=ut(a),L=nt(s);return()=>{G("backward"),j(L-1)}},useGoToNextWeek:()=>{const G=ut(C),j=ut(a),L=nt(s);return()=>{G("forward"),j(L+1)}},useActions:()=>{const G=ut(r),j=ut(c),L=ut(a),V=ut(S),U=ut(C),ye=ut(p),O=ut(t);return{setMonthlyVisibleStartIndex:G,setWeeklyVisibleStartIndex:j,setFetchRangeIndexesAtom:V,setWeeklyVisibleIndex:L,setScrollDirection:U,goToToday:ye,setOpenedSeeMoreInDay:O}}}},[]),Ui=Y.createContext(null),O1=({children:e})=>{const t=P1();return i.jsx(Ui.Provider,{value:t,children:e})},Dt=()=>{const e=Y.useContext(Ui);if(!e)throw new Error("!!!");return e},z1="_year_3hjq6_1",W1={year:z1};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const H1=({monthlyCalendarRef:e})=>{const t=Re(),{useCalendarView:n,useTodayIndexInWeek:r,useMonthlyActiveMonthDate:o,useWeeklyActiveDate:a,use
1ShowWeekNumbers:s,useCalendarWeekDates:c,useGoToPrevWeek:l,useGoToNextWeek:u,useActions:h}=Dt(),{goToToday:p}=h(),f=l(),k=u(),S=Go(),[C]=n(),y=o(),m=a(),d=r(),g=c(),w=c(),[v]=s();zu([["ArrowUp",()=>{C==="monthly"?b():C==="weekly"&&f()}],["ArrowDown",()=>{C==="monthly"?A():C==="weekly"&&k()}],["ArrowLeft",()=>{C==="monthly"?b():C==="weekly"&&f()}],["ArrowRight",()=>{C==="monthly"?A():C==="weekly"&&k()}],["t",()=>{x()}]]);const x=()=>{var M;C==="monthly"?(M=e.current)==null||M.scrollToIndex(d):C==="weekly"&&p()},b=()=>{var F;const M=y.subtract(1,"month");(F=e.current)==null||F.scrollToIndex(Dn(M.format("YYYY-MM-DD"),g))},A=()=>{var F;const M=y.add(1,"month");(F=e.current)==null||F.scrollToIndex(Dn(M.format("YYYY-MM-DD"),g))},[T,I]=Y.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsxs(W,{align:"center",gap:"xs",h:"3.75rem",px:"sm",children:[i.jsx(Ke,{variant:"primary",color:"gray",size:"xs",onClick:x,children:i.jsx(K,{id:"CalendarHeader.today"})}),C==="monthly"&&i.jsxs(i.Fragment,{children:[i.jsx(et,{variant:"subtle",color:"gray",size:"sm",onClick:b,children:i.jsx(Zu,{size:12})}),i.jsx(et,{variant:"subtle",color:"gray",size:"sm",onClick:A,children:i.jsx(Xu,{size:12})})]}),i.jsxs(Gt,{opened:T,onClose:()=>I(!1),position:"right-start",children:[i.jsx(Gt.Target,{children:i.jsxs(wi,{order:3,onClick:()=>I(!0),className:W1.year,children:[C==="monthly"&&y.format("MMMM YYYY"),C==="weekly"&&m.format("MMMM YYYY")]})}),i.jsx(Gt.Dropdown,{children:i.jsx(sd,{minDate:new Date(2015,4,1),defaultDate:xe().format("YYYY-MM-DD"),onChange:M=>{var F;if(M){const P=Dn(M,w);(F=e.current)==null||F.scrollToIndex(P)}I(!1)}})})]})]}),i.jsxs(W,{gap:0,py:"4",style:{borderBottom:"1px solid #222"},children:[w[0].map((M,F)=>i.jsx(W,{flex:1,justify:"center",color:"gray",children:i.jsx(R,{size:"sm",children:xe.weekdaysShort()[xe.tz(M,S).day()].toLocaleUpperCase()})},F)),v&&i.jsx(W,{flex:1,align:"center",justify:"center",miw:180,children:i.jsx(R,{size:"sm",children:t.formatMessage({id:"CalendarToolbar.summary"}).toLocaleUpperCase()})})]})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const or=0,Et=1,nn=2,Zi=4;function Ki(e,t){return n=>e(t(n))}function B1(e,t){return t(e)}function Xi(e,t){return n=>e(t,n)}function Ea(e,t){return()=>e(t)}function ar(e,t){return t(e),e}function Me(...e){return e}function $1(e){e()}function La(e){return()=>e}function V1(...e){return()=>{e.map($1)}}function na(e){return e!==void 0}function Wt(){}function Se(e,t){return e(Et,t)}function ce(e,t){e(or,t)}function ra(e){e(nn)}function Ve(e){return e(Zi)}function q(e,t){return Se(e,Xi(t,or))}function yt(e,t){const n=e(Et,r=>{n(),t(r)});return n}function ge(){const e=[];return(t,n)=>{switch(t){case nn:e.splice(0,e.length);return;case Et:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case or:e.slice().forEach(r=>{r(n)});return;default:throw new Error("unrecognized action ".concat(t))}}}function D(e){let t=e;const n=ge();return(r,o)=>{switch(r){case Et:o(t);break;case or:t=o;break;case Zi:return t}return n(r,o)}}function G1(e){let t,n;const r=()=>t&&t();return function(o,a){switch(o){case Et:return a?n===a?void 0:(r(),n=a,t=Se(e,a),t):(r(),Wt);case nn:r(),n=null;return;default:throw new Error("unrecognized action ".concat(o))}}}function ot(e){return ar(ge(),t=>q(e,t))}function Ge(e,t){return ar(D(t),n=>q(e,n))}function q1(...e){return t=>e.reduceRight(B1,t)}function _(e,...t){const n=q1(...t);return(r,o)=>{switch(r){case Et:return Se(e,n(o));case nn:ra(e);return}}}function Ji(e,t){return e===t}function Ie(e=Ji){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ee(e){return t=>n=>{e(n)&&t(n)}}function z(e){return t=>Ki(t,e)}function gt(e){return t=>()=>t(e)}function vt(e,t){return n=>r=>n(t=e(t,r))}function Xt(e){return t=>n=>{e>0?e--:t(n)}}function Mt(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Ya(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function he(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((a,s)=>{const c=Math.pow(2,s);Se(a,l=>{const u=n;n=n|c,t[s]=l,u!==o&&n===o&&r&&(r(),r=null)})}),a=>s=>{const c=()=>a([s].concat(t));n===o?c():r=c}}function Ra(...e){return function(t,n){switch(t){case Et:return V1(...e.map(r=>Se(r,n)));case nn:return;default:throw new Error("unrecognized action ".concat(t))}}}function ne(e,t=Ji){return _(e,Ie(t))}function Oe(...e){const t=ge(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((a,s)=>{const c=Math.pow(2,s);Se(a,l=>
1{n[s]=l,r=r|c,r===o&&ce(t,n)})}),function(a,s){switch(a){case Et:return r===o&&s(n),Se(t,s);case nn:return ra(t);default:throw new Error("unrecognized action ".concat(a))}}}function ke(e,t=[],{singleton:n}={singleton:!0}){return{id:U1(),constructor:e,dependencies:t,singleton:n}}const U1=()=>Symbol();function Z1(e){const t=new Map,n=({id:r,constructor:o,dependencies:a,singleton:s})=>{if(s&&t.has(r))return t.get(r);const c=o(a.map(l=>n(l)));return s&&t.set(r,c),c};return n(e)}function K1(e,t){const n={},r={};let o=0;const a=e.length;for(;o<a;)r[e[o]]=1,o+=1;for(const s in t)r.hasOwnProperty(s)||(n[s]=t[s]);return n}const jn=typeof document<"u"?N.useLayoutEffect:N.useEffect;function Qi(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),s=Object.keys(t.events||{}),c=N.createContext({});function l(m,d){m.propsReady&&ce(m.propsReady,!1);for(const g of r){const w=m[t.required[g]];ce(w,d[g])}for(const g of o)if(g in d){const w=m[t.optional[g]];ce(w,d[g])}m.propsReady&&ce(m.propsReady,!0)}function u(m){return a.reduce((d,g)=>(d[g]=w=>{const v=m[t.methods[g]];ce(v,w)},d),{})}function h(m){return s.reduce((d,g)=>(d[g]=G1(m[t.events[g]]),d),{})}const p=N.forwardRef((m,d)=>{const{children:g,...w}=m,[v]=N.useState(()=>ar(Z1(e),b=>l(b,w))),[x]=N.useState(Ea(h,v));return jn(()=>{for(const b of s)b in w&&Se(x[b],w[b]);return()=>{Object.values(x).map(ra)}},[w,x,v]),jn(()=>{l(v,w)}),N.useImperativeHandle(d,La(u(v))),N.createElement(c.Provider,{value:v},n?N.createElement(n,K1([...r,...o,...s],w),g):g)}),f=m=>N.useCallback(Xi(ce,N.useContext(c)[m]),[m]),k=m=>{const g=N.useContext(c)[m],w=N.useCallback(v=>Se(g,v),[g]);return N.useSyncExternalStore(w,()=>Ve(g),()=>Ve(g))},S=m=>{const g=N.useContext(c)[m],[w,v]=N.useState(Ea(Ve,g));return jn(()=>Se(g,x=>{x!==w&&v(La(x))}),[g,w]),w},C=N.version.startsWith("18")?k:S;return{Component:p,usePublisher:f,useEmitterValue:C,useEmitter:(m,d)=>{const w=N.useContext(c)[m];jn(()=>Se(w,d),[d,w])}}}const X1=typeof document<"u"?N.useLayoutEffect:N.useEffect,J1=X1;var at=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(at||{});const Q1={0:"debug",1:"log",2:"warn",3:"error"},e0=()=>typeof globalThis>"u"?window:globalThis,Lt=ke(()=>{const e=D(3);return{log:D((n,r,o=1)=>{var a;const s=(a=e0().VIRTUOSO_LOG_LEVEL)!=null?a:Ve(e);o>=s&&console[Q1[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function oa(e,t,n){const r=N.useRef(null);let o=a=>{};if(typeof ResizeObserver<"u"){const a=N.useMemo(()=>new ResizeObserver(s=>{const c=()=>{const l=s[0].target;l.offsetParent!==null&&e(l)};n?c():requestAnimationFrame(c)}),[e]);o=s=>{s&&t?(a.observe(s),r.current=s):(r.current&&a.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:o}}function Ht(e,t,n){return oa(e,t,n).callbackRef}function t0(e,t,n,r,o,a,s,c,l){const u=N.useCallback(h=>{const p=n0(h.children,t,c?"offsetWidth":"offsetHeight",o);let f=h.parentElement;for(;!f.dataset.virtuosoScroller;)f=f.parentElement;const k=f.lastElementChild.dataset.viewportType==="window",S=s?c?s.scrollLeft:s.scrollTop:k?c?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:c?f.scrollLeft:f.scrollTop,C=s?c?s.scrollWidth:s.scrollHeight:k?c?document.documentElement.scrollWidth:document.documentElement.scrollHeight:c?f.scrollWidth:f.scrollHeight,y=s?c?s.offsetWidth:s.offsetHeight:k?c?window.innerWidth:window.innerHeight:c?f.offsetWidth:f.offsetHeight;r({scrollTop:Math.max(S,0),scrollHeight:C,viewportHeight:y}),a==null||a(c?Pa("column-gap",getComputedStyle(h).columnGap,o):Pa("row-gap",getComputedStyle(h).rowGap,o)),p!==null&&e(p)},[e,t,o,a,s,r]);return oa(u,n,l)}function n0(e,t,n,r){const o=e.length;if(o===0)return null;const a=[];for(let s=0;s<o;s++){const c=e.item(s);if(!c||c.dataset.index===void 0)continue;const l=parseInt(c.dataset.index),u=parseFloat(c.dataset.knownSize),h=t(c,n);if(h===0&&r("Zero-sized element, this should not happen",{child:c},at.ERROR),h===u)continue;const p=a[a.length-1];a.length===0||p.size!==h||p.endIndex!==l-1?a.push({startIndex:l,endIndex:l,size:h}):a[a.length-1].endIndex++}return a}function Pa(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n("".concat(e," was not resolved to pixel value correctly"),t,at.WARN),t==="normal"?0:parseInt(t!=null?t:"0",10)}function Ft(e,t){return Math.round(e.getBoundingClientRect()[t])}function ec(e,t){return Math.abs(e-t)<1.01}function tc(e,t,n,r=Wt,o,a){const s=N.useRef(null),c=N.useRef(null),l=N.useRef(null),u=N.useCallback(f=>{const k=f.target,S=k===window||k===document,C=a?S?window.pageXOffset||document.documentElement.scrollLeft:k.scrollLeft:S?window.pageYOffset||document.documentElement.scrollTop:k.scrollTop,y=a?S?document.documentElement.scrollWidth:k.scrollWidth:S?document.documentElement.scrollHeight:k.scrollHeight,m=a?S?window.innerWidth:k.offsetWidth:S?window.innerHeight:k.offsetHeight,d=()=>
1{e({scrollTop:Math.max(C,0),scrollHeight:y,viewportHeight:m})};f.suppressFlushSync?d():ul.flushSync(d),c.current!==null&&(C===c.current||C<=0||C===y-m)&&(c.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);N.useEffect(()=>{const f=o||s.current;return r(o||s.current),u({target:f,suppressFlushSync:!0}),f.addEventListener("scroll",u,{passive:!0}),()=>{r(null),f.removeEventListener("scroll",u)}},[s,u,n,r,o]);function h(f){const k=s.current;if(!k||(a?"offsetWidth"in k&&k.offsetWidth===0:"offsetHeight"in k&&k.offsetHeight===0))return;const S=f.behavior==="smooth";let C,y,m;k===window?(y=Math.max(Ft(document.documentElement,a?"width":"height"),a?document.documentElement.scrollWidth:document.documentElement.scrollHeight),C=a?window.innerWidth:window.innerHeight,m=a?document.documentElement.scrollLeft:document.documentElement.scrollTop):(y=k[a?"scrollWidth":"scrollHeight"],C=Ft(k,a?"width":"height"),m=k[a?"scrollLeft":"scrollTop"]);const d=y-C;if(f.top=Math.ceil(Math.max(Math.min(d,f.top),0)),ec(C,y)||f.top===m){e({scrollTop:m,scrollHeight:y,viewportHeight:C}),S&&t(!0);return}S?(c.current=f.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,c.current=null,t(!0)},1e3)):c.current=null,a&&(f={left:f.top,behavior:f.behavior}),k.scrollTo(f)}function p(f){a&&(f={left:f.top,behavior:f.behavior}),s.current.scrollBy(f)}return{scrollerRef:s,scrollByCallback:p,scrollToCallback:h}}const Je=ke(()=>{const e=ge(),t=ge(),n=D(0),r=ge(),o=D(0),a=ge(),s=ge(),c=D(0),l=D(0),u=D(0),h=D(0),p=ge(),f=ge(),k=D(!1),S=D(!1),C=D(!1);return q(_(e,z(({scrollTop:y})=>y)),t),q(_(e,z(({scrollHeight:y})=>y)),s),q(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:a,headerHeight:c,fixedHeaderHeight:l,fixedFooterHeight:u,footerHeight:h,scrollHeight:s,smoothScrollTargetReached:r,horizontalDirection:S,skipAnimationFrameInResizeObserver:C,scrollTo:p,scrollBy:f,statefulScrollTop:o,deviation:n,scrollingInProgress:k}},[],{singleton:!0}),hn={lvl:0};function nc(e,t,n,r=hn,o=hn){return{k:e,v:t,lvl:n,l:r,r:o}}function Te(e){return e===hn}function Ut(){return hn}function Fo(e,t){if(Te(e))return hn;const{k:n,l:r,r:o}=e;if(t===n){if(Te(r))return o;if(Te(o))return r;{const[a,s]=rc(r);return Ln(Ye(e,{k:a,v:s,l:oc(r)}))}}else return t<n?Ln(Ye(e,{l:Fo(r,t)})):Ln(Ye(e,{r:Fo(o,t)}))}function fn(e,t){if(!Te(e))return t===e.k?e.v:t<e.k?fn(e.l,t):fn(e.r,t)}function ft(e,t,n="k"){if(Te(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=ft(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return ft(e.l,t,n)}function rt(e,t,n){return Te(e)?nc(t,n,1):t===e.k?Ye(e,{k:t,v:n}):t<e.k?Oa(Ye(e,{l:rt(e.l,t,n)})):Oa(Ye(e,{r:rt(e.r,t,n)}))}function Do(e,t,n){if(Te(e))return[];const{k:r,v:o,l:a,r:s}=e;let c=[];return r>t&&(c=c.concat(Do(a,t,n))),r>=t&&r<=n&&c.push({k:r,v:o}),r<=n&&(c=c.concat(Do(s,t,n))),c}function Ot(e){return Te(e)?[]:[...Ot(e.l),{k:e.k,v:e.v},...Ot(e.r)]}function rc(e){return Te(e.r)?[e.k,e.v]:rc(e.r)}function oc(e){return Te(e.r)?e.l:Ln(Ye(e,{r:oc(e.r)}))}function Ye(e,t){return nc(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function xr(e){return Te(e)||e.lvl>e.r.lvl}function Oa(e){return Eo(sc(e))}function Ln(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(xr(t))return sc(Ye(e,{lvl:r-1}));if(!Te(t)&&!Te(t.r))return Ye(t.r,{l:Ye(t,{r:t.r.l}),r:Ye(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(xr(e))return Eo(Ye(e,{lvl:r-1}));if(!Te(n)&&!Te(n.l)){const o=n.l,a=xr(o)?n.lvl-1:n.lvl;return Ye(o,{l:Ye(e,{r:o.l,lvl:r-1}),r:Eo(Ye(n,{l:o.r,lvl:a})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function sr(e,t,n){if(Te(e))return[];const r=ft(e,t)[0];return r0(Do(e,r,n))}function ac(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const a=[];for(let s=1;s<n;s++){const{index:c,value:l}=t(e[s]);a.push({start:r,end:c-1,value:o}),r=c,o=l}return a.push({start:r,end:1/0,value:o}),a}function r0(e){return ac(e,({k:t,v:n})=>({index:t,value:n}))}function Eo(e){const{r:t,lvl:n}=e;return!Te(t)&&!Te(t.r)&&t.lvl===n&&t.r.lvl===n?Ye(t,{l:Ye(e,{r:t.l}),lvl:n+1}):e}function sc(e){const{l:t}=e;return!Te(t)&&t.lvl===e.lvl?Ye(t,{r:Ye(e,{l:t.r})}):e}function Wn(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const a=Math.floor((r+o)/2),s=e[a],c=n(s,t);if(c===0)return a;
1if(c===-1){if(o-r<2)return a-1;o=a-1}else{if(o===r)return a;r=a+1}}throw new Error("Failed binary finding record in array - ".concat(e.join(","),", searched for ").concat(t))}function ic(e,t,n){return e[Wn(e,t,n)]}function o0(e,t,n,r){const o=Wn(e,t,r),a=Wn(e,n,r,o);return e.slice(o,a+1)}const aa=ke(()=>({recalcInProgress:D(!1)}),[],{singleton:!0});function a0(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function za(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function s0(e,t){let n=Te(e)?0:1/0;for(const r of t){const{size:o,startIndex:a,endIndex:s}=r;if(n=Math.min(n,a),Te(e)){e=rt(e,0,o);continue}const c=sr(e,a-1,s+1);if(c.some(a0(r)))continue;let l=!1,u=!1;for(const{start:h,end:p,value:f}of c)l?(s>=h||o===f)&&(e=Fo(e,h)):(u=f!==o,l=!0),p>s&&s>=h&&f!==o&&(e=rt(e,s+1,f));u&&(e=rt(e,a,o))}return[e,n]}function i0(){return{offsetTree:[],sizeTree:Ut(),groupOffsetTree:Ut(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function sa({index:e},t){return t===e?0:t<e?-1:1}function c0({offset:e},t){return t===e?0:t<e?-1:1}function l0(e){return{index:e.index,value:e}}function u0(e,t,n,r=0){return r>0&&(t=Math.max(t,ic(e,r,sa).offset)),ac(o0(e,t,n,c0),l0)}function Lo(e,t,n,r){let o=e,a=0,s=0,c=0,l=0;if(t!==0){l=Wn(o,t-1,sa),c=o[l].offset;const h=ft(n,t-1);a=h[0],s=h[1],o.length&&o[l].size===ft(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:u,value:h}of sr(n,t,1/0)){const p=u-a,f=p*s+c+p*r;o.push({offset:f,size:h,index:u}),a=u,c=f,s=h}return{offsetTree:o,lastIndex:a,lastOffset:c,lastSize:s}}function d0(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,at.DEBUG);const a=e.sizeTree;let s=a,c=0;if(n.length>0&&Te(a)&&t.length===2){const f=t[0].size,k=t[1].size;s=n.reduce((S,C)=>rt(rt(S,C,f),C+1,k),s)}else[s,c]=s0(s,t);if(s===a)return e;const{offsetTree:l,lastIndex:u,lastSize:h,lastOffset:p}=Lo(e.offsetTree,c,s,o);return{sizeTree:s,offsetTree:l,lastIndex:u,lastOffset:p,lastSize:h,groupOffsetTree:n.reduce((f,k)=>rt(f,k,pn(k,l,o)),Ut()),groupIndices:n}}function pn(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:a}=ic(t,e,sa),s=e-o,c=a*s+(s-1)*n+r;return c>0?c+n:c}function h0(e){return typeof e.groupIndex<"u"}function cc(e,t,n){if(h0(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=lc(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function lc(e,t){if(!ir(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function ir(e){return!Te(e.groupOffsetTree)}function f0(e){return Ot(e).map(({k:t,v:n},r,o)=>{const a=o[r+1],s=a?a.k-1:1/0;return{startIndex:t,endIndex:s,size:n}})}const p0={offsetHeight:"height",offsetWidth:"width"},Ct=ke(([{log:e},{recalcInProgress:t}])=>{const n=ge(),r=ge(),o=Ge(r,0),a=ge(),s=ge(),c=D(0),l=D([]),u=D(void 0),h=D(void 0),p=D((v,x)=>Ft(v,p0[x])),f=D(void 0),k=D(0),S=i0(),C=Ge(_(n,he(l,e,k),vt(d0,S),Ie()),S),y=Ge(_(l,Ie(),vt((v,x)=>({prev:v.current,current:x}),{prev:[],current:[]}),z(({prev:v})=>v)),[]);q(_(l,ee(v=>v.length>0),he(C,k),z(([v,x,b])=>{const A=v.reduce((T,I,M)=>rt(T,I,pn(I,x.offsetTree,b)||M),Ut());return{...x,groupIndices:v,groupOffsetTree:A}})),C),q(_(r,he(C),ee(([v,{lastIndex:x}])=>v<x),z(([v,{lastIndex:x,lastSize:b}])=>[{startIndex:v,endIndex:x,size:b}])),n),q(u,h);const m=Ge(_(u,z(v=>v===void 0)),!0);q(_(h,ee(v=>v!==void 0&&Te(Ve(C).sizeTree)),z(v=>[{startIndex:0,endIndex:0,size:v}])),n);const d=ot(_(n,he(C),vt(({sizes:v},[x,b])=>({changed:b!==v,sizes:b}),{changed:!1,sizes:S}),z(v=>v.changed)));Se(_(c,vt((v,x)=>({diff:v.prev-x,prev:x}),{diff:0,prev:0}),z(v=>v.diff)),v=>{const{groupIndices:x}=Ve(C);if(v>0)ce(t,!0),ce(a,v+za(v,x));else if(v<0){const b=Ve(y);b.length>0&&(v-=za(-v,b)),ce(s,v)}}),Se(_(c,he(e)),([v,x])=>{v<0&&x("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},at.ERROR)});const g=ot(a);q(_(a,he(C),z(([v,x])=>{const b=x.groupIndices.length>0,A=[],T=x.lastSize;if(b){const I=fn(x.sizeTree,0);let M=0,F=0;for(;M<v;){const E=x.groupIndices[F],H=x.groupIndices.length===F+1?1/0:x.groupIndices[F+1]-E-1;A.push({startIndex:E,endIndex:E,size:I}),A.push({startIndex:E+1,endIndex:E+1+H-1,size:T}),F++,M+=H+1}const P=Ot(x.sizeTree);return M!==v&&P.shift(),P.reduce((E,{k:H,v:te})=>{let me=E.ranges;return E.prevSize!==0&&(me=[...E.ranges,{startIndex:E.prevIndex,endIndex:H+v-1,size:E.prevSize}]),{ranges:me,prevIndex:H+v,prevSize:te}},{ranges:A,prevIndex:v,prevSize:0}).ranges}return Ot(x.sizeTree).reduce((I,{k:M,v:F})=>({ranges:[...I.ranges,{startIndex:I.prevIndex,endIndex:M+v-1,size:I.prevSize}],prevIndex:M+v,prevSize:F}),{ranges:[],prevIndex:0,prevSize:T}).ranges})),n);const w=ot(_(s,he(C,k),z(([v,{offsetTree:x},b])=>{const A=-v;return pn(A,x,b)})));return q(_(s,he(C,k),z(([v,x,b])=>
1{if(x.groupIndices.length>0){if(Te(x.sizeTree))return x;let T=Ut();const I=Ve(y);let M=0,F=0,P=0;for(;M<-v;){P=I[F];const E=I[F+1]-P-1;F++,M+=E+1}if(T=Ot(x.sizeTree).reduce((E,{k:H,v:te})=>rt(E,Math.max(0,H+v),te),T),M!==-v){const E=fn(x.sizeTree,P);T=rt(T,0,E);const H=ft(x.sizeTree,-v+1)[1];T=rt(T,1,H)}return{...x,sizeTree:T,...Lo(x.offsetTree,0,T,b)}}else{const T=Ot(x.sizeTree).reduce((I,{k:M,v:F})=>rt(I,Math.max(0,M+v),F),Ut());return{...x,sizeTree:T,...Lo(x.offsetTree,0,T,b)}}})),C),{data:f,totalCount:r,sizeRanges:n,groupIndices:l,defaultItemSize:h,fixedItemSize:u,unshiftWith:a,shiftWith:s,shiftWithOffset:w,beforeUnshiftWith:g,firstItemIndex:c,gap:k,sizes:C,listRefresh:d,statefulTotalCount:o,trackItemSizes:m,itemSize:p}},Me(Lt,aa),{singleton:!0}),m0=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function uc(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!m0)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const xn=ke(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:a,scrollTo:s,smoothScrollTargetReached:c,headerHeight:l,footerHeight:u,fixedHeaderHeight:h,fixedFooterHeight:p},{log:f}])=>{const k=ge(),S=ge(),C=D(0);let y=null,m=null,d=null;function g(){y&&(y(),y=null),d&&(d(),d=null),m&&(clearTimeout(m),m=null),ce(o,!1)}return q(_(k,he(e,a,t,C,l,u,f),he(r,h,p),z(([[w,v,x,b,A,T,I,M],F,P,B])=>{const E=uc(w),{align:H,behavior:te,offset:me}=E,fe=b-1,Q=cc(E,v,fe);let le=pn(Q,v.offsetTree,F)+T;H==="end"?(le+=P+ft(v.sizeTree,Q)[1]-x+B,Q===fe&&(le+=I)):H==="center"?le+=(P+ft(v.sizeTree,Q)[1]-x+B)/2:le-=A,me&&(le+=me);const we=ue=>{g(),ue?(M("retrying to scroll to",{location:w},at.DEBUG),ce(k,w)):(ce(S,!0),M("list did not change, scroll successful",{},at.DEBUG))};if(g(),te==="smooth"){let ue=!1;d=Se(n,oe=>{ue=ue||oe}),y=yt(c,()=>{we(ue)})}else y=yt(_(n,g0(150)),we);return m=setTimeout(()=>{g()},1200),ce(o,!0),M("scrolling from index to",{index:Q,top:le,behavior:te},at.DEBUG),{top:le,behavior:te}})),s),{scrollToIndex:k,scrollTargetReached:S,topListHeight:C}},Me(Ct,Je,Lt),{singleton:!0});function g0(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const mn="up",sn="down",w0="none",v0={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},x0=0,yn=ke(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:a}])=>{const s=D(!1),c=D(!0),l=ge(),u=ge(),h=D(4),p=D(x0),f=Ge(_(Ra(_(ne(t),Xt(1),gt(!0)),_(ne(t),Xt(1),gt(!1),Ya(100))),Ie()),!1),k=Ge(_(Ra(_(a,gt(!0)),_(a,gt(!1),Ya(200))),Ie()),!1);q(_(Oe(ne(t),ne(p)),z(([d,g])=>d<=g),Ie()),c),q(_(c,Mt(50)),u);const S=ot(_(Oe(e,ne(n),ne(r),ne(o),ne(h)),vt((d,[{scrollTop:g,scrollHeight:w},v,x,b,A])=>{const T=g+v-w>-A,I={viewportHeight:v,scrollTop:g,scrollHeight:w};if(T){let F,P;return g>d.state.scrollTop?(F="SCROLLED_DOWN",P=d.state.scrollTop-g):(F="SIZE_DECREASED",P=d.state.scrollTop-g||d.scrollTopDelta),{atBottom:!0,state:I,atBottomBecause:F,scrollTopDelta:P}}let M;return I.scrollHeight>d.state.scrollHeight?M="SIZE_INCREASED":v<d.state.viewportHeight?M="VIEWPORT_HEIGHT_DECREASING":g<d.state.scrollTop?M="SCROLLING_UPWARDS":M="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:M,state:I}},v0),Ie((d,g)=>d&&d.atBottom===g.atBottom))),C=Ge(_(e,vt((d,{scrollTop:g,scrollHeight:w,viewportHeight:v})=>{if(ec(d.scrollHeight,w))return{scrollTop:g,scrollHeight:w,jump:0,changed:!1};{const x=w-(g+v)<1;return d.scrollTop!==g&&x?{scrollHeight:w,scrollTop:g,jump:d.scrollTop-g,changed:!0}:{scrollHeight:w,scrollTop:g,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),ee(d=>d.changed),z(d=>d.jump)),0);q(_(S,z(d=>d.atBottom)),s),q(_(s,Mt(50)),l);const y=D(sn);q(_(e,z(({scrollTop:d})=>d),Ie(),vt((d,g)=>Ve(k)?{direction:d.direction,prevScrollTop:g}:{direction:g<d.prevScrollTop?mn:sn,prevScrollTop:g},{direction:sn,prevScrollTop:0}),z(d=>d.direction)),y),q(_(e,Mt(50),gt(w0)),y);const m=D(0);return q(_(f,ee(d=>!d),gt(0)),m),q(_(t,Mt(100),he(f),ee(([d,g])=>!!g),vt(([d,g],[w])=>[g,w],[0,0]),z(([d,g])=>g-d)),m),{isScrolling:f,isAtTop:c,isAtBottom:s,atBottomState:S,atTopStateChange:u,atBottomStateChange:l,scrollDirection:y,atBottomThreshold:h,atTopThreshold:p,scrollVelocity:m,lastJumpDueToItemResize:C}},Me(Je)),Yt=ke(([{log:e}])=>{const t=D(!1),n=ot(_(t,ee(r=>r),Ie()));return Se(t,r=>{r&&Ve(e)("props updated",{},at.DEBUG)}),{propsReady:t,didMount:n}},Me(Lt),{singleton:!0});function ia(e,t){e==0?t():requestAnimationFrame(()=>ia(e-1,t))}function ca(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const kn=ke(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o,scrollTargetReached:a},{didMount:s}])=>{const c=D(!0),l=D(0),u=D(!0);return q(_(s,he(l),ee(([h,p])=>!!p),gt(!1)),c),q(_(s,he(l),ee(([h,p])=>!!p),gt(!1)),u),Se(_(Oe(t,s),he(c,e,n,u),ee(([[,h],p,{sizeTree:f},k,S])=>h&&(!Te(f)||na(k))&&!p&&!S),he(l)),([,h])=>{yt(a,()=>{ce(u,!0)}),ia(4,()=>{yt(r,()=>{ce(c,!0)}),ce(o,h)})}
1),{scrolledToInitialItem:c,initialTopMostItemIndex:l,initialItemFinalLocationReached:u}},Me(Ct,Je,xn,Yt),{singleton:!0});function Wa(e){return e?e==="smooth"?"smooth":"auto":!1}const y0=(e,t)=>typeof e=="function"?Wa(e(t)):t&&Wa(e),k0=ke(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:a},{propsReady:s,didMount:c},{log:l},{scrollingInProgress:u}])=>{const h=D(!1),p=ge();let f=null;function k(C){ce(o,{index:"LAST",align:"end",behavior:C})}Se(_(Oe(_(ne(e),Xt(1)),c),he(ne(h),n,a,u),z(([[C,y],m,d,g,w])=>{let v=y&&g,x="auto";return v&&(x=y0(m,d||w),v=v&&!!x),{totalCount:C,shouldFollow:v,followOutputBehavior:x}}),ee(({shouldFollow:C})=>C)),({totalCount:C,followOutputBehavior:y})=>{f&&(f(),f=null),f=yt(t,()=>{Ve(l)("following output to ",{totalCount:C},at.DEBUG),k(y),f=null})});function S(C){const y=yt(r,m=>{C&&!m.atBottom&&m.notAtBottomBecause==="SIZE_INCREASED"&&!f&&(Ve(l)("scrolling to bottom due to increased size",{},at.DEBUG),k("auto"))});setTimeout(y,100)}return Se(_(Oe(ne(h),e,s),ee(([C,,y])=>C&&y),vt(({value:C},[,y])=>({refreshed:C===y,value:y}),{refreshed:!1,value:0}),ee(({refreshed:C})=>C),he(h,e)),([,C])=>{Ve(a)&&S(C!==!1)}),Se(p,()=>{S(Ve(h)!==!1)}),Se(Oe(ne(h),r),([C,y])=>{C&&!y.atBottom&&y.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&k("auto")}),{followOutput:h,autoscrollToBottom:p}},Me(Ct,yn,xn,kn,Yt,Lt,Je));function C0(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const dc=ke(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const a=ge(),s=ge(),c=ot(_(a,z(C0)));return q(_(c,z(l=>l.totalCount)),e),q(_(c,z(l=>l.groupIndices)),t),q(_(Oe(r,n,o),ee(([l,u])=>ir(u)),z(([l,u,h])=>ft(u.groupOffsetTree,Math.max(l-h,0),"v")[0]),Ie(),z(l=>[l])),s),{groupCounts:a,topItemsIndexes:s}},Me(Ct,Je));function gn(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function hc(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Hn="top",Bn="bottom",Ha="none";function Ba(e,t,n){return typeof e=="number"?n===mn&&t===Hn||n===sn&&t===Bn?e:0:n===mn?t===Hn?e.main:e.reverse:t===Bn?e.main:e.reverse}function $a(e,t){return typeof e=="number"?e:e[t]||0}const la=ke(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const a=ge(),s=D(0),c=D(0),l=D(0),u=Ge(_(Oe(ne(e),ne(t),ne(r),ne(a,gn),ne(l),ne(s),ne(o),ne(n),ne(c)),z(([h,p,f,[k,S],C,y,m,d,g])=>{const w=h-d,v=y+m,x=Math.max(f-w,0);let b=Ha;const A=$a(g,Hn),T=$a(g,Bn);return k-=d,k+=f+m,S+=f+m,S-=d,k>h+v-A&&(b=mn),S<h-x+p+T&&(b=sn),b!==Ha?[Math.max(w-f-Ba(C,Hn,b)-A,0),w-x-m+p+Ba(C,Bn,b)+T]:null}),ee(h=>h!=null),Ie(gn)),[0,0]);return{listBoundary:a,overscan:l,topListHeight:s,increaseViewportBy:c,visibleRange:u}},Me(Je),{singleton:!0});function S0(e,t,n){if(ir(t)){const r=lc(e,t);return[{index:ft(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const yr={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Va(e,t,n){if(e.length===0)return[];if(!ir(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const r=e[0].index,o=e[e.length-1].index,a=[],s=sr(t.groupOffsetTree,r,o);let c,l=0;for(const u of e){(!c||c.end<u.index)&&(c=s.shift(),l=t.groupIndices.indexOf(c.start));let h;u.index===c.start?h={type:"group",index:l}:h={index:u.index-(l+1)+n,groupIndex:l},a.push({...h,size:u.size,offset:u.offset,originalIndex:u.index,data:u.data})}return a}function Yn(e,t,n,r,o,a){const{lastSize:s,lastOffset:c,lastIndex:l}=o;let u=0,h=0;if(e.length>0){u=e[0].offset;const C=e[e.length-1];h=C.offset+C.size}const p=n-l,f=c+p*s+(p-1)*r,k=u,S=f-h;return{items:Va(e,o,a),topItems:Va(t,o,a),topListHeight:t.reduce((C,y)=>y.size+C,0),offsetTop:u,offsetBottom:S,top:k,bottom:h,totalCount:n,firstItemIndex:a}}function fc(e,t,n,r,o,a){let s=0;if(n.groupIndices.length>0)for(const h of n.groupIndices){if(h-s>=e)break;s++}const c=e+s,l=ca(t,c),u=Array.from({length:c}).map((h,p)=>({index:p+l,size:0,offset:0,data:a[p+l]}));return Yn(u,[],c,o,n,r)}const Bt=ke(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},a,{visibleRange:s,listBoundary:c,topListHeight:l}
1,{scrolledToInitialItem:u,initialTopMostItemIndex:h},{topListHeight:p},f,{didMount:k},{recalcInProgress:S}])=>{const C=D([]),y=D(0),m=ge();q(a.topItemsIndexes,C);const d=Ge(_(Oe(k,S,ne(s,gn),ne(t),ne(e),ne(h),u,ne(C),ne(r),ne(o),n),ee(([x,b,,A,,,,,,,T])=>{const I=T&&T.length!==A;return x&&!b&&!I}),z(([,,[x,b],A,T,I,M,F,P,B,E])=>{const H=T,{sizeTree:te,offsetTree:me}=H,fe=Ve(y);if(A===0)return{...yr,totalCount:A};if(x===0&&b===0)return fe===0?{...yr,totalCount:A}:fc(fe,I,T,P,B,E||[]);if(Te(te))return fe>0?null:Yn(S0(ca(I,A),H,E),[],A,B,H,P);const Q=[];if(F.length>0){const Ce=F[0],G=F[F.length-1];let j=0;for(const L of sr(te,Ce,G)){const V=L.value,U=Math.max(L.start,Ce),ye=Math.min(L.end,G);for(let O=U;O<=ye;O++)Q.push({index:O,size:V,offset:j,data:E&&E[O]}),j+=V}}if(!M)return Yn([],Q,A,B,H,P);const le=F.length>0?F[F.length-1]+1:0,we=u0(me,x,b,le);if(we.length===0)return null;const ue=A-1,oe=ar([],Ce=>{for(const G of we){const j=G.value;let L=j.offset,V=G.start;const U=j.size;if(j.offset<x){V+=Math.floor((x-j.offset+B)/(U+B));const O=V-G.start;L+=O*U+O*B}V<le&&(L+=(le-V)*U,V=le);const ye=Math.min(G.end,ue);for(let O=V;O<=ye&&!(L>=b);O++)Ce.push({index:O,size:U,offset:L,data:E&&E[O]}),L+=U+B}});return Yn(oe,Q,A,B,H,P)}),ee(x=>x!==null),Ie()),yr);q(_(n,ee(na),z(x=>x==null?void 0:x.length)),t),q(_(d,z(x=>x.topListHeight)),p),q(p,l),q(_(d,z(x=>[x.top,x.bottom])),c),q(_(d,z(x=>x.items)),m);const g=ot(_(d,ee(({items:x})=>x.length>0),he(t,n),ee(([{items:x},b])=>x[x.length-1].originalIndex===b-1),z(([,x,b])=>[x-1,b]),Ie(gn),z(([x])=>x))),w=ot(_(d,Mt(200),ee(({items:x,topItems:b})=>x.length>0&&x[0].originalIndex===b.length),z(({items:x})=>x[0].index),Ie())),v=ot(_(d,ee(({items:x})=>x.length>0),z(({items:x})=>{let b=0,A=x.length-1;for(;x[b].type==="group"&&b<A;)b++;for(;x[A].type==="group"&&A>b;)A--;return{startIndex:x[b].index,endIndex:x[A].index}}),Ie(hc)));return{listState:d,topItemsIndexes:C,endReached:g,startReached:w,rangeChanged:v,itemsRendered:m,initialItemCount:y,...f}},Me(Ct,dc,la,kn,xn,yn,Yt,aa),{singleton:!0}),b0=ke(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{initialItemCount:a,listState:s},{didMount:c}])=>(q(_(c,he(a),ee(([,l])=>l!==0),he(o,e,t,r,n),z(([[,l],u,h,p,f,k=[]])=>fc(l,u,h,p,f,k))),s),{}),Me(Ct,kn,Bt,Yt),{singleton:!0}),pc=ke(([{scrollVelocity:e}])=>{const t=D(!1),n=ge(),r=D(!1);return q(_(e,he(r,t,n),ee(([o,a])=>!!a),z(([o,a,s,c])=>{const{exit:l,enter:u}=a;if(s){if(l(o,c))return!1}else if(u(o,c))return!0;return s}),Ie()),t),Se(_(Oe(t,e,n),he(r)),([[o,a,s],c])=>o&&c&&c.change&&c.change(a,s)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Me(yn),{singleton:!0}),A0=ke(([{topItemsIndexes:e}])=>{const t=D(0);return q(_(t,ee(n=>n>0),z(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Me(Bt)),mc=ke(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const a=ge(),s=Ge(_(Oe(e,r,t,n,o),z(([c,l,u,h,p])=>c+l+u+h+p.offsetBottom+p.bottom)),0);return q(ne(s),a),{totalListHeight:s,totalListHeightChanged:a}},Me(Je,Bt),{singleton:!0});function gc(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const T0=gc(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),j0=ke(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:a,scrollDirection:s,lastJumpDueToItemResize:c},{listState:l},{beforeUnshiftWith:u,shiftWithOffset:h,sizes:p,gap:f},{log:k},{recalcInProgress:S}])=>{const C=ot(_(l,he(c),vt(([,m,d,g],[{items:w,totalCount:v,bottom:x,offsetBottom:b},A])=>{const T=x+b;let I=0;return d===v&&m.length>0&&w.length>0&&(w[0].originalIndex===0&&m[0].originalIndex===0||(I=T-g,I!==0&&(I+=A))),[I,w,v,T]},[0,[],0,0]),ee(([m])=>m!==0),he(t,s,r,a,k,S),ee(([,m,d,g,,,w])=>!w&&!g&&m!==0&&d===mn),z(([[m],,,,,d])=>(d("Upward scrolling compensation",{amount:m},at.DEBUG),m))));function y(m){m>0?(ce(e,{top:-m,behavior:"auto"}),ce(n,0)):(ce(n,0),ce(e,{top:-m,behavior:"auto"}))}return Se(_(C,he(n,o)),([m,d,g])=>{g&&T0()?ce(n,d-m):y(-m)}),Se(_(Oe(Ge(o,!1),n,S),ee(([m,d,g])=>!m&&!g&&d!==0),z(([m,d])=>d),Mt(1)),y),q(_(h,z(m=>({top:-m}))),e),Se(_(u,he(p,f),z(([m,{lastSize:d,groupIndices:g,sizeTree:w},v])=>{function x(b){return b*(d+v)}if(g.length===0)return x(m);{let b=0;const A=fn(w,0);let T=0,I=0;for(;T<m;){T++,b+=A;let M=g.length===I+1?1/0:g[I+1]-g[I]-1;T+M>m&&(b-=A,M=m-T+1),T+=M,b+=x(M),I++}return b}})),m=>{ce(n,m),requestAnimationFrame(()=>{ce(e,{top:m}),requestAnimationFrame(()=>{ce(n,0),ce(S,!1)})})}),{deviation:n}},Me(Je,yn,Bt,Ct,Lt,aa)),N0=ke(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=D(0);return Se(_(e,he(r),ee(([,o])=>o!==0),z(([,o])=>({top:o}))),o=>{yt(_(n,Xt(1),ee(a=>a.items.length>1)),()=>{requestAnimationFrame(()=>{ce(t,o)})})}),{initialScrollTop:r}},Me(Yt,Je,Bt),{singleton:!0}
1),I0=ke(([{viewportHeight:e},{totalListHeight:t}])=>{const n=D(!1),r=Ge(_(Oe(n,e,t),ee(([o])=>o),z(([,o,a])=>Math.max(0,o-a)),Mt(0),Ie()),0);return{alignToBottom:n,paddingTopAddition:r}},Me(Je,mc),{singleton:!0}),ua=ke(([{scrollTo:e,scrollContainerState:t}])=>{const n=ge(),r=ge(),o=ge(),a=D(!1),s=D(void 0);return q(_(Oe(n,r),z(([{viewportHeight:c,scrollTop:l,scrollHeight:u},{offsetTop:h}])=>({scrollTop:Math.max(0,l-h),scrollHeight:u,viewportHeight:c}))),t),q(_(e,he(r),z(([c,{offsetTop:l}])=>({...c,top:c.top+l}))),o),{useWindowScroll:a,customScrollParent:s,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Me(Je)),M0=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:a,...s}})=>e<n?{...s,behavior:o,align:a!=null?a:"start"}:t>r?{...s,behavior:o,align:a!=null?a:"end"}:null,_0=ke(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:a,fixedHeaderHeight:s,fixedFooterHeight:c,scrollingInProgress:l},{scrollToIndex:u}])=>{const h=ge();return q(_(h,he(e,o,t,a,s,c,r),he(n),z(([[p,f,k,S,C,y,m,d],g])=>{const{done:w,behavior:v,align:x,calculateViewLocation:b=M0,...A}=p,T=cc(p,f,S-1),I=pn(T,f.offsetTree,g)+C+y,M=I+ft(f.sizeTree,T)[1],F=d+y,P=d+k-m,B=b({itemTop:I,itemBottom:M,viewportTop:F,viewportBottom:P,locationParams:{behavior:v,align:x,...A}});return B?w&&yt(_(l,ee(E=>E===!1),Xt(Ve(l)?1:2)),w):w&&w(),B}),ee(p=>p!==null)),u),{scrollIntoView:h}},Me(Ct,Je,xn,Bt,Lt),{singleton:!0}),F0=ke(([{sizes:e,sizeRanges:t},{scrollTop:n,headerHeight:r},{initialTopMostItemIndex:o},{didMount:a},{useWindowScroll:s,windowScrollContainerState:c,windowViewportRect:l}])=>{const u=ge(),h=D(void 0),p=D(null),f=D(null);return q(c,p),q(l,f),Se(_(u,he(e,n,s,p,f,r)),([k,S,C,y,m,d,g])=>{const w=f0(S.sizeTree);y&&m!==null&&d!==null&&(C=m.scrollTop-d.offsetTop),C-=g,k({ranges:w,scrollTop:C})}),q(_(h,ee(na),z(D0)),o),q(_(a,he(h),ee(([,k])=>k!==void 0),Ie(),z(([,k])=>k.ranges)),t),{getState:u,restoreStateFrom:h}},Me(Ct,Je,kn,Yt,ua));function D0(e){return{offset:e.scrollTop,index:0,align:"start"}}const E0=ke(([e,t,n,r,o,a,s,c,l,u])=>({...e,...t,...n,...r,...o,...a,...s,...c,...l,...u}),Me(la,b0,Yt,pc,mc,N0,I0,ua,_0,Lt)),wc=ke(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:a,data:s,firstItemIndex:c,groupIndices:l,statefulTotalCount:u,gap:h,sizes:p},{initialTopMostItemIndex:f,scrolledToInitialItem:k,initialItemFinalLocationReached:S},C,y,m,{listState:d,topItemsIndexes:g,...w},{scrollToIndex:v},x,{topItemCount:b},{groupCounts:A},T])=>(q(w.rangeChanged,T.scrollSeekRangeChanged),q(_(T.windowViewportRect,z(I=>I.visibleHeight)),C.viewportHeight),{totalCount:e,data:s,firstItemIndex:c,sizeRanges:t,initialTopMostItemIndex:f,scrolledToInitialItem:k,initialItemFinalLocationReached:S,topItemsIndexes:g,topItemCount:b,groupCounts:A,fixedItemHeight:n,defaultItemHeight:r,gap:h,...m,statefulTotalCount:u,listState:d,scrollToIndex:v,trackItemSizes:o,itemSize:a,groupIndices:l,...w,...T,...C,sizes:p,...y}),Me(Ct,kn,Je,F0,k0,Bt,xn,j0,A0,dc,E0)),kr="-webkit-sticky",Ga="sticky",vc=gc(()=>{if(typeof document>"u")return Ga;const e=document.createElement("div");return e.style.position=kr,e.style.position===kr?kr:Ga});function xc(e,t,n){const r=N.useRef(null),o=N.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),h=u.width;let p,f;if(t){const k=t.getBoundingClientRect(),S=u.top-k.top;p=k.height-Math.max(0,S),f=S+t.scrollTop}else p=window.innerHeight-Math.max(0,u.top),f=u.top+window.pageYOffset;r.current={offsetTop:f,visibleHeight:p,visibleWidth:h},e(r.current)},[e,t]),{callbackRef:a,ref:s}=oa(o,!0,n),c=N.useCallback(()=>{o(s.current)},[o,s]);return N.useEffect(()=>{if(t){t.addEventListener("scroll",c);const l=new ResizeObserver(()=>{requestAnimationFrame(c)});return l.observe(t),()=>{t.removeEventListener("scroll",c),l.unobserve(t)}}else return window.addEventListener("scroll",c),window.addEventListener("resize",c),()=>{window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[c,t]),a}const yc=N.createContext(void 0),kc=N.createContext(void 0);function da(e){return e}const L0=ke(()=>{const e=D(l=>"Item ".concat(l)),t=D(null),n=D(l=>"Group ".concat(l)),r=D({}),o=D(da),a=D("div"),s=D(Wt),c=(l,u=null)=>Ge(_(r,z(h=>h[l]),Ie()),u);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:a,scrollerRef:s,FooterComponent:c("Footer"),HeaderComponent:c("Header"),TopItemListComponent:c("TopItemList"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),GroupComponent:c("Group","div"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder")}}),Y0=ke(([e,t])=>({...e,...t}),Me(wc,L0)),R0=({height:e})=>N.createElement("div",{style:{height:e}}),P0={position:vc(),zIndex:1,overflowAnchor:"none"},Cc={overflowAnchor:"none"},O0={...Cc,display:"inline-block",height:"100%"},qa=N.memo(function({showTopList:t=!1}){const n=ae("listState"),r=ct("sizeRanges"),o=ae("useWindowScroll"),a=ae("customScrollParent"),s=ct("windowScrollContainerState"),c=ct("scrollContainerState"),l=a||o?s:c,u=ae("itemContent"),h=ae("context"),p=ae("groupContent"),f=ae("trackItemSizes"),k=ae("itemSize"),S=ae("log"),C=ct("gap"),y=ae("horizontalDirection"),{callbackRef:m}=t0(r,k,f,t?Wt:l,S,C,a,y,ae("skipAnimationFrameInResizeObserver")),[d,g]=N.useState(0);ha("deviation",E=>{d!==E&&g(E)});const w=ae("EmptyPlaceholder"),v=ae("ScrollSeekPlaceholder")||R0,x=ae("ListComponent"),b=ae("ItemComponent"),A=ae("GroupComponent"),T=ae("computeItemKey"),I=ae("isSeeking"),M=ae("groupIndices").length>0,F=ae("alignToBottom"),P=ae("initialItemFinalLocationReached"),B=t?{}:{boxSizing:"border-box",...y?{whiteSpace:"nowrap",display:"inline-block",height:"100%",paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,marginLeft:d!==0?d:F?"auto":0}:{marginTop:d!==0?d:F?"auto":0,paddingTop:n.offsetTop,paddingBottom:n.offsetBottom},...P?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&w?N.createElement(w,Ze(w,h)):N.createElement(x,{...Ze(x,h),ref:m,style:B,"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(E=>{const H=E.originalIndex,te=T(H+n.firstItemIndex,E.data,h);return I?N.createElement(v,{...Ze(v,h),key:te,index:E.index,height:E.size,type:E.type||"item",...E.type==="group"?{}:{groupIndex:E.groupIndex}}):E.type==="group"?N.createElement(A,{...Ze(A,h),key:te,"data-index":H,"data-known-size":E.size,"data-item-index":E.index,style:P0},p(E.index,h)):N.createElement(b,{...Ze(b,h),...B0(b,E.data),key:te,"data-index":H,"data-known-size":E.size,"data-item-index":E.index,"data-item-group-index":E.groupIndex,style:y?O0:Cc},M?u(E.index,E.groupIndex,E.data,h):u(E.index,E.data,h))}))}),z0={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},W0={outline:"none",overflowX:"auto",position:"relative"},cr=e=>({width:"100%",height:"100%",position:"absolute",top:0,...e?{display:"flex",flexDirection:"column"}:{}}),H0={width:"100%",position:vc(),top:0,zIndex:1};function Ze(e,t){if(typeof e!="string")return{context:t}}function B0(e,t){return{item:typeof e=="string"?void 0:t}}const $0=N.memo(function(){const t=ae("HeaderComponent"),n=ct("headerHeight"),r=ae("headerFooterTag"),o=Ht(N.useMemo(()=>s=>n(Ft(s,"height")),[n]),!0,ae("skipAnimationFrameInResizeObserver")),a=ae("context");return t?N.createElement(r,{ref:o},N.createElement(t,Ze(t,a))):null}),V0=N.memo(function(){const t=ae("FooterComponent"),n=ct("footerHeight"),r=ae("headerFooterTag"),o=Ht(N.useMemo(()=>s=>n(Ft(s,"height")),[n]),!0,ae("skipAnimationFrameInResizeObserver")),a=ae("context");return t?N.createElement(r,{ref:o},N.createElement(t,Ze(t,a))):null});function Sc({usePublisher:e,useEmitter:t,useEmitterValue:n}){return N.memo(function({style:a,children:s,...c}){const l=e("scrollContainerState"),u=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),p=n("scrollerRef"),f=n("c
1ontext"),k=n("horizontalDirection")||!1,{scrollerRef:S,scrollByCallback:C,scrollToCallback:y}=tc(l,h,u,p,void 0,k);t("scrollTo",y),t("scrollBy",C);const m=k?W0:z0;return N.createElement(u,{ref:S,style:{...m,...a},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...c,...Ze(u,f)},s)})}function bc({usePublisher:e,useEmitter:t,useEmitterValue:n}){return N.memo(function({style:a,children:s,...c}){const l=e("windowScrollContainerState"),u=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),p=n("totalListHeight"),f=n("deviation"),k=n("customScrollParent"),S=n("context"),{scrollerRef:C,scrollByCallback:y,scrollToCallback:m}=tc(l,h,u,Wt,k);return J1(()=>(C.current=k||window,()=>{C.current=null}),[C,k]),t("windowScrollTo",m),t("scrollBy",y),N.createElement(u,{style:{position:"relative",...a,...p!==0?{height:p+f}:{}},"data-virtuoso-scroller":!0,...c,...Ze(u,S)},s)})}const G0=({children:e})=>{const t=N.useContext(yc),n=ct("viewportHeight"),r=ct("fixedItemHeight"),o=ae("alignToBottom"),a=ae("horizontalDirection"),s=N.useMemo(()=>Ki(n,l=>Ft(l,a?"width":"height")),[n,a]),c=Ht(s,!0,ae("skipAnimationFrameInResizeObserver"));return N.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),N.createElement("div",{style:cr(o),ref:c,"data-viewport-type":"element"},e)},q0=({children:e})=>{const t=N.useContext(yc),n=ct("windowViewportRect"),r=ct("fixedItemHeight"),o=ae("customScrollParent"),a=xc(n,o,ae("skipAnimationFrameInResizeObserver")),s=ae("alignToBottom");return N.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),N.createElement("div",{ref:a,style:cr(s),"data-viewport-type":"window"},e)},U0=({children:e})=>{const t=ae("TopItemListComponent")||"div",n=ae("headerHeight"),r={...H0,marginTop:"".concat(n,"px")},o=ae("context");return N.createElement(t,{style:r,...Ze(t,o)},e)},Z0=N.memo(function(t){const n=ae("useWindowScroll"),r=ae("topItemsIndexes").length>0,o=ae("customScrollParent"),a=o||n?J0:X0,s=o||n?q0:G0;return N.createElement(a,{...t},r&&N.createElement(U0,null,N.createElement(qa,{showTopList:!0})),N.createElement(s,null,N.createElement($0,null),N.createElement(qa,null),N.createElement(V0,null)))}),{Component:K0,usePublisher:ct,useEmitterValue:ae,useEmitter:ha}=Qi(Y0,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Z0),X0=Sc({usePublisher:ct,useEmitterValue:ae,useEmitter:ha}),J0=bc({usePublisher:ct,useEmitterValue:ae,useEmitter:ha}),Ac=K0,Ua={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Q0={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Za,ceil:Ka,floor:$n,min:Cr,max:cn}=Math;function eh(e){return{...Q0,items:e}}function Xa(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const a=n===null?null:n[o+e];return{index:o+e,data:a}})}function th(e,t){return e&&e.column===t.column&&e.row===t.row}function Nn(e,t){return e&&e.width===t.width&&e.height===t.height}const nh=ke(([{overscan:e,visibleRange:t,listBoundary:n}
1,{scrollTop:r,viewportHeight:o,scrollBy:a,scrollTo:s,smoothScrollTargetReached:c,scrollContainerState:l,footerHeight:u,headerHeight:h},p,f,{propsReady:k,didMount:S},{windowViewportRect:C,useWindowScroll:y,customScrollParent:m,windowScrollContainerState:d,windowScrollTo:g},w])=>{const v=D(0),x=D(0),b=D(Ua),A=D({height:0,width:0}),T=D({height:0,width:0}),I=ge(),M=ge(),F=D(0),P=D(null),B=D({row:0,column:0}),E=ge(),H=ge(),te=D(!1),me=D(0),fe=D(!0),Q=D(!1),le=D(!1);Se(_(S,he(me),ee(([j,L])=>!!L)),()=>{ce(fe,!1),ce(x,0)}),Se(_(Oe(S,fe,T,A,me,Q),ee(([j,L,V,U,,ye])=>j&&!L&&V.height!==0&&U.height!==0&&!ye)),([,,,,j])=>{ce(Q,!0),ia(1,()=>{ce(I,j)}),yt(_(r),()=>{ce(n,[0,0]),ce(fe,!0)})}),q(_(H,ee(j=>j!=null&&j.scrollTop>0),gt(0)),x),Se(_(S,he(H),ee(([,j])=>j!=null)),([,j])=>{j&&(ce(A,j.viewport),ce(T,j==null?void 0:j.item),ce(B,j.gap),j.scrollTop>0&&(ce(te,!0),yt(_(r,Xt(1)),L=>{ce(te,!1)}),ce(s,{top:j.scrollTop})))}),q(_(A,z(({height:j})=>j)),o),q(_(Oe(ne(A,Nn),ne(T,Nn),ne(B,(j,L)=>j&&j.column===L.column&&j.row===L.row),ne(r)),z(([j,L,V,U])=>({viewport:j,item:L,gap:V,scrollTop:U}))),E),q(_(Oe(ne(v),t,ne(B,th),ne(T,Nn),ne(A,Nn),ne(P),ne(x),ne(te),ne(fe),ne(me)),ee(([,,,,,,,j])=>!j),z(([j,[L,V],U,ye,O,be,ze,,qe,Z])=>{const{row:se,column:de}=U,{height:Ae,width:Qe}=ye,{width:We}=O;if(ze===0&&(j===0||We===0))return Ua;if(Qe===0){const J=ca(Z,j),$=J===0?Math.max(ze-1,0):J;return eh(Xa(J,$,be))}const $e=Tc(We,Qe,de);let pe,Ne;qe?L===0&&V===0&&ze>0?(pe=0,Ne=ze-1):(pe=$e*$n((L+se)/(Ae+se)),Ne=$e*Ka((V+se)/(Ae+se))-1,Ne=Cr(j-1,cn(Ne,$e-1)),pe=Cr(Ne,cn(0,pe))):(pe=0,Ne=-1);const je=Xa(pe,Ne,be),{top:Ee,bottom:X}=Ja(O,U,ye,je),_e=Ka(j/$e),lt=_e*Ae+(_e-1)*se-X;return{items:je,offsetTop:Ee,offsetBottom:lt,top:Ee,bottom:X,itemHeight:Ae,itemWidth:Qe}})),b),q(_(P,ee(j=>j!==null),z(j=>j.length)),v),q(_(Oe(A,T,b,B),ee(([j,L,{items:V}])=>V.length>0&&L.height!==0&&j.height!==0),z(([j,L,{items:V},U])=>{const{top:ye,bottom:O}=Ja(j,U,L,V);return[ye,O]}),Ie(gn)),n);const we=D(!1);q(_(r,he(we),z(([j,L])=>L||j!==0)),we);const ue=ot(_(ne(b),ee(({items:j})=>j.length>0),he(v,we),ee(([{items:j},L,V])=>V&&j[j.length-1].index===L-1),z(([,j])=>j-1),Ie())),oe=ot(_(ne(b),ee(({items:j})=>j.length>0&&j[0].index===0),gt(0),Ie())),Ce=ot(_(ne(b),he(te),ee(([{items:j},L])=>j.length>0&&!L),z(([{items:j}])=>({startIndex:j[0].index,endIndex:j[j.length-1].index})),Ie(hc),Mt(0)));q(Ce,f.scrollSeekRangeChanged),q(_(I,he(A,T,v,B),z(([j,L,V,U,ye])=>{const O=uc(j),{align:be,behavior:ze,offset:qe}=O;let Z=O.index;Z==="LAST"&&(Z=U-1),Z=cn(0,Z,Cr(U-1,Z));let se=Yo(L,ye,V,Z);return be==="end"?se=Za(se-L.height+V.height):be==="center"&&(se=Za(se-L.height/2+V.height/2)),qe&&(se+=qe),{top:se,behavior:ze}})),s);const G=Ge(_(b,z(j=>j.offsetBottom+j.bottom)),0);return q(_(C,z(j=>({width:j.visibleWidth,height:j.visibleHeight}))),A),{data:P,totalCount:v,viewportDimensions:A,itemDimensions:T,scrollTop:r,scrollHeight:M,overscan:e,scrollBy:a,scrollTo:s,scrollToIndex:I,smoothScrollTargetReached:c,windowViewportRect:C,windowScrollTo:g,useWindowScroll:y,customScrollParent:m,windowScrollContainerState:d,deviation:F,scrollContainerState:l,footerHeight:u,headerHeight:h,initialItemCount:x,gap:B,restoreStateFrom:H,...f,initialTopMostItemIndex:me,horizontalDirection:le,gridState:b,totalListHeight:G,...p,startReached:oe,endReached:ue,rangeChanged:Ce,stateChanged:E,propsReady:k,stateRestoreInProgress:te,...w}},Me(la,Je,yn,pc,Yt,ua,Lt));function Ja(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const a=Yo(e,t,n,r[0].index),s=Yo(e,t,n,r[r.length-1].index)+o;return{top:a,bottom:s}}function Yo(e,t,n,r){const o=Tc(e.width,n.width,t.column),a=$n(r/o),s=a*n.height+cn(0,a-1)*t.row;return s>0?s+t.row:s}function Tc(e,t,n){return cn(1,$n((e+n)/($n(t)+n)))}const rh=ke(()=>{const e=D(u=>"Item ".concat(u)),t=D({}),n=D(null),r=D("virtuoso-grid-item"),o=D("virtuoso-grid-list"),a=D(da),s=D("div"),c=D(Wt),l=(u,h=null)=>Ge(_(t,z(p=>p[u]),Ie()),h);return{context:n,itemContent:e,components:t,computeItemKey:a,itemClassName:r,listClassName:o,headerFooterTag:s,scrollerRef:c,FooterComponent:l("Footer"),HeaderComponent:l("Header"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),oh=ke(([e,t])=>({...e,...t}),Me(nh,rh)),ah=N.memo(function(){const t=De("gridState"),n=De("listClassName"),r=De("itemClassName"),o=De("itemContent"),a=De("computeItemKey"),s=De("isSeeking"),c=ht("scrollHeight"),l=De("ItemComponent"),u=De("ListComponent"),h=De("ScrollSeekPlaceholder"),p=De("
1context"),f=ht("itemDimensions"),k=ht("gap"),S=De("log"),C=De("stateRestoreInProgress"),y=Ht(N.useMemo(()=>m=>{const d=m.parentElement.parentElement.scrollHeight;c(d);const g=m.firstChild;if(g){const{width:w,height:v}=g.getBoundingClientRect();f({width:w,height:v})}k({row:Qa("row-gap",getComputedStyle(m).rowGap,S),column:Qa("column-gap",getComputedStyle(m).columnGap,S)})},[c,f,k,S]),!0,!1);return C?null:N.createElement(u,{ref:y,className:n,...Ze(u,p),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list"},t.items.map(m=>{const d=a(m.index,m.data,p);return s?N.createElement(h,{key:d,...Ze(h,p),index:m.index,height:t.itemHeight,width:t.itemWidth}):N.createElement(l,{...Ze(l,p),className:r,"data-index":m.index,key:d},o(m.index,m.data,p))}))}),sh=N.memo(function(){const t=De("HeaderComponent"),n=ht("headerHeight"),r=De("headerFooterTag"),o=Ht(N.useMemo(()=>s=>n(Ft(s,"height")),[n]),!0,!1),a=De("context");return t?N.createElement(r,{ref:o},N.createElement(t,Ze(t,a))):null}),ih=N.memo(function(){const t=De("FooterComponent"),n=ht("footerHeight"),r=De("headerFooterTag"),o=Ht(N.useMemo(()=>s=>n(Ft(s,"height")),[n]),!0,!1),a=De("context");return t?N.createElement(r,{ref:o},N.createElement(t,Ze(t,a))):null}),ch=({children:e})=>{const t=N.useContext(kc),n=ht("itemDimensions"),r=ht("viewportDimensions"),o=Ht(N.useMemo(()=>a=>{r(a.getBoundingClientRect())},[r]),!0,!1);return N.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),N.createElement("div",{style:cr(!1),ref:o},e)},lh=({children:e})=>{const t=N.useContext(kc),n=ht("windowViewportRect"),r=ht("itemDimensions"),o=De("customScrollParent"),a=xc(n,o,!1);return N.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),N.createElement("div",{ref:a,style:cr(!1)},e)},uh=N.memo(function({...t}){const n=De("useWindowScroll"),r=De("customScrollParent"),o=r||n?hh:dh,a=r||n?lh:ch;return N.createElement(o,{...t},N.createElement(a,null,N.createElement(sh,null),N.createElement(ah,null),N.createElement(ih,null)))}),{usePublisher:ht,useEmitterValue:De,useEmitter:jc}=Qi(oh,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},uh),dh=Sc({usePublisher:ht,useEmitterValue:De,useEmitter:jc}),hh=bc({usePublisher:ht,useEmitterValue:De,useEmitter:jc});function Qa(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n("".concat(e," was not resolved to pixel value correctly"),t,at.WARN),t==="normal"?0:parseInt(t!=null?t:"0",10)}const fh=ke(()=>{const e=D(l=>N.createElement("td",null,"Item $",l)),t=D(null),n=D(null),r=D(null),o=D({}),a=D(da),s=D(Wt),c=(l,u=null)=>Ge(_(o,z(h=>h[l]),Ie()),u);return{context:t,itemContent:e,fixedHeaderContent:n,fixedFooterContent:r,components:o,computeItemKey:a,scrollerRef:s,TableComponent:c("Table","table"),TableHeadComponent:c("TableHead","thead"),TableFooterComponent:c("TableFoot","tfoot"),TableBodyComponent:c("TableBody","tbody"),TableRowComponent:c("TableRow","tr"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),FillerRow:c("FillerRow")}});Me(wc,fh);globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const ph=({user:e,params:t,userEventId:n,enabled:r})=>{const o=$o();return Fl(["race-prediction",e.id,n,t.course_id],()=>o.user.getRacePrediction(e.id,t).then(a=>a.ok?a.data:null),{enabled:r,staleTime:ya,cacheTime:ya})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Nc(e,t){return e>=t.power_range_suggested.min&&e<=t.power_range_suggested.max?"#21B090":e>t.power_range_suggested.max?"#C12235":"#c2c4c9"}function Ic(e,t){return e>=t.time_range_suggested.min&&e<=t.time_range_suggested.max?"#21B090":e<t.time_range_suggested.min?"#C12235":"#c2c4c9"}function Mc(e,t){return e>t.max?"above":e<t.min?"below":"in-range"}const mh="/powercenter/assets/event-card-bg-2-DSRKmi_P.svg";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function gh(e){return e.years||e.months||e.weeks||e.days||0}function wh(e){return e.years?Pt({id:"date.years"}):e.months?Pt({id:"date.months"}
1):e.weeks?Pt({id:"date.weeks"}):e.days?Pt({id:"date.days"}):Pt({id:"date.hours"})}function _c({event:e,user:t}){const n=Re(),r=Io.utcToZonedTime(new Date,t.time_zone),o=Io.utcToZonedTime(dl(e.date),t.time_zone);if(Un(o,r))return{isValid:!1,num:-1,nums:[],unit:""};const a=fd({start:r,end:o});a.days?a.days++:a.days=1;const s=gh(a),c="".concat(s).padStart(2,"0").split(""),l=wh(a);return{isValid:!0,num:s,nums:c,unit:n.formatMessage(l,{n:s})}}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Fc=(e,t)=>{const n=Re(),r=s=>{if(s<60)return n.formatMessage({id:"RaceGraphs.secondsRange",defaultMessage:"+/- {seconds} sec"},{seconds:s});const c=Dl(s,60)/60;return n.formatMessage({id:"RaceGraphs.minutesRange",defaultMessage:"+/- {minutes} min"},{minutes:c})},o=s=>n.formatMessage({id:"RaceGraphs.wattsRange",defaultMessage:"+/- {watts} W"},{watts:Math.ceil(s)});return((s,c)=>{const l=Math.round(s.target-s.min),u=Math.round(s.max-s.target),h=u>l?u:l;return c===It.time?r(h):o(h)})(e,t)};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const vh="/powercenter/assets/event-card-modal-bg-BiDj_-cn.svg";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const xh={elevation:wt.elevation?wt.elevation.lineChartStyle:void 0},yh=({userEventIR:e,user:t,calculatorType:n,prediction:r,onClose:o})=>{const{event:{event:a},user_event:s}=e,c=_c({event:a,user:t}),{isMobileView:l}=El(),u=Y.useMemo(()=>r?dd(r,!0):null,[r]),h=r1(s,r),p=()=>i.jsx(No,{style:{width:"100%",height:"100%",backgroundImage:"url(".concat(vh,")"),backgroundSize:"cover"},children:c.isValid&&i.jsxs(W,{justify:"center",gap:4,pt:"md",style:{fontSize:"1.5rem"},children:[c.nums.map((S,C)=>i.jsx(W,{align:"center",justify:"center",style:{width:"22px",height:"27px",background:"white",borderRadius:"2px"},children:i.jsx(R,{c:"dimmed",children:S})},C)),i.jsx(R,{children:c.unit})]})}),f=()=>i.jsxs(W,{gap:"xs",align:"center",w:"100%",style:{fontSize:"1.5rem"},children:[i.jsx(W,{align:"center",justify:"center",style:{width:"30px",height:"30px",borderRadius:9999,backgroundColor:"#2E3135",overflow:"hidden"},children:i.jsx(R,{children:Mo(s.priority)})}),i.jsx(R,{flex:"1",children:a.name}),l&&c.isValid&&i.jsxs(W,{children:[c.nums.map((S,C)=>i.jsx(W,{align:"center",justify:"center",py:"sm",style:{backgroundColor:"#2E3135",width:"24px",borderRadius:"2px"},children:i.jsx(R,{children:S})},C)),i.jsx(R,{children:c.unit})]})]}),k=()=>{var S;return i.jsxs(re,{align:"flex-start",gap:"xs",w:"100%",children:[i.jsx(R,{fw:"bold",children:i.jsx(K,{id:"EventCard.course.title"})}),i.jsxs(W,{align:"stretch",w:"100%",gap:"xs",children:[i.jsxs(re,{align:"flex-start",gap:4,p:"md",style:{border:"1px solid #333",borderRadius:"8px",flexBasis:140},children:[i.jsx(R,{c:"dimmed",children:i.jsx(K,{id:"metricTitle.distance"})}),i.jsx(R,{size:"1.125rem",fw:"bold",children:Yl(a.distance_in_meter,t.units)}),i.jsx(R,{c:"dimmed",children:i.jsx(K,{id:"metricTitle.surface"})}),i.jsx(R,{size:"1.125rem",fw:"bold",children:Mo(a.surface)}),i.jsx(R,{c:"dimmed",children:i.jsx(K,{id:"metricTitle.avgElevation"})}),i.jsx(R,{size:"1.125rem",fw:"bold",children:Yd(a.elevation,t.units)})]}),i.jsxs(re,{align:"flex-start",px:"xs",py:"sm",style:{border:"1px solid #333",borderRadius:"8px",flexBasis:140,flex:"1"},children:[i.jsx(R,{ml:4,children:i.jsx(K,{id:"EventCard.profile.title"})}),u&&!!((S=u.elevation_list)!=null&&S.length)&&i.jsx(hd,{raceData:u,lineStyles:xh})]})]})]})};return i.jsx(Ll,{onClose:o,decorationContent:p(),children:r?i.jsxs(re,{align:"flex-start",gap:"xs",px:"md",py:"xs",h:"100%",style:{overflowY:"auto"},children:[f(),n===It.power?i.jsx(kh,{prediction:r,userEvent:s,calculatorType:n,showCpWarning:h}):i.jsx(Ch,{prediction:r,user:t,userEvent:s,calculatorType:n,showCpWarning:h}),k(),i.jsx(W,{w:"100%",justify:"flex-end",mt:"auto",children:i.jsx(Ke,{variant:"light",onClick:o,children:i.jsx(K,{id:"action.dismiss"})})})]}):i.jsx(hl,{})})},kh=({prediction:e,userEvent:t,calculatorType:n,showCpWarning:r})=>{const o=$i(t,e),a=Fc(e.power_range,n),s=Ic(o,e),c=Mc(o,e.time_range_suggested);
1return i.jsxs(re,{align:"flex-start",gap:"xs",w:"100%",children:[i.jsx(R,{fw:"bold",children:i.jsx(K,{id:"EventCard.projection.title"})}),i.jsxs(W,{gap:"xs",align:"stretch",w:"100%",children:[i.jsxs(re,{align:"flex-start",gap:"4",p:"md",style:{border:"1px solid #333",borderRadius:"8px",flexBasis:140},children:[i.jsx(R,{c:"dimmed",children:i.jsx(K,{id:"CalculatorInputs.targetTimeInputLabel"})}),i.jsx(W,{children:i.jsx(R,{c:s,size:"1.75rem",fw:"bold",children:en(o*1e3)})})]}),i.jsxs(re,{style:{border:"1px solid #333",borderRadius:"8px",flex:"1"},p:"md",gap:4,align:"flex-start",children:[i.jsx(R,{c:"dimmed",children:i.jsx(K,{id:"EventCard.estimatedPower.title"})}),i.jsxs(W,{gap:"xs",children:[i.jsx(R,{fz:"1.75rem",children:e.power_range.target.toFixed()}),i.jsx(R,{size:"1.75rem",children:"W"}),i.jsx(R,{size:"1.75rem",children:a})]}),i.jsx(R,{lh:1.2,c:"dimmed",children:c==="in-range"?i.jsx(K,{id:"raceCalculator.estimatedTimeInRangeMsg"}):c==="above"?i.jsx(K,{id:"raceCalculator.estimatedTimeHighMsg"}):c==="below"?i.jsx(K,{id:"raceCalculator.estimatedTimeLowMsg"}):null}),r&&i.jsx(R,{size:"1rem",c:"#C12235",children:i.jsx(K,{id:"raceCalculator.cpDifferenceMsg"})})]})]})]})},Ch=({prediction:e,user:t,calculatorType:n,userEvent:r,showCpWarning:o})=>{const a=Fc(e.time_range,n),s=Qo(r,e),c=Nc(s,e),l=Mc(s,e.power_range_suggested),u=!r.goal_power;return i.jsxs(re,{align:"flex-start",gap:"xs",w:"100%",children:[i.jsx(R,{fw:"bold",children:i.jsx(K,{id:"EventCard.projection.title"})}),i.jsxs(W,{gap:"xs",align:"stretch",w:"100%",children:[i.jsxs(re,{gap:4,align:"flex-start",p:"md",style:{border:"1px solid #333",borderRadius:"8px",flexBasis:140},children:[i.jsx(R,{c:"dimmed",children:i.jsx(K,{id:"CalculatorInputs.targetPowerInputLabel"})}),i.jsxs(W,{gap:"xs",children:[i.jsx(R,{c,size:"1.75rem",children:s.toFixed()}),i.jsx(R,{size:"1.75rem",children:"W"})]}),i.jsxs(W,{gap:"4",children:[i.jsx(R,{size:"1.5rem",children:(s/t.training_info.critical_power*100).toFixed()}),i.jsx(R,{size:"1.5rem",children:"%CP"})]})]}),i.jsxs(re,{align:"flex-start",gap:4,style:{border:"1px solid #333",borderRadius:"8px",flex:"1"},p:"md",children:[i.jsx(R,{c:"dimmed",children:i.jsx(K,{id:"EventCard.estimatedTime.title"})}),i.jsxs(W,{gap:"xs",children:[i.jsx(R,{size:"1.75rem",children:en(e.time_range.target*1e3)}),i.jsx(R,{size:"1.75rem",c:"rgb(194, 196, 201)",children:a})]}),i.jsx(R,{lh:1.2,c:"dimmed",children:u?i.jsx(K,{id:"raceCalculator.estimatedPowerSuggestedMsg"}):l==="in-range"?i.jsx(K,{id:"raceCalculator.estimatedPowerInRangeMsg"}):l==="below"?i.jsx(K,{id:"raceCalculator.estimatedPowerLowMsg"}):l==="above"?i.jsx(K,{id:"raceCalculator.estimatedPowerHighMsg"}):null}),o&&i.jsx(R,{size:"1rem",c:"#C12235",lh:1.2,children:i.jsx(K,{id:"raceCalculator.cpDifferenceMsg"})})]})]})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Sh="radial-gradient(105.81% 136.21% at -7.04% -4.84%, #312350 0%, rgba(78, 45, 150, 0.98) 68.18%, rgba(81, 46, 158, 0.9) 100%)",Ro=105,bh=({id:e,user:t})=>{const[n,r]=Y.useState(!1),a=wn()[e];if(!a)throw new Error("The event with id: ".concat(e," is not found!"));if(!vi(a))throw new Error("Expected an event, got a ".concat(a.category));const{event:s,course:c}=a.data.event,{user_event:l}=a.data,u=_c({event:s,user:t}),h=n1(s,t),p=l.goal_time?It.power:It.time,{data:f=null}=ph({user:t,userEventId:l.id,params:{race_distance:s.distance_in_meter,race_elevation:s.elevation,course_id:c.id||0,race_humidity:s.humidity,race_temperature:s.temperature,surface:s.surface,depth:"complete",target_power:p===It.time?l.goal_power:void 0,target_time:p===It.power?l.goal_time:void 0},enabled:!h||n}),k=$i(l,f),S=Qo(l,f),C=()=>f&&i.jsx(R,{fw:"bold",size:"xs",c:p===It.power?Ic(k,f):void 0,children:en(k*1e3)}),y=()=>f&&i.jsxs(W,{gap:"xs",children:[i.jsx(R,{fw:"bold",size:"xs",c:p===It.time?Nc(S,f):void 0,children:S.toFixed()}),i.jsx(R,{size:"xs",children:"W"})]});return i.jsxs(i.Fragment,{children:[i.jsx(No,{style:{backgroundImage:"url(".concat(mh,")"),borderRadius:"4px",cursor:"pointer",userSelect:"none"},h:Ro,onClick:()=>r(!0),children:i.jsx(No,{style:{backgroundImage:Sh,borderRadius:"4px",height:"100%"},children:i.jsxs(re,{align:"flex-start",py:"xs",px:"sm",style:{overflow:"hidden"},gap:4,children:[i.jsxs(W,{align:"center",gap:"xs",w:"100%",wrap:"nowrap",children:[i.jsx(W,{align:"center",justify:"center",wrap:"nowrap",style:{width:"12px",height:"12px",background:"white",borderRadius:9999,flexShrink:0},children:i.jsx(R,{size:"sm",fw:"bold",c:"#312350",children:Mo(l.priority)})}),i.jsx(R,{size:"sm",truncate:"end",children:s.name})]}
1),i.jsxs(re,{align:"flex-start",gap:"0",children:[u.isValid&&i.jsxs(R,{size:"xs",fw:"bold",children:[u.num," ",u.unit]}),C(),i.jsxs(W,{gap:"xs",children:[i.jsx(R,{fw:"bold",size:"xs",children:xi(s.distance_in_meter,t.units).toFixed(2)}),i.jsx(R,{size:"xs",children:Rl(t.units)})]}),y()]})]})})}),n&&i.jsx(yh,{userEventIR:a.data,user:t,prediction:f,calculatorType:p,onClose:()=>r(!1)})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Rn({id:e,data:t,children:n}){const{attributes:r,listeners:o,setNodeRef:a}=Pl({id:e,data:t});return i.jsx(re,{gap:0,ref:a,...o,...r,children:n})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Dc({id:e,data:t,disabled:n,children:r}){const o=Ol({id:e,data:t,disabled:n});return r(o)}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Ec=({entry:e})=>{var a;if(!e.data.exercise)throw new Error("entry.data.exercise not existed");const t=Re(),{mutateAsync:n,isLoading:r}=yi(),o=t.formatMessage({id:"result.success"});return i.jsxs(re,{children:[i.jsx(wi,{order:4,children:i.jsxs(W,{gap:"4",children:[lr(24)[e.data.exercise.type],Qt(e.data.exercise)&&i.jsx("span",{children:i.jsx(K,{id:Qt(e.data.exercise)})}),Jt(e.data.exercise)&&i.jsx("span",{children:i.jsx(K,{id:Jt(e.data.exercise)})})]})}),i.jsx("div",{className:"my-1.5",children:(a=e.data.exercise)==null?void 0:a.title}),i.jsx(Ah,{entry:e}),i.jsx(et,{color:"red",variant:"light",loading:r,onClick:()=>{n({id:e.data.id_str}).then(()=>{Ue({message:o,variant:"success"})})},children:i.jsx(vn,{size:14})})]})},Ah=({entry:e})=>{var r,o;const t=a=>{const s=/(https?:\/\/[^\s]+)/g;return a.replace(s,'<a href="$1">$1</a>')};return(a=>{if(!a)return i.jsx("p",{className:"text-gray-200",children:i.jsx(K,{id:"WorkoutEntryModal.workoutDescription.noContentMsg",defaultMessage:"No Description"})});const s=a.split("\n").map(c=>{const l=t(c.trim());return ki(Ci.sanitize(l))});return i.jsx("div",{className:"max-h-96 overflow-auto no-scrollbar",children:s.map((c,l)=>i.jsx("p",{className:"text-gray-400",children:c},"".concat(e.id,"-desc-").concat(l)))})})((o=(r=e.data.exercise)==null?void 0:r.description)!=null?o:"")};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Th=({entry:e})=>{const t=Re(),{mutateAsync:n,isLoading:r}=yi(),o=t.formatMessage({id:"result.success"});return i.jsxs(re,{children:[i.jsx(jh,{entry:e}),i.jsx(et,{color:"red",variant:"light",loading:r,onClick:()=>{n({id:e.data.id_str}).then(()=>{Ue({message:o,variant:"success"})})},children:i.jsx(vn,{size:14})})]})},jh=({entry:e})=>{var r,o;const t=a=>{const s=/(https?:\/\/[^\s]+)/g;return a.replace(s,'<a href="$1">$1</a>')};return(a=>{if(!a)return i.jsx(R,{size:"sm",children:i.jsx(K,{id:"WorkoutEntryModal.workoutDescription.noContentMsg",defaultMessage:"No Description"})});const s=a.split("\n").map(c=>{const l=t(c.trim());return ki(Ci.sanitize(l))});return i.jsx(re,{gap:"xs",children:s.map((c,l)=>Array.isArray(c)&&c.length===0?null:i.jsx(R,{size:"sm",children:c},"".concat(e.id,"-desc-").concat(l)))})})((o=(r=e.data.note)==null?void 0:r.description)!=null?o:"")},Nh="_container_iz8fu_1",Lc={container:Nh};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Vn=24,Ih=(e=14)=>i.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.2307 6.74669C14.8366 6.50505 15.1324 5.81511 14.8913 5.20566C14.6503 4.59621 13.9636 4.29803 13.3576 4.53967C12.7517 4.7813 12.4559 5.47124 12.697 6.0807C12.9381 6.69015 13.6248 6.98832 14.2307 6.74669ZM12.7935 6.60693C13.0527 6.67391 13.2517 6.88157 13.3081 7.14373L13.5494 8.26666L15.2914 10.3901C15.5397 10.6928 15.4956 11.1403 15.193 11.3897C14.8904 11.6391 14.4438 11.5959 14.1955 11.2932L12.4938 9.21871L11.9614 10.1694L13.1655 10.5135C13.386 10.5764 13.5621 10.7424 13.6384 10.959C13.7146 11.1756 13.6815 11.4159 13.5494 11.604L11.7055 14.2313L11.7798 14.3392C12.002 14.6616 11.921 15.104 11.5987 15.3272C11.4755 15.4126 11.3349 15.4536 11.1957 15.4536L11.1957 16.0772L11.5139 16.2362C11.8638 16.4112 12.0054 16.8376 11.83 17.188
16C11.6547 17.5395 11.2288 17.6822 10.8789 17.5072L10.1695 17.1525C9.92964 17.0326 9.77821 16.7872 9.77821 16.5185L9.77821 12.67L9.44628 10.4696C9.43743 10.4109 9.43604 10.3519 9.44173 10.294C9.39213 10.0789 9.44312 9.84365 9.59968 9.66474L12.0827 6.82705C12.2593 6.62512 12.5343 6.53996 12.7935 6.60693ZM11.1871 12.5033L11.0172 11.3772L11.817 11.6057L11.1871 12.5033Z",fill:"currentColor"}),i.jsx("path",{d:"M16.1623 15.8076L14.7435 12.4024M14.7435 12.4024L14.4764 11.7615C14.429 11.6477 14.2951 11.5979 14.1848 11.653L10.8791 13.3059C10.8543 13.3183 10.8323 13.3353 10.8141 13.3561L8.58803 15.9002C8.48322 16.02 8.54217 16.2082 8.69658 16.2468L11.0633 16.8385C11.1443 16.8587 11.2297 16.8297 11.2816 16.7643L14.7435 12.4024Z",stroke:"white",strokeWidth:"0.709422",strokeLinecap:"round"}),i.jsx("circle",{cx:"8.71339",cy:"16.1623",r:"2.48298",stroke:"white",strokeWidth:"0.709422"}),i.jsx("circle",{cx:"16.1623",cy:"16.1623",r:"2.48298",stroke:"white",strokeWidth:"0.709422"})]}),Mh=(e=14)=>i.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.3535 5.10026C12.98 4.60665 13.0873 3.6951 12.5931 3.06427C12.0989 2.43344 11.1904 2.3222 10.5639 2.81582C9.93734 3.30944 9.83005 4.22098 10.3242 4.85181C10.8184 5.48265 11.727 5.59388 12.3535 5.10026ZM11.1072 5.82774C11.2872 5.84408 11.4493 5.91454 11.579 6.02166L12.7687 6.97335L13.2429 5.55053C13.3946 5.09548 13.8854 4.84964 14.3391 5.00143C14.7928 5.15322 15.0377 5.64516 14.886 6.10021L14.0186 8.70242C13.9289 8.97155 13.7138 9.17988 13.4424 9.26042C13.201 9.33208 12.9421 9.29453 12.7322 9.16076L12.582 10.3622L14.1479 9.29214C14.4019 9.11851 14.7286 9.09283 15.0064 9.22465C15.2842 9.35647 15.4713 9.62605 15.4983 9.93305L15.8621 14.0772C16.2044 14.1808 16.4601 14.492 16.4766 14.8705C16.4975 15.3497 16.1269 15.7554 15.649 15.7767L15.1054 15.8008C14.6423 15.8214 14.2453 15.4728 14.2047 15.0098L13.902 11.5617L11.7617 13.0244C11.7416 13.0381 11.7212 13.0508 11.7005 13.0626L11.8859 14.3506C11.8922 14.394 11.8951 14.4379 11.8948 14.4817L11.8587 18.9366L12.4748 19.491C12.8307 19.8113 12.8601 20.3604 12.5404 20.7175C12.2208 21.0746 11.6731 21.1044 11.3172 20.7841L10.4105 19.9683C10.2258 19.802 10.1211 19.5642 10.1231 19.3152L10.1618 14.5347L9.73752 11.5882C9.72784 11.521 9.72606 11.4528 9.73221 11.3852L9.80414 10.594C9.66562 10.6065 9.52211 10.5857 9.38537 10.5269C8.94584 10.3377 8.74269 9.82704 8.93162 9.38621L10.225 6.36836C10.2757 6.2421 10.3548 6.13136 10.4538 6.04332C10.4664 6.03208 10.4794 6.02121 10.4927 6.01072C10.6606 5.87798 10.8775 5.8069 11.1072 5.82774Z",fill:"currentColor"})}),_h=(e=14)=>i.jsx("svg",{width:e,height:e,viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5513 2.36128C12.9599 2.11643 13.492 2.2491 13.7398 2.65761L15.2398 5.13053C15.403 5.3996 15.4072 5.73503 15.2508 6.00642L13.7508 8.60813C13.6917 8.71053 13.6133 8.79778 13.5215 8.86637L13.9657 12.3818C13.9766 12.4678 13.9758 12.5526 13.9646 12.6346L14.3552 15.3388L15.0853 19.7818C15.1626 20.2521 14.843 20.694 14.3715 20.7686C13.8999 20.8432 13.4549 20.5223 13.3776 20.0519L12.6461 15.6007L12.6436 15.5841L12.2953 13.1729L11.8599 17.0497C11.8581 17.0653 11.8559 17.0809 11.8533 17.0964L11.3533 20.0639C11.2742 20.5332 10.8281 20.8478 10.3568 20.7666C9.88555 20.6853 9.5676 20.239 9.64667 19.7698L10.1427 16.8255L10.5541 13.1633C10.216 13.4432 9.71207 13.4251 9.39209 13.1086L7.89209 11.6248C7.56659 11.3029 7.54746 10.7853 7.84843 10.4435L10.3484 7.60481C10.5117 7.41941 10.7474 7.31322 10.9955 7.31322L12.497 7.31322L13.4957 5.58114L12.2602 3.5443C12.0124 3.13579 12.1427 2.60614 12.5513 2.36128ZM9.68721 10.9768L10.3188 10.2596L10.5329 11.8134L9.68721 10.9768ZM11.905 6.75944C12.6186 6.4142 12.9143 5.55853 12.5655 4.84824C12.2167 4.13796 11.3555 3.84203 10.642 4.18727C9.92843 4.53251 9.63273 5.38818 9.9815 6.09847C10.3303 6.80875 11.1915 7.10468 11.905 6.75944Z",fill:"currentColor"})}),Fh=(e=14)=>i.jsx("svg",{width:e,height:e,viewBox:"0 0 22 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.3167 5.09519C13.1427 4.69115 13.4851 3.68995 13.0815 2.85893C12.6778 2.02792 11.681 1.68178 10.855 2.08582C10.0289 2.48986 9.68651 3.49107 10.0901 4.32208C10.4938 5.15309 11.4906 5.49923 12.316
17 5.09519ZM7.1915 4.36546C7.4325 4.249 7.70987 4.23414 7.96154 4.32423L12.3896 5.90926C12.6351 5.99713 12.8364 6.17782 12.9505 6.41269L13.7911 8.14345L15.1553 7.4762C15.6514 7.23353 16.2492 7.43953 16.4905 7.93632C16.7318 8.4331 16.5252 9.03254 16.0291 9.27521L13.7667 10.3818C13.2705 10.6245 12.6727 10.4185 12.4314 9.92173L11.9798 8.99194L11.2807 11.0362L14.3481 12.1773C14.6701 12.2971 14.9078 12.5745 14.9773 12.9117C15.0469 13.2489 14.9385 13.5985 14.6904 13.8373L12.5687 15.8796L12.1651 16.4069C11.8291 16.846 11.202 16.9295 10.7644 16.5935C10.3269 16.2575 10.2446 15.6292 10.5806 15.1901L11.0304 14.6025C11.0611 14.5623 11.0948 14.5245 11.1313 14.4894L12.1593 13.4999L9.51198 12.5152L9.51198 19.877L9.86525 21.3153C9.99705 21.852 9.66963 22.3948 9.13392 22.5278C8.59821 22.6608 8.05708 22.3336 7.92528 21.797L7.54308 20.2409C7.52387 20.1626 7.51416 20.0823 7.51416 20.0017L7.51415 12.3156C7.51415 12.2143 7.52951 12.1135 7.55969 12.0168L9.16153 6.88096L8.24034 6.55122L7.58651 8.46299C7.40755 8.98628 6.83942 9.26581 6.31757 9.08735C5.79572 8.90888 5.51776 8.34 5.69673 7.81671L6.67923 4.94391C6.76597 4.69028 6.95049 4.48193 7.1915 4.36546Z",fill:"currentColor"})}),Dh=(e=14)=>i.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.2948 8.16231C14.0598 8.01076 14.5788 7.2791 14.4625 6.49627C14.3428 5.69103 13.5964 5.13659 12.7952 5.25788C11.9941 5.37917 11.4416 6.13027 11.5612 6.9355C11.6298 7.39668 11.9039 7.7756 12.2761 7.99242C12.2548 8.003 12.2339 8.01447 12.2133 8.02683L11.3221 8.53609C11.418 8.11976 11.1995 7.6849 10.7911 7.52218C10.3396 7.34226 9.82684 7.56314 9.64587 8.01553L8.76467 10.2184C8.6254 10.5666 8.72102 10.9643 9.00308 11.2099C9.18027 11.3642 9.40671 11.4373 9.63129 11.4243L8.44892 13.0323C8.19263 13.3809 8.22617 13.8634 8.52813 14.1716L9.43103 15.0933L8.30642 18.0922C8.21391 18.3389 8.2363 18.6137 8.36745 18.8416C8.4986 19.0694 8.72479 19.2264 8.98415 19.2696L9.86533 19.4164C10.345 19.4962 10.7996 19.1717 10.8806 18.6914C10.9519 18.2691 10.7107 17.867 10.3253 17.7218L11.2773 15.1832C11.3976 14.8624 11.3216 14.5015 11.0825 14.2574L11.0211 14.1948C11.0343 14.189 11.0474 14.1829 11.0603 14.1765L12.9691 14.3655L11.8315 17.7555C11.7501 17.9979 11.7778 18.2635 11.9074 18.4834C12.0369 18.7033 12.2556 18.8559 12.5068 18.9015L13.3879 19.0617C13.8663 19.1486 14.3256 18.8308 14.4138 18.3518C14.4946 17.9123 14.2351 17.49 13.8224 17.356L14.9904 13.8756C15.0757 13.6213 15.0409 13.3422 14.8958 13.1173C14.7506 12.8924 14.511 12.7461 14.2445 12.7197L12.4178 12.5388L13.3122 11.3409L13.6956 11.916C13.8513 12.1495 14.1091 12.2944 14.3897 12.3061C14.6703 12.3179 14.94 12.1949 15.1157 11.9752L16.8781 9.77231C17.1825 9.39178 17.1217 8.83711 16.7423 8.53344C16.3628 8.22977 15.8085 8.29208 15.504 8.67261L14.4948 9.93421L13.4103 8.30754C13.3789 8.25805 13.3422 8.21126 13.3004 8.16808C13.2985 8.16615 13.2966 8.16423 13.2948 8.16231Z",fill:"currentColor"}),i.jsx("path",{d:"M5.17644 7.90071L18.394 8.78188",stroke:"white",strokeWidth:"0.660876",strokeLinecap:"round"}),i.jsx("ellipse",{cx:"6.93877",cy:"7.90071",rx:"1.76234",ry:"2.20292",fill:"currentColor"}),i.jsx("ellipse",{cx:"17.0722",cy:"8.78188",rx:"1.32175",ry:"1.76234",fill:"currentColor"})]}),Eh=(e=14)=>i.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.347 7.72911L15.4575 7.40156C15.4287 7.39045 15.399 7.38088 15.3685 7.37296C15.3577 7.37016 15.3468 7.36758 15.336 7.36523L11.6875 6.55447C11.5959 6.53412 11.5015 6.52978 11.4083 6.54164L10.5966 6.64505C10.4574 6.66278 10.3251 6.71617 10.2126 6.80002L9.80672 7.1025C9.77514 7.12604 9.74531 7.15183 9.71746 7.17968L9.31155 7.58557C9.2271 7.67001 9.16229 7.77196 9.12171 7.88416L7.80687 11.5202L4.47862 14.4503C4.23354 14.6661 4.14122 15.007 4.24421 15.316L4.65009 16.5337C4.79167 16.9585 5.25158 17.1874 5.67732 17.045C6.10306 16.9027 6.33341 16.4429 6.19182 16.0181L5.95585 15.3102L9.03645 12.5981C9.13923 12.5076 9.2175 12.3927 9.26402 12.2641L10.299 9.40185L10.3029 9.40827L11.7931 11.892L14.3691 16.6813C14.5103 16.9438 14.7844 17.1074 15.0831 17.1074L15.8949 17.1074C16.3435 17.1074 16.7081 16.7442 16.7091 16.2962C16.7094 16.1842 16.6869 16.0776 16.6461 15.9805C16.7958 15.7837 16.8543 15.5215 16.7813 15.266L16.7623 15.1997L16.2566 10.6481L16.8416 8.72428C16.9665 8.31354 16.7498 7.87744 16.347 7.72911ZM13.1971 11.0721L11.8512 8.82892L14.5181 9.71786L14.6049 10.4994L14.2227 11.7562C14.1773 11.9055 14.1759 12.0646 14.2188 12.2144L14.679 13.8253L13.2159 11.1051C13.2099 11.0939 13.2036 11.0829 13.1971 11.0721ZM17.6785 11.1404C18.3956 11.3477 19.1474 10.9322 19.3576 10.2123C19.5679 9.49241 19.157 8.74077 18.4399 8.53345C17.7228 8.32614 16.971 8.74167 16.7607 9.46156C16.5505 10.1814 16.9614 10.9331 17.6785 11.1404Z",fill:"currentColor"})}),Jt=e=>({"post-run":"exercise_post_run","pre-run":"exercise_pre_run"})[e.recommended_timing],Qt=e=>({"cross-training":"exercise_type_cross_training",drill:"exercise_type_drill",other:"",plyometrics:"exercise_type_plyometrics",strength:"exercise_type_strength",stretch:"exercise_type_stretch"})[e.type],lr=(e=14)=>({"cross-training":Ih(e),drill:Mh(e),plyometrics:Fh(e),strength:Dh(e),stretch:Eh(e),other:_h(e)}),Lh=({id:e,entry:t})=>{const n=t.data.note,r=t.data.exercise,[o,{open:a,close:s}]=Si(!1),c=t.data.note?i.jsxs(i.Fragment,{children:[i.jsx(zl,{size:14,style:{flexShrink:0}}),i.jsx(R,{size:"sm",truncate:"end",children:t.data.note.title})]}):"",l=t.data.exercise?i.jsxs(i.Fragment,{children:[lr()[t.data.exercise.type]," ",i.jsxs(R,{size:"sm",truncate:"end",children:[Qt(t.data.exercise)&&i.jsx(K,{id:Qt(t.data.exercise)})," ",Jt(t.data.exercise)&&i.jsx("span",{children:i.jsx(K,{id:Jt(t.data.exercise)})})]})]}):"";return i.jsxs(i.Fragment,{children:[i.jsxs(W,{h:Vn,wrap:"nowrap",gap:4,className:Lc.container,onClick:a,children:[t.data.note&&c,t.data.exercise&&l]}),i.jsx(zt,{opened:o,onClose:s,title:i.jsx(W,{gap:4,children:c||l}),size:"50vw",radius:0,transitionProps:{transition:"fade",duration:200},styles:{body:{height:"100%"}},children:n?i.jsx(Th,{entry:t}):r?i.jsx(Ec,{entry:t}):null})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Yh=({workout:e,opened:t,onClose:n})=>{const r=Re(),[o,a]=Y.useState(null),[s,c]=Y.useState(!1),[l,u]=Y.useState(""),{userCollections:h,userLibrary:p,updateCollection:f,refreshUserWorkoutLibraries:k,addNewCollection:S,isAddingNewCollection:C,isUpdateingCollection:y}=bi(),{mutateAsync:m,isLoading:d}=Ai(),g=async()=>
1{if(!o||!p)return;const v=h.find(b=>b.id===o);if(!v||!e)return;const x=await m({workout:e});x&&(await f({libraryId:p.id,collectionId:o,collection:{...v,workouts:[...v.workouts||[],x==null?void 0:x.id.toString()]}}),k(),a(""),n())},w=async()=>{if(!p||!l)return;const v=await S({libraryId:p.id,collectionTitle:l});v&&(k(),a(v.id),c(!1),u(""))};return i.jsxs(i.Fragment,{children:[i.jsx(zt,{opened:t,onClose:n,title:r.formatMessage({id:"WorkoutLibrary.saveToCollectionTitle",defaultMessage:"Save to collection"}),children:i.jsxs(re,{children:[i.jsx(Pn,{value:o,onChange:v=>{v?a(v):c(!0)},placeholder:r.formatMessage({id:"WorkoutLibrary.addToCollectionPlaceholder",defaultMessage:"Add to workout collection"}),data:[{label:r.formatMessage({id:"WorkoutLibrary.createNewCollectionOption",defaultMessage:"+ Create new collection"}),value:""},...h.map(({title:v,id:x})=>({label:v,value:x}))]}),i.jsxs(W,{justify:"end",children:[i.jsx(Ke,{size:"xs",variant:"default",onClick:n,children:r.formatMessage({id:"action.dismiss"})}),i.jsx(Ke,{size:"xs",loading:y||d,onClick:g,disabled:!o,children:r.formatMessage({id:"action.save",defaultMessage:"Save"})})]})]})}),i.jsx(zt,{opened:s,onClose:()=>c(!1),title:r.formatMessage({id:"WorkoutLibrary.createNewCollectionTitle",defaultMessage:"Create new collection"}),children:i.jsxs(re,{children:[i.jsx(Ei,{placeholder:r.formatMessage({id:"WorkoutLibrary.collectionTitleLabel",defaultMessage:"Collection title"}),value:l,onChange:v=>u(v.target.value)}),i.jsxs(W,{justify:"end",children:[i.jsx(Ke,{size:"xs",variant:"default",onClick:()=>c(!1),children:r.formatMessage({id:"action.dismiss"})}),i.jsx(Ke,{size:"xs",loading:C,onClick:w,disabled:!l,children:r.formatMessage({id:"action.save",defaultMessage:"Save"})})]})]})})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Rh="_container_1b0hv_1",Ph="_title_1b0hv_15",Oh="_metrics_1b0hv_19",zh="_stat_1b0hv_25",In={container:Rh,title:Ph,metrics:Oh,stat:zh};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Po=85,Wh=({id:e,entry:t,onClick:n,setWorkoutBuilderModalOpened:r})=>{const o=Re(),{releaseWorkoutLibrary:a}=qo(),s=Go(),{userData:c,isEditable:l}=Xe(),u=Jo(c),h=Uo(c.units,u),[p,f]=Y.useState(!1),[k,S]=Y.useState(null),C=Wl({entry:t,timezone:s}),{handleDuplicateWorkout:y,isDuplicatingWorkout:m}=Hl({entry:t,userData:c,datePickerValue:k,onSuccess:()=>{f(!1),S(null)},onFail:()=>{}}),d=t.data,g=Bl(t),w=[{value:en(d.duration*1e3)},{value:Zo(d.distance,c.units).toFixed(2),unit:h.distance},{value:d.stress.toFixed(),unit:"RSS"}],v=T=>{T.stopPropagation(),C()},x="workout-summary-".concat(d.id_str,"-").concat(e),[b,A]=Y.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(re,{style:{height:Po},gap:"0",children:i.jsxs(re,{h:"100%",className:xt([In.container]),gap:0,id:x,onClick:n,children:[i.jsxs(W,{gap:4,className:In.title,children:[pd(t.data.source),i.jsx(R,{size:"sm",lineClamp:1,flex:1,style:{wordBreak:"break-all"},children:t.data.workout.title}),l&&i.jsxs(ve,{children:[i.jsx(ve.Target,{children:i.jsx(et,{variant:"subtle",size:"sm",color:"white",onClick:T=>{T.stopPropagation()},onMouseDown:T=>{T.stopPropagation()},children:i.jsx(Pi,{size:14})})}),i.jsxs(ve.Dropdown,{children:[i.jsx(ve.Item,{leftSection:i.jsx(Ti,{size:14}),onClick:T=>{T.stopPropagation(),r==null||r(!0)},children:o.formatMessage({id:"WorkoutLibraryWorkoutCard.editAction",defaultMessage:"Edit"})}),d.source.includes("stryd")&&i.jsx(ve.Item,{leftSection:i.jsx(f1,{size:14}),onClick:T=>{T.stopPropagation(),f(!0)},children:o.formatMessage({id:"WorkoutBuilder.duplicateAction",defaultMessage:"Duplicate"})}),a&&i.jsx(ve.Item,{leftSection:i.jsx(ea,{size:14}),onClick:T=>{T.stopPropagation(),A(!0)},children:o.formatMessage({id:"WorkoutBuilder.saveToLibraryTitle",defaultMessage:"Save to library"})}),i.jsx(ve.Item,{leftSection:i.jsx(vn,{size:14}),onClick:v,children:i.jsx(K,{id:"action.delete"})})]})]})]}),i.jsx(W,{w:"100%",align:"center",className:In.metrics,children:w.map(T=>i.jsxs(R,{size:"xs",className:In.stat,children:[i.jsx("span",{children:T.value}),i.jsx("span",{children:T.unit})]},T.value))}),i.jsx(ji,{workout:d.workout,containerId:x,user:c}),i.jsx(W,{pos:"absolute",style:{bottom:4,left:4,right:4},justify:"flex-end",children:g&&i.jsx(W,{style:{padding:"3px",borderRadius:"50%",background:"rgba(35, 38, 43, 0.9)"},children:i.jsx(Ni,{size:16})})})]})}),i.jsx(Yh,{workout:d.workout,opened:b,onClose:()=>A(!1)}),i.jsxs(zt,{opened:p,onClose:()=>f(!1),title:o.formatMessage({id:"WorkoutCard.selectDateTitle",defaultMessage:"Select Date"}),w:"200",children:[i.jsx(ta,{value:k,onChange:S,label:o.formatMessage({id:"WorkoutCard.selectDateTitle",defaultMessage:"Select Date"}),placeholder:o.formatMessage({id:"WorkoutCard.selectDateTitle",defaultMessage:"Select Date"})}),i.jsxs(W,{justify:"end",mt:"md",children:[i.jsx(Ke,{variant:"subtle",onClick:()=>{f(!1),S(null)},children:i.jsx(K,{id:"action.cancel"})}),i.jsx(Ke,{variant:"default",onClick:y,disabled:m,loading:m,children:i.jsx(K,{id:"WorkoutBuilder.duplicateAction",defaultMessage:"Duplicate"})})]})]})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Yc=({entryId:e,day:t,...n})=>{const r=fl(),{userData:o}=Xe(),s=wn()[e],[c,l]=Y.useState(!1);if(!s)throw new Error("calendar entry (id: ".concat(e,") does not exist!"));if(s.category==="activities")return i.jsx(Dc,{id:e,data:{type:"entry",category:"activities",id:e},children:({setNodeRef:u,isOver:h})=>i.jsx(md,{id:e,entry:s,...n,droppableRef:u,isOver:h})});if(s.category==="workouts"){const u=s,h=()=>{const{id_str:p,source:f,source_id:k}=u.data;location.pathname.includes(p)||r("".concat(location.pathname,"/entries/workouts/").concat(p,"?source=").concat(f,"&source_id=").concat(k))};return i.jsxs(i.Fragment,{children:[i.jsx(Rn,{id:e,data:{id:e,day:t,category:"workouts"},children:i.jsx(Wh,{id:e,entry:s,...n,onClick:h,setWorkoutBuilderModalOpened:l})}),c&&i.jsx(Zn,{entry:s,opened:c,onClose:()=>l(!1)})]})}return s.category==="events"?i.jsx(Rn,{id:e,data:{id:e,day:t,category:"events"},children:i.jsx(bh,{id:e,user:o,...n})}):s.category==="supplementals"?i.jsx(Rn,{id:e,data:{id:e,day:t,category:"supplementals"},children:i.jsx(Lh,{id:e,entry:s,...n})}):null},Hh="_root_gd7df_1",Bh="_dayMenuTarget_gd7df_2",$h="_day_gd7df_2",Vh="_isInActiveMonth_gd7df_19",Gh="_today_gd
17df_23",qh="_abbr_gd7df_33",Nt={root:Hh,dayMenuTarget:Bh,day:$h,isInActiveMonth:Vh,today:Gh,abbr:qh};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const es=(e,t)=>{const n=t[e];return On(n)&&n.data.exercise?i.jsxs(W,{align:"center",justify:"center",gap:2,children:[lr(16)[n.data.exercise.type]," ",Qt(n.data.exercise)&&i.jsx(K,{id:Qt(n.data.exercise)})," ",Jt(n.data.exercise)&&i.jsx("span",{children:i.jsx(K,{id:Jt(n.data.exercise)})})]}):""},Uh=({exercises:e})=>{const[t,{open:n,close:r}]=Si(!1),o=wn(),[a,s]=Y.useState(e[0]),c=e.map(u=>{const h=o[u];if(!On(h))throw new Error;return{label:es(u,o),value:h.data.id_str,entry:h}}),l=o[a];return Y.useEffect(()=>{l||s(e[0])},[l,e]),i.jsxs(i.Fragment,{children:[i.jsxs(W,{h:Vn,wrap:"nowrap",gap:"xs",px:"xs",className:Lc.container,onClick:n,children:[i.jsx(R,{size:"sm",truncate:"end",children:e.length>1?"".concat(e.length," Exercises"):es(e[0],o)}),e.length>1&&i.jsx(W,{flex:1,gap:0,justify:"flex-end",wrap:"nowrap",children:c.map(({entry:u})=>{var h,p;return((h=u.data.exercise)==null?void 0:h.type)&&lr(16)[(p=u.data.exercise)==null?void 0:p.type]})})]}),i.jsx(zt,{opened:t,onClose:r,size:"50vw",children:i.jsxs(re,{children:[e.length>1&&i.jsx($l,{value:a,onChange:s,data:c}),i.jsx(re,{children:On(l)?i.jsx(Ec,{entry:l}):null})]})})]})},Zh="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='path-1-inside-1_814_132'%20fill='white'%3e%3cpath%20d='M6.32085%2010.134C6.35417%2010.3761%206.18482%2010.6015%205.94071%2010.6115C5.181%2010.6427%204.42289%2010.4856%203.73489%2010.1514C2.91382%209.7525%202.22947%209.11909%201.7684%208.33126C1.30732%207.54343%201.09021%206.63657%201.14453%205.72535C1.19885%204.81413%201.52216%203.93948%202.07358%203.21201C2.62499%202.48454%203.37974%201.93692%204.24239%201.63839C5.10503%201.33987%206.03682%201.30386%206.91994%201.53491C7.80305%201.76595%208.59782%202.25369%209.20373%202.93643C9.71146%203.50852%2010.0675%204.19601%2010.2428%204.93586C10.2991%205.1736%2010.1278%205.39757%209.88576%205.43089C9.64372%205.46421%209.42309%205.29396%209.36137%205.05756C9.21341%204.49088%208.9335%203.96485%208.542%203.5237C8.05223%202.97184%207.40982%202.57761%206.696%202.39085C5.98217%202.20409%205.229%202.2332%204.53172%202.4745C3.83444%202.7158%203.22438%203.15844%202.77867%203.74646C2.33296%204.33448%202.07163%205.04146%202.02772%205.778C1.98381%206.51454%202.1593%207.24756%202.53199%207.88437C2.90468%208.52117%203.45784%209.03316%204.12151%209.35559C4.65203%209.61333%205.23413%209.74069%205.81971%209.73002C6.06399%209.72556%206.28753%209.89199%206.32085%2010.134Z'/%3e%3c/mask%3e%3cpath%20d='M6.32085%2010.134C6.35417%2010.3761%206.18482%2010.6015%205.94071%2010.6115C5.181%2010.6427%204.42289%2010.4856%203.73489%2010.1514C2.91382%209.7525%202.22947%209.11909%201.7684%208.33126C1.30732%207.54343%201.09021%206.63657%201.14453%205.72535C1.19885%204.81413%201.52216%203.93948%202.07358%203.21201C2.62499%202.48454%203.37974%201.93692%204.24239%201.63839C5.10503%201.33987%206.03682%201.30386%206.91994%201.53491C7.80305%201.76595%208.59782%202.25369%209.20373%202.93643C9.71146%203.50852%2010.0675%204.19601%2010.2428%204.93586C10.2991%205.1736%2010.1278%205.39757%209.88576%205.43089C9.64372%205.46421%209.42309%205.29396%209.36137%205.05756C9.21341%204.49088%208.9335%203.96485%208.542%203.5237C8.05223%202.97184%207.40982%202.57761%206.696%202.39085C5.98217%202.20409%205.229%202.2332%204.53172%202.4745C3.83444%202.7158%203.22438%203.15844%202.77867%203.74646C2.33296%204.33448%202.07163%205.04146%202.02772%205.778C1.98381%206.51454%202.1593%207.24756%202.53199%207.88437C2.90468%208.52117%203.45784%209.03316%204.12151%209.35559C4.65203%209.61333%205.23413%209.74069%205.81971%209.73002C6.06399%209.72556%206.28753%209.89199%206.32085%2010.134Z'%20stroke='white'%20stroke-width='0.923077'%20mask='url(%23path-1-inside-1_814_132)'/%3e%3ccircle%20cx='9.12084'%20cy='8.4923'%20r='0.230769'%20fill='white'%20stroke='white'%20stroke-width='0.461538'/%3e%3ccircle%20cx='7.69018'%20cy='9.69231'%20r='0.230769'%20fill='white'%20stroke='white'%20stroke-width='0.461538'/%3e%3ccircle%20cx='9.85937'%20cy='6.8308'%20r='0.230769'%20fill='white'%20stroke='white'%20stroke-width='0.461538'/%3e%3cpath%20d='M9.87613%205.23972L8.50761%204.876C8.42312%204.85354%208.41428%204.73714%208.49441%204.70218L10.4375%203.85448C10.5157%203.82035%2010.5944%203.90154
1%2010.5578%203.97864L9.98324%205.19007C9.96417%205.23027%209.91913%205.25115%209.87613%205.23972Z'%20stroke='white'%20stroke-width='0.692308'%20stroke-linecap='round'/%3e%3c/svg%3e";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Kh=()=>{const e=Re();return i.jsxs(W,{gap:4,style:{width:"100%",height:24,backgroundColor:"#262728",borderRadius:"4px",padding:"0 6px",pointerEvents:"none"},children:[i.jsx("img",{src:Zh}),i.jsx(R,{size:"xs",children:e.formatMessage({id:"PhaseTransitionIndicator.title",defaultMessage:"Phase Transition"})})]})},Xh="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.51308%204.34346L4.64123%208.0766C4.56453%208.22958%204.40947%208.32756%204.23838%208.33117L3.08629%208.35544'%20stroke='white'%20stroke-width='0.989011'%20stroke-linecap='round'/%3e%3cpath%20d='M4.3488%204.71049L5.02265%204.10916C5.12976%204.01358%205.27525%203.97328%205.41627%204.00013L7.03466%204.30825C7.19064%204.33794%207.3204%204.44573%207.37821%204.59362L7.61042%205.1877C7.70321%205.42511%207.9709%205.54234%208.20831%205.44954L9.47597%204.95405'%20stroke='white'%20stroke-width='0.989011'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M6.97459%209.8819L7.23564%207.92991C7.25339%207.79717%207.21262%207.66327%207.1239%207.56296L6.22108%206.54217C6.09753%206.40248%206.07019%206.20216%206.15179%206.03447L6.9746%204.34343'%20stroke='white'%20stroke-width='0.989011'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3ccircle%20cx='7.58979'%20cy='2.50567'%20r='0.865385'%20transform='rotate(-21.349%207.58979%202.50567)'%20fill='white'/%3e%3c/svg%3e",Jh="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='8.51289'%20cy='2.50567'%20r='0.865385'%20transform='rotate(-21.349%208.51289%202.50567)'%20fill='white'/%3e%3cpath%20d='M6.00001%2010.1538L0.461548%2010.1538'%20stroke='white'%20stroke-width='0.923077'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M7.43611%204.34343L5.56427%208.07657C5.48756%208.22955%205.33251%208.32753%205.16141%208.33114L4.00932%208.35541'%20stroke='white'%20stroke-width='0.989011'%20stroke-linecap='round'/%3e%3cpath%20d='M5.27189%204.71049L5.94575%204.10916C6.05286%204.01358%206.19834%203.97328%206.33936%204.00013L7.95776%204.30825C8.11374%204.33794%208.2435%204.44573%208.3013%204.59362L8.53351%205.1877C8.62631%205.42511%208.89399%205.54234%209.1314%205.44954L10.3991%204.95405'%20stroke='white'%20stroke-width='0.989011'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M7.84617%209.69229L8.11988%207.81711C8.13972%207.68121%208.09801%207.54355%208.00609%207.44152L7.14666%206.48759C7.01923%206.34614%206.99173%206.14095%207.07741%205.97094L7.89768%204.34341'%20stroke='white'%20stroke-width='0.989011'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Qh="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.2422%209.33861C2.04688%209.5295%202.04328%209.84258%202.23417%2010.0379C2.42505%2010.2332%202.73813%2010.2368%202.93346%2010.0459L2.58783%209.69228L2.2422%209.33861ZM2.58783%209.69228L2.93346%2010.0459L8.37302%204.73001L8.02739%204.37634L7.68176%204.02268L2.2422%209.33861L2.58783%209.69228Z'%20fill='white'/%3e%3cpath%20d='M5.55487%204.5L6.54388%203.51099L8.27465%205.24176V6.60165H10.0054'%20stroke='white'%20stroke-width='0.989011'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M5.67847%208.7033L8.15099%208.45605L6.42023%206.60165L8.02737%204.99451'%20stroke='white'%20stroke-width='0.989011'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3ccircle%20cx='9.14004'%20cy='3.63461'%20r='0.865385'%20fill='white'/%3e%3cpath%20d='M3.23065%203.75824H4.59054'%20stroke='white'%20stroke-width='0.494505'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M1.84607%204.74725L4.56585%204.74725'%20stroke='white'%20stroke-width='0.494505'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.76917%205.73627H4.12906'%20stroke='white'%20stroke-width='0.494505'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const e2=({dayString:e})=>{const t=Xe(),n=Ii(t.userData,e);if(!n)return null;const r=n==="workout"?"Workout":Vl(n)+" Run",o=n==="easy"?Xh:n==="long"?Jh:Qh;return i.jsxs(W,{gap:4,style:{width:"100%",height:24,backgroundColor:"#262728",borderRadius:"4px",padding:n==="easy"?"0 2px":"0 4px",pointerEvents:"none"},children:[i.jsx("img",{src:o,style:{width:16,height:16}}),i.jsxs(R,{size:"xs",children:[r," Upcoming"]})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Sr="-1",br="phase-transition",Ar="pending-workout",t2=(e,t,n)=>{const r=[],o=[];let a=[],s=[];const c={activities:[],workouts:[],events:[],plans:[],supplementals:[]};for(const l of t){const u=e[l];u&&Xl(e,u)&&(c[u.category].push(u.id),Jl(u)&&r.push(u.id),On(u)&&o.push(u.id),Ql(u)&&a.push(u.id),eu(u)&&s.push(u.id))}return c.activities.sort(r2(e)),c.workouts.sort(o2(e)),a=a.filter(rs(e,n)),s=s.filter(rs(e,n)),[r,o,c.activities,a,c.workouts,s,c.events]},ts=20,Tr=20,st=6,ns=6,n2="YYYY-MM-DD",r2=e=>(t,n)=>{const r=e[t],o=e[n];if(!r||!o)return 0;if(r.category!=="activities"||o.category!=="activities")throw new Error("Can only sort activity entries with `sortRunsRecentFirst");return gd(r.data,o.data)},o2=e=>(t,n)=>{const r=e[t],o=e[n];if(!r||!o)return 0;if(r.category!=="workouts"||o.category!=="workouts")throw new Error("Can only sort workout entries with `sortWorkoutsByOrder");return r.data.order-o.data.order},rs=(e,t)=>n=>{const r=e[n];if(!r)return!1;const o=xe.tz(new Date,t.time_zone).subtract(1,"day").hour(23).minute(59).second(59);
1return xe.tz(r.start_date,t.time_zone).isAfter(o)},a2=(e,t)=>{var r;if(e.training_status==="inactive"||!((r=e.prefs)!=null&&r.guided_training))return!1;const n=Kl(e);return n?n.isSame(xe.tz(t,e.time_zone),"day"):!1},s2=({day:e,height:t})=>{const n=Re(),{userData:r,isEditable:o}=Xe(),a=Mi(),s=wn(),{useToday:c,useOpenedSeeMoreInDay:l,useMonthlyActiveMonthDate:u,useToolsDrawerOpened:h,useToolsDrawerActiveOption:p,useActions:f}=Dt(),{releaseWorkoutLibrary:k}=qo(),{setOpenedSeeMoreInDay:S}=f(),C=l(),y=u(),m=c(),[,d]=h(),[,g]=p(),[w,v]=Y.useState(!1),[x,b]=Y.useState(!1),A=Y.useMemo(()=>xe(e),[e]),T=Y.useMemo(()=>y.year()===A.year()&&y.month()===A.month(),[A,y]),I=Y.useMemo(()=>m.date()===A.date()&&m.month()===A.month()&&m.year()===A.year(),[A,m]),M=Y.useMemo(()=>A.format(n2),[A]),F=Y.useMemo(()=>{var L,V;return(V=(L=a[M])==null?void 0:L.entryIds)!=null?V:[]},[a,M]),P=Y.useMemo(()=>a2(r,e),[r,e]),B=Y.useMemo(()=>!!Ii(r,e),[r,e]),[E,H,te,me,fe,Q,le]=Y.useMemo(()=>t2(s,F,r),[s,r,F]);let we=[];const ue=[];let oe=t-ns*2-Tr;we=[...E,...fe,...te,...H.length>0?[Sr]:[],...le],P&&we.unshift(br),B&&we.unshift(Ar),we.map(L=>{const V=s[L];L===br&&oe>24+st?ue.push(br):L===Ar&&oe>24+st?ue.push(Ar):Gl(V)?oe>ba+st&&(ue.push(L),oe-=ba+st):ql(V)?oe>Po+st&&(ue.push(L),oe-=Po+st):Ul(V)||L===Sr?oe>Vn+st&&(ue.push(L),oe-=Vn+st):vi(V)&&oe>Ro+st&&(ue.push(L),oe-=Ro+st)});const Ce=we.length!==ue.length;Ce&&oe<=ts&&ue.pop();const G=C===M,j=(L,V)=>L.map((U,ye)=>U==="phase-transition"?i.jsx(Kh,{},U+ye):U==="pending-workout"?i.jsx(e2,{dayString:e},U+ye):U===Sr?i.jsx(Uh,{exercises:H},U+ye):i.jsx(Yc,{entryId:U,day:e,isInOverlay:V},U));return i.jsx(Dc,{id:"Droppable-"+M,data:{id:M,type:"day",day:A},children:({isOver:L,setNodeRef:V})=>i.jsxs(re,{ref:V,flex:1,miw:0,className:Nt.root,children:[i.jsxs(re,{gap:st,miw:0,pos:"relative",h:"100%",style:{borderTop:"1px solid #222",borderRight:"1px solid #222",backgroundColor:L?"#222":I?"#13243A":void 0,pointerEvents:L?"none":void 0,padding:ns},children:[i.jsxs(W,{justify:"center",align:"center",gap:4,children:[A.date()===1&&i.jsx(R,{size:"sm",className:xt(I&&Nt.today,T&&Nt.isInActiveMonth,Nt.abbr),children:A.format("MMM")}),i.jsx(W,{justify:"center",align:"center",className:xt(I&&Nt.today,T&&Nt.isInActiveMonth,Nt.day),style:{width:Tr,height:Tr},children:i.jsx(R,{size:"sm",children:A.date()})}),o&&i.jsxs(ve,{withinPortal:!1,children:[i.jsx(ve.Target,{children:i.jsx(et,{variant:"default",size:"xs",color:"gray",ml:4,className:Nt.dayMenuTarget,children:i.jsx(Zl,{})})}),i.jsxs(ve.Dropdown,{children:[i.jsx(ve.Item,{onClick:()=>v(!0),children:n.formatMessage({id:"Day.createWorkoutAction",defaultMessage:"Create Workout"})}),i.jsx(ve.Item,{onClick:()=>{b(!0),v(!0)},children:n.formatMessage({id:"Day.createTreadmillWorkoutAction",defaultMessage:"Create Treadmill Workout"})}),k&&i.jsx(ve.Item,{onClick:()=>{d(!0),g("workoutLibrary")},children:n.formatMessage({id:"Day.addWorkoutFromLibraryAction",defaultMessage:"Add Workout From Library"})})]})]})]}),j(ue,!1),Ce&&i.jsxs(Ke,{size:"xs",variant:"transparent",c:"white",justify:"flex-start",p:"xs",py:0,style:{border:"none",height:ts},onClick:()=>{S(M)},children:[we.length-ue.length," more..."]}),G&&i.jsxs(re,{pos:"absolute",px:"sm",py:"xs",pb:"lg",bg:"#1E1E20",gap:st,mih:"calc(100% - 8px)",style:{zIndex:100,borderRadius:4,border:"1px solid #555",top:8,left:8,right:8},children:[i.jsxs(W,{justify:"center",pos:"relative",py:2,children:[i.jsx(R,{ta:"center",size:"sm",children:A.format("ll")}),i.jsx(pl,{size:"sm",pos:"absolute",right:-6,top:0,onClick:()=>{S("")}})]}),j(we,!0)]})]}),i.jsx(Zn,{isCreatingTreadmillWorkout:x,dayString:e,opened:w,onClose:()=>{b(!1),v(!1)}})]})})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const i2=({weekDates:e,weekIndex:t})=>{const{useCalendarView:n,useActions:r}=Dt(),{setWeeklyVisibleIndex:o}=r(),[a,s]=n(),c=Mi(),l=wn(),{userData:u}=Xe(),h=Jo(u),p=Uo(u.units,h),f=Re(),k=y=>{const d=e.map(w=>{var v;return((v=c[w])==null?void 0:v.entryIds)||[]}).reduce((w,v)=>{const x=v.reduce((b,A)=>{const T=l[A];if(!T||T.category!=="activities")return b;const I=T.data[y];return typeof I!="number"?b:y==="stress"?b+Math.round(I):b+I},0);return w+x},0);let g;return y==="distance"?g=xi(d,u.units).toFixed(2):y==="moving_time"?g=en(d*1e3):y==="stress"||y==="lower_body_stress"?g=d.toFixed():y==="total_elevation_gain"?g=tu(d,u.units).toFixed():g="",g},S=[{key:"stress",unit:"RSS",displayName:f.formatMessage(wt.stress.translatableDisplayName)},{key:"lower_body_stress",unit:"LBSS",displayName:f.formatMessage(wt.lower_body_stress.translatableDisplayName)},{key:"distance",unit:p.distance,displayName:f.formatMessage(wt.distance.translatableDisplayName)},{key:"moving_time",displayName:f.formatMessage(wt.moving_time.translatableDisplayName)},{key:"total_elevation_gain",unit:p.elevation_gain,displayName:f.formatMessage(wt.elevation_gain.translatableDisplayName)}],C=Go();return Y.useMemo(()=>xe.tz(e[0],C).week(),[C,e]),i.jsxs(re,{flex:1,px:"sm",pb:"sm",pt:4,w:"100%",h:"100%",children:[i.jsx(W,{gap:4}),i.jsx(re,{gap:6,children:S.map(y=>{const m=y.key==="distance"||y.key==="total_elevation_gain";return i.jsxs(W,{justify:"space-between",children:[i.jsxs(W,{gap:4,children:[i.jsx(R,{size:"sm",children:y.displayName}),i.jsx(R,{size:"sm",children:y.unit&&m?i.jsxs(R,{size:"sm",children:["(",y.unit,")"]}):null})]}),i.jsx(W,{gap:2,children:i.jsx(R,{size:"sm",children:k(y.key)})})]},y.key)})})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const os=5,Mn=10,c2=({calendarRef:e,fetchRangeIndexes:t})=>{const{userData:n}=Xe(),{updateCalendarEntriesFromResponse:r}=Kn(),{useCalendarWeekDates:o,useTodayIndexInWeek:a,useShowWeekNumbers:s,useShowWeeklyRunningGraph:c,useActions:l}=Dt(),{setMonthlyVisibleStartIndex:u}=l(),h=o(),p=a(),[f]=s(),[k]=c(),S=k?1.1:3,[C,{height:y}]=Ri(),{mutateAsync:m}=_i(),d=({min:w,max:v})=>{w<0&&(w=0);const x=xe.tz(h[w][0],n.time_zone),b=xe.tz(h[v].at(-1),n.time_zone).add(1,"day");m({from:x.toDate(),to:b.toDate(),include_deleted:!1,userId:n.id}).then(A=>{r(A)}
1)},g=(w,v)=>{t.current.min===0&&t.current.max===0?(d({min:w,max:v}),t.current={min:w,max:v}):w<=t.current.min?(d({min:w-Mn,max:t.current.min-1}),t.current={...t.current,min:w-Mn}):v>=t.current.max&&(d({min:t.current.max+1,max:v+Mn}),t.current={...t.current,max:v+Mn})};return i.jsx(zn,{ref:C,flex:1,children:i.jsx(Ac,{ref:e,style:{height:"100%",width:"100%"},totalCount:h.length,initialTopMostItemIndex:p,itemContent:w=>{var b;const v=(b=h[w])!=null?b:[],x=y/S;return i.jsxs(W,{gap:0,flex:1,align:"stretch",style:{height:"".concat(x,"px")},children:[v.map(A=>i.jsx(s2,{day:A,height:x},A)),f&&i.jsx(W,{h:"100%",align:"flex-start",flex:1,miw:180,children:i.jsx(i2,{weekDates:v,weekIndex:w})}),i.jsx(W,{w:0,style:{height:x}})]})},itemsRendered:w=>{var v,x;if(w.length&&w.length>1){const b=w[0],A=w[w.length-1],T=b.index-os,I=A.index+os;g(T,I)}(v=w==null?void 0:w[0])!=null&&v.index&&u((x=w[Math.floor(w.length/2)-1])==null?void 0:x.index)}},y)})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const l2="_container_12u4f_1",u2="_title_12u4f_15",d2="_metrics_12u4f_19",h2="_stat_12u4f_24",_n={container:l2,title:u2,metrics:d2,stat:h2};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const f2=85,dt=(e,t)=>e.estimates.reduce((n,r)=>n+r[t],0),Rc=({workout:e,handleClick:t,setWorkoutBuilderModalOpened:n,setSaveToCollectionModalOpened:r,handleRemoveWorkoutFromCollection:o,isEditable:a})=>{var m;const s=Re(),{userData:c}=Xe(),l=Jo(c),u=Uo(c.units,l),h=e.workout,p=!!((m=h.tags)!=null&&m.includes("treadmill")),f=dt(e,"duration"),k=dt(e,"distance"),S=dt(e,"stress"),C=[{value:en(f*1e3)},{value:Zo(k,c.units).toFixed(2),unit:u.distance},{value:S.toFixed(),unit:"RSS"}],y="workout-library-".concat(h.id);return i.jsx(Rn,{id:h.id.toString(),data:{id:h.id.toString(),type:"workoutLibrary",workout:e},children:i.jsx(re,{style:{height:f2},gap:"0",onClick:t,children:i.jsxs(re,{h:"100%",className:xt([_n.container]),gap:0,id:y,children:[i.jsxs(W,{gap:4,className:_n.title,children:[i.jsx(R,{size:"sm",lineClamp:1,flex:1,style:{wordBreak:"break-all"},children:h.title}),i.jsxs(ve,{children:[i.jsx(ve.Target,{children:i.jsx(et,{variant:"subtle",size:"sm",color:"white",onClick:d=>{d.stopPropagation()},onMouseDown:d=>{d.stopPropagation()},children:i.jsx(Pi,{size:14})})}),i.jsxs(ve.Dropdown,{children:[a&&i.jsx(ve.Item,{leftSection:i.jsx(Ti,{size:14}),onClick:d=>{d.stopPropagation(),n==null||n(!0)},children:s.formatMessage({id:"WorkoutLibraryWorkoutCard.editAction",defaultMessage:"Edit"})}),i.jsx(ve.Item,{leftSection:i.jsx(ea,{size:14}),onClick:d=>{d.stopPropagation(),r==null||r(!0)},children:s.formatMessage({id:"WorkoutLibrary.saveToCollectionTitle",defaultMessage:"Save to collection"})}),a&&i.jsx(ve.Item,{leftSection:i.jsx(vn,{size:14}),onClick:d=>{d.stopPropagation(),ml.openConfirmModal({title:s.formatMessage({id:"action.remove"}),children:i.jsx(R,{size:"sm",children:s.formatMessage({id:"WorkoutLibraryWorkoutCard.removeConfirmMessage",defaultMessage:"Are you sure you want to remove it from the library?"})}),labels:{confirm:s.formatMessage({id:"action.delete"}),cancel:s.formatMessage({id:"action.cancel"})},confirmProps:{color:"red"},onCancel:()=>{},onConfirm:()=>{o==null||o(h.id.toString())}})},children:i.jsx(K,{id:"action.remove"})})]})]})]}),i.jsx(W,{w:"100%",align:"center",gap:"md",className:_n.metrics,children:C.map(d=>i.jsxs(R,{size:"xs",className:_n.stat,children:[i.jsx("span",{children:d.value}),i.jsx("span",{children:d.unit})]},d.value))}),i.jsx(ji,{workout:h,containerId:y,user:c}),i.jsx(W,{pos:"absolute",style:{bottom:4,left:4,right:4},justify:"flex-end",children:p&&i.jsx(W,{style:{padding:"3px",borderRadius:"50%",background:"rgba(35, 38, 43, 0.9)"},children:i.jsx(Ni,{size:16})})})]})})})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const p2=({children:e})=>{const t=Re(),{userData:n,isEditable:r}=Xe(),[o,a]=Y.useState(null),{mutateAsync:s}=nu(),{mutateAsync:c}=ru(),{mutateAsync:l}=ou(),{mutateAsync:u}=au({user:n}),{mutateAsync:h}=su(),{addCalendarEntries:p}=Kn(),f=iu(du,{activationConstraint:{distance:5}}),k=cu(f),S=t.formatMessage({id:"result.success"});return i.jsxs(lu,{sensors:k,onDragStart:({active:C})=>{a(C.data.current)},onDragEnd:C=>{if(!r)return a(null);const y=C.active.data.current.category?C.active.data.current:o;if(!C.over)return;const m=C.over.data.current;if((m==null?void 0:m.type)==="day"){if(m.id===(y==null?void 0:y.day))return;(y==null?void 0:y.type)==="workoutLibrary"?h({userId:n.id,workoutId:y.id,timestamp:xe.tz(m.id,n.time_zone).unix()}).then(d=>{p([Oi.workouts(d)]),Ue({message:S,variant:"success"})}).catch(d=>{Ue({message:d,variant:"error"})}):(y==null?void 0:y.category)==="workouts"?s({id:y.id,to:xe.tz(m.id,n.time_zone).toDate(),day:xe.tz(m.id,n.time_zone),order:0,timezone:n.time_zone,userId:n.id}).then(()=>{Ue({message:S,variant:"success"})}).catch(d=>{Ue({message:d,variant:"error"})}):(y==null?void 0:y.category)==="supplementals"&&c({id:y.id,day:m.day,timezone:n.time_zone}).then(()=>{Ue({message:S,variant:"success"})}).catch(d=>{Ue({message:d,variant:"error"})})}if((m==null?void 0:m.type)==="entry"){if((y==null?void 0:y.category)==="workouts"&&(m==null?void 0:m.category)==="activities"){l({workoutId:y==null?void 0:y.id,activityId:m==null?void 0:m.id}).then(()=>{Ue({message:S,variant:"success"})}).catch(d=>{Ue({message:d,variant:"error"})});return}if((y==null?void 0:y.category)==="events"&&(m==null?void 0:m.category)==="activities"){u({eventId:y==null?void 0:y.id,activityId:m==null?void 0:m.id}).then(()=>{Ue({message:S,variant:"success"})}).catch(d=>{Ue({message:d,variant:"error"})});return}}a(null)},children:[e,i.jsx(uu,{dropAnimation:null,children:o?o.category?i.jsx(Yc,{entryId:o.id,day:""}):o.workout&&i.jsx(Rc,{workout:o.workout}):null})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const m2=()=>{const e=$o(),t=Re(),[n]=hu(),{userData:r}
1=Xe(),[o,a]=Y.useState("fit"),[s,c]=Y.useState([null,null]),l=!(s&&s[0]&&s[1]),u=fu(()=>{const[h,p]=s||[];if(!h||!p)throw new Error("startDate or endDate is not valid");return e.activity.export(n,{from:xe(h).startOf("day").unix(),to:xe(p).tz(r.time_zone).add(1,"day").startOf("day").unix(),file_format:o})},{onSuccess:h=>{var p,f,k,S;(f=(p=h.err)==null?void 0:p.response)!=null&&f.data.message?Ue({message:(S=(k=h.err)==null?void 0:k.response)==null?void 0:S.data.message,variant:"error"}):Ue({message:t.formatMessage({id:"DownloadRunsForm.success"})})},onError:()=>{Ue({message:t.formatMessage({id:"DownloadRunsForm.error"}),variant:"error"})}});return i.jsxs(re,{px:2,gap:"xs",align:"flex-start",children:[i.jsx(Pn,{label:t.formatMessage({id:"DownloadRunsForm.fileFormatLabel",defaultMessage:"File Format"}),value:o,data:["fit","csv"],onChange:h=>a(h),w:"100%"}),i.jsx(re,{style:{minWidth:"100%"},children:i.jsx(pu,{type:"range",label:t.formatMessage({id:"ProfileCardPowerDurationCurve.legendTitle.dateRange"}),value:s,onChange:c})}),i.jsx(Ke,{variant:"outlined",loading:u.isLoading,disabled:l,onClick:()=>u.mutate(),size:"xs",children:i.jsx(K,{id:"ActionsOverlay.download"})})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const jr=5,g2=tt.div.withConfig({displayName:"PlansManager__Caret",componentId:"sc-1vbesbu-0"})(["display:inline-block;height:0;width:0;background:transparent;margin-left:",";border-top:","px solid ",";border-left:","px solid transparent;border-right:","px solid transparent;content:'';vertical-align:middle;transform:",";transition:transform 0.2s ease;"],_t.halfPadding,jr,e=>e.color||dn.themes.dark.text,jr,jr,e=>e.rotation?"rotate(".concat(e.rotation,")"):void 0),w2=tt.div.withConfig({displayName:"PlansManager__Container",componentId:"sc-1vbesbu-1"})(["width:100%;"]),v2=tt.ul.withConfig({displayName:"PlansManager__PlansList",componentId:"sc-1vbesbu-2"})(["margin:0;padding:0;"]),Oo=tt.div.withConfig({displayName:"PlansManager__PlanItemContainer",componentId:"sc-1vbesbu-3"})(["padding:",";border-radius:",";cursor:pointer;&:hover{background-color:",";}"],_t.halfPadding,_t.defaultBorderRadius,dn.themes.dark.backgroundLayers[2]),x2=tt.div.withConfig({displayName:"PlansManager__PlanControlContainer",componentId:"sc-1vbesbu-4"})(["margin-bottom:",";display:grid;grid-template-columns:15px 1fr;"],_t.defaultPadding),y2=tt.div.withConfig({displayName:"PlansManager__CaretContainer",componentId:"sc-1vbesbu-5"})(["grid-column:1;display:inline-flex;align-items:center;justify-content:flex-start;> *{margin:0;}"]),k2=tt(Oo).withConfig({displayName:"PlansManager__PlannedControlsHeading",componentId:"sc-1vbesbu-6"})(["grid-column:2;display:flex;flex-direction:column;> * + *{margin-top:5px;}"]),C2=tt.div.withConfig({displayName:"PlansManager__ControlOptionsColumn",componentId:"sc-1vbesbu-7"})(["grid-column:2;transform-origin:top left;"]),Pc=tt.span.withConfig({displayName:"PlansManager__Badge",componentId:"sc-1vbesbu-8"})(["display:inline;font-size:0.75rem;padding:2px 6px;margin-left:",";border-radius:6px;"],_t.halfPadding),S2=tt(Pc).withConfig({displayName:"PlansManager__ActiveBadge",componentId:"sc-1vbesbu-9"})(["background:rgba(33,176,144,0.3);color:#21b090;"]),b2=tt(Pc).withConfig({displayName:"PlansManager__PausedBadge",componentId:"sc-1vbesbu-10"})(["background:rgba(127,127,127,0.3);"]),as=tt.div.withConfig({displayName:"PlansManager__ControlOptionRow",componentId:"sc-1vbesbu-11"})(["display:flex;align-items:center;"]),ss=tt.span.withConfig({displayName:"PlansManager__ControlLabel",componentId:"sc-1vbesbu-12"})(["margin-left:",";"],_t.halfPadding),A2=e=>!!e&&e.category==="plans"&&!e.deleted,Oc=e=>{const t=new Date;return Un(e.start_date,t)},T2=e=>{const t=new Date,n=wd(e.start_date,e.data.plan.week_length);return gl(t,n)},j2=e=>!e.deleted&&!e.data.paused&&Oc(e)&&!T2(e),N2=(e,t)=>Un(e.start_date,t.start_date)?-1:1,I2=e=>{const{plan:t}=e,n=Re(),[r,o]=Y.useState(!1),{userData:a}=Xe(),s=mu("personalized_plans"),{mutate:c,isLoading:l}=gu(a.id),{mutate:u,isLoading:h}=wu(),p=()=>t.data.paused?n.formatMessage({id:"PlansManager.resumeActionText",defaultMessage:"Resume plan"}):n.formatMessage({id:"PlansManager.pauseActionText",defaultMessage:"Pause plan"}),f=async w=>{window.confirm("Are you sure you want to delete ".concat(t.data.plan.name,"?"))&&(w.stopPropagation(),w.preventDefault(),c({planId:t.id}))},k=async()=>{h||u({planId:t.id})},S=n.formatDate(Io.utcToZonedTime(t.start_date,a.time_zone)),C=t.data.paused?i.jsx(b2,{children:i.jsx(K,{id:"PlansManager.pausedBadgeText",defaultMessage:"Paused"})}):j2(t)?i.jsx(S2,{children:i.jsx(K,{id:"PlansManager.activeBadgeText",defaultMessage:"Active"})}):null,y=t.data.paused?i.jsx(x1,{size:16}):i.jsx(w1,{size:16}),m=Pt({id:"PlansManager.planStarted",defaultMessage:"Started {date}"}),d=Pt({id:"PlansManager.planBegins",defaultMessage:"Begins {date}"}),g=Oc(t)?m:d;return i.jsxs(x2,{children:[i.jsx(y2,{children:i.jsx(g2,{rotation:r?"0deg":"-90deg"})}),i.jsxs(k2,{onClick:()=>o(w=>!w),children:[i.jsx("span",{style:{color:dn.themes.dark.headerText},children:t.data.plan.name}),i.jsxs("span",{style:{fontSize:"0.8rem",color:dn.themes.dark.text,display:"flex",alignItems:"center",minHeight:"16px"},children:[n.formatMessage(g,{date:S}),C]})]}),r&&i.jsxs(C2,{children:[s.accessGranted&&i.jsx(Oo,{onClick:k,children:i.jsxs(as,{children:[y,i.jsx(ss,{children:p()})]})}),i.jsx(Oo,{onClick:f,children:i.jsxs(as,{children:[i.jsx(vn,{size:16}),i.jsx(ss,{children:l?n.formatMessage({id:"PlansManager.deleteActionLoadingText",defaultMessage:"Deleting..."}):n.formatMessage({id:"PlansManager.deleteActionDefaultText",defaultMessage:"Delete Plan"})})]})})]},"content")]})},M2=()=>{const e=Fi(),t=Y.useMemo(()=>e.filter(A2).sort(N2),[e]),n=()=>t.map(o=>i.jsx("li",{style:{listStyle:"none"},children:i.jsx(I2,{plan:o})},o.id)),r=i.jsxs(i.Fragment,{children:[i.jsx("p",{style:{color:dn.themes.dark.headerText},children:i.jsx(K,{id:"PlansManager.noPlans.title",defaultMessage:"No Plans"})}),i.jsx("p",{style:{fontSize:"0.9rem"},children:i.jsx(K,{id:"PlansManager.noPlans.description",defaultMessage:"Sign up for training plans using the Stryd mobile app."})})]});return i.jsx(w2,{children:i.jsx(v2,{children:t.length>0?n():r})})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const _2=tt.form.withConfig({displayName:"UploadRunsForm__Form",componentId:"zmicf1-0"})(["margin-top:",";width:100%;height:100%;min-height:0;overflow-y:auto;> *{margin-bottom:",";}> div > div{background:none;border:none;}"],_t.halfPadding,_t.halfPadding);let F2=-1;const D2=()=>++F2,E2=e=>[...e].sort((n,r)=>Un(n.updated_date,r.updated_date)?1:-1)[0],L2=xu(E2),Y2=()=>{const e=wl(),[t,n]=Y.useState([]),r=$o(),{userData:o}=Xe(),a=Re(),s=Fi(),[c,l]=Y.useState(null),{updateCalendarLoadedDateRanges:u,updateCalendarEntriesFromResponse:h}=Kn(),p=L2(s);vu({include_deleted:!1,userId:o.id,updated_after:c},{enabled:!!c,onSuccess:m=>{h(m),c&&u({from:c,to:new Date,userId:o.id})}});const f=(m,d)=>g=>{const w=[...g],v=w.find(x=>x.id===m);
1return v?(v.error=d,v.status=pr.Error,w):g},k=m=>d=>{const g=[...d],w=g.find(v=>v.id===m);return w?(xl.trackEvent("run_file_uploaded",{filename:w.data.name}),w.status=pr.Success,g):d},S=(m,d,g)=>{g.stopPropagation(),n(w=>yu(w,d))},C=async m=>{const d=vl.getToken();if(!d)throw new Error("Could not find user token in localStorage.");const g=await r.platform.uploadActivityFile({file:m.data,userToken:d});if(!g.ok){const w=g.err.response?typeof g.err.response.data=="string"?g.err.response.data:g.err.response.data.message:a.formatMessage({id:"UploadRunsForm.genericErrMsg",defaultMessage:"Could not upload file."});n(f(m.id,w));return}n(k(m.id))},y=async m=>{if(m.length===0)return;const d=m.map(w=>({data:w,status:pr.Loading,id:D2()}));n(w=>[...w,...d]);const g=d.map(w=>C(w));await Promise.all(g),l(p?p.updated_date:ku(new Date,90)),setTimeout(()=>{e.invalidateQueries(["recent-runs"])},500)};return i.jsx(_2,{children:i.jsx(vd,{label:a.formatMessage({id:"UploadRunsForm.fileSelectorLabel",defaultMessage:"File (FIT or TCX)"}),files:t,onDrop:y,onClear:S,acceptedFileTypes:[".fit",".tcx"],placeholder:a.formatMessage({id:"UploadRunsForm.fileSelectorActionMessage",defaultMessage:"Select Files"})})})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const R2=({filterState:e,setFilterState:t,maxDistanceInWorkouts:n,maxStressInWorkouts:r,maxDurationInWorkouts:o,workoutTypeCountMap:a,onClear:s})=>{var g,w,v;const c=Re(),{workoutTypes:l,minDistance:u,maxDistance:h,minDuration:p,maxDuration:f,minStress:k,maxStress:S}=e,C=bu(),{userData:y}=Xe(),m=xd();let d=0;return l.length&&(d+=l.length),(p||f)&&(d+=1),(u||h)&&(d+=1),(k||S)&&(d+=1),i.jsxs(ve,{shadow:"md",width:400,closeOnItemClick:!1,position:"left-start",children:[i.jsx(ve.Target,{children:i.jsx(Ko,{label:c.formatMessage({id:"dataDisplay.filter"}),color:"dark",children:i.jsx(Yi,{size:"6",disabled:!d,children:i.jsx(et,{variant:"default",size:"sm",children:i.jsx(s1,{size:16})})})})}),i.jsxs(ve.Dropdown,{children:[i.jsxs(ve.Label,{children:[c.formatMessage({id:"dataDisplay.filter"}),i.jsx(Ke,{size:"compact-xs",variant:"subtle",ml:"sm",onClick:s,children:i.jsx(K,{id:"action.clear"})})]}),i.jsxs(re,{px:"sm",pb:"md",gap:"xs",children:[i.jsx(W,{gap:"xs",children:i.jsx(R,{size:"sm",children:i.jsx(K,{id:"workoutTypeLabel"})})}),i.jsx(W,{gap:4,children:C.map(({label:x,value:b})=>{if(!a[b])return;const A=l.includes(b);return i.jsxs(Au,{style:{outline:A?"1px solid #fff":void 0,cursor:"pointer"},onClick:()=>{t(T=>({...T,workoutTypes:A?T.workoutTypes.filter(I=>I!==b):[...T.workoutTypes,b]}))},children:[x," (",a[b],")"]},b)})}),i.jsx(R,{size:"sm",children:i.jsx(K,{...(g=wt.duration)==null?void 0:g.translatableDisplayName})}),i.jsx(an,{color:"blue",min:0,max:o+60,minRange:1,step:60,label:x=>xe.duration(x*1e3).format("HH:mm:ss"),value:[p||0,f||o+60],onChange:([x,b])=>{t(A=>({...A,minDuration:x,maxDuration:b}))}}),i.jsx(R,{size:"sm",children:i.jsx(K,{...(w=wt.distance)==null?void 0:w.translatableDisplayName})}
1),i.jsx(an,{color:"blue",min:0,max:n,minRange:1,step:1,label:x=>"".concat(Zo(x,y.units).toFixed(2)," ").concat(m.distance),value:[u||0,h||n],onChange:([x,b])=>{t(A=>({...A,minDistance:x,maxDistance:b}))}}),i.jsx(R,{size:"sm",children:i.jsx(K,{...(v=wt.stress)==null?void 0:v.translatableDisplayName})}),i.jsx(an,{color:"blue",min:0,max:r,minRange:1,step:1,value:[k||0,S||400],onChange:([x,b])=>{t(A=>({...A,minStress:x,maxStress:b}))}})]})]})]})},P2=({sortState:e,setSortState:t})=>{const n=Re(),r=[{key:"title",label:"dataDisplay.sortByAlphabetical"},{key:"distance",label:"dataDisplay.sortByDistance"},{key:"duration",label:"dataDisplay.sortByDuration"},{key:"stress",label:"dataDisplay.sortByStress"}];return i.jsxs(ve,{shadow:"md",width:200,closeOnItemClick:!1,children:[i.jsx(ve.Target,{children:i.jsx(Ko,{label:n.formatMessage({id:"dataDisplay.sort"}),color:"dark",children:i.jsx(Yi,{size:"6",disabled:!0,children:i.jsx(et,{variant:"default",size:"sm",children:i.jsx(Tu,{size:16})})})})}),i.jsxs(ve.Dropdown,{children:[i.jsx(ve.Label,{children:n.formatMessage({id:"dataDisplay.sort"})}),r.map(({key:o,label:a})=>i.jsx(ve.Item,{rightSection:e.key===o?e.asc?i.jsx(ju,{size:14}):i.jsx(Nu,{size:14}):null,onClick:()=>{e.key===o?t(s=>({...s,asc:!s.asc})):t({key:o,asc:!0})},children:i.jsx(K,{id:a})},o))]})]})},O2=e=>{var n,r,o;const t=[];return(o=(r=(n=e==null?void 0:e[0])==null?void 0:n.library)==null?void 0:r.content)==null||o.forEach(a=>{var s,c;(s=e==null?void 0:e[0].collections)!=null&&s[a]&&t.push((c=e==null?void 0:e[0].collections)==null?void 0:c[a])}),t},is={workoutTypes:[],minDistance:void 0,maxDistance:void 0,minDuration:void 0,maxDuration:void 0,minStress:void 0,maxStress:void 0},z2=()=>{const e=Re(),{userData:t}=Xe(),{data:n,isInitialLoading:r}=Cu(),{userCollections:o,userWorkoutLibraries:a,userLibrary:s,updateCollection:c,refreshUserWorkoutLibraries:l,addNewCollection:u,isAddingNewCollection:h,isUpdateingCollection:p,isLoadingUserWorkoutLibraries:f}=bi(),k=Y.useMemo(()=>O2(n),[n]),[S,C]=Y.useState(""),[y,m]=Y.useState(!1),[d,g]=Y.useState(""),w=r||f,[v,x]=Y.useState(null),[b,A]=Y.useState(null),[T,I]=Y.useState(!1),[M,F]=Y.useState({key:"title",asc:!0}),[P,B]=Y.useState(is),{workouts:E,maxDistanceInWorkouts:H,maxStressInWorkouts:te,maxDurationInWorkouts:me,workoutTypeCountMap:fe}=Y.useMemo(()=>{const Z=[...o,...k],se=v?Z.filter(pe=>pe.id===v):Z;let de=[];se.forEach(pe=>{var Ne;(Ne=pe==null?void 0:pe.workouts)==null||Ne.forEach(je=>{var Ee,X,_e,Le;(Ee=a==null?void 0:a[0].workouts)!=null&&Ee[je]?de.push((X=a[0].workouts)==null?void 0:X[je]):(_e=n==null?void 0:n[0].workouts)!=null&&_e[je]&&de.push((Le=n==null?void 0:n[0].workouts)==null?void 0:Le[je])})});let Ae=0,Qe=0,We=0;const $e={};return de.forEach(pe=>{const Ne=dt(pe,"stress"),je=dt(pe,"distance"),Ee=dt(pe,"duration");Ne>Ae&&(Ae=Ne),je>Qe&&(Qe=je),Ee>We&&(We=Ee),pe.workout.type&&($e[pe.workout.type]||($e[pe.workout.type]=0),$e[pe.workout.type]++)}),de=de.filter(pe=>{const{workoutTypes:Ne,minDistance:je,maxDistance:Ee,minDuration:X,maxDuration:_e,minStress:Le,maxStress:lt}=P;if(Ne.length&&!Ne.includes(pe.workout.type))return!1;if(typeof je=="number"||typeof Ee=="number"){const J=typeof je=="number"?je:-1/0,$=typeof Ee=="number"?Ee:1/0,Fe=dt(pe,"distance");if(Fe<J||Fe>$)return!1}if(typeof Le=="number"||typeof lt=="number"){const J=typeof Le=="number"?Le:-1/0,$=typeof lt=="number"?lt:1/0,Fe=dt(pe,"stress");if(Fe<J||Fe>$)return!1}if(typeof X=="number"||typeof _e=="number"){const J=X||-1/0,$=_e||1/0,Fe=dt(pe,"duration");if(Fe<J||Fe>$)return!1}return!0}),de.sort((pe,Ne)=>{const{key:je,asc:Ee}=M;if(je==="title")return Ee?pe.workout.title.localeCompare(Ne.workout.title):Ne.workout.title.localeCompare(pe.workout.title);if(je==="duration"||je==="distance"||je==="stress"){const X=dt(pe,je),_e=dt(Ne,je);return Ee?X-_e:_e-X}return 1}),{workouts:de,maxStressInWorkouts:Ae,maxDistanceInWorkouts:Qe,maxDurationInWorkouts:We,workoutTypeCountMap:$e}},[v,P,o,M,k,a,n]),Q=Y.useRef(null),[le,we]=Y.useState(!1),[ue,oe]=Y.useState(!1),[Ce,G]=Y.useState(""),j=async()=>{if(!s||!Ce)return;const Z=await u({libraryId:s.id,collectionTitle:Ce});Z&&(l(),x(Z.id),A(Z.id),we(!1),G(""))},{mutateAsync:L,isLoading:V}=Ai(),U=async()=>{var Ae,Qe,We,$e;if(!b||!d||!s)return;const Z=o.find(pe=>pe.id===b);if(!Z)return;const se=((Qe=(Ae=a==null?void 0:a[0].workouts)==null?void 0:Ae[d])==null?void 0:Qe.workout)||(($e=(We=n==null?void 0:n[0].workouts)==null?void 0:We[d])==null?void 0:$e.workout);if(!se)return;const de=await L({workout:se});de&&(await c({libraryId:s.id,collectionId:b,collection:{...Z,workouts:[...Z.workouts||[],de==null?void 0:de.id.toString()]}}),l(),A(""),g(""),oe(!1))},ye=async Z=>{if(!s)return;const se=o.find(de=>(de.workouts||[]).find(Ae=>Ae===Z));se&&(await c({libraryId:s.id,collectionId:se.id,collection:{...se,workouts:(se.workouts||[]).filter(de=>de!==Z)}}),l())},O=E.find(Z=>Z.workout.id.toString()===S),be=O?Oi.workouts({...O,id_str:O.workout.id,user_id:t.id,date:O.workout.created_time}):null,ze=Z=>o.every(se=>{var de;return!((de=se.workouts)!=null&&de.find(Ae=>Ae===Z))}),qe=be?ze(be==null?void 0:be.id.toString()):!1;return i.jsxs(re,{flex:1,h:"100vh",w:"100%",children:[w?i.jsx(re,{align:"center",justify:"center",my:"md",children:i.jsx(yl,{size:"sm"})}):i.jsxs(i.Fragment,{children:[i.jsx(Pn,{label:e.formatMessage({id:"WorkoutLibrary.collectionLabel"}),clearable:!0,data:[{label:e.formatMessage({id:"WorkoutLibrary.createNewCollectionTitle",defaultMessage:"Create new collection"}),value:"+"},{group:"My Collections",items:o.map(Z=>({label:Z.title,value:Z.id}))},{group:"System Collections",items:k.map(Z=>({label:Z.title,value:Z.id}))}],placeholder:e.formatMessage({id:"WorkoutLibrary.collectionSelectPlaceholder"}
1),value:v,onChange:Z=>{Z==="+"?we(!0):x(Z)}}),E&&i.jsxs(re,{flex:1,children:[i.jsxs(W,{justify:"space-between",align:"center",children:[i.jsxs(W,{gap:"xs",align:"center",children:[i.jsx(R2,{filterState:P,setFilterState:B,maxDistanceInWorkouts:H,maxStressInWorkouts:te,maxDurationInWorkouts:me,workoutTypeCountMap:fe,onClear:()=>B(is)}),i.jsx(P2,{sortState:M,setSortState:F})]}),i.jsx(R,{size:"sm",children:i.jsx(K,{id:"WorkoutLibrary.resultsCount",values:{count:E.length}})})]}),i.jsx(re,{flex:1,children:i.jsx(Ac,{ref:Q,style:{height:"100%",width:"100%"},totalCount:E.length,itemContent:Z=>{const se=E[Z];return i.jsx("div",{style:{marginBottom:12},children:i.jsx(Rc,{workout:se,handleClick:()=>{m(!0),C(se.workout.id.toString())},setWorkoutBuilderModalOpened:de=>{C(se.workout.id.toString()),I(de)},setSaveToCollectionModalOpened:de=>{g(se.workout.id.toString()),oe(de)},handleRemoveWorkoutFromCollection:ye,isEditable:!ze(se.workout.id.toString())},se.workout.id)})}})})]})]}),!!be&&i.jsx(Su,{isOpen:y,onDismiss:()=>{C(""),m(!1)},user:t,entry:be,hideDate:!0,isInWorkoutLibrary:!0,hideEditButton:qe}),i.jsx(zt,{opened:ue,onClose:()=>oe(!1),title:e.formatMessage({id:"WorkoutLibrary.saveToCollectionTitle",defaultMessage:"Save to collection"}),children:i.jsxs(re,{children:[i.jsx(Pn,{value:b,onChange:Z=>{Z?A(Z):we(!0)},placeholder:e.formatMessage({id:"WorkoutLibrary.addToCollectionPlaceholder",defaultMessage:"Add to workout collection"}),data:[{label:e.formatMessage({id:"WorkoutLibrary.createNewCollectionOption",defaultMessage:"+ Create new collection"}),value:""},...o.map(({title:Z,id:se})=>({label:Z,value:se}))]}),i.jsxs(W,{justify:"end",children:[i.jsx(Ke,{size:"xs",variant:"default",onClick:()=>oe(!1),children:e.formatMessage({id:"action.dismiss"})}),i.jsx(Ke,{size:"xs",loading:p,onClick:U,disabled:!b,children:e.formatMessage({id:"action.save",defaultMessage:"Save"})})]})]})}),i.jsx(zt,{opened:le,onClose:()=>we(!1),title:e.formatMessage({id:"WorkoutLibrary.createNewCollectionTitle",defaultMessage:"Create new collection"}),children:i.jsxs(re,{children:[i.jsx(Ei,{placeholder:e.formatMessage({id:"WorkoutLibrary.collectionTitleLabel",defaultMessage:"Collection title"}),value:Ce,onChange:Z=>G(Z.target.value)}),i.jsxs(W,{justify:"end",children:[i.jsx(Ke,{size:"xs",variant:"default",onClick:()=>we(!1),children:e.formatMessage({id:"action.dismiss"})}),i.jsx(Ke,{size:"xs",loading:h,onClick:j,disabled:!Ce,children:e.formatMessage({id:"action.save",defaultMessage:"Save"})})]})]})}),i.jsx(W,{ml:"auto",children:T&&be&&i.jsx(Zn,{isInWorkoutLibrary:!0,entry:be,opened:T,onClose:()=>I(!1)})})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const W2=()=>{const{useShowWeekNumbers:e,useExpandAllCards:t}=Dt(),[n,r]=Iu(),[o,a]=e();kl().userLocale;const{userData:c}=Xe();return Y.useMemo(()=>{let l=xe.tz(new Date,c.time_zone);for(;l.day()!==0;)l=l.add(1,"day");const u=[];for(let h=0;h<7;h++)u.push({label:l.add(h,"day").format("dddd"),value:h.toString()});return u},[c.time_zone]),i.jsx(re,{pt:"xs",children:i.jsx(Mu,{size:"sm",checked:o,label:i.jsx(K,{id:"CalendarSideDrawer.settings.showWeekSummary"}),onChange:l=>a(l.currentTarget.checked)})})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const H2=()=>{var C;const{releaseWorkoutLibrary:e}=qo(),[t,n]=Y.useState(!1),[r,o]=Y.useState(!1),[a,s]=Y.useState(!1);_u({onDragStart:({active:y})=>{var m;((m=y==null?void 0:y.data.current)==null?void 0:m.type)==="workoutLibrary"&&s(!0)},onDragEnd:()=>s(!1)});const c=[{key:"settings",label:"CalendarSideDrawer.settingsIconTitle",icon:()=>i.jsx(Eu,{color:"white",size:18})},{key:"trainingPlans",label:"CalendarSideDrawer.trainingPlansIconTitle",icon:()=>i.jsx(m1,{color:"white",size:18})},{key:"uploadRuns",label:"CalendarSideDrawer.uploadRunsIconTitle",icon:()=>i.jsx(k1,{color:"white",size:18})},{key:"downloadRuns",label:"CalendarSideDrawer.downloadRunsIconTitle",icon:()=>i.jsx(Lu,{color:"white",size:18})}];e&&c.push({key:"workoutLibrary",label:"CalendarSideDrawer.workoutLibraryIconTitle",icon:()=>i.jsx(ea,{color:"white",size:18})});const{useToolsDrawerOpened:l,useToolsDrawerActiveOption:u}=Dt(),[h,p]=l(),[f,k]=u(),S=(C=c.find(y=>y.key===f))==null?void 0:C.label;return i.jsxs(i.Fragment,{children:[i.jsxs(re,{align:"center",pos:"relative",w:"2rem",gap:"xs",py:"xs",pt:"lg",style:{borderLeft:"1px solid #222"},bg:"var(--mantine-color-dark-8)",children:[c.map(y=>i.jsx(Ko,{label:i.jsx(K,{id:y.label}),children:i.jsx(et,{variant:"subtle",size:"sm",onClick:()=>{k(y.key),p(!0)},children:i.jsx(y.icon,{})})},y.key)),i.jsx(et,{size:"sm",variant:"default",c:"white",pos:"absolute",top:"50%",left:0,style:{transform:"translate3d(-50%, 0, 0)"},onClick:()=>p(!0),children:h?i.jsx(Fu,{size:16}):i.jsx(Du,{size:16})})]}),i.jsx(pt,{opened:h,onClose:()=>p(!1),title:f==="workoutLibrary"?i.jsxs(W,{children:[i.jsx(K,{id:S}),i.jsxs(ve,{children:[i.jsx(ve.Target,{children:i.jsx(et,{variant:"default",size:"sm",children:"+"})}),i.jsxs(ve.Dropdown,{children:[i.jsx(ve.Item,{onClick:()=>n(!0),children:i.jsx(K,{id:"Day.createWorkoutAction",defaultMessage:"Create Workout"})}),i.jsx(ve.Item,{onClick:()=>{o(!0),n(!0)},children:i.jsx(K,{id:"Day.createTreadmillWorkoutAction",defaultMessage:"Create Treadmill Workout"})})]})]})]}):i.jsx(K,{id:S}),position:"right",size:"18rem",overlayProps:{style:{background:a?"transparent":void 0}},styles:{content:{borderLeft:"1px solid #222"},body:{height:"calc(100vh - 80px)"}},children:i.jsxs(W,{align:"stretch",wrap:"nowrap",h:"100%",children:[i.jsx(re,{gap:"xs",p:"8",style:{border:"1px solid #333",borderRadius:4,alignSelf:"flex-start"},children:c.map(y=>i.jsx(et,{variant:f===y.key?"light":"subtle",onClick:()=>{k(y.key)},children:i.jsx(y.icon,{})},y.key))}),i.jsxs(re,{flex:1,children:[f==="settings"&&i.jsx(W2,{}),f==="trainingPlans"&&i.jsx(M2,{}),f==="uploadRuns"&&i.jsx(Y2,{}),f==="downloadRuns"&&i.jsx(m2,{}),e&&f==="workoutLibrary"&&i.jsx(z2,{})]})]})}),i.jsx(W,{ml:"auto",children:t&&i.jsx(Zn,{isInWorkoutLibrary:!0,isCreatingTreadmillWorkout:r,opened:t,onClose:()=>{o(!1),n(!1)}})})]})};var B2=Wu("domain","range","reverse","unknown");function $2(e){return B2(Yu(),e)}function V2(e){if((typeof e=="function"||typeof e=="object"&&e)&&"valueOf"in e){var t=e.valueOf();if(typeof t=="number")return t}return e}function G2(e,t){var n=e;return"ticks"in n?n.ticks(t):n.domain().filter(function(r,o,a){return t==null||a.length<=t||o%Math.round((a.length-1)/t)===0})}function q2(e){return e==null?void 0:e.toString()}var cs={ascending:Gi,descending:E1,insideout:L1,none:Kt,reverse:Y1};function U2(e){return e&&cs[e]||cs.none}var ls={expand:N1,diverging:I1,none:Zt,silhouette:M1,wiggle:_1};function Z2(e){return e&&ls[e]||ls.none}function K2(e){if("bandwidth"in e)return e.bandwidth();var t=e.range(),n=e.domain();return Math.abs(t[t.length-1]-t[0])/n.length}function X2(e){return e==null?void 0:e[0]}function J2(e){return e==null?void 0:e[1]}var Q2=["data","className","top","left","x","y0","y1","xScale","yScale","color","keys","value","order","offset","children"];function zo(){return zo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zo.apply(this,arguments)}function ef(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function tf(e){var t=e.data,n=e.className,r=e.top,o=e.left,a=e.x,s=e.y0,c=s===void 0?X2:s,l=e.y1,u=l===void 0?J2:l,h=e.xScale,p=e.
1yScale,f=e.color,k=e.keys,S=e.value,C=e.order,y=e.offset,m=e.children,d=ef(e,Q2),g=j1();k&&g.keys(k),S&&id(g.value,S),C&&g.order(U2(C)),y&&g.offset(Z2(y));var w=g(t),v=K2(h),x=w.map(function(b,A){var T=b.key;return{index:A,key:T,bars:b.map(function(I,M){var F=(p(c(I))||0)-(p(u(I))||0),P=p(u(I)),B="bandwidth"in h?h(a(I.data)):Math.max((h(a(I.data))||0)-v/2);return{bar:I,key:T,index:M,height:F,width:v,x:B||0,y:P||0,color:f(b.key,M)}})}});return m?N.createElement(N.Fragment,null,m(x)):N.createElement(qt,{className:xt("visx-bar-stack",n),top:r,left:o},x.map(function(b){return b.bars.map(function(A){return N.createElement(Di,zo({key:"bar-stack-"+b.index+"-"+A.index,x:A.x,y:A.y,height:A.height,width:A.width,fill:A.color},d))})}))}var Nr,us;function nf(){if(us)return Nr;us=1,Nr=e;function e(r,o,a){r instanceof RegExp&&(r=t(r,a)),o instanceof RegExp&&(o=t(o,a));var s=n(r,o,a);return s&&{start:s[0],end:s[1],pre:a.slice(0,s[0]),body:a.slice(s[0]+r.length,s[1]),post:a.slice(s[1]+o.length)}}function t(r,o){var a=o.match(r);return a?a[0]:null}e.range=n;function n(r,o,a){var s,c,l,u,h,p=a.indexOf(r),f=a.indexOf(o,p+1),k=p;if(p>=0&&f>0){for(s=[],l=a.length;k>=0&&!h;)k==p?(s.push(k),p=a.indexOf(r,k+1)):s.length==1?h=[s.pop(),f]:(c=s.pop(),c<l&&(l=c,u=f),f=a.indexOf(o,k+1)),k=p<f&&p>=0?p:f;s.length&&(h=[l,u])}return h}return Nr}var Ir,ds;function rf(){if(ds)return Ir;ds=1,Ir=e;function e(r,o,a){r instanceof RegExp&&(r=t(r,a)),o instanceof RegExp&&(o=t(o,a));var s=n(r,o,a);return s&&{start:s[0],end:s[1],pre:a.slice(0,s[0]),body:a.slice(s[0]+r.length,s[1]),post:a.slice(s[1]+o.length)}}function t(r,o){var a=o.match(r);return a?a[0]:null}e.range=n;function n(r,o,a){var s,c,l,u,h,p=a.indexOf(r),f=a.indexOf(o,p+1),k=p;if(p>=0&&f>0){if(r===o)return[p,f];for(s=[],l=a.length;k>=0&&!h;)k==p?(s.push(k),p=a.indexOf(r,k+1)):s.length==1?h=[s.pop(),f]:(c=s.pop(),c<l&&(l=c,u=f),f=a.indexOf(o,k+1)),k=p<f&&p>=0?p:f;s.length&&(h=[l,u])}return h}return Ir}var Mr,hs;function of(){if(hs)return Mr;hs=1;var e=rf();Mr=t;function t(o,a,s){var c=o;return n(o,a).reduce(function(l,u){return l.replace(u.functionIdentifier+"("+u.matches.body+")",r(u.matches.body,u.functionIdentifier,s,c,a))},o)}function n(o,a){var s=[],c=typeof a=="string"?new RegExp("\\b("+a+")\\("):a;do{var l=c.exec(o);if(!l)return s;if(l[1]===void 0)throw new Error("Missing the first couple of parenthesis to get the function identifier in "+a);var u=l[1],h=l.index,p=e("(",")",o.substring(h));if(!p||p.start!==l[0].length-1)throw new SyntaxError(u+"(): missing closing ')' in the value '"+o+"'");s.push({matches:p,functionIdentifier:u}),o=p.post}while(c.test(o));return s}function r(o,a,s,c,l){return s(t(o,l,s),a,c)}return Mr}var _r,fs;function af(){if(fs)return _r;fs=1;var e=function(t){this.value=t};return e.math={isDegree:!0,acos:function(t){return e.math.isDegree?180/Math.PI*Math.acos(t):Math.acos(t)},add:function(t,n){return t+n},asin:function(t){return e.math.isDegree?180/Math.PI*Math.asin(t):Math.asin(t)},atan:function(t){return e.math.isDegree?180/Math.PI*Math.atan(t):Math.atan(t)},acosh:function(t){return Math.log(t+Math.sqrt(t*t-1))},asinh:function(t){return Math.log(t+Math.sqrt(t*t+1))},atanh:function(t){return Math.log((1+t)/(1-t))},C:function(t,n){var r=1,o=t-n,a=n;a<o&&(a=o,o=n);for(var s=a+1;s<=t;s++)r*=s;return r/e.math.fact(o)},changeSign:function(t){return-t},cos:function(t){return e.math.isDegree&&(t=e.math.toRadian(t)),Math.cos(t)},cosh:function(t){return(Math.pow(Math.E,t)+Math.pow(Math.E,-1*t))/2},div:function(t,n){return t/n},fact:function(t){if(t%1!==0)return"NaN";for(var n=1,r=2;r<=t;r++)n*=r;return n},inverse:function(t){return 1/t},log:function(t){return Math.log(t)/Math.log(10)},mod:function(t,n){return t%n},mul:function(t,n){return t*n},P:function(t,n){for(var r=1,o=Math.floor(t)-Math.floor(n)+1;o<=Math.floor(t);o++)r*=o;return r},Pi:function(t,n,r){for(var o=1,a=t;a<=n;a++)o*=Number(r.postfixEval({n:a}));return o},pow10x:function(t){for(var n=1;t--;)n*=10;return n},sigma:function(t,n,r){for(var o=0,a=t;a<=n;a++)o+=Number(r.postfixEval({n:a}));return o},sin:function(t){return e.math.isDegree&&(t=e.math.toRadian(t)),Math.sin(t)},sinh:function(t){return(Math.pow(Math.E,t)-Math.pow(Math.E,-1*t))/2},sub:function(t,n){return t-n},tan:function(t){return e.math.isDegree&&(t=e.math.toRadian(t)),Math.tan(t)},tanh:function(t){return e.sinha(t)/e.cosha(t)},toRadian:function(t){return t*Math.PI/180},and:function(t,n){return t&n}},e.Exception=function(t){this.message=t},_r=e,_r}var Fr,ps;function sf(){if(ps)return Fr;ps=1;var e=af();function t(d,g){for(var w=0;w<d.length;w++)d[w]+=g;return d}for(var n=[{token:"sin",show:"sin",type:0,value:e.math.sin}
1,{token:"cos",show:"cos",type:0,value:e.math.cos},{token:"tan",show:"tan",type:0,value:e.math.tan},{token:"pi",show:"π",type:3,value:"PI"},{token:"(",show:"(",type:4,value:"("},{token:")",show:")",type:5,value:")"},{token:"P",show:"P",type:10,value:e.math.P},{token:"C",show:"C",type:10,value:e.math.C},{token:" ",show:" ",type:14,value:" ".anchor},{token:"asin",show:"asin",type:0,value:e.math.asin},{token:"acos",show:"acos",type:0,value:e.math.acos},{token:"atan",show:"atan",type:0,value:e.math.atan},{token:"7",show:"7",type:1,value:"7"},{token:"8",show:"8",type:1,value:"8"},{token:"9",show:"9",type:1,value:"9"},{token:"int",show:"Int",type:0,value:Math.floor},{token:"cosh",show:"cosh",type:0,value:e.math.cosh},{token:"acosh",show:"acosh",type:0,value:e.math.acosh},{token:"ln",show:" ln",type:0,value:Math.log},{token:"^",show:"^",type:10,value:Math.pow},{token:"root",show:"root",type:0,value:Math.sqrt},{token:"4",show:"4",type:1,value:"4"},{token:"5",show:"5",type:1,value:"5"},{token:"6",show:"6",type:1,value:"6"},{token:"/",show:"÷",type:2,value:e.math.div},{token:"!",show:"!",type:7,value:e.math.fact},{token:"tanh",show:"tanh",type:0,value:e.math.tanh},{token:"atanh",show:"atanh",type:0,value:e.math.atanh},{token:"Mod",show:" Mod ",type:2,value:e.math.mod},{token:"1",show:"1",type:1,value:"1"},{token:"2",show:"2",type:1,value:"2"},{token:"3",show:"3",type:1,value:"3"},{token:"*",show:"×",type:2,value:e.math.mul},{token:"sinh",show:"sinh",type:0,value:e.math.sinh},{token:"asinh",show:"asinh",type:0,value:e.math.asinh},{token:"e",show:"e",type:3,value:"E"},{token:"log",show:" log",type:0,value:e.math.log},{token:"0",show:"0",type:1,value:"0"},{token:".",show:".",type:6,value:"."},{token:"+",show:"+",type:9,value:e.math.add},{token:"-",show:"-",type:9,value:e.math.sub},{token:",",show:",",type:11,value:","},{token:"Sigma",show:"Σ",type:12,value:e.math.sigma},{token:"n",show:"n",type:13,value:"n"},{token:"Pi",show:"Π",type:12,value:e.math.Pi},{token:"pow",show:"pow",type:8,value:Math.pow,numberOfArguments:2},{token:"&",show:"&",type:9,value:e.math.and}],r={0:11,1:0,2:3,3:0,4:0,5:0,6:0,7:11,8:11,9:1,10:10,11:0,12:11,13:0,14:-1,15:11},o=0;o<n.length;o++)n[o].precedence=r[n[o].type];var a={0:!0,1:!0,3:!0,4:!0,6:!0,8:!0,9:!0,12:!0,13:!0,14:!0,15:!0},s={0:!0,1:!0,2:!0,3:!0,4:!0,5:!0,6:!0,7:!0,8:!0,9:!0,10:!0,11:!0,12:!0,13:!0,15:!0},c={0:!0,3:!0,4:!0,8:!0,12:!0,13:!0,15:!0},l={},u={0:!0,1:!0,3:!0,4:!0,6:!0,8:!0,12:!0,13:!0,15:!0},h={1:!0},p=[[],["1","2","3","7","8","9","4","5","6","+","-","*","/","(",")","^","!","P","C","e","0",".",",","n"," ","&"],["pi","ln","Pi"],["sin","cos","tan","Del","int","Mod","log","pow"],["asin","acos","atan","cosh","root","tanh","sinh"],["acosh","atanh","asinh","Sigma"]];function f(d,g,w,v){for(var x=0;x<v;x++)if(d[w+x]!==g[x])return!1;return!0}e.tokenTypes={FUNCTION_WITH_ONE_ARG:0,NUMBER:1,BINARY_OPERATOR_HIGH_PRECENDENCE:2,CONSTANT:3,OPENING_PARENTHESIS:4,CLOSING_PARENTHESIS:5,DECIMAL:6,POSTFIX_FUNCTION_WITH_ONE_ARG:7,FUNCTION_WITH_N_ARGS:8,BINARY_OPERATOR_LOW_PRECENDENCE:9,BINARY_OPERATOR_PERMUTATION:10,COMMA:11,EVALUATED_FUNCTION:12,EVALUATED_FUNCTION_PARAMETER:13,SPACE:14},e.addToken=function(d){for(var g=0;g<d.length;g++){var w=d[g].token.length,v=-1;d[g].type===e.tokenTypes.FUNCTION_WITH_N_ARGS&&d[g].numberOfArguments===void 0&&(d[g].numberOfArguments=2),p[w]=p[w]||[];for(var x=0;x<p[w].length;x++)if(d[g].token===p[w][x]){v=k(p[w][x],n);break}v===-1?(n.push(d[g]),d[g].precedence=r[d[g].type],p.length<=d[g].token.length&&(p[d[g].token.length]=[]),p[d[g].token.length].push(d[g].token)):(n[v]=d[g],d[g].precedence=r[d[g].type])}};function k(d,g){for(var w=0;w<g.length;w++)if(g[w].token===d)return w;return-1}function S(d){for(var g=[],w=d.length,v,x,b,A=0;A<w;A++)if(!(A<w-1&&d[A]===" "&&d[A+1]===" ")){for(v="",x=d.length-A>p.length-2?p.length-1:d.length-A;x>0;x--)if(p[x]!==void 0)for(b=0;b<p[x].length;b++)f(d,p[x][b],A,x)&&(v=p[x][b],b=p[x].length,x=0);if(A+=v.length-1,v==="")throw new e.Exception("Can't understand after "+d.slice(A));g.push(n[k(v,n)])}return g}var C={value:e.math.changeSign,type:0,pre:21,show:"-"},y={value:")",show:")",type:5,pre:0},m={value:"(",type:4,pre:0,show:"("};return e.lex=function(d,g){var w=[m],v=[],x=d,b=a,A=0,T=l,I="",M;typeof g<"u"&&e.addToken(g);var F={},P=S(x);for(M=0;M<P.length;M++){var B=P[M];if(B.type===14){if(M>0&&M<P.length-1&&P[M+1].type===1&&(P[M-1].type===1||P[M-1].type===6))throw new e.Exception("Unexpected Space");continue}var E=B.token,H=B.type,te=B.value,me=B.precedence,fe=B.show,Q=w[w.length-1],le;for(le=v.length;le--&&v[le]===0;)if([0,2,3,4,5,9,11,12,13].indexOf(H)!==-1){if(b[H]!==!0)throw new e.Exception(E+" is not allowed after "+I);w.push(y),b=s,T=u,v.pop()}if(b[H]!==!0)throw new e.Exception(E+" is not allowed after "+I);if(T[H]===!0&&(H=2,te=e.math.mul,fe="×",me=3,M=M-1),F={value:te,type:H,pre:me,show:fe,numberOfArguments:B.numberOfArguments},H===0)b=a,T=l,t(v,2),w.push(F),P[M+1].type!==4&&(w.push(m),v.push(2));else if(H===1)Q.type===1?(Q.value+=te,t(v,1)):w.push(F),b=s,T=c;else if(H===2)b=a,T=l,t(v,2),w.push(F);else if(H===3)w.push(F),b=s,T=u;else if(H===4)t(v,1),A++,b=a,T=l,w.push(F);else if(H===5){if(!A)throw new e.Exception("Closing parenthesis are more than opening one, wait What!!!");A--,b=s,T=u,w.push(F),t(v,1)}else if(H===6){if(Q.hasDec)throw new e.Exception("Two decimals are not allowed in one number");Q.type!==1&&(Q={value:0,type:1,pre:0}
1,w.push(Q)),b=h,t(v,1),T=l,Q.value+=te,Q.hasDec=!0}else H===7&&(b=s,T=u,t(v,1),w.push(F));H===8?(b=a,T=l,t(v,B.numberOfArguments+2),w.push(F),P[M+1].type!==4&&(w.push(m),v.push(B.numberOfArguments+2))):H===9?(Q.type===9?Q.value===e.math.add?(Q.value=te,Q.show=fe,t(v,1)):Q.value===e.math.sub&&fe==="-"&&(Q.value=e.math.add,Q.show="+",t(v,1)):Q.type!==5&&Q.type!==7&&Q.type!==1&&Q.type!==3&&Q.type!==13?E==="-"&&(b=a,T=l,t(v,2).push(2),w.push(C),w.push(m)):(w.push(F),t(v,2)),b=a,T=l):H===10?(b=a,T=l,t(v,2),w.push(F)):H===11?(b=a,T=l,w.push(F)):H===12?(b=a,T=l,t(v,6),w.push(F),P[M+1].type!==4&&(w.push(m),v.push(6))):H===13&&(b=s,T=u,w.push(F)),t(v,-1),I=E}for(le=v.length;le--;)w.push(y);if(b[5]!==!0)throw new e.Exception("complete the expression");for(;A--;)w.push(y);return w.push(y),new e(w)},Fr=e,Fr}var Dr,ms;function cf(){if(ms)return Dr;ms=1;var e=sf();return e.prototype.toPostfix=function(){for(var t=[],n,r,o,a,s,c=[{value:"(",type:4,pre:0}],l=this.value,u=1;u<l.length;u++)if(l[u].type===1||l[u].type===3||l[u].type===13)l[u].type===1&&(l[u].value=Number(l[u].value)),t.push(l[u]);else if(l[u].type===4)c.push(l[u]);else if(l[u].type===5)for(;(r=c.pop()).type!==4;)t.push(r);else if(l[u].type===11){for(;(r=c.pop()).type!==4;)t.push(r);c.push(r)}else{n=l[u],a=n.pre,s=c[c.length-1],o=s.pre;var h=s.value=="Math.pow"&&n.value=="Math.pow";if(a>o)c.push(n);else{for(;o>=a&&!h||h&&a<o;)r=c.pop(),s=c[c.length-1],t.push(r),o=s.pre,h=n.value=="Math.pow"&&s.value=="Math.pow";c.push(n)}}return new e(t)},Dr=e,Dr}var Er,gs;function lf(){if(gs)return Er;gs=1;var e=cf();return e.prototype.postfixEval=function(t){t=t||{},t.PI=Math.PI,t.E=Math.E;for(var n=[],r,o,a,s=this.value,c=typeof t.n<"u",l=0;l<s.length;l++)if(s[l].type===1)n.push({value:s[l].value,type:1});else if(s[l].type===3)n.push({value:t[s[l].value],type:1});else if(s[l].type===0)typeof n[n.length-1].type>"u"?n[n.length-1].value.push(s[l]):n[n.length-1].value=s[l].value(n[n.length-1].value);else if(s[l].type===7)typeof n[n.length-1].type>"u"?n[n.length-1].value.push(s[l]):n[n.length-1].value=s[l].value(n[n.length-1].value);else if(s[l].type===8){for(var u=[],h=0;h<s[l].numberOfArguments;h++)u.push(n.pop().value);n.push({type:1,value:s[l].value.apply(s[l],u.reverse())})}else s[l].type===10?(r=n.pop(),o=n.pop(),typeof o.type>"u"?(o.value=o.concat(r),o.value.push(s[l]),n.push(o)):typeof r.type>"u"?(r.unshift(o),r.push(s[l]),n.push(r)):n.push({type:1,value:s[l].value(o.value,r.value)})):s[l].type===2||s[l].type===9?(r=n.pop(),o=n.pop(),typeof o.type>"u"?(o=o.concat(r),o.push(s[l]),n.push(o)):typeof r.type>"u"?(r.unshift(o),r.push(s[l]),n.push(r)):n.push({type:1,value:s[l].value(o.value,r.value)})):s[l].type===12?(r=n.pop(),typeof r.type<"u"&&(r=[r]),o=n.pop(),a=n.pop(),n.push({type:1,value:s[l].value(a.value,o.value,new e(r))})):s[l].type===13&&(c?n.push({value:t[s[l].value],type:3}):n.push([s[l]]));if(n.length>1)throw new e.Exception("Uncaught Syntax error");return n[0].value>1e15?"Infinity":parseFloat(n[0].value.toFixed(15))},e.eval=function(t,n,r){return typeof n>"u"?this.lex(t).toPostfix().postfixEval():typeof r>"u"?typeof n.length<"u"?this.lex(t,n).toPostfix().postfixEval():this.lex(t).toPostfix().postfixEval(n):this.lex(t,n).toPostfix().postfixEval(r)},Er=e,Er}var Lr,ws;function uf(){if(ws)return Lr;ws=1;var e=lf();return e.prototype.formulaEval=function(){for(var t,n,r,o=[],a=this.value,s=0;s<a.length;s++)a[s].type===1||a[s].type===3?o.push({value:a[s].type===3?a[s].show:a[s].value,type:1}):a[s].type===13?o.push({value:a[s].show,type:1}):a[s].type===0?o[o.length-1]={value:a[s].show+(a[s].show!="-"?"(":"")+o[o.length-1].value+(a[s].show!="-"?")":""),type:0}:a[s].type===7?o[o.length-1]={value:(o[o.length-1].type!=1?"(":"")+o[o.length-1].value+(o[o.length-1].type!=1?")":"")+a[s].show,type:7}:a[s].type===10?(t=o.pop(),n=o.pop(),a[s].show==="P"||a[s].show==="C"?o.push({value:"<sup>"+n.value+"</sup>"+a[s].show+"<sub>"+t.value+"</sub>",type:10}):o.push({value:(n.type!=1?"(":"")+n.value+(n.type!=1?")":"")+"<sup>"+t.value+"</sup>",type:1})):a[s].type===2||a[s].type===9?(t=o.pop(),n=o.pop(),o.push({value:(n.type!=1?"(":"")+n.value+(n.t
1ype!=1?")":"")+a[s].show+(t.type!=1?"(":"")+t.value+(t.type!=1?")":""),type:a[s].type})):a[s].type===12&&(t=o.pop(),n=o.pop(),r=o.pop(),o.push({value:a[s].show+"("+r.value+","+n.value+","+t.value+")",type:12}));return o[0].value},Lr=e,Lr}var Yr,vs;function df(){if(vs)return Yr;vs=1;var e=nf(),t=of(),n=uf(),r=100,o=/(\+|\-|\*|\\|[^a-z]|)(\s*)(\()/g,a;Yr=s;function s(l,u){a=0,u=Math.pow(10,u===void 0?5:u),l=l.replace(/\n+/g," ");function h(f,k,S){if(a++>r)throw a=0,new Error("Call stack overflow for "+S);if(f==="")throw new Error(k+"(): '"+S+"' must contain a non-whitespace string");f=p(f,S);var C=c(f);if(C.length>1||f.indexOf("var(")>-1)return k+"("+f+")";var y=C[0]||"";y==="%"&&(f=f.replace(/\b[0-9\.]+%/g,function(g){return parseFloat(g.slice(0,-1))*.01}));var m=f.replace(new RegExp(y,"gi"),""),d;try{d=n.eval(m)}catch(g){return k+"("+f+")"}return y==="%"&&(d*=100),(k.length||y==="%")&&(d=Math.round(d*u)/u),d+=y,d}function p(f,k){f=f.replace(/((?:\-[a-z]+\-)?calc)/g,"");for(var S="",C=f,y;y=o.exec(C);){y[0].index>0&&(S+=C.substring(0,y[0].index));var m=e("(",")",C.substring([0].index));if(m.body==="")throw new Error("'"+f+"' must contain a non-whitespace string");var d=h(m.body,"",k);S+=m.pre+d,C=m.post}return S+C}return t(l,/((?:\-[a-z]+\-)?calc)\(/,h)}function c(l){for(var u=[],h=[],p=/[\.0-9]([%a-z]+)/gi,f=p.exec(l);f;)!f||!f[1]||(h.indexOf(f[1].toLowerCase())===-1&&(u.push(f[1]),h.push(f[1].toLowerCase())),f=p.exec(l));return u}return Yr}var hf=df();const Rr=Vo(hf);var Pr,xs;function ff(){if(xs)return Pr;xs=1;var e=typeof Cn=="object"&&Cn&&Cn.Object===Object&&Cn;return Pr=e,Pr}var Or,ys;function fa(){if(ys)return Or;ys=1;var e=ff(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Or=n,Or}var zr,ks;function zc(){if(ks)return zr;ks=1;var e=fa(),t=e.Symbol;return zr=t,zr}var Wr,Cs;function pf(){if(Cs)return Wr;Cs=1;var e=zc(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;function a(s){var c=n.call(s,o),l=s[o];try{s[o]=void 0;var u=!0}catch(p){}var h=r.call(s);return u&&(c?s[o]=l:delete s[o]),h}return Wr=a,Wr}var Hr,Ss;function mf(){if(Ss)return Hr;Ss=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Hr=n,Hr}var Br,bs;function gf(){if(bs)return Br;bs=1;var e=zc(),t=pf(),n=mf(),r="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function s(c){return c==null?c===void 0?o:r:a&&a in Object(c)?t(c):n(c)}return Br=s,Br}var $r,As;function Wc(){if(As)return $r;As=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return $r=e,$r}var Vr,Ts;function wf(){if(Ts)return Vr;Ts=1;var e=gf(),t=Wc(),n="[object AsyncFunction]",r="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function s(c){if(!t(c))return!1;var l=e(c);return l==r||l==o||l==n||l==a}return Vr=s,Vr}var Gr,js;function vf(){if(js)return Gr;js=1;var e=fa(),t=e["__core-js_shared__"];return Gr=t,Gr}var qr,Ns;function xf(){if(Ns)return qr;Ns=1;
vendor: 4,709 bytes, line 1
1var e=vf(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return qr=n,qr}var Ur,Is;function yf(){if(Is)return Ur;Is=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch(o){}try{return r+""}catch(o){}}return""}return Ur=n,Ur}var Zr,Ms;function kf(){if(Ms)return Zr;Ms=1;var e=wf(),t=xf(),n=Wc(),r=yf(),o=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,c=Object.prototype,l=s.toString,u=c.hasOwnProperty,h=RegExp("^"+l.call(u).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(f){if(!n(f)||t(f))return!1;var k=e(f)?h:a;return k.test(r(f))}return Zr=p,Zr}var Kr,_s;function Cf(){if(_s)return Kr;_s=1;function e(t,n){return t==null?void 0:t[n]}return Kr=e,Kr}var Xr,Fs;function Hc(){if(Fs)return Xr;Fs=1;var e=kf(),t=Cf();function n(r,o){var a=t(r,o);return e(a)?a:void 0}return Xr=n,Xr}var Jr,Ds;function ur(){if(Ds)return Jr;Ds=1;var e=Hc(),t=e(Object,"create");return Jr=t,Jr}var Qr,Es;function Sf(){if(Es)return Qr;Es=1;var e=ur();function t(){this.__data__=e?e(null):{},this.size=0}return Qr=t,Qr}var eo,Ls;function bf(){if(Ls)return eo;Ls=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return eo=e,eo}var to,Ys;function Af(){if(Ys)return to;Ys=1;var e=ur(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function o(a){var s=this.__data__;if(e){var c=s[a];return c===t?void 0:c}return r.call(s,a)?s[a]:void 0}return to=o,to}var no,Rs;function Tf(){if(Rs)return no;Rs=1;var e=ur(),t=Object.prototype,n=t.hasOwnProperty;function r(o){var a=this.__data__;return e?a[o]!==void 0:n.call(a,o)}return no=r,no}var ro,Ps;function jf(){if(Ps)return ro;Ps=1;var e=ur(),t="__lodash_hash_undefined__";function n(r,o){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&o===void 0?t:o,this}return ro=n,ro}var oo,Os;function Nf(){if(Os)return oo;Os=1;var e=Sf(),t=bf(),n=Af(),r=Tf(),o=jf();function a(s){var c=-1,l=s==null?0:s.length;for(this.clear();++c<l;){var u=s[c];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=o,oo=a,oo}var ao,zs;function If(){if(zs)return ao;zs=1;function e(){this.__data__=[],this.size=0}return ao=e,ao}var so,Ws;function Mf(){if(Ws)return so;Ws=1;function e(t,n){return t===n||t!==t&&n!==n}return so=e,so}var io,Hs;function dr(){if(Hs)return io;Hs=1;var e=Mf();function t(n,r){for(var o=n.length;o--;)if(e(n[o][0],r))return o;return-1}return io=t,io}var co,Bs;function _f(){if(Bs)return co;Bs=1;var e=dr(),t=Array.prototype,n=t.splice;function r(o){var a=this.__data__,s=e(a,o);if(s<0)return!1;var c=a.length-1;return s==c?a.pop():n.call(a,s,1),--this.size,!0}return co=r,co}var lo,$s;function Ff(){if($s)return lo;$s=1;var e=dr();function t(n){var r=this.__data__,o=e(r,n);return o<0?void 0:r[o][1]}return lo=t,lo}var uo,Vs;function Df(){if(Vs)return uo;Vs=1;var e=dr();function t(n){return e(this.__data__,n)>-1}return uo=t,uo}var ho,Gs;function Ef(){if(Gs)return ho;Gs=1;var e=dr();function t(n,r){var o=this.__data__,a=e(o,n);return a<0?(++this.size,o.push([n,r])):o[a][1]=r,this}return ho=t,ho}var fo,qs;function Lf(){if(qs)return fo;qs=1;var e=If(),t=_f(),n=Ff(),r=Df(),o=Ef();function a(s){var c=-1,l=s==null?0:s.length;for(this.clear();++c<l;){var u=s[c];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=o,fo=a,fo}var po,Us;function Yf(){if(Us)return po;Us=1;var e=Hc(),t=fa(),n=e(t,"Map");return po=n,po}var mo,Zs;function Rf(){if(Zs)return mo;Zs=1;var e=Nf(),t=Lf(),n=Yf();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return mo=r,mo}var go,Ks;function Pf(){if(Ks)return go;Ks=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return go=e,go}var wo,Xs;function hr(){if(Xs)return wo;Xs=1;var e=Pf();function t(n,r){var o=n.__data__;return e(r)?o[typeof r=="string"?"string":"hash"]:o.map}return wo=t,wo}var vo,Js;function Of(){if(Js)return vo;Js=1;var e=hr();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return vo=t,vo}var xo,Qs;function zf(){if(Qs)return xo;Qs=1;var e=hr();function t(n){return e(this,n).get(n)}return xo=t,xo}var yo,ei;function Wf(){if(ei)return yo;ei=1;var e=hr();function t(n){return e(this,n).has(n)}return yo=t,yo}var ko,ti;function Hf(){if(ti)return ko;ti=1;var e=hr();function t(n,r){var o=e(this,n),a=o.size;return o.set(n,r),this.size+=o.size==a?0:1,this}return ko=t,ko}var Co,ni;function Bf(){if(ni)return Co;ni=1;
1var e=Rf(),t=Of(),n=zf(),r=Wf(),o=Hf();function a(s){var c=-1,l=s==null?0:s.length;for(this.clear();++c<l;){var u=s[c];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=o,Co=a,Co}var So,ri;function $f(){if(ri)return So;ri=1;var e=Bf(),t="Expected a function";function n(r,o){if(typeof r!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var a=function(){var s=arguments,c=o?o.apply(this,s):s[0],l=a.cache;if(l.has(c))return l.get(c);var u=r.apply(this,s);return a.cache=l.set(c,u)||l,u};return a.cache=new(n.Cache||e),a}return n.Cache=e,So=n,So}var Vf=$f();const Gf=Vo(Vf);var oi="__react_svg_text_measurement_id";function qf(e,t){try{var n=document.getElementById(oi);if(!n){var r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("aria-hidden","true"),r.style.width="0",r.style.height="0",r.style.position="absolute",r.style.top="-100%",r.style.left="-100%",n=document.createElementNS("http://www.w3.org/2000/svg","text"),n.setAttribute("id",oi),r.appendChild(n),document.body.appendChild(r)}return Object.assign(n.style,t),n.textContent=e,n.getComputedTextLength()}catch(o){return null}}const ai=Gf(qf,function(e,t){return e+"_"+JSON.stringify(t)});var Uf=["verticalAnchor","scaleToFit","angle","width","lineHeight","capHeight","children","style"];function Zf(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function bo(e){return typeof e=="number"}function si(e){return typeof e=="number"&&Number.isFinite(e)||typeof e=="string"}function Kf(e){var t=e.verticalAnchor,n=t===void 0?"end":t,r=e.scaleToFit,o=r===void 0?!1:r,a=e.angle,s=e.width,c=e.lineHeight,l=c===void 0?"1em":c,u=e.capHeight,h=u===void 0?"0.71em":u,p=e.children,f=e.style,k=Zf(e,Uf),S=k.x,C=S===void 0?0:S,y=k.y,m=y===void 0?0:y,d=!si(C)||!si(m),g=Y.useMemo(function(){var T=p==null?[]:p.toString().split(/(?:(?!\u00A0+)\s+)/);return{wordsWithWidth:T.map(function(I){return{word:I,wordWidth:ai(I,f)||0}}),spaceWidth:ai("Â ",f)||0}},[p,f]),w=g.wordsWithWidth,v=g.spaceWidth,x=Y.useMemo(function(){return d?[]:s||o?w.reduce(function(T,I){var M=I.word,F=I.wordWidth,P=T[T.length-1];if(P&&(s==null||o||(P.width||0)+F+v<s))P.words.push(M),P.width=P.width||0,P.width+=F+v;else{var B={words:[M],width:F};T.push(B)}return T},[]):[{words:p==null?[]:p.toString().split(/(?:(?!\u00A0+)\s+)/)}]},[d,s,o,p,w,v]),b=Y.useMemo(function(){var T=d?"":Rr(n==="start"?"calc("+h+")":n==="middle"?"calc("+(x.length-1)/2+" * -"+l+" + ("+h+" / 2))":"calc("+(x.length-1)+" * -"+l+")");return T},[d,n,h,x.length,l]),A=Y.useMemo(function(){var T=[];if(d)return"";if(bo(C)&&bo(m)&&bo(s)&&o&&x.length>0){var I=x[0].width||1,M=o==="shrink-only"?Math.min(s/I,1):s/I,F=M,P=C-M*C,B=m-F*m;T.push("matrix("+M+", 0, 0, "+F+", "+P+", "+B+")")}return a&&T.push("rotate("+a+", "+C+", "+m+")"),T.length>0?T.join(" "):""},[d,C,m,s,o,x,a]);return{wordsByLines:x,startDy:b,transform:A}}var Xf=["dx","dy","textAnchor","innerRef","innerTextRef","verticalAnchor","angle","lineHeight","scaleToFit","capHeight","width"];function Wo(){return Wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wo.apply(this,arguments)}function Jf(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var Qf={overflow:"visible"};function Bc(e){var t=e.dx,n=t===void 0?0:t,r=e.dy,o=r===void 0?0:r,a=e.textAnchor,s=a===void 0?"start":a,c=e.innerRef,l=e.innerTextRef;e.verticalAnchor,e.angle;var u=e.lineHeight,h=u===void 0?"1em":u;e.scaleToFit,e.capHeight,e.width;var p=Jf(e,Xf),f=p.x,k=f===void 0?0:f,S=p.fontSize,C=Kf(e),y=C.wordsByLines,m=C.startDy,d=C.transform;return N.createElement("svg",{ref:c,x:n,y:o,fontSize:S,style:Qf},y.length>0?N.createElement("text",Wo({ref:l,transform:d},p,{textAnchor:s}),y.map(function(g,w){return N.createElement("tspan",{key:w,x:k,dy:w===0?m:h},g.words.join(" "))})):null)}var it={top:"top",left:"left",bottom:"bottom"};function ep(e){var t=e.labelOffset,n=e.labelProps,r=e.orientation,o=e.range,a=e.tickLabelFontSize,s=e.tickLength,c=r===it.left||r===it.top?-1:1,l,u,h;if(r===it.top||r===it.bottom){var p=r===it.bottom&&typeof n.fontSize=="number"?n.fontSize:0;l=(Number(o[0])+Number(o[o.length-1]))/2,u=c*(s+t+a+p)}else l=c*((Number(o[0])+Number(o[o.length-1]))/2),u=-(s+t),h="rotate("+c*90+")";return{x:l,y:u,transform:h}}function ln(){return ln=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ln.apply(this,arguments)}function tp(e){var t=e.hideTicks,n=e.horizontal,r=e.orientation,o=e.tickClassName,a=e.tickComponent,s=e.tickLabelProps,c=e.tickStroke,l=c===void 0?"#222":c,u=e.tickTransform,h=e.ticks,p=e.strokeWidth,f=e.tickLineProps;return h.map(function(k){var S,C=k.value,y=k.index,m=k.from,d=k.to,g=k.formattedValue,w=(S=s[y])!=null?S:{},v=Math.max(10,typeof w.fontSize=="number"&&w.fontSize||0),x=d.y+(n&&r!==it.top?v:0);return N.createElement(qt,{key:"visx-tick-"+C+"-"+y,className:xt("visx-axis-tick",o),transform:u},!t&&N.createElement(Xo,ln({from:m,to:d,stroke:l,strokeWidth:p,strokeLinecap:"square"},f)),a?a(ln({},w,{x:d.x,y:x,formattedValue:g})):N.createElement(Bc,ln({x:d.x,y:x},w),g))})}function un(){return un=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},un.apply(this,arguments)}var ii={textAnchor:"middle",fontFamily:"Arial",fontSize:10,fill:"#222"};function np(e){var t=e.axisFromPoint,n=e.axisLineClassName,r=e.axisToPoint,o=e.hideAxisLine,a=e.hideTicks,s=e.horizontal,c=e.label,l=c===void 0?"":c,u=e.labelClassName,h=e.labelOffset,p=h===void 0?14:h,f=e.labelProps,k=e.orientation,S=k===void 0?it.bottom:k,C=e.scale,y=e.stroke,m=y===void 0?"#222":y,d=e.strokeDasharray,g=e.strokeWidth,w=g===void 0?1:g,v=e.tickClassName,x=e.tickComponent,b=e.tickLineProps,A=e.tickLabelProps,T=e.tickLength,I=T===void 0?8:T,M=e.tickStroke,F=M===void 0?"#222":M,P=e.tickTransform,B=e.ticks,E=e.ticksComponent,H=E===void 0?tp:E,te=un({},ii,f),me=un({},ii,typeof A=="object"?A:null),fe=B.map(function(le){var we=le.value,ue=le.index;return typeof A=="function"?A(we,ue,B):me}),Q=Math.max.apply(Math,[10].concat(fe.map(function(le){return typeof le.fontSize=="number"?le.fontSize:0})));return N.createElement(N.Fragment,null,H({hideTicks:a,horizontal:s,orientation:S,scale:C,tickClassName:v,tickComponent:x,tickLabelProps:fe,tickStroke:F,tickTransform:P,ticks:B,strokeWidth:w,tickLineProps:b}),!o&&N.createElement(Xo,{className:xt("visx-axis-line",n),from:t,to:r,stroke:m,strokeWidth:w,strokeDasharray:d}),l&&N.createElement(Bc,un({className:xt("visx-axis-label",u)},ep({labelOffset:p,labelProps:te,orientation:S,range:C.range(),tickLabelFontSize:Q,tickLength:I}),te),l))}function rp(e,t){t===void 0&&(t="center");var n=e;if(t!=="start"&&"bandwidth"in n){var r=n.bandwidth();
1return t==="center"&&(r/=2),n.round()&&(r=Math.round(r)),function(o){var a=n(o);return typeof a=="number"?a+r:a}}return e}function op(e){var t=e;return"tickFormat"in t?t.tickFormat():q2}function Fn(e,t){var n=e.x,r=e.y;return new cd(t?{x:n,y:r}:{x:r,y:n})}function Ho(){return Ho=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ho.apply(this,arguments)}var Ao=0;function ap(e){return e===void 0&&(e=Ao),typeof e=="number"?{start:e,end:e}:Ho({start:Ao,end:Ao},e)}var sp=["children","axisClassName","hideAxisLine","hideTicks","hideZero","innerRef","left","numTicks","orientation","rangePadding","scale","tickFormat","tickLength","tickValues","top"];function Bo(){return Bo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bo.apply(this,arguments)}function ip(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function cp(e){var t=e.children,n=t===void 0?np:t,r=e.axisClassName,o=e.hideAxisLine,a=o===void 0?!1:o,s=e.hideTicks,c=s===void 0?!1:s,l=e.hideZero,u=l===void 0?!1:l,h=e.innerRef,p=e.left,f=p===void 0?0:p,k=e.numTicks,S=k===void 0?10:k,C=e.orientation,y=C===void 0?it.bottom:C,m=e.rangePadding,d=m===void 0?0:m,g=e.scale,w=e.tickFormat,v=e.tickLength,x=v===void 0?8:v,b=e.tickValues,A=e.top,T=A===void 0?0:A,I=ip(e,sp),M=w!=null?w:op(g),F=y===it.left,P=y===it.top,B=P||y===it.bottom,E=rp(g),H=F||P?-1:1,te=g.range(),me=ap(d),fe=Fn({x:Number(te[0])+.5-me.start,y:0},B),Q=Fn({x:Number(te[te.length-1])+.5+me.end,y:0},B),le=(b!=null?b:G2(g,S)).filter(function(ue){return!u||ue!==0&&ue!=="0"}).map(function(ue,oe){return{value:ue,index:oe}}),we=le.map(function(ue){var oe=ue.value,Ce=ue.index,G=V2(E(oe));return{value:oe,index:Ce,from:Fn({x:G,y:0},B),to:Fn({x:G,y:x*H},B),formattedValue:M(oe,Ce,le)}});return N.createElement(qt,{className:xt("visx-axis",r),innerRef:h,top:T,left:f},n(Bo({},I,{axisFromPoint:fe,axisToPoint:Q,hideAxisLine:a,hideTicks:c,hideZero:u,horizontal:B,numTicks:S,orientation:y,rangePadding:d,scale:g,tickFormat:M,tickLength:x,tickPosition:E,tickSign:H,ticks:we})))}var lp=["axisClassName","labelOffset","tickLength","tickLabelProps"];function Gn(){return Gn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gn.apply(this,arguments)}function up(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var dp={dy:"0.25em",fill:"#222",fontFamily:"Arial",fontSize:10,textAnchor:"middle"};function hp(e){var t=e.axisClassName,n=e.labelOffset,r=n===void 0?8:n,o=e.tickLength,a=o===void 0?8:o,s=e.tickLabelProps,c=up(e,lp),l=typeof s=="function"?s:Gn({},dp,s);return N.createElement(cp,Gn({axisClassName:xt("visx-axis-bottom",t),labelOffset:r,orientation:it.bottom,tickLabelProps:l,tickLength:a},c))}var on={},ci;function fp(){if(ci)return on;ci=1,on.__esModule=!0,on.default=void 0;var e=[{date:"2011-10-01","New York":"63.4","San Francisco":"62.7",Austin:"72.2"},{date:"2011-10-02","New York":"58.0","San Francisco":"59.9",Austin:"67.7"},{date:"2011-10-03","New York":"53.3","San Francisco":"59.1",Austin:"69.4"},{date:"2011-10-04","New York":"55.7","San Francisco":"58.8",Austin:"68.0"},{date:"2011-10-05","New York":"64.2","San Francisco":"58.7",Austin:"72.4"},{date:"2011-10-06","New York":"58.8","San Francisco":"57.0",Austin:"77.0"},{date:"2011-10-07","New York":"57.9","San Francisco":"56.7",Austin:"82.3"},{date:"2011-10-08","New York":"61.8","San Francisco":"56.8",Austin:"78.9"},{date:"2011-10-09","New York":"69.3","San Francisco":"56.7",Austin:"68.8"},{date:"2011-10-10","New York":"71.2","San Francisco":"60.1",Austin:"68.7"},{date:"2011-10-11","New York":"68.7","San Francisco":"61.1",Austin:"70.3"},{date:"2011-10-12","New York":"61.8","San Francisco":"61.5",Austin:"75.3"},{date:"2011-10-13","New York":"63.0","San Francisco":"64.3",Austin:"76.
16"},{date:"2011-10-14","New York":"66.9","San Francisco":"67.1",Austin:"66.6"},{date:"2011-10-15","New York":"61.7","San Francisco":"64.6",Austin:"68.0"},{date:"2011-10-16","New York":"61.8","San Francisco":"61.6",Austin:"70.6"},{date:"2011-10-17","New York":"62.8","San Francisco":"61.1",Austin:"71.1"},{date:"2011-10-18","New York":"60.8","San Francisco":"59.2",Austin:"70.0"},{date:"2011-10-19","New York":"62.1","San Francisco":"58.9",Austin:"61.6"},{date:"2011-10-20","New York":"65.1","San Francisco":"57.2",Austin:"57.4"},{date:"2011-10-21","New York":"55.6","San Francisco":"56.4",Austin:"64.3"},{date:"2011-10-22","New York":"54.4","San Francisco":"60.7",Austin:"72.4"},{date:"2011-10-23","New York":"54.4","San Francisco":"65.1",Austin:"72.4"},{date:"2011-10-24","New York":"54.8","San Francisco":"60.9",Austin:"72.5"},{date:"2011-10-25","New York":"57.9","San Francisco":"56.1",Austin:"72.7"},{date:"2011-10-26","New York":"54.6","San Francisco":"54.6",Austin:"73.4"},{date:"2011-10-27","New York":"54.4","San Francisco":"56.1",Austin:"70.7"},{date:"2011-10-28","New York":"42.5","San Francisco":"58.1",Austin:"56.8"},{date:"2011-10-29","New York":"40.9","San Francisco":"57.5",Austin:"51.0"},{date:"2011-10-30","New York":"38.6","San Francisco":"57.7",Austin:"54.9"},{date:"2011-10-31","New York":"44.2","San Francisco":"55.1",Austin:"58.8"},{date:"2011-11-01","New York":"49.6","San Francisco":"57.9",Austin:"62.6"},{date:"2011-11-02","New York":"47.2","San Francisco":"64.6",Austin:"71.0"},{date:"2011-11-03","New York":"50.1","San Francisco":"56.2",Austin:"58.4"},{date:"2011-11-04","New York":"50.1","San Francisco":"50.5",Austin:"45.1"},{date:"2011-11-05","New York":"43.5","San Francisco":"51.3",Austin:"52.2"},{date:"2011-11-06","New York":"43.8","San Francisco":"52.6",Austin:"73.0"},{date:"2011-11-07","New York":"48.9","San Francisco":"51.4",Austin:"75.4"},{date:"2011-11-08","New York":"55.5","San Francisco":"50.6",Austin:"72.1"},{date:"2011-11-09","New York":"53.7","San Francisco":"54.6",Austin:"56.6"},{date:"2011-11-10","New York":"57.7","San Francisco":"55.6",Austin:"55.4"},{date:"2011-11-11","New York":"48.5","San Francisco":"53.9",Austin:"46.7"},{date:"2011-11-12","New York":"46.8","San Francisco":"54.0",Austin:"62.0"},{date:"2011-11-13","New York":"51.1","San Francisco":"53.8",Austin:"71.6"},{date:"2011-11-14","New York":"56.8","San Francisco":"53.5",Austin:"75.5"},{date:"2011-11-15","New York":"59.7","San Francisco":"53.4",Austin:"72.1"},{date:"2011-11-16","New York":"56.5","San Francisco":"52.2",Austin:"65.7"},{date:"2011-11-17","New York":"49.6","San Francisco":"52.7",Austin:"56.8"},{date:"2011-11-18","New York":"41.5","San Francisco":"53.1",Austin:"49.9"},{date:"2011-11-19","New York":"44.3","San Francisco":"49.0",Austin:"71.7"},{date:"2011-11-20","New York":"54.0","San Francisco":"50.4",Austin:"77.7"},{date:"2011-11-21","New York":"54.1","San Francisco":"51.1",Austin:"76.4"},{date:"2011-11-22","New York":"49.4","San Francisco":"52.3",Austin:"68.8"},{date:"2011-11-23","New York":"50.0","San Francisco":"54.6",Austin:"57.0"},{date:"2011-11-24","New York":"44.0","San Francisco":"55.1",Austin:"55.5"},{date:"2011-11-25","New York":"50.3","San Francisco":"51.5",Austin:"61.6"},{date:"2011-11-26","New York":"52.1","San Francisco":"53.6",Austin:"64.1"},{date:"2011-11-27","New York":"49.6","San Francisco":"52.3",Austin:"51.1"},{date:"2011-11-28","New York":"57.2","San Francisco":"51.0",Austin:"43.0"},{date:"2011-11-29","New York":"59.1","San Francisco":"49.5",Austin:"46.4"},{date:"2011-11-30","New York":"50.6","San Francisco":"49.8",Austin:"48.0"},{date:"2011-12-01","New York":"44.3","San Francisco":"60.4",Austin:"48.1"},{date:"2011-12-02","New York":"43.9","San Francisco":"62.2",Austin:"60.6"},{date:"2011-12-03","New York":"42.1","San Francisco":"58.3",Austin:"62.6"},{date:"2011-12-04","New York":"43.9","San Francisco":"52.7",Austin:"57.1"},{date:"2011-12-05","New York":"50.2","San Francisco":"51.5",Austin:"44.2"},{date:"2011-12-06","New York":"54.2","San Francisco":"49.9",Austin:"37.4"},{date:"2011-12-07","New York":"54.6","San Francisco":"48.6",Austin:"35.0"},{date:"2011-12-08","New York":"43.4","San Francisco":"46.4",Austin:"37.0"},{date:"2011-12-09","New York":"42.2","San Francisco":"49.8",Austin:"45.4"},{date:"2011-12-10","New York":"45.0","San Francisco":"52.1",Austin:"50.7"},{date:"2011-12-11","New York":"33.8","San Francisco":"48.8",Austin:"48.6"},{date:"2011-12-12","New York":"36.8","San Francisco":"47.4",Austin:"52.2"},{date:"2011-12-13","New York":"38.6","San Francisco":"47.2",Austin:"60.8"},{date:"2011-12-14","New York":"41.9","San Francisco":"46.1",Austin:"70.0"},{date:"2011-12-15","New York":"49.6","San Francisco":"48.8",Austin:"64.2"},{date:"2011-12-16","New York":"50.2","San Francisco":"47.9",Austin:"50.9"},{date:"2011-12-17","New York":"40.6","San Francisco":"49.8",Austin:"51.6"},{date:"2011-12-18","New York":"29.1","San Francisco":"49.1",Austin:"55.2"},{date:"2011-12-19","New York":"33.7","San Francisco":"48.3",Austin:"62.1"},{date:"2011-12-20","New York":"45.8","San Francisco":"49.3",Austin:"56.3"},{date:"2011-12-21","New York":"47.4","San Francisco":"48.4",Austin:"47.2"},{date:"2011-12-22","New York":"54.4","San Francisco":"53.3",Austin:"52.3"},{date:"2011-12-23","New York":"47.8","San Francisco":"47.5",Austin:"45.2"},{date:"2011-12-24","New York":"34.9","San Francisco":"47.9",Austin:"43.6"},{date:"2011-12-25","New York":"35.9","San Francisco":"48.9",Austin:"42.9"},{date:"2011-12-26","New York":"43.6","San Francisco":"45.9",Austin:"48.2"},{date:"2011-12-27","New York":"42.9","San Francisco":"47.2",Austin:"45.4"},{date:"2011-12-28","New York":"46.2","San Francisco":"48.9",Austin:"44.2"},{date:"2011-12-29","New York":"30.8","San Francisco":"50.9",Austin:"50.4"},{date:"2011-12-30","New York":"40.8","San Francisco":"52.9",Austin:"52.4"},{date:"2011-12-31","New York":"49.8","San Francisco":"50.1",Austin:"53.5"},{date:"2012-01-01","New York":"46.3","San Francisco":"53.9",Austin:"55.9"},{date:"2012-01-02","New York":"43.2","San Francisco":"53.1",Austin:"48.2"},{date:"2012-01-03","New York":"30.3","San Francisco":"49.7",Austin:"41.0"},{date:"2012-01-04","New York":"19.2","San Francisco":"52.7",Austin:"48.9"},{date:"2012-01-05","New York":"32.1","San Francisco":"52.6",Austin:"54.8"},{date:"2012-01-06","New York":"41.2","San Francisco":"49.0",Austin:"61.2"},{date:"2012-01-07","New York":"47.0","San Francisco":"51.0",Austin:"59.7"},{date:"2012-01-08","New York":"46.0","San Francisco":"56.8",Austin:"52.5"},{date:"2012-01-09","New York":"34.7","San Francisco":"52.3",Austin:"54.0"},{date:"2012-01-10","New York":"39.4","San Francisco":"51.6",Austin:"47.7"},{date:"2012-01-11","New York":"40.4","San Francisco":"49.8",Austin:"49.2"},{date:"2012-01-12","New York":"45.4","San Francisco":"51.9",Austin:"48.4"},{date:"2012-01-13","New York":"40.7","San Francisco":"53.7",Austin:"40.2"},{date:"2012-01-14","New York":"30.4","San Francisco":"52.9",Austin:"43.9"},{date:"2012-01-15","New York":"23.9","San Francisco":"49.7",Austin:"45.2"},{date:"2012-01-16","New York":"22.6","San Francisco":"45.3",Austin:"65.0"},{date:"2012-01-17","New York":"39.8","San Francisco":"43.6",Austin:"68.2"},{date:"2012-01-18","New York":"43.2","San Francisco":"45.0",Austin:"47.5"},{date:"2012-01-19","New York":"26.3","San Francisco":"47.3",Austin:"57.1"},{date:"2012-01-20","New York":"32.8","San Francisco":"51.4",Austin:"61.9"},{date:"2012-01-21","New York":"27.4","San Francisco":"53.7",Austin:"54.6"},{date:"2012-01-22","New York":"25.0","San Francisco":"48.3",Austin:"56.7"},{date:"2012-01-23","New York":"39.4","San Francisco":"52.9",Austin:"54.4"},{date:"2012-01-24","New York":"48.7","San Francisco":"49.1",Austin:"52.7"},{date:"2012-01-25","New York":"43.0","San Francisco":"52.1",Austin:"61.8"}
1,{date:"2012-01-26","New York":"37.1","San Francisco":"53.6",Austin:"55.0"},{date:"2012-01-27","New York":"48.2","San Francisco":"50.4",Austin:"50.7"},{date:"2012-01-28","New York":"43.7","San Francisco":"50.3",Austin:"52.9"},{date:"2012-01-29","New York":"40.1","San Francisco":"53.8",Austin:"44.4"},{date:"2012-01-30","New York":"38.0","San Francisco":"51.9",Austin:"49.1"},{date:"2012-01-31","New York":"43.5","San Francisco":"50.0",Austin:"62.8"},{date:"2012-02-01","New York":"50.4","San Francisco":"50.0",Austin:"64.6"},{date:"2012-02-02","New York":"45.8","San Francisco":"51.3",Austin:"61.1"},{date:"2012-02-03","New York":"37.5","San Francisco":"51.5",Austin:"70.0"},{date:"2012-02-04","New York":"40.8","San Francisco":"52.0",Austin:"61.3"},{date:"2012-02-05","New York":"36.5","San Francisco":"53.8",Austin:"48.2"},{date:"2012-02-06","New York":"39.1","San Francisco":"54.6",Austin:"44.2"},{date:"2012-02-07","New York":"43.2","San Francisco":"54.3",Austin:"51.3"},{date:"2012-02-08","New York":"36.5","San Francisco":"51.9",Austin:"49.2"},{date:"2012-02-09","New York":"36.5","San Francisco":"53.8",Austin:"45.7"},{date:"2012-02-10","New York":"38.3","San Francisco":"53.9",Austin:"54.1"},{date:"2012-02-11","New York":"36.9","San Francisco":"52.3",Austin:"44.9"},{date:"2012-02-12","New York":"29.7","San Francisco":"50.1",Austin:"36.5"},{date:"2012-02-13","New York":"33.1","San Francisco":"49.5",Austin:"44.8"},{date:"2012-02-14","New York":"39.6","San Francisco":"48.6",Austin:"52.3"},{date:"2012-02-15","New York":"42.3","San Francisco":"49.9",Austin:"68.0"},{date:"2012-02-16","New York":"39.7","San Francisco":"52.4",Austin:"54.6"},{date:"2012-02-17","New York":"46.0","San Francisco":"49.9",Austin:"53.8"},{date:"2012-02-18","New York":"41.2","San Francisco":"51.6",Austin:"56.2"},{date:"2012-02-19","New York":"39.8","San Francisco":"47.8",Austin:"50.8"},{date:"2012-02-20","New York":"38.1","San Francisco":"48.7",Austin:"53.0"},{date:"2012-02-21","New York":"37.1","San Francisco":"49.7",Austin:"61.0"},{date:"2012-02-22","New York":"45.5","San Francisco":"53.4",Austin:"68.8"},{date:"2012-02-23","New York":"50.6","San Francisco":"54.1",Austin:"69.4"},{date:"2012-02-24","New York":"42.7","San Francisco":"55.9",Austin:"59.3"},{date:"2012-02-25","New York":"42.6","San Francisco":"51.7",Austin:"47.2"},{date:"2012-02-26","New York":"36.9","San Francisco":"47.7",Austin:"47.7"},{date:"2012-02-27","New York":"40.9","San Francisco":"45.4",Austin:"61.9"},{date:"2012-02-28","New York":"45.9","San Francisco":"47.0",Austin:"67.2"},{date:"2012-02-29","New York":"40.7","San Francisco":"49.8",Austin:"70.1"},{date:"2012-03-01","New York":"41.3","San Francisco":"48.9",Austin:"62.1"},{date:"2012-03-02","New York":"36.8","San Francisco":"48.1",Austin:"72.7"},{date:"2012-03-03","New York":"47.6","San Francisco":"50.7",Austin:"59.0"},{date:"2012-03-04","New York":"44.2","San Francisco":"55.0",Austin:"51.8"},{date:"2012-03-05","New York":"38.5","San Francisco":"48.8",Austin:"55.0"},{date:"2012-03-06","New York":"32.9","San Francisco":"48.4",Austin:"61.8"},{date:"2012-03-07","New York":"43.3","San Francisco":"49.9",Austin:"67.1"},{date:"2012-03-08","New York":"51.2","San Francisco":"49.2",Austin:"72.0"},{date:"2012-03-09","New York":"47.8","San Francisco":"51.7",Austin:"46.4"},{date:"2012-03-10","New York":"37.2","San Francisco":"49.3",Austin:"46.7"},{date:"2012-03-11","New York":"42.9","San Francisco":"50.0",Austin:"56.9"},{date:"2012-03-12","New York":"48.8","San Francisco":"48.6",Austin:"61.9"},{date:"2012-03-13","New York":"52.6","San Francisco":"53.9",Austin:"68.8"},{date:"2012-03-14","New York":"60.5","San Francisco":"55.2",Austin:"71.9"},{date:"2012-03-15","New York":"47.2","San Francisco":"55.9",Austin:"72.0"},{date:"2012-03-16","New York":"44.7","San Francisco":"54.6",Austin:"72.5"},{date:"2012-03-17","New York":"48.2","San Francisco":"48.2",Austin:"71.7"},{date:"2012-03-18","New York":"48.2","San Francisco":"47.1",Austin:"71.1"},{date:"2012-03-19","New York":"53.1","San Francisco":"45.8",Austin:"73.0"},{date:"2012-03-20","New York":"57.8","San Francisco":"49.7",Austin:"63.8"},{date:"2012-03-21","New York":"57.5","San Francisco":"51.4",Austin:"60.0"},{date:"2012-03-22","New York":"57.3","San Francisco":"51.4",Austin:"62.3"},{date:"2012-03-23","New York":"61.7","San Francisco":"48.4",Austin:"61.1"},{date:"2012-03-24","New York":"55.8","San Francisco":"49.0",Austin:"62.0"},{date:"2012-03-25","New York":"48.4","San Francisco":"46.4",Austin:"64.6"},{date:"2012-03-26","New York":"49.8","San Francisco":"49.7",Austin:"66.0"},{date:"2012-03-27","New York":"39.6","San Francisco":"54.1",Austin:"65.8"},{date:"2012-03-28","New York":"49.7","San Francisco":"54.6",Austin:"69.2"},{date:"2012-03-29","New York":"56.8","San Francisco":"52.3",Austin:"69.5"},{date:"2012-03-30","New York":"46.5","San Francisco":"54.5",Austin:"73.5"},{date:"2012-03-31","New York":"42.2","San Francisco":"56.2",Austin:"73.9"},{date:"2012-04-01","New York":"45.3","San Francisco":"51.1",Austin:"75.3"},{date:"2012-04-02","New York":"48.1","San Francisco":"50.5",Austin:"75.4"},{date:"2012-04-03","New York":"51.2","San Francisco":"52.2",Austin:"77.3"}
1,{date:"2012-04-04","New York":"61.0","San Francisco":"50.6",Austin:"67.0"},{date:"2012-04-05","New York":"50.7","San Francisco":"47.9",Austin:"71.1"},{date:"2012-04-06","New York":"48.0","San Francisco":"47.4",Austin:"70.4"},{date:"2012-04-07","New York":"51.1","San Francisco":"49.4",Austin:"73.6"},{date:"2012-04-08","New York":"55.7","San Francisco":"50.0",Austin:"71.1"},{date:"2012-04-09","New York":"58.3","San Francisco":"51.3",Austin:"70.0"},{date:"2012-04-10","New York":"55.0","San Francisco":"53.8",Austin:"69.0"},{date:"2012-04-11","New York":"49.0","San Francisco":"52.9",Austin:"69.2"},{date:"2012-04-12","New York":"51.7","San Francisco":"53.9",Austin:"74.5"},{date:"2012-04-13","New York":"53.1","San Francisco":"50.2",Austin:"73.4"},{date:"2012-04-14","New York":"55.2","San Francisco":"50.9",Austin:"76.0"},{date:"2012-04-15","New York":"62.3","San Francisco":"51.5",Austin:"74.5"},{date:"2012-04-16","New York":"62.9","San Francisco":"51.9",Austin:"63.6"},{date:"2012-04-17","New York":"69.3","San Francisco":"53.2",Austin:"67.3"},{date:"2012-04-18","New York":"59.0","San Francisco":"53.0",Austin:"65.1"},{date:"2012-04-19","New York":"54.1","San Francisco":"55.1",Austin:"67.9"},{date:"2012-04-20","New York":"56.5","San Francisco":"55.8",Austin:"68.9"},{date:"2012-04-21","New York":"58.2","San Francisco":"58.0",Austin:"65.1"},{date:"2012-04-22","New York":"52.4","San Francisco":"52.8",Austin:"65.4"}
1,{date:"2012-04-23","New York":"51.6","San Francisco":"55.1",Austin:"70.1"},{date:"2012-04-24","New York":"49.3","San Francisco":"57.9",Austin:"67.0"},{date:"2012-04-25","New York":"52.5","San Francisco":"57.5",Austin:"75.4"},{date:"2012-04-26","New York":"50.5","San Francisco":"55.3",Austin:"77.5"},{date:"2012-04-27","New York":"51.9","San Francisco":"53.5",Austin:"77.0"},{date:"2012-04-28","New York":"47.4","San Francisco":"54.7",Austin:"77.7"},{date:"2012-04-29","New York":"54.1","San Francisco":"54.0",Austin:"77.7"},{date:"2012-04-30","New York":"51.9","San Francisco":"53.4",Austin:"77.7"},{date:"2012-05-01","New York":"57.4","San Francisco":"52.7",Austin:"77.0"},{date:"2012-05-02","New York":"53.7","San Francisco":"50.7",Austin:"77.9"},{date:"2012-05-03","New York":"53.1","San Francisco":"52.6",Austin:"79.1"},{date:"2012-05-04","New York":"57.2","San Francisco":"53.4",Austin:"80.1"},{date:"2012-05-05","New York":"57.0","San Francisco":"53.1",Austin:"82.1"},{date:"2012-05-06","New York":"56.6","San Francisco":"56.5",Austin:"79.0"},{date:"2012-05-07","New York":"54.6","San Francisco":"55.3",Austin:"79.8"},{date:"2012-05-08","New York":"57.9","San Francisco":"52.0",Austin:"70.0"},{date:"2012-05-09","New York":"59.2","San Francisco":"52.4",Austin:"69.8"},{date:"2012-05-10","New York":"61.1","San Francisco":"53.4",Austin:"71.3"},{date:"2012-05-11","New York":"59.7","San Francisco":"53.1",Austin:"69.4"},{date:"2012-05-12","New York":"64.1","San Francisco":"49.9",Austin:"72.0"},{date:"2012-05-13","New York":"65.3","San Francisco":"52.0",Austin:"72.4"},{date:"2012-05-14","New York":"64.2","San Francisco":"56.0",Austin:"72.5"},{date:"2012-05-15","New York":"62.0","San Francisco":"53.0",Austin:"67.6"},{date:"2012-05-16","New York":"63.8","San Francisco":"51.0",Austin:"69.0"},{date:"2012-05-17","New York":"64.5","San Francisco":"51.4",Austin:"72.7"},{date:"2012-05-18","New York":"61.0","San Francisco":"52.2",Austin:"73.7"},{date:"2012-05-19","New York":"62.6","San Francisco":"52.4",Austin:"77.5"},{date:"2012-05-20","New York":"66.2","San Francisco":"54.5",Austin:"75.8"},{date:"2012-05-21","New York":"62.7","San Francisco":"52.8",Austin:"76.9"},{date:"2012-05-22","New York":"63.7","San Francisco":"53.9",Austin:"78.8"},{date:"2012-05-23","New York":"66.4","San Francisco":"56.5",Austin:"77.7"},{date:"2012-05-24","New York":"64.5","San Francisco":"54.7",Austin:"80.6"},{date:"2012-05-25","New York":"65.4","San Francisco":"52.5",Austin:"81.4"},{date:"2012-05-26","New York":"69.4","San Francisco":"52.1",Austin:"82.3"},{date:"2012-05-27","New York":"71.9","San Francisco":"52.2",Austin:"80.3"},{date:"2012-05-28","New York":"74.4","San Francisco":"52.9",Austin:"80.3"},{date:"2012-05-29","New York":"75.9","San Francisco":"52.1",Austin:"82.2"},{date:"2012-05-30","New York":"72.9","San Francisco":"52.1",Austin:"81.9"},{date:"2012-05-31","New York":"72.5","San Francisco":"53.3",Austin:"82.4"},{date:"2012-06-01","New York":"67.2","San Francisco":"54.8",Austin:"77.9"},{date:"2012-06-02","New York":"68.3","San Francisco":"54.0",Austin:"81.1"},{date:"2012-06-03","New York":"67.7","San Francisco":"52.3",Austin:"82.2"},{date:"2012-06-04","New York":"61.9","San Francisco":"55.3",Austin:"81.2"},{date:"2012-06-05","New York":"58.3","San Francisco":"53.5",Austin:"83.0"},{date:"2012-06-06","New York":"61.7","San Francisco":"54.1",Austin:"83.2"},{date:"2012-06-07","New York":"66.7","San Francisco":"53.9",Austin:"82.1"},{date:"2012-06-08","New York":"68.7","San Francisco":"54.4",Austin:"77.5"},{date:"2012-06-09","New York":"72.2","San Francisco":"55.0",Austin:"77.9"},{date:"2012-06-10","New York":"72.6","San Francisco":"60.0",Austin:"82.9"},{date:"2012-06-11","New York":"69.2","San Francisco":"57.2",Austin:"86.8"},{date:"2012-06-12","New York":"66.9","San Francisco":"55.1",Austin:"85.3"},{date:"2012-06-13","New York":"66.7","San Francisco":"53.3",Austin:"76.9"},{date:"2012-06-14","New York":"67.7","San Francisco":"53.4",Austin:"84.5"},{date:"2012-06-15","New York":"68.5","San Francisco":"54.6",Austin:"84.4"},{date:"2012-06-16","New York":"67.5","San Francisco":"57.0",Austin:"83.8"},{date:"2012-06-17","New York":"64.2","San Francisco":"55.6",Austin:"82.5"},{date:"2012-06-18","New York":"61.7","San Francisco":"52.5",Austin:"82.9"},{date:"2012-06-19","New York":"66.4","San Francisco":"53.9",Austin:"82.5"},{date:"2012-06-20","New York":"77.9","San Francisco":"55.3",Austin:"81.3"},{date:"2012-06-21","New York":"88.3","San Francisco":"53.3",Austin:"80.8"},{date:"2012-06-22","New York":"82.2","San Francisco":"54.1",Austin:"81.7"},{date:"2012-06-23","New York":"77.0","San Francisco":"55.2",Austin:"83.9"},{date:"2012-06-24","New York":"75.4","San Francisco":"55.8",Austin:"85.5"},{date:"2012-06-25","New York":"70.9","San Francisco":"56.8",Austin:"87.2"},{date:"2012-06-26","New York":"65.9","San Francisco":"57.5",Austin:"88.0"},{date:"2012-06-27","New York":"73.5","San Francisco":"57.7",Austin:"89.6"}
1,{date:"2012-06-28","New York":"77.4","San Francisco":"56.6",Austin:"86.7"},{date:"2012-06-29","New York":"79.6","San Francisco":"56.4",Austin:"85.3"},{date:"2012-06-30","New York":"84.2","San Francisco":"58.4",Austin:"81.7"},{date:"2012-07-01","New York":"81.8","San Francisco":"58.8",Austin:"78.5"},{date:"2012-07-02","New York":"82.5","San Francisco":"56.4",Austin:"83.1"},{date:"2012-07-03","New York":"80.2","San Francisco":"56.5",Austin:"83.1"},{date:"2012-07-04","New York":"77.8","San Francisco":"55.8",Austin:"84.5"},{date:"2012-07-05","New York":"86.1","San Francisco":"54.8",Austin:"84.6"},{date:"2012-07-06","New York":"79.9","San Francisco":"54.9",Austin:"84.2"},{date:"2012-07-07","New York":"83.5","San Francisco":"54.7",Austin:"86.7"},{date:"2012-07-08","New York":"81.5","San Francisco":"52.8",Austin:"84.3"},{date:"2012-07-09","New York":"77.8","San Francisco":"53.7",Austin:"83.7"},{date:"2012-07-10","New York":"76.1","San Francisco":"53.1",Austin:"77.1"},{date:"2012-07-11","New York":"76.3","San Francisco":"52.7",Austin:"77.4"},{date:"2012-07-12","New York":"75.8","San Francisco":"52.0",Austin:"80.6"},{date:"2012-07-13","New York":"77.2","San Francisco":"53.4",Austin:"81.4"},{date:"2012-07-14","New York":"79.3","San Francisco":"54.0",Austin:"80.2"},{date:"2012-07-15","New York":"78.9","San Francisco":"54.0",Austin:"81.8"},{date:"2012-07-16","New York":"79.6","San Francisco":"54.5",Austin:"77.3"},{date:"2012-07-17","New York":"83.3","San Francisco":"56.7",Austin:"80.8"},{date:"2012-07-18","New York":"84.3","San Francisco":"57.5",Austin:"81.6"},{date:"2012-07-19","New York":"75.1","San Francisco":"57.1",Austin:"80.9"},{date:"2012-07-20","New York":"68.4","San Francisco":"58.1",Austin:"83.9"},{date:"2012-07-21","New York":"68.4","San Francisco":"57.6",Austin:"85.6"},{date:"2012-07-22","New York":"72.2","San Francisco":"56.0",Austin:"83.6"},{date:"2012-07-23","New York":"75.6","San Francisco":"56.6",Austin:"84.0"},{date:"2012-07-24","New York":"82.6","San Francisco":"57.8",Austin:"83.0"},{date:"2012-07-25","New York":"78.4","San Francisco":"57.5",Austin:"84.8"},{date:"2012-07-26","New York":"77.0","San Francisco":"56.4",Austin:"84.4"},{date:"2012-07-27","New York":"79.4","San Francisco":"55.3",Austin:"84.3"},{date:"2012-07-28","New York":"77.4","San Francisco":"55.0",Austin:"83.9"},{date:"2012-07-29","New York":"72.5","San Francisco":"55.6",Austin:"85.0"},{date:"2012-07-30","New York":"72.9","San Francisco":"55.6",Austin:"84.9"},{date:"2012-07-31","New York":"73.6","San Francisco":"55.9",Austin:"86.3"},{date:"2012-08-01","New York":"75.0","San Francisco":"55.4",Austin:"86.5"},{date:"2012-08-02","New York":"77.7","San Francisco":"54.4",Austin:"85.8"},{date:"2012-08-03","New York":"79.7","San Francisco":"53.7",Austin:"85.3"},{date:"2012-08-04","New York":"79.6","San Francisco":"54.1",Austin:"86.0"},{date:"2012-08-05","New York":"81.5","San Francisco":"57.8",Austin:"84.2"},{date:"2012-08-06","New York":"80.0","San Francisco":"58.2",Austin:"81.9"},{date:"2012-08-07","New York":"75.7","San Francisco":"58.0",Austin:"86.5"},{date:"2012-08-08","New York":"77.8","San Francisco":"57.0",Austin:"86.1"},{date:"2012-08-09","New York":"78.6","San Francisco":"55.0",Austin:"86.8"},{date:"2012-08-10","New York":"77.8","San Francisco":"54.8",Austin:"88.0"},{date:"2012-08-11","New York":"78.5","San Francisco":"53.0",Austin:"85.1"},{date:"2012-08-12","New York":"78.8","San Francisco":"52.5",Austin:"87.4"},{date:"2012-08-13","New York":"78.6","San Francisco":"53.3",Austin:"88.0"},{date:"2012-08-14","New York":"76.8","San Francisco":"53.9",Austin:"88.0"},{date:"2012-08-15","New York":"76.7","San Francisco":"56.2",Austin:"87.2"},{date:"2012-08-16","New York":"75.9","San Francisco":"57.1",Austin:"86.1"},{date:"2012-08-17","New York":"77.6","San Francisco":"55.3",Austin:"86.8"},{date:"2012-08-18","New York":"72.6","San Francisco":"56.2",Austin:"84.9"},{date:"2012-08-19","New York":"70.4","San Francisco":"54.3",Austin:"76.8"},{date:"2012-08-20","New York":"71.8","San Francisco":"53.1",Austin:"80.6"},{date:"2012-08-21","New York":"73.6","San Francisco":"53.4",Austin:"80.0"},{date:"2012-08-22","New York":"74.7","San Francisco":"54.5",Austin:"78.2"},{date:"2012-08-23","New York":"74.6","San Francisco":"55.7",Austin:"79.1"},{date:"2012-08-24","New York":"76.0","San Francisco":"54.8",Austin:"81.9"},{date:"2012-08-25","New York":"76.2","San Francisco":"53.8",Austin:"84.7"},{date:"2012-08-26","New York":"73.4","San Francisco":"56.5",Austin:"83.5"},{date:"2012-08-27","New York":"74.6","San Francisco":"58.3",Austin:"82.1"},{date:"2012-08-28","New York":"79.4","San Francisco":"58.7",Austin:"84.0"},{date:"2012-08-29","New York":"74.7","San Francisco":"57.5",Austin:"85.7"},{date:"2012-08-30","New York":"73.5","San Francisco":"55.9",Austin:"87.2"},{date:"2012-08-31","New York":"77.9","San Francisco":"55.4",Austin:"82.9"},{date:"2012-09-01","New York":"80.7","San Francisco":"55.7",Austin:"84.8"},{date:"2012-09-02","New York":"75.1","San Francisco":"53.1",Austin:"83.9"},{date:"2012-09-03","New York":"73.5","San Francisco":"53.5",Austin:"85.5"},{date:"2012-09-04","New York":"73.5","San Francisco":"52.5",Austin:"86.4"},{date:"2012-09-05","New York":"77.7","San Francisco":"54.5",Austin:"85.8"},{date:"2012-09-06","New York":"74.2","San Francisco":"56.3",Austin:"85.4"},{date:"2012-09-07","New York":"76.0","San Francisco":"56.4",Austin:"85.3"},{date:"2012-09-08","New York":"77.1","San Francisco":"56.5",Austin:"81.9"},{date:"2012-09-09","New York":"69.7","San Francisco":"56.4",Austin:"74.8"},{date:"2012-09-10","New York":"67.8","San Francisco":"55.4",Austin:"71.6"},{date:"2012-09-11","New York":"64.0","San Francisco":"56.2",Austin:"75.9"},{date:"2012-09-12","New York":"68.1","San Francisco":"55.7",Austin:"82.1"},{date:"2012-09-13","New York":"69.3","San Francisco":"54.3",Austin:"80.5"},{date:"2012-09-14","New York":"70.0","San Francisco":"55.2",Austin:"70.0"},{date:"2012-09-15","New York":"69.3","San Francisco":"54.3",Austin:"71.2"},{date:"2012-09-16","New York":"66.3","San Francisco":"52.9",Austin:"70.3"},{date:"2012-09-17","New York":"67.0","San Francisco":"54.8",Austin:"72.1"},{date:"2012-09-18","New York":"72.8","San Francisco":"54.8",Austin:"73.7"},{date:"2012-09-19","New York":"67.2","San Francisco":"56.8",Austin:"72.7"},{date:"2012-09-20","New York":"62.1","San Francisco":"55.4",Austin:"71.7"},{date:"2012-09-21","New York":"64.0","San Francisco":"55.8",Austin:"72.9"},{date:"2012-09-22","New York":"65.5","San Francisco":"55.9",Austin:"73.1"},{date:"2012-09-23","New York":"65.7","San Francisco":"52.8",Austin:"75.6"},{date:"2012-09-24","New York":"60.4","San Francisco":"54.5",Austin:"78.3"},{date:"2012-09-25","New York":"63.2","San Francisco":"53.3",Austin:"78.3"},{date:"2012-09-26","New York":"68.5","San Francisco":"53.6",Austin:"79.6"},{date:"2012-09-27","New York":"69.2","San Francisco":"52.1",Austin:"76.4"},{date:"2012-09-28","New York":"68.7","San Francisco":"52.6",Austin:"77.2"},{date:"2012-09-29","New York":"62.5","San Francisco":"53.9",Austin:"75.2"},{date:"2012-09-30","New York":"62.3","San Francisco":"55.1",Austin:"71.9"}],t=e;return on.default=t,on}var pp=fp();const mp=Vo(pp);globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const gp="#6c5efb",wp="#c998ff",vp="#a44afe",xp={top:20,right:0,bottom:0,left:0},yp={...$u,minWidth:60,backgroundColor:"rgba(0,0,0,0.9)",color:"white"},St=mp.slice(0,50).map(e=>({date:e.date,rsb:Math.round(Math.random()*120)+5,actualRSS:Math.round(Math.random()*120),planRSS:Math.round(Math.random()*120)})),$c=Object.keys(St[0]).filter(e=>e!=="date"&&e!=="rsb"),kp=Pu("%Y-%m-%d"),Cp=Ru("%b %d"),Sp=e=>Cp(kp(e)),Vc=e=>e.date,mt=Gu({domain:St.map(Vc),padding:.5}),Vt=Vu({domain:[0,240],nice:!0}),bp=$2({domain:$c,range:[gp,wp,vp]});let To;const Ap=({width:e,height:t,events:n=!1,margin:r=xp})=>{var S,C,y;const{tooltipOpen:o,tooltipLeft:a,tooltipData:s,hideTooltip:c,showTooltip:l}=Hu();if(s&&console.log((S=Vt(St[s.index].rsb))!=null?S:0),e<10)return null;const u=e,h=t-r.top-30;mt.rangeRound([0,u]),Vt.range([h,0]);const p=m=>m/(St.length-1)*100+"%",f=30,k=30;return e<10?null:i.jsxs("div",{style:{position:"relative"},children:[i.jsxs("svg",{width:e,height:t,children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:"solids",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[i.jsx("stop",{offset:"0%",style:{stopColor:"#197BF6"}}),i.jsx("stop",{offset:p(f),style:{stopColor:"#197BF6"}}),i.jsx("stop",{offset:p(f),style:{stopColor:"white"}}),i.jsx("stop",{offset:"100%",style:{stopColor:"white"}})]})}),i.jsxs(qt,{top:r.top,children:[St.map((m,d)=>{var w;const g=(w=mt(m.date))!=null?w:0;return i.jsx(Di,{x:g,y:0,height:h,width:mt.bandwidth(),fill:"transparent",onMouseLeave:()=>{To=window.setTimeout(()=>{c()},300)},onMouseMove:v=>{To&&clearTimeout(To);const x=ld(v),b=g+mt.bandwidth()/2;l({tooltipData:{bar:m,index:d},tooltipTop:x==null?void 0:x.y,tooltipLeft:b})}},"bar-".concat(d))}),i.jsx(tf,{data:St,keys:$c,x:Vc,xScale:mt,yScale:Vt,color:bp,children:m=>m.map(d=>d.bars.map((g,w)=>g.key==="actualRSS"&&w>k||g.key==="planRSS"&&w<k?null:i.jsx("rect",{x:g.x,y:w===k?g.y:h-g.height,height:g.height,width:g.width,fill:w>k?"rgba(255, 255, 255, 0.2)":w<k?"white":g.key==="planRSS"?"rgba(255, 255, 255, 0.2)":"#197BF6",onClick:()=>{n&&alert("clicked: ".concat(JSON.stringify(g)))},style:{pointerEvents:"none"}},"bar-stack-".concat(d.index,"-").concat(g.index))))}),i.jsx(qt,{style:{pointerEvents:"none"},children:i.jsx(ud,{data:St,x:m=>{var d;return((d=mt(m.date))!=null?d:0)+mt.bandwidth()/2},y:m=>{var d,g;return console.log(m,(d=Vt(m.rsb))!=null?d:0),(g=Vt(m.rsb))!=null?g:0}
1,stroke:"url(#solids)",strokeWidth:2,shapeRendering:"geometricPrecision",curve:A1,style:{pointerEvents:"none"}})})]}),i.jsx(hp,{top:h+r.top,scale:mt,tickFormat:Sp,stroke:"white",tickStroke:"white",tickLabelProps:{fill:"white",fontSize:14,fontWeight:"bold",textAnchor:"middle"}}),o&&s&&i.jsxs(qt,{top:r.top,children:[i.jsx(Xo,{from:{x:a,y:0},to:{x:a,y:h},stroke:"#fff",strokeWidth:2,pointerEvents:"none",strokeDasharray:"5,2",style:{pointerEvents:"none"}}),i.jsx(Ku,{r:4,cx:((C=mt(St[s.index].date))!=null?C:0)+mt.bandwidth()/2,cy:(y=Vt(St[s.index].rsb))!=null?y:0,fill:"white",strokeWidth:2,stroke:"#197BF6"})]})]}),o&&s&&i.jsx(Bu,{top:20,left:a,style:yp,children:i.jsxs(re,{gap:2,children:[i.jsx(R,{size:"xs",children:"Week of March 1st, 2023"}),i.jsx(R,{size:"xs",children:"RSS 120/320"}),i.jsx(R,{size:"xs",children:"RSB +30"}),i.jsx(R,{size:"xs",children:"CP 232"})]})})]})},Tp=({fetchRangeIndexes:e})=>{const t=Re(),{useShowWeeklyRunningGraph:n,useCalendarWeekDates:r,useTodayIndexInWeek:o}=Dt(),[a,s]=n(),c=r(),l=o(),{updateCalendarEntriesFromResponse:u}=Kn(),{mutateAsync:h}=_i(),{userData:p}=Xe(),[f,{width:k,height:S}]=Ri();console.log(S);const C=({min:d,max:g})=>{d<0&&(d=0);const w=xe.tz(c[d][0],p.time_zone),v=xe.tz(c[g].at(-1),p.time_zone).add(1,"day");h({from:w.toDate(),to:v.toDate(),include_deleted:!1,userId:p.id}).then(x=>{u(x)})},y=l-20,m=l+20;return Y.useEffect(()=>{a&&(e.current={min:Math.min(y,e.current.min),max:Math.max(m,e.current.max)},C({min:y,max:m}))},[a]),i.jsxs(re,{justify:a?"center":"flex-start",p:"8",m:"sm",mb:0,pos:"relative",style:{height:a?200:30,marginRight:30},children:[i.jsxs(zn,{align:"center",gap:4,pos:"absolute",top:0,left:0,children:[i.jsx(R,{children:t.formatMessage({id:"RSSChart.weeklyRunningLabel",defaultMessage:"WEEKLY RUNNING"})}),i.jsx(et,{variant:"default",size:"xs",onClick:()=>s(d=>!d),children:a?i.jsx(d1,{}):i.jsx(l1,{})})]}),i.jsx(zn,{ref:f,flex:1,style:{paddingTop:20},children:a&&i.jsx(Ap,{width:k,height:180})})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const jp={min:0,max:0},Np=()=>{const{useCalendarView:e}=Dt(),[t]=e(),{alpha:n}=Ou(),r=Y.useRef(null),o=Y.useRef(jp);return i.jsx(p2,{children:i.jsxs(W,{align:"stretch",gap:0,style:{height:"100vh",overflowY:"hidden"},children:[i.jsxs(re,{flex:1,gap:0,children:[n&&i.jsx(Tp,{fetchRangeIndexes:o}),i.jsx(H1,{monthlyCalendarRef:r}),i.jsx(zn,{style:{flex:1},children:t==="monthly"&&i.jsx(c2,{calendarRef:r,fetchRangeIndexes:o})})]}),i.jsx(H2,{})]})})},Up=e=>i.jsx(O1,{children:i.jsx(Np,{})});export{Up as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.