@remit/web-client-dist 0.0.694 → 0.0.695
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 +1 -0
- package/assets/{CalendarEventEditor-nNdTRvrP.js → CalendarEventEditor-MMNLFvjJ.js} +1 -1
- package/assets/{CalendarEventPopup-CK0ThqUH.js → CalendarEventPopup-DVJ9DC_Y.js} +1 -1
- package/assets/{CalendarLoadFailed-DqZc18ET.js → CalendarLoadFailed-uHGxFBGx.js} +1 -1
- package/assets/{CalendarQuickCreate-DvzkHIO9.js → CalendarQuickCreate-CzJ4lehP.js} +1 -1
- package/assets/{CalendarSession-D_c9Y6UZ.js → CalendarSession-BVuy8A2H.js} +1 -1
- package/assets/{CollectionPane-Ud4h-8ub.js → CollectionPane-RUuB6sFo.js} +1 -1
- package/assets/{DesktopChrome-DHYyHOV_.js → DesktopChrome-Ct-IB4ks.js} +1 -1
- package/assets/{DropdownMenu-BPnbuxSi.js → DropdownMenu-CTCHgh4X.js} +1 -1
- package/assets/{EmptyState-B6TJewxS.js → EmptyState-CN-AyHj-.js} +1 -1
- package/assets/{ErrorState-B5x7OO3P.js → ErrorState-Bk3DwNvd.js} +1 -1
- package/assets/{FullCompose-By2bNMiB.js → FullCompose-BWiLy3Vm.js} +1 -1
- package/assets/LabelApplyTrigger-52QGuTLD.js +1 -0
- package/assets/{MailShell-BAZsxo3-.js → MailShell-DAqGpnce.js} +1 -1
- package/assets/{MailViewChrome-CeNEd8rP.js → MailViewChrome-BDymWKX9.js} +1 -1
- package/assets/{MailboxPane-pHPHm1KP.js → MailboxPane-DUI-sxQF.js} +2 -2
- package/assets/{MessageBody-BHkIMp4s.js → MessageBody-BeciCqb_.js} +4 -4
- package/assets/MessageToolbar-BYhqv9RG.js +1 -0
- package/assets/{NavMenuButton-Dha0SvsJ.js → NavMenuButton-A6v6v8tE.js} +1 -1
- package/assets/{OnboardingWizard-DqRtmDGR.js → OnboardingWizard-CIneAccs.js} +1 -1
- package/assets/OutboxPane-InUnHiNC.js +1 -0
- package/assets/{ReportLink-T3skoNQg.js → ReportLink-q8WFRQli.js} +1 -1
- package/assets/_calendarObjectId-B3IHxxnZ.js +1 -0
- package/assets/_labelId-BX1_9FW3.js +1 -0
- package/assets/_mailboxId-BKCf6hRR.js +1 -0
- package/assets/_messageId-DGc5xyqH.js +1 -0
- package/assets/_messageId-ODP9L5rG.js +1 -0
- package/assets/_messageId-_9l1GYCG.js +1 -0
- package/assets/_messageId-t0gwqxwG.js +1 -0
- package/assets/_outboxMessageId-DGFiVWCU.js +1 -0
- package/assets/_recurrenceId-yqFEhvsn.js +1 -0
- package/assets/_slotId-Cf-NASLE.js +1 -0
- package/assets/_threadId-Bvd5G-pJ.js +1 -0
- package/assets/_threadId-BwJQjORR.js +1 -0
- package/assets/_threadId-CFLbzDUi.js +1 -0
- package/assets/_threadId-Dj29QtLs.js +1 -0
- package/assets/{_view._date-hcmgBm1_.js → _view._date-dARprXsM.js} +1 -1
- package/assets/{account-service-status-DIZp2CJy.js → account-service-status-DexPoUiT.js} +1 -1
- package/assets/{accounts-C97z1Pd0.js → accounts-DPvTdrTr.js} +1 -1
- package/assets/{advanced--29ZYfrn.js → advanced-CDr_JOXg.js} +1 -1
- package/assets/{agenda-time-bZcjQKSG.js → agenda-time-BcOiQ5_R.js} +1 -1
- package/assets/{app-chrome-UVvRNKwI.js → app-chrome-6ZXmy5H4.js} +1 -1
- package/assets/{appearance-ZXFz5lao.js → appearance-BQZnBlkc.js} +1 -1
- package/assets/{avatar-D3At1Qul.js → avatar-B_QEsxCw.js} +1 -1
- package/assets/{badge-dj8dD-AR.js → badge-CeCxCmzS.js} +1 -1
- package/assets/{bottom-sheet-CV9rObvl.js → bottom-sheet-DWqGf7I3.js} +1 -1
- package/assets/{brief-2yNYS3wf.js → brief-B7EfkUB4.js} +1 -1
- package/assets/brief-NsiukvBp.js +1 -0
- package/assets/{calendar-Cx77i_wv.js → calendar-CJGXdypt.js} +1 -1
- package/assets/{calendar-CCfPHKaQ.js → calendar-DxjT7IrR.js} +1 -1
- package/assets/{calendar-event-popup-knBxRz2d.js → calendar-event-popup-y4Z860B0.js} +1 -1
- package/assets/{calendar-event-sidebar-3BKQojrV.js → calendar-event-sidebar-BaAGgT2x.js} +1 -1
- package/assets/{calendar-failure-note-BUiZ-O7a.js → calendar-failure-note-CJvPzX2o.js} +1 -1
- package/assets/{calendar-guests-aFcN8ViV.js → calendar-guests-DeRthr7k.js} +1 -1
- package/assets/{calendar-suggestion-Cm4KjSk-.js → calendar-suggestion-BulekNHV.js} +1 -1
- package/assets/{calendars-BFDTOhwb.js → calendars-D-Use38B.js} +1 -1
- package/assets/{card-DLgsoLfF.js → card-0Dzt3Scs.js} +1 -1
- package/assets/{checkbox-DmpjHqx5.js → checkbox-DIKh2-eX.js} +1 -1
- package/assets/{chevron-down-B0Bkzz-J.js → chevron-down-BnC2m4J6.js} +1 -1
- package/assets/{chevron-left-CXtArtIm.js → chevron-left-CNQ3caMn.js} +1 -1
- package/assets/{circle-check-luU3Az-0.js → circle-check-CTlM3FQo.js} +1 -1
- package/assets/{circle-check-big-CI7pNoKP.js → circle-check-big-DCVJA_H0.js} +1 -1
- package/assets/{circle-question-mark-DS_MwyOq.js → circle-question-mark-CpApZe3H.js} +1 -1
- package/assets/{classification-M7vyyYc0.js → classification-C7_2tIfb.js} +1 -1
- package/assets/{clock-CXNiym3R.js → clock-CTlZVcLb.js} +1 -1
- package/assets/{cloud-off-DEFh0ByK.js → cloud-off-CtJJ9OTh.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BT2RKEAF.js +1 -0
- package/assets/compose._-_outboxMessageId_-B_NGqkpg.js +1 -0
- package/assets/compose._-_outboxMessageId_-CCPr3GjM.js +1 -0
- package/assets/compose._-_outboxMessageId_-CFBNHbeY.js +1 -0
- package/assets/compose._-_outboxMessageId_-Cw-Zq1kx.js +1 -0
- package/assets/{config-import-DYrX4xYR.js → config-import-CHZ9oJuF.js} +1 -1
- package/assets/{confirm-dialog-CeB0RrSC.js → confirm-dialog-Cc446-7C.js} +1 -1
- package/assets/{copy-BVh-dc4N.js → copy-jXKvwaUz.js} +1 -1
- package/assets/{credential-steps-ihHk8G-d.js → credential-steps-yT5IXLY8.js} +1 -1
- package/assets/{download-Im4qAd93.js → download-CyhaY4zL.js} +1 -1
- package/assets/{draft-gA8ktwkL.js → draft-C1ufEqDz.js} +1 -1
- package/assets/edit-BGhTeEac.js +1 -0
- package/assets/edit-CeXJ3wiI.js +1 -0
- package/assets/{external-link-BPfutwMA.js → external-link-1TiTglgB.js} +1 -1
- package/assets/{file-braces-DImhKXQB.js → file-braces-CXZUVCry.js} +1 -1
- package/assets/{filters-BixikXOX.js → filters-CR0iG1ow.js} +1 -1
- package/assets/flagged-B4N5fCui.js +1 -0
- package/assets/{flagged-DlXuJV7_.js → flagged-DuEE_WUV.js} +1 -1
- package/assets/{folder-input-BBQLR_tO.js → folder-input-kcvJkrLj.js} +1 -1
- package/assets/{folders-tN5ItNP7.js → folders-6mmHeM8E.js} +1 -1
- package/assets/{help-copy-CHQ_TpI3.js → help-copy-CIhcXCo3.js} +1 -1
- package/assets/{import-BRAmXjIS.js → import-76KXkdMq.js} +1 -1
- package/assets/index-5PtybTMj.js +1 -0
- package/assets/index-B-gNDz7v.js +1 -0
- package/assets/index-B1AltYi_.js +1 -0
- package/assets/index-BX5kv92z.js +1 -0
- package/assets/index-CzMYehsR.js +1 -0
- package/assets/index-DT4iQTvg.js +1 -0
- package/assets/index-DZ4zN_a2.js +1 -0
- package/assets/index-Xq-TD3Lr.js +1 -0
- package/assets/index-eKzwYumy.js +1 -0
- package/assets/index-ehMMhnu5.js +1 -0
- package/assets/{index-DHBczCNW.js → index-iXcp-mGT.js} +8 -8
- package/assets/index-rui9BQ_f.js +1 -0
- package/assets/index-t0gwqxwG.js +1 -0
- package/assets/{index-DR_5o1cC.js → index-yeSesYv-.js} +43 -43
- package/assets/{kbd-B0NHhH5P.js → kbd-BVK8yKhS.js} +1 -1
- package/assets/{label-chip-DSBEe7ry.js → label-chip-CrQMhpJe.js} +1 -1
- package/assets/{labels-BHUDM5JS.js → labels-CaXUAL8B.js} +1 -1
- package/assets/{mail-aEfuaSCr.js → mail-CLkdzm71.js} +1 -1
- package/assets/mail-CiuTTyMm.js +1 -0
- package/assets/{menu-CnR5z5hQ.js → menu-Cn2tY52U.js} +1 -1
- package/assets/{nav-link-UUbkPPMg.js → nav-link-BvlYCbp-.js} +1 -1
- package/assets/new-ZEuIlDnl.js +1 -0
- package/assets/onboarding-bCsMaIPY.js +1 -0
- package/assets/{onboarding-completion-yyY7ooIW.js → onboarding-completion-CJl9zKMA.js} +1 -1
- package/assets/outbox-BthyAXQ5.js +1 -0
- package/assets/{pencil-B7A6MPOt.js → pencil-A679n1yJ.js} +1 -1
- package/assets/{people-lwS7SzAR.js → people-C5ni4bV_.js} +1 -1
- package/assets/{plus-D_zwaNNt.js → plus-D9A6i0pi.js} +1 -1
- package/assets/{popover-menu-Cwo1QYau.js → popover-menu-wrc2e8Vk.js} +1 -1
- package/assets/{refresh-cw-Ct8GI0Vj.js → refresh-cw-BRmmCn_2.js} +1 -1
- package/assets/{reply-CKR0JbDH.js → reply-DL5kkaJs.js} +1 -1
- package/assets/{rich-text-DoqySYOC.js → rich-text-EZFEOU8t.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-CRq84w6_.js → rich-text-spellcheck-worker-provider-NOmoFs4G.js} +1 -1
- package/assets/{rotate-ccw-DLTgUk3r.js → rotate-ccw-C2NtRHS-.js} +1 -1
- package/assets/{roving-focus-DZDqBfb5.js → roving-focus-CSq3MPWi.js} +1 -1
- package/assets/{row-actions-B2wFen9R.js → row-actions-Cthc4RCY.js} +1 -1
- package/assets/{search-mirror-DpnpCDcj.js → search-mirror-CCAs_ZWe.js} +1 -1
- package/assets/{search-scope-T2j_EsV0.js → search-scope-DaiXqXNv.js} +1 -1
- package/assets/{search-token-index-BP7yKtG_.js → search-token-index-VBBiMTaA.js} +1 -1
- package/assets/{sections-6h7DKCxQ.js → sections-uFHlOXiA.js} +1 -1
- package/assets/{segmented-control-1R4LBvE6.js → segmented-control-DNxc5Ghi.js} +1 -1
- package/assets/{select-CzHV_FFG.js → select-B9t8348S.js} +1 -1
- package/assets/{senders-BPxxJ0j1.js → senders-uBzIqu95.js} +1 -1
- package/assets/settings-BLs90wKU.js +1 -0
- package/assets/{settings-screen-Bbjg-6l6.js → settings-screen-CafoSGzb.js} +1 -1
- package/assets/{shield-check-C2UgIrHV.js → shield-check-BdZGtm0z.js} +1 -1
- package/assets/{spam-ZsXuaYs-.js → spam-DKjh33Xi.js} +1 -1
- package/assets/{suggest-list-B6cD40Oq.js → suggest-list-Do7i1-gb.js} +1 -1
- package/assets/{suggested-vips-CSjON5_8.js → suggested-vips-C-je5foZ.js} +1 -1
- package/assets/{suggestion._suggestionId-DuDQGf01.js → suggestion._suggestionId-DF2BM_zX.js} +1 -1
- package/assets/{switch-RGS_qoTB.js → switch-1RDXcNo-.js} +1 -1
- package/assets/{task._calendarTaskId-Ckwunqac.js → task._calendarTaskId-B7k5whQt.js} +1 -1
- package/assets/{undo-2-Bnztakne.js → undo-2-B-b8_FeJ.js} +1 -1
- package/assets/{useCalendarData-CVSSTX7q.js → useCalendarData-BcNSn1yP.js} +1 -1
- package/assets/{useCalendarScheduling-A8jy-RIu.js → useCalendarScheduling-Dfk1b293.js} +1 -1
- package/assets/{useCalendarSuggestions-BUA2-2mf.js → useCalendarSuggestions-D_tk6nh4.js} +1 -1
- package/assets/{useCalendarTasks-DSxaVdL9.js → useCalendarTasks-CX2Wh1Fn.js} +1 -1
- package/assets/{useClassificationSettings-ChYo6qTF.js → useClassificationSettings-Bi0m63-O.js} +1 -1
- package/assets/{useDebouncedValue-KKz10SXI.js → useDebouncedValue-AWe2Zncy.js} +1 -1
- package/assets/{useFilters-DhxRBswc.js → useFilters-Bp1QgyWU.js} +1 -1
- package/assets/{useJunkMailboxIds-B_SqvUpu.js → useJunkMailboxIds-CWScvBHw.js} +1 -1
- package/assets/useLabels-CGE9kc74.js +1 -0
- package/assets/{useLayoutTier-DinVKpNb.js → useLayoutTier-D5MoTNho.js} +1 -1
- package/assets/{useMediaQuery-BRSRIX06.js → useMediaQuery-Bf7zukl9.js} +1 -1
- package/assets/{useMessageBodyContent-B8gK2Lo3.js → useMessageBodyContent-BxjoKGiE.js} +1 -1
- package/assets/{useQueries-Dp5PLsrF.js → useQueries-Dj93detX.js} +1 -1
- package/assets/{useRefreshControl-CAy6K6Em.js → useRefreshControl-DCFTdDZz.js} +1 -1
- package/assets/{useResultFolderIndex-JpPkIntb.js → useResultFolderIndex-DAcbTt0T.js} +1 -1
- package/assets/useSignature-CA8ypw7f.js +1 -0
- package/assets/{warnings-BaDRsN2r.js → warnings-C-blkf-m.js} +3 -3
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/BriefPane-DfgrMpfo.js +0 -1
- package/assets/LabelApplyTrigger-Bxs6cDOn.js +0 -1
- package/assets/MessageToolbar-CMdOlqF2.js +0 -1
- package/assets/OutboxPane-CWhLXXM2.js +0 -1
- package/assets/_calendarObjectId-D-xdcBhY.js +0 -1
- package/assets/_labelId-Cl0mm0aS.js +0 -1
- package/assets/_mailboxId-DXY2xie_.js +0 -1
- package/assets/_messageId-1xfg9JRz.js +0 -1
- package/assets/_messageId-C7RYu8D4.js +0 -1
- package/assets/_messageId-CpLDLwG4.js +0 -1
- package/assets/_messageId-DM4J2nkn.js +0 -1
- package/assets/_outboxMessageId-DbphUtGt.js +0 -1
- package/assets/_recurrenceId-B_wIJyrZ.js +0 -1
- package/assets/_slotId-DSoyw2sm.js +0 -1
- package/assets/_threadId-CWcvebi1.js +0 -1
- package/assets/_threadId-D1KeSzSU.js +0 -1
- package/assets/_threadId-DhAQNmCG.js +0 -1
- package/assets/_threadId-rafiyWr7.js +0 -1
- package/assets/brief-TvSyJ0Hh.js +0 -1
- package/assets/compose._-_outboxMessageId_-C4UqzqsB.js +0 -1
- package/assets/compose._-_outboxMessageId_-CSUyyPsf.js +0 -1
- package/assets/compose._-_outboxMessageId_-CUUUaKzp.js +0 -1
- package/assets/compose._-_outboxMessageId_-D3ZrtXb-.js +0 -1
- package/assets/compose._-_outboxMessageId_-txkeSl3z.js +0 -1
- package/assets/edit-AeV5d7Q9.js +0 -1
- package/assets/edit-C9IrXIRT.js +0 -1
- package/assets/flagged-UlACOt4x.js +0 -1
- package/assets/index-0F6D1QL4.js +0 -1
- package/assets/index-BNnZBbIV.js +0 -1
- package/assets/index-BeKthChA.js +0 -1
- package/assets/index-BhPUwC8f.js +0 -1
- package/assets/index-CUf1A0fN.js +0 -1
- package/assets/index-CbjCUjyM.js +0 -1
- package/assets/index-Chdoahsq.js +0 -1
- package/assets/index-CisM5xYX.js +0 -1
- package/assets/index-CpLDLwG4.js +0 -1
- package/assets/index-D-qIc_Ph.js +0 -1
- package/assets/index-DFaozp7e.js +0 -1
- package/assets/index-UJSPAbyu.js +0 -1
- package/assets/mail-D2zTFQj4.js +0 -1
- package/assets/new-UOrJpTbz.js +0 -1
- package/assets/onboarding-CE1GqVAK.js +0 -1
- package/assets/outbox-BjrTttbX.js +0 -1
- package/assets/settings-CxT_7aK9.js +0 -1
- package/assets/useLabels-CIb1kkc9.js +0 -1
- package/assets/useSignature-C-S_OGgq.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as Ve,ag as z,r as b,j as l,p as C,I as He,J as Ge,el as ye,e as We,ak as Ye,f as Xe,al as Qe,cQ as qe,bQ as Ze,a7 as Je,v as et,X as tt}from"./index-DR_5o1cC.js";import{K as U}from"./kbd-B0NHhH5P.js";import{i as st}from"./search-scope-T2j_EsV0.js";import"./nav-link-UUbkPPMg.js";import{d as rt}from"./reply-CKR0JbDH.js";import{p as nt,B as ot,b as it}from"./useMessageBodyContent-B8gK2Lo3.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 kr=[{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 Sr=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 kt(...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 St=32;class At{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[k,_]=s.offset,[[w,A],[T,D]]=s._bounds;s.overflow=[k<w?-1:k>A?1:0,_<T?-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>St)){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 Tt([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 At{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=Tt(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,ke={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({},ke),{},{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,k=r.swipe.duration;if(s.elapsedTime<k){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 Se(){return P&&"ontouchstart"in window}function Pt(){return Se()||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 S={isBrowser:P,gesture:Mt(),touch:Se(),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&&S.pointerLock,S.touch&&s?"touch":this.pointerLock?"mouse":S.pointer&&!n?"pointer":S.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Rt:void 0,!(!S.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({},ke),{},{device(t,e,{shared:s,pointer:{touch:r=!1}={}}){if(s.target&&!S.touch&&S.gesture)return"gesture";if(S.touch&&r)return"touch";if(S.touchscreen){if(S.pointer)return"pointer";if(S.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 Ae=new Map,G=new Map;function Te(t){Ae.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=S.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=Ae.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]=kt(...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 Te(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 Te(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,Ar=({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,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`
|
|
2
2
|
/* Plain-email base: UI font-stack + theme-aware colors (#424) */
|
|
3
3
|
html, body {
|
|
4
4
|
font-family: ${is};
|
|
@@ -19,7 +19,7 @@ a, a:visited {
|
|
|
19
19
|
color: ${e.accent} !important;
|
|
20
20
|
text-decoration: underline;
|
|
21
21
|
}
|
|
22
|
-
`},Y="invert(0.92) hue-rotate(180deg)",le=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${Y}}`,ps=(t,e,s)=>{const r=t?$.dark.canvas:$.light.canvas;return s?t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${Y}}body{margin:0}${le}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${Y}}${le}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},ms=(t,e,s,r=as)=>{const n=e==="plain"?hs(s):ps(s,ds.test(t),r.background),o=r.spacing?"":ls();return`${fs}<style>${n}</style>${t}<style>${us()}${o}</style>`},ue=5e4,gs="allow-same-origin allow-popups allow-popups-to-escape-sandbox",de=(t,e,s)=>Math.min(Math.ceil(Math.max(t,e)),s),X=.5,fe=(t,e)=>e>0&&t>e+1?Math.max(e/t,X):1,bs=["box-sizing","width","max-width","transform","transform-origin","margin-bottom","overflow-x"],ys=t=>{for(const i of bs)t.style.removeProperty(i);const e=t.clientWidth,s=t.scrollWidth;if(fe(s,e)===1)return 1;const r=(i,c)=>t.style.setProperty(i,c,"important");r("box-sizing","border-box"),r("max-width","none"),r("width",`${s}px`);const n=Math.max(s,t.scrollWidth),o=fe(n,e);return o>X?r("overflow-x","visible"):r("width",`${e/X}px`),r("transform-origin","0 0"),r("transform",`scale(${o})`),r("margin-bottom",`${-t.offsetHeight*(1-o)}px`),o},vs=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),ws=t=>t===" "?!1:t.length===1?!0:vs.has(t),H=t=>{if(t.metaKey||t.ctrlKey||t.altKey||!ws(t.key))return;const e=t.currentTarget??t.target,s=e?.defaultView?.parent;!s||s===e?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:t.key,code:t.code,shiftKey:t.shiftKey,bubbles:!0,cancelable:!0}))},he=({html:t,variant:e="framed",isDark:s=!1,declares:r,className:n})=>{const o=b.useRef(null),[i,c]=b.useState(0),u=b.useContext(ns),d=b.useMemo(()=>ms(t,e,s,r),[t,e,s,r]);return b.useEffect(()=>{const a=o.current;if(!a)return;const f=()=>{const p=a.contentDocument;if(!p?.body)return;
|
|
22
|
+
`},Y="invert(0.92) hue-rotate(180deg)",le=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${Y}}`,ps=(t,e,s)=>{const r=t?$.dark.canvas:$.light.canvas;return s?t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${Y}}body{margin:0}${le}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${Y}}${le}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},ms=(t,e,s,r=as)=>{const n=e==="plain"?hs(s):ps(s,ds.test(t),r.background),o=r.spacing?"":ls();return`${fs}<style>${n}</style>${t}<style>${us()}${o}</style>`},ue=5e4,gs="allow-same-origin allow-popups allow-popups-to-escape-sandbox",de=(t,e,s)=>Math.min(Math.ceil(Math.max(t,e)),s),X=.5,fe=(t,e)=>e>0&&t>e+1?Math.max(e/t,X):1,bs=["box-sizing","width","max-width","transform","transform-origin","margin-bottom","overflow-x"],ys=t=>{for(const i of bs)t.style.removeProperty(i);const e=t.clientWidth,s=t.scrollWidth;if(fe(s,e)===1)return 1;const r=(i,c)=>t.style.setProperty(i,c,"important");r("box-sizing","border-box"),r("max-width","none"),r("width",`${s}px`);const n=Math.max(s,t.scrollWidth),o=fe(n,e);return o>X?r("overflow-x","visible"):r("width",`${e/X}px`),r("transform-origin","0 0"),r("transform",`scale(${o})`),r("margin-bottom",`${-t.offsetHeight*(1-o)}px`),o},vs=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),ws=t=>t===" "?!1:t.length===1?!0:vs.has(t),H=t=>{if(t.metaKey||t.ctrlKey||t.altKey||!ws(t.key))return;const e=t.currentTarget??t.target,s=e?.defaultView?.parent;!s||s===e?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:t.key,code:t.code,shiftKey:t.shiftKey,bubbles:!0,cancelable:!0}))},he=({html:t,variant:e="framed",isDark:s=!1,declares:r,className:n})=>{const o=b.useRef(null),[i,c]=b.useState(0),u=b.useContext(ns),d=b.useMemo(()=>ms(t,e,s,r),[t,e,s,r]);return b.useEffect(()=>{const a=o.current;if(!a)return;const f=()=>{const p=a.contentDocument;if(!p?.body)return;S();const g=p.documentElement,L=ys(p.body)<1?de(p.body.getBoundingClientRect().height,0,ue):de(p.body.scrollHeight,g?.scrollHeight??0,ue);c(N=>N===L?N:L)};let h=0;const E=()=>{cancelAnimationFrame(h),h=requestAnimationFrame(f)},y=p=>{const g=p.documentElement;return Le()||g.scrollWidth>g.clientWidth+1},S=()=>{const p=a.contentDocument;if(!u||!p?.body)return;const g=y(p)?"auto":"pan-y pinch-zoom";p.documentElement.style.touchAction=g,p.body.style.touchAction=g};let _,w,T;const A=u?Pe(S):void 0,D=()=>{f(),_?.disconnect(),_=void 0,w?.removeEventListener("keydown",H),w?.removeEventListener("load",f,!0),w=void 0,T?.destroy(),T=void 0;const p=a.contentDocument;p?.body&&(S(),u&&(T=new ts(p.documentElement,g=>{const O=je(g);O&&a.dispatchEvent(new CustomEvent(W,{bubbles:!0,detail:O}))},{...Ie,axis:"x",window:p.defaultView??void 0})),_=new ResizeObserver(E),_.observe(p.body),p.documentElement&&_.observe(p.documentElement),p.addEventListener("load",f,!0),p.fonts?.ready.then(f),p.addEventListener("keydown",H),w=p)};return a.addEventListener("load",D),()=>{a.removeEventListener("load",D),w?.removeEventListener("keydown",H),w?.removeEventListener("load",f,!0),_?.disconnect(),T?.destroy(),A?.(),cancelAnimationFrame(h)}},[u]),l.jsx("iframe",{ref:o,title:"Email content",sandbox:gs,srcDoc:d,className:n,style:{width:"100%",border:"none",display:"block",height:i===0?"1px":`${i}px`,colorScheme:"normal"}})},_s=(t,e)=>{const r=t==="newsletter"||t==="marketing"||e;return{framed:r,isPlain:!r}},xs=()=>`
|
|
23
23
|
/* Zero the UA default body margin and clamp the document to the iframe width so
|
|
24
24
|
wide author markup can't push the body (and the page) past the viewport. */
|
|
25
25
|
html, body {
|
|
@@ -74,11 +74,11 @@ pre, code {
|
|
|
74
74
|
:is(pre, code, pre *, code *):is([nowrap], [style*="nowrap" i]) {
|
|
75
75
|
white-space: pre-wrap !important;
|
|
76
76
|
}
|
|
77
|
-
`,Es=t=>{const e=new Map;for(const s of t){if(!s.contentId||s.contentUrl.length===0)continue;const r=s.contentId.replace(/^<|>$/g,"");e.set(r,s.contentUrl)}return s=>e.get(s.replace(/^<|>$/g,""))},
|
|
77
|
+
`,Es=t=>{const e=new Map;for(const s of t){if(!s.contentId||s.contentUrl.length===0)continue;const r=s.contentId.replace(/^<|>$/g,"");e.set(r,s.contentUrl)}return s=>e.get(s.replace(/^<|>$/g,""))},Ss=/^(none|transparent|inherit|initial|unset)\s*$/i,Ne=t=>{const e=[],s=/<style[^>]*>([\s\S]*?)<\/style>/gi;let r;for(r=s.exec(t);r!==null;)e.push(r[1]),r=s.exec(t);return e},ks=t=>{const e=/background(?:-color)?\s*:\s*([^;}\n]+)/gi;let s;for(s=e.exec(t);s!==null;){const r=s[1].trim();if(!Ss.test(r))return!0;s=e.exec(t)}return!1},Ts=t=>{if(/\bstyle\s*=\s*["'][^"']*background/i.test(t)||/\bbgcolor\s*=/i.test(t))return!0;for(const e of Ne(t))if(ks(e))return!0;return!1},As=new Set(["auto","none","initial","inherit","unset","revert","revert-layer"]),Cs=new RegExp(`(?<![-\\w])(?:padding|margin)(?:-(top|right|bottom|left|block|inline)(?:-(?:start|end))?)?\\s*:\\s*([^;}"']+)`,"gi"),Os=new Set(["top","bottom","block"]),Me=t=>t.replace(/\/\*[\s\S]*?\*\//g,""),pe=t=>{const e=t.toLowerCase();if(!e||As.has(e)||e.startsWith("-"))return!1;const s=/^\+?(\d*\.?\d+)[a-z%]*$/.exec(e);return s?Number.parseFloat(s[1])!==0:!0},Ds=t=>{const e=t.split(/\s+/).filter(Boolean);return e.length<2?e:e.length<4?[e[1]]:[e[1],e[3]]},Is=(t,e)=>{if(t&&Os.has(t))return!1;const s=e.replace(/!\s*important/gi,"").trim();return s?t?s.split(/\s+/).some(pe):Ds(s).some(pe):!1},me=t=>{for(const e of Me(t).matchAll(Cs))if(Is(e[1],e[2]))return!0;return!1},Re=new Set(["blockquote"]),js=t=>t.replace(/<!--[\s\S]*?-->/g,""),Ps=t=>{const e=[],s=/<([a-zA-Z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,r=/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;for(const[,n,o]of t.matchAll(s))for(const i of o.matchAll(r))e.push({tag:n.toLowerCase(),style:i[1]??i[2]??""});return e},Ls=t=>[...Me(t).matchAll(/([^{}]*)\{([^{}]*)\}/g)].map(e=>({selector:e[1].trim(),body:e[2]})),Ns=t=>{const e=t.trim().split(/[\s>+~]+/).pop()??"";return(/^[a-zA-Z][\w-]*/.exec(e)?.[0]??"").toLowerCase()},Ms=t=>t.split(",").every(e=>Re.has(Ns(e))),Rs=t=>{const e=Ne(t),s=js(t);if(/\bcellpadding\s*=\s*["']?(?!0["'\s>])\d/i.test(s))return!0;for(const{tag:r,style:n}of Ps(s))if(!Re.has(r)&&me(n))return!0;for(const r of e)for(const n of Ls(r))if(!Ms(n.selector)&&me(n.body))return!0;return!1},Bs=["script","iframe","object","embed","form","input","button","textarea","select","meta","link","base"],$s=["onerror","onload","onclick","onmouseover","onmouseout","onfocus","onblur","onsubmit","onkeydown","onkeyup","formaction","xlink:href","data-bind"],Ks="data:image/svg+xml,"+encodeURIComponent(`
|
|
78
78
|
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
|
|
79
79
|
<rect fill="#f0f0f0" width="100" height="100"/>
|
|
80
80
|
<text x="50" y="50" text-anchor="middle" dy=".3em" fill="#999" font-size="12">
|
|
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=As(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."}),Tr=({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,k])=>({queryKey:y,data:k}));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:k,isPending:_}=ir({messageId:o??""}),w=!!t&&t.length>0,{picked:A,data:T,isLoading:D,isError:p,error:g,refetch:O}=it({messageId:o,bodyParts:t,enabled:w}),L=b.useMemo(()=>Es(t??[]),[t]),N=w&&T?.kind==="html"?T.body:e,Ke=w&&T?.kind==="text"?T.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(!A)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),k(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{Sr as A,_r as C,Tr as M,Cr as R,Ie as S,rs as a,V as b,kr as c,q as d,at as e,Vs as f,xr as g,Ar 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,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};
|