@remit/web-client-dist 0.0.206 → 0.0.207
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/{ComposeBody-CicE0nVt.js → ComposeBody-uQ4F8ZtN.js} +1 -1
- package/assets/{ConfirmDialog-D06qiXz1.js → ConfirmDialog-DXxndw06.js} +1 -1
- package/assets/{ErrorState-Bx_OSJeA.js → ErrorState-C4MPdySt.js} +1 -1
- package/assets/{OnboardingWizard-CWAkqfUF.js → OnboardingWizard-soR-mgEP.js} +1 -1
- package/assets/{account-form-helpers-DyUvqI8e.js → account-form-helpers-DshQgJkL.js} +1 -1
- package/assets/{accounts-BtGpIYW-.js → accounts-DVu_NYXk.js} +1 -1
- package/assets/{advanced-DGMp4P0V.js → advanced-DKoySa1y.js} +1 -1
- package/assets/{appearance-DuhMZp4w.js → appearance-DO_432sY.js} +1 -1
- package/assets/{avatar-ICMP-ozS.js → avatar-mwB_u04P.js} +1 -1
- package/assets/{browser-ponyfill-C47wq56l.js → browser-ponyfill-DSwFA3Yw.js} +1 -1
- package/assets/{circle-check-CbQVn35g.js → circle-check-BOTpEQiP.js} +1 -1
- package/assets/{download-D0oCxOvJ.js → download-g_CfMsdA.js} +1 -1
- package/assets/{filters-S7Cpppo4.js → filters-BT--wzfg.js} +1 -1
- package/assets/{flagged-BIC-QkIa.js → flagged-COe8LmUM.js} +1 -1
- package/assets/{folders-D_YlXc7a.js → folders-DXv8Q23p.js} +1 -1
- package/assets/{index-C7PN_qn4.js → index-Db465Czt.js} +1 -1
- package/assets/{index-BgZZpZoW.js → index-RjRZanC1.js} +4 -4
- package/assets/index-VVzEhb1s.js +1 -0
- package/assets/{kbd-DOH5vRcN.js → kbd-D0v8K9Au.js} +1 -1
- package/assets/{labels-Dj1dohhs.js → labels-DqoVlXuM.js} +1 -1
- package/assets/{mail-kOwmcgZa.js → mail-vYFxs7wf.js} +3 -3
- package/assets/{move-mailbox-picker-BlDv7-Eg.js → move-mailbox-picker-DZyMtAwv.js} +1 -1
- package/assets/{move-targets-F2xsRUZW.js → move-targets-DRkkDZ9N.js} +1 -1
- package/assets/{onboarding-CyJKvtYJ.js → onboarding-C4sDVACA.js} +1 -1
- package/assets/{search-DmH1GXMu.js → search-BZqLkx84.js} +1 -1
- package/assets/{senders-CcYAuK37.js → senders-DOYnba8s.js} +1 -1
- package/assets/settings-Du2eiJu_.js +1 -0
- package/assets/{settings-screen-B2fhhiBV.js → settings-screen-_CM9NR95.js} +1 -1
- package/assets/{shield-check-CCtt4Xt_.js → shield-check-Bv8XXzbu.js} +1 -1
- package/assets/{suggested-vips-BsTfz7iR.js → suggested-vips-m5S1UxGW.js} +1 -1
- package/assets/{useDebouncedValue-Pb1NXUBY.js → useDebouncedValue-p-uexMod.js} +1 -1
- package/assets/{useLabels-B8X13h8F.js → useLabels-JmLYc9bP.js} +1 -1
- package/assets/{useRulePreview-DRmHTXyE.js → useRulePreview-BZ2fDKX1.js} +1 -1
- package/assets/{useSignature-Boafu5LW.js → useSignature-DtLuehhu.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/index-CSK29bfP.js +0 -1
- package/assets/settings-DwaSrqzH.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as A,r as a,ch as H,j as s,b7 as K,b as C}from"./index-
|
|
1
|
+
import{a as A,r as a,ch as H,j as s,b7 as K,b as C}from"./index-RjRZanC1.js";import{S as Q}from"./search-BZqLkx84.js";const O=A("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);const U=A("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),E="w-full text-left px-3 py-2.5 min-h-11 flex items-center gap-2 transition-colors text-sm rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-canvas",V={searchPlaceholder:"Move to…",searchAriaLabel:"Filter folders",listAriaLabel:"Destination folders",currentSuffix:"(current folder)",currentTag:"current",emptyMessage:r=>`No folders match "${r}"`,optionLabel:r=>`Move to ${r}`,createLabel:r=>`Create "${r}"`,createPending:"Creating folder…",createError:"Couldn't create that folder. Please try again."},j=r=>{for(let t=0;t<r.length;t+=1)if(!r[t]?.isCurrent)return t;return-1},T=r=>{for(let t=r.length-1;t>=0;t-=1)if(!r[t]?.isCurrent)return t;return-1},D=(r,t,u)=>{const l=r.length;if(l<=0)return-1;const g=t<0?u===1?-1:l:t;for(let p=1;p<=l;p+=1){const c=((g+u*p)%l+l)%l;if(!r[c]?.isCurrent)return c}return-1},q=(r,t)=>r.label.toLowerCase().includes(t)?!0:r.searchValue?.toLowerCase().includes(t)??!1,W=({mailboxes:r,onSelect:t,onCreateFolder:u,onCancel:l,autoFocus:g=!1,labels:p})=>{const c={...V,...p},[d,M]=a.useState(""),[w,m]=a.useState(!1),[k,L]=a.useState(),[o,h]=a.useState(()=>j(r)),x=a.useRef(null),y=a.useRef([]),v=a.useRef(null);a.useEffect(()=>()=>v.current?.abort(),[]),a.useEffect(()=>{g&&x.current?.focus()},[g]);const b=d.trim().toLowerCase(),n=a.useMemo(()=>b?r.filter(e=>q(e,b)):[...r],[r,b]);a.useEffect(()=>{h(e=>e>=0&&e<n.length&&!n[e]?.isCurrent?e:j(n))},[n]),a.useEffect(()=>{if(o<0)return;const e=y.current[o];e&&document.activeElement!==x.current&&e.focus()},[o]);const N=a.useCallback(()=>{if(o<0)return;const e=n[o];!e||e.isCurrent||t(e.id)},[o,n,t]),I=!!u&&b.length>0&&!r.some(e=>e.label.toLowerCase()===b),S=a.useCallback(()=>{if(!u)return;const e=d.trim();if(e==="")return;m(!0),L(void 0),v.current?.abort();const i=new AbortController;v.current=i,u(e,i.signal).then(f=>{t(f.id),m(!1)}).catch(f=>{H(f)||(L(f instanceof Error?f.message:c.createError),m(!1))})},[u,d,t,c.createError]),R=a.useCallback(e=>{switch(e.key){case"ArrowDown":e.preventDefault(),h(i=>D(n,i,1));return;case"ArrowUp":e.preventDefault(),h(i=>D(n,i,-1));return;case"Home":e.preventDefault(),h(j(n));return;case"End":e.preventDefault(),h(T(n));return;case"Enter":case" ":e.preventDefault(),N();return;case"Escape":e.preventDefault(),l?.();return;default:return}},[n,N,l]),F=a.useCallback(e=>{if(e.key==="ArrowDown"){if(e.preventDefault(),n.length===0)return;y.current[o>=0?o:0]?.focus();return}e.key==="Escape"&&(e.preventDefault(),l?.())},[n.length,o,l]);return s.jsxs("div",{className:"flex flex-col",children:[s.jsx(K,{variant:"inline",className:"border-b border-line px-3 py-2",icon:s.jsx(Q,{className:"size-4","aria-hidden":"true"}),ref:x,type:"search",value:d,onChange:e=>M(e.target.value),onKeyDown:F,placeholder:c.searchPlaceholder,"aria-label":c.searchAriaLabel}),s.jsx("div",{className:"flex-1 overflow-y-auto py-1",role:"listbox","aria-label":c.listAriaLabel,onKeyDown:R,children:n.length===0?s.jsx("div",{className:"px-3 py-3 text-sm text-fg-muted","aria-live":"polite",children:c.emptyMessage(d)}):n.map((e,i)=>{const f=e.isCurrent??!1,P=i===o;return f?s.jsx("div",{children:s.jsxs("div",{role:"option","aria-selected":!1,"aria-current":"true","aria-label":`${e.label} ${c.currentSuffix}`,className:C(E,"opacity-60 bg-surface-sunken/40"),children:[s.jsx("span",{className:"truncate flex-1",children:e.label}),s.jsx("span",{className:"text-xs text-fg-muted shrink-0",children:c.currentTag})]})},e.id):s.jsx("div",{children:s.jsx("button",{ref:$=>{y.current[i]=$},type:"button",role:"option","aria-selected":!1,tabIndex:P?0:-1,onClick:()=>t(e.id),onFocus:()=>h(i),"aria-label":c.optionLabel(e.label),className:C(E,"hover:bg-surface-raised"),children:s.jsx("span",{className:"truncate flex-1",children:e.label})})},e.id)})}),I&&s.jsxs("div",{className:"border-t border-line p-1",children:[s.jsx("button",{type:"button",onClick:S,disabled:w,className:C(E,"font-medium text-accent-2 hover:bg-surface-raised disabled:opacity-60"),children:s.jsx("span",{className:"truncate",children:w?c.createPending:c.createLabel(d.trim())})}),k&&s.jsx("p",{className:"px-3 py-1 text-xs text-danger",role:"alert",children:k})]})]})};export{O as F,W as M,U as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as P,aq as S,af as h,at as T,aL as E,ci as v,r as x,aQ as d,ag as L,cj as f}from"./index-
|
|
1
|
+
import{$ as P,aq as S,af as h,at as T,aL as E,ci as v,r as x,aQ as d,ag as L,cj as f}from"./index-RjRZanC1.js";const y={synced:"synced",failed:"failed"},F={uncategorized:"uncategorized",personal:"personal",newsletter:"newsletter",marketing:"marketing",automated:"automated",transactional:"transactional",social:"social"},Q={MoveToInbox:"MoveToInbox",MoveToJunk:"MoveToJunk"},_=3e4,g=1e3,A="The folder couldn't be created on the mail server. Please try again.",C="The folder was created but the mail server hasn't confirmed it yet, so nothing was attached to it. It's in your folder list — try again in a moment.",N=(a,e)=>new Promise((t,s)=>{if(e?.aborted){s(e.reason);return}const o=setTimeout(()=>{e?.removeEventListener("abort",n),t()},a),n=()=>{clearTimeout(o),s(e?.reason)};e?.addEventListener("abort",n,{once:!0})});async function k({fetchMailboxes:a,mailboxId:e,signal:t,timeoutMs:s=_,pollIntervalMs:o=g,delay:n=N,now:r=Date.now}){const i=r()+s;for(;;){t?.throwIfAborted();const l=(await a()).find(u=>u.mailboxId===e);if(l?.syncStatus===y.synced)return l;if(l?.syncStatus===y.failed)throw new Error(A);if(r()>=i)throw new Error(C);await n(o,t)}}function w(a,e){const t=a.trim();return e?`${e.fullPath}${e.hierarchyDelimiter}${t}`:t}const M=(a,e)=>{const t=a.split(e);return t[0]?.toLowerCase()==="inbox"&&(t[0]="INBOX"),t.join(e)};function R({name:a,delimiter:e,parent:t,existingPaths:s}){const o=a.trim();if(o==="")return"Enter a folder name.";if(o.includes(e))return`A folder name can't contain "${e}".`;const n=M(w(o,t),e);if(s.some(i=>M(i,e)===n))return"A folder with that name already exists."}function X(a){const e=P(),{data:t}=S(h({path:{accountId:a}})),s=T({...v(),onSuccess:()=>{e.invalidateQueries({queryKey:E({path:{accountId:a}})})}}),o=x.useRef(new Map);return{createFolder:x.useCallback(async(r,i)=>{const c=w(r);let l=o.current.get(c);if(!l){const m=t?.items??[],I=m[0]?.hierarchyDelimiter??"/",b=R({name:r,delimiter:I,existingPaths:m.map(O=>O.fullPath)});if(b)throw new Error(b);l=(await s.mutateAsync({path:{accountId:a},body:{fullPath:c,namespaceType:"personal"}})).mailboxId,o.current.set(c,l)}const u=await k({mailboxId:l,signal:i,fetchMailboxes:async()=>(await e.fetchQuery({...h({path:{accountId:a}}),staleTime:0})).items??[]});return o.current.delete(c),{id:u.mailboxId,label:d(u.fullPath)}},[s,a,t,e]),mutation:s}}const B=new Set(["outbox","postvak uit","boîte d'envoi","postausgang","buzón de salida","posta in uscita","送信トレイ","送件匣","发件箱","skrzynka nadawcza"]),D=a=>{const e=d(a.fullPath).trim().toLowerCase();return B.has(e)},p=f.length,$=(a,e=[])=>{const t=L(e);return[...a.filter(o=>{const n=t.get(o.mailboxId);return n==="drafts"||n==="sent"?!1:!D(o)})].sort((o,n)=>{const r=t.has(o.mailboxId)?f.indexOf(t.get(o.mailboxId)??"inbox"):p,i=t.has(n.mailboxId)?f.indexOf(t.get(n.mailboxId)??"inbox"):p;return r!==i?r-i:d(o.fullPath).localeCompare(d(n.fullPath),void 0,{sensitivity:"base",numeric:!0})})};export{F as M,Q as P,$ as b,w as c,X as u,R as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bw as t,ap as r,$ as a,r as i,j as s}from"./index-
|
|
1
|
+
import{bw as t,ap as r,$ as a,r as i,j as s}from"./index-RjRZanC1.js";import{O as c}from"./OnboardingWizard-soR-mgEP.js";import"./kbd-D0v8K9Au.js";import"./account-form-helpers-DshQgJkL.js";async function l(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:t()}),e.navigateToInbox()}function y(){const e=r(),o=a(),n=i.useCallback(m=>{l({queryClient:o,recordCompleted:()=>e.recordEvent("onboarding.completed"),navigateToInbox:()=>{window.location.assign("/mail")}})},[e,o]);return s.jsx(c,{skipWelcome:!1,onComplete:n})}export{y as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./index-
|
|
1
|
+
import{a as e}from"./index-RjRZanC1.js";const r=e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);export{r as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,b as N,ae as q,r as c,bM as z,b7 as O,bO as $,aq as I,cq as L,$ as k,at as C,cr as M,aS as P,B as S,S as A,ax as R,X as B}from"./index-
|
|
1
|
+
import{j as e,b as N,ae as q,r as c,bM as z,b7 as O,bO as $,aq as I,cq as L,$ as k,at as C,cr as M,aS as P,B as S,S as A,ax as R,X as B}from"./index-RjRZanC1.js";import{K as m}from"./kbd-D0v8K9Au.js";import{S as G,a as E}from"./settings-screen-_CM9NR95.js";import{E as V}from"./ErrorState-C4MPdySt.js";import{u as Q}from"./useDebouncedValue-p-uexMod.js";import{c as K}from"./format-B6Elex-n.js";import{S as _}from"./search-BZqLkx84.js";import"./avatar-mwB_u04P.js";function D({options:t,active:r,onSelect:x}){return e.jsx("div",{role:"tablist",className:N("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(a=>{const d=a.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>x(a.id),className:N("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:a.label}),e.jsx("span",{className:N("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:a.count??"—"})]},a.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"},F=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(m,{children:"v"})," VIP,"," ",e.jsx(m,{children:"m"})," mute, ",e.jsx(m,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]});function H({query:t,onCount:r}){const{data:x,isPending:a,isError:d,error:b}=I(L()),g=k(),i=C({...P(),onSettled:()=>{g.invalidateQueries({queryKey:M()})}}),l=x?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(n=>(n.displayName??"").toLowerCase().includes(p)||n.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),a?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:b})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(m,{children:"v"})," on any message to promote a sender to VIP."]}):u.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),u.map(n=>e.jsx(E,{name:n.displayName??n.normalizedEmail,email:n.normalizedEmail,meta:n.replyCount>0?`${n.inboundCount} received · you replied ${n.replyCount}×`:`${n.inboundCount} received · you've never replied`,trailing:e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(A,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:n.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},n.addressId))]})}function U({group:t,query:r,onCount:x}){const a=Q(r.trim(),300),d=k(),[b,g]=c.useState(null),i=a.length>=2,l=R({query:{q:a,limit:50}}),{data:p,isPending:u,isError:n,error:j}=I({...l,enabled:i}),h=C({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),f=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{x?.(i?f.length:0,null)},[x,i,f.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):n?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):f.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",a,"”."]}):e.jsx(e.Fragment,{children:f.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&K(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=h.isPending&&h.variables?.path.addressId===s.addressId,T=h.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:T?e.jsx(S,{variant:"secondary",size:"sm",onClick:()=>{g(s.addressId),h.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}})},children:"Retry"}):e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(g(s.addressId),h.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}}))}})},s.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",v[t].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(m,{children:"m"})," on any message to mute its sender; ",e.jsx(m,{children:"b"})," to block."]})]})}function ne(){const t=q(),[r,x]=c.useState("vip"),[a,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),n=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),h=p[r],f=s=>{const o=$[s];o&&t({to:o})};return e.jsx(G,{items:z,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:F,helpOpen:b,onToggleHelp:()=>g(s=>!s),onSelect:f,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(D,{active:r,onSelect:s=>{x(s),d("")},options:["vip","muted","blocked"].map(s=>({id:s,label:v[s],count:p[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(O,{icon:e.jsx(_,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:a,onChange:s=>d(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:r==="vip"?e.jsx(H,{query:a,onCount:n}):e.jsx(U,{group:r,query:a,onCount:j})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:h!=null?`${i} of ${h} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(m,{children:"j"})," ",e.jsx(m,{children:"k"})," navigate · ",e.jsx(m,{children:"⌫"})," remove flag"]})]})]})]})})}export{ne as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,bv as o}from"./index-RjRZanC1.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as z,r as g,j as e,b as m,B as x,X as j,d as S}from"./index-
|
|
1
|
+
import{a as z,r as g,j as e,b as m,B as x,X as j,d as S}from"./index-RjRZanC1.js";import{M as B,C as N,A as w}from"./avatar-mwB_u04P.js";const v=z("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);function L({items:l,activeId:t,title:i,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:f,onBackToMail:h}){const[y,c]=g.useState(!1),[u,C]=g.useState(!1),b=!!s&&d,p=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),c(!1)},className:m("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:m("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:h,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(v,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),p]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>c(!1)}),e.jsxs("aside",{className:"relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{h?.(),c(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(v,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(x,{variant:"ghost",size:"sm",icon:e.jsx(j,{className:"size-4"}),onClick:()=>c(!1),"aria-label":"Close menu"})]}),p]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[e.jsx(x,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-4"}),className:"lg:hidden",onClick:()=>c(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:i}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(x,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":u}),s&&!b&&e.jsx(x,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:f,"aria-label":"Show tips"})]}),s&&u&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),b&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(x,{variant:"ghost",size:"sm",icon:e.jsx(j,{className:"size-3.5"}),onClick:f,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function E({name:l,email:t,meta:i,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:m(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[i,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const O={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function F({label:l,email:t,connector:i,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=O[r];return e.jsxs("div",{className:m("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(S,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",i," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{F as A,L as S,E as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./index-
|
|
1
|
+
import{a as e}from"./index-RjRZanC1.js";const c=e("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const t=e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const o=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{c as C,t as R,o as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,bx as e}from"./index-
|
|
1
|
+
import{j as t,bx as e}from"./index-RjRZanC1.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o}from"./index-
|
|
1
|
+
import{r as o}from"./index-RjRZanC1.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aq as p,cl as L,$ as n,at as l,cm as d,r as o,cn as c,co as y,cp as g}from"./index-
|
|
1
|
+
import{aq as p,cl as L,$ as n,at as l,cm as d,r as o,cn as c,co as y,cp as g}from"./index-RjRZanC1.js";const u=e=>c({path:{accountId:e}}),P=e=>{const a=p({...L({path:{accountId:e??""}}),enabled:!!e});return{labels:a.data?.items??[],isPending:a.isPending,isError:a.isError,error:a.error,refetch:a.refetch}},f=e=>{const a=n(),t=l({...d(),onSuccess:()=>{e&&a.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:r}=t;return{createLabel:o.useCallback((s,i="Default")=>e?r({path:{accountId:e},body:{name:s,color:i}}):Promise.reject(new Error("No account")),[e,r]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},h=e=>{const a=n(),t=l({...y(),onSuccess:()=>{e&&a.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{updateLabel:o.useCallback((s,i)=>{e&&r({path:{accountId:e,labelId:s},body:i})},[e,r]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const a=n(),t=l({...g(),onSuccess:()=>{e&&a.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{deleteLabel:o.useCallback(s=>{e&&r({path:{accountId:e,labelId:s}})},[e,r]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{f as a,h as b,C as c,P as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as g,j as M,b as T,c1 as J,aq as U,c2 as q,$ as Y,at as E,c3 as K,c4 as Q,c5 as V,c6 as G,c7 as X,a$ as Z}from"./index-BgZZpZoW.js";const ee=320,te="cubic-bezier(0.32, 0.9, 0.3, 1)",ne=.5,re=.4,se=360;function ie(e){return Math.sign(e)*Math.sqrt(Math.abs(e))*4}function Qe({open:e,onClose:t,children:n,dismissLabel:r="Dismiss"}){const s=g.useRef(null),[i,o]=g.useState(se),[u,h]=g.useState(null);g.useLayoutEffect(()=>{const a=s.current;if(!a)return;const c=()=>o(a.offsetHeight);c();const l=new ResizeObserver(c);return l.observe(a),()=>l.disconnect()},[]);const m=g.useRef(null),b=g.useCallback(a=>{a.currentTarget.setPointerCapture(a.pointerId),m.current={startY:a.clientY,lastY:a.clientY,lastT:a.timeStamp,velocity:0,moved:!1},h(0)},[]),C=g.useCallback(a=>{const c=m.current;if(!c)return;const l=a.timeStamp-c.lastT;l>0&&(c.velocity=(a.clientY-c.lastY)/l),c.lastY=a.clientY,c.lastT=a.timeStamp;const d=a.clientY-c.startY;Math.abs(d)>4&&(c.moved=!0);const A=d<0?ie(d):d;h(A)},[]),p=g.useCallback(()=>{const a=m.current;if(m.current=null,!a)return;const c=a.lastY-a.startY,d=a.velocity>ne||c>i*re;h(null),d&&t()},[i,t]),v=u!==null,S=e?u??0:i,x=Math.min(Math.max(1-S/i,0),1),f=v?"none":`transform ${ee}ms ${te}`;return M.jsxs("div",{className:T("absolute inset-0 z-40 select-none overflow-hidden",e||v?"":"pointer-events-none"),children:[M.jsx("button",{type:"button","aria-label":r,tabIndex:-1,onClick:t,className:T("absolute inset-0 bg-black/40",x>0?"pointer-events-auto":"pointer-events-none"),style:{opacity:x*.6,transition:f.replace("transform","opacity")}}),M.jsxs("div",{ref:s,className:"absolute inset-x-0 bottom-0 flex max-h-[92%] flex-col rounded-t-3xl border-t border-line bg-surface shadow-2xl shadow-black/30",style:{transform:`translateY(${S}px)`,transition:f},children:[M.jsx("div",{role:"slider","aria-label":"Drag down to dismiss","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(x*100),tabIndex:0,onPointerDown:b,onPointerMove:C,onPointerUp:p,onPointerCancel:p,className:"flex cursor-grab touch-none justify-center pb-1 pt-2.5 active:cursor-grabbing",children:M.jsx("div",{className:"h-1 w-10 rounded-full bg-fg-subtle/40"})}),M.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:n})]})]})}function ae(e,t){return e.endsWith(t)?e.length===t.length||e[e.length-t.length-1]===".":!1}function oe(e,t){const n=e.length-t.length-2,r=e.lastIndexOf(".",n);return r===-1?e:e.slice(r+1)}function le(e,t,n){if(n.validHosts!==null){const s=n.validHosts;for(const i of s)if(ae(t,i))return i}let r=0;if(t.startsWith("."))for(;r<t.length&&t[r]===".";)r+=1;return e.length===t.length-r?null:oe(t,e)}const L=/[\t\n\r]/g;let P=!1;function k(e){return e>=97&&e<=122||e>=48&&e<=57||e>127||e>=65&&e<=90||e===45||e===95}function R(e,t,n){const r=n-t,s=e.charCodeAt(t)|32;if(r===2)return s===119&&(e.charCodeAt(t+1)|32)===115?1:0;if(r===3){const i=e.charCodeAt(t+1)|32,o=e.charCodeAt(t+2)|32;return s===119&&i===115&&o===115||s===102&&i===116&&o===112?1:0}else if(r===4){const i=e.charCodeAt(t+1)|32,o=e.charCodeAt(t+2)|32,u=e.charCodeAt(t+3)|32;return s===104&&i===116&&o===116&&u===112?1:s===102&&i===105&&o===108&&u===101?2:0}else if(r===5)return s===104&&(e.charCodeAt(t+1)|32)===116&&(e.charCodeAt(t+2)|32)===116&&(e.charCodeAt(t+3)|32)===112&&(e.charCodeAt(t+4)|32)===115?1:0;return 0}function O(e,t,n=!1){let r=0,s=e.length,i=!1,o=!1;if(P=!1,!t){if(e.startsWith("data:"))return null;for(;r<e.length&&e.charCodeAt(r)<=32;)r+=1;for(;s>r+1&&e.charCodeAt(s-1)<=32;)s-=1;if(e.charCodeAt(r)===47&&e.charCodeAt(r+1)===47)r+=2;else{const f=e.indexOf(":/",r);if(f!==-1){const a=R(e,r,f);if(a===1)for(o=!0,r=f+2;e.charCodeAt(r)===47||e.charCodeAt(r)===92;)r+=1;else if(a===2){o=!0,r=f+1;let c=0;for(;(e.charCodeAt(r)===47||e.charCodeAt(r)===92)&&c<2;)r+=1,c+=1;if(c<2)return null}else{for(let c=r;c<f;c+=1){const l=e.charCodeAt(c)|32;if(!(l>=97&&l<=122||l>=48&&l<=57||l===46||l===45||l===43)){const d=e.charCodeAt(c);return d===9||d===10||d===13?O(e.replace(L,""),t,n):null}}if(e.charCodeAt(f+2)===47)r=f+3;else return null}}else if(e.charCodeAt(r)!==91){let a=-1;for(let c=r;c<s;c+=1){const l=e.charCodeAt(c);if(l===9||l===10||l===13)return O(e.replace(L,""),t,n);if(l===58){a=c;break}if(l===47||l===92||l===63||l===35)break}if(a!==-1){let c=!1;for(let l=a+1;l<s;l+=1){const d=e.charCodeAt(l);if(d===47||d===92||d===63||d===35)break;if(d===64){c=!0;break}}if(!c){let l=!0,d=a+1;for(;d<s;d+=1){const A=e.charCodeAt(d);if(A===47||A===92||A===63||A===35)break;if(A<48||A>57){l=!1;break}}if(d===a+1&&(l=!1),!l){const A=R(e,r,a);if(A===0){let w=!1;for(let D=a+1;D<s;D+=1){const I=e.charCodeAt(D);if(I===47||I===92||I===63||I===35)break;if(I===58){w=!0;break}}if(!w)return null}else if(o=!0,r=a+1,A===2){let w=0;for(;(e.charCodeAt(r)===47||e.charCodeAt(r)===92)&&w<2;)r+=1,w+=1;if(w<2)return null}else for(;e.charCodeAt(r)===47||e.charCodeAt(r)===92;)r+=1}}}}}let h=-1,m=-1,b=-1,C=-1,p=!1,v=n,S=r-1,x=-1;if(n&&r<s){const f=e.charCodeAt(r);(!(k(f)||f===46||f===95)||f===45)&&(v=!1)}for(let f=r;f<s;f+=1){const a=e.charCodeAt(f);if(a<64)if(a===47||a===35||a===63){s=f;break}else a===58?(C===-1&&(C=f),b=f):a===9||a===10||a===13?p=!0:n&&(a===46?((f-S>64||x===46||x===45)&&(v=!1),S=f):(a<48||a>57)&&(a!==45||x===46)&&(v=!1));else if(o&&a===92){s=f;break}else a===64?(h=f,C=-1):a===93?m=f:a>=65&&a<=90?i=!0:n&&!k(a)&&(v=!1);n&&(x=a)}if(p)return O(e.replace(L,""),t,n);if(h!==-1&&h>=r&&h<s&&(r=h+1),e.charCodeAt(r)===91)return m!==-1?e.slice(r+1,m).toLowerCase():null;if(b!==-1&&b>r&&b<s&&C===b&&(s=b),r>=s)return null;n&&v&&h===-1&&b===-1&&m===-1&&e.charCodeAt(s-1)!==46&&s-r<=255&&s-S-1<=63&&x!==45&&(P=!0)}for(;s>r+1&&e.charCodeAt(s-1)===46;)s-=1;const u=r!==0||s!==e.length?e.slice(r,s):e;return i?u.toLowerCase():u}function ce(e){if(e.length<7||e.length>15)return!1;let t=0;for(let n=0;n<e.length;n+=1){const r=e.charCodeAt(n);if(r===46)t+=1;else if(r<48||r>57)return!1}return t===3&&e.charCodeAt(0)!==46&&e.charCodeAt(e.length-1)!==46}function ue(e){if(e.length<3)return!1;let t=e.startsWith("[")?1:0,n=e.length;if(e[n-1]==="]"&&(n-=1),n-t>39)return!1;let r=!1;for(;t<n;t+=1){const s=e.charCodeAt(t);if(s===58)r=!0;else if(!(s>=48&&s<=57||s>=97&&s<=102||s>=65&&s<=70))return!1}return r}function fe(e){return ue(e)||ce(e)}function _(e){return e>=97&&e<=122||e>=48&&e<=57||e>127}function j(e){if(e.length>255||e.length===0||!_(e.charCodeAt(0))&&e.charCodeAt(0)!==46&&e.charCodeAt(0)!==95)return!1;let t=-1,n=-1;const r=e.length;for(let s=0;s<r;s+=1){const i=e.charCodeAt(s);if(i===46){if(s-t>64||n===46||n===45)return!1;t=s}else if(!(_(i)||i===45||i===95)||i===45&&n===46)return!1;n=i}return r-t-1<=63&&n!==45}function de({allowIcannDomains:e=!0,allowPrivateDomains:t=!1,detectIp:n=!0,detectSpecialUse:r=!1,extractHostname:s=!0,mixedInputs:i=!0,validHosts:o=null,validateHostname:u=!0}){return{allowIcannDomains:e,allowPrivateDomains:t,detectIp:n,detectSpecialUse:r,extractHostname:s,mixedInputs:i,validHosts:o,validateHostname:u}}const he=de({});function me(e){return he}function pe(){return{domain:null,domainWithoutSuffix:null,hostname:null,isIcann:null,isIp:null,isPrivate:null,isSpecialUse:null,publicSuffix:null,subdomain:null}}function ge(e){e.domain=null,e.domainWithoutSuffix=null,e.hostname=null,e.isIcann=null,e.isIp=null,e.isPrivate=null,e.isSpecialUse=null,e.publicSuffix=null,e.subdomain=null}function be(e,t,n,r,s){const i=me();if(typeof e!="string")return s;let o=!1;return i.extractHostname?i.mixedInputs?(o=j(e),s.hostname=O(e,o,i.validateHostname)):s.hostname=O(e,!1,i.validateHostname):s.hostname=e,i.detectIp&&s.hostname!==null&&(s.isIp=fe(s.hostname),s.isIp)?s:i.validateHostname&&i.extractHostname&&s.hostname!==null&&!(o&&s.hostname===e)&&!P&&!j(s.hostname)?(s.hostname=null,s):(s.hostname===null||(n(s.hostname,i,s),s.publicSuffix===null)||(s.domain=le(s.publicSuffix,s.hostname,i)),s)}const z=pe();function Ce(e,t){return ge(z),be(e,3,J,t,z).domain}const F=e=>{const t=new Set,n=[];for(const r of e){const s=r.trim();if(s==="")continue;const i=s.toLowerCase();t.has(i)||(t.add(i),n.push(s))}return n},ve=e=>{const t=e.lastIndexOf("@");return t>=0?e.slice(t+1):e},Ae=e=>Ce(ve(e.trim())),xe=e=>{const t=F(e);if(t.length<2)return null;let n=null;for(const r of t){const s=Ae(r);if(s===null)return null;if(n===null)n=s;else if(n!==s)return null}return n},Se=e=>{const t=xe(e);return t!==null?[{field:"FromDomain",value:t}]:F(e).map(n=>({field:"From",value:n}))},we=/^\s*(?:(?:re|aw|fwd?|vs|sv|antw|res|enc|tr)\s*(?:\[\d+\])?\s*:|\[[^\]]{1,32}\])\s*/i,Me=e=>{let t=e.replace(/\s+/g," ").trim();for(;;){const n=t.replace(we,"");if(n===t)return t.trim();t=n}},Ie=new Set(["a","an","and","are","as","at","be","by","for","from","has","have","in","is","it","me","my","new","of","on","or","our","the","this","to","was","we","with","you","your"]),Oe=3,N=e=>e.split(" ").filter(t=>t!==""),H=e=>e.length===0||e.join(" ").length<Oe?!1:e.some(t=>!Ie.has(t.toLowerCase())),ye=(e,t)=>e.findIndex((n,r)=>t.every((s,i)=>e[r+i]?.toLowerCase()===s.toLowerCase())),Ee=e=>{const t=e.map(Me).filter(i=>i!=="");if(t.length===0)return;const[n,...r]=t;if(r.length===0)return H(N(n))?n:void 0;const s=N(n);for(let i=s.length;i>0;i-=1)for(let o=0;o+i<=s.length;o+=1){const u=s.slice(o,o+i);if(H(u)&&r.every(h=>ye(N(h),u)>=0))return u.join(" ")}},De=(e,t)=>{const n=Se(e);if(F(e).length===1||n.length===1&&n[0].field==="FromDomain")return n;const r=Ee(t);return r!==void 0?[{field:"Subject",value:r}]:n},Le=e=>{const[t,n]=g.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return g.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia(e),s=i=>n(i.matches);return n(r.matches),r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[e]),t},Ve=()=>Le("(min-width: 1024px)"),y="None",Ge=e=>!e.literalClauses.some(t=>t.field==="HasWords"),W=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??y,actionMailboxId:e.moveMailboxId??y}),Ne=(e,t,n)=>({name:n,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??y,actionMailboxId:e.moveMailboxId??y,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),Xe=(e,t)=>{if(e.state==="Expired")return"Expired";if(e.scope!=="Temporary"||!e.expiresAt)return"Active";const n=Date.parse(e.expiresAt);return Number.isNaN(n)?"Active":n<=t?"Expired":"Active"},Ze=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},Pe=(e,t=new Date)=>{if(!e)return;const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!n)return;const[,r,s,i]=n,o=new Date(Number(r),Number(s)-1,Number(i),23,59,59,0);if(Number.isNaN(o.getTime()))return;const u=-t.getTimezoneOffset(),h=u>=0?"+":"-",m=Math.abs(u),b=String(Math.floor(m/60)).padStart(2,"0"),C=String(m%60).padStart(2,"0"),p=v=>String(v).padStart(2,"0");return`${o.getFullYear()}-${p(o.getMonth()+1)}-${p(o.getDate())}T${p(o.getHours())}:${p(o.getMinutes())}:${p(o.getSeconds())}${h}${b}:${C}`},et=["From","Subject","HasWords","ListId","FromDomain"],Fe=e=>{const t=e.trim(),n=t.match(/<([^>]+)>/);return(n?n[1]:t).trim().toLowerCase()},tt=(e,t)=>e==="ListId"?Fe(t):t.trim(),Te=e=>e==="all"?"And":"Or",ke=e=>e?"properties":"similar",Re=(e,t)=>De(e,t).map((n,r)=>({id:`derived-${r}`,field:n.field,value:n.value,derived:!0})),_e=(e,t)=>{const n=t.keepClauses??[];if(e==="properties"){const r=Re(t.senders,t.subjects).filter(s=>!n.some(i=>i.field===s.field&&i.value===s.value));return{clauses:[...n,...r],matchOperator:n.length>0?t.currentOperator??"any":"any",widen:void 0}}return{clauses:n,matchOperator:n.length>0?t.currentOperator??"all":"all",widen:t.anchorMessageId?{anchorCount:Math.max(t.selectionCount,1)}:void 0}},nt=e=>{const t=e.seedScope??"once",n=e.matchMode??ke(e.semanticUnavailable);return{..._e(n,{anchorMessageId:e.anchorMessageId,senders:e.senders,subjects:e.subjects??[],selectionCount:e.selectionCount}),moveMailboxId:e.seedMailboxId,scope:t,name:""}},je=(e,t)=>{const n=e.widen!==void 0&&!e.widen.inactive,r=e.clauses.map(s=>({field:s.field,value:s.value}));return{...n&&t?{anchorMessageId:t}:{},matchOperator:Te(e.matchOperator),literalClauses:r}},ze=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),He="Can't count matches — “has the words” reads message bodies, which only a saved rule does.",$e=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),rt=(e,t)=>{const n=je(e,t);return{...n.anchorMessageId?{anchorMessageId:n.anchorMessageId}:{},matchOperator:n.matchOperator,literalClauses:n.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?Pe(e.until??""):void 0}},Ue=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},Ye=350,B=e=>Q({path:{accountId:e}}),st=e=>{const t=U({...q({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},it=e=>{const t=Y(),n=E({...V(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:B(e)})}}),{mutate:r}=n;return{createFilter:g.useCallback((i,o,u)=>{e&&r({path:{accountId:e},body:Ne(i,o,u)})},[e,r]),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,error:n.error,reset:n.reset}},at=e=>{const t=Y(),n=E({...K(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:B(e)})}}),{mutate:r}=n;return{deleteFilter:g.useCallback(i=>{e&&r({path:{accountId:e,filterId:i}})},[e,r]),isPending:n.isPending,deletingFilterId:n.isPending?n.variables?.path.filterId:void 0}},We=new Set(["Complete","Failed"]),$=e=>e!==void 0&&We.has(e),Be=1e3,Je=15e3,qe=e=>{const t=Math.max(0,e),n=Be*2**t;return Math.min(n,Je)},ot=e=>{const[t,n]=g.useState(),r=E({...G(),onSuccess:C=>n(C.organizeJobId)}),{mutate:s}=r,i=U({...X({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:C=>{const p=C.state.data?.state;return $(p)?!1:qe(C.state.dataUpdateCount)}}),o=g.useCallback(C=>{e&&(n(void 0),s({path:{accountId:e},body:W(C)}))},[e,s]),u=i.data,h=u?.state??r.data?.state,m=$(u?.state),b={state:h,matchedCount:u?.matchedCount??0,appliedCount:u?.appliedCount??0,failedCount:u?.failedCount??0,errorMessage:u?.errorMessage??""};return{start:o,progress:b,isStarting:r.isPending,isRunning:!!t&&!m,isDone:m,isError:r.isError||i.isError,error:r.error??i.error}},lt=(e,t,n)=>{const r=E(Z()),{mutateAsync:s}=r,i=$e(t),[o,u]=g.useState(()=>n===void 0?{}:{count:n,previewedSignature:i}),h=g.useRef(t);h.current=t;const m=g.useRef(i),b=ze(t);return g.useEffect(()=>{if(!e||!b||i===o.previewedSignature||i===o.errorSignature)return;const C=setTimeout(()=>{const p=i;m.current=p,s({path:{accountId:e},body:W({...h.current})}).then(v=>{m.current===p&&u({count:v.matchedCount,previewedSignature:p})}).catch(v=>{m.current===p&&u(S=>({...S,error:v instanceof Error?v.message:"Couldn't count matches.",errorSignature:p}))})},Ye);return()=>clearTimeout(C)},[e,b,i,o.previewedSignature,o.errorSignature,s]),b?Ue(o,i):{status:"error",reason:He}};export{Qe as B,y as N,et as S,Le as a,W as b,lt as c,ot as d,it as e,rt as f,Se as g,F as h,ze as i,ke as j,nt as k,Ge as l,_e as m,tt as n,B as o,Pe as p,Xe as q,je as r,Ae as s,Ze as t,Ve as u,st as v,at as w};
|
|
1
|
+
import{r as g,j as M,b as T,c1 as J,aq as U,c2 as q,$ as Y,at as E,c3 as K,c4 as Q,c5 as V,c6 as G,c7 as X,a$ as Z}from"./index-RjRZanC1.js";const ee=320,te="cubic-bezier(0.32, 0.9, 0.3, 1)",ne=.5,re=.4,se=360;function ie(e){return Math.sign(e)*Math.sqrt(Math.abs(e))*4}function Qe({open:e,onClose:t,children:n,dismissLabel:r="Dismiss"}){const s=g.useRef(null),[i,o]=g.useState(se),[u,h]=g.useState(null);g.useLayoutEffect(()=>{const a=s.current;if(!a)return;const c=()=>o(a.offsetHeight);c();const l=new ResizeObserver(c);return l.observe(a),()=>l.disconnect()},[]);const m=g.useRef(null),b=g.useCallback(a=>{a.currentTarget.setPointerCapture(a.pointerId),m.current={startY:a.clientY,lastY:a.clientY,lastT:a.timeStamp,velocity:0,moved:!1},h(0)},[]),C=g.useCallback(a=>{const c=m.current;if(!c)return;const l=a.timeStamp-c.lastT;l>0&&(c.velocity=(a.clientY-c.lastY)/l),c.lastY=a.clientY,c.lastT=a.timeStamp;const d=a.clientY-c.startY;Math.abs(d)>4&&(c.moved=!0);const A=d<0?ie(d):d;h(A)},[]),p=g.useCallback(()=>{const a=m.current;if(m.current=null,!a)return;const c=a.lastY-a.startY,d=a.velocity>ne||c>i*re;h(null),d&&t()},[i,t]),v=u!==null,S=e?u??0:i,x=Math.min(Math.max(1-S/i,0),1),f=v?"none":`transform ${ee}ms ${te}`;return M.jsxs("div",{className:T("absolute inset-0 z-40 select-none overflow-hidden",e||v?"":"pointer-events-none"),children:[M.jsx("button",{type:"button","aria-label":r,tabIndex:-1,onClick:t,className:T("absolute inset-0 bg-black/40",x>0?"pointer-events-auto":"pointer-events-none"),style:{opacity:x*.6,transition:f.replace("transform","opacity")}}),M.jsxs("div",{ref:s,className:"absolute inset-x-0 bottom-0 flex max-h-[92%] flex-col rounded-t-3xl border-t border-line bg-surface shadow-2xl shadow-black/30",style:{transform:`translateY(${S}px)`,transition:f},children:[M.jsx("div",{role:"slider","aria-label":"Drag down to dismiss","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(x*100),tabIndex:0,onPointerDown:b,onPointerMove:C,onPointerUp:p,onPointerCancel:p,className:"flex cursor-grab touch-none justify-center pb-1 pt-2.5 active:cursor-grabbing",children:M.jsx("div",{className:"h-1 w-10 rounded-full bg-fg-subtle/40"})}),M.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:n})]})]})}function ae(e,t){return e.endsWith(t)?e.length===t.length||e[e.length-t.length-1]===".":!1}function oe(e,t){const n=e.length-t.length-2,r=e.lastIndexOf(".",n);return r===-1?e:e.slice(r+1)}function le(e,t,n){if(n.validHosts!==null){const s=n.validHosts;for(const i of s)if(ae(t,i))return i}let r=0;if(t.startsWith("."))for(;r<t.length&&t[r]===".";)r+=1;return e.length===t.length-r?null:oe(t,e)}const L=/[\t\n\r]/g;let P=!1;function k(e){return e>=97&&e<=122||e>=48&&e<=57||e>127||e>=65&&e<=90||e===45||e===95}function R(e,t,n){const r=n-t,s=e.charCodeAt(t)|32;if(r===2)return s===119&&(e.charCodeAt(t+1)|32)===115?1:0;if(r===3){const i=e.charCodeAt(t+1)|32,o=e.charCodeAt(t+2)|32;return s===119&&i===115&&o===115||s===102&&i===116&&o===112?1:0}else if(r===4){const i=e.charCodeAt(t+1)|32,o=e.charCodeAt(t+2)|32,u=e.charCodeAt(t+3)|32;return s===104&&i===116&&o===116&&u===112?1:s===102&&i===105&&o===108&&u===101?2:0}else if(r===5)return s===104&&(e.charCodeAt(t+1)|32)===116&&(e.charCodeAt(t+2)|32)===116&&(e.charCodeAt(t+3)|32)===112&&(e.charCodeAt(t+4)|32)===115?1:0;return 0}function O(e,t,n=!1){let r=0,s=e.length,i=!1,o=!1;if(P=!1,!t){if(e.startsWith("data:"))return null;for(;r<e.length&&e.charCodeAt(r)<=32;)r+=1;for(;s>r+1&&e.charCodeAt(s-1)<=32;)s-=1;if(e.charCodeAt(r)===47&&e.charCodeAt(r+1)===47)r+=2;else{const f=e.indexOf(":/",r);if(f!==-1){const a=R(e,r,f);if(a===1)for(o=!0,r=f+2;e.charCodeAt(r)===47||e.charCodeAt(r)===92;)r+=1;else if(a===2){o=!0,r=f+1;let c=0;for(;(e.charCodeAt(r)===47||e.charCodeAt(r)===92)&&c<2;)r+=1,c+=1;if(c<2)return null}else{for(let c=r;c<f;c+=1){const l=e.charCodeAt(c)|32;if(!(l>=97&&l<=122||l>=48&&l<=57||l===46||l===45||l===43)){const d=e.charCodeAt(c);return d===9||d===10||d===13?O(e.replace(L,""),t,n):null}}if(e.charCodeAt(f+2)===47)r=f+3;else return null}}else if(e.charCodeAt(r)!==91){let a=-1;for(let c=r;c<s;c+=1){const l=e.charCodeAt(c);if(l===9||l===10||l===13)return O(e.replace(L,""),t,n);if(l===58){a=c;break}if(l===47||l===92||l===63||l===35)break}if(a!==-1){let c=!1;for(let l=a+1;l<s;l+=1){const d=e.charCodeAt(l);if(d===47||d===92||d===63||d===35)break;if(d===64){c=!0;break}}if(!c){let l=!0,d=a+1;for(;d<s;d+=1){const A=e.charCodeAt(d);if(A===47||A===92||A===63||A===35)break;if(A<48||A>57){l=!1;break}}if(d===a+1&&(l=!1),!l){const A=R(e,r,a);if(A===0){let w=!1;for(let D=a+1;D<s;D+=1){const I=e.charCodeAt(D);if(I===47||I===92||I===63||I===35)break;if(I===58){w=!0;break}}if(!w)return null}else if(o=!0,r=a+1,A===2){let w=0;for(;(e.charCodeAt(r)===47||e.charCodeAt(r)===92)&&w<2;)r+=1,w+=1;if(w<2)return null}else for(;e.charCodeAt(r)===47||e.charCodeAt(r)===92;)r+=1}}}}}let h=-1,m=-1,b=-1,C=-1,p=!1,v=n,S=r-1,x=-1;if(n&&r<s){const f=e.charCodeAt(r);(!(k(f)||f===46||f===95)||f===45)&&(v=!1)}for(let f=r;f<s;f+=1){const a=e.charCodeAt(f);if(a<64)if(a===47||a===35||a===63){s=f;break}else a===58?(C===-1&&(C=f),b=f):a===9||a===10||a===13?p=!0:n&&(a===46?((f-S>64||x===46||x===45)&&(v=!1),S=f):(a<48||a>57)&&(a!==45||x===46)&&(v=!1));else if(o&&a===92){s=f;break}else a===64?(h=f,C=-1):a===93?m=f:a>=65&&a<=90?i=!0:n&&!k(a)&&(v=!1);n&&(x=a)}if(p)return O(e.replace(L,""),t,n);if(h!==-1&&h>=r&&h<s&&(r=h+1),e.charCodeAt(r)===91)return m!==-1?e.slice(r+1,m).toLowerCase():null;if(b!==-1&&b>r&&b<s&&C===b&&(s=b),r>=s)return null;n&&v&&h===-1&&b===-1&&m===-1&&e.charCodeAt(s-1)!==46&&s-r<=255&&s-S-1<=63&&x!==45&&(P=!0)}for(;s>r+1&&e.charCodeAt(s-1)===46;)s-=1;const u=r!==0||s!==e.length?e.slice(r,s):e;return i?u.toLowerCase():u}function ce(e){if(e.length<7||e.length>15)return!1;let t=0;for(let n=0;n<e.length;n+=1){const r=e.charCodeAt(n);if(r===46)t+=1;else if(r<48||r>57)return!1}return t===3&&e.charCodeAt(0)!==46&&e.charCodeAt(e.length-1)!==46}function ue(e){if(e.length<3)return!1;let t=e.startsWith("[")?1:0,n=e.length;if(e[n-1]==="]"&&(n-=1),n-t>39)return!1;let r=!1;for(;t<n;t+=1){const s=e.charCodeAt(t);if(s===58)r=!0;else if(!(s>=48&&s<=57||s>=97&&s<=102||s>=65&&s<=70))return!1}return r}function fe(e){return ue(e)||ce(e)}function _(e){return e>=97&&e<=122||e>=48&&e<=57||e>127}function j(e){if(e.length>255||e.length===0||!_(e.charCodeAt(0))&&e.charCodeAt(0)!==46&&e.charCodeAt(0)!==95)return!1;let t=-1,n=-1;const r=e.length;for(let s=0;s<r;s+=1){const i=e.charCodeAt(s);if(i===46){if(s-t>64||n===46||n===45)return!1;t=s}else if(!(_(i)||i===45||i===95)||i===45&&n===46)return!1;n=i}return r-t-1<=63&&n!==45}function de({allowIcannDomains:e=!0,allowPrivateDomains:t=!1,detectIp:n=!0,detectSpecialUse:r=!1,extractHostname:s=!0,mixedInputs:i=!0,validHosts:o=null,validateHostname:u=!0}){return{allowIcannDomains:e,allowPrivateDomains:t,detectIp:n,detectSpecialUse:r,extractHostname:s,mixedInputs:i,validHosts:o,validateHostname:u}}const he=de({});function me(e){return he}function pe(){return{domain:null,domainWithoutSuffix:null,hostname:null,isIcann:null,isIp:null,isPrivate:null,isSpecialUse:null,publicSuffix:null,subdomain:null}}function ge(e){e.domain=null,e.domainWithoutSuffix=null,e.hostname=null,e.isIcann=null,e.isIp=null,e.isPrivate=null,e.isSpecialUse=null,e.publicSuffix=null,e.subdomain=null}function be(e,t,n,r,s){const i=me();if(typeof e!="string")return s;let o=!1;return i.extractHostname?i.mixedInputs?(o=j(e),s.hostname=O(e,o,i.validateHostname)):s.hostname=O(e,!1,i.validateHostname):s.hostname=e,i.detectIp&&s.hostname!==null&&(s.isIp=fe(s.hostname),s.isIp)?s:i.validateHostname&&i.extractHostname&&s.hostname!==null&&!(o&&s.hostname===e)&&!P&&!j(s.hostname)?(s.hostname=null,s):(s.hostname===null||(n(s.hostname,i,s),s.publicSuffix===null)||(s.domain=le(s.publicSuffix,s.hostname,i)),s)}const z=pe();function Ce(e,t){return ge(z),be(e,3,J,t,z).domain}const F=e=>{const t=new Set,n=[];for(const r of e){const s=r.trim();if(s==="")continue;const i=s.toLowerCase();t.has(i)||(t.add(i),n.push(s))}return n},ve=e=>{const t=e.lastIndexOf("@");return t>=0?e.slice(t+1):e},Ae=e=>Ce(ve(e.trim())),xe=e=>{const t=F(e);if(t.length<2)return null;let n=null;for(const r of t){const s=Ae(r);if(s===null)return null;if(n===null)n=s;else if(n!==s)return null}return n},Se=e=>{const t=xe(e);return t!==null?[{field:"FromDomain",value:t}]:F(e).map(n=>({field:"From",value:n}))},we=/^\s*(?:(?:re|aw|fwd?|vs|sv|antw|res|enc|tr)\s*(?:\[\d+\])?\s*:|\[[^\]]{1,32}\])\s*/i,Me=e=>{let t=e.replace(/\s+/g," ").trim();for(;;){const n=t.replace(we,"");if(n===t)return t.trim();t=n}},Ie=new Set(["a","an","and","are","as","at","be","by","for","from","has","have","in","is","it","me","my","new","of","on","or","our","the","this","to","was","we","with","you","your"]),Oe=3,N=e=>e.split(" ").filter(t=>t!==""),H=e=>e.length===0||e.join(" ").length<Oe?!1:e.some(t=>!Ie.has(t.toLowerCase())),ye=(e,t)=>e.findIndex((n,r)=>t.every((s,i)=>e[r+i]?.toLowerCase()===s.toLowerCase())),Ee=e=>{const t=e.map(Me).filter(i=>i!=="");if(t.length===0)return;const[n,...r]=t;if(r.length===0)return H(N(n))?n:void 0;const s=N(n);for(let i=s.length;i>0;i-=1)for(let o=0;o+i<=s.length;o+=1){const u=s.slice(o,o+i);if(H(u)&&r.every(h=>ye(N(h),u)>=0))return u.join(" ")}},De=(e,t)=>{const n=Se(e);if(F(e).length===1||n.length===1&&n[0].field==="FromDomain")return n;const r=Ee(t);return r!==void 0?[{field:"Subject",value:r}]:n},Le=e=>{const[t,n]=g.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return g.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia(e),s=i=>n(i.matches);return n(r.matches),r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[e]),t},Ve=()=>Le("(min-width: 1024px)"),y="None",Ge=e=>!e.literalClauses.some(t=>t.field==="HasWords"),W=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??y,actionMailboxId:e.moveMailboxId??y}),Ne=(e,t,n)=>({name:n,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??y,actionMailboxId:e.moveMailboxId??y,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),Xe=(e,t)=>{if(e.state==="Expired")return"Expired";if(e.scope!=="Temporary"||!e.expiresAt)return"Active";const n=Date.parse(e.expiresAt);return Number.isNaN(n)?"Active":n<=t?"Expired":"Active"},Ze=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},Pe=(e,t=new Date)=>{if(!e)return;const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!n)return;const[,r,s,i]=n,o=new Date(Number(r),Number(s)-1,Number(i),23,59,59,0);if(Number.isNaN(o.getTime()))return;const u=-t.getTimezoneOffset(),h=u>=0?"+":"-",m=Math.abs(u),b=String(Math.floor(m/60)).padStart(2,"0"),C=String(m%60).padStart(2,"0"),p=v=>String(v).padStart(2,"0");return`${o.getFullYear()}-${p(o.getMonth()+1)}-${p(o.getDate())}T${p(o.getHours())}:${p(o.getMinutes())}:${p(o.getSeconds())}${h}${b}:${C}`},et=["From","Subject","HasWords","ListId","FromDomain"],Fe=e=>{const t=e.trim(),n=t.match(/<([^>]+)>/);return(n?n[1]:t).trim().toLowerCase()},tt=(e,t)=>e==="ListId"?Fe(t):t.trim(),Te=e=>e==="all"?"And":"Or",ke=e=>e?"properties":"similar",Re=(e,t)=>De(e,t).map((n,r)=>({id:`derived-${r}`,field:n.field,value:n.value,derived:!0})),_e=(e,t)=>{const n=t.keepClauses??[];if(e==="properties"){const r=Re(t.senders,t.subjects).filter(s=>!n.some(i=>i.field===s.field&&i.value===s.value));return{clauses:[...n,...r],matchOperator:n.length>0?t.currentOperator??"any":"any",widen:void 0}}return{clauses:n,matchOperator:n.length>0?t.currentOperator??"all":"all",widen:t.anchorMessageId?{anchorCount:Math.max(t.selectionCount,1)}:void 0}},nt=e=>{const t=e.seedScope??"once",n=e.matchMode??ke(e.semanticUnavailable);return{..._e(n,{anchorMessageId:e.anchorMessageId,senders:e.senders,subjects:e.subjects??[],selectionCount:e.selectionCount}),moveMailboxId:e.seedMailboxId,scope:t,name:""}},je=(e,t)=>{const n=e.widen!==void 0&&!e.widen.inactive,r=e.clauses.map(s=>({field:s.field,value:s.value}));return{...n&&t?{anchorMessageId:t}:{},matchOperator:Te(e.matchOperator),literalClauses:r}},ze=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),He="Can't count matches — “has the words” reads message bodies, which only a saved rule does.",$e=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),rt=(e,t)=>{const n=je(e,t);return{...n.anchorMessageId?{anchorMessageId:n.anchorMessageId}:{},matchOperator:n.matchOperator,literalClauses:n.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?Pe(e.until??""):void 0}},Ue=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},Ye=350,B=e=>Q({path:{accountId:e}}),st=e=>{const t=U({...q({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},it=e=>{const t=Y(),n=E({...V(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:B(e)})}}),{mutate:r}=n;return{createFilter:g.useCallback((i,o,u)=>{e&&r({path:{accountId:e},body:Ne(i,o,u)})},[e,r]),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,error:n.error,reset:n.reset}},at=e=>{const t=Y(),n=E({...K(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:B(e)})}}),{mutate:r}=n;return{deleteFilter:g.useCallback(i=>{e&&r({path:{accountId:e,filterId:i}})},[e,r]),isPending:n.isPending,deletingFilterId:n.isPending?n.variables?.path.filterId:void 0}},We=new Set(["Complete","Failed"]),$=e=>e!==void 0&&We.has(e),Be=1e3,Je=15e3,qe=e=>{const t=Math.max(0,e),n=Be*2**t;return Math.min(n,Je)},ot=e=>{const[t,n]=g.useState(),r=E({...G(),onSuccess:C=>n(C.organizeJobId)}),{mutate:s}=r,i=U({...X({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:C=>{const p=C.state.data?.state;return $(p)?!1:qe(C.state.dataUpdateCount)}}),o=g.useCallback(C=>{e&&(n(void 0),s({path:{accountId:e},body:W(C)}))},[e,s]),u=i.data,h=u?.state??r.data?.state,m=$(u?.state),b={state:h,matchedCount:u?.matchedCount??0,appliedCount:u?.appliedCount??0,failedCount:u?.failedCount??0,errorMessage:u?.errorMessage??""};return{start:o,progress:b,isStarting:r.isPending,isRunning:!!t&&!m,isDone:m,isError:r.isError||i.isError,error:r.error??i.error}},lt=(e,t,n)=>{const r=E(Z()),{mutateAsync:s}=r,i=$e(t),[o,u]=g.useState(()=>n===void 0?{}:{count:n,previewedSignature:i}),h=g.useRef(t);h.current=t;const m=g.useRef(i),b=ze(t);return g.useEffect(()=>{if(!e||!b||i===o.previewedSignature||i===o.errorSignature)return;const C=setTimeout(()=>{const p=i;m.current=p,s({path:{accountId:e},body:W({...h.current})}).then(v=>{m.current===p&&u({count:v.matchedCount,previewedSignature:p})}).catch(v=>{m.current===p&&u(S=>({...S,error:v instanceof Error?v.message:"Couldn't count matches.",errorSignature:p}))})},Ye);return()=>clearTimeout(C)},[e,b,i,o.previewedSignature,o.errorSignature,s]),b?Ue(o,i):{status:"error",reason:He}};export{Qe as B,y as N,et as S,Le as a,W as b,lt as c,ot as d,it as e,rt as f,Se as g,F as h,ze as i,ke as j,nt as k,Ge as l,_e as m,tt as n,B as o,Pe as p,Xe as q,je as r,Ae as s,Ze as t,Ve as u,st as v,at as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as y,j as i,B as u,b as m,L as p,$ as x,aB as C,aq as h,aA as j,at as L,aF as k,bw as E,bA as O}from"./index-
|
|
1
|
+
import{r as y,j as i,B as u,b as m,L as p,$ as x,aB as C,aq as h,aA as j,at as L,aF as k,bw as E,bA as O}from"./index-RjRZanC1.js";const t=()=>i.jsx(p,{className:"size-3.5 animate-spin"}),f=(s,n)=>n?i.jsx("span",{className:"sr-only",children:s}):s;function S({actions:s=[],destructive:n,className:l}){const[r,o]=y.useState(!1);return r&&n?.confirm?i.jsxs("div",{className:m("flex items-center gap-2",l),children:[i.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),i.jsx(u,{variant:"secondary",size:"sm",onClick:()=>o(!1),children:n.confirm.cancelLabel??"Cancel"}),i.jsx(u,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?t():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):i.jsxs("div",{className:m("flex items-center gap-2",l),children:[s.map(a=>i.jsx(u,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?t():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:f(a.label,a.iconOnly)},a.label)),n&&i.jsx(u,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?t():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){o(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:f(n.label,n.iconOnly)})]})}const c={html:"",plainText:""},z=s=>{const n=x(),{pushError:l}=C(),{data:r}=h({...j(),staleTime:1/0}),o=y.useMemo(()=>{if(!s||!r)return c;const e=r.accounts.find(b=>b.accountId===s);return e?{html:e.signatureHtml??"",plainText:e.signaturePlainText??""}:c},[s,r]),a=L({...O(),onSuccess:()=>{n.invalidateQueries({queryKey:E()})},onError:e=>{l(k("Couldn't save signature","The signature wasn't saved.",e))}}),g=y.useCallback((e,b)=>{s&&a.mutate({path:{accountId:s},body:{signatureHtml:e,signaturePlainText:b}})},[s,a]);return{signature:o,setSignature:g,isSaving:a.isPending}};export{S as R,z as u};
|
package/index.html
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
} catch (_) {}
|
|
32
32
|
})();
|
|
33
33
|
</script>
|
|
34
|
-
<script type="module" crossorigin src="/assets/index-
|
|
34
|
+
<script type="module" crossorigin src="/assets/index-RjRZanC1.js"></script>
|
|
35
35
|
<link rel="stylesheet" crossorigin href="/assets/index-DZa4p56e.css">
|
|
36
36
|
</head>
|
|
37
37
|
<body>
|
package/package.json
CHANGED
package/assets/index-CSK29bfP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,bx as o}from"./index-BgZZpZoW.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,bv as o}from"./index-BgZZpZoW.js";const n=()=>t.jsx(o,{});export{n as component};
|