@remit/web-client-dist 0.0.491 → 0.0.492
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-BnLQf9xD.js → BriefPane-CTVoGQnv.js} +1 -1
- package/assets/{CalendarComposePane-Bvz98py-.js → CalendarComposePane-ajmRlZ4a.js} +1 -1
- package/assets/{CalendarComposeSeed-C6TxmXgI.js → CalendarComposeSeed-DhKz0mPP.js} +1 -1
- package/assets/{CalendarShell-XtkvgoTN.js → CalendarShell-CAgg870O.js} +1 -1
- package/assets/{EmptyState-AoOm4qk_.js → EmptyState-DUIY0X8d.js} +1 -1
- package/assets/{ErrorState-cRFUQiJa.js → ErrorState-BngYP48L.js} +1 -1
- package/assets/{FlaggedPane-DYPA4hlb.js → FlaggedPane-Oe_MykTl.js} +1 -1
- package/assets/{FullCompose-D_kaI67H.js → FullCompose-Bo00Kn2C.js} +1 -1
- package/assets/{MailListHeader-D_cICyhV.js → MailListHeader-BZ43JcTd.js} +1 -1
- package/assets/{MailNav-BcmeuAwQ.js → MailNav-DHlmkxS0.js} +1 -1
- package/assets/{MailShell-B9Wo6k_y.js → MailShell-D41cTX_1.js} +1 -1
- package/assets/{MailViewChrome-YZbLaJ6q.js → MailViewChrome-Bfnh98rg.js} +1 -1
- package/assets/{MailboxPane-CfRnS_fq.js → MailboxPane-Crm6R_SS.js} +1 -1
- package/assets/{NavMenuButton-DRei5nZF.js → NavMenuButton-CyRQS98D.js} +1 -1
- package/assets/{OnboardingWizard-CGvHlk36.js → OnboardingWizard-bdovBza4.js} +1 -1
- package/assets/{OpenCalendarEvent-DNVGyzCc.js → OpenCalendarEvent-DMwoLpSt.js} +1 -1
- package/assets/{OutboxPane-DUVXcz0n.js → OutboxPane-BlGG_vwk.js} +1 -1
- package/assets/_calendarObjectId-DJ7tRpdY.js +1 -0
- package/assets/_mailboxId-DN5uE-Wu.js +1 -0
- package/assets/_messageId-Bu_1-FsY.js +1 -0
- package/assets/_messageId-DfeaznaI.js +1 -0
- package/assets/_messageId-He6f9mx3.js +1 -0
- package/assets/_outboxMessageId-Dv47Xxqa.js +1 -0
- package/assets/_recurrenceId-H9MhgngH.js +1 -0
- package/assets/_threadId-BZF4rzpf.js +1 -0
- package/assets/_threadId-DuDjOnzL.js +1 -0
- package/assets/_threadId-b1rckNZ5.js +1 -0
- package/assets/_view._date-QlgcNfR-.js +1 -0
- package/assets/{accounts-BSuRSxHh.js → accounts-l9ElCLlE.js} +1 -1
- package/assets/{advanced-CiK-l36f.js → advanced-T2ZTO2eK.js} +1 -1
- package/assets/{appearance-Wu3_UKSH.js → appearance-cTRDXKQB.js} +1 -1
- package/assets/{attachment-file-Bp9sEthw.js → attachment-file-DBm19MjU.js} +1 -1
- package/assets/{avatar-CwtUIkH9.js → avatar-TGnSyTcr.js} +1 -1
- package/assets/{bottom-sheet-ICAMxSzN.js → bottom-sheet-B5NX4d94.js} +1 -1
- package/assets/{brief-DucVUc-F.js → brief-BLFqalKf.js} +1 -1
- package/assets/brief-CgHvMv26.js +1 -0
- package/assets/{browser-ponyfill-HVkvnKr2.js → browser-ponyfill-JB8smfuT.js} +1 -1
- package/assets/{bug-CB2SBKL6.js → bug-CChRjNAW.js} +1 -1
- package/assets/{calendar-gza4aJvT.js → calendar-TTK3dP_9.js} +1 -1
- package/assets/{calendar-days-B9elPilO.js → calendar-days-DOjpTOSr.js} +1 -1
- package/assets/{card-BiIyyhx9.js → card-5RNE1D9U.js} +1 -1
- package/assets/chevron-left-FAjAhXYV.js +1 -0
- package/assets/{circle-check-B_KN_2Gx.js → circle-check-D5gzkegt.js} +1 -1
- package/assets/{circle-check-big-Dv7zyjMu.js → circle-check-big-BuHT0l85.js} +1 -1
- package/assets/{circle-help-ffqeCP37.js → circle-help-BvOeRAjQ.js} +1 -1
- package/assets/{clock-DZztmFmd.js → clock-BDFPxBQY.js} +1 -1
- package/assets/compose._-_outboxMessageId_-B6TFZf6f.js +1 -0
- package/assets/compose._-_outboxMessageId_-CPPe51hs.js +1 -0
- package/assets/compose._-_outboxMessageId_-CR6LdfS6.js +1 -0
- package/assets/compose._-_outboxMessageId_-D_O5C6mu.js +1 -0
- package/assets/{config-import-CFt6-48Y.js → config-import-BYKb2bE7.js} +1 -1
- package/assets/{confirm-dialog-CxFHf24h.js → confirm-dialog-DvZrfsRk.js} +1 -1
- package/assets/{credential-steps-ogZBYeYz.js → credential-steps-DcaWeTyb.js} +1 -1
- package/assets/{download-DfZ8evcv.js → download-DJTw5tRx.js} +1 -1
- package/assets/{filters-ZBKsIm3W.js → filters-B7Yfay1D.js} +1 -1
- package/assets/flagged-CmbAFtHG.js +1 -0
- package/assets/{flagged-BZuPnlrC.js → flagged-Oc25Zg-6.js} +1 -1
- package/assets/{folders-oX1Zn_x8.js → folders-BFi2VgQK.js} +1 -1
- package/assets/{format-DrNANgYi.js → format-6QqrpvJS.js} +1 -1
- package/assets/{help-copy-BuJ5LAUI.js → help-copy-BG4_zdhC.js} +1 -1
- package/assets/{import-BGtZptKZ.js → import-C87x7rKS.js} +1 -1
- package/assets/index-B8WRJZjD.js +1 -0
- package/assets/index-BX4qZUKO.js +1 -0
- package/assets/index-Blb0g_Ie.js +1 -0
- package/assets/index-BqrsoWfS.js +1 -0
- package/assets/index-Bu_1-FsY.js +1 -0
- package/assets/{index-IslFt5rW.js → index-CAZr9Hkk.js} +4 -4
- package/assets/index-CkTWAvl-.js +1 -0
- package/assets/{index-iwA7tSuw.js → index-D_w105Kd.js} +4 -4
- package/assets/index-Dt9DhkV0.js +1 -0
- package/assets/index-He6f9mx3.js +1 -0
- package/assets/index-iOk76Xfg.js +1 -0
- package/assets/{index-CpSmePgd.js → index-tzoWLTU1.js} +1 -1
- package/assets/{kbd-Bdkpw2Ft.js → kbd-tEhcU6de.js} +1 -1
- package/assets/{labels-ViB7na-l.js → labels-C0Ibb6qz.js} +1 -1
- package/assets/{mail-DFh8uyhl.js → mail-CU3vq4wJ.js} +1 -1
- package/assets/{mail-DNC_UZkB.js → mail-DkcWxcwo.js} +1 -1
- package/assets/{menu-DyI2BxNU.js → menu-C9Jej5w7.js} +1 -1
- package/assets/minus-BfMTSSD5.js +1 -0
- package/assets/{new-DXc_mP-x.js → new-xWC_q9ne.js} +1 -1
- package/assets/onboarding-DXg0_c6u.js +1 -0
- package/assets/{onboarding-completion-niSqIzSE.js → onboarding-completion--Lg7GNU_.js} +1 -1
- package/assets/outbox-DNbdNX77.js +1 -0
- package/assets/{pencil-DfTwfu4l.js → pencil-BON3jZO8.js} +1 -1
- package/assets/{rich-text-ByTp01Iy.js → rich-text-Do-1dscf.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-4yRXlO1S.js → rich-text-spellcheck-worker-provider-dZ8uUB7O.js} +1 -1
- package/assets/{rotate-ccw-CgUL21p-.js → rotate-ccw-FJO2cGCC.js} +1 -1
- package/assets/{row-actions-Bhl5vsOp.js → row-actions-B83AUOcr.js} +1 -1
- package/assets/{search-mirror-BTzsnaFp.js → search-mirror-Cp9GXxZs.js} +1 -1
- package/assets/{search-token-index-B6Aad9U5.js → search-token-index-DBjqEp4z.js} +1 -1
- package/assets/{sections-DuiDVOoI.js → sections-D83I4ptW.js} +1 -1
- package/assets/{senders-l0FP6im2.js → senders-BcNTQ3Ow.js} +1 -1
- package/assets/settings-BSSh1Qeh.js +1 -0
- package/assets/{settings-screen-BjOH8tBv.js → settings-screen-d7D3e6bb.js} +1 -1
- package/assets/{shield-check-Bo0PJbZu.js → shield-check-kxi3CCdE.js} +1 -1
- package/assets/{suggested-vips-SH2RewF0.js → suggested-vips-4_h8oaUi.js} +1 -1
- package/assets/{useCalendarData-qB8z4ZBS.js → useCalendarData-gMRe9BP7.js} +1 -1
- package/assets/{useCalendars-AvRt3z_j.js → useCalendars-DsToCd2I.js} +1 -1
- package/assets/{useDebouncedValue-BVqLAsg7.js → useDebouncedValue-Crqb3lBu.js} +1 -1
- package/assets/{useFilters-Dxt-BW5R.js → useFilters-bk7-84hg.js} +1 -1
- package/assets/{useLabels-hkgnUlmR.js → useLabels-B9y3vyS7.js} +1 -1
- package/assets/{useLayoutTier-BiP61506.js → useLayoutTier-DjDOYqv6.js} +1 -1
- package/assets/{useMessageBodyContent-B6azTA9z.js → useMessageBodyContent-D9gi_wLu.js} +1 -1
- package/assets/{useQueries-BCxbAFg2.js → useQueries-DZidh9HG.js} +1 -1
- package/assets/{useRefreshControl-D8j8tzmu.js → useRefreshControl-DwWmzI9O.js} +1 -1
- package/assets/{useSearchTokenContext-Cje6t3Dh.js → useSearchTokenContext-05ksrHjq.js} +1 -1
- package/assets/{useSemanticSearch-5Iyb31DP.js → useSemanticSearch-DkTgGuC_.js} +1 -1
- package/assets/{useSignature-CESrHwSY.js → useSignature-NMPmEDy2.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_calendarObjectId-B0lKheSA.js +0 -1
- package/assets/_mailboxId-D7BOUOSu.js +0 -1
- package/assets/_messageId-C25cJhHu.js +0 -1
- package/assets/_messageId-CjE1oEc2.js +0 -1
- package/assets/_messageId-DmlAFDXB.js +0 -1
- package/assets/_outboxMessageId-BUAtn4qx.js +0 -1
- package/assets/_recurrenceId-D1Wjq_B-.js +0 -1
- package/assets/_threadId-R3oFyqWQ.js +0 -1
- package/assets/_threadId-SKW98t2r.js +0 -1
- package/assets/_threadId-Yhl01yWM.js +0 -1
- package/assets/_view._date-AoXCHtt7.js +0 -1
- package/assets/brief-CsHzTePE.js +0 -1
- package/assets/chevron-left-BZyVDk26.js +0 -1
- package/assets/compose._-_outboxMessageId_-CXjPWXID.js +0 -1
- package/assets/compose._-_outboxMessageId_-CjgAzOdV.js +0 -1
- package/assets/compose._-_outboxMessageId_-Dpt5Y8Wx.js +0 -1
- package/assets/compose._-_outboxMessageId_-vXig8meM.js +0 -1
- package/assets/flagged-B8F0_A8V.js +0 -1
- package/assets/index-BTmKx_1K.js +0 -1
- package/assets/index-BiATRBev.js +0 -1
- package/assets/index-C25cJhHu.js +0 -1
- package/assets/index-CHa3Q4dh.js +0 -1
- package/assets/index-DFurgden.js +0 -1
- package/assets/index-DSfrhTnC.js +0 -1
- package/assets/index-DaHXlsb7.js +0 -1
- package/assets/index-Dcab3yFo.js +0 -1
- package/assets/index-DmlAFDXB.js +0 -1
- package/assets/minus-DZN7ywCo.js +0 -1
- package/assets/onboarding-DCxAmiEk.js +0 -1
- package/assets/outbox-B5iYplIX.js +0 -1
- package/assets/settings-CSDvcm-5.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ef as A,K as $}from"./index-
|
|
1
|
+
import{ef as A,K as $}from"./index-CAZr9Hkk.js";function X(_,d){for(var b=0;b<d.length;b++){const y=d[b];if(typeof y!="string"&&!Array.isArray(y)){for(const l in y)if(l!=="default"&&!(l in _)){const p=Object.getOwnPropertyDescriptor(y,l);p&&Object.defineProperty(_,l,p.get?p:{enumerable:!0,get:()=>y[l]})}}}return Object.freeze(Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}))}var E={exports:{}},H;function J(){return H||(H=1,(function(_,d){var b=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof A<"u"&&A,y=(function(){function p(){this.fetch=!1,this.DOMException=b.DOMException}return p.prototype=b,new p})();(function(p){(function(h){var a=typeof p<"u"&&p||typeof self<"u"&&self||typeof A<"u"&&A||{},u={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function F(e){return e&&DataView.prototype.isPrototypeOf(e)}if(u.arrayBuffer)var q=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],C=ArrayBuffer.isView||function(e){return e&&q.indexOf(Object.prototype.toString.call(e))>-1};function v(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function T(e){return typeof e!="string"&&(e=String(e)),e}function B(e){var t={next:function(){var r=e.shift();return{done:r===void 0,value:r}}};return u.iterable&&(t[Symbol.iterator]=function(){return t}),t}function i(e){this.map={},e instanceof i?e.forEach(function(t,r){this.append(r,t)},this):Array.isArray(e)?e.forEach(function(t){if(t.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}i.prototype.append=function(e,t){e=v(e),t=T(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},i.prototype.delete=function(e){delete this.map[v(e)]},i.prototype.get=function(e){return e=v(e),this.has(e)?this.map[e]:null},i.prototype.has=function(e){return this.map.hasOwnProperty(v(e))},i.prototype.set=function(e,t){this.map[v(e)]=T(t)},i.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},i.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),B(e)},i.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),B(e)},i.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),B(e)},u.iterable&&(i.prototype[Symbol.iterator]=i.prototype.entries);function O(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}}function D(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function I(e){var t=new FileReader,r=D(t);return t.readAsArrayBuffer(e),r}function M(e){var t=new FileReader,r=D(t),n=/charset=([A-Za-z0-9_-]+)/.exec(e.type),s=n?n[1]:"utf-8";return t.readAsText(e,s),r}function L(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}function R(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function U(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:u.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:u.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():u.arrayBuffer&&u.blob&&F(e)?(this._bodyArrayBuffer=R(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||C(e))?this._bodyArrayBuffer=R(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var e=O(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=O(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(u.blob)return this.blob().then(I);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var e=O(this);if(e)return e;if(this._bodyBlob)return M(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(L(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(z)}),this.json=function(){return this.text().then(JSON.parse)},this}var N=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function k(e){var t=e.toUpperCase();return N.indexOf(t)>-1?t:e}function w(e,t){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var r=t.body;if(e instanceof w){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new i(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!r&&e._bodyInit!=null&&(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new i(t.headers)),this.method=k(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||(function(){if("AbortController"in a){var o=new AbortController;return o.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var s=/\?/;this.url+=(s.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})};function z(e){var t=new FormData;return e.trim().split("&").forEach(function(r){if(r){var n=r.split("="),s=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(s),decodeURIComponent(o))}}),t}function G(e){var t=new i,r=e.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
|
|
2
2
|
`)===0?n.substr(1,n.length):n}).forEach(function(n){var s=n.split(":"),o=s.shift().trim();if(o){var g=s.join(":").trim();try{t.append(o,g)}catch(x){console.warn("Response "+x.message)}}}),t}U.call(w.prototype);function c(e,t){if(!(this instanceof c))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new i(t.headers),this.url=t.url||"",this._initBody(e)}U.call(c.prototype),c.prototype.clone=function(){return new c(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},c.error=function(){var e=new c(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var V=[301,302,303,307,308];c.redirect=function(e,t){if(V.indexOf(t)===-1)throw new RangeError("Invalid status code");return new c(null,{status:t,headers:{location:e}})},h.DOMException=a.DOMException;try{new h.DOMException}catch{h.DOMException=function(t,r){this.message=t,this.name=r;var n=Error(t);this.stack=n.stack},h.DOMException.prototype=Object.create(Error.prototype),h.DOMException.prototype.constructor=h.DOMException}function P(e,t){return new Promise(function(r,n){var s=new w(e,t);if(s.signal&&s.signal.aborted)return n(new h.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function g(){o.abort()}o.onload=function(){var f={statusText:o.statusText,headers:G(o.getAllResponseHeaders()||"")};s.url.indexOf("file://")===0&&(o.status<200||o.status>599)?f.status=200:f.status=o.status,f.url="responseURL"in o?o.responseURL:f.headers.get("X-Request-URL");var m="response"in o?o.response:o.responseText;setTimeout(function(){r(new c(m,f))},0)},o.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},o.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request timed out"))},0)},o.onabort=function(){setTimeout(function(){n(new h.DOMException("Aborted","AbortError"))},0)};function x(f){try{return f===""&&a.location.href?a.location.href:f}catch{return f}}if(o.open(s.method,x(s.url),!0),s.credentials==="include"?o.withCredentials=!0:s.credentials==="omit"&&(o.withCredentials=!1),"responseType"in o&&(u.blob?o.responseType="blob":u.arrayBuffer&&(o.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof i||a.Headers&&t.headers instanceof a.Headers)){var j=[];Object.getOwnPropertyNames(t.headers).forEach(function(f){j.push(v(f)),o.setRequestHeader(f,T(t.headers[f]))}),s.headers.forEach(function(f,m){j.indexOf(m)===-1&&o.setRequestHeader(m,f)})}else s.headers.forEach(function(f,m){o.setRequestHeader(m,f)});s.signal&&(s.signal.addEventListener("abort",g),o.onreadystatechange=function(){o.readyState===4&&s.signal.removeEventListener("abort",g)}),o.send(typeof s._bodyInit>"u"?null:s._bodyInit)})}return P.polyfill=!0,a.fetch||(a.fetch=P,a.Headers=i,a.Request=w,a.Response=c),h.Headers=i,h.Request=w,h.Response=c,h.fetch=P,h})({})})(y),y.fetch.ponyfill=!0,delete y.fetch.polyfill;var l=b.fetch?b:y;d=l.fetch,d.default=l.fetch,d.fetch=l.fetch,d.Headers=l.Headers,d.Request=l.Request,d.Response=l.Response,_.exports=d})(E,E.exports)),E.exports}var S=J();const K=$(S),Q=X({__proto__:null,default:K},[S]);export{Q as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a}from"./index-
|
|
1
|
+
import{e as a}from"./index-CAZr9Hkk.js";const p=a("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);export{p as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as g,a as x,b as h,r as i,p as O,c as j,d as y,j as e,O as C}from"./index-
|
|
1
|
+
import{u as g,a as x,b as h,r as i,p as O,c as j,d as y,j as e,O as C}from"./index-CAZr9Hkk.js";import{C as N}from"./CalendarShell-CAgg870O.js";import{M as P}from"./MailNav-DHlmkxS0.js";import{E}from"./ErrorState-BngYP48L.js";import{i as S,u as b}from"./useLayoutTier-DjDOYqv6.js";import"./calendar-days-DOjpTOSr.js";import"./useQueries-DZidh9HG.js";import"./outbox-status-BlKn6P0x.js";import"./bug-CChRjNAW.js";function I(){const t=g(),c=S(b()),a=x(),r=h(),l=a.includes("nav"),n=i.useCallback(v=>{r(O(a,v?"nav":void 0))},[a,r]),{data:s,isLoading:u,isError:p,error:f,refetch:m}=j({...y(),staleTime:1/0}),o=!!(s&&(s.accounts?.length??0)===0);i.useEffect(()=>{o&&t({to:"/onboarding",replace:!0})},[o,t]);const d=s?.accounts??[];return p?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(E,{title:"Couldn't load your account",error:f,onRetry:()=>{m()}})}):e.jsx(N,{chrome:{isSinglePane:c,isLoading:u||o,nav:e.jsx(P,{accounts:d,onMailboxSelect:()=>n(!1)}),navOpen:l,onOpenNav:()=>n(!0),onCloseNav:()=>n(!1)},children:e.jsx(C,{})})}export{I as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as h}from"./index-
|
|
1
|
+
import{e as h}from"./index-CAZr9Hkk.js";const t=h("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);export{t as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as d,j as s,t}from"./index-
|
|
1
|
+
import{e as d,j as s,t}from"./index-CAZr9Hkk.js";const o=d("FileJson",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);function c({raised:a,className:e,...r}){return s.jsx("div",{className:t("rounded-sm border border-line bg-surface",a?"bg-surface-raised shadow-sm":"",e),...r})}function i({className:a,...e}){return s.jsx("div",{className:t("px-4 pt-3 pb-2",a),...e})}function m({className:a,...e}){return s.jsx("h3",{className:t("text-md font-semibold text-fg",a),...e})}function p({className:a,...e}){return s.jsx("div",{className:t("px-4 pb-3 text-sm text-fg-muted",a),...e})}export{c as C,o as F,i as a,m as b,p as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e}from"./index-CAZr9Hkk.js";const t=e("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);export{t as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as c}from"./index-
|
|
1
|
+
import{e as c}from"./index-CAZr9Hkk.js";const r=c("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{r as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./index-
|
|
1
|
+
import{e}from"./index-CAZr9Hkk.js";const t=e("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);export{t as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./index-
|
|
1
|
+
import{e}from"./index-CAZr9Hkk.js";const p=e("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);export{p as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as c}from"./index-
|
|
1
|
+
import{e as c}from"./index-CAZr9Hkk.js";const o=c("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);export{o as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as o}from"./FullCompose-Bo00Kn2C.js";import"./index-CAZr9Hkk.js";import"./ErrorState-BngYP48L.js";import"./index-D_w105Kd.js";import"./useMessageBodyContent-D9gi_wLu.js";import"./useSignature-NMPmEDy2.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Crqb3lBu.js";import"./sections-D83I4ptW.js";import"./format-6QqrpvJS.js";import"./confirm-dialog-DvZrfsRk.js";const C=o;export{C as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as o}from"./FullCompose-Bo00Kn2C.js";import"./index-CAZr9Hkk.js";import"./ErrorState-BngYP48L.js";import"./index-D_w105Kd.js";import"./useMessageBodyContent-D9gi_wLu.js";import"./useSignature-NMPmEDy2.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Crqb3lBu.js";import"./sections-D83I4ptW.js";import"./format-6QqrpvJS.js";import"./confirm-dialog-DvZrfsRk.js";const C=o;export{C as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as o}from"./FullCompose-Bo00Kn2C.js";import"./index-CAZr9Hkk.js";import"./ErrorState-BngYP48L.js";import"./index-D_w105Kd.js";import"./useMessageBodyContent-D9gi_wLu.js";import"./useSignature-NMPmEDy2.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Crqb3lBu.js";import"./sections-D83I4ptW.js";import"./format-6QqrpvJS.js";import"./confirm-dialog-DvZrfsRk.js";const C=o;export{C as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as o}from"./FullCompose-Bo00Kn2C.js";import"./index-CAZr9Hkk.js";import"./ErrorState-BngYP48L.js";import"./index-D_w105Kd.js";import"./useMessageBodyContent-D9gi_wLu.js";import"./useSignature-NMPmEDy2.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Crqb3lBu.js";import"./sections-D83I4ptW.js";import"./format-6QqrpvJS.js";import"./confirm-dialog-DvZrfsRk.js";const C=o;export{C as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b2 as y,b3 as b}from"./index-
|
|
1
|
+
import{b2 as y,b3 as b}from"./index-CAZr9Hkk.js";const x=e=>new Promise(n=>{n(JSON.parse(e))}),c=["accounts","labels","filters","addressFlags","settings"],h={accounts:"Accounts",labels:"Labels",filters:"Rules & filters",addressFlags:"Senders",settings:"Folders & appearance"},v=["created","updated","unchanged","skipped","rejected"],$={created:"positive",updated:"accent",unchanged:"neutral",skipped:"warning",rejected:"danger"},g=e=>v.includes(e)?e:"rejected",d="unknown",u=e=>c.includes(e)?e:void 0,N=e=>{const n=new Map;return e.forEach((t,i)=>{const s=u(t.section)??d,a=n.get(s)??[];a.push({id:`${s}-${t.key}-${i}`,label:t.key,verdict:g(t.verdict),reason:s===d?t.reason??`This instance does not know the "${t.section}" section, so it cannot say what this entry does.`:t.reason}),n.set(s,a)}),[...c,d].filter(t=>n.has(t)).map(t=>({id:t,title:t===d?"Not recognised":h[t],entries:n.get(t)??[]}))},_=e=>{const n={created:0,updated:0,unchanged:0,skipped:0,rejected:0};for(const o of e)n[g(o.verdict)]+=1;return n},T={NotAnObject:()=>({title:"That is not a Reader config file",explanation:"The file was read, but it is not a configuration document — a Reader config is a JSON object carrying a kind and a schemaVersion.",fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host."}),WrongKind:()=>({title:"That is not a Reader config file",explanation:"The file parses as JSON but does not declare itself a Reader configuration, so nothing here can be trusted to mean what it looks like.",fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host."}),UnsupportedVersion:e=>({title:"This file was written by a newer Reader",explanation:e.message||"The file declares a schema version this instance does not read, so importing it would drop settings it cannot understand.",fix:"Update this Reader, then import again. The file is unchanged and safe to keep."}),UnknownKeys:e=>({title:"The file contains settings this version does not know",explanation:"An unknown key is refused rather than quietly dropped: losing configuration without saying so is exactly what this feature exists to prevent.",fix:`Update this Reader, or remove the named keys from the file and import again. ${e.message}`}),CredentialPresent:()=>({title:"The file carries a credential",explanation:"A configuration document describes which credential an account needs; it never carries one. Reader refuses the file rather than importing around it — the secret may now be in your backups, your chat history, or a pull request.",fix:"Delete the field from the file and import again, then change that mailbox's password. Exports written by Reader never contain one."}),Malformed:e=>({title:"The file does not match the configuration format",explanation:"Every part of the document has to validate before anything is written, and this one does not.",fix:`Re-export it from the instance you are moving from. ${e.message}`}),duplicate_key:e=>({title:"The file names something twice",explanation:"A configuration names each account, label and filter once, so a document with two of the same key has no single answer to import.",fix:`Remove the duplicate and import again. ${e.message}`}),unknown_label:e=>({title:"A rule points at a label that is not here",explanation:"The file applies a label neither it nor this instance carries, so the rule would land doing nothing.",fix:`Add the label to the file, or create it here first, then import again. ${e.message}`}),unknown_account:e=>({title:"A rule points at an account that is not here",explanation:"The file files mail into a folder on an account it does not carry, so the rule has no destination to bind to.",fix:`Export the configuration again from an instance that holds both, then import that file. ${e.message}`})},k=e=>({title:"The file could not be imported",explanation:e.message||"The import was refused and nothing was written.",fix:"Re-export the configuration from the instance you are moving from and try again. If it keeps failing, report it with the line below."}),w="import_write_failed",S="config_not_empty",A=e=>{const n=y(e);if(n!==void 0&&n!==409)return;const o=e instanceof b?e.body:e;if(typeof o!="object"||o===null)return;const t=o;if(t.code===S)return{message:typeof t.message=="string"?t.message:"",details:typeof t.details=="object"&&t.details!==null?t.details:void 0}},I=e=>{const n=e.errors.find(t=>t.code!==w);return n?{...(T[n.code]??k)(n),raw:`${n.code}: ${n.message}`}:void 0},E=e=>e.errors.find(n=>n.code===w),j=e=>{const n=E(e),o=n?.details?.section,t=o?u(o):void 0,i=new Map;for(const a of e.items){if(g(a.verdict)==="rejected")continue;const r=u(a.section);r&&i.set(r,(i.get(r)??0)+1)}if(!t){const a=o?`The import stopped in "${o}", which this instance does not recognise, so it cannot say whether this section was written.`:"The import stopped without naming where, so it cannot say whether this section was written. Open Settings to see what is here.";return c.map(r=>({section:r,title:h[r],state:"unknown",detail:a}))}const s=c.indexOf(t);return c.map((a,r)=>{const l=h[a];if(a===t)return{section:a,title:l,state:"failed",detail:n?.message??"This section could not be written."};if(r>s)return{section:a,title:l,state:"not-attempted",detail:"Not attempted — the import stopped before this section."};const f=i.get(a)??0;return{section:a,title:l,state:"landed",detail:f===0?"Nothing in the file for this section.":`${f} ${f===1?"entry":"entries"} written.`}})},R="folder_not_found_yet",F=e=>{const n=new Set,o=[];for(const t of e.warnings){if(t.code!==R)continue;const i=t.details?.folderPath;if(!i)continue;const s=t.details?.filter,a=t.details?.accountId,r=`${a??""}:${i}:${s??""}`;n.has(r)||(n.add(r),o.push({path:i,accountId:a,waitingFor:s?`Rule “${s}”`:"A folder role or a folder's own settings"}))}return o},p=2*1024*1024,m=Symbol("not json"),C=async(e,n,o)=>{if(n>p)return{ok:!1,failure:{title:"That file is too large to be a config file",explanation:`${e} is ${Math.round(n/1024)} kB. A Reader configuration is tens of kilobytes; a file this size is something else.`,fix:"Pick the .json file written by Settings › Advanced, or by remit config save.",raw:`${n} bytes > ${p} byte limit`}};let t="";const i=await x(o).catch(s=>(t=s instanceof Error?s.message:String(s),m));return i===m?{ok:!1,failure:{title:"That file is not JSON",explanation:`${e} could not be read as JSON at all, so there is nothing in it to import.`,fix:"Pick the .json file written by Settings › Advanced, or by remit config save.",raw:t}}:typeof i!="object"||i===null||Array.isArray(i)?{ok:!1,failure:{title:"That is not a Reader config file",explanation:`${e} is valid JSON but not a configuration document — a Reader config is a JSON object carrying a kind and a schemaVersion.`,fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host.",raw:`expected a JSON object, found ${Array.isArray(i)?"an array":typeof i}`}}:{ok:!0,document:i}},D=e=>`reader-config.${e.toISOString().slice(0,10)}.json`,J=e=>e<1024?`${e} B`:`${Math.round(e/1024)} kB`;export{w as W,A as a,I as b,_ as c,D as e,J as f,N as g,F as p,C as r,j as s,$ as v,E as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,E as x,j as e,F as b,t as n}from"./index-
|
|
1
|
+
import{r as o,E as x,j as e,F as b,t as n}from"./index-CAZr9Hkk.js";const h=({isOpen:s,title:r,description:a,confirmLabel:c,cancelLabel:d="Cancel",destructive:m=!1,isBusy:u=!1,onConfirm:f,onCancel:t})=>{const i=o.useRef(null);return x({id:"confirm-dialog",open:s,answers:{back:t}}),o.useEffect(()=>{if(!s)return;const l=document.activeElement instanceof HTMLElement?document.activeElement:null;return i.current?.focus(),()=>{l?.isConnected&&l.focus()}},[s]),s?e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[e.jsx(b,{label:"Dismiss confirmation",onDismiss:t,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":r,className:n("relative z-10 w-full max-w-sm","bg-surface border border-line rounded-sm shadow-lg","p-6"),children:[e.jsx("h2",{className:"text-lg font-semibold",children:r}),a&&e.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:a}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-2",children:[e.jsx("button",{ref:i,type:"button",onClick:t,className:n("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors","border border-line hover:bg-surface-raised"),children:d}),e.jsx("button",{type:"button",onClick:f,disabled:u,className:n("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors",m?"bg-danger text-canvas hover:bg-danger/90":"bg-accent text-accent-fg hover:bg-accent-hover","disabled:opacity-50 disabled:cursor-not-allowed"),children:c})]})]})]}):null};export{h as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as W,j as t,ax as F,aA as _,t as E,r as n,g as B,aO as R,ay as C,i as G,av as X,B as J,az as K,f as N}from"./index-IslFt5rW.js";import{C as Q}from"./card-BiIyyhx9.js";const ut=W("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function Y({url:r}){return t.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Stored encrypted, used only to connect to your mail server."," ",r?t.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"How to create an app password"}):t.jsx("span",{children:"Check your provider's help for app password instructions."})]})}function M({value:r,defaultValue:i,onValueChange:s,...e}){return s?t.jsxs(F,{value:r,onChange:a=>s(a.target.value),...e,children:[t.jsx("option",{value:"tls",children:"TLS/SSL"}),t.jsx("option",{value:"starttls",children:"STARTTLS"}),t.jsx("option",{value:"none",children:"None (insecure)"})]}):t.jsxs(F,{defaultValue:i??r,...e,children:[t.jsx("option",{value:"tls",children:"TLS/SSL"}),t.jsx("option",{value:"starttls",children:"STARTTLS"}),t.jsx("option",{value:"none",children:"None (insecure)"})]})}function D(r){return{tls:r==="tls",startTls:r==="starttls"}}function Z({steps:r,activeStep:i}){return t.jsx("ol",{className:"flex items-center gap-1",children:r.map((s,e)=>{const a=e<i,o=e===i;return t.jsxs("li",{className:"flex items-center gap-1",children:[e>0&&t.jsx("span",{className:"h-px w-5 bg-line","aria-hidden":!0}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:E("flex size-5 items-center justify-center rounded-full text-2xs font-semibold tabular-nums",a&&"bg-accent text-accent-fg",o&&"bg-accent-soft text-accent ring-1 ring-accent",!a&&!o&&"bg-surface-sunken text-fg-subtle"),children:a?t.jsx(_,{className:"size-3"}):e+1}),t.jsx("span",{className:E("hidden text-2xs sm:inline",o?"font-medium text-fg":"text-fg-subtle"),children:s})]})]},s)})})}function H({steps:r,activeStep:i,title:s,subtitle:e,children:a,footer:o,hideSteps:c}){return t.jsxs("div",{className:"flex min-h-dvh w-full flex-col items-center overflow-y-auto bg-canvas pb-[max(2rem,env(safe-area-inset-bottom,0px))] pl-[max(2rem,env(safe-area-inset-left,0px))] pr-[max(2rem,env(safe-area-inset-right,0px))] pt-[max(2rem,env(safe-area-inset-top,0px))] font-sans text-fg sm:pt-[30vh]",children:[!c&&t.jsx("div",{className:"mb-5 w-full max-w-xl",children:t.jsx(Z,{steps:r,activeStep:i})}),t.jsxs(Q,{raised:!0,className:"w-full max-w-xl",children:[t.jsxs("div",{className:"px-5 pt-5",children:[t.jsx("h1",{className:"text-xl font-semibold text-fg",children:s}),e&&t.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:e})]}),t.jsx("div",{className:"px-5 py-5",children:a}),o&&t.jsx("div",{className:"flex items-center justify-between gap-3 border-t border-line px-5 py-3",children:o})]})]})}const tt="Coming soon — use IMAP for now.";function pt({name:r,description:i,icon:s,comingSoon:e,selected:a,onSelect:o}){const[c,l]=n.useState(!1),m=()=>{if(o){o();return}e&&l(!0)};return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("button",{type:"button",onClick:m,"aria-disabled":e||void 0,className:E("flex flex-col items-start gap-2 rounded-sm border p-3 text-left transition-colors",a?"border-accent-2 bg-accent-2-soft":"border-line bg-surface hover:border-line-strong",e&&"opacity-55"),children:[t.jsx("span",{className:E("text-fg-muted",a&&"text-accent-2"),children:s}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-semibold text-fg",children:r}),e&&t.jsx("span",{className:"rounded-full bg-surface-sunken px-1.5 py-0.5 text-2xs text-fg-subtle",children:"soon"})]}),t.jsx("span",{className:"text-xs text-fg-subtle",children:i})]}),c&&t.jsx("p",{className:"text-2xs text-fg-subtle",children:tt})]})}function dt({legend:r,badge:i,host:s,port:e,security:a,readOnly:o,onHostChange:c,onPortChange:l,onSecurityChange:m,hostPlaceholder:x,portPlaceholder:g}){const v=n.useId(),b=n.useId(),h=n.useId();return t.jsxs("fieldset",{children:[t.jsxs("legend",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[r,i&&t.jsx(B,{tone:i.tone,children:i.label})]}),t.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-3 sm:grid-cols-[1fr_6rem_8rem] sm:gap-2",children:[t.jsxs("div",{children:[t.jsx(R,{htmlFor:v,children:"Host"}),c?t.jsx(C,{id:v,readOnly:o,value:s,onChange:p=>c(p.target.value),placeholder:x}):t.jsx(C,{id:v,readOnly:o,defaultValue:s,placeholder:x})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:b,children:"Port"}),l?t.jsx(C,{id:b,readOnly:o,value:e,onChange:p=>l(p.target.value),placeholder:g}):t.jsx(C,{id:b,readOnly:o,defaultValue:e,placeholder:g})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:h,children:"Security"}),m?t.jsx(M,{id:h,value:a,onValueChange:m}):t.jsx(M,{id:h,defaultValue:a})]})]})]})}function q({label:r,detail:i,state:s}){return t.jsxs("div",{className:"flex items-start gap-3 py-2",children:[t.jsxs("span",{className:E("mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full text-2xs",s==="ok"&&"bg-positive text-accent-fg",s==="failed"&&"bg-danger text-accent-fg",s==="running"&&"border border-accent text-accent",s==="pending"&&"border border-line text-fg-subtle"),children:[s==="ok"&&t.jsx(_,{className:"size-3"}),s==="failed"&&"!",s==="running"&&t.jsx("span",{className:"size-2 animate-pulse rounded-full bg-accent"})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:E("text-sm",s==="failed"?"font-medium text-danger":"text-fg"),children:r}),i&&t.jsx("div",{className:"mt-0.5 text-xs text-fg-subtle",children:i})]})]})}const et=(r,i)=>{const s=n.useRef(i);s.current=i,n.useEffect(()=>{if(!r)return;const e=()=>{document.visibilityState==="visible"&&s.current()};return document.addEventListener("visibilitychange",e),window.addEventListener("pageshow",e),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("pageshow",e)}},[r])},st=2e4,ht="Couldn't open Microsoft's sign-in page. Check your connection, and anything blocking redirects, then try again.",xt=r=>{const i=n.useRef(!1),s=n.useRef(!1),e=n.useRef(null),a=n.useRef(r);a.current=r;const o=n.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),c=n.useCallback(()=>{!i.current||!s.current||(o(),s.current=!1,a.current("returned"))},[o]);return n.useEffect(()=>{const l=()=>{s.current=!0,o()},m=()=>{document.visibilityState==="hidden"&&l()},x=g=>{g.persisted&&(l(),c())};return document.addEventListener("visibilitychange",m),window.addEventListener("pagehide",l),window.addEventListener("pageshow",x),()=>{document.removeEventListener("visibilitychange",m),window.removeEventListener("pagehide",l),window.removeEventListener("pageshow",x),o()}},[c,o]),et(!0,c),n.useCallback(()=>{i.current=!0,s.current=!1,o(),e.current=setTimeout(()=>{e.current=null,i.current=!1,s.current=!1,a.current("stalled")},st)},[o])},rt={"gmail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"googlemail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"outlook.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"hotmail.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"live.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"msn.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"icloud.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"me.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"mac.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"fastmail.com":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"fastmail.fm":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"yahoo.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"yahoo.co.uk":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"ymail.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"aol.com":{imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},source:"provider-table"},"zoho.com":{imap:{host:"imap.zoho.com",port:993,security:"tls"},smtp:{host:"smtp.zoho.com",port:465,security:"tls"},source:"provider-table"},"gmx.com":{imap:{host:"imap.gmx.com",port:993,security:"tls"},smtp:{host:"smtp.gmx.com",port:587,security:"starttls"},source:"provider-table"},"gmx.net":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"gmx.de":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"web.de":{imap:{host:"imap.web.de",port:993,security:"tls"},smtp:{host:"smtp.web.de",port:587,security:"starttls"},source:"provider-table"},"mail.com":{imap:{host:"imap.mail.com",port:993,security:"tls"},smtp:{host:"smtp.mail.com",port:465,security:"tls"},source:"provider-table"},"hey.com":{imap:{host:"imap.hey.com",port:993,security:"tls"},smtp:{host:"smtp.hey.com",port:465,security:"tls"},source:"provider-table"},"tutanota.com":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"tuta.io":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"posteo.de":{imap:{host:"posteo.de",port:993,security:"tls"},smtp:{host:"posteo.de",port:465,security:"tls"},source:"provider-table"},"runbox.com":{imap:{host:"imap.runbox.com",port:993,security:"tls"},smtp:{host:"smtp.runbox.com",port:587,security:"starttls"},source:"provider-table"},"mailbox.org":{imap:{host:"imap.mailbox.org",port:993,security:"tls"},smtp:{host:"smtp.mailbox.org",port:465,security:"tls"},source:"provider-table"},"hushmail.com":{imap:{host:"imap.hushmail.com",port:993,security:"tls"},smtp:{host:"smtp.hushmail.com",port:465,security:"tls"},source:"provider-table"}},ot={"gmail.com":"https://support.google.com/accounts/answer/185833","googlemail.com":"https://support.google.com/accounts/answer/185833","yahoo.com":"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html","icloud.com":"https://support.apple.com/en-us/102654","me.com":"https://support.apple.com/en-us/102654","mac.com":"https://support.apple.com/en-us/102654","fastmail.com":"https://www.fastmail.help/hc/en-us/articles/360058752854","fastmail.fm":"https://www.fastmail.help/hc/en-us/articles/360058752854","outlook.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","hotmail.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","zoho.com":"https://help.zoho.com/portal/en/kb/zoho-mail/client-configuration/imap-access/articles/zoho-mail-app-passwords"};function O(r){try{const s=new DOMParser().parseFromString(r,"application/xml");if(s.querySelector("parsererror"))return null;const e=s.querySelectorAll("incomingServer[type='imap']"),a=s.querySelectorAll("outgoingServer[type='smtp']");if(!e.length||!a.length)return null;const o=e[0],c=a[0],l=o.querySelector("hostname")?.textContent?.trim(),m=o.querySelector("port")?.textContent?.trim(),x=o.querySelector("socketType")?.textContent?.trim().toUpperCase(),g=c.querySelector("hostname")?.textContent?.trim(),v=c.querySelector("port")?.textContent?.trim(),b=c.querySelector("socketType")?.textContent?.trim().toUpperCase();if(!l||!m||!g||!v)return null;const h=p=>p==="SSL"||p==="TLS"||p==="SSL/TLS"?"tls":p==="STARTTLS"?"starttls":"none";return{imap:{host:l,port:Number.parseInt(m,10),security:h(x)},smtp:{host:g,port:Number.parseInt(v,10),security:h(b)},source:"mozilla-autoconfig"}}catch{return null}}async function it(r,i){try{const s=`https://autoconfig.thunderbird.net/v1.1/${r}`,e=await fetch(s,{signal:i});if(!e.ok)return null;const a=await e.text(),o=O(a);return o||null}catch{return null}}async function at(r,i){try{const s=`https://autoconfig.${r}/mail/config-v1.1.xml`,e=await fetch(s,{signal:i});if(!e.ok)return null;const a=await e.text(),o=O(a);return o?{...o,source:"domain-autoconfig"}:null}catch{return null}}function nt(r){return{imap:{host:`imap.${r}`,port:993,security:"tls"},smtp:{host:`smtp.${r}`,port:587,security:"starttls"},source:"heuristic"}}async function ft(r,i=1500){const s=r.indexOf("@");if(s===-1)return null;const e=r.slice(s+1).toLowerCase();if(!e)return null;const a=rt[e];if(a)return a;const o=new AbortController,c=setTimeout(()=>o.abort(),i);try{const l=await it(e,o.signal);if(l)return l;const m=await at(e,o.signal);if(m)return m}finally{clearTimeout(c)}return nt(e)}function yt(r){const i=r.indexOf("@");return i===-1?"Looking up server settings…":`Looking up settings for ${r.slice(i+1)}…`}function ct(r){const i=r.indexOf("@");if(i===-1)return;const s=r.slice(i+1).toLowerCase();return ot[s]}function gt({steps:r,activeStep:i,title:s,subtitle:e,email:a,username:o,password:c,notice:l,error:m,continueLabel:x="Test connection",backLabel:g="Back",onContinue:v,onBack:b,onChange:h}){const[p,I]=n.useState(o||a),[S,w]=n.useState(c),[T,k]=n.useState(null),z=ct(a),y=p.trim()!==""&&S.trim()!=="";n.useEffect(()=>{h(p,S)},[p,S,h]);const L=n.useCallback(()=>{if(!y){k("Enter your username and password.");return}k(null),v()},[y,v]);return n.useEffect(()=>{const u=j=>{j.key==="Enter"&&L(),j.key==="Escape"&&b()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[L,b]),t.jsx(H,{steps:r,activeStep:i,title:s,subtitle:e,footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:b,children:g}),t.jsx(N,{variant:"primary",onClick:L,children:x})]}),children:t.jsxs("div",{className:"space-y-3",children:[m&&t.jsx(J,{tone:"danger",children:m}),T&&t.jsx("div",{className:"rounded-md bg-danger-soft px-3 py-2 text-sm text-danger",children:T}),l,t.jsxs("div",{children:[t.jsx(R,{htmlFor:"credentials-username",children:"Username"}),t.jsx(C,{id:"credentials-username",value:p,onChange:u=>{I(u.target.value),k(null)},autoComplete:"username"})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:"credentials-password",children:"Password or app password"}),t.jsx(K,{id:"credentials-password",value:S,onChange:u=>{w(u.target.value),k(null)},autoComplete:"current-password"})]}),t.jsx(Y,{url:z})]})})}function vt({steps:r,activeStep:i,email:s,imapConfig:e,smtpConfig:a,username:o,password:c,onSuccess:l,onBackToCredentials:m,onBackToServers:x,credentialsBackLabel:g="Back to credentials",serversBackLabel:v="Back to servers",successLabel:b="Start syncing"}){const[h,p]=n.useState({imapState:"running",smtpState:"pending",phase:"running"}),[I,S]=n.useState(0),w=a.host.trim()!=="",T=D(e.security),k=D(a.security),z=G({...X()});n.useEffect(()=>{let u=!1;const j=[];return p({imapState:"running",smtpState:"pending",phase:"running"}),z.mutate({body:{username:o,password:c,imapHost:e.host,imapPort:e.port,imapTls:T.tls,imapStartTls:T.startTls,smtpHost:a.host,smtpPort:a.port,smtpTls:k.tls,smtpStartTls:k.startTls}},{onSuccess:d=>{if(u)return;const f=d.imapSuccess,P=w?d.smtpSuccess:!0;p({imapState:f?"ok":"failed",smtpState:w?"running":"ok",imapDetail:f?`Connected — ${e.host}:${e.port}`:d.imapError,phase:"running"}),j.push(window.setTimeout(()=>{if(u)return;const $=V=>{const A=V?.toLowerCase()??"";return A.includes("auth")||A.includes("login")||A.includes("535")||A.includes("credential")},U=!f&&$(d.imapError)||f&&w&&!d.smtpSuccess&&$(d.smtpError);p({imapState:f?"ok":"failed",smtpState:w?d.smtpSuccess?"ok":"failed":"ok",imapDetail:f?`Connected — ${e.host}:${e.port}`:d.imapError,smtpDetail:w?d.smtpSuccess?`Connected — ${a.host}:${a.port}`:d.smtpError:"Not set up — receive-only",rawError:f?w&&!d.smtpSuccess?d.smtpError:void 0:d.imapError,phase:f&&P?"success":U?"auth-failure":"network-failure"}),f&&P&&j.push(window.setTimeout(()=>{u||l()},800))},400))},onError:d=>{if(u)return;const f=d instanceof Error?d.message:"Connection failed";p({imapState:"failed",smtpState:"failed",imapDetail:f,smtpDetail:f,rawError:f,phase:"network-failure"})}}),()=>{u=!0;for(const d of j)window.clearTimeout(d)}},[I]);const{phase:y}=h;n.useEffect(()=>{const u=j=>{j.key==="Escape"&&(y==="auth-failure"?m():y==="network-failure"&&x())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[y,m,x]);const L=y==="auth-failure"?t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:m,children:g}),t.jsx(N,{variant:"primary",onClick:()=>S(u=>u+1),children:"Retry"})]}):y==="network-failure"?t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:x,children:v}),t.jsx(N,{variant:"primary",onClick:()=>S(u=>u+1),children:"Retry"})]}):y==="success"?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-2xs text-fg-subtle",children:"Connection verified"}),t.jsx(N,{variant:"primary",onClick:l,children:b})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-2xs text-fg-subtle",children:"Testing…"}),t.jsx("span",{})]});return t.jsx(H,{steps:r,activeStep:i,title:"Testing the connection",subtitle:`Checking ${s}`,footer:L,children:t.jsxs("div",{className:"divide-y divide-line",children:[t.jsx(q,{label:`IMAP — ${e.host}:${e.port}`,detail:h.imapDetail,state:h.imapState}),t.jsx(q,{label:w?`SMTP — ${a.host}:${a.port}`:"SMTP — sending",detail:w?h.smtpDetail:"Not set up — you can add sending later in Settings",state:h.smtpState}),(y==="auth-failure"||y==="network-failure")&&h.rawError&&t.jsxs("div",{className:"py-3",children:[y==="auth-failure"&&t.jsx("p",{className:"mb-2 text-xs text-fg-muted",children:"Check your password — many providers require an app password."}),t.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:h.rawError})]})]})})}export{q as C,ht as R,ut as S,H as W,pt as a,xt as b,vt as c,gt as d,dt as e,yt as f,ct as g,ft as h,D as s,et as u};
|
|
1
|
+
import{e as W,j as t,ax as F,aA as _,t as E,r as n,g as B,aO as R,ay as C,i as G,av as X,B as J,az as K,f as N}from"./index-CAZr9Hkk.js";import{C as Q}from"./card-5RNE1D9U.js";const ut=W("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function Y({url:r}){return t.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Stored encrypted, used only to connect to your mail server."," ",r?t.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"How to create an app password"}):t.jsx("span",{children:"Check your provider's help for app password instructions."})]})}function M({value:r,defaultValue:i,onValueChange:s,...e}){return s?t.jsxs(F,{value:r,onChange:a=>s(a.target.value),...e,children:[t.jsx("option",{value:"tls",children:"TLS/SSL"}),t.jsx("option",{value:"starttls",children:"STARTTLS"}),t.jsx("option",{value:"none",children:"None (insecure)"})]}):t.jsxs(F,{defaultValue:i??r,...e,children:[t.jsx("option",{value:"tls",children:"TLS/SSL"}),t.jsx("option",{value:"starttls",children:"STARTTLS"}),t.jsx("option",{value:"none",children:"None (insecure)"})]})}function D(r){return{tls:r==="tls",startTls:r==="starttls"}}function Z({steps:r,activeStep:i}){return t.jsx("ol",{className:"flex items-center gap-1",children:r.map((s,e)=>{const a=e<i,o=e===i;return t.jsxs("li",{className:"flex items-center gap-1",children:[e>0&&t.jsx("span",{className:"h-px w-5 bg-line","aria-hidden":!0}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:E("flex size-5 items-center justify-center rounded-full text-2xs font-semibold tabular-nums",a&&"bg-accent text-accent-fg",o&&"bg-accent-soft text-accent ring-1 ring-accent",!a&&!o&&"bg-surface-sunken text-fg-subtle"),children:a?t.jsx(_,{className:"size-3"}):e+1}),t.jsx("span",{className:E("hidden text-2xs sm:inline",o?"font-medium text-fg":"text-fg-subtle"),children:s})]})]},s)})})}function H({steps:r,activeStep:i,title:s,subtitle:e,children:a,footer:o,hideSteps:c}){return t.jsxs("div",{className:"flex min-h-dvh w-full flex-col items-center overflow-y-auto bg-canvas pb-[max(2rem,env(safe-area-inset-bottom,0px))] pl-[max(2rem,env(safe-area-inset-left,0px))] pr-[max(2rem,env(safe-area-inset-right,0px))] pt-[max(2rem,env(safe-area-inset-top,0px))] font-sans text-fg sm:pt-[30vh]",children:[!c&&t.jsx("div",{className:"mb-5 w-full max-w-xl",children:t.jsx(Z,{steps:r,activeStep:i})}),t.jsxs(Q,{raised:!0,className:"w-full max-w-xl",children:[t.jsxs("div",{className:"px-5 pt-5",children:[t.jsx("h1",{className:"text-xl font-semibold text-fg",children:s}),e&&t.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:e})]}),t.jsx("div",{className:"px-5 py-5",children:a}),o&&t.jsx("div",{className:"flex items-center justify-between gap-3 border-t border-line px-5 py-3",children:o})]})]})}const tt="Coming soon — use IMAP for now.";function pt({name:r,description:i,icon:s,comingSoon:e,selected:a,onSelect:o}){const[c,l]=n.useState(!1),m=()=>{if(o){o();return}e&&l(!0)};return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("button",{type:"button",onClick:m,"aria-disabled":e||void 0,className:E("flex flex-col items-start gap-2 rounded-sm border p-3 text-left transition-colors",a?"border-accent-2 bg-accent-2-soft":"border-line bg-surface hover:border-line-strong",e&&"opacity-55"),children:[t.jsx("span",{className:E("text-fg-muted",a&&"text-accent-2"),children:s}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-semibold text-fg",children:r}),e&&t.jsx("span",{className:"rounded-full bg-surface-sunken px-1.5 py-0.5 text-2xs text-fg-subtle",children:"soon"})]}),t.jsx("span",{className:"text-xs text-fg-subtle",children:i})]}),c&&t.jsx("p",{className:"text-2xs text-fg-subtle",children:tt})]})}function dt({legend:r,badge:i,host:s,port:e,security:a,readOnly:o,onHostChange:c,onPortChange:l,onSecurityChange:m,hostPlaceholder:x,portPlaceholder:g}){const v=n.useId(),b=n.useId(),h=n.useId();return t.jsxs("fieldset",{children:[t.jsxs("legend",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[r,i&&t.jsx(B,{tone:i.tone,children:i.label})]}),t.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-3 sm:grid-cols-[1fr_6rem_8rem] sm:gap-2",children:[t.jsxs("div",{children:[t.jsx(R,{htmlFor:v,children:"Host"}),c?t.jsx(C,{id:v,readOnly:o,value:s,onChange:p=>c(p.target.value),placeholder:x}):t.jsx(C,{id:v,readOnly:o,defaultValue:s,placeholder:x})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:b,children:"Port"}),l?t.jsx(C,{id:b,readOnly:o,value:e,onChange:p=>l(p.target.value),placeholder:g}):t.jsx(C,{id:b,readOnly:o,defaultValue:e,placeholder:g})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:h,children:"Security"}),m?t.jsx(M,{id:h,value:a,onValueChange:m}):t.jsx(M,{id:h,defaultValue:a})]})]})]})}function q({label:r,detail:i,state:s}){return t.jsxs("div",{className:"flex items-start gap-3 py-2",children:[t.jsxs("span",{className:E("mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full text-2xs",s==="ok"&&"bg-positive text-accent-fg",s==="failed"&&"bg-danger text-accent-fg",s==="running"&&"border border-accent text-accent",s==="pending"&&"border border-line text-fg-subtle"),children:[s==="ok"&&t.jsx(_,{className:"size-3"}),s==="failed"&&"!",s==="running"&&t.jsx("span",{className:"size-2 animate-pulse rounded-full bg-accent"})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:E("text-sm",s==="failed"?"font-medium text-danger":"text-fg"),children:r}),i&&t.jsx("div",{className:"mt-0.5 text-xs text-fg-subtle",children:i})]})]})}const et=(r,i)=>{const s=n.useRef(i);s.current=i,n.useEffect(()=>{if(!r)return;const e=()=>{document.visibilityState==="visible"&&s.current()};return document.addEventListener("visibilitychange",e),window.addEventListener("pageshow",e),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("pageshow",e)}},[r])},st=2e4,ht="Couldn't open Microsoft's sign-in page. Check your connection, and anything blocking redirects, then try again.",xt=r=>{const i=n.useRef(!1),s=n.useRef(!1),e=n.useRef(null),a=n.useRef(r);a.current=r;const o=n.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),c=n.useCallback(()=>{!i.current||!s.current||(o(),s.current=!1,a.current("returned"))},[o]);return n.useEffect(()=>{const l=()=>{s.current=!0,o()},m=()=>{document.visibilityState==="hidden"&&l()},x=g=>{g.persisted&&(l(),c())};return document.addEventListener("visibilitychange",m),window.addEventListener("pagehide",l),window.addEventListener("pageshow",x),()=>{document.removeEventListener("visibilitychange",m),window.removeEventListener("pagehide",l),window.removeEventListener("pageshow",x),o()}},[c,o]),et(!0,c),n.useCallback(()=>{i.current=!0,s.current=!1,o(),e.current=setTimeout(()=>{e.current=null,i.current=!1,s.current=!1,a.current("stalled")},st)},[o])},rt={"gmail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"googlemail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"outlook.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"hotmail.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"live.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"msn.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"icloud.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"me.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"mac.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"fastmail.com":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"fastmail.fm":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"yahoo.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"yahoo.co.uk":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"ymail.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"aol.com":{imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},source:"provider-table"},"zoho.com":{imap:{host:"imap.zoho.com",port:993,security:"tls"},smtp:{host:"smtp.zoho.com",port:465,security:"tls"},source:"provider-table"},"gmx.com":{imap:{host:"imap.gmx.com",port:993,security:"tls"},smtp:{host:"smtp.gmx.com",port:587,security:"starttls"},source:"provider-table"},"gmx.net":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"gmx.de":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"web.de":{imap:{host:"imap.web.de",port:993,security:"tls"},smtp:{host:"smtp.web.de",port:587,security:"starttls"},source:"provider-table"},"mail.com":{imap:{host:"imap.mail.com",port:993,security:"tls"},smtp:{host:"smtp.mail.com",port:465,security:"tls"},source:"provider-table"},"hey.com":{imap:{host:"imap.hey.com",port:993,security:"tls"},smtp:{host:"smtp.hey.com",port:465,security:"tls"},source:"provider-table"},"tutanota.com":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"tuta.io":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"posteo.de":{imap:{host:"posteo.de",port:993,security:"tls"},smtp:{host:"posteo.de",port:465,security:"tls"},source:"provider-table"},"runbox.com":{imap:{host:"imap.runbox.com",port:993,security:"tls"},smtp:{host:"smtp.runbox.com",port:587,security:"starttls"},source:"provider-table"},"mailbox.org":{imap:{host:"imap.mailbox.org",port:993,security:"tls"},smtp:{host:"smtp.mailbox.org",port:465,security:"tls"},source:"provider-table"},"hushmail.com":{imap:{host:"imap.hushmail.com",port:993,security:"tls"},smtp:{host:"smtp.hushmail.com",port:465,security:"tls"},source:"provider-table"}},ot={"gmail.com":"https://support.google.com/accounts/answer/185833","googlemail.com":"https://support.google.com/accounts/answer/185833","yahoo.com":"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html","icloud.com":"https://support.apple.com/en-us/102654","me.com":"https://support.apple.com/en-us/102654","mac.com":"https://support.apple.com/en-us/102654","fastmail.com":"https://www.fastmail.help/hc/en-us/articles/360058752854","fastmail.fm":"https://www.fastmail.help/hc/en-us/articles/360058752854","outlook.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","hotmail.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","zoho.com":"https://help.zoho.com/portal/en/kb/zoho-mail/client-configuration/imap-access/articles/zoho-mail-app-passwords"};function O(r){try{const s=new DOMParser().parseFromString(r,"application/xml");if(s.querySelector("parsererror"))return null;const e=s.querySelectorAll("incomingServer[type='imap']"),a=s.querySelectorAll("outgoingServer[type='smtp']");if(!e.length||!a.length)return null;const o=e[0],c=a[0],l=o.querySelector("hostname")?.textContent?.trim(),m=o.querySelector("port")?.textContent?.trim(),x=o.querySelector("socketType")?.textContent?.trim().toUpperCase(),g=c.querySelector("hostname")?.textContent?.trim(),v=c.querySelector("port")?.textContent?.trim(),b=c.querySelector("socketType")?.textContent?.trim().toUpperCase();if(!l||!m||!g||!v)return null;const h=p=>p==="SSL"||p==="TLS"||p==="SSL/TLS"?"tls":p==="STARTTLS"?"starttls":"none";return{imap:{host:l,port:Number.parseInt(m,10),security:h(x)},smtp:{host:g,port:Number.parseInt(v,10),security:h(b)},source:"mozilla-autoconfig"}}catch{return null}}async function it(r,i){try{const s=`https://autoconfig.thunderbird.net/v1.1/${r}`,e=await fetch(s,{signal:i});if(!e.ok)return null;const a=await e.text(),o=O(a);return o||null}catch{return null}}async function at(r,i){try{const s=`https://autoconfig.${r}/mail/config-v1.1.xml`,e=await fetch(s,{signal:i});if(!e.ok)return null;const a=await e.text(),o=O(a);return o?{...o,source:"domain-autoconfig"}:null}catch{return null}}function nt(r){return{imap:{host:`imap.${r}`,port:993,security:"tls"},smtp:{host:`smtp.${r}`,port:587,security:"starttls"},source:"heuristic"}}async function ft(r,i=1500){const s=r.indexOf("@");if(s===-1)return null;const e=r.slice(s+1).toLowerCase();if(!e)return null;const a=rt[e];if(a)return a;const o=new AbortController,c=setTimeout(()=>o.abort(),i);try{const l=await it(e,o.signal);if(l)return l;const m=await at(e,o.signal);if(m)return m}finally{clearTimeout(c)}return nt(e)}function yt(r){const i=r.indexOf("@");return i===-1?"Looking up server settings…":`Looking up settings for ${r.slice(i+1)}…`}function ct(r){const i=r.indexOf("@");if(i===-1)return;const s=r.slice(i+1).toLowerCase();return ot[s]}function gt({steps:r,activeStep:i,title:s,subtitle:e,email:a,username:o,password:c,notice:l,error:m,continueLabel:x="Test connection",backLabel:g="Back",onContinue:v,onBack:b,onChange:h}){const[p,I]=n.useState(o||a),[S,w]=n.useState(c),[T,k]=n.useState(null),z=ct(a),y=p.trim()!==""&&S.trim()!=="";n.useEffect(()=>{h(p,S)},[p,S,h]);const L=n.useCallback(()=>{if(!y){k("Enter your username and password.");return}k(null),v()},[y,v]);return n.useEffect(()=>{const u=j=>{j.key==="Enter"&&L(),j.key==="Escape"&&b()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[L,b]),t.jsx(H,{steps:r,activeStep:i,title:s,subtitle:e,footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:b,children:g}),t.jsx(N,{variant:"primary",onClick:L,children:x})]}),children:t.jsxs("div",{className:"space-y-3",children:[m&&t.jsx(J,{tone:"danger",children:m}),T&&t.jsx("div",{className:"rounded-md bg-danger-soft px-3 py-2 text-sm text-danger",children:T}),l,t.jsxs("div",{children:[t.jsx(R,{htmlFor:"credentials-username",children:"Username"}),t.jsx(C,{id:"credentials-username",value:p,onChange:u=>{I(u.target.value),k(null)},autoComplete:"username"})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:"credentials-password",children:"Password or app password"}),t.jsx(K,{id:"credentials-password",value:S,onChange:u=>{w(u.target.value),k(null)},autoComplete:"current-password"})]}),t.jsx(Y,{url:z})]})})}function vt({steps:r,activeStep:i,email:s,imapConfig:e,smtpConfig:a,username:o,password:c,onSuccess:l,onBackToCredentials:m,onBackToServers:x,credentialsBackLabel:g="Back to credentials",serversBackLabel:v="Back to servers",successLabel:b="Start syncing"}){const[h,p]=n.useState({imapState:"running",smtpState:"pending",phase:"running"}),[I,S]=n.useState(0),w=a.host.trim()!=="",T=D(e.security),k=D(a.security),z=G({...X()});n.useEffect(()=>{let u=!1;const j=[];return p({imapState:"running",smtpState:"pending",phase:"running"}),z.mutate({body:{username:o,password:c,imapHost:e.host,imapPort:e.port,imapTls:T.tls,imapStartTls:T.startTls,smtpHost:a.host,smtpPort:a.port,smtpTls:k.tls,smtpStartTls:k.startTls}},{onSuccess:d=>{if(u)return;const f=d.imapSuccess,P=w?d.smtpSuccess:!0;p({imapState:f?"ok":"failed",smtpState:w?"running":"ok",imapDetail:f?`Connected — ${e.host}:${e.port}`:d.imapError,phase:"running"}),j.push(window.setTimeout(()=>{if(u)return;const $=V=>{const A=V?.toLowerCase()??"";return A.includes("auth")||A.includes("login")||A.includes("535")||A.includes("credential")},U=!f&&$(d.imapError)||f&&w&&!d.smtpSuccess&&$(d.smtpError);p({imapState:f?"ok":"failed",smtpState:w?d.smtpSuccess?"ok":"failed":"ok",imapDetail:f?`Connected — ${e.host}:${e.port}`:d.imapError,smtpDetail:w?d.smtpSuccess?`Connected — ${a.host}:${a.port}`:d.smtpError:"Not set up — receive-only",rawError:f?w&&!d.smtpSuccess?d.smtpError:void 0:d.imapError,phase:f&&P?"success":U?"auth-failure":"network-failure"}),f&&P&&j.push(window.setTimeout(()=>{u||l()},800))},400))},onError:d=>{if(u)return;const f=d instanceof Error?d.message:"Connection failed";p({imapState:"failed",smtpState:"failed",imapDetail:f,smtpDetail:f,rawError:f,phase:"network-failure"})}}),()=>{u=!0;for(const d of j)window.clearTimeout(d)}},[I]);const{phase:y}=h;n.useEffect(()=>{const u=j=>{j.key==="Escape"&&(y==="auth-failure"?m():y==="network-failure"&&x())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[y,m,x]);const L=y==="auth-failure"?t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:m,children:g}),t.jsx(N,{variant:"primary",onClick:()=>S(u=>u+1),children:"Retry"})]}):y==="network-failure"?t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:x,children:v}),t.jsx(N,{variant:"primary",onClick:()=>S(u=>u+1),children:"Retry"})]}):y==="success"?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-2xs text-fg-subtle",children:"Connection verified"}),t.jsx(N,{variant:"primary",onClick:l,children:b})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-2xs text-fg-subtle",children:"Testing…"}),t.jsx("span",{})]});return t.jsx(H,{steps:r,activeStep:i,title:"Testing the connection",subtitle:`Checking ${s}`,footer:L,children:t.jsxs("div",{className:"divide-y divide-line",children:[t.jsx(q,{label:`IMAP — ${e.host}:${e.port}`,detail:h.imapDetail,state:h.imapState}),t.jsx(q,{label:w?`SMTP — ${a.host}:${a.port}`:"SMTP — sending",detail:w?h.smtpDetail:"Not set up — you can add sending later in Settings",state:h.smtpState}),(y==="auth-failure"||y==="network-failure")&&h.rawError&&t.jsxs("div",{className:"py-3",children:[y==="auth-failure"&&t.jsx("p",{className:"mb-2 text-xs text-fg-muted",children:"Check your password — many providers require an app password."}),t.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:h.rawError})]})]})})}export{q as C,ht as R,ut as S,H as W,pt as a,xt as b,vt as c,gt as d,dt as e,yt as f,ct as g,ft as h,D as s,et as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./index-
|
|
1
|
+
import{e}from"./index-CAZr9Hkk.js";const a=e("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);export{a as D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as X,i as Z,b7 as ee,b8 as te,r as x,b9 as se,j as t,ba as ae,bb as ie,L as R,f as N,bc as ne,aH as re,g as oe,bd as le,be as ce,a2 as de,c as P,G as me,bf as ue,ad as pe,ae as xe,bg as fe,aV as he,u as ge,d as be,aK as ve,aM as ye}from"./index-IslFt5rW.js";import{S as je}from"./settings-screen-BjOH8tBv.js";import{B as Ne}from"./bottom-sheet-ICAMxSzN.js";import{u as Ce,a as Se}from"./useLabels-hkgnUlmR.js";import{b as Me,N as S,p as Fe,u as Ie,r as we,a as Ee,S as L,c as Oe,n as De,f as Ae,d as Le,e as ke,g as Te}from"./useFilters-Dxt-BW5R.js";import{C as A}from"./circle-check-B_KN_2Gx.js";import{E as $}from"./ErrorState-cRFUQiJa.js";import"./avatar-CwtUIkH9.js";import"./chevron-left-BZyVDk26.js";import"./menu-DyI2BxNU.js";import"./circle-help-ffqeCP37.js";const Re=(e,s)=>{const r=X(),i=Z({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:Me(e)}),s&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:s}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!s||c({path:{accountId:e,filterId:s},body:d})},[e,s,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},Pe=(e,s=!1)=>({clauses:e.literalClauses.map((i,c)=>({id:`clause-${c}`,field:i.field,value:i.value})),matchOperator:e.matchOperator==="And"?"all":"any",widen:e.hasAnchor?{anchorCount:1,...s?{inactive:!0}:{}}:void 0,moveMailboxId:e.actionMailboxId!==S?e.actionMailboxId:void 0,labelId:e.actionLabelId!==S?e.actionLabelId:void 0,scope:e.scope==="Temporary"?"until":"standing",until:e.scope==="Temporary"?$e(e.expiresAt):void 0,name:e.name}),$e=e=>{if(!e)return"";const s=Date.parse(e);if(Number.isNaN(s))return"";const r=new Date(s),i=c=>String(c).padStart(2,"0");return`${r.getFullYear()}-${i(r.getMonth()+1)}-${i(r.getDate())}`},k=e=>JSON.stringify({clauses:e.clauses.map(s=>[s.field,s.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),z=(e,s)=>k(e)!==k(s),T=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),_=(e,s)=>T(e)!==T(s),ze=(e,s)=>{const r={},i=(e.name??"").trim();return i!==(s.name??"").trim()&&(r.name=i),z(e,s)&&(r.matchOperator=e.matchOperator==="all"?"And":"Or",r.literalClauses=e.clauses.map(c=>({field:c.field,value:c.value})),r.actionMailboxId=e.moveMailboxId??S,r.actionLabelId=e.labelId??S),_(e,s)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=Fe(e.until??""))),r};function _e({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>Pe(s,g),[s,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,v]=x.useState(!1),F=x.useRef(0),{count:C}=Ie(e,we(n)),j=Re(e,s.filterId),b=Ee(e),{createFolderIn:M}=se(e),{createLabel:E}=Ce(e),I=async o=>{const a=await E(o);return{id:a.labelId,name:a.name,color:a.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),w=o=>{const a=n.clauses.find(y=>y.id===o);a&&u({mode:"edit",clauseId:o,draft:{field:a.field,value:a.value}})},O=o=>u(a=>a&&{...a,draft:{...a.draft,field:o}}),K=o=>u(a=>a&&{...a,draft:{...a.draft,value:o}}),U=()=>{if(!m)return;const o=m.draft.field,a=De(o,m.draft.value);a!==""&&(l(y=>m.mode==="edit"&&m.clauseId?{...y,clauses:y.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:a}:D)}:(F.current+=1,{...y,clauses:[...y.clauses,{id:`new-${F.current}`,field:o,value:a}]})),u(void 0))},B=o=>l(a=>({...a,clauses:a.clauses.filter(y=>y.id!==o)})),G=o=>l(a=>({...a,matchOperator:o})),H=o=>l(a=>({...a,moveMailboxId:o||void 0})),Q=o=>l(a=>({...a,labelId:o||void 0})),V=o=>l(a=>({...a,name:o})),J=o=>l(a=>({...a,scope:o,until:o==="until"?a.until:void 0})),q=o=>l(a=>({...a,until:o})),W=()=>{const o=z(n,f)||_(n,f),a=ze(n,f);if(Object.keys(a).length===0){d();return}v(o),j.updateFilter(a)},Y=()=>b.start(Oe(n));return b.isStarting||b.isRunning||b.isDone?t.jsx(Ge,{progress:b.progress,isDone:b.isDone,onClose:d}):j.isPending?t.jsx(Ke,{}):j.isError?t.jsx(He,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Be,{preview:ae(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:Y,onClose:d}):t.jsx(Ue,{onClose:d}):t.jsx(ie,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:w,onRemoveClause:B,onChangeDraftField:O,onChangeDraftValue:K,onSubmitClause:U,onCancelClause:()=>u(void 0),onChangeMatchOperator:G,onChangeMove:H,onCreateFolder:M,onChangeLabel:Q,onCreateLabel:I,onChangeName:V,onChangeScope:J,onChangeUntil:q,onCommit:W,onCancel:d})}function Ke(){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function Ue({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),t.jsx(N,{variant:"primary",onClick:e,className:"mt-2",children:"Done"})]})}function Be({preview:e,blocked:s,onReapply:r,onClose:i}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),t.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",e," — move the mail already in your mailbox too?"]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:r,disabled:s,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Ge({progress:e,isDone:s,onClose:r}){const i=e.state==="Failed";return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[s?i?t.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):t.jsx(A,{className:"size-8 text-positive"}):t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),!s&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),s&&!i&&t.jsxs("div",{className:"text-sm text-fg",children:[t.jsx("p",{className:"font-medium",children:"Done"}),t.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[e.appliedCount," of ",e.matchedCount," moved",e.failedCount>0?` · ${e.failedCount} failed`:"","."]})]}),s&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),s&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function He({onRetry:e,onClose:s}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:e,children:"Try again"}),t.jsx(N,{variant:"ghost",onClick:s,children:"Not now"})]})]})}function Qe({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=ne(),n=t.jsx(_e,{accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(re,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(Ne,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Ve({filters:e,mailboxName:s,labelById:r,onEdit:i,onDelete:c,deletingFilterId:g,semanticUnavailable:d=!1,now:f=Date.now()}){return e.length===0?t.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):t.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:e.map(n=>{const l=Ae(n,f),m=l==="Expired",u=n.actionMailboxId!==S?s(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,v=Le(n.expiresAt);return t.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:()=>i(n.filterId),"aria-label":`Edit filter ${n.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`truncate text-sm font-medium ${m?"text-fg-muted":"text-fg"}`,children:n.name}),t.jsx(oe,{tone:m?"neutral":"positive",dot:!0,children:l})]}),t.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[u?`Moves matches to ${u}`:"No move action",n.scope==="Temporary"&&v?m?` · expired ${v}`:` · until ${v}`:n.scope==="Standing"?" · always":""]}),(n.hasAnchor||h)&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[n.hasAnchor&&t.jsx(le,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(ce,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(de,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Je=t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",t.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",t.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),t.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."})]});function qe({account:e}){const s=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=ke(s),{deleteFilter:f,deletingFilterId:n}=Te(s),[l,m]=x.useState(),{data:u}=P({...me({path:{accountId:s}}),staleTime:1/0}),h=ue(),v=x.useMemo(()=>pe(e.folderAppointments),[e.folderAppointments]),F=x.useCallback(p=>{const w=u?.items.find(O=>O.mailboxId===p);if(w)return xe(w,v.get(p),h)},[u?.items,v,h]),C=x.useMemo(()=>fe({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=he(u?.items??[]),{labels:b}=Se(s),M=x.useMemo(()=>b.map(p=>({id:p.labelId,name:p.name,color:p.color})),[b]),E=x.useMemo(()=>new Map(M.map(p=>[p.id,p])),[M]),I=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),I&&t.jsx(Qe,{accountId:s,filter:I,folders:C,delimiter:j,labels:M,onClose:()=>m(void 0)}),i?t.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${e.email}`}):c?t.jsx($,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Ve,{filters:r,mailboxName:F,labelById:E,onEdit:m,onDelete:f,deletingFilterId:n})]})}function ot(){const e=ge(),[s,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=P(be()),n=l=>{const m=ye[l];m&&e({to:m})};return t.jsx(je,{items:ve,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Je,helpOpen:s,onToggleHelp:()=>r(l=>!l),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:c?t.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):g?t.jsx($,{title:"Couldn't load accounts",error:d,onRetry:()=>{f()}}):i.accounts.length===0?t.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):t.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>t.jsx(qe,{account:l},l.accountId))})})}export{qe as AccountFilters,ot as component};
|
|
1
|
+
import{h as X,i as Z,b7 as ee,b8 as te,r as x,b9 as se,j as t,ba as ae,bb as ie,L as R,f as N,bc as ne,aH as re,g as oe,bd as le,be as ce,a2 as de,c as P,G as me,bf as ue,ad as pe,ae as xe,bg as fe,aV as he,u as ge,d as be,aK as ve,aM as ye}from"./index-CAZr9Hkk.js";import{S as je}from"./settings-screen-d7D3e6bb.js";import{B as Ne}from"./bottom-sheet-B5NX4d94.js";import{u as Ce,a as Se}from"./useLabels-B9y3vyS7.js";import{b as Me,N as S,p as Fe,u as Ie,r as we,a as Ee,S as L,c as Oe,n as De,f as Ae,d as Le,e as ke,g as Te}from"./useFilters-bk7-84hg.js";import{C as A}from"./circle-check-D5gzkegt.js";import{E as $}from"./ErrorState-BngYP48L.js";import"./avatar-TGnSyTcr.js";import"./chevron-left-FAjAhXYV.js";import"./menu-C9Jej5w7.js";import"./circle-help-BvOeRAjQ.js";const Re=(e,s)=>{const r=X(),i=Z({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:Me(e)}),s&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:s}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!s||c({path:{accountId:e,filterId:s},body:d})},[e,s,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},Pe=(e,s=!1)=>({clauses:e.literalClauses.map((i,c)=>({id:`clause-${c}`,field:i.field,value:i.value})),matchOperator:e.matchOperator==="And"?"all":"any",widen:e.hasAnchor?{anchorCount:1,...s?{inactive:!0}:{}}:void 0,moveMailboxId:e.actionMailboxId!==S?e.actionMailboxId:void 0,labelId:e.actionLabelId!==S?e.actionLabelId:void 0,scope:e.scope==="Temporary"?"until":"standing",until:e.scope==="Temporary"?$e(e.expiresAt):void 0,name:e.name}),$e=e=>{if(!e)return"";const s=Date.parse(e);if(Number.isNaN(s))return"";const r=new Date(s),i=c=>String(c).padStart(2,"0");return`${r.getFullYear()}-${i(r.getMonth()+1)}-${i(r.getDate())}`},k=e=>JSON.stringify({clauses:e.clauses.map(s=>[s.field,s.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),z=(e,s)=>k(e)!==k(s),T=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),_=(e,s)=>T(e)!==T(s),ze=(e,s)=>{const r={},i=(e.name??"").trim();return i!==(s.name??"").trim()&&(r.name=i),z(e,s)&&(r.matchOperator=e.matchOperator==="all"?"And":"Or",r.literalClauses=e.clauses.map(c=>({field:c.field,value:c.value})),r.actionMailboxId=e.moveMailboxId??S,r.actionLabelId=e.labelId??S),_(e,s)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=Fe(e.until??""))),r};function _e({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>Pe(s,g),[s,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,v]=x.useState(!1),F=x.useRef(0),{count:C}=Ie(e,we(n)),j=Re(e,s.filterId),b=Ee(e),{createFolderIn:M}=se(e),{createLabel:E}=Ce(e),I=async o=>{const a=await E(o);return{id:a.labelId,name:a.name,color:a.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),w=o=>{const a=n.clauses.find(y=>y.id===o);a&&u({mode:"edit",clauseId:o,draft:{field:a.field,value:a.value}})},O=o=>u(a=>a&&{...a,draft:{...a.draft,field:o}}),K=o=>u(a=>a&&{...a,draft:{...a.draft,value:o}}),U=()=>{if(!m)return;const o=m.draft.field,a=De(o,m.draft.value);a!==""&&(l(y=>m.mode==="edit"&&m.clauseId?{...y,clauses:y.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:a}:D)}:(F.current+=1,{...y,clauses:[...y.clauses,{id:`new-${F.current}`,field:o,value:a}]})),u(void 0))},B=o=>l(a=>({...a,clauses:a.clauses.filter(y=>y.id!==o)})),G=o=>l(a=>({...a,matchOperator:o})),H=o=>l(a=>({...a,moveMailboxId:o||void 0})),Q=o=>l(a=>({...a,labelId:o||void 0})),V=o=>l(a=>({...a,name:o})),J=o=>l(a=>({...a,scope:o,until:o==="until"?a.until:void 0})),q=o=>l(a=>({...a,until:o})),W=()=>{const o=z(n,f)||_(n,f),a=ze(n,f);if(Object.keys(a).length===0){d();return}v(o),j.updateFilter(a)},Y=()=>b.start(Oe(n));return b.isStarting||b.isRunning||b.isDone?t.jsx(Ge,{progress:b.progress,isDone:b.isDone,onClose:d}):j.isPending?t.jsx(Ke,{}):j.isError?t.jsx(He,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Be,{preview:ae(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:Y,onClose:d}):t.jsx(Ue,{onClose:d}):t.jsx(ie,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:w,onRemoveClause:B,onChangeDraftField:O,onChangeDraftValue:K,onSubmitClause:U,onCancelClause:()=>u(void 0),onChangeMatchOperator:G,onChangeMove:H,onCreateFolder:M,onChangeLabel:Q,onCreateLabel:I,onChangeName:V,onChangeScope:J,onChangeUntil:q,onCommit:W,onCancel:d})}function Ke(){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function Ue({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),t.jsx(N,{variant:"primary",onClick:e,className:"mt-2",children:"Done"})]})}function Be({preview:e,blocked:s,onReapply:r,onClose:i}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),t.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",e," — move the mail already in your mailbox too?"]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:r,disabled:s,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Ge({progress:e,isDone:s,onClose:r}){const i=e.state==="Failed";return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[s?i?t.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):t.jsx(A,{className:"size-8 text-positive"}):t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),!s&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),s&&!i&&t.jsxs("div",{className:"text-sm text-fg",children:[t.jsx("p",{className:"font-medium",children:"Done"}),t.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[e.appliedCount," of ",e.matchedCount," moved",e.failedCount>0?` · ${e.failedCount} failed`:"","."]})]}),s&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),s&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function He({onRetry:e,onClose:s}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:e,children:"Try again"}),t.jsx(N,{variant:"ghost",onClick:s,children:"Not now"})]})]})}function Qe({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=ne(),n=t.jsx(_e,{accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(re,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(Ne,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Ve({filters:e,mailboxName:s,labelById:r,onEdit:i,onDelete:c,deletingFilterId:g,semanticUnavailable:d=!1,now:f=Date.now()}){return e.length===0?t.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):t.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:e.map(n=>{const l=Ae(n,f),m=l==="Expired",u=n.actionMailboxId!==S?s(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,v=Le(n.expiresAt);return t.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:()=>i(n.filterId),"aria-label":`Edit filter ${n.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`truncate text-sm font-medium ${m?"text-fg-muted":"text-fg"}`,children:n.name}),t.jsx(oe,{tone:m?"neutral":"positive",dot:!0,children:l})]}),t.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[u?`Moves matches to ${u}`:"No move action",n.scope==="Temporary"&&v?m?` · expired ${v}`:` · until ${v}`:n.scope==="Standing"?" · always":""]}),(n.hasAnchor||h)&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[n.hasAnchor&&t.jsx(le,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(ce,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(de,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Je=t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",t.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",t.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),t.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."})]});function qe({account:e}){const s=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=ke(s),{deleteFilter:f,deletingFilterId:n}=Te(s),[l,m]=x.useState(),{data:u}=P({...me({path:{accountId:s}}),staleTime:1/0}),h=ue(),v=x.useMemo(()=>pe(e.folderAppointments),[e.folderAppointments]),F=x.useCallback(p=>{const w=u?.items.find(O=>O.mailboxId===p);if(w)return xe(w,v.get(p),h)},[u?.items,v,h]),C=x.useMemo(()=>fe({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=he(u?.items??[]),{labels:b}=Se(s),M=x.useMemo(()=>b.map(p=>({id:p.labelId,name:p.name,color:p.color})),[b]),E=x.useMemo(()=>new Map(M.map(p=>[p.id,p])),[M]),I=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),I&&t.jsx(Qe,{accountId:s,filter:I,folders:C,delimiter:j,labels:M,onClose:()=>m(void 0)}),i?t.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${e.email}`}):c?t.jsx($,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Ve,{filters:r,mailboxName:F,labelById:E,onEdit:m,onDelete:f,deletingFilterId:n})]})}function ot(){const e=ge(),[s,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=P(be()),n=l=>{const m=ye[l];m&&e({to:m})};return t.jsx(je,{items:ve,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Je,helpOpen:s,onToggleHelp:()=>r(l=>!l),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:c?t.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):g?t.jsx($,{title:"Couldn't load accounts",error:d,onRetry:()=>{f()}}):i.accounts.length===0?t.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):t.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>t.jsx(qe,{account:l},l.accountId))})})}export{qe as AccountFilters,ot as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o,O as i}from"./index-CAZr9Hkk.js";import{a as m}from"./MailShell-D41cTX_1.js";import{F as r}from"./FlaggedPane-Oe_MykTl.js";import{d as p}from"./search-token-index-DBjqEp4z.js";import{u as e}from"./search-mirror-Cp9GXxZs.js";import"./FullCompose-Bo00Kn2C.js";import"./ErrorState-BngYP48L.js";import"./index-D_w105Kd.js";import"./useMessageBodyContent-D9gi_wLu.js";import"./useSignature-NMPmEDy2.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Crqb3lBu.js";import"./sections-D83I4ptW.js";import"./format-6QqrpvJS.js";import"./confirm-dialog-DvZrfsRk.js";import"./useSearchTokenContext-05ksrHjq.js";import"./kbd-tEhcU6de.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-BZ43JcTd.js";import"./attachment-file-DBm19MjU.js";import"./mail-DkcWxcwo.js";import"./avatar-TGnSyTcr.js";import"./EmptyState-DUIY0X8d.js";import"./download-DJTw5tRx.js";import"./useLayoutTier-DjDOYqv6.js";import"./shield-check-kxi3CCdE.js";import"./useFilters-bk7-84hg.js";import"./useQueries-DZidh9HG.js";import"./minus-BfMTSSD5.js";import"./clock-BDFPxBQY.js";import"./menu-C9Jej5w7.js";import"./MailViewChrome-Bfnh98rg.js";import"./wizard-selection-B1bng5Jq.js";function G(){const t=p();return e({to:"/mail/flagged"}),o.jsx(r,{thread:t,children:o.jsx(m,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!t})})}export{G as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./index-
|
|
1
|
+
import{j as r}from"./index-CAZr9Hkk.js";import{E as o}from"./ErrorState-BngYP48L.js";const l=({error:t,reset:e})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(o,{title:"Couldn't load your starred mail",error:t,onRetry:e})});export{l as errorComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,f as N,a2 as q,bh as W,r as c,aH as Y,X,aO as he,ay as Z,a0 as xe,aR as Q,bi as fe,ax as pe,aA as ge,B as L,aQ as be,bj as ve,h as J,N as ee,o as se,bk as je,bl as ye,aN as Ne,M as ke,bm as Ce,bn as _,bo as we,bp as Se,bq as te,br as Me,bs as H,b9 as ae,bf as re,bg as Ie,ae as B,ad as ne,L as G,bt as V,bu as Ae,aq as Ee,bv as De,u as Oe,c as ie,d as Te,aK as Re,aM as Fe,G as Pe,i as U,bw as $e,bx as ze,by as Le,aW as _e,bz as qe,bA as Be}from"./index-IslFt5rW.js";import{P as Ge}from"./pencil-DfTwfu4l.js";import{S as Ke}from"./settings-screen-BjOH8tBv.js";import{E as oe}from"./ErrorState-cRFUQiJa.js";import"./avatar-CwtUIkH9.js";import"./chevron-left-BZyVDk26.js";import"./menu-DyI2BxNU.js";import"./circle-help-ffqeCP37.js";const Qe=({label:s,onRename:t,onDelete:a,deleteBlockedReason:o,renameLabel:m=u=>`Rename ${u}`,deleteLabel:r=u=>`Delete ${u}`})=>{const u=o?`${r(s)} — ${o}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Ge,{className:"size-3.5"}),"aria-label":m(s),onClick:t}),e.jsx("span",{title:o,children:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(q,{className:"size-3.5"}),"aria-label":u,disabled:o!==void 0,onClick:a})})]})},He=({folders:s,onRename:t,onDelete:a,onCreateFolder:o,delimiter:m,labels:r})=>{const u=new Map(s.map(l=>[l.id,l]));return e.jsx(W,{folders:s,onCreateFolder:o,delimiter:m,labels:{treeAriaLabel:"Your folders",optionLabel:l=>l.label,...r},rowActions:l=>{const i=u.get(l.id);return i?e.jsx(Qe,{label:i.label,deleteBlockedReason:i.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>t(i),onDelete:()=>a(i)}):null}})},Ve=({open:s,folderLabel:t,defaultLabel:a,name:o,onNameChange:m,onSubmit:r,onClose:u,pending:l=!1,error:i})=>{const d=c.useId(),g=`Rename ${t}`;return s?e.jsxs(Y,{open:s,onClose:u,title:g,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:g}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:u,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(he,{htmlFor:d,children:"Folder name"}),e.jsx(Z,{id:d,value:o,placeholder:a,onChange:p=>m(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),r())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:a}),"."]}),i&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:i})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:u,children:"Cancel"}),e.jsx(N,{variant:"primary",size:"sm",onClick:r,disabled:l,children:l?"Saving…":"Save name"})]})]}):null},Ue=["inbox","drafts","sent","archive","junk","trash"],K="",We={mailboxId:null,source:"None"};function Ye(s){const t=s.messageCount===1?"msg":"msgs";return`${Q(s.providerPath,s.hierarchyDelimiter)} · ${s.messageCount} ${t}`}const le=s=>`${s} ${s===1?"message":"messages"}`,Xe=(s,t)=>s==="Appointed"?"Chosen by you":s==="Flagged"?`The mail server marks it as ${t}`:s==="Reserved"?"The account's own INBOX":"Matched by name, not confirmed";function Ze({role:s,folders:t,appointment:a,displayName:o,onAppoint:m,onRename:r}){const[u,l]=c.useState(o),i=c.useRef(null),d=c.useRef(!1),g=c.useId(),{mailboxId:p,source:v,staleFolderPath:j}=a,h=t.find(y=>y.mailboxId===p)??null,f=be(s),O=h!=null&&u.trim()!==o.trim();c.useEffect(()=>{!d.current||v==="Proposed"||(d.current=!1,i.current?.focus())},[v]);const I=(()=>{if(v==="None"){const y=s==="trash"?" Deleting mail needs one.":"";return e.jsx("span",{id:g,className:"pl-[7.5rem] text-xs text-fg-muted",children:`Not set — pick the folder this account uses for ${f}.${y}`})}return v==="Stale"||!h?null:e.jsx("span",{id:g,className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:h.providerPath,children:`${Xe(v,f)} · ${h.providerPath} · ${le(h.messageCount)}`})})(),w=s==="trash"?" Deleting mail is stopped until you pick another one.":h?` reader is using ${Q(h.providerPath,h.hierarchyDelimiter)} instead.`:"",D=`The folder you chose for ${f}${j?` — ${j} —`:""} is gone from the mail server.${w}`;return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[fe(s),f]}),e.jsxs(pe,{ref:i,className:"w-56 shrink-0",value:p??K,"aria-label":`Folder for ${f}`,"aria-describedby":I||v==="Stale"?g:void 0,onChange:y=>m(s,y.target.value===K?null:y.target.value),children:[e.jsx("option",{value:K,children:"None"}),t.map(y=>e.jsx("option",{value:y.mailboxId,children:Ye(y)},y.mailboxId))]}),v==="Proposed"&&h&&e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{d.current=!0,m(s,h.mailboxId)},children:`Set as ${f}`}),h&&e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"flex-1",value:u,placeholder:f,"aria-label":`Display name for ${f}`,onChange:y=>l(y.target.value)}),O&&e.jsx(N,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(ge,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(h.mailboxId,u)})]})]}),I,v==="Stale"&&e.jsx(L,{tone:"warning",variant:"soft",className:"ml-[7.5rem]",children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:g,className:"flex-1",children:D}),e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>i.current?.focus(),children:"Pick a folder"})]})})]})}function Je(){return e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]})}function es({accountEmail:s,folders:t,appointments:a,displayNames:o={},onAppoint:m,onRename:r}){const u=new Set(Object.values(a).map(i=>i.mailboxId).filter(i=>i!=null)),l=t.filter(i=>!u.has(i.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each row says where its answer came from — your choice, the mail server's own flag, or a name reader matched."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Ue.map(i=>{const d=a[i]??We;return e.jsx(Ze,{role:i,folders:t,appointment:d,displayName:d.mailboxId?o[d.mailboxId]??"":"",onAppoint:m,onRename:r},i)})}),l.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:l.map(i=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(xe,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:Q(i.providerPath,i.hierarchyDelimiter)}),e.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:le(i.messageCount)})]},i.mailboxId))})]})]})}const ss=12e4,ts=2e3,as="This folder is no longer in the account's folder list, so nothing was deleted.",ce=(s,t)=>{const a=s.find(o=>o.mailboxId===t);if(!a)throw new Error(as);return a},rs=(s,t)=>ce(s,t).lastSyncedAt??0;async function ns({readMailboxes:s,mailboxId:t,since:a,signal:o,segmentMs:m=ss,pollIntervalMs:r=ts,delay:u=ve,now:l=Date.now}){const i=l()+m;for(;;){o?.throwIfAborted();const d=ce(await s(),t);if((d.lastSyncedAt??0)>a)return{status:"fresh",messageCount:d.messagesTotal};if(l()>=i)return{status:"pending"};await u(r,o)}}const de=50,is=s=>s instanceof Error?s.message:"Something went wrong.",$=s=>s.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:is(t)})),os=async(s,t,a,o)=>{const m=[];let r;for(let u=0;u<de;u+=1){if(o.aborted)return m;const{data:l}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const i of l.items)if(!i.isDeleted&&!t.has(i.messageId)&&!m.includes(i.messageId)&&(m.push(i.messageId),m.length>=a))return m;if(!l.continuationToken)break;r=l.continuationToken}return m},ls=async(s,t)=>{let a=0,o;for(let m=0;m<de;m+=1){if(t.aborted)return a;const{data:r}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:o},throwOnError:!0});for(const u of r.items)u.isDeleted||(a+=1);if(!r.continuationToken)break;o=r.continuationToken}return a};function cs({accountId:s,mailboxId:t,onDeleted:a}){const o=J(),[m,r]=c.useState("idle"),[u,l]=c.useState(null),[i,d]=c.useState(),[g,p]=c.useState(),v=c.useRef(null),j=c.useRef(void 0),h=c.useCallback(()=>{o.invalidateQueries({queryKey:ee({path:{accountId:s}})}),o.invalidateQueries({queryKey:se()})},[o,s]),f=c.useCallback(async()=>{r("deleting");const k=await $(je({path:{accountId:s,mailboxId:t},throwOnError:!0}));if(!k.ok){d(k.error),r("error");return}h(),r("done"),a()},[s,t,h,a]),O=c.useCallback(()=>ye({path:{accountId:s},throwOnError:!0}).then(({data:k})=>k.items.find(S=>S.mailboxId===t)?.messageCount??0),[s,t]),I=c.useCallback(()=>o.fetchQuery({...Ne({path:{accountId:s}}),staleTime:0}).then(k=>k.mailboxes??[]),[o,s]),w=c.useCallback(async()=>{const k=new AbortController;v.current=k;const{signal:S}=k;r("checking"),d(void 0);const M=j.current!==void 0,C=await $((async()=>(M||(S.throwIfAborted(),j.current=rs(await I(),t),S.throwIfAborted(),p(Date.now()),await ke({path:{accountId:s},throwOnError:!0})),ns({readMailboxes:I,mailboxId:t,since:j.current??0,signal:S})))());return S.aborted?(r("idle"),j.current=void 0,{status:"failed"}):C.ok?C.value.status==="pending"?(r("check-stalled"),{status:"pending"}):(j.current=void 0,C.value.messageCount>0?(r("idle"),h(),{status:"blocked",messageCount:C.value.messageCount}):(await f(),{status:"deleted"})):(j.current=void 0,d(C.error),r("error"),{status:"failed"})},[s,t,I,f,h]),D=c.useCallback(()=>{v.current?.abort()},[]),y=c.useCallback(async k=>{const S=new AbortController;v.current=S;const{signal:M}=S;r("moving"),d(void 0);const C=await $(O());if(M.aborted)return;if(!C.ok){d(C.error),r("error");return}let x=Ce(C.value);l(x);const A=new Set;for(;;){if(M.aborted)return;const n=await $(os(t,A,Me,M));if(M.aborted)return;if(!n.ok){x=_(x,n.error),l(x),d(n.error),r("error");return}const b=n.value;if(b.length===0)break;const T=await $(we({body:{messageIds:b,destinationMailboxId:k},throwOnError:!0}));if(M.aborted)return;if(!T.ok){x=_(x,T.error),l(x),d(T.error),r("error");return}for(const P of b)A.add(P);x=Se(x,b.length),l(x)}const E=await $(ls(t,M));if(!M.aborted){if(!E.ok){x=_(x,E.error),l(x),d(E.error),r("error");return}if(E.value>0){const n=`${E.value} ${E.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;x=_(x,n),l(x),d(n),r("error"),h();return}await f()}},[t,O,f,h]),R=c.useCallback(()=>{v.current?.abort(),v.current=null,j.current=void 0,r("idle"),l(null),d(void 0),p(void 0)},[]);return{phase:m,progress:u,errorMessage:i,checkStartedAt:g,deleteMailbox:f,deleteIfEmpty:w,moveThenDelete:y,cancel:D,reset:R}}const z=s=>`${s} ${s===1?"email":"emails"}`;function ds({open:s,accountId:t,folder:a,mailboxes:o,appointments:m,onClose:r}){const[u,l]=c.useState(()=>H(a.messageCount)),[i,d]=c.useState(),[g,p]=c.useState(),{createFolderIn:v}=ae(t),j=re(),{phase:h,progress:f,errorMessage:O,checkStartedAt:I,deleteMailbox:w,deleteIfEmpty:D,moveThenDelete:y,cancel:R,reset:k}=cs({accountId:t,mailboxId:a.mailboxId,onDeleted:r}),[S,M]=c.useState("0:00"),C=h==="checking"||h==="check-stalled";c.useEffect(()=>{if(!C||I===void 0)return;const F=()=>M(De(Date.now()-I));F();const ue=setInterval(F,1e3);return()=>clearInterval(ue)},[C,I]),c.useEffect(()=>{s&&(l(H(a.messageCount)),d(void 0),k())},[s,k]),c.useEffect(()=>{s&&p(void 0)},[s]),c.useEffect(()=>R,[R]);const x=c.useCallback(()=>{R(),r()},[R,r]),A=c.useCallback(async()=>{const F=await D();F.status==="blocked"&&(d(F.messageCount),l("choose-fate"))},[D]),E=c.useMemo(()=>Ie({mailboxes:o,folderAppointments:m,excludeMailboxId:a.mailboxId,translator:j}),[o,m,a.mailboxId,j]),n=E.find(F=>F.id===g),b=c.useMemo(()=>B(a,ne(m).get(a.mailboxId),j),[a,m,j]);if(!s)return null;const T=`Delete ${b}`,P=i??a.messageCount,me=h==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:f?V(f):"Moved 0 of 0"})]}):h==="checking"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Checking the folder on the mail server…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:`Waiting ${S}. Nothing is deleted until the server answers.`})]}):h==="check-stalled"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"warning",variant:"soft",children:`The mail server hasn't reported back on this folder yet — ${S} so far. Nothing has been deleted.`}),e.jsx("p",{className:"text-xs text-fg-muted",children:"A sync covers the whole account, so a busy mailbox can take a while to come round to this folder."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{size:"sm",onClick:()=>A(),children:"Keep waiting"})]})]}):h==="deleting"||h==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):h==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"danger",variant:"soft",children:O??"Something went wrong. Please try again."}),f&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[V(f),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Close"})})]}):u==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(q,{className:"size-3.5"}),onClick:()=>A(),children:"Delete folder"})]})]}):u==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[i!==void 0&&e.jsx(L,{tone:"warning",variant:"soft",children:`This folder is not empty: the mail server reports ${z(i)} in it. Nothing was deleted.`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:b})," holds"," ",z(P),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>l("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(q,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>l("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(Ae,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"})})]}):u==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b})," and its"," ",z(P),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>l("choose-fate"),children:"Back"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(q,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",z(P)," in"," ",e.jsx("strong",{className:"text-fg",children:b})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(W,{folders:E,selectedId:g,delimiter:o[0]?.hierarchyDelimiter??"/",onSelect:p,onCreateFolder:v,onCancel:()=>{p(void 0),l("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),n&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(N,{variant:"danger",onClick:()=>y(n.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${z(P)} to ${n.label}`})})})]});return e.jsxs(Y,{open:s,onClose:x,title:T,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(Ee,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:T}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:x,"aria-label":"Cancel"})]}),me]})}function ms({account:s}){const t=J(),a=s.accountId,o=re(),{data:m,isPending:r,isError:u,error:l,refetch:i}=ie(Pe({path:{accountId:a}})),{createFolderIn:d}=ae(a),g=U({...$e(),onSuccess:()=>{t.invalidateQueries({queryKey:se()})}}),p=U({...ze(),onSuccess:()=>{t.invalidateQueries({queryKey:ee({path:{accountId:a}})})}}),[v,j]=c.useState(),[h,f]=c.useState(),[O,I]=c.useState(""),w=c.useMemo(()=>m?.items??[],[m]),D=c.useMemo(()=>ne(s.folderAppointments),[s.folderAppointments]),y=c.useMemo(()=>w.map(n=>({id:n.mailboxId,label:B(n,D.get(n.mailboxId),o),path:n.fullPath,deleteBlockedReason:Le(n,w,s.folderAppointments).message})),[w,D,o,s.folderAppointments]),R=(n,b)=>{g.mutate({path:{accountId:a,role:Be[n]},body:{mailboxId:b}})},k=(n,b)=>{const T=b.trim();p.mutate({path:{accountId:a,mailboxId:n},body:{displayNameOverride:T===""?null:T}})};if(r)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(u)return e.jsx(oe,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:l,onRetry:()=>{i()}});const S=w.map(n=>({mailboxId:n.mailboxId,providerPath:n.fullPath,hierarchyDelimiter:n.hierarchyDelimiter,messageCount:n.messageCount})),M={};for(const n of s.folderAppointments){const b=_e[n.role];b&&(M[b]={mailboxId:n.mailboxId??null,source:n.source,staleFolderPath:n.staleAppointmentPath})}const C={};for(const n of w)n.displayNameOverride&&(C[n.mailboxId]=n.displayNameOverride);const x=n=>w.find(b=>b.mailboxId===n),A=x(h),E=x(v);return e.jsxs("div",{className:"space-y-4",children:[(g.isError||p.isError)&&e.jsx(L,{tone:"danger",variant:"soft",children:qe(g.error)?"That folder is still being created on the mail server — wait for it to finish, then try again.":"Couldn't save that change. Please try again."}),e.jsx(es,{accountEmail:s.email,folders:S,appointments:M,displayNames:C,onAppoint:R,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(He,{folders:y,delimiter:w[0]?.hierarchyDelimiter??"/",onCreateFolder:d,onRename:n=>{f(n.id),I(x(n.id)?.displayNameOverride?.trim()??"")},onDelete:n=>j(n.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),A&&e.jsx(Ve,{open:!0,folderLabel:B(A,D.get(A.mailboxId),o),defaultLabel:B({fullPath:A.fullPath,hierarchyDelimiter:A.hierarchyDelimiter},D.get(A.mailboxId),o),name:O,onNameChange:I,pending:p.isPending,error:p.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const n=O.trim();p.mutate({path:{accountId:a,mailboxId:A.mailboxId},body:{displayNameOverride:n===""?null:n}},{onSuccess:()=>f(void 0)})},onClose:()=>f(void 0)}),E&&e.jsx(ds,{open:!0,accountId:a,folder:E,mailboxes:w,appointments:s.folderAppointments,onClose:()=>j(void 0)})]})}function js(){const s=Oe(),[t,a]=c.useState(!0),{data:o,isPending:m,isError:r,error:u,refetch:l}=ie(Te()),i=d=>{const g=Fe[d];g&&s({to:g})};return e.jsx(Ke,{items:Re,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:e.jsx(Je,{}),helpOpen:t,onToggleHelp:()=>a(d=>!d),onSelect:i,onBackToMail:()=>{s({to:"/mail"})},children:m?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):r?e.jsx(oe,{title:"Couldn't load accounts",error:u,onRetry:()=>{l()}}):o.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:o.accounts.map(d=>e.jsx(ms,{account:d},d.accountId))})})}export{js as component};
|
|
1
|
+
import{j as e,f as N,a2 as q,bh as W,r as c,aH as Y,X,aO as he,ay as Z,a0 as xe,aR as Q,bi as fe,ax as pe,aA as ge,B as L,aQ as be,bj as ve,h as J,N as ee,o as se,bk as je,bl as ye,aN as Ne,M as ke,bm as Ce,bn as _,bo as we,bp as Se,bq as te,br as Me,bs as H,b9 as ae,bf as re,bg as Ie,ae as B,ad as ne,L as G,bt as V,bu as Ae,aq as Ee,bv as De,u as Oe,c as ie,d as Te,aK as Re,aM as Fe,G as Pe,i as U,bw as $e,bx as ze,by as Le,aW as _e,bz as qe,bA as Be}from"./index-CAZr9Hkk.js";import{P as Ge}from"./pencil-BON3jZO8.js";import{S as Ke}from"./settings-screen-d7D3e6bb.js";import{E as oe}from"./ErrorState-BngYP48L.js";import"./avatar-TGnSyTcr.js";import"./chevron-left-FAjAhXYV.js";import"./menu-C9Jej5w7.js";import"./circle-help-BvOeRAjQ.js";const Qe=({label:s,onRename:t,onDelete:a,deleteBlockedReason:o,renameLabel:m=u=>`Rename ${u}`,deleteLabel:r=u=>`Delete ${u}`})=>{const u=o?`${r(s)} — ${o}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Ge,{className:"size-3.5"}),"aria-label":m(s),onClick:t}),e.jsx("span",{title:o,children:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(q,{className:"size-3.5"}),"aria-label":u,disabled:o!==void 0,onClick:a})})]})},He=({folders:s,onRename:t,onDelete:a,onCreateFolder:o,delimiter:m,labels:r})=>{const u=new Map(s.map(l=>[l.id,l]));return e.jsx(W,{folders:s,onCreateFolder:o,delimiter:m,labels:{treeAriaLabel:"Your folders",optionLabel:l=>l.label,...r},rowActions:l=>{const i=u.get(l.id);return i?e.jsx(Qe,{label:i.label,deleteBlockedReason:i.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>t(i),onDelete:()=>a(i)}):null}})},Ve=({open:s,folderLabel:t,defaultLabel:a,name:o,onNameChange:m,onSubmit:r,onClose:u,pending:l=!1,error:i})=>{const d=c.useId(),g=`Rename ${t}`;return s?e.jsxs(Y,{open:s,onClose:u,title:g,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:g}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:u,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(he,{htmlFor:d,children:"Folder name"}),e.jsx(Z,{id:d,value:o,placeholder:a,onChange:p=>m(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),r())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:a}),"."]}),i&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:i})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:u,children:"Cancel"}),e.jsx(N,{variant:"primary",size:"sm",onClick:r,disabled:l,children:l?"Saving…":"Save name"})]})]}):null},Ue=["inbox","drafts","sent","archive","junk","trash"],K="",We={mailboxId:null,source:"None"};function Ye(s){const t=s.messageCount===1?"msg":"msgs";return`${Q(s.providerPath,s.hierarchyDelimiter)} · ${s.messageCount} ${t}`}const le=s=>`${s} ${s===1?"message":"messages"}`,Xe=(s,t)=>s==="Appointed"?"Chosen by you":s==="Flagged"?`The mail server marks it as ${t}`:s==="Reserved"?"The account's own INBOX":"Matched by name, not confirmed";function Ze({role:s,folders:t,appointment:a,displayName:o,onAppoint:m,onRename:r}){const[u,l]=c.useState(o),i=c.useRef(null),d=c.useRef(!1),g=c.useId(),{mailboxId:p,source:v,staleFolderPath:j}=a,h=t.find(y=>y.mailboxId===p)??null,f=be(s),O=h!=null&&u.trim()!==o.trim();c.useEffect(()=>{!d.current||v==="Proposed"||(d.current=!1,i.current?.focus())},[v]);const I=(()=>{if(v==="None"){const y=s==="trash"?" Deleting mail needs one.":"";return e.jsx("span",{id:g,className:"pl-[7.5rem] text-xs text-fg-muted",children:`Not set — pick the folder this account uses for ${f}.${y}`})}return v==="Stale"||!h?null:e.jsx("span",{id:g,className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:h.providerPath,children:`${Xe(v,f)} · ${h.providerPath} · ${le(h.messageCount)}`})})(),w=s==="trash"?" Deleting mail is stopped until you pick another one.":h?` reader is using ${Q(h.providerPath,h.hierarchyDelimiter)} instead.`:"",D=`The folder you chose for ${f}${j?` — ${j} —`:""} is gone from the mail server.${w}`;return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[fe(s),f]}),e.jsxs(pe,{ref:i,className:"w-56 shrink-0",value:p??K,"aria-label":`Folder for ${f}`,"aria-describedby":I||v==="Stale"?g:void 0,onChange:y=>m(s,y.target.value===K?null:y.target.value),children:[e.jsx("option",{value:K,children:"None"}),t.map(y=>e.jsx("option",{value:y.mailboxId,children:Ye(y)},y.mailboxId))]}),v==="Proposed"&&h&&e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{d.current=!0,m(s,h.mailboxId)},children:`Set as ${f}`}),h&&e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"flex-1",value:u,placeholder:f,"aria-label":`Display name for ${f}`,onChange:y=>l(y.target.value)}),O&&e.jsx(N,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(ge,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(h.mailboxId,u)})]})]}),I,v==="Stale"&&e.jsx(L,{tone:"warning",variant:"soft",className:"ml-[7.5rem]",children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:g,className:"flex-1",children:D}),e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>i.current?.focus(),children:"Pick a folder"})]})})]})}function Je(){return e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]})}function es({accountEmail:s,folders:t,appointments:a,displayNames:o={},onAppoint:m,onRename:r}){const u=new Set(Object.values(a).map(i=>i.mailboxId).filter(i=>i!=null)),l=t.filter(i=>!u.has(i.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each row says where its answer came from — your choice, the mail server's own flag, or a name reader matched."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Ue.map(i=>{const d=a[i]??We;return e.jsx(Ze,{role:i,folders:t,appointment:d,displayName:d.mailboxId?o[d.mailboxId]??"":"",onAppoint:m,onRename:r},i)})}),l.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:l.map(i=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(xe,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:Q(i.providerPath,i.hierarchyDelimiter)}),e.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:le(i.messageCount)})]},i.mailboxId))})]})]})}const ss=12e4,ts=2e3,as="This folder is no longer in the account's folder list, so nothing was deleted.",ce=(s,t)=>{const a=s.find(o=>o.mailboxId===t);if(!a)throw new Error(as);return a},rs=(s,t)=>ce(s,t).lastSyncedAt??0;async function ns({readMailboxes:s,mailboxId:t,since:a,signal:o,segmentMs:m=ss,pollIntervalMs:r=ts,delay:u=ve,now:l=Date.now}){const i=l()+m;for(;;){o?.throwIfAborted();const d=ce(await s(),t);if((d.lastSyncedAt??0)>a)return{status:"fresh",messageCount:d.messagesTotal};if(l()>=i)return{status:"pending"};await u(r,o)}}const de=50,is=s=>s instanceof Error?s.message:"Something went wrong.",$=s=>s.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:is(t)})),os=async(s,t,a,o)=>{const m=[];let r;for(let u=0;u<de;u+=1){if(o.aborted)return m;const{data:l}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const i of l.items)if(!i.isDeleted&&!t.has(i.messageId)&&!m.includes(i.messageId)&&(m.push(i.messageId),m.length>=a))return m;if(!l.continuationToken)break;r=l.continuationToken}return m},ls=async(s,t)=>{let a=0,o;for(let m=0;m<de;m+=1){if(t.aborted)return a;const{data:r}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:o},throwOnError:!0});for(const u of r.items)u.isDeleted||(a+=1);if(!r.continuationToken)break;o=r.continuationToken}return a};function cs({accountId:s,mailboxId:t,onDeleted:a}){const o=J(),[m,r]=c.useState("idle"),[u,l]=c.useState(null),[i,d]=c.useState(),[g,p]=c.useState(),v=c.useRef(null),j=c.useRef(void 0),h=c.useCallback(()=>{o.invalidateQueries({queryKey:ee({path:{accountId:s}})}),o.invalidateQueries({queryKey:se()})},[o,s]),f=c.useCallback(async()=>{r("deleting");const k=await $(je({path:{accountId:s,mailboxId:t},throwOnError:!0}));if(!k.ok){d(k.error),r("error");return}h(),r("done"),a()},[s,t,h,a]),O=c.useCallback(()=>ye({path:{accountId:s},throwOnError:!0}).then(({data:k})=>k.items.find(S=>S.mailboxId===t)?.messageCount??0),[s,t]),I=c.useCallback(()=>o.fetchQuery({...Ne({path:{accountId:s}}),staleTime:0}).then(k=>k.mailboxes??[]),[o,s]),w=c.useCallback(async()=>{const k=new AbortController;v.current=k;const{signal:S}=k;r("checking"),d(void 0);const M=j.current!==void 0,C=await $((async()=>(M||(S.throwIfAborted(),j.current=rs(await I(),t),S.throwIfAborted(),p(Date.now()),await ke({path:{accountId:s},throwOnError:!0})),ns({readMailboxes:I,mailboxId:t,since:j.current??0,signal:S})))());return S.aborted?(r("idle"),j.current=void 0,{status:"failed"}):C.ok?C.value.status==="pending"?(r("check-stalled"),{status:"pending"}):(j.current=void 0,C.value.messageCount>0?(r("idle"),h(),{status:"blocked",messageCount:C.value.messageCount}):(await f(),{status:"deleted"})):(j.current=void 0,d(C.error),r("error"),{status:"failed"})},[s,t,I,f,h]),D=c.useCallback(()=>{v.current?.abort()},[]),y=c.useCallback(async k=>{const S=new AbortController;v.current=S;const{signal:M}=S;r("moving"),d(void 0);const C=await $(O());if(M.aborted)return;if(!C.ok){d(C.error),r("error");return}let x=Ce(C.value);l(x);const A=new Set;for(;;){if(M.aborted)return;const n=await $(os(t,A,Me,M));if(M.aborted)return;if(!n.ok){x=_(x,n.error),l(x),d(n.error),r("error");return}const b=n.value;if(b.length===0)break;const T=await $(we({body:{messageIds:b,destinationMailboxId:k},throwOnError:!0}));if(M.aborted)return;if(!T.ok){x=_(x,T.error),l(x),d(T.error),r("error");return}for(const P of b)A.add(P);x=Se(x,b.length),l(x)}const E=await $(ls(t,M));if(!M.aborted){if(!E.ok){x=_(x,E.error),l(x),d(E.error),r("error");return}if(E.value>0){const n=`${E.value} ${E.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;x=_(x,n),l(x),d(n),r("error"),h();return}await f()}},[t,O,f,h]),R=c.useCallback(()=>{v.current?.abort(),v.current=null,j.current=void 0,r("idle"),l(null),d(void 0),p(void 0)},[]);return{phase:m,progress:u,errorMessage:i,checkStartedAt:g,deleteMailbox:f,deleteIfEmpty:w,moveThenDelete:y,cancel:D,reset:R}}const z=s=>`${s} ${s===1?"email":"emails"}`;function ds({open:s,accountId:t,folder:a,mailboxes:o,appointments:m,onClose:r}){const[u,l]=c.useState(()=>H(a.messageCount)),[i,d]=c.useState(),[g,p]=c.useState(),{createFolderIn:v}=ae(t),j=re(),{phase:h,progress:f,errorMessage:O,checkStartedAt:I,deleteMailbox:w,deleteIfEmpty:D,moveThenDelete:y,cancel:R,reset:k}=cs({accountId:t,mailboxId:a.mailboxId,onDeleted:r}),[S,M]=c.useState("0:00"),C=h==="checking"||h==="check-stalled";c.useEffect(()=>{if(!C||I===void 0)return;const F=()=>M(De(Date.now()-I));F();const ue=setInterval(F,1e3);return()=>clearInterval(ue)},[C,I]),c.useEffect(()=>{s&&(l(H(a.messageCount)),d(void 0),k())},[s,k]),c.useEffect(()=>{s&&p(void 0)},[s]),c.useEffect(()=>R,[R]);const x=c.useCallback(()=>{R(),r()},[R,r]),A=c.useCallback(async()=>{const F=await D();F.status==="blocked"&&(d(F.messageCount),l("choose-fate"))},[D]),E=c.useMemo(()=>Ie({mailboxes:o,folderAppointments:m,excludeMailboxId:a.mailboxId,translator:j}),[o,m,a.mailboxId,j]),n=E.find(F=>F.id===g),b=c.useMemo(()=>B(a,ne(m).get(a.mailboxId),j),[a,m,j]);if(!s)return null;const T=`Delete ${b}`,P=i??a.messageCount,me=h==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:f?V(f):"Moved 0 of 0"})]}):h==="checking"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Checking the folder on the mail server…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:`Waiting ${S}. Nothing is deleted until the server answers.`})]}):h==="check-stalled"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"warning",variant:"soft",children:`The mail server hasn't reported back on this folder yet — ${S} so far. Nothing has been deleted.`}),e.jsx("p",{className:"text-xs text-fg-muted",children:"A sync covers the whole account, so a busy mailbox can take a while to come round to this folder."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{size:"sm",onClick:()=>A(),children:"Keep waiting"})]})]}):h==="deleting"||h==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):h==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"danger",variant:"soft",children:O??"Something went wrong. Please try again."}),f&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[V(f),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Close"})})]}):u==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(q,{className:"size-3.5"}),onClick:()=>A(),children:"Delete folder"})]})]}):u==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[i!==void 0&&e.jsx(L,{tone:"warning",variant:"soft",children:`This folder is not empty: the mail server reports ${z(i)} in it. Nothing was deleted.`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:b})," holds"," ",z(P),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>l("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(q,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>l("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(Ae,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"})})]}):u==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b})," and its"," ",z(P),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>l("choose-fate"),children:"Back"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(q,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",z(P)," in"," ",e.jsx("strong",{className:"text-fg",children:b})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(W,{folders:E,selectedId:g,delimiter:o[0]?.hierarchyDelimiter??"/",onSelect:p,onCreateFolder:v,onCancel:()=>{p(void 0),l("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),n&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(N,{variant:"danger",onClick:()=>y(n.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${z(P)} to ${n.label}`})})})]});return e.jsxs(Y,{open:s,onClose:x,title:T,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(Ee,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:T}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:x,"aria-label":"Cancel"})]}),me]})}function ms({account:s}){const t=J(),a=s.accountId,o=re(),{data:m,isPending:r,isError:u,error:l,refetch:i}=ie(Pe({path:{accountId:a}})),{createFolderIn:d}=ae(a),g=U({...$e(),onSuccess:()=>{t.invalidateQueries({queryKey:se()})}}),p=U({...ze(),onSuccess:()=>{t.invalidateQueries({queryKey:ee({path:{accountId:a}})})}}),[v,j]=c.useState(),[h,f]=c.useState(),[O,I]=c.useState(""),w=c.useMemo(()=>m?.items??[],[m]),D=c.useMemo(()=>ne(s.folderAppointments),[s.folderAppointments]),y=c.useMemo(()=>w.map(n=>({id:n.mailboxId,label:B(n,D.get(n.mailboxId),o),path:n.fullPath,deleteBlockedReason:Le(n,w,s.folderAppointments).message})),[w,D,o,s.folderAppointments]),R=(n,b)=>{g.mutate({path:{accountId:a,role:Be[n]},body:{mailboxId:b}})},k=(n,b)=>{const T=b.trim();p.mutate({path:{accountId:a,mailboxId:n},body:{displayNameOverride:T===""?null:T}})};if(r)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(u)return e.jsx(oe,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:l,onRetry:()=>{i()}});const S=w.map(n=>({mailboxId:n.mailboxId,providerPath:n.fullPath,hierarchyDelimiter:n.hierarchyDelimiter,messageCount:n.messageCount})),M={};for(const n of s.folderAppointments){const b=_e[n.role];b&&(M[b]={mailboxId:n.mailboxId??null,source:n.source,staleFolderPath:n.staleAppointmentPath})}const C={};for(const n of w)n.displayNameOverride&&(C[n.mailboxId]=n.displayNameOverride);const x=n=>w.find(b=>b.mailboxId===n),A=x(h),E=x(v);return e.jsxs("div",{className:"space-y-4",children:[(g.isError||p.isError)&&e.jsx(L,{tone:"danger",variant:"soft",children:qe(g.error)?"That folder is still being created on the mail server — wait for it to finish, then try again.":"Couldn't save that change. Please try again."}),e.jsx(es,{accountEmail:s.email,folders:S,appointments:M,displayNames:C,onAppoint:R,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(He,{folders:y,delimiter:w[0]?.hierarchyDelimiter??"/",onCreateFolder:d,onRename:n=>{f(n.id),I(x(n.id)?.displayNameOverride?.trim()??"")},onDelete:n=>j(n.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),A&&e.jsx(Ve,{open:!0,folderLabel:B(A,D.get(A.mailboxId),o),defaultLabel:B({fullPath:A.fullPath,hierarchyDelimiter:A.hierarchyDelimiter},D.get(A.mailboxId),o),name:O,onNameChange:I,pending:p.isPending,error:p.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const n=O.trim();p.mutate({path:{accountId:a,mailboxId:A.mailboxId},body:{displayNameOverride:n===""?null:n}},{onSuccess:()=>f(void 0)})},onClose:()=>f(void 0)}),E&&e.jsx(ds,{open:!0,accountId:a,folder:E,mailboxes:w,appointments:s.folderAppointments,onClose:()=>j(void 0)})]})}function js(){const s=Oe(),[t,a]=c.useState(!0),{data:o,isPending:m,isError:r,error:u,refetch:l}=ie(Te()),i=d=>{const g=Fe[d];g&&s({to:g})};return e.jsx(Ke,{items:Re,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:e.jsx(Je,{}),helpOpen:t,onToggleHelp:()=>a(d=>!d),onSelect:i,onBackToMail:()=>{s({to:"/mail"})},children:m?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):r?e.jsx(oe,{title:"Couldn't load accounts",error:u,onRetry:()=>{l()}}):o.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:o.accounts.map(d=>e.jsx(ms,{account:d},d.accountId))})})}export{js as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aB as l,aC as T,cA as m,aD as u,cB as h,cC as D,cD as k,cE as d}from"./index-
|
|
1
|
+
import{aB as l,aC as T,cA as m,aD as u,cB as h,cC as D,cD as k,cE as d}from"./index-CAZr9Hkk.js";l({kind:m("Boolean"),value:T()});l({kind:m("String"),value:u()});l({kind:m("Number"),value:h()});l({kind:m("StringList"),value:D(u())});l({kind:m("Map"),value:k(u(),u())});l({kind:m("MutedFlag"),value:l({value:T(),setAt:h(),setBy:u().optional(),expiresAt:h().optional(),reason:u().optional()})});const v=(e,t)=>{switch(e.kind){case"appointed":case"flagged":return{allowed:!0,mailbox:e.mailbox};case"proposed":return t==="resolved"?{allowed:!0,mailbox:e.mailbox}:{allowed:!1,reason:"unconfirmed"};case"appointment_stale":return{allowed:!1,reason:"stale"};default:return{allowed:!1,reason:"none"}}},x=(e,t)=>v(e,t).allowed,$={[d.Appointed]:{kind:"appointed",mailbox:null},[d.Flagged]:{kind:"flagged",mailbox:null},[d.Reserved]:{kind:"reserved",mailbox:null},[d.Proposed]:{kind:"proposed",mailbox:null},[d.Stale]:{kind:"appointment_stale",appointedMailboxId:"",fallback:{kind:"none"}},[d.None]:{kind:"none"}},M=(e,t)=>x($[e],t),g=()=>typeof navigator<"u"&&(navigator.language||navigator.languages?.[0])||"en-US",w=(e,t)=>new Intl.NumberFormat(g(),t).format(e),N=/^-?\d+$/,p=e=>{if(e instanceof Date)return e;if(typeof e=="number")return new Date(e);if(typeof e=="string"){const t=e.trim();return N.test(t)?new Date(Number(t)):new Date(t)}return new Date(Number.NaN)},b=e=>Number.isFinite(e.getTime()),c=(e,t)=>{const n=p(e);return b(n)?new Intl.DateTimeFormat(g(),t).format(n):""},S=(e,t)=>c(e,{short:{month:"short",day:"numeric"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"},time:{hour:"numeric",minute:"numeric"},datetime:{month:"short",day:"numeric",hour:"numeric",minute:"numeric"}}[t]),L=e=>{const t=p(e);if(!b(t))return"";const n=new Intl.RelativeTimeFormat(g(),{numeric:"auto"}),i=Date.now(),r=t.getTime()-i,s=Math.round(r/1e3),a=Math.round(r/(1e3*60)),o=Math.round(r/(1e3*60*60)),f=Math.round(r/(1e3*60*60*24)),y=Math.round(r/(1e3*60*60*24*7));return Math.abs(s)<60?n.format(s,"second"):Math.abs(a)<60?n.format(a,"minute"):Math.abs(o)<24?n.format(o,"hour"):Math.abs(f)<7?n.format(f,"day"):Math.abs(y)<4?n.format(y,"week"):S(t,"medium")},I=e=>{const t=p(e);if(!b(t))return"";const n=new Date,i=t.toDateString()===n.toDateString(),r=new Date(n);r.setDate(r.getDate()-1);const s=t.toDateString()===r.toDateString(),a=new Date(n);a.setDate(a.getDate()-6);const o=t>=a&&t<n,f=t.getFullYear()===n.getFullYear();return i?c(t,{hour:"numeric",minute:"numeric"}):s?"Yesterday":o?c(t,{weekday:"long"}):f?c(t,{month:"short",day:"numeric"}):c(t,{month:"short",day:"numeric",year:"numeric"})},C=e=>`Move ${e===1?"1":w(e)} ${e===1?"message":"messages"} to Trash?`,A=({targets:e,trashByAccount:t,hasAppointments:n,isError:i})=>{if(i)return"unavailable";if(!n||e.length===0)return"unknown";let r=!1,s=!1;for(const a of e){if(a.accountId===void 0)return"unknown";const o=t.get(a.accountId);if(o===void 0)return"unknown";if(o.source==="Stale")return"staleTrash";if(o.mailboxId===void 0)return"noTrash";o.mailboxId===a.mailboxId&&(r=!0,M(o.source,"confirmed")||(s=!0))}return s?"unconfirmed":r?"permanent":"trash"},E=e=>e==="permanent"||e==="unconfirmed",R=(e,t,n={})=>{const i=e===1?"1":w(e),r=e===1?"message":"messages",{trashFolderLabel:s,staleFolderLabel:a}=n;if(t==="noTrash")return{title:`Can't delete ${i} ${r} yet`,description:"No folder on this account is set as Trash, so there is nowhere to move the mail. Nothing has been deleted.",confirmLabel:"Pick a Trash folder"};if(t==="staleTrash")return{title:`Can't delete ${i} ${r} yet`,description:a?`The folder you set as this account's Trash — ${a} — is gone from the mail server. Nothing has been deleted.`:"The folder you set as this account's Trash is gone from the mail server. Nothing has been deleted.",confirmLabel:"Pick another folder"};if(t==="unconfirmed"){const o=s?`reader files this account's deleted mail in ${s} because of its name — nobody confirmed it.`:"reader files this account's deleted mail in a folder it matched by name — nobody confirmed it.";return{title:"Confirm this account's Trash folder",description:e>0?`${o} Deleting ${i} ${r} there erases them from the mail server, and that cannot be restored. Nothing has been deleted.`:`${o} Emptying a folder erases everything in it from the mail server, and that cannot be restored. Nothing has been emptied.`,confirmLabel:"Confirm the folder"}}return t==="unavailable"?{title:`Can't delete ${i} ${r}`,description:"reader couldn't read this account's folder settings, so it can't say whether this would move the mail to Trash or erase it. Nothing has been deleted.",confirmLabel:"Sign in again"}:t==="unknown"?{title:`Delete ${i} ${r}?`,description:"Checking where this account files deleted mail…",confirmLabel:"Delete"}:t==="permanent"?{title:`Permanently delete ${i} ${r}?`,description:"They are erased from the mail server and cannot be restored.",confirmLabel:"Delete permanently"}:{title:C(e),description:"You can restore them from Trash later.",confirmLabel:"Move to Trash"}};export{c as a,I as b,w as c,R as d,S as e,L as f,A as g,E as h,p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-CAZr9Hkk.js";import{K as s}from"./kbd-tEhcU6de.js";const a=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"VIP"})," senders get priority surface in the daily brief and notification escalation, even when an account is quiet."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," senders never notify and stay out of the brief. Their mail still syncs and stays searchable."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Blocked"})," senders never load images and go straight to junk."]}),e.jsxs("p",{children:["Tip: flag from the keyboard on any message — ",e.jsx(s,{children:"v"})," VIP,"," ",e.jsx(s,{children:"m"})," mute, ",e.jsx(s,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]}),r=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Sync health"})," shows the IMAP connection state and the last successful sync per account."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Error"})," means the last connection attempt failed — the raw server response is shown on the card. Reconnect re-runs the connection test from the add-account wizard."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," accounts keep syncing but stay out of the daily brief and unified counts."]})]}),c=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Density"})," controls how much information fits on screen. Compact is great on smaller displays; Comfortable gives each item more breathing room."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Theme"})," switches between light, dark, and system-preference modes instantly. The change takes effect across the whole app immediately."]}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Preferences are stored locally in this browser. Server-side sync is coming soon."})]}),i=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Notification rules"})," and data export are coming in a future release."]}),e.jsxs("p",{children:["A message Remit cannot read is"," ",e.jsx("strong",{className:"text-fg",children:"set aside"})," rather than skipped, and the folder keeps syncing. Setting one aside is a defect in Remit, so every entry can be reported with the diagnostics already attached."]})]});export{r as a,i as b,c,a as s};
|