@aracreate/arm-ui 3.13.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{a as ha,b as D,c as Vt}from"./chunk-LGJWNA6J.mjs";import{Box as Yl,Flex as ql,Grid as Xl,Container as Jl,Section as Zl,Inset as Ql,AspectRatio as ec,ScrollArea as rc,Separator as tc,Text as oc,Heading as ac,Blockquote as nc,Code as ic,Em as sc,Kbd as lc,Link as cc,Quote as dc,Strong as pc,Button as gc,IconButton as uc,TextField as mc,TextArea as fc,Checkbox as yc,CheckboxGroup as vc,CheckboxCards as hc,Radio as bc,RadioGroup as xc,RadioCards as Cc,Select as wc,Slider as Tc,Switch as Sc,SegmentedControl as Rc,Dialog as kc,AlertDialog as Dc,DropdownMenu as Ac,ContextMenu as Ic,Popover as Pc,HoverCard as Ec,Tooltip as Nc,Portal as Bc,Avatar as Mc,Badge as zc,Callout as Lc,Card as Fc,DataList as Hc,Progress as Oc,Spinner as _c,Table as Vc,Tabs as Wc,TabNav as $c,AccessibleIcon as Uc,Slot as Gc,Slottable as Kc,VisuallyHidden as jc}from"@radix-ui/themes";import{jsx as xa}from"react/jsx-runtime";function ba({width:e="100%",height:r="var(--space-4)",radius:t="var(--radius-2)",circle:o=!1,mb:n,className:a,style:i}){return xa("div",{className:["skeleton",a].filter(Boolean).join(" "),"aria-hidden":"true",style:{width:e,height:r,borderRadius:o?"50%":t,marginBottom:n,...i}})}import*as We from"react";import*as le from"@radix-ui/react-accordion";import{ChevronDownIcon as Ca}from"@radix-ui/react-icons";import{jsx as Be,jsxs as wa}from"react/jsx-runtime";var Wt=We.forwardRef(({className:e="",...r},t)=>Be(le.Root,{ref:t,className:`arm-accordion ${e}`,...r}));Wt.displayName="Accordion";var $t=We.forwardRef(({className:e="",...r},t)=>Be(le.Item,{ref:t,className:`arm-accordion__item ${e}`,...r}));$t.displayName="AccordionItem";var Ut=We.forwardRef(({className:e="",children:r,...t},o)=>Be(le.Header,{className:"arm-accordion__header",children:wa(le.Trigger,{ref:o,className:`arm-accordion__trigger ${e}`,...t,children:[r,Be(Ca,{"aria-hidden":!0,className:"arm-accordion__chevron"})]})}));Ut.displayName="AccordionTrigger";var Gt=We.forwardRef(({className:e="",children:r,...t},o)=>Be(le.Content,{ref:o,className:`arm-accordion__content ${e}`,...t,children:Be("div",{className:"arm-accordion__body",children:r})}));Gt.displayName="AccordionContent";import*as cr from"react";import*as N from"@radix-ui/react-dialog";import{Cross2Icon as Ta}from"@radix-ui/react-icons";import{jsx as we,jsxs as Ia}from"react/jsx-runtime";var Sa=N.Root,Ra=N.Trigger,ka=N.Close,Kt=cr.forwardRef(({className:e="",side:r="right",size:t="md",children:o,...n},a)=>Ia(N.Portal,{children:[we(N.Overlay,{className:"arm-drawer__overlay"}),we(N.Content,{ref:a,"data-side":r,"data-size":t,className:`arm-drawer ${e}`,...n,children:o})]}));Kt.displayName="DrawerContent";var Da=({className:e="",children:r,...t})=>we("div",{className:`arm-drawer__header ${e}`,...t,children:r}),jt=cr.forwardRef(({className:e="",...r},t)=>we(N.Title,{ref:t,className:`arm-drawer__title ${e}`,...r}));jt.displayName="DrawerTitle";var Yt=cr.forwardRef(({className:e="",...r},t)=>we(N.Description,{ref:t,className:`arm-drawer__description ${e}`,...r}));Yt.displayName="DrawerDescription";var Aa=()=>we(N.Close,{"aria-label":"Close",className:"arm-drawer__close",children:we(Ta,{"aria-hidden":!0,className:"arm-drawer__close-icon"})});import{Box as qt,Flex as Pa,Text as Ea}from"@radix-ui/themes";import{jsx as Fr,jsxs as Jt}from"react/jsx-runtime";function Xt({title:e,trailing:r,style:t}){let o=typeof e=="string"||typeof e=="number"?Fr(Ea,{size:"3",weight:"medium",style:{color:"var(--accent-contrast)"},children:e}):e;return Jt(Pa,{align:"center",justify:"between",gap:"3",px:"4",style:{background:"var(--accent-9)",minHeight:"var(--space-7)",...t},children:[o,r]})}function Na({title:e,trailing:r,children:t,bodyPadding:o="4",style:n}){return Jt(qt,{style:{background:"var(--color-panel-solid)",borderRadius:"var(--radius-5)",overflow:"hidden",boxShadow:"var(--shadow-card)",...n},children:[Fr(Xt,{title:e,trailing:r}),Fr(qt,{p:o,children:t})]})}import{AlertDialog as Te,Button as Zt}from"@radix-ui/themes";var x={contentMax:"calc(15 * var(--space-9) + var(--space-5))",accountCardW:"calc(3 * var(--space-9) + var(--space-8))",accountCardMinH:"calc(2 * var(--space-9) - var(--space-2))",monthTitleMinW:"calc(3 * var(--space-9) - var(--space-1))",bigCalendarH:"calc(10 * var(--space-9))",sidebarColBasis:"calc(4 * var(--space-9) - var(--space-2))",sidebarColMin:"calc(3 * var(--space-9) + var(--space-6))",syncColMin:"calc(5 * var(--space-9))",syncColWide:"calc(7 * var(--space-9) + var(--space-6))",dialogSm:"calc(6 * var(--space-9) - var(--space-2))",dialogBody:"calc(5 * var(--space-9) + var(--space-7))",authFormMax:"calc(6 * var(--space-9) + var(--space-8))",brandLogoMax:"calc(6 * var(--space-9) + var(--space-8) - var(--space-1))",connectedAccountCardH:"calc(var(--space-9) - var(--space-1))",dialogMd:"calc(6 * var(--space-9) + var(--space-6))",dialogLg:"calc(7 * var(--space-9) - var(--space-1))",emptyStateMax:"calc(10 * var(--space-9))",emptyStateCopyMax:"calc(6 * var(--space-9))",providerChooserMax:"calc(6 * var(--space-9) + var(--space-6))",auditColTime:"calc(var(--space-9) + var(--space-2))",auditColAction:"calc(var(--space-9) + var(--space-5) + var(--space-1))",searchFieldW:"calc(3 * var(--space-9) + var(--space-5) + var(--space-1))",settingsGridMin:"calc(5 * var(--space-9) + var(--space-5))",placeholderMd:"calc(6 * var(--space-9) + var(--space-4))"};import{Flex as Ba}from"@radix-ui/themes";import{jsx as Ma}from"react/jsx-runtime";function Q({children:e,justify:r="end",noTopMargin:t,pad:o="var(--space-5)",radius:n="var(--radius-5)"}){return Ma(Ba,{justify:r,style:{margin:`${t?"0":"var(--space-5)"} calc(-1 * ${o}) calc(-1 * ${o})`,padding:`var(--space-4) ${o}`,alignItems:"center",background:"var(--gray-2)",borderTop:"1px solid var(--gray-5)",borderRadius:`0 0 ${n} ${n}`},children:e})}import{jsx as Se,jsxs as Hr}from"react/jsx-runtime";function Or({title:e,description:r,confirmLabel:t="Yes",cancelLabel:o="Cancel",onConfirm:n,trigger:a,open:i,onOpenChange:l}){return Hr(Te.Root,{open:i,onOpenChange:l,children:[a?Se(Te.Trigger,{children:a}):null,Hr(Te.Content,{maxWidth:x.dialogSm,children:[Se(Te.Title,{size:"5",mb:"1",style:{fontFamily:"var(--heading-font-family)",fontWeight:"var(--font-weight-medium)"},children:e}),Se(Te.Description,{size:"2",color:"gray",mb:"5",children:r}),Hr(Q,{justify:"between",noTopMargin:!0,children:[Se(Te.Cancel,{children:Se(Zt,{size:"2",variant:"outline",color:"gray",children:o})}),Se(Te.Action,{children:Se(Zt,{size:"2",className:"btn-amber-primary",onClick:n,children:t})})]})]})]})}import{PauseIcon as za}from"@radix-ui/react-icons";function h(e){return{width:`var(${e})`,height:`var(${e})`}}import{jsx as Qt,jsxs as La}from"react/jsx-runtime";function _r({label:e="Paused",style:r}){return La("span",{style:{display:"inline-flex",alignItems:"center",gap:"var(--space-1)",height:"calc(var(--space-4) + var(--space-1))",padding:"var(--space-1) var(--space-2)",border:"1px solid var(--color-paused)",borderRadius:999,background:"var(--color-panel-solid)",color:"var(--color-paused)",fontSize:"var(--font-size-1)",fontWeight:600,lineHeight:1,whiteSpace:"nowrap",...r},children:[Qt("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--space-3)",height:"var(--space-3)",flexShrink:0,borderRadius:"50%",border:"1px solid var(--color-paused)"},children:Qt(za,{style:h("--space-2")})}),e]})}import{Avatar as Fa,Box as eo,DropdownMenu as Me,Flex as ro,IconButton as Ha,Text as to}from"@radix-ui/themes";import{DotsVerticalIcon as Oa,PauseIcon as _a,PlayIcon as Va,TrashIcon as Wa}from"@radix-ui/react-icons";import{jsx as G,jsxs as ce}from"react/jsx-runtime";function $a({name:e,email:r,avatarSrc:t,paused:o=!1,onPause:n,onResume:a,onDelete:i,onClick:l,badge:s,accentColor:c,style:g}){let p=G(to,{as:l?"span":"p",size:"3",weight:"medium",truncate:!0,style:{color:"var(--gray-12)",minWidth:0},children:e});return ce(eo,{onClick:l,style:{width:x.accountCardW,minHeight:x.accountCardMinH,padding:"var(--space-3)",background:"var(--color-panel-solid)",borderRadius:"var(--radius-4)",boxShadow:"var(--shadow-card)",cursor:l?"pointer":void 0,...g},children:[ce(ro,{align:"center",justify:"between",gap:"2",mb:"3",children:[ce(ro,{align:"center",gap:"2",style:{minWidth:0},children:[ce("div",{style:{position:"relative",flexShrink:0},children:[G(Fa,{size:"3",radius:"full",src:t,fallback:e.charAt(0).toUpperCase()||"?",style:c?{background:c,color:"white"}:void 0}),s&&G("span",{style:{position:"absolute",right:"calc(-1 * var(--space-1))",bottom:"calc(-1 * var(--space-1))",width:"var(--space-4)",height:"var(--space-4)",borderRadius:"50%",background:"var(--color-panel-solid)",border:"1px solid var(--gray-4)",display:"inline-flex",alignItems:"center",justifyContent:"center",transform:"scale(0.72)"},children:s})]}),o&&G(_r,{})]}),ce(Me.Root,{children:[G(Me.Trigger,{children:G(Ha,{variant:"ghost",color:"gray","aria-label":"Account actions",style:{flexShrink:0},onClick:u=>u.stopPropagation(),children:G(Oa,{})})}),ce(Me.Content,{align:"end",onClick:u=>u.stopPropagation(),children:[o?ce(Me.Item,{onSelect:a,children:[G(Va,{})," Resume"]}):ce(Me.Item,{onSelect:n,children:[G(_a,{})," Pause"]}),ce(Me.Item,{color:"red",onSelect:i,children:[G(Wa,{})," Delete"]})]})]})]}),ce(eo,{style:{minWidth:0},children:[l?G("button",{type:"button",className:"card-title-button",onClick:u=>{u.stopPropagation(),l()},children:p}):p,G(to,{as:"p",size:"1",color:"gray",truncate:!0,children:r})]})]})}import{Box as oo,Flex as ao,Heading as Ua,IconButton as no,Text as io}from"@radix-ui/themes";import{ChevronLeftIcon as Ga,ChevronRightIcon as Ka}from"@radix-ui/react-icons";var O={h1:"6",h2:"5",h3:"4",h4:"3"};import{Fragment as en,jsx as L,jsxs as Wr}from"react/jsx-runtime";var ja=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Vr="var(--space-9)",Ya="var(--space-8)",so="var(--space-2)",qa=new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}),Xa=new Intl.DateTimeFormat("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"});function Ja(e,r){return e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()&&e.getDate()===r.getDate()}function lo(e){return(e+6)%7}function Za(e){let r=e.getMonth(),t=e.getFullYear(),o=new Date(t,r,1),n=new Date(t,r+1,0),a=lo(o.getDay()),i=6-lo(n.getDay()),l=new Date(t,r,1-a),s=a+n.getDate()+i;return Array.from({length:s},(c,g)=>{let p=new Date(l.getFullYear(),l.getMonth(),l.getDate()+g);return{date:p,inCurrentMonth:p.getMonth()===r}})}function co(e,r){return new Date(e.getFullYear(),e.getMonth()+r,1)}function Qa({month:e,onMonthChange:r,events:t=[],dayDots:o,today:n,onSelectDay:a,style:i}){let l=n??new Date,s=Za(e),c=new Set(t.map(g=>g.toDateString()));return Wr(ao,{direction:"column",align:"center",gap:"4",style:i,children:[Wr(ao,{align:"center",gap:"2",children:[L(no,{type:"button",variant:"ghost",color:"gray","aria-label":"Previous month",onClick:()=>r?.(co(e,-1)),children:L(Ga,{style:h("--space-4")})}),L(Ua,{as:"h2",size:O.h2,weight:"medium",style:{minWidth:x.monthTitleMinW,textAlign:"center"},children:qa.format(e)}),L(no,{type:"button",variant:"ghost",color:"gray","aria-label":"Next month",onClick:()=>r?.(co(e,1)),children:L(Ka,{style:h("--space-4")})})]}),L(oo,{style:{display:"grid",gridTemplateColumns:`repeat(7, ${Vr})`,gap:so},children:ja.map(g=>L(io,{size:"2",align:"center",style:{color:"var(--gray-11)"},children:g},g))}),L(oo,{style:{display:"grid",gridTemplateColumns:`repeat(7, ${Vr})`,gap:so},children:s.map(({date:g,inCurrentMonth:p})=>{let u=Ja(g,l),b=o?.get(g.toDateString()),v=c.has(g.toDateString()),f={position:"relative",width:Vr,height:Ya,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",background:p?u?"var(--color-panel-solid)":"transparent":"var(--gray-2)",border:u?"1.5px solid var(--accent-9)":"none",borderRadius:u?"var(--radius-3)":p?void 0:"var(--radius-2)",padding:0,font:"inherit",cursor:a?"pointer":void 0},S=Wr(en,{children:[b&&b.length>0?L("span",{"aria-hidden":"true",style:{position:"absolute",bottom:"var(--space-1)",left:0,right:0,display:"flex",justifyContent:"center",gap:"2px"},children:b.slice(0,3).map((X,ie)=>L("span",{style:{width:"var(--space-1)",height:"var(--space-1)",borderRadius:"50%",background:X}},ie))}):v&&L("span",{"aria-hidden":"true",style:{position:"absolute",top:"var(--space-1)",right:"var(--space-2)",width:"var(--space-2)",height:"var(--space-2)",borderRadius:"50%",background:"var(--accent-9)"}}),L(io,{size:"3",style:{color:p?"var(--gray-12)":"var(--gray-11)",fontWeight:u?600:400},children:g.getDate()})]}),E=g.toISOString();return a?L("button",{type:"button",onClick:()=>a(g),"aria-label":Xa.format(g),style:f,children:S},E):L("div",{style:f,children:S},E)})})]})}import{useEffect as rn}from"react";import{Callout as $r}from"@radix-ui/themes";import{CheckCircledIcon as tn,ExclamationTriangleIcon as on}from"@radix-ui/react-icons";import{jsx as $e,jsxs as an}from"react/jsx-runtime";function Ur({msg:e,color:r="green",onDone:t,durationMs:o=3e3}){return rn(()=>{let n=setTimeout(t,o);return()=>clearTimeout(n)},[t,o]),$e("div",{style:{position:"fixed",bottom:"var(--space-5)",right:"var(--space-5)",zIndex:1e4,maxWidth:x.dialogBody,pointerEvents:"none"},children:an($r.Root,{color:r,variant:"soft",size:"1",children:[$e($r.Icon,{children:r==="red"?$e(on,{}):$e(tn,{})}),$e($r.Text,{children:e})]})})}import{jsx as nn}from"react/jsx-runtime";function B({children:e,size:r="var(--space-7)"}){return nn("div",{style:{width:r,height:r,borderRadius:"var(--radius-4)",background:"var(--color-panel-solid)",border:"1px solid var(--gray-5)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e})}import{Box as sn,Flex as ln,Text as po}from"@radix-ui/themes";import{LockClosedIcon as cn}from"@radix-ui/react-icons";import{jsx as go,jsxs as Gr}from"react/jsx-runtime";function dn({title:e,time:r,detail:t,color:o,locked:n}){return Gr(ln,{align:"center",justify:"between",style:{background:o,borderRadius:"var(--radius-3)",padding:"var(--space-3)",color:"white"},children:[Gr(sn,{style:{minWidth:0},children:[go(po,{as:"p",size:"2",weight:"medium",style:{color:"white"},truncate:!0,children:e}),Gr(po,{as:"p",size:"1",style:{color:"rgba(255,255,255,0.85)"},truncate:!0,children:[r,t?` \xB7 ${t}`:""]})]}),n&&go(cn,{style:{flexShrink:0,color:"rgba(255,255,255,0.85)"}})]})}import{Box as pn}from"@radix-ui/themes";import{jsx as gn}from"react/jsx-runtime";function Kr({children:e,style:r,showBorder:t=!1,onActivate:o,selected:n=!1,className:a,"aria-label":i}){let l=!!o;function s(c){o&&(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),o())}return gn(pn,{role:l?"button":void 0,tabIndex:l?0:void 0,"aria-label":i,onClick:o,onKeyDown:l?s:void 0,className:["data-table-row",l&&"data-table-row--interactive",l&&n&&"data-table-row--selected",a].filter(Boolean).join(" "),style:{borderTop:t?"1px solid var(--gray-3)":void 0,...r},children:e})}import{useId as un}from"react";import{Card as mn,Flex as jr,Text as Yr}from"@radix-ui/themes";import{jsx as de,jsxs as ze}from"react/jsx-runtime";function fn({label:e,value:r,delta:t,deltaDir:o,goodDirection:n,statusColor:a,sparkline:i}){return de(mn,{className:"metric-card",children:ze(jr,{direction:"column",p:"1",children:[ze(jr,{align:"center",justify:"between",mb:"3",children:[de(Yr,{as:"span",className:"ds-section-label",children:e}),de("div",{style:{width:"var(--space-2)",height:"var(--space-2)",borderRadius:"50%",background:a,flexShrink:0}})]}),de(Yr,{as:"p",className:"metric-card-value",children:r}),ze(jr,{align:"end",justify:"between",children:[ze(Yr,{size:"1",style:{color:o==="flat"?"var(--gray-11)":o===n?"var(--green-11)":"var(--red-11)",lineHeight:1.4},children:[o==="up"?"\u2191 ":o==="down"?"\u2193 ":"",t]}),de(yn,{data:i,color:a})]})]})})}function yn({data:e,color:r}){let n=Math.min(...e),i=Math.max(...e)-n||1,l=e.map((u,b)=>({x:b/(e.length-1)*72,y:28-(u-n)/i*28*.75-28*.1})),s=l.map((u,b)=>`${b===0?"M":"L"} ${u.x.toFixed(1)} ${u.y.toFixed(1)}`).join(" "),c=["M 0 28",...l.map(u=>`L ${u.x.toFixed(1)} ${u.y.toFixed(1)}`),"L 72 28 Z"].join(" "),p=`spk${un().replace(/[^a-zA-Z0-9_-]/g,"")}`;return ze("svg",{width:72,height:28,viewBox:"0 0 72 28","aria-hidden":!0,style:{overflow:"visible",flexShrink:0},children:[de("defs",{children:ze("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:[de("stop",{offset:"0%",stopColor:r,stopOpacity:"0.18"}),de("stop",{offset:"100%",stopColor:r,stopOpacity:"0"})]})}),de("path",{d:c,fill:`url(#${p})`}),de("path",{d:s,fill:"none",stroke:r,strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})]})}import{Link as vn}from"react-router-dom";import{Badge as hn,Button as bn,Card as xn,Flex as uo,Text as mo}from"@radix-ui/themes";import{ArrowRightIcon as Cn}from"@radix-ui/react-icons";import{jsx as Re,jsxs as dr}from"react/jsx-runtime";function wn({href:e,icon:r,name:t,description:o,badge:n}){return dr(xn,{style:{height:"100%",display:"flex",flexDirection:"column"},children:[dr(uo,{direction:"column",gap:"3",p:"1",flexGrow:"1",children:[dr(uo,{align:"center",gap:"3",minWidth:"0",children:[Re(B,{children:r}),Re(mo,{size:"4",weight:"medium",style:{color:"var(--gray-12)",fontFamily:"var(--font-poppins)"},truncate:!0,children:t}),n&&Re(hn,{color:"gray",variant:"soft",size:"1",radius:"full",style:{flexShrink:0},children:n})]}),Re(mo,{size:"2",style:{color:"var(--gray-11)",fontFamily:"var(--font-poppins)",lineHeight:1.5},children:o})]}),Re(Q,{pad:"var(--space-3)",radius:"var(--radius-4)",children:Re(bn,{size:"2",className:"btn-amber-primary",asChild:!0,children:dr(vn,{to:e,children:["Open",Re(Cn,{style:h("--space-3")})]})})})]})}import{Text as Ue}from"@radix-ui/themes";import{jsx as qr,jsxs as Xr}from"react/jsx-runtime";function Tn({tag:e,tagColor:r,msg:t,actor:o,timeAgo:n,timestamp:a,showBorder:i}){return Xr(Kr,{showBorder:i,style:{display:"flex",alignItems:"center",gap:"var(--space-3)",paddingBlock:"var(--space-2)",paddingInline:"var(--space-4)"},children:[qr(Ue,{as:"span",size:"1",weight:"medium",className:"data-mono",style:{color:r,minWidth:"var(--space-6)",letterSpacing:"0.06em",flexShrink:0},children:e}),Xr(Ue,{as:"span",size:"2",style:{flex:1,color:"var(--gray-11)",lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[t,o&&Xr(Ue,{as:"span",size:"1",style:{color:"var(--gray-11)",marginLeft:"var(--space-2)"},children:["by ",o]})]}),n&&qr(Ue,{as:"span",size:"1",color:"gray",style:{whiteSpace:"nowrap",flexShrink:0},children:n}),qr(Ue,{as:"span",size:"1",className:"data-mono",style:{color:"var(--gray-11)",whiteSpace:"nowrap",flexShrink:0,minWidth:"var(--space-7)",textAlign:"right"},children:a})]})}import{Button as Sn,Card as Rn,Flex as kn,Text as Dn}from"@radix-ui/themes";import{ExclamationTriangleIcon as An}from"@radix-ui/react-icons";import{jsx as Ge,jsxs as Pn}from"react/jsx-runtime";function In({onRetry:e,message:r="Couldn't load your dashboard."}){return Ge(Rn,{children:Pn(kn,{direction:"column",align:"center",justify:"center",py:"9",gap:"3",children:[Ge(B,{children:Ge(An,{style:{...h("--space-5"),color:"var(--gray-7)"}})}),Ge(Dn,{size:"2",color:"gray",children:r}),Ge(Sn,{size:"2",color:"amber",variant:"solid",className:"btn-amber-primary",onClick:e,children:"Retry"})]})})}import{useMemo as En}from"react";import{Button as Nn,Flex as Bn,IconButton as pr,Text as Mn}from"@radix-ui/themes";import{ChevronLeftIcon as zn,ChevronRightIcon as Ln,DoubleArrowLeftIcon as Fn,DoubleArrowRightIcon as Hn}from"@radix-ui/react-icons";import{jsx as ee,jsxs as Vn}from"react/jsx-runtime";var Le="\u2026";function On(e,r,t){let o=t*2+5;if(r<=o)return Array.from({length:r},(c,g)=>g+1);let n=Math.max(e-t,1),a=Math.min(e+t,r),i=n>2,l=a<r-1;if(!i&&l)return[...Array.from({length:3+t*2},(g,p)=>p+1),Le,r];if(i&&!l){let c=3+t*2,g=Array.from({length:c},(p,u)=>r-c+u+1);return[1,Le,...g]}let s=Array.from({length:a-n+1},(c,g)=>n+g);return[1,Le,...s,Le,r]}function _n({currentPage:e,totalPages:r,onPageChange:t,siblingCount:o=1,showFirstLast:n=!1,size:a="2"}){let i=En(()=>On(e,r,o),[e,r,o]),l=e<=1,s=e>=r;return ee(Bn,{asChild:!0,align:"center",gap:"1",children:Vn("nav",{"aria-label":"Pagination",children:[n&&ee(pr,{size:a,variant:"soft",color:"gray","aria-label":"First page",disabled:l,onClick:()=>t(1),children:ee(Fn,{})}),ee(pr,{size:a,variant:"soft",color:"gray","aria-label":"Previous page",disabled:l,onClick:()=>t(e-1),children:ee(zn,{})}),i.map((c,g)=>c===Le?ee(Mn,{size:a,color:"gray","aria-hidden":!0,style:{paddingInline:"var(--space-1)"},children:Le},`ellipsis-${g}`):ee(Nn,{size:a,"aria-label":`Page ${c}`,"aria-current":c===e?"page":void 0,variant:c===e?"solid":"soft",color:c===e?void 0:"gray",className:c===e?"btn-amber-primary":void 0,onClick:()=>c!==e&&t(c),children:c},c)),ee(pr,{size:a,variant:"soft",color:"gray","aria-label":"Next page",disabled:s,onClick:()=>t(e+1),children:ee(Ln,{})}),n&&ee(pr,{size:a,variant:"soft",color:"gray","aria-label":"Last page",disabled:s,onClick:()=>t(r),children:ee(Hn,{})})]})})}var gr={admin:{label:"Admin",color:"amber"},operator:{label:"Operator",color:"blue"},user:{label:"Platform User",color:"gray"}},Wn={admin:gr.admin.label,operator:gr.operator.label,user:gr.user.label},$n={active:{label:"Active",color:"var(--color-success)"},inactive:{label:"Inactive",color:"var(--gray-11)"},suspended:{label:"Suspended",color:"var(--color-danger)"}},Un={ok:"var(--green-9)",warn:"var(--orange-9)",error:"var(--red-9)"},Gn={auth:{tag:"AUTH",color:"var(--gray-11)"},sync:{tag:"SYNC",color:"var(--blue-11)"},role:{tag:"ROLE",color:"var(--violet-11)"},provision:{tag:"PROV",color:"var(--green-11)"},health:{tag:"HLTH",color:"var(--teal-11)"},error:{tag:"ERR!",color:"var(--red-11)"}},fo={USER_UPDATED:{label:"User updated",tag:"UPD",badge:"amber",color:"var(--amber-11)"},USER_DISABLED:{label:"User disabled",tag:"DIS",badge:"red",color:"var(--red-11)"},USER_ENABLED:{label:"User enabled",tag:"ENA",badge:"green",color:"var(--teal-11)"},USER_APPROVED:{label:"User approved",tag:"APPR",badge:"green",color:"var(--green-11)"},USER_REJECTED:{label:"User rejected",tag:"REJ",badge:"red",color:"var(--red-11)"},SIGNUP_NOTIFICATIONS_ON:{label:"Signup notifications on",tag:"NOTF",badge:"gray",color:"var(--gray-11)"},SIGNUP_NOTIFICATIONS_OFF:{label:"Signup notifications off",tag:"NOTF",badge:"gray",color:"var(--gray-11)"},APPROVAL_EMAIL_RESENT:{label:"Approval email resent",tag:"MAIL",badge:"amber",color:"var(--amber-11)"},USER_DELETED:{label:"User deleted",tag:"DEL",badge:"yellow",color:"var(--red-11)"},ADMIN_GRANTED:{label:"Admin granted",tag:"ADMN",badge:"gray",color:"var(--violet-11)"},ADMIN_REVOKED:{label:"Admin revoked",tag:"ADMN",badge:"gray",color:"var(--orange-11)"},ADMIN_ROLE_CHANGED:{label:"Role changed",tag:"ROLE",badge:"amber",color:"var(--violet-11)"},SESSION_REVOKED:{label:"Session revoked",tag:"SESS",badge:"gray",color:"var(--gray-11)"},APP_GRANTED:{label:"App access granted",tag:"APP",badge:"green",color:"var(--green-11)"},APP_REVOKED:{label:"App access revoked",tag:"APP",badge:"red",color:"var(--orange-11)"},BUNDLE_GRANTED:{label:"Bundle access granted",tag:"BNDL",badge:"green",color:"var(--green-11)"},BUNDLE_REVOKED:{label:"Bundle access revoked",tag:"BNDL",badge:"red",color:"var(--orange-11)"},APP_VALIDATED:{label:"App repo checked",tag:"CHK",badge:"gray",color:"var(--gray-11)"},APP_DEPLOY_REQUESTED:{label:"App deploy requested",tag:"DPLY",badge:"amber",color:"var(--amber-11)"},APP_DEPLOYED:{label:"App deployed",tag:"LIVE",badge:"green",color:"var(--green-11)"},APP_DEPLOY_FAILED:{label:"App deploy failed",tag:"FAIL",badge:"red",color:"var(--red-11)"},APP_REVERTED:{label:"App deploy reverted",tag:"RVRT",badge:"red",color:"var(--orange-11)"},APP_ROLLED_BACK:{label:"App rolled back",tag:"RBCK",badge:"amber",color:"var(--orange-11)"},APP_REMOVED:{label:"App undeployed",tag:"UNDP",badge:"red",color:"var(--red-11)"},APP_DEPLOY_GRANTS_FAILED:{label:"Deploy grants failed",tag:"GRNT",badge:"red",color:"var(--red-11)"},ADMIN_CHANGE_ROLLED_BACK:{label:"Admin change rolled back",tag:"UNDO",badge:"amber",color:"var(--amber-11)"},AUDIT_EXPORTED:{label:"Audit log exported",tag:"EXPT",badge:"gray",color:"var(--gray-11)"},SESSIONS_LISTED:{label:"Sessions viewed",tag:"VIEW",badge:"gray",color:"var(--gray-11)"}};function Kn(e){return fo[e]??{label:e,tag:e.slice(0,4).toUpperCase(),badge:"gray",color:"var(--gray-11)"}}import{jsx as yo}from"react/jsx-runtime";function Jr(){return yo("div",{className:"auth-art-card",children:yo("img",{src:"/arm-logo-inverted.svg",alt:"araMetrics",style:{width:"56%",maxWidth:x.brandLogoMax,display:"block",userSelect:"none"},draggable:!1})})}import{jsx as ur,jsxs as Yn}from"react/jsx-runtime";function jn({children:e}){return Yn("div",{style:{minHeight:"100vh",display:"flex",background:"var(--surface-content)",padding:"var(--space-5)",gap:"var(--space-5)"},children:[ur("div",{className:"auth-card-left",style:{width:"47%",flexShrink:0,position:"sticky",top:"var(--space-5)",height:"calc(100vh - var(--space-8))"},children:ur(Jr,{})}),ur("div",{className:"auth-card-right",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:"calc(100vh - var(--space-8))",padding:"var(--space-7) var(--space-5)"},children:ur("main",{style:{maxWidth:x.authFormMax,width:"100%",marginLeft:"auto",marginRight:"auto",background:"var(--color-panel-solid)",borderRadius:"var(--radius-5)",boxShadow:"var(--shadow-card)",padding:"var(--space-7) var(--space-5)"},children:e})})]})}import{jsx as mr,jsxs as qn}from"react/jsx-runtime";function Zr(){return qn("svg",{width:18,height:18,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:[mr("path",{d:"M15.68 8.18c0-.57-.05-1.11-.14-1.64H8v3.1h4.3a3.68 3.68 0 0 1-1.6 2.42v2h2.58c1.51-1.39 2.4-3.44 2.4-5.88Z",fill:"#4285F4"}),mr("path",{d:"M8 16c2.16 0 3.97-.71 5.3-1.94l-2.59-2a4.88 4.88 0 0 1-7.27-2.56H0.9v2.07A8 8 0 0 0 8 16Z",fill:"#34A853"}),mr("path",{d:"M3.44 9.5A4.8 4.8 0 0 1 3.19 8c0-.52.09-1.03.25-1.5V4.43H.9A8 8 0 0 0 0 8c0 1.29.31 2.51.9 3.57L3.44 9.5Z",fill:"#FBBC05"}),mr("path",{d:"M8 3.18c1.22 0 2.31.42 3.17 1.24l2.37-2.37A7.94 7.94 0 0 0 8 0 8 8 0 0 0 .9 4.43L3.44 6.5A4.77 4.77 0 0 1 8 3.18Z",fill:"#EA4335"})]})}import{jsx as fr,jsxs as Xn}from"react/jsx-runtime";function Qr(){return Xn("svg",{width:18,height:18,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:[fr("rect",{x:"0",y:"0",width:"7.6",height:"7.6",fill:"#F25022"}),fr("rect",{x:"8.4",y:"0",width:"7.6",height:"7.6",fill:"#7FBA00"}),fr("rect",{x:"0",y:"8.4",width:"7.6",height:"7.6",fill:"#00A4EF"}),fr("rect",{x:"8.4",y:"8.4",width:"7.6",height:"7.6",fill:"#FFB900"})]})}import{useRef as Jn}from"react";import{TextField as Zn}from"@radix-ui/themes";import{jsx as vo}from"react/jsx-runtime";function et({value:e,onChange:r,disabled:t}){let o=Jn([]);function n(s,c){let g=c.target.value.replace(/\D/g,"").slice(-1),p=Array.from({length:4},(u,b)=>e[b]??"");p[s]=g,r(p.join("")),g&&s<3&&o.current[s+1]?.focus()}function a(s,c){let g=Array.from({length:4},(p,u)=>e[u]??"");c.key==="Backspace"?!g[s]&&s>0&&(g[s-1]="",r(g.join("")),o.current[s-1]?.focus()):c.key==="ArrowLeft"&&s>0?o.current[s-1]?.focus():c.key==="ArrowRight"&&s<3&&o.current[s+1]?.focus()}function i(s){let c=s.clipboardData.getData("text").replace(/\D/g,"").slice(0,4);c&&(s.preventDefault(),r(c),o.current[Math.min(c.length,3)]?.focus())}let l=Array.from({length:4},(s,c)=>e[c]??"");return vo("div",{style:{display:"flex",gap:"var(--space-3)",justifyContent:"center"},children:l.map((s,c)=>vo(Zn.Root,{ref:g=>{o.current[c]=g},type:"text",inputMode:"numeric",maxLength:1,value:s,onChange:g=>n(c,g),onKeyDown:g=>a(c,g),onPaste:i,disabled:t,className:"otp-box","aria-label":`Digit ${c+1}`,autoComplete:c===0?"one-time-code":"off"},c))})}import{Button as rt,Callout as Ke,Heading as Qn,Text as tt}from"@radix-ui/themes";import{ExclamationTriangleIcon as ei}from"@radix-ui/react-icons";import{Fragment as ho,jsx as K,jsxs as ue}from"react/jsx-runtime";function ri({email:e,title:r,subtitle:t,code:o,onCodeChange:n,otpDevHint:a,error:i,errorAction:l,busy:s,otpExpiresAt:c,otpSecondsLeft:g,resendCooldown:p,onResend:u,onUseDifferentEmail:b}){return ue(ho,{children:[ue("div",{style:{marginBottom:"var(--space-6)",textAlign:"center"},children:[K(Qn,{as:"h1",size:O.h1,style:{color:"var(--ink-strong)",marginBottom:"var(--space-3)"},children:r}),ue(tt,{as:"p",size:"2",style:{color:"var(--ink-mid)",lineHeight:1.55},children:[t," ",K("span",{style:{fontWeight:600,color:"var(--ink-strong)"},children:e}),"."]})]}),a&&K(Ke.Root,{color:"gray",variant:"surface",size:"1",style:{marginBottom:"var(--space-5)"},children:ue(Ke.Text,{style:{fontFamily:"var(--font-poppins)"},children:["Dev hint \u2014 code is ",K("strong",{children:a})]})}),i&&ue(Ke.Root,{color:"red",variant:"surface",size:"2",style:{marginBottom:"var(--space-5)"},children:[K(Ke.Icon,{children:K(ei,{})}),ue(Ke.Text,{style:{fontFamily:"var(--font-poppins)"},children:[i,l&&ue(ho,{children:[" ",K(rt,{type:"button",variant:"ghost",size:"1",onClick:l.onClick,style:{fontWeight:600,textDecoration:"underline",height:"auto",padding:0},children:l.label})]})]})]}),ue("div",{children:[K(et,{value:o,onChange:n,disabled:s||g<=0}),s?K(tt,{as:"p",size:"1",style:{color:"var(--ink-mid)",marginTop:"var(--space-3)",textAlign:"center"},children:"Checking code\u2026"}):c&&g<=0?K(tt,{as:"p",size:"1",style:{color:"var(--red-11)",marginTop:"var(--space-3)",textAlign:"center"},children:"Code expired \u2014 resend to get a new one."}):null]}),ue("div",{style:{marginTop:"var(--space-5)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--space-3)"},children:[K(rt,{type:"button",variant:"ghost",size:"2",disabled:p>0||s,onClick:u,style:{fontWeight:500,color:p>0?"rgba(85, 85, 85, 0.4)":"var(--ink-strong)",textDecoration:p>0?"none":"underline"},children:p>0?`Resend email (${p}s)`:"Resend email"}),K(rt,{type:"button",variant:"ghost",size:"2",className:"auth-underline-link",disabled:s,onClick:b,style:{fontWeight:500,color:"var(--ink-strong)"},children:"Use a Different Email"})]})]})}import{jsx as bo}from"react/jsx-runtime";function _({provider:e}){return e==="microsoft"?bo(Qr,{}):bo(Zr,{})}var ti={google:"Google",microsoft:"Microsoft"};import{useEffect as oi,useRef as xo,useState as ot}from"react";import{Link as ko,useLocation as ai}from"react-router-dom";import{Avatar as Co,Badge as Do,DropdownMenu as me,IconButton as wo,Text as Ye,Tooltip as yr}from"@radix-ui/themes";import{ChevronDownIcon as ni,ChevronLeftIcon as ii,ChevronRightIcon as To,Cross1Icon as si,DotFilledIcon as Ao,DotsVerticalIcon as li,ExitIcon as ci,GearIcon as So,QuestionMarkCircledIcon as di}from"@radix-ui/react-icons";import{Fragment as lt,jsx as m,jsxs as A}from"react/jsx-runtime";var vr="var(--space-9)",je=e=>"items"in e,nt=e=>e.badge?`${e.label} \xB7 ${e.badge}`:e.label;function pi(e){if(!e)return{};try{let r=JSON.parse(localStorage.getItem(e)??"{}");return!r||typeof r!="object"||Array.isArray(r)?{}:Object.fromEntries(Object.entries(r).filter(t=>typeof t[1]=="boolean"))}catch{return{}}}function gi(e,r){if(e)try{localStorage.setItem(e,JSON.stringify(r))}catch{}}var ui="calc(4 * var(--space-9))",mi="calc(var(--space-9) + var(--space-6))",fi="calc(4 * var(--space-9) + var(--space-5))",yi="var(--space-8)",it="var(--space-5)",st="var(--space-5)",Io="calc(var(--space-5) + var(--space-3))",vi="var(--space-3)",hi=e=>e?"opacity 130ms ease 80ms":"opacity 90ms ease",Ro="opacity 200ms ease";function bi({collapsed:e,onToggle:r,onClose:t,items:o,persistKey:n,utilityHrefs:a,user:i,onSignOut:l,hasCalendarAccounts:s=!1,brandLogoExpandedSrc:c="/expand.svg",brandLogoCollapsedSrc:g="/shrink.svg",helpHref:p,devRoles:u,onDevRoleSelect:b,showDevRoles:v=!1}){let f=ai().pathname,[S,E]=ot(!1),[X,ie]=ot(null),R=()=>ie(null),F=xo(null),H=xo(null),pe=()=>{H.current={back:!0},R()},y=!!t,w=!e||y,$=y?fi:e?mi:ui,J=d=>!d.roles||!!i&&d.roles.includes(i.role),Z=d=>{if(!J(d))return[];if(!d.bundle||!d.children)return[d];let C=d.children.flatMap(Z);return C.length>0?[{...d,children:C}]:[]},se=o.flatMap(d=>{if(!je(d))return Z(d);let C=d.items.flatMap(Z);return C.length>0?[{...d,items:C}]:[]}),Ce=se.filter(d=>!je(d)),pa=se.flatMap(d=>je(d)?d.items:[d]),[Bt,ga]=ot(()=>pi(n)),Mt=d=>Bt[d.id]??!!d.defaultCollapsed;function ua(d){let C={...Bt,[d.id]:!Mt(d)};ga(C),gi(n,C)}let zt=new Set(a),ma=se.filter(d=>je(d)||!zt.has(d.href)),Lt=Ce.find(d=>d.href==="/settings"),Nr=Ce.filter(d=>zt.has(d.href)&&d.href!=="/settings");function sr(d){return d.root??d.href}function Ft(d){return!!d.children?.length&&(d.drillable??(sr(d)!=="/calendar"||s))}function Br(d){let C=sr(d);return f===C||f===d.href||f.startsWith(C+"/")?!0:!!d.bundle&&!!d.children?.some(Br)}let lr=[];for(let d=pa;;){let C=d.find(U=>Ft(U)&&Br(U));if(!C)break;lr.push(C),d=C.children}let Mr=X?.path===f?Math.min(X.depth,lr.length):lr.length,ge=Mr>0?lr[Mr-1]:void 0,fa=()=>{ge&&(H.current={row:ge.href}),ie({path:f,depth:Mr-1})};oi(()=>{let d=H.current,C=F.current;if(!d||!C)return;H.current=null,("back"in d?C.querySelector("[data-nav-back]"):Array.from(C.querySelectorAll("[data-nav-href]")).find(Ne=>Ne.dataset.navHref===d.row))?.focus()},[ge?.href]);function zr(d,C){return d==="/home"||C?f===d:f===d||f.startsWith(d+"/")}function Lr(d){return Ht(d,!0)}function Ht(d,C){let U=d.bundle?Br(d):zr(sr(d),d.end),Ne=Ft(d),_t=m(at,{item:d,active:U,expanded:w,uppercase:C,showChevron:Ne,onClick:Ne?pe:void 0},d.href);return w?_t:m(yr,{content:nt(d),side:"right",delayDuration:300,children:_t},d.href)}function ya(d){let C=`nav-group-${d.id}`;if(!w)return A("div",{role:"group","aria-label":d.label,children:[m("div",{"aria-hidden":"true",style:{height:1,background:"var(--gray-4)",margin:`var(--space-2) ${it}`}}),d.items.map(Lr)]},C);let U=Mt(d);return A("div",{style:{display:"flex",flexDirection:"column",marginTop:"var(--space-3)"},children:[m(xi,{label:d.label,folded:U,holdsActive:U&&d.items.some(Ne=>zr(sr(Ne))),controls:C,onToggle:()=>ua(d)}),m("div",{id:C,role:"group","aria-label":d.label,hidden:U,children:d.items.map(Lr)})]},C)}let va=f.startsWith("/admin")&&(i?.role==="admin"||i?.role==="operator"),Ot=i?.name?.split(" ").map(d=>d[0]).join("").slice(0,2)||"?";return A("aside",{ref:F,style:{position:"relative",width:$,height:"100%",minHeight:"100vh",background:"var(--shell-surface)",borderRight:"1px solid var(--gray-6)",flexShrink:0,transition:y?"none":"width 200ms ease",zIndex:2},children:[A("div",{style:{width:"100%",height:"100%",minHeight:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},children:[A("div",{style:{height:vr,flexShrink:0,position:"relative",overflow:"hidden",borderBottom:"1px solid var(--border-hairline)"},children:[m("img",{src:c,alt:"",height:40,style:{display:"block",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",transition:Ro,opacity:w?1:0,pointerEvents:"none",userSelect:"none"}}),m("img",{src:g,alt:"",height:40,style:{display:"block",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",transition:Ro,opacity:w?0:1,pointerEvents:"none",userSelect:"none"}}),y&&m(wo,{variant:"ghost",color:"gray",size:"1",onClick:t,"aria-label":"Close menu",style:{position:"absolute",right:"var(--space-2)",top:"50%",transform:"translateY(-50%)"},children:m(si,{style:h("--space-3")})})]}),m("nav",{"aria-label":"Main navigation",style:{flex:1,overflowY:"auto",overflowX:"hidden",paddingTop:"var(--space-5)",display:"flex",flexDirection:"column"},children:ge?A(lt,{children:[(()=>{let d=m(at,{item:{label:ge.label,href:"#",Icon:ii},active:!1,expanded:w,uppercase:!0,asButton:!0,onClick:fa});return w?d:m(yr,{content:ge.label,side:"right",delayDuration:300,children:d})})(),ge.children.map(d=>Ht(d,!!ge.bundle))]}):ma.map(d=>je(d)?ya(d):Lr(d))}),!ge&&Nr.length>0&&m("nav",{"aria-label":"Utility navigation",style:{flexShrink:0,borderTop:"1px solid var(--gray-4)",paddingTop:"var(--space-2)",paddingBottom:"var(--space-2)",display:"flex",flexDirection:"column"},children:Nr.map(d=>{let C=zr(d.href),U=m(at,{item:d,active:C,expanded:w,uppercase:!0,showChevron:!!d.children,onClick:d.children?pe:void 0},d.href);return w?U:m(yr,{content:nt(d),side:"right",delayDuration:300,children:U},d.href)})}),A("div",{style:{borderTop:Nr.length>0?"none":"1px solid var(--gray-4)",padding:w?"var(--space-2) var(--space-4)":"var(--space-2) 0",flexShrink:0,display:"flex",flexDirection:"column",gap:"var(--space-2)"},children:[w&&va&&A(Do,{color:"gray",variant:"soft",highContrast:!0,size:"1",radius:"full",style:{alignSelf:"flex-start"},children:[m(Ao,{style:h("--space-2")}),"Administering platform"]}),A("div",{style:{display:"flex",flexDirection:w?"row":"column",alignItems:"center",justifyContent:w?"space-between":"center",gap:"var(--space-2)"},children:[w?A("div",{className:"shell-profile-chip",style:{display:"flex",alignItems:"center",gap:"var(--space-2)",minWidth:0,flex:1,padding:"var(--space-1)",borderRadius:"var(--radius-3)"},children:[m(Co,{size:"2",radius:"full",src:i?.avatarSrc,fallback:Ot,color:"gray",variant:"soft",style:{flexShrink:0}}),m(Ye,{as:"p",size:"2",weight:"medium",truncate:!0,style:{color:"var(--shell-ink-strong)"},children:i?.name})]}):m(yr,{content:i?.name??"Account",side:"right",delayDuration:300,children:m(Co,{size:"3",radius:"full",src:i?.avatarSrc,fallback:Ot,color:"gray",variant:"soft"})}),A(me.Root,{children:[m(me.Trigger,{children:m(wo,{variant:"ghost",color:"gray","aria-label":"Account menu",className:"sidebar-icon-btn",style:{flexShrink:0},children:m(li,{style:h("--space-4")})})}),A(me.Content,{align:w?"end":"start",side:w?"top":"right",style:{minWidth:200},children:[Lt&&m(me.Item,{asChild:!0,children:A(ko,{to:Lt.href,onClick:R,children:[m(So,{}),"Settings"]})}),p&&A(me.Item,{onClick:()=>window.open(p,"_blank","noopener,noreferrer"),children:[m(di,{}),"Help"]}),m(me.Separator,{}),A(me.Item,{color:"red",onClick:()=>E(!0),children:[m(ci,{}),"Log Out"]}),v&&u&&u.length>0&&A(lt,{children:[m(me.Separator,{}),m("div",{style:{padding:"var(--space-1) var(--space-3)"},children:m(Ye,{size:"1",style:{fontFamily:"monospace",color:"var(--gray-11)",letterSpacing:"0.04em",textTransform:"uppercase"},children:"Dev \xB7 switch role"})}),u.map(d=>A(me.Item,{onClick:()=>b?.(d.email),disabled:i?.role===d.role,children:[m(So,{}),d.label,A(Ye,{size:"1",color:"gray",style:{marginLeft:"auto"},children:[d.role,"@"]})]},d.role))]})]})]})]})]})]}),!y&&m("button",{onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",className:"sidebar-collapse-btn",style:{top:"calc(var(--space-9) / 2)",transform:"translateY(-50%)",right:"calc(-1 * var(--space-3))"},children:m(Ci,{flipped:e})}),m(Or,{open:S,onOpenChange:E,title:"Confirm Logout",description:"Are you sure you want to log out?",onConfirm:l})]})}function at({item:e,active:r,expanded:t,onClick:o,asButton:n,showChevron:a,uppercase:i}){let l={position:"relative",textDecoration:"none",display:"flex",alignItems:"center",height:yi,flexShrink:0,paddingLeft:Io,paddingRight:t?`calc(${st} + var(--space-1))`:0,gap:t?vi:0,color:r?"var(--shell-ink-strong)":"var(--shell-ink-mid)",cursor:"pointer"},s=A(lt,{children:[r&&m("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:0,width:"var(--space-1)",height:"100%",background:"var(--accent-9)",borderRadius:"0 var(--radius-1) var(--radius-1) 0"}}),m("span",{"aria-hidden":"true",className:"nav-pill",style:{position:"absolute",top:0,bottom:0,left:it,right:t?st:it,borderRadius:"var(--radius-3)",background:r?"var(--accent-9)":"transparent",transition:"background 80ms ease"}}),m(e.Icon,{width:20,height:20,style:{position:"relative",flexShrink:0}}),A("span",{style:{position:"relative",display:"flex",alignItems:"center",gap:"var(--space-1)",minWidth:0,overflow:"hidden",maxWidth:t?void 0:0,opacity:t?1:0,transition:hi(t)},children:[m(Ye,{as:"span",size:"3",weight:r?"medium":"regular",style:{lineHeight:1.3,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0,textTransform:i?"uppercase":void 0},children:e.label}),e.badge&&m(Do,{color:"gray",variant:r?"solid":"soft",highContrast:r,size:"1",radius:"full",style:{flexShrink:0,paddingInline:"var(--space-1)",textTransform:i?"uppercase":void 0},children:e.badge})]}),a&&t&&(r?m("span",{style:{position:"relative",marginLeft:"auto",marginRight:"var(--space-1)",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--space-5)",height:"var(--space-5)",background:"var(--color-panel-solid)",borderRadius:"var(--radius-2)",boxShadow:"0 1px 2px rgba(0,0,0,0.12)"},children:m(To,{style:{...h("--space-4"),color:"var(--gray-11)"}})}):m(To,{style:{...h("--space-4"),position:"relative",marginLeft:"auto",color:"var(--shell-ink-mid)",flexShrink:0}}))]});return n?m("button",{type:"button",onClick:o,"data-nav-back":"",className:"shell-nav-item",style:{...l,background:"none",border:"none",width:"100%",textAlign:"left",font:"inherit"},children:s}):m(ko,{to:e.href,onClick:o,className:"shell-nav-item","data-nav-href":e.href,"data-active":r?"true":void 0,"aria-current":r?"page":void 0,title:t?nt(e):void 0,style:l,children:s})}function xi({label:e,folded:r,holdsActive:t,controls:o,onToggle:n}){return A("button",{type:"button",onClick:n,"aria-expanded":!r,"aria-controls":o,className:"shell-nav-group","data-holds-active":t?"true":void 0,style:{display:"flex",alignItems:"center",gap:"var(--space-1)",height:"var(--space-6)",flexShrink:0,width:"100%",paddingLeft:Io,paddingRight:`calc(${st} + var(--space-1))`,background:"none",border:"none",font:"inherit",textAlign:"left",cursor:"pointer",color:t?"var(--shell-ink-strong)":"var(--shell-ink-mid)"},children:[m(Ye,{as:"span",size:"1",weight:"medium",style:{textTransform:"uppercase",letterSpacing:"0.04em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:e}),t&&m(Ao,{"aria-hidden":"true",style:{...h("--space-3"),color:"var(--accent-9)",flexShrink:0}}),m(ni,{"aria-hidden":"true",style:{...h("--space-4"),marginLeft:"auto",flexShrink:0,transform:r?"rotate(-90deg)":void 0,transition:"transform 120ms ease"}})]})}function Ci({flipped:e}){return A("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{transform:e?"scaleX(-1)":void 0},children:[m("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5",stroke:"currentColor"}),m("path",{d:"M5.5 2.5v11",stroke:"currentColor"}),m("path",{d:"M11 5.5 8.5 8l2.5 2.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]})}import{Link as wi,useLocation as Ti}from"react-router-dom";import{HamburgerMenuIcon as Si,MagnifyingGlassIcon as Ri,BellIcon as ki}from"@radix-ui/react-icons";import{Flex as Di,Heading as Ai,IconButton as Ii,Text as Po,Tooltip as Pi}from"@radix-ui/themes";import{Fragment as Li,jsx as V,jsxs as hr}from"react/jsx-runtime";var Ei=[["/home","Home","/home","Home"],["/calendar/syncs","Calendar","/calendar/syncs","Manage Syncs"],["/calendar/view","Calendar","/calendar/syncs","My Calendar"],["/calendar","Calendar","/calendar/syncs","Manage Syncs"],["/settings/account","Settings","/settings/account","Account"],["/settings/linked","Settings","/settings/account","Linked Account"],["/settings","Settings","/settings/account","Settings"]],Ni=[["/admin/overview","Overview"],["/admin/users","Users"],["/admin/monitoring","Monitoring"],["/admin/calendar-ops","Calendar Ops"],["/admin/logs","Logs"],["/admin/security","Security"],["/admin/audit","Audit Log"]];function Bi(e,r,t){let o=r.split("/"),n=e.split("/");return(t?n.length!==o.length:n.length<o.length)?!1:o.every((a,i)=>a.startsWith(":")?n[i]!=="":a===n[i])}function Mi(e,r,t){if(e==="/calendar/syncs/new")return{section:"Calendar",sectionHref:"/calendar/syncs",page:"New Sync"};if(/^\/calendar\/syncs\/[^/]+$/.test(e))return{section:"Calendar",sectionHref:"/calendar/syncs",page:"Edit Sync"};let o=r.find(([n,,,,a])=>Bi(e,n,a));if(o){let[,n,a,i]=o;return{section:n,sectionHref:a,page:i}}if(e==="/admin"||e.startsWith("/admin/")){let n=t.find(([a])=>e===a||e.startsWith(a+"/"));return{section:"Admin Portal",sectionHref:"/admin/overview",page:n?n[1]:"Admin Portal"}}return{section:"Home",sectionHref:"/home",page:"Home"}}function zi({onSearchOpen:e,onMenuOpen:r,showMenu:t,titles:o=Ei,adminTitles:n=Ni}){let a=Ti().pathname;return hr("header",{style:{height:vr,background:"var(--accent-9)",borderBottom:"1px solid var(--border-hairline)",flexShrink:0,display:"flex",alignItems:"center",padding:"0 var(--space-6)",gap:"var(--space-4)"},children:[t&&V(Ii,{variant:"ghost",size:"1",onClick:r,"aria-label":"Open navigation",style:{marginRight:"var(--space-1)",color:"var(--shell-ink-strong)"},children:V(Si,{style:h("--space-4")})}),(()=>{let{section:i,sectionHref:l,page:s}=Mi(a,o,n);return hr(Di,{align:"baseline",gap:"2",style:{minWidth:0,overflow:"hidden"},children:[i!==s&&hr(Li,{children:[V(Po,{asChild:!0,size:"3",weight:"regular",children:V(wi,{to:l,style:{color:"var(--shell-ink-mid)",whiteSpace:"nowrap",textDecoration:"none",overflow:"hidden",textOverflow:"ellipsis",flexShrink:0},className:"topbar-breadcrumb-link",children:i})}),V(Po,{size:"3",weight:"regular",className:"topbar-breadcrumb-sep",style:{color:"var(--shell-ink-mid)",flexShrink:0},children:"/"})]}),V(Ai,{as:"h1",size:O.h1,weight:"medium",style:{color:"var(--shell-ink-strong)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:s})]})})(),V("div",{style:{flex:1}}),hr("button",{className:"topbar-search",onClick:e,"aria-label":"Search (\u2318K)",children:[V(Ri,{width:16,height:16,style:{color:"var(--shell-ink-strong)",flexShrink:0}}),V("span",{className:"topbar-search-placeholder",children:"Search for something"})]}),V(Pi,{content:"Coming soon",children:V("span",{children:V("button",{className:"topbar-icon-circle","aria-label":"Notifications (coming soon)",disabled:!0,children:V(ki,{style:h("--space-4")})})})})]})}import{useEffect as Eo,useRef as No,useState as ct}from"react";import{Dialog as dt,Flex as Bo,Spinner as Fi,Text as re,TextField as Hi,VisuallyHidden as Oi}from"@radix-ui/themes";import{CalendarIcon as _i,MagnifyingGlassIcon as Vi,PersonIcon as Wi,ReaderIcon as $i}from"@radix-ui/react-icons";import{Fragment as qi,jsx as T,jsxs as j}from"react/jsx-runtime";var Ui={app:_i,people:Wi,page:$i},Gi={app:"Apps",people:"People",page:"Pages"};function Ki(e){let r=["app","people","page"],t=[],o=0;for(let n of r){let a=e.filter(i=>i.type===n);a.length>0&&(t.push({type:n,label:Gi[n],items:a,startIdx:o}),o+=a.length)}return t}function ji({open:e,onClose:r,results:t,onSelectResult:o,title:n="Search",placeholder:a="Search\u2026"}){return T(dt.Root,{open:e,onOpenChange:i=>!i&&r(),children:T(dt.Content,{"aria-describedby":void 0,style:{padding:0,maxWidth:"calc(9 * var(--space-9) + var(--space-2))",overflow:"hidden",boxShadow:"0 4px 8px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.10), 0 0 0 1px var(--gray-5)"},children:T(Yi,{onClose:r,resultPool:t,onSelectResult:o,title:n,placeholder:a})})})}function Yi({onClose:e,resultPool:r,onSelectResult:t,title:o,placeholder:n}){let[a,i]=ct(""),[l,s]=ct(null),[c,g]=ct(-1),p=No(null),u=No(null),b=!!l&&l.q===a,v=b?l.items:[],f=a.trim()?b?v.length?"results":"no-match":"searching":"prompt";Eo(()=>{if(!a.trim())return;let R=setTimeout(()=>{let F=a.toLowerCase(),H=r.filter(pe=>pe.title.toLowerCase().includes(F)||pe.subtitle.toLowerCase().includes(F));s({q:a,items:H}),g(-1)},320);return()=>clearTimeout(R)},[a,r]),Eo(()=>{if(c<0||!u.current)return;u.current.querySelector(`[data-idx="${c}"]`)?.scrollIntoView({block:"nearest"})},[c]);function S(R){R.key==="Escape"?e():R.key==="ArrowDown"?(R.preventDefault(),g(F=>Math.min(F+1,v.length-1))):R.key==="ArrowUp"?(R.preventDefault(),g(F=>Math.max(F-1,0))):R.key==="Enter"&&(R.preventDefault(),c>=0&&v[c]&&(t(v[c]),e()))}function E(R){t(R),e()}let X=Ki(v),ie="calc(2 * var(--space-9) + var(--space-6))";return j(qi,{children:[T(Oi,{children:T(dt.Title,{children:o})}),j("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-3) var(--space-4)",borderBottom:"1px solid var(--gray-5)"},children:[f==="searching"?T(Fi,{size:"1",style:{flexShrink:0}}):T(Vi,{width:16,height:16,style:{color:"var(--gray-9)",flexShrink:0}}),T(Hi.Root,{ref:p,autoFocus:!0,type:"text",placeholder:n,value:a,onChange:R=>i(R.target.value),onKeyDown:S,className:"search-overlay-input",style:{flex:1,border:"none",outline:"none",background:"transparent",boxShadow:"none","--text-field-selection-color":"unset"}}),T("kbd",{style:{color:"var(--gray-11)",background:"var(--gray-3)",border:"1px solid var(--gray-5)",borderRadius:"var(--radius-1)",padding:"var(--space-1) var(--space-2)",flexShrink:0},children:T(re,{size:"1",as:"span",children:"Esc"})})]}),j("div",{ref:u,style:{minHeight:ie,maxHeight:"calc(6 * var(--space-9) + var(--space-7))",overflowY:"auto"},children:[f==="prompt"&&T(Bo,{align:"center",justify:"center",style:{height:ie},children:T(re,{size:"2",color:"gray",children:"Type to search\u2026"})}),f==="no-match"&&T(Bo,{align:"center",justify:"center",style:{height:ie},children:j("div",{style:{textAlign:"center"},children:[j(re,{size:"2",color:"gray",as:"p",children:["No results for \u201C",a,"\u201D"]}),T(re,{size:"1",color:"gray",as:"p",mt:"1",children:"Try searching with different keywords"})]})}),f==="results"&&T("div",{style:{padding:"var(--space-2)"},children:X.map(R=>{let F=Ui[R.type];return j("div",{style:{marginBottom:"var(--space-1)"},children:[T("div",{style:{padding:"var(--space-2) var(--space-3) var(--space-1)",display:"flex",alignItems:"center",gap:"var(--space-2)"},children:T(re,{size:"1",style:{color:"var(--gray-11)",fontWeight:500,letterSpacing:"0.04em",textTransform:"uppercase",fontFamily:"var(--font-poppins)"},children:R.label})}),R.items.map((H,pe)=>{let y=R.startIdx+pe,w=c===y;return j("button",{"data-idx":y,onClick:()=>E(H),onMouseEnter:()=>g(y),className:"search-result-item",style:{width:"100%",display:"flex",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-2) var(--space-3)",borderRadius:"var(--radius-2)",border:"none",cursor:"pointer",textAlign:"left",background:w?"var(--gray-3)":"transparent"},children:[T("div",{style:{width:"var(--space-6)",height:"var(--space-6)",borderRadius:"var(--radius-1)",background:w?"var(--accent-a3)":"var(--gray-3)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"background 100ms ease"},children:T(F,{width:12,height:12,style:{color:w?"var(--accent-11)":"var(--gray-9)"}})}),j("div",{style:{flex:1,minWidth:0},children:[T(re,{as:"p",size:"2",weight:"medium",style:{color:w?"var(--gray-12)":"var(--gray-11)",lineHeight:1.3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:H.title}),T(re,{as:"p",size:"1",style:{color:"var(--gray-11)",lineHeight:1.3,marginTop:"1px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:H.subtitle})]}),w&&T("kbd",{style:{color:"var(--gray-9)",background:"var(--gray-4)",border:"1px solid var(--gray-5)",borderRadius:"var(--radius-1)",padding:"var(--space-1)",flexShrink:0},children:T(re,{size:"1",as:"span",className:"data-mono",children:"\u21B5"})})]},H.id)})]},R.type)})})]}),f!=="prompt"&&j("div",{style:{borderTop:"1px solid var(--gray-4)",padding:"var(--space-2) var(--space-4)",display:"flex",gap:"var(--space-4)"},children:[j(re,{as:"span",size:"1",color:"gray",children:[T("kbd",{className:"data-mono",children:"\u2191\u2193"})," navigate"]}),j(re,{as:"span",size:"1",color:"gray",children:[T("kbd",{className:"data-mono",children:"\u21B5"})," open"]}),j(re,{as:"span",size:"1",color:"gray",children:[T("kbd",{className:"data-mono",children:"Esc"})," close"]})]})]})}function Y(e,r){for(let t of e){let o=t.calendars.find(n=>n.id===r);if(o)return{account:t,calendar:o}}}import pt from"dayjs";import{Flex as Mo,Text as zo}from"@radix-ui/themes";import{jsx as gt,jsxs as Xi}from"react/jsx-runtime";function ut({date:e,today:r=new Date}){let t=pt(e).isSame(r,"day");return Xi(Mo,{direction:"column",align:"center",gap:"1",py:"1",children:[gt(zo,{size:"1",weight:"medium",color:"gray",style:{letterSpacing:"0.04em"},children:pt(e).format("ddd").toUpperCase()}),gt(Mo,{align:"center",justify:"center",style:{width:"var(--space-6)",height:"var(--space-6)",borderRadius:"50%",background:t?"var(--accent-9)":"transparent",lineHeight:1},children:gt(zo,{size:"3",weight:t?"medium":"regular",style:{color:t?"var(--accent-contrast)":"var(--gray-12)",lineHeight:1},children:pt(e).format("D")})})]})}import{Box as qe,Checkbox as Ji,Flex as Zi,RadioGroup as Lo,Text as Xe}from"@radix-ui/themes";import{jsx as M,jsxs as Ho}from"react/jsx-runtime";function Qi(e){return e.flatMap(r=>r.calendars.map(t=>({calendarId:t.id,calendarName:t.name,email:r.email,provider:r.provider})))}function es({provider:e}){return M("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--space-5)",height:"var(--space-5)",flexShrink:0},children:M(_,{provider:e})})}function Fo({row:e,control:r,selected:t,disabled:o,disabledLabel:n}){return Ho(Xe,{as:"label",size:"2",style:{display:"flex",alignItems:"center",gap:"var(--space-3)",width:"100%",paddingBlock:"var(--space-3)",paddingInline:"var(--space-4)",cursor:o?"not-allowed":"pointer",opacity:o?.45:1,background:t?"var(--accent-2)":"transparent",color:"var(--gray-12)"},children:[M(es,{provider:e.provider}),Ho(Zi,{direction:"column",gap:"0",style:{minWidth:0,flex:1},children:[M(Xe,{size:"2",weight:"medium",truncate:!0,style:{color:"var(--gray-12)"},children:e.calendarName}),M(Xe,{size:"1",color:"gray",truncate:!0,children:e.email})]}),n?M(Xe,{size:"1",color:"gray",style:{flexShrink:0},children:n}):null,M(qe,{style:{flexShrink:0,display:"flex",alignItems:"center"},children:r})]})}function rs({accounts:e,mode:r,sourceCalendarIds:t,targetCalendarId:o,takenSourceIds:n,onToggleSource:a,onSelectTarget:i,fill:l=!1}){let s=Qi(e),g=r==="sources"&&s.length>0&&s.every(p=>p.calendarId===o||n.has(p.calendarId))?M(qe,{style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-3)",background:"var(--color-panel-solid)",padding:"var(--space-4)",...l?{flex:1,minHeight:0}:{}},children:M(Xe,{as:"p",size:"2",color:"gray",align:"center",children:"All your calendars are already used as sources in other syncs, or set as this sync's target. Remove a calendar from another sync to make it available here."})}):M(qe,{style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-3)",background:"var(--color-panel-solid)",...l?{flex:1,minHeight:0,overflowY:"auto"}:{overflow:"hidden"}},children:s.map((p,u)=>{if(r==="sources"){let f=p.calendarId===o,S=n.has(p.calendarId),E=f||S,X=t.includes(p.calendarId);return M(qe,{style:{borderTop:u>0?"1px solid var(--gray-4)":void 0},children:M(Fo,{row:p,selected:X,disabled:E,disabledLabel:f?"Target":S?"In use":void 0,control:M(Ji,{checked:X,disabled:E,onCheckedChange:()=>{E||a(p.calendarId)}})})},p.calendarId)}let b=t.includes(p.calendarId),v=p.calendarId===o;return M(qe,{style:{borderTop:u>0?"1px solid var(--gray-4)":void 0},children:M(Fo,{row:p,selected:v,disabled:b,disabledLabel:b?"Source":void 0,control:M(Lo.Item,{value:p.calendarId,disabled:b})})},p.calendarId)})});return r==="target"?M(Lo.Root,{value:o??"",onValueChange:p=>{p&&i(p)},style:l?{flex:1,minHeight:0,display:"flex",flexDirection:"column"}:void 0,children:g}):g}import{Button as Oo,Flex as mt,Heading as ts,IconButton as _o}from"@radix-ui/themes";import{ChevronLeftIcon as os,ChevronRightIcon as as}from"@radix-ui/react-icons";import{Navigate as ft}from"react-big-calendar";import{jsx as ve,jsxs as Vo}from"react/jsx-runtime";function yt({label:e,view:r,onNavigate:t,onView:o}){return Vo(mt,{align:"center",justify:"between",gap:"3",wrap:"wrap",className:"calendar-toolbar",children:[Vo(mt,{align:"center",gap:"2",children:[ve(_o,{size:"2",variant:"soft",color:"gray",radius:"full","aria-label":"Previous",onClick:()=>t(ft.PREVIOUS),children:ve(os,{})}),ve(Oo,{size:"2",variant:"soft",color:"gray",onClick:()=>t(ft.TODAY),children:"Today"}),ve(_o,{size:"2",variant:"soft",color:"gray",radius:"full","aria-label":"Next",onClick:()=>t(ft.NEXT),children:ve(as,{})})]}),ve(ts,{as:"h2",size:O.h2,weight:"medium",style:{color:"var(--gray-12)"},children:e}),ve(mt,{gap:"1",style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-3)",padding:"var(--space-1)",background:"var(--gray-2)"},children:["week","month"].map(n=>ve(Oo,{size:"2",variant:r===n?"solid":"soft",className:r===n?"btn-amber-primary":void 0,color:r===n?void 0:"gray",onClick:()=>o(n),style:r===n?void 0:{background:"transparent"},children:n==="week"?"Week":"Month"},n))})]})}import{Button as ns,Flex as br,Spinner as is,Text as vt}from"@radix-ui/themes";import{ChevronRightIcon as ss,ExclamationTriangleIcon as ls}from"@radix-ui/react-icons";import{jsx as te,jsxs as Je}from"react/jsx-runtime";var Fe={google:{label:"Google Calendar",description:"Connect a Google account calendar"},microsoft:{label:"Outlook Calendar",description:"Connect an Outlook account calendar"}},cs=["google","microsoft"];function ht({connectingProvider:e,failedProvider:r,exhausted:t=!1,onConnect:o}){return te(br,{direction:"column",gap:"3",style:{width:"100%",textAlign:"left"},children:cs.map(n=>{let a=Fe[n],i=e===n;return Je("div",{children:[Je("button",{type:"button",className:"provider-choice",onClick:()=>o(n),disabled:e!==null,"data-connecting":i?"true":void 0,"aria-busy":i||void 0,"aria-label":`Connect ${a.label}`,children:[te(B,{children:te(_,{provider:n})}),Je(br,{direction:"column",className:"provider-choice__copy",gap:"1",children:[te(vt,{size:"3",weight:"medium",truncate:!0,style:{color:"var(--gray-12)"},children:a.label}),te(vt,{size:"2",color:"gray",truncate:!0,children:a.description})]}),te("span",{className:"provider-choice__chevron","aria-hidden":!0,children:i?te(is,{size:"2"}):te(ss,{style:h("--space-5")})})]}),r===n&&Je(br,{align:"center",justify:"between",gap:"3",mt:"2",px:"1",children:[Je(br,{align:"center",gap:"2",children:[te(ls,{style:{...h("--space-4"),color:"var(--red-9)",flexShrink:0}}),te(vt,{size:"2",style:{color:"var(--red-11)"},children:t?`No more ${a.label} accounts available to connect.`:`Couldn't connect ${a.label}. Please try again.`})]}),!t&&te(ns,{variant:"ghost",size:"1",onClick:()=>o(n),children:"Retry"})]})]},n)})})}import{Badge as Wo,Box as ds,DropdownMenu as Ze,Flex as $o,IconButton as ps,Text as Uo}from"@radix-ui/themes";import{DotsVerticalIcon as gs,ReloadIcon as us,TrashIcon as ms}from"@radix-ui/react-icons";import{jsx as q,jsxs as ke}from"react/jsx-runtime";function fs({account:e,onRemove:r,onReconnect:t,onClick:o}){let n=e.authStatus==="reauth",a=e.authStatus==="failed",i=q(Uo,{size:"2",weight:"medium",truncate:!0,style:{color:"var(--gray-12)"},children:e.displayName});return ke(ds,{onClick:o,style:{width:"100%",minWidth:0,height:x.connectedAccountCardH,boxSizing:"border-box",padding:"var(--space-3)",background:"var(--color-panel-solid)",border:"1px solid var(--gray-5)",borderRadius:"var(--radius-3)",display:"flex",alignItems:"center",gap:"var(--space-3)",cursor:o?"pointer":void 0},children:[q(B,{size:"var(--space-6)",children:q(_,{provider:e.provider})}),ke($o,{direction:"column",style:{flex:1,minWidth:0},children:[ke($o,{align:"center",gap:"2",style:{minWidth:0},children:[o?q("button",{type:"button",className:"card-title-button",onClick:l=>{l.stopPropagation(),o()},children:i}):i,n&&q(Wo,{color:"amber",variant:"soft",size:"1",radius:"full",style:{flexShrink:0},children:"Needs reconnect"}),a&&q(Wo,{color:"red",variant:"soft",size:"1",radius:"full",style:{flexShrink:0},children:"Connection failed"})]}),q(Uo,{size:"1",color:"gray",truncate:!0,children:e.email})]}),ke(Ze.Root,{children:[q(Ze.Trigger,{children:q(ps,{variant:"ghost",color:"gray",size:"1","aria-label":`${e.displayName} actions`,onClick:l=>l.stopPropagation(),children:q(gs,{})})}),ke(Ze.Content,{align:"end",onClick:l=>l.stopPropagation(),children:[(n||a)&&t&&ke(Ze.Item,{onSelect:t,children:[q(us,{})," Reconnect"]}),ke(Ze.Item,{color:"red",onSelect:r,children:[q(ms,{})," Remove account"]})]})]})]})}import{Flex as ys,Text as vs,Heading as hs}from"@radix-ui/themes";import{jsx as bt,jsxs as xs}from"react/jsx-runtime";function bs({icon:e,title:r,description:t,action:o,headingAs:n="h2"}){return xs(ys,{direction:"column",align:"center",gap:"3",style:{width:"100%",paddingTop:"var(--space-9)",textAlign:"center"},children:[bt(B,{size:"var(--space-8)",children:e}),bt(hs,{as:n,size:O[n],weight:"medium",align:"center",children:r}),t&&bt(vs,{size:"2",color:"gray",align:"center",style:{maxWidth:x.emptyStateCopyMax},children:t}),o]})}import{useState as Cs}from"react";import{Dialog as Qe,Flex as ws,Text as xr,Checkbox as Ts,Button as Go}from"@radix-ui/themes";import{Fragment as Rs,jsx as W,jsxs as xt}from"react/jsx-runtime";function De({account:e,onOpenChange:r,onImport:t,initiallySelectedIds:o,disabledIds:n,disabledReason:a,title:i="Calendars",description:l="Choose which calendars you want to import.",confirmLabel:s="Import Calendars"}){let c=e?`${e.id}:${(o??e.calendars.map(g=>g.id)).join(",")}`:"closed";return W(Qe.Root,{open:!!e,onOpenChange:r,children:W(Qe.Content,{maxWidth:x.dialogMd,onInteractOutside:g=>g.preventDefault(),children:e&&W(Ss,{account:e,initiallySelectedIds:o,disabledIds:n,disabledReason:a,title:i,description:l,confirmLabel:s,onImport:t},c)})})}function Ss({account:e,initiallySelectedIds:r,disabledIds:t,disabledReason:o,title:n,description:a,confirmLabel:i,onImport:l}){let[s,c]=Cs(()=>new Set(r??e.calendars.map(u=>u.id))),g=new Set(t??[]);function p(u){g.has(u)||c(b=>{let v=new Set(b);return v.has(u)?v.delete(u):v.add(u),v})}return xt(Rs,{children:[W(Qe.Title,{size:"5",weight:"medium",mb:"1",children:n}),W(Qe.Description,{size:"2",color:"gray",mb:"2",children:a}),W(xr,{as:"p",size:"2",weight:"medium",mb:"5",style:{color:"var(--gray-12)"},children:e.email}),W(ws,{direction:"column",gap:"3",mb:"5",children:e.calendars.map(u=>{let b=s.has(u.id),v=g.has(u.id);return xt(xr,{as:"label",size:"3",className:"calendar-picker-row","data-selected":b||void 0,"data-disabled":v?"true":void 0,style:{display:"flex",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-4)",cursor:v?"default":"pointer"},children:[W(Ts,{checked:b,disabled:v,onCheckedChange:()=>p(u.id)}),W(xr,{weight:"medium",truncate:!0,style:{flex:1,minWidth:0,color:"var(--gray-12)"},children:u.name}),v&&o&&W(xr,{size:"1",color:"gray",style:{flexShrink:0},children:o})]},u.id)})}),xt(Q,{justify:"between",noTopMargin:!0,pad:"var(--space-5)",radius:"var(--radius-4)",children:[W(Qe.Close,{children:W(Go,{size:"2",variant:"outline",color:"gray",children:"Cancel"})}),W(Go,{size:"2",className:"btn-amber-primary",disabled:s.size===0,onClick:()=>l(Array.from(s)),children:i})]})]})}import{Box as er,Flex as ks,Text as oe}from"@radix-ui/themes";import{jsx as z,jsxs as Cr}from"react/jsx-runtime";function Ds(e){let r=/^#?([0-9a-f]{6})$/i.exec(e.trim());if(!r)return"white";let t=parseInt(r[1],16),o=a=>{let i=a/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)};return .2126*o(t>>16&255)+.7152*o(t>>8&255)+.0722*o(t&255)>.45?"black":"white"}function Ko({tone:e,title:r,meta:t,accentColor:o}){let n=e==="synced"?o||"var(--accent-9)":"var(--blue-11)",a=e==="synced"?o?Ds(o):"var(--accent-contrast)":"white";return Cr(er,{style:{background:n,borderRadius:"var(--radius-2)",padding:"var(--space-2) var(--space-3)"},children:[z(oe,{as:"p",size:"2",weight:"medium",style:{color:a},children:r}),t?z(oe,{as:"p",size:"1",style:{color:a},children:t}):null]})}var As="Busy",Is={title:"Gym",time:"10:00 AM",location:"Flex Gym on 16th Ave",description:"Workout notes"};function Ps({hasSources:e,hasTarget:r,sourceLabel:t,targetLabel:o,showTitle:n,showDescription:a,showLocation:i,tagLabel:l,accentColor:s,sampleEvent:c=Is}){let g=c.title,p=[c.time,c.location].filter(Boolean).join(" \xB7 "),u=l?.trim()||As,b=n?`${c.title} - (${u})`:u,v=[c.time].filter(Boolean);i&&c.location&&v.push(c.location),a&&c.description&&v.push(c.description);let f=v.join(" \xB7 ");return Cr(ks,{direction:"column",gap:"4",style:{padding:"var(--space-4)"},children:[z(oe,{as:"p",className:"ds-section-label",style:{textAlign:"center"},children:"Sync Preview"}),z(oe,{as:"p",size:"1",color:"gray",style:{textAlign:"center",marginTop:"calc(-1 * var(--space-2))"},children:"Example event \u2014 not from your calendars."}),Cr(er,{children:[z(oe,{as:"p",size:"1",color:"gray",mb:"1",children:"Sources"}),z(oe,{as:"p",size:"1",weight:"medium",mb:"2",truncate:!0,style:{color:"var(--gray-12)"},children:e?t||"Selected sources":"\u2014"}),z(er,{style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-2)",padding:"var(--space-2)",background:"var(--gray-2)"},children:z(Ko,{tone:"source",title:g,meta:p})})]}),Cr(er,{children:[z(oe,{as:"p",size:"1",color:"gray",mb:"1",children:"Target"}),z(oe,{as:"p",size:"1",weight:"medium",mb:"2",truncate:!0,style:{color:"var(--gray-12)"},children:r?o||"Selected target":"\u2014"}),z(er,{style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-2)",padding:"var(--space-2)",background:"var(--gray-2)"},children:r?z(Ko,{tone:"synced",title:b,meta:f,...s?{accentColor:s}:{}}):z(oe,{as:"p",size:"2",color:"gray",children:"Pick one target calendar"})})]}),!e||!r?z(oe,{as:"p",size:"1",color:"gray",style:{textAlign:"center"},children:"Select one or more sources, then one target"}):z(oe,{as:"p",size:"1",color:"gray",style:{textAlign:"center"},children:"Only the highlighted block is posted to the target"})]})}import{Flex as Ct,Text as wt}from"@radix-ui/themes";import{CheckIcon as Es}from"@radix-ui/react-icons";import{jsx as He,jsxs as jo}from"react/jsx-runtime";function Tt({steps:e,current:r}){return He("div",{role:"list","aria-label":"Wizard progress",style:{display:"flex",flexWrap:"wrap",width:"100%",flexShrink:0,marginBottom:0,border:"1px solid var(--gray-5)",borderRadius:"var(--radius-4)",background:"var(--color-panel-solid)",overflow:"hidden"},children:e.map((t,o)=>{let n=o+1,a=n===r,i=n<r;return jo(Ct,{align:"start",gap:"3",role:"listitem","aria-current":a?"step":void 0,style:{flex:"1 1 calc(3 * var(--space-9) + var(--space-6))",minWidth:"calc(3 * var(--space-9) + var(--space-6))",paddingTop:"var(--space-4)",paddingBottom:"var(--space-4)",paddingLeft:"var(--space-4)",paddingRight:"var(--space-4)",marginBottom:"-1px",borderBottom:a?"2px solid var(--accent-9)":"2px solid transparent"},children:[He(Ct,{align:"center",justify:"center",style:{width:"var(--space-6)",height:"var(--space-6)",borderRadius:"50%",flexShrink:0,marginTop:"var(--space-1)",background:i?"var(--green-9)":a?"var(--accent-9)":"var(--gray-3)",color:i?"white":a?"var(--accent-contrast)":"var(--gray-11)"},children:i?He(Es,{style:h("--space-3")}):He(wt,{size:"1",weight:"medium",children:t.n})}),jo(Ct,{direction:"column",gap:"1",style:{minWidth:0,flex:1,paddingTop:"var(--space-1)"},children:[He(wt,{size:"2",weight:"medium",style:{color:a||i?"var(--gray-12)":"var(--gray-10)",lineHeight:"var(--line-height-2)"},children:t.title}),He(wt,{size:"1",color:"gray",style:{lineHeight:"var(--line-height-1)"},children:t.description})]})]},t.n)})})}import{jsx as qo}from"react/jsx-runtime";var Ns=[{n:"01",title:"Connect",description:"Connect your calendar account"},{n:"02",title:"Calendars",description:"Import at least 2 calendars"},{n:"03",title:"Sync",description:"Set up your first sync"}];function Yo({current:e}){return qo(Tt,{steps:Ns,current:e})}function Bs({current:e,total:r=3}){return qo(Yo,{current:e})}import St from"dayjs";import{Flex as Xo,Grid as Jo,IconButton as Zo,Text as Qo}from"@radix-ui/themes";import{ChevronLeftIcon as Ms,ChevronRightIcon as zs}from"@radix-ui/react-icons";import{jsx as fe,jsxs as Rt}from"react/jsx-runtime";var Ls=["S","M","T","W","T","F","S"];function kt({cursor:e,onSelect:r,today:t=new Date}){let o=St(e).startOf("month"),n=o.startOf("week"),a=Array.from({length:42},(i,l)=>n.add(l,"day"));return Rt("div",{children:[Rt(Xo,{align:"center",justify:"between",mb:"2",children:[fe(Qo,{size:"2",weight:"medium",style:{color:"var(--gray-12)"},children:o.format("MMMM YYYY")}),Rt(Xo,{gap:"1",children:[fe(Zo,{size:"1",variant:"ghost",color:"gray","aria-label":"Previous month",onClick:()=>r(St(e).subtract(1,"month").toDate()),children:fe(Ms,{})}),fe(Zo,{size:"1",variant:"ghost",color:"gray","aria-label":"Next month",onClick:()=>r(St(e).add(1,"month").toDate()),children:fe(zs,{})})]})]}),fe(Jo,{columns:"7",gap:"1",mb:"1",children:Ls.map((i,l)=>fe(Qo,{size:"1",color:"gray",align:"center",children:i},l))}),fe(Jo,{columns:"7",gap:"1",justify:"center",align:"center",style:{justifyItems:"center"},children:a.map(i=>{let l=i.isSame(t,"day"),s=i.isSame(e,"day"),c=!i.isSame(o,"month");return fe("button",{type:"button",onClick:()=>r(i.toDate()),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--space-5)",height:"var(--space-5)",boxSizing:"border-box",flexShrink:0,padding:0,borderRadius:"50%",border:l&&!s?"1.5px solid var(--accent-9)":"none",cursor:"pointer",background:s?"var(--accent-9)":"transparent",color:s?"var(--accent-contrast)":c?"var(--gray-11)":l?"var(--accent-11)":"var(--gray-12)",fontWeight:l||s?500:400,fontSize:"var(--font-size-1)",fontFamily:"var(--font-poppins)"},children:i.format("D")},i.format("YYYY-MM-DD"))})})]})}import{useState as Fs}from"react";import{Dialog as rr,Flex as tr,Text as wr,Button as Dt,IconButton as Hs,Badge as ea,Separator as Os,Box as ra}from"@radix-ui/themes";import{Cross2Icon as _s,PlusIcon as Vs,ReloadIcon as Ws}from"@radix-ui/react-icons";import{Fragment as ta,jsx as I,jsxs as ae}from"react/jsx-runtime";function $s({account:e,catalog:r,onOpenChange:t,onRemoveCalendar:o,onSaveCalendars:n,onReconnect:a}){let[i,l]=Fs(!1),s=e?.authStatus==="reauth",c=e?.authStatus==="failed";function g(p){if(!e||!r)return;let u=new Set(p);n(e,r.calendars.filter(b=>u.has(b.id))),l(!1)}return ae(ta,{children:[I(rr.Root,{open:!!e&&!i,onOpenChange:p=>{p||t(!1)},children:I(rr.Content,{maxWidth:x.dialogMd,children:e&&ae(ta,{children:[ae(tr,{align:"center",gap:"3",mb:"1",children:[I(B,{size:"var(--space-6)",children:I(_,{provider:e.provider})}),ae(ra,{style:{minWidth:0,flex:1},children:[ae(tr,{align:"center",gap:"2",mb:"1",style:{minWidth:0},children:[I(rr.Title,{size:"4",weight:"medium",mb:"0",truncate:!0,style:{minWidth:0},children:e.displayName}),s&&I(ea,{color:"amber",variant:"soft",size:"1",radius:"full",style:{flexShrink:0},children:"Needs reconnect"}),c&&I(ea,{color:"red",variant:"soft",size:"1",radius:"full",style:{flexShrink:0},children:"Connection failed"})]}),I(rr.Description,{size:"2",color:"gray",mb:"0",children:e.email})]})]}),(s||c)&&a&&ae(Dt,{size:"2",variant:"soft",color:c?"red":"amber",mt:"3",onClick:()=>a(e.id),children:[I(Ws,{}),"Reconnect"]}),I(Os,{size:"4",my:"4"}),ae(tr,{align:"center",justify:"between",gap:"3",mb:"3",children:[I(wr,{as:"p",className:"ds-section-label",mb:"0",children:"Calendars"}),r&&r.calendars.length>0&&ae(Dt,{size:"1",variant:"soft",color:"gray",onClick:()=>l(!0),children:[I(Vs,{style:h("--space-3")}),"Change calendars"]})]}),I(tr,{direction:"column",style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-3)",overflow:"hidden",background:"var(--color-panel-solid)"},children:e.calendars.length===0?I(wr,{size:"2",color:"gray",style:{padding:"var(--space-4)"},children:"No calendars imported."}):e.calendars.map((p,u)=>ae(tr,{align:"center",gap:"3",className:"data-table-row",style:{padding:"var(--space-3) var(--space-4)",minHeight:"var(--space-7)",borderTop:u>0?"1px solid var(--gray-4)":void 0},children:[I(ra,{"aria-hidden":!0,style:{width:"var(--space-2)",height:"var(--space-2)",borderRadius:"50%",background:p.colorToken,flexShrink:0}}),ae(wr,{size:"2",truncate:!0,style:{flex:1,minWidth:0,color:"var(--gray-12)"},children:[p.name,p.isPrimary&&ae(wr,{size:"1",color:"gray",children:[" ","\xB7 Primary"]})]}),I(Hs,{variant:"ghost",color:"gray",size:"1","aria-label":`Remove ${p.name}`,onClick:()=>o(e,p),children:I(_s,{})})]},p.id))}),I(Q,{justify:"end",children:I(rr.Close,{children:I(Dt,{size:"2",variant:"soft",color:"gray",children:"Close"})})})]})})}),I(De,{account:i&&r?r:null,initiallySelectedIds:e?.calendars.map(p=>p.id),title:"Change calendars",description:"Choose which calendars to keep on this account.",confirmLabel:"Save calendars",onOpenChange:p=>{p||l(!1)},onImport:g})]})}import{useMemo as Us}from"react";import Rr from"dayjs";import{Calendar as Gs,dayjsLocalizer as Ks,Views as or}from"react-big-calendar";import"react-big-calendar/lib/css/react-big-calendar.css";import{Text as Tr}from"@radix-ui/themes";import{jsx as Oe,jsxs as Sr}from"react/jsx-runtime";var js=Ks(Rr),Ys=new Date(1970,0,1,8,0,0);function At({blocks:e,view:r,onViewChange:t,date:o,onNavigate:n,accounts:a,today:i=new Date}){let l=Us(()=>e.map(s=>{let c=new Date(s.date);c.setHours(s.startHour,s.startMinute,0,0);let g=new Date(s.date);return g.setHours(s.endHour,s.endMinute,0,0),{id:s.id,title:s.title,start:c,end:g,resource:s}}),[e]);return Oe("div",{className:"rbc-radix-scope",style:{height:"100%",containerType:"inline-size"},children:Oe(Gs,{localizer:js,events:l,view:r==="week"?or.WEEK:or.MONTH,onView:s=>t(s===or.MONTH?"month":"week"),date:o,onNavigate:n,views:[or.WEEK,or.MONTH],toolbar:!0,popup:!0,scrollToTime:Ys,enableAutoScroll:!0,getNow:()=>i,tooltipAccessor:null,eventPropGetter:s=>{let g=Y(a,s.resource.calendarId)?.calendar.colorToken??"var(--gray-8)";return r==="month"?{style:{background:"transparent",border:"none",boxShadow:"none"}}:{style:{backgroundColor:g,border:"none"}}},components:{toolbar:yt,week:{header:s=>Oe(ut,{...s,today:i}),event:({event:s})=>{let c=(s.end.getTime()-s.start.getTime())/6e4,g=c>=60,p=c>=30;return Sr("div",{children:[Oe(Tr,{size:"1",weight:"medium",style:{color:"white",display:"block"},truncate:!0,children:s.title}),p&&Sr(Tr,{size:"1",style:{color:"rgba(255,255,255,0.85)",display:"block"},truncate:!0,children:[Rr(s.start).format("h:mm A")," \u2013 ",Rr(s.end).format("h:mm A")]}),g&&s.resource.location&&Oe(Tr,{size:"1",style:{color:"rgba(255,255,255,0.85)",display:"block"},truncate:!0,children:s.resource.location})]})}},month:{event:({event:s})=>{let g=Y(a,s.resource.calendarId)?.calendar.colorToken??"var(--gray-8)";return Sr(Tr,{size:"1",style:{display:"flex",alignItems:"center",gap:"var(--space-1)",color:"var(--gray-12)",background:`color-mix(in srgb, ${g} 28%, transparent)`,borderRadius:"var(--radius-2)",padding:"var(--space-1) var(--space-2)"},truncate:!0,children:[Oe("span",{"aria-hidden":!0,style:{width:"var(--space-2)",height:"var(--space-2)",borderRadius:"50%",background:g,flexShrink:0}}),Sr("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[Rr(s.start).format("H:mm")," ",s.title]})]})}}}})})}import{Dialog as ar,Flex as Ae,Text as Ie,Button as oa,Separator as qs,Badge as Xs}from"@radix-ui/themes";import{Fragment as Zs,jsx as k,jsxs as be}from"react/jsx-runtime";var aa={synced:{label:"Synced",color:"green"},syncing:{label:"Syncing\u2026",color:"amber"},error:{label:"Error",color:"red"}};function Js({sync:e,accounts:r,onOpenChange:t,onEdit:o}){let n=e?(()=>{let a=e.sourceCalendarIds.map(l=>Y(r,l)?.calendar.name).filter(l=>!!l),i=Y(r,e.targetCalendarId)?.calendar.name??"\u2014";return`${a.join(", ")||"\u2014"} \u2192 ${i}`})():"";return k(ar.Root,{open:!!e,onOpenChange:t,children:k(ar.Content,{maxWidth:x.dialogMd,children:e&&be(Zs,{children:[be(Ae,{align:"center",justify:"between",mb:"1",children:[k(ar.Title,{size:"4",mb:"0",children:e.name}),k(Xs,{color:aa[e.status].color,variant:"soft",size:"1",radius:"full",children:aa[e.status].label})]}),k(ar.Description,{size:"2",color:"gray",mb:"4",children:"Sync configuration"}),be(Ae,{direction:"column",gap:"3",children:[k(he,{label:"Calendars",children:n}),k(he,{label:"Sources",children:k(Ae,{direction:"column",gap:"1",align:"end",children:e.sourceCalendarIds.map(a=>{let i=Y(r,a);return i?be(Ae,{direction:"column",align:"end",children:[k(Ie,{size:"2",weight:"medium",style:{color:"var(--gray-12)"},children:i.calendar.name}),k(Ie,{size:"1",color:"gray",children:i.account.email})]},a):null})||"\u2014"})}),k(he,{label:"Target",children:(()=>{let a=Y(r,e.targetCalendarId);return a?be(Ae,{direction:"column",align:"end",children:[k(Ie,{size:"2",weight:"medium",style:{color:"var(--gray-12)"},children:a.calendar.name}),k(Ie,{size:"1",color:"gray",children:a.account.email})]}):"\u2014"})()}),k(he,{label:"Last synced",children:e.lastSyncedLabel??"\u2014"})]}),k(qs,{size:"4",my:"4"}),k(Ie,{as:"p",size:"1",weight:"medium",color:"gray",mb:"3",style:{letterSpacing:"0.04em"},children:"WHAT TO SHOW"}),be(Ae,{direction:"column",gap:"3",children:[k(he,{label:"Tag",children:e.tagLabel?.trim()||"Busy"}),k(he,{label:"Event titles",children:e.showTitle?"Shown":"Hidden"}),k(he,{label:"Event description",children:e.showDescription?"Shown":"Hidden"}),k(he,{label:"Event location",children:e.showLocation?"Shown":"Hidden"})]}),be(Q,{justify:"between",children:[k(ar.Close,{children:k(oa,{size:"2",variant:"soft",color:"gray",children:"Close"})}),k(oa,{size:"2",className:"btn-amber-primary",onClick:()=>o(e.id),children:"Edit sync"})]})]})})})}function he({label:e,children:r}){return be(Ae,{align:"baseline",justify:"between",gap:"4",children:[k(Ie,{size:"2",color:"gray",style:{flexShrink:0},children:e}),k(Ie,{size:"2",weight:"medium",align:"right",style:{color:"var(--gray-12)"},children:r})]})}import{useState as kr}from"react";function nr({accounts:e,connectProvider:r,onAccountAdded:t,onImported:o}){let[n,a]=kr(null),[i,l]=kr(null),[s,c]=kr(null),[g,p]=kr(!1);function u(v){if(n)return;c(null),p(!1),a(v);let f=e.map(S=>S.id);r(v,f).then(S=>{a(null),S?l(S):(c(v),p(!0))}).catch(()=>{a(null),c(v),p(!1)})}function b(v){if(!i)return;let f=new Set(v);t({...i,calendars:i.calendars.filter(S=>f.has(S.id))}),l(null),o?.()}return{connectingProvider:n,pendingAccount:i,failedProvider:s,exhausted:g,connect:u,confirmImport:b,cancelImport:()=>l(null),dismissError:()=>c(null)}}import{Box as Qs,DropdownMenu as Dr,Button as el,Flex as rl,Text as na}from"@radix-ui/themes";import{PlusIcon as ia}from"@radix-ui/react-icons";import{Fragment as ol,jsx as ne,jsxs as _e}from"react/jsx-runtime";function tl({variant:e="button",trigger:r,accounts:t,connectProvider:o,onAccountAdded:n,onImported:a}){let{pendingAccount:i,failedProvider:l,exhausted:s,connect:c,confirmImport:g,cancelImport:p,dismissError:u}=nr({accounts:t,connectProvider:o,onAccountAdded:n,onImported:a}),b=["google","microsoft"],v=e==="tile"?_e("button",{type:"button",className:"connect-account-tile","aria-label":"Connect Account",children:[ne(ia,{style:h("--space-4")}),"Connect Account"]}):_e(el,{size:"2",className:"btn-amber-primary",children:[ne(ia,{style:h("--space-4")}),"Connect Account"]}),f=_e(Dr.Root,{children:[ne(Dr.Trigger,{children:r??v}),ne(Dr.Content,{align:"start",style:{width:"max-content",minWidth:"max-content"},children:b.map(S=>{let E=Fe[S];return _e(Dr.Item,{onSelect:()=>c(S),style:{height:"auto",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-2) var(--space-3)"},children:[ne(B,{size:"var(--space-6)",children:ne(_,{provider:S})}),_e(rl,{direction:"column",gap:"1",style:{flexShrink:0},children:[ne(na,{size:"2",weight:"medium",style:{color:"var(--gray-12)"},children:E.label}),ne(na,{size:"1",color:"gray",children:E.description})]})]},S)})})]});return _e(ol,{children:[e==="tile"&&!r?ne(Qs,{style:{width:"100%",minWidth:0},children:f}):f,ne(De,{account:i,onOpenChange:S=>!S&&p(),onImport:g}),l&&ne(Ur,{msg:s?`No more ${Fe[l].label} accounts available to connect.`:`Couldn't connect ${Fe[l].label}. Please try again.`,color:"red",onDone:u})]})}import{Card as al,Flex as It,Text as nl,Heading as il}from"@radix-ui/themes";import{CalendarIcon as sl}from"@radix-ui/react-icons";import{jsx as xe,jsxs as sa}from"react/jsx-runtime";function ll({accounts:e,connectProvider:r,onAccountAdded:t,onImported:o}){let{connectingProvider:n,pendingAccount:a,failedProvider:i,exhausted:l,connect:s,confirmImport:c,cancelImport:g}=nr({accounts:e,connectProvider:r,onAccountAdded:t,onImported:o});return sa(It,{direction:"column",align:"center",justify:"center",style:{width:"100%",flex:1,minHeight:0},children:[xe(al,{style:{width:"100%",maxWidth:x.providerChooserMax},children:sa(It,{direction:"column",align:"center",justify:"center",gap:"3",py:"6",px:"3",style:{width:"100%",textAlign:"center"},children:[xe(B,{children:xe(sl,{style:{...h("--space-5"),color:"var(--gray-7)"}})}),xe(il,{as:"h2",size:O.h2,weight:"medium",children:e.length>0?"Connect another account":"Connect your first account"}),xe(nl,{as:"p",size:"2",color:"gray",children:e.length>0?"Add another Google or Microsoft account, then choose which calendars to import.":"Connect a Google or Microsoft account to import calendars for sync."}),xe(It,{direction:"column",style:{width:"100%"},mt:"3",children:xe(ht,{connectingProvider:n,failedProvider:i,exhausted:l,onConnect:s})})]})}),xe(De,{account:a,onOpenChange:p=>!p&&g(),onImport:c})]})}import{useEffect as cl,useMemo as Pt,useState as Ar}from"react";import{Link as dl}from"react-router-dom";import{Box as Et,Checkbox as la,Flex as ir,Separator as Nt,Text as Pe}from"@radix-ui/themes";import{ChevronDownIcon as pl,GearIcon as gl,HamburgerMenuIcon as ul}from"@radix-ui/react-icons";import{jsx as P,jsxs as ye}from"react/jsx-runtime";function ml({accounts:e,view:r,setView:t,hideClones:o,setHideClones:n,mergedCalendarIds:a,visibleCalendarIds:i,toggleCalendarVisible:l,getVisibleBlocksInRange:s,manageAccountsHref:c,today:g=new Date}){let[p,u]=Ar(g),[b,v]=Ar(new Set),[f,S]=Ar(()=>typeof window<"u"&&window.innerWidth<900),[E,X]=Ar(!1);cl(()=>{function y(){S(window.innerWidth<900)}return window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]);let ie=Pt(()=>{let y=new Date(p);return y.setDate(y.getDate()-42),y},[p]),R=Pt(()=>{let y=new Date(p);return y.setDate(y.getDate()+42),y},[p]),F=s(ie,R),H=Pt(()=>{let y=[],w=new Map;for(let $ of a){let J=Y(e,$);if(!J)continue;let Z=w.get(J.account.id);Z===void 0&&(Z=y.length,w.set(J.account.id,Z),y.push({accountId:J.account.id,calendarIds:[]})),y[Z].calendarIds.push($)}return y},[a,e]);function pe(y){v(w=>{let $=new Set(w);return $.has(y)?$.delete(y):$.add(y),$})}return ye(ir,{gap:"5",align:"start",direction:f?"column":"row",flexGrow:"1",minHeight:"0",height:"100%",children:[(!f||E)&&ye(Et,{minWidth:f?void 0:x.sidebarColMin,p:"4",maxHeight:"100%",style:{flex:f?"1 1 100%":`0 0 ${x.sidebarColBasis}`,border:"1px solid var(--gray-5)",borderRadius:"var(--radius-4)",background:"var(--color-panel-solid)",boxShadow:"var(--shadow-card)",overflow:"auto"},children:[P(kt,{cursor:p,onSelect:u,today:g}),P(Nt,{size:"4",my:"3"}),P(Pe,{as:"p",size:"1",weight:"medium",color:"gray",mb:"3",style:{letterSpacing:"0.04em"},children:"CALENDARS"}),P(ir,{direction:"column",gap:"1",mb:"4",children:H.map(({accountId:y,calendarIds:w},$)=>{let J=e.find(se=>se.id===y);if(!J)return null;let Z=b.has(y);return ye("div",{style:{paddingTop:$>0?"var(--space-2)":void 0,borderTop:$>0?"1px solid var(--gray-3)":void 0},children:[ye(ir,{align:"center",gap:"2",mb:"2",py:"1",className:"calendar-legend-account-row",style:{cursor:"pointer",borderRadius:"var(--radius-2)"},onClick:()=>pe(y),children:[P(pl,{style:{...h("--space-3"),color:"var(--gray-9)",transform:Z?"rotate(-90deg)":void 0,transition:"transform 120ms ease",flexShrink:0}}),P(_,{provider:J.provider}),P(Pe,{size:"2",weight:"medium",truncate:!0,title:J.email,style:{color:"var(--gray-12)",minWidth:0},children:J.email})]}),!Z&&P(ir,{direction:"column",gap:"1",pl:"5",children:w.map(se=>{let Ce=Y(e,se);return Ce?ye(Pe,{as:"label",size:"2",className:"calendar-legend-row",style:{display:"flex",alignItems:"center",gap:"var(--space-2)",cursor:"pointer",borderRadius:"var(--radius-2)",padding:"var(--space-1) var(--space-2)",marginLeft:"calc(var(--space-2) * -1)"},children:[ye(ir,{align:"center",gap:"1",children:[P(la,{checked:i.has(se),onCheckedChange:()=>l(se)}),P("span",{"aria-hidden":!0,style:{width:"var(--space-3)",height:"var(--space-3)",borderRadius:"50%",background:Ce.calendar.colorToken,flexShrink:0}})]}),P(Pe,{size:"2",truncate:!0,style:{color:"var(--gray-12)"},title:Ce.calendar.name,children:Ce.calendar.name})]},se):null})})]},y)})}),P(Nt,{size:"4",mb:"3"}),ye(Pe,{as:"label",size:"2",style:{display:"flex",alignItems:"center",gap:"var(--space-2)",cursor:"pointer"},mb:"3",children:[P(la,{checked:o,onCheckedChange:y=>n(!!y)}),"Hide synced events"]}),P(Nt,{size:"4",mb:"3"}),ye(dl,{to:c,style:{display:"flex",alignItems:"center",gap:"var(--space-2)",color:"var(--gray-11)",textDecoration:"none"},children:[P(gl,{style:h("--space-3")}),P(Pe,{size:"2",children:"Manage accounts"})]}),P(Pe,{as:"p",size:"1",color:"gray",mt:"4",children:"On your target calendars, others see only what each sync is set to share. Full detail stays in araMetrics."})]}),ye(Et,{width:f?"100%":void 0,minHeight:x.bigCalendarH,height:"100%",style:{flex:f?"1 1 100%":`1 1 ${x.syncColWide}`,minWidth:f?0:x.syncColMin,display:"flex",flexDirection:"column",alignSelf:"stretch"},children:[f&&P("button",{type:"button",className:"sidebar-icon-btn","aria-label":E?"Hide calendars":"Show calendars",style:{alignSelf:"flex-start",marginBottom:"var(--space-3)"},onClick:()=>X(y=>!y),children:P(ul,{style:h("--space-4")})}),P(Et,{flexGrow:"1",minHeight:"0",height:"100%",children:P(At,{blocks:F,view:r,onViewChange:t,date:p,onNavigate:u,accounts:e,today:g})})]})]})}import{clsx as fl}from"clsx";import{twMerge as yl}from"tailwind-merge";function Ee(...e){return yl(fl(e))}function vl(e,r="solid"){return D.variants[e]?.[r]||D.variants.primary[r]}function hl(e){let r=D.sizes[e]||D.sizes.md;return`${r.text} ${r.padding} ${r.height}`}function bl(){return Ee(D.base.transition,D.base.focus,D.base.disabled,D.accessibility.reducedMotion)}function xl(){return Ee(D.base.interactive,D.accessibility.focusTrap,D.accessibility.touchTarget)}function Cl(e={}){return Ee(e.focusVisible&&D.accessibility.focusTrap,e.highContrast&&D.accessibility.highContrast,e.reducedMotion&&D.accessibility.reducedMotion)}function wl(e,r=""){return typeof e=="string"?`${r}${e}`:typeof e=="object"&&e!==null?Object.entries(e).map(([t,o])=>o===void 0?"":`${t==="xs"?"":`${t}:`}${r}${o}`).filter(Boolean).join(" "):""}function Tl(e,r="gap"){let t=D.spacing[e]||D.spacing.md;switch(r){case"margin":return t.replace("gap-","m-");case"padding":return t.replace("gap-","p-");default:return t}}function Sl(e){return D.radius[e]||D.radius.md}function Rl(e){return D.typography[e]||D.typography.base}function kl(e,r=500){return`bg-${e}-${r}`}function Dl(e,r=500){return`text-${e}-${r}`}function Al(e,r=500){return`border-${e}-${r}`}function Il(e,r=500){return`hover:bg-${e}-${r}`}function Pl(e,r=500){return`hover:text-${e}-${r}`}function El(e,r=500){return`focus:ring-${e}-${r}`}function Nl(e){let r=D.animations[e];return typeof r=="string"?r:""}function Bl(e,r,t){return o=>{let n=e;return Object.entries(r).forEach(([a,i])=>{let l=o[a];l&&i[l]&&(n+=` ${i[l]}`)}),t?.forEach(({conditions:a,className:i})=>{Object.entries(a).every(([s,c])=>o[s]===c)&&(n+=` ${i}`)}),Ee(n)}}function Ml(e){return function(t){let{className:o,...n}=t,a={...e.defaultVariants,...n},i=e.base||"";return e.variants&&Object.entries(e.variants).forEach(([l,s])=>{let c=a[l];c&&s[c]&&(i+=` ${s[c]}`)}),e.compoundVariants?.forEach(({conditions:l,className:s})=>{Object.entries(l).every(([g,p])=>a[g]===p)&&(i+=` ${s}`)}),Ee(i,o)}}function zl(e,r){let t={...e};return Object.keys(r).forEach(o=>{let n=r[o],a=e[o];o==="className"?t[o]=Ee(a,n):typeof n=="object"&&typeof a=="object"&&n!==null&&a!==null&&!Array.isArray(n)&&!Array.isArray(a)?t[o]={...a,...n}:t[o]=n}),t}function Ll(e,r,t){return e?r:t&&e===!1?t:""}function Fl(e){let r=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(", ");return Array.from(e.querySelectorAll(r))}function Hl(e,r,t,o={}){let{loop:n=!0,orientation:a="both"}=o,i=t;switch(e.key){case"ArrowDown":(a==="vertical"||a==="both")&&(i=t+1,i>=r.length&&(i=n?0:r.length-1));break;case"ArrowUp":(a==="vertical"||a==="both")&&(i=t-1,i<0&&(i=n?r.length-1:0));break;case"ArrowRight":(a==="horizontal"||a==="both")&&(i=t+1,i>=r.length&&(i=n?0:r.length-1));break;case"ArrowLeft":(a==="horizontal"||a==="both")&&(i=t-1,i<0&&(i=n?r.length-1:0));break;case"Home":i=0;break;case"End":i=r.length-1;break}return i!==t&&(e.preventDefault(),r[i]?.focus()),i}import{Theme as Ol}from"@radix-ui/themes";import"@radix-ui/themes/styles.css";import{jsx as Vl}from"react/jsx-runtime";function _l({children:e,appearance:r="light",radius:t="none",scaling:o="100%",accentColor:n="amber",grayColor:a="gray",panelBackground:i="solid",className:l=""}){return Vl(Ol,{accentColor:n,grayColor:a,radius:t,scaling:o,panelBackground:i,appearance:r,className:l,children:e})}var ca="arm.shell.v1",da=/^[a-z][a-z0-9-]{0,31}(\.[a-z][a-z0-9-]{0,31})+$/;function Ir(e,r=[]){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||r.includes(e))return!1;let t=[...r,e];if(Array.isArray(e))return e.every(n=>Ir(n,t));let o=Object.getPrototypeOf(e);return o!==Object.prototype&&o!==null?!1:Object.values(e).every(n=>Ir(n,t))}function Wl(e){if(typeof e!="object"||e===null)return!1;let{v:r,id:t,type:o,payload:n}=e;return r===1&&typeof t=="string"&&t!==""&&typeof o=="string"&&da.test(o)&&Ir(n)}function $l(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function Ul(){let e=new Map,r=new Set,t;function o(a){if(!r.has(a.id)){r.add(a.id),r.size>256&&r.delete(r.values().next().value);for(let i of[...e.get(a.type)??[]])i(a.payload)}}function n(){return t===void 0&&(t=typeof BroadcastChannel>"u"?null:new BroadcastChannel(ca),t?.addEventListener("message",a=>{Wl(a.data)&&o(a.data)})),t}return{emit(a,i){if(!da.test(a))throw new TypeError(`shell.events: "${a}" is not an "<app>.<event>" type`);if(!Ir(i))throw new TypeError(`shell.events: the payload of "${a}" is not plain JSON`);let l={v:1,id:$l(),type:a,payload:i};n()?.postMessage(l),o(l)},on(a,i){n();let l=e.get(a)??new Set;e.set(a,l);let s=i;return l.add(s),()=>{l.delete(s)}}}}var Gl={events:Ul()};import*as Pr from"react";function _f({value:e,defaultValue:r,onChange:t}){let[o,n]=Pr.useState(r),a=e!==void 0,i=a?e:o,l=Pr.useCallback(s=>{let c=typeof s=="function"?s(i):s;a||n(c),t?.(c)},[a,i,t]);return[i,l]}import*as Ve from"react";function Wf(e=!1){let[r,t]=Ve.useState(e),o=Ve.useCallback(()=>t(!0),[]),n=Ve.useCallback(()=>t(!1),[]),a=Ve.useCallback(()=>t(i=>!i),[]);return{isOpen:r,open:o,close:n,toggle:a,onOpen:o,onClose:n,onToggle:a}}import*as Er from"react";function Uf(e,r=!0){let t=Er.useRef(null);return Er.useEffect(()=>{if(!r)return;let o=n=>{t.current&&!t.current.contains(n.target)&&e()};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,r]),t}export*from"@radix-ui/react-icons";export{Gn as ACTIVITY_META,fo as AUDIT_ACTION_META,Na as AccentCard,Xt as AccentHeader,Uc as AccessibleIcon,Wt as Accordion,Gt as AccordionContent,$t as AccordionItem,Ut as AccordionTrigger,$s as AccountCalendarsDialog,$a as AccountCard,Tn as ActivityRow,tl as AddAccountMenu,Dc as AlertDialog,wn as AppCard,ec as AspectRatio,jn as AuthCard,Mc as Avatar,zc as Badge,At as BigCalendarView,nc as Blockquote,Yl as Box,Jr as BrandPanel,gc as Button,ut as CalendarDayHeader,ml as CalendarMergedView,rs as CalendarPickList,yt as CalendarToolbar,Lc as Callout,Fc as Card,Q as CardFooter,yc as Checkbox,hc as CheckboxCards,vc as CheckboxGroup,ic as Code,Or as ConfirmDialog,ht as ConnectProviderList,ll as ConnectProviderRows,fs as ConnectedAccountCard,Jl as Container,Ic as ContextMenu,In as DashboardErrorCard,Hc as DataList,Kr as DataTableRow,kc as Dialog,Sa as Drawer,ka as DrawerClose,Kt as DrawerContent,Aa as DrawerDefaultClose,Yt as DrawerDescription,Da as DrawerHeader,jt as DrawerTitle,Ra as DrawerTrigger,Ac as DropdownMenu,sc as Em,bs as EmptyCard,dn as EventBlock,ql as Flex,Zr as GoogleIcon,Xl as Grid,ac as Heading,Ec as HoverCard,uc as IconButton,B as IconTile,De as ImportCalendarsDialog,Ql as Inset,lc as Kbd,Un as METRIC_STATUS_COLOR,fn as MetricCard,Qr as MicrosoftIcon,kt as MiniMonthPicker,Qa as MonthGrid,Bs as OnboardingStepDots,Yo as OnboardingStepper,et as OtpInput,ri as OtpVerifyStep,ti as PROVIDER_LABEL,Fe as PROVIDER_META,_n as Pagination,_r as PausedBadge,Pc as Popover,Bc as Portal,Oc as Progress,_ as ProviderIcon,dc as Quote,Wn as ROLE_LABELS,gr as ROLE_META,bc as Radio,Cc as RadioCards,xc as RadioGroup,ca as SHELL_CHANNEL,vr as SHELL_HEADER_H,$n as STATUS_META,rc as ScrollArea,ji as SearchOverlay,Zl as Section,Rc as SegmentedControl,wc as Select,tc as Separator,bi as Sidebar,ba as Skeleton,Tc as Slider,Gc as Slot,Kc as Slottable,_c as Spinner,pc as Strong,Sc as Switch,Js as SyncDetailsDialog,Ps as SyncPreviewRail,$c as TabNav,Vc as Table,Wc as Tabs,oc as Text,fc as TextArea,mc as TextField,cc as TextLink,Ur as Toast,Nc as Tooltip,zi as Topbar,_l as UIProvider,jc as VisuallyHidden,Tt as WizardStepper,Kn as auditActionMeta,Ee as cn,ha as colors,Ll as conditionalClass,Bl as createCompoundVariants,Ml as createVariantGenerator,Y as findCalendar,Cl as getAccessibilityStyles,Nl as getAnimationClass,bl as getBaseStyles,kl as getBgClass,Al as getBorderClass,Vt as getColor,El as getFocusRingClass,Fl as getFocusableElements,Il as getHoverBgClass,Pl as getHoverTextClass,xl as getInteractiveStyles,Sl as getRadiusClass,wl as getResponsiveClasses,hl as getSizeStyles,Tl as getSpacingClass,Dl as getTextClass,Rl as getTypographyClass,vl as getVariantStyles,Hl as handleArrowNavigation,O as headingSize,x as layout,zl as mergeProps,Gl as shell,D as theme,Uf as useClickOutside,nr as useConnectAccount,_f as useControllableState,Wf as useDisclosure};
1
+ import{a as va,b as k,c as $t}from"./chunk-UTKQHNA3.mjs";import{Box as jl,Flex as Kl,Grid as Yl,Container as ql,Section as Xl,Inset as Zl,AspectRatio as Jl,ScrollArea as Ql,Separator as ec,Text as rc,Heading as tc,Blockquote as oc,Code as ac,Em as nc,Kbd as ic,Link as sc,Quote as lc,Strong as cc,Button as dc,IconButton as pc,TextField as gc,TextArea as uc,Checkbox as mc,CheckboxGroup as fc,CheckboxCards as hc,Radio as vc,RadioGroup as yc,RadioCards as bc,Select as xc,Slider as _c,Switch as wc,SegmentedControl as Cc,Dialog as Tc,AlertDialog as Rc,DropdownMenu as kc,ContextMenu as Sc,Popover as Dc,HoverCard as Ac,Tooltip as Ic,Portal as Pc,Avatar as Ec,Badge as Nc,Callout as Bc,Card as zc,DataList as Lc,Progress as Mc,Spinner as Fc,Table as Oc,Tabs as Hc,TabNav as $c,AccessibleIcon as Wc,Slot as Uc,Slottable as Vc,VisuallyHidden as Gc}from"@radix-ui/themes";import{jsx as ba}from"react/jsx-runtime";function ya({width:e="100%",height:r="var(--space-4)",radius:t="var(--radius-2)",circle:o=!1,mb:n,className:a,style:i}){return ba("div",{className:["skeleton",a].filter(Boolean).join(" "),"aria-hidden":"true",style:{width:e,height:r,borderRadius:o?"50%":t,marginBottom:n,...i}})}import*as We from"react";import*as le from"@radix-ui/react-accordion";import{ChevronDownIcon as xa}from"@radix-ui/react-icons";import{jsx as Ne,jsxs as _a}from"react/jsx-runtime";var Wt=We.forwardRef(({className:e="",...r},t)=>Ne(le.Root,{ref:t,className:`arm-accordion ${e}`,...r}));Wt.displayName="Accordion";var Ut=We.forwardRef(({className:e="",...r},t)=>Ne(le.Item,{ref:t,className:`arm-accordion__item ${e}`,...r}));Ut.displayName="AccordionItem";var Vt=We.forwardRef(({className:e="",children:r,...t},o)=>Ne(le.Header,{className:"arm-accordion__header",children:_a(le.Trigger,{ref:o,className:`arm-accordion__trigger ${e}`,...t,children:[r,Ne(xa,{"aria-hidden":!0,className:"arm-accordion__chevron"})]})}));Vt.displayName="AccordionTrigger";var Gt=We.forwardRef(({className:e="",children:r,...t},o)=>Ne(le.Content,{ref:o,className:`arm-accordion__content ${e}`,...t,children:Ne("div",{className:"arm-accordion__body",children:r})}));Gt.displayName="AccordionContent";import*as lr from"react";import*as P from"@radix-ui/react-dialog";import{Cross2Icon as wa}from"@radix-ui/react-icons";import{jsx as _e,jsxs as Da}from"react/jsx-runtime";var Ca=P.Root,Ta=P.Trigger,Ra=P.Close,jt=lr.forwardRef(({className:e="",side:r="right",size:t="md",children:o,...n},a)=>Da(P.Portal,{children:[_e(P.Overlay,{className:"arm-drawer__overlay"}),_e(P.Content,{ref:a,"data-side":r,"data-size":t,className:`arm-drawer ${e}`,...n,children:o})]}));jt.displayName="DrawerContent";var ka=({className:e="",children:r,...t})=>_e("div",{className:`arm-drawer__header ${e}`,...t,children:r}),Kt=lr.forwardRef(({className:e="",...r},t)=>_e(P.Title,{ref:t,className:`arm-drawer__title ${e}`,...r}));Kt.displayName="DrawerTitle";var Yt=lr.forwardRef(({className:e="",...r},t)=>_e(P.Description,{ref:t,className:`arm-drawer__description ${e}`,...r}));Yt.displayName="DrawerDescription";var Sa=()=>_e(P.Close,{"aria-label":"Close",className:"arm-drawer__close",children:_e(wa,{"aria-hidden":!0,className:"arm-drawer__close-icon"})});import{Box as qt,Flex as Aa,Text as Ia}from"@radix-ui/themes";import{jsx as Mr,jsxs as Zt}from"react/jsx-runtime";function Xt({title:e,trailing:r,style:t}){let o=typeof e=="string"||typeof e=="number"?Mr(Ia,{size:"3",weight:"medium",style:{color:"var(--accent-contrast)"},children:e}):e;return Zt(Aa,{align:"center",justify:"between",gap:"3",px:"4",style:{background:"var(--accent-9)",minHeight:"var(--space-7)",...t},children:[o,r]})}function Pa({title:e,trailing:r,children:t,bodyPadding:o="4",style:n}){return Zt(qt,{style:{background:"var(--color-panel-solid)",borderRadius:"var(--radius-5)",overflow:"hidden",boxShadow:"var(--shadow-card)",...n},children:[Mr(Xt,{title:e,trailing:r}),Mr(qt,{p:o,children:t})]})}import{AlertDialog as we,Button as Jt}from"@radix-ui/themes";var b={content_max:"calc(15 * var(--space-9) + var(--space-5))",account_card_w:"calc(3 * var(--space-9) + var(--space-8))",account_card_min_h:"calc(2 * var(--space-9) - var(--space-2))",month_title_min_w:"calc(3 * var(--space-9) - var(--space-1))",big_calendar_h:"calc(10 * var(--space-9))",sidebar_col_basis:"calc(4 * var(--space-9) - var(--space-2))",sidebar_col_min:"calc(3 * var(--space-9) + var(--space-6))",sync_col_min:"calc(5 * var(--space-9))",sync_col_wide:"calc(7 * var(--space-9) + var(--space-6))",dialog_sm:"calc(6 * var(--space-9) - var(--space-2))",dialog_body:"calc(5 * var(--space-9) + var(--space-7))",auth_form_max:"calc(6 * var(--space-9) + var(--space-8))",brand_logo_max:"calc(6 * var(--space-9) + var(--space-8) - var(--space-1))",connected_account_card_h:"calc(var(--space-9) - var(--space-1))",dialog_md:"calc(6 * var(--space-9) + var(--space-6))",dialog_lg:"calc(7 * var(--space-9) - var(--space-1))",empty_state_max:"calc(10 * var(--space-9))",empty_state_copy_max:"calc(6 * var(--space-9))",provider_chooser_max:"calc(6 * var(--space-9) + var(--space-6))",audit_col_time:"calc(var(--space-9) + var(--space-2))",audit_col_action:"calc(var(--space-9) + var(--space-5) + var(--space-1))",search_field_w:"calc(3 * var(--space-9) + var(--space-5) + var(--space-1))",settings_grid_min:"calc(5 * var(--space-9) + var(--space-5))",placeholder_md:"calc(6 * var(--space-9) + var(--space-4))"};import{Flex as Ea}from"@radix-ui/themes";import{jsx as Na}from"react/jsx-runtime";function ee({children:e,justify:r="end",noTopMargin:t,pad:o="var(--space-5)",radius:n="var(--radius-5)"}){return Na(Ea,{justify:r,style:{margin:`${t?"0":"var(--space-5)"} calc(-1 * ${o}) calc(-1 * ${o})`,padding:`var(--space-4) ${o}`,alignItems:"center",background:"var(--gray-2)",borderTop:"1px solid var(--gray-5)",borderRadius:`0 0 ${n} ${n}`},children:e})}import{jsx as Ce,jsxs as Fr}from"react/jsx-runtime";function Or({title:e,description:r,confirmLabel:t="Yes",cancelLabel:o="Cancel",onConfirm:n,trigger:a,open:i,onOpenChange:l}){return Fr(we.Root,{open:i,onOpenChange:l,children:[a?Ce(we.Trigger,{children:a}):null,Fr(we.Content,{maxWidth:b.dialog_sm,children:[Ce(we.Title,{size:"5",mb:"1",style:{fontFamily:"var(--heading-font-family)",fontWeight:"var(--font-weight-medium)"},children:e}),Ce(we.Description,{size:"2",color:"gray",mb:"5",children:r}),Fr(ee,{justify:"between",noTopMargin:!0,children:[Ce(we.Cancel,{children:Ce(Jt,{size:"2",variant:"outline",color:"gray",children:o})}),Ce(we.Action,{children:Ce(Jt,{size:"2",className:"btn-amber-primary",onClick:n,children:t})})]})]})]})}import{PauseIcon as Ba}from"@radix-ui/react-icons";function v(e){return{width:`var(${e})`,height:`var(${e})`}}import{jsx as Qt,jsxs as za}from"react/jsx-runtime";function Hr({label:e="Paused",style:r}){return za("span",{style:{display:"inline-flex",alignItems:"center",gap:"var(--space-1)",height:"calc(var(--space-4) + var(--space-1))",padding:"var(--space-1) var(--space-2)",border:"1px solid var(--color-paused)",borderRadius:999,background:"var(--color-panel-solid)",color:"var(--color-paused)",fontSize:"var(--font-size-1)",fontWeight:600,lineHeight:1,whiteSpace:"nowrap",...r},children:[Qt("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--space-3)",height:"var(--space-3)",flexShrink:0,borderRadius:"50%",border:"1px solid var(--color-paused)"},children:Qt(Ba,{style:v("--space-2")})}),e]})}import{Avatar as La,Box as eo,DropdownMenu as Be,Flex as ro,IconButton as Ma,Text as to}from"@radix-ui/themes";import{DotsVerticalIcon as Fa,PauseIcon as Oa,PlayIcon as Ha,TrashIcon as $a}from"@radix-ui/react-icons";import{jsx as j,jsxs as ce}from"react/jsx-runtime";function Wa({name:e,email:r,avatarSrc:t,paused:o=!1,onPause:n,onResume:a,onDelete:i,onClick:l,badge:s,accentColor:c,style:g}){let p=j(to,{as:l?"span":"p",size:"3",weight:"medium",truncate:!0,style:{color:"var(--gray-12)",minWidth:0},children:e});return ce(eo,{onClick:l,style:{width:b.account_card_w,minHeight:b.account_card_min_h,padding:"var(--space-3)",background:"var(--color-panel-solid)",borderRadius:"var(--radius-4)",boxShadow:"var(--shadow-card)",cursor:l?"pointer":void 0,...g},children:[ce(ro,{align:"center",justify:"between",gap:"2",mb:"3",children:[ce(ro,{align:"center",gap:"2",style:{minWidth:0},children:[ce("div",{style:{position:"relative",flexShrink:0},children:[j(La,{size:"3",radius:"full",src:t,fallback:e.charAt(0).toUpperCase()||"?",style:c?{background:c,color:"white"}:void 0}),s&&j("span",{style:{position:"absolute",right:"calc(-1 * var(--space-1))",bottom:"calc(-1 * var(--space-1))",width:"var(--space-4)",height:"var(--space-4)",borderRadius:"50%",background:"var(--color-panel-solid)",border:"1px solid var(--gray-4)",display:"inline-flex",alignItems:"center",justifyContent:"center",transform:"scale(0.72)"},children:s})]}),o&&j(Hr,{})]}),ce(Be.Root,{children:[j(Be.Trigger,{children:j(Ma,{variant:"ghost",color:"gray","aria-label":"Account actions",style:{flexShrink:0},onClick:u=>u.stopPropagation(),children:j(Fa,{})})}),ce(Be.Content,{align:"end",onClick:u=>u.stopPropagation(),children:[o?ce(Be.Item,{onSelect:a,children:[j(Ha,{})," Resume"]}):ce(Be.Item,{onSelect:n,children:[j(Oa,{})," Pause"]}),ce(Be.Item,{color:"red",onSelect:i,children:[j($a,{})," Delete"]})]})]})]}),ce(eo,{style:{minWidth:0},children:[l?j("button",{type:"button",className:"card-title-button",onClick:u=>{u.stopPropagation(),l()},children:p}):p,j(to,{as:"p",size:"1",color:"gray",truncate:!0,children:r})]})]})}import{Box as oo,Flex as ao,Heading as Ua,IconButton as no,Text as io}from"@radix-ui/themes";import{ChevronLeftIcon as Va,ChevronRightIcon as Ga}from"@radix-ui/react-icons";var O={h1:"6",h2:"5",h3:"4",h4:"3"};import{Fragment as Qa,jsx as M,jsxs as Wr}from"react/jsx-runtime";var ja=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],$r="var(--space-9)",Ka="var(--space-8)",so="var(--space-2)",Ya=new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}),qa=new Intl.DateTimeFormat("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"});function Xa(e,r){return e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()&&e.getDate()===r.getDate()}function lo(e){return(e+6)%7}function Za(e){let r=e.getMonth(),t=e.getFullYear(),o=new Date(t,r,1),n=new Date(t,r+1,0),a=lo(o.getDay()),i=6-lo(n.getDay()),l=new Date(t,r,1-a),s=a+n.getDate()+i;return Array.from({length:s},(c,g)=>{let p=new Date(l.getFullYear(),l.getMonth(),l.getDate()+g);return{date:p,inCurrentMonth:p.getMonth()===r}})}function co(e,r){return new Date(e.getFullYear(),e.getMonth()+r,1)}function Ja({month:e,onMonthChange:r,events:t=[],dayDots:o,today:n,onSelectDay:a,style:i}){let l=n??new Date,s=Za(e),c=new Set(t.map(g=>g.toDateString()));return Wr(ao,{direction:"column",align:"center",gap:"4",style:i,children:[Wr(ao,{align:"center",gap:"2",children:[M(no,{type:"button",variant:"ghost",color:"gray","aria-label":"Previous month",onClick:()=>r?.(co(e,-1)),children:M(Va,{style:v("--space-4")})}),M(Ua,{as:"h2",size:O.h2,weight:"medium",style:{minWidth:b.month_title_min_w,textAlign:"center"},children:Ya.format(e)}),M(no,{type:"button",variant:"ghost",color:"gray","aria-label":"Next month",onClick:()=>r?.(co(e,1)),children:M(Ga,{style:v("--space-4")})})]}),M(oo,{style:{display:"grid",gridTemplateColumns:`repeat(7, ${$r})`,gap:so},children:ja.map(g=>M(io,{size:"2",align:"center",style:{color:"var(--gray-11)"},children:g},g))}),M(oo,{style:{display:"grid",gridTemplateColumns:`repeat(7, ${$r})`,gap:so},children:s.map(({date:g,inCurrentMonth:p})=>{let u=Xa(g,l),y=o?.get(g.toDateString()),h=c.has(g.toDateString()),x={position:"relative",width:$r,height:Ka,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",background:p?u?"var(--color-panel-solid)":"transparent":"var(--gray-2)",border:u?"1.5px solid var(--accent-9)":"none",borderRadius:u?"var(--radius-3)":p?void 0:"var(--radius-2)",padding:0,font:"inherit",cursor:a?"pointer":void 0},w=Wr(Qa,{children:[y&&y.length>0?M("span",{"aria-hidden":"true",style:{position:"absolute",bottom:"var(--space-1)",left:0,right:0,display:"flex",justifyContent:"center",gap:"2px"},children:y.slice(0,3).map((Z,se)=>M("span",{style:{width:"var(--space-1)",height:"var(--space-1)",borderRadius:"50%",background:Z}},se))}):h&&M("span",{"aria-hidden":"true",style:{position:"absolute",top:"var(--space-1)",right:"var(--space-2)",width:"var(--space-2)",height:"var(--space-2)",borderRadius:"50%",background:"var(--accent-9)"}}),M(io,{size:"3",style:{color:p?"var(--gray-12)":"var(--gray-11)",fontWeight:u?600:400},children:g.getDate()})]}),I=g.toISOString();return a?M("button",{type:"button",onClick:()=>a(g),"aria-label":qa.format(g),style:x,children:w},I):M("div",{style:x,children:w},I)})})]})}import{useEffect as en}from"react";import{Callout as Ur}from"@radix-ui/themes";import{CheckCircledIcon as rn,ExclamationTriangleIcon as tn}from"@radix-ui/react-icons";import{jsx as Ue,jsxs as on}from"react/jsx-runtime";function Vr({msg:e,color:r="green",onDone:t,durationMs:o=3e3}){return en(()=>{let n=setTimeout(t,o);return()=>clearTimeout(n)},[t,o]),Ue("div",{style:{position:"fixed",bottom:"var(--space-5)",right:"var(--space-5)",zIndex:1e4,maxWidth:b.dialog_body,pointerEvents:"none"},children:on(Ur.Root,{color:r,variant:"soft",size:"1",children:[Ue(Ur.Icon,{children:r==="red"?Ue(tn,{}):Ue(rn,{})}),Ue(Ur.Text,{children:e})]})})}import{jsx as an}from"react/jsx-runtime";function E({children:e,size:r="var(--space-7)"}){return an("div",{style:{width:r,height:r,borderRadius:"var(--radius-4)",background:"var(--color-panel-solid)",border:"1px solid var(--gray-5)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e})}import{Box as nn,Flex as sn,Text as po}from"@radix-ui/themes";import{LockClosedIcon as ln}from"@radix-ui/react-icons";import{jsx as go,jsxs as Gr}from"react/jsx-runtime";function cn({title:e,time:r,detail:t,color:o,locked:n}){return Gr(sn,{align:"center",justify:"between",style:{background:o,borderRadius:"var(--radius-3)",padding:"var(--space-3)",color:"white"},children:[Gr(nn,{style:{minWidth:0},children:[go(po,{as:"p",size:"2",weight:"medium",style:{color:"white"},truncate:!0,children:e}),Gr(po,{as:"p",size:"1",style:{color:"rgba(255,255,255,0.85)"},truncate:!0,children:[r,t?` \xB7 ${t}`:""]})]}),n&&go(ln,{style:{flexShrink:0,color:"rgba(255,255,255,0.85)"}})]})}import{Box as dn}from"@radix-ui/themes";import{jsx as pn}from"react/jsx-runtime";function jr({children:e,style:r,showBorder:t=!1,onActivate:o,selected:n=!1,className:a,"aria-label":i}){let l=!!o;function s(c){o&&(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),o())}return pn(dn,{role:l?"button":void 0,tabIndex:l?0:void 0,"aria-label":i,onClick:o,onKeyDown:l?s:void 0,className:["data-table-row",l&&"data-table-row--interactive",l&&n&&"data-table-row--selected",a].filter(Boolean).join(" "),style:{borderTop:t?"1px solid var(--gray-3)":void 0,...r},children:e})}import{useId as gn}from"react";import{Card as un,Flex as Kr,Text as Yr}from"@radix-ui/themes";import{jsx as de,jsxs as ze}from"react/jsx-runtime";function mn({label:e,value:r,delta:t,deltaDir:o,goodDirection:n,statusColor:a,sparkline:i}){return de(un,{className:"metric-card",children:ze(Kr,{direction:"column",p:"1",children:[ze(Kr,{align:"center",justify:"between",mb:"3",children:[de(Yr,{as:"span",className:"ds-section-label",children:e}),de("div",{style:{width:"var(--space-2)",height:"var(--space-2)",borderRadius:"50%",background:a,flexShrink:0}})]}),de(Yr,{as:"p",className:"metric-card-value",children:r}),ze(Kr,{align:"end",justify:"between",children:[ze(Yr,{size:"1",style:{color:o==="flat"?"var(--gray-11)":o===n?"var(--green-11)":"var(--red-11)",lineHeight:1.4},children:[o==="up"?"\u2191 ":o==="down"?"\u2193 ":"",t]}),de(fn,{data:i,color:a})]})]})})}function fn({data:e,color:r}){let n=Math.min(...e),i=Math.max(...e)-n||1,l=e.map((u,y)=>({x:y/(e.length-1)*72,y:28-(u-n)/i*28*.75-28*.1})),s=l.map((u,y)=>`${y===0?"M":"L"} ${u.x.toFixed(1)} ${u.y.toFixed(1)}`).join(" "),c=["M 0 28",...l.map(u=>`L ${u.x.toFixed(1)} ${u.y.toFixed(1)}`),"L 72 28 Z"].join(" "),p=`spk${gn().replace(/[^a-zA-Z0-9_-]/g,"")}`;return ze("svg",{width:72,height:28,viewBox:"0 0 72 28","aria-hidden":!0,style:{overflow:"visible",flexShrink:0},children:[de("defs",{children:ze("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:[de("stop",{offset:"0%",stopColor:r,stopOpacity:"0.18"}),de("stop",{offset:"100%",stopColor:r,stopOpacity:"0"})]})}),de("path",{d:c,fill:`url(#${p})`}),de("path",{d:s,fill:"none",stroke:r,strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})]})}import{Link as hn}from"react-router-dom";import{Badge as vn,Button as yn,Card as bn,Flex as uo,Text as mo}from"@radix-ui/themes";import{ArrowRightIcon as xn}from"@radix-ui/react-icons";import{jsx as Te,jsxs as cr}from"react/jsx-runtime";function _n({href:e,icon:r,name:t,description:o,badge:n}){return cr(bn,{style:{height:"100%",display:"flex",flexDirection:"column"},children:[cr(uo,{direction:"column",gap:"3",p:"1",flexGrow:"1",children:[cr(uo,{align:"center",gap:"3",minWidth:"0",children:[Te(E,{children:r}),Te(mo,{size:"4",weight:"medium",style:{color:"var(--gray-12)",fontFamily:"var(--font-poppins)"},truncate:!0,children:t}),n&&Te(vn,{color:"gray",variant:"soft",size:"1",radius:"full",style:{flexShrink:0},children:n})]}),Te(mo,{size:"2",style:{color:"var(--gray-11)",fontFamily:"var(--font-poppins)",lineHeight:1.5},children:o})]}),Te(ee,{pad:"var(--space-3)",radius:"var(--radius-4)",children:Te(yn,{size:"2",className:"btn-amber-primary",asChild:!0,children:cr(hn,{to:e,children:["Open",Te(xn,{style:v("--space-3")})]})})})]})}import{Text as Ve}from"@radix-ui/themes";import{jsx as qr,jsxs as Xr}from"react/jsx-runtime";function wn({tag:e,tagColor:r,msg:t,actor:o,timeAgo:n,timestamp:a,showBorder:i}){return Xr(jr,{showBorder:i,style:{display:"flex",alignItems:"center",gap:"var(--space-3)",paddingBlock:"var(--space-2)",paddingInline:"var(--space-4)"},children:[qr(Ve,{as:"span",size:"1",weight:"medium",className:"data-mono",style:{color:r,minWidth:"var(--space-6)",letterSpacing:"0.06em",flexShrink:0},children:e}),Xr(Ve,{as:"span",size:"2",style:{flex:1,color:"var(--gray-11)",lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[t,o&&Xr(Ve,{as:"span",size:"1",style:{color:"var(--gray-11)",marginLeft:"var(--space-2)"},children:["by ",o]})]}),n&&qr(Ve,{as:"span",size:"1",color:"gray",style:{whiteSpace:"nowrap",flexShrink:0},children:n}),qr(Ve,{as:"span",size:"1",className:"data-mono",style:{color:"var(--gray-11)",whiteSpace:"nowrap",flexShrink:0,minWidth:"var(--space-7)",textAlign:"right"},children:a})]})}import{Button as Cn,Card as Tn,Flex as Rn,Text as kn}from"@radix-ui/themes";import{ExclamationTriangleIcon as Sn}from"@radix-ui/react-icons";import{jsx as Ge,jsxs as An}from"react/jsx-runtime";function Dn({onRetry:e,message:r="Couldn't load your dashboard."}){return Ge(Tn,{children:An(Rn,{direction:"column",align:"center",justify:"center",py:"9",gap:"3",children:[Ge(E,{children:Ge(Sn,{style:{...v("--space-5"),color:"var(--gray-7)"}})}),Ge(kn,{size:"2",color:"gray",children:r}),Ge(Cn,{size:"2",color:"amber",variant:"solid",className:"btn-amber-primary",onClick:e,children:"Retry"})]})})}import{useMemo as In}from"react";import{Button as Pn,Flex as En,IconButton as dr,Text as Nn}from"@radix-ui/themes";import{ChevronLeftIcon as Bn,ChevronRightIcon as zn,DoubleArrowLeftIcon as Ln,DoubleArrowRightIcon as Mn}from"@radix-ui/react-icons";import{jsx as re,jsxs as Hn}from"react/jsx-runtime";var Le="\u2026";function Fn(e,r,t){let o=t*2+5;if(r<=o)return Array.from({length:r},(c,g)=>g+1);let n=Math.max(e-t,1),a=Math.min(e+t,r),i=n>2,l=a<r-1;if(!i&&l)return[...Array.from({length:3+t*2},(g,p)=>p+1),Le,r];if(i&&!l){let c=3+t*2,g=Array.from({length:c},(p,u)=>r-c+u+1);return[1,Le,...g]}let s=Array.from({length:a-n+1},(c,g)=>n+g);return[1,Le,...s,Le,r]}function On({currentPage:e,totalPages:r,onPageChange:t,siblingCount:o=1,showFirstLast:n=!1,size:a="2"}){let i=In(()=>Fn(e,r,o),[e,r,o]),l=e<=1,s=e>=r;return re(En,{asChild:!0,align:"center",gap:"1",children:Hn("nav",{"aria-label":"Pagination",children:[n&&re(dr,{size:a,variant:"soft",color:"gray","aria-label":"First page",disabled:l,onClick:()=>t(1),children:re(Ln,{})}),re(dr,{size:a,variant:"soft",color:"gray","aria-label":"Previous page",disabled:l,onClick:()=>t(e-1),children:re(Bn,{})}),i.map((c,g)=>c===Le?re(Nn,{size:a,color:"gray","aria-hidden":!0,style:{paddingInline:"var(--space-1)"},children:Le},`ellipsis-${g}`):re(Pn,{size:a,"aria-label":`Page ${c}`,"aria-current":c===e?"page":void 0,variant:c===e?"solid":"soft",color:c===e?void 0:"gray",className:c===e?"btn-amber-primary":void 0,onClick:()=>c!==e&&t(c),children:c},c)),re(dr,{size:a,variant:"soft",color:"gray","aria-label":"Next page",disabled:s,onClick:()=>t(e+1),children:re(zn,{})}),n&&re(dr,{size:a,variant:"soft",color:"gray","aria-label":"Last page",disabled:s,onClick:()=>t(r),children:re(Mn,{})})]})})}var pr={admin:{label:"Admin",color:"amber"},operator:{label:"Operator",color:"blue"},user:{label:"Platform User",color:"gray"}},$n={admin:pr.admin.label,operator:pr.operator.label,user:pr.user.label},Wn={active:{label:"Active",color:"var(--color-success)"},inactive:{label:"Inactive",color:"var(--gray-11)"},suspended:{label:"Suspended",color:"var(--color-danger)"}},Un={ok:"var(--green-9)",warn:"var(--orange-9)",error:"var(--red-9)"},Vn={auth:{tag:"AUTH",color:"var(--gray-11)"},sync:{tag:"SYNC",color:"var(--blue-11)"},role:{tag:"ROLE",color:"var(--violet-11)"},provision:{tag:"PROV",color:"var(--green-11)"},health:{tag:"HLTH",color:"var(--teal-11)"},error:{tag:"ERR!",color:"var(--red-11)"}},fo={USER_UPDATED:{label:"User updated",tag:"UPD",badge:"amber",color:"var(--amber-11)"},USER_DISABLED:{label:"User disabled",tag:"DIS",badge:"red",color:"var(--red-11)"},USER_ENABLED:{label:"User enabled",tag:"ENA",badge:"green",color:"var(--teal-11)"},USER_APPROVED:{label:"User approved",tag:"APPR",badge:"green",color:"var(--green-11)"},USER_REJECTED:{label:"User rejected",tag:"REJ",badge:"red",color:"var(--red-11)"},SIGNUP_NOTIFICATIONS_ON:{label:"Signup notifications on",tag:"NOTF",badge:"gray",color:"var(--gray-11)"},SIGNUP_NOTIFICATIONS_OFF:{label:"Signup notifications off",tag:"NOTF",badge:"gray",color:"var(--gray-11)"},APPROVAL_EMAIL_RESENT:{label:"Approval email resent",tag:"MAIL",badge:"amber",color:"var(--amber-11)"},USER_DELETED:{label:"User deleted",tag:"DEL",badge:"yellow",color:"var(--red-11)"},ADMIN_GRANTED:{label:"Admin granted",tag:"ADMN",badge:"gray",color:"var(--violet-11)"},ADMIN_REVOKED:{label:"Admin revoked",tag:"ADMN",badge:"gray",color:"var(--orange-11)"},ADMIN_ROLE_CHANGED:{label:"Role changed",tag:"ROLE",badge:"amber",color:"var(--violet-11)"},SESSION_REVOKED:{label:"Session revoked",tag:"SESS",badge:"gray",color:"var(--gray-11)"},APP_GRANTED:{label:"App access granted",tag:"APP",badge:"green",color:"var(--green-11)"},APP_REVOKED:{label:"App access revoked",tag:"APP",badge:"red",color:"var(--orange-11)"},BUNDLE_GRANTED:{label:"Bundle access granted",tag:"BNDL",badge:"green",color:"var(--green-11)"},BUNDLE_REVOKED:{label:"Bundle access revoked",tag:"BNDL",badge:"red",color:"var(--orange-11)"},APP_VALIDATED:{label:"App repo checked",tag:"CHK",badge:"gray",color:"var(--gray-11)"},APP_DEPLOY_REQUESTED:{label:"App deploy requested",tag:"DPLY",badge:"amber",color:"var(--amber-11)"},APP_DEPLOYED:{label:"App deployed",tag:"LIVE",badge:"green",color:"var(--green-11)"},APP_DEPLOY_FAILED:{label:"App deploy failed",tag:"FAIL",badge:"red",color:"var(--red-11)"},APP_REVERTED:{label:"App deploy reverted",tag:"RVRT",badge:"red",color:"var(--orange-11)"},APP_ROLLED_BACK:{label:"App rolled back",tag:"RBCK",badge:"amber",color:"var(--orange-11)"},APP_REMOVED:{label:"App undeployed",tag:"UNDP",badge:"red",color:"var(--red-11)"},APP_DEPLOY_GRANTS_FAILED:{label:"Deploy grants failed",tag:"GRNT",badge:"red",color:"var(--red-11)"},ADMIN_CHANGE_ROLLED_BACK:{label:"Admin change rolled back",tag:"UNDO",badge:"amber",color:"var(--amber-11)"},AUDIT_EXPORTED:{label:"Audit log exported",tag:"EXPT",badge:"gray",color:"var(--gray-11)"},SESSIONS_LISTED:{label:"Sessions viewed",tag:"VIEW",badge:"gray",color:"var(--gray-11)"}};function Gn(e){return fo[e]??{label:e,tag:e.slice(0,4).toUpperCase(),badge:"gray",color:"var(--gray-11)"}}import{jsx as ho}from"react/jsx-runtime";function Zr(){return ho("div",{className:"auth-art-card",children:ho("img",{src:"/arm-logo-inverted.svg",alt:"araMetrics",style:{width:"56%",maxWidth:b.brand_logo_max,display:"block",userSelect:"none"},draggable:!1})})}import{jsx as gr,jsxs as Kn}from"react/jsx-runtime";function jn({children:e}){return Kn("div",{style:{minHeight:"100vh",display:"flex",background:"var(--surface-content)",padding:"var(--space-5)",gap:"var(--space-5)"},children:[gr("div",{className:"auth-card-left",style:{width:"47%",flexShrink:0,position:"sticky",top:"var(--space-5)",height:"calc(100vh - var(--space-8))"},children:gr(Zr,{})}),gr("div",{className:"auth-card-right",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:"calc(100vh - var(--space-8))",padding:"var(--space-7) var(--space-5)"},children:gr("main",{style:{maxWidth:b.auth_form_max,width:"100%",marginLeft:"auto",marginRight:"auto",background:"var(--color-panel-solid)",borderRadius:"var(--radius-5)",boxShadow:"var(--shadow-card)",padding:"var(--space-7) var(--space-5)"},children:e})})]})}import{jsx as ur,jsxs as Yn}from"react/jsx-runtime";function Jr(){return Yn("svg",{width:18,height:18,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:[ur("path",{d:"M15.68 8.18c0-.57-.05-1.11-.14-1.64H8v3.1h4.3a3.68 3.68 0 0 1-1.6 2.42v2h2.58c1.51-1.39 2.4-3.44 2.4-5.88Z",fill:"#4285F4"}),ur("path",{d:"M8 16c2.16 0 3.97-.71 5.3-1.94l-2.59-2a4.88 4.88 0 0 1-7.27-2.56H0.9v2.07A8 8 0 0 0 8 16Z",fill:"#34A853"}),ur("path",{d:"M3.44 9.5A4.8 4.8 0 0 1 3.19 8c0-.52.09-1.03.25-1.5V4.43H.9A8 8 0 0 0 0 8c0 1.29.31 2.51.9 3.57L3.44 9.5Z",fill:"#FBBC05"}),ur("path",{d:"M8 3.18c1.22 0 2.31.42 3.17 1.24l2.37-2.37A7.94 7.94 0 0 0 8 0 8 8 0 0 0 .9 4.43L3.44 6.5A4.77 4.77 0 0 1 8 3.18Z",fill:"#EA4335"})]})}import{jsx as mr,jsxs as qn}from"react/jsx-runtime";function Qr(){return qn("svg",{width:18,height:18,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:[mr("rect",{x:"0",y:"0",width:"7.6",height:"7.6",fill:"#F25022"}),mr("rect",{x:"8.4",y:"0",width:"7.6",height:"7.6",fill:"#7FBA00"}),mr("rect",{x:"0",y:"8.4",width:"7.6",height:"7.6",fill:"#00A4EF"}),mr("rect",{x:"8.4",y:"8.4",width:"7.6",height:"7.6",fill:"#FFB900"})]})}import{useRef as Xn}from"react";import{TextField as Zn}from"@radix-ui/themes";import{jsx as vo}from"react/jsx-runtime";function et({value:e,onChange:r,disabled:t}){let o=Xn([]);function n(s,c){let g=c.target.value.replace(/\D/g,"").slice(-1),p=Array.from({length:4},(u,y)=>e[y]??"");p[s]=g,r(p.join("")),g&&s<3&&o.current[s+1]?.focus()}function a(s,c){let g=Array.from({length:4},(p,u)=>e[u]??"");c.key==="Backspace"?!g[s]&&s>0&&(g[s-1]="",r(g.join("")),o.current[s-1]?.focus()):c.key==="ArrowLeft"&&s>0?o.current[s-1]?.focus():c.key==="ArrowRight"&&s<3&&o.current[s+1]?.focus()}function i(s){let c=s.clipboardData.getData("text").replace(/\D/g,"").slice(0,4);c&&(s.preventDefault(),r(c),o.current[Math.min(c.length,3)]?.focus())}let l=Array.from({length:4},(s,c)=>e[c]??"");return vo("div",{style:{display:"flex",gap:"var(--space-3)",justifyContent:"center"},children:l.map((s,c)=>vo(Zn.Root,{ref:g=>{o.current[c]=g},type:"text",inputMode:"numeric",maxLength:1,value:s,onChange:g=>n(c,g),onKeyDown:g=>a(c,g),onPaste:i,disabled:t,className:"otp-box","aria-label":`Digit ${c+1}`,autoComplete:c===0?"one-time-code":"off"},c))})}import{Button as rt,Callout as je,Heading as Jn,Text as tt}from"@radix-ui/themes";import{ExclamationTriangleIcon as Qn}from"@radix-ui/react-icons";import{Fragment as yo,jsx as K,jsxs as ue}from"react/jsx-runtime";function ei({email:e,title:r,subtitle:t,code:o,onCodeChange:n,otpDevHint:a,error:i,errorAction:l,busy:s,otpExpiresAt:c,otpSecondsLeft:g,resendCooldown:p,onResend:u,onUseDifferentEmail:y}){return ue(yo,{children:[ue("div",{style:{marginBottom:"var(--space-6)",textAlign:"center"},children:[K(Jn,{as:"h1",size:O.h1,style:{color:"var(--ink-strong)",marginBottom:"var(--space-3)"},children:r}),ue(tt,{as:"p",size:"2",style:{color:"var(--ink-mid)",lineHeight:1.55},children:[t," ",K("span",{style:{fontWeight:600,color:"var(--ink-strong)"},children:e}),"."]})]}),a&&K(je.Root,{color:"gray",variant:"surface",size:"1",style:{marginBottom:"var(--space-5)"},children:ue(je.Text,{style:{fontFamily:"var(--font-poppins)"},children:["Dev hint \u2014 code is ",K("strong",{children:a})]})}),i&&ue(je.Root,{color:"red",variant:"surface",size:"2",style:{marginBottom:"var(--space-5)"},children:[K(je.Icon,{children:K(Qn,{})}),ue(je.Text,{style:{fontFamily:"var(--font-poppins)"},children:[i,l&&ue(yo,{children:[" ",K(rt,{type:"button",variant:"ghost",size:"1",onClick:l.onClick,style:{fontWeight:600,textDecoration:"underline",height:"auto",padding:0},children:l.label})]})]})]}),ue("div",{children:[K(et,{value:o,onChange:n,disabled:s||g<=0}),s?K(tt,{as:"p",size:"1",style:{color:"var(--ink-mid)",marginTop:"var(--space-3)",textAlign:"center"},children:"Checking code\u2026"}):c&&g<=0?K(tt,{as:"p",size:"1",style:{color:"var(--red-11)",marginTop:"var(--space-3)",textAlign:"center"},children:"Code expired \u2014 resend to get a new one."}):null]}),ue("div",{style:{marginTop:"var(--space-5)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--space-3)"},children:[K(rt,{type:"button",variant:"ghost",size:"2",disabled:p>0||s,onClick:u,style:{fontWeight:500,color:p>0?"rgba(85, 85, 85, 0.4)":"var(--ink-strong)",textDecoration:p>0?"none":"underline"},children:p>0?`Resend email (${p}s)`:"Resend email"}),K(rt,{type:"button",variant:"ghost",size:"2",className:"auth-underline-link",disabled:s,onClick:y,style:{fontWeight:500,color:"var(--ink-strong)"},children:"Use a Different Email"})]})]})}import{jsx as bo}from"react/jsx-runtime";function H({provider:e}){return e==="microsoft"?bo(Qr,{}):bo(Jr,{})}var ri={google:"Google",microsoft:"Microsoft"};import{useEffect as ti,useRef as xo,useState as ot}from"react";import{Link as ko,useLocation as oi}from"react-router-dom";import{Avatar as _o,Badge as So,DropdownMenu as me,IconButton as wo,Text as Ye,Tooltip as fr}from"@radix-ui/themes";import{ChevronDownIcon as ai,ChevronLeftIcon as ni,ChevronRightIcon as Co,Cross1Icon as ii,DotFilledIcon as Do,DotsVerticalIcon as si,ExitIcon as li,GearIcon as To,QuestionMarkCircledIcon as ci}from"@radix-ui/react-icons";import{Fragment as lt,jsx as m,jsxs as S}from"react/jsx-runtime";var hr="var(--space-9)",Ke=e=>"items"in e,nt=e=>e.badge?`${e.label} \xB7 ${e.badge}`:e.label;function di(e){if(!e)return{};try{let r=JSON.parse(localStorage.getItem(e)??"{}");return!r||typeof r!="object"||Array.isArray(r)?{}:Object.fromEntries(Object.entries(r).filter(t=>typeof t[1]=="boolean"))}catch{return{}}}function pi(e,r){if(e)try{localStorage.setItem(e,JSON.stringify(r))}catch{}}var gi="calc(4 * var(--space-9))",ui="calc(var(--space-9) + var(--space-6))",mi="calc(4 * var(--space-9) + var(--space-5))",fi="var(--space-8)",it="var(--space-5)",st="var(--space-5)",Ao="calc(var(--space-5) + var(--space-3))",hi="var(--space-3)",vi=e=>e?"opacity 130ms ease 80ms":"opacity 90ms ease",Ro="opacity 200ms ease";function yi({collapsed:e,onToggle:r,onClose:t,items:o,persistKey:n,utilityHrefs:a,user:i,onSignOut:l,brandLogoExpandedSrc:s="/expand.svg",brandLogoCollapsedSrc:c="/shrink.svg",helpHref:g,devRoles:p,onDevRoleSelect:u,showDevRoles:y=!1}){let h=oi().pathname,[x,w]=ot(!1),[I,Z]=ot(null),se=()=>Z(null),T=xo(null),B=xo(null),J=()=>{B.current={back:!0},se()},U=!!t,f=!e||U,L=U?mi:e?ui:gi,V=d=>!d.roles||!!i&&d.roles.includes(i.role),F=d=>{if(!V(d))return[];if(!d.bundle||!d.children)return[d];let _=d.children.flatMap(F);return _.length>0?[{...d,children:_}]:[]},Q=o.flatMap(d=>{if(!Ke(d))return F(d);let _=d.items.flatMap(F);return _.length>0?[{...d,items:_}]:[]}),pe=Q.filter(d=>!Ke(d)),Pe=Q.flatMap(d=>Ke(d)?d.items:[d]),[Nt,pa]=ot(()=>di(n)),Bt=d=>Nt[d.id]??!!d.default_collapsed;function ga(d){let _={...Nt,[d.id]:!Bt(d)};pa(_),pi(n,_)}let zt=new Set(a),ua=Q.filter(d=>Ke(d)||!zt.has(d.href)),Lt=pe.find(d=>d.href==="/settings"),Pr=pe.filter(d=>zt.has(d.href)&&d.href!=="/settings");function Er(d){return d.root??d.href}function Mt(d){return!!d.children?.length&&(d.drillable??!0)}function Nr(d){let _=Er(d);return h===_||h===d.href||h.startsWith(_+"/")?!0:!!d.bundle&&!!d.children?.some(Nr)}let sr=[];for(let d=Pe;;){let _=d.find(G=>Mt(G)&&Nr(G));if(!_)break;sr.push(_),d=_.children}let Br=I?.path===h?Math.min(I.depth,sr.length):sr.length,ge=Br>0?sr[Br-1]:void 0,ma=()=>{ge&&(B.current={row:ge.href}),Z({path:h,depth:Br-1})};ti(()=>{let d=B.current,_=T.current;if(!d||!_)return;B.current=null,("back"in d?_.querySelector("[data-nav-back]"):Array.from(_.querySelectorAll("[data-nav-href]")).find(Ee=>Ee.dataset.navHref===d.row))?.focus()},[ge?.href]);function zr(d,_){return d==="/home"||_?h===d:h===d||h.startsWith(d+"/")}function Lr(d){return Ft(d,!0)}function Ft(d,_){let G=d.bundle?Nr(d):zr(Er(d),d.end),Ee=Mt(d),Ht=m(at,{item:d,active:G,expanded:f,uppercase:_,showChevron:Ee,onClick:Ee?J:void 0},d.href);return f?Ht:m(fr,{content:nt(d),side:"right",delayDuration:300,children:Ht},d.href)}function fa(d){let _=`nav-group-${d.id}`;if(!f)return S("div",{role:"group","aria-label":d.label,children:[m("div",{"aria-hidden":"true",style:{height:1,background:"var(--gray-4)",margin:`var(--space-2) ${it}`}}),d.items.map(Lr)]},_);let G=Bt(d);return S("div",{style:{display:"flex",flexDirection:"column",marginTop:"var(--space-3)"},children:[m(bi,{label:d.label,folded:G,holdsActive:G&&d.items.some(Ee=>zr(Er(Ee))),controls:_,onToggle:()=>ga(d)}),m("div",{id:_,role:"group","aria-label":d.label,hidden:G,children:d.items.map(Lr)})]},_)}let ha=h.startsWith("/admin")&&(i?.role==="admin"||i?.role==="operator"),Ot=i?.name?.split(" ").map(d=>d[0]).join("").slice(0,2)||"?";return S("aside",{ref:T,style:{position:"relative",width:L,height:"100%",minHeight:"100vh",background:"var(--shell-surface)",borderRight:"1px solid var(--gray-6)",flexShrink:0,transition:U?"none":"width 200ms ease",zIndex:2},children:[S("div",{style:{width:"100%",height:"100%",minHeight:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},children:[S("div",{style:{height:hr,flexShrink:0,position:"relative",overflow:"hidden",borderBottom:"1px solid var(--border-hairline)"},children:[m("img",{src:s,alt:"",height:40,style:{display:"block",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",transition:Ro,opacity:f?1:0,pointerEvents:"none",userSelect:"none"}}),m("img",{src:c,alt:"",height:40,style:{display:"block",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",transition:Ro,opacity:f?0:1,pointerEvents:"none",userSelect:"none"}}),U&&m(wo,{variant:"ghost",color:"gray",size:"1",onClick:t,"aria-label":"Close menu",style:{position:"absolute",right:"var(--space-2)",top:"50%",transform:"translateY(-50%)"},children:m(ii,{style:v("--space-3")})})]}),m("nav",{"aria-label":"Main navigation",style:{flex:1,overflowY:"auto",overflowX:"hidden",paddingTop:"var(--space-5)",display:"flex",flexDirection:"column"},children:ge?S(lt,{children:[(()=>{let d=m(at,{item:{label:ge.label,href:"#",Icon:ni},active:!1,expanded:f,uppercase:!0,asButton:!0,onClick:ma});return f?d:m(fr,{content:ge.label,side:"right",delayDuration:300,children:d})})(),ge.children.map(d=>Ft(d,!!ge.bundle))]}):ua.map(d=>Ke(d)?fa(d):Lr(d))}),!ge&&Pr.length>0&&m("nav",{"aria-label":"Utility navigation",style:{flexShrink:0,borderTop:"1px solid var(--gray-4)",paddingTop:"var(--space-2)",paddingBottom:"var(--space-2)",display:"flex",flexDirection:"column"},children:Pr.map(d=>{let _=zr(d.href),G=m(at,{item:d,active:_,expanded:f,uppercase:!0,showChevron:!!d.children,onClick:d.children?J:void 0},d.href);return f?G:m(fr,{content:nt(d),side:"right",delayDuration:300,children:G},d.href)})}),S("div",{style:{borderTop:Pr.length>0?"none":"1px solid var(--gray-4)",padding:f?"var(--space-2) var(--space-4)":"var(--space-2) 0",flexShrink:0,display:"flex",flexDirection:"column",gap:"var(--space-2)"},children:[f&&ha&&S(So,{color:"gray",variant:"soft",highContrast:!0,size:"1",radius:"full",style:{alignSelf:"flex-start"},children:[m(Do,{style:v("--space-2")}),"Administering platform"]}),S("div",{style:{display:"flex",flexDirection:f?"row":"column",alignItems:"center",justifyContent:f?"space-between":"center",gap:"var(--space-2)"},children:[f?S("div",{className:"shell-profile-chip",style:{display:"flex",alignItems:"center",gap:"var(--space-2)",minWidth:0,flex:1,padding:"var(--space-1)",borderRadius:"var(--radius-3)"},children:[m(_o,{size:"2",radius:"full",src:i?.avatar_src,fallback:Ot,color:"gray",variant:"soft",style:{flexShrink:0}}),m(Ye,{as:"p",size:"2",weight:"medium",truncate:!0,style:{color:"var(--shell-ink-strong)"},children:i?.name})]}):m(fr,{content:i?.name??"Account",side:"right",delayDuration:300,children:m(_o,{size:"3",radius:"full",src:i?.avatar_src,fallback:Ot,color:"gray",variant:"soft"})}),S(me.Root,{children:[m(me.Trigger,{children:m(wo,{variant:"ghost",color:"gray","aria-label":"Account menu",className:"sidebar-icon-btn",style:{flexShrink:0},children:m(si,{style:v("--space-4")})})}),S(me.Content,{align:f?"end":"start",side:f?"top":"right",style:{minWidth:200},children:[Lt&&m(me.Item,{asChild:!0,children:S(ko,{to:Lt.href,onClick:se,children:[m(To,{}),"Settings"]})}),g&&S(me.Item,{onClick:()=>window.open(g,"_blank","noopener,noreferrer"),children:[m(ci,{}),"Help"]}),m(me.Separator,{}),S(me.Item,{color:"red",onClick:()=>w(!0),children:[m(li,{}),"Log Out"]}),y&&p&&p.length>0&&S(lt,{children:[m(me.Separator,{}),m("div",{style:{padding:"var(--space-1) var(--space-3)"},children:m(Ye,{size:"1",style:{fontFamily:"monospace",color:"var(--gray-11)",letterSpacing:"0.04em",textTransform:"uppercase"},children:"Dev \xB7 switch role"})}),p.map(d=>S(me.Item,{onClick:()=>u?.(d.email),disabled:i?.role===d.role,children:[m(To,{}),d.label,S(Ye,{size:"1",color:"gray",style:{marginLeft:"auto"},children:[d.role,"@"]})]},d.role))]})]})]})]})]})]}),!U&&m("button",{onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",className:"sidebar-collapse-btn",style:{top:"calc(var(--space-9) / 2)",transform:"translateY(-50%)",right:"calc(-1 * var(--space-3))"},children:m(xi,{flipped:e})}),m(Or,{open:x,onOpenChange:w,title:"Confirm Logout",description:"Are you sure you want to log out?",onConfirm:l})]})}function at({item:e,active:r,expanded:t,onClick:o,asButton:n,showChevron:a,uppercase:i}){let l={position:"relative",textDecoration:"none",display:"flex",alignItems:"center",height:fi,flexShrink:0,paddingLeft:Ao,paddingRight:t?`calc(${st} + var(--space-1))`:0,gap:t?hi:0,color:r?"var(--shell-ink-strong)":"var(--shell-ink-mid)",cursor:"pointer"},s=S(lt,{children:[r&&m("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:0,width:"var(--space-1)",height:"100%",background:"var(--accent-9)",borderRadius:"0 var(--radius-1) var(--radius-1) 0"}}),m("span",{"aria-hidden":"true",className:"nav-pill",style:{position:"absolute",top:0,bottom:0,left:it,right:t?st:it,borderRadius:"var(--radius-3)",background:r?"var(--accent-9)":"transparent",transition:"background 80ms ease"}}),m(e.Icon,{width:20,height:20,style:{position:"relative",flexShrink:0}}),S("span",{style:{position:"relative",display:"flex",alignItems:"center",gap:"var(--space-1)",minWidth:0,overflow:"hidden",maxWidth:t?void 0:0,opacity:t?1:0,transition:vi(t)},children:[m(Ye,{as:"span",size:"3",weight:r?"medium":"regular",style:{lineHeight:1.3,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0,textTransform:i?"uppercase":void 0},children:e.label}),e.badge&&m(So,{color:"gray",variant:r?"solid":"soft",highContrast:r,size:"1",radius:"full",style:{flexShrink:0,paddingInline:"var(--space-1)",textTransform:i?"uppercase":void 0},children:e.badge})]}),a&&t&&(r?m("span",{style:{position:"relative",marginLeft:"auto",marginRight:"var(--space-1)",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--space-5)",height:"var(--space-5)",background:"var(--color-panel-solid)",borderRadius:"var(--radius-2)",boxShadow:"0 1px 2px rgba(0,0,0,0.12)"},children:m(Co,{style:{...v("--space-4"),color:"var(--gray-11)"}})}):m(Co,{style:{...v("--space-4"),position:"relative",marginLeft:"auto",color:"var(--shell-ink-mid)",flexShrink:0}}))]});return n?m("button",{type:"button",onClick:o,"data-nav-back":"",className:"shell-nav-item",style:{...l,background:"none",border:"none",width:"100%",textAlign:"left",font:"inherit"},children:s}):m(ko,{to:e.href,onClick:o,className:"shell-nav-item","data-nav-href":e.href,"data-active":r?"true":void 0,"aria-current":r?"page":void 0,title:t?nt(e):void 0,style:l,children:s})}function bi({label:e,folded:r,holdsActive:t,controls:o,onToggle:n}){return S("button",{type:"button",onClick:n,"aria-expanded":!r,"aria-controls":o,className:"shell-nav-group","data-holds-active":t?"true":void 0,style:{display:"flex",alignItems:"center",gap:"var(--space-1)",height:"var(--space-6)",flexShrink:0,width:"100%",paddingLeft:Ao,paddingRight:`calc(${st} + var(--space-1))`,background:"none",border:"none",font:"inherit",textAlign:"left",cursor:"pointer",color:t?"var(--shell-ink-strong)":"var(--shell-ink-mid)"},children:[m(Ye,{as:"span",size:"1",weight:"medium",style:{textTransform:"uppercase",letterSpacing:"0.04em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:e}),t&&m(Do,{"aria-hidden":"true",style:{...v("--space-3"),color:"var(--accent-9)",flexShrink:0}}),m(ai,{"aria-hidden":"true",style:{...v("--space-4"),marginLeft:"auto",flexShrink:0,transform:r?"rotate(-90deg)":void 0,transition:"transform 120ms ease"}})]})}function xi({flipped:e}){return S("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{transform:e?"scaleX(-1)":void 0},children:[m("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5",stroke:"currentColor"}),m("path",{d:"M5.5 2.5v11",stroke:"currentColor"}),m("path",{d:"M11 5.5 8.5 8l2.5 2.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]})}import{Link as _i,useLocation as wi}from"react-router-dom";import{HamburgerMenuIcon as Ci,MagnifyingGlassIcon as Ti,BellIcon as Ri}from"@radix-ui/react-icons";import{Flex as ki,Heading as Si,IconButton as Di,Text as Io,Tooltip as Ai}from"@radix-ui/themes";import{Fragment as Bi,jsx as $,jsxs as vr}from"react/jsx-runtime";var Ii=[["/home","Home","/home","Home"],["/settings/account","Settings","/settings/account","Account"],["/settings/linked","Settings","/settings/account","Linked Account"],["/settings","Settings","/settings/account","Settings"]];function Pi(e,r,t){let o=r.split("/"),n=e.split("/");return(t?n.length!==o.length:n.length<o.length)?!1:o.every((a,i)=>a.startsWith(":")?n[i]!=="":a===n[i])}function Ei(e,r){let t=r.find(([i,,,,l])=>Pi(e,i,l));if(!t)return{section:"Home",sectionHref:"/home",page:"Home"};let[,o,n,a]=t;return{section:o,sectionHref:n,page:a}}function Ni({onSearchOpen:e,onMenuOpen:r,showMenu:t,titles:o=Ii}){let n=wi().pathname;return vr("header",{style:{height:hr,background:"var(--accent-9)",borderBottom:"1px solid var(--border-hairline)",flexShrink:0,display:"flex",alignItems:"center",padding:"0 var(--space-6)",gap:"var(--space-4)"},children:[t&&$(Di,{variant:"ghost",size:"1",onClick:r,"aria-label":"Open navigation",style:{marginRight:"var(--space-1)",color:"var(--shell-ink-strong)"},children:$(Ci,{style:v("--space-4")})}),(()=>{let{section:a,sectionHref:i,page:l}=Ei(n,o);return vr(ki,{align:"baseline",gap:"2",style:{minWidth:0,overflow:"hidden"},children:[a!==l&&vr(Bi,{children:[$(Io,{asChild:!0,size:"3",weight:"regular",children:$(_i,{to:i,style:{color:"var(--shell-ink-mid)",whiteSpace:"nowrap",textDecoration:"none",overflow:"hidden",textOverflow:"ellipsis",flexShrink:0},className:"topbar-breadcrumb-link",children:a})}),$(Io,{size:"3",weight:"regular",className:"topbar-breadcrumb-sep",style:{color:"var(--shell-ink-mid)",flexShrink:0},children:"/"})]}),$(Si,{as:"h1",size:O.h1,weight:"medium",style:{color:"var(--shell-ink-strong)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:l})]})})(),$("div",{style:{flex:1}}),vr("button",{className:"topbar-search",onClick:e,"aria-label":"Search (\u2318K)",children:[$(Ti,{width:16,height:16,style:{color:"var(--shell-ink-strong)",flexShrink:0}}),$("span",{className:"topbar-search-placeholder",children:"Search for something"})]}),$(Ai,{content:"Coming soon",children:$("span",{children:$("button",{className:"topbar-icon-circle","aria-label":"Notifications (coming soon)",disabled:!0,children:$(Ri,{style:v("--space-4")})})})})]})}import{useEffect as Po,useRef as Eo,useState as ct}from"react";import{Dialog as dt,Flex as No,Spinner as zi,Text as te,TextField as Li,VisuallyHidden as Mi}from"@radix-ui/themes";import{CalendarIcon as Fi,MagnifyingGlassIcon as Oi,PersonIcon as Hi,ReaderIcon as $i}from"@radix-ui/react-icons";import{Fragment as Ki,jsx as C,jsxs as Y}from"react/jsx-runtime";var Wi={app:Fi,people:Hi,page:$i},Ui={app:"Apps",people:"People",page:"Pages"};function Vi(e){let r=["app","people","page"],t=[],o=0;for(let n of r){let a=e.filter(i=>i.type===n);a.length>0&&(t.push({type:n,label:Ui[n],items:a,startIdx:o}),o+=a.length)}return t}function Gi({open:e,onClose:r,results:t,onSelectResult:o,title:n="Search",placeholder:a="Search\u2026"}){return C(dt.Root,{open:e,onOpenChange:i=>!i&&r(),children:C(dt.Content,{"aria-describedby":void 0,style:{padding:0,maxWidth:"calc(9 * var(--space-9) + var(--space-2))",overflow:"hidden",boxShadow:"0 4px 8px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.10), 0 0 0 1px var(--gray-5)"},children:C(ji,{onClose:r,resultPool:t,onSelectResult:o,title:n,placeholder:a})})})}function ji({onClose:e,resultPool:r,onSelectResult:t,title:o,placeholder:n}){let[a,i]=ct(""),[l,s]=ct(null),[c,g]=ct(-1),p=Eo(null),u=Eo(null),y=!!l&&l.q===a,h=y?l.items:[],x=a.trim()?y?h.length?"results":"no-match":"searching":"prompt";Po(()=>{if(!a.trim())return;let T=setTimeout(()=>{let B=a.toLowerCase(),J=r.filter(U=>U.title.toLowerCase().includes(B)||U.subtitle.toLowerCase().includes(B));s({q:a,items:J}),g(-1)},320);return()=>clearTimeout(T)},[a,r]),Po(()=>{if(c<0||!u.current)return;u.current.querySelector(`[data-idx="${c}"]`)?.scrollIntoView({block:"nearest"})},[c]);function w(T){T.key==="Escape"?e():T.key==="ArrowDown"?(T.preventDefault(),g(B=>Math.min(B+1,h.length-1))):T.key==="ArrowUp"?(T.preventDefault(),g(B=>Math.max(B-1,0))):T.key==="Enter"&&(T.preventDefault(),c>=0&&h[c]&&(t(h[c]),e()))}function I(T){t(T),e()}let Z=Vi(h),se="calc(2 * var(--space-9) + var(--space-6))";return Y(Ki,{children:[C(Mi,{children:C(dt.Title,{children:o})}),Y("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-3) var(--space-4)",borderBottom:"1px solid var(--gray-5)"},children:[x==="searching"?C(zi,{size:"1",style:{flexShrink:0}}):C(Oi,{width:16,height:16,style:{color:"var(--gray-9)",flexShrink:0}}),C(Li.Root,{ref:p,autoFocus:!0,type:"text",placeholder:n,value:a,onChange:T=>i(T.target.value),onKeyDown:w,className:"search-overlay-input",style:{flex:1,border:"none",outline:"none",background:"transparent",boxShadow:"none","--text-field-selection-color":"unset"}}),C("kbd",{style:{color:"var(--gray-11)",background:"var(--gray-3)",border:"1px solid var(--gray-5)",borderRadius:"var(--radius-1)",padding:"var(--space-1) var(--space-2)",flexShrink:0},children:C(te,{size:"1",as:"span",children:"Esc"})})]}),Y("div",{ref:u,style:{minHeight:se,maxHeight:"calc(6 * var(--space-9) + var(--space-7))",overflowY:"auto"},children:[x==="prompt"&&C(No,{align:"center",justify:"center",style:{height:se},children:C(te,{size:"2",color:"gray",children:"Type to search\u2026"})}),x==="no-match"&&C(No,{align:"center",justify:"center",style:{height:se},children:Y("div",{style:{textAlign:"center"},children:[Y(te,{size:"2",color:"gray",as:"p",children:["No results for \u201C",a,"\u201D"]}),C(te,{size:"1",color:"gray",as:"p",mt:"1",children:"Try searching with different keywords"})]})}),x==="results"&&C("div",{style:{padding:"var(--space-2)"},children:Z.map(T=>{let B=Wi[T.type];return Y("div",{style:{marginBottom:"var(--space-1)"},children:[C("div",{style:{padding:"var(--space-2) var(--space-3) var(--space-1)",display:"flex",alignItems:"center",gap:"var(--space-2)"},children:C(te,{size:"1",style:{color:"var(--gray-11)",fontWeight:500,letterSpacing:"0.04em",textTransform:"uppercase",fontFamily:"var(--font-poppins)"},children:T.label})}),T.items.map((J,U)=>{let f=T.startIdx+U,L=c===f;return Y("button",{"data-idx":f,onClick:()=>I(J),onMouseEnter:()=>g(f),className:"search-result-item",style:{width:"100%",display:"flex",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-2) var(--space-3)",borderRadius:"var(--radius-2)",border:"none",cursor:"pointer",textAlign:"left",background:L?"var(--gray-3)":"transparent"},children:[C("div",{style:{width:"var(--space-6)",height:"var(--space-6)",borderRadius:"var(--radius-1)",background:L?"var(--accent-a3)":"var(--gray-3)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"background 100ms ease"},children:C(B,{width:12,height:12,style:{color:L?"var(--accent-11)":"var(--gray-9)"}})}),Y("div",{style:{flex:1,minWidth:0},children:[C(te,{as:"p",size:"2",weight:"medium",style:{color:L?"var(--gray-12)":"var(--gray-11)",lineHeight:1.3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:J.title}),C(te,{as:"p",size:"1",style:{color:"var(--gray-11)",lineHeight:1.3,marginTop:"1px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:J.subtitle})]}),L&&C("kbd",{style:{color:"var(--gray-9)",background:"var(--gray-4)",border:"1px solid var(--gray-5)",borderRadius:"var(--radius-1)",padding:"var(--space-1)",flexShrink:0},children:C(te,{size:"1",as:"span",className:"data-mono",children:"\u21B5"})})]},J.id)})]},T.type)})})]}),x!=="prompt"&&Y("div",{style:{borderTop:"1px solid var(--gray-4)",padding:"var(--space-2) var(--space-4)",display:"flex",gap:"var(--space-4)"},children:[Y(te,{as:"span",size:"1",color:"gray",children:[C("kbd",{className:"data-mono",children:"\u2191\u2193"})," navigate"]}),Y(te,{as:"span",size:"1",color:"gray",children:[C("kbd",{className:"data-mono",children:"\u21B5"})," open"]}),Y(te,{as:"span",size:"1",color:"gray",children:[C("kbd",{className:"data-mono",children:"Esc"})," close"]})]})]})}function q(e,r){for(let t of e){let o=t.calendars.find(n=>n.id===r);if(o)return{account:t,calendar:o}}}import pt from"dayjs";import{Flex as Bo,Text as zo}from"@radix-ui/themes";import{jsx as gt,jsxs as Yi}from"react/jsx-runtime";function ut({date:e,today:r=new Date}){let t=pt(e).isSame(r,"day");return Yi(Bo,{direction:"column",align:"center",gap:"1",py:"1",children:[gt(zo,{size:"1",weight:"medium",color:"gray",style:{letterSpacing:"0.04em"},children:pt(e).format("ddd").toUpperCase()}),gt(Bo,{align:"center",justify:"center",style:{width:"var(--space-6)",height:"var(--space-6)",borderRadius:"50%",background:t?"var(--accent-9)":"transparent",lineHeight:1},children:gt(zo,{size:"3",weight:t?"medium":"regular",style:{color:t?"var(--accent-contrast)":"var(--gray-12)",lineHeight:1},children:pt(e).format("D")})})]})}import{Box as qe,Checkbox as qi,Flex as Xi,RadioGroup as Lo,Text as Xe}from"@radix-ui/themes";import{jsx as N,jsxs as Fo}from"react/jsx-runtime";function Zi(e){return e.flatMap(r=>r.calendars.map(t=>({calendarId:t.id,calendarName:t.name,email:r.email,provider:r.provider})))}function Ji({provider:e}){return N("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--space-5)",height:"var(--space-5)",flexShrink:0},children:N(H,{provider:e})})}function Mo({row:e,control:r,selected:t,disabled:o,disabledLabel:n}){return Fo(Xe,{as:"label",size:"2",style:{display:"flex",alignItems:"center",gap:"var(--space-3)",width:"100%",paddingBlock:"var(--space-3)",paddingInline:"var(--space-4)",cursor:o?"not-allowed":"pointer",opacity:o?.45:1,background:t?"var(--accent-2)":"transparent",color:"var(--gray-12)"},children:[N(Ji,{provider:e.provider}),Fo(Xi,{direction:"column",gap:"0",style:{minWidth:0,flex:1},children:[N(Xe,{size:"2",weight:"medium",truncate:!0,style:{color:"var(--gray-12)"},children:e.calendarName}),N(Xe,{size:"1",color:"gray",truncate:!0,children:e.email})]}),n?N(Xe,{size:"1",color:"gray",style:{flexShrink:0},children:n}):null,N(qe,{style:{flexShrink:0,display:"flex",alignItems:"center"},children:r})]})}function Qi({accounts:e,mode:r,sourceCalendarIds:t,targetCalendarId:o,takenSourceIds:n,onToggleSource:a,onSelectTarget:i,fill:l=!1}){let s=Zi(e),g=r==="sources"&&s.length>0&&s.every(p=>p.calendarId===o||n.has(p.calendarId))?N(qe,{style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-3)",background:"var(--color-panel-solid)",padding:"var(--space-4)",...l?{flex:1,minHeight:0}:{}},children:N(Xe,{as:"p",size:"2",color:"gray",align:"center",children:"All your calendars are already used as sources in other syncs, or set as this sync's target. Remove a calendar from another sync to make it available here."})}):N(qe,{style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-3)",background:"var(--color-panel-solid)",...l?{flex:1,minHeight:0,overflowY:"auto"}:{overflow:"hidden"}},children:s.map((p,u)=>{if(r==="sources"){let x=p.calendarId===o,w=n.has(p.calendarId),I=x||w,Z=t.includes(p.calendarId);return N(qe,{style:{borderTop:u>0?"1px solid var(--gray-4)":void 0},children:N(Mo,{row:p,selected:Z,disabled:I,disabledLabel:x?"Target":w?"In use":void 0,control:N(qi,{checked:Z,disabled:I,onCheckedChange:()=>{I||a(p.calendarId)}})})},p.calendarId)}let y=t.includes(p.calendarId),h=p.calendarId===o;return N(qe,{style:{borderTop:u>0?"1px solid var(--gray-4)":void 0},children:N(Mo,{row:p,selected:h,disabled:y,disabledLabel:y?"Source":void 0,control:N(Lo.Item,{value:p.calendarId,disabled:y})})},p.calendarId)})});return r==="target"?N(Lo.Root,{value:o??"",onValueChange:p=>{p&&i(p)},style:l?{flex:1,minHeight:0,display:"flex",flexDirection:"column"}:void 0,children:g}):g}import{Button as Oo,Flex as mt,Heading as es,IconButton as Ho}from"@radix-ui/themes";import{ChevronLeftIcon as rs,ChevronRightIcon as ts}from"@radix-ui/react-icons";import{Navigate as ft}from"react-big-calendar";import{jsx as ve,jsxs as $o}from"react/jsx-runtime";function ht({label:e,view:r,onNavigate:t,onView:o}){return $o(mt,{align:"center",justify:"between",gap:"3",wrap:"wrap",className:"calendar-toolbar",children:[$o(mt,{align:"center",gap:"2",children:[ve(Ho,{size:"2",variant:"soft",color:"gray",radius:"full","aria-label":"Previous",onClick:()=>t(ft.PREVIOUS),children:ve(rs,{})}),ve(Oo,{size:"2",variant:"soft",color:"gray",onClick:()=>t(ft.TODAY),children:"Today"}),ve(Ho,{size:"2",variant:"soft",color:"gray",radius:"full","aria-label":"Next",onClick:()=>t(ft.NEXT),children:ve(ts,{})})]}),ve(es,{as:"h2",size:O.h2,weight:"medium",style:{color:"var(--gray-12)"},children:e}),ve(mt,{gap:"1",style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-3)",padding:"var(--space-1)",background:"var(--gray-2)"},children:["week","month"].map(n=>ve(Oo,{size:"2",variant:r===n?"solid":"soft",className:r===n?"btn-amber-primary":void 0,color:r===n?void 0:"gray",onClick:()=>o(n),style:r===n?void 0:{background:"transparent"},children:n==="week"?"Week":"Month"},n))})]})}import{Button as os,Flex as yr,Spinner as as,Text as vt}from"@radix-ui/themes";import{ChevronRightIcon as ns,ExclamationTriangleIcon as is}from"@radix-ui/react-icons";import{jsx as oe,jsxs as Ze}from"react/jsx-runtime";var Me={google:{label:"Google Calendar",description:"Connect a Google account calendar"},microsoft:{label:"Outlook Calendar",description:"Connect an Outlook account calendar"}},ss=["google","microsoft"];function yt({connectingProvider:e,failedProvider:r,exhausted:t=!1,onConnect:o}){return oe(yr,{direction:"column",gap:"3",style:{width:"100%",textAlign:"left"},children:ss.map(n=>{let a=Me[n],i=e===n;return Ze("div",{children:[Ze("button",{type:"button",className:"provider-choice",onClick:()=>o(n),disabled:e!==null,"data-connecting":i?"true":void 0,"aria-busy":i||void 0,"aria-label":`Connect ${a.label}`,children:[oe(E,{children:oe(H,{provider:n})}),Ze(yr,{direction:"column",className:"provider-choice__copy",gap:"1",children:[oe(vt,{size:"3",weight:"medium",truncate:!0,style:{color:"var(--gray-12)"},children:a.label}),oe(vt,{size:"2",color:"gray",truncate:!0,children:a.description})]}),oe("span",{className:"provider-choice__chevron","aria-hidden":!0,children:i?oe(as,{size:"2"}):oe(ns,{style:v("--space-5")})})]}),r===n&&Ze(yr,{align:"center",justify:"between",gap:"3",mt:"2",px:"1",children:[Ze(yr,{align:"center",gap:"2",children:[oe(is,{style:{...v("--space-4"),color:"var(--red-9)",flexShrink:0}}),oe(vt,{size:"2",style:{color:"var(--red-11)"},children:t?`No more ${a.label} accounts available to connect.`:`Couldn't connect ${a.label}. Please try again.`})]}),!t&&oe(os,{variant:"ghost",size:"1",onClick:()=>o(n),children:"Retry"})]})]},n)})})}import{Badge as Wo,Box as ls,DropdownMenu as Je,Flex as Uo,IconButton as cs,Text as Vo}from"@radix-ui/themes";import{DotsVerticalIcon as ds,ReloadIcon as ps,TrashIcon as gs}from"@radix-ui/react-icons";import{jsx as X,jsxs as Re}from"react/jsx-runtime";function us({account:e,onRemove:r,onReconnect:t,onClick:o}){let n=e.auth_status==="reauth",a=e.auth_status==="failed",i=X(Vo,{size:"2",weight:"medium",truncate:!0,style:{color:"var(--gray-12)"},children:e.display_name});return Re(ls,{onClick:o,style:{width:"100%",minWidth:0,height:b.connected_account_card_h,boxSizing:"border-box",padding:"var(--space-3)",background:"var(--color-panel-solid)",border:"1px solid var(--gray-5)",borderRadius:"var(--radius-3)",display:"flex",alignItems:"center",gap:"var(--space-3)",cursor:o?"pointer":void 0},children:[X(E,{size:"var(--space-6)",children:X(H,{provider:e.provider})}),Re(Uo,{direction:"column",style:{flex:1,minWidth:0},children:[Re(Uo,{align:"center",gap:"2",style:{minWidth:0},children:[o?X("button",{type:"button",className:"card-title-button",onClick:l=>{l.stopPropagation(),o()},children:i}):i,n&&X(Wo,{color:"amber",variant:"soft",size:"1",radius:"full",style:{flexShrink:0},children:"Needs reconnect"}),a&&X(Wo,{color:"red",variant:"soft",size:"1",radius:"full",style:{flexShrink:0},children:"Connection failed"})]}),X(Vo,{size:"1",color:"gray",truncate:!0,children:e.email})]}),Re(Je.Root,{children:[X(Je.Trigger,{children:X(cs,{variant:"ghost",color:"gray",size:"1","aria-label":`${e.display_name} actions`,onClick:l=>l.stopPropagation(),children:X(ds,{})})}),Re(Je.Content,{align:"end",onClick:l=>l.stopPropagation(),children:[(n||a)&&t&&Re(Je.Item,{onSelect:t,children:[X(ps,{})," Reconnect"]}),Re(Je.Item,{color:"red",onSelect:r,children:[X(gs,{})," Remove account"]})]})]})]})}import{Flex as ms,Text as fs,Heading as hs}from"@radix-ui/themes";import{jsx as bt,jsxs as ys}from"react/jsx-runtime";function vs({icon:e,title:r,description:t,action:o,headingAs:n="h2"}){return ys(ms,{direction:"column",align:"center",gap:"3",style:{width:"100%",paddingTop:"var(--space-9)",textAlign:"center"},children:[bt(E,{size:"var(--space-8)",children:e}),bt(hs,{as:n,size:O[n],weight:"medium",align:"center",children:r}),t&&bt(fs,{size:"2",color:"gray",align:"center",style:{maxWidth:b.empty_state_copy_max},children:t}),o]})}import{useState as bs}from"react";import{Dialog as Qe,Flex as xs,Text as br,Checkbox as _s,Button as Go}from"@radix-ui/themes";import{Fragment as Cs,jsx as W,jsxs as xt}from"react/jsx-runtime";function ke({account:e,onOpenChange:r,onImport:t,initiallySelectedIds:o,disabledIds:n,disabledReason:a,title:i="Calendars",description:l="Choose which calendars you want to import.",confirmLabel:s="Import Calendars"}){let c=e?`${e.id}:${(o??e.calendars.map(g=>g.id)).join(",")}`:"closed";return W(Qe.Root,{open:!!e,onOpenChange:r,children:W(Qe.Content,{maxWidth:b.dialog_md,onInteractOutside:g=>g.preventDefault(),children:e&&W(ws,{account:e,initiallySelectedIds:o,disabledIds:n,disabledReason:a,title:i,description:l,confirmLabel:s,onImport:t},c)})})}function ws({account:e,initiallySelectedIds:r,disabledIds:t,disabledReason:o,title:n,description:a,confirmLabel:i,onImport:l}){let[s,c]=bs(()=>new Set(r??e.calendars.map(u=>u.id))),g=new Set(t??[]);function p(u){g.has(u)||c(y=>{let h=new Set(y);return h.has(u)?h.delete(u):h.add(u),h})}return xt(Cs,{children:[W(Qe.Title,{size:"5",weight:"medium",mb:"1",children:n}),W(Qe.Description,{size:"2",color:"gray",mb:"2",children:a}),W(br,{as:"p",size:"2",weight:"medium",mb:"5",style:{color:"var(--gray-12)"},children:e.email}),W(xs,{direction:"column",gap:"3",mb:"5",children:e.calendars.map(u=>{let y=s.has(u.id),h=g.has(u.id);return xt(br,{as:"label",size:"3",className:"calendar-picker-row","data-selected":y||void 0,"data-disabled":h?"true":void 0,style:{display:"flex",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-4)",cursor:h?"default":"pointer"},children:[W(_s,{checked:y,disabled:h,onCheckedChange:()=>p(u.id)}),W(br,{weight:"medium",truncate:!0,style:{flex:1,minWidth:0,color:"var(--gray-12)"},children:u.name}),h&&o&&W(br,{size:"1",color:"gray",style:{flexShrink:0},children:o})]},u.id)})}),xt(ee,{justify:"between",noTopMargin:!0,pad:"var(--space-5)",radius:"var(--radius-4)",children:[W(Qe.Close,{children:W(Go,{size:"2",variant:"outline",color:"gray",children:"Cancel"})}),W(Go,{size:"2",className:"btn-amber-primary",disabled:s.size===0,onClick:()=>l(Array.from(s)),children:i})]})]})}import{Box as er,Flex as Ts,Text as ae}from"@radix-ui/themes";import{jsx as z,jsxs as xr}from"react/jsx-runtime";function Rs(e){let r=/^#?([0-9a-f]{6})$/i.exec(e.trim());if(!r)return"white";let t=parseInt(r[1],16),o=a=>{let i=a/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)};return .2126*o(t>>16&255)+.7152*o(t>>8&255)+.0722*o(t&255)>.45?"black":"white"}function jo({tone:e,title:r,meta:t,accentColor:o}){let n=e==="synced"?o||"var(--accent-9)":"var(--blue-11)",a=e==="synced"?o?Rs(o):"var(--accent-contrast)":"white";return xr(er,{style:{background:n,borderRadius:"var(--radius-2)",padding:"var(--space-2) var(--space-3)"},children:[z(ae,{as:"p",size:"2",weight:"medium",style:{color:a},children:r}),t?z(ae,{as:"p",size:"1",style:{color:a},children:t}):null]})}var ks="Busy",Ss={title:"Gym",time:"10:00 AM",location:"Flex Gym on 16th Ave",description:"Workout notes"};function Ds({hasSources:e,hasTarget:r,sourceLabel:t,targetLabel:o,showTitle:n,showDescription:a,showLocation:i,tagLabel:l,accentColor:s,sampleEvent:c=Ss}){let g=c.title,p=[c.time,c.location].filter(Boolean).join(" \xB7 "),u=l?.trim()||ks,y=n?`${c.title} - (${u})`:u,h=[c.time].filter(Boolean);i&&c.location&&h.push(c.location),a&&c.description&&h.push(c.description);let x=h.join(" \xB7 ");return xr(Ts,{direction:"column",gap:"4",style:{padding:"var(--space-4)"},children:[z(ae,{as:"p",className:"ds-section-label",style:{textAlign:"center"},children:"Sync Preview"}),z(ae,{as:"p",size:"1",color:"gray",style:{textAlign:"center",marginTop:"calc(-1 * var(--space-2))"},children:"Example event \u2014 not from your calendars."}),xr(er,{children:[z(ae,{as:"p",size:"1",color:"gray",mb:"1",children:"Sources"}),z(ae,{as:"p",size:"1",weight:"medium",mb:"2",truncate:!0,style:{color:"var(--gray-12)"},children:e?t||"Selected sources":"\u2014"}),z(er,{style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-2)",padding:"var(--space-2)",background:"var(--gray-2)"},children:z(jo,{tone:"source",title:g,meta:p})})]}),xr(er,{children:[z(ae,{as:"p",size:"1",color:"gray",mb:"1",children:"Target"}),z(ae,{as:"p",size:"1",weight:"medium",mb:"2",truncate:!0,style:{color:"var(--gray-12)"},children:r?o||"Selected target":"\u2014"}),z(er,{style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-2)",padding:"var(--space-2)",background:"var(--gray-2)"},children:r?z(jo,{tone:"synced",title:y,meta:x,...s?{accentColor:s}:{}}):z(ae,{as:"p",size:"2",color:"gray",children:"Pick one target calendar"})})]}),!e||!r?z(ae,{as:"p",size:"1",color:"gray",style:{textAlign:"center"},children:"Select one or more sources, then one target"}):z(ae,{as:"p",size:"1",color:"gray",style:{textAlign:"center"},children:"Only the highlighted block is posted to the target"})]})}import{Flex as _t,Text as wt}from"@radix-ui/themes";import{CheckIcon as As}from"@radix-ui/react-icons";import{jsx as Fe,jsxs as Ko}from"react/jsx-runtime";function Ct({steps:e,current:r}){return Fe("div",{role:"list","aria-label":"Wizard progress",style:{display:"flex",flexWrap:"wrap",width:"100%",flexShrink:0,marginBottom:0,border:"1px solid var(--gray-5)",borderRadius:"var(--radius-4)",background:"var(--color-panel-solid)",overflow:"hidden"},children:e.map((t,o)=>{let n=o+1,a=n===r,i=n<r;return Ko(_t,{align:"start",gap:"3",role:"listitem","aria-current":a?"step":void 0,style:{flex:"1 1 calc(3 * var(--space-9) + var(--space-6))",minWidth:"calc(3 * var(--space-9) + var(--space-6))",paddingTop:"var(--space-4)",paddingBottom:"var(--space-4)",paddingLeft:"var(--space-4)",paddingRight:"var(--space-4)",marginBottom:"-1px",borderBottom:a?"2px solid var(--accent-9)":"2px solid transparent"},children:[Fe(_t,{align:"center",justify:"center",style:{width:"var(--space-6)",height:"var(--space-6)",borderRadius:"50%",flexShrink:0,marginTop:"var(--space-1)",background:i?"var(--green-9)":a?"var(--accent-9)":"var(--gray-3)",color:i?"white":a?"var(--accent-contrast)":"var(--gray-11)"},children:i?Fe(As,{style:v("--space-3")}):Fe(wt,{size:"1",weight:"medium",children:t.n})}),Ko(_t,{direction:"column",gap:"1",style:{minWidth:0,flex:1,paddingTop:"var(--space-1)"},children:[Fe(wt,{size:"2",weight:"medium",style:{color:a||i?"var(--gray-12)":"var(--gray-10)",lineHeight:"var(--line-height-2)"},children:t.title}),Fe(wt,{size:"1",color:"gray",style:{lineHeight:"var(--line-height-1)"},children:t.description})]})]},t.n)})})}import{jsx as qo}from"react/jsx-runtime";var Is=[{n:"01",title:"Connect",description:"Connect your calendar account"},{n:"02",title:"Calendars",description:"Import at least 2 calendars"},{n:"03",title:"Sync",description:"Set up your first sync"}];function Yo({current:e}){return qo(Ct,{steps:Is,current:e})}function Ps({current:e,total:r=3}){return qo(Yo,{current:e})}import Tt from"dayjs";import{Flex as Xo,Grid as Zo,IconButton as Jo,Text as Qo}from"@radix-ui/themes";import{ChevronLeftIcon as Es,ChevronRightIcon as Ns}from"@radix-ui/react-icons";import{jsx as fe,jsxs as Rt}from"react/jsx-runtime";var Bs=["S","M","T","W","T","F","S"];function kt({cursor:e,onSelect:r,today:t=new Date}){let o=Tt(e).startOf("month"),n=o.startOf("week"),a=Array.from({length:42},(i,l)=>n.add(l,"day"));return Rt("div",{children:[Rt(Xo,{align:"center",justify:"between",mb:"2",children:[fe(Qo,{size:"2",weight:"medium",style:{color:"var(--gray-12)"},children:o.format("MMMM YYYY")}),Rt(Xo,{gap:"1",children:[fe(Jo,{size:"1",variant:"ghost",color:"gray","aria-label":"Previous month",onClick:()=>r(Tt(e).subtract(1,"month").toDate()),children:fe(Es,{})}),fe(Jo,{size:"1",variant:"ghost",color:"gray","aria-label":"Next month",onClick:()=>r(Tt(e).add(1,"month").toDate()),children:fe(Ns,{})})]})]}),fe(Zo,{columns:"7",gap:"1",mb:"1",children:Bs.map((i,l)=>fe(Qo,{size:"1",color:"gray",align:"center",children:i},l))}),fe(Zo,{columns:"7",gap:"1",justify:"center",align:"center",style:{justifyItems:"center"},children:a.map(i=>{let l=i.isSame(t,"day"),s=i.isSame(e,"day"),c=!i.isSame(o,"month");return fe("button",{type:"button",onClick:()=>r(i.toDate()),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--space-5)",height:"var(--space-5)",boxSizing:"border-box",flexShrink:0,padding:0,borderRadius:"50%",border:l&&!s?"1.5px solid var(--accent-9)":"none",cursor:"pointer",background:s?"var(--accent-9)":"transparent",color:s?"var(--accent-contrast)":c?"var(--gray-11)":l?"var(--accent-11)":"var(--gray-12)",fontWeight:l||s?500:400,fontSize:"var(--font-size-1)",fontFamily:"var(--font-poppins)"},children:i.format("D")},i.format("YYYY-MM-DD"))})})]})}import{useState as zs}from"react";import{Dialog as rr,Flex as tr,Text as _r,Button as St,IconButton as Ls,Badge as ea,Separator as Ms,Box as ra}from"@radix-ui/themes";import{Cross2Icon as Fs,PlusIcon as Os,ReloadIcon as Hs}from"@radix-ui/react-icons";import{Fragment as ta,jsx as D,jsxs as ne}from"react/jsx-runtime";function $s({account:e,catalog:r,onOpenChange:t,onRemoveCalendar:o,onSaveCalendars:n,onReconnect:a}){let[i,l]=zs(!1),s=e?.auth_status==="reauth",c=e?.auth_status==="failed";function g(p){if(!e||!r)return;let u=new Set(p);n(e,r.calendars.filter(y=>u.has(y.id))),l(!1)}return ne(ta,{children:[D(rr.Root,{open:!!e&&!i,onOpenChange:p=>{p||t(!1)},children:D(rr.Content,{maxWidth:b.dialog_md,children:e&&ne(ta,{children:[ne(tr,{align:"center",gap:"3",mb:"1",children:[D(E,{size:"var(--space-6)",children:D(H,{provider:e.provider})}),ne(ra,{style:{minWidth:0,flex:1},children:[ne(tr,{align:"center",gap:"2",mb:"1",style:{minWidth:0},children:[D(rr.Title,{size:"4",weight:"medium",mb:"0",truncate:!0,style:{minWidth:0},children:e.display_name}),s&&D(ea,{color:"amber",variant:"soft",size:"1",radius:"full",style:{flexShrink:0},children:"Needs reconnect"}),c&&D(ea,{color:"red",variant:"soft",size:"1",radius:"full",style:{flexShrink:0},children:"Connection failed"})]}),D(rr.Description,{size:"2",color:"gray",mb:"0",children:e.email})]})]}),(s||c)&&a&&ne(St,{size:"2",variant:"soft",color:c?"red":"amber",mt:"3",onClick:()=>a(e.id),children:[D(Hs,{}),"Reconnect"]}),D(Ms,{size:"4",my:"4"}),ne(tr,{align:"center",justify:"between",gap:"3",mb:"3",children:[D(_r,{as:"p",className:"ds-section-label",mb:"0",children:"Calendars"}),r&&r.calendars.length>0&&ne(St,{size:"1",variant:"soft",color:"gray",onClick:()=>l(!0),children:[D(Os,{style:v("--space-3")}),"Change calendars"]})]}),D(tr,{direction:"column",style:{border:"1px solid var(--gray-5)",borderRadius:"var(--radius-3)",overflow:"hidden",background:"var(--color-panel-solid)"},children:e.calendars.length===0?D(_r,{size:"2",color:"gray",style:{padding:"var(--space-4)"},children:"No calendars imported."}):e.calendars.map((p,u)=>ne(tr,{align:"center",gap:"3",className:"data-table-row",style:{padding:"var(--space-3) var(--space-4)",minHeight:"var(--space-7)",borderTop:u>0?"1px solid var(--gray-4)":void 0},children:[D(ra,{"aria-hidden":!0,style:{width:"var(--space-2)",height:"var(--space-2)",borderRadius:"50%",background:p.color_token,flexShrink:0}}),ne(_r,{size:"2",truncate:!0,style:{flex:1,minWidth:0,color:"var(--gray-12)"},children:[p.name,p.is_primary&&ne(_r,{size:"1",color:"gray",children:[" ","\xB7 Primary"]})]}),D(Ls,{variant:"ghost",color:"gray",size:"1","aria-label":`Remove ${p.name}`,onClick:()=>o(e,p),children:D(Fs,{})})]},p.id))}),D(ee,{justify:"end",children:D(rr.Close,{children:D(St,{size:"2",variant:"soft",color:"gray",children:"Close"})})})]})})}),D(ke,{account:i&&r?r:null,initiallySelectedIds:e?.calendars.map(p=>p.id),title:"Change calendars",description:"Choose which calendars to keep on this account.",confirmLabel:"Save calendars",onOpenChange:p=>{p||l(!1)},onImport:g})]})}import{useMemo as Ws}from"react";import Tr from"dayjs";import{Calendar as Us,dayjsLocalizer as Vs,Views as or}from"react-big-calendar";import"react-big-calendar/lib/css/react-big-calendar.css";import{Text as wr}from"@radix-ui/themes";import{jsx as Oe,jsxs as Cr}from"react/jsx-runtime";var Gs=Vs(Tr),js=new Date(1970,0,1,8,0,0);function Dt({blocks:e,view:r,onViewChange:t,date:o,onNavigate:n,accounts:a,today:i=new Date}){let l=Ws(()=>e.map(s=>{let c=new Date(s.date);c.setHours(s.start_hour,s.start_minute,0,0);let g=new Date(s.date);return g.setHours(s.end_hour,s.end_minute,0,0),{id:s.id,title:s.title,start:c,end:g,resource:s}}),[e]);return Oe("div",{className:"rbc-radix-scope",style:{height:"100%",containerType:"inline-size"},children:Oe(Us,{localizer:Gs,events:l,view:r==="week"?or.WEEK:or.MONTH,onView:s=>t(s===or.MONTH?"month":"week"),date:o,onNavigate:n,views:[or.WEEK,or.MONTH],toolbar:!0,popup:!0,scrollToTime:js,enableAutoScroll:!0,getNow:()=>i,tooltipAccessor:null,eventPropGetter:s=>{let g=q(a,s.resource.calendar_id)?.calendar.color_token??"var(--gray-8)";return r==="month"?{style:{background:"transparent",border:"none",boxShadow:"none"}}:{style:{backgroundColor:g,border:"none"}}},components:{toolbar:ht,week:{header:s=>Oe(ut,{...s,today:i}),event:({event:s})=>{let c=(s.end.getTime()-s.start.getTime())/6e4,g=c>=60,p=c>=30;return Cr("div",{children:[Oe(wr,{size:"1",weight:"medium",style:{color:"white",display:"block"},truncate:!0,children:s.title}),p&&Cr(wr,{size:"1",style:{color:"rgba(255,255,255,0.85)",display:"block"},truncate:!0,children:[Tr(s.start).format("h:mm A")," \u2013 ",Tr(s.end).format("h:mm A")]}),g&&s.resource.location&&Oe(wr,{size:"1",style:{color:"rgba(255,255,255,0.85)",display:"block"},truncate:!0,children:s.resource.location})]})}},month:{event:({event:s})=>{let g=q(a,s.resource.calendar_id)?.calendar.color_token??"var(--gray-8)";return Cr(wr,{size:"1",style:{display:"flex",alignItems:"center",gap:"var(--space-1)",color:"var(--gray-12)",background:`color-mix(in srgb, ${g} 28%, transparent)`,borderRadius:"var(--radius-2)",padding:"var(--space-1) var(--space-2)"},truncate:!0,children:[Oe("span",{"aria-hidden":!0,style:{width:"var(--space-2)",height:"var(--space-2)",borderRadius:"50%",background:g,flexShrink:0}}),Cr("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[Tr(s.start).format("H:mm")," ",s.title]})]})}}}})})}import{Dialog as ar,Flex as Se,Text as De,Button as oa,Separator as Ks,Badge as Ys}from"@radix-ui/themes";import{Fragment as Xs,jsx as R,jsxs as be}from"react/jsx-runtime";var aa={synced:{label:"Synced",color:"green"},syncing:{label:"Syncing\u2026",color:"amber"},error:{label:"Error",color:"red"}};function qs({sync:e,accounts:r,onOpenChange:t,onEdit:o}){let n=e?(()=>{let a=e.source_calendar_ids.map(l=>q(r,l)?.calendar.name).filter(l=>!!l),i=q(r,e.target_calendar_id)?.calendar.name??"\u2014";return`${a.join(", ")||"\u2014"} \u2192 ${i}`})():"";return R(ar.Root,{open:!!e,onOpenChange:t,children:R(ar.Content,{maxWidth:b.dialog_md,children:e&&be(Xs,{children:[be(Se,{align:"center",justify:"between",mb:"1",children:[R(ar.Title,{size:"4",mb:"0",children:e.name}),R(Ys,{color:aa[e.status].color,variant:"soft",size:"1",radius:"full",children:aa[e.status].label})]}),R(ar.Description,{size:"2",color:"gray",mb:"4",children:"Sync configuration"}),be(Se,{direction:"column",gap:"3",children:[R(ye,{label:"Calendars",children:n}),R(ye,{label:"Sources",children:R(Se,{direction:"column",gap:"1",align:"end",children:e.source_calendar_ids.map(a=>{let i=q(r,a);return i?be(Se,{direction:"column",align:"end",children:[R(De,{size:"2",weight:"medium",style:{color:"var(--gray-12)"},children:i.calendar.name}),R(De,{size:"1",color:"gray",children:i.account.email})]},a):null})||"\u2014"})}),R(ye,{label:"Target",children:(()=>{let a=q(r,e.target_calendar_id);return a?be(Se,{direction:"column",align:"end",children:[R(De,{size:"2",weight:"medium",style:{color:"var(--gray-12)"},children:a.calendar.name}),R(De,{size:"1",color:"gray",children:a.account.email})]}):"\u2014"})()}),R(ye,{label:"Last synced",children:e.last_synced_label??"\u2014"})]}),R(Ks,{size:"4",my:"4"}),R(De,{as:"p",size:"1",weight:"medium",color:"gray",mb:"3",style:{letterSpacing:"0.04em"},children:"WHAT TO SHOW"}),be(Se,{direction:"column",gap:"3",children:[R(ye,{label:"Tag",children:e.tag_label?.trim()||"Busy"}),R(ye,{label:"Event titles",children:e.show_title?"Shown":"Hidden"}),R(ye,{label:"Event description",children:e.show_description?"Shown":"Hidden"}),R(ye,{label:"Event location",children:e.show_location?"Shown":"Hidden"})]}),be(ee,{justify:"between",children:[R(ar.Close,{children:R(oa,{size:"2",variant:"soft",color:"gray",children:"Close"})}),R(oa,{size:"2",className:"btn-amber-primary",onClick:()=>o(e.id),children:"Edit sync"})]})]})})})}function ye({label:e,children:r}){return be(Se,{align:"baseline",justify:"between",gap:"4",children:[R(De,{size:"2",color:"gray",style:{flexShrink:0},children:e}),R(De,{size:"2",weight:"medium",align:"right",style:{color:"var(--gray-12)"},children:r})]})}import{useState as Rr}from"react";function nr({accounts:e,connectProvider:r,onAccountAdded:t,onImported:o}){let[n,a]=Rr(null),[i,l]=Rr(null),[s,c]=Rr(null),[g,p]=Rr(!1);function u(h){if(n)return;c(null),p(!1),a(h);let x=e.map(w=>w.id);r(h,x).then(w=>{a(null),w?l(w):(c(h),p(!0))}).catch(()=>{a(null),c(h),p(!1)})}function y(h){if(!i)return;let x=new Set(h);t({...i,calendars:i.calendars.filter(w=>x.has(w.id))}),l(null),o?.()}return{connecting_provider:n,pending_account:i,failed_provider:s,exhausted:g,connect:u,confirm_import:y,cancel_import:()=>l(null),dismiss_error:()=>c(null)}}import{Box as Zs,DropdownMenu as kr,Button as Js,Flex as Qs,Text as na}from"@radix-ui/themes";import{PlusIcon as ia}from"@radix-ui/react-icons";import{Fragment as rl,jsx as ie,jsxs as He}from"react/jsx-runtime";function el({variant:e="button",trigger:r,accounts:t,connectProvider:o,onAccountAdded:n,onImported:a}){let{pending_account:i,failed_provider:l,exhausted:s,connect:c,confirm_import:g,cancel_import:p,dismiss_error:u}=nr({accounts:t,connectProvider:o,onAccountAdded:n,onImported:a}),y=["google","microsoft"],h=e==="tile"?He("button",{type:"button",className:"connect-account-tile","aria-label":"Connect Account",children:[ie(ia,{style:v("--space-4")}),"Connect Account"]}):He(Js,{size:"2",className:"btn-amber-primary",children:[ie(ia,{style:v("--space-4")}),"Connect Account"]}),x=He(kr.Root,{children:[ie(kr.Trigger,{children:r??h}),ie(kr.Content,{align:"start",style:{width:"max-content",minWidth:"max-content"},children:y.map(w=>{let I=Me[w];return He(kr.Item,{onSelect:()=>c(w),style:{height:"auto",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-2) var(--space-3)"},children:[ie(E,{size:"var(--space-6)",children:ie(H,{provider:w})}),He(Qs,{direction:"column",gap:"1",style:{flexShrink:0},children:[ie(na,{size:"2",weight:"medium",style:{color:"var(--gray-12)"},children:I.label}),ie(na,{size:"1",color:"gray",children:I.description})]})]},w)})})]});return He(rl,{children:[e==="tile"&&!r?ie(Zs,{style:{width:"100%",minWidth:0},children:x}):x,ie(ke,{account:i,onOpenChange:w=>!w&&p(),onImport:g}),l&&ie(Vr,{msg:s?`No more ${Me[l].label} accounts available to connect.`:`Couldn't connect ${Me[l].label}. Please try again.`,color:"red",onDone:u})]})}import{Card as tl,Flex as At,Text as ol,Heading as al}from"@radix-ui/themes";import{CalendarIcon as nl}from"@radix-ui/react-icons";import{jsx as xe,jsxs as sa}from"react/jsx-runtime";function il({accounts:e,connectProvider:r,onAccountAdded:t,onImported:o}){let{connecting_provider:n,pending_account:a,failed_provider:i,exhausted:l,connect:s,confirm_import:c,cancel_import:g}=nr({accounts:e,connectProvider:r,onAccountAdded:t,onImported:o});return sa(At,{direction:"column",align:"center",justify:"center",style:{width:"100%",flex:1,minHeight:0},children:[xe(tl,{style:{width:"100%",maxWidth:b.provider_chooser_max},children:sa(At,{direction:"column",align:"center",justify:"center",gap:"3",py:"6",px:"3",style:{width:"100%",textAlign:"center"},children:[xe(E,{children:xe(nl,{style:{...v("--space-5"),color:"var(--gray-7)"}})}),xe(al,{as:"h2",size:O.h2,weight:"medium",children:e.length>0?"Connect another account":"Connect your first account"}),xe(ol,{as:"p",size:"2",color:"gray",children:e.length>0?"Add another Google or Microsoft account, then choose which calendars to import.":"Connect a Google or Microsoft account to import calendars for sync."}),xe(At,{direction:"column",style:{width:"100%"},mt:"3",children:xe(yt,{connectingProvider:n,failedProvider:i,exhausted:l,onConnect:s})})]})}),xe(ke,{account:a,onOpenChange:p=>!p&&g(),onImport:c})]})}import{useEffect as sl,useMemo as It,useState as Sr}from"react";import{Link as ll}from"react-router-dom";import{Box as Pt,Checkbox as la,Flex as ir,Separator as Et,Text as Ae}from"@radix-ui/themes";import{ChevronDownIcon as cl,GearIcon as dl,HamburgerMenuIcon as pl}from"@radix-ui/react-icons";import{jsx as A,jsxs as he}from"react/jsx-runtime";function gl({accounts:e,view:r,setView:t,hideClones:o,setHideClones:n,mergedCalendarIds:a,visibleCalendarIds:i,toggleCalendarVisible:l,getVisibleBlocksInRange:s,manageAccountsHref:c,today:g=new Date}){let[p,u]=Sr(g),[y,h]=Sr(new Set),[x,w]=Sr(()=>typeof window<"u"&&window.innerWidth<900),[I,Z]=Sr(!1);sl(()=>{function f(){w(window.innerWidth<900)}return window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]);let se=It(()=>{let f=new Date(p);return f.setDate(f.getDate()-42),f},[p]),T=It(()=>{let f=new Date(p);return f.setDate(f.getDate()+42),f},[p]),B=s(se,T),J=It(()=>{let f=[],L=new Map;for(let V of a){let F=q(e,V);if(!F)continue;let Q=L.get(F.account.id);Q===void 0&&(Q=f.length,L.set(F.account.id,Q),f.push({accountId:F.account.id,calendarIds:[]})),f[Q].calendarIds.push(V)}return f},[a,e]);function U(f){h(L=>{let V=new Set(L);return V.has(f)?V.delete(f):V.add(f),V})}return he(ir,{gap:"5",align:"start",direction:x?"column":"row",flexGrow:"1",minHeight:"0",height:"100%",children:[(!x||I)&&he(Pt,{minWidth:x?void 0:b.sidebar_col_min,p:"4",maxHeight:"100%",style:{flex:x?"1 1 100%":`0 0 ${b.sidebar_col_basis}`,border:"1px solid var(--gray-5)",borderRadius:"var(--radius-4)",background:"var(--color-panel-solid)",boxShadow:"var(--shadow-card)",overflow:"auto"},children:[A(kt,{cursor:p,onSelect:u,today:g}),A(Et,{size:"4",my:"3"}),A(Ae,{as:"p",size:"1",weight:"medium",color:"gray",mb:"3",style:{letterSpacing:"0.04em"},children:"CALENDARS"}),A(ir,{direction:"column",gap:"1",mb:"4",children:J.map(({accountId:f,calendarIds:L},V)=>{let F=e.find(pe=>pe.id===f);if(!F)return null;let Q=y.has(f);return he("div",{style:{paddingTop:V>0?"var(--space-2)":void 0,borderTop:V>0?"1px solid var(--gray-3)":void 0},children:[he(ir,{align:"center",gap:"2",mb:"2",py:"1",className:"calendar-legend-account-row",style:{cursor:"pointer",borderRadius:"var(--radius-2)"},onClick:()=>U(f),children:[A(cl,{style:{...v("--space-3"),color:"var(--gray-9)",transform:Q?"rotate(-90deg)":void 0,transition:"transform 120ms ease",flexShrink:0}}),A(H,{provider:F.provider}),A(Ae,{size:"2",weight:"medium",truncate:!0,title:F.email,style:{color:"var(--gray-12)",minWidth:0},children:F.email})]}),!Q&&A(ir,{direction:"column",gap:"1",pl:"5",children:L.map(pe=>{let Pe=q(e,pe);return Pe?he(Ae,{as:"label",size:"2",className:"calendar-legend-row",style:{display:"flex",alignItems:"center",gap:"var(--space-2)",cursor:"pointer",borderRadius:"var(--radius-2)",padding:"var(--space-1) var(--space-2)",marginLeft:"calc(var(--space-2) * -1)"},children:[he(ir,{align:"center",gap:"1",children:[A(la,{checked:i.has(pe),onCheckedChange:()=>l(pe)}),A("span",{"aria-hidden":!0,style:{width:"var(--space-3)",height:"var(--space-3)",borderRadius:"50%",background:Pe.calendar.color_token,flexShrink:0}})]}),A(Ae,{size:"2",truncate:!0,style:{color:"var(--gray-12)"},title:Pe.calendar.name,children:Pe.calendar.name})]},pe):null})})]},f)})}),A(Et,{size:"4",mb:"3"}),he(Ae,{as:"label",size:"2",style:{display:"flex",alignItems:"center",gap:"var(--space-2)",cursor:"pointer"},mb:"3",children:[A(la,{checked:o,onCheckedChange:f=>n(!!f)}),"Hide synced events"]}),A(Et,{size:"4",mb:"3"}),he(ll,{to:c,style:{display:"flex",alignItems:"center",gap:"var(--space-2)",color:"var(--gray-11)",textDecoration:"none"},children:[A(dl,{style:v("--space-3")}),A(Ae,{size:"2",children:"Manage accounts"})]}),A(Ae,{as:"p",size:"1",color:"gray",mt:"4",children:"On your target calendars, others see only what each sync is set to share. Full detail stays in araMetrics."})]}),he(Pt,{width:x?"100%":void 0,minHeight:b.big_calendar_h,height:"100%",style:{flex:x?"1 1 100%":`1 1 ${b.sync_col_wide}`,minWidth:x?0:b.sync_col_min,display:"flex",flexDirection:"column",alignSelf:"stretch"},children:[x&&A("button",{type:"button",className:"sidebar-icon-btn","aria-label":I?"Hide calendars":"Show calendars",style:{alignSelf:"flex-start",marginBottom:"var(--space-3)"},onClick:()=>Z(f=>!f),children:A(pl,{style:v("--space-4")})}),A(Pt,{flexGrow:"1",minHeight:"0",height:"100%",children:A(Dt,{blocks:B,view:r,onViewChange:t,date:p,onNavigate:u,accounts:e,today:g})})]})]})}import{clsx as ul}from"clsx";import{twMerge as ml}from"tailwind-merge";function Ie(...e){return ml(ul(e))}function fl(e,r="solid"){return k.variants[e]?.[r]||k.variants.primary[r]}function hl(e){let r=k.sizes[e]||k.sizes.md;return`${r.text} ${r.padding} ${r.height}`}function vl(){return Ie(k.base.transition,k.base.focus,k.base.disabled,k.accessibility.reduced_motion)}function yl(){return Ie(k.base.interactive,k.accessibility.focus_trap,k.accessibility.touch_target)}function bl(e={}){return Ie(e.focus_visible&&k.accessibility.focus_trap,e.high_contrast&&k.accessibility.high_contrast,e.reduced_motion&&k.accessibility.reduced_motion)}function xl(e,r=""){return typeof e=="string"?`${r}${e}`:typeof e=="object"&&e!==null?Object.entries(e).map(([t,o])=>o===void 0?"":`${t==="xs"?"":`${t}:`}${r}${o}`).filter(Boolean).join(" "):""}function _l(e,r="gap"){let t=k.spacing[e]||k.spacing.md;switch(r){case"margin":return t.replace("gap-","m-");case"padding":return t.replace("gap-","p-");default:return t}}function wl(e){return k.radius[e]||k.radius.md}function Cl(e){return k.typography[e]||k.typography.base}function Tl(e,r=500){return`bg-${e}-${r}`}function Rl(e,r=500){return`text-${e}-${r}`}function kl(e,r=500){return`border-${e}-${r}`}function Sl(e,r=500){return`hover:bg-${e}-${r}`}function Dl(e,r=500){return`hover:text-${e}-${r}`}function Al(e,r=500){return`focus:ring-${e}-${r}`}function Il(e){let r=k.animations[e];return typeof r=="string"?r:""}function Pl(e,r,t){return o=>{let n=e;return Object.entries(r).forEach(([a,i])=>{let l=o[a];l&&i[l]&&(n+=` ${i[l]}`)}),t?.forEach(({conditions:a,class_name:i})=>{Object.entries(a).every(([s,c])=>o[s]===c)&&(n+=` ${i}`)}),Ie(n)}}function El(e){return function(t){let{class_name:o,...n}=t,a={...e.default_variants,...n},i=e.base||"";return e.variants&&Object.entries(e.variants).forEach(([l,s])=>{let c=a[l];c&&s[c]&&(i+=` ${s[c]}`)}),e.compound_variants?.forEach(({conditions:l,class_name:s})=>{Object.entries(l).every(([g,p])=>a[g]===p)&&(i+=` ${s}`)}),Ie(i,o)}}function Nl(e,r){let t={...e};return Object.keys(r).forEach(o=>{let n=r[o],a=e[o];o==="className"?t[o]=Ie(a,n):typeof n=="object"&&typeof a=="object"&&n!==null&&a!==null&&!Array.isArray(n)&&!Array.isArray(a)?t[o]={...a,...n}:t[o]=n}),t}function Bl(e,r,t){return e?r:t&&e===!1?t:""}function zl(e){let r=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(", ");return Array.from(e.querySelectorAll(r))}function Ll(e,r,t,o={}){let{loop:n=!0,orientation:a="both"}=o,i=t;switch(e.key){case"ArrowDown":(a==="vertical"||a==="both")&&(i=t+1,i>=r.length&&(i=n?0:r.length-1));break;case"ArrowUp":(a==="vertical"||a==="both")&&(i=t-1,i<0&&(i=n?r.length-1:0));break;case"ArrowRight":(a==="horizontal"||a==="both")&&(i=t+1,i>=r.length&&(i=n?0:r.length-1));break;case"ArrowLeft":(a==="horizontal"||a==="both")&&(i=t-1,i<0&&(i=n?r.length-1:0));break;case"Home":i=0;break;case"End":i=r.length-1;break}return i!==t&&(e.preventDefault(),r[i]?.focus()),i}import{Theme as Ml}from"@radix-ui/themes";import"@radix-ui/themes/styles.css";import{jsx as Ol}from"react/jsx-runtime";function Fl({children:e,appearance:r="light",radius:t="none",scaling:o="100%",accentColor:n="amber",grayColor:a="gray",panelBackground:i="solid",className:l=""}){return Ol(Ml,{accentColor:n,grayColor:a,radius:t,scaling:o,panelBackground:i,appearance:r,className:l,children:e})}var ca="arm.shell.v1",da=/^[a-z][a-z0-9-]{0,31}(\.[a-z][a-z0-9-]{0,31})+$/;function Dr(e,r=[]){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||r.includes(e))return!1;let t=[...r,e];if(Array.isArray(e))return e.every(n=>Dr(n,t));let o=Object.getPrototypeOf(e);return o!==Object.prototype&&o!==null?!1:Object.values(e).every(n=>Dr(n,t))}function Hl(e){if(typeof e!="object"||e===null)return!1;let{v:r,id:t,type:o,payload:n}=e;return r===1&&typeof t=="string"&&t!==""&&typeof o=="string"&&da.test(o)&&Dr(n)}function $l(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function Wl(){let e=new Map,r=new Set,t;function o(a){if(!r.has(a.id)){r.add(a.id),r.size>256&&r.delete(r.values().next().value);for(let i of[...e.get(a.type)??[]])i(a.payload)}}function n(){return t===void 0&&(t=typeof BroadcastChannel>"u"?null:new BroadcastChannel(ca),t?.addEventListener("message",a=>{Hl(a.data)&&o(a.data)})),t}return{emit(a,i){if(!da.test(a))throw new TypeError(`shell.events: "${a}" is not an "<app>.<event>" type`);if(!Dr(i))throw new TypeError(`shell.events: the payload of "${a}" is not plain JSON`);let l={v:1,id:$l(),type:a,payload:i};n()?.postMessage(l),o(l)},on(a,i){n();let l=e.get(a)??new Set;e.set(a,l);let s=i;return l.add(s),()=>{l.delete(s)}}}}var Ul={events:Wl()};import*as Ar from"react";function Ff({value:e,default_value:r,on_change:t}){let[o,n]=Ar.useState(r),a=e!==void 0,i=a?e:o,l=Ar.useCallback(s=>{let c=typeof s=="function"?s(i):s;a||n(c),t?.(c)},[a,i,t]);return[i,l]}import*as $e from"react";function Hf(e=!1){let[r,t]=$e.useState(e),o=$e.useCallback(()=>t(!0),[]),n=$e.useCallback(()=>t(!1),[]),a=$e.useCallback(()=>t(i=>!i),[]);return{is_open:r,open:o,close:n,toggle:a,on_open:o,on_close:n,on_toggle:a}}import*as Ir from"react";function Wf(e,r=!0){let t=Ir.useRef(null);return Ir.useEffect(()=>{if(!r)return;let o=n=>{t.current&&!t.current.contains(n.target)&&e()};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,r]),t}export*from"@radix-ui/react-icons";export{Vn as ACTIVITY_META,fo as AUDIT_ACTION_META,Pa as AccentCard,Xt as AccentHeader,Wc as AccessibleIcon,Wt as Accordion,Gt as AccordionContent,Ut as AccordionItem,Vt as AccordionTrigger,$s as AccountCalendarsDialog,Wa as AccountCard,wn as ActivityRow,el as AddAccountMenu,Rc as AlertDialog,_n as AppCard,Jl as AspectRatio,jn as AuthCard,Ec as Avatar,Nc as Badge,Dt as BigCalendarView,oc as Blockquote,jl as Box,Zr as BrandPanel,dc as Button,ut as CalendarDayHeader,gl as CalendarMergedView,Qi as CalendarPickList,ht as CalendarToolbar,Bc as Callout,zc as Card,ee as CardFooter,mc as Checkbox,hc as CheckboxCards,fc as CheckboxGroup,ac as Code,Or as ConfirmDialog,yt as ConnectProviderList,il as ConnectProviderRows,us as ConnectedAccountCard,ql as Container,Sc as ContextMenu,Dn as DashboardErrorCard,Lc as DataList,jr as DataTableRow,Tc as Dialog,Ca as Drawer,Ra as DrawerClose,jt as DrawerContent,Sa as DrawerDefaultClose,Yt as DrawerDescription,ka as DrawerHeader,Kt as DrawerTitle,Ta as DrawerTrigger,kc as DropdownMenu,nc as Em,vs as EmptyCard,cn as EventBlock,Kl as Flex,Jr as GoogleIcon,Yl as Grid,tc as Heading,Ac as HoverCard,pc as IconButton,E as IconTile,ke as ImportCalendarsDialog,Zl as Inset,ic as Kbd,Un as METRIC_STATUS_COLOR,mn as MetricCard,Qr as MicrosoftIcon,kt as MiniMonthPicker,Ja as MonthGrid,Ps as OnboardingStepDots,Yo as OnboardingStepper,et as OtpInput,ei as OtpVerifyStep,ri as PROVIDER_LABEL,Me as PROVIDER_META,On as Pagination,Hr as PausedBadge,Dc as Popover,Pc as Portal,Mc as Progress,H as ProviderIcon,lc as Quote,$n as ROLE_LABELS,pr as ROLE_META,vc as Radio,bc as RadioCards,yc as RadioGroup,ca as SHELL_CHANNEL,hr as SHELL_HEADER_H,Wn as STATUS_META,Ql as ScrollArea,Gi as SearchOverlay,Xl as Section,Cc as SegmentedControl,xc as Select,ec as Separator,yi as Sidebar,ya as Skeleton,_c as Slider,Uc as Slot,Vc as Slottable,Fc as Spinner,cc as Strong,wc as Switch,qs as SyncDetailsDialog,Ds as SyncPreviewRail,$c as TabNav,Oc as Table,Hc as Tabs,rc as Text,uc as TextArea,gc as TextField,sc as TextLink,Vr as Toast,Ic as Tooltip,Ni as Topbar,Fl as UIProvider,Gc as VisuallyHidden,Ct as WizardStepper,Gn as audit_action_meta,Ie as cn,va as colors,Bl as conditional_class,Pl as create_compound_variants,El as create_variant_generator,q as find_calendar,bl as get_accessibility_styles,Il as get_animation_class,vl as get_base_styles,Tl as get_bg_class,kl as get_border_class,$t as get_color,Al as get_focus_ring_class,zl as get_focusable_elements,Sl as get_hover_bg_class,Dl as get_hover_text_class,yl as get_interactive_styles,wl as get_radius_class,xl as get_responsive_classes,hl as get_size_styles,_l as get_spacing_class,Rl as get_text_class,Cl as get_typography_class,fl as get_variant_styles,Ll as handle_arrow_navigation,O as heading_size,b as layout,Nl as merge_props,Ul as shell,k as theme,Wf as useClickOutside,nr as useConnectAccount,Ff as useControllableState,Hf as useDisclosure};
2
2
  //# sourceMappingURL=index.mjs.map