@remit/web-client-dist 0.0.695 → 0.0.697
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-BJLNB-w7.js → BriefPane-BQx5RRpb.js} +1 -1
- package/assets/{CalendarEventEditor-MMNLFvjJ.js → CalendarEventEditor-B3bVY-Oc.js} +1 -1
- package/assets/{CalendarEventPopup-DVJ9DC_Y.js → CalendarEventPopup-D6PNfUfu.js} +1 -1
- package/assets/{CalendarLoadFailed-uHGxFBGx.js → CalendarLoadFailed-Cm6trTQZ.js} +1 -1
- package/assets/{CalendarQuickCreate-CzJ4lehP.js → CalendarQuickCreate-B_n983kv.js} +1 -1
- package/assets/{CalendarSession-BVuy8A2H.js → CalendarSession-BosFoHg2.js} +1 -1
- package/assets/CollectionPane-BzktgIp0.js +1 -0
- package/assets/{DesktopChrome-Ct-IB4ks.js → DesktopChrome-GxTHTvqD.js} +1 -1
- package/assets/{DropdownMenu-CTCHgh4X.js → DropdownMenu-C2J8u8zN.js} +1 -1
- package/assets/{EmptyState-CN-AyHj-.js → EmptyState-BJU14tbt.js} +1 -1
- package/assets/{ErrorState-Bk3DwNvd.js → ErrorState-BTHOmsYP.js} +1 -1
- package/assets/{FullCompose-BWiLy3Vm.js → FullCompose-DiZNltCL.js} +1 -1
- package/assets/{LabelApplyTrigger-52QGuTLD.js → LabelApplyTrigger-P8IoLKME.js} +1 -1
- package/assets/{MailShell-DAqGpnce.js → MailShell-tKLYT5hn.js} +1 -1
- package/assets/MailViewChrome-CLgaFbe-.js +1 -0
- package/assets/{MailboxPane-DUI-sxQF.js → MailboxPane-BxNCkl6s.js} +2 -2
- package/assets/{MessageBody-BeciCqb_.js → MessageBody-jG4Dhul6.js} +2 -2
- package/assets/{MessageToolbar-BYhqv9RG.js → MessageToolbar-DeDUhCvg.js} +1 -1
- package/assets/{NavMenuButton-A6v6v8tE.js → NavMenuButton-CLp6InRG.js} +1 -1
- package/assets/{OnboardingWizard-CIneAccs.js → OnboardingWizard-BSlPpmI5.js} +1 -1
- package/assets/{OutboxPane-InUnHiNC.js → OutboxPane-B6UfixBP.js} +1 -1
- package/assets/{ReportLink-q8WFRQli.js → ReportLink-BELrQR40.js} +1 -1
- package/assets/_calendarObjectId-BiaBDCEt.js +1 -0
- package/assets/_labelId-DLeWLaow.js +1 -0
- package/assets/_mailboxId-DWvQ-9gi.js +1 -0
- package/assets/_messageId-BB9xOwfs.js +1 -0
- package/assets/_messageId-C2YSZxRF.js +1 -0
- package/assets/_messageId-CPvSvBZB.js +1 -0
- package/assets/_messageId-DbVH08AL.js +1 -0
- package/assets/_outboxMessageId-BFgW_k_u.js +1 -0
- package/assets/_recurrenceId-96pqeQMh.js +1 -0
- package/assets/{_slotId-Cf-NASLE.js → _slotId-DQqfctAf.js} +1 -1
- package/assets/_threadId-Bm7b75jN.js +1 -0
- package/assets/_threadId-CCwEReI2.js +1 -0
- package/assets/_threadId-Db39B53v.js +1 -0
- package/assets/_threadId-Dht02PUZ.js +1 -0
- package/assets/{_view._date-dARprXsM.js → _view._date-BQeaBjoE.js} +1 -1
- package/assets/{account-service-status-DexPoUiT.js → account-service-status-DsLvRU-X.js} +1 -1
- package/assets/{accounts-DPvTdrTr.js → accounts-D0rPQMGH.js} +1 -1
- package/assets/{advanced-CDr_JOXg.js → advanced-q_hG98BB.js} +1 -1
- package/assets/{agenda-time-BcOiQ5_R.js → agenda-time-D0yU-H44.js} +1 -1
- package/assets/{app-chrome-6ZXmy5H4.js → app-chrome-BfyGOiSA.js} +1 -1
- package/assets/{appearance-BQZnBlkc.js → appearance-DM1k2Ta7.js} +1 -1
- package/assets/{avatar-B_QEsxCw.js → avatar-Bq7beWCy.js} +1 -1
- package/assets/{badge-CeCxCmzS.js → badge-BB80tGxy.js} +1 -1
- package/assets/{bottom-sheet-DWqGf7I3.js → bottom-sheet-DKF_Dkid.js} +1 -1
- package/assets/{brief-B7EfkUB4.js → brief-8diVJSZ9.js} +1 -1
- package/assets/brief-CFBkxoDK.js +1 -0
- package/assets/{calendar-DxjT7IrR.js → calendar-BqFIadRy.js} +1 -1
- package/assets/{calendar-CJGXdypt.js → calendar-Ds9kgvU8.js} +1 -1
- package/assets/{calendar-event-popup-y4Z860B0.js → calendar-event-popup-Cr_LW8IP.js} +1 -1
- package/assets/{calendar-event-sidebar-BaAGgT2x.js → calendar-event-sidebar-B_eR1h5J.js} +1 -1
- package/assets/{calendar-failure-note-CJvPzX2o.js → calendar-failure-note-C4gNXDQV.js} +1 -1
- package/assets/{calendar-guests-DeRthr7k.js → calendar-guests-Cay9Ub8h.js} +1 -1
- package/assets/{calendar-suggestion-BulekNHV.js → calendar-suggestion-EosZrXZC.js} +1 -1
- package/assets/{calendars-D-Use38B.js → calendars-52NaEZbX.js} +1 -1
- package/assets/{card-0Dzt3Scs.js → card-CLJYKox8.js} +1 -1
- package/assets/{checkbox-DIKh2-eX.js → checkbox-CYOm-zGr.js} +1 -1
- package/assets/{chevron-down-BnC2m4J6.js → chevron-down-De4wQzka.js} +1 -1
- package/assets/{chevron-left-CNQ3caMn.js → chevron-left-CUHU8UT9.js} +1 -1
- package/assets/{circle-check-CTlM3FQo.js → circle-check-DlR8I4Hf.js} +1 -1
- package/assets/{circle-check-big-DCVJA_H0.js → circle-check-big-CMsxQSjY.js} +1 -1
- package/assets/{circle-question-mark-CpApZe3H.js → circle-question-mark-DhNa_A16.js} +1 -1
- package/assets/{classification-C7_2tIfb.js → classification-BgDJ1gwK.js} +1 -1
- package/assets/{clock-CTlZVcLb.js → clock-Dds4zv6u.js} +1 -1
- package/assets/{cloud-off-CtJJ9OTh.js → cloud-off-BYulqayx.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BY1Sf-7o.js +1 -0
- package/assets/compose._-_outboxMessageId_-ByGI1c-o.js +1 -0
- package/assets/compose._-_outboxMessageId_-CvOAO1iL.js +1 -0
- package/assets/compose._-_outboxMessageId_-EZpX9L3H.js +1 -0
- package/assets/compose._-_outboxMessageId_-urlj3DLH.js +1 -0
- package/assets/{config-import-CHZ9oJuF.js → config-import-VTZQj3gU.js} +1 -1
- package/assets/{confirm-dialog-Cc446-7C.js → confirm-dialog-XvccFJdE.js} +1 -1
- package/assets/{copy-jXKvwaUz.js → copy-BokIobZ4.js} +1 -1
- package/assets/{credential-steps-yT5IXLY8.js → credential-steps-O1OzlOow.js} +1 -1
- package/assets/{download-CyhaY4zL.js → download-DEuAIIIQ.js} +1 -1
- package/assets/{draft-C1ufEqDz.js → draft-BEiHkDpm.js} +1 -1
- package/assets/edit-B9dhadKH.js +1 -0
- package/assets/edit-vn6fIBd6.js +1 -0
- package/assets/{external-link-1TiTglgB.js → external-link-L7NXOTeQ.js} +1 -1
- package/assets/{file-braces-CXZUVCry.js → file-braces-BN8-S---.js} +1 -1
- package/assets/{filters-CR0iG1ow.js → filters-VSaDpnX3.js} +1 -1
- package/assets/{flagged-DuEE_WUV.js → flagged-B-j-3yRr.js} +1 -1
- package/assets/flagged-BZJepVc-.js +1 -0
- package/assets/{folder-input-kcvJkrLj.js → folder-input-B0q8wLhf.js} +1 -1
- package/assets/{folders-6mmHeM8E.js → folders-CTNX9Hcm.js} +1 -1
- package/assets/{help-copy-CIhcXCo3.js → help-copy-DUjzIPXf.js} +1 -1
- package/assets/{import-76KXkdMq.js → import-DLM5VFnJ.js} +1 -1
- package/assets/index-B--m5QrT.js +1 -0
- package/assets/index-BuawSiTp.js +1 -0
- package/assets/index-C2YSZxRF.js +1 -0
- package/assets/index-CO1X8-aP.js +1 -0
- package/assets/index-CPvSvBZB.js +1 -0
- package/assets/{index-iXcp-mGT.js → index-Caon2n2j.js} +4 -4
- package/assets/index-ChWo5_90.js +1 -0
- package/assets/index-DGb7Ls8y.js +1 -0
- package/assets/index-DLRo9M2D.js +1 -0
- package/assets/index-DemsYVll.js +1 -0
- package/assets/index-Dylwxpr-.js +1 -0
- package/assets/index-YwusJB4d.js +1 -0
- package/assets/index-Zfii_-4V.js +1 -0
- package/assets/{index-yeSesYv-.js → index-fsuIswbe.js} +72 -72
- package/assets/{kbd-BVK8yKhS.js → kbd-jzPSd-a2.js} +1 -1
- package/assets/{label-chip-CrQMhpJe.js → label-chip-DtBVyALF.js} +1 -1
- package/assets/{labels-CaXUAL8B.js → labels-CUXsONgB.js} +1 -1
- package/assets/mail-BodKXw3C.js +1 -0
- package/assets/{mail-CLkdzm71.js → mail-BzFJWQZy.js} +1 -1
- package/assets/{menu-Cn2tY52U.js → menu-Bh94jr77.js} +1 -1
- package/assets/{nav-link-BvlYCbp-.js → nav-link-ed0mFCCx.js} +1 -1
- package/assets/new-DlRrHbU8.js +1 -0
- package/assets/onboarding-8O2rW7qq.js +1 -0
- package/assets/{onboarding-completion-CJl9zKMA.js → onboarding-completion-qKzJSmsI.js} +1 -1
- package/assets/outbox-nrXvnMTk.js +1 -0
- package/assets/{pencil-A679n1yJ.js → pencil-BDbmS56C.js} +1 -1
- package/assets/{people-C5ni4bV_.js → people-eWwwIt4_.js} +1 -1
- package/assets/{plus-D9A6i0pi.js → plus-D5-2sA5v.js} +1 -1
- package/assets/{popover-menu-wrc2e8Vk.js → popover-menu-DhcuKv1N.js} +1 -1
- package/assets/{refresh-cw-BRmmCn_2.js → refresh-cw-Cu9_I3cT.js} +1 -1
- package/assets/{reply-DL5kkaJs.js → reply-CXuSMyqp.js} +1 -1
- package/assets/{rich-text-EZFEOU8t.js → rich-text-Ds4rQc2o.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-NOmoFs4G.js → rich-text-spellcheck-worker-provider-ChKzrvjg.js} +1 -1
- package/assets/{rotate-ccw-C2NtRHS-.js → rotate-ccw-hQhPZwrx.js} +1 -1
- package/assets/{roving-focus-CSq3MPWi.js → roving-focus-DZX7IpN4.js} +1 -1
- package/assets/{row-actions-Cthc4RCY.js → row-actions-BDfQKXdD.js} +1 -1
- package/assets/{search-mirror-CCAs_ZWe.js → search-mirror-B2xnwy77.js} +1 -1
- package/assets/{search-scope-DaiXqXNv.js → search-scope-B-3MTDpD.js} +1 -1
- package/assets/{search-token-index-VBBiMTaA.js → search-token-index-BYKMNlJD.js} +1 -1
- package/assets/{sections-uFHlOXiA.js → sections-DpRVKuXF.js} +1 -1
- package/assets/{segmented-control-DNxc5Ghi.js → segmented-control-BwvsufVp.js} +1 -1
- package/assets/{select-B9t8348S.js → select-TYdrgtW5.js} +1 -1
- package/assets/senders-vh4OQfD0.js +1 -0
- package/assets/settings-MlHARJWl.js +1 -0
- package/assets/{settings-screen-CafoSGzb.js → settings-screen-DTYVWAkg.js} +1 -1
- package/assets/{shield-check-BdZGtm0z.js → shield-check-C-tOrPEx.js} +1 -1
- package/assets/{spam-DKjh33Xi.js → spam-CecFwFHS.js} +1 -1
- package/assets/{suggest-list-Do7i1-gb.js → suggest-list-BCqr1j26.js} +1 -1
- package/assets/{suggested-vips-C-je5foZ.js → suggested-vips--pG2iuOT.js} +1 -1
- package/assets/{suggestion._suggestionId-DF2BM_zX.js → suggestion._suggestionId-DiMWWP0r.js} +1 -1
- package/assets/{switch-1RDXcNo-.js → switch-CyAtRlCz.js} +1 -1
- package/assets/{task._calendarTaskId-B7k5whQt.js → task._calendarTaskId-D-wpEifQ.js} +1 -1
- package/assets/{undo-2-B-b8_FeJ.js → undo-2-D1IMLq7c.js} +1 -1
- package/assets/{useCalendarData-BcNSn1yP.js → useCalendarData-DFG3pzeG.js} +1 -1
- package/assets/{useCalendarScheduling-Dfk1b293.js → useCalendarScheduling-B_INtO-h.js} +1 -1
- package/assets/{useCalendarSuggestions-D_tk6nh4.js → useCalendarSuggestions-DXbA0boT.js} +1 -1
- package/assets/{useCalendarTasks-CX2Wh1Fn.js → useCalendarTasks-b_UNFPQH.js} +1 -1
- package/assets/{useClassificationSettings-Bi0m63-O.js → useClassificationSettings-DBRecrmp.js} +1 -1
- package/assets/useCollectionThreads-DgofDKen.js +1 -0
- package/assets/{useDebouncedValue-AWe2Zncy.js → useDebouncedValue-CFZ4EPXW.js} +1 -1
- package/assets/{useFilters-Bp1QgyWU.js → useFilters-DHWZEIQe.js} +1 -1
- package/assets/useInfiniteQuery-B-vOuANs.js +1 -0
- package/assets/{useJunkMailboxIds-CWScvBHw.js → useJunkMailboxIds-CW7aI25D.js} +1 -1
- package/assets/{useLabels-CGE9kc74.js → useLabels-k1VKuQrr.js} +1 -1
- package/assets/{useLayoutTier-D5MoTNho.js → useLayoutTier-BNUKvwJD.js} +1 -1
- package/assets/{useMediaQuery-Bf7zukl9.js → useMediaQuery-Hy81MQ2M.js} +1 -1
- package/assets/{useMessageBodyContent-BxjoKGiE.js → useMessageBodyContent-CpTD2HGg.js} +1 -1
- package/assets/{useQueries-Dj93detX.js → useQueries-DPH-PeHV.js} +1 -1
- package/assets/{useRefreshControl-DCFTdDZz.js → useRefreshControl-DdbTrGxq.js} +1 -1
- package/assets/{useResultFolderIndex-DAcbTt0T.js → useResultFolderIndex-BVyfzXH5.js} +1 -1
- package/assets/{useSignature-CA8ypw7f.js → useSignature-W9HBbZ_n.js} +1 -1
- package/assets/{warnings-C-blkf-m.js → warnings-B2sNE31D.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/CollectionPane-RUuB6sFo.js +0 -1
- package/assets/MailViewChrome-BDymWKX9.js +0 -1
- package/assets/_calendarObjectId-B3IHxxnZ.js +0 -1
- package/assets/_labelId-BX1_9FW3.js +0 -1
- package/assets/_mailboxId-BKCf6hRR.js +0 -1
- package/assets/_messageId-DGc5xyqH.js +0 -1
- package/assets/_messageId-ODP9L5rG.js +0 -1
- package/assets/_messageId-_9l1GYCG.js +0 -1
- package/assets/_messageId-t0gwqxwG.js +0 -1
- package/assets/_outboxMessageId-DGFiVWCU.js +0 -1
- package/assets/_recurrenceId-yqFEhvsn.js +0 -1
- package/assets/_threadId-Bvd5G-pJ.js +0 -1
- package/assets/_threadId-BwJQjORR.js +0 -1
- package/assets/_threadId-CFLbzDUi.js +0 -1
- package/assets/_threadId-Dj29QtLs.js +0 -1
- package/assets/brief-NsiukvBp.js +0 -1
- package/assets/compose._-_outboxMessageId_-BT2RKEAF.js +0 -1
- package/assets/compose._-_outboxMessageId_-B_NGqkpg.js +0 -1
- package/assets/compose._-_outboxMessageId_-CCPr3GjM.js +0 -1
- package/assets/compose._-_outboxMessageId_-CFBNHbeY.js +0 -1
- package/assets/compose._-_outboxMessageId_-Cw-Zq1kx.js +0 -1
- package/assets/edit-BGhTeEac.js +0 -1
- package/assets/edit-CeXJ3wiI.js +0 -1
- package/assets/flagged-B4N5fCui.js +0 -1
- package/assets/index-5PtybTMj.js +0 -1
- package/assets/index-B-gNDz7v.js +0 -1
- package/assets/index-B1AltYi_.js +0 -1
- package/assets/index-BX5kv92z.js +0 -1
- package/assets/index-CzMYehsR.js +0 -1
- package/assets/index-DT4iQTvg.js +0 -1
- package/assets/index-DZ4zN_a2.js +0 -1
- package/assets/index-Xq-TD3Lr.js +0 -1
- package/assets/index-eKzwYumy.js +0 -1
- package/assets/index-ehMMhnu5.js +0 -1
- package/assets/index-rui9BQ_f.js +0 -1
- package/assets/index-t0gwqxwG.js +0 -1
- package/assets/mail-CiuTTyMm.js +0 -1
- package/assets/new-ZEuIlDnl.js +0 -1
- package/assets/onboarding-bCsMaIPY.js +0 -1
- package/assets/outbox-BthyAXQ5.js +0 -1
- package/assets/senders-uBzIqu95.js +0 -1
- package/assets/settings-BLs90wKU.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as Ve,aj as z,r as b,j as l,p as C,I as He,P as Ge,eo as ye,e as We,an as Ye,f as Xe,ao as qe,cT as Qe,bT as Ze,aa as Je,y as et,X as tt}from"./index-yeSesYv-.js";import{K as U}from"./kbd-BVK8yKhS.js";import{i as st}from"./search-scope-DaiXqXNv.js";import"./nav-link-BvlYCbp-.js";import{d as rt}from"./reply-DL5kkaJs.js";import{p as nt,B as ot,b as it}from"./useMessageBodyContent-BxjoKGiE.js";const q=[{category:"personal",label:"Personal",tone:"accent",section:1},{category:"uncategorized",label:"Unclassified",tone:"neutral",section:8},{category:"transactional",label:"Transactional",tone:"positive",section:2},{category:"newsletter",label:"Newsletter",tone:"neutral",section:3},{category:"marketing",label:"Marketing",tone:"neutral",section:4},{category:"social",label:"Social",tone:"warning",section:5},{category:"automated",label:"Automated",tone:"neutral",section:6},{category:"coldOutreach",label:"Cold outreach",tone:"neutral",section:7}],_r=[...q].sort((t,e)=>t.section-e.section).map(t=>t.category),ve=t=>Object.fromEntries(q.map(e=>[e.category,t(e)])),Q=ve(t=>t.label),at=ve(t=>t.tone),xr=t=>!t||t==="personal"?null:Q[t];function ct(t){return Object.hasOwn(at,t)}function Er(t){return t==="all"||ct(t)}const Sr=[{id:"all",label:"All",tone:"neutral"},...q.map(t=>({id:t.category,label:t.label,tone:t.tone}))];const we={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};we.node;const kr=Ve(we);function lt(t,e,s){return Math.max(e,Math.min(t,s))}const v={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Z(t,e,s){return e===0||Math.abs(e)===1/0?Math.pow(t,s*5):t*e*s/(e+s*t)}function J(t,e,s,r=.15){return r===0?lt(t,e,s):t<e?-Z(e-t,s-e,r)+e:t>s?+Z(t-s,s-e,r)+s:t}function ut(t,[e,s],[r,n]){const[[o,i],[c,u]]=t;return[J(e,o,i,r),J(s,c,u,n)]}function dt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ft(t){var e=dt(t,"string");return typeof e=="symbol"?e:String(e)}function x(t,e,s){return e=ft(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ee(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function m(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(s),!0).forEach(function(r){x(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ee(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const _e={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function te(t){return t?t[0].toUpperCase()+t.slice(1):""}const ht=["enter","leave"];function pt(t=!1,e){return t&&!ht.includes(e)}function mt(t,e="",s=!1){const r=_e[t],n=r&&r[e]||e;return"on"+te(t)+te(n)+(pt(s,n)?"Capture":"")}const gt=["gotpointercapture","lostpointercapture"];function bt(t){let e=t.substring(2).toLowerCase();const s=!!~e.indexOf("passive");s&&(e=e.replace("passive",""));const r=gt.includes(e)?"capturecapture":"capture",n=!!~e.indexOf(r);return n&&(e=e.replace("capture","")),{device:e,capture:n,passive:s}}function yt(t,e=""){const s=_e[t],r=s&&s[e]||e;return t+r}function K(t){return"touches"in t}function xe(t){return K(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function vt(t){return Array.from(t.touches).filter(e=>{var s,r;return e.target===t.currentTarget||((s=t.currentTarget)===null||s===void 0||(r=s.contains)===null||r===void 0?void 0:r.call(s,e.target))})}function wt(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function Ee(t){return K(t)?wt(t)[0]:t}function _t(t){return vt(t).map(e=>e.identifier)}function F(t){const e=Ee(t);return K(t)?e.identifier:e.pointerId}function se(t){const e=Ee(t);return[e.clientX,e.clientY]}function xt(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o}=t;Object.assign(e,{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o})}return e}function B(t,...e){return typeof t=="function"?t(...e):t}function Et(){}function St(...t){return t.length===0?Et:t.length===1?t[0]:function(){let e;for(const s of t)e=s.apply(this,arguments)||e;return e}}function re(t,e){return Object.assign({},e,t||{})}const kt=32;class Tt{constructor(e,s,r){this.ctrl=e,this.args=s,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:s,ingKey:r,args:n}=this;s[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=n,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const s=this.state,r=this.config;s._active||(this.reset(),this.computeInitial(),s._active=!0,s.target=e.target,s.currentTarget=e.currentTarget,s.lastOffset=r.from?B(r.from,s):s.offset,s.offset=s.lastOffset,s.startTime=s.timeStamp=e.timeStamp)}computeValues(e){const s=this.state;s._values=e,s.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:s,config:r,shared:n}=this;s.args=this.args;let o=0;if(e&&(s.event=e,r.preventDefault&&e.cancelable&&s.event.preventDefault(),s.type=e.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,xt(e)),n.down=n.pressed=n.buttons%2===1||n.touches>0,o=e.timeStamp-s.timeStamp,s.timeStamp=e.timeStamp,s.elapsedTime=s.timeStamp-s.startTime),s._active){const g=s._delta.map(Math.abs);v.addTo(s._distance,g)}this.axisIntent&&this.axisIntent(e);const[i,c]=s._movement,[u,d]=r.threshold,{_step:a,values:f}=s;if(r.hasCustomTransform?(a[0]===!1&&(a[0]=Math.abs(i)>=u&&f[0]),a[1]===!1&&(a[1]=Math.abs(c)>=d&&f[1])):(a[0]===!1&&(a[0]=Math.abs(i)>=u&&Math.sign(i)*u),a[1]===!1&&(a[1]=Math.abs(c)>=d&&Math.sign(c)*d)),s.intentional=a[0]!==!1||a[1]!==!1,!s.intentional)return;const h=[0,0];if(r.hasCustomTransform){const[g,O]=f;h[0]=a[0]!==!1?g-a[0]:0,h[1]=a[1]!==!1?O-a[1]:0}else h[0]=a[0]!==!1?i-a[0]:0,h[1]=a[1]!==!1?c-a[1]:0;this.restrictToAxis&&!s._blocked&&this.restrictToAxis(h);const E=s.offset,y=s._active&&!s._blocked||s.active;y&&(s.first=s._active&&!s.active,s.last=!s._active&&s.active,s.active=n[this.ingKey]=s._active,e&&(s.first&&("bounds"in r&&(s._bounds=B(r.bounds,s)),this.setup&&this.setup()),s.movement=h,this.computeOffset()));const[S,_]=s.offset,[[w,T],[A,D]]=s._bounds;s.overflow=[S<w?-1:S>T?1:0,_<A?-1:_>D?1:0],s._movementBound[0]=s.overflow[0]?s._movementBound[0]===!1?s._movement[0]:s._movementBound[0]:!1,s._movementBound[1]=s.overflow[1]?s._movementBound[1]===!1?s._movement[1]:s._movementBound[1]:!1;const p=s._active?r.rubberband||[0,0]:[0,0];if(s.offset=ut(s._bounds,s.offset,p),s.delta=v.sub(s.offset,E),this.computeMovement(),y&&(!s.last||o>kt)){s.delta=v.sub(s.offset,E);const g=s.delta.map(Math.abs);v.addTo(s.distance,g),s.direction=s.delta.map(Math.sign),s._direction=s._delta.map(Math.sign),!s.first&&o>0&&(s.velocity=[g[0]/o,g[1]/o],s.timeDelta=o)}}emit(){const e=this.state,s=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const n=this.handler(m(m(m({},s),e),{},{[this.aliasKey]:e.values}));n!==void 0&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function At([t,e],s){const r=Math.abs(t),n=Math.abs(e);if(r>n&&r>s)return"x";if(n>r&&n>s)return"y"}class Ct extends Tt{constructor(...e){super(...e),x(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=v.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=v.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const s=this.state,r=this.config;if(!s.axis&&e){const n=typeof r.axisThreshold=="object"?r.axisThreshold[xe(e)]:r.axisThreshold;s.axis=At(s._movement,n)}s._blocked=(r.lockDirection||!!r.axis)&&!s.axis||!!r.axis&&r.axis!==s.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Ot=t=>t,ne=.15,Se={enabled(t=!0){return t},eventOptions(t,e,s){return m(m({},s.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[ne,ne];case!1:return[0,0];default:return v.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return v.toVector(t)},transform(t,e,s){const r=t||s.shared.transform;return this.hasCustomTransform=!!r,r||Ot},threshold(t){return v.toVector(t,0)}},Dt=0,j=m(m({},Se),{},{axis(t,e,{axis:s}){if(this.lockDirection=s==="lock",!this.lockDirection)return s},axisThreshold(t=Dt){return t},bounds(t={}){if(typeof t=="function")return o=>j.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:s=1/0,top:r=-1/0,bottom:n=1/0}=t;return[[e,s],[r,n]]}}),oe={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class It extends Ct{constructor(...e){super(...e),x(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const s=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),n={left:s.left-r.left+e.offset[0],right:s.right-r.right+e.offset[0],top:s.top-r.top+e.offset[1],bottom:s.bottom-r.bottom+e.offset[1]};e._bounds=j.bounds(n)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const s=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(s.pointerButtons)?!s.pointerButtons.includes(e.buttons):s.pointerButtons!==-1&&s.pointerButtons!==e.buttons))return;const n=this.ctrl.setEventIds(e);s.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(n&&n.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=F(e),r._pointerActive=!0,this.computeValues(se(e)),this.computeInitial(),s.preventScrollAxis&&xe(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):s.delay>0?(this.setupDelayTrigger(e),s.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const s=this.state;s._active=!0,s._preventScroll=!0,s._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const s=this.state,r=this.config;if(!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;const o=se(e);if(document.pointerLockElement===e.target?s._delta=[e.movementX,e.movementY]:(s._delta=v.sub(o,s._values),this.computeValues(o)),v.addTo(s._movement,s._delta),this.compute(e),s._delayed&&s.intentional){this.timeoutStore.remove("dragDelay"),s.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!s._preventScroll)if(s.axis)if(s.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){s._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const s=this.state,r=this.config;if(!s._active||!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=s._distance;if(s.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,s.tap&&r.filterTaps)s._force=!0;else{const[c,u]=s._delta,[d,a]=s._movement,[f,h]=r.swipe.velocity,[E,y]=r.swipe.distance,S=r.swipe.duration;if(s.elapsedTime<S){const _=Math.abs(c/s.timeDelta),w=Math.abs(u/s.timeDelta);_>f&&Math.abs(d)>E&&(s.swipe[0]=Math.sign(c)),w>h&&Math.abs(a)>y&&(s.swipe[1]=Math.sign(u))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const s=this.config,r=s.device;s.pointerLock&&e.currentTarget.requestPointerLock(),s.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,jt(e);const s=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",s),this.eventStore.add(this.sharedConfig.window,"touch","cancel",s),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const s=oe[e.key];if(s){const r=this.state,n=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=s(this.config.keyboardDisplacement,n),r._keyboardActive=!0,v.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in oe&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const s=this.config.device;e(s,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(s,"change",this.pointerMove.bind(this)),e(s,"end",this.pointerUp.bind(this)),e(s,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function jt(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const P=typeof window<"u"&&window.document&&window.document.createElement;function ke(){return P&&"ontouchstart"in window}function Pt(){return ke()||P&&window.navigator.maxTouchPoints>1}function Lt(){return P&&"onpointerdown"in window}function Nt(){return P&&"exitPointerLock"in window.document}function Mt(){try{return"constructor"in GestureEvent}catch{return!1}}const k={isBrowser:P,gesture:Mt(),touch:ke(),touchscreen:Pt(),pointer:Lt(),pointerLock:Nt()},Rt=250,Bt=180,$t=.5,Kt=50,zt=250,Ut=10,ie={mouse:0,touch:0,pen:8},Ft=m(m({},j),{},{device(t,e,{pointer:{touch:s=!1,lock:r=!1,mouse:n=!1}={}}){return this.pointerLock=r&&k.pointerLock,k.touch&&s?"touch":this.pointerLock?"mouse":k.pointer&&!n?"pointer":k.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Rt:void 0,!(!k.touchscreen||s===!1))return t||(s!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:s=!0,buttons:r=1,keys:n=!0}={}}){return this.pointerButtons=r,this.keys=n,!this.pointerLock&&this.device==="pointer"&&s},threshold(t,e,{filterTaps:s=!1,tapsThreshold:r=3,axis:n=void 0}){const o=v.toVector(t,s?r:n?1:0);return this.filterTaps=s,this.tapsThreshold=r,o},swipe({velocity:t=$t,distance:e=Kt,duration:s=zt}={}){return{velocity:this.transform(v.toVector(t)),distance:this.transform(v.toVector(e)),duration:s}},delay(t=0){switch(t){case!0:return Bt;case!1:return 0;default:return t}},axisThreshold(t){return t?m(m({},ie),t):ie},keyboardDisplacement(t=Ut){return t}});m(m({},Se),{},{device(t,e,{shared:s,pointer:{touch:r=!1}={}}){if(s.target&&!k.touch&&k.gesture)return"gesture";if(k.touch&&r)return"touch";if(k.touchscreen){if(k.pointer)return"pointer";if(k.touch)return"touch"}},bounds(t,e,{scaleBounds:s={},angleBounds:r={}}){const n=i=>{const c=re(B(s,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=re(B(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof s!="function"&&typeof r!="function"?[n(),o()]:i=>[n(i),o(i)]},threshold(t,e,s){return this.lockDirection=s.axis==="lock",v.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});m(m({},j),{},{mouseOnly:(t=!0)=>t});m(m({},j),{},{mouseOnly:(t=!0)=>t});const Te=new Map,G=new Map;function Ae(t){Te.set(t.key,t.engine),G.set(t.key,t.resolver)}const Ce={key:"drag",engine:It,resolver:Ft};function Vt(t,e){if(t==null)return{};var s={},r=Object.keys(t),n,o;for(o=0;o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&(s[n]=t[n]);return s}function Ht(t,e){if(t==null)return{};var s=Vt(t,e),r,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(s[r]=t[r])}return s}const Gt={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=k.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},Wt=["target","eventOptions","window","enabled","transform"];function R(t={},e){const s={};for(const[r,n]of Object.entries(e))switch(typeof n){case"function":s[r]=n.call(s,t[r],r,t);break;case"object":s[r]=R(t[r],n);break;case"boolean":n&&(s[r]=t[r]);break}return s}function Yt(t,e,s={}){const r=t,{target:n,eventOptions:o,window:i,enabled:c,transform:u}=r,d=Ht(r,Wt);if(s.shared=R({target:n,eventOptions:o,window:i,enabled:c,transform:u},Gt),e){const a=G.get(e);s[e]=R(m({shared:s.shared},d),a)}else for(const a in d){const f=G.get(a);f&&(s[a]=R(m({shared:s.shared},d[a]),f))}return s}class Oe{constructor(e,s){x(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=s}add(e,s,r,n,o){const i=this._listeners,c=yt(s,r),u=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},d=m(m({},u),o);e.addEventListener(c,n,d);const a=()=>{e.removeEventListener(c,n,d),i.delete(a)};return i.add(a),a}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Xt{constructor(){x(this,"_timeouts",new Map)}add(e,s,r=140,...n){this.remove(e),this._timeouts.set(e,window.setTimeout(s,r,...n))}remove(e){const s=this._timeouts.get(e);s&&window.clearTimeout(s)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class De{constructor(e){x(this,"gestures",new Set),x(this,"_targetEventStore",new Oe(this)),x(this,"gestureEventStores",{}),x(this,"gestureTimeoutStores",{}),x(this,"handlers",{}),x(this,"config",{}),x(this,"pointerIds",new Set),x(this,"touchIds",new Set),x(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),qt(this,e)}setEventIds(e){if(K(e))return this.touchIds=new Set(_t(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,s){this.handlers=e,this.nativeHandlers=s}applyConfig(e,s){this.config=Yt(e,s,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const s=this.config.shared,r={};let n;if(!(s.target&&(n=s.target(),!n))){if(s.enabled){for(const i of this.gestures){const c=this.config[i],u=ae(r,c.eventOptions,!!n);if(c.enabled){const d=Te.get(i);new d(this,e,i).bind(u)}}const o=ae(r,s.eventOptions,!!n);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](m(m({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=St(...r[o]);if(!n)return r;for(const o in r){const{device:i,capture:c,passive:u}=bt(o);this._targetEventStore.add(n,i,"",r[o],{capture:c,passive:u})}}}}function I(t,e){t.gestures.add(e),t.gestureEventStores[e]=new Oe(t,e),t.gestureTimeoutStores[e]=new Xt}function qt(t,e){e.drag&&I(t,"drag"),e.wheel&&I(t,"wheel"),e.scroll&&I(t,"scroll"),e.move&&I(t,"move"),e.pinch&&I(t,"pinch"),e.hover&&I(t,"hover")}const ae=(t,e,s)=>(r,n,o,i={},c=!1)=>{var u,d;const a=(u=i.capture)!==null&&u!==void 0?u:e.capture,f=(d=i.passive)!==null&&d!==void 0?d:e.passive;let h=c?r:mt(r,n,a);s&&f&&(h+="Passive"),t[h]=t[h]||[],t[h].push(o)};function Qt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zt(t){var e=Qt(t,"string");return typeof e=="symbol"?e:String(e)}function Jt(t,e,s){return e=Zt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ce(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function M(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ce(Object(s),!0).forEach(function(r){Jt(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ce(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}class es{constructor(e,s,r,n,o){this._target=e,this._gestureKey=n,this._ctrl=new De(s),this._ctrl.applyHandlers(s,o),this._ctrl.applyConfig(M(M({},r),{},{target:e}),n),this._ctrl.effect()}destroy(){this._ctrl.clean()}setConfig(e){this._ctrl.clean(),this._ctrl.applyConfig(M(M({},e),{},{target:this._target}),this._gestureKey),this._ctrl.effect()}}const ts=function(e,s,r){return Ae(Ce),new es(e,{drag:s},r||{},"drag")},V=10,Ie={axisThreshold:{mouse:V,touch:V,pen:V},swipe:{distance:60,velocity:.3,duration:600},pointer:{keys:!1,capture:!1}};function ss(t,e={},s,r){const n=z.useMemo(()=>new De(t),[]);if(n.applyHandlers(t,r),n.applyConfig(e,s),z.useEffect(n.effect.bind(n)),z.useEffect(()=>n.clean.bind(n),[]),e.target===void 0)return n.bind.bind(n)}function rs(t,e){return Ae(Ce),ss({drag:t},e||{},"drag")}const W="remit:swipe",ns=b.createContext(!1),os=1.01,je=t=>{const{event:e}=t;if("pointerType"in e&&e.pointerType!=="touch"||e.type!=="pointerup")return null;const s=t.swipe[0];return s<0?"left":s>0?"right":null},Pe=t=>{const e=window.visualViewport;return e?.addEventListener("resize",t),()=>e?.removeEventListener("resize",t)},Le=()=>(window.visualViewport?.scale??1)>os,Tr=({onSwipeLeft:t,onSwipeRight:e})=>{const s=b.useRef(null),r=t!==void 0||e!==void 0,n=b.useSyncExternalStore(Pe,Le,()=>!1),o=c=>{c==="left"&&t?.(),c==="right"&&e?.()},i=rs(c=>o(je(c)),{...Ie,axis:"x",enabled:r&&!n});return b.useEffect(()=>{const c=s.current;if(!c||!r||n)return;const u=d=>{if(!(d instanceof CustomEvent))return;const{detail:a}=d;(a==="left"||a==="right")&&o(a)};return c.addEventListener(W,u),()=>c.removeEventListener(W,u)}),{ref:s,bind:i,touchAction:r&&!n?"pan-y pinch-zoom":"auto",enabled:r}},is='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',$={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},as={background:!1,spacing:!1},cs="16px",ls=()=>`html{padding:0}body{padding:${cs};box-sizing:border-box}`,us=()=>"html{overflow:hidden}body{overflow-x:auto}",ds=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,fs='<meta name="viewport" content="width=device-width, initial-scale=1">',hs=t=>{const e=t?$.dark:$.light;return`
|
|
1
|
+
import{b as Ve,aj as z,r as b,j as l,p as C,I as He,P as Ge,ep as ye,e as We,an as Ye,f as Xe,ao as qe,cT as Qe,bT as Ze,aa as Je,y as et,X as tt}from"./index-fsuIswbe.js";import{K as U}from"./kbd-jzPSd-a2.js";import{i as st}from"./search-scope-B-3MTDpD.js";import"./nav-link-ed0mFCCx.js";import{d as rt}from"./reply-CXuSMyqp.js";import{p as nt,B as ot,b as it}from"./useMessageBodyContent-CpTD2HGg.js";const q=[{category:"personal",label:"Personal",tone:"accent",section:1},{category:"uncategorized",label:"Unclassified",tone:"neutral",section:8},{category:"transactional",label:"Transactional",tone:"positive",section:2},{category:"newsletter",label:"Newsletter",tone:"neutral",section:3},{category:"marketing",label:"Marketing",tone:"neutral",section:4},{category:"social",label:"Social",tone:"warning",section:5},{category:"automated",label:"Automated",tone:"neutral",section:6},{category:"coldOutreach",label:"Cold outreach",tone:"neutral",section:7}],_r=[...q].sort((t,e)=>t.section-e.section).map(t=>t.category),ve=t=>Object.fromEntries(q.map(e=>[e.category,t(e)])),Q=ve(t=>t.label),at=ve(t=>t.tone),xr=t=>!t||t==="personal"?null:Q[t];function ct(t){return Object.hasOwn(at,t)}function Er(t){return t==="all"||ct(t)}const Sr=[{id:"all",label:"All",tone:"neutral"},...q.map(t=>({id:t.category,label:t.label,tone:t.tone}))];const we={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};we.node;const kr=Ve(we);function lt(t,e,s){return Math.max(e,Math.min(t,s))}const v={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Z(t,e,s){return e===0||Math.abs(e)===1/0?Math.pow(t,s*5):t*e*s/(e+s*t)}function J(t,e,s,r=.15){return r===0?lt(t,e,s):t<e?-Z(e-t,s-e,r)+e:t>s?+Z(t-s,s-e,r)+s:t}function ut(t,[e,s],[r,n]){const[[o,i],[c,u]]=t;return[J(e,o,i,r),J(s,c,u,n)]}function dt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ft(t){var e=dt(t,"string");return typeof e=="symbol"?e:String(e)}function x(t,e,s){return e=ft(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ee(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function m(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(s),!0).forEach(function(r){x(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ee(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const _e={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function te(t){return t?t[0].toUpperCase()+t.slice(1):""}const ht=["enter","leave"];function pt(t=!1,e){return t&&!ht.includes(e)}function mt(t,e="",s=!1){const r=_e[t],n=r&&r[e]||e;return"on"+te(t)+te(n)+(pt(s,n)?"Capture":"")}const gt=["gotpointercapture","lostpointercapture"];function bt(t){let e=t.substring(2).toLowerCase();const s=!!~e.indexOf("passive");s&&(e=e.replace("passive",""));const r=gt.includes(e)?"capturecapture":"capture",n=!!~e.indexOf(r);return n&&(e=e.replace("capture","")),{device:e,capture:n,passive:s}}function yt(t,e=""){const s=_e[t],r=s&&s[e]||e;return t+r}function K(t){return"touches"in t}function xe(t){return K(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function vt(t){return Array.from(t.touches).filter(e=>{var s,r;return e.target===t.currentTarget||((s=t.currentTarget)===null||s===void 0||(r=s.contains)===null||r===void 0?void 0:r.call(s,e.target))})}function wt(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function Ee(t){return K(t)?wt(t)[0]:t}function _t(t){return vt(t).map(e=>e.identifier)}function F(t){const e=Ee(t);return K(t)?e.identifier:e.pointerId}function se(t){const e=Ee(t);return[e.clientX,e.clientY]}function xt(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o}=t;Object.assign(e,{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o})}return e}function B(t,...e){return typeof t=="function"?t(...e):t}function Et(){}function St(...t){return t.length===0?Et:t.length===1?t[0]:function(){let e;for(const s of t)e=s.apply(this,arguments)||e;return e}}function re(t,e){return Object.assign({},e,t||{})}const kt=32;class Tt{constructor(e,s,r){this.ctrl=e,this.args=s,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:s,ingKey:r,args:n}=this;s[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=n,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const s=this.state,r=this.config;s._active||(this.reset(),this.computeInitial(),s._active=!0,s.target=e.target,s.currentTarget=e.currentTarget,s.lastOffset=r.from?B(r.from,s):s.offset,s.offset=s.lastOffset,s.startTime=s.timeStamp=e.timeStamp)}computeValues(e){const s=this.state;s._values=e,s.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:s,config:r,shared:n}=this;s.args=this.args;let o=0;if(e&&(s.event=e,r.preventDefault&&e.cancelable&&s.event.preventDefault(),s.type=e.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,xt(e)),n.down=n.pressed=n.buttons%2===1||n.touches>0,o=e.timeStamp-s.timeStamp,s.timeStamp=e.timeStamp,s.elapsedTime=s.timeStamp-s.startTime),s._active){const g=s._delta.map(Math.abs);v.addTo(s._distance,g)}this.axisIntent&&this.axisIntent(e);const[i,c]=s._movement,[u,d]=r.threshold,{_step:a,values:f}=s;if(r.hasCustomTransform?(a[0]===!1&&(a[0]=Math.abs(i)>=u&&f[0]),a[1]===!1&&(a[1]=Math.abs(c)>=d&&f[1])):(a[0]===!1&&(a[0]=Math.abs(i)>=u&&Math.sign(i)*u),a[1]===!1&&(a[1]=Math.abs(c)>=d&&Math.sign(c)*d)),s.intentional=a[0]!==!1||a[1]!==!1,!s.intentional)return;const h=[0,0];if(r.hasCustomTransform){const[g,O]=f;h[0]=a[0]!==!1?g-a[0]:0,h[1]=a[1]!==!1?O-a[1]:0}else h[0]=a[0]!==!1?i-a[0]:0,h[1]=a[1]!==!1?c-a[1]:0;this.restrictToAxis&&!s._blocked&&this.restrictToAxis(h);const E=s.offset,y=s._active&&!s._blocked||s.active;y&&(s.first=s._active&&!s.active,s.last=!s._active&&s.active,s.active=n[this.ingKey]=s._active,e&&(s.first&&("bounds"in r&&(s._bounds=B(r.bounds,s)),this.setup&&this.setup()),s.movement=h,this.computeOffset()));const[S,_]=s.offset,[[w,T],[A,D]]=s._bounds;s.overflow=[S<w?-1:S>T?1:0,_<A?-1:_>D?1:0],s._movementBound[0]=s.overflow[0]?s._movementBound[0]===!1?s._movement[0]:s._movementBound[0]:!1,s._movementBound[1]=s.overflow[1]?s._movementBound[1]===!1?s._movement[1]:s._movementBound[1]:!1;const p=s._active?r.rubberband||[0,0]:[0,0];if(s.offset=ut(s._bounds,s.offset,p),s.delta=v.sub(s.offset,E),this.computeMovement(),y&&(!s.last||o>kt)){s.delta=v.sub(s.offset,E);const g=s.delta.map(Math.abs);v.addTo(s.distance,g),s.direction=s.delta.map(Math.sign),s._direction=s._delta.map(Math.sign),!s.first&&o>0&&(s.velocity=[g[0]/o,g[1]/o],s.timeDelta=o)}}emit(){const e=this.state,s=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const n=this.handler(m(m(m({},s),e),{},{[this.aliasKey]:e.values}));n!==void 0&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function At([t,e],s){const r=Math.abs(t),n=Math.abs(e);if(r>n&&r>s)return"x";if(n>r&&n>s)return"y"}class Ct extends Tt{constructor(...e){super(...e),x(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=v.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=v.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const s=this.state,r=this.config;if(!s.axis&&e){const n=typeof r.axisThreshold=="object"?r.axisThreshold[xe(e)]:r.axisThreshold;s.axis=At(s._movement,n)}s._blocked=(r.lockDirection||!!r.axis)&&!s.axis||!!r.axis&&r.axis!==s.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Ot=t=>t,ne=.15,Se={enabled(t=!0){return t},eventOptions(t,e,s){return m(m({},s.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[ne,ne];case!1:return[0,0];default:return v.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return v.toVector(t)},transform(t,e,s){const r=t||s.shared.transform;return this.hasCustomTransform=!!r,r||Ot},threshold(t){return v.toVector(t,0)}},Dt=0,j=m(m({},Se),{},{axis(t,e,{axis:s}){if(this.lockDirection=s==="lock",!this.lockDirection)return s},axisThreshold(t=Dt){return t},bounds(t={}){if(typeof t=="function")return o=>j.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:s=1/0,top:r=-1/0,bottom:n=1/0}=t;return[[e,s],[r,n]]}}),oe={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class It extends Ct{constructor(...e){super(...e),x(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const s=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),n={left:s.left-r.left+e.offset[0],right:s.right-r.right+e.offset[0],top:s.top-r.top+e.offset[1],bottom:s.bottom-r.bottom+e.offset[1]};e._bounds=j.bounds(n)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const s=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(s.pointerButtons)?!s.pointerButtons.includes(e.buttons):s.pointerButtons!==-1&&s.pointerButtons!==e.buttons))return;const n=this.ctrl.setEventIds(e);s.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(n&&n.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=F(e),r._pointerActive=!0,this.computeValues(se(e)),this.computeInitial(),s.preventScrollAxis&&xe(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):s.delay>0?(this.setupDelayTrigger(e),s.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const s=this.state;s._active=!0,s._preventScroll=!0,s._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const s=this.state,r=this.config;if(!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;const o=se(e);if(document.pointerLockElement===e.target?s._delta=[e.movementX,e.movementY]:(s._delta=v.sub(o,s._values),this.computeValues(o)),v.addTo(s._movement,s._delta),this.compute(e),s._delayed&&s.intentional){this.timeoutStore.remove("dragDelay"),s.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!s._preventScroll)if(s.axis)if(s.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){s._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const s=this.state,r=this.config;if(!s._active||!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=s._distance;if(s.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,s.tap&&r.filterTaps)s._force=!0;else{const[c,u]=s._delta,[d,a]=s._movement,[f,h]=r.swipe.velocity,[E,y]=r.swipe.distance,S=r.swipe.duration;if(s.elapsedTime<S){const _=Math.abs(c/s.timeDelta),w=Math.abs(u/s.timeDelta);_>f&&Math.abs(d)>E&&(s.swipe[0]=Math.sign(c)),w>h&&Math.abs(a)>y&&(s.swipe[1]=Math.sign(u))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const s=this.config,r=s.device;s.pointerLock&&e.currentTarget.requestPointerLock(),s.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,jt(e);const s=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",s),this.eventStore.add(this.sharedConfig.window,"touch","cancel",s),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const s=oe[e.key];if(s){const r=this.state,n=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=s(this.config.keyboardDisplacement,n),r._keyboardActive=!0,v.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in oe&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const s=this.config.device;e(s,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(s,"change",this.pointerMove.bind(this)),e(s,"end",this.pointerUp.bind(this)),e(s,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function jt(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const P=typeof window<"u"&&window.document&&window.document.createElement;function ke(){return P&&"ontouchstart"in window}function Pt(){return ke()||P&&window.navigator.maxTouchPoints>1}function Lt(){return P&&"onpointerdown"in window}function Nt(){return P&&"exitPointerLock"in window.document}function Mt(){try{return"constructor"in GestureEvent}catch{return!1}}const k={isBrowser:P,gesture:Mt(),touch:ke(),touchscreen:Pt(),pointer:Lt(),pointerLock:Nt()},Rt=250,Bt=180,$t=.5,Kt=50,zt=250,Ut=10,ie={mouse:0,touch:0,pen:8},Ft=m(m({},j),{},{device(t,e,{pointer:{touch:s=!1,lock:r=!1,mouse:n=!1}={}}){return this.pointerLock=r&&k.pointerLock,k.touch&&s?"touch":this.pointerLock?"mouse":k.pointer&&!n?"pointer":k.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Rt:void 0,!(!k.touchscreen||s===!1))return t||(s!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:s=!0,buttons:r=1,keys:n=!0}={}}){return this.pointerButtons=r,this.keys=n,!this.pointerLock&&this.device==="pointer"&&s},threshold(t,e,{filterTaps:s=!1,tapsThreshold:r=3,axis:n=void 0}){const o=v.toVector(t,s?r:n?1:0);return this.filterTaps=s,this.tapsThreshold=r,o},swipe({velocity:t=$t,distance:e=Kt,duration:s=zt}={}){return{velocity:this.transform(v.toVector(t)),distance:this.transform(v.toVector(e)),duration:s}},delay(t=0){switch(t){case!0:return Bt;case!1:return 0;default:return t}},axisThreshold(t){return t?m(m({},ie),t):ie},keyboardDisplacement(t=Ut){return t}});m(m({},Se),{},{device(t,e,{shared:s,pointer:{touch:r=!1}={}}){if(s.target&&!k.touch&&k.gesture)return"gesture";if(k.touch&&r)return"touch";if(k.touchscreen){if(k.pointer)return"pointer";if(k.touch)return"touch"}},bounds(t,e,{scaleBounds:s={},angleBounds:r={}}){const n=i=>{const c=re(B(s,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=re(B(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof s!="function"&&typeof r!="function"?[n(),o()]:i=>[n(i),o(i)]},threshold(t,e,s){return this.lockDirection=s.axis==="lock",v.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});m(m({},j),{},{mouseOnly:(t=!0)=>t});m(m({},j),{},{mouseOnly:(t=!0)=>t});const Te=new Map,G=new Map;function Ae(t){Te.set(t.key,t.engine),G.set(t.key,t.resolver)}const Ce={key:"drag",engine:It,resolver:Ft};function Vt(t,e){if(t==null)return{};var s={},r=Object.keys(t),n,o;for(o=0;o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&(s[n]=t[n]);return s}function Ht(t,e){if(t==null)return{};var s=Vt(t,e),r,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(s[r]=t[r])}return s}const Gt={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=k.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},Wt=["target","eventOptions","window","enabled","transform"];function R(t={},e){const s={};for(const[r,n]of Object.entries(e))switch(typeof n){case"function":s[r]=n.call(s,t[r],r,t);break;case"object":s[r]=R(t[r],n);break;case"boolean":n&&(s[r]=t[r]);break}return s}function Yt(t,e,s={}){const r=t,{target:n,eventOptions:o,window:i,enabled:c,transform:u}=r,d=Ht(r,Wt);if(s.shared=R({target:n,eventOptions:o,window:i,enabled:c,transform:u},Gt),e){const a=G.get(e);s[e]=R(m({shared:s.shared},d),a)}else for(const a in d){const f=G.get(a);f&&(s[a]=R(m({shared:s.shared},d[a]),f))}return s}class Oe{constructor(e,s){x(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=s}add(e,s,r,n,o){const i=this._listeners,c=yt(s,r),u=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},d=m(m({},u),o);e.addEventListener(c,n,d);const a=()=>{e.removeEventListener(c,n,d),i.delete(a)};return i.add(a),a}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Xt{constructor(){x(this,"_timeouts",new Map)}add(e,s,r=140,...n){this.remove(e),this._timeouts.set(e,window.setTimeout(s,r,...n))}remove(e){const s=this._timeouts.get(e);s&&window.clearTimeout(s)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class De{constructor(e){x(this,"gestures",new Set),x(this,"_targetEventStore",new Oe(this)),x(this,"gestureEventStores",{}),x(this,"gestureTimeoutStores",{}),x(this,"handlers",{}),x(this,"config",{}),x(this,"pointerIds",new Set),x(this,"touchIds",new Set),x(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),qt(this,e)}setEventIds(e){if(K(e))return this.touchIds=new Set(_t(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,s){this.handlers=e,this.nativeHandlers=s}applyConfig(e,s){this.config=Yt(e,s,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const s=this.config.shared,r={};let n;if(!(s.target&&(n=s.target(),!n))){if(s.enabled){for(const i of this.gestures){const c=this.config[i],u=ae(r,c.eventOptions,!!n);if(c.enabled){const d=Te.get(i);new d(this,e,i).bind(u)}}const o=ae(r,s.eventOptions,!!n);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](m(m({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=St(...r[o]);if(!n)return r;for(const o in r){const{device:i,capture:c,passive:u}=bt(o);this._targetEventStore.add(n,i,"",r[o],{capture:c,passive:u})}}}}function I(t,e){t.gestures.add(e),t.gestureEventStores[e]=new Oe(t,e),t.gestureTimeoutStores[e]=new Xt}function qt(t,e){e.drag&&I(t,"drag"),e.wheel&&I(t,"wheel"),e.scroll&&I(t,"scroll"),e.move&&I(t,"move"),e.pinch&&I(t,"pinch"),e.hover&&I(t,"hover")}const ae=(t,e,s)=>(r,n,o,i={},c=!1)=>{var u,d;const a=(u=i.capture)!==null&&u!==void 0?u:e.capture,f=(d=i.passive)!==null&&d!==void 0?d:e.passive;let h=c?r:mt(r,n,a);s&&f&&(h+="Passive"),t[h]=t[h]||[],t[h].push(o)};function Qt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zt(t){var e=Qt(t,"string");return typeof e=="symbol"?e:String(e)}function Jt(t,e,s){return e=Zt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ce(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function M(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ce(Object(s),!0).forEach(function(r){Jt(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ce(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}class es{constructor(e,s,r,n,o){this._target=e,this._gestureKey=n,this._ctrl=new De(s),this._ctrl.applyHandlers(s,o),this._ctrl.applyConfig(M(M({},r),{},{target:e}),n),this._ctrl.effect()}destroy(){this._ctrl.clean()}setConfig(e){this._ctrl.clean(),this._ctrl.applyConfig(M(M({},e),{},{target:this._target}),this._gestureKey),this._ctrl.effect()}}const ts=function(e,s,r){return Ae(Ce),new es(e,{drag:s},r||{},"drag")},V=10,Ie={axisThreshold:{mouse:V,touch:V,pen:V},swipe:{distance:60,velocity:.3,duration:600},pointer:{keys:!1,capture:!1}};function ss(t,e={},s,r){const n=z.useMemo(()=>new De(t),[]);if(n.applyHandlers(t,r),n.applyConfig(e,s),z.useEffect(n.effect.bind(n)),z.useEffect(()=>n.clean.bind(n),[]),e.target===void 0)return n.bind.bind(n)}function rs(t,e){return Ae(Ce),ss({drag:t},e||{},"drag")}const W="remit:swipe",ns=b.createContext(!1),os=1.01,je=t=>{const{event:e}=t;if("pointerType"in e&&e.pointerType!=="touch"||e.type!=="pointerup")return null;const s=t.swipe[0];return s<0?"left":s>0?"right":null},Pe=t=>{const e=window.visualViewport;return e?.addEventListener("resize",t),()=>e?.removeEventListener("resize",t)},Le=()=>(window.visualViewport?.scale??1)>os,Tr=({onSwipeLeft:t,onSwipeRight:e})=>{const s=b.useRef(null),r=t!==void 0||e!==void 0,n=b.useSyncExternalStore(Pe,Le,()=>!1),o=c=>{c==="left"&&t?.(),c==="right"&&e?.()},i=rs(c=>o(je(c)),{...Ie,axis:"x",enabled:r&&!n});return b.useEffect(()=>{const c=s.current;if(!c||!r||n)return;const u=d=>{if(!(d instanceof CustomEvent))return;const{detail:a}=d;(a==="left"||a==="right")&&o(a)};return c.addEventListener(W,u),()=>c.removeEventListener(W,u)}),{ref:s,bind:i,touchAction:r&&!n?"pan-y pinch-zoom":"auto",enabled:r}},is='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',$={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},as={background:!1,spacing:!1},cs="16px",ls=()=>`html{padding:0}body{padding:${cs};box-sizing:border-box}`,us=()=>"html{overflow:hidden}body{overflow-x:auto}",ds=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,fs='<meta name="viewport" content="width=device-width, initial-scale=1">',hs=t=>{const e=t?$.dark:$.light;return`
|
|
2
2
|
/* Plain-email base: UI font-stack + theme-aware colors (#424) */
|
|
3
3
|
html, body {
|
|
4
4
|
font-family: ${is};
|
|
@@ -81,4 +81,4 @@ pre, code {
|
|
|
81
81
|
Image blocked
|
|
82
82
|
</text>
|
|
83
83
|
</svg>
|
|
84
|
-
`),zs=t=>t.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Us=t=>t.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Fs=(t={})=>{const e=nt(),s={FORBID_TAGS:Bs,FORBID_ATTR:$s,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return e.addHook("afterSanitizeAttributes",r=>{if(t.allowExternalImages||(r.tagName==="IMG"&&r.removeAttribute("srcset"),r.tagName==="SOURCE"&&(r.removeAttribute("srcset"),r.removeAttribute("src")),r.tagName==="VIDEO"&&r.removeAttribute("poster")),r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const i=n.slice(4).replace(/^<|>$/g,""),c=t.resolveCid?.(i);c&&(r.setAttribute("src",c),r.classList.add("inline-content"));return}t.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",Ks),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",zs(n))}}),e.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=Us(o)}}),r=>{const n=Ts(r),o=Rs(r),i=e.sanitize(r,s);return{html:`<style>${xs()}</style>${i}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},ge=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Ar=({className:t,children:e})=>l.jsx("div",{className:C("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",t),children:e}),Vs=({html:t,text:e,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:i,renderBlockedNotice:c})=>{const u=b.useMemo(()=>!t||typeof document>"u"?null:Fs({allowExternalImages:n,resolveCid:o})(t),[t,n,o]),d=u?.html??null,{framed:a,isPlain:f}=_s(r,u?.hasAuthorBackground??!1),h=b.useMemo(()=>({background:u?.hasAuthorBackground??!1,spacing:u?.hasAuthorSpacing??!1}),[u?.hasAuthorBackground,u?.hasAuthorSpacing]),E=b.useMemo(()=>!d||n?0:(d.match(/data-blocked-src/g)||[]).length,[d,n]);return!d&&!e?l.jsx("div",{className:C("message-body",i),children:l.jsx(ge,{})}):l.jsxs("div",{className:C("message-body",i),children:[E>0&&l.jsx("div",{children:c?.(E)}),d?l.jsx("div",{className:"message-body-frame",children:a?l.jsx("div",{className:"w-full max-w-full",children:l.jsx(he,{html:d,variant:"framed",isDark:s,declares:h})}):l.jsx("div",{className:"max-w-full lg:max-w-2xl",children:l.jsx(he,{html:d,variant:f?"plain":"framed",isDark:s,declares:h})})}):e?l.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:e}):l.jsx(ge,{})]})};function Cr({message:t="Select a thread to read",icon:e,showHints:s=!0,className:r}){return l.jsxs("div",{className:C("flex flex-1 flex-col items-center justify-center text-center",r),children:[e??l.jsx(He,{className:"size-10 text-fg-subtle"}),l.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:t}),s&&l.jsxs("p",{className:"text-2xs text-fg-subtle",children:[l.jsx(U,{children:"j"})," / ",l.jsx(U,{children:"k"})," to move, ",l.jsx(U,{children:"Enter"})," to open"]})]})}function Be(t){const e=[];let s=-1,r=!1;for(let n=0;n<t.length;n++){const o=t[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&e.push({raw:t.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&e.push({raw:t.slice(s),start:s,end:t.length}),e}const Hs=t=>{if(!t.startsWith('"'))return t;const e=t.slice(1);return e.endsWith('"')?e.slice(0,-1):e};function Gs(t){const e=t.indexOf(":");if(e<=0)return;const s=t.slice(e+1);return{name:t.slice(0,e).toLowerCase(),value:Hs(s),rawValue:s}}const Ws=t=>/[\s"]/.test(t),Ys=t=>Ws(t)?`"${t.replace(/"/g,"")}"`:t,Or=(t,e)=>`${t}:${Ys(e)}`;function Dr(){const{mailboxNameIndex:t,accountNameIndex:e}=Ge(),s=rt();return{...st(s)?{}:{mailboxesByName:t},accountsByName:e}}const Xs=Object.values(ye).map(t=>({value:t,label:Q[t]})),qs={unclassified:"uncategorized"},Qs=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:Xs},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],Zs=new Map(Qs.map(t=>[t.name,t])),Ir=t=>Zs.get(t.toLowerCase()),Js=/^\d{4}-\d{2}-\d{2}$/;function er(t,e,s){if(!Js.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:t,raw:e,value:s,epochSeconds:Math.floor(r/1e3)}}function tr(t){const e=t.toLowerCase(),s=qs[e];return s||Object.values(ye).find(n=>n.toLowerCase()===e)}function sr(t,e){switch(e.toLowerCase()){case"unread":return{type:"isUnread",raw:t};case"read":return{type:"isRead",raw:t};case"starred":case"flagged":return{type:"isStarred",raw:t};default:return}}function rr(t,e){const s=Gs(t);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:t,value:n};case"subject":return{type:"subject",raw:t,value:n};case"category":{const o=tr(n);return o?{type:"category",raw:t,value:n,category:o}:void 0}case"is":return sr(t,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:t}:void 0;case"before":case"after":return er(r,t,n);case"in":{const o=e.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:t,value:n,mailboxId:o}:void 0}case"account":{const o=e.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:t,value:n,accountId:o}:void 0}default:return}}function jr(t,e={}){const s=[],r=[];for(const n of Be(t)){const o=rr(n.raw,e);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Pr(t,e){return Be(t).filter(s=>s.raw!==e.raw).map(s=>s.raw).join(" ")}function Lr(t){switch(t.type){case"from":return`From: ${t.value}`;case"subject":return`Subject: ${t.value}`;case"category":return`Category: ${Q[t.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${t.value}`;case"after":return`After ${t.value}`;case"in":return`In: ${t.value}`;case"account":return`Account: ${t.value}`}}const $e=(t,e=Date.now())=>({value:t,setAt:e}),nr=(t,e,s,r)=>{if(t.addressId!==e)return t;const n={...t.flags??{}};return s?n.trusted=$e(!0,r):delete n.trusted,{...t,flags:n}},or=(t,e,s,r)=>{const n=o=>o.map(i=>nr(i,e,s,r));return{...t,envelope:{...t.envelope,from:n(t.envelope.from),to:n(t.envelope.to),cc:n(t.envelope.cc),bcc:n(t.envelope.bcc),replyTo:n(t.envelope.replyTo)}}},ir=({messageId:t})=>{const e=We(),{pushError:s}=Ye(),{mutate:r,isPending:n,error:o,reset:i}=Xe({...Ze(),onMutate:async u=>{const d=u.path.addressId,f=u.body.flags?.trusted?.value===!0,h=Qe({path:{messageId:t}});await e.cancelQueries({queryKey:h});const E=e.getQueriesData({queryKey:h}).filter(y=>y[1]!==void 0).map(([y,S])=>({queryKey:y,data:S}));return e.setQueriesData({queryKey:h},y=>y&&or(y,d,f)),{describePrefix:h,previous:E}},onError:(u,d,a)=>{if(a)for(const f of a.previous)e.setQueryData(f.queryKey,f.data);s(qe("Couldn't trust sender","The change wasn't saved.",u))},onSettled:(u,d,a,f)=>{f&&e.invalidateQueries({queryKey:f.describePrefix})}});return{toggleTrusted:(u,d)=>{r({path:{addressId:u},body:{flags:{trusted:$e(!d)}}})},isPending:n,error:o,reset:i}},ar=()=>{const[t,e]=b.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return b.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{e(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t},cr=(t,e)=>{const s=`${t} image${t>1?"s":""}`;return e?`${s} hidden — you blocked this sender`:`${s} blocked for privacy`},lr=({blockedImageCount:t,canAlwaysTrust:e,isTrustPending:s,isSenderBlocked:r,onLoadOnce:n,onAlwaysTrust:o})=>l.jsxs("div",{"data-testid":"blocked-images-notice",className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[l.jsx("span",{className:"text-fg-muted",children:cr(t,r)}),!r&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:n,className:"text-accent hover:underline",children:"Load once"}),e&&l.jsx("button",{type:"button",onClick:o,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),ur=(t,e)=>{switch(t){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:e}}},dr=t=>t instanceof ot?t.reason:"generic",fr=t=>t instanceof Error?t.message:typeof t=="string"?t:"An unexpected error occurred while loading the message body.",hr=({error:t,onRetry:e})=>{const s=dr(t),r=fr(t),{title:n,detail:o}=ur(s,r),[i,c]=b.useState(!1),{Account:u}=Je();return i?null:l.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[l.jsx(et,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-danger",children:n}),l.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&l.jsx(u,{children:({signOut:d})=>l.jsx("button",{type:"button",onClick:()=>d(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),e&&l.jsx("button",{type:"button",onClick:e,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),l.jsx("button",{type:"button",onClick:()=>c(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:l.jsx(tt,{className:"size-4","aria-hidden":"true"})})]})]})},pr=()=>l.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),be=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Nr=({bodyParts:t,html:e,text:s,isTrusted:r=!1,isBlocked:n=!1,messageId:o,fromAddressId:i,category:c,className:u})=>{const[d,a]=b.useState(!1),[f,h]=b.useState(o);f!==o&&(h(o),a(!1));const E=!n&&(r||d),y=ar(),{toggleTrusted:S,isPending:_}=ir({messageId:o??""}),w=!!t&&t.length>0,{picked:T,data:A,isLoading:D,isError:p,error:g,refetch:O}=it({messageId:o,bodyParts:t,enabled:w}),L=b.useMemo(()=>Es(t??[]),[t]),N=w&&A?.kind==="html"?A.body:e,Ke=w&&A?.kind==="text"?A.body:s;if(w){if(D)return l.jsx("div",{className:C("message-body",u),children:l.jsx(pr,{})});if(p)return l.jsx("div",{className:C("message-body",u),children:l.jsx(hr,{error:g,onRetry:()=>O()})});if(!T)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})})}else if(!e&&!s)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})});const ze=!!(i&&o),Ue=()=>{!i||_||(a(!0),S(i,!1))};return l.jsx(Vs,{className:u,html:N,text:Ke,isDark:y,category:c,allowImages:E,resolveCid:L,renderBlockedNotice:Fe=>l.jsx(lr,{blockedImageCount:Fe,canAlwaysTrust:ze,isTrustPending:_,isSenderBlocked:n,onLoadOnce:()=>a(!0),onAlwaysTrust:Ue})})};export{kr as A,_r as C,Ar as M,Cr as R,Ie as S,rs as a,V as b,Sr as c,Q as d,at as e,Vs as f,xr as g,Tr as h,ns as i,ct as j,ir as k,Nr as l,q as m,Be as n,Gs as o,jr as p,Qs as q,Or as r,Ir as s,Lr as t,Dr as u,Pr as v,Er as w};
|
|
84
|
+
`),zs=t=>t.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Us=t=>t.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Fs=(t={})=>{const e=nt(),s={FORBID_TAGS:Bs,FORBID_ATTR:$s,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return e.addHook("afterSanitizeAttributes",r=>{if(t.allowExternalImages||(r.tagName==="IMG"&&r.removeAttribute("srcset"),r.tagName==="SOURCE"&&(r.removeAttribute("srcset"),r.removeAttribute("src")),r.tagName==="VIDEO"&&r.removeAttribute("poster")),r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const i=n.slice(4).replace(/^<|>$/g,""),c=t.resolveCid?.(i);c&&(r.setAttribute("src",c),r.classList.add("inline-content"));return}t.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",Ks),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",zs(n))}}),e.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=Us(o)}}),r=>{const n=Ts(r),o=Rs(r),i=e.sanitize(r,s);return{html:`<style>${xs()}</style>${i}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},ge=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Ar=({className:t,children:e})=>l.jsx("div",{className:C("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",t),children:e}),Vs=({html:t,text:e,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:i,renderBlockedNotice:c})=>{const u=b.useMemo(()=>!t||typeof document>"u"?null:Fs({allowExternalImages:n,resolveCid:o})(t),[t,n,o]),d=u?.html??null,{framed:a,isPlain:f}=_s(r,u?.hasAuthorBackground??!1),h=b.useMemo(()=>({background:u?.hasAuthorBackground??!1,spacing:u?.hasAuthorSpacing??!1}),[u?.hasAuthorBackground,u?.hasAuthorSpacing]),E=b.useMemo(()=>!d||n?0:(d.match(/data-blocked-src/g)||[]).length,[d,n]);return!d&&!e?l.jsx("div",{className:C("message-body",i),children:l.jsx(ge,{})}):l.jsxs("div",{className:C("message-body",i),children:[E>0&&l.jsx("div",{children:c?.(E)}),d?l.jsx("div",{className:"message-body-frame",children:a?l.jsx("div",{className:"w-full max-w-full",children:l.jsx(he,{html:d,variant:"framed",isDark:s,declares:h})}):l.jsx("div",{className:"max-w-full lg:max-w-2xl",children:l.jsx(he,{html:d,variant:f?"plain":"framed",isDark:s,declares:h})})}):e?l.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:e}):l.jsx(ge,{})]})};function Cr({message:t="Select a thread to read",icon:e,showHints:s=!0,className:r}){return l.jsxs("div",{className:C("flex flex-1 flex-col items-center justify-center text-center",r),children:[e??l.jsx(He,{className:"size-10 text-fg-subtle"}),l.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:t}),s&&l.jsxs("p",{className:"text-2xs text-fg-subtle",children:[l.jsx(U,{children:"j"})," / ",l.jsx(U,{children:"k"})," to move, ",l.jsx(U,{children:"Enter"})," to open"]})]})}function Be(t){const e=[];let s=-1,r=!1;for(let n=0;n<t.length;n++){const o=t[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&e.push({raw:t.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&e.push({raw:t.slice(s),start:s,end:t.length}),e}const Hs=t=>{if(!t.startsWith('"'))return t;const e=t.slice(1);return e.endsWith('"')?e.slice(0,-1):e};function Gs(t){const e=t.indexOf(":");if(e<=0)return;const s=t.slice(e+1);return{name:t.slice(0,e).toLowerCase(),value:Hs(s),rawValue:s}}const Ws=t=>/[\s"]/.test(t),Ys=t=>Ws(t)?`"${t.replace(/"/g,"")}"`:t,Or=(t,e)=>`${t}:${Ys(e)}`;function Dr(){const{mailboxNameIndex:t,accountNameIndex:e}=Ge(),s=rt();return{...st(s)?{}:{mailboxesByName:t},accountsByName:e}}const Xs=Object.values(ye).map(t=>({value:t,label:Q[t]})),qs={unclassified:"uncategorized"},Qs=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:Xs},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],Zs=new Map(Qs.map(t=>[t.name,t])),Ir=t=>Zs.get(t.toLowerCase()),Js=/^\d{4}-\d{2}-\d{2}$/;function er(t,e,s){if(!Js.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:t,raw:e,value:s,epochSeconds:Math.floor(r/1e3)}}function tr(t){const e=t.toLowerCase(),s=qs[e];return s||Object.values(ye).find(n=>n.toLowerCase()===e)}function sr(t,e){switch(e.toLowerCase()){case"unread":return{type:"isUnread",raw:t};case"read":return{type:"isRead",raw:t};case"starred":case"flagged":return{type:"isStarred",raw:t};default:return}}function rr(t,e){const s=Gs(t);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:t,value:n};case"subject":return{type:"subject",raw:t,value:n};case"category":{const o=tr(n);return o?{type:"category",raw:t,value:n,category:o}:void 0}case"is":return sr(t,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:t}:void 0;case"before":case"after":return er(r,t,n);case"in":{const o=e.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:t,value:n,mailboxId:o}:void 0}case"account":{const o=e.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:t,value:n,accountId:o}:void 0}default:return}}function jr(t,e={}){const s=[],r=[];for(const n of Be(t)){const o=rr(n.raw,e);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Pr(t,e){return Be(t).filter(s=>s.raw!==e.raw).map(s=>s.raw).join(" ")}function Lr(t){switch(t.type){case"from":return`From: ${t.value}`;case"subject":return`Subject: ${t.value}`;case"category":return`Category: ${Q[t.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${t.value}`;case"after":return`After ${t.value}`;case"in":return`In: ${t.value}`;case"account":return`Account: ${t.value}`}}const $e=(t,e=Date.now())=>({value:t,setAt:e}),nr=(t,e,s,r)=>{if(t.addressId!==e)return t;const n={...t.flags??{}};return s?n.trusted=$e(!0,r):delete n.trusted,{...t,flags:n}},or=(t,e,s,r)=>{const n=o=>o.map(i=>nr(i,e,s,r));return{...t,envelope:{...t.envelope,from:n(t.envelope.from),to:n(t.envelope.to),cc:n(t.envelope.cc),bcc:n(t.envelope.bcc),replyTo:n(t.envelope.replyTo)}}},ir=({messageId:t})=>{const e=We(),{pushError:s}=Ye(),{mutate:r,isPending:n,error:o,reset:i}=Xe({...Ze(),onMutate:async u=>{const d=u.path.addressId,f=u.body.flags?.trusted?.value===!0,h=Qe({path:{messageId:t}});await e.cancelQueries({queryKey:h});const E=e.getQueriesData({queryKey:h}).filter(y=>y[1]!==void 0).map(([y,S])=>({queryKey:y,data:S}));return e.setQueriesData({queryKey:h},y=>y&&or(y,d,f)),{describePrefix:h,previous:E}},onError:(u,d,a)=>{if(a)for(const f of a.previous)e.setQueryData(f.queryKey,f.data);s(qe("Couldn't trust sender","The change wasn't saved.",u))},onSettled:(u,d,a,f)=>{f&&e.invalidateQueries({queryKey:f.describePrefix})}});return{toggleTrusted:(u,d)=>{r({path:{addressId:u},body:{flags:{trusted:$e(!d)}}})},isPending:n,error:o,reset:i}},ar=()=>{const[t,e]=b.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return b.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{e(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t},cr=(t,e)=>{const s=`${t} image${t>1?"s":""}`;return e?`${s} hidden — you blocked this sender`:`${s} blocked for privacy`},lr=({blockedImageCount:t,canAlwaysTrust:e,isTrustPending:s,isSenderBlocked:r,onLoadOnce:n,onAlwaysTrust:o})=>l.jsxs("div",{"data-testid":"blocked-images-notice",className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[l.jsx("span",{className:"text-fg-muted",children:cr(t,r)}),!r&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:n,className:"text-accent hover:underline",children:"Load once"}),e&&l.jsx("button",{type:"button",onClick:o,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),ur=(t,e)=>{switch(t){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:e}}},dr=t=>t instanceof ot?t.reason:"generic",fr=t=>t instanceof Error?t.message:typeof t=="string"?t:"An unexpected error occurred while loading the message body.",hr=({error:t,onRetry:e})=>{const s=dr(t),r=fr(t),{title:n,detail:o}=ur(s,r),[i,c]=b.useState(!1),{Account:u}=Je();return i?null:l.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[l.jsx(et,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-danger",children:n}),l.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&l.jsx(u,{children:({signOut:d})=>l.jsx("button",{type:"button",onClick:()=>d(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),e&&l.jsx("button",{type:"button",onClick:e,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),l.jsx("button",{type:"button",onClick:()=>c(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:l.jsx(tt,{className:"size-4","aria-hidden":"true"})})]})]})},pr=()=>l.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),be=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Nr=({bodyParts:t,html:e,text:s,isTrusted:r=!1,isBlocked:n=!1,messageId:o,fromAddressId:i,category:c,className:u})=>{const[d,a]=b.useState(!1),[f,h]=b.useState(o);f!==o&&(h(o),a(!1));const E=!n&&(r||d),y=ar(),{toggleTrusted:S,isPending:_}=ir({messageId:o??""}),w=!!t&&t.length>0,{picked:T,data:A,isLoading:D,isError:p,error:g,refetch:O}=it({messageId:o,bodyParts:t,enabled:w}),L=b.useMemo(()=>Es(t??[]),[t]),N=w&&A?.kind==="html"?A.body:e,Ke=w&&A?.kind==="text"?A.body:s;if(w){if(D)return l.jsx("div",{className:C("message-body",u),children:l.jsx(pr,{})});if(p)return l.jsx("div",{className:C("message-body",u),children:l.jsx(hr,{error:g,onRetry:()=>O()})});if(!T)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})})}else if(!e&&!s)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})});const ze=!!(i&&o),Ue=()=>{!i||_||(a(!0),S(i,!1))};return l.jsx(Vs,{className:u,html:N,text:Ke,isDark:y,category:c,allowImages:E,resolveCid:L,renderBlockedNotice:Fe=>l.jsx(lr,{blockedImageCount:Fe,canAlwaysTrust:ze,isTrustPending:_,isSenderBlocked:n,onLoadOnce:()=>a(!0),onAlwaysTrust:Ue})})};export{kr as A,_r as C,Ar as M,Cr as R,ns as S,Q as a,at as b,Sr as c,rs as d,Vs as e,Tr as f,xr as g,ir as h,ct as i,Nr as j,q as k,Be as l,Gs as m,Qs as n,Or as o,jr as p,Lr as q,Pr as r,Ir as s,Ie as t,Dr as u,V as v,Er as w};
|