@remit/web-client-dist 0.0.698 → 0.0.699
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-OvZiBDtW.js → BriefPane-CVojVy4N.js} +1 -1
- package/assets/{CalendarEventEditor-JBfO_GQa.js → CalendarEventEditor-BcGWIsNu.js} +1 -1
- package/assets/{CalendarEventPopup-U6Ndkn2v.js → CalendarEventPopup-MzsWR5GB.js} +1 -1
- package/assets/{CalendarLoadFailed-CNaVKDtW.js → CalendarLoadFailed-Bq0_jt4H.js} +1 -1
- package/assets/{CalendarQuickCreate-C-yc6zce.js → CalendarQuickCreate-m3dyD7gG.js} +1 -1
- package/assets/{CalendarSession-C_XnZoOI.js → CalendarSession-D2sxMFYX.js} +1 -1
- package/assets/{CollectionPane-C6EYtyWc.js → CollectionPane-BykvWdR8.js} +1 -1
- package/assets/{DesktopChrome-DXIJ6wUA.js → DesktopChrome-D8EtAdwf.js} +1 -1
- package/assets/{DropdownMenu-DsxemHc4.js → DropdownMenu-BuKAMdhw.js} +1 -1
- package/assets/{EmptyState-Dv8xCRkX.js → EmptyState-DEGumQTC.js} +1 -1
- package/assets/{ErrorState-BptbbJAv.js → ErrorState-g7-Y1uhe.js} +1 -1
- package/assets/{FullCompose-BGLjrGst.js → FullCompose-CN22d_2q.js} +1 -1
- package/assets/{LabelApplyTrigger-DzgVUcax.js → LabelApplyTrigger-Ds7qPw1w.js} +1 -1
- package/assets/{MailShell-DE0ZN2ct.js → MailShell-DemzOx8u.js} +1 -1
- package/assets/{MailViewChrome-DoBZYTxQ.js → MailViewChrome-pi6cPv-J.js} +1 -1
- package/assets/{MailboxPane-CxaGFC0R.js → MailboxPane-DGJQyeZU.js} +1 -1
- package/assets/{MessageBody-BYYCZieC.js → MessageBody-Lnqqwldl.js} +1 -1
- package/assets/{MessageToolbar-CnhMX7Ap.js → MessageToolbar-HTPVoP6C.js} +1 -1
- package/assets/{NavMenuButton-B28Nb9kR.js → NavMenuButton-BWwWmGhg.js} +1 -1
- package/assets/{OnboardingWizard-dQ9c99Ni.js → OnboardingWizard-C9TeAtWU.js} +1 -1
- package/assets/{OutboxPane-ByJt4RDv.js → OutboxPane-dfNu0jGv.js} +1 -1
- package/assets/{ReportLink-D0tCso5T.js → ReportLink-qkDHdkiE.js} +1 -1
- package/assets/_calendarObjectId-DbDEB7MM.js +1 -0
- package/assets/_labelId-DeoXHX88.js +1 -0
- package/assets/_mailboxId-BGYGT6QY.js +1 -0
- package/assets/_messageId-Bqhz_qdo.js +1 -0
- package/assets/_messageId-DNugF3h5.js +1 -0
- package/assets/_messageId-DXnZth67.js +1 -0
- package/assets/_messageId-DtLyjaix.js +1 -0
- package/assets/_outboxMessageId-CphlQb-y.js +1 -0
- package/assets/_recurrenceId-De3orc9t.js +1 -0
- package/assets/{_slotId-BgSRkGdw.js → _slotId-Cl3N41sT.js} +1 -1
- package/assets/_threadId-BJhKtdZn.js +1 -0
- package/assets/_threadId-Bjt3wKzI.js +1 -0
- package/assets/_threadId-Cp8WdX2x.js +1 -0
- package/assets/_threadId-LaejKsjM.js +1 -0
- package/assets/{_view._date-BCOouUgc.js → _view._date-CjV2fY7h.js} +1 -1
- package/assets/{account-service-status-C6hq8flJ.js → account-service-status-CHNkQEDe.js} +1 -1
- package/assets/{accounts-B2HAE5Mp.js → accounts-BLUtQMSv.js} +1 -1
- package/assets/{advanced-BBWKSR4H.js → advanced-Cbpc8AqG.js} +1 -1
- package/assets/{agenda-time-C9jExuVe.js → agenda-time-BwFncCBt.js} +1 -1
- package/assets/{app-chrome-CS-vT-4r.js → app-chrome-CGYf2rTW.js} +1 -1
- package/assets/{appearance-oUeDfZvm.js → appearance-Pwj-DY3o.js} +1 -1
- package/assets/{avatar-B60PZejm.js → avatar-CVmRGlvx.js} +1 -1
- package/assets/{badge-DYFkBshe.js → badge-CDOouHHB.js} +1 -1
- package/assets/{bottom-sheet-B0y_-mKC.js → bottom-sheet-Bl-_mC2x.js} +1 -1
- package/assets/{brief-DBLwMpYO.js → brief-0MZHMWP6.js} +1 -1
- package/assets/brief-Cm-kx12Z.js +1 -0
- package/assets/{calendar-Cf7D8za1.js → calendar-BDEdchBU.js} +1 -1
- package/assets/{calendar-DON3hXqq.js → calendar-BHWGBart.js} +1 -1
- package/assets/{calendar-event-popup-BqE6svk6.js → calendar-event-popup-O-JrsyRu.js} +1 -1
- package/assets/{calendar-event-sidebar-BGvCPmWa.js → calendar-event-sidebar-BUwhXGT2.js} +1 -1
- package/assets/{calendar-failure-note-sEjmPcbo.js → calendar-failure-note-_XD99AnH.js} +1 -1
- package/assets/{calendar-guests-CuFcAD3k.js → calendar-guests-BVwUAczN.js} +1 -1
- package/assets/{calendar-suggestion-CZ6ssHct.js → calendar-suggestion-DnD4hQ5U.js} +1 -1
- package/assets/{calendars-9OZeuRv6.js → calendars-DmhTUU22.js} +1 -1
- package/assets/{card-13z0qC0r.js → card-D8MhhaRw.js} +1 -1
- package/assets/{checkbox-ZdvWSWRN.js → checkbox-DQCA_mSq.js} +1 -1
- package/assets/{chevron-down-wpFtElCn.js → chevron-down-DeNyJr8d.js} +1 -1
- package/assets/{chevron-left-HeNgNNR2.js → chevron-left-Co8HGTow.js} +1 -1
- package/assets/{circle-check-Q9IHsvBp.js → circle-check-BoVmBAEX.js} +1 -1
- package/assets/{circle-check-big-C2cm1OoH.js → circle-check-big-DSc97Qaj.js} +1 -1
- package/assets/{circle-question-mark-CYsyue28.js → circle-question-mark-DuTpeMvV.js} +1 -1
- package/assets/{classification-BxsZLEnC.js → classification-9tqOMgRd.js} +1 -1
- package/assets/{clock-D8a14yMJ.js → clock--ouhjt6L.js} +1 -1
- package/assets/{cloud-off-I2wH-wZi.js → cloud-off-DEwqlx6S.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BAzIb9up.js +1 -0
- package/assets/compose._-_outboxMessageId_-C8ETLKa8.js +1 -0
- package/assets/compose._-_outboxMessageId_-CAFZwe5_.js +1 -0
- package/assets/compose._-_outboxMessageId_-CS88venz.js +1 -0
- package/assets/compose._-_outboxMessageId_-CVS1GWS6.js +1 -0
- package/assets/{config-import-DTqOa38a.js → config-import-B-pJhKeZ.js} +1 -1
- package/assets/{confirm-dialog-CsttDS5u.js → confirm-dialog-BdT5xj08.js} +1 -1
- package/assets/{copy-V6gKiItu.js → copy-CCCumQLf.js} +1 -1
- package/assets/{credential-steps-BPun50HH.js → credential-steps-BIgbwjRe.js} +1 -1
- package/assets/{download-CHIm9QMw.js → download-BrsKwaQk.js} +1 -1
- package/assets/{draft-CUl68Y86.js → draft-B-aWKHzd.js} +1 -1
- package/assets/edit-Cn1GEm6M.js +1 -0
- package/assets/edit-sXk685Tf.js +1 -0
- package/assets/{external-link-DinDD_TS.js → external-link-D__EDlgs.js} +1 -1
- package/assets/{file-braces-DSnr6-a7.js → file-braces-BtzbF80p.js} +1 -1
- package/assets/{filters-BOpD_izN.js → filters-B0cQUlmN.js} +1 -1
- package/assets/flagged-BH8DBC_m.js +1 -0
- package/assets/{flagged-Cj4ARwpT.js → flagged-DHdIwzxj.js} +1 -1
- package/assets/{folder-input-BqAxe_6s.js → folder-input-C_5R00h6.js} +1 -1
- package/assets/{folders-NwCVYN5L.js → folders-DlGCVINx.js} +1 -1
- package/assets/{help-copy-EtAi1Aq7.js → help-copy-Cy9gka_E.js} +1 -1
- package/assets/{import-DJMjk1Ri.js → import-D8rex9A_.js} +1 -1
- package/assets/index-1RsOqxw1.js +1 -0
- package/assets/index-BON2Uz34.js +1 -0
- package/assets/index-Bc1xPJmS.js +1 -0
- package/assets/index-Bqhz_qdo.js +1 -0
- package/assets/{index-CKFdaY9c.js → index-C2US5ZnK.js} +3 -3
- package/assets/index-CPXeIqob.js +1 -0
- package/assets/index-D4tg2bgX.js +1 -0
- package/assets/index-DEDbYXlC.js +1 -0
- package/assets/index-DNugF3h5.js +1 -0
- package/assets/index-Da8RbG-l.js +1 -0
- package/assets/index-Dq3u3q5n.js +1 -0
- package/assets/index-G-mQoWoq.js +1 -0
- package/assets/index-SJfI-AF0.js +1 -0
- package/assets/{index-BQ2vE6gp.js → index-v9nM8Dsp.js} +4 -4
- package/assets/{kbd-qpWA48X9.js → kbd-C052hWKm.js} +1 -1
- package/assets/{label-chip-zwUAXSWu.js → label-chip-D_oZixyY.js} +1 -1
- package/assets/{labels-CwGUliq_.js → labels--8vbvW8D.js} +1 -1
- package/assets/{mail-Bsgov7FY.js → mail-Cqr91KmH.js} +1 -1
- package/assets/{mail-B-_K5JCo.js → mail-DTcPvSJ6.js} +1 -1
- package/assets/{menu-CKmdL0us.js → menu-CEGeda9s.js} +1 -1
- package/assets/{nav-link-YOSchPy9.js → nav-link-Df_MDzvJ.js} +1 -1
- package/assets/new-B_AuEYbG.js +1 -0
- package/assets/onboarding-B2cpYesO.js +1 -0
- package/assets/{onboarding-completion-cX9HM-aL.js → onboarding-completion-2pWLyByk.js} +1 -1
- package/assets/outbox-BOxaEnp0.js +1 -0
- package/assets/{pencil-C6KO5975.js → pencil-C1yBZXUb.js} +1 -1
- package/assets/{people-BhhvdCU4.js → people-BTPHUD8U.js} +1 -1
- package/assets/{plus-DsSkq30M.js → plus-DY_LOTJC.js} +1 -1
- package/assets/{popover-menu-DP-hyKpu.js → popover-menu-D4kT-xqh.js} +1 -1
- package/assets/{refresh-cw-CCcTeH3S.js → refresh-cw-CY0SJjI-.js} +1 -1
- package/assets/{reply-SkF_KCOk.js → reply-CijQsg4o.js} +1 -1
- package/assets/{rich-text-By6rXXKy.js → rich-text-CY6eh-tS.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-DQbI8hMR.js → rich-text-spellcheck-worker-provider-BoNiweeq.js} +1 -1
- package/assets/{rotate-ccw-lh0BmpDo.js → rotate-ccw-CfAs8Xij.js} +1 -1
- package/assets/{roving-focus-DlzLpO4G.js → roving-focus-C0jnB7ie.js} +1 -1
- package/assets/{row-actions-0g39M7ib.js → row-actions-gLlnd0fC.js} +1 -1
- package/assets/{search-mirror-D9nwr5km.js → search-mirror-B_HO5zGq.js} +1 -1
- package/assets/{search-scope-DNDpRNp9.js → search-scope-7jHRUZbg.js} +1 -1
- package/assets/{search-token-index-cy3uaYXm.js → search-token-index-BymL-AGz.js} +1 -1
- package/assets/{sections-ZsRsk30_.js → sections-FtpeSpRq.js} +1 -1
- package/assets/{segmented-control-CeqFpYfk.js → segmented-control-CMV1-H2S.js} +1 -1
- package/assets/{select-yGv73aji.js → select-DhVwx5IO.js} +1 -1
- package/assets/{senders-lMWjFLIX.js → senders-ZFBTlEw_.js} +1 -1
- package/assets/settings-aaApx7r_.js +1 -0
- package/assets/{settings-screen-C8z8YwuM.js → settings-screen-zihVEeS9.js} +1 -1
- package/assets/{shield-check-CIZoP3AE.js → shield-check-CvFo5QUy.js} +1 -1
- package/assets/{spam-D6paxCM2.js → spam-CN0HeRYz.js} +1 -1
- package/assets/{suggest-list-czu9q5H4.js → suggest-list-DJUWGfG3.js} +1 -1
- package/assets/{suggested-vips-DXCCMmOn.js → suggested-vips-DNc6wPf9.js} +1 -1
- package/assets/{suggestion._suggestionId-zlbObxkn.js → suggestion._suggestionId-DCu4Y3bg.js} +1 -1
- package/assets/{switch-BezKd3gx.js → switch-Bza9700F.js} +1 -1
- package/assets/{task._calendarTaskId-CgBc-n43.js → task._calendarTaskId-B9lXR7O6.js} +1 -1
- package/assets/{undo-2-CgG5m84e.js → undo-2-BHa76eIs.js} +1 -1
- package/assets/{useCalendarData-CgRGDHYQ.js → useCalendarData-AQi5DlI1.js} +1 -1
- package/assets/{useCalendarScheduling-BhFuxgru.js → useCalendarScheduling-BzXa0l-K.js} +1 -1
- package/assets/{useCalendarSuggestions-BaIFwYBZ.js → useCalendarSuggestions-CJGnqdiK.js} +1 -1
- package/assets/{useCalendarTasks-CnP7DfUR.js → useCalendarTasks-BBv_7Q0J.js} +1 -1
- package/assets/{useClassificationSettings-Bk89yu99.js → useClassificationSettings-Dh7qfWbF.js} +1 -1
- package/assets/{useCollectionThreads-BMsppZhN.js → useCollectionThreads-B1vimpsO.js} +1 -1
- package/assets/{useDebouncedValue-BpDHcfPe.js → useDebouncedValue-C3FljUyl.js} +1 -1
- package/assets/{useFilters-Cv2IfE4J.js → useFilters-BoddpA09.js} +1 -1
- package/assets/{useInfiniteQuery-DwTTxcsy.js → useInfiniteQuery-Dd0GYAxg.js} +1 -1
- package/assets/{useJunkMailboxIds-CDFS8XJA.js → useJunkMailboxIds-D3M8TbeX.js} +1 -1
- package/assets/{useLabels-BIArT792.js → useLabels-DnF0cYWq.js} +1 -1
- package/assets/{useLayoutTier-Y7Z9Nnsm.js → useLayoutTier-lXeQo_2w.js} +1 -1
- package/assets/{useMediaQuery-CjE8xNMz.js → useMediaQuery-BaUDTtu8.js} +1 -1
- package/assets/{useMessageBodyContent-D5mskS3v.js → useMessageBodyContent-DwHmQdO9.js} +1 -1
- package/assets/{useQueries-CQ_R-NWg.js → useQueries-B-1XtDe8.js} +1 -1
- package/assets/{useRefreshControl-DwtRYeei.js → useRefreshControl-CJGMdQve.js} +1 -1
- package/assets/{useResultFolderIndex-ZNSoZByc.js → useResultFolderIndex-D_NiyNtK.js} +1 -1
- package/assets/{useSignature-CnLh1XFv.js → useSignature-cMh39FpD.js} +1 -1
- package/assets/{warnings-zZSUr-_I.js → warnings-DzSQHNtz.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_calendarObjectId-DA9THlEZ.js +0 -1
- package/assets/_labelId-QQEJSaaH.js +0 -1
- package/assets/_mailboxId-CjHcitFP.js +0 -1
- package/assets/_messageId-BR_TgwKr.js +0 -1
- package/assets/_messageId-CAxQBVFC.js +0 -1
- package/assets/_messageId-CO7AhNVu.js +0 -1
- package/assets/_messageId-D0sfforj.js +0 -1
- package/assets/_outboxMessageId-CuYUqctH.js +0 -1
- package/assets/_recurrenceId-CLQuwNQw.js +0 -1
- package/assets/_threadId-BGKDrxuA.js +0 -1
- package/assets/_threadId-Ba8E2aAx.js +0 -1
- package/assets/_threadId-Br_FU4M4.js +0 -1
- package/assets/_threadId-D9ge4hnK.js +0 -1
- package/assets/brief--Wmhw18k.js +0 -1
- package/assets/compose._-_outboxMessageId_-BGkih4eY.js +0 -1
- package/assets/compose._-_outboxMessageId_-CivLnC_Q.js +0 -1
- package/assets/compose._-_outboxMessageId_-DhaK6pb5.js +0 -1
- package/assets/compose._-_outboxMessageId_-cX-iEK_S.js +0 -1
- package/assets/compose._-_outboxMessageId_-nFk2BCjJ.js +0 -1
- package/assets/edit-CO4QGWtB.js +0 -1
- package/assets/edit-DRr0H801.js +0 -1
- package/assets/flagged-BLzcJrUz.js +0 -1
- package/assets/index-6MdUWIJB.js +0 -1
- package/assets/index-B3pRGruo.js +0 -1
- package/assets/index-BDF8UTpu.js +0 -1
- package/assets/index-BoKIe_Hw.js +0 -1
- package/assets/index-CO7AhNVu.js +0 -1
- package/assets/index-CR5Op_4t.js +0 -1
- package/assets/index-D0sfforj.js +0 -1
- package/assets/index-DLuz5acm.js +0 -1
- package/assets/index-DqCcXbbs.js +0 -1
- package/assets/index-GZXGsbCN.js +0 -1
- package/assets/index-PBPFqVVA.js +0 -1
- package/assets/index-h2rbe_XB.js +0 -1
- package/assets/new-DKJdGwfE.js +0 -1
- package/assets/onboarding-pnezHKXj.js +0 -1
- package/assets/outbox-CLnMeXYO.js +0 -1
- package/assets/settings-C8z99CK0.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aS as v,aT as T}from"./index-
|
|
1
|
+
import{aS as v,aT as T}from"./index-C2US5ZnK.js";const S=e=>new Promise(n=>{n(JSON.parse(e))}),l=["accounts","labels","filters","addressFlags","settings"],g={accounts:"Accounts",labels:"Labels",filters:"Rules & filters",addressFlags:"Senders",settings:"Folders & appearance"},k=["created","updated","unchanged","skipped","rejected"],$={created:"positive",updated:"accent",unchanged:"neutral",skipped:"warning",rejected:"danger"},m=e=>k.includes(e)?e:"rejected",h="unknown",p=e=>l.includes(e)?e:void 0,I=e=>{const n=new Map;return e.forEach((t,i)=>{const a=p(t.section)??h,r=n.get(a)??[];r.push({id:`${a}-${t.key}-${i}`,label:t.key,verdict:m(t.verdict),reason:a===h?t.reason??`This instance does not know the "${t.section}" section, so it cannot say what this entry does.`:t.reason}),n.set(a,r)}),[...l,h].filter(t=>n.has(t)).map(t=>({id:t,title:t===h?"Not recognised":g[t],entries:n.get(t)??[]}))},j=e=>{const n={created:0,updated:0,unchanged:0,skipped:0,rejected:0};for(const o of e)n[m(o.verdict)]+=1;return n},E={NotAnObject:()=>({title:"That is not a Reader config file",explanation:"The file was read, but it is not a configuration document — a Reader config is a JSON object carrying a kind and a schemaVersion.",fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host."}),WrongKind:()=>({title:"That is not a Reader config file",explanation:"The file parses as JSON but does not declare itself a Reader configuration, so nothing here can be trusted to mean what it looks like.",fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host."}),UnsupportedVersion:e=>({title:"This file was written by a newer Reader",explanation:e.message||"The file declares a schema version this instance does not read, so importing it would drop settings it cannot understand.",fix:"Update this Reader, then import again. The file is unchanged and safe to keep."}),UnknownKeys:e=>({title:"The file contains settings this version does not know",explanation:"An unknown key is refused rather than quietly dropped: losing configuration without saying so is exactly what this feature exists to prevent.",fix:`Update this Reader, or remove the named keys from the file and import again. ${e.message}`}),CredentialPresent:()=>({title:"The file carries a credential",explanation:"A configuration document describes which credential an account needs; it never carries one. Reader refuses the file rather than importing around it — the secret may now be in your backups, your chat history, or a pull request.",fix:"Delete the field from the file and import again, then change that mailbox's password. Exports written by Reader never contain one."}),Malformed:e=>({title:"The file does not match the configuration format",explanation:"Every part of the document has to validate before anything is written, and this one does not.",fix:`Re-export it from the instance you are moving from. ${e.message}`}),duplicate_key:e=>({title:"The file names something twice",explanation:"A configuration names each account, label and filter once, so a document with two of the same key has no single answer to import.",fix:`Remove the duplicate and import again. ${e.message}`}),unknown_label:e=>({title:"A rule points at a label that is not here",explanation:"The file applies a label neither it nor this instance carries, so the rule would land doing nothing.",fix:`Add the label to the file, or create it here first, then import again. ${e.message}`}),unknown_account:e=>({title:"A rule points at an account that is not here",explanation:"The file files mail into a folder on an account it does not carry, so the rule has no destination to bind to.",fix:`Export the configuration again from an instance that holds both, then import that file. ${e.message}`})},R=e=>({title:"The file could not be imported",explanation:e.message||"The import was refused and nothing was written.",fix:"Re-export the configuration from the instance you are moving from and try again. If it keeps failing, report it with the line below."}),x="import_write_failed",N="config_not_empty",F=e=>{const n=v(e);if(n!==void 0&&n!==409)return;const o=e instanceof T?e.body:e;if(typeof o!="object"||o===null)return;const t=o;if(t.code===N)return{message:typeof t.message=="string"?t.message:"",details:typeof t.details=="object"&&t.details!==null?t.details:void 0}},C=e=>{const n=e.errors.find(t=>t.code!==x);return n?{...(E[n.code]??R)(n),raw:`${n.code}: ${n.message}`}:void 0},O=e=>e.errors.find(n=>n.code===x),w="Nothing from this section was written.",D=e=>{const n=O(e),o=n?.details?.section,t=o?p(o):void 0,i=!e.applied,a=new Map;for(const s of e.items){if(m(s.verdict)==="rejected")continue;const c=p(s.section);c&&a.set(c,(a.get(c)??0)+1)}const r=(s,c)=>l.map(d=>({section:d,title:g[d],state:s,detail:c}));if(!t){if(i)return r("not-landed",w);const s=o?`The import stopped in "${o}", which this instance does not recognise, so it cannot say whether this section was written.`:"The import stopped without naming where, so it cannot say whether this section was written. Open Settings to see what is here.";return r("unknown",s)}const f=l.indexOf(t);return l.map((s,c)=>{const d=g[s];if(s===t)return{section:s,title:d,state:"failed",detail:n?.message??"This section could not be written."};if(c>f)return{section:s,title:d,state:"not-attempted",detail:"Not attempted — the import stopped before this section."};if(i)return{section:s,title:d,state:"not-landed",detail:w};const u=a.get(s)??0;return{section:s,title:d,state:"landed",detail:u===0?"Nothing in the file for this section.":`${u} ${u===1?"entry":"entries"} written.`}})},_="folder_not_found_yet",L=e=>{const n=new Set,o=[];for(const t of e.warnings){if(t.code!==_)continue;const i=t.details?.folderPath;if(!i)continue;const a=t.details?.filter,r=t.details?.accountId,f=`${r??""}:${i}:${a??""}`;n.has(f)||(n.add(f),o.push({path:i,accountId:r,waitingFor:a?`Rule “${a}”`:"A folder role or a folder's own settings"}))}return o},y=2*1024*1024,b=Symbol("not json"),J=async(e,n,o)=>{if(n>y)return{ok:!1,failure:{title:"That file is too large to be a config file",explanation:`${e} is ${Math.round(n/1024)} kB. A Reader configuration is tens of kilobytes; a file this size is something else.`,fix:"Pick the .json file written by Settings › Advanced, or by remit config save.",raw:`${n} bytes > ${y} byte limit`}};let t="";const i=await S(o).catch(a=>(t=a instanceof Error?a.message:String(a),b));return i===b?{ok:!1,failure:{title:"That file is not JSON",explanation:`${e} could not be read as JSON at all, so there is nothing in it to import.`,fix:"Pick the .json file written by Settings › Advanced, or by remit config save.",raw:t}}:typeof i!="object"||i===null||Array.isArray(i)?{ok:!1,failure:{title:"That is not a Reader config file",explanation:`${e} is valid JSON but not a configuration document — a Reader config is a JSON object carrying a kind and a schemaVersion.`,fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host.",raw:`expected a JSON object, found ${Array.isArray(i)?"an array":typeof i}`}}:{ok:!0,document:i}},P=e=>`reader-config.${e.toISOString().slice(0,10)}.json`,U=e=>e<1024?`${e} B`:`${Math.round(e/1024)} kB`;export{x as W,F as a,C as b,j as c,P as e,U as f,I as g,L as p,J as r,D as s,$ as v,O as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,n as x,o as f,j as e,D as b,p as t}from"./index-
|
|
1
|
+
import{r as u,n as x,o as f,j as e,D as b,p as t}from"./index-C2US5ZnK.js";const h=({isOpen:s,title:r,description:n,confirmLabel:l,cancelLabel:o="Cancel",destructive:c=!1,isBusy:d=!1,onConfirm:m,onCancel:a})=>{const i=u.useRef(null);return x({id:"confirm-dialog",open:s,answers:{back:a}}),f(i,s),s?e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[e.jsx(b,{label:"Dismiss confirmation",onDismiss:a,className:"backdrop-blur-sm"}),e.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,className:t("relative z-10 w-full max-w-sm","bg-surface border border-line rounded-sm shadow-lg","p-6"),children:[e.jsx("h2",{className:"text-lg font-semibold",children:r}),n&&e.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:n}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:a,className:t("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors","border border-line hover:bg-surface-raised"),children:o}),e.jsx("button",{type:"button",onClick:m,disabled:d,className:t("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors",c?"bg-danger text-canvas hover:bg-danger/90":"bg-accent text-accent-fg hover:bg-accent-hover","disabled:opacity-50 disabled:cursor-not-allowed"),children:l})]})]})]}):null};export{h as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as c}from"./index-
|
|
1
|
+
import{b as c}from"./index-C2US5ZnK.js";const e={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};e.node;const t=c(e);export{t as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as B,j as t,at as q,p as E,r as n,aJ as R,ar as C,f as G,ap as J,d as X,as as K,B as N}from"./index-CKFdaY9c.js";import{S as D}from"./select-yGv73aji.js";import{B as Q}from"./badge-DYFkBshe.js";import{C as Y}from"./card-13z0qC0r.js";const H={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};H.node;const ht=B(H);function Z({url:r}){return t.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Stored encrypted, used only to connect to your mail server."," ",r?t.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"How to create an app password"}):t.jsx("span",{children:"Check your provider's help for app password instructions."})]})}function F({value:r,defaultValue:i,onValueChange:s,...e}){return s?t.jsxs(D,{value:r,onChange:a=>s(a.target.value),...e,children:[t.jsx("option",{value:"tls",children:"TLS/SSL"}),t.jsx("option",{value:"starttls",children:"STARTTLS"}),t.jsx("option",{value:"none",children:"None (insecure)"})]}):t.jsxs(D,{defaultValue:i??r,...e,children:[t.jsx("option",{value:"tls",children:"TLS/SSL"}),t.jsx("option",{value:"starttls",children:"STARTTLS"}),t.jsx("option",{value:"none",children:"None (insecure)"})]})}function M(r){return{tls:r==="tls",startTls:r==="starttls"}}function tt({steps:r,activeStep:i}){return t.jsx("ol",{className:"flex items-center gap-1",children:r.map((s,e)=>{const a=e<i,o=e===i;return t.jsxs("li",{className:"flex items-center gap-1",children:[e>0&&t.jsx("span",{className:"h-px w-5 bg-line","aria-hidden":!0}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:E("flex size-5 items-center justify-center rounded-full text-2xs font-semibold tabular-nums",a&&"bg-accent text-accent-fg",o&&"bg-accent-soft text-accent ring-1 ring-accent",!a&&!o&&"bg-surface-sunken text-fg-subtle"),children:a?t.jsx(q,{className:"size-3"}):e+1}),t.jsx("span",{className:E("hidden text-2xs sm:inline",o?"font-medium text-fg":"text-fg-subtle"),children:s})]})]},s)})})}function U({steps:r,activeStep:i,title:s,subtitle:e,children:a,footer:o,hideSteps:c}){return t.jsxs("div",{className:"flex h-dvh w-full flex-col items-center overflow-hidden bg-canvas pb-[max(2rem,env(safe-area-inset-bottom,0px))] pl-[max(2rem,env(safe-area-inset-left,0px))] pr-[max(2rem,env(safe-area-inset-right,0px))] pt-[max(2rem,env(safe-area-inset-top,0px))] font-sans text-fg",children:[t.jsx("div",{className:"hidden shrink-[9999] basis-[30vh] sm:block"}),!c&&t.jsx("div",{className:"mb-5 w-full max-w-xl shrink-0",children:t.jsx(tt,{steps:r,activeStep:i})}),t.jsxs(Y,{raised:!0,className:"flex w-full min-h-0 max-w-xl flex-col",children:[t.jsxs("div",{className:"shrink-0 px-5 pt-5",children:[t.jsx("h1",{className:"text-xl font-semibold text-fg",children:s}),e&&t.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:e})]}),t.jsx("div",{"data-testid":"wizard-body",className:"min-h-0 overflow-y-auto px-5 py-5",children:a}),o&&t.jsx("div",{"data-testid":"wizard-footer",className:"flex shrink-0 items-center justify-between gap-3 border-t border-line px-5 py-3",children:o})]})]})}const et="Coming soon — use IMAP for now.";function xt({name:r,description:i,icon:s,comingSoon:e,selected:a,onSelect:o}){const[c,l]=n.useState(!1),m=()=>{if(o){o();return}e&&l(!0)};return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("button",{type:"button",onClick:m,"aria-disabled":e||void 0,className:E("flex flex-col items-start gap-2 rounded-sm border p-3 text-left transition-colors",a?"border-accent-2 bg-accent-2-soft":"border-line bg-surface hover:border-line-strong",e&&"opacity-55"),children:[t.jsx("span",{className:E("text-fg-muted",a&&"text-accent-2"),children:s}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-semibold text-fg",children:r}),e&&t.jsx("span",{className:"rounded-full bg-surface-sunken px-1.5 py-0.5 text-2xs text-fg-subtle",children:"soon"})]}),t.jsx("span",{className:"text-xs text-fg-subtle",children:i})]}),c&&t.jsx("p",{className:"text-2xs text-fg-subtle",children:et})]})}function ft({legend:r,badge:i,host:s,port:e,security:a,readOnly:o,onHostChange:c,onPortChange:l,onSecurityChange:m,hostPlaceholder:x,portPlaceholder:y}){const v=n.useId(),b=n.useId(),h=n.useId();return t.jsxs("fieldset",{children:[t.jsxs("legend",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[r,i&&t.jsx(Q,{tone:i.tone,children:i.label})]}),t.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-3 sm:grid-cols-[1fr_6rem_8rem] sm:gap-2",children:[t.jsxs("div",{children:[t.jsx(R,{htmlFor:v,children:"Host"}),c?t.jsx(C,{id:v,readOnly:o,value:s,onChange:p=>c(p.target.value),placeholder:x}):t.jsx(C,{id:v,readOnly:o,defaultValue:s,placeholder:x})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:b,children:"Port"}),l?t.jsx(C,{id:b,readOnly:o,value:e,onChange:p=>l(p.target.value),placeholder:y}):t.jsx(C,{id:b,readOnly:o,defaultValue:e,placeholder:y})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:h,children:"Security"}),m?t.jsx(F,{id:h,disabled:o,value:a,onValueChange:m}):t.jsx(F,{id:h,disabled:o,defaultValue:a})]})]})]})}function _({label:r,detail:i,state:s}){return t.jsxs("div",{className:"flex items-start gap-3 py-2",children:[t.jsxs("span",{className:E("mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full text-2xs",s==="ok"&&"bg-positive text-accent-fg",s==="failed"&&"bg-danger text-accent-fg",s==="running"&&"border border-accent text-accent",s==="pending"&&"border border-line text-fg-subtle"),children:[s==="ok"&&t.jsx(q,{className:"size-3"}),s==="failed"&&"!",s==="running"&&t.jsx("span",{className:"size-2 animate-pulse rounded-full bg-accent"})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:E("text-sm",s==="failed"?"font-medium text-danger":"text-fg"),children:r}),i&&t.jsx("div",{className:"mt-0.5 text-xs text-fg-subtle",children:i})]})]})}const st=(r,i)=>{const s=n.useRef(i);s.current=i,n.useEffect(()=>{if(!r)return;const e=()=>{document.visibilityState==="visible"&&s.current()};return document.addEventListener("visibilitychange",e),window.addEventListener("pageshow",e),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("pageshow",e)}},[r])},rt=2e4,gt="Couldn't open Microsoft's sign-in page. Check your connection, and anything blocking redirects, then try again.",yt=r=>{const i=n.useRef(!1),s=n.useRef(!1),e=n.useRef(null),a=n.useRef(r);a.current=r;const o=n.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),c=n.useCallback(()=>{!i.current||!s.current||(o(),s.current=!1,a.current("returned"))},[o]);return n.useEffect(()=>{const l=()=>{s.current=!0,o()},m=()=>{document.visibilityState==="hidden"&&l()},x=y=>{y.persisted&&(l(),c())};return document.addEventListener("visibilitychange",m),window.addEventListener("pagehide",l),window.addEventListener("pageshow",x),()=>{document.removeEventListener("visibilitychange",m),window.removeEventListener("pagehide",l),window.removeEventListener("pageshow",x),o()}},[c,o]),st(!0,c),n.useCallback(()=>{i.current=!0,s.current=!1,o(),e.current=setTimeout(()=>{e.current=null,i.current=!1,s.current=!1,a.current("stalled")},rt)},[o])},ot={"gmail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"googlemail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"outlook.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"hotmail.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"live.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"msn.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"icloud.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"me.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"mac.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"fastmail.com":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"fastmail.fm":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"yahoo.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"yahoo.co.uk":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"ymail.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"aol.com":{imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},source:"provider-table"},"zoho.com":{imap:{host:"imap.zoho.com",port:993,security:"tls"},smtp:{host:"smtp.zoho.com",port:465,security:"tls"},source:"provider-table"},"gmx.com":{imap:{host:"imap.gmx.com",port:993,security:"tls"},smtp:{host:"smtp.gmx.com",port:587,security:"starttls"},source:"provider-table"},"gmx.net":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"gmx.de":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"web.de":{imap:{host:"imap.web.de",port:993,security:"tls"},smtp:{host:"smtp.web.de",port:587,security:"starttls"},source:"provider-table"},"mail.com":{imap:{host:"imap.mail.com",port:993,security:"tls"},smtp:{host:"smtp.mail.com",port:465,security:"tls"},source:"provider-table"},"hey.com":{imap:{host:"imap.hey.com",port:993,security:"tls"},smtp:{host:"smtp.hey.com",port:465,security:"tls"},source:"provider-table"},"tutanota.com":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"tuta.io":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"posteo.de":{imap:{host:"posteo.de",port:993,security:"tls"},smtp:{host:"posteo.de",port:465,security:"tls"},source:"provider-table"},"runbox.com":{imap:{host:"imap.runbox.com",port:993,security:"tls"},smtp:{host:"smtp.runbox.com",port:587,security:"starttls"},source:"provider-table"},"mailbox.org":{imap:{host:"imap.mailbox.org",port:993,security:"tls"},smtp:{host:"smtp.mailbox.org",port:465,security:"tls"},source:"provider-table"},"hushmail.com":{imap:{host:"imap.hushmail.com",port:993,security:"tls"},smtp:{host:"smtp.hushmail.com",port:465,security:"tls"},source:"provider-table"}},it={"gmail.com":"https://support.google.com/accounts/answer/185833","googlemail.com":"https://support.google.com/accounts/answer/185833","yahoo.com":"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html","icloud.com":"https://support.apple.com/en-us/102654","me.com":"https://support.apple.com/en-us/102654","mac.com":"https://support.apple.com/en-us/102654","fastmail.com":"https://www.fastmail.help/hc/en-us/articles/360058752854","fastmail.fm":"https://www.fastmail.help/hc/en-us/articles/360058752854","outlook.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","hotmail.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","zoho.com":"https://help.zoho.com/portal/en/kb/zoho-mail/client-configuration/imap-access/articles/zoho-mail-app-passwords"};function V(r){try{const s=new DOMParser().parseFromString(r,"application/xml");if(s.querySelector("parsererror"))return null;const e=s.querySelectorAll("incomingServer[type='imap']"),a=s.querySelectorAll("outgoingServer[type='smtp']");if(!e.length||!a.length)return null;const o=e[0],c=a[0],l=o.querySelector("hostname")?.textContent?.trim(),m=o.querySelector("port")?.textContent?.trim(),x=o.querySelector("socketType")?.textContent?.trim().toUpperCase(),y=c.querySelector("hostname")?.textContent?.trim(),v=c.querySelector("port")?.textContent?.trim(),b=c.querySelector("socketType")?.textContent?.trim().toUpperCase();if(!l||!m||!y||!v)return null;const h=p=>p==="SSL"||p==="TLS"||p==="SSL/TLS"?"tls":p==="STARTTLS"?"starttls":"none";return{imap:{host:l,port:Number.parseInt(m,10),security:h(x)},smtp:{host:y,port:Number.parseInt(v,10),security:h(b)},source:"mozilla-autoconfig"}}catch{return null}}async function at(r,i){try{const s=`https://autoconfig.thunderbird.net/v1.1/${r}`,e=await fetch(s,{signal:i});if(!e.ok)return null;const a=await e.text(),o=V(a);return o||null}catch{return null}}async function nt(r,i){try{const s=`https://autoconfig.${r}/mail/config-v1.1.xml`,e=await fetch(s,{signal:i});if(!e.ok)return null;const a=await e.text(),o=V(a);return o?{...o,source:"domain-autoconfig"}:null}catch{return null}}function ct(r){return{imap:{host:`imap.${r}`,port:993,security:"tls"},smtp:{host:`smtp.${r}`,port:587,security:"starttls"},source:"heuristic"}}async function vt(r,i=1500){const s=r.indexOf("@");if(s===-1)return null;const e=r.slice(s+1).toLowerCase();if(!e)return null;const a=ot[e];if(a)return a;const o=new AbortController,c=setTimeout(()=>o.abort(),i);try{const l=await at(e,o.signal);if(l)return l;const m=await nt(e,o.signal);if(m)return m}finally{clearTimeout(c)}return ct(e)}function bt(r){const i=r.indexOf("@");return i===-1?"Looking up server settings…":`Looking up settings for ${r.slice(i+1)}…`}function lt(r){const i=r.indexOf("@");if(i===-1)return;const s=r.slice(i+1).toLowerCase();return it[s]}function wt({steps:r,activeStep:i,title:s,subtitle:e,email:a,username:o,password:c,notice:l,error:m,continueLabel:x="Test connection",backLabel:y="Back",onContinue:v,onBack:b,onChange:h}){const[p,z]=n.useState(o||a),[S,w]=n.useState(c),[T,k]=n.useState(null),I=lt(a),g=p.trim()!==""&&S.trim()!=="";n.useEffect(()=>{h(p,S)},[p,S,h]);const L=n.useCallback(()=>{if(!g){k("Enter your username and password.");return}k(null),v()},[g,v]);return n.useEffect(()=>{const u=j=>{j.key==="Enter"&&L(),j.key==="Escape"&&b()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[L,b]),t.jsx(U,{steps:r,activeStep:i,title:s,subtitle:e,footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:b,children:y}),t.jsx(N,{variant:"primary",onClick:L,children:x})]}),children:t.jsxs("div",{className:"space-y-3",children:[m&&t.jsx(X,{tone:"danger",children:m}),T&&t.jsx("div",{className:"rounded-md bg-danger-soft px-3 py-2 text-sm text-danger",children:T}),l,t.jsxs("div",{children:[t.jsx(R,{htmlFor:"credentials-username",children:"Username"}),t.jsx(C,{id:"credentials-username",value:p,onChange:u=>{z(u.target.value),k(null)},autoComplete:"username"})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:"credentials-password",children:"Password or app password"}),t.jsx(K,{id:"credentials-password",value:S,onChange:u=>{w(u.target.value),k(null)},autoComplete:"current-password"})]}),t.jsx(Z,{url:I})]})})}function jt({steps:r,activeStep:i,email:s,imapConfig:e,smtpConfig:a,username:o,password:c,onSuccess:l,onBackToCredentials:m,onBackToServers:x,credentialsBackLabel:y="Back to credentials",serversBackLabel:v="Back to servers",successLabel:b="Start syncing"}){const[h,p]=n.useState({imapState:"running",smtpState:"pending",phase:"running"}),[z,S]=n.useState(0),w=a.host.trim()!=="",T=M(e.security),k=M(a.security),I=G({...J()});n.useEffect(()=>{let u=!1;const j=[];return p({imapState:"running",smtpState:"pending",phase:"running"}),I.mutate({body:{username:o,password:c,imapHost:e.host,imapPort:e.port,imapTls:T.tls,imapStartTls:T.startTls,smtpHost:a.host,smtpPort:a.port,smtpTls:k.tls,smtpStartTls:k.startTls}},{onSuccess:d=>{if(u)return;const f=d.imapSuccess,P=w?d.smtpSuccess:!0;p({imapState:f?"ok":"failed",smtpState:w?"running":"ok",imapDetail:f?`Connected — ${e.host}:${e.port}`:d.imapError,phase:"running"}),j.push(window.setTimeout(()=>{if(u)return;const $=W=>{const A=W?.toLowerCase()??"";return A.includes("auth")||A.includes("login")||A.includes("535")||A.includes("credential")},O=!f&&$(d.imapError)||f&&w&&!d.smtpSuccess&&$(d.smtpError);p({imapState:f?"ok":"failed",smtpState:w?d.smtpSuccess?"ok":"failed":"ok",imapDetail:f?`Connected — ${e.host}:${e.port}`:d.imapError,smtpDetail:w?d.smtpSuccess?`Connected — ${a.host}:${a.port}`:d.smtpError:"Not set up — receive-only",rawError:f?w&&!d.smtpSuccess?d.smtpError:void 0:d.imapError,phase:f&&P?"success":O?"auth-failure":"network-failure"}),f&&P&&j.push(window.setTimeout(()=>{u||l()},800))},400))},onError:d=>{if(u)return;const f=d instanceof Error?d.message:"Connection failed";p({imapState:"failed",smtpState:"failed",imapDetail:f,smtpDetail:f,rawError:f,phase:"network-failure"})}}),()=>{u=!0;for(const d of j)window.clearTimeout(d)}},[z]);const{phase:g}=h;n.useEffect(()=>{const u=j=>{j.key==="Escape"&&(g==="auth-failure"?m():g==="network-failure"&&x())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[g,m,x]);const L=g==="auth-failure"?t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:m,children:y}),t.jsx(N,{variant:"primary",onClick:()=>S(u=>u+1),children:"Retry"})]}):g==="network-failure"?t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:x,children:v}),t.jsx(N,{variant:"primary",onClick:()=>S(u=>u+1),children:"Retry"})]}):g==="success"?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-2xs text-fg-subtle",children:"Connection verified"}),t.jsx(N,{variant:"primary",onClick:l,children:b})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-2xs text-fg-subtle",children:"Testing…"}),t.jsx("span",{})]});return t.jsx(U,{steps:r,activeStep:i,title:"Testing the connection",subtitle:`Checking ${s}`,footer:L,children:t.jsxs("div",{className:"divide-y divide-line",children:[t.jsx(_,{label:`IMAP — ${e.host}:${e.port}`,detail:h.imapDetail,state:h.imapState}),t.jsx(_,{label:w?`SMTP — ${a.host}:${a.port}`:"SMTP — sending",detail:w?h.smtpDetail:"Not set up — you can add sending later in Settings",state:h.smtpState}),(g==="auth-failure"||g==="network-failure")&&h.rawError&&t.jsxs("div",{className:"py-3",children:[g==="auth-failure"&&t.jsx("p",{className:"mb-2 text-xs text-fg-muted",children:"Check your password — many providers require an app password."}),t.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:h.rawError})]})]})})}export{it as A,_ as C,gt as R,ht as S,U as W,xt as a,yt as b,jt as c,wt as d,ft as e,bt as f,lt as g,vt as h,M as s,st as u};
|
|
1
|
+
import{b as B,j as t,at as q,p as E,r as n,aJ as R,ar as C,f as G,ap as J,d as X,as as K,B as N}from"./index-C2US5ZnK.js";import{S as D}from"./select-DhVwx5IO.js";import{B as Q}from"./badge-CDOouHHB.js";import{C as Y}from"./card-D8MhhaRw.js";const H={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};H.node;const ht=B(H);function Z({url:r}){return t.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Stored encrypted, used only to connect to your mail server."," ",r?t.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"How to create an app password"}):t.jsx("span",{children:"Check your provider's help for app password instructions."})]})}function F({value:r,defaultValue:i,onValueChange:s,...e}){return s?t.jsxs(D,{value:r,onChange:a=>s(a.target.value),...e,children:[t.jsx("option",{value:"tls",children:"TLS/SSL"}),t.jsx("option",{value:"starttls",children:"STARTTLS"}),t.jsx("option",{value:"none",children:"None (insecure)"})]}):t.jsxs(D,{defaultValue:i??r,...e,children:[t.jsx("option",{value:"tls",children:"TLS/SSL"}),t.jsx("option",{value:"starttls",children:"STARTTLS"}),t.jsx("option",{value:"none",children:"None (insecure)"})]})}function M(r){return{tls:r==="tls",startTls:r==="starttls"}}function tt({steps:r,activeStep:i}){return t.jsx("ol",{className:"flex items-center gap-1",children:r.map((s,e)=>{const a=e<i,o=e===i;return t.jsxs("li",{className:"flex items-center gap-1",children:[e>0&&t.jsx("span",{className:"h-px w-5 bg-line","aria-hidden":!0}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:E("flex size-5 items-center justify-center rounded-full text-2xs font-semibold tabular-nums",a&&"bg-accent text-accent-fg",o&&"bg-accent-soft text-accent ring-1 ring-accent",!a&&!o&&"bg-surface-sunken text-fg-subtle"),children:a?t.jsx(q,{className:"size-3"}):e+1}),t.jsx("span",{className:E("hidden text-2xs sm:inline",o?"font-medium text-fg":"text-fg-subtle"),children:s})]})]},s)})})}function U({steps:r,activeStep:i,title:s,subtitle:e,children:a,footer:o,hideSteps:c}){return t.jsxs("div",{className:"flex h-dvh w-full flex-col items-center overflow-hidden bg-canvas pb-[max(2rem,env(safe-area-inset-bottom,0px))] pl-[max(2rem,env(safe-area-inset-left,0px))] pr-[max(2rem,env(safe-area-inset-right,0px))] pt-[max(2rem,env(safe-area-inset-top,0px))] font-sans text-fg",children:[t.jsx("div",{className:"hidden shrink-[9999] basis-[30vh] sm:block"}),!c&&t.jsx("div",{className:"mb-5 w-full max-w-xl shrink-0",children:t.jsx(tt,{steps:r,activeStep:i})}),t.jsxs(Y,{raised:!0,className:"flex w-full min-h-0 max-w-xl flex-col",children:[t.jsxs("div",{className:"shrink-0 px-5 pt-5",children:[t.jsx("h1",{className:"text-xl font-semibold text-fg",children:s}),e&&t.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:e})]}),t.jsx("div",{"data-testid":"wizard-body",className:"min-h-0 overflow-y-auto px-5 py-5",children:a}),o&&t.jsx("div",{"data-testid":"wizard-footer",className:"flex shrink-0 items-center justify-between gap-3 border-t border-line px-5 py-3",children:o})]})]})}const et="Coming soon — use IMAP for now.";function xt({name:r,description:i,icon:s,comingSoon:e,selected:a,onSelect:o}){const[c,l]=n.useState(!1),m=()=>{if(o){o();return}e&&l(!0)};return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("button",{type:"button",onClick:m,"aria-disabled":e||void 0,className:E("flex flex-col items-start gap-2 rounded-sm border p-3 text-left transition-colors",a?"border-accent-2 bg-accent-2-soft":"border-line bg-surface hover:border-line-strong",e&&"opacity-55"),children:[t.jsx("span",{className:E("text-fg-muted",a&&"text-accent-2"),children:s}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-semibold text-fg",children:r}),e&&t.jsx("span",{className:"rounded-full bg-surface-sunken px-1.5 py-0.5 text-2xs text-fg-subtle",children:"soon"})]}),t.jsx("span",{className:"text-xs text-fg-subtle",children:i})]}),c&&t.jsx("p",{className:"text-2xs text-fg-subtle",children:et})]})}function ft({legend:r,badge:i,host:s,port:e,security:a,readOnly:o,onHostChange:c,onPortChange:l,onSecurityChange:m,hostPlaceholder:x,portPlaceholder:y}){const v=n.useId(),b=n.useId(),h=n.useId();return t.jsxs("fieldset",{children:[t.jsxs("legend",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[r,i&&t.jsx(Q,{tone:i.tone,children:i.label})]}),t.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-3 sm:grid-cols-[1fr_6rem_8rem] sm:gap-2",children:[t.jsxs("div",{children:[t.jsx(R,{htmlFor:v,children:"Host"}),c?t.jsx(C,{id:v,readOnly:o,value:s,onChange:p=>c(p.target.value),placeholder:x}):t.jsx(C,{id:v,readOnly:o,defaultValue:s,placeholder:x})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:b,children:"Port"}),l?t.jsx(C,{id:b,readOnly:o,value:e,onChange:p=>l(p.target.value),placeholder:y}):t.jsx(C,{id:b,readOnly:o,defaultValue:e,placeholder:y})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:h,children:"Security"}),m?t.jsx(F,{id:h,disabled:o,value:a,onValueChange:m}):t.jsx(F,{id:h,disabled:o,defaultValue:a})]})]})]})}function _({label:r,detail:i,state:s}){return t.jsxs("div",{className:"flex items-start gap-3 py-2",children:[t.jsxs("span",{className:E("mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full text-2xs",s==="ok"&&"bg-positive text-accent-fg",s==="failed"&&"bg-danger text-accent-fg",s==="running"&&"border border-accent text-accent",s==="pending"&&"border border-line text-fg-subtle"),children:[s==="ok"&&t.jsx(q,{className:"size-3"}),s==="failed"&&"!",s==="running"&&t.jsx("span",{className:"size-2 animate-pulse rounded-full bg-accent"})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:E("text-sm",s==="failed"?"font-medium text-danger":"text-fg"),children:r}),i&&t.jsx("div",{className:"mt-0.5 text-xs text-fg-subtle",children:i})]})]})}const st=(r,i)=>{const s=n.useRef(i);s.current=i,n.useEffect(()=>{if(!r)return;const e=()=>{document.visibilityState==="visible"&&s.current()};return document.addEventListener("visibilitychange",e),window.addEventListener("pageshow",e),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("pageshow",e)}},[r])},rt=2e4,gt="Couldn't open Microsoft's sign-in page. Check your connection, and anything blocking redirects, then try again.",yt=r=>{const i=n.useRef(!1),s=n.useRef(!1),e=n.useRef(null),a=n.useRef(r);a.current=r;const o=n.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),c=n.useCallback(()=>{!i.current||!s.current||(o(),s.current=!1,a.current("returned"))},[o]);return n.useEffect(()=>{const l=()=>{s.current=!0,o()},m=()=>{document.visibilityState==="hidden"&&l()},x=y=>{y.persisted&&(l(),c())};return document.addEventListener("visibilitychange",m),window.addEventListener("pagehide",l),window.addEventListener("pageshow",x),()=>{document.removeEventListener("visibilitychange",m),window.removeEventListener("pagehide",l),window.removeEventListener("pageshow",x),o()}},[c,o]),st(!0,c),n.useCallback(()=>{i.current=!0,s.current=!1,o(),e.current=setTimeout(()=>{e.current=null,i.current=!1,s.current=!1,a.current("stalled")},rt)},[o])},ot={"gmail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"googlemail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"outlook.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"hotmail.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"live.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"msn.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"icloud.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"me.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"mac.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"fastmail.com":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"fastmail.fm":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"yahoo.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"yahoo.co.uk":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"ymail.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"aol.com":{imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},source:"provider-table"},"zoho.com":{imap:{host:"imap.zoho.com",port:993,security:"tls"},smtp:{host:"smtp.zoho.com",port:465,security:"tls"},source:"provider-table"},"gmx.com":{imap:{host:"imap.gmx.com",port:993,security:"tls"},smtp:{host:"smtp.gmx.com",port:587,security:"starttls"},source:"provider-table"},"gmx.net":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"gmx.de":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"web.de":{imap:{host:"imap.web.de",port:993,security:"tls"},smtp:{host:"smtp.web.de",port:587,security:"starttls"},source:"provider-table"},"mail.com":{imap:{host:"imap.mail.com",port:993,security:"tls"},smtp:{host:"smtp.mail.com",port:465,security:"tls"},source:"provider-table"},"hey.com":{imap:{host:"imap.hey.com",port:993,security:"tls"},smtp:{host:"smtp.hey.com",port:465,security:"tls"},source:"provider-table"},"tutanota.com":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"tuta.io":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"posteo.de":{imap:{host:"posteo.de",port:993,security:"tls"},smtp:{host:"posteo.de",port:465,security:"tls"},source:"provider-table"},"runbox.com":{imap:{host:"imap.runbox.com",port:993,security:"tls"},smtp:{host:"smtp.runbox.com",port:587,security:"starttls"},source:"provider-table"},"mailbox.org":{imap:{host:"imap.mailbox.org",port:993,security:"tls"},smtp:{host:"smtp.mailbox.org",port:465,security:"tls"},source:"provider-table"},"hushmail.com":{imap:{host:"imap.hushmail.com",port:993,security:"tls"},smtp:{host:"smtp.hushmail.com",port:465,security:"tls"},source:"provider-table"}},it={"gmail.com":"https://support.google.com/accounts/answer/185833","googlemail.com":"https://support.google.com/accounts/answer/185833","yahoo.com":"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html","icloud.com":"https://support.apple.com/en-us/102654","me.com":"https://support.apple.com/en-us/102654","mac.com":"https://support.apple.com/en-us/102654","fastmail.com":"https://www.fastmail.help/hc/en-us/articles/360058752854","fastmail.fm":"https://www.fastmail.help/hc/en-us/articles/360058752854","outlook.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","hotmail.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","zoho.com":"https://help.zoho.com/portal/en/kb/zoho-mail/client-configuration/imap-access/articles/zoho-mail-app-passwords"};function V(r){try{const s=new DOMParser().parseFromString(r,"application/xml");if(s.querySelector("parsererror"))return null;const e=s.querySelectorAll("incomingServer[type='imap']"),a=s.querySelectorAll("outgoingServer[type='smtp']");if(!e.length||!a.length)return null;const o=e[0],c=a[0],l=o.querySelector("hostname")?.textContent?.trim(),m=o.querySelector("port")?.textContent?.trim(),x=o.querySelector("socketType")?.textContent?.trim().toUpperCase(),y=c.querySelector("hostname")?.textContent?.trim(),v=c.querySelector("port")?.textContent?.trim(),b=c.querySelector("socketType")?.textContent?.trim().toUpperCase();if(!l||!m||!y||!v)return null;const h=p=>p==="SSL"||p==="TLS"||p==="SSL/TLS"?"tls":p==="STARTTLS"?"starttls":"none";return{imap:{host:l,port:Number.parseInt(m,10),security:h(x)},smtp:{host:y,port:Number.parseInt(v,10),security:h(b)},source:"mozilla-autoconfig"}}catch{return null}}async function at(r,i){try{const s=`https://autoconfig.thunderbird.net/v1.1/${r}`,e=await fetch(s,{signal:i});if(!e.ok)return null;const a=await e.text(),o=V(a);return o||null}catch{return null}}async function nt(r,i){try{const s=`https://autoconfig.${r}/mail/config-v1.1.xml`,e=await fetch(s,{signal:i});if(!e.ok)return null;const a=await e.text(),o=V(a);return o?{...o,source:"domain-autoconfig"}:null}catch{return null}}function ct(r){return{imap:{host:`imap.${r}`,port:993,security:"tls"},smtp:{host:`smtp.${r}`,port:587,security:"starttls"},source:"heuristic"}}async function vt(r,i=1500){const s=r.indexOf("@");if(s===-1)return null;const e=r.slice(s+1).toLowerCase();if(!e)return null;const a=ot[e];if(a)return a;const o=new AbortController,c=setTimeout(()=>o.abort(),i);try{const l=await at(e,o.signal);if(l)return l;const m=await nt(e,o.signal);if(m)return m}finally{clearTimeout(c)}return ct(e)}function bt(r){const i=r.indexOf("@");return i===-1?"Looking up server settings…":`Looking up settings for ${r.slice(i+1)}…`}function lt(r){const i=r.indexOf("@");if(i===-1)return;const s=r.slice(i+1).toLowerCase();return it[s]}function wt({steps:r,activeStep:i,title:s,subtitle:e,email:a,username:o,password:c,notice:l,error:m,continueLabel:x="Test connection",backLabel:y="Back",onContinue:v,onBack:b,onChange:h}){const[p,z]=n.useState(o||a),[S,w]=n.useState(c),[T,k]=n.useState(null),I=lt(a),g=p.trim()!==""&&S.trim()!=="";n.useEffect(()=>{h(p,S)},[p,S,h]);const L=n.useCallback(()=>{if(!g){k("Enter your username and password.");return}k(null),v()},[g,v]);return n.useEffect(()=>{const u=j=>{j.key==="Enter"&&L(),j.key==="Escape"&&b()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[L,b]),t.jsx(U,{steps:r,activeStep:i,title:s,subtitle:e,footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:b,children:y}),t.jsx(N,{variant:"primary",onClick:L,children:x})]}),children:t.jsxs("div",{className:"space-y-3",children:[m&&t.jsx(X,{tone:"danger",children:m}),T&&t.jsx("div",{className:"rounded-md bg-danger-soft px-3 py-2 text-sm text-danger",children:T}),l,t.jsxs("div",{children:[t.jsx(R,{htmlFor:"credentials-username",children:"Username"}),t.jsx(C,{id:"credentials-username",value:p,onChange:u=>{z(u.target.value),k(null)},autoComplete:"username"})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:"credentials-password",children:"Password or app password"}),t.jsx(K,{id:"credentials-password",value:S,onChange:u=>{w(u.target.value),k(null)},autoComplete:"current-password"})]}),t.jsx(Z,{url:I})]})})}function jt({steps:r,activeStep:i,email:s,imapConfig:e,smtpConfig:a,username:o,password:c,onSuccess:l,onBackToCredentials:m,onBackToServers:x,credentialsBackLabel:y="Back to credentials",serversBackLabel:v="Back to servers",successLabel:b="Start syncing"}){const[h,p]=n.useState({imapState:"running",smtpState:"pending",phase:"running"}),[z,S]=n.useState(0),w=a.host.trim()!=="",T=M(e.security),k=M(a.security),I=G({...J()});n.useEffect(()=>{let u=!1;const j=[];return p({imapState:"running",smtpState:"pending",phase:"running"}),I.mutate({body:{username:o,password:c,imapHost:e.host,imapPort:e.port,imapTls:T.tls,imapStartTls:T.startTls,smtpHost:a.host,smtpPort:a.port,smtpTls:k.tls,smtpStartTls:k.startTls}},{onSuccess:d=>{if(u)return;const f=d.imapSuccess,P=w?d.smtpSuccess:!0;p({imapState:f?"ok":"failed",smtpState:w?"running":"ok",imapDetail:f?`Connected — ${e.host}:${e.port}`:d.imapError,phase:"running"}),j.push(window.setTimeout(()=>{if(u)return;const $=W=>{const A=W?.toLowerCase()??"";return A.includes("auth")||A.includes("login")||A.includes("535")||A.includes("credential")},O=!f&&$(d.imapError)||f&&w&&!d.smtpSuccess&&$(d.smtpError);p({imapState:f?"ok":"failed",smtpState:w?d.smtpSuccess?"ok":"failed":"ok",imapDetail:f?`Connected — ${e.host}:${e.port}`:d.imapError,smtpDetail:w?d.smtpSuccess?`Connected — ${a.host}:${a.port}`:d.smtpError:"Not set up — receive-only",rawError:f?w&&!d.smtpSuccess?d.smtpError:void 0:d.imapError,phase:f&&P?"success":O?"auth-failure":"network-failure"}),f&&P&&j.push(window.setTimeout(()=>{u||l()},800))},400))},onError:d=>{if(u)return;const f=d instanceof Error?d.message:"Connection failed";p({imapState:"failed",smtpState:"failed",imapDetail:f,smtpDetail:f,rawError:f,phase:"network-failure"})}}),()=>{u=!0;for(const d of j)window.clearTimeout(d)}},[z]);const{phase:g}=h;n.useEffect(()=>{const u=j=>{j.key==="Escape"&&(g==="auth-failure"?m():g==="network-failure"&&x())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[g,m,x]);const L=g==="auth-failure"?t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:m,children:y}),t.jsx(N,{variant:"primary",onClick:()=>S(u=>u+1),children:"Retry"})]}):g==="network-failure"?t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:x,children:v}),t.jsx(N,{variant:"primary",onClick:()=>S(u=>u+1),children:"Retry"})]}):g==="success"?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-2xs text-fg-subtle",children:"Connection verified"}),t.jsx(N,{variant:"primary",onClick:l,children:b})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-2xs text-fg-subtle",children:"Testing…"}),t.jsx("span",{})]});return t.jsx(U,{steps:r,activeStep:i,title:"Testing the connection",subtitle:`Checking ${s}`,footer:L,children:t.jsxs("div",{className:"divide-y divide-line",children:[t.jsx(_,{label:`IMAP — ${e.host}:${e.port}`,detail:h.imapDetail,state:h.imapState}),t.jsx(_,{label:w?`SMTP — ${a.host}:${a.port}`:"SMTP — sending",detail:w?h.smtpDetail:"Not set up — you can add sending later in Settings",state:h.smtpState}),(g==="auth-failure"||g==="network-failure")&&h.rawError&&t.jsxs("div",{className:"py-3",children:[g==="auth-failure"&&t.jsx("p",{className:"mb-2 text-xs text-fg-muted",children:"Check your password — many providers require an app password."}),t.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:h.rawError})]})]})})}export{it as A,_ as C,gt as R,ht as S,U as W,xt as a,yt as b,jt as c,wt as d,ft as e,bt as f,lt as g,vt as h,M as s,st as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o}from"./index-
|
|
1
|
+
import{b as o}from"./index-C2US5ZnK.js";const a={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};a.node;const n=o(a);export{n as D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f5 as g,cl as Y,f7 as B}from"./index-
|
|
1
|
+
import{f5 as g,cl as Y,f7 as B}from"./index-C2US5ZnK.js";import{q as F}from"./agenda-time-BwFncCBt.js";import{i as x}from"./calendar-guests-BVwUAczN.js";const m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["SU","MO","TU","WE","TH","FR","SA"],E=["January","February","March","April","May","June","July","August","September","October","November","December"],$=["first","second","third","fourth","last"],D=[1,2,3,4,-1],N="MO,TU,WE,TH,FR",L=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(e){const t=L(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${N}`;const a=t.match(/^Every week on (\w+)$/);if(a){const i=m.indexOf(a[1]);return i===-1?void 0:`FREQ=WEEKLY;BYDAY=${l[i]}`}const r=t.match(/^Every month on the (\w+) (\w+)$/);if(r){const i=$.indexOf(r[1]),n=m.indexOf(r[2]);return i===-1||n===-1?void 0:`FREQ=MONTHLY;BYDAY=${D[i]}${l[n]}`}const o=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(o){const i=E.indexOf(o[2]);return i===-1?void 0:`FREQ=YEARLY;BYMONTH=${i+1};BYMONTHDAY=${Number(o[1])}`}}const w=e=>e===""?"":`, ${e}`;function S(e,t){const a=new Map(e.split(";").map(n=>n.split("=")).filter(n=>n.length===2).map(([n,c])=>[n.toUpperCase(),c.toUpperCase()])),r=w(t),o=a.get("FREQ"),i=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(o==="DAILY")return`Every day${r}`;if(o==="WEEKLY"){if(i===void 0)return;if(i===N)return`Every weekday${r}`;const n=l.indexOf(i);return n===-1?void 0:`Every week on ${m[n]}${r}`}if(o==="MONTHLY"){const n=i?.match(/^(-?\d)([A-Z]{2})$/);if(!n)return;const c=D.indexOf(Number(n[1])),s=l.indexOf(n[2]);return c===-1||s===-1?void 0:`Every month on the ${$[c]} ${m[s]}${r}`}if(o==="YEARLY"){const n=Number(a.get("BYMONTH")),c=Number(a.get("BYMONTHDAY"));return!n||!c||n>12?void 0:`Every year on ${c} ${E[n-1]}${r}`}}}const f=e=>Date.parse(`${e}T00:00:00Z`)/864e5;function C(e,t,a){const r=f(a)-f(t);if(e===""||r===0||Number.isNaN(r))return e;const[o,i,n]=a.split("-").map(Number),c=new Date(Date.UTC(o,i-1,n)).getUTCDay(),s=/FREQ=(\w+)/i.exec(e)?.[1]?.toUpperCase();return e.split(";").map(u=>{const[y,R=""]=u.split("="),d=y.toUpperCase();return d==="BYDAY"&&s==="MONTHLY"?`BYDAY=${D[Math.min(Math.floor((n-1)/7),4)]}${l[c]}`:d==="BYDAY"?`BYDAY=${R.split(",").map(p=>{const T=l.indexOf(p.toUpperCase());return T===-1?p:l[(T+r+7)%7]}).join(",")}`:d==="BYMONTH"?`BYMONTH=${i}`:d==="BYMONTHDAY"?`BYMONTHDAY=${n}`:u}).join(";")}function b(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:[],notes:"",repeat:""}}function W(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endDate:F(e),endTime:e.allDay?"":e.end.slice(11,16),allDay:e.allDay,calendarId:e.calendarId,location:t.location,guests:t.guests,notes:t.notes,repeat:t.repeat}}function A(e,t){return e.allDay?{start:e.date,end:g(e.endDate,1)}:{start:Y(e.date,e.startTime,t),end:Y(e.endDate,e.endTime,t)}}function M(e,t,a){const r=O(e.repeat)??"",o=e.allDay?e.date:B(t,a.anchor===""?"UTC":a.anchor).slice(0,10);return C(r,e.date,o)}function k(e,t){if(e.title.trim()==="")return"Give the event a title before saving it.";if(e.date==="")return"Pick the day the event is on.";if(e.endDate==="")return"Pick the day the event ends on.";if(e.calendarId==="")return"Pick the calendar to save the event in.";if(!e.allDay&&(e.startTime===""||e.endTime===""))return"Set a start and an end time, or mark the event all day.";if(e.allDay&&e.endDate<e.date)return"The last day is before the first. Move one of them.";if(!e.allDay&&`${e.endDate}T${e.endTime}`<=`${e.date}T${e.startTime}`)return"The end is not after the start. Move one of them.";const a=x(e.guests);return a?`${a.text} is not an email address. Fix or remove it to save.`:t&&O(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}const h=e=>e.guests.filter(t=>t.valid).map(t=>({email:t.email,displayName:t.displayName})),v=e=>JSON.stringify(h(e));function Q(e,t,a){const r=k(e,!0);if(r!=="")return{ok:!1,problem:r};const{start:o,end:i}=A(e,t.clock),n=h(e);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:o,end:i,allDay:e.allDay,...t.anchor===""?{}:{timeZone:t.anchor},recurrenceRule:M(e,o,t),attendees:n,...n.length===0?{}:{organizerAccountId:a}}}}function K(e,t,a){const r=t.repeat!==e.repeat,i=t.allDay!==e.allDay||t.date!==e.date||t.startTime!==e.startTime,n=i||t.endDate!==e.endDate||t.endTime!==e.endTime,c=k(t,r);if(c!=="")return{ok:!1,problem:c};const s={};t.title.trim()!==e.title.trim()&&(s.summary=t.title.trim()),t.location!==e.location&&(s.location=t.location),t.notes!==e.notes&&(s.description=t.notes);const{start:u,end:y}=A(t,a.clock);return i&&(s.start=u),n&&(s.end=y,s.allDay=t.allDay,a.anchor!==""&&(s.timeZone=a.anchor)),r&&(s.recurrenceRule=M(t,u,a)),v(t)!==v(e)&&(s.attendees=h(t)),{ok:!0,patch:s}}export{A as a,Q as c,W as d,b as e,C as m,K as p,S as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fx as o,j as r}from"./index-C2US5ZnK.js";import{a as i}from"./CalendarEventEditor-BcGWIsNu.js";import"./draft-B-aWKHzd.js";import"./agenda-time-BwFncCBt.js";import"./calendar-guests-BVwUAczN.js";import"./calendar-event-popup-O-JrsyRu.js";import"./useCalendarSuggestions-CJGnqdiK.js";import"./ErrorState-g7-Y1uhe.js";import"./useQueries-B-1XtDe8.js";import"./list-pages-BCUbyyea.js";import"./pencil-C1yBZXUb.js";import"./circle-question-mark-DuTpeMvV.js";import"./useCalendarData-AQi5DlI1.js";import"./useCalendarTasks-BBv_7Q0J.js";import"./useCalendarScheduling-BzXa0l-K.js";import"./useDebouncedValue-C3FljUyl.js";import"./calendar-format-BwCpz-JZ.js";import"./nav-link-Df_MDzvJ.js";import"./useMediaQuery-BaUDTtu8.js";import"./calendar-BHWGBart.js";import"./reply-CijQsg4o.js";import"./CalendarQuickCreate-m3dyD7gG.js";import"./CalendarSession-D2sxMFYX.js";import"./calendar-event-sidebar-BUwhXGT2.js";import"./select-DhVwx5IO.js";import"./chevron-down-DeNyJr8d.js";import"./confirm-dialog-BdT5xj08.js";function y(){const{calendarObjectId:t}=o.useParams();return r.jsx(i,{calendarObjectId:t})}export{y as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fA as o,j as i}from"./index-C2US5ZnK.js";import{a as m}from"./CalendarEventEditor-BcGWIsNu.js";import"./draft-B-aWKHzd.js";import"./agenda-time-BwFncCBt.js";import"./calendar-guests-BVwUAczN.js";import"./calendar-event-popup-O-JrsyRu.js";import"./useCalendarSuggestions-CJGnqdiK.js";import"./ErrorState-g7-Y1uhe.js";import"./useQueries-B-1XtDe8.js";import"./list-pages-BCUbyyea.js";import"./pencil-C1yBZXUb.js";import"./circle-question-mark-DuTpeMvV.js";import"./useCalendarData-AQi5DlI1.js";import"./useCalendarTasks-BBv_7Q0J.js";import"./useCalendarScheduling-BzXa0l-K.js";import"./useDebouncedValue-C3FljUyl.js";import"./calendar-format-BwCpz-JZ.js";import"./nav-link-Df_MDzvJ.js";import"./useMediaQuery-BaUDTtu8.js";import"./calendar-BHWGBart.js";import"./reply-CijQsg4o.js";import"./CalendarQuickCreate-m3dyD7gG.js";import"./CalendarSession-D2sxMFYX.js";import"./calendar-event-sidebar-BUwhXGT2.js";import"./select-DhVwx5IO.js";import"./chevron-down-DeNyJr8d.js";import"./confirm-dialog-BdT5xj08.js";function y(){const{calendarObjectId:r,recurrenceId:t}=o.useParams();return i.jsx(m,{calendarObjectId:r,recurrenceId:t})}export{y as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./index-
|
|
1
|
+
import{b as e}from"./index-C2US5ZnK.js";const a={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};a.node;const n=e(a);export{n as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./index-
|
|
1
|
+
import{b as e}from"./index-C2US5ZnK.js";const a={name:"file-braces",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],aliases:["file-json"]};a.node;const s=e(a);export{s as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b5 as ee,j as e,L as B,ag as oe,p as ce,b6 as de,b7 as me,r as m,ar as H,B as I,b8 as ue,b9 as J,ba as xe,bb as pe,aS as fe,e as he,f as ge,bc as be,bd as je,be as ve,aE as Ne,T as ye,az as te,aA as se,a as ae,Y as Ce,bf as Se,_ as Fe,$ as we,bg as ke,bh as Ie,u as Me,af as Re,bi as Ee,c as Oe}from"./index-CKFdaY9c.js";import{E as K,f as De}from"./ErrorState-BptbbJAv.js";import{u as Le}from"./useMediaQuery-CjE8xNMz.js";import{a as Ae,u as Te}from"./useLabels-BIArT792.js";import{C as ze,A as $e,a as Pe,b as Be,N as E,p as Ue,u as _e,r as He,c as ne,S as Q,d as Ke,n as qe,f as Je,e as Qe,g as Ve,h as Ge,i as We,j as Ye}from"./useFilters-Cv2IfE4J.js";import{L as ie}from"./label-chip-zwUAXSWu.js";import{S as V}from"./segmented-control-CeqFpYfk.js";import{S as Xe}from"./select-yGv73aji.js";import{C as q}from"./circle-check-Q9IHsvBp.js";import{B as Ze}from"./bottom-sheet-B0y_-mKC.js";import{B as et}from"./badge-DYFkBshe.js";import{a as tt}from"./sections-ZsRsk30_.js";import{S as st}from"./settings-screen-C8z8YwuM.js";import"./list-pages-BCUbyyea.js";import"./suggest-list-czu9q5H4.js";import"./plus-DsSkq30M.js";import"./chevron-down-wpFtElCn.js";import"./avatar-B60PZejm.js";import"./chevron-left-HeNgNNR2.js";import"./menu-CKmdL0us.js";import"./circle-question-mark-CYsyue28.js";function at({preview:t}){const s=ee(t);if(t.status==="loading")return e.jsxs("p",{className:"flex items-center gap-2 text-xs text-fg-muted","aria-live":"polite",children:[e.jsx(B,{className:"size-3.5 animate-spin","aria-hidden":"true"}),s]});if(t.status==="error")return e.jsxs("p",{className:"flex items-center gap-2 text-xs text-danger",role:"alert",children:[e.jsx(oe,{className:"size-3.5 shrink-0","aria-hidden":"true"}),s]});const a=t.count===0;return e.jsxs("p",{className:ce("flex items-center gap-2 text-xs",t.stale?"text-fg-subtle":a?"text-fg-muted":"font-medium text-fg"),"aria-live":"polite",children:[t.stale&&e.jsx(B,{className:"size-3.5 animate-spin","aria-hidden":"true"}),s]})}const nt=[{value:"all",label:J("all")},{value:"any",label:J("any")}],G=[{value:"once",label:"Just once"},{value:"standing",label:"Keep doing this"},{value:"until",label:"Until a date"}],W="__filter_create_label__";function it({folders:t,value:s,delimiter:a="/",onChangeMove:n,onCreateFolder:u}){const[x,g]=m.useState(!1),[p,f]=m.useState(),[h,b]=m.useState([]),d=m.useMemo(()=>{const y=new Set(t.map(v=>v.id));return[...t,...h.filter(v=>!y.has(v.id))]},[t,h]),l=m.useMemo(()=>{if(u)return async(y,v,i)=>{const o=await u(y,v,i);return b(w=>w.some(M=>M.id===o.id)?w:[...w,o]),o}},[u]),C=d.find(y=>y.id===s),S=d.find(y=>y.id===p),j=y=>{const v=pe(y.path,a);return v.map((i,o)=>{const w=v.slice(0,o+1).join(a);return d.find(M=>M.path===w)?.label??i}).join(" / ")},N=()=>{g(!1),f(void 0)};return x?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex h-72 min-h-0 overflow-hidden rounded-md border border-line bg-surface",children:e.jsx(xe,{folders:d,selectedId:p,delimiter:a,onSelect:f,onCreateFolder:l,onCancel:N,labels:{createPending:"Waiting for the mail server to confirm the folder…"}})}),S?e.jsx(I,{variant:"primary",onClick:()=>{n?.(S.id),N()},className:"w-full",children:e.jsx("span",{className:"truncate",children:`Move matches to ${j(S)}`})}):e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Tap a folder to open it, or make a new one where you want it."}),e.jsx(I,{variant:"ghost",size:"sm",onClick:N,className:"w-full",children:"Cancel"})]}):e.jsxs("div",{className:"rounded-md border border-line bg-surface-sunken p-3",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:C?j(C):"No folder yet"}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[e.jsx(I,{variant:"ghost",size:"sm",className:"px-0",onClick:()=>{f(s),g(!0)},children:"Choose a folder"}),C&&e.jsx(I,{variant:"ghost",size:"sm",className:"px-0",onClick:()=>n?.(""),children:"Don't move matches"})]})]})}function rt({labels:t,value:s,onChangeLabel:a,onCreateLabel:n}){const[u,x]=m.useState(!1),[g,p]=m.useState(""),[f,h]=m.useState(!1),[b,d]=m.useState(),[l,C]=m.useState([]),S=m.useMemo(()=>{const i=new Set(t.map(o=>o.id));return[...t,...l.filter(o=>!i.has(o.id))]},[t,l]),j=S.find(i=>i.id===s),N=i=>{if(i===W){d(void 0),x(!0);return}a?.(i)},y=()=>{if(!n)return;const i=g.trim();i!==""&&(h(!0),d(void 0),n(i).then(o=>{C(w=>w.some(M=>M.id===o.id)?w:[...w,o]),a?.(o.id),x(!1),p(""),h(!1)}).catch(o=>{d(o instanceof Error?o.message:"Couldn't create that label. Please try again."),h(!1)}))},v=()=>{x(!1),p(""),d(void 0)};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Xe,{"aria-label":"Label to apply",value:s,onChange:i=>N(i.target.value),className:"flex-1",children:[e.jsx("option",{value:"",children:"No label"}),S.map(i=>e.jsx("option",{value:i.id,children:i.name},i.id)),n&&e.jsx("option",{value:W,children:"+ New label…"})]}),j&&e.jsx(ie,{label:{...j,labelId:j.id}})]}),u&&e.jsxs("div",{className:"space-y-2 rounded-md border border-line bg-surface-sunken p-2",children:[e.jsx(H,{value:g,onChange:i=>p(i.target.value),placeholder:"Label name","aria-label":"New label name",disabled:f,autoFocus:!0,onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),y()),i.key==="Escape"&&(i.preventDefault(),v())}}),b&&e.jsx("p",{className:"text-2xs text-danger",role:"alert",children:b}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(I,{variant:"primary",size:"sm",onClick:y,disabled:f||g.trim()==="",children:f?"Creating…":"Create label"}),e.jsx(I,{variant:"ghost",size:"sm",onClick:v,disabled:f,children:"Cancel"})]})]})]})}function lt({rule:t,folders:s,delimiter:a,labels:n=[],preview:u,notice:x,clauseFields:g,persisted:p=!1,clauseSuggestions:f,clauseEdit:h,onStartAddClause:b,onStartEditClause:d,onRemoveClause:l,onChangeDraftField:C,onChangeDraftValue:S,onSubmitClause:j,onCancelClause:N,onChangeMatchOperator:y,onChangeMove:v,onCreateFolder:i,onChangeLabel:o,onCreateLabel:w,onChangeScope:M,onChangeName:O,onChangeUntil:$,onCommit:A,onCancel:D}){const P=t.clauses.length>=2,T=de(t.matchOperator),L=me(t,u),F=t.scope==="standing"||t.scope==="until",z=p?G.filter(k=>k.value!=="once"):G;return e.jsxs("div",{className:"flex min-h-0 flex-col",children:[e.jsxs("div",{className:"border-b border-line px-5 py-3",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Filter rule"}),e.jsx("p",{className:"mt-0.5 text-xs text-fg-muted",children:"These chips are the whole rule — what you see is what applies."})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4",children:[x,e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.clauses.map((k,U)=>e.jsxs(m.Fragment,{children:[U>0&&e.jsx("span",{className:"text-2xs font-medium uppercase text-fg-subtle",children:T}),e.jsx(ze,{clause:k,onEdit:()=>d?.(k.id),onRemove:()=>l?.(k.id)})]},k.id)),!h&&e.jsx($e,{label:"Add clause",onClick:b})]}),h&&e.jsx(Pe,{draft:h.draft,mode:h.mode,fields:g,suggestions:f,onChangeField:C,onChangeValue:S,onSubmit:j,onCancel:N}),P&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Match"}),e.jsx(V,{name:"match-operator",size:"sm","aria-label":"Match operator",options:nt,value:t.matchOperator,onChange:k=>y?.(k)})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-fg-muted",children:"Move matches to"}),e.jsx(it,{folders:s,value:t.moveMailboxId,delimiter:a,onChangeMove:v,onCreateFolder:i})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-fg-muted",children:"Apply a label"}),e.jsx(rt,{labels:n,value:t.labelId??"",onChangeLabel:o,onCreateLabel:w})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-fg-muted",children:"How long"}),e.jsx(V,{name:"rule-scope",size:"sm","aria-label":"Rule scope",options:z,value:t.scope,onChange:k=>M?.(k)}),F&&e.jsx(H,{value:t.name??"",onChange:k=>O?.(k.target.value),placeholder:"Name this rule (e.g. Receipts)","aria-label":"Rule name",className:"w-full"}),t.scope==="until"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx("span",{children:"Until"}),e.jsx(H,{type:"date",value:t.until??"",onChange:k=>$?.(k.target.value),"aria-label":"Expiry date",className:"flex-1"})]})]}),e.jsx("div",{className:"border-t border-line pt-3",children:e.jsx(at,{preview:u})})]}),e.jsxs("div",{className:"space-y-2 border-t border-line px-5 py-3",children:[L&&e.jsx("p",{className:"text-xs text-fg-subtle",role:"status",children:L}),e.jsx(I,{variant:"primary",onClick:A,disabled:L!==void 0,className:"w-full",children:ue(t.scope)}),e.jsx(I,{variant:"ghost",onClick:D,className:"w-full",children:"Not now"})]})]})}const ot=t=>{const s=fe(t);return s!==void 0&&s>=400&&s<500};function Y({title:t,error:s,onRetry:a,reportHref:n}){return e.jsxs("div",{className:"space-y-1",children:[e.jsx(K,{variant:"inline",title:t,error:s,onRetry:ot(s)?void 0:a}),e.jsx("a",{href:n(De(s)),target:"_blank",rel:"noreferrer",className:"text-xs text-accent hover:underline",children:"Report an issue"})]})}const ct=(t,s)=>{const a=he(),n=ge({...je(),onSuccess:()=>{t&&(a.invalidateQueries({queryKey:Be(t)}),s&&a.invalidateQueries({queryKey:be({path:{accountId:t,filterId:s}})}))}}),{mutate:u}=n;return{updateFilter:m.useCallback(g=>{!t||!s||u({path:{accountId:t,filterId:s},body:g})},[t,s,u]),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,error:n.error,reset:n.reset}},dt=t=>({clauses:t.literalClauses.map((a,n)=>({id:`clause-${n}`,field:a.field,value:a.value})),matchOperator:t.matchOperator==="And"?"all":"any",moveMailboxId:t.actionMailboxId!==E?t.actionMailboxId:void 0,labelId:t.actionLabelId!==E?t.actionLabelId:void 0,scope:t.scope==="Temporary"?"until":"standing",until:t.scope==="Temporary"?mt(t.expiresAt):void 0,name:t.name}),mt=t=>{if(!t)return"";const s=Date.parse(t);if(Number.isNaN(s))return"";const a=new Date(s),n=u=>String(u).padStart(2,"0");return`${a.getFullYear()}-${n(a.getMonth()+1)}-${n(a.getDate())}`},X=t=>JSON.stringify({clauses:t.clauses.map(s=>[s.field,s.value]),operator:t.matchOperator,move:t.moveMailboxId??null,label:t.labelId??null}),re=(t,s)=>X(t)!==X(s),Z=t=>JSON.stringify({scope:t.scope==="until"?"until":"standing",until:t.scope==="until"?t.until??"":""}),le=(t,s)=>Z(t)!==Z(s),ut=(t,s)=>{const a={},n=(t.name??"").trim();return n!==(s.name??"").trim()&&(a.name=n),re(t,s)&&(a.matchOperator=t.matchOperator==="all"?"And":"Or",a.literalClauses=t.clauses.map(u=>({field:u.field,value:u.value})),a.actionMailboxId=t.moveMailboxId??E,a.actionLabelId=t.labelId??E),le(t,s)&&(a.scope=t.scope==="until"?"Temporary":"Standing",t.scope==="until"&&(a.expiresAt=Ue(t.until??""))),a};function xt({accountId:t,filter:s,folders:a,delimiter:n,labels:u,onClose:x}){const g=m.useMemo(()=>dt(s),[s]),[p,f]=m.useState(g),[h,b]=m.useState(),[d,l]=m.useState(!1),C=m.useRef(0),{count:S}=_e(t,He(p)),j=ct(t,s.filterId),N=ne(t),{createFolderIn:y}=ve(t),{createLabel:v}=Ae(t),i=async c=>{const r=await v(c);return{id:r.labelId,name:r.name,color:r.color}},o=()=>b({mode:"add",draft:{field:Q[0],value:""}}),w=c=>{const r=p.clauses.find(R=>R.id===c);r&&b({mode:"edit",clauseId:c,draft:{field:r.field,value:r.value}})},M=c=>b(r=>r&&{...r,draft:{...r.draft,field:c}}),O=c=>b(r=>r&&{...r,draft:{...r.draft,value:c}}),$=()=>{if(!h)return;const c=h.draft.field,r=qe(c,h.draft.value);r!==""&&(f(R=>h.mode==="edit"&&h.clauseId?{...R,clauses:R.clauses.map(_=>_.id===h.clauseId?{id:_.id,field:c,value:r}:_)}:(C.current+=1,{...R,clauses:[...R.clauses,{id:`new-${C.current}`,field:c,value:r}]})),b(void 0))},A=c=>f(r=>({...r,clauses:r.clauses.filter(R=>R.id!==c)})),D=c=>f(r=>({...r,matchOperator:c})),P=c=>f(r=>({...r,moveMailboxId:c||void 0})),T=c=>f(r=>({...r,labelId:c||void 0})),L=c=>f(r=>({...r,name:c})),F=c=>f(r=>({...r,scope:c,until:c==="until"?r.until:void 0})),z=c=>f(r=>({...r,until:c})),k=()=>{const c=re(p,g)||le(p,g),r=ut(p,g);if(Object.keys(r).length===0){x();return}l(c),j.updateFilter(r)},U=()=>N.start(Ke(p));return N.isStarting||N.isRunning||N.isDone?e.jsx(gt,{progress:N.progress,isDone:N.isDone,onClose:x}):j.isPending?e.jsx(pt,{}):j.isError?e.jsx(bt,{onRetry:j.reset,onClose:x}):j.isSuccess?d?e.jsx(ht,{preview:ee(S),blocked:S.status!=="ready"||S.stale===!0,onReapply:U,onClose:x}):e.jsx(ft,{onClose:x}):e.jsx(lt,{rule:p,folders:a,delimiter:n,labels:u,preview:S,clauseFields:Q,persisted:!0,clauseEdit:h,onStartAddClause:o,onStartEditClause:w,onRemoveClause:A,onChangeDraftField:M,onChangeDraftValue:O,onSubmitClause:$,onCancelClause:()=>b(void 0),onChangeMatchOperator:D,onChangeMove:P,onCreateFolder:y,onChangeLabel:T,onCreateLabel:i,onChangeName:L,onChangeScope:F,onChangeUntil:z,onCommit:k,onCancel:x})}function pt(){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function ft({onClose:t}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[e.jsx(q,{className:"size-8 text-positive"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),e.jsx(I,{variant:"primary",onClick:t,className:"mt-2",children:"Done"})]})}function ht({preview:t,blocked:s,onReapply:a,onClose:n}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[e.jsx(q,{className:"size-8 text-positive"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),e.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",t," — move the mail already in your mailbox too?"]}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(I,{variant:"primary",onClick:a,disabled:s,children:"Move existing mail"}),e.jsx(I,{variant:"ghost",onClick:n,children:"Not now"})]})]})}function gt({progress:t,isDone:s,onClose:a}){const n=t.state==="Failed";return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[s?n?e.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):e.jsx(q,{className:"size-8 text-positive"}):e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),!s&&e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),s&&!n&&e.jsxs("div",{className:"text-sm text-fg",children:[e.jsx("p",{className:"font-medium",children:"Done"}),e.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[t.appliedCount," of ",t.matchedCount," moved",t.failedCount>0?` · ${t.failedCount} failed`:"","."]})]}),s&&n&&e.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:t.errorMessage||"Something went wrong. Please try again."}),s&&e.jsx(I,{variant:"primary",onClick:a,className:"mt-2",children:"Done"})]})}function bt({onRetry:t,onClose:s}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[e.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),e.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(I,{variant:"primary",onClick:t,children:"Try again"}),e.jsx(I,{variant:"ghost",onClick:s,children:"Not now"})]})]})}function jt({accountId:t,filter:s,folders:a,delimiter:n,labels:u,onClose:x}){const g=Le(),p=e.jsx(xt,{accountId:t,filter:s,folders:a,delimiter:n,labels:u,onClose:x});return g?e.jsx(Ne,{open:!0,onClose:x,title:"Filter rule",children:p}):e.jsx(Ze,{open:!0,onClose:x,label:"Filter rule",dismissLabel:"Dismiss filter rule",children:p})}const vt=t=>{switch(t.kind){case"queuing":case"running":return"Running over the inbox…";case"done":return t.matched===0?"Done. Nothing in the inbox matched.":`Done. Filed ${t.applied} of ${t.matched} matching messages in the inbox.`;case"failed":return}};function Nt({filters:t,mailboxName:s,labelById:a,onEdit:n,onDelete:u,deletingFilterId:x,onToggle:g,togglingFilterId:p,onRunNow:f,runFilterId:h,runStatus:b,now:d=Date.now()}){return t.length===0?e.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):e.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:t.map(l=>{const C=Je(l,d),S=C==="Expired",j=C==="Disabled",N=j?Qe(l):void 0,y=l.actionMailboxId!==E?s(l.actionMailboxId):void 0,v=l.actionLabelId!==E?a.get(l.actionLabelId):void 0,i=Ve(l.expiresAt),o=h===l.filterId?b:void 0,w=o?.kind==="queuing"||o?.kind==="running",M=o?vt(o):void 0,O=C==="Active"&&(l.actionMailboxId!==E||l.actionLabelId!==E);return e.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>n(l.filterId),"aria-label":`Edit filter ${l.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`truncate text-sm font-medium ${S||j?"text-fg-muted":"text-fg"}`,children:l.name}),e.jsx(et,{tone:S?"neutral":j?"warning":"positive",dot:!0,children:C})]}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[y?`Moves matches to ${y}`:"No move action",l.scope==="Temporary"&&i?S?` · expired ${i}`:` · until ${i}`:l.scope==="Standing"?" · always":""]}),N&&e.jsx("p",{className:"mt-0.5 text-xs text-warning",children:N}),M&&e.jsx("p",{role:"status",className:"mt-0.5 text-xs text-fg-muted",children:M}),v&&e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:e.jsx(ie,{label:{labelId:v.id,name:v.name,color:v.color}})})]}),O&&e.jsx(I,{variant:"ghost",size:"sm",onClick:()=>f(l.filterId),disabled:w,"aria-label":`Run now: filter ${l.name}`,children:w?"Running…":"Run now"}),!S&&e.jsx(I,{variant:"ghost",size:"sm",onClick:()=>g(l.filterId,j),disabled:p===l.filterId,"aria-label":`${j?"Turn on":"Turn off"} filter ${l.name}`,children:j?"Turn on":"Turn off"}),e.jsx(I,{variant:"ghost",size:"sm",icon:e.jsx(ye,{className:"size-4 text-danger"}),onClick:()=>u(l.filterId),disabled:x===l.filterId,"aria-label":`Delete filter ${l.name}`})]},l.filterId)})})}function yt(t){return te(se({title:`Filter toggle: ${t}`,errorMessage:t}))}function Ct(t){return te(se({title:`Filter run now: ${t}`,errorMessage:t}))}const St=t=>{if(t.failure)return{kind:"failed",error:t.failure.error};if(t.isStarting)return{kind:"queuing"};if(t.isDone)return t.progress.state==="Failed"?{kind:"failed",error:new Error(t.progress.errorMessage||"The run over the inbox failed.")}:{kind:"done",matched:t.progress.matchedCount,applied:t.progress.appliedCount};if(t.isRunning)return{kind:"running"}},Ft=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",e.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",e.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),e.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."}),e.jsx("p",{children:"A filter that can't do its job turns itself off and says why, for example when its folder no longer exists. Turn it back on once that is fixed."})]});function wt({account:t,openFilterId:s}){const a=t.accountId,{filters:n,isPending:u,isError:x,error:g,refetch:p}=Ge(a),{deleteFilter:f,deletingFilterId:h}=We(a),b=Ye(a),d=ne(a),{startForFilter:l}=d,[C,S]=m.useState(),j=m.useCallback(F=>{S(F),l(F)},[l]),N=St(d),[y,v]=m.useState(s),{data:i}=ae({...Ce({path:{accountId:a}}),staleTime:1/0}),o=Se(),w=m.useMemo(()=>Fe(t.folderAppointments),[t.folderAppointments]),M=m.useCallback(F=>{const z=i?.items.find(k=>k.mailboxId===F);if(z)return we(z,w.get(F),o)},[i?.items,w,o]),O=m.useMemo(()=>ke({mailboxes:i?.items??[],folderAppointments:t.folderAppointments,translator:o}),[i?.items,t.folderAppointments,o]),$=Ie(i?.items??[]),{labels:A}=Te(a),D=m.useMemo(()=>A.map(F=>({id:F.labelId,name:F.name,color:F.color})),[A]),P=m.useMemo(()=>new Map(D.map(F=>[F.id,F])),[D]),T=n.find(F=>F.filterId===y),L=n.find(F=>F.filterId===C)?.name;return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:t.email}),T&&e.jsx(jt,{accountId:a,filter:T,folders:O,delimiter:$,labels:D,onClose:()=>v(void 0)}),u?e.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${t.email}`}):x?e.jsx(K,{variant:"inline",title:`Couldn't load filters for ${t.email}`,error:g,onRetry:()=>{p()}}):e.jsxs(e.Fragment,{children:[b.isError&&e.jsx(Y,{title:b.enabling?"Couldn't turn the filter on":"Couldn't turn the filter off",error:b.error,onRetry:b.retry,reportHref:yt}),C&&N?.kind==="failed"&&e.jsx(Y,{title:`Couldn't run ${L??"the filter"} over the inbox`,error:N.error,onRetry:d.failure?.kind==="statusUnreadable"?d.refreshStatus:()=>j(C),reportHref:Ct}),e.jsx(Nt,{filters:n,mailboxName:M,labelById:P,onEdit:v,onDelete:f,deletingFilterId:h,onToggle:b.toggleFilter,togglingFilterId:b.togglingFilterId,onRunNow:j,runFilterId:C,runStatus:N})]})]})}function Vt(){const t=Me(),s=Re(),a=tt(),[n,u]=m.useState(!0),x=Ee.useSearch({select:d=>d.filterId}),{data:g,isPending:p,isError:f,error:h,refetch:b}=ae(Oe());return e.jsx(st,{items:s,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Ft,helpOpen:n,onToggleHelp:()=>u(d=>!d),onSelect:a,onBackToMail:()=>{t({to:"/mail"})},children:p?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):f?e.jsx(K,{title:"Couldn't load accounts",error:h,onRetry:()=>{b()}}):g.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:g.accounts.map(d=>e.jsx(wt,{account:d,openFilterId:x},d.accountId))})})}export{wt as AccountFilters,Vt as component};
|
|
1
|
+
import{b5 as ee,j as e,L as B,ag as oe,p as ce,b6 as de,b7 as me,r as m,ar as H,B as I,b8 as ue,b9 as J,ba as xe,bb as pe,aS as fe,e as he,f as ge,bc as be,bd as je,be as ve,aE as Ne,T as ye,az as te,aA as se,a as ae,Y as Ce,bf as Se,_ as Fe,$ as we,bg as ke,bh as Ie,u as Me,af as Re,bi as Ee,c as Oe}from"./index-C2US5ZnK.js";import{E as K,f as De}from"./ErrorState-g7-Y1uhe.js";import{u as Le}from"./useMediaQuery-BaUDTtu8.js";import{a as Ae,u as Te}from"./useLabels-DnF0cYWq.js";import{C as ze,A as $e,a as Pe,b as Be,N as E,p as Ue,u as _e,r as He,c as ne,S as Q,d as Ke,n as qe,f as Je,e as Qe,g as Ve,h as Ge,i as We,j as Ye}from"./useFilters-BoddpA09.js";import{L as ie}from"./label-chip-D_oZixyY.js";import{S as V}from"./segmented-control-CMV1-H2S.js";import{S as Xe}from"./select-DhVwx5IO.js";import{C as q}from"./circle-check-BoVmBAEX.js";import{B as Ze}from"./bottom-sheet-Bl-_mC2x.js";import{B as et}from"./badge-CDOouHHB.js";import{a as tt}from"./sections-FtpeSpRq.js";import{S as st}from"./settings-screen-zihVEeS9.js";import"./list-pages-BCUbyyea.js";import"./suggest-list-DJUWGfG3.js";import"./plus-DY_LOTJC.js";import"./chevron-down-DeNyJr8d.js";import"./avatar-CVmRGlvx.js";import"./chevron-left-Co8HGTow.js";import"./menu-CEGeda9s.js";import"./circle-question-mark-DuTpeMvV.js";function at({preview:t}){const s=ee(t);if(t.status==="loading")return e.jsxs("p",{className:"flex items-center gap-2 text-xs text-fg-muted","aria-live":"polite",children:[e.jsx(B,{className:"size-3.5 animate-spin","aria-hidden":"true"}),s]});if(t.status==="error")return e.jsxs("p",{className:"flex items-center gap-2 text-xs text-danger",role:"alert",children:[e.jsx(oe,{className:"size-3.5 shrink-0","aria-hidden":"true"}),s]});const a=t.count===0;return e.jsxs("p",{className:ce("flex items-center gap-2 text-xs",t.stale?"text-fg-subtle":a?"text-fg-muted":"font-medium text-fg"),"aria-live":"polite",children:[t.stale&&e.jsx(B,{className:"size-3.5 animate-spin","aria-hidden":"true"}),s]})}const nt=[{value:"all",label:J("all")},{value:"any",label:J("any")}],G=[{value:"once",label:"Just once"},{value:"standing",label:"Keep doing this"},{value:"until",label:"Until a date"}],W="__filter_create_label__";function it({folders:t,value:s,delimiter:a="/",onChangeMove:n,onCreateFolder:u}){const[x,g]=m.useState(!1),[p,f]=m.useState(),[h,b]=m.useState([]),d=m.useMemo(()=>{const y=new Set(t.map(v=>v.id));return[...t,...h.filter(v=>!y.has(v.id))]},[t,h]),l=m.useMemo(()=>{if(u)return async(y,v,i)=>{const o=await u(y,v,i);return b(w=>w.some(M=>M.id===o.id)?w:[...w,o]),o}},[u]),C=d.find(y=>y.id===s),S=d.find(y=>y.id===p),j=y=>{const v=pe(y.path,a);return v.map((i,o)=>{const w=v.slice(0,o+1).join(a);return d.find(M=>M.path===w)?.label??i}).join(" / ")},N=()=>{g(!1),f(void 0)};return x?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex h-72 min-h-0 overflow-hidden rounded-md border border-line bg-surface",children:e.jsx(xe,{folders:d,selectedId:p,delimiter:a,onSelect:f,onCreateFolder:l,onCancel:N,labels:{createPending:"Waiting for the mail server to confirm the folder…"}})}),S?e.jsx(I,{variant:"primary",onClick:()=>{n?.(S.id),N()},className:"w-full",children:e.jsx("span",{className:"truncate",children:`Move matches to ${j(S)}`})}):e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Tap a folder to open it, or make a new one where you want it."}),e.jsx(I,{variant:"ghost",size:"sm",onClick:N,className:"w-full",children:"Cancel"})]}):e.jsxs("div",{className:"rounded-md border border-line bg-surface-sunken p-3",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:C?j(C):"No folder yet"}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[e.jsx(I,{variant:"ghost",size:"sm",className:"px-0",onClick:()=>{f(s),g(!0)},children:"Choose a folder"}),C&&e.jsx(I,{variant:"ghost",size:"sm",className:"px-0",onClick:()=>n?.(""),children:"Don't move matches"})]})]})}function rt({labels:t,value:s,onChangeLabel:a,onCreateLabel:n}){const[u,x]=m.useState(!1),[g,p]=m.useState(""),[f,h]=m.useState(!1),[b,d]=m.useState(),[l,C]=m.useState([]),S=m.useMemo(()=>{const i=new Set(t.map(o=>o.id));return[...t,...l.filter(o=>!i.has(o.id))]},[t,l]),j=S.find(i=>i.id===s),N=i=>{if(i===W){d(void 0),x(!0);return}a?.(i)},y=()=>{if(!n)return;const i=g.trim();i!==""&&(h(!0),d(void 0),n(i).then(o=>{C(w=>w.some(M=>M.id===o.id)?w:[...w,o]),a?.(o.id),x(!1),p(""),h(!1)}).catch(o=>{d(o instanceof Error?o.message:"Couldn't create that label. Please try again."),h(!1)}))},v=()=>{x(!1),p(""),d(void 0)};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Xe,{"aria-label":"Label to apply",value:s,onChange:i=>N(i.target.value),className:"flex-1",children:[e.jsx("option",{value:"",children:"No label"}),S.map(i=>e.jsx("option",{value:i.id,children:i.name},i.id)),n&&e.jsx("option",{value:W,children:"+ New label…"})]}),j&&e.jsx(ie,{label:{...j,labelId:j.id}})]}),u&&e.jsxs("div",{className:"space-y-2 rounded-md border border-line bg-surface-sunken p-2",children:[e.jsx(H,{value:g,onChange:i=>p(i.target.value),placeholder:"Label name","aria-label":"New label name",disabled:f,autoFocus:!0,onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),y()),i.key==="Escape"&&(i.preventDefault(),v())}}),b&&e.jsx("p",{className:"text-2xs text-danger",role:"alert",children:b}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(I,{variant:"primary",size:"sm",onClick:y,disabled:f||g.trim()==="",children:f?"Creating…":"Create label"}),e.jsx(I,{variant:"ghost",size:"sm",onClick:v,disabled:f,children:"Cancel"})]})]})]})}function lt({rule:t,folders:s,delimiter:a,labels:n=[],preview:u,notice:x,clauseFields:g,persisted:p=!1,clauseSuggestions:f,clauseEdit:h,onStartAddClause:b,onStartEditClause:d,onRemoveClause:l,onChangeDraftField:C,onChangeDraftValue:S,onSubmitClause:j,onCancelClause:N,onChangeMatchOperator:y,onChangeMove:v,onCreateFolder:i,onChangeLabel:o,onCreateLabel:w,onChangeScope:M,onChangeName:O,onChangeUntil:$,onCommit:A,onCancel:D}){const P=t.clauses.length>=2,T=de(t.matchOperator),L=me(t,u),F=t.scope==="standing"||t.scope==="until",z=p?G.filter(k=>k.value!=="once"):G;return e.jsxs("div",{className:"flex min-h-0 flex-col",children:[e.jsxs("div",{className:"border-b border-line px-5 py-3",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Filter rule"}),e.jsx("p",{className:"mt-0.5 text-xs text-fg-muted",children:"These chips are the whole rule — what you see is what applies."})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4",children:[x,e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.clauses.map((k,U)=>e.jsxs(m.Fragment,{children:[U>0&&e.jsx("span",{className:"text-2xs font-medium uppercase text-fg-subtle",children:T}),e.jsx(ze,{clause:k,onEdit:()=>d?.(k.id),onRemove:()=>l?.(k.id)})]},k.id)),!h&&e.jsx($e,{label:"Add clause",onClick:b})]}),h&&e.jsx(Pe,{draft:h.draft,mode:h.mode,fields:g,suggestions:f,onChangeField:C,onChangeValue:S,onSubmit:j,onCancel:N}),P&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Match"}),e.jsx(V,{name:"match-operator",size:"sm","aria-label":"Match operator",options:nt,value:t.matchOperator,onChange:k=>y?.(k)})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-fg-muted",children:"Move matches to"}),e.jsx(it,{folders:s,value:t.moveMailboxId,delimiter:a,onChangeMove:v,onCreateFolder:i})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-fg-muted",children:"Apply a label"}),e.jsx(rt,{labels:n,value:t.labelId??"",onChangeLabel:o,onCreateLabel:w})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-fg-muted",children:"How long"}),e.jsx(V,{name:"rule-scope",size:"sm","aria-label":"Rule scope",options:z,value:t.scope,onChange:k=>M?.(k)}),F&&e.jsx(H,{value:t.name??"",onChange:k=>O?.(k.target.value),placeholder:"Name this rule (e.g. Receipts)","aria-label":"Rule name",className:"w-full"}),t.scope==="until"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx("span",{children:"Until"}),e.jsx(H,{type:"date",value:t.until??"",onChange:k=>$?.(k.target.value),"aria-label":"Expiry date",className:"flex-1"})]})]}),e.jsx("div",{className:"border-t border-line pt-3",children:e.jsx(at,{preview:u})})]}),e.jsxs("div",{className:"space-y-2 border-t border-line px-5 py-3",children:[L&&e.jsx("p",{className:"text-xs text-fg-subtle",role:"status",children:L}),e.jsx(I,{variant:"primary",onClick:A,disabled:L!==void 0,className:"w-full",children:ue(t.scope)}),e.jsx(I,{variant:"ghost",onClick:D,className:"w-full",children:"Not now"})]})]})}const ot=t=>{const s=fe(t);return s!==void 0&&s>=400&&s<500};function Y({title:t,error:s,onRetry:a,reportHref:n}){return e.jsxs("div",{className:"space-y-1",children:[e.jsx(K,{variant:"inline",title:t,error:s,onRetry:ot(s)?void 0:a}),e.jsx("a",{href:n(De(s)),target:"_blank",rel:"noreferrer",className:"text-xs text-accent hover:underline",children:"Report an issue"})]})}const ct=(t,s)=>{const a=he(),n=ge({...je(),onSuccess:()=>{t&&(a.invalidateQueries({queryKey:Be(t)}),s&&a.invalidateQueries({queryKey:be({path:{accountId:t,filterId:s}})}))}}),{mutate:u}=n;return{updateFilter:m.useCallback(g=>{!t||!s||u({path:{accountId:t,filterId:s},body:g})},[t,s,u]),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,error:n.error,reset:n.reset}},dt=t=>({clauses:t.literalClauses.map((a,n)=>({id:`clause-${n}`,field:a.field,value:a.value})),matchOperator:t.matchOperator==="And"?"all":"any",moveMailboxId:t.actionMailboxId!==E?t.actionMailboxId:void 0,labelId:t.actionLabelId!==E?t.actionLabelId:void 0,scope:t.scope==="Temporary"?"until":"standing",until:t.scope==="Temporary"?mt(t.expiresAt):void 0,name:t.name}),mt=t=>{if(!t)return"";const s=Date.parse(t);if(Number.isNaN(s))return"";const a=new Date(s),n=u=>String(u).padStart(2,"0");return`${a.getFullYear()}-${n(a.getMonth()+1)}-${n(a.getDate())}`},X=t=>JSON.stringify({clauses:t.clauses.map(s=>[s.field,s.value]),operator:t.matchOperator,move:t.moveMailboxId??null,label:t.labelId??null}),re=(t,s)=>X(t)!==X(s),Z=t=>JSON.stringify({scope:t.scope==="until"?"until":"standing",until:t.scope==="until"?t.until??"":""}),le=(t,s)=>Z(t)!==Z(s),ut=(t,s)=>{const a={},n=(t.name??"").trim();return n!==(s.name??"").trim()&&(a.name=n),re(t,s)&&(a.matchOperator=t.matchOperator==="all"?"And":"Or",a.literalClauses=t.clauses.map(u=>({field:u.field,value:u.value})),a.actionMailboxId=t.moveMailboxId??E,a.actionLabelId=t.labelId??E),le(t,s)&&(a.scope=t.scope==="until"?"Temporary":"Standing",t.scope==="until"&&(a.expiresAt=Ue(t.until??""))),a};function xt({accountId:t,filter:s,folders:a,delimiter:n,labels:u,onClose:x}){const g=m.useMemo(()=>dt(s),[s]),[p,f]=m.useState(g),[h,b]=m.useState(),[d,l]=m.useState(!1),C=m.useRef(0),{count:S}=_e(t,He(p)),j=ct(t,s.filterId),N=ne(t),{createFolderIn:y}=ve(t),{createLabel:v}=Ae(t),i=async c=>{const r=await v(c);return{id:r.labelId,name:r.name,color:r.color}},o=()=>b({mode:"add",draft:{field:Q[0],value:""}}),w=c=>{const r=p.clauses.find(R=>R.id===c);r&&b({mode:"edit",clauseId:c,draft:{field:r.field,value:r.value}})},M=c=>b(r=>r&&{...r,draft:{...r.draft,field:c}}),O=c=>b(r=>r&&{...r,draft:{...r.draft,value:c}}),$=()=>{if(!h)return;const c=h.draft.field,r=qe(c,h.draft.value);r!==""&&(f(R=>h.mode==="edit"&&h.clauseId?{...R,clauses:R.clauses.map(_=>_.id===h.clauseId?{id:_.id,field:c,value:r}:_)}:(C.current+=1,{...R,clauses:[...R.clauses,{id:`new-${C.current}`,field:c,value:r}]})),b(void 0))},A=c=>f(r=>({...r,clauses:r.clauses.filter(R=>R.id!==c)})),D=c=>f(r=>({...r,matchOperator:c})),P=c=>f(r=>({...r,moveMailboxId:c||void 0})),T=c=>f(r=>({...r,labelId:c||void 0})),L=c=>f(r=>({...r,name:c})),F=c=>f(r=>({...r,scope:c,until:c==="until"?r.until:void 0})),z=c=>f(r=>({...r,until:c})),k=()=>{const c=re(p,g)||le(p,g),r=ut(p,g);if(Object.keys(r).length===0){x();return}l(c),j.updateFilter(r)},U=()=>N.start(Ke(p));return N.isStarting||N.isRunning||N.isDone?e.jsx(gt,{progress:N.progress,isDone:N.isDone,onClose:x}):j.isPending?e.jsx(pt,{}):j.isError?e.jsx(bt,{onRetry:j.reset,onClose:x}):j.isSuccess?d?e.jsx(ht,{preview:ee(S),blocked:S.status!=="ready"||S.stale===!0,onReapply:U,onClose:x}):e.jsx(ft,{onClose:x}):e.jsx(lt,{rule:p,folders:a,delimiter:n,labels:u,preview:S,clauseFields:Q,persisted:!0,clauseEdit:h,onStartAddClause:o,onStartEditClause:w,onRemoveClause:A,onChangeDraftField:M,onChangeDraftValue:O,onSubmitClause:$,onCancelClause:()=>b(void 0),onChangeMatchOperator:D,onChangeMove:P,onCreateFolder:y,onChangeLabel:T,onCreateLabel:i,onChangeName:L,onChangeScope:F,onChangeUntil:z,onCommit:k,onCancel:x})}function pt(){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function ft({onClose:t}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[e.jsx(q,{className:"size-8 text-positive"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),e.jsx(I,{variant:"primary",onClick:t,className:"mt-2",children:"Done"})]})}function ht({preview:t,blocked:s,onReapply:a,onClose:n}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[e.jsx(q,{className:"size-8 text-positive"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),e.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",t," — move the mail already in your mailbox too?"]}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(I,{variant:"primary",onClick:a,disabled:s,children:"Move existing mail"}),e.jsx(I,{variant:"ghost",onClick:n,children:"Not now"})]})]})}function gt({progress:t,isDone:s,onClose:a}){const n=t.state==="Failed";return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[s?n?e.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):e.jsx(q,{className:"size-8 text-positive"}):e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),!s&&e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),s&&!n&&e.jsxs("div",{className:"text-sm text-fg",children:[e.jsx("p",{className:"font-medium",children:"Done"}),e.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[t.appliedCount," of ",t.matchedCount," moved",t.failedCount>0?` · ${t.failedCount} failed`:"","."]})]}),s&&n&&e.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:t.errorMessage||"Something went wrong. Please try again."}),s&&e.jsx(I,{variant:"primary",onClick:a,className:"mt-2",children:"Done"})]})}function bt({onRetry:t,onClose:s}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[e.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),e.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(I,{variant:"primary",onClick:t,children:"Try again"}),e.jsx(I,{variant:"ghost",onClick:s,children:"Not now"})]})]})}function jt({accountId:t,filter:s,folders:a,delimiter:n,labels:u,onClose:x}){const g=Le(),p=e.jsx(xt,{accountId:t,filter:s,folders:a,delimiter:n,labels:u,onClose:x});return g?e.jsx(Ne,{open:!0,onClose:x,title:"Filter rule",children:p}):e.jsx(Ze,{open:!0,onClose:x,label:"Filter rule",dismissLabel:"Dismiss filter rule",children:p})}const vt=t=>{switch(t.kind){case"queuing":case"running":return"Running over the inbox…";case"done":return t.matched===0?"Done. Nothing in the inbox matched.":`Done. Filed ${t.applied} of ${t.matched} matching messages in the inbox.`;case"failed":return}};function Nt({filters:t,mailboxName:s,labelById:a,onEdit:n,onDelete:u,deletingFilterId:x,onToggle:g,togglingFilterId:p,onRunNow:f,runFilterId:h,runStatus:b,now:d=Date.now()}){return t.length===0?e.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):e.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:t.map(l=>{const C=Je(l,d),S=C==="Expired",j=C==="Disabled",N=j?Qe(l):void 0,y=l.actionMailboxId!==E?s(l.actionMailboxId):void 0,v=l.actionLabelId!==E?a.get(l.actionLabelId):void 0,i=Ve(l.expiresAt),o=h===l.filterId?b:void 0,w=o?.kind==="queuing"||o?.kind==="running",M=o?vt(o):void 0,O=C==="Active"&&(l.actionMailboxId!==E||l.actionLabelId!==E);return e.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>n(l.filterId),"aria-label":`Edit filter ${l.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`truncate text-sm font-medium ${S||j?"text-fg-muted":"text-fg"}`,children:l.name}),e.jsx(et,{tone:S?"neutral":j?"warning":"positive",dot:!0,children:C})]}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[y?`Moves matches to ${y}`:"No move action",l.scope==="Temporary"&&i?S?` · expired ${i}`:` · until ${i}`:l.scope==="Standing"?" · always":""]}),N&&e.jsx("p",{className:"mt-0.5 text-xs text-warning",children:N}),M&&e.jsx("p",{role:"status",className:"mt-0.5 text-xs text-fg-muted",children:M}),v&&e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:e.jsx(ie,{label:{labelId:v.id,name:v.name,color:v.color}})})]}),O&&e.jsx(I,{variant:"ghost",size:"sm",onClick:()=>f(l.filterId),disabled:w,"aria-label":`Run now: filter ${l.name}`,children:w?"Running…":"Run now"}),!S&&e.jsx(I,{variant:"ghost",size:"sm",onClick:()=>g(l.filterId,j),disabled:p===l.filterId,"aria-label":`${j?"Turn on":"Turn off"} filter ${l.name}`,children:j?"Turn on":"Turn off"}),e.jsx(I,{variant:"ghost",size:"sm",icon:e.jsx(ye,{className:"size-4 text-danger"}),onClick:()=>u(l.filterId),disabled:x===l.filterId,"aria-label":`Delete filter ${l.name}`})]},l.filterId)})})}function yt(t){return te(se({title:`Filter toggle: ${t}`,errorMessage:t}))}function Ct(t){return te(se({title:`Filter run now: ${t}`,errorMessage:t}))}const St=t=>{if(t.failure)return{kind:"failed",error:t.failure.error};if(t.isStarting)return{kind:"queuing"};if(t.isDone)return t.progress.state==="Failed"?{kind:"failed",error:new Error(t.progress.errorMessage||"The run over the inbox failed.")}:{kind:"done",matched:t.progress.matchedCount,applied:t.progress.appliedCount};if(t.isRunning)return{kind:"running"}},Ft=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",e.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",e.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),e.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."}),e.jsx("p",{children:"A filter that can't do its job turns itself off and says why, for example when its folder no longer exists. Turn it back on once that is fixed."})]});function wt({account:t,openFilterId:s}){const a=t.accountId,{filters:n,isPending:u,isError:x,error:g,refetch:p}=Ge(a),{deleteFilter:f,deletingFilterId:h}=We(a),b=Ye(a),d=ne(a),{startForFilter:l}=d,[C,S]=m.useState(),j=m.useCallback(F=>{S(F),l(F)},[l]),N=St(d),[y,v]=m.useState(s),{data:i}=ae({...Ce({path:{accountId:a}}),staleTime:1/0}),o=Se(),w=m.useMemo(()=>Fe(t.folderAppointments),[t.folderAppointments]),M=m.useCallback(F=>{const z=i?.items.find(k=>k.mailboxId===F);if(z)return we(z,w.get(F),o)},[i?.items,w,o]),O=m.useMemo(()=>ke({mailboxes:i?.items??[],folderAppointments:t.folderAppointments,translator:o}),[i?.items,t.folderAppointments,o]),$=Ie(i?.items??[]),{labels:A}=Te(a),D=m.useMemo(()=>A.map(F=>({id:F.labelId,name:F.name,color:F.color})),[A]),P=m.useMemo(()=>new Map(D.map(F=>[F.id,F])),[D]),T=n.find(F=>F.filterId===y),L=n.find(F=>F.filterId===C)?.name;return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:t.email}),T&&e.jsx(jt,{accountId:a,filter:T,folders:O,delimiter:$,labels:D,onClose:()=>v(void 0)}),u?e.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${t.email}`}):x?e.jsx(K,{variant:"inline",title:`Couldn't load filters for ${t.email}`,error:g,onRetry:()=>{p()}}):e.jsxs(e.Fragment,{children:[b.isError&&e.jsx(Y,{title:b.enabling?"Couldn't turn the filter on":"Couldn't turn the filter off",error:b.error,onRetry:b.retry,reportHref:yt}),C&&N?.kind==="failed"&&e.jsx(Y,{title:`Couldn't run ${L??"the filter"} over the inbox`,error:N.error,onRetry:d.failure?.kind==="statusUnreadable"?d.refreshStatus:()=>j(C),reportHref:Ct}),e.jsx(Nt,{filters:n,mailboxName:M,labelById:P,onEdit:v,onDelete:f,deletingFilterId:h,onToggle:b.toggleFilter,togglingFilterId:b.togglingFilterId,onRunNow:j,runFilterId:C,runStatus:N})]})]})}function Vt(){const t=Me(),s=Re(),a=tt(),[n,u]=m.useState(!0),x=Ee.useSearch({select:d=>d.filterId}),{data:g,isPending:p,isError:f,error:h,refetch:b}=ae(Oe());return e.jsx(st,{items:s,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Ft,helpOpen:n,onToggleHelp:()=>u(d=>!d),onSelect:a,onBackToMail:()=>{t({to:"/mail"})},children:p?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):f?e.jsx(K,{title:"Couldn't load accounts",error:h,onRetry:()=>{b()}}):g.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:g.accounts.map(d=>e.jsx(wt,{account:d,openFilterId:x},d.accountId))})})}export{wt as AccountFilters,Vt as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o,O as i}from"./index-C2US5ZnK.js";import{a as m}from"./MailShell-DemzOx8u.js";import{C as t,S as p}from"./CollectionPane-BykvWdR8.js";import"./nav-link-Df_MDzvJ.js";import{a as e}from"./search-token-index-BymL-AGz.js";import"./reply-CijQsg4o.js";import{u as a}from"./search-mirror-B_HO5zGq.js";import"./useMessageBodyContent-DwHmQdO9.js";import"./FullCompose-CN22d_2q.js";import"./index-v9nM8Dsp.js";import"./useSignature-cMh39FpD.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-C3FljUyl.js";import"./suggest-list-DJUWGfG3.js";import"./sections-FtpeSpRq.js";import"./useMediaQuery-BaUDTtu8.js";import"./chevron-down-DeNyJr8d.js";import"./ErrorState-g7-Y1uhe.js";import"./confirm-dialog-BdT5xj08.js";import"./search-scope-7jHRUZbg.js";import"./app-chrome-CGYf2rTW.js";import"./useCollectionThreads-B1vimpsO.js";import"./useQueries-B-1XtDe8.js";import"./useInfiniteQuery-Dd0GYAxg.js";import"./MessageToolbar-HTPVoP6C.js";import"./MessageBody-Lnqqwldl.js";import"./kbd-C052hWKm.js";import"./roving-focus-C0jnB7ie.js";import"./useJunkMailboxIds-D3M8TbeX.js";import"./badge-CDOouHHB.js";import"./undo-2-BHa76eIs.js";import"./DropdownMenu-BuKAMdhw.js";import"./refresh-cw-CY0SJjI-.js";import"./popover-menu-D4kT-xqh.js";import"./mail-Cqr91KmH.js";import"./download-BrsKwaQk.js";import"./avatar-CVmRGlvx.js";import"./EmptyState-DEGumQTC.js";import"./circle-question-mark-DuTpeMvV.js";import"./useFilters-BoddpA09.js";import"./select-DhVwx5IO.js";import"./plus-DY_LOTJC.js";import"./calendar-suggestion-DnD4hQ5U.js";import"./useCalendarSuggestions-CJGnqdiK.js";import"./list-pages-BCUbyyea.js";import"./agenda-time-BwFncCBt.js";import"./calendar-format-BwCpz-JZ.js";import"./calendar-BHWGBart.js";import"./calendar-failure-note-_XD99AnH.js";import"./checkbox-DQCA_mSq.js";import"./clock--ouhjt6L.js";import"./segmented-control-CMV1-H2S.js";import"./useLayoutTier-lXeQo_2w.js";import"./menu-CEGeda9s.js";import"./folder-input-C_5R00h6.js";import"./label-chip-D_oZixyY.js";import"./useLabels-DnF0cYWq.js";import"./cloud-off-DEwqlx6S.js";import"./MailViewChrome-pi6cPv-J.js";import"./wizard-selection-zWa1qc6-.js";function jo(){const r=e();return a({to:"/mail/flagged"}),o.jsx(t,{collection:p,title:"Starred",thread:r,children:o.jsx(m,{phone:o.jsx(t.Phone,{}),list:o.jsx(t.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(t.Intelligence,{}),hasThread:!!r})})}export{jo as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./index-
|
|
1
|
+
import{j as r}from"./index-C2US5ZnK.js";import{E as o}from"./ErrorState-g7-Y1uhe.js";const l=({error:t,reset:e})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(o,{title:"Couldn't load your starred mail",error:t,onRetry:e})});export{l as errorComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./index-
|
|
1
|
+
import{b as e}from"./index-C2US5ZnK.js";const a={name:"folder-input",size:24,node:[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]};a.node;const o=e(a);export{o as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,B as y,T as B,ba as Y,r as l,aE as W,X,aJ as ue,ar as J,F as he,bj as q,bk as xe,at as fe,d as z,bl as pe,bm as ge,e as Z,a4 as ee,k as se,bn as be,bo as ve,aI as je,a3 as ye,bp as Ne,bq as _,br as Ce,bs as ke,bt as we,bu as Se,bv as H,be as te,bf as ae,bg as Ie,$ as K,_ as re,L as Q,bw as G,ag as Me,bx as Ee,u as Ae,af as De,a as ne,c as Oe,Y as Fe,f as V,s as Re,by as Pe,bz as $e,bA as Le,bB as Te,bC as ze,bD as _e}from"./index-CKFdaY9c.js";import{l as Be}from"./list-pages-BCUbyyea.js";import{F as Ke}from"./folder-input-BqAxe_6s.js";import{a as Qe}from"./folder-failure-BphZCUyZ.js";import{a as qe}from"./sections-ZsRsk30_.js";import{S as He}from"./settings-screen-C8z8YwuM.js";import{E as ie}from"./ErrorState-BptbbJAv.js";import{S as Ge}from"./select-yGv73aji.js";import{P as Ve}from"./pencil-C6KO5975.js";import"./avatar-B60PZejm.js";import"./badge-DYFkBshe.js";import"./chevron-left-HeNgNNR2.js";import"./menu-CKmdL0us.js";import"./circle-question-mark-CYsyue28.js";import"./chevron-down-wpFtElCn.js";const Ue=({label:s,onRename:t,onDelete:a,deleteBlockedReason:i,renameLabel:h=d=>`Rename ${d}`,deleteLabel:n=d=>`Delete ${d}`})=>{const d=i?`${n(s)} — ${i}`:n(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(Ve,{className:"size-3.5"}),"aria-label":h(s),onClick:t}),e.jsx("span",{title:i,children:e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),"aria-label":d,disabled:i!==void 0,onClick:a})})]})},Ye=({folders:s,onRename:t,onDelete:a,onCreateFolder:i,delimiter:h,labels:n})=>{const d=new Map(s.map(c=>[c.id,c]));return e.jsx(Y,{folders:s,onCreateFolder:i,delimiter:h,labels:{treeAriaLabel:"Your folders",optionLabel:c=>c.label,...n},rowFailure:c=>d.get(c.id)?.failure,rowActions:c=>{const o=d.get(c.id);return o?e.jsx(Ue,{label:o.label,deleteBlockedReason:o.deleteBlockedReason,renameLabel:n?.rename,deleteLabel:n?.remove,onRename:()=>t(o),onDelete:()=>a(o)}):null}})},We=({open:s,folderLabel:t,defaultLabel:a,name:i,onNameChange:h,onSubmit:n,onClose:d,pending:c=!1,error:o})=>{const u=l.useId(),p=`Rename ${t}`;return s?e.jsxs(W,{open:s,onClose:d,title:p,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:p}),e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:d,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(ue,{htmlFor:u,children:"Folder name"}),e.jsx(J,{id:u,value:i,placeholder:a,onChange:g=>h(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),n())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:a}),"."]}),o&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:o})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:d,children:"Cancel"}),e.jsx(y,{variant:"primary",size:"sm",onClick:n,disabled:c,children:c?"Saving…":"Save name"})]})]}):null},Xe=["inbox","drafts","sent","archive","junk","trash"],U="",Je={mailboxId:null,source:"None"};function Ze(s){const t=s.messageCount===1?"msg":"msgs";return`${q(s.providerPath,s.hierarchyDelimiter)} · ${s.messageCount} ${t}`}const oe=s=>`${s} ${s===1?"message":"messages"}`,es=(s,t)=>s==="Appointed"?"Chosen by you":s==="Flagged"?`The mail server marks it as ${t}`:s==="Reserved"?"The account's own INBOX":"Matched by name, not confirmed";function ss({role:s,folders:t,appointment:a,displayName:i,onAppoint:h,onRename:n}){const[d,c]=l.useState(i),o=l.useRef(null),u=l.useRef(!1),p=l.useId(),{mailboxId:g,source:v,staleFolderPath:j}=a,m=t.find(N=>N.mailboxId===g)??null,f=pe(s),O=m!=null&&d.trim()!==i.trim();l.useEffect(()=>{!u.current||v==="Proposed"||(u.current=!1,o.current?.focus())},[v]);const M=(()=>{if(v==="None"){const N=s==="trash"?" Deleting mail needs one.":"";return e.jsx("span",{id:p,className:"pl-[7.5rem] text-xs text-fg-muted",children:`Not set — pick the folder this account uses for ${f}.${N}`})}return v==="Stale"||!m?null:e.jsx("span",{id:p,className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:m.providerPath,children:`${es(v,f)} · ${m.providerPath} · ${oe(m.messageCount)}`})})(),w=s==="trash"?" Deleting mail is stopped until you pick another one.":m?` reader is using ${q(m.providerPath,m.hierarchyDelimiter)} instead.`:"",D=`The folder you chose for ${f}${j?` — ${j} —`:""} is gone from the mail server.${w}`;return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[xe(s),f]}),e.jsxs(Ge,{ref:o,className:"w-56 shrink-0",value:m?.mailboxId??U,"aria-label":`Folder for ${f}`,"aria-describedby":M||v==="Stale"?p:void 0,onChange:N=>h(s,N.target.value),children:[!m&&e.jsx("option",{value:U,disabled:!0,children:"Choose a folder"}),t.map(N=>e.jsx("option",{value:N.mailboxId,children:Ze(N)},N.mailboxId))]}),v==="Proposed"&&m&&e.jsx(y,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{u.current=!0,h(s,m.mailboxId)},children:`Set as ${f}`}),m&&e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"flex-1",value:d,placeholder:f,"aria-label":`Display name for ${f}`,onChange:N=>c(N.target.value)}),O&&e.jsx(y,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(fe,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>n(m.mailboxId,d)})]})]}),M,v==="Stale"&&e.jsx(z,{tone:"warning",variant:"soft",className:"ml-[7.5rem]",children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:p,className:"flex-1",children:D}),e.jsx(y,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>o.current?.focus(),children:"Pick a folder"})]})})]})}function ts(){return e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]})}function as({accountEmail:s,folders:t,appointments:a,displayNames:i={},onAppoint:h,onRename:n}){const d=new Set(Object.values(a).map(o=>o.mailboxId).filter(o=>o!=null)),c=t.filter(o=>!d.has(o.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each row says where its answer came from — your choice, the mail server's own flag, or a name reader matched."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Xe.map(o=>{const u=a[o]??Je;return e.jsx(ss,{role:o,folders:t,appointment:u,displayName:u.mailboxId?i[u.mailboxId]??"":"",onAppoint:h,onRename:n},o)})}),c.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:c.map(o=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(he,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:q(o.providerPath,o.hierarchyDelimiter)}),e.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:oe(o.messageCount)})]},o.mailboxId))})]})]})}const rs=12e4,ns=2e3,is="This folder is no longer in the account's folder list, so nothing was deleted.",le=(s,t)=>{const a=s.find(i=>i.mailboxId===t);if(!a)throw new Error(is);return a},os=(s,t)=>le(s,t).lastSyncedAt??0;async function ls({readMailboxes:s,mailboxId:t,since:a,signal:i,segmentMs:h=rs,pollIntervalMs:n=ns,delay:d=ge,now:c=Date.now}){const o=c()+h;for(;;){i?.throwIfAborted();const u=le(await s(),t);if((u.lastSyncedAt??0)>a)return{status:"fresh",messageCount:u.messagesTotal};if(c()>=o)return{status:"pending"};await d(n,i)}}const cs=50,ce=(s,t)=>Be(async a=>{const{data:i}=await Se({path:{mailboxId:s},query:{order:"desc",continuationToken:a},throwOnError:!0});return i},{maxPages:cs,signal:t}),ds=s=>s instanceof Error?s.message:"Something went wrong.",L=s=>s.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:ds(t)})),ms=async(s,t,a,i)=>{const h=[];for await(const n of ce(s,i))for(const d of n)if(!t.has(d.messageId)&&!h.includes(d.messageId)&&(h.push(d.messageId),h.length>=a))return h;return h},us=async(s,t)=>{let a=0;for await(const i of ce(s,t))a+=i.length;return a};function hs({accountId:s,mailboxId:t,onDeleted:a}){const i=Z(),[h,n]=l.useState("idle"),[d,c]=l.useState(null),[o,u]=l.useState(),[p,g]=l.useState(),v=l.useRef(null),j=l.useRef(void 0),m=l.useCallback(()=>{i.invalidateQueries({queryKey:ee({path:{accountId:s}})}),i.invalidateQueries({queryKey:se()})},[i,s]),f=l.useCallback(async()=>{n("deleting");const C=await L(be({path:{accountId:s,mailboxId:t},throwOnError:!0}));if(!C.ok){u(C.error),n("error");return}m(),n("done"),a()},[s,t,m,a]),O=l.useCallback(()=>ve({path:{accountId:s},throwOnError:!0}).then(({data:C})=>C.items.find(S=>S.mailboxId===t)?.messageCount??0),[s,t]),M=l.useCallback(()=>i.fetchQuery({...je({path:{accountId:s}}),staleTime:0}).then(C=>C.mailboxes??[]),[i,s]),w=l.useCallback(async()=>{const C=new AbortController;v.current=C;const{signal:S}=C;n("checking"),u(void 0);const I=j.current!==void 0,k=await L((async()=>(I||(S.throwIfAborted(),j.current=os(await M(),t),S.throwIfAborted(),g(Date.now()),await ye({path:{accountId:s},throwOnError:!0})),ls({readMailboxes:M,mailboxId:t,since:j.current??0,signal:S})))());return S.aborted?(n("idle"),j.current=void 0,{status:"failed"}):k.ok?k.value.status==="pending"?(n("check-stalled"),{status:"pending"}):(j.current=void 0,k.value.messageCount>0?(n("idle"),m(),{status:"blocked",messageCount:k.value.messageCount}):(await f(),{status:"deleted"})):(j.current=void 0,u(k.error),n("error"),{status:"failed"})},[s,t,M,f,m]),D=l.useCallback(()=>{v.current?.abort()},[]),N=l.useCallback(async C=>{const S=new AbortController;v.current=S;const{signal:I}=S;n("moving"),u(void 0);const k=await L(O());if(I.aborted)return;if(!k.ok){u(k.error),n("error");return}let x=Ne(k.value);c(x);const E=new Set;for(;;){if(I.aborted)return;const r=await L(ms(t,E,we,I));if(I.aborted)return;if(!r.ok){x=_(x,r.error),c(x),u(r.error),n("error");return}const b=r.value;if(b.length===0)break;const F=await L(Ce({body:{messageIds:b,destinationMailboxId:C},throwOnError:!0}));if(I.aborted)return;if(!F.ok){x=_(x,F.error),c(x),u(F.error),n("error");return}for(const $ of b)E.add($);x=ke(x,b.length),c(x)}const A=await L(us(t,I));if(!I.aborted){if(!A.ok){x=_(x,A.error),c(x),u(A.error),n("error");return}if(A.value>0){const r=`${A.value} ${A.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;x=_(x,r),c(x),u(r),n("error"),m();return}await f()}},[t,O,f,m]),R=l.useCallback(()=>{v.current?.abort(),v.current=null,j.current=void 0,n("idle"),c(null),u(void 0),g(void 0)},[]);return{phase:h,progress:d,errorMessage:o,checkStartedAt:p,deleteMailbox:f,deleteIfEmpty:w,moveThenDelete:N,cancel:D,reset:R}}const T=s=>`${s} ${s===1?"email":"emails"}`;function xs({open:s,accountId:t,folder:a,mailboxes:i,appointments:h,onClose:n}){const[d,c]=l.useState(()=>H(a.messageCount)),[o,u]=l.useState(),[p,g]=l.useState(),{createFolderIn:v}=te(t),j=ae(),{phase:m,progress:f,errorMessage:O,checkStartedAt:M,deleteMailbox:w,deleteIfEmpty:D,moveThenDelete:N,cancel:R,reset:C}=hs({accountId:t,mailboxId:a.mailboxId,onDeleted:n}),[S,I]=l.useState("0:00"),k=m==="checking"||m==="check-stalled";l.useEffect(()=>{if(!k||M===void 0)return;const P=()=>I(Ee(Date.now()-M));P();const me=setInterval(P,1e3);return()=>clearInterval(me)},[k,M]),l.useEffect(()=>{s&&(c(H(a.messageCount)),u(void 0),C())},[s,C]),l.useEffect(()=>{s&&g(void 0)},[s]),l.useEffect(()=>R,[R]);const x=l.useCallback(()=>{R(),n()},[R,n]),E=l.useCallback(async()=>{const P=await D();P.status==="blocked"&&(u(P.messageCount),c("choose-fate"))},[D]),A=l.useMemo(()=>Ie({mailboxes:i,folderAppointments:h,excludeMailboxId:a.mailboxId,translator:j}),[i,h,a.mailboxId,j]),r=A.find(P=>P.id===p),b=l.useMemo(()=>K(a,re(h).get(a.mailboxId),j),[a,h,j]);if(!s)return null;const F=`Delete ${b}`,$=o??a.messageCount,de=m==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(Q,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:f?G(f):"Moved 0 of 0"})]}):m==="checking"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(Q,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Checking the folder on the mail server…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:`Waiting ${S}. Nothing is deleted until the server answers.`})]}):m==="check-stalled"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(z,{tone:"warning",variant:"soft",children:`The mail server hasn't reported back on this folder yet — ${S} so far. Nothing has been deleted.`}),e.jsx("p",{className:"text-xs text-fg-muted",children:"A sync covers the whole account, so a busy mailbox can take a while to come round to this folder."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(y,{size:"sm",onClick:()=>E(),children:"Keep waiting"})]})]}):m==="deleting"||m==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(Q,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):m==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(z,{tone:"danger",variant:"soft",children:O??"Something went wrong. Please try again."}),f&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[G(f),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Close"})})]}):d==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(y,{variant:"danger",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),onClick:()=>E(),children:"Delete folder"})]})]}):d==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[o!==void 0&&e.jsx(z,{tone:"warning",variant:"soft",children:`This folder is not empty: the mail server reports ${T(o)} in it. Nothing was deleted.`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:b})," holds"," ",T($),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>c("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(B,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>c("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(Ke,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"})})]}):d==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b})," and its"," ",T($),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:()=>c("choose-fate"),children:"Back"}),e.jsx(y,{variant:"danger",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",T($)," in"," ",e.jsx("strong",{className:"text-fg",children:b})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(Y,{folders:A,selectedId:p,delimiter:i[0]?.hierarchyDelimiter??"/",onSelect:g,onCreateFolder:v,onCancel:()=>{g(void 0),c("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),r&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(y,{variant:"danger",onClick:()=>N(r.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${T($)} to ${r.label}`})})})]});return e.jsxs(W,{open:s,onClose:x,title:F,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(Me,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:F}),e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:x,"aria-label":"Cancel"})]}),de]})}function fs({account:s}){const t=Z(),a=s.accountId,i=ae(),{data:h,isPending:n,isError:d,error:c,refetch:o}=ne(Fe({path:{accountId:a}})),{createFolderIn:u}=te(a),p=V({...Pe(),meta:Re(409),onSuccess:()=>{t.invalidateQueries({queryKey:se()})}}),g=V({...$e(),onSuccess:()=>{t.invalidateQueries({queryKey:ee({path:{accountId:a}})})}}),[v,j]=l.useState(),[m,f]=l.useState(),[O,M]=l.useState(""),w=l.useMemo(()=>h?.items??[],[h]),D=l.useMemo(()=>re(s.folderAppointments),[s.folderAppointments]),N=l.useMemo(()=>w.map(r=>({id:r.mailboxId,label:K(r,D.get(r.mailboxId),i),path:r.fullPath,deleteBlockedReason:Le(r,w,s.folderAppointments).message,failure:Qe(r)})),[w,D,i,s.folderAppointments]),R=(r,b)=>{p.mutate({path:{accountId:a,role:_e[r]},body:{mailboxId:b}})},C=(r,b)=>{const F=b.trim();g.mutate({path:{accountId:a,mailboxId:r},body:{displayNameOverride:F===""?null:F}})};if(n)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(d)return e.jsx(ie,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:c,onRetry:()=>{o()}});const S=w.map(r=>({mailboxId:r.mailboxId,providerPath:r.fullPath,hierarchyDelimiter:r.hierarchyDelimiter,messageCount:r.messageCount})),I={};for(const r of s.folderAppointments){const b=Te[r.role];b&&(I[b]={mailboxId:r.mailboxId??null,source:r.source,staleFolderPath:r.staleAppointmentPath})}const k={};for(const r of w)r.displayNameOverride&&(k[r.mailboxId]=r.displayNameOverride);const x=r=>w.find(b=>b.mailboxId===r),E=x(m),A=x(v);return e.jsxs("div",{className:"space-y-4",children:[(p.isError||g.isError)&&e.jsx(z,{tone:"danger",variant:"soft",children:ze(p.error)?"That folder is still being created on the mail server — wait for it to finish, then try again.":"Couldn't save that change. Please try again."}),e.jsx(as,{accountEmail:s.email,folders:S,appointments:I,displayNames:k,onAppoint:R,onRename:C}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(Ye,{folders:N,delimiter:w[0]?.hierarchyDelimiter??"/",onCreateFolder:u,onRename:r=>{f(r.id),M(x(r.id)?.displayNameOverride?.trim()??"")},onDelete:r=>j(r.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),E&&e.jsx(We,{open:!0,folderLabel:K(E,D.get(E.mailboxId),i),defaultLabel:K({fullPath:E.fullPath,hierarchyDelimiter:E.hierarchyDelimiter},D.get(E.mailboxId),i),name:O,onNameChange:M,pending:g.isPending,error:g.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const r=O.trim();g.mutate({path:{accountId:a,mailboxId:E.mailboxId},body:{displayNameOverride:r===""?null:r}},{onSuccess:()=>f(void 0)})},onClose:()=>f(void 0)}),A&&e.jsx(xs,{open:!0,accountId:a,folder:A,mailboxes:w,appointments:s.folderAppointments,onClose:()=>j(void 0)})]})}function Ds(){const s=Ae(),t=De(),a=qe(),[i,h]=l.useState(!0),{data:n,isPending:d,isError:c,error:o,refetch:u}=ne(Oe());return e.jsx(He,{items:t,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:e.jsx(ts,{}),helpOpen:i,onToggleHelp:()=>h(p=>!p),onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:d?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):c?e.jsx(ie,{title:"Couldn't load accounts",error:o,onRetry:()=>{u()}}):n.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:n.accounts.map(p=>e.jsx(fs,{account:p},p.accountId))})})}export{Ds as component};
|
|
1
|
+
import{j as e,B as y,T as B,ba as Y,r as l,aE as W,X,aJ as ue,ar as J,F as he,bj as q,bk as xe,at as fe,d as z,bl as pe,bm as ge,e as Z,a4 as ee,k as se,bn as be,bo as ve,aI as je,a3 as ye,bp as Ne,bq as _,br as Ce,bs as ke,bt as we,bu as Se,bv as H,be as te,bf as ae,bg as Ie,$ as K,_ as re,L as Q,bw as G,ag as Me,bx as Ee,u as Ae,af as De,a as ne,c as Oe,Y as Fe,f as V,s as Re,by as Pe,bz as $e,bA as Le,bB as Te,bC as ze,bD as _e}from"./index-C2US5ZnK.js";import{l as Be}from"./list-pages-BCUbyyea.js";import{F as Ke}from"./folder-input-C_5R00h6.js";import{a as Qe}from"./folder-failure-BphZCUyZ.js";import{a as qe}from"./sections-FtpeSpRq.js";import{S as He}from"./settings-screen-zihVEeS9.js";import{E as ie}from"./ErrorState-g7-Y1uhe.js";import{S as Ge}from"./select-DhVwx5IO.js";import{P as Ve}from"./pencil-C1yBZXUb.js";import"./avatar-CVmRGlvx.js";import"./badge-CDOouHHB.js";import"./chevron-left-Co8HGTow.js";import"./menu-CEGeda9s.js";import"./circle-question-mark-DuTpeMvV.js";import"./chevron-down-DeNyJr8d.js";const Ue=({label:s,onRename:t,onDelete:a,deleteBlockedReason:i,renameLabel:h=d=>`Rename ${d}`,deleteLabel:n=d=>`Delete ${d}`})=>{const d=i?`${n(s)} — ${i}`:n(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(Ve,{className:"size-3.5"}),"aria-label":h(s),onClick:t}),e.jsx("span",{title:i,children:e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),"aria-label":d,disabled:i!==void 0,onClick:a})})]})},Ye=({folders:s,onRename:t,onDelete:a,onCreateFolder:i,delimiter:h,labels:n})=>{const d=new Map(s.map(c=>[c.id,c]));return e.jsx(Y,{folders:s,onCreateFolder:i,delimiter:h,labels:{treeAriaLabel:"Your folders",optionLabel:c=>c.label,...n},rowFailure:c=>d.get(c.id)?.failure,rowActions:c=>{const o=d.get(c.id);return o?e.jsx(Ue,{label:o.label,deleteBlockedReason:o.deleteBlockedReason,renameLabel:n?.rename,deleteLabel:n?.remove,onRename:()=>t(o),onDelete:()=>a(o)}):null}})},We=({open:s,folderLabel:t,defaultLabel:a,name:i,onNameChange:h,onSubmit:n,onClose:d,pending:c=!1,error:o})=>{const u=l.useId(),p=`Rename ${t}`;return s?e.jsxs(W,{open:s,onClose:d,title:p,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:p}),e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:d,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(ue,{htmlFor:u,children:"Folder name"}),e.jsx(J,{id:u,value:i,placeholder:a,onChange:g=>h(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),n())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:a}),"."]}),o&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:o})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:d,children:"Cancel"}),e.jsx(y,{variant:"primary",size:"sm",onClick:n,disabled:c,children:c?"Saving…":"Save name"})]})]}):null},Xe=["inbox","drafts","sent","archive","junk","trash"],U="",Je={mailboxId:null,source:"None"};function Ze(s){const t=s.messageCount===1?"msg":"msgs";return`${q(s.providerPath,s.hierarchyDelimiter)} · ${s.messageCount} ${t}`}const oe=s=>`${s} ${s===1?"message":"messages"}`,es=(s,t)=>s==="Appointed"?"Chosen by you":s==="Flagged"?`The mail server marks it as ${t}`:s==="Reserved"?"The account's own INBOX":"Matched by name, not confirmed";function ss({role:s,folders:t,appointment:a,displayName:i,onAppoint:h,onRename:n}){const[d,c]=l.useState(i),o=l.useRef(null),u=l.useRef(!1),p=l.useId(),{mailboxId:g,source:v,staleFolderPath:j}=a,m=t.find(N=>N.mailboxId===g)??null,f=pe(s),O=m!=null&&d.trim()!==i.trim();l.useEffect(()=>{!u.current||v==="Proposed"||(u.current=!1,o.current?.focus())},[v]);const M=(()=>{if(v==="None"){const N=s==="trash"?" Deleting mail needs one.":"";return e.jsx("span",{id:p,className:"pl-[7.5rem] text-xs text-fg-muted",children:`Not set — pick the folder this account uses for ${f}.${N}`})}return v==="Stale"||!m?null:e.jsx("span",{id:p,className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:m.providerPath,children:`${es(v,f)} · ${m.providerPath} · ${oe(m.messageCount)}`})})(),w=s==="trash"?" Deleting mail is stopped until you pick another one.":m?` reader is using ${q(m.providerPath,m.hierarchyDelimiter)} instead.`:"",D=`The folder you chose for ${f}${j?` — ${j} —`:""} is gone from the mail server.${w}`;return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[xe(s),f]}),e.jsxs(Ge,{ref:o,className:"w-56 shrink-0",value:m?.mailboxId??U,"aria-label":`Folder for ${f}`,"aria-describedby":M||v==="Stale"?p:void 0,onChange:N=>h(s,N.target.value),children:[!m&&e.jsx("option",{value:U,disabled:!0,children:"Choose a folder"}),t.map(N=>e.jsx("option",{value:N.mailboxId,children:Ze(N)},N.mailboxId))]}),v==="Proposed"&&m&&e.jsx(y,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{u.current=!0,h(s,m.mailboxId)},children:`Set as ${f}`}),m&&e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"flex-1",value:d,placeholder:f,"aria-label":`Display name for ${f}`,onChange:N=>c(N.target.value)}),O&&e.jsx(y,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(fe,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>n(m.mailboxId,d)})]})]}),M,v==="Stale"&&e.jsx(z,{tone:"warning",variant:"soft",className:"ml-[7.5rem]",children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:p,className:"flex-1",children:D}),e.jsx(y,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>o.current?.focus(),children:"Pick a folder"})]})})]})}function ts(){return e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]})}function as({accountEmail:s,folders:t,appointments:a,displayNames:i={},onAppoint:h,onRename:n}){const d=new Set(Object.values(a).map(o=>o.mailboxId).filter(o=>o!=null)),c=t.filter(o=>!d.has(o.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each row says where its answer came from — your choice, the mail server's own flag, or a name reader matched."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Xe.map(o=>{const u=a[o]??Je;return e.jsx(ss,{role:o,folders:t,appointment:u,displayName:u.mailboxId?i[u.mailboxId]??"":"",onAppoint:h,onRename:n},o)})}),c.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:c.map(o=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(he,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:q(o.providerPath,o.hierarchyDelimiter)}),e.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:oe(o.messageCount)})]},o.mailboxId))})]})]})}const rs=12e4,ns=2e3,is="This folder is no longer in the account's folder list, so nothing was deleted.",le=(s,t)=>{const a=s.find(i=>i.mailboxId===t);if(!a)throw new Error(is);return a},os=(s,t)=>le(s,t).lastSyncedAt??0;async function ls({readMailboxes:s,mailboxId:t,since:a,signal:i,segmentMs:h=rs,pollIntervalMs:n=ns,delay:d=ge,now:c=Date.now}){const o=c()+h;for(;;){i?.throwIfAborted();const u=le(await s(),t);if((u.lastSyncedAt??0)>a)return{status:"fresh",messageCount:u.messagesTotal};if(c()>=o)return{status:"pending"};await d(n,i)}}const cs=50,ce=(s,t)=>Be(async a=>{const{data:i}=await Se({path:{mailboxId:s},query:{order:"desc",continuationToken:a},throwOnError:!0});return i},{maxPages:cs,signal:t}),ds=s=>s instanceof Error?s.message:"Something went wrong.",L=s=>s.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:ds(t)})),ms=async(s,t,a,i)=>{const h=[];for await(const n of ce(s,i))for(const d of n)if(!t.has(d.messageId)&&!h.includes(d.messageId)&&(h.push(d.messageId),h.length>=a))return h;return h},us=async(s,t)=>{let a=0;for await(const i of ce(s,t))a+=i.length;return a};function hs({accountId:s,mailboxId:t,onDeleted:a}){const i=Z(),[h,n]=l.useState("idle"),[d,c]=l.useState(null),[o,u]=l.useState(),[p,g]=l.useState(),v=l.useRef(null),j=l.useRef(void 0),m=l.useCallback(()=>{i.invalidateQueries({queryKey:ee({path:{accountId:s}})}),i.invalidateQueries({queryKey:se()})},[i,s]),f=l.useCallback(async()=>{n("deleting");const C=await L(be({path:{accountId:s,mailboxId:t},throwOnError:!0}));if(!C.ok){u(C.error),n("error");return}m(),n("done"),a()},[s,t,m,a]),O=l.useCallback(()=>ve({path:{accountId:s},throwOnError:!0}).then(({data:C})=>C.items.find(S=>S.mailboxId===t)?.messageCount??0),[s,t]),M=l.useCallback(()=>i.fetchQuery({...je({path:{accountId:s}}),staleTime:0}).then(C=>C.mailboxes??[]),[i,s]),w=l.useCallback(async()=>{const C=new AbortController;v.current=C;const{signal:S}=C;n("checking"),u(void 0);const I=j.current!==void 0,k=await L((async()=>(I||(S.throwIfAborted(),j.current=os(await M(),t),S.throwIfAborted(),g(Date.now()),await ye({path:{accountId:s},throwOnError:!0})),ls({readMailboxes:M,mailboxId:t,since:j.current??0,signal:S})))());return S.aborted?(n("idle"),j.current=void 0,{status:"failed"}):k.ok?k.value.status==="pending"?(n("check-stalled"),{status:"pending"}):(j.current=void 0,k.value.messageCount>0?(n("idle"),m(),{status:"blocked",messageCount:k.value.messageCount}):(await f(),{status:"deleted"})):(j.current=void 0,u(k.error),n("error"),{status:"failed"})},[s,t,M,f,m]),D=l.useCallback(()=>{v.current?.abort()},[]),N=l.useCallback(async C=>{const S=new AbortController;v.current=S;const{signal:I}=S;n("moving"),u(void 0);const k=await L(O());if(I.aborted)return;if(!k.ok){u(k.error),n("error");return}let x=Ne(k.value);c(x);const E=new Set;for(;;){if(I.aborted)return;const r=await L(ms(t,E,we,I));if(I.aborted)return;if(!r.ok){x=_(x,r.error),c(x),u(r.error),n("error");return}const b=r.value;if(b.length===0)break;const F=await L(Ce({body:{messageIds:b,destinationMailboxId:C},throwOnError:!0}));if(I.aborted)return;if(!F.ok){x=_(x,F.error),c(x),u(F.error),n("error");return}for(const $ of b)E.add($);x=ke(x,b.length),c(x)}const A=await L(us(t,I));if(!I.aborted){if(!A.ok){x=_(x,A.error),c(x),u(A.error),n("error");return}if(A.value>0){const r=`${A.value} ${A.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;x=_(x,r),c(x),u(r),n("error"),m();return}await f()}},[t,O,f,m]),R=l.useCallback(()=>{v.current?.abort(),v.current=null,j.current=void 0,n("idle"),c(null),u(void 0),g(void 0)},[]);return{phase:h,progress:d,errorMessage:o,checkStartedAt:p,deleteMailbox:f,deleteIfEmpty:w,moveThenDelete:N,cancel:D,reset:R}}const T=s=>`${s} ${s===1?"email":"emails"}`;function xs({open:s,accountId:t,folder:a,mailboxes:i,appointments:h,onClose:n}){const[d,c]=l.useState(()=>H(a.messageCount)),[o,u]=l.useState(),[p,g]=l.useState(),{createFolderIn:v}=te(t),j=ae(),{phase:m,progress:f,errorMessage:O,checkStartedAt:M,deleteMailbox:w,deleteIfEmpty:D,moveThenDelete:N,cancel:R,reset:C}=hs({accountId:t,mailboxId:a.mailboxId,onDeleted:n}),[S,I]=l.useState("0:00"),k=m==="checking"||m==="check-stalled";l.useEffect(()=>{if(!k||M===void 0)return;const P=()=>I(Ee(Date.now()-M));P();const me=setInterval(P,1e3);return()=>clearInterval(me)},[k,M]),l.useEffect(()=>{s&&(c(H(a.messageCount)),u(void 0),C())},[s,C]),l.useEffect(()=>{s&&g(void 0)},[s]),l.useEffect(()=>R,[R]);const x=l.useCallback(()=>{R(),n()},[R,n]),E=l.useCallback(async()=>{const P=await D();P.status==="blocked"&&(u(P.messageCount),c("choose-fate"))},[D]),A=l.useMemo(()=>Ie({mailboxes:i,folderAppointments:h,excludeMailboxId:a.mailboxId,translator:j}),[i,h,a.mailboxId,j]),r=A.find(P=>P.id===p),b=l.useMemo(()=>K(a,re(h).get(a.mailboxId),j),[a,h,j]);if(!s)return null;const F=`Delete ${b}`,$=o??a.messageCount,de=m==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(Q,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:f?G(f):"Moved 0 of 0"})]}):m==="checking"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(Q,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Checking the folder on the mail server…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:`Waiting ${S}. Nothing is deleted until the server answers.`})]}):m==="check-stalled"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(z,{tone:"warning",variant:"soft",children:`The mail server hasn't reported back on this folder yet — ${S} so far. Nothing has been deleted.`}),e.jsx("p",{className:"text-xs text-fg-muted",children:"A sync covers the whole account, so a busy mailbox can take a while to come round to this folder."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(y,{size:"sm",onClick:()=>E(),children:"Keep waiting"})]})]}):m==="deleting"||m==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(Q,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):m==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(z,{tone:"danger",variant:"soft",children:O??"Something went wrong. Please try again."}),f&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[G(f),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Close"})})]}):d==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(y,{variant:"danger",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),onClick:()=>E(),children:"Delete folder"})]})]}):d==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[o!==void 0&&e.jsx(z,{tone:"warning",variant:"soft",children:`This folder is not empty: the mail server reports ${T(o)} in it. Nothing was deleted.`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:b})," holds"," ",T($),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>c("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(B,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>c("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(Ke,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"})})]}):d==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b})," and its"," ",T($),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:()=>c("choose-fate"),children:"Back"}),e.jsx(y,{variant:"danger",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",T($)," in"," ",e.jsx("strong",{className:"text-fg",children:b})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(Y,{folders:A,selectedId:p,delimiter:i[0]?.hierarchyDelimiter??"/",onSelect:g,onCreateFolder:v,onCancel:()=>{g(void 0),c("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),r&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(y,{variant:"danger",onClick:()=>N(r.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${T($)} to ${r.label}`})})})]});return e.jsxs(W,{open:s,onClose:x,title:F,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(Me,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:F}),e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:x,"aria-label":"Cancel"})]}),de]})}function fs({account:s}){const t=Z(),a=s.accountId,i=ae(),{data:h,isPending:n,isError:d,error:c,refetch:o}=ne(Fe({path:{accountId:a}})),{createFolderIn:u}=te(a),p=V({...Pe(),meta:Re(409),onSuccess:()=>{t.invalidateQueries({queryKey:se()})}}),g=V({...$e(),onSuccess:()=>{t.invalidateQueries({queryKey:ee({path:{accountId:a}})})}}),[v,j]=l.useState(),[m,f]=l.useState(),[O,M]=l.useState(""),w=l.useMemo(()=>h?.items??[],[h]),D=l.useMemo(()=>re(s.folderAppointments),[s.folderAppointments]),N=l.useMemo(()=>w.map(r=>({id:r.mailboxId,label:K(r,D.get(r.mailboxId),i),path:r.fullPath,deleteBlockedReason:Le(r,w,s.folderAppointments).message,failure:Qe(r)})),[w,D,i,s.folderAppointments]),R=(r,b)=>{p.mutate({path:{accountId:a,role:_e[r]},body:{mailboxId:b}})},C=(r,b)=>{const F=b.trim();g.mutate({path:{accountId:a,mailboxId:r},body:{displayNameOverride:F===""?null:F}})};if(n)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(d)return e.jsx(ie,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:c,onRetry:()=>{o()}});const S=w.map(r=>({mailboxId:r.mailboxId,providerPath:r.fullPath,hierarchyDelimiter:r.hierarchyDelimiter,messageCount:r.messageCount})),I={};for(const r of s.folderAppointments){const b=Te[r.role];b&&(I[b]={mailboxId:r.mailboxId??null,source:r.source,staleFolderPath:r.staleAppointmentPath})}const k={};for(const r of w)r.displayNameOverride&&(k[r.mailboxId]=r.displayNameOverride);const x=r=>w.find(b=>b.mailboxId===r),E=x(m),A=x(v);return e.jsxs("div",{className:"space-y-4",children:[(p.isError||g.isError)&&e.jsx(z,{tone:"danger",variant:"soft",children:ze(p.error)?"That folder is still being created on the mail server — wait for it to finish, then try again.":"Couldn't save that change. Please try again."}),e.jsx(as,{accountEmail:s.email,folders:S,appointments:I,displayNames:k,onAppoint:R,onRename:C}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(Ye,{folders:N,delimiter:w[0]?.hierarchyDelimiter??"/",onCreateFolder:u,onRename:r=>{f(r.id),M(x(r.id)?.displayNameOverride?.trim()??"")},onDelete:r=>j(r.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),E&&e.jsx(We,{open:!0,folderLabel:K(E,D.get(E.mailboxId),i),defaultLabel:K({fullPath:E.fullPath,hierarchyDelimiter:E.hierarchyDelimiter},D.get(E.mailboxId),i),name:O,onNameChange:M,pending:g.isPending,error:g.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const r=O.trim();g.mutate({path:{accountId:a,mailboxId:E.mailboxId},body:{displayNameOverride:r===""?null:r}},{onSuccess:()=>f(void 0)})},onClose:()=>f(void 0)}),A&&e.jsx(xs,{open:!0,accountId:a,folder:A,mailboxes:w,appointments:s.folderAppointments,onClose:()=>j(void 0)})]})}function Ds(){const s=Ae(),t=De(),a=qe(),[i,h]=l.useState(!0),{data:n,isPending:d,isError:c,error:o,refetch:u}=ne(Oe());return e.jsx(He,{items:t,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:e.jsx(ts,{}),helpOpen:i,onToggleHelp:()=>h(p=>!p),onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:d?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):c?e.jsx(ie,{title:"Couldn't load accounts",error:o,onRetry:()=>{u()}}):n.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:n.accounts.map(p=>e.jsx(fs,{account:p},p.accountId))})})}export{Ds as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-C2US5ZnK.js";import{K as s}from"./kbd-C052hWKm.js";const a=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"VIP"})," senders get priority surface in the daily brief and notification escalation, even when an account is quiet."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," senders never notify and stay out of the brief. Their mail still syncs and stays searchable."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Blocked"})," senders never load images and go straight to junk."]}),e.jsxs("p",{children:["Tip: flag from the keyboard on any message — ",e.jsx(s,{children:"v"})," VIP,"," ",e.jsx(s,{children:"m"})," mute, ",e.jsx(s,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]}),r=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Sync health"})," shows the IMAP connection state and the last successful sync per account."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Error"})," means the last connection attempt failed — the raw server response is shown on the card. Reconnect re-runs the connection test from the add-account wizard."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," accounts keep syncing but stay out of the daily brief and unified counts."]})]}),c=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Density"})," controls how much information fits on screen. Compact is great on smaller displays; Comfortable gives each item more breathing room."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Theme"})," switches between light, dark, and system-preference modes instantly. The change takes effect across the whole app immediately."]}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Preferences are stored locally in this browser. Server-side sync is coming soon."})]}),i=e.jsx("div",{className:"space-y-3",children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Notification rules"})," and data export are coming in a future release."]})}),o=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["A message that fails to sync three times shows here. A"," ",e.jsx("strong",{className:"text-fg",children:"retrying"})," one is tried again every sync; a body that ",e.jsx("strong",{className:"text-fg",children:"gave up"})," is not. Either leaves the list once it syncs."]}),e.jsxs("p",{children:["A message Remit cannot read is"," ",e.jsx("strong",{className:"text-fg",children:"set aside"})," rather than skipped, and the folder keeps syncing. Setting one aside is a defect in Remit, so every entry can be reported with the diagnostics already attached."]}),e.jsx("p",{children:"A report carries no folder name, subject, address, message content or error text."})]});export{r as a,i as b,c,a as s,o as w};
|