1import{j as n,bd as g,cf as q,r as M,kw as Kt,a4 as pe,a1 as ae,br as se,bW as ue,kx as Yt,bS as _e,dt as zt,aA as Ce,ek as it,ak as rt,W as we,ky as qt,kz as We,aj as Ue,kA as Xt,ay as vt,ey as at,c as Re,bk as He,cg as st,bi as Be,at as P,ap as Zt,cy as Ge,b5 as je,cA as Ke,cz as Ye,f6 as E,b4 as Se,g4 as ze,$ as qe,kn as I,ad as xt,cS as Jt,bj as Qt,aS as Xe,d as yt,jm as te,ds as bt,aP as en,jn as _t,b_ as tn,Z as ot,ci as Ct,b as wt,gN as nn,by as $e,kB as jt,bu as rn,aT as an}from"./index-2CwtICst.js";import{C as sn}from"./index-C3EW0cdX.js";import{C as Ze}from"./index-ByI-dl2o.js";import{C as Je}from"./index-RBiBiqiu.js";import{S as De}from"./index-CNOSNgs_.js";import{S as St}from"./RupeeSymbol-BAb_lcJl.js";import{C as Qe}from"./index-IOqWghCC.js";import{D as et}from"./index-BCDMll3A.js";import{S as on}from"./TruckLine-Cr8zw0v_.js";import{S as ln}from"./TruckRtoLine-DU62hawY.js";import{S as cn}from"./LocationPinColor-BeWl92k5.js";import{R as dn}from"./ExclamationCircleOutlined-BpOnn4hU.js";import{T as un}from"./table_loader-9XCof2ZJ.js";import{R as pn}from"./SyncOutlined-Cxccdn5y.js";import{T as he}from"./Table-CwvOdCcz.js";import{R as It}from"./InfoCircleOutlined-WJAwMEA5.js";import{R as kt}from"./HolderOutlined-eKR3UX_K.js";import{C as hn}from"./confirmation_modal-z4uGN-A_.js";import{C as fn,R as mn}from"./index-CMxXHkm6.js";import{d as gn,A as vn,e as xn}from"./constant-Djc3dzGD.js";import{C as Fe,R as me}from"./common-Cfql01h7.js";import{S as yn}from"./AIIcon2-h0lcDNr1.js";import{t as Ve}from"./mixpanel_utils-DOVBG_9P.js";import{C as bn}from"./col-MZTILiOt.js";import{R as _n}from"./CopyOutlined-DHdlcXnq.js";import{R as Cn}from"./EditOutlined-DNdDFaOm.js";import{U as wn}from"./humbleicons_ai-R1B9qVKG.js";import"./product_guide_activity_provider-DkIj5k50.js";import{U as jn}from"./user_guide_banner-CMaOEJ-k.js";import{T as Sn}from"./index-DaN20Aem.js";import"./utils-D_KRJni2.js";import"./utils-Byo2OGEK.js";import"./react-number-format.es-Dr0FQMRn.js";import"./index-D_ey_yow.js";import"./walletPromo-7iFugMAD.js";import"./WalletOutlined-CJ-LESdj.js";import"./form_utils-BRD3em_d.js";import"./index-DdKyALA4.js";import"./css-CG3sgCP8.js";import"./DialogWrap-DDRffVA8.js";import"./Portal-m7W4unkL.js";import"./getScrollBarSize-CHB1zEd-.js";import"./useId-BeW6vcu-.js";import"./index-l3dd8B4K.js";import"./use_is_mobile-QmlX2oD9.js";import"./constant-BEBLfsgt.js";import"./utils-CJar-MsZ.js";import"./PackageMedium-p3o-GjjV.js";import"./CartTrolley-BJIgsVV3.js";import"./constants-CNHr-9z-.js";import"./KeyLine-DbHrvLov.js";import"./BillLine-D4PgZmiD.js";import"./MessageFill-DoJFk5G_.js";import"./PackageSmall-DXcoG-iG.js";import"./ClipboardLineIcon-Bh2KJsdr.js";import"./ExchangeLine-DasM4eUe.js";import"./layout.module-CnEu4Xzs.js";import"./ExportOutlined-DuChcwzc.js";import"./index-CUYKYEVB.js";import"./CloseIcon-CdU2swGf.js";import"./index-BxPsFHPt.js";import"./isEqual-DAIv1GAa.js";import"./dropdown-1Xi7yUr8.js";import"./Dropdown-CSDSyzzq.js";import"./isNumeric-OYazz19Q.js";import"./modal_component-CQ9TsgKw.js";import"./modal_header-Zzno9Dew.js";import"./index-BC4zRIry.js";import"./Collapse-LLLXNv2l.js";import"./index-D3pD5RCc.js";import"./firebase-C6tfLYOi.js";import"./mixpanel-BymvXId3.js";import"./ClockCircleOutlined-P-L76-YC.js";import"./CloseOutlined-DrYqvwGF.js";import"./PlusOutlined-ByZyTB3m.js";const In="_container_1k0ab_10",kn="_value_1k0ab_17",Nn="_title_1k0ab_22",Oe={container:In,value:kn,title:Nn},Tn=({title:t,value:i})=>n.jsxs(g,{className:Oe.container,vertical:!0,align:"center",justify:"center",children:[n.jsx(g,{className:Oe.value,children:i}),n.jsx(g,{className:Oe.title,children:t})]}),Nt=({carrierId:t,status:i,onStatusChange:r})=>{const{reloadShippingCarriers:c}=q(),[s,u]=M.useState(!1),l=async({carrierId:e,updatedStatus:h})=>{u(!0);const o=await Kt({carrierId:e,updatedStatus:h}),{ok:a,data:p}=o;a?(await c(),pe("Carrier status updated successfully"),r&&r()):ae(se(p,"Unable to update carrier status")),u(!1)};return n.jsx(De,{checked:i,checkedChildren:"On",unCheckedChildren:"Off",loading:s,onChange:e=>{l({carrierId:t,updatedStatus:e})}})},Dn="_insightCardsContainer_16et0_10",Rn="_serviceContainer_16et0_14",On="_checked_16et0_14",En="_unChecked_16et0_18",An="_tableHeaderTitle_16et0_26",Ln="_filterTitle_16et0_31",Pn="_courierPartnerSelect_16et0_36",Mn="_modeSelect_16et0_39",Bn="_infoIcon_16et0_42",$n="_otpVerificationDisabledContainer_16et0_53",Fn="_otpVerificationLockedTooltip_16et0_61",Vn="_otpVerificationLockedSwitchWrapper_16et0_66",Wn="_viewDetailsButton_16et0_69",Un="_table_16et0_26",U={insightCardsContainer:Dn,serviceContainer:Rn,checked:On,unChecked:En,tableHeaderTitle:An,filterTitle:Ln,courierPartnerSelect:Pn,modeSelect:Mn,infoIcon:Bn,otpVerificationDisabledContainer:$n,otpVerificationLockedTooltip:Fn,otpVerificationLockedSwitchWrapper:Vn,viewDetailsButton:Wn,table:Un},Tt=({carrierId:t,status:i,defaultOtpVerificationStatus:r,carrierOtpVerificationStatus:c})=>{const{reloadShippingCarriers:s}=q(),[u,l]=M.useState(!1),e=r===!0,h=c===!0,o=async({carrierId:a,updatedStatus:p})=>{l(!0);const{ok:d,data:f}=await Yt({carrierId:a,updatedStatus:p});if(l(!1),!d){ae(se(f,"Failed to update OTP verification")),s();return}pe("OTP verification updated successfully"),s()};return e?n.jsx(ue,{title:"OTP verified delivery is enabled by default for this carrier",color:"#FFFFFF",overlayClassName:U.otpVerificationLockedTooltip,overlayInnerStyle:{color:"#3D3D6B"},children:n.jsx("span",{className:U.otpVerificationLockedSwitchWrapper,children:n.jsx(De,{checked:!0,checkedChildren:"On",unCheckedChildren:"Off",disabled:!0})})}):h?n.jsx(De,{checked:i,checkedChildren:"On",unCheckedChildren:"Off",loading:u,onChange:a=>{o({carrierId:t,updatedStatus:a})}}):n.jsx(g,{align:"center",gap:4,className:U.otpVerificationDisabledContainer,children:n.jsx("p",{children:"Not Available"})})},Hn="_container_nwvtn_10",Gn="_locationPinIcon_nwvtn_16",Kn="_totalPincodesLabel_nwvtn_20",Yn="_totalPincodesDescription_nwvtn_29",zn="_downloadButton_nwvtn_34",ge={container:Hn,locationPinIcon:Gn,totalPincodesLabel:Kn,totalPincodesDescription:Yn,downloadButton:zn},lt=({totalPincodes:t,pincodesFileLink:i})=>{const r=u=>{u==null||u.stopPropagation(),window.open(i,"_self","noopener,noreferrer")},c=!!t&&!!i,s=t||0;return n.jsxs(g,{align:"center",gap:10,justify:"space-between",className:ge.container,children:[n.jsxs(g,{align:"center",gap:10,children:[n.jsx(cn,{className:ge.locationPinIcon}),n.jsxs(g,{vertical:!0,children:[n.jsxs("p",{className:ge.totalPincodesLabel,children:[n.jsx("span",{children:s})," pincodes"]}),n.jsx("p",{className:ge.totalPincodesDescription,children:"Total high performance pincodes"})]})]}),c&&n.jsx(_e,{icon:n.jsx(zt,{}),size:"small",className:ge.downloadButton,onClick:r})]})},qn="_container_1f3jp_10",Xn="_confirmButton_1f3jp_13",Zn="_configItem
1Container_1f3jp_17",Jn="_configItemHeader_1f3jp_28",Qn="_configItemLabel_1f3jp_28",ei="_configItemDescription_1f3jp_36",ti="_radioItemLabel_1f3jp_41",ni="_radioItemDescription_1f3jp_45",ii="_forwardConfigContainer_1f3jp_50",ri="_reverseConfigContainer_1f3jp_54",ai="_lastUpdatedLabel_1f3jp_58",si="_lastUpdatedValue_1f3jp_63",oi="_disabledContainer_1f3jp_68",li="_primeCarrierWarningContainer_1f3jp_71",V={container:qn,confirmButton:Xn,configItemContainer:Zn,configItemHeader:Jn,configItemLabel:Qn,configItemDescription:ei,radioItemLabel:ti,radioItemDescription:ni,forwardConfigContainer:ii,reverseConfigContainer:ri,lastUpdatedLabel:ai,lastUpdatedValue:si,disabledContainer:oi,primeCarrierWarningContainer:li},ct={forward:"deliveryPincodeCoverage",reverse:"reversePickupPincodeCoverage"},ci=({clientCarrierId:t,onClose:i})=>{var b,w,N,_,D,A,T,S,R,C,k,y;const{shippingRuleCarriers:r,reloadShippingCarriers:c}=q(),[s,u]=M.useState(!1),l=r==null?void 0:r.find(x=>(x==null?void 0:x.id)===t),e=(w=(b=l==null?void 0:l.attributes)==null?void 0:b.carrier)==null?void 0:w.is_prime,[h,o]=M.useState({deliveryPincodeCoverage:!!((N=l==null?void 0:l.attributes)!=null&&N.delivery_hp_pincodes_enabled),reversePickupPincodeCoverage:!!((_=l==null?void 0:l.attributes)!=null&&_.reverse_pickup_hp_pincodes_enabled)}),a=(T=(A=(D=l==null?void 0:l.attributes)==null?void 0:D.carrier)==null?void 0:A.pincode_configurations)==null?void 0:T.customer_delivery_high_performance,p=(C=(R=(S=l==null?void 0:l.attributes)==null?void 0:S.carrier)==null?void 0:R.pincode_configurations)==null?void 0:C.customer_pickup_high_performance,d=a==null?void 0:a.uploaded_at,f=p==null?void 0:p.uploaded_at,v=(y=(k=l==null?void 0:l.attributes)==null?void 0:k.carrier)==null?void 0:y.return_eligible,m=[{key:"forward",label:"Delivery Pincode",icon:n.jsx(on,{}),description:"Kindly select the option for delivery pincode configuration.",radioOptions:[{value:"custom",label:"Custom",disabled:!(a!=null&&a.count),labelComponent:n.jsxs(g,{vertical:!0,gap:4,children:[n.jsxs(g,{vertical:!0,children:[n.jsx("p",{className:V.radioItemLabel,children:"Only High Performance Pincodes"}),n.jsx("p",{className:V.radioItemDescription,children:"Allow deliveries only to high-performance pincodes for this courier"})]}),n.jsxs(g,{vertical:!0,gap:2,children:[n.jsx(lt,{totalPincodes:a==null?void 0:a.count,pincodesFileLink:a==null?void 0:a.file}),d&&n.jsxs(g,{gap:4,align:"center",children:[n.jsx("p",{className:V.lastUpdatedLabel,children:"Last updated on:"}),n.jsx("p",{className:V.lastUpdatedValue,children:Ce(d).format("DD MMM YY")})]})]})]})},{value:"all",label:"All",disabled:!1,labelComponent:n.jsxs(g,{vertical:!0,children:[n.jsx("p",{className:V.radioItemLabel,children:"Full Coverage"}),n.jsx("p",{className:V.radioItemDescription,children:"Allow deliveries to all serviceable pincodes for this courier"})]})}]},{key:"reverse",label:"Reverse Pickup Pincode",icon:n.jsx(ln,{}),description:"Kindly select the option for reverse pickup pincode configuration.",radioOptions:[{value:"custom",label:"Custom",disabled:!(p!=null&&p.count),labelComponent:n.jsxs(g,{vertical:!0,gap:4,children:[n.jsxs(g,{vertical:!0,children:[n.jsx("p",{className:V.radioItemLabel,children:"Only High Performance Pincodes"}),n.jsx("p",{className:V.radioItemDescription,children:"Allow deliveries only to high-performance pincodes for this courier"})]}),n.jsxs(g,{vertical:!0,gap:2,children:[n.jsx(lt,{totalPincodes:p==null?void 0:p.count,pincodesFileLink:p==null?void 0:p.file}),f&&n.jsxs(g,{gap:4,align:"center",children:[n.jsx("p",{className:V.lastUpdatedLabel,children:"Last updated on:"}),n.jsx("p",{className:V.lastUpdatedValue,children:Ce(f).format("DD MMM YY")})]})]})]})},{value:"all",label:"All",disabled:!1,labelComponent:n.jsxs(g,{vertical:!0,children:[n.jsx("p",{className:V.radioItemLabel,children:"Full Coverage"}),n.jsx("p",{className:V.radioItemDescription,children:"Allow deliveries to all serviceable pincodes for this courier"})]})}]}],j=async()=>{u(!0);const{ok:x,data:$}=await qt({clientCarrierId:t,updatedData:{delivery_hp_pincodes_enabled:h.deliveryPincodeCoverage,reverse_pickup_hp_pincodes_enabled:h.reversePickupPincodeCoverage}});if(!x){ae(se($,"Failed to update pincode coverage")),u(!1);return}pe("Pincode coverage updated successfully"),await c(),u(!1),i()};return n.jsxs(g,{vertical:!0,gap:24,justify:"space-between",className:V.container,children:[n.jsxs(g,{vertical:!0,gap:16,children:[e&&n.jsxs(g,{align:"center",gap:10,className:V.primeCarrierWarningContainer,children:[n.jsx(dn,{}),n.jsx("p",{children:"This configuration is not available for prime carriers"})]}),m.map(x=>{const $=x.key==="forward",F=x.key==="reverse",L=F&&!v;return n.jsx(ue,{title:L&&!e?"This courier partner is not eligible for reverse pickup":"",color:"#FFFFFF",overlayInnerStyle:{color:"#3D3D6B"},children:n.jsxs(g,{vertical:!0,gap:16,className:rt(V.configItem
1Container,{[V.forwardConfigContainer]:$,[V.reverseConfigContainer]:F,[V.disabledContainer]:L||e}),children:[n.jsxs(g,{vertical:!0,children:[n.jsxs(g,{align:"center",gap:4,className:V.configItemHeader,children:[x.icon,n.jsx("p",{className:V.configItemLabel,children:x.label})]}),n.jsx("p",{className:V.configItemDescription,children:x.description})]}),n.jsx(it.Group,{disabled:L||e,value:h[ct[x.key]]?"custom":"all",onChange:Y=>{o({...h,[ct[x.key]]:Y.target.value==="custom"})},children:n.jsx(g,{vertical:!0,gap:8,children:x.radioOptions.map(Y=>{const O=Y.disabled||L,B=O&&!L&&!e;return n.jsx(it,{value:Y.value,disabled:O||e,children:n.jsx(ue,{title:B?"There are no high performance pincodes available for this courier":"",color:"#FFFFFF",overlayInnerStyle:{color:"#3D3D6B"},children:n.jsx("div",{className:rt({[V.disabledContainer]:O}),children:Y.labelComponent})},x.key)},Y.value)})})})]},x.key)},x.key)})]}),n.jsx(we,{className:V.confirmButton,onClick:j,loading:s,children:"CONFIRM"})]})},di="_drawerDescription_tpv5f_10",ui="_serviceContainer_tpv5f_16",pi="_checked_tpv5f_16",hi="_unChecked_tpv5f_20",fi="_drawerDescriptionItemTitle_tpv5f_28",mi="_drawerDescriptionItemDivider_tpv5f_33",oe={drawerDescription:di,serviceContainer:ui,checked:pi,unChecked:hi,drawerDescriptionItemTitle:fi,drawerDescriptionItemDivider:mi},gi=({clientCarrierId:t,onClose:i})=>{var d,f,v;const{shippingRuleCarriers:r}=q(),c=r==null?void 0:r.find(m=>(m==null?void 0:m.id)===t),{name:s,code:u,service_level:l,services:e,default_otp_verification:h,otp_verification:o}=((d=c==null?void 0:c.attributes)==null?void 0:d.carrier)||{},a=((f=c.attributes)==null?void 0:f.otp_verification)||!1,p=[{id:"mode",label:"Mode",value:n.jsx(Je,{deliveryMode:l})},{id:"services",label:"Services",value:n.jsx(g,{vertical:!0,gap:2,children:e==null?void 0:e.map((m,j)=>{const{feature:b,status:w}=m;return n.jsxs(g,{align:"center",gap:4,className:oe.serviceContainer,children:[w?n.jsx(We,{className:oe.checked}):n.jsx(Ue,{className:oe.unChecked}),n.jsx("p",{children:b})]},j)})})},{id:"activate_deactivate",label:"Activate / Deactivate",value:n.jsx(Nt,{carrierId:t,status:(v=c==null?void 0:c.attributes)==null?void 0:v.status})},{id:"otp_verification",label:"OTP Verification",value:n.jsx(Tt,{carrierId:t,status:a,defaultOtpVerificationStatus:h,carrierOtpVerificationStatus:o})}];return n.jsx(Qe,{open:!0,onClose:i,width:580,header:n.jsx(et,{headerTitle:n.jsx(Ze,{name:s,code:u,children:n.jsx("p",{className:oe.drawerDescription,children:"You can edit pincode coverage configuration here"})}),onClose:i,children:n.jsx(g,{justify:"space-between",gap:4,children:p.map((m,j)=>{const b=j!==p.length-1;return n.jsxs(M.Fragment,{children:[n.jsxs(g,{vertical:!0,justify:"space-between",gap:4,children:[n.jsx("p",{className:oe.drawerDescriptionItemTitle,children:m.label}),n.jsx("div",{children:m.value})]},m.id),b&&n.jsx("div",{className:oe.drawerDescriptionItemDivider})]},m.id)})})}),children:n.jsx(ci,{clientCarrierId:t,onClose:i})})},Dt=(t=[],i)=>!i||t.some(c=>{var s;return(s=c.feature)==null?void 0:s.toLowerCase().includes("open box")})?t:[...t,{feature:"Open box delivery",status:!0}],vi=()=>{var D,A,T;const{shippingRuleCarriers:t,isLoading:i,isValidating:r,reloadShippingCarriers:c}=q(),{summary:s,isLoading:u}=Xt(),{query:l,appendParams:e,removeParam:h}=vt(),[o,a]=M.useState({showDrawer:!1,clientCarrierId:""}),p=Object.keys(at).map(S=>({label:at[S],value:S})),d=[{label:"Road",value:"road"},{label:"Air",value:"air"},{label:"NDD",value:"ndd"},{label:"SDD",value:"sdd"}],f=[{title:"Activated Courier Partners",value:s==null?void 0:s.enabled_carriers},{title:"Serviceable Pincode for Delivery",value:(D=s==null?void 0:s.serviceable_pincodes)==null?void 0:D.customer_delivery},{title:"Serviceable Pincode for Pickup",value:(A=s==null?void 0:s.serviceable_pincodes)==null?void 0:A.customer_pickup},{title:"Serviceable Pincode for Reverse Pickup",value:(T=s==null?void 0:s.serviceable_pincodes)==null?void 0:T.seller_delivery}],v=[{title:"Courier Name",key:"courierName",render:(S,R)=>{const{attributes:{carrier:{code:C,name:k,channel:y}}}=R,x=y==="external";return n.jsx(Ze,{name:k,code:C,isExternalCourier:x})}},{title:"Mode",key:"mode",render:(S,R)=>{const{attributes:{carrier:{service_level:C}}}=R;return n.jsx(Je,{deliveryMode:C})}},{title:"Speed",key:"speed",render:(S,R)=>{const{attributes:{carrier:{speed:C}}}=R;return n.jsx(Be,{children:C||""})}},{title:"Cost",key:"cost",render:(S,R)=>{const{attributes:{carrier:{cost_rating:C}}}=R,k=[...Array(C||0).keys()];return n.jsx(g,{gap:4,children:k.map((y,x)=>n.jsx(St,{},x))})}},{title:"Services",key:"services",render:(S,R)=>{const{attributes:{carrier:{services:C,is_obd:k}}}=R,y=Dt(C,k);return n.jsx(g,{vertical:!0,gap:2,children:y.map((x,$)=>{const{feature:F,status:L}=x;return n.jsxs(g,{align:"center",gap:4,className:U.serviceContainer,children:[L?n.jsx(We,{className:U.checked}):n.jsx(Ue,{className:U.unChecked}),n.jsx("p",{children:F})]},$)})})}},{title:"Activate / Deactivate",key:"status",render:(S,R)=>{const{attributes:{id:C,status:k}}=R;return n.jsx(Nt,{carrierId:C,status:k})}},{title:n.jsxs(g,{align:"center",gap:4,justify:"space-between",children:[n.jsx("p",{children:"OTP Verification"}
1),n.jsx(ue,{title:"Applicable only for prepaid orders.",color:"#FFFFFF",overlayInnerStyle:{color:"#3D3D6B"},children:n.jsx(It,{className:U.infoIcon})})]}),key:"otpVerification",render:(S,R)=>{const{attributes:{id:C,otp_verification:k,carrier:{default_otp_verification:y,otp_verification:x}}}=R;return n.jsx(Tt,{carrierId:C,status:k??!1,defaultOtpVerificationStatus:y,carrierOtpVerificationStatus:x})}},{title:"",key:"actions",render:(S,R)=>{const{attributes:{id:C}}=R;return n.jsx(_e,{size:"small",type:"link",className:U.viewDetailsButton,onClick:()=>a({showDrawer:!0,clientCarrierId:C}),children:"View Details"})}}],m=l.courierPartner,j=m||void 0,b=l.mode,w=b||void 0,N=t.filter(S=>{const R=S.attributes.carrier.code;return j?j===R:!0}).filter(S=>{const R=S.attributes.carrier.service_level;return w?R===w:!0}),_=N==null?void 0:N.length;return n.jsxs(g,{vertical:!0,gap:10,className:U.container,children:[u?n.jsx(Re,{size:"small"}):n.jsx(g,{gap:12,className:U.insightCardsContainer,children:f.map(S=>n.jsx(Tn,{title:S.title,value:String(S.value??0)},S.title))}),n.jsxs(g,{justify:"space-between",className:U.tableHeader,align:"center",children:[n.jsxs("p",{className:U.tableHeaderTitle,children:[_," ",He("partner",_)]}),n.jsxs(g,{gap:12,align:"center",children:[n.jsxs(g,{gap:8,align:"center",children:[n.jsx("p",{className:U.filterTitle,children:"Courier Partner"}),n.jsx(st,{placeholder:"All",options:p,size:"small",value:j,onChange:S=>{if(!S){h("courierPartner");return}e({courierPartner:S})},className:U.courierPartnerSelect,allowClear:!0})]}),n.jsxs(g,{gap:8,align:"center",children:[n.jsx("p",{className:U.filterTitle,children:"Mode"}),n.jsx(st,{placeholder:"All",options:d,size:"small",value:w,onChange:S=>{if(!S){h("mode");return}e({mode:S})},className:U.modeSelect,allowClear:!0})]}),n.jsx(_e,{size:"small",icon:n.jsx(pn,{}),onClick:c,loading:r,disabled:r||i})]})]}),i?n.jsx(un,{columns:v.length}):n.jsx(he,{columns:v,dataSource:N,rowKey:"id",pagination:!1,className:U.table,loading:r}),o.showDrawer&&n.jsx(gi,{clientCarrierId:o.clientCarrierId,onClose:()=>a({showDrawer:!1,clientCarrierId:""})})]})};function Ee(t){for(var i=1;i<arguments.length;i++){var r=arguments[i]!=null?Object(arguments[i]):{},c=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&c.push.apply(c,Object.getOwnPropertySymbols(r).filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),c.forEach(function(s){P(t,s,r[s])})}return t}var xi=function(t,i,r,c,s,u,l,e){if(!t){var h;if(i===void 0)h=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=[r,c,s,u,l,e],a=0;h=new Error(i.replace(/%s/g,function(){return o[a++]})),h.name="Invariant Violation"}throw h.framesToPop=1,h}},yi=xi;const re=Zt(yi);var bi=function(){function t(){je(this,t),P(this,"refs",{})}return Se(t,[{key:"add",value:function(r,c){this.refs[r]||(this.refs[r]=[]),this.refs[r].push(c)}},{key:"remove",value:function(r,c){var s=this.getIndex(r,c);s!==-1&&this.refs[r].splice(s,1)}},{key:"isActive",value:function(){return this.active}},{key:"getActive",value:function(){var r=this;return this.refs[this.active.collection].find(function(c){var s=c.node;return s.sortableInfo.index==r.active.index})}},{key:"getIndex",value:function(r,c){return this.refs[r].indexOf(c)}},{key:"getOrderedRefs",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.active.collection;return this.refs[r].sort(_i)}}]),t}();function _i(t,i){var r=t.node.sortableInfo.index,c=i.node.sortableInfo.index;return r-c}function Rt(t,i,r){return t=t.slice(),t.splice(r<0?t.length+r:r,0,t.splice(i,1)[0]),t}function Ot(t,i){return Object.keys(t).reduce(function(r,c){return i.indexOf(c)===-1&&(r[c]=t[c]),r},{})}var le={end:["touchend","touchcancel","mouseup"],move:["touchmove","mousemove"],start:["touchstart","mousedown"]},Et=function(){if(typeof window>"u"||typeof document>"u")return"";var t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"],i=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||t.OLink===""&&["","o"])[1];switch(i){case"ms":return"ms";default:return i&&i.length?i[0].toUpperCase()+i.substr(1):""}}();
1function Ie(t,i){Object.keys(i).forEach(function(r){t.style[r]=i[r]})}function ke(t,i){t.style["".concat(Et,"Transform")]=i==null?"":"translate3d(".concat(i.x,"px,").concat(i.y,"px,0)")}function Ae(t,i){t.style["".concat(Et,"TransitionDuration")]=i==null?"":"".concat(i,"ms")}function be(t,i){for(;t;){if(i(t))return t;t=t.parentNode}return null}function dt(t,i,r){return Math.max(t,Math.min(r,i))}function de(t){return t.substr(-2)==="px"?parseFloat(t):0}function Ci(t){var i=window.getComputedStyle(t);return{bottom:de(i.marginBottom),left:de(i.marginLeft),right:de(i.marginRight),top:de(i.marginTop)}}function tt(t,i){var r=i.displayName||i.name;return r?"".concat(t,"(").concat(r,")"):t}function Le(t,i){var r=t.getBoundingClientRect();return{top:r.top+i.top,left:r.left+i.left}}function ve(t){return t.touches&&t.touches.length?{x:t.touches[0].pageX,y:t.touches[0].pageY}:t.changedTouches&&t.changedTouches.length?{x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY}:{x:t.pageX,y:t.pageY}}function wi(t){return t.touches&&t.touches.length||t.changedTouches&&t.changedTouches.length}function Te(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{left:0,top:0};if(t){var c={left:r.left+t.offsetLeft,top:r.top+t.offsetTop};return t.parentNode===i?c:Te(t.parentNode,i,c)}}function ji(t,i,r){return t<r&&t>i?t-1:t>r&&t<i?t+1:t}function ut(t){var i=t.lockOffset,r=t.width,c=t.height,s=i,u=i,l="px";if(typeof i=="string"){var e=/^[+-]?\d*(?:\.\d*)?(px|%)$/.exec(i);re(e!==null,'lockOffset value should be a number or a string of a number followed by "px" or "%". Given %s',i),s=parseFloat(i),u=parseFloat(i),l=e[1]}return re(isFinite(s)&&isFinite(u),"lockOffset value should be a finite. Given %s",i),l==="%"&&(s=s*r/100,u=u*c/100),{x:s,y:u}}function Si(t){var i=t.height,r=t.width,c=t.lockOffset,s=Array.isArray(c)?c:[c,c];re(s.length===2,"lockOffset prop of SortableContainer should be a single value or an array of exactly two values. Given %s",c);var u=xt(s,2),l=u[0],e=u[1];return[ut({height:i,lockOffset:l,width:r}),ut({height:i,lockOffset:e,width:r})]}function Ii(t){var i=window.getComputedStyle(t),r=/(auto|scroll)/,c=["overflow","overflowX","overflowY"];return c.find(function(s){return r.test(i[s])})}function At(t){return t instanceof HTMLElement?Ii(t)?t:At(t.parentNode):null}function ki(t){var i=window.getComputedStyle(t);return i.display==="grid"?{x:de(i.gridColumnGap),y:de(i.gridRowGap)}:{x:0,y:0}}var ne={ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40},ie={Anchor:"A",Button:"BUTTON",Canvas:"CANVAS",Input:"INPUT",Option:"OPTION",Textarea:"TEXTAREA",Select:"SELECT"};function Ni(t){var i="input, textarea, select, canvas, [contenteditable]",r=t.querySelectorAll(i),c=t.cloneNode(!0),s=Jt(c.querySelectorAll(i));return s.forEach(function(u,l){if(u.type!=="file"&&(u.value=r[l].value),u.type==="radio"&&u.name&&(u.name="__sortableClone__".concat(u.name)),u.tagName===ie.Canvas&&r[l].width>0&&r[l].height>0){var e=u.getContext("2d");e.drawImage(r[l],0,0)}}),c}function Lt(t){var i,r,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{withRef:!1};return r=i=function(s){Ge(u,s);function u(){var l,e;je(this,u);for(var h=arguments.length,o=new Array(h),a=0;a<h;a++)o[a]=arguments[a];return e=Ke(this,(l=Ye(u)).call.apply(l,[this].concat(o))),P(E(E(e)),"wrappedInstance",M.createRef()),e}return Se(u,[{key:"componentDidMount",value:function(){var e=ze.findDOMNode(this);e.sortableHandle=!0}},{key:"getWrappedInstance",value:function(){return re(c.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableHandle() call"),this.wrappedInstance.current}},{key:"render",value:function(){var e=c.withRef?this.wrappedInstance:null;return M.createElement(t,qe({ref:e},this.props))}}]),u}(M.Component),P(i,"displayName",tt("sortableHandle",t)),r}function pt(t){return t.sortableHandle!=null}var Ti=function(){function t(i,r){je(this,t),this.container=i,this.onScrollCallback=r}return Se(t,[{key:"clear",value:function(){this.interval!=null&&(clearInterval(this.interval),this.interval=null)}},{key:"update",value:function(r){var c=this,s=r.translate,u=r.minTranslate,l=r.maxTranslate,e=r.width,h=r.height,o={x:0,y:0},a={x:1,y:1},p={x:10,y:10},d=this.container,f=d.scrollTop,v=d.scrollLeft,m=d.scrollHeight,j=d.scrollWidth,b=d.clientHeight,w=d.clientWidth,N=f===0,_=m-f-b===0,D=v===0,A=j-v-w===0;s.y>
1=l.y-h/2&&!_?(o.y=1,a.y=p.y*Math.abs((l.y-h/2-s.y)/h)):s.x>=l.x-e/2&&!A?(o.x=1,a.x=p.x*Math.abs((l.x-e/2-s.x)/e)):s.y<=u.y+h/2&&!N?(o.y=-1,a.y=p.y*Math.abs((s.y-h/2-u.y)/h)):s.x<=u.x+e/2&&!D&&(o.x=-1,a.x=p.x*Math.abs((s.x-e/2-u.x)/e)),this.interval&&(this.clear(),this.isAutoScrolling=!1),(o.x!==0||o.y!==0)&&(this.interval=setInterval(function(){c.isAutoScrolling=!0;var T={left:a.x*o.x,top:a.y*o.y};c.container.scrollTop+=T.top,c.container.scrollLeft+=T.left,c.onScrollCallback(T)},5))}}]),t}();function Di(t){var i=t.node;return{height:i.offsetHeight,width:i.offsetWidth}}function Ri(t){var i=[ie.Input,ie.Textarea,ie.Select,ie.Option,ie.Button];return!!(i.indexOf(t.target.tagName)!==-1||be(t.target,function(r){return r.contentEditable==="true"}))}var Pt={axis:I.oneOf(["x","y","xy"]),contentWindow:I.any,disableAutoscroll:I.bool,distance:I.number,getContainer:I.func,getHelperDimensions:I.func,helperClass:I.string,helperContainer:I.oneOfType([I.func,typeof HTMLElement>"u"?I.any:I.instanceOf(HTMLElement)]),hideSortableGhost:I.bool,keyboardSortingTransitionDuration:I.number,lockAxis:I.string,lockOffset:I.oneOfType([I.number,I.string,I.arrayOf(I.oneOfType([I.number,I.string]))]),lockToContainerEdges:I.bool,onSortEnd:I.func,onSortMove:I.func,onSortOver:I.func,onSortStart:I.func,pressDelay:I.number,pressThreshold:I.number,keyCodes:I.shape({lift:I.arrayOf(I.number),drop:I.arrayOf(I.number),cancel:I.arrayOf(I.number),up:I.arrayOf(I.number),down:I.arrayOf(I.number)}),shouldCancelStart:I.func,transitionDuration:I.number,updateBeforeSortStart:I.func,useDragHandle:I.bool,useWindowAsScrollContainer:I.bool},Mt={lift:[ne.SPACE],drop:[ne.SPACE],cancel:[ne.ESC],up:[ne.UP,ne.LEFT],down:[ne.DOWN,ne.RIGHT]},Oi={axis:"y",disableAutoscroll:!1,distance:0,getHelperDimensions:Di,hideSortableGhost:!0,lockOffset:"50%",lockToContainerEdges:!1,pressDelay:0,pressThreshold:5,keyCodes:Mt,shouldCancelStart:Ri,transitionDuration:300,useWindowAsScrollContainer:!1},Ei=Object.keys(Pt);function Ai(t){re(!(t.distance&&t.pressDelay),"Attempted to set both `pressDelay` and `distance` on SortableContainer, you may only use one or the other, not both at the same time.")}function Li(t,i){try{var r=t()}catch(c){return i(!0,c)}return r&&r.then?r.then(i.bind(null,!1),i.bind(null,!0)):i(!1,value)}var Bt=M.createContext({manager:{}});function $t(t){var i,r,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{withRef:!1};return r=i=function(s){Ge(u,s);function u(l){var e;je(this,u),e=Ke(this,Ye(u).call(this,l)),P(E(E(e)),"state",{}),P(E(E(e)),"handleStart",function(o){var a=e.props,p=a.distance,d=a.shouldCancelStart;if(!(o.button===2||d(o))){e.touched=!0,e.position=ve(o);var f=be(o.target,function(N){return N.sortableInfo!=null});if(f&&f.sortableInfo&&e.nodeIsChild(f)&&!e.state.sorting){var v=e.props.useDragHandle,m=f.sortableInfo,j=m.index,b=m.collection,w=m.disabled;if(w||v&&!be(o.target,pt))return;e.manager.active={collection:b,index:j},!wi(o)&&o.target.tagName===ie.Anchor&&o.preventDefault(),p||(e.props.pressDelay===0?e.handlePress(o):e.pressTimer=setTimeout(function(){return e.handlePress(o)},e.props.pressDelay))}}}),P(E(E(e)),"nodeIsChild",function(o){return o.sortableInfo.manager===e.manager}),P(E(E(e)),"handleMove",function(o){var a=e.props,p=a.distance,d=a.pressThreshold;if(!e.state.sorting&&e.touched&&!e._awaitingUpdateBeforeSortStart){var f=ve(o),v={x:e.position.x-f.x,y:e.position.y-f.y},m=Math.abs(v.x)+Math.abs(v.y);e.delta=v,!p&&(!d||m>=d)?(clearTimeout(e.cancelTimer),e.cancelTimer=setTimeout(e.cancel,0)):p&&m>=p&&e.manager.isActive()&&e.handlePress(o)}}),P(E(E(e)),"handleEnd",function(){e.touched=!1,e.cancel()}),P(E(E(e)),"cancel",function(){var o=e.props.distance,a=e.state.sorting;a||(o||clearTimeout(e.pressTimer),e.manager.active=null)}),P(E(E(e)),"handlePress",function(o){try{var a=e.manager.getActive(),p=function(){if(a){var d=function(){var C=D.sortableInfo.index,k=Ci(D),y=ki(e.container),x=e.scrollContainer.getBoundingClientRect(),$=m({index:C,node:D,collection:A});if(e.node=D,e.margin=k,e.gridGap=y,e.width=$.width,e.height=$.height,e.marginOffset={x:e.margin.left+e.margin.right+e.gridGap.x,y:Math.max(e.margin.top,e.margin.bottom,e.gridGap.y)},e.boundingClientRect=D.getBoundingClientRect(),e.containerBoundingRect=x,e.index=C,e.newIndex=C,e.axis={x:v.indexOf("x")>=0,y:v.indexOf("y")>=0},e.offsetEdge=Te(D,e.container),T?e.initialOffset=ve(Ee({},o,{pageX:e.boundingClientRect.left,pageY:e.boundingClientRect.top}
1)):e.initialOffset=ve(o),e.initialScroll={left:e.scrollContainer.scrollLeft,top:e.scrollContainer.scrollTop},e.initialWindowScroll={left:window.pageXOffset,top:window.pageYOffset},e.helper=e.helperContainer.appendChild(Ni(D)),Ie(e.helper,{boxSizing:"border-box",height:"".concat(e.height,"px"),left:"".concat(e.boundingClientRect.left-k.left,"px"),pointerEvents:"none",position:"fixed",top:"".concat(e.boundingClientRect.top-k.top,"px"),width:"".concat(e.width,"px")}),T&&e.helper.focus(),b&&(e.sortableGhost=D,Ie(D,{opacity:0,visibility:"hidden"})),e.minTranslate={},e.maxTranslate={},T){var F=_?{top:0,left:0,width:e.contentWindow.innerWidth,height:e.contentWindow.innerHeight}:e.containerBoundingRect,L=F.top,Y=F.left,O=F.width,B=F.height,W=L+B,K=Y+O;e.axis.x&&(e.minTranslate.x=Y-e.boundingClientRect.left,e.maxTranslate.x=K-(e.boundingClientRect.left+e.width)),e.axis.y&&(e.minTranslate.y=L-e.boundingClientRect.top,e.maxTranslate.y=W-(e.boundingClientRect.top+e.height))}else e.axis.x&&(e.minTranslate.x=(_?0:x.left)-e.boundingClientRect.left-e.width/2,e.maxTranslate.x=(_?e.contentWindow.innerWidth:x.left+x.width)-e.boundingClientRect.left-e.width/2),e.axis.y&&(e.minTranslate.y=(_?0:x.top)-e.boundingClientRect.top-e.height/2,e.maxTranslate.y=(_?e.contentWindow.innerHeight:x.top+x.height)-e.boundingClientRect.top-e.height/2);j&&j.split(" ").forEach(function(H){return e.helper.classList.add(H)}),e.listenerNode=o.touches?o.target:e.contentWindow,T?(e.listenerNode.addEventListener("wheel",e.handleKeyEnd,!0),e.listenerNode.addEventListener("mousedown",e.handleKeyEnd,!0),e.listenerNode.addEventListener("keydown",e.handleKeyDown)):(le.move.forEach(function(H){return e.listenerNode.addEventListener(H,e.handleSortMove,!1)}),le.end.forEach(function(H){return e.listenerNode.addEventListener(H,e.handleSortEnd,!1)})),e.setState({sorting:!0,sortingIndex:C}),N&&N({node:D,index:C,collection:A,isKeySorting:T,nodes:e.manager.getOrderedRefs(),helper:e.helper},o),T&&e.keyMove(0)},f=e.props,v=f.axis,m=f.getHelperDimensions,j=f.helperClass,b=f.hideSortableGhost,w=f.updateBeforeSortStart,N=f.onSortStart,_=f.useWindowAsScrollContainer,D=a.node,A=a.collection,T=e.manager.isKeySorting,S=function(){if(typeof w=="function"){e._awaitingUpdateBeforeSortStart=!0;var R=Li(function(){var C=D.sortableInfo.index;return Promise.resolve(w({collection:A,index:C,node:D,isKeySorting:T},o)).then(function(){})},function(C,k){if(e._awaitingUpdateBeforeSortStart=!1,C)throw k;return k});if(R&&R.then)return R.then(function(){})}}();return S&&S.then?S.then(d):d(S)}}();return Promise.resolve(p&&p.then?p.then(function(){}):void 0)}catch(d){return Promise.reject(d)}}),P(E(E(e)),"handleSortMove",function(o){var a=e.props.onSortMove;typeof o.preventDefault=="function"&&o.cancelable&&o.preventDefault(),e.updateHelperPosition(o),e.animateNodes(),e.autoscroll(),a&&a(o)}),P(E(E(e)),"handleSortEnd",function(o){var a=e.props,p=a.hideSortableGhost,d=a.onSortEnd,f=e.manager,v=f.active.collection,m=f.isKeySorting,j=e.manager.getOrderedRefs();e.listenerNode&&(m?(e.listenerNode.removeEventListener("wheel",e.handleKeyEnd,!0),e.listenerNode.removeEventListener("mousedown",e.handleKeyEnd,!0),e.listenerNode.removeEventListener("keydown",e.handleKeyDown)):(le.move.forEach(function(D){return e.listenerNode.removeEventListener(D,e.handleSortMove)}),le.end.forEach(function(D){return e.listenerNode.removeEventListener(D,e.handleSortEnd)}))),e.helper.parentNode.removeChild(e.helper),p&&e.sortableGhost&&Ie(e.sortableGhost,{opacity:"",visibility:""});for(var b=0,w=j.length;b<w;b++){var N=j[b],_=N.node;N.edgeOffset=null,N.boundingClientRect=null,ke(_,null),Ae(_,null),N.translate=null}e.autoScroller.clear(),e.manager.active=null,e.manager.isKeySorting=!1,e.setState({sorting:!1,sortingIndex:null}),typeof d=="function"&&d({collection:v,newIndex:e.newIndex,oldIndex:e.index,isKeySorting:m,nodes:j},o),e.touched=!1}),P(E(E(e)),"autoscroll",function(){var o=e.props.disableAutoscroll,a=e.manager.isKeySorting;if(o){e.autoScroller.clear();return}if(a){var p=Ee({},e.translate),d=0,f=0;e.axis.x&&(p.x=Math.min(e.maxTranslate.x,Math.max(e.minTranslate.x,e.translate.x)),d=e.translate.x-p.x),e.axis.y&&(p.y=Math.min(e.maxTranslate.y,Math.max(e.minTranslate.y,e.translate.y)),f=e.translate.y-p.y),e.translate=p,ke(e.helper,e.translate),e.scrollC
1ontainer.scrollLeft+=d,e.scrollContainer.scrollTop+=f;return}e.autoScroller.update({height:e.height,maxTranslate:e.maxTranslate,minTranslate:e.minTranslate,translate:e.translate,width:e.width})}),P(E(E(e)),"onAutoScroll",function(o){e.translate.x+=o.left,e.translate.y+=o.top,e.animateNodes()}),P(E(E(e)),"handleKeyDown",function(o){var a=o.keyCode,p=e.props,d=p.shouldCancelStart,f=p.keyCodes,v=f===void 0?{}:f,m=Ee({},Mt,v);e.manager.active&&!e.manager.isKeySorting||!e.manager.active&&(!m.lift.includes(a)||d(o)||!e.isValidSortingTarget(o))||(o.stopPropagation(),o.preventDefault(),m.lift.includes(a)&&!e.manager.active?e.keyLift(o):m.drop.includes(a)&&e.manager.active?e.keyDrop(o):m.cancel.includes(a)?(e.newIndex=e.manager.active.index,e.keyDrop(o)):m.up.includes(a)?e.keyMove(-1):m.down.includes(a)&&e.keyMove(1))}),P(E(E(e)),"keyLift",function(o){var a=o.target,p=be(a,function(m){return m.sortableInfo!=null}),d=p.sortableInfo,f=d.index,v=d.collection;e.initialFocusedNode=a,e.manager.isKeySorting=!0,e.manager.active={index:f,collection:v},e.handlePress(o)}),P(E(E(e)),"keyMove",function(o){var a=e.manager.getOrderedRefs(),p=a[a.length-1].node.sortableInfo.index,d=e.newIndex+o,f=e.newIndex;if(!(d<0||d>p)){e.prevIndex=f,e.newIndex=d;var v=ji(e.newIndex,e.prevIndex,e.index),m=a.find(function(T){var S=T.node;return S.sortableInfo.index===v}),j=m.node,b=e.containerScrollDelta,w=m.boundingClientRect||Le(j,b),N=m.translate||{x:0,y:0},_={top:w.top+N.y-b.top,left:w.left+N.x-b.left},D=f<d,A={x:D&&e.axis.x?j.offsetWidth-e.width:0,y:D&&e.axis.y?j.offsetHeight-e.height:0};e.handleSortMove({pageX:_.left+A.x,pageY:_.top+A.y,ignoreTransition:o===0})}}),P(E(E(e)),"keyDrop",function(o){e.handleSortEnd(o),e.initialFocusedNode&&e.initialFocusedNode.focus()}),P(E(E(e)),"handleKeyEnd",function(o){e.manager.active&&e.keyDrop(o)}),P(E(E(e)),"isValidSortingTarget",function(o){var a=e.props.useDragHandle,p=o.target,d=be(p,function(f){return f.sortableInfo!=null});return d&&d.sortableInfo&&!d.sortableInfo.disabled&&(a?pt(p):p.sortableInfo)});var h=new bi;return Ai(l),e.manager=h,e.wrappedInstance=M.createRef(),e.sortableContextValue={manager:h},e.events={end:e.handleEnd,move:e.handleMove,start:e.handleStart},e}return Se(u,[{key:"componentDidMount",value:function(){var e=this,h=this.props.useWindowAsScrollContainer,o=this.getContainer();Promise.resolve(o).then(function(a){e.container=a,e.document=e.container.ownerDocument||document;var p=e.props.contentWindow||e.document.defaultView||window;e.contentWindow=typeof p=="function"?p():p,e.scrollContainer=h?e.document.scrollingElement||e.document.documentElement:At(e.container)||e.container,e.autoScroller=new Ti(e.scrollContainer,e.onAutoScroll),Object.keys(e.events).forEach(function(d){return le[d].forEach(function(f){return e.container.addEventListener(f,e.events[d],!1)})}),e.container.addEventListener("keydown",e.handleKeyDown)})}},{key:"componentWillUnmount",value:function(){var e=this;this.helper&&this.helper.parentNode&&this.helper.parentNode.removeChild(this.helper),this.container&&(Object.keys(this.events).forEach(function(h){return le[h].forEach(function(o){return e.container.removeEventListener(o,e.events[h])})}),this.container.removeEventListener("keydown",this.handleKeyDown))}},{key:"updateHelperPosition",value:function(e){var h=this.props,o=h.lockAxis,a=h.lockOffset,p=h.lockToContainerEdges,d=h.transitionDuration,f=h.keyboardSortingTransitionDuration,v=f===void 0?d:f,m=this.manager.isKeySorting,j=e.ignoreTransition,b=ve(e),w={x:b.x-this.initialOffset.x,y:b.y-this.initialOffset.y};if(w.y-=window.pageYOffset-this.initialWindowScroll.top,w.x-=window.pageXOffset-this.initialWindowScroll.left,this.translate=w,p){var N=Si({height:this.height,lockOffset:a,width:this.width}),_=xt(N,2),D=_[0],A=_[1],T={x:this.width/2-D.x,y:this.height/2-D.y},S={x:this.width/2-A.x,y:this.height/2-A.y};w.x=dt(this.minTranslate.x+T.x,this.maxTranslate.x-S.x,w.x),w.y=dt(this.minTranslate.y+T.y,this.maxTranslate.y-S.y,w.y)}o==="x"?w.y=0:o==="y"&&(w.x=0),m&&v&&!j&&Ae(this.helper,v),ke(this.helper,w)}},{key:"animateNodes",value:function(){var e=this.props,h=e.transitionDuration,o=e.hide
1SortableGhost,a=e.onSortOver,p=this.containerScrollDelta,d=this.windowScrollDelta,f=this.manager.getOrderedRefs(),v={left:this.offsetEdge.left+this.translate.x+p.left,top:this.offsetEdge.top+this.translate.y+p.top},m=this.manager.isKeySorting,j=this.newIndex;this.newIndex=null;for(var b=0,w=f.length;b<w;b++){var N=f[b].node,_=N.sortableInfo.index,D=N.offsetWidth,A=N.offsetHeight,T={height:this.height>A?A/2:this.height/2,width:this.width>D?D/2:this.width/2},S=m&&_>this.index&&_<=j,R=m&&_<this.index&&_>=j,C={x:0,y:0},k=f[b].edgeOffset;k||(k=Te(N,this.container),f[b].edgeOffset=k,m&&(f[b].boundingClientRect=Le(N,p)));var y=b<f.length-1&&f[b+1],x=b>0&&f[b-1];if(y&&!y.edgeOffset&&(y.edgeOffset=Te(y.node,this.container),m&&(y.boundingClientRect=Le(y.node,p))),_===this.index){o&&(this.sortableGhost=N,Ie(N,{opacity:0,visibility:"hidden"}));continue}h&&Ae(N,h),this.axis.x?this.axis.y?R||_<this.index&&(v.left+d.left-T.width<=k.left&&v.top+d.top<=k.top+T.height||v.top+d.top+T.height<=k.top)?(C.x=this.width+this.marginOffset.x,k.left+C.x>this.containerBoundingRect.width-T.width&&y&&(C.x=y.edgeOffset.left-k.left,C.y=y.edgeOffset.top-k.top),this.newIndex===null&&(this.newIndex=_)):(S||_>this.index&&(v.left+d.left+T.width>=k.left&&v.top+d.top+T.height>=k.top||v.top+d.top+T.height>=k.top+A))&&(C.x=-(this.width+this.marginOffset.x),k.left+C.x<this.containerBoundingRect.left+T.width&&x&&(C.x=x.edgeOffset.left-k.left,C.y=x.edgeOffset.top-k.top),this.newIndex=_):S||_>this.index&&v.left+d.left+T.width>=k.left?(C.x=-(this.width+this.marginOffset.x),this.newIndex=_):(R||_<this.index&&v.left+d.left<=k.left+T.width)&&(C.x=this.width+this.marginOffset.x,this.newIndex==null&&(this.newIndex=_)):this.axis.y&&(S||_>this.index&&v.top+d.top+T.height>=k.top?(C.y=-(this.height+this.marginOffset.y),this.newIndex=_):(R||_<this.index&&v.top+d.top<=k.top+T.height)&&(C.y=this.height+this.marginOffset.y,this.newIndex==null&&(this.newIndex=_))),ke(N,C),f[b].translate=C}this.newIndex==null&&(this.newIndex=this.index),m&&(this.newIndex=j);var $=m?this.prevIndex:j;a&&this.newIndex!==$&&a({collection:this.manager.active.collection,index:this.index,newIndex:this.newIndex,oldIndex:$,isKeySorting:m,nodes:f,helper:this.helper})}},{key:"getWrappedInstance",value:function(){return re(c.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableContainer() call"),this.wrappedInstance.current}},{key:"getContainer",value:function(){var e=this.props.getContainer;return typeof e!="function"?ze.findDOMNode(this):e(c.withRef?this.getWrappedInstance():void 0)}},{key:"render",value:function(){var e=c.withRef?this.wrappedInstance:null;return M.createElement(Bt.Provider,{value:this.sortableContextValue},M.createElement(t,qe({ref:e},Ot(this.props,Ei))))}},{key:"helperContainer",get:function(){var e=this.props.helperContainer;return typeof e=="function"?e():this.props.helperContainer||this.document.body}},{key:"containerScrollDelta",get:function(){var e=this.props.useWindowAsScrollContainer;return e?{left:0,top:0}:{left:this.scrollContainer.scrollLeft-this.initialScroll.left,top:this.scrollContainer.scrollTop-this.initialScroll.top}}},{key:"windowScrollDelta",get:function(){return{left:this.contentWindow.pageXOffset-this.initialWindowScroll.left,top:this.contentWindow.pageYOffset-this.initialWindowScroll.top}}}]),u}(M.Component),P(i,"displayName",tt("sortableList",t)),P(i,"defaultProps",Oi),P(i,"propTypes",Pt),r}var Ft={index:I.number.isRequired,collection:I.oneOfType([I.number,I.string]),disabled:I.bool},Pi=Object.keys(Ft);function Vt(t){var i,r,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{withRef:!1};return r=i=function(s){Ge(u,s);function u(){var l,e;je(this,u);for(var h=arguments.length,o=new Array(h),a=0;a<h;a++)o[a]=arguments[a];return e=Ke(this,(l=Ye(u)).call.apply(l,[this].concat(o))),P(E(E(e)),"wrappedInstance",M.createRef()),e}return Se(u,[{key:"componentDidMount",value:function(){this.register()}},{key:"componentDidUpdate",value:function(e){this.node&&(e.index!==this.props.index&&(this.node.sortableInfo.index=this.props.index),e.disabled!==this.props.disabled&&(this.node.sortableInfo.disabled=this.props.disabled)),e.collection!==this.props.collection&&(this.unregister(e.collection),this.register())}},{key:"componentWillUnmount",value:function(){this.unregister()}},{key:"register",value:function(){var e=this.props,h=e.collection,o=e.disabled,a=e.index,p=ze.findDOMNode(this);p.sortableInfo={collection:h,disabled:o,index:a,manager:this.context.manager},this.node=p,this.ref={node:p},this.context.manager.add(h,this.ref)}},{key:"unregister",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props.collection;this.context.manager.remove(e,this.ref)}},{key:"getWrappedInstance",value:function(){return re(c.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call"),this.wrappedInstance.current}},{key:"render",value:function(){var e=c.withRef?this.wrappedInstance:null;return M.createElement(t,qe({ref:e},Ot(this.props,Pi)))}}]),u}(M.Component),P(i,"displayName",tt("sortableElement",t)),P(i,"contextType",Bt),P(i,"propT
1ypes",Ft),P(i,"defaultProps",{collection:0}),r}const Mi="_container_cjl9m_10",Bi="_table_cjl9m_16",$i="_rowIndexCell_cjl9m_47",Fi="_helperContainerClass_cjl9m_56",Vi="_serviceContainer_cjl9m_72",Wi="_checked_cjl9m_72",Ui="_unChecked_cjl9m_76",Z={container:Mi,table:Bi,rowIndexCell:$i,helperContainerClass:Fi,serviceContainer:Vi,checked:Wi,unChecked:Ui},Hi=({dataSource:t,setDataSource:i,updating:r})=>{const c=Lt(({index:a})=>n.jsxs(g,{gap:8,align:"center",className:Z.rowIndexCell,children:[n.jsx(kt,{}),n.jsxs("p",{className:Z.rowIndex,children:[a+1,"."]})]})),s=[{title:"",key:"rowIndex",render:(a,p,d)=>n.jsx(c,{index:d}),className:Z.rowIndexCell},{title:"Courier Name",key:"courierName",render:(a,p)=>{const{attributes:{carrier:{code:d,name:f}}}=p;return n.jsx(Ze,{name:f,code:d})}},{title:"Mode",key:"mode",render:(a,p)=>{const{attributes:{carrier:{service_level:d}}}=p;return n.jsx(Je,{deliveryMode:d})}},{title:"Speed",key:"speed",render:(a,p)=>{const{attributes:{carrier:{speed:d}}}=p;return n.jsx(Be,{children:d||""})}},{title:"Cost",key:"cost",render:(a,p)=>{const{attributes:{carrier:{cost_rating:d}}}=p,f=[...Array(d||0).keys()];return n.jsx(g,{gap:4,children:f.map((v,m)=>n.jsx(St,{},m))})}},{title:"Services",key:"services",render:(a,p)=>{const{attributes:{carrier:{services:d,is_obd:f}}}=p,v=Dt(d,f);return n.jsx(g,{vertical:!0,gap:2,children:v.map((m,j)=>{const{feature:b,status:w}=m;return n.jsxs(g,{align:"center",gap:4,className:Z.serviceContainer,children:[w?n.jsx(We,{className:Z.checked}):n.jsx(Ue,{className:Z.unChecked}),n.jsx("p",{children:b})]},j)})})}}],u=({oldIndex:a,newIndex:p})=>{const d=Rt(t,a,p);i(d)},l=Vt(a=>n.jsx("tr",{...a})),e=$t(a=>n.jsx("tbody",{...a})),h=a=>n.jsx(e,{useDragHandle:!0,disableAutoscroll:!0,useWindowAsScrollContainer:!0,hideSortableGhost:!0,helperClass:Z.helperContainerClass,onSortEnd:u,...a}),o=({className:a,style:p,...d})=>{const f=t.findIndex(v=>v.id===d["data-row-key"]);return n.jsx(l,{index:f,...d})};return n.jsxs(g,{className:Z.container,vertical:!0,gap:12,children:[n.jsxs(g,{vertical:!0,children:[n.jsx(Be,{children:"Set the priority"}),n.jsx(Qt,{type:"secondary",children:"Drag and drop to set the priority of your preferred partner"})]}),n.jsx(he,{columns:s,dataSource:t,rowKey:"id",pagination:!1,className:Z.table,loading:r,components:{body:{wrapper:h,row:o}}})]})},Gi="_primeNoticeBanner_1n1f9_10",Ki="_primeNoticeIcon_1n1f9_16",Yi="_primeNoticeText_1n1f9_22",zi="_primeNoticeLabel_1n1f9_28",qi="_primeNoticeActive_1n1f9_32",xe={primeNoticeBanner:Gi,primeNoticeIcon:Ki,primeNoticeText:Yi,primeNoticeLabel:zi,primeNoticeActive:qi},Wt=()=>{const{isPrimeAccount:t}=Xe();return t?n.jsxs(g,{align:"flex-start",gap:8,className:xe.primeNoticeBanner,children:[n.jsx(It,{className:xe.primeNoticeIcon}),n.jsxs("p",{className:xe.primeNoticeText,children:[n.jsx("span",{className:xe.primeNoticeLabel,children:"Please note:"})," Velocity Prime is currently"," ",n.jsx("span",{className:xe.primeNoticeActive,children:"active"})," for this account. Any changes made here will apply only to Non-Prime orders and will be charged separately."]})]}):null},Xi="_container_12dwj_10",Zi="_header_12dwj_13",Ji="_title_12dwj_13",Qi="_description_12dwj_18",er="_saveButton_12dwj_23",tr="_primaryActionButton_12dwj_32",nr="_boldText_12dwj_43",J={container:Xi,header:Zi,title:Ji,description:Qi,saveButton:er,primaryActionButton:tr,boldText:nr},ir=()=>{var F,L,Y;const{shipfastProfile:t,isPrimeAccount:i}=Xe(),{isShipfastChildUser:r,userUuid:c}=yt(),{shippingRules:s,isLoading:u,isValidating:l,reloadShippingRules:e}=te(),{shippingRuleCarriers:h,isLoading:o}=q(),{shipfastCarriers:a,isLoading:p}=bt(),d=s.find(O=>{var B;return((B=O==null?void 0:O.attributes)==null?void 0:B.name)=="default"}),f=(F=d==null?void 0:d.attributes)==null?void 0:F.courier_selection_mode,v=(L=d==null?void 0:d.attributes)==null?void 0:L.shipping_rule_carriers,[m,j]=M.useState(Fe.includes(f||"")?"concierge":me.includes(f||"")?f||"recommended":f||""),b=h==null?void 0:h.filter(O=>{var B;return!!((B=O==null?void 0:O.attributes)!=null&&B.status)}),w=f=="custom"?v==null?void 0:v.map((O,B)=>{var W,K,H;return{attributes:{carrier:{...((W=a==null?void 0:a.find(G=>{var X;return(G==null?void 0:G.id)==((X=O==null?void 0:O.attributes)==null?void 0:X.carrier_id)}))==null?void 0:W.attributes)||{}}},priority:(K=O==null?void 0:O.attributes)==null?void 0:K.priority,defaultCarrierId:(H=O==null?void 0:O.attributes)==null?void 0:H.id,id:B+1}}):b,N=O=>{var B;return(B=O==null?void 0:O.slice())==null?void 0:B.sort((W,K)=>{var X,fe;const H=(W==null?void 0:W.priority)??((X=W==null?void 0:W.attributes)==null?void 0:X.priority),G=(K==null?void 0:K.priority)??((fe=K==null?void 0:K.attributes)==null?void 0:fe.priority);return H!==void 0&&G!==void 0?H-G:H!==void 0?-1:G!==void 0?1:0})},[_,D]=M.useState(N(w)),[A,T]=M.useState(!1),[S,R]=M.useState(!1),C=m==="custom",k=me.includes(m),y=async(O=!1)=>{var H;if(!me.includes(m)&&me.includes(f||"")&&!O){R(!0);return}const B={courier_selection_mode:m};m=="custom"&&(f=="custom"?B.shipping_rule_carriers_attributes=_==null?void 0:_.map((G,X)=>({id:G==null?void 0:G.defaultCarrierId,priority:X+1})):B.shipping_rule_carriers_attributes=_==null?void 0:_.map((G,X)=>{var fe,nt;return{carrier_id:(nt=(fe=G==null?void 0:G.attributes)==null?void 0:fe.carrier)==null?void 0:nt.id,priority:X+1}})),T(!0);const{ok:W,data:K}=await _t({ruleId:(H=d==null?void 0:d.attributes)==null?void 0:H.id,updateData:B});T(!1),W?(pe("Courier priority updated successfully"),e()):ae(se(K,"Failed to update courier priority"))};if(u||o||p)return n.jsx(Re,{});const x=Fe.includes(f||""),$=(Y=gn(i))==null?void 0:Y.filter(O=>O.key==="concierge"?x:!0);return n.jsxs(g,{className:J.container,vertical:!0,gap:24,children:[n.jsxs(g,{className:J.header,vertical:!0,children:[n.jsx("p",{className:J.title,children:"Courier Priority"}),n.jsx("p",{className:J.description,children:"Choose how your shipments are prioritized to meet delivery goals"})]}),n.jsx(Wt,{}),n.jsx(en,{gutter:[16,16],children:$.map(O=>{const B=me.includes(m)?"recommended":m;return n.jsx(bn,{xs:24,sm:12,md:8,lg:6,children:n.jsx(fn,{selectedOption:B,option:O,setSelectedOption:j,disabled:x&&O.key!=="concierge"})}
1,O.key)})}),C&&n.jsx(Hi,{dataSource:_,setDataSource:D,updating:A}),k&&n.jsx(mn,{selectedOption:m,setSelectedOption:j}),S&&n.jsx(hn,{title:"Are you sure you want to switch?",width:"s",icon:n.jsx(yn,{}),description:n.jsxs("span",{className:J.description,children:["Velocity Recommended"," ",n.jsx("span",{className:J.boldText,children:"helps brands reduce RTOs by up to 8%."})]}),cancelText:"CANCEL",confirmText:"SWITCH ANYWAY",tipText:"It's recommended to try out for at least a month to see results!",primaryActionButtonClass:J.primaryActionButton,cancelButtonClass:J.primaryActionButton,onClose:()=>{var O,B,W;R(!1),Ve("courier_priority_switch_cancelled",{email:(B=(O=t==null?void 0:t.attributes)==null?void 0:O.contact_information)==null?void 0:B.email,seller:(W=t==null?void 0:t.attributes)==null?void 0:W.name,client_id:t==null?void 0:t.id,user_uuid:c,is_child_user:r})},onConfirm:()=>{var O,B,W;y(!0),R(!1),Ve("courier_priority_switch_confirmed",{email:(B=(O=t==null?void 0:t.attributes)==null?void 0:O.contact_information)==null?void 0:B.email,seller:(W=t==null?void 0:t.attributes)==null?void 0:W.name,client_id:t==null?void 0:t.id,user_uuid:c,is_child_user:r})}}),n.jsx(g,{children:n.jsx(we,{disabled:!m||!d||A||l||x,onClick:()=>y(!1),className:J.saveButton,loading:A||l,children:"SAVE COURIER PRIORITY"})})]})},ht={},rr=()=>{const t=[{title:"Courier Name",dataIndex:"courierName",key:"courierName"},{title:"Status",dataIndex:"status",key:"status",render:i=>n.jsx("span",{style:{color:i==="Activated"?"#52C41A":"#FF4D4F"},children:i})},{title:"Updated At",dataIndex:"updatedAt",key:"updatedAt"},{title:"Username",dataIndex:"username",key:"username"}];return n.jsx("div",{className:ht.container,children:n.jsx(he,{className:ht.table,columns:t,dataSource:vn,pagination:!1})})},ar="_courierListContainer_1v2yx_10",sr="_courierItem_1v2yx_14",or="_courierLogo_1v2yx_20",lr="_courierName_1v2yx_26",Ne={courierListContainer:ar,courierItem:sr,courierLogo:or,courierName:lr},ft=({couriers:t})=>{var c;const{shippingRuleCarriers:i}=q(),r=(c=t==null?void 0:t.map(s=>i.find(u=>{var l,e,h;return((e=(l=u==null?void 0:u.attributes)==null?void 0:l.carrier)==null?void 0:e.id)==((h=s==null?void 0:s.attributes)==null?void 0:h.carrier_id)})))==null?void 0:c.filter(s=>!!(s!=null&&s.id));return n.jsx(g,{className:Ne.courierListContainer,gap:10,children:r.map(s=>{var u,l,e,h;return n.jsxs(g,{className:Ne.courierItem,vertical:!0,align:"center",children:[n.jsx(g,{className:Ne.courierLogo,align:"center",justify:"center",children:tn[(l=(u=s==null?void 0:s.attributes)==null?void 0:u.carrier)==null?void 0:l.code]}),n.jsx("p",{className:Ne.courierName,children:(h=(e=s==null?void 0:s.attributes)==null?void 0:e.carrier)==null?void 0:h.name})]},s==null?void 0:s.id)})})},cr=({ruleId:t,status:i,disabled:r=!1})=>{const{reloadShippingRules:c}=te(),[s,u]=M.useState(!1),l=async({ruleId:e,updatedStatus:h})=>{u(!0);const{ok:o,data:a}=await _t({ruleId:e,updateData:{status:h}});o?await c():(ae(se(a,"Failed to update rule status")),await c()),u(!1)};return n.jsx(De,{checked:i,checkedChildren:"On",unCheckedChildren:"Off",loading:s,disabled:r,onChange:e=>{l({ruleId:t,updatedStatus:e})}})},dr=t=>{var v,m,j,b,w,N,_,D,A,T,S,R,C,k,y,x,$,F;let i={};const r=(v=t==null?void 0:t.attributes)==null?void 0:v.journey_type,c=(m=t==null?void 0:t.attributes)==null?void 0:m.amazon_verified,s=(j=t==null?void 0:t.attributes)==null?void 0:j.payment_mode,u=(b=t==null?void 0:t.attributes)==null?void 0:b.weight,l=(w=t==null?void 0:t.attributes)==null?void 0:w.amount,e=(N=t==null?void 0:t.attributes)==null?void 0:N.zones,h=(_=t==null?void 0:t.attributes)==null?void 0:_.states,o=(D=t==null?void 0:t.attributes)==null?void 0:D.cities,a=(A=t==null?void 0:t.attributes)==null?void 0:A.pincodes,p=(T=t==null?void 0:t.attributes)==null?void 0:T.sku_ids,d=(S=t==null?void 0:t.attributes)==null?void 0:S.tags,f=(R=t==null?void 0:t.attributes)==null?void 0:R.product_categories;if(r&&(i.journey_type={label:"Journey type",value:ot(r)}),typeof c=="boolean"&&(i.amazon_verified={label:"Amazon address verified",value:c?"Yes":"No"}),s&&(i.payment_mode={label:"Payment mode",value:ot(s)}),u){let L="";u.min&&(L=`Greater than or equal to ${u.min/1e3}kg`),u.max&&(L+=L==""?`Less than or equal to ${u.max/1e3}kg`:`, Less than or equal to ${u.max/1e3}kg`),i.weight={label:"Weight",value:L}}if(l){let L="";l.min&&(L=`Greater than or equal to â¹${l.min}`),l.max&&(L+=L==""?`Less than or equal to â¹${l.max}`:`, Less than or equal to â¹${l.max}`),i.amount={label:"Order value",value:L}}return e&&(i.zones={label:"Zones",value:e==null?void 0:e.map(L=>Ct(L)).join(", ")}),h&&(i.pickup_states={label:"Pickup states",value:(C=h==null?void 0:h.pickup)==null?void 0:C.join(", ")},i.delivery_states={label:"Delivery states",value:(k=h==null?void 0:h.delivery)==null?void 0:k.join(", ")}),o&&(i.pickup_cities={label:"Pickup cities",value:(y=o==null?void 0:o.pickup)==null?void 0:y.join(", ")},i.delivery_cities={label:"Delivery cities",value:(x=o==null?void 0:o.delivery)==null?void 0:x.join(", ")}),a&&(i.pickup_pincodes={label:"Pickup pincodes",value:($=a==null?void 0:a.pickup)==null?void 0:$.join(", ")},i.delivery_pincodes={label:"Delivery pincodes",value:(F=a==null?void 0:a.delivery)==null?void 0:F.join(", ")}),Array.isArray(p)&&p.length>0&&(i.sku_ids={label:"SKU IDs",value:p.join(", ")}),Array.isArray(d)&&d.length>0&&(i.tags={label:"Tags",value:d.join(", ")}),Array.isArray(f)&&f.length>0&&(i.product_categories={label:"Product Categories",value:f.join(", ")}),i},ur="_shippingRuleCard_1mcti_11",pr="_cardHeader_1mcti_18",hr="_ruleName_1mcti_28",fr="_contentContainer_1mcti_36",mr="_sectionHeader_1mcti_40",gr="_labelValue_1mcti_51",vr="_conditionValueWrap_1mcti_60",xr="_viewMoreButton_1mcti_63",z={
1shippingRuleCard:ur,cardHeader:pr,ruleName:hr,contentContainer:fr,sectionHeader:mr,labelValue:gr,conditionValueWrap:vr,viewMoreButton:xr},mt=200,yr=new Set(["pickup_states","delivery_states","pickup_cities","delivery_cities","pickup_pincodes","delivery_pincodes","sku_ids","tags","product_categories"]),br=({conditionKey:t,value:i})=>{const[r,c]=M.useState(!1),s=yr.has(t)&&i.length>mt,u=s&&!r?i.slice(0,mt):i;return n.jsxs("span",{className:z.conditionValueWrap,children:[u,s&&!r&&"â¦",s&&n.jsx("button",{type:"button",className:z.viewMoreButton,onClick:()=>c(l=>!l),children:r?"View less":"View more"})]})},gt=({rule:t})=>{var m,j,b,w,N,_,D,A,T,S,R,C,k;const{shippingRuleCarriers:i}=q(),r=wt(),c=i==null?void 0:i.filter(y=>{var x;return(x=y==null?void 0:y.attributes)==null?void 0:x.status}),s=(b=(j=(m=t==null?void 0:t.attributes)==null?void 0:m.shipping_rule_carriers)==null?void 0:j.filter(y=>{var x;return!((x=y==null?void 0:y.attributes)!=null&&x.blacklisted)}).sort((y,x)=>{var $,F;return(($=y==null?void 0:y.attributes)==null?void 0:$.priority)-((F=x==null?void 0:x.attributes)==null?void 0:F.priority)}))==null?void 0:b.filter(y=>c==null?void 0:c.find(x=>{var $,F,L;return((F=($=x==null?void 0:x.attributes)==null?void 0:$.carrier)==null?void 0:F.id)===((L=y==null?void 0:y.attributes)==null?void 0:L.carrier_id)})),u=(_=(N=(w=t==null?void 0:t.attributes)==null?void 0:w.shipping_rule_carriers)==null?void 0:N.filter(y=>{var x;return(x=y==null?void 0:y.attributes)==null?void 0:x.blacklisted}))==null?void 0:_.filter(y=>c==null?void 0:c.find(x=>{var $,F,L;return((F=($=x==null?void 0:x.attributes)==null?void 0:$.carrier)==null?void 0:F.id)===((L=y==null?void 0:y.attributes)==null?void 0:L.carrier_id)})),l=(D=t==null?void 0:t.attributes)==null?void 0:D.courier_selection_mode,e=l==="custom"&&(s==null?void 0:s.length)>0,h=l==="custom"&&(u==null?void 0:u.length)>0,o=(A=t==null?void 0:t.attributes)==null?void 0:A.name,a=dr(t),p=Object.keys(a),d=p.length>0,f=()=>{var y;r(`add-rule?rule_id=${(y=t==null?void 0:t.attributes)==null?void 0:y.id}&mode=clone`)},v=()=>{var y;r(`add-rule?rule_id=${(y=t==null?void 0:t.attributes)==null?void 0:y.id}&mode=edit`)};return n.jsxs(g,{className:z.shippingRuleCard,vertical:!0,children:[n.jsxs(g,{justify:"space-between",align:"center",className:z.cardHeader,gap:12,children:[n.jsxs("p",{className:z.ruleName,children:["Rule Name: ",n.jsx("span",{children:o})]}),n.jsxs(g,{align:"center",gap:8,children:[n.jsx(ue,{title:"Clone Rule",color:"#FFFFFF",overlayInnerStyle:{color:"#3D3D6B"},children:n.jsx(nn,{size:"small",onClick:f,disabled:!((T=t==null?void 0:t.attributes)!=null&&T.editable),icon:n.jsx(_n,{})})}),n.jsx(ue,{title:"Edit Rule",color:"#FFFFFF",overlayInnerStyle:{color:"#3D3D6B"},children:n.jsx($e,{icon:n.jsx(Cn,{}),onClick:v,size:"small",disabled:!((S=t==null?void 0:t.attributes)!=null&&S.editable)})}),n.jsx(cr,{ruleId:(R=t==null?void 0:t.attributes)==null?void 0:R.id,status:(C=t==null?void 0:t.attributes)==null?void 0:C.status,disabled:!((k=t==null?void 0:t.attributes)!=null&&k.editable)})]})]}),n.jsxs(g,{className:z.contentContainer,vertical:!0,gap:16,justify:"space-between",children:[d&&n.jsxs(g,{vertical:!0,gap:8,children:[n.jsx(g,{className:z.sectionHeader,children:n.jsx("p",{children:"Shipment Condition"})}),n.jsx(g,{vertical:!0,gap:2,children:p.map(y=>n.jsx(g,{children:n.jsxs("p",{className:z.labelValue,children:[a[y].label,":"," ",n.jsx("span",{children:n.jsx(br,{conditionKey:y,value:a[y].value??""})})]})},y))})]}),n.jsxs(g,{vertical:!0,gap:8,children:[n.jsx(g,{className:z.sectionHeader,children:n.jsx("p",{children:"Courier Priority"})}),e?n.jsx(ft,{couriers:s}):n.jsxs("p",{children:[Ct(l)," first"]})]}),h&&n.jsxs(g,{vertical:!0,gap:8,children:[n.jsx(g,{className:z.sectionHeader,children:n.jsx("p",{children:"Restricted Couriers"})}),n.jsx(ft,{couriers:u})]})]})]})},_r="_table_1w8gl_10",Cr="_rowIndexCell_1w8gl_44",wr="_lockedRowIndexCell_1w8gl_53",jr="_helperContainerClass_1w8gl_59",ee={table:_r,rowIndexCell:Cr,lockedRowIndexCell:wr,helperContainerClass:jr},Ut=t=>!!t.attributes.editable,Ht=t=>t.filter(i=>!Ut(i)),Gt=t=>t.filter(i=>Ut(i)),Sr=t=>[...Ht(t),...Gt(t)],Ir=()=>[{title:"Priority",key:"rowIndex",render:(t,i,r)=>n.jsx(g,{gap:8,align:"center",className:ee.lockedRowIndexCell,children:n.jsxs("p",{className:ee.rowIndex,children:[r+1,"."]})}),className:ee.rowIndexCell},{title:"Rule Name",key:"ruleName",render:(t,i)=>{var r;return(r=i==null?void 0:i.attributes)==null?void 0:r.name}},{title:"Date",key:"creationDate",render:(t,i)=>{var r;return n.jsx("p",{children:Ce((r=i==null?void 0:i.attributes)==null?void 0:r.created_at).format("DD MMM, YYYY")})}}],kr=({lockedRulesCount:t,draggableRules:i,DragHandle:r})=>[{title:"Priority",key:"rowIndex",render:(c,s)=>{const u=i.findIndex(l=>l.id===s.id);return n.jsx(r,{index:u})},className:ee.rowIndexCell},{title:"Rule Name",key:"ruleName",render:(c,s)=>{var u;return(u=s==null?void 0:s.attributes)==null?void 0:u.name}},{title:"Date",key:"creationDate",render:(c,s)=>{var u;return n.jsx("p",{children:Ce((u=s==null?void 0:s.attributes)==null?void 0:u.created_at).format("DD MMM, YYYY")})}}],Nr=({rules:t})=>t.length?n.jsx(he,{columns:Ir(),dataSource:t,rowKey:"id",pagination:!1,className:ee.table,showHeader:!0}):null,Tr=({rules:t,lockedRulesCount:i,onReorder:r})=>{if(!t.length)return null;const c=Lt(({index:a})=>n.jsxs(g,{gap:8,align:"center",className:ee.rowIndexCell,children:[n.jsx(kt,{}),n.jsxs("p",{className:ee.rowIndex,children:[i+a+1,"."]})]})),s=kr({lockedRulesCount:i,draggableRules:t,DragHandle:c}),u=({oldIndex:a,newIndex:p})=>{r(Rt(t,a,p))},l=Vt(a=>n.jsx("tr",{...a}
1)),e=$t(a=>n.jsx("tbody",{...a})),h=a=>n.jsx(e,{useDragHandle:!0,disableAutoscroll:!0,useWindowAsScrollContainer:!0,hideSortableGhost:!0,helperClass:ee.helperContainerClass,onSortEnd:u,...a}),o=({className:a,style:p,...d})=>{const f=d["data-row-key"],v=t.findIndex(m=>m.id===f);return n.jsx(l,{index:v,...d})};return n.jsx(he,{columns:s,dataSource:t,rowKey:"id",pagination:!1,className:ee.table,showHeader:i===0,components:{body:{wrapper:h,row:o}}})},Dr=({dataSource:t,setDataSource:i})=>{const r=Ht(t),c=Gt(t),s=u=>{i([...r,...u])};return n.jsxs(g,{vertical:!0,gap:16,children:[n.jsx(Nr,{rules:r}),n.jsx(Tr,{rules:c,lockedRulesCount:r.length,onReorder:s})]})},Rr="_header_eo6xs_23",Or="_title_eo6xs_23",Er="_description_eo6xs_28",Ar="_tableContainer_eo6xs_33",Lr="_cancelButton_eo6xs_38",ye={header:Rr,title:Or,description:Er,tableContainer:Ar,cancelButton:Lr},Pr=({onClose:t})=>{const[i,r]=M.useState(!1),{shippingRules:c,reloadShippingRules:s}=te(),u=c==null?void 0:c.filter(d=>d.attributes.name!="default"),l=Sr(u.sort((d,f)=>f.attributes.priority-d.attributes.priority)),[e,h]=M.useState(l),o=e==null?void 0:e.length,a=()=>{t()},p=async()=>{r(!0);const{ok:d,data:f}=await jt({updatedRules:e.map((v,m)=>({id:v==null?void 0:v.id,priority:o-m}))});d?(pe("Priority updated successfully"),await s(),t()):ae(se(f,"Failed to update rule priority")),r(!1)};return n.jsx(Qe,{open:!0,onClose:t,header:n.jsx(et,{headerTitle:"Courier Rule Priority",onClose:t}),footer:n.jsxs(g,{justify:"flex-end",gap:10,children:[n.jsx(_e,{size:"small",type:"link",className:ye.cancelButton,onClick:a,children:"CANCEL"}),n.jsx(we,{size:"small",onClick:p,loading:i,children:"SAVE"})]}),children:n.jsxs(g,{vertical:!0,gap:20,children:[n.jsxs(g,{vertical:!0,className:ye.header,children:[n.jsx("p",{className:ye.title,children:"Set the priority"}),n.jsx("p",{className:ye.description,children:"Drag to set the priority of your preferred rule"})]}),n.jsx(g,{vertical:!0,gap:16,className:ye.tableContainer,children:n.jsx(Dr,{dataSource:e,setDataSource:h})})]})})},Mr="_table_1r4vs_10",Br="_rowIndexCell_1r4vs_48",Pe={table:Mr,rowIndexCell:Br},$r=({currentSelected:t,setCurrentSelected:i})=>{const{shippingRules:r}=te(),s=r==null?void 0:r.filter(l=>l.attributes.name!="default"),u=[{title:"Sr. No.",key:"rowIndex",render:(l,e,h)=>n.jsxs("p",{className:Pe.rowIndex,children:[h+1,"."]}),className:Pe.rowIndexCell},{title:"Rule Name",key:"ruleName",render:(l,e)=>{var h;return(h=e==null?void 0:e.attributes)==null?void 0:h.name}},{title:"Date",key:"creationDate",render:(l,e)=>{var h;return n.jsx("p",{children:Ce((h=e==null?void 0:e.attributes)==null?void 0:h.created_at).format("DD MMM, YYYY")})}}];return n.jsx(he,{columns:u,dataSource:s,rowKey:"id",pagination:!1,className:Pe.table,rowSelection:{type:"checkbox",selectedRowKeys:t,onChange:(l,e)=>{i(e.map(h=>h.id))}}})},Fr="_tableContainer_1yyjb_10",Vr="_header_1yyjb_15",Wr="_title_1yyjb_15",Ur="_description_1yyjb_20",Hr="_cancelButton_1yyjb_25",ce={tableContainer:Fr,header:Vr,title:Wr,description:Ur,cancelButton:Hr},Gr=({onClose:t})=>{const{reloadShippingRules:i}=te(),[r,c]=M.useState([]),[s,u]=M.useState(!1),l=r.length===0,e=()=>{c([]),t()},h=async()=>{u(!0);const{ok:o,data:a}=await jt({updatedRules:r.map(p=>({id:p,_destroy:!0}))});o?(pe(`${He("Rule",r.length)} archived successfully`),await i(),t()):ae(se(a,"Failed to archive courier rules")),u(!1)};return n.jsx(Qe,{open:!0,onClose:t,header:n.jsx(et,{headerTitle:"Courier Rule Archive",onClose:t}),footer:n.jsxs(g,{justify:"flex-end",gap:10,children:[n.jsx(_e,{size:"small",type:"link",className:ce.cancelButton,onClick:e,children:"CANCEL"}),n.jsx(we,{size:"small",onClick:h,disabled:l||s,className:ce.saveButton,loading:s,children:"SAVE"})]}),children:n.jsx(g,{vertical:!0,gap:20,children:n.jsxs(g,{vertical:!0,gap:16,className:ce.tableContainer,children:[n.jsxs(g,{vertical:!0,className:ce.header,children:[n.jsx("p",{className:ce.title,children:"Archive Rule"}),n.jsx("p",{className:ce.description,children:"Select rule(s) to archive"})]}),n.jsx($r,{currentSelected:r,setCurrentSelected:c})]})})})},Kr="_container_1v6fe_10",Yr="_header_1v6fe_13",zr="_rulesCount_1v6fe_16",qr="_archiveRuleButton_1v6fe_24",Xr="_setPriorityButton_1v6fe_33",Zr="_addRuleButton_1v6fe_41",Jr="_listContainer_1v6fe_48",Qr="_masonryColumn_1v6fe_54",Q={container:Kr,header:Yr,rulesCount:zr,archiveRuleButton:qr,setPriorityButton:Xr,addRuleButton:Zr,listContainer:Jr,masonryColumn:Qr},ea=()=>{var f;const t=wt(),{shippingRules:i,isLoading:r}=te(),{isLoading:c}=q(),[s,u]=M.useState(!1),[l,e]=M.useState(!1),h=(f=i==null?void 0:i.filter(v=>v.attributes.name!="default"))==null?void 0:f.sort((v,m)=>m.attributes.priority-v.attributes.priority),o=()=>{t("/shipping/rules/add-rule")},a=v=>
1{if(!v)return{leftColumnRules:[],rightColumnRules:[]};const m=[[],[]],j=[0,0];return v.forEach(b=>{const w=j[0]<=j[1]?0:1;m[w].push(b),j[w]+=1}),{leftColumnRules:m[0],rightColumnRules:m[1]}},{leftColumnRules:p,rightColumnRules:d}=a(h);return r||c?n.jsx(Re,{}):n.jsxs("div",{className:Q.container,children:[n.jsxs(g,{justify:"space-between",align:"center",className:Q.header,children:[n.jsxs("p",{className:Q.rulesCount,children:[h==null?void 0:h.length," ",He("rule",h==null?void 0:h.length)]}),n.jsx(g,{align:"center",gap:20,children:n.jsxs(g,{align:"center",gap:10,children:[n.jsx($e,{size:"small",className:Q.archiveRuleButton,onClick:()=>e(!0),children:"Archive Rule"}),n.jsx($e,{size:"small",className:Q.setPriorityButton,onClick:()=>u(!0),children:"Set Courier Rule Priority"}),n.jsx(we,{size:"small",className:Q.addRuleButton,onClick:o,children:"Add Rule"})]})})]}),n.jsx(Wt,{}),n.jsxs("div",{className:Q.listContainer,children:[n.jsx("div",{className:Q.masonryColumn,children:p==null?void 0:p.map(v=>n.jsx(gt,{rule:v},v.id))}),n.jsx("div",{className:Q.masonryColumn,children:d==null?void 0:d.map(v=>n.jsx(gt,{rule:v},v.id))})]}),s&&n.jsx(Pr,{onClose:()=>u(!1)}),l&&n.jsx(Gr,{onClose:()=>e(!1)})]})},ta="_container_5adkt_10",Me={container:ta},ws=async({request:t})=>{const i=new URL(t.url);return i.searchParams.get("current_tab")==null?(i.searchParams.set("current_tab","courier_selection"),rn(i.toString())):null},js=()=>{var j;const{query:t,setSearchParams:i}=vt(),r=t.current_tab,{isLoading:c}=te(),{isLoading:s}=q(),{isLoading:u}=bt(),{shippingRules:l,isLoading:e}=te(),{shipfastProfile:h}=Xe(),{isShipfastChildUser:o,userUuid:a}=yt(),p=b=>{Ve(`shipfast_rules_${b}_tab_clicked`,{client_id:h==null?void 0:h.id,is_ghost:an(),user_uuid:a,is_child_user:o}),i({current_tab:b})},d={courier_selection:n.jsx(vi,{}),courier_priority:n.jsx(ir,{}),courier_rules:n.jsx(ea,{}),activity_log:n.jsx(rr,{})};if(c||s||u||e)return n.jsx(Re,{});const f=l.find(b=>{var w;return((w=b==null?void 0:b.attributes)==null?void 0:w.name)=="default"}),v=(j=f==null?void 0:f.attributes)==null?void 0:j.courier_selection_mode,m=Fe.includes(v||"");return n.jsxs(g,{vertical:!0,className:Me.container,children:[n.jsx(jn,{guideKey:wn.courier_rules,page:"rules"}),n.jsx(Sn,{activeKey:r,onChange:p,className:Me.tab,items:xn.map(({key:b,label:w,icon:N})=>({key:b,label:n.jsxs(g,{gap:8,className:Me.tabTitle,children:[N,n.jsx("p",{children:w})]}),disabled:m&&b==="courier_rules"}))}),d[r]||n.jsx(sn,{})]})};export{js as Component,ws as loader};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.