@remit/web-client-dist 0.0.676 → 0.0.678
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/assets/{BriefPane-Cfl-uWfm.js → BriefPane-DZbE8ZNv.js} +1 -1
- package/assets/{CalendarEventEditor-COnJXvRd.js → CalendarEventEditor-LUplTbrz.js} +1 -1
- package/assets/{CalendarEventPopup-CqHE2vrc.js → CalendarEventPopup-CQaPJg2s.js} +1 -1
- package/assets/{CalendarLoadFailed-CxL15r1A.js → CalendarLoadFailed-DGqiWK7A.js} +1 -1
- package/assets/CalendarQuickCreate-DqIwACsh.js +1 -0
- package/assets/{CalendarSession-BKwK9s2o.js → CalendarSession-DGGQfwLi.js} +1 -1
- package/assets/DesktopChrome-Dl4YzJrV.js +1 -0
- package/assets/DropdownMenu-CowSyQUa.js +1 -0
- package/assets/{EmptyState-BUOSmldo.js → EmptyState-DcHnaG2R.js} +1 -1
- package/assets/{ErrorState-KjDYblD5.js → ErrorState-DcP5ZTMN.js} +1 -1
- package/assets/{FlaggedPane-Dw-wR4tp.js → FlaggedPane-CuevlxSV.js} +1 -1
- package/assets/{FullCompose-Djp_h4BT.js → FullCompose-BdpPcB8J.js} +1 -1
- package/assets/LabelApplyTrigger-c7ugtEyT.js +1 -0
- package/assets/MailShell-C7RoeX76.js +1 -0
- package/assets/{MailViewChrome-yffBJjbO.js → MailViewChrome-CQnNS9Dt.js} +1 -1
- package/assets/{MailboxPane-DUCZVAx6.js → MailboxPane-GqjbzfQ9.js} +1 -1
- package/assets/{MessageBody-C89PSL_p.js → MessageBody-B3Z3zu18.js} +4 -4
- package/assets/MessageToolbar-DpBF7XWc.js +1 -0
- package/assets/NavMenuButton-d1WErbNE.js +1 -0
- package/assets/{OnboardingWizard-Cvqq2aP_.js → OnboardingWizard-CPxEO5Gn.js} +1 -1
- package/assets/{OutboxPane-ce4uTAzW.js → OutboxPane-CnWjm3Kz.js} +1 -1
- package/assets/_calendarObjectId-BNxfdsFq.js +1 -0
- package/assets/_mailboxId-5uzJGGTA.js +1 -0
- package/assets/_messageId-CtUY7QaK.js +1 -0
- package/assets/_messageId-CyMtXqvK.js +1 -0
- package/assets/_messageId-jb0nvtAH.js +1 -0
- package/assets/_outboxMessageId-CRuHx4Az.js +1 -0
- package/assets/_recurrenceId-Dcdvy3HK.js +1 -0
- package/assets/_threadId-B17WzUu-.js +1 -0
- package/assets/_threadId-Djcejxjj.js +1 -0
- package/assets/_threadId-TLGn2UeF.js +1 -0
- package/assets/_view._date-DLGnjbKh.js +1 -0
- package/assets/{account-service-status-oYDwuPLn.js → account-service-status-BrL78Bwl.js} +1 -1
- package/assets/accounts-DKPcRgRU.js +1 -0
- package/assets/advanced-BjXiUDtl.js +1 -0
- package/assets/appearance-MzTWiLTR.js +1 -0
- package/assets/{avatar-uWJajuSb.js → avatar-B4KRzyzS.js} +1 -1
- package/assets/{bottom-sheet-Bc0vwv2J.js → bottom-sheet-B5OEKAh2.js} +1 -1
- package/assets/brief-C-5GXXj6.js +1 -0
- package/assets/{brief-bdXCpAmW.js → brief-ChnlqLdX.js} +1 -1
- package/assets/{calendar-event-popup-DsPmxVye.js → calendar-event-popup-Dbcz3Zb_.js} +1 -1
- package/assets/{calendar-event-sidebar-soFGsDRR.js → calendar-event-sidebar-D_7uvmvT.js} +1 -1
- package/assets/{calendar-failure-note-BtZLcaiZ.js → calendar-failure-note-BJCyTf1U.js} +1 -1
- package/assets/{calendar-guests-BR4hC59z.js → calendar-guests-BCC1uGzd.js} +1 -1
- package/assets/{calendar-tMekVEGW.js → calendar-miAZmlW9.js} +1 -1
- package/assets/calendar-mwWH-7s8.js +1 -0
- package/assets/{calendar-suggestion-8jcpefeR.js → calendar-suggestion-BppH-3oL.js} +1 -1
- package/assets/{calendars-bLB0g-E-.js → calendars-D9ZEiowB.js} +1 -1
- package/assets/{card-CPL-TrL1.js → card-WB75jB_w.js} +1 -1
- package/assets/{checkbox-CGG1nAhQ.js → checkbox-BXzuviQP.js} +1 -1
- package/assets/{circle-check-i3jeyeTf.js → circle-check-Bifl6wEJ.js} +1 -1
- package/assets/{circle-check-big-BsCwNdJZ.js → circle-check-big-BrmrabN6.js} +1 -1
- package/assets/{circle-help-CVWHf1ow.js → circle-help-Cyj92MDS.js} +1 -1
- package/assets/{clock-NnulNCOv.js → clock-A6ewTncv.js} +1 -1
- package/assets/cloud-off-CsGOr1Gn.js +1 -0
- package/assets/compose._-_outboxMessageId_-C6-fUwE2.js +1 -0
- package/assets/compose._-_outboxMessageId_-CSKV8YnZ.js +1 -0
- package/assets/compose._-_outboxMessageId_-Djp_aqSn.js +1 -0
- package/assets/compose._-_outboxMessageId_-DspXe17c.js +1 -0
- package/assets/{config-import-DmOMXQ5W.js → config-import-DTjV5c_Y.js} +1 -1
- package/assets/{confirm-dialog-q8tbS_22.js → confirm-dialog-9Q6aXOb5.js} +1 -1
- package/assets/{copy-LUCWJAE6.js → copy-DjyWdtW5.js} +1 -1
- package/assets/{credential-steps-DVglyUgf.js → credential-steps-BoiX5zy2.js} +1 -1
- package/assets/{download-SQdHw0Vd.js → download-CtoLQ9Ox.js} +1 -1
- package/assets/{draft-Y5XWTm_J.js → draft-CdiiJR8n.js} +1 -1
- package/assets/edit-D9g3EW1R.js +1 -0
- package/assets/edit-DkOWaaHs.js +1 -0
- package/assets/{external-link-BDqA_mVy.js → external-link-Dn2gWGrg.js} +1 -1
- package/assets/{file-json-DQGozYSr.js → file-json-B4YU26EQ.js} +1 -1
- package/assets/filters--HZZoQYr.js +1 -0
- package/assets/flagged-CVmpEd-z.js +1 -0
- package/assets/{flagged-CyMautVT.js → flagged-CjfnRBYq.js} +1 -1
- package/assets/{folders-DtchKvEA.js → folders-BEv1OKE6.js} +1 -1
- package/assets/{help-copy-B2iT8EG_.js → help-copy-CQIBCXJf.js} +1 -1
- package/assets/{import-DqNA5XIM.js → import-DhvqQyGM.js} +1 -1
- package/assets/index-4XPoPWhu.js +349 -0
- package/assets/index-B4YQCeZ5.js +1 -0
- package/assets/index-B8TxM1Ri.js +1 -0
- package/assets/{index-DZb7rV9A.js → index-BNUBjW43.js} +4 -4
- package/assets/index-BqN9osrB.js +1 -0
- package/assets/index-CA4e3svh.js +1 -0
- package/assets/{index-Cr6oUxXl.css → index-CNLnhDIy.css} +1 -1
- package/assets/index-ChXNLMBw.js +1 -0
- package/assets/index-Cm4__-V6.js +1 -0
- package/assets/index-CtUY7QaK.js +1 -0
- package/assets/index-CyMtXqvK.js +1 -0
- package/assets/index-DDMaQQcI.js +1 -0
- package/assets/index-aTwfTj57.js +1 -0
- package/assets/{kbd-CDJCJUnp.js → kbd-D0eWE7Kp.js} +1 -1
- package/assets/labels-DlSg6Q8z.js +1 -0
- package/assets/mail-CmiK10Kq.js +1 -0
- package/assets/{menu-CcLh9Whg.js → menu-D06KWsdQ.js} +1 -1
- package/assets/new-B_n0KCot.js +1 -0
- package/assets/onboarding-DVJYsyGv.js +1 -0
- package/assets/{onboarding-completion-DoF3_MyG.js → onboarding-completion-DnXMA7VE.js} +1 -1
- package/assets/outbox-_8AzSWX1.js +1 -0
- package/assets/{pencil-LSmMSKiW.js → pencil-CA6DIP59.js} +1 -1
- package/assets/people-BAjwQQiz.js +1 -0
- package/assets/{popover-menu-fjlAfNO1.js → popover-menu-BT-fkOr5.js} +1 -1
- package/assets/{refresh-cw-5OKnYRBy.js → refresh-cw-BERt5E10.js} +1 -1
- package/assets/{reply-DvdgFS16.js → reply-FoVQqDdv.js} +1 -1
- package/assets/{rich-text-BBwYPM6F.js → rich-text-C9TR28N2.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-Bk8cqxyg.js → rich-text-spellcheck-worker-provider-DjdTU9LK.js} +1 -1
- package/assets/{rotate-ccw-CENCKp2Z.js → rotate-ccw-C-agNTCI.js} +1 -1
- package/assets/{roving-focus-FWOr5tBU.js → roving-focus-Cj3j6dFs.js} +1 -1
- package/assets/{row-actions-DA6zLLAB.js → row-actions-C7JJUiqN.js} +1 -1
- package/assets/{search-mirror-Dri4pWEq.js → search-mirror-B5Imt12Z.js} +1 -1
- package/assets/{search-token-index-B1HU1d2-.js → search-token-index-C7o7PQIx.js} +1 -1
- package/assets/{sections-Rf3k05-_.js → sections-DiFHIPo4.js} +1 -1
- package/assets/senders-BpChah6o.js +1 -0
- package/assets/settings-kL8Y1zKC.js +1 -0
- package/assets/{settings-screen-DBP3ABLE.js → settings-screen-ZYutaKzZ.js} +1 -1
- package/assets/shield-check-DDrlOAO3.js +1 -0
- package/assets/{sparkles-Bcn4ZRhZ.js → sparkles-MrqvyWps.js} +1 -1
- package/assets/{suggested-vips-D-8cU8GT.js → suggested-vips-ODDnv-D2.js} +1 -1
- package/assets/{suggestion._suggestionId-D6z0CuYD.js → suggestion._suggestionId-DZhG3YlZ.js} +1 -1
- package/assets/{task._calendarTaskId-BYRN0yW3.js → task._calendarTaskId-BfaZmOEn.js} +1 -1
- package/assets/{undo-2-Bdx8L5xj.js → undo-2-C6aYHE3s.js} +1 -1
- package/assets/{useCalendarData-DXhaM_NM.js → useCalendarData-C3WbLJaC.js} +2 -2
- package/assets/{useCalendarScheduling-BpjmrzdY.js → useCalendarScheduling-CjI7T1o-.js} +1 -1
- package/assets/{useCalendarSuggestions-D3Jza1d7.js → useCalendarSuggestions-D6k1REyo.js} +1 -1
- package/assets/{useCalendarTasks-D_NZ0GM6.js → useCalendarTasks-DNBYBsvN.js} +1 -1
- package/assets/{useDebouncedValue-BTZsNKEh.js → useDebouncedValue-B0BMCu3v.js} +1 -1
- package/assets/{useFilters-CIuC8WLg.js → useFilters-C_nA08Aa.js} +1 -1
- package/assets/{useLabels-BZFMPVjT.js → useLabels-Dn9qgr5w.js} +1 -1
- package/assets/useLayoutTier-DtUqYCCh.js +1 -0
- package/assets/{useMediaQuery-DiQ0fGER.js → useMediaQuery-a7SamL-l.js} +1 -1
- package/assets/useMessageBodyContent-ClVl7CBj.js +1 -0
- package/assets/useQueries-XPiXhlQX.js +1 -0
- package/assets/{useRefreshControl-B6YIG0w2.js → useRefreshControl-C9tPndY1.js} +1 -1
- package/assets/{useResultFolderIndex-6TeGdWgp.js → useResultFolderIndex-koSvRw-H.js} +1 -1
- package/assets/{useSignature-BkzkUbjz.js → useSignature-rM5axmpY.js} +1 -1
- package/assets/{warnings-BdQvV6Kc.js → warnings-De2eUHBy.js} +4 -4
- package/index.html +2 -2
- package/package.json +1 -1
- package/assets/AppFrame-DSPG81Mk.js +0 -1
- package/assets/CalendarQuickCreate-DxgU3bNP.js +0 -1
- package/assets/LabelApplyTrigger-oS5sxATE.js +0 -1
- package/assets/MailShell-LIuV2C3h.js +0 -1
- package/assets/MessageToolbar-UJadqHyA.js +0 -1
- package/assets/NavMenuButton-B-goW-G5.js +0 -1
- package/assets/_calendarObjectId-lcrg9Fhc.js +0 -1
- package/assets/_mailboxId-BzKo-TnK.js +0 -1
- package/assets/_messageId-C7U0TsBv.js +0 -1
- package/assets/_messageId-CGB3gt7C.js +0 -1
- package/assets/_messageId-D2Qjacn6.js +0 -1
- package/assets/_outboxMessageId-FUbJ3RF8.js +0 -1
- package/assets/_recurrenceId-DpQOCGAd.js +0 -1
- package/assets/_threadId-BmZ2vl5z.js +0 -1
- package/assets/_threadId-Bs84eLjr.js +0 -1
- package/assets/_threadId-DySupNzi.js +0 -1
- package/assets/_view._date-DYujYKtx.js +0 -1
- package/assets/accounts-DhSbRlEm.js +0 -1
- package/assets/advanced-B50NfkTy.js +0 -1
- package/assets/appearance-CYNOlHLz.js +0 -1
- package/assets/brief-DPWE6nMF.js +0 -1
- package/assets/calendar-7SdvLY_h.js +0 -1
- package/assets/compose._-_outboxMessageId_-Be8c22eR.js +0 -1
- package/assets/compose._-_outboxMessageId_-BuomqJqQ.js +0 -1
- package/assets/compose._-_outboxMessageId_-Bv9hyiuT.js +0 -1
- package/assets/compose._-_outboxMessageId_-CvUr9awX.js +0 -1
- package/assets/edit-DMorYaTV.js +0 -1
- package/assets/edit-Dr5FEVcd.js +0 -1
- package/assets/filters-DFLdTFEB.js +0 -1
- package/assets/flagged-CCXBAY09.js +0 -1
- package/assets/index-BaEsIFAV.js +0 -1
- package/assets/index-Biz6TlId.js +0 -1
- package/assets/index-BkMAx0hv.js +0 -1
- package/assets/index-CL_fwLHN.js +0 -349
- package/assets/index-CZYy2P_j.js +0 -1
- package/assets/index-CqsCZrgd.js +0 -1
- package/assets/index-CvDZvwnj.js +0 -1
- package/assets/index-D2Qjacn6.js +0 -1
- package/assets/index-DoTwMLuw.js +0 -1
- package/assets/index-DrtbTKeC.js +0 -1
- package/assets/index-wVOTkeaF.js +0 -1
- package/assets/labels-rv-5Xb0f.js +0 -1
- package/assets/mail-SW3rbFnq.js +0 -1
- package/assets/new-Zmtsd7wU.js +0 -1
- package/assets/onboarding-BbZUe6dp.js +0 -1
- package/assets/outbox-ZJk7VidB.js +0 -1
- package/assets/senders-ikMjTlbx.js +0 -1
- package/assets/settings-Bk7jziSO.js +0 -1
- package/assets/shield-check-CdR23I2B.js +0 -1
- package/assets/useLayoutTier-DrLg7_rq.js +0 -1
- package/assets/useMessageBodyContent-D-LJBFh4.js +0 -1
- package/assets/useQueries-hChzM5ru.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./index-
|
|
1
|
+
import{b as e}from"./index-4XPoPWhu.js";const a=e("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]),y={Mail:"mail sync off",Calendar:"calendar sync off"};export{y as A,a as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r,r as I,q as Pe,af as _e,B as ie,S as Rs,X as De,ag as Is,ah as Os,ai as mt,o as Ms,p as Ls,aj as Us,ak as Hs,al as re,am as zs,an as $s,ao as Bs,f as Ke,ap as qs,a as ns,c as os,aq as Ws,g as pe,ar as Gs,l as we,i as ht,as as Ks,at as Ys,au as Qs,av as be,aw as Ct,L as rt,ax as Vt,ay as Zs,az as Oe,aA as Te,aB as Xs,aC as it,d as at,aD as Js,aE as er,aF as _t,m as ls,aa as tr,aG as sr,aH as rr,aI as cs,aJ as Pt,u as ir,aK as ar,aL as nr,e as or,aM as Dt,aN as lr,T as cr,aO as dr}from"./index-4XPoPWhu.js";import{A as nt,g as Ft,P as ur,O as fr}from"./OnboardingWizard-CPxEO5Gn.js";import{f as Rt,E as mr}from"./ErrorState-DcP5ZTMN.js";import{R as hr}from"./row-actions-C7JJUiqN.js";import{S as pr,A as gr}from"./settings-screen-ZYutaKzZ.js";import{s as $e,b as ds,R as us,u as xr}from"./credential-steps-BoiX5zy2.js";import{u as yr}from"./useSignature-rM5axmpY.js";import{c as vr,a as It,d as br}from"./account-form-helpers-DhckT_PN.js";import{C as Sr}from"./confirm-dialog-9Q6aXOb5.js";import{D as jr}from"./download-CtoLQ9Ox.js";import{a as wr}from"./help-copy-CQIBCXJf.js";import"./checkbox-BXzuviQP.js";import"./kbd-D0eWE7Kp.js";import"./file-json-B4YU26EQ.js";import"./avatar-B4KRzyzS.js";import"./menu-D06KWsdQ.js";import"./circle-help-Cyj92MDS.js";import"./card-WB75jB_w.js";const Nr={Mail:"Mail already in Remit stays, and you can keep reading it.",Calendar:"Events already in Remit stay on your calendar."},Ar={Mail:"New mail stops arriving until you turn it back on.",Calendar:"Changes stop arriving until you turn it back on."},Tr={Mail:"mail",Calendar:"calendar"};function kr(e,s){const t=Tr[e.service];return e.kind==="enable"?{title:`Sign in with ${s} to add ${t}?`,description:`This account was never asked for ${t} access. Remit sends you to ${s} to ask for it, and brings you back here when you are done. Nothing changes until you get back.`,confirmLabel:`Continue to ${s}`,cancelLabel:"Cancel",destructive:!1}:e.kind==="last"?{title:`${e.service} is the only thing this account syncs`,description:`An account has to sync something. To stop this one entirely, remove the account — that deletes what Remit stored for it, which switching ${t} off never does.`,confirmLabel:"Remove account",cancelLabel:`Keep syncing ${t}`,destructive:!0}:{title:`Stop syncing ${t} for this account?`,description:`${Nr[e.service]} ${Ar[e.service]} Nothing is deleted.`,confirmLabel:`Stop syncing ${t}`,cancelLabel:"Cancel",destructive:!1}}function Er({change:e,providerName:s,onConfirm:t,onCancel:a,isBusy:n}){if(e===null)return null;const c=kr(e,s);return r.jsx(Sr,{isOpen:!0,title:c.title,description:c.description,confirmLabel:c.confirmLabel,cancelLabel:c.cancelLabel,destructive:c.destructive,isBusy:n??!1,onConfirm:t,onCancel:a})}function Cr({checked:e,label:s,describedBy:t,disabled:a,onToggle:n}){return r.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":s,"aria-describedby":t,disabled:a,onClick:n,className:Pe("relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors","outline-none disabled:cursor-not-allowed disabled:opacity-60 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",e?"border-positive bg-positive":"border-line-strong bg-surface-sunken"),children:r.jsx("span",{"aria-hidden":!0,className:Pe("size-4 rounded-full bg-canvas transition-transform",e?"translate-x-6":"translate-x-1")})})}function Vr({providerName:e,offered:s,enabled:t,consented:a,disabled:n=!1,onRequestChange:c}){const o=I.useId(),u=nt.filter(y=>s.includes(y.id));return u.length<2?null:r.jsxs("fieldset",{children:[r.jsx("legend",{className:"text-sm font-semibold text-fg",children:"What this account syncs"}),r.jsx("div",{className:"mt-1 divide-y divide-line",children:u.map(y=>{const A=t.includes(y.id),T=`${o}-${y.id}`,_=!A&&!a.includes(y.id);return r.jsxs("div",{className:"flex min-h-11 items-center gap-3 py-2 text-left",children:[r.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm text-fg",children:y.label}),r.jsx("span",{id:T,className:"text-xs text-fg-subtle",children:_?`${y.description} Turning this on means signing in with ${e} again.`:y.description})]}),r.jsx(Cr,{checked:A,label:`Sync ${y.label.toLowerCase()}`,describedBy:T,disabled:n,onToggle:()=>c(y.id,A?"off":"on")})]},y.id)})})]})}const _r=e=>{const s=new Set(e.map(Is));return Os.map(t=>t.tag).filter(t=>!s.has(t)).sort((t,a)=>_e(t).localeCompare(_e(a)))},Pr=({value:e,onChange:s,busy:t=!1})=>{const a=_r(e);return r.jsxs("div",{className:"space-y-2","data-testid":"compose-language-setting",children:[r.jsx("ul",{className:"space-y-1",children:e.map((n,c)=>r.jsxs("li",{"data-testid":`compose-language-row-${n}`,className:"flex items-center gap-2 rounded-md border border-line bg-surface-sunken px-3 py-1.5",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-fg",lang:n,children:_e(n)}),c===0?r.jsx("span",{className:"shrink-0 text-2xs uppercase tracking-wider text-fg-subtle",children:"Default"}):r.jsx(ie,{variant:"ghost",size:"sm",icon:r.jsx(Rs,{className:"size-3.5"}),disabled:t,"aria-label":`Write new messages in ${_e(n)} by default`,onClick:()=>s([n,...e.filter(o=>o!==n)]),children:"Default"}),r.jsx(ie,{variant:"ghost",size:"sm",icon:r.jsx(De,{className:"size-3.5"}),disabled:t||e.length===1,"aria-label":`Remove ${_e(n)}`,onClick:()=>s(e.filter(o=>o!==n))})]},n))}),r.jsxs("select",{"aria-label":"Add a language",value:"",disabled:t||a.length===0,onChange:n=>{n.target.value!==""&&s([...e,n.target.value])},className:"w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none transition-colors focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30",children:[r.jsx("option",{value:"",children:"Add a language…"}),a.map(n=>r.jsx("option",{value:n,children:_e(n)},n))]}),r.jsx("p",{className:"text-xs text-fg-muted",children:"A message is tagged with the language you write it in, picked from this list. Your browser, not this app, decides which dictionaries it spellchecks against — add the language there too to get its underlines."})]})};function Dr({title:e,description:s,action:t}){return r.jsxs("div",{className:"rounded-sm border border-danger/50",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-danger/30 bg-danger-soft px-row-inset py-2",children:[r.jsx(mt,{className:"size-4 text-danger"}),r.jsx("h2",{className:"text-sm font-semibold text-danger",children:"Danger zone"})]}),r.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium text-fg",children:e}),r.jsx("p",{className:"text-xs text-fg-muted",children:s})]}),r.jsx("div",{className:"shrink-0",children:t})]})]})}function Ot({isOpen:e,onClose:s,title:t,children:a,footer:n}){Ms({id:"slide-panel",open:e,answers:{back:s}});const c=I.useRef(null);return Ls(c,e),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:Pe("fixed inset-0 z-40 bg-black/30 transition-opacity",e?"opacity-100":"pointer-events-none opacity-0"),onClick:s,"aria-hidden":"true"}),r.jsxs("div",{ref:c,className:Pe("safe-area-frame fixed top-0 right-0 z-50 flex h-full w-full flex-col border-l border-line bg-canvas shadow-xl sm:w-[400px] sm:max-w-[90vw]","transform transition-transform duration-200 ease-out",e?"translate-x-0":"pointer-events-none translate-x-full"),role:"dialog","aria-modal":"true","aria-hidden":!e,inert:!e,"aria-labelledby":"slide-panel-title",tabIndex:-1,children:[r.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-line px-4",children:[r.jsx("h2",{id:"slide-panel-title",className:"font-semibold",children:t}),r.jsx("button",{type:"button",onClick:s,className:"rounded-md p-1.5 transition-colors hover:bg-surface-raised","aria-label":"Close",children:r.jsx(De,{className:"size-5"})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsx("div",{className:"flex-1 overflow-auto p-4",children:a}),n&&r.jsx("div",{className:"flex justify-end gap-3 border-t border-line bg-canvas p-4",children:n})]})]})]})}function Mt(e){return Us(Hs,e)}var Ue=e=>e.type==="checkbox",Ne=e=>e instanceof Date,Z=e=>e==null;const pt=e=>typeof e=="object";var B=e=>!Z(e)&&!Array.isArray(e)&&pt(e)&&!Ne(e),Fr=e=>B(e)&&e.target?Ue(e.target)?e.target.checked:e.target.value:e,Rr=(e,s)=>s.split(".").some((t,a,n)=>!isNaN(Number(t))&&e.has(n.slice(0,a).join("."))),fs=e=>{const s=e.constructor&&e.constructor.prototype;return B(s)&&s.hasOwnProperty("isPrototypeOf")},Ye=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function q(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(Ye&&(e instanceof Blob||s))return e;const t=Array.isArray(e);if(!t&&!(B(e)&&fs(e)))return e;const a=t?[]:Object.create(Object.getPrototypeOf(e));for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=q(e[n]));return a}const Ce={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},fe={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ue={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},ms="root",gt=["__proto__","constructor","prototype"],Ir=/^\w*$/;var He=e=>Ir.test(e),U=e=>e===void 0;const Or=/[.[\]'"]/;var Qe=e=>e.split(Or).filter(Boolean),v=(e,s,t)=>{if(!s||!B(e))return t;const a=He(s)?[s]:Qe(s);if(a.some(c=>gt.includes(c)))return t;const n=a.reduce((c,o)=>Z(c)?void 0:c[o],e);return U(n)||n===e?U(e[s])?t:e[s]:n},me=e=>typeof e=="boolean",ce=e=>typeof e=="function",M=(e,s,t)=>{let a=-1;const n=He(s)?[s]:Qe(s),c=n.length,o=c-1;for(;++a<c;){const u=n[a];let y=t;if(a!==o){const A=e[u];y=B(A)||Array.isArray(A)?A:isNaN(+n[a+1])?{}:[]}if(gt.includes(u))return;e[u]=y,e=e[u]}};const Mr=re.createContext(null);Mr.displayName="HookFormControlContext";var Lr=(e,s,t,a=!0)=>{const n={};for(const c in e)Object.defineProperty(n,c,{get:()=>{const o=c;return s._proxyFormState[o]!==fe.all&&(s._proxyFormState[o]=!a||fe.all),e[o]}});return n};const Ur=Ye?re.useLayoutEffect:re.useEffect;var X=e=>typeof e=="string",Hr=(e,s,t,a,n)=>X(e)?(a&&s.watch.add(e),v(t,e,n)):Array.isArray(e)?e.map(c=>(a&&s.watch.add(c),v(t,c))):(a&&(s.watchAll=!0),t),ot=e=>Z(e)||!pt(e);const Lt=(e,s)=>s.length===0&&!Array.isArray(e)&&!fs(e);function he(e,s,t=new WeakMap){if(e===s)return!0;if(ot(e)||ot(s))return Object.is(e,s);if(Ne(e)&&Ne(s))return Object.is(e.getTime(),s.getTime());const a=Object.keys(e),n=Object.keys(s);if(a.length!==n.length)return!1;if(Lt(e,a)||Lt(s,n))return Object.is(e,s);if(!a.length&&Array.isArray(e)!==Array.isArray(s))return!1;const c=t.get(e);if(c&&c.has(s))return!0;if(c)c.add(s);else{const o=new WeakSet;o.add(s),t.set(e,o)}for(const o of a){const u=e[o];if(!(o in s))return!1;if(o!=="ref"){const y=s[o];if(Ne(u)&&Ne(y)||(B(u)||Array.isArray(u))&&(B(y)||Array.isArray(y))?!he(u,y,t):!Object.is(u,y))return!1}}return!0}var Be=e=>({isOnSubmit:!e||e===fe.onSubmit,isOnBlur:e===fe.onBlur,isOnChange:e===fe.onChange,isOnAll:e===fe.all,isOnTouch:e===fe.onTouched}),et=(e,s,t)=>{if(t)return!1;if(s.watchAll||s.watch.has(e))return!0;for(const a of s.watch)if(e.startsWith(a)&&e.charAt(a.length)===".")return!0;return!1};const Le=(e,s,t,a)=>{for(const n of t||Object.keys(e)){const c=v(e,n);if(c){const{_f:o,...u}=c;if(o){if(o.refs&&o.refs[0]&&s(o.refs[0],n)&&!a)return!0;if(o.ref&&s(o.ref,o.name)&&!a)return!0;if(Le(u,s))break}else if(B(u)&&Le(u,s))break}}};var Ut=(e,s,t)=>{const a=v(e,t),n=Array.isArray(a)?a:[];return M(n,ms,s[t]),M(e,t,n),e},Q=e=>B(e)&&!Object.keys(e).length,xt=e=>e.type==="file",We=e=>{if(!Ye)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},yt=e=>e.type==="radio",Ge=e=>e instanceof RegExp,vt=(e,s,t,a,n)=>s?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[a]:n||!0}}:{};const Ht={value:!1,isValid:!1},zt={value:!0,isValid:!0};var hs=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===""?zt:{value:e[0].value,isValid:!0}:zt:Ht}return Ht};const $t={isValid:!1,value:null};var ps=e=>Array.isArray(e)?e.reduce((s,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:s,$t):$t;function Bt(e,s,t="validate"){if(X(e)||Array.isArray(e)&&e.every(X)||me(e)&&!e)return{type:t,message:X(e)?e:"",ref:s}}var Ve=e=>B(e)&&!Ge(e)?e:{value:e,message:""},qt=async(e,s,t,a,n,c)=>{const{ref:o,refs:u,required:y,maxLength:A,minLength:T,min:_,max:L,pattern:p,validate:S,name:k,valueAsNumber:j,mount:le}=e._f,C=v(t,k);if(!le||s.has(k))return{};const P=u?u[0]:o,V=F=>{if(n&&P.reportValidity){const D=me(F)?"":F||"";u?u.forEach(O=>O.setCustomValidity(D)):P.setCustomValidity(D),P.reportValidity()}},E={},J=yt(o),ne=Ue(o),H=J||ne,oe=(j||xt(o))&&U(o.value)&&U(C)||We(o)&&o.value===""||C===""||Array.isArray(C)&&!C.length,ae=vt.bind(null,k,a,E),ge=(F,D,O,z=ue.maxLength,G=ue.minLength)=>{const K=F?D:O;E[k]={type:F?z:G,message:K,ref:o,...ae(F?z:G,K)}};if(c?!Array.isArray(C)||!C.length:y&&(!H&&(oe||Z(C))||me(C)&&!C||ne&&!hs(u).isValid||J&&!ps(u).isValid)){const{value:F,message:D}=X(y)?{value:!!y,message:y}:Ve(y);if(F&&(E[k]={type:ue.required,message:D,ref:P,...ae(ue.required,D)},!a))return V(D),E}if(!oe&&(!Z(_)||!Z(L))){let F,D;const O=Ve(L),z=Ve(_);if(!Z(C)&&!isNaN(C)){const G=o.valueAsNumber||C&&+C;Z(O.value)||(F=G>O.value),Z(z.value)||(D=G<z.value)}else{const G=o.valueAsDate||new Date(C),K=w=>new Date(new Date().toDateString()+" "+w),Se=o.type=="time",Y=o.type=="week";X(O.value)&&C&&(F=Se?K(C)>K(O.value):Y?C>O.value:G>new Date(O.value)),X(z.value)&&C&&(D=Se?K(C)<K(z.value):Y?C<z.value:G<new Date(z.value))}if((F||D)&&(ge(!!F,O.message,z.message,ue.max,ue.min),!a))return V(E[k].message),E}if((A||T)&&!oe&&(X(C)||c&&Array.isArray(C))){const F=Ve(A),D=Ve(T),O=!Z(F.value)&&C.length>+F.value,z=!Z(D.value)&&C.length<+D.value;if((O||z)&&(ge(O,F.message,D.message),!a))return V(E[k].message),E}if(p&&!oe&&X(C)){const{value:F,message:D}=Ve(p);if(Ge(F)&&!C.match(F)&&(E[k]={type:ue.pattern,message:D,ref:o,...ae(ue.pattern,D)},!a))return V(D),E}if(S){if(ce(S)){const F=await S(C,t),D=Bt(F,P);if(D&&(E[k]={...D,...ae(ue.validate,D.message)},!a))return V(D.message),E}else if(B(S)){let F={};for(const D in S){if(!Q(F)&&!a)break;const O=Bt(await S[D](C,t),P,D);O&&(F={...O,...ae(D,O.message)},V(O.message),a&&(E[k]=F))}if(!Q(F)&&(E[k]={ref:P,...F},!a))return E}}return V(!0),E},qe=e=>Array.isArray(e)?e:[e],gs=e=>Array.isArray(e)?e.filter(Boolean):[];function zr(e,s){const t=s.slice(0,-1).length;let a=0;for(;a<t;){if(Z(e)){e=void 0;break}e=e[s[a]],a++}return e}function $r(e){for(const s in e)if(e.hasOwnProperty(s)&&!U(e[s]))return!1;return!0}function W(e,s){if(X(s)&&Object.prototype.hasOwnProperty.call(e,s))return delete e[s],e;const t=Array.isArray(s)?s:He(s)?[s]:Qe(s);if(t.some(o=>gt.includes(String(o))))return e;const a=t.length===1?e:zr(e,t),n=t.length-1,c=t[n];return a&&delete a[c],n!==0&&(B(a)&&Q(a)||Array.isArray(a)&&$r(a))&&W(e,t.slice(0,-1)),e}const xs=e=>{const s={};for(const t of Object.keys(e))if(pt(e[t])&&e[t]!==null&&!Ne(e[t])){const a=xs(e[t]);for(const n of Object.keys(a))s[`${t}.${n}`]=a[n]}else s[t]=e[t];return s},Br=re.createContext(null);Br.displayName="HookFormContext";var Wt=()=>{let e=[];return{get observers(){return e},next:n=>{for(const c of e)c.next&&c.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(c=>c!==n)}}),unsubscribe:()=>{e=[]}}};function ys(e,s){const t={};for(const a in e)if(e.hasOwnProperty(a)){const n=e[a],c=s[a];if(n&&B(n)&&c){const o=ys(n,c);B(o)&&(t[a]=o)}else e[a]&&(t[a]=c)}return t}var vs=e=>e.type==="select-multiple",qr=e=>yt(e)||Ue(e),tt=e=>We(e)&&e.isConnected,Wr=e=>{for(const s in e)if(ce(e[s]))return!0;return!1};function bs(e){return Array.isArray(e)||B(e)&&!Wr(e)}function Ss(e){return!!(e&&"_f"in e)}function js(e){return Array.isArray(e)?!e.some(s=>!U(s)):!Object.keys(e).length}function lt(e,s){Array.isArray(e)?e[s]=void 0:delete e[s]}function ct(e,s={},t){for(const a in e){const n=e[a],c=t&&t[a];bs(n)&&(!Array.isArray(n)||!Ss(c))?(s[a]=Array.isArray(n)?[]:{},ct(n,s[a],c),js(s[a])&<(s,a)):U(n)||(s[a]=!0)}return s}function ke(e,s,t,a){t||(t=ct(s,{},a));for(const n in e){const c=e[n],o=a&&a[n];bs(c)&&(!Array.isArray(c)||!Ss(o))?(U(s)||ot(t[n])?t[n]=ct(c,Array.isArray(c)?[]:{},o):ke(c,Z(s)?{}:s[n],t[n],o),js(t[n])&<(t,n)):he(c,s[n])?lt(t,n):t[n]=!0}return t}var ws=(e,{valueAsNumber:s,valueAsDate:t,setValueAs:a})=>U(e)?e:s?e===""?NaN:e&&+e:t&&X(e)?new Date(e):a?a(e):e;function Gt(e){const s=e.ref;return xt(s)?s.files:yt(s)?ps(e.refs).value:vs(s)?[...s.selectedOptions].map(({value:t})=>t):Ue(s)?hs(e.refs).value:ws(U(s.value)?e.ref.value:s.value,e)}var Gr=(e,s,t,a)=>{const n={};for(const c of e){const o=v(s,c);o&&M(n,c,o._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:a}},Me=e=>U(e)?e:Ge(e)?e.source:B(e)?Ge(e.value)?e.value.source:e.value:e;const Kt="AsyncFunction";var Kr=e=>{if(!e||!e.validate)return!1;if(ce(e.validate))return e.validate.constructor.name===Kt;if(B(e.validate)){for(const s in e.validate)if(e.validate[s].constructor.name===Kt)return!0}return!1},Yr=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Yt(e,s,t){const a=v(e,t);if(a||He(t))return{error:a,name:t};const n=t.split(".");for(;n.length;){const c=n.join("."),o=v(s,c),u=v(e,c);if(o&&!Array.isArray(o)&&t!==c)return{name:t};if(u&&u.type)return{name:c,error:u};if(u&&u.root&&u.root.type)return{name:`${c}.root`,error:u.root};n.pop()}return{name:t}}var Qr=(e,s,t,a)=>{t(e);const{name:n,...c}=e,o=Object.keys(c);return!o.length||a&&o.length>=Object.keys(s).length||o.find(u=>s[u]===(!a||fe.all))},Zr=(e,s,t)=>!e||!s||e===s||qe(e).some(a=>a&&(t?a===s||a.startsWith(s+"."):a.startsWith(s)||s.startsWith(a))),Xr=(e,s,t,a,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(s||e):(t?a.isOnBlur:n.isOnBlur)?!e:(t?a.isOnChange:n.isOnChange)?e:!0,Jr=(e,s)=>!gs(v(e,s)).length&&W(e,s);const ei={mode:fe.onSubmit,reValidateMode:fe.onChange,shouldFocusError:!0},st="form",Ns={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function ti(e={}){let s={...ei,...e},t={...q(Ns),isLoading:ce(s.defaultValues),errors:s.errors||{},disabled:s.disabled||!1},a={},n=B(s.defaultValues)||B(s.values)?q(s.defaultValues||s.values)||{}:{},c=s.shouldUnregister?{}:q(n),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},u={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const y={},A={};let T=0,_=Be(s.mode),L=Be(s.reValidateMode);const p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},S={...p};let k={...S};const j={array:Wt(),state:Wt()};let le=0;const C=s.criteriaMode===fe.all,P=(i,l)=>d=>{clearTimeout(A[i]),A[i]=setTimeout(l,d)},V=async i=>{if(!o.keepIsValid&&!s.disabled&&(S.isValid||k.isValid||i)){const l=++le;let d;s.resolver?(d=Q((await O()).errors),l===le&&E()):d=await K({fields:a,onlyCheckValid:!0,eventType:Ce.VALID}),l===le&&d!==t.isValid&&j.state.next({isValid:d})}},E=(i,l)=>{!s.disabled&&(S.isValidating||S.validatingFields||k.isValidating||k.validatingFields)&&((i||Array.from(u.mount)).forEach(d=>{d&&(l?M(t.validatingFields,d,l):W(t.validatingFields,d))}),j.state.next({validatingFields:t.validatingFields,isValidating:!Q(t.validatingFields)}))},J=()=>{t.dirtyFields=ke(n,c,void 0,a)},ne=(i,l=[],d,f,m=!0,x=!0)=>{if(f&&d&&!s.disabled){if(o.action=!0,x&&Array.isArray(v(a,i))){const g=d(v(a,i),f.argA,f.argB);m&&M(a,i,g)}if(x&&Array.isArray(v(t.errors,i))){const g=d(v(t.errors,i),f.argA,f.argB);m&&M(t.errors,i,g),Jr(t.errors,i)}if((S.touchedFields||k.touchedFields)&&x&&Array.isArray(v(t.touchedFields,i))){const g=d(v(t.touchedFields,i),f.argA,f.argB);m&&M(t.touchedFields,i,g)}(S.dirtyFields||k.dirtyFields)&&J(),j.state.next({name:i,isDirty:Y(i,l),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else M(c,i,l)},H=(i,l)=>{M(t.errors,i,l),t.errors={...t.errors},j.state.next({errors:t.errors})},oe=i=>{t.errors=i,j.state.next({errors:t.errors,isValid:!1})},ae=i=>{const l=He(i)?[i]:Qe(i);let d=c,f=n;for(let m=0;m<l.length-1;m++){const x=l[m];if(d=Z(d)?d:d[x],f=Z(f)?f:f[x],d===null&&f!==null)return!0}return!1},ge=(i,l,d,f)=>{const m=v(a,i);if(m){if(ae(i))return;const x=U(v(c,i)),g=v(c,i,U(d)?v(n,i):d);U(g)||f&&f.defaultChecked||l?M(c,i,l?g:Gt(m._f)):Ae(i,g),o.mount&&!o.action&&(V(),x&&t.isDirty&&(S.isDirty||k.isDirty)&&(Y()||(t.isDirty=!1,j.state.next({...t}))),e.shouldUnregister&&x&&!U(v(c,i))&&et(i,u)&&(o.watch=!0))}},F=(i,l,d,f,m)=>{let x=!1,g=!1;const b={name:i};if(!s.disabled||f===!0){if(!d||f){const N=he(v(n,i),l);(S.isDirty||k.isDirty)&&(g=t.isDirty,t.isDirty=b.isDirty=!N||Y(),x=g!==b.isDirty),g=!!v(t.dirtyFields,i),N!==t.isDirty?t.dirtyFields=ke(n,c,void 0,a):N?W(t.dirtyFields,i):M(t.dirtyFields,i,!0),b.dirtyFields=t.dirtyFields,x=x||(S.dirtyFields||k.dirtyFields)&&g!==!N}if(d){const N=v(t.touchedFields,i);N||(M(t.touchedFields,i,d),b.touchedFields=t.touchedFields,x=x||(S.touchedFields||k.touchedFields)&&N!==d)}x&&m&&j.state.next(b)}return x?b:{}},D=(i,l,d,f)=>{const m=v(t.errors,i),x=(S.isValid||k.isValid)&&me(l)&&t.isValid!==l;if(s.delayError&&d?(y[i]=P(i,()=>H(i,d)),y[i](s.delayError)):(clearTimeout(A[i]),delete y[i],d?M(t.errors,i,d):W(t.errors,i),t.errors={...t.errors}),(d?!he(m,d):m)||!Q(f)||x){const g={...f,...x&&me(l)?{isValid:l}:{},errors:t.errors,name:i};t={...t,...g},j.state.next(g)}},O=async i=>(E(i,!0),await s.resolver(c,s.context,Gr(i||u.mount,a,s.criteriaMode,s.shouldUseNativeValidation))),z=async i=>{const{errors:l}=await O(i);if(E(i),i){for(const d of i){const f=v(l,d);f?u.array.has(d)&&B(f)&&!Object.keys(f).some(m=>!Number.isNaN(Number(m)))?Ut(t.errors,{[d]:f},d):M(t.errors,d,f):W(t.errors,d)}t.errors={...t.errors}}else t.errors=l;return l},G=async({name:i,eventType:l})=>{if(e.validate){const d=await e.validate({formValues:c,formState:t,name:i,eventType:l});if(B(d))for(const f in d){const m=d[f];m&&ze(`${st}.${f}`,{message:X(m.message)?m.message:"",type:m.type||ue.validate})}else X(d)||!d?ze(st,{message:d||"",type:ue.validate}):St(st);return d}return!0},K=async({fields:i,onlyCheckValid:l,name:d,eventType:f,context:m={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(m.runRootValidation=!0,!await G({name:d,eventType:f})&&(m.valid=!1,l)))return m.valid;for(const x in i){const g=i[x];if(g){const{_f:b,...N}=g;if(b){const $=u.array.has(b.name),se=g._f&&Kr(g._f),ye=S.validatingFields||S.isValidating||k.validatingFields||k.isValidating;se&&ye&&E([b.name],!0);const ve=await qt(g,u.disabled,c,C,s.shouldUseNativeValidation&&!l,$);if(se&&ye&&E([b.name]),ve[b.name]&&(m.valid=!1,l)||(!l&&(v(ve,b.name)?$?Ut(t.errors,ve,b.name):M(t.errors,b.name,ve[b.name]):W(t.errors,b.name)),e.shouldUseNativeValidation&&ve[b.name]))break}!Q(N)&&await K({context:m,onlyCheckValid:l,fields:N,name:x,eventType:f})}}return m.valid},Se=()=>{for(const i of u.unMount){const l=v(a,i);l&&(l._f.refs?l._f.refs.every(d=>!tt(d)):!tt(l._f.ref))&&Ze(i)}u.unMount=new Set},Y=(i,l)=>(i&&l&&M(c,i,l),!he(o.mount?c:n,n)),w=(i,l,d)=>Hr(i,u,{...o.mount?c:U(l)?n:X(i)?{[i]:l}:l},d,l),de=i=>gs(v(o.mount?c:n,i,s.shouldUnregister?v(n,i,[]):[])),Ae=(i,l,d={},f=!1,m=!1)=>{const x=v(a,i);let g=l;if(x){const b=x._f;b&&(!b.disabled&&M(c,i,ws(l,b)),g=We(b.ref)&&Z(l)?"":l,vs(b.ref)?[...b.ref.options].forEach(N=>N.selected=g.includes(N.value)):b.refs?Ue(b.ref)?b.refs.forEach(N=>{(!N.defaultChecked||!N.disabled)&&(Array.isArray(g)?N.checked=!!g.find($=>$===N.value):N.checked=g===N.value||!!g)}):b.refs.forEach(N=>N.checked=N.value===g):xt(b.ref)?b.ref.value="":(b.ref.value=g,!b.ref.type&&!m&&j.state.next({name:i,values:f?c:q(c)})))}(d.shouldDirty||d.shouldTouch)&&F(i,g,d.shouldTouch,d.shouldDirty,!m),d.shouldValidate&&Ee(i,{delayError:d.delayError})},h=(i,l,d,f=!1,m=!1)=>{for(const x in l){if(!l.hasOwnProperty(x))return;const g=l[x],b=i+"."+x,N=v(a,b);(u.array.has(i)||B(g)||N&&!N._f)&&!Ne(g)?h(b,g,d,f,m):Ae(b,g,d,f,m)}},R=(i,l,d,f,m=!1)=>{const x=v(a,i),g=u.array.has(i),b=f?l:q(l),N=v(c,i),$=he(N,b);if($||M(c,i,b),g)j.array.next({name:i,values:f?c:q(c)}),(S.isDirty||S.dirtyFields||k.isDirty||k.dirtyFields)&&d.shouldDirty&&(J(),m||j.state.next({name:i,dirtyFields:t.dirtyFields,isDirty:Y(i,b)}));else{const se=Array.isArray(b)&&!b.length||Q(b);!x||x._f||Z(b)||se?Ae(i,b,d,f,m):h(i,b,d,f,m)}if(!$&&!m){const se=et(i,u),ye=f?c:q(c);j.state.next({...se&&t,name:o.mount||se?i:void 0,values:ye})}},ee=(i,l,d={})=>R(i,l,d,!1),te=(i,l={})=>{const d=ce(i)?i(c):i;if(!he(c,d)){c={...c,...d};const f=xs(d);for(const m of u.mount)m in f&&R(m,f[m],l,!0,!0);j.state.next({...t,name:void 0,type:void 0,...T?{values:c}:{}}),l.shouldValidate&&V()}},xe=async i=>{o.mount=!0;const l=i.target;let d=l.name,f=!0;const m=v(a,d),x=g=>{f=Number.isNaN(g)||Ne(g)&&isNaN(g.getTime())||he(g,v(c,d,g))};if(m){let g,b;const N=l.type?Gt(m._f):Fr(i),$=i.type===Ce.BLUR||i.type===Ce.FOCUS_OUT,se=!Yr(m._f)&&!e.validate&&!s.resolver&&!v(t.errors,d)&&!m._f.deps,ye=se||Xr($,v(t.touchedFields,d),t.isSubmitted,L,_),ve=et(d,u,$);if(M(c,d,N),$){if(!l||!l.readOnly){m._f.onBlur&&m._f.onBlur(i);const Ie=y[d];Ie&&Ie(0)}}else m._f.onChange&&m._f.onChange(i);const Re=F(d,N,$),Ds=!Q(Re)||ve;if(!$&&j.state.next({name:d,type:i.type,...T?{values:q(c)}:{}}),ye)return(!se||!t.isValid)&&(S.isValid||k.isValid)&&(s.mode==="onBlur"?$&&V():$||V()),Ds&&j.state.next({name:d,...ve?{}:Re});if(!s.resolver&&e.validate&&await G({name:d,eventType:i.type}),!$&&ve&&j.state.next({...t}),s.resolver){const{errors:Ie}=await O([d]);if(E([d]),x(N),!f){!Q(Re)&&j.state.next(Re);return}const Fs=Yt(t.errors,a,d),Et=Yt(Ie,a,Fs.name||d);g=Et.error,d=Et.name,b=Q(Ie)}else E([d],!0),g=(await qt(m,u.disabled,c,C,s.shouldUseNativeValidation))[d],E([d]),x(N),f&&(g?b=!1:(S.isValid||k.isValid)&&(b=await K({fields:a,onlyCheckValid:!0,name:d,eventType:i.type})));f&&(m._f.deps&&(!Array.isArray(m._f.deps)||m._f.deps.length>0)&&Ee(m._f.deps),D(d,b,g,Re))}},je=(i,l)=>{if(v(t.errors,l)&&i.focus)return i.focus(),1},Ee=async(i,l={})=>{let d,f;const m=qe(i);if(s.resolver){const x=await z(U(i)?i:m);d=Q(x),f=i?!m.some(g=>v(x,g)):d}else i?(f=(await Promise.all(m.map(async x=>{const g=v(a,x);return await K({fields:g&&g._f?{[x]:g}:g,eventType:Ce.TRIGGER})}))).every(Boolean),!(!f&&!t.isValid)&&V()):f=d=await K({fields:a,name:i,eventType:Ce.TRIGGER});if(l.delayError&&s.delayError&&X(i)){const x=v(t.errors,i);x?(W(t.errors,i),y[i]=P(i,()=>H(i,x)),y[i](s.delayError)):(clearTimeout(A[i]),delete y[i])}return j.state.next({...!X(i)||(S.isValid||k.isValid)&&d!==t.isValid?{}:{name:i},...s.resolver||!i?{isValid:d}:{},errors:t.errors}),l.shouldFocus&&!f&&Le(a,je,i?m:u.mount),f},Fe=(i,l)=>{let d={...o.mount?c:n};return l&&(d=ys(l.dirtyFields?t.dirtyFields:t.touchedFields,d)),U(i)?d:X(i)?v(d,i):i.map(f=>v(d,f))},bt=(i,l)=>({invalid:!!v((l||t).errors,i),isDirty:!!v((l||t).dirtyFields,i),error:v((l||t).errors,i),isValidating:!!v(t.validatingFields,i),isTouched:!!v((l||t).touchedFields,i)}),St=i=>{const l=i?qe(i):void 0;l?.forEach(d=>W(t.errors,d)),l?l.forEach(d=>{j.state.next({name:d,errors:t.errors})}):j.state.next({errors:{}})},ze=(i,l,d)=>{const f=(v(a,i,{_f:{}})._f||{}).ref,m=v(t.errors,i)||{},{ref:x,message:g,type:b,...N}=m;M(t.errors,i,{...N,...l,ref:f}),j.state.next({name:i,errors:t.errors,isValid:!1}),d&&d.shouldFocus&&f&&f.focus&&f.focus()},ks=(i,l)=>{if(ce(i)){T++;const{unsubscribe:d}=j.state.subscribe({next:m=>"values"in m&&i(m.values||w(void 0,l),m)});let f=!1;return{unsubscribe:()=>{f||(f=!0,T--,d())}}}return w(i,l,!0)},jt=i=>{var l;const d=!!(!((l=i.formState)===null||l===void 0)&&l.values);d&&T++;const{unsubscribe:f}=j.state.subscribe({next:x=>{if(Zr(i.name,x.name,i.exact)&&Qr(x,i.formState||S,Ps,i.reRenderRoot)){const g={...c};i.callback({values:g,...t,...x,defaultValues:n})}}});if(!d)return f;let m=!1;return()=>{m||(m=!0,T--,f())}},Es=i=>(o.mount=!0,k={...k,...i.formState},jt({...i,formState:{...p,...i.formState}})),Ze=(i,l={})=>{for(const d of i?qe(i):u.mount)u.mount.delete(d),u.array.delete(d),l.keepValue||(W(a,d),W(c,d)),!l.keepError&&W(t.errors,d),!l.keepDirty&&W(t.dirtyFields,d),!l.keepTouched&&W(t.touchedFields,d),!l.keepIsValidating&&W(t.validatingFields,d),!s.shouldUnregister&&!l.keepDefaultValue&&W(n,d);j.state.next({values:q(c)}),j.state.next({...t,...l.keepDirty?{isDirty:Y()}:{}}),!l.keepIsValid&&V()},wt=({disabled:i,name:l})=>{if(me(i)&&o.mount||i||u.disabled.has(l)){const m=u.disabled.has(l)!==!!i;i?u.disabled.add(l):u.disabled.delete(l),m&&o.mount&&!o.action&&V()}},Xe=(i,l={})=>{let d=v(a,i);const f=me(l.disabled)||me(s.disabled),m=!u.registerName.has(i)&&d&&d._f&&!d._f.mount;return M(a,i,{...d||{},_f:{...d&&d._f?d._f:{ref:{name:i}},name:i,mount:!0,...l}}),u.mount.add(i),d&&!m?wt({disabled:me(l.disabled)?l.disabled:s.disabled,name:i}):ge(i,!0,l.value),{...f?{disabled:l.disabled||s.disabled}:{},...s.progressive?{required:!!l.required,min:Me(l.min),max:Me(l.max),minLength:Me(l.minLength),maxLength:Me(l.maxLength),pattern:Me(l.pattern)}:{},name:i,onChange:xe,onBlur:xe,ref:x=>{if(x){u.registerName.add(i),Xe(i,l),u.registerName.delete(i),d=v(a,i);const g=U(x.value)&&x.querySelectorAll&&x.querySelectorAll("input,select,textarea")[0]||x,b=qr(g),N=d._f.refs||[];if(b?N.find($=>$===g):g===d._f.ref)return;M(a,i,{_f:{...d._f,...b?{refs:[...N.filter(tt),g,...Array.isArray(v(n,i))?[{}]:[]],ref:{type:g.type,name:i}}:{ref:g}}}),ge(i,!1,void 0,g)}else d=v(a,i,{}),d._f&&(d._f.mount=!1),(s.shouldUnregister||l.shouldUnregister)&&!(Rr(u.array,i)&&o.action)&&u.unMount.add(i)}}},Je=()=>s.shouldFocusError&&!s.shouldUseNativeValidation&&Le(a,je,u.mount),Cs=i=>{me(i)&&(j.state.next({disabled:i}),Le(a,(l,d)=>{const f=v(a,d);f&&(l.disabled=f._f.disabled||i,Array.isArray(f._f.refs)&&f._f.refs.forEach(m=>{m.disabled=f._f.disabled||i}))},0,!1))},Nt=(i,l)=>async d=>{let f;d&&(d.preventDefault&&d.preventDefault(),d.persist&&d.persist());let m=q(c);if(j.state.next({isSubmitting:!0}),s.resolver){const{errors:x,values:g}=await O();E(),t.errors=x,m=q(g)}else await K({fields:a,eventType:Ce.SUBMIT});if(u.disabled.size)for(const x of u.disabled)W(m,x);if(W(t.errors,ms),Q(t.errors)){j.state.next({errors:{}});try{await i(m,d)}catch(x){f=x}}else l&&await l({...t.errors},d),Je(),setTimeout(Je);if(j.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Q(t.errors)&&!f,submitCount:t.submitCount+1,errors:t.errors}),f)throw f},Vs=(i,l={})=>{v(a,i)&&(U(l.defaultValue)?ee(i,q(v(n,i))):(ee(i,l.defaultValue),M(n,i,q(l.defaultValue))),l.keepTouched||W(t.touchedFields,i),l.keepDirty||(W(t.dirtyFields,i),t.isDirty=l.defaultValue?Y(i,q(v(n,i))):Y()),l.keepError||(W(t.errors,i),S.isValid&&V()),j.state.next({...t}))},At=(i,l={})=>{const d=i?q(i):n,f=q(d),m=Q(i),x=f,g=a;if(l.keepDefaultValues||(n=d),!l.keepValues){if(l.keepDirtyValues){const b=new Set([...u.mount,...Object.keys(ke(n,c,void 0,g))]);for(const N of Array.from(b)){const $=v(t.dirtyFields,N),se=v(c,N),ye=v(x,N);$&&!U(se)?M(x,N,se):!$&&!U(ye)&&ee(N,ye)}}else{if(Ye&&U(i))for(const b of u.mount){const N=v(a,b);if(N&&N._f){const $=Array.isArray(N._f.refs)?N._f.refs[0]:N._f.ref;if(We($)){const se=$.closest("form");if(se){se.reset();break}}}}if(l.keepFieldsRef)for(const b of u.mount)ee(b,v(x,b));else a={}}if(s.shouldUnregister){if(c=l.keepDefaultValues?q(n):{},l.keepFieldsRef)for(const b of u.mount)M(c,b,v(x,b))}else c=q(x);j.array.next({values:{...x}}),j.state.next({name:void 0,type:void 0,values:{...x}})}u={mount:l.keepDirtyValues?u.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!S.isValid||!!l.keepIsValid||!!l.keepDirtyValues||!s.shouldUnregister&&!Q(x),o.watch=!!s.shouldUnregister,o.keepIsValid=!!l.keepIsValid,o.action=!1,l.keepErrors||(t.errors={}),j.state.next({submitCount:l.keepSubmitCount?t.submitCount:0,isDirty:m?!1:l.keepDirty?t.isDirty:l.keepValues?Y():!!(l.keepDefaultValues&&!he(i,n)),isSubmitted:l.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:m?{}:l.keepDirtyValues?l.keepDefaultValues&&c?ke(n,c,void 0,g):t.dirtyFields:l.keepDefaultValues&&i?ke(n,i,void 0,g):l.keepDirty?t.dirtyFields:{},touchedFields:l.keepTouched?t.touchedFields:{},errors:l.keepErrors?t.errors:{},isSubmitSuccessful:l.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:n})},Tt=(i,l)=>At(ce(i)?i(c):i,{...s.resetOptions,...l}),_s=(i,l={})=>{const d=v(a,i),f=d&&d._f;if(f){const m=f.refs?f.refs[0]:f.ref;m.focus&&setTimeout(()=>{m.focus(),l.shouldSelect&&ce(m.select)&&m.select()})}},Ps=i=>{const{name:l,type:d,values:f,...m}=i;t={...t,...m}},kt={control:{register:Xe,unregister:Ze,getFieldState:bt,handleSubmit:Nt,setError:ze,_subscribe:jt,_runSchema:O,_updateIsValidating:E,_focusError:Je,_getWatch:w,_getDirty:Y,_setValid:V,_setFieldArray:ne,_setDisabledField:wt,_setErrors:oe,_getFieldArray:de,_reset:At,_resetDefaultValues:()=>ce(s.defaultValues)&&s.defaultValues().then(i=>{Tt(i,s.resetOptions),j.state.next({isLoading:!1})}),_removeUnmounted:Se,_disableForm:Cs,_subjects:j,_proxyFormState:S,get _fields(){return a},get _formValues(){return c},get _state(){return o},set _state(i){o=i},get _defaultValues(){return n},get _names(){return u},set _names(i){u=i},get _formState(){return t},get _options(){return s},set _options(i){s={...s,...i},_=Be(s.mode),L=Be(s.reValidateMode)}},subscribe:Es,trigger:Ee,register:Xe,handleSubmit:Nt,watch:ks,setValue:ee,setValues:te,getValues:Fe,reset:Tt,resetField:Vs,resetDefaultValues:(i,l={})=>{if(n=q(i),!l.keepDirty){const d=ke(n,c,void 0,a);t.dirtyFields=d,t.isDirty=!Q(d)}l.keepIsValid||V(),j.state.next({...t,defaultValues:n})},clearErrors:St,unregister:Ze,setError:ze,setFocus:_s,getFieldState:bt};return{...kt,formControl:kt}}function si(e={}){const s=re.useRef(void 0),t=re.useRef(void 0),a=re.useRef(e.formControl),[n,c]=re.useState(()=>({...q(Ns),isLoading:ce(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ce(e.defaultValues)?void 0:e.defaultValues}));if(!s.current||e.formControl&&a.current!==e.formControl)if(a.current=e.formControl,e.formControl)s.current={...e.formControl,formState:n},e.defaultValues&&!ce(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:u,...y}=ti(e);s.current={...y,formState:n}}const o=s.current.control;return o._options=e,Ur(()=>{const u=o._subscribe({formState:o._proxyFormState,callback:()=>c({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return c(y=>({...y,isReady:!0})),o._formState.isReady=!0,u},[o]),re.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),re.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),re.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),re.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),re.useEffect(()=>{if(o._proxyFormState.isDirty){const u=o._getDirty();u!==n.isDirty&&o._subjects.state.next({isDirty:u})}},[o,n.isDirty]),re.useEffect(()=>{var u;e.values&&!he(e.values,t.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((u=o._options.resetOptions)===null||u===void 0)&&u.keepIsValid||o._setValid(),t.current=e.values,c(y=>({...y}))):o._resetDefaultValues()},[o,e.values]),re.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),s.current.formState=re.useMemo(()=>Lr(n,o),[o,n]),s.current}const Qt=(e,s,t)=>{if(e&&"reportValidity"in e){const a=v(t,s);e.setCustomValidity(a&&a.message||""),e.reportValidity()}},dt=(e,s)=>{for(const t in s.fields){const a=s.fields[t];a&&a.ref&&"reportValidity"in a.ref?Qt(a.ref,t,e):a&&a.refs&&a.refs.forEach(n=>Qt(n,t,e))}},Zt=(e,s)=>{s.shouldUseNativeValidation&&dt(e,s);const t={};for(const a in e){const n=v(s.fields,a),c=Object.assign(e[a]||{},{ref:n&&n.ref});if(ri(s.names||Object.keys(e),a)){const o=Object.assign({},v(t,a));M(o,"root",c),M(t,a,o)}else M(t,a,c)}return t},ri=(e,s)=>{const t=Xt(s).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(a=>Xt(a).match(`^${t}\\.\\d+`))};function Xt(e){return e.replace(/[\[\]]/g,"")}function ut(){return ut=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var t=arguments[s];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ut.apply(null,arguments)}function Jt(e,s){try{var t=e()}catch(a){return s(a)}return t&&t.then?t.then(void 0,s):t}function ii(e,s){for(var t={};e.length;){var a=e[0],n=a.code,c=a.message,o=a.path.join(".");if(!t[o])if("unionErrors"in a){var u=a.unionErrors[0].errors[0];t[o]={message:u.message,type:u.code}}else t[o]={message:c,type:n};if("unionErrors"in a&&a.unionErrors.forEach(function(T){return T.errors.forEach(function(_){return e.push(_)})}),s){var y=t[o].types,A=y&&y[a.code];t[o]=vt(o,s,t,n,A?[].concat(A,a.message):a.message)}e.shift()}return t}function ai(e,s){for(var t={},a=function(){var n=e[0],c=n.code,o=n.message,u=n.path.join(".");if(!t[u])if(n.code==="invalid_union"&&n.errors.length>0){var y=n.errors[0][0];t[u]={message:y.message,type:y.code}}else t[u]={message:o,type:c};if(n.code==="invalid_union"&&n.errors.forEach(function(_){return _.forEach(function(L){return e.push(ut({},L,{path:[].concat(n.path,L.path)}))})}),s){var A=t[u].types,T=A&&A[n.code];t[u]=vt(u,s,t,c,T?[].concat(T,n.message):n.message)}e.shift()};e.length;)a();return t}function ni(e,s,t){if(t===void 0&&(t={}),(function(a){return"_def"in a&&typeof a._def=="object"&&"typeName"in a._def})(e))return function(a,n,c){try{return Promise.resolve(Jt(function(){return Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](a,s)).then(function(o){return c.shouldUseNativeValidation&&dt({},c),{errors:{},values:t.raw?Object.assign({},a):o}})},function(o){if((function(u){return Array.isArray(u?.issues)})(o))return{values:{},errors:Zt(ii(o.errors,!c.shouldUseNativeValidation&&c.criteriaMode==="all"),c)};throw o}))}catch(o){return Promise.reject(o)}};if((function(a){return"_zod"in a&&typeof a._zod=="object"})(e))return function(a,n,c){try{return Promise.resolve(Jt(function(){return Promise.resolve((t.mode==="sync"?zs:$s)(e,a,s)).then(function(o){return c.shouldUseNativeValidation&&dt({},c),{errors:{},values:t.raw?Object.assign({},a):o}})},function(o){if((function(u){return u instanceof Bs})(o))return{values:{},errors:Zt(ai(o.issues,!c.shouldUseNativeValidation&&c.criteriaMode==="all"),c)};throw o}))}catch(o){return Promise.reject(o)}};throw new Error("Invalid input: not a Zod schema")}const oi=e=>{const s=Ke(),{pushError:t}=qs(),{data:a}=ns({...os(),staleTime:1/0}),n=a?.accounts.find(y=>y.accountId===e)?.composeLanguages,c=I.useMemo(()=>n&&n.length>0?[...n]:Ws(navigator.languages),[n]),o=pe({...ht(),onSuccess:()=>{s.invalidateQueries({queryKey:we()})},onError:y=>{t(Gs("Couldn't save languages","The writing languages weren't saved.",y))}}),u=I.useCallback(y=>{e&&o.mutate({path:{accountId:e},body:{composeLanguages:y}})},[e,o]);return{languages:c,setLanguages:u,isSaving:o.isPending}},li=e=>e.authType==="oauthMicrosoft",ci=e=>{const s=e.smtpUsername?.trim();return s?s!==e.username:!1},di=Zs({email:Xs(),displayName:Te().optional(),username:Te().optional(),password:Te().optional(),imapHost:Te().min(1,"IMAP host is required"),imapPort:Mt().int().min(1).max(65535),imapTls:Oe(),imapStartTls:Oe(),smtpHost:Te().optional(),smtpPort:Mt().int().min(1).max(65535).optional(),smtpTls:Oe().optional(),smtpStartTls:Oe().optional(),smtpUsername:Te().optional(),smtpPassword:Te().optional(),useDifferentSmtpCreds:Oe().optional()}),ui=({isOpen:e,onClose:s,account:t,focusSmtp:a})=>{const n=Ke(),c=!!t,[o,u]=I.useState(""),[y,A]=I.useState(!1),T=Ft(o),_=!!T&&!y,L=I.useRef(null),p=si({resolver:ni(di),defaultValues:{email:"",displayName:"",username:"",password:"",imapHost:"",imapPort:993,imapTls:!0,imapStartTls:!1,smtpHost:"",smtpPort:587,smtpTls:!1,smtpStartTls:!0,useDifferentSmtpCreds:!1}});I.useEffect(()=>{if(t){const h=ci(t);p.reset({email:t.email,displayName:t.displayName||"",username:t.username||"",password:"",imapHost:t.imapHost,imapPort:t.imapPort,imapTls:t.imapTls,imapStartTls:t.imapStartTls,smtpHost:t.smtpHost||"",smtpPort:t.smtpPort||587,smtpTls:t.smtpTls||!1,smtpStartTls:t.smtpStartTls||!0,smtpUsername:h&&t.smtpUsername||"",smtpPassword:"",useDifferentSmtpCreds:h})}else p.reset({email:"",displayName:"",username:"",password:"",imapHost:"",imapPort:993,imapTls:!0,imapStartTls:!1,smtpHost:"",smtpPort:587,smtpTls:!1,smtpStartTls:!0,useDifferentSmtpCreds:!1})},[t,p]);const S=pe({...Ks()}),k=pe({...Ys(),onSuccess:()=>{n.invalidateQueries({queryKey:we()}),s()}}),j=pe({...ht(),onSuccess:()=>{n.invalidateQueries({queryKey:we()}),s()}}),le=()=>{const h=p.getValues(),R=c&&!h.password;S.mutate({body:{accountId:R?t?.accountId:void 0,username:h.username||h.email,password:R?void 0:h.password||void 0,imapHost:h.imapHost,imapPort:Number(h.imapPort),imapTls:h.imapTls,imapStartTls:h.imapStartTls}})},C=()=>{const h=p.getValues(),R=c&&!h.password;S.mutate({body:{accountId:R?t?.accountId:void 0,username:h.username||h.email,password:R?void 0:h.password||void 0,imapHost:h.imapHost,imapPort:Number(h.imapPort),imapTls:h.imapTls,imapStartTls:h.imapStartTls,smtpHost:h.smtpHost||void 0,smtpPort:h.smtpPort?Number(h.smtpPort):void 0,smtpTls:h.smtpTls,smtpStartTls:h.smtpStartTls,smtpUsername:h.useDifferentSmtpCreds?h.smtpUsername:void 0,smtpPassword:h.useDifferentSmtpCreds?h.smtpPassword:void 0}})},P=p.handleSubmit(h=>{if(!c&&!h.password){p.setError("password",{message:"Password is required"});return}const R=vr({imapHost:h.imapHost,smtpHost:h.smtpHost,smtpPort:h.smtpPort,smtpTls:h.smtpTls,smtpStartTls:h.smtpStartTls});R&&(p.setValue("smtpHost",R.smtpHost),p.setValue("smtpPort",R.smtpPort),p.setValue("smtpTls",R.smtpTls),p.setValue("smtpStartTls",R.smtpStartTls));const ee=R?.smtpHost??h.smtpHost,te=R?.smtpPort??h.smtpPort,xe=R?.smtpTls??h.smtpTls,je=R?.smtpStartTls??h.smtpStartTls,Ee={email:h.email,displayName:h.displayName?.trim()||void 0,username:h.username||void 0,imapHost:h.imapHost,imapPort:Number(h.imapPort),imapTls:h.imapTls,imapStartTls:h.imapStartTls,smtpHost:ee||void 0,smtpPort:te?Number(te):void 0,smtpTls:xe,smtpStartTls:je,smtpUsername:h.useDifferentSmtpCreds&&h.smtpUsername||void 0,smtpPassword:h.useDifferentSmtpCreds&&h.smtpPassword||void 0};if(c&&t){const Fe={...Ee,password:h.password||void 0};j.mutate({path:{accountId:t.accountId},body:Fe})}else{const Fe={...Ee,password:h.password};k.mutate({body:Fe})}}),V=k.isPending||j.isPending,{signature:E,setSignature:J,isSaving:ne}=yr(t?.accountId),[H,oe]=I.useState(E.plainText),{languages:ae,setLanguages:ge,isSaving:F}=oi(t?.accountId),D=r.jsxs("section",{children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Writing languages"}),r.jsx(Pr,{value:ae,onChange:ge,busy:F})]});I.useEffect(()=>{oe(E.plainText)},[E.plainText]),I.useEffect(()=>{if(!e||!a)return;const h=L.current;if(!h)return;const R=window.setTimeout(()=>{h.scrollIntoView({behavior:"smooth",block:"start"})},250);return()=>window.clearTimeout(R)},[e,a]);const O=I.useCallback(()=>{H!==E.plainText&&J(H,H)},[H,E.plainText,J]),z=h=>{const{tls:R,startTls:ee}=$e(h);p.setValue("imapTls",R),p.setValue("imapStartTls",ee);const te=p.getValues("imapPort");(te===993||te===143)&&p.setValue("imapPort",h==="tls"?993:143)},G=h=>{const{tls:R,startTls:ee}=$e(h);p.setValue("smtpTls",R),p.setValue("smtpStartTls",ee);const te=p.getValues("smtpPort");if(te===465||te===587||te===25){const je=h==="tls"?465:h==="starttls"?587:25;p.setValue("smtpPort",je)}},K=()=>{const h=p.getValues("imapHost");p.setValue("smtpHost",br(h)),p.setValue("smtpTls",!1),p.setValue("smtpStartTls",!0),p.setValue("smtpPort",587)},Se=h=>{u(h),A(!1);const R=Ft(h);if(!R)return;const ee=$e(R.imap.security);p.setValue("imapHost",R.imap.host),p.setValue("imapPort",R.imap.port),p.setValue("imapTls",ee.tls),p.setValue("imapStartTls",ee.startTls);const te=$e(R.smtp.security);p.setValue("smtpHost",R.smtp.host),p.setValue("smtpPort",R.smtp.port),p.setValue("smtpTls",te.tls),p.setValue("smtpStartTls",te.startTls);const xe=p.getValues("email").trim(),je=p.getValues("username")?.trim();xe&&!je&&p.setValue("username",xe)},Y=T?.passwordHelp.text,w=It(S.data?.imapError,Y),de=It(S.data?.smtpError,Y);return(t?li(t):!1)&&c?r.jsx(Ot,{isOpen:e,onClose:s,title:"Edit Account",footer:r.jsx(ie,{type:"button",variant:"secondary",onClick:s,children:"Close"}),children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("section",{children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Microsoft 365 Account"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-md border border-line bg-surface-sunken px-3 py-2.5 text-sm text-fg-muted",children:[r.jsx("span",{className:"block text-2xs font-medium uppercase tracking-wider text-fg-subtle mb-1",children:"Email"}),r.jsx("span",{className:"text-fg",children:t?.email})]}),r.jsxs("div",{className:"rounded-md border border-line bg-surface-sunken px-3 py-2.5 text-sm text-fg-muted",children:[r.jsx("span",{className:"block text-2xs font-medium uppercase tracking-wider text-fg-subtle mb-1",children:"Authentication"}),r.jsx("span",{className:"text-fg",children:"Microsoft OAuth (XOAUTH2)"})]}),r.jsx("p",{className:"text-xs text-fg-muted",children:"Server settings are managed automatically for Microsoft 365 accounts. To update credentials, use the Reconnect button."})]})]}),c&&r.jsxs("section",{children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Signature"}),r.jsx("div",{className:"space-y-3",children:r.jsxs("div",{children:[r.jsx("label",{htmlFor:"email-sig-view",className:"text-sm font-medium mb-1.5 block",children:"Email Signature"}),r.jsx("textarea",{id:"email-sig-view",value:H,onChange:h=>oe(h.target.value),onBlur:O,rows:5,className:"w-full px-3 py-2 border border-line rounded-md bg-surface-sunken text-sm text-fg placeholder:text-fg-subtle focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors resize-y outline-none",placeholder:"Enter your email signature..."}),r.jsx("p",{className:"text-xs text-fg-muted mt-1",children:ne?"Saving signature...":"This signature will be appended to new emails."})]})})]}),c&&D]})}):r.jsx(Ot,{isOpen:e,onClose:s,title:c?"Edit Account":"Add Account",footer:r.jsxs(r.Fragment,{children:[r.jsx(ie,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),r.jsx(ie,{type:"submit",form:"account-form",variant:"primary",disabled:V,children:V?"Saving...":"Save Account"})]}),children:r.jsxs("form",{id:"account-form",onSubmit:P,className:"space-y-6",children:[r.jsxs("section",{children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Account Information"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"account-provider",className:"text-sm font-medium mb-1.5 block",children:"Provider"}),r.jsxs(Qs,{id:"account-provider",value:o,onChange:h=>Se(h.target.value),children:[r.jsx("option",{value:"",children:"Custom / other"}),ur.map(h=>r.jsx("option",{value:h.id,children:h.label},h.id))]}),r.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Pick your email provider to fill in server settings automatically, or choose Custom to enter them by hand."})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"account-email",className:"text-sm font-medium mb-1.5 block",children:"Email Address"}),r.jsx(be,{id:"account-email",...p.register("email"),placeholder:"alice@example.com"}),p.formState.errors.email&&r.jsx("p",{className:"text-sm text-danger mt-1",children:p.formState.errors.email.message})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"account-displayName",className:"text-sm font-medium mb-1.5 block",children:"Display name (optional)"}),r.jsx(be,{id:"account-displayName",...p.register("displayName"),placeholder:"Alice"}),r.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"What to call this account in Remit. Leave blank to use a name derived from the address."})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"account-username",className:"text-sm font-medium mb-1.5 block",children:"Username"}),r.jsx(be,{id:"account-username",...p.register("username"),placeholder:"Same as email if empty"})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"account-password",className:"text-sm font-medium mb-1.5 block",children:"Password"}),r.jsx(Ct,{id:"account-password",...p.register("password"),placeholder:c?"Leave empty to keep current":""}),p.formState.errors.password&&r.jsx("p",{className:"text-sm text-danger mt-1",children:p.formState.errors.password.message}),T&&r.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[T.passwordHelp.text," ",r.jsx("a",{href:T.passwordHelp.url,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline",children:"Get an app password"})]})]})]})]}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider",children:"Incoming Mail (IMAP)"}),T&&r.jsx("button",{type:"button",onClick:()=>A(h=>!h),className:"text-xs text-fg-muted hover:text-fg transition-colors",children:y?"Use preset settings":"Advanced"})]}),_&&r.jsxs("p",{className:"text-xs text-fg-muted mb-3",children:["Server settings are pre-filled for ",T?.label," and locked. Choose Advanced to edit them by hand."]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"imap-host",className:"text-sm font-medium mb-1.5 block",children:"Server"}),r.jsx(be,{id:"imap-host",...p.register("imapHost"),readOnly:_,placeholder:"imap.example.com"}),p.formState.errors.imapHost&&r.jsx("p",{className:"text-sm text-danger mt-1",children:p.formState.errors.imapHost.message})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"imap-port",className:"text-sm font-medium mb-1.5 block",children:"Port"}),r.jsx(be,{id:"imap-port",...p.register("imapPort"),readOnly:_,type:"number"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium mb-1.5 block",children:"Security"}),r.jsxs("div",{className:"space-y-1.5 mt-2",children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:_,checked:p.watch("imapTls"),onChange:()=>z("tls")}),"TLS (Port 993)"]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:_,checked:!p.watch("imapTls")&&p.watch("imapStartTls"),onChange:()=>z("starttls")}),"STARTTLS (Port 143)"]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:_,checked:!p.watch("imapTls")&&!p.watch("imapStartTls"),onChange:()=>z("none")}),"None (Unencrypted)"]})]})]})]}),r.jsx(ie,{type:"button",variant:"secondary",onClick:le,disabled:S.isPending,className:"w-full",icon:S.isPending?r.jsx(rt,{className:"size-4 animate-spin"}):void 0,children:S.isPending?"Testing...":"Test IMAP Connection"}),S.data&&r.jsxs("div",{className:Pe("p-2 rounded-md text-sm",S.data.imapSuccess?"bg-positive/10 text-positive":"bg-danger-soft text-danger"),children:[S.data.imapSuccess?r.jsx(Vt,{className:"inline size-4 mr-1"}):r.jsx(De,{className:"inline size-4 mr-1"}),S.data.imapSuccess?"IMAP Connected":w]})]})]}),r.jsxs("section",{ref:L,"data-testid":"smtp-section",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider",children:"Outgoing Mail (SMTP)"}),!_&&r.jsx("button",{type:"button",onClick:K,disabled:!p.watch("imapHost"),className:"text-xs text-fg-muted hover:text-fg transition-colors disabled:opacity-50",children:"Pre-fill from IMAP"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"smtp-host",className:"text-sm font-medium mb-1.5 block",children:"Server"}),r.jsx(be,{id:"smtp-host",...p.register("smtpHost"),readOnly:_,placeholder:"smtp.example.com"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"smtp-port",className:"text-sm font-medium mb-1.5 block",children:"Port"}),r.jsx(be,{id:"smtp-port",...p.register("smtpPort"),readOnly:_,type:"number"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium mb-1.5 block",children:"Security"}),r.jsxs("div",{className:"space-y-1.5 mt-2",children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:_,checked:p.watch("smtpTls")===!0,onChange:()=>G("tls")}),"TLS (Port 465)"]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:_,checked:!p.watch("smtpTls")&&p.watch("smtpStartTls")===!0,onChange:()=>G("starttls")}),"STARTTLS (Port 587)"]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:_,checked:!p.watch("smtpTls")&&!p.watch("smtpStartTls"),onChange:()=>G("none")}),"None (Unencrypted)"]})]})]})]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"checkbox",...p.register("useDifferentSmtpCreds")}),"Use different credentials for SMTP"]}),p.watch("useDifferentSmtpCreds")&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"smtp-username",className:"text-sm font-medium mb-1.5 block",children:"SMTP Username"}),r.jsx(be,{id:"smtp-username",...p.register("smtpUsername")})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"smtp-password",className:"text-sm font-medium mb-1.5 block",children:"SMTP Password"}),r.jsx(Ct,{id:"smtp-password",...p.register("smtpPassword")})]})]}),r.jsx(ie,{type:"button",variant:"secondary",onClick:C,disabled:S.isPending||!p.watch("smtpHost"),className:"w-full",icon:S.isPending?r.jsx(rt,{className:"size-4 animate-spin"}):void 0,children:S.isPending?"Testing...":"Test SMTP Connection"}),S.data?.smtpSuccess!==void 0&&r.jsxs("div",{className:Pe("p-2 rounded-md text-sm",S.data.smtpSuccess?"bg-positive/10 text-positive":"bg-danger-soft text-danger"),children:[S.data.smtpSuccess?r.jsx(Vt,{className:"inline size-4 mr-1"}):r.jsx(De,{className:"inline size-4 mr-1"}),S.data.smtpSuccess?"SMTP Connected":de]})]})]}),c&&r.jsxs("section",{children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Signature"}),r.jsx("div",{className:"space-y-3",children:r.jsxs("div",{children:[r.jsx("label",{htmlFor:"email-sig-edit",className:"text-sm font-medium mb-1.5 block",children:"Email Signature"}),r.jsx("textarea",{id:"email-sig-edit",value:H,onChange:h=>oe(h.target.value),onBlur:O,rows:5,className:"w-full px-3 py-2 border border-line rounded-md bg-surface-sunken text-sm text-fg placeholder:text-fg-subtle focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors resize-y outline-none",placeholder:"Enter your email signature..."}),r.jsx("p",{className:"text-xs text-fg-muted mt-1",children:ne?"Saving signature...":"This signature will be appended to new emails."})]})})]}),c&&D]})})},fi="https://graph.microsoft.com/",mi={[it.Mail]:["https://outlook.office.com/IMAP.AccessAsUser.All","https://outlook.office.com/SMTP.Send"],[it.Calendar]:[`${fi}Calendars.Read`]},hi=e=>{const s=new Set(e.map(t=>t.toLowerCase()));return Object.values(it).filter(t=>mi[t].every(a=>s.has(a.toLowerCase())))},ft=e=>`Couldn't turn ${e.service.toLowerCase()} ${e.intent}`,pi=e=>Js(er({title:`Bug: ${ft(e)}`,errorMessage:`${ft(e)} — ${e.message}`}));function gi({providerName:e,offered:s,enabled:t,consented:a,disabled:n,refusal:c,onRequestChange:o}){return s.length<2?null:r.jsxs("section",{className:"space-y-2 rounded-sm border border-line bg-surface px-row-inset py-3",children:[r.jsx(Vr,{providerName:e,offered:s,enabled:t,consented:a,disabled:n,onRequestChange:o}),c&&r.jsxs(at,{tone:"danger",variant:"soft",children:[r.jsx("p",{className:"font-medium",children:ft(c)}),r.jsx("p",{className:"mt-0.5 break-words text-fg-muted",children:c.message}),r.jsx("a",{href:pi(c),target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-block font-medium text-accent hover:underline",children:"Report an issue"})]})]})}const As=["Mail","Calendar"],es="Microsoft",ts=e=>e.authType==="oauthMicrosoft",ss=(e,s)=>As.filter(t=>t===s||e.includes(t));function xi({account:e,onRemoveAccount:s}){const t=Ke(),[a,n]=I.useState(null),[c,o]=I.useState(null),[u,y]=I.useState(null),A=pe({...ht(),meta:_t,onSuccess:()=>t.invalidateQueries({queryKey:we()})}),T=pe({...ls(),meta:_t}),_=ds(P=>{const V=u;y(null),!(P!=="stalled"||V===null)&&o({service:V,intent:"on",message:us})}),L=A.isPending&&A.variables?.body.syncedServices?A.variables.body.syncedServices:e.syncedServices,p=ts(e)?As:["Mail"],S=ts(e)?hi(e.grantedScopes):p,k=(P,V,E)=>{o(null),A.mutate({path:{accountId:e.accountId},body:{syncedServices:P}},{onError:J=>o({service:V,intent:E,message:Rt(J)})})},j=P=>{o(null),T.mutate({body:{email:e.email,services:ss(L,P)}},{onSuccess:V=>{y(P),_(),window.location.assign(V.authorizationUrl)},onError:V=>o({service:P,intent:"on",message:Rt(V)})})},le=(P,V)=>{if(V==="off"){n({kind:L.length===1?"last":"disable",service:P});return}if(!S.includes(P)){n({kind:"enable",service:P});return}k(ss(L,P),P,"on")},C=()=>{const P=a;if(n(null),P!==null){if(P.kind==="last"){s();return}if(P.kind==="enable"){j(P.service);return}k(L.filter(V=>V!==P.service),P.service,"off")}};return r.jsxs(r.Fragment,{children:[r.jsx(gi,{providerName:es,offered:p,enabled:L,consented:S,disabled:A.isPending||T.isPending||u!==null,refusal:c,onRequestChange:le}),r.jsx(Er,{change:a,providerName:es,onConfirm:C,onCancel:()=>n(null)})]})}function rs({open:e,onClose:s,accountEmail:t,signOut:a}){const[n,c]=I.useState(""),[o,u]=I.useState(!1),[y,A]=I.useState(!1),T=pe({...sr(),onSuccess:()=>{A(!0),setTimeout(()=>a(),2e3)}}),_=pe(rr()),L=()=>{T.isPending||(c(""),u(!1),A(!1),T.reset(),_.reset(),s())},p=()=>{if(n.trim().toLowerCase()!==t.toLowerCase()){u(!0);return}u(!1),T.mutate({body:{confirmEmail:n.trim()}})};return r.jsxs(cs,{open:e,onClose:L,title:"Delete your Remit account",children:[r.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[r.jsx(mt,{className:"size-4 shrink-0 text-danger"}),r.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:"Delete your Remit account"}),r.jsx(ie,{variant:"ghost",size:"sm",icon:r.jsx(De,{className:"size-3.5"}),onClick:L,"aria-label":"Cancel"})]}),y?r.jsxs("div",{className:"px-5 py-6 text-sm text-fg-muted",children:[r.jsx("p",{className:"font-medium text-fg",children:"Account deletion scheduled."}),r.jsx("p",{className:"mt-1",children:"Your data will be erased shortly. Signing you out…"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-4 px-5 py-4 text-sm text-fg-muted",children:[r.jsx("p",{children:"This permanently erases everything Remit holds for you:"}),r.jsxs("ul",{className:"space-y-1.5 text-xs",children:[r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"text-danger",children:"•"}),"All connected accounts disconnected and access tokens revoked."]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"text-danger",children:"•"}),"Synced mail cache and search index."]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"text-danger",children:"•"}),"AI history and insights."]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"text-danger",children:"•"}),"Preferences and rules."]})]}),r.jsxs("div",{className:"rounded-sm border border-line bg-surface-sunken px-3 py-2 text-xs",children:[r.jsx("strong",{className:"text-fg",children:"Your mail at Gmail / IMAP is not deleted."})," ","This only removes Remit's copy and its access — the mail stays in your provider mailboxes."]}),r.jsxs("div",{className:"text-xs",children:[r.jsxs("button",{type:"button",onClick:()=>_.mutate({}),"aria-busy":_.isPending,className:"inline-flex items-center gap-1.5 font-medium text-accent hover:underline",children:[r.jsx(jr,{className:"size-3.5"}),_.isPending?"Requesting export…":"Export my data first"]}),_.isSuccess&&r.jsx("p",{className:"mt-1.5 text-fg-muted",role:"status",children:"Export requested. We'll prepare a ZIP of your mail — find it under your data exports when it's ready."}),_.isError&&r.jsx("p",{className:"mt-1.5 text-danger",role:"alert",children:"Couldn't start the export. Please try again."})]}),r.jsxs("div",{children:[r.jsxs("label",{htmlFor:"confirm-remit-email",className:"mb-1 block text-xs font-medium text-fg",children:["Type"," ",r.jsx("span",{className:"font-mono text-fg-muted",children:t})," ","to confirm"]}),r.jsx(be,{id:"confirm-remit-email",type:"email",placeholder:t,value:n,onChange:S=>{c(S.target.value),o&&u(!1),T.isError&&T.reset()},autoComplete:"off"}),o&&r.jsx("p",{className:"mt-1.5 text-xs text-danger",role:"alert",children:"That doesn't match your account email. Type it exactly to confirm."}),T.isError&&r.jsx("p",{className:"mt-1.5 text-xs text-danger",role:"alert",children:T.error instanceof Error?T.error.message:"Something went wrong. Please try again."})]})]}),r.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[r.jsx(ie,{variant:"secondary",size:"sm",onClick:L,children:"Cancel"}),r.jsx(ie,{variant:"danger",size:"sm",onClick:p,"aria-busy":T.isPending,children:T.isPending?"Deleting…":"Delete everything"})]})]})]})}function yi(e){const{Account:s}=tr();return r.jsx(s,{fallback:r.jsx(rs,{...e,accountEmail:"",signOut:()=>{}}),children:({email:t,signOut:a})=>r.jsx(rs,{...e,accountEmail:t??"",signOut:a})})}function vi(){const[e,s]=I.useState(!1);return r.jsxs("section",{className:"mt-8 border-t border-line pt-6",children:[r.jsx(Dr,{title:"Delete your Remit account",description:"Disconnects every account and erases Remit's copy of your mail, insights and preferences. Your mail at the providers is untouched.",action:r.jsx(ie,{variant:"danger",size:"sm",onClick:()=>s(!0),children:"Delete your Remit account"})}),r.jsx(yi,{open:e,onClose:()=>s(!1)})]})}function Ts(e){const s=e.toLowerCase();return s==="access_denied"?"You cancelled the sign-in.":s==="scope_not_granted"?"Microsoft did not grant access to every service you picked. Sign in again and accept each permission Microsoft asks for.":s==="consent_required"||s.includes("admin_consent")||s.includes("interaction_required")?"Your organisation's admin needs to approve Remit. Ask your IT admin to grant the required permissions.":s.includes("imap_disabled")||s.includes("imap disabled")?"IMAP is disabled for this account. Ask your admin to enable IMAP access in the Microsoft 365 admin centre.":`Sign-in failed: ${e}. Please try again.`}const bi=e=>e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e[0]??"";function Si(e,s){const t=(e.missingServices??"").split(","),a=nt.filter(A=>t.includes(A.id)),n=e.oauthEmail,c=n?s.find(A=>A.authType==="oauthMicrosoft"&&A.email.toLowerCase()===n.toLowerCase()):void 0,o=bi(a.map(A=>A.label)),u=a.length===0?Ts("scope_not_granted"):`Microsoft did not grant access to ${o}. Sign in again and accept the ${o} ${a.length>1?"permissions":"permission"} when Microsoft asks.`,y=c?nt.filter(A=>c.syncedServices.includes(A.id)||a.some(T=>T.id===A.id)).map(A=>A.id):void 0;return{kind:"refused",message:u,email:n,services:y,reconnect:!!c}}function ji(e){const s=e.split("@")[0]??"";return s?s.split(/[._-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "):e}function wi(e){const s=e.displayName?.trim();return s||ji(e.email)}function Ni(e){if(!e.lastSyncAt)return"never synced";const s=dr(e.lastSyncAt);return s?`synced ${s}`:"never synced"}function is(e){return e.muted?.value?"muted":e.lastError?"error":e.connectionState==="authenticated"?"healthy":"error"}function as(e){return e.connectionState==="reauth_required"}function Ai(e){return e.connectionState==="credentials_missing"}const Ti=()=>r.jsx("div",{className:"space-y-3",role:"status","aria-busy":"true","aria-label":"Loading accounts",children:["skeleton-0","skeleton-1"].map(e=>r.jsx("div",{className:"rounded-sm border border-line bg-surface animate-pulse p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"size-10 rounded-full bg-surface-sunken"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-surface-sunken rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-2/3"})]})]})},e))});function Gi(){const e=Pt.useSearch(),s=ir({from:Pt.fullPath}),t=ar(),[a,n]=I.useState(!0),[c,o]=I.useState(!1),[u,y]=I.useState(!1),[A,T]=I.useState(void 0),[_,L]=I.useState(null),[p,S]=I.useState(!1),[k,j]=I.useState(null),[le,C]=I.useState(null),[P,V]=I.useState(null),[E,J]=I.useState(null),ne=Ke(),{data:H,isPending:oe,isError:ae,error:ge,refetch:F}=ns(os());I.useEffect(()=>{e.editAccountId&&(L(e.editAccountId),S(!!e.focusSmtp),s({search:{editAccountId:void 0,focusSmtp:void 0,connected:e.connected,oauthError:e.oauthError,oauthEmail:e.oauthEmail,missingServices:e.missingServices},replace:!0}))},[e.editAccountId,e.focusSmtp,s,e.connected,e.oauthError,e.oauthEmail,e.missingServices]),I.useEffect(()=>{e.connected&&(T({kind:"connected",accountId:e.connected}),y(!0),ne.invalidateQueries({queryKey:we()}),s({search:{connected:void 0,oauthError:void 0,editAccountId:void 0,focusSmtp:void 0},replace:!0}))},[e.connected,s,ne]),I.useEffect(()=>{if(!e.oauthError)return;const w=e.oauthError==="scope_not_granted";w&&!H&&!ae||(J(null),w?(T(Si({oauthEmail:e.oauthEmail,missingServices:e.missingServices},H?.accounts??[])),y(!0)):V(Ts(e.oauthError)),s({search:{oauthError:void 0,connected:void 0,editAccountId:void 0,focusSmtp:void 0},replace:!0}))},[e.oauthError,e.oauthEmail,e.missingServices,H,ae,s]),xr(E!==null,()=>{ne.invalidateQueries({queryKey:we()})}),I.useEffect(()=>{if(!E||!H)return;const w=H.accounts.find(de=>de.accountId===E);(!w||!as(w))&&J(null)},[H,E]);const D=ds(w=>{J(null),w==="stalled"&&V(us)}),O=pe({...ls(),onSuccess:w=>{D(),window.location.assign(w.authorizationUrl)},onError:w=>{V(w instanceof Error?w.message:"Failed to start reconnect"),J(null)}}),z=pe({...nr(),onSuccess:()=>{ne.invalidateQueries({queryKey:we()}),j(null)}}),G=H?.accounts.find(w=>w.accountId===k),K=H?.accounts.find(w=>w.accountId===_),Se=()=>{o(!1),y(!1),L(null),S(!1)},Y=w=>{const de=lr[w];de&&s({to:de})};return r.jsxs(pr,{items:t,activeId:"accounts",title:"Accounts",description:"Every account keeps syncing — muted ones just stay out of unified views.",help:wr,helpOpen:a,onToggleHelp:()=>n(w=>!w),onSelect:Y,onBackToMail:()=>{s({to:"/mail"})},children:[le&&r.jsx(at,{tone:"success",variant:"soft","data-testid":"oauth-success-banner",onDismiss:()=>C(null),children:le}),P&&r.jsx(at,{tone:"danger",variant:"soft","data-testid":"oauth-error-banner",onDismiss:()=>V(null),children:P}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(or,{tone:"neutral",children:oe||ae?"accounts":`${H.accounts.length} ${H.accounts.length===1?"account":"accounts"}`}),r.jsx(ie,{variant:"primary",size:"sm",icon:r.jsx(Dt,{className:"size-3.5"}),onClick:()=>y(!0),children:"Add account"})]}),oe?r.jsx(Ti,{}):ae?r.jsx(mr,{title:"Couldn't load accounts",error:ge,onRetry:()=>{F()}}):H.accounts.length===0?r.jsxs("div",{className:"py-12 text-sm text-fg-muted","data-testid":"accounts-empty",children:[r.jsx("p",{className:"mb-3",children:"No accounts configured."}),r.jsx(ie,{variant:"primary",size:"sm",icon:r.jsx(Dt,{className:"size-3.5"}),onClick:()=>y(!0),children:"Add your first account"})]}):r.jsx("div",{className:"space-y-3",children:H.accounts.map(w=>{const de=as(w),Ae=Ai(w),h=w.authType==="oauthMicrosoft",R=E===w.accountId,ee=de&&h?{label:"Reconnect",variant:"secondary",busy:R,busyLabel:"Redirecting…",onClick:()=>{J(w.accountId),O.mutate({body:{email:w.email,services:w.syncedServices}})}}:Ae?{label:"Enter password",variant:"secondary",onClick:()=>L(w.accountId)}:is(w)==="error"?{label:"Reconnect",variant:"secondary",onClick:()=>L(w.accountId)}:{label:"Manage",variant:"ghost",onClick:()=>L(w.accountId)},te=r.jsx(hr,{actions:[ee],destructive:{label:"Delete account",iconOnly:!0,icon:r.jsx(cr,{className:"size-3.5"}),onClick:()=>j(w.accountId)}});return r.jsxs("div",{className:"space-y-2",children:[r.jsx(gr,{label:wi(w),email:w.email,connector:h?"Microsoft 365":"IMAP",syncLabel:Ni(w),state:is(w),errorDetail:de?w.lastError??"Re-authentication required":Ae?"Imported from a config file, which carries no password. Enter one to start syncing.":w.lastError,trailing:te}),r.jsx(xi,{account:w,onRemoveAccount:()=>j(w.accountId)})]},w.accountId)})}),u&&r.jsx("div",{className:"fixed inset-0 z-40 overflow-auto bg-canvas",children:r.jsx(fr,{skipWelcome:!0,microsoftReturn:A,onComplete:()=>{A?.kind==="connected"&&C("Account connected successfully."),y(!1),T(void 0),ne.invalidateQueries({queryKey:we()})},onCancel:()=>{y(!1),T(void 0)}})}),r.jsx(ui,{isOpen:c||!!_,account:K,focusSmtp:p,onClose:Se}),r.jsxs(cs,{open:!!k,onClose:()=>j(null),title:"Delete account",children:[r.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[r.jsx(mt,{className:"size-4 shrink-0 text-danger"}),r.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:"Delete account"}),r.jsx(ie,{variant:"ghost",size:"sm",icon:r.jsx(De,{className:"size-3.5"}),onClick:()=>j(null),"aria-label":"Cancel"})]}),r.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[r.jsx("p",{className:"text-center text-lg font-medium text-fg",children:"Are you sure?"}),G&&r.jsx("p",{className:"text-center",children:G.email}),r.jsxs("ul",{className:"list-inside list-disc space-y-1",children:[r.jsx("li",{children:"Remove the account from your settings"}),r.jsx("li",{children:"Stop syncing mail for this account"}),r.jsx("li",{children:"Delete all associated data (within 24 hours)"})]})]}),r.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[r.jsx(ie,{variant:"secondary",size:"sm",onClick:()=>j(null),children:"Cancel"}),r.jsx(ie,{variant:"danger",size:"sm","aria-busy":z.isPending,icon:z.isPending?r.jsx(rt,{className:"size-3.5 animate-spin"}):void 0,onClick:()=>{z.isPending||k&&z.mutate({path:{accountId:k}})},children:z.isPending?"Deleting…":"Delete account"})]})]}),r.jsx(vi,{})]})}export{Gi as component,Ts as mapOauthError,Si as scopeRefusalReturn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,aI as T,aR as y,B as r,aS as j,r as h,ai as u,d as S,L as g,e as k,aT as p,q as I,f as A,aU as U,aV as D,a7 as w,aW as L,aX as O,aY as B,u as E,aK as V,aN as _}from"./index-4XPoPWhu.js";import{S as Y}from"./settings-screen-ZYutaKzZ.js";import{e as F}from"./config-import-DTjV5c_Y.js";import"./reply-FoVQqDdv.js";import{u as H}from"./sections-DiFHIPo4.js";import{C as M,a as P,b as G,c as J}from"./card-WB75jB_w.js";import{D as N}from"./download-CtoLQ9Ox.js";import{F as W}from"./file-json-B4YU26EQ.js";import{E as C}from"./external-link-Dn2gWGrg.js";import{R as v}from"./rotate-ccw-C-agNTCI.js";import{C as b}from"./circle-check-Bifl6wEJ.js";import{C as q}from"./cloud-off-CsGOr1Gn.js";import{C as Q}from"./clock-A6ewTncv.js";import{S as $}from"./shield-check-DDrlOAO3.js";import{b as K}from"./help-copy-CQIBCXJf.js";import"./avatar-B4KRzyzS.js";import"./menu-D06KWsdQ.js";import"./circle-help-Cyj92MDS.js";import"./useMediaQuery-a7SamL-l.js";import"./kbd-D0eWE7Kp.js";const X=["Remit restarts. Mail stops loading for about a minute and this page will lose its connection while that happens.","Nothing is sent, deleted or moved. Your mail stays at your provider.","If the new version does not come back up, the version you are running now is restored automatically."];function Z({open:s,currentVersion:n,release:a,appliesSchemaMigration:t=!1,onClose:c,onConfirm:i}){return s?e.jsx(T,{open:!0,onClose:c,title:`Install Remit ${a.version}`,children:e.jsxs("div",{className:"flex max-h-[80vh] flex-col",children:[e.jsxs("header",{className:"space-y-1 border-b border-line px-4 py-3",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Install Remit ",a.version,"?"]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["You are on ",n,". ",a.version," was released"," ",y(a.releasedAt),"."]})]}),e.jsxs("div",{className:"flex-1 space-y-3 overflow-auto px-4 py-3",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:a.summary}),e.jsxs("ul",{className:"space-y-2",children:[X.map(l=>e.jsxs("li",{className:"flex gap-2 text-sm text-fg-muted",children:[e.jsx("span",{className:"mt-1.5 size-1.5 shrink-0 rounded-full bg-fg-subtle"}),e.jsx("span",{children:l})]},l)),t&&e.jsxs("li",{className:"flex gap-2 text-sm text-fg-muted",children:[e.jsx("span",{className:"mt-1.5 size-1.5 shrink-0 rounded-full bg-fg-subtle"}),e.jsx("span",{children:"This version updates the database while Remit is offline. The step forward cannot be undone by hand, but a failed start is still rolled back to the version and data you have now."})]})]}),e.jsx("p",{className:"text-xs text-fg-subtle",children:"Good moment for this: when you are not waiting on a message."})]}),e.jsxs("footer",{className:"flex flex-wrap items-center justify-end gap-2 border-t border-line px-4 py-3",children:[e.jsx(r,{variant:"ghost",size:"sm",onClick:c,children:"Not now"}),e.jsx(j,{variant:"secondary",size:"sm",external:!0,href:a.releaseNotesUrl,icon:e.jsx(C,{className:"size-3.5"}),children:"Release notes"}),e.jsx(r,{size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:i,children:"Install and restart"})]})]})}):null}function o({children:s,tone:n}){return e.jsx("div",{className:I("rounded-sm border bg-surface px-row-inset py-3",n==="danger"?"border-danger/50":"border-line"),children:s})}function ee({state:s,onCheck:n,onInstall:a,onDismissResult:t,now:c=Date.now()}){const[i,l]=h.useState(null),m=s.status==="checking",d=s.status==="available",x=()=>{if(m){l("Already checking. The result appears here in a moment.");return}l(null),n()},z=()=>{t(),x()},f=()=>{if(!d&&s.status!=="rolledBack"&&s.status!=="abandoned"){l("There is no update to install. Check for updates first — if one is found it appears here.");return}l(null),a()},R=(()=>{switch(s.status){case"upToDate":return e.jsx(o,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(b,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg",children:["Remit ",s.version," is the latest version.",e.jsxs("span",{className:"text-fg-subtle",children:[" ","Checked ",p(s.checkedAt,c),"."]})]})]}),e.jsx(r,{variant:"secondary",size:"sm",className:"shrink-0",onClick:x,children:"Check again"})]})});case"checking":return e.jsx(o,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(g,{className:"size-4 shrink-0 animate-spin text-fg-subtle","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["Looking for a newer version. You are on ",s.version,"."]})]}),e.jsx(r,{variant:"secondary",size:"sm",className:"shrink-0",onClick:x,children:"Check again"})]})});case"neverChecked":return e.jsx(o,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[e.jsx(Q,{className:"mt-0.5 size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["No update check has run yet. Remit checks for updates on its own in the background.",s.lastCheckedAt!==void 0&&e.jsxs("span",{className:"text-fg-subtle",children:[" ","Last checked"," ",p(s.lastCheckedAt,c),"."]})]})]}),e.jsx(r,{variant:"secondary",size:"sm",className:"shrink-0",onClick:x,children:"Check now"})]})});case"checkFailed":return e.jsx(o,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(q,{className:"mt-0.5 size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm text-fg",children:"Could not reach the update source."}),e.jsx("p",{className:"text-xs text-fg-muted",children:s.reason}),e.jsxs("p",{className:"text-xs text-fg-subtle",children:["You are still on ",s.version," and it keeps working.",s.lastCheckedAt!==void 0&&e.jsxs(e.Fragment,{children:[" ","Last successful check"," ",p(s.lastCheckedAt,c),"."]})]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(r,{variant:"secondary",size:"sm",onClick:x,children:"Try again"})})]})});case"available":return e.jsx(o,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-semibold text-fg",children:["Remit ",s.release.version]}),e.jsx(k,{tone:"accent",children:"update available"}),e.jsxs("span",{className:"text-2xs text-fg-subtle",children:["released ",y(s.release.releasedAt)," · you are on ",s.version]})]}),e.jsx("p",{className:"text-sm text-fg-muted",children:s.release.summary}),e.jsx("p",{className:"text-xs text-fg-subtle",children:"Installing restarts Remit, so mail stops loading for about a minute. If the new version does not come back up, the one you are running now is restored on its own."}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(r,{size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:f,children:["Install ",s.release.version]}),e.jsx(j,{variant:"secondary",size:"sm",external:!0,href:s.release.releaseNotesUrl,icon:e.jsx(C,{className:"size-3.5"}),children:"Release notes"})]})]})});case"applying":return e.jsx(o,{children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(g,{className:"size-4 shrink-0 animate-spin text-accent-2","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["Installing Remit ",s.target,". The restart screen has the details."]})]})});case"succeeded":return e.jsxs(e.Fragment,{children:[e.jsx(S,{tone:"success",onDismiss:t,children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"font-semibold",children:["Updated to Remit ",s.version,"."]}),e.jsxs("p",{children:["You were on ",s.previousVersion,"."," ",e.jsx("a",{href:s.releaseNotesUrl,target:"_blank",rel:"noopener noreferrer",className:"underline",children:"See what changed"}),"."]})]})}),e.jsx(o,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(b,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg",children:["Remit ",s.version," is running."]})]}),e.jsx(r,{variant:"secondary",size:"sm",className:"shrink-0",onClick:z,children:"Check for updates"})]})})]});case"rolledBack":return e.jsx(o,{tone:"danger",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(u,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Remit ",s.attemptedVersion," did not start. Remit reports that it put ",s.version," back."]}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["You are running ",s.version," again. A failed update can still have changed things on the way — the log below is the only account of what it got as far as doing."]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"What Remit reported as the failure"}),e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s.reason})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"Read the full log before trying again:"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(r,{variant:"secondary",size:"sm",icon:e.jsx(v,{className:"size-3.5"}),onClick:f,children:["Try ",s.attemptedVersion," again"]}),e.jsxs(r,{variant:"ghost",size:"sm",onClick:t,children:["Stay on ",s.version]})]})]})});case"unreachable":return e.jsx(o,{tone:"danger",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(u,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Installing ",s.attemptedVersion," left the server unreachable."]}),e.jsx("p",{className:"text-sm text-fg-muted",children:"Remit has answered again since, but nothing here can say what happened during the silence."})]})]}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand}),e.jsx("div",{className:"flex justify-end",children:e.jsx(r,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})})]})});case"rollbackFailed":return e.jsx(o,{tone:"danger",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(u,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Remit ",s.attemptedVersion," did not start, and Remit could not put ",s.previousVersion," back."]}),e.jsx("p",{className:"text-sm text-fg-muted",children:"This is the one outcome Remit cannot resolve on its own. The server is in a half-changed state and needs you at a shell. The log below is the only account of where it stopped."})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"What Remit reported as the failure"}),e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s.reason})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"Read the full log on the server:"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(r,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})})]})});case"abandoned":return e.jsx(o,{tone:"danger",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(u,{className:"mt-0.5 size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Remit ",s.attemptedVersion," was not installed. Nothing changed."]}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["The update stopped before it altered anything. You are still running ",s.version,"."]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"What Remit reported"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.reason})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"Read the full log before trying again:"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(r,{variant:"secondary",size:"sm",icon:e.jsx(v,{className:"size-3.5"}),onClick:f,children:["Try ",s.attemptedVersion," again"]}),e.jsxs(r,{variant:"ghost",size:"sm",onClick:t,children:["Stay on ",s.version]})]})]})});default:return s}})();return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Updates"}),e.jsx("p",{className:"text-xs text-fg-muted",children:"This Remit runs on your own server, so it updates when you say so. Your mail lives at your provider and is never touched by an update."})]}),R,i&&e.jsx("p",{role:"status",className:"text-xs text-fg-muted",children:i})]})}function se({fileName:s,state:n="ready",error:a,onDownload:t,onImport:c}){const i=n==="downloading";return e.jsxs(M,{className:"max-w-xl",children:[e.jsx(P,{children:e.jsx(G,{children:"Configuration file"})}),e.jsxs(J,{children:[e.jsx("p",{className:"text-sm text-fg-muted",children:"One versioned JSON document carrying every setting this instance holds: accounts and their servers, folder roles, rules, labels, flagged senders and appearance. No passwords and no OAuth tokens — you sign in again wherever you import it."}),n==="failed"&&e.jsxs("div",{className:"mt-3 space-y-2 rounded-sm border border-danger/40 bg-danger-soft px-3 py-2.5",children:[e.jsx("p",{className:"text-sm font-medium text-danger",children:"The config file could not be written."}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Nothing was downloaded. Try again — if it keeps failing, use"," ",e.jsx("code",{className:"rounded bg-surface-sunken px-1 py-0.5",children:"remit config save"})," ","on the host in the meantime."]}),a&&e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:a})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsx(r,{variant:"secondary",size:"sm",disabled:i,icon:i?e.jsx(g,{className:"size-3.5 animate-spin"}):e.jsx(N,{className:"size-3.5"}),onClick:t,children:i?"Preparing…":`Download ${s}`}),e.jsx(k,{tone:"neutral",children:"no passwords"})]}),e.jsxs("p",{className:"mt-3 text-2xs text-fg-subtle",children:["On the host, the same file comes from"," ",e.jsxs("code",{className:"rounded bg-surface-sunken px-1 py-0.5",children:["remit config save ~/",s]}),"."]}),e.jsxs("div",{className:"mt-5 border-t border-line pt-4",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"Import a config file"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Read a file from another Reader into this one. It shows what will change before anything is written, and asks for each account's credentials afterwards."}),e.jsx(r,{className:"mt-3",variant:"secondary",size:"sm",icon:e.jsx(W,{className:"size-3.5"}),onClick:c,children:"Import a config file"})]})]})]})}const ae=(s,n)=>{const a=URL.createObjectURL(new Blob([JSON.stringify(n,null,2)],{type:"application/json"})),t=document.createElement("a");t.href=a,t.download=s,t.click(),URL.revokeObjectURL(a)};function te(){const s=A(),n=H(),[a,t]=h.useState("ready"),[c,i]=h.useState(void 0),l=F(new Date),m=()=>{a!=="downloading"&&(t("downloading"),i(void 0),s.fetchQuery(U()).then(d=>{ae(l,d.document),t("ready")}).catch(d=>{t("failed"),i(d instanceof Error?d.message:"GET /config/export did not answer with a configuration.")}))};return e.jsx(se,{fileName:l,state:a,error:c,onDownload:m,onImport:()=>n("importConfig")})}function ne(){const{surface:s,release:n,currentVersion:a,appliesSchemaMigration:t,onCheck:c,install:i,onDismissResult:l}=D(),[m,d]=h.useState(!1);return s.status!=="ready"?null:e.jsxs(e.Fragment,{children:[e.jsx(ee,{state:s.section,onCheck:c,onInstall:()=>d(!0),onDismissResult:l}),n&&a&&e.jsx(Z,{open:m,currentVersion:a,release:n,appliesSchemaMigration:t,onClose:()=>d(!1),onConfirm:()=>{d(!1),i(n.version)}})]})}function ie(){return w().tlsMode!=="internal"?null:e.jsxs("div",{className:"border-t border-line pt-4 mt-4",children:[e.jsx("p",{className:"text-sm font-medium text-fg mb-1",children:"TLS root certificate"}),e.jsx("p",{className:"text-sm text-fg-muted mb-2",children:"This deployment signs its own certificate. Import it into the trust store of each device you browse from, and the browser warning stops for good."}),e.jsx(j,{href:"/tls-root-ca.crt",download:!0,variant:"secondary",size:"sm",icon:e.jsx($,{className:"size-3.5"}),children:"Download root certificate"})]})}function re(s){try{return new Date(s).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return s}}function le({sha:s=O,commitUrl:n=L,buildTime:a=B}){return e.jsxs("p",{className:"text-xs text-fg-subtle",children:["Version"," ",n?e.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"font-mono hover:text-fg-muted hover:underline",children:s}):e.jsx("span",{className:"font-mono",children:s})," · ",e.jsxs("span",{children:["Built ",re(a)]})]})}function Se(){const s=E(),n=V(),[a,t]=h.useState(!0),c=i=>{const l=_[i];l&&s({to:l})};return e.jsxs(Y,{items:n,activeId:"advanced",title:"Advanced",description:"Notification rules, export, and diagnostics.",help:K,helpOpen:a,onToggleHelp:()=>t(i=>!i),onSelect:c,onBackToMail:()=>{s({to:"/mail"})},children:[w().updateMode==="self"&&e.jsx(ne,{}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsx(te,{})}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsx("p",{className:"text-sm text-fg-muted",children:"Notification rules are coming in a future release."})}),e.jsx(ie,{}),e.jsxs("div",{className:"border-t border-line pt-4 mt-4",children:[e.jsx("p",{className:"text-sm font-medium text-fg mb-1",children:"About"}),e.jsx(le,{})]})]})}export{Se as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as x,aK as y,r as a,a$ as S,j as e,b0 as l,aN as v,b1 as b}from"./index-4XPoPWhu.js";import{S as N}from"./settings-screen-ZYutaKzZ.js";import{c as T}from"./help-copy-CQIBCXJf.js";import"./avatar-B4KRzyzS.js";import"./menu-D06KWsdQ.js";import"./circle-help-Cyj92MDS.js";import"./kbd-D0eWE7Kp.js";const o="remit.density";function j(){return typeof localStorage>"u"?"comfortable":localStorage.getItem(o)??"comfortable"}function _(){const s=x(),i=y(),[r,c]=a.useState(!0),[m,p]=a.useState(j),[d,h]=a.useState(S),f=t=>{p(t),typeof localStorage<"u"&&localStorage.setItem(o,t)},u=t=>{h(t),b(t)},g=t=>{const n=v[t];n&&s({to:n})};return e.jsx(N,{items:i,activeId:"appearance",title:"Appearance",description:"Display density and colour theme — instant-apply.",help:T,helpOpen:r,onToggleHelp:()=>c(t=>!t),onSelect:g,onBackToMail:()=>{s({to:"/mail"})},children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"Density"}),e.jsx(l,{name:"density","aria-label":"Density",value:m,onChange:f,options:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}]}),e.jsx("p",{className:"text-xs text-fg-subtle",children:"Controls the spacing of message rows in the mail list."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"Theme"}),e.jsx(l,{name:"theme","aria-label":"Theme",value:d,onChange:u,options:[{value:"system",label:"System"},{value:"light",label:"Light"},{value:"dark",label:"Dark"}]}),e.jsx("p",{className:"text-xs text-fg-subtle",children:"Applies immediately. System default follows your OS preference."})]})]})})}export{_ as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as h,
|
|
1
|
+
import{r as a,j as h,q as u}from"./index-4XPoPWhu.js";const p={sm:"size-7 text-2xs",md:"size-9 text-sm",lg:"size-11 text-md"},n=["oklch(0.6 0.08 150)","oklch(0.6 0.08 185)","oklch(0.6 0.08 215)","oklch(0.6 0.07 250)","oklch(0.6 0.07 310)","oklch(0.62 0.07 110)"],d="oklch(0.97 0.012 90)";function f(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}function m({name:e,email:t,size:l="md",className:c}){const i=a.useMemo(()=>{const r=t??e;let s=0;for(let o=0;o<r.length;o++)s=s*31+r.charCodeAt(o)>>>0;return n[s%n.length]},[e,t]);return h.jsx("span",{className:u("inline-flex shrink-0 items-center justify-center rounded-full font-semibold select-none",p[l],c),style:{backgroundColor:i,color:d},"aria-hidden":!0,children:f(e)})}export{m as A};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{o as N,r as n,p as k,j as a,q as g}from"./index-4XPoPWhu.js";const R=320,C="cubic-bezier(0.32, 0.9, 0.3, 1)",E=.5,P=.4,T=360;function A(s){return Math.sign(s)*Math.sqrt(Math.abs(s))*4}function L({open:s,onClose:l,children:S,label:Y,dismissLabel:y="Dismiss"}){N({id:"bottom-sheet",open:s,answers:{back:l}});const b=n.useRef(null),f=n.useRef(null),[i,M]=n.useState(T),[m,u]=n.useState(null);k(f,s),n.useLayoutEffect(()=>{const t=b.current;if(!t)return;const e=()=>M(t.offsetHeight);e();const r=new ResizeObserver(e);return r.observe(t),()=>r.disconnect()},[]);const c=n.useRef(null),j=n.useCallback(t=>{t.currentTarget.setPointerCapture(t.pointerId),c.current={startY:t.clientY,lastY:t.clientY,lastT:t.timeStamp,velocity:0,moved:!1},u(0)},[]),w=n.useCallback(t=>{const e=c.current;if(!e)return;const r=t.timeStamp-e.lastT;r>0&&(e.velocity=(t.clientY-e.lastY)/r),e.lastY=t.clientY,e.lastT=t.timeStamp;const o=t.clientY-e.startY;Math.abs(o)>4&&(e.moved=!0);const I=o<0?A(o):o;u(I)},[]),h=n.useCallback(()=>{const t=c.current;if(c.current=null,!t)return;const e=t.lastY-t.startY,o=t.velocity>E||e>i*P;u(null),o&&l()},[i,l]),x=m!==null,p=s?m??0:i,d=Math.min(Math.max(1-p/i,0),1),v=x?"none":`transform ${R}ms ${C}`;return a.jsxs("div",{className:g("absolute inset-0 z-40 select-none overflow-hidden",s||x?"":"pointer-events-none"),children:[a.jsx("button",{type:"button","aria-label":y,tabIndex:-1,onClick:l,className:g("absolute inset-0 bg-black/40",d>0?"pointer-events-auto":"pointer-events-none"),style:{opacity:d*.6,transition:v.replace("transform","opacity")}}),a.jsxs("div",{ref:b,role:"dialog","aria-modal":"true","aria-labelledby":"bottom-sheet-title","aria-hidden":!s,inert:!s,className:"absolute inset-x-0 bottom-0 flex max-h-[92%] flex-col rounded-t-3xl border-t border-line bg-surface pb-[env(safe-area-inset-bottom,0px)] shadow-2xl shadow-black/30",style:{transform:`translateY(${p}px)`,transition:v},children:[a.jsx("h2",{id:"bottom-sheet-title",className:"sr-only",children:Y}),a.jsx("div",{role:"slider","aria-label":"Drag down to dismiss","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(d*100),tabIndex:-1,onPointerDown:j,onPointerMove:w,onPointerUp:h,onPointerCancel:h,className:"flex cursor-grab touch-none justify-center pb-1 pt-2.5 active:cursor-grabbing",children:a.jsx("div",{className:"h-1 w-10 rounded-full bg-fg-subtle/40"})}),a.jsx("div",{ref:f,tabIndex:-1,className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:S})]})]})}export{L as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r,O as i}from"./index-4XPoPWhu.js";import{a as m}from"./MailShell-C7RoeX76.js";import{B as o}from"./BriefPane-DZbE8ZNv.js";import"./reply-FoVQqDdv.js";import{a as p}from"./search-token-index-C7o7PQIx.js";import{u as e}from"./search-mirror-B5Imt12Z.js";import"./useMessageBodyContent-ClVl7CBj.js";import"./FullCompose-BdpPcB8J.js";import"./ErrorState-DcP5ZTMN.js";import"./index-BNUBjW43.js";import"./useSignature-rM5axmpY.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-B0BMCu3v.js";import"./sections-DiFHIPo4.js";import"./useMediaQuery-a7SamL-l.js";import"./confirm-dialog-9Q6aXOb5.js";import"./MessageBody-B3Z3zu18.js";import"./kbd-D0eWE7Kp.js";import"./search-scope-UI1H6AzA.js";import"./MessageToolbar-DpBF7XWc.js";import"./roving-focus-Cj3j6dFs.js";import"./EmptyState-DcHnaG2R.js";import"./popover-menu-BT-fkOr5.js";import"./avatar-B4KRzyzS.js";import"./useQueries-XPiXhlQX.js";import"./undo-2-C6aYHE3s.js";import"./DropdownMenu-CowSyQUa.js";import"./download-CtoLQ9Ox.js";import"./calendar-suggestion-BppH-3oL.js";import"./sparkles-MrqvyWps.js";import"./useCalendarSuggestions-D6k1REyo.js";import"./calendar-format-BwCpz-JZ.js";import"./calendar-failure-note-BJCyTf1U.js";import"./checkbox-BXzuviQP.js";import"./clock-A6ewTncv.js";import"./shield-check-DDrlOAO3.js";import"./calendar-miAZmlW9.js";import"./useLayoutTier-DtUqYCCh.js";import"./menu-D06KWsdQ.js";import"./useFilters-C_nA08Aa.js";import"./cloud-off-CsGOr1Gn.js";import"./useRefreshControl-C9tPndY1.js";import"./circle-check-big-BrmrabN6.js";import"./refresh-cw-BERt5E10.js";import"./LabelApplyTrigger-c7ugtEyT.js";import"./useLabels-Dn9qgr5w.js";import"./wizard-selection-zWa1qc6-.js";function rr(){const t=p();return e({to:"/mail/brief"}),r.jsx(o,{thread:t,children:r.jsx(m,{phone:r.jsx(o.Phone,{}),list:r.jsx(o.List,{}),reading:r.jsx(i,{}),intelligence:r.jsx(o.Intelligence,{}),hasThread:!!t})})}export{rr as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./index-
|
|
1
|
+
import{j as r}from"./index-4XPoPWhu.js";import{E as t}from"./ErrorState-DcP5ZTMN.js";const i=({error:e,reset:o})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(t,{title:"Couldn't load your mailboxes",error:e,onRetry:o})});export{i as errorComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,T as g,X as j,
|
|
1
|
+
import{j as e,T as g,X as j,q as N,C as v,ca as C}from"./index-4XPoPWhu.js";import{P as y}from"./pencil-CA6DIP59.js";import{M as k}from"./useCalendarSuggestions-D6k1REyo.js";function z({failure:s,focusRef:a}){return e.jsxs("div",{ref:a,role:"alert",tabIndex:-1,className:"flex flex-col gap-2 rounded-md border border-danger/40 bg-danger-soft p-3 text-sm outline-none",children:[e.jsx("p",{className:"text-danger",children:s.text}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:s.onRetry,className:"rounded-md border border-line bg-surface px-3 py-1 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:s.retryLabel??"Try again"}),e.jsx("a",{href:s.reportHref,target:"_blank",rel:"noreferrer",className:"text-sm font-medium text-accent hover:underline",children:"Report an issue"})]})]})}const l="flex size-9 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40";function T({headingId:s,headingRef:a,title:n,color:c,when:o,location:r,calendarName:x,availability:m,onEdit:t,onDelete:i,deleting:u=!1,onClose:f,failure:d,failureRef:b,children:h}){const p=C(c);return e.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[e.jsxs("div",{className:"flex justify-end gap-1",children:[t&&e.jsx("button",{type:"button","aria-label":"Edit",onClick:t,className:l,children:e.jsx(y,{className:"size-4"})}),i&&e.jsx("button",{type:"button","aria-label":"Delete",onClick:i,disabled:u,className:l,children:e.jsx(g,{className:"size-4"})}),e.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:l,children:e.jsx(j,{className:"size-4"})})]}),e.jsxs("div",{className:"flex gap-3 px-2",children:[e.jsx("span",{className:N("mt-1.5 size-3.5 shrink-0 rounded-sm",p.solid),"aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{id:s,ref:a,tabIndex:-1,className:"text-xl font-normal break-words text-fg outline-none",children:n===""?"(No title)":n}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:o})]})]}),e.jsxs("dl",{className:"flex flex-col gap-2 px-2 text-sm",children:[r!==""&&e.jsxs("div",{className:"flex gap-3",children:[e.jsx("dt",{children:e.jsx(k,{className:"size-4 text-fg-subtle","aria-label":"Location"})}),e.jsx("dd",{className:"min-w-0 break-words",children:r})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("dt",{children:e.jsx(v,{className:"size-4 text-fg-subtle","aria-label":"Calendar"})}),e.jsxs("dd",{children:[x," · ",m]})]})]}),h,d&&e.jsx(z,{failure:d,focusRef:b})]})}function E({headingId:s,onClose:a,closeRef:n}){return e.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[e.jsx("h2",{id:s,className:"text-base font-medium text-fg",children:"This event was deleted or moved"}),e.jsx("button",{ref:n,type:"button",onClick:a,className:"self-end rounded-md border border-line px-3 py-1.5 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Close"})]})}export{z as C,E as a,T as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as _,
|
|
1
|
+
import{r as _,q as h,j as s,av as g,g0 as S,cj as y,g1 as I,au as z,X as U}from"./index-4XPoPWhu.js";import{i as W,c as B,C as G}from"./calendar-guests-BCC1uGzd.js";import{C as J}from"./calendar-event-popup-Dbcz3Zb_.js";const L=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],P=["January","February","March","April","May","June","July","August","September","October","November","December"],H=["first","second","third","fourth","last"],N="";function Q(e,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[a,r,i]=e.split("-").map(Number),d=new Date(Date.UTC(a,r-1,i)),o=L[d.getUTCDay()],m=H[Math.min(Math.floor((i-1)/7),4)],l=n===""?"":`, ${n}`,c=d.getUTCDay()>=1&&d.getUTCDay()<=5;return[`Every day${l}`,...c?[`Every weekday${l}`]:[],`Every week on ${o}${l}`,`Every month on the ${m} ${o}${l}`,`Every year on ${i} ${P[r-1]}${l}`]}const v=({draft:e,onChange:n},a,r)=>n({...e,[a]:r});function b({label:e,children:n}){return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),n]})}function w(e){return e.date===""||e.endDate===""?!1:e.allDay?e.endDate<e.date:e.startTime===""||e.endTime===""?!1:`${e.endDate}T${e.endTime}`<`${e.date}T${e.startTime}`}function q(e,n){return n===""?{...e,date:n}:e.endDate===""?{...e,date:n,endDate:n}:e.date===""?{...e,date:n}:{...e,date:n,endDate:y(n,I(e.date,e.endDate))}}function K(e,n){const a=e.date!==""&&e.endDate===y(e.date,1)&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime;return n&&a?{...e,allDay:n,endDate:e.date}:!n&&e.date!==""&&e.endDate===e.date&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime?{...e,allDay:n,endDate:y(e.date,1)}:{...e,allDay:n}}function X({draft:e,onChange:n,touch:a}){const r=a?"min-h-11":"",i=w(e),d=_.useId(),o={"aria-invalid":i,"aria-describedby":i?d:void 0},m=h("w-40",r,i&&"border-danger/60"),l=h("w-28",r,i&&"border-danger/60");return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(g,{type:"date",value:e.date,"aria-label":"Date",...o,onChange:c=>n(q(e,c.target.value)),className:m}),!e.allDay&&s.jsx(g,{type:"time",value:e.startTime,"aria-label":"Start time",...o,onChange:c=>v({draft:e,onChange:n},"startTime",c.target.value),className:l}),s.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),s.jsx(g,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...o,onChange:c=>v({draft:e,onChange:n},"endDate",c.target.value),className:m}),!e.allDay&&s.jsx(g,{type:"time",value:e.endTime,"aria-label":"End time",...o,onChange:c=>v({draft:e,onChange:n},"endTime",c.target.value),className:l}),s.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[s.jsx("input",{type:"checkbox",checked:e.allDay,onChange:c=>n(K(e,c.target.checked)),className:"size-4 accent-current"}),"All day"]})]}),i&&s.jsx("p",{id:d,className:"text-xs text-danger",role:"alert",children:e.allDay?`Ends before it starts. Move the end to ${e.date} or later.`:`Ends before it starts. Move the end past ${e.date} ${e.startTime}, or start earlier.`})]})}function Y({draft:e,onChange:n,touch:a,repeatEditable:r=!0,onCustom:i}){return r?s.jsx(V,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:d=>v({draft:e,onChange:n},"repeat",d),onCustom:i,className:a?"min-h-11":""}):s.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[s.jsx(S,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===N?"Does not repeat":e.repeat]})}const E="__custom__";function V({value:e,date:n,startTime:a,onChange:r,onCustom:i,className:d}){const o=Q(n,a),m=e===N||o.includes(e)?o:[e,...o];return s.jsxs(z,{icon:s.jsx(S,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:l=>{if(l.target.value===E){i?.();return}r(l.target.value)},className:d,children:[s.jsx("option",{value:N,children:"Does not repeat"}),m.map(l=>s.jsx("option",{value:l,children:l},l)),i&&s.jsx("option",{value:E,children:"Custom…"})]})}const Z="h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30 disabled:opacity-60";function te({heading:e,draft:n,onChange:a,calendars:r,calendarEditable:i,repeatEditable:d,timeZone:o,timeZones:m,onTimeZone:l,busy:c,onBusy:$,onSave:A,onCancel:f,saving:j=!1,saveLabel:M="Save",problem:T="",failure:D,failureRef:F,titleRef:O,touch:x=!1,children:R,guests:u}){const p=h(Z,x&&"h-11"),C=w(n),k=u!==void 0&&W(n.guests)!==void 0;return s.jsxs("form",{"aria-label":e,"data-event-sidebar":"",className:"flex h-full min-h-0 flex-col bg-surface",onSubmit:t=>{t.preventDefault(),!j&&!C&&!k&&A()},children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-line px-4 py-2",children:[s.jsx("h2",{className:"text-base font-medium text-fg",children:e}),s.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:h("flex items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",x?"size-11":"size-8"),children:s.jsx(U,{className:"size-4"})})]}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4",children:[s.jsx("input",{ref:O,"aria-label":"Title",placeholder:"Add title",value:n.title,onChange:t=>a({...n,title:t.target.value}),className:"border-b-2 border-line bg-transparent pb-1 text-xl text-fg outline-none placeholder:text-fg-subtle focus:border-accent"}),s.jsx(X,{draft:n,onChange:a,touch:x}),s.jsx(b,{label:"Time zone",children:s.jsx("select",{"aria-label":"Time zone",value:o,onChange:t=>l(t.target.value),className:p,children:m.map(t=>s.jsx("option",{value:t,children:t},t))})}),s.jsx(b,{label:"Repeat",children:s.jsx(Y,{draft:n,onChange:a,touch:x,repeatEditable:d})}),s.jsx(b,{label:"Calendar",children:s.jsx("select",{"aria-label":"Calendar",value:n.calendarId,disabled:!i,onChange:t=>a({...n,calendarId:t.target.value}),className:p,children:r.map(t=>s.jsx("option",{value:t.id,children:t.name},t.id))})}),s.jsx(b,{label:"Location",children:s.jsx("input",{"aria-label":"Location",placeholder:"Add location",value:n.location,onChange:t=>a({...n,location:t.target.value}),className:p})}),s.jsx(b,{label:"Show as",children:s.jsxs("select",{"aria-label":"Show as",value:c?"busy":"free",onChange:t=>$(t.target.value==="busy"),className:p,children:[s.jsx("option",{value:"busy",children:"Busy"}),s.jsx("option",{value:"free",children:"Free"})]})}),s.jsx(b,{label:"Description",children:s.jsx("textarea",{"aria-label":"Description",placeholder:"Add description",rows:5,value:n.notes,onChange:t=>a({...n,notes:t.target.value}),className:"w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30"})}),u&&s.jsx(b,{label:"Guests",children:s.jsx(B,{value:n.guests,onChange:t=>a({...n,guests:t}),suggestions:u.suggestions,onQuery:u.onQuery,touch:x})}),u&&n.guests.length>0&&u.senders.length>0&&s.jsxs(b,{label:"Send invitations from",children:[s.jsx(G,{label:"Send invitations from",senders:u.senders,value:u.sender,onChange:u.onSender,disabled:!u.senderEditable,touch:x}),s.jsx("p",{className:"mt-1 text-xs text-fg-muted",children:"Default set in Settings, Calendars"})]}),R]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-t border-line px-4 py-3",children:[T!==""&&s.jsx("p",{role:"alert",className:"text-sm text-danger",children:T}),D&&s.jsx(J,{failure:D,focusRef:F}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{type:"button",onClick:f,className:h("rounded-md border border-line px-4 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",x?"min-h-11":"h-9"),children:"Cancel"}),s.jsx("button",{type:"submit",disabled:j||C||k,className:h("rounded-md bg-accent px-5 text-sm font-medium text-accent-fg hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",x?"min-h-11":"h-9"),children:j?"Saving…":M})]})]})]})}export{te as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,
|
|
1
|
+
import{j as e,ai as n,q as t}from"./index-4XPoPWhu.js";function l({text:a,reportHref:r,className:s}){return e.jsxs("div",{role:"alert",className:t("flex items-start gap-1.5 rounded-md border border-danger/40 bg-danger-soft p-2 text-xs text-danger",s),children:[e.jsx(n,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":!0}),e.jsxs("p",{className:"min-w-0 flex-1",children:[a,r&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:r,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]})]})]})}export{l as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as v,j as e,
|
|
1
|
+
import{b as v,j as e,q as x,X as f,r as b,ax as C}from"./index-4XPoPWhu.js";import{C as k}from"./calendar-event-popup-Dbcz3Zb_.js";import{C as w}from"./circle-help-Cyj92MDS.js";const z=v("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);const G=v("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]),I=/^[^\s@<>",;]+@[^\s@<>",;]+\.[^\s@<>",;]+$/,L=/^\s*"?([^"<]*?)"?\s*<([^>]+)>\s*$/;function h(a){const s=a.trim(),t=L.exec(s),i=(t?.[2]??s).trim().toLowerCase(),l=t?.[1]?.trim()??"";return{text:s,email:i,displayName:l===""?i:l,valid:I.test(i)}}function Y(a,s){return{text:a,email:a,displayName:s===""?a:s,valid:!0}}function A(a,s){return s.valid&&a.some(t=>t.email===s.email)?[...a]:[...a,s]}function q(a){return a.find(s=>!s.valid)}const D="inline-flex max-w-full items-center gap-1 rounded-full border px-2 py-0.5 text-sm";function B({value:a,onChange:s,suggestions:t,onQuery:i,touch:l=!1}){const o=b.useId(),c=b.useId(),[u,g]=b.useState(""),d=a,m=d.find(n=>!n.valid),p=n=>{if(n.trim()==="")return;const r=t.find(y=>y.email===n.trim().toLowerCase()),N=h(r?r.name===""?r.email:`${r.name} <${r.email}>`:n);s(A(d,N)),g(""),i("")},j=n=>s(d.filter(r=>r!==n));return e.jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&e.jsx("ul",{"aria-label":"Guests",className:"flex flex-wrap gap-1.5",children:d.map(n=>e.jsxs("li",{className:x(D,n.valid?"border-line bg-surface-sunken text-fg":"border-danger bg-danger-soft text-danger"),children:[e.jsx("span",{className:"truncate",children:n.valid?n.displayName:n.text}),e.jsx("button",{type:"button","aria-label":`Remove ${n.valid?n.email:n.text}`,onClick:()=>j(n),className:"rounded-full p-0.5 hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(f,{className:"size-3"})})]},n.text))}),e.jsx("input",{"aria-label":"Guests","aria-describedby":m?c:void 0,"aria-invalid":m?!0:void 0,placeholder:"Add guests",list:o,value:u,onChange:n=>{const r=n.target.value;if(/[,;]$/.test(r)){p(r.slice(0,-1));return}g(r),i(r)},onKeyDown:n=>{n.key!=="Enter"||u.trim()===""||(n.preventDefault(),p(u))},onBlur:()=>p(u),className:x("h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",l&&"h-11")}),e.jsx("datalist",{id:o,children:t.map(n=>e.jsx("option",{value:n.email,children:n.name},n.email))}),m&&e.jsxs("p",{id:c,role:"status",className:"text-sm text-danger",children:[m.text," is not an email address. Fix or remove it to save."]})]})}function H({label:a,senders:s,value:t,onChange:i,disabled:l=!1,touch:o=!1}){return e.jsx("select",{"aria-label":a,value:t,disabled:l,onChange:c=>i(c.target.value),className:x("h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30 disabled:opacity-60",o&&"h-11"),children:s.map(c=>e.jsx("option",{value:c.accountId,children:c.email},c.accountId))})}const M=[["accepted","yes"],["declined","no"],["tentative","maybe"],["needsAction","awaiting"]],S=a=>M.flatMap(([s,t])=>a[s]===0?[]:[`${a[s]} ${t}`]).join(", "),$=a=>a==="accepted"?e.jsx(C,{className:"size-3.5 text-positive","aria-label":"Yes"}):a==="declined"?e.jsx(f,{className:"size-3.5 text-danger","aria-label":"No"}):a==="tentative"?e.jsx(w,{className:"size-3.5 text-fg-muted","aria-label":"Maybe"}):e.jsx(z,{className:"size-3.5 text-fg-subtle","aria-label":"Awaiting"});function T({attendees:a,counts:s}){return a.length===0?null:e.jsxs("section",{"aria-label":"Guests",className:"flex flex-col gap-1.5 px-2 text-sm",children:[e.jsxs("p",{className:"font-medium text-fg",children:[a.length," ",a.length===1?"guest":"guests"]}),e.jsx("p",{className:"text-fg-muted",children:S(s)}),e.jsx("ul",{className:"flex flex-col gap-1",children:a.map(t=>e.jsxs("li",{className:"flex items-center gap-2",children:[$(t.rsvp),e.jsx("span",{className:"min-w-0 truncate",children:t.name===""?t.email:t.name}),t.role==="organizer"&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-xs text-fg-muted",children:[e.jsx(G,{className:"size-3","aria-hidden":"true"}),"Organizer"]})]},t.email))})]})}const E=[["accepted","Yes"],["declined","No"],["tentative","Maybe"]];function W({current:a,onAnswer:s,sending:t=!1,failure:i}){return e.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-2 pt-3",children:[e.jsxs("fieldset",{className:"flex items-center gap-2",children:[e.jsx("legend",{className:"sr-only",children:"Going?"}),e.jsx("span",{"aria-hidden":"true",className:"mr-1 text-sm text-fg",children:"Going?"}),E.map(([l,o])=>e.jsx("button",{type:"button","aria-pressed":a===l,disabled:t,onClick:()=>s(l),className:x("h-8 rounded-full border px-3 text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60",a===l?"border-accent bg-accent text-accent-fg":"border-line hover:bg-surface-sunken"),children:o},l))]}),i&&e.jsx(k,{failure:i})]})}function _({missed:a,onRetry:s,reportHref:t,onDismiss:i}){if(a.length===0)return null;const l=a.join(", ");return e.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[e.jsxs("p",{className:"text-danger",children:["Saved, but the ",a.length===1?"invitation":"invitations"," to"," ",l," didn't go out."]}),e.jsx("button",{type:"button",onClick:s,className:"rounded-md border border-line bg-surface px-3 py-1 font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Try again"}),e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"}),e.jsx("button",{type:"button","aria-label":"Dismiss",onClick:i,className:"ml-auto rounded-full p-1 text-fg-muted hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(f,{className:"size-4"})})]})}function K({guests:a,onDismiss:s}){return a.length===0?null:e.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-3 rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm",children:[e.jsxs("p",{className:"text-fg",children:["Deleted. A cancellation is going to ",a.join(", "),"."]}),e.jsx("button",{type:"button","aria-label":"Dismiss",onClick:s,className:"ml-auto rounded-full p-1 text-fg-muted hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(f,{className:"size-4"})})]})}export{H as C,K as a,_ as b,B as c,T as d,W as e,q as i,Y as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as B,r as c,u as k,J as i,
|
|
1
|
+
import{K as B,r as c,u as k,J as i,cP as O,cR as C,ct as F}from"./index-4XPoPWhu.js";import{g as R}from"./reply-FoVQqDdv.js";function y(e,n){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const a=!!(e.condition??!0),t=e.blockerFn;return{shouldBlockFn:async()=>a&&t!==void 0?await t():a,enableBeforeUnload:a,withResolver:t===void 0}}function j(e,n){const{shouldBlockFn:a,enableBeforeUnload:t=!0,disabled:s=!1,withResolver:h=!1}=y(e),u=B(),{history:d}=u,[f,v]=c.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return c.useEffect(()=>{const o=async r=>{function T(p){const w=u.parseLocation(p),m=u.getMatchedRoutes(w.pathname);return m.foundRoute===void 0?{routeId:"__notFound__",fullPath:w.pathname,pathname:w.pathname,params:m.routeParams,search:u.options.parseSearch(p.search)}:{routeId:m.foundRoute.id,fullPath:m.foundRoute.fullPath,pathname:w.pathname,params:m.routeParams,search:u.options.parseSearch(p.search)}}const I=T(r.currentLocation),g=T(r.nextLocation);if(I.routeId==="__notFound__"&&g.routeId!=="__notFound__")return!1;const b=await a({action:r.action,current:I,next:g});if(!h)return b;if(!b)return!1;const E=await new Promise(p=>{v({status:"blocked",current:I,next:g,action:r.action,proceed:()=>p(!1),reset:()=>p(!0)})});return v({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),E};return s?void 0:d.block({blockerFn:o,enableBeforeUnload:t})},[a,t,s,h,d,u]),f}const l="/calendar/$view/$date",$="/calendar/$view/$date/suggestion/$suggestionId",_="/calendar/$view/$date/task/$calendarTaskId";function P(){const e=i({from:l,shouldThrow:!1}),n=O({from:l,shouldThrow:!1}),a=e?.view??"",t=e?.date??"",s=n?.calendarId;return c.useMemo(()=>({...C({view:a,date:t},F(new Date)),calendarIds:s??[]}),[a,t,s])}function S(){const e=i({from:"/calendar/$view/$date/$calendarObjectId",shouldThrow:!1}),n=i({from:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",shouldThrow:!1}),a=e?.calendarObjectId,t=n?.recurrenceId;return c.useMemo(()=>a?{calendarObjectId:a,recurrenceId:t}:void 0,[a,t])}function V(){return i({from:_,shouldThrow:!1})?.calendarTaskId}function D(){return i({from:$,shouldThrow:!1})?.suggestionId}function U(){const e=i({from:"/calendar/$view/$date/$calendarObjectId/edit",shouldThrow:!1}),n=i({from:"/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit",shouldThrow:!1}),a=e?.calendarObjectId??n?.calendarObjectId,t=n?.recurrenceId;return c.useMemo(()=>a?{calendarObjectId:a,recurrenceId:t}:void 0,[a,t])}function L(){const e=O({from:"/calendar/$view/$date/new",shouldThrow:!1}),n=e?.start,a=e?.end,t=e!==void 0;return c.useMemo(()=>t?{start:n,end:a}:void 0,[t,n,a])}function M(){const e=U(),n=i({from:"/calendar/$view/$date/new",shouldThrow:!1}),a=i({from:$,shouldThrow:!1});return n!==void 0||a!==void 0||e!==void 0}function K(){const e=k(),n=B(),a=R(),{view:t,date:s}=P(),h=S(),u=V(),d=h!==void 0||u!==void 0,f=c.useCallback(o=>{e({to:l,params:o,search:!0,hash:a})},[e,a]),v=c.useCallback(o=>n.buildLocation({to:l,params:{view:"day",date:o},search:!0,hash:a}).href,[n,a]);return c.useMemo(()=>({goToView:o=>f({view:o,date:s}),goToToday:()=>f({view:t,date:F(new Date)}),goToDate:o=>f({view:t,date:o}),setCalendarIds:o=>e({to:l,params:{view:t,date:s},search:r=>({...r,calendarId:o.length===0?void 0:[...o]}),hash:!0,replace:!0}),setAnchorDate:o=>{d||e({to:l,params:{view:t,date:o},search:!0,hash:a,replace:!0})},zoomToDay:o=>e({href:v(o)}),dayHref:v,openEvent:(o,r)=>e(r===void 0||r===""?{to:"/calendar/$view/$date/$calendarObjectId",params:{view:t,date:s,calendarObjectId:o},search:!0,hash:a,replace:d,state:{openedFromView:!0}}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:t,date:s,calendarObjectId:o,recurrenceId:r},search:!0,hash:a,replace:d,state:{openedFromView:!0}}),openTask:o=>e({to:_,params:{view:t,date:s,calendarTaskId:o},search:!0,hash:a,replace:d,state:{openedFromView:!0}}),closeToView:()=>{if(n.state.location.state.openedFromView===!0){n.history.back();return}e({to:l,params:{view:t,date:s},search:o=>({calendarId:o.calendarId}),hash:a,replace:!0})},openNewEvent:o=>e({to:"/calendar/$view/$date/new",params:{view:t,date:s},search:r=>({...r,...o}),hash:a,replace:d,state:{openedFromView:!0}}),setNewEventBounds:o=>e({to:"/calendar/$view/$date/new",params:{view:t,date:s},search:r=>({...r,...o}),hash:!0,replace:!0,state:r=>r}),openEditor:(o,r)=>e(r===void 0||r===""?{to:"/calendar/$view/$date/$calendarObjectId/edit",params:{view:t,date:s,calendarObjectId:o},search:!0,hash:a,replace:d,state:{openedFromView:!0}}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit",params:{view:t,date:s,calendarObjectId:o,recurrenceId:r},search:!0,hash:a,replace:d,state:{openedFromView:!0}}),changeSuggestionFirst:(o,r)=>e({to:$,params:{view:t,date:r,suggestionId:o},search:!0,hash:a})}),[f,e,v,a,t,s,n,d])}function A(){const e=k();return c.useCallback((n,a,t)=>{if(t===""){e({to:"/calendar/$view/$date/$calendarObjectId",params:{view:"day",date:n,calendarObjectId:a}});return}e({to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:"day",date:n,calendarObjectId:a,recurrenceId:t}})},[e])}function G(){const e=k();return c.useCallback((n,a)=>{e({to:$,params:{view:"day",date:n,suggestionId:a}})},[e])}function W(e,n){const a=c.useRef(n);a.current=n,j({shouldBlockFn:({action:t})=>t!=="BACK"?!1:a.current(),enableBeforeUnload:!1,disabled:!e})}export{P as a,K as b,S as c,U as d,V as e,j as f,A as g,G as h,W as i,L as j,D as k,M as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,B as l,u as m,a as f,c as x,r as g,A as j,O as d}from"./index-4XPoPWhu.js";import{E as h}from"./ErrorState-DcP5ZTMN.js";import{A as S,S as B,a as A,D as e,b as E}from"./DesktopChrome-Dl4YzJrV.js";import"./reply-FoVQqDdv.js";import{u as v}from"./sections-DiFHIPo4.js";import{u as y}from"./calendar-miAZmlW9.js";import"./useLayoutTier-DtUqYCCh.js";import"./useMediaQuery-a7SamL-l.js";import"./avatar-B4KRzyzS.js";import"./popover-menu-BT-fkOr5.js";import"./shield-check-DDrlOAO3.js";import"./roving-focus-Cj3j6dFs.js";function a(){const s=v();return t.jsx(S,{search:null,actions:t.jsxs(t.Fragment,{children:[t.jsx(l,{variant:"ghost",size:"sm",icon:t.jsx(B,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:()=>s("accounts")}),t.jsx(A,{})]})})}function R(){const s=m(),n=y(),{data:r,isLoading:i,isError:c,error:p,refetch:u}=f({...x(),staleTime:1/0}),o=!!(r&&(r.accounts?.length??0)===0);return g.useEffect(()=>{o&&s({to:"/onboarding",replace:!0})},[o,s]),c?t.jsx(e,{topBar:t.jsx(a,{}),children:t.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:t.jsx(h,{title:"Couldn't load your account",error:p,onRetry:()=>{u()}})})}):t.jsx(E,{hideTabBar:n,children:t.jsx(e,{topBar:t.jsx(a,{}),children:i||o?t.jsx(j,{}):t.jsx(d,{})})})}export{R as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as P,j as n,c7 as G,o as m,c8 as q,r as D,X as H,ah as Y,aa as T,f5 as K,e0 as X,d as g,aL as J,ce as j,f6 as f,f7 as Q,f8 as V,f9 as M,fa as _,b_ as A}from"./index-CL_fwLHN.js";import{S as ee}from"./sparkles-Bcn4ZRhZ.js";import{N as te}from"./reply-DvdgFS16.js";import"./useCalendarSuggestions-D3Jza1d7.js";import{a as R,c as E,f as ne,d as O,b as se}from"./calendar-format-BwCpz-JZ.js";const ae=P("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);function Te({title:e,timeText:t,color:a,layout:s,density:i,rsvp:r,status:c,hasThread:p,isRecurring:y,zoneCertainty:l,selected:u,onClick:o,leading:h,trailing:S,detail:b}){const v=s==="column";return n.jsxs("button",{type:"button",onClick:o,"aria-pressed":u,className:m("group flex w-full min-w-0 text-left outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",v?"h-full":"items-start",h!==void 0&&"gap-2"),children:[h,n.jsx("span",{className:m(q({color:a,layout:s,density:i,rsvp:r,status:c,selected:u,stacked:b!==void 0}),"flex-1",v&&"h-full"),children:n.jsx(G,{title:e,timeText:t,layout:s,rsvp:r,hasThread:p,isRecurring:y,zoneCertainty:l,trailing:S,detail:b})})]})}function ge({items:e,className:t}){return e.length===0?n.jsxs("div",{className:m("flex flex-col items-center gap-2 p-6 text-center",t),children:[n.jsx(ee,{className:"size-6 text-fg-subtle","aria-hidden":!0}),n.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing in your mail is waiting on a decision about time."})]}):n.jsx("ul",{"aria-label":"Suggested events",className:m("flex min-h-0 flex-col gap-3 overflow-y-auto",t),children:e.map(a=>n.jsx("li",{children:a.card},a.id))})}const re="Pick a clock first. The mail never said, and the reader will not choose for you.";function ie(e,t){const a=e.zoneOptions;return a===void 0?{settled:!0,timeZone:""}:a.some(s=>s.timeZone===t)?{settled:!0,timeZone:t}:{settled:!1,reason:re}}function Z(e){return e.threadSubject===""?e.sender:`${e.sender} — ${e.threadSubject}`}function le(e){return e>=.85?"Read cleanly":e>=.6?"Read with gaps":"Barely read"}function Ae({suggestion:e,whenText:t,onAdd:a,onReview:s,onDismiss:i,onOpenThread:r,busy:c=!1,addBlocked:p=!1,zoneChoice:y,onZoneChoice:l,addLabel:u="Add",touch:o,className:h}){const[S,b]=D.useState(""),[v,I]=D.useState(!1),w=D.useId(),C=y??S,W=d=>{I(!1),l?l(d):b(d)},x=ie(e,C),z=d=>()=>{if(!x.settled){I(!0);return}d(x.timeZone)};return n.jsxs("article",{"aria-label":e.title,className:m("flex flex-col gap-2 rounded-lg border border-dashed border-line-strong bg-surface-sunken p-3",h),children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:["Suggested from mail · ",le(e.confidence)]}),n.jsx("span",{className:"block truncate text-sm font-medium text-fg",children:e.title}),n.jsx("span",{className:"block text-xs text-fg-muted",children:t}),e.location!==""&&n.jsx("span",{className:"block truncate text-xs text-fg-muted",children:e.location})]}),n.jsx("button",{type:"button","aria-label":"Dismiss suggestion",onClick:i,disabled:c,className:m("flex shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",o?"size-11":"size-7"),children:n.jsx(H,{className:"size-4"})})]}),e.ambiguity!==""&&n.jsxs("p",{className:"flex items-start gap-1.5 text-2xs text-warning",children:[n.jsx(Y,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),e.ambiguity]}),r?n.jsxs("button",{type:"button",onClick:r,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm text-left text-2xs text-accent-2 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx(T,{className:"size-3 shrink-0"}),n.jsx("span",{className:"truncate",children:Z(e)})]}):n.jsxs("p",{className:"flex w-full min-w-0 items-center gap-1.5 text-2xs text-fg-subtle",children:[n.jsx(T,{className:"size-3 shrink-0"}),n.jsx("span",{className:"truncate",children:Z(e)})]}),e.zoneOptions&&n.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-warning/40 p-2",children:[n.jsxs("p",{className:"flex items-center gap-1.5 text-2xs font-semibold text-warning",children:[n.jsx(K,{className:"size-3 shrink-0","aria-hidden":!0}),"Which clock is this on?"]}),e.zoneOptions.map(d=>n.jsxs("button",{type:"button","aria-pressed":C===d.timeZone,onClick:()=>W(d.timeZone),className:m("rounded-md border px-2 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",o&&"min-h-11",C===d.timeZone?"border-accent bg-accent-soft":"border-line bg-surface hover:border-line-strong"),children:[n.jsx("span",{className:"block text-xs font-medium text-fg",children:d.label}),n.jsx("span",{className:"block text-2xs text-fg-subtle",children:d.note})]},d.timeZone))]}),!x.settled&&n.jsx(X,{id:w,reason:x.reason,nudged:v,className:"text-2xs text-warning"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(g,{variant:"primary",size:o?"md":"sm",icon:n.jsx(J,{className:"size-3.5"}),onClick:z(a),disabled:c||p,"aria-describedby":x.settled?void 0:w,className:m(o&&"min-h-11 flex-1",!x.settled&&"opacity-55"),children:u}),s&&n.jsx(g,{variant:"secondary",size:o?"md":"sm",icon:n.jsx(ae,{className:"size-3.5"}),onClick:z(s),disabled:c,"aria-describedby":x.settled?void 0:w,className:m(o&&"min-h-11",!x.settled&&"opacity-55"),children:"Change first"})]})]})}function Re(e){return e.defaultCalendarId!==""?"ready":e.error!==null?"failed":e.isLoading?"loading":"none"}function Oe(e,t){if(e!=="ready")return e==="loading"?"Reading your calendars…":e==="failed"?n.jsxs(n.Fragment,{children:["Couldn't read your calendars, so there is nowhere to add this yet. Reload to try again."," ",n.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]}):n.jsxs(n.Fragment,{children:["You have no calendar yet, so there is nowhere to add this."," ",n.jsx(te,{to:"/settings/calendars",className:"font-medium text-accent hover:underline",children:"Create a calendar"})]})}const oe=24,$=7,ce=52,k=ce*7,de=e=>({from:f(e,-10),to:f(e,oe),floor:f(e,-k),ceiling:f(e,k)}),fe=e=>e.from<=e.floor,me=e=>e.to>=e.ceiling,ue=(e,t)=>e>t?e:t,xe=(e,t)=>e<t?e:t,he=e=>fe(e)?e:{...e,from:ue(f(e.from,-$),e.floor)},pe=e=>me(e)?e:{...e,to:xe(f(e.to,$),e.ceiling)},Ze=e=>he({...e,floor:f(e.from,-k)}),Le=e=>pe({...e,ceiling:f(e.to,k)});function Me(e,t){return t>=e.from&&t<=e.to?e:de(t)}function _e(e){const t=new Map;for(const a of e){const s=M("week",a);t.has(s.from)||t.set(s.from,s)}return[...t.values()]}const $e=e=>M("week",e).from,ye=1440,L=e=>e.getHours()*60+e.getMinutes();function B(e,t){const a=new Set(e),s=new Map;for(const i of t){const r=new Date(i.start),c=new Date(i.end);if(Number.isNaN(r.getTime())||Number.isNaN(c.getTime())||c.getTime()<=r.getTime())continue;const p=j(r),y=j(new Date(c.getTime()-1));for(let l=p;l<=y;l=f(l,1)){if(!a.has(l))continue;const u=l===p?L(r):0,o=j(c)===l?L(c):ye;if(o<=u)continue;const h=s.get(l);h?h.push({from:u,to:o}):s.set(l,[{from:u,to:o}])}}for(const[i,r]of s)s.set(i,Q(r));return s}function Be(e,t){const a=B(e,t);return new Map(e.map(s=>[s,_(s,a.get(s)??[])]))}const Fe=e=>V(e.from,e.to),N=30,be=6,F={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},ve="The invitation's time zone could not be resolved. Add opens the editor so you can set the time.",Ne="The invitation's time zone could not be resolved.";function Ue(e){return e.method==="Cancel"?e.state==="Pending"?{state:"cancelled",rsvp:"noReply"}:void 0:e.state==="Dismissed"?{state:"dismissed",rsvp:"noReply"}:e.state==="Superseded"?{state:"superseded",rsvp:"noReply"}:e.state==="Accepted"?{state:"answered",rsvp:"accepted"}:e.state==="Declined"?{state:"answered",rsvp:"declined"}:e.state==="Tentative"?{state:"answered",rsvp:"tentative"}:{state:"pending",rsvp:"noReply"}}const je=e=>e.source!=="TextHeuristic";function We(e){return e.allDay?e.dtStart.slice(0,10):j(new Date(e.dtStart))}const U=e=>e.summary===""?"Untitled event":e.summary;function Pe(e){if(e.allDay){const t=e.dtStart.slice(0,10),a=e.dtEnd.slice(0,10),s=a>t?f(a,-1):t;return s===t?`${E(t)}, all day`:`${E(t)} – ${E(s)}, all day`}return ne({start:e.dtStart,end:e.dtEnd,allDay:e.allDay})}function ke(e,t){return{id:e.suggestionId,calendarId:t.calendarId,title:U(e),start:e.dtStart,end:e.dtEnd,allDay:e.allDay,location:e.location,notes:"",attendees:[],myRsvp:"noReply",threadId:t.threadId,threadSubject:t.threadSubject,timeZone:"",zoneCertainty:F[e.zoneCertainty],recurrenceRule:"",seriesId:"",seriesException:!1,status:"confirmed"}}function Ge(e,t,a){const s=e.organizer===""?a.senderName:e.organizer;return{id:e.suggestionId,threadId:a.threadId,proposed:ke(e,a),organizerName:s===""?"The sender":s,organizerEmail:e.organizer,method:"ics",evidence:"",state:t,sequence:e.sequence}}function Se(e){return e.zoneCertainty!=="Ambiguous"?"":e.method==="Cancel"?Ne:ve}function qe(e,t){return{id:e.suggestionId,title:U(e),start:e.dtStart,end:e.dtEnd,allDay:e.allDay,location:e.location,threadId:t.threadId,threadSubject:t.threadSubject,sender:t.sender,senderAddress:e.organizer,confidence:je(e)?1:.6,ambiguity:Se(e),suggestedCalendarId:t.calendarId,timeZone:"",zoneCertainty:F[e.zoneCertainty]}}const we=(e,t)=>Date.parse(t.start)<Date.parse(e.end)&&Date.parse(t.end)>Date.parse(e.start);function He(e,t){return t.filter(a=>we(e,a)).map(a=>({id:`${a.start}/${a.end}`,label:`Busy ${R(a.start)} – ${R(a.end)}`}))}function Ye(e,t){const a=B([e],t).get(e)??[],s=[];for(const i of _(e,a,N))for(let r=i.startMinute;r+N<=i.endMinute&&s.length<be;r+=N)s.push({date:e,endDate:e,startTime:A(r),endTime:A(r+N),allDay:!1});return s}function Ke(e,t,a){const s=t.filter(i=>a.includes(i.startTime)).map(i=>`${O(i.startTime)} – ${O(i.endTime)}`);return`${se(e)}: ${s.join(", ")}`}export{Te as C,Ae as E,Me as a,$e as b,pe as c,Fe as d,he as e,Be as f,Le as g,me as h,fe as i,ge as j,Oe as k,Ze as l,Re as m,We as n,je as o,Ue as p,He as q,de as r,Pe as s,qe as t,Ge as u,Ye as v,_e as w,Ke as x};
|
|
1
|
+
import{b as P,j as n,cm as q,q as m,cn as G,r as D,X as H,ai as Y,a9 as T,fk as K,ef as X,B as g,aM as J,ct as j,fl as f,fm as Q,fn as V,fo as $,fp as B,cd as A}from"./index-4XPoPWhu.js";import{S as ee}from"./sparkles-MrqvyWps.js";import{N as te}from"./reply-FoVQqDdv.js";import"./useCalendarSuggestions-D6k1REyo.js";import{a as R,c as E,f as ne,d as O,b as se}from"./calendar-format-BwCpz-JZ.js";const ae=P("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);function Te({title:e,timeText:t,color:a,layout:s,density:i,rsvp:r,status:c,hasThread:p,isRecurring:y,zoneCertainty:l,selected:u,onClick:o,leading:h,trailing:S,detail:b}){const v=s==="column";return n.jsxs("button",{type:"button",onClick:o,"aria-pressed":u,className:m("group flex w-full min-w-0 text-left outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",v?"h-full":"items-start",h!==void 0&&"gap-2"),children:[h,n.jsx("span",{className:m(G({color:a,layout:s,density:i,rsvp:r,status:c,selected:u,stacked:b!==void 0}),"flex-1",v&&"h-full"),children:n.jsx(q,{title:e,timeText:t,layout:s,rsvp:r,hasThread:p,isRecurring:y,zoneCertainty:l,trailing:S,detail:b})})]})}function ge({items:e,className:t}){return e.length===0?n.jsxs("div",{className:m("flex flex-col items-center gap-2 p-6 text-center",t),children:[n.jsx(ee,{className:"size-6 text-fg-subtle","aria-hidden":!0}),n.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing in your mail is waiting on a decision about time."})]}):n.jsx("ul",{"aria-label":"Suggested events",className:m("flex min-h-0 flex-col gap-3 overflow-y-auto",t),children:e.map(a=>n.jsx("li",{children:a.card},a.id))})}const re="Pick a clock first. The mail never said, and the reader will not choose for you.";function ie(e,t){const a=e.zoneOptions;return a===void 0?{settled:!0,timeZone:""}:a.some(s=>s.timeZone===t)?{settled:!0,timeZone:t}:{settled:!1,reason:re}}function M(e){return e.threadSubject===""?e.sender:`${e.sender} — ${e.threadSubject}`}function le(e){return e>=.85?"Read cleanly":e>=.6?"Read with gaps":"Barely read"}function Ae({suggestion:e,whenText:t,onAdd:a,onReview:s,onDismiss:i,onOpenThread:r,busy:c=!1,addBlocked:p=!1,zoneChoice:y,onZoneChoice:l,addLabel:u="Add",touch:o,className:h}){const[S,b]=D.useState(""),[v,I]=D.useState(!1),w=D.useId(),C=y??S,W=d=>{I(!1),l?l(d):b(d)},x=ie(e,C),z=d=>()=>{if(!x.settled){I(!0);return}d(x.timeZone)};return n.jsxs("article",{"aria-label":e.title,className:m("flex flex-col gap-2 rounded-lg border border-dashed border-line-strong bg-surface-sunken p-3",h),children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:["Suggested from mail · ",le(e.confidence)]}),n.jsx("span",{className:"block truncate text-sm font-medium text-fg",children:e.title}),n.jsx("span",{className:"block text-xs text-fg-muted",children:t}),e.location!==""&&n.jsx("span",{className:"block truncate text-xs text-fg-muted",children:e.location})]}),n.jsx("button",{type:"button","aria-label":"Dismiss suggestion",onClick:i,disabled:c,className:m("flex shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",o?"size-11":"size-7"),children:n.jsx(H,{className:"size-4"})})]}),e.ambiguity!==""&&n.jsxs("p",{className:"flex items-start gap-1.5 text-2xs text-warning",children:[n.jsx(Y,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),e.ambiguity]}),r?n.jsxs("button",{type:"button",onClick:r,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm text-left text-2xs text-accent-2 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx(T,{className:"size-3 shrink-0"}),n.jsx("span",{className:"truncate",children:M(e)})]}):n.jsxs("p",{className:"flex w-full min-w-0 items-center gap-1.5 text-2xs text-fg-subtle",children:[n.jsx(T,{className:"size-3 shrink-0"}),n.jsx("span",{className:"truncate",children:M(e)})]}),e.zoneOptions&&n.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-warning/40 p-2",children:[n.jsxs("p",{className:"flex items-center gap-1.5 text-2xs font-semibold text-warning",children:[n.jsx(K,{className:"size-3 shrink-0","aria-hidden":!0}),"Which clock is this on?"]}),e.zoneOptions.map(d=>n.jsxs("button",{type:"button","aria-pressed":C===d.timeZone,onClick:()=>W(d.timeZone),className:m("rounded-md border px-2 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",o&&"min-h-11",C===d.timeZone?"border-accent bg-accent-soft":"border-line bg-surface hover:border-line-strong"),children:[n.jsx("span",{className:"block text-xs font-medium text-fg",children:d.label}),n.jsx("span",{className:"block text-2xs text-fg-subtle",children:d.note})]},d.timeZone))]}),!x.settled&&n.jsx(X,{id:w,reason:x.reason,nudged:v,className:"text-2xs text-warning"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(g,{variant:"primary",size:o?"md":"sm",icon:n.jsx(J,{className:"size-3.5"}),onClick:z(a),disabled:c||p,"aria-describedby":x.settled?void 0:w,className:m(o&&"min-h-11 flex-1",!x.settled&&"opacity-55"),children:u}),s&&n.jsx(g,{variant:"secondary",size:o?"md":"sm",icon:n.jsx(ae,{className:"size-3.5"}),onClick:z(s),disabled:c,"aria-describedby":x.settled?void 0:w,className:m(o&&"min-h-11",!x.settled&&"opacity-55"),children:"Change first"})]})]})}function Re(e){return e.defaultCalendarId!==""?"ready":e.error!==null?"failed":e.isLoading?"loading":"none"}function Oe(e,t){if(e!=="ready")return e==="loading"?"Reading your calendars…":e==="failed"?n.jsxs(n.Fragment,{children:["Couldn't read your calendars, so there is nowhere to add this yet. Reload to try again."," ",n.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]}):n.jsxs(n.Fragment,{children:["You have no calendar yet, so there is nowhere to add this."," ",n.jsx(te,{to:"/settings/calendars",className:"font-medium text-accent hover:underline",children:"Create a calendar"})]})}const oe=24,L=7,ce=52,k=ce*7,de=e=>({from:f(e,-10),to:f(e,oe),floor:f(e,-k),ceiling:f(e,k)}),fe=e=>e.from<=e.floor,me=e=>e.to>=e.ceiling,ue=(e,t)=>e>t?e:t,xe=(e,t)=>e<t?e:t,he=e=>fe(e)?e:{...e,from:ue(f(e.from,-L),e.floor)},pe=e=>me(e)?e:{...e,to:xe(f(e.to,L),e.ceiling)},Me=e=>he({...e,floor:f(e.from,-k)}),Ze=e=>pe({...e,ceiling:f(e.to,k)});function $e(e,t){return t>=e.from&&t<=e.to?e:de(t)}function Be(e){const t=new Map;for(const a of e){const s=$("week",a);t.has(s.from)||t.set(s.from,s)}return[...t.values()]}const Le=e=>$("week",e).from,ye=1440,Z=e=>e.getHours()*60+e.getMinutes();function _(e,t){const a=new Set(e),s=new Map;for(const i of t){const r=new Date(i.start),c=new Date(i.end);if(Number.isNaN(r.getTime())||Number.isNaN(c.getTime())||c.getTime()<=r.getTime())continue;const p=j(r),y=j(new Date(c.getTime()-1));for(let l=p;l<=y;l=f(l,1)){if(!a.has(l))continue;const u=l===p?Z(r):0,o=j(c)===l?Z(c):ye;if(o<=u)continue;const h=s.get(l);h?h.push({from:u,to:o}):s.set(l,[{from:u,to:o}])}}for(const[i,r]of s)s.set(i,Q(r));return s}function _e(e,t){const a=_(e,t);return new Map(e.map(s=>[s,B(s,a.get(s)??[])]))}const Fe=e=>V(e.from,e.to),N=30,be=6,F={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},ve="The invitation's time zone could not be resolved. Add opens the editor so you can set the time.",Ne="The invitation's time zone could not be resolved.";function Ue(e){return e.method==="Cancel"?e.state==="Pending"?{state:"cancelled",rsvp:"noReply"}:void 0:e.state==="Dismissed"?{state:"dismissed",rsvp:"noReply"}:e.state==="Superseded"?{state:"superseded",rsvp:"noReply"}:e.state==="Accepted"?{state:"answered",rsvp:"accepted"}:e.state==="Declined"?{state:"answered",rsvp:"declined"}:e.state==="Tentative"?{state:"answered",rsvp:"tentative"}:{state:"pending",rsvp:"noReply"}}const je=e=>e.source!=="TextHeuristic";function We(e){return e.allDay?e.dtStart.slice(0,10):j(new Date(e.dtStart))}const U=e=>e.summary===""?"Untitled event":e.summary;function Pe(e){if(e.allDay){const t=e.dtStart.slice(0,10),a=e.dtEnd.slice(0,10),s=a>t?f(a,-1):t;return s===t?`${E(t)}, all day`:`${E(t)} – ${E(s)}, all day`}return ne({start:e.dtStart,end:e.dtEnd,allDay:e.allDay})}function ke(e,t){return{id:e.suggestionId,calendarId:t.calendarId,title:U(e),start:e.dtStart,end:e.dtEnd,allDay:e.allDay,location:e.location,notes:"",attendees:[],myRsvp:"noReply",threadId:t.threadId,threadSubject:t.threadSubject,timeZone:"",zoneCertainty:F[e.zoneCertainty],recurrenceRule:"",seriesId:"",seriesException:!1,status:"confirmed"}}function qe(e,t,a){const s=e.organizer===""?a.senderName:e.organizer;return{id:e.suggestionId,threadId:a.threadId,proposed:ke(e,a),organizerName:s===""?"The sender":s,organizerEmail:e.organizer,method:"ics",evidence:"",state:t,sequence:e.sequence}}function Se(e){return e.zoneCertainty!=="Ambiguous"?"":e.method==="Cancel"?Ne:ve}function Ge(e,t){return{id:e.suggestionId,title:U(e),start:e.dtStart,end:e.dtEnd,allDay:e.allDay,location:e.location,threadId:t.threadId,threadSubject:t.threadSubject,sender:t.sender,senderAddress:e.organizer,confidence:je(e)?1:.6,ambiguity:Se(e),suggestedCalendarId:t.calendarId,timeZone:"",zoneCertainty:F[e.zoneCertainty]}}const we=(e,t)=>Date.parse(t.start)<Date.parse(e.end)&&Date.parse(t.end)>Date.parse(e.start);function He(e,t){return t.filter(a=>we(e,a)).map(a=>({id:`${a.start}/${a.end}`,label:`Busy ${R(a.start)} – ${R(a.end)}`}))}function Ye(e,t){const a=_([e],t).get(e)??[],s=[];for(const i of B(e,a,N))for(let r=i.startMinute;r+N<=i.endMinute&&s.length<be;r+=N)s.push({date:e,endDate:e,startTime:A(r),endTime:A(r+N),allDay:!1});return s}function Ke(e,t,a){const s=t.filter(i=>a.includes(i.startTime)).map(i=>`${O(i.startTime)} – ${O(i.endTime)}`);return`${se(e)}: ${s.join(", ")}`}export{Te as C,Ae as E,$e as a,Le as b,pe as c,Fe as d,he as e,_e as f,Ze as g,me as h,fe as i,ge as j,Oe as k,Me as l,Re as m,We as n,je as o,Ue as p,He as q,de as r,Pe as s,Ge as t,qe as u,Ye as v,Be as w,Ke as x};
|