ages/zoneless-workers/utils/useDebouncedValue.ts"),k=n("../../../../node_modules/punycode/punycode.es6.js");const H=y()` { viewer { zones(filter: { zoneTag: $zoneTag }) { emailRoutingAdaptive( limit: 10000 filter: $filter orderBy: [datetime_DESC, from_ASC, to_ASC, status_ASC] ) { datetime id: sessionId messageId from to subject status action spf dkim dmarc arc errorDetail isNDR isSpam spamThreshold spamScore } } } } `;function oe(){const{id:Ee}=(0,w.p4)(c.nA),[Te,W]=(0,s.useMemo)(()=>(0,b.aC)(b.tn.Last24Hours,15),[]),[J]=(0,s.useState)(()=>(0,Z.l9)()),[he]=(0,s.useState)(()=>(0,Z.vR)()),[Ae,je]=(0,s.useState)(""),[Ye,Fe]=(0,s.useState)(""),[ke,qe]=(0,s.useState)(""),[tn,Dn]=(0,s.useState)(""),cn=(0,L.c)(ke,1e3),[vn]=(0,s.useState)(C()()),Rn=(0,b.LN)([b.tn.Last30Minutes,b.tn.Last24Hours,b.tn.Last7Days]),[kn,Xe]=(0,s.useState)({relativeTimeRange:(0,b._e)(b.tn.Last24Hours),startDate:null,endDate:null}),un={datetime_geq:Te,datetime_leq:W};kn.relativeTimeRange?(un.datetime_geq=vn.clone().startOf("minute").subtract(kn.relativeTimeRange,"m").toISOString(),un.datetime_leq=vn.clone().startOf("minute").toISOString()):(un.datetime_geq=kn.startDate.toISOString(),un.datetimeEnd=kn.endDate.toISOString());const Wn=[];Ae&&Wn.push({status:Ae}),Ye&&(un.isNDR=1),cn&&Wn.push({OR:[{from_like:`%<${cn}%>`},{from_like:`${cn}%`,from_notlike:"%<%"}]}),tn&&Wn.push({OR:[{to_like:`%<${tn}%>`},{to:tn}]}),Wn.length>0&&(un.AND=Wn);const{data:Ln,loading:Jn}=(0,p.aM)(H,{variables:{zoneTag:Ee,filter:un},fetchPolicy:"cache-first"}),st=(0,s.useMemo)(()=>Ln===void 0&&!Jn,[Jn,Ln]),{logRows:_t,customAddresses:rt}=(0,s.useMemo)(()=>{const rn=Ln&&Ln.viewer.zones[0].emailRoutingAdaptive||[],Bn=new Set,Lt=rn.filter(yt=>{const Tt=Bn.has(yt.id);return Bn.add(yt.id),!Tt}),wt=rn.filter((yt,Tt,bt)=>bt.findIndex(Ot=>Ot.to===yt.to)===Tt).map(yt=>yt.to);return{logRows:Lt,customAddresses:wt}},[Jn,Ln]);return a().createElement(u.ZC,{pb:4},a().createElement(u.ZC,{display:"flex",columnGap:"1em",justifyContent:"space-between",alignItems:"center"},a().createElement(u.h4,{mt:3,mb:3},a().createElement(u.H3,null,a().createElement(I.cC,{id:"email.logs.card.title"}))),a().createElement(u.Dr,{maxWidth:"20em"},a().createElement(E.E,{now:vn,startDate:kn.startDate,endDate:kn.endDate,relativeTimeRange:kn.relativeTimeRange,relativeTimeRangeOptions:Rn,defaultRelativeTimeRange:(0,b._e)(b.tn.Last24Hours),onChange:Xe,maxTimeRange:7*24*60,maxPickableWindow:7*24*60}))),a().createElement(B.H,null,a().createElement(B.L,null,a().createElement(u.__,{marginBottom:0},a().createElement(u.P,{mb:1},a().createElement(I.cC,{id:"email.logs.table.columns.sender"})),a().createElement(X.o,{name:"sender-filter",value:ke,onChange:rn=>qe(rn.target.value),marginBottom:0}))),a().createElement(B.L,null,a().createElement(q.u,{label:(0,I.ZP)("email.logs.table.columns.custom_address"),value:tn,options:[{label:(0,I.ZP)("email.logs.filter.all_custom_addresses"),value:""},...rt.map(rn=>({label:rn,value:rn}))],onChange:({value:rn})=>Dn(rn)})),a().createElement(B.L,null,a().createElement(q.u,{label:(0,I.ZP)("email.logs.table.columns.result"),value:Ae,options:[{label:(0,I.ZP)("email.logs.filter.all_results"),value:""},...Object.entries(J).map(([rn,Bn])=>({label:Bn,value:rn}))],onChange:({value:rn})=>je(rn)})),a().createElement(B.L,null,a().createElement(q.u,{label:(0,I.ZP)("email.logs.table.columns.bounce"),value:Ye,options:[{label:(0,I.ZP)("email.logs.filter.all_results"),value:""},...Object.entries(he).map(([rn,Bn])=>({label:Bn,value:rn}))],onChange:({value:rn})=>Fe(rn)}))),a().createElement(O.V,null,a().createElement(V.ZP,{wrapperStyle:{borderBottom:"none"},data:Jn?[]:_t,pageSize:10,isLoading:Jn,hasError:st,autoResetExpanded:!0,autoResetPage:!0,isEmpty:!st&&_t&&_t.length===0,renderError:()=>a().createElement(r.xu,{p:3},a().createElement(I.cC,{id:"email.logs.table.api_outage"})),renderEmpty:()=>a().createElement(r.xu,{p:3},Jn?a().createElement(I.cC,{id:"email.logs.table.loading"}):a().createElement(I.cC,{id:"email.logs.table.empty"})),columns:[{accessor:"id",width:35,Header:a().createElement(I.cC,{id:"email.logs.table.columns.session_id"}),Cell:({cell:{value:rn}})=>a().createElement(V.G3,{wordBreak:"break-all"},rn||a().createElement(I.cC,{id:"email.logs.table.columns.session_id.unknown"}))},{accessor:"isNDR",width:25,Cell:({cell:{value:rn}})=>a().createElement(V.G3,{alignContent:"left"},rn==0?"":a().createElement(Y._,{hue:"blue"},a().createElement(I.cC,{id:"email.logs.table.columns.bounce.label.bounce"})))},{accessor:"from",Header:a().createElement(I.cC,{id:"email.logs.table.columns.sender"}),Cell:({cell:{value:rn}})=>a().createElement(V.G3,{title:rn,wordBreak:"break-all"},k.default.toUnicode((rn.match(/.*<(.+)>/)||[void 0,rn])[1]||"-"))},{accessor:"to",Header:a().createElement(I.cC,{id:"email.logs.table.columns.custom_address"}),Cell:({cell:{value:rn}})=>a().createElement(V.G3,{title:rn,wordBreak:"break-all"},k.default.toUnicode((rn.match(/.*<(.+)>/)||[void 0,rn])[1]||"-"))},{accessor:"datetime",width:30,Header:a().createElement(I.cC,{id:"email.logs.table.columns.received"}),Cell:({cell:{value:rn}})=>a().createElement(V.G3,{title:rn},C()(rn).fromNow())},{accessor:"status",width:30,Header:a().createElement(I.cC,{id:"email.logs.table.columns.result"}),Cell:({cell:{value:rn}})=>a().createElement(V.G3,{wordBreak:"break-all"},J[rn]||J.unknown)}],expandable:({row:{original:rn}})=>a().createElement(V.jT,null,a().createElement(r.xu,{display:"grid",gap:3,py:3,px:4,backgroundColor:"background",fontSize:2},a().createElement(r.xu,{display:"flex",flexWrap:"wrap",gap:"2em"},a().createElement(r.xu,null,a().createElement(u.cK,null,a().createElement(I.cC,{id:"email.logs.table.expand.action"})),a().createElement(te,{action:rn.action})),a().createElement(r.xu,null,a().createElement(u.cK,null,a().createElement(I.cC,{id:"email.logs.table.expand.message_id"})),a().createElement(u.ZC,null,rn.messageId))),a().createElement(r.xu,{display:"flex",gap:"2em",flexWrap:"wrap"},a().createElement(r.xu,null,a().createElement(u.cK,null,a().createElement(I.cC,{id:"email.logs.table.expand.spf"})),a().createElement(G,{status:rn.spf,errorInfo:{temperror:a().createElement(I.cC,{id:"email.logs.table.expand.spf.temperror"}),fail:a().createElement(I.cC,{id:"email.logs.table.expand.spf.fail"}),softfail:a().createElement(I.cC,{id:"email.logs.table.expand.spf.softfail"}),permerror:a().createElement(I.cC,{id:"email.logs.table.expand.spf.permerror"})}})),a().createElement(r.xu,null,a().createElement(u.cK,null,a().createElement(I.cC,{id:"email.logs.table.expand.dmarc"})),a().createElement(G,{status:rn.dmarc})),a().createElement(r.xu,null,a().createElement(u.cK,null,a().createElement(I.cC,{id:"email.logs.table.expand.dkim"})),a().createElement(G,{status:rn.dkim})),a().createElement(r.xu,null,a().createElement(u.cK,null,a().createElement(I.cC,{id:"email.logs.table.expand.arc"})),a().createElement(G,{status:rn.arc})),rn.spamThreshold>0&&a().createElement(r.xu,null,a().createElement(u.cK,null,a().createElement(I.cC,{id:"email.logs.table.expand.spam"})),a().createElement(ne,{isSpam:rn.isSpam,spamScore:rn.spamScore}))),rn.errorDetail&&a().createElement(r.xu,null,a().createElement(u.cK,null,a().createElement(I.cC,{id:"email.logs.table.expand.reject_reason"})),a().createElement(u.ZC,null,rn.errorDetail)),rn.isNDR>0&&rn.subject&&a().createElement(r.xu,null,a().createElement(u.cK,null,a().createElement(I.cC,{id:"email.logs.table.expand.bounce_message"})),a().createElement(u.ZC,null,rn.subject))))})))}const ce=(0,N.createStyledComponent)(()=>({}),K.u);function G({status:Ee,errorInfo:Te}){return Ee==="none"||Ee==="pass"||Ee==="neutral"?a().createElement(u.ZC,null,Ee):a().createElement(u.ZC,{display:"flex",alignItems:"center"},a().createElement(Y._,{hue:"red"},Ee),Te&&Te[Ee]&&a().createElement(u.Dr,{display:"inline-block",pl:"2px"},a().createElement(ce,{place:"top",message:Te[Ee],width:210},a().createElement(U.J,{type:"info-sign",color:"blue.4",label:"tooltip"}))))}function te({action:Ee}){return Ee==="unknown"||Ee==="forward"||Ee==="worker"||Ee==="drop"?a().createElement(u.ZC,null,a().createElement(I.cC,{id:`email.logs.table.expand.action.${Ee}`})):a().createElement(u.ZC,null,Ee)}function ne({isSpam:Ee,spamScore:Te}){return Ee!==0?a().createElement(u.ZC,{display:"flex",alignItems:"center"},a().createElement(ce,{message:a().createElement(I.cC,{id:"email.logs.table.expand.action.spam.note",values:{spamScore:Te}})},a().createElement(Y._,{hue:"orange"},a().createElement(I.cC,{id:"email.logs.table.expand.action.spam.not_safe"})))):a().createElement(u.ZC,{display:"flex",alignItems:"center"},a().createElement(Y._,{hue:"green"},a().createElement(I.cC,{id:"email.logs.table.expand.action.spam.safe"})))}var ee=n("../react/pages/email/components/DnsRecordsCard/DnsRecordsCard.tsx"),$=n("../react/pages/email/logic.ts"),ie=n("../react/pages/email/redux/selectors.ts"),le=n("../react/pages/email/api.ts"),re=n("../../../../node_modules/react-query/es/index.js");const me=(0,N.createStyledComponent)(()=>({gridTemplateColumns:"repeat(auto-fit, minmax(210px, 1fr));-ms-grid-columns:(minmax(210px, 1fr))[6]"}),i.xg);function de(){var Ee,Te;const[W,J]=(0,s.useState)(0),[he,Ae]=(0,s.useState)(0),{id:je,account:Ye}=(0,w.p4)(c.nA),Fe=(0,w.p4)(ie.k8),ke=["GetRules",{zoneId:je}],{isLoading:qe,data:tn}=(0,re.useQuery)(ke,()=>(0,le.up)(je,{page:1,perPage:5,filterMatcherType:"literal"}),{refetchOnWindowFocus:!0});(0,s.useEffect)(()=>{var kn;J((tn==null||(kn=tn.result_info)===null||kn===void 0?void 0:kn.total_count)||0)},[tn]);const Dn=["GetDestinationAddresses",{accountId:Ye.id}],{isLoading:cn,data:vn}=(0,re.useQuery)(Dn,()=>(0,le.tf)(Ye.id,{page:1,perPage:5}),{refetchOnWindowFocus:!0});(0,s.useEffect)(()=>{var kn;Ae((vn==null||(kn=vn.result_info)===null||kn===void 0?void 0:kn.total_count)||0)},[vn]);const Rn=Fe.routing.status===$.eU.Loading;return a().createElement(u.ZC,{pb:4},a().createElement(u.h4,{mt:3,mb:3},a().createElement(u.H3,null,a().createElement(I.cC,{id:"email.summary.card.title"}))),a().createElement(O.V,null,a().createElement(l.uO,null,a().createElement(l.aY,null,a().createElement(me,null,a().createElement(A,{title:a().createElement(I.cC,{id:"email.summary.card.custom_addresses"}),stat:(0,h.Z)(W),loading:qe}),a().createElement(A,{title:a().createElement(I.cC,{id:"email.summary.card.destination_addresses"}),stat:(0,h.Z)(he),loading:cn}),a().createElement(A,{title:a().createElement(u.ZC,{display:"flex",gap:1},a().createElement(u.ZC,null,"Domain")),stat:(0,h.Z)((((Ee=Fe.subdomains)===null||Ee===void 0?void 0:Ee.length)||0)+1),loading:Rn}),a().createElement(A,{title:a().createElement(I.cC,{id:"email.summary.card.status"}),stat:a().createElement(Le,{loading:Rn,synced:!Fe.routing.synced,enabled:Fe.routing.enabled}),loading:Rn}),a().createElement(A,{title:a().createElement(I.cC,{id:"email.summary.card.dns"}),stat:a().createElement(ee.gh,{loading:Rn,misconfigured:(Te=Fe.dns)===null||Te===void 0?void 0:Te.someServiceMisconfigured}),loading:Rn}))))))}function Le({loading:Ee,synced:Te,enabled:W}){const J=!Ee&&W?Te?"syncing":"enabled":"disabled";return a().createElement(a().Fragment,null,Ee?a().createElement(m.g,null):a().createElement(K.u,{place:"top",message:a().createElement(I.cC,{id:`email.summary.card.status.${J}.tooltip`}),display:"inline"},a().createElement(Y._,{hue:J==="syncing"?"orange":J==="enabled"?"green":"red"},a().createElement(I.cC,{id:`email.summary.card.status.${J}`}))))}const Oe=()=>a().createElement(a().Fragment,null,a().createElement(de,null),a().createElement(S,null),a().createElement(oe,null));var se=n("../../../../node_modules/@cloudflare/component-table/es/index.js");const ve=(0,N.createStyledComponent)(({theme:Ee})=>({mobile:{"& td":{display:"block",with:"100%",wordBreak:"break-word",whiteSpace:"normal"},"& > table > thead > tr > th":{display:"none"}},desktop:{"& td":{display:"table-cell",whiteSpace:"nowrap"},"& > table > thead > tr > th":{display:"table-cell"}},"& tr":{borderRight:"none !important",borderLeft:"none","& > td, th":{border:"none !important"}},"& > table > tbody > tr:last-child":{borderBottom:"none"}}),se.iA),ae=(0,N.createStyledComponent)(({theme:Ee})=>({mobile:{display:"block",fontWeight:Ee.weightSemiBold},desktop:{display:"none"}}),u.__),Ie=({actions:Ee=[],isCatchAll:Te=!1})=>{if(Ee)if(Ee.length===1){const W=Ee[0],J=W.value&&W.value.join(", ")||"";return W.type==="forward"?a().createElement(a().Fragment,null,a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.actions.forward_to_address"}),Te&&a().createElement(a().Fragment,null,":",a().createElement(u.Dr,{pl:1,fontWeight:600},J))):W.type==="worker"?a().createElement(a().Fragment,null,a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.actions.forward_to_worker"}),Te&&a().createElement(a().Fragment,null,":",a().createElement(u.Dr,{pl:1,fontWeight:600},J))):W.type==="drop"?a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.actions.drop"}):a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.actions.unknown_action"})}else return a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.actions.multiple_actions"});else return a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.actions.no_actions"})},Se=({actions:Ee=[]})=>{if(Ee){const Te=Ee[0];return a().createElement(u.Dr,null,Te.value?Te.value.join(", "):"")}else return a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.actions.no_actions"})},Re=({matchers:Ee=[],status:Te})=>{if(Ee)if(Ee.length===1){const W=Ee[0];return W.field==="to"?a().createElement(u.ZC,{display:"flex",gap:2,alignItems:"center"},a().createElement(u.Dr,{title:W.value},W.value),Te&&!Te.enabled&&a().createElement(K.u,{place:"top",message:a().createElement(u.Dr,null,a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.matchers.domain_misconfigured.tooltip"}))},a().createElement(U.J,{type:"exclamation-sign",label:"attention"}))):W.type==="all"?a().createElement(u.Dr,null,"Catch-All"):a().createElement(u.ZC,{wordBreak:"break-all"},W.field," ",W.value)}else return a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.matchers.multiple_matchers"});else return a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.matchers.no_matchers"})};var ye=n("../../../../node_modules/@cloudflare/component-toggle/es/index.js"),_e=n("../react/common/actions/modalActions.ts"),be=n("../../../../node_modules/lodash/cloneDeep.js"),ze=n.n(be),Ue=n("../node_modules/@cloudflare/component-button/es/index.js"),Ke=n("../../../../node_modules/@cloudflare/component-modal/es/index.js"),Ge=n("../react/pages/email/modals/common.ts");const en=({isOpen:Ee,closeModal:Te,onClose:W,onConfirm:J,rule:he,catchAll:Ae})=>{const[je,Ye]=(0,s.useState)(!1),Fe=(0,Ge.M)({onClose:W,closeModal:Te}),ke=(0,Ge.S)({onConfirm:J,closeModal:Te,setIsConfirming:Ye});return a().createElement(Ke.u_,{isOpen:Ee,onRequestClose:Fe},a().createElement(Ke.xB,null,a().createElement(u.H3,null,a().createElement(I.cC,{id:`email.forwarding_rules.disable_modal${Ae?".catch_all":""}.title`}),a().createElement(Ke.A3,{onClick:Fe}))),a().createElement(Ke.fe,null,a().createElement(u.P,{pb:3},a().createElement(I.cC,{id:`email.forwarding_rules.disable_modal${Ae?".catch_all":""}.description`}))),a().createElement(Ke.mz,null,a().createElement(Ke.nK,null,a().createElement(Ue.hE,{spaced:!0},a().createElement(Ue.zx,{onClick:Fe,type:"primary",inverted:!0},a().createElement(I.cC,{id:"common.cancel"})),a().createElement(Ue.zx,{type:"danger",onClick:ke,loading:je},a().createElement(I.cC,{id:`email.forwarding_rules.disable_modal${Ae?".catch_all":""}.confirm`}))))))};var nn=n("../react/pages/email/redux/actions.ts");const yn=({rule:Ee})=>{const Te=(0,w.UM)(),[W,J]=(0,s.useState)(!1),[he,Ae]=(0,s.useState)(!1),{id:je}=(0,w.p4)(c.nA),Ye=Ee.matchers.some(qe=>qe.type==="all");(0,s.useEffect)(()=>{Ae((Ee==null?void 0:Ee.enabled)||!1)},[Ee]);const Fe=async qe=>{if(!!Ee){J(!0);try{const tn=ze()(Ee);tn.enabled=qe,Ye?await Te((0,nn.xo)(je,tn)):await Te((0,nn.Bo)(je,tn))}finally{J(!1),Ae(qe)}}},ke=async qe=>{qe?await Fe(qe):Te((0,_e.openModal)(en,{rule:Ee,catchAll:Ye,onConfirm:async()=>await Fe(qe)}))};return a().createElement(u.Dr,{display:"flex",alignItems:"center",justifyContent:"flex-start",whiteSpace:"nowrap"},a().createElement(ye.Z,{value:he||!1,onChange:ke,disabled:W||!Ee}),a().createElement(u.Dr,{ml:2,fontSize:2},he?a().createElement(I.cC,{id:"email.forwarding_rules.rule_toggle.enabled"}):a().createElement(I.cC,{id:"email.forwarding_rules.rule_toggle.disabled"})))};var sn=n("../react/pages/email/components/PointerLink.tsx"),wn=n("../react/pages/email/components/EmptyStates.tsx"),gn=n("../react/pages/email/types.ts"),Qn=n("../react/pages/email/routes.ts"),ht=n("../react/utils/router.tsx");const ut=({rule:Ee,separator:Te,dstAddresses:W,dstWorkers:J,simpleView:he=!1})=>{const Ae=(0,ht.k6)(),{name:je,account:Ye}=(0,w.p4)(c.nA),[Fe,ke]=(0,s.useState)(!0),[qe,tn]=(0,s.useState)(gn.Pm.Loading),[Dn,cn]=(0,s.useState)(),[vn,Rn]=(0,s.useState)(),kn=Ee.matchers.some(Xe=>Xe.type==="all");return(0,s.useEffect)(()=>{if(W){const Xe={};for(const un of W)Xe[un.email]=un;cn(Xe)}else cn(void 0);if(J){const Xe={};for(const un of J)Xe[un.id]=un;Rn(Xe)}else Rn(void 0)},[W,J]),(0,s.useEffect)(()=>{if(!Ee){tn(gn.Pm.Loading);return}const Xe=Ee.actions&&Ee.actions.length===1&&["forward","worker","drop","all"].includes(Ee.actions[0].type)&&Ee.matchers&&Ee.matchers.length===1&&["literal"].includes(Ee.matchers[0].type)&&["to"].includes(Ee.matchers[0].field||"")||["all"].includes(Ee.matchers[0].type);if(ke(Xe),!Xe)tn(gn.Pm.Unknown);else if(Ee.actions[0].type==="drop")tn(gn.Pm.Verified);else if(Ee.actions[0].type==="worker"&&vn){if(vn&&Object.keys(vn).length>0){if(!J){tn(gn.Pm.Loading);return}const un=vn[Ee.actions[0].value[0]];tn(un?gn.Pm.Verified:gn.Pm.WorkerNotFound)}}else if(Ee.actions[0].type==="forward"&&Dn){if(!J){tn(gn.Pm.Loading);return}const un=Dn[Ee.actions[0].value[0]];tn(un?un.verified?gn.Pm.Verified:gn.Pm.Pending:gn.Pm.Missing)}},[Ee,Dn,vn]),a().createElement(a().Fragment,null,a().createElement(se.SC,{separator:Te},Fe?a().createElement(a().Fragment,null,a().createElement(se.pj,{textEllipsis:!0,pl:3},a().createElement(ae,null,a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.matchers"})),a().createElement(u.Dr,null,a().createElement(Re,{matchers:Ee.matchers,status:Ee.domain_status}))),!he&&a().createElement(a().Fragment,null,a().createElement(se.pj,{textEllipsis:!0},a().createElement(ae,null,a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.actions"})),a().createElement(u.Dr,{fontSize:2},a().createElement(Ie,{actions:Ee.actions}))),a().createElement(se.pj,{textEllipsis:!0},a().createElement(ae,null,a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.destinations"})),a().createElement(u.Dr,{fontSize:2},a().createElement(Se,{actions:Ee.actions})))),a().createElement(se.pj,null,qe===gn.Pm.Loading?a().createElement(wn.qM,{minHeight:"24px",m:"3px"}):qe===gn.Pm.Pending?a().createElement(a().Fragment,null,a().createElement(u.Dr,{display:"inline-block",verticalAlign:"middle",mr:2},a().createElement(K.u,{place:"top",message:a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.status.pending_confirmation.tooltip",values:{forwardingAddress:Ee.actions[0].value}})},a().createElement(Y._,{hue:"orange",fontSize:1},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.status.pending_confirmation"}))))):qe===gn.Pm.Missing?a().createElement(a().Fragment,null,a().createElement(ae,null,a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.status"})),a().createElement(Y._,{hue:"red",fontSize:1},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.status.not_found"}))):qe==gn.Pm.WorkerNotFound?a().createElement(a().Fragment,null,a().createElement(ae,null,a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.status"})),a().createElement(Y._,{hue:"red",fontSize:1},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.status.worker_not_found"}))):a().createElement(a().Fragment,null,a().createElement(ae,null,a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.status"})),a().createElement(yn,{rule:Ee}))),a().createElement(se.pj,{pr:3,align:"right",verticalAlign:"middle"},a().createElement(sn._,{noUnderline:!0,onClick:()=>{Ae.push(Qn._j.editRule.toUrl({accountId:Ye.id,zoneName:je,ruleId:kn?"catch_all":(Ee==null?void 0:Ee.tag)||""}))},fontSize:2},a().createElement(I.cC,{id:"common.edit"})))):a().createElement(se.pj,{colSpan:5},a().createElement(K.u,{place:"top",message:(0,I.ZP)("email.forwarding_rules.table.unsupported_rule.tooltip")},a().createElement(I.cC,{id:"email.forwarding_rules.table.unsupported_rule.text"}),a().createElement(U.J,{type:"info-sign",color:"blue.4",label:"tooltip"})))))},Ct=(0,N.createStyledComponent)(()=>{const Ee={overflow:"hidden",textOverflow:"ellipsis",":first-child":{paddingLeft:"32px"}};return{"& td":Ee,"& th":Ee}},se.SC),It=(0,N.createStyledComponent)(()=>({"& div:nth-child(2)":{display:"inline",verticalAlign:"text-top",marginRight:"3px"}}),u.Dr);var Dt=n("webpack/sharing/consume/default/react-redux/react-redux");const xt=({rules:Ee=[],workers:Te,simpleView:W=!1})=>{const[J,he]=(0,s.useState)(),{account:Ae}=(0,Dt.useSelector)(c.nA),je=Ee.filter(ke=>ke.actions&&ke.actions.length>0&&ke.actions[0].type==="forward"&&ke.actions[0].value&&ke.actions[0].value.length>0&&ke.actions[0].value[0]!==void 0).map(ke=>{var qe,tn;return(ke==null||(qe=ke.actions[0])===null||qe===void 0||(tn=qe.value)===null||tn===void 0?void 0:tn[0])||""}),Ye=["GetDestinationAddresses",{accountId:Ae.id,emails:String(je)}],{data:Fe}=(0,re.useQuery)(Ye,()=>(0,le.tf)(Ae.id,{page:1,perPage:50,emails:[...new Set(je)]}));return(0,s.useEffect)(()=>{Fe&&(Fe==null?void 0:Fe.addresses)&&(Fe==null?void 0:Fe.addresses.length)>0&&he(Fe.addresses)},[Fe]),a().createElement(se.RM,null,Ee.map((ke,qe)=>a().createElement(ut,{key:ke.tag,rule:ke,dstAddresses:J,dstWorkers:Te,separator:qe!==Ee.length-1,simpleView:W})))};var At=n("../react/pages/zoneless-workers/utils/useServices.ts");function ct(){const{account:Ee,id:Te}=(0,w.p4)(c.nA),[W,J]=(0,s.useState)(),{services:he}=(0,At.wb)(Ee.id),Ae=["GetCatchAllRule",{zoneId:Te}],{isLoading:je,error:Ye,data:Fe}=(0,re.useQuery)(Ae,()=>(0,le.ZF)(Te),{refetchOnWindowFocus:!0});return(0,s.useEffect)(()=>{Fe&&(Fe==null?void 0:Fe.catchAll)&&J([Fe.catchAll])},[Fe]),a().createElement(u.ZC,{pb:3},a().createElement(u.h4,{mt:3,mb:3},a().createElement(u.H3,null,a().createElement(I.cC,{id:"email.catch_all.card.title"})),a().createElement(u.P,null,a().createElement(I.cC,{id:"email.catch_all.card.description"}))),a().createElement(O.V,null,a().createElement(ve,{fixedLayout:!0,bordered:!1,loading:je,errored:Ye!==null,empty:W===void 0,noItemsNode:a().createElement(u.ZC,{py:2,px:4},a().createElement(I.cC,{id:"email.destination_addresses.table.empty"})),mb:"2px"}," ",a().createElement(se.ss,null,a().createElement(se.SC,null,a().createElement(se.pj,{width:Z.FR[0]},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.matchers"})),a().createElement(se.pj,{width:Z.FR[1]},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.actions"})),a().createElement(se.pj,{width:Z.FR[2]},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.destinations"})),a().createElement(se.pj,{width:Z.FR[3]},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.status"})),a().createElement(se.pj,{width:Z.FR[4]}))),a().createElement(xt,{rules:W,workers:he}))))}var Et=n("../../../../node_modules/@cloudflare/component-pagination/es/index.js");const gt=({rules:Ee=[],workers:Te,loading:W=!1,errored:J=!1,simpleView:he=!1})=>a().createElement(ve,{loading:W,errored:J,empty:Ee.length===0,noItemsNode:a().createElement(u.ZC,{py:2,px:4},a().createElement(I.cC,{id:"email.forwarding_rules.table.empty"})),mb:"2px"},a().createElement(se.ss,null,a().createElement(se.SC,null,a().createElement(se.pj,{width:he?"100%":Z.FR[0]},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.matchers"})),!he&&a().createElement(a().Fragment,null,a().createElement(se.pj,{width:Z.FR[1]},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.actions"})),a().createElement(se.pj,{width:Z.FR[2]},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.destinations"}))),a().createElement(se.pj,{width:Z.FR[3]},a().createElement(I.cC,{id:"email.forwarding_rules.table.columns.status"})),a().createElement(se.pj,{width:Z.FR[4]}))),a().createElement(xt,{rules:Ee,workers:Te,simpleView:he}));function Zn(){return Zn=Object.assign?Object.assign.bind():function(Ee){for(var Te=1;Te(0,le.up)(qe,{page:vn,perPage:15,search:ke,filterActionType:Ye,filterMatcherType:"literal",filterDomain:Ae}),{refetchOnWindowFocus:!0});(0,s.useEffect)(()=>{Wn&&(Wn==null?void 0:Wn.rules)&&W(Wn.rules)},[Wn]);const Ln=(0,Et.aV)(Wn==null?void 0:Wn.result_info),Jn=(0,w.p4)(ie.k8),st=[{label:"All domains",value:""},{label:tn,value:tn}],[_t,rt]=(0,s.useState)(st);return(0,s.useEffect)(()=>{Jn&&Jn.routing.status===$.eU.Loading||Jn.subdomains===void 0||rt([...st,...Jn.subdomains.map(rn=>{var Bn,Lt;return{label:((Bn=rn.zone)===null||Bn===void 0?void 0:Bn.name)||"",value:((Lt=rn.zone)===null||Lt===void 0?void 0:Lt.name)||""}})])},[Jn]),(0,s.useEffect)(()=>{if(!Te||!Jn)return;let rn=new Map;Jn&&Jn.zone&&Jn.zone.name&&Jn.zone.name!=""&&Jn.routing&&rn.set(Jn.zone.name,{status:Jn.routing.status,enabled:Jn.routing.enabled||!1});for(const Bn of Jn.subdomains||[])Bn&&Bn.zone&&Bn.zone.name&&Bn.zone.name!=""&&Bn.routing&&rn.set(Bn.zone.name,{status:Bn.routing.status,enabled:Bn.routing.enabled||!1});Te.forEach(Bn=>{if(Bn.matchers&&Bn.matchers.length===1&&["literal"].includes(Bn.matchers[0].type)&&["to"].includes(Bn.matchers[0].field||"")&&Bn.matchers[0].value){const Lt=Bn.matchers[0].value.substring(Bn.matchers[0].value.lastIndexOf("@")+1);Bn.domain_status=rn.get(Lt)}})},[Te,Jn]),a().createElement(u.ZC,{pb:3},a().createElement(u.h4,{mt:3,mb:3},a().createElement(u.H3,null,a().createElement(I.cC,{id:"email.forwarding_rules.card.title"})),a().createElement(u.P,null,a().createElement(I.cC,{id:"email.forwarding_rules.card.description"}))),a().createElement(u.ZC,{display:"flex",justifyContent:"space-between",alignItems:"flex-end"},a().createElement(u.ZC,{display:"flex",gap:3,width:"100%",pr:3},a().createElement(B.L,null,a().createElement(u.__,{marginBottom:0},a().createElement(u.P,{mb:1},"Search"),a().createElement(X.o,{name:"search",value:J,onChange:rn=>{he(rn.target.value)},marginBottom:0}))),a().createElement(B.L,null,a().createElement(q.u,{label:"Domain",value:Ae,options:_t,onChange:({value:rn})=>je(rn)})),a().createElement(B.L,null,a().createElement(q.u,{label:"Action",value:Ye,options:[{label:"All actions",value:""},{label:(0,I.ZP)("email.common.action.forward"),value:"FORWARD"},{label:(0,I.ZP)("email.common.action.worker"),value:"WORKER"},{label:(0,I.ZP)("email.common.action.drop"),value:"DROP"}],onChange:({value:rn})=>Fe(rn)}))),a().createElement(u.ZC,{width:"20%",display:"flex",justifyContent:"flex-end"},a().createElement(Ue.zx,{type:"primary",onClick:()=>{Ee.push(Qn._j.newRule.toUrl({accountId:Dn.id,zoneName:tn}))}},a().createElement(I.cC,{id:"email.forwarding_rules.card.add_rule"})))),a().createElement(O.V,null,a().createElement(gt,{rules:Te||[],workers:cn,loading:Xe,errored:un!==null})),Ln.isPaginated&&a().createElement(Et.tl,Zn({},Ln,{onPrevClick:Rn.onPrevClick,onNextClick:Rn.onNextClick,items:Te&&Te.length===1?(0,I.ZP)("email.forwarding_rules.table.pagination.rule"):(0,I.ZP)("email.forwarding_rules.table.pagination.rules")})))}const ue=()=>a().createElement(a().Fragment,null,a().createElement(ct,null),a().createElement(we,null));var fe=n("../react/common/selectors/accountSelectors.ts"),ge=n("../../../../node_modules/@cloudflare/util-formatters/es/index.js"),Me=n("../react/common/components/MoreOptionsMenu/index.tsx"),Pe=n("../react/common/actions/notificationsActions.ts"),He=n("../react/pages/dns/dns-records/actions.ts"),mn=n("../react/pages/email/components/UnderlinedLink.tsx"),dn=n("../react/pages/email/modals/DeleteConflictingModal.tsx");function xe({parentUrl:Ee,router:Te,accountId:W,separator:J=!1,isSubdomain:he=!1}){var Ae;const[je,Ye]=(0,s.useState)(!1);return a().createElement(a().Fragment,null,a().createElement(se.SC,{separator:J&&!je},a().createElement(se.pj,null,a().createElement(u.ZC,{display:"flex",alignItems:"center",gap:2,onClick:()=>{Ye(!je)},cursor:"pointer"},a().createElement(u.Dr,{transform:je?"rotate(90deg)":"rotate(0deg)",transition:"transform 120ms ease-out",display:"inline-flex",alignItems:"center",justifyContent:"center"},a().createElement(U.J,{type:"right",label:!1,size:16})),a().createElement(u.Dr,null,Te.zone.name))),a().createElement(se.pj,null,Te.routing.enabled?a().createElement(Y._,{hue:"green"},a().createElement(I.cC,{id:"email.settings.table.label.enabled"})):a().createElement(Y._,{hue:"red"},a().createElement(I.cC,{id:"email.settings.table.label.disabled"}))),a().createElement(se.pj,null,((Ae=Te.dns)===null||Ae===void 0?void 0:Ae.misconfigured)?a().createElement(Y._,{hue:"red"},a().createElement(I.cC,{id:"email.settings.table.label.misconfigured"})):a().createElement(Y._,{hue:"green"},a().createElement(I.cC,{id:"email.settings.table.label.configured"}))),a().createElement(se.pj,{align:"left"},Te.routing.status===$.eU.Locked||Te.routing.status===$.eU.MisconfiguredLocked?a().createElement(a().Fragment,null,a().createElement(u.Dr,{display:"flex",alignItems:"center",gap:2},a().createElement(U.J,{type:"lock",label:"tooltip"}),a().createElement(u.Dr,{fontSize:2},a().createElement(I.cC,{id:"email.settings.table.label.locked"})))):a().createElement(a().Fragment,null,a().createElement(u.Dr,{display:"flex",alignItems:"center",gap:2},a().createElement(U.J,{type:"unlock-outline"}),a().createElement(u.Dr,{fontSize:2},a().createElement(I.cC,{id:"email.settings.table.label.unlocked"}))))),a().createElement(se.pj,null,(0,ge.p6)(Te.zone.modified,ge.pN.LongDate)),a().createElement(se.pj,{align:"right",pr:4},a().createElement(Ne,{state:Te.routing.status,router:Te,accountId:W,parentUrl:Ee,isSubdomain:he}))),!!(Te.records&&je)&&a().createElement(se.SC,{separator:J},a().createElement(se.pj,{colSpan:5},a().createElement(Ce,{id:"email-dns-records-drawer",status:Te.routing.status,expectedRecords:Te.records.expected,conflictingRecords:Te.records.conflicting,multipleRecords:Te.records.multiple,accountId:W,zoneName:Te.zone.name||"",parentUrl:Ee,showActions:!0}))))}function Ne({parentUrl:Ee,accountId:Te,router:W,state:J,isSubdomain:he=!1}){const[Ae,je]=(0,s.useState)(!1),Ye=(0,w.UM)(),Fe=(0,ht.k6)(),ke=(0,w.p4)(c.nA),qe=(0,w.p4)(ie.nS),tn=async()=>{try{he?await(0,le.p2)(ke==null?void 0:ke.id,W.zone.name||""):await(0,le.BH)(ke==null?void 0:ke.id),await Ye((0,nn.ty)(ke==null?void 0:ke.id)),await Ye((0,nn.fz)(gn.UZ.SETTINGS_PAGE,"success","email.root.toasts.dns_locked"))}finally{je(!1)}},Dn=async()=>{await Ye((0,nn.jn)()),he?Fe.push(Qn._j.disableSubdomain.toUrl({accountId:Te,zoneName:ke.name,subdomain:W.zone.name||""})):Fe.push(Qn._j.disableZone.toUrl({accountId:Te,zoneName:ke.name}))},cn=async()=>{await Ye((0,nn.jn)()),he?Fe.push(Qn._j.enableSubdomain.toUrl({accountId:Te,zoneName:ke.name,subdomain:W.zone.name||""})):Fe.push(Qn._j.enableZone.toUrl({accountId:Te,zoneName:ke.name}))},vn=async()=>{je(!0);const Rn=await Ye((0,nn.ty)(ke==null?void 0:ke.id));if((qe==null?void 0:qe.status)!==(Rn==null?void 0:Rn.status)){Ye(Pe.info((0,I.ZP)("email.dns_records.notification.data_changed")));return}switch(J){case $.eU.Locked:case $.eU.MisconfiguredLocked:await Dn();break;case $.eU.Unlocked:await tn();break;case $.eU.Disabled:case $.eU.Misconfigured:await cn();break}};return a().createElement(a().Fragment,null,Ae?a().createElement(m.g,null):a().createElement(Me.xe,{menu:a().createElement(Me.v2,null,J===$.eU.Locked||J===$.eU.MisconfiguredLocked?a().createElement(Me.sN,{onClick:vn},a().createElement(I.cC,{id:he?"email.dns_records.action_menu.disable_and_delete":"email.dns_records.action_menu.disable"})):J===$.eU.Unlocked?a().createElement(Me.sN,{onClick:vn,disabled:qe==null?void 0:qe.is_idn},a().createElement(I.cC,{id:"email.dns_records.action_menu.lock"})):J===$.eU.Disabled||J===$.eU.Misconfigured?a().createElement(Me.sN,{onClick:vn,disabled:qe==null?void 0:qe.is_idn},a().createElement(I.cC,{id:"email.dns_records.action_menu.enable"})):a().createElement(m.g,null),J===$.eU.MisconfiguredLocked&&a().createElement(Me.sN,{onClick:cn},a().createElement(I.cC,{id:"email.dns_records.action_menu.fix_records"})))}))}function Ze({loading:Ee,misconfigured:Te}){return Ee?null:Te?React.createElement(Label,{hue:"red"},React.createElement(Trans,{id:"email.dns_records.card.label.misconfigured"})):React.createElement(Label,{hue:"green"},React.createElement(Trans,{id:"email.dns_records.card.label.enabled"}))}function Ce({id:Ee,status:Te,expectedRecords:W,conflictingRecords:J,multipleRecords:he,accountId:Ae,zoneName:je,parentUrl:Ye,showActions:Fe}){return a().createElement(l.uO,null,a().createElement(l.aY,{p:16},a().createElement(u.ZC,{id:Ee,overflow:"auto"},Te!==$.eU.Loading?a().createElement(a().Fragment,null,!!he.length&&a().createElement(a().Fragment,null,a().createElement(u.P,{fontSize:4},a().createElement(I.cC,{id:"email.dns_records.card.conflicting_multi_spf_records"})),a().createElement(I.cC,{id:"email.dns_records.card.conflicting_multi_spf_records.description",values:{zone:je}}),a().createElement($e,{records:he,showActions:Fe})),!!J.length&&a().createElement(a().Fragment,null,a().createElement(u.P,{fontSize:4},a().createElement(I.cC,{id:"email.dns_records.card.conflicting_records"})),a().createElement(I.cC,{id:"email.dns_records.card.conflicting_records.description",values:{zone:je}}),a().createElement(an,{records:J,showActions:Fe})),!!W.length&&a().createElement(a().Fragment,null,!!J.length&&a().createElement("br",null),a().createElement(u.P,{fontSize:4},a().createElement(I.cC,{id:"email.dns_records.card.expected_records"})),a().createElement(I.cC,{id:"email.dns_records.card.expected_records.description",values:{zone:je}}),a().createElement(xn,{records:W})),!!J.length&&a().createElement(u.P,null,a().createElement(I.cC,{id:"email.dns_records.card.how_add"}))):a().createElement(u.P,null,a().createElement(I.cC,{id:"email.dns_records.table.loading"})))))}function $e({records:Ee,showActions:Te}){const W=(0,w.UM)(),J=(0,w.p4)(c.nA),he=async Ae=>{W((0,_e.openModal)(dn.h,{onConfirm:async()=>{await W((0,He.Gp)(J.id,{id:Ae})),await W((0,nn.ty)(J.id)),await W((0,nn.fz)(gn.UZ.SETTINGS_PAGE,"success","email.root.toasts.fix_multi_spf_records"))}}))};return a().createElement(se.iA,{bordered:!1,fixedLayout:!1,my:2},a().createElement(Sn,null,a().createElement(at,null,a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.type"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.name"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.priority"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.content"})),Te&&a().createElement(se.pj,null))),a().createElement(se.RM,null,Ee&&Ee.map(Ae=>a().createElement(at,{key:Ae.id},a().createElement(Kn,{record:Ae}),Te&&a().createElement(se.pj,null,a().createElement(mn.G,{to:"#",color:"red.4",onClick:()=>he(Ae.id)},a().createElement(I.cC,{id:"email.dns_records.table.columns.action.delete"})))))))}function an({records:Ee,showActions:Te}){const W=(0,w.UM)(),J=(0,w.p4)(c.nA),he=async Ae=>{W((0,_e.openModal)(dn.h,{onConfirm:async()=>{await W((0,nn.jn)()),await W((0,He.Gp)(J.id,{id:Ae})),await W((0,nn.ty)(J.id))}}))};return a().createElement(se.iA,{bordered:!1,fixedLayout:!1,my:2},a().createElement(Sn,null,a().createElement(at,null,a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.type"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.name"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.priority"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.content"})),Te&&a().createElement(se.pj,null))),a().createElement(se.RM,null,Ee&&Ee.map(Ae=>a().createElement(at,{key:Ae.id},a().createElement(Kn,{record:Ae}),Te&&a().createElement(se.pj,null,a().createElement(mn.G,{to:"#",color:"red.4",onClick:()=>he(Ae.id)},a().createElement(I.cC,{id:"email.dns_records.table.columns.action.delete"})))))))}function xn({records:Ee,withStatus:Te=!0}){return a().createElement(se.iA,{bordered:!1,fixedLayout:!1,my:2},a().createElement(Sn,null,a().createElement(at,null,a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.type"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.name"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.priority"})),a().createElement(se.pj,{maxWidth:"200px"},a().createElement(I.cC,{id:"email.dns_records.table.columns.content"})),Te&&a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.dns_records.table.columns.status"})))),a().createElement(se.RM,null,Ee&&Ee.map((W,J)=>a().createElement(at,{key:J},a().createElement(Kn,{record:W}),Te&&a().createElement(se.pj,null,W.added?a().createElement(I.cC,{id:"email.dns_records.table.columns.status.added"}):a().createElement(Y._,{hue:"red"},a().createElement(I.cC,{id:"email.dns_records.table.columns.status.missing"})))))))}const Kn=({record:Ee})=>a().createElement(a().Fragment,null,a().createElement(se.pj,null,Ee.type),a().createElement(se.pj,null,a().createElement(u.Dr,{style:{display:"inline-block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:"100%"},title:Ee.name},Ee.name)),a().createElement(se.pj,null,Ee.priority),a().createElement(se.pj,{maxWidth:"200px"},a().createElement(u.Dr,{style:{display:"inline-block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:"100%"},title:Ee.content},Ee.content))),Sn=(0,N.createStyledComponent)(()=>({backgroundColor:"unset","& th":{backgroundColor:"unset"}}),se.ss),at=(0,N.createStyledComponent)(()=>{const Ee={paddingLeft:0,paddingRight:"32px"};return{"& td":Ee,"& th":Ee}},se.SC);function jn({parentUrl:Ee,routers:Te,accountId:W,isSubdomain:J=!1,isLoading:he=!1}){return a().createElement(O.V,null,a().createElement(se.iA,{mb:"2px",bordered:!1,empty:he||Te.length===0,loading:he},a().createElement(se.ss,null,a().createElement(se.SC,null,a().createElement(se.pj,null,a().createElement(I.cC,{id:J?"email.settings.table.columns.subdomain":"email.settings.table.columns.domain"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.settings.table.columns.routing_status"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.settings.table.columns.dns_records"})),a().createElement(se.pj,{align:"left"},a().createElement(I.cC,{id:"email.settings.table.columns.mx_records"})),a().createElement(se.pj,null,a().createElement(I.cC,{id:"email.settings.table.columns.last_update"})),a().createElement(se.pj,{width:"4em",pr:4}))),a().createElement(se.RM,null,Te&&Te.map((Ae,je)=>a().createElement(xe,{parentUrl:Ee,router:Ae,accountId:W,separator:je!==Te.length-1,isSubdomain:J})))))}function zn({parentUrl:Ee}){const Te=(0,ht.k6)(),W=(0,w.UM)(),{id:J}=(0,w.p4)(fe.D0),[he,Ae]=(0,s.useState)([]),je=(0,w.p4)(ie.k8),Ye=async()=>{await W((0,nn.jn)()),Te.push(`${Ee}/subdomain`)};return(0,s.useEffect)(()=>{je&&je.routing.status===$.eU.Loading||je.subdomains===void 0||Ae(je.subdomains)},[je]),a().createElement(u.ZC,{display:"inline-flex",flexDirection:"column",alignItems:"column",gap:4},a().createElement(u.ZC,null,a().createElement(u.h4,{mt:3,mb:3},a().createElement(u.H3,null,a().createElement(I.cC,{id:"email.settings.header.domain.title"})),a().createElement(u.P,null,a().createElement(I.cC,{id:"email.settings.header.domain.description"}))),a().createElement(jn,{parentUrl:Ee,routers:[je],accountId:J,isLoading:je.routing.status===$.eU.Loading})),a().createElement(u.ZC,null,a().createElement(u.h4,{mt:3,mb:3},a().createElement(u.H3,null,a().createElement(I.cC,{id:"email.settings.header.subdomain.title"})),a().createElement(u.P,null,a().createElement(I.cC,{id:"email.settings.header.subdomain.description"}))),a().createElement(Ue.zx,{onClick:Ye,type:"primary"},a().createElement(I.cC,{id:"email.settings.header.button.add_subdomain"})),a().createElement(jn,{parentUrl:Ee,routers:he,accountId:J,isSubdomain:!0,isLoading:je.routing.status===$.eU.Loading})))}var nt=n("../react/pages/email/components/ReduxToast.tsx");const lt=({parentUrl:Ee})=>a().createElement(a().Fragment,null,a().createElement(nt.Tx,{slot:gn.UZ.SETTINGS_PAGE}),a().createElement(zn,{parentUrl:Ee}));var Gn=n("webpack/sharing/consume/default/react-router-dom/react-router-dom"),Pn=n("../../../../node_modules/@cloudflare/component-page/es/index.js"),ln=n("../react/pages/email/components/ExternalLink.tsx");const Je=Ee=>[{href:Z.L7.documentation.workers.root,text:a().createElement(I.cC,{id:"email.workers.sidepanel.links.documentation"})},{href:Qn._j.workers.toUrl({accountId:Ee}),text:a().createElement(I.cC,{id:"email.workers.sidepanel.links.workersAccount"})}],ot=()=>{const{account:Ee}=(0,w.p4)(c.nA);return a().createElement(u.$0,{mt:0},a().createElement(u.$0,{mt:0},a().createElement(Pn.X6,{fontSize:2},a().createElement(I.cC,{id:"email.workers.sidepanel.links.title.explore_resourses"})),a().createElement(dt,{links:Je(Ee.id)})))},dt=({links:Ee})=>a().createElement(a().Fragment,null,Ee.map(Te=>a().createElement(u.ZC,{key:Te.href,fontSize:2,py:1},Te.external===!1?a().createElement(Gn.Link,{to:Te.href},Te.text):a().createElement(ln.d,{to:Te.href,icon:!1},Te.text))));var De=n("../react/pages/zoneless-workers/components/_ui/DocsLink.tsx");const Be=({parentUrl:Ee})=>{const Te=(0,ht.k6)(),W=async()=>{Te.push(`${Ee}/workers/new`)};return a().createElement(Ue.zx,{onClick:W,type:"primary"},a().createElement(I.cC,{id:"email.workers.header.button.create"}))},Qe=({parentUrl:Ee})=>a().createElement(a().Fragment,null,a().createElement(u.$0,{mt:0},a().createElement(u.ZC,{display:"flex"},a().createElement(u.ZC,null,a().createElement(u.h4,{mb:3},a().createElement(Pn.X6,null,a().createElement(I.cC,{id:"email.workers.header.title"}),a().createElement(u.Dr,{fontWeight:1,ml:2},a().createElement(De.c,{href:Z.L7.documentation.workers.whatsNewInWorkers},a().createElement(I.cC,{id:"email.workers.intro.card.label"}))))),a().createElement(u.P,null,a().createElement(I.cC,{id:"email.workers.header.description"})),a().createElement(u.ZC,{mt:2,fontSize:2,display:"flex",alignItems:"center"},a().createElement(U.J,{type:"info-sign",color:"blue.4",mr:1}),a().createElement(I.cC,{id:"email.workers.header.info"}))),a().createElement(u.ZC,{ml:3},a().createElement(Be,{parentUrl:Ee})))),a().createElement(nt.u9,{slot:gn.UZ.WORKERS_PAGE,fullWith:!0}));var We=n("../react/pages/zoneless-workers/utils/metrics/utils.ts"),Ve=n("../react/pages/zoneless-workers/utils/metrics/queries.ts"),hn=n("../react/pages/zoneless-workers/components/WorkersOverview/ServicesList/SortDropdown.tsx"),pn=n("../../../../node_modules/@cloudflare/component-arrow-swivel/es/index.js"),En=n("../node_modules/@cloudflare/component-link/es/index.js"),Cn=n("../react/pages/zoneless-workers/components/_ui/DateTime.tsx"),pt=n("../react/pages/zoneless-workers/components/WorkersOverview/ServiceCard/ServiceCardMetrics/ServiceCardMetrics.tsx");const tt=({service:Ee,metricsData:Te,loadingMetrics:W,workers:J})=>{const he=(0,ht.k6)(),[Ae,je]=(0,s.useState)(),[Ye,Fe]=(0,s.useState)(!1),{id:ke,name:qe,account:tn}=(0,w.p4)(c.nA),Dn=["GetRules",{zoneId:ke,page:1,filterActionType:"worker",filterActionValue:Ee.id}],{isLoading:cn,data:vn}=(0,re.useQuery)(Dn,()=>(0,le.up)(ke,{page:1,perPage:50,filterActionType:"worker",filterActionValue:Ee.id}),{refetchOnWindowFocus:!0});(0,s.useEffect)(()=>{vn&&(vn==null?void 0:vn.rules)&&je(vn.rules)},[vn]);const Rn=async Xe=>{window.open(`/${tn.id}/workers/services/view/${Xe.id}/${Xe.default_environment.environment}`,"_blank")},kn=async Xe=>{he.push(`/${tn.id}/${qe}/email/routing/workers/edit/${Xe.id}/${Xe.default_environment.environment}`)};return a().createElement(l.Zb,null,a().createElement(u.ZC,{px:4,py:4},a().createElement(u.ZC,{display:"flex",justifyContent:"space-between"},a().createElement(u.ZC,{display:"flex",flexDirection:"column",overflow:"hidden"},a().createElement(Pn.X6,{mb:2,fontSize:3},Ee.id),a().createElement(u.ZC,null,a().createElement(u.ZC,{display:"flex",flexDirection:"column"},a().createElement(u.P,{color:"gray.3",fontSize:1,fontWeight:500,mb:0},Ee.default_environment.environment)))),a().createElement(u.ZC,{display:"flex",columnGap:"1em"},a().createElement(pt.Z,{data:Te,loading:W}),a().createElement(u.ZC,{display:"flex",alignItems:"center"},a().createElement(Ue.zx,{type:"primary",inverted:!0,onClick:()=>{he.push(Qn._j.newWorkerRule.toUrl({accountId:tn.id,zoneName:qe,workerId:Ee.id}))}},a().createElement(I.cC,{id:"email.worker.card.action.createRoute"})),a().createElement(Me.xe,{menu:a().createElement(Me.v2,null,a().createElement(Me.sN,{onClick:()=>kn(Ee)},a().createElement(I.cC,{id:"email.worker.card.action.codeEditor"})),a().createElement(Me.sN,{onClick:()=>Rn(Ee)},a().createElement(I.cC,{id:"email.worker.card.action.manageWorker"})))}))))),a().createElement(u.Hr,{my:0,borderColor:"gray.7"}),a().createElement(u.ZC,{px:4,py:2},a().createElement(u.ZC,{display:"flex",justifyContent:"space-between",color:"gray.4",fontSize:1},a().createElement(u.ZC,{display:"flex",gap:3},cn&&a().createElement(m.g,null),!cn&&Ae&&Ae.length>0&&a().createElement(u.ZC,{display:"flex",alignItems:"center"},a().createElement($n,{onClick:()=>Fe(Xe=>!Xe),cursor:"pointer",noUnderline:!0},a().createElement(u.Dr,{pr:1},Ae&&Ae.length),a().createElement(u.Dr,null,Ae.length===1?a().createElement(I.cC,{id:"email.workers.card.route.label"}):a().createElement(I.cC,{id:"email.workers.card.routes.label"}))),a().createElement(u.Dr,{pl:1},a().createElement(pn.OE,{color:"currentColor",size:12,isActive:Ye,onClick:()=>Fe(Xe=>!Xe)})))),a().createElement(u.ZC,null,a().createElement(I.cC,{id:"email.workers.card.last_modified.label"}),Ee.modified_on&&a().createElement(u.Dr,{pl:1},a().createElement(Cn.Z,{value:Ee.modified_on,fromNow:!0}))))),Ye&&a().createElement(a().Fragment,null,a().createElement(gt,{rules:Ae,workers:J,simpleView:!0})))},$n=(0,N.createStyledComponent)(({theme:Ee})=>({color:Ee.colors.gray[4],":hover":{color:Ee.colors.gray[4],textDecoration:"none"},":active":{color:Ee.colors.gray[4]},":focus":{color:Ee.colors.gray[4]}}),En.rU);var Nn=n("../react/pages/zoneless-workers/utils/useMetrics.ts");function Yn(){return Yn=Object.assign?Object.assign.bind():function(Ee){for(var Te=1;Te{var Ee;const{t:Te}=(0,I.QT)(),[W,J]=(0,We.T3)(24),[he,Ae]=(0,s.useState)([]),[je,Ye]=(0,s.useState)(!0),{account:Fe}=(0,w.p4)(c.nA),[ke,qe]=(0,Et.fH)((Ee=he)!==null&&Ee!==void 0?Ee:[],Xn),{data:tn,loading:Dn}=(0,Nn.B)(J,W,{queryFn:Ve.vV,queryFilterFn:Ve.ri,queryDateAccessor:We.A3,dateDimensionAccessor:We.uc},Fe.id),cn=(0,s.useMemo)(()=>(0,We.p)(tn),[tn]),vn=({servicesList:un,sortVal:Wn})=>{Ae([...un||he||[]].filter(Ln=>{var Jn,st;return Ln&&Ln.default_environment&&((Jn=Ln.default_environment.script)===null||Jn===void 0||(st=Jn.handlers)===null||st===void 0?void 0:st.includes("email"))}).sort((0,hn.bZ)(Wn||hn._Y,cn)))},{data:Rn,error:kn}=(0,At.Su)(Fe.id,{expand:["routes"]},void 0,void 0,{onSuccess:un=>{Ye(!1),vn({servicesList:un})}}),Xe=!Rn&&!kn||je;return a().createElement(a().Fragment,null,Xe?a().createElement(wn.a9,null):a().createElement(a().Fragment,null,ke.length!==0?a().createElement(u.Ul,{listStyleType:"none",ml:0},ke.map(un=>a().createElement(u.Li,{key:un.id,pb:1,mb:2},a().createElement(tt,{service:un,loadingMetrics:Dn,metricsData:cn==null?void 0:cn[un.id],workers:he})))):a().createElement(wn.Kz,null),qe.isPaginated&&a().createElement(Et.tl,Yn({},qe,{items:Te("email.workers.paginations.description")}))))};function Un({parentUrl:Ee}){return a().createElement(u.or,{display:"flex",py:1,mb:4},a().createElement(u.ZC,{ml:"auto",mr:"auto",display:["block","block","flex"],width:"100%",maxWidth:"100%"},a().createElement(u.ZC,{width:[1,1,4/5],pr:[0,0,3],mt:0},a().createElement(Qe,{parentUrl:Ee}),a().createElement(Mn,null)),a().createElement(u.ZC,{width:[1,1,1/5],pl:[0,0,3],pt:[4,4,0]},a().createElement(ot,null))))}const qn=(0,N.withTheme)(({theme:Ee})=>a().createElement("svg",{width:"206",height:"116",viewBox:"0 0 206 116",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a().createElement("path",{opacity:"0.75",fillRule:"evenodd",clipRule:"evenodd",d:"M68.4597 62.9385L69.3597 62.6266L69.2728 62.375L68.3726 62.6869L68.4597 62.9385ZM66.57 63.3113L66.657 63.5628L67.5596 63.2502L67.4827 62.995L66.57 63.3113ZM64.8541 64.1872L65.7568 63.8746L65.6699 63.623L64.7673 63.9356L64.8541 64.1872ZM63.0541 64.8107L63.9541 64.4989L63.8671 64.2473L62.967 64.5591L63.0541 64.8107ZM61.2512 65.435L62.1513 65.1233L62.0644 64.8717L61.1643 65.1834L61.2512 65.435ZM59.3692 65.8052L59.4561 66.0568L60.3486 65.7476L60.2693 65.4934L59.3692 65.8052ZM57.6457 66.6839L58.5483 66.3711L58.4615 66.1195L57.5588 66.4321L57.6457 66.6839ZM55.8456 67.3073L56.7456 66.9956L56.6588 66.744L55.7586 67.0557L55.8456 67.3073ZM54.0428 67.9317L54.943 67.6199L54.8559 67.3683L53.9559 67.6801L54.0428 67.9317ZM52.2401 68.556L53.1401 68.2443L53.0533 67.9927L52.153 68.3044L52.2401 68.556ZM50.3504 68.9288L50.4374 69.1803L51.34 68.8677L51.2556 68.6153L50.3504 68.9288ZM48.6346 69.8047L49.5372 69.4921L49.4503 69.2405L48.5477 69.5531L48.6346 69.8047ZM46.8345 70.4282L47.7345 70.1164L47.6475 69.8648L46.7474 70.1766L46.8345 70.4282ZM45.0316 71.0527L45.9317 70.7409L45.8448 70.4892L44.9448 70.8011L45.0316 71.0527ZM43.229 71.677L44.129 71.3653L44.0421 71.1137L43.1419 71.4254L43.229 71.677ZM41.4261 72.3014L42.3287 71.9888L42.2419 71.7372L41.3392 72.0498L41.4261 72.3014ZM39.626 72.9248L40.5261 72.6131L40.4392 72.3615L39.539 72.6732L39.626 72.9248ZM37.8232 73.5492L38.7234 73.2374L38.6364 72.9858L37.7363 73.2976L37.8232 73.5492ZM36.0205 74.1735L36.9206 73.8618L36.8337 73.6102L35.9335 73.9219L36.0205 74.1735ZM35.1205 74.4853L35.0284 74.2356L34.1308 74.5464L34.2178 74.798L35.1205 74.4853ZM32.415 75.4224L33.3176 75.1098L33.2307 74.8582L32.3281 75.1708L32.415 75.4224Z",fill:"#F8FBFB"}),a().createElement("path",{d:"M47.5497 99.536L48.2674 97.531L46.2646 96.8125L45.5469 98.8175L47.5497 99.536Z",fill:"#FBAD41"}),a().createElement("path",{d:"M51.0645 97.459L51.5663 96.057L50.166 95.5547L49.6641 96.9565L51.0645 97.459Z",fill:"#F6821F"}),a().createElement("path",{d:"M54.3612 96.0684L54.8632 94.6664L53.4627 94.1641L52.9609 95.5659L54.3612 96.0684Z",fill:"#FF6633"}),a().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M57.805 93.5642L57.2284 93.8382L56.9453 93.2408L57.5221 92.9669L57.805 93.5642ZM60.1122 92.4689L58.9586 93.0166L58.6755 92.4192L59.8291 91.8715L60.1122 92.4689ZM62.4194 91.3733L61.2658 91.921L60.9827 91.3237L62.1363 90.776L62.4194 91.3733ZM64.7264 90.2778L63.573 90.8254L63.2899 90.2281L64.4435 89.6804L64.7264 90.2778ZM67.0336 89.1822L65.88 89.7299L65.597 89.1325L66.7506 88.5849L67.0336 89.1822ZM69.3408 88.0866L68.1872 88.6343L67.9042 88.037L69.0578 87.4893L69.3408 88.0866ZM71.6479 86.9911L70.4943 87.5388L70.2114 86.9414L71.365 86.3937L71.6479 86.9911ZM73.9551 85.8955L72.8015 86.4432L72.5184 85.8459L73.672 85.2982L73.9551 85.8955ZM75.6855 85.0739L75.1087 85.3478L74.8256 84.7505L75.4024 84.4766L75.6855 85.0739Z",fill:"#003682"}),a().createElement("path",{d:"M157.688 47.9751L157.688 47.9747L158.528 45.8695L113.335 67.2397L113.133 66.8118L158.326 45.4418L156.168 44.7539L156.329 44.25L159.361 45.2143L158.179 48.171L157.688 47.9751Z",fill:"#003682"}),a().createElement("path",{d:"M16.4522 93.228L15.6634 91.25L13.6875 92.0397L14.4763 94.0177L16.4522 93.228Z",fill:"#6ECCE5"}),a().createElement("path",{d:"M12.8758 94.2736L12.4365 93.1719L11.3359 93.6116L11.7753 94.7134L12.8758 94.2736Z",fill:"#9ADCED"}),a().createElement("path",{d:"M10.4695 95.133L10.0302 94.0312L8.92969 94.471L9.36902 95.5728L10.4695 95.133Z",fill:"#F8FBFB"}),a().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.1215 91.7011L17.5126 91.9446L17.2578 91.3063L17.8665 91.0628L18.1215 91.7011ZM20.5567 90.7267L19.3391 91.2139L19.0842 90.5756L20.302 90.0884L20.5567 90.7267ZM22.9922 89.7523L21.7745 90.2395L21.5196 89.6012L22.7372 89.114L22.9922 89.7523ZM25.4274 88.7779L24.2098 89.2651L23.9549 88.6268L25.1727 88.1394L25.4274 88.7779ZM27.8629 87.8035L26.6451 88.2907L26.3903 87.6522L27.6079 87.165L27.8629 87.8035ZM30.2981 86.8291L29.0805 8