@zeniai/web-components 4.1.57-betaNB4 → 4.1.57-betaNB5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3619,7 +3619,7 @@ Initiate your first transfer to start earning yield.`,insuredFundsTooltip:"Secur
3619
3619
  padding: 0;
3620
3620
  padding-right: ${o.sp0};
3621
3621
  justify-content: flex-start;
3622
- `,XB=e=>{const{payload:n}=e;return t.jsxRuntimeExports.jsx(Xxt,{children:n.map((i,r)=>t.jsxRuntimeExports.jsxs(eht,{children:[t.jsxRuntimeExports.jsx(tht,{color:i.color}),t.jsxRuntimeExports.jsx(oht,{children:i.value})]},`item-${r}`))})},lht={minChartWidth:300,widthPerDataPoint:60,maxLabelWidthPerDataPoint:180},PN=23,cht=25,BT=cht*2+PN,dht={minChartWidth:240,widthPerDataPoint:BT,maxLabelWidthPerDataPoint:120},uht={minChartWidth:280,widthPerDataPoint:44,maxLabelWidthPerDataPoint:120},pht=BT,N6e=18,H6e=p[3],WZ=36,VZ=6,mht=12,xht=480,W6e=6,QZ=0,hht=p[9],ght=10,fht=52,yht=6,jht=60,Cht=p[2],bht=60,wht=p[2],Eht=64,$ht=p[2],Rht=p[10],eP=35,vht=p[2],Sht={top:0,right:0,bottom:0,left:0},x5={top:0,right:0,bottom:0,left:0},Aht={left:p[1],right:p[1]},kht=e=>e==="bar_chart"||e==="line_chart",Iht=2,Tht=Number.parseFloat(o.sp5.replace("px",""))*2,V6e=Iht+Tht,Lht=(e,n,i)=>{const r=typeof e=="string"||typeof e=="number"?String(e).length:0;return Math.min(i,Math.max(n,r*W6e))},UZ=(e,n,i,r,a,l,c)=>{const d=e.reduce((u,m)=>{const x=n.reduce((h,f)=>{const y=m[f];if(typeof y!="number")return h;const C=bb(y,i,r,a);return Math.max(h,C.length)},0);return Math.max(u,x)},0);return Math.max(l,Math.min(c,d*vht))},Bht=({baseCategoryWidth:e,minChartWidth:n,seriesWidth:i,widthBuffer:r,dataPointsCount:a,seriesCount:l,widestLabelWidthPerDataPoint:c,yAxisWidth:d,chartType:u,barPerCategoryWidthOverride:m})=>{const x=u==="bar_chart"?Math.max(0,l-1)*i:l*i,h=u==="bar_chart"?m??e+x:Math.max(c,e+x),f=u==="bar_chart"||u==="line_chart"?x5.left+x5.right:r;return Math.max(n,a*h+d+f)};function Pht({dataPointsCount:e,longestXLabelCharacterCount:n,scrollHostClientWidth:i,seriesCount:r,yAxisWidth:a}){const l=Math.max(0,r-1)*N6e,c=BT+l,d=Math.min(xht,Math.max(c,n*W6e));if(i==null||e===0)return Math.max(c,d);const u=Math.max(0,i-V6e),m=a+H6e+x5.left+x5.right,h=Math.max(0,u-m)/e;return Math.max(c,Math.min(d,Math.max(c,h)))}function Mht(e,n,i){if(n<=0)return 1;const r=e-x5.left-x5.right-i;return Math.max(1,r/n)}function Dht({barCategorySlotWidth:e,chartCanvasWidth:n,dataPointsCount:i,yAxisWidth:r}){const a=Mht(n,i,r),l=p[1]*2;return Math.max(1,Math.floor(Math.min(e,a-l)))}const _ht=({type:e,data:n,summarizedTitle:i,style:r})=>{const a=t.useTheme(),l=g.useRef(null),c=g.useRef(null),[d,u]=g.useState(null),[,m]=al(),{isCopied:x,setIsCopied:h}=lQ();g.useLayoutEffect(()=>{const ce=c.current;if(ce==null)return;const de=()=>{u(ce.clientWidth)};if(de(),typeof ResizeObserver>"u")return;const ue=new ResizeObserver(de);return ue.observe(ce),()=>{ue.disconnect()}},[e,i,n]);const{currency:{currencySymbol:f},texts:y}=O.getLocalizedStrings().common,{copied:C,copy:b,download:E}=y,$=[a.colors.graphColor27,a.colors.graphColor09,a.colors.graphColor17,a.colors.graphColor36,a.colors.graphColor12,a.colors.graphColor10,a.colors.graphColor33,a.colors.graphColor35];if(!Array.isArray(n.values)||n.values.length===0||e==="line_chart"&&n.lines?.length===0)return null;const R=n.x,S=n.y;if(!Array.isArray(S)||S.length===0)return null;const k=a.palette?.success?.main??v.success,T=e==="bar_chart"?S.length<=1?S.map(()=>k):S.map((ce,de)=>$[de%$.length]):$,A=Array.isArray(n.lines)?n.lines:S.length>0?S:[],I=n.yFormat,B=I==null?"currency":I?.type,L=I?.unit,P=I?.symbol??f,D=kht(e),{minChartWidth:M,widthPerDataPoint:F,maxLabelWidthPerDataPoint:V}=e==="bar_chart"?dht:e==="line_chart"?uht:lht,N=n.values.length,H=n.values.reduce((ce,de)=>{const ue=de[R],le=Lht(ue,F,V);return Math.max(ce,le)},F),W=n.values.reduce((ce,de)=>{const ue=de[R],le=ue==null?"":typeof ue=="string"||typeof ue=="number"?String(ue):"";return Math.max(ce,le.length)},0),U=e==="bar_chart"?UZ(n.values,S,P,B,L,wht,Eht):e==="line_chart"?UZ(n.values,[...S,...A],P,B,L,$ht,Rht):bht,Y=e==="bar_chart"?Pht({dataPointsCount:N,longestXLabelCharacterCount:W,scrollHostClientWidth:d,seriesCount:S.length,yAxisWidth:U}):null,q=Math.max(M,N*H),Z=Bht({baseCategoryWidth:e==="line_chart"?WZ:pht,dataPointsCount:N,minChartWidth:M,seriesWidth:e==="line_chart"?VZ:N6e,seriesCount:e==="line_chart"?Math.max(S.length,A.length):S.length,widestLabelWidthPerDataPoint:H,widthBuffer:e==="line_chart"?mht:H6e,yAxisWidth:U,chartType:e,barPerCategoryWidthOverride:e==="bar_chart"&&Y!=null?Y:void 0}),G=D?Z:e==="pie_chart"?Uxt:q,K=d!=null?Math.max(G,Math.max(0,d-V6e)):G,J=D?e==="bar_chart"?Y!=null?Dht({barCategorySlotWidth:Y,chartCanvasWidth:K,dataPointsCount:N,yAxisWidth:U}):BT:Math.max(1,Math.floor(Math.max(H,WZ+Math.max(S.length,A.length)*VZ))):1,oe=e==="bar_chart"?fht:e==="line_chart"?jht:hht,ee=e==="bar_chart"?yht:e==="line_chart"?Cht:ght,te=ce=>{const{payload:de,x:ue,y:le}=ce,ae=String(de.value??""),ge=J,ye=-ge/2;return t.jsxRuntimeExports.jsx("g",{transform:`translate(${ue},${le})`,children:t.jsxRuntimeExports.jsx("foreignObject",{x:ye,y:0,width:ge,height:F6e,children:t.jsxRuntimeExports.jsx(Gxt,{title:ae,children:ae})})})};let se=null;const ie=e==="bar_chart"?{maxBarSize:PN,barCategoryGap:0,barGap:0}:null,re=e==="bar_chart"||e==="line_chart"?x5:Sht,ne=ce=>{const{x:de,y:ue,payload:le,index:ae,tickFormatter:ge}=ce,ye=ge!=null?ge(le.value,ae):String(le.value),he=de-U+p[2];return t.jsxRuntimeExports.jsx("text",{x:he,y:ue,textAnchor:"start",dominantBaseline:"central",fill:a.colors.hero,style:{...z.extraSmallSemiBold.cssObject,lineHeight:`${eP}px`},children:ye})};switch(e){case"bar_chart":{if(ie==null){se=null;break}const{barCategoryGap:ce,barGap:de,maxBarSize:ue}=ie;se=t.jsxRuntimeExports.jsxs(st.BarChart,{data:n.values,barCategoryGap:ce,barGap:de,maxBarSize:ue,margin:re,children:[t.jsxRuntimeExports.jsx(st.CartesianGrid,{horizontal:!0,vertical:!1,stroke:a.colors.grey2,strokeWidth:1}),t.jsxRuntimeExports.jsx(st.XAxis,{dataKey:R,type:"category",axisLine:{stroke:a.colors.grey3,strokeWidth:.5},tickLine:!1,interval:QZ,angle:0,textAnchor:"middle",height:oe,tickMargin:ee,padding:{left:0,right:0},tick:te}),t.jsxRuntimeExports.jsx(st.YAxis,{type:"number",width:U,axisLine:!1,tickLine:!1,tick:ne,tickFormatter:le=>bb(le,P,B,L)}),t.jsxRuntimeExports.jsx(st.Tooltip,{offset:0,shared:!1,wrapperStyle:{zIndex:2},cursor:!1,content:({payload:le,active:ae,coordinate:ge})=>t.jsxRuntimeExports.jsx(KB,{active:ae,coordinate:ge,payload:le,xKey:R,currencySymbol:P,chartType:e,yFormatType:B,yFormatUnit:L}),allowEscapeViewBox:{x:!1,y:!0}}),S.map((le,ae)=>t.jsxRuntimeExports.jsx(st.Bar,{dataKey:le,fill:T[ae%T.length],maxBarSize:PN},le)),t.jsxRuntimeExports.jsx(st.Legend,{iconType:"square",verticalAlign:"bottom",wrapperStyle:{width:"100%",display:"flex",justifyContent:"center",left:"initial",bottom:o.sp0,color:a.colors.hero,...z.extraSmallSemiBold.cssObject,margin:0,padding:0},formatter:le=>t.jsxRuntimeExports.jsx(JB,{children:le}),content:le=>t.jsxRuntimeExports.jsx(XB,{...le,themeContext:a})})]});break}case"pie_chart":se=t.jsxRuntimeExports.jsxs(nht,{data:n.values,children:[t.jsxRuntimeExports.jsx(st.Pie,{data:n.values,dataKey:S[0],nameKey:R,cx:"50%",cy:"50%",outerRadius:z6e,label:ce=>t.jsxRuntimeExports.jsx("text",{x:ce.x,y:ce.y,textAnchor:ce.textAnchor,fill:a.colors.hero,style:z.extraSmallSemiBold.cssObject,children:bb(ce.value,P,B,L)}),children:n.values.map((ce,de)=>t.jsxRuntimeExports.jsx(st.Cell,{fill:$[de%$.length]},de))}),t.jsxRuntimeExports.jsx(st.Tooltip,{offset:0,wrapperStyle:{zIndex:2},content:({payload:ce,active:de,coordinate:ue})=>t.jsxRuntimeExports.jsx(KB,{active:de,coordinate:ue,payload:ce,xKey:R,currencySymbol:P,chartType:e,yFormatType:B,yFormatUnit:L}),allowEscapeViewBox:{x:!1,y:!0}}),t.jsxRuntimeExports.jsx(st.Legend,{iconType:"square",verticalAlign:"bottom",wrapperStyle:{width:"100%",display:"flex",justifyContent:"center",left:"initial",bottom:o.sp0,color:a.colors.hero,...z.extraSmallSemiBold.cssObject,margin:0,padding:0},formatter:ce=>t.jsxRuntimeExports.jsx(JB,{children:ce}),content:ce=>t.jsxRuntimeExports.jsx(XB,{...ce,themeContext:a})})]});break;case"line_chart":se=t.jsxRuntimeExports.jsxs(st.LineChart,{data:n.values,margin:re,children:[t.jsxRuntimeExports.jsx(st.CartesianGrid,{horizontal:!0,vertical:!0,stroke:a.colors.grey2,strokeWidth:1}),t.jsxRuntimeExports.jsx(st.XAxis,{dataKey:R,type:"category",axisLine:{stroke:a.colors.grey3,strokeWidth:.5},tickLine:!1,interval:QZ,angle:0,textAnchor:"middle",height:oe,tickMargin:ee,padding:Aht,tick:te}),t.jsxRuntimeExports.jsx(st.YAxis,{type:"number",width:U,axisLine:!1,tickLine:!1,tick:{color:a.colors.hero,...z.extraSmallSemiBold.cssObject,style:{lineHeight:`${eP}px`,height:`${eP}px`}},tickFormatter:ce=>bb(ce,P,B,L)}),t.jsxRuntimeExports.jsx(st.Tooltip,{offset:0,wrapperStyle:{zIndex:2},cursor:{stroke:a.colors.background,strokeDasharray:"1, 1",strokeWidth:1,fill:a.colors.background},content:({payload:ce,active:de,coordinate:ue})=>t.jsxRuntimeExports.jsx(KB,{active:de,coordinate:ue,payload:ce,xKey:R,currencySymbol:P,chartType:e,yFormatType:B,yFormatUnit:L}),allowEscapeViewBox:{x:!1,y:!0}}),A.map((ce,de)=>t.jsxRuntimeExports.jsx(st.Line,{type:"monotone",dataKey:ce,stroke:$[de%$.length],strokeWidth:2,dot:!0,activeDot:{r:6}},ce)),t.jsxRuntimeExports.jsx(st.Legend,{iconType:"square",verticalAlign:"bottom",wrapperStyle:{width:"100%",display:"flex",justifyContent:"center",left:"initial",bottom:o.sp0,color:a.colors.hero,...z.extraSmallSemiBold.cssObject,margin:0,padding:0},formatter:ce=>t.jsxRuntimeExports.jsx(JB,{children:ce}),content:ce=>t.jsxRuntimeExports.jsx(XB,{...ce,themeContext:a})})]});break;default:se=null}if(!se)return null;const me=O6e,pe=async()=>{try{const ce=L6e(e,n);await m(ce)&&h(!0)}catch(ce){console.error("Failed to copy chart data:",ce)}},je=()=>{l.current&&setTimeout(()=>{try{const ce=l.current?.querySelector("svg");if(!ce){console.error("Error: Could not find SVG element");return}const de=T6e(i,"png",e),ue=ce.cloneNode(!0);Wxt(ue,a.colors.hero);let le,ae;if(D)le=K,ae=me;else{const _e=ue.getAttribute("width"),Te=ue.getAttribute("height"),Re=ue.getAttribute("viewBox");if(_e!=null&&Te!=null&&_e.trim()!==""&&Te.trim()!=="")le=parseFloat(_e),ae=parseFloat(Te);else if(Re!=null&&Re.trim()!==""){const[,,ke,Oe]=Re.split(/\s+|,/);le=parseFloat(ke),ae=parseFloat(Oe)}else{const ke=ue.getBoundingClientRect();le=ke.width,ae=ke.height}(!Number.isFinite(le)||le<=0)&&(le=K),(!Number.isFinite(ae)||ae<=0)&&(ae=me)}const ge=Qxt(e,n,R,S,A,e==="bar_chart"?T:$),ye=FZ(ge,le,Rp);if(D){zxt(ue);const _e=Hxt(ue)??{width:K,height:me},Te=_e.width,Re=_e.height,Me=FZ(ge,Te,Rp)+p[1],Ie=Te,Ne=Re+Rp.VERTICAL_OFFSET+Me,Pe=document.createElementNS("http://www.w3.org/2000/svg","svg");Pe.setAttribute("xmlns","http://www.w3.org/2000/svg"),Pe.setAttribute("width",Ie.toString()),Pe.setAttribute("height",Me.toString()),Pe.setAttribute("viewBox",`0 0 ${Ie} ${Me}`),NZ(Pe,-Rp.VERTICAL_OFFSET,Ie,ge,a);const Ue=new XMLSerializer().serializeToString(ue),Je=new XMLSerializer().serializeToString(Pe),tt=new Blob([Ue],{type:"image/svg+xml;charset=utf-8"}),Qe=new Blob([Je],{type:"image/svg+xml;charset=utf-8"}),dt=URL.createObjectURL(tt),ct=URL.createObjectURL(Qe),yt=document.createElement("canvas"),He=yt.getContext("2d");yt.width=Ie,yt.height=Ne;const jt=new Image,St=new Image;jt.onload=()=>{He&&(HZ(He,yt.width,yt.height),He.drawImage(jt,0,0,Te,Re)),St.onload=()=>{He?(He.drawImage(St,0,Re+Rp.VERTICAL_OFFSET,Ie,Me),yt.toBlob(We=>{URL.revokeObjectURL(dt),URL.revokeObjectURL(ct),We?t.fileDownload(We,de):console.error("Error exporting chart to PNG: blob is null")})):(URL.revokeObjectURL(dt),URL.revokeObjectURL(ct))},St.onerror=()=>{URL.revokeObjectURL(dt),URL.revokeObjectURL(ct),console.error("Error loading legend SVG for PNG conversion")},St.src=ct},jt.onerror=()=>{URL.revokeObjectURL(dt),URL.revokeObjectURL(ct),console.error("Error loading chart SVG for PNG conversion")},jt.src=dt;return}const he=ae+ye,Ce=le,we=document.createElementNS("http://www.w3.org/2000/svg","svg");we.setAttribute("width",Ce.toString()),we.setAttribute("height",he.toString()),we.setAttribute("viewBox",`0 0 ${Ce} ${he}`),ue.setAttribute("x","0"),ue.setAttribute("y","0"),ue.setAttribute("width",le.toString()),ue.setAttribute("height",ae.toString()),we.appendChild(ue),NZ(we,ae,Ce,ge,a);const ve=new XMLSerializer().serializeToString(we),Ee=document.createElement("canvas"),Se=Ee.getContext("2d"),$e=new Image;Ee.width=Ce,Ee.height=he;const Be=new Blob([ve],{type:"image/svg+xml;charset=utf-8"}),Ae=URL.createObjectURL(Be);$e.onload=()=>{Se?(HZ(Se,Ee.width,Ee.height),Se.drawImage($e,0,0,Ce,he),Ee.toBlob(_e=>{URL.revokeObjectURL(Ae),_e?t.fileDownload(_e,de):console.error("Error exporting chart to PNG: blob is null")})):URL.revokeObjectURL(Ae)},$e.onerror=()=>{URL.revokeObjectURL(Ae),console.error("Error loading SVG for PNG conversion")},$e.src=Ae}catch(ce){console.error("Error exporting chart:",ce)}},100)};return t.jsxRuntimeExports.jsxs(Yxt,{style:r,children:[t.jsxRuntimeExports.jsx(qxt,{ref:c,"aria-hidden":!0}),t.jsxRuntimeExports.jsxs(Zxt,{children:[t.jsxRuntimeExports.jsx(Kxt,{children:t.jsxRuntimeExports.jsx(A6e,{children:t.jsxRuntimeExports.jsx(Jxt,{alignStart:D,minHeight:me,children:t.jsxRuntimeExports.jsx(sht,{ref:l,children:t.jsxRuntimeExports.jsx(iht,{chartWidth:K,chartHeight:me,children:t.jsxRuntimeExports.jsx(st.ResponsiveContainer,{width:"100%",height:"100%",children:se})})})})})}),t.jsxRuntimeExports.jsx(rht,{children:t.jsxRuntimeExports.jsxs(aht,{children:[t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:E,arrow:!0,enterDelay:Jr,disableIntersectionObserver:!0,children:t.jsxRuntimeExports.jsx(vS,{"aria-label":E,onClick:je,onKeyDown:ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),je())},role:"button",tabIndex:0,children:t.jsxRuntimeExports.jsx(P6e,{"aria-hidden":!0})})}),t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:x?C:b,arrow:!0,enterDelay:Jr,disableIntersectionObserver:!0,children:t.jsxRuntimeExports.jsx(vS,{"aria-label":x?C:b,onClick:()=>{pe()},onKeyDown:ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),pe())},role:"button",tabIndex:0,children:x?t.jsxRuntimeExports.jsx(D6e,{"aria-hidden":!0}):t.jsxRuntimeExports.jsx(M6e,{"aria-hidden":!0})})})]})})]})]})},Q6e=o.sp6,Oht=s.div`
3622
+ `,XB=e=>{const{payload:n}=e;return t.jsxRuntimeExports.jsx(Xxt,{children:n.map((i,r)=>t.jsxRuntimeExports.jsxs(eht,{children:[t.jsxRuntimeExports.jsx(tht,{color:i.color}),t.jsxRuntimeExports.jsx(oht,{children:i.value})]},`item-${r}`))})},lht={minChartWidth:300,widthPerDataPoint:60,maxLabelWidthPerDataPoint:180},PN=23,cht=25,BT=cht*2+PN,dht={minChartWidth:240,widthPerDataPoint:BT,maxLabelWidthPerDataPoint:120},uht={minChartWidth:280,widthPerDataPoint:44,maxLabelWidthPerDataPoint:120},pht=BT,N6e=18,H6e=p[3],WZ=36,VZ=6,mht=12,xht=480,W6e=6,QZ=0,hht=p[9],ght=10,fht=52,yht=6,jht=60,Cht=p[2],bht=60,wht=p[2],Eht=64,$ht=p[2],Rht=p[10],eP=35,vht=p[2],Sht={top:0,right:0,bottom:0,left:0},x5={top:0,right:0,bottom:0,left:0},Aht={left:p[1],right:p[1]},kht=e=>e==="bar_chart"||e==="line_chart",Iht=2,Tht=Number.parseFloat(o.sp5.replace("px",""))*2,V6e=Iht+Tht,Lht=(e,n,i)=>{const r=typeof e=="string"||typeof e=="number"?String(e).length:0;return Math.min(i,Math.max(n,r*W6e))},UZ=(e,n,i,r,a,l,c)=>{const d=e.reduce((u,m)=>{const x=n.reduce((h,f)=>{const y=m[f];if(typeof y!="number")return h;const C=bb(y,i,r,a);return Math.max(h,C.length)},0);return Math.max(u,x)},0);return Math.max(l,Math.min(c,d*vht))},Bht=({baseCategoryWidth:e,minChartWidth:n,seriesWidth:i,widthBuffer:r,dataPointsCount:a,seriesCount:l,widestLabelWidthPerDataPoint:c,yAxisWidth:d,chartType:u,barPerCategoryWidthOverride:m})=>{const x=u==="bar_chart"?Math.max(0,l-1)*i:l*i,h=u==="bar_chart"?m??e+x:Math.max(c,e+x),f=u==="bar_chart"||u==="line_chart"?x5.left+x5.right:r;return Math.max(n,a*h+d+f)};function Pht({dataPointsCount:e,longestXLabelCharacterCount:n,scrollHostClientWidth:i,seriesCount:r,yAxisWidth:a}){const l=Math.max(0,r-1)*N6e,c=BT+l,d=Math.min(xht,Math.max(c,n*W6e));if(i==null||e===0)return Math.max(c,d);const u=Math.max(0,i-V6e),m=a+H6e+x5.left+x5.right,h=Math.max(0,u-m)/e;return Math.max(c,Math.min(d,Math.max(c,h)))}function Mht(e,n,i){if(n<=0)return 1;const r=e-x5.left-x5.right-i;return Math.max(1,r/n)}function Dht({barCategorySlotWidth:e,chartCanvasWidth:n,dataPointsCount:i,yAxisWidth:r}){const a=Mht(n,i,r),l=p[1]*2;return Math.max(1,Math.floor(Math.min(e,a-l)))}const _ht=({type:e,data:n,summarizedTitle:i,style:r})=>{const a=t.useTheme(),l=g.useRef(null),c=g.useRef(null),[d,u]=g.useState(null),[,m]=al(),{isCopied:x,setIsCopied:h}=lQ();g.useLayoutEffect(()=>{const ce=c.current;if(ce==null)return;const de=()=>{u(ce.clientWidth)};if(de(),typeof ResizeObserver>"u")return;const ue=new ResizeObserver(de);return ue.observe(ce),()=>{ue.disconnect()}},[e,i,n]);const{currency:{currencySymbol:f},texts:y}=O.getLocalizedStrings().common,{copied:C,copy:b,download:E}=y,$=[a.colors.graphColor27,a.colors.graphColor09,a.colors.graphColor17,a.colors.graphColor36,a.colors.graphColor12,a.colors.graphColor10,a.colors.graphColor33,a.colors.graphColor35];if(!Array.isArray(n.values)||n.values.length===0||e==="line_chart"&&n.lines?.length===0)return null;const R=n.x,S=n.y;if(!Array.isArray(S)||S.length===0)return null;const k=a.palette?.success?.main??v.success,T=e==="bar_chart"?S.length<=1?S.map(()=>k):S.map((ce,de)=>$[de%$.length]):$,A=Array.isArray(n.lines)?n.lines:S.length>0?S:[],I=n.yFormat,B=I==null?"currency":I?.type,L=I?.unit,P=I?.symbol??f,D=kht(e),{minChartWidth:M,widthPerDataPoint:F,maxLabelWidthPerDataPoint:V}=e==="bar_chart"?dht:e==="line_chart"?uht:lht,N=n.values.length,H=n.values.reduce((ce,de)=>{const ue=de[R],le=Lht(ue,F,V);return Math.max(ce,le)},F),W=n.values.reduce((ce,de)=>{const ue=de[R],le=ue==null?"":typeof ue=="string"||typeof ue=="number"?String(ue):"";return Math.max(ce,le.length)},0),U=e==="bar_chart"?UZ(n.values,S,P,B,L,wht,Eht):e==="line_chart"?UZ(n.values,[...S,...A],P,B,L,$ht,Rht):bht,Y=e==="bar_chart"?Pht({dataPointsCount:N,longestXLabelCharacterCount:W,scrollHostClientWidth:d,seriesCount:S.length,yAxisWidth:U}):null,q=Math.max(M,N*H),Z=Bht({baseCategoryWidth:e==="line_chart"?WZ:pht,dataPointsCount:N,minChartWidth:M,seriesWidth:e==="line_chart"?VZ:N6e,seriesCount:e==="line_chart"?Math.max(S.length,A.length):S.length,widestLabelWidthPerDataPoint:H,widthBuffer:e==="line_chart"?mht:H6e,yAxisWidth:U,chartType:e,barPerCategoryWidthOverride:e==="bar_chart"&&Y!=null?Y:void 0}),G=D?Z:e==="pie_chart"?Uxt:q,K=d!=null?Math.max(G,Math.max(0,d-V6e)):G,J=D?e==="bar_chart"?Y!=null?Dht({barCategorySlotWidth:Y,chartCanvasWidth:K,dataPointsCount:N,yAxisWidth:U}):BT:Math.max(1,Math.floor(Math.max(H,WZ+Math.max(S.length,A.length)*VZ))):1,oe=e==="bar_chart"?fht:e==="line_chart"?jht:hht,ee=e==="bar_chart"?yht:e==="line_chart"?Cht:ght,te=ce=>{const{payload:de,x:ue,y:le}=ce,ae=String(de.value??""),ge=J,ye=-ge/2;return t.jsxRuntimeExports.jsx("g",{transform:`translate(${ue},${le})`,children:t.jsxRuntimeExports.jsx("foreignObject",{x:ye,y:0,width:ge,height:F6e,children:t.jsxRuntimeExports.jsx(Gxt,{title:ae,children:ae})})})};let se=null;const ie=e==="bar_chart"?{maxBarSize:PN,barCategoryGap:0,barGap:0}:null,re=e==="bar_chart"||e==="line_chart"?x5:Sht,ne=ce=>{const{x:de,y:ue,payload:le,index:ae,tickFormatter:ge}=ce,ye=ge!=null?ge(le.value,ae):String(le.value),he=de-U+p[2];return t.jsxRuntimeExports.jsx("text",{x:he,y:ue,textAnchor:"start",dominantBaseline:"central",fill:a.colors.hero,style:{...z.extraSmallSemiBold.cssObject,lineHeight:`${eP}px`},children:ye})};switch(e){case"bar_chart":{if(ie==null){se=null;break}const{barCategoryGap:ce,barGap:de,maxBarSize:ue}=ie;se=t.jsxRuntimeExports.jsxs(st.BarChart,{data:n.values,barCategoryGap:ce,barGap:de,maxBarSize:ue,margin:re,children:[t.jsxRuntimeExports.jsx(st.CartesianGrid,{horizontal:!0,vertical:!1,stroke:a.colors.grey2,strokeWidth:1}),t.jsxRuntimeExports.jsx(st.XAxis,{dataKey:R,type:"category",axisLine:{stroke:a.colors.grey3,strokeWidth:.5},tickLine:!1,interval:QZ,angle:0,textAnchor:"middle",height:oe,tickMargin:ee,padding:{left:0,right:0},tick:te}),t.jsxRuntimeExports.jsx(st.YAxis,{type:"number",width:U,axisLine:!1,tickLine:!1,tick:ne,tickFormatter:le=>bb(le,P,B,L)}),t.jsxRuntimeExports.jsx(st.Tooltip,{offset:0,shared:!1,wrapperStyle:{zIndex:2},cursor:!1,content:({payload:le,active:ae,coordinate:ge})=>t.jsxRuntimeExports.jsx(KB,{active:ae,coordinate:ge,payload:le,xKey:R,currencySymbol:P,chartType:e,yFormatType:B,yFormatUnit:L}),allowEscapeViewBox:{x:!1,y:!0}}),S.map((le,ae)=>t.jsxRuntimeExports.jsx(st.Bar,{dataKey:le,fill:T[ae%T.length],maxBarSize:PN},le)),t.jsxRuntimeExports.jsx(st.Legend,{iconType:"square",verticalAlign:"bottom",wrapperStyle:{width:"100%",display:"flex",justifyContent:"center",left:"initial",bottom:o.sp0,color:a.colors.hero,...z.extraSmallSemiBold.cssObject,margin:0,padding:0},formatter:le=>t.jsxRuntimeExports.jsx(JB,{children:le}),content:le=>t.jsxRuntimeExports.jsx(XB,{...le,themeContext:a})})]});break}case"pie_chart":se=t.jsxRuntimeExports.jsxs(nht,{data:n.values,children:[t.jsxRuntimeExports.jsx(st.Pie,{data:n.values,dataKey:S[0],nameKey:R,cx:"50%",cy:"50%",outerRadius:z6e,label:ce=>t.jsxRuntimeExports.jsx("text",{x:ce.x,y:ce.y,textAnchor:ce.textAnchor,fill:a.colors.hero,style:z.extraSmallSemiBold.cssObject,children:bb(ce.value,P,B,L)}),children:n.values.map((ce,de)=>t.jsxRuntimeExports.jsx(st.Cell,{fill:$[de%$.length]},de))}),t.jsxRuntimeExports.jsx(st.Tooltip,{offset:0,wrapperStyle:{zIndex:2},content:({payload:ce,active:de,coordinate:ue})=>t.jsxRuntimeExports.jsx(KB,{active:de,coordinate:ue,payload:ce,xKey:R,currencySymbol:P,chartType:e,yFormatType:B,yFormatUnit:L}),allowEscapeViewBox:{x:!1,y:!0}}),t.jsxRuntimeExports.jsx(st.Legend,{iconType:"square",verticalAlign:"bottom",wrapperStyle:{width:"100%",display:"flex",justifyContent:"center",left:"initial",bottom:o.sp0,color:a.colors.hero,...z.extraSmallSemiBold.cssObject,margin:0,padding:0},formatter:ce=>t.jsxRuntimeExports.jsx(JB,{children:ce}),content:ce=>t.jsxRuntimeExports.jsx(XB,{...ce,themeContext:a})})]});break;case"line_chart":se=t.jsxRuntimeExports.jsxs(st.LineChart,{data:n.values,margin:re,children:[t.jsxRuntimeExports.jsx(st.CartesianGrid,{horizontal:!0,vertical:!0,stroke:a.colors.grey2,strokeWidth:1}),t.jsxRuntimeExports.jsx(st.XAxis,{dataKey:R,type:"category",axisLine:{stroke:a.colors.grey3,strokeWidth:.5},tickLine:!1,interval:QZ,angle:0,textAnchor:"middle",height:oe,tickMargin:ee,padding:Aht,tick:te}),t.jsxRuntimeExports.jsx(st.YAxis,{type:"number",width:U,axisLine:!1,tickLine:!1,tick:{color:a.colors.hero,...z.extraSmallSemiBold.cssObject,style:{lineHeight:`${eP}px`,height:`${eP}px`}},tickFormatter:ce=>bb(ce,P,B,L)}),t.jsxRuntimeExports.jsx(st.Tooltip,{offset:0,wrapperStyle:{zIndex:2},cursor:{stroke:a.colors.background,strokeDasharray:"1, 1",strokeWidth:1,fill:a.colors.background},content:({payload:ce,active:de,coordinate:ue})=>t.jsxRuntimeExports.jsx(KB,{active:de,coordinate:ue,payload:ce,xKey:R,currencySymbol:P,chartType:e,yFormatType:B,yFormatUnit:L}),allowEscapeViewBox:{x:!1,y:!0}}),A.map((ce,de)=>t.jsxRuntimeExports.jsx(st.Line,{type:"monotone",dataKey:ce,stroke:$[de%$.length],strokeWidth:2,dot:!0,activeDot:{r:6}},ce)),t.jsxRuntimeExports.jsx(st.Legend,{iconType:"square",verticalAlign:"bottom",wrapperStyle:{width:"100%",display:"flex",justifyContent:"center",left:"initial",bottom:o.sp0,color:a.colors.hero,...z.extraSmallSemiBold.cssObject,margin:0,padding:0},formatter:ce=>t.jsxRuntimeExports.jsx(JB,{children:ce}),content:ce=>t.jsxRuntimeExports.jsx(XB,{...ce,themeContext:a})})]});break;default:se=null}if(!se)return null;const me=O6e,pe=async()=>{try{const ce=L6e(e,n);await m(ce)&&h(!0)}catch(ce){console.error("Failed to copy chart data:",ce)}},je=()=>{l.current&&setTimeout(()=>{try{const ce=l.current?.querySelector("svg");if(!ce){console.error("Error: Could not find SVG element");return}const de=T6e(i,"png",e),ue=ce.cloneNode(!0);Wxt(ue,a.colors.hero);let le,ae;if(D)le=K,ae=me;else{const _e=ue.getAttribute("width"),Te=ue.getAttribute("height"),Re=ue.getAttribute("viewBox");if(_e!=null&&Te!=null&&_e.trim()!==""&&Te.trim()!=="")le=parseFloat(_e),ae=parseFloat(Te);else if(Re!=null&&Re.trim()!==""){const[,,ke,Oe]=Re.split(/\s+|,/);le=parseFloat(ke),ae=parseFloat(Oe)}else{const ke=ue.getBoundingClientRect();le=ke.width,ae=ke.height}(!Number.isFinite(le)||le<=0)&&(le=K),(!Number.isFinite(ae)||ae<=0)&&(ae=me)}const ge=Qxt(e,n,R,S,A,e==="bar_chart"?T:$),ye=FZ(ge,le,Rp);if(D){zxt(ue);const _e=Hxt(ue)??{width:K,height:me},Te=_e.width,Re=_e.height,Me=FZ(ge,Te,Rp)+p[1],Ie=Te,Ne=Re+Rp.VERTICAL_OFFSET+Me,Pe=document.createElementNS("http://www.w3.org/2000/svg","svg");Pe.setAttribute("xmlns","http://www.w3.org/2000/svg"),Pe.setAttribute("width",Ie.toString()),Pe.setAttribute("height",Me.toString()),Pe.setAttribute("viewBox",`0 0 ${Ie} ${Me}`),NZ(Pe,-Rp.VERTICAL_OFFSET,Ie,ge,a);const Qe=new XMLSerializer().serializeToString(ue),Je=new XMLSerializer().serializeToString(Pe),tt=new Blob([Qe],{type:"image/svg+xml;charset=utf-8"}),Ue=new Blob([Je],{type:"image/svg+xml;charset=utf-8"}),dt=URL.createObjectURL(tt),ct=URL.createObjectURL(Ue),yt=document.createElement("canvas"),He=yt.getContext("2d");yt.width=Ie,yt.height=Ne;const jt=new Image,St=new Image;jt.onload=()=>{He&&(HZ(He,yt.width,yt.height),He.drawImage(jt,0,0,Te,Re)),St.onload=()=>{He?(He.drawImage(St,0,Re+Rp.VERTICAL_OFFSET,Ie,Me),yt.toBlob(We=>{URL.revokeObjectURL(dt),URL.revokeObjectURL(ct),We?t.fileDownload(We,de):console.error("Error exporting chart to PNG: blob is null")})):(URL.revokeObjectURL(dt),URL.revokeObjectURL(ct))},St.onerror=()=>{URL.revokeObjectURL(dt),URL.revokeObjectURL(ct),console.error("Error loading legend SVG for PNG conversion")},St.src=ct},jt.onerror=()=>{URL.revokeObjectURL(dt),URL.revokeObjectURL(ct),console.error("Error loading chart SVG for PNG conversion")},jt.src=dt;return}const he=ae+ye,Ce=le,we=document.createElementNS("http://www.w3.org/2000/svg","svg");we.setAttribute("width",Ce.toString()),we.setAttribute("height",he.toString()),we.setAttribute("viewBox",`0 0 ${Ce} ${he}`),ue.setAttribute("x","0"),ue.setAttribute("y","0"),ue.setAttribute("width",le.toString()),ue.setAttribute("height",ae.toString()),we.appendChild(ue),NZ(we,ae,Ce,ge,a);const ve=new XMLSerializer().serializeToString(we),Ee=document.createElement("canvas"),Se=Ee.getContext("2d"),$e=new Image;Ee.width=Ce,Ee.height=he;const Be=new Blob([ve],{type:"image/svg+xml;charset=utf-8"}),Ae=URL.createObjectURL(Be);$e.onload=()=>{Se?(HZ(Se,Ee.width,Ee.height),Se.drawImage($e,0,0,Ce,he),Ee.toBlob(_e=>{URL.revokeObjectURL(Ae),_e?t.fileDownload(_e,de):console.error("Error exporting chart to PNG: blob is null")})):URL.revokeObjectURL(Ae)},$e.onerror=()=>{URL.revokeObjectURL(Ae),console.error("Error loading SVG for PNG conversion")},$e.src=Ae}catch(ce){console.error("Error exporting chart:",ce)}},100)};return t.jsxRuntimeExports.jsxs(Yxt,{style:r,children:[t.jsxRuntimeExports.jsx(qxt,{ref:c,"aria-hidden":!0}),t.jsxRuntimeExports.jsxs(Zxt,{children:[t.jsxRuntimeExports.jsx(Kxt,{children:t.jsxRuntimeExports.jsx(A6e,{children:t.jsxRuntimeExports.jsx(Jxt,{alignStart:D,minHeight:me,children:t.jsxRuntimeExports.jsx(sht,{ref:l,children:t.jsxRuntimeExports.jsx(iht,{chartWidth:K,chartHeight:me,children:t.jsxRuntimeExports.jsx(st.ResponsiveContainer,{width:"100%",height:"100%",children:se})})})})})}),t.jsxRuntimeExports.jsx(rht,{children:t.jsxRuntimeExports.jsxs(aht,{children:[t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:E,arrow:!0,enterDelay:Jr,disableIntersectionObserver:!0,children:t.jsxRuntimeExports.jsx(vS,{"aria-label":E,onClick:je,onKeyDown:ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),je())},role:"button",tabIndex:0,children:t.jsxRuntimeExports.jsx(P6e,{"aria-hidden":!0})})}),t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:x?C:b,arrow:!0,enterDelay:Jr,disableIntersectionObserver:!0,children:t.jsxRuntimeExports.jsx(vS,{"aria-label":x?C:b,onClick:()=>{pe()},onKeyDown:ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),pe())},role:"button",tabIndex:0,children:x?t.jsxRuntimeExports.jsx(D6e,{"aria-hidden":!0}):t.jsxRuntimeExports.jsx(M6e,{"aria-hidden":!0})})})]})})]})]})},Q6e=o.sp6,Oht=s.div`
3623
3623
  width: 100%;
3624
3624
  min-width: 0;
3625
3625
  max-width: 100%;
@@ -4337,7 +4337,7 @@ Initiate your first transfer to start earning yield.`,insuredFundsTooltip:"Secur
4337
4337
  `,Jgt=s(be)`
4338
4338
  cursor: pointer;
4339
4339
  color: ${e=>e.theme.colors.champion};
4340
- `,Xgt=({isMobile:e,onSampleQuestionClick:n,questionsList:i,chipsJustify:r,isSuggestedQuestionsLoading:a,loadingSkeletonDesktopWidthPercentage:l,narrowMobileLoadingSkeleton:c,collapseExtraSuggestions:d=!0,skeletonPlaceholderCount:u,loadingSkeletonDesktopSingleRow:m})=>{const x=X(),[h,f]=g.useState(!1),y=i.join("");g.useEffect(()=>{f(!1)},[y]);const C=i.length,b=d&&C>GB,E=!d||h||!b?i:i.slice(0,GB),$=C-GB,R=d&&!h&&b&&$>0?_gt.replace("__count__",String($)):null,S=u??out,k=m===!0&&a===!0&&e===!1&&!Ec(x);return a===!0?t.jsxRuntimeExports.jsx(hK,{$chipsJustify:r,children:t.jsxRuntimeExports.jsx(xK,{isMobile:e,$chipsJustify:r,$desktopSingleRowSkeletons:k,children:Array.from({length:S},(T,A)=>t.jsxRuntimeExports.jsx(Kgt,{windowSize:x,$desktopLoadingSkeletonWidthPercentage:a===!0?l:void 0,$narrowMobileLoading:c===!0&&e===!0,$desktopSingleRowFill:k,children:t.jsxRuntimeExports.jsx(fe,{width:"100%",height:p[4]})},`sample-q-skeleton-${A}`))})}):t.jsxRuntimeExports.jsxs(hK,{$chipsJustify:r,children:[t.jsxRuntimeExports.jsx(xK,{isMobile:e,$chipsJustify:r,children:E.map((T,A)=>t.jsxRuntimeExports.jsx(qgt,{type:"button",onClick:()=>{n(T,A)},children:t.jsxRuntimeExports.jsx(Zgt,{children:T})},`sample-q-${A}-${jS(T)}`))}),R!=null?t.jsxRuntimeExports.jsx(Jgt,{onClick:()=>{f(!0)},children:R}):null]})},pQ=(e,n,i=[],r)=>t.jsxRuntimeExports.jsx(Xgt,{isMobile:e,onSampleQuestionClick:n,questionsList:i,chipsJustify:r?.chipsJustify??"center",isSuggestedQuestionsLoading:r?.isSuggestedQuestionsLoading,loadingSkeletonDesktopWidthPercentage:r?.loadingSkeletonDesktopWidthPct,narrowMobileLoadingSkeleton:r?.narrowMobileLoadingSkeleton,collapseExtraSuggestions:r?.collapseExtraSuggestions??!0,skeletonPlaceholderCount:r?.skeletonPlaceholderCount,loadingSkeletonDesktopSingleRow:r?.loadingSkeletonDesktopSingleRow}),gK=(e,n,i)=>n?t.jsxRuntimeExports.jsx(l2t,{children:t.jsxRuntimeExports.jsxs(c2t,{children:[t.jsxRuntimeExports.jsx(mP,{children:`${_N} ${i}`}),t.jsxRuntimeExports.jsx(mP,{children:ON})]})}):t.jsxRuntimeExports.jsx(a2t,{isFullView:e,children:t.jsxRuntimeExports.jsx(mP,{children:`${_N} ${i}${Wgt} ${ON}`})}),uP=(e,n)=>`${e}_${n}`,Y8=({Icon:e,title:n,onClick:i})=>t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:n,arrow:!0,enterDelay:Jr,disableIntersectionObserver:!0,children:t.jsxRuntimeExports.jsx(zN,{onClick:i,children:t.jsxRuntimeExports.jsx(e,{})})}),e2t=({hasActiveChat:e,isFullView:n,isMobile:i,onCloseClick:r,onNewChatClick:a,togglePageView:l})=>i?t.jsxRuntimeExports.jsxs(CK,{isMobile:i,children:[e&&t.jsxRuntimeExports.jsx(zN,{onClick:a,children:t.jsxRuntimeExports.jsx(wK,{})}),t.jsxRuntimeExports.jsx(zN,{onClick:r,children:t.jsxRuntimeExports.jsx(EK,{})})]}):t.jsxRuntimeExports.jsxs(CK,{isMobile:i,children:[n?t.jsxRuntimeExports.jsx(Y8,{Icon:g2t,title:Qgt,onClick:l}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[e&&t.jsxRuntimeExports.jsx(Y8,{Icon:wK,title:i7e,onClick:a}),t.jsxRuntimeExports.jsx(Y8,{Icon:f2t,title:Ugt,onClick:l})]}),t.jsxRuntimeExports.jsx(Y8,{Icon:EK,title:Vgt,onClick:r})]}),fK=({isFullView:e,isMobile:n})=>t.jsxRuntimeExports.jsxs(u2t,{isFullView:e,isMobile:n,children:[t.jsxRuntimeExports.jsx(p2t,{isMobile:n,children:t.jsxRuntimeExports.jsx(m2t,{})}),t.jsxRuntimeExports.jsx(x2t,{children:s7e})]}),t2t=({aiCfoView:e,isNewChatSession:n,isFullView:i,initialUploadingFiles:r,isFileUploadEnabled:a=!1,isUploadPromoVisible:l=!1,onUploadPromoClose:c,showSampleQuestions:d,tableDownloadEndPoint:u,emailLinkQuestion:m,autoSubmitEmailLinkQuestion:x,routedInitialQuestionSource:h,routedInitialQuestionSuggestionIndex:f,exploreSuggestedPromptQuestions:y,exploreSuggestedPromptQuestionsLoading:C=!1,exploreSuggestedQuestionsOverride:b,onCloseClick:E,onNewChatClick:$,togglePageView:R,onCopy:S,onThumbsUp:k,onThumbsDown:T,onSubmit:A,onToggleCotCollapsed:I,updateCurrentInput:B,openOnboardingPage:L,onStopSubmit:P,onUpdateScrollYOffset:D,onEmailLinkQuestionProcessed:M,onMenuClick:F})=>{const V=t.useTheme(),N=ht(),H=Ml(N.loggedInUser),W=X(),{useDynamicConfig:U}=Dc(),{configValue:Y}=U(Fx.aiCfoMessageDynamicConfig),q=g.useMemo(()=>{if(y!=null&&y.length>0)return[...y];if(b!=null&&b.length>0)return[...b];const Xe=Y?.default_message_list;return Array.isArray(Xe)&&Xe.length>0?[...Xe]:[Ogt,zgt,Fgt]},[y,b,Y?.default_message_list]),Z=(W==="small"||W==="medium-compact")&&F!=null,G=e.uiState.currentChatSessionId,K=e.uiState.currentInput,oe=ro().analytics,ee=Z?!n&&!d:i&&!n,te=G==null||e.uiState.chatHistoryNextPageToken[G]==null,se=ee&&te,ie=e.createSessionAndSubmitState.fetchState==="In-Progress",[re,ne]=g.useState(null),[me,pe]=g.useState({}),je=G!=null?e.allSessionsWithOrderedQuestionAnswers.find(Xe=>Xe.chatSession.chatSessionId===G):null,ce=je?.chatSession,de=(je?.questionAnswers.length??0)>0,ue=d&&!de&&!se&&!ie,le=g.useCallback(()=>{G!=null&&(pe(Xe=>({...Xe,[G]:{answer:!1,thought:!1,reasoning:!1,analysis:!1}})),uK.forEach(Xe=>{const ft=uP(G,Xe);we.current[ft]=!1}))},[G]),ae=Xe=>{G!=null&&pe(ft=>{const oo=ft[G]??{answer:!1,thought:!1,reasoning:!1,analysis:!1};return oo[Xe]===!0?ft:{...ft,[G]:{...oo,[Xe]:!0}}})},[ge,ye]=g.useState(K),he=Ye(ie),Ce=e.responseStateByChatSessionId[G??""]?.answer?.fetchState,we=g.useRef({}),ve=Ye(G),Ee=Ye(e.responseStateByChatSessionId[G??""]?.analysis?.fetchState),Se=e.responseStateByChatSessionId[G??""]?.analysis?.fetchState,$e=g.useRef(null),Be=Ye(je?.questionAnswers),Ae=Ye(e.responseStateByChatSessionId[G??""]?.answer?.fetchState),_e=Ye(e.stopSubmitStateByChatSessionId[G??""]?.fetchState),Te=e.stopSubmitStateByChatSessionId[G??""]?.fetchState,[Re,ke]=g.useState({}),Oe=g.useRef({});g.useEffect(()=>{if(!de||G==null)return;const Xe=G,ft=je?.questionAnswers??[],oo=ft.length-1,To=ft[oo]?.questionAnswerId,kn=e.responseStateByChatSessionId[Xe??""]?.answer?.fetchState;Ae==="In-Progress"&&kn==="Completed"&&To&&Oe.current[Xe]!==To&&(ke(dn=>({...dn,[Xe]:To})),Oe.current[Xe]=To);const Dn=Array.isArray(Be)?Be:[],qt=Dn.length>0?Dn[Dn.length-1]?.questionAnswerId:null;To&&qt!==To&&ke(dn=>({...dn,[Xe]:null}))},[je,e.responseStateByChatSessionId,G,de,Be,Ae,Re]),g.useEffect(()=>{if(!(ve!==G||!de||G==null)&&(uK.forEach(Xe=>{if((me[G]?.[Xe]??!1)&&!we.current[uP(G,Xe)]){we.current[uP(G,Xe)]=!0;const oo=()=>{if($e.current){const on=$e.current;if(Xe==="answer")on.scrollTo({top:on.scrollTop+500,behavior:"smooth"});else{const To=on.scrollHeight-on.scrollTop-on.clientHeight<100;on.scrollTo({top:on.scrollHeight,behavior:To?"smooth":"auto"})}}};Xe==="thought"?setTimeout(oo,200):oo()}}),Ee!==Se&&Se==="In-Progress"&&$e.current)){const Xe=$e.current,ft=Xe.scrollHeight-Xe.scrollTop-Xe.clientHeight<100;Xe.scrollTo({top:Xe.scrollHeight,behavior:ft?"smooth":"auto"})}},[G,de,ve,Ee,Se,me]),g.useEffect(()=>{const Xe=e.uiState.scrollPositionByChatSessionId,ft=e.uiState.currentChatSessionId;if($e.current&&ft!=null){const oo=Xe[ft]?.scrollTop??null;typeof oo=="number"&&($e.current.scrollTop=oo)}},[e.uiState.currentChatSessionId,e.uiState.scrollPositionByChatSessionId]);const Me=g.useRef(t.debounce(Xe=>{D(Xe)},1e3,{trailing:!0})),Ie=g.useCallback((Xe,ft)=>{ne(Xe),le(),A(Xe,"user_input",ft)},[A,le]),Ne=Xe=>{Me.current(Xe.currentTarget.scrollTop),St(Xe.currentTarget)},Pe=Ce==="In-Progress"||ie,Ue=g.useRef(t.debounce(Xe=>{B(Xe)},300));g.useEffect(()=>{const Xe=Ue.current;return()=>{Xe.cancel()}},[]);const Je=g.useCallback((Xe,ft,oo)=>{if(Pe){Ue.current.cancel(),ye(Xe),B(Xe);return}ne(Xe),le(),A(Xe,ft,void 0,oo)},[A,Pe,le,B]);g.useEffect(()=>{he===!0&&ie===!1&&ne(null)},[he,ie]),g.useEffect(()=>{_e==="In-Progress"&&Te==="Completed"&&ye(K)},[_e,K,Te]),g.useLayoutEffect(()=>{Pe&&(Ue.current.cancel(),ye(Xe=>Xe===K?Xe:K))},[K,Pe]);const tt=Ye(m),[Qe,dt]=g.useState(!1),[ct,yt]=g.useState([]),{showScrollToBottom:He,handleScrollToBottom:jt,updateScrollToBottomOnScroll:St}=o7e($e),We=He&&!se&&!ie,nt=g.useCallback(()=>{const Xe=ct.length>0?ct.map(oo=>oo.file):void 0,ft=ge;Ue.current.cancel(),B(""),Ie(ft,Xe),ye(""),yt([])},[Ie,ge,ct,B]),ut=g.useCallback(()=>{dt(!1)},[]);g.useEffect(()=>{if(m==null||m===""||m===tt||x===!0&&Pe)return;const Xe=h??"email_link";Xe==="email_link"&&oe.trackAICFOChatScreenStateChanged("viewed","email_link",G??null,null),x===!0?(le(),ne(m),A(m,Xe,void 0,f)):(Ue.current.cancel(),ye(m),B(m),dt(!0)),M?.()},[m,tt,x,h,f,Pe,A,B,M,le,ye,dt,oe,G]);const pt=g.useCallback(Xe=>{ye(Xe),Ue.current(Xe)},[]),Bt=g.useCallback((Xe,ft)=>{Je(Xe,"question_card",ft)},[Je]),Ht=je?.chatSession.chatSessionSummary,$o=g.useCallback(()=>{R();const Xe=i?"minimize":"maximize";oe.trackAICFOChatScreenStateChanged(Xe,"left_menu",G??null,Ht??null)},[R,i,oe,G,Ht]),Tt=g.useCallback(()=>{E(),oe.trackAICFOChatScreenStateChanged("close","left_menu",G??null,Ht??null)},[E,oe,G,Ht]),Gt=Ht??i7e,so=()=>Z?de||n&&!d?t.jsxRuntimeExports.jsx(bK,{children:t.jsxRuntimeExports.jsx(h2t,{children:Gt})}):t.jsxRuntimeExports.jsx(bK,{children:t.jsxRuntimeExports.jsx(fK,{isFullView:!1,isMobile:!0})}):t.jsxRuntimeExports.jsx(fK,{isFullView:i,isMobile:!1}),no=()=>{if(se||ie)return t.jsxRuntimeExports.jsx(t7e,{isQuestionOnlyLoading:ie,pendingQuestionText:re,style:{width:Z?"auto":i?Yb.valuePx(W):"auto",padding:Z?`0 ${o.sp3}`:void 0,margin:Z?"0":i?"0 auto":`0 ${o.sp8}`}});if(Z){if(d&&!de)return t.jsxRuntimeExports.jsx(pP,{windowSize:W,isFullView:!1,isMobile:!0,children:t.jsxRuntimeExports.jsx(yK,{isFullView:!1,isMobile:!0,children:gK(!1,!0,H)})});if(n&&!de)return t.jsxRuntimeExports.jsx(pP,{windowSize:W,isFullView:!1,isMobile:!0,isMobileNewChat:!0,children:t.jsxRuntimeExports.jsxs(d2t,{children:[t.jsxRuntimeExports.jsx(jK,{children:`${_N} ${H}`}),t.jsxRuntimeExports.jsx(jK,{children:ON})]})})}return t.jsxRuntimeExports.jsx(pP,{windowSize:W,isFullView:i,isMobile:Z,showExploreDesktop:!Z&&i&&d,children:!Z&&d&&(i||!de)?t.jsxRuntimeExports.jsx(yK,{isFullView:i,isMobile:!1,children:gK(i,!1,H)}):de?je?.questionAnswers.map((Xe,ft)=>{const oo=ft===je?.questionAnswers.length-1,on=!!(oo&&G!=null&&Re[G]===Xe.questionAnswerId),kn=oo?e.responseStateByChatSessionId[G??""]:{thought:{fetchState:"Completed",error:void 0},analysis:{fetchState:"Completed",error:void 0},reasoning:{fetchState:"Completed",error:void 0},answer:{fetchState:"Completed",error:void 0},fetchStatus:{fetchState:"Completed",error:void 0}},Dn=e.uiState.cotCollapsedByQuestionAnswerId[Xe.questionAnswerId]??!1;return t.jsxRuntimeExports.jsx(e7e,{enableTypingEffect:on,enableCotTypingEffect:oo,isCotCollapsed:Dn,isFullView:Z?!1:i,aiCfoAnswer:Xe,responseState:kn,currentChatSession:ce,tableDownloadEndPoint:u,onCopy:S,onThumbsUp:k,onThumbsDown:T,onQuestionClick:Je,onToggleCotCollapsed:I,handleChainOfThoughtTypingDoneForScrollPurpose:ae},Xe.questionAnswerId)}):null})};return t.jsxRuntimeExports.jsxs(o2t,{isFullView:i,windowSize:W,isMobile:Z,children:[t.jsxRuntimeExports.jsx(Rt,{showMenuIcon:Z,onClickMenuIcon:Z?F:void 0,rightSideComponent:t.jsxRuntimeExports.jsx(e2t,{hasActiveChat:de,isFullView:i,isMobile:Z,onCloseClick:Tt,onNewChatClick:$,togglePageView:$o}),title:so(),leftSideComponent:Z?void 0:t.jsxRuntimeExports.jsx(y2t,{}),leftComponentStyle:Z?void 0:{width:o.sp4,flex:`0 0 ${o.sp4}`},middleComponentStyle:Z?void 0:{width:"auto",flex:"1 1 auto",justifyContent:"flex-start",minWidth:0},rightComponentStyle:Z?void 0:{width:"auto",flex:"0 0 auto",marginLeft:"auto",paddingRight:o.sp5},scrollableContent:$e,ignoreScrollAction:$e.current==null,backgroundColor:V.colors.grey4,style:{zIndex:3,...Z?{}:{minHeight:o.sp8,height:o.sp8}},titleStyle:Z?{marginLeft:o.sp2}:{width:"100%",marginLeft:0,justifyContent:"flex-start",textAlign:"left"},navBarContainerStyles:Z?{alignItems:"center",justifyContent:"space-between",paddingTop:o.sp2,paddingBottom:o.sp0}:{alignItems:"center",justifyContent:"space-between",paddingTop:o.sp3,paddingBottom:o.sp3},navBarContentContainerStyles:Z?void 0:{margin:o.sp0,minHeight:o.sp8,height:o.sp8},source:Z?"AiCfoPageMobile":"AiCfoPage",hideSearchBtn:!0}),t.jsxRuntimeExports.jsxs(R6e,{children:[t.jsxRuntimeExports.jsx(n2t,{ref:$e,onScroll:Ne,children:no()}),We&&t.jsxRuntimeExports.jsx(v6e,{$centeredColumnWidthPx:i&&!Z?Yb.valuePx(W):void 0,$height:$6e})]}),t.jsxRuntimeExports.jsxs(s2t,{isFullView:i,isMobile:Z,children:[We&&t.jsxRuntimeExports.jsx(k6e,{onClick:jt,children:t.jsxRuntimeExports.jsx(n7e,{})}),ue?t.jsxRuntimeExports.jsx(i2t,{isFullView:i,isMobile:Z,windowSize:W,children:pQ(Z,Bt,q,{chipsJustify:!Z&&i?"center":"flex-start",isSuggestedQuestionsLoading:C===!0,narrowMobileLoadingSkeleton:!0,collapseExtraSuggestions:!i||Z})}):null,t.jsxRuntimeExports.jsx(r2t,{windowSize:W,isFullView:i,isMobile:Z,children:t.jsxRuntimeExports.jsx(aQ,{currentInput:ge,isSubmitting:Pe,formId:uQ(Ggt),isFileUploadEnabled:a,initialUploadingFiles:r,selectedFiles:ct,name:"input",aiAgentName:s7e,shouldFocus:Qe,onFocusComplete:ut,openOnboardingPage:L,onFilesChange:yt,onSubmit:nt,onStopSubmit:P,onInputChange:pt,isUploadPromoVisible:l,onUploadPromoClose:c})})]})]})},o2t=s.div`
4340
+ `,Xgt=({isMobile:e,onSampleQuestionClick:n,questionsList:i,chipsJustify:r,isSuggestedQuestionsLoading:a,loadingSkeletonDesktopWidthPercentage:l,narrowMobileLoadingSkeleton:c,collapseExtraSuggestions:d=!0,skeletonPlaceholderCount:u,loadingSkeletonDesktopSingleRow:m})=>{const x=X(),[h,f]=g.useState(!1),y=i.join("");g.useEffect(()=>{f(!1)},[y]);const C=i.length,b=d&&C>GB,E=!d||h||!b?i:i.slice(0,GB),$=C-GB,R=d&&!h&&b&&$>0?_gt.replace("__count__",String($)):null,S=u??out,k=m===!0&&a===!0&&e===!1&&!Ec(x);return a===!0?t.jsxRuntimeExports.jsx(hK,{$chipsJustify:r,children:t.jsxRuntimeExports.jsx(xK,{isMobile:e,$chipsJustify:r,$desktopSingleRowSkeletons:k,children:Array.from({length:S},(T,A)=>t.jsxRuntimeExports.jsx(Kgt,{windowSize:x,$desktopLoadingSkeletonWidthPercentage:a===!0?l:void 0,$narrowMobileLoading:c===!0&&e===!0,$desktopSingleRowFill:k,children:t.jsxRuntimeExports.jsx(fe,{width:"100%",height:p[4]})},`sample-q-skeleton-${A}`))})}):t.jsxRuntimeExports.jsxs(hK,{$chipsJustify:r,children:[t.jsxRuntimeExports.jsx(xK,{isMobile:e,$chipsJustify:r,children:E.map((T,A)=>t.jsxRuntimeExports.jsx(qgt,{type:"button",onClick:()=>{n(T,A)},children:t.jsxRuntimeExports.jsx(Zgt,{children:T})},`sample-q-${A}-${jS(T)}`))}),R!=null?t.jsxRuntimeExports.jsx(Jgt,{onClick:()=>{f(!0)},children:R}):null]})},pQ=(e,n,i=[],r)=>t.jsxRuntimeExports.jsx(Xgt,{isMobile:e,onSampleQuestionClick:n,questionsList:i,chipsJustify:r?.chipsJustify??"center",isSuggestedQuestionsLoading:r?.isSuggestedQuestionsLoading,loadingSkeletonDesktopWidthPercentage:r?.loadingSkeletonDesktopWidthPct,narrowMobileLoadingSkeleton:r?.narrowMobileLoadingSkeleton,collapseExtraSuggestions:r?.collapseExtraSuggestions??!0,skeletonPlaceholderCount:r?.skeletonPlaceholderCount,loadingSkeletonDesktopSingleRow:r?.loadingSkeletonDesktopSingleRow}),gK=(e,n,i)=>n?t.jsxRuntimeExports.jsx(l2t,{children:t.jsxRuntimeExports.jsxs(c2t,{children:[t.jsxRuntimeExports.jsx(mP,{children:`${_N} ${i}`}),t.jsxRuntimeExports.jsx(mP,{children:ON})]})}):t.jsxRuntimeExports.jsx(a2t,{isFullView:e,children:t.jsxRuntimeExports.jsx(mP,{children:`${_N} ${i}${Wgt} ${ON}`})}),uP=(e,n)=>`${e}_${n}`,Y8=({Icon:e,title:n,onClick:i})=>t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:n,arrow:!0,enterDelay:Jr,disableIntersectionObserver:!0,children:t.jsxRuntimeExports.jsx(zN,{onClick:i,children:t.jsxRuntimeExports.jsx(e,{})})}),e2t=({hasActiveChat:e,isFullView:n,isMobile:i,onCloseClick:r,onNewChatClick:a,togglePageView:l})=>i?t.jsxRuntimeExports.jsxs(CK,{isMobile:i,children:[e&&t.jsxRuntimeExports.jsx(zN,{onClick:a,children:t.jsxRuntimeExports.jsx(wK,{})}),t.jsxRuntimeExports.jsx(zN,{onClick:r,children:t.jsxRuntimeExports.jsx(EK,{})})]}):t.jsxRuntimeExports.jsxs(CK,{isMobile:i,children:[n?t.jsxRuntimeExports.jsx(Y8,{Icon:g2t,title:Qgt,onClick:l}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[e&&t.jsxRuntimeExports.jsx(Y8,{Icon:wK,title:i7e,onClick:a}),t.jsxRuntimeExports.jsx(Y8,{Icon:f2t,title:Ugt,onClick:l})]}),t.jsxRuntimeExports.jsx(Y8,{Icon:EK,title:Vgt,onClick:r})]}),fK=({isFullView:e,isMobile:n})=>t.jsxRuntimeExports.jsxs(u2t,{isFullView:e,isMobile:n,children:[t.jsxRuntimeExports.jsx(p2t,{isMobile:n,children:t.jsxRuntimeExports.jsx(m2t,{})}),t.jsxRuntimeExports.jsx(x2t,{children:s7e})]}),t2t=({aiCfoView:e,isNewChatSession:n,isFullView:i,initialUploadingFiles:r,isFileUploadEnabled:a=!1,isUploadPromoVisible:l=!1,onUploadPromoClose:c,showSampleQuestions:d,tableDownloadEndPoint:u,emailLinkQuestion:m,autoSubmitEmailLinkQuestion:x,routedInitialQuestionSource:h,routedInitialQuestionSuggestionIndex:f,exploreSuggestedPromptQuestions:y,exploreSuggestedPromptQuestionsLoading:C=!1,exploreSuggestedQuestionsOverride:b,onCloseClick:E,onNewChatClick:$,togglePageView:R,onCopy:S,onThumbsUp:k,onThumbsDown:T,onSubmit:A,onToggleCotCollapsed:I,updateCurrentInput:B,openOnboardingPage:L,onStopSubmit:P,onUpdateScrollYOffset:D,onEmailLinkQuestionProcessed:M,onMenuClick:F})=>{const V=t.useTheme(),N=ht(),H=Ml(N.loggedInUser),W=X(),{useDynamicConfig:U}=Dc(),{configValue:Y}=U(Fx.aiCfoMessageDynamicConfig),q=g.useMemo(()=>{if(y!=null&&y.length>0)return[...y];if(b!=null&&b.length>0)return[...b];const Xe=Y?.default_message_list;return Array.isArray(Xe)&&Xe.length>0?[...Xe]:[Ogt,zgt,Fgt]},[y,b,Y?.default_message_list]),Z=(W==="small"||W==="medium-compact")&&F!=null,G=e.uiState.currentChatSessionId,K=e.uiState.currentInput,oe=ro().analytics,ee=Z?!n&&!d:i&&!n,te=G==null||e.uiState.chatHistoryNextPageToken[G]==null,se=ee&&te,ie=e.createSessionAndSubmitState.fetchState==="In-Progress",[re,ne]=g.useState(null),[me,pe]=g.useState({}),je=G!=null?e.allSessionsWithOrderedQuestionAnswers.find(Xe=>Xe.chatSession.chatSessionId===G):null,ce=je?.chatSession,de=(je?.questionAnswers.length??0)>0,ue=d&&!de&&!se&&!ie,le=g.useCallback(()=>{G!=null&&(pe(Xe=>({...Xe,[G]:{answer:!1,thought:!1,reasoning:!1,analysis:!1}})),uK.forEach(Xe=>{const ft=uP(G,Xe);we.current[ft]=!1}))},[G]),ae=Xe=>{G!=null&&pe(ft=>{const oo=ft[G]??{answer:!1,thought:!1,reasoning:!1,analysis:!1};return oo[Xe]===!0?ft:{...ft,[G]:{...oo,[Xe]:!0}}})},[ge,ye]=g.useState(K),he=Ye(ie),Ce=e.responseStateByChatSessionId[G??""]?.answer?.fetchState,we=g.useRef({}),ve=Ye(G),Ee=Ye(e.responseStateByChatSessionId[G??""]?.analysis?.fetchState),Se=e.responseStateByChatSessionId[G??""]?.analysis?.fetchState,$e=g.useRef(null),Be=Ye(je?.questionAnswers),Ae=Ye(e.responseStateByChatSessionId[G??""]?.answer?.fetchState),_e=Ye(e.stopSubmitStateByChatSessionId[G??""]?.fetchState),Te=e.stopSubmitStateByChatSessionId[G??""]?.fetchState,[Re,ke]=g.useState({}),Oe=g.useRef({});g.useEffect(()=>{if(!de||G==null)return;const Xe=G,ft=je?.questionAnswers??[],oo=ft.length-1,To=ft[oo]?.questionAnswerId,kn=e.responseStateByChatSessionId[Xe??""]?.answer?.fetchState;Ae==="In-Progress"&&kn==="Completed"&&To&&Oe.current[Xe]!==To&&(ke(dn=>({...dn,[Xe]:To})),Oe.current[Xe]=To);const Dn=Array.isArray(Be)?Be:[],qt=Dn.length>0?Dn[Dn.length-1]?.questionAnswerId:null;To&&qt!==To&&ke(dn=>({...dn,[Xe]:null}))},[je,e.responseStateByChatSessionId,G,de,Be,Ae,Re]),g.useEffect(()=>{if(!(ve!==G||!de||G==null)&&(uK.forEach(Xe=>{if((me[G]?.[Xe]??!1)&&!we.current[uP(G,Xe)]){we.current[uP(G,Xe)]=!0;const oo=()=>{if($e.current){const on=$e.current;if(Xe==="answer")on.scrollTo({top:on.scrollTop+500,behavior:"smooth"});else{const To=on.scrollHeight-on.scrollTop-on.clientHeight<100;on.scrollTo({top:on.scrollHeight,behavior:To?"smooth":"auto"})}}};Xe==="thought"?setTimeout(oo,200):oo()}}),Ee!==Se&&Se==="In-Progress"&&$e.current)){const Xe=$e.current,ft=Xe.scrollHeight-Xe.scrollTop-Xe.clientHeight<100;Xe.scrollTo({top:Xe.scrollHeight,behavior:ft?"smooth":"auto"})}},[G,de,ve,Ee,Se,me]),g.useEffect(()=>{const Xe=e.uiState.scrollPositionByChatSessionId,ft=e.uiState.currentChatSessionId;if($e.current&&ft!=null){const oo=Xe[ft]?.scrollTop??null;typeof oo=="number"&&($e.current.scrollTop=oo)}},[e.uiState.currentChatSessionId,e.uiState.scrollPositionByChatSessionId]);const Me=g.useRef(t.debounce(Xe=>{D(Xe)},1e3,{trailing:!0})),Ie=g.useCallback((Xe,ft)=>{ne(Xe),le(),A(Xe,"user_input",ft)},[A,le]),Ne=Xe=>{Me.current(Xe.currentTarget.scrollTop),St(Xe.currentTarget)},Pe=Ce==="In-Progress"||ie,Qe=g.useRef(t.debounce(Xe=>{B(Xe)},300));g.useEffect(()=>{const Xe=Qe.current;return()=>{Xe.cancel()}},[]);const Je=g.useCallback((Xe,ft,oo)=>{if(Pe){Qe.current.cancel(),ye(Xe),B(Xe);return}ne(Xe),le(),A(Xe,ft,void 0,oo)},[A,Pe,le,B]);g.useEffect(()=>{he===!0&&ie===!1&&ne(null)},[he,ie]),g.useEffect(()=>{_e==="In-Progress"&&Te==="Completed"&&ye(K)},[_e,K,Te]),g.useLayoutEffect(()=>{Pe&&(Qe.current.cancel(),ye(Xe=>Xe===K?Xe:K))},[K,Pe]);const tt=Ye(m),[Ue,dt]=g.useState(!1),[ct,yt]=g.useState([]),{showScrollToBottom:He,handleScrollToBottom:jt,updateScrollToBottomOnScroll:St}=o7e($e),We=He&&!se&&!ie,nt=g.useCallback(()=>{const Xe=ct.length>0?ct.map(oo=>oo.file):void 0,ft=ge;Qe.current.cancel(),B(""),Ie(ft,Xe),ye(""),yt([])},[Ie,ge,ct,B]),ut=g.useCallback(()=>{dt(!1)},[]);g.useEffect(()=>{if(m==null||m===""||m===tt||x===!0&&Pe)return;const Xe=h??"email_link";Xe==="email_link"&&oe.trackAICFOChatScreenStateChanged("viewed","email_link",G??null,null),x===!0?(le(),ne(m),A(m,Xe,void 0,f)):(Qe.current.cancel(),ye(m),B(m),dt(!0)),M?.()},[m,tt,x,h,f,Pe,A,B,M,le,ye,dt,oe,G]);const pt=g.useCallback(Xe=>{ye(Xe),Qe.current(Xe)},[]),Bt=g.useCallback((Xe,ft)=>{Je(Xe,"question_card",ft)},[Je]),Ht=je?.chatSession.chatSessionSummary,$o=g.useCallback(()=>{R();const Xe=i?"minimize":"maximize";oe.trackAICFOChatScreenStateChanged(Xe,"left_menu",G??null,Ht??null)},[R,i,oe,G,Ht]),Tt=g.useCallback(()=>{E(),oe.trackAICFOChatScreenStateChanged("close","left_menu",G??null,Ht??null)},[E,oe,G,Ht]),Gt=Ht??i7e,so=()=>Z?de||n&&!d?t.jsxRuntimeExports.jsx(bK,{children:t.jsxRuntimeExports.jsx(h2t,{children:Gt})}):t.jsxRuntimeExports.jsx(bK,{children:t.jsxRuntimeExports.jsx(fK,{isFullView:!1,isMobile:!0})}):t.jsxRuntimeExports.jsx(fK,{isFullView:i,isMobile:!1}),no=()=>{if(se||ie)return t.jsxRuntimeExports.jsx(t7e,{isQuestionOnlyLoading:ie,pendingQuestionText:re,style:{width:Z?"auto":i?Yb.valuePx(W):"auto",padding:Z?`0 ${o.sp3}`:void 0,margin:Z?"0":i?"0 auto":`0 ${o.sp8}`}});if(Z){if(d&&!de)return t.jsxRuntimeExports.jsx(pP,{windowSize:W,isFullView:!1,isMobile:!0,children:t.jsxRuntimeExports.jsx(yK,{isFullView:!1,isMobile:!0,children:gK(!1,!0,H)})});if(n&&!de)return t.jsxRuntimeExports.jsx(pP,{windowSize:W,isFullView:!1,isMobile:!0,isMobileNewChat:!0,children:t.jsxRuntimeExports.jsxs(d2t,{children:[t.jsxRuntimeExports.jsx(jK,{children:`${_N} ${H}`}),t.jsxRuntimeExports.jsx(jK,{children:ON})]})})}return t.jsxRuntimeExports.jsx(pP,{windowSize:W,isFullView:i,isMobile:Z,showExploreDesktop:!Z&&i&&d,children:!Z&&d&&(i||!de)?t.jsxRuntimeExports.jsx(yK,{isFullView:i,isMobile:!1,children:gK(i,!1,H)}):de?je?.questionAnswers.map((Xe,ft)=>{const oo=ft===je?.questionAnswers.length-1,on=!!(oo&&G!=null&&Re[G]===Xe.questionAnswerId),kn=oo?e.responseStateByChatSessionId[G??""]:{thought:{fetchState:"Completed",error:void 0},analysis:{fetchState:"Completed",error:void 0},reasoning:{fetchState:"Completed",error:void 0},answer:{fetchState:"Completed",error:void 0},fetchStatus:{fetchState:"Completed",error:void 0}},Dn=e.uiState.cotCollapsedByQuestionAnswerId[Xe.questionAnswerId]??!1;return t.jsxRuntimeExports.jsx(e7e,{enableTypingEffect:on,enableCotTypingEffect:oo,isCotCollapsed:Dn,isFullView:Z?!1:i,aiCfoAnswer:Xe,responseState:kn,currentChatSession:ce,tableDownloadEndPoint:u,onCopy:S,onThumbsUp:k,onThumbsDown:T,onQuestionClick:Je,onToggleCotCollapsed:I,handleChainOfThoughtTypingDoneForScrollPurpose:ae},Xe.questionAnswerId)}):null})};return t.jsxRuntimeExports.jsxs(o2t,{isFullView:i,windowSize:W,isMobile:Z,children:[t.jsxRuntimeExports.jsx(Rt,{showMenuIcon:Z,onClickMenuIcon:Z?F:void 0,rightSideComponent:t.jsxRuntimeExports.jsx(e2t,{hasActiveChat:de,isFullView:i,isMobile:Z,onCloseClick:Tt,onNewChatClick:$,togglePageView:$o}),title:so(),leftSideComponent:Z?void 0:t.jsxRuntimeExports.jsx(y2t,{}),leftComponentStyle:Z?void 0:{width:o.sp4,flex:`0 0 ${o.sp4}`},middleComponentStyle:Z?void 0:{width:"auto",flex:"1 1 auto",justifyContent:"flex-start",minWidth:0},rightComponentStyle:Z?void 0:{width:"auto",flex:"0 0 auto",marginLeft:"auto",paddingRight:o.sp5},scrollableContent:$e,ignoreScrollAction:$e.current==null,backgroundColor:V.colors.grey4,style:{zIndex:3,...Z?{}:{minHeight:o.sp8,height:o.sp8}},titleStyle:Z?{marginLeft:o.sp2}:{width:"100%",marginLeft:0,justifyContent:"flex-start",textAlign:"left"},navBarContainerStyles:Z?{alignItems:"center",justifyContent:"space-between",paddingTop:o.sp2,paddingBottom:o.sp0}:{alignItems:"center",justifyContent:"space-between",paddingTop:o.sp3,paddingBottom:o.sp3},navBarContentContainerStyles:Z?void 0:{margin:o.sp0,minHeight:o.sp8,height:o.sp8},source:Z?"AiCfoPageMobile":"AiCfoPage",hideSearchBtn:!0}),t.jsxRuntimeExports.jsxs(R6e,{children:[t.jsxRuntimeExports.jsx(n2t,{ref:$e,onScroll:Ne,children:no()}),We&&t.jsxRuntimeExports.jsx(v6e,{$centeredColumnWidthPx:i&&!Z?Yb.valuePx(W):void 0,$height:$6e})]}),t.jsxRuntimeExports.jsxs(s2t,{isFullView:i,isMobile:Z,children:[We&&t.jsxRuntimeExports.jsx(k6e,{onClick:jt,children:t.jsxRuntimeExports.jsx(n7e,{})}),ue?t.jsxRuntimeExports.jsx(i2t,{isFullView:i,isMobile:Z,windowSize:W,children:pQ(Z,Bt,q,{chipsJustify:!Z&&i?"center":"flex-start",isSuggestedQuestionsLoading:C===!0,narrowMobileLoadingSkeleton:!0,collapseExtraSuggestions:!i||Z})}):null,t.jsxRuntimeExports.jsx(r2t,{windowSize:W,isFullView:i,isMobile:Z,children:t.jsxRuntimeExports.jsx(aQ,{currentInput:ge,isSubmitting:Pe,formId:uQ(Ggt),isFileUploadEnabled:a,initialUploadingFiles:r,selectedFiles:ct,name:"input",aiAgentName:s7e,shouldFocus:Ue,onFocusComplete:ut,openOnboardingPage:L,onFilesChange:yt,onSubmit:nt,onStopSubmit:P,onInputChange:pt,isUploadPromoVisible:l,onUploadPromoClose:c})})]})]})},o2t=s.div`
4341
4341
  display: flex;
4342
4342
  flex-direction: column;
4343
4343
  align-items: stretch;
@@ -4537,7 +4537,7 @@ Initiate your first transfer to start earning yield.`,insuredFundsTooltip:"Secur
4537
4537
  &:hover {
4538
4538
  background-color: ${e=>e.theme.colors.grey3};
4539
4539
  }
4540
- `,xP=({Icon:e,title:n,onClick:i})=>t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:n,arrow:!0,enterDelay:Jr,disableIntersectionObserver:!0,children:t.jsxRuntimeExports.jsx(I2t,{onClick:i,children:t.jsxRuntimeExports.jsx(e,{})})}),T2t=({aiCfoView:e,isNewChatSession:n,showSampleQuestions:i,tableDownloadEndPoint:r,emailLinkQuestion:a,autoSubmitEmailLinkQuestion:l,onCloseClick:c,onNewChatClick:d,togglePageView:u,onCopy:m,onThumbsUp:x,onThumbsDown:h,onSubmit:f,onToggleCotCollapsed:y,updateCurrentInput:C,openOnboardingPage:b,onStopSubmit:E,onUpdateScrollYOffset:$,onEmailLinkQuestionProcessed:R,isFileUploadEnabled:S=!1,isUploadPromoVisible:k=!1,onUploadPromoClose:T,suggestedQuestionsOverride:A=[],suggestedQuestionsLoading:I=!1,aiCfoSidePanelQuestionToSubmit:B=null,setAiCfoSidePanelQuestionToSubmit:L=k2t})=>{const P=t.useTheme(),{useDynamicConfig:D}=Dc(),{configValue:M}=D(Fx.aiCfoMessageDynamicConfig),F=Array.isArray(M?.default_message_list)?M.default_message_list:[],V=A.length>0?A:F.length>0?F:[C2t,b2t,w2t],H=ro().analytics,W=e.uiState.currentChatSessionId,U=e.uiState.currentInput,Y=e.createSessionAndSubmitState.fetchState==="In-Progress",q=W==null||e.uiState.chatHistoryNextPageToken[W]==null,Z=!n&&q,[G,K]=g.useState(null),[,J]=g.useState({}),[oe,ee]=g.useState(U),[te,se]=g.useState([]),[ie,re]=g.useState(!1),ne=g.useRef(null),{showScrollToBottom:me,handleScrollToBottom:pe,updateScrollToBottomOnScroll:je}=o7e(ne),ce=me&&!Z&&!Y,de=g.useRef(t.debounce(Qe=>{$(Qe)},1e3,{trailing:!0})),ue=g.useRef(t.debounce(Qe=>{C(Qe)},300)),[le]=Rn("AiStar"),ae=W!=null?e.allSessionsWithOrderedQuestionAnswers.find(Qe=>Qe.chatSession.chatSessionId===W):null,ge=(ae?.questionAnswers.length??0)>0,ye=ae?.chatSession,he=ae?.chatSession.chatSessionSummary,Ce=g.useCallback(()=>{W!=null&&J(Qe=>({...Qe,[W]:{answer:!1,thought:!1,reasoning:!1,analysis:!1}}))},[W]),we=g.useCallback((Qe,dt)=>{K(Qe),Ce(),f(Qe,"user_input",dt)},[f,Ce]),ve=e.responseStateByChatSessionId[W??""]?.answer?.fetchState,Ee=Ye(e.responseStateByChatSessionId[W??""]?.analysis?.fetchState),Se=e.responseStateByChatSessionId[W??""]?.analysis?.fetchState,$e=ve==="In-Progress"||Y,Be=ge||G!=null||Y||ve==="In-Progress";g.useLayoutEffect(()=>{B==null||B===""||G==null&&(K(B),L(null))},[B,G,L]),g.useLayoutEffect(()=>{$e&&(ue.current.cancel(),ee(Qe=>Qe===U?Qe:U))},[U,$e]);const Ae=g.useCallback((Qe,dt,ct)=>{if($e){ue.current.cancel(),ee(Qe),C(Qe);return}K(Qe),Ce(),f(Qe,dt,void 0,ct)},[f,$e,Ce,C]),_e=g.useCallback((Qe,dt)=>{Ae(Qe,"question_card",dt)},[Ae]),Te=g.useCallback(()=>{u(),H.trackAICFOChatScreenStateChanged("maximize","left_menu",W??null,he??null)},[u,H,W,he]),Re=g.useCallback(()=>{c(),H.trackAICFOChatScreenStateChanged("close","left_menu",W??null,he??null)},[c,H,W,he]);g.useEffect(()=>{const Qe=ue.current,dt=de.current;return()=>{Qe.cancel(),dt.cancel()}},[]);const ke=Ye(Y);g.useEffect(()=>{ke===!0&&Y===!1&&K(null)},[ke,Y]);const Oe=Ye(a);g.useEffect(()=>{if(!(a==null||a===""||a===Oe)){if(l===!0){if($e)return;Ce(),f(a,"email_link")}else ue.current.cancel(),ee(a),C(a),re(!0);R?.()}},[a,Oe,l,$e,f,C,R,Ce]);const Me=g.useCallback(Qe=>{ee(Qe),ue.current(Qe)},[]),Ie=g.useCallback(()=>{const Qe=te.length>0?te.map(ct=>ct.file):void 0,dt=oe;ue.current.cancel(),C(""),we(dt,Qe),ee(""),se([])},[we,oe,te,C]),Ne=g.useCallback(()=>{re(!1)},[]),Pe=g.useCallback(Qe=>{de.current(Qe.currentTarget.scrollTop),je(Qe.currentTarget)},[je]);g.useEffect(()=>{if(Ee!==Se&&Se==="In-Progress"&&ne.current!=null){const Qe=ne.current,dt=Qe.scrollHeight-Qe.scrollTop-Qe.clientHeight<100;Qe.scrollTo({top:Qe.scrollHeight,behavior:dt?"smooth":"auto"})}},[Ee,Se]);const Ue=n&&!ge&&G!=null,Je=()=>Z||Y||Ue?t.jsxRuntimeExports.jsx(t7e,{isQuestionOnlyLoading:Y||Ue,pendingQuestionText:G,style:{width:"auto"}}):ge?ae?.questionAnswers.map((Qe,dt)=>{const ct=dt===(ae?.questionAnswers.length??0)-1,yt=ct?e.responseStateByChatSessionId[W??""]??{}:{thought:{fetchState:"Completed",error:void 0},analysis:{fetchState:"Completed",error:void 0},reasoning:{fetchState:"Completed",error:void 0},answer:{fetchState:"Completed",error:void 0},fetchStatus:{fetchState:"Completed",error:void 0}},He=e.uiState.cotCollapsedByQuestionAnswerId[Qe.questionAnswerId]??!1;return t.jsxRuntimeExports.jsx(e7e,{enableTypingEffect:!1,enableCotTypingEffect:ct,isCotCollapsed:He,isFullView:!1,aiCfoAnswer:Qe,responseState:yt,currentChatSession:ye,tableDownloadEndPoint:r,onCopy:m,onThumbsUp:x,onThumbsDown:h,onQuestionClick:Ae,onToggleCotCollapsed:y,handleChainOfThoughtTypingDoneForScrollPurpose:()=>{}},Qe.questionAnswerId)})??null:null,tt=t.jsxRuntimeExports.jsxs(O2t,{children:[t.jsxRuntimeExports.jsx(Xg,{children:le!=null?t.jsxRuntimeExports.jsx(IT,{animationData:le,play:!0,loop:!0}):t.jsxRuntimeExports.jsx(z2t,{})}),t.jsxRuntimeExports.jsx(F2t,{children:j2t??$K})]});return t.jsxRuntimeExports.jsxs(L2t,{children:[t.jsxRuntimeExports.jsx(Rt,{showMenuIcon:!1,hideMiddleSection:!0,leftSideComponent:tt,title:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),leftComponentStyle:{width:"auto",flex:"0 0 auto"},rightComponentStyle:{width:"auto",marginLeft:"auto"},rightSideComponent:t.jsxRuntimeExports.jsxs(_2t,{children:[ge?t.jsxRuntimeExports.jsx(xP,{Icon:H2t,title:S2t,onClick:d}):null,t.jsxRuntimeExports.jsx(xP,{Icon:N2t,title:v2t,onClick:Te}),t.jsxRuntimeExports.jsx(xP,{Icon:W2t,title:R2t,onClick:Re})]}),navBarContentContainerStyles:{margin:`${o.sp0} ${o.sp3}`},scrollableContent:ne,ignoreScrollAction:ne.current==null,backgroundColor:P.colors.grey4,style:{zIndex:3},source:"AiCfoSidePanel",hideSearchBtn:!0}),t.jsxRuntimeExports.jsxs(R6e,{children:[t.jsxRuntimeExports.jsx(S6e,{ref:ne,onScroll:Pe,children:t.jsxRuntimeExports.jsx(B2t,{children:Je()})}),ce&&t.jsxRuntimeExports.jsx(v6e,{$height:$6e})]}),i&&!Be?t.jsxRuntimeExports.jsx(P2t,{children:pQ(!0,_e,V,{chipsJustify:"flex-start",isSuggestedQuestionsLoading:I===!0,loadingSkeletonDesktopWidthPct:Ygt,collapseExtraSuggestions:!0})}):null,t.jsxRuntimeExports.jsxs(M2t,{children:[ce&&t.jsxRuntimeExports.jsx(k6e,{onClick:pe,children:t.jsxRuntimeExports.jsx(n7e,{})}),t.jsxRuntimeExports.jsx(D2t,{children:t.jsxRuntimeExports.jsx(aQ,{currentInput:oe,isSubmitting:$e,formId:uQ(A2t),hideFooter:!1,isFileUploadEnabled:S,selectedFiles:te,name:"input",aiAgentName:$K,shouldFocus:ie,onFocusComplete:Ne,openOnboardingPage:b,onFilesChange:se,onSubmit:Ie,onStopSubmit:E,onInputChange:Me,isUploadPromoVisible:k,onUploadPromoClose:T})})]})]})},L2t=s.div`
4540
+ `,xP=({Icon:e,title:n,onClick:i})=>t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:n,arrow:!0,enterDelay:Jr,disableIntersectionObserver:!0,children:t.jsxRuntimeExports.jsx(I2t,{onClick:i,children:t.jsxRuntimeExports.jsx(e,{})})}),T2t=({aiCfoView:e,isNewChatSession:n,showSampleQuestions:i,tableDownloadEndPoint:r,emailLinkQuestion:a,autoSubmitEmailLinkQuestion:l,onCloseClick:c,onNewChatClick:d,togglePageView:u,onCopy:m,onThumbsUp:x,onThumbsDown:h,onSubmit:f,onToggleCotCollapsed:y,updateCurrentInput:C,openOnboardingPage:b,onStopSubmit:E,onUpdateScrollYOffset:$,onEmailLinkQuestionProcessed:R,isFileUploadEnabled:S=!1,isUploadPromoVisible:k=!1,onUploadPromoClose:T,suggestedQuestionsOverride:A=[],suggestedQuestionsLoading:I=!1,aiCfoSidePanelQuestionToSubmit:B=null,setAiCfoSidePanelQuestionToSubmit:L=k2t})=>{const P=t.useTheme(),{useDynamicConfig:D}=Dc(),{configValue:M}=D(Fx.aiCfoMessageDynamicConfig),F=Array.isArray(M?.default_message_list)?M.default_message_list:[],V=A.length>0?A:F.length>0?F:[C2t,b2t,w2t],H=ro().analytics,W=e.uiState.currentChatSessionId,U=e.uiState.currentInput,Y=e.createSessionAndSubmitState.fetchState==="In-Progress",q=W==null||e.uiState.chatHistoryNextPageToken[W]==null,Z=!n&&q,[G,K]=g.useState(null),[,J]=g.useState({}),[oe,ee]=g.useState(U),[te,se]=g.useState([]),[ie,re]=g.useState(!1),ne=g.useRef(null),{showScrollToBottom:me,handleScrollToBottom:pe,updateScrollToBottomOnScroll:je}=o7e(ne),ce=me&&!Z&&!Y,de=g.useRef(t.debounce(Ue=>{$(Ue)},1e3,{trailing:!0})),ue=g.useRef(t.debounce(Ue=>{C(Ue)},300)),[le]=Rn("AiStar"),ae=W!=null?e.allSessionsWithOrderedQuestionAnswers.find(Ue=>Ue.chatSession.chatSessionId===W):null,ge=(ae?.questionAnswers.length??0)>0,ye=ae?.chatSession,he=ae?.chatSession.chatSessionSummary,Ce=g.useCallback(()=>{W!=null&&J(Ue=>({...Ue,[W]:{answer:!1,thought:!1,reasoning:!1,analysis:!1}}))},[W]),we=g.useCallback((Ue,dt)=>{K(Ue),Ce(),f(Ue,"user_input",dt)},[f,Ce]),ve=e.responseStateByChatSessionId[W??""]?.answer?.fetchState,Ee=Ye(e.responseStateByChatSessionId[W??""]?.analysis?.fetchState),Se=e.responseStateByChatSessionId[W??""]?.analysis?.fetchState,$e=ve==="In-Progress"||Y,Be=ge||G!=null||Y||ve==="In-Progress";g.useLayoutEffect(()=>{B==null||B===""||G==null&&(K(B),L(null))},[B,G,L]),g.useLayoutEffect(()=>{$e&&(ue.current.cancel(),ee(Ue=>Ue===U?Ue:U))},[U,$e]);const Ae=g.useCallback((Ue,dt,ct)=>{if($e){ue.current.cancel(),ee(Ue),C(Ue);return}K(Ue),Ce(),f(Ue,dt,void 0,ct)},[f,$e,Ce,C]),_e=g.useCallback((Ue,dt)=>{Ae(Ue,"question_card",dt)},[Ae]),Te=g.useCallback(()=>{u(),H.trackAICFOChatScreenStateChanged("maximize","left_menu",W??null,he??null)},[u,H,W,he]),Re=g.useCallback(()=>{c(),H.trackAICFOChatScreenStateChanged("close","left_menu",W??null,he??null)},[c,H,W,he]);g.useEffect(()=>{const Ue=ue.current,dt=de.current;return()=>{Ue.cancel(),dt.cancel()}},[]);const ke=Ye(Y);g.useEffect(()=>{ke===!0&&Y===!1&&K(null)},[ke,Y]);const Oe=Ye(a);g.useEffect(()=>{if(!(a==null||a===""||a===Oe)){if(l===!0){if($e)return;Ce(),f(a,"email_link")}else ue.current.cancel(),ee(a),C(a),re(!0);R?.()}},[a,Oe,l,$e,f,C,R,Ce]);const Me=g.useCallback(Ue=>{ee(Ue),ue.current(Ue)},[]),Ie=g.useCallback(()=>{const Ue=te.length>0?te.map(ct=>ct.file):void 0,dt=oe;ue.current.cancel(),C(""),we(dt,Ue),ee(""),se([])},[we,oe,te,C]),Ne=g.useCallback(()=>{re(!1)},[]),Pe=g.useCallback(Ue=>{de.current(Ue.currentTarget.scrollTop),je(Ue.currentTarget)},[je]);g.useEffect(()=>{if(Ee!==Se&&Se==="In-Progress"&&ne.current!=null){const Ue=ne.current,dt=Ue.scrollHeight-Ue.scrollTop-Ue.clientHeight<100;Ue.scrollTo({top:Ue.scrollHeight,behavior:dt?"smooth":"auto"})}},[Ee,Se]);const Qe=n&&!ge&&G!=null,Je=()=>Z||Y||Qe?t.jsxRuntimeExports.jsx(t7e,{isQuestionOnlyLoading:Y||Qe,pendingQuestionText:G,style:{width:"auto"}}):ge?ae?.questionAnswers.map((Ue,dt)=>{const ct=dt===(ae?.questionAnswers.length??0)-1,yt=ct?e.responseStateByChatSessionId[W??""]??{}:{thought:{fetchState:"Completed",error:void 0},analysis:{fetchState:"Completed",error:void 0},reasoning:{fetchState:"Completed",error:void 0},answer:{fetchState:"Completed",error:void 0},fetchStatus:{fetchState:"Completed",error:void 0}},He=e.uiState.cotCollapsedByQuestionAnswerId[Ue.questionAnswerId]??!1;return t.jsxRuntimeExports.jsx(e7e,{enableTypingEffect:!1,enableCotTypingEffect:ct,isCotCollapsed:He,isFullView:!1,aiCfoAnswer:Ue,responseState:yt,currentChatSession:ye,tableDownloadEndPoint:r,onCopy:m,onThumbsUp:x,onThumbsDown:h,onQuestionClick:Ae,onToggleCotCollapsed:y,handleChainOfThoughtTypingDoneForScrollPurpose:()=>{}},Ue.questionAnswerId)})??null:null,tt=t.jsxRuntimeExports.jsxs(O2t,{children:[t.jsxRuntimeExports.jsx(Xg,{children:le!=null?t.jsxRuntimeExports.jsx(IT,{animationData:le,play:!0,loop:!0}):t.jsxRuntimeExports.jsx(z2t,{})}),t.jsxRuntimeExports.jsx(F2t,{children:j2t??$K})]});return t.jsxRuntimeExports.jsxs(L2t,{children:[t.jsxRuntimeExports.jsx(Rt,{showMenuIcon:!1,hideMiddleSection:!0,leftSideComponent:tt,title:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),leftComponentStyle:{width:"auto",flex:"0 0 auto"},rightComponentStyle:{width:"auto",marginLeft:"auto"},rightSideComponent:t.jsxRuntimeExports.jsxs(_2t,{children:[ge?t.jsxRuntimeExports.jsx(xP,{Icon:H2t,title:S2t,onClick:d}):null,t.jsxRuntimeExports.jsx(xP,{Icon:N2t,title:v2t,onClick:Te}),t.jsxRuntimeExports.jsx(xP,{Icon:W2t,title:R2t,onClick:Re})]}),navBarContentContainerStyles:{margin:`${o.sp0} ${o.sp3}`},scrollableContent:ne,ignoreScrollAction:ne.current==null,backgroundColor:P.colors.grey4,style:{zIndex:3},source:"AiCfoSidePanel",hideSearchBtn:!0}),t.jsxRuntimeExports.jsxs(R6e,{children:[t.jsxRuntimeExports.jsx(S6e,{ref:ne,onScroll:Pe,children:t.jsxRuntimeExports.jsx(B2t,{children:Je()})}),ce&&t.jsxRuntimeExports.jsx(v6e,{$height:$6e})]}),i&&!Be?t.jsxRuntimeExports.jsx(P2t,{children:pQ(!0,_e,V,{chipsJustify:"flex-start",isSuggestedQuestionsLoading:I===!0,loadingSkeletonDesktopWidthPct:Ygt,collapseExtraSuggestions:!0})}):null,t.jsxRuntimeExports.jsxs(M2t,{children:[ce&&t.jsxRuntimeExports.jsx(k6e,{onClick:pe,children:t.jsxRuntimeExports.jsx(n7e,{})}),t.jsxRuntimeExports.jsx(D2t,{children:t.jsxRuntimeExports.jsx(aQ,{currentInput:oe,isSubmitting:$e,formId:uQ(A2t),hideFooter:!1,isFileUploadEnabled:S,selectedFiles:te,name:"input",aiAgentName:$K,shouldFocus:ie,onFocusComplete:Ne,openOnboardingPage:b,onFilesChange:se,onSubmit:Ie,onStopSubmit:E,onInputChange:Me,isUploadPromoVisible:k,onUploadPromoClose:T})})]})]})},L2t=s.div`
4541
4541
  display: flex;
4542
4542
  flex-direction: column;
4543
4543
  align-items: stretch;
@@ -6650,7 +6650,7 @@ Initiate your first transfer to start earning yield.`,insuredFundsTooltip:"Secur
6650
6650
  &:hover {
6651
6651
  color: ${v.primaryDark};
6652
6652
  }
6653
- `;function Y9({title:e,file:n,imageAltText:i="invoice",documentType:r,setShowFullScreenView:a,onCrossClick:l}){const c=X(),d=["social_security_card","passport","driving_license","id_document"];return t.jsxRuntimeExports.jsx(t6t,{windowSize:c,role:"presentation",children:t.jsxRuntimeExports.jsxs(o6t,{windowSize:c,children:[t.jsxRuntimeExports.jsxs(n6t,{children:[t.jsxRuntimeExports.jsx(s6t,{children:e}),t.jsxRuntimeExports.jsxs(i6t,{children:[t.jsxRuntimeExports.jsx(r6t,{onClick:()=>m6t(n.fileDownloadUrl.href,n.fileName),"data-testid":_("download-file",n.fileName),children:t.jsxRuntimeExports.jsx(d6t,{})}),t.jsxRuntimeExports.jsx(a6t,{onClick:()=>l(),"data-testid":_("close-upload-view",n.fileName),children:t.jsxRuntimeExports.jsx(u6t,{})})]})]}),n.contentType=="application/pdf"?t.jsxRuntimeExports.jsx(Zb,{fileUrl:n.fileDownloadUrl.href,isFullScreen:!0,onCrossClick:l,setShowFullScreenView:a}):p6t.includes(n.contentType??"")?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>l(),children:t.jsxRuntimeExports.jsx(c6t,{isPersonalId:r!=null?d.includes(r):!1,children:t.jsxRuntimeExports.jsx("img",{src:n.fileDownloadUrl.href,alt:i})})}):null]})})}const p6t=["image/jpeg","image/jpg","image/png"];async function m6t(e,n){const i=`${e}`,r=O.getLocalizedStrings().downloadReport;try{const a=await t.fetch(i);if(a.ok){const l=await a.arrayBuffer();t.fileDownload(l,n)}else console.error(`${r.reportErrorMessage} ${a.statusText}`)}catch(a){console.error(`${r.reportErrorMessage} ${JSON.stringify(a)}`)}}const x6t=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M13 13H3C2.73478 13 2.48043 12.8946 2.29289 12.7071C2.10536 12.5196 2 12.2652 2 12V5C2 4.73478 2.10536 4.48043 2.29289 4.29289C2.48043 4.10536 2.73478 4 3 4H5L6 2.5H10L11 4H13C13.2652 4 13.5196 4.10536 13.7071 4.29289C13.8946 4.48043 14 4.73478 14 5V12C14 12.2652 13.8946 12.5196 13.7071 12.7071C13.5196 12.8946 13.2652 13 13 13Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M8 10.5C9.24264 10.5 10.25 9.49264 10.25 8.25C10.25 7.00736 9.24264 6 8 6C6.75736 6 5.75 7.00736 5.75 8.25C5.75 9.49264 6.75736 10.5 8 10.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),$i=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M6 13.5H3C2.86739 13.5 2.74021 13.4473 2.64645 13.3535C2.55268 13.2598 2.5 13.1326 2.5 13V10.2069C2.50006 10.0744 2.55266 9.94743 2.64625 9.85374L10.3538 2.14624C10.4475 2.05254 10.5746 1.99991 10.7072 1.99991C10.8397 1.99991 10.9669 2.05254 11.0606 2.14624L13.8538 4.93749C13.9474 5.03125 14.0001 5.15837 14.0001 5.29093C14.0001 5.42348 13.9474 5.55061 13.8538 5.64436L6 13.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M13.5 13.5H6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M8.5 4L12 7.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),lJ=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M8 9V2",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M13.5 9V13H2.5V9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M5.5 4.5L8 2L10.5 4.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}));function cJ(e){return e.split("_").map(i=>YV(i)).join("")}const j2={applicableBorderWidthForSmall:new w(1,0),nonApplicableBorderWidthForSmall:new w(0,1),uploadTagPaddingLeft:new w(0,p[4]),photoTagPaddingLeft:new w(0,36)},h6t={infoLabel:new Ke("smallMedium","smallMedium")},mu=({name:e,companyOfficerName:n,deleteFileStatusById:i,updateFileStatusById:r,filesEndPoint:a,authParams:l,filemetadataPayload:c,file:d,officerIndex:u,registerOptions:m,shouldDisplay:x=!0,acceptableTypes:h,supportedImageFileFormat:f,isDisabled:y=!1,placeholderText:C,sizeLimit:b,hasError:E,showPhotoPicker:$,errorInfoLabel:R,useMobileCam:S,showUploadSuccessAnimation:k=!0,showWebCamPopUpCloseIcon:T=!0,compressImage:A=!1,autoOpenFilePicker:I=!1,simulateUploading:B=!1,updateFilesEntity:L,onDeleteFile:P,onEditFileName:D,onClick:M,onFileSizeError:F,openPopup:V,accountStatementUpload:N})=>{const H=X(),W=g.useRef(null),U=g.useRef(null),[Y,q]=g.useState(B),[Z,G]=g.useState(()=>B?"application/pdf":""),[K,J]=g.useState(!1),[oe,ee]=g.useState(()=>B?15e5:0),[te,se]=g.useState(!1),[ie,re]=g.useState(!1),[ne,me]=g.useState(!1),pe=Ye(I),{control:je,formState:{errors:ce},getValues:de,setValue:ue}=t.useFormContext(),le=t.has(ce,e)||E===!0,{fileElementPicker:ae}=O.getLocalizedStrings().common;g.useEffect(()=>{(pe===!1||pe===void 0)&&I===!0&&ne===!1&&W.current?.files?.length===0&&(me(!0),W?.current.click(),N?.onUploadWindowOpenedOnce())},[I,ne,N,pe]);const ge=()=>{W.current!=null&&W.current.files?.length===0&&(me(!0),W.current.click())};g.useEffect(()=>{const Ae=()=>{ne&&me(!1)};return window.addEventListener("focus",Ae),()=>{window.removeEventListener("focus",Ae)}},[ne]);const ye=()=>{U.current?.click()};async function he(Ae,_e,Te){let Re;if(!Y){let ke=Ae;(A||S&&Be)&&Ae.size>kpt&&(ke=await $Ct(Ae,$e())),q(!0),G(ke.type||"image/png"),ee(ke.size),N!=null&&N.metadataPayload!=null?(N?.onUploadStart(),await N.uploadHelper(N.metadataPayload.accountType,Ae,l).then(Oe=>{if(Oe!==void 0&&(J(!0),Re=setTimeout(()=>{J(!1),q(!1)},2e3),N?.onUploadSuccess(Oe),Oe.files!=null))return Te(Q.mapFilePayloadToFile(Oe.files[0]))}).catch(Oe=>{console.error(Oe),q(!1),N?.onUploadError(Oe)})):c!=null&&(await Q.uploadFile(ke,c,a,l).then(Oe=>{if(Oe!==void 0){J(!0),Re=setTimeout(()=>{J(!1),q(!1)},2e3),L?.(Oe);const Me=_e.split(".")[0],Ie=u!=null?`${Me}.${u}.fileIds`:`${Me}.fileIds`,Ne=de(Ie),Pe=Oe.map(Ue=>Ue.file_id);return ue(Ie,Ne?.concat(Pe)),Oe.forEach(Ue=>Te(Q.mapFilePayloadToFile(Ue)))}}),Re==null&&q(!1))}}const Ce=(Ae,_e,Te)=>{const Re=Ae.target.files;return Re!=null?Array.from(Re).slice(0,10).map(ke=>he?.(ke,_e,Te)):""},we=(Ae,_e,Te)=>{const Re=Ae.dataTransfer.files;return Re!=null?Array.from(Re).slice(0,10).map(ke=>h?.includes(Tpt(ke.type))===!0?he?.(ke,_e,Te):(N?.onUploadError(new Error(ae.formatNotSupported)),"")):""},ve=(Ae,_e)=>{b!=null&&Ae.dataTransfer.files[0].size<=b?we(Ae,e,_e):(F?.(!0),N?.onUploadError(new Error(ae.sizeLimit)))},Ee=function(Ae){Ae.preventDefault(),Ae.stopPropagation(),Ae.type==="dragenter"||Ae.type==="dragover"?se(!0):Ae.type==="dragleave"&&te&&se(!1)},Se=Ae=>{V?.(Ae),re(Ae)},$e=()=>{const Ae=CN(n?.firstName??""),_e=YV(n?.lastName??""),Te=`${Ae}${_e}`;let Re;return Te!==""?Re=`${Ae}${_e}_${cJ(c?.documentType??"driving_license")}_${c?.documentSide??"front"}`:Re=`${cJ(c?.documentType??"driving_license")}_${c?.documentSide??"front"}`,Re},{isMobileOrTabletScreen:Be}=W5();return t.jsxRuntimeExports.jsxs(B6t,{windowSize:H,shouldDisplay:x,"data-labeled-document-control":"","data-disabled":y?"true":void 0,children:[t.jsxRuntimeExports.jsxs(L6t,{children:[t.jsxRuntimeExports.jsxs(J7e,{justifyContent:!1,style:{gap:o.sp1,position:"relative"},actionInProgress:Y,isDisabled:y,shouldDisplay:Y,children:[Y&&!K?t.jsxRuntimeExports.jsx(P6t,{duration:DCt(oe)}):null,t.jsxRuntimeExports.jsx(X7e,{isDisabled:y,style:{zIndex:2},children:t.jsxRuntimeExports.jsx(ebe,{contentType:Q.toSupportedFileTypeStrict(Z)})}),t.jsxRuntimeExports.jsx(gv,{isPlaceholderText:!1,style:{zIndex:2},className:"fileText",isDisabled:y,children:O.getLocalizedStrings().commonSetUp.businessVerification.uploading}),k&&K?t.jsxRuntimeExports.jsx(G9,{styles:{position:"absolute",right:o.sp2},width:52,shouldDisplay:!0,animationInLoop:1}):null]}),t.jsxRuntimeExports.jsx(C6t,{name:e,file:d,onDeleteFile:P,officerIndex:u,onEditFileName:D,shouldDisplay:!Y&&d!=null,deleteFileStatusById:i,updateFileStatusById:r,isDisabled:y,disablePreview:y&&d?.documentType==="social_security_card",onFileSizeError:F}),t.jsxRuntimeExports.jsx(t.Controller,{name:e,control:je,defaultValue:d,rules:m,"data-testid":_("file-photo-picker",e),render:({field:{value:Ae,onChange:_e}})=>$===!0?t.jsxRuntimeExports.jsxs(y6t,{shouldDisplay:!Y&&d==null,windowSize:H,isDisabled:y,children:[t.jsxRuntimeExports.jsx(S6t,{windowSize:H,children:t.jsxRuntimeExports.jsxs(k6t,{className:"uploadTagAlongPhotoPicker",windowSize:H,"data-testid":_("upload-tag-with-photo-picker",e),onClick:Te=>{Te.stopPropagation(),!y&&(M!=null?M():ge())},isError:le,onDragEnter:Ee,onDragLeave:Ee,onDragOver:Ee,onDrop:Te=>{Te.preventDefault(),Te.stopPropagation(),se(!1),ve(Te,_e)},children:[t.jsxRuntimeExports.jsx(EP,{children:t.jsxRuntimeExports.jsx(lJ,{height:o.sp3,width:o.sp3,className:"uploadIconStyled"})}),t.jsxRuntimeExports.jsx(gv,{isPlaceholderText:!0,className:"textContent",isDisabled:y,children:C??O.getLocalizedStrings().commonSetUp.businessVerification.dropDocumentPlaceholder}),t.jsxRuntimeExports.jsx(yu,{name:e,value:Ae?.filename,fileRef:W,sizeLimit:b,acceptableTypes:h,onFileSizeError:F,onFileChange:async Te=>{Ce(Te,e,_e)},multiple:!1})]})}),t.jsxRuntimeExports.jsx(f6t,{className:"attachFileSeparator",windowSize:H,isError:le}),t.jsxRuntimeExports.jsx(A6t,{windowSize:H,children:t.jsxRuntimeExports.jsxs(j6t,{className:"photoTag",isError:le,windowSize:H,"data-testid":_("photo-tag",e),onClick:Te=>{Te.stopPropagation(),y===!1&&(M!=null?M():S&&Be?ye():Se(!0))},children:[t.jsxRuntimeExports.jsx(EP,{children:t.jsxRuntimeExports.jsx(x6t,{height:o.sp3,width:o.sp3,className:"cameraIconStyled"})}),t.jsxRuntimeExports.jsx(g6t,{children:"Take a photo"}),S&&Be?t.jsxRuntimeExports.jsx(BCt,{name:e,fileRef:U,sizeLimit:b,acceptableTypes:h,onFileSizeError:F,onImageChange:Te=>{he(Te,e,_e)},multiple:!1}):ie===!0?Ns.createPortal(t.jsxRuntimeExports.jsx(aCt,{onCancelClick:()=>{Se(!1)},onImageChange:Te=>{he(Te,e,_e)},showWebCamPopUpCloseIcon:T,filemetadataPayload:c,filename:$e(),supportedImageFileFormat:f}),document.body):null]})})]}):t.jsxRuntimeExports.jsxs(I6t,{className:"uploadTag",windowSize:H,onClick:Te=>{Te.stopPropagation(),!y&&(M!=null?M():ge())},"data-testid":_("upload-tag",e),shouldDisplay:!Y&&d==null,isError:le,onDragEnter:Ee,onDragLeave:Ee,onDragOver:Ee,onDrop:Te=>{Te.preventDefault(),Te.stopPropagation(),se(!1),ve(Te,_e)},children:[M==null&&t.jsxRuntimeExports.jsx(EP,{children:t.jsxRuntimeExports.jsx(lJ,{height:o.sp3,width:o.sp3,className:"uploadIconStyled"})}),t.jsxRuntimeExports.jsx(gv,{isPlaceholderText:!0,className:"textContent",isDisabled:y,children:C??O.getLocalizedStrings().commonSetUp.businessVerification.dropDocumentPlaceholder}),t.jsxRuntimeExports.jsx(yu,{name:e,value:Ae?.filename,fileRef:W,sizeLimit:b,acceptableTypes:h,onFileSizeError:F,onFileChange:async Te=>{Ce(Te,e,_e)},multiple:!1})]})})]}),le&&R?t.jsxRuntimeExports.jsx(dJ,{size:H,isError:le,children:R}):null,N&&N.errorMessage?t.jsxRuntimeExports.jsx(dJ,{size:H,isError:!0,style:{paddingTop:o.sp2,paddingRight:o.sp0},children:N.errorMessage}):null]})},g6t=s(be)``,f6t=s.div`
6653
+ `;function Y9({title:e,file:n,imageAltText:i="invoice",documentType:r,setShowFullScreenView:a,onCrossClick:l}){const c=X(),d=["social_security_card","passport","driving_license","id_document"];return t.jsxRuntimeExports.jsx(t6t,{windowSize:c,role:"presentation",children:t.jsxRuntimeExports.jsxs(o6t,{windowSize:c,children:[t.jsxRuntimeExports.jsxs(n6t,{children:[t.jsxRuntimeExports.jsx(s6t,{children:e}),t.jsxRuntimeExports.jsxs(i6t,{children:[t.jsxRuntimeExports.jsx(r6t,{onClick:()=>m6t(n.fileDownloadUrl.href,n.fileName),"data-testid":_("download-file",n.fileName),children:t.jsxRuntimeExports.jsx(d6t,{})}),t.jsxRuntimeExports.jsx(a6t,{onClick:()=>l(),"data-testid":_("close-upload-view",n.fileName),children:t.jsxRuntimeExports.jsx(u6t,{})})]})]}),n.contentType=="application/pdf"?t.jsxRuntimeExports.jsx(Zb,{fileUrl:n.fileDownloadUrl.href,isFullScreen:!0,onCrossClick:l,setShowFullScreenView:a}):p6t.includes(n.contentType??"")?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>l(),children:t.jsxRuntimeExports.jsx(c6t,{isPersonalId:r!=null?d.includes(r):!1,children:t.jsxRuntimeExports.jsx("img",{src:n.fileDownloadUrl.href,alt:i})})}):null]})})}const p6t=["image/jpeg","image/jpg","image/png"];async function m6t(e,n){const i=`${e}`,r=O.getLocalizedStrings().downloadReport;try{const a=await t.fetch(i);if(a.ok){const l=await a.arrayBuffer();t.fileDownload(l,n)}else console.error(`${r.reportErrorMessage} ${a.statusText}`)}catch(a){console.error(`${r.reportErrorMessage} ${JSON.stringify(a)}`)}}const x6t=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M13 13H3C2.73478 13 2.48043 12.8946 2.29289 12.7071C2.10536 12.5196 2 12.2652 2 12V5C2 4.73478 2.10536 4.48043 2.29289 4.29289C2.48043 4.10536 2.73478 4 3 4H5L6 2.5H10L11 4H13C13.2652 4 13.5196 4.10536 13.7071 4.29289C13.8946 4.48043 14 4.73478 14 5V12C14 12.2652 13.8946 12.5196 13.7071 12.7071C13.5196 12.8946 13.2652 13 13 13Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M8 10.5C9.24264 10.5 10.25 9.49264 10.25 8.25C10.25 7.00736 9.24264 6 8 6C6.75736 6 5.75 7.00736 5.75 8.25C5.75 9.49264 6.75736 10.5 8 10.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),$i=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M6 13.5H3C2.86739 13.5 2.74021 13.4473 2.64645 13.3535C2.55268 13.2598 2.5 13.1326 2.5 13V10.2069C2.50006 10.0744 2.55266 9.94743 2.64625 9.85374L10.3538 2.14624C10.4475 2.05254 10.5746 1.99991 10.7072 1.99991C10.8397 1.99991 10.9669 2.05254 11.0606 2.14624L13.8538 4.93749C13.9474 5.03125 14.0001 5.15837 14.0001 5.29093C14.0001 5.42348 13.9474 5.55061 13.8538 5.64436L6 13.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M13.5 13.5H6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M8.5 4L12 7.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),lJ=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M8 9V2",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M13.5 9V13H2.5V9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M5.5 4.5L8 2L10.5 4.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}));function cJ(e){return e.split("_").map(i=>YV(i)).join("")}const j2={applicableBorderWidthForSmall:new w(1,0),nonApplicableBorderWidthForSmall:new w(0,1),uploadTagPaddingLeft:new w(0,p[4]),photoTagPaddingLeft:new w(0,36)},h6t={infoLabel:new Ke("smallMedium","smallMedium")},mu=({name:e,companyOfficerName:n,deleteFileStatusById:i,updateFileStatusById:r,filesEndPoint:a,authParams:l,filemetadataPayload:c,file:d,officerIndex:u,registerOptions:m,shouldDisplay:x=!0,acceptableTypes:h,supportedImageFileFormat:f,isDisabled:y=!1,placeholderText:C,sizeLimit:b,hasError:E,showPhotoPicker:$,errorInfoLabel:R,useMobileCam:S,showUploadSuccessAnimation:k=!0,showWebCamPopUpCloseIcon:T=!0,compressImage:A=!1,autoOpenFilePicker:I=!1,simulateUploading:B=!1,updateFilesEntity:L,onDeleteFile:P,onEditFileName:D,onClick:M,onFileSizeError:F,openPopup:V,accountStatementUpload:N})=>{const H=X(),W=g.useRef(null),U=g.useRef(null),[Y,q]=g.useState(B),[Z,G]=g.useState(()=>B?"application/pdf":""),[K,J]=g.useState(!1),[oe,ee]=g.useState(()=>B?15e5:0),[te,se]=g.useState(!1),[ie,re]=g.useState(!1),[ne,me]=g.useState(!1),pe=Ye(I),{control:je,formState:{errors:ce},getValues:de,setValue:ue}=t.useFormContext(),le=t.has(ce,e)||E===!0,{fileElementPicker:ae}=O.getLocalizedStrings().common;g.useEffect(()=>{(pe===!1||pe===void 0)&&I===!0&&ne===!1&&W.current?.files?.length===0&&(me(!0),W?.current.click(),N?.onUploadWindowOpenedOnce())},[I,ne,N,pe]);const ge=()=>{W.current!=null&&W.current.files?.length===0&&(me(!0),W.current.click())};g.useEffect(()=>{const Ae=()=>{ne&&me(!1)};return window.addEventListener("focus",Ae),()=>{window.removeEventListener("focus",Ae)}},[ne]);const ye=()=>{U.current?.click()};async function he(Ae,_e,Te){let Re;if(!Y){let ke=Ae;(A||S&&Be)&&Ae.size>kpt&&(ke=await $Ct(Ae,$e())),q(!0),G(ke.type||"image/png"),ee(ke.size),N!=null&&N.metadataPayload!=null?(N?.onUploadStart(),await N.uploadHelper(N.metadataPayload.accountType,Ae,l).then(Oe=>{if(Oe!==void 0&&(J(!0),Re=setTimeout(()=>{J(!1),q(!1)},2e3),N?.onUploadSuccess(Oe),Oe.files!=null))return Te(Q.mapFilePayloadToFile(Oe.files[0]))}).catch(Oe=>{console.error(Oe),q(!1),N?.onUploadError(Oe)})):c!=null&&(await Q.uploadFile(ke,c,a,l).then(Oe=>{if(Oe!==void 0){J(!0),Re=setTimeout(()=>{J(!1),q(!1)},2e3),L?.(Oe);const Me=_e.split(".")[0],Ie=u!=null?`${Me}.${u}.fileIds`:`${Me}.fileIds`,Ne=de(Ie),Pe=Oe.map(Qe=>Qe.file_id);return ue(Ie,Ne?.concat(Pe)),Oe.forEach(Qe=>Te(Q.mapFilePayloadToFile(Qe)))}}),Re==null&&q(!1))}}const Ce=(Ae,_e,Te)=>{const Re=Ae.target.files;return Re!=null?Array.from(Re).slice(0,10).map(ke=>he?.(ke,_e,Te)):""},we=(Ae,_e,Te)=>{const Re=Ae.dataTransfer.files;return Re!=null?Array.from(Re).slice(0,10).map(ke=>h?.includes(Tpt(ke.type))===!0?he?.(ke,_e,Te):(N?.onUploadError(new Error(ae.formatNotSupported)),"")):""},ve=(Ae,_e)=>{b!=null&&Ae.dataTransfer.files[0].size<=b?we(Ae,e,_e):(F?.(!0),N?.onUploadError(new Error(ae.sizeLimit)))},Ee=function(Ae){Ae.preventDefault(),Ae.stopPropagation(),Ae.type==="dragenter"||Ae.type==="dragover"?se(!0):Ae.type==="dragleave"&&te&&se(!1)},Se=Ae=>{V?.(Ae),re(Ae)},$e=()=>{const Ae=CN(n?.firstName??""),_e=YV(n?.lastName??""),Te=`${Ae}${_e}`;let Re;return Te!==""?Re=`${Ae}${_e}_${cJ(c?.documentType??"driving_license")}_${c?.documentSide??"front"}`:Re=`${cJ(c?.documentType??"driving_license")}_${c?.documentSide??"front"}`,Re},{isMobileOrTabletScreen:Be}=W5();return t.jsxRuntimeExports.jsxs(B6t,{windowSize:H,shouldDisplay:x,"data-labeled-document-control":"","data-disabled":y?"true":void 0,children:[t.jsxRuntimeExports.jsxs(L6t,{children:[t.jsxRuntimeExports.jsxs(J7e,{justifyContent:!1,style:{gap:o.sp1,position:"relative"},actionInProgress:Y,isDisabled:y,shouldDisplay:Y,children:[Y&&!K?t.jsxRuntimeExports.jsx(P6t,{duration:DCt(oe)}):null,t.jsxRuntimeExports.jsx(X7e,{isDisabled:y,style:{zIndex:2},children:t.jsxRuntimeExports.jsx(ebe,{contentType:Q.toSupportedFileTypeStrict(Z)})}),t.jsxRuntimeExports.jsx(gv,{isPlaceholderText:!1,style:{zIndex:2},className:"fileText",isDisabled:y,children:O.getLocalizedStrings().commonSetUp.businessVerification.uploading}),k&&K?t.jsxRuntimeExports.jsx(G9,{styles:{position:"absolute",right:o.sp2},width:52,shouldDisplay:!0,animationInLoop:1}):null]}),t.jsxRuntimeExports.jsx(C6t,{name:e,file:d,onDeleteFile:P,officerIndex:u,onEditFileName:D,shouldDisplay:!Y&&d!=null,deleteFileStatusById:i,updateFileStatusById:r,isDisabled:y,disablePreview:y&&d?.documentType==="social_security_card",onFileSizeError:F}),t.jsxRuntimeExports.jsx(t.Controller,{name:e,control:je,defaultValue:d,rules:m,"data-testid":_("file-photo-picker",e),render:({field:{value:Ae,onChange:_e}})=>$===!0?t.jsxRuntimeExports.jsxs(y6t,{shouldDisplay:!Y&&d==null,windowSize:H,isDisabled:y,children:[t.jsxRuntimeExports.jsx(S6t,{windowSize:H,children:t.jsxRuntimeExports.jsxs(k6t,{className:"uploadTagAlongPhotoPicker",windowSize:H,"data-testid":_("upload-tag-with-photo-picker",e),onClick:Te=>{Te.stopPropagation(),!y&&(M!=null?M():ge())},isError:le,onDragEnter:Ee,onDragLeave:Ee,onDragOver:Ee,onDrop:Te=>{Te.preventDefault(),Te.stopPropagation(),se(!1),ve(Te,_e)},children:[t.jsxRuntimeExports.jsx(EP,{children:t.jsxRuntimeExports.jsx(lJ,{height:o.sp3,width:o.sp3,className:"uploadIconStyled"})}),t.jsxRuntimeExports.jsx(gv,{isPlaceholderText:!0,className:"textContent",isDisabled:y,children:C??O.getLocalizedStrings().commonSetUp.businessVerification.dropDocumentPlaceholder}),t.jsxRuntimeExports.jsx(yu,{name:e,value:Ae?.filename,fileRef:W,sizeLimit:b,acceptableTypes:h,onFileSizeError:F,onFileChange:async Te=>{Ce(Te,e,_e)},multiple:!1})]})}),t.jsxRuntimeExports.jsx(f6t,{className:"attachFileSeparator",windowSize:H,isError:le}),t.jsxRuntimeExports.jsx(A6t,{windowSize:H,children:t.jsxRuntimeExports.jsxs(j6t,{className:"photoTag",isError:le,windowSize:H,"data-testid":_("photo-tag",e),onClick:Te=>{Te.stopPropagation(),y===!1&&(M!=null?M():S&&Be?ye():Se(!0))},children:[t.jsxRuntimeExports.jsx(EP,{children:t.jsxRuntimeExports.jsx(x6t,{height:o.sp3,width:o.sp3,className:"cameraIconStyled"})}),t.jsxRuntimeExports.jsx(g6t,{children:"Take a photo"}),S&&Be?t.jsxRuntimeExports.jsx(BCt,{name:e,fileRef:U,sizeLimit:b,acceptableTypes:h,onFileSizeError:F,onImageChange:Te=>{he(Te,e,_e)},multiple:!1}):ie===!0?Ns.createPortal(t.jsxRuntimeExports.jsx(aCt,{onCancelClick:()=>{Se(!1)},onImageChange:Te=>{he(Te,e,_e)},showWebCamPopUpCloseIcon:T,filemetadataPayload:c,filename:$e(),supportedImageFileFormat:f}),document.body):null]})})]}):t.jsxRuntimeExports.jsxs(I6t,{className:"uploadTag",windowSize:H,onClick:Te=>{Te.stopPropagation(),!y&&(M!=null?M():ge())},"data-testid":_("upload-tag",e),shouldDisplay:!Y&&d==null,isError:le,onDragEnter:Ee,onDragLeave:Ee,onDragOver:Ee,onDrop:Te=>{Te.preventDefault(),Te.stopPropagation(),se(!1),ve(Te,_e)},children:[M==null&&t.jsxRuntimeExports.jsx(EP,{children:t.jsxRuntimeExports.jsx(lJ,{height:o.sp3,width:o.sp3,className:"uploadIconStyled"})}),t.jsxRuntimeExports.jsx(gv,{isPlaceholderText:!0,className:"textContent",isDisabled:y,children:C??O.getLocalizedStrings().commonSetUp.businessVerification.dropDocumentPlaceholder}),t.jsxRuntimeExports.jsx(yu,{name:e,value:Ae?.filename,fileRef:W,sizeLimit:b,acceptableTypes:h,onFileSizeError:F,onFileChange:async Te=>{Ce(Te,e,_e)},multiple:!1})]})})]}),le&&R?t.jsxRuntimeExports.jsx(dJ,{size:H,isError:le,children:R}):null,N&&N.errorMessage?t.jsxRuntimeExports.jsx(dJ,{size:H,isError:!0,style:{paddingTop:o.sp2,paddingRight:o.sp0},children:N.errorMessage}):null]})},g6t=s(be)``,f6t=s.div`
6654
6654
  border-width: ${o.sp0};
6655
6655
  border-style: dashed;
6656
6656
  border-color: ${e=>e.isError?v.important:e.theme.colors.grey2};
@@ -13332,7 +13332,7 @@ Initiate your first transfer to start earning yield.`,insuredFundsTooltip:"Secur
13332
13332
  gap: ${o.sp4};
13333
13333
  align-items: center;
13334
13334
  overflow: scroll;
13335
- `;function YQ(e){const{companyName:n,vendor:i,amount:r,paymentType:a,paymentDate:l,isInvoiceAttached:c=!1,containerWidth:d="85vw"}=e,u=X(),m=t.useTheme(),x=O.getLocalizedStrings().spendManagement.billPay.billDetails.magicLink.emailPreview,h=a.replace("International Wire","Wire").replace("Domestic Wire","Wire"),f=x.signature.replace(/<company_name>/,n),y=(c?x.content:x.contentNoAttachment).replace(/<company_name>/g,n).replace(/<payment_type>/,h).replace(/<vendor_name>/,i??"").replace(/<bill_due_date>/,l).replace(/<amount>/,r),C=x.subjectContent.replace(/<company_name>/,n).replace(/<amount>/,r),b=x.buttonText.replace(/<payment_type>/,h),E={background:m.colors.primary,color:m.colors.grey5,borderColor:m.colors.primary,cursor:"default"};return t.jsxRuntimeExports.jsxs(ATt,{size:u,width:d,children:[t.jsxRuntimeExports.jsx(STt,{size:u,onClick:e.onClose,"data-testid":_("vendor-email-preview-close-icon")}),t.jsxRuntimeExports.jsx(wTt,{children:x.title}),t.jsxRuntimeExports.jsxs(bTt,{size:u,children:[t.jsxRuntimeExports.jsx(ETt,{children:x.subjectLabel}),t.jsxRuntimeExports.jsx($Tt,{children:C})]}),t.jsxRuntimeExports.jsxs(CTt,{size:u,children:[t.jsxRuntimeExports.jsx(IX,{children:y}),t.jsxRuntimeExports.jsx(vTt,{children:t.jsxRuntimeExports.jsx(Ge,{style:E,variant:"primary",label:b,"data-testid":_("vendor-email-preview-button",h)})}),t.jsxRuntimeExports.jsx(IX,{children:f}),t.jsxRuntimeExports.jsx(RTt,{children:t.jsxRuntimeExports.jsx(Fr,{height:o.sp4})})]})]})}const tf=(e,n)=>`${e}.${n}`,eM="toAccountVendorEmail",e3={labelWidth:new w(120,160,160),largeLabelWidth:new w(140,180,180),largeLabelPickerWidth:new w(100,180,180),paddingBottom:new w(p[3],p[2]),marginBottom:new w(p[3],p[3]),autoFillIconLeft:new w(-6,-p[4]),marginTop:new w(p[2],p[0]),paddingRight:new w(p[2],p[3]),labelMarginRight:new w(p[0],p[3]),textPadding:new w(p[0],p[3]),additionalTextMarginTop:new w(-p[1],0),labelMarginLeftPicker:new w(p[3],p[4]),labelMarginRightPicker:new w(p[3],p[4]),labelMarginTopPicker:new w(p[2],p[2]),labeledFieldPaddingLeft:new w(p[0],p[0]),labeledFieldPaddingRight:new w(p[2],p[2]),labeledFieldPaddingTop:new w(p[2],p[2]),labeledFieldPaddingBottom:new w(p[2],p[2]),infoLabelPaddingRight:new w(p[0],p[3]),infoLabelMarginTop:new w(p[1],p[0])},{spendManagement:{billPay:{billDetails:sr,vendorCreation:za,paymentDetails:uw,insufficientFunds:kTt,paymentDetails:{accountsPromoSection:TX}}},commonSetUp:ITt,common:{currency:kh,strings:{empty:Dd,dividerDot:tM},texts:LX},dateFormat:XN}=O.getLocalizedStrings(),TTt=e=>{const{onInternationalWireVerifyClick:n,isVendorNameError:i,isInternationalPaymentShaVsOurEnabled:r,vendorId:a,showMarkAsPaidInfo:l,vendorName:c,totalAmount:d,allPaymentMethods:u,paymentToOptions:m,withdrawFromList:x,vendor:h,companyName:f,paymentDetails:y,analytics:C,billDueDate:b,sectionId:E,isBillPayCommentingEnabled:$,isDisabled:R,style:S,autoFields:k=[],isBillMarkedForRetry:T,isPayNowEnabled:A,isShaDisabled:I,isOurDisabled:B,isCollectFromVendor:L,vendorContactSaveStatus:P,isMagicLinkFeatureEnabled:D,isRecurringBillsFeatureEnabled:M,isRecurringBill:F,recurringBillInstances:V,isDraftBill:N,isInvoiceAttached:H,paymentType:W,totalAmountWithFees:U,recurringBillConfig:Y,isAccountsEnabled:q,isAdmin:Z,billId:G,isEligibleForRetryOBP:K,accountsPromoConfig:J,internationalVerificationStatus:oe,lowBalanceAdditionalInfo:ee,isDetectInsufficientFundsEnabled:te,plaidConnectionDetails:se,paymentAccount:ie,onFetchLinkTokenClick:re,onEstablishConnectionSuccess:ne,onEstablishConnectionClick:me,onUpdatePaymentAccountStatus:pe,onAttachmentClick:je,addVendorContactEmail:ce,onClickAddAccount:de,onSignUpAccountClick:ue,onMoveMoneyClick:le,isNewUser:ae,isSameDayACHEnabled:ge,sameDayAchDisablementConfig:ye}=e,he=t.useTheme(),Ce=X(),we=ht(),ve=Ki(),[Ee,Se]=g.useState(!1),[$e,Be]=g.useState(!1),[Ae,_e]=g.useState(void 0),Te=()=>Be(!1),Re=()=>{C?.trackBillPayMagicLinkPreviewEmail("edit_bill"),Be(!0)},{setValue:ke,getValues:Oe}=t.useFormContext(),Me=t.useForm(),Ie=g.useRef(null),[Ne,Pe]=g.useState(!1),Ue={application:"dashboard",companyId:we.currentTenant?.companyId,tab:"bill",entityId:G},Je=`dashboard_${we.currentTenant?.companyId}`,tt=$&&G!=null;g.useEffect(()=>{P?.fetchState==="Completed"&&(ke(`${E}.paymentTo`,{selectedOption:y?.paymentTo?.id,allOptions:m?.map($t=>$t.id)}),Se(!1))},[P?.fetchState]),g.useEffect(()=>{if(y?.paymentDate!=null&&y.paymentType!=null){const $t=Q.zeniDate(Q.getNextNthWorkingDay(y.paymentDate.toDate(),[0,6],y.paymentType.maxPeriod.value).toDateString());_e($t)}},[y?.paymentDate,y?.paymentType,y?.paymentType?.maxPeriod.value]),g.useEffect(()=>{W?.method!==Oe(`${E}.paymentType`)?.method&&ke(`${E}.paymentType`,W)},[y?.withdrawFrom?.accType]);const Qe=ud(y?.paymentType?.method??"").replace("Same Day",""),dt=XN.visual.MMMDCommaYYYYformat,ct=ITt.setUp.accountsPlg,yt=sr.paymentOutsideZeni,He=e3.labelWidth.value(Ce),jt=e3.largeLabelWidth.value(Ce),St=$t=>m.find(bo=>bo.id===$t),We=$t=>rL(St($t)),nt=()=>{let $t=[];W?.method.includes("wire")===!0?W?.method.includes("international")?$t=m.filter(mt=>mt.type==="PaymentInstrument"&&d.amount>=mt.minValidAmount&&(mt.maxValidAmount==null||d.amount<=mt.maxValidAmount)).map(mt=>mt.id):$t=m.filter(mt=>!!mt.bankRoutingNumberWireTransfer).map(mt=>mt.id):$t=m.filter(mt=>!!mt.bankRoutingNumberAch).map(mt=>mt.id);const bo=W?.method.includes("international")===!0&&h?.vendorCurrencyCode!==kh.currencyCode?[]:m.filter(mt=>mt.type==="Contact").map(mt=>mt.id);return $t=[...$t,...bo],$t},ut=()=>m.filter($t=>$t.type==="Contact")?.length>0,pt=$t=>m.find(bo=>bo.id===$t)?.type==="Contact",Bt=$t=>{const bo=St($t);return W?.method.includes("ach")===!0?t.jsxRuntimeExports.jsxs(oM,{children:[t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.bankRoutingNumber}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankRoutingNumberAch??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.bankName}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankName??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.bankAccountNumber}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankAccountNumber??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.accountTypeLabel}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankAccountType!=null&&bo.bankAccountType!==""?m5(bo.bankAccountType.toLowerCase()):za.emptyPlaceholderString})]})]}):W?.method.includes("wire")===!0?W?.method.includes("international")===!0?t.jsxRuntimeExports.jsx(oM,{children:bo?.piLabels.map(mt=>t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsxs(sh,{children:[mt.name,uw.colon]}),t.jsxRuntimeExports.jsx(ih,{children:mt.value})]},mt.name))}):t.jsxRuntimeExports.jsxs(oM,{children:[t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.wireDetails.bankRoutingNumber}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankRoutingNumberWireTransfer??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.bankName}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankName??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.wireDetails.accountNumber}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankAccountNumber??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.accountTypeLabel}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankAccountType!=null&&bo.bankAccountType!==""?m5(bo.bankAccountType.toLowerCase()):za.emptyPlaceholderString})]})]}):""},Ht=y?.paymentTo,$o=y?.paymentTo?.type==="BankAccount"?sr.addedByZeni:D&&L?t.jsxRuntimeExports.jsx(GQ,{paymentTypeLabel:Qe,onClick:Re,style:{marginTop:`${Ce==="small"?o.sp2:o.sp0}`}}):void 0,Tt=()=>{Se(!0)},Gt=()=>W!=null&&Ht?.type==="Contact"&&y?.paymentDate!=null?t.jsxRuntimeExports.jsx(Pbe,{paymentType:W?.method,paymentDate:y?.paymentDate}):null,so=$t=>{$t[eM]&&a!=null&&ce?.($t[eM],a)},no=u.filter($t=>$t.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)),Xe=u.filter($t=>!Q.isPaymentMethodOutsideZeni($t.method)&&$t.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)===!1),ft=F?[]:u.filter($t=>Q.isPaymentMethodOutsideZeni($t.method)),oo=no.find($t=>$t.method.includes(Q.SWIFT_OUR_INTERNATIONAL_METHOD_SUBTEXT)&&$t.method.includes(y?.withdrawFrom?.accType??"depositAccount")),on=oo!=null?[...Xe,oo,...ft]:[...Xe,...ft],To=(h?.vendorCurrencyCode===kh.currencyCode?on:oo!=null?[oo]:[]).filter($t=>Q.isPaymentMethodOutsideZeni($t.method)||$t.method.includes(y?.withdrawFrom?.accType??"depositAccount")),kn=sr.recurringBill.paymentTypeOptions,Dn=$t=>{if(ee!=null)return ee;const bo=x.find(mt=>mt.id===$t);return te&&bo?.accountBalance?.available!=null&&Q.checkIfLowBalance(U,bo?.accountBalance?.available)?kTt.addMoney:""},qt=Q.isPaymentMethodOutsideZeni(y?.paymentType?.method),[dn,Zs]=g.useState(void 0),Yn=se.link_account,Hs=se.update_account,yn=dn==="update_account"?Hs:Yn,[Go,ds]=g.useState(yn.linkToken??null),[In,ts]=g.useState(!1),pn=Ye(Yn.updateStatus.fetchState),_s=Ye(Hs.updateStatus.fetchState),us=ie?.isLoginRequired??!1,xn=ie?.providerVerificationStatus?.code,As=g.useCallback(($t,bo)=>{const mt=bo.accounts.find(Qt=>Qt.id===ie?.providerAccountId)??bo.accounts[0];ie?.paymentAccountId!=null&&dn==="update_account"&&mt?.verification_status!=null&&!us?pe(mt?.verification_status,ie.paymentAccountId,"update_account"):me($t,dn),Zs(void 0),ts(!1)},[ie?.paymentAccountId,ie?.providerAccountId,dn,us,pe,me]),nn=g.useCallback(($t,bo)=>{$t!=null&&($t.error_code==="TOO_MANY_VERIFICATION_ATTEMPTS"&&ie?.paymentAccountId!=null&&pe("verification_failed",ie.paymentAccountId,"update_account"),console.log("Plaid Connection Error",$t,bo)),Zs(void 0),ts(!1)},[ie?.paymentAccountId,pe]),{open:os,ready:qe}=Pc.usePlaidLink({token:Go,onSuccess:As,onExit:nn});g.useEffect(()=>{(pn==="In-Progress"&&Yn.updateStatus.fetchState==="Completed"||_s==="In-Progress"&&Hs.updateStatus.fetchState==="Completed")&&(Q.isVerifiedPaymentAccountProviderStatusCode(xn??"")||(re("link_account"),ne()))},[Yn.updateStatus.fetchState,ne,re,pn,_s,Hs.updateStatus.fetchState,xn]),g.useEffect(()=>{(Q.isVerifiedStatusCode(xn??"")||xn==="verification_failed")&&!In&&dn!=null&&yn.linkToken===Go&&yn.fetchStatus.fetchState==="Completed"&&qe&&ts(!0)},[qe,Go,yn.fetchStatus.fetchState,yn.linkToken,xn,dn,In]),g.useEffect(()=>{yn.fetchStatus.fetchState==="Completed"&&yn.linkToken!=null&&yn.linkToken!==Go&&ds(yn.linkToken)},[yn.fetchStatus.fetchState,yn.linkToken,Go]),g.useEffect(()=>{In&&os()},[In,os]),g.useEffect(()=>{(xn==null||xn==="verification_failed"||xn==="verification_expired"||Q.isVerifiedStatusCode(xn))&&(Q.zeniDate(new Date().toISOString()).isAfter(Yn.expiration)||Yn.linkToken==null)&&re("link_account")},[]);const xt=y?.withdrawFrom==null||y?.withdrawFrom?.accType==="paymentAccount",Wt=y?.withdrawFrom?.accType==="depositAccount"?ye.disablementAmountThresholdInternal:ye.disablementAmountThresholdExternal,Ze=d.amount>Wt,Mo=y?.withdrawFrom?.accountBalance?.available?.amount!=null&&y?.withdrawFrom?.accType==="paymentAccount"&&y?.withdrawFrom?.accountBalance?.available?.amount<2*U.amount,Lo=y?.withdrawFrom?.accType==="depositAccount"&&y?.withdrawFrom.accountBalance!=null&&y.withdrawFrom.accountBalance.available!=null&&y.withdrawFrom.accountBalance.available.amount<U.amount,_n=ge===!0&&(Ze===!0||Mo===!0)||ge===!1&&ae===!0,ns=$t=>{switch($t){case TX.signupButtonText:ue?.();break;case TX.switchButtonText:Ie.current!=null&&Ie.current.focus();break}},en=(()=>{if(ge===!0){if(Ze){const $t=Ao(ki(Wt??1e5),Wt,kh.currencySymbol).toUpperCase();return uw.sameDayAchExtraInfo.transferLimitExceededText.replace("__amount__",$t)}if(Mo)return uw.sameDayAchExtraInfo.insufficientBalanceError}else if(ae)return uw.sameDayAchExtraInfo.newAtZeniText;return""})(),On=tf(E,"paymentType");return g.useEffect(()=>{const $t=W?.method==="billPay_ach_sameDay_depositAccount"||W?.method==="billPay_ach_sameDay_paymentAccount";Pe(!!(_n&&$t&&en))},[_n,W?.method,en,On]),t.jsxRuntimeExports.jsxs(PTt,{style:S,children:[t.jsxRuntimeExports.jsx(t.Drawer,{anchor:"right",open:$e,onClose:Te,transitionDuration:250,"data-testid":_("vendor-email-preview-drawer"),children:t.jsxRuntimeExports.jsx(YQ,{companyName:f,vendor:c,paymentDate:y?.paymentDate?.format(dt)??"",paymentType:Qe,amount:Ao("0,0.[00]",d.amount,y?.paymentType?.fee.currencySymbol),isInvoiceAttached:H,onClose:Te})}),Ee?t.jsxRuntimeExports.jsx(t.FormProvider,{...Me,children:t.jsxRuntimeExports.jsx(Mbe,{description:sr.magicLink.popUp.description.replace(/<payment_type>/,Qe),isLoading:P?.fetchState==="In-Progress",onCancelClick:()=>Se(!1),onSaveClick:Me.handleSubmit(so),textFieldName:eM})}):null,t.jsxRuntimeExports.jsx(_Tt,{children:sr.paymentDetailsTitle}),a==null?t.jsxRuntimeExports.jsx(OTt,{windowSize:Ce,isAddAccountInError:i,children:sr.selectVendorBeforeScheduling}):t.jsxRuntimeExports.jsxs(MTt,{children:[k.includes("withdrawFrom")?t.jsxRuntimeExports.jsx(pw,{children:t.jsxRuntimeExports.jsx(xw,{windowSize:Ce,children:t.jsxRuntimeExports.jsx(mw,{})})}):null,qt?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:tt,entityId:G,dashboardTabKey:Yt({type:"details",key:"withdrawFrom"}),roomId:Je,companyId:we.currentTenant?.companyId??Dd,companyName:we.currentTenant?.companyName??Dd,dashboardOptionType:"bill",filterMetaData:{...Ue,entityType:`bill.details.${Qn("withdrawFrom")}`},fieldThreadTargetElement:ve?.sharedRef?.contentWrapperRef,children:t.jsxRuntimeExports.jsx(Bs,{selectRef:Ie,isDisabled:T===!0&&K===!0?"readonly":R,label:{label:sr.withdrawFrom,width:jt,style:{width:e3.largeLabelPickerWidth.value(Ce)}},style:{width:"auto",display:"flex",borderTop:`1px solid ${he.colors.grey2}`},infoLabelStyle:{textAlign:"right",paddingRight:e3.infoLabelPaddingRight.valuePx(Ce),marginTop:e3.infoLabelMarginTop.valuePx(Ce),color:v.brandColorGoldDark},singleSelectPickerField:{name:tf(E,"withdrawFrom"),placeholder:Io(sr.withdrawFrom),style:{position:"relative"},menuPortalTarget:typeof document<"u"?document.body:null,customStyleConfig:{menuPortal:$t=>({...$t,zIndex:he.zIndex?.tooltip!=null?he.zIndex.tooltip+1:2})},capitalizeOptions:!0,isOptionRemovable:!1,showTickIcon:!1,valueToLogo:($t,bo)=>Bx(x,$t,bo),valueToSubLabels:($t,bo)=>ju(x,$t,bo,te,U),defaultValue:{selectedOption:y?.withdrawFrom?.id,allOptions:x.map($t=>({label:$t.label,value:$t.id,isRecommended:$t.accType==="depositAccount"}))},textAlignment:"right",registerOptions:{required:!0,validate:$t=>$t!=null&&!!$t.selectedOption},showCreateOption:!0,onClickCreateOption:()=>{Zs("link_account"),Yn.linkToken==null||Q.zeniDate(new Date().toISOString()).isAfter(Yn.expiration)?re("link_account"):Go!==Yn.linkToken?ds(Yn.linkToken):In?os():ts(!0)}},valueToAdditionalLabel:Dn})}),xt?t.jsxRuntimeExports.jsx(GS,{heading:ct.heading,buttonText:q?ct.switchButtonText:ct.signUpButtonText,isAccountsEnabled:q,pageName:"Bill Pay Create",analytics:C,onSignUpClick:ue,onSwitchClick:()=>{Ie.current!=null&&Ie.current.focus()},accountsPromoConfig:J}):Lo?t.jsxRuntimeExports.jsx(GS,{heading:ct.moveMoneyHeading,buttonText:ct.moveMoneyButtonText,isAccountsEnabled:q,pageName:"Bill Pay Create",analytics:C,onMoveMoneyClick:le,accountsPromoConfig:J}):null,k.includes("paymentType")?t.jsxRuntimeExports.jsx(pw,{children:t.jsxRuntimeExports.jsx(xw,{windowSize:Ce,children:t.jsxRuntimeExports.jsx(mw,{})})}):null]}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:tt,entityId:G,dashboardTabKey:Yt({type:"details",key:"paymentType"}),roomId:Je,companyId:we.currentTenant?.companyId??Dd,companyName:we.currentTenant?.companyName??Dd,dashboardOptionType:"bill",filterMetaData:{...Ue,entityType:`bill.details.${Qn("paymentType")}`},fieldThreadTargetElement:ve?.sharedRef?.contentWrapperRef,children:t.jsxRuntimeExports.jsxs(LTt,{children:[t.jsxRuntimeExports.jsx(Abe,{label:{label:sr.paymentMethod,width:jt},style:{width:"auto"},errorInfoLabel:en,hasError:Ne,paymentSingleSelectField:{name:tf(E,"paymentType"),placeholder:sr.billTypeMethodPlaceholder,defaultValue:W,allPaymentMethods:To,isAdmin:Z,showAccountsPromoSection:xt,isAccountsEnabled:q,internationalVerificationStatus:oe,registerOptions:{required:!0,validate:$t=>{if($t==null)return!1;const bo=$t?.method;return _n&&(bo==="billPay_ach_sameDay_depositAccount"||bo==="billPay_ach_sameDay_paymentAccount")?en:!0}},shouldRemoveScroll:!0,onInternationalWireVerifyClick:n,showDisabledSameDayACHOption:_n,isNewUser:ae,isSameDayACHEnabled:ge,isTransferLimitExceeded:Ze,isInsufficientBalance:Mo,isDepositAccount:y?.withdrawFrom?.accType==="depositAccount",disablementAmountThreshold:Wt,onButtonClick:ns},isDisabled:T===!0?"readonly":R}),W!=null&&W.method.includes("international")===!0?h?.vendorCurrencyCode!==kh.currencyCode?t.jsxRuntimeExports.jsx(Ckt,{conversionRate:y?.conversionRate,currentTotal:d,homeCurrency:{currencyCode:kh.currencyCode,currencySymbol:kh.currencySymbol},paymentType:W}):r?t.jsxRuntimeExports.jsx(eTt,{isShaDisabled:I,isOurDisabled:B,invoiceTotalAmount:d.amount,name:tf(E,"internationalTransferFeeBearerPaymentMethod"),internationalMethods:no,internationalTransferFeeBearerPaymentMethodValue:y?.internationalTransferFeeBearerPaymentMethod}):W.fee.amount!==0?t.jsxRuntimeExports.jsx(fX,{paymentType:W,currentFee:d.amount}):null:W!=null&&W.fee.amount!==0?t.jsxRuntimeExports.jsx(fX,{paymentType:W,currentFee:d.amount}):null]})}),qt?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[R!=="readonly"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[k.includes("paymentDate")?t.jsxRuntimeExports.jsx(pw,{children:t.jsxRuntimeExports.jsx(xw,{windowSize:Ce,children:t.jsxRuntimeExports.jsx(mw,{})})}):null,t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:tt,entityId:G,dashboardTabKey:Yt({type:"details",key:"paymentDate"}),roomId:Je,companyId:we.currentTenant?.companyId??Dd,companyName:we.currentTenant?.companyName??Dd,dashboardOptionType:"bill",filterMetaData:{...Ue,entityType:`bill.details.${Qn("paymentDate")}`},fieldThreadTargetElement:ve?.sharedRef?.contentWrapperRef,children:t.jsxRuntimeExports.jsx(VAt,{name:tf(E,"paymentDate"),paymentDate:W==null?void 0:y?.paymentDate,receiveDate:Ae,billDueDate:W==null?void 0:b,numberOfBusinessDays:W?.maxPeriod.value??Q.PAYMENT_BUSINESS_DAYS,filterDaysIndex:[0,6],isDisabled:W==null||T===!0?"readonly":R,isPayNowEnabled:A,registerOptions:{required:!0,validate:$t=>T===!0?!0:!(A&&Q.zeniDate($t.toString()??"").isSameOrAfter(Q.dateNow(),"date")===!1||!A&&Q.zeniDate($t.toString()??"").isAfter(Q.dateNow(),"date")===!1)}})})]}):null,t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:tt,entityId:G,dashboardTabKey:Yt({type:"details",key:"paymentTo"}),roomId:Je,companyId:we.currentTenant?.companyId??Dd,companyName:we.currentTenant?.companyName??Dd,dashboardOptionType:"bill",filterMetaData:{...Ue,entityType:`bill.details.${Qn("paymentTo")}`},fieldThreadTargetElement:ve?.sharedRef?.contentWrapperRef,children:t.jsxRuntimeExports.jsxs(BTt,{shouldDisplay:!0,isLastItem:!M,children:[k.includes("paymentTo")?t.jsxRuntimeExports.jsx(pw,{children:t.jsxRuntimeExports.jsx(xw,{windowSize:Ce,children:t.jsxRuntimeExports.jsx(mw,{})})}):null,t.jsxRuntimeExports.jsx(ei,{label:{label:sr.paymentTo,width:jt},style:{width:"auto"},singleSelectField:{singleSelect:{name:tf(E,"paymentTo"),placeholder:sr.selectAccount,getTooltipInfo:Bt,menuPlacement:"top",maxMenuHeight:308,vendorName:c,isOptionRemovable:!1,showEyeIconOnSelect:!1,showVerifiedIcon:!0,isContactOption:pt,onClickCreateBankAccount:de,onClickCollectPaymentDetails:Tt,showAddBankAccountOption:!0,showCollectPaymentDetailsOption:D&&!ut()&&h?.vendorCurrencyCode===kh.currencyCode,getLabelForId:We,isDisabled:R},defaultValue:{selectedOption:W!=null?Ht?.id:"",allOptions:W!=null?nt():[]},registerOptions:{required:!0,validate:$t=>$t!=null&&$t.selectedOption!=null}},showContacts:D,isFunctional:W?.method!=null,additionalInfoLabel:$o})]})})]}),D?Gt():null,M||qt?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:tt,entityId:G,dashboardTabKey:Yt({type:"details",key:"recurringPaymentType"}),roomId:Je,companyId:we.currentTenant?.companyId??Dd,companyName:we.currentTenant?.companyName??Dd,dashboardOptionType:"bill",filterMetaData:{...Ue,entityType:`bill.details.${Qn("recurringPaymentType")}`},fieldThreadTargetElement:ve?.sharedRef?.contentWrapperRef,children:t.jsxRuntimeExports.jsxs(DTt,{children:[!N||qt?t.jsxRuntimeExports.jsx(Nn,{label:{label:sr.paymentType,width:He},labelStyles:{marginRight:e3.labelMarginRight.valuePx(Ce)},style:{width:"auto"},text:qQ(F,qt,Y?.currentInstance??1,Y?.totalPaymentCycles??0),additionalInfoLabel:ZQ(Ce,F,qt,Y)}):t.jsxRuntimeExports.jsx(ei,{label:{label:sr.recurringBill.paymentType,width:jt},singleSelectField:{singleSelect:{name:tf(E,"recurringPaymentType"),showValueEyeIcon:!1,showEyeIconOnSelect:!1,isOptionRemovable:!1},defaultValue:{selectedOption:F?kn[1]:kn[0],allOptions:kn}},isFunctional:Ae!=null,style:{width:"auto"}}),F?t.jsxRuntimeExports.jsx(KIt,{name:`${E}.${Wbe}`,startDate:Y?.isActive===!0?Y.startDate:Ae,currencySymbol:d.currencySymbol,recurringBillConfig:Y,recurringBillInstances:V,isInternationalPayment:y?.paymentType?.method.toLocaleLowerCase().includes("international"),onAttachmentClick:je}):null]})})}):null]}),qt&&l?t.jsxRuntimeExports.jsx(xd,{description:yt.banner.description,title:yt.banner.title,style:{marginTop:o.sp5,marginBottom:o.sp5},variant:"info"}):null]})},iL=(e,n)=>n==="small"?t.jsxRuntimeExports.jsxs(HTt,{children:[t.jsxRuntimeExports.jsxs(BX,{children:[Bx([e],e.id,!0),e.label]}),ju([e],e.id,!0,!1)]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(BX,{children:[Bx([e],e.id,!0),e.label,ju([e],e.id,!0,!1)]})}),rL=e=>e==null?"":e.email?`${sr.magicLink.collectFrom} ${e.email}`:e.bankAccountName?e.bankAccountName??"":e.bankName&&e.bankAccountNumber?`${e.bankName} ${sr.accountNameConnector} ${e.bankAccountNumber?.slice(e.bankAccountNumber.length-4)}`:e.bankName&&e.bankAccountIban!=null&&e.bankAccountIban?`${e.bankName} ${sr.accountNameConnector} ${e.bankAccountIban?.slice(e?.bankAccountIban?.length-4)}`:e.piName?`${e.piName}`:"",Vbe=(e,n,i,r,a,l)=>{let c=a;if(c?.method.includes("international")===!0){if(n&&l!==kh.currencyCode){const d=i.find(u=>u.method.includes(Q.LOCAL_CURRENCY_INTERNATIONAL_METHOD_SUBTEXT));d!=null&&(c=d)}else if(l===kh.currencyCode)if(r!=null&&e){const d=Q.getInternationalSubConfigCodeKey(r),u=i.find(m=>m.method.includes(d));u!=null&&(c=u)}else{const d=i.find(u=>u.method.includes("swiftOur"));d!=null&&(c=d)}}return c},qQ=(e,n,i,r)=>!n&&e?t.jsxRuntimeExports.jsxs(zTt,{children:[t.jsxRuntimeExports.jsx(fv,{children:`${sr.recurringBill.recurringCycle}${i}/${r}`}),t.jsxRuntimeExports.jsx(FTt,{})]}):sr.recurringBill.paymentTypeOptions[0],ZQ=(e,n,i,r)=>i||!n?Dd:r?.frequency!=null?t.jsxRuntimeExports.jsxs(NTt,{size:e,children:[t.jsxRuntimeExports.jsxs(fv,{children:[e==="small"?`${tM} `:null,sr.recurringBill.frequencyOptions.find(a=>a.value===r.frequency)?.label]}),t.jsxRuntimeExports.jsxs(fv,{children:[tM," ",LX.startDate,":"," ",r.startDate?.format(XN.visual.MMMDCommaYYYYformat)]}),t.jsxRuntimeExports.jsxs(fv,{children:[tM," ",LX.endDate,":"," ",r.endDate?.format(XN.visual.MMMDCommaYYYYformat)]})]}):Dd,LTt=s.div`
13335
+ `;function YQ(e){const{companyName:n,vendor:i,amount:r,paymentType:a,paymentDate:l,isInvoiceAttached:c=!1,containerWidth:d="85vw"}=e,u=X(),m=t.useTheme(),x=O.getLocalizedStrings().spendManagement.billPay.billDetails.magicLink.emailPreview,h=a.replace("International Wire","Wire").replace("Domestic Wire","Wire"),f=x.signature.replace(/<company_name>/,n),y=(c?x.content:x.contentNoAttachment).replace(/<company_name>/g,n).replace(/<payment_type>/,h).replace(/<vendor_name>/,i??"").replace(/<bill_due_date>/,l).replace(/<amount>/,r),C=x.subjectContent.replace(/<company_name>/,n).replace(/<amount>/,r),b=x.buttonText.replace(/<payment_type>/,h),E={background:m.colors.primary,color:m.colors.grey5,borderColor:m.colors.primary,cursor:"default"};return t.jsxRuntimeExports.jsxs(ATt,{size:u,width:d,children:[t.jsxRuntimeExports.jsx(STt,{size:u,onClick:e.onClose,"data-testid":_("vendor-email-preview-close-icon")}),t.jsxRuntimeExports.jsx(wTt,{children:x.title}),t.jsxRuntimeExports.jsxs(bTt,{size:u,children:[t.jsxRuntimeExports.jsx(ETt,{children:x.subjectLabel}),t.jsxRuntimeExports.jsx($Tt,{children:C})]}),t.jsxRuntimeExports.jsxs(CTt,{size:u,children:[t.jsxRuntimeExports.jsx(IX,{children:y}),t.jsxRuntimeExports.jsx(vTt,{children:t.jsxRuntimeExports.jsx(Ge,{style:E,variant:"primary",label:b,"data-testid":_("vendor-email-preview-button",h)})}),t.jsxRuntimeExports.jsx(IX,{children:f}),t.jsxRuntimeExports.jsx(RTt,{children:t.jsxRuntimeExports.jsx(Fr,{height:o.sp4})})]})]})}const tf=(e,n)=>`${e}.${n}`,eM="toAccountVendorEmail",e3={labelWidth:new w(120,160,160),largeLabelWidth:new w(140,180,180),largeLabelPickerWidth:new w(100,180,180),paddingBottom:new w(p[3],p[2]),marginBottom:new w(p[3],p[3]),autoFillIconLeft:new w(-6,-p[4]),marginTop:new w(p[2],p[0]),paddingRight:new w(p[2],p[3]),labelMarginRight:new w(p[0],p[3]),textPadding:new w(p[0],p[3]),additionalTextMarginTop:new w(-p[1],0),labelMarginLeftPicker:new w(p[3],p[4]),labelMarginRightPicker:new w(p[3],p[4]),labelMarginTopPicker:new w(p[2],p[2]),labeledFieldPaddingLeft:new w(p[0],p[0]),labeledFieldPaddingRight:new w(p[2],p[2]),labeledFieldPaddingTop:new w(p[2],p[2]),labeledFieldPaddingBottom:new w(p[2],p[2]),infoLabelPaddingRight:new w(p[0],p[3]),infoLabelMarginTop:new w(p[1],p[0])},{spendManagement:{billPay:{billDetails:sr,vendorCreation:za,paymentDetails:uw,insufficientFunds:kTt,paymentDetails:{accountsPromoSection:TX}}},commonSetUp:ITt,common:{currency:kh,strings:{empty:Dd,dividerDot:tM},texts:LX},dateFormat:XN}=O.getLocalizedStrings(),TTt=e=>{const{onInternationalWireVerifyClick:n,isVendorNameError:i,isInternationalPaymentShaVsOurEnabled:r,vendorId:a,showMarkAsPaidInfo:l,vendorName:c,totalAmount:d,allPaymentMethods:u,paymentToOptions:m,withdrawFromList:x,vendor:h,companyName:f,paymentDetails:y,analytics:C,billDueDate:b,sectionId:E,isBillPayCommentingEnabled:$,isDisabled:R,style:S,autoFields:k=[],isBillMarkedForRetry:T,isPayNowEnabled:A,isShaDisabled:I,isOurDisabled:B,isCollectFromVendor:L,vendorContactSaveStatus:P,isMagicLinkFeatureEnabled:D,isRecurringBillsFeatureEnabled:M,isRecurringBill:F,recurringBillInstances:V,isDraftBill:N,isInvoiceAttached:H,paymentType:W,totalAmountWithFees:U,recurringBillConfig:Y,isAccountsEnabled:q,isAdmin:Z,billId:G,isEligibleForRetryOBP:K,accountsPromoConfig:J,internationalVerificationStatus:oe,lowBalanceAdditionalInfo:ee,isDetectInsufficientFundsEnabled:te,plaidConnectionDetails:se,paymentAccount:ie,onFetchLinkTokenClick:re,onEstablishConnectionSuccess:ne,onEstablishConnectionClick:me,onUpdatePaymentAccountStatus:pe,onAttachmentClick:je,addVendorContactEmail:ce,onClickAddAccount:de,onSignUpAccountClick:ue,onMoveMoneyClick:le,isNewUser:ae,isSameDayACHEnabled:ge,sameDayAchDisablementConfig:ye}=e,he=t.useTheme(),Ce=X(),we=ht(),ve=Ki(),[Ee,Se]=g.useState(!1),[$e,Be]=g.useState(!1),[Ae,_e]=g.useState(void 0),Te=()=>Be(!1),Re=()=>{C?.trackBillPayMagicLinkPreviewEmail("edit_bill"),Be(!0)},{setValue:ke,getValues:Oe}=t.useFormContext(),Me=t.useForm(),Ie=g.useRef(null),[Ne,Pe]=g.useState(!1),Qe={application:"dashboard",companyId:we.currentTenant?.companyId,tab:"bill",entityId:G},Je=`dashboard_${we.currentTenant?.companyId}`,tt=$&&G!=null;g.useEffect(()=>{P?.fetchState==="Completed"&&(ke(`${E}.paymentTo`,{selectedOption:y?.paymentTo?.id,allOptions:m?.map($t=>$t.id)}),Se(!1))},[P?.fetchState]),g.useEffect(()=>{if(y?.paymentDate!=null&&y.paymentType!=null){const $t=Q.zeniDate(Q.getNextNthWorkingDay(y.paymentDate.toDate(),[0,6],y.paymentType.maxPeriod.value).toDateString());_e($t)}},[y?.paymentDate,y?.paymentType,y?.paymentType?.maxPeriod.value]),g.useEffect(()=>{W?.method!==Oe(`${E}.paymentType`)?.method&&ke(`${E}.paymentType`,W)},[y?.withdrawFrom?.accType]);const Ue=ud(y?.paymentType?.method??"").replace("Same Day",""),dt=XN.visual.MMMDCommaYYYYformat,ct=ITt.setUp.accountsPlg,yt=sr.paymentOutsideZeni,He=e3.labelWidth.value(Ce),jt=e3.largeLabelWidth.value(Ce),St=$t=>m.find(bo=>bo.id===$t),We=$t=>rL(St($t)),nt=()=>{let $t=[];W?.method.includes("wire")===!0?W?.method.includes("international")?$t=m.filter(mt=>mt.type==="PaymentInstrument"&&d.amount>=mt.minValidAmount&&(mt.maxValidAmount==null||d.amount<=mt.maxValidAmount)).map(mt=>mt.id):$t=m.filter(mt=>!!mt.bankRoutingNumberWireTransfer).map(mt=>mt.id):$t=m.filter(mt=>!!mt.bankRoutingNumberAch).map(mt=>mt.id);const bo=W?.method.includes("international")===!0&&h?.vendorCurrencyCode!==kh.currencyCode?[]:m.filter(mt=>mt.type==="Contact").map(mt=>mt.id);return $t=[...$t,...bo],$t},ut=()=>m.filter($t=>$t.type==="Contact")?.length>0,pt=$t=>m.find(bo=>bo.id===$t)?.type==="Contact",Bt=$t=>{const bo=St($t);return W?.method.includes("ach")===!0?t.jsxRuntimeExports.jsxs(oM,{children:[t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.bankRoutingNumber}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankRoutingNumberAch??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.bankName}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankName??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.bankAccountNumber}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankAccountNumber??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.accountTypeLabel}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankAccountType!=null&&bo.bankAccountType!==""?m5(bo.bankAccountType.toLowerCase()):za.emptyPlaceholderString})]})]}):W?.method.includes("wire")===!0?W?.method.includes("international")===!0?t.jsxRuntimeExports.jsx(oM,{children:bo?.piLabels.map(mt=>t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsxs(sh,{children:[mt.name,uw.colon]}),t.jsxRuntimeExports.jsx(ih,{children:mt.value})]},mt.name))}):t.jsxRuntimeExports.jsxs(oM,{children:[t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.wireDetails.bankRoutingNumber}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankRoutingNumberWireTransfer??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.bankName}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankName??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.wireDetails.accountNumber}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankAccountNumber??za.emptyPlaceholderString})]}),t.jsxRuntimeExports.jsxs(rh,{children:[t.jsxRuntimeExports.jsx(sh,{children:za.achDetails.accountTypeLabel}),t.jsxRuntimeExports.jsx(ih,{children:bo?.bankAccountType!=null&&bo.bankAccountType!==""?m5(bo.bankAccountType.toLowerCase()):za.emptyPlaceholderString})]})]}):""},Ht=y?.paymentTo,$o=y?.paymentTo?.type==="BankAccount"?sr.addedByZeni:D&&L?t.jsxRuntimeExports.jsx(GQ,{paymentTypeLabel:Ue,onClick:Re,style:{marginTop:`${Ce==="small"?o.sp2:o.sp0}`}}):void 0,Tt=()=>{Se(!0)},Gt=()=>W!=null&&Ht?.type==="Contact"&&y?.paymentDate!=null?t.jsxRuntimeExports.jsx(Pbe,{paymentType:W?.method,paymentDate:y?.paymentDate}):null,so=$t=>{$t[eM]&&a!=null&&ce?.($t[eM],a)},no=u.filter($t=>$t.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)),Xe=u.filter($t=>!Q.isPaymentMethodOutsideZeni($t.method)&&$t.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)===!1),ft=F?[]:u.filter($t=>Q.isPaymentMethodOutsideZeni($t.method)),oo=no.find($t=>$t.method.includes(Q.SWIFT_OUR_INTERNATIONAL_METHOD_SUBTEXT)&&$t.method.includes(y?.withdrawFrom?.accType??"depositAccount")),on=oo!=null?[...Xe,oo,...ft]:[...Xe,...ft],To=(h?.vendorCurrencyCode===kh.currencyCode?on:oo!=null?[oo]:[]).filter($t=>Q.isPaymentMethodOutsideZeni($t.method)||$t.method.includes(y?.withdrawFrom?.accType??"depositAccount")),kn=sr.recurringBill.paymentTypeOptions,Dn=$t=>{if(ee!=null)return ee;const bo=x.find(mt=>mt.id===$t);return te&&bo?.accountBalance?.available!=null&&Q.checkIfLowBalance(U,bo?.accountBalance?.available)?kTt.addMoney:""},qt=Q.isPaymentMethodOutsideZeni(y?.paymentType?.method),[dn,Zs]=g.useState(void 0),Yn=se.link_account,Hs=se.update_account,yn=dn==="update_account"?Hs:Yn,[Go,ds]=g.useState(yn.linkToken??null),[In,ts]=g.useState(!1),pn=Ye(Yn.updateStatus.fetchState),_s=Ye(Hs.updateStatus.fetchState),us=ie?.isLoginRequired??!1,xn=ie?.providerVerificationStatus?.code,As=g.useCallback(($t,bo)=>{const mt=bo.accounts.find(Qt=>Qt.id===ie?.providerAccountId)??bo.accounts[0];ie?.paymentAccountId!=null&&dn==="update_account"&&mt?.verification_status!=null&&!us?pe(mt?.verification_status,ie.paymentAccountId,"update_account"):me($t,dn),Zs(void 0),ts(!1)},[ie?.paymentAccountId,ie?.providerAccountId,dn,us,pe,me]),nn=g.useCallback(($t,bo)=>{$t!=null&&($t.error_code==="TOO_MANY_VERIFICATION_ATTEMPTS"&&ie?.paymentAccountId!=null&&pe("verification_failed",ie.paymentAccountId,"update_account"),console.log("Plaid Connection Error",$t,bo)),Zs(void 0),ts(!1)},[ie?.paymentAccountId,pe]),{open:os,ready:qe}=Pc.usePlaidLink({token:Go,onSuccess:As,onExit:nn});g.useEffect(()=>{(pn==="In-Progress"&&Yn.updateStatus.fetchState==="Completed"||_s==="In-Progress"&&Hs.updateStatus.fetchState==="Completed")&&(Q.isVerifiedPaymentAccountProviderStatusCode(xn??"")||(re("link_account"),ne()))},[Yn.updateStatus.fetchState,ne,re,pn,_s,Hs.updateStatus.fetchState,xn]),g.useEffect(()=>{(Q.isVerifiedStatusCode(xn??"")||xn==="verification_failed")&&!In&&dn!=null&&yn.linkToken===Go&&yn.fetchStatus.fetchState==="Completed"&&qe&&ts(!0)},[qe,Go,yn.fetchStatus.fetchState,yn.linkToken,xn,dn,In]),g.useEffect(()=>{yn.fetchStatus.fetchState==="Completed"&&yn.linkToken!=null&&yn.linkToken!==Go&&ds(yn.linkToken)},[yn.fetchStatus.fetchState,yn.linkToken,Go]),g.useEffect(()=>{In&&os()},[In,os]),g.useEffect(()=>{(xn==null||xn==="verification_failed"||xn==="verification_expired"||Q.isVerifiedStatusCode(xn))&&(Q.zeniDate(new Date().toISOString()).isAfter(Yn.expiration)||Yn.linkToken==null)&&re("link_account")},[]);const xt=y?.withdrawFrom==null||y?.withdrawFrom?.accType==="paymentAccount",Wt=y?.withdrawFrom?.accType==="depositAccount"?ye.disablementAmountThresholdInternal:ye.disablementAmountThresholdExternal,Ze=d.amount>Wt,Mo=y?.withdrawFrom?.accountBalance?.available?.amount!=null&&y?.withdrawFrom?.accType==="paymentAccount"&&y?.withdrawFrom?.accountBalance?.available?.amount<2*U.amount,Lo=y?.withdrawFrom?.accType==="depositAccount"&&y?.withdrawFrom.accountBalance!=null&&y.withdrawFrom.accountBalance.available!=null&&y.withdrawFrom.accountBalance.available.amount<U.amount,_n=ge===!0&&(Ze===!0||Mo===!0)||ge===!1&&ae===!0,ns=$t=>{switch($t){case TX.signupButtonText:ue?.();break;case TX.switchButtonText:Ie.current!=null&&Ie.current.focus();break}},en=(()=>{if(ge===!0){if(Ze){const $t=Ao(ki(Wt??1e5),Wt,kh.currencySymbol).toUpperCase();return uw.sameDayAchExtraInfo.transferLimitExceededText.replace("__amount__",$t)}if(Mo)return uw.sameDayAchExtraInfo.insufficientBalanceError}else if(ae)return uw.sameDayAchExtraInfo.newAtZeniText;return""})(),On=tf(E,"paymentType");return g.useEffect(()=>{const $t=W?.method==="billPay_ach_sameDay_depositAccount"||W?.method==="billPay_ach_sameDay_paymentAccount";Pe(!!(_n&&$t&&en))},[_n,W?.method,en,On]),t.jsxRuntimeExports.jsxs(PTt,{style:S,children:[t.jsxRuntimeExports.jsx(t.Drawer,{anchor:"right",open:$e,onClose:Te,transitionDuration:250,"data-testid":_("vendor-email-preview-drawer"),children:t.jsxRuntimeExports.jsx(YQ,{companyName:f,vendor:c,paymentDate:y?.paymentDate?.format(dt)??"",paymentType:Ue,amount:Ao("0,0.[00]",d.amount,y?.paymentType?.fee.currencySymbol),isInvoiceAttached:H,onClose:Te})}),Ee?t.jsxRuntimeExports.jsx(t.FormProvider,{...Me,children:t.jsxRuntimeExports.jsx(Mbe,{description:sr.magicLink.popUp.description.replace(/<payment_type>/,Ue),isLoading:P?.fetchState==="In-Progress",onCancelClick:()=>Se(!1),onSaveClick:Me.handleSubmit(so),textFieldName:eM})}):null,t.jsxRuntimeExports.jsx(_Tt,{children:sr.paymentDetailsTitle}),a==null?t.jsxRuntimeExports.jsx(OTt,{windowSize:Ce,isAddAccountInError:i,children:sr.selectVendorBeforeScheduling}):t.jsxRuntimeExports.jsxs(MTt,{children:[k.includes("withdrawFrom")?t.jsxRuntimeExports.jsx(pw,{children:t.jsxRuntimeExports.jsx(xw,{windowSize:Ce,children:t.jsxRuntimeExports.jsx(mw,{})})}):null,qt?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:tt,entityId:G,dashboardTabKey:Yt({type:"details",key:"withdrawFrom"}),roomId:Je,companyId:we.currentTenant?.companyId??Dd,companyName:we.currentTenant?.companyName??Dd,dashboardOptionType:"bill",filterMetaData:{...Qe,entityType:`bill.details.${Qn("withdrawFrom")}`},fieldThreadTargetElement:ve?.sharedRef?.contentWrapperRef,children:t.jsxRuntimeExports.jsx(Bs,{selectRef:Ie,isDisabled:T===!0&&K===!0?"readonly":R,label:{label:sr.withdrawFrom,width:jt,style:{width:e3.largeLabelPickerWidth.value(Ce)}},style:{width:"auto",display:"flex",borderTop:`1px solid ${he.colors.grey2}`},infoLabelStyle:{textAlign:"right",paddingRight:e3.infoLabelPaddingRight.valuePx(Ce),marginTop:e3.infoLabelMarginTop.valuePx(Ce),color:v.brandColorGoldDark},singleSelectPickerField:{name:tf(E,"withdrawFrom"),placeholder:Io(sr.withdrawFrom),style:{position:"relative"},menuPortalTarget:typeof document<"u"?document.body:null,customStyleConfig:{menuPortal:$t=>({...$t,zIndex:he.zIndex?.tooltip!=null?he.zIndex.tooltip+1:2})},capitalizeOptions:!0,isOptionRemovable:!1,showTickIcon:!1,valueToLogo:($t,bo)=>Bx(x,$t,bo),valueToSubLabels:($t,bo)=>ju(x,$t,bo,te,U),defaultValue:{selectedOption:y?.withdrawFrom?.id,allOptions:x.map($t=>({label:$t.label,value:$t.id,isRecommended:$t.accType==="depositAccount"}))},textAlignment:"right",registerOptions:{required:!0,validate:$t=>$t!=null&&!!$t.selectedOption},showCreateOption:!0,onClickCreateOption:()=>{Zs("link_account"),Yn.linkToken==null||Q.zeniDate(new Date().toISOString()).isAfter(Yn.expiration)?re("link_account"):Go!==Yn.linkToken?ds(Yn.linkToken):In?os():ts(!0)}},valueToAdditionalLabel:Dn})}),xt?t.jsxRuntimeExports.jsx(GS,{heading:ct.heading,buttonText:q?ct.switchButtonText:ct.signUpButtonText,isAccountsEnabled:q,pageName:"Bill Pay Create",analytics:C,onSignUpClick:ue,onSwitchClick:()=>{Ie.current!=null&&Ie.current.focus()},accountsPromoConfig:J}):Lo?t.jsxRuntimeExports.jsx(GS,{heading:ct.moveMoneyHeading,buttonText:ct.moveMoneyButtonText,isAccountsEnabled:q,pageName:"Bill Pay Create",analytics:C,onMoveMoneyClick:le,accountsPromoConfig:J}):null,k.includes("paymentType")?t.jsxRuntimeExports.jsx(pw,{children:t.jsxRuntimeExports.jsx(xw,{windowSize:Ce,children:t.jsxRuntimeExports.jsx(mw,{})})}):null]}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:tt,entityId:G,dashboardTabKey:Yt({type:"details",key:"paymentType"}),roomId:Je,companyId:we.currentTenant?.companyId??Dd,companyName:we.currentTenant?.companyName??Dd,dashboardOptionType:"bill",filterMetaData:{...Qe,entityType:`bill.details.${Qn("paymentType")}`},fieldThreadTargetElement:ve?.sharedRef?.contentWrapperRef,children:t.jsxRuntimeExports.jsxs(LTt,{children:[t.jsxRuntimeExports.jsx(Abe,{label:{label:sr.paymentMethod,width:jt},style:{width:"auto"},errorInfoLabel:en,hasError:Ne,paymentSingleSelectField:{name:tf(E,"paymentType"),placeholder:sr.billTypeMethodPlaceholder,defaultValue:W,allPaymentMethods:To,isAdmin:Z,showAccountsPromoSection:xt,isAccountsEnabled:q,internationalVerificationStatus:oe,registerOptions:{required:!0,validate:$t=>{if($t==null)return!1;const bo=$t?.method;return _n&&(bo==="billPay_ach_sameDay_depositAccount"||bo==="billPay_ach_sameDay_paymentAccount")?en:!0}},shouldRemoveScroll:!0,onInternationalWireVerifyClick:n,showDisabledSameDayACHOption:_n,isNewUser:ae,isSameDayACHEnabled:ge,isTransferLimitExceeded:Ze,isInsufficientBalance:Mo,isDepositAccount:y?.withdrawFrom?.accType==="depositAccount",disablementAmountThreshold:Wt,onButtonClick:ns},isDisabled:T===!0?"readonly":R}),W!=null&&W.method.includes("international")===!0?h?.vendorCurrencyCode!==kh.currencyCode?t.jsxRuntimeExports.jsx(Ckt,{conversionRate:y?.conversionRate,currentTotal:d,homeCurrency:{currencyCode:kh.currencyCode,currencySymbol:kh.currencySymbol},paymentType:W}):r?t.jsxRuntimeExports.jsx(eTt,{isShaDisabled:I,isOurDisabled:B,invoiceTotalAmount:d.amount,name:tf(E,"internationalTransferFeeBearerPaymentMethod"),internationalMethods:no,internationalTransferFeeBearerPaymentMethodValue:y?.internationalTransferFeeBearerPaymentMethod}):W.fee.amount!==0?t.jsxRuntimeExports.jsx(fX,{paymentType:W,currentFee:d.amount}):null:W!=null&&W.fee.amount!==0?t.jsxRuntimeExports.jsx(fX,{paymentType:W,currentFee:d.amount}):null]})}),qt?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[R!=="readonly"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[k.includes("paymentDate")?t.jsxRuntimeExports.jsx(pw,{children:t.jsxRuntimeExports.jsx(xw,{windowSize:Ce,children:t.jsxRuntimeExports.jsx(mw,{})})}):null,t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:tt,entityId:G,dashboardTabKey:Yt({type:"details",key:"paymentDate"}),roomId:Je,companyId:we.currentTenant?.companyId??Dd,companyName:we.currentTenant?.companyName??Dd,dashboardOptionType:"bill",filterMetaData:{...Qe,entityType:`bill.details.${Qn("paymentDate")}`},fieldThreadTargetElement:ve?.sharedRef?.contentWrapperRef,children:t.jsxRuntimeExports.jsx(VAt,{name:tf(E,"paymentDate"),paymentDate:W==null?void 0:y?.paymentDate,receiveDate:Ae,billDueDate:W==null?void 0:b,numberOfBusinessDays:W?.maxPeriod.value??Q.PAYMENT_BUSINESS_DAYS,filterDaysIndex:[0,6],isDisabled:W==null||T===!0?"readonly":R,isPayNowEnabled:A,registerOptions:{required:!0,validate:$t=>T===!0?!0:!(A&&Q.zeniDate($t.toString()??"").isSameOrAfter(Q.dateNow(),"date")===!1||!A&&Q.zeniDate($t.toString()??"").isAfter(Q.dateNow(),"date")===!1)}})})]}):null,t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:tt,entityId:G,dashboardTabKey:Yt({type:"details",key:"paymentTo"}),roomId:Je,companyId:we.currentTenant?.companyId??Dd,companyName:we.currentTenant?.companyName??Dd,dashboardOptionType:"bill",filterMetaData:{...Qe,entityType:`bill.details.${Qn("paymentTo")}`},fieldThreadTargetElement:ve?.sharedRef?.contentWrapperRef,children:t.jsxRuntimeExports.jsxs(BTt,{shouldDisplay:!0,isLastItem:!M,children:[k.includes("paymentTo")?t.jsxRuntimeExports.jsx(pw,{children:t.jsxRuntimeExports.jsx(xw,{windowSize:Ce,children:t.jsxRuntimeExports.jsx(mw,{})})}):null,t.jsxRuntimeExports.jsx(ei,{label:{label:sr.paymentTo,width:jt},style:{width:"auto"},singleSelectField:{singleSelect:{name:tf(E,"paymentTo"),placeholder:sr.selectAccount,getTooltipInfo:Bt,menuPlacement:"top",maxMenuHeight:308,vendorName:c,isOptionRemovable:!1,showEyeIconOnSelect:!1,showVerifiedIcon:!0,isContactOption:pt,onClickCreateBankAccount:de,onClickCollectPaymentDetails:Tt,showAddBankAccountOption:!0,showCollectPaymentDetailsOption:D&&!ut()&&h?.vendorCurrencyCode===kh.currencyCode,getLabelForId:We,isDisabled:R},defaultValue:{selectedOption:W!=null?Ht?.id:"",allOptions:W!=null?nt():[]},registerOptions:{required:!0,validate:$t=>$t!=null&&$t.selectedOption!=null}},showContacts:D,isFunctional:W?.method!=null,additionalInfoLabel:$o})]})})]}),D?Gt():null,M||qt?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:tt,entityId:G,dashboardTabKey:Yt({type:"details",key:"recurringPaymentType"}),roomId:Je,companyId:we.currentTenant?.companyId??Dd,companyName:we.currentTenant?.companyName??Dd,dashboardOptionType:"bill",filterMetaData:{...Qe,entityType:`bill.details.${Qn("recurringPaymentType")}`},fieldThreadTargetElement:ve?.sharedRef?.contentWrapperRef,children:t.jsxRuntimeExports.jsxs(DTt,{children:[!N||qt?t.jsxRuntimeExports.jsx(Nn,{label:{label:sr.paymentType,width:He},labelStyles:{marginRight:e3.labelMarginRight.valuePx(Ce)},style:{width:"auto"},text:qQ(F,qt,Y?.currentInstance??1,Y?.totalPaymentCycles??0),additionalInfoLabel:ZQ(Ce,F,qt,Y)}):t.jsxRuntimeExports.jsx(ei,{label:{label:sr.recurringBill.paymentType,width:jt},singleSelectField:{singleSelect:{name:tf(E,"recurringPaymentType"),showValueEyeIcon:!1,showEyeIconOnSelect:!1,isOptionRemovable:!1},defaultValue:{selectedOption:F?kn[1]:kn[0],allOptions:kn}},isFunctional:Ae!=null,style:{width:"auto"}}),F?t.jsxRuntimeExports.jsx(KIt,{name:`${E}.${Wbe}`,startDate:Y?.isActive===!0?Y.startDate:Ae,currencySymbol:d.currencySymbol,recurringBillConfig:Y,recurringBillInstances:V,isInternationalPayment:y?.paymentType?.method.toLocaleLowerCase().includes("international"),onAttachmentClick:je}):null]})})}):null]}),qt&&l?t.jsxRuntimeExports.jsx(xd,{description:yt.banner.description,title:yt.banner.title,style:{marginTop:o.sp5,marginBottom:o.sp5},variant:"info"}):null]})},iL=(e,n)=>n==="small"?t.jsxRuntimeExports.jsxs(HTt,{children:[t.jsxRuntimeExports.jsxs(BX,{children:[Bx([e],e.id,!0),e.label]}),ju([e],e.id,!0,!1)]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(BX,{children:[Bx([e],e.id,!0),e.label,ju([e],e.id,!0,!1)]})}),rL=e=>e==null?"":e.email?`${sr.magicLink.collectFrom} ${e.email}`:e.bankAccountName?e.bankAccountName??"":e.bankName&&e.bankAccountNumber?`${e.bankName} ${sr.accountNameConnector} ${e.bankAccountNumber?.slice(e.bankAccountNumber.length-4)}`:e.bankName&&e.bankAccountIban!=null&&e.bankAccountIban?`${e.bankName} ${sr.accountNameConnector} ${e.bankAccountIban?.slice(e?.bankAccountIban?.length-4)}`:e.piName?`${e.piName}`:"",Vbe=(e,n,i,r,a,l)=>{let c=a;if(c?.method.includes("international")===!0){if(n&&l!==kh.currencyCode){const d=i.find(u=>u.method.includes(Q.LOCAL_CURRENCY_INTERNATIONAL_METHOD_SUBTEXT));d!=null&&(c=d)}else if(l===kh.currencyCode)if(r!=null&&e){const d=Q.getInternationalSubConfigCodeKey(r),u=i.find(m=>m.method.includes(d));u!=null&&(c=u)}else{const d=i.find(u=>u.method.includes("swiftOur"));d!=null&&(c=d)}}return c},qQ=(e,n,i,r)=>!n&&e?t.jsxRuntimeExports.jsxs(zTt,{children:[t.jsxRuntimeExports.jsx(fv,{children:`${sr.recurringBill.recurringCycle}${i}/${r}`}),t.jsxRuntimeExports.jsx(FTt,{})]}):sr.recurringBill.paymentTypeOptions[0],ZQ=(e,n,i,r)=>i||!n?Dd:r?.frequency!=null?t.jsxRuntimeExports.jsxs(NTt,{size:e,children:[t.jsxRuntimeExports.jsxs(fv,{children:[e==="small"?`${tM} `:null,sr.recurringBill.frequencyOptions.find(a=>a.value===r.frequency)?.label]}),t.jsxRuntimeExports.jsxs(fv,{children:[tM," ",LX.startDate,":"," ",r.startDate?.format(XN.visual.MMMDCommaYYYYformat)]}),t.jsxRuntimeExports.jsxs(fv,{children:[tM," ",LX.endDate,":"," ",r.endDate?.format(XN.visual.MMMDCommaYYYYformat)]})]}):Dd,LTt=s.div`
13336
13336
  :first-of-type {
13337
13337
  border-top-left-radius: inherit;
13338
13338
  border-top-right-radius: inherit;
@@ -14070,7 +14070,7 @@ Initiate your first transfer to start earning yield.`,insuredFundsTooltip:"Secur
14070
14070
  justify-content: flex-end;
14071
14071
  `,kBt=s(ze)`
14072
14072
  color: ${v.brandColorGoldDark};
14073
- `,B1=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M8 4C8.55228 4 9 3.55228 9 3C9 2.44772 8.55228 2 8 2C7.44772 2 7 2.44772 7 3C7 3.55228 7.44772 4 8 4Z",fill:"currentColor"}),j.createElement("path",{d:"M8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9Z",fill:"currentColor"}),j.createElement("path",{d:"M8 14C8.55228 14 9 13.5523 9 13C9 12.4477 8.55228 12 8 12C7.44772 12 7 12.4477 7 13C7 13.5523 7.44772 14 8 14Z",fill:"currentColor"})),Tl={containerPaddingLeft:new w(p[3],p[5],p[5]),containerPaddingRight:new w(p[3],p[5],p[5]),marginBottom:new w(p[3],p[3]),formTitlePaddingLeftRight:new w(30,0),marginTop:new w(p[1],0),closeContainerMarginTop:new w(p[1],0),rightIconsGap:new w(p[4],p[3]),formTitleMarginTopBottom:new w(0,p[3]),footerButtonWidth:new w(120,165),right:new w(p[3],p[0]),actionsContainerRight:new w(p[0],p[3]),otherActionsContainerBottom:new w(58,44),confirmationPopupWidth:new w(343,412,412),drawerSectionPaddingLeftRight:new w(p[4],p[5])},hg="whatFor",Ym="lineItems",KX="editBillDetailPage",gs="paymentDetails",{common:{currency:Mi,strings:{empty:y4}},dateFormat:IBt,spendManagement:{billPay:{billDetails:an,bulkActions:JX,insufficientFunds:TBt}},collaboration:{threads:{placeholder:XX,tooltip:eee,title:{comments:LBt}}}}=O.getLocalizedStrings(),tee=({billDetails:e,currentTenant:n,uncategorizedAccounts:i,billId:r,analytics:a,customerSearchAutoCompleteData:l,customerSearchAutoCompleteActions:c,isMagicLinkEnabled:d,isInternationalPaymentShaVsOurEnabled:u,isVendorRecommendationEnabled:m,isRecurringBillsFeatureEnabled:x,isLocalCurrencyEnabled:h,isAccountingClassesEnabled:f,isAccountsEnabled:y,sameDayAchDisablementConfig:C,isNewUser:b=!1,isAdmin:E,accountsPromoConfig:$,showMarkAsPaidInfo:R,isShaDisabled:S,isOurDisabled:k,isBillPayCommentingEnabled:T,isDetectInsufficientFundsEnabled:A,editVendor:I,chooseNewVendor:B,onSaveChangesToLocalStore:L,updateBillDetailSaveBillCode:P,clearBillPayReviewLocalState:D,discardBillDetailsFromLocalStore:M,saveBillDetails:F,updateShowAutofill:V,reviewBillDetails:N,redirectToACHScreen:H,redirectToWireScreen:W,redirectToInternationalScreen:U,redirectToBillsScreen:Y,redirectToBillDetailPage:q,onAttachmentClick:Z,onInternationalWireVerifyClick:G,onBackClick:K,deleteBill:J,addVendorContactEmail:oe,onVendorSelected:ee,onSignUpAccountClick:te,onMoveMoneyClick:se,onFetchLinkTokenClick:ie,onUpdatePaymentAccountStatus:re,onEstablishConnectionClick:ne,onEstablishConnectionSuccess:me,initialOpenThreadRequest:pe,isAiCfoAccessEnabled:je,onAskAiCfoClick:ce})=>{const de=X(),ue=ht(),le=t.useTheme(),ae=g.useRef(),ge=g.useRef(),[ye,he]=g.useState(!1),Ce={application:"dashboard",companyId:ue.currentTenant?.companyId,tab:"bill",entityId:r,isGlobalComment:!1},we=T&&r!=null,{threads:ve,isLoading:Ee}=Y5(),{requestToOpenThread:Se,setRequestToOpenThread:$e,setOpenThread:Be}=g.useContext(vs);g.useEffect(()=>{pe?.threadId!=null&&pe?.companyId!=null&&pe?.entityType!=null&&$e(pe)},[pe,$e]);const _e=g.useMemo(()=>r==null?[]:ve.filter(et=>et.resolved===!1&&!et.id.includes($s)),[ve,r]).length,Te=g.useCallback((et,Jt)=>{Be(Jt),he(!1)},[Be,he]);g.useEffect(()=>{Se?.threadId!=null&&ve.length>0&&!Ee&&(Be(Se.threadId),$e(null))},[Se,ve,Ee,Be,$e]);const[Re,ke]=g.useState(e.whatForSection.invoiceDate!=null&&e.bookCloseDate!=null&&e.whatForSection.invoiceDate.isBefore(e.bookCloseDate)),Oe=e.uploadStatus,Me=g.useMemo(()=>d?e.paymentToList:e.paymentToList.filter(et=>et.type==="BankAccount"||et.type==="PaymentInstrument"),[e.paymentToList,d]),Ie=Ye(Oe?.fetchState),[Ne,Pe]=g.useState(!1),[Ue,Je]=g.useState(!1),[tt,Qe]=g.useState(!1),[dt,ct]=g.useState(!1),[yt,He]=g.useState({title:"",description:"",primaryButtonText:"",secondaryButtonText:""}),jt=g.useRef(null),St=g.useRef(null),[We,nt]=g.useState(!1),[ut,pt]=g.useState(!1),[Bt,Ht]=g.useState(-1),[$o,Tt]=g.useState(!1),[Gt,so]=g.useState(!1),no=t.useForm({mode:"all",reValidateMode:"onBlur",defaultValues:rM(e,Me,d,l.entityAutoCompleteView),values:rM(e,Me,d,l.entityAutoCompleteView),resetOptions:{keepErrors:!0},shouldFocusError:!0}),Xe="vendorEmail",ft=t.useForm();g.useEffect(()=>{l.entityAutoCompleteView.fetchState==="Completed"&&(ae.current?.(HQ(l.entityAutoCompleteView)),ge.current?.(Rbe(l.entityAutoCompleteView,e.recommendedVendor,e.addBillAutoFields.tentativeVendorName)))},[l.entityAutoCompleteView.fetchState]);const oo=e.saveStatus,on=e.deleteStatus,To=e.payNowCutOffTime!=null?Q.dateNow().isSameOrBefore(e.payNowCutOffTime):!1;g.useEffect(()=>{if(Ie==="In-Progress"&&Oe?.fetchState==="Completed"){let et=e.paymentDetailsSection?.paymentDate;e.whatForSection.billDueDate!=null&&(et=ree(e.whatForSection.billDueDate,To,e.paymentDetailsSection?.paymentType?.maxPeriod.value)),no.reset(rM({...e,paymentDetailsSection:{...e.paymentDetailsSection,paymentDate:et}},Me,d,l.entityAutoCompleteView),{keepDefaultValues:!0})}},[e,Me,d,no,To,Ie,Oe,l]),g.useEffect(()=>{(oo.fetchState==="Completed"||on.fetchState==="Completed")&&(on.fetchState==="Completed"&&r!=null&&a.trackBillPayDeleteBill(r,e.isRecurring),oo.fetchState==="Completed"&&P(),M({billId:r}),Y?.())},[oo,on,Y,M,a,r]),g.useEffect(()=>{const et=no.watch((Jt,{name:gt})=>{gt!=null&&Jt!=null&&t.defer(()=>Mo(gt,Jt))});return()=>{et.unsubscribe()}}),g.useEffect(()=>{const et=e.whatForSection.invoiceDate;et!=null&&e.bookCloseDate!=null&&et.isBefore(e.bookCloseDate)?ke(!0):ke(!1)},[e.bookCloseDate,e.whatForSection.invoiceDate]),g.useEffect(()=>{e.vendorContactSaveStatus?.fetchState==="Completed"&&so(!1)},[e.vendorContactSaveStatus?.fetchState]);const kn=!1,Dn=e.editBillInitialDetails?.whatForSection?.invoiceDate!=null&&e.bookCloseDate!=null&&e.editBillInitialDetails?.whatForSection?.invoiceDate.isBefore(e.bookCloseDate),qt=iee(r,e.billStage,de)?.secondary,dn=iee(r,e.billStage,de)?.primary,Zs=e.saveStatus,Yn=e.vendor?.accountId,Hs=e.vendor?.classId,{isValid:yn,isDirty:Go}=no.formState,ds=e.billStage==="draft"?an.newBillTitle:an.editTitle;let In=!1;Object.values(e.addBillAutoFields).forEach(et=>{et?.length>0&&(In=!0)});const ts=(et,Jt)=>{c.onAutoCompleteInputChange?.(et,"customer"),ae.current=Jt},pn=(et,Jt)=>{c.onAutoCompleteInputChange?.(et,"vendor"),ge.current=Jt},_s=m&&e.recommendedVendor!=null&&e.addBillAutoFields.tentativeVendorName!=null,us=r==null,js=us&&In,xn=Vbe(u,h,e.billPayConfigList.filter(et=>Q.isPaymentMethodOutsideZeni(et.method)||et.method.includes(e.paymentDetailsSection?.withdrawFrom?.accType??"depositAccount")),e.paymentDetailsSection?.internationalTransferFeeBearerPaymentMethod,e.paymentDetailsSection?.paymentType,e.vendor?.vendorCurrencyCode),As=no.getValues("lineItems"),nn=As.reduce((et,Jt)=>et+(Jt.recipientAmount??0),0),os={amount:Mp(nn),currencyCode:As.length>0?As[0].recipientCurrency?.currencyCode??Mi.currencyCode:Mi.currencyCode,currencySymbol:As.length>0?As[0].recipientCurrency?.currencySymbol??Mi.currencySymbol:Mi.currencySymbol},qe=As.length>0?os:e.editBillInitialDetails?.recipientTotalAmount??{amount:0,currencyCode:Mi.currencyCode,currencySymbol:Mi.currencySymbol},xt={amount:qe!=null?Mp(qe.amount/(e.paymentDetailsSection?.conversionRate??1)):0,currencyCode:Mi.currencyCode,currencySymbol:Mi.currencySymbol},Wt={amount:xn?.method.includes("international")===!0?sC(xt,xn):xt.amount+(xn?.fee.amount??0),currencyCode:Mi.currencyCode,currencySymbol:Mi.currencySymbol};let Ze;const Mo=async(et,Jt)=>{Ze=parseInt(et.split(".")[1]);let gt=Jt[gs]?.paymentDate;const mn=Jt[hg]?.billDueDate,zt=Jt[hg].invoiceDate,tn=Jt[gs]?.paymentType,Dt=Jt[gs]?.paymentTo,mo=Jt[Ym][Ze]?.customer,to=Jt.lineItems;if(et.includes("memo")||et.includes("invoiceNumber")||et.includes("lineDescription")||et.includes("recipientAmount")||et.includes("amount")||f===!1&&et.includes("class"))return;let eo={...Jt};if(et.includes("whosItFor.vendor")){let Zo=Jt[nC].vendor.selectedOption;Zo===e.addBillAutoFields.tentativeVendorName&&(Zo=void 0),ee(Zo);return}else if((et.includes("billDueDate")||et.includes("paymentType")||et.includes("invoiceDate"))&&mn!=null){const Zo=ree(Q.zeniDate(mn.toDateString()),To,tn?.maxPeriod.value);(gt==null||Zo.isSame(gt,"date")===!1)&&(gt=Zo.toDate(),eo={...eo,[gs]:{...eo[gs],paymentDate:gt}})}else if(et.includes("paymentType")){const Zo=Me.find(ss=>ss.id===Dt?.selectedOption),hs=HBt(tn,e.paymentDetailsSection?.paymentTo,Zo);if(eo={...eo,[gs]:{...eo[gs],paymentTo:{selectedOption:hs?.id,allOptions:Me?.map(ss=>ss.id)}}},Jt[gs]?.paymentType?.method!=null&&Jt[gs].paymentType.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)===!0){const ss=e.billPayInfo?.billStatus,_a=e.billPayInfo?.billPaymentStatus,Do=ss?.code=="approved"&&_a?.code?_a:ss;a.trackIntlWirePaymentSelect(Do?.code??"",e.billPayInfo?.stage.code??"",e.isRecurring?["Recurring"]:["One-Time"],e.whatForSection.invoiceNumber??"",h)}}else if(!zt)eo={...eo,[hg]:{...eo[hg],invoiceDate:Q.dateNow().toDate()}};else if(et.includes("invoiceDate"))zt!=null&&e.bookCloseDate!=null&&Q.zeniDate(zt.toDateString()).isBefore(e.bookCloseDate)?ke(!0):ke(!1);else if(et.includes("customer")){const Zo=mo?.defaultOptions.map(hs=>hs.value);if(mo?.selectedOption!=null&&Zo?.includes(mo.selectedOption)!=!0){const hs=l.entityAutoCompleteView.customer.find(_a=>_a.id===Jt[Ym][Ze].customer?.selectedOption),ss=[...eo[Ym]];ss[Ze]={...ss[Ze],customer:{...ss[Ze].customer,defaultOptions:oC(hs,l.entityAutoCompleteView)}},eo={...eo,[Ym]:ss}}else if(mo?.selectedOption==null&&mo?.defaultOptions.length!=0){const hs=[...eo[Ym]];hs[Ze]={...hs[Ze],customer:{selectedOption:void 0,defaultOptions:[]}},eo={...eo,[Ym]:hs}}}else if(et.includes("lineItems")){const Zo=to[Ze]?.lineId,hs=e?.editBillInitialDetails?.lineDetailSection,ss=hs?.[Zo]?.account?.qboId,_a=hs?.[Zo]?.class?.classId,Do=[...eo[Ym]];if(et.includes("updateAllCheckbox")===!0)if(to[Ze].updateAllCheckbox===!0){const Wi=to[Ze].account.selectedOption,la=to[Ze].class?.selectedOption;Do.forEach((Oa,N1)=>{Do[N1]={...Oa,account:{...Oa.account,selectedOption:Wi},class:{...Oa.class,selectedOption:la},updateAllCheckbox:!0,isCategoryOrClassUpdated:!0,isCategoryUpdateSelected:Oa.recommendedCategory?.qboId===Wi,isClassUpdateSelected:Oa.recommendedClass?.classId===la,isRetainedCategorySelected:Oa.retainedCategory?.qboId===Wi,isRetainedClassSelected:Oa.retainedClass?.classId===la}})}else Do.forEach((Wi,la)=>{if(la===Ze){Do[la]={...Wi,updateAllCheckbox:!1};return}const Oa=hs?.[la+1]?.account?.qboId,N1=hs?.[la+1]?.class?.classId;Do[la]={...Wi,account:{...Wi.account,selectedOption:Oa},class:{...Wi.class,selectedOption:N1},isCategoryUpdateSelected:Wi.recommendedCategory?.qboId===Oa,isClassUpdateSelected:Wi.recommendedClass?.classId===N1,isRetainedCategorySelected:Wi.retainedCategory?.qboId===Oa,isRetainedClassSelected:Wi.retainedClass?.classId===N1,updateAllCheckbox:!1,isCategoryOrClassUpdated:!1}});else{const Wi=to.every(la=>la.account.selectedOption===to[0].account.selectedOption&&la.class?.selectedOption===to[0].class?.selectedOption);Do.forEach((la,Oa)=>{Do[Oa]={...la,updateAllCheckbox:Wi}})}et.includes("account")&&(to[Ze].account.selectedOption!==to[Ze].recommendedCategory?.qboId&&to[Ze].account.selectedOption!==to[Ze].recommendedCategory?.accountId?Do[Ze]={...Do[Ze],isCategoryUpdateSelected:!1,isCategoryFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}:(to[Ze].account.selectedOption===to[Ze].recommendedCategory?.qboId||to[Ze].account.selectedOption===to[Ze].recommendedCategory?.accountId)&&(Do[Ze]={...Do[Ze],isCategoryUpdateSelected:!0,isCategoryFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),to[Ze].account.selectedOption!==to[Ze].retainedCategory?.qboId&&to[Ze].account.selectedOption!==to[Ze].retainedCategory?.accountId?Do[Ze]={...Do[Ze],isRetainedCategorySelected:!1}:(to[Ze].account.selectedOption===to[Ze].retainedCategory?.qboId||to[Ze].account.selectedOption===to[Ze].retainedCategory?.accountId)&&(Do[Ze]={...Do[Ze],isRetainedCategorySelected:!0})),et.includes("class")&&(to[Ze].class.selectedOption!==to[Ze].recommendedClass?.classId?Do[Ze]={...Do[Ze],isClassUpdateSelected:!1,isClassFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}:to[Ze].class.selectedOption===to[Ze].recommendedClass?.classId&&(Do[Ze]={...Do[Ze],isClassUpdateSelected:!0,isClassFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),to[Ze].class.selectedOption!==to[Ze].retainedClass?.classId?Do[Ze]={...Do[Ze],isRetainedClassSelected:!1}:to[Ze].class.selectedOption===to[Ze].retainedClass?.classId&&(Do[Ze]={...Do[Ze],isRetainedClassSelected:!0})),et.includes("isRetainedCategorySelected")&&to[Ze].isRetainedCategorySelected===!0&&(Do[Ze]={...Do[Ze],isCategoryUpdateSelected:!1,account:{...Do[Ze].account,selectedOption:to[Ze].retainedCategory?.qboId??to[Ze].retainedCategory?.accountId},isCategoryFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),et.includes("isRetainedClassSelected")&&to[Ze].isRetainedClassSelected===!0&&(Do[Ze]={...Do[Ze],isClassUpdateSelected:!1,class:{...Do[Ze].class,selectedOption:to[Ze].retainedClass?.classId},isClassFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),et.includes("isCategoryUpdateSelected")&&(to[Ze].isCategoryUpdateSelected===!0?Do[Ze]={...Do[Ze],account:{...Do[Ze].account,selectedOption:to[Ze].recommendedCategory?.qboId},isRetainedCategorySelected:!1,isCategoryFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}:Do[Ze]={...Do[Ze],account:{...Do[Ze].account,selectedOption:ss},isCategoryFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),et.includes("isClassUpdateSelected")&&(to[Ze].isClassUpdateSelected===!0?Do[Ze]={...Do[Ze],class:{...Do[Ze].class,selectedOption:to[Ze].recommendedClass?.classId},isRetainedClassSelected:!1,isClassFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}:Do[Ze]={...Do[Ze],class:{...Do[Ze].class,selectedOption:_a},isClassFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),eo={...eo,[Ym]:Do}}else if(et.includes("endDateSelector.recurringCount")){const Zo=eo[gs]?.recurringPaymentDetails;eo={...eo,[gs]:{...eo[gs],recurringPaymentDetails:{frequency:Zo?.frequency??{allOptions:[],selectedOption:""},requireApproval:Zo?.requireApproval??{allOptions:[],selectedOption:""},startDate:Zo?.startDate,updateRecurringBills:Zo?.updateRecurringBills,endDateSelector:{...Zo?.endDateSelector??{},type:"recurringCount"}}}};return}else if(et.includes("endDateSelector.date")){const Zo=eo[gs]?.recurringPaymentDetails;eo={...eo,[gs]:{...eo[gs],recurringPaymentDetails:{frequency:Zo?.frequency??{allOptions:[],selectedOption:""},requireApproval:Zo?.requireApproval??{allOptions:[],selectedOption:""},startDate:Zo?.startDate,updateRecurringBills:Zo?.updateRecurringBills,endDateSelector:{...Zo?.endDateSelector??{},type:"date"}}}};return}else if(et.includes("endDateSelector.type")){no.trigger(`${gs}.recurringPaymentDetails.endDateSelector`);return}else if(et.includes("recurringPaymentType"))no.trigger(`${gs}`);else if(et.includes("withdrawFrom")&&A){const Zo=Jt[gs]?.withdrawFrom?.selectedOption,hs=e.withdrawFromList.find(ss=>ss.id===Zo);if(hs?.accountBalance?.available!=null){const ss=Q.checkIfLowBalance(Wt,hs.accountBalance.available),_a=e.billStage??"draft",Do=e.billPayInfo?.billPaymentStatus.code??"",Wi=e.isRecurring?["Recurring"]:["One-Time"],la=e.whatForSection.invoiceNumber??"",Oa=Ml(ue.loggedInUser),N1=hs.accType==="depositAccount"?"ZA":"External Account";ss?a?.trackLowBalanceAccountSelected(_a,Do,Wi,la,Oa,N1):e.paymentDetailsSection?.withdrawFrom?.accountBalance?.available!=null&&Q.checkIfLowBalance(Wt,e.paymentDetailsSection?.withdrawFrom.accountBalance.available)&&a?.trackLowBalanceAccountChange(_a,Do,Wi,la,Oa,N1)}}const mi=Me.find(Zo=>Zo.id===eo[gs]?.paymentTo?.selectedOption);L(eo,Ze,l.entityAutoCompleteView,mi,gt,r)},Lo=()=>{if(e.whatForSection.isInvoiceDateAutoUpdated===!0&&a.trackBillPayAutoDateChange(r??"new_bill"),Vt()){const et=no.getValues(),Jt=Me.find(gt=>gt.id===et[gs]?.paymentTo?.selectedOption);L(et,Ze,l.entityAutoCompleteView,Jt,et[gs]?.paymentDate,r),F()}},_n=()=>{const et=no.getValues(),Jt=et.whatFor.invoiceNumber,gt=et.whatFor.memo,mn=et.whatFor.invoiceDate,zt=et.whatFor.recipientCurrency??an.usd,tn=et.whatFor.billDueDate,Dt=et[gs]?.paymentTo?.selectedOption,mo=et[gs]?.internationalTransferFeeBearerPaymentMethod,to=Me.find(Wi=>Wi.id===Dt)?.type==="Contact",eo=et[gs]?.recurringPaymentType?.selectedOption===an.recurringBill.paymentTypeOptions[1],mi=et[gs]?.recurringPaymentDetails,Zo=e.editBillInitialDetails?.recipientTotalAmount?.amount,hs=IBt.visual.MMMDCommaYYYYformat,ss=e.vendor?.name,_a=e.addBillAutoFields.tentativeVendorName,Do=et[gs]?.paymentType?.method;if(mn!=null&&zt!=null&&ss!=null&&Do!=null){const Wi=Q.isPaymentMethodOutsideZeni(Do)?an.paymentOutsideZeni.offline:ud(Do);a.trackBillPayReviewBill(Wi,mn.toString(),zt,to,eo,ss,e.lastRecommendedVendorName,_a||void 0,r,Jt,tn?.toString(),gt,mo,{startDate:Q.zeniDate(mi?.startDate?.toString()??y4).format(hs),endDate:Q.zeniDate(mi?.endDateSelector?.date?.toString()??y4).format(hs),frequency:Q.toRecurringBillFrequency(mi?.frequency.selectedOption??y4),totalAmount:Zo??0,totalPaymentCycles:mi?.endDateSelector?.recurringCount??0,isApprovalRequired:mi?.requireApproval.selectedOption==="all"})}},ns=no.handleSubmit(()=>{if(e.vendor?.id==null)nt(!0);else if(!e.vendor.email)so(!0);else if(yn)if(nt(!1),_n(),e.isRecurring&&e.recurringConfig?.id!=null&&e$t(e))Tt(!0);else{const et=no.getValues(),Jt=Me.find(gt=>gt.id===et[gs]?.paymentTo?.selectedOption);L(et,Ze,l.entityAutoCompleteView,Jt,et[gs]?.paymentDate,r),N()}}),Vt=()=>{const et=no.getValues();let Jt=!0;return(et[hg].invoiceNumber?.length??0)>21&&(no.trigger(`${hg}.invoiceNumber`,{shouldFocus:!0}),Jt=!1),Jt},en=()=>{pt(!0),He({title:`${an.editPopupInformationTitle} ${e.vendor?.name}`,description:`${an.editConfirmationDescriptionFirstPart}${e.vendor?.name}${an.editConfirmationDescriptionSecondPart}`,primaryButtonText:an.edit,secondaryButtonText:an.cancel}),Pe(!0)},On=et=>{B(et)},$t=()=>{const et=e.paymentDetailsSection?.paymentType;e.vendor?.id!=null&&et!=null&&(et.method.toLowerCase().indexOf("ach")!==-1?H(e.vendor?.id):et.method.toLowerCase().indexOf("wire")!==-1&&et.method.toLowerCase().indexOf("domestic")!==-1?W(e.vendor?.id):et.method.toLowerCase().indexOf("wire")!==-1&&et.method.toLowerCase().indexOf("international")!==-1&&U(e.vendor?.id))},bo=()=>{pt(!1),He({title:an.discardTitle,description:an.discardDescription,primaryButtonText:an.discard,secondaryButtonText:an.cancel}),Pe(!0)},mt=e.editBillInitialDetails?.vendor?.id,Qt=e.vendor?.id,wt=mt!==Qt,Kt=et=>{Go||r===void 0&&e.file!=null&&e.billStage==="draft"||wt?(Qe(!0),bo()):(M({billId:r}),D(),K?.())},ks=()=>{pt(!1),He({title:an.deleteBillTitle,description:an.deleteAlertDescription,primaryButtonText:an.delete,secondaryButtonText:an.cancel}),Pe(!0)},_o={onOkClick:()=>{Pe(!1),yt.primaryButtonText===an.discard?(M({billId:r}),D(),tt?K?.():Ue?Y?.():q()):yt.primaryButtonText===an.edit?e.vendor!=null?(a.trackBillPayEditVendor(e.vendor.id),I(e.vendor.id)):_s&&e.recommendedVendor!=null&&(a.trackBillPayEditVendor(e.recommendedVendor.id),I(e.recommendedVendor.id)):yt.primaryButtonText===an.delete&&J?.()},onCancelClick:()=>{Pe(!1),Qe(!1),Je(!1)}},Ct=()=>{qt===an.buttons.saveChanges||qt===an.buttons.save?Lo():(qt===an.buttons.discardChanges||qt===an.buttons.discard)&&Kt()},Ot=e.qboId!=null;let Yo=[];if(r==null){const et=xt.amount;et>0&&(Yo=e.approvalRules.allApprovalRules?.filter(Jt=>{const gt=Jt.criteria[0].range;if(gt.max!=null){if(gt.min.amount<et&&gt.max.amount>=et)return Jt}else if(gt.min.amount<et)return Jt;return null}).map(Jt=>({...Jt,stepsWithStatus:Jt.steps.map(gt=>({...gt,actorsActivity:[],isOriginalApprovalStep:!0})),isRealTimeApprovalEnabled:!1})))}const Mt=e.billPayInfo?.isRefundInitiated===!0&&e.billPayInfo?.isRefundComplete===!1?e.billPayInfo?.billPaymentRefundStatus:e.billPayInfo?.billStatus?.code=="approved"&&e.billPayInfo?.billPaymentStatus?.code?e.billPayInfo?.billPaymentStatus:e.billPayInfo?.billStatus,fo=e.billPayInfo!=null?Q.getActualPaymentDate(e.billPayInfo):void 0,ot=fo!=null&&e.paymentDetailsSection?.paymentType?.maxPeriod?.value!=null?Q.zeniDate(Q.getNextNthWorkingDay(fo.toDate(),[0,6],e.paymentDetailsSection.paymentType.maxPeriod.value).toDateString()):void 0,Lt=e.billPayInfo?.expectedDepositDate??ot,Nt=r!=null&&e.billStage==="draft",qn={zIndex:e.showAutofill===!0?"unset":2},vo={defaultOptions:oL(e.vendor?.id,e.vendor?.name,l?.entityAutoCompleteView,e.recommendedVendor,e.addBillAutoFields.tentativeVendorName),selectedOption:e.vendor?.id??e.vendor?.name??""},jn=et=>{et[Xe]&&e.vendor?.id!=null&&oe?.(et[Xe],e.vendor.id)},Ln=e.isBillMarkedForRetry,ri=g.useMemo(()=>({companyId:ue.currentTenant?.companyId??y4,companyName:ue.currentTenant?.companyName??y4,entityType:"bill.details",entityId:r??y4,isGlobalComment:!1,application:"dashboard",tab:"bill",url:window.location.href}),[ue.currentTenant,r]),Hc=A&&e.billStage!=="draft"?WT(Wt,e.paymentDetailsSection?.withdrawFrom,e.paymentDetailsSection?.paymentDate):void 0;return t.jsxRuntimeExports.jsxs(UBt,{windowSize:de,ref:St,children:[e.showAutofill===!0&&de==="small"?t.jsxRuntimeExports.jsx(Rt,{title:"","data-testid":_("skip-autofill-section-bill-pay-nav-bar-mobile"),rightSideComponent:t.jsxRuntimeExports.jsx(QBt,{windowSize:de,onClick:()=>V(!1),"data-testid":_("skip-autofill-close-button-mobile"),children:t.jsxRuntimeExports.jsx(lee,{withOverlay:!0,children:t.jsxRuntimeExports.jsx(aee,{})})}),source:"EditableBillDetailPage"}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(GBt,{windowSize:de,"data-testid":_("bill-detail-container"),children:[t.jsxRuntimeExports.jsx(iPt,{windowSize:de,showAutoFill:e.showAutofill,children:de==="small"?t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("editable-bill-detail-container-nav-bar-small"),title:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ds,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{width:o.sp3,height:o.sp3}):null]}),hideSearchBtn:!0,backgroundColor:le.colors.grey4,rightSideComponent:t.jsxRuntimeExports.jsxs(cee,{windowSize:de,children:[we&&!ye?t.jsxRuntimeExports.jsxs(VS,{isDisabled:Ee,"data-testid":_("bill-comment-button-mobile"),onClick:Ee?()=>null:et=>{et.preventDefault(),et.stopPropagation(),he(!0),a.trackCommentActivity("bill","clicked",ue.currentTenant?.companyName??"",ue.controllersList.controllers.map(Jt=>cn(Jt)),void 0,void 0,"page icon")},children:[t.jsxRuntimeExports.jsx(Br,{count:Ee?void 0:_e,isLoading:Ee,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(QS,{})]}):null,t.jsxRuntimeExports.jsx(lee,{withOverlay:!1,"data-testid":_("editable-bill-detail-nav-bar-close-icon"),onClick:()=>Y?.(),children:t.jsxRuntimeExports.jsx(aee,{})}),t.jsxRuntimeExports.jsx(ms,{dataTestId:"editable-bill-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:je,onAskAiCfoClick:ce})]}),showBackButton:!1,showMenuIcon:!1,scrollableContent:St,source:"EditableBillDetailPage"}):t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("editable-bill-detail-container-nav-bar-large"),title:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ds,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{width:o.sp3,height:o.sp3}):null]}),showBackButton:!1,showMenuIcon:!1,hideSearchBtn:!0,backgroundColor:le.colors.grey4,rightSideComponent:t.jsxRuntimeExports.jsxs(cee,{windowSize:de,children:[we&&!ye?t.jsxRuntimeExports.jsxs(VS,{isDisabled:Ee,"data-testid":_("billpay-comment-button"),onClick:Ee?()=>null:et=>{et.preventDefault(),et.stopPropagation(),he(!0),a.trackCommentActivity("bill","clicked",ue.currentTenant?.companyName??"",ue.controllersList.controllers.map(Jt=>cn(Jt)),void 0,void 0,"page icon")},children:[t.jsxRuntimeExports.jsx(Br,{count:Ee?void 0:_e,isLoading:Ee,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(QS,{})]}):null,t.jsxRuntimeExports.jsx(ms,{dataTestId:"editable-bill-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:je,onAskAiCfoClick:ce})]}),enableTitleOnScroll:!0,scrollableContent:St,source:"EditableBillDetailPage"})}),t.jsxRuntimeExports.jsxs(YBt,{windowSize:de,children:[Ne?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:yt.title}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:yt.description}),primaryButtonText:yt.primaryButtonText,proceedButtonVariant:ut?void 0:"destructive",secondaryButtonText:yt.secondaryButtonText,action:_o,containerStyle:ut?{maxWidth:Tl.confirmationPopupWidth.value(de)}:void 0}):null,t.jsxRuntimeExports.jsxs(qBt,{children:[de!=="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(JBt,{windowSize:de,children:t.jsxRuntimeExports.jsxs(nPt,{children:[ds,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{height:o.sp3,width:o.sp3}):null]})}),Re&&e.billStage==="draft"&&t.jsxRuntimeExports.jsx(xd,{title:an.issueSyncing,description:`${an.accountPeriodClosed} ${an.updateDate}`,style:{marginBottom:o.sp3}})]}):Re&&e.billStage==="draft"&&t.jsxRuntimeExports.jsx(xd,{title:an.issueSyncing,description:`${an.accountPeriodClosed} ${an.updateDate}`,style:{marginBottom:js?o.sp3:0}}),de==="small"?t.jsxRuntimeExports.jsx(NT,{progressSectionObj:Mt,createDate:e.createTime,paymentDate:Lt,scheduleDate:fo,approvedDate:e.latestApprovedDate,isBillUploaded:r!=null?!0:e.uploadStatus?.fetchState==="Completed"}):t.jsxRuntimeExports.jsx(g5,{progressSectionObj:Mt,createDate:e.createTime,paymentDate:Lt,scheduleDate:fo,approvedDate:e.latestApprovedDate,isBillUploaded:r!=null?!0:e.uploadStatus?.fetchState==="Completed"}),js&&t.jsxRuntimeExports.jsxs(ZBt,{children:[t.jsxRuntimeExports.jsx(tPt,{}),t.jsxRuntimeExports.jsx(KBt,{children:an.banner})]})]}),VBt(e.isProcessing,e,Hc),t.jsxRuntimeExports.jsx(v0,{sharedItems:{sharedFunctions:void 0,sharedRef:{contentWrapperRef:jt.current??null}},children:t.jsxRuntimeExports.jsx(sPt,{ref:jt,children:t.jsxRuntimeExports.jsx(t.FormProvider,{...no,children:t.jsxRuntimeExports.jsxs("form",{id:oee(KX),onSubmit:ns,children:[t.jsxRuntimeExports.jsx(Zbe,{isBillPaid:kn,vendor:e.vendor,prevBills:e.previousBills,editVendor:en,chooseNewVendor:On,onAttachmentClick:Z,isNewBillPage:us,isVendorNameError:We,tentativeVendorName:e.addBillAutoFields.tentativeVendorName,isVendorWithNewCurrency:e.addBillAutoFields.isVendorWithNewCurrency,currencyInInvoice:e.addBillAutoFields.currencyInInvoice,vendorCurrency:e.addBillAutoFields.vendorCurrency,disableVendorActions:Ln===!0||Ot&&Dn,isVendorRecommendationEnabled:Ln===!0?!1:m,recommendedVendor:e.recommendedVendor,showVendorGptRecommendationText:e.showVendorGptRecommendationText,disableChooseNewVendor:e.recurringConfig?.isActive,analytics:a,vendorSearchAutoComplete:{vendorSearchAutoCompleteData:l,loadOptions:pn},currentVendorOption:vo,isBillPayCommentingEnabled:T,billId:r,sectionId:nC}),t.jsxRuntimeExports.jsx($Bt,{onAttachmentClick:Z,sectionId:hg,billWhatForInfo:e.whatForSection,duplicateBills:e.duplicateBills,autoFields:e.addBillAutoFields.whatForSectionFields,isDisabled:Ln===!0||Ot&&Dn?"disabled":void 0,bookCloseDate:e.bookCloseDate,doesBillExistOnQBO:Ot,isInvoiceDateBeforeBookCloseDateFromSavedDetails:Dn,isBillPayCommentingEnabled:T,billId:r}),t.jsxRuntimeExports.jsx(fRt,{billId:r,accountsList:e.accountList.accounts,classList:e.classList.classes,isAccountingClassesEnabled:f,accountsHierarchyList:e.accountsHierarchyList,classHierarchyList:e.classHierarchyList,sectionId:Ym,deleteConfirmationIndex:Bt,setDeleteConfirmationIndex:Ht,autoFields:e.addBillAutoFields.linesFields,vendorAccountId:Yn,vendorClassId:Hs,vendorRecommendations:e.vendor?.recommendations??[],isDisabled:Ln===!0||Ot&&Dn?"disabled":void 0,customerSearchAutoComplete:{customerSearchAutoCompleteData:l,loadOptions:ts},recommendationByLineId:e.recommendationByLineID,uncategorizedAccounts:i,billStage:e.billStage,isBillPayCommentingEnabled:T}),t.jsxRuntimeExports.jsxs(XBt,{windowSize:de,children:[t.jsxRuntimeExports.jsx(ePt,{children:an.total}),t.jsxRuntimeExports.jsx(ls,{amount:qe,integerStyles:z.largeBold.cssObject,decimalStyles:z.largeBold.cssObject,style:{color:le.colors.champion}})]}),t.jsxRuntimeExports.jsx(TTt,{sectionId:gs,vendorId:e.vendor?.id,vendorName:e.vendor?.name,paymentToOptions:Me,withdrawFromList:e.withdrawFromList,paymentDetails:e.paymentDetailsSection,vendor:e.vendor,billDueDate:e.whatForSection.billDueDate,allPaymentMethods:e.billPayConfigList,isShaDisabled:S,isOurDisabled:k,onClickAddAccount:$t,totalAmount:qe,isNewUser:b,sameDayAchDisablementConfig:C,autoFields:e.addBillAutoFields.whatForSectionFields,doesBillExistOnQBO:Ot,isInvoiceDateBeforeBookCloseDateFromSavedDetails:Dn,isBillMarkedForRetry:Ln,isPayNowEnabled:To,isVendorNameError:We,companyName:IQ(n.company?.companyInfo),isSameDayACHEnabled:n.company?.featuresActivationInfo.isSameDayAchFeatureEnabled??!1,isCollectFromVendor:e.isCollectToAccountInfoFromVendorContact,collectFromVendorEmail:e.toAccountVendorEmail,addVendorContactEmail:oe,vendorContactSaveStatus:e.vendorContactSaveStatus,isMagicLinkFeatureEnabled:d,isInternationalPaymentShaVsOurEnabled:u,onInternationalWireVerifyClick:G,isInvoiceAttached:!!e?.file,analytics:a,isRecurringBillsFeatureEnabled:x,isRecurringBill:e.isRecurring,recurringBillConfig:e.recurringConfig,recurringBillInstances:e.recurringBillInstances??[],onAttachmentClick:Z,isDraftBill:e.billStage==="draft",isAccountsEnabled:y,isAdmin:E,internationalVerificationStatus:e.internationalWireOnboardingStatus,onSignUpAccountClick:te,onMoveMoneyClick:se,accountsPromoConfig:$,showMarkAsPaidInfo:R,isBillPayCommentingEnabled:T,billId:r,totalAmountWithFees:Wt,isDetectInsufficientFundsEnabled:A,paymentType:xn,lowBalanceAdditionalInfo:Hc,isEligibleForRetryOBP:e.isEligibleForRetryOBP,plaidConnectionDetails:e.plaidConnectionDetails,paymentAccount:e.paymentAccount,onFetchLinkTokenClick:ie,onUpdatePaymentAccountStatus:re,onEstablishConnectionClick:ne,onEstablishConnectionSuccess:me}),$o?t.jsxRuntimeExports.jsx(TRt,{name:`${gs}.${Wbe}.updateRecurringBills`,selectedValue:e.recurringConfig?.updateRecurringBills,onSaveClick:N,onCancelClick:()=>Tt(!1)}):null,Gt?t.jsxRuntimeExports.jsx(t.FormProvider,{...ft,children:t.jsxRuntimeExports.jsx(Mbe,{description:an.vendorEmailPopupText,isLoading:e.vendorContactSaveStatus?.fetchState==="In-Progress",onCancelClick:()=>so(!1),onSaveClick:ft.handleSubmit(jn),textFieldName:Xe})}):null]})})})}),r!=null&&t.jsxRuntimeExports.jsx(h5,{amount:qe.amount,activities:e.billActivities,stage:"draft",entity:"bill_pay",historicActivities:e.billHistory.activities}),r==null&&xt.amount>0?t.jsxRuntimeExports.jsx(h5,{amount:xt.amount,activities:Yo,stage:"draft",entity:"bill_pay",historicActivities:e.billHistory.activities}):null,t.jsxRuntimeExports.jsx(oPt,{})]}),t.jsxRuntimeExports.jsx(_t,{separatorStyle:{marginRight:o.sp4},formId:oee(KX),cancelBtn:{label:qt??"",isLoading:Zs?.fetchState==="In-Progress",onClick:Ct,style:{width:Tl.footerButtonWidth.value(de)},reverseSpinnerColor:!1},primaryBtn:{label:dn??"",style:{width:Tl.footerButtonWidth.value(de)}},rightSideComponent:t.jsxRuntimeExports.jsx(PBt,{children:t.jsxRuntimeExports.jsxs(zBt,{windowSize:de,children:[dt?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>ct(!1),children:t.jsxRuntimeExports.jsx(OBt,{windowSize:de,children:t.jsxRuntimeExports.jsx(FBt,{onClick:ks,"data-testid":_("billpay-more-actions-delete-bill"),children:an.buttons.deleteBill})})}):null,t.jsxRuntimeExports.jsx(_Bt,{windowSize:de,children:Nt===!0?t.jsxRuntimeExports.jsx(DBt,{windowSize:de,children:t.jsxRuntimeExports.jsx(MBt,{onClick:()=>ct(!dt),"data-testid":_("billpay-more-actions-icon")})}):null})]})}),style:qn})]})}),we?t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:ye,allowComposer:!0,drawerTitle:LBt,threads:ve,filter:Ce,autoExpand:!0,autoFocus:!1,isLoading:Ee,textOverrides:{composerPlaceholder:XX.addANewComment,replyComposerPlaceholder:XX.replyAComment,threadResolve:eee.resolveComment,threadUnResolve:eee.unResolveComment},threadMetadata:ri,onThreadClick:Te,onCloseAllThreadsDrawer:()=>he(!1),drawerSectionStyle:{width:de==="small"?"100%":"400px",boxSizing:de==="small"?"border-box":"content-box",padding:`${o.sp0} ${Tl.drawerSectionPaddingLeftRight.valuePx(de)}`,backgroundColor:le.colors.background},collapsibleThreadStyle:{width:de==="small"?"100%":"360px"}}):null]})},BBt=e=>{const n=ht(),i=e.billId,r=e.isBillPayCommentingEnabled&&i!=null,a=n.currentTenant?.companyId;if(!(r&&a!=null&&i!=null))return t.jsxRuntimeExports.jsx(tee,{...e});const c=`dashboard_${a}`;return t.jsxRuntimeExports.jsx(q5,{roomId:c,filter:{application:"dashboard",companyId:a,entityId:i,tab:"bill",isGlobalComment:!1},children:t.jsxRuntimeExports.jsx(tee,{...e})})},PBt=s.div`
14073
+ `,B1=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M8 4C8.55228 4 9 3.55228 9 3C9 2.44772 8.55228 2 8 2C7.44772 2 7 2.44772 7 3C7 3.55228 7.44772 4 8 4Z",fill:"currentColor"}),j.createElement("path",{d:"M8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9Z",fill:"currentColor"}),j.createElement("path",{d:"M8 14C8.55228 14 9 13.5523 9 13C9 12.4477 8.55228 12 8 12C7.44772 12 7 12.4477 7 13C7 13.5523 7.44772 14 8 14Z",fill:"currentColor"})),Tl={containerPaddingLeft:new w(p[3],p[5],p[5]),containerPaddingRight:new w(p[3],p[5],p[5]),marginBottom:new w(p[3],p[3]),formTitlePaddingLeftRight:new w(30,0),marginTop:new w(p[1],0),closeContainerMarginTop:new w(p[1],0),rightIconsGap:new w(p[4],p[3]),formTitleMarginTopBottom:new w(0,p[3]),footerButtonWidth:new w(120,165),right:new w(p[3],p[0]),actionsContainerRight:new w(p[0],p[3]),otherActionsContainerBottom:new w(58,44),confirmationPopupWidth:new w(343,412,412),drawerSectionPaddingLeftRight:new w(p[4],p[5])},hg="whatFor",Ym="lineItems",KX="editBillDetailPage",gs="paymentDetails",{common:{currency:Mi,strings:{empty:y4}},dateFormat:IBt,spendManagement:{billPay:{billDetails:an,bulkActions:JX,insufficientFunds:TBt}},collaboration:{threads:{placeholder:XX,tooltip:eee,title:{comments:LBt}}}}=O.getLocalizedStrings(),tee=({billDetails:e,currentTenant:n,uncategorizedAccounts:i,billId:r,analytics:a,customerSearchAutoCompleteData:l,customerSearchAutoCompleteActions:c,isMagicLinkEnabled:d,isInternationalPaymentShaVsOurEnabled:u,isVendorRecommendationEnabled:m,isRecurringBillsFeatureEnabled:x,isLocalCurrencyEnabled:h,isAccountingClassesEnabled:f,isAccountsEnabled:y,sameDayAchDisablementConfig:C,isNewUser:b=!1,isAdmin:E,accountsPromoConfig:$,showMarkAsPaidInfo:R,isShaDisabled:S,isOurDisabled:k,isBillPayCommentingEnabled:T,isDetectInsufficientFundsEnabled:A,editVendor:I,chooseNewVendor:B,onSaveChangesToLocalStore:L,updateBillDetailSaveBillCode:P,clearBillPayReviewLocalState:D,discardBillDetailsFromLocalStore:M,saveBillDetails:F,updateShowAutofill:V,reviewBillDetails:N,redirectToACHScreen:H,redirectToWireScreen:W,redirectToInternationalScreen:U,redirectToBillsScreen:Y,redirectToBillDetailPage:q,onAttachmentClick:Z,onInternationalWireVerifyClick:G,onBackClick:K,deleteBill:J,addVendorContactEmail:oe,onVendorSelected:ee,onSignUpAccountClick:te,onMoveMoneyClick:se,onFetchLinkTokenClick:ie,onUpdatePaymentAccountStatus:re,onEstablishConnectionClick:ne,onEstablishConnectionSuccess:me,initialOpenThreadRequest:pe,isAiCfoAccessEnabled:je,onAskAiCfoClick:ce})=>{const de=X(),ue=ht(),le=t.useTheme(),ae=g.useRef(),ge=g.useRef(),[ye,he]=g.useState(!1),Ce={application:"dashboard",companyId:ue.currentTenant?.companyId,tab:"bill",entityId:r,isGlobalComment:!1},we=T&&r!=null,{threads:ve,isLoading:Ee}=Y5(),{requestToOpenThread:Se,setRequestToOpenThread:$e,setOpenThread:Be}=g.useContext(vs);g.useEffect(()=>{pe?.threadId!=null&&pe?.companyId!=null&&pe?.entityType!=null&&$e(pe)},[pe,$e]);const _e=g.useMemo(()=>r==null?[]:ve.filter(et=>et.resolved===!1&&!et.id.includes($s)),[ve,r]).length,Te=g.useCallback((et,Jt)=>{Be(Jt),he(!1)},[Be,he]);g.useEffect(()=>{Se?.threadId!=null&&ve.length>0&&!Ee&&(Be(Se.threadId),$e(null))},[Se,ve,Ee,Be,$e]);const[Re,ke]=g.useState(e.whatForSection.invoiceDate!=null&&e.bookCloseDate!=null&&e.whatForSection.invoiceDate.isBefore(e.bookCloseDate)),Oe=e.uploadStatus,Me=g.useMemo(()=>d?e.paymentToList:e.paymentToList.filter(et=>et.type==="BankAccount"||et.type==="PaymentInstrument"),[e.paymentToList,d]),Ie=Ye(Oe?.fetchState),[Ne,Pe]=g.useState(!1),[Qe,Je]=g.useState(!1),[tt,Ue]=g.useState(!1),[dt,ct]=g.useState(!1),[yt,He]=g.useState({title:"",description:"",primaryButtonText:"",secondaryButtonText:""}),jt=g.useRef(null),St=g.useRef(null),[We,nt]=g.useState(!1),[ut,pt]=g.useState(!1),[Bt,Ht]=g.useState(-1),[$o,Tt]=g.useState(!1),[Gt,so]=g.useState(!1),no=t.useForm({mode:"all",reValidateMode:"onBlur",defaultValues:rM(e,Me,d,l.entityAutoCompleteView),values:rM(e,Me,d,l.entityAutoCompleteView),resetOptions:{keepErrors:!0},shouldFocusError:!0}),Xe="vendorEmail",ft=t.useForm();g.useEffect(()=>{l.entityAutoCompleteView.fetchState==="Completed"&&(ae.current?.(HQ(l.entityAutoCompleteView)),ge.current?.(Rbe(l.entityAutoCompleteView,e.recommendedVendor,e.addBillAutoFields.tentativeVendorName)))},[l.entityAutoCompleteView.fetchState]);const oo=e.saveStatus,on=e.deleteStatus,To=e.payNowCutOffTime!=null?Q.dateNow().isSameOrBefore(e.payNowCutOffTime):!1;g.useEffect(()=>{if(Ie==="In-Progress"&&Oe?.fetchState==="Completed"){let et=e.paymentDetailsSection?.paymentDate;e.whatForSection.billDueDate!=null&&(et=ree(e.whatForSection.billDueDate,To,e.paymentDetailsSection?.paymentType?.maxPeriod.value)),no.reset(rM({...e,paymentDetailsSection:{...e.paymentDetailsSection,paymentDate:et}},Me,d,l.entityAutoCompleteView),{keepDefaultValues:!0})}},[e,Me,d,no,To,Ie,Oe,l]),g.useEffect(()=>{(oo.fetchState==="Completed"||on.fetchState==="Completed")&&(on.fetchState==="Completed"&&r!=null&&a.trackBillPayDeleteBill(r,e.isRecurring),oo.fetchState==="Completed"&&P(),M({billId:r}),Y?.())},[oo,on,Y,M,a,r]),g.useEffect(()=>{const et=no.watch((Jt,{name:gt})=>{gt!=null&&Jt!=null&&t.defer(()=>Mo(gt,Jt))});return()=>{et.unsubscribe()}}),g.useEffect(()=>{const et=e.whatForSection.invoiceDate;et!=null&&e.bookCloseDate!=null&&et.isBefore(e.bookCloseDate)?ke(!0):ke(!1)},[e.bookCloseDate,e.whatForSection.invoiceDate]),g.useEffect(()=>{e.vendorContactSaveStatus?.fetchState==="Completed"&&so(!1)},[e.vendorContactSaveStatus?.fetchState]);const kn=!1,Dn=e.editBillInitialDetails?.whatForSection?.invoiceDate!=null&&e.bookCloseDate!=null&&e.editBillInitialDetails?.whatForSection?.invoiceDate.isBefore(e.bookCloseDate),qt=iee(r,e.billStage,de)?.secondary,dn=iee(r,e.billStage,de)?.primary,Zs=e.saveStatus,Yn=e.vendor?.accountId,Hs=e.vendor?.classId,{isValid:yn,isDirty:Go}=no.formState,ds=e.billStage==="draft"?an.newBillTitle:an.editTitle;let In=!1;Object.values(e.addBillAutoFields).forEach(et=>{et?.length>0&&(In=!0)});const ts=(et,Jt)=>{c.onAutoCompleteInputChange?.(et,"customer"),ae.current=Jt},pn=(et,Jt)=>{c.onAutoCompleteInputChange?.(et,"vendor"),ge.current=Jt},_s=m&&e.recommendedVendor!=null&&e.addBillAutoFields.tentativeVendorName!=null,us=r==null,js=us&&In,xn=Vbe(u,h,e.billPayConfigList.filter(et=>Q.isPaymentMethodOutsideZeni(et.method)||et.method.includes(e.paymentDetailsSection?.withdrawFrom?.accType??"depositAccount")),e.paymentDetailsSection?.internationalTransferFeeBearerPaymentMethod,e.paymentDetailsSection?.paymentType,e.vendor?.vendorCurrencyCode),As=no.getValues("lineItems"),nn=As.reduce((et,Jt)=>et+(Jt.recipientAmount??0),0),os={amount:Mp(nn),currencyCode:As.length>0?As[0].recipientCurrency?.currencyCode??Mi.currencyCode:Mi.currencyCode,currencySymbol:As.length>0?As[0].recipientCurrency?.currencySymbol??Mi.currencySymbol:Mi.currencySymbol},qe=As.length>0?os:e.editBillInitialDetails?.recipientTotalAmount??{amount:0,currencyCode:Mi.currencyCode,currencySymbol:Mi.currencySymbol},xt={amount:qe!=null?Mp(qe.amount/(e.paymentDetailsSection?.conversionRate??1)):0,currencyCode:Mi.currencyCode,currencySymbol:Mi.currencySymbol},Wt={amount:xn?.method.includes("international")===!0?sC(xt,xn):xt.amount+(xn?.fee.amount??0),currencyCode:Mi.currencyCode,currencySymbol:Mi.currencySymbol};let Ze;const Mo=async(et,Jt)=>{Ze=parseInt(et.split(".")[1]);let gt=Jt[gs]?.paymentDate;const mn=Jt[hg]?.billDueDate,zt=Jt[hg].invoiceDate,tn=Jt[gs]?.paymentType,Dt=Jt[gs]?.paymentTo,mo=Jt[Ym][Ze]?.customer,to=Jt.lineItems;if(et.includes("memo")||et.includes("invoiceNumber")||et.includes("lineDescription")||et.includes("recipientAmount")||et.includes("amount")||f===!1&&et.includes("class"))return;let eo={...Jt};if(et.includes("whosItFor.vendor")){let Zo=Jt[nC].vendor.selectedOption;Zo===e.addBillAutoFields.tentativeVendorName&&(Zo=void 0),ee(Zo);return}else if((et.includes("billDueDate")||et.includes("paymentType")||et.includes("invoiceDate"))&&mn!=null){const Zo=ree(Q.zeniDate(mn.toDateString()),To,tn?.maxPeriod.value);(gt==null||Zo.isSame(gt,"date")===!1)&&(gt=Zo.toDate(),eo={...eo,[gs]:{...eo[gs],paymentDate:gt}})}else if(et.includes("paymentType")){const Zo=Me.find(ss=>ss.id===Dt?.selectedOption),hs=HBt(tn,e.paymentDetailsSection?.paymentTo,Zo);if(eo={...eo,[gs]:{...eo[gs],paymentTo:{selectedOption:hs?.id,allOptions:Me?.map(ss=>ss.id)}}},Jt[gs]?.paymentType?.method!=null&&Jt[gs].paymentType.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)===!0){const ss=e.billPayInfo?.billStatus,_a=e.billPayInfo?.billPaymentStatus,Do=ss?.code=="approved"&&_a?.code?_a:ss;a.trackIntlWirePaymentSelect(Do?.code??"",e.billPayInfo?.stage.code??"",e.isRecurring?["Recurring"]:["One-Time"],e.whatForSection.invoiceNumber??"",h)}}else if(!zt)eo={...eo,[hg]:{...eo[hg],invoiceDate:Q.dateNow().toDate()}};else if(et.includes("invoiceDate"))zt!=null&&e.bookCloseDate!=null&&Q.zeniDate(zt.toDateString()).isBefore(e.bookCloseDate)?ke(!0):ke(!1);else if(et.includes("customer")){const Zo=mo?.defaultOptions.map(hs=>hs.value);if(mo?.selectedOption!=null&&Zo?.includes(mo.selectedOption)!=!0){const hs=l.entityAutoCompleteView.customer.find(_a=>_a.id===Jt[Ym][Ze].customer?.selectedOption),ss=[...eo[Ym]];ss[Ze]={...ss[Ze],customer:{...ss[Ze].customer,defaultOptions:oC(hs,l.entityAutoCompleteView)}},eo={...eo,[Ym]:ss}}else if(mo?.selectedOption==null&&mo?.defaultOptions.length!=0){const hs=[...eo[Ym]];hs[Ze]={...hs[Ze],customer:{selectedOption:void 0,defaultOptions:[]}},eo={...eo,[Ym]:hs}}}else if(et.includes("lineItems")){const Zo=to[Ze]?.lineId,hs=e?.editBillInitialDetails?.lineDetailSection,ss=hs?.[Zo]?.account?.qboId,_a=hs?.[Zo]?.class?.classId,Do=[...eo[Ym]];if(et.includes("updateAllCheckbox")===!0)if(to[Ze].updateAllCheckbox===!0){const Wi=to[Ze].account.selectedOption,la=to[Ze].class?.selectedOption;Do.forEach((Oa,N1)=>{Do[N1]={...Oa,account:{...Oa.account,selectedOption:Wi},class:{...Oa.class,selectedOption:la},updateAllCheckbox:!0,isCategoryOrClassUpdated:!0,isCategoryUpdateSelected:Oa.recommendedCategory?.qboId===Wi,isClassUpdateSelected:Oa.recommendedClass?.classId===la,isRetainedCategorySelected:Oa.retainedCategory?.qboId===Wi,isRetainedClassSelected:Oa.retainedClass?.classId===la}})}else Do.forEach((Wi,la)=>{if(la===Ze){Do[la]={...Wi,updateAllCheckbox:!1};return}const Oa=hs?.[la+1]?.account?.qboId,N1=hs?.[la+1]?.class?.classId;Do[la]={...Wi,account:{...Wi.account,selectedOption:Oa},class:{...Wi.class,selectedOption:N1},isCategoryUpdateSelected:Wi.recommendedCategory?.qboId===Oa,isClassUpdateSelected:Wi.recommendedClass?.classId===N1,isRetainedCategorySelected:Wi.retainedCategory?.qboId===Oa,isRetainedClassSelected:Wi.retainedClass?.classId===N1,updateAllCheckbox:!1,isCategoryOrClassUpdated:!1}});else{const Wi=to.every(la=>la.account.selectedOption===to[0].account.selectedOption&&la.class?.selectedOption===to[0].class?.selectedOption);Do.forEach((la,Oa)=>{Do[Oa]={...la,updateAllCheckbox:Wi}})}et.includes("account")&&(to[Ze].account.selectedOption!==to[Ze].recommendedCategory?.qboId&&to[Ze].account.selectedOption!==to[Ze].recommendedCategory?.accountId?Do[Ze]={...Do[Ze],isCategoryUpdateSelected:!1,isCategoryFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}:(to[Ze].account.selectedOption===to[Ze].recommendedCategory?.qboId||to[Ze].account.selectedOption===to[Ze].recommendedCategory?.accountId)&&(Do[Ze]={...Do[Ze],isCategoryUpdateSelected:!0,isCategoryFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),to[Ze].account.selectedOption!==to[Ze].retainedCategory?.qboId&&to[Ze].account.selectedOption!==to[Ze].retainedCategory?.accountId?Do[Ze]={...Do[Ze],isRetainedCategorySelected:!1}:(to[Ze].account.selectedOption===to[Ze].retainedCategory?.qboId||to[Ze].account.selectedOption===to[Ze].retainedCategory?.accountId)&&(Do[Ze]={...Do[Ze],isRetainedCategorySelected:!0})),et.includes("class")&&(to[Ze].class.selectedOption!==to[Ze].recommendedClass?.classId?Do[Ze]={...Do[Ze],isClassUpdateSelected:!1,isClassFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}:to[Ze].class.selectedOption===to[Ze].recommendedClass?.classId&&(Do[Ze]={...Do[Ze],isClassUpdateSelected:!0,isClassFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),to[Ze].class.selectedOption!==to[Ze].retainedClass?.classId?Do[Ze]={...Do[Ze],isRetainedClassSelected:!1}:to[Ze].class.selectedOption===to[Ze].retainedClass?.classId&&(Do[Ze]={...Do[Ze],isRetainedClassSelected:!0})),et.includes("isRetainedCategorySelected")&&to[Ze].isRetainedCategorySelected===!0&&(Do[Ze]={...Do[Ze],isCategoryUpdateSelected:!1,account:{...Do[Ze].account,selectedOption:to[Ze].retainedCategory?.qboId??to[Ze].retainedCategory?.accountId},isCategoryFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),et.includes("isRetainedClassSelected")&&to[Ze].isRetainedClassSelected===!0&&(Do[Ze]={...Do[Ze],isClassUpdateSelected:!1,class:{...Do[Ze].class,selectedOption:to[Ze].retainedClass?.classId},isClassFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),et.includes("isCategoryUpdateSelected")&&(to[Ze].isCategoryUpdateSelected===!0?Do[Ze]={...Do[Ze],account:{...Do[Ze].account,selectedOption:to[Ze].recommendedCategory?.qboId},isRetainedCategorySelected:!1,isCategoryFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}:Do[Ze]={...Do[Ze],account:{...Do[Ze].account,selectedOption:ss},isCategoryFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),et.includes("isClassUpdateSelected")&&(to[Ze].isClassUpdateSelected===!0?Do[Ze]={...Do[Ze],class:{...Do[Ze].class,selectedOption:to[Ze].recommendedClass?.classId},isRetainedClassSelected:!1,isClassFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}:Do[Ze]={...Do[Ze],class:{...Do[Ze].class,selectedOption:_a},isClassFirstTimeAutofilled:!1,isCategoryOrClassUpdated:!0}),eo={...eo,[Ym]:Do}}else if(et.includes("endDateSelector.recurringCount")){const Zo=eo[gs]?.recurringPaymentDetails;eo={...eo,[gs]:{...eo[gs],recurringPaymentDetails:{frequency:Zo?.frequency??{allOptions:[],selectedOption:""},requireApproval:Zo?.requireApproval??{allOptions:[],selectedOption:""},startDate:Zo?.startDate,updateRecurringBills:Zo?.updateRecurringBills,endDateSelector:{...Zo?.endDateSelector??{},type:"recurringCount"}}}};return}else if(et.includes("endDateSelector.date")){const Zo=eo[gs]?.recurringPaymentDetails;eo={...eo,[gs]:{...eo[gs],recurringPaymentDetails:{frequency:Zo?.frequency??{allOptions:[],selectedOption:""},requireApproval:Zo?.requireApproval??{allOptions:[],selectedOption:""},startDate:Zo?.startDate,updateRecurringBills:Zo?.updateRecurringBills,endDateSelector:{...Zo?.endDateSelector??{},type:"date"}}}};return}else if(et.includes("endDateSelector.type")){no.trigger(`${gs}.recurringPaymentDetails.endDateSelector`);return}else if(et.includes("recurringPaymentType"))no.trigger(`${gs}`);else if(et.includes("withdrawFrom")&&A){const Zo=Jt[gs]?.withdrawFrom?.selectedOption,hs=e.withdrawFromList.find(ss=>ss.id===Zo);if(hs?.accountBalance?.available!=null){const ss=Q.checkIfLowBalance(Wt,hs.accountBalance.available),_a=e.billStage??"draft",Do=e.billPayInfo?.billPaymentStatus.code??"",Wi=e.isRecurring?["Recurring"]:["One-Time"],la=e.whatForSection.invoiceNumber??"",Oa=Ml(ue.loggedInUser),N1=hs.accType==="depositAccount"?"ZA":"External Account";ss?a?.trackLowBalanceAccountSelected(_a,Do,Wi,la,Oa,N1):e.paymentDetailsSection?.withdrawFrom?.accountBalance?.available!=null&&Q.checkIfLowBalance(Wt,e.paymentDetailsSection?.withdrawFrom.accountBalance.available)&&a?.trackLowBalanceAccountChange(_a,Do,Wi,la,Oa,N1)}}const mi=Me.find(Zo=>Zo.id===eo[gs]?.paymentTo?.selectedOption);L(eo,Ze,l.entityAutoCompleteView,mi,gt,r)},Lo=()=>{if(e.whatForSection.isInvoiceDateAutoUpdated===!0&&a.trackBillPayAutoDateChange(r??"new_bill"),Vt()){const et=no.getValues(),Jt=Me.find(gt=>gt.id===et[gs]?.paymentTo?.selectedOption);L(et,Ze,l.entityAutoCompleteView,Jt,et[gs]?.paymentDate,r),F()}},_n=()=>{const et=no.getValues(),Jt=et.whatFor.invoiceNumber,gt=et.whatFor.memo,mn=et.whatFor.invoiceDate,zt=et.whatFor.recipientCurrency??an.usd,tn=et.whatFor.billDueDate,Dt=et[gs]?.paymentTo?.selectedOption,mo=et[gs]?.internationalTransferFeeBearerPaymentMethod,to=Me.find(Wi=>Wi.id===Dt)?.type==="Contact",eo=et[gs]?.recurringPaymentType?.selectedOption===an.recurringBill.paymentTypeOptions[1],mi=et[gs]?.recurringPaymentDetails,Zo=e.editBillInitialDetails?.recipientTotalAmount?.amount,hs=IBt.visual.MMMDCommaYYYYformat,ss=e.vendor?.name,_a=e.addBillAutoFields.tentativeVendorName,Do=et[gs]?.paymentType?.method;if(mn!=null&&zt!=null&&ss!=null&&Do!=null){const Wi=Q.isPaymentMethodOutsideZeni(Do)?an.paymentOutsideZeni.offline:ud(Do);a.trackBillPayReviewBill(Wi,mn.toString(),zt,to,eo,ss,e.lastRecommendedVendorName,_a||void 0,r,Jt,tn?.toString(),gt,mo,{startDate:Q.zeniDate(mi?.startDate?.toString()??y4).format(hs),endDate:Q.zeniDate(mi?.endDateSelector?.date?.toString()??y4).format(hs),frequency:Q.toRecurringBillFrequency(mi?.frequency.selectedOption??y4),totalAmount:Zo??0,totalPaymentCycles:mi?.endDateSelector?.recurringCount??0,isApprovalRequired:mi?.requireApproval.selectedOption==="all"})}},ns=no.handleSubmit(()=>{if(e.vendor?.id==null)nt(!0);else if(!e.vendor.email)so(!0);else if(yn)if(nt(!1),_n(),e.isRecurring&&e.recurringConfig?.id!=null&&e$t(e))Tt(!0);else{const et=no.getValues(),Jt=Me.find(gt=>gt.id===et[gs]?.paymentTo?.selectedOption);L(et,Ze,l.entityAutoCompleteView,Jt,et[gs]?.paymentDate,r),N()}}),Vt=()=>{const et=no.getValues();let Jt=!0;return(et[hg].invoiceNumber?.length??0)>21&&(no.trigger(`${hg}.invoiceNumber`,{shouldFocus:!0}),Jt=!1),Jt},en=()=>{pt(!0),He({title:`${an.editPopupInformationTitle} ${e.vendor?.name}`,description:`${an.editConfirmationDescriptionFirstPart}${e.vendor?.name}${an.editConfirmationDescriptionSecondPart}`,primaryButtonText:an.edit,secondaryButtonText:an.cancel}),Pe(!0)},On=et=>{B(et)},$t=()=>{const et=e.paymentDetailsSection?.paymentType;e.vendor?.id!=null&&et!=null&&(et.method.toLowerCase().indexOf("ach")!==-1?H(e.vendor?.id):et.method.toLowerCase().indexOf("wire")!==-1&&et.method.toLowerCase().indexOf("domestic")!==-1?W(e.vendor?.id):et.method.toLowerCase().indexOf("wire")!==-1&&et.method.toLowerCase().indexOf("international")!==-1&&U(e.vendor?.id))},bo=()=>{pt(!1),He({title:an.discardTitle,description:an.discardDescription,primaryButtonText:an.discard,secondaryButtonText:an.cancel}),Pe(!0)},mt=e.editBillInitialDetails?.vendor?.id,Qt=e.vendor?.id,wt=mt!==Qt,Kt=et=>{Go||r===void 0&&e.file!=null&&e.billStage==="draft"||wt?(Ue(!0),bo()):(M({billId:r}),D(),K?.())},ks=()=>{pt(!1),He({title:an.deleteBillTitle,description:an.deleteAlertDescription,primaryButtonText:an.delete,secondaryButtonText:an.cancel}),Pe(!0)},_o={onOkClick:()=>{Pe(!1),yt.primaryButtonText===an.discard?(M({billId:r}),D(),tt?K?.():Qe?Y?.():q()):yt.primaryButtonText===an.edit?e.vendor!=null?(a.trackBillPayEditVendor(e.vendor.id),I(e.vendor.id)):_s&&e.recommendedVendor!=null&&(a.trackBillPayEditVendor(e.recommendedVendor.id),I(e.recommendedVendor.id)):yt.primaryButtonText===an.delete&&J?.()},onCancelClick:()=>{Pe(!1),Ue(!1),Je(!1)}},Ct=()=>{qt===an.buttons.saveChanges||qt===an.buttons.save?Lo():(qt===an.buttons.discardChanges||qt===an.buttons.discard)&&Kt()},Ot=e.qboId!=null;let Yo=[];if(r==null){const et=xt.amount;et>0&&(Yo=e.approvalRules.allApprovalRules?.filter(Jt=>{const gt=Jt.criteria[0].range;if(gt.max!=null){if(gt.min.amount<et&&gt.max.amount>=et)return Jt}else if(gt.min.amount<et)return Jt;return null}).map(Jt=>({...Jt,stepsWithStatus:Jt.steps.map(gt=>({...gt,actorsActivity:[],isOriginalApprovalStep:!0})),isRealTimeApprovalEnabled:!1})))}const Mt=e.billPayInfo?.isRefundInitiated===!0&&e.billPayInfo?.isRefundComplete===!1?e.billPayInfo?.billPaymentRefundStatus:e.billPayInfo?.billStatus?.code=="approved"&&e.billPayInfo?.billPaymentStatus?.code?e.billPayInfo?.billPaymentStatus:e.billPayInfo?.billStatus,fo=e.billPayInfo!=null?Q.getActualPaymentDate(e.billPayInfo):void 0,ot=fo!=null&&e.paymentDetailsSection?.paymentType?.maxPeriod?.value!=null?Q.zeniDate(Q.getNextNthWorkingDay(fo.toDate(),[0,6],e.paymentDetailsSection.paymentType.maxPeriod.value).toDateString()):void 0,Lt=e.billPayInfo?.expectedDepositDate??ot,Nt=r!=null&&e.billStage==="draft",qn={zIndex:e.showAutofill===!0?"unset":2},vo={defaultOptions:oL(e.vendor?.id,e.vendor?.name,l?.entityAutoCompleteView,e.recommendedVendor,e.addBillAutoFields.tentativeVendorName),selectedOption:e.vendor?.id??e.vendor?.name??""},jn=et=>{et[Xe]&&e.vendor?.id!=null&&oe?.(et[Xe],e.vendor.id)},Ln=e.isBillMarkedForRetry,ri=g.useMemo(()=>({companyId:ue.currentTenant?.companyId??y4,companyName:ue.currentTenant?.companyName??y4,entityType:"bill.details",entityId:r??y4,isGlobalComment:!1,application:"dashboard",tab:"bill",url:window.location.href}),[ue.currentTenant,r]),Hc=A&&e.billStage!=="draft"?WT(Wt,e.paymentDetailsSection?.withdrawFrom,e.paymentDetailsSection?.paymentDate):void 0;return t.jsxRuntimeExports.jsxs(UBt,{windowSize:de,ref:St,children:[e.showAutofill===!0&&de==="small"?t.jsxRuntimeExports.jsx(Rt,{title:"","data-testid":_("skip-autofill-section-bill-pay-nav-bar-mobile"),rightSideComponent:t.jsxRuntimeExports.jsx(QBt,{windowSize:de,onClick:()=>V(!1),"data-testid":_("skip-autofill-close-button-mobile"),children:t.jsxRuntimeExports.jsx(lee,{withOverlay:!0,children:t.jsxRuntimeExports.jsx(aee,{})})}),source:"EditableBillDetailPage"}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(GBt,{windowSize:de,"data-testid":_("bill-detail-container"),children:[t.jsxRuntimeExports.jsx(iPt,{windowSize:de,showAutoFill:e.showAutofill,children:de==="small"?t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("editable-bill-detail-container-nav-bar-small"),title:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ds,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{width:o.sp3,height:o.sp3}):null]}),hideSearchBtn:!0,backgroundColor:le.colors.grey4,rightSideComponent:t.jsxRuntimeExports.jsxs(cee,{windowSize:de,children:[we&&!ye?t.jsxRuntimeExports.jsxs(VS,{isDisabled:Ee,"data-testid":_("bill-comment-button-mobile"),onClick:Ee?()=>null:et=>{et.preventDefault(),et.stopPropagation(),he(!0),a.trackCommentActivity("bill","clicked",ue.currentTenant?.companyName??"",ue.controllersList.controllers.map(Jt=>cn(Jt)),void 0,void 0,"page icon")},children:[t.jsxRuntimeExports.jsx(Br,{count:Ee?void 0:_e,isLoading:Ee,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(QS,{})]}):null,t.jsxRuntimeExports.jsx(lee,{withOverlay:!1,"data-testid":_("editable-bill-detail-nav-bar-close-icon"),onClick:()=>Y?.(),children:t.jsxRuntimeExports.jsx(aee,{})}),t.jsxRuntimeExports.jsx(ms,{dataTestId:"editable-bill-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:je,onAskAiCfoClick:ce})]}),showBackButton:!1,showMenuIcon:!1,scrollableContent:St,source:"EditableBillDetailPage"}):t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("editable-bill-detail-container-nav-bar-large"),title:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ds,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{width:o.sp3,height:o.sp3}):null]}),showBackButton:!1,showMenuIcon:!1,hideSearchBtn:!0,backgroundColor:le.colors.grey4,rightSideComponent:t.jsxRuntimeExports.jsxs(cee,{windowSize:de,children:[we&&!ye?t.jsxRuntimeExports.jsxs(VS,{isDisabled:Ee,"data-testid":_("billpay-comment-button"),onClick:Ee?()=>null:et=>{et.preventDefault(),et.stopPropagation(),he(!0),a.trackCommentActivity("bill","clicked",ue.currentTenant?.companyName??"",ue.controllersList.controllers.map(Jt=>cn(Jt)),void 0,void 0,"page icon")},children:[t.jsxRuntimeExports.jsx(Br,{count:Ee?void 0:_e,isLoading:Ee,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(QS,{})]}):null,t.jsxRuntimeExports.jsx(ms,{dataTestId:"editable-bill-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:je,onAskAiCfoClick:ce})]}),enableTitleOnScroll:!0,scrollableContent:St,source:"EditableBillDetailPage"})}),t.jsxRuntimeExports.jsxs(YBt,{windowSize:de,children:[Ne?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:yt.title}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:yt.description}),primaryButtonText:yt.primaryButtonText,proceedButtonVariant:ut?void 0:"destructive",secondaryButtonText:yt.secondaryButtonText,action:_o,containerStyle:ut?{maxWidth:Tl.confirmationPopupWidth.value(de)}:void 0}):null,t.jsxRuntimeExports.jsxs(qBt,{children:[de!=="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(JBt,{windowSize:de,children:t.jsxRuntimeExports.jsxs(nPt,{children:[ds,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{height:o.sp3,width:o.sp3}):null]})}),Re&&e.billStage==="draft"&&t.jsxRuntimeExports.jsx(xd,{title:an.issueSyncing,description:`${an.accountPeriodClosed} ${an.updateDate}`,style:{marginBottom:o.sp3}})]}):Re&&e.billStage==="draft"&&t.jsxRuntimeExports.jsx(xd,{title:an.issueSyncing,description:`${an.accountPeriodClosed} ${an.updateDate}`,style:{marginBottom:js?o.sp3:0}}),de==="small"?t.jsxRuntimeExports.jsx(NT,{progressSectionObj:Mt,createDate:e.createTime,paymentDate:Lt,scheduleDate:fo,approvedDate:e.latestApprovedDate,isBillUploaded:r!=null?!0:e.uploadStatus?.fetchState==="Completed"}):t.jsxRuntimeExports.jsx(g5,{progressSectionObj:Mt,createDate:e.createTime,paymentDate:Lt,scheduleDate:fo,approvedDate:e.latestApprovedDate,isBillUploaded:r!=null?!0:e.uploadStatus?.fetchState==="Completed"}),js&&t.jsxRuntimeExports.jsxs(ZBt,{children:[t.jsxRuntimeExports.jsx(tPt,{}),t.jsxRuntimeExports.jsx(KBt,{children:an.banner})]})]}),VBt(e.isProcessing,e,Hc),t.jsxRuntimeExports.jsx(v0,{sharedItems:{sharedFunctions:void 0,sharedRef:{contentWrapperRef:jt.current??null}},children:t.jsxRuntimeExports.jsx(sPt,{ref:jt,children:t.jsxRuntimeExports.jsx(t.FormProvider,{...no,children:t.jsxRuntimeExports.jsxs("form",{id:oee(KX),onSubmit:ns,children:[t.jsxRuntimeExports.jsx(Zbe,{isBillPaid:kn,vendor:e.vendor,prevBills:e.previousBills,editVendor:en,chooseNewVendor:On,onAttachmentClick:Z,isNewBillPage:us,isVendorNameError:We,tentativeVendorName:e.addBillAutoFields.tentativeVendorName,isVendorWithNewCurrency:e.addBillAutoFields.isVendorWithNewCurrency,currencyInInvoice:e.addBillAutoFields.currencyInInvoice,vendorCurrency:e.addBillAutoFields.vendorCurrency,disableVendorActions:Ln===!0||Ot&&Dn,isVendorRecommendationEnabled:Ln===!0?!1:m,recommendedVendor:e.recommendedVendor,showVendorGptRecommendationText:e.showVendorGptRecommendationText,disableChooseNewVendor:e.recurringConfig?.isActive,analytics:a,vendorSearchAutoComplete:{vendorSearchAutoCompleteData:l,loadOptions:pn},currentVendorOption:vo,isBillPayCommentingEnabled:T,billId:r,sectionId:nC}),t.jsxRuntimeExports.jsx($Bt,{onAttachmentClick:Z,sectionId:hg,billWhatForInfo:e.whatForSection,duplicateBills:e.duplicateBills,autoFields:e.addBillAutoFields.whatForSectionFields,isDisabled:Ln===!0||Ot&&Dn?"disabled":void 0,bookCloseDate:e.bookCloseDate,doesBillExistOnQBO:Ot,isInvoiceDateBeforeBookCloseDateFromSavedDetails:Dn,isBillPayCommentingEnabled:T,billId:r}),t.jsxRuntimeExports.jsx(fRt,{billId:r,accountsList:e.accountList.accounts,classList:e.classList.classes,isAccountingClassesEnabled:f,accountsHierarchyList:e.accountsHierarchyList,classHierarchyList:e.classHierarchyList,sectionId:Ym,deleteConfirmationIndex:Bt,setDeleteConfirmationIndex:Ht,autoFields:e.addBillAutoFields.linesFields,vendorAccountId:Yn,vendorClassId:Hs,vendorRecommendations:e.vendor?.recommendations??[],isDisabled:Ln===!0||Ot&&Dn?"disabled":void 0,customerSearchAutoComplete:{customerSearchAutoCompleteData:l,loadOptions:ts},recommendationByLineId:e.recommendationByLineID,uncategorizedAccounts:i,billStage:e.billStage,isBillPayCommentingEnabled:T}),t.jsxRuntimeExports.jsxs(XBt,{windowSize:de,children:[t.jsxRuntimeExports.jsx(ePt,{children:an.total}),t.jsxRuntimeExports.jsx(ls,{amount:qe,integerStyles:z.largeBold.cssObject,decimalStyles:z.largeBold.cssObject,style:{color:le.colors.champion}})]}),t.jsxRuntimeExports.jsx(TTt,{sectionId:gs,vendorId:e.vendor?.id,vendorName:e.vendor?.name,paymentToOptions:Me,withdrawFromList:e.withdrawFromList,paymentDetails:e.paymentDetailsSection,vendor:e.vendor,billDueDate:e.whatForSection.billDueDate,allPaymentMethods:e.billPayConfigList,isShaDisabled:S,isOurDisabled:k,onClickAddAccount:$t,totalAmount:qe,isNewUser:b,sameDayAchDisablementConfig:C,autoFields:e.addBillAutoFields.whatForSectionFields,doesBillExistOnQBO:Ot,isInvoiceDateBeforeBookCloseDateFromSavedDetails:Dn,isBillMarkedForRetry:Ln,isPayNowEnabled:To,isVendorNameError:We,companyName:IQ(n.company?.companyInfo),isSameDayACHEnabled:n.company?.featuresActivationInfo.isSameDayAchFeatureEnabled??!1,isCollectFromVendor:e.isCollectToAccountInfoFromVendorContact,collectFromVendorEmail:e.toAccountVendorEmail,addVendorContactEmail:oe,vendorContactSaveStatus:e.vendorContactSaveStatus,isMagicLinkFeatureEnabled:d,isInternationalPaymentShaVsOurEnabled:u,onInternationalWireVerifyClick:G,isInvoiceAttached:!!e?.file,analytics:a,isRecurringBillsFeatureEnabled:x,isRecurringBill:e.isRecurring,recurringBillConfig:e.recurringConfig,recurringBillInstances:e.recurringBillInstances??[],onAttachmentClick:Z,isDraftBill:e.billStage==="draft",isAccountsEnabled:y,isAdmin:E,internationalVerificationStatus:e.internationalWireOnboardingStatus,onSignUpAccountClick:te,onMoveMoneyClick:se,accountsPromoConfig:$,showMarkAsPaidInfo:R,isBillPayCommentingEnabled:T,billId:r,totalAmountWithFees:Wt,isDetectInsufficientFundsEnabled:A,paymentType:xn,lowBalanceAdditionalInfo:Hc,isEligibleForRetryOBP:e.isEligibleForRetryOBP,plaidConnectionDetails:e.plaidConnectionDetails,paymentAccount:e.paymentAccount,onFetchLinkTokenClick:ie,onUpdatePaymentAccountStatus:re,onEstablishConnectionClick:ne,onEstablishConnectionSuccess:me}),$o?t.jsxRuntimeExports.jsx(TRt,{name:`${gs}.${Wbe}.updateRecurringBills`,selectedValue:e.recurringConfig?.updateRecurringBills,onSaveClick:N,onCancelClick:()=>Tt(!1)}):null,Gt?t.jsxRuntimeExports.jsx(t.FormProvider,{...ft,children:t.jsxRuntimeExports.jsx(Mbe,{description:an.vendorEmailPopupText,isLoading:e.vendorContactSaveStatus?.fetchState==="In-Progress",onCancelClick:()=>so(!1),onSaveClick:ft.handleSubmit(jn),textFieldName:Xe})}):null]})})})}),r!=null&&t.jsxRuntimeExports.jsx(h5,{amount:qe.amount,activities:e.billActivities,stage:"draft",entity:"bill_pay",historicActivities:e.billHistory.activities}),r==null&&xt.amount>0?t.jsxRuntimeExports.jsx(h5,{amount:xt.amount,activities:Yo,stage:"draft",entity:"bill_pay",historicActivities:e.billHistory.activities}):null,t.jsxRuntimeExports.jsx(oPt,{})]}),t.jsxRuntimeExports.jsx(_t,{separatorStyle:{marginRight:o.sp4},formId:oee(KX),cancelBtn:{label:qt??"",isLoading:Zs?.fetchState==="In-Progress",onClick:Ct,style:{width:Tl.footerButtonWidth.value(de)},reverseSpinnerColor:!1},primaryBtn:{label:dn??"",style:{width:Tl.footerButtonWidth.value(de)}},rightSideComponent:t.jsxRuntimeExports.jsx(PBt,{children:t.jsxRuntimeExports.jsxs(zBt,{windowSize:de,children:[dt?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>ct(!1),children:t.jsxRuntimeExports.jsx(OBt,{windowSize:de,children:t.jsxRuntimeExports.jsx(FBt,{onClick:ks,"data-testid":_("billpay-more-actions-delete-bill"),children:an.buttons.deleteBill})})}):null,t.jsxRuntimeExports.jsx(_Bt,{windowSize:de,children:Nt===!0?t.jsxRuntimeExports.jsx(DBt,{windowSize:de,children:t.jsxRuntimeExports.jsx(MBt,{onClick:()=>ct(!dt),"data-testid":_("billpay-more-actions-icon")})}):null})]})}),style:qn})]})}),we?t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:ye,allowComposer:!0,drawerTitle:LBt,threads:ve,filter:Ce,autoExpand:!0,autoFocus:!1,isLoading:Ee,textOverrides:{composerPlaceholder:XX.addANewComment,replyComposerPlaceholder:XX.replyAComment,threadResolve:eee.resolveComment,threadUnResolve:eee.unResolveComment},threadMetadata:ri,onThreadClick:Te,onCloseAllThreadsDrawer:()=>he(!1),drawerSectionStyle:{width:de==="small"?"100%":"400px",boxSizing:de==="small"?"border-box":"content-box",padding:`${o.sp0} ${Tl.drawerSectionPaddingLeftRight.valuePx(de)}`,backgroundColor:le.colors.background},collapsibleThreadStyle:{width:de==="small"?"100%":"360px"}}):null]})},BBt=e=>{const n=ht(),i=e.billId,r=e.isBillPayCommentingEnabled&&i!=null,a=n.currentTenant?.companyId;if(!(r&&a!=null&&i!=null))return t.jsxRuntimeExports.jsx(tee,{...e});const c=`dashboard_${a}`;return t.jsxRuntimeExports.jsx(q5,{roomId:c,filter:{application:"dashboard",companyId:a,entityId:i,tab:"bill",isGlobalComment:!1},children:t.jsxRuntimeExports.jsx(tee,{...e})})},PBt=s.div`
14074
14074
  display: flex;
14075
14075
  justify-content: flex-end;
14076
14076
  `,MBt=s(B1)`
@@ -17983,7 +17983,7 @@ to {
17983
17983
  box-sizing: border-box;
17984
17984
  `,IQt=s(es)`
17985
17985
  color: ${e=>e.isDarkTheme?v.brandColorJadeLight:e.theme.colors.brandColorSapphire};
17986
- `,Ste=45,pH=3;function TQt({googleClientId:e,microsoftClientId:n,fetchState:i,signInError:r={},showEmailLogin:a=!1,sendMagicLinkStatus:l,magicLinkAlreadyUsed:c,magicLinkExpired:d,magicLinkExpiredEmail:u,getSignedInUser:m,onSignedInCallback:x,clearSignInError:h,onOAuthSuccess:f,onOAuthError:y,sendMagicLink:C}){const b=X(),{dark:E}=WQ(),{analytics:$}=ro(),R=OWt(.68,1.2,1440,2560),S=i==="In-Progress",k=i==="Error",[T,A]=g.useState(void 0),[I,B]=g.useState(""),[L,P]=g.useState(!1),[D,M]=g.useState(!1),[F,V]=g.useState(void 0),[N,H]=g.useState(!1),[W]=g.useState(()=>hVt()),U=i==="In-Progress"&&I==="google",Y=i==="In-Progress"&&I==="microsoft",q=t.useForm({mode:"onSubmit",defaultValues:{email:""}}),{register:Z,handleSubmit:G,formState:{errors:K},setValue:J,watch:oe,clearErrors:ee}=q,te=l.fetchState==="Error"&&l.error?.details?.application_error_code!=="LOGIN_VIA_EMAIL_LOCKED",se=oe("email"),ie=!!K.email||D||te,re=!!K.email;g.useEffect(()=>{d===!0&&u!=null&&u.trim()!==""&&J("email",u)},[d,u,J]),g.useEffect(()=>{a&&l.fetchState==="Error"&&l.error?.details?.application_error_code==="LOGIN_VIA_MAGIC_LINK_RESTRICTED"&&(H(!1),V(()=>{const Pe=l.error?.details?.domain_type;if(Pe==="google"||Pe==="microsoft")return Pe}))},[l.error?.details,l.fetchState,a]);const ne=Pe=>{M(!1),Pe.email.trim()&&($.trackSignInClick("email"),C?.(Pe.email))},me=()=>{M(!1),ee("email")},pe=k&&r.type==="email_not_found";g.useEffect(()=>{(pe||l.fetchState==="Completed")&&P(!0)},[pe,l.fetchState]);const je=Pe=>{console.log(JSON.stringify(Pe)),A(void 0),f(Pe.code,"google"),B("google")},ce=Pe=>{const Ue="Error = "+Pe?.error+" Error Description = "+Pe?.error_description;A(Ue),y?.(JSON.stringify(Pe),"google")},de=Pe=>{console.log(JSON.stringify(Pe)),A(void 0),f(Pe.code,"microsoft"),B("microsoft")},ue=Pe=>{console.log(JSON.stringify(Pe)),A(Pe.error??"Microsoft authorization failed."),y?.(JSON.stringify(Pe),"microsoft")},le=()=>{let Pe="";return(k||T!=null)&&L===!1&&(Pe=T??wn.signIn.signInAuthError),Pe},[ae,ge]=g.useState(!1);g.useEffect(()=>{l.fetchState==="Completed"&&ge(!0)},[l.fetchState]);const ye=ae&&!L,he=W!=null&&!ye,Ce=ye?wn.signIn.confirmationLinkSent:he?wn.signIn.autoLogoutHeading:wn.signIn.heading,we=he?`${wn.signIn.autoLogoutMessagePrefix}${yVt(W?.idleTimeoutMinutes??60)}${wn.signIn.autoLogoutMessageSuffix}`:F!=null?wn.signIn.signInSecurelyMessage:wn.signIn.message,ve=c===!0&&!ye,Ee=d===!0&&!ve&&!ye,Se=()=>{u!=null&&u.trim()!==""&&C?.(u)},[$e,Be]=g.useState(0),[Ae,_e]=g.useState(0),Te=Ae>=pH,[Re,ke]=g.useState(0);g.useEffect(()=>{ye&&Be(Ste)},[ye]),g.useEffect(()=>{if($e<=0)return;const Pe=setTimeout(()=>Be($e-1),1e3);return()=>clearTimeout(Pe)},[$e]),g.useEffect(()=>{Te&&ke(vQt)},[Te]),g.useEffect(()=>{if(Re<=0||l.fetchState==="In-Progress")return;const Pe=setTimeout(()=>{const Ue=Re-1;ke(Ue),Ue===0&&(ge(!1),_e(0),H(!1))},1e3);return()=>clearTimeout(Pe)},[Re,l.fetchState]);const Oe=()=>{Te||(C?.(se),_e(Pe=>Pe+1),Be(Ste))},Me=l.error?.details?.user,Ie=Me?.first_name??void 0,Ne=Me?.photo?.original!=null?Q.toZeniUrl(Me.photo.original):void 0;return t.jsxRuntimeExports.jsxs(rQt,{windowSize:b,children:[t.jsxRuntimeExports.jsxs(aQt,{windowSize:b,children:[t.jsxRuntimeExports.jsxs(yQt,{children:[t.jsxRuntimeExports.jsx(gQt,{windowSize:b,children:t.jsxRuntimeExports.jsx(fQt,{className:"zeni-logo"})}),ve?t.jsxRuntimeExports.jsx(wM,{windowSize:b,style:{flex:1},children:t.jsxRuntimeExports.jsxs(AQt,{children:[t.jsxRuntimeExports.jsx(vte,{windowSize:b,children:wn.signIn.magicLinkAlreadyUsedHeading}),t.jsxRuntimeExports.jsxs(kQt,{isDarkTheme:E,children:[t.jsxRuntimeExports.jsx(jte,{children:t.jsxRuntimeExports.jsx(yte,{})}),t.jsxRuntimeExports.jsx(IQt,{isDarkTheme:E,children:wn.signIn.magicLinkAlreadyUsedMessage})]}),t.jsxRuntimeExports.jsx(Ge,{variant:"primary",label:wn.signIn.requestNewLink,onClick:Se,loading:l.fetchState==="In-Progress"})]})}):Ee?t.jsxRuntimeExports.jsx(wM,{windowSize:b,style:{flex:1},children:t.jsxRuntimeExports.jsxs(SQt,{children:[t.jsxRuntimeExports.jsx(vte,{windowSize:b,children:wn.signIn.magicLinkExpiredHeading}),t.jsxRuntimeExports.jsx(Ge,{variant:"primary",label:wn.signIn.requestNewLink,onClick:Se,loading:l.fetchState==="In-Progress"})]})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs($te,{isMagicLinkSent:ye,windowSize:b,style:{display:b==="small"?"flex":"none"},children:[t.jsxRuntimeExports.jsx(pte,{windowSize:b,children:Ce}),t.jsxRuntimeExports.jsx(bt,{controller:!ye,children:t.jsxRuntimeExports.jsx(mte,{windowSize:b,children:we})}),t.jsxRuntimeExports.jsx(bt,{controller:ye,children:t.jsxRuntimeExports.jsxs(gte,{children:[t.jsxRuntimeExports.jsx(fte,{isDarkTheme:E,"data-testid":_("magic-link-primary-message","small"),children:t.jsxRuntimeExports.jsx(Cte,{isDarkTheme:E,children:O.getLocalizedStrings().signIn.magicLinkSent.primaryMessage.split("__email__").map((Pe,Ue,Je)=>t.jsxRuntimeExports.jsxs(wte,{children:[Pe,Ue<Je.length-1&&t.jsxRuntimeExports.jsx(bte,{children:se})]},Ue))})}),t.jsxRuntimeExports.jsx(Ete,{children:wn.signIn.magicLinkSent.secondaryMessage}),t.jsxRuntimeExports.jsx(Rte,{resendCountdown:$e,resendCount:Ae,resendLimitReached:Te,redirectCountdown:Re,onClick:Oe})]})})]}),t.jsxRuntimeExports.jsxs($te,{isMagicLinkSent:ye,windowSize:b,style:{display:b==="small"?"none":"flex"},children:[t.jsxRuntimeExports.jsx(pte,{windowSize:b,children:Ce}),t.jsxRuntimeExports.jsx(bt,{controller:!ye,children:t.jsxRuntimeExports.jsx(mte,{windowSize:b,children:we})}),t.jsxRuntimeExports.jsx(bt,{controller:ye,children:t.jsxRuntimeExports.jsxs(gte,{children:[t.jsxRuntimeExports.jsxs(fte,{isDarkTheme:E,"data-testid":_("magic-link-primary-message","large"),children:[t.jsxRuntimeExports.jsx(jte,{children:t.jsxRuntimeExports.jsx(yte,{})}),t.jsxRuntimeExports.jsx(Cte,{isDarkTheme:E,children:O.getLocalizedStrings().signIn.magicLinkSent.primaryMessage.split("__email__").map((Pe,Ue,Je)=>t.jsxRuntimeExports.jsxs(wte,{children:[Pe,Ue<Je.length-1&&t.jsxRuntimeExports.jsx(bte,{children:se})]},Ue))})]}),t.jsxRuntimeExports.jsx(Ete,{children:wn.signIn.magicLinkSent.secondaryMessage}),t.jsxRuntimeExports.jsx(Rte,{resendCountdown:$e,resendCount:Ae,resendLimitReached:Te,redirectCountdown:Re,onClick:Oe})]})})]}),t.jsxRuntimeExports.jsx(bt,{controller:!ye,children:t.jsxRuntimeExports.jsxs(wM,{windowSize:b,children:[t.jsxRuntimeExports.jsxs(mQt,{showEmailError:ie,showEmailForm:N,children:[!N&&!F&&t.jsxRuntimeExports.jsxs(xQt,{windowSize:b,children:[t.jsxRuntimeExports.jsx(t.GoogleOAuthProvider,{clientId:e,children:t.jsxRuntimeExports.jsx(lte,{disabled:S,inProgress:U,getSignedInUser:m,onSuccess:je,onSignedInCallback:x,onError:ce})}),t.jsxRuntimeExports.jsx(cte,{clientId:n,scopes:["openid","profile","email","offline_access","User.Read"],getSignedInUser:m,prompt:"select_account",responseType:"code",responseMode:"query",render:Pe=>t.jsxRuntimeExports.jsx(uH,{onClick:Pe.onClick,disabled:S||Pe.disabled,type:"Microsoft",titleText:wn.signIn.signInMicrosoftButton,loadingIndication:Y}),onSignedInCallback:x,onSuccess:de,onFailure:ue})]}),!N&&F==="google"&&t.jsxRuntimeExports.jsx(t.GoogleOAuthProvider,{clientId:e,children:t.jsxRuntimeExports.jsx(lte,{disabled:S,inProgress:U,email:se,firstName:Ie,photo:Ne,getSignedInUser:m,onSuccess:je,onSignedInCallback:x,onError:ce})}),!N&&F==="microsoft"&&t.jsxRuntimeExports.jsx(cte,{clientId:n,scopes:["openid","profile","email","offline_access","User.Read"],getSignedInUser:m,prompt:"select_account",responseType:"code",responseMode:"query",render:Pe=>t.jsxRuntimeExports.jsx(uH,{onClick:Pe.onClick,disabled:S||Pe.disabled,type:"Microsoft",titleText:wn.signIn.signInMicrosoftButton,loadingIndication:Y,email:se,firstName:Ie,photo:Ne}),onSignedInCallback:x,onSuccess:de,onFailure:ue}),a&&N&&t.jsxRuntimeExports.jsx(t.FormProvider,{...q,children:t.jsxRuntimeExports.jsxs(cQt,{windowSize:b,children:[t.jsxRuntimeExports.jsx(CQt,{onSubmit:G(ne),children:t.jsxRuntimeExports.jsxs(dQt,{windowSize:b,hasError:re,children:[t.jsxRuntimeExports.jsx(uQt,{windowSize:b,type:"text",placeholder:wn.signIn.workEmailExample,variant:"outlined",fullWidth:!0,isValid:!re,autoComplete:"off",...Z("email",{required:wn.signIn.invalidEmailMessage,pattern:{value:zp,message:wn.signIn.invalidEmailMessage},onChange:me})}),t.jsxRuntimeExports.jsx(bQt,{variant:"primary",type:"submit",label:wn.signIn.signInButton,loading:l.fetchState==="In-Progress"})]})}),ie&&t.jsxRuntimeExports.jsx(pQt,{children:D?wn.signIn.magicLinkExpired:te?wn.common.errorMessage.somethingWentWrongPleaseTryAgain:wn.signIn.invalidEmailMessage})]})}),a&&!F&&t.jsxRuntimeExports.jsxs(oQt,{children:[t.jsxRuntimeExports.jsxs(eQt,{showEmailForm:N,windowSize:b,children:[t.jsxRuntimeExports.jsx(ute,{showEmailForm:N,windowSize:b}),t.jsxRuntimeExports.jsx(tQt,{children:wn.common.texts.or.toUpperCase()}),t.jsxRuntimeExports.jsx(ute,{showEmailForm:N,windowSize:b})]}),t.jsxRuntimeExports.jsxs(iQt,{children:[t.jsxRuntimeExports.jsx(nQt,{onClick:()=>{N?$.trackSignInViaGoogleMicrosoft():$.trackSignInViaEmail(),H(!N)},children:N?wn.signIn.googleOrMicrosoftLink:wn.signIn.workEmailLink}),t.jsxRuntimeExports.jsx(sQt,{isVisible:!N,children:wn.signIn.workEmailSubText})]})]})]}),L===!1&&k&&t.jsxRuntimeExports.jsx(hQt,{children:t.jsxRuntimeExports.jsx(lQt,{children:le()})})]})})]})]}),t.jsxRuntimeExports.jsx(bt,{controller:b!=="small",children:t.jsxRuntimeExports.jsx(jQt,{children:t.jsxRuntimeExports.jsx(n8e,{scale:R})})}),t.jsxRuntimeExports.jsx(xte,{style:{maxWidth:"100%",textAlign:"center",marginBottom:b==="small"?o.sp5:o.sp1},children:t.jsxRuntimeExports.jsxs(xte,{children:[t.jsxRuntimeExports.jsxs(hte,{children:[wn.signIn.termsPrivacyFinePrintPart,wn.signIn.agreeWith,t.jsxRuntimeExports.jsx(Kn,{href:wn.signIn.termsUrl,target:"_Blank",rel:"noopener noreferrer",linkText:wn.signIn.termsOfService})," ",wn.signIn.and," ",t.jsxRuntimeExports.jsx(Kn,{href:wn.signIn.privacyPolicyUrl,target:"_Blank",rel:"noopener noreferrer",linkText:wn.signIn.privacyPolicy}),"."]}),t.jsxRuntimeExports.jsx(hte,{children:t.jsxRuntimeExports.jsx(o8e,{})})]})})]}),L&&t.jsxRuntimeExports.jsx(FVt,{onClose:()=>{h(),P(!1),ge(!1)}})]})}class LQt{constructor(n,i,r,a,l,c){this.width=n,this.height=i,this.marginTop=r,this.marginRight=a,this.marginBottom=l,this.marginLeft=c}width;height;marginTop;marginRight;marginBottom;marginLeft;get widthCss(){return this.width+"px"}get heightCss(){return this.height+"px"}get marginTopCss(){return this.marginTop+"px"}get marginRightCss(){return this.marginRight+"px"}get marginBottomCss(){return this.marginBottom+"px"}get marginLeftCss(){return this.marginLeft+"px"}get totalWidth(){return this.width+this.marginLeft+this.marginRight}set totalWidth(n){this.width=n-this.marginLeft-this.marginRight}get totalHeight(){return this.height+this.marginTop+this.marginBottom}set totalHeight(n){this.height=n-this.marginTop-this.marginBottom}}const pi=s.div`
17986
+ `,Ste=45,pH=3;function TQt({googleClientId:e,microsoftClientId:n,fetchState:i,signInError:r={},showEmailLogin:a=!1,sendMagicLinkStatus:l,magicLinkAlreadyUsed:c,magicLinkExpired:d,magicLinkExpiredEmail:u,getSignedInUser:m,onSignedInCallback:x,clearSignInError:h,onOAuthSuccess:f,onOAuthError:y,sendMagicLink:C}){const b=X(),{dark:E}=WQ(),{analytics:$}=ro(),R=OWt(.68,1.2,1440,2560),S=i==="In-Progress",k=i==="Error",[T,A]=g.useState(void 0),[I,B]=g.useState(""),[L,P]=g.useState(!1),[D,M]=g.useState(!1),[F,V]=g.useState(void 0),[N,H]=g.useState(!1),[W]=g.useState(()=>hVt()),U=i==="In-Progress"&&I==="google",Y=i==="In-Progress"&&I==="microsoft",q=t.useForm({mode:"onSubmit",defaultValues:{email:""}}),{register:Z,handleSubmit:G,formState:{errors:K},setValue:J,watch:oe,clearErrors:ee}=q,te=l.fetchState==="Error"&&l.error?.details?.application_error_code!=="LOGIN_VIA_EMAIL_LOCKED",se=oe("email"),ie=!!K.email||D||te,re=!!K.email;g.useEffect(()=>{d===!0&&u!=null&&u.trim()!==""&&J("email",u)},[d,u,J]),g.useEffect(()=>{a&&l.fetchState==="Error"&&l.error?.details?.application_error_code==="LOGIN_VIA_MAGIC_LINK_RESTRICTED"&&(H(!1),V(()=>{const Pe=l.error?.details?.domain_type;if(Pe==="google"||Pe==="microsoft")return Pe}))},[l.error?.details,l.fetchState,a]);const ne=Pe=>{M(!1),Pe.email.trim()&&($.trackSignInClick("email"),C?.(Pe.email))},me=()=>{M(!1),ee("email")},pe=k&&r.type==="email_not_found";g.useEffect(()=>{(pe||l.fetchState==="Completed")&&P(!0)},[pe,l.fetchState]);const je=Pe=>{console.log(JSON.stringify(Pe)),A(void 0),f(Pe.code,"google"),B("google")},ce=Pe=>{const Qe="Error = "+Pe?.error+" Error Description = "+Pe?.error_description;A(Qe),y?.(JSON.stringify(Pe),"google")},de=Pe=>{console.log(JSON.stringify(Pe)),A(void 0),f(Pe.code,"microsoft"),B("microsoft")},ue=Pe=>{console.log(JSON.stringify(Pe)),A(Pe.error??"Microsoft authorization failed."),y?.(JSON.stringify(Pe),"microsoft")},le=()=>{let Pe="";return(k||T!=null)&&L===!1&&(Pe=T??wn.signIn.signInAuthError),Pe},[ae,ge]=g.useState(!1);g.useEffect(()=>{l.fetchState==="Completed"&&ge(!0)},[l.fetchState]);const ye=ae&&!L,he=W!=null&&!ye,Ce=ye?wn.signIn.confirmationLinkSent:he?wn.signIn.autoLogoutHeading:wn.signIn.heading,we=he?`${wn.signIn.autoLogoutMessagePrefix}${yVt(W?.idleTimeoutMinutes??60)}${wn.signIn.autoLogoutMessageSuffix}`:F!=null?wn.signIn.signInSecurelyMessage:wn.signIn.message,ve=c===!0&&!ye,Ee=d===!0&&!ve&&!ye,Se=()=>{u!=null&&u.trim()!==""&&C?.(u)},[$e,Be]=g.useState(0),[Ae,_e]=g.useState(0),Te=Ae>=pH,[Re,ke]=g.useState(0);g.useEffect(()=>{ye&&Be(Ste)},[ye]),g.useEffect(()=>{if($e<=0)return;const Pe=setTimeout(()=>Be($e-1),1e3);return()=>clearTimeout(Pe)},[$e]),g.useEffect(()=>{Te&&ke(vQt)},[Te]),g.useEffect(()=>{if(Re<=0||l.fetchState==="In-Progress")return;const Pe=setTimeout(()=>{const Qe=Re-1;ke(Qe),Qe===0&&(ge(!1),_e(0),H(!1))},1e3);return()=>clearTimeout(Pe)},[Re,l.fetchState]);const Oe=()=>{Te||(C?.(se),_e(Pe=>Pe+1),Be(Ste))},Me=l.error?.details?.user,Ie=Me?.first_name??void 0,Ne=Me?.photo?.original!=null?Q.toZeniUrl(Me.photo.original):void 0;return t.jsxRuntimeExports.jsxs(rQt,{windowSize:b,children:[t.jsxRuntimeExports.jsxs(aQt,{windowSize:b,children:[t.jsxRuntimeExports.jsxs(yQt,{children:[t.jsxRuntimeExports.jsx(gQt,{windowSize:b,children:t.jsxRuntimeExports.jsx(fQt,{className:"zeni-logo"})}),ve?t.jsxRuntimeExports.jsx(wM,{windowSize:b,style:{flex:1},children:t.jsxRuntimeExports.jsxs(AQt,{children:[t.jsxRuntimeExports.jsx(vte,{windowSize:b,children:wn.signIn.magicLinkAlreadyUsedHeading}),t.jsxRuntimeExports.jsxs(kQt,{isDarkTheme:E,children:[t.jsxRuntimeExports.jsx(jte,{children:t.jsxRuntimeExports.jsx(yte,{})}),t.jsxRuntimeExports.jsx(IQt,{isDarkTheme:E,children:wn.signIn.magicLinkAlreadyUsedMessage})]}),t.jsxRuntimeExports.jsx(Ge,{variant:"primary",label:wn.signIn.requestNewLink,onClick:Se,loading:l.fetchState==="In-Progress"})]})}):Ee?t.jsxRuntimeExports.jsx(wM,{windowSize:b,style:{flex:1},children:t.jsxRuntimeExports.jsxs(SQt,{children:[t.jsxRuntimeExports.jsx(vte,{windowSize:b,children:wn.signIn.magicLinkExpiredHeading}),t.jsxRuntimeExports.jsx(Ge,{variant:"primary",label:wn.signIn.requestNewLink,onClick:Se,loading:l.fetchState==="In-Progress"})]})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs($te,{isMagicLinkSent:ye,windowSize:b,style:{display:b==="small"?"flex":"none"},children:[t.jsxRuntimeExports.jsx(pte,{windowSize:b,children:Ce}),t.jsxRuntimeExports.jsx(bt,{controller:!ye,children:t.jsxRuntimeExports.jsx(mte,{windowSize:b,children:we})}),t.jsxRuntimeExports.jsx(bt,{controller:ye,children:t.jsxRuntimeExports.jsxs(gte,{children:[t.jsxRuntimeExports.jsx(fte,{isDarkTheme:E,"data-testid":_("magic-link-primary-message","small"),children:t.jsxRuntimeExports.jsx(Cte,{isDarkTheme:E,children:O.getLocalizedStrings().signIn.magicLinkSent.primaryMessage.split("__email__").map((Pe,Qe,Je)=>t.jsxRuntimeExports.jsxs(wte,{children:[Pe,Qe<Je.length-1&&t.jsxRuntimeExports.jsx(bte,{children:se})]},Qe))})}),t.jsxRuntimeExports.jsx(Ete,{children:wn.signIn.magicLinkSent.secondaryMessage}),t.jsxRuntimeExports.jsx(Rte,{resendCountdown:$e,resendCount:Ae,resendLimitReached:Te,redirectCountdown:Re,onClick:Oe})]})})]}),t.jsxRuntimeExports.jsxs($te,{isMagicLinkSent:ye,windowSize:b,style:{display:b==="small"?"none":"flex"},children:[t.jsxRuntimeExports.jsx(pte,{windowSize:b,children:Ce}),t.jsxRuntimeExports.jsx(bt,{controller:!ye,children:t.jsxRuntimeExports.jsx(mte,{windowSize:b,children:we})}),t.jsxRuntimeExports.jsx(bt,{controller:ye,children:t.jsxRuntimeExports.jsxs(gte,{children:[t.jsxRuntimeExports.jsxs(fte,{isDarkTheme:E,"data-testid":_("magic-link-primary-message","large"),children:[t.jsxRuntimeExports.jsx(jte,{children:t.jsxRuntimeExports.jsx(yte,{})}),t.jsxRuntimeExports.jsx(Cte,{isDarkTheme:E,children:O.getLocalizedStrings().signIn.magicLinkSent.primaryMessage.split("__email__").map((Pe,Qe,Je)=>t.jsxRuntimeExports.jsxs(wte,{children:[Pe,Qe<Je.length-1&&t.jsxRuntimeExports.jsx(bte,{children:se})]},Qe))})]}),t.jsxRuntimeExports.jsx(Ete,{children:wn.signIn.magicLinkSent.secondaryMessage}),t.jsxRuntimeExports.jsx(Rte,{resendCountdown:$e,resendCount:Ae,resendLimitReached:Te,redirectCountdown:Re,onClick:Oe})]})})]}),t.jsxRuntimeExports.jsx(bt,{controller:!ye,children:t.jsxRuntimeExports.jsxs(wM,{windowSize:b,children:[t.jsxRuntimeExports.jsxs(mQt,{showEmailError:ie,showEmailForm:N,children:[!N&&!F&&t.jsxRuntimeExports.jsxs(xQt,{windowSize:b,children:[t.jsxRuntimeExports.jsx(t.GoogleOAuthProvider,{clientId:e,children:t.jsxRuntimeExports.jsx(lte,{disabled:S,inProgress:U,getSignedInUser:m,onSuccess:je,onSignedInCallback:x,onError:ce})}),t.jsxRuntimeExports.jsx(cte,{clientId:n,scopes:["openid","profile","email","offline_access","User.Read"],getSignedInUser:m,prompt:"select_account",responseType:"code",responseMode:"query",render:Pe=>t.jsxRuntimeExports.jsx(uH,{onClick:Pe.onClick,disabled:S||Pe.disabled,type:"Microsoft",titleText:wn.signIn.signInMicrosoftButton,loadingIndication:Y}),onSignedInCallback:x,onSuccess:de,onFailure:ue})]}),!N&&F==="google"&&t.jsxRuntimeExports.jsx(t.GoogleOAuthProvider,{clientId:e,children:t.jsxRuntimeExports.jsx(lte,{disabled:S,inProgress:U,email:se,firstName:Ie,photo:Ne,getSignedInUser:m,onSuccess:je,onSignedInCallback:x,onError:ce})}),!N&&F==="microsoft"&&t.jsxRuntimeExports.jsx(cte,{clientId:n,scopes:["openid","profile","email","offline_access","User.Read"],getSignedInUser:m,prompt:"select_account",responseType:"code",responseMode:"query",render:Pe=>t.jsxRuntimeExports.jsx(uH,{onClick:Pe.onClick,disabled:S||Pe.disabled,type:"Microsoft",titleText:wn.signIn.signInMicrosoftButton,loadingIndication:Y,email:se,firstName:Ie,photo:Ne}),onSignedInCallback:x,onSuccess:de,onFailure:ue}),a&&N&&t.jsxRuntimeExports.jsx(t.FormProvider,{...q,children:t.jsxRuntimeExports.jsxs(cQt,{windowSize:b,children:[t.jsxRuntimeExports.jsx(CQt,{onSubmit:G(ne),children:t.jsxRuntimeExports.jsxs(dQt,{windowSize:b,hasError:re,children:[t.jsxRuntimeExports.jsx(uQt,{windowSize:b,type:"text",placeholder:wn.signIn.workEmailExample,variant:"outlined",fullWidth:!0,isValid:!re,autoComplete:"off",...Z("email",{required:wn.signIn.invalidEmailMessage,pattern:{value:zp,message:wn.signIn.invalidEmailMessage},onChange:me})}),t.jsxRuntimeExports.jsx(bQt,{variant:"primary",type:"submit",label:wn.signIn.signInButton,loading:l.fetchState==="In-Progress"})]})}),ie&&t.jsxRuntimeExports.jsx(pQt,{children:D?wn.signIn.magicLinkExpired:te?wn.common.errorMessage.somethingWentWrongPleaseTryAgain:wn.signIn.invalidEmailMessage})]})}),a&&!F&&t.jsxRuntimeExports.jsxs(oQt,{children:[t.jsxRuntimeExports.jsxs(eQt,{showEmailForm:N,windowSize:b,children:[t.jsxRuntimeExports.jsx(ute,{showEmailForm:N,windowSize:b}),t.jsxRuntimeExports.jsx(tQt,{children:wn.common.texts.or.toUpperCase()}),t.jsxRuntimeExports.jsx(ute,{showEmailForm:N,windowSize:b})]}),t.jsxRuntimeExports.jsxs(iQt,{children:[t.jsxRuntimeExports.jsx(nQt,{onClick:()=>{N?$.trackSignInViaGoogleMicrosoft():$.trackSignInViaEmail(),H(!N)},children:N?wn.signIn.googleOrMicrosoftLink:wn.signIn.workEmailLink}),t.jsxRuntimeExports.jsx(sQt,{isVisible:!N,children:wn.signIn.workEmailSubText})]})]})]}),L===!1&&k&&t.jsxRuntimeExports.jsx(hQt,{children:t.jsxRuntimeExports.jsx(lQt,{children:le()})})]})})]})]}),t.jsxRuntimeExports.jsx(bt,{controller:b!=="small",children:t.jsxRuntimeExports.jsx(jQt,{children:t.jsxRuntimeExports.jsx(n8e,{scale:R})})}),t.jsxRuntimeExports.jsx(xte,{style:{maxWidth:"100%",textAlign:"center",marginBottom:b==="small"?o.sp5:o.sp1},children:t.jsxRuntimeExports.jsxs(xte,{children:[t.jsxRuntimeExports.jsxs(hte,{children:[wn.signIn.termsPrivacyFinePrintPart,wn.signIn.agreeWith,t.jsxRuntimeExports.jsx(Kn,{href:wn.signIn.termsUrl,target:"_Blank",rel:"noopener noreferrer",linkText:wn.signIn.termsOfService})," ",wn.signIn.and," ",t.jsxRuntimeExports.jsx(Kn,{href:wn.signIn.privacyPolicyUrl,target:"_Blank",rel:"noopener noreferrer",linkText:wn.signIn.privacyPolicy}),"."]}),t.jsxRuntimeExports.jsx(hte,{children:t.jsxRuntimeExports.jsx(o8e,{})})]})})]}),L&&t.jsxRuntimeExports.jsx(FVt,{onClose:()=>{h(),P(!1),ge(!1)}})]})}class LQt{constructor(n,i,r,a,l,c){this.width=n,this.height=i,this.marginTop=r,this.marginRight=a,this.marginBottom=l,this.marginLeft=c}width;height;marginTop;marginRight;marginBottom;marginLeft;get widthCss(){return this.width+"px"}get heightCss(){return this.height+"px"}get marginTopCss(){return this.marginTop+"px"}get marginRightCss(){return this.marginRight+"px"}get marginBottomCss(){return this.marginBottom+"px"}get marginLeftCss(){return this.marginLeft+"px"}get totalWidth(){return this.width+this.marginLeft+this.marginRight}set totalWidth(n){this.width=n-this.marginLeft-this.marginRight}get totalHeight(){return this.height+this.marginTop+this.marginBottom}set totalHeight(n){this.height=n-this.marginTop-this.marginBottom}}const pi=s.div`
17987
17987
  display: flex;
17988
17988
  flex: 1 1 auto;
17989
17989
  width: ${e=>e.dimension.widthCss};
@@ -22449,7 +22449,7 @@ to {
22449
22449
  top: 0;
22450
22450
  z-index: 12;
22451
22451
  background: ${e=>e.$background??"transparent"};
22452
- `;function Yro(e,n,i){if(n==null)return i;const r=n(e);return typeof r=="number"&&!Number.isNaN(r)&&r>0?r:i}const qwe=g.createContext(null),qro=g.forwardRef(function(n,i){const{children:r,style:a,...l}=n,c=g.useContext(qwe);return t.jsxRuntimeExports.jsxs(Uro,{ref:i,$minWidthPx:c?.minWidth??null,style:a,...l,children:[t.jsxRuntimeExports.jsx(Gro,{$background:c?.headerBackground,children:c?.headerContent}),r]})});function Zro({index:e,style:n,data:i}){const r={...n,top:n.top||0};if(e===0)return t.jsxRuntimeExports.jsx(Hw,{style:r,"aria-hidden":!0,children:t.jsxRuntimeExports.jsx("div",{style:{height:"100%",width:"100%"}})});const a=e-1;if(!(i.infiniteLoader==null||i.infiniteLoader.isItemLoaded(a)===!0)){const x=i.renderPlaceholderRow?.(a);return x!=null?t.jsxRuntimeExports.jsx(Hw,{style:r,children:x}):t.jsxRuntimeExports.jsx(Hw,{style:r,children:t.jsxRuntimeExports.jsx(Cro,{paneColumns:i.paneColumns,paneMinWidth:i.paneMinWidth,columnGapPx:i.columnGapPx,includeCheckboxRail:i.includeCheckboxRail,rightRailWidth:i.rightRailW,rowMinHeight:i.rowMinHeight,maxWidthByColumnKey:i.maxWidthByColumnKey,columnWidthPxByKey:i.columnWidthPxByKey,lastStickyColumnKey:i.lastStickyColumnKey,placeholderRowRootProps:i.placeholderRowRootProps,stickyLeftOffsets:i.stickyLeftOffsets})})}const c=i.data[a];if(c==null)return t.jsxRuntimeExports.jsx(Hw,{style:r});const d=i.getRowId(c,a),u=i.selectedSet.has(d),m=i.getRowMeta?.(c,a);return t.jsxRuntimeExports.jsx(Qro,{style:r,children:t.jsxRuntimeExports.jsx(Uwe,{row:c,rowIndex:a,cellVerticalAlign:i.cellVerticalAlign,paneColumns:i.paneColumns,paneMinWidth:i.paneMinWidth,primaryColumnKey:i.primaryColumnKey,maxWidthByColumnKey:i.maxWidthByColumnKey,columnWidthPxByKey:i.columnWidthPxByKey,columnGapPx:i.columnGapPx,stickyLeftOffsets:i.stickyLeftOffsets,lastStickyColumnKey:i.lastStickyColumnKey,rowMeta:m,rowId:d,rightRailW:i.rightRailW,rowMinHeight:i.rowMinHeight,selected:u,features:i.features,includeCheckboxRail:i.includeCheckboxRail===!0,includeRightRails:i.includeRightRails===!0,onToggleRow:i.onToggleRow,renderCheckboxRailCell:i.renderCheckboxRailCell,renderRowBorderIcon:i.renderRowBorderIcon,renderRowComment:i.renderRowComment,renderRowMenu:i.renderRowMenu,onRowHeight:i.onRowHeight,layoutVersion:i.layoutVersion})})}function ane(e){const{viewportWidth:n,columnHeight:i,fillParent:r,orderedColumns:a,stickyKeys:l,leftRailW:c,checkboxRail:d,rightRailW:u,primaryColumnKey:m,selectedSet:x,allSelected:h,someSelected:f,virtualItemCount:y,listInstanceRef:C,itemKey:b,handleListScroll:E,bindListRef:$,onToggleAll:R,onToggleRow:S,footerBelowFrameNode:k,hasFooterBelowFrame:T,centerWhenNarrow:A=!0,columnOrder:I,onColumnOrderChange:B,data:L,getRowId:P,maxWidthByColumnKey:D,sortState:M=null,onSortChange:F,onSelectedRowIdsChange:V,features:N,renderCheckboxRailCell:H,renderCheckboxRailHeader:W,renderRowBorderIcon:U,renderRowComment:Y,renderRowCommentHeader:q,renderRowMenu:Z,getRowMeta:G,infiniteLoader:K,estimatedRowHeight:J=52,getEstimatedRowHeight:oe,cellVerticalAlign:ee="start",bodyHeight:te,bodyHeightIncludesHeader:se=!1,disableInternalScroll:ie=!1,onScroll:re,placeholderRowRootProps:ne,showOuterBorder:me=!0,initialScrollOffset:pe,rowLayoutVersion:je=0,rowMinHeight:ce,isResponsiveTable:de=!1,responsiveTableMinWidth:ue,responsiveTableMaxWidth:le,isHorizontalScroll:ae,expandFrameWidthToViewport:ge=!1,columnGapPx:ye=0}=e,he=Mro(N),Ce=g.useMemo(()=>R9e(n,{centerWhenNarrow:A,columnGapPx:ye,expandFrameWidthToViewport:ge,isHorizontalScroll:ae,isResponsiveTable:de,maxWidthByColumnKey:D,orderedColumns:a,railW:he,responsiveTableMaxWidth:le,responsiveTableMinWidth:ue}),[n,A,ye,ge,ae,de,D,a,he,le,ue]),we=g.useMemo(()=>{if(l.size===0)return;const nt=Gwe(a,l,D,Ce.columnWidthPxByKey,ye);if(c===0)return nt;const ut=new Map;for(const[pt,Bt]of nt)ut.set(pt,Bt+c);return ut},[a,l,D,Ce.columnWidthPxByKey,c,ye]),ve=g.useMemo(()=>l.size>0?kro(a,l):void 0,[a,l]),[Ee,Se]=g.useState(null),[$e,Be]=g.useState(0),Ae=g.useCallback(nt=>{$(nt),Se(Vro(nt))},[$]);g.useEffect(()=>{if(!T||Ee==null){Be(0);return}const nt=Ee,ut=()=>Be(nt.scrollLeft);return ut(),nt.addEventListener("scroll",ut,{passive:!0}),()=>nt.removeEventListener("scroll",ut)},[T,Ee]);const[_e,Te]=g.useState(LU),Re=g.useRef(null),ke=g.useRef(null),Oe=g.useCallback(nt=>{if(Re.current=nt,ke.current?.disconnect(),ke.current=null,nt==null)return;const ut=()=>{const Bt=Math.ceil(nt.getBoundingClientRect().height);Bt>0&&Te(Bt)};ut();const pt=new ResizeObserver(ut);pt.observe(nt),ke.current=pt},[]);g.useLayoutEffect(()=>{const nt=Re.current;if(nt==null)return;const ut=Math.ceil(nt.getBoundingClientRect().height);ut>0&&Te(pt=>ut===pt?pt:ut)},[n,Ce,M,I]);const Me=g.useRef({}),Ie=g.useCallback(()=>{C.current?.resetAfterIndex(0,!0)},[C]),Ne=g.useCallback((nt,ut)=>{const pt=Math.max(1,Math.ceil(ut)),Bt=nt+1;Me.current[Bt]={s:pt},C.current?.resetAfterIndex(Bt,!1)},[C]),Pe=g.useCallback(nt=>{if(nt===0)return Math.max(1,_e);const ut=Me.current[nt],pt=Yro(nt-1,oe,J);return Math.max(ut?.s??0,pt)},[J,oe,_e]);g.useEffect(()=>{Me.current={},Ie()},[a,I,D,je,ce,M,de,ue,le,ae,ye,Ie]),g.useLayoutEffect(()=>{C.current?.resetAfterIndex(0,!1)},[C,_e]);const Ue=g.useMemo(()=>({cellVerticalAlign:ee,columnGapPx:ye,columnWidthPxByKey:Ce.columnWidthPxByKey,data:L,headerHeight:0,paneColumns:a,paneMinWidth:Ce.singleTableMinWidth,primaryColumnKey:m,maxWidthByColumnKey:D,stickyLeftOffsets:we,getRowId:P,getRowMeta:G,features:N,selectedSet:x,onToggleRow:d===!0&&V!=null?S:void 0,includeCheckboxRail:d,includeRightRails:N?.rowComment===!0||N?.rowMenu===!0,renderCheckboxRailCell:H,renderRowBorderIcon:U,renderRowComment:Y,renderRowMenu:Z,rightRailW:u,rowMinHeight:ce,onRowHeight:Ne,layoutVersion:je,infiniteLoader:K,estimatedRowHeight:J,getEstimatedRowHeight:oe,lastStickyColumnKey:ve,placeholderRowRootProps:ne,renderPlaceholderRow:K?.renderPlaceholderRow}),[ee,ye,Ce.columnWidthPxByKey,Ce.singleTableMinWidth,L,a,m,D,we,ve,P,G,N,x,S,d,V,H,U,Y,Z,u,ce,Ne,je,K,J,oe,ne]),Je=g.useMemo(()=>t.jsxRuntimeExports.jsx(Qwe,{headerRowRef:Oe,columnGapPx:ye,columnWidthPxByKey:Ce.columnWidthPxByKey,paneColumns:a,paneMinWidth:Ce.singleTableMinWidth,includeCheckboxRail:d,includeRightRails:N?.rowComment===!0||N?.rowMenu===!0,sortState:M,onSortChange:F,features:N,onColumnOrderChange:B,columnOrder:I,allSelected:h,someSelected:f,onToggleAll:d===!0&&V!=null?R:void 0,renderCheckboxRailHeader:W,renderRowCommentHeader:q,lastStickyColumnKey:ve,maxWidthByColumnKey:D,stickyLeftOffsets:we}),[Oe,ye,Ce.columnWidthPxByKey,Ce.singleTableMinWidth,a,d,N,M,F,B,I,h,f,R,V,W,q,D,we,ve]),tt=t.useTheme();g.useEffect(()=>()=>{ke.current?.disconnect()},[]);const Qe=Je,dt=g.useMemo(()=>({headerBackground:tt.colors.grey4,headerContent:Qe,minWidth:Ce.singleTableMinWidth}),[Qe,Ce.singleTableMinWidth,tt.colors.grey4]),ct=(nt,ut)=>{const pt=K??Lro,Bt=$o=>({height:$o,width:nt,itemCount:y,itemSize:Pe,itemData:Ue,overscanCount:Nwe,itemKey:b,initialScrollOffset:pe,innerElementType:qro,onScroll:re!=null?E:void 0,style:ie===!0?Tro:Iro,children:Zro}),Ht=$o=>t.jsxRuntimeExports.jsx(t.InfiniteLoader,{isItemLoaded:Tt=>Tt===0?!0:pt.isItemLoaded(Tt-1),itemCount:y,loadMoreItems:(Tt,Gt)=>{if(Gt<1)return;const so=Tt===0?0:Tt-1,no=Gt-1;return pt.loadMoreItems(so,no)},children:({onItemsRendered:Tt,ref:Gt})=>t.jsxRuntimeExports.jsx(t.VariableSizeList,{...Bt($o),ref:so=>{Gt(so),Ae(so)},onItemsRendered:Tt})});return t.jsxRuntimeExports.jsxs(zro,{children:[t.jsxRuntimeExports.jsx(_ro,{$showBorder:me!==!1,$leftInset:c,$rightInset:u,children:t.jsxRuntimeExports.jsx(Wro,{columnHeightEstimate:ut,children:$o=>Ht($o)})}),T?t.jsxRuntimeExports.jsx(Fro,{children:t.jsxRuntimeExports.jsx(Nro,{$minWidthPx:Ce.singleTableMinWidth,$scrollLeft:$e,children:k})}):null]})},yt=Ce.effectiveW,He=Ce.centered,jt=r?i:te??p[10]*5,We=r?i:jt+(se?0:PU);return t.jsxRuntimeExports.jsx(qwe.Provider,{value:dt,children:t.jsxRuntimeExports.jsx(Oro,{style:{width:yt,height:We,margin:He?"0 auto":void 0,alignSelf:He?"center":void 0},children:ct(yt,jt)})})}function Zwe({columns:e,columnOrder:n,onColumnOrderChange:i,data:r,getRowId:a,stickyColumnKeys:l,maxWidthByColumnKey:c,sortState:d=null,onSortChange:u,selectedRowIds:m,onSelectedRowIdsChange:x,features:h,renderCheckboxRailCell:f,renderCheckboxRailHeader:y,renderRowBorderIcon:C,renderRowComment:b,renderRowCommentHeader:E,renderRowMenu:$,getRowMeta:R,infiniteLoader:S,estimatedRowHeight:k=52,getEstimatedRowHeight:T,cellVerticalAlign:A="start",centerWhenNarrow:I=!0,bodyHeightIncludesHeader:B=!1,disableInternalScroll:L=!1,expandFrameWidthToViewport:P=!1,bodyHeight:D,fillParent:M=!0,className:F,"data-testid":V,rowLayoutVersion:N=0,rowMinHeight:H=BU,onScroll:W,showOuterBorder:U=!0,initialScrollOffset:Y,onVirtualListRef:q,placeholderRowRootProps:Z,renderFooterBelowFrame:G,isResponsiveTable:K=!1,responsiveTableMinWidth:J,responsiveTableMaxWidth:oe,isHorizontalScroll:ee,columnGapPx:te=0}){const se=g.useRef(null),ie=G?.()??null,re=G!=null&&ie!=null,ne=g.useCallback(_e=>{se.current=_e,q?.(_e)},[q]),me=g.useMemo(()=>{const _e=new Map;for(const Te of e)_e.set(Te.key,Te);return _e},[e]),pe=g.useMemo(()=>{const _e=[];for(const Te of n){const Re=me.get(Te);Re!=null&&Re.visible!==!1&&_e.push(Re)}return _e},[n,me]),je=g.useMemo(()=>Ywe(pe,l),[pe,l]),ce=h?.checkboxRail===!0,de=g.useMemo(()=>Aro(h),[h]),ue=ce===!0?i8:0,le=pe[0]?.key,ae=g.useMemo(()=>m==null?new Set:m instanceof Set?m:new Set(m),[m]),ge=g.useCallback(_e=>{if(x==null)return;const Te=new Set(ae);Te.has(_e)?Te.delete(_e):Te.add(_e),x(Te)},[x,ae]),ye=g.useCallback(()=>{if(x==null)return;const _e=[];for(let Re=0;Re<r.length;Re++){const ke=r[Re];ke!=null&&_e.push(a(ke,Re))}if(_e.length===0)return;const Te=_e.every(Re=>ae.has(Re));x(Te?new Set:new Set(_e))},[r,a,x,ae]),{allSelected:he,someSelected:Ce}=g.useMemo(()=>{let _e=!0,Te=!1,Re=!1;for(let ke=0;ke<r.length;ke++){const Oe=r[ke];if(Oe!=null&&(Re=!0,ae.has(a(Oe,ke))?Te=!0:_e=!1,Te&&!_e))break}return Re?{allSelected:_e,someSelected:Te}:{allSelected:!1,someSelected:!1}},[r,ae,a]),we=S!=null?S.itemCount:r.length,ve=we+1,Ee=B?0:PU,Se=M===!0?"100%":D!=null?D+Ee:`${iro}px`,$e=g.useCallback(_e=>{if(_e===0)return"__datalist_header_spacer__";const Te=_e-1,Re=r[Te];return Re==null?`placeholder-${Te}`:`${a(Re,Te)}-${Te}`},[r,a]),Be=g.useCallback(_e=>{W?.(_e.scrollOffset)},[W]),Ae={allSelected:he,bindListRef:ne,bodyHeightIncludesHeader:B,checkboxRail:ce,columnOrder:n,columns:e,data:r,disableInternalScroll:L,estimatedRowHeight:k,fillParent:M,features:h,footerBelowFrameNode:ie,getEstimatedRowHeight:T,getRowId:a,getRowMeta:R,handleListScroll:Be,hasFooterBelowFrame:re,infiniteLoader:S,initialScrollOffset:Y,isHorizontalScroll:ee,isResponsiveTable:K,virtualItemCount:ve,listInstanceRef:se,itemKey:$e,leftRailW:ue,maxWidthByColumnKey:c,onColumnOrderChange:i,onScroll:W,onSortChange:u,onSelectedRowIdsChange:x,placeholderRowRootProps:Z,onToggleAll:ye,onToggleRow:ge,orderedColumns:pe,primaryColumnKey:le,renderCheckboxRailCell:f,renderCheckboxRailHeader:y,renderRowBorderIcon:C,renderRowComment:b,renderRowCommentHeader:E,renderRowMenu:$,responsiveTableMaxWidth:oe,responsiveTableMinWidth:J,rightRailW:de,rowLayoutVersion:N,rowMinHeight:H,selectedRowIds:m,selectedSet:ae,someSelected:Ce,sortState:d,stickyColumnKeys:l,stickyKeys:je,cellVerticalAlign:A,centerWhenNarrow:I,columnGapPx:te,expandFrameWidthToViewport:P,bodyHeight:D,showOuterBorder:U};return t.jsxRuntimeExports.jsx(Dro,{className:F,$rootHeight:Se,"data-testid":V,role:"grid","aria-rowcount":we+1,"aria-colcount":pe.length,children:M===!0?t.jsxRuntimeExports.jsx(t.AutoSizer,{style:Bro,children:({height:_e,width:Te})=>_e<=0||Te<=0?null:t.jsxRuntimeExports.jsx(ane,{...Ae,viewportWidth:Te,columnHeight:_e})}):t.jsxRuntimeExports.jsx(t.AutoSizer,{disableHeight:!0,style:Pro,children:({width:_e})=>t.jsxRuntimeExports.jsx(ane,{...Ae,viewportWidth:_e||0,columnHeight:D??p[10]*5})})})}function Kwe(e,n){return{...e,...n}}function Kro(e){return e.map(({header:n,renderCell:i,renderHeader:r,...a})=>({...a,header:n,renderCell:i,renderHeader:r}))}function WM(e){return e==null?null:e._outerRef??null}const lne=3,Jwe=g.forwardRef(function({columns:n,columnOrder:i,componentName:r,data:a,getRowId:l,layoutDefaults:c,currentScrollYOffset:d,"data-testid":u,fillParent:m,infiniteLoader:x,isFirstLotLoading:h=!1,isLoadingNextPeriod:f=!1,isLoadingPreviousPeriod:y=!1,onListInnerElementHeightChanged:C,onScroll:b,quickViewColumnOrder:E,quickViewColumns:$,renderFooterBelowFrame:R,scrollMode:S,scrollToBottomOnLoad:k=!1,selectedRowIds:T,sortState:A,trackPerformance:I=!0,onSortChange:B},L){const P=S==="content-height",D=P?!1:m,M=mr(),[F,V]=g.useState(!1);g.useEffect(()=>{!F&&h===!1&&V(!0)},[h,F]),qs({componentName:r,enabled:I&&F});const N=g.useMemo(()=>M===!0&&$!=null?$:n,[n,$,M]),H=g.useMemo(()=>M===!0&&E!=null?[...E]:[...i],[i,E,M]),W=g.useRef(null),U=g.useRef(void 0),Y=g.useRef(null),[q,Z]=g.useState(void 0),G=g.useCallback(ce=>{if(Y.current?.disconnect(),Y.current=null,C==null&&!P||ce==null)return;const ue=WM(ce)?.firstElementChild;if(ue==null)return;const le=new ResizeObserver(ae=>{for(const ge of ae){const ye=ge.contentRect.height,he=parseFloat(getComputedStyle(ge.target).paddingTop)||0,Ce=ye+he;Ce>0&&Ce!==U.current&&(U.current=Ce,C?.(Ce),P&&Z(we=>we==null||Math.abs(Ce-we)>2?Ce:we))}});le.observe(ue),Y.current=le},[C,P]);g.useEffect(()=>()=>{Y.current?.disconnect()},[]);const K=g.useCallback(ce=>{W.current=ce;const de=WM(ce);typeof L=="function"?L(de):L!=null&&(L.current=de),G(ce)},[L,G]),J=g.useMemo(()=>y?[null,...a]:a,[y,a]),oe=g.useMemo(()=>{if(x!=null)return x;if(h&&a.length===0)return{itemCount:lne,isItemLoaded:()=>!1,loadMoreItems:async()=>{}};if(!y&&!f)return;const ce=J.length;return{itemCount:ce+(f?1:0),isItemLoaded:ue=>!(y&&ue===0||f&&ue>=ce),loadMoreItems:async()=>{}}},[x,h,y,f,a.length,J.length]),ee=g.useRef(!1);g.useEffect(()=>{const ce=ee.current;if(ee.current=f,!k||!f||ce||a.length===0)return;const de=requestAnimationFrame(()=>{const ue=WM(W.current);ue!=null&&(ue.scrollTop=ue.scrollHeight)});return()=>cancelAnimationFrame(de)},[k,f,a.length]);const te=J.length+(f?1:0)+(h&&a.length===0?lne:0),se=oe?.itemCount??a.length,ie=c.estimatedRowHeight??p[7],re=se*ie+PU,ne=se*(ie+1)+(P?LU:0),me=D===!1?P&&q!=null?q:ne:void 0,pe=g.useMemo(()=>Kwe(c,{columnOrder:H,columns:N,data:J,getRowId:l,selectedRowIds:T,initialScrollOffset:d??0,onScroll:b!=null?ce=>b(ce):void 0,onVirtualListRef:K,infiniteLoader:oe,rowLayoutVersion:te,renderFooterBelowFrame:R,"data-testid":u,sortState:A,onSortChange:B,...M===!0?{responsiveTableMinWidth:void 0}:{},...D!=null?{fillParent:D}:{}}),[c,N,H,J,l,T,d,b,K,oe,te,R,u,A,B,M,D]),je=D===!1?me:void 0;return t.jsxRuntimeExports.jsx(Jro,{style:D!==!1&&!P?{maxHeight:re}:P?{overflow:"visible",flexShrink:0}:void 0,children:t.jsxRuntimeExports.jsx(Zwe,{...pe,bodyHeight:je,bodyHeightIncludesHeader:P,disableInternalScroll:P})})}),Jro=s.div`
22452
+ `;function Yro(e,n,i){if(n==null)return i;const r=n(e);return typeof r=="number"&&!Number.isNaN(r)&&r>0?r:i}const qwe=g.createContext(null),qro=g.forwardRef(function(n,i){const{children:r,style:a,...l}=n,c=g.useContext(qwe);return t.jsxRuntimeExports.jsxs(Uro,{ref:i,$minWidthPx:c?.minWidth??null,style:a,...l,children:[t.jsxRuntimeExports.jsx(Gro,{$background:c?.headerBackground,children:c?.headerContent}),r]})});function Zro({index:e,style:n,data:i}){const r={...n,top:n.top||0};if(e===0)return t.jsxRuntimeExports.jsx(Hw,{style:r,"aria-hidden":!0,children:t.jsxRuntimeExports.jsx("div",{style:{height:"100%",width:"100%"}})});const a=e-1;if(!(i.infiniteLoader==null||i.infiniteLoader.isItemLoaded(a)===!0)){const x=i.renderPlaceholderRow?.(a);return x!=null?t.jsxRuntimeExports.jsx(Hw,{style:r,children:x}):t.jsxRuntimeExports.jsx(Hw,{style:r,children:t.jsxRuntimeExports.jsx(Cro,{paneColumns:i.paneColumns,paneMinWidth:i.paneMinWidth,columnGapPx:i.columnGapPx,includeCheckboxRail:i.includeCheckboxRail,rightRailWidth:i.rightRailW,rowMinHeight:i.rowMinHeight,maxWidthByColumnKey:i.maxWidthByColumnKey,columnWidthPxByKey:i.columnWidthPxByKey,lastStickyColumnKey:i.lastStickyColumnKey,placeholderRowRootProps:i.placeholderRowRootProps,stickyLeftOffsets:i.stickyLeftOffsets})})}const c=i.data[a];if(c==null)return t.jsxRuntimeExports.jsx(Hw,{style:r});const d=i.getRowId(c,a),u=i.selectedSet.has(d),m=i.getRowMeta?.(c,a);return t.jsxRuntimeExports.jsx(Qro,{style:r,children:t.jsxRuntimeExports.jsx(Uwe,{row:c,rowIndex:a,cellVerticalAlign:i.cellVerticalAlign,paneColumns:i.paneColumns,paneMinWidth:i.paneMinWidth,primaryColumnKey:i.primaryColumnKey,maxWidthByColumnKey:i.maxWidthByColumnKey,columnWidthPxByKey:i.columnWidthPxByKey,columnGapPx:i.columnGapPx,stickyLeftOffsets:i.stickyLeftOffsets,lastStickyColumnKey:i.lastStickyColumnKey,rowMeta:m,rowId:d,rightRailW:i.rightRailW,rowMinHeight:i.rowMinHeight,selected:u,features:i.features,includeCheckboxRail:i.includeCheckboxRail===!0,includeRightRails:i.includeRightRails===!0,onToggleRow:i.onToggleRow,renderCheckboxRailCell:i.renderCheckboxRailCell,renderRowBorderIcon:i.renderRowBorderIcon,renderRowComment:i.renderRowComment,renderRowMenu:i.renderRowMenu,onRowHeight:i.onRowHeight,layoutVersion:i.layoutVersion})})}function ane(e){const{viewportWidth:n,columnHeight:i,fillParent:r,orderedColumns:a,stickyKeys:l,leftRailW:c,checkboxRail:d,rightRailW:u,primaryColumnKey:m,selectedSet:x,allSelected:h,someSelected:f,virtualItemCount:y,listInstanceRef:C,itemKey:b,handleListScroll:E,bindListRef:$,onToggleAll:R,onToggleRow:S,footerBelowFrameNode:k,hasFooterBelowFrame:T,centerWhenNarrow:A=!0,columnOrder:I,onColumnOrderChange:B,data:L,getRowId:P,maxWidthByColumnKey:D,sortState:M=null,onSortChange:F,onSelectedRowIdsChange:V,features:N,renderCheckboxRailCell:H,renderCheckboxRailHeader:W,renderRowBorderIcon:U,renderRowComment:Y,renderRowCommentHeader:q,renderRowMenu:Z,getRowMeta:G,infiniteLoader:K,estimatedRowHeight:J=52,getEstimatedRowHeight:oe,cellVerticalAlign:ee="start",bodyHeight:te,bodyHeightIncludesHeader:se=!1,disableInternalScroll:ie=!1,onScroll:re,placeholderRowRootProps:ne,showOuterBorder:me=!0,initialScrollOffset:pe,rowLayoutVersion:je=0,rowMinHeight:ce,isResponsiveTable:de=!1,responsiveTableMinWidth:ue,responsiveTableMaxWidth:le,isHorizontalScroll:ae,expandFrameWidthToViewport:ge=!1,columnGapPx:ye=0}=e,he=Mro(N),Ce=g.useMemo(()=>R9e(n,{centerWhenNarrow:A,columnGapPx:ye,expandFrameWidthToViewport:ge,isHorizontalScroll:ae,isResponsiveTable:de,maxWidthByColumnKey:D,orderedColumns:a,railW:he,responsiveTableMaxWidth:le,responsiveTableMinWidth:ue}),[n,A,ye,ge,ae,de,D,a,he,le,ue]),we=g.useMemo(()=>{if(l.size===0)return;const nt=Gwe(a,l,D,Ce.columnWidthPxByKey,ye);if(c===0)return nt;const ut=new Map;for(const[pt,Bt]of nt)ut.set(pt,Bt+c);return ut},[a,l,D,Ce.columnWidthPxByKey,c,ye]),ve=g.useMemo(()=>l.size>0?kro(a,l):void 0,[a,l]),[Ee,Se]=g.useState(null),[$e,Be]=g.useState(0),Ae=g.useCallback(nt=>{$(nt),Se(Vro(nt))},[$]);g.useEffect(()=>{if(!T||Ee==null){Be(0);return}const nt=Ee,ut=()=>Be(nt.scrollLeft);return ut(),nt.addEventListener("scroll",ut,{passive:!0}),()=>nt.removeEventListener("scroll",ut)},[T,Ee]);const[_e,Te]=g.useState(LU),Re=g.useRef(null),ke=g.useRef(null),Oe=g.useCallback(nt=>{if(Re.current=nt,ke.current?.disconnect(),ke.current=null,nt==null)return;const ut=()=>{const Bt=Math.ceil(nt.getBoundingClientRect().height);Bt>0&&Te(Bt)};ut();const pt=new ResizeObserver(ut);pt.observe(nt),ke.current=pt},[]);g.useLayoutEffect(()=>{const nt=Re.current;if(nt==null)return;const ut=Math.ceil(nt.getBoundingClientRect().height);ut>0&&Te(pt=>ut===pt?pt:ut)},[n,Ce,M,I]);const Me=g.useRef({}),Ie=g.useCallback(()=>{C.current?.resetAfterIndex(0,!0)},[C]),Ne=g.useCallback((nt,ut)=>{const pt=Math.max(1,Math.ceil(ut)),Bt=nt+1;Me.current[Bt]={s:pt},C.current?.resetAfterIndex(Bt,!1)},[C]),Pe=g.useCallback(nt=>{if(nt===0)return Math.max(1,_e);const ut=Me.current[nt],pt=Yro(nt-1,oe,J);return Math.max(ut?.s??0,pt)},[J,oe,_e]);g.useEffect(()=>{Me.current={},Ie()},[a,I,D,je,ce,M,de,ue,le,ae,ye,Ie]),g.useLayoutEffect(()=>{C.current?.resetAfterIndex(0,!1)},[C,_e]);const Qe=g.useMemo(()=>({cellVerticalAlign:ee,columnGapPx:ye,columnWidthPxByKey:Ce.columnWidthPxByKey,data:L,headerHeight:0,paneColumns:a,paneMinWidth:Ce.singleTableMinWidth,primaryColumnKey:m,maxWidthByColumnKey:D,stickyLeftOffsets:we,getRowId:P,getRowMeta:G,features:N,selectedSet:x,onToggleRow:d===!0&&V!=null?S:void 0,includeCheckboxRail:d,includeRightRails:N?.rowComment===!0||N?.rowMenu===!0,renderCheckboxRailCell:H,renderRowBorderIcon:U,renderRowComment:Y,renderRowMenu:Z,rightRailW:u,rowMinHeight:ce,onRowHeight:Ne,layoutVersion:je,infiniteLoader:K,estimatedRowHeight:J,getEstimatedRowHeight:oe,lastStickyColumnKey:ve,placeholderRowRootProps:ne,renderPlaceholderRow:K?.renderPlaceholderRow}),[ee,ye,Ce.columnWidthPxByKey,Ce.singleTableMinWidth,L,a,m,D,we,ve,P,G,N,x,S,d,V,H,U,Y,Z,u,ce,Ne,je,K,J,oe,ne]),Je=g.useMemo(()=>t.jsxRuntimeExports.jsx(Qwe,{headerRowRef:Oe,columnGapPx:ye,columnWidthPxByKey:Ce.columnWidthPxByKey,paneColumns:a,paneMinWidth:Ce.singleTableMinWidth,includeCheckboxRail:d,includeRightRails:N?.rowComment===!0||N?.rowMenu===!0,sortState:M,onSortChange:F,features:N,onColumnOrderChange:B,columnOrder:I,allSelected:h,someSelected:f,onToggleAll:d===!0&&V!=null?R:void 0,renderCheckboxRailHeader:W,renderRowCommentHeader:q,lastStickyColumnKey:ve,maxWidthByColumnKey:D,stickyLeftOffsets:we}),[Oe,ye,Ce.columnWidthPxByKey,Ce.singleTableMinWidth,a,d,N,M,F,B,I,h,f,R,V,W,q,D,we,ve]),tt=t.useTheme();g.useEffect(()=>()=>{ke.current?.disconnect()},[]);const Ue=Je,dt=g.useMemo(()=>({headerBackground:tt.colors.grey4,headerContent:Ue,minWidth:Ce.singleTableMinWidth}),[Ue,Ce.singleTableMinWidth,tt.colors.grey4]),ct=(nt,ut)=>{const pt=K??Lro,Bt=$o=>({height:$o,width:nt,itemCount:y,itemSize:Pe,itemData:Qe,overscanCount:Nwe,itemKey:b,initialScrollOffset:pe,innerElementType:qro,onScroll:re!=null?E:void 0,style:ie===!0?Tro:Iro,children:Zro}),Ht=$o=>t.jsxRuntimeExports.jsx(t.InfiniteLoader,{isItemLoaded:Tt=>Tt===0?!0:pt.isItemLoaded(Tt-1),itemCount:y,loadMoreItems:(Tt,Gt)=>{if(Gt<1)return;const so=Tt===0?0:Tt-1,no=Gt-1;return pt.loadMoreItems(so,no)},children:({onItemsRendered:Tt,ref:Gt})=>t.jsxRuntimeExports.jsx(t.VariableSizeList,{...Bt($o),ref:so=>{Gt(so),Ae(so)},onItemsRendered:Tt})});return t.jsxRuntimeExports.jsxs(zro,{children:[t.jsxRuntimeExports.jsx(_ro,{$showBorder:me!==!1,$leftInset:c,$rightInset:u,children:t.jsxRuntimeExports.jsx(Wro,{columnHeightEstimate:ut,children:$o=>Ht($o)})}),T?t.jsxRuntimeExports.jsx(Fro,{children:t.jsxRuntimeExports.jsx(Nro,{$minWidthPx:Ce.singleTableMinWidth,$scrollLeft:$e,children:k})}):null]})},yt=Ce.effectiveW,He=Ce.centered,jt=r?i:te??p[10]*5,We=r?i:jt+(se?0:PU);return t.jsxRuntimeExports.jsx(qwe.Provider,{value:dt,children:t.jsxRuntimeExports.jsx(Oro,{style:{width:yt,height:We,margin:He?"0 auto":void 0,alignSelf:He?"center":void 0},children:ct(yt,jt)})})}function Zwe({columns:e,columnOrder:n,onColumnOrderChange:i,data:r,getRowId:a,stickyColumnKeys:l,maxWidthByColumnKey:c,sortState:d=null,onSortChange:u,selectedRowIds:m,onSelectedRowIdsChange:x,features:h,renderCheckboxRailCell:f,renderCheckboxRailHeader:y,renderRowBorderIcon:C,renderRowComment:b,renderRowCommentHeader:E,renderRowMenu:$,getRowMeta:R,infiniteLoader:S,estimatedRowHeight:k=52,getEstimatedRowHeight:T,cellVerticalAlign:A="start",centerWhenNarrow:I=!0,bodyHeightIncludesHeader:B=!1,disableInternalScroll:L=!1,expandFrameWidthToViewport:P=!1,bodyHeight:D,fillParent:M=!0,className:F,"data-testid":V,rowLayoutVersion:N=0,rowMinHeight:H=BU,onScroll:W,showOuterBorder:U=!0,initialScrollOffset:Y,onVirtualListRef:q,placeholderRowRootProps:Z,renderFooterBelowFrame:G,isResponsiveTable:K=!1,responsiveTableMinWidth:J,responsiveTableMaxWidth:oe,isHorizontalScroll:ee,columnGapPx:te=0}){const se=g.useRef(null),ie=G?.()??null,re=G!=null&&ie!=null,ne=g.useCallback(_e=>{se.current=_e,q?.(_e)},[q]),me=g.useMemo(()=>{const _e=new Map;for(const Te of e)_e.set(Te.key,Te);return _e},[e]),pe=g.useMemo(()=>{const _e=[];for(const Te of n){const Re=me.get(Te);Re!=null&&Re.visible!==!1&&_e.push(Re)}return _e},[n,me]),je=g.useMemo(()=>Ywe(pe,l),[pe,l]),ce=h?.checkboxRail===!0,de=g.useMemo(()=>Aro(h),[h]),ue=ce===!0?i8:0,le=pe[0]?.key,ae=g.useMemo(()=>m==null?new Set:m instanceof Set?m:new Set(m),[m]),ge=g.useCallback(_e=>{if(x==null)return;const Te=new Set(ae);Te.has(_e)?Te.delete(_e):Te.add(_e),x(Te)},[x,ae]),ye=g.useCallback(()=>{if(x==null)return;const _e=[];for(let Re=0;Re<r.length;Re++){const ke=r[Re];ke!=null&&_e.push(a(ke,Re))}if(_e.length===0)return;const Te=_e.every(Re=>ae.has(Re));x(Te?new Set:new Set(_e))},[r,a,x,ae]),{allSelected:he,someSelected:Ce}=g.useMemo(()=>{let _e=!0,Te=!1,Re=!1;for(let ke=0;ke<r.length;ke++){const Oe=r[ke];if(Oe!=null&&(Re=!0,ae.has(a(Oe,ke))?Te=!0:_e=!1,Te&&!_e))break}return Re?{allSelected:_e,someSelected:Te}:{allSelected:!1,someSelected:!1}},[r,ae,a]),we=S!=null?S.itemCount:r.length,ve=we+1,Ee=B?0:PU,Se=M===!0?"100%":D!=null?D+Ee:`${iro}px`,$e=g.useCallback(_e=>{if(_e===0)return"__datalist_header_spacer__";const Te=_e-1,Re=r[Te];return Re==null?`placeholder-${Te}`:`${a(Re,Te)}-${Te}`},[r,a]),Be=g.useCallback(_e=>{W?.(_e.scrollOffset)},[W]),Ae={allSelected:he,bindListRef:ne,bodyHeightIncludesHeader:B,checkboxRail:ce,columnOrder:n,columns:e,data:r,disableInternalScroll:L,estimatedRowHeight:k,fillParent:M,features:h,footerBelowFrameNode:ie,getEstimatedRowHeight:T,getRowId:a,getRowMeta:R,handleListScroll:Be,hasFooterBelowFrame:re,infiniteLoader:S,initialScrollOffset:Y,isHorizontalScroll:ee,isResponsiveTable:K,virtualItemCount:ve,listInstanceRef:se,itemKey:$e,leftRailW:ue,maxWidthByColumnKey:c,onColumnOrderChange:i,onScroll:W,onSortChange:u,onSelectedRowIdsChange:x,placeholderRowRootProps:Z,onToggleAll:ye,onToggleRow:ge,orderedColumns:pe,primaryColumnKey:le,renderCheckboxRailCell:f,renderCheckboxRailHeader:y,renderRowBorderIcon:C,renderRowComment:b,renderRowCommentHeader:E,renderRowMenu:$,responsiveTableMaxWidth:oe,responsiveTableMinWidth:J,rightRailW:de,rowLayoutVersion:N,rowMinHeight:H,selectedRowIds:m,selectedSet:ae,someSelected:Ce,sortState:d,stickyColumnKeys:l,stickyKeys:je,cellVerticalAlign:A,centerWhenNarrow:I,columnGapPx:te,expandFrameWidthToViewport:P,bodyHeight:D,showOuterBorder:U};return t.jsxRuntimeExports.jsx(Dro,{className:F,$rootHeight:Se,"data-testid":V,role:"grid","aria-rowcount":we+1,"aria-colcount":pe.length,children:M===!0?t.jsxRuntimeExports.jsx(t.AutoSizer,{style:Bro,children:({height:_e,width:Te})=>_e<=0||Te<=0?null:t.jsxRuntimeExports.jsx(ane,{...Ae,viewportWidth:Te,columnHeight:_e})}):t.jsxRuntimeExports.jsx(t.AutoSizer,{disableHeight:!0,style:Pro,children:({width:_e})=>t.jsxRuntimeExports.jsx(ane,{...Ae,viewportWidth:_e||0,columnHeight:D??p[10]*5})})})}function Kwe(e,n){return{...e,...n}}function Kro(e){return e.map(({header:n,renderCell:i,renderHeader:r,...a})=>({...a,header:n,renderCell:i,renderHeader:r}))}function WM(e){return e==null?null:e._outerRef??null}const lne=3,Jwe=g.forwardRef(function({columns:n,columnOrder:i,componentName:r,data:a,getRowId:l,layoutDefaults:c,currentScrollYOffset:d,"data-testid":u,fillParent:m,infiniteLoader:x,isFirstLotLoading:h=!1,isLoadingNextPeriod:f=!1,isLoadingPreviousPeriod:y=!1,onListInnerElementHeightChanged:C,onScroll:b,quickViewColumnOrder:E,quickViewColumns:$,renderFooterBelowFrame:R,scrollMode:S,scrollToBottomOnLoad:k=!1,selectedRowIds:T,sortState:A,trackPerformance:I=!0,onSortChange:B},L){const P=S==="content-height",D=P?!1:m,M=mr(),[F,V]=g.useState(!1);g.useEffect(()=>{!F&&h===!1&&V(!0)},[h,F]),qs({componentName:r,enabled:I&&F});const N=g.useMemo(()=>M===!0&&$!=null?$:n,[n,$,M]),H=g.useMemo(()=>M===!0&&E!=null?[...E]:[...i],[i,E,M]),W=g.useRef(null),U=g.useRef(void 0),Y=g.useRef(null),[q,Z]=g.useState(void 0),G=g.useCallback(ce=>{if(Y.current?.disconnect(),Y.current=null,C==null&&!P||ce==null)return;const ue=WM(ce)?.firstElementChild;if(ue==null)return;const le=new ResizeObserver(ae=>{for(const ge of ae){const ye=ge.contentRect.height,he=parseFloat(getComputedStyle(ge.target).paddingTop)||0,Ce=ye+he;Ce>0&&Ce!==U.current&&(U.current=Ce,C?.(Ce),P&&Z(we=>we==null||Math.abs(Ce-we)>2?Ce:we))}});le.observe(ue),Y.current=le},[C,P]);g.useEffect(()=>()=>{Y.current?.disconnect()},[]);const K=g.useCallback(ce=>{W.current=ce;const de=WM(ce);typeof L=="function"?L(de):L!=null&&(L.current=de),G(ce)},[L,G]),J=g.useMemo(()=>y?[null,...a]:a,[y,a]),oe=g.useMemo(()=>{if(x!=null)return x;if(h&&a.length===0)return{itemCount:lne,isItemLoaded:()=>!1,loadMoreItems:async()=>{}};if(!y&&!f)return;const ce=J.length;return{itemCount:ce+(f?1:0),isItemLoaded:ue=>!(y&&ue===0||f&&ue>=ce),loadMoreItems:async()=>{}}},[x,h,y,f,a.length,J.length]),ee=g.useRef(!1);g.useEffect(()=>{const ce=ee.current;if(ee.current=f,!k||!f||ce||a.length===0)return;const de=requestAnimationFrame(()=>{const ue=WM(W.current);ue!=null&&(ue.scrollTop=ue.scrollHeight)});return()=>cancelAnimationFrame(de)},[k,f,a.length]);const te=J.length+(f?1:0)+(h&&a.length===0?lne:0),se=oe?.itemCount??a.length,ie=c.estimatedRowHeight??p[7],re=se*ie+PU,ne=se*(ie+1)+(P?LU:0),me=D===!1?P&&q!=null?q:ne:void 0,pe=g.useMemo(()=>Kwe(c,{columnOrder:H,columns:N,data:J,getRowId:l,selectedRowIds:T,initialScrollOffset:d??0,onScroll:b!=null?ce=>b(ce):void 0,onVirtualListRef:K,infiniteLoader:oe,rowLayoutVersion:te,renderFooterBelowFrame:R,"data-testid":u,sortState:A,onSortChange:B,...M===!0?{responsiveTableMinWidth:void 0}:{},...D!=null?{fillParent:D}:{}}),[c,N,H,J,l,T,d,b,K,oe,te,R,u,A,B,M,D]),je=D===!1?me:void 0;return t.jsxRuntimeExports.jsx(Jro,{style:D!==!1&&!P?{maxHeight:re}:P?{overflow:"visible",flexShrink:0}:void 0,children:t.jsxRuntimeExports.jsx(Zwe,{...pe,bodyHeight:je,bodyHeightIncludesHeader:P,disableInternalScroll:P})})}),Jro=s.div`
22453
22453
  display: flex;
22454
22454
  flex-direction: column;
22455
22455
  min-height: ${o.sp0};
@@ -24337,7 +24337,7 @@ to {
24337
24337
  align-items: center;
24338
24338
  justify-content: flex-start;
24339
24339
  gap: ${o.sp3};
24340
- `,{dateFormat:ixo,expenseAutomation:{accountRecon:{reconciliation:Us}},common:{strings:{hyphen:Di,percentage:kEe},texts:{excluded:Pne}}}=O.getLocalizedStrings(),XM=Us.tooltips.excludeAccount;function rxo({height:e,accountRecon:n,isLastRow:i,shouldShowBottomRadius:r,isSelectedRow:a,index:l,tableType:c="normal",isExcludeInProgress:d,isIncludeInProgress:u,onReviewClicked:m,onOpenDrawerClicked:x,onConnectClicked:h,onReconnectClicked:f,onStatementAddClicked:y,onExcludeClicked:C,onIgnoreDetectionClicked:b}){const E=X(),$=t.useTheme(),R=n.accountReconEntity.account.accountId,S=l8(),k=Ki(),T=S!=null,A=ht(),I=g.useMemo(()=>({application:"dashboard",companyId:A.currentTenant?.companyId,tab:"expense_automation",entityType:"expense_automation.reconciliation.account",entityId:R,isGlobalComment:!1}),[A.currentTenant?.companyId,R]),{threads:B,isLoading:L}=sa(I,!1,!0),P=g.useMemo(()=>({application:"dashboard",companyId:A.currentTenant?.companyId,tab:"expense_automation",entityType:"expense_automation.transaction.row",groupId:R,isGlobalComment:!1}),[A.currentTenant?.companyId,R]),{threads:D,isLoading:M}=sa(P,!1,!0),F=B.length+D.length,V=L||M,{addThread:N,setOpenThread:H,openThread:W,threads:U,requestToOpenThread:Y,setRequestToOpenThread:q}=g.useContext(vs),Z=A.currentTenant?.companyId??"",G=A.currentTenant?.companyName??"",K=`dashboard_${Z}`,J=`expense_automation.reconciliation.account.${R}.${$s}`,oe=B.length>0?B[0].id:null,ee=W===J,te=oe!=null&&W===oe,se=W!=null?U.get(W)?.metadata??null:null,[ie,re]=g.useState(!1),ne=()=>re(!0),me=()=>re(!1);g.useEffect(()=>{if(Y?.threadId==null)return;B.some(nt=>nt.id===Y.threadId)&&L===!1&&(H(Y.threadId),q(null))},[Y,B,L,H,q]);const pe=We=>{We.stopPropagation();const nt={application:"dashboard",companyId:Z,companyName:G,entityId:R,entityType:"expense_automation.reconciliation.account",isGlobalComment:!1,tab:"expense_automation",url:window.location.href};N(J,{id:J,type:"thread",roomId:K,createdAt:new Date,comments:[],metadata:nt,resolved:!1,updatedAt:new Date}),H(J)},je=We=>{if(We.stopPropagation(),D.length===0&&oe!=null){H(oe);return}k?.sharedFunctions?.subtreeFunctions.openAllThreadsDrawer?.({roomId:K,companyId:Z,companyName:G,entityId:R,entityType:"expense_automation.reconciliation.account",groupId:R})},ce=n.accountReconEntity.account.accountName,de=n.accountDetectionReason,ue=de!=null,[le,ae]=g.useState(!1),ge=n.accountReconEntity.balance,ye=n.accountReconEntity.clearedBalance,he=n.accountReconEntity.variance,Ce=n.accountReconEntity.variancePercentage,we=()=>{h?.(n.accountReconEntity.account.accountId)},ve=()=>{f?.(n.accountReconEntity.account.accountId)},Ee=()=>{y?.(n.accountReconEntity.account.accountId)},Se=()=>{ae(!1),C?.(n.accountReconEntity.account.accountId)},$e=()=>{ae(!1),b?.(n.accountReconEntity.account.accountId)},Be=()=>{m?.(n.accountReconEntity.account.accountId)},[Ae,_e]=g.useState(!1),Te=n.accountConnectionStatus==="connected"||n.connectionInProgress===!0?"plaid":n.accountReconEntity.statementStatus?.code==="uploaded"||n.statementParseInProgress===!0?"bank_statement":"plaid",Re=Te==="plaid"?n.accountReconEntity.balanceDataStatus?.code==="in_progress"||n.connectionInProgress===!0:n.accountReconEntity.statementDataStatus?.code==="parsing"||n.statementParseInProgress===!0,ke=n.accountConnectionStatus==="connected"||n.accountConnectionStatus==="reconnect"||n.connectionInProgress===!0?"bank":n.accountReconEntity.statementStatus?.code==="uploaded"||n.statementParseInProgress===!0?"statement":"none",Oe=c!=="excluded"&&ke==="none",{openingBalance:Me,matchProgress:Ie,lastReconciled:Ne,reconciliationStatus:Pe,reconUpdatedAt:Ue,endDate:Je}=n.accountReconEntity,tt=Ne?.at??(Pe?.code==="reconciled"&&Ue!=null?Ue:Je??null),Qe=tt!=null?tt.format(ixo.visual.MMMDCommaYYYYformat):Di,dt=Ie!=null&&Ie.total>0?Ie.total:0,ct=Ie!=null&&dt>0?Math.min(Ie.matched,dt):0,yt=Ie?.percentage!=null?Math.round(Ie.percentage):dt>0?Math.round(ct/dt*100):null,He=dt>0?Math.max(dt-ct,0):1,jt=()=>{ae(!1),Ae!==!0&&x?.(n.accountReconEntity.account.accountId)},St=c==="excluded";return t.jsxRuntimeExports.jsxs(gmo,{"data-testid":_("account-recon-row-root-container",l!=null?`index-${l}`:n.accountReconEntity.account.accountId),heightValue:e,isLastRow:i,shouldShowBottomRadius:r,windowSize:E,isSelectedRow:a,isStatusHovered:Ae,isNeedsConnectionRow:Oe,onClick:jt,style:{position:"relative"},children:[T&&F>0?t.jsxRuntimeExports.jsx(ia,{flushRight:!0,children:t.jsxRuntimeExports.jsx(ra,{isLoading:V,count:F,style:{backgroundColor:$.colors.grey4,borderRadius:"50% 50% 50% 0",cursor:"pointer"},openThread:je,handleCommentMouseEnter:ne,handleCommentMouseLeave:me})}):null,T&&V===!1&&F===0?t.jsxRuntimeExports.jsx(ia,{flushRight:!0,innerClassName:"comment-add-icon",children:t.jsxRuntimeExports.jsx(fmo,{"data-testid":_("account-recon-add-comment",R),onClick:pe})}):null,T&&ee?t.jsxRuntimeExports.jsx(pu,{isElementThreadOpen:ee,roomId:K,openThreadId:W,openThreadMetadata:se,autoFocus:!0,autoExpand:!0,style:{position:"absolute",top:o.sp6,right:o.sp2,zIndex:5}}):null,T&&te&&oe!=null?t.jsxRuntimeExports.jsx(pu,{isElementThreadOpen:!0,roomId:K,openThreadId:oe,openThreadMetadata:U.get(oe)?.metadata??null,autoFocus:!1,autoExpand:!0,style:{position:"absolute",top:o.sp6,right:o.sp2,zIndex:5}}):T&&ie&&oe!=null&&B[0]!=null?t.jsxRuntimeExports.jsx(pu,{isElementThreadOpen:!0,roomId:K,openThreadId:oe,openThreadMetadata:B[0].metadata,showThreadOnHover:!0,autoFocus:!1,autoExpand:!1,style:{position:"absolute",top:o.sp6,right:o.sp2,zIndex:5}}):null,t.jsxRuntimeExports.jsxs(ymo,{isClickable:!0,"data-testid":_("total-row-container"),heightValue:e,$needsConnectionMuted:Oe===!0,children:[t.jsxRuntimeExports.jsx(jmo,{children:t.jsxRuntimeExports.jsxs(Cmo,{children:[t.jsxRuntimeExports.jsx(Le,{enterDelay:600,title:ce,style:{padding:`${o.sp1} ${o.sp2}`},placement:"bottom",children:t.jsxRuntimeExports.jsx(bmo,{className:"any-text-container",children:ce})}),ue&&t.jsxRuntimeExports.jsx(Le,{open:le,disableHoverListener:!0,disableIntersectionObserver:!0,arrow:!0,placement:"top",style:{padding:`${o.sp3} ${o.sp4}`},title:t.jsxRuntimeExports.jsxs(Jmo,{children:[t.jsxRuntimeExports.jsxs(Xmo,{children:[t.jsxRuntimeExports.jsx(exo,{children:XM.title}),t.jsxRuntimeExports.jsx(txo,{onClick:We=>{We.stopPropagation(),ae(!1)},children:t.jsxRuntimeExports.jsx(oxo,{})})]}),t.jsxRuntimeExports.jsxs(wmo,{children:[t.jsxRuntimeExports.jsx(nxo,{children:de}),t.jsxRuntimeExports.jsxs(sxo,{children:[t.jsxRuntimeExports.jsx(Ge,{label:XM.ignore,size:"small",variant:"secondary",loading:u,onClick:We=>{We.stopPropagation(),$e()}}),t.jsxRuntimeExports.jsx(Ge,{label:XM.exclude,size:"small",variant:"primary",loading:d,onClick:We=>{We.stopPropagation(),Se()}})]})]})]}),children:t.jsxRuntimeExports.jsx(Kmo,{onClick:We=>{We.stopPropagation(),ae(nt=>!nt)}})})]})}),t.jsxRuntimeExports.jsxs(Emo,{children:[St!==!0?t.jsxRuntimeExports.jsx($mo,{children:t.jsxRuntimeExports.jsx(Mne,{columnMode:"icon",noneSourceTrigger:Oe===!0?"connectLink":"addIcon",accountType:n.accountReconEntity.account.accountType,lastUpdatedAt:n.accountReconEntity.reconciliationId!=null?n.accountReconEntity.reconUpdatedAt:n.accountReconEntity.accountUpdatedAt,setIsStatusHovered:_e,statementStatus:n.accountReconEntity.statementStatus.code,accountId:n.accountReconEntity.account.accountId,bankBalance:ge,bankConnection:n.accountConnectionStatus,sourceType:ke,onConnectClicked:we,onStatementAddClicked:Ee,isLoading:Re,onReconnectClicked:ve})}):null,t.jsxRuntimeExports.jsx(Rmo,{$excludedTable:St,className:"any-text-container",children:Oe===!0?Di:Me!=null&&Re===!1?Fe("0,0",Me):Di}),t.jsxRuntimeExports.jsx(vmo,{children:c==="excluded"?t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",style:{paddingRight:o.sp3},children:Fe("0,0",ge)??Di}):Oe===!0?t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:null}):t.jsxRuntimeExports.jsx(Mne,{columnMode:"amount",accountType:n.accountReconEntity.account.accountType,lastUpdatedAt:n.accountReconEntity.reconciliationId!=null?n.accountReconEntity.reconUpdatedAt:n.accountReconEntity.accountUpdatedAt,setIsStatusHovered:_e,statementStatus:n.accountReconEntity.statementStatus.code,accountId:n.accountReconEntity.account.accountId,bankBalance:ge,bankConnection:n.accountConnectionStatus,sourceType:ke,onConnectClicked:we,onStatementAddClicked:Ee,isLoading:Re,onReconnectClicked:ve})}),t.jsxRuntimeExports.jsx(Smo,{children:Oe===!0?t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Di}):t.jsxRuntimeExports.jsx(gxo,{clearedBalance:ye,isLoading:Re})}),Oe===!0?t.jsxRuntimeExports.jsx(AEe,{children:t.jsxRuntimeExports.jsx(Ve,{className:"any-text-container",children:Di})}):t.jsxRuntimeExports.jsx(axo,{isLoading:Re,variance:he,variancePercentage:Ce,reconciliationStatusCode:n.accountReconEntity.reconciliationStatus?.code}),t.jsxRuntimeExports.jsx(Amo,{children:Oe===!0?t.jsxRuntimeExports.jsx(ze,{className:"any-text-container",children:Di}):dt>0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{style:{display:"flex",width:"100%",justifyContent:"flex-end",alignItems:"baseline",gap:o.sp2},children:[t.jsxRuntimeExports.jsx(jo,{className:"any-text-container",children:`${ct}/${dt}`}),t.jsxRuntimeExports.jsxs(jo,{className:"any-text-container",children:[yt,kEe]})]}),t.jsxRuntimeExports.jsxs(Imo,{children:[t.jsxRuntimeExports.jsx(Ane,{flexGrow:ct>0?ct:0,bg:$.colors.success}),t.jsxRuntimeExports.jsx(Ane,{flexGrow:He,bg:v.tagAttentionColorLight})]})]}):t.jsxRuntimeExports.jsx(Tmo,{onMouseEnter:()=>{_e(!0)},onMouseLeave:()=>{_e(!1)},children:c==="excluded"?t.jsxRuntimeExports.jsx(Lmo,{children:t.jsxRuntimeExports.jsx(Bmo,{children:Pne})}):Te==="plaid"?t.jsxRuntimeExports.jsx(mxo,{accountRecon:n,isLoading:Re,onReviewClicked:Be}):t.jsxRuntimeExports.jsx(xxo,{accountRecon:n,isLoading:Re,onReviewClicked:Be})})}),t.jsxRuntimeExports.jsx(kmo,{className:"any-text-container",children:c==="excluded"?Pne:Oe===!0?Di:Qe})]})]})]})}const axo=({variance:e,variancePercentage:n,reconciliationStatusCode:i,isLoading:r})=>{const a=t.useTheme(),l=e?.amount,c=n??void 0,d=e!=null&&l!=null?{amount:e.amount,currencyCode:e.currencyCode??"USD",currencySymbol:e.currencySymbol??"$"}:void 0,{varianceColor:u,variancePercentageColor:m,variancePercentageContainerColor:x}=hxo(a,e,i),h=r?Di:l!=null&&l===0?"0%":c!=null?c===0?"0%":`${parseFloat(c.toFixed(2))}${kEe}`:Di;return t.jsxRuntimeExports.jsxs(AEe,{children:[t.jsxRuntimeExports.jsx(Wmo,{textColor:u,children:d==null||r?Di:Fe("0,0",d)}),t.jsxRuntimeExports.jsx(Vmo,{textColor:m,bgColor:x,children:h})]})},IEe=e=>{const n=e.accountReconEntity.user;if(n!=null)return`${n.firstName} ${n.lastName}`.trim()||void 0},jA=({buttonLabel:e,isDisabled:n,tooltipText:i,dataTestId:r,onClick:a})=>t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:i}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(Ge,{suffixIcon:t.jsxRuntimeExports.jsx(Fo,{style:{marginTop:"2px"},width:o.sp3,height:o.sp3}),label:e,size:"standard",variant:"ghost",style:{padding:`${o.sp1} 12px`,columnGap:o.sp0,alignItems:"center"},disabled:n,"data-testid":r,onClick:l=>{l.stopPropagation(),a()}})}),lxo=({tooltipText:e,reconciledByName:n})=>n==null?t.jsxRuntimeExports.jsx(r4,{tooltipText:e}):t.jsxRuntimeExports.jsxs(Nmo,{children:[t.jsxRuntimeExports.jsxs(Ine,{children:[t.jsxRuntimeExports.jsx(Tne,{children:Us.tooltips.reconciledByLabel}),t.jsxRuntimeExports.jsx(SH,{children:n})]}),t.jsxRuntimeExports.jsxs(Ine,{children:[t.jsxRuntimeExports.jsx(Tne,{children:Us.tooltips.lastUpdatedLabel}),t.jsxRuntimeExports.jsx(SH,{children:e})]})]}),TEe=({tooltipText:e,reconciledByName:n,plainTooltip:i=!1})=>{const r=v.tagSuccessColorLight,a=i?t.jsxRuntimeExports.jsx(SH,{children:e}):t.jsxRuntimeExports.jsx(lxo,{tooltipText:e,reconciledByName:n});return t.jsxRuntimeExports.jsx(Le,{title:a,style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:n!=null||i?"none":"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(Pmo,{children:t.jsxRuntimeExports.jsx(Mmo,{children:t.jsxRuntimeExports.jsx(_mo,{textColor:r,children:Us.status.reconciled})})})})},LEe=({tooltipText:e})=>{const n=new t.Color(v.tagAttentionColorLight);return t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:e}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsx(JU,{children:t.jsxRuntimeExports.jsx(Dmo,{children:t.jsxRuntimeExports.jsx(XU,{textColor:n,children:Us.status.reconciliationFailed})})})})})},cxo=({status:e,tooltipText:n})=>{const i=new t.Color(v.tagWarningColorLight);return t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:n}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsx(JU,{children:t.jsxRuntimeExports.jsx(SEe,{children:t.jsxRuntimeExports.jsx(XU,{textColor:i,children:e})})})})})},BEe=({tooltipText:e})=>{const n=t.useTheme(),i=new t.Color(n.colors.hero);return t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:e}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsxs(eG,{children:[t.jsxRuntimeExports.jsx(dC,{textColor:i,children:Us.status.autoReconInProgress}),t.jsxRuntimeExports.jsx(dC,{textColor:i,children:Us.status.isInProgress})]})})})},dxo=()=>{const e=t.useTheme(),n=new t.Color(e.colors.hero);return t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsxs(eG,{children:[t.jsxRuntimeExports.jsx(dC,{textColor:n,children:Us.status.balanceSyncInProgress}),t.jsxRuntimeExports.jsx(dC,{textColor:n,children:Us.status.isInProgress})]})})},uxo=()=>{const e=t.useTheme(),n=new t.Color(e.colors.grey1);return t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsxs(eG,{children:[t.jsxRuntimeExports.jsx(dC,{textColor:n,children:Us.status.statementSyncInProgress}),t.jsxRuntimeExports.jsx(dC,{textColor:n,children:Us.status.isInProgress})]})})},pxo=({code:e,tooltipText:n,errorMessage:i})=>{const r=new t.Color(v.important),a=yxo(e);return t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:n}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsxs(_2,{children:[t.jsxRuntimeExports.jsx(Omo,{iconcolor:r.hex()}),t.jsxRuntimeExports.jsxs(JU,{children:[t.jsxRuntimeExports.jsx(SEe,{children:t.jsxRuntimeExports.jsx(XU,{textColor:r,children:a})}),t.jsxRuntimeExports.jsx(Fmo,{children:t.jsxRuntimeExports.jsx(zmo,{textColor:r,children:Us.status.failed})})]})]})})},AH=({showTooltip:e,tooltipText:n})=>e===!1?t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsx(kne,{children:Di})}):t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:n}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsx(kne,{children:Di})})});function mxo({accountRecon:e,isLoading:n,onReviewClicked:i}){const r=e.accountReconEntity.reconciliationStatus,a=e.accountConnectionStatus,l=e.accountReconEntity.reconciliationId!=null?e.accountReconEntity.reconUpdatedAt:e.accountReconEntity.accountUpdatedAt,c=l!=null?`${l.utc(!0).fromNow().toLowerCase()}`:Di,d=IEe(e);if(n)return t.jsxRuntimeExports.jsx(dxo,{});if(e.accountReconEntity.balanceDataStatus?.code==="not_found")return t.jsxRuntimeExports.jsx(cxo,{status:Us.status.balanceNotFound,tooltipText:c});if(a==="reconnect"||a==="not_connected")return t.jsxRuntimeExports.jsx(AH,{tooltipText:c,showTooltip:l!=null});if(r==null&&a==="connected"&&e.accountReconEntity.balance!=null&&e.accountReconEntity.clearedBalance!=null)return t.jsxRuntimeExports.jsx(jA,{buttonLabel:Us.status.review,isDisabled:!1,dataTestId:_("status-button",e.accountReconEntity.account.accountId),tooltipText:c,onClick:i});if(r!=null)switch(r.code){case"save_for_later":case"pending":return t.jsxRuntimeExports.jsx(jA,{buttonLabel:Us.status.review,isDisabled:!1,dataTestId:_("status-button",e.accountReconEntity.account.accountId),tooltipText:c,onClick:i});case"reconciled":case"reconciled_on_qbo":return t.jsxRuntimeExports.jsx(TEe,{tooltipText:c,reconciledByName:d});case"in_progress":return t.jsxRuntimeExports.jsx(BEe,{tooltipText:c});case"failed":return t.jsxRuntimeExports.jsx(LEe,{tooltipText:c});default:return null}else return t.jsxRuntimeExports.jsx(AH,{showTooltip:l!=null,tooltipText:c})}function xxo({accountRecon:e,isLoading:n,onReviewClicked:i}){const r=e.accountReconEntity.reconciliationStatus,a=e.accountReconEntity.statementDataStatus?.code==="validated"||e.accountReconEntity.statementDataStatus?.code==="processed",l=e.accountReconEntity.reconUpdatedAt,c=l!=null?`${l.utc(!0).fromNow().toLowerCase()}`:Di,d=IEe(e);if(e.accountReconEntity.statementDataStatus?.code==="parsing_failed"||e.accountReconEntity.statementDataStatus?.code==="validation_failed"||e.accountReconEntity.statementDataStatus?.code==="processing_failed")return t.jsxRuntimeExports.jsx(pxo,{code:e.accountReconEntity.statementDataStatus?.code,tooltipText:c,errorMessage:e.accountReconEntity.errorMessage?.errorShort});if(n)return t.jsxRuntimeExports.jsx(uxo,{});if(r==null&&a&&e.accountReconEntity.balance!=null&&e.accountReconEntity.clearedBalance!=null)return t.jsxRuntimeExports.jsx(jA,{buttonLabel:Us.status.review,isDisabled:!1,dataTestId:_("status-button",e.accountReconEntity.account.accountId),tooltipText:c,onClick:i});if(r!=null)switch(r.code){case"save_for_later":case"pending":return t.jsxRuntimeExports.jsx(jA,{buttonLabel:Us.status.review,isDisabled:!1,dataTestId:_("status-button",e.accountReconEntity.account.accountId),tooltipText:c,onClick:i});case"reconciled":case"reconciled_on_qbo":return t.jsxRuntimeExports.jsx(TEe,{tooltipText:c,reconciledByName:d});case"in_progress":return t.jsxRuntimeExports.jsx(BEe,{tooltipText:c});case"failed":return t.jsxRuntimeExports.jsx(LEe,{tooltipText:c});default:return null}else return t.jsxRuntimeExports.jsx(AH,{showTooltip:l!=null,tooltipText:c})}const hxo=(e,n,i)=>{let r,a,l;return n!=null&&n.amount===0&&i!=null&&i==="reconciled"?(r=new t.Color(e.colors.success),a=new t.Color(v.tagSuccessColorLight),l=new t.Color(v.tagSuccessBgLight)):(r=new t.Color(e.colors.champion),a=new t.Color(v.tagDefaultColorLight),l=new t.Color(v.tagDefaultBgLight)),{varianceColor:r,variancePercentageColor:a,variancePercentageContainerColor:l}},Mne=({bankBalance:e,accountType:n,bankConnection:i,sourceType:r,statementStatus:a,fromDrawer:l=!1,onConnectClicked:c,onReconnectClicked:d,isLoading:u,accountId:m,onStatementAddClicked:x,setIsStatusHovered:h,columnMode:f="full",noneSourceTrigger:y="addIcon"})=>{const C=fxo(n),E=(()=>{if(r==="bank")return i==="reconnect"?t.jsxRuntimeExports.jsx(Gmo,{"data-testid":_("account-reconciliation-reconnect-link",m),onClick:R=>{R.stopPropagation(),d?.()},children:Us.connect.reconnnect}):t.jsxRuntimeExports.jsx(Lne,{});if(r==="statement")return t.jsxRuntimeExports.jsx(Bne,{});const $=y==="connectLink";return t.jsxRuntimeExports.jsx(Qmo,{"data-testid":_("account-reconciliation-connect-button",m),onMouseEnter:()=>{h(!0)},onMouseLeave:()=>{h(!1)},children:t.jsxRuntimeExports.jsx(bt,{controller:C.length>0,children:t.jsxRuntimeExports.jsx(Le,{title:Us.tooltips.selectSource,style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(Gx,{moreIconType:"custom",customIcon:$===!0?t.jsxRuntimeExports.jsx(Hmo,{children:Us.connect.connect}):t.jsxRuntimeExports.jsx(Umo,{}),options:C,customStyleConfig:{control:()=>({backgroundColor:"transparent",":hover":{backgroundColor:"transparent"}}),option:()=>({".option-container":{justifyContent:"flex-start"}}),container:()=>({marginLeft:o.sp0,width:"100%",height:"100%"}),valueContainer:()=>$===!0?{width:"100%",minHeight:o.sp3,height:"auto",justifyContent:"center",padding:0,".more-icon":{width:"auto",height:"auto"}}:{width:"100%",height:o.sp3,justifyContent:"center",padding:0,".more-icon":{width:o.sp3,height:o.sp3}}},menuPlacement:"auto",onOptionSelection:R=>{R==="bank_connection"?c?.():R==="statement"&&x?.()},valueToIcon:R=>R==="bank_connection"?t.jsxRuntimeExports.jsx(Lne,{}):R==="statement"?t.jsxRuntimeExports.jsx(Bne,{}):null})})})})})();if(l===!0)return t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Fe("0,0",e)??Di});if(f==="icon")return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:E});if(u===!0)return f==="amount"?t.jsxRuntimeExports.jsx(qw,{children:t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Di})}):t.jsxRuntimeExports.jsxs(KM,{children:[t.jsxRuntimeExports.jsx(qw,{children:t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Di})}),t.jsxRuntimeExports.jsx(JM,{children:E})]});if(i==="connected"||i==="reconnect"||a==="uploaded"){const $=t.jsxRuntimeExports.jsx(qw,{children:t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Fe("0,0",e)??Di})});return f==="amount"?$:t.jsxRuntimeExports.jsxs(KM,{children:[$,t.jsxRuntimeExports.jsx(JM,{children:E})]})}else{const $=t.jsxRuntimeExports.jsx(qw,{children:t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Di})});return f==="amount"?$:t.jsxRuntimeExports.jsxs(KM,{children:[$,t.jsxRuntimeExports.jsx(JM,{children:E})]})}},gxo=({clearedBalance:e,isLoading:n})=>e!=null&&n===!1?t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Fe("0,0",e)??Di}):t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Di}),r4=({tooltipText:e})=>t.jsxRuntimeExports.jsxs(Ymo,{children:[t.jsxRuntimeExports.jsx(qmo,{children:Us.tooltips.lastUpdated}),t.jsxRuntimeExports.jsx(Zmo,{children:e})]});function fxo(e){const n=[];return e!=null&&e==="bank"&&n.push({label:Us.menu.bankConnection,value:"bank_connection"}),n.push({label:Us.menu.statement,value:"statement"}),n}const yxo=(e,n,i)=>{let r="";switch(e){case"parsing_failed":r=Us.status.statementParseError;break;case"validation_failed":r=Us.status.statementValidationFailed;break;case"processing_failed":r=Us.status.statementProcessingFailed;break;default:r=Us.status.statementParseError;break}return r},jxo=s.div`
24340
+ `,{dateFormat:ixo,expenseAutomation:{accountRecon:{reconciliation:Us}},common:{strings:{hyphen:Di,percentage:kEe},texts:{excluded:Pne}}}=O.getLocalizedStrings(),XM=Us.tooltips.excludeAccount;function rxo({height:e,accountRecon:n,isLastRow:i,shouldShowBottomRadius:r,isSelectedRow:a,index:l,tableType:c="normal",isExcludeInProgress:d,isIncludeInProgress:u,onReviewClicked:m,onOpenDrawerClicked:x,onConnectClicked:h,onReconnectClicked:f,onStatementAddClicked:y,onExcludeClicked:C,onIgnoreDetectionClicked:b}){const E=X(),$=t.useTheme(),R=n.accountReconEntity.account.accountId,S=l8(),k=Ki(),T=S!=null,A=ht(),I=g.useMemo(()=>({application:"dashboard",companyId:A.currentTenant?.companyId,tab:"expense_automation",entityType:"expense_automation.reconciliation.account",entityId:R,isGlobalComment:!1}),[A.currentTenant?.companyId,R]),{threads:B,isLoading:L}=sa(I,!1,!0),P=g.useMemo(()=>({application:"dashboard",companyId:A.currentTenant?.companyId,tab:"expense_automation",entityType:"expense_automation.transaction.row",groupId:R,isGlobalComment:!1}),[A.currentTenant?.companyId,R]),{threads:D,isLoading:M}=sa(P,!1,!0),F=B.length+D.length,V=L||M,{addThread:N,setOpenThread:H,openThread:W,threads:U,requestToOpenThread:Y,setRequestToOpenThread:q}=g.useContext(vs),Z=A.currentTenant?.companyId??"",G=A.currentTenant?.companyName??"",K=`dashboard_${Z}`,J=`expense_automation.reconciliation.account.${R}.${$s}`,oe=B.length>0?B[0].id:null,ee=W===J,te=oe!=null&&W===oe,se=W!=null?U.get(W)?.metadata??null:null,[ie,re]=g.useState(!1),ne=()=>re(!0),me=()=>re(!1);g.useEffect(()=>{if(Y?.threadId==null)return;B.some(nt=>nt.id===Y.threadId)&&L===!1&&(H(Y.threadId),q(null))},[Y,B,L,H,q]);const pe=We=>{We.stopPropagation();const nt={application:"dashboard",companyId:Z,companyName:G,entityId:R,entityType:"expense_automation.reconciliation.account",isGlobalComment:!1,tab:"expense_automation",url:window.location.href};N(J,{id:J,type:"thread",roomId:K,createdAt:new Date,comments:[],metadata:nt,resolved:!1,updatedAt:new Date}),H(J)},je=We=>{if(We.stopPropagation(),D.length===0&&oe!=null){H(oe);return}k?.sharedFunctions?.subtreeFunctions.openAllThreadsDrawer?.({roomId:K,companyId:Z,companyName:G,entityId:R,entityType:"expense_automation.reconciliation.account",groupId:R})},ce=n.accountReconEntity.account.accountName,de=n.accountDetectionReason,ue=de!=null,[le,ae]=g.useState(!1),ge=n.accountReconEntity.balance,ye=n.accountReconEntity.clearedBalance,he=n.accountReconEntity.variance,Ce=n.accountReconEntity.variancePercentage,we=()=>{h?.(n.accountReconEntity.account.accountId)},ve=()=>{f?.(n.accountReconEntity.account.accountId)},Ee=()=>{y?.(n.accountReconEntity.account.accountId)},Se=()=>{ae(!1),C?.(n.accountReconEntity.account.accountId)},$e=()=>{ae(!1),b?.(n.accountReconEntity.account.accountId)},Be=()=>{m?.(n.accountReconEntity.account.accountId)},[Ae,_e]=g.useState(!1),Te=n.accountConnectionStatus==="connected"||n.connectionInProgress===!0?"plaid":n.accountReconEntity.statementStatus?.code==="uploaded"||n.statementParseInProgress===!0?"bank_statement":"plaid",Re=Te==="plaid"?n.accountReconEntity.balanceDataStatus?.code==="in_progress"||n.connectionInProgress===!0:n.accountReconEntity.statementDataStatus?.code==="parsing"||n.statementParseInProgress===!0,ke=n.accountConnectionStatus==="connected"||n.accountConnectionStatus==="reconnect"||n.connectionInProgress===!0?"bank":n.accountReconEntity.statementStatus?.code==="uploaded"||n.statementParseInProgress===!0?"statement":"none",Oe=c!=="excluded"&&ke==="none",{openingBalance:Me,matchProgress:Ie,lastReconciled:Ne,reconciliationStatus:Pe,reconUpdatedAt:Qe,endDate:Je}=n.accountReconEntity,tt=Ne?.at??(Pe?.code==="reconciled"&&Qe!=null?Qe:Je??null),Ue=tt!=null?tt.format(ixo.visual.MMMDCommaYYYYformat):Di,dt=Ie!=null&&Ie.total>0?Ie.total:0,ct=Ie!=null&&dt>0?Math.min(Ie.matched,dt):0,yt=Ie?.percentage!=null?Math.round(Ie.percentage):dt>0?Math.round(ct/dt*100):null,He=dt>0?Math.max(dt-ct,0):1,jt=()=>{ae(!1),Ae!==!0&&x?.(n.accountReconEntity.account.accountId)},St=c==="excluded";return t.jsxRuntimeExports.jsxs(gmo,{"data-testid":_("account-recon-row-root-container",l!=null?`index-${l}`:n.accountReconEntity.account.accountId),heightValue:e,isLastRow:i,shouldShowBottomRadius:r,windowSize:E,isSelectedRow:a,isStatusHovered:Ae,isNeedsConnectionRow:Oe,onClick:jt,style:{position:"relative"},children:[T&&F>0?t.jsxRuntimeExports.jsx(ia,{flushRight:!0,children:t.jsxRuntimeExports.jsx(ra,{isLoading:V,count:F,style:{backgroundColor:$.colors.grey4,borderRadius:"50% 50% 50% 0",cursor:"pointer"},openThread:je,handleCommentMouseEnter:ne,handleCommentMouseLeave:me})}):null,T&&V===!1&&F===0?t.jsxRuntimeExports.jsx(ia,{flushRight:!0,innerClassName:"comment-add-icon",children:t.jsxRuntimeExports.jsx(fmo,{"data-testid":_("account-recon-add-comment",R),onClick:pe})}):null,T&&ee?t.jsxRuntimeExports.jsx(pu,{isElementThreadOpen:ee,roomId:K,openThreadId:W,openThreadMetadata:se,autoFocus:!0,autoExpand:!0,style:{position:"absolute",top:o.sp6,right:o.sp2,zIndex:5}}):null,T&&te&&oe!=null?t.jsxRuntimeExports.jsx(pu,{isElementThreadOpen:!0,roomId:K,openThreadId:oe,openThreadMetadata:U.get(oe)?.metadata??null,autoFocus:!1,autoExpand:!0,style:{position:"absolute",top:o.sp6,right:o.sp2,zIndex:5}}):T&&ie&&oe!=null&&B[0]!=null?t.jsxRuntimeExports.jsx(pu,{isElementThreadOpen:!0,roomId:K,openThreadId:oe,openThreadMetadata:B[0].metadata,showThreadOnHover:!0,autoFocus:!1,autoExpand:!1,style:{position:"absolute",top:o.sp6,right:o.sp2,zIndex:5}}):null,t.jsxRuntimeExports.jsxs(ymo,{isClickable:!0,"data-testid":_("total-row-container"),heightValue:e,$needsConnectionMuted:Oe===!0,children:[t.jsxRuntimeExports.jsx(jmo,{children:t.jsxRuntimeExports.jsxs(Cmo,{children:[t.jsxRuntimeExports.jsx(Le,{enterDelay:600,title:ce,style:{padding:`${o.sp1} ${o.sp2}`},placement:"bottom",children:t.jsxRuntimeExports.jsx(bmo,{className:"any-text-container",children:ce})}),ue&&t.jsxRuntimeExports.jsx(Le,{open:le,disableHoverListener:!0,disableIntersectionObserver:!0,arrow:!0,placement:"top",style:{padding:`${o.sp3} ${o.sp4}`},title:t.jsxRuntimeExports.jsxs(Jmo,{children:[t.jsxRuntimeExports.jsxs(Xmo,{children:[t.jsxRuntimeExports.jsx(exo,{children:XM.title}),t.jsxRuntimeExports.jsx(txo,{onClick:We=>{We.stopPropagation(),ae(!1)},children:t.jsxRuntimeExports.jsx(oxo,{})})]}),t.jsxRuntimeExports.jsxs(wmo,{children:[t.jsxRuntimeExports.jsx(nxo,{children:de}),t.jsxRuntimeExports.jsxs(sxo,{children:[t.jsxRuntimeExports.jsx(Ge,{label:XM.ignore,size:"small",variant:"secondary",loading:u,onClick:We=>{We.stopPropagation(),$e()}}),t.jsxRuntimeExports.jsx(Ge,{label:XM.exclude,size:"small",variant:"primary",loading:d,onClick:We=>{We.stopPropagation(),Se()}})]})]})]}),children:t.jsxRuntimeExports.jsx(Kmo,{onClick:We=>{We.stopPropagation(),ae(nt=>!nt)}})})]})}),t.jsxRuntimeExports.jsxs(Emo,{children:[St!==!0?t.jsxRuntimeExports.jsx($mo,{children:t.jsxRuntimeExports.jsx(Mne,{columnMode:"icon",noneSourceTrigger:Oe===!0?"connectLink":"addIcon",accountType:n.accountReconEntity.account.accountType,lastUpdatedAt:n.accountReconEntity.reconciliationId!=null?n.accountReconEntity.reconUpdatedAt:n.accountReconEntity.accountUpdatedAt,setIsStatusHovered:_e,statementStatus:n.accountReconEntity.statementStatus.code,accountId:n.accountReconEntity.account.accountId,bankBalance:ge,bankConnection:n.accountConnectionStatus,sourceType:ke,onConnectClicked:we,onStatementAddClicked:Ee,isLoading:Re,onReconnectClicked:ve})}):null,t.jsxRuntimeExports.jsx(Rmo,{$excludedTable:St,className:"any-text-container",children:Oe===!0?Di:Me!=null&&Re===!1?Fe("0,0",Me):Di}),t.jsxRuntimeExports.jsx(vmo,{children:c==="excluded"?t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",style:{paddingRight:o.sp3},children:Fe("0,0",ge)??Di}):Oe===!0?t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:null}):t.jsxRuntimeExports.jsx(Mne,{columnMode:"amount",accountType:n.accountReconEntity.account.accountType,lastUpdatedAt:n.accountReconEntity.reconciliationId!=null?n.accountReconEntity.reconUpdatedAt:n.accountReconEntity.accountUpdatedAt,setIsStatusHovered:_e,statementStatus:n.accountReconEntity.statementStatus.code,accountId:n.accountReconEntity.account.accountId,bankBalance:ge,bankConnection:n.accountConnectionStatus,sourceType:ke,onConnectClicked:we,onStatementAddClicked:Ee,isLoading:Re,onReconnectClicked:ve})}),t.jsxRuntimeExports.jsx(Smo,{children:Oe===!0?t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Di}):t.jsxRuntimeExports.jsx(gxo,{clearedBalance:ye,isLoading:Re})}),Oe===!0?t.jsxRuntimeExports.jsx(AEe,{children:t.jsxRuntimeExports.jsx(Ve,{className:"any-text-container",children:Di})}):t.jsxRuntimeExports.jsx(axo,{isLoading:Re,variance:he,variancePercentage:Ce,reconciliationStatusCode:n.accountReconEntity.reconciliationStatus?.code}),t.jsxRuntimeExports.jsx(Amo,{children:Oe===!0?t.jsxRuntimeExports.jsx(ze,{className:"any-text-container",children:Di}):dt>0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{style:{display:"flex",width:"100%",justifyContent:"flex-end",alignItems:"baseline",gap:o.sp2},children:[t.jsxRuntimeExports.jsx(jo,{className:"any-text-container",children:`${ct}/${dt}`}),t.jsxRuntimeExports.jsxs(jo,{className:"any-text-container",children:[yt,kEe]})]}),t.jsxRuntimeExports.jsxs(Imo,{children:[t.jsxRuntimeExports.jsx(Ane,{flexGrow:ct>0?ct:0,bg:$.colors.success}),t.jsxRuntimeExports.jsx(Ane,{flexGrow:He,bg:v.tagAttentionColorLight})]})]}):t.jsxRuntimeExports.jsx(Tmo,{onMouseEnter:()=>{_e(!0)},onMouseLeave:()=>{_e(!1)},children:c==="excluded"?t.jsxRuntimeExports.jsx(Lmo,{children:t.jsxRuntimeExports.jsx(Bmo,{children:Pne})}):Te==="plaid"?t.jsxRuntimeExports.jsx(mxo,{accountRecon:n,isLoading:Re,onReviewClicked:Be}):t.jsxRuntimeExports.jsx(xxo,{accountRecon:n,isLoading:Re,onReviewClicked:Be})})}),t.jsxRuntimeExports.jsx(kmo,{className:"any-text-container",children:c==="excluded"?Pne:Oe===!0?Di:Ue})]})]})]})}const axo=({variance:e,variancePercentage:n,reconciliationStatusCode:i,isLoading:r})=>{const a=t.useTheme(),l=e?.amount,c=n??void 0,d=e!=null&&l!=null?{amount:e.amount,currencyCode:e.currencyCode??"USD",currencySymbol:e.currencySymbol??"$"}:void 0,{varianceColor:u,variancePercentageColor:m,variancePercentageContainerColor:x}=hxo(a,e,i),h=r?Di:l!=null&&l===0?"0%":c!=null?c===0?"0%":`${parseFloat(c.toFixed(2))}${kEe}`:Di;return t.jsxRuntimeExports.jsxs(AEe,{children:[t.jsxRuntimeExports.jsx(Wmo,{textColor:u,children:d==null||r?Di:Fe("0,0",d)}),t.jsxRuntimeExports.jsx(Vmo,{textColor:m,bgColor:x,children:h})]})},IEe=e=>{const n=e.accountReconEntity.user;if(n!=null)return`${n.firstName} ${n.lastName}`.trim()||void 0},jA=({buttonLabel:e,isDisabled:n,tooltipText:i,dataTestId:r,onClick:a})=>t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:i}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(Ge,{suffixIcon:t.jsxRuntimeExports.jsx(Fo,{style:{marginTop:"2px"},width:o.sp3,height:o.sp3}),label:e,size:"standard",variant:"ghost",style:{padding:`${o.sp1} 12px`,columnGap:o.sp0,alignItems:"center"},disabled:n,"data-testid":r,onClick:l=>{l.stopPropagation(),a()}})}),lxo=({tooltipText:e,reconciledByName:n})=>n==null?t.jsxRuntimeExports.jsx(r4,{tooltipText:e}):t.jsxRuntimeExports.jsxs(Nmo,{children:[t.jsxRuntimeExports.jsxs(Ine,{children:[t.jsxRuntimeExports.jsx(Tne,{children:Us.tooltips.reconciledByLabel}),t.jsxRuntimeExports.jsx(SH,{children:n})]}),t.jsxRuntimeExports.jsxs(Ine,{children:[t.jsxRuntimeExports.jsx(Tne,{children:Us.tooltips.lastUpdatedLabel}),t.jsxRuntimeExports.jsx(SH,{children:e})]})]}),TEe=({tooltipText:e,reconciledByName:n,plainTooltip:i=!1})=>{const r=v.tagSuccessColorLight,a=i?t.jsxRuntimeExports.jsx(SH,{children:e}):t.jsxRuntimeExports.jsx(lxo,{tooltipText:e,reconciledByName:n});return t.jsxRuntimeExports.jsx(Le,{title:a,style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:n!=null||i?"none":"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(Pmo,{children:t.jsxRuntimeExports.jsx(Mmo,{children:t.jsxRuntimeExports.jsx(_mo,{textColor:r,children:Us.status.reconciled})})})})},LEe=({tooltipText:e})=>{const n=new t.Color(v.tagAttentionColorLight);return t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:e}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsx(JU,{children:t.jsxRuntimeExports.jsx(Dmo,{children:t.jsxRuntimeExports.jsx(XU,{textColor:n,children:Us.status.reconciliationFailed})})})})})},cxo=({status:e,tooltipText:n})=>{const i=new t.Color(v.tagWarningColorLight);return t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:n}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsx(JU,{children:t.jsxRuntimeExports.jsx(SEe,{children:t.jsxRuntimeExports.jsx(XU,{textColor:i,children:e})})})})})},BEe=({tooltipText:e})=>{const n=t.useTheme(),i=new t.Color(n.colors.hero);return t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:e}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsxs(eG,{children:[t.jsxRuntimeExports.jsx(dC,{textColor:i,children:Us.status.autoReconInProgress}),t.jsxRuntimeExports.jsx(dC,{textColor:i,children:Us.status.isInProgress})]})})})},dxo=()=>{const e=t.useTheme(),n=new t.Color(e.colors.hero);return t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsxs(eG,{children:[t.jsxRuntimeExports.jsx(dC,{textColor:n,children:Us.status.balanceSyncInProgress}),t.jsxRuntimeExports.jsx(dC,{textColor:n,children:Us.status.isInProgress})]})})},uxo=()=>{const e=t.useTheme(),n=new t.Color(e.colors.grey1);return t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsxs(eG,{children:[t.jsxRuntimeExports.jsx(dC,{textColor:n,children:Us.status.statementSyncInProgress}),t.jsxRuntimeExports.jsx(dC,{textColor:n,children:Us.status.isInProgress})]})})},pxo=({code:e,tooltipText:n,errorMessage:i})=>{const r=new t.Color(v.important),a=yxo(e);return t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:n}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsxs(_2,{children:[t.jsxRuntimeExports.jsx(Omo,{iconcolor:r.hex()}),t.jsxRuntimeExports.jsxs(JU,{children:[t.jsxRuntimeExports.jsx(SEe,{children:t.jsxRuntimeExports.jsx(XU,{textColor:r,children:a})}),t.jsxRuntimeExports.jsx(Fmo,{children:t.jsxRuntimeExports.jsx(zmo,{textColor:r,children:Us.status.failed})})]})]})})},AH=({showTooltip:e,tooltipText:n})=>e===!1?t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsx(kne,{children:Di})}):t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(r4,{tooltipText:n}),style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(_2,{children:t.jsxRuntimeExports.jsx(kne,{children:Di})})});function mxo({accountRecon:e,isLoading:n,onReviewClicked:i}){const r=e.accountReconEntity.reconciliationStatus,a=e.accountConnectionStatus,l=e.accountReconEntity.reconciliationId!=null?e.accountReconEntity.reconUpdatedAt:e.accountReconEntity.accountUpdatedAt,c=l!=null?`${l.utc(!0).fromNow().toLowerCase()}`:Di,d=IEe(e);if(n)return t.jsxRuntimeExports.jsx(dxo,{});if(e.accountReconEntity.balanceDataStatus?.code==="not_found")return t.jsxRuntimeExports.jsx(cxo,{status:Us.status.balanceNotFound,tooltipText:c});if(a==="reconnect"||a==="not_connected")return t.jsxRuntimeExports.jsx(AH,{tooltipText:c,showTooltip:l!=null});if(r==null&&a==="connected"&&e.accountReconEntity.balance!=null&&e.accountReconEntity.clearedBalance!=null)return t.jsxRuntimeExports.jsx(jA,{buttonLabel:Us.status.review,isDisabled:!1,dataTestId:_("status-button",e.accountReconEntity.account.accountId),tooltipText:c,onClick:i});if(r!=null)switch(r.code){case"save_for_later":case"pending":return t.jsxRuntimeExports.jsx(jA,{buttonLabel:Us.status.review,isDisabled:!1,dataTestId:_("status-button",e.accountReconEntity.account.accountId),tooltipText:c,onClick:i});case"reconciled":case"reconciled_on_qbo":return t.jsxRuntimeExports.jsx(TEe,{tooltipText:c,reconciledByName:d});case"in_progress":return t.jsxRuntimeExports.jsx(BEe,{tooltipText:c});case"failed":return t.jsxRuntimeExports.jsx(LEe,{tooltipText:c});default:return null}else return t.jsxRuntimeExports.jsx(AH,{showTooltip:l!=null,tooltipText:c})}function xxo({accountRecon:e,isLoading:n,onReviewClicked:i}){const r=e.accountReconEntity.reconciliationStatus,a=e.accountReconEntity.statementDataStatus?.code==="validated"||e.accountReconEntity.statementDataStatus?.code==="processed",l=e.accountReconEntity.reconUpdatedAt,c=l!=null?`${l.utc(!0).fromNow().toLowerCase()}`:Di,d=IEe(e);if(e.accountReconEntity.statementDataStatus?.code==="parsing_failed"||e.accountReconEntity.statementDataStatus?.code==="validation_failed"||e.accountReconEntity.statementDataStatus?.code==="processing_failed")return t.jsxRuntimeExports.jsx(pxo,{code:e.accountReconEntity.statementDataStatus?.code,tooltipText:c,errorMessage:e.accountReconEntity.errorMessage?.errorShort});if(n)return t.jsxRuntimeExports.jsx(uxo,{});if(r==null&&a&&e.accountReconEntity.balance!=null&&e.accountReconEntity.clearedBalance!=null)return t.jsxRuntimeExports.jsx(jA,{buttonLabel:Us.status.review,isDisabled:!1,dataTestId:_("status-button",e.accountReconEntity.account.accountId),tooltipText:c,onClick:i});if(r!=null)switch(r.code){case"save_for_later":case"pending":return t.jsxRuntimeExports.jsx(jA,{buttonLabel:Us.status.review,isDisabled:!1,dataTestId:_("status-button",e.accountReconEntity.account.accountId),tooltipText:c,onClick:i});case"reconciled":case"reconciled_on_qbo":return t.jsxRuntimeExports.jsx(TEe,{tooltipText:c,reconciledByName:d});case"in_progress":return t.jsxRuntimeExports.jsx(BEe,{tooltipText:c});case"failed":return t.jsxRuntimeExports.jsx(LEe,{tooltipText:c});default:return null}else return t.jsxRuntimeExports.jsx(AH,{showTooltip:l!=null,tooltipText:c})}const hxo=(e,n,i)=>{let r,a,l;return n!=null&&n.amount===0&&i!=null&&i==="reconciled"?(r=new t.Color(e.colors.success),a=new t.Color(v.tagSuccessColorLight),l=new t.Color(v.tagSuccessBgLight)):(r=new t.Color(e.colors.champion),a=new t.Color(v.tagDefaultColorLight),l=new t.Color(v.tagDefaultBgLight)),{varianceColor:r,variancePercentageColor:a,variancePercentageContainerColor:l}},Mne=({bankBalance:e,accountType:n,bankConnection:i,sourceType:r,statementStatus:a,fromDrawer:l=!1,onConnectClicked:c,onReconnectClicked:d,isLoading:u,accountId:m,onStatementAddClicked:x,setIsStatusHovered:h,columnMode:f="full",noneSourceTrigger:y="addIcon"})=>{const C=fxo(n),E=(()=>{if(r==="bank")return i==="reconnect"?t.jsxRuntimeExports.jsx(Gmo,{"data-testid":_("account-reconciliation-reconnect-link",m),onClick:R=>{R.stopPropagation(),d?.()},children:Us.connect.reconnnect}):t.jsxRuntimeExports.jsx(Lne,{});if(r==="statement")return t.jsxRuntimeExports.jsx(Bne,{});const $=y==="connectLink";return t.jsxRuntimeExports.jsx(Qmo,{"data-testid":_("account-reconciliation-connect-button",m),onMouseEnter:()=>{h(!0)},onMouseLeave:()=>{h(!1)},children:t.jsxRuntimeExports.jsx(bt,{controller:C.length>0,children:t.jsxRuntimeExports.jsx(Le,{title:Us.tooltips.selectSource,style:{padding:`${o.sp1} ${o.sp2}`},maxWidth:"105px",placement:"bottom",children:t.jsxRuntimeExports.jsx(Gx,{moreIconType:"custom",customIcon:$===!0?t.jsxRuntimeExports.jsx(Hmo,{children:Us.connect.connect}):t.jsxRuntimeExports.jsx(Umo,{}),options:C,customStyleConfig:{control:()=>({backgroundColor:"transparent",":hover":{backgroundColor:"transparent"}}),option:()=>({".option-container":{justifyContent:"flex-start"}}),container:()=>({marginLeft:o.sp0,width:"100%",height:"100%"}),valueContainer:()=>$===!0?{width:"100%",minHeight:o.sp3,height:"auto",justifyContent:"center",padding:0,".more-icon":{width:"auto",height:"auto"}}:{width:"100%",height:o.sp3,justifyContent:"center",padding:0,".more-icon":{width:o.sp3,height:o.sp3}}},menuPlacement:"auto",onOptionSelection:R=>{R==="bank_connection"?c?.():R==="statement"&&x?.()},valueToIcon:R=>R==="bank_connection"?t.jsxRuntimeExports.jsx(Lne,{}):R==="statement"?t.jsxRuntimeExports.jsx(Bne,{}):null})})})})})();if(l===!0)return t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Fe("0,0",e)??Di});if(f==="icon")return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:E});if(u===!0)return f==="amount"?t.jsxRuntimeExports.jsx(qw,{children:t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Di})}):t.jsxRuntimeExports.jsxs(KM,{children:[t.jsxRuntimeExports.jsx(qw,{children:t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Di})}),t.jsxRuntimeExports.jsx(JM,{children:E})]});if(i==="connected"||i==="reconnect"||a==="uploaded"){const $=t.jsxRuntimeExports.jsx(qw,{children:t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Fe("0,0",e)??Di})});return f==="amount"?$:t.jsxRuntimeExports.jsxs(KM,{children:[$,t.jsxRuntimeExports.jsx(JM,{children:E})]})}else{const $=t.jsxRuntimeExports.jsx(qw,{children:t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Di})});return f==="amount"?$:t.jsxRuntimeExports.jsxs(KM,{children:[$,t.jsxRuntimeExports.jsx(JM,{children:E})]})}},gxo=({clearedBalance:e,isLoading:n})=>e!=null&&n===!1?t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Fe("0,0",e)??Di}):t.jsxRuntimeExports.jsx(bx,{className:"any-text-container",children:Di}),r4=({tooltipText:e})=>t.jsxRuntimeExports.jsxs(Ymo,{children:[t.jsxRuntimeExports.jsx(qmo,{children:Us.tooltips.lastUpdated}),t.jsxRuntimeExports.jsx(Zmo,{children:e})]});function fxo(e){const n=[];return e!=null&&e==="bank"&&n.push({label:Us.menu.bankConnection,value:"bank_connection"}),n.push({label:Us.menu.statement,value:"statement"}),n}const yxo=(e,n,i)=>{let r="";switch(e){case"parsing_failed":r=Us.status.statementParseError;break;case"validation_failed":r=Us.status.statementValidationFailed;break;case"processing_failed":r=Us.status.statementProcessingFailed;break;default:r=Us.status.statementParseError;break}return r},jxo=s.div`
24341
24341
  display: flex;
24342
24342
  flex: 1 1 auto;
24343
24343
  box-sizing: border-box;
@@ -28548,7 +28548,7 @@ to {
28548
28548
  margin-bottom: ${o.sp3};
28549
28549
  `,fjo=s.div`
28550
28550
  height: ${o.sp3};
28551
- `,yjo=e=>{const n=X(),i=t.useTheme(),[r,a]=g.useState(!1),l=O.getLocalizedStrings(),{reportLabels:c,selectedRangeReport:d,selectedClassesViewRangeReport:u,uiState:m,downloadParams:x,analytics:h,onBackClick:f,updateDownloadStateHandler:y,onAdditionalBalanceSelectionChanged:C,insightsSectionAiCfoInfo:b,isAiCfoAccessEnabled:E,onAskAiCfoClick:$,initialOpenThreadRequest:R,isReportsCommentingEnabled:S,onElementCollapseStateChanged:k}=e,T=e.isZeniUser??!1,{insights:A}=d,{selectedCOABalancesRange:I,timeframe:B,selectedAdditionalBalances:L,downloadState:P}=m,D=d.availableNumberOfPeriods!=null&&d.availableNumberOfPeriods<2,M=m.mode==="compare_mode"&&!D,F=ht(),V=F.loggedInUserRole!=null&&!Q.hasInvestorBankerLevelAccess(F.loggedInUserRole),N=e.selectedRangeReport.reportId==="cash_in_cash_out"||e.selectedRangeReport.reportId==="cash_position",H=F?.currentTenant?.companyId,W=F?.currentTenant?.companyName??"",U=g.useMemo(()=>Hao(d.reportId),[d.reportId]),Y=S===!0&&H!=null&&U!=null,q=T?vs:Nu,{threads:Z,isLoading:G,requestToOpenThread:K,setRequestToOpenThread:J,setOpenThread:oe}=g.useContext(q),[ee,te]=g.useState(!1),se=g.useMemo(()=>({application:"dashboard",companyId:H,tab:"standard_report",isGlobalComment:!1}),[H]),ie=g.useMemo(()=>{if(U==null)return[];const Ne=V5(Z,se,"both");return Array.from(Ne.values()).filter(Pe=>rEe(Pe.metadata,U))},[Z,se,U]),ne=g.useMemo(()=>ie.filter(Ne=>Ne.resolved===!1&&!Ne.id.includes($s)),[ie]).length,me=300,pe=g.useRef(null);g.useEffect(()=>()=>{pe.current!=null&&clearTimeout(pe.current)},[]);const je=g.useCallback((Ne,Pe)=>{te(!1),pe.current!=null&&clearTimeout(pe.current),pe.current=setTimeout(()=>{J({threadId:Pe,companyId:Ne.companyId,entityType:Ne.entityType,threadMetadata:Ne})},me)},[J]),[ce,de]=g.useState(void 0),ue=g.useRef(null),le=g.useCallback(Ne=>{de(Ne)},[]),ae=g.useCallback(Ne=>{ue.current?.scrollToItem(Ne,"center")},[]),ge=u?.uiState.accountViewMode==="classes"?u.uiState.nodeCollapseState:m.nodeCollapseState,ye=g.useCallback(Ne=>U!=null&&iEe(U).includes(Ne),[U]);FU({requestToOpenThread:K,setRequestToOpenThread:J,setOpenThread:oe,allThreads:ie,reportTreeRootNodes:ce,nodeCollapseState:ge,isReportIdSupported:ye,onExpandNode:k?(Ne,Pe,Ue)=>k(Pe,Ue):void 0,scrollToNode:ae});const he=g.useRef(!1);g.useEffect(()=>{he.current||!Y||R?.threadId==null||R?.companyId==null||R?.entityType==null||G||ce==null||(he.current=!0,J(R))},[Y,R,G,ce,J]);const Ce=Wao(U),we=g.useMemo(()=>({companyId:H??"",companyName:W,entityType:Ce,entityId:H??"",isGlobalComment:!1,application:"dashboard",tab:"standard_report",url:globalThis.location.href}),[H,W,Ce]),ve=`dashboard_${H??""}`;g.useEffect(()=>{async function Ne(){await nlo({report:u!==void 0&&u.uiState.accountViewMode==="classes"?u:d,filter:d.filter,coaBalancesRange:I,isCompareModeOn:M,reportView:u!==void 0?u.uiState.accountViewMode:"account_group",classesToFilterOut:u!==void 0?u.uiState.classesToFilterOut:[],...x,reportType:V||N?"more_detailed":"detailed",isZeniCOAUsed:e.isZeniCOAUsed??!0}),h?.trackDownload(Ir(d.reportId),wu(B),"excel",M),y("Completed")}r&&P!=="In-Progress"&&(a(!1),y("In-Progress"),Ne())},[x,P,d.filter,r,M,I,d,u,B,h,y,V,N,e.isZeniCOAUsed]);const Ee=d.availableNumberOfPeriods==null||d.availableNumberOfPeriods===0||d.allTimeframeTicks.length===0,Se=Z$e(d),$e=d.fetchState==="In-Progress"||d.fetchState==="Not-Started"||m.mode==="forecast_mode"&&(Se==="In-Progress"||Se==="Not-Started"),Ae=Q.reduceAllFetchState([e?.reportsResyncFetchState??{fetchState:"Not-Started"},u??{fetchState:"Not-Started"}]).fetchState==="In-Progress"&&u?.uiState.accountViewMode==="classes";g.useEffect(()=>{const Ne=M||m.mode==="forecast_mode"?3:1;C(M,L,Ne)},[n]);const _e=Ne=>{e.autoCompleteData?.autoCompleteText!=null&&e.analytics?.trackSearch(io.Event.search,Ir(d.reportId),Ne.type,Ne.name,e.autoCompleteData?.autoCompleteText),e.autoCompleteActions?.onAutoCompleteEntity?.(Ne)},{autoCompleteData:Te,autoCompleteActions:Re,scrollPosition:ke,...Oe}=e,Me=t.jsxRuntimeExports.jsxs(ii,{children:[t.jsxRuntimeExports.jsx(H0,{downloadReportOptions:{type:"simple_menu",downloadMenu:{simpleMenuItems:[{type:"excel",isDisabled:Ee,isDownloading:P==="In-Progress"}],onDownloadClick:async Ne=>{if(Ne==="excel"){if(P==="In-Progress")return;a(!0)}}}}}),t.jsxRuntimeExports.jsx(ms,{dataTestId:"dashboard-report-ask-ai-cfo-button",isAiCfoAccessEnabled:E,onAskAiCfoClick:$})]}),Ie=t.jsxRuntimeExports.jsxs(Ejo,{children:[Y&&!ee?t.jsxRuntimeExports.jsxs($jo,{onClick:()=>te(!0),"data-testid":_("dashboard-report-page-comment-button"),children:[t.jsxRuntimeExports.jsx(Br,{count:G?void 0:ne,isLoading:G,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(Rjo,{})]}):null,Me]});return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(mjo,{children:[t.jsxRuntimeExports.jsx(Rt,{title:c.reportTitle,backgroundColor:i.colors.grey4,onBackClick:f,hideSearchBtn:!0,rightSideComponent:Ie,downloadPresent:!0,searchAutoComplete:{autoCompleteData:e.autoCompleteData,autoCompleteActions:{...e.autoCompleteActions,onAutoCompleteEntity:_e}},source:"DashboardReportPage",style:{zIndex:2}}),$e?t.jsxRuntimeExports.jsx(Vlo,{}):Ee?t.jsxRuntimeExports.jsx(Kao,{style:{background:i.colors.grey4},emptyContentText:l.common.noReport.replace("_item-name_",`${l.reportTitleById.operating_expenses.toLowerCase()}`),EmptyContentImage:$Dt}):t.jsxRuntimeExports.jsxs(xjo,{windowSize:n,children:[t.jsxRuntimeExports.jsx(wjo,{...Oe}),t.jsxRuntimeExports.jsxs(hjo,{children:[t.jsxRuntimeExports.jsx(jjo,{highlightedRangeReport:d,uiState:m}),Ae?t.jsxRuntimeExports.jsx(HU,{}):t.jsxRuntimeExports.jsx(Cjo,{...Oe})]}),A?.length>0&&A[0].summary?t.jsxRuntimeExports.jsx(gjo,{children:t.jsxRuntimeExports.jsx(NU,{insights:A,insightsSectionAiCfoQuestionsAndHandlers:b})}):t.jsxRuntimeExports.jsx(fjo,{}),t.jsxRuntimeExports.jsx(bjo,{scrollPosition:ke,isPageFetchInProgress:Ae,treeRef:Y?ue:void 0,onTreeNodesReady:Y?le:void 0,...Oe})]})]}),Y?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:ve,children:t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:ee,allowComposer:!0,drawerTitle:pjo,threads:ie,filter:se,autoExpand:!0,autoFocus:!1,isLoading:G,textOverrides:{composerPlaceholder:bse.addANewComment,replyComposerPlaceholder:bse.replyAComment,threadResolve:wse.resolveComment,threadUnResolve:wse.unResolveComment},threadMetadata:we,onThreadClick:je,onCloseAllThreadsDrawer:()=>te(!1),drawerSectionStyle:{width:n==="small"?"100%":"400px",boxSizing:n==="small"?"border-box":"content-box"},collapsibleThreadStyle:{width:n==="small"?"100%":"360px"}})}):null]})},jjo=g.memo(gco,t.isEqual),Cjo=g.memo(Sco,t.isEqual),bjo=g.memo(cjo,t.isEqual),wjo=g.memo(Byo,t.isEqual),Ejo=s.div`
28551
+ `,yjo=e=>{const n=X(),i=t.useTheme(),[r,a]=g.useState(!1),l=O.getLocalizedStrings(),{reportLabels:c,selectedRangeReport:d,selectedClassesViewRangeReport:u,uiState:m,downloadParams:x,analytics:h,onBackClick:f,updateDownloadStateHandler:y,onAdditionalBalanceSelectionChanged:C,insightsSectionAiCfoInfo:b,isAiCfoAccessEnabled:E,onAskAiCfoClick:$,initialOpenThreadRequest:R,isReportsCommentingEnabled:S,onElementCollapseStateChanged:k}=e,T=e.isZeniUser??!1,{insights:A}=d,{selectedCOABalancesRange:I,timeframe:B,selectedAdditionalBalances:L,downloadState:P}=m,D=d.availableNumberOfPeriods!=null&&d.availableNumberOfPeriods<2,M=m.mode==="compare_mode"&&!D,F=ht(),V=F.loggedInUserRole!=null&&!Q.hasInvestorBankerLevelAccess(F.loggedInUserRole),N=e.selectedRangeReport.reportId==="cash_in_cash_out"||e.selectedRangeReport.reportId==="cash_position",H=F?.currentTenant?.companyId,W=F?.currentTenant?.companyName??"",U=g.useMemo(()=>Hao(d.reportId),[d.reportId]),Y=S===!0&&H!=null&&U!=null,q=T?vs:Nu,{threads:Z,isLoading:G,requestToOpenThread:K,setRequestToOpenThread:J,setOpenThread:oe}=g.useContext(q),[ee,te]=g.useState(!1),se=g.useMemo(()=>({application:"dashboard",companyId:H,tab:"standard_report",isGlobalComment:!1}),[H]),ie=g.useMemo(()=>{if(U==null)return[];const Ne=V5(Z,se,"both");return Array.from(Ne.values()).filter(Pe=>rEe(Pe.metadata,U))},[Z,se,U]),ne=g.useMemo(()=>ie.filter(Ne=>Ne.resolved===!1&&!Ne.id.includes($s)),[ie]).length,me=300,pe=g.useRef(null);g.useEffect(()=>()=>{pe.current!=null&&clearTimeout(pe.current)},[]);const je=g.useCallback((Ne,Pe)=>{te(!1),pe.current!=null&&clearTimeout(pe.current),pe.current=setTimeout(()=>{J({threadId:Pe,companyId:Ne.companyId,entityType:Ne.entityType,threadMetadata:Ne})},me)},[J]),[ce,de]=g.useState(void 0),ue=g.useRef(null),le=g.useCallback(Ne=>{de(Ne)},[]),ae=g.useCallback(Ne=>{ue.current?.scrollToItem(Ne,"center")},[]),ge=u?.uiState.accountViewMode==="classes"?u.uiState.nodeCollapseState:m.nodeCollapseState,ye=g.useCallback(Ne=>U!=null&&iEe(U).includes(Ne),[U]);FU({requestToOpenThread:K,setRequestToOpenThread:J,setOpenThread:oe,allThreads:ie,reportTreeRootNodes:ce,nodeCollapseState:ge,isReportIdSupported:ye,onExpandNode:k?(Ne,Pe,Qe)=>k(Pe,Qe):void 0,scrollToNode:ae});const he=g.useRef(!1);g.useEffect(()=>{he.current||!Y||R?.threadId==null||R?.companyId==null||R?.entityType==null||G||ce==null||(he.current=!0,J(R))},[Y,R,G,ce,J]);const Ce=Wao(U),we=g.useMemo(()=>({companyId:H??"",companyName:W,entityType:Ce,entityId:H??"",isGlobalComment:!1,application:"dashboard",tab:"standard_report",url:globalThis.location.href}),[H,W,Ce]),ve=`dashboard_${H??""}`;g.useEffect(()=>{async function Ne(){await nlo({report:u!==void 0&&u.uiState.accountViewMode==="classes"?u:d,filter:d.filter,coaBalancesRange:I,isCompareModeOn:M,reportView:u!==void 0?u.uiState.accountViewMode:"account_group",classesToFilterOut:u!==void 0?u.uiState.classesToFilterOut:[],...x,reportType:V||N?"more_detailed":"detailed",isZeniCOAUsed:e.isZeniCOAUsed??!0}),h?.trackDownload(Ir(d.reportId),wu(B),"excel",M),y("Completed")}r&&P!=="In-Progress"&&(a(!1),y("In-Progress"),Ne())},[x,P,d.filter,r,M,I,d,u,B,h,y,V,N,e.isZeniCOAUsed]);const Ee=d.availableNumberOfPeriods==null||d.availableNumberOfPeriods===0||d.allTimeframeTicks.length===0,Se=Z$e(d),$e=d.fetchState==="In-Progress"||d.fetchState==="Not-Started"||m.mode==="forecast_mode"&&(Se==="In-Progress"||Se==="Not-Started"),Ae=Q.reduceAllFetchState([e?.reportsResyncFetchState??{fetchState:"Not-Started"},u??{fetchState:"Not-Started"}]).fetchState==="In-Progress"&&u?.uiState.accountViewMode==="classes";g.useEffect(()=>{const Ne=M||m.mode==="forecast_mode"?3:1;C(M,L,Ne)},[n]);const _e=Ne=>{e.autoCompleteData?.autoCompleteText!=null&&e.analytics?.trackSearch(io.Event.search,Ir(d.reportId),Ne.type,Ne.name,e.autoCompleteData?.autoCompleteText),e.autoCompleteActions?.onAutoCompleteEntity?.(Ne)},{autoCompleteData:Te,autoCompleteActions:Re,scrollPosition:ke,...Oe}=e,Me=t.jsxRuntimeExports.jsxs(ii,{children:[t.jsxRuntimeExports.jsx(H0,{downloadReportOptions:{type:"simple_menu",downloadMenu:{simpleMenuItems:[{type:"excel",isDisabled:Ee,isDownloading:P==="In-Progress"}],onDownloadClick:async Ne=>{if(Ne==="excel"){if(P==="In-Progress")return;a(!0)}}}}}),t.jsxRuntimeExports.jsx(ms,{dataTestId:"dashboard-report-ask-ai-cfo-button",isAiCfoAccessEnabled:E,onAskAiCfoClick:$})]}),Ie=t.jsxRuntimeExports.jsxs(Ejo,{children:[Y&&!ee?t.jsxRuntimeExports.jsxs($jo,{onClick:()=>te(!0),"data-testid":_("dashboard-report-page-comment-button"),children:[t.jsxRuntimeExports.jsx(Br,{count:G?void 0:ne,isLoading:G,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(Rjo,{})]}):null,Me]});return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(mjo,{children:[t.jsxRuntimeExports.jsx(Rt,{title:c.reportTitle,backgroundColor:i.colors.grey4,onBackClick:f,hideSearchBtn:!0,rightSideComponent:Ie,downloadPresent:!0,searchAutoComplete:{autoCompleteData:e.autoCompleteData,autoCompleteActions:{...e.autoCompleteActions,onAutoCompleteEntity:_e}},source:"DashboardReportPage",style:{zIndex:2}}),$e?t.jsxRuntimeExports.jsx(Vlo,{}):Ee?t.jsxRuntimeExports.jsx(Kao,{style:{background:i.colors.grey4},emptyContentText:l.common.noReport.replace("_item-name_",`${l.reportTitleById.operating_expenses.toLowerCase()}`),EmptyContentImage:$Dt}):t.jsxRuntimeExports.jsxs(xjo,{windowSize:n,children:[t.jsxRuntimeExports.jsx(wjo,{...Oe}),t.jsxRuntimeExports.jsxs(hjo,{children:[t.jsxRuntimeExports.jsx(jjo,{highlightedRangeReport:d,uiState:m}),Ae?t.jsxRuntimeExports.jsx(HU,{}):t.jsxRuntimeExports.jsx(Cjo,{...Oe})]}),A?.length>0&&A[0].summary?t.jsxRuntimeExports.jsx(gjo,{children:t.jsxRuntimeExports.jsx(NU,{insights:A,insightsSectionAiCfoQuestionsAndHandlers:b})}):t.jsxRuntimeExports.jsx(fjo,{}),t.jsxRuntimeExports.jsx(bjo,{scrollPosition:ke,isPageFetchInProgress:Ae,treeRef:Y?ue:void 0,onTreeNodesReady:Y?le:void 0,...Oe})]})]}),Y?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:ve,children:t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:ee,allowComposer:!0,drawerTitle:pjo,threads:ie,filter:se,autoExpand:!0,autoFocus:!1,isLoading:G,textOverrides:{composerPlaceholder:bse.addANewComment,replyComposerPlaceholder:bse.replyAComment,threadResolve:wse.resolveComment,threadUnResolve:wse.unResolveComment},threadMetadata:we,onThreadClick:je,onCloseAllThreadsDrawer:()=>te(!1),drawerSectionStyle:{width:n==="small"?"100%":"400px",boxSizing:n==="small"?"border-box":"content-box"},collapsibleThreadStyle:{width:n==="small"?"100%":"360px"}})}):null]})},jjo=g.memo(gco,t.isEqual),Cjo=g.memo(Sco,t.isEqual),bjo=g.memo(cjo,t.isEqual),wjo=g.memo(Byo,t.isEqual),Ejo=s.div`
28552
28552
  display: flex;
28553
28553
  flex-direction: row;
28554
28554
  align-items: center;
@@ -30763,7 +30763,7 @@ to {
30763
30763
  `,sEo=s.div`
30764
30764
  display: flex;
30765
30765
  flex-direction: row;
30766
- `,iEo=s.div``,rEo=()=>null,aEo=()=>null,lEo=()=>null,cEo=()=>null,{common:{strings:n3},expenseAutomation:{transactions:q1},transactionDetail:{lineItems:{journalEntryTable:hE,categories:dEo}}}=O.getLocalizedStrings(),hC={containerPaddingLeftRight:new w(p[3],p[3]),containerPaddingTopBottom:new w(6,6),controlHeight:new w(p[4],p[5]),nameLogoWidth:new w(p[2],p[3]),nameLogoHeight:new w(p[2],p[3]),borderRadius:6},uEo=({accountList:e,accountsHierarchyList:n,classHierarchyList:i,classList:r,columns:a,isCOTEnabled:l,isCompressed:c,isDisabled:d,isUncategorizedExpenseCategoryEnabled:u,line:m,lineIndex:x,onCOTView:h,openTooltipId:f,projects:y,searchAutoComplete:C,sectionId:b,setOpenTooltipId:E,transactionId:$,uncategorizedAccounts:R})=>{const S=t.useTheme(),k=X(),A=t.useFormContext()?.setValue,[I,B]=g.useState(!1),L=g.useMemo(()=>mEo(m),[m]),P=g.useMemo(()=>xEo(m),[m]),D=g.useMemo(()=>hEo(m),[m]),M=m.lineEntity,F=M?.qboId??M?.id??M?.name,V=M?.name,N=`${b}.${x}.lineDescription`,H=`${b}.${x}.lineEntitySelection`,W=`${b}.${x}.account`,U=`${b}.${x}.class`,Y=`${b}.${x}.project`,q=`${b}.${x}.amount.amount`,Z=I,G={control:()=>({marginLeft:-2,backgroundColor:I?S.colors.background:S.colors.grey5,minHeight:p[5]}),valueContainer:()=>({justifyContent:"flex-start",paddingLeft:p[0],height:p[5],backgroundColor:S.colors.grey5}),menu:()=>({width:"150%",background:S.colors.grey5}),singleValue:()=>({color:I||Z?S.colors.primary:S.colors.champion,paddingLeft:p[2]}),input:We=>({...We,color:I||Z?S.colors.primary:S.colors.champion,textAlign:"left",paddingLeft:p[2]}),menuPortal:We=>({...We,zIndex:10})},K={...G,singleValue:We=>({...We,color:I||Z?S.colors.primary:S.colors.champion}),menu:()=>({marginTop:p[1],marginLeft:-p[2]}),input:We=>({...We,color:I||Z?S.colors.primary:S.colors.champion,textAlign:"left",...z.standardMedium}),control:We=>({...We,height:p[5]})},J=g.useMemo(()=>m.recommendationsWithCOT??[],[m.recommendationsWithCOT]),oe=g.useMemo(()=>N9(n,J,dEo),[n,J]),ee=g.useMemo(()=>H9(i,J),[i,J]),te=g.useMemo(()=>PC(y),[y]),se=g.useMemo(()=>({customer:[],vendor:[],fetchState:"not_started"}),[]),ie=g.useMemo(()=>K5(C?.autoCompleteData?.entityAutoCompleteView??se,M,J),[C,M,J,se]),re=g.useCallback((We,nt)=>{C?.loadOptions?C.loadOptions(We,nt):nt(ie)},[C,ie]),ne=cD(oe,L),me=cD(ee,P),pe=cD(te,D),je=y2("vendor",ie,F),ce=!!m.isCategoryMiscategorized||y2("category",oe,L),de=!!m.isClassMiscategorized||y2("class",ee,P),ue=!L||R!=null&&typeof L=="string"&&Q.isAccountUncategorized(R,L,u===!0?["income"]:void 0),[le,ae]=g.useState(ue),[ge,ye]=g.useState(!P),[he,Ce]=g.useState(!D),[we,ve]=g.useState(!F),[Ee,Se]=g.useState(!1),[$e,Be]=g.useState(!1),[Ae,_e]=g.useState(!1),[Te,Re]=g.useState(!1);g.useEffect(()=>{L&&typeof L=="string"&&R!=null&&Q.isAccountUncategorized(R,L,u===!0?["income"]:void 0)===!1?ae(!1):ae(!0)},[L,R,u]),g.useEffect(()=>{ye(!P)},[P]),g.useEffect(()=>{Ce(!D)},[D]),g.useEffect(()=>{ve(!F)},[F]);const ke=()=>{ve(!F),Se(!1)},Oe=()=>{L&&typeof L=="string"&&(R==null||Q.isAccountUncategorized(R,L,u===!0?["income"]:void 0)===!1)?ae(!1):ae(!0),Be(!1)},Me=()=>{ye(!P),_e(!1)},Ie=()=>{Ce(!D),Re(!1)},Ne=()=>{Se(!0)},Pe=()=>{Be(!0)},Ue=()=>{_e(!0)},Je=()=>{Re(!0)},tt=g.useMemo(()=>h!=null?{onCOTView:(We,nt,ut,pt)=>{h(ut,pt)}}:void 0,[h]),Qe=g.useCallback((We,nt)=>{h?.(We,nt)},[h]),dt=(We,nt)=>{if(A==null)return;let ut;switch(nt){case"vendor":ut=H;break;case"category":ut=W;break;case"class":ut=U;break;default:return}A(`${ut}.selectedOption`,We,{shouldValidate:!0,shouldDirty:!0})},ct=g.useCallback(We=>R!=null&&Q.isAccountUncategorized(R,We,u===!0?["income"]:void 0),[R,u]),yt=$??m.id,He=E??(We=>{}),jt=!1,St=(We,nt)=>{const ut=m.postingType;if(!(We==="debit"&&ut==="debit"||We==="credit"&&ut==="credit"))return t.jsxRuntimeExports.jsx(dwo,{children:hE.emptyDash});const Bt=m.amount,Ht=We==="debit"?hE.debitPrefix:hE.creditPrefix;return t.jsxRuntimeExports.jsxs(kA,{windowSize:k,isLastItem:!0,style:{justifyContent:"flex-start",width:"100%"},children:[nt&&t.jsxRuntimeExports.jsx(cwo,{children:Ht}),t.jsxRuntimeExports.jsx(gEo,{children:t.jsxRuntimeExports.jsx(Qs,{isDisabled:d??"readonly",showAdditionalInfoLabel:!1,label:{label:"",width:0},controlWidth:"100%",formattedTextField:{type:"number",name:q,defaultValue:Bt.amount,prefix:Bt.currencySymbol??"",placeholderAlignment:"left",returnValueType:"floatValue",allowNegative:!0,decimalSeparator:".",decimalScale:2,fixedDecimalScale:!0,thousandSeparator:!0,isNumericString:!1,registerOptions:{required:!1},autoComplete:"off",inputStyle:{paddingLeft:0,paddingRight:0,textAlign:"left"}},style:{minWidth:0,boxSizing:"border-box",paddingLeft:0,paddingRight:0,borderLeftWidth:0,borderRightWidth:0}},q)})]})};return t.jsxRuntimeExports.jsx(ARe,{isHovered:I,onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),"data-testid":_("journal-entry-table-row",`${b}-${x}`),children:a.map((We,nt)=>{const ut=nt===a.length-1,pt=We.key==="debit"||We.key==="credit",Bt=c===!0?We.customStyle?.quickView??We.customStyle?.cellStyle:We.customStyle?.cellStyle,$o=`${b}-${x}-${We.key}`;switch(We.key){case"description":return t.jsxRuntimeExports.jsx(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:Bt,children:t.jsxRuntimeExports.jsx(kA,{windowSize:k,isLastItem:ut,style:{width:"100%",justifyContent:"flex-start"},children:t.jsxRuntimeExports.jsx(fEo,{isCompressed:c,children:t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,showAdditionalInfoLabel:!1,label:{label:"",width:0},controlWidth:"100%",text:{name:N,type:"text",defaultValue:m.lineDescription??"",placeholder:hE.descriptionPlaceholder,options:{required:!1},style:{textAlign:"left"}},style:{minWidth:0,boxSizing:"border-box",paddingLeft:0,paddingRight:0}},N)})})},$o);case"name":return t.jsxRuntimeExports.jsxs(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:Bt,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(dD,{isCOTEnabled:l,recommendations:J,type:"vendor",isMisCategorized:je,onRecommendationClick:dt,selectedValue:F,selectedValueLabel:V,isReviewTab:jt,isAccountOptionDisabled:ct,existingOption:{label:M?.name,value:M?.qboId??M?.id},cotTracking:tt,lineId:m.id,transactionId:yt,openTooltipId:f,setOpenTooltipId:He}),t.jsxRuntimeExports.jsx(jE,{children:we===!0?t.jsxRuntimeExports.jsx(fE,{isHovered:I,isCompressed:c,children:t.jsxRuntimeExports.jsx(gE,{onClick:Tt=>{Tt.stopPropagation(),ve(!1),Se(!0)},"data-testid":_("add-vendor-button",`${b}-${x}`),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:q1.addPayee})}):Ee===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:ke,children:t.jsxRuntimeExports.jsx(vEo,{"data-testid":_("vendor-selection-dropdown-container",`${b}-${x}`),children:t.jsxRuntimeExports.jsx(TG,{name:H,placeholder:q1.addPayee,defaultValue:{selectedOption:F,defaultOptions:ie},type:"vendor",autoFocus:!we,style:{width:"100%"},pageSource:"details_page",transactionStatus:null,isOptionRemovable:!1,customStyleConfig:K,menuIsOpen:Ee,onMenuClose:ke,registerOptions:{required:!1},loadOptions:re,showCOT:l,onCOTView:Qe,menuPortal:document.body})})}):t.jsxRuntimeExports.jsx(AEo,{children:t.jsxRuntimeExports.jsx(yE,{isHovered:I,isCompressed:c,children:t.jsxRuntimeExports.jsx(REo,{onClick:Ne,"data-testid":_("vendor-name-text",`${b}-${x}`),children:M!=null&&M.name?t.jsxRuntimeExports.jsx(Xn,{text:M.name,itemTextStyle:{color:I?S.colors.primary:S.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}):t.jsxRuntimeExports.jsx(SEo,{children:n3.hyphen})})})})})]},$o);case"category":return t.jsxRuntimeExports.jsxs(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:Bt,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(dD,{isCOTEnabled:l,recommendations:J,type:"category",isReviewTab:jt,isAccountOptionDisabled:ct,isMisCategorized:ce,onRecommendationClick:dt,selectedValue:L,selectedValueLabel:ne,existingOption:{label:ne,value:L},cotTracking:tt,lineId:m.id,transactionId:yt,openTooltipId:f,setOpenTooltipId:He}),t.jsxRuntimeExports.jsx(jE,{children:le===!0?t.jsxRuntimeExports.jsx(fE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(gE,{onClick:Tt=>{Tt.stopPropagation(),ae(!1),Be(!0)},"data-testid":_("category-selection-field",`${b}-${x}`),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[q1.addCategory,t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})}):$e===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:Oe,children:t.jsxRuntimeExports.jsx(uD,{isHovered:I,"data-testid":_("category-selection-dropdown-container",`${b}-${x}`),children:t.jsxRuntimeExports.jsx(Ll,{name:W,placeholder:q1.addCategory,type:"category",pageSource:"details_page",transactionStatus:null,showCOT:l,isDisabled:d,defaultValue:{selectedOption:L,allOptions:oe},style:{display:"flex",flexGrow:1,width:"100%",cursor:"inherit"},registerOptions:{required:!1},menuIsOpen:$e,autoFocus:!le,onMenuClose:Oe,customStyleConfig:G,disableCurrentOption:ct,menuPortal:document.body,onCOTView:Qe})})}):t.jsxRuntimeExports.jsx(yE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(pD,{onClick:Pe,"data-testid":_("category-label-text",`${b}-${x}`),children:[t.jsxRuntimeExports.jsx(Xn,{text:ne??"",itemTextStyle:{color:I?S.colors.primary:S.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})})})]},$o);case"class":return t.jsxRuntimeExports.jsxs(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:Bt,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(dD,{isCOTEnabled:l,recommendations:J,type:"class",isReviewTab:jt,isAccountOptionDisabled:ct,isMisCategorized:de,onRecommendationClick:dt,selectedValue:P,selectedValueLabel:me,existingOption:{label:me,value:P},cotTracking:tt,lineId:m.id,transactionId:yt,openTooltipId:f,setOpenTooltipId:He}),t.jsxRuntimeExports.jsx(jE,{children:ge===!0?t.jsxRuntimeExports.jsx(fE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(gE,{onClick:Tt=>{Tt.stopPropagation(),ye(!1),_e(!0)},"data-testid":_("class-selection-field",`${b}-${x}`),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[q1.addClass,t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})}):Ae===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:Me,children:t.jsxRuntimeExports.jsx(uD,{isHovered:I,"data-testid":_("class-selection-dropdown-container",`${b}-${x}`),children:t.jsxRuntimeExports.jsx(Ll,{name:U,placeholder:q1.addClass,type:"class",showCOT:l,isDisabled:d,defaultValue:{selectedOption:P,allOptions:ee},pageSource:"details_page",transactionStatus:null,menuIsOpen:Ae,registerOptions:{required:!1},style:{width:"100%"},autoFocus:!ge&&!P,customStyleConfig:G,onMenuClose:Me,menuPortal:document.body,onCOTView:Qe})})}):t.jsxRuntimeExports.jsx(yE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(pD,{"data-testid":_("class-selection-field",`${b}-${x}`),onClick:Ue,children:[t.jsxRuntimeExports.jsx(Xn,{text:me??"",itemTextStyle:{color:I?S.colors.primary:S.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})})})]},$o);case"project":return t.jsxRuntimeExports.jsxs(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:Bt,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(YH,{children:t.jsxRuntimeExports.jsx("span",{})}),t.jsxRuntimeExports.jsx(jE,{children:he===!0?t.jsxRuntimeExports.jsx(fE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(gE,{onClick:Tt=>{Tt.stopPropagation(),Ce(!1),Re(!0)},"data-testid":_("project-selection-field",`${b}-${x}`),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[q1.addProject,t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})}):Te===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:Ie,children:t.jsxRuntimeExports.jsx(uD,{isHovered:I,"data-testid":_("project-selection-dropdown-container",`${b}-${x}`),children:t.jsxRuntimeExports.jsx(Ll,{name:Y,placeholder:q1.addProject,type:"project",showCOT:!1,isDisabled:d,defaultValue:{selectedOption:D,allOptions:te},pageSource:"details_page",transactionStatus:null,menuIsOpen:Te,registerOptions:{required:!1},style:{width:"100%"},autoFocus:!he&&!D,customStyleConfig:G,onMenuClose:Ie,menuPortal:document.body})})}):t.jsxRuntimeExports.jsx(yE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(pD,{"data-testid":_("project-selection-field",`${b}-${x}`),onClick:Je,children:[t.jsxRuntimeExports.jsx(Xn,{text:pe??"",itemTextStyle:{color:I?S.colors.primary:S.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})})})]},$o);case"debit":return t.jsxRuntimeExports.jsx(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:{marginRight:p[0],...Bt},children:St("debit",!1)},$o);case"credit":return t.jsxRuntimeExports.jsx(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:{marginRight:p[0],...Bt},children:St("credit",!1)},$o);case"amount":{const Tt=m.postingType==="credit"?"credit":"debit";return t.jsxRuntimeExports.jsx(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:{marginRight:p[0],...Bt},children:St(Tt,!0)},$o)}default:return null}})})},pEo=({columns:e,isCompressed:n})=>{const i=X();return t.jsxRuntimeExports.jsx(ARe,{"data-testid":_("journal-entry-table-empty-row","skeleton"),children:e.map((r,a)=>{const l=a===e.length-1,c=r.key==="debit"||r.key==="credit",d=n===!0?r.customStyle?.quickView??r.customStyle?.common:r.customStyle?.common;return r.key==="name"?t.jsxRuntimeExports.jsx(Vd,{windowSize:i,wrapperWidth:r.width,widthPercentage:r.widthPercentage,isCompressed:n,isDividerColumn:c,isLastItem:l,style:d,children:t.jsxRuntimeExports.jsx(kA,{windowSize:i,isLastItem:l,children:t.jsxRuntimeExports.jsxs($Eo,{children:[t.jsxRuntimeExports.jsx(xs,{width:p[4],height:p[4]}),t.jsxRuntimeExports.jsx(fe,{width:"100%",height:p[4],style:{display:"flex",alignItems:"center"}})]})})},r.key):t.jsxRuntimeExports.jsx(Vd,{windowSize:i,wrapperWidth:r.width,widthPercentage:r.widthPercentage,isCompressed:n,isDividerColumn:c,isLastItem:l,style:d,children:t.jsxRuntimeExports.jsx(kA,{windowSize:i,isLastItem:l,children:t.jsxRuntimeExports.jsx(fe,{width:"100%",height:p[4],style:{display:"flex",alignItems:"center"}})})},r.key)})})},mEo=e=>{const n=e.account;if(n==null)return;if(typeof n.selectedOption=="string")return n.selectedOption;const i=n;return i.qboId??i.accountId},xEo=e=>{const n=e.class;if(n!=null)return typeof n.selectedOption=="string"?n.selectedOption:n.classId},hEo=e=>{const n=e.project;if(n!=null)return typeof n.selectedOption=="string"?n.selectedOption:n.projectId},cD=(e,n)=>{if(n==null||!n)return;let i=[];return e.forEach(r=>{i=i.concat(r.options)}),i.find(r=>r.value===n)?.label??n},gEo=s.div`
30766
+ `,iEo=s.div``,rEo=()=>null,aEo=()=>null,lEo=()=>null,cEo=()=>null,{common:{strings:n3},expenseAutomation:{transactions:q1},transactionDetail:{lineItems:{journalEntryTable:hE,categories:dEo}}}=O.getLocalizedStrings(),hC={containerPaddingLeftRight:new w(p[3],p[3]),containerPaddingTopBottom:new w(6,6),controlHeight:new w(p[4],p[5]),nameLogoWidth:new w(p[2],p[3]),nameLogoHeight:new w(p[2],p[3]),borderRadius:6},uEo=({accountList:e,accountsHierarchyList:n,classHierarchyList:i,classList:r,columns:a,isCOTEnabled:l,isCompressed:c,isDisabled:d,isUncategorizedExpenseCategoryEnabled:u,line:m,lineIndex:x,onCOTView:h,openTooltipId:f,projects:y,searchAutoComplete:C,sectionId:b,setOpenTooltipId:E,transactionId:$,uncategorizedAccounts:R})=>{const S=t.useTheme(),k=X(),A=t.useFormContext()?.setValue,[I,B]=g.useState(!1),L=g.useMemo(()=>mEo(m),[m]),P=g.useMemo(()=>xEo(m),[m]),D=g.useMemo(()=>hEo(m),[m]),M=m.lineEntity,F=M?.qboId??M?.id??M?.name,V=M?.name,N=`${b}.${x}.lineDescription`,H=`${b}.${x}.lineEntitySelection`,W=`${b}.${x}.account`,U=`${b}.${x}.class`,Y=`${b}.${x}.project`,q=`${b}.${x}.amount.amount`,Z=I,G={control:()=>({marginLeft:-2,backgroundColor:I?S.colors.background:S.colors.grey5,minHeight:p[5]}),valueContainer:()=>({justifyContent:"flex-start",paddingLeft:p[0],height:p[5],backgroundColor:S.colors.grey5}),menu:()=>({width:"150%",background:S.colors.grey5}),singleValue:()=>({color:I||Z?S.colors.primary:S.colors.champion,paddingLeft:p[2]}),input:We=>({...We,color:I||Z?S.colors.primary:S.colors.champion,textAlign:"left",paddingLeft:p[2]}),menuPortal:We=>({...We,zIndex:10})},K={...G,singleValue:We=>({...We,color:I||Z?S.colors.primary:S.colors.champion}),menu:()=>({marginTop:p[1],marginLeft:-p[2]}),input:We=>({...We,color:I||Z?S.colors.primary:S.colors.champion,textAlign:"left",...z.standardMedium}),control:We=>({...We,height:p[5]})},J=g.useMemo(()=>m.recommendationsWithCOT??[],[m.recommendationsWithCOT]),oe=g.useMemo(()=>N9(n,J,dEo),[n,J]),ee=g.useMemo(()=>H9(i,J),[i,J]),te=g.useMemo(()=>PC(y),[y]),se=g.useMemo(()=>({customer:[],vendor:[],fetchState:"not_started"}),[]),ie=g.useMemo(()=>K5(C?.autoCompleteData?.entityAutoCompleteView??se,M,J),[C,M,J,se]),re=g.useCallback((We,nt)=>{C?.loadOptions?C.loadOptions(We,nt):nt(ie)},[C,ie]),ne=cD(oe,L),me=cD(ee,P),pe=cD(te,D),je=y2("vendor",ie,F),ce=!!m.isCategoryMiscategorized||y2("category",oe,L),de=!!m.isClassMiscategorized||y2("class",ee,P),ue=!L||R!=null&&typeof L=="string"&&Q.isAccountUncategorized(R,L,u===!0?["income"]:void 0),[le,ae]=g.useState(ue),[ge,ye]=g.useState(!P),[he,Ce]=g.useState(!D),[we,ve]=g.useState(!F),[Ee,Se]=g.useState(!1),[$e,Be]=g.useState(!1),[Ae,_e]=g.useState(!1),[Te,Re]=g.useState(!1);g.useEffect(()=>{L&&typeof L=="string"&&R!=null&&Q.isAccountUncategorized(R,L,u===!0?["income"]:void 0)===!1?ae(!1):ae(!0)},[L,R,u]),g.useEffect(()=>{ye(!P)},[P]),g.useEffect(()=>{Ce(!D)},[D]),g.useEffect(()=>{ve(!F)},[F]);const ke=()=>{ve(!F),Se(!1)},Oe=()=>{L&&typeof L=="string"&&(R==null||Q.isAccountUncategorized(R,L,u===!0?["income"]:void 0)===!1)?ae(!1):ae(!0),Be(!1)},Me=()=>{ye(!P),_e(!1)},Ie=()=>{Ce(!D),Re(!1)},Ne=()=>{Se(!0)},Pe=()=>{Be(!0)},Qe=()=>{_e(!0)},Je=()=>{Re(!0)},tt=g.useMemo(()=>h!=null?{onCOTView:(We,nt,ut,pt)=>{h(ut,pt)}}:void 0,[h]),Ue=g.useCallback((We,nt)=>{h?.(We,nt)},[h]),dt=(We,nt)=>{if(A==null)return;let ut;switch(nt){case"vendor":ut=H;break;case"category":ut=W;break;case"class":ut=U;break;default:return}A(`${ut}.selectedOption`,We,{shouldValidate:!0,shouldDirty:!0})},ct=g.useCallback(We=>R!=null&&Q.isAccountUncategorized(R,We,u===!0?["income"]:void 0),[R,u]),yt=$??m.id,He=E??(We=>{}),jt=!1,St=(We,nt)=>{const ut=m.postingType;if(!(We==="debit"&&ut==="debit"||We==="credit"&&ut==="credit"))return t.jsxRuntimeExports.jsx(dwo,{children:hE.emptyDash});const Bt=m.amount,Ht=We==="debit"?hE.debitPrefix:hE.creditPrefix;return t.jsxRuntimeExports.jsxs(kA,{windowSize:k,isLastItem:!0,style:{justifyContent:"flex-start",width:"100%"},children:[nt&&t.jsxRuntimeExports.jsx(cwo,{children:Ht}),t.jsxRuntimeExports.jsx(gEo,{children:t.jsxRuntimeExports.jsx(Qs,{isDisabled:d??"readonly",showAdditionalInfoLabel:!1,label:{label:"",width:0},controlWidth:"100%",formattedTextField:{type:"number",name:q,defaultValue:Bt.amount,prefix:Bt.currencySymbol??"",placeholderAlignment:"left",returnValueType:"floatValue",allowNegative:!0,decimalSeparator:".",decimalScale:2,fixedDecimalScale:!0,thousandSeparator:!0,isNumericString:!1,registerOptions:{required:!1},autoComplete:"off",inputStyle:{paddingLeft:0,paddingRight:0,textAlign:"left"}},style:{minWidth:0,boxSizing:"border-box",paddingLeft:0,paddingRight:0,borderLeftWidth:0,borderRightWidth:0}},q)})]})};return t.jsxRuntimeExports.jsx(ARe,{isHovered:I,onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),"data-testid":_("journal-entry-table-row",`${b}-${x}`),children:a.map((We,nt)=>{const ut=nt===a.length-1,pt=We.key==="debit"||We.key==="credit",Bt=c===!0?We.customStyle?.quickView??We.customStyle?.cellStyle:We.customStyle?.cellStyle,$o=`${b}-${x}-${We.key}`;switch(We.key){case"description":return t.jsxRuntimeExports.jsx(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:Bt,children:t.jsxRuntimeExports.jsx(kA,{windowSize:k,isLastItem:ut,style:{width:"100%",justifyContent:"flex-start"},children:t.jsxRuntimeExports.jsx(fEo,{isCompressed:c,children:t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,showAdditionalInfoLabel:!1,label:{label:"",width:0},controlWidth:"100%",text:{name:N,type:"text",defaultValue:m.lineDescription??"",placeholder:hE.descriptionPlaceholder,options:{required:!1},style:{textAlign:"left"}},style:{minWidth:0,boxSizing:"border-box",paddingLeft:0,paddingRight:0}},N)})})},$o);case"name":return t.jsxRuntimeExports.jsxs(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:Bt,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(dD,{isCOTEnabled:l,recommendations:J,type:"vendor",isMisCategorized:je,onRecommendationClick:dt,selectedValue:F,selectedValueLabel:V,isReviewTab:jt,isAccountOptionDisabled:ct,existingOption:{label:M?.name,value:M?.qboId??M?.id},cotTracking:tt,lineId:m.id,transactionId:yt,openTooltipId:f,setOpenTooltipId:He}),t.jsxRuntimeExports.jsx(jE,{children:we===!0?t.jsxRuntimeExports.jsx(fE,{isHovered:I,isCompressed:c,children:t.jsxRuntimeExports.jsx(gE,{onClick:Tt=>{Tt.stopPropagation(),ve(!1),Se(!0)},"data-testid":_("add-vendor-button",`${b}-${x}`),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:q1.addPayee})}):Ee===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:ke,children:t.jsxRuntimeExports.jsx(vEo,{"data-testid":_("vendor-selection-dropdown-container",`${b}-${x}`),children:t.jsxRuntimeExports.jsx(TG,{name:H,placeholder:q1.addPayee,defaultValue:{selectedOption:F,defaultOptions:ie},type:"vendor",autoFocus:!we,style:{width:"100%"},pageSource:"details_page",transactionStatus:null,isOptionRemovable:!1,customStyleConfig:K,menuIsOpen:Ee,onMenuClose:ke,registerOptions:{required:!1},loadOptions:re,showCOT:l,onCOTView:Ue,menuPortal:document.body})})}):t.jsxRuntimeExports.jsx(AEo,{children:t.jsxRuntimeExports.jsx(yE,{isHovered:I,isCompressed:c,children:t.jsxRuntimeExports.jsx(REo,{onClick:Ne,"data-testid":_("vendor-name-text",`${b}-${x}`),children:M!=null&&M.name?t.jsxRuntimeExports.jsx(Xn,{text:M.name,itemTextStyle:{color:I?S.colors.primary:S.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}):t.jsxRuntimeExports.jsx(SEo,{children:n3.hyphen})})})})})]},$o);case"category":return t.jsxRuntimeExports.jsxs(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:Bt,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(dD,{isCOTEnabled:l,recommendations:J,type:"category",isReviewTab:jt,isAccountOptionDisabled:ct,isMisCategorized:ce,onRecommendationClick:dt,selectedValue:L,selectedValueLabel:ne,existingOption:{label:ne,value:L},cotTracking:tt,lineId:m.id,transactionId:yt,openTooltipId:f,setOpenTooltipId:He}),t.jsxRuntimeExports.jsx(jE,{children:le===!0?t.jsxRuntimeExports.jsx(fE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(gE,{onClick:Tt=>{Tt.stopPropagation(),ae(!1),Be(!0)},"data-testid":_("category-selection-field",`${b}-${x}`),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[q1.addCategory,t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})}):$e===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:Oe,children:t.jsxRuntimeExports.jsx(uD,{isHovered:I,"data-testid":_("category-selection-dropdown-container",`${b}-${x}`),children:t.jsxRuntimeExports.jsx(Ll,{name:W,placeholder:q1.addCategory,type:"category",pageSource:"details_page",transactionStatus:null,showCOT:l,isDisabled:d,defaultValue:{selectedOption:L,allOptions:oe},style:{display:"flex",flexGrow:1,width:"100%",cursor:"inherit"},registerOptions:{required:!1},menuIsOpen:$e,autoFocus:!le,onMenuClose:Oe,customStyleConfig:G,disableCurrentOption:ct,menuPortal:document.body,onCOTView:Ue})})}):t.jsxRuntimeExports.jsx(yE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(pD,{onClick:Pe,"data-testid":_("category-label-text",`${b}-${x}`),children:[t.jsxRuntimeExports.jsx(Xn,{text:ne??"",itemTextStyle:{color:I?S.colors.primary:S.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})})})]},$o);case"class":return t.jsxRuntimeExports.jsxs(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:Bt,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(dD,{isCOTEnabled:l,recommendations:J,type:"class",isReviewTab:jt,isAccountOptionDisabled:ct,isMisCategorized:de,onRecommendationClick:dt,selectedValue:P,selectedValueLabel:me,existingOption:{label:me,value:P},cotTracking:tt,lineId:m.id,transactionId:yt,openTooltipId:f,setOpenTooltipId:He}),t.jsxRuntimeExports.jsx(jE,{children:ge===!0?t.jsxRuntimeExports.jsx(fE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(gE,{onClick:Tt=>{Tt.stopPropagation(),ye(!1),_e(!0)},"data-testid":_("class-selection-field",`${b}-${x}`),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[q1.addClass,t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})}):Ae===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:Me,children:t.jsxRuntimeExports.jsx(uD,{isHovered:I,"data-testid":_("class-selection-dropdown-container",`${b}-${x}`),children:t.jsxRuntimeExports.jsx(Ll,{name:U,placeholder:q1.addClass,type:"class",showCOT:l,isDisabled:d,defaultValue:{selectedOption:P,allOptions:ee},pageSource:"details_page",transactionStatus:null,menuIsOpen:Ae,registerOptions:{required:!1},style:{width:"100%"},autoFocus:!ge&&!P,customStyleConfig:G,onMenuClose:Me,menuPortal:document.body,onCOTView:Ue})})}):t.jsxRuntimeExports.jsx(yE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(pD,{"data-testid":_("class-selection-field",`${b}-${x}`),onClick:Qe,children:[t.jsxRuntimeExports.jsx(Xn,{text:me??"",itemTextStyle:{color:I?S.colors.primary:S.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})})})]},$o);case"project":return t.jsxRuntimeExports.jsxs(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:Bt,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(YH,{children:t.jsxRuntimeExports.jsx("span",{})}),t.jsxRuntimeExports.jsx(jE,{children:he===!0?t.jsxRuntimeExports.jsx(fE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(gE,{onClick:Tt=>{Tt.stopPropagation(),Ce(!1),Re(!0)},"data-testid":_("project-selection-field",`${b}-${x}`),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[q1.addProject,t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})}):Te===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:Ie,children:t.jsxRuntimeExports.jsx(uD,{isHovered:I,"data-testid":_("project-selection-dropdown-container",`${b}-${x}`),children:t.jsxRuntimeExports.jsx(Ll,{name:Y,placeholder:q1.addProject,type:"project",showCOT:!1,isDisabled:d,defaultValue:{selectedOption:D,allOptions:te},pageSource:"details_page",transactionStatus:null,menuIsOpen:Te,registerOptions:{required:!1},style:{width:"100%"},autoFocus:!he&&!D,customStyleConfig:G,onMenuClose:Ie,menuPortal:document.body})})}):t.jsxRuntimeExports.jsx(yE,{isHovered:I,children:t.jsxRuntimeExports.jsxs(pD,{"data-testid":_("project-selection-field",`${b}-${x}`),onClick:Je,children:[t.jsxRuntimeExports.jsx(Xn,{text:pe??"",itemTextStyle:{color:I?S.colors.primary:S.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(T4,{children:t.jsxRuntimeExports.jsx(I4,{})})]})})})]},$o);case"debit":return t.jsxRuntimeExports.jsx(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:{marginRight:p[0],...Bt},children:St("debit",!1)},$o);case"credit":return t.jsxRuntimeExports.jsx(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:{marginRight:p[0],...Bt},children:St("credit",!1)},$o);case"amount":{const Tt=m.postingType==="credit"?"credit":"debit";return t.jsxRuntimeExports.jsx(Vd,{windowSize:k,wrapperWidth:We.width,widthPercentage:We.widthPercentage,isCompressed:c,isDividerColumn:pt,isLastItem:ut,style:{marginRight:p[0],...Bt},children:St(Tt,!0)},$o)}default:return null}})})},pEo=({columns:e,isCompressed:n})=>{const i=X();return t.jsxRuntimeExports.jsx(ARe,{"data-testid":_("journal-entry-table-empty-row","skeleton"),children:e.map((r,a)=>{const l=a===e.length-1,c=r.key==="debit"||r.key==="credit",d=n===!0?r.customStyle?.quickView??r.customStyle?.common:r.customStyle?.common;return r.key==="name"?t.jsxRuntimeExports.jsx(Vd,{windowSize:i,wrapperWidth:r.width,widthPercentage:r.widthPercentage,isCompressed:n,isDividerColumn:c,isLastItem:l,style:d,children:t.jsxRuntimeExports.jsx(kA,{windowSize:i,isLastItem:l,children:t.jsxRuntimeExports.jsxs($Eo,{children:[t.jsxRuntimeExports.jsx(xs,{width:p[4],height:p[4]}),t.jsxRuntimeExports.jsx(fe,{width:"100%",height:p[4],style:{display:"flex",alignItems:"center"}})]})})},r.key):t.jsxRuntimeExports.jsx(Vd,{windowSize:i,wrapperWidth:r.width,widthPercentage:r.widthPercentage,isCompressed:n,isDividerColumn:c,isLastItem:l,style:d,children:t.jsxRuntimeExports.jsx(kA,{windowSize:i,isLastItem:l,children:t.jsxRuntimeExports.jsx(fe,{width:"100%",height:p[4],style:{display:"flex",alignItems:"center"}})})},r.key)})})},mEo=e=>{const n=e.account;if(n==null)return;if(typeof n.selectedOption=="string")return n.selectedOption;const i=n;return i.qboId??i.accountId},xEo=e=>{const n=e.class;if(n!=null)return typeof n.selectedOption=="string"?n.selectedOption:n.classId},hEo=e=>{const n=e.project;if(n!=null)return typeof n.selectedOption=="string"?n.selectedOption:n.projectId},cD=(e,n)=>{if(n==null||!n)return;let i=[];return e.forEach(r=>{i=i.concat(r.options)}),i.find(r=>r.value===n)?.label??n},gEo=s.div`
30767
30767
  display: flex;
30768
30768
  flex: 1 1 auto;
30769
30769
  width: 100%;
@@ -31637,7 +31637,7 @@ to {
31637
31637
  height: ${o.sp3};
31638
31638
  align-items: center;
31639
31639
  justify-content: center;
31640
- `,Ga="lineInfo",w3="memo",Wy="vendorDetails",O3="updatePreviousTransactionWithNewVendor",z3="isUpdateVendorToAllLineItemsChecked",gie=e=>`${e}_form`;function YRo(e,n,i){return F$o(e,n,i)}const ha=O.getLocalizedStrings();function fie({firstMonthOfFY:e,transactionDetail:n,transactionAttachmentEndpointToDownload:i,transactionAttachmentsEndpointToFetch:r,attachmentUploadEndpoint:a,isNavBarVisible:l=!0,isDisabled:c,isCOTEnabled:d,isVendorBulkUpdateOnTransactionEnabled:u,authParams:m,trendReport:x,analytics:h,uncategorizedAccounts:f,vendorSaveStatus:y,companyId:C,companyName:b,isProjectsTransactionsEnabled:E,isTransactionCommentingEnabled:$,containerStyles:R,headerStyles:S,autoCompleteData:k,autoCompleteActions:T,enableBackClickOnSave:A,onTransactionClick:I,onBackClick:B,onTrendSelectedPeriodChange:L,onUploadAttachmentAttachment:P,onDeleteAttachment:D,onSaveUpdates:M,onResetLineItemsCategoryClassInLocalData:F,onSaveTransactionDetailLocalData:V,saveLatestSelectedEntity:N,onSaveSuccess:H,onPageRefresh:W,onUpdateAllChecked:U,onChangeCategoryClassWhenUpdateAllIsChecked:Y,discardTransactionDetailLocalData:q,onFetchRecommendationsForEntity:Z,updateVendorBulkRecommendationsFetchStatus:G,clearRecommendationForLineId:K,resetUpdateErrorState:J,onSaveVendorInLocalData:oe,onSaveCustomerInLocalData:ee,onSaveTransactionIdInNewVendorLocalData:te,onUpdateAllTranactionsWithCurrentVendorChecked:se,onClickUpdateVendorToAllLineItems:ie,onResetVendorToAllLineItems:re,setIsVendorUpdateAllChecked:ne,isAiCfoAccessEnabled:me,onAskAiCfoClick:pe,canComment:je,entityId:ce,onCreateTransferEntry:de}){const ue=g.useRef(null),le=g.useRef(null),[ae,ge]=g.useState(null),ye=mr(),Ce=Owe()??ue.current,we=g.useRef(),{useDynamicConfig:ve}=Dc(),{configValue:Ee}=ve(Fx.enableUncategorizedExpenseCategory),[Se,$e]=g.useState(!1),[Be,Ae]=g.useState("transfer"),_e=g.useCallback(ot=>{Ae(ot),$e(!0)},[]),Te=g.useCallback(()=>{$e(!1)},[]),Re=g.useCallback(ot=>{de?.(ot)},[de]),ke=g.useMemo(()=>{const ot=n;return(Be===$A?ot.creditCardTransferAccountsList:ot.transferAccounts)??[]},[Be,n]),Oe=g.useMemo(()=>n.transaction!=null?qRo(n,Be):null,[n,Be]),Me=n.createTransferEntryStatus??"Not-Started",Ie=t.useTheme(),Ne=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView)}),{vendorUpdates:Pe,vendorDetails:Ue,customerUpdates:Je,customerDetails:tt}=n.transactionDetailLocalData,Qe=Object.keys(n.transactionDetailLocalData.lineItemById)[0],[dt,ct]=g.useState(n.transaction?.attachments??[]),[yt,He]=g.useState(!1),[jt,St]=g.useState([]),[We,nt]=g.useState([]),[ut,pt]=g.useState(void 0),[Bt,Ht]=g.useState(n.transaction?.id??""),[$o,Tt]=g.useState(void 0),[Gt,so]=g.useState(!1),no=g.useContext(vs),{setOpenThread:Xe,requestToOpenThread:ft,setRequestToOpenThread:oo}=no,{threads:on,isLoading:To}=Y5();g.useEffect(()=>{if(ft?.threadId==null||To)return;on.some(Lt=>Lt.id===ft.threadId)&&(Xe(ft.threadId),oo(null))},[ft,on,To,Xe,oo]);const kn=g.useMemo(()=>({application:"dashboard",companyId:C,tab:"transaction",entityId:ce,isGlobalComment:!1}),[C,ce]),qt=g.useMemo(()=>je?on.filter(ot=>ot.resolved===!1&&!ot.id.includes($s)):[],[on,je]).length,dn=g.useCallback((ot,Lt)=>{Xe(Lt),so(!1)},[Xe,so]),Zs=g.useMemo(()=>({companyId:C??"",companyName:b??"",entityType:"transaction.details",entityId:ce,isGlobalComment:!1,application:"dashboard",tab:"transaction",url:window.location.href}),[C,b,ce]),Yn=O.getLocalizedStrings().collaboration.threads,{placeholder:Hs,tooltip:yn,title:{comments:Go}}=Yn,ds=g.useRef([]),In=(ot,Lt,Nt,qn)=>{if(Lt!==Bt||qn==null||qn==="")return;const vo=[...ds.current];let jn=vo.find(ri=>ri.lineId===ot);if(jn==null)jn={lineId:ot,category:{recommendationTypesViewed:[]},class:{recommendationTypesViewed:[]},vendor:{recommendationTypesViewed:[]},project:{recommendationTypesViewed:[]}},vo.push(jn);else{jn={...jn,category:{...jn.category,recommendationTypesViewed:[...jn.category.recommendationTypesViewed]},class:{...jn.class,recommendationTypesViewed:[...jn.class.recommendationTypesViewed]},vendor:{...jn.vendor,recommendationTypesViewed:[...jn.vendor.recommendationTypesViewed]},project:jn.project!=null?{...jn.project,recommendationTypesViewed:[...jn.project.recommendationTypesViewed]}:{recommendationTypesViewed:[]}};const ri=vo.findIndex(Hc=>Hc.lineId===ot);vo[ri]=jn}const Ln=jn[Nt];Ln!=null&&!Ln.recommendationTypesViewed.includes(qn)&&Ln.recommendationTypesViewed.push(qn),ds.current=vo},ts=n.transactionDetailUpdateStatus?.fetchState??"Not-Started",pn=X(),{common:{footer:_s},dateFormat:us}=O.getLocalizedStrings(),[js,xn]=g.useState(void 0),As=g.useRef(),nn=Ye(n.transactionDetailUpdateStatus?.fetchState),os=Ye(k.entityAutoCompleteView.fetchState),qe=Ye(n.fetchState),xt=n.transaction!=null?O$o(n.transaction?.type,Ie):void 0,Wt=!ye&&x?.trendReport?.dataAvailable!=null;g.useEffect(()=>{k.entityAutoCompleteView.fetchState==="Completed"&&we.current?.(C7e(k.entityAutoCompleteView))},[k.entityAutoCompleteView.fetchState]);const Ze=(ot,Lt)=>{bo(),T.onAutoCompleteInputChange?.(ot),we.current=Lt},Mo=async(ot,Lt)=>{if(ot.includes("lineDescription")||ot.includes(w3))return;const Nt=Object.assign({},n.transaction),qn=ot.split(".")[1];let vo=n.transactionDetailLocalData.latestSelectedEntityOnLineItem,jn,Ln=Lt.isUpdateVendorToAllLineItemsChecked;if(ot.includes(w3)===!1&&ot.includes(Wy)===!1&&ot.includes(O3)===!1&&ot.includes(z3)===!1&&ot!==Ga&&ot!=="detailTransactionType"){const et=parseInt(ot.split(".")[1]),Jt=Lt[Ga][et].id;jn=Jt;const gt=t.cloneDeep(Lt[Ga][et]);let mn=!1;if(ot.includes(lc)||ot.includes(cc)){if(ot.includes(lc)){const zt=ns(Jt,et,Lt);gt[ij]!==zt&&(gt[ij]=zt,mn=!0),gt[lc].selectedOption!=null&&gt[lc].selectedOption===gt[Eb]?.qboId&&!gt[ap]?(gt[ap]=!0,mn=!0):(gt[ap]=!1,mn=!0),gt[lc].selectedOption!=null&&gt[lc].selectedOption===gt[Rb]?.qboId&&!gt[ap]?(gt[x3]=!0,mn=!0):(gt[x3]=!1,mn=!0)}if(ot.includes(cc)&&(gt[g3]!==Vt(Jt,et,Lt)&&(gt[g3]=Vt(Jt,et,Lt),mn=!0),gt[cc].selectedOption!=null&&gt[cc].selectedOption===gt[$b]?.classId&&!gt[lp]?(gt[lp]=!0,mn=!0):(gt[lp]=!1,mn=!0),gt[cc].selectedOption!=null&&gt[cc].selectedOption===gt[vb]?.classId&&!gt[lp]?(gt[h3]=!0,mn=!0):(gt[h3]=!1,mn=!0)),gt[$g]===!0){const zt=h6(gt,n.transactionDetailLocalData,gt[rp].selectedOption,qn,k.entityAutoCompleteView);Y?.(!gt[$g],zt)}}if(ot.includes(ap))if(gt[ap]===!1){F?.({id:Nt.id,type:Nt.type},Nt,[Jt],_n(et,Jt,Lt),"account",!1);return}else gt[ap]===!0&&gt[lc].selectedOption!==gt[Eb]?.qboId&&(gt[lc].selectedOption=gt[Eb]?.qboId,gt[ij]=!0,gt[x3]=!1,mn=!0);if(ot.includes(lp))if(gt[lp]===!1){F?.({id:Nt.id,type:Nt.type},Nt,[Jt],_n(et,Jt,Lt),"class",!1);return}else gt[lp]===!0&&gt[cc].selectedOption!==gt[$b]?.classId&&(gt[cc].selectedOption=gt[$b]?.classId,gt[g3]=!0,gt[h3]=!1,mn=!0);if(ot.includes(x3)&&gt[x3]===!0&&gt[lc].selectedOption!==gt[Rb]?.qboId&&(gt[lc].selectedOption=gt[Rb]?.qboId,gt[ap]=!1,gt[ij]=!1,mn=!0),ot.includes(h3)&&gt[h3]===!0&&gt[cc].selectedOption!==gt[vb]?.classId&&(gt[cc].selectedOption=gt[vb]?.classId,gt[lp]=!1,gt[g3]=!1,mn=!0),ot.includes($g))if(gt[$g]===!0){const zt=gt[lc].selectedOption,tn=gt[cc].selectedOption,Dt=n.accountList.accounts.find(eo=>eo.qboId===zt),mo=n.classList.classes.find(eo=>eo.classId===tn);gt[g3]=!0;const to=h6(gt,n.transactionDetailLocalData,gt[rp].selectedOption,qn,k.entityAutoCompleteView);U?.(gt[$g],Dt!=null?{account:Dt,updateOrRetain:gt[ap]===!0?"update":"retain"}:void 0,mo!=null?{classBase:mo,updateOrRetain:gt[lp]===!0?"update":"retain"}:void 0,to);return}else{F?.({id:Nt.id,type:Nt.type},Nt,_n(et,Jt,Lt),[Jt],"both",!1);return}if(ot.includes(Ij)&&gt[rp].selectedOption==null){K?.({transactionId:{id:Nt.id,type:Nt.type},transaction:Nt,lineId:Jt}),mn=!0;return}if(ot.includes(Ij)&&gt[rp].selectedOption!=null&&(vo=h6(gt,n.transactionDetailLocalData,gt[rp].selectedOption,Jt,k.entityAutoCompleteView),vo!=null)){const zt={id:Nt.id,type:Nt.type};N(zt,Jt,vo),Z?.(vo,gt.amount.amount,{transactionId:{id:Nt.id,type:Nt.type},transaction:Nt,lineIds:[Jt]},!1),n.transaction!=null&&n.transactionDetailLocalData.isVendorUpdateAllChecked&&(ne(zt,n.transaction,!1),Ln=!1,mn=!0)}if(mn){const zt={...Lt};zt[Ga][et]=gt,Ne.reset(zt,{keepDefaultValues:!0,keepDirty:!0})}}const ri=et=>{const Jt=parseInt(et.split(".")[1]),gt=Lt[Ga][Jt][rp].selectedOption;if(gt==null)return!1;let mn=!1;return Lt.lineInfo.forEach((zt,tn)=>{if(Jt!==tn){const Dt=zt[rp].selectedOption;Dt!=null&&gt===Dt&&(mn=mn||zt[$g])}}),!et.includes(Ij)&&mn},Hc=et=>et!==Ga?n.transaction!=null&&(Q.isVendorTransaction(n.transaction)||Q.isCustomerTransaction(n.transaction))?et.includes(w3)===!1&&et.includes(AS)===!1:et.includes(w3)===!1&&et.includes(AS)===!1&&ri(et):!1;if(ot!==Ga&&ot!==Wy&&ot!==z3&&ot!==O3){const et=$D(Lt,n.accountList,n.classList,n.projectList.projects,k,Hc(ot),qn,n.transactionDetailLocalData,vo,jn,Ln);V?.({id:Nt.id,type:Nt.type},et)}if(ot===Wy){const et=Lt[Wy];if(et.selectedOption!==Pe?.qboId||et.selectedOption!==Je?.qboId){const Jt=et.defaultOptions,gt=et.selectedOption,mn=k.entityAutoCompleteView.vendor.find(eo=>eo.qboId===et.selectedOption),zt=Jt?.flatMap(eo=>eo.options).find(eo=>eo.value===gt)?.label,tn=k.entityAutoCompleteView.customer.find(eo=>eo.qboId===et.selectedOption),mo=n.transactionDetailLocalData.lineItemById[Qe]?.recommendationsWithCOT?.find(eo=>eo.vendor?.qboId===et.selectedOption)?.vendor,to={id:Nt.id,type:Nt.type};if(mn==null&&mo==null&&tn==null){if(te?.(to),n.transaction!=null){const eo=gt!==""&&gt!=null?gt:zt!==""&&zt!=null?zt:"",mi={name:zt??gt??"",id:eo,qboId:eo},Zo={id:eo,type:"vendor",qboId:eo,zeniId:eo,name:zt??gt??""},hs={transaction:n.transaction,transactionId:to,lineIds:n.transaction.lines?.map(ss=>ss.id)??[]};oe?.(to,mi,Zo,n.transaction.amount.amount,hs)}}else if(mn!=null&&tn==null){if(n.transaction!=null){const eo={name:mn.name,id:mn.zeniId,qboId:mn.qboId},mi={id:mn.id,type:"vendor",qboId:mn.qboId,zeniId:mn.qboId,name:mn.name},Zo={transaction:n.transaction,transactionId:to,lineIds:n.transaction.lines?.map(hs=>hs.id)??[]};oe?.(to,eo,mi,n.transaction.amount.amount,Zo)}}else if(mo?.id!=null&&mo?.qboId!=null&&tn==null){if(n.transaction!=null){const eo={name:mo.name,id:mo.id,qboId:mo.qboId},mi={id:mo.id,type:"vendor",qboId:mo.qboId,zeniId:mo.qboId,name:mo.name},Zo={transaction:n.transaction,transactionId:to,lineIds:n.transaction.lines?.map(hs=>hs.id)??[]};oe?.(to,eo,mi,n.transaction.amount.amount,Zo)}}else if(tn!=null&&n.transaction!=null){const eo={name:tn.name,id:tn.zeniId,qboId:tn.qboId},mi={id:tn.id,type:"customer",qboId:tn.qboId,zeniId:tn.qboId,name:tn.name},Zo={transaction:n.transaction,transactionId:to,lineIds:n.transaction.lines?.map(hs=>hs.id)??[]};ee?.(to,eo,mi,n.transaction.amount.amount,Zo)}}T.onCancelAutoComplete?.();return}if(ot===O3){const et=Lt[O3];se?.(et)}if(ot===z3){const et=Lt[z3],Jt=n.transactionDetailLocalData.latestSelectedEntityOnLineItem;et===!0&&n.transaction!=null&&Jt!=null?(ie?.({id:Nt.id,type:Nt.type},n.transaction,Jt),He(!0)):et===!1&&n.transactionDetailLocalData.latestUpdatedLineWithEntity!=null&&re?.({id:Nt.id,type:Nt.type},Nt,n.transactionDetailLocalData.latestUpdatedLineWithEntity)}},Lo=(ot,Lt)=>{if(ot!=null&&Lt!=null){const Nt=ot.qboId??ot.id,qn=Lt.qboId??Lt.id;return Nt===qn}return!1},_n=(ot,Lt,Nt)=>{const qn=n.transaction;if(qn!=null&&(Q.isVendorTransaction(qn)||Q.isCustomerTransaction(qn)))return Nt[Ga].filter(Ln=>Ln.id!==Lt).map(Ln=>Ln.id);const vo=h6(Nt[Ga][ot],n.transactionDetailLocalData,Nt[Ga][ot][rp].selectedOption,ot.toString(),k.entityAutoCompleteView);return vo!=null?Nt[Ga].filter((Ln,ri)=>{const Hc=h6(Ln,n.transactionDetailLocalData,Ln[rp].selectedOption,ri.toString(),k.entityAutoCompleteView);return Lo(vo,Hc)&&Ln.id!==Lt}).map(Ln=>Ln.id):[]},ns=(ot,Lt,Nt)=>!!(n.transactionDetailLocalData.lineItemById[ot].recommendationsWithCOT?.map(vo=>vo.account?.qboId)??[]).includes(Nt[Ga][Lt][lc].selectedOption),Vt=(ot,Lt,Nt)=>!!(n.transactionDetailLocalData.lineItemById[ot].recommendationsWithCOT?.map(vo=>vo.class?.classId)??[]).includes(Nt[Ga][Lt][cc].selectedOption),en=()=>{q?.(),B?.()};g.useEffect(()=>{const ot=Ne.watch((Lt,{name:Nt})=>{Nt!=null&&Lt!=null&&Nt!=null&&Lt!=null&&t.defer(()=>Mo(Nt,Lt))});return()=>{ot.unsubscribe()}}),g.useEffect(()=>()=>{q?.()},[]),g.useEffect(()=>{n.transaction&&Bt!==n.transaction?.id&&(Ht(n.transaction?.id??""),Ne.reset(mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView)))},[n,Bt,k.entityAutoCompleteView,Ne]),g.useEffect(()=>{t.isEqual(Ne.getValues(),mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView))||Ne.reset(mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView),{keepDefaultValues:!0,keepDirty:!0})},[n.transactionDetailLocalData,n.accountList,n.classList,n.transaction?.recommendationsWithCOT,k.entityAutoCompleteView,Ne]),g.useEffect(()=>{async function ot(Lt){jt.includes(Lt.attachment_id)?console.warn(`Attachment with ID ${Lt.attachment_id} is already getting downloaded`):(St([Lt.attachment_id,...jt]),await YRo(i,m,Lt),St(t.Remove(jt,Nt=>Nt==Lt.attachment_id)))}n.fetchState==="Completed"&&n.transaction!=null&&ut!=null&&(ot({transaction_key:{transaction_id:n.transaction.id,transaction_type:n.transaction.type},attachment_id:ut}),pt(void 0))},[ut]),g.useEffect(()=>{(nn==="In-Progress"||nn==="Not-Started")&&ts==="Error"?xn(ts):ts==="Completed"&&(nn==="In-Progress"||nn==="Not-Started")&&Ne.formState.isDirty&&(Ne.reset(mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView)),H?.()),ts==="Completed"&&(nn==="In-Progress"||nn==="Not-Started")&&A===!0&&B?.(),k.entityAutoCompleteView.fetchState==="Completed"&&(os==="In-Progress"||os==="Not-Started")&&Ne.reset(mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView),{keepDefaultValues:!0,keepDirty:!0})},[ts,A,Ne,H,n,nn,k,os,B]),g.useEffect(()=>{(qe==="In-Progress"||qe==="Not-Started")&&n.fetchState==="Completed"&&Ne.reset(mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView),{keepDirty:!0})},[Ne,n,n.fetchState,qe,k]),g.useEffect(()=>{n.fetchState==="Completed"&&n.transaction?.attachments!=null&&ct(n.transaction.attachments)},[n]),g.useEffect(()=>{k.entityAutoCompleteView.fetchState==="Completed"&&As.current?.(K5(k.entityAutoCompleteView,n.transactionDetailLocalData.selectedEntity??n.transactionDetailLocalData.latestSelectedEntityOnLineItem,n.transactionDetailLocalData.lineItemById[Qe]?.recommendationsWithCOT))},[k.entityAutoCompleteView.fetchState]);const On=(ot,Lt)=>{JRo(ot,h,Lt,x?.trendReport?.entity,n.transaction),L?.(Lt)},$t=Ne.handleSubmit(ot=>{const Nt=$D(ot,n.accountList,n.classList,n.projectList.projects,k,!1,void 0,n.transactionDetailLocalData);if(n.transaction!=null){h?.trackTransactionDetailsSave(n.transaction.account?.accountId,n.transaction.account?.accountName,n.transaction.id,void 0,n.transaction.type,Q.getChangedLineItemCountFromLocalData(n.transaction,Nt),Nt.memo,n.transaction.attachments?.map(jn=>jn.fileName)),V?.({id:n.transaction.id,type:n.transaction.type},Nt);const qn=Nt.vendorDetails?.id!=null&&Nt.vendorDetails?.id===Nt.vendorUpdates?.id&&Nt.vendorDetails?.name!==Nt.vendorUpdates?.name,vo=ds.current;M?.({id:n.transaction.id,type:n.transaction.type},vo,Pe?.id,qn),ds.current=[]}}),bo=()=>{if(n.transaction!=null){const ot=Ne.getValues(),Lt=$D(ot,n.accountList,n.classList,n.projectList.projects,k,!1,void 0,n.transactionDetailLocalData);V?.({id:n.transaction.id,type:n.transaction.type},Lt)}};async function mt(ot,Lt,Nt,qn,vo,jn){nt([jn.toString()]),await QRe(ot,Lt,Nt,qn,vo).then(({uploadResponse:Ln})=>{if(Ln!=null&&n.transaction!==void 0){const ri=Ln.transaction.attachments;Array.isArray(ri)&&ri[0]!=null?(ct([Q.toAttachment(ri[0])]),P(Ln.transaction)):console.warn("Upload attachment response has no attachments; skipping update.")}}),nt(t.Remove(We,Ln=>Ln==jn.toString()))}const Qt=n.fetchState==="In-Progress"||n.fetchState==="Not-Started",wt={onOkClick:()=>{xn(void 0),Ne.reset(),J?.()},onRefresh:()=>{xn(void 0),Ne.reset(),J?.(),W?.()}},Kt=ot=>{n.transaction!=null&&oe?.({id:n.transaction.id,type:n.transaction.type},{name:ot,id:Ue?.id,qboId:Ue?.qboId})},ks=ot=>{n.transaction!=null&&ee?.({id:n.transaction.id,type:n.transaction.type},{name:ot,id:tt?.id,qboId:tt?.qboId})},_o=()=>!!(Ne.formState.isDirty&&Object.keys(Ne.formState.dirtyFields).length>0||Pe?.id!==Ue?.id||Pe?.name!==Ue?.name||Je?.id!==tt?.id||Je?.name!==tt?.name),Ct=(ot,Lt)=>{bo(),T.onAutoCompleteInputChange?.(ot),As.current=Lt},Ot={defaultOptions:lRo(Pe?.qboId,Pe?.name,k?.entityAutoCompleteView),selectedOption:Pe?.qboId!=null?Pe?.qboId:Pe?.name!=null&&Pe?.name!==""?Pe?.name:""},Yo=()=>{const ot=n.transactionDetailLocalData.latestSelectedEntityOnLineItem;if(ot!=null&&n.transaction!=null){const Lt=n.transaction.lines?.map(Nt=>Nt.id);G({id:n.transaction.id,type:n.transaction.type},"In-Progress"),Z?.(ot,n.transaction.lines?.[0].amount.amount??0,{transactionId:{id:n.transaction.id,type:n.transaction.type},transaction:n.transaction,lineIds:Lt??[]},!0)}},Mt=()=>{n.transaction!=null&&n.transactionDetailLocalData.latestUpdatedLineWithEntity!=null&&re?.({id:n.transaction.id,type:n.transaction.type},n.transaction,n.transactionDetailLocalData.latestUpdatedLineWithEntity)},fo=()=>{n.transaction!=null&&G({id:n.transaction.id,type:n.transaction.type},"Not-Started")};return t.jsxRuntimeExports.jsx(FRo,{ref:ue,style:R,"data-testid":_("transaction-detail-page"),children:t.jsxRuntimeExports.jsxs(Nu.Provider,{value:no,children:[t.jsxRuntimeExports.jsx(v0,{sharedItems:{sharedFunctions:void 0,sharedRef:{contentWrapperRef:ae}},children:t.jsxRuntimeExports.jsxs(HRo,{children:[t.jsxRuntimeExports.jsx(WRo,{children:t.jsxRuntimeExports.jsx(NRo,{ref:ge,children:t.jsxRuntimeExports.jsxs(t.FormProvider,{...Ne,children:[t.jsxRuntimeExports.jsx(QRo,{id:gie(MK),ref:le,onSubmit:$t,children:Qt===!1&&n.transaction!=null?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[l?t.jsxRuntimeExports.jsx(Rt,{title:PG(n.transaction,Pe?.name),onBackClick:en,style:{zIndex:3},backgroundColor:Ie.colors.grey5,enableTitleOnScroll:!0,scrollableContent:le,rightSideComponent:t.jsxRuntimeExports.jsxs(ii,{style:{gap:o.sp4},children:[je&&!Gt?t.jsxRuntimeExports.jsxs(URo,{"data-testid":_("transaction-comment-button"),onClick:ot=>{ot.preventDefault(),ot.stopPropagation(),so(!0)},children:[t.jsxRuntimeExports.jsx(Br,{count:To?void 0:qt,isLoading:To,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(GRo,{})]}):null,me===!0&&pe!=null&&t.jsxRuntimeExports.jsx(ms,{dataTestId:"transaction-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:me,onAskAiCfoClick:pe})]}),source:"TransactionDetailPage"}):null,js==="Error"?t.jsxRuntimeExports.jsx(ERo,{errorCode:n.transactionDetailUpdateStatus?.error!==void 0?n.transactionDetailUpdateStatus?.error.code:500,action:wt,transactionDate:n.transaction?.date.format(us.visual.MMMYYYYFormat)}):null,yt?t.jsxRuntimeExports.jsx(BRo,{recommendationsBuildStatus:n.transactionDetailLocalData.vendorBulkUpdateCategoryClassRecommendationsFetchStatus?.fetchState,fetchRecommendations:Yo,setShowVendorRecommendationsBuildPopup:He,clearVendorName:Mt,clearUpdateVendorBulkRecommendationsFetchStatus:fo}):null,n.transaction.isUpdatingTransaction===!0||n.isUpdateNotAllowed===!0?t.jsxRuntimeExports.jsx(vRo,{}):null,t.jsxRuntimeExports.jsx(hRo,{isQuickViewMode:ye,vendorDetailsSectionId:Wy,transaction:n.transaction,existingVendor:Ue,existingCustomer:tt,isCOTEnabled:d,selectedEntity:n.transactionDetailLocalData.selectedEntity,headerStyles:S,vendorSearchAutoComplete:{autoCompleteData:k,loadOptions:Ct},handleVendorRename:Kt,handleCustomerRename:ks,currentVendorOption:Ot,recommendationsWithCOT:n.transactionDetailLocalData.lineItemById[Qe]?.recommendationsWithCOT,cotTracking:{lineId:Qe,transactionId:Bt,onCOTView:In},openTooltipId:$o,setOpenTooltipId:Tt,onTransactionTypeChangeToTransfer:de!=null?_e:void 0}),t.jsxRuntimeExports.jsxs(hie,{children:[t.jsxRuntimeExports.jsxs(hie,{children:[t.jsxRuntimeExports.jsx(D$o,{containerRef:Ce,transaction:n.transaction,accountList:n.accountList.accounts,accountsHierarchyList:n.accountsHierarchyList,classHierarchyList:n.classHierarchyList,classList:n.classList.classes,projects:n.projectList.projects,isAccountingClassesEnabled:n.isAccountingClassesEnabled,isAccountingProjectsEnabled:n.isAccountingProjectsEnabled,isProjectsTransactionsEnabled:E===!0,sectionId:Ga,isDisabled:c,isCOTEnabled:d,lineItemsLocalData:n.transactionDetailLocalData,uncategorizedAccounts:f,searchAutoComplete:{autoCompleteData:k,loadOptions:Ze,autoCompleteActions:T},cotTracking:{transactionId:Bt,onCOTView:In},openTooltipId:$o,setOpenTooltipId:Tt,isUncategorizedExpenseCategoryEnabled:Ee?.uncategorized_expense_category_enabled===!0,isQuickViewMode:ye,isTransactionCommentingEnabled:$,entityId:ce}),t.jsxRuntimeExports.jsx(wmt,{isQuickViewMode:ye,transaction:n.transaction,deleteStatusByAttachmentName:n.deleteStatusByAttachmentName,memo:n.transactionDetailLocalData.memo,attachments:dt,sectionId:w3,attachmentIdsBeingDownloaded:jt,attachmentIdsBeingUploaded:We,isDisabled:c,authParams:m,onDeleteAttachment:ot=>{bo(),D(ot)},transactionAttachmentsEndpointToFetch:r,onAttachmentClick:ot=>{XRo(ot.id,h,n.transaction),pt(ot.id)},onUploadAttachment:(ot,Lt,Nt,qn)=>{bo(),evo(h,n.transaction,Lt,ot.type),mt(a,m,ot,Lt,Nt,qn)},isTransactionCommentingEnabled:$,entityId:ce})]}),!ye&&n.linkedTransactions.length>0&&t.jsxRuntimeExports.jsx(M$o,{sectionId:Ga,linkedTransactions:n.linkedTransactions,onTransactionClick:I})]}),Wt&&t.jsxRuntimeExports.jsx($G,{firstMonthOfFY:e,isAccountingClassesEnabled:n.isAccountingClassesEnabled,trendWithTransactionsReport:x,isDetailPage:!0,graphColor:xt,page:"TransactionDetailPage",onTimePeriodChange:On,onTransactionItemClick:I})]}):t.jsxRuntimeExports.jsx(j9e,{isQuickViewMode:ye})}),_o()?t.jsxRuntimeExports.jsx(_t,{formId:gie(MK),primaryBtn:{label:_s.save,isLoading:ts==="In-Progress"||y==="In-Progress",style:{width:xie.buttonWidth.value(pn)},isDisabled:n.hasInFlightCategoryClassRecommendations===!0},cancelBtn:{label:_s.cancel,style:{width:xie.buttonWidth.value(pn)},onClick:()=>{Ne.reset(),q?.()}},topComponent:ZRo(n,u)===!0?KRo(Ie,n):null,style:{flexShrink:0,position:"relative"}}):null]})})}),de!=null&&Se===!0?t.jsxRuntimeExports.jsx(VRo,{children:t.jsxRuntimeExports.jsx(mRe,{createTransferEntryStatus:Me,transaction:Oe,transferAccounts:ke,onClose:Te,onCreateTransfer:Re})}):null]})}),je?t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:Gt,syncsAppMainMargin:ye!==!0,allowComposer:!0,drawerTitle:Go,threads:on,filter:kn,autoExpand:!0,autoFocus:!1,isLoading:To,textOverrides:{composerPlaceholder:Hs.addANewComment,replyComposerPlaceholder:Hs.replyAComment,threadResolve:yn.resolveComment,threadUnResolve:yn.unResolveComment},threadMetadata:Zs,onThreadClick:dn,onCloseAllThreadsDrawer:()=>so(!1),drawerSectionStyle:{width:pn==="small"?"100%":"400px",boxSizing:pn==="small"?"border-box":"content-box",backgroundColor:Ie.colors.background},collapsibleThreadStyle:{width:pn==="small"?"100%":"360px"}}):null]})})}function URe(e){const n=e.transactionDetail.transaction?.id,i=e.isTransactionCommentingEnabled===!0&&n!=null&&e.companyId!=null,r=i?Vu(n):"";if(!i)return t.jsxRuntimeExports.jsx(fie,{...e,canComment:!1,entityId:r});const a=`dashboard_${e.companyId}`;return t.jsxRuntimeExports.jsx(q5,{roomId:a,filter:{application:"dashboard",companyId:e.companyId,entityId:r,tab:"transaction",isGlobalComment:!1},children:t.jsxRuntimeExports.jsx(fie,{...e,canComment:!0,entityId:r})})}function qRo(e,n){const i=e.transaction;if(i==null)return null;const r=e.transactionDetailLocalData,a=i.lines?.[0]?.id,l=a!=null?r.lineItemById[a]:void 0,c=i;return{transactionId:i.id,transactionType:n,sourceTransactionType:i.type,payee:r.vendorDetails?.name??i.vendorName??"",category:l?.account?.accountName??"",className:l?.class?.className??"",amount:i.amount,debitAccountIntegrationId:c.qboAccountId??"",debitAccountName:c.qboAccountName??"",memo:i.memo??""}}const ZRo=(e,n)=>{const{vendorUpdates:i,vendorDetails:r}=e.transactionDetailLocalData,a=GRe(e.transactionDetailLocalData);return r?.id!=null&&i?.id!=null&&r.id!==i.id||r?.id!=null&&i?.id!=null&&r.name!==i.name||n&&a},KRo=(e,n)=>{const{vendorUpdates:i,vendorDetails:r}=n.transactionDetailLocalData,a=r?.id!=null&&r.id!==i?.id,l=GRe(n.transactionDetailLocalData),c=n.transactionDetailLocalData.latestSelectedEntityOnLineItem;return t.jsxRuntimeExports.jsxs(tvo,{children:[l&&c!=null?t.jsxRuntimeExports.jsx(SA,{style:{width:"auto"},label:{label:t.jsxRuntimeExports.jsxs(RD,{children:[ha.common.texts.update,ha.common.strings.space,c.type,ha.common.strings.space,ha.common.texts.name.toLocaleLowerCase(),ha.common.strings.space,t.jsxRuntimeExports.jsx(EE,{children:t.jsxRuntimeExports.jsx(W6,{children:c.name})}),ha.transactionDetail.footer.forAllLineItems]}),style:{color:e.colors.primary}},checkBoxField:{defaultChecked:n.transactionDetailLocalData.isVendorUpdateAllChecked??!1,name:z3,checkBoxValue:z3}}):a===!0?t.jsxRuntimeExports.jsx(SA,{style:{width:"auto"},label:{label:t.jsxRuntimeExports.jsxs(RD,{children:[ha.transactionDetail.footer.allTransactions,t.jsxRuntimeExports.jsx(EE,{children:t.jsxRuntimeExports.jsx(W6,{children:n.transactionDetailLocalData.vendorDetails?.name??ha.common.strings.empty})}),ha.transactionDetail.footer.willUpdate,t.jsxRuntimeExports.jsx(EE,{children:t.jsxRuntimeExports.jsx(W6,{children:n.transactionDetailLocalData.vendorUpdates?.name??ha.common.strings.empty})}),ha.transactionDetail.footer.postBookCloseData,`${n?.transaction?.bookCloseDate?.format(ha.dateFormat.visual.MMMDCommaYYYYformat)}
31640
+ `,Ga="lineInfo",w3="memo",Wy="vendorDetails",O3="updatePreviousTransactionWithNewVendor",z3="isUpdateVendorToAllLineItemsChecked",gie=e=>`${e}_form`;function YRo(e,n,i){return F$o(e,n,i)}const ha=O.getLocalizedStrings();function fie({firstMonthOfFY:e,transactionDetail:n,transactionAttachmentEndpointToDownload:i,transactionAttachmentsEndpointToFetch:r,attachmentUploadEndpoint:a,isNavBarVisible:l=!0,isDisabled:c,isCOTEnabled:d,isVendorBulkUpdateOnTransactionEnabled:u,authParams:m,trendReport:x,analytics:h,uncategorizedAccounts:f,vendorSaveStatus:y,companyId:C,companyName:b,isProjectsTransactionsEnabled:E,isTransactionCommentingEnabled:$,containerStyles:R,headerStyles:S,autoCompleteData:k,autoCompleteActions:T,enableBackClickOnSave:A,onTransactionClick:I,onBackClick:B,onTrendSelectedPeriodChange:L,onUploadAttachmentAttachment:P,onDeleteAttachment:D,onSaveUpdates:M,onResetLineItemsCategoryClassInLocalData:F,onSaveTransactionDetailLocalData:V,saveLatestSelectedEntity:N,onSaveSuccess:H,onPageRefresh:W,onUpdateAllChecked:U,onChangeCategoryClassWhenUpdateAllIsChecked:Y,discardTransactionDetailLocalData:q,onFetchRecommendationsForEntity:Z,updateVendorBulkRecommendationsFetchStatus:G,clearRecommendationForLineId:K,resetUpdateErrorState:J,onSaveVendorInLocalData:oe,onSaveCustomerInLocalData:ee,onSaveTransactionIdInNewVendorLocalData:te,onUpdateAllTranactionsWithCurrentVendorChecked:se,onClickUpdateVendorToAllLineItems:ie,onResetVendorToAllLineItems:re,setIsVendorUpdateAllChecked:ne,isAiCfoAccessEnabled:me,onAskAiCfoClick:pe,canComment:je,entityId:ce,onCreateTransferEntry:de}){const ue=g.useRef(null),le=g.useRef(null),[ae,ge]=g.useState(null),ye=mr(),Ce=Owe()??ue.current,we=g.useRef(),{useDynamicConfig:ve}=Dc(),{configValue:Ee}=ve(Fx.enableUncategorizedExpenseCategory),[Se,$e]=g.useState(!1),[Be,Ae]=g.useState("transfer"),_e=g.useCallback(ot=>{Ae(ot),$e(!0)},[]),Te=g.useCallback(()=>{$e(!1)},[]),Re=g.useCallback(ot=>{de?.(ot)},[de]),ke=g.useMemo(()=>{const ot=n;return(Be===$A?ot.creditCardTransferAccountsList:ot.transferAccounts)??[]},[Be,n]),Oe=g.useMemo(()=>n.transaction!=null?qRo(n,Be):null,[n,Be]),Me=n.createTransferEntryStatus??"Not-Started",Ie=t.useTheme(),Ne=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView)}),{vendorUpdates:Pe,vendorDetails:Qe,customerUpdates:Je,customerDetails:tt}=n.transactionDetailLocalData,Ue=Object.keys(n.transactionDetailLocalData.lineItemById)[0],[dt,ct]=g.useState(n.transaction?.attachments??[]),[yt,He]=g.useState(!1),[jt,St]=g.useState([]),[We,nt]=g.useState([]),[ut,pt]=g.useState(void 0),[Bt,Ht]=g.useState(n.transaction?.id??""),[$o,Tt]=g.useState(void 0),[Gt,so]=g.useState(!1),no=g.useContext(vs),{setOpenThread:Xe,requestToOpenThread:ft,setRequestToOpenThread:oo}=no,{threads:on,isLoading:To}=Y5();g.useEffect(()=>{if(ft?.threadId==null||To)return;on.some(Lt=>Lt.id===ft.threadId)&&(Xe(ft.threadId),oo(null))},[ft,on,To,Xe,oo]);const kn=g.useMemo(()=>({application:"dashboard",companyId:C,tab:"transaction",entityId:ce,isGlobalComment:!1}),[C,ce]),qt=g.useMemo(()=>je?on.filter(ot=>ot.resolved===!1&&!ot.id.includes($s)):[],[on,je]).length,dn=g.useCallback((ot,Lt)=>{Xe(Lt),so(!1)},[Xe,so]),Zs=g.useMemo(()=>({companyId:C??"",companyName:b??"",entityType:"transaction.details",entityId:ce,isGlobalComment:!1,application:"dashboard",tab:"transaction",url:window.location.href}),[C,b,ce]),Yn=O.getLocalizedStrings().collaboration.threads,{placeholder:Hs,tooltip:yn,title:{comments:Go}}=Yn,ds=g.useRef([]),In=(ot,Lt,Nt,qn)=>{if(Lt!==Bt||qn==null||qn==="")return;const vo=[...ds.current];let jn=vo.find(ri=>ri.lineId===ot);if(jn==null)jn={lineId:ot,category:{recommendationTypesViewed:[]},class:{recommendationTypesViewed:[]},vendor:{recommendationTypesViewed:[]},project:{recommendationTypesViewed:[]}},vo.push(jn);else{jn={...jn,category:{...jn.category,recommendationTypesViewed:[...jn.category.recommendationTypesViewed]},class:{...jn.class,recommendationTypesViewed:[...jn.class.recommendationTypesViewed]},vendor:{...jn.vendor,recommendationTypesViewed:[...jn.vendor.recommendationTypesViewed]},project:jn.project!=null?{...jn.project,recommendationTypesViewed:[...jn.project.recommendationTypesViewed]}:{recommendationTypesViewed:[]}};const ri=vo.findIndex(Hc=>Hc.lineId===ot);vo[ri]=jn}const Ln=jn[Nt];Ln!=null&&!Ln.recommendationTypesViewed.includes(qn)&&Ln.recommendationTypesViewed.push(qn),ds.current=vo},ts=n.transactionDetailUpdateStatus?.fetchState??"Not-Started",pn=X(),{common:{footer:_s},dateFormat:us}=O.getLocalizedStrings(),[js,xn]=g.useState(void 0),As=g.useRef(),nn=Ye(n.transactionDetailUpdateStatus?.fetchState),os=Ye(k.entityAutoCompleteView.fetchState),qe=Ye(n.fetchState),xt=n.transaction!=null?O$o(n.transaction?.type,Ie):void 0,Wt=!ye&&x?.trendReport?.dataAvailable!=null;g.useEffect(()=>{k.entityAutoCompleteView.fetchState==="Completed"&&we.current?.(C7e(k.entityAutoCompleteView))},[k.entityAutoCompleteView.fetchState]);const Ze=(ot,Lt)=>{bo(),T.onAutoCompleteInputChange?.(ot),we.current=Lt},Mo=async(ot,Lt)=>{if(ot.includes("lineDescription")||ot.includes(w3))return;const Nt=Object.assign({},n.transaction),qn=ot.split(".")[1];let vo=n.transactionDetailLocalData.latestSelectedEntityOnLineItem,jn,Ln=Lt.isUpdateVendorToAllLineItemsChecked;if(ot.includes(w3)===!1&&ot.includes(Wy)===!1&&ot.includes(O3)===!1&&ot.includes(z3)===!1&&ot!==Ga&&ot!=="detailTransactionType"){const et=parseInt(ot.split(".")[1]),Jt=Lt[Ga][et].id;jn=Jt;const gt=t.cloneDeep(Lt[Ga][et]);let mn=!1;if(ot.includes(lc)||ot.includes(cc)){if(ot.includes(lc)){const zt=ns(Jt,et,Lt);gt[ij]!==zt&&(gt[ij]=zt,mn=!0),gt[lc].selectedOption!=null&&gt[lc].selectedOption===gt[Eb]?.qboId&&!gt[ap]?(gt[ap]=!0,mn=!0):(gt[ap]=!1,mn=!0),gt[lc].selectedOption!=null&&gt[lc].selectedOption===gt[Rb]?.qboId&&!gt[ap]?(gt[x3]=!0,mn=!0):(gt[x3]=!1,mn=!0)}if(ot.includes(cc)&&(gt[g3]!==Vt(Jt,et,Lt)&&(gt[g3]=Vt(Jt,et,Lt),mn=!0),gt[cc].selectedOption!=null&&gt[cc].selectedOption===gt[$b]?.classId&&!gt[lp]?(gt[lp]=!0,mn=!0):(gt[lp]=!1,mn=!0),gt[cc].selectedOption!=null&&gt[cc].selectedOption===gt[vb]?.classId&&!gt[lp]?(gt[h3]=!0,mn=!0):(gt[h3]=!1,mn=!0)),gt[$g]===!0){const zt=h6(gt,n.transactionDetailLocalData,gt[rp].selectedOption,qn,k.entityAutoCompleteView);Y?.(!gt[$g],zt)}}if(ot.includes(ap))if(gt[ap]===!1){F?.({id:Nt.id,type:Nt.type},Nt,[Jt],_n(et,Jt,Lt),"account",!1);return}else gt[ap]===!0&&gt[lc].selectedOption!==gt[Eb]?.qboId&&(gt[lc].selectedOption=gt[Eb]?.qboId,gt[ij]=!0,gt[x3]=!1,mn=!0);if(ot.includes(lp))if(gt[lp]===!1){F?.({id:Nt.id,type:Nt.type},Nt,[Jt],_n(et,Jt,Lt),"class",!1);return}else gt[lp]===!0&&gt[cc].selectedOption!==gt[$b]?.classId&&(gt[cc].selectedOption=gt[$b]?.classId,gt[g3]=!0,gt[h3]=!1,mn=!0);if(ot.includes(x3)&&gt[x3]===!0&&gt[lc].selectedOption!==gt[Rb]?.qboId&&(gt[lc].selectedOption=gt[Rb]?.qboId,gt[ap]=!1,gt[ij]=!1,mn=!0),ot.includes(h3)&&gt[h3]===!0&&gt[cc].selectedOption!==gt[vb]?.classId&&(gt[cc].selectedOption=gt[vb]?.classId,gt[lp]=!1,gt[g3]=!1,mn=!0),ot.includes($g))if(gt[$g]===!0){const zt=gt[lc].selectedOption,tn=gt[cc].selectedOption,Dt=n.accountList.accounts.find(eo=>eo.qboId===zt),mo=n.classList.classes.find(eo=>eo.classId===tn);gt[g3]=!0;const to=h6(gt,n.transactionDetailLocalData,gt[rp].selectedOption,qn,k.entityAutoCompleteView);U?.(gt[$g],Dt!=null?{account:Dt,updateOrRetain:gt[ap]===!0?"update":"retain"}:void 0,mo!=null?{classBase:mo,updateOrRetain:gt[lp]===!0?"update":"retain"}:void 0,to);return}else{F?.({id:Nt.id,type:Nt.type},Nt,_n(et,Jt,Lt),[Jt],"both",!1);return}if(ot.includes(Ij)&&gt[rp].selectedOption==null){K?.({transactionId:{id:Nt.id,type:Nt.type},transaction:Nt,lineId:Jt}),mn=!0;return}if(ot.includes(Ij)&&gt[rp].selectedOption!=null&&(vo=h6(gt,n.transactionDetailLocalData,gt[rp].selectedOption,Jt,k.entityAutoCompleteView),vo!=null)){const zt={id:Nt.id,type:Nt.type};N(zt,Jt,vo),Z?.(vo,gt.amount.amount,{transactionId:{id:Nt.id,type:Nt.type},transaction:Nt,lineIds:[Jt]},!1),n.transaction!=null&&n.transactionDetailLocalData.isVendorUpdateAllChecked&&(ne(zt,n.transaction,!1),Ln=!1,mn=!0)}if(mn){const zt={...Lt};zt[Ga][et]=gt,Ne.reset(zt,{keepDefaultValues:!0,keepDirty:!0})}}const ri=et=>{const Jt=parseInt(et.split(".")[1]),gt=Lt[Ga][Jt][rp].selectedOption;if(gt==null)return!1;let mn=!1;return Lt.lineInfo.forEach((zt,tn)=>{if(Jt!==tn){const Dt=zt[rp].selectedOption;Dt!=null&&gt===Dt&&(mn=mn||zt[$g])}}),!et.includes(Ij)&&mn},Hc=et=>et!==Ga?n.transaction!=null&&(Q.isVendorTransaction(n.transaction)||Q.isCustomerTransaction(n.transaction))?et.includes(w3)===!1&&et.includes(AS)===!1:et.includes(w3)===!1&&et.includes(AS)===!1&&ri(et):!1;if(ot!==Ga&&ot!==Wy&&ot!==z3&&ot!==O3){const et=$D(Lt,n.accountList,n.classList,n.projectList.projects,k,Hc(ot),qn,n.transactionDetailLocalData,vo,jn,Ln);V?.({id:Nt.id,type:Nt.type},et)}if(ot===Wy){const et=Lt[Wy];if(et.selectedOption!==Pe?.qboId||et.selectedOption!==Je?.qboId){const Jt=et.defaultOptions,gt=et.selectedOption,mn=k.entityAutoCompleteView.vendor.find(eo=>eo.qboId===et.selectedOption),zt=Jt?.flatMap(eo=>eo.options).find(eo=>eo.value===gt)?.label,tn=k.entityAutoCompleteView.customer.find(eo=>eo.qboId===et.selectedOption),mo=n.transactionDetailLocalData.lineItemById[Ue]?.recommendationsWithCOT?.find(eo=>eo.vendor?.qboId===et.selectedOption)?.vendor,to={id:Nt.id,type:Nt.type};if(mn==null&&mo==null&&tn==null){if(te?.(to),n.transaction!=null){const eo=gt!==""&&gt!=null?gt:zt!==""&&zt!=null?zt:"",mi={name:zt??gt??"",id:eo,qboId:eo},Zo={id:eo,type:"vendor",qboId:eo,zeniId:eo,name:zt??gt??""},hs={transaction:n.transaction,transactionId:to,lineIds:n.transaction.lines?.map(ss=>ss.id)??[]};oe?.(to,mi,Zo,n.transaction.amount.amount,hs)}}else if(mn!=null&&tn==null){if(n.transaction!=null){const eo={name:mn.name,id:mn.zeniId,qboId:mn.qboId},mi={id:mn.id,type:"vendor",qboId:mn.qboId,zeniId:mn.qboId,name:mn.name},Zo={transaction:n.transaction,transactionId:to,lineIds:n.transaction.lines?.map(hs=>hs.id)??[]};oe?.(to,eo,mi,n.transaction.amount.amount,Zo)}}else if(mo?.id!=null&&mo?.qboId!=null&&tn==null){if(n.transaction!=null){const eo={name:mo.name,id:mo.id,qboId:mo.qboId},mi={id:mo.id,type:"vendor",qboId:mo.qboId,zeniId:mo.qboId,name:mo.name},Zo={transaction:n.transaction,transactionId:to,lineIds:n.transaction.lines?.map(hs=>hs.id)??[]};oe?.(to,eo,mi,n.transaction.amount.amount,Zo)}}else if(tn!=null&&n.transaction!=null){const eo={name:tn.name,id:tn.zeniId,qboId:tn.qboId},mi={id:tn.id,type:"customer",qboId:tn.qboId,zeniId:tn.qboId,name:tn.name},Zo={transaction:n.transaction,transactionId:to,lineIds:n.transaction.lines?.map(hs=>hs.id)??[]};ee?.(to,eo,mi,n.transaction.amount.amount,Zo)}}T.onCancelAutoComplete?.();return}if(ot===O3){const et=Lt[O3];se?.(et)}if(ot===z3){const et=Lt[z3],Jt=n.transactionDetailLocalData.latestSelectedEntityOnLineItem;et===!0&&n.transaction!=null&&Jt!=null?(ie?.({id:Nt.id,type:Nt.type},n.transaction,Jt),He(!0)):et===!1&&n.transactionDetailLocalData.latestUpdatedLineWithEntity!=null&&re?.({id:Nt.id,type:Nt.type},Nt,n.transactionDetailLocalData.latestUpdatedLineWithEntity)}},Lo=(ot,Lt)=>{if(ot!=null&&Lt!=null){const Nt=ot.qboId??ot.id,qn=Lt.qboId??Lt.id;return Nt===qn}return!1},_n=(ot,Lt,Nt)=>{const qn=n.transaction;if(qn!=null&&(Q.isVendorTransaction(qn)||Q.isCustomerTransaction(qn)))return Nt[Ga].filter(Ln=>Ln.id!==Lt).map(Ln=>Ln.id);const vo=h6(Nt[Ga][ot],n.transactionDetailLocalData,Nt[Ga][ot][rp].selectedOption,ot.toString(),k.entityAutoCompleteView);return vo!=null?Nt[Ga].filter((Ln,ri)=>{const Hc=h6(Ln,n.transactionDetailLocalData,Ln[rp].selectedOption,ri.toString(),k.entityAutoCompleteView);return Lo(vo,Hc)&&Ln.id!==Lt}).map(Ln=>Ln.id):[]},ns=(ot,Lt,Nt)=>!!(n.transactionDetailLocalData.lineItemById[ot].recommendationsWithCOT?.map(vo=>vo.account?.qboId)??[]).includes(Nt[Ga][Lt][lc].selectedOption),Vt=(ot,Lt,Nt)=>!!(n.transactionDetailLocalData.lineItemById[ot].recommendationsWithCOT?.map(vo=>vo.class?.classId)??[]).includes(Nt[Ga][Lt][cc].selectedOption),en=()=>{q?.(),B?.()};g.useEffect(()=>{const ot=Ne.watch((Lt,{name:Nt})=>{Nt!=null&&Lt!=null&&Nt!=null&&Lt!=null&&t.defer(()=>Mo(Nt,Lt))});return()=>{ot.unsubscribe()}}),g.useEffect(()=>()=>{q?.()},[]),g.useEffect(()=>{n.transaction&&Bt!==n.transaction?.id&&(Ht(n.transaction?.id??""),Ne.reset(mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView)))},[n,Bt,k.entityAutoCompleteView,Ne]),g.useEffect(()=>{t.isEqual(Ne.getValues(),mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView))||Ne.reset(mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView),{keepDefaultValues:!0,keepDirty:!0})},[n.transactionDetailLocalData,n.accountList,n.classList,n.transaction?.recommendationsWithCOT,k.entityAutoCompleteView,Ne]),g.useEffect(()=>{async function ot(Lt){jt.includes(Lt.attachment_id)?console.warn(`Attachment with ID ${Lt.attachment_id} is already getting downloaded`):(St([Lt.attachment_id,...jt]),await YRo(i,m,Lt),St(t.Remove(jt,Nt=>Nt==Lt.attachment_id)))}n.fetchState==="Completed"&&n.transaction!=null&&ut!=null&&(ot({transaction_key:{transaction_id:n.transaction.id,transaction_type:n.transaction.type},attachment_id:ut}),pt(void 0))},[ut]),g.useEffect(()=>{(nn==="In-Progress"||nn==="Not-Started")&&ts==="Error"?xn(ts):ts==="Completed"&&(nn==="In-Progress"||nn==="Not-Started")&&Ne.formState.isDirty&&(Ne.reset(mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView)),H?.()),ts==="Completed"&&(nn==="In-Progress"||nn==="Not-Started")&&A===!0&&B?.(),k.entityAutoCompleteView.fetchState==="Completed"&&(os==="In-Progress"||os==="Not-Started")&&Ne.reset(mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView),{keepDefaultValues:!0,keepDirty:!0})},[ts,A,Ne,H,n,nn,k,os,B]),g.useEffect(()=>{(qe==="In-Progress"||qe==="Not-Started")&&n.fetchState==="Completed"&&Ne.reset(mf(n.transactionDetailLocalData,n.accountsHierarchyList,n.classHierarchyList,n.projectList.projects,k.entityAutoCompleteView),{keepDirty:!0})},[Ne,n,n.fetchState,qe,k]),g.useEffect(()=>{n.fetchState==="Completed"&&n.transaction?.attachments!=null&&ct(n.transaction.attachments)},[n]),g.useEffect(()=>{k.entityAutoCompleteView.fetchState==="Completed"&&As.current?.(K5(k.entityAutoCompleteView,n.transactionDetailLocalData.selectedEntity??n.transactionDetailLocalData.latestSelectedEntityOnLineItem,n.transactionDetailLocalData.lineItemById[Ue]?.recommendationsWithCOT))},[k.entityAutoCompleteView.fetchState]);const On=(ot,Lt)=>{JRo(ot,h,Lt,x?.trendReport?.entity,n.transaction),L?.(Lt)},$t=Ne.handleSubmit(ot=>{const Nt=$D(ot,n.accountList,n.classList,n.projectList.projects,k,!1,void 0,n.transactionDetailLocalData);if(n.transaction!=null){h?.trackTransactionDetailsSave(n.transaction.account?.accountId,n.transaction.account?.accountName,n.transaction.id,void 0,n.transaction.type,Q.getChangedLineItemCountFromLocalData(n.transaction,Nt),Nt.memo,n.transaction.attachments?.map(jn=>jn.fileName)),V?.({id:n.transaction.id,type:n.transaction.type},Nt);const qn=Nt.vendorDetails?.id!=null&&Nt.vendorDetails?.id===Nt.vendorUpdates?.id&&Nt.vendorDetails?.name!==Nt.vendorUpdates?.name,vo=ds.current;M?.({id:n.transaction.id,type:n.transaction.type},vo,Pe?.id,qn),ds.current=[]}}),bo=()=>{if(n.transaction!=null){const ot=Ne.getValues(),Lt=$D(ot,n.accountList,n.classList,n.projectList.projects,k,!1,void 0,n.transactionDetailLocalData);V?.({id:n.transaction.id,type:n.transaction.type},Lt)}};async function mt(ot,Lt,Nt,qn,vo,jn){nt([jn.toString()]),await QRe(ot,Lt,Nt,qn,vo).then(({uploadResponse:Ln})=>{if(Ln!=null&&n.transaction!==void 0){const ri=Ln.transaction.attachments;Array.isArray(ri)&&ri[0]!=null?(ct([Q.toAttachment(ri[0])]),P(Ln.transaction)):console.warn("Upload attachment response has no attachments; skipping update.")}}),nt(t.Remove(We,Ln=>Ln==jn.toString()))}const Qt=n.fetchState==="In-Progress"||n.fetchState==="Not-Started",wt={onOkClick:()=>{xn(void 0),Ne.reset(),J?.()},onRefresh:()=>{xn(void 0),Ne.reset(),J?.(),W?.()}},Kt=ot=>{n.transaction!=null&&oe?.({id:n.transaction.id,type:n.transaction.type},{name:ot,id:Qe?.id,qboId:Qe?.qboId})},ks=ot=>{n.transaction!=null&&ee?.({id:n.transaction.id,type:n.transaction.type},{name:ot,id:tt?.id,qboId:tt?.qboId})},_o=()=>!!(Ne.formState.isDirty&&Object.keys(Ne.formState.dirtyFields).length>0||Pe?.id!==Qe?.id||Pe?.name!==Qe?.name||Je?.id!==tt?.id||Je?.name!==tt?.name),Ct=(ot,Lt)=>{bo(),T.onAutoCompleteInputChange?.(ot),As.current=Lt},Ot={defaultOptions:lRo(Pe?.qboId,Pe?.name,k?.entityAutoCompleteView),selectedOption:Pe?.qboId!=null?Pe?.qboId:Pe?.name!=null&&Pe?.name!==""?Pe?.name:""},Yo=()=>{const ot=n.transactionDetailLocalData.latestSelectedEntityOnLineItem;if(ot!=null&&n.transaction!=null){const Lt=n.transaction.lines?.map(Nt=>Nt.id);G({id:n.transaction.id,type:n.transaction.type},"In-Progress"),Z?.(ot,n.transaction.lines?.[0].amount.amount??0,{transactionId:{id:n.transaction.id,type:n.transaction.type},transaction:n.transaction,lineIds:Lt??[]},!0)}},Mt=()=>{n.transaction!=null&&n.transactionDetailLocalData.latestUpdatedLineWithEntity!=null&&re?.({id:n.transaction.id,type:n.transaction.type},n.transaction,n.transactionDetailLocalData.latestUpdatedLineWithEntity)},fo=()=>{n.transaction!=null&&G({id:n.transaction.id,type:n.transaction.type},"Not-Started")};return t.jsxRuntimeExports.jsx(FRo,{ref:ue,style:R,"data-testid":_("transaction-detail-page"),children:t.jsxRuntimeExports.jsxs(Nu.Provider,{value:no,children:[t.jsxRuntimeExports.jsx(v0,{sharedItems:{sharedFunctions:void 0,sharedRef:{contentWrapperRef:ae}},children:t.jsxRuntimeExports.jsxs(HRo,{children:[t.jsxRuntimeExports.jsx(WRo,{children:t.jsxRuntimeExports.jsx(NRo,{ref:ge,children:t.jsxRuntimeExports.jsxs(t.FormProvider,{...Ne,children:[t.jsxRuntimeExports.jsx(QRo,{id:gie(MK),ref:le,onSubmit:$t,children:Qt===!1&&n.transaction!=null?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[l?t.jsxRuntimeExports.jsx(Rt,{title:PG(n.transaction,Pe?.name),onBackClick:en,style:{zIndex:3},backgroundColor:Ie.colors.grey5,enableTitleOnScroll:!0,scrollableContent:le,rightSideComponent:t.jsxRuntimeExports.jsxs(ii,{style:{gap:o.sp4},children:[je&&!Gt?t.jsxRuntimeExports.jsxs(URo,{"data-testid":_("transaction-comment-button"),onClick:ot=>{ot.preventDefault(),ot.stopPropagation(),so(!0)},children:[t.jsxRuntimeExports.jsx(Br,{count:To?void 0:qt,isLoading:To,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(GRo,{})]}):null,me===!0&&pe!=null&&t.jsxRuntimeExports.jsx(ms,{dataTestId:"transaction-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:me,onAskAiCfoClick:pe})]}),source:"TransactionDetailPage"}):null,js==="Error"?t.jsxRuntimeExports.jsx(ERo,{errorCode:n.transactionDetailUpdateStatus?.error!==void 0?n.transactionDetailUpdateStatus?.error.code:500,action:wt,transactionDate:n.transaction?.date.format(us.visual.MMMYYYYFormat)}):null,yt?t.jsxRuntimeExports.jsx(BRo,{recommendationsBuildStatus:n.transactionDetailLocalData.vendorBulkUpdateCategoryClassRecommendationsFetchStatus?.fetchState,fetchRecommendations:Yo,setShowVendorRecommendationsBuildPopup:He,clearVendorName:Mt,clearUpdateVendorBulkRecommendationsFetchStatus:fo}):null,n.transaction.isUpdatingTransaction===!0||n.isUpdateNotAllowed===!0?t.jsxRuntimeExports.jsx(vRo,{}):null,t.jsxRuntimeExports.jsx(hRo,{isQuickViewMode:ye,vendorDetailsSectionId:Wy,transaction:n.transaction,existingVendor:Qe,existingCustomer:tt,isCOTEnabled:d,selectedEntity:n.transactionDetailLocalData.selectedEntity,headerStyles:S,vendorSearchAutoComplete:{autoCompleteData:k,loadOptions:Ct},handleVendorRename:Kt,handleCustomerRename:ks,currentVendorOption:Ot,recommendationsWithCOT:n.transactionDetailLocalData.lineItemById[Ue]?.recommendationsWithCOT,cotTracking:{lineId:Ue,transactionId:Bt,onCOTView:In},openTooltipId:$o,setOpenTooltipId:Tt,onTransactionTypeChangeToTransfer:de!=null?_e:void 0}),t.jsxRuntimeExports.jsxs(hie,{children:[t.jsxRuntimeExports.jsxs(hie,{children:[t.jsxRuntimeExports.jsx(D$o,{containerRef:Ce,transaction:n.transaction,accountList:n.accountList.accounts,accountsHierarchyList:n.accountsHierarchyList,classHierarchyList:n.classHierarchyList,classList:n.classList.classes,projects:n.projectList.projects,isAccountingClassesEnabled:n.isAccountingClassesEnabled,isAccountingProjectsEnabled:n.isAccountingProjectsEnabled,isProjectsTransactionsEnabled:E===!0,sectionId:Ga,isDisabled:c,isCOTEnabled:d,lineItemsLocalData:n.transactionDetailLocalData,uncategorizedAccounts:f,searchAutoComplete:{autoCompleteData:k,loadOptions:Ze,autoCompleteActions:T},cotTracking:{transactionId:Bt,onCOTView:In},openTooltipId:$o,setOpenTooltipId:Tt,isUncategorizedExpenseCategoryEnabled:Ee?.uncategorized_expense_category_enabled===!0,isQuickViewMode:ye,isTransactionCommentingEnabled:$,entityId:ce}),t.jsxRuntimeExports.jsx(wmt,{isQuickViewMode:ye,transaction:n.transaction,deleteStatusByAttachmentName:n.deleteStatusByAttachmentName,memo:n.transactionDetailLocalData.memo,attachments:dt,sectionId:w3,attachmentIdsBeingDownloaded:jt,attachmentIdsBeingUploaded:We,isDisabled:c,authParams:m,onDeleteAttachment:ot=>{bo(),D(ot)},transactionAttachmentsEndpointToFetch:r,onAttachmentClick:ot=>{XRo(ot.id,h,n.transaction),pt(ot.id)},onUploadAttachment:(ot,Lt,Nt,qn)=>{bo(),evo(h,n.transaction,Lt,ot.type),mt(a,m,ot,Lt,Nt,qn)},isTransactionCommentingEnabled:$,entityId:ce})]}),!ye&&n.linkedTransactions.length>0&&t.jsxRuntimeExports.jsx(M$o,{sectionId:Ga,linkedTransactions:n.linkedTransactions,onTransactionClick:I})]}),Wt&&t.jsxRuntimeExports.jsx($G,{firstMonthOfFY:e,isAccountingClassesEnabled:n.isAccountingClassesEnabled,trendWithTransactionsReport:x,isDetailPage:!0,graphColor:xt,page:"TransactionDetailPage",onTimePeriodChange:On,onTransactionItemClick:I})]}):t.jsxRuntimeExports.jsx(j9e,{isQuickViewMode:ye})}),_o()?t.jsxRuntimeExports.jsx(_t,{formId:gie(MK),primaryBtn:{label:_s.save,isLoading:ts==="In-Progress"||y==="In-Progress",style:{width:xie.buttonWidth.value(pn)},isDisabled:n.hasInFlightCategoryClassRecommendations===!0},cancelBtn:{label:_s.cancel,style:{width:xie.buttonWidth.value(pn)},onClick:()=>{Ne.reset(),q?.()}},topComponent:ZRo(n,u)===!0?KRo(Ie,n):null,style:{flexShrink:0,position:"relative"}}):null]})})}),de!=null&&Se===!0?t.jsxRuntimeExports.jsx(VRo,{children:t.jsxRuntimeExports.jsx(mRe,{createTransferEntryStatus:Me,transaction:Oe,transferAccounts:ke,onClose:Te,onCreateTransfer:Re})}):null]})}),je?t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:Gt,syncsAppMainMargin:ye!==!0,allowComposer:!0,drawerTitle:Go,threads:on,filter:kn,autoExpand:!0,autoFocus:!1,isLoading:To,textOverrides:{composerPlaceholder:Hs.addANewComment,replyComposerPlaceholder:Hs.replyAComment,threadResolve:yn.resolveComment,threadUnResolve:yn.unResolveComment},threadMetadata:Zs,onThreadClick:dn,onCloseAllThreadsDrawer:()=>so(!1),drawerSectionStyle:{width:pn==="small"?"100%":"400px",boxSizing:pn==="small"?"border-box":"content-box",backgroundColor:Ie.colors.background},collapsibleThreadStyle:{width:pn==="small"?"100%":"360px"}}):null]})})}function URe(e){const n=e.transactionDetail.transaction?.id,i=e.isTransactionCommentingEnabled===!0&&n!=null&&e.companyId!=null,r=i?Vu(n):"";if(!i)return t.jsxRuntimeExports.jsx(fie,{...e,canComment:!1,entityId:r});const a=`dashboard_${e.companyId}`;return t.jsxRuntimeExports.jsx(q5,{roomId:a,filter:{application:"dashboard",companyId:e.companyId,entityId:r,tab:"transaction",isGlobalComment:!1},children:t.jsxRuntimeExports.jsx(fie,{...e,canComment:!0,entityId:r})})}function qRo(e,n){const i=e.transaction;if(i==null)return null;const r=e.transactionDetailLocalData,a=i.lines?.[0]?.id,l=a!=null?r.lineItemById[a]:void 0,c=i;return{transactionId:i.id,transactionType:n,sourceTransactionType:i.type,payee:r.vendorDetails?.name??i.vendorName??"",category:l?.account?.accountName??"",className:l?.class?.className??"",amount:i.amount,debitAccountIntegrationId:c.qboAccountId??"",debitAccountName:c.qboAccountName??"",memo:i.memo??""}}const ZRo=(e,n)=>{const{vendorUpdates:i,vendorDetails:r}=e.transactionDetailLocalData,a=GRe(e.transactionDetailLocalData);return r?.id!=null&&i?.id!=null&&r.id!==i.id||r?.id!=null&&i?.id!=null&&r.name!==i.name||n&&a},KRo=(e,n)=>{const{vendorUpdates:i,vendorDetails:r}=n.transactionDetailLocalData,a=r?.id!=null&&r.id!==i?.id,l=GRe(n.transactionDetailLocalData),c=n.transactionDetailLocalData.latestSelectedEntityOnLineItem;return t.jsxRuntimeExports.jsxs(tvo,{children:[l&&c!=null?t.jsxRuntimeExports.jsx(SA,{style:{width:"auto"},label:{label:t.jsxRuntimeExports.jsxs(RD,{children:[ha.common.texts.update,ha.common.strings.space,c.type,ha.common.strings.space,ha.common.texts.name.toLocaleLowerCase(),ha.common.strings.space,t.jsxRuntimeExports.jsx(EE,{children:t.jsxRuntimeExports.jsx(W6,{children:c.name})}),ha.transactionDetail.footer.forAllLineItems]}),style:{color:e.colors.primary}},checkBoxField:{defaultChecked:n.transactionDetailLocalData.isVendorUpdateAllChecked??!1,name:z3,checkBoxValue:z3}}):a===!0?t.jsxRuntimeExports.jsx(SA,{style:{width:"auto"},label:{label:t.jsxRuntimeExports.jsxs(RD,{children:[ha.transactionDetail.footer.allTransactions,t.jsxRuntimeExports.jsx(EE,{children:t.jsxRuntimeExports.jsx(W6,{children:n.transactionDetailLocalData.vendorDetails?.name??ha.common.strings.empty})}),ha.transactionDetail.footer.willUpdate,t.jsxRuntimeExports.jsx(EE,{children:t.jsxRuntimeExports.jsx(W6,{children:n.transactionDetailLocalData.vendorUpdates?.name??ha.common.strings.empty})}),ha.transactionDetail.footer.postBookCloseData,`${n?.transaction?.bookCloseDate?.format(ha.dateFormat.visual.MMMDCommaYYYYformat)}
31641
31641
  .`]}),style:{color:e.colors.primary}},checkBoxField:{defaultChecked:n.transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor??!1,name:O3,checkBoxValue:O3}}):t.jsxRuntimeExports.jsxs(RD,{children:[ha.transactionDetail.footer.allTransactions,t.jsxRuntimeExports.jsx(EE,{children:t.jsxRuntimeExports.jsx(W6,{children:r?.name??ha.common.strings.empty})}),ha.transactionDetail.footer.willUpdate,t.jsxRuntimeExports.jsx("q",{children:t.jsxRuntimeExports.jsx(W6,{children:i?.name??ha.common.strings.empty})})]}),t.jsxRuntimeExports.jsx(ovo,{})]})},GRe=e=>e.latestSelectedEntityOnLineItem!=null&&e.latestSelectedEntityOnLineItem.type==="vendor",MG=e=>(Q.isCustomerTransaction(e)===!0||Q.isVendorTransactionWithCustomer(e)===!0)&&e.customer!=null?e.customer?.name??"":Q.isVendorTransaction(e)===!0&&e.vendor!=null?e.vendor?.name??"":e.memo??e.type,YRe=e=>{const n=[],i=[],r=[],a=[];return e.lines?.forEach(l=>{switch(l.type){case"transaction_with_account_and_class_line":case"transaction_with_product_or_service_line":case"journal_entry_transaction_line":{n.push(l.account.accountId),i.push(l.account.accountName);const c=l.class,d=c?.className??"";d!==""&&(a.push(d),r.push(c?.classId??""));break}}}),{accountIds:n,accountNames:i,classIds:r,classNames:a}},JRo=(e,n,i,r,a)=>{if(e==="Chart"&&i!=null&&r!=null&&a!=null){const{accountIds:l,accountNames:c,classIds:d,classNames:u}=YRe(a),m=MG(a);n?.trackSpendIncomeTrendForTransaction(r.type==="vendor"?io.Event.spendTrend:io.Event.incomeTrend,"Transaction Details",a.id,a.type,m,l,c,d,u,i?.addTimePeriod.startDate.format(ha.dateFormat.analytics.MMMYYFormat))}e==="TransactionListLoadMore"&&n?.trackTransactionList(a?.account?.accountId,a?.account?.accountName,"Transaction Details",void 0,void 0,!0)},XRo=(e,n,i)=>{if(i!=null){const{accountIds:r,accountNames:a}=YRe(i);n?.trackTransactionDetailReceipt(io.Event.transactionDetailReceiptOpened,e,i.id,MG(i),i.type,r,a)}},evo=(e,n,i,r)=>{n!=null&&e?.trackTransactionDetailReceiptUpload(n.account?.accountId,n.account?.accountName,n.id,MG(n),n.type,n.memo,i,r?.split("/")[1])},mf=(e,n,i,r,a)=>{const l=e.selectedEntity,c=Object.values(e.lineItemById).filter(m=>m.type==="journal_entry_transaction_line"||m.type==="transaction_with_account_and_class_line"||m.type==="transaction_with_product_or_service_line"),d=Object.keys(e.lineItemById)[0];return{[Ga]:c?.map(m=>({id:m.id,type:m.type,amount:m.amount,lineDetailType:m.lineDetailType,platformLineDetailType:m.platformLineDetailType,lineTransactionType:m.lineTransactionType,postingType:m.postingType,postingTypeName:m.postingTypeName,customer:m?.customer,vendor:m?.vendor,billable:m.billable,item:m.item,isCategoryMiscategorized:m.isCategoryMiscategorized,isClassMiscategorized:m.isClassMiscategorized,[lc]:{selectedOption:m?.account?.qboId??m?.account?.accountId,allOptions:N9(n,m.recommendationsWithCOT)},[cc]:{selectedOption:m?.class?.classId,allOptions:H9(i,m.recommendationsWithCOT)},[$Q]:{selectedOption:m?.project?.projectId,allOptions:PC(r)},[AS]:m?.lineDescription,[rp]:{selectedOption:m.lineEntity?.qboId??m.lineEntity?.id??m.lineEntity?.name??"",defaultOptions:b5t(m,a)},[Ij]:m.lineEntity,[Eb]:m?.recommendedAccount,[$b]:m?.recommendedClass,[ij]:m?.isRecommendedCategorySelected,[g3]:m?.isRecommendedClassSelected,[Rb]:m?.retainedAccount,[vb]:m?.retainedClass,[x3]:m?.isRetainedCategorySelected,[h3]:m?.isRetainedClassSelected,[$g]:m?.isUpdateAllChecked,[ap]:m?.isCategoryUpdateSelected,[lp]:m?.isClassUpdateSelected,[j7e]:m?.recommendationsWithCOT})),[w3]:e?.memo,[Wy]:{selectedOption:l?.qboId??l?.id??l?.name,defaultOptions:K5(a,l,e.lineItemById[d]?.recommendationsWithCOT)},[O3]:e.updatePreviousTransactionsWithUpdatedVendor,[z3]:e.isVendorUpdateAllChecked}},$D=(e,n,i,r,a,l,c,d,u,m,x)=>{const h={};return h.memo=e[w3],h.vendorUpdates=d?.vendorUpdates,h.vendorDetails=d?.vendorDetails,h.customerUpdates=d?.customerUpdates,h.customerDetails=d?.customerDetails,h.selectedEntity=d?.selectedEntity,h.updatePreviousTransactionsWithUpdatedVendor=d?.updatePreviousTransactionsWithUpdatedVendor,h.latestSelectedEntityOnLineItem=u??d?.latestSelectedEntityOnLineItem,h.latestUpdatedLineWithEntity=m??d?.latestUpdatedLineWithEntity,d!=null&&(h.isVendorUpdateAllChecked=x??d.isVendorUpdateAllChecked,h.vendorBulkUpdateCategoryClassRecommendationsFetchStatus=d?.vendorBulkUpdateCategoryClassRecommendationsFetchStatus),h.lineItemById=e.lineInfo.reduce((f,y)=>{const C=y[cc].selectedOption,b=y[lc].selectedOption,E=y[$Q]?.selectedOption,$=y[rp].selectedOption,{customerInfo:R,vendorInfo:S}=w5t(y,$,c,a.entityAutoCompleteView),k=R??S;return{...f,[y.id]:{...y,id:y.id,customer:k!=null&&k.type==="customer"?R:void 0,vendor:k!=null&&k.type==="vendor"?S:void 0,lineDescription:y[AS],lineEntity:k,isRecommendedCategorySelected:y[ij],isRecommendedClassSelected:y[g3],isCategoryUpdateSelected:y[ap],isClassUpdateSelected:y[lp],isRetainedCategorySelected:y[x3],isRetainedClassSelected:y[h3],isUpdateAllChecked:l===!0?!1:y[$g],class:C!=null?i.classes.find(T=>T.classId===C):void 0,project:E!=null?r.find(T=>T.projectId===E):void 0,account:b!=null?n.accounts.find(T=>T.qboId===b):void 0,recommendedAccount:y[Eb],recommendedClass:y[$b],retainedAccount:y[Rb],retainedClass:y[vb],recommendationsWithCOT:y[j7e]}}},{}),h},tvo=s.div`
31642
31642
  display: flex;
31643
31643
  width: fit-content;
@@ -36045,7 +36045,7 @@ to {
36045
36045
  ${e=>`${__o.infoLabel.style(e.size)}`};
36046
36046
  padding-right: ${o.sp3};
36047
36047
  text-align: right;
36048
- `,Lve=["small","medium-compact","medium-regular"],Rc={largeLabelWidth:new w(150,215,215),paddingBottom:new w(p[3],p[2]),infoMinWidth:new w(0,0,0,142,142),infoMarginRight:new w(0,0,0,p[2],p[2]),footerButtonWidth:new w(120,165),iconContainerMarginTop:new w(6,p[1]),navBarContainerPaddingTop:new w(10,p[3]),navBarContainerPaddingBottom:new w(9,p[3]),sectionTitleMarginLeft:new w(p[3],p[0]),containerPaddingLeft:new w(p[3],p[5],p[5]),containerPaddingRight:new w(p[3],p[5],p[5]),footerRightIconMarginRight:new w(p[0],p[0],p[7]),infoLabelPaddingRight:new w(p[0],p[3]),infoLabelMarginTop:new w(p[1],p[0]),paymentInfoPaddingTop:new w(p[3],p[0])},H_o={sectionTitle:new Ke("h7Medium","h7Medium")},{dateFormat:Are,common:{currency:K1,labels:kre,edit:W_o,strings:{empty:qu}},spendManagement:{billPay:V_o}}=O.getLocalizedStrings(),{billDetails:zn,paymentDetails:Ire}=V_o,Tre=({attachment:e})=>{const[n,i]=g.useState(!1),r=()=>{i(!1)},a=e.fileId?.length===0;return t.jsxRuntimeExports.jsxs(COo,{isDisabled:e.fileId?.length===0,"data-testid":_("attachment-tag",e.fileName),onClick:()=>a===!1?i(!0):null,children:[n&&e?.fileDownloadUrl!=null?t.jsxRuntimeExports.jsx(Y9,{title:e.fileName,file:e,onCrossClick:()=>r(),setShowFullScreenView:i}):null,t.jsxRuntimeExports.jsx(bOo,{children:t.jsxRuntimeExports.jsx(eC,{contentType:e.contentType})})]})},Q_o=({billDetails:e,billpayApprovalView:n,isBillPayCommentingEnabled:i,currentTenant:r,isInternationalPaymentShaVsOurEnabled:a,isLocalCurrencyEnabled:l,style:c,analytics:d,isRecurringBillsFeatureEnabled:u,isApprovalRequiredForMarkAsPaid:m,isDetectInsufficientFundsEnabled:x,billId:h,onClickEdit:f,discardBillDetailsFromLocalStore:y,saveBillDetails:C,discardOutsideZeniPaymentData:b,updateBillDetailSaveBillCode:E,redirectToBillsScreen:$,onAttachmentClick:R,retryPayment:S})=>{const k=X(),T=t.useTheme().colors,A=ht(),I={application:"dashboard",companyId:A.currentTenant?.companyId,tab:"bill",entityId:h},B=i&&h!=null,L=`dashboard_${A.currentTenant?.companyId}`,P=Rc.largeLabelWidth.value(k),D=e.saveStatus,M=e.zeniAssistRetryStatus,F=e.vendor?.vendorCurrencyCode,V=Vbe(a,l,e.billPayConfigList.filter(Me=>Me.method.includes(e.paymentDetailsSection?.withdrawFrom?.accType??"depositAccount")),e.paymentDetailsSection?.internationalTransferFeeBearerPaymentMethod,e.paymentDetailsSection?.paymentType,F),N=Are.visual.MMMDCommaYYYYformat,H={amount:e.recipientTotalAmount.amount/(e.paymentDetailsSection?.conversionRate??1)*100/100,currencyCode:K1.currencyCode,currencySymbol:K1.currencySymbol},W={amount:V?.method.includes("international")===!0?sC(H,V):e.recipientTotalAmount.amount+(V?.fee.amount??0),currencyCode:K1.currencyCode,currencySymbol:K1.currencySymbol},U={amount:V?.method.includes("international")===!0?sL(H,V):V?.fee.amount??0,currencyCode:K1.currencyCode,currencySymbol:K1.currencySymbol},[Y,q]=g.useState(!1),[Z,G]=g.useState(!1),K=()=>q(!1),J=()=>{d.trackBillPayMagicLinkPreviewEmail("review_bill"),q(!0)},oe=e.isCollectToAccountInfoFromVendorContact?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[`${zn.magicLink.collectFrom} ${e.toAccountVendorEmail}`,t.jsxRuntimeExports.jsx(fOo,{size:k,children:t.jsxRuntimeExports.jsx(gOo,{})})]}):rL(e.paymentDetailsSection?.paymentTo);g.useEffect(()=>{(D?.fetchState==="Completed"||M?.fetchState==="Completed")&&(y(),E(),$())},[D,M,$,y,E]);const ee=e.billPayInfo?.stage,te=e.billPayInfo?.billStatus,se=e.billPayInfo?.billPaymentStatus,ie=e.billPayInfo?.billPaymentRefundStatus,ne=ee?.code==="paid"?ee:te?.code=="approved"&&se?.code?se:te,me=e.billPayInfo?.isRefundInitiated===!0?ie:te?.code=="approved"&&se?.code?se:te,pe=()=>{f()},je=()=>{f()},ce=e.paymentDetailsSection?.paymentDate,de=ud(V?.method??""),ue=de.replace("Same Day",""),le=e.isCollectToAccountInfoFromVendorContact?t.jsxRuntimeExports.jsx(GQ,{paymentTypeLabel:ue,onClick:J}):zn.addedByZeni,ae=n.allApprovalRules.length>0,ge=Q.toAmount(V?.method!=null&&(V.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)||V?.fee.amount!=null&&V.fee.amount!==0)?W.amount-U.amount:W.amount,V?.fee.currencyCode??Q.defaultVendorCurrency.currencyCode,V?.fee.currencySymbol??Q.defaultVendorCurrency.currencySymbol),ye=Q.isPaymentMethodOutsideZeni(e.paymentDetailsSection?.paymentType?.method),he=Me=>{d.trackBillPayMarkAsPaidSubmit(Me.paymentMode??"other",ee?.code??"draft",ne?.code??""),C(!0,Me)},Ce=()=>{G(!0),d.trackBillPayMarkAsPaid(ee?.code??"draft",ne?.code??"")},we=()=>{b(),G(!1)},ve=ye,Ee=ve&&!m,Se=Lre(Ee,ae,e.isBillMarkedForRetry),$e=()=>ye?Ee?void 0:zn.paymentOutsideZeni.reviewInfo:V?.method!=null&&V.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)&&e.paymentDetailsSection?.internationalTransferFeeBearerPaymentMethod!=null&&a&&F===K1.currencyCode?g7e(e.paymentDetailsSection.internationalTransferFeeBearerPaymentMethod):void 0,Be=x&&e.paymentDetailsSection!=null?WT(W,e.paymentDetailsSection.withdrawFrom,e.paymentDetailsSection.paymentDate):void 0,Ae=()=>{const Me=e.paymentDetailsSection?.paymentDate,Ie=e.isCollectToAccountInfoFromVendorContact,Ne=e.recurringConfig,Pe=e.recipientTotalAmount;if(e.isInvoiceDateAutoUpdated===!0&&d.trackBillPayAutoDateChange(h??"new_bill"),V?.method!=null&&Me!=null){const Ue=ye?zn.paymentOutsideZeni.offline:ud(V.method);if(d.trackBillPaySendForApproval(Ue,Me.format(Are.analytics.MMMDashDDDashYYYYFormat),Ie,e.isRecurring,h,e.paymentDetailsSection?.internationalTransferFeeBearerPaymentMethod,{startDate:Q.zeniDate(Ne?.startDate?.toString()??"").format(N),endDate:Q.zeniDate(Ne?.endDate?.toString()??"").format(N),frequency:Ne?.frequency??"monthly",totalAmount:Pe.amount,totalPaymentCycles:Ne?.totalPaymentCycles??0,isApprovalRequired:Ne?.isApprovalRequired??!1,updateCurrentBill:e.recurringConfig?.id!=null?Ne?.updateRecurringBills==="current":void 0,updateFutureRecurringBills:e.recurringConfig?.id!=null?Ne?.updateRecurringBills==="all":void 0}),Be!=null){const Je=ee?.code??"draft",tt=te?.code??"",Qe=e.isRecurring?["Recurring"]:["One-Time"],dt=e.invoiceNumber??"",ct=Ml(A.loggedInUser),yt=e.paymentDetailsSection?.withdrawFrom?.accType==="depositAccount"?"ZA":"External Account";Se===zn.scheduleBill?d.trackLowBalanceAccountSchedule(Je,tt,Qe,dt,ct,yt):Se===zn.sendForApproval&&d.trackLowBalanceAccountSentForApproval(Je,tt,Qe,dt,ct,yt)}}},_e=()=>{Re===!0&&ke(!1),e.isBillMarkedForRetry===!0?(S(),d.trackRetryConfirmClick(ne?.code??"",ee?.code??"",me?.description??"",e.isRecurring?["Recurring"]:["One-Time"],e.invoiceNumber??"")):e.vendor!=null&&(Ae(),C(!1,{}))},Te=Q.checkIfCreatorIsApprover(W.amount,n.allApprovalRules,A.loggedInUser),[Re,ke]=g.useState(!1),Oe=B0(je);return t.jsxRuntimeExports.jsxs(tOo,{children:[Z?t.jsxRuntimeExports.jsx(Ive,{onCancel:we,onProceedForMarkAsPaid:he,saveDetailsFetchState:D?.fetchState,paymentData:e.outsideZeniPaymentInfo}):null,Re?t.jsxRuntimeExports.jsx(Tve,{withdrawFrom:e.paymentDetailsSection?.withdrawFrom,paymentDate:e.paymentDetailsSection?.paymentDate,onOkClick:_e,onCancelClick:()=>{ke(!1),pe()},onClickAway:()=>{ke(!1)}}):null,t.jsxRuntimeExports.jsx(t.Drawer,{anchor:"right",open:Y,onClose:K,transitionDuration:250,"data-testid":_("vendor-email-preview-drawer"),children:t.jsxRuntimeExports.jsx(YQ,{companyName:IQ(r.company?.companyInfo),vendor:e.vendor?.name,paymentDate:ce?.format(N)??"",paymentType:ue,amount:Fe("0,0[.]00",W),isInvoiceAttached:!!e.file,onClose:K})}),t.jsxRuntimeExports.jsxs(oOo,{windowSize:k,children:[k==="small"?t.jsxRuntimeExports.jsxs(hOo,{windowSize:k,children:[Oe?null:t.jsxRuntimeExports.jsx(zre,{onClick:je,"data-testid":_("review-detail-nav-bar-small-back")}),t.jsxRuntimeExports.jsx(Mre,{windowSize:k,children:zn.oneLastLook})]}):t.jsxRuntimeExports.jsx(XT,{children:t.jsxRuntimeExports.jsx(xOo,{"data-testid":_("review-details-nav-bar-back"),children:Oe?null:t.jsxRuntimeExports.jsx(zre,{onClick:je})})}),t.jsxRuntimeExports.jsxs(nOo,{windowSize:k,style:c,children:[k!=="small"?t.jsxRuntimeExports.jsx(iOo,{children:t.jsxRuntimeExports.jsx(Mre,{windowSize:k,children:zn.oneLastLook})}):null,e.duplicateBillTransactions.length>0?t.jsxRuntimeExports.jsxs(rOo,{children:[t.jsxRuntimeExports.jsxs(aOo,{children:[t.jsxRuntimeExports.jsx(SOo,{}),t.jsxRuntimeExports.jsxs(lOo,{children:[t.jsxRuntimeExports.jsx(dOo,{children:zn.duplicateBillPayWarning}),t.jsxRuntimeExports.jsxs(cOo,{children:[zn.duplicateBillPayWarningSubHeading,t.jsxRuntimeExports.jsxs("span",{"data-testid":_("review-detail-attachment-button"),onClick:()=>R(e.duplicateBillTransactions[0].id,e.duplicateBillTransactions[0].billPayInfo.stage.code),style:{textDecoration:"underline",cursor:"pointer"},children:[zn.viewBill,e.duplicateBillTransactions[0].documentId]})]})]})]}),t.jsxRuntimeExports.jsxs($Oo,{children:[t.jsxRuntimeExports.jsx(vOo,{children:zn.duplicateInvoiceFound}),e.duplicateBillTransactions.map(Me=>{const Ie=U7e(Me,T);return Me!=null?t.jsxRuntimeExports.jsx(ROo,{children:Lve.includes(k)?t.jsxRuntimeExports.jsxs(Dre,{windowSize:k,children:[t.jsxRuntimeExports.jsxs(uOo,{children:[t.jsxRuntimeExports.jsxs(pOo,{children:[Me.attachments&&Me.attachments.length>0?t.jsxRuntimeExports.jsx(Tre,{attachment:Me.attachments[0]}):t.jsxRuntimeExports.jsx(Fre,{children:t.jsxRuntimeExports.jsx(Nre,{})}),t.jsxRuntimeExports.jsx(_E,{children:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[Me.documentId!=null?zn.invoiceNo:null,Me.documentId]})})]}),t.jsxRuntimeExports.jsx(Hre,{windowSize:k,children:Fe("0,0[.]00",Me.recipientTotalAmount)})]}),t.jsxRuntimeExports.jsxs(wOo,{"data-testid":_("review-detail-mobile-info"),onClick:()=>R(Me.id,Me.billPayInfo.stage.code),children:[t.jsxRuntimeExports.jsxs(_E,{children:[Me.dueDate!=null?zn.due:null," ",Me.dueDate?.format(N)]}),t.jsxRuntimeExports.jsx(Wre,{children:Ie!=null?QN.includes(Ie.code)?t.jsxRuntimeExports.jsx(t.Tooltip,{title:Ie.value,placement:"top",children:t.jsxRuntimeExports.jsx(OE,{color:Ie.color,bgColor:Ie.bgColor,borderColor:Ie.borderColor,children:Ie.value})}):t.jsxRuntimeExports.jsx(OE,{color:Ie.color,bgColor:Ie.bgColor,borderColor:Ie.borderColor,children:Ie.value}):null})]})]}):t.jsxRuntimeExports.jsxs(Dre,{windowSize:k,children:[Me.attachments&&Me.attachments.length>0?t.jsxRuntimeExports.jsx(Tre,{attachment:Me.attachments[0]}):t.jsxRuntimeExports.jsx(Fre,{children:t.jsxRuntimeExports.jsx(Nre,{})}),t.jsxRuntimeExports.jsxs(EOo,{"data-testid":_("review-detail-info"),onClick:()=>R(Me.id,Me.billPayInfo.stage.code),children:[t.jsxRuntimeExports.jsx(_E,{style:{width:"50%"},children:t.jsxRuntimeExports.jsxs("div",{children:[Me.documentId!=null?zn.invoiceNo:null," ",Me.documentId]})}),t.jsxRuntimeExports.jsxs(_E,{style:{width:"25%"},children:[Me.dueDate!=null?zn.due:null," ",Me.dueDate?.format(N)]}),t.jsxRuntimeExports.jsx(Hre,{style:{width:"25%"},windowSize:k,children:Fe("0,0[.]00",Me.amount)})]}),t.jsxRuntimeExports.jsx(Wre,{children:Ie!=null?QN.includes(Ie.code)?t.jsxRuntimeExports.jsx(t.Tooltip,{style:{padding:"2px 5px"},title:Ie.value,placement:"top",children:t.jsxRuntimeExports.jsx(OE,{color:Ie.color,bgColor:Ie.bgColor,borderColor:Ie.borderColor,children:Ie.value})}):t.jsxRuntimeExports.jsx(OE,{color:Ie.color,bgColor:Ie.bgColor,borderColor:Ie.borderColor,children:Ie.value}):null})]})},Me.id):null})]})]}):null,t.jsxRuntimeExports.jsxs(mOo,{windowSize:k,children:[t.jsxRuntimeExports.jsx(_re,{children:zn.pay}),t.jsxRuntimeExports.jsx(Ore,{children:t.jsxRuntimeExports.jsx(ls,{amount:ge,integerStyles:z.largeSemiBold.cssObject,decimalStyles:z.largeSemiBold.cssObject})}),t.jsxRuntimeExports.jsx(_re,{children:zn.to}),t.jsxRuntimeExports.jsx(Ore,{children:e.vendor?.name})]}),t.jsxRuntimeExports.jsxs(sOo,{children:[ye?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:B,entityId:h,dashboardTabKey:Yt({type:"details",key:"withdrawFrom"}),roomId:L,companyId:A.currentTenant?.companyId??qu,companyName:A.currentTenant?.companyName??qu,dashboardOptionType:"bill",filterMetaData:{...I,entityType:`bill.details.${Qn("withdrawFrom")}`},children:t.jsxRuntimeExports.jsx(qh,{label:{label:zn.withdrawFrom,width:P},style:{width:"auto"},value:e.paymentDetailsSection?.withdrawFrom!=null?iL(e.paymentDetailsSection.withdrawFrom,k):qu,infoLabelStyle:{textAlign:k==="small"?"left":"right",paddingRight:Rc.infoLabelPaddingRight.valuePx(k),marginTop:Rc.infoLabelMarginTop.valuePx(k),color:v.brandColorGoldDark},additionalInfoLabel:Be})}),t.jsxRuntimeExports.jsx(DE,{})]}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:B,entityId:h,dashboardTabKey:Yt({type:"details",key:"paymentType"}),roomId:L,companyId:A.currentTenant?.companyId??qu,companyName:A.currentTenant?.companyName??qu,dashboardOptionType:"bill",filterMetaData:{...I,entityType:`bill.details.${Qn("paymentType")}`},children:t.jsxRuntimeExports.jsx(qh,{label:{label:zn.paymentMethod,width:P},style:{width:"auto"},value:ud(V?.method??""),additionalInfoLabel:$e()})}),t.jsxRuntimeExports.jsx(DE,{}),!ye&&ce!=null?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:B,entityId:h,dashboardTabKey:Yt({type:"details",key:"paymentDate"}),roomId:L,companyId:A.currentTenant?.companyId??qu,companyName:A.currentTenant?.companyName??qu,dashboardOptionType:"bill",filterMetaData:{...I,entityType:`bill.details.${Qn("paymentDate")}`},children:t.jsxRuntimeExports.jsx(qh,{label:{label:zn.paymentDate,width:P},style:{width:"auto"},value:ce.format(N),additionalInfoLabel:`${zn.estimatedArrival}${Q.zeniDate(Q.getNextNthWorkingDay(ce.toDate(),[0,6],V?.maxPeriod.value??0).toDateString()).format(N)} - (${de.length>0?`${de} `:""}${zn.deliveryTimeLabel} = ${V?.maxPeriod.value??"0"} ${zn.deliveryTimeUnits})`})}),t.jsxRuntimeExports.jsx(DE,{})]}):null,ye?null:t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:B,entityId:h,dashboardTabKey:Yt({type:"details",key:"paymentTo"}),roomId:L,companyId:A.currentTenant?.companyId??qu,companyName:A.currentTenant?.companyName??qu,dashboardOptionType:"bill",filterMetaData:{...I,entityType:`bill.details.${Qn("paymentTo")}`},children:t.jsxRuntimeExports.jsx(qh,{label:{label:zn.paymentTo,width:P},style:{width:"auto"},value:oe??"",additionalInfoLabel:le})}),ye||u?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(DE,{}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:B,entityId:h,dashboardTabKey:Yt({type:"details",key:"recurringPaymentType"}),roomId:L,companyId:A.currentTenant?.companyId??qu,companyName:A.currentTenant?.companyName??qu,dashboardOptionType:"bill",filterMetaData:{...I,entityType:`bill.details.${Qn("recurringPaymentType")}`},children:t.jsxRuntimeExports.jsx(qh,{label:{label:zn.paymentType,width:P},style:{width:"auto"},value:qQ(e.isRecurring,ye,e.recurringBillInstance??1,e.recurringConfig?.totalPaymentCycles??0),additionalInfoLabel:ZQ(k,e.isRecurring,ye,e.recurringConfig)})})]}):null]}),!ye&&V?.method!=null&&(V.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)||V?.fee.amount!=null&&V.fee.amount!==0)?t.jsxRuntimeExports.jsx(K_o,{children:t.jsxRuntimeExports.jsxs(J_o,{windowSize:k,children:[t.jsxRuntimeExports.jsxs(X_o,{children:[t.jsxRuntimeExports.jsx(Y_o,{children:zn.total}),t.jsxRuntimeExports.jsx(Le,{style:{padding:`12px ${o.sp3}`,lineHeight:"18px"},display:"flex",maxWidth:"312px",title:t.jsxRuntimeExports.jsxs(Z_o,{children:[t.jsxRuntimeExports.jsxs(Pre,{children:[t.jsxRuntimeExports.jsx(HD,{children:V.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)&&F!==K1.currencyCode?Ire.conversionAmountColon:kre.invoiceAmount}),t.jsxRuntimeExports.jsx(ND,{children:Fe("0,0[.]00",{amount:W.amount-U.amount,currencySymbol:U.currencySymbol})})]}),t.jsxRuntimeExports.jsxs(Pre,{children:[t.jsxRuntimeExports.jsx(HD,{children:Ire.transactionFee}),t.jsxRuntimeExports.jsx(ND,{children:Fe("0,0[.]00",{amount:U.amount,currencySymbol:U.currencySymbol})})]}),t.jsxRuntimeExports.jsx(q_o,{}),t.jsxRuntimeExports.jsxs(G_o,{children:[t.jsxRuntimeExports.jsx(HD,{children:kre.total}),t.jsxRuntimeExports.jsx(ND,{children:Fe("0,0[.]00",{amount:W.amount,currencyCode:W.currencyCode,currencySymbol:W.currencySymbol})})]})]}),placement:"top-end",children:t.jsxRuntimeExports.jsx(U_o,{})})]}),t.jsxRuntimeExports.jsx(eOo,{children:t.jsxRuntimeExports.jsx(ls,{amount:Q.toAmount(W.amount,W.currencyCode,W.currencySymbol),integerStyles:z.largeBold.cssObject,decimalStyles:z.largeBold.cssObject,style:{color:T.champion}})})]})}):null]})]}),t.jsxRuntimeExports.jsx(_t,{cancelBtn:{label:ve&&!Ee?zn.paymentOutsideZeni.markAsPaid:zn.editBill,onClick:ve&&!Ee?Ce:pe,isLoading:ve&&!Ee&&Z&&D?.fetchState==="In-Progress",reverseSpinnerColor:!1,style:{width:Bre(!1,ve,Ee,ae,k)}},primaryBtn:{label:Lre(Ee,ae,e.isBillMarkedForRetry),isLoading:D?.fetchState==="In-Progress"&&(Ee||!Z)||M?.fetchState==="In-Progress",onClick:Ee?Ce:()=>{Te&&Be!=null?ke(!0):_e()},style:{width:Bre(!0,ve,Ee,ae,k)}},rightSideComponent:ve&&!Ee&&D.fetchState!=="In-Progress"?t.jsxRuntimeExports.jsx(AOo,{windowSize:k,children:t.jsxRuntimeExports.jsx(Le,{style:{color:v.heroDark,padding:`2px ${o.sp2}`},display:"flex",title:W_o,placement:"top",children:t.jsxRuntimeExports.jsx(IOo,{onClick:pe,"data-testid":_("review-detail-edit-bill-button"),children:t.jsxRuntimeExports.jsx(kOo,{})})})}):null,style:{minHeight:e.paymentDetailsSection?.paymentType?.method!=null&&e.paymentDetailsSection.paymentType.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)?127:56,...e.paymentDetailsSection?.paymentType?.method!=null&&e.paymentDetailsSection.paymentType.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)&&{padding:o.sp3,rowGap:o.sp3}},children:e.paymentDetailsSection?.paymentType?.method!=null&&e.paymentDetailsSection.paymentType.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)?t.jsxRuntimeExports.jsxs(yOo,{children:[zn.internationalText1,t.jsxRuntimeExports.jsx(jOo,{href:"https://www.nium.com/legal/end-customer-terms",target:"_Blank",rel:"noopener noreferrer",children:zn.internationalTerms}),zn.internationalText2]}):null})]})},Lre=(e,n,i)=>e?zn.paymentOutsideZeni.markAsPaid:i===!0?zn.retryPayment:n?zn.sendForApproval:zn.scheduleBill,Bre=(e,n,i,r,a)=>i?128:n&&!e&&a==="small"?"auto":r?165:Rc.footerButtonWidth.value(a),U_o=s(fn)`
36048
+ `,Lve=["small","medium-compact","medium-regular"],Rc={largeLabelWidth:new w(150,215,215),paddingBottom:new w(p[3],p[2]),infoMinWidth:new w(0,0,0,142,142),infoMarginRight:new w(0,0,0,p[2],p[2]),footerButtonWidth:new w(120,165),iconContainerMarginTop:new w(6,p[1]),navBarContainerPaddingTop:new w(10,p[3]),navBarContainerPaddingBottom:new w(9,p[3]),sectionTitleMarginLeft:new w(p[3],p[0]),containerPaddingLeft:new w(p[3],p[5],p[5]),containerPaddingRight:new w(p[3],p[5],p[5]),footerRightIconMarginRight:new w(p[0],p[0],p[7]),infoLabelPaddingRight:new w(p[0],p[3]),infoLabelMarginTop:new w(p[1],p[0]),paymentInfoPaddingTop:new w(p[3],p[0])},H_o={sectionTitle:new Ke("h7Medium","h7Medium")},{dateFormat:Are,common:{currency:K1,labels:kre,edit:W_o,strings:{empty:qu}},spendManagement:{billPay:V_o}}=O.getLocalizedStrings(),{billDetails:zn,paymentDetails:Ire}=V_o,Tre=({attachment:e})=>{const[n,i]=g.useState(!1),r=()=>{i(!1)},a=e.fileId?.length===0;return t.jsxRuntimeExports.jsxs(COo,{isDisabled:e.fileId?.length===0,"data-testid":_("attachment-tag",e.fileName),onClick:()=>a===!1?i(!0):null,children:[n&&e?.fileDownloadUrl!=null?t.jsxRuntimeExports.jsx(Y9,{title:e.fileName,file:e,onCrossClick:()=>r(),setShowFullScreenView:i}):null,t.jsxRuntimeExports.jsx(bOo,{children:t.jsxRuntimeExports.jsx(eC,{contentType:e.contentType})})]})},Q_o=({billDetails:e,billpayApprovalView:n,isBillPayCommentingEnabled:i,currentTenant:r,isInternationalPaymentShaVsOurEnabled:a,isLocalCurrencyEnabled:l,style:c,analytics:d,isRecurringBillsFeatureEnabled:u,isApprovalRequiredForMarkAsPaid:m,isDetectInsufficientFundsEnabled:x,billId:h,onClickEdit:f,discardBillDetailsFromLocalStore:y,saveBillDetails:C,discardOutsideZeniPaymentData:b,updateBillDetailSaveBillCode:E,redirectToBillsScreen:$,onAttachmentClick:R,retryPayment:S})=>{const k=X(),T=t.useTheme().colors,A=ht(),I={application:"dashboard",companyId:A.currentTenant?.companyId,tab:"bill",entityId:h},B=i&&h!=null,L=`dashboard_${A.currentTenant?.companyId}`,P=Rc.largeLabelWidth.value(k),D=e.saveStatus,M=e.zeniAssistRetryStatus,F=e.vendor?.vendorCurrencyCode,V=Vbe(a,l,e.billPayConfigList.filter(Me=>Me.method.includes(e.paymentDetailsSection?.withdrawFrom?.accType??"depositAccount")),e.paymentDetailsSection?.internationalTransferFeeBearerPaymentMethod,e.paymentDetailsSection?.paymentType,F),N=Are.visual.MMMDCommaYYYYformat,H={amount:e.recipientTotalAmount.amount/(e.paymentDetailsSection?.conversionRate??1)*100/100,currencyCode:K1.currencyCode,currencySymbol:K1.currencySymbol},W={amount:V?.method.includes("international")===!0?sC(H,V):e.recipientTotalAmount.amount+(V?.fee.amount??0),currencyCode:K1.currencyCode,currencySymbol:K1.currencySymbol},U={amount:V?.method.includes("international")===!0?sL(H,V):V?.fee.amount??0,currencyCode:K1.currencyCode,currencySymbol:K1.currencySymbol},[Y,q]=g.useState(!1),[Z,G]=g.useState(!1),K=()=>q(!1),J=()=>{d.trackBillPayMagicLinkPreviewEmail("review_bill"),q(!0)},oe=e.isCollectToAccountInfoFromVendorContact?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[`${zn.magicLink.collectFrom} ${e.toAccountVendorEmail}`,t.jsxRuntimeExports.jsx(fOo,{size:k,children:t.jsxRuntimeExports.jsx(gOo,{})})]}):rL(e.paymentDetailsSection?.paymentTo);g.useEffect(()=>{(D?.fetchState==="Completed"||M?.fetchState==="Completed")&&(y(),E(),$())},[D,M,$,y,E]);const ee=e.billPayInfo?.stage,te=e.billPayInfo?.billStatus,se=e.billPayInfo?.billPaymentStatus,ie=e.billPayInfo?.billPaymentRefundStatus,ne=ee?.code==="paid"?ee:te?.code=="approved"&&se?.code?se:te,me=e.billPayInfo?.isRefundInitiated===!0?ie:te?.code=="approved"&&se?.code?se:te,pe=()=>{f()},je=()=>{f()},ce=e.paymentDetailsSection?.paymentDate,de=ud(V?.method??""),ue=de.replace("Same Day",""),le=e.isCollectToAccountInfoFromVendorContact?t.jsxRuntimeExports.jsx(GQ,{paymentTypeLabel:ue,onClick:J}):zn.addedByZeni,ae=n.allApprovalRules.length>0,ge=Q.toAmount(V?.method!=null&&(V.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)||V?.fee.amount!=null&&V.fee.amount!==0)?W.amount-U.amount:W.amount,V?.fee.currencyCode??Q.defaultVendorCurrency.currencyCode,V?.fee.currencySymbol??Q.defaultVendorCurrency.currencySymbol),ye=Q.isPaymentMethodOutsideZeni(e.paymentDetailsSection?.paymentType?.method),he=Me=>{d.trackBillPayMarkAsPaidSubmit(Me.paymentMode??"other",ee?.code??"draft",ne?.code??""),C(!0,Me)},Ce=()=>{G(!0),d.trackBillPayMarkAsPaid(ee?.code??"draft",ne?.code??"")},we=()=>{b(),G(!1)},ve=ye,Ee=ve&&!m,Se=Lre(Ee,ae,e.isBillMarkedForRetry),$e=()=>ye?Ee?void 0:zn.paymentOutsideZeni.reviewInfo:V?.method!=null&&V.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)&&e.paymentDetailsSection?.internationalTransferFeeBearerPaymentMethod!=null&&a&&F===K1.currencyCode?g7e(e.paymentDetailsSection.internationalTransferFeeBearerPaymentMethod):void 0,Be=x&&e.paymentDetailsSection!=null?WT(W,e.paymentDetailsSection.withdrawFrom,e.paymentDetailsSection.paymentDate):void 0,Ae=()=>{const Me=e.paymentDetailsSection?.paymentDate,Ie=e.isCollectToAccountInfoFromVendorContact,Ne=e.recurringConfig,Pe=e.recipientTotalAmount;if(e.isInvoiceDateAutoUpdated===!0&&d.trackBillPayAutoDateChange(h??"new_bill"),V?.method!=null&&Me!=null){const Qe=ye?zn.paymentOutsideZeni.offline:ud(V.method);if(d.trackBillPaySendForApproval(Qe,Me.format(Are.analytics.MMMDashDDDashYYYYFormat),Ie,e.isRecurring,h,e.paymentDetailsSection?.internationalTransferFeeBearerPaymentMethod,{startDate:Q.zeniDate(Ne?.startDate?.toString()??"").format(N),endDate:Q.zeniDate(Ne?.endDate?.toString()??"").format(N),frequency:Ne?.frequency??"monthly",totalAmount:Pe.amount,totalPaymentCycles:Ne?.totalPaymentCycles??0,isApprovalRequired:Ne?.isApprovalRequired??!1,updateCurrentBill:e.recurringConfig?.id!=null?Ne?.updateRecurringBills==="current":void 0,updateFutureRecurringBills:e.recurringConfig?.id!=null?Ne?.updateRecurringBills==="all":void 0}),Be!=null){const Je=ee?.code??"draft",tt=te?.code??"",Ue=e.isRecurring?["Recurring"]:["One-Time"],dt=e.invoiceNumber??"",ct=Ml(A.loggedInUser),yt=e.paymentDetailsSection?.withdrawFrom?.accType==="depositAccount"?"ZA":"External Account";Se===zn.scheduleBill?d.trackLowBalanceAccountSchedule(Je,tt,Ue,dt,ct,yt):Se===zn.sendForApproval&&d.trackLowBalanceAccountSentForApproval(Je,tt,Ue,dt,ct,yt)}}},_e=()=>{Re===!0&&ke(!1),e.isBillMarkedForRetry===!0?(S(),d.trackRetryConfirmClick(ne?.code??"",ee?.code??"",me?.description??"",e.isRecurring?["Recurring"]:["One-Time"],e.invoiceNumber??"")):e.vendor!=null&&(Ae(),C(!1,{}))},Te=Q.checkIfCreatorIsApprover(W.amount,n.allApprovalRules,A.loggedInUser),[Re,ke]=g.useState(!1),Oe=B0(je);return t.jsxRuntimeExports.jsxs(tOo,{children:[Z?t.jsxRuntimeExports.jsx(Ive,{onCancel:we,onProceedForMarkAsPaid:he,saveDetailsFetchState:D?.fetchState,paymentData:e.outsideZeniPaymentInfo}):null,Re?t.jsxRuntimeExports.jsx(Tve,{withdrawFrom:e.paymentDetailsSection?.withdrawFrom,paymentDate:e.paymentDetailsSection?.paymentDate,onOkClick:_e,onCancelClick:()=>{ke(!1),pe()},onClickAway:()=>{ke(!1)}}):null,t.jsxRuntimeExports.jsx(t.Drawer,{anchor:"right",open:Y,onClose:K,transitionDuration:250,"data-testid":_("vendor-email-preview-drawer"),children:t.jsxRuntimeExports.jsx(YQ,{companyName:IQ(r.company?.companyInfo),vendor:e.vendor?.name,paymentDate:ce?.format(N)??"",paymentType:ue,amount:Fe("0,0[.]00",W),isInvoiceAttached:!!e.file,onClose:K})}),t.jsxRuntimeExports.jsxs(oOo,{windowSize:k,children:[k==="small"?t.jsxRuntimeExports.jsxs(hOo,{windowSize:k,children:[Oe?null:t.jsxRuntimeExports.jsx(zre,{onClick:je,"data-testid":_("review-detail-nav-bar-small-back")}),t.jsxRuntimeExports.jsx(Mre,{windowSize:k,children:zn.oneLastLook})]}):t.jsxRuntimeExports.jsx(XT,{children:t.jsxRuntimeExports.jsx(xOo,{"data-testid":_("review-details-nav-bar-back"),children:Oe?null:t.jsxRuntimeExports.jsx(zre,{onClick:je})})}),t.jsxRuntimeExports.jsxs(nOo,{windowSize:k,style:c,children:[k!=="small"?t.jsxRuntimeExports.jsx(iOo,{children:t.jsxRuntimeExports.jsx(Mre,{windowSize:k,children:zn.oneLastLook})}):null,e.duplicateBillTransactions.length>0?t.jsxRuntimeExports.jsxs(rOo,{children:[t.jsxRuntimeExports.jsxs(aOo,{children:[t.jsxRuntimeExports.jsx(SOo,{}),t.jsxRuntimeExports.jsxs(lOo,{children:[t.jsxRuntimeExports.jsx(dOo,{children:zn.duplicateBillPayWarning}),t.jsxRuntimeExports.jsxs(cOo,{children:[zn.duplicateBillPayWarningSubHeading,t.jsxRuntimeExports.jsxs("span",{"data-testid":_("review-detail-attachment-button"),onClick:()=>R(e.duplicateBillTransactions[0].id,e.duplicateBillTransactions[0].billPayInfo.stage.code),style:{textDecoration:"underline",cursor:"pointer"},children:[zn.viewBill,e.duplicateBillTransactions[0].documentId]})]})]})]}),t.jsxRuntimeExports.jsxs($Oo,{children:[t.jsxRuntimeExports.jsx(vOo,{children:zn.duplicateInvoiceFound}),e.duplicateBillTransactions.map(Me=>{const Ie=U7e(Me,T);return Me!=null?t.jsxRuntimeExports.jsx(ROo,{children:Lve.includes(k)?t.jsxRuntimeExports.jsxs(Dre,{windowSize:k,children:[t.jsxRuntimeExports.jsxs(uOo,{children:[t.jsxRuntimeExports.jsxs(pOo,{children:[Me.attachments&&Me.attachments.length>0?t.jsxRuntimeExports.jsx(Tre,{attachment:Me.attachments[0]}):t.jsxRuntimeExports.jsx(Fre,{children:t.jsxRuntimeExports.jsx(Nre,{})}),t.jsxRuntimeExports.jsx(_E,{children:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[Me.documentId!=null?zn.invoiceNo:null,Me.documentId]})})]}),t.jsxRuntimeExports.jsx(Hre,{windowSize:k,children:Fe("0,0[.]00",Me.recipientTotalAmount)})]}),t.jsxRuntimeExports.jsxs(wOo,{"data-testid":_("review-detail-mobile-info"),onClick:()=>R(Me.id,Me.billPayInfo.stage.code),children:[t.jsxRuntimeExports.jsxs(_E,{children:[Me.dueDate!=null?zn.due:null," ",Me.dueDate?.format(N)]}),t.jsxRuntimeExports.jsx(Wre,{children:Ie!=null?QN.includes(Ie.code)?t.jsxRuntimeExports.jsx(t.Tooltip,{title:Ie.value,placement:"top",children:t.jsxRuntimeExports.jsx(OE,{color:Ie.color,bgColor:Ie.bgColor,borderColor:Ie.borderColor,children:Ie.value})}):t.jsxRuntimeExports.jsx(OE,{color:Ie.color,bgColor:Ie.bgColor,borderColor:Ie.borderColor,children:Ie.value}):null})]})]}):t.jsxRuntimeExports.jsxs(Dre,{windowSize:k,children:[Me.attachments&&Me.attachments.length>0?t.jsxRuntimeExports.jsx(Tre,{attachment:Me.attachments[0]}):t.jsxRuntimeExports.jsx(Fre,{children:t.jsxRuntimeExports.jsx(Nre,{})}),t.jsxRuntimeExports.jsxs(EOo,{"data-testid":_("review-detail-info"),onClick:()=>R(Me.id,Me.billPayInfo.stage.code),children:[t.jsxRuntimeExports.jsx(_E,{style:{width:"50%"},children:t.jsxRuntimeExports.jsxs("div",{children:[Me.documentId!=null?zn.invoiceNo:null," ",Me.documentId]})}),t.jsxRuntimeExports.jsxs(_E,{style:{width:"25%"},children:[Me.dueDate!=null?zn.due:null," ",Me.dueDate?.format(N)]}),t.jsxRuntimeExports.jsx(Hre,{style:{width:"25%"},windowSize:k,children:Fe("0,0[.]00",Me.amount)})]}),t.jsxRuntimeExports.jsx(Wre,{children:Ie!=null?QN.includes(Ie.code)?t.jsxRuntimeExports.jsx(t.Tooltip,{style:{padding:"2px 5px"},title:Ie.value,placement:"top",children:t.jsxRuntimeExports.jsx(OE,{color:Ie.color,bgColor:Ie.bgColor,borderColor:Ie.borderColor,children:Ie.value})}):t.jsxRuntimeExports.jsx(OE,{color:Ie.color,bgColor:Ie.bgColor,borderColor:Ie.borderColor,children:Ie.value}):null})]})},Me.id):null})]})]}):null,t.jsxRuntimeExports.jsxs(mOo,{windowSize:k,children:[t.jsxRuntimeExports.jsx(_re,{children:zn.pay}),t.jsxRuntimeExports.jsx(Ore,{children:t.jsxRuntimeExports.jsx(ls,{amount:ge,integerStyles:z.largeSemiBold.cssObject,decimalStyles:z.largeSemiBold.cssObject})}),t.jsxRuntimeExports.jsx(_re,{children:zn.to}),t.jsxRuntimeExports.jsx(Ore,{children:e.vendor?.name})]}),t.jsxRuntimeExports.jsxs(sOo,{children:[ye?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:B,entityId:h,dashboardTabKey:Yt({type:"details",key:"withdrawFrom"}),roomId:L,companyId:A.currentTenant?.companyId??qu,companyName:A.currentTenant?.companyName??qu,dashboardOptionType:"bill",filterMetaData:{...I,entityType:`bill.details.${Qn("withdrawFrom")}`},children:t.jsxRuntimeExports.jsx(qh,{label:{label:zn.withdrawFrom,width:P},style:{width:"auto"},value:e.paymentDetailsSection?.withdrawFrom!=null?iL(e.paymentDetailsSection.withdrawFrom,k):qu,infoLabelStyle:{textAlign:k==="small"?"left":"right",paddingRight:Rc.infoLabelPaddingRight.valuePx(k),marginTop:Rc.infoLabelMarginTop.valuePx(k),color:v.brandColorGoldDark},additionalInfoLabel:Be})}),t.jsxRuntimeExports.jsx(DE,{})]}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:B,entityId:h,dashboardTabKey:Yt({type:"details",key:"paymentType"}),roomId:L,companyId:A.currentTenant?.companyId??qu,companyName:A.currentTenant?.companyName??qu,dashboardOptionType:"bill",filterMetaData:{...I,entityType:`bill.details.${Qn("paymentType")}`},children:t.jsxRuntimeExports.jsx(qh,{label:{label:zn.paymentMethod,width:P},style:{width:"auto"},value:ud(V?.method??""),additionalInfoLabel:$e()})}),t.jsxRuntimeExports.jsx(DE,{}),!ye&&ce!=null?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:B,entityId:h,dashboardTabKey:Yt({type:"details",key:"paymentDate"}),roomId:L,companyId:A.currentTenant?.companyId??qu,companyName:A.currentTenant?.companyName??qu,dashboardOptionType:"bill",filterMetaData:{...I,entityType:`bill.details.${Qn("paymentDate")}`},children:t.jsxRuntimeExports.jsx(qh,{label:{label:zn.paymentDate,width:P},style:{width:"auto"},value:ce.format(N),additionalInfoLabel:`${zn.estimatedArrival}${Q.zeniDate(Q.getNextNthWorkingDay(ce.toDate(),[0,6],V?.maxPeriod.value??0).toDateString()).format(N)} - (${de.length>0?`${de} `:""}${zn.deliveryTimeLabel} = ${V?.maxPeriod.value??"0"} ${zn.deliveryTimeUnits})`})}),t.jsxRuntimeExports.jsx(DE,{})]}):null,ye?null:t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:B,entityId:h,dashboardTabKey:Yt({type:"details",key:"paymentTo"}),roomId:L,companyId:A.currentTenant?.companyId??qu,companyName:A.currentTenant?.companyName??qu,dashboardOptionType:"bill",filterMetaData:{...I,entityType:`bill.details.${Qn("paymentTo")}`},children:t.jsxRuntimeExports.jsx(qh,{label:{label:zn.paymentTo,width:P},style:{width:"auto"},value:oe??"",additionalInfoLabel:le})}),ye||u?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(DE,{}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:B,entityId:h,dashboardTabKey:Yt({type:"details",key:"recurringPaymentType"}),roomId:L,companyId:A.currentTenant?.companyId??qu,companyName:A.currentTenant?.companyName??qu,dashboardOptionType:"bill",filterMetaData:{...I,entityType:`bill.details.${Qn("recurringPaymentType")}`},children:t.jsxRuntimeExports.jsx(qh,{label:{label:zn.paymentType,width:P},style:{width:"auto"},value:qQ(e.isRecurring,ye,e.recurringBillInstance??1,e.recurringConfig?.totalPaymentCycles??0),additionalInfoLabel:ZQ(k,e.isRecurring,ye,e.recurringConfig)})})]}):null]}),!ye&&V?.method!=null&&(V.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)||V?.fee.amount!=null&&V.fee.amount!==0)?t.jsxRuntimeExports.jsx(K_o,{children:t.jsxRuntimeExports.jsxs(J_o,{windowSize:k,children:[t.jsxRuntimeExports.jsxs(X_o,{children:[t.jsxRuntimeExports.jsx(Y_o,{children:zn.total}),t.jsxRuntimeExports.jsx(Le,{style:{padding:`12px ${o.sp3}`,lineHeight:"18px"},display:"flex",maxWidth:"312px",title:t.jsxRuntimeExports.jsxs(Z_o,{children:[t.jsxRuntimeExports.jsxs(Pre,{children:[t.jsxRuntimeExports.jsx(HD,{children:V.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)&&F!==K1.currencyCode?Ire.conversionAmountColon:kre.invoiceAmount}),t.jsxRuntimeExports.jsx(ND,{children:Fe("0,0[.]00",{amount:W.amount-U.amount,currencySymbol:U.currencySymbol})})]}),t.jsxRuntimeExports.jsxs(Pre,{children:[t.jsxRuntimeExports.jsx(HD,{children:Ire.transactionFee}),t.jsxRuntimeExports.jsx(ND,{children:Fe("0,0[.]00",{amount:U.amount,currencySymbol:U.currencySymbol})})]}),t.jsxRuntimeExports.jsx(q_o,{}),t.jsxRuntimeExports.jsxs(G_o,{children:[t.jsxRuntimeExports.jsx(HD,{children:kre.total}),t.jsxRuntimeExports.jsx(ND,{children:Fe("0,0[.]00",{amount:W.amount,currencyCode:W.currencyCode,currencySymbol:W.currencySymbol})})]})]}),placement:"top-end",children:t.jsxRuntimeExports.jsx(U_o,{})})]}),t.jsxRuntimeExports.jsx(eOo,{children:t.jsxRuntimeExports.jsx(ls,{amount:Q.toAmount(W.amount,W.currencyCode,W.currencySymbol),integerStyles:z.largeBold.cssObject,decimalStyles:z.largeBold.cssObject,style:{color:T.champion}})})]})}):null]})]}),t.jsxRuntimeExports.jsx(_t,{cancelBtn:{label:ve&&!Ee?zn.paymentOutsideZeni.markAsPaid:zn.editBill,onClick:ve&&!Ee?Ce:pe,isLoading:ve&&!Ee&&Z&&D?.fetchState==="In-Progress",reverseSpinnerColor:!1,style:{width:Bre(!1,ve,Ee,ae,k)}},primaryBtn:{label:Lre(Ee,ae,e.isBillMarkedForRetry),isLoading:D?.fetchState==="In-Progress"&&(Ee||!Z)||M?.fetchState==="In-Progress",onClick:Ee?Ce:()=>{Te&&Be!=null?ke(!0):_e()},style:{width:Bre(!0,ve,Ee,ae,k)}},rightSideComponent:ve&&!Ee&&D.fetchState!=="In-Progress"?t.jsxRuntimeExports.jsx(AOo,{windowSize:k,children:t.jsxRuntimeExports.jsx(Le,{style:{color:v.heroDark,padding:`2px ${o.sp2}`},display:"flex",title:W_o,placement:"top",children:t.jsxRuntimeExports.jsx(IOo,{onClick:pe,"data-testid":_("review-detail-edit-bill-button"),children:t.jsxRuntimeExports.jsx(kOo,{})})})}):null,style:{minHeight:e.paymentDetailsSection?.paymentType?.method!=null&&e.paymentDetailsSection.paymentType.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)?127:56,...e.paymentDetailsSection?.paymentType?.method!=null&&e.paymentDetailsSection.paymentType.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)&&{padding:o.sp3,rowGap:o.sp3}},children:e.paymentDetailsSection?.paymentType?.method!=null&&e.paymentDetailsSection.paymentType.method.includes(Q.NEW_INTERNATIONAL_METHOD_SUBTEXT)?t.jsxRuntimeExports.jsxs(yOo,{children:[zn.internationalText1,t.jsxRuntimeExports.jsx(jOo,{href:"https://www.nium.com/legal/end-customer-terms",target:"_Blank",rel:"noopener noreferrer",children:zn.internationalTerms}),zn.internationalText2]}):null})]})},Lre=(e,n,i)=>e?zn.paymentOutsideZeni.markAsPaid:i===!0?zn.retryPayment:n?zn.sendForApproval:zn.scheduleBill,Bre=(e,n,i,r,a)=>i?128:n&&!e&&a==="small"?"auto":r?165:Rc.footerButtonWidth.value(a),U_o=s(fn)`
36049
36049
  width: ${o.sp3};
36050
36050
  height: ${o.sp3};
36051
36051
  color: ${e=>e.theme.colors.hero};
@@ -37093,7 +37093,7 @@ to {
37093
37093
  text-decoration: underline;
37094
37094
  cursor: pointer;
37095
37095
  }
37096
- `,GD=({updateCardPaymentModalState:e,linktext:n,descriptionText:i,style:r,eventSource:a,analytics:l,productType:c,referrer:d,setEventSourceType:u})=>t.jsxRuntimeExports.jsxs(_ve,{style:r,children:[t.jsxRuntimeExports.jsxs(zve,{onClick:()=>{e?.(!0),a!=null&&d!=null&&(u(a),l.trackCreditCardConnect(c,a,d))},children:[n,t.jsxRuntimeExports.jsx(_A,{children:t.jsxRuntimeExports.jsx(Hve,{width:o.sp3,height:o.sp3})})]}),t.jsxRuntimeExports.jsx(Ove,{children:i})]}),XFo=({openPlaidDialog:e,linktext:n,descriptionText:i})=>t.jsxRuntimeExports.jsxs(_ve,{children:[t.jsxRuntimeExports.jsxs(zve,{onClick:r=>{e?.(r,"switch_to_bank_account")},children:[n,t.jsxRuntimeExports.jsx(_A,{children:t.jsxRuntimeExports.jsx(Hve,{width:o.sp4,height:o.sp4})})]}),t.jsxRuntimeExports.jsx(Ove,{children:i})]});function Fve({paymentAccount:e,allBankAccounts:n,cardPaymentView:i,plaidConnectionDetails:r,sectionId:a,isDisabled:l,icon:c,isError:d,hasError:u=!1,header:m,subHeader:x,defaultSectionTitle:h,defaultSectionSubTitle:f,sectionTitle:y,style:C,analytics:b,productType:E,referrer:$,connectedAccountProvider:R,isCompleted:S=!1,showCompletedIcon:k=!1,showZeniAccountSection:T=!0,cardPaymentSectionValues:A,onFetchLinkTokenClick:I,onEstablishConnectionClick:B,onUpdatePaymentAccountStatus:L,onEstablishConnectionSuccess:P,resetCardPaymentViewState:D,updateCardPaymentModalState:M,cardSetupInProgress:F=!1}){const V=X(),{trigger:N,formState:H}=t.useFormContext(),{errors:W}=H,U=t.useTheme(),{card_payment_method:Y}=jf.sections,q=e?.institutionDetails,Z=e?.providerVerificationStatus,G=Z?.code,K=e?.isLoginRequired??!1,J=tNo(a,"account"),oe=t.has(W,J),ee=G==="verification_expired"||G==="verification_failed"?Jc.achFailedTitle:Jc.achTitle,[te,se]=g.useState(void 0),ie=r.link_account,re=r.update_account,[ne,me]=g.useState(!1),pe=te==="update_account"?re:ie,[je,ce]=g.useState(pe.linkToken??null),[de,ue]=g.useState(!1),[le,ae]=g.useState(!1),[ge,ye]=g.useState(!1),he=Ye(ie.updateStatus.fetchState),Ce=Ye(re.updateStatus.fetchState),we=Ye(re.fetchStatus.fetchState),ve=Ye(i?.addCardPaymentSourceStatus.fetchState),Ee=g.useRef(void 0),[Se,$e]=g.useState(!1),[Be,Ae]=g.useState(null),_e=Tt=>{Ee.current=Tt},Te=g.useCallback((Tt,Gt)=>{const so=Gt.accounts.find(Xe=>Xe.id===e?.providerAccountId)??Gt.accounts[0];Ae(Gt.link_session_id),b.trackConnectBankSuccess(E,$,Ee.current,Gt.link_session_id??null,so?.id??null,!1,Gt.institution?.name??null);const no=Gt.accounts.find(Xe=>Xe.id===e?.providerAccountId)??Gt.accounts[0];e?.paymentAccountId!=null&&te==="update_account"&&no?.verification_status!=null&&!K?L(no?.verification_status,e.paymentAccountId,"update_account"):B(Tt,te),D?.(),se(void 0),ue(!1)},[b,E,$,e,te,K,D,L,B]),Re=g.useCallback((Tt,Gt)=>{Gt.link_session_id!=null&&Ae(Gt.link_session_id),Tt!=null&&(b.trackConnectBankFailure(E,Tt.error_code+" "+Tt.error_message,$,Ee.current,Number(Tt.error_code),Gt.link_session_id,Gt.request_id,Gt.institution?.name),Tt.error_code==="TOO_MANY_VERIFICATION_ATTEMPTS"&&e?.paymentAccountId!=null&&L("verification_failed",e.paymentAccountId,"update_account"),console.log("Plaid Connection Error",Tt,Gt)),se(void 0),ue(!1)},[b,E,$,e?.paymentAccountId,L]),ke=g.useCallback((Tt,Gt)=>{Tt!=null&&Gt.link_session_id!=null&&Ae(Gt.link_session_id)},[]),{open:Oe,ready:Me}=Pc.usePlaidLink({token:je,onSuccess:Te,onExit:Re,onEvent:ke});g.useEffect(()=>{(he==="In-Progress"&&ie.updateStatus.fetchState==="Completed"||Ce==="In-Progress"&&re.updateStatus.fetchState==="Completed")&&G!=="verified"&&G!=="manually_verified"&&G!=="automatically_verified"&&G!=="database_matched"&&(I("link_account"),P())},[ie.updateStatus.fetchState,P,I,e?.providerVerificationStatus?.code,e?.paymentAccountId,he,Ce,re.updateStatus.fetchState,G]),g.useEffect(()=>{(Q.isVerifiedStatusCode(G??"")||G==="verification_failed")&&!de&&te!=null&&pe.linkToken===je&&pe.fetchStatus.fetchState==="Completed"&&Me&&ue(!0)},[Me,je,pe.fetchStatus.fetchState,pe.linkToken,G,te,de]),g.useEffect(()=>{pe.fetchStatus.fetchState==="Completed"&&pe.linkToken!=null&&pe.linkToken!==je&&ce(pe.linkToken)},[pe.fetchStatus.fetchState,pe.linkToken,je]),g.useEffect(()=>{de&&Oe()},[de,Oe]),g.useEffect(()=>{!e?.zeniAccountId&&!oe&&N(J)},[e?.paymentAccountId]),g.useEffect(()=>{(G==null||G==="verification_failed"||G==="verification_expired"||Q.isVerifiedStatusCode(G))&&(Q.zeniDate(new Date().toISOString()).isAfter(ie.expiration)||ie.linkToken==null)&&I("link_account")},[]),g.useEffect(()=>{const Tt=setTimeout(()=>{$e(!0),me(!0)},500);return()=>clearTimeout(Tt)},[]),g.useEffect(()=>{ve==="In-Progress"&&i?.addCardPaymentSourceStatus.fetchState==="Completed"&&b.trackCreditCardConnectSuccess(E,$,Ee.current)},[i?.addCardPaymentSourceStatus.fetchState]),g.useEffect(()=>{ve==="In-Progress"&&i?.addCardPaymentSourceStatus.fetchState==="Error"&&b.trackCreditCardConnectFailure(E,i?.addCardPaymentSourceStatus.error?.message??"",$,Ee.current)},[i?.addCardPaymentSourceStatus.fetchState]);const Ie=()=>{b.trackConnectBankGetBalance(E,$),se("update_account"),I("update_account",e?.paymentAccountId)},Ne=`${e?.accountSubType?.name!=null?e?.accountSubType?.name.substring(0,1).toUpperCase().concat(e?.accountSubType?.name.substring(1)):""} ${e?.maskedAccountNumber??""}`.trim(),Pe=ie.fetchStatus.fetchState==="In-Progress"||ie.updateStatus.fetchState==="In-Progress",Ue=re.fetchStatus.fetchState==="In-Progress"||re.updateStatus.fetchState==="In-Progress",Je=U.mode==="light"?new t.Color(U.colors.brandColorJadeLight):new t.Color(U.colors.brandColorJadeDark),tt=()=>{ye(!0)},Qe=(Tt,Gt)=>{Tt.stopPropagation(),b.trackConnectBank(E,$,Gt),se("link_account"),_e(Gt),ie.linkToken==null||Q.zeniDate(new Date().toISOString()).isAfter(ie.expiration)?I("link_account"):je!==ie.linkToken?ce(ie.linkToken):de?Oe():ue(!0)},dt=!!(i&&i.bankAccountsList.length>0&&i.cardsList.length===0),ct=i&&i.cardsList.length>0,yt=Pe||F||Ue,He=re.fetchStatus,jt=re.updateStatus;if((E==="onboarding"||E==="billing")&&A!=null&&ct===!0)return t.jsxRuntimeExports.jsx(nl,{title:A.title,subTitle:A.subtitle,header:A.header,subHeader:A.subHeader,isCompleted:A.isCompleted,showCompletedIcon:A.showCompletedIcon,isError:A.isError,icon:A.icon,isLoading:A.isLoading||F,status:A.status,showRightArrow:A.showRightArrow,footNote:t.jsxRuntimeExports.jsx(XFo,{linktext:jf.steps.link_card.footNoteCard.text1,openPlaidDialog:Qe,productType:E,analytics:b,setEventSourceType:_e}),showAddPaymentMethodDropDown:A.showAddPaymentMethodDropDown,isCardPaymentMethod:!0,updateCardPaymentModalState:M,openPlaidDialog:Qe,analytics:b,productType:E,setEventSourceType:_e,referrer:$});if((E==="billing"||E==="onboarding")&&dt&&i&&e==null)return t.jsxRuntimeExports.jsx(mFo,{subscriptionPaymentAccount:i.bankAccountsList[0],sectionId:"billPageSetUpPage",showAddPaymentMethodDropDown:!0,updateCardPaymentModalState:M,openPlaidDialog:Qe,isCardPaymentMethod:!1,analytics:b,referrer:$,productType:E,setEventSourceType:_e,addPaymentMethodDropdownOpen:le,setAddPaymentMethodDropdownOpen:ae,sectionSubHeader:x??Jc.achSubHeader,footNote:t.jsxRuntimeExports.jsx(GD,{linktext:jf.steps.link_card.footNote.text2,updateCardPaymentModalState:M,setEventSourceType:_e,analytics:b,eventSource:"switch_to_credit_card",productType:E,referrer:$})});if(Q.isVerifiedStatusCode(G??"")===!1&&G!=="verification_failed")return t.jsxRuntimeExports.jsx(nl,{onClick:()=>{(G==null||G==="verification_failed"||G==="verification_expired")&&(b.trackConnectBank(E,$,"link_bank_account"),_e("link_bank_account"),Oe())},title:h??ee,subTitle:f??Jc.achSubTitle,header:m??Jc.achHeader,subHeader:x??Jc.achSubHeader,isCompleted:S,showCompletedIcon:k,isError:G==="verification_failed"||G==="verification_expired",footNote:E==="onboarding"||E==="billing"?t.jsxRuntimeExports.jsx(GD,{linktext:jf.steps.link_card.footNote.text1,eventSource:"link_credit_card",updateCardPaymentModalState:M,analytics:b,productType:E,referrer:$,setEventSourceType:_e}):void 0,icon:{element:t.jsxRuntimeExports.jsx(Fs,{width:o.sp3,height:o.sp3}),color:new t.Color(Je)},isLoading:yt,status:Z,isCardPaymentMethod:!1,hasError:u&&e==null,showAddPaymentMethodDropDown:E==="onboarding"||E==="billing"?e!=null:!1,openPlaidDialog:Qe,analytics:b});const St=q&&q.institutionName.length>0?q?.institutionName:e?.accountName??Jc.achTitle,We=q?.zeniInstitutionId.toLowerCase()==="chase",nt=()=>{me(!ne)},ut=E==="onboarding"&&e?.accountName!=null?Y.header:y??Jc.achVerifiedHeader,pt={isBankVerificationBox:ne,paymentAccountStatus:G,paymentAccount:e},Bt=pt.isBankVerificationBox&&G!=="verification_failed"&&e?.providerVerificationStatus?.code==="pending_manual_verification"&&yt===!1,Ht=G!=="verification_failed"&&e?.providerVerificationStatus?.code==="pending_manual_verification",$o=e?.providerVerificationStatus?.code==="pending_automatic_verification"&&Se&&yt===!1;return t.jsxRuntimeExports.jsxs(oNo,{windowSize:V,style:C,children:[ge===!0?Ns.createPortal(t.jsxRuntimeExports.jsx(v8,{connectedAccountProvider:R,action:{onBackClick:()=>ye(!1)}}),document.body):null,t.jsxRuntimeExports.jsxs(hNo,{children:[k===!0?t.jsxRuntimeExports.jsx(jNo,{children:S?t.jsxRuntimeExports.jsx(CNo,{}):t.jsxRuntimeExports.jsx(bNo,{})}):null,t.jsxRuntimeExports.jsxs(gNo,{children:[t.jsxRuntimeExports.jsx(fNo,{windowSize:V,children:ut}),t.jsxRuntimeExports.jsx(yNo,{windowSize:V,children:Jc.achSubHeader})]})]}),t.jsxRuntimeExports.jsxs(xNo,{windowSize:V,isDisabled:K,children:[t.jsxRuntimeExports.jsxs(nNo,{windowSize:V,children:[t.jsxRuntimeExports.jsxs(aNo,{children:[t.jsxRuntimeExports.jsx(Co,{isLoading:yt,customStyle:{marginRight:$l.iconContainerMarginRight.valuePx(V),width:o.sp3,height:o.sp3},children:t.jsxRuntimeExports.jsx(rNo,{isDisabled:K,children:Nve(c,e,!1,Q.isVerifiedStatusCode(G??"")?{flatIconNoBackground:!0}:void 0)})}),t.jsxRuntimeExports.jsxs(ANo,{children:[t.jsxRuntimeExports.jsxs(wNo,{children:[t.jsxRuntimeExports.jsx(Co,{isLoading:yt,customStyle:{marginRight:$l.iconContainerMarginRight.valuePx(V),width:"200px",height:"20px",marginBottom:$l.rowGap.valuePx(V)},children:t.jsxRuntimeExports.jsx(YG,{title:St,isDisabled:K,isError:d,showAddPaymentMethodDropDown:E==="onboarding"||E==="billing",setAddPaymentMethodDropdownOpen:ae,addPaymentMethodDropdownOpen:le,isCardPaymentMethod:!1,openPlaidDialog:Qe,updateCardPaymentModalState:M})}),t.jsxRuntimeExports.jsx(Co,{isLoading:yt,customStyle:{marginRight:$l.iconContainerMarginRight.valuePx(V),width:o.sp12,height:"20px",marginBottom:$l.rowGap.valuePx(V)},children:t.jsxRuntimeExports.jsxs(cNo,{isDisabled:K,children:[Ne?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(uNo,{isDisabled:K,children:Ne}),V!=="small"&&Ht||K||We?t.jsxRuntimeExports.jsx($No,{}):null]}):null,Ht||K||We?t.jsxRuntimeExports.jsx(eNo,{isUpdateLinkClicked:te==="update_account",isLoginRequired:K,isPendingVerification:Ht,fetchAndUpdateStatues:{fetchStatus:re.fetchStatus,updateStatus:re.updateStatus,linkFetchStatus:ie.fetchStatus,linkUpdateStatus:ie.updateStatus,prevFetchState:we,prevUpdateState:Ce},onUpdateLinkTokenClick:Ie,onChaseInfoClick:tt}):null]})})]}),Z!=null&&V==="small"?t.jsxRuntimeExports.jsx(Co,{isLoading:yt||He?.fetchState==="In-Progress"||jt?.fetchState==="In-Progress",customStyle:{marginRight:$l.iconContainerMarginRight.valuePx(V),width:o.sp12,height:`${o.sp4}`,marginLeft:"auto"},children:Ht&&V!=="small"?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(dae,{onClick:()=>{nt()},children:[t.jsxRuntimeExports.jsx(pae,{}),t.jsxRuntimeExports.jsx(mae,{children:jf.sections.link_payment_account.verifyButton}),ne?t.jsxRuntimeExports.jsx(kNo,{}):t.jsxRuntimeExports.jsx(uae,{})]})}):Z!=null?t.jsxRuntimeExports.jsx(ao,{label:Z?.code==="pending_automatic_verification"?"Pending Verification":Z?.name,labelColor:ws(Z.code??"").color.toString(),capsuleBackground:ws(Z.code??"","light","solid").backgroundColor?.toString()}):null}):null]})]}),t.jsxRuntimeExports.jsx(lNo,{children:Ht&&V!=="small"?t.jsxRuntimeExports.jsxs(Co,{isLoading:yt||He?.fetchState==="In-Progress"||jt?.fetchState==="In-Progress",customStyle:{marginLeft:"auto",width:o.sp12,height:o.sp4},children:[t.jsxRuntimeExports.jsxs(dae,{onClick:()=>{nt()},children:[t.jsxRuntimeExports.jsx(pae,{}),t.jsxRuntimeExports.jsx(mae,{children:jf.sections.link_payment_account.verifyButton}),ne?t.jsxRuntimeExports.jsx(INo,{}):t.jsxRuntimeExports.jsx(uae,{})]}),t.jsxRuntimeExports.jsx(ENo,{})]}):Z!=null&&t.jsxRuntimeExports.jsx(Co,{isLoading:yt||He?.fetchState==="In-Progress"||jt?.fetchState==="In-Progress",customStyle:{marginLeft:"auto",width:o.sp12,height:o.sp4},children:t.jsxRuntimeExports.jsx(ao,{label:Z?.code==="pending_automatic_verification"?"Pending Verification":Z?.name,labelColor:ws(Z.code??"").color.toString(),capsuleBackground:ws(Z.code??"","light","solid").backgroundColor?.toString()})})})]}),T?t.jsxRuntimeExports.jsx(Co,{isLoading:yt,customStyle:{marginTop:$l.rowGap.valuePx(V),width:"100%",height:o.sp12},children:t.jsxRuntimeExports.jsx(sNo,{windowSize:V,isDisabled:K,onClick:Tt=>Tt.stopPropagation(),children:t.jsxRuntimeExports.jsx(iNo,{isDisabled:K?"disabled":l,label:{label:Jc.zeniCashAccountLabel,width:V==="small"?void 0:$l.labelWidth.value(V)},style:{borderRadius:o.sp2,border:`1px solid ${U.colors.grey2}`,width:"-webkit-fill-available",display:V==="small"?"block":"inherit"},infoLabelStyle:{textAlign:V==="small"?"left":"right"},singleSelectPickerField:{name:J,placeholder:Jc.zeniCashAccountPlaceholder,style:{position:"relative"},defaultValue:{selectedOption:e?.zeniAccountId??"",allOptions:n.map(Tt=>({label:Tt.accountName,value:Tt.accountId}))},isOptionRemovable:!1,withBorder:V==="small",textAlignment:V==="small"?"left":"right",registerOptions:{required:E!=="zeni_accounts",validate:Tt=>E==="zeni_accounts"||Tt!=null&&!!Tt.selectedOption||l!=null}},valueToAdditionalLabel:()=>Jc.zeniCashAcoountInfo})})}):null,t.jsxRuntimeExports.jsx(BNo,{children:t.jsxRuntimeExports.jsx($zo,{showPlaidVerificationNoticeFlag:$o,linkSessionId:Be})}),t.jsxRuntimeExports.jsx(LNo,{showBankVerification:Bt,children:t.jsxRuntimeExports.jsx(mzo,{onClick:Ie,bankVerificationFlags:pt,linkSessionId:Be})}),t.jsxRuntimeExports.jsx(Co,{isLoading:yt,customStyle:{marginTop:$l.rowGap.valuePx(V),width:"48%",height:o.sp3,marginBottom:o.sp2,marginLeft:o.sp3},children:t.jsxRuntimeExports.jsxs(TNo,{children:[t.jsxRuntimeExports.jsx(GD,{linktext:jf.steps.link_card.footNote.text2,updateCardPaymentModalState:M,setEventSourceType:_e,analytics:b,eventSource:"switch_to_credit_card",productType:E,referrer:$}),Pe?t.jsxRuntimeExports.jsx(Wve,{children:t.jsxRuntimeExports.jsx(Et,{size:"ExtraSmall",start:!0,style:{display:"flex"}})}):null]})})]})]})}const Nve=(e,n,i,r)=>{const a=r?.flatIconNoBackground===!0;return n?.institutionDetails.logo?.base64!=null?a?t.jsxRuntimeExports.jsx(vNo,{src:`${gu}${n?.institutionDetails.logo?.base64}`,alt:n?.institutionDetails.institutionName,loading:"lazy"}):t.jsxRuntimeExports.jsx(RNo,{src:`${gu}${n?.institutionDetails.logo?.base64}`,alt:n?.institutionDetails.institutionName,loading:"lazy"}):i===!0?e.element:a?t.jsxRuntimeExports.jsx(SNo,{children:e.element}):t.jsxRuntimeExports.jsx(mNo,{children:e.element})},eNo=({isLoginRequired:e,isUpdateLinkClicked:n,isPendingVerification:i,fetchAndUpdateStatues:r,onUpdateLinkTokenClick:a,onChaseInfoClick:l})=>{const{verifyAccountError:c,reLogging:d,reLoginLabel:u,reLoginError:m,reLoginMessage:x,chaseLabel:h}=Jc,{fetchStatus:f,updateStatus:y,linkFetchStatus:C,linkUpdateStatus:b,prevFetchState:E,prevUpdateState:$}=r,R=n&&E==="In-Progress"&&f?.fetchState==="Error"||$==="In-Progress"&&y?.fetchState==="Error";return e?n&&(f?.fetchState==="In-Progress"||y?.fetchState==="In-Progress"||C?.fetchState==="In-Progress"||b?.fetchState==="In-Progress")?t.jsxRuntimeExports.jsxs(HE,{style:{color:v.important},children:[t.jsxRuntimeExports.jsx(dNo,{children:d}),t.jsxRuntimeExports.jsx(Wve,{children:t.jsxRuntimeExports.jsx(Et,{size:"Small",start:!0,style:{display:"flex",color:v.important}})})]}):t.jsxRuntimeExports.jsx(HE,{style:{cursor:"pointer"},onClick:a,children:t.jsxRuntimeExports.jsx(Le,{variant:"small-description",data:x,placement:"bottom",maxWidth:"264px",children:t.jsxRuntimeExports.jsxs(pNo,{children:[t.jsxRuntimeExports.jsx(cae,{style:{marginLeft:o.sp0,marginRight:o.sp1}}),t.jsxRuntimeExports.jsx(aae,{isError:!0,style:{color:v.important},children:R?m:u}),t.jsxRuntimeExports.jsx(_A,{children:t.jsxRuntimeExports.jsx(lae,{style:{color:v.important}})})]})})}):i?t.jsxRuntimeExports.jsx(HE,{onClick:a,children:R?t.jsxRuntimeExports.jsx(Le,{variant:"small-description",style:{color:v.important},data:c,placement:"bottom",children:t.jsxRuntimeExports.jsx(cae,{})}):null}):t.jsxRuntimeExports.jsxs(HE,{onClick:l,children:[t.jsxRuntimeExports.jsx(aae,{isError:!1,children:h}),t.jsxRuntimeExports.jsx(_A,{children:t.jsxRuntimeExports.jsx(lae,{})})]})},tNo=(e,n)=>`${e}.${n}`,oNo=s.div`
37096
+ `,GD=({updateCardPaymentModalState:e,linktext:n,descriptionText:i,style:r,eventSource:a,analytics:l,productType:c,referrer:d,setEventSourceType:u})=>t.jsxRuntimeExports.jsxs(_ve,{style:r,children:[t.jsxRuntimeExports.jsxs(zve,{onClick:()=>{e?.(!0),a!=null&&d!=null&&(u(a),l.trackCreditCardConnect(c,a,d))},children:[n,t.jsxRuntimeExports.jsx(_A,{children:t.jsxRuntimeExports.jsx(Hve,{width:o.sp3,height:o.sp3})})]}),t.jsxRuntimeExports.jsx(Ove,{children:i})]}),XFo=({openPlaidDialog:e,linktext:n,descriptionText:i})=>t.jsxRuntimeExports.jsxs(_ve,{children:[t.jsxRuntimeExports.jsxs(zve,{onClick:r=>{e?.(r,"switch_to_bank_account")},children:[n,t.jsxRuntimeExports.jsx(_A,{children:t.jsxRuntimeExports.jsx(Hve,{width:o.sp4,height:o.sp4})})]}),t.jsxRuntimeExports.jsx(Ove,{children:i})]});function Fve({paymentAccount:e,allBankAccounts:n,cardPaymentView:i,plaidConnectionDetails:r,sectionId:a,isDisabled:l,icon:c,isError:d,hasError:u=!1,header:m,subHeader:x,defaultSectionTitle:h,defaultSectionSubTitle:f,sectionTitle:y,style:C,analytics:b,productType:E,referrer:$,connectedAccountProvider:R,isCompleted:S=!1,showCompletedIcon:k=!1,showZeniAccountSection:T=!0,cardPaymentSectionValues:A,onFetchLinkTokenClick:I,onEstablishConnectionClick:B,onUpdatePaymentAccountStatus:L,onEstablishConnectionSuccess:P,resetCardPaymentViewState:D,updateCardPaymentModalState:M,cardSetupInProgress:F=!1}){const V=X(),{trigger:N,formState:H}=t.useFormContext(),{errors:W}=H,U=t.useTheme(),{card_payment_method:Y}=jf.sections,q=e?.institutionDetails,Z=e?.providerVerificationStatus,G=Z?.code,K=e?.isLoginRequired??!1,J=tNo(a,"account"),oe=t.has(W,J),ee=G==="verification_expired"||G==="verification_failed"?Jc.achFailedTitle:Jc.achTitle,[te,se]=g.useState(void 0),ie=r.link_account,re=r.update_account,[ne,me]=g.useState(!1),pe=te==="update_account"?re:ie,[je,ce]=g.useState(pe.linkToken??null),[de,ue]=g.useState(!1),[le,ae]=g.useState(!1),[ge,ye]=g.useState(!1),he=Ye(ie.updateStatus.fetchState),Ce=Ye(re.updateStatus.fetchState),we=Ye(re.fetchStatus.fetchState),ve=Ye(i?.addCardPaymentSourceStatus.fetchState),Ee=g.useRef(void 0),[Se,$e]=g.useState(!1),[Be,Ae]=g.useState(null),_e=Tt=>{Ee.current=Tt},Te=g.useCallback((Tt,Gt)=>{const so=Gt.accounts.find(Xe=>Xe.id===e?.providerAccountId)??Gt.accounts[0];Ae(Gt.link_session_id),b.trackConnectBankSuccess(E,$,Ee.current,Gt.link_session_id??null,so?.id??null,!1,Gt.institution?.name??null);const no=Gt.accounts.find(Xe=>Xe.id===e?.providerAccountId)??Gt.accounts[0];e?.paymentAccountId!=null&&te==="update_account"&&no?.verification_status!=null&&!K?L(no?.verification_status,e.paymentAccountId,"update_account"):B(Tt,te),D?.(),se(void 0),ue(!1)},[b,E,$,e,te,K,D,L,B]),Re=g.useCallback((Tt,Gt)=>{Gt.link_session_id!=null&&Ae(Gt.link_session_id),Tt!=null&&(b.trackConnectBankFailure(E,Tt.error_code+" "+Tt.error_message,$,Ee.current,Number(Tt.error_code),Gt.link_session_id,Gt.request_id,Gt.institution?.name),Tt.error_code==="TOO_MANY_VERIFICATION_ATTEMPTS"&&e?.paymentAccountId!=null&&L("verification_failed",e.paymentAccountId,"update_account"),console.log("Plaid Connection Error",Tt,Gt)),se(void 0),ue(!1)},[b,E,$,e?.paymentAccountId,L]),ke=g.useCallback((Tt,Gt)=>{Tt!=null&&Gt.link_session_id!=null&&Ae(Gt.link_session_id)},[]),{open:Oe,ready:Me}=Pc.usePlaidLink({token:je,onSuccess:Te,onExit:Re,onEvent:ke});g.useEffect(()=>{(he==="In-Progress"&&ie.updateStatus.fetchState==="Completed"||Ce==="In-Progress"&&re.updateStatus.fetchState==="Completed")&&G!=="verified"&&G!=="manually_verified"&&G!=="automatically_verified"&&G!=="database_matched"&&(I("link_account"),P())},[ie.updateStatus.fetchState,P,I,e?.providerVerificationStatus?.code,e?.paymentAccountId,he,Ce,re.updateStatus.fetchState,G]),g.useEffect(()=>{(Q.isVerifiedStatusCode(G??"")||G==="verification_failed")&&!de&&te!=null&&pe.linkToken===je&&pe.fetchStatus.fetchState==="Completed"&&Me&&ue(!0)},[Me,je,pe.fetchStatus.fetchState,pe.linkToken,G,te,de]),g.useEffect(()=>{pe.fetchStatus.fetchState==="Completed"&&pe.linkToken!=null&&pe.linkToken!==je&&ce(pe.linkToken)},[pe.fetchStatus.fetchState,pe.linkToken,je]),g.useEffect(()=>{de&&Oe()},[de,Oe]),g.useEffect(()=>{!e?.zeniAccountId&&!oe&&N(J)},[e?.paymentAccountId]),g.useEffect(()=>{(G==null||G==="verification_failed"||G==="verification_expired"||Q.isVerifiedStatusCode(G))&&(Q.zeniDate(new Date().toISOString()).isAfter(ie.expiration)||ie.linkToken==null)&&I("link_account")},[]),g.useEffect(()=>{const Tt=setTimeout(()=>{$e(!0),me(!0)},500);return()=>clearTimeout(Tt)},[]),g.useEffect(()=>{ve==="In-Progress"&&i?.addCardPaymentSourceStatus.fetchState==="Completed"&&b.trackCreditCardConnectSuccess(E,$,Ee.current)},[i?.addCardPaymentSourceStatus.fetchState]),g.useEffect(()=>{ve==="In-Progress"&&i?.addCardPaymentSourceStatus.fetchState==="Error"&&b.trackCreditCardConnectFailure(E,i?.addCardPaymentSourceStatus.error?.message??"",$,Ee.current)},[i?.addCardPaymentSourceStatus.fetchState]);const Ie=()=>{b.trackConnectBankGetBalance(E,$),se("update_account"),I("update_account",e?.paymentAccountId)},Ne=`${e?.accountSubType?.name!=null?e?.accountSubType?.name.substring(0,1).toUpperCase().concat(e?.accountSubType?.name.substring(1)):""} ${e?.maskedAccountNumber??""}`.trim(),Pe=ie.fetchStatus.fetchState==="In-Progress"||ie.updateStatus.fetchState==="In-Progress",Qe=re.fetchStatus.fetchState==="In-Progress"||re.updateStatus.fetchState==="In-Progress",Je=U.mode==="light"?new t.Color(U.colors.brandColorJadeLight):new t.Color(U.colors.brandColorJadeDark),tt=()=>{ye(!0)},Ue=(Tt,Gt)=>{Tt.stopPropagation(),b.trackConnectBank(E,$,Gt),se("link_account"),_e(Gt),ie.linkToken==null||Q.zeniDate(new Date().toISOString()).isAfter(ie.expiration)?I("link_account"):je!==ie.linkToken?ce(ie.linkToken):de?Oe():ue(!0)},dt=!!(i&&i.bankAccountsList.length>0&&i.cardsList.length===0),ct=i&&i.cardsList.length>0,yt=Pe||F||Qe,He=re.fetchStatus,jt=re.updateStatus;if((E==="onboarding"||E==="billing")&&A!=null&&ct===!0)return t.jsxRuntimeExports.jsx(nl,{title:A.title,subTitle:A.subtitle,header:A.header,subHeader:A.subHeader,isCompleted:A.isCompleted,showCompletedIcon:A.showCompletedIcon,isError:A.isError,icon:A.icon,isLoading:A.isLoading||F,status:A.status,showRightArrow:A.showRightArrow,footNote:t.jsxRuntimeExports.jsx(XFo,{linktext:jf.steps.link_card.footNoteCard.text1,openPlaidDialog:Ue,productType:E,analytics:b,setEventSourceType:_e}),showAddPaymentMethodDropDown:A.showAddPaymentMethodDropDown,isCardPaymentMethod:!0,updateCardPaymentModalState:M,openPlaidDialog:Ue,analytics:b,productType:E,setEventSourceType:_e,referrer:$});if((E==="billing"||E==="onboarding")&&dt&&i&&e==null)return t.jsxRuntimeExports.jsx(mFo,{subscriptionPaymentAccount:i.bankAccountsList[0],sectionId:"billPageSetUpPage",showAddPaymentMethodDropDown:!0,updateCardPaymentModalState:M,openPlaidDialog:Ue,isCardPaymentMethod:!1,analytics:b,referrer:$,productType:E,setEventSourceType:_e,addPaymentMethodDropdownOpen:le,setAddPaymentMethodDropdownOpen:ae,sectionSubHeader:x??Jc.achSubHeader,footNote:t.jsxRuntimeExports.jsx(GD,{linktext:jf.steps.link_card.footNote.text2,updateCardPaymentModalState:M,setEventSourceType:_e,analytics:b,eventSource:"switch_to_credit_card",productType:E,referrer:$})});if(Q.isVerifiedStatusCode(G??"")===!1&&G!=="verification_failed")return t.jsxRuntimeExports.jsx(nl,{onClick:()=>{(G==null||G==="verification_failed"||G==="verification_expired")&&(b.trackConnectBank(E,$,"link_bank_account"),_e("link_bank_account"),Oe())},title:h??ee,subTitle:f??Jc.achSubTitle,header:m??Jc.achHeader,subHeader:x??Jc.achSubHeader,isCompleted:S,showCompletedIcon:k,isError:G==="verification_failed"||G==="verification_expired",footNote:E==="onboarding"||E==="billing"?t.jsxRuntimeExports.jsx(GD,{linktext:jf.steps.link_card.footNote.text1,eventSource:"link_credit_card",updateCardPaymentModalState:M,analytics:b,productType:E,referrer:$,setEventSourceType:_e}):void 0,icon:{element:t.jsxRuntimeExports.jsx(Fs,{width:o.sp3,height:o.sp3}),color:new t.Color(Je)},isLoading:yt,status:Z,isCardPaymentMethod:!1,hasError:u&&e==null,showAddPaymentMethodDropDown:E==="onboarding"||E==="billing"?e!=null:!1,openPlaidDialog:Ue,analytics:b});const St=q&&q.institutionName.length>0?q?.institutionName:e?.accountName??Jc.achTitle,We=q?.zeniInstitutionId.toLowerCase()==="chase",nt=()=>{me(!ne)},ut=E==="onboarding"&&e?.accountName!=null?Y.header:y??Jc.achVerifiedHeader,pt={isBankVerificationBox:ne,paymentAccountStatus:G,paymentAccount:e},Bt=pt.isBankVerificationBox&&G!=="verification_failed"&&e?.providerVerificationStatus?.code==="pending_manual_verification"&&yt===!1,Ht=G!=="verification_failed"&&e?.providerVerificationStatus?.code==="pending_manual_verification",$o=e?.providerVerificationStatus?.code==="pending_automatic_verification"&&Se&&yt===!1;return t.jsxRuntimeExports.jsxs(oNo,{windowSize:V,style:C,children:[ge===!0?Ns.createPortal(t.jsxRuntimeExports.jsx(v8,{connectedAccountProvider:R,action:{onBackClick:()=>ye(!1)}}),document.body):null,t.jsxRuntimeExports.jsxs(hNo,{children:[k===!0?t.jsxRuntimeExports.jsx(jNo,{children:S?t.jsxRuntimeExports.jsx(CNo,{}):t.jsxRuntimeExports.jsx(bNo,{})}):null,t.jsxRuntimeExports.jsxs(gNo,{children:[t.jsxRuntimeExports.jsx(fNo,{windowSize:V,children:ut}),t.jsxRuntimeExports.jsx(yNo,{windowSize:V,children:Jc.achSubHeader})]})]}),t.jsxRuntimeExports.jsxs(xNo,{windowSize:V,isDisabled:K,children:[t.jsxRuntimeExports.jsxs(nNo,{windowSize:V,children:[t.jsxRuntimeExports.jsxs(aNo,{children:[t.jsxRuntimeExports.jsx(Co,{isLoading:yt,customStyle:{marginRight:$l.iconContainerMarginRight.valuePx(V),width:o.sp3,height:o.sp3},children:t.jsxRuntimeExports.jsx(rNo,{isDisabled:K,children:Nve(c,e,!1,Q.isVerifiedStatusCode(G??"")?{flatIconNoBackground:!0}:void 0)})}),t.jsxRuntimeExports.jsxs(ANo,{children:[t.jsxRuntimeExports.jsxs(wNo,{children:[t.jsxRuntimeExports.jsx(Co,{isLoading:yt,customStyle:{marginRight:$l.iconContainerMarginRight.valuePx(V),width:"200px",height:"20px",marginBottom:$l.rowGap.valuePx(V)},children:t.jsxRuntimeExports.jsx(YG,{title:St,isDisabled:K,isError:d,showAddPaymentMethodDropDown:E==="onboarding"||E==="billing",setAddPaymentMethodDropdownOpen:ae,addPaymentMethodDropdownOpen:le,isCardPaymentMethod:!1,openPlaidDialog:Ue,updateCardPaymentModalState:M})}),t.jsxRuntimeExports.jsx(Co,{isLoading:yt,customStyle:{marginRight:$l.iconContainerMarginRight.valuePx(V),width:o.sp12,height:"20px",marginBottom:$l.rowGap.valuePx(V)},children:t.jsxRuntimeExports.jsxs(cNo,{isDisabled:K,children:[Ne?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(uNo,{isDisabled:K,children:Ne}),V!=="small"&&Ht||K||We?t.jsxRuntimeExports.jsx($No,{}):null]}):null,Ht||K||We?t.jsxRuntimeExports.jsx(eNo,{isUpdateLinkClicked:te==="update_account",isLoginRequired:K,isPendingVerification:Ht,fetchAndUpdateStatues:{fetchStatus:re.fetchStatus,updateStatus:re.updateStatus,linkFetchStatus:ie.fetchStatus,linkUpdateStatus:ie.updateStatus,prevFetchState:we,prevUpdateState:Ce},onUpdateLinkTokenClick:Ie,onChaseInfoClick:tt}):null]})})]}),Z!=null&&V==="small"?t.jsxRuntimeExports.jsx(Co,{isLoading:yt||He?.fetchState==="In-Progress"||jt?.fetchState==="In-Progress",customStyle:{marginRight:$l.iconContainerMarginRight.valuePx(V),width:o.sp12,height:`${o.sp4}`,marginLeft:"auto"},children:Ht&&V!=="small"?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(dae,{onClick:()=>{nt()},children:[t.jsxRuntimeExports.jsx(pae,{}),t.jsxRuntimeExports.jsx(mae,{children:jf.sections.link_payment_account.verifyButton}),ne?t.jsxRuntimeExports.jsx(kNo,{}):t.jsxRuntimeExports.jsx(uae,{})]})}):Z!=null?t.jsxRuntimeExports.jsx(ao,{label:Z?.code==="pending_automatic_verification"?"Pending Verification":Z?.name,labelColor:ws(Z.code??"").color.toString(),capsuleBackground:ws(Z.code??"","light","solid").backgroundColor?.toString()}):null}):null]})]}),t.jsxRuntimeExports.jsx(lNo,{children:Ht&&V!=="small"?t.jsxRuntimeExports.jsxs(Co,{isLoading:yt||He?.fetchState==="In-Progress"||jt?.fetchState==="In-Progress",customStyle:{marginLeft:"auto",width:o.sp12,height:o.sp4},children:[t.jsxRuntimeExports.jsxs(dae,{onClick:()=>{nt()},children:[t.jsxRuntimeExports.jsx(pae,{}),t.jsxRuntimeExports.jsx(mae,{children:jf.sections.link_payment_account.verifyButton}),ne?t.jsxRuntimeExports.jsx(INo,{}):t.jsxRuntimeExports.jsx(uae,{})]}),t.jsxRuntimeExports.jsx(ENo,{})]}):Z!=null&&t.jsxRuntimeExports.jsx(Co,{isLoading:yt||He?.fetchState==="In-Progress"||jt?.fetchState==="In-Progress",customStyle:{marginLeft:"auto",width:o.sp12,height:o.sp4},children:t.jsxRuntimeExports.jsx(ao,{label:Z?.code==="pending_automatic_verification"?"Pending Verification":Z?.name,labelColor:ws(Z.code??"").color.toString(),capsuleBackground:ws(Z.code??"","light","solid").backgroundColor?.toString()})})})]}),T?t.jsxRuntimeExports.jsx(Co,{isLoading:yt,customStyle:{marginTop:$l.rowGap.valuePx(V),width:"100%",height:o.sp12},children:t.jsxRuntimeExports.jsx(sNo,{windowSize:V,isDisabled:K,onClick:Tt=>Tt.stopPropagation(),children:t.jsxRuntimeExports.jsx(iNo,{isDisabled:K?"disabled":l,label:{label:Jc.zeniCashAccountLabel,width:V==="small"?void 0:$l.labelWidth.value(V)},style:{borderRadius:o.sp2,border:`1px solid ${U.colors.grey2}`,width:"-webkit-fill-available",display:V==="small"?"block":"inherit"},infoLabelStyle:{textAlign:V==="small"?"left":"right"},singleSelectPickerField:{name:J,placeholder:Jc.zeniCashAccountPlaceholder,style:{position:"relative"},defaultValue:{selectedOption:e?.zeniAccountId??"",allOptions:n.map(Tt=>({label:Tt.accountName,value:Tt.accountId}))},isOptionRemovable:!1,withBorder:V==="small",textAlignment:V==="small"?"left":"right",registerOptions:{required:E!=="zeni_accounts",validate:Tt=>E==="zeni_accounts"||Tt!=null&&!!Tt.selectedOption||l!=null}},valueToAdditionalLabel:()=>Jc.zeniCashAcoountInfo})})}):null,t.jsxRuntimeExports.jsx(BNo,{children:t.jsxRuntimeExports.jsx($zo,{showPlaidVerificationNoticeFlag:$o,linkSessionId:Be})}),t.jsxRuntimeExports.jsx(LNo,{showBankVerification:Bt,children:t.jsxRuntimeExports.jsx(mzo,{onClick:Ie,bankVerificationFlags:pt,linkSessionId:Be})}),t.jsxRuntimeExports.jsx(Co,{isLoading:yt,customStyle:{marginTop:$l.rowGap.valuePx(V),width:"48%",height:o.sp3,marginBottom:o.sp2,marginLeft:o.sp3},children:t.jsxRuntimeExports.jsxs(TNo,{children:[t.jsxRuntimeExports.jsx(GD,{linktext:jf.steps.link_card.footNote.text2,updateCardPaymentModalState:M,setEventSourceType:_e,analytics:b,eventSource:"switch_to_credit_card",productType:E,referrer:$}),Pe?t.jsxRuntimeExports.jsx(Wve,{children:t.jsxRuntimeExports.jsx(Et,{size:"ExtraSmall",start:!0,style:{display:"flex"}})}):null]})})]})]})}const Nve=(e,n,i,r)=>{const a=r?.flatIconNoBackground===!0;return n?.institutionDetails.logo?.base64!=null?a?t.jsxRuntimeExports.jsx(vNo,{src:`${gu}${n?.institutionDetails.logo?.base64}`,alt:n?.institutionDetails.institutionName,loading:"lazy"}):t.jsxRuntimeExports.jsx(RNo,{src:`${gu}${n?.institutionDetails.logo?.base64}`,alt:n?.institutionDetails.institutionName,loading:"lazy"}):i===!0?e.element:a?t.jsxRuntimeExports.jsx(SNo,{children:e.element}):t.jsxRuntimeExports.jsx(mNo,{children:e.element})},eNo=({isLoginRequired:e,isUpdateLinkClicked:n,isPendingVerification:i,fetchAndUpdateStatues:r,onUpdateLinkTokenClick:a,onChaseInfoClick:l})=>{const{verifyAccountError:c,reLogging:d,reLoginLabel:u,reLoginError:m,reLoginMessage:x,chaseLabel:h}=Jc,{fetchStatus:f,updateStatus:y,linkFetchStatus:C,linkUpdateStatus:b,prevFetchState:E,prevUpdateState:$}=r,R=n&&E==="In-Progress"&&f?.fetchState==="Error"||$==="In-Progress"&&y?.fetchState==="Error";return e?n&&(f?.fetchState==="In-Progress"||y?.fetchState==="In-Progress"||C?.fetchState==="In-Progress"||b?.fetchState==="In-Progress")?t.jsxRuntimeExports.jsxs(HE,{style:{color:v.important},children:[t.jsxRuntimeExports.jsx(dNo,{children:d}),t.jsxRuntimeExports.jsx(Wve,{children:t.jsxRuntimeExports.jsx(Et,{size:"Small",start:!0,style:{display:"flex",color:v.important}})})]}):t.jsxRuntimeExports.jsx(HE,{style:{cursor:"pointer"},onClick:a,children:t.jsxRuntimeExports.jsx(Le,{variant:"small-description",data:x,placement:"bottom",maxWidth:"264px",children:t.jsxRuntimeExports.jsxs(pNo,{children:[t.jsxRuntimeExports.jsx(cae,{style:{marginLeft:o.sp0,marginRight:o.sp1}}),t.jsxRuntimeExports.jsx(aae,{isError:!0,style:{color:v.important},children:R?m:u}),t.jsxRuntimeExports.jsx(_A,{children:t.jsxRuntimeExports.jsx(lae,{style:{color:v.important}})})]})})}):i?t.jsxRuntimeExports.jsx(HE,{onClick:a,children:R?t.jsxRuntimeExports.jsx(Le,{variant:"small-description",style:{color:v.important},data:c,placement:"bottom",children:t.jsxRuntimeExports.jsx(cae,{})}):null}):t.jsxRuntimeExports.jsxs(HE,{onClick:l,children:[t.jsxRuntimeExports.jsx(aae,{isError:!1,children:h}),t.jsxRuntimeExports.jsx(_A,{children:t.jsxRuntimeExports.jsx(lae,{})})]})},tNo=(e,n)=>`${e}.${n}`,oNo=s.div`
37097
37097
  display: flex;
37098
37098
  flex-direction: column;
37099
37099
  row-gap: ${e=>$l.rowGap.valuePx(e.windowSize)};
@@ -39791,7 +39791,7 @@ to {
39791
39791
  right: 0;
39792
39792
  height: 1px;
39793
39793
  background-color: ${e=>e.theme.colors.grey3};
39794
- `,eB=5999,tle="taskManagementPage",tu="taskManagementTable",Kh="newGroup",iY="groupData",Tg="taskData",rY="status",aY="priority",lY="dueDate",cY="assignees",dY="tags",R2="groupName",d9="selectedIds",F2="timeSpent",Tb=[{code:"one_time",name:"One-time"},{code:"recurring",name:"Recurring"}],uY=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M3.16016 1.43762H13.7852C14.1289 1.43762 14.1908 1.61325 13.922 1.82825L9.72203 5.18762L13.922 8.547C14.1908 8.762 14.1289 8.93762 13.7852 8.93762H3.16016",fill:"currentColor"}),j.createElement("path",{d:"M3.16016 1.43762H13.7852C14.1289 1.43762 14.1908 1.61325 13.922 1.82825L9.72203 5.18762L13.922 8.547C14.1908 8.762 14.1289 8.93762 13.7852 8.93762H3.16016",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M1.91016 0.812622V15.1876",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),kSe=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M6 10L10 6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M7 4.75686L8.87875 2.88186C9.44291 2.32682 10.2035 2.01719 10.9949 2.02041C11.7864 2.02363 12.5444 2.33945 13.104 2.89907C13.6637 3.45868 13.9795 4.21676 13.9827 5.00817C13.9859 5.79958 13.6763 6.5602 13.1213 7.12436L11.2425 8.99999",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M4.75686 7L2.88186 8.87875C2.32682 9.44291 2.01719 10.2035 2.02041 10.9949C2.02363 11.7864 2.33945 12.5444 2.89907 13.104C3.45868 13.6637 4.21676 13.9795 5.00817 13.9827C5.79958 13.9859 6.5602 13.6763 7.12436 13.1213L8.99999 11.2425",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),ISe="name",Bv="description",uW="status",sb="assignee",Pv="dueDate",pW="priority",Mv="tag",mW="fileIds",rn="taskDetail",ole="taskDetailPage",ZYo="taskType",bf="recurringView",Qy="visibility",Wa=(e,n)=>`${e}.${n}`,nle=e=>`${e}_form`,Ar={controlHeight:new w(p[6],60),height:new w(p[6],p[6]),paddingTopBottom:new w(p[2],p[2]),navBarContainerPaddingXaxis:new w(10,p[3]),marginRight:new w(p[2],p[2]),marginBottom:new w(p[3],p[3]),rowContentPaddingLeft:new w(p[3],p[4]),labelMarginRight:new w(p[3],p[4]),labelMarginTop:new w(p[2],p[2]),containerPaddingLeft:new w(p[3],p[6],p[8]),containerPaddingRight:new w(p[3],p[5],p[5])},{common:Zl,taskManagement:{common:{timeSpentPlaceholder:KYo,timeSpentFormat:JYo},taskDetail:ps},dateFormat:u_,dropDowns:XYo,collaboration:{threads:{placeholder:{addANewComment:eqo,replyAComment:tqo}}}}=O.getLocalizedStrings(),yC=(e,n)=>{switch(e){case"todo":case"urgent":return v.important;case"in_progress":return n?.mode==="light"?v.heroLight:v.heroDark;case"medium":case"normal":return v.info;case"on_hold":return v.taskInHoldLabelColor;case"high":return v.alert;case"done":return v.taskInReviewLabelColor;case"resolved":return v.successDark;default:return v.neutralGrey2Light}},oqo=e=>{switch(e){case"todo":return v.importantLight;case"in_progress":return v.taskInProgressbackgroundLight;case"on_hold":return v.importantLight;case"done":return v.taskInReviewbackgroundColor;case"resolved":return v.successLight;default:return v.neutralGrey3Light}},N2=(e,n)=>{const i=a=>Q.allTaskStatus.find(l=>l.code===a)?.name??"",r=a=>Q.allTaskPriority.find(l=>l.code===a)?.name??"";switch(e){case"todo":case"in_progress":case"on_hold":case"done":case"resolved":return t.jsxRuntimeExports.jsx(ao,{label:i(e),labelColor:yC(e,n),capsuleBackground:oqo(e)});case"urgent":case"high":case"medium":case"low":case"normal":return t.jsxRuntimeExports.jsxs(yqo,{children:[t.jsxRuntimeExports.jsx(jqo,{color:yC(e,n)}),t.jsxRuntimeExports.jsx(Cqo,{children:r(e)})]});default:return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{})}},TSe=XL.map(e=>e.label),u9=e=>e.map(n=>({label:n.name,value:n.tagId,isDeleted:n.isDeleted})),nqo=({taskDetailSelectorView:e,companyName:n,companyId:i,loggedInUser:r,analytics:a,isNewClicked:l,filesEndPoint:c,authParams:d,currentUrl:u,taskId:m,taskGroupList:x,taskGroupName:h,taskDetailFetchState:f,onSaveChangesToLocalStore:y,onSaveDetailClick:C,onArchiveTaskClick:b,onSnoozeTask:E,onUnsnoozeTask:$,onDismissClick:R,handleZeniLogoClick:S,updateFilesEntity:k,onDeleteFile:T,onEditFileName:A,onDeleteTaskClick:I,onReloadTaskDetailPage:B,tagListView:L,userGroupList:P,onCreateTagClick:D,onDeleteTagClick:M,cannedResponses:F,initialOpenThreadRequest:V,isCannedResponsesLoading:N,isTaskCannedResponsesEnabled:H,isTaskGroupAssigneesEnabled:W,isTaskRecurringParentEnabled:U,isTaskSnoozeEnabled:Y,isTaskVisibilityEnabled:q,isZeniUser:Z,onFetchCannedResponses:G,onManageTemplatesClick:K,recurringSourceTaskUrl:J})=>{const oe=X(),ee=t.useTheme(),te=new w(80,100,120).value(oe),se=Ye(e.taskDetailView.saveStatus.fetchState),ie=Ye(e.taskDetailView.deleteTaskStatus.fetchState),re=e.taskDetailView.saveStatus.fetchState,ne=e.taskDetailView.deleteTaskStatus.fetchState,me=Ye(e.taskDetailView.taskId),pe=Ye(e.taskDetailView.archiveStatus.fetchState),je=e.taskDetailView.archiveStatus.fetchState,ce=Ye(e.taskDetailView.snoozeStatus.fetchState),de=e.taskDetailView.snoozeStatus.fetchState,ue=Ye(L.tagCreateStatus.fetchState),le=L.tagCreateStatus.fetchState,ae=L.tagDeleteStatusById,ge=()=>{const He=Object.keys(ae);for(let jt=0;jt<He.length;jt++)if(ae[He[jt]].fetchState==="In-Progress")return!0;return!1};g.useEffect(()=>{if(se==="In-Progress"&&re==="Completed"||ie==="In-Progress"&&ne==="Completed"||pe==="In-Progress"&&je==="Completed"||ce==="In-Progress"&&de==="Completed"){const{taskId:He,taskDetailLocalData:jt}=e.taskDetailView;if(me==null&&He!=null&&r.userEmail!=null){const{name:St,description:We,status:nt,assignee:ut,dueDate:pt,priority:Bt,tagIds:Ht,fileIds:$o}=jt;a.trackTaskCreated({tenantName:n,newButtonClicked:l,taskId:He,activity:{count:Ne.formState.dirtyFields[rn]!=null?Object.keys(Ne.formState.dirtyFields[rn]).length:0,details:{name:St,description:We,status:nt,priority:Bt,tags:Ht,assignees:dt.filter(Tt=>ut.includes(Tt.userId)).map(Tt=>({name:Tt.firstName.concat(Zl.strings.space,Tt.lastName).trim(),email:Tt.email})),dueDate:pt?.format(u_.analytics.YYYYDashMMDashDDFormat)??null,numberOfAttachments:$o.length}},createdBy:{name:r.firstName!=null?r.firstName.concat(Zl.strings.space,r.lastName??Zl.strings.empty).trim():r.lastName??Zl.strings.empty,email:r.userEmail}})}R()}},[se,re,ie,ne,pe,je,ce,de,R]);const[,ye]=al(),[he,Ce]=g.useState(!1),[we,ve]=g.useState(null),[Ee,Se]=g.useState(!0),[$e,Be]=g.useState("comments"),[Ae,_e]=g.useState(void 0),[Te,Re]=g.useState(!1),ke=()=>{ye(u),Ce(!0)};g.useEffect(()=>{he===!0&&setTimeout(()=>{Ce(!1)},800)},[he]);const{threads:Oe,fetchMore:Me}=Ps.useThreads({query:{metadata:{entityType:"task.details",tab:"task",application:"dashboard",entityId:m??Zl.all}}});g.useEffect(()=>{const He=setTimeout(()=>Me?.(),0);return()=>clearTimeout(He)});const Ie=Oe?.length??0,Ne=t.useForm({mode:"all",reValidateMode:"onBlur",defaultValues:sle(e,L,P,W===!0),values:sle(e,L,P,W===!0),resetOptions:{keepDirtyValues:!0,keepErrors:!0}});g.useEffect(()=>{(ue==="In-Progress"&&le==="Completed"||ge())&&Ne.resetField(`${rn}.${Mv}`,{defaultValue:{selectedOptions:Qe.tagIds,allOptions:u9(L.tagList)}})},[ue,le,L.tagList.length,ae]);const Pe=async(He,jt)=>{if(He!=null){const St={...jt};let We={name:St[rn].name,description:St[rn][Bv],status:St[rn][uW].selectedOption,assignee:St[rn][sb].selectedUsers.map(nt=>nt.userId),groupAssignees:W===!0?St[rn][sb].selectedUserGroups?.map(nt=>nt.userGroupId)??[]:[],dueDate:St[rn][Pv]!=null?Q.zeniDate(St[rn][Pv].toString()):void 0,priority:St[rn][pW].selectedOption,tagIds:St[rn][Mv].selectedOptions,type:Tb.find(nt=>{const ut=St[rn]?.taskType?.selectedOption;return nt.name===ut||typeof ut=="string"&&ut.includes(nt.name)})??{code:"one_time",name:"One-time"},recurringEndDateLocalData:{recurringEndDate:St[rn][bf]?.selectedEndDate?.date,recurringDatePickerOptionsType:St[rn][bf]?.selectedEndDate?.type,recurringCount:St[rn][bf]?.selectedEndDate?.recurringCount},recurringFrequency:lSe(St[rn][bf]?.selectedFrequency?.selectedOption),recurringDaysOfWeek:e.taskDetailView.taskDetailLocalData.recurringDaysOfWeek,recurringStartDate:St[rn][bf]?.selectedStartDate!=null?Q.zeniDate(St[rn][bf].selectedStartDate.toDateString()):Q.dateNow(),fileIds:St[rn][mW].filter(nt=>nt!=null).map(nt=>nt.fileId).filter(nt=>nt!=null),timeSpent:St[rn].timeSpent,...e.taskDetailView.taskId==null&&q===!0?{isPrivate:Z!==!0?!1:St[rn][Qy]==="private"?!0:St[rn][Qy]==="public"?!1:void 0}:{}};He.includes("selectedEndDate.date")?We={...We,recurringEndDateLocalData:{...We.recurringEndDateLocalData,recurringDatePickerOptionsType:"date"}}:He.includes("selectedEndDate.recurringCount")?We={...We,recurringEndDateLocalData:{...We.recurringEndDateLocalData,recurringDatePickerOptionsType:"recurringCount"}}:He.includes("selectedFrequency")&&Qe.savedRecurringTasksCount!=null&&Qe.recurringEndDateLocalData.recurringDatePickerOptionsType==="recurringCount"&&(We={...We,recurringEndDateLocalData:{recurringCount:0,recurringDatePickerOptionsType:void 0,recurringEndDate:void 0}}),y(We)}};g.useEffect(()=>{Ne.register(Wa(rn,Bv),{required:!0,validate:He=>He!=null})},[]),g.useEffect(()=>{const He=Ne.watch((jt,{name:St})=>{if(St!=null&&jt!=null){if(St.includes("taskGroup")&&x!=null){const We=jt?.taskGroup?.selectedOption,nt=x.find(ut=>ut.name===We);nt!=null&&_e(nt.id);return}t.defer(()=>Pe(St,jt))}});return()=>{He.unsubscribe()}});const Ue=Ne.handleSubmit(()=>{const{taskDetailView:{taskId:He,taskDetailLocalData:jt},createdByUser:St}=e;if(jt.type.code==="recurring"&&jt.recurringFrequency==="semi_weekly"&&(jt.recurringDaysOfWeek?.length??0)!==Q.SEMI_WEEKLY_REQUIRED_DAYS_COUNT){Re(!0);return}if(Re(!1),He!=null&&St!=null&&r.userEmail!=null){const{name:We,description:nt,status:ut,assignee:pt,dueDate:Bt,priority:Ht,tagIds:$o,fileIds:Tt}=jt;a.trackTaskEdited({tenantName:n,taskId:He,activity:{count:Ne.formState.dirtyFields[rn]!=null?Object.keys(Ne.formState.dirtyFields[rn]).length:0,details:{name:We,description:nt,status:ut,priority:Ht,tags:$o,assignees:dt.filter(Gt=>pt.includes(Gt.userId)).map(Gt=>({name:Gt.firstName.concat(Zl.strings.space,Gt.lastName).trim(),email:Gt.email})),dueDate:Bt?.format(u_.analytics.YYYYDashMMDashDDFormat)??null,numberOfAttachments:Tt.length},byUser:{name:r.firstName!=null?r.firstName.concat(Zl.strings.space,r.lastName??Zl.strings.empty).trim():r.lastName??Zl.strings.empty,email:r.userEmail}},createdBy:{name:St.user.firstName.concat(Zl.strings.space,St.user.lastName).trim(),email:St.user.email},commentsCreated:Ie>0})}C(Ae)}),Je=()=>{let He=e.taskDetailView.taskDetailLocalData,jt=He.recurringEndDateLocalData?.recurringEndDate;He.recurringEndDateLocalData?.recurringDatePickerOptionsType==="recurringCount"&&He.recurringStartDate!=null&&He.recurringFrequency!=null&&He.recurringEndDateLocalData.recurringCount!=null&&(jt=Q.getRecurringEndDateFromCount(He.recurringStartDate,Q.toRecurringFrequency(He.recurringFrequency.toLocaleLowerCase()),He.recurringEndDateLocalData.recurringCount)),He={...He,savedRecurringEndDate:jt,savedRecurringTasksCount:He.recurringEndDateLocalData.recurringCount,recurringEndDateLocalData:{...He.recurringEndDateLocalData,recurringEndDate:jt}},y(He)},tt=()=>{let He=e.taskDetailView.taskDetailLocalData;He={...He,recurringEndDateLocalData:{...He.recurringEndDateLocalData,recurringEndDate:He.savedRecurringEndDate,recurringCount:He.savedRecurringTasksCount}},y(He)},Qe=e.taskDetailView.taskDetailLocalData,dt=e.userList.users.map(He=>He.user).filter(Boolean),ct=e.taskDetailView.taskId!=null&&me!=null,yt=He=>t.jsxRuntimeExports.jsx(ao,{label:`${XYo.createOption} "${He}"`,labelColor:yC("in_progress",ee)});return t.jsxRuntimeExports.jsx(t.FormProvider,{...Ne,children:t.jsxRuntimeExports.jsxs(uqo,{windowSize:oe,children:[t.jsxRuntimeExports.jsxs(mqo,{windowSize:oe,children:[t.jsxRuntimeExports.jsxs(gqo,{children:[t.jsxRuntimeExports.jsx(hqo,{onClick:R}),t.jsxRuntimeExports.jsx(fqo,{children:t.jsxRuntimeExports.jsx(Vl,{type:"text",placeholderAlignment:"left",name:Wa(rn,ISe),defaultValue:Qe.name,placeholder:ps.taskNamePlaceholder,style:{padding:`${o.sp1} ${o.sp0}`,background:"transparent",textAlign:"left",flexGrow:1,minWidth:0,cursor:"text",fontWeight:600,fontSize:"16px"},registerOptions:{required:!0,validate:He=>He!=null}})}),Qe.type.code==="recurring"?t.jsxRuntimeExports.jsx(Dqo,{height:o.sp3,width:o.sp3}):null,U===!0&&J!=null?t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:t.jsxRuntimeExports.jsx(e7,{children:ps.viewParentTask}),enterDelay:600,children:t.jsxRuntimeExports.jsx(kqo,{onClick:()=>window.open(J,"_blank")})}):null]}),t.jsxRuntimeExports.jsxs(xqo,{windowSize:oe,children:[ct?t.jsxRuntimeExports.jsx(WE,{children:t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:t.jsxRuntimeExports.jsx(e7,{children:he?t.jsxRuntimeExports.jsxs(Tqo,{children:[t.jsxRuntimeExports.jsx(Iqo,{}),Zl.copyToClipBoard.copied]}):Zl.copyToClipBoard.copy}),enterDelay:600,children:t.jsxRuntimeExports.jsx(bqo,{onClick:ke})})}):null,ct?t.jsxRuntimeExports.jsx(WE,{children:t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:t.jsxRuntimeExports.jsx(e7,{children:ps.archiveTooltip}),enterDelay:600,children:t.jsxRuntimeExports.jsx(wqo,{onClick:b})})}):null,ct?t.jsxRuntimeExports.jsx(WE,{children:t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:t.jsxRuntimeExports.jsx(e7,{children:ps.deleteTooltip}),enterDelay:600,children:t.jsxRuntimeExports.jsx(Eqo,{onClick:I})})}):null,Y===!0&&ct&&e.snoozedUntil!=null?t.jsxRuntimeExports.jsxs(vqo,{onClick:He=>ve(He.currentTarget),children:[t.jsxRuntimeExports.jsx(Sqo,{}),t.jsxRuntimeExports.jsx(Aqo,{children:ps.snoozedUntilBanner.replace("_date_",e.snoozedUntil.format("MMM D, h:mm A"))})]}):null,Y===!0&&ct&&e.snoozedUntil==null?t.jsxRuntimeExports.jsx(WE,{children:t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:t.jsxRuntimeExports.jsx(e7,{children:ps.snoozeTooltip}),enterDelay:600,children:t.jsxRuntimeExports.jsx($qo,{onClick:He=>ve(He.currentTarget),children:t.jsxRuntimeExports.jsx(Rqo,{$isSnoozed:!1})})})}):null]})]}),t.jsxRuntimeExports.jsx(cSe,{anchorEl:we,onClose:()=>ve(null),onSnooze:He=>{m!=null&&E(m,He)},onUnsnooze:e.snoozedUntil!=null&&m!=null?()=>$(m):void 0}),f==="In-Progress"||f==="Not-Started"&&m!=null?t.jsxRuntimeExports.jsx(zYo,{}):e.fetchState==="Error"?t.jsxRuntimeExports.jsxs(Lqo,{children:[t.jsxRuntimeExports.jsx(Bqo,{onClick:B,children:t.jsxRuntimeExports.jsx(Pqo,{})}),t.jsxRuntimeExports.jsx(Mqo,{children:Zl.reloadPage.label})]}):t.jsxRuntimeExports.jsxs(cqo,{windowSize:oe,children:[t.jsxRuntimeExports.jsxs(aqo,{children:[t.jsxRuntimeExports.jsx(rqo,{windowSize:oe,children:t.jsxRuntimeExports.jsxs("form",{id:nle(ole),onSubmit:Ue,children:[t.jsxRuntimeExports.jsx(Hqo,{}),t.jsxRuntimeExports.jsx(IYo,{initialValue:Qe.description,placeholder:ps.descriptionPlaceholder,onChange:He=>{Ne.setValue(Wa(rn,Bv),He,{shouldDirty:!0})}}),t.jsxRuntimeExports.jsxs(_qo,{onClick:()=>Se(He=>!He),children:[t.jsxRuntimeExports.jsx(Oqo,{children:ps.viewDetailsLabel}),t.jsxRuntimeExports.jsx(zqo,{$isExpanded:Ee})]}),t.jsxRuntimeExports.jsx(t.Collapse,{in:Ee,timeout:300,children:t.jsxRuntimeExports.jsxs(pqo,{children:[t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsx(Bs,{label:{label:ps.statusLabel,width:te},style:{width:"100%"},singleSelectPickerField:{valueToLabel:He=>N2(He,ee),name:Wa(rn,uW),placeholder:ps.statusPlaceholder,style:{position:"relative"},capitalizeOptions:!0,defaultValue:{selectedOption:Qe.status,allOptions:Q.allTaskStatus.map(He=>({label:He.name,value:He.code}))},textAlignment:"right",registerOptions:{required:!0,validate:He=>He?.selectedOption!=null}}})}),t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsxs(Wqo,{windowSize:oe,children:[t.jsxRuntimeExports.jsx(Ft,{label:ps.assigneeLabel,htmlFor:Wa(rn,sb),style:{marginRight:Ar.labelMarginRight.value(oe),marginTop:Ar.labelMarginTop.value(oe),width:te}}),t.jsxRuntimeExports.jsx(Vqo,{children:t.jsxRuntimeExports.jsx(oY,{placeholderLabel:ps.assigneePlaceholder,name:Wa(rn,sb),value:{allUsers:dt,selectedUsers:dt.filter(He=>Qe.assignee.includes(He.userId)),allUserGroups:W===!0?P:[],selectedUserGroups:W===!0?P.filter(He=>Qe.groupAssignees.includes(He.userGroupId)):[]},registerOptions:{required:!0,validate:He=>He!=null&&(He.selectedUsers.length>0||(He.selectedUserGroups?.length??0)>0)}})})]})}),t.jsxRuntimeExports.jsx(Fqo,{children:t.jsxRuntimeExports.jsx(CGo,{label:{label:ps.tagLabel,width:te},style:{width:"100%"},creatableMultiSelectField:{name:Wa(rn,Mv),placeholder:ps.tagPlaceholder,defaultValue:{selectedOptions:Qe.tagIds,allOptions:u9(L.tagList)},registerOptions:{required:!1},isLoading:le==="In-Progress"||ge(),onCreateOption:D,onDeleteOption:M,customCreateLabel:He=>yt(He)}})}),t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsx(Bs,{label:{label:ps.priorityLabel,width:te},style:{width:"100%"},singleSelectPickerField:{valueToLabel:He=>N2(He,ee),name:Wa(rn,pW),placeholder:ps.priorityPlaceholder,style:{position:"relative"},capitalizeOptions:!0,defaultValue:{selectedOption:Qe.priority,allOptions:Q.allTaskPriority.map(He=>({label:He.name,value:He.code}))},textAlignment:"right",registerOptions:{required:!0,validate:He=>He?.selectedOption!=null}}})}),t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsx(Pr,{label:{label:ps.dueDateLabel,width:te},style:{width:"100%"},dateField:{name:Wa(rn,Pv),placeholder:ps.dueDatePlaceholder,defaultValue:Qe.dueDate,dateFormat:u_.visual.defaultInput,minDate:Q.dateNow(),autoComplete:"off",registerOptions:{required:!0}}})}),t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsx(vGo,{name:Wa(rn,F2),placeholder:KYo,timeSpentFormat:JYo,defaultValue:Qe.timeSpent,label:{label:ps.totalTimeSpent,width:te},registerOptions:{validate:He=>Q.convertHHMMStrToMinutes(He)>eB?Zl.snackBar.task_time_spent_validation.failed:!0},style:{width:"auto",border:"none",outline:"none"}})}),Z===!0&&q===!0?t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsxs(Qqo,{windowSize:oe,children:[t.jsxRuntimeExports.jsx(Ft,{label:ps.visibilityLabel,htmlFor:Wa(rn,Qy),style:{marginRight:Ar.labelMarginRight.value(oe),marginTop:Ar.labelMarginTop.value(oe),width:te}}),t.jsxRuntimeExports.jsxs(dqo,{children:[t.jsxRuntimeExports.jsx(Bo,{radioField:{name:Wa(rn,Qy),id:`${rn}-visibility-public`,value:"public",checked:Qe.isPrivate===!1,style:{height:o.sp3,width:o.sp3},radioSize:"small",registerOptions:{required:ps.visibilityRequired}},label:{label:ps.visibilityPublic},isContainerClickable:!0,isDisabled:ct?"readonly":void 0,style:{paddingRight:o.sp4,width:"auto",border:"none"}}),t.jsxRuntimeExports.jsx(Bo,{radioField:{name:Wa(rn,Qy),id:`${rn}-visibility-private`,value:"private",checked:Qe.isPrivate===!0,style:{height:o.sp3,width:o.sp3},radioSize:"small",registerOptions:{required:ps.visibilityRequired}},label:{label:ps.visibilityPrivate},isContainerClickable:!0,isDisabled:ct?"readonly":void 0,style:{width:"auto",border:"none"}})]})]})}):t.jsxRuntimeExports.jsx(Jm,{}),t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsx(Bs,{label:{label:ps.groupLabel,width:te},style:{width:"100%"},singleSelectPickerField:{name:"taskGroup",isSearchable:!0,placeholder:"Select group",defaultValue:{selectedOption:h??x?.find(He=>He.isDefault)?.name??"All Other Tasks",allOptions:x?.map(He=>({label:He.name,value:He.name}))??[{label:h??"All Other Tasks",value:h??"All Other Tasks"}]},textAlignment:"right"}})},`group-${x?.length??0}`),t.jsxRuntimeExports.jsx(LSe,{children:t.jsxRuntimeExports.jsx(tL,{label:{label:ps.taskTypeLabel,width:te},singleSelectField:{name:Wa(rn,ZYo),defaultValue:{selectedOption:Tb.find(He=>He.code===Qe.type.code)?.name,allOptions:Tb.map(He=>He.name)}},style:{width:"auto",border:"none",outline:"none"}})}),Qe.type.code==="recurring"?t.jsxRuntimeExports.jsx(Nqo,{children:t.jsxRuntimeExports.jsx(HGo,{name:Wa(rn,bf),startMinDate:Q.dateNow(),recurringView:{selectedEndDate:{type:Qe.recurringEndDateLocalData?.recurringDatePickerOptionsType,date:Qe.recurringEndDateLocalData?.recurringEndDate,recurringCount:Qe.recurringEndDateLocalData?.recurringCount},selectedFrequency:{allOptions:TSe,selectedOption:XL.find(He=>He.value===Qe.recurringFrequency)?.label},selectedStartDate:Qe.recurringStartDate?.toDate()??Q.dateNow().toDate(),selectedDaysOfWeek:Qe.recurringDaysOfWeek},recurringCountInputLabel:ps.totalNumberOfTasks,onClickSave:Je,onClickCancel:tt,showDaysOfWeekError:Te,onDaysOfWeekChange:He=>{y({...Qe,recurringDaysOfWeek:He}),He.length===Q.SEMI_WEEKLY_REQUIRED_DAYS_COUNT&&Re(!1)}})}):null]})}),t.jsxRuntimeExports.jsx(UGo,{sectionId:Wa(rn,mW),deleteFileStatusById:e.deleteFileStatusById,updateFileStatusById:e.updateFileStatusById,filesEndPoint:c,authParams:d,files:e.files,updateFilesEntity:k,onEditFileName:A,onDeleteFile:T})]})}),m==null||e.showTaskDetailFormFooter?t.jsxRuntimeExports.jsx(_t,{style:{zIndex:1,paddingTop:o.sp3,paddingBottom:o.sp3},formId:nle(ole),helperStyle:{paddingTop:o.sp0,paddingBottom:o.sp0},primaryBtn:{label:ps.primaryBtnText,isLoading:e.taskDetailView.saveStatus.fetchState==="In-Progress"},cancelBtn:{label:ps.secondaryBtnText,onClick:R}}):null]}),t.jsxRuntimeExports.jsxs(lqo,{children:[t.jsxRuntimeExports.jsx(_c,{allTabs:[{id:"comments",label:ps.commentsSectionTitle,countDetails:Ie>0?{count:Ie,isFetching:!1}:void 0},{id:"activity",label:ps.activitySectionTitle}],selectedTab:$e,onTabChange:He=>Be(He.id)}),t.jsxRuntimeExports.jsx(Uqo,{children:$e==="comments"?ct?t.jsxRuntimeExports.jsx(DUo,{autoExpand:!0,autoFocus:!1,cannedResponses:Z===!0&&H===!0?F:void 0,isCannedResponsesLoading:N,onFetchCannedResponses:Z===!0&&H===!0?G:void 0,onManageTemplatesClick:Z===!0&&H===!0?K:void 0,initialScrollToThreadId:V?.threadId,threadMetadata:{companyName:n,companyId:i,entityId:e.taskDetailView.taskId,entityType:"task.details",isGlobalComment:!0,application:"dashboard",tab:"task",url:window.location.href},textOverrides:{composerPlaceholder:eqo,replyComposerPlaceholder:tqo},filter:{entityType:"task.details",entityId:e.taskDetailView.taskId},threadsContainerStyle:{width:"auto",padding:o.sp5},threadStyle:{width:"100%"},composerContainerStyle:{width:"auto",padding:o.sp5},onThreadClick:()=>null}):t.jsxRuntimeExports.jsx(sqo,{children:t.jsxRuntimeExports.jsx(iqo,{children:ps.taskCommentCreationMessage})}):t.jsxRuntimeExports.jsx(Gqo,{children:t.jsxRuntimeExports.jsx(SQ,{historicActivities:e.taskHistory})})})]})]})]})})},sqo=s.div`
39794
+ `,eB=5999,tle="taskManagementPage",tu="taskManagementTable",Kh="newGroup",iY="groupData",Tg="taskData",rY="status",aY="priority",lY="dueDate",cY="assignees",dY="tags",R2="groupName",d9="selectedIds",F2="timeSpent",Tb=[{code:"one_time",name:"One-time"},{code:"recurring",name:"Recurring"}],uY=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M3.16016 1.43762H13.7852C14.1289 1.43762 14.1908 1.61325 13.922 1.82825L9.72203 5.18762L13.922 8.547C14.1908 8.762 14.1289 8.93762 13.7852 8.93762H3.16016",fill:"currentColor"}),j.createElement("path",{d:"M3.16016 1.43762H13.7852C14.1289 1.43762 14.1908 1.61325 13.922 1.82825L9.72203 5.18762L13.922 8.547C14.1908 8.762 14.1289 8.93762 13.7852 8.93762H3.16016",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M1.91016 0.812622V15.1876",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),kSe=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M6 10L10 6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M7 4.75686L8.87875 2.88186C9.44291 2.32682 10.2035 2.01719 10.9949 2.02041C11.7864 2.02363 12.5444 2.33945 13.104 2.89907C13.6637 3.45868 13.9795 4.21676 13.9827 5.00817C13.9859 5.79958 13.6763 6.5602 13.1213 7.12436L11.2425 8.99999",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M4.75686 7L2.88186 8.87875C2.32682 9.44291 2.01719 10.2035 2.02041 10.9949C2.02363 11.7864 2.33945 12.5444 2.89907 13.104C3.45868 13.6637 4.21676 13.9795 5.00817 13.9827C5.79958 13.9859 6.5602 13.6763 7.12436 13.1213L8.99999 11.2425",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),ISe="name",Bv="description",uW="status",sb="assignee",Pv="dueDate",pW="priority",Mv="tag",mW="fileIds",rn="taskDetail",ole="taskDetailPage",ZYo="taskType",bf="recurringView",Qy="visibility",Wa=(e,n)=>`${e}.${n}`,nle=e=>`${e}_form`,Ar={controlHeight:new w(p[6],60),height:new w(p[6],p[6]),paddingTopBottom:new w(p[2],p[2]),navBarContainerPaddingXaxis:new w(10,p[3]),marginRight:new w(p[2],p[2]),marginBottom:new w(p[3],p[3]),rowContentPaddingLeft:new w(p[3],p[4]),labelMarginRight:new w(p[3],p[4]),labelMarginTop:new w(p[2],p[2]),containerPaddingLeft:new w(p[3],p[6],p[8]),containerPaddingRight:new w(p[3],p[5],p[5])},{common:Zl,taskManagement:{common:{timeSpentPlaceholder:KYo,timeSpentFormat:JYo},taskDetail:ps},dateFormat:u_,dropDowns:XYo,collaboration:{threads:{placeholder:{addANewComment:eqo,replyAComment:tqo}}}}=O.getLocalizedStrings(),yC=(e,n)=>{switch(e){case"todo":case"urgent":return v.important;case"in_progress":return n?.mode==="light"?v.heroLight:v.heroDark;case"medium":case"normal":return v.info;case"on_hold":return v.taskInHoldLabelColor;case"high":return v.alert;case"done":return v.taskInReviewLabelColor;case"resolved":return v.successDark;default:return v.neutralGrey2Light}},oqo=e=>{switch(e){case"todo":return v.importantLight;case"in_progress":return v.taskInProgressbackgroundLight;case"on_hold":return v.importantLight;case"done":return v.taskInReviewbackgroundColor;case"resolved":return v.successLight;default:return v.neutralGrey3Light}},N2=(e,n)=>{const i=a=>Q.allTaskStatus.find(l=>l.code===a)?.name??"",r=a=>Q.allTaskPriority.find(l=>l.code===a)?.name??"";switch(e){case"todo":case"in_progress":case"on_hold":case"done":case"resolved":return t.jsxRuntimeExports.jsx(ao,{label:i(e),labelColor:yC(e,n),capsuleBackground:oqo(e)});case"urgent":case"high":case"medium":case"low":case"normal":return t.jsxRuntimeExports.jsxs(yqo,{children:[t.jsxRuntimeExports.jsx(jqo,{color:yC(e,n)}),t.jsxRuntimeExports.jsx(Cqo,{children:r(e)})]});default:return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{})}},TSe=XL.map(e=>e.label),u9=e=>e.map(n=>({label:n.name,value:n.tagId,isDeleted:n.isDeleted})),nqo=({taskDetailSelectorView:e,companyName:n,companyId:i,loggedInUser:r,analytics:a,isNewClicked:l,filesEndPoint:c,authParams:d,currentUrl:u,taskId:m,taskGroupList:x,taskGroupName:h,taskDetailFetchState:f,onSaveChangesToLocalStore:y,onSaveDetailClick:C,onArchiveTaskClick:b,onSnoozeTask:E,onUnsnoozeTask:$,onDismissClick:R,handleZeniLogoClick:S,updateFilesEntity:k,onDeleteFile:T,onEditFileName:A,onDeleteTaskClick:I,onReloadTaskDetailPage:B,tagListView:L,userGroupList:P,onCreateTagClick:D,onDeleteTagClick:M,cannedResponses:F,initialOpenThreadRequest:V,isCannedResponsesLoading:N,isTaskCannedResponsesEnabled:H,isTaskGroupAssigneesEnabled:W,isTaskRecurringParentEnabled:U,isTaskSnoozeEnabled:Y,isTaskVisibilityEnabled:q,isZeniUser:Z,onFetchCannedResponses:G,onManageTemplatesClick:K,recurringSourceTaskUrl:J})=>{const oe=X(),ee=t.useTheme(),te=new w(80,100,120).value(oe),se=Ye(e.taskDetailView.saveStatus.fetchState),ie=Ye(e.taskDetailView.deleteTaskStatus.fetchState),re=e.taskDetailView.saveStatus.fetchState,ne=e.taskDetailView.deleteTaskStatus.fetchState,me=Ye(e.taskDetailView.taskId),pe=Ye(e.taskDetailView.archiveStatus.fetchState),je=e.taskDetailView.archiveStatus.fetchState,ce=Ye(e.taskDetailView.snoozeStatus.fetchState),de=e.taskDetailView.snoozeStatus.fetchState,ue=Ye(L.tagCreateStatus.fetchState),le=L.tagCreateStatus.fetchState,ae=L.tagDeleteStatusById,ge=()=>{const He=Object.keys(ae);for(let jt=0;jt<He.length;jt++)if(ae[He[jt]].fetchState==="In-Progress")return!0;return!1};g.useEffect(()=>{if(se==="In-Progress"&&re==="Completed"||ie==="In-Progress"&&ne==="Completed"||pe==="In-Progress"&&je==="Completed"||ce==="In-Progress"&&de==="Completed"){const{taskId:He,taskDetailLocalData:jt}=e.taskDetailView;if(me==null&&He!=null&&r.userEmail!=null){const{name:St,description:We,status:nt,assignee:ut,dueDate:pt,priority:Bt,tagIds:Ht,fileIds:$o}=jt;a.trackTaskCreated({tenantName:n,newButtonClicked:l,taskId:He,activity:{count:Ne.formState.dirtyFields[rn]!=null?Object.keys(Ne.formState.dirtyFields[rn]).length:0,details:{name:St,description:We,status:nt,priority:Bt,tags:Ht,assignees:dt.filter(Tt=>ut.includes(Tt.userId)).map(Tt=>({name:Tt.firstName.concat(Zl.strings.space,Tt.lastName).trim(),email:Tt.email})),dueDate:pt?.format(u_.analytics.YYYYDashMMDashDDFormat)??null,numberOfAttachments:$o.length}},createdBy:{name:r.firstName!=null?r.firstName.concat(Zl.strings.space,r.lastName??Zl.strings.empty).trim():r.lastName??Zl.strings.empty,email:r.userEmail}})}R()}},[se,re,ie,ne,pe,je,ce,de,R]);const[,ye]=al(),[he,Ce]=g.useState(!1),[we,ve]=g.useState(null),[Ee,Se]=g.useState(!0),[$e,Be]=g.useState("comments"),[Ae,_e]=g.useState(void 0),[Te,Re]=g.useState(!1),ke=()=>{ye(u),Ce(!0)};g.useEffect(()=>{he===!0&&setTimeout(()=>{Ce(!1)},800)},[he]);const{threads:Oe,fetchMore:Me}=Ps.useThreads({query:{metadata:{entityType:"task.details",tab:"task",application:"dashboard",entityId:m??Zl.all}}});g.useEffect(()=>{const He=setTimeout(()=>Me?.(),0);return()=>clearTimeout(He)});const Ie=Oe?.length??0,Ne=t.useForm({mode:"all",reValidateMode:"onBlur",defaultValues:sle(e,L,P,W===!0),values:sle(e,L,P,W===!0),resetOptions:{keepDirtyValues:!0,keepErrors:!0}});g.useEffect(()=>{(ue==="In-Progress"&&le==="Completed"||ge())&&Ne.resetField(`${rn}.${Mv}`,{defaultValue:{selectedOptions:Ue.tagIds,allOptions:u9(L.tagList)}})},[ue,le,L.tagList.length,ae]);const Pe=async(He,jt)=>{if(He!=null){const St={...jt};let We={name:St[rn].name,description:St[rn][Bv],status:St[rn][uW].selectedOption,assignee:St[rn][sb].selectedUsers.map(nt=>nt.userId),groupAssignees:W===!0?St[rn][sb].selectedUserGroups?.map(nt=>nt.userGroupId)??[]:[],dueDate:St[rn][Pv]!=null?Q.zeniDate(St[rn][Pv].toString()):void 0,priority:St[rn][pW].selectedOption,tagIds:St[rn][Mv].selectedOptions,type:Tb.find(nt=>{const ut=St[rn]?.taskType?.selectedOption;return nt.name===ut||typeof ut=="string"&&ut.includes(nt.name)})??{code:"one_time",name:"One-time"},recurringEndDateLocalData:{recurringEndDate:St[rn][bf]?.selectedEndDate?.date,recurringDatePickerOptionsType:St[rn][bf]?.selectedEndDate?.type,recurringCount:St[rn][bf]?.selectedEndDate?.recurringCount},recurringFrequency:lSe(St[rn][bf]?.selectedFrequency?.selectedOption),recurringDaysOfWeek:e.taskDetailView.taskDetailLocalData.recurringDaysOfWeek,recurringStartDate:St[rn][bf]?.selectedStartDate!=null?Q.zeniDate(St[rn][bf].selectedStartDate.toDateString()):Q.dateNow(),fileIds:St[rn][mW].filter(nt=>nt!=null).map(nt=>nt.fileId).filter(nt=>nt!=null),timeSpent:St[rn].timeSpent,...e.taskDetailView.taskId==null&&q===!0?{isPrivate:Z!==!0?!1:St[rn][Qy]==="private"?!0:St[rn][Qy]==="public"?!1:void 0}:{}};He.includes("selectedEndDate.date")?We={...We,recurringEndDateLocalData:{...We.recurringEndDateLocalData,recurringDatePickerOptionsType:"date"}}:He.includes("selectedEndDate.recurringCount")?We={...We,recurringEndDateLocalData:{...We.recurringEndDateLocalData,recurringDatePickerOptionsType:"recurringCount"}}:He.includes("selectedFrequency")&&Ue.savedRecurringTasksCount!=null&&Ue.recurringEndDateLocalData.recurringDatePickerOptionsType==="recurringCount"&&(We={...We,recurringEndDateLocalData:{recurringCount:0,recurringDatePickerOptionsType:void 0,recurringEndDate:void 0}}),y(We)}};g.useEffect(()=>{Ne.register(Wa(rn,Bv),{required:!0,validate:He=>He!=null})},[]),g.useEffect(()=>{const He=Ne.watch((jt,{name:St})=>{if(St!=null&&jt!=null){if(St.includes("taskGroup")&&x!=null){const We=jt?.taskGroup?.selectedOption,nt=x.find(ut=>ut.name===We);nt!=null&&_e(nt.id);return}t.defer(()=>Pe(St,jt))}});return()=>{He.unsubscribe()}});const Qe=Ne.handleSubmit(()=>{const{taskDetailView:{taskId:He,taskDetailLocalData:jt},createdByUser:St}=e;if(jt.type.code==="recurring"&&jt.recurringFrequency==="semi_weekly"&&(jt.recurringDaysOfWeek?.length??0)!==Q.SEMI_WEEKLY_REQUIRED_DAYS_COUNT){Re(!0);return}if(Re(!1),He!=null&&St!=null&&r.userEmail!=null){const{name:We,description:nt,status:ut,assignee:pt,dueDate:Bt,priority:Ht,tagIds:$o,fileIds:Tt}=jt;a.trackTaskEdited({tenantName:n,taskId:He,activity:{count:Ne.formState.dirtyFields[rn]!=null?Object.keys(Ne.formState.dirtyFields[rn]).length:0,details:{name:We,description:nt,status:ut,priority:Ht,tags:$o,assignees:dt.filter(Gt=>pt.includes(Gt.userId)).map(Gt=>({name:Gt.firstName.concat(Zl.strings.space,Gt.lastName).trim(),email:Gt.email})),dueDate:Bt?.format(u_.analytics.YYYYDashMMDashDDFormat)??null,numberOfAttachments:Tt.length},byUser:{name:r.firstName!=null?r.firstName.concat(Zl.strings.space,r.lastName??Zl.strings.empty).trim():r.lastName??Zl.strings.empty,email:r.userEmail}},createdBy:{name:St.user.firstName.concat(Zl.strings.space,St.user.lastName).trim(),email:St.user.email},commentsCreated:Ie>0})}C(Ae)}),Je=()=>{let He=e.taskDetailView.taskDetailLocalData,jt=He.recurringEndDateLocalData?.recurringEndDate;He.recurringEndDateLocalData?.recurringDatePickerOptionsType==="recurringCount"&&He.recurringStartDate!=null&&He.recurringFrequency!=null&&He.recurringEndDateLocalData.recurringCount!=null&&(jt=Q.getRecurringEndDateFromCount(He.recurringStartDate,Q.toRecurringFrequency(He.recurringFrequency.toLocaleLowerCase()),He.recurringEndDateLocalData.recurringCount)),He={...He,savedRecurringEndDate:jt,savedRecurringTasksCount:He.recurringEndDateLocalData.recurringCount,recurringEndDateLocalData:{...He.recurringEndDateLocalData,recurringEndDate:jt}},y(He)},tt=()=>{let He=e.taskDetailView.taskDetailLocalData;He={...He,recurringEndDateLocalData:{...He.recurringEndDateLocalData,recurringEndDate:He.savedRecurringEndDate,recurringCount:He.savedRecurringTasksCount}},y(He)},Ue=e.taskDetailView.taskDetailLocalData,dt=e.userList.users.map(He=>He.user).filter(Boolean),ct=e.taskDetailView.taskId!=null&&me!=null,yt=He=>t.jsxRuntimeExports.jsx(ao,{label:`${XYo.createOption} "${He}"`,labelColor:yC("in_progress",ee)});return t.jsxRuntimeExports.jsx(t.FormProvider,{...Ne,children:t.jsxRuntimeExports.jsxs(uqo,{windowSize:oe,children:[t.jsxRuntimeExports.jsxs(mqo,{windowSize:oe,children:[t.jsxRuntimeExports.jsxs(gqo,{children:[t.jsxRuntimeExports.jsx(hqo,{onClick:R}),t.jsxRuntimeExports.jsx(fqo,{children:t.jsxRuntimeExports.jsx(Vl,{type:"text",placeholderAlignment:"left",name:Wa(rn,ISe),defaultValue:Ue.name,placeholder:ps.taskNamePlaceholder,style:{padding:`${o.sp1} ${o.sp0}`,background:"transparent",textAlign:"left",flexGrow:1,minWidth:0,cursor:"text",fontWeight:600,fontSize:"16px"},registerOptions:{required:!0,validate:He=>He!=null}})}),Ue.type.code==="recurring"?t.jsxRuntimeExports.jsx(Dqo,{height:o.sp3,width:o.sp3}):null,U===!0&&J!=null?t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:t.jsxRuntimeExports.jsx(e7,{children:ps.viewParentTask}),enterDelay:600,children:t.jsxRuntimeExports.jsx(kqo,{onClick:()=>window.open(J,"_blank")})}):null]}),t.jsxRuntimeExports.jsxs(xqo,{windowSize:oe,children:[ct?t.jsxRuntimeExports.jsx(WE,{children:t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:t.jsxRuntimeExports.jsx(e7,{children:he?t.jsxRuntimeExports.jsxs(Tqo,{children:[t.jsxRuntimeExports.jsx(Iqo,{}),Zl.copyToClipBoard.copied]}):Zl.copyToClipBoard.copy}),enterDelay:600,children:t.jsxRuntimeExports.jsx(bqo,{onClick:ke})})}):null,ct?t.jsxRuntimeExports.jsx(WE,{children:t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:t.jsxRuntimeExports.jsx(e7,{children:ps.archiveTooltip}),enterDelay:600,children:t.jsxRuntimeExports.jsx(wqo,{onClick:b})})}):null,ct?t.jsxRuntimeExports.jsx(WE,{children:t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:t.jsxRuntimeExports.jsx(e7,{children:ps.deleteTooltip}),enterDelay:600,children:t.jsxRuntimeExports.jsx(Eqo,{onClick:I})})}):null,Y===!0&&ct&&e.snoozedUntil!=null?t.jsxRuntimeExports.jsxs(vqo,{onClick:He=>ve(He.currentTarget),children:[t.jsxRuntimeExports.jsx(Sqo,{}),t.jsxRuntimeExports.jsx(Aqo,{children:ps.snoozedUntilBanner.replace("_date_",e.snoozedUntil.format("MMM D, h:mm A"))})]}):null,Y===!0&&ct&&e.snoozedUntil==null?t.jsxRuntimeExports.jsx(WE,{children:t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:t.jsxRuntimeExports.jsx(e7,{children:ps.snoozeTooltip}),enterDelay:600,children:t.jsxRuntimeExports.jsx($qo,{onClick:He=>ve(He.currentTarget),children:t.jsxRuntimeExports.jsx(Rqo,{$isSnoozed:!1})})})}):null]})]}),t.jsxRuntimeExports.jsx(cSe,{anchorEl:we,onClose:()=>ve(null),onSnooze:He=>{m!=null&&E(m,He)},onUnsnooze:e.snoozedUntil!=null&&m!=null?()=>$(m):void 0}),f==="In-Progress"||f==="Not-Started"&&m!=null?t.jsxRuntimeExports.jsx(zYo,{}):e.fetchState==="Error"?t.jsxRuntimeExports.jsxs(Lqo,{children:[t.jsxRuntimeExports.jsx(Bqo,{onClick:B,children:t.jsxRuntimeExports.jsx(Pqo,{})}),t.jsxRuntimeExports.jsx(Mqo,{children:Zl.reloadPage.label})]}):t.jsxRuntimeExports.jsxs(cqo,{windowSize:oe,children:[t.jsxRuntimeExports.jsxs(aqo,{children:[t.jsxRuntimeExports.jsx(rqo,{windowSize:oe,children:t.jsxRuntimeExports.jsxs("form",{id:nle(ole),onSubmit:Qe,children:[t.jsxRuntimeExports.jsx(Hqo,{}),t.jsxRuntimeExports.jsx(IYo,{initialValue:Ue.description,placeholder:ps.descriptionPlaceholder,onChange:He=>{Ne.setValue(Wa(rn,Bv),He,{shouldDirty:!0})}}),t.jsxRuntimeExports.jsxs(_qo,{onClick:()=>Se(He=>!He),children:[t.jsxRuntimeExports.jsx(Oqo,{children:ps.viewDetailsLabel}),t.jsxRuntimeExports.jsx(zqo,{$isExpanded:Ee})]}),t.jsxRuntimeExports.jsx(t.Collapse,{in:Ee,timeout:300,children:t.jsxRuntimeExports.jsxs(pqo,{children:[t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsx(Bs,{label:{label:ps.statusLabel,width:te},style:{width:"100%"},singleSelectPickerField:{valueToLabel:He=>N2(He,ee),name:Wa(rn,uW),placeholder:ps.statusPlaceholder,style:{position:"relative"},capitalizeOptions:!0,defaultValue:{selectedOption:Ue.status,allOptions:Q.allTaskStatus.map(He=>({label:He.name,value:He.code}))},textAlignment:"right",registerOptions:{required:!0,validate:He=>He?.selectedOption!=null}}})}),t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsxs(Wqo,{windowSize:oe,children:[t.jsxRuntimeExports.jsx(Ft,{label:ps.assigneeLabel,htmlFor:Wa(rn,sb),style:{marginRight:Ar.labelMarginRight.value(oe),marginTop:Ar.labelMarginTop.value(oe),width:te}}),t.jsxRuntimeExports.jsx(Vqo,{children:t.jsxRuntimeExports.jsx(oY,{placeholderLabel:ps.assigneePlaceholder,name:Wa(rn,sb),value:{allUsers:dt,selectedUsers:dt.filter(He=>Ue.assignee.includes(He.userId)),allUserGroups:W===!0?P:[],selectedUserGroups:W===!0?P.filter(He=>Ue.groupAssignees.includes(He.userGroupId)):[]},registerOptions:{required:!0,validate:He=>He!=null&&(He.selectedUsers.length>0||(He.selectedUserGroups?.length??0)>0)}})})]})}),t.jsxRuntimeExports.jsx(Fqo,{children:t.jsxRuntimeExports.jsx(CGo,{label:{label:ps.tagLabel,width:te},style:{width:"100%"},creatableMultiSelectField:{name:Wa(rn,Mv),placeholder:ps.tagPlaceholder,defaultValue:{selectedOptions:Ue.tagIds,allOptions:u9(L.tagList)},registerOptions:{required:!1},isLoading:le==="In-Progress"||ge(),onCreateOption:D,onDeleteOption:M,customCreateLabel:He=>yt(He)}})}),t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsx(Bs,{label:{label:ps.priorityLabel,width:te},style:{width:"100%"},singleSelectPickerField:{valueToLabel:He=>N2(He,ee),name:Wa(rn,pW),placeholder:ps.priorityPlaceholder,style:{position:"relative"},capitalizeOptions:!0,defaultValue:{selectedOption:Ue.priority,allOptions:Q.allTaskPriority.map(He=>({label:He.name,value:He.code}))},textAlignment:"right",registerOptions:{required:!0,validate:He=>He?.selectedOption!=null}}})}),t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsx(Pr,{label:{label:ps.dueDateLabel,width:te},style:{width:"100%"},dateField:{name:Wa(rn,Pv),placeholder:ps.dueDatePlaceholder,defaultValue:Ue.dueDate,dateFormat:u_.visual.defaultInput,minDate:Q.dateNow(),autoComplete:"off",registerOptions:{required:!0}}})}),t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsx(vGo,{name:Wa(rn,F2),placeholder:KYo,timeSpentFormat:JYo,defaultValue:Ue.timeSpent,label:{label:ps.totalTimeSpent,width:te},registerOptions:{validate:He=>Q.convertHHMMStrToMinutes(He)>eB?Zl.snackBar.task_time_spent_validation.failed:!0},style:{width:"auto",border:"none",outline:"none"}})}),Z===!0&&q===!0?t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsxs(Qqo,{windowSize:oe,children:[t.jsxRuntimeExports.jsx(Ft,{label:ps.visibilityLabel,htmlFor:Wa(rn,Qy),style:{marginRight:Ar.labelMarginRight.value(oe),marginTop:Ar.labelMarginTop.value(oe),width:te}}),t.jsxRuntimeExports.jsxs(dqo,{children:[t.jsxRuntimeExports.jsx(Bo,{radioField:{name:Wa(rn,Qy),id:`${rn}-visibility-public`,value:"public",checked:Ue.isPrivate===!1,style:{height:o.sp3,width:o.sp3},radioSize:"small",registerOptions:{required:ps.visibilityRequired}},label:{label:ps.visibilityPublic},isContainerClickable:!0,isDisabled:ct?"readonly":void 0,style:{paddingRight:o.sp4,width:"auto",border:"none"}}),t.jsxRuntimeExports.jsx(Bo,{radioField:{name:Wa(rn,Qy),id:`${rn}-visibility-private`,value:"private",checked:Ue.isPrivate===!0,style:{height:o.sp3,width:o.sp3},radioSize:"small",registerOptions:{required:ps.visibilityRequired}},label:{label:ps.visibilityPrivate},isContainerClickable:!0,isDisabled:ct?"readonly":void 0,style:{width:"auto",border:"none"}})]})]})}):t.jsxRuntimeExports.jsx(Jm,{}),t.jsxRuntimeExports.jsx(Jm,{children:t.jsxRuntimeExports.jsx(Bs,{label:{label:ps.groupLabel,width:te},style:{width:"100%"},singleSelectPickerField:{name:"taskGroup",isSearchable:!0,placeholder:"Select group",defaultValue:{selectedOption:h??x?.find(He=>He.isDefault)?.name??"All Other Tasks",allOptions:x?.map(He=>({label:He.name,value:He.name}))??[{label:h??"All Other Tasks",value:h??"All Other Tasks"}]},textAlignment:"right"}})},`group-${x?.length??0}`),t.jsxRuntimeExports.jsx(LSe,{children:t.jsxRuntimeExports.jsx(tL,{label:{label:ps.taskTypeLabel,width:te},singleSelectField:{name:Wa(rn,ZYo),defaultValue:{selectedOption:Tb.find(He=>He.code===Ue.type.code)?.name,allOptions:Tb.map(He=>He.name)}},style:{width:"auto",border:"none",outline:"none"}})}),Ue.type.code==="recurring"?t.jsxRuntimeExports.jsx(Nqo,{children:t.jsxRuntimeExports.jsx(HGo,{name:Wa(rn,bf),startMinDate:Q.dateNow(),recurringView:{selectedEndDate:{type:Ue.recurringEndDateLocalData?.recurringDatePickerOptionsType,date:Ue.recurringEndDateLocalData?.recurringEndDate,recurringCount:Ue.recurringEndDateLocalData?.recurringCount},selectedFrequency:{allOptions:TSe,selectedOption:XL.find(He=>He.value===Ue.recurringFrequency)?.label},selectedStartDate:Ue.recurringStartDate?.toDate()??Q.dateNow().toDate(),selectedDaysOfWeek:Ue.recurringDaysOfWeek},recurringCountInputLabel:ps.totalNumberOfTasks,onClickSave:Je,onClickCancel:tt,showDaysOfWeekError:Te,onDaysOfWeekChange:He=>{y({...Ue,recurringDaysOfWeek:He}),He.length===Q.SEMI_WEEKLY_REQUIRED_DAYS_COUNT&&Re(!1)}})}):null]})}),t.jsxRuntimeExports.jsx(UGo,{sectionId:Wa(rn,mW),deleteFileStatusById:e.deleteFileStatusById,updateFileStatusById:e.updateFileStatusById,filesEndPoint:c,authParams:d,files:e.files,updateFilesEntity:k,onEditFileName:A,onDeleteFile:T})]})}),m==null||e.showTaskDetailFormFooter?t.jsxRuntimeExports.jsx(_t,{style:{zIndex:1,paddingTop:o.sp3,paddingBottom:o.sp3},formId:nle(ole),helperStyle:{paddingTop:o.sp0,paddingBottom:o.sp0},primaryBtn:{label:ps.primaryBtnText,isLoading:e.taskDetailView.saveStatus.fetchState==="In-Progress"},cancelBtn:{label:ps.secondaryBtnText,onClick:R}}):null]}),t.jsxRuntimeExports.jsxs(lqo,{children:[t.jsxRuntimeExports.jsx(_c,{allTabs:[{id:"comments",label:ps.commentsSectionTitle,countDetails:Ie>0?{count:Ie,isFetching:!1}:void 0},{id:"activity",label:ps.activitySectionTitle}],selectedTab:$e,onTabChange:He=>Be(He.id)}),t.jsxRuntimeExports.jsx(Uqo,{children:$e==="comments"?ct?t.jsxRuntimeExports.jsx(DUo,{autoExpand:!0,autoFocus:!1,cannedResponses:Z===!0&&H===!0?F:void 0,isCannedResponsesLoading:N,onFetchCannedResponses:Z===!0&&H===!0?G:void 0,onManageTemplatesClick:Z===!0&&H===!0?K:void 0,initialScrollToThreadId:V?.threadId,threadMetadata:{companyName:n,companyId:i,entityId:e.taskDetailView.taskId,entityType:"task.details",isGlobalComment:!0,application:"dashboard",tab:"task",url:window.location.href},textOverrides:{composerPlaceholder:eqo,replyComposerPlaceholder:tqo},filter:{entityType:"task.details",entityId:e.taskDetailView.taskId},threadsContainerStyle:{width:"auto",padding:o.sp5},threadStyle:{width:"100%"},composerContainerStyle:{width:"auto",padding:o.sp5},onThreadClick:()=>null}):t.jsxRuntimeExports.jsx(sqo,{children:t.jsxRuntimeExports.jsx(iqo,{children:ps.taskCommentCreationMessage})}):t.jsxRuntimeExports.jsx(Gqo,{children:t.jsxRuntimeExports.jsx(SQ,{historicActivities:e.taskHistory})})})]})]})]})})},sqo=s.div`
39795
39795
  display: flex;
39796
39796
  align-items: center;
39797
39797
  justify-content: center;
@@ -43050,7 +43050,7 @@ to {
43050
43050
  align-items: flex-end;
43051
43051
  margin-left: ${o.sp2};
43052
43052
  margin-top: ${o.sp1};
43053
- `,Yr={width:new w(343,580,756),horizontalChromePx:new w(24,40),labelWidth:new w(115,145,155),mediumLabelWidth:new w(140,160,170),largeLabelWidth:new w(150,210,244),extraLargeLabelWidth:new w(160,240,292),largeLabelDocumentWidth:new w(150,210,252),fieldPaddingTopBottom:new w(p[2],p[2]),fieldPaddingLeft:new w(p[3],p[4]),fieldPaddingRight:new w(p[2],p[3]),labelMarginRight:new w(p[3],p[4])},cAe={title:new Ke("largeSemiBold","largeSemiBold"),subTitle:new Ke("smallSemiBold","smallSemiBold")},rnn=O.getLocalizedStrings(),{dateFormat:{visual:ann},commonSetUp:lnn,companyPassport:oce,common:{documents:nce,optional:cnn,yes:sce,no:ice}}=rnn,kt=lnn.businessVerification,jY=g.forwardRef(({allIndustries:e,fileProps:n,productType:i,companyDetails:r,allNationalityCountries:a,connectedAccountProvider:l,businessVerificationProps:c,isDisabled:d,style:u,sectionId:m,showInfoTooltip:x=!0,isCompleted:h=!1,showCompletedIcon:f=!1,hideNewOnboardingFields:y=!1,showTreasuryFields:C=!1,sectionHeader:b,optionalFields:E=[],sectionSubHeader:$,onCompanyAddressClick:R,onRegisteredAddressClick:S},k)=>{const T=X(),A=t.useTheme(),{watch:I,setValue:B,formState:{errors:L}}=t.useFormContext(),P=I(sn(m,"companySourceOfFunds")),D=I(sn(m,"transactionVolume")),M=I(sn(m,"purposeOfAccount")),F=I(sn(m,"regulatedStatus")),V=I(sn(m,"usNexus")),N=I(sn(m,"companyIndustryType")),H=We=>{B(sn(m,"companySubIndustry"),{selectedOption:null,allOptions:Q.getCompanyOnboardingSubIndustryCodesForIndustry(We)})},W=Yr.labelWidth.value(T),U=Yr.mediumLabelWidth.value(T),Y=Yr.largeLabelWidth.value(T),q=Yr.extraLargeLabelWidth.value(T),Z=Yr.largeLabelDocumentWidth.value(T),G=kt.productType[i],K=c?.companyVerificationStatus!=null?ws(c.companyVerificationStatus.code,A.mode,"solid"):null,J=r?.companyFiles.find(We=>We.documentType==="certificate_of_incorporation"),oe=r?.companyFiles.find(We=>We.documentType==="tax_ein"),ee=r?.companyDescription,te=r?.companyLegalName,se=r?.website,ie=r?.typeOfIncorporation,re=r?.stateOfIncorporation,ne=r?.countriesOfOperations,me=r?.incDate,pe=r?.companyIndustry,je=r?.companyIndustryType,ce=r?.companySubIndustry,de=r?.companySourceOfFunds,ue=r?.transactionVolume,le=r?.purposeOfAccount,ae=r?.regulatedStatus,ge=r?.usNexus,ye=r?.phone,he=r?.taxIdOrEIN,Ce=r?.primaryContactLocalData,we=r?.deleteFileStatusById??{},ve=r?.updateFileStatusById??{},Ee=r?.addressStatus?.addressToCreate,Se=r?.registeredAddressStatus?.addressToCreate,[$e,Be]=g.useState(!1),[Ae,_e]=g.useState(!1),Te=We=>(d==null||!!We)&&!y,Re=Te(je),ke=(d==null||Array.isArray(ne)&&ne.length>0)&&!y,Oe=Te(re),Me=Te(de),Ie=Te(ue),Ne=Te(le),Pe=Te(ae),Ue=Te(ge),Je=kt.sourceOfFundOptions,tt=We=>Je[We]??We,Qe=N?.selectedOption??je,dt=We=>gve(We,Qe),ct=We=>e.find(nt=>nt.code===We)?.name??We,yt=L[m]!=null&&L[m]?.regulatedStatus!=null,He=L[m]!=null&&L[m]?.regulatedStatusDescription!=null,jt=L[m]!=null&&L[m]?.usNexus!=null,St=L[m]!=null&&L[m]?.usNexusTypes!=null;return t.jsxRuntimeExports.jsxs(dnn,{style:u,ref:k,windowSize:T,children:[t.jsxRuntimeExports.jsxs(unn,{children:[t.jsxRuntimeExports.jsxs(Cnn,{children:[t.jsxRuntimeExports.jsxs(xnn,{children:[f===!0?t.jsxRuntimeExports.jsx(hnn,{children:h?t.jsxRuntimeExports.jsx(gnn,{}):t.jsxRuntimeExports.jsx(fnn,{})}):null,t.jsxRuntimeExports.jsx(pnn,{windowSize:T,children:b??kt.confirmCompanyDetails})]}),x?t.jsxRuntimeExports.jsx(ynn,{children:t.jsxRuntimeExports.jsx(Le,{variant:"small-description",display:"flex",maxWidth:"280px",data:kt.confirmCompanyDetailsTooltip,placement:T==="small"||i==="onboarding"?"bottom":"right",children:t.jsxRuntimeExports.jsx(jnn,{})})}):null,i==="onboarding"&&b!=null?t.jsxRuntimeExports.jsx(lAe,{text:cnn}):null,c?.companyVerificationStatus!=null&&K!=null?t.jsxRuntimeExports.jsxs(wnn,{children:[t.jsxRuntimeExports.jsx(ao,{label:c.companyVerificationStatus.name,labelColor:K.color.toString(),capsuleBackground:K.backgroundColor?.toString()}),c?.isRefreshingViewInBackground?t.jsxRuntimeExports.jsx(Et,{start:!0,size:"Small",style:{display:"flex",alignItems:"center",marginLeft:o.sp2}}):null]}):null]}),t.jsxRuntimeExports.jsx(mnn,{windowSize:T,children:$??kt.confirmCompanyDetailsSubTitle})]}),t.jsxRuntimeExports.jsxs(bnn,{windowSize:T,children:[t.jsxRuntimeExports.jsx(aAe,{}),t.jsxRuntimeExports.jsx(gC,{name:sn(m,"certificateOfIncorporation"),isDisabled:d,sizeLimit:fu,deleteFileStatusById:we,updateFileStatusById:ve,filesEndPoint:n.filesEndPoint,authParams:n.authParams,label:{label:kt.certificateOfIncorporation,width:Z},filemetadataPayload:{documentType:"certificate_of_incorporation",purposeId:"business_verification",documentSide:"front"},file:J,acceptableTypes:["image/jpg","image/jpeg","image/png","application/pdf","image/heic","image/heif"],registerOptions:{required:d==null&&E.includes("certificateOfIncorporation")===!1&&l==="unit"},hasError:$e,updateFilesEntity:n.updateFilesEntity,onEditFileName:n.onEditFileName,onDeleteFile:n.onDeleteFile,onFileSizeError:We=>Be(We),errorInfoLabel:kt.certOfIncopDocumentError.replace("_product_type_",G),formatHintLabel:nce.formatDocumentText10MB,formatHintIsError:$e,showFormatHintLabel:$e||!(d!=null||J!=null)}),t.jsxRuntimeExports.jsx(gC,{name:sn(m,"ein"),isDisabled:d,sizeLimit:fu,deleteFileStatusById:we,updateFileStatusById:ve,filesEndPoint:n.filesEndPoint,authParams:n.authParams,label:{label:kt.einDocument,width:Z},filemetadataPayload:{documentType:"tax_ein",purposeId:"business_verification",documentSide:"front"},file:oe,acceptableTypes:["image/jpg","image/jpeg","image/png","application/pdf","image/heic","image/heif"],registerOptions:{required:d==null&&E.includes("ein")===!1},errorInfoLabel:kt.einDocumentError.replace("_product_type_",G),hasError:Ae,updateFilesEntity:n.updateFilesEntity,onEditFileName:n.onEditFileName,onDeleteFile:n.onDeleteFile,onFileSizeError:We=>_e(We),formatHintLabel:nce.formatDocumentText10MB,formatHintIsError:Ae,showFormatHintLabel:Ae||!(d!=null||oe!=null)}),t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,showAdditionalInfoLabel:!1,label:{label:kt.companyLegalNameLabel,width:Y},text:{type:"text",name:sn(m,"companyLegalName"),placeholder:kt.companyLegalNamePlaceholder,defaultValue:te,options:{required:d==null&&E.includes("companyLegalName")===!1}},additionalInfoLabel:kt.companyLegalNameError.replace("_product_type_",G)}),t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,showAdditionalInfoLabel:!1,label:{label:kt.companyDescriptionLabel,width:U},text:{type:"text",name:sn(m,"companyDescription"),placeholder:kt.addProductPlaceholder,defaultValue:ee,options:{required:d==null&&E.includes("companyDescription")===!1}},additionalInfoLabel:kt.companyDescriptionError.replace("_product_type_",G)}),t.jsxRuntimeExports.jsx(fC,{isDisabled:d,label:{label:kt.registeredAddressLabel,width:U},addressValueField:{name:sn(m,"registeredAddress"),placeholder:kt.registeredAddressPlaceholder,defaultValue:Se,registerOptions:{validate:We=>E.includes("registeredAddress")===!1?!(d==null&&We==null):!0},onClick:()=>{S?.("company_registered_address")}},additionalInfoLabel:kt.registeredAddressError.replace("_product_type_",G),showAdditionalInfoLabel:!1,style:{width:"auto"}}),t.jsxRuntimeExports.jsx(fC,{isDisabled:d,label:{label:kt.companyAddressLabel,width:U},addressValueField:{name:sn(m,"companyAddress"),placeholder:kt.companyAddressPlaceholder,defaultValue:Ee,registerOptions:{validate:We=>E.includes("companyAddress")===!1?!(d==null&&We==null):!0},onClick:()=>{R?.("company_address")}},additionalInfoLabel:kt.companyAddressError.replace("_product_type_",G),showAdditionalInfoLabel:!1,style:{width:"auto"}}),t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,showAdditionalInfoLabel:!1,label:{label:kt.companyWebsiteLabel,width:W},text:{type:"url",name:sn(m,"companyWebsite"),placeholder:kt.companyWebsitePlaceholder,defaultValue:se?.toString()??"",options:{required:d==null&&E.includes("companyWebsite")===!1}},additionalInfoLabel:kt.companyWebsiteError.replace("_product_type_",G)}),t.jsxRuntimeExports.jsx(y_,{className:"regulated-status-industry",windowSize:T,$isDisabledRow:d!=null,"data-suppress-hover":d!=null?!0:void 0,children:Re?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(ei,{label:{label:kt.companyIndustryLabel,width:W},singleSelectField:{singleSelect:{name:sn(m,"companyIndustryType"),placeholder:kt.companyIndustryPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:hve,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:je,allOptions:[...Q.COMPANY_ONBOARDING_INDUSTRY_TYPE_CODES]},registerOptions:{required:d==null&&E.includes("companyIndustryType")===!1,validate:We=>E.includes("companyIndustryType")===!1?!(d==null&&!We?.selectedOption):!0},onSelectChange:H},isFunctional:!0,errorInfoLabel:kt.companyIndustryError.replace("_product_type_",G),style:{padding:0,margin:0,outline:"none",border:"none",width:"100%",maxWidth:"100%",backgroundColor:"transparent"}}),Qe!=null&&t.jsxRuntimeExports.jsx(ei,{isSecondaryInput:!0,label:{label:"",width:0,style:{marginRight:0}},singleSelectField:{singleSelect:{name:sn(m,"companySubIndustry"),placeholder:kt.companySubIndustryPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:dt,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:ce,allOptions:Q.getCompanyOnboardingSubIndustryCodesForIndustry(Qe)},registerOptions:{required:d==null&&E.includes("companySubIndustry")===!1,validate:We=>E.includes("companySubIndustry")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,errorInfoLabel:kt.companySubIndustryError.replace("_product_type_",G),additionalInfoLabel:d==null?kt.companyIndustryAdditionalInfo:void 0,style:{outline:"none",border:"none",padding:0,margin:`${o.sp2} 0 0 0`,width:"100%",maxWidth:"100%",backgroundColor:"transparent"}})]}):t.jsxRuntimeExports.jsx(ei,{label:{label:kt.companyIndustryLabel,width:W},singleSelectField:{singleSelect:{name:sn(m,"companyIndustry"),placeholder:kt.companyIndustryPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:ct,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:pe,allOptions:e?.map(We=>We.code)??[]},registerOptions:{required:d==null&&E.includes("companyIndustry")===!1,validate:We=>E.includes("companyIndustry")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,errorInfoLabel:kt.companyIndustryError.replace("_product_type_",G),additionalInfoLabel:d==null?kt.companyIndustryAdditionalInfo:void 0,style:{padding:0,margin:0,outline:"none",border:"none",width:"100%",maxWidth:"100%",backgroundColor:"transparent"}})}),t.jsxRuntimeExports.jsx(l9,{label:{label:kt.companyTypeOfIncorporationLabel,width:Y},isDisabled:d,creatableSingleSelectField:{name:sn(m,"typeOfIncorporation"),placeholder:kt.companyTypeOfIncorporationPlaceholder,defaultValue:{selectedOption:ie,allOptions:oce.companyIncInfo.allTypesOfIncorporation},registerOptions:{required:d==null&&E.includes("typeOfIncorporation")===!1,validate:We=>E.includes("typeOfIncorporation")===!1?!(d==null&&!We?.selectedOption):!0}},errorInfoLabel:kt.companyTypeOfIncorporationError.replace("_product_type_",G)}),t.jsxRuntimeExports.jsx(Pr,{isDisabled:d,label:{label:kt.companyIncDateLabel,width:Y},dateField:{name:sn(m,"incDate"),placeholder:kt.companyIncDatePlaceholder,defaultValue:me,dateFormat:ann.defaultInput,maxDate:Q.dateNow(),minDate:Q.zeniDate("01 Jan 1900"),autoComplete:"off",registerOptions:{required:d==null&&E.includes("incDate")===!1}},additionalInfoLabel:kt.companyIncDateError.replace("_product_type_",G),style:{width:"auto"}}),Oe?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(l9,{label:{label:kt.companyStateOfIncorporationLabel,width:Y},isDisabled:d,creatableSingleSelectField:{name:sn(m,"stateOfIncorporation"),placeholder:kt.companyStateOfIncorporationPlaceholder,defaultValue:{selectedOption:re,allOptions:oce.companyIncInfo.allStatesOfIncorporation},registerOptions:{required:d==null&&E.includes("stateOfIncorporation")===!1,validate:We=>E.includes("stateOfIncorporation")===!1?!(d==null&&!We?.selectedOption):!0}},errorInfoLabel:kt.companyStateOfIncorporationError.replace("_product_type_",G)})}):null,ke?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(FG,{label:{label:kt.countriesOfOperationsLabel,width:Y},isDisabled:d,additionalInfoLabel:d==null?kt.countriesOfOperationsAdditionalInfo:void 0,errorInfoLabel:kt.countriesOfOperationsError.replace("_product_type_",G),multiSelectField:{name:sn(m,"countriesOfOperations"),placeholder:kt.countriesOfOperationsPlaceholder,defaultValue:U9(ne,(a??[]).map(We=>We.countryCode)),registerOptions:{validate:We=>E.includes("countriesOfOperations")?!0:!(d==null&&We.selectedOptions.length===0)}},style:{width:"auto"}})}):null,Me?t.jsxRuntimeExports.jsx(j_,{children:t.jsxRuntimeExports.jsx(ei,{label:{label:kt.companySourceOfFundsLabel,width:Y},singleSelectField:{singleSelect:{name:sn(m,"companySourceOfFunds"),placeholder:kt.companySourceOfFundsPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:pve,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:de,allOptions:[...Q.COMPANY_SOURCE_OF_FUNDS_CODES]},registerOptions:{required:d==null&&E.includes("companySourceOfFunds")===!1,validate:We=>E.includes("companySourceOfFunds")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,additionalContent:rve.includes(P?.selectedOption)?t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,label:{label:"",width:0,style:{marginRight:0,marginTop:0,marginBottom:0}},controlWidth:Yr.width.value(T)-Yr.horizontalChromePx.value(T),isSecondaryInput:!0,text:{type:"text",name:sn(m,"companySourceOfFundsDescription"),style:{...L[m]!=null&&L[m]?.companySourceOfFundsDescription!=null?{backgroundColor:v.importantLight}:{}},placeholder:kt.descriptionPlaceholder,options:{required:d==null}},showAdditionalInfoLabel:!1,showErrorInfoLabel:!0,errorInfoLabel:kt.companySourceOfFundsDescriptionError,style:{position:"relative",top:0,padding:0,margin:`${o.sp2} 0 0 0`,outline:"none",border:"none",borderRadius:"6px"}}):null,additionalInfoLabel:d!=null||L[m]!=null&&L[m]?.companySourceOfFundsDescription!=null?void 0:kt.companySourceOfFundsAdditionalInfo,errorInfoLabel:kt.companySourceOfFundsError.replace("_product_type_",G)})}):null,Ie?t.jsxRuntimeExports.jsx(j_,{children:t.jsxRuntimeExports.jsx(ei,{label:{label:kt.transactionVolumeLabel,width:q},singleSelectField:{singleSelect:{name:sn(m,"transactionVolume"),placeholder:kt.transactionVolumePlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:uve,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:ue,allOptions:[...Q.COMPANY_TRANSACTION_VOLUME_CODES]},registerOptions:{required:d==null&&E.includes("transactionVolume")===!1,validate:We=>E.includes("transactionVolume")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,additionalContent:ave.includes(D?.selectedOption)?t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,label:{label:"",width:0,style:{marginRight:0,marginTop:0,marginBottom:0}},isSecondaryInput:!0,text:{type:"text",name:sn(m,"transactionVolumeDescription"),style:{...L[m]!=null&&L[m]?.transactionVolumeDescription!=null?{backgroundColor:v.importantLight}:{}},placeholder:kt.descriptionPlaceholder,options:{required:d==null}},controlWidth:Yr.width.value(T)-Yr.horizontalChromePx.value(T),showAdditionalInfoLabel:!1,showErrorInfoLabel:!0,errorInfoLabel:kt.transactionVolumeDescriptionError,style:{position:"relative",top:0,padding:0,margin:`${o.sp2} 0 0 0`,outline:"none",border:"none",borderRadius:"6px"}}):null,additionalInfoLabel:d!=null||L[m]!=null&&L[m]?.transactionVolumeDescription!=null?void 0:kt.transactionVolumeAdditionalInfo,errorInfoLabel:kt.transactionVolumeError.replace("_product_type_",G)})}):null,Ne?t.jsxRuntimeExports.jsx(j_,{children:t.jsxRuntimeExports.jsx(ei,{label:{label:kt.purposeOfAccountLabel,width:Y},singleSelectField:{singleSelect:{name:sn(m,"purposeOfAccount"),placeholder:kt.purposeOfAccountPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:mve,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:le,allOptions:[...Q.COMPANY_PURPOSE_OF_ACCOUNT_CODES]},registerOptions:{required:d==null&&E.includes("purposeOfAccount")===!1,validate:We=>E.includes("purposeOfAccount")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,additionalContent:lve.includes(M?.selectedOption)?t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,label:{label:"",width:0,style:{marginRight:0,marginTop:0,marginBottom:0}},text:{type:"text",name:sn(m,"purposeOfAccountDescription"),placeholder:kt.descriptionPlaceholder,style:{...L[m]!=null&&L[m]?.purposeOfAccountDescription!=null?{backgroundColor:v.importantLight}:{}},options:{required:d==null}},controlWidth:Yr.width.value(T)-Yr.horizontalChromePx.value(T),isSecondaryInput:!0,showAdditionalInfoLabel:!1,showErrorInfoLabel:!0,errorInfoLabel:kt.purposeOfAccountDescriptionError,style:{position:"relative",top:0,padding:0,margin:`${o.sp2} 0 0 0`,outline:"none",border:"none",borderRadius:"6px"}}):null,additionalInfoLabel:d!=null||L[m]!=null&&L[m]?.purposeOfAccountDescription!=null?void 0:kt.purposeOfAccountAdditionalInfo,errorInfoLabel:kt.purposeOfAccountError.replace("_product_type_",G)})}):null,Pe?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(y_,{windowSize:T,$isDisabledRow:d!=null,"data-suppress-hover":d!=null?!0:void 0,children:[t.jsxRuntimeExports.jsxs(rce,{children:[t.jsxRuntimeExports.jsx(Ft,{label:kt.regulatedStatusLabel,htmlFor:sn(m,"regulatedStatus"),isDisabled:d,syncBackgroundWithAncestor:!0,style:{width:Y,marginRight:Yr.labelMarginRight.valuePx(T)}}),t.jsxRuntimeExports.jsxs(ace,{labelWidth:Y,windowSize:T,children:[t.jsxRuntimeExports.jsx(Bo,{label:{label:sce},style:{paddingRight:`${o.sp4}`,width:"auto",border:"none"},radioField:{name:sn(m,"regulatedStatus"),id:`${sn(m,"regulatedStatus")}.yes`,value:"yes",style:{height:`${o.sp3}`,width:`${o.sp3}`},radioSize:"small",registerOptions:{required:d==null&&E.includes("regulatedStatus")===!1}},isDisabled:d,isContainerClickable:!0}),t.jsxRuntimeExports.jsx(Bo,{label:{label:ice},style:{width:"auto",border:"none"},radioField:{name:sn(m,"regulatedStatus"),id:`${sn(m,"regulatedStatus")}.no`,value:"no",style:{height:`${o.sp3}`,width:`${o.sp3}`},radioSize:"small",registerOptions:{required:d==null&&E.includes("regulatedStatus")===!1}},isDisabled:d,isContainerClickable:!0})]})]}),F==="yes"&&t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,label:{label:"",width:0,style:{marginRight:0,marginTop:0,marginBottom:0,marginLeft:0}},isSecondaryInput:!0,text:{type:"text",name:sn(m,"regulatedStatusDescription"),placeholder:kt.regulatedStatusDescriptionPlaceholder,options:{required:d==null,shouldUnregister:!0},style:{...L[m]!=null&&L[m]?.regulatedStatusDescription!=null?{backgroundColor:v.importantLight}:{}}},showAdditionalInfoLabel:!1,showErrorInfoLabel:!0,errorInfoLabel:kt.regulatedStatusDescriptionError,style:{margin:`${o.sp2} 0 0 0`,padding:0,outline:"none",border:"none",borderRadius:"6px",width:"100%",maxWidth:"100%",minWidth:0}}),yt?t.jsxRuntimeExports.jsx(qE,{windowSize:T,isError:!0,children:kt.regulatedStatusError.replace("_product_type_",G)}):d==null&&He===!1?t.jsxRuntimeExports.jsx(qE,{windowSize:T,isError:!1,children:kt.regulatedStatusAdditionalInfo}):null]})}):null,Ue?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(y_,{className:"regulated-status-us-nexus",windowSize:T,$isDisabledRow:d!=null,"data-suppress-hover":d!=null?!0:void 0,"data-us-nexus-types-invalid":St?!0:void 0,children:[t.jsxRuntimeExports.jsxs(rce,{children:[t.jsxRuntimeExports.jsx(Ft,{label:kt.usNexusLabel,htmlFor:sn(m,"usNexus"),isDisabled:d,syncBackgroundWithAncestor:!0,style:{width:Y,marginRight:Yr.labelMarginRight.valuePx(T)}}),t.jsxRuntimeExports.jsxs(ace,{labelWidth:Y,windowSize:T,children:[t.jsxRuntimeExports.jsx(Bo,{label:{label:sce},style:{paddingRight:`${o.sp4}`,width:"auto",border:"none"},radioField:{name:sn(m,"usNexus"),id:`${sn(m,"usNexus")}.yes`,value:"yes",style:{height:`${o.sp3}`,width:`${o.sp3}`},radioSize:"small",registerOptions:{required:d==null&&E.includes("usNexus")===!1}},isDisabled:d,isContainerClickable:!0}),t.jsxRuntimeExports.jsx(Bo,{label:{label:ice},style:{width:"auto",border:"none"},radioField:{name:sn(m,"usNexus"),id:`${sn(m,"usNexus")}.no`,value:"no",style:{height:`${o.sp3}`,width:`${o.sp3}`},radioSize:"small",registerOptions:{required:d==null&&E.includes("usNexus")===!1}},isDisabled:d,isContainerClickable:!0})]})]}),V==="yes"&&t.jsxRuntimeExports.jsx(Enn,{className:"us-nexus-types-inner-field",children:t.jsxRuntimeExports.jsx(NG,{isDisabled:d,label:{label:"",width:0,style:{marginRight:0,marginTop:0,marginBottom:0,marginLeft:0}},multiSelectField:{name:sn(m,"usNexusTypes"),placeholder:kt.usNexusPlaceholder,getOptionLabel:xve,defaultValue:{selectedOptions:r?.usNexusTypes??[],allOptions:[...Q.COMPANY_US_NEXUS_TYPE_CODES]},registerOptions:{required:d==null,shouldUnregister:!0,validate:We=>{const nt=We?.selectedOptions;return nt!=null&&nt.length>0}}},style:{outline:"none",margin:`${o.sp2} 0 0 0`,padding:0,width:"100%",maxWidth:"100%",border:"none",borderRadius:"6px"},errorInfoLabel:kt.usNexusTypesError.replace("_product_type_",G)})}),jt?t.jsxRuntimeExports.jsx(qE,{windowSize:T,isError:!0,children:kt.usNexusError.replace("_product_type_",G)}):d==null&&St===!1?t.jsxRuntimeExports.jsx(qE,{windowSize:T,isError:!1,children:kt.usNexusAdditionalInfo}):null]})}):null,t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,showAdditionalInfoLabel:!1,label:{label:kt.companyTaxIdLabel,width:W},text:{type:"text",name:sn(m,"companyTaxId"),placeholder:kt.companyTaxIdPlaceholder,defaultValue:he,options:{required:d==null&&E.includes("companyTaxId")===!1,pattern:L9},autoComplete:"new-password"},additionalInfoLabel:kt.companyTaxIdError.replace("_product_type_",G)}),t.jsxRuntimeExports.jsx(I1,{isDisabled:d,label:{label:kt.companyPhoneLabel,width:W},text:{name:sn(m,"companyPhone"),placeholder:Io(kt.companyPhoneLabel),defaultValue:ye,autoComplete:"new-password",options:{required:d==null&&E.includes("companyPhone")===!1}},errorInfoLabel:kt.companyPhoneError.replace("_product_type_",G),style:{width:"auto"}}),t.jsxRuntimeExports.jsx(d4,{isDisabled:d,label:{label:kt.companyPrimaryContactNameLabel,width:Y},nameField:{name:sn(m,"primaryContactName"),placeHolder:{firstName:kt.firstNamePlaceholder,lastName:kt.lastNamePlaceholder,name:kt.namePlaceholder},defaultValue:{firstName:Ce?.firstName??"",lastName:Ce?.lastName??""},registerOptions:{required:d==null&&E.includes("primaryContactName")===!1,validate:We=>!!We||d!=null||E.includes("primaryContactName")},showFullNameError:!0},errorInfoLabel:kt.companyPrimaryContactNameError.replace("_product_type_",G),style:{width:"auto"}}),t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,label:{label:kt.companyPrimaryContactEmailLabel,width:Y},text:{type:"email",name:sn(m,"primaryContactEmail"),placeholder:kt.companyPrimaryContactEmailPlaceholder,defaultValue:Ce?.email,options:{required:d==null&&E.includes("primaryContactEmail")===!1}},errorInfoLabel:kt.companyPrimaryContactEmailError.replace("_product_type_",G)}),C===!0?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(ei,{label:{label:kt.sourceOfFundsLabel,width:W},singleSelectField:{singleSelect:{name:sn(m,"sourceOfFunds"),placeholder:kt.sourceOfFundsPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:tt,isDisabled:d,showTickMark:!1,menuPlacement:"top",sortOptions:!1},defaultValue:{selectedOption:r?.sourceOfFunds,allOptions:Object.keys(kt.sourceOfFundOptions)},registerOptions:{required:d==null&&E.includes("sourceOfFunds")===!1,validate:We=>E.includes("sourceOfFunds")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,errorInfoLabel:kt.sourceOfFundsError.replace("_product_type_",G)})}):null]})]})});jY.displayName="Company Details Section";const sn=(e,n)=>`${e}.${n}`,dnn=s.div`
43053
+ `,Yr={width:new w(343,580,756),horizontalChromePx:new w(24,40),labelWidth:new w(115,145,155),mediumLabelWidth:new w(140,160,170),largeLabelWidth:new w(150,210,244),extraLargeLabelWidth:new w(160,240,292),largeLabelDocumentWidth:new w(150,210,252),fieldPaddingTopBottom:new w(p[2],p[2]),fieldPaddingLeft:new w(p[3],p[4]),fieldPaddingRight:new w(p[2],p[3]),labelMarginRight:new w(p[3],p[4])},cAe={title:new Ke("largeSemiBold","largeSemiBold"),subTitle:new Ke("smallSemiBold","smallSemiBold")},rnn=O.getLocalizedStrings(),{dateFormat:{visual:ann},commonSetUp:lnn,companyPassport:oce,common:{documents:nce,optional:cnn,yes:sce,no:ice}}=rnn,kt=lnn.businessVerification,jY=g.forwardRef(({allIndustries:e,fileProps:n,productType:i,companyDetails:r,allNationalityCountries:a,connectedAccountProvider:l,businessVerificationProps:c,isDisabled:d,style:u,sectionId:m,showInfoTooltip:x=!0,isCompleted:h=!1,showCompletedIcon:f=!1,hideNewOnboardingFields:y=!1,showTreasuryFields:C=!1,sectionHeader:b,optionalFields:E=[],sectionSubHeader:$,onCompanyAddressClick:R,onRegisteredAddressClick:S},k)=>{const T=X(),A=t.useTheme(),{watch:I,setValue:B,formState:{errors:L}}=t.useFormContext(),P=I(sn(m,"companySourceOfFunds")),D=I(sn(m,"transactionVolume")),M=I(sn(m,"purposeOfAccount")),F=I(sn(m,"regulatedStatus")),V=I(sn(m,"usNexus")),N=I(sn(m,"companyIndustryType")),H=We=>{B(sn(m,"companySubIndustry"),{selectedOption:null,allOptions:Q.getCompanyOnboardingSubIndustryCodesForIndustry(We)})},W=Yr.labelWidth.value(T),U=Yr.mediumLabelWidth.value(T),Y=Yr.largeLabelWidth.value(T),q=Yr.extraLargeLabelWidth.value(T),Z=Yr.largeLabelDocumentWidth.value(T),G=kt.productType[i],K=c?.companyVerificationStatus!=null?ws(c.companyVerificationStatus.code,A.mode,"solid"):null,J=r?.companyFiles.find(We=>We.documentType==="certificate_of_incorporation"),oe=r?.companyFiles.find(We=>We.documentType==="tax_ein"),ee=r?.companyDescription,te=r?.companyLegalName,se=r?.website,ie=r?.typeOfIncorporation,re=r?.stateOfIncorporation,ne=r?.countriesOfOperations,me=r?.incDate,pe=r?.companyIndustry,je=r?.companyIndustryType,ce=r?.companySubIndustry,de=r?.companySourceOfFunds,ue=r?.transactionVolume,le=r?.purposeOfAccount,ae=r?.regulatedStatus,ge=r?.usNexus,ye=r?.phone,he=r?.taxIdOrEIN,Ce=r?.primaryContactLocalData,we=r?.deleteFileStatusById??{},ve=r?.updateFileStatusById??{},Ee=r?.addressStatus?.addressToCreate,Se=r?.registeredAddressStatus?.addressToCreate,[$e,Be]=g.useState(!1),[Ae,_e]=g.useState(!1),Te=We=>(d==null||!!We)&&!y,Re=Te(je),ke=(d==null||Array.isArray(ne)&&ne.length>0)&&!y,Oe=Te(re),Me=Te(de),Ie=Te(ue),Ne=Te(le),Pe=Te(ae),Qe=Te(ge),Je=kt.sourceOfFundOptions,tt=We=>Je[We]??We,Ue=N?.selectedOption??je,dt=We=>gve(We,Ue),ct=We=>e.find(nt=>nt.code===We)?.name??We,yt=L[m]!=null&&L[m]?.regulatedStatus!=null,He=L[m]!=null&&L[m]?.regulatedStatusDescription!=null,jt=L[m]!=null&&L[m]?.usNexus!=null,St=L[m]!=null&&L[m]?.usNexusTypes!=null;return t.jsxRuntimeExports.jsxs(dnn,{style:u,ref:k,windowSize:T,children:[t.jsxRuntimeExports.jsxs(unn,{children:[t.jsxRuntimeExports.jsxs(Cnn,{children:[t.jsxRuntimeExports.jsxs(xnn,{children:[f===!0?t.jsxRuntimeExports.jsx(hnn,{children:h?t.jsxRuntimeExports.jsx(gnn,{}):t.jsxRuntimeExports.jsx(fnn,{})}):null,t.jsxRuntimeExports.jsx(pnn,{windowSize:T,children:b??kt.confirmCompanyDetails})]}),x?t.jsxRuntimeExports.jsx(ynn,{children:t.jsxRuntimeExports.jsx(Le,{variant:"small-description",display:"flex",maxWidth:"280px",data:kt.confirmCompanyDetailsTooltip,placement:T==="small"||i==="onboarding"?"bottom":"right",children:t.jsxRuntimeExports.jsx(jnn,{})})}):null,i==="onboarding"&&b!=null?t.jsxRuntimeExports.jsx(lAe,{text:cnn}):null,c?.companyVerificationStatus!=null&&K!=null?t.jsxRuntimeExports.jsxs(wnn,{children:[t.jsxRuntimeExports.jsx(ao,{label:c.companyVerificationStatus.name,labelColor:K.color.toString(),capsuleBackground:K.backgroundColor?.toString()}),c?.isRefreshingViewInBackground?t.jsxRuntimeExports.jsx(Et,{start:!0,size:"Small",style:{display:"flex",alignItems:"center",marginLeft:o.sp2}}):null]}):null]}),t.jsxRuntimeExports.jsx(mnn,{windowSize:T,children:$??kt.confirmCompanyDetailsSubTitle})]}),t.jsxRuntimeExports.jsxs(bnn,{windowSize:T,children:[t.jsxRuntimeExports.jsx(aAe,{}),t.jsxRuntimeExports.jsx(gC,{name:sn(m,"certificateOfIncorporation"),isDisabled:d,sizeLimit:fu,deleteFileStatusById:we,updateFileStatusById:ve,filesEndPoint:n.filesEndPoint,authParams:n.authParams,label:{label:kt.certificateOfIncorporation,width:Z},filemetadataPayload:{documentType:"certificate_of_incorporation",purposeId:"business_verification",documentSide:"front"},file:J,acceptableTypes:["image/jpg","image/jpeg","image/png","application/pdf","image/heic","image/heif"],registerOptions:{required:d==null&&E.includes("certificateOfIncorporation")===!1&&l==="unit"},hasError:$e,updateFilesEntity:n.updateFilesEntity,onEditFileName:n.onEditFileName,onDeleteFile:n.onDeleteFile,onFileSizeError:We=>Be(We),errorInfoLabel:kt.certOfIncopDocumentError.replace("_product_type_",G),formatHintLabel:nce.formatDocumentText10MB,formatHintIsError:$e,showFormatHintLabel:$e||!(d!=null||J!=null)}),t.jsxRuntimeExports.jsx(gC,{name:sn(m,"ein"),isDisabled:d,sizeLimit:fu,deleteFileStatusById:we,updateFileStatusById:ve,filesEndPoint:n.filesEndPoint,authParams:n.authParams,label:{label:kt.einDocument,width:Z},filemetadataPayload:{documentType:"tax_ein",purposeId:"business_verification",documentSide:"front"},file:oe,acceptableTypes:["image/jpg","image/jpeg","image/png","application/pdf","image/heic","image/heif"],registerOptions:{required:d==null&&E.includes("ein")===!1},errorInfoLabel:kt.einDocumentError.replace("_product_type_",G),hasError:Ae,updateFilesEntity:n.updateFilesEntity,onEditFileName:n.onEditFileName,onDeleteFile:n.onDeleteFile,onFileSizeError:We=>_e(We),formatHintLabel:nce.formatDocumentText10MB,formatHintIsError:Ae,showFormatHintLabel:Ae||!(d!=null||oe!=null)}),t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,showAdditionalInfoLabel:!1,label:{label:kt.companyLegalNameLabel,width:Y},text:{type:"text",name:sn(m,"companyLegalName"),placeholder:kt.companyLegalNamePlaceholder,defaultValue:te,options:{required:d==null&&E.includes("companyLegalName")===!1}},additionalInfoLabel:kt.companyLegalNameError.replace("_product_type_",G)}),t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,showAdditionalInfoLabel:!1,label:{label:kt.companyDescriptionLabel,width:U},text:{type:"text",name:sn(m,"companyDescription"),placeholder:kt.addProductPlaceholder,defaultValue:ee,options:{required:d==null&&E.includes("companyDescription")===!1}},additionalInfoLabel:kt.companyDescriptionError.replace("_product_type_",G)}),t.jsxRuntimeExports.jsx(fC,{isDisabled:d,label:{label:kt.registeredAddressLabel,width:U},addressValueField:{name:sn(m,"registeredAddress"),placeholder:kt.registeredAddressPlaceholder,defaultValue:Se,registerOptions:{validate:We=>E.includes("registeredAddress")===!1?!(d==null&&We==null):!0},onClick:()=>{S?.("company_registered_address")}},additionalInfoLabel:kt.registeredAddressError.replace("_product_type_",G),showAdditionalInfoLabel:!1,style:{width:"auto"}}),t.jsxRuntimeExports.jsx(fC,{isDisabled:d,label:{label:kt.companyAddressLabel,width:U},addressValueField:{name:sn(m,"companyAddress"),placeholder:kt.companyAddressPlaceholder,defaultValue:Ee,registerOptions:{validate:We=>E.includes("companyAddress")===!1?!(d==null&&We==null):!0},onClick:()=>{R?.("company_address")}},additionalInfoLabel:kt.companyAddressError.replace("_product_type_",G),showAdditionalInfoLabel:!1,style:{width:"auto"}}),t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,showAdditionalInfoLabel:!1,label:{label:kt.companyWebsiteLabel,width:W},text:{type:"url",name:sn(m,"companyWebsite"),placeholder:kt.companyWebsitePlaceholder,defaultValue:se?.toString()??"",options:{required:d==null&&E.includes("companyWebsite")===!1}},additionalInfoLabel:kt.companyWebsiteError.replace("_product_type_",G)}),t.jsxRuntimeExports.jsx(y_,{className:"regulated-status-industry",windowSize:T,$isDisabledRow:d!=null,"data-suppress-hover":d!=null?!0:void 0,children:Re?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(ei,{label:{label:kt.companyIndustryLabel,width:W},singleSelectField:{singleSelect:{name:sn(m,"companyIndustryType"),placeholder:kt.companyIndustryPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:hve,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:je,allOptions:[...Q.COMPANY_ONBOARDING_INDUSTRY_TYPE_CODES]},registerOptions:{required:d==null&&E.includes("companyIndustryType")===!1,validate:We=>E.includes("companyIndustryType")===!1?!(d==null&&!We?.selectedOption):!0},onSelectChange:H},isFunctional:!0,errorInfoLabel:kt.companyIndustryError.replace("_product_type_",G),style:{padding:0,margin:0,outline:"none",border:"none",width:"100%",maxWidth:"100%",backgroundColor:"transparent"}}),Ue!=null&&t.jsxRuntimeExports.jsx(ei,{isSecondaryInput:!0,label:{label:"",width:0,style:{marginRight:0}},singleSelectField:{singleSelect:{name:sn(m,"companySubIndustry"),placeholder:kt.companySubIndustryPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:dt,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:ce,allOptions:Q.getCompanyOnboardingSubIndustryCodesForIndustry(Ue)},registerOptions:{required:d==null&&E.includes("companySubIndustry")===!1,validate:We=>E.includes("companySubIndustry")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,errorInfoLabel:kt.companySubIndustryError.replace("_product_type_",G),additionalInfoLabel:d==null?kt.companyIndustryAdditionalInfo:void 0,style:{outline:"none",border:"none",padding:0,margin:`${o.sp2} 0 0 0`,width:"100%",maxWidth:"100%",backgroundColor:"transparent"}})]}):t.jsxRuntimeExports.jsx(ei,{label:{label:kt.companyIndustryLabel,width:W},singleSelectField:{singleSelect:{name:sn(m,"companyIndustry"),placeholder:kt.companyIndustryPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:ct,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:pe,allOptions:e?.map(We=>We.code)??[]},registerOptions:{required:d==null&&E.includes("companyIndustry")===!1,validate:We=>E.includes("companyIndustry")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,errorInfoLabel:kt.companyIndustryError.replace("_product_type_",G),additionalInfoLabel:d==null?kt.companyIndustryAdditionalInfo:void 0,style:{padding:0,margin:0,outline:"none",border:"none",width:"100%",maxWidth:"100%",backgroundColor:"transparent"}})}),t.jsxRuntimeExports.jsx(l9,{label:{label:kt.companyTypeOfIncorporationLabel,width:Y},isDisabled:d,creatableSingleSelectField:{name:sn(m,"typeOfIncorporation"),placeholder:kt.companyTypeOfIncorporationPlaceholder,defaultValue:{selectedOption:ie,allOptions:oce.companyIncInfo.allTypesOfIncorporation},registerOptions:{required:d==null&&E.includes("typeOfIncorporation")===!1,validate:We=>E.includes("typeOfIncorporation")===!1?!(d==null&&!We?.selectedOption):!0}},errorInfoLabel:kt.companyTypeOfIncorporationError.replace("_product_type_",G)}),t.jsxRuntimeExports.jsx(Pr,{isDisabled:d,label:{label:kt.companyIncDateLabel,width:Y},dateField:{name:sn(m,"incDate"),placeholder:kt.companyIncDatePlaceholder,defaultValue:me,dateFormat:ann.defaultInput,maxDate:Q.dateNow(),minDate:Q.zeniDate("01 Jan 1900"),autoComplete:"off",registerOptions:{required:d==null&&E.includes("incDate")===!1}},additionalInfoLabel:kt.companyIncDateError.replace("_product_type_",G),style:{width:"auto"}}),Oe?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(l9,{label:{label:kt.companyStateOfIncorporationLabel,width:Y},isDisabled:d,creatableSingleSelectField:{name:sn(m,"stateOfIncorporation"),placeholder:kt.companyStateOfIncorporationPlaceholder,defaultValue:{selectedOption:re,allOptions:oce.companyIncInfo.allStatesOfIncorporation},registerOptions:{required:d==null&&E.includes("stateOfIncorporation")===!1,validate:We=>E.includes("stateOfIncorporation")===!1?!(d==null&&!We?.selectedOption):!0}},errorInfoLabel:kt.companyStateOfIncorporationError.replace("_product_type_",G)})}):null,ke?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(FG,{label:{label:kt.countriesOfOperationsLabel,width:Y},isDisabled:d,additionalInfoLabel:d==null?kt.countriesOfOperationsAdditionalInfo:void 0,errorInfoLabel:kt.countriesOfOperationsError.replace("_product_type_",G),multiSelectField:{name:sn(m,"countriesOfOperations"),placeholder:kt.countriesOfOperationsPlaceholder,defaultValue:U9(ne,(a??[]).map(We=>We.countryCode)),registerOptions:{validate:We=>E.includes("countriesOfOperations")?!0:!(d==null&&We.selectedOptions.length===0)}},style:{width:"auto"}})}):null,Me?t.jsxRuntimeExports.jsx(j_,{children:t.jsxRuntimeExports.jsx(ei,{label:{label:kt.companySourceOfFundsLabel,width:Y},singleSelectField:{singleSelect:{name:sn(m,"companySourceOfFunds"),placeholder:kt.companySourceOfFundsPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:pve,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:de,allOptions:[...Q.COMPANY_SOURCE_OF_FUNDS_CODES]},registerOptions:{required:d==null&&E.includes("companySourceOfFunds")===!1,validate:We=>E.includes("companySourceOfFunds")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,additionalContent:rve.includes(P?.selectedOption)?t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,label:{label:"",width:0,style:{marginRight:0,marginTop:0,marginBottom:0}},controlWidth:Yr.width.value(T)-Yr.horizontalChromePx.value(T),isSecondaryInput:!0,text:{type:"text",name:sn(m,"companySourceOfFundsDescription"),style:{...L[m]!=null&&L[m]?.companySourceOfFundsDescription!=null?{backgroundColor:v.importantLight}:{}},placeholder:kt.descriptionPlaceholder,options:{required:d==null}},showAdditionalInfoLabel:!1,showErrorInfoLabel:!0,errorInfoLabel:kt.companySourceOfFundsDescriptionError,style:{position:"relative",top:0,padding:0,margin:`${o.sp2} 0 0 0`,outline:"none",border:"none",borderRadius:"6px"}}):null,additionalInfoLabel:d!=null||L[m]!=null&&L[m]?.companySourceOfFundsDescription!=null?void 0:kt.companySourceOfFundsAdditionalInfo,errorInfoLabel:kt.companySourceOfFundsError.replace("_product_type_",G)})}):null,Ie?t.jsxRuntimeExports.jsx(j_,{children:t.jsxRuntimeExports.jsx(ei,{label:{label:kt.transactionVolumeLabel,width:q},singleSelectField:{singleSelect:{name:sn(m,"transactionVolume"),placeholder:kt.transactionVolumePlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:uve,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:ue,allOptions:[...Q.COMPANY_TRANSACTION_VOLUME_CODES]},registerOptions:{required:d==null&&E.includes("transactionVolume")===!1,validate:We=>E.includes("transactionVolume")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,additionalContent:ave.includes(D?.selectedOption)?t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,label:{label:"",width:0,style:{marginRight:0,marginTop:0,marginBottom:0}},isSecondaryInput:!0,text:{type:"text",name:sn(m,"transactionVolumeDescription"),style:{...L[m]!=null&&L[m]?.transactionVolumeDescription!=null?{backgroundColor:v.importantLight}:{}},placeholder:kt.descriptionPlaceholder,options:{required:d==null}},controlWidth:Yr.width.value(T)-Yr.horizontalChromePx.value(T),showAdditionalInfoLabel:!1,showErrorInfoLabel:!0,errorInfoLabel:kt.transactionVolumeDescriptionError,style:{position:"relative",top:0,padding:0,margin:`${o.sp2} 0 0 0`,outline:"none",border:"none",borderRadius:"6px"}}):null,additionalInfoLabel:d!=null||L[m]!=null&&L[m]?.transactionVolumeDescription!=null?void 0:kt.transactionVolumeAdditionalInfo,errorInfoLabel:kt.transactionVolumeError.replace("_product_type_",G)})}):null,Ne?t.jsxRuntimeExports.jsx(j_,{children:t.jsxRuntimeExports.jsx(ei,{label:{label:kt.purposeOfAccountLabel,width:Y},singleSelectField:{singleSelect:{name:sn(m,"purposeOfAccount"),placeholder:kt.purposeOfAccountPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:mve,isDisabled:d,showTickMark:!0,sortOptions:!1},defaultValue:{selectedOption:le,allOptions:[...Q.COMPANY_PURPOSE_OF_ACCOUNT_CODES]},registerOptions:{required:d==null&&E.includes("purposeOfAccount")===!1,validate:We=>E.includes("purposeOfAccount")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,additionalContent:lve.includes(M?.selectedOption)?t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,label:{label:"",width:0,style:{marginRight:0,marginTop:0,marginBottom:0}},text:{type:"text",name:sn(m,"purposeOfAccountDescription"),placeholder:kt.descriptionPlaceholder,style:{...L[m]!=null&&L[m]?.purposeOfAccountDescription!=null?{backgroundColor:v.importantLight}:{}},options:{required:d==null}},controlWidth:Yr.width.value(T)-Yr.horizontalChromePx.value(T),isSecondaryInput:!0,showAdditionalInfoLabel:!1,showErrorInfoLabel:!0,errorInfoLabel:kt.purposeOfAccountDescriptionError,style:{position:"relative",top:0,padding:0,margin:`${o.sp2} 0 0 0`,outline:"none",border:"none",borderRadius:"6px"}}):null,additionalInfoLabel:d!=null||L[m]!=null&&L[m]?.purposeOfAccountDescription!=null?void 0:kt.purposeOfAccountAdditionalInfo,errorInfoLabel:kt.purposeOfAccountError.replace("_product_type_",G)})}):null,Pe?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(y_,{windowSize:T,$isDisabledRow:d!=null,"data-suppress-hover":d!=null?!0:void 0,children:[t.jsxRuntimeExports.jsxs(rce,{children:[t.jsxRuntimeExports.jsx(Ft,{label:kt.regulatedStatusLabel,htmlFor:sn(m,"regulatedStatus"),isDisabled:d,syncBackgroundWithAncestor:!0,style:{width:Y,marginRight:Yr.labelMarginRight.valuePx(T)}}),t.jsxRuntimeExports.jsxs(ace,{labelWidth:Y,windowSize:T,children:[t.jsxRuntimeExports.jsx(Bo,{label:{label:sce},style:{paddingRight:`${o.sp4}`,width:"auto",border:"none"},radioField:{name:sn(m,"regulatedStatus"),id:`${sn(m,"regulatedStatus")}.yes`,value:"yes",style:{height:`${o.sp3}`,width:`${o.sp3}`},radioSize:"small",registerOptions:{required:d==null&&E.includes("regulatedStatus")===!1}},isDisabled:d,isContainerClickable:!0}),t.jsxRuntimeExports.jsx(Bo,{label:{label:ice},style:{width:"auto",border:"none"},radioField:{name:sn(m,"regulatedStatus"),id:`${sn(m,"regulatedStatus")}.no`,value:"no",style:{height:`${o.sp3}`,width:`${o.sp3}`},radioSize:"small",registerOptions:{required:d==null&&E.includes("regulatedStatus")===!1}},isDisabled:d,isContainerClickable:!0})]})]}),F==="yes"&&t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,label:{label:"",width:0,style:{marginRight:0,marginTop:0,marginBottom:0,marginLeft:0}},isSecondaryInput:!0,text:{type:"text",name:sn(m,"regulatedStatusDescription"),placeholder:kt.regulatedStatusDescriptionPlaceholder,options:{required:d==null,shouldUnregister:!0},style:{...L[m]!=null&&L[m]?.regulatedStatusDescription!=null?{backgroundColor:v.importantLight}:{}}},showAdditionalInfoLabel:!1,showErrorInfoLabel:!0,errorInfoLabel:kt.regulatedStatusDescriptionError,style:{margin:`${o.sp2} 0 0 0`,padding:0,outline:"none",border:"none",borderRadius:"6px",width:"100%",maxWidth:"100%",minWidth:0}}),yt?t.jsxRuntimeExports.jsx(qE,{windowSize:T,isError:!0,children:kt.regulatedStatusError.replace("_product_type_",G)}):d==null&&He===!1?t.jsxRuntimeExports.jsx(qE,{windowSize:T,isError:!1,children:kt.regulatedStatusAdditionalInfo}):null]})}):null,Qe?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(y_,{className:"regulated-status-us-nexus",windowSize:T,$isDisabledRow:d!=null,"data-suppress-hover":d!=null?!0:void 0,"data-us-nexus-types-invalid":St?!0:void 0,children:[t.jsxRuntimeExports.jsxs(rce,{children:[t.jsxRuntimeExports.jsx(Ft,{label:kt.usNexusLabel,htmlFor:sn(m,"usNexus"),isDisabled:d,syncBackgroundWithAncestor:!0,style:{width:Y,marginRight:Yr.labelMarginRight.valuePx(T)}}),t.jsxRuntimeExports.jsxs(ace,{labelWidth:Y,windowSize:T,children:[t.jsxRuntimeExports.jsx(Bo,{label:{label:sce},style:{paddingRight:`${o.sp4}`,width:"auto",border:"none"},radioField:{name:sn(m,"usNexus"),id:`${sn(m,"usNexus")}.yes`,value:"yes",style:{height:`${o.sp3}`,width:`${o.sp3}`},radioSize:"small",registerOptions:{required:d==null&&E.includes("usNexus")===!1}},isDisabled:d,isContainerClickable:!0}),t.jsxRuntimeExports.jsx(Bo,{label:{label:ice},style:{width:"auto",border:"none"},radioField:{name:sn(m,"usNexus"),id:`${sn(m,"usNexus")}.no`,value:"no",style:{height:`${o.sp3}`,width:`${o.sp3}`},radioSize:"small",registerOptions:{required:d==null&&E.includes("usNexus")===!1}},isDisabled:d,isContainerClickable:!0})]})]}),V==="yes"&&t.jsxRuntimeExports.jsx(Enn,{className:"us-nexus-types-inner-field",children:t.jsxRuntimeExports.jsx(NG,{isDisabled:d,label:{label:"",width:0,style:{marginRight:0,marginTop:0,marginBottom:0,marginLeft:0}},multiSelectField:{name:sn(m,"usNexusTypes"),placeholder:kt.usNexusPlaceholder,getOptionLabel:xve,defaultValue:{selectedOptions:r?.usNexusTypes??[],allOptions:[...Q.COMPANY_US_NEXUS_TYPE_CODES]},registerOptions:{required:d==null,shouldUnregister:!0,validate:We=>{const nt=We?.selectedOptions;return nt!=null&&nt.length>0}}},style:{outline:"none",margin:`${o.sp2} 0 0 0`,padding:0,width:"100%",maxWidth:"100%",border:"none",borderRadius:"6px"},errorInfoLabel:kt.usNexusTypesError.replace("_product_type_",G)})}),jt?t.jsxRuntimeExports.jsx(qE,{windowSize:T,isError:!0,children:kt.usNexusError.replace("_product_type_",G)}):d==null&&St===!1?t.jsxRuntimeExports.jsx(qE,{windowSize:T,isError:!1,children:kt.usNexusAdditionalInfo}):null]})}):null,t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,showAdditionalInfoLabel:!1,label:{label:kt.companyTaxIdLabel,width:W},text:{type:"text",name:sn(m,"companyTaxId"),placeholder:kt.companyTaxIdPlaceholder,defaultValue:he,options:{required:d==null&&E.includes("companyTaxId")===!1,pattern:L9},autoComplete:"new-password"},additionalInfoLabel:kt.companyTaxIdError.replace("_product_type_",G)}),t.jsxRuntimeExports.jsx(I1,{isDisabled:d,label:{label:kt.companyPhoneLabel,width:W},text:{name:sn(m,"companyPhone"),placeholder:Io(kt.companyPhoneLabel),defaultValue:ye,autoComplete:"new-password",options:{required:d==null&&E.includes("companyPhone")===!1}},errorInfoLabel:kt.companyPhoneError.replace("_product_type_",G),style:{width:"auto"}}),t.jsxRuntimeExports.jsx(d4,{isDisabled:d,label:{label:kt.companyPrimaryContactNameLabel,width:Y},nameField:{name:sn(m,"primaryContactName"),placeHolder:{firstName:kt.firstNamePlaceholder,lastName:kt.lastNamePlaceholder,name:kt.namePlaceholder},defaultValue:{firstName:Ce?.firstName??"",lastName:Ce?.lastName??""},registerOptions:{required:d==null&&E.includes("primaryContactName")===!1,validate:We=>!!We||d!=null||E.includes("primaryContactName")},showFullNameError:!0},errorInfoLabel:kt.companyPrimaryContactNameError.replace("_product_type_",G),style:{width:"auto"}}),t.jsxRuntimeExports.jsx(Pt,{isDisabled:d,label:{label:kt.companyPrimaryContactEmailLabel,width:Y},text:{type:"email",name:sn(m,"primaryContactEmail"),placeholder:kt.companyPrimaryContactEmailPlaceholder,defaultValue:Ce?.email,options:{required:d==null&&E.includes("primaryContactEmail")===!1}},errorInfoLabel:kt.companyPrimaryContactEmailError.replace("_product_type_",G)}),C===!0?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(ei,{label:{label:kt.sourceOfFundsLabel,width:W},singleSelectField:{singleSelect:{name:sn(m,"sourceOfFunds"),placeholder:kt.sourceOfFundsPlaceholder,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:tt,isDisabled:d,showTickMark:!1,menuPlacement:"top",sortOptions:!1},defaultValue:{selectedOption:r?.sourceOfFunds,allOptions:Object.keys(kt.sourceOfFundOptions)},registerOptions:{required:d==null&&E.includes("sourceOfFunds")===!1,validate:We=>E.includes("sourceOfFunds")===!1?!(d==null&&!We?.selectedOption):!0}},isFunctional:!0,errorInfoLabel:kt.sourceOfFundsError.replace("_product_type_",G)})}):null]})]})});jY.displayName="Company Details Section";const sn=(e,n)=>`${e}.${n}`,dnn=s.div`
43054
43054
  display: flex;
43055
43055
  flex-direction: column;
43056
43056
  `,unn=s.div`
@@ -43452,7 +43452,7 @@ to {
43452
43452
  flex-direction: row;
43453
43453
  cursor: pointer;
43454
43454
  align-items: center;
43455
- `,Db={width:new w(343,580,756),labelWidth:new w(115,145,155),largeLabelWidth:new w(160,240,240),veryLargeLabelWidth:new w(150,240,245),paddingBottom:new w(p[3],p[2]),containerRowGap:new w(p[2],p[2])},uAe={title:new Ke("largeSemiBold","largeSemiBold"),subTitle:new Ke("smallSemiBold","smallSemiBold")};function pAe({companyOfficerData:e,isDisabled:n,allOfficers:i,allNationalityCountries:r,isRefreshingViewInBackground:a,connectedAccountProvider:l,style:c,isPopupOpen:d,sectionId:u,filesEndPoint:m,authParams:x,showInfoTooltip:h=!0,isCompleted:f=!1,showCompletedIcon:y=!1,showOfficerSelect:C=!0,showVerificationTag:b=!0,isForTreasury:E=!1,isOverlay:$=!1,productType:R,companyTitles:S,sectionHeader:k,sectionSubHeader:T,optionalFields:A=[],onOfficerAddressClick:I,onDeleteFile:B,onEditFileName:L,updateFilesEntity:P,openPopup:D,onGetOtp:M,onVerifyOtp:F,onResendOtp:V,verifiedPhoneNumber:N,onPhoneVerified:H}){const W=X(),U=t.useTheme(),{getValues:Y,setValue:q}=t.useFormContext(),Z=i.length>0,[G,K]=g.useState(!1),J=Z?Object.values(e).findIndex(Pe=>Pe?.isSelectedForVerification===!0):0,oe=`Officer_${J<0?1:J+1}`;g.useEffect(()=>{H!=null&&e[oe]?.phone!=null&&e[oe].isPhoneVerified===!0&&H(e[oe]?.phone??"")},[]);const ee=`${u}.${J}`,te=e[oe],se=E?te?.treasuryUserVerificationStatus:te?.userVerificationStatus,ie=se!=null?ws(se.code,U.mode,"solid"):null,re=i.find(Pe=>Pe.userId===te?.userId),ne=i.sort((Pe,Ue)=>(Pe.firstName||Pe.lastName?`${Pe.firstName} ${Pe.lastName}`:Pe.email).localeCompare(Ue.firstName||Ue.lastName?`${Ue.firstName} ${Ue.lastName}`:Ue.email)),me=Z?ne.findIndex(Pe=>Pe.userId===te?.userId):0,pe=e[oe]?.deleteFileStatusById??{},je=e[oe]?.updateFileStatusById??{},ce=Y(`${ee}.selectDocument.selectDocumentType`),{common:{optional:de,documents:ue},commonSetUp:{businessVerification:le},dateFormat:{visual:ae},cockpit:ge}=O.getLocalizedStrings(),ye=R==="onboarding"?le.productType.business_verification:le.productType[R],he=Db.labelWidth.value(W),Ce=Db.veryLargeLabelWidth.value(W),we=Db.largeLabelWidth.value(W),ve=W==="small"?le.companyRolePlaceholderSmall:le.companyRolePlaceholder,Ee=W==="small"?le.protectedSsnTextSmall:le.protectedSsnText,Se=se?.code==="pending_review"||se?.code==="verified"?"readonly":n,$e=Se!=null||!Z||se?.code==="require_info",Be=re?.firstName||re?.lastName?`${re?.firstName} ${re?.lastName}`:le.addOfficer,Ae=te?.userId!=null?le.confirmIdentityDetails:le.confirmIdentityDetailsNewOfficer,_e=le.confirmIdentityDetailsSubTitle,Te={menu:()=>({right:"initial",left:0})},Re=Pe=>S.find(Ue=>Ue.code===Pe)?.name??Pe,ke=te?.otpverificationStatus?.fetchState,Oe=Ye(ke);g.useEffect(()=>{H!=null&&Oe==="In-Progress"&&ke==="Completed"&&H(Y(`${ee}.phone`))},[Oe,ke]);const Me=(Pe,Ue)=>{F(Pe,Ue)},Ie=()=>N==null||N===""?!1:Y(`${ee}.phone`)===N,Ne=()=>{const Pe=Y(`${ee}.phone`);return Pe!=null&&!t.isValidPhoneNumber(Pe)?le.phoneErrorForOnboarding:le.phoneError.replace("_product_type_",ye)};return t.jsxRuntimeExports.jsxs(Gnn,{style:c,windowSize:W,children:[t.jsxRuntimeExports.jsx(Ynn,{windowSize:W,isOverlay:$,children:t.jsxRuntimeExports.jsxs(Znn,{children:[t.jsxRuntimeExports.jsxs(Knn,{children:[t.jsxRuntimeExports.jsxs(Jnn,{children:[t.jsxRuntimeExports.jsxs(esn,{children:[y===!0?t.jsxRuntimeExports.jsx(tsn,{children:f?t.jsxRuntimeExports.jsx(osn,{}):t.jsxRuntimeExports.jsx(nsn,{})}):null,t.jsxRuntimeExports.jsx(qnn,{windowSize:W,children:k??Ae})]}),h?t.jsxRuntimeExports.jsx(ssn,{children:t.jsxRuntimeExports.jsx(Le,{variant:"small-description",maxWidth:"275px",data:le.confirmIdentityDetailsTooltip,display:"flex",placement:W==="small"||R==="onboarding"?"bottom":"right",children:t.jsxRuntimeExports.jsx(isn,{})})}):null,R==="onboarding"&&k!=null?t.jsxRuntimeExports.jsx(lAe,{text:de}):null,se!=null&&b&&ie!=null?t.jsxRuntimeExports.jsxs(usn,{children:[t.jsxRuntimeExports.jsx(ao,{label:se.name,labelColor:ie.color.toString(),capsuleBackground:ie.backgroundColor?.toString()}),a?t.jsxRuntimeExports.jsx(Et,{start:!0,size:"Small",style:{display:"flex",alignItems:"center",marginLeft:o.sp2}}):null]}):null]}),t.jsxRuntimeExports.jsx(Xnn,{windowSize:W,children:T??_e})]}),C?t.jsxRuntimeExports.jsx(lsn,{children:$e?Z?t.jsxRuntimeExports.jsxs(dsn,{children:[re?.photo!==void 0?t.jsxRuntimeExports.jsx(rsn,{src:re?.photo.href,alt:ge.userProfileAltText,onError:({currentTarget:Pe})=>{Pe.onerror=null,Pe.src=Zi},loading:"lazy"}):t.jsxRuntimeExports.jsx(ka,{firstName:re?.firstName??"",lastName:re?.lastName??"",index:me}),t.jsxRuntimeExports.jsx(lce,{children:`${Be}`})]}):t.jsxRuntimeExports.jsxs(psn,{children:[t.jsxRuntimeExports.jsx(msn,{children:t.jsxRuntimeExports.jsx(xsn,{})}),t.jsxRuntimeExports.jsx(lce,{children:`${le.addOfficer}`})]}):t.jsxRuntimeExports.jsx(asn,{style:{marginRight:0},children:t.jsxRuntimeExports.jsx(Snn,{style:{marginRight:0,paddingRight:0},selectedUser:re,allUsers:i,onSelectedUserChanged:Pe=>{const Ue=Object.values(e).findIndex(Je=>Je?.userId===Pe?.userId);q(`${ee}.isSelectedForVerification`,!1),q(`${u}.${Ue}.isSelectedForVerification`,!0)},customization:{placeholderLabel:le.addOfficer},showAddUser:i.length<=9,pickerStyles:{backgroundColor:U.colors.grey4,selectedOptionBackgroundColor:U.colors.background,customStyleConfig:{...W==="small"?Te:{},control:Pe=>({...Pe,paddingRight:0})}}})})}):null]})}),Object.values(e).map((Pe,Ue)=>{if(J!==Ue)return null;const Je=f5(Pe?.documentTypeSelectedForVerification),tt=Pe?.userFiles??[],Qe=()=>N!=""&&R==="onboarding"?Ie():Pe?.isPhoneVerified??!1;return t.jsxRuntimeExports.jsxs(csn,{children:[t.jsxRuntimeExports.jsx(aAe,{}),t.jsxRuntimeExports.jsx(tbe,{name:Om(ee,"selectDocument"),officerIndex:J,sizeLimit:fu,filesEndPoint:m,authParams:x,onEditFileName:L,acceptableTypes:["image/jpg","image/jpeg","image/png","image/heic","image/heif"],label:{width:Ce},allFiles:tt,updateFilesEntity:P,deleteFileStatusById:pe,updateFileStatusById:je,onDeleteFile:B,isDisabled:Se,menuPlacement:R==="onboarding"&&Je==null?"top":"auto",defaultValue:{defaultSelectDocumentType:Je,allSelectDocumentType:["driverLicense","passport","ssnCard"],files:{front:pd(!0,tt,ce),back:pd(!1,tt,ce)}},registerOptions:{required:A.includes("selectDocument")===!1},hasError:G,additionalInfoLabel:ue.formatDocumentMax10MB,errorInfoLabel:le.companyIdDescription.replace("_product_type_",ye),onFileSizeError:dt=>K(dt),isPopupOpen:d,openPopup:D,companyOfficerName:{firstName:Pe?.firstName??"",lastName:Pe?.lastName??""},style:{width:"auto"}}),t.jsxRuntimeExports.jsx(d4,{isDisabled:Se,label:{label:le.name,width:he},nameField:{name:Om(ee,"name"),placeHolder:{firstName:le.firstNamePlaceholder,lastName:le.lastNamePlaceholder,name:le.namePlaceholder},defaultValue:{firstName:Pe?.firstName??"",lastName:Pe?.lastName??""},registerOptions:{required:A.includes("name")===!1,validate:dt=>A.includes("name")===!1?!!dt:!0},showFullNameError:!0},errorInfoLabel:le.nameError.replace("_product_type_",ye),style:{width:"auto"}}),Pe?.userId==null?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Pt,{isDisabled:Se,showAdditionalInfoLabel:!1,label:{label:le.email,width:he},text:{type:"email",name:Om(ee,"email"),placeholder:Io(le.email),defaultValue:Pe?.email,options:{required:A.includes("email")===!1}},additionalInfoLabel:le.emailDescription.replace("_product_type_",ye),style:{width:"auto"}})}):null,t.jsxRuntimeExports.jsx(Pr,{isDisabled:Se,label:{label:le.dobLabel,width:we},dateField:{name:Om(ee,"dob"),type:"text",defaultValue:Pe?.birthday,placeholder:Io(le.dobLabel),dateFormat:ae.defaultInput,maxDate:Q.dateNow().subtract(l==="unit"?18:13,"years"),registerOptions:{required:A.includes("dob")===!1},autoComplete:"off"},additionalInfoLabel:le.dobDescription.replace("_product_type_",ye),style:{width:"auto"},isMasked:!0}),t.jsxRuntimeExports.jsx(Z9,{isDisabled:Se,label:{label:le.nationalityLabel,width:he},showAdditionalInfoLabel:R!=="onboarding",additionalInfoLabel:le.nationalityDescription.replace("_product_type_",ye),countrySelectField:{name:Om(ee,"nationalityCountryCode"),placeholder:le.nationalityPlaceholder,defaultValue:cl(Pe?.nationalityCountryCode,r.map(dt=>dt.countryCode)),registerOptions:{validate:dt=>!!(dt!=null&&dt.selectedOption)}},style:{width:"auto"}}),t.jsxRuntimeExports.jsx(fC,{isDisabled:Se,label:{label:le.address,width:he},addressValueField:{name:Om(ee,"officerAddress"),placeholder:Io(le.address),defaultValue:Pe?.addressStatus?.addressToCreate,registerOptions:{validate:dt=>A.includes("officerAddress")===!1?!(Se==null&&dt==null):!0},onClick:()=>{I(Pe?.officerType.toLocaleLowerCase().concat("_address"))}},additionalInfoLabel:R==="onboarding"?le.addressAdditionInfo:le.addressError.replace("_product_type_",ye),showAdditionalInfoLabel:!0,style:{width:"auto"}}),t.jsxRuntimeExports.jsx(I1,{isDisabled:Se,label:{label:le.phone,width:he},text:{name:Om(ee,"phone"),placeholder:Io(le.phone),defaultValue:Pe?.phone,autoComplete:"new-password",options:{required:A.includes("phone")===!1}},errorInfoLabel:Ne(),verificationErrorInfoLabel:le.phoneValidationError,isPopupOpen:d,phoneVerifyButtonProps:{otpChallenge:Pe?.otpChallenge,showOtpButton:l==="unit",onGetOtp:M,onVerifyOtp:Me,onResendOtp:V,isPhoneVerified:Qe(),phoneVerificationStatus:Pe?.otpverificationStatus,getOtpStatus:Pe?.sendOtpStatus,openPopup:D,verifiedPhoneNumber:N,focusNotRequired:!0},style:{width:"auto"}}),t.jsxRuntimeExports.jsx(ei,{label:{label:le.companyRoleLabel,width:we},singleSelectField:{singleSelect:{name:Om(ee,"role"),placeholder:ve,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:Re,isDisabled:Se,showTickMark:!0,maxMenuHeight:250},defaultValue:{selectedOption:Pe?.titleAtCompany,allOptions:S?.map(dt=>dt.code)??[]},registerOptions:{required:A.includes("role")===!1,validate:dt=>A.includes("role")===!1?!(Se==null&&!dt?.selectedOption):!0}},isFunctional:!0,errorInfoLabel:le.companyRoleDescription.replace("_product_type_",ye)}),t.jsxRuntimeExports.jsx(Qs,{isDisabled:Se,showAdditionalInfoLabel:!1,label:{label:le.companyOwnershipLabel,width:we},formattedTextField:{type:"number",name:Om(ee,"ownership"),defaultValue:Pe?.ownershipInCompany,placeholder:le.companyOwnershipPlaceholder,returnValueType:"floatValue",suffix:"%",allowNegative:!1,isNumericString:!1,registerOptions:{required:A.includes("ownership")===!1,validate:dt=>dt!=null?dt>0&&dt<=100:!0,max:100},autoComplete:"new-password"},additionalInfoLabel:R==="onboarding"?le.companyOwnershipDescriptionForOnboarding:le.companyOwnershipDescription}),t.jsxRuntimeExports.jsx(Qs,{isDisabled:Se,showAdditionalInfoLabel:!1,label:{label:le.ssnLabel,width:we},formattedTextField:{type:"text",name:Om(ee,"ssn"),placeholder:le.addSSNPlaceholder,defaultValue:Pe?.ssn,format:"###-##-####",registerOptions:{required:A.includes("ssn")===!1,pattern:ST},autoComplete:"new-password",maxLength:9,allowLeadingZeros:!0},protectedInfoText:Se!=null&&Pe?.ssn?Ee:void 0,additionalInfoLabel:le.ssnDescription.replace("_product_type_",ye),isMasked:!0})]},ee)})]})}const Om=(e,n)=>`${e}.${n}`,Gnn=s.div`
43455
+ `,Db={width:new w(343,580,756),labelWidth:new w(115,145,155),largeLabelWidth:new w(160,240,240),veryLargeLabelWidth:new w(150,240,245),paddingBottom:new w(p[3],p[2]),containerRowGap:new w(p[2],p[2])},uAe={title:new Ke("largeSemiBold","largeSemiBold"),subTitle:new Ke("smallSemiBold","smallSemiBold")};function pAe({companyOfficerData:e,isDisabled:n,allOfficers:i,allNationalityCountries:r,isRefreshingViewInBackground:a,connectedAccountProvider:l,style:c,isPopupOpen:d,sectionId:u,filesEndPoint:m,authParams:x,showInfoTooltip:h=!0,isCompleted:f=!1,showCompletedIcon:y=!1,showOfficerSelect:C=!0,showVerificationTag:b=!0,isForTreasury:E=!1,isOverlay:$=!1,productType:R,companyTitles:S,sectionHeader:k,sectionSubHeader:T,optionalFields:A=[],onOfficerAddressClick:I,onDeleteFile:B,onEditFileName:L,updateFilesEntity:P,openPopup:D,onGetOtp:M,onVerifyOtp:F,onResendOtp:V,verifiedPhoneNumber:N,onPhoneVerified:H}){const W=X(),U=t.useTheme(),{getValues:Y,setValue:q}=t.useFormContext(),Z=i.length>0,[G,K]=g.useState(!1),J=Z?Object.values(e).findIndex(Pe=>Pe?.isSelectedForVerification===!0):0,oe=`Officer_${J<0?1:J+1}`;g.useEffect(()=>{H!=null&&e[oe]?.phone!=null&&e[oe].isPhoneVerified===!0&&H(e[oe]?.phone??"")},[]);const ee=`${u}.${J}`,te=e[oe],se=E?te?.treasuryUserVerificationStatus:te?.userVerificationStatus,ie=se!=null?ws(se.code,U.mode,"solid"):null,re=i.find(Pe=>Pe.userId===te?.userId),ne=i.sort((Pe,Qe)=>(Pe.firstName||Pe.lastName?`${Pe.firstName} ${Pe.lastName}`:Pe.email).localeCompare(Qe.firstName||Qe.lastName?`${Qe.firstName} ${Qe.lastName}`:Qe.email)),me=Z?ne.findIndex(Pe=>Pe.userId===te?.userId):0,pe=e[oe]?.deleteFileStatusById??{},je=e[oe]?.updateFileStatusById??{},ce=Y(`${ee}.selectDocument.selectDocumentType`),{common:{optional:de,documents:ue},commonSetUp:{businessVerification:le},dateFormat:{visual:ae},cockpit:ge}=O.getLocalizedStrings(),ye=R==="onboarding"?le.productType.business_verification:le.productType[R],he=Db.labelWidth.value(W),Ce=Db.veryLargeLabelWidth.value(W),we=Db.largeLabelWidth.value(W),ve=W==="small"?le.companyRolePlaceholderSmall:le.companyRolePlaceholder,Ee=W==="small"?le.protectedSsnTextSmall:le.protectedSsnText,Se=se?.code==="pending_review"||se?.code==="verified"?"readonly":n,$e=Se!=null||!Z||se?.code==="require_info",Be=re?.firstName||re?.lastName?`${re?.firstName} ${re?.lastName}`:le.addOfficer,Ae=te?.userId!=null?le.confirmIdentityDetails:le.confirmIdentityDetailsNewOfficer,_e=le.confirmIdentityDetailsSubTitle,Te={menu:()=>({right:"initial",left:0})},Re=Pe=>S.find(Qe=>Qe.code===Pe)?.name??Pe,ke=te?.otpverificationStatus?.fetchState,Oe=Ye(ke);g.useEffect(()=>{H!=null&&Oe==="In-Progress"&&ke==="Completed"&&H(Y(`${ee}.phone`))},[Oe,ke]);const Me=(Pe,Qe)=>{F(Pe,Qe)},Ie=()=>N==null||N===""?!1:Y(`${ee}.phone`)===N,Ne=()=>{const Pe=Y(`${ee}.phone`);return Pe!=null&&!t.isValidPhoneNumber(Pe)?le.phoneErrorForOnboarding:le.phoneError.replace("_product_type_",ye)};return t.jsxRuntimeExports.jsxs(Gnn,{style:c,windowSize:W,children:[t.jsxRuntimeExports.jsx(Ynn,{windowSize:W,isOverlay:$,children:t.jsxRuntimeExports.jsxs(Znn,{children:[t.jsxRuntimeExports.jsxs(Knn,{children:[t.jsxRuntimeExports.jsxs(Jnn,{children:[t.jsxRuntimeExports.jsxs(esn,{children:[y===!0?t.jsxRuntimeExports.jsx(tsn,{children:f?t.jsxRuntimeExports.jsx(osn,{}):t.jsxRuntimeExports.jsx(nsn,{})}):null,t.jsxRuntimeExports.jsx(qnn,{windowSize:W,children:k??Ae})]}),h?t.jsxRuntimeExports.jsx(ssn,{children:t.jsxRuntimeExports.jsx(Le,{variant:"small-description",maxWidth:"275px",data:le.confirmIdentityDetailsTooltip,display:"flex",placement:W==="small"||R==="onboarding"?"bottom":"right",children:t.jsxRuntimeExports.jsx(isn,{})})}):null,R==="onboarding"&&k!=null?t.jsxRuntimeExports.jsx(lAe,{text:de}):null,se!=null&&b&&ie!=null?t.jsxRuntimeExports.jsxs(usn,{children:[t.jsxRuntimeExports.jsx(ao,{label:se.name,labelColor:ie.color.toString(),capsuleBackground:ie.backgroundColor?.toString()}),a?t.jsxRuntimeExports.jsx(Et,{start:!0,size:"Small",style:{display:"flex",alignItems:"center",marginLeft:o.sp2}}):null]}):null]}),t.jsxRuntimeExports.jsx(Xnn,{windowSize:W,children:T??_e})]}),C?t.jsxRuntimeExports.jsx(lsn,{children:$e?Z?t.jsxRuntimeExports.jsxs(dsn,{children:[re?.photo!==void 0?t.jsxRuntimeExports.jsx(rsn,{src:re?.photo.href,alt:ge.userProfileAltText,onError:({currentTarget:Pe})=>{Pe.onerror=null,Pe.src=Zi},loading:"lazy"}):t.jsxRuntimeExports.jsx(ka,{firstName:re?.firstName??"",lastName:re?.lastName??"",index:me}),t.jsxRuntimeExports.jsx(lce,{children:`${Be}`})]}):t.jsxRuntimeExports.jsxs(psn,{children:[t.jsxRuntimeExports.jsx(msn,{children:t.jsxRuntimeExports.jsx(xsn,{})}),t.jsxRuntimeExports.jsx(lce,{children:`${le.addOfficer}`})]}):t.jsxRuntimeExports.jsx(asn,{style:{marginRight:0},children:t.jsxRuntimeExports.jsx(Snn,{style:{marginRight:0,paddingRight:0},selectedUser:re,allUsers:i,onSelectedUserChanged:Pe=>{const Qe=Object.values(e).findIndex(Je=>Je?.userId===Pe?.userId);q(`${ee}.isSelectedForVerification`,!1),q(`${u}.${Qe}.isSelectedForVerification`,!0)},customization:{placeholderLabel:le.addOfficer},showAddUser:i.length<=9,pickerStyles:{backgroundColor:U.colors.grey4,selectedOptionBackgroundColor:U.colors.background,customStyleConfig:{...W==="small"?Te:{},control:Pe=>({...Pe,paddingRight:0})}}})})}):null]})}),Object.values(e).map((Pe,Qe)=>{if(J!==Qe)return null;const Je=f5(Pe?.documentTypeSelectedForVerification),tt=Pe?.userFiles??[],Ue=()=>N!=""&&R==="onboarding"?Ie():Pe?.isPhoneVerified??!1;return t.jsxRuntimeExports.jsxs(csn,{children:[t.jsxRuntimeExports.jsx(aAe,{}),t.jsxRuntimeExports.jsx(tbe,{name:Om(ee,"selectDocument"),officerIndex:J,sizeLimit:fu,filesEndPoint:m,authParams:x,onEditFileName:L,acceptableTypes:["image/jpg","image/jpeg","image/png","image/heic","image/heif"],label:{width:Ce},allFiles:tt,updateFilesEntity:P,deleteFileStatusById:pe,updateFileStatusById:je,onDeleteFile:B,isDisabled:Se,menuPlacement:R==="onboarding"&&Je==null?"top":"auto",defaultValue:{defaultSelectDocumentType:Je,allSelectDocumentType:["driverLicense","passport","ssnCard"],files:{front:pd(!0,tt,ce),back:pd(!1,tt,ce)}},registerOptions:{required:A.includes("selectDocument")===!1},hasError:G,additionalInfoLabel:ue.formatDocumentMax10MB,errorInfoLabel:le.companyIdDescription.replace("_product_type_",ye),onFileSizeError:dt=>K(dt),isPopupOpen:d,openPopup:D,companyOfficerName:{firstName:Pe?.firstName??"",lastName:Pe?.lastName??""},style:{width:"auto"}}),t.jsxRuntimeExports.jsx(d4,{isDisabled:Se,label:{label:le.name,width:he},nameField:{name:Om(ee,"name"),placeHolder:{firstName:le.firstNamePlaceholder,lastName:le.lastNamePlaceholder,name:le.namePlaceholder},defaultValue:{firstName:Pe?.firstName??"",lastName:Pe?.lastName??""},registerOptions:{required:A.includes("name")===!1,validate:dt=>A.includes("name")===!1?!!dt:!0},showFullNameError:!0},errorInfoLabel:le.nameError.replace("_product_type_",ye),style:{width:"auto"}}),Pe?.userId==null?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Pt,{isDisabled:Se,showAdditionalInfoLabel:!1,label:{label:le.email,width:he},text:{type:"email",name:Om(ee,"email"),placeholder:Io(le.email),defaultValue:Pe?.email,options:{required:A.includes("email")===!1}},additionalInfoLabel:le.emailDescription.replace("_product_type_",ye),style:{width:"auto"}})}):null,t.jsxRuntimeExports.jsx(Pr,{isDisabled:Se,label:{label:le.dobLabel,width:we},dateField:{name:Om(ee,"dob"),type:"text",defaultValue:Pe?.birthday,placeholder:Io(le.dobLabel),dateFormat:ae.defaultInput,maxDate:Q.dateNow().subtract(l==="unit"?18:13,"years"),registerOptions:{required:A.includes("dob")===!1},autoComplete:"off"},additionalInfoLabel:le.dobDescription.replace("_product_type_",ye),style:{width:"auto"},isMasked:!0}),t.jsxRuntimeExports.jsx(Z9,{isDisabled:Se,label:{label:le.nationalityLabel,width:he},showAdditionalInfoLabel:R!=="onboarding",additionalInfoLabel:le.nationalityDescription.replace("_product_type_",ye),countrySelectField:{name:Om(ee,"nationalityCountryCode"),placeholder:le.nationalityPlaceholder,defaultValue:cl(Pe?.nationalityCountryCode,r.map(dt=>dt.countryCode)),registerOptions:{validate:dt=>!!(dt!=null&&dt.selectedOption)}},style:{width:"auto"}}),t.jsxRuntimeExports.jsx(fC,{isDisabled:Se,label:{label:le.address,width:he},addressValueField:{name:Om(ee,"officerAddress"),placeholder:Io(le.address),defaultValue:Pe?.addressStatus?.addressToCreate,registerOptions:{validate:dt=>A.includes("officerAddress")===!1?!(Se==null&&dt==null):!0},onClick:()=>{I(Pe?.officerType.toLocaleLowerCase().concat("_address"))}},additionalInfoLabel:R==="onboarding"?le.addressAdditionInfo:le.addressError.replace("_product_type_",ye),showAdditionalInfoLabel:!0,style:{width:"auto"}}),t.jsxRuntimeExports.jsx(I1,{isDisabled:Se,label:{label:le.phone,width:he},text:{name:Om(ee,"phone"),placeholder:Io(le.phone),defaultValue:Pe?.phone,autoComplete:"new-password",options:{required:A.includes("phone")===!1}},errorInfoLabel:Ne(),verificationErrorInfoLabel:le.phoneValidationError,isPopupOpen:d,phoneVerifyButtonProps:{otpChallenge:Pe?.otpChallenge,showOtpButton:l==="unit",onGetOtp:M,onVerifyOtp:Me,onResendOtp:V,isPhoneVerified:Ue(),phoneVerificationStatus:Pe?.otpverificationStatus,getOtpStatus:Pe?.sendOtpStatus,openPopup:D,verifiedPhoneNumber:N,focusNotRequired:!0},style:{width:"auto"}}),t.jsxRuntimeExports.jsx(ei,{label:{label:le.companyRoleLabel,width:we},singleSelectField:{singleSelect:{name:Om(ee,"role"),placeholder:ve,showValueEyeIcon:!1,showEyeIconOnSelect:!1,getLabelForId:Re,isDisabled:Se,showTickMark:!0,maxMenuHeight:250},defaultValue:{selectedOption:Pe?.titleAtCompany,allOptions:S?.map(dt=>dt.code)??[]},registerOptions:{required:A.includes("role")===!1,validate:dt=>A.includes("role")===!1?!(Se==null&&!dt?.selectedOption):!0}},isFunctional:!0,errorInfoLabel:le.companyRoleDescription.replace("_product_type_",ye)}),t.jsxRuntimeExports.jsx(Qs,{isDisabled:Se,showAdditionalInfoLabel:!1,label:{label:le.companyOwnershipLabel,width:we},formattedTextField:{type:"number",name:Om(ee,"ownership"),defaultValue:Pe?.ownershipInCompany,placeholder:le.companyOwnershipPlaceholder,returnValueType:"floatValue",suffix:"%",allowNegative:!1,isNumericString:!1,registerOptions:{required:A.includes("ownership")===!1,validate:dt=>dt!=null?dt>0&&dt<=100:!0,max:100},autoComplete:"new-password"},additionalInfoLabel:R==="onboarding"?le.companyOwnershipDescriptionForOnboarding:le.companyOwnershipDescription}),t.jsxRuntimeExports.jsx(Qs,{isDisabled:Se,showAdditionalInfoLabel:!1,label:{label:le.ssnLabel,width:we},formattedTextField:{type:"text",name:Om(ee,"ssn"),placeholder:le.addSSNPlaceholder,defaultValue:Pe?.ssn,format:"###-##-####",registerOptions:{required:A.includes("ssn")===!1,pattern:ST},autoComplete:"new-password",maxLength:9,allowLeadingZeros:!0},protectedInfoText:Se!=null&&Pe?.ssn?Ee:void 0,additionalInfoLabel:le.ssnDescription.replace("_product_type_",ye),isMasked:!0})]},ee)})]})}const Om=(e,n)=>`${e}.${n}`,Gnn=s.div`
43456
43456
  display: flex;
43457
43457
  flex-direction: column;
43458
43458
  row-gap: ${e=>Db.containerRowGap.valuePx(e.windowSize)};
@@ -43568,7 +43568,7 @@ to {
43568
43568
  width: ${o.sp3};
43569
43569
  height: ${o.sp3};
43570
43570
  color: ${e=>e.theme.colors.champion};
43571
- `,mAe=e=>j.createElement("svg",{width:78,height:91,viewBox:"0 0 78 91",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M64.9922 45.5V36.0296V15.3598C64.9922 14.2147 64.5014 13.1245 63.6442 12.3653L52.5113 2.50554C51.7798 1.85768 50.8364 1.5 49.8593 1.5H3.14733C1.95707 1.5 0.992188 2.48261 0.992188 3.69472L0.992188 85.3053C0.992188 86.5174 1.95707 87.5 3.14733 87.5H62.8371C64.0273 87.5 64.9922 86.5174 64.9922 85.3053V78.5",stroke:"#97C3B9",strokeWidth:1.5,strokeMiterlimit:10,strokeLinecap:"round"}),j.createElement("path",{opacity:.2,d:"M3.99219 6.69472L3.99219 88.3053C3.99219 89.5174 4.95707 90.5 6.14733 90.5H65.8371C67.0273 90.5 67.9922 89.5174 67.9922 88.3053V20.8804C67.9922 19.6893 67.4614 18.5602 66.5443 17.8003L51.6024 5.41991C50.8849 4.82536 49.9822 4.5 49.0504 4.5H6.14733C4.95707 4.5 3.99219 5.48261 3.99219 6.69472Z",fill:"#97C3B9"}),j.createElement("path",{d:"M33.2172 32.5352H6.96289",stroke:"#EEBA7D",strokeWidth:1.5,strokeMiterlimit:10,strokeLinecap:"round"}),j.createElement("path",{d:"M53.5181 22H6.96289",stroke:"#EEBA7D",strokeWidth:1.5,strokeMiterlimit:10,strokeLinecap:"round"}),j.createElement("path",{d:"M41.796 11.4648H6.96289",stroke:"#EEBA7D",strokeWidth:1.5,strokeMiterlimit:10,strokeLinecap:"round"}),j.createElement("path",{d:"M47.8259 43.0195H6.96289",stroke:"#EEBA7D",strokeWidth:1.5,strokeMiterlimit:10,strokeLinecap:"round"}),j.createElement("path",{d:"M48.9766 61.6719C48.9766 64.9042 50.2606 68.0041 52.5462 70.2897C54.8318 72.5753 57.9317 73.8594 61.1641 73.8594C64.3964 73.8594 67.4963 72.5753 69.7819 70.2897C72.0675 68.0041 73.3516 64.9042 73.3516 61.6719C73.3516 58.4395 72.0675 55.3396 69.7819 53.054C67.4963 50.7684 64.3964 49.4844 61.1641 49.4844C57.9317 49.4844 54.8318 50.7684 52.5462 53.054C50.2606 55.3396 48.9766 58.4395 48.9766 61.6719Z",stroke:"#EEBA7D",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M51.9922 60.5C51.9922 63.0859 53.0194 65.5658 54.8479 67.3943C56.6764 69.2228 59.1563 70.25 61.7422 70.25",stroke:"#EEBA7D",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M77.0082 77.516L69.7822 70.29",stroke:"#EEBA7D",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),rb={width:new w(343,580,756),subTitlePaddingTop:new w(12,p[3]),subTitlePaddingBottom:new w(p[3],p[3]),verificationDetailsRowGap:new w(12,p[5],p[5]),termsPaddingLeftRight:new w(p[0],p[3]),marginLeft:new w(p[4],p[0]),containerPaddingLeft:new w(p[3],p[6],p[8]),containerPaddingRight:new w(p[3],p[6],p[8]),navBarContainerPaddingXaxis:new w(10,p[3])},hsn={stepTitle:new Ke("h6Regular","h5Regular")},cce="businessVerificationPage",yg="companyDetails",jg="companyOfficerDetails",{commonSetUp:{businessVerification:rs},common:{currency:dce,footer:uce,strings:{empty:gsn}}}=O.getLocalizedStrings(),fsn=({businessVerificationDetails:e,allNationalityCountries:n,verficationDetailsFetchState:i,isRefreshingViewInBackground:r,filesEndPoint:a,authParams:l,productType:c,allIndustries:d,companyTitles:u,maxInsuredAmount:m,isDisabled:x,isSettings:h=!1,isOverlay:f=!1,analytics:y,isStepInProgress:C=!1,isTreasuryTransferInitiated:b=!1,transferDetails:E,onOverlayClose:$,onAddressClick:R,onRegisteredAddressClick:S,onBackClick:k,onGetOtp:T,onVerifyOtp:A,onResendOtp:I,onSendForVerificationClick:B,onEditFileName:L,onCompanyDetailsChanged:P,updateFilesEntity:D,onDeleteFile:M,onDeleteFileList:F,onCompanyOfficerUpdated:V,saveNewAddressInLocalStore:N,onSaveDetailsClick:H,onClickMenuIcon:W,onExecuteTreasuryTransfer:U})=>{const Y=t.useTheme(),q=X(),{updateStatus:Z,companyView:G,companyDetailsLocalData:K,companyOfficerLocalData:J}=e,oe=Ye(Z.fetchState),ee=G?.company.company.featuresActivationInfo.connectedAccountProvider,te=ee==="unit"?t.jsxRuntimeExports.jsxs($sn,{children:[rs.terms.term1,t.jsxRuntimeExports.jsx(Kn,{href:rs.terms.consentUrl,onZeniLinkClick:()=>(y?.trackBillPayAgreement(),!0),linkText:rs.terms.consent}),rs.terms.term2,t.jsxRuntimeExports.jsx(Kn,{href:rs.terms.depositUrl,onZeniLinkClick:()=>(y?.trackBillPayAgreement(),!0),linkText:rs.terms.depositTerms}),rs.terms.term3,t.jsxRuntimeExports.jsx(Kn,{href:rs.terms.privacyPolicyUrl,onZeniLinkClick:()=>(y?.trackBillPayAgreement(),!0),linkText:rs.terms.privacy}),rs.terms.term4,t.jsxRuntimeExports.jsx(Kn,{href:rs.terms.tosUrl,onZeniLinkClick:()=>(y?.trackBillPayPrivacyPolicy(),!0),linkText:rs.terms.tos}),rs.terms.term5]}):rs.terms.termsForStripe,[se,ie]=g.useState(!1),[re,ne]=g.useState("save"),[me,pe]=g.useState(!1),je=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:ysn(e,d,u,n)}),{isValid:ce}=je.formState,de=G?.company.company.companyBillPayInfo,ue=G?.company.company.companyTreasuryInfo,le=c==="zeni_treasury"?ue?.companyVerificationStatus:de?.companyVerificationStatus,ae=Object.values(J).findIndex(Me=>Me?.isSelectedForVerification===!0),ge=`Officer_${ae<0?1:ae+1}`,ye=()=>{const Me=J[ge],Ie=Me?.email,Ne=Me?.birthday?.toString(),Pe=Me?.ownershipInCompany,Ue=Me?.firstName,Je=Me?.lastName,tt=Me?.titleAtCompany,Qe=Me?.documentTypeSelectedForVerification,dt=Me?.phone,ct=Me?.addressStatus?.addressToCreate,yt=ct!=null?Q.getFormattedAddress(ct):void 0,He=K?.companyDescription,jt=K?.companyLegalName,St=K?.companyIndustry,We=K?.phone,nt=K?.website,ut=K?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(K?.addressStatus?.addressToCreate):void 0,pt=K?.primaryContactLocalData,Bt=pt?.firstName,Ht=pt?.lastName,$o=pt?.email;Ie!=null&&Pe!=null&&Ue!=null&&Je!=null&&Ne!=null&&tt!=null&&dt!=null&&yt!=null&&Qe!=null&&He!=null&&jt!=null&&We!=null&&nt!=null&&St!=null&&jt!=null&&ut!=null&&Bt!=null&&Ht!=null&&$o!=null&&y?.trackBusinessVerificationSend({email:Ie,birthday:Ne.toString(),companyOwnership:Pe,firstName:Ue,lastName:Je,companyRole:tt,phone:dt,formattedAddress:yt,documentTypeForVerification:Qe},{companyDescription:He,legalName:jt,phone:We,website:nt.toString(),industry:St,formattedAddress:ut},{firstName:Bt,lastName:Ht,email:$o},c,h?"Settings":void 0)},he=()=>{const Me=J[ge],Ie=K?.primaryContactLocalData,Ne=Me?.email??"",Pe=!!Me?.firstName&&!!Me?.lastName,Ue=Ie?.email??"",Je=!!Ie?.firstName&&!!Ie?.lastName;return Ne&&!Pe?((!Me?.firstName||!Me?.lastName)&&je.trigger(`${jg}.${ae<0?0:ae}.name`,{shouldFocus:!0}),!1):Ue&&!Je?((!Ie?.firstName||!Ie?.lastName)&&je.trigger(`${yg}.primaryContactName`,{shouldFocus:!0}),!1):!0},Ce=()=>{const Me=J[ge],Ie=K?.primaryContactLocalData,Ne=Me?.email,Pe=Ie?.email;if(Ne){if(!Pe)return(Ie?.firstName||Ie?.lastName)&&je.trigger(`${yg}.primaryContactEmail`,{shouldFocus:!0}),!1}else if(Me?.firstName||Me?.lastName||Me?.birthday||Me?.nationalityCountryCode||Me?.ownershipInCompany||Me?.phone||Me?.ssn||Me?.titleAtCompany||Me?.addressStatus?.addressToCreate||Me?.fileIds!=null&&Me?.fileIds.length>0||Be!=null&&Be?.length>0)return je.trigger(`${jg}.${ae<0?0:ae}.email`,{shouldFocus:!0}),!1;return!0},we=je.handleSubmit(()=>{if(re!=="verification"&&ne("verification"),ee==="unit"&&J[ge]?.isPhoneVerified!==!0){je.setError(`${jg}.${ae}.phone`,{type:"custom"});return}const Me=t.flatMap(Object.values(J).map(Pe=>Object.values(Pe?.deleteFileStatusById??{}).filter(Ue=>Ue!=null))),Ie=Object.values(K?.deleteFileStatusById??{}).filter(Pe=>Pe!=null);Q.reduceAllFetchState(Me.concat(Ie)).fetchState!=="In-Progress"&&ce&&(ye(),B?.(ge),b===!0&&U?.())}),ve=async(Me,Ie)=>{Me.includes(yg)?P?.(Ie[yg]):Me.includes(jg)&&V?.(Ie[jg])},Ee=g.useCallback(t.debounce((Me,Ie)=>{ve(Me,Ie)},300),[]);g.useEffect(()=>{const Me=je.watch((Ie,{name:Ne})=>{Ne!=null&&Ie!=null&&t.defer(()=>Ee(Ne,Ie))});return()=>{Me.unsubscribe()}});const Se=Ye(e.companyDetailsLocalData?.addressStatus);g.useEffect(()=>{e.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&e.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&Se==null&&(N?.("company_registered_address",e.companyDetailsLocalData?.addressStatus?.addressToCreate),je.setValue(`${yg}.registeredAddress`,e.companyDetailsLocalData?.addressStatus?.addressToCreate))},[e.companyDetailsLocalData?.addressStatus,e.companyDetailsLocalData?.registeredAddressStatus,Se,N,je]);const $e=G?.companyOfficers.slice(0,10).sort((Me,Ie)=>Me.user.createTime?.isAfter(Ie.user.createTime)===!0?1:-1),Be=$e?.map(Me=>Me.user),Ae=$e?.map(Me=>Me.role),_e={onOkClick:()=>{ie(!1),k();const Me=[],Ie=G?.company.company.incInfo.fileIds??[];je.getValues(`${yg}.fileIds`).forEach(Pe=>{Ie.includes(Pe)||Me.push(Pe)}),Ae?.forEach((Pe,Ue)=>{const Je=Pe?.fileIds??[];je.getValues(`${jg}.${Ue}.fileIds`).forEach(Qe=>{Je.includes(Qe)||Me.push(Qe)})}),Me.length!==0&&F?.(Me)},onCancelClick:()=>{ie(!1)}},Te=Ao(ki(m),m,dce.currencySymbol).toUpperCase(),Re=le?.code==="pending_review"||le?.code==="verified",ke=(E?.treasuryTransferMoneyLocalData?.amount?.amount??0)>0;if(c==="zeni_treasury"&&le?.code==="pending_review"&&oe==="In-Progress"&&Z.fetchState==="Completed")return t.jsxRuntimeExports.jsxs(Tsn,{children:[t.jsxRuntimeExports.jsxs(Lsn,{children:[t.jsxRuntimeExports.jsx(mAe,{}),t.jsxRuntimeExports.jsx(Bsn,{windowSize:q,children:b===!0?rs.submittedTitleWithTransfer:rs.submittedTitle}),t.jsxRuntimeExports.jsx(Isn,{isReadonly:!1,children:b===!0?rs.submittedDescriptionWithTransfer.replace("__amount__",Ao(ki(E?.treasuryTransferMoneyLocalData?.amount?.amount??0),E?.treasuryTransferMoneyLocalData?.amount?.amount??0,dce.currencySymbol)).replace("__account__",E?.treasuryTransferMoneyLocalData?.fromAccount?.label??""):rs.submittedDescription})]}),t.jsxRuntimeExports.jsx(Ge,{label:rs.submittedButton,onClick:()=>{k(),$?.()},variant:"primary"})]});const Oe=()=>{const Me=de?.companyVerificationStatus?.code==="verified",Ie=(K?.countriesOfOperations?.length??0)>0||K?.companySourceOfFunds!=null||K?.transactionVolume!=null||K?.purposeOfAccount!=null||K?.registeredAddressStatus!=null||K?.usNexus!=null;return Me===!0&&Ie===!1};return t.jsxRuntimeExports.jsxs(jsn,{isSettings:h,children:[t.jsxRuntimeExports.jsx(Rt,{title:f&&C===!0?gsn:rs.header,backgroundColor:Y.colors.grey5,style:{zIndex:me?1:4},onBackClick:()=>{kc(je.formState.dirtyFields)?ie(!0):k()},showBackButton:!h&&!f,showMenuIcon:h?q==="medium-compact"||q==="small":!1,onClickMenuIcon:W,rightSideComponent:f?t.jsxRuntimeExports.jsx(Psn,{"data-testid":_("nav-bar-close-business-verification-overlay"),onClick:()=>{k(),$?.()}}):null,source:"BusinessVerificationPage"}),se===!0?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:rs.discardTitle}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:rs.discardDescription}),primaryButtonText:rs.discard,secondaryButtonText:rs.cancel,proceedButtonVariant:"destructive",action:_e}):null,t.jsxRuntimeExports.jsx(bsn,{windowSize:q,children:i==="In-Progress"||i==="Not-Started"?t.jsxRuntimeExports.jsx(Hsn,{windowSize:q}):t.jsxRuntimeExports.jsx(t.FormProvider,{...je,children:t.jsxRuntimeExports.jsxs("form",{id:pce(cce),onSubmit:we,children:[f&&C===!0&&t.jsxRuntimeExports.jsxs(Csn,{children:[t.jsxRuntimeExports.jsxs(Rsn,{windowSize:q,children:[t.jsxRuntimeExports.jsx(vsn,{windowSize:q,children:Re?rs.businessVerificationDetails:ke?rs.verifyBusinessDetails:rs.verifyBusinessDetailsWithoutTransfer}),!Re&&t.jsxRuntimeExports.jsx(Ssn,{children:t.jsxRuntimeExports.jsxs(Asn,{children:[t.jsxRuntimeExports.jsx(mce,{}),ke&&t.jsxRuntimeExports.jsx(mce,{}),t.jsxRuntimeExports.jsx(ksn,{})]})})]}),t.jsxRuntimeExports.jsx(xAe,{isReadonly:Re,children:rs.verifyBusinessDetailsDescription})]}),t.jsxRuntimeExports.jsxs(wsn,{children:[t.jsxRuntimeExports.jsx(pAe,{companyOfficerData:J,allNationalityCountries:n,allOfficers:Be??[],sectionId:jg,isRefreshingViewInBackground:r,connectedAccountProvider:ee,productType:"business_verification",updateFilesEntity:D,onEditFileName:L,onOfficerAddressClick:R,onDeleteFile:M,isDisabled:x,filesEndPoint:a,authParams:l,isPopupOpen:me,openPopup:pe,onGetOtp:T,onVerifyOtp:A,onResendOtp:I,companyTitles:u,isForTreasury:c==="zeni_treasury",isOverlay:f}),t.jsxRuntimeExports.jsx(jY,{companyDetails:K,businessVerificationProps:{companyVerificationStatus:le,isRefreshingViewInBackground:r},productType:"business_verification",showTreasuryFields:c==="zeni_treasury",hideNewOnboardingFields:Oe(),sectionId:yg,isDisabled:le?.code==="pending_review"||le?.code==="verified"?"readonly":x,fileProps:{authParams:l,filesEndPoint:a,onEditFileName:L,onDeleteFile:M,updateFilesEntity:D},onCompanyAddressClick:R,onRegisteredAddressClick:S,connectedAccountProvider:ee,allIndustries:d,allNationalityCountries:n})]}),c==="zeni_accounts"?t.jsxRuntimeExports.jsx(Esn,{windowSize:q,children:rs.threadText.replace("__amount__",Te)}):null]})})}),i==="Completed"&&(c==="zeni_treasury"?ue?.companyVerificationStatus?.code!=="pending_review"&&ue?.companyVerificationStatus?.code!=="verified":de?.businessVerificationStatus?.code!=="pending_review"&&de?.businessVerificationStatus?.code!=="verified")?t.jsxRuntimeExports.jsx(_t,{formId:pce(cce),primaryBtn:{label:C?uce.submit:rs.sendForVerificationButton,style:{width:"auto",minWidth:q==="small"?"auto":C?"83px":"181px"},isLoading:re==="verification"&&Z.fetchState==="In-Progress",isDisabled:x!=null},containerStyle:{width:q==="small"?rb.width.valuePx(q):"auto",justifyContent:q==="small"?"space-between":"center"},helperStyle:{width:q==="small"?rb.width.valuePx(q):"auto",paddingLeft:rb.termsPaddingLeftRight.valuePx(q),paddingRight:rb.termsPaddingLeftRight.valuePx(q),textAlign:q==="small"?"center":"initial"},showCancel:!0,cancelBtn:{reverseSpinnerColor:!1,label:C?uce.back:rs.saveDetailsButton,style:{width:q==="small"?"auto":C?"83px":"181px"},isLoading:re==="save"&&Z.fetchState==="In-Progress",onClick:()=>{if(C)k();else{const Me=J[ge],Ie=K?.primaryContactLocalData;re!=="save"&&ne("save");const Ne=Me?.email??"",Pe=he(),Ue=Ce();Pe&&Ue&&(y?.trackBusinessVerificationSave({email:Ne,birthday:Me?.birthday?.toString(),companyOwnership:Me?.ownershipInCompany,firstName:Me?.firstName,lastName:Me?.lastName,companyRole:Me?.titleAtCompany,phone:Me?.phone,formattedAddress:Me?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(Me?.addressStatus?.addressToCreate):void 0,documentTypeForVerification:Me?.documentTypeSelectedForVerification},{companyDescription:K?.companyDescription,legalName:K?.companyLegalName,phone:K?.phone,website:K?.website?.toString(),industry:K?.companyIndustry??"",formattedAddress:K?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(K?.addressStatus?.addressToCreate):void 0},{firstName:Ie?.firstName,lastName:Ie?.lastName,email:Ie?.email},c,h?"Settings":void 0),H?.(ge))}}},helperText:te,style:{padding:`12px ${o.sp3}`,zIndex:me?0:4}}):null]})},ysn=(e,n,i,r)=>{const{companyDetailsLocalData:a,companyOfficerLocalData:l,companyView:c}=e,d=O.getLocalizedStrings().companyPassport,u=c?.companyOfficers!=null&&c?.companyOfficers.length>0;return{[yg]:{companyDescription:a?.companyDescription??"",ein:a?.companyFiles.find(m=>m.documentType==="tax_ein"),companyId:a?.companyId??"",syncToken:a?.syncToken,companyLegalName:a?.companyLegalName??"",companyWebsite:a?.website?.toString()??"",companyAddress:a?.addressStatus?.addressToCreate,registeredAddress:a?.registeredAddressStatus?.addressToCreate,companyIndustry:{selectedOption:a?.companyIndustry,allOptions:n?.map(m=>m.code)},companyPhone:a?.phone??"",companyTaxId:a?.taxIdOrEIN??"",primaryContactName:{firstName:a?.primaryContactLocalData?.firstName??"",lastName:a?.primaryContactLocalData?.lastName??""},primaryContactEmail:a?.primaryContactLocalData?.email??"",primaryContactUserId:a?.primaryContactLocalData?.userId,primaryContactSyncToken:a?.primaryContactLocalData?.syncToken,fileIds:a?.companyFiles.map(m=>m.fileId)??[],certificateOfIncorporation:a?.companyFiles.find(m=>m.documentType==="certificate_of_incorporation"),incDate:a?.incDate?.toDate(),typeOfIncorporation:{selectedOption:a?.typeOfIncorporation,allOptions:d.companyIncInfo.allTypesOfIncorporation},stateOfIncorporation:{selectedOption:a?.stateOfIncorporation,allOptions:d.companyIncInfo.allStatesOfIncorporation},sourceOfFunds:{selectedOption:a?.sourceOfFunds??"",allOptions:Object.keys(rs.sourceOfFundOptions)},companySourceOfFunds:{selectedOption:a?.companySourceOfFunds??"",allOptions:Object.keys(rs.companySourceOfFundOptions??{})},companySourceOfFundsDescription:a?.companySourceOfFundsDescription??"",transactionVolume:{selectedOption:a?.transactionVolume,allOptions:[...Q.COMPANY_TRANSACTION_VOLUME_CODES]},transactionVolumeDescription:a?.transactionVolumeDescription??"",purposeOfAccount:{selectedOption:a?.purposeOfAccount,allOptions:[...Q.COMPANY_PURPOSE_OF_ACCOUNT_CODES]},purposeOfAccountDescription:a?.purposeOfAccountDescription??"",usNexus:a?.usNexus??"",usNexusTypes:{selectedOptions:a?.usNexusTypes??[],allOptions:[...Q.COMPANY_US_NEXUS_TYPE_CODES]},regulatedStatus:a?.regulatedStatus??"",regulatedStatusDescription:a?.regulatedStatusDescription??""},[jg]:Object.values(l).map((m,x)=>{const h=m,f=f5(h?.documentTypeSelectedForVerification);return{userId:h?.userId,officerType:h?.officerType??`Officer_${x+1}`,name:{firstName:h?.firstName,lastName:h?.lastName},email:h?.email,fileIds:h?.fileIds??[],dob:h?.birthday?.toDate(),nationalityCountryCode:cl(h?.nationalityCountryCode,r.map(y=>y.countryCode)),ssn:h?.ssn,role:{selectedOption:h?.titleAtCompany,allOptions:i?.map(y=>y.code)},phone:h?.phone??"",ownership:h?.ownershipInCompany,officerAddress:h?.addressStatus?.addressToCreate,selectDocument:{front:pd(!0,h?.userFiles??[],f),back:pd(!1,h?.userFiles??[],f),selectDocumentType:f},isSelectedForVerification:!u&&x===0?!0:h?.isSelectedForVerification??!1,userVerificationStatus:h?.userVerificationStatus,treasuryUserVerificationStatus:h?.treasuryUserVerificationStatus,syncToken:h?.syncToken,isPhoneVerified:h?.isPhoneVerified,otpChallenge:h?.otpChallenge}})}},pce=e=>`${e}_form`,jsn=s.div`
43571
+ `,mAe=e=>j.createElement("svg",{width:78,height:91,viewBox:"0 0 78 91",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M64.9922 45.5V36.0296V15.3598C64.9922 14.2147 64.5014 13.1245 63.6442 12.3653L52.5113 2.50554C51.7798 1.85768 50.8364 1.5 49.8593 1.5H3.14733C1.95707 1.5 0.992188 2.48261 0.992188 3.69472L0.992188 85.3053C0.992188 86.5174 1.95707 87.5 3.14733 87.5H62.8371C64.0273 87.5 64.9922 86.5174 64.9922 85.3053V78.5",stroke:"#97C3B9",strokeWidth:1.5,strokeMiterlimit:10,strokeLinecap:"round"}),j.createElement("path",{opacity:.2,d:"M3.99219 6.69472L3.99219 88.3053C3.99219 89.5174 4.95707 90.5 6.14733 90.5H65.8371C67.0273 90.5 67.9922 89.5174 67.9922 88.3053V20.8804C67.9922 19.6893 67.4614 18.5602 66.5443 17.8003L51.6024 5.41991C50.8849 4.82536 49.9822 4.5 49.0504 4.5H6.14733C4.95707 4.5 3.99219 5.48261 3.99219 6.69472Z",fill:"#97C3B9"}),j.createElement("path",{d:"M33.2172 32.5352H6.96289",stroke:"#EEBA7D",strokeWidth:1.5,strokeMiterlimit:10,strokeLinecap:"round"}),j.createElement("path",{d:"M53.5181 22H6.96289",stroke:"#EEBA7D",strokeWidth:1.5,strokeMiterlimit:10,strokeLinecap:"round"}),j.createElement("path",{d:"M41.796 11.4648H6.96289",stroke:"#EEBA7D",strokeWidth:1.5,strokeMiterlimit:10,strokeLinecap:"round"}),j.createElement("path",{d:"M47.8259 43.0195H6.96289",stroke:"#EEBA7D",strokeWidth:1.5,strokeMiterlimit:10,strokeLinecap:"round"}),j.createElement("path",{d:"M48.9766 61.6719C48.9766 64.9042 50.2606 68.0041 52.5462 70.2897C54.8318 72.5753 57.9317 73.8594 61.1641 73.8594C64.3964 73.8594 67.4963 72.5753 69.7819 70.2897C72.0675 68.0041 73.3516 64.9042 73.3516 61.6719C73.3516 58.4395 72.0675 55.3396 69.7819 53.054C67.4963 50.7684 64.3964 49.4844 61.1641 49.4844C57.9317 49.4844 54.8318 50.7684 52.5462 53.054C50.2606 55.3396 48.9766 58.4395 48.9766 61.6719Z",stroke:"#EEBA7D",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M51.9922 60.5C51.9922 63.0859 53.0194 65.5658 54.8479 67.3943C56.6764 69.2228 59.1563 70.25 61.7422 70.25",stroke:"#EEBA7D",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M77.0082 77.516L69.7822 70.29",stroke:"#EEBA7D",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),rb={width:new w(343,580,756),subTitlePaddingTop:new w(12,p[3]),subTitlePaddingBottom:new w(p[3],p[3]),verificationDetailsRowGap:new w(12,p[5],p[5]),termsPaddingLeftRight:new w(p[0],p[3]),marginLeft:new w(p[4],p[0]),containerPaddingLeft:new w(p[3],p[6],p[8]),containerPaddingRight:new w(p[3],p[6],p[8]),navBarContainerPaddingXaxis:new w(10,p[3])},hsn={stepTitle:new Ke("h6Regular","h5Regular")},cce="businessVerificationPage",yg="companyDetails",jg="companyOfficerDetails",{commonSetUp:{businessVerification:rs},common:{currency:dce,footer:uce,strings:{empty:gsn}}}=O.getLocalizedStrings(),fsn=({businessVerificationDetails:e,allNationalityCountries:n,verficationDetailsFetchState:i,isRefreshingViewInBackground:r,filesEndPoint:a,authParams:l,productType:c,allIndustries:d,companyTitles:u,maxInsuredAmount:m,isDisabled:x,isSettings:h=!1,isOverlay:f=!1,analytics:y,isStepInProgress:C=!1,isTreasuryTransferInitiated:b=!1,transferDetails:E,onOverlayClose:$,onAddressClick:R,onRegisteredAddressClick:S,onBackClick:k,onGetOtp:T,onVerifyOtp:A,onResendOtp:I,onSendForVerificationClick:B,onEditFileName:L,onCompanyDetailsChanged:P,updateFilesEntity:D,onDeleteFile:M,onDeleteFileList:F,onCompanyOfficerUpdated:V,saveNewAddressInLocalStore:N,onSaveDetailsClick:H,onClickMenuIcon:W,onExecuteTreasuryTransfer:U})=>{const Y=t.useTheme(),q=X(),{updateStatus:Z,companyView:G,companyDetailsLocalData:K,companyOfficerLocalData:J}=e,oe=Ye(Z.fetchState),ee=G?.company.company.featuresActivationInfo.connectedAccountProvider,te=ee==="unit"?t.jsxRuntimeExports.jsxs($sn,{children:[rs.terms.term1,t.jsxRuntimeExports.jsx(Kn,{href:rs.terms.consentUrl,onZeniLinkClick:()=>(y?.trackBillPayAgreement(),!0),linkText:rs.terms.consent}),rs.terms.term2,t.jsxRuntimeExports.jsx(Kn,{href:rs.terms.depositUrl,onZeniLinkClick:()=>(y?.trackBillPayAgreement(),!0),linkText:rs.terms.depositTerms}),rs.terms.term3,t.jsxRuntimeExports.jsx(Kn,{href:rs.terms.privacyPolicyUrl,onZeniLinkClick:()=>(y?.trackBillPayAgreement(),!0),linkText:rs.terms.privacy}),rs.terms.term4,t.jsxRuntimeExports.jsx(Kn,{href:rs.terms.tosUrl,onZeniLinkClick:()=>(y?.trackBillPayPrivacyPolicy(),!0),linkText:rs.terms.tos}),rs.terms.term5]}):rs.terms.termsForStripe,[se,ie]=g.useState(!1),[re,ne]=g.useState("save"),[me,pe]=g.useState(!1),je=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:ysn(e,d,u,n)}),{isValid:ce}=je.formState,de=G?.company.company.companyBillPayInfo,ue=G?.company.company.companyTreasuryInfo,le=c==="zeni_treasury"?ue?.companyVerificationStatus:de?.companyVerificationStatus,ae=Object.values(J).findIndex(Me=>Me?.isSelectedForVerification===!0),ge=`Officer_${ae<0?1:ae+1}`,ye=()=>{const Me=J[ge],Ie=Me?.email,Ne=Me?.birthday?.toString(),Pe=Me?.ownershipInCompany,Qe=Me?.firstName,Je=Me?.lastName,tt=Me?.titleAtCompany,Ue=Me?.documentTypeSelectedForVerification,dt=Me?.phone,ct=Me?.addressStatus?.addressToCreate,yt=ct!=null?Q.getFormattedAddress(ct):void 0,He=K?.companyDescription,jt=K?.companyLegalName,St=K?.companyIndustry,We=K?.phone,nt=K?.website,ut=K?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(K?.addressStatus?.addressToCreate):void 0,pt=K?.primaryContactLocalData,Bt=pt?.firstName,Ht=pt?.lastName,$o=pt?.email;Ie!=null&&Pe!=null&&Qe!=null&&Je!=null&&Ne!=null&&tt!=null&&dt!=null&&yt!=null&&Ue!=null&&He!=null&&jt!=null&&We!=null&&nt!=null&&St!=null&&jt!=null&&ut!=null&&Bt!=null&&Ht!=null&&$o!=null&&y?.trackBusinessVerificationSend({email:Ie,birthday:Ne.toString(),companyOwnership:Pe,firstName:Qe,lastName:Je,companyRole:tt,phone:dt,formattedAddress:yt,documentTypeForVerification:Ue},{companyDescription:He,legalName:jt,phone:We,website:nt.toString(),industry:St,formattedAddress:ut},{firstName:Bt,lastName:Ht,email:$o},c,h?"Settings":void 0)},he=()=>{const Me=J[ge],Ie=K?.primaryContactLocalData,Ne=Me?.email??"",Pe=!!Me?.firstName&&!!Me?.lastName,Qe=Ie?.email??"",Je=!!Ie?.firstName&&!!Ie?.lastName;return Ne&&!Pe?((!Me?.firstName||!Me?.lastName)&&je.trigger(`${jg}.${ae<0?0:ae}.name`,{shouldFocus:!0}),!1):Qe&&!Je?((!Ie?.firstName||!Ie?.lastName)&&je.trigger(`${yg}.primaryContactName`,{shouldFocus:!0}),!1):!0},Ce=()=>{const Me=J[ge],Ie=K?.primaryContactLocalData,Ne=Me?.email,Pe=Ie?.email;if(Ne){if(!Pe)return(Ie?.firstName||Ie?.lastName)&&je.trigger(`${yg}.primaryContactEmail`,{shouldFocus:!0}),!1}else if(Me?.firstName||Me?.lastName||Me?.birthday||Me?.nationalityCountryCode||Me?.ownershipInCompany||Me?.phone||Me?.ssn||Me?.titleAtCompany||Me?.addressStatus?.addressToCreate||Me?.fileIds!=null&&Me?.fileIds.length>0||Be!=null&&Be?.length>0)return je.trigger(`${jg}.${ae<0?0:ae}.email`,{shouldFocus:!0}),!1;return!0},we=je.handleSubmit(()=>{if(re!=="verification"&&ne("verification"),ee==="unit"&&J[ge]?.isPhoneVerified!==!0){je.setError(`${jg}.${ae}.phone`,{type:"custom"});return}const Me=t.flatMap(Object.values(J).map(Pe=>Object.values(Pe?.deleteFileStatusById??{}).filter(Qe=>Qe!=null))),Ie=Object.values(K?.deleteFileStatusById??{}).filter(Pe=>Pe!=null);Q.reduceAllFetchState(Me.concat(Ie)).fetchState!=="In-Progress"&&ce&&(ye(),B?.(ge),b===!0&&U?.())}),ve=async(Me,Ie)=>{Me.includes(yg)?P?.(Ie[yg]):Me.includes(jg)&&V?.(Ie[jg])},Ee=g.useCallback(t.debounce((Me,Ie)=>{ve(Me,Ie)},300),[]);g.useEffect(()=>{const Me=je.watch((Ie,{name:Ne})=>{Ne!=null&&Ie!=null&&t.defer(()=>Ee(Ne,Ie))});return()=>{Me.unsubscribe()}});const Se=Ye(e.companyDetailsLocalData?.addressStatus);g.useEffect(()=>{e.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&e.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&Se==null&&(N?.("company_registered_address",e.companyDetailsLocalData?.addressStatus?.addressToCreate),je.setValue(`${yg}.registeredAddress`,e.companyDetailsLocalData?.addressStatus?.addressToCreate))},[e.companyDetailsLocalData?.addressStatus,e.companyDetailsLocalData?.registeredAddressStatus,Se,N,je]);const $e=G?.companyOfficers.slice(0,10).sort((Me,Ie)=>Me.user.createTime?.isAfter(Ie.user.createTime)===!0?1:-1),Be=$e?.map(Me=>Me.user),Ae=$e?.map(Me=>Me.role),_e={onOkClick:()=>{ie(!1),k();const Me=[],Ie=G?.company.company.incInfo.fileIds??[];je.getValues(`${yg}.fileIds`).forEach(Pe=>{Ie.includes(Pe)||Me.push(Pe)}),Ae?.forEach((Pe,Qe)=>{const Je=Pe?.fileIds??[];je.getValues(`${jg}.${Qe}.fileIds`).forEach(Ue=>{Je.includes(Ue)||Me.push(Ue)})}),Me.length!==0&&F?.(Me)},onCancelClick:()=>{ie(!1)}},Te=Ao(ki(m),m,dce.currencySymbol).toUpperCase(),Re=le?.code==="pending_review"||le?.code==="verified",ke=(E?.treasuryTransferMoneyLocalData?.amount?.amount??0)>0;if(c==="zeni_treasury"&&le?.code==="pending_review"&&oe==="In-Progress"&&Z.fetchState==="Completed")return t.jsxRuntimeExports.jsxs(Tsn,{children:[t.jsxRuntimeExports.jsxs(Lsn,{children:[t.jsxRuntimeExports.jsx(mAe,{}),t.jsxRuntimeExports.jsx(Bsn,{windowSize:q,children:b===!0?rs.submittedTitleWithTransfer:rs.submittedTitle}),t.jsxRuntimeExports.jsx(Isn,{isReadonly:!1,children:b===!0?rs.submittedDescriptionWithTransfer.replace("__amount__",Ao(ki(E?.treasuryTransferMoneyLocalData?.amount?.amount??0),E?.treasuryTransferMoneyLocalData?.amount?.amount??0,dce.currencySymbol)).replace("__account__",E?.treasuryTransferMoneyLocalData?.fromAccount?.label??""):rs.submittedDescription})]}),t.jsxRuntimeExports.jsx(Ge,{label:rs.submittedButton,onClick:()=>{k(),$?.()},variant:"primary"})]});const Oe=()=>{const Me=de?.companyVerificationStatus?.code==="verified",Ie=(K?.countriesOfOperations?.length??0)>0||K?.companySourceOfFunds!=null||K?.transactionVolume!=null||K?.purposeOfAccount!=null||K?.registeredAddressStatus!=null||K?.usNexus!=null;return Me===!0&&Ie===!1};return t.jsxRuntimeExports.jsxs(jsn,{isSettings:h,children:[t.jsxRuntimeExports.jsx(Rt,{title:f&&C===!0?gsn:rs.header,backgroundColor:Y.colors.grey5,style:{zIndex:me?1:4},onBackClick:()=>{kc(je.formState.dirtyFields)?ie(!0):k()},showBackButton:!h&&!f,showMenuIcon:h?q==="medium-compact"||q==="small":!1,onClickMenuIcon:W,rightSideComponent:f?t.jsxRuntimeExports.jsx(Psn,{"data-testid":_("nav-bar-close-business-verification-overlay"),onClick:()=>{k(),$?.()}}):null,source:"BusinessVerificationPage"}),se===!0?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:rs.discardTitle}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:rs.discardDescription}),primaryButtonText:rs.discard,secondaryButtonText:rs.cancel,proceedButtonVariant:"destructive",action:_e}):null,t.jsxRuntimeExports.jsx(bsn,{windowSize:q,children:i==="In-Progress"||i==="Not-Started"?t.jsxRuntimeExports.jsx(Hsn,{windowSize:q}):t.jsxRuntimeExports.jsx(t.FormProvider,{...je,children:t.jsxRuntimeExports.jsxs("form",{id:pce(cce),onSubmit:we,children:[f&&C===!0&&t.jsxRuntimeExports.jsxs(Csn,{children:[t.jsxRuntimeExports.jsxs(Rsn,{windowSize:q,children:[t.jsxRuntimeExports.jsx(vsn,{windowSize:q,children:Re?rs.businessVerificationDetails:ke?rs.verifyBusinessDetails:rs.verifyBusinessDetailsWithoutTransfer}),!Re&&t.jsxRuntimeExports.jsx(Ssn,{children:t.jsxRuntimeExports.jsxs(Asn,{children:[t.jsxRuntimeExports.jsx(mce,{}),ke&&t.jsxRuntimeExports.jsx(mce,{}),t.jsxRuntimeExports.jsx(ksn,{})]})})]}),t.jsxRuntimeExports.jsx(xAe,{isReadonly:Re,children:rs.verifyBusinessDetailsDescription})]}),t.jsxRuntimeExports.jsxs(wsn,{children:[t.jsxRuntimeExports.jsx(pAe,{companyOfficerData:J,allNationalityCountries:n,allOfficers:Be??[],sectionId:jg,isRefreshingViewInBackground:r,connectedAccountProvider:ee,productType:"business_verification",updateFilesEntity:D,onEditFileName:L,onOfficerAddressClick:R,onDeleteFile:M,isDisabled:x,filesEndPoint:a,authParams:l,isPopupOpen:me,openPopup:pe,onGetOtp:T,onVerifyOtp:A,onResendOtp:I,companyTitles:u,isForTreasury:c==="zeni_treasury",isOverlay:f}),t.jsxRuntimeExports.jsx(jY,{companyDetails:K,businessVerificationProps:{companyVerificationStatus:le,isRefreshingViewInBackground:r},productType:"business_verification",showTreasuryFields:c==="zeni_treasury",hideNewOnboardingFields:Oe(),sectionId:yg,isDisabled:le?.code==="pending_review"||le?.code==="verified"?"readonly":x,fileProps:{authParams:l,filesEndPoint:a,onEditFileName:L,onDeleteFile:M,updateFilesEntity:D},onCompanyAddressClick:R,onRegisteredAddressClick:S,connectedAccountProvider:ee,allIndustries:d,allNationalityCountries:n})]}),c==="zeni_accounts"?t.jsxRuntimeExports.jsx(Esn,{windowSize:q,children:rs.threadText.replace("__amount__",Te)}):null]})})}),i==="Completed"&&(c==="zeni_treasury"?ue?.companyVerificationStatus?.code!=="pending_review"&&ue?.companyVerificationStatus?.code!=="verified":de?.businessVerificationStatus?.code!=="pending_review"&&de?.businessVerificationStatus?.code!=="verified")?t.jsxRuntimeExports.jsx(_t,{formId:pce(cce),primaryBtn:{label:C?uce.submit:rs.sendForVerificationButton,style:{width:"auto",minWidth:q==="small"?"auto":C?"83px":"181px"},isLoading:re==="verification"&&Z.fetchState==="In-Progress",isDisabled:x!=null},containerStyle:{width:q==="small"?rb.width.valuePx(q):"auto",justifyContent:q==="small"?"space-between":"center"},helperStyle:{width:q==="small"?rb.width.valuePx(q):"auto",paddingLeft:rb.termsPaddingLeftRight.valuePx(q),paddingRight:rb.termsPaddingLeftRight.valuePx(q),textAlign:q==="small"?"center":"initial"},showCancel:!0,cancelBtn:{reverseSpinnerColor:!1,label:C?uce.back:rs.saveDetailsButton,style:{width:q==="small"?"auto":C?"83px":"181px"},isLoading:re==="save"&&Z.fetchState==="In-Progress",onClick:()=>{if(C)k();else{const Me=J[ge],Ie=K?.primaryContactLocalData;re!=="save"&&ne("save");const Ne=Me?.email??"",Pe=he(),Qe=Ce();Pe&&Qe&&(y?.trackBusinessVerificationSave({email:Ne,birthday:Me?.birthday?.toString(),companyOwnership:Me?.ownershipInCompany,firstName:Me?.firstName,lastName:Me?.lastName,companyRole:Me?.titleAtCompany,phone:Me?.phone,formattedAddress:Me?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(Me?.addressStatus?.addressToCreate):void 0,documentTypeForVerification:Me?.documentTypeSelectedForVerification},{companyDescription:K?.companyDescription,legalName:K?.companyLegalName,phone:K?.phone,website:K?.website?.toString(),industry:K?.companyIndustry??"",formattedAddress:K?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(K?.addressStatus?.addressToCreate):void 0},{firstName:Ie?.firstName,lastName:Ie?.lastName,email:Ie?.email},c,h?"Settings":void 0),H?.(ge))}}},helperText:te,style:{padding:`12px ${o.sp3}`,zIndex:me?0:4}}):null]})},ysn=(e,n,i,r)=>{const{companyDetailsLocalData:a,companyOfficerLocalData:l,companyView:c}=e,d=O.getLocalizedStrings().companyPassport,u=c?.companyOfficers!=null&&c?.companyOfficers.length>0;return{[yg]:{companyDescription:a?.companyDescription??"",ein:a?.companyFiles.find(m=>m.documentType==="tax_ein"),companyId:a?.companyId??"",syncToken:a?.syncToken,companyLegalName:a?.companyLegalName??"",companyWebsite:a?.website?.toString()??"",companyAddress:a?.addressStatus?.addressToCreate,registeredAddress:a?.registeredAddressStatus?.addressToCreate,companyIndustry:{selectedOption:a?.companyIndustry,allOptions:n?.map(m=>m.code)},companyPhone:a?.phone??"",companyTaxId:a?.taxIdOrEIN??"",primaryContactName:{firstName:a?.primaryContactLocalData?.firstName??"",lastName:a?.primaryContactLocalData?.lastName??""},primaryContactEmail:a?.primaryContactLocalData?.email??"",primaryContactUserId:a?.primaryContactLocalData?.userId,primaryContactSyncToken:a?.primaryContactLocalData?.syncToken,fileIds:a?.companyFiles.map(m=>m.fileId)??[],certificateOfIncorporation:a?.companyFiles.find(m=>m.documentType==="certificate_of_incorporation"),incDate:a?.incDate?.toDate(),typeOfIncorporation:{selectedOption:a?.typeOfIncorporation,allOptions:d.companyIncInfo.allTypesOfIncorporation},stateOfIncorporation:{selectedOption:a?.stateOfIncorporation,allOptions:d.companyIncInfo.allStatesOfIncorporation},sourceOfFunds:{selectedOption:a?.sourceOfFunds??"",allOptions:Object.keys(rs.sourceOfFundOptions)},companySourceOfFunds:{selectedOption:a?.companySourceOfFunds??"",allOptions:Object.keys(rs.companySourceOfFundOptions??{})},companySourceOfFundsDescription:a?.companySourceOfFundsDescription??"",transactionVolume:{selectedOption:a?.transactionVolume,allOptions:[...Q.COMPANY_TRANSACTION_VOLUME_CODES]},transactionVolumeDescription:a?.transactionVolumeDescription??"",purposeOfAccount:{selectedOption:a?.purposeOfAccount,allOptions:[...Q.COMPANY_PURPOSE_OF_ACCOUNT_CODES]},purposeOfAccountDescription:a?.purposeOfAccountDescription??"",usNexus:a?.usNexus??"",usNexusTypes:{selectedOptions:a?.usNexusTypes??[],allOptions:[...Q.COMPANY_US_NEXUS_TYPE_CODES]},regulatedStatus:a?.regulatedStatus??"",regulatedStatusDescription:a?.regulatedStatusDescription??""},[jg]:Object.values(l).map((m,x)=>{const h=m,f=f5(h?.documentTypeSelectedForVerification);return{userId:h?.userId,officerType:h?.officerType??`Officer_${x+1}`,name:{firstName:h?.firstName,lastName:h?.lastName},email:h?.email,fileIds:h?.fileIds??[],dob:h?.birthday?.toDate(),nationalityCountryCode:cl(h?.nationalityCountryCode,r.map(y=>y.countryCode)),ssn:h?.ssn,role:{selectedOption:h?.titleAtCompany,allOptions:i?.map(y=>y.code)},phone:h?.phone??"",ownership:h?.ownershipInCompany,officerAddress:h?.addressStatus?.addressToCreate,selectDocument:{front:pd(!0,h?.userFiles??[],f),back:pd(!1,h?.userFiles??[],f),selectDocumentType:f},isSelectedForVerification:!u&&x===0?!0:h?.isSelectedForVerification??!1,userVerificationStatus:h?.userVerificationStatus,treasuryUserVerificationStatus:h?.treasuryUserVerificationStatus,syncToken:h?.syncToken,isPhoneVerified:h?.isPhoneVerified,otpChallenge:h?.otpChallenge}})}},pce=e=>`${e}_form`,jsn=s.div`
43572
43572
  display: flex;
43573
43573
  min-height: 100%;
43574
43574
  flex-direction: column;
@@ -43915,8 +43915,8 @@ to {
43915
43915
  border-radius: ${o.sp2};
43916
43916
  border-top: 1px solid ${e=>e.theme.colors.grey2};
43917
43917
  margin-top: ${o.sp2};
43918
- `,Fin=e=>j.createElement("svg",{viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M6.50004 13.4338C6.10033 12.7104 5.93449 11.881 6.02531 11.0596C6.11612 10.2382 6.45914 9.46503 7.00721 8.84647C7.55527 8.22791 8.28147 7.79429 9.08599 7.60523C9.8905 7.41616 10.7338 7.48093 11.5 7.79063L9.00004 10.5L9.35379 12.1463L11 12.5L13.7094 10C14.0191 10.7662 14.0839 11.6095 13.8948 12.4141C13.7057 13.2186 13.2721 13.9448 12.6536 14.4928C12.035 15.0409 11.2619 15.3839 10.4405 15.4747C9.61902 15.5655 8.78963 15.3997 8.06629 15L4.56254 19.0625C4.28075 19.3443 3.89855 19.5026 3.50004 19.5026C3.10152 19.5026 2.71933 19.3443 2.43754 19.0625C2.15575 18.7807 1.99744 18.3985 1.99744 18C1.99744 17.6015 2.15575 17.2193 2.43754 16.9375L6.50004 13.4338Z",stroke:"#4B5253",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M16 10.5C18.7614 10.5 21 8.26142 21 5.5C21 2.73858 18.7614 0.5 16 0.5C13.2386 0.5 11 2.73858 11 5.5C11 8.26142 13.2386 10.5 16 10.5Z",fill:"#C27419",stroke:"white"}),j.createElement("path",{d:"M16 5.95829V3.04163",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M16 7.95837C16.2761 7.95837 16.5 7.73452 16.5 7.45837C16.5 7.18223 16.2761 6.95837 16 6.95837C15.7239 6.95837 15.5 7.18223 15.5 7.45837C15.5 7.73452 15.7239 7.95837 16 7.95837Z",fill:"white"})),tl={containerPaddingLeft:new w(p[3],p[5],p[5]),containerPaddingRight:new w(p[3],p[5],p[5]),marginBottom:new w(p[3],p[3]),labelWidth:new w(120,160,160),formTitlePaddingLeftRight:new w(30,0),marginTop:new w(p[1],0),rightIconsGap:new w(p[4],p[3]),closeContainerMarginTop:new w(p[1],0),formTitleMarginTopBottom:new w(0,0),footerButtonWidth:new w(120,120,120,165,165),right:new w(p[3],p[0]),actionsContainerRight:new w(p[0],p[3]),otherActionsIconContainerMarginLeft:new w(p[5],p[4],p[4],p[5]),otherActionsContainerBottom:new w(58,44),iconContainerMarginTop:new w(2,p[1]),recurringSchedulePaddingLeft:new w(p[2],0),paddingRight:new w(p[2],p[3]),labelMarginRight:new w(p[0],p[3]),textPadding:new w(p[0],p[3]),additionalTextMarginTop:new w(-p[1],0),refundPopupWidth:new w(300,420,420),drawerSectionPaddingLeftRight:new w(p[4],p[5]),infoLabelPaddingRight:new w(p[3],p[3]),infoLabelMarginTop:new w(p[1],p[0])},{dateFormat:Nin,common:{noText:bW,strings:{empty:qm},currency:Hin,more:Win,edit:Vin},spendManagement:{billPay:{billDetails:ko,billsByTabs:wW,bulkActions:$ce,vendorCreation:b_,insufficientFunds:Qin}},collaboration:{threads:{placeholder:Rce,tooltip:vce,title:{comments:Uin}}}}=O.getLocalizedStrings(),Gin=Nin.visual.MMMDCommaYYYYformat,Sce=({billDetails:e,currentTenant:n,showApproveRejectBtns:i,isShowDeletedBillsEnabled:r,signedInUser:a,isAdmin:l,isRealTimeApprovalEnabled:c,isInternationalPaymentShaVsOurEnabled:d,hasZeniAssistAccess:u,analytics:m,showMarkAsPaidButtonToCreator:x,showMarkAsPaidButtonToApprover:h,isBillPayCommentingEnabled:f,isZeniUser:y,isDetectInsufficientFundsEnabled:C,isAccountingClassesEnabled:b,redirectToEditableBillScreen:E,redirectToBillsScreen:$,discardBillDetailsFromLocalStore:R,deleteBill:S,cancelAndDeleteBill:k,approveOrRejectBill:T,onAddNewRule:A,onAttachmentClick:I,saveBillDetails:B,discardOutsideZeniPaymentData:L,updateEditRealTimeApproverClicked:P,onSaveRealTimeApprovals:D,onRetryPaymentClick:M,onRefundPaymentClick:F,initialOpenThreadRequest:V,isAiCfoAccessEnabled:N,onAskAiCfoClick:H})=>{const W=X(),U=ht(),Y=t.useTheme(),q=k1(Y.colors),[Z,G]=g.useState(!1),[K,J]=g.useState(!1),[oe,ee]=g.useState(!1),[te,se]=g.useState(!1),[ie,re]=g.useState(!1),[ne,me]=g.useState(!1),pe=e.transactionDetails?.id,je=y?vs:Nu,{requestToOpenThread:ce,setRequestToOpenThread:de,setOpenThread:ue}=g.useContext(je);g.useEffect(()=>{V?.threadId!=null&&V?.companyId!=null&&V?.entityType!=null&&de(V)},[V,de]);const[le,ae]=g.useState(!1),ge={application:"dashboard",companyId:U.currentTenant?.companyId,tab:"bill",entityId:pe,isGlobalComment:!1},ye=f&&pe!=null,{threads:he,isLoading:Ce}=Y5(),ve=g.useMemo(()=>pe==null?[]:he.filter(Mt=>Mt.resolved===!1&&!Mt.id.includes($s)),[he,pe]).length,Ee=`dashboard_${U.currentTenant?.companyId}`,Se=g.useCallback((Mt,fo)=>{ue(fo),ae(!1)},[ue,ae]);g.useEffect(()=>{ce?.threadId!=null&&he.length>0&&!Ce&&(ue(ce.threadId),de(null))},[ce,he,Ce,ue,de]);const $e=g.useRef(!1),[Be,Ae]=g.useState(!1),_e=g.useRef(Mt=>{Mt&&!$e.current&&($e.current=!0,Ae(!0))});qs({componentName:"bill.details",enabled:Be});const[Te,Re]=g.useState({title:"",description:"",primaryButtonText:"",secondaryButtonText:""}),[ke,Oe]=g.useState("approved"),[Me,Ie]=g.useState(!1),[Ne,Pe]=g.useState(!1),[Ue,Je]=g.useState(!1),tt=()=>Ie(!1),Qe=()=>Ie(!0),dt=Ye(e.zeniAssist?.refundStatus.fetchState),ct=g.useCallback(()=>{$()},[$]);g.useEffect(()=>{(e.deleteStatus.fetchState==="Completed"||e.approvalUpdateStatus.fetchState==="Completed"||e.cancelAndDeleteStatus.fetchState==="Completed"||e.billSaveStatus==="Completed")&&(R(),$())},[e,$,R]),g.useEffect(()=>{dt==="In-Progress"&&(e.zeniAssist?.refundStatus.fetchState==="Completed"||e.zeniAssist?.refundStatus.fetchState==="Error")&&(ee(!1),ct())},[dt,e.zeniAssist?.refundStatus,ct]);const yt=e.transactionDetails?.billPayInfo.stage,He=e.transactionDetails?.billPayInfo.billStatus,jt=e.transactionDetails?.billPayInfo.billPaymentStatus,St=e.transactionDetails?.billPayInfo.billPaymentRefundStatus,We=yt?.code==="paid",nt=We?yt:He?.code=="approved"&&jt?.code?jt:He,ut=qin(nt,e.transactionDetails,q),pt=e.transactionDetails?.billPayInfo.isRefundInitiated===!0?St:jt?.code!=null&&(He?.code=="approved"||jt.code==="mark_as_paid")?jt:He,Bt=e.transactionDetails?.vendor?.name,Ht=e.isRecurring,$o=()=>{e.transactionDetails?.id!=null&&E(e.transactionDetails?.id??"")},Tt=()=>{Re({title:Ht?ko.recurringBill.deleteRecurringTitle:ko.deleteBillTitle,description:Ht?ko.recurringBill.deleteRecurringAlertText:ko.deleteAlertDescription,primaryButtonText:ko.delete,secondaryButtonText:ko.cancel}),G(!0)},Gt=()=>{Re({title:ko.cancelBillTitle,description:ko.cancelAlertDescription,primaryButtonText:ko.yes,secondaryButtonText:ko.no}),G(!0)},so=()=>{Re({title:Ht?ko.recurringBill.cancelAndDeleteRecurringTitle:ko.cancelAndDeleteBillTitle,description:Ht?ko.recurringBill.cancelAndDeleteRecurringAlertText:ko.cancelAndDeleteAlertDescription,primaryButtonText:ko.yes,secondaryButtonText:ko.no}),G(!0)},no=()=>{m.trackRefundClick(nt?.code??"",yt?.code??"",pt?.description??"",Ht?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??""),Re({title:ko.zeniAssist.refundTitle,description:ko.zeniAssist.refundDescription,primaryButtonText:ko.zeniAssist.proceed,secondaryButtonText:ko.cancel}),ee(!0)},Xe={onOkClick:()=>{G(!1),Te.primaryButtonText===ko.delete?S?.(e.isRecurring):Te.title===ko.cancelBillTitle?k?.(e.isRecurring):Te.title===ko.cancelAndDeleteBillTitle||Te.title===ko.recurringBill.cancelAndDeleteRecurringTitle?k?.(e.isRecurring,!0):Te.primaryButtonText===ko.zeniAssist.proceed&&(m.trackRefundConfirmClick(nt?.code??"",yt?.code??"",pt?.description??"",Ht?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??""),F())},onCancelClick:()=>{G(!1),ee(!1)}},ft={onOkClick:Mt=>{re(!1),T({billId:e.transactionDetails?.id??"",type:"rejected",description:Mt})},onCancelClick:()=>{re(!1)}},oo=()=>{const[Mt]=Rn("ZeniAssist");return Mt!=null?t.jsxRuntimeExports.jsx(t.Lottie,{"data-testid":_("bill-details-zeni-assist-icon",pe),onClick:()=>{se(!te),m.trackZeniAssistClick(nt?.code??"",yt?.code??"",pt?.description??"",Ht?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??"")},style:{width:`${o.sp5}`,height:`${o.sp5}`,marginBottom:`${o.sp2}`},animationData:Mt,loop:!0,play:!0,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}}):null},on={invoiceNumber:e.transactionDetails?.documentId??"",invoiceDate:e.transactionDetails?.date,billDueDate:e.transactionDetails?.dueDate,memo:e.transactionDetails?.memo,currencyCode:e.vendorCurrency??Hin.currencyCode},To=e.transactionDetails?.lines?.map((Mt,fo)=>{const ot=Mt;return{lineIndex:fo,lineId:ot.id,account:ot.account,class:ot.class,amount:ot.amount.amount,billable:ot.billable,customer:ot.customer,lineDescription:ot.lineDescription,recipientAmount:ot.recipientAmount?.amount}})??[],kn=e.transactionDetails?.recipientTotalAmount.amount??0,Dn=e.transactionDetails?.recipientTotalAmount,qt={paymentType:e.paymentMethodType,paymentDate:e.transactionDetails?.billPayInfo.paymentDate,internationalTransferFeeBearerPaymentMethod:e.transactionDetails?.billPayInfo.internationalTransferFeeBearerPaymentMethod,paymentToBankAccount:e.bankAccount,paymentToPI:e.paymentInstrument},dn=tl.labelWidth.value(W),Zs=Mt=>Mt==="billable"||Mt==="has_been_billed"?ko.yes:ko.no,Yn=qt.paymentToBankAccount?.bankAccountNumber?qt.paymentToBankAccount?.bankAccountNumber?.slice(qt.paymentToBankAccount?.bankAccountNumber?.length-4):qt.paymentType?.method?.includes("international")&&qt.paymentToBankAccount?.bankAccountIban?qt.paymentToBankAccount?.bankAccountIban?.slice(qt.paymentToBankAccount?.bankAccountIban.length-4):"",Hs=qt.paymentToBankAccount?.bankAccountName!=null&&qt.paymentToBankAccount?.bankAccountName!=""?qt.paymentToBankAccount?.bankAccountName:`${e.transactionDetails?.vendor?.name} - ${qt.paymentToBankAccount?.bankName} XXXX${Yn}`,yn=e.transactionDetails?.billPayInfo?.isCollectToAccountInfoFromVendorContact?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[`${ko.magicLink.collectFrom} ${e.transactionDetails?.billPayInfo?.toAccountVendorEmail}`,t.jsxRuntimeExports.jsx(Crn,{windowSize:W,children:t.jsxRuntimeExports.jsx(jrn,{})})]}):void 0,Go=e.transactionDetails?.date!=null&&e.transactionDetails.bookCloseDate!=null&&e.transactionDetails.date.isBefore(e.transactionDetails.bookCloseDate),ds=()=>{const Mt=qt?.paymentToBankAccount?.bankAccountType,fo=Mt!=null&&Mt!==""?m5(Mt.toLowerCase()):Mt??"";return`${b_.achDetails.bankRoutingNumber} ${qt?.paymentToBankAccount?.bankRoutingNumberAch}, ${qt?.paymentToBankAccount?.bankName}
43919
- ${b_.achDetails.bankAccountNumber} ${qt?.paymentToBankAccount?.bankAccountNumber}, ${b_.achDetails.accountTypeLabel} ${fo}`},In=e.transactionDetails?.billPayInfo!=null?Q.getActualPaymentDate(e.transactionDetails?.billPayInfo):void 0,ts=In!=null&&e.paymentMethodType?.maxPeriod?.value!=null?Q.zeniDate(Q.getNextNthWorkingDay(In?.toDate(),[0,6],e.paymentMethodType?.maxPeriod.value).toDateString()):void 0,pn=e.transactionDetails?.billPayInfo.expectedDepositDate??ts,_s=ud(qt?.paymentType?.method??"").replace("Same Day",""),us=(qt?.paymentToBankAccount!=null||qt?.paymentToPI)!=null?ko.addedByZeni:e.transactionDetails?.billPayInfo.isCollectToAccountInfoFromVendorContact?t.jsxRuntimeExports.jsx(GQ,{paymentTypeLabel:_s,onClick:Qe,style:{marginTop:`${W==="small"?o.sp2:o.sp0}`}}):void 0,js=()=>qt?.paymentToBankAccount==null&&qt?.paymentToPI==null&&qt?.paymentType?.method!=null&&e.transactionDetails?.billPayInfo.isCollectToAccountInfoFromVendorContact&&e.transactionDetails?.billPayInfo.paymentDate!=null?t.jsxRuntimeExports.jsx(Pbe,{paymentType:qt?.paymentType?.method,paymentDate:e.transactionDetails?.billPayInfo.paymentDate}):null,xn=e.transactionDetails?.lines?.some(Mt=>{const fo=Mt.account;return fo?.isDeleted===!0&&fo?.isBillEditableCoaAccountType===!1})??!1,As=!(nt?.code==="processing"||e.transactionDetails?.billPayInfo.isRefundInitiated===!0||e.transactionDetails?.billPayInfo.isRefundComplete===!0||(yt?.code==="scheduled"||yt?.code==="pending_approval")&&xn),nn=!((yt?.code==="scheduled"||yt?.code==="pending_approval")&&xn),os=e.zeniAssist?.isEligibleForRetryIBT===!0||e.zeniAssist?.isEligibleForRetryOBP===!0,qe=e.zeniAssist?.isEligibleForRefund===!0,xt=e?.transactionDetails?.billPayInfo.billPaymentMethodType.code==="wire"&&e?.transactionDetails?.billPayInfo.billPaymentMethodType.subCode==="international",Wt=u&&e.transactionDetails?.billPayInfo.billPaymentStatus.code!=null&&["failed","cancelled","returned"].includes(e.transactionDetails.billPayInfo.billPaymentStatus.code)&&(os||qe)&&xt===!1,Ze=os||qe,Mo=e.transactionDetails?.billPayInfo.isRefundInitiated===!0&&e.transactionDetails?.billPayInfo.isRefundComplete===!1,Lo=nt?.code,_n=!Mo&&(!Go||nt?.code==="processing"&&!Ht),ns=!Go,en=["small","medium-compact","medium-regular"].includes(W),On=Q.isBulkProcessing(e.transactionDetails?.bulkProcessingDetail?.type),$t=Q.isPaymentMethodOutsideZeni(e.paymentMethodType?.method),bo=!On&&(Lo!=="processing"&&nn||Lo==="processing"&&!Ht||Lo==="processing"&&ns||i&&$t&&h),mt=Mt=>{m.trackBillPayMarkAsPaidSubmit(Mt.paymentMode??"other",yt?.code??"",nt?.code??""),B(!0,Ue,Mt)},Qt=()=>{Pe(!0),m.trackBillPayMarkAsPaid(yt?.code??"",nt?.code??"")},wt=()=>{Je(!0),Qt()},Kt=()=>{L(),Pe(!1),Ue&&Je(!1)},ks=g.useMemo(()=>({companyId:U.currentTenant?.companyId??qm,companyName:U.currentTenant?.companyName??qm,entityType:"bill.details",entityId:pe??qm,isGlobalComment:!1,application:"dashboard",tab:"bill",url:window.location.href}),[U.currentTenant,pe]),_o=C&&e.transactionDetails?.totalAmountWithFeesInUSD!=null&&yt?.code!=="paid"&&nt?.code!=="failed"&&nt?.code!=="processing"&&nt?.code!=="cancelled"&&nt?.code!=="returned"&&nt?.code!=="rejected"?WT(e.transactionDetails?.totalAmountWithFeesInUSD,e.withdrawFrom,qt.paymentDate):void 0,Ct=()=>{Oe("approved"),ne===!0&&me(!1),_o!=null&&m.trackLowBalanceAccountApprove(yt?.code??"",e.transactionDetails?.billPayInfo.billPaymentStatus.code??"",e.isRecurring?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??"",Ml(U.loggedInUser),e.withdrawFrom?.accType==="depositAccount"?"ZA":"External Account"),T({billId:e.transactionDetails?.id??"",type:"approved"})},Ot=()=>{Oe("rejected"),_o!=null&&m.trackLowBalanceAccountReject(yt?.code??"",e.transactionDetails?.billPayInfo.billPaymentStatus.code??"",e.isRecurring?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??"",Ml(U.loggedInUser),e.withdrawFrom?.accType==="depositAccount"?"ZA":"External Account"),re(!0)},Yo=g.useRef(null);return t.jsxRuntimeExports.jsxs(lrn,{windowSize:W,ref:Yo,children:[t.jsxRuntimeExports.jsx(t.Drawer,{anchor:"right",open:Me,onClose:tt,transitionDuration:250,"data-testid":_("vendor-email-preview-drawer"),children:t.jsxRuntimeExports.jsx(YQ,{companyName:IQ(n.company?.companyInfo),vendor:e.transactionDetails?.vendor?.name,paymentDate:qt.paymentDate?.format(Gin)??"",paymentType:_s,amount:Fe("0,0.[00]",Dn),isInvoiceAttached:!!e.transactionDetails?.attachments?.length,onClose:tt})}),t.jsxRuntimeExports.jsxs(drn,{ref:_e.current,windowSize:W,children:[t.jsxRuntimeExports.jsx(wrn,{windowSize:W,children:W==="small"?t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("bill-detail-nav-bar-mobile"),showBackButton:!1,showMenuIcon:!1,hideSearchBtn:!0,title:t.jsxRuntimeExports.jsxs(Lce,{children:[Bt,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{width:o.sp3,height:o.sp3}):null]}),backgroundColor:Y.colors.grey4,rightSideComponent:t.jsxRuntimeExports.jsxs(Ice,{windowSize:W,children:[ye&&!le?t.jsxRuntimeExports.jsxs(VS,{isDisabled:Ce,"data-testid":_("bill-comment-button"),onClick:Ce?()=>null:Mt=>{Mt.preventDefault(),Mt.stopPropagation(),ae(!0),m.trackCommentActivity("bill","clicked",U.currentTenant?.companyName??"",U.controllersList.controllers.map(fo=>cn(fo)),void 0,void 0,"page icon")},children:[t.jsxRuntimeExports.jsx(Br,{count:Ce?void 0:ve,isLoading:Ce,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(QS,{})]}):null,t.jsxRuntimeExports.jsx(arn,{"data-testid":_("bill-detail-nav-bar-close-icon"),onClick:()=>$(),children:t.jsxRuntimeExports.jsx(rrn,{})}),t.jsxRuntimeExports.jsx(ms,{dataTestId:"bill-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:N,onAskAiCfoClick:H})]}),source:"BillDetailPage"}):t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("bill-detail-nav-bar"),showBackButton:!1,showMenuIcon:W==="medium-compact",title:t.jsxRuntimeExports.jsxs(Lce,{children:[Bt,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{width:o.sp3,height:o.sp3}):null]}),rightSideComponent:t.jsxRuntimeExports.jsxs(Ice,{windowSize:W,children:[ye&&!le?t.jsxRuntimeExports.jsxs(VS,{isDisabled:Ce,"data-testid":_("bill-comment-button"),onClick:Ce?()=>null:Mt=>{Mt.preventDefault(),Mt.stopPropagation(),ae(!0),m.trackCommentActivity("bill","clicked",U.currentTenant?.companyName??"",U.controllersList.controllers.map(fo=>cn(fo)),void 0,void 0,"page icon")},children:[t.jsxRuntimeExports.jsx(Br,{count:Ce?void 0:ve,isLoading:Ce,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(QS,{})]}):null,t.jsxRuntimeExports.jsx(ms,{dataTestId:"bill-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:N,onAskAiCfoClick:H})]}),enableTitleOnScroll:!0,scrollableContent:Yo,style:{boxSizing:"content-box"},source:"BillDetailPage"})}),t.jsxRuntimeExports.jsxs(urn,{windowSize:W,children:[ne?t.jsxRuntimeExports.jsx(Tve,{withdrawFrom:e.withdrawFrom,paymentDate:e?.transactionDetails?.billPayInfo.paymentDate,onOkClick:Ct,onCancelClick:()=>{me(!1),$o()},onClickAway:()=>{me(!1)}}):null,Ne?t.jsxRuntimeExports.jsx(Ive,{onCancel:Kt,onProceedForMarkAsPaid:mt,saveDetailsFetchState:e.billSaveStatus,paymentData:e.outsideZeniPaymentInfo}):null,Z||oe?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:Te.title}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:Te.description}),primaryButtonText:Te.primaryButtonText,proceedButtonVariant:oe?"primary":"destructive",secondaryButtonText:Te.secondaryButtonText,action:Xe,useLegacyStyles:!0,isEditPopup:!0,isLoading:e.zeniAssist?.refundStatus.fetchState==="In-Progress",children:oe?Zin(W,e):null}):null,ie?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:ko.rejectBillTitlePrefix+" "+(e.transactionDetails?.vendor?.name!=null?e.transactionDetails.vendor.name:"")}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:ko.rejectBillDescription}),primaryButtonText:ko.send,secondaryButtonText:ko.cancel,action:ft,useLegacyStyles:!0,isEditPopup:!0,isNotesIncluded:!0,notesPlaceholder:ko.rejectBillReasonPlaceholder}):null,W!=="small"||ut?t.jsxRuntimeExports.jsxs(mrn,{windowSize:W,children:[W!=="small"?t.jsxRuntimeExports.jsxs(xrn,{windowSize:W,children:[Bt,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{}):null]}):null,r&&ut!=null&&ut.code==="deleted"?t.jsxRuntimeExports.jsx(Tce,{color:ut.color,bgColor:ut.bgColor,borderColor:ut.borderColor,children:ut.value}):ut?.value===wW.tabsById.overdue?t.jsxRuntimeExports.jsx(Tce,{color:ut.color,bgColor:ut.bgColor,borderColor:ut.borderColor,children:ut.value}):null]}):null,pt!=null&&pt.code?W==="small"?t.jsxRuntimeExports.jsx(NT,{progressSectionObj:pt,createDate:e.transactionDetails?.createTime,paymentDate:pn,scheduleDate:In,approvedDate:e.latestApprovedDate,isFrozen:e.transactionDetails?.isDeleted}):t.jsxRuntimeExports.jsx(g5,{progressSectionObj:pt,createDate:e.transactionDetails?.createTime,paymentDate:pn,scheduleDate:In,approvedDate:e.latestApprovedDate,isFrozen:e.transactionDetails?.isDeleted}):null,Jin(On,e,_o),t.jsxRuntimeExports.jsx(Zbe,{sectionId:nC,currentVendorOption:{defaultOptions:[]},billId:pe,isBillPayCommentingEnabled:f,isBillPaid:We,disableVendorActions:!0,vendor:e.transactionDetails?.vendor,prevBills:e.previousBills,onAttachmentClick:I,isVendorRecommendationEnabled:!1,showVendorGptRecommendationText:!1}),t.jsxRuntimeExports.jsxs(w_,{children:[t.jsxRuntimeExports.jsx(E_,{children:ko.whatForTitle}),t.jsxRuntimeExports.jsx(Oin,{billId:pe,canComment:ye,companyId:U.currentTenant?.companyId??qm,companyName:U.currentTenant?.companyName??qm,labelWidth:dn,roomId:Ee,threadsFilter:ge,whatForSection:on})]}),t.jsxRuntimeExports.jsxs(w_,{children:[t.jsxRuntimeExports.jsx(prn,{windowSize:W,children:t.jsxRuntimeExports.jsx(E_,{children:ko.lineItemsTitle})}),t.jsxRuntimeExports.jsx(crn,{children:To.length>0?To.map((Mt,fo)=>{const ot=e?.transactionDetails?.lines?.find(Lt=>Lt.id===Mt.lineId)?.recipientAmount;return t.jsxRuntimeExports.jsx(win,{billId:pe,canComment:ye,companyId:U.currentTenant?.companyId??qm,companyName:U.currentTenant?.companyName??qm,index:fo,isAccountingClassesEnabled:b,labelWidth:dn,line:Mt,lineInfoSectionLength:To.length,noText:bW,recipientAmount:ot,roomId:Ee,threadsFilter:ge,windowSize:W,getBillableStatus:Zs},fo)}):null})]}),t.jsxRuntimeExports.jsxs(hrn,{windowSize:W,children:[t.jsxRuntimeExports.jsx(grn,{children:ko.total}),t.jsxRuntimeExports.jsx(frn,{children:Dn!=null?t.jsxRuntimeExports.jsx(ls,{amount:Dn,integerStyles:z.largeBold.cssObject,decimalStyles:z.largeBold.cssObject,style:{color:Y.colors.champion}}):bW})]}),t.jsxRuntimeExports.jsxs(w_,{children:[t.jsxRuntimeExports.jsx(E_,{children:ko.paymentDetailsTitle}),t.jsxRuntimeExports.jsx(Lin,{additionalInfoLabel:us,billDetails:e,billId:pe,billStage:yt,canComment:ye,collectFromInfoLabel:yn,companyId:U.currentTenant?.companyId??qm,companyName:U.currentTenant?.companyName??qm,isInternationalPaymentShaVsOurEnabled:d,isPaymentOutsideZeni:$t,labelWidth:dn,lowBalanceAdditionalInfo:_o,paymentDetailsSection:qt,roomId:Ee,sendToInfoLabel:Hs,threadsFilter:ge,windowSize:W,getSecondaryAdditionalInfo:js,getTooltipInfo:ds,onAttachmentClick:I})]}),e.transactionDetails&&e.transactionDetails.id&&t.jsxRuntimeExports.jsx(h5,{amount:kn,activities:e.billActivities,stage:yt?.code??"draft",onAddNewRule:A,entity:"bill_pay",billPayInfo:e.transactionDetails.billPayInfo,realTimeApproval:{allApprovers:e.filteredApprovers,filteredAttributes:e.filteredAttributes,isRealTimeApproverEditMode:e.realTimeApproval.isEditMode,realTimeApprovalSaveStatus:{fetchState:e.realTimeApproval.fetchState,error:e.realTimeApproval.error},approvalListFetchState:e.approverListFetchState.fetchState,allAccountingClass:e.allAccountingClasses,vendorOwnerId:e.vendorOwnerId??"",isAdmin:l,signedInUserId:a?.userId,showRealTimeApproval:c,entityApprovalId:e.billActivities[0]?.entityApprovalId??e.transactionDetails.entityApprovalId,updateEditMode:P,onSaveRealTimeApprovals:D},historicActivities:e.billHistory.activities}),t.jsxRuntimeExports.jsx(yrn,{})]}),e.transactionDetails?.vendor!=null&&!We&&!e.transactionDetails.isDeleted?t.jsxRuntimeExports.jsx(_t,{separatorStyle:{marginRight:o.sp4},showPrimaryButton:x||i,showCancel:!x&&i,cancelBtn:{label:en?ko.buttons.reject:ko.buttons.rejectBill,isLoading:ke==="rejected"&&e.approvalUpdateStatus.fetchState==="In-Progress",onClick:Ot,style:{width:tl.footerButtonWidth.value(W)},reverseSpinnerColor:!1},primaryBtn:{label:Kin(x,en),isLoading:ke==="approved"&&e.approvalUpdateStatus.fetchState==="In-Progress",onClick:x?Qt:()=>{_o!=null?me(!0):Ct()},isDisabled:e.billSaveStatus==="In-Progress"||e.approvalUpdateStatus.fetchState==="In-Progress"||e.realTimeApproval.isEditMode===!0,style:{width:x?"auto":tl.footerButtonWidth.value(W)}},rightSideComponent:t.jsxRuntimeExports.jsx(Xin,{children:t.jsxRuntimeExports.jsxs(irn,{windowSize:W,children:[!On&&K?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>{J(!1),se(!1)},children:t.jsxRuntimeExports.jsxs(kce,{windowSize:W,"data-testid":_("bill-actions-container"),children:[Lo!=="processing"&&nn?t.jsxRuntimeExports.jsx(G4,{onClick:Tt,"data-testid":_("delete-bill-action-item"),children:ko.buttons.deleteBill}):null,Lo==="processing"&&!Ht?t.jsxRuntimeExports.jsx(G4,{onClick:Gt,"data-testid":_("cancel-bill-action-item"),children:ko.buttons.cancel}):null,Lo==="processing"&&ns?t.jsxRuntimeExports.jsx(G4,{onClick:so,"data-testid":_("cancel-and-delete-bill-action-item"),children:ko.buttons.cancelAndDelete}):null,i&&$t&&h?t.jsxRuntimeExports.jsx(G4,{onClick:wt,"data-testid":_("mark-as-paid-action-item"),children:ko.paymentOutsideZeni.markAsPaid}):null]})}):null,te?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>{J(!1),se(!1)},children:t.jsxRuntimeExports.jsxs(kce,{windowSize:W,"data-testid":_("bill-actions-with-zeni-assist-container"),children:[os?t.jsxRuntimeExports.jsx(G4,{onClick:()=>{m.trackRetryClick(nt?.code??"",yt?.code??"",pt?.description??"",Ht?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??""),M()},"data-testid":_("retry-bill-action-item"),children:ko.buttons.retry}):null,qe?t.jsxRuntimeExports.jsx(G4,{onClick:no,"data-testid":_("refund-bill-action-item"),children:ko.buttons.refund}):null]})}):null,t.jsxRuntimeExports.jsxs(srn,{windowSize:W,children:[Wt===!0?t.jsxRuntimeExports.jsx(Le,{enterDelay:600,display:"flex",title:Ze?ko.zeniAssist.tooltip:ko.zeniAssist.connectToTeamTooltip,placement:"top",maxWidth:"267px",children:t.jsxRuntimeExports.jsx(Ace,{windowSize:W,showEditIcon:As,isIconClickable:Ze,"data-testid":_("other-actions-icon-container"),children:Ze?t.jsxRuntimeExports.jsx(oo,{}):t.jsxRuntimeExports.jsx(trn,{})})}):null,!On&&As===!0?t.jsxRuntimeExports.jsx(Le,{enterDelay:600,display:"flex",title:Vin,placement:"top",children:t.jsxRuntimeExports.jsx(nrn,{onClick:$o,"data-testid":_("edit-bill-icon-container"),children:t.jsxRuntimeExports.jsx(orn,{})})}):null,!On&&_n===!0&&bo?t.jsxRuntimeExports.jsx(Le,{enterDelay:600,style:{color:v.heroDark,padding:`2px ${o.sp2}`},display:"flex",title:Win,placement:"top",children:t.jsxRuntimeExports.jsx(Ace,{windowSize:W,showEditIcon:As,isIconClickable:!0,"data-testid":_("more-details-icon-container"),children:t.jsxRuntimeExports.jsx(ern,{onClick:()=>J(!K)})})}):null]})]})})}):null]}),ye?t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:le,allowComposer:!0,drawerTitle:Uin,threads:he,filter:ge,autoExpand:!0,autoFocus:!1,isLoading:Ce,textOverrides:{composerPlaceholder:Rce.addANewComment,replyComposerPlaceholder:Rce.replyAComment,threadResolve:vce.resolveComment,threadUnResolve:vce.unResolveComment},threadMetadata:ks,onThreadClick:Se,onCloseAllThreadsDrawer:()=>ae(!1),drawerSectionStyle:{width:W==="small"?"100%":"400px",boxSizing:W==="small"?"border-box":"content-box",padding:`${o.sp0} ${tl.drawerSectionPaddingLeftRight.valuePx(W)}`,backgroundColor:Y.colors.background},collapsibleThreadStyle:{width:W==="small"?"100%":"360px"}}):null]})},Yin=e=>{const n=ht(),i=e.billDetails.transactionDetails?.id,r=e.isBillPayCommentingEnabled&&i!=null,a=n.currentTenant?.companyId;if(!(r&&a!=null&&i!=null))return t.jsxRuntimeExports.jsx(Sce,{...e});const c=`dashboard_${a}`;return t.jsxRuntimeExports.jsx(q5,{roomId:c,filter:{application:"dashboard",companyId:a,entityId:i,tab:"bill",isGlobalComment:!1},children:t.jsxRuntimeExports.jsx(Sce,{...e})})},qin=(e,n,i)=>{const r=e?.code;if(e!=null&&r!=null)return n?.isDeleted===!0?{value:wW.tabsById.deleted,color:i.deleted.color,bgColor:i.deleted.bgColor,borderColor:i.deleted.borderColor,code:"deleted"}:r==="pending_approval"&&n?.dueDate?.isBefore(Q.dateNow(),"date")===!0?{value:wW.tabsById.overdue,color:i.overdue.color,bgColor:i.overdue.bgColor,borderColor:i.overdue.borderColor}:{value:e.name,color:i[r].color,bgColor:i[r].bgColor,borderColor:i[r].borderColor}},Zin=(e,n)=>{const i=n.transactionDetails?.recipientTotalAmount;return t.jsxRuntimeExports.jsxs(brn,{windowSize:e,children:[t.jsxRuntimeExports.jsxs(Bce,{windowSize:e,children:[t.jsxRuntimeExports.jsx(Pce,{children:ko.zeniAssist.accountNumber}),t.jsxRuntimeExports.jsx(Mce,{children:n.withdrawFrom!=null?iL(n.withdrawFrom,e):qm})]}),t.jsxRuntimeExports.jsxs(Bce,{windowSize:e,children:[t.jsxRuntimeExports.jsx(Pce,{children:ko.zeniAssist.amount}),t.jsxRuntimeExports.jsx(Mce,{children:i!=null?Fe("0,0[.]00",i):bW})]})]})},Kin=(e,n)=>e?ko.paymentOutsideZeni.markAsPaid:n?ko.buttons.approve:ko.buttons.approveBill,Jin=(e,n,i)=>{if(e)return t.jsxRuntimeExports.jsx(xd,{variant:"warning",style:{marginTop:o.sp5,marginBottom:o.sp3},title:$ce.duplicateWarning.title,description:$ce.duplicateWarning.description});if(i!=null){const r=`${n.withdrawFrom?.label??""} ${n.withdrawFrom?.maskedAccountNumber??""}`;return t.jsxRuntimeExports.jsx(xd,{variant:"low-balance",style:{marginTop:o.sp2,marginBottom:o.sp3},title:`${Qin.lowBalanceIn.replace("__account__",r)}`,description:i.replace("Low balance! ","")})}else return null},Xin=s.div`
43918
+ `,Fin=e=>j.createElement("svg",{viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M6.50004 13.4338C6.10033 12.7104 5.93449 11.881 6.02531 11.0596C6.11612 10.2382 6.45914 9.46503 7.00721 8.84647C7.55527 8.22791 8.28147 7.79429 9.08599 7.60523C9.8905 7.41616 10.7338 7.48093 11.5 7.79063L9.00004 10.5L9.35379 12.1463L11 12.5L13.7094 10C14.0191 10.7662 14.0839 11.6095 13.8948 12.4141C13.7057 13.2186 13.2721 13.9448 12.6536 14.4928C12.035 15.0409 11.2619 15.3839 10.4405 15.4747C9.61902 15.5655 8.78963 15.3997 8.06629 15L4.56254 19.0625C4.28075 19.3443 3.89855 19.5026 3.50004 19.5026C3.10152 19.5026 2.71933 19.3443 2.43754 19.0625C2.15575 18.7807 1.99744 18.3985 1.99744 18C1.99744 17.6015 2.15575 17.2193 2.43754 16.9375L6.50004 13.4338Z",stroke:"#4B5253",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M16 10.5C18.7614 10.5 21 8.26142 21 5.5C21 2.73858 18.7614 0.5 16 0.5C13.2386 0.5 11 2.73858 11 5.5C11 8.26142 13.2386 10.5 16 10.5Z",fill:"#C27419",stroke:"white"}),j.createElement("path",{d:"M16 5.95829V3.04163",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M16 7.95837C16.2761 7.95837 16.5 7.73452 16.5 7.45837C16.5 7.18223 16.2761 6.95837 16 6.95837C15.7239 6.95837 15.5 7.18223 15.5 7.45837C15.5 7.73452 15.7239 7.95837 16 7.95837Z",fill:"white"})),tl={containerPaddingLeft:new w(p[3],p[5],p[5]),containerPaddingRight:new w(p[3],p[5],p[5]),marginBottom:new w(p[3],p[3]),labelWidth:new w(120,160,160),formTitlePaddingLeftRight:new w(30,0),marginTop:new w(p[1],0),rightIconsGap:new w(p[4],p[3]),closeContainerMarginTop:new w(p[1],0),formTitleMarginTopBottom:new w(0,0),footerButtonWidth:new w(120,120,120,165,165),right:new w(p[3],p[0]),actionsContainerRight:new w(p[0],p[3]),otherActionsIconContainerMarginLeft:new w(p[5],p[4],p[4],p[5]),otherActionsContainerBottom:new w(58,44),iconContainerMarginTop:new w(2,p[1]),recurringSchedulePaddingLeft:new w(p[2],0),paddingRight:new w(p[2],p[3]),labelMarginRight:new w(p[0],p[3]),textPadding:new w(p[0],p[3]),additionalTextMarginTop:new w(-p[1],0),refundPopupWidth:new w(300,420,420),drawerSectionPaddingLeftRight:new w(p[4],p[5]),infoLabelPaddingRight:new w(p[3],p[3]),infoLabelMarginTop:new w(p[1],p[0])},{dateFormat:Nin,common:{noText:bW,strings:{empty:qm},currency:Hin,more:Win,edit:Vin},spendManagement:{billPay:{billDetails:ko,billsByTabs:wW,bulkActions:$ce,vendorCreation:b_,insufficientFunds:Qin}},collaboration:{threads:{placeholder:Rce,tooltip:vce,title:{comments:Uin}}}}=O.getLocalizedStrings(),Gin=Nin.visual.MMMDCommaYYYYformat,Sce=({billDetails:e,currentTenant:n,showApproveRejectBtns:i,isShowDeletedBillsEnabled:r,signedInUser:a,isAdmin:l,isRealTimeApprovalEnabled:c,isInternationalPaymentShaVsOurEnabled:d,hasZeniAssistAccess:u,analytics:m,showMarkAsPaidButtonToCreator:x,showMarkAsPaidButtonToApprover:h,isBillPayCommentingEnabled:f,isZeniUser:y,isDetectInsufficientFundsEnabled:C,isAccountingClassesEnabled:b,redirectToEditableBillScreen:E,redirectToBillsScreen:$,discardBillDetailsFromLocalStore:R,deleteBill:S,cancelAndDeleteBill:k,approveOrRejectBill:T,onAddNewRule:A,onAttachmentClick:I,saveBillDetails:B,discardOutsideZeniPaymentData:L,updateEditRealTimeApproverClicked:P,onSaveRealTimeApprovals:D,onRetryPaymentClick:M,onRefundPaymentClick:F,initialOpenThreadRequest:V,isAiCfoAccessEnabled:N,onAskAiCfoClick:H})=>{const W=X(),U=ht(),Y=t.useTheme(),q=k1(Y.colors),[Z,G]=g.useState(!1),[K,J]=g.useState(!1),[oe,ee]=g.useState(!1),[te,se]=g.useState(!1),[ie,re]=g.useState(!1),[ne,me]=g.useState(!1),pe=e.transactionDetails?.id,je=y?vs:Nu,{requestToOpenThread:ce,setRequestToOpenThread:de,setOpenThread:ue}=g.useContext(je);g.useEffect(()=>{V?.threadId!=null&&V?.companyId!=null&&V?.entityType!=null&&de(V)},[V,de]);const[le,ae]=g.useState(!1),ge={application:"dashboard",companyId:U.currentTenant?.companyId,tab:"bill",entityId:pe,isGlobalComment:!1},ye=f&&pe!=null,{threads:he,isLoading:Ce}=Y5(),ve=g.useMemo(()=>pe==null?[]:he.filter(Mt=>Mt.resolved===!1&&!Mt.id.includes($s)),[he,pe]).length,Ee=`dashboard_${U.currentTenant?.companyId}`,Se=g.useCallback((Mt,fo)=>{ue(fo),ae(!1)},[ue,ae]);g.useEffect(()=>{ce?.threadId!=null&&he.length>0&&!Ce&&(ue(ce.threadId),de(null))},[ce,he,Ce,ue,de]);const $e=g.useRef(!1),[Be,Ae]=g.useState(!1),_e=g.useRef(Mt=>{Mt&&!$e.current&&($e.current=!0,Ae(!0))});qs({componentName:"bill.details",enabled:Be});const[Te,Re]=g.useState({title:"",description:"",primaryButtonText:"",secondaryButtonText:""}),[ke,Oe]=g.useState("approved"),[Me,Ie]=g.useState(!1),[Ne,Pe]=g.useState(!1),[Qe,Je]=g.useState(!1),tt=()=>Ie(!1),Ue=()=>Ie(!0),dt=Ye(e.zeniAssist?.refundStatus.fetchState),ct=g.useCallback(()=>{$()},[$]);g.useEffect(()=>{(e.deleteStatus.fetchState==="Completed"||e.approvalUpdateStatus.fetchState==="Completed"||e.cancelAndDeleteStatus.fetchState==="Completed"||e.billSaveStatus==="Completed")&&(R(),$())},[e,$,R]),g.useEffect(()=>{dt==="In-Progress"&&(e.zeniAssist?.refundStatus.fetchState==="Completed"||e.zeniAssist?.refundStatus.fetchState==="Error")&&(ee(!1),ct())},[dt,e.zeniAssist?.refundStatus,ct]);const yt=e.transactionDetails?.billPayInfo.stage,He=e.transactionDetails?.billPayInfo.billStatus,jt=e.transactionDetails?.billPayInfo.billPaymentStatus,St=e.transactionDetails?.billPayInfo.billPaymentRefundStatus,We=yt?.code==="paid",nt=We?yt:He?.code=="approved"&&jt?.code?jt:He,ut=qin(nt,e.transactionDetails,q),pt=e.transactionDetails?.billPayInfo.isRefundInitiated===!0?St:jt?.code!=null&&(He?.code=="approved"||jt.code==="mark_as_paid")?jt:He,Bt=e.transactionDetails?.vendor?.name,Ht=e.isRecurring,$o=()=>{e.transactionDetails?.id!=null&&E(e.transactionDetails?.id??"")},Tt=()=>{Re({title:Ht?ko.recurringBill.deleteRecurringTitle:ko.deleteBillTitle,description:Ht?ko.recurringBill.deleteRecurringAlertText:ko.deleteAlertDescription,primaryButtonText:ko.delete,secondaryButtonText:ko.cancel}),G(!0)},Gt=()=>{Re({title:ko.cancelBillTitle,description:ko.cancelAlertDescription,primaryButtonText:ko.yes,secondaryButtonText:ko.no}),G(!0)},so=()=>{Re({title:Ht?ko.recurringBill.cancelAndDeleteRecurringTitle:ko.cancelAndDeleteBillTitle,description:Ht?ko.recurringBill.cancelAndDeleteRecurringAlertText:ko.cancelAndDeleteAlertDescription,primaryButtonText:ko.yes,secondaryButtonText:ko.no}),G(!0)},no=()=>{m.trackRefundClick(nt?.code??"",yt?.code??"",pt?.description??"",Ht?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??""),Re({title:ko.zeniAssist.refundTitle,description:ko.zeniAssist.refundDescription,primaryButtonText:ko.zeniAssist.proceed,secondaryButtonText:ko.cancel}),ee(!0)},Xe={onOkClick:()=>{G(!1),Te.primaryButtonText===ko.delete?S?.(e.isRecurring):Te.title===ko.cancelBillTitle?k?.(e.isRecurring):Te.title===ko.cancelAndDeleteBillTitle||Te.title===ko.recurringBill.cancelAndDeleteRecurringTitle?k?.(e.isRecurring,!0):Te.primaryButtonText===ko.zeniAssist.proceed&&(m.trackRefundConfirmClick(nt?.code??"",yt?.code??"",pt?.description??"",Ht?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??""),F())},onCancelClick:()=>{G(!1),ee(!1)}},ft={onOkClick:Mt=>{re(!1),T({billId:e.transactionDetails?.id??"",type:"rejected",description:Mt})},onCancelClick:()=>{re(!1)}},oo=()=>{const[Mt]=Rn("ZeniAssist");return Mt!=null?t.jsxRuntimeExports.jsx(t.Lottie,{"data-testid":_("bill-details-zeni-assist-icon",pe),onClick:()=>{se(!te),m.trackZeniAssistClick(nt?.code??"",yt?.code??"",pt?.description??"",Ht?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??"")},style:{width:`${o.sp5}`,height:`${o.sp5}`,marginBottom:`${o.sp2}`},animationData:Mt,loop:!0,play:!0,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}}):null},on={invoiceNumber:e.transactionDetails?.documentId??"",invoiceDate:e.transactionDetails?.date,billDueDate:e.transactionDetails?.dueDate,memo:e.transactionDetails?.memo,currencyCode:e.vendorCurrency??Hin.currencyCode},To=e.transactionDetails?.lines?.map((Mt,fo)=>{const ot=Mt;return{lineIndex:fo,lineId:ot.id,account:ot.account,class:ot.class,amount:ot.amount.amount,billable:ot.billable,customer:ot.customer,lineDescription:ot.lineDescription,recipientAmount:ot.recipientAmount?.amount}})??[],kn=e.transactionDetails?.recipientTotalAmount.amount??0,Dn=e.transactionDetails?.recipientTotalAmount,qt={paymentType:e.paymentMethodType,paymentDate:e.transactionDetails?.billPayInfo.paymentDate,internationalTransferFeeBearerPaymentMethod:e.transactionDetails?.billPayInfo.internationalTransferFeeBearerPaymentMethod,paymentToBankAccount:e.bankAccount,paymentToPI:e.paymentInstrument},dn=tl.labelWidth.value(W),Zs=Mt=>Mt==="billable"||Mt==="has_been_billed"?ko.yes:ko.no,Yn=qt.paymentToBankAccount?.bankAccountNumber?qt.paymentToBankAccount?.bankAccountNumber?.slice(qt.paymentToBankAccount?.bankAccountNumber?.length-4):qt.paymentType?.method?.includes("international")&&qt.paymentToBankAccount?.bankAccountIban?qt.paymentToBankAccount?.bankAccountIban?.slice(qt.paymentToBankAccount?.bankAccountIban.length-4):"",Hs=qt.paymentToBankAccount?.bankAccountName!=null&&qt.paymentToBankAccount?.bankAccountName!=""?qt.paymentToBankAccount?.bankAccountName:`${e.transactionDetails?.vendor?.name} - ${qt.paymentToBankAccount?.bankName} XXXX${Yn}`,yn=e.transactionDetails?.billPayInfo?.isCollectToAccountInfoFromVendorContact?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[`${ko.magicLink.collectFrom} ${e.transactionDetails?.billPayInfo?.toAccountVendorEmail}`,t.jsxRuntimeExports.jsx(Crn,{windowSize:W,children:t.jsxRuntimeExports.jsx(jrn,{})})]}):void 0,Go=e.transactionDetails?.date!=null&&e.transactionDetails.bookCloseDate!=null&&e.transactionDetails.date.isBefore(e.transactionDetails.bookCloseDate),ds=()=>{const Mt=qt?.paymentToBankAccount?.bankAccountType,fo=Mt!=null&&Mt!==""?m5(Mt.toLowerCase()):Mt??"";return`${b_.achDetails.bankRoutingNumber} ${qt?.paymentToBankAccount?.bankRoutingNumberAch}, ${qt?.paymentToBankAccount?.bankName}
43919
+ ${b_.achDetails.bankAccountNumber} ${qt?.paymentToBankAccount?.bankAccountNumber}, ${b_.achDetails.accountTypeLabel} ${fo}`},In=e.transactionDetails?.billPayInfo!=null?Q.getActualPaymentDate(e.transactionDetails?.billPayInfo):void 0,ts=In!=null&&e.paymentMethodType?.maxPeriod?.value!=null?Q.zeniDate(Q.getNextNthWorkingDay(In?.toDate(),[0,6],e.paymentMethodType?.maxPeriod.value).toDateString()):void 0,pn=e.transactionDetails?.billPayInfo.expectedDepositDate??ts,_s=ud(qt?.paymentType?.method??"").replace("Same Day",""),us=(qt?.paymentToBankAccount!=null||qt?.paymentToPI)!=null?ko.addedByZeni:e.transactionDetails?.billPayInfo.isCollectToAccountInfoFromVendorContact?t.jsxRuntimeExports.jsx(GQ,{paymentTypeLabel:_s,onClick:Ue,style:{marginTop:`${W==="small"?o.sp2:o.sp0}`}}):void 0,js=()=>qt?.paymentToBankAccount==null&&qt?.paymentToPI==null&&qt?.paymentType?.method!=null&&e.transactionDetails?.billPayInfo.isCollectToAccountInfoFromVendorContact&&e.transactionDetails?.billPayInfo.paymentDate!=null?t.jsxRuntimeExports.jsx(Pbe,{paymentType:qt?.paymentType?.method,paymentDate:e.transactionDetails?.billPayInfo.paymentDate}):null,xn=e.transactionDetails?.lines?.some(Mt=>{const fo=Mt.account;return fo?.isDeleted===!0&&fo?.isBillEditableCoaAccountType===!1})??!1,As=!(nt?.code==="processing"||e.transactionDetails?.billPayInfo.isRefundInitiated===!0||e.transactionDetails?.billPayInfo.isRefundComplete===!0||(yt?.code==="scheduled"||yt?.code==="pending_approval")&&xn),nn=!((yt?.code==="scheduled"||yt?.code==="pending_approval")&&xn),os=e.zeniAssist?.isEligibleForRetryIBT===!0||e.zeniAssist?.isEligibleForRetryOBP===!0,qe=e.zeniAssist?.isEligibleForRefund===!0,xt=e?.transactionDetails?.billPayInfo.billPaymentMethodType.code==="wire"&&e?.transactionDetails?.billPayInfo.billPaymentMethodType.subCode==="international",Wt=u&&e.transactionDetails?.billPayInfo.billPaymentStatus.code!=null&&["failed","cancelled","returned"].includes(e.transactionDetails.billPayInfo.billPaymentStatus.code)&&(os||qe)&&xt===!1,Ze=os||qe,Mo=e.transactionDetails?.billPayInfo.isRefundInitiated===!0&&e.transactionDetails?.billPayInfo.isRefundComplete===!1,Lo=nt?.code,_n=!Mo&&(!Go||nt?.code==="processing"&&!Ht),ns=!Go,en=["small","medium-compact","medium-regular"].includes(W),On=Q.isBulkProcessing(e.transactionDetails?.bulkProcessingDetail?.type),$t=Q.isPaymentMethodOutsideZeni(e.paymentMethodType?.method),bo=!On&&(Lo!=="processing"&&nn||Lo==="processing"&&!Ht||Lo==="processing"&&ns||i&&$t&&h),mt=Mt=>{m.trackBillPayMarkAsPaidSubmit(Mt.paymentMode??"other",yt?.code??"",nt?.code??""),B(!0,Qe,Mt)},Qt=()=>{Pe(!0),m.trackBillPayMarkAsPaid(yt?.code??"",nt?.code??"")},wt=()=>{Je(!0),Qt()},Kt=()=>{L(),Pe(!1),Qe&&Je(!1)},ks=g.useMemo(()=>({companyId:U.currentTenant?.companyId??qm,companyName:U.currentTenant?.companyName??qm,entityType:"bill.details",entityId:pe??qm,isGlobalComment:!1,application:"dashboard",tab:"bill",url:window.location.href}),[U.currentTenant,pe]),_o=C&&e.transactionDetails?.totalAmountWithFeesInUSD!=null&&yt?.code!=="paid"&&nt?.code!=="failed"&&nt?.code!=="processing"&&nt?.code!=="cancelled"&&nt?.code!=="returned"&&nt?.code!=="rejected"?WT(e.transactionDetails?.totalAmountWithFeesInUSD,e.withdrawFrom,qt.paymentDate):void 0,Ct=()=>{Oe("approved"),ne===!0&&me(!1),_o!=null&&m.trackLowBalanceAccountApprove(yt?.code??"",e.transactionDetails?.billPayInfo.billPaymentStatus.code??"",e.isRecurring?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??"",Ml(U.loggedInUser),e.withdrawFrom?.accType==="depositAccount"?"ZA":"External Account"),T({billId:e.transactionDetails?.id??"",type:"approved"})},Ot=()=>{Oe("rejected"),_o!=null&&m.trackLowBalanceAccountReject(yt?.code??"",e.transactionDetails?.billPayInfo.billPaymentStatus.code??"",e.isRecurring?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??"",Ml(U.loggedInUser),e.withdrawFrom?.accType==="depositAccount"?"ZA":"External Account"),re(!0)},Yo=g.useRef(null);return t.jsxRuntimeExports.jsxs(lrn,{windowSize:W,ref:Yo,children:[t.jsxRuntimeExports.jsx(t.Drawer,{anchor:"right",open:Me,onClose:tt,transitionDuration:250,"data-testid":_("vendor-email-preview-drawer"),children:t.jsxRuntimeExports.jsx(YQ,{companyName:IQ(n.company?.companyInfo),vendor:e.transactionDetails?.vendor?.name,paymentDate:qt.paymentDate?.format(Gin)??"",paymentType:_s,amount:Fe("0,0.[00]",Dn),isInvoiceAttached:!!e.transactionDetails?.attachments?.length,onClose:tt})}),t.jsxRuntimeExports.jsxs(drn,{ref:_e.current,windowSize:W,children:[t.jsxRuntimeExports.jsx(wrn,{windowSize:W,children:W==="small"?t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("bill-detail-nav-bar-mobile"),showBackButton:!1,showMenuIcon:!1,hideSearchBtn:!0,title:t.jsxRuntimeExports.jsxs(Lce,{children:[Bt,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{width:o.sp3,height:o.sp3}):null]}),backgroundColor:Y.colors.grey4,rightSideComponent:t.jsxRuntimeExports.jsxs(Ice,{windowSize:W,children:[ye&&!le?t.jsxRuntimeExports.jsxs(VS,{isDisabled:Ce,"data-testid":_("bill-comment-button"),onClick:Ce?()=>null:Mt=>{Mt.preventDefault(),Mt.stopPropagation(),ae(!0),m.trackCommentActivity("bill","clicked",U.currentTenant?.companyName??"",U.controllersList.controllers.map(fo=>cn(fo)),void 0,void 0,"page icon")},children:[t.jsxRuntimeExports.jsx(Br,{count:Ce?void 0:ve,isLoading:Ce,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(QS,{})]}):null,t.jsxRuntimeExports.jsx(arn,{"data-testid":_("bill-detail-nav-bar-close-icon"),onClick:()=>$(),children:t.jsxRuntimeExports.jsx(rrn,{})}),t.jsxRuntimeExports.jsx(ms,{dataTestId:"bill-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:N,onAskAiCfoClick:H})]}),source:"BillDetailPage"}):t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("bill-detail-nav-bar"),showBackButton:!1,showMenuIcon:W==="medium-compact",title:t.jsxRuntimeExports.jsxs(Lce,{children:[Bt,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{width:o.sp3,height:o.sp3}):null]}),rightSideComponent:t.jsxRuntimeExports.jsxs(Ice,{windowSize:W,children:[ye&&!le?t.jsxRuntimeExports.jsxs(VS,{isDisabled:Ce,"data-testid":_("bill-comment-button"),onClick:Ce?()=>null:Mt=>{Mt.preventDefault(),Mt.stopPropagation(),ae(!0),m.trackCommentActivity("bill","clicked",U.currentTenant?.companyName??"",U.controllersList.controllers.map(fo=>cn(fo)),void 0,void 0,"page icon")},children:[t.jsxRuntimeExports.jsx(Br,{count:Ce?void 0:ve,isLoading:Ce,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(QS,{})]}):null,t.jsxRuntimeExports.jsx(ms,{dataTestId:"bill-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:N,onAskAiCfoClick:H})]}),enableTitleOnScroll:!0,scrollableContent:Yo,style:{boxSizing:"content-box"},source:"BillDetailPage"})}),t.jsxRuntimeExports.jsxs(urn,{windowSize:W,children:[ne?t.jsxRuntimeExports.jsx(Tve,{withdrawFrom:e.withdrawFrom,paymentDate:e?.transactionDetails?.billPayInfo.paymentDate,onOkClick:Ct,onCancelClick:()=>{me(!1),$o()},onClickAway:()=>{me(!1)}}):null,Ne?t.jsxRuntimeExports.jsx(Ive,{onCancel:Kt,onProceedForMarkAsPaid:mt,saveDetailsFetchState:e.billSaveStatus,paymentData:e.outsideZeniPaymentInfo}):null,Z||oe?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:Te.title}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:Te.description}),primaryButtonText:Te.primaryButtonText,proceedButtonVariant:oe?"primary":"destructive",secondaryButtonText:Te.secondaryButtonText,action:Xe,useLegacyStyles:!0,isEditPopup:!0,isLoading:e.zeniAssist?.refundStatus.fetchState==="In-Progress",children:oe?Zin(W,e):null}):null,ie?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:ko.rejectBillTitlePrefix+" "+(e.transactionDetails?.vendor?.name!=null?e.transactionDetails.vendor.name:"")}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:ko.rejectBillDescription}),primaryButtonText:ko.send,secondaryButtonText:ko.cancel,action:ft,useLegacyStyles:!0,isEditPopup:!0,isNotesIncluded:!0,notesPlaceholder:ko.rejectBillReasonPlaceholder}):null,W!=="small"||ut?t.jsxRuntimeExports.jsxs(mrn,{windowSize:W,children:[W!=="small"?t.jsxRuntimeExports.jsxs(xrn,{windowSize:W,children:[Bt,e.isRecurring?t.jsxRuntimeExports.jsx(Tj,{}):null]}):null,r&&ut!=null&&ut.code==="deleted"?t.jsxRuntimeExports.jsx(Tce,{color:ut.color,bgColor:ut.bgColor,borderColor:ut.borderColor,children:ut.value}):ut?.value===wW.tabsById.overdue?t.jsxRuntimeExports.jsx(Tce,{color:ut.color,bgColor:ut.bgColor,borderColor:ut.borderColor,children:ut.value}):null]}):null,pt!=null&&pt.code?W==="small"?t.jsxRuntimeExports.jsx(NT,{progressSectionObj:pt,createDate:e.transactionDetails?.createTime,paymentDate:pn,scheduleDate:In,approvedDate:e.latestApprovedDate,isFrozen:e.transactionDetails?.isDeleted}):t.jsxRuntimeExports.jsx(g5,{progressSectionObj:pt,createDate:e.transactionDetails?.createTime,paymentDate:pn,scheduleDate:In,approvedDate:e.latestApprovedDate,isFrozen:e.transactionDetails?.isDeleted}):null,Jin(On,e,_o),t.jsxRuntimeExports.jsx(Zbe,{sectionId:nC,currentVendorOption:{defaultOptions:[]},billId:pe,isBillPayCommentingEnabled:f,isBillPaid:We,disableVendorActions:!0,vendor:e.transactionDetails?.vendor,prevBills:e.previousBills,onAttachmentClick:I,isVendorRecommendationEnabled:!1,showVendorGptRecommendationText:!1}),t.jsxRuntimeExports.jsxs(w_,{children:[t.jsxRuntimeExports.jsx(E_,{children:ko.whatForTitle}),t.jsxRuntimeExports.jsx(Oin,{billId:pe,canComment:ye,companyId:U.currentTenant?.companyId??qm,companyName:U.currentTenant?.companyName??qm,labelWidth:dn,roomId:Ee,threadsFilter:ge,whatForSection:on})]}),t.jsxRuntimeExports.jsxs(w_,{children:[t.jsxRuntimeExports.jsx(prn,{windowSize:W,children:t.jsxRuntimeExports.jsx(E_,{children:ko.lineItemsTitle})}),t.jsxRuntimeExports.jsx(crn,{children:To.length>0?To.map((Mt,fo)=>{const ot=e?.transactionDetails?.lines?.find(Lt=>Lt.id===Mt.lineId)?.recipientAmount;return t.jsxRuntimeExports.jsx(win,{billId:pe,canComment:ye,companyId:U.currentTenant?.companyId??qm,companyName:U.currentTenant?.companyName??qm,index:fo,isAccountingClassesEnabled:b,labelWidth:dn,line:Mt,lineInfoSectionLength:To.length,noText:bW,recipientAmount:ot,roomId:Ee,threadsFilter:ge,windowSize:W,getBillableStatus:Zs},fo)}):null})]}),t.jsxRuntimeExports.jsxs(hrn,{windowSize:W,children:[t.jsxRuntimeExports.jsx(grn,{children:ko.total}),t.jsxRuntimeExports.jsx(frn,{children:Dn!=null?t.jsxRuntimeExports.jsx(ls,{amount:Dn,integerStyles:z.largeBold.cssObject,decimalStyles:z.largeBold.cssObject,style:{color:Y.colors.champion}}):bW})]}),t.jsxRuntimeExports.jsxs(w_,{children:[t.jsxRuntimeExports.jsx(E_,{children:ko.paymentDetailsTitle}),t.jsxRuntimeExports.jsx(Lin,{additionalInfoLabel:us,billDetails:e,billId:pe,billStage:yt,canComment:ye,collectFromInfoLabel:yn,companyId:U.currentTenant?.companyId??qm,companyName:U.currentTenant?.companyName??qm,isInternationalPaymentShaVsOurEnabled:d,isPaymentOutsideZeni:$t,labelWidth:dn,lowBalanceAdditionalInfo:_o,paymentDetailsSection:qt,roomId:Ee,sendToInfoLabel:Hs,threadsFilter:ge,windowSize:W,getSecondaryAdditionalInfo:js,getTooltipInfo:ds,onAttachmentClick:I})]}),e.transactionDetails&&e.transactionDetails.id&&t.jsxRuntimeExports.jsx(h5,{amount:kn,activities:e.billActivities,stage:yt?.code??"draft",onAddNewRule:A,entity:"bill_pay",billPayInfo:e.transactionDetails.billPayInfo,realTimeApproval:{allApprovers:e.filteredApprovers,filteredAttributes:e.filteredAttributes,isRealTimeApproverEditMode:e.realTimeApproval.isEditMode,realTimeApprovalSaveStatus:{fetchState:e.realTimeApproval.fetchState,error:e.realTimeApproval.error},approvalListFetchState:e.approverListFetchState.fetchState,allAccountingClass:e.allAccountingClasses,vendorOwnerId:e.vendorOwnerId??"",isAdmin:l,signedInUserId:a?.userId,showRealTimeApproval:c,entityApprovalId:e.billActivities[0]?.entityApprovalId??e.transactionDetails.entityApprovalId,updateEditMode:P,onSaveRealTimeApprovals:D},historicActivities:e.billHistory.activities}),t.jsxRuntimeExports.jsx(yrn,{})]}),e.transactionDetails?.vendor!=null&&!We&&!e.transactionDetails.isDeleted?t.jsxRuntimeExports.jsx(_t,{separatorStyle:{marginRight:o.sp4},showPrimaryButton:x||i,showCancel:!x&&i,cancelBtn:{label:en?ko.buttons.reject:ko.buttons.rejectBill,isLoading:ke==="rejected"&&e.approvalUpdateStatus.fetchState==="In-Progress",onClick:Ot,style:{width:tl.footerButtonWidth.value(W)},reverseSpinnerColor:!1},primaryBtn:{label:Kin(x,en),isLoading:ke==="approved"&&e.approvalUpdateStatus.fetchState==="In-Progress",onClick:x?Qt:()=>{_o!=null?me(!0):Ct()},isDisabled:e.billSaveStatus==="In-Progress"||e.approvalUpdateStatus.fetchState==="In-Progress"||e.realTimeApproval.isEditMode===!0,style:{width:x?"auto":tl.footerButtonWidth.value(W)}},rightSideComponent:t.jsxRuntimeExports.jsx(Xin,{children:t.jsxRuntimeExports.jsxs(irn,{windowSize:W,children:[!On&&K?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>{J(!1),se(!1)},children:t.jsxRuntimeExports.jsxs(kce,{windowSize:W,"data-testid":_("bill-actions-container"),children:[Lo!=="processing"&&nn?t.jsxRuntimeExports.jsx(G4,{onClick:Tt,"data-testid":_("delete-bill-action-item"),children:ko.buttons.deleteBill}):null,Lo==="processing"&&!Ht?t.jsxRuntimeExports.jsx(G4,{onClick:Gt,"data-testid":_("cancel-bill-action-item"),children:ko.buttons.cancel}):null,Lo==="processing"&&ns?t.jsxRuntimeExports.jsx(G4,{onClick:so,"data-testid":_("cancel-and-delete-bill-action-item"),children:ko.buttons.cancelAndDelete}):null,i&&$t&&h?t.jsxRuntimeExports.jsx(G4,{onClick:wt,"data-testid":_("mark-as-paid-action-item"),children:ko.paymentOutsideZeni.markAsPaid}):null]})}):null,te?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>{J(!1),se(!1)},children:t.jsxRuntimeExports.jsxs(kce,{windowSize:W,"data-testid":_("bill-actions-with-zeni-assist-container"),children:[os?t.jsxRuntimeExports.jsx(G4,{onClick:()=>{m.trackRetryClick(nt?.code??"",yt?.code??"",pt?.description??"",Ht?["Recurring"]:["One-Time"],e.transactionDetails?.documentId??""),M()},"data-testid":_("retry-bill-action-item"),children:ko.buttons.retry}):null,qe?t.jsxRuntimeExports.jsx(G4,{onClick:no,"data-testid":_("refund-bill-action-item"),children:ko.buttons.refund}):null]})}):null,t.jsxRuntimeExports.jsxs(srn,{windowSize:W,children:[Wt===!0?t.jsxRuntimeExports.jsx(Le,{enterDelay:600,display:"flex",title:Ze?ko.zeniAssist.tooltip:ko.zeniAssist.connectToTeamTooltip,placement:"top",maxWidth:"267px",children:t.jsxRuntimeExports.jsx(Ace,{windowSize:W,showEditIcon:As,isIconClickable:Ze,"data-testid":_("other-actions-icon-container"),children:Ze?t.jsxRuntimeExports.jsx(oo,{}):t.jsxRuntimeExports.jsx(trn,{})})}):null,!On&&As===!0?t.jsxRuntimeExports.jsx(Le,{enterDelay:600,display:"flex",title:Vin,placement:"top",children:t.jsxRuntimeExports.jsx(nrn,{onClick:$o,"data-testid":_("edit-bill-icon-container"),children:t.jsxRuntimeExports.jsx(orn,{})})}):null,!On&&_n===!0&&bo?t.jsxRuntimeExports.jsx(Le,{enterDelay:600,style:{color:v.heroDark,padding:`2px ${o.sp2}`},display:"flex",title:Win,placement:"top",children:t.jsxRuntimeExports.jsx(Ace,{windowSize:W,showEditIcon:As,isIconClickable:!0,"data-testid":_("more-details-icon-container"),children:t.jsxRuntimeExports.jsx(ern,{onClick:()=>J(!K)})})}):null]})]})})}):null]}),ye?t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:le,allowComposer:!0,drawerTitle:Uin,threads:he,filter:ge,autoExpand:!0,autoFocus:!1,isLoading:Ce,textOverrides:{composerPlaceholder:Rce.addANewComment,replyComposerPlaceholder:Rce.replyAComment,threadResolve:vce.resolveComment,threadUnResolve:vce.unResolveComment},threadMetadata:ks,onThreadClick:Se,onCloseAllThreadsDrawer:()=>ae(!1),drawerSectionStyle:{width:W==="small"?"100%":"400px",boxSizing:W==="small"?"border-box":"content-box",padding:`${o.sp0} ${tl.drawerSectionPaddingLeftRight.valuePx(W)}`,backgroundColor:Y.colors.background},collapsibleThreadStyle:{width:W==="small"?"100%":"360px"}}):null]})},Yin=e=>{const n=ht(),i=e.billDetails.transactionDetails?.id,r=e.isBillPayCommentingEnabled&&i!=null,a=n.currentTenant?.companyId;if(!(r&&a!=null&&i!=null))return t.jsxRuntimeExports.jsx(Sce,{...e});const c=`dashboard_${a}`;return t.jsxRuntimeExports.jsx(q5,{roomId:c,filter:{application:"dashboard",companyId:a,entityId:i,tab:"bill",isGlobalComment:!1},children:t.jsxRuntimeExports.jsx(Sce,{...e})})},qin=(e,n,i)=>{const r=e?.code;if(e!=null&&r!=null)return n?.isDeleted===!0?{value:wW.tabsById.deleted,color:i.deleted.color,bgColor:i.deleted.bgColor,borderColor:i.deleted.borderColor,code:"deleted"}:r==="pending_approval"&&n?.dueDate?.isBefore(Q.dateNow(),"date")===!0?{value:wW.tabsById.overdue,color:i.overdue.color,bgColor:i.overdue.bgColor,borderColor:i.overdue.borderColor}:{value:e.name,color:i[r].color,bgColor:i[r].bgColor,borderColor:i[r].borderColor}},Zin=(e,n)=>{const i=n.transactionDetails?.recipientTotalAmount;return t.jsxRuntimeExports.jsxs(brn,{windowSize:e,children:[t.jsxRuntimeExports.jsxs(Bce,{windowSize:e,children:[t.jsxRuntimeExports.jsx(Pce,{children:ko.zeniAssist.accountNumber}),t.jsxRuntimeExports.jsx(Mce,{children:n.withdrawFrom!=null?iL(n.withdrawFrom,e):qm})]}),t.jsxRuntimeExports.jsxs(Bce,{windowSize:e,children:[t.jsxRuntimeExports.jsx(Pce,{children:ko.zeniAssist.amount}),t.jsxRuntimeExports.jsx(Mce,{children:i!=null?Fe("0,0[.]00",i):bW})]})]})},Kin=(e,n)=>e?ko.paymentOutsideZeni.markAsPaid:n?ko.buttons.approve:ko.buttons.approveBill,Jin=(e,n,i)=>{if(e)return t.jsxRuntimeExports.jsx(xd,{variant:"warning",style:{marginTop:o.sp5,marginBottom:o.sp3},title:$ce.duplicateWarning.title,description:$ce.duplicateWarning.description});if(i!=null){const r=`${n.withdrawFrom?.label??""} ${n.withdrawFrom?.maskedAccountNumber??""}`;return t.jsxRuntimeExports.jsx(xd,{variant:"low-balance",style:{marginTop:o.sp2,marginBottom:o.sp3},title:`${Qin.lowBalanceIn.replace("__account__",r)}`,description:i.replace("Low balance! ","")})}else return null},Xin=s.div`
43920
43920
  display: flex;
43921
43921
  justify-content: flex-end;
43922
43922
  `,ern=s(B1)`
@@ -45666,7 +45666,7 @@ to {
45666
45666
  height: ${o.sp4};
45667
45667
  min-width: ${o.sp4};
45668
45668
  color: ${v.success};
45669
- `,na={rightMargin:new w(p[3],p[5]),leftMargin:new w(p[3],p[5]),closeMarginTop:new w(0,19),closeMarginRight:new w(p[3],p[5]),rightSectionWidth:new w(100,58),leftSectionWidth:new w(100,42),footerButtonWidth:new w(120,129),right:new w(p[3],p[0]),actionsContainerRight:new w(p[0],p[3]),otherActionsContainerBottom:new w(58,44),duplicateBannerWrapperMarginTop:new w(p[5],p[3]),duplicateBannerWrapperMarginRight:new w(p[3],p[5]),duplicateBannerWrapperMarginBottom:new w(p[5],p[3]),duplicateBannerWrapperMarginLeft:new w(p[3],p[5]),navBarWidth:new w(100,58)},{spendManagement:{reimbursement:{reimbursementDetail:xo,bulkActions:jde}},common:{currency:{currencyCode:ox,currencySymbol:t$},texts:{comments:fdn},strings:{empty:ydn}},collaboration:{threads:{placeholder:{addANewComment:jdn,replyAComment:Cdn},tooltip:{resolveComment:bdn,unResolveComment:wdn}}},dateFormat:Cde}=O.getLocalizedStrings(),bde="editReimbursementDetailPage",wde=e=>`${e}_form`,Edn=(e,n,i,r,a,l,c,d,u)=>{const m=e.outOfPocket,x=e.mileage,h=m.merchant,f=m.recommendations;return{lineIndex:l,lineId:e?.lineId??String(l+1),reimbursementType:e?.type??xo.outOfPocketKey,file:e?.file,homeCurrencyConversions:{amount:e?.homeCurrencyConversions?.amount??0,currencyCode:e?.homeCurrencyConversions?.currencyCode??c.currencyCode,currencySymbol:e?.homeCurrencyConversions?.currencySymbol??c.currencySymbol},outOfPocket:{recommendedAccount:m.recommendedAccount,isCategoryUpdateSelected:m.isCategoryUpdateSelected??!1,isCategoryFirstTimeAutofilled:m.isCategoryFirstTimeAutofilled??!1,retainedAccount:m.retainedAccount,isRetainedCategorySelected:m.isRetainedCategorySelected??!1,recommendations:f??[],transactionDate:m?.transactionDate?.toDate()??void 0,class:{allOptions:d1(Lr(i,[])),selectedOption:m?.lineDetail?.class?.classId??u},account:{allOptions:d1($n(n,f)),selectedOption:m.lineDetail?.account?.qboId??m.lineDetail?.account?.accountId},customer:{defaultOptions:oC(m?.lineDetail?.customer),selectedOption:m?.lineDetail?.customer?.id},amount:{amount:m?.amount??0,currencyCode:m?.currencyCode??c.currencyCode,currencySymbol:m?.currencySymbol??c.currencySymbol,currency:{allOptions:d.map(y=>({label:`${y.currencyCode} - ${y.currency}`,value:y.currencyCode,countryCode:VT(y.countryCode)})),selectedOption:m?.currencyCode??c.currencyCode??ox}},memo:m?.description??void 0,merchant:{allOptions:r.map(y=>y.id).filter(y=>!!y),selectedOption:h?.id?h?.id:h?.name?h?.name:e?.lineId!=null?a[e?.lineId]:void 0}},mileage:{transactionDate:x?.transactionDate?.toDate(),class:{allOptions:d1(Lr(i,[])),selectedOption:x?.lineDetail?.class?.classId},customer:{defaultOptions:oC(x?.lineDetail?.customer),selectedOption:x?.lineDetail?.customer?.id},distanceInMiles:x?.distanceMileage?.value,amount:{amount:x?.amount??0,currencyCode:x?.currencyCode??c.currencyCode,currencySymbol:x?.currencySymbol??c.currencySymbol},memo:x?.description}}},L_=(e,n,i)=>{const r=[];return Object.values(e.lineDetailSection).forEach((a,l)=>{a?.lineId!=null&&r.push(Edn(a,e.accountsHierarchyList,e.classHierarchyList,e.merchantList.merchants,e.tentativeMerchantNameByLineId,l,n,e.allCurrencies,e.loggedInUserDepartmentId))}),r.length===0&&r.push(DAe(0,"1",e.accountsHierarchyList,e.classHierarchyList,e.merchantList.merchants,n,e.allCurrencies,e.loggedInUserDepartmentId)),{[qA]:{reportTitle:e.whatForSection.reportTitle},[wY]:r,[x9]:{selectedOption:e.paymentTo,allOptions:i.map(a=>a.bankAccountId)}}},B_=(e,n)=>{const i=r=>r.lineId==null||n[r.lineId]?.fetchState==="In-Progress"?0:(n[r.lineId]?.fetchState==="Completed",r.type===xo.mileageKey?r?.mileage?.amount??0:r?.outOfPocket?.currencyCode!==ox&&r.homeCurrencyConversions?.amount!==r?.outOfPocket?.amount?r.homeCurrencyConversions?.amount??0:r?.outOfPocket?.amount??0);return Object.values(e).reduce((r,a)=>r+i(a),0)},P_=(e,n,i,r,a,l,c,d,u)=>{const m={};return e.lineInfo.forEach(x=>{const h=d.find(R=>R.classId===x.mileage.class.selectedOption),f=(()=>{const R=x.mileage.customer?.selectedOption;if(R==null)return;const S=u?.customer.find(T=>T.id===R);if(S!=null)return S;const k=x.mileage.customer?.defaultOptions?.find(T=>T.value===R);if(k!=null)return{id:k.value,name:k.label}})(),y=c.find(R=>R.qboId===x.outOfPocket.account.selectedOption||R.accountId===x.outOfPocket.account.selectedOption),C=d.find(R=>R.classId===x.outOfPocket.class.selectedOption),b=(()=>{const R=x.outOfPocket.customer?.selectedOption;if(R==null)return;const S=u?.customer.find(T=>T.id===R);if(S!=null)return S;const k=x.outOfPocket.customer?.defaultOptions?.find(T=>T.value===R);if(k!=null)return{id:k.value,name:k.label}})(),E=n.find(R=>R.id===x.outOfPocket.merchant.selectedOption),$=l.find(R=>R.currencyCode===x.outOfPocket.amount?.currency.selectedOption)?.currencySymbol;m[x.lineId]={fileId:x.file?.fileId,lineId:x.lineId,type:x.reimbursementType,homeCurrencyConversions:x.homeCurrencyConversions??{amount:0,currencyCode:"USD",currencySymbol:"$"},mileage:{description:x.mileage.memo??"",lineDetail:{class:h,customer:f},transactionDate:x.mileage.transactionDate!=null?Q.zeniDate(x.mileage.transactionDate.toDateString()):void 0,amount:x.mileage.amount?.amount??0,currencyCode:x.mileage.amount?.currencyCode??$,currencySymbol:x.mileage.amount?.currencySymbol??$,distanceMileage:{unit:"miles",value:x.mileage.distanceInMiles??0}},outOfPocket:{description:x.outOfPocket.memo??"",lineDetail:{class:C,account:y,customer:b},transactionDate:x.outOfPocket.transactionDate!=null?Q.zeniDate(x.outOfPocket.transactionDate.toDateString()):void 0,amount:x.outOfPocket.amount?.amount??0,currencyCode:x.outOfPocket.amount?.currency.selectedOption??$,currencySymbol:$,merchant:x.outOfPocket.merchant.selectedOption!=null?{id:E?.id??"",name:E?.name??x.outOfPocket.merchant.selectedOption}:void 0,recommendations:x.outOfPocket.recommendations,recommendedAccount:x.outOfPocket.recommendedAccount,isCategoryUpdateSelected:x.outOfPocket.isCategoryUpdateSelected,isCategoryFirstTimeAutofilled:x.outOfPocket.isCategoryFirstTimeAutofilled,isRetainedCategorySelected:x.outOfPocket.isRetainedCategorySelected,retainedAccount:x.outOfPocket.retainedAccount}}}),{whatForSection:{reportTitle:e.whatFor.reportTitle},updatesByLineId:m,totalAmount:{amount:r,...i},currencyConversionStateByLineId:a,paymentTo:e.paymentTo.selectedOption}},$dn=({remiDetails:e,authParams:n,defaultCurrency:i,customerSearchAutoCompleteData:r,customerSearchAutoCompleteActions:a,companyMileageConfigInfo:l,uploadInvoiceEndPoint:c,isAccountingClassesEnabled:d,isReimbursementCommentingEnabled:u,isUserAdmin:m,analytics:x,reimbursementId:h,plaidConnectionDetails:f,bankAccountCreationState:y,bankNameByRouting:C,bankAccounts:b,isSignedInUserReimbursementCreator:E,uncategorizedAccounts:$,bankAccountToCreate:R,fetchBankNameByRoutingStatus:S,onUserBankDetailsUpdated:k,onFetchBankName:T,onSaveBankAccount:A,fetchDuplicateReimbursement:I,clearDuplicateReimbursementDetail:B,clearRemiSaveStatus:L,removeDuplicateReimbursementForLine:P,onDuplicateLineClick:D,onExistingMerchantChange:M,onNewMerchantChange:F,onReceiptsUpload:V,saveRemiDetails:N,submitRemiDetails:H,discardReimbursementDetailsFromLocalStore:W,onReimbursementDetailsChanged:U,updateReimbursementType:Y,onHomeCurrencyConversionUpdate:q,redirectToReimbursementListScreen:Z,redirectToReimbursementDetailScreen:G,deleteReimbursement:K,removeFileFromLine:J,onAmountChanged:oe,updateInvoiceUploadFetchState:ee,clearTentativeNameForLine:te,onAddNewRule:se,onFetchLinkTokenClick:ie,onEstablishConnectionClick:re,deleteBankAccount:ne,onBackClickFromBankAccountPage:me,initialOpenThreadRequest:pe,disableInternalOverlay:je,isAiCfoAccessEnabled:ce,onAskAiCfoClick:de,onCurrentLineIdForUploadChange:ue,showSkipAutoFill:le,setShowSkipAutoFill:ae})=>{const ge=g.useRef(null),ye=g.useRef(null),he=g.useRef(null),Ce=g.useRef(null),we=Ye(e.uploadStatus),ve=t.useTheme(),Ee=ht(),[Se,$e]=g.useState(!1),[Be,Ae]=g.useState(!1),[_e,Te]=g.useState("save"),[Re,ke]=g.useState(B_(e.lineDetailSection,e.currencyConversionStatus)),[Oe,Me]=g.useState(!1),[Ie,Ne]=g.useState(null),[Pe,Ue]=g.useState(!1),Je=`dashboard_${Ee.currentTenant?.companyId}`,tt=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:g.useMemo(()=>L_(e,i,b),[e,i,b]),values:g.useMemo(()=>L_(e,i,b),[e,i,b]),resetOptions:{keepErrors:!0},shouldFocusError:!0}),{isDirty:Qe,dirtyFields:dt}=tt.formState,ct=async(mt,Qt)=>{const{lineInfo:wt}=Qt,Kt=Number(mt.split(".")[1]);if(mt.includes("reportTitle")||mt.includes("memo"))return;if(mt.includes("reimbursementType")){const _o=wt[Kt].mileage,Ct=wt[Kt].outOfPocket;wt[Kt]={...wt[Kt],outOfPocket:{transactionDate:Ct.transactionDate??void 0,class:{allOptions:Ct.class.allOptions??d1(Lr(e.classHierarchyList,[])),selectedOption:Ct.class.selectedOption??void 0},account:{allOptions:Ct.account.allOptions??d1($n(e.accountsHierarchyList,[])),selectedOption:Ct.account.selectedOption??void 0},amount:Ct.amount??{amount:0,currencyCode:i.currencyCode,currencySymbol:i.currencySymbol,currency:{allOptions:e.allCurrencies.map(Ot=>({label:`${Ot.currencyCode} - ${Ot.currency}`,value:Ot.currencyCode,countryCode:VT(Ot.countryCode)})),selectedOption:i.currencyCode??ox}},memo:Ct.memo??void 0,merchant:Ct.merchant??void 0,recommendations:Ct.recommendations??[],recommendedAccount:Ct.recommendedAccount??void 0,isCategoryUpdateSelected:Ct.isCategoryUpdateSelected??!1,isCategoryFirstTimeAutofilled:Ct.isCategoryFirstTimeAutofilled??!1,retainedAccount:Ct.retainedAccount??void 0,isRetainedCategorySelected:Ct.isRetainedCategorySelected??!1},mileage:{transactionDate:_o.transactionDate??void 0,class:{allOptions:_o.class.allOptions??d1(Lr(e.classHierarchyList,[])),selectedOption:_o.class.selectedOption??e.loggedInUserDepartmentId},distanceInMiles:_o.distanceInMiles,amount:{amount:_o?.amount?.amount??0,currencyCode:_o?.amount?.currencyCode??ox,currencySymbol:_o?.amount?.currencySymbol??t$},memo:_o.memo??void 0}}}else if(mt.includes("mileage.distanceInMiles")){const{distanceInMiles:_o}=wt[Kt].mileage,Ct=l?.mileageUnitAmount??0;wt[Kt].mileage={...wt[Kt].mileage,amount:{amount:_o!=null?_o*Ct:0,currencyCode:i.currencyCode,currencySymbol:i.currencySymbol}}}else if(mt.includes("outOfPocket.amount")&&wt[Kt].lineId){const _o=wt[Kt].outOfPocket.amount,Ct=e.allCurrencies.find(Ot=>Ot.currencyCode===_o?.currency.selectedOption)?.currencySymbol;if(_o?.currencyCode!==_o?.currency.selectedOption){const Ot=_o?.currency?.allOptions||[];wt[Kt].outOfPocket.amount={currency:{allOptions:Ot,selectedOption:_o?.currency?.selectedOption},amount:wt[Kt].outOfPocket?.amount?.amount??0,currencyCode:_o?.currency.selectedOption??ox,currencySymbol:Ct??t$}}if(_o?.currency.selectedOption!==ox)Me(!0),Hs(wt[Kt].lineId,ox);else{const Ot={};wt.forEach(Mt=>{Ot[Mt.lineId]={lineId:Mt.lineId,homeCurrencyConversions:Mt.homeCurrencyConversions}}),wt[Kt].homeCurrencyConversions={amount:_o.amount??0,currencyCode:_o?.currency.selectedOption??ox,currencySymbol:Ct??t$};const Yo=B_(Ot,e.currencyConversionStatus);Re!==Yo&&ke(Yo)}}else if(mt.includes("outOfPocket.isRetainedCategorySelected"))wt[Kt].outOfPocket.isRetainedCategorySelected===!0&&(wt[Kt].outOfPocket.isCategoryUpdateSelected=!1,wt[Kt].outOfPocket.account.selectedOption=wt[Kt].outOfPocket.retainedAccount?.qboId);else if(mt.includes("outOfPocket.isCategoryUpdateSelected"))if(wt[Kt].outOfPocket.isCategoryUpdateSelected===!0)wt[Kt].outOfPocket.account.selectedOption=wt[Kt].outOfPocket.recommendedAccount?.qboId,wt[Kt].outOfPocket.isRetainedCategorySelected=!1;else{const _o=wt[Kt].lineId,Ct=e.editRemiInitialDetails.lineDetailSection[_o]?.lineDetail?.account?.qboId;wt[Kt].outOfPocket.account.selectedOption=Ct,wt[Kt].outOfPocket.isRetainedCategorySelected=!1}else mt.includes("outOfPocket.account")&&(wt[Kt].outOfPocket.recommendations.length>0&&(wt[Kt].outOfPocket.recommendedAccount=wt[Kt].outOfPocket.recommendations[0].account),wt[Kt].outOfPocket.recommendedAccount?.qboId!=null&&wt[Kt].outOfPocket.account.selectedOption===wt[Kt].outOfPocket.recommendedAccount?.qboId?wt[Kt].outOfPocket.isCategoryUpdateSelected=!0:wt[Kt].outOfPocket.isCategoryUpdateSelected=!1,wt[Kt].outOfPocket.retainedAccount?.qboId!=null&&wt[Kt].outOfPocket.account.selectedOption===wt[Kt].outOfPocket.retainedAccount?.qboId?wt[Kt].outOfPocket.isRetainedCategorySelected=!0:wt[Kt].outOfPocket.isRetainedCategorySelected=!1,wt[Kt].outOfPocket.isCategoryFirstTimeAutofilled=!1);const ks=P_({...Qt,lineInfo:wt},e.merchantList.merchants,i,Re,e.currencyConversionStatus,e.allCurrencies,e.accountList.accounts,e.classList.classes,r?.entityAutoCompleteView);if(U?.(ks),mt.includes("outOfPocket.merchant")){const _o=wt[Kt].lineId,Ct=wt[Kt].outOfPocket.merchant.selectedOption??"";wt[Kt].outOfPocket.merchant.allOptions.find(Yo=>Yo===Ct)!=null?M(Ct,_o):F(Ct,_o)}},yt=g.useMemo(()=>t.debounce((mt,Qt)=>ct(mt,Qt),300),[e.accountList.fetchState,e.classList.fetchState,e.merchantList.fetchState]);g.useEffect(()=>{const mt=tt.watch((Qt,{name:wt})=>{wt!=null&&Qt!=null&&yt(wt,Qt)});return()=>{mt.unsubscribe()}},[yt,tt]),g.useEffect(()=>{const mt=Q.reduceAnyFetchState(Object.values(e.currencyConversionStatus)),Qt=mt.fetchState==="In-Progress"||mt.fetchState==="Error";Me(Qt)},[e.currencyConversionStatus]),g.useEffect(()=>{for(const Qt in e.currencyConversionStatus){const wt=e.lineDetailSection[Qt],Kt=e.lineDetailSection[Qt];e.currencyConversionStatus[Qt].fetchState==="Completed"&&Kt!=null&&wt.type!==xo.mileageKey&&!t.isEqual(wt?.homeCurrencyConversions,Kt.homeCurrencyConversions)&&q({amount:wt?.homeCurrencyConversions?.amount??0,currencyCode:wt?.homeCurrencyConversions?.currencyCode??ox,currencySymbol:wt?.homeCurrencyConversions?.currencySymbol??t$},Qt,h)}const mt=B_(e.lineDetailSection,e.currencyConversionStatus);Re!==mt&&ke(mt)},[e.currencyConversionStatus,e.lineDetailSection]),g.useEffect(()=>{(e.saveStatus?.fetchState==="Completed"||e.deleteStatus.fetchState==="Completed")&&(W(h),Z?.())},[e.saveStatus?.fetchState,e.deleteStatus.fetchState,h,W,Z]);const He=X(),[jt,St]=g.useState(h==null),We=le??jt,nt=ae??St,[ut,pt]=g.useState(1);g.useEffect(()=>{ue?.(ut)},[ut,ue]);const[Bt,Ht]=g.useState(!1),[$o,Tt]=g.useState(""),Gt=g.useCallback(()=>{me(),Ht(!1)},[me]),so=g.useCallback(()=>{Bt?Ce.current?.requestBack():Z?.()},[Bt,Z]),[no,Xe]=g.useState(null),[ft,oo]=g.useState(!1),[on,To]=g.useState(!1),[kn,Dn]=g.useState([]),[qt,dn]=g.useState({title:"",description:"",primaryButtonText:"",secondaryButtonText:""}),Zs=g.useRef(),Yn=(mt,Qt)=>{a?.onAutoCompleteInputChange?.(mt,"customer"),Zs.current=Qt},Hs=g.useRef(t.debounce((mt,Qt)=>oe(mt,Qt),500,{trailing:!0})).current;g.useEffect(()=>{r?.entityAutoCompleteView.fetchState==="Completed"&&(Zs.current?.(HQ(r.entityAutoCompleteView)),Zs.current=void 0)},[r]),g.useEffect(()=>{we==="In-Progress"&&(e.uploadStatus==="Completed"?(tt.reset(L_(e,i,b),{keepDefaultValues:!0}),$e(!1),nt(!1)):e.uploadStatus==="Error"&&$e(!1))},[we,e.uploadStatus,tt,e,Se,$e,nt,We,i,b,x]),g.useEffect(()=>{e.uploadStatus==="In-Progress"&&We===!1&&$e(!0)},[e.uploadStatus,$e,We]);const yn=e.remiStage==="draft"?xo.newReimbursementTitle:xo.editReimbursementTitle,Go={onOkClick:()=>{if(oo(!1),qt.primaryButtonText===xo.buttons.discard)W(h),e.remiStage==="draft"?Z?.():G?.();else if(qt.primaryButtonText===xo.buttons.delete)qt.title===xo.deleteBankAccountTitle?ne?.($o):K?.();else if(qt.primaryButtonText===xo.buttons.yes&&no!=null){const mt=kn.filter(Qt=>Qt!==ut.toString());Dn(mt),V(no,ut,!0)}},onCancelClick:()=>{if(oo(!1),qt.secondaryButtonText===xo.buttons.no){const mt=kn.filter(Qt=>Qt!==ut.toString());Dn(mt),V(no,ut,!1)}}},ds=()=>{Qe||kc(dt)?(dn({title:xo.discardTitle,description:xo.discardDescription,primaryButtonText:xo.buttons.discard,secondaryButtonText:xo.buttons.cancel}),oo(!0)):(W(h),Z?.())},In=()=>{dn({title:e.remiStage==="draft"?xo.deleteDraftTitle:xo.deleteReportTitle,description:xo.deleteAlertDescription,primaryButtonText:xo.buttons.delete,secondaryButtonText:xo.buttons.cancel}),oo(!0)},ts=mt=>{Tt(mt),dn({title:xo.deleteBankAccountTitle,description:xo.deleteBankAccountDescription,primaryButtonText:xo.buttons.delete,secondaryButtonText:xo.buttons.cancel}),oo(!0)},pn=()=>{dn({title:xo.overwriteTitle,description:xo.overwriteDescription,primaryButtonText:xo.buttons.yes,secondaryButtonText:xo.buttons.no}),oo(!0)},_s=()=>{let mt=!0;const Qt=[];return Object.values(e.lineDetailSection).forEach((wt,Kt)=>{wt.type===xo.outOfPocketKey&&LAe(wt)>=75&&wt.file==null&&(Qt.push(wt.lineId),mt=!1)}),Dn(Qt),mt},us=()=>{if(m&&e.remiStage==="pending_approval"&&e.remiStatus!=="rejected")ds();else{Te("save");const mt=tt.getValues(),Qt=P_(mt,e.merchantList.merchants,i,Re,e.currencyConversionStatus,e.allCurrencies,e.accountList.accounts,e.classList.classes,r?.entityAutoCompleteView);U?.(Qt);const wt=Qt.whatForSection?.reportTitle;wt!=null&&wt.length>0?N(e.remiStatus==="rejected"?"pending_approval":"draft"):tt.trigger(`${qA}.reportTitle`,{shouldFocus:!0})}};let js=!1;Object.values(e.addRemiAutoFieldsByLineId).forEach(mt=>{mt.length>0&&(js=!0)});let xn=[];if(e.remiId==null){const mt=Re??0;mt>0&&(xn=e.approvalRules.allApprovalRules?.filter(Qt=>{const wt=Qt.criteria[0].range;if(wt.max!=null){if(wt.min.amount<mt&&wt.max.amount>=mt)return Qt}else if(wt.min.amount<mt)return Qt;return null}).map(Qt=>({...Qt,stepsWithStatus:Qt.steps.map(wt=>({...wt,actorsActivity:[],isOriginalApprovalStep:!0})),isRealTimeApprovalEnabled:!1})))}const As=mt=>{const Qt=_s();return tt.handleSubmit(()=>{Qt&&(Te("submit"),x?.trackReimbursementSubmitReimbursement(e.createTime?.format(Cde.analytics.MMMDashDDDashYYYYFormat)??Q.dateNow().format(Cde.analytics.MMMDashDDDashYYYYFormat),i.currencyCode,Re,h),B(),To(!0))})(mt)},nn=()=>{const mt=tt.getValues(),Qt=P_(mt,e.merchantList.merchants,i,Re,e.currencyConversionStatus,e.allCurrencies,e.accountList.accounts,e.classList.classes,r?.entityAutoCompleteView);U?.(Qt),H()},os=e.reimbursementInfo?.billStatus.code=="approved"&&e.reimbursementInfo?.billPaymentStatus.code?e.reimbursementInfo?.billPaymentStatus:e.reimbursementInfo?.billStatus,qe=e.reimbursementInfo?.paymentDate!=null?Q.zeniDate(Q.getNextNthWorkingDay(e.reimbursementInfo.paymentDate.toDate(),[0,6],e.achSameDayMaxDays).toDateString()):void 0,xt=e.reimbursementInfo?.expectedDepositDate??qe,Wt=h!=null&&e.remiStage==="draft",Ze=AAe(e.duplicateLineByLineId),Mo=e.duplicateReimbursementStatus.fetchState==="Completed"&&Ze>0,{requestToOpenThread:Lo,setRequestToOpenThread:_n,setOpenThread:ns}=g.useContext(vs);g.useEffect(()=>{pe?.threadId!=null&&pe?.companyId!=null&&pe?.entityType!=null&&_n(pe)},[pe,_n]);const{threads:Vt,isLoading:en}=sa({application:"dashboard",companyId:Ee.currentTenant?.companyId,tab:"reimbursement",entityId:h,isGlobalComment:!1},"both",!1);g.useEffect(()=>{Lo?.threadId!=null&&Vt.length>0&&!en&&(ns(Lo.threadId),_n(null))},[Lo,Vt,en,ns,_n]);const $t=g.useMemo(()=>h==null?[]:Vt.filter(mt=>mt.resolved===!1&&!mt.id.includes($s)),[Vt,h]).length,bo=(mt,Qt)=>{ns(Qt);const wt=mt.entityType.split("."),Kt=parseInt(wt[2]);if(isNaN(Kt)){Ue(!1);return}const ks=`${Kt+1}`,_o=e.lineDetailSection[Kt+1].type;wt.includes(xo.mileageKey)&&_o===xo.outOfPocketKey?Y(Q.toReimbursementTypeCode(xo.mileageKey),ks,h):wt.includes(xo.outOfPocketKey)&&_o===xo.mileageKey&&Y(Q.toReimbursementTypeCode(xo.outOfPocketKey),ks,h),Ue(!1)};return t.jsxRuntimeExports.jsx(vdn,{children:t.jsxRuntimeExports.jsx(v0,{sharedItems:{sharedFunctions:void 0,sharedRef:{contentWrapperRef:ye.current??null}},children:t.jsxRuntimeExports.jsxs(t.FormProvider,{...tt,children:[t.jsxRuntimeExports.jsx("form",{id:wde(bde),onSubmit:mt=>As(mt),children:t.jsxRuntimeExports.jsxs(nun,{windowSize:He,ref:ye,children:[ft?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:qt.title}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:qt.description}),primaryButtonText:qt.primaryButtonText,secondaryButtonText:qt.secondaryButtonText,action:Go,proceedButtonVariant:qt.title===xo.deleteBankAccountTitle||qt.title===xo.deleteDraftTitle||qt.title===xo.deleteReportTitle||qt.title===xo.discardTitle?"destructive":"primary",useLegacyStyles:!0,isEditPopup:qt.title===xo.deleteBankAccountTitle}):null,on?t.jsxRuntimeExports.jsx(pdn,{reimbursementId:h,submitFetchState:e.saveStatus?.fetchState??"Not-Started",duplicateReimbursementStatus:e.duplicateReimbursementStatus.fetchState,hasDuplicateLine:Mo,numberOfDuplicateLines:Ze,setShowDuplicatePopup:To,submitReport:nn,fetchDuplicateReimbursement:I,clearDuplicateReimbursementDetail:B,clearRemiSaveStatus:L,analytics:x}):null,Se?t.jsxRuntimeExports.jsx($de,{windowSize:He}):null,We&&je!==!0?t.jsxRuntimeExports.jsxs($de,{windowSize:He,"data-testid":_("skip-autofill-section"),children:[He==="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(zdn,{children:t.jsxRuntimeExports.jsx(oun,{partOfSkipAutoFill:!0,size:He,onClick:()=>nt(!1),"data-testid":_("close-invoice-upload"),children:t.jsxRuntimeExports.jsx(Jdn,{withOverlay:!0,children:t.jsxRuntimeExports.jsx(Kdn,{})})})}),t.jsxRuntimeExports.jsx(Fdn,{children:yn})]}):null,t.jsxRuntimeExports.jsx(rB,{showAutofill:We,analytics:x,onSkipAutofill:()=>{x?.trackReimbursementSkipAutofill(),nt(!1)},uploadInvoiceEndPoint:c,authParams:n,style:{width:na.leftSectionWidth.valuePercentage(He),boxSizing:"border-box",backgroundColor:He==="small"?ve.colors.grey4:"unset",paddingTop:He==="small"?o.sp5:"78px",paddingRight:o.sp3,paddingBottom:He==="small"?o.sp5:"15px",paddingLeft:He==="small"?o.sp3:o.sp5,margin:He==="small"?o.sp0:void 0},onInvoiceUpload:mt=>V(mt,ut,!0),dropFilePlaceholder:{upload:xo.dropReceipt.upload,single:xo.dropReceipt.single,or:xo.dropReceipt.or,multiple:xo.dropReceipt.multiple,receipts:xo.dropReceipt.receipts},updateInvoiceUploadFetchState:ee,showInfoText:!1,allowMultiFiles:We,type:"reimbursement"})]}):null,t.jsxRuntimeExports.jsxs(Zdn,{windowSize:He,"data-testid":_("edit-reimbursement-detail-page-nav-bar-container"),children:[He!=="small"?t.jsxRuntimeExports.jsx(Rt,{style:{width:"42%"},"data-testid":_("edit-reimbursement-detail-page-left-nav-bar"),title:"",leftSideComponent:t.jsxRuntimeExports.jsx(Rde,{"data-testid":_("edit-remi-detail-page-nav-bar-back-icon"),onClick:so}),enableTitleOnScroll:!1,scrollableContent:ge,backgroundColor:ve.colors.grey4,keepBackgroundOnScroll:!0,source:"EditReimbursementDetailPage"}):null,He!=="small"?t.jsxRuntimeExports.jsx(Sdn,{}):null,t.jsxRuntimeExports.jsx(Rt,{style:{width:na.navBarWidth.valuePercentage(He)},"data-testid":_("edit-reimbursement-detail-page-right-nav-bar"),source:"EditReimbursementDetailPage",title:yn,hideSearchBtn:!0,leftSideComponent:He==="small"?t.jsxRuntimeExports.jsx(Rde,{"data-testid":_("edit-remi-detail-page-nav-bar-back-icon-mobile"),onClick:so}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),rightSideComponent:t.jsxRuntimeExports.jsxs(Xdn,{children:[We!=!0&&u&&h!=null&&!Pe?t.jsxRuntimeExports.jsxs(eun,{isDisabled:en,"data-testid":_("remi-comment-button"),onClick:en?()=>null:mt=>{mt.preventDefault(),mt.stopPropagation(),Ne({roomId:Je,companyId:Ee.currentTenant?.companyId??"",companyName:Ee.currentTenant?.companyName??"",entityType:"reimbursement.details",entityId:h}),Ue(!0),x?.trackCommentActivity("reimbursement","clicked",Ee.currentTenant?.companyName??"",Ee.controllersList.controllers.map(Qt=>cn(Qt)),void 0,void 0,"page icon")},children:[t.jsxRuntimeExports.jsx(Br,{count:en?void 0:$t,isLoading:en,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(tun,{})]}):null,t.jsxRuntimeExports.jsx(ms,{dataTestId:"edit-reimbursement-detail-page-ask-ai-cfo-button",isAiCfoAccessEnabled:ce,onAskAiCfoClick:de})]}),enableTitleOnScroll:He!=="small",scrollThreshold:64,scrollableContent:ge,backgroundColor:ve.colors.grey4,keepBackgroundOnScroll:!0})]}),t.jsxRuntimeExports.jsxs(sun,{windowSize:He,ref:ge,children:[He==="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(qdn,{children:yn}),t.jsxRuntimeExports.jsx(NT,{progressSectionObj:os,createDate:e.createTime,paymentDate:xt,scheduleDate:e.reimbursementInfo?.paymentDate,approvedDate:e.latestApprovedDate,isBillUploaded:h!=null?!0:e.uploadStatus==="Completed"}),js&&t.jsxRuntimeExports.jsxs(Wdn,{children:[t.jsxRuntimeExports.jsx(Hdn,{}),t.jsxRuntimeExports.jsx(Vdn,{children:xo.banner})]}),e.isProcessing?t.jsxRuntimeExports.jsx(xd,{variant:"warning",style:{margin:He==="small"?`${o.sp5} ${o.sp3}`:`${o.sp3} ${o.sp5} ${o.sp3} ${o.sp5}`},title:jde.duplicateWarning.title,description:jde.duplicateWarning.description}):Mo?t.jsxRuntimeExports.jsxs(Qdn,{size:He,children:[t.jsxRuntimeExports.jsx(Tdn,{}),t.jsxRuntimeExports.jsxs(Gdn,{children:[t.jsxRuntimeExports.jsx(Udn,{children:xo.thereSeems}),t.jsxRuntimeExports.jsx(Ydn,{children:xo.pleaseFind})]})]}):null,t.jsxRuntimeExports.jsx(TAe,{isReimbursementCommentingEnabled:u,sectionId:qA,reimbursementId:e.remiId,reportTitle:e.whatForSection.reportTitle})]}):null,t.jsxRuntimeExports.jsx(Hcn,{onDuplicateLineClick:D,reimbursementId:h,remiDetails:e,uploadInvoiceEndPoint:c,authParams:n,isAccountingClassesEnabled:d,showSkipAutoFill:We,setShowSkipAutoFill:nt,isReimbursementCommentingEnabled:u,isAutoFieldsExist:js,totalAmount:Re,removeFileFromLine:J,onReplaceClick:pn,onReceiptsUpload:V,currencyConversionStatus:e.currencyConversionStatus,setCurrentLineIdForUpload:pt,setUploadedReceiptPayload:Xe,updateInvoiceUploadFetchState:ee,clearTentativeNameForLine:te,defaultCurrency:i,companyMileageConfigInfo:l,isUserAdmin:m,setShowBankAccountPage:Ht,bankAccounts:b,onDeleteBankAccount:ts,analytics:x,fileRequiredLineIds:kn,isSignedInUserReimbursementCreator:E,uncategorizedAccounts:$,showTotalAmountLoader:Oe,duplicateLineByLineId:e.duplicateLineByLineId,hasDuplicateLine:Mo,removeDuplicateReimbursementForLine:P,scrollContainerRef:ge,customerSearchAutoComplete:r!=null?{customerSearchAutoCompleteData:r,loadOptions:Yn}:void 0}),t.jsxRuntimeExports.jsxs(iun,{showSkipAutoFill:We,windowSize:He,children:[He!=="small"?t.jsxRuntimeExports.jsx(Ede,{}):null,t.jsxRuntimeExports.jsx(run,{windowSize:He,children:t.jsxRuntimeExports.jsxs(aun,{windowSize:He,children:[e.remiId!==void 0&&t.jsxRuntimeExports.jsx(h5,{amount:Re??0,activities:e.remiActivities,stage:e.remiStage??"draft",onAddNewRule:se,entity:"reimbursement",historicActivities:e.remiHistory.activities}),e.remiId==null&&Re!=null&&Re>0?t.jsxRuntimeExports.jsx(h5,{amount:Re??0,activities:xn,stage:"draft",entity:"reimbursement",historicActivities:e.remiHistory.activities}):null]})})]}),t.jsxRuntimeExports.jsx(lun,{}),t.jsxRuntimeExports.jsxs(Ndn,{showSkipAutoFill:We,windowSize:He,children:[He!=="small"?t.jsxRuntimeExports.jsx(Ede,{}):null,t.jsxRuntimeExports.jsx(Adn,{windowSize:He,onClick:mt=>{mt.stopPropagation(),Be===!0&&Ae(!1)},children:t.jsxRuntimeExports.jsx(_t,{formId:wde(bde),separatorStyle:{marginRight:o.sp4},showCancel:E,cancelBtn:{label:m&&e.remiStage==="pending_approval"&&e.remiStatus!=="rejected"?He==="small"?xo.buttons.discard:xo.buttons.discardChanges:He==="small"?xo.buttons.save:xo.buttons.saveChanges,isLoading:_e==="save"&&e.saveStatus?.fetchState==="In-Progress",onClick:us,style:{width:na.footerButtonWidth.value(He)},reverseSpinnerColor:!1},primaryBtn:{label:Rdn(E,m,e,He),isDisabled:!E,style:{width:E?na.footerButtonWidth.value(He):"auto"},type:E?"submit":"button",onClick:E?()=>null:us,isLoading:!E&&_e==="save"&&e.saveStatus?.fetchState==="In-Progress"},rightSideComponent:t.jsxRuntimeExports.jsx(kdn,{children:t.jsxRuntimeExports.jsxs(Mdn,{windowSize:He,children:[Be?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>Ae(!1),children:t.jsxRuntimeExports.jsx(Pdn,{windowSize:He,"data-testid":_("remi-other-actions-container"),children:t.jsxRuntimeExports.jsx(Ddn,{onClick:In,"data-testid":_("delete-report-action"),children:xo.buttons.deleteReport})})}):null,t.jsxRuntimeExports.jsx(Bdn,{windowSize:He,children:Wt===!0?t.jsxRuntimeExports.jsx(Ldn,{windowSize:He,"data-testid":_("more-details-button"),children:t.jsxRuntimeExports.jsx(Idn,{onClick:()=>Ae(!Be)})}):null})]})})})})]})]})]})}),u&&h!=null?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:Je,children:t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:Pe,allowComposer:!0,drawerTitle:fdn,threads:Vt,autoExpand:!0,autoFocus:!1,filter:{application:"dashboard",companyId:Ie?.companyId??ydn,isGlobalComment:!1,tab:"reimbursement"},isLoading:en,threadMetadata:Ie?{companyName:Ie.companyName,companyId:Ie.companyId,entityId:Ie.entityId,entityType:Ie.entityType,isGlobalComment:!1,application:"dashboard",tab:"reimbursement",url:window.location.href}:void 0,textOverrides:{composerPlaceholder:jdn,replyComposerPlaceholder:Cdn,threadResolve:bdn,threadUnResolve:wdn},onThreadClick:(mt,Qt)=>bo(mt,Qt),onCloseAllThreadsDrawer:()=>Ue(!1),drawerSectionStyle:{width:"400px",backgroundColor:ve.colors.background}})}):null,Bt?t.jsxRuntimeExports.jsxs(_dn,{windowSize:He,children:[He!=="small"?t.jsxRuntimeExports.jsx(Rt,{style:{width:"100%"},source:"EditReimbursementDetailPage_BankAccount",title:xo.addBankAccount,leftSideComponent:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),rightSideComponent:null,hideSearchBtn:!0,enableTitleOnScroll:!0,scrollThreshold:64,scrollableContent:he,backgroundColor:ve.colors.grey4,keepBackgroundOnScroll:!0}):null,t.jsxRuntimeExports.jsx(Odn,{ref:he,windowSize:He,children:t.jsxRuntimeExports.jsx(_Ae,{ref:Ce,bankAccountCreationState:y,setShowBankAccountPage:Ht,plaidConnectionDetails:f,onFetchLinkTokenClick:ie,onEstablishConnectionClick:re,onSaveHandler:A,bankAccountToCreate:R,bankNameByRouting:C,fetchBankNameByRoutingStatus:S,onUserBankDetailsUpdated:k,onFetchBankName:T,hideBackIcon:He!=="small",hideTopBar:He!=="small",onBackClick:Gt})})]}):null]})})})},Rdn=(e,n,i,r)=>e?i.reimbursementId!=null&&i.remiStage==="pending_approval"?xo.buttons.resubmit:xo.buttons.submit:n&&i.remiStage==="pending_approval"&&i.remiStatus!=="rejected"?r==="small"?xo.buttons.discard:xo.buttons.discardChanges:r==="small"?xo.buttons.save:xo.buttons.saveChanges,vdn=s.div`
45669
+ `,na={rightMargin:new w(p[3],p[5]),leftMargin:new w(p[3],p[5]),closeMarginTop:new w(0,19),closeMarginRight:new w(p[3],p[5]),rightSectionWidth:new w(100,58),leftSectionWidth:new w(100,42),footerButtonWidth:new w(120,129),right:new w(p[3],p[0]),actionsContainerRight:new w(p[0],p[3]),otherActionsContainerBottom:new w(58,44),duplicateBannerWrapperMarginTop:new w(p[5],p[3]),duplicateBannerWrapperMarginRight:new w(p[3],p[5]),duplicateBannerWrapperMarginBottom:new w(p[5],p[3]),duplicateBannerWrapperMarginLeft:new w(p[3],p[5]),navBarWidth:new w(100,58)},{spendManagement:{reimbursement:{reimbursementDetail:xo,bulkActions:jde}},common:{currency:{currencyCode:ox,currencySymbol:t$},texts:{comments:fdn},strings:{empty:ydn}},collaboration:{threads:{placeholder:{addANewComment:jdn,replyAComment:Cdn},tooltip:{resolveComment:bdn,unResolveComment:wdn}}},dateFormat:Cde}=O.getLocalizedStrings(),bde="editReimbursementDetailPage",wde=e=>`${e}_form`,Edn=(e,n,i,r,a,l,c,d,u)=>{const m=e.outOfPocket,x=e.mileage,h=m.merchant,f=m.recommendations;return{lineIndex:l,lineId:e?.lineId??String(l+1),reimbursementType:e?.type??xo.outOfPocketKey,file:e?.file,homeCurrencyConversions:{amount:e?.homeCurrencyConversions?.amount??0,currencyCode:e?.homeCurrencyConversions?.currencyCode??c.currencyCode,currencySymbol:e?.homeCurrencyConversions?.currencySymbol??c.currencySymbol},outOfPocket:{recommendedAccount:m.recommendedAccount,isCategoryUpdateSelected:m.isCategoryUpdateSelected??!1,isCategoryFirstTimeAutofilled:m.isCategoryFirstTimeAutofilled??!1,retainedAccount:m.retainedAccount,isRetainedCategorySelected:m.isRetainedCategorySelected??!1,recommendations:f??[],transactionDate:m?.transactionDate?.toDate()??void 0,class:{allOptions:d1(Lr(i,[])),selectedOption:m?.lineDetail?.class?.classId??u},account:{allOptions:d1($n(n,f)),selectedOption:m.lineDetail?.account?.qboId??m.lineDetail?.account?.accountId},customer:{defaultOptions:oC(m?.lineDetail?.customer),selectedOption:m?.lineDetail?.customer?.id},amount:{amount:m?.amount??0,currencyCode:m?.currencyCode??c.currencyCode,currencySymbol:m?.currencySymbol??c.currencySymbol,currency:{allOptions:d.map(y=>({label:`${y.currencyCode} - ${y.currency}`,value:y.currencyCode,countryCode:VT(y.countryCode)})),selectedOption:m?.currencyCode??c.currencyCode??ox}},memo:m?.description??void 0,merchant:{allOptions:r.map(y=>y.id).filter(y=>!!y),selectedOption:h?.id?h?.id:h?.name?h?.name:e?.lineId!=null?a[e?.lineId]:void 0}},mileage:{transactionDate:x?.transactionDate?.toDate(),class:{allOptions:d1(Lr(i,[])),selectedOption:x?.lineDetail?.class?.classId},customer:{defaultOptions:oC(x?.lineDetail?.customer),selectedOption:x?.lineDetail?.customer?.id},distanceInMiles:x?.distanceMileage?.value,amount:{amount:x?.amount??0,currencyCode:x?.currencyCode??c.currencyCode,currencySymbol:x?.currencySymbol??c.currencySymbol},memo:x?.description}}},L_=(e,n,i)=>{const r=[];return Object.values(e.lineDetailSection).forEach((a,l)=>{a?.lineId!=null&&r.push(Edn(a,e.accountsHierarchyList,e.classHierarchyList,e.merchantList.merchants,e.tentativeMerchantNameByLineId,l,n,e.allCurrencies,e.loggedInUserDepartmentId))}),r.length===0&&r.push(DAe(0,"1",e.accountsHierarchyList,e.classHierarchyList,e.merchantList.merchants,n,e.allCurrencies,e.loggedInUserDepartmentId)),{[qA]:{reportTitle:e.whatForSection.reportTitle},[wY]:r,[x9]:{selectedOption:e.paymentTo,allOptions:i.map(a=>a.bankAccountId)}}},B_=(e,n)=>{const i=r=>r.lineId==null||n[r.lineId]?.fetchState==="In-Progress"?0:(n[r.lineId]?.fetchState==="Completed",r.type===xo.mileageKey?r?.mileage?.amount??0:r?.outOfPocket?.currencyCode!==ox&&r.homeCurrencyConversions?.amount!==r?.outOfPocket?.amount?r.homeCurrencyConversions?.amount??0:r?.outOfPocket?.amount??0);return Object.values(e).reduce((r,a)=>r+i(a),0)},P_=(e,n,i,r,a,l,c,d,u)=>{const m={};return e.lineInfo.forEach(x=>{const h=d.find(R=>R.classId===x.mileage.class.selectedOption),f=(()=>{const R=x.mileage.customer?.selectedOption;if(R==null)return;const S=u?.customer.find(T=>T.id===R);if(S!=null)return S;const k=x.mileage.customer?.defaultOptions?.find(T=>T.value===R);if(k!=null)return{id:k.value,name:k.label}})(),y=c.find(R=>R.qboId===x.outOfPocket.account.selectedOption||R.accountId===x.outOfPocket.account.selectedOption),C=d.find(R=>R.classId===x.outOfPocket.class.selectedOption),b=(()=>{const R=x.outOfPocket.customer?.selectedOption;if(R==null)return;const S=u?.customer.find(T=>T.id===R);if(S!=null)return S;const k=x.outOfPocket.customer?.defaultOptions?.find(T=>T.value===R);if(k!=null)return{id:k.value,name:k.label}})(),E=n.find(R=>R.id===x.outOfPocket.merchant.selectedOption),$=l.find(R=>R.currencyCode===x.outOfPocket.amount?.currency.selectedOption)?.currencySymbol;m[x.lineId]={fileId:x.file?.fileId,lineId:x.lineId,type:x.reimbursementType,homeCurrencyConversions:x.homeCurrencyConversions??{amount:0,currencyCode:"USD",currencySymbol:"$"},mileage:{description:x.mileage.memo??"",lineDetail:{class:h,customer:f},transactionDate:x.mileage.transactionDate!=null?Q.zeniDate(x.mileage.transactionDate.toDateString()):void 0,amount:x.mileage.amount?.amount??0,currencyCode:x.mileage.amount?.currencyCode??$,currencySymbol:x.mileage.amount?.currencySymbol??$,distanceMileage:{unit:"miles",value:x.mileage.distanceInMiles??0}},outOfPocket:{description:x.outOfPocket.memo??"",lineDetail:{class:C,account:y,customer:b},transactionDate:x.outOfPocket.transactionDate!=null?Q.zeniDate(x.outOfPocket.transactionDate.toDateString()):void 0,amount:x.outOfPocket.amount?.amount??0,currencyCode:x.outOfPocket.amount?.currency.selectedOption??$,currencySymbol:$,merchant:x.outOfPocket.merchant.selectedOption!=null?{id:E?.id??"",name:E?.name??x.outOfPocket.merchant.selectedOption}:void 0,recommendations:x.outOfPocket.recommendations,recommendedAccount:x.outOfPocket.recommendedAccount,isCategoryUpdateSelected:x.outOfPocket.isCategoryUpdateSelected,isCategoryFirstTimeAutofilled:x.outOfPocket.isCategoryFirstTimeAutofilled,isRetainedCategorySelected:x.outOfPocket.isRetainedCategorySelected,retainedAccount:x.outOfPocket.retainedAccount}}}),{whatForSection:{reportTitle:e.whatFor.reportTitle},updatesByLineId:m,totalAmount:{amount:r,...i},currencyConversionStateByLineId:a,paymentTo:e.paymentTo.selectedOption}},$dn=({remiDetails:e,authParams:n,defaultCurrency:i,customerSearchAutoCompleteData:r,customerSearchAutoCompleteActions:a,companyMileageConfigInfo:l,uploadInvoiceEndPoint:c,isAccountingClassesEnabled:d,isReimbursementCommentingEnabled:u,isUserAdmin:m,analytics:x,reimbursementId:h,plaidConnectionDetails:f,bankAccountCreationState:y,bankNameByRouting:C,bankAccounts:b,isSignedInUserReimbursementCreator:E,uncategorizedAccounts:$,bankAccountToCreate:R,fetchBankNameByRoutingStatus:S,onUserBankDetailsUpdated:k,onFetchBankName:T,onSaveBankAccount:A,fetchDuplicateReimbursement:I,clearDuplicateReimbursementDetail:B,clearRemiSaveStatus:L,removeDuplicateReimbursementForLine:P,onDuplicateLineClick:D,onExistingMerchantChange:M,onNewMerchantChange:F,onReceiptsUpload:V,saveRemiDetails:N,submitRemiDetails:H,discardReimbursementDetailsFromLocalStore:W,onReimbursementDetailsChanged:U,updateReimbursementType:Y,onHomeCurrencyConversionUpdate:q,redirectToReimbursementListScreen:Z,redirectToReimbursementDetailScreen:G,deleteReimbursement:K,removeFileFromLine:J,onAmountChanged:oe,updateInvoiceUploadFetchState:ee,clearTentativeNameForLine:te,onAddNewRule:se,onFetchLinkTokenClick:ie,onEstablishConnectionClick:re,deleteBankAccount:ne,onBackClickFromBankAccountPage:me,initialOpenThreadRequest:pe,disableInternalOverlay:je,isAiCfoAccessEnabled:ce,onAskAiCfoClick:de,onCurrentLineIdForUploadChange:ue,showSkipAutoFill:le,setShowSkipAutoFill:ae})=>{const ge=g.useRef(null),ye=g.useRef(null),he=g.useRef(null),Ce=g.useRef(null),we=Ye(e.uploadStatus),ve=t.useTheme(),Ee=ht(),[Se,$e]=g.useState(!1),[Be,Ae]=g.useState(!1),[_e,Te]=g.useState("save"),[Re,ke]=g.useState(B_(e.lineDetailSection,e.currencyConversionStatus)),[Oe,Me]=g.useState(!1),[Ie,Ne]=g.useState(null),[Pe,Qe]=g.useState(!1),Je=`dashboard_${Ee.currentTenant?.companyId}`,tt=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:g.useMemo(()=>L_(e,i,b),[e,i,b]),values:g.useMemo(()=>L_(e,i,b),[e,i,b]),resetOptions:{keepErrors:!0},shouldFocusError:!0}),{isDirty:Ue,dirtyFields:dt}=tt.formState,ct=async(mt,Qt)=>{const{lineInfo:wt}=Qt,Kt=Number(mt.split(".")[1]);if(mt.includes("reportTitle")||mt.includes("memo"))return;if(mt.includes("reimbursementType")){const _o=wt[Kt].mileage,Ct=wt[Kt].outOfPocket;wt[Kt]={...wt[Kt],outOfPocket:{transactionDate:Ct.transactionDate??void 0,class:{allOptions:Ct.class.allOptions??d1(Lr(e.classHierarchyList,[])),selectedOption:Ct.class.selectedOption??void 0},account:{allOptions:Ct.account.allOptions??d1($n(e.accountsHierarchyList,[])),selectedOption:Ct.account.selectedOption??void 0},amount:Ct.amount??{amount:0,currencyCode:i.currencyCode,currencySymbol:i.currencySymbol,currency:{allOptions:e.allCurrencies.map(Ot=>({label:`${Ot.currencyCode} - ${Ot.currency}`,value:Ot.currencyCode,countryCode:VT(Ot.countryCode)})),selectedOption:i.currencyCode??ox}},memo:Ct.memo??void 0,merchant:Ct.merchant??void 0,recommendations:Ct.recommendations??[],recommendedAccount:Ct.recommendedAccount??void 0,isCategoryUpdateSelected:Ct.isCategoryUpdateSelected??!1,isCategoryFirstTimeAutofilled:Ct.isCategoryFirstTimeAutofilled??!1,retainedAccount:Ct.retainedAccount??void 0,isRetainedCategorySelected:Ct.isRetainedCategorySelected??!1},mileage:{transactionDate:_o.transactionDate??void 0,class:{allOptions:_o.class.allOptions??d1(Lr(e.classHierarchyList,[])),selectedOption:_o.class.selectedOption??e.loggedInUserDepartmentId},distanceInMiles:_o.distanceInMiles,amount:{amount:_o?.amount?.amount??0,currencyCode:_o?.amount?.currencyCode??ox,currencySymbol:_o?.amount?.currencySymbol??t$},memo:_o.memo??void 0}}}else if(mt.includes("mileage.distanceInMiles")){const{distanceInMiles:_o}=wt[Kt].mileage,Ct=l?.mileageUnitAmount??0;wt[Kt].mileage={...wt[Kt].mileage,amount:{amount:_o!=null?_o*Ct:0,currencyCode:i.currencyCode,currencySymbol:i.currencySymbol}}}else if(mt.includes("outOfPocket.amount")&&wt[Kt].lineId){const _o=wt[Kt].outOfPocket.amount,Ct=e.allCurrencies.find(Ot=>Ot.currencyCode===_o?.currency.selectedOption)?.currencySymbol;if(_o?.currencyCode!==_o?.currency.selectedOption){const Ot=_o?.currency?.allOptions||[];wt[Kt].outOfPocket.amount={currency:{allOptions:Ot,selectedOption:_o?.currency?.selectedOption},amount:wt[Kt].outOfPocket?.amount?.amount??0,currencyCode:_o?.currency.selectedOption??ox,currencySymbol:Ct??t$}}if(_o?.currency.selectedOption!==ox)Me(!0),Hs(wt[Kt].lineId,ox);else{const Ot={};wt.forEach(Mt=>{Ot[Mt.lineId]={lineId:Mt.lineId,homeCurrencyConversions:Mt.homeCurrencyConversions}}),wt[Kt].homeCurrencyConversions={amount:_o.amount??0,currencyCode:_o?.currency.selectedOption??ox,currencySymbol:Ct??t$};const Yo=B_(Ot,e.currencyConversionStatus);Re!==Yo&&ke(Yo)}}else if(mt.includes("outOfPocket.isRetainedCategorySelected"))wt[Kt].outOfPocket.isRetainedCategorySelected===!0&&(wt[Kt].outOfPocket.isCategoryUpdateSelected=!1,wt[Kt].outOfPocket.account.selectedOption=wt[Kt].outOfPocket.retainedAccount?.qboId);else if(mt.includes("outOfPocket.isCategoryUpdateSelected"))if(wt[Kt].outOfPocket.isCategoryUpdateSelected===!0)wt[Kt].outOfPocket.account.selectedOption=wt[Kt].outOfPocket.recommendedAccount?.qboId,wt[Kt].outOfPocket.isRetainedCategorySelected=!1;else{const _o=wt[Kt].lineId,Ct=e.editRemiInitialDetails.lineDetailSection[_o]?.lineDetail?.account?.qboId;wt[Kt].outOfPocket.account.selectedOption=Ct,wt[Kt].outOfPocket.isRetainedCategorySelected=!1}else mt.includes("outOfPocket.account")&&(wt[Kt].outOfPocket.recommendations.length>0&&(wt[Kt].outOfPocket.recommendedAccount=wt[Kt].outOfPocket.recommendations[0].account),wt[Kt].outOfPocket.recommendedAccount?.qboId!=null&&wt[Kt].outOfPocket.account.selectedOption===wt[Kt].outOfPocket.recommendedAccount?.qboId?wt[Kt].outOfPocket.isCategoryUpdateSelected=!0:wt[Kt].outOfPocket.isCategoryUpdateSelected=!1,wt[Kt].outOfPocket.retainedAccount?.qboId!=null&&wt[Kt].outOfPocket.account.selectedOption===wt[Kt].outOfPocket.retainedAccount?.qboId?wt[Kt].outOfPocket.isRetainedCategorySelected=!0:wt[Kt].outOfPocket.isRetainedCategorySelected=!1,wt[Kt].outOfPocket.isCategoryFirstTimeAutofilled=!1);const ks=P_({...Qt,lineInfo:wt},e.merchantList.merchants,i,Re,e.currencyConversionStatus,e.allCurrencies,e.accountList.accounts,e.classList.classes,r?.entityAutoCompleteView);if(U?.(ks),mt.includes("outOfPocket.merchant")){const _o=wt[Kt].lineId,Ct=wt[Kt].outOfPocket.merchant.selectedOption??"";wt[Kt].outOfPocket.merchant.allOptions.find(Yo=>Yo===Ct)!=null?M(Ct,_o):F(Ct,_o)}},yt=g.useMemo(()=>t.debounce((mt,Qt)=>ct(mt,Qt),300),[e.accountList.fetchState,e.classList.fetchState,e.merchantList.fetchState]);g.useEffect(()=>{const mt=tt.watch((Qt,{name:wt})=>{wt!=null&&Qt!=null&&yt(wt,Qt)});return()=>{mt.unsubscribe()}},[yt,tt]),g.useEffect(()=>{const mt=Q.reduceAnyFetchState(Object.values(e.currencyConversionStatus)),Qt=mt.fetchState==="In-Progress"||mt.fetchState==="Error";Me(Qt)},[e.currencyConversionStatus]),g.useEffect(()=>{for(const Qt in e.currencyConversionStatus){const wt=e.lineDetailSection[Qt],Kt=e.lineDetailSection[Qt];e.currencyConversionStatus[Qt].fetchState==="Completed"&&Kt!=null&&wt.type!==xo.mileageKey&&!t.isEqual(wt?.homeCurrencyConversions,Kt.homeCurrencyConversions)&&q({amount:wt?.homeCurrencyConversions?.amount??0,currencyCode:wt?.homeCurrencyConversions?.currencyCode??ox,currencySymbol:wt?.homeCurrencyConversions?.currencySymbol??t$},Qt,h)}const mt=B_(e.lineDetailSection,e.currencyConversionStatus);Re!==mt&&ke(mt)},[e.currencyConversionStatus,e.lineDetailSection]),g.useEffect(()=>{(e.saveStatus?.fetchState==="Completed"||e.deleteStatus.fetchState==="Completed")&&(W(h),Z?.())},[e.saveStatus?.fetchState,e.deleteStatus.fetchState,h,W,Z]);const He=X(),[jt,St]=g.useState(h==null),We=le??jt,nt=ae??St,[ut,pt]=g.useState(1);g.useEffect(()=>{ue?.(ut)},[ut,ue]);const[Bt,Ht]=g.useState(!1),[$o,Tt]=g.useState(""),Gt=g.useCallback(()=>{me(),Ht(!1)},[me]),so=g.useCallback(()=>{Bt?Ce.current?.requestBack():Z?.()},[Bt,Z]),[no,Xe]=g.useState(null),[ft,oo]=g.useState(!1),[on,To]=g.useState(!1),[kn,Dn]=g.useState([]),[qt,dn]=g.useState({title:"",description:"",primaryButtonText:"",secondaryButtonText:""}),Zs=g.useRef(),Yn=(mt,Qt)=>{a?.onAutoCompleteInputChange?.(mt,"customer"),Zs.current=Qt},Hs=g.useRef(t.debounce((mt,Qt)=>oe(mt,Qt),500,{trailing:!0})).current;g.useEffect(()=>{r?.entityAutoCompleteView.fetchState==="Completed"&&(Zs.current?.(HQ(r.entityAutoCompleteView)),Zs.current=void 0)},[r]),g.useEffect(()=>{we==="In-Progress"&&(e.uploadStatus==="Completed"?(tt.reset(L_(e,i,b),{keepDefaultValues:!0}),$e(!1),nt(!1)):e.uploadStatus==="Error"&&$e(!1))},[we,e.uploadStatus,tt,e,Se,$e,nt,We,i,b,x]),g.useEffect(()=>{e.uploadStatus==="In-Progress"&&We===!1&&$e(!0)},[e.uploadStatus,$e,We]);const yn=e.remiStage==="draft"?xo.newReimbursementTitle:xo.editReimbursementTitle,Go={onOkClick:()=>{if(oo(!1),qt.primaryButtonText===xo.buttons.discard)W(h),e.remiStage==="draft"?Z?.():G?.();else if(qt.primaryButtonText===xo.buttons.delete)qt.title===xo.deleteBankAccountTitle?ne?.($o):K?.();else if(qt.primaryButtonText===xo.buttons.yes&&no!=null){const mt=kn.filter(Qt=>Qt!==ut.toString());Dn(mt),V(no,ut,!0)}},onCancelClick:()=>{if(oo(!1),qt.secondaryButtonText===xo.buttons.no){const mt=kn.filter(Qt=>Qt!==ut.toString());Dn(mt),V(no,ut,!1)}}},ds=()=>{Ue||kc(dt)?(dn({title:xo.discardTitle,description:xo.discardDescription,primaryButtonText:xo.buttons.discard,secondaryButtonText:xo.buttons.cancel}),oo(!0)):(W(h),Z?.())},In=()=>{dn({title:e.remiStage==="draft"?xo.deleteDraftTitle:xo.deleteReportTitle,description:xo.deleteAlertDescription,primaryButtonText:xo.buttons.delete,secondaryButtonText:xo.buttons.cancel}),oo(!0)},ts=mt=>{Tt(mt),dn({title:xo.deleteBankAccountTitle,description:xo.deleteBankAccountDescription,primaryButtonText:xo.buttons.delete,secondaryButtonText:xo.buttons.cancel}),oo(!0)},pn=()=>{dn({title:xo.overwriteTitle,description:xo.overwriteDescription,primaryButtonText:xo.buttons.yes,secondaryButtonText:xo.buttons.no}),oo(!0)},_s=()=>{let mt=!0;const Qt=[];return Object.values(e.lineDetailSection).forEach((wt,Kt)=>{wt.type===xo.outOfPocketKey&&LAe(wt)>=75&&wt.file==null&&(Qt.push(wt.lineId),mt=!1)}),Dn(Qt),mt},us=()=>{if(m&&e.remiStage==="pending_approval"&&e.remiStatus!=="rejected")ds();else{Te("save");const mt=tt.getValues(),Qt=P_(mt,e.merchantList.merchants,i,Re,e.currencyConversionStatus,e.allCurrencies,e.accountList.accounts,e.classList.classes,r?.entityAutoCompleteView);U?.(Qt);const wt=Qt.whatForSection?.reportTitle;wt!=null&&wt.length>0?N(e.remiStatus==="rejected"?"pending_approval":"draft"):tt.trigger(`${qA}.reportTitle`,{shouldFocus:!0})}};let js=!1;Object.values(e.addRemiAutoFieldsByLineId).forEach(mt=>{mt.length>0&&(js=!0)});let xn=[];if(e.remiId==null){const mt=Re??0;mt>0&&(xn=e.approvalRules.allApprovalRules?.filter(Qt=>{const wt=Qt.criteria[0].range;if(wt.max!=null){if(wt.min.amount<mt&&wt.max.amount>=mt)return Qt}else if(wt.min.amount<mt)return Qt;return null}).map(Qt=>({...Qt,stepsWithStatus:Qt.steps.map(wt=>({...wt,actorsActivity:[],isOriginalApprovalStep:!0})),isRealTimeApprovalEnabled:!1})))}const As=mt=>{const Qt=_s();return tt.handleSubmit(()=>{Qt&&(Te("submit"),x?.trackReimbursementSubmitReimbursement(e.createTime?.format(Cde.analytics.MMMDashDDDashYYYYFormat)??Q.dateNow().format(Cde.analytics.MMMDashDDDashYYYYFormat),i.currencyCode,Re,h),B(),To(!0))})(mt)},nn=()=>{const mt=tt.getValues(),Qt=P_(mt,e.merchantList.merchants,i,Re,e.currencyConversionStatus,e.allCurrencies,e.accountList.accounts,e.classList.classes,r?.entityAutoCompleteView);U?.(Qt),H()},os=e.reimbursementInfo?.billStatus.code=="approved"&&e.reimbursementInfo?.billPaymentStatus.code?e.reimbursementInfo?.billPaymentStatus:e.reimbursementInfo?.billStatus,qe=e.reimbursementInfo?.paymentDate!=null?Q.zeniDate(Q.getNextNthWorkingDay(e.reimbursementInfo.paymentDate.toDate(),[0,6],e.achSameDayMaxDays).toDateString()):void 0,xt=e.reimbursementInfo?.expectedDepositDate??qe,Wt=h!=null&&e.remiStage==="draft",Ze=AAe(e.duplicateLineByLineId),Mo=e.duplicateReimbursementStatus.fetchState==="Completed"&&Ze>0,{requestToOpenThread:Lo,setRequestToOpenThread:_n,setOpenThread:ns}=g.useContext(vs);g.useEffect(()=>{pe?.threadId!=null&&pe?.companyId!=null&&pe?.entityType!=null&&_n(pe)},[pe,_n]);const{threads:Vt,isLoading:en}=sa({application:"dashboard",companyId:Ee.currentTenant?.companyId,tab:"reimbursement",entityId:h,isGlobalComment:!1},"both",!1);g.useEffect(()=>{Lo?.threadId!=null&&Vt.length>0&&!en&&(ns(Lo.threadId),_n(null))},[Lo,Vt,en,ns,_n]);const $t=g.useMemo(()=>h==null?[]:Vt.filter(mt=>mt.resolved===!1&&!mt.id.includes($s)),[Vt,h]).length,bo=(mt,Qt)=>{ns(Qt);const wt=mt.entityType.split("."),Kt=parseInt(wt[2]);if(isNaN(Kt)){Qe(!1);return}const ks=`${Kt+1}`,_o=e.lineDetailSection[Kt+1].type;wt.includes(xo.mileageKey)&&_o===xo.outOfPocketKey?Y(Q.toReimbursementTypeCode(xo.mileageKey),ks,h):wt.includes(xo.outOfPocketKey)&&_o===xo.mileageKey&&Y(Q.toReimbursementTypeCode(xo.outOfPocketKey),ks,h),Qe(!1)};return t.jsxRuntimeExports.jsx(vdn,{children:t.jsxRuntimeExports.jsx(v0,{sharedItems:{sharedFunctions:void 0,sharedRef:{contentWrapperRef:ye.current??null}},children:t.jsxRuntimeExports.jsxs(t.FormProvider,{...tt,children:[t.jsxRuntimeExports.jsx("form",{id:wde(bde),onSubmit:mt=>As(mt),children:t.jsxRuntimeExports.jsxs(nun,{windowSize:He,ref:ye,children:[ft?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:qt.title}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:qt.description}),primaryButtonText:qt.primaryButtonText,secondaryButtonText:qt.secondaryButtonText,action:Go,proceedButtonVariant:qt.title===xo.deleteBankAccountTitle||qt.title===xo.deleteDraftTitle||qt.title===xo.deleteReportTitle||qt.title===xo.discardTitle?"destructive":"primary",useLegacyStyles:!0,isEditPopup:qt.title===xo.deleteBankAccountTitle}):null,on?t.jsxRuntimeExports.jsx(pdn,{reimbursementId:h,submitFetchState:e.saveStatus?.fetchState??"Not-Started",duplicateReimbursementStatus:e.duplicateReimbursementStatus.fetchState,hasDuplicateLine:Mo,numberOfDuplicateLines:Ze,setShowDuplicatePopup:To,submitReport:nn,fetchDuplicateReimbursement:I,clearDuplicateReimbursementDetail:B,clearRemiSaveStatus:L,analytics:x}):null,Se?t.jsxRuntimeExports.jsx($de,{windowSize:He}):null,We&&je!==!0?t.jsxRuntimeExports.jsxs($de,{windowSize:He,"data-testid":_("skip-autofill-section"),children:[He==="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(zdn,{children:t.jsxRuntimeExports.jsx(oun,{partOfSkipAutoFill:!0,size:He,onClick:()=>nt(!1),"data-testid":_("close-invoice-upload"),children:t.jsxRuntimeExports.jsx(Jdn,{withOverlay:!0,children:t.jsxRuntimeExports.jsx(Kdn,{})})})}),t.jsxRuntimeExports.jsx(Fdn,{children:yn})]}):null,t.jsxRuntimeExports.jsx(rB,{showAutofill:We,analytics:x,onSkipAutofill:()=>{x?.trackReimbursementSkipAutofill(),nt(!1)},uploadInvoiceEndPoint:c,authParams:n,style:{width:na.leftSectionWidth.valuePercentage(He),boxSizing:"border-box",backgroundColor:He==="small"?ve.colors.grey4:"unset",paddingTop:He==="small"?o.sp5:"78px",paddingRight:o.sp3,paddingBottom:He==="small"?o.sp5:"15px",paddingLeft:He==="small"?o.sp3:o.sp5,margin:He==="small"?o.sp0:void 0},onInvoiceUpload:mt=>V(mt,ut,!0),dropFilePlaceholder:{upload:xo.dropReceipt.upload,single:xo.dropReceipt.single,or:xo.dropReceipt.or,multiple:xo.dropReceipt.multiple,receipts:xo.dropReceipt.receipts},updateInvoiceUploadFetchState:ee,showInfoText:!1,allowMultiFiles:We,type:"reimbursement"})]}):null,t.jsxRuntimeExports.jsxs(Zdn,{windowSize:He,"data-testid":_("edit-reimbursement-detail-page-nav-bar-container"),children:[He!=="small"?t.jsxRuntimeExports.jsx(Rt,{style:{width:"42%"},"data-testid":_("edit-reimbursement-detail-page-left-nav-bar"),title:"",leftSideComponent:t.jsxRuntimeExports.jsx(Rde,{"data-testid":_("edit-remi-detail-page-nav-bar-back-icon"),onClick:so}),enableTitleOnScroll:!1,scrollableContent:ge,backgroundColor:ve.colors.grey4,keepBackgroundOnScroll:!0,source:"EditReimbursementDetailPage"}):null,He!=="small"?t.jsxRuntimeExports.jsx(Sdn,{}):null,t.jsxRuntimeExports.jsx(Rt,{style:{width:na.navBarWidth.valuePercentage(He)},"data-testid":_("edit-reimbursement-detail-page-right-nav-bar"),source:"EditReimbursementDetailPage",title:yn,hideSearchBtn:!0,leftSideComponent:He==="small"?t.jsxRuntimeExports.jsx(Rde,{"data-testid":_("edit-remi-detail-page-nav-bar-back-icon-mobile"),onClick:so}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),rightSideComponent:t.jsxRuntimeExports.jsxs(Xdn,{children:[We!=!0&&u&&h!=null&&!Pe?t.jsxRuntimeExports.jsxs(eun,{isDisabled:en,"data-testid":_("remi-comment-button"),onClick:en?()=>null:mt=>{mt.preventDefault(),mt.stopPropagation(),Ne({roomId:Je,companyId:Ee.currentTenant?.companyId??"",companyName:Ee.currentTenant?.companyName??"",entityType:"reimbursement.details",entityId:h}),Qe(!0),x?.trackCommentActivity("reimbursement","clicked",Ee.currentTenant?.companyName??"",Ee.controllersList.controllers.map(Qt=>cn(Qt)),void 0,void 0,"page icon")},children:[t.jsxRuntimeExports.jsx(Br,{count:en?void 0:$t,isLoading:en,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(tun,{})]}):null,t.jsxRuntimeExports.jsx(ms,{dataTestId:"edit-reimbursement-detail-page-ask-ai-cfo-button",isAiCfoAccessEnabled:ce,onAskAiCfoClick:de})]}),enableTitleOnScroll:He!=="small",scrollThreshold:64,scrollableContent:ge,backgroundColor:ve.colors.grey4,keepBackgroundOnScroll:!0})]}),t.jsxRuntimeExports.jsxs(sun,{windowSize:He,ref:ge,children:[He==="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(qdn,{children:yn}),t.jsxRuntimeExports.jsx(NT,{progressSectionObj:os,createDate:e.createTime,paymentDate:xt,scheduleDate:e.reimbursementInfo?.paymentDate,approvedDate:e.latestApprovedDate,isBillUploaded:h!=null?!0:e.uploadStatus==="Completed"}),js&&t.jsxRuntimeExports.jsxs(Wdn,{children:[t.jsxRuntimeExports.jsx(Hdn,{}),t.jsxRuntimeExports.jsx(Vdn,{children:xo.banner})]}),e.isProcessing?t.jsxRuntimeExports.jsx(xd,{variant:"warning",style:{margin:He==="small"?`${o.sp5} ${o.sp3}`:`${o.sp3} ${o.sp5} ${o.sp3} ${o.sp5}`},title:jde.duplicateWarning.title,description:jde.duplicateWarning.description}):Mo?t.jsxRuntimeExports.jsxs(Qdn,{size:He,children:[t.jsxRuntimeExports.jsx(Tdn,{}),t.jsxRuntimeExports.jsxs(Gdn,{children:[t.jsxRuntimeExports.jsx(Udn,{children:xo.thereSeems}),t.jsxRuntimeExports.jsx(Ydn,{children:xo.pleaseFind})]})]}):null,t.jsxRuntimeExports.jsx(TAe,{isReimbursementCommentingEnabled:u,sectionId:qA,reimbursementId:e.remiId,reportTitle:e.whatForSection.reportTitle})]}):null,t.jsxRuntimeExports.jsx(Hcn,{onDuplicateLineClick:D,reimbursementId:h,remiDetails:e,uploadInvoiceEndPoint:c,authParams:n,isAccountingClassesEnabled:d,showSkipAutoFill:We,setShowSkipAutoFill:nt,isReimbursementCommentingEnabled:u,isAutoFieldsExist:js,totalAmount:Re,removeFileFromLine:J,onReplaceClick:pn,onReceiptsUpload:V,currencyConversionStatus:e.currencyConversionStatus,setCurrentLineIdForUpload:pt,setUploadedReceiptPayload:Xe,updateInvoiceUploadFetchState:ee,clearTentativeNameForLine:te,defaultCurrency:i,companyMileageConfigInfo:l,isUserAdmin:m,setShowBankAccountPage:Ht,bankAccounts:b,onDeleteBankAccount:ts,analytics:x,fileRequiredLineIds:kn,isSignedInUserReimbursementCreator:E,uncategorizedAccounts:$,showTotalAmountLoader:Oe,duplicateLineByLineId:e.duplicateLineByLineId,hasDuplicateLine:Mo,removeDuplicateReimbursementForLine:P,scrollContainerRef:ge,customerSearchAutoComplete:r!=null?{customerSearchAutoCompleteData:r,loadOptions:Yn}:void 0}),t.jsxRuntimeExports.jsxs(iun,{showSkipAutoFill:We,windowSize:He,children:[He!=="small"?t.jsxRuntimeExports.jsx(Ede,{}):null,t.jsxRuntimeExports.jsx(run,{windowSize:He,children:t.jsxRuntimeExports.jsxs(aun,{windowSize:He,children:[e.remiId!==void 0&&t.jsxRuntimeExports.jsx(h5,{amount:Re??0,activities:e.remiActivities,stage:e.remiStage??"draft",onAddNewRule:se,entity:"reimbursement",historicActivities:e.remiHistory.activities}),e.remiId==null&&Re!=null&&Re>0?t.jsxRuntimeExports.jsx(h5,{amount:Re??0,activities:xn,stage:"draft",entity:"reimbursement",historicActivities:e.remiHistory.activities}):null]})})]}),t.jsxRuntimeExports.jsx(lun,{}),t.jsxRuntimeExports.jsxs(Ndn,{showSkipAutoFill:We,windowSize:He,children:[He!=="small"?t.jsxRuntimeExports.jsx(Ede,{}):null,t.jsxRuntimeExports.jsx(Adn,{windowSize:He,onClick:mt=>{mt.stopPropagation(),Be===!0&&Ae(!1)},children:t.jsxRuntimeExports.jsx(_t,{formId:wde(bde),separatorStyle:{marginRight:o.sp4},showCancel:E,cancelBtn:{label:m&&e.remiStage==="pending_approval"&&e.remiStatus!=="rejected"?He==="small"?xo.buttons.discard:xo.buttons.discardChanges:He==="small"?xo.buttons.save:xo.buttons.saveChanges,isLoading:_e==="save"&&e.saveStatus?.fetchState==="In-Progress",onClick:us,style:{width:na.footerButtonWidth.value(He)},reverseSpinnerColor:!1},primaryBtn:{label:Rdn(E,m,e,He),isDisabled:!E,style:{width:E?na.footerButtonWidth.value(He):"auto"},type:E?"submit":"button",onClick:E?()=>null:us,isLoading:!E&&_e==="save"&&e.saveStatus?.fetchState==="In-Progress"},rightSideComponent:t.jsxRuntimeExports.jsx(kdn,{children:t.jsxRuntimeExports.jsxs(Mdn,{windowSize:He,children:[Be?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>Ae(!1),children:t.jsxRuntimeExports.jsx(Pdn,{windowSize:He,"data-testid":_("remi-other-actions-container"),children:t.jsxRuntimeExports.jsx(Ddn,{onClick:In,"data-testid":_("delete-report-action"),children:xo.buttons.deleteReport})})}):null,t.jsxRuntimeExports.jsx(Bdn,{windowSize:He,children:Wt===!0?t.jsxRuntimeExports.jsx(Ldn,{windowSize:He,"data-testid":_("more-details-button"),children:t.jsxRuntimeExports.jsx(Idn,{onClick:()=>Ae(!Be)})}):null})]})})})})]})]})]})}),u&&h!=null?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:Je,children:t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:Pe,allowComposer:!0,drawerTitle:fdn,threads:Vt,autoExpand:!0,autoFocus:!1,filter:{application:"dashboard",companyId:Ie?.companyId??ydn,isGlobalComment:!1,tab:"reimbursement"},isLoading:en,threadMetadata:Ie?{companyName:Ie.companyName,companyId:Ie.companyId,entityId:Ie.entityId,entityType:Ie.entityType,isGlobalComment:!1,application:"dashboard",tab:"reimbursement",url:window.location.href}:void 0,textOverrides:{composerPlaceholder:jdn,replyComposerPlaceholder:Cdn,threadResolve:bdn,threadUnResolve:wdn},onThreadClick:(mt,Qt)=>bo(mt,Qt),onCloseAllThreadsDrawer:()=>Qe(!1),drawerSectionStyle:{width:"400px",backgroundColor:ve.colors.background}})}):null,Bt?t.jsxRuntimeExports.jsxs(_dn,{windowSize:He,children:[He!=="small"?t.jsxRuntimeExports.jsx(Rt,{style:{width:"100%"},source:"EditReimbursementDetailPage_BankAccount",title:xo.addBankAccount,leftSideComponent:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),rightSideComponent:null,hideSearchBtn:!0,enableTitleOnScroll:!0,scrollThreshold:64,scrollableContent:he,backgroundColor:ve.colors.grey4,keepBackgroundOnScroll:!0}):null,t.jsxRuntimeExports.jsx(Odn,{ref:he,windowSize:He,children:t.jsxRuntimeExports.jsx(_Ae,{ref:Ce,bankAccountCreationState:y,setShowBankAccountPage:Ht,plaidConnectionDetails:f,onFetchLinkTokenClick:ie,onEstablishConnectionClick:re,onSaveHandler:A,bankAccountToCreate:R,bankNameByRouting:C,fetchBankNameByRoutingStatus:S,onUserBankDetailsUpdated:k,onFetchBankName:T,hideBackIcon:He!=="small",hideTopBar:He!=="small",onBackClick:Gt})})]}):null]})})})},Rdn=(e,n,i,r)=>e?i.reimbursementId!=null&&i.remiStage==="pending_approval"?xo.buttons.resubmit:xo.buttons.submit:n&&i.remiStage==="pending_approval"&&i.remiStatus!=="rejected"?r==="small"?xo.buttons.discard:xo.buttons.discardChanges:r==="small"?xo.buttons.save:xo.buttons.saveChanges,vdn=s.div`
45670
45670
  position: relative;
45671
45671
  `,Sdn=s.div`
45672
45672
  position: fixed;
@@ -45922,7 +45922,7 @@ to {
45922
45922
  `,lun=s.div`
45923
45923
  flex-shrink: 0;
45924
45924
  height: ${o.sp3};
45925
- `,Pn={labelWidth:new w(120,160,160),largeLabelWidth:new w(150,235,235),rightMargin:new w(p[3],p[5]),leftMargin:new w(p[3],p[5]),invoiceRightMargin:new w(p[3],p[3]),invoiceLeftMargin:new w(p[3],p[5]),topMargin:new w(p[3],0),bottomMargin:new w(p[4],27),totalBottomMargin:new w(p[5],p[3]),formBottomMargin:new w(p[5],p[3]),navBarHeight:new w(44,62),closeMarginTop:new w(0,0),closeMarginRight:new w(p[3],p[8]),rightSectionWidth:new w(100,58),leftSectionWidth:new w(100,42),footerButtonWidth:new w(120,165),right:new w(p[3],p[0]),actionsContainerRight:new w(p[0],p[3]),otherActionsContainerBottom:new w(58,44),duplicateBannerWrapperMarginTop:new w(p[5],p[3]),duplicateBannerWrapperMarginRight:new w(p[3],p[5]),duplicateBannerWrapperMarginBottom:new w(p[5],p[3]),duplicateBannerWrapperMarginLeft:new w(p[3],p[5])},cun=({remiDetails:e,uploadInvoiceEndPoint:n,authParams:i,isAccountingClassesEnabled:r,isAdmin:a,signedInUser:l,showApproveRejectBtns:c,isRealTimeApprovalEnabled:d,isReimbursementCommentingEnabled:u,isShowDeletedReimbursementEnabled:m,isSignedInUserReimbursementCreator:x,updateEditRealTimeApproverClicked:h,onSaveRealTimeApprovals:f,redirectToReimbursementListScreen:y,redirectToEditableReimbursementScreen:C,onDuplicateLineClick:b,approveOrRejectRemi:E,deleteReimbursement:$,cancelAndDeleteReport:R,onAddNewRule:S,initialOpenThreadRequest:k,isAiCfoAccessEnabled:T,onAskAiCfoClick:A})=>{const I=ht(),L=ro().analytics,P=X(),D=t.useTheme(),M=k1(D.colors),[F,V]=g.useState(!1),[N,H]=g.useState(!1),[W,U]=g.useState(!1),[Y,q]=g.useState("approved"),Z=g.useRef(null),[G,K]=g.useState({title:"",description:"",primaryButtonText:"",secondaryButtonText:""}),[J,oe]=g.useState(null),[ee,te]=g.useState(!1),se=`dashboard_${I.currentTenant?.companyId}`,ie=g.useRef({}),re=Xe=>{const ft=ie.current[Xe];ft!=null&&setTimeout(()=>RW(ft,Z.current),100)};g.useEffect(()=>{(e.deleteStatus.fetchState==="Completed"||e.approvalUpdateStatus.fetchState==="Completed"||e.cancelAndDeleteStatus.fetchState==="Completed")&&y()},[e,y]),g.useEffect(()=>{const Xe=window.location.hash;if(Xe&&Xe.startsWith("#L")){const ft=Xe.substring(1);re(ft)}},[]),qs({componentName:"reimbursement.details"});const ne={onOkClick:()=>{V(!1),G.primaryButtonText===he.buttons.delete?$?.():G.title===he.cancelReportTitle?R?.():G.title===he.cancelAndDeleteReportTitle&&R?.(!0)},onCancelClick:()=>{V(!1)}},me=Pn.labelWidth.value(P),pe=Pn.largeLabelWidth.value(P),je=O.getLocalizedStrings(),{common:{texts:{comments:ce},strings:{empty:de}},collaboration:{threads:{placeholder:{addANewComment:ue,replyAComment:le},tooltip:{resolveComment:ae,unResolveComment:ge}}},dateFormat:ye}=je,{reimbursementDetail:he,bulkActions:Ce}=je.spendManagement.reimbursement,we=e.remiDetails?.reportTitle,ve=e.remiDetails?.lines??[],Ee=e.remiDetails?.reimbursementInfo.stage,Se=e.remiDetails?.reimbursementInfo.billStatus,$e=e.remiDetails?.reimbursementInfo.billPaymentStatus,Be=Ee?.code==="paid",Ae=Be?Ee:Se?.code=="approved"&&$e?.code?$e:Se,_e=dun(e.remiDetails,M),Te=Se?.code=="approved"&&$e?.code?$e:Se,Re=e.remiDetails?.isDeleted??!1,ke=e.remiDetails?.amount,Oe=e.remiDetails?.amount.amount??0,Me=()=>{K({title:e.remiDetails?.reimbursementInfo.stage.code==="draft"?he.deleteDraftTitle:he.deleteReportTitle,description:he.deleteAlertDescription,primaryButtonText:he.buttons.delete,secondaryButtonText:he.buttons.cancel}),V(!0)},Ie=()=>{K({title:he.cancelReportTitle,description:he.cancelAlertDescription,primaryButtonText:he.buttons.yes,secondaryButtonText:he.buttons.no}),V(!0)},Ne=()=>{K({title:he.cancelAndDeleteReportTitle,description:he.cancelAndDeleteAlertDescription,primaryButtonText:he.buttons.yes,secondaryButtonText:he.buttons.no}),V(!0)},Pe=()=>{C()},Ue={onOkClick:Xe=>{U(!1),E({reimbursementId:e.remiDetails?.id??"",type:"rejected",description:Xe})},onCancelClick:()=>{U(!1)}},Je=()=>{e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"?Pe():(q("approved"),E({reimbursementId:e.remiDetails?.id??"",type:"approved"}))},tt=()=>{e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"?(q("delete"),Me()):(q("rejected"),U(!0))},Qe=e.remiDetails?.reimbursementInfo.paymentDate!=null?Q.zeniDate(Q.getNextNthWorkingDay(e.remiDetails.reimbursementInfo.paymentDate.toDate(),[0,6],e.achSameDayMaxDays).toDateString()):void 0,dt=e.remiDetails?.reimbursementInfo.expectedDepositDate??Qe,ct=e.remiDetails?.lines?.some(Xe=>{const ft=Xe.lineDetail;return ft?.account?.isDeleted===!0&&ft?.account?.isBillEditableCoaAccountType===!1})??!1,yt=e.remiDetails?.reimbursementInfo.billStatus.code==="pending_approval"&&x&&!ct,He=e.remiDetails?.reimbursementInfo.billStatus.code!=="rejected"&&e.remiDetails?.reimbursementInfo.billPaymentStatus.code!=="paid",jt=Ae?.code,St=AAe(e.duplicateLineByLineId),We=e.duplicateReimbursementStatus.fetchState==="Completed"&&St>0,{requestToOpenThread:nt,setRequestToOpenThread:ut,setOpenThread:pt}=g.useContext(vs);g.useEffect(()=>{k?.threadId!=null&&k?.companyId!=null&&k?.entityType!=null&&ut(k)},[k,ut]);const{threads:Bt,isLoading:Ht}=sa({application:"dashboard",companyId:I.currentTenant?.companyId,tab:"reimbursement",entityId:e.remiDetails?.id,isGlobalComment:!1},"both",!1),Tt=g.useMemo(()=>Bt.filter(Xe=>Xe.resolved===!1&&!Xe.id.includes($s)),[Bt]).length,Gt=g.useCallback((Xe,ft)=>{pt(ft),te(!1)},[pt,te]);g.useEffect(()=>{nt?.threadId!=null&&Bt.length>0&&!Ht&&(pt(nt.threadId),ut(null))},[nt,Bt,Ht,pt,ut]);const so={application:"dashboard",companyId:I.currentTenant?.companyId,tab:"reimbursement",entityId:e.remiDetails?.id},no=Q.isBulkProcessing(e.remiDetails?.bulkProcessingDetail?.type);return t.jsxRuntimeExports.jsxs(Oun,{windowSize:P,children:[F?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:G.title}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:G.description}),primaryButtonText:G.primaryButtonText,proceedButtonVariant:"destructive",secondaryButtonText:G.secondaryButtonText,action:ne}):null,W?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:`${he.rejectRemiTitlePrefix} ${e.remiDetails?.reportTitle??""} by ${e.createdBy?.firstName??""} ${e.createdBy?.lastName??""}`}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:he.rejectRemiDescription}),primaryButtonText:he.buttons.send,secondaryButtonText:he.buttons.cancel,action:Ue,useLegacyStyles:!0,isEditPopup:!0,isNotesIncluded:!0,notesPlaceholder:he.rejectRejectReasonPlaceholder}):null,t.jsxRuntimeExports.jsxs(Tun,{windowSize:P,"data-testid":_("reimbursement-detail-page-nav-bar-container"),children:[P!=="small"?t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("reimbursement-detail-page-nav-bar-left"),style:{width:"42%"},title:"",leftSideComponent:t.jsxRuntimeExports.jsx(Lun,{onClick:()=>y(),"data-testid":_("remi-detail-page-nav-bar-back-icon")}),enableTitleOnScroll:!1,backgroundColor:D.colors.background,keepBackgroundOnScroll:!0,scrollableContent:Z,source:"ReimbursementDetailPage"}):null,P!=="small"?t.jsxRuntimeExports.jsx(Aun,{}):null,t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("reimbursement-detail-page-nav-bar-right"),title:we??de,leftSideComponent:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),hideSearchBtn:!0,style:{width:P!=="small"?"58%":"100%"},rightSideComponent:t.jsxRuntimeExports.jsxs(Bun,{children:[u&&!ee?t.jsxRuntimeExports.jsxs(Dun,{isDisabled:Ht,onClick:Ht?()=>null:Xe=>{Xe.preventDefault(),Xe.stopPropagation(),oe({roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityType:"reimbursement.details",entityId:e.remiDetails?.id??""}),te(!0),L.trackCommentActivity("reimbursement","clicked",I.currentTenant?.companyName??"",I.controllersList.controllers.map(ft=>cn(ft)),void 0,void 0,"page icon")},"data-testid":_("remi-comments-section"),children:[t.jsxRuntimeExports.jsx(Br,{count:Ht?void 0:Tt,isLoading:Ht,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(_un,{})]}):null,P==="small"?t.jsxRuntimeExports.jsx(Mun,{"data-testid":_("remi-detail-page-nav-bar-close-icon"),onClick:()=>y(),children:t.jsxRuntimeExports.jsx(Pun,{})}):null,t.jsxRuntimeExports.jsx(ms,{dataTestId:"reimbursement-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:T,onAskAiCfoClick:A})]}),scrollableContent:Z,enableTitleOnScroll:P!=="small",scrollThreshold:64,backgroundColor:D.colors.grey4,keepBackgroundOnScroll:!0,source:"ReimbursementDetailPage"})]}),t.jsxRuntimeExports.jsxs(zun,{windowSize:P,ref:Z,children:[t.jsxRuntimeExports.jsxs(Uun,{children:[P==="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(Pde,{windowSize:P,children:[t.jsxRuntimeExports.jsx(Mde,{children:we}),e.createdBy?.userId!=null?t.jsxRuntimeExports.jsx(Tde,{children:`${he.by} ${e.createdBy.firstName} ${e.createdBy.lastName}`}):null,m&&_e!=null?t.jsxRuntimeExports.jsx(Run,{color:_e.color,bgColor:_e.bgColor,borderColor:_e.borderColor,children:_e.value}):null]}),Te?.code!=null?P==="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(NT,{progressSectionObj:Te,createDate:e.remiDetails?.createTime,paymentDate:dt,scheduleDate:e.remiDetails?.reimbursementInfo.paymentDate,approvedDate:e.latestApprovedDate,isFrozen:Re}),no?t.jsxRuntimeExports.jsx(xd,{variant:"warning",style:{margin:`${o.sp5} ${o.sp3}`},title:Ce.duplicateWarning.title,description:Ce.duplicateWarning.description}):We?t.jsxRuntimeExports.jsxs(vde,{size:P,children:[t.jsxRuntimeExports.jsx(Ide,{}),t.jsxRuntimeExports.jsxs(Ade,{children:[t.jsxRuntimeExports.jsx(Sde,{children:he.thereSeems}),t.jsxRuntimeExports.jsx(kde,{children:he.pleaseFind})]})]}):null]}):t.jsxRuntimeExports.jsx(Bde,{windowSize:P,children:t.jsxRuntimeExports.jsx(g5,{progressSectionObj:Te,createDate:e.remiDetails?.createTime,paymentDate:dt,scheduleDate:e.remiDetails?.reimbursementInfo.paymentDate,approvedDate:e.latestApprovedDate,isFrozen:Re})}):null]}):null,ve.map((Xe,ft)=>{const oo=e.duplicateLineByLineId[Xe.lineId];return t.jsxRuntimeExports.jsxs(Ode,{windowSize:P,children:[t.jsxRuntimeExports.jsx(Wun,{windowSize:P,children:t.jsxRuntimeExports.jsx(Vun,{bottomSeperator:ve.length!==1,windowSize:P,children:t.jsxRuntimeExports.jsx(rB,{showAutofill:!1,uploadInvoiceEndPoint:n,authParams:i,entityId:e.remiDetails?.id,file:Xe.file,showTitlebar:!0,showTitlebarIcon:!1,pdfTitle:ve.length>1?`#${ft+1} Receipt`:"Receipt",style:{width:"auto",padding:0,height:ve.length-1===ft||ft===0?760:451},onInvoiceUpload:()=>{console.log("onInvoiceUpload")},noAttachmentText:he.noReceiptAttached,type:"reimbursement"})})}),t.jsxRuntimeExports.jsxs(Hun,{windowSize:P,children:[ft===0&&P!=="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(Pde,{windowSize:P,children:[t.jsxRuntimeExports.jsx(Mde,{children:we}),e.createdBy?.userId!=null?t.jsxRuntimeExports.jsx(Tde,{children:`By ${e.createdBy.firstName} ${e.createdBy.lastName}`}):null]}),Te?.code!=null?t.jsxRuntimeExports.jsx(Bde,{windowSize:P,children:t.jsxRuntimeExports.jsx(g5,{progressSectionObj:Te,createDate:e.remiDetails?.createTime,paymentDate:dt,scheduleDate:e.remiDetails?.reimbursementInfo.paymentDate,approvedDate:e.latestApprovedDate,isFrozen:Re})}):null,no?t.jsxRuntimeExports.jsx(xd,{variant:"warning",style:{margin:`${o.sp3} ${o.sp5} ${o.sp3} ${o.sp5}`},title:Ce.duplicateWarning.title,description:Ce.duplicateWarning.description}):We?t.jsxRuntimeExports.jsxs(vde,{size:P,children:[t.jsxRuntimeExports.jsx(Ide,{}),t.jsxRuntimeExports.jsxs(Ade,{children:[t.jsxRuntimeExports.jsx(Sde,{children:he.thereSeems}),t.jsxRuntimeExports.jsx(kde,{children:he.pleaseFind})]})]}):null]}):null,t.jsxRuntimeExports.jsxs(gun,{windowSize:P,ref:on=>{on!=null&&(ie.current[`L${Xe.lineId}`]=on)},children:[P!=="small"?t.jsxRuntimeExports.jsx(hun,{children:t.jsxRuntimeExports.jsx(fun,{children:ve.length>1?`#${ft+1} ${he.reimbursement}`:he.reimbursement})}):null,t.jsxRuntimeExports.jsxs(yun,{windowSize:P,children:[oo?.duplicateLineId!=null?t.jsxRuntimeExports.jsxs(mun,{children:[he.thisExpenseReview," ",t.jsxRuntimeExports.jsx(xun,{onClick:()=>{if(oo.isDuplicateWithinTransaction&&oo.duplicateLineId!=null)return re(`L${oo.duplicateLineId}`);oo.duplicateTransactionId!=null&&oo.duplicateLineId!=null&&b(oo.duplicateTransactionId,oo.duplicateLineId)},"data-testid":_("remi-view-duplicate-expense"),children:he.viewOriginalExpense})]}):null,t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:Xe.type===he.mileageKey?`${ft}.mileage.reimbursementType`:`${ft}.out_of_pocket.reimbursementType`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("reimbursementType",ft,Xe.type===he.mileageKey?"mileage":"out_of_pocket")}`},style:{borderRadius:oo?.duplicateLineId==null?`${o.sp2} ${o.sp2} 0 0`:"0 0 0 0"},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.reimbursementType,width:pe},text:Xe.type===he.mileageKey?he.mileage:he.outOfPocket,style:{width:"auto",borderRadius:oo?.duplicateLineId==null?`${o.sp2} ${o.sp2} 0 0`:"0 0 0 0"}})}),Xe.type===he.mileageKey?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.transactionDate`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("transactionDate",ft,"mileage")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.transactionDate,width:pe},text:Xe.transactionDate?.format(ye.visual.MMMDCommaYYYYformat)??he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.distanceInMiles`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("distanceInMiles",ft,"mileage")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.distanceInMiles,width:pe},text:Xe.distanceMileage.value.toString()??he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.amount`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("amount",ft,"mileage")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.amount,width:me},text:Xe.homeCurrencyConversions!=null?Fe("0,0[.]00",Xe.homeCurrencyConversions):he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.memo`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("memo",ft,"mileage")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.memo,width:me},text:Xe.description??he.emptyValue,style:{width:"auto"}})}),r&&t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.class`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("class",ft,"mileage")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.department,width:me},text:Xe.lineDetail.class?.className??he.emptyValue,style:{width:"auto"}})})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.customer`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("customer",ft,"mileage")}`},style:{borderRadius:`0 0 ${o.sp2} ${o.sp2}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.customer,width:me},text:Xe.lineDetail.customer?.name??he.emptyValue,style:{width:"auto",borderRadius:`0 0 ${o.sp2} ${o.sp2}`}})})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.merchant`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("merchant",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.merchant,width:pe},text:Xe.merchant?.name??he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.transactionDate`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("transactionDate",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.transactionDate,width:pe},text:Xe.transactionDate?.format(ye.visual.MMMDCommaYYYYformat)??he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.amount`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("amount",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.amount,width:me},text:Xe.homeCurrencyConversions!=null?Fe("0,0[.]00",Xe.homeCurrencyConversions):he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.memo`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("memo",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.memo,width:me},text:Xe.description??he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.account`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("account",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.category,width:me},text:Xe.lineDetail.account?.accountName??he.emptyValue,style:{width:"auto"}})}),r&&t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.class`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("class",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.department,width:me},text:Xe.lineDetail.class?.className??he.emptyValue,style:{width:"auto"}})})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.customer`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("customer",ft,"out_of_pocket")}`},style:{borderRadius:`0 0 ${o.sp2} ${o.sp2}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.customer,width:me},text:Xe.lineDetail.customer?.name??he.emptyValue,style:{width:"auto",borderRadius:`0 0 ${o.sp2} ${o.sp2}`}})})]})]})]}),ve.length!==1&&ve.length===ft+1&&t.jsxRuntimeExports.jsxs(Nun,{windowSize:P,children:[t.jsxRuntimeExports.jsxs(Dde,{windowSize:P,children:[t.jsxRuntimeExports.jsx(_de,{children:he.total}),t.jsxRuntimeExports.jsx(ls,{amount:ke,integerStyles:z.h6Regular.cssObject,decimalStyles:z.largeRegular.cssObject})]}),e.remiDetails&&t.jsxRuntimeExports.jsx(h5,{amount:Oe,activities:e.remiActivities,stage:Ee?.code??"draft",onAddNewRule:S,entity:"reimbursement",realTimeApproval:{allApprovers:e.filteredApprovers,filteredAttributes:e.filteredAttributes,allAccountingClass:e.allAccountingClasses,isRealTimeApproverEditMode:e.realTimeApproval.isEditMode??!1,realTimeApprovalSaveStatus:{fetchState:e.realTimeApproval.fetchState,error:e.realTimeApproval.error},approvalListFetchState:e.approverListFetchState.fetchState,attributeSubTypeToUserIdMapping:e.attributeSubTypeToUserIdMapping,isAdmin:a,signedInUserId:l?.userId,showRealTimeApproval:d,entityApprovalId:e.remiActivities[0]?.entityApprovalId??e.remiDetails.entityApprovalId,updateEditMode:h,onSaveRealTimeApprovals:f},historicActivities:e.remiHistory.activities})]})]})]},Xe.lineId)}),ve.length===1&&t.jsxRuntimeExports.jsxs(Ode,{windowSize:P,children:[t.jsxRuntimeExports.jsx(Lde,{}),t.jsxRuntimeExports.jsxs(uun,{windowSize:P,children:[t.jsxRuntimeExports.jsx(Fun,{windowSize:P,children:t.jsxRuntimeExports.jsxs(Dde,{windowSize:P,children:[t.jsxRuntimeExports.jsx(_de,{children:he.total}),t.jsxRuntimeExports.jsx(ls,{amount:ke,integerStyles:z.h6Regular.cssObject,decimalStyles:z.largeRegular.cssObject})]})}),e.remiDetails&&t.jsxRuntimeExports.jsx(pun,{windowSize:P,children:t.jsxRuntimeExports.jsx(h5,{amount:Oe,activities:e.remiActivities,stage:Ee?.code??"draft",onAddNewRule:S,entity:"reimbursement",historicActivities:e.remiHistory.activities,realTimeApproval:{allApprovers:e.filteredApprovers,allAccountingClass:e.allAccountingClasses,filteredAttributes:e.filteredAttributes,isRealTimeApproverEditMode:e.realTimeApproval.isEditMode??!1,realTimeApprovalSaveStatus:{fetchState:e.realTimeApproval.fetchState,error:e.realTimeApproval.error},approvalListFetchState:e.approverListFetchState.fetchState,attributeSubTypeToUserIdMapping:e.attributeSubTypeToUserIdMapping,isAdmin:a,signedInUserId:l?.userId,showRealTimeApproval:d,entityApprovalId:e.remiActivities[0]?.entityApprovalId??e.remiDetails.entityApprovalId,updateEditMode:h,onSaveRealTimeApprovals:f}})})]})]}),t.jsxRuntimeExports.jsx(Qun,{})]}),Be||Re===!0?null:t.jsxRuntimeExports.jsxs(Iun,{children:[P!=="small"?t.jsxRuntimeExports.jsx(Lde,{}):null,t.jsxRuntimeExports.jsx(Cun,{windowSize:P,"data-testid":_("remi-detail-page-footer"),onClick:Xe=>{Xe.stopPropagation(),N===!0&&H(!1)},children:t.jsxRuntimeExports.jsx(_t,{separatorStyle:{marginRight:o.sp4},showPrimaryButton:e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"||c,showCancel:e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"||c,cancelBtn:{label:e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"?P==="small"?he.buttons.delete:he.buttons.deleteReport:P==="small"?he.buttons.reject:he.buttons.rejectReport,isLoading:Y==="rejected"&&e.approvalUpdateStatus.fetchState==="In-Progress"||Y==="delete"&&e.deleteStatus.fetchState==="In-Progress",onClick:tt,style:{width:Pn.footerButtonWidth.value(P)},reverseSpinnerColor:!1},primaryBtn:{label:e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"?P==="small"?he.buttons.edit:he.buttons.editAndResubmit:P==="small"?he.buttons.approve:he.buttons.approveReport,isLoading:Y==="approved"&&e.approvalUpdateStatus.fetchState==="In-Progress",onClick:Je,style:{width:Pn.footerButtonWidth.value(P)},isDisabled:e.approvalUpdateStatus.fetchState==="In-Progress"||e.realTimeApproval.isEditMode===!0},rightSideComponent:t.jsxRuntimeExports.jsx(jun,{children:t.jsxRuntimeExports.jsxs(kun,{windowSize:P,children:[!no&&N?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>H(!1),children:t.jsxRuntimeExports.jsxs(Sun,{windowSize:P,children:[jt!=="processing"?t.jsxRuntimeExports.jsx(M_,{onClick:Me,"data-testid":_("remi-delete-action"),children:he.buttons.deleteReport}):null,jt==="processing"?t.jsxRuntimeExports.jsx(M_,{onClick:Ie,"data-testid":_("remi-cancel-action"),children:he.buttons.cancel}):null,jt==="processing"?t.jsxRuntimeExports.jsx(M_,{onClick:Ne,"data-testid":_("remi-cancel-and-delete-action"),children:he.buttons.cancelAndDelete}):null]})}):null,t.jsxRuntimeExports.jsxs(vun,{windowSize:P,children:[!no&&yt?t.jsxRuntimeExports.jsx($un,{onClick:Pe,"data-testid":_("remi-edit-button"),children:t.jsxRuntimeExports.jsx(Eun,{})}):null,!no&&He===!0?t.jsxRuntimeExports.jsx(wun,{windowSize:P,showEditIcon:yt,children:t.jsxRuntimeExports.jsx(bun,{onClick:()=>H(!N),"data-testid":_("remi-more-actions-button")})}):null]})]})})})})]}),u?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:se,children:t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:ee,allowComposer:!0,drawerTitle:ce,threads:Bt,autoExpand:!0,autoFocus:!1,filter:{application:"dashboard",companyId:J?.companyId??de,isGlobalComment:!1,tab:"reimbursement"},isLoading:Ht,threadMetadata:J?{companyName:J.companyName,companyId:J.companyId,entityId:J.entityId,entityType:J.entityType,isGlobalComment:!1,application:"dashboard",tab:"reimbursement",url:window.location.href}:void 0,textOverrides:{composerPlaceholder:ue,replyComposerPlaceholder:le,threadResolve:ae,threadUnResolve:ge},onThreadClick:(Xe,ft)=>Gt(Xe,ft),onCloseAllThreadsDrawer:()=>te(!1),drawerSectionStyle:{width:"400px",backgroundColor:D.colors.background}})}):null]})]})},dun=(e,n)=>{const i=O.getLocalizedStrings().spendManagement.billPay.billsByTabs;if(e?.isDeleted===!0)return{value:i.tabsById.deleted,color:n.deleted.color,bgColor:n.deleted.bgColor,borderColor:n.deleted.borderColor,code:"deleted"}},uun=s.div`
45925
+ `,Pn={labelWidth:new w(120,160,160),largeLabelWidth:new w(150,235,235),rightMargin:new w(p[3],p[5]),leftMargin:new w(p[3],p[5]),invoiceRightMargin:new w(p[3],p[3]),invoiceLeftMargin:new w(p[3],p[5]),topMargin:new w(p[3],0),bottomMargin:new w(p[4],27),totalBottomMargin:new w(p[5],p[3]),formBottomMargin:new w(p[5],p[3]),navBarHeight:new w(44,62),closeMarginTop:new w(0,0),closeMarginRight:new w(p[3],p[8]),rightSectionWidth:new w(100,58),leftSectionWidth:new w(100,42),footerButtonWidth:new w(120,165),right:new w(p[3],p[0]),actionsContainerRight:new w(p[0],p[3]),otherActionsContainerBottom:new w(58,44),duplicateBannerWrapperMarginTop:new w(p[5],p[3]),duplicateBannerWrapperMarginRight:new w(p[3],p[5]),duplicateBannerWrapperMarginBottom:new w(p[5],p[3]),duplicateBannerWrapperMarginLeft:new w(p[3],p[5])},cun=({remiDetails:e,uploadInvoiceEndPoint:n,authParams:i,isAccountingClassesEnabled:r,isAdmin:a,signedInUser:l,showApproveRejectBtns:c,isRealTimeApprovalEnabled:d,isReimbursementCommentingEnabled:u,isShowDeletedReimbursementEnabled:m,isSignedInUserReimbursementCreator:x,updateEditRealTimeApproverClicked:h,onSaveRealTimeApprovals:f,redirectToReimbursementListScreen:y,redirectToEditableReimbursementScreen:C,onDuplicateLineClick:b,approveOrRejectRemi:E,deleteReimbursement:$,cancelAndDeleteReport:R,onAddNewRule:S,initialOpenThreadRequest:k,isAiCfoAccessEnabled:T,onAskAiCfoClick:A})=>{const I=ht(),L=ro().analytics,P=X(),D=t.useTheme(),M=k1(D.colors),[F,V]=g.useState(!1),[N,H]=g.useState(!1),[W,U]=g.useState(!1),[Y,q]=g.useState("approved"),Z=g.useRef(null),[G,K]=g.useState({title:"",description:"",primaryButtonText:"",secondaryButtonText:""}),[J,oe]=g.useState(null),[ee,te]=g.useState(!1),se=`dashboard_${I.currentTenant?.companyId}`,ie=g.useRef({}),re=Xe=>{const ft=ie.current[Xe];ft!=null&&setTimeout(()=>RW(ft,Z.current),100)};g.useEffect(()=>{(e.deleteStatus.fetchState==="Completed"||e.approvalUpdateStatus.fetchState==="Completed"||e.cancelAndDeleteStatus.fetchState==="Completed")&&y()},[e,y]),g.useEffect(()=>{const Xe=window.location.hash;if(Xe&&Xe.startsWith("#L")){const ft=Xe.substring(1);re(ft)}},[]),qs({componentName:"reimbursement.details"});const ne={onOkClick:()=>{V(!1),G.primaryButtonText===he.buttons.delete?$?.():G.title===he.cancelReportTitle?R?.():G.title===he.cancelAndDeleteReportTitle&&R?.(!0)},onCancelClick:()=>{V(!1)}},me=Pn.labelWidth.value(P),pe=Pn.largeLabelWidth.value(P),je=O.getLocalizedStrings(),{common:{texts:{comments:ce},strings:{empty:de}},collaboration:{threads:{placeholder:{addANewComment:ue,replyAComment:le},tooltip:{resolveComment:ae,unResolveComment:ge}}},dateFormat:ye}=je,{reimbursementDetail:he,bulkActions:Ce}=je.spendManagement.reimbursement,we=e.remiDetails?.reportTitle,ve=e.remiDetails?.lines??[],Ee=e.remiDetails?.reimbursementInfo.stage,Se=e.remiDetails?.reimbursementInfo.billStatus,$e=e.remiDetails?.reimbursementInfo.billPaymentStatus,Be=Ee?.code==="paid",Ae=Be?Ee:Se?.code=="approved"&&$e?.code?$e:Se,_e=dun(e.remiDetails,M),Te=Se?.code=="approved"&&$e?.code?$e:Se,Re=e.remiDetails?.isDeleted??!1,ke=e.remiDetails?.amount,Oe=e.remiDetails?.amount.amount??0,Me=()=>{K({title:e.remiDetails?.reimbursementInfo.stage.code==="draft"?he.deleteDraftTitle:he.deleteReportTitle,description:he.deleteAlertDescription,primaryButtonText:he.buttons.delete,secondaryButtonText:he.buttons.cancel}),V(!0)},Ie=()=>{K({title:he.cancelReportTitle,description:he.cancelAlertDescription,primaryButtonText:he.buttons.yes,secondaryButtonText:he.buttons.no}),V(!0)},Ne=()=>{K({title:he.cancelAndDeleteReportTitle,description:he.cancelAndDeleteAlertDescription,primaryButtonText:he.buttons.yes,secondaryButtonText:he.buttons.no}),V(!0)},Pe=()=>{C()},Qe={onOkClick:Xe=>{U(!1),E({reimbursementId:e.remiDetails?.id??"",type:"rejected",description:Xe})},onCancelClick:()=>{U(!1)}},Je=()=>{e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"?Pe():(q("approved"),E({reimbursementId:e.remiDetails?.id??"",type:"approved"}))},tt=()=>{e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"?(q("delete"),Me()):(q("rejected"),U(!0))},Ue=e.remiDetails?.reimbursementInfo.paymentDate!=null?Q.zeniDate(Q.getNextNthWorkingDay(e.remiDetails.reimbursementInfo.paymentDate.toDate(),[0,6],e.achSameDayMaxDays).toDateString()):void 0,dt=e.remiDetails?.reimbursementInfo.expectedDepositDate??Ue,ct=e.remiDetails?.lines?.some(Xe=>{const ft=Xe.lineDetail;return ft?.account?.isDeleted===!0&&ft?.account?.isBillEditableCoaAccountType===!1})??!1,yt=e.remiDetails?.reimbursementInfo.billStatus.code==="pending_approval"&&x&&!ct,He=e.remiDetails?.reimbursementInfo.billStatus.code!=="rejected"&&e.remiDetails?.reimbursementInfo.billPaymentStatus.code!=="paid",jt=Ae?.code,St=AAe(e.duplicateLineByLineId),We=e.duplicateReimbursementStatus.fetchState==="Completed"&&St>0,{requestToOpenThread:nt,setRequestToOpenThread:ut,setOpenThread:pt}=g.useContext(vs);g.useEffect(()=>{k?.threadId!=null&&k?.companyId!=null&&k?.entityType!=null&&ut(k)},[k,ut]);const{threads:Bt,isLoading:Ht}=sa({application:"dashboard",companyId:I.currentTenant?.companyId,tab:"reimbursement",entityId:e.remiDetails?.id,isGlobalComment:!1},"both",!1),Tt=g.useMemo(()=>Bt.filter(Xe=>Xe.resolved===!1&&!Xe.id.includes($s)),[Bt]).length,Gt=g.useCallback((Xe,ft)=>{pt(ft),te(!1)},[pt,te]);g.useEffect(()=>{nt?.threadId!=null&&Bt.length>0&&!Ht&&(pt(nt.threadId),ut(null))},[nt,Bt,Ht,pt,ut]);const so={application:"dashboard",companyId:I.currentTenant?.companyId,tab:"reimbursement",entityId:e.remiDetails?.id},no=Q.isBulkProcessing(e.remiDetails?.bulkProcessingDetail?.type);return t.jsxRuntimeExports.jsxs(Oun,{windowSize:P,children:[F?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:G.title}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:G.description}),primaryButtonText:G.primaryButtonText,proceedButtonVariant:"destructive",secondaryButtonText:G.secondaryButtonText,action:ne}):null,W?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:`${he.rejectRemiTitlePrefix} ${e.remiDetails?.reportTitle??""} by ${e.createdBy?.firstName??""} ${e.createdBy?.lastName??""}`}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:he.rejectRemiDescription}),primaryButtonText:he.buttons.send,secondaryButtonText:he.buttons.cancel,action:Qe,useLegacyStyles:!0,isEditPopup:!0,isNotesIncluded:!0,notesPlaceholder:he.rejectRejectReasonPlaceholder}):null,t.jsxRuntimeExports.jsxs(Tun,{windowSize:P,"data-testid":_("reimbursement-detail-page-nav-bar-container"),children:[P!=="small"?t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("reimbursement-detail-page-nav-bar-left"),style:{width:"42%"},title:"",leftSideComponent:t.jsxRuntimeExports.jsx(Lun,{onClick:()=>y(),"data-testid":_("remi-detail-page-nav-bar-back-icon")}),enableTitleOnScroll:!1,backgroundColor:D.colors.background,keepBackgroundOnScroll:!0,scrollableContent:Z,source:"ReimbursementDetailPage"}):null,P!=="small"?t.jsxRuntimeExports.jsx(Aun,{}):null,t.jsxRuntimeExports.jsx(Rt,{"data-testid":_("reimbursement-detail-page-nav-bar-right"),title:we??de,leftSideComponent:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),hideSearchBtn:!0,style:{width:P!=="small"?"58%":"100%"},rightSideComponent:t.jsxRuntimeExports.jsxs(Bun,{children:[u&&!ee?t.jsxRuntimeExports.jsxs(Dun,{isDisabled:Ht,onClick:Ht?()=>null:Xe=>{Xe.preventDefault(),Xe.stopPropagation(),oe({roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityType:"reimbursement.details",entityId:e.remiDetails?.id??""}),te(!0),L.trackCommentActivity("reimbursement","clicked",I.currentTenant?.companyName??"",I.controllersList.controllers.map(ft=>cn(ft)),void 0,void 0,"page icon")},"data-testid":_("remi-comments-section"),children:[t.jsxRuntimeExports.jsx(Br,{count:Ht?void 0:Tt,isLoading:Ht,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(_un,{})]}):null,P==="small"?t.jsxRuntimeExports.jsx(Mun,{"data-testid":_("remi-detail-page-nav-bar-close-icon"),onClick:()=>y(),children:t.jsxRuntimeExports.jsx(Pun,{})}):null,t.jsxRuntimeExports.jsx(ms,{dataTestId:"reimbursement-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:T,onAskAiCfoClick:A})]}),scrollableContent:Z,enableTitleOnScroll:P!=="small",scrollThreshold:64,backgroundColor:D.colors.grey4,keepBackgroundOnScroll:!0,source:"ReimbursementDetailPage"})]}),t.jsxRuntimeExports.jsxs(zun,{windowSize:P,ref:Z,children:[t.jsxRuntimeExports.jsxs(Uun,{children:[P==="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(Pde,{windowSize:P,children:[t.jsxRuntimeExports.jsx(Mde,{children:we}),e.createdBy?.userId!=null?t.jsxRuntimeExports.jsx(Tde,{children:`${he.by} ${e.createdBy.firstName} ${e.createdBy.lastName}`}):null,m&&_e!=null?t.jsxRuntimeExports.jsx(Run,{color:_e.color,bgColor:_e.bgColor,borderColor:_e.borderColor,children:_e.value}):null]}),Te?.code!=null?P==="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(NT,{progressSectionObj:Te,createDate:e.remiDetails?.createTime,paymentDate:dt,scheduleDate:e.remiDetails?.reimbursementInfo.paymentDate,approvedDate:e.latestApprovedDate,isFrozen:Re}),no?t.jsxRuntimeExports.jsx(xd,{variant:"warning",style:{margin:`${o.sp5} ${o.sp3}`},title:Ce.duplicateWarning.title,description:Ce.duplicateWarning.description}):We?t.jsxRuntimeExports.jsxs(vde,{size:P,children:[t.jsxRuntimeExports.jsx(Ide,{}),t.jsxRuntimeExports.jsxs(Ade,{children:[t.jsxRuntimeExports.jsx(Sde,{children:he.thereSeems}),t.jsxRuntimeExports.jsx(kde,{children:he.pleaseFind})]})]}):null]}):t.jsxRuntimeExports.jsx(Bde,{windowSize:P,children:t.jsxRuntimeExports.jsx(g5,{progressSectionObj:Te,createDate:e.remiDetails?.createTime,paymentDate:dt,scheduleDate:e.remiDetails?.reimbursementInfo.paymentDate,approvedDate:e.latestApprovedDate,isFrozen:Re})}):null]}):null,ve.map((Xe,ft)=>{const oo=e.duplicateLineByLineId[Xe.lineId];return t.jsxRuntimeExports.jsxs(Ode,{windowSize:P,children:[t.jsxRuntimeExports.jsx(Wun,{windowSize:P,children:t.jsxRuntimeExports.jsx(Vun,{bottomSeperator:ve.length!==1,windowSize:P,children:t.jsxRuntimeExports.jsx(rB,{showAutofill:!1,uploadInvoiceEndPoint:n,authParams:i,entityId:e.remiDetails?.id,file:Xe.file,showTitlebar:!0,showTitlebarIcon:!1,pdfTitle:ve.length>1?`#${ft+1} Receipt`:"Receipt",style:{width:"auto",padding:0,height:ve.length-1===ft||ft===0?760:451},onInvoiceUpload:()=>{console.log("onInvoiceUpload")},noAttachmentText:he.noReceiptAttached,type:"reimbursement"})})}),t.jsxRuntimeExports.jsxs(Hun,{windowSize:P,children:[ft===0&&P!=="small"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(Pde,{windowSize:P,children:[t.jsxRuntimeExports.jsx(Mde,{children:we}),e.createdBy?.userId!=null?t.jsxRuntimeExports.jsx(Tde,{children:`By ${e.createdBy.firstName} ${e.createdBy.lastName}`}):null]}),Te?.code!=null?t.jsxRuntimeExports.jsx(Bde,{windowSize:P,children:t.jsxRuntimeExports.jsx(g5,{progressSectionObj:Te,createDate:e.remiDetails?.createTime,paymentDate:dt,scheduleDate:e.remiDetails?.reimbursementInfo.paymentDate,approvedDate:e.latestApprovedDate,isFrozen:Re})}):null,no?t.jsxRuntimeExports.jsx(xd,{variant:"warning",style:{margin:`${o.sp3} ${o.sp5} ${o.sp3} ${o.sp5}`},title:Ce.duplicateWarning.title,description:Ce.duplicateWarning.description}):We?t.jsxRuntimeExports.jsxs(vde,{size:P,children:[t.jsxRuntimeExports.jsx(Ide,{}),t.jsxRuntimeExports.jsxs(Ade,{children:[t.jsxRuntimeExports.jsx(Sde,{children:he.thereSeems}),t.jsxRuntimeExports.jsx(kde,{children:he.pleaseFind})]})]}):null]}):null,t.jsxRuntimeExports.jsxs(gun,{windowSize:P,ref:on=>{on!=null&&(ie.current[`L${Xe.lineId}`]=on)},children:[P!=="small"?t.jsxRuntimeExports.jsx(hun,{children:t.jsxRuntimeExports.jsx(fun,{children:ve.length>1?`#${ft+1} ${he.reimbursement}`:he.reimbursement})}):null,t.jsxRuntimeExports.jsxs(yun,{windowSize:P,children:[oo?.duplicateLineId!=null?t.jsxRuntimeExports.jsxs(mun,{children:[he.thisExpenseReview," ",t.jsxRuntimeExports.jsx(xun,{onClick:()=>{if(oo.isDuplicateWithinTransaction&&oo.duplicateLineId!=null)return re(`L${oo.duplicateLineId}`);oo.duplicateTransactionId!=null&&oo.duplicateLineId!=null&&b(oo.duplicateTransactionId,oo.duplicateLineId)},"data-testid":_("remi-view-duplicate-expense"),children:he.viewOriginalExpense})]}):null,t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:Xe.type===he.mileageKey?`${ft}.mileage.reimbursementType`:`${ft}.out_of_pocket.reimbursementType`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("reimbursementType",ft,Xe.type===he.mileageKey?"mileage":"out_of_pocket")}`},style:{borderRadius:oo?.duplicateLineId==null?`${o.sp2} ${o.sp2} 0 0`:"0 0 0 0"},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.reimbursementType,width:pe},text:Xe.type===he.mileageKey?he.mileage:he.outOfPocket,style:{width:"auto",borderRadius:oo?.duplicateLineId==null?`${o.sp2} ${o.sp2} 0 0`:"0 0 0 0"}})}),Xe.type===he.mileageKey?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.transactionDate`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("transactionDate",ft,"mileage")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.transactionDate,width:pe},text:Xe.transactionDate?.format(ye.visual.MMMDCommaYYYYformat)??he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.distanceInMiles`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("distanceInMiles",ft,"mileage")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.distanceInMiles,width:pe},text:Xe.distanceMileage.value.toString()??he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.amount`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("amount",ft,"mileage")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.amount,width:me},text:Xe.homeCurrencyConversions!=null?Fe("0,0[.]00",Xe.homeCurrencyConversions):he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.memo`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("memo",ft,"mileage")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.memo,width:me},text:Xe.description??he.emptyValue,style:{width:"auto"}})}),r&&t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.class`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("class",ft,"mileage")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.department,width:me},text:Xe.lineDetail.class?.className??he.emptyValue,style:{width:"auto"}})})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.mileage.customer`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("customer",ft,"mileage")}`},style:{borderRadius:`0 0 ${o.sp2} ${o.sp2}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.customer,width:me},text:Xe.lineDetail.customer?.name??he.emptyValue,style:{width:"auto",borderRadius:`0 0 ${o.sp2} ${o.sp2}`}})})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.merchant`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("merchant",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.merchant,width:pe},text:Xe.merchant?.name??he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.transactionDate`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("transactionDate",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.transactionDate,width:pe},text:Xe.transactionDate?.format(ye.visual.MMMDCommaYYYYformat)??he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.amount`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("amount",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.amount,width:me},text:Xe.homeCurrencyConversions!=null?Fe("0,0[.]00",Xe.homeCurrencyConversions):he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.memo`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("memo",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.memo,width:me},text:Xe.description??he.emptyValue,style:{width:"auto"}})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.account`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("account",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.category,width:me},text:Xe.lineDetail.account?.accountName??he.emptyValue,style:{width:"auto"}})}),r&&t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.class`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("class",ft,"out_of_pocket")}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.department,width:me},text:Xe.lineDetail.class?.className??he.emptyValue,style:{width:"auto"}})})}),t.jsxRuntimeExports.jsx(Ut,{isThreadAllowed:u,dashboardTabKey:Yt({type:"details",key:`${ft}.out_of_pocket.customer`}),roomId:se,companyId:I.currentTenant?.companyId??"",companyName:I.currentTenant?.companyName??"",entityId:e.remiDetails?.id??"",dashboardOptionType:"reimbursement",filterMetaData:{...so,entityType:`reimbursement.details.${zs("customer",ft,"out_of_pocket")}`},style:{borderRadius:`0 0 ${o.sp2} ${o.sp2}`},children:t.jsxRuntimeExports.jsx(Nn,{label:{label:he.customer,width:me},text:Xe.lineDetail.customer?.name??he.emptyValue,style:{width:"auto",borderRadius:`0 0 ${o.sp2} ${o.sp2}`}})})]})]})]}),ve.length!==1&&ve.length===ft+1&&t.jsxRuntimeExports.jsxs(Nun,{windowSize:P,children:[t.jsxRuntimeExports.jsxs(Dde,{windowSize:P,children:[t.jsxRuntimeExports.jsx(_de,{children:he.total}),t.jsxRuntimeExports.jsx(ls,{amount:ke,integerStyles:z.h6Regular.cssObject,decimalStyles:z.largeRegular.cssObject})]}),e.remiDetails&&t.jsxRuntimeExports.jsx(h5,{amount:Oe,activities:e.remiActivities,stage:Ee?.code??"draft",onAddNewRule:S,entity:"reimbursement",realTimeApproval:{allApprovers:e.filteredApprovers,filteredAttributes:e.filteredAttributes,allAccountingClass:e.allAccountingClasses,isRealTimeApproverEditMode:e.realTimeApproval.isEditMode??!1,realTimeApprovalSaveStatus:{fetchState:e.realTimeApproval.fetchState,error:e.realTimeApproval.error},approvalListFetchState:e.approverListFetchState.fetchState,attributeSubTypeToUserIdMapping:e.attributeSubTypeToUserIdMapping,isAdmin:a,signedInUserId:l?.userId,showRealTimeApproval:d,entityApprovalId:e.remiActivities[0]?.entityApprovalId??e.remiDetails.entityApprovalId,updateEditMode:h,onSaveRealTimeApprovals:f},historicActivities:e.remiHistory.activities})]})]})]},Xe.lineId)}),ve.length===1&&t.jsxRuntimeExports.jsxs(Ode,{windowSize:P,children:[t.jsxRuntimeExports.jsx(Lde,{}),t.jsxRuntimeExports.jsxs(uun,{windowSize:P,children:[t.jsxRuntimeExports.jsx(Fun,{windowSize:P,children:t.jsxRuntimeExports.jsxs(Dde,{windowSize:P,children:[t.jsxRuntimeExports.jsx(_de,{children:he.total}),t.jsxRuntimeExports.jsx(ls,{amount:ke,integerStyles:z.h6Regular.cssObject,decimalStyles:z.largeRegular.cssObject})]})}),e.remiDetails&&t.jsxRuntimeExports.jsx(pun,{windowSize:P,children:t.jsxRuntimeExports.jsx(h5,{amount:Oe,activities:e.remiActivities,stage:Ee?.code??"draft",onAddNewRule:S,entity:"reimbursement",historicActivities:e.remiHistory.activities,realTimeApproval:{allApprovers:e.filteredApprovers,allAccountingClass:e.allAccountingClasses,filteredAttributes:e.filteredAttributes,isRealTimeApproverEditMode:e.realTimeApproval.isEditMode??!1,realTimeApprovalSaveStatus:{fetchState:e.realTimeApproval.fetchState,error:e.realTimeApproval.error},approvalListFetchState:e.approverListFetchState.fetchState,attributeSubTypeToUserIdMapping:e.attributeSubTypeToUserIdMapping,isAdmin:a,signedInUserId:l?.userId,showRealTimeApproval:d,entityApprovalId:e.remiActivities[0]?.entityApprovalId??e.remiDetails.entityApprovalId,updateEditMode:h,onSaveRealTimeApprovals:f}})})]})]}),t.jsxRuntimeExports.jsx(Qun,{})]}),Be||Re===!0?null:t.jsxRuntimeExports.jsxs(Iun,{children:[P!=="small"?t.jsxRuntimeExports.jsx(Lde,{}):null,t.jsxRuntimeExports.jsx(Cun,{windowSize:P,"data-testid":_("remi-detail-page-footer"),onClick:Xe=>{Xe.stopPropagation(),N===!0&&H(!1)},children:t.jsxRuntimeExports.jsx(_t,{separatorStyle:{marginRight:o.sp4},showPrimaryButton:e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"||c,showCancel:e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"||c,cancelBtn:{label:e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"?P==="small"?he.buttons.delete:he.buttons.deleteReport:P==="small"?he.buttons.reject:he.buttons.rejectReport,isLoading:Y==="rejected"&&e.approvalUpdateStatus.fetchState==="In-Progress"||Y==="delete"&&e.deleteStatus.fetchState==="In-Progress",onClick:tt,style:{width:Pn.footerButtonWidth.value(P)},reverseSpinnerColor:!1},primaryBtn:{label:e.remiDetails?.reimbursementInfo.billStatus.code==="rejected"?P==="small"?he.buttons.edit:he.buttons.editAndResubmit:P==="small"?he.buttons.approve:he.buttons.approveReport,isLoading:Y==="approved"&&e.approvalUpdateStatus.fetchState==="In-Progress",onClick:Je,style:{width:Pn.footerButtonWidth.value(P)},isDisabled:e.approvalUpdateStatus.fetchState==="In-Progress"||e.realTimeApproval.isEditMode===!0},rightSideComponent:t.jsxRuntimeExports.jsx(jun,{children:t.jsxRuntimeExports.jsxs(kun,{windowSize:P,children:[!no&&N?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>H(!1),children:t.jsxRuntimeExports.jsxs(Sun,{windowSize:P,children:[jt!=="processing"?t.jsxRuntimeExports.jsx(M_,{onClick:Me,"data-testid":_("remi-delete-action"),children:he.buttons.deleteReport}):null,jt==="processing"?t.jsxRuntimeExports.jsx(M_,{onClick:Ie,"data-testid":_("remi-cancel-action"),children:he.buttons.cancel}):null,jt==="processing"?t.jsxRuntimeExports.jsx(M_,{onClick:Ne,"data-testid":_("remi-cancel-and-delete-action"),children:he.buttons.cancelAndDelete}):null]})}):null,t.jsxRuntimeExports.jsxs(vun,{windowSize:P,children:[!no&&yt?t.jsxRuntimeExports.jsx($un,{onClick:Pe,"data-testid":_("remi-edit-button"),children:t.jsxRuntimeExports.jsx(Eun,{})}):null,!no&&He===!0?t.jsxRuntimeExports.jsx(wun,{windowSize:P,showEditIcon:yt,children:t.jsxRuntimeExports.jsx(bun,{onClick:()=>H(!N),"data-testid":_("remi-more-actions-button")})}):null]})]})})})})]}),u?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:se,children:t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:ee,allowComposer:!0,drawerTitle:ce,threads:Bt,autoExpand:!0,autoFocus:!1,filter:{application:"dashboard",companyId:J?.companyId??de,isGlobalComment:!1,tab:"reimbursement"},isLoading:Ht,threadMetadata:J?{companyName:J.companyName,companyId:J.companyId,entityId:J.entityId,entityType:J.entityType,isGlobalComment:!1,application:"dashboard",tab:"reimbursement",url:window.location.href}:void 0,textOverrides:{composerPlaceholder:ue,replyComposerPlaceholder:le,threadResolve:ae,threadUnResolve:ge},onThreadClick:(Xe,ft)=>Gt(Xe,ft),onCloseAllThreadsDrawer:()=>te(!1),drawerSectionStyle:{width:"400px",backgroundColor:D.colors.background}})}):null]})]})},dun=(e,n)=>{const i=O.getLocalizedStrings().spendManagement.billPay.billsByTabs;if(e?.isDeleted===!0)return{value:i.tabsById.deleted,color:n.deleted.color,bgColor:n.deleted.bgColor,borderColor:n.deleted.borderColor,code:"deleted"}},uun=s.div`
45926
45926
  display: flex;
45927
45927
  flex-direction: column;
45928
45928
  width: ${e=>Pn.rightSectionWidth.valuePercentage(e.windowSize)};
@@ -47899,7 +47899,7 @@ to {
47899
47899
  padding-left: 26px;
47900
47900
  `,b2n=s(De)`
47901
47901
  color: ${v.important};
47902
- `,uke=O.getLocalizedStrings(),dc=uke.spendManagement,{common:{texts:{comments:w2n}},collaboration:{threads:{placeholder:{addANewComment:E2n,replyAComment:$2n},tooltip:{resolveComment:R2n,unResolveComment:v2n}}}}=uke,S2n={drawerSectionPaddingLeftRight:new w(p[4],p[5])},Nv=e=>e.trim().toLowerCase().replaceAll(/[^a-z0-9]/g,""),A2n=(e,n)=>{const i=Nv(n);if(i!==""){if(i==="all")return"all";if(i==="awaitingmyapproval")return e==="bill_pay"?"awaiting_my_approval":"awaitingMyApproval";if(i==="awaitingallapproval"||i==="awaitingapproval")return e==="bill_pay"?"awaiting_approval":"awaitingAllApproval";if(i==="overdue"&&e==="bill_pay")return"overdue";if(i==="rejected")return"rejected";if(i==="deleted")return"deleted"}},k2n=({threadData:e,collaborationTab:n,isThreadsOpen:i,setIsThreadsOpen:r,handleThreadClick:a,windowSize:l,backgroundColor:c})=>{const d=ht(),u=g.useMemo(()=>({application:"dashboard",companyId:d.currentTenant?.companyId,tab:n,entityId:e?.entityId,isGlobalComment:!1}),[d.currentTenant?.companyId,n,e?.entityId]),{threads:m,isLoading:x}=O9({filter:u});return t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:i,allowComposer:!1,drawerTitle:w2n,threads:m,autoExpand:!0,autoFocus:!1,filter:{application:"dashboard",companyId:d.currentTenant?.companyId,isGlobalComment:!1,tab:n},isLoading:x,textOverrides:{composerPlaceholder:E2n,replyComposerPlaceholder:$2n,threadResolve:R2n,threadUnResolve:v2n},onThreadClick:(h,f)=>a(h,f),onCloseAllThreadsDrawer:()=>r(!1),drawerSectionStyle:{width:l==="small"?"100%":"400px",boxSizing:l==="small"?"border-box":"content-box",padding:`${o.sp0} ${S2n.drawerSectionPaddingLeftRight.valuePx(l)}`,backgroundColor:c},collapsibleThreadStyle:{width:l==="small"?"100%":"360px"}})},I2n=e=>{const n=t.useTheme(),i=ht(),r=X(),{transactionList:a,allSubTabs:l,isAdmin:c,botEmail:d,currentTab:u,currentSubTab:m,approvalCount:x,fetchState:h,analytics:f,entity:y,uiState:C,searchText:b,filters:E,vendorSearchAutoCompleteData:$,vendorSearchAutoCompleteActions:R,createdByUserList:S,createdByUserListFetchState:k,downloadParams:T,downloadState:A,isDownloadEnabled:I,isShowDeletedBillsEnabled:B,isShowDeletedReimbursementEnabled:L,billPayApprovalRulesAffectedEntityIds:P,remiApprovalRulesAffectedEntityIds:D,isBillPayCommentingEnabled:M,isReimbursementCommentingEnabled:F,isDetectInsufficientFundsEnabled:V=!1,updateTabToState:N,onSubtabChange:H,onReloadTransactions:W,onTransactionClick:U,onClickSetupIcon:Y,onBackClick:q,onAddTransactionClick:Z,onColumnSortConfigChanged:G,onSearchTextChanged:K,onClickMenuIcon:J,isAiCfoAccessEnabled:oe,onAskAiCfoClick:ee,onFiltersChange:te,updateDownloadStateHandler:se,bulkSubmissionLimit:ie=10,isBulkActionAllowed:re=!1,isRecurringBillInBulkActionList:ne=!1,transactionsSelectedForBulkAction:me=[],allowedBulkActions:pe=[],bulkSubmissionFetchState:je,updateBulkActionList:ce,removeAllTransactionsFromBulkActionList:de,onProceedForBulkActionClick:ue}=e,le=["draft","pending_approval","scheduled","paid"],ae=ct=>{U(ct,u)},ye=t.jsxRuntimeExports.jsx(Hgn,{botEmail:d,transactionList:a,allSubTabs:l,isAdmin:c,selectedTab:u,selectedSubTab:m,fetchState:h,onSubtabChange:H,onTransactionRowClick:ae,onReloadTransactions:W,onColumnSortConfigChanged:G,analytics:f,entity:y,uiState:C,searchText:b,isShowDeletedBillsEnabled:B,isShowDeletedReimbursementEnabled:L,billPayApprovalRulesAffectedEntityIds:P,remiApprovalRulesAffectedEntityIds:D,isBillPayCommentingEnabled:M,isReimbursementCommentingEnabled:F,bulkSubmissionLimit:ie,isBulkActionAllowed:re,isRecurringBillInBulkActionList:ne,transactionsSelectedForBulkAction:me,isDetectInsufficientFundsEnabled:V,allowedBulkActions:pe,bulkSubmissionFetchState:je,updateBulkActionList:ce,removeAllTransactionsFromBulkActionList:de,onProceedForBulkActionClick:ue}),he=ct=>{N(ct),H("all")},Ce=g.useRef({querySignature:"",subTabSelectionAttempted:!1,tabSelectionAttempted:!1});g.useEffect(()=>{if(globalThis.window===void 0)return;const ct=(new URLSearchParams(globalThis.window.location.search).get("selectedTab")??"").trim(),yt=(new URLSearchParams(globalThis.window.location.search).get("selectedSubTab")??"").trim(),He=`${Nv(ct)}|${Nv(yt)}|${y}`;if(Ce.current.querySignature!==He&&(Ce.current={querySignature:He,subTabSelectionAttempted:!1,tabSelectionAttempted:!1}),Nv(ct)!=="approvals")return;const jt="pending_approval",St=A2n(y,yt)??(y==="bill_pay"?"awaiting_my_approval":"awaitingMyApproval");if(u!==jt){Ce.current.tabSelectionAttempted===!1&&(Ce.current.tabSelectionAttempted=!0,N(jt));return}m!==St&&Ce.current.subTabSelectionAttempted===!1&&(Ce.current.subTabSelectionAttempted=!0,H(St))},[m,u,y,H,N]);const we=le.map(ct=>({id:ct,label:SW(ct,y),countDetails:ct==="pending_approval"&&x>0?{count:x,isFetching:!1}:void 0})),ve=l.map(ct=>({id:ct,label:SW(ct,y)})),[Ee,Se]=g.useState(!1),[$e,Be]=g.useState(!1),Ae=ct=>{Se(ct)},_e=y==="bill_pay"?Q.hasBillPayAdminLevelAccess(i.loggedInUserRoleMap):Q.hasReimbursementAdminLevelAccess(i.loggedInUserRoleMap),Te={entity:y,showNewButtonOnNavbar:!0,showEntityEmailInfoIconOnNavbar:!0,newButtonLabel:"New",isSearchOpen:Ee,searchPlaceHolder:y==="bill_pay"?dc.billPay.billsByTabs.searchPlaceHolder:dc.reimbursement.reimbursementByTabs.searchPlaceHolder,searchText:b,showSettingsIconOnNavbar:_e,showStatementButtonOnNavbar:!1,showDownloadButtonOnNavbar:!0,disableDownloadButton:I===!1,downloadParams:T,downloadState:A,filters:E,vendorSearchAutoCompleteData:$,vendorSearchAutoCompleteActions:R,createdByUserListLoaded:y==="bill_pay"||Q.hideCreatedByFilter(i.loggedInUserRole??[])?!0:k==="Completed"||k==="Error",analytics:f,onNewButtonClick:Z,onSearchOpen:Ae,onSearchTextChanged:K,onClickSetupIcon:Y,onClickEmailInfoIcon:()=>Be(!0),onFiltersChange:te,getFilterOptions:y==="bill_pay"||y==="reimbursement"?()=>AY(y,S??[],i.loggedInUserRole??[],[]):void 0,updateDownloadStateHandler:se},Re=t.jsxRuntimeExports.jsxs(ii,{children:[t.jsxRuntimeExports.jsx(lB,{spendManagementSectionProps:Te}),t.jsxRuntimeExports.jsx(ms,{isAiCfoAccessEnabled:oe,onAskAiCfoClick:ee})]}),[ke,Oe]=g.useState(null),[Me,Ie]=g.useState(!1),{setRequestToOpenThread:Ne}=g.useContext(vs),Pe=`dashboard_${i.currentTenant?.companyId}`,Ue=y==="bill_pay"?"bill":"reimbursement",Je=y==="bill_pay"&&M||y==="reimbursement"&&F,Qe={openAllThreadsDrawer:ct=>{Oe({...ct}),Ie(!0)}},dt=(ct,yt)=>{const{companyId:He,entityId:jt,entityType:St}=ct;Ie(!1),Ne({threadId:yt,companyId:He,entityType:St}),U(jt,u)};return t.jsxRuntimeExports.jsx(v0,{sharedItems:{sharedFunctions:{subtreeFunctions:Qe},sharedRef:void 0},children:t.jsxRuntimeExports.jsxs(L2n,{children:[t.jsxRuntimeExports.jsx(Rt,{source:"SpendManagementListViewPage",title:y==="bill_pay"?dc.billPay.billsByTabs.pageTitle:dc.reimbursement.reimbursementByTabs.pageTitle,showBorderBottom:!1,showBackButton:!1,showMenuIcon:r==="medium-compact"||r==="small",backgroundColor:n.colors.grey4,style:{zIndex:3,...z.extraLargeSemiBold.cssObject},onBackClick:q,rightSideComponent:Re,onClickMenuIcon:J,isSearchOpen:Ee}),t.jsxRuntimeExports.jsxs(B2n,{children:[t.jsxRuntimeExports.jsx(UAe,{tabs:we,selectedTab:u,subTabs:ve,selectedSubTab:m,tabStyle:{paddingLeft:di.valuePx(r)},subTabStyle:{paddingLeft:di.valuePx(r),paddingTop:o.sp3,paddingBottom:o.sp3},onTabChange:ct=>he(ct),onSubTabChange:ct=>H(ct)}),t.jsxRuntimeExports.jsx(P2n,{windowSize:r,children:ye})]}),$e?t.jsxRuntimeExports.jsx(Nhn,{botEmail:d,onCancelClick:()=>Be(!1),title:y==="bill_pay"?dc.billPay.billsByTabs.emailInfoTitle:dc.reimbursement.reimbursementByTabs.emailInfoTitle,descriptionLines:y==="bill_pay"?[{icon:t.jsxRuntimeExports.jsx(yee,{width:o.sp4,height:o.sp4}),text:dc.billPay.billsByTabs.emailInfoDescription1},{icon:t.jsxRuntimeExports.jsx(D9,{width:o.sp4,height:o.sp4}),text:dc.billPay.billsByTabs.emailInfoDescription2},{icon:t.jsxRuntimeExports.jsx(t9,{width:o.sp4,height:o.sp4}),text:dc.billPay.billsByTabs.emailInfoDescription3}]:[{icon:t.jsxRuntimeExports.jsx(yee,{width:o.sp4,height:o.sp4}),text:dc.reimbursement.reimbursementByTabs.emailInfoDescription1},{icon:t.jsxRuntimeExports.jsx(T0,{width:o.sp4,height:o.sp4}),text:dc.reimbursement.reimbursementByTabs.emailInfoDescription2},{icon:t.jsxRuntimeExports.jsx(t9,{width:o.sp4,height:o.sp4}),text:dc.reimbursement.reimbursementByTabs.emailInfoDescription3}]}):null,Je?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:Pe,children:t.jsxRuntimeExports.jsx(k2n,{threadData:ke,collaborationTab:Ue,isThreadsOpen:Me,setIsThreadsOpen:Ie,handleThreadClick:dt,windowSize:r,backgroundColor:n.colors.background})}):null]})})},T2n=e=>e.base64!==void 0?`${gu}${e.base64}`:e.url!==void 0?e.url.toString():"",AY=(e,n,i,r,a)=>{const l=dc.filters.filterOptions;return e==="bill_pay"?Q.BILL_PAY_FILTER_CATEGORIES.reduce((d,u)=>{switch(u.value){case"amount":return{...d,[u.value]:l.billAmountOptions};case"paymentMethod":return{...d,[u.value]:l.paymentMethodOptions};case"status":return{...d,[u.value]:[...l.commonStatusOptions,...l.billStatusOptions]};case"paymentType":return{...d,[u.value]:l.billPaymentTypeOptions};default:return{...d,[u.value]:[]}}},{}):e==="reimbursement"?(Q.hideCreatedByFilter(i)?Q.REIMBURSEMENT_FILTER_CATEGORIES_RESTRICTED:Q.REIMBURSEMENT_FILTER_CATEGORIES).reduce((d,u)=>{switch(u.value){case"createdBy":{if(n?.length===0)return{...d,[u.value]:[]};const m=n.map(x=>({label:x?.firstName||x?.lastName?`${x?.firstName} ${x?.lastName}`:x?.email??"",value:x.userId,photo:x?.photo,email:x?.email}));return{...d,[u.value]:m}}case"paymentMethod":return{...d,[u.value]:l.paymentMethodOptions};case"status":return{...d,[u.value]:l.commonStatusOptions};case"amount":return{...d,[u.value]:l.reimbursementAmountOptions};default:return{...d,[u.value]:[]}}},{}):e==="charge_card_payment_history"?(Q.PAYMENT_HISTORY_FILTER_CATEGORIES??[]).reduce((d,u)=>{switch(u.value){case"status":return{...d,[u.value]:l.paymentHistoryStatusOptions};case"initiatedBy":{if(n?.length===0)return{...d,[u.value]:[]};const m=n.map(x=>({label:x?.firstName||x?.lastName?`${x?.firstName} ${x?.lastName}`:x?.email??"",value:x.userId,photo:x?.photo,email:x?.email}));return{...d,[u.value]:[{label:"Autopay",value:"autopay"},...m]}}case"sourceAccount":{const m=a?Object.entries(a).map(([x,h])=>{const f=tke(h.depositAccountName,h.depositAccountLast4,dc.chargeCard.paymentHistory.sourceAccountUnknown),y=Chn(h,T2n),C=y.iconType!=null&&y.iconColor!=null,b=y.photo,E=b!=null&&b!=="";return{label:f,value:x,...C&&{iconType:y.iconType,iconColor:y.iconColor},...E&&{photo:Q.toZeniUrl(b)}}}):[];return{...d,[u.value]:m}}case"repaymentDate":return{...d,[u.value]:[]};default:return{...d,[u.value]:[]}}},{}):Q.TASK_LIST_FILTER_CATEGORIES.reduce((d,u)=>{switch(u.value){case"assignee":{if(n?.length===0)return{...d,[u.value]:[]};const m=n.map(x=>({label:x?.firstName||x?.lastName?`${x?.firstName} ${x?.lastName}`:x?.email??"",value:x.userId,photo:x?.photo,email:x?.email}));return{...d,[u.value]:m}}case"status":return{...d,[u.value]:[...Q.allTaskStatus.map(m=>({label:m.name,value:m.code}))]};case"priority":return{...d,[u.value]:[...Q.allTaskPriority.map(m=>({label:m.name,value:m.code}))]};case"tag":return{...d,[u.value]:[...r.map(m=>({label:m.name,value:m.tagId}))]};default:return{...d,[u.value]:[]}}},{})},L2n=s.div`
47902
+ `,uke=O.getLocalizedStrings(),dc=uke.spendManagement,{common:{texts:{comments:w2n}},collaboration:{threads:{placeholder:{addANewComment:E2n,replyAComment:$2n},tooltip:{resolveComment:R2n,unResolveComment:v2n}}}}=uke,S2n={drawerSectionPaddingLeftRight:new w(p[4],p[5])},Nv=e=>e.trim().toLowerCase().replaceAll(/[^a-z0-9]/g,""),A2n=(e,n)=>{const i=Nv(n);if(i!==""){if(i==="all")return"all";if(i==="awaitingmyapproval")return e==="bill_pay"?"awaiting_my_approval":"awaitingMyApproval";if(i==="awaitingallapproval"||i==="awaitingapproval")return e==="bill_pay"?"awaiting_approval":"awaitingAllApproval";if(i==="overdue"&&e==="bill_pay")return"overdue";if(i==="rejected")return"rejected";if(i==="deleted")return"deleted"}},k2n=({threadData:e,collaborationTab:n,isThreadsOpen:i,setIsThreadsOpen:r,handleThreadClick:a,windowSize:l,backgroundColor:c})=>{const d=ht(),u=g.useMemo(()=>({application:"dashboard",companyId:d.currentTenant?.companyId,tab:n,entityId:e?.entityId,isGlobalComment:!1}),[d.currentTenant?.companyId,n,e?.entityId]),{threads:m,isLoading:x}=O9({filter:u});return t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:i,allowComposer:!1,drawerTitle:w2n,threads:m,autoExpand:!0,autoFocus:!1,filter:{application:"dashboard",companyId:d.currentTenant?.companyId,isGlobalComment:!1,tab:n},isLoading:x,textOverrides:{composerPlaceholder:E2n,replyComposerPlaceholder:$2n,threadResolve:R2n,threadUnResolve:v2n},onThreadClick:(h,f)=>a(h,f),onCloseAllThreadsDrawer:()=>r(!1),drawerSectionStyle:{width:l==="small"?"100%":"400px",boxSizing:l==="small"?"border-box":"content-box",padding:`${o.sp0} ${S2n.drawerSectionPaddingLeftRight.valuePx(l)}`,backgroundColor:c},collapsibleThreadStyle:{width:l==="small"?"100%":"360px"}})},I2n=e=>{const n=t.useTheme(),i=ht(),r=X(),{transactionList:a,allSubTabs:l,isAdmin:c,botEmail:d,currentTab:u,currentSubTab:m,approvalCount:x,fetchState:h,analytics:f,entity:y,uiState:C,searchText:b,filters:E,vendorSearchAutoCompleteData:$,vendorSearchAutoCompleteActions:R,createdByUserList:S,createdByUserListFetchState:k,downloadParams:T,downloadState:A,isDownloadEnabled:I,isShowDeletedBillsEnabled:B,isShowDeletedReimbursementEnabled:L,billPayApprovalRulesAffectedEntityIds:P,remiApprovalRulesAffectedEntityIds:D,isBillPayCommentingEnabled:M,isReimbursementCommentingEnabled:F,isDetectInsufficientFundsEnabled:V=!1,updateTabToState:N,onSubtabChange:H,onReloadTransactions:W,onTransactionClick:U,onClickSetupIcon:Y,onBackClick:q,onAddTransactionClick:Z,onColumnSortConfigChanged:G,onSearchTextChanged:K,onClickMenuIcon:J,isAiCfoAccessEnabled:oe,onAskAiCfoClick:ee,onFiltersChange:te,updateDownloadStateHandler:se,bulkSubmissionLimit:ie=10,isBulkActionAllowed:re=!1,isRecurringBillInBulkActionList:ne=!1,transactionsSelectedForBulkAction:me=[],allowedBulkActions:pe=[],bulkSubmissionFetchState:je,updateBulkActionList:ce,removeAllTransactionsFromBulkActionList:de,onProceedForBulkActionClick:ue}=e,le=["draft","pending_approval","scheduled","paid"],ae=ct=>{U(ct,u)},ye=t.jsxRuntimeExports.jsx(Hgn,{botEmail:d,transactionList:a,allSubTabs:l,isAdmin:c,selectedTab:u,selectedSubTab:m,fetchState:h,onSubtabChange:H,onTransactionRowClick:ae,onReloadTransactions:W,onColumnSortConfigChanged:G,analytics:f,entity:y,uiState:C,searchText:b,isShowDeletedBillsEnabled:B,isShowDeletedReimbursementEnabled:L,billPayApprovalRulesAffectedEntityIds:P,remiApprovalRulesAffectedEntityIds:D,isBillPayCommentingEnabled:M,isReimbursementCommentingEnabled:F,bulkSubmissionLimit:ie,isBulkActionAllowed:re,isRecurringBillInBulkActionList:ne,transactionsSelectedForBulkAction:me,isDetectInsufficientFundsEnabled:V,allowedBulkActions:pe,bulkSubmissionFetchState:je,updateBulkActionList:ce,removeAllTransactionsFromBulkActionList:de,onProceedForBulkActionClick:ue}),he=ct=>{N(ct),H("all")},Ce=g.useRef({querySignature:"",subTabSelectionAttempted:!1,tabSelectionAttempted:!1});g.useEffect(()=>{if(globalThis.window===void 0)return;const ct=(new URLSearchParams(globalThis.window.location.search).get("selectedTab")??"").trim(),yt=(new URLSearchParams(globalThis.window.location.search).get("selectedSubTab")??"").trim(),He=`${Nv(ct)}|${Nv(yt)}|${y}`;if(Ce.current.querySignature!==He&&(Ce.current={querySignature:He,subTabSelectionAttempted:!1,tabSelectionAttempted:!1}),Nv(ct)!=="approvals")return;const jt="pending_approval",St=A2n(y,yt)??(y==="bill_pay"?"awaiting_my_approval":"awaitingMyApproval");if(u!==jt){Ce.current.tabSelectionAttempted===!1&&(Ce.current.tabSelectionAttempted=!0,N(jt));return}m!==St&&Ce.current.subTabSelectionAttempted===!1&&(Ce.current.subTabSelectionAttempted=!0,H(St))},[m,u,y,H,N]);const we=le.map(ct=>({id:ct,label:SW(ct,y),countDetails:ct==="pending_approval"&&x>0?{count:x,isFetching:!1}:void 0})),ve=l.map(ct=>({id:ct,label:SW(ct,y)})),[Ee,Se]=g.useState(!1),[$e,Be]=g.useState(!1),Ae=ct=>{Se(ct)},_e=y==="bill_pay"?Q.hasBillPayAdminLevelAccess(i.loggedInUserRoleMap):Q.hasReimbursementAdminLevelAccess(i.loggedInUserRoleMap),Te={entity:y,showNewButtonOnNavbar:!0,showEntityEmailInfoIconOnNavbar:!0,newButtonLabel:"New",isSearchOpen:Ee,searchPlaceHolder:y==="bill_pay"?dc.billPay.billsByTabs.searchPlaceHolder:dc.reimbursement.reimbursementByTabs.searchPlaceHolder,searchText:b,showSettingsIconOnNavbar:_e,showStatementButtonOnNavbar:!1,showDownloadButtonOnNavbar:!0,disableDownloadButton:I===!1,downloadParams:T,downloadState:A,filters:E,vendorSearchAutoCompleteData:$,vendorSearchAutoCompleteActions:R,createdByUserListLoaded:y==="bill_pay"||Q.hideCreatedByFilter(i.loggedInUserRole??[])?!0:k==="Completed"||k==="Error",analytics:f,onNewButtonClick:Z,onSearchOpen:Ae,onSearchTextChanged:K,onClickSetupIcon:Y,onClickEmailInfoIcon:()=>Be(!0),onFiltersChange:te,getFilterOptions:y==="bill_pay"||y==="reimbursement"?()=>AY(y,S??[],i.loggedInUserRole??[],[]):void 0,updateDownloadStateHandler:se},Re=t.jsxRuntimeExports.jsxs(ii,{children:[t.jsxRuntimeExports.jsx(lB,{spendManagementSectionProps:Te}),t.jsxRuntimeExports.jsx(ms,{isAiCfoAccessEnabled:oe,onAskAiCfoClick:ee})]}),[ke,Oe]=g.useState(null),[Me,Ie]=g.useState(!1),{setRequestToOpenThread:Ne}=g.useContext(vs),Pe=`dashboard_${i.currentTenant?.companyId}`,Qe=y==="bill_pay"?"bill":"reimbursement",Je=y==="bill_pay"&&M||y==="reimbursement"&&F,Ue={openAllThreadsDrawer:ct=>{Oe({...ct}),Ie(!0)}},dt=(ct,yt)=>{const{companyId:He,entityId:jt,entityType:St}=ct;Ie(!1),Ne({threadId:yt,companyId:He,entityType:St}),U(jt,u)};return t.jsxRuntimeExports.jsx(v0,{sharedItems:{sharedFunctions:{subtreeFunctions:Ue},sharedRef:void 0},children:t.jsxRuntimeExports.jsxs(L2n,{children:[t.jsxRuntimeExports.jsx(Rt,{source:"SpendManagementListViewPage",title:y==="bill_pay"?dc.billPay.billsByTabs.pageTitle:dc.reimbursement.reimbursementByTabs.pageTitle,showBorderBottom:!1,showBackButton:!1,showMenuIcon:r==="medium-compact"||r==="small",backgroundColor:n.colors.grey4,style:{zIndex:3,...z.extraLargeSemiBold.cssObject},onBackClick:q,rightSideComponent:Re,onClickMenuIcon:J,isSearchOpen:Ee}),t.jsxRuntimeExports.jsxs(B2n,{children:[t.jsxRuntimeExports.jsx(UAe,{tabs:we,selectedTab:u,subTabs:ve,selectedSubTab:m,tabStyle:{paddingLeft:di.valuePx(r)},subTabStyle:{paddingLeft:di.valuePx(r),paddingTop:o.sp3,paddingBottom:o.sp3},onTabChange:ct=>he(ct),onSubTabChange:ct=>H(ct)}),t.jsxRuntimeExports.jsx(P2n,{windowSize:r,children:ye})]}),$e?t.jsxRuntimeExports.jsx(Nhn,{botEmail:d,onCancelClick:()=>Be(!1),title:y==="bill_pay"?dc.billPay.billsByTabs.emailInfoTitle:dc.reimbursement.reimbursementByTabs.emailInfoTitle,descriptionLines:y==="bill_pay"?[{icon:t.jsxRuntimeExports.jsx(yee,{width:o.sp4,height:o.sp4}),text:dc.billPay.billsByTabs.emailInfoDescription1},{icon:t.jsxRuntimeExports.jsx(D9,{width:o.sp4,height:o.sp4}),text:dc.billPay.billsByTabs.emailInfoDescription2},{icon:t.jsxRuntimeExports.jsx(t9,{width:o.sp4,height:o.sp4}),text:dc.billPay.billsByTabs.emailInfoDescription3}]:[{icon:t.jsxRuntimeExports.jsx(yee,{width:o.sp4,height:o.sp4}),text:dc.reimbursement.reimbursementByTabs.emailInfoDescription1},{icon:t.jsxRuntimeExports.jsx(T0,{width:o.sp4,height:o.sp4}),text:dc.reimbursement.reimbursementByTabs.emailInfoDescription2},{icon:t.jsxRuntimeExports.jsx(t9,{width:o.sp4,height:o.sp4}),text:dc.reimbursement.reimbursementByTabs.emailInfoDescription3}]}):null,Je?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:Pe,children:t.jsxRuntimeExports.jsx(k2n,{threadData:ke,collaborationTab:Qe,isThreadsOpen:Me,setIsThreadsOpen:Ie,handleThreadClick:dt,windowSize:r,backgroundColor:n.colors.background})}):null]})})},T2n=e=>e.base64!==void 0?`${gu}${e.base64}`:e.url!==void 0?e.url.toString():"",AY=(e,n,i,r,a)=>{const l=dc.filters.filterOptions;return e==="bill_pay"?Q.BILL_PAY_FILTER_CATEGORIES.reduce((d,u)=>{switch(u.value){case"amount":return{...d,[u.value]:l.billAmountOptions};case"paymentMethod":return{...d,[u.value]:l.paymentMethodOptions};case"status":return{...d,[u.value]:[...l.commonStatusOptions,...l.billStatusOptions]};case"paymentType":return{...d,[u.value]:l.billPaymentTypeOptions};default:return{...d,[u.value]:[]}}},{}):e==="reimbursement"?(Q.hideCreatedByFilter(i)?Q.REIMBURSEMENT_FILTER_CATEGORIES_RESTRICTED:Q.REIMBURSEMENT_FILTER_CATEGORIES).reduce((d,u)=>{switch(u.value){case"createdBy":{if(n?.length===0)return{...d,[u.value]:[]};const m=n.map(x=>({label:x?.firstName||x?.lastName?`${x?.firstName} ${x?.lastName}`:x?.email??"",value:x.userId,photo:x?.photo,email:x?.email}));return{...d,[u.value]:m}}case"paymentMethod":return{...d,[u.value]:l.paymentMethodOptions};case"status":return{...d,[u.value]:l.commonStatusOptions};case"amount":return{...d,[u.value]:l.reimbursementAmountOptions};default:return{...d,[u.value]:[]}}},{}):e==="charge_card_payment_history"?(Q.PAYMENT_HISTORY_FILTER_CATEGORIES??[]).reduce((d,u)=>{switch(u.value){case"status":return{...d,[u.value]:l.paymentHistoryStatusOptions};case"initiatedBy":{if(n?.length===0)return{...d,[u.value]:[]};const m=n.map(x=>({label:x?.firstName||x?.lastName?`${x?.firstName} ${x?.lastName}`:x?.email??"",value:x.userId,photo:x?.photo,email:x?.email}));return{...d,[u.value]:[{label:"Autopay",value:"autopay"},...m]}}case"sourceAccount":{const m=a?Object.entries(a).map(([x,h])=>{const f=tke(h.depositAccountName,h.depositAccountLast4,dc.chargeCard.paymentHistory.sourceAccountUnknown),y=Chn(h,T2n),C=y.iconType!=null&&y.iconColor!=null,b=y.photo,E=b!=null&&b!=="";return{label:f,value:x,...C&&{iconType:y.iconType,iconColor:y.iconColor},...E&&{photo:Q.toZeniUrl(b)}}}):[];return{...d,[u.value]:m}}case"repaymentDate":return{...d,[u.value]:[]};default:return{...d,[u.value]:[]}}},{}):Q.TASK_LIST_FILTER_CATEGORIES.reduce((d,u)=>{switch(u.value){case"assignee":{if(n?.length===0)return{...d,[u.value]:[]};const m=n.map(x=>({label:x?.firstName||x?.lastName?`${x?.firstName} ${x?.lastName}`:x?.email??"",value:x.userId,photo:x?.photo,email:x?.email}));return{...d,[u.value]:m}}case"status":return{...d,[u.value]:[...Q.allTaskStatus.map(m=>({label:m.name,value:m.code}))]};case"priority":return{...d,[u.value]:[...Q.allTaskPriority.map(m=>({label:m.name,value:m.code}))]};case"tag":return{...d,[u.value]:[...r.map(m=>({label:m.name,value:m.tagId}))]};default:return{...d,[u.value]:[]}}},{})},L2n=s.div`
47903
47903
  display: flex;
47904
47904
  min-height: 100%;
47905
47905
  flex-direction: column;
@@ -52067,7 +52067,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
52067
52067
  display: flex;
52068
52068
  `,Awn=s.input`
52069
52069
  display: none;
52070
- `,kwn=({isValid:e,sectionId:n="onboardingQboConnection",...i})=>{const{register:r}=t.useFormContext();return t.jsxRuntimeExports.jsxs(Swn,{children:[t.jsxRuntimeExports.jsx(Awn,{type:"hidden",...r(`${n}.connected`,{validate:a=>a==="true"}),value:e?"true":"false"}),t.jsxRuntimeExports.jsx(lwn,{isValid:e,...i})]})},Sh="companyDetails",yl="companyOfficer",d3="onboardingPaymentAccountSetupSection",cxe="customerOnboardingDetailPage",vi="onboardingSubscriptionBillingAddress",cb="onboardingQboConnection",dIe={topNavBarHeight:new w(52,52,63),topNavBarLeftRightSpace:new w(p[5],p[9],112),topNavBarHeaderLeftRightPadding:new w(p[4],p[0]),navBarTitleMarginLeft:new w(p[3],p[4]),subTitlePaddingTop:new w(p[3],p[3]),subTitlePaddingBottom:new w(p[3],p[3]),termsPaddingLeftRight:new w(p[0],p[3])},Iwn=e=>`${e}_form`,mj=O.getLocalizedStrings(),Twn=({fileProps:e,isRefreshingViewInBackground:n,isAdmin:i,onboardingCustomerView:r,companyTitles:a,connectedAccountProvider:l,analytics:c,cardPaymentView:d,stripeKey:u,googleAPIKey:m,handleCreateCardSetupIntent:x,handleConfirmCardSetupIntent:h,updateCardPaymentModalState:f,handleAddCardPaymentSource:y,resetCardPaymentViewState:C,handleResetCardPaymentErrorStatuses:b,redirectToProductSuitePage:E,onFormErrorsChange:$,...R})=>{const S=X(),k=g.useRef(null),T=g.useRef(null),A=g.useRef(null),I=g.useRef(null),[B,L]=g.useState(!1),[P,D]=g.useState("next"),[M,F]=g.useState(!1),[V,N]=g.useState(!1),[H,W]=g.useState(null),{onAddressClick:U,onCompanyDetailsChanged:Y,onCompanyOfficerUpdated:q,onFetchLinkTokenClick:Z,onUpdatePaymentAccountStatus:G,onUpdatePaymentAccountLoginStatus:K,onEstablishConnectionClick:J,onEstablishConnectionSuccess:oe,onDeleteFile:ee,onEditFileName:te,updateFilesEntity:se,onGetOtp:ie,onSkipSetupClick:re,onUpdateCustomerView:ne,updateStepHandler:me,onVerifyOtp:pe,onResendOtp:je,handleOnConnectClick:ce,updateQBOPopupState:de,onUpdateStep:ue,onAddressEditHandler:le}=R,ae=t.useTheme(),ge=t.useForm({mode:"onSubmit",reValidateMode:"onChange",defaultValues:kO(r,r.allNationalityCountries),values:kO(r,r.allNationalityCountries),shouldFocusError:!0,resetOptions:{keepDirtyValues:!0}}),ye=g.useCallback(()=>{const qe=[];return(ge.getFieldState(d3).error!=null||ge.getFieldState(vi).error!=null)&&qe.push("link_payment_account"),ge.getFieldState(cb).error!=null&&qe.push("qbo_connection"),qe},[ge]);g.useEffect(()=>{const qe=ye();$?.(qe)},[ye,$]),g.useEffect(()=>{const qe=ge.watch((xt,{name:Wt,type:Ze})=>{Wt!=null&&(Ze==="change"||Ze==="blur")&&t.defer(()=>{const Mo=ye();$?.(Mo)})});return()=>qe.unsubscribe()},[ge,ye,$]);const he=qe=>{tt(qe)},{companyView:Ce,companyDetailsLocalData:we,companyOfficerLocalData:ve,currentStep:Ee,completedSteps:Se,saveStatus:$e,allSteps:Be,allRequiredStepsCompleted:Ae,paymentAccount:_e,paymentAccountStatus:Te,externalConnections:Re,plaidConnectionDetails:ke,uiState:Oe,allNationalityCountries:Me,pendingSaveDetails:{companyDetails:Ie,officer:Ne},subscriptionBillingAddress:Pe}=r,Ue=g.useRef(""),Je=qe=>{Ue.current=qe;const xt=Object.values(r.companyOfficerLocalData).findIndex(Ze=>Ze?.isSelectedForVerification===!0)??0,Wt=xt<0?0:xt;ge.clearErrors(`${yl}.${Wt}.phone`)},tt=qe=>{qe!=null&&!t.isValidPhoneNumber(qe)?ge.trigger(`${yl}.${Qe}.phone`):ie(qe)},Qe=Object.values(ve).findIndex(qe=>qe?.isSelectedForVerification===!0)??0,dt=`Officer_${Qe<0?1:Qe+1}`,ct=Ce?.companyOfficers.slice(0,10).sort((qe,xt)=>qe.user.createTime?.isAfter(xt.user.createTime)===!0?1:-1),yt=ve[dt]?.userId!=null?ct?.find(qe=>qe.user.userId===ve[dt]?.userId)?.address:null,He=ve[dt]?.addressStatus?.addressToCreate,jt=Ce?.companyAddress,St=we?.addressStatus?.addressToCreate,We=Ce?.registeredAddress,nt=we?.registeredAddressStatus?.addressToCreate,{customerOnboardingPage:ut,common:pt}=mj,{footer:Bt,steps:Ht}=ut,{buttons:$o}=Bt,Tt=Ht[Ee],Gt=Be.length,so=Ye($e.fetchState),no=Ye(Ee);function Xe(){return Re?.accounting[0]?.isValid??!1}const ft=()=>{const qe=Object.values(ke).some(Lo=>Lo.fetchStatus.fetchState==="Completed"),xt=_e?.providerVerificationStatus?.code?.includes("verified")??!1,Wt=d.cardsList.length>0,Mo=d.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1;return qe&&xt||!xt&&!_e&&Wt||!Wt&&!_e&&Mo};function oo(){if(ge.getFieldState(vi).error)return!1;const xt=ge.getValues(vi),Wt=Pe?.street.join("").trim(),Ze=Pe?.city,Mo=Pe?.state,Lo=Pe?.country,_n=Pe?.postalCode!=null&&Pe.postalCode||xt.postalCode||pt.strings.empty;return!!Wt&&!!Ze&&!!Mo&&!!Lo&&!!_n}const on=Ye(_e?.providerVerificationStatus?.code),To=()=>{const qe=we,xt=[];return qe?.companyLegalName!=null&&xt.push("legal_name"),qe?.companyDescription!=null&&qe?.companyDescription!==pt.strings.empty&&xt.push("company_description"),qe?.addressStatus?.addressToCreate!=null&&xt.push("company_address"),qe?.registeredAddressStatus?.addressToCreate!=null&&xt.push("registered_address"),qe?.website!=null&&xt.push("website"),qe?.companyIndustry!=null&&qe?.companyIndustry!==pt.strings.empty&&xt.push("industry"),qe?.typeOfIncorporation!=null&&qe?.typeOfIncorporation!==pt.strings.empty&&xt.push("type_of_incorporation"),qe?.incDate!=null&&xt.push("inc_date"),qe?.phone!=null&&xt.push("phone"),qe?.primaryContactLocalData?.firstName!=null&&qe?.primaryContactLocalData?.lastName!=null&&xt.push("primary_contact_name"),qe?.primaryContactLocalData?.email!=null&&xt.push("primary_contact_email"),qe?.taxIdOrEIN!=null&&xt.push("tax_id_or_ein"),qe?.companyFiles.find(Wt=>Wt.documentType==="certificate_of_incorporation")!=null&&xt.push("certificate_of_incorporation"),qe?.companyFiles.find(Wt=>Wt.documentType==="tax_ein")!=null&&xt.push("ein"),{completedFields:xt,status:xt.length===14?"complete":xt.length>0?"partially_complete":"incomplete"}},kn=()=>{const qe=ve[dt],xt=[];return qe?.firstName!=null&&qe.firstName!==pt.strings.empty&&xt.push("first_name"),qe?.lastName!=null&&qe.lastName!==pt.strings.empty&&xt.push("last_name"),qe?.birthday!=null&&xt.push("dob"),qe?.nationalityCountryCode!=null&&xt.push("nationality"),qe?.addressStatus?.addressToCreate!=null&&xt.push("address"),qe?.phone!=null&&qe.phone!==pt.strings.empty&&qe.isPhoneVerified===!0&&xt.push("phone"),qe?.titleAtCompany!=null&&qe.titleAtCompany!==pt.strings.empty&&xt.push("company_role"),qe?.ownershipInCompany!=null&&xt.push("ownership"),qe?.ssn!=null&&qe.ssn!==pt.strings.empty&&xt.push("ssn"),qe?.documentTypeSelectedForVerification!=null&&xt.push("document_type"),qe?.fileIds!=null&&qe.fileIds.length>0&&xt.push("document_uploaded"),{completedFields:xt,status:xt.length===11?"complete":xt.length>0?"partially_complete":"incomplete"}};g.useEffect(()=>{on==="pending_manual_verification"&&_e?.providerVerificationStatus?.code==="manually_verified"&&c.trackOnboardingBankAccountVerified("manual")},[c,_e?.providerVerificationStatus?.code,on]);const Dn=async(qe,xt)=>{if(qe.includes(Sh))Y?.(xt[Sh]);else if(qe.includes(yl))q?.(xt[yl]);else if(qe.includes(vi)&&xt[vi]!=null){const Wt=ge.getValues(`${vi}`).country;let Ze=xt[vi];if(qe.includes(`${vi}.street`)&&xt[vi].street!=null){const{addressValue:Mo}=xt[vi].street,Lo=cl(Mo?.country);Ze={street:xt[vi].street??pt.strings.empty,city:Mo?.locality??pt.strings.empty,state:Mo?.administrativeAreaLevel1??pt.strings.empty,country:Lo,countryCode:Mo?.countryCode??pt.strings.empty,postalCode:Mo?.postalCode??pt.strings.empty,secondaryInfo:xt[vi].secondaryInfo,suite:xt[vi].suite},Wt.selectedOption!==Lo.selectedOption&&(Ze={...Ze,country:Lo})}else qe===`${vi}.country`&&Wt.selectedOption!=null?Ze={...Ze,countryCode:hd(Wt.selectedOption)}:Wt.selectedOption!=null&&qe.includes(`${vi}.street`)===!1&&(Ze={...Ze,countryCode:hd(Wt.selectedOption)});le(Ze)}};g.useEffect(()=>{const qe=ge.watch((xt,{name:Wt})=>{Wt!=null&&xt!=null&&t.defer(()=>Dn(Wt,xt))});return()=>{qe.unsubscribe()}}),g.useEffect(()=>{so==="In-Progress"&&$e.fetchState==="Completed"&&(ge.reset(kO(r,Me),{keepDirtyValues:!1}),no==="company_details"&&Ee==="link_payment_account"&&!Be.includes("qbo_connection")&&!r.qboConnected&&E())},[ge,r,so,$e.fetchState,Me,no,Ee,Be,E]),g.useEffect(()=>{B&&so==="In-Progress"&&$e.fetchState==="Completed"&&(re(),c.track(io.Event.onboardingSkipAndSave))},[so,B,$e.fetchState,re]),g.useEffect(()=>{H?.shouldNavigate===!0&&so==="In-Progress"&&$e.fetchState==="Completed"&&(W(null),me(H.fromStep,H.stepDirection,!0))},[H,so,$e.fetchState,me]),g.useLayoutEffect(()=>{no!=null&&no!==Ee&&(Be.indexOf(no)===Be.indexOf(Ee)-1||Be.indexOf(no)===Gt-1&&Be.indexOf(Ee)===0?P!=="next"&&D("next"):(Be.indexOf(no)-1===Be.indexOf(Ee)||Be.indexOf(no)===0&&Be.indexOf(Ee)===Gt-1)&&P!=="previous"&&D("previous"))},[Be,Ee,no,P,Gt]);const qt=()=>{const qe=ve[dt];return!!qe?.firstName||!!qe?.lastName||!!qe?.email||!!qe?.nationalityCountryCode||!!qe?.birthday||!!qe?.ownershipInCompany||!!qe?.phone||!!qe?.ssn||!!qe?.titleAtCompany||!!qe?.addressStatus?.addressToCreate||qe?.fileIds!=null&&qe?.fileIds.length>0},dn=!t.isEqual(He!=null?Q.getFormattedAddress(He):null,yt!=null?Q.getFormattedAddress(yt):null),Zs=!t.isEqual(St!=null?Q.getFormattedAddress(St):null,jt!=null?Q.getFormattedAddress(jt):null),Yn=!t.isEqual(nt!=null?Q.getFormattedAddress(nt):null,We!=null?Q.getFormattedAddress(We):null),Hs=ge.getFieldState(Sh).isDirty||Zs||Yn||Ie,yn=ge.getFieldState(yl).isDirty&&qt()||dn||Ne,Go=ge.getFieldState(`${vi}`).isDirty,ds=we?.primaryContactLocalData,In=()=>{me(Ee,"previous",!0)},ts=()=>{const qe=ge.getValues(vi),xt={street:qe.street.addressString,suite:qe.suite,city:qe.city,state:qe.state,postalCode:qe.postalCode,country:qe.country.selectedOption??pt.strings.empty,secondaryInfo:qe.secondaryInfo};c.trackOnboardingBillingAddressSave(xt)},pn=()=>{switch(N(!1),Ee){case"link_payment_account":Go?setTimeout(()=>{const qe=ye();$?.(qe),oo()&&Go?(ts(),ne(dt,!1,!0),W({fromStep:Ee,shouldNavigate:!0,stepDirection:"next"})):me(Ee,"next",!0)},200):me(Ee,"next",!0);break;case"qbo_connection":me(Ee,"next",!0);break;case"company_officer":if(yn){const qe=us();if(t.defer(()=>{const xt=ye();$?.(xt)}),qe.needsOtp&&qe.phoneNumber&&t.isValidPhoneNumber(qe.phoneNumber)){const Wt=ge.formState.errors[yl]?.[Qe<0?0:Qe],Ze=Wt?.phone,Mo=Wt!=null&&Object.keys(Wt).some(Lo=>Lo!=="phone"&&Wt[Lo]!=null);if(Ze!=null&&!Mo){he(qe.phoneNumber);return}}qe.isValid&&(ne(dt,!1,!1),c.trackOnboardingCompanyOfficerSave(xn(),{legalName:we?.companyLegalName},kn()),W({fromStep:Ee,shouldNavigate:!0,stepDirection:"next"}))}else me(Ee,"next",!0);break;case"company_details":N(!0);{const qe=!(oo()&&ft()),xt=!Xe()&&Be.includes("qbo_connection");if(qe||xt){qe&&(ge.trigger(`${d3}`),ge.trigger(`${vi}`)),xt&&ge.trigger(cb),t.defer(()=>{const Wt=ye();$?.(Wt)}),qe?ue("link_payment_account"):xt&&ue("qbo_connection");return}}if(Hs||yn||!ds?.email){const qe=js(),xt=yn?us():{isValid:!0};t.defer(()=>{const Wt=ye();$?.(Wt)}),qe&&xt.isValid?(Ae&&(L(!0),As()),ne(dt,!Ae,!1),c.trackOnboardingCompanyDetailsSave({companyDescription:we?.companyDescription,legalName:we?.companyLegalName,industry:we?.companyIndustry??pt.strings.empty,incDate:we?.incDate?.toString(),phone:we?.phone,website:we?.website?.toString(),formattedAddress:we?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(we?.addressStatus?.addressToCreate):void 0},To(),{firstName:ds?.firstName,lastName:ds?.lastName,email:ds?.email}),W({fromStep:Ee,shouldNavigate:!0,stepDirection:"next"})):xt.isValid||ue("company_officer")}else Ae?_s():me(Ee,"next",!0);break}},_s=()=>{$e.fetchState!=="In-Progress"&&(re(),c.track(io.Event.onboardingSkipAndSave))},us=()=>{const qe=ve[dt],xt=qe?.email??pt.strings.empty,Wt=qe?.phone??pt.strings.empty,Ze=qe?.ssn??pt.strings.empty,Mo=qe?.ownershipInCompany,Lo=Qe<0?0:Qe,_n=!!qe?.firstName&&!!qe?.lastName;let ns=!0,Vt=!1;return xt&&!_n&&(ge.trigger([`${yl}.${Lo}.name.firstName`,`${yl}.${Lo}.name.lastName`],{shouldFocus:Ee==="company_officer"}),ns=!1),(!xt&&qt()||zp.test(xt)===!1)&&(ge.trigger(`${yl}.${Lo}.email`,{shouldFocus:Ee==="company_officer"}),ns=!1),Wt&&t.isValidPhoneNumber(Wt)===!1&&(ge.trigger(`${yl}.${Lo}.phone`,{shouldFocus:Ee==="company_officer"}),ns=!1),Wt&&t.isValidPhoneNumber(Wt)===!0&&l==="unit"&&(Ue.current!==""&&Wt===Ue.current||(Vt=!0,ge.setError(`${yl}.${Lo}.phone`,{type:"custom",message:mj.commonSetUp.businessVerification.phoneValidationError},{shouldFocus:Ee==="company_officer"}),ns=!1)),Mo!=null&&Mo>100&&(ge.trigger(`${yl}.${Lo}.ownership`,{shouldFocus:Ee==="company_officer"}),ns=!1),Ze&&ST.test(Ze)===!1&&(ge.trigger(`${yl}.${Lo}.ssn`,{shouldFocus:Ee==="company_officer"}),ns=!1),{isValid:ns,needsOtp:Vt,phoneNumber:Wt}},js=()=>{const qe=we?.website?.toString()??pt.strings.empty,xt=we?.phone??pt.strings.empty,Wt=we?.taxIdOrEIN??pt.strings.empty,Mo=we?.primaryContactLocalData?.email??pt.strings.empty;let Lo=!0;return qe&&Kj.test(qe)===!1&&(ge.trigger(`${Sh}.companyWebsite`,{shouldFocus:Ee==="company_details"}),Lo=!1),Kj.lastIndex=0,xt&&t.isValidPhoneNumber(xt)===!1&&(ge.trigger(`${Sh}.companyPhone`,{shouldFocus:Ee==="company_details"}),Lo=!1),(!Mo||zp.test(Mo)===!1)&&(ge.trigger(`${Sh}.primaryContactEmail`,{shouldFocus:Ee==="company_details"}),Lo=!1),Wt&&L9.test(Wt)===!1&&(ge.trigger(`${Sh}.companyTaxId`,{shouldFocus:Ee==="company_details"}),Lo=!1),Lo},xn=()=>{const qe=ve[dt];return{email:qe?.email??pt.strings.empty,birthday:qe?.birthday?.toString(),companyOwnership:qe?.ownershipInCompany,firstName:qe?.firstName,lastName:qe?.lastName,companyRole:qe?.titleAtCompany,phone:qe?.phone,formattedAddress:qe?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(qe?.addressStatus?.addressToCreate):void 0,documentTypeForVerification:qe?.documentTypeSelectedForVerification}},As=()=>{const qe=we?.primaryContactLocalData;c.trackBusinessVerificationSave(xn(),{companyDescription:we?.companyDescription,legalName:we?.companyLegalName,phone:we?.phone,website:we?.website?.toString(),industry:we?.companyIndustry??pt.strings.empty,formattedAddress:we?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(we?.addressStatus?.addressToCreate):void 0},{firstName:qe?.firstName,lastName:qe?.lastName,email:qe?.email},"onboarding")},[nn,os]=g.useState(!1);return t.jsxRuntimeExports.jsxs(Pwn,{children:[t.jsxRuntimeExports.jsxs(Mwn,{windowSize:S,children:[Be.indexOf(Ee)>=0?t.jsxRuntimeExports.jsx(Rt,{title:Tt.sectionTitle,showBackButton:S!=="medium-compact"&&S!=="small",showMenuIcon:S==="medium-compact"||S==="small",backgroundColor:ae.colors.grey4,style:{zIndex:4},showLeftSection:S!=="small",titleStyle:{display:"flex",alignItems:"center"},navBarContainerStyles:{paddingTop:o.sp0,paddingBottom:o.sp0},source:"CustomerOnboardingDetailPage"}):t.jsxRuntimeExports.jsx(Dwn,{windowSize:S,children:t.jsxRuntimeExports.jsx(Own,{windowSize:S,children:t.jsxRuntimeExports.jsx(_wn,{})})}),t.jsxRuntimeExports.jsx(t.FormProvider,{...ge,children:t.jsxRuntimeExports.jsx(Fwn,{id:Iwn(cxe),children:Be.map(qe=>{let xt;xt=t.jsxRuntimeExports.jsx(DW,{connectedAccountProvider:l,paymentAccount:_e,accountStatus:Te,plaidConnectionDetails:ke,sectionId:d3,hasError:ge.getFieldState(d3).error!=null||V&&!ft(),isValid:ft(),analytics:c,onFetchLinkTokenClick:Z,onEstablishConnectionClick:J,onUpdatePaymentAccountStatus:G,onUpdatePaymentAccountLoginStatus:K,onEstablishConnectionSuccess:oe,cardPaymentView:d,resetCardPaymentViewState:C,updateCardPaymentModalState:f,cardSetupInProgress:nn,subscriptionBillingAddressSectionId:vi});let Wt=k;switch(qe){case"link_payment_account":xt=t.jsxRuntimeExports.jsx(DW,{connectedAccountProvider:l,paymentAccount:_e,accountStatus:Te,plaidConnectionDetails:ke,subscriptionBillingAddressSectionId:vi,sectionId:d3,hasError:ge.getFieldState(d3).error!=null||V&&!ft(),isValid:ft(),analytics:c,onFetchLinkTokenClick:Z,onEstablishConnectionClick:J,onUpdatePaymentAccountStatus:G,onUpdatePaymentAccountLoginStatus:K,onEstablishConnectionSuccess:oe,updateCardPaymentModalState:f,cardPaymentView:d,resetCardPaymentViewState:C,cardSetupInProgress:nn,googleAPIKey:m,subscriptionBillingAddress:Pe});break;case"qbo_connection":xt=t.jsxRuntimeExports.jsx(kwn,{sectionId:cb,hasError:ge.getFieldState(cb).error!=null,isAdmin:i,isValid:Re?.accounting[0]?.isValid??!1,companyName:Ce?.company.company.companyInfo.companyLegalName,saveConnectionState:Re?.saveConnectionState,isQBOPopupOpen:Oe.isQBOPopupOpen,handleOnConnectClick:ce,updateQBOPopupState:de}),Wt=T;break;case"company_officer":xt=t.jsxRuntimeExports.jsx(K8n,{companyOfficerLocalData:ve,allNationalityCountries:Me,isCompleted:Se.includes("company_officer"),companyView:Ce,sectionId:yl,filesEndPoint:e.filesEndPoint,authParams:e.authParams,isRefreshingViewInBackground:n,companyTitles:a,isVerificationPopupOpen:M,setIsVerificationPopupOpen:F,onGetOtp:he,onVerifyOtp:pe,onResendOtp:je,onOfficerAddressClick:Ze=>U(Ze,yt?.addressId),updateFilesEntity:se,onEditFileName:te,onDeleteFile:ee,verifiedPhoneNumber:Ue.current,onPhoneVerified:Je,isDisabled:$e.fetchState==="In-Progress"?"readonly":void 0,triggerError:tt}),Wt=I;break;case"company_details":xt=t.jsxRuntimeExports.jsx(X8n,{fileProps:{...e,onEditFileName:te,onDeleteFile:ee,updateFilesEntity:se},allNationalityCountries:Me,sectionId:Sh,companyIndustries:r.companyIndustries,companyDetails:we,isDisabled:$e.fetchState==="In-Progress"?"readonly":void 0,isCompleted:Se.includes("company_details"),onCompanyAddressClick:Ze=>{const Mo=Ce?.company.company.companyOnboardingInfo.subscriptionBillingAddressId;jt?.addressId==null&&Mo!=null?U(Ze,Mo):U(Ze,jt?.addressId)},onRegisteredAddressClick:Ze=>U(Ze,We?.addressId)}),Wt=A;break}return t.jsxRuntimeExports.jsx(zwn,{ref:Wt,isVisible:Ee===qe,includeAnimation:Ee==="link_payment_account"||Ee==="qbo_connection"?!Oe.isQBOPopupOpen:Ee==="company_officer"?!M:!0,paddingBottom:qe==="company_details"||qe==="company_officer"?p[6]:p[0],stepAnimationDirection:P,children:xt},qe)})})}),t.jsxRuntimeExports.jsx(_t,{formId:`${cxe}`,style:{width:S==="small"?"auto":"100%",paddingTop:o.sp2,paddingBottom:o.sp2},primaryBtn:{onClick:pn,label:Ee==="company_details"?pt.footer.submit:$o.next,isLoading:$e.fetchState==="In-Progress",isDisabled:$e.fetchState==="In-Progress"},cancelBtn:{onClick:In,label:$o.back,isDisabled:$e.fetchState==="In-Progress"||Be.indexOf(Ee)===0},containerStyle:{width:"auto",justifyContent:"center"},showCancel:!0})]}),t.jsxRuntimeExports.jsx(DY,{handleConfirmCardSetupIntent:h,updateCardPaymentModalState:f,handleCreateCardSetupIntent:x,handleAddCardPaymentSource:y,cardPaymentView:d,stripeKey:u,isCardPaymentOpen:Oe.isCardPaymentPopupOpen,handleResetCardPaymentErrorStatuses:b,cardSetupInProgress:nn,setCardSetupInProgress:os})]})},Lwn=xe.keyframes`
52070
+ `,kwn=({isValid:e,sectionId:n="onboardingQboConnection",...i})=>{const{register:r}=t.useFormContext();return t.jsxRuntimeExports.jsxs(Swn,{children:[t.jsxRuntimeExports.jsx(Awn,{type:"hidden",...r(`${n}.connected`,{validate:a=>a==="true"}),value:e?"true":"false"}),t.jsxRuntimeExports.jsx(lwn,{isValid:e,...i})]})},Sh="companyDetails",yl="companyOfficer",d3="onboardingPaymentAccountSetupSection",cxe="customerOnboardingDetailPage",vi="onboardingSubscriptionBillingAddress",cb="onboardingQboConnection",dIe={topNavBarHeight:new w(52,52,63),topNavBarLeftRightSpace:new w(p[5],p[9],112),topNavBarHeaderLeftRightPadding:new w(p[4],p[0]),navBarTitleMarginLeft:new w(p[3],p[4]),subTitlePaddingTop:new w(p[3],p[3]),subTitlePaddingBottom:new w(p[3],p[3]),termsPaddingLeftRight:new w(p[0],p[3])},Iwn=e=>`${e}_form`,mj=O.getLocalizedStrings(),Twn=({fileProps:e,isRefreshingViewInBackground:n,isAdmin:i,onboardingCustomerView:r,companyTitles:a,connectedAccountProvider:l,analytics:c,cardPaymentView:d,stripeKey:u,googleAPIKey:m,handleCreateCardSetupIntent:x,handleConfirmCardSetupIntent:h,updateCardPaymentModalState:f,handleAddCardPaymentSource:y,resetCardPaymentViewState:C,handleResetCardPaymentErrorStatuses:b,redirectToProductSuitePage:E,onFormErrorsChange:$,...R})=>{const S=X(),k=g.useRef(null),T=g.useRef(null),A=g.useRef(null),I=g.useRef(null),[B,L]=g.useState(!1),[P,D]=g.useState("next"),[M,F]=g.useState(!1),[V,N]=g.useState(!1),[H,W]=g.useState(null),{onAddressClick:U,onCompanyDetailsChanged:Y,onCompanyOfficerUpdated:q,onFetchLinkTokenClick:Z,onUpdatePaymentAccountStatus:G,onUpdatePaymentAccountLoginStatus:K,onEstablishConnectionClick:J,onEstablishConnectionSuccess:oe,onDeleteFile:ee,onEditFileName:te,updateFilesEntity:se,onGetOtp:ie,onSkipSetupClick:re,onUpdateCustomerView:ne,updateStepHandler:me,onVerifyOtp:pe,onResendOtp:je,handleOnConnectClick:ce,updateQBOPopupState:de,onUpdateStep:ue,onAddressEditHandler:le}=R,ae=t.useTheme(),ge=t.useForm({mode:"onSubmit",reValidateMode:"onChange",defaultValues:kO(r,r.allNationalityCountries),values:kO(r,r.allNationalityCountries),shouldFocusError:!0,resetOptions:{keepDirtyValues:!0}}),ye=g.useCallback(()=>{const qe=[];return(ge.getFieldState(d3).error!=null||ge.getFieldState(vi).error!=null)&&qe.push("link_payment_account"),ge.getFieldState(cb).error!=null&&qe.push("qbo_connection"),qe},[ge]);g.useEffect(()=>{const qe=ye();$?.(qe)},[ye,$]),g.useEffect(()=>{const qe=ge.watch((xt,{name:Wt,type:Ze})=>{Wt!=null&&(Ze==="change"||Ze==="blur")&&t.defer(()=>{const Mo=ye();$?.(Mo)})});return()=>qe.unsubscribe()},[ge,ye,$]);const he=qe=>{tt(qe)},{companyView:Ce,companyDetailsLocalData:we,companyOfficerLocalData:ve,currentStep:Ee,completedSteps:Se,saveStatus:$e,allSteps:Be,allRequiredStepsCompleted:Ae,paymentAccount:_e,paymentAccountStatus:Te,externalConnections:Re,plaidConnectionDetails:ke,uiState:Oe,allNationalityCountries:Me,pendingSaveDetails:{companyDetails:Ie,officer:Ne},subscriptionBillingAddress:Pe}=r,Qe=g.useRef(""),Je=qe=>{Qe.current=qe;const xt=Object.values(r.companyOfficerLocalData).findIndex(Ze=>Ze?.isSelectedForVerification===!0)??0,Wt=xt<0?0:xt;ge.clearErrors(`${yl}.${Wt}.phone`)},tt=qe=>{qe!=null&&!t.isValidPhoneNumber(qe)?ge.trigger(`${yl}.${Ue}.phone`):ie(qe)},Ue=Object.values(ve).findIndex(qe=>qe?.isSelectedForVerification===!0)??0,dt=`Officer_${Ue<0?1:Ue+1}`,ct=Ce?.companyOfficers.slice(0,10).sort((qe,xt)=>qe.user.createTime?.isAfter(xt.user.createTime)===!0?1:-1),yt=ve[dt]?.userId!=null?ct?.find(qe=>qe.user.userId===ve[dt]?.userId)?.address:null,He=ve[dt]?.addressStatus?.addressToCreate,jt=Ce?.companyAddress,St=we?.addressStatus?.addressToCreate,We=Ce?.registeredAddress,nt=we?.registeredAddressStatus?.addressToCreate,{customerOnboardingPage:ut,common:pt}=mj,{footer:Bt,steps:Ht}=ut,{buttons:$o}=Bt,Tt=Ht[Ee],Gt=Be.length,so=Ye($e.fetchState),no=Ye(Ee);function Xe(){return Re?.accounting[0]?.isValid??!1}const ft=()=>{const qe=Object.values(ke).some(Lo=>Lo.fetchStatus.fetchState==="Completed"),xt=_e?.providerVerificationStatus?.code?.includes("verified")??!1,Wt=d.cardsList.length>0,Mo=d.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1;return qe&&xt||!xt&&!_e&&Wt||!Wt&&!_e&&Mo};function oo(){if(ge.getFieldState(vi).error)return!1;const xt=ge.getValues(vi),Wt=Pe?.street.join("").trim(),Ze=Pe?.city,Mo=Pe?.state,Lo=Pe?.country,_n=Pe?.postalCode!=null&&Pe.postalCode||xt.postalCode||pt.strings.empty;return!!Wt&&!!Ze&&!!Mo&&!!Lo&&!!_n}const on=Ye(_e?.providerVerificationStatus?.code),To=()=>{const qe=we,xt=[];return qe?.companyLegalName!=null&&xt.push("legal_name"),qe?.companyDescription!=null&&qe?.companyDescription!==pt.strings.empty&&xt.push("company_description"),qe?.addressStatus?.addressToCreate!=null&&xt.push("company_address"),qe?.registeredAddressStatus?.addressToCreate!=null&&xt.push("registered_address"),qe?.website!=null&&xt.push("website"),qe?.companyIndustry!=null&&qe?.companyIndustry!==pt.strings.empty&&xt.push("industry"),qe?.typeOfIncorporation!=null&&qe?.typeOfIncorporation!==pt.strings.empty&&xt.push("type_of_incorporation"),qe?.incDate!=null&&xt.push("inc_date"),qe?.phone!=null&&xt.push("phone"),qe?.primaryContactLocalData?.firstName!=null&&qe?.primaryContactLocalData?.lastName!=null&&xt.push("primary_contact_name"),qe?.primaryContactLocalData?.email!=null&&xt.push("primary_contact_email"),qe?.taxIdOrEIN!=null&&xt.push("tax_id_or_ein"),qe?.companyFiles.find(Wt=>Wt.documentType==="certificate_of_incorporation")!=null&&xt.push("certificate_of_incorporation"),qe?.companyFiles.find(Wt=>Wt.documentType==="tax_ein")!=null&&xt.push("ein"),{completedFields:xt,status:xt.length===14?"complete":xt.length>0?"partially_complete":"incomplete"}},kn=()=>{const qe=ve[dt],xt=[];return qe?.firstName!=null&&qe.firstName!==pt.strings.empty&&xt.push("first_name"),qe?.lastName!=null&&qe.lastName!==pt.strings.empty&&xt.push("last_name"),qe?.birthday!=null&&xt.push("dob"),qe?.nationalityCountryCode!=null&&xt.push("nationality"),qe?.addressStatus?.addressToCreate!=null&&xt.push("address"),qe?.phone!=null&&qe.phone!==pt.strings.empty&&qe.isPhoneVerified===!0&&xt.push("phone"),qe?.titleAtCompany!=null&&qe.titleAtCompany!==pt.strings.empty&&xt.push("company_role"),qe?.ownershipInCompany!=null&&xt.push("ownership"),qe?.ssn!=null&&qe.ssn!==pt.strings.empty&&xt.push("ssn"),qe?.documentTypeSelectedForVerification!=null&&xt.push("document_type"),qe?.fileIds!=null&&qe.fileIds.length>0&&xt.push("document_uploaded"),{completedFields:xt,status:xt.length===11?"complete":xt.length>0?"partially_complete":"incomplete"}};g.useEffect(()=>{on==="pending_manual_verification"&&_e?.providerVerificationStatus?.code==="manually_verified"&&c.trackOnboardingBankAccountVerified("manual")},[c,_e?.providerVerificationStatus?.code,on]);const Dn=async(qe,xt)=>{if(qe.includes(Sh))Y?.(xt[Sh]);else if(qe.includes(yl))q?.(xt[yl]);else if(qe.includes(vi)&&xt[vi]!=null){const Wt=ge.getValues(`${vi}`).country;let Ze=xt[vi];if(qe.includes(`${vi}.street`)&&xt[vi].street!=null){const{addressValue:Mo}=xt[vi].street,Lo=cl(Mo?.country);Ze={street:xt[vi].street??pt.strings.empty,city:Mo?.locality??pt.strings.empty,state:Mo?.administrativeAreaLevel1??pt.strings.empty,country:Lo,countryCode:Mo?.countryCode??pt.strings.empty,postalCode:Mo?.postalCode??pt.strings.empty,secondaryInfo:xt[vi].secondaryInfo,suite:xt[vi].suite},Wt.selectedOption!==Lo.selectedOption&&(Ze={...Ze,country:Lo})}else qe===`${vi}.country`&&Wt.selectedOption!=null?Ze={...Ze,countryCode:hd(Wt.selectedOption)}:Wt.selectedOption!=null&&qe.includes(`${vi}.street`)===!1&&(Ze={...Ze,countryCode:hd(Wt.selectedOption)});le(Ze)}};g.useEffect(()=>{const qe=ge.watch((xt,{name:Wt})=>{Wt!=null&&xt!=null&&t.defer(()=>Dn(Wt,xt))});return()=>{qe.unsubscribe()}}),g.useEffect(()=>{so==="In-Progress"&&$e.fetchState==="Completed"&&(ge.reset(kO(r,Me),{keepDirtyValues:!1}),no==="company_details"&&Ee==="link_payment_account"&&!Be.includes("qbo_connection")&&!r.qboConnected&&E())},[ge,r,so,$e.fetchState,Me,no,Ee,Be,E]),g.useEffect(()=>{B&&so==="In-Progress"&&$e.fetchState==="Completed"&&(re(),c.track(io.Event.onboardingSkipAndSave))},[so,B,$e.fetchState,re]),g.useEffect(()=>{H?.shouldNavigate===!0&&so==="In-Progress"&&$e.fetchState==="Completed"&&(W(null),me(H.fromStep,H.stepDirection,!0))},[H,so,$e.fetchState,me]),g.useLayoutEffect(()=>{no!=null&&no!==Ee&&(Be.indexOf(no)===Be.indexOf(Ee)-1||Be.indexOf(no)===Gt-1&&Be.indexOf(Ee)===0?P!=="next"&&D("next"):(Be.indexOf(no)-1===Be.indexOf(Ee)||Be.indexOf(no)===0&&Be.indexOf(Ee)===Gt-1)&&P!=="previous"&&D("previous"))},[Be,Ee,no,P,Gt]);const qt=()=>{const qe=ve[dt];return!!qe?.firstName||!!qe?.lastName||!!qe?.email||!!qe?.nationalityCountryCode||!!qe?.birthday||!!qe?.ownershipInCompany||!!qe?.phone||!!qe?.ssn||!!qe?.titleAtCompany||!!qe?.addressStatus?.addressToCreate||qe?.fileIds!=null&&qe?.fileIds.length>0},dn=!t.isEqual(He!=null?Q.getFormattedAddress(He):null,yt!=null?Q.getFormattedAddress(yt):null),Zs=!t.isEqual(St!=null?Q.getFormattedAddress(St):null,jt!=null?Q.getFormattedAddress(jt):null),Yn=!t.isEqual(nt!=null?Q.getFormattedAddress(nt):null,We!=null?Q.getFormattedAddress(We):null),Hs=ge.getFieldState(Sh).isDirty||Zs||Yn||Ie,yn=ge.getFieldState(yl).isDirty&&qt()||dn||Ne,Go=ge.getFieldState(`${vi}`).isDirty,ds=we?.primaryContactLocalData,In=()=>{me(Ee,"previous",!0)},ts=()=>{const qe=ge.getValues(vi),xt={street:qe.street.addressString,suite:qe.suite,city:qe.city,state:qe.state,postalCode:qe.postalCode,country:qe.country.selectedOption??pt.strings.empty,secondaryInfo:qe.secondaryInfo};c.trackOnboardingBillingAddressSave(xt)},pn=()=>{switch(N(!1),Ee){case"link_payment_account":Go?setTimeout(()=>{const qe=ye();$?.(qe),oo()&&Go?(ts(),ne(dt,!1,!0),W({fromStep:Ee,shouldNavigate:!0,stepDirection:"next"})):me(Ee,"next",!0)},200):me(Ee,"next",!0);break;case"qbo_connection":me(Ee,"next",!0);break;case"company_officer":if(yn){const qe=us();if(t.defer(()=>{const xt=ye();$?.(xt)}),qe.needsOtp&&qe.phoneNumber&&t.isValidPhoneNumber(qe.phoneNumber)){const Wt=ge.formState.errors[yl]?.[Ue<0?0:Ue],Ze=Wt?.phone,Mo=Wt!=null&&Object.keys(Wt).some(Lo=>Lo!=="phone"&&Wt[Lo]!=null);if(Ze!=null&&!Mo){he(qe.phoneNumber);return}}qe.isValid&&(ne(dt,!1,!1),c.trackOnboardingCompanyOfficerSave(xn(),{legalName:we?.companyLegalName},kn()),W({fromStep:Ee,shouldNavigate:!0,stepDirection:"next"}))}else me(Ee,"next",!0);break;case"company_details":N(!0);{const qe=!(oo()&&ft()),xt=!Xe()&&Be.includes("qbo_connection");if(qe||xt){qe&&(ge.trigger(`${d3}`),ge.trigger(`${vi}`)),xt&&ge.trigger(cb),t.defer(()=>{const Wt=ye();$?.(Wt)}),qe?ue("link_payment_account"):xt&&ue("qbo_connection");return}}if(Hs||yn||!ds?.email){const qe=js(),xt=yn?us():{isValid:!0};t.defer(()=>{const Wt=ye();$?.(Wt)}),qe&&xt.isValid?(Ae&&(L(!0),As()),ne(dt,!Ae,!1),c.trackOnboardingCompanyDetailsSave({companyDescription:we?.companyDescription,legalName:we?.companyLegalName,industry:we?.companyIndustry??pt.strings.empty,incDate:we?.incDate?.toString(),phone:we?.phone,website:we?.website?.toString(),formattedAddress:we?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(we?.addressStatus?.addressToCreate):void 0},To(),{firstName:ds?.firstName,lastName:ds?.lastName,email:ds?.email}),W({fromStep:Ee,shouldNavigate:!0,stepDirection:"next"})):xt.isValid||ue("company_officer")}else Ae?_s():me(Ee,"next",!0);break}},_s=()=>{$e.fetchState!=="In-Progress"&&(re(),c.track(io.Event.onboardingSkipAndSave))},us=()=>{const qe=ve[dt],xt=qe?.email??pt.strings.empty,Wt=qe?.phone??pt.strings.empty,Ze=qe?.ssn??pt.strings.empty,Mo=qe?.ownershipInCompany,Lo=Ue<0?0:Ue,_n=!!qe?.firstName&&!!qe?.lastName;let ns=!0,Vt=!1;return xt&&!_n&&(ge.trigger([`${yl}.${Lo}.name.firstName`,`${yl}.${Lo}.name.lastName`],{shouldFocus:Ee==="company_officer"}),ns=!1),(!xt&&qt()||zp.test(xt)===!1)&&(ge.trigger(`${yl}.${Lo}.email`,{shouldFocus:Ee==="company_officer"}),ns=!1),Wt&&t.isValidPhoneNumber(Wt)===!1&&(ge.trigger(`${yl}.${Lo}.phone`,{shouldFocus:Ee==="company_officer"}),ns=!1),Wt&&t.isValidPhoneNumber(Wt)===!0&&l==="unit"&&(Qe.current!==""&&Wt===Qe.current||(Vt=!0,ge.setError(`${yl}.${Lo}.phone`,{type:"custom",message:mj.commonSetUp.businessVerification.phoneValidationError},{shouldFocus:Ee==="company_officer"}),ns=!1)),Mo!=null&&Mo>100&&(ge.trigger(`${yl}.${Lo}.ownership`,{shouldFocus:Ee==="company_officer"}),ns=!1),Ze&&ST.test(Ze)===!1&&(ge.trigger(`${yl}.${Lo}.ssn`,{shouldFocus:Ee==="company_officer"}),ns=!1),{isValid:ns,needsOtp:Vt,phoneNumber:Wt}},js=()=>{const qe=we?.website?.toString()??pt.strings.empty,xt=we?.phone??pt.strings.empty,Wt=we?.taxIdOrEIN??pt.strings.empty,Mo=we?.primaryContactLocalData?.email??pt.strings.empty;let Lo=!0;return qe&&Kj.test(qe)===!1&&(ge.trigger(`${Sh}.companyWebsite`,{shouldFocus:Ee==="company_details"}),Lo=!1),Kj.lastIndex=0,xt&&t.isValidPhoneNumber(xt)===!1&&(ge.trigger(`${Sh}.companyPhone`,{shouldFocus:Ee==="company_details"}),Lo=!1),(!Mo||zp.test(Mo)===!1)&&(ge.trigger(`${Sh}.primaryContactEmail`,{shouldFocus:Ee==="company_details"}),Lo=!1),Wt&&L9.test(Wt)===!1&&(ge.trigger(`${Sh}.companyTaxId`,{shouldFocus:Ee==="company_details"}),Lo=!1),Lo},xn=()=>{const qe=ve[dt];return{email:qe?.email??pt.strings.empty,birthday:qe?.birthday?.toString(),companyOwnership:qe?.ownershipInCompany,firstName:qe?.firstName,lastName:qe?.lastName,companyRole:qe?.titleAtCompany,phone:qe?.phone,formattedAddress:qe?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(qe?.addressStatus?.addressToCreate):void 0,documentTypeForVerification:qe?.documentTypeSelectedForVerification}},As=()=>{const qe=we?.primaryContactLocalData;c.trackBusinessVerificationSave(xn(),{companyDescription:we?.companyDescription,legalName:we?.companyLegalName,phone:we?.phone,website:we?.website?.toString(),industry:we?.companyIndustry??pt.strings.empty,formattedAddress:we?.addressStatus?.addressToCreate!=null?Q.getFormattedAddress(we?.addressStatus?.addressToCreate):void 0},{firstName:qe?.firstName,lastName:qe?.lastName,email:qe?.email},"onboarding")},[nn,os]=g.useState(!1);return t.jsxRuntimeExports.jsxs(Pwn,{children:[t.jsxRuntimeExports.jsxs(Mwn,{windowSize:S,children:[Be.indexOf(Ee)>=0?t.jsxRuntimeExports.jsx(Rt,{title:Tt.sectionTitle,showBackButton:S!=="medium-compact"&&S!=="small",showMenuIcon:S==="medium-compact"||S==="small",backgroundColor:ae.colors.grey4,style:{zIndex:4},showLeftSection:S!=="small",titleStyle:{display:"flex",alignItems:"center"},navBarContainerStyles:{paddingTop:o.sp0,paddingBottom:o.sp0},source:"CustomerOnboardingDetailPage"}):t.jsxRuntimeExports.jsx(Dwn,{windowSize:S,children:t.jsxRuntimeExports.jsx(Own,{windowSize:S,children:t.jsxRuntimeExports.jsx(_wn,{})})}),t.jsxRuntimeExports.jsx(t.FormProvider,{...ge,children:t.jsxRuntimeExports.jsx(Fwn,{id:Iwn(cxe),children:Be.map(qe=>{let xt;xt=t.jsxRuntimeExports.jsx(DW,{connectedAccountProvider:l,paymentAccount:_e,accountStatus:Te,plaidConnectionDetails:ke,sectionId:d3,hasError:ge.getFieldState(d3).error!=null||V&&!ft(),isValid:ft(),analytics:c,onFetchLinkTokenClick:Z,onEstablishConnectionClick:J,onUpdatePaymentAccountStatus:G,onUpdatePaymentAccountLoginStatus:K,onEstablishConnectionSuccess:oe,cardPaymentView:d,resetCardPaymentViewState:C,updateCardPaymentModalState:f,cardSetupInProgress:nn,subscriptionBillingAddressSectionId:vi});let Wt=k;switch(qe){case"link_payment_account":xt=t.jsxRuntimeExports.jsx(DW,{connectedAccountProvider:l,paymentAccount:_e,accountStatus:Te,plaidConnectionDetails:ke,subscriptionBillingAddressSectionId:vi,sectionId:d3,hasError:ge.getFieldState(d3).error!=null||V&&!ft(),isValid:ft(),analytics:c,onFetchLinkTokenClick:Z,onEstablishConnectionClick:J,onUpdatePaymentAccountStatus:G,onUpdatePaymentAccountLoginStatus:K,onEstablishConnectionSuccess:oe,updateCardPaymentModalState:f,cardPaymentView:d,resetCardPaymentViewState:C,cardSetupInProgress:nn,googleAPIKey:m,subscriptionBillingAddress:Pe});break;case"qbo_connection":xt=t.jsxRuntimeExports.jsx(kwn,{sectionId:cb,hasError:ge.getFieldState(cb).error!=null,isAdmin:i,isValid:Re?.accounting[0]?.isValid??!1,companyName:Ce?.company.company.companyInfo.companyLegalName,saveConnectionState:Re?.saveConnectionState,isQBOPopupOpen:Oe.isQBOPopupOpen,handleOnConnectClick:ce,updateQBOPopupState:de}),Wt=T;break;case"company_officer":xt=t.jsxRuntimeExports.jsx(K8n,{companyOfficerLocalData:ve,allNationalityCountries:Me,isCompleted:Se.includes("company_officer"),companyView:Ce,sectionId:yl,filesEndPoint:e.filesEndPoint,authParams:e.authParams,isRefreshingViewInBackground:n,companyTitles:a,isVerificationPopupOpen:M,setIsVerificationPopupOpen:F,onGetOtp:he,onVerifyOtp:pe,onResendOtp:je,onOfficerAddressClick:Ze=>U(Ze,yt?.addressId),updateFilesEntity:se,onEditFileName:te,onDeleteFile:ee,verifiedPhoneNumber:Qe.current,onPhoneVerified:Je,isDisabled:$e.fetchState==="In-Progress"?"readonly":void 0,triggerError:tt}),Wt=I;break;case"company_details":xt=t.jsxRuntimeExports.jsx(X8n,{fileProps:{...e,onEditFileName:te,onDeleteFile:ee,updateFilesEntity:se},allNationalityCountries:Me,sectionId:Sh,companyIndustries:r.companyIndustries,companyDetails:we,isDisabled:$e.fetchState==="In-Progress"?"readonly":void 0,isCompleted:Se.includes("company_details"),onCompanyAddressClick:Ze=>{const Mo=Ce?.company.company.companyOnboardingInfo.subscriptionBillingAddressId;jt?.addressId==null&&Mo!=null?U(Ze,Mo):U(Ze,jt?.addressId)},onRegisteredAddressClick:Ze=>U(Ze,We?.addressId)}),Wt=A;break}return t.jsxRuntimeExports.jsx(zwn,{ref:Wt,isVisible:Ee===qe,includeAnimation:Ee==="link_payment_account"||Ee==="qbo_connection"?!Oe.isQBOPopupOpen:Ee==="company_officer"?!M:!0,paddingBottom:qe==="company_details"||qe==="company_officer"?p[6]:p[0],stepAnimationDirection:P,children:xt},qe)})})}),t.jsxRuntimeExports.jsx(_t,{formId:`${cxe}`,style:{width:S==="small"?"auto":"100%",paddingTop:o.sp2,paddingBottom:o.sp2},primaryBtn:{onClick:pn,label:Ee==="company_details"?pt.footer.submit:$o.next,isLoading:$e.fetchState==="In-Progress",isDisabled:$e.fetchState==="In-Progress"},cancelBtn:{onClick:In,label:$o.back,isDisabled:$e.fetchState==="In-Progress"||Be.indexOf(Ee)===0},containerStyle:{width:"auto",justifyContent:"center"},showCancel:!0})]}),t.jsxRuntimeExports.jsx(DY,{handleConfirmCardSetupIntent:h,updateCardPaymentModalState:f,handleCreateCardSetupIntent:x,handleAddCardPaymentSource:y,cardPaymentView:d,stripeKey:u,isCardPaymentOpen:Oe.isCardPaymentPopupOpen,handleResetCardPaymentErrorStatuses:b,cardSetupInProgress:nn,setCardSetupInProgress:os})]})},Lwn=xe.keyframes`
52071
52071
  from {
52072
52072
  transform: translateY(100%);
52073
52073
  opacity: 0;
@@ -52918,7 +52918,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
52918
52918
  flex-direction: column;
52919
52919
  align-items: center;
52920
52920
  gap: ${e=>w9.sectionsRowGap.valuePx(e.windowSize)};
52921
- `;function vRn({currentTenant:e,accountMappingView:n,isAccountingClassesEnabled:i,isAccountingClassesUpdateInProgress:r,isAccountingProjectsEnabled:a,isFiling1099FeatureEnabled:l,isAccruedExpensesFeatureEnabled:c,meetingUrl:d,isSettings:u=!1,onAccountingClassesToggle:m,onAccountMappingChange:x,onSaveClick:h,onBackClick:f,onClickMenuIcon:y,capitalizableAccounts:C,accountNamesById:b,capitalizationThreshold:E,currencySymbol:$="$",isCapitalizationFeatureEnabled:R=!1,isCapitalizationThresholdSaving:S=!1,onSaveCapitalizationThreshold:k}){const T=t.useTheme(),A=X(),I=ht(),[B,L]=g.useState(!1),P=Ye(n.saveState.fetchState),D=g.useRef(null),M=Q.hasFullOrAdminLevelAccess(I.loggedInUserRole??[]),F=Sf.accountingSettings,V=[{key:"accountingClasses",checked:i,isUpdateInProgress:r,title:F.accountingClasses.title,subTitle:F.accountingClasses.subTitle,onToggle:m,enableConfirmation:F.accountingClasses.enableConfirmation,disableConfirmation:F.accountingClasses.disableConfirmation,confirmLabel:F.confirmLabel,cancelLabel:F.cancelLabel},{key:"projects",checked:a,isUpdateInProgress:!1,readOnly:!0,title:F.projects.title,subTitle:F.projects.subTitle}],{incomeRecommendation:N,expenseRecommendation:H,billPayRecommendation:W,reimbursementsRecommendation:U,prepaidExpensesRecommendation:Y,fixedAssetsRecommendation:q,accruedExpensesRecommendation:Z}=n,G=N!=null?[N]:[],K=H!=null?[H]:[],J=W!=null?[W]:[],oe=U!=null?[U]:[],ee=Y,te=q,se=Z,ie=$n(n.incomeAccountHierachy,G,"Accounts"),re=$n(n.expenseAccountHierarchy,K,"Accounts"),ne=$n(n.billPayAccountHierarchy,J,"Accounts"),me=$n(n.reimbursementsAccountHierarchy,oe,"Accounts"),pe=$n(n.prepaidExpensesAccountHierarchy,ee,"Accounts"),je=$n(n.fixedAssetsAccountHierarchy,te,"Accounts"),ce=$n(n.accruedExpensesAccountHierarchy,se,"Accounts"),de=$n(n.bankAccounts1099FilingAccountHierarchy,[],"Accounts"),ue=$n(n.expenseAccounts1099FilingAccountHierarchy,[],"Categories"),le=Il(n.expenseTypeList,Sf.filing1099Section.allExpenseTypes),ae=Il(n.expense1099TypeList,Sf.filing1099Section.all1099Types),ge=Il(n.boxTypesList.int,Sf.filing1099Section.allBoxes),ye=Il(n.boxTypesList.misc,Sf.filing1099Section.allBoxes),he=Il(n.boxTypesList.nec,Sf.filing1099Section.allBoxes),Ce={int:ge,misc:ye,nec:he},we=t.useForm({mode:"all",defaultValues:Rxe(n,ie,re,ne,me,pe,je,ce,de,ue,le,ae,Ce),resetOptions:{keepDirtyValues:!0},values:Rxe(n,ie,re,ne,me,pe,je,ce,de,ue,le,ae,Ce)}),ve=we.handleSubmit(Ae=>{const _e=Ae[wr].bankAccount.selectedOptions.length,Te=Ae[wr].expenseCategory1099.length,Re=_e===0&&Te===1&&hke(Ae[wr].expenseCategory1099[0]),ke=Ae[wr].expenseCategory1099,Oe=[];ke.forEach((Me,Ie)=>{if(!Re){const Ne=Me.accountId?.selectedOption,Pe=Me.expenseType?.selectedOption,Ue=Me.type1099?.selectedOption,Je=Me.boxType?.selectedOption;(Ne==null||Ne==="")&&(we.setError(`${wr}.expenseCategory1099.${Ie}.accountId`,{type:"manual",message:"Account ID is required."}),Oe.push(`${Ie}.accountId`)),(Pe==null||Pe==="")&&(we.setError(`${wr}.expenseCategory1099.${Ie}.expenseType`,{type:"manual",message:"Expense Type is required."}),Oe.push(`${Ie}.expenseType`)),(Ue==null||Ue==="")&&(we.setError(`${wr}.expenseCategory1099.${Ie}.type1099`,{type:"manual",message:"Type 1099 is required."}),Oe.push(`${Ie}.type1099`)),(Je==null||Je==="")&&(we.setError(`${wr}.expenseCategory1099.${Ie}.boxType`,{type:"manual",message:"Box Type is required."}),Oe.push(`${Ie}.boxType`))}}),Oe.length===0&&(_e>0&&Te>1&&ok(Ae[wr].expenseCategory1099[0])||_e>0&&Te===1&&ok(Ae[wr].expenseCategory1099[0])||Re)&&h(Ae)}),Ee=async(Ae,_e)=>{if(Ae.includes("isRecommendedIncomeAccountChecked")){const Te=_e[Zy].isRecommendedIncomeAccountChecked===!0?n.incomeRecommendation?.account?.qboId??Pi.strings.empty:n.accountMappingLocalData?.previousIncomeAccount?.qboId;we.setValue(`${Zy}.incomeAccount`,{selectedOption:Te,allOptions:ie},{shouldValidate:!0})}if(Ae.includes("isRecommendedExpenseAccountChecked")){const Te=_e[Zy].isRecommendedExpenseAccountChecked===!0?n.expenseRecommendation?.account?.qboId??Pi.strings.empty:n.accountMappingLocalData?.previousExpenseAccount?.qboId;we.setValue(`${Zy}.expenseAccount`,{selectedOption:Te,allOptions:re},{shouldValidate:!0})}if(Ae.includes("isRecommendedBillPayAccountChecked")){const Te=_e[Uv].isRecommendedBillPayAccountChecked===!0?n.billPayRecommendation?.account?.qboId??Pi.strings.empty:n.accountMappingLocalData?.previousBillPayAccount?.qboId;we.setValue(`${Uv}.billPayAccount`,{selectedOption:Te,allOptions:ne},{shouldValidate:!0})}if(Ae.includes("isRecommendedReimbursementsAccountChecked")){const Te=_e[Gv].isRecommendedReimbursementsAccountChecked===!0?n.reimbursementsRecommendation?.account?.qboId??Pi.strings.empty:n.accountMappingLocalData?.previousReimbursementsAccount?.qboId;we.setValue(`${Gv}.reimbursementsAccount`,{selectedOption:Te,allOptions:me},{shouldValidate:!0})}if(Ae.includes("filing1099Section.expenseCategory1099")){const Te=Ae.split(".").find(Re=>!isNaN(Number(Re)));if(Te!==void 0){const Re=parseInt(Te,10),ke=_e[wr].expenseCategory1099[Re];ke.accountId?.selectedOption!=null&&we.clearErrors(`${wr}.expenseCategory1099.${Re}.accountId`),ke.expenseType?.selectedOption!=null&&we.clearErrors(`${wr}.expenseCategory1099.${Re}.expenseType`),ke.type1099?.selectedOption!=null&&we.clearErrors(`${wr}.expenseCategory1099.${Re}.type1099`),ke.boxType?.selectedOption!=null&&we.clearErrors(`${wr}.expenseCategory1099.${Re}.boxType`)}}if(Ae.includes("type1099")){const Te=Ae?.split(".")?.find(Re=>!isNaN(Number(Re)));if(Te!=null){const Re=parseInt(Te,10),ke=_e[wr].expenseCategory1099[Re].type1099?.selectedOption;we.setValue(`${wr}.expenseCategory1099.${Re}.boxType`,{selectedOption:Pi.strings.empty,allOptions:CC(ke??Pi.strings.empty,Ce)},{shouldValidate:!0})}}x(_e)};g.useEffect(()=>{P==="In-Progress"&&n.saveState.fetchState==="Completed"&&f?.()},[P,n.saveState.fetchState,f]),g.useEffect(()=>{const Ae=we.watch((_e,{name:Te})=>{Te!=null&&_e!=null&&t.defer(()=>Ee(Te,_e))});return()=>{Ae.unsubscribe()}});const Se=()=>n.fetchState==="Completed"&&(n.accountMappingLocalData?.selectedExpenseAccountId!==n.accountMappingLocalData?.previousExpenseAccount?.accountId||n.accountMappingLocalData?.selectedIncomeAccountId!==n.accountMappingLocalData?.previousIncomeAccount?.accountId||n.accountMappingLocalData?.selectedBillPayAccountId!==n.accountMappingLocalData?.previousBillPayAccount?.accountId||n.accountMappingLocalData?.selectedReimbursementsAccountId!==n.accountMappingLocalData?.previousReimbursementsAccount?.accountId||c2(n.accountMappingLocalData?.selectedPrepaidExpensesAccountIds,n.accountMappingLocalData?.previousPrepaidExpensesAccount)||c2(n.accountMappingLocalData?.selectedFixedAssetsAccountIds,n.accountMappingLocalData?.previousFixedAssetsAccount)||c2(n.accountMappingLocalData?.selectedAccruedExpensesAccountIds,n.accountMappingLocalData?.previousAccruedExpensesAccount)||c2(n.accountMappingLocalData?.selectedBankAccounts1099FilingAccountIds,n.accountMappingLocalData?.previousBankAccounts1099FilingAccount)||xke(n.accountMappingLocalData?.selectedExpenseAccounts1099FilingAccountIds,n.accountMappingLocalData?.previousExpenseAccounts1099FilingAccount)),$e=n.fetchState!=="Completed",Be={onOkClick:()=>{L(!1),f?.(),we.reset()},onCancelClick:()=>{L(!1)}};return t.jsxRuntimeExports.jsxs(bRn,{ref:D,children:[t.jsxRuntimeExports.jsx(Rt,{title:u?Pi.settings.title.accounting:Sf.title,onBackClick:f,backgroundColor:T.colors.grey4,showBackButton:!u,showMenuIcon:u?A==="medium-compact"||A==="small":!1,onClickMenuIcon:y,source:"UncategorizedAccountsMappingPage"}),B===!0?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:Pi.confirmationPopup.discardTitle}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:Pi.confirmationPopup.discardDescription}),primaryButtonText:Pi.confirmationPopup.discard,secondaryButtonText:Pi.confirmationPopup.cancel,action:Be,proceedButtonVariant:"destructive"}):null,t.jsxRuntimeExports.jsx(wRn,{windowSize:A,children:$e===!1?t.jsxRuntimeExports.jsx(t.FormProvider,{...we,children:t.jsxRuntimeExports.jsx("form",{id:$xe(Exe),onSubmit:ve,children:t.jsxRuntimeExports.jsxs(ERn,{windowSize:A,children:[M?t.jsxRuntimeExports.jsx(j$n,{toggles:V}):null,R&&M?t.jsxRuntimeExports.jsx(gIe,{capitalizableAccounts:C,accountNamesById:b??{},capitalizationThreshold:E,currencySymbol:$,isSaving:S,onSaveThreshold:k??(()=>{})}):null,M?t.jsxRuntimeExports.jsx(fRn,{sectionId:Zy,containerRef:D.current,accountMappingView:n}):null,Q.hasBillPayAccessible(e,I.loggedInUserRoleMap)?t.jsxRuntimeExports.jsx(S$n,{sectionId:Uv,containerRef:D.current,accountMappingView:n}):null,Q.hasReimbursementAccessible(e,I.loggedInUserRoleMap)?t.jsxRuntimeExports.jsx(cRn,{sectionId:Gv,containerRef:D.current,accountMappingView:n}):null,M?t.jsxRuntimeExports.jsx(fIe,{sectionId:yIe,vendorAccountMappingSection:{accruedExpensesAccountHierarchy:n.accruedExpensesAccountHierarchy,accruedExpensesAccountList:n.accruedExpensesAccountList,accruedExpensesRecommendations:n.accruedExpensesRecommendation,fixedAssetsAccountHierarchy:n.fixedAssetsAccountHierarchy,fixedAssetsAccountList:n.fixedAssetsAccountList,fixedAssetsRecommendations:n.fixedAssetsRecommendation,prepaidExpensesAccountHierarchy:n.prepaidExpensesAccountHierarchy,prepaidExpensesAccountList:n.prepaidExpensesAccountList,prepaidExpensesRecommendations:n.prepaidExpensesRecommendation,selectedAccruedExpensesAccountIds:n.accountMappingLocalData?.selectedAccruedExpensesAccountIds??[],selectedFixedAssetsAccountIds:n.accountMappingLocalData?.selectedFixedAssetsAccountIds??[],selectedPrepaidExpensesAccountIds:n.accountMappingLocalData?.selectedPrepaidExpensesAccountIds??[]},isAccruedExpensesFeatureEnabled:c}):null,l&&Q.isVendorsTabVisible(I.loggedInUserRoleMap)?t.jsxRuntimeExports.jsx(gke,{sectionId:wr,accountMappingView:n,containerRef:D.current,isSettingsPage:!0}):null]})})}):t.jsxRuntimeExports.jsx(RRn,{windowSize:A,children:[0,1,2].map(Ae=>t.jsxRuntimeExports.jsxs($Rn,{windowSize:A,children:[t.jsxRuntimeExports.jsx(fe,{width:200,height:20}),t.jsxRuntimeExports.jsx(fe,{width:300,height:p[3]}),t.jsxRuntimeExports.jsx(fe,{width:160,height:p[3]})]},Ae))})}),Se()===!0?t.jsxRuntimeExports.jsx(_t,{formId:$xe(Exe),primaryBtn:{label:Pi.footer.save,style:{width:"82px"},isLoading:n.saveState.fetchState==="In-Progress",isDisabled:n.saveState.fetchState==="In-Progress"},cancelBtn:{label:Pi.footer.cancel,style:{width:"82px"},shouldResetOnCancel:!0,onClick:()=>{L(!0)}}}):null,u?null:t.jsxRuntimeExports.jsx(eh,{isFooterRendered:Se(),meetingUrl:d})]})}const $xe=e=>`${e}_form`,Rxe=(e,n,i,r,a,l,c,d,u,m,x,h,f)=>{const{accountMappingLocalData:y,incomeRecommendation:C,expenseRecommendation:b,billPayRecommendation:E,reimbursementsRecommendation:$}=e,R=y?.selectedIncomeAccountId===C?.account?.accountId,S=y?.selectedExpenseAccountId===b?.account?.accountId,k=y?.selectedBillPayAccountId===E?.account?.accountId,T=y?.selectedReimbursementsAccountId===$?.account?.accountId,A=y?.selectedIncomeAccountId!=null?e.incomeAccountList.find(N=>N.accountId===y.selectedIncomeAccountId):void 0,I=y?.selectedExpenseAccountId!=null?e.expenseAccountList.find(N=>N.accountId===y.selectedExpenseAccountId):void 0,B=y?.selectedBillPayAccountId!=null?e.billPayAccountList.find(N=>N.accountId===y.selectedBillPayAccountId):void 0,L=y?.selectedReimbursementsAccountId!=null?e.reimbursementsAccountList.find(N=>N.accountId===y.selectedReimbursementsAccountId):void 0,P=y?.selectedPrepaidExpensesAccountIds!=null?e.prepaidExpensesAccountList.filter(N=>y.selectedPrepaidExpensesAccountIds.includes(N.accountId)):[],D=y?.selectedFixedAssetsAccountIds!=null?e.fixedAssetsAccountList.filter(N=>y.selectedFixedAssetsAccountIds.includes(N.accountId)):[],M=y?.selectedAccruedExpensesAccountIds!=null?e.accruedExpensesAccountList.filter(N=>y.selectedAccruedExpensesAccountIds.includes(N.accountId)):[],F=y?.selectedBankAccounts1099FilingAccountIds!=null?e.bankAccounts1099FilingAccountList.filter(N=>y.selectedBankAccounts1099FilingAccountIds.includes(N.accountId)):[],V=y?.selectedExpenseAccounts1099FilingAccountIds!=null?y.selectedExpenseAccounts1099FilingAccountIds.map(N=>({accountId:N.accountId??Pi.strings.empty,tax1099Config:{expenseType1099:N.expenseType??Pi.strings.empty,type1099:N.type1099??Pi.strings.empty,boxType:N.boxType??Pi.strings.empty}})):[];return{[wr]:{bankAccount:{selectedOptions:F.map(N=>N.qboId).filter(N=>N!=null),allOptions:u},expenseCategory1099:V.map(N=>({accountId:{selectedOption:e.expenseAccounts1099FilingAccountList.find(H=>H.accountId===N.accountId)?.qboId??Pi.strings.empty,allOptions:m},expenseType:{selectedOption:N?.tax1099Config?.expenseType1099??Pi.strings.empty,allOptions:x},type1099:{selectedOption:N?.tax1099Config?.type1099??Pi.strings.empty,allOptions:h},boxType:{selectedOption:N?.tax1099Config?.boxType??Pi.strings.empty,allOptions:CC(N?.tax1099Config?.type1099??Pi.strings.empty,f)}}))},[Zy]:{incomeAccount:{selectedOption:A?.qboId,allOptions:n},isRecommendedIncomeAccountChecked:R,expenseAccount:{selectedOption:I?.qboId,allOptions:i},isRecommendedExpenseAccountChecked:S},[Uv]:{billPayAccount:{selectedOption:B?.qboId,allOptions:r},isRecommendedBillPayAccountChecked:k},[Gv]:{reimbursementsAccount:{selectedOption:L?.qboId,allOptions:a},isRecommendedReimbursementsAccountChecked:T},[yIe]:{prepaidExpensesAccount:{selectedOptions:P.map(N=>N.qboId).filter(N=>N!=null),allOptions:l},fixedAssetsAccount:{selectedOptions:D.map(N=>N.qboId).filter(N=>N!=null),allOptions:c},accruedExpensesAccount:{selectedOptions:M.map(N=>N.qboId).filter(N=>N!=null),allOptions:d}}}},Af=mv.uncategorizedAccountsMapping.capitalizationSection.onboardingPopup,SRn=s(So)`
52921
+ `;function vRn({currentTenant:e,accountMappingView:n,isAccountingClassesEnabled:i,isAccountingClassesUpdateInProgress:r,isAccountingProjectsEnabled:a,isFiling1099FeatureEnabled:l,isAccruedExpensesFeatureEnabled:c,meetingUrl:d,isSettings:u=!1,onAccountingClassesToggle:m,onAccountMappingChange:x,onSaveClick:h,onBackClick:f,onClickMenuIcon:y,capitalizableAccounts:C,accountNamesById:b,capitalizationThreshold:E,currencySymbol:$="$",isCapitalizationFeatureEnabled:R=!1,isCapitalizationThresholdSaving:S=!1,onSaveCapitalizationThreshold:k}){const T=t.useTheme(),A=X(),I=ht(),[B,L]=g.useState(!1),P=Ye(n.saveState.fetchState),D=g.useRef(null),M=Q.hasFullOrAdminLevelAccess(I.loggedInUserRole??[]),F=Sf.accountingSettings,V=[{key:"accountingClasses",checked:i,isUpdateInProgress:r,title:F.accountingClasses.title,subTitle:F.accountingClasses.subTitle,onToggle:m,enableConfirmation:F.accountingClasses.enableConfirmation,disableConfirmation:F.accountingClasses.disableConfirmation,confirmLabel:F.confirmLabel,cancelLabel:F.cancelLabel},{key:"projects",checked:a,isUpdateInProgress:!1,readOnly:!0,title:F.projects.title,subTitle:F.projects.subTitle}],{incomeRecommendation:N,expenseRecommendation:H,billPayRecommendation:W,reimbursementsRecommendation:U,prepaidExpensesRecommendation:Y,fixedAssetsRecommendation:q,accruedExpensesRecommendation:Z}=n,G=N!=null?[N]:[],K=H!=null?[H]:[],J=W!=null?[W]:[],oe=U!=null?[U]:[],ee=Y,te=q,se=Z,ie=$n(n.incomeAccountHierachy,G,"Accounts"),re=$n(n.expenseAccountHierarchy,K,"Accounts"),ne=$n(n.billPayAccountHierarchy,J,"Accounts"),me=$n(n.reimbursementsAccountHierarchy,oe,"Accounts"),pe=$n(n.prepaidExpensesAccountHierarchy,ee,"Accounts"),je=$n(n.fixedAssetsAccountHierarchy,te,"Accounts"),ce=$n(n.accruedExpensesAccountHierarchy,se,"Accounts"),de=$n(n.bankAccounts1099FilingAccountHierarchy,[],"Accounts"),ue=$n(n.expenseAccounts1099FilingAccountHierarchy,[],"Categories"),le=Il(n.expenseTypeList,Sf.filing1099Section.allExpenseTypes),ae=Il(n.expense1099TypeList,Sf.filing1099Section.all1099Types),ge=Il(n.boxTypesList.int,Sf.filing1099Section.allBoxes),ye=Il(n.boxTypesList.misc,Sf.filing1099Section.allBoxes),he=Il(n.boxTypesList.nec,Sf.filing1099Section.allBoxes),Ce={int:ge,misc:ye,nec:he},we=t.useForm({mode:"all",defaultValues:Rxe(n,ie,re,ne,me,pe,je,ce,de,ue,le,ae,Ce),resetOptions:{keepDirtyValues:!0},values:Rxe(n,ie,re,ne,me,pe,je,ce,de,ue,le,ae,Ce)}),ve=we.handleSubmit(Ae=>{const _e=Ae[wr].bankAccount.selectedOptions.length,Te=Ae[wr].expenseCategory1099.length,Re=_e===0&&Te===1&&hke(Ae[wr].expenseCategory1099[0]),ke=Ae[wr].expenseCategory1099,Oe=[];ke.forEach((Me,Ie)=>{if(!Re){const Ne=Me.accountId?.selectedOption,Pe=Me.expenseType?.selectedOption,Qe=Me.type1099?.selectedOption,Je=Me.boxType?.selectedOption;(Ne==null||Ne==="")&&(we.setError(`${wr}.expenseCategory1099.${Ie}.accountId`,{type:"manual",message:"Account ID is required."}),Oe.push(`${Ie}.accountId`)),(Pe==null||Pe==="")&&(we.setError(`${wr}.expenseCategory1099.${Ie}.expenseType`,{type:"manual",message:"Expense Type is required."}),Oe.push(`${Ie}.expenseType`)),(Qe==null||Qe==="")&&(we.setError(`${wr}.expenseCategory1099.${Ie}.type1099`,{type:"manual",message:"Type 1099 is required."}),Oe.push(`${Ie}.type1099`)),(Je==null||Je==="")&&(we.setError(`${wr}.expenseCategory1099.${Ie}.boxType`,{type:"manual",message:"Box Type is required."}),Oe.push(`${Ie}.boxType`))}}),Oe.length===0&&(_e>0&&Te>1&&ok(Ae[wr].expenseCategory1099[0])||_e>0&&Te===1&&ok(Ae[wr].expenseCategory1099[0])||Re)&&h(Ae)}),Ee=async(Ae,_e)=>{if(Ae.includes("isRecommendedIncomeAccountChecked")){const Te=_e[Zy].isRecommendedIncomeAccountChecked===!0?n.incomeRecommendation?.account?.qboId??Pi.strings.empty:n.accountMappingLocalData?.previousIncomeAccount?.qboId;we.setValue(`${Zy}.incomeAccount`,{selectedOption:Te,allOptions:ie},{shouldValidate:!0})}if(Ae.includes("isRecommendedExpenseAccountChecked")){const Te=_e[Zy].isRecommendedExpenseAccountChecked===!0?n.expenseRecommendation?.account?.qboId??Pi.strings.empty:n.accountMappingLocalData?.previousExpenseAccount?.qboId;we.setValue(`${Zy}.expenseAccount`,{selectedOption:Te,allOptions:re},{shouldValidate:!0})}if(Ae.includes("isRecommendedBillPayAccountChecked")){const Te=_e[Uv].isRecommendedBillPayAccountChecked===!0?n.billPayRecommendation?.account?.qboId??Pi.strings.empty:n.accountMappingLocalData?.previousBillPayAccount?.qboId;we.setValue(`${Uv}.billPayAccount`,{selectedOption:Te,allOptions:ne},{shouldValidate:!0})}if(Ae.includes("isRecommendedReimbursementsAccountChecked")){const Te=_e[Gv].isRecommendedReimbursementsAccountChecked===!0?n.reimbursementsRecommendation?.account?.qboId??Pi.strings.empty:n.accountMappingLocalData?.previousReimbursementsAccount?.qboId;we.setValue(`${Gv}.reimbursementsAccount`,{selectedOption:Te,allOptions:me},{shouldValidate:!0})}if(Ae.includes("filing1099Section.expenseCategory1099")){const Te=Ae.split(".").find(Re=>!isNaN(Number(Re)));if(Te!==void 0){const Re=parseInt(Te,10),ke=_e[wr].expenseCategory1099[Re];ke.accountId?.selectedOption!=null&&we.clearErrors(`${wr}.expenseCategory1099.${Re}.accountId`),ke.expenseType?.selectedOption!=null&&we.clearErrors(`${wr}.expenseCategory1099.${Re}.expenseType`),ke.type1099?.selectedOption!=null&&we.clearErrors(`${wr}.expenseCategory1099.${Re}.type1099`),ke.boxType?.selectedOption!=null&&we.clearErrors(`${wr}.expenseCategory1099.${Re}.boxType`)}}if(Ae.includes("type1099")){const Te=Ae?.split(".")?.find(Re=>!isNaN(Number(Re)));if(Te!=null){const Re=parseInt(Te,10),ke=_e[wr].expenseCategory1099[Re].type1099?.selectedOption;we.setValue(`${wr}.expenseCategory1099.${Re}.boxType`,{selectedOption:Pi.strings.empty,allOptions:CC(ke??Pi.strings.empty,Ce)},{shouldValidate:!0})}}x(_e)};g.useEffect(()=>{P==="In-Progress"&&n.saveState.fetchState==="Completed"&&f?.()},[P,n.saveState.fetchState,f]),g.useEffect(()=>{const Ae=we.watch((_e,{name:Te})=>{Te!=null&&_e!=null&&t.defer(()=>Ee(Te,_e))});return()=>{Ae.unsubscribe()}});const Se=()=>n.fetchState==="Completed"&&(n.accountMappingLocalData?.selectedExpenseAccountId!==n.accountMappingLocalData?.previousExpenseAccount?.accountId||n.accountMappingLocalData?.selectedIncomeAccountId!==n.accountMappingLocalData?.previousIncomeAccount?.accountId||n.accountMappingLocalData?.selectedBillPayAccountId!==n.accountMappingLocalData?.previousBillPayAccount?.accountId||n.accountMappingLocalData?.selectedReimbursementsAccountId!==n.accountMappingLocalData?.previousReimbursementsAccount?.accountId||c2(n.accountMappingLocalData?.selectedPrepaidExpensesAccountIds,n.accountMappingLocalData?.previousPrepaidExpensesAccount)||c2(n.accountMappingLocalData?.selectedFixedAssetsAccountIds,n.accountMappingLocalData?.previousFixedAssetsAccount)||c2(n.accountMappingLocalData?.selectedAccruedExpensesAccountIds,n.accountMappingLocalData?.previousAccruedExpensesAccount)||c2(n.accountMappingLocalData?.selectedBankAccounts1099FilingAccountIds,n.accountMappingLocalData?.previousBankAccounts1099FilingAccount)||xke(n.accountMappingLocalData?.selectedExpenseAccounts1099FilingAccountIds,n.accountMappingLocalData?.previousExpenseAccounts1099FilingAccount)),$e=n.fetchState!=="Completed",Be={onOkClick:()=>{L(!1),f?.(),we.reset()},onCancelClick:()=>{L(!1)}};return t.jsxRuntimeExports.jsxs(bRn,{ref:D,children:[t.jsxRuntimeExports.jsx(Rt,{title:u?Pi.settings.title.accounting:Sf.title,onBackClick:f,backgroundColor:T.colors.grey4,showBackButton:!u,showMenuIcon:u?A==="medium-compact"||A==="small":!1,onClickMenuIcon:y,source:"UncategorizedAccountsMappingPage"}),B===!0?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:Pi.confirmationPopup.discardTitle}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:Pi.confirmationPopup.discardDescription}),primaryButtonText:Pi.confirmationPopup.discard,secondaryButtonText:Pi.confirmationPopup.cancel,action:Be,proceedButtonVariant:"destructive"}):null,t.jsxRuntimeExports.jsx(wRn,{windowSize:A,children:$e===!1?t.jsxRuntimeExports.jsx(t.FormProvider,{...we,children:t.jsxRuntimeExports.jsx("form",{id:$xe(Exe),onSubmit:ve,children:t.jsxRuntimeExports.jsxs(ERn,{windowSize:A,children:[M?t.jsxRuntimeExports.jsx(j$n,{toggles:V}):null,R&&M?t.jsxRuntimeExports.jsx(gIe,{capitalizableAccounts:C,accountNamesById:b??{},capitalizationThreshold:E,currencySymbol:$,isSaving:S,onSaveThreshold:k??(()=>{})}):null,M?t.jsxRuntimeExports.jsx(fRn,{sectionId:Zy,containerRef:D.current,accountMappingView:n}):null,Q.hasBillPayAccessible(e,I.loggedInUserRoleMap)?t.jsxRuntimeExports.jsx(S$n,{sectionId:Uv,containerRef:D.current,accountMappingView:n}):null,Q.hasReimbursementAccessible(e,I.loggedInUserRoleMap)?t.jsxRuntimeExports.jsx(cRn,{sectionId:Gv,containerRef:D.current,accountMappingView:n}):null,M?t.jsxRuntimeExports.jsx(fIe,{sectionId:yIe,vendorAccountMappingSection:{accruedExpensesAccountHierarchy:n.accruedExpensesAccountHierarchy,accruedExpensesAccountList:n.accruedExpensesAccountList,accruedExpensesRecommendations:n.accruedExpensesRecommendation,fixedAssetsAccountHierarchy:n.fixedAssetsAccountHierarchy,fixedAssetsAccountList:n.fixedAssetsAccountList,fixedAssetsRecommendations:n.fixedAssetsRecommendation,prepaidExpensesAccountHierarchy:n.prepaidExpensesAccountHierarchy,prepaidExpensesAccountList:n.prepaidExpensesAccountList,prepaidExpensesRecommendations:n.prepaidExpensesRecommendation,selectedAccruedExpensesAccountIds:n.accountMappingLocalData?.selectedAccruedExpensesAccountIds??[],selectedFixedAssetsAccountIds:n.accountMappingLocalData?.selectedFixedAssetsAccountIds??[],selectedPrepaidExpensesAccountIds:n.accountMappingLocalData?.selectedPrepaidExpensesAccountIds??[]},isAccruedExpensesFeatureEnabled:c}):null,l&&Q.isVendorsTabVisible(I.loggedInUserRoleMap)?t.jsxRuntimeExports.jsx(gke,{sectionId:wr,accountMappingView:n,containerRef:D.current,isSettingsPage:!0}):null]})})}):t.jsxRuntimeExports.jsx(RRn,{windowSize:A,children:[0,1,2].map(Ae=>t.jsxRuntimeExports.jsxs($Rn,{windowSize:A,children:[t.jsxRuntimeExports.jsx(fe,{width:200,height:20}),t.jsxRuntimeExports.jsx(fe,{width:300,height:p[3]}),t.jsxRuntimeExports.jsx(fe,{width:160,height:p[3]})]},Ae))})}),Se()===!0?t.jsxRuntimeExports.jsx(_t,{formId:$xe(Exe),primaryBtn:{label:Pi.footer.save,style:{width:"82px"},isLoading:n.saveState.fetchState==="In-Progress",isDisabled:n.saveState.fetchState==="In-Progress"},cancelBtn:{label:Pi.footer.cancel,style:{width:"82px"},shouldResetOnCancel:!0,onClick:()=>{L(!0)}}}):null,u?null:t.jsxRuntimeExports.jsx(eh,{isFooterRendered:Se(),meetingUrl:d})]})}const $xe=e=>`${e}_form`,Rxe=(e,n,i,r,a,l,c,d,u,m,x,h,f)=>{const{accountMappingLocalData:y,incomeRecommendation:C,expenseRecommendation:b,billPayRecommendation:E,reimbursementsRecommendation:$}=e,R=y?.selectedIncomeAccountId===C?.account?.accountId,S=y?.selectedExpenseAccountId===b?.account?.accountId,k=y?.selectedBillPayAccountId===E?.account?.accountId,T=y?.selectedReimbursementsAccountId===$?.account?.accountId,A=y?.selectedIncomeAccountId!=null?e.incomeAccountList.find(N=>N.accountId===y.selectedIncomeAccountId):void 0,I=y?.selectedExpenseAccountId!=null?e.expenseAccountList.find(N=>N.accountId===y.selectedExpenseAccountId):void 0,B=y?.selectedBillPayAccountId!=null?e.billPayAccountList.find(N=>N.accountId===y.selectedBillPayAccountId):void 0,L=y?.selectedReimbursementsAccountId!=null?e.reimbursementsAccountList.find(N=>N.accountId===y.selectedReimbursementsAccountId):void 0,P=y?.selectedPrepaidExpensesAccountIds!=null?e.prepaidExpensesAccountList.filter(N=>y.selectedPrepaidExpensesAccountIds.includes(N.accountId)):[],D=y?.selectedFixedAssetsAccountIds!=null?e.fixedAssetsAccountList.filter(N=>y.selectedFixedAssetsAccountIds.includes(N.accountId)):[],M=y?.selectedAccruedExpensesAccountIds!=null?e.accruedExpensesAccountList.filter(N=>y.selectedAccruedExpensesAccountIds.includes(N.accountId)):[],F=y?.selectedBankAccounts1099FilingAccountIds!=null?e.bankAccounts1099FilingAccountList.filter(N=>y.selectedBankAccounts1099FilingAccountIds.includes(N.accountId)):[],V=y?.selectedExpenseAccounts1099FilingAccountIds!=null?y.selectedExpenseAccounts1099FilingAccountIds.map(N=>({accountId:N.accountId??Pi.strings.empty,tax1099Config:{expenseType1099:N.expenseType??Pi.strings.empty,type1099:N.type1099??Pi.strings.empty,boxType:N.boxType??Pi.strings.empty}})):[];return{[wr]:{bankAccount:{selectedOptions:F.map(N=>N.qboId).filter(N=>N!=null),allOptions:u},expenseCategory1099:V.map(N=>({accountId:{selectedOption:e.expenseAccounts1099FilingAccountList.find(H=>H.accountId===N.accountId)?.qboId??Pi.strings.empty,allOptions:m},expenseType:{selectedOption:N?.tax1099Config?.expenseType1099??Pi.strings.empty,allOptions:x},type1099:{selectedOption:N?.tax1099Config?.type1099??Pi.strings.empty,allOptions:h},boxType:{selectedOption:N?.tax1099Config?.boxType??Pi.strings.empty,allOptions:CC(N?.tax1099Config?.type1099??Pi.strings.empty,f)}}))},[Zy]:{incomeAccount:{selectedOption:A?.qboId,allOptions:n},isRecommendedIncomeAccountChecked:R,expenseAccount:{selectedOption:I?.qboId,allOptions:i},isRecommendedExpenseAccountChecked:S},[Uv]:{billPayAccount:{selectedOption:B?.qboId,allOptions:r},isRecommendedBillPayAccountChecked:k},[Gv]:{reimbursementsAccount:{selectedOption:L?.qboId,allOptions:a},isRecommendedReimbursementsAccountChecked:T},[yIe]:{prepaidExpensesAccount:{selectedOptions:P.map(N=>N.qboId).filter(N=>N!=null),allOptions:l},fixedAssetsAccount:{selectedOptions:D.map(N=>N.qboId).filter(N=>N!=null),allOptions:c},accruedExpensesAccount:{selectedOptions:M.map(N=>N.qboId).filter(N=>N!=null),allOptions:d}}}},Af=mv.uncategorizedAccountsMapping.capitalizationSection.onboardingPopup,SRn=s(So)`
52922
52922
  && {
52923
52923
  padding: ${o.sp5} ${o.sp7} 0 ${o.sp7};
52924
52924
  }
@@ -54828,7 +54828,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
54828
54828
  overflow-wrap: break-word;
54829
54829
  white-space: normal;
54830
54830
  word-break: break-all;
54831
- `,cBn=()=>null,dBn=()=>null,uBn=()=>null,pBn=()=>null;function HW(e,n,i){return mBn(e,n,{vendor_id:i.vendorId,attachment_ids:i.attachmentIds})}async function mBn(e,n,i){const r=`${e}?query=${encodeURIComponent(JSON.stringify(i))}`,a=O.getLocalizedStrings().downloadReport;try{const l=await fetch(r,{method:"GET",headers:{"zeni-user-id":n.userId,"zeni-tenant-id":n.tenantId,"zeni-session-id":n.sessionId}});if(l.ok)return await l.json();console.error(`${a.reportErrorMessage} ${l.statusText}`)}catch(l){throw console.error(`${a.reportErrorMessage} ${JSON.stringify(l)}`),l}return[]}const FY=(e,n,i,r,a)=>{const l=O.getLocalizedStrings().vendorReview.firstReview,c=[];return i.length>0&&c.push({label:l.vendorDropdown.recommendedVendor,options:[]}),i.forEach(u=>{c[0].options.push({label:u.globalMerchantName,value:u.globalMerchantId??u.globalMerchantName,isVisible:!0,isDisabled:n,info:u.reason,isOptionRecommended:!0})}),c.length&&c[0].options.length===0&&c.pop(),c.push({label:l.vendorDropdown.allVendors,options:e.map(u=>({label:u.globalMerchantName,value:u.globalMerchantId,isVisible:!0}))}),r!=null&&c[c.length-1].options.push({label:r.name,value:r.id,isVisible:!1,isDisabled:n}),a!=null&&c[c.length-1].options.push({label:a.name,value:a.id,isVisible:!1}),c},Sl={containerPaddingLeft:new w(p[3],p[4]),containerPaddingRight:new w(p[3],p[4]),containerPaddingTop:new w(p[2],p[3]),containerPaddingBottom:new w(p[2],p[3]),containerMarginLeft:new w(p[4],p[8]),nameLogoWidth:new w(p[6],p[6]),nameLogoHeight:new w(p[6],p[6]),logoToValueGap:new w(p[2],p[2]),logoHeightAndWidth:new w(p[3],p[4]),webkitLineClamp:new w(2,2,1,1,1)},{common:Gd,vendorReview:{firstReview:A3}}=O.getLocalizedStrings(),xBn=({analytics:e,authParams:n,attachmentEndpoint:i,onClickCancel:r,onClickRenameOption:a,onClickSave:l,onClearGlobalMerchantAutoCompleteResults:c,onVendorNameClick:d,rowData:u,rowIndex:m,searchAutoComplete:x,sectionId:h,setCurrentVendorInAction:f})=>{const y=String(m),C=Ie=>_(Ie,y),b=t.useTheme(),E=X(),$=ht(),[R,S]=g.useState(!1),[k,T]=g.useState(0),[A,I]=g.useState(!1),{globalMerchantAutoCompleteView:B}=x.autoCompleteData,L=u.currentSelection!=null,[P,D]=g.useState(!1),{transactionAttachments:M}=u,[F,V]=g.useState([]),[N,H]=g.useState(null),[W,U]=g.useState(0),[Y,q]=g.useState(0),[Z,G]=g.useState(0),K=Ie=>{G(Ie),D(!0),ie(M[Ie]),H(F[Ie])};function J(Ie){U(Ie.targetTouches[0].clientX)}function oe(Ie){q(Ie.targetTouches[0].clientX)}function ee(Ie){return Ie<0?M.length+Ie:Ie%M.length}function te(){W-Y>50&&Y!==0&&Z<M.length-1?(K(ee(Z+1)),U(0),q(0)):W-Y<-50&&Y!==0&&Z>0&&(K(ee(Z-1)),U(0),q(0))}const[se,ie]=g.useState(M[0]),re=()=>{D(!1),H(null),V([]),M.length>0&&ie(M[0])},ne=()=>{V([]),T(Ie=>{const Ne=Ie<M.length-1?Ie+1:0;return ce(u.vendorId,Ne),Ne})},me=()=>{V([]),T(Ie=>{const Ne=Ie>0?Ie-1:M.length-1;return ce(u.vendorId,Ne),Ne})},pe=M.length===0,je=M.map(Ie=>Ie.id),ce=(Ie,Ne)=>{D(!0);async function Pe(Je){return await HW(i,n,Je)}const Ue=[je[Ne]];Pe({vendorId:Ie,attachmentIds:Ue}).then(Je=>{V(Je),ie(M[Ne]),M.length>0&&H(Je[0])})},de=Ie=>{D(!0);async function Ne(Pe){return await HW(i,n,Pe)}Ne({vendorId:Ie,attachmentIds:je}).then(Pe=>{V(Pe),M.length>0&&H(Pe[0])})},ue=g.useMemo(()=>u.currentSelection==="customMerchant"&&u.selectedVendor.id!=null&&u.selectedVendor.name!=null?{id:u.selectedVendor.id,name:u.selectedVendor.name}:void 0,[u]),le=u.status.code==="under_review"||u.saveStatus.fetchState==="In-Progress",ae=u.status.code==="merge_in_qbo"||u.status.code==="merge_in_netsuite",ge=ae||le,ye=Ie=>{let Ne=Ie.websiteUrl?.toString();if(Ne){if(Ne.includes("http")||(Ne="https://".concat(Ne)),u.currentVendor!=null){const Pe=Ie?.globalMerchantName??null;e.trackVendorReviewWebsiteOpened({reviewSource:"tenant_review",vendorName:u.currentVendor.name,wasRecommendationAvailable:!!Pe,recommendedVendorName:Pe,recommendedVendorReason:Ie.reason??null,vendorWebsite:Ne})}window.open(Ne,"_blank")}},he=u.currentVendor!=null?{label:{label:u.currentVendor?.name,style:{display:"block",overflow:"hidden",textOverflow:"ellipsis"}},checkBoxField:{name:qO(h,Th,"retain"),defaultChecked:u.currentSelection==="retain"},tooltipProps:{text:u.currentVendor?.name},isDisabled:ge}:void 0,Ce=g.useCallback(Ie=>Ie.logo!=null?t.jsxRuntimeExports.jsxs(RBn,{children:[t.jsxRuntimeExports.jsx(Cu,{photoUrl:Ie.logo.toString(),styles:{width:Sl.logoHeightAndWidth.valuePx(E),height:Sl.logoHeightAndWidth.valuePx(E)},placeholder:{width:Sl.logoHeightAndWidth.value(E),height:Sl.logoHeightAndWidth.value(E)},fallbackAvatar:t.jsxRuntimeExports.jsx(ZO,{children:t.jsxRuntimeExports.jsx(Jo,{name:Ie.globalMerchantName})})}),t.jsxRuntimeExports.jsx(Bf,{windowSize:E,isLastItem:!1,children:t.jsxRuntimeExports.jsx(Ehe,{children:Ie.globalMerchantName})})]}):t.jsxRuntimeExports.jsx(Bf,{windowSize:E,isLastItem:!1,children:t.jsxRuntimeExports.jsx(Ehe,{children:Ie.globalMerchantName})}),[E]),we=u.recommendations.map((Ie,Ne)=>{const Pe=Ce(Ie),Je=`recommended${ZV(Ne)}`;return{label:{label:Pe,style:{display:"block",overflow:"hidden",textOverflow:"ellipsis"}},checkBoxField:{name:qO(h,Th,Je),defaultChecked:u.currentSelection===Je},tooltipProps:{text:Ie.websiteUrl?.toString().length?t.jsxRuntimeExports.jsx(hBn,{recommendation:Ie,rowSuffix:y,onRedirectionToRecommendedMerchantWebsiteUrl:()=>ye(Ie)}):Ie.globalMerchantName,maxWidth:"360px"},isDisabled:ge,fieldName:Je}}),ve=g.useMemo(()=>({defaultOptions:FY(B.globalMerchants,ae,u.recommendations,u.currentVendor,ue),selectedOption:u.selectedVendor.id}),[B,u,ue,ae]),Ee=()=>{S(!1),c()},Se=Ie=>{const Ne=u.currentVendor?.name,Pe=[...B.globalMerchants.map(Ue=>Ue.globalMerchantName),...u.recommendations.map(Ue=>Ue.globalMerchantName)];return u.currentVendor==null||Pe.includes(Ie)||Ne===Ie?null:Ie.trim().length>0?A3.vendorDropdown.fromOldName.replace("__old_name__",Ne??"")+" "+A3.vendorDropdown.toNewName.replace("__new_name__",Ie??""):null},$e=Ie=>{Ie.stopPropagation(),l(u.vendorId)},Be=Ie=>{Ie.stopPropagation(),r(h)},Ae=Ie=>{Ie.stopPropagation(),S(!0)},_e=()=>{u.selectedVendor.id!=null&&u.vendorQboId!=null&&d(u.vendorId,u.vendorQboId)},Te=Ie=>{u.selectedVendor.id!=null&&a(u.selectedVendor.id,Ie),S(!1)},Re=(Ie,Ne)=>{f(u.vendorId),x.loadOptions(Ie,Ne)},ke=Ie=>u.recommendations.find(Pe=>Pe.globalMerchantId===Ie||Pe.globalMerchantName===Ie)?.reason??"",Oe=()=>{l(u.vendorId,!0)},Me=()=>{l(u.vendorId,!1,!0)};return t.jsxRuntimeExports.jsxs(fBn,{"data-testid":C("vendor-first-review-row"),windowSize:E,isDisabled:le,isRowActive:L,children:[t.jsxRuntimeExports.jsx(ly,{"data-testid":C("vendor-first-review-row-column-vendor"),windowSize:E,width:25,isDisabled:le,gap:Sl.logoToValueGap,children:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:R===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:Ee,children:t.jsxRuntimeExports.jsx(wBn,{windowSize:E,children:t.jsxRuntimeExports.jsx(ALn,{name:qO(h,bg),placeholder:Gd.strings.empty,defaultValue:ve,autoFocus:!0,customStyleConfig:{valueContainer:()=>({justifyContent:"flex-start",margin:`${o.sp0} ${o.sp3}`}),singleValue:()=>({display:"flex",alignItems:"center",color:b.colors.hero,"&:hover":{color:b.colors.primary}})},style:{display:"flex",flexGrow:1,width:"-webkit-fill-available",height:"20px",cursor:"inherit",alignItems:"center"},valueToInfo:ke,menuIsOpen:R,getRenameOptionText:Se,onMenuClose:Ee,loadOptions:Re,isOptionRemovable:!1,onClickRenameOption:Te})})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[u.selectedVendor?.logo!=null&&u.selectedVendor.name!=null?t.jsxRuntimeExports.jsx(Cu,{photoUrl:u.selectedVendor.logo.toString(),styles:{width:Sl.nameLogoWidth.valuePx(E),height:Sl.nameLogoHeight.valuePx(E)},fallbackAvatar:t.jsxRuntimeExports.jsx(ZO,{children:t.jsxRuntimeExports.jsx(Jo,{name:u.selectedVendor.name})})}):u.selectedVendor.name!=null?t.jsxRuntimeExports.jsx(ZO,{children:t.jsxRuntimeExports.jsx(Jo,{name:u.selectedVendor.name})}):null,t.jsxRuntimeExports.jsx(jBn,{onClick:_e,"data-testid":C("vendor-first-review-row-vendor-name"),children:t.jsxRuntimeExports.jsxs(CBn,{children:[u.selectedVendor.name?t.jsxRuntimeExports.jsx(Le,{enterDelay:600,display:"block",placement:"bottom",title:u.selectedVendor.name,children:t.jsxRuntimeExports.jsx(jhe,{children:u.selectedVendor.name})}):t.jsxRuntimeExports.jsx(jhe,{children:Gd.strings.hyphen}),t.jsxRuntimeExports.jsx(Le,{display:"block",placement:"bottom",title:Gd.tooltips.editName,enterDelay:600,children:t.jsxRuntimeExports.jsx(bBn,{onClick:Ae,"data-testid":C("vendor-first-review-row-edit-icon")})})]})})]})})}),t.jsxRuntimeExports.jsx(ly,{"data-testid":C("vendor-first-review-row-column-receipts"),windowSize:E,width:p[1],isDisabled:!1,children:M.length>0?t.jsxRuntimeExports.jsx(Bf,{windowSize:E,className:"vendor-first-review-row-item",children:t.jsxRuntimeExports.jsx(vBn,{isDisabled:pe,onClick:()=>pe===!1?de(u.vendorId):null,"data-testid":C("vendor-first-review-row-view-receipts"),children:t.jsxRuntimeExports.jsx(Le,{display:"block",placement:"top",title:A3.viewRecipts,enterDelay:600,children:t.jsxRuntimeExports.jsx(SBn,{children:t.jsxRuntimeExports.jsx(pr,{width:o.sp3,height:o.sp3})})})})}):t.jsxRuntimeExports.jsx(Bf,{className:"vendor-first-review-row-item","data-testid":C("vendor-first-review-row-column-receipts-empty"),windowSize:E,children:Gd.strings.hyphen})}),t.jsxRuntimeExports.jsx(ly,{"data-testid":C("vendor-first-review-row-column-recommendations"),windowSize:E,width:25,isDisabled:ge,gap:Sl.logoToValueGap,children:we.map((Ie,Ne)=>t.jsxRuntimeExports.jsxs(g.Fragment,{children:[t.jsxRuntimeExports.jsx(Bf,{"data-testid":_("vendor-first-review-row-recommendation-option",`${y}-${Ne}`),windowSize:E,className:"vendor-first-review-row-item",children:t.jsxRuntimeExports.jsx(Pp,{isHighlighted:!0,defaultChecked:u.currentSelection===Ie.fieldName,label:Ie.label,checkBoxField:Ie.checkBoxField,isDisabled:Ie.isDisabled,tooltipProps:Ie.tooltipProps})}),Ne<we.length-1?t.jsxRuntimeExports.jsxs(whe,{children:[" ",Gd.texts.or]}):null]},Ie.fieldName))}),t.jsxRuntimeExports.jsx(ly,{"data-testid":C("vendor-first-review-row-column-retain"),windowSize:E,width:20,isDisabled:ge,children:u.currentVendor!=null&&he!=null?t.jsxRuntimeExports.jsx(Bf,{"data-testid":C("vendor-first-review-row-retain-option"),windowSize:E,className:"vendor-first-review-row-item",children:t.jsxRuntimeExports.jsx(Pp,{defaultChecked:u.currentSelection==="retain",label:he.label,checkBoxField:he.checkBoxField,isDisabled:he.isDisabled,tooltipProps:he.tooltipProps,backgroundDefaultColor:b.colors.grey5})}):null}),t.jsxRuntimeExports.jsx(ly,{"data-currentVendorName":u.currentVendor?.name,"data-mergeVendorName":u.mergeVendorName,"data-testid":C("vendor-first-review-row-column-status"),windowSize:E,width:L?10:25,isDisabled:le,children:t.jsxRuntimeExports.jsxs(Bf,{windowSize:E,className:"vendor-first-review-row-item",children:[t.jsxRuntimeExports.jsxs(whe,{children:[t.jsxRuntimeExports.jsx(yBn,{isDisabled:!1,clickable:!1,statusMergeInQBO:ae,children:t.jsxRuntimeExports.jsx(fhe,{children:u.status.name})}),ae&&u.currentVendor!=null&&u.mergeVendorName!=null?t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(gBn,{vendorName:u.currentVendor.name,mergeVendorName:u.mergeVendorName,statusCode:u.status}),maxWidth:"312px",children:t.jsxRuntimeExports.jsx(fn,{width:o.sp3,height:o.sp3})}):null]}),u.lastUpdatedVendorNameByUser!=null&&ae?t.jsxRuntimeExports.jsx(fhe,{children:`${Gd.by} ${cn(u.lastUpdatedVendorNameByUser)}`}):null]})}),t.jsxRuntimeExports.jsxs(ly,{className:"vendor-first-review-action-items","data-testid":C("vendor-first-review-row-column-actions"),windowSize:E,width:L?15:0,isDisabled:le,children:[t.jsxRuntimeExports.jsx(Ge,{dataTestId:C("vendor-first-review-row-cancel"),disabled:!L,label:Gd.footer.cancel,onClick:Be,size:"small",style:{height:"100%"},variant:"outline"}),t.jsxRuntimeExports.jsx(yhe,{space:o.sp0}),t.jsxRuntimeExports.jsx(Ge,{dataTestId:C("vendor-first-review-row-confirm"),disabled:!L,label:Gd.texts.confirm,loading:u.saveStatus.fetchState==="In-Progress",onClick:$e,size:"small",style:{height:"100%"},variant:"primary"}),t.jsxRuntimeExports.jsx(yhe,{space:o.sp0}),t.jsxRuntimeExports.jsx(EBn,{children:u.currentSelection==null?t.jsxRuntimeExports.jsx(YC,{isMenuOpen:A,menuItems:t.jsxRuntimeExports.jsxs($Bn,{children:[t.jsxRuntimeExports.jsxs(Che,{"data-testid":C("vendor-first-review-row-mark-as-employee-menu-item"),onClick:()=>{I(!1),Oe()},children:[t.jsxRuntimeExports.jsx(bhe,{}),A3.rowMoreActions.markAsEmployee]}),t.jsxRuntimeExports.jsxs(Che,{"data-testid":C("vendor-first-review-row-mark-as-contractor-menu-item"),onClick:()=>{I(!1),Me()},children:[t.jsxRuntimeExports.jsx(bhe,{}),A3.rowMoreActions.markAsLocalContractor]})]}),menuTriggerDataTestId:C("vendor-first-review-row-more-menu-trigger"),setIsMenuOpen:I}):null})]}),P&&M.length>0?Ns.createPortal(t.jsxRuntimeExports.jsx(Q5,{allFiles:F,fileSource:N,file:se,title:se.fileName,attachments:M,showNavigation:$.connectionName==="netsuite",setFileSource:H,setShowFullScreenView:D,onCrossClick:re,onNextClick:ne,onPreviousClick:me,setSelectedFileAttachment:ie,handleTouchStart:J,handleTouchMove:oe,handleTouchEnd:te}),document.body):null]})},hBn=({recommendation:e,rowSuffix:n,onRedirectionToRecommendedMerchantWebsiteUrl:i})=>t.jsxRuntimeExports.jsxs(HIe,{setMaxHeight:!0,children:[t.jsxRuntimeExports.jsxs(pk,{children:[t.jsxRuntimeExports.jsx(fj,{children:Gd.labels.name}),t.jsxRuntimeExports.jsx(mk,{children:e.globalMerchantName})]}),t.jsxRuntimeExports.jsxs(pk,{children:[t.jsxRuntimeExports.jsx(fj,{children:Gd.labels.websiteURL}),t.jsxRuntimeExports.jsx(mk,{className:"websiteUrlTooltipText",onClick:i,"data-testid":_("vendor-first-review-row-website-url-tooltip-content",n),children:e.websiteUrl?.toString()})]})]}),gBn=({vendorName:e,mergeVendorName:n,statusCode:i})=>t.jsxRuntimeExports.jsxs(HIe,{setMaxHeight:!1,children:[i.code==="merge_in_qbo"?t.jsxRuntimeExports.jsx(fj,{children:A3.tooltip.mergeInQBOText}):null,i.code==="merge_in_netsuite"?t.jsxRuntimeExports.jsx(fj,{children:A3.tooltip.mergeInNetSuiteText}):null,t.jsxRuntimeExports.jsxs(pk,{children:[t.jsxRuntimeExports.jsx(fj,{children:Gd.labels.vendor}),t.jsxRuntimeExports.jsx(mk,{children:e})]}),t.jsxRuntimeExports.jsxs(pk,{children:[t.jsxRuntimeExports.jsx(fj,{children:Gd.labels.mergedTo}),t.jsxRuntimeExports.jsx(mk,{children:n})]})]}),fBn=s.div`
54831
+ `,cBn=()=>null,dBn=()=>null,uBn=()=>null,pBn=()=>null;function HW(e,n,i){return mBn(e,n,{vendor_id:i.vendorId,attachment_ids:i.attachmentIds})}async function mBn(e,n,i){const r=`${e}?query=${encodeURIComponent(JSON.stringify(i))}`,a=O.getLocalizedStrings().downloadReport;try{const l=await fetch(r,{method:"GET",headers:{"zeni-user-id":n.userId,"zeni-tenant-id":n.tenantId,"zeni-session-id":n.sessionId}});if(l.ok)return await l.json();console.error(`${a.reportErrorMessage} ${l.statusText}`)}catch(l){throw console.error(`${a.reportErrorMessage} ${JSON.stringify(l)}`),l}return[]}const FY=(e,n,i,r,a)=>{const l=O.getLocalizedStrings().vendorReview.firstReview,c=[];return i.length>0&&c.push({label:l.vendorDropdown.recommendedVendor,options:[]}),i.forEach(u=>{c[0].options.push({label:u.globalMerchantName,value:u.globalMerchantId??u.globalMerchantName,isVisible:!0,isDisabled:n,info:u.reason,isOptionRecommended:!0})}),c.length&&c[0].options.length===0&&c.pop(),c.push({label:l.vendorDropdown.allVendors,options:e.map(u=>({label:u.globalMerchantName,value:u.globalMerchantId,isVisible:!0}))}),r!=null&&c[c.length-1].options.push({label:r.name,value:r.id,isVisible:!1,isDisabled:n}),a!=null&&c[c.length-1].options.push({label:a.name,value:a.id,isVisible:!1}),c},Sl={containerPaddingLeft:new w(p[3],p[4]),containerPaddingRight:new w(p[3],p[4]),containerPaddingTop:new w(p[2],p[3]),containerPaddingBottom:new w(p[2],p[3]),containerMarginLeft:new w(p[4],p[8]),nameLogoWidth:new w(p[6],p[6]),nameLogoHeight:new w(p[6],p[6]),logoToValueGap:new w(p[2],p[2]),logoHeightAndWidth:new w(p[3],p[4]),webkitLineClamp:new w(2,2,1,1,1)},{common:Gd,vendorReview:{firstReview:A3}}=O.getLocalizedStrings(),xBn=({analytics:e,authParams:n,attachmentEndpoint:i,onClickCancel:r,onClickRenameOption:a,onClickSave:l,onClearGlobalMerchantAutoCompleteResults:c,onVendorNameClick:d,rowData:u,rowIndex:m,searchAutoComplete:x,sectionId:h,setCurrentVendorInAction:f})=>{const y=String(m),C=Ie=>_(Ie,y),b=t.useTheme(),E=X(),$=ht(),[R,S]=g.useState(!1),[k,T]=g.useState(0),[A,I]=g.useState(!1),{globalMerchantAutoCompleteView:B}=x.autoCompleteData,L=u.currentSelection!=null,[P,D]=g.useState(!1),{transactionAttachments:M}=u,[F,V]=g.useState([]),[N,H]=g.useState(null),[W,U]=g.useState(0),[Y,q]=g.useState(0),[Z,G]=g.useState(0),K=Ie=>{G(Ie),D(!0),ie(M[Ie]),H(F[Ie])};function J(Ie){U(Ie.targetTouches[0].clientX)}function oe(Ie){q(Ie.targetTouches[0].clientX)}function ee(Ie){return Ie<0?M.length+Ie:Ie%M.length}function te(){W-Y>50&&Y!==0&&Z<M.length-1?(K(ee(Z+1)),U(0),q(0)):W-Y<-50&&Y!==0&&Z>0&&(K(ee(Z-1)),U(0),q(0))}const[se,ie]=g.useState(M[0]),re=()=>{D(!1),H(null),V([]),M.length>0&&ie(M[0])},ne=()=>{V([]),T(Ie=>{const Ne=Ie<M.length-1?Ie+1:0;return ce(u.vendorId,Ne),Ne})},me=()=>{V([]),T(Ie=>{const Ne=Ie>0?Ie-1:M.length-1;return ce(u.vendorId,Ne),Ne})},pe=M.length===0,je=M.map(Ie=>Ie.id),ce=(Ie,Ne)=>{D(!0);async function Pe(Je){return await HW(i,n,Je)}const Qe=[je[Ne]];Pe({vendorId:Ie,attachmentIds:Qe}).then(Je=>{V(Je),ie(M[Ne]),M.length>0&&H(Je[0])})},de=Ie=>{D(!0);async function Ne(Pe){return await HW(i,n,Pe)}Ne({vendorId:Ie,attachmentIds:je}).then(Pe=>{V(Pe),M.length>0&&H(Pe[0])})},ue=g.useMemo(()=>u.currentSelection==="customMerchant"&&u.selectedVendor.id!=null&&u.selectedVendor.name!=null?{id:u.selectedVendor.id,name:u.selectedVendor.name}:void 0,[u]),le=u.status.code==="under_review"||u.saveStatus.fetchState==="In-Progress",ae=u.status.code==="merge_in_qbo"||u.status.code==="merge_in_netsuite",ge=ae||le,ye=Ie=>{let Ne=Ie.websiteUrl?.toString();if(Ne){if(Ne.includes("http")||(Ne="https://".concat(Ne)),u.currentVendor!=null){const Pe=Ie?.globalMerchantName??null;e.trackVendorReviewWebsiteOpened({reviewSource:"tenant_review",vendorName:u.currentVendor.name,wasRecommendationAvailable:!!Pe,recommendedVendorName:Pe,recommendedVendorReason:Ie.reason??null,vendorWebsite:Ne})}window.open(Ne,"_blank")}},he=u.currentVendor!=null?{label:{label:u.currentVendor?.name,style:{display:"block",overflow:"hidden",textOverflow:"ellipsis"}},checkBoxField:{name:qO(h,Th,"retain"),defaultChecked:u.currentSelection==="retain"},tooltipProps:{text:u.currentVendor?.name},isDisabled:ge}:void 0,Ce=g.useCallback(Ie=>Ie.logo!=null?t.jsxRuntimeExports.jsxs(RBn,{children:[t.jsxRuntimeExports.jsx(Cu,{photoUrl:Ie.logo.toString(),styles:{width:Sl.logoHeightAndWidth.valuePx(E),height:Sl.logoHeightAndWidth.valuePx(E)},placeholder:{width:Sl.logoHeightAndWidth.value(E),height:Sl.logoHeightAndWidth.value(E)},fallbackAvatar:t.jsxRuntimeExports.jsx(ZO,{children:t.jsxRuntimeExports.jsx(Jo,{name:Ie.globalMerchantName})})}),t.jsxRuntimeExports.jsx(Bf,{windowSize:E,isLastItem:!1,children:t.jsxRuntimeExports.jsx(Ehe,{children:Ie.globalMerchantName})})]}):t.jsxRuntimeExports.jsx(Bf,{windowSize:E,isLastItem:!1,children:t.jsxRuntimeExports.jsx(Ehe,{children:Ie.globalMerchantName})}),[E]),we=u.recommendations.map((Ie,Ne)=>{const Pe=Ce(Ie),Je=`recommended${ZV(Ne)}`;return{label:{label:Pe,style:{display:"block",overflow:"hidden",textOverflow:"ellipsis"}},checkBoxField:{name:qO(h,Th,Je),defaultChecked:u.currentSelection===Je},tooltipProps:{text:Ie.websiteUrl?.toString().length?t.jsxRuntimeExports.jsx(hBn,{recommendation:Ie,rowSuffix:y,onRedirectionToRecommendedMerchantWebsiteUrl:()=>ye(Ie)}):Ie.globalMerchantName,maxWidth:"360px"},isDisabled:ge,fieldName:Je}}),ve=g.useMemo(()=>({defaultOptions:FY(B.globalMerchants,ae,u.recommendations,u.currentVendor,ue),selectedOption:u.selectedVendor.id}),[B,u,ue,ae]),Ee=()=>{S(!1),c()},Se=Ie=>{const Ne=u.currentVendor?.name,Pe=[...B.globalMerchants.map(Qe=>Qe.globalMerchantName),...u.recommendations.map(Qe=>Qe.globalMerchantName)];return u.currentVendor==null||Pe.includes(Ie)||Ne===Ie?null:Ie.trim().length>0?A3.vendorDropdown.fromOldName.replace("__old_name__",Ne??"")+" "+A3.vendorDropdown.toNewName.replace("__new_name__",Ie??""):null},$e=Ie=>{Ie.stopPropagation(),l(u.vendorId)},Be=Ie=>{Ie.stopPropagation(),r(h)},Ae=Ie=>{Ie.stopPropagation(),S(!0)},_e=()=>{u.selectedVendor.id!=null&&u.vendorQboId!=null&&d(u.vendorId,u.vendorQboId)},Te=Ie=>{u.selectedVendor.id!=null&&a(u.selectedVendor.id,Ie),S(!1)},Re=(Ie,Ne)=>{f(u.vendorId),x.loadOptions(Ie,Ne)},ke=Ie=>u.recommendations.find(Pe=>Pe.globalMerchantId===Ie||Pe.globalMerchantName===Ie)?.reason??"",Oe=()=>{l(u.vendorId,!0)},Me=()=>{l(u.vendorId,!1,!0)};return t.jsxRuntimeExports.jsxs(fBn,{"data-testid":C("vendor-first-review-row"),windowSize:E,isDisabled:le,isRowActive:L,children:[t.jsxRuntimeExports.jsx(ly,{"data-testid":C("vendor-first-review-row-column-vendor"),windowSize:E,width:25,isDisabled:le,gap:Sl.logoToValueGap,children:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:R===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:Ee,children:t.jsxRuntimeExports.jsx(wBn,{windowSize:E,children:t.jsxRuntimeExports.jsx(ALn,{name:qO(h,bg),placeholder:Gd.strings.empty,defaultValue:ve,autoFocus:!0,customStyleConfig:{valueContainer:()=>({justifyContent:"flex-start",margin:`${o.sp0} ${o.sp3}`}),singleValue:()=>({display:"flex",alignItems:"center",color:b.colors.hero,"&:hover":{color:b.colors.primary}})},style:{display:"flex",flexGrow:1,width:"-webkit-fill-available",height:"20px",cursor:"inherit",alignItems:"center"},valueToInfo:ke,menuIsOpen:R,getRenameOptionText:Se,onMenuClose:Ee,loadOptions:Re,isOptionRemovable:!1,onClickRenameOption:Te})})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[u.selectedVendor?.logo!=null&&u.selectedVendor.name!=null?t.jsxRuntimeExports.jsx(Cu,{photoUrl:u.selectedVendor.logo.toString(),styles:{width:Sl.nameLogoWidth.valuePx(E),height:Sl.nameLogoHeight.valuePx(E)},fallbackAvatar:t.jsxRuntimeExports.jsx(ZO,{children:t.jsxRuntimeExports.jsx(Jo,{name:u.selectedVendor.name})})}):u.selectedVendor.name!=null?t.jsxRuntimeExports.jsx(ZO,{children:t.jsxRuntimeExports.jsx(Jo,{name:u.selectedVendor.name})}):null,t.jsxRuntimeExports.jsx(jBn,{onClick:_e,"data-testid":C("vendor-first-review-row-vendor-name"),children:t.jsxRuntimeExports.jsxs(CBn,{children:[u.selectedVendor.name?t.jsxRuntimeExports.jsx(Le,{enterDelay:600,display:"block",placement:"bottom",title:u.selectedVendor.name,children:t.jsxRuntimeExports.jsx(jhe,{children:u.selectedVendor.name})}):t.jsxRuntimeExports.jsx(jhe,{children:Gd.strings.hyphen}),t.jsxRuntimeExports.jsx(Le,{display:"block",placement:"bottom",title:Gd.tooltips.editName,enterDelay:600,children:t.jsxRuntimeExports.jsx(bBn,{onClick:Ae,"data-testid":C("vendor-first-review-row-edit-icon")})})]})})]})})}),t.jsxRuntimeExports.jsx(ly,{"data-testid":C("vendor-first-review-row-column-receipts"),windowSize:E,width:p[1],isDisabled:!1,children:M.length>0?t.jsxRuntimeExports.jsx(Bf,{windowSize:E,className:"vendor-first-review-row-item",children:t.jsxRuntimeExports.jsx(vBn,{isDisabled:pe,onClick:()=>pe===!1?de(u.vendorId):null,"data-testid":C("vendor-first-review-row-view-receipts"),children:t.jsxRuntimeExports.jsx(Le,{display:"block",placement:"top",title:A3.viewRecipts,enterDelay:600,children:t.jsxRuntimeExports.jsx(SBn,{children:t.jsxRuntimeExports.jsx(pr,{width:o.sp3,height:o.sp3})})})})}):t.jsxRuntimeExports.jsx(Bf,{className:"vendor-first-review-row-item","data-testid":C("vendor-first-review-row-column-receipts-empty"),windowSize:E,children:Gd.strings.hyphen})}),t.jsxRuntimeExports.jsx(ly,{"data-testid":C("vendor-first-review-row-column-recommendations"),windowSize:E,width:25,isDisabled:ge,gap:Sl.logoToValueGap,children:we.map((Ie,Ne)=>t.jsxRuntimeExports.jsxs(g.Fragment,{children:[t.jsxRuntimeExports.jsx(Bf,{"data-testid":_("vendor-first-review-row-recommendation-option",`${y}-${Ne}`),windowSize:E,className:"vendor-first-review-row-item",children:t.jsxRuntimeExports.jsx(Pp,{isHighlighted:!0,defaultChecked:u.currentSelection===Ie.fieldName,label:Ie.label,checkBoxField:Ie.checkBoxField,isDisabled:Ie.isDisabled,tooltipProps:Ie.tooltipProps})}),Ne<we.length-1?t.jsxRuntimeExports.jsxs(whe,{children:[" ",Gd.texts.or]}):null]},Ie.fieldName))}),t.jsxRuntimeExports.jsx(ly,{"data-testid":C("vendor-first-review-row-column-retain"),windowSize:E,width:20,isDisabled:ge,children:u.currentVendor!=null&&he!=null?t.jsxRuntimeExports.jsx(Bf,{"data-testid":C("vendor-first-review-row-retain-option"),windowSize:E,className:"vendor-first-review-row-item",children:t.jsxRuntimeExports.jsx(Pp,{defaultChecked:u.currentSelection==="retain",label:he.label,checkBoxField:he.checkBoxField,isDisabled:he.isDisabled,tooltipProps:he.tooltipProps,backgroundDefaultColor:b.colors.grey5})}):null}),t.jsxRuntimeExports.jsx(ly,{"data-currentVendorName":u.currentVendor?.name,"data-mergeVendorName":u.mergeVendorName,"data-testid":C("vendor-first-review-row-column-status"),windowSize:E,width:L?10:25,isDisabled:le,children:t.jsxRuntimeExports.jsxs(Bf,{windowSize:E,className:"vendor-first-review-row-item",children:[t.jsxRuntimeExports.jsxs(whe,{children:[t.jsxRuntimeExports.jsx(yBn,{isDisabled:!1,clickable:!1,statusMergeInQBO:ae,children:t.jsxRuntimeExports.jsx(fhe,{children:u.status.name})}),ae&&u.currentVendor!=null&&u.mergeVendorName!=null?t.jsxRuntimeExports.jsx(Le,{title:t.jsxRuntimeExports.jsx(gBn,{vendorName:u.currentVendor.name,mergeVendorName:u.mergeVendorName,statusCode:u.status}),maxWidth:"312px",children:t.jsxRuntimeExports.jsx(fn,{width:o.sp3,height:o.sp3})}):null]}),u.lastUpdatedVendorNameByUser!=null&&ae?t.jsxRuntimeExports.jsx(fhe,{children:`${Gd.by} ${cn(u.lastUpdatedVendorNameByUser)}`}):null]})}),t.jsxRuntimeExports.jsxs(ly,{className:"vendor-first-review-action-items","data-testid":C("vendor-first-review-row-column-actions"),windowSize:E,width:L?15:0,isDisabled:le,children:[t.jsxRuntimeExports.jsx(Ge,{dataTestId:C("vendor-first-review-row-cancel"),disabled:!L,label:Gd.footer.cancel,onClick:Be,size:"small",style:{height:"100%"},variant:"outline"}),t.jsxRuntimeExports.jsx(yhe,{space:o.sp0}),t.jsxRuntimeExports.jsx(Ge,{dataTestId:C("vendor-first-review-row-confirm"),disabled:!L,label:Gd.texts.confirm,loading:u.saveStatus.fetchState==="In-Progress",onClick:$e,size:"small",style:{height:"100%"},variant:"primary"}),t.jsxRuntimeExports.jsx(yhe,{space:o.sp0}),t.jsxRuntimeExports.jsx(EBn,{children:u.currentSelection==null?t.jsxRuntimeExports.jsx(YC,{isMenuOpen:A,menuItems:t.jsxRuntimeExports.jsxs($Bn,{children:[t.jsxRuntimeExports.jsxs(Che,{"data-testid":C("vendor-first-review-row-mark-as-employee-menu-item"),onClick:()=>{I(!1),Oe()},children:[t.jsxRuntimeExports.jsx(bhe,{}),A3.rowMoreActions.markAsEmployee]}),t.jsxRuntimeExports.jsxs(Che,{"data-testid":C("vendor-first-review-row-mark-as-contractor-menu-item"),onClick:()=>{I(!1),Me()},children:[t.jsxRuntimeExports.jsx(bhe,{}),A3.rowMoreActions.markAsLocalContractor]})]}),menuTriggerDataTestId:C("vendor-first-review-row-more-menu-trigger"),setIsMenuOpen:I}):null})]}),P&&M.length>0?Ns.createPortal(t.jsxRuntimeExports.jsx(Q5,{allFiles:F,fileSource:N,file:se,title:se.fileName,attachments:M,showNavigation:$.connectionName==="netsuite",setFileSource:H,setShowFullScreenView:D,onCrossClick:re,onNextClick:ne,onPreviousClick:me,setSelectedFileAttachment:ie,handleTouchStart:J,handleTouchMove:oe,handleTouchEnd:te}),document.body):null]})},hBn=({recommendation:e,rowSuffix:n,onRedirectionToRecommendedMerchantWebsiteUrl:i})=>t.jsxRuntimeExports.jsxs(HIe,{setMaxHeight:!0,children:[t.jsxRuntimeExports.jsxs(pk,{children:[t.jsxRuntimeExports.jsx(fj,{children:Gd.labels.name}),t.jsxRuntimeExports.jsx(mk,{children:e.globalMerchantName})]}),t.jsxRuntimeExports.jsxs(pk,{children:[t.jsxRuntimeExports.jsx(fj,{children:Gd.labels.websiteURL}),t.jsxRuntimeExports.jsx(mk,{className:"websiteUrlTooltipText",onClick:i,"data-testid":_("vendor-first-review-row-website-url-tooltip-content",n),children:e.websiteUrl?.toString()})]})]}),gBn=({vendorName:e,mergeVendorName:n,statusCode:i})=>t.jsxRuntimeExports.jsxs(HIe,{setMaxHeight:!1,children:[i.code==="merge_in_qbo"?t.jsxRuntimeExports.jsx(fj,{children:A3.tooltip.mergeInQBOText}):null,i.code==="merge_in_netsuite"?t.jsxRuntimeExports.jsx(fj,{children:A3.tooltip.mergeInNetSuiteText}):null,t.jsxRuntimeExports.jsxs(pk,{children:[t.jsxRuntimeExports.jsx(fj,{children:Gd.labels.vendor}),t.jsxRuntimeExports.jsx(mk,{children:e})]}),t.jsxRuntimeExports.jsxs(pk,{children:[t.jsxRuntimeExports.jsx(fj,{children:Gd.labels.mergedTo}),t.jsxRuntimeExports.jsx(mk,{children:n})]})]}),fBn=s.div`
54832
54832
  display: flex;
54833
54833
  margin-bottom: ${o.sp3};
54834
54834
  background-color: ${e=>e.theme.colors.grey5};
@@ -58975,7 +58975,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
58975
58975
  margin-bottom: ${o.sp2};
58976
58976
  margin-top: ${o.sp3};
58977
58977
  color: ${e=>e.theme.colors.champion};
58978
- `,UUn=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M4.99866 4.27356H11.0117",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M9.23645 4.27357C9.31133 4.27262 9.38331 4.24451 9.43902 4.19448C9.49474 4.14445 9.53039 4.0759 9.53937 4.00156C9.67299 3.19219 9.92504 2.40689 10.2874 1.67093C10.3173 1.61487 10.3291 1.55096 10.3214 1.48791C10.3137 1.42486 10.2867 1.36572 10.2441 1.31855C10.2011 1.27012 10.1436 1.23677 10.0802 1.22342C10.0167 1.21006 9.95069 1.21741 9.89175 1.24437C9.89175 1.24437 8.76236 1.80143 7.98768 1.80075C7.21532 1.80008 6.08979 1.24437 6.08979 1.24437C6.03085 1.21741 5.96481 1.21006 5.90138 1.22342C5.83796 1.23677 5.78048 1.27012 5.73741 1.31855C5.69487 1.36572 5.66789 1.42486 5.66014 1.48791C5.6524 1.55096 5.66427 1.61487 5.69414 1.67093C6.05651 2.40689 6.30855 3.19219 6.44217 4.00156C6.45115 4.0759 6.48681 4.14445 6.54252 4.19448C6.59823 4.24451 6.67022 4.27262 6.74509 4.27357",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M9.23641 4.27356C9.23641 4.27356 13.5638 7.67369 13.5638 10.6472C13.5638 13.7383 11.091 14.783 8 14.783C4.90898 14.783 2.43616 13.7197 2.43616 10.6472C2.43616 7.67369 6.76359 4.27356 6.76359 4.27356",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M8.03613 5.96594C8.31228 5.96594 8.53613 6.1898 8.53613 6.46594V6.84094H9.34863C9.62478 6.84094 9.84863 7.0648 9.84863 7.34094C9.84856 7.61702 9.62473 7.84094 9.34863 7.84094H7.37988C7.22241 7.84094 7.07131 7.90342 6.95996 8.01477C6.84866 8.12611 6.78613 8.27725 6.78613 8.43469C6.78617 8.59211 6.84864 8.7433 6.95996 8.85461C7.0713 8.96592 7.22244 9.02844 7.37988 9.02844H8.69238C9.11507 9.02844 9.52045 9.19635 9.81934 9.49524C10.1182 9.79412 10.2861 10.1995 10.2861 10.6222C10.2861 11.0448 10.1182 11.4503 9.81934 11.7491C9.52046 12.048 9.11504 12.2159 8.69238 12.2159H8.53613V12.5909C8.53606 12.867 8.31223 13.0909 8.03613 13.0909C7.76004 13.0909 7.53621 12.867 7.53613 12.5909V12.2159H6.72363C6.44754 12.2159 6.22371 11.992 6.22363 11.7159C6.22363 11.4398 6.44749 11.2159 6.72363 11.2159H8.69238C8.84982 11.2159 9.00096 11.1534 9.1123 11.0421C9.22362 10.9308 9.2861 10.7796 9.28613 10.6222C9.28613 10.4648 9.22361 10.3136 9.1123 10.2023C9.00095 10.0909 8.84986 10.0284 8.69238 10.0284H7.37988C6.95723 10.0284 6.55181 9.86049 6.25293 9.56165C5.95408 9.26279 5.78617 8.85733 5.78613 8.43469C5.78613 8.01204 5.95409 7.60662 6.25293 7.30774C6.55182 7.00885 6.95719 6.84094 7.37988 6.84094H7.53613V6.46594C7.53613 6.1898 7.75999 5.96594 8.03613 5.96594Z",fill:"currentColor"})),GY={contentContainerMargin:new w(p[3],p[4],p[8]),infoSubheadingTextMarginTop:new w(p[0],p[0]),cardsMinWidth:new w(343,353)},GUn={remainingText:new Ke("smallSemiBold","smallSemiBold")},YUn=O.getLocalizedStrings(),{spendManagement:{chargeCard:{payEarly:xa,cardList:dp,chargeCardsPromo:Qr}},common:rc,collaboration:{threads:{placeholder:{addANewComment:qUn,replyAComment:ZUn},tooltip:{resolveComment:KUn,unResolveComment:JUn}}},dateFormat:F$}=YUn,{texts:{comments:XUn}}=rc,eGn=({chargeCardListView:e,searchText:n,admins:i,companyLegalName:r,onFetchChargeCardsRecurringExpenses:a,onFetchDepositAccountLimit:l,onCloseChargeCard:c,onCloseChargeCardList:d,onLockChargeCard:u,onLockChargeCardList:m,onUnlockChargeCardList:x,updateChargeCardListSpendLimit:h,onUpdateSpendLimit:f,isCardControlsEnabled:y,isCardsCommentingEnabled:C,isCashbackFeatureEnabled:b,creditCardPayNowThreshold:E,isChargeCardFeatureEnabled:$,isCompanyInterestedInChargeCard:R,isCreditCardProductVisibleForExpressInterest:S,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:A,companyChargeCardInfoCreditAccountLimit:I,controllerEmails:B,onRevokeChargeCardList:L,depositAccountListWithDebitCardIssued:P,chargeCardCashbackDetailState:D,uiState:M,signedInUser:F,creditLimit:V,cashbackRate:N,onSearchTextChanged:H,navigateToCreditCardPaymentHistoryPage:W,onClickSetupIcon:U,isChargeCardPaymentHistoryFeatureEnabled:Y,isEarlyPayEnabled:q,onClickStatementsIcon:Z,onChargeCardRowClick:G,updateChargeCardName:K,onChargeCardResendInviteClick:J,onChargeCardRevokeInviteClick:oe,onUnlockChargeCard:ee,onIssueCardClick:te,onBackClick:se,onReloadCards:ie,onTotalCashbackClick:re,onColumnSortConfigChanged:ne,onClickMenuIcon:me,onPromoCardClick:pe,onCreateNowClick:je,showPayNowInfoTooltip:ce,navigateToCreditCardPaymentPage:de,shouldShowPayNowInfoTooltip:ue,rowActionView:le,bulkActionView:ae,onSetRowActionCardId:ge,onSetBulkActionCardIds:ye,isAiCfoAccessEnabled:he,onAskAiCfoClick:Ce})=>{const ve=ro().analytics,[Ee,Se]=g.useState(!1),[$e,Be]=g.useState(!1),[Ae,_e]=g.useState(!1),[Te,Re]=g.useState(!1),[ke,Oe]=g.useState(!1),[Me,Ie]=g.useState(!1),[Ne,Pe]=g.useState(!1),[Ue,Je]=g.useState(!1),[tt,Qe]=g.useState(void 0),[dt,ct]=g.useState(null),[yt,He]=g.useState(!1),jt=Dt=>{ct({...Dt}),He(!0)},St=ae.chargeCards[0]?.status.code,{creditAccount:We,creditAccountRepayment:nt}=e,ut=g.useCallback(()=>{ge(void 0),Qe(void 0)},[ge]),pt=ae.chargeCards,Bt=g.useMemo(()=>pt.length===0?void 0:pt.reduce((mo,to)=>to.balance.amount>mo.balance.amount?to:mo,pt[0]).balance,[pt]),Ht=g.useMemo(()=>{const Dt=pt.filter(eo=>eo.type.code.includes("debit"));if(Dt.length===0)return;const mo=Dt.map(eo=>P.depositAccounts.find(Zo=>Zo.id===eo.connectedAccountId)?.cardLimits.dailyCardTransactionLimit).filter(eo=>eo!==void 0);return mo.length===0?void 0:mo.reduce((eo,mi)=>mi.amount<eo.amount?mi:eo)},[pt,P.depositAccounts]),$o=Ye(e.unlockChargeCardsFetchState.fetchState),Tt=Ye(e.revokeChargeCardsInviteFetchState.fetchState),Gt=Ye(e.lockChargeCardsFetchState.fetchState),so=Ye(e.closeChargeCardsFetchState.fetchState),no=Ye(e.updateChargeCardsSpendLimitFetchState.fetchState);g.useEffect(()=>{const Dt=$o==="In-Progress"&&e.unlockChargeCardsFetchState.fetchState==="Completed",mo=Tt==="In-Progress"&&e.revokeChargeCardsInviteFetchState.fetchState==="Completed",to=Gt==="In-Progress"&&e.lockChargeCardsFetchState.fetchState==="Completed",eo=so==="In-Progress"&&e.closeChargeCardsFetchState.fetchState==="Completed",mi=no==="In-Progress"&&e.updateChargeCardsSpendLimitFetchState.fetchState==="Completed";(Dt||mo)&&ye([]),to&&(Re(!1),ye([])),eo&&(Oe(!1),ye([])),mi&&(Ie(!1),ye([]))},[e.unlockChargeCardsFetchState.fetchState,e.revokeChargeCardsInviteFetchState.fetchState,e.lockChargeCardsFetchState.fetchState,e.closeChargeCardsFetchState.fetchState,e.updateChargeCardsSpendLimitFetchState.fetchState,$o,Tt,Gt,so,no,ye]);const Xe=le.cardId!=null?le.unlockChargeCardsFetchState.fetchState:void 0,ft=Ye(Xe),oo=le.cardId!=null?le.updateChargeCardLimitFetchState.fetchState:void 0,on=Ye(oo),To=le.cardId!=null?le.updateChargeCardNameFetchState.fetchState:void 0,kn=Ye(To),Dn=le.cardId!=null?le.lockChargeCardsFetchState.fetchState:void 0,qt=Ye(Dn),dn=le.cardId!=null?le.closeChargeCardsFetchState.fetchState:void 0,Zs=Ye(dn),Yn=le.cardId!=null?le.revokeChargeCardFetchState.fetchState:void 0,Hs=Ye(Yn);g.useEffect(()=>{le.cardId!=null&&ft==="In-Progress"&&Xe==="Completed"?ut():le.cardId!=null&&on==="In-Progress"&&oo==="Completed"?(Je(!1),ut()):le.cardId!=null&&kn==="In-Progress"&&To==="Completed"?(Pe(!1),ut()):le.cardId!=null&&qt==="In-Progress"&&Dn==="Completed"?(Be(!1),ut()):le.cardId!=null&&Zs==="In-Progress"&&dn==="Completed"?(_e(!1),ut()):le.cardId!=null&&Hs==="In-Progress"&&Yn==="Completed"&&ut()},[le.cardId,Xe,oo,To,Dn,dn,Yn,ft,kn,on,qt,Zs,Hs,ut]);const yn=g.useCallback(Dt=>{switch(Dt){case"close":a(ae.bulkActionCardIds),Oe(!0);break;case"lock":a(ae.bulkActionCardIds),Re(!0);break;case"unlock":x(ae.bulkActionCardIds);break;case"update_limit":Ie(!0);break;case"revoke_invite":L(ae.bulkActionCardIds);break}},[ae.bulkActionCardIds,a,L,x]),Go=le.chargeCard;g.useEffect(()=>{if(!(tt===void 0||le.cardId===void 0||Go===void 0))switch(tt){case p3.CLOSE:Ae||(a([le.cardId]),_e(!0));break;case p3.LOCK:$e||(a([le.cardId]),Be(!0));break;case p3.UNLOCK:Xe!=="In-Progress"&&Xe!=="Completed"&&ee(le.cardId);break;case p3.REVOKE_INVITE:Yn!=="In-Progress"&&Yn!=="Completed"&&oe(le.cardId);break;case p3.RENAME:Ne||Pe(!0);break;case p3.UPDATE_SPEND_LIMIT:Ue||(Go.type.code.includes("debit")&&le.depositAccountLimitFetchState.fetchState!=="Completed"&&l(Go.connectedAccountId,le.cardId),Je(!0));break}},[tt,le.cardId,Ue,Ne,Ae,$e,Xe,Yn,a,l,ee,oe]);const ds=ht(),In=!!ds.loggedInUserRole.includes("charge_card_user"),ts=I0(ds),pn=Q.hasChargeCardAdminLevelAccess(ds.loggedInUserRoleMap),_s=g.useMemo(()=>pn===!0?{creditCardCashbackOffer:`${D.cashbackAnalytics.creditCardCashbackOffer}%`,debitCardCashbackOffer:`${D.cashbackAnalytics.debitCardCashbackOffer}%`,totalEarnedCashback:Ls(D.cashbackSummary.cashbackEarned.amount),redeemedCashback:Ls(D.cashbackSummary.cashbackRedeemed.amount),availableCashback:Ls(D.cashbackSummary.cashbackAvailable.amount),creditCardCashbackRedemptionMode:D.cashbackAnalytics.creditCardCashbackRedemptionMode,debitCardCashbackRedemptionMode:D.cashbackAnalytics.debitCardCashbackRedemptionMode}:void 0,[pn,D.cashbackAnalytics.creditCardCashbackOffer,D.cashbackAnalytics.debitCardCashbackOffer,D.cashbackSummary.cashbackEarned.amount,D.cashbackSummary.cashbackRedeemed.amount,D.cashbackSummary.cashbackAvailable.amount,D.cashbackAnalytics.creditCardCashbackRedemptionMode,D.cashbackAnalytics.debitCardCashbackRedemptionMode]),us=g.useMemo(()=>$&&A&&pn===!0?{creditAccountId:We.id,creditAccountLimit:Ls(We.limit.amount),creditAccountAvailableAmount:Ls(We.available.amount),creditAccountSpentAmount:Ls(We.balance.amount+We.hold.amount),creditAccountStatus:We.status,outstandingBalance:Ls(nt.remainingAmountDue.amount)}:void 0,[$,A,pn,We.id,We.limit.amount,We.available.amount,We.balance.amount,We.hold.amount,We.status,nt.remainingAmountDue.amount]),js=g.useMemo(()=>k&&T?{debitAccountId:P.depositAccounts.map(Dt=>Dt.id),debitAccountName:P.depositAccounts.map(Dt=>Dt.accountName),debitAccountBalance:P.depositAccounts.map(Dt=>Ls(Dt.accountBalance.available.amount)),debitCardsSpend:Ls(e.debitCardSummary?.currentMonthSpends?.amount??0),debitAccountStatus:P.depositAccounts.map(Dt=>Dt.accountStatus)}:void 0,[k,T,P.depositAccounts,e.debitCardSummary?.currentMonthSpends?.amount]),xn={isCreditCardOffered:$,isDebitCardOffered:k,isDebitCardEnabled:T,isCreditCardEnabled:A},As=Dt=>{Se(Dt),Dt===!0&&(ve.trackCardsListPageClicked("search"),(!$||We.fetchState==="Completed"&&nt.fetchState==="Completed")&&(!(k&&T)||P.fetchState==="Completed")&&_s!=null&&ve.trackCardsCardListSearchClick(B,xn,_s,us,js))},nn=X(),os=ts&&!pn,qe=e.creditAccount.balance.amount+e.creditAccount.hold.amount,xt={amount:qe,currencyCode:e.creditAccount.balance.currencyCode,currencySymbol:e.creditAccount.balance.currencySymbol},Wt=Math.round(xt.amount*100/e.creditAccount.limit.amount),Ze=isNaN(Wt)?0:qe!==0&&Wt===0?1:Wt,Mo=e.chargeCardConfig.rePaymentInfo?.cardLimitResetDate,Lo=pn&&xt.amount>E*e.creditAccount.limit.amount/100,_n=Mo!=null&&nt.initiatedRepayments.amount>0,ns={entity:"charge_cards",showNewButtonOnNavbar:pn,showEntityEmailInfoIconOnNavbar:!1,newButtonLabel:pn?dp.newBtnLabel:rc.strings.empty,hideSearchBtn:In,searchTextBoxStyle:{right:os?o.sp4:"120px",paddingTop:o.sp0},moreIconContainerStyle:{paddingRight:o.sp0},isSearchOpen:Ee,searchPlaceHolder:dp.searchPlaceHolder,searchText:n,showSettingsIcon:!In,showSettingsIconOnNavbar:pn,showStatementButtonOnNavbar:$&&A,showPayEarlyButtonOnNavbar:q&&pn&&xt.amount>0&&!_n&&!Lo,showPaymentHistoryButtonOnNavbar:pn&&Y&&$&&A,onClickPaymentHistoryIcon:W,showDownloadButtonOnNavbar:!1,disableDownloadButton:!0,analytics:ve,onSearchOpen:As,onSearchTextChanged:H,onClickSetupIcon:U,onClickStatementsIcon:Z,downloadState:"Not-Started",onNewButtonClick:te,onClickPayEarlyIcon:()=>de("More Button","Pay Early"),onMenuOpen:()=>{(!$||We.fetchState==="Completed"&&nt.fetchState==="Completed")&&(!(k&&T)||P.fetchState==="Completed")&&_s!=null&&ve.trackCardsCardListMoreMenuClick(B,xn,_s,us,js)},filters:{categoryCombinationOperator:"AND",categories:[]}},Vt=t.jsxRuntimeExports.jsxs(ii,{children:[t.jsxRuntimeExports.jsx(lB,{spendManagementSectionProps:ns}),t.jsxRuntimeExports.jsx(ms,{dataTestId:"cards-ask-ai-cfo-button",isAiCfoAccessEnabled:he,onAskAiCfoClick:Ce})]}),en=e.cards.length===0?!1:In&&Q.anyCardOnHold(e.cards),On=e.fetchState==="Completed"?cGn({isChargeCardFeatureEnabled:$,isChargeCardSetupEnabled:A,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:T}):"",$t=e.debitCardSummary!=null?e.debitCardSummary.currentMonthSpends.amount-e.debitCardSummary.lastCompletedMonthSpends.amount:0,bo=$&&A&&e.hasCreditCard,mt=k&&T&&e.hasDebitCard,Qt=$&&A&&ts&&!pn,wt=k&&T&&ts&&!pn,_o=(bo||Qt||$&&A||S?1:0)+(mt||wt||k&&T||k?1:0)+1,Ct=e.chargeCardConfig.rePaymentInfo?.rePaymentDueDate?.diff(Q.dateNow(),"days")??0,Ot=[xa.payNow,Ct>0&&Ct<11?`${xa.billDueIn} ${Ct} ${Ct===1?rc.timeStrings.day:rc.timeStrings.days}`:xa.creditLimitLow,xa.payNow],Yo=nt.initiatedRepayments.amount===We.balance.amount+We.hold.amount,Mt=nt.paymentMethod==="ACH",fo=[xa.paymentInitiated,`${dp.header.limit} ${Yo?rc.resets:rc.updates} ${rc.by} ${Q.zeniDate(Q.getNextNthWorkingDay(nt.initiatedRepaymentDate?.toDate()??Q.dateNow().toDate(),[0,6],Mt?3:1).toDateString()).format(F$.visual.MMMDFormat)}`,xa.paymentInitiated],ot=g.useRef(null),Lt=g.useRef(null),Nt=t.useTheme(),[qn,vo]=g.useState(!0);g.useEffect(()=>{const Dt=()=>{Lt.current&&(Lt.current.getBoundingClientRect().top<(nn==="small"?68:40)?vo(!1):vo(!0))};Dt();const mo=()=>{Dt()},to=ot.current;return to&&to.addEventListener("scroll",mo),window.addEventListener("scroll",mo),()=>{to&&to.removeEventListener("scroll",mo),window.removeEventListener("scroll",mo)}},[nn]);const jn=Dt=>{const mo=Dt.reasonType==="other"?Dt.reason:Dt.reasonType;le.cardId!=null&&c(le.cardId,mo)},Ln=Dt=>{const mo=Dt.reasonType==="other"?Dt.reason:Dt.reasonType;le.cardId!=null&&u(le.cardId,mo)},ri=Dt=>{const mo=Dt.reasonType==="other"?Dt.reason:Dt.reasonType;d(ae.bulkActionCardIds,mo)},Hc=Dt=>{const mo=Dt.reasonType==="other"?Dt.reason:Dt.reasonType;m(ae.bulkActionCardIds,mo)},et=g.useMemo(()=>{const Dt={};return ae.chargeCards.forEach(mo=>{Dt[mo.id]=mo}),{chargeCardsByCardId:Dt,cardRecurringExpensesByCardId:ae.recurringExpensesByCardId,fetchState:ae.recurringExpensesFetchState.fetchState}},[ae]),Jt=g.useCallback(()=>{a(ae.bulkActionCardIds),Re(!0)},[ae.bulkActionCardIds,a]),gt=g.useCallback(()=>{a(ae.bulkActionCardIds),Oe(!0)},[ae.bulkActionCardIds,a]),mn=g.useCallback(Dt=>{const mo=ae.bulkActionCardIds.filter(to=>to!==Dt);ye(mo),mo.length===0&&(Re(!1),Oe(!1))},[ae.bulkActionCardIds,ye]),zt=R&&I===0,tn=I===-1;return t.jsxRuntimeExports.jsxs(v0,{sharedItems:{sharedFunctions:{subtreeFunctions:{openAllThreadsDrawer:jt}},sharedRef:void 0},children:[t.jsxRuntimeExports.jsxs(gGn,{ref:ot,children:[t.jsxRuntimeExports.jsx(Rt,{title:On,showBackButton:nn!=="medium-compact"&&nn!=="small",showMenuIcon:nn==="medium-compact"||nn==="small",onClickMenuIcon:me,style:{zIndex:3},onBackClick:se,rightSideComponent:Vt,isSearchOpen:Ee,hideSearchBtn:In,scrollableContent:ot,source:"ChargeCardListPage",backgroundColor:Nt.colors.grey4}),e.fetchState==="Not-Started"||e.fetchState==="In-Progress"?t.jsxRuntimeExports.jsx(STe,{isCardUser:In,showTopSummaryCards:!In,topSummaryCardCount:_o}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[In?null:t.jsxRuntimeExports.jsxs(fGn,{windowSize:nn,children:[bo||Qt?t.jsxRuntimeExports.jsxs(Lge,{windowSize:nn,"data-testid":_("credit-card-spend-bar-container"),children:[t.jsxRuntimeExports.jsxs(Dge,{children:[t.jsxRuntimeExports.jsxs(Oge,{children:[t.jsxRuntimeExports.jsx(mz,{children:dp.creditCardBalance}),t.jsxRuntimeExports.jsx(PGn,{})]}),t.jsxRuntimeExports.jsxs(_ge,{children:[t.jsxRuntimeExports.jsxs(BGn,{children:[t.jsxRuntimeExports.jsx(ls,{amount:xt,integerStyles:{...z.h7Medium.cssObject},decimalStyles:{...z.extraLargeSemiBold.cssObject}}),t.jsxRuntimeExports.jsx(jGn,{children:rc.texts.spent})]}),Lo&&!_n&&q?t.jsxRuntimeExports.jsx(Le,{placement:"bottom",title:t.jsxRuntimeExports.jsx(aGn,{children:xa.creditLimitIsRunningLow}),children:t.jsxRuntimeExports.jsxs(Bge,{children:[t.jsxRuntimeExports.jsx(ls,{amount:e.creditAccount.available,integerStyles:z.smallSemiBold.cssObject,decimalStyles:z.smallSemiBold.cssObject}),t.jsxRuntimeExports.jsx(Pge,{windowSize:nn,children:rc.texts.remaining}),t.jsxRuntimeExports.jsx(lGn,{children:t.jsxRuntimeExports.jsx(rGn,{})})]})}):t.jsxRuntimeExports.jsxs(Bge,{children:[t.jsxRuntimeExports.jsx(ls,{amount:e.creditAccount.available,integerStyles:z.smallSemiBold.cssObject,decimalStyles:z.smallSemiBold.cssObject}),t.jsxRuntimeExports.jsx(Pge,{windowSize:nn,children:rc.texts.remaining})]})]}),t.jsxRuntimeExports.jsx(SGn,{children:t.jsxRuntimeExports.jsx(AGn,{style:{width:`${Ze}%`}})}),t.jsxRuntimeExports.jsx(bGn,{children:`${rc.texts.limit}: ${Ao("0,0",e.creditAccount.limit.amount,e.creditAccount.limit.currencySymbol)}`})]}),t.jsxRuntimeExports.jsxs(mGn,{showPaymentInitiatedInfo:_n,isEarlyPayEnabled:q,children:[_n&&q?null:t.jsxRuntimeExports.jsx(Mge,{children:`${rc.texts.limitReset} ${Mo!=null?Mo.format(F$.visual.MMMDFormat):null}`}),pn&&q&&(_n?t.jsxRuntimeExports.jsx(LGn,{children:t.jsxRuntimeExports.jsx(Le,{maxWidth:"242px",display:"flex",title:t.jsxRuntimeExports.jsxs(dGn,{children:[t.jsxRuntimeExports.jsx(Tge,{children:`${xa.paymentOf} ${Fe("0,0.[00]",{amount:nt.initiatedRepayments.amount,currencyCode:nt.initiatedRepayments.currencyCode,currencySymbol:nt.initiatedRepayments.currencySymbol})} ${xa.madeOn} `}),t.jsxRuntimeExports.jsx(uGn,{children:nt.initiatedRepaymentDate?.format(F$.visual.MMMDFormat)}),rc.strings.space,t.jsxRuntimeExports.jsx(Tge,{children:Mt?Yo?xa.isProcessingAndWillResetTheCreditLimitIn23BusinessDays:xa.isProcessingAndWillUpdateTheCreditLimitIn23BusinessDays:Yo?xa.isProcessingAndWillResetTheCreditLimitIn1BusinessDay:xa.isProcessingAndWillUpdateTheCreditLimitIn1BusinessDay})]}),placement:"bottom",children:t.jsxRuntimeExports.jsxs(Age,{hasPointer:!1,children:[fo.length>0&&t.jsxRuntimeExports.jsx(ige,{slideUpCount:fo.length,style:{alignItems:"flex-end",width:"auto"},children:fo.map((Dt,mo)=>t.jsxRuntimeExports.jsx(nGn,{children:Dt},`card-payment-initiated-${mo.toString()}`))}),t.jsxRuntimeExports.jsx(iGn,{})]})})}):Lo?t.jsxRuntimeExports.jsx(Le,{variant:"informative",display:"flex",arrow:!0,style:{top:o.sp2,left:"22px",position:"relative"},data:{preHeading:"URGENT",heading:xa.creditLimitIsLow,description:xa.transactionsMayBeDeclinedBecauseTheCreditLimitIsRunningLow,buttonText:xa.payNow,tooltipContentStyle:{width:"240px",boxSizing:"content-box",gap:o.sp0},tooltipIntroductionStyle:{color:v.important},buttonStyle:{width:"auto",whiteSpace:"nowrap"},onButtonClick:()=>{ue(!1),de("Toast Button","Pay Now")},showCloseButton:!0,onClose:Dt=>{Dt.preventDefault(),Dt.stopPropagation(),ue(!1)}},title:"informative",placement:"bottom-end",open:ce&&qn,children:t.jsxRuntimeExports.jsxs(Age,{ref:Lt,onClick:()=>{ue(!1),de("Text Button","Pay Now")},hasPointer:!0,children:[Ot.length>0&&t.jsxRuntimeExports.jsx(ige,{slideUpCount:Ot.length,style:{alignItems:"flex-end",width:"auto"},children:Ot.map((Dt,mo)=>t.jsxRuntimeExports.jsx(oGn,{isImportant:mo===1,children:Dt},`card-pay-now-${mo.toString()}`))}),t.jsxRuntimeExports.jsx(kge,{})]})}):xt.amount>0?t.jsxRuntimeExports.jsxs(sGn,{onClick:()=>de("Text Button","Pay Early"),children:[xa.payEarly,t.jsxRuntimeExports.jsx(kge,{})]}):null)]})]}):$&&A?t.jsxRuntimeExports.jsx(sge,{cardType:"creditCard","data-testid":_("card-list-page-promo-card-back","credit"),header:Qr.listPage.spendSmarter,title:Qr.listPage.setUpText.replace("__cardType__",Qr.listPage.credit),creditLimit:Ao("0,0",V.amount,V.currencySymbol),onCreateNowClick:je}):S?t.jsxRuntimeExports.jsx(nge,{cardPromoType:"credit","data-testid":_("card-list-page-promo-card","credit"),cardText:Qr.listPage.creditCards,header:Qr.listPage.getAccessTo,title:Qr.listPage.creditCards,subTitle:Qr.listPage.promoSubText.credit,slidingTextList:Ige("credit",N,{amount:I,currencyCode:V.currencyCode,currencySymbol:V.currencySymbol}),onClick:pe,status:tn?"rejected":zt?"under_review":void 0,statusMessage:tn?Qr.listPage.status.rejectedMessage:zt?Qr.listPage.status.underReviewMessage:void 0}):null,mt||wt?t.jsxRuntimeExports.jsxs(Lge,{windowSize:nn,"data-testid":_("debit-spend-bar-container"),children:[t.jsxRuntimeExports.jsxs(Dge,{children:[t.jsxRuntimeExports.jsxs(Oge,{children:[t.jsxRuntimeExports.jsx(mz,{children:dp.debitCardSpend}),t.jsxRuntimeExports.jsx(MGn,{})]}),t.jsxRuntimeExports.jsx(_ge,{children:t.jsxRuntimeExports.jsx(TGn,{children:t.jsxRuntimeExports.jsx(ls,{amount:e.debitCardSummary?.currentMonthSpends,integerStyles:{...z.h7Medium.cssObject},decimalStyles:{...z.extraLargeSemiBold.cssObject}})})}),t.jsxRuntimeExports.jsx(wGn,{children:$t!==0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[$t<0?t.jsxRuntimeExports.jsx($Gn,{}):t.jsxRuntimeExports.jsx(RGn,{}),t.jsxRuntimeExports.jsx(EGn,{hasNegativeValue:$t<0,children:Ao("0,0.00",$t,e.debitCardSummary?.currentMonthSpends.currencySymbol)}),t.jsxRuntimeExports.jsx(dLe,{children:dp.compareToLastMonth})]}):null})]}),t.jsxRuntimeExports.jsx(cLe,{children:t.jsxRuntimeExports.jsxs(Mge,{children:[`${rc.texts.limitReset} `,t.jsxRuntimeExports.jsx(CGn,{children:Mo!=null?Mo.format(F$.visual.MMMDFormat):null})]})})]}):k&&T?t.jsxRuntimeExports.jsx(sge,{cardType:"debitCard","data-testid":_("card-list-page-promo-card-back","debit"),header:Qr.listPage.spendSmarter,title:Qr.listPage.setUpText.replace("__cardType__",Qr.listPage.debit),onCreateNowClick:je}):k?t.jsxRuntimeExports.jsx(nge,{cardPromoType:"debit","data-testid":_("card-list-page-promo-card","debit"),cardText:Qr.listPage.debitCards,header:Qr.listPage.getAccessTo,title:Qr.listPage.debitCards,subTitle:Qr.listPage.promoSubText.debit,slidingTextList:Ige("debit",N),onClick:pe}):null,t.jsxRuntimeExports.jsxs(yGn,{windowSize:nn,"data-testid":_("credit-spend-info-container"),children:[b?t.jsxRuntimeExports.jsxs(pGn,{children:[t.jsxRuntimeExports.jsx(mz,{style:{textAlign:"start"},children:dp.totalCashback}),t.jsxRuntimeExports.jsx(ls,{amount:e.totalCashback,style:{justifyContent:"flex-start",color:v.success,marginTop:o.sp1},integerStyles:z.h7Medium.cssObject,decimalStyles:z.standardSemiBold.cssObject}),e.totalCashback.amount>0?t.jsxRuntimeExports.jsx(hGn,{windowSize:nn,children:t.jsxRuntimeExports.jsxs(vGn,{windowSize:nn,onClick:re,"data-testid":_("total-cashback-info"),children:[t.jsxRuntimeExports.jsx(xGn,{children:dp.overview}),t.jsxRuntimeExports.jsx(kGn,{})]})}):null]}):null,t.jsxRuntimeExports.jsx(DGn,{})]})]}),e.cards.length===0&&In===!0||en?t.jsxRuntimeExports.jsx(IGn,{children:t.jsxRuntimeExports.jsx(yTe,{companyLegalName:r,cards:e.cards,admins:i,hasZeniFinopsRoles:ts,cashbackRate:N})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[Ae&&le.cardId!=null&&Go&&t.jsxRuntimeExports.jsx(KW,{showCloseCardDrawer:!0,onCloseCloseCardDrawer:()=>{_e(!1),ut()},isChargeCardAdmin:!0,chargeCardsByCardId:{[le.cardId]:Go},cardRecurringExpensesByCardId:{[le.cardId]:le.recurringExpenses},cardRecurringExpenseFetchState:le.recurringExpensesFetchState.fetchState,closeCardFetchState:le.closeChargeCardsFetchState.fetchState,onConfirmClick:jn,onDismissClick:()=>{_e(!1),ut()},onRemoveCardClick:()=>{}}),$e&&le.cardId!=null&&Go&&t.jsxRuntimeExports.jsx(XW,{showLockCardDrawer:!0,onCloseLockCardDrawer:()=>{Be(!1),ut()},isChargeCardAdmin:!0,chargeCardsByCardId:{[le.cardId]:Go},cardRecurringExpensesByCardId:{[le.cardId]:le.recurringExpenses},cardRecurringExpenseFetchState:le.recurringExpensesFetchState.fetchState,lockCardFetchState:le.lockChargeCardsFetchState.fetchState,onConfirmClick:Ln,onDismissClick:()=>{Be(!1),ut()},onRemoveCardClick:()=>{}}),ke&&ae.bulkActionCardIds.length>0&&t.jsxRuntimeExports.jsx(KW,{showCloseCardDrawer:!0,onCloseCloseCardDrawer:()=>{Oe(!1),ye([])},isChargeCardAdmin:!0,chargeCardsByCardId:et.chargeCardsByCardId,cardRecurringExpensesByCardId:et.cardRecurringExpensesByCardId,cardRecurringExpenseFetchState:et.fetchState,closeCardFetchState:e.closeChargeCardsFetchState.fetchState,onConfirmClick:ri,onDismissClick:()=>{Oe(!1),ye([])},onRemoveCardClick:mn}),Te&&ae.bulkActionCardIds.length>0&&t.jsxRuntimeExports.jsx(XW,{showLockCardDrawer:!0,onCloseLockCardDrawer:()=>{Re(!1),ye([])},isChargeCardAdmin:!0,chargeCardsByCardId:et.chargeCardsByCardId,cardRecurringExpensesByCardId:et.cardRecurringExpensesByCardId,cardRecurringExpenseFetchState:et.fetchState,lockCardFetchState:e.lockChargeCardsFetchState.fetchState,onConfirmClick:Hc,onDismissClick:()=>{Re(!1),ye([])},onRemoveCardClick:mn}),Ne&&le.cardId!=null&&Go&&t.jsxRuntimeExports.jsx(rLe,{currentCardName:Go.cardName,renameFetchState:le.updateChargeCardNameFetchState.fetchState,onCancelClick:()=>{Pe(!1),ut()},onSubmitClick:Dt=>{le.cardId!=null&&K(le.cardId,Dt)}}),Ue&&le.cardId!=null&&Go&&t.jsxRuntimeExports.jsx(aLe,{controllerEmails:B,isChargeCardFeatureEnabled:$,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:A,productInformation:xn,cashbackInformation:_s,creditAccountInformation:us,debitAccountInformation:js,cardDetail:Go,depositAccountLimitFetchState:le.depositAccountLimitFetchState.fetchState,creditAccount:We,creditAccountRepayment:nt,signedInUser:F,isDebitCard:Go.type.code.includes("debit"),classListFetchState:"Not-Started",currentLimitAmount:Go.limit,currentSpentAmount:Go.balance,maxLimitAmount:Go.type.code.includes("debit")?le.depositAccountLimit?.cardLimits.dailyCardTransactionLimit:We.limit,isDisabled:Go.type.code.includes("debit")&&le.depositAccountLimitFetchState.fetchState!=="Completed",updateLimitFetchState:le.updateChargeCardLimitFetchState.fetchState,onCancelClick:()=>{Je(!1),ut()},onSubmitClick:Dt=>{if(le.cardId!=null){const mo={amount:Dt,currencyCode:Go.limit.currencyCode,currencySymbol:Go.limit.currencySymbol};f(le.cardId,mo,Go.creditLimitFrequency,Fe("0,0.[00]",mo))}},recommendations:Go.recommendations}),Me&&pt.length>0&&t.jsxRuntimeExports.jsx(TVn,{currentSpentAmount:Bt??{amount:0,currencyCode:pt[0].limit.currencyCode,currencySymbol:pt[0].limit.currencySymbol},maxLimitAmountForCreditCard:e.creditAccount.limit,maxLimitAmountForDebitCard:Ht,hasCreditCard:ae.hasCreditCards,hasDebitCard:ae.hasDebitCards,signedInUser:F,isDisabled:ae.hasDebitCards&&P.fetchState!=="Completed",updateLimitFetchState:e.updateChargeCardsSpendLimitFetchState.fetchState,onCancelClick:()=>{Ie(!1),ye([])},onSubmitClick:Dt=>{const mo={amount:Dt,currencyCode:pt[0].limit.currencyCode,currencySymbol:pt[0].limit.currencySymbol};h(ae.bulkActionCardIds,mo,pt[0].creditLimitFrequency)}}),t.jsxRuntimeExports.jsx(nLe,{cardsSelectedForBulkAction:ae.bulkActionCardIds,isBulkActionAllowed:pn,firstSelectedCardStatus:St,bulkSubmissionLimit:XTe,removeAllCardsFromBulkActionList:()=>ye([]),updateBulkActionList:ye,onProceedForBulkActionClick:yn,onBulkLockClick:Jt,onBulkCloseClick:gt,setShowBulkChangeSpendLimitPopup:Ie,depositAccountListWithDebitCardIssued:P,setCardIdForRowAction:ge,setActionTypeForRowAction:Qe,cashbackInformation:_s,creditAccountInformation:us,debitAccountInformation:js,productInformation:xn,controllerEmails:B,isChargeCardFeatureEnabled:$,isCardControlsEnabled:y,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:A,creditAccount:We,creditAccountRepayment:nt,cardList:e.cards,showViewForCardUser:!1,signedInUser:F,fetchState:e.fetchState,revokeChargeCardsInviteFetchState:e.revokeChargeCardsInviteFetchState.fetchState,unlockChargeCardsFetchState:e.unlockChargeCardsFetchState.fetchState,onReloadCards:ie,onChargeCardRowClick:G,searchText:n,receiptBotEmail:e.chargeCardConfig.receiptBotEmail,uiState:M,resendInviteId:e?.resendCardInvite?.cardId,onColumnSortConfigChanged:ne,onChargeCardResendInviteClick:J,rowActionView:le,isCardsCommentingEnabled:C})]})]})]}),C?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:`dashboard_${ds.currentTenant?.companyId}`,children:t.jsxRuntimeExports.jsx(tGn,{threadData:dt,isThreadsOpen:yt,setIsThreadsOpen:He,windowSize:nn,backgroundColor:Nt.colors.background})}):null]})},tGn=({threadData:e,isThreadsOpen:n,setIsThreadsOpen:i,windowSize:r,backgroundColor:a})=>{const l=ht(),c=g.useMemo(()=>({application:"dashboard",companyId:l.currentTenant?.companyId,tab:"cards",entityId:e?.entityId,isGlobalComment:!1}),[l.currentTenant?.companyId,e?.entityId]),{threads:d,isLoading:u}=O9({filter:c});return t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:n,allowComposer:!1,drawerTitle:XUn,threads:d,autoExpand:!0,autoFocus:!1,filter:{application:"dashboard",companyId:l.currentTenant?.companyId,isGlobalComment:!1,tab:"cards"},isLoading:u,textOverrides:{composerPlaceholder:qUn,replyComposerPlaceholder:ZUn,threadResolve:KUn,threadUnResolve:JUn},onThreadClick:()=>{},onCloseAllThreadsDrawer:()=>i(!1),drawerSectionStyle:{width:r==="small"?"100%":"400px",boxSizing:r==="small"?"border-box":"content-box",padding:`${o.sp0} ${o.sp4}`,backgroundColor:a},collapsibleThreadStyle:{width:r==="small"?"100%":"360px"}})},oGn=s(it)`
58978
+ `,UUn=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M4.99866 4.27356H11.0117",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M9.23645 4.27357C9.31133 4.27262 9.38331 4.24451 9.43902 4.19448C9.49474 4.14445 9.53039 4.0759 9.53937 4.00156C9.67299 3.19219 9.92504 2.40689 10.2874 1.67093C10.3173 1.61487 10.3291 1.55096 10.3214 1.48791C10.3137 1.42486 10.2867 1.36572 10.2441 1.31855C10.2011 1.27012 10.1436 1.23677 10.0802 1.22342C10.0167 1.21006 9.95069 1.21741 9.89175 1.24437C9.89175 1.24437 8.76236 1.80143 7.98768 1.80075C7.21532 1.80008 6.08979 1.24437 6.08979 1.24437C6.03085 1.21741 5.96481 1.21006 5.90138 1.22342C5.83796 1.23677 5.78048 1.27012 5.73741 1.31855C5.69487 1.36572 5.66789 1.42486 5.66014 1.48791C5.6524 1.55096 5.66427 1.61487 5.69414 1.67093C6.05651 2.40689 6.30855 3.19219 6.44217 4.00156C6.45115 4.0759 6.48681 4.14445 6.54252 4.19448C6.59823 4.24451 6.67022 4.27262 6.74509 4.27357",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M9.23641 4.27356C9.23641 4.27356 13.5638 7.67369 13.5638 10.6472C13.5638 13.7383 11.091 14.783 8 14.783C4.90898 14.783 2.43616 13.7197 2.43616 10.6472C2.43616 7.67369 6.76359 4.27356 6.76359 4.27356",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M8.03613 5.96594C8.31228 5.96594 8.53613 6.1898 8.53613 6.46594V6.84094H9.34863C9.62478 6.84094 9.84863 7.0648 9.84863 7.34094C9.84856 7.61702 9.62473 7.84094 9.34863 7.84094H7.37988C7.22241 7.84094 7.07131 7.90342 6.95996 8.01477C6.84866 8.12611 6.78613 8.27725 6.78613 8.43469C6.78617 8.59211 6.84864 8.7433 6.95996 8.85461C7.0713 8.96592 7.22244 9.02844 7.37988 9.02844H8.69238C9.11507 9.02844 9.52045 9.19635 9.81934 9.49524C10.1182 9.79412 10.2861 10.1995 10.2861 10.6222C10.2861 11.0448 10.1182 11.4503 9.81934 11.7491C9.52046 12.048 9.11504 12.2159 8.69238 12.2159H8.53613V12.5909C8.53606 12.867 8.31223 13.0909 8.03613 13.0909C7.76004 13.0909 7.53621 12.867 7.53613 12.5909V12.2159H6.72363C6.44754 12.2159 6.22371 11.992 6.22363 11.7159C6.22363 11.4398 6.44749 11.2159 6.72363 11.2159H8.69238C8.84982 11.2159 9.00096 11.1534 9.1123 11.0421C9.22362 10.9308 9.2861 10.7796 9.28613 10.6222C9.28613 10.4648 9.22361 10.3136 9.1123 10.2023C9.00095 10.0909 8.84986 10.0284 8.69238 10.0284H7.37988C6.95723 10.0284 6.55181 9.86049 6.25293 9.56165C5.95408 9.26279 5.78617 8.85733 5.78613 8.43469C5.78613 8.01204 5.95409 7.60662 6.25293 7.30774C6.55182 7.00885 6.95719 6.84094 7.37988 6.84094H7.53613V6.46594C7.53613 6.1898 7.75999 5.96594 8.03613 5.96594Z",fill:"currentColor"})),GY={contentContainerMargin:new w(p[3],p[4],p[8]),infoSubheadingTextMarginTop:new w(p[0],p[0]),cardsMinWidth:new w(343,353)},GUn={remainingText:new Ke("smallSemiBold","smallSemiBold")},YUn=O.getLocalizedStrings(),{spendManagement:{chargeCard:{payEarly:xa,cardList:dp,chargeCardsPromo:Qr}},common:rc,collaboration:{threads:{placeholder:{addANewComment:qUn,replyAComment:ZUn},tooltip:{resolveComment:KUn,unResolveComment:JUn}}},dateFormat:F$}=YUn,{texts:{comments:XUn}}=rc,eGn=({chargeCardListView:e,searchText:n,admins:i,companyLegalName:r,onFetchChargeCardsRecurringExpenses:a,onFetchDepositAccountLimit:l,onCloseChargeCard:c,onCloseChargeCardList:d,onLockChargeCard:u,onLockChargeCardList:m,onUnlockChargeCardList:x,updateChargeCardListSpendLimit:h,onUpdateSpendLimit:f,isCardControlsEnabled:y,isCardsCommentingEnabled:C,isCashbackFeatureEnabled:b,creditCardPayNowThreshold:E,isChargeCardFeatureEnabled:$,isCompanyInterestedInChargeCard:R,isCreditCardProductVisibleForExpressInterest:S,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:A,companyChargeCardInfoCreditAccountLimit:I,controllerEmails:B,onRevokeChargeCardList:L,depositAccountListWithDebitCardIssued:P,chargeCardCashbackDetailState:D,uiState:M,signedInUser:F,creditLimit:V,cashbackRate:N,onSearchTextChanged:H,navigateToCreditCardPaymentHistoryPage:W,onClickSetupIcon:U,isChargeCardPaymentHistoryFeatureEnabled:Y,isEarlyPayEnabled:q,onClickStatementsIcon:Z,onChargeCardRowClick:G,updateChargeCardName:K,onChargeCardResendInviteClick:J,onChargeCardRevokeInviteClick:oe,onUnlockChargeCard:ee,onIssueCardClick:te,onBackClick:se,onReloadCards:ie,onTotalCashbackClick:re,onColumnSortConfigChanged:ne,onClickMenuIcon:me,onPromoCardClick:pe,onCreateNowClick:je,showPayNowInfoTooltip:ce,navigateToCreditCardPaymentPage:de,shouldShowPayNowInfoTooltip:ue,rowActionView:le,bulkActionView:ae,onSetRowActionCardId:ge,onSetBulkActionCardIds:ye,isAiCfoAccessEnabled:he,onAskAiCfoClick:Ce})=>{const ve=ro().analytics,[Ee,Se]=g.useState(!1),[$e,Be]=g.useState(!1),[Ae,_e]=g.useState(!1),[Te,Re]=g.useState(!1),[ke,Oe]=g.useState(!1),[Me,Ie]=g.useState(!1),[Ne,Pe]=g.useState(!1),[Qe,Je]=g.useState(!1),[tt,Ue]=g.useState(void 0),[dt,ct]=g.useState(null),[yt,He]=g.useState(!1),jt=Dt=>{ct({...Dt}),He(!0)},St=ae.chargeCards[0]?.status.code,{creditAccount:We,creditAccountRepayment:nt}=e,ut=g.useCallback(()=>{ge(void 0),Ue(void 0)},[ge]),pt=ae.chargeCards,Bt=g.useMemo(()=>pt.length===0?void 0:pt.reduce((mo,to)=>to.balance.amount>mo.balance.amount?to:mo,pt[0]).balance,[pt]),Ht=g.useMemo(()=>{const Dt=pt.filter(eo=>eo.type.code.includes("debit"));if(Dt.length===0)return;const mo=Dt.map(eo=>P.depositAccounts.find(Zo=>Zo.id===eo.connectedAccountId)?.cardLimits.dailyCardTransactionLimit).filter(eo=>eo!==void 0);return mo.length===0?void 0:mo.reduce((eo,mi)=>mi.amount<eo.amount?mi:eo)},[pt,P.depositAccounts]),$o=Ye(e.unlockChargeCardsFetchState.fetchState),Tt=Ye(e.revokeChargeCardsInviteFetchState.fetchState),Gt=Ye(e.lockChargeCardsFetchState.fetchState),so=Ye(e.closeChargeCardsFetchState.fetchState),no=Ye(e.updateChargeCardsSpendLimitFetchState.fetchState);g.useEffect(()=>{const Dt=$o==="In-Progress"&&e.unlockChargeCardsFetchState.fetchState==="Completed",mo=Tt==="In-Progress"&&e.revokeChargeCardsInviteFetchState.fetchState==="Completed",to=Gt==="In-Progress"&&e.lockChargeCardsFetchState.fetchState==="Completed",eo=so==="In-Progress"&&e.closeChargeCardsFetchState.fetchState==="Completed",mi=no==="In-Progress"&&e.updateChargeCardsSpendLimitFetchState.fetchState==="Completed";(Dt||mo)&&ye([]),to&&(Re(!1),ye([])),eo&&(Oe(!1),ye([])),mi&&(Ie(!1),ye([]))},[e.unlockChargeCardsFetchState.fetchState,e.revokeChargeCardsInviteFetchState.fetchState,e.lockChargeCardsFetchState.fetchState,e.closeChargeCardsFetchState.fetchState,e.updateChargeCardsSpendLimitFetchState.fetchState,$o,Tt,Gt,so,no,ye]);const Xe=le.cardId!=null?le.unlockChargeCardsFetchState.fetchState:void 0,ft=Ye(Xe),oo=le.cardId!=null?le.updateChargeCardLimitFetchState.fetchState:void 0,on=Ye(oo),To=le.cardId!=null?le.updateChargeCardNameFetchState.fetchState:void 0,kn=Ye(To),Dn=le.cardId!=null?le.lockChargeCardsFetchState.fetchState:void 0,qt=Ye(Dn),dn=le.cardId!=null?le.closeChargeCardsFetchState.fetchState:void 0,Zs=Ye(dn),Yn=le.cardId!=null?le.revokeChargeCardFetchState.fetchState:void 0,Hs=Ye(Yn);g.useEffect(()=>{le.cardId!=null&&ft==="In-Progress"&&Xe==="Completed"?ut():le.cardId!=null&&on==="In-Progress"&&oo==="Completed"?(Je(!1),ut()):le.cardId!=null&&kn==="In-Progress"&&To==="Completed"?(Pe(!1),ut()):le.cardId!=null&&qt==="In-Progress"&&Dn==="Completed"?(Be(!1),ut()):le.cardId!=null&&Zs==="In-Progress"&&dn==="Completed"?(_e(!1),ut()):le.cardId!=null&&Hs==="In-Progress"&&Yn==="Completed"&&ut()},[le.cardId,Xe,oo,To,Dn,dn,Yn,ft,kn,on,qt,Zs,Hs,ut]);const yn=g.useCallback(Dt=>{switch(Dt){case"close":a(ae.bulkActionCardIds),Oe(!0);break;case"lock":a(ae.bulkActionCardIds),Re(!0);break;case"unlock":x(ae.bulkActionCardIds);break;case"update_limit":Ie(!0);break;case"revoke_invite":L(ae.bulkActionCardIds);break}},[ae.bulkActionCardIds,a,L,x]),Go=le.chargeCard;g.useEffect(()=>{if(!(tt===void 0||le.cardId===void 0||Go===void 0))switch(tt){case p3.CLOSE:Ae||(a([le.cardId]),_e(!0));break;case p3.LOCK:$e||(a([le.cardId]),Be(!0));break;case p3.UNLOCK:Xe!=="In-Progress"&&Xe!=="Completed"&&ee(le.cardId);break;case p3.REVOKE_INVITE:Yn!=="In-Progress"&&Yn!=="Completed"&&oe(le.cardId);break;case p3.RENAME:Ne||Pe(!0);break;case p3.UPDATE_SPEND_LIMIT:Qe||(Go.type.code.includes("debit")&&le.depositAccountLimitFetchState.fetchState!=="Completed"&&l(Go.connectedAccountId,le.cardId),Je(!0));break}},[tt,le.cardId,Qe,Ne,Ae,$e,Xe,Yn,a,l,ee,oe]);const ds=ht(),In=!!ds.loggedInUserRole.includes("charge_card_user"),ts=I0(ds),pn=Q.hasChargeCardAdminLevelAccess(ds.loggedInUserRoleMap),_s=g.useMemo(()=>pn===!0?{creditCardCashbackOffer:`${D.cashbackAnalytics.creditCardCashbackOffer}%`,debitCardCashbackOffer:`${D.cashbackAnalytics.debitCardCashbackOffer}%`,totalEarnedCashback:Ls(D.cashbackSummary.cashbackEarned.amount),redeemedCashback:Ls(D.cashbackSummary.cashbackRedeemed.amount),availableCashback:Ls(D.cashbackSummary.cashbackAvailable.amount),creditCardCashbackRedemptionMode:D.cashbackAnalytics.creditCardCashbackRedemptionMode,debitCardCashbackRedemptionMode:D.cashbackAnalytics.debitCardCashbackRedemptionMode}:void 0,[pn,D.cashbackAnalytics.creditCardCashbackOffer,D.cashbackAnalytics.debitCardCashbackOffer,D.cashbackSummary.cashbackEarned.amount,D.cashbackSummary.cashbackRedeemed.amount,D.cashbackSummary.cashbackAvailable.amount,D.cashbackAnalytics.creditCardCashbackRedemptionMode,D.cashbackAnalytics.debitCardCashbackRedemptionMode]),us=g.useMemo(()=>$&&A&&pn===!0?{creditAccountId:We.id,creditAccountLimit:Ls(We.limit.amount),creditAccountAvailableAmount:Ls(We.available.amount),creditAccountSpentAmount:Ls(We.balance.amount+We.hold.amount),creditAccountStatus:We.status,outstandingBalance:Ls(nt.remainingAmountDue.amount)}:void 0,[$,A,pn,We.id,We.limit.amount,We.available.amount,We.balance.amount,We.hold.amount,We.status,nt.remainingAmountDue.amount]),js=g.useMemo(()=>k&&T?{debitAccountId:P.depositAccounts.map(Dt=>Dt.id),debitAccountName:P.depositAccounts.map(Dt=>Dt.accountName),debitAccountBalance:P.depositAccounts.map(Dt=>Ls(Dt.accountBalance.available.amount)),debitCardsSpend:Ls(e.debitCardSummary?.currentMonthSpends?.amount??0),debitAccountStatus:P.depositAccounts.map(Dt=>Dt.accountStatus)}:void 0,[k,T,P.depositAccounts,e.debitCardSummary?.currentMonthSpends?.amount]),xn={isCreditCardOffered:$,isDebitCardOffered:k,isDebitCardEnabled:T,isCreditCardEnabled:A},As=Dt=>{Se(Dt),Dt===!0&&(ve.trackCardsListPageClicked("search"),(!$||We.fetchState==="Completed"&&nt.fetchState==="Completed")&&(!(k&&T)||P.fetchState==="Completed")&&_s!=null&&ve.trackCardsCardListSearchClick(B,xn,_s,us,js))},nn=X(),os=ts&&!pn,qe=e.creditAccount.balance.amount+e.creditAccount.hold.amount,xt={amount:qe,currencyCode:e.creditAccount.balance.currencyCode,currencySymbol:e.creditAccount.balance.currencySymbol},Wt=Math.round(xt.amount*100/e.creditAccount.limit.amount),Ze=isNaN(Wt)?0:qe!==0&&Wt===0?1:Wt,Mo=e.chargeCardConfig.rePaymentInfo?.cardLimitResetDate,Lo=pn&&xt.amount>E*e.creditAccount.limit.amount/100,_n=Mo!=null&&nt.initiatedRepayments.amount>0,ns={entity:"charge_cards",showNewButtonOnNavbar:pn,showEntityEmailInfoIconOnNavbar:!1,newButtonLabel:pn?dp.newBtnLabel:rc.strings.empty,hideSearchBtn:In,searchTextBoxStyle:{right:os?o.sp4:"120px",paddingTop:o.sp0},moreIconContainerStyle:{paddingRight:o.sp0},isSearchOpen:Ee,searchPlaceHolder:dp.searchPlaceHolder,searchText:n,showSettingsIcon:!In,showSettingsIconOnNavbar:pn,showStatementButtonOnNavbar:$&&A,showPayEarlyButtonOnNavbar:q&&pn&&xt.amount>0&&!_n&&!Lo,showPaymentHistoryButtonOnNavbar:pn&&Y&&$&&A,onClickPaymentHistoryIcon:W,showDownloadButtonOnNavbar:!1,disableDownloadButton:!0,analytics:ve,onSearchOpen:As,onSearchTextChanged:H,onClickSetupIcon:U,onClickStatementsIcon:Z,downloadState:"Not-Started",onNewButtonClick:te,onClickPayEarlyIcon:()=>de("More Button","Pay Early"),onMenuOpen:()=>{(!$||We.fetchState==="Completed"&&nt.fetchState==="Completed")&&(!(k&&T)||P.fetchState==="Completed")&&_s!=null&&ve.trackCardsCardListMoreMenuClick(B,xn,_s,us,js)},filters:{categoryCombinationOperator:"AND",categories:[]}},Vt=t.jsxRuntimeExports.jsxs(ii,{children:[t.jsxRuntimeExports.jsx(lB,{spendManagementSectionProps:ns}),t.jsxRuntimeExports.jsx(ms,{dataTestId:"cards-ask-ai-cfo-button",isAiCfoAccessEnabled:he,onAskAiCfoClick:Ce})]}),en=e.cards.length===0?!1:In&&Q.anyCardOnHold(e.cards),On=e.fetchState==="Completed"?cGn({isChargeCardFeatureEnabled:$,isChargeCardSetupEnabled:A,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:T}):"",$t=e.debitCardSummary!=null?e.debitCardSummary.currentMonthSpends.amount-e.debitCardSummary.lastCompletedMonthSpends.amount:0,bo=$&&A&&e.hasCreditCard,mt=k&&T&&e.hasDebitCard,Qt=$&&A&&ts&&!pn,wt=k&&T&&ts&&!pn,_o=(bo||Qt||$&&A||S?1:0)+(mt||wt||k&&T||k?1:0)+1,Ct=e.chargeCardConfig.rePaymentInfo?.rePaymentDueDate?.diff(Q.dateNow(),"days")??0,Ot=[xa.payNow,Ct>0&&Ct<11?`${xa.billDueIn} ${Ct} ${Ct===1?rc.timeStrings.day:rc.timeStrings.days}`:xa.creditLimitLow,xa.payNow],Yo=nt.initiatedRepayments.amount===We.balance.amount+We.hold.amount,Mt=nt.paymentMethod==="ACH",fo=[xa.paymentInitiated,`${dp.header.limit} ${Yo?rc.resets:rc.updates} ${rc.by} ${Q.zeniDate(Q.getNextNthWorkingDay(nt.initiatedRepaymentDate?.toDate()??Q.dateNow().toDate(),[0,6],Mt?3:1).toDateString()).format(F$.visual.MMMDFormat)}`,xa.paymentInitiated],ot=g.useRef(null),Lt=g.useRef(null),Nt=t.useTheme(),[qn,vo]=g.useState(!0);g.useEffect(()=>{const Dt=()=>{Lt.current&&(Lt.current.getBoundingClientRect().top<(nn==="small"?68:40)?vo(!1):vo(!0))};Dt();const mo=()=>{Dt()},to=ot.current;return to&&to.addEventListener("scroll",mo),window.addEventListener("scroll",mo),()=>{to&&to.removeEventListener("scroll",mo),window.removeEventListener("scroll",mo)}},[nn]);const jn=Dt=>{const mo=Dt.reasonType==="other"?Dt.reason:Dt.reasonType;le.cardId!=null&&c(le.cardId,mo)},Ln=Dt=>{const mo=Dt.reasonType==="other"?Dt.reason:Dt.reasonType;le.cardId!=null&&u(le.cardId,mo)},ri=Dt=>{const mo=Dt.reasonType==="other"?Dt.reason:Dt.reasonType;d(ae.bulkActionCardIds,mo)},Hc=Dt=>{const mo=Dt.reasonType==="other"?Dt.reason:Dt.reasonType;m(ae.bulkActionCardIds,mo)},et=g.useMemo(()=>{const Dt={};return ae.chargeCards.forEach(mo=>{Dt[mo.id]=mo}),{chargeCardsByCardId:Dt,cardRecurringExpensesByCardId:ae.recurringExpensesByCardId,fetchState:ae.recurringExpensesFetchState.fetchState}},[ae]),Jt=g.useCallback(()=>{a(ae.bulkActionCardIds),Re(!0)},[ae.bulkActionCardIds,a]),gt=g.useCallback(()=>{a(ae.bulkActionCardIds),Oe(!0)},[ae.bulkActionCardIds,a]),mn=g.useCallback(Dt=>{const mo=ae.bulkActionCardIds.filter(to=>to!==Dt);ye(mo),mo.length===0&&(Re(!1),Oe(!1))},[ae.bulkActionCardIds,ye]),zt=R&&I===0,tn=I===-1;return t.jsxRuntimeExports.jsxs(v0,{sharedItems:{sharedFunctions:{subtreeFunctions:{openAllThreadsDrawer:jt}},sharedRef:void 0},children:[t.jsxRuntimeExports.jsxs(gGn,{ref:ot,children:[t.jsxRuntimeExports.jsx(Rt,{title:On,showBackButton:nn!=="medium-compact"&&nn!=="small",showMenuIcon:nn==="medium-compact"||nn==="small",onClickMenuIcon:me,style:{zIndex:3},onBackClick:se,rightSideComponent:Vt,isSearchOpen:Ee,hideSearchBtn:In,scrollableContent:ot,source:"ChargeCardListPage",backgroundColor:Nt.colors.grey4}),e.fetchState==="Not-Started"||e.fetchState==="In-Progress"?t.jsxRuntimeExports.jsx(STe,{isCardUser:In,showTopSummaryCards:!In,topSummaryCardCount:_o}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[In?null:t.jsxRuntimeExports.jsxs(fGn,{windowSize:nn,children:[bo||Qt?t.jsxRuntimeExports.jsxs(Lge,{windowSize:nn,"data-testid":_("credit-card-spend-bar-container"),children:[t.jsxRuntimeExports.jsxs(Dge,{children:[t.jsxRuntimeExports.jsxs(Oge,{children:[t.jsxRuntimeExports.jsx(mz,{children:dp.creditCardBalance}),t.jsxRuntimeExports.jsx(PGn,{})]}),t.jsxRuntimeExports.jsxs(_ge,{children:[t.jsxRuntimeExports.jsxs(BGn,{children:[t.jsxRuntimeExports.jsx(ls,{amount:xt,integerStyles:{...z.h7Medium.cssObject},decimalStyles:{...z.extraLargeSemiBold.cssObject}}),t.jsxRuntimeExports.jsx(jGn,{children:rc.texts.spent})]}),Lo&&!_n&&q?t.jsxRuntimeExports.jsx(Le,{placement:"bottom",title:t.jsxRuntimeExports.jsx(aGn,{children:xa.creditLimitIsRunningLow}),children:t.jsxRuntimeExports.jsxs(Bge,{children:[t.jsxRuntimeExports.jsx(ls,{amount:e.creditAccount.available,integerStyles:z.smallSemiBold.cssObject,decimalStyles:z.smallSemiBold.cssObject}),t.jsxRuntimeExports.jsx(Pge,{windowSize:nn,children:rc.texts.remaining}),t.jsxRuntimeExports.jsx(lGn,{children:t.jsxRuntimeExports.jsx(rGn,{})})]})}):t.jsxRuntimeExports.jsxs(Bge,{children:[t.jsxRuntimeExports.jsx(ls,{amount:e.creditAccount.available,integerStyles:z.smallSemiBold.cssObject,decimalStyles:z.smallSemiBold.cssObject}),t.jsxRuntimeExports.jsx(Pge,{windowSize:nn,children:rc.texts.remaining})]})]}),t.jsxRuntimeExports.jsx(SGn,{children:t.jsxRuntimeExports.jsx(AGn,{style:{width:`${Ze}%`}})}),t.jsxRuntimeExports.jsx(bGn,{children:`${rc.texts.limit}: ${Ao("0,0",e.creditAccount.limit.amount,e.creditAccount.limit.currencySymbol)}`})]}),t.jsxRuntimeExports.jsxs(mGn,{showPaymentInitiatedInfo:_n,isEarlyPayEnabled:q,children:[_n&&q?null:t.jsxRuntimeExports.jsx(Mge,{children:`${rc.texts.limitReset} ${Mo!=null?Mo.format(F$.visual.MMMDFormat):null}`}),pn&&q&&(_n?t.jsxRuntimeExports.jsx(LGn,{children:t.jsxRuntimeExports.jsx(Le,{maxWidth:"242px",display:"flex",title:t.jsxRuntimeExports.jsxs(dGn,{children:[t.jsxRuntimeExports.jsx(Tge,{children:`${xa.paymentOf} ${Fe("0,0.[00]",{amount:nt.initiatedRepayments.amount,currencyCode:nt.initiatedRepayments.currencyCode,currencySymbol:nt.initiatedRepayments.currencySymbol})} ${xa.madeOn} `}),t.jsxRuntimeExports.jsx(uGn,{children:nt.initiatedRepaymentDate?.format(F$.visual.MMMDFormat)}),rc.strings.space,t.jsxRuntimeExports.jsx(Tge,{children:Mt?Yo?xa.isProcessingAndWillResetTheCreditLimitIn23BusinessDays:xa.isProcessingAndWillUpdateTheCreditLimitIn23BusinessDays:Yo?xa.isProcessingAndWillResetTheCreditLimitIn1BusinessDay:xa.isProcessingAndWillUpdateTheCreditLimitIn1BusinessDay})]}),placement:"bottom",children:t.jsxRuntimeExports.jsxs(Age,{hasPointer:!1,children:[fo.length>0&&t.jsxRuntimeExports.jsx(ige,{slideUpCount:fo.length,style:{alignItems:"flex-end",width:"auto"},children:fo.map((Dt,mo)=>t.jsxRuntimeExports.jsx(nGn,{children:Dt},`card-payment-initiated-${mo.toString()}`))}),t.jsxRuntimeExports.jsx(iGn,{})]})})}):Lo?t.jsxRuntimeExports.jsx(Le,{variant:"informative",display:"flex",arrow:!0,style:{top:o.sp2,left:"22px",position:"relative"},data:{preHeading:"URGENT",heading:xa.creditLimitIsLow,description:xa.transactionsMayBeDeclinedBecauseTheCreditLimitIsRunningLow,buttonText:xa.payNow,tooltipContentStyle:{width:"240px",boxSizing:"content-box",gap:o.sp0},tooltipIntroductionStyle:{color:v.important},buttonStyle:{width:"auto",whiteSpace:"nowrap"},onButtonClick:()=>{ue(!1),de("Toast Button","Pay Now")},showCloseButton:!0,onClose:Dt=>{Dt.preventDefault(),Dt.stopPropagation(),ue(!1)}},title:"informative",placement:"bottom-end",open:ce&&qn,children:t.jsxRuntimeExports.jsxs(Age,{ref:Lt,onClick:()=>{ue(!1),de("Text Button","Pay Now")},hasPointer:!0,children:[Ot.length>0&&t.jsxRuntimeExports.jsx(ige,{slideUpCount:Ot.length,style:{alignItems:"flex-end",width:"auto"},children:Ot.map((Dt,mo)=>t.jsxRuntimeExports.jsx(oGn,{isImportant:mo===1,children:Dt},`card-pay-now-${mo.toString()}`))}),t.jsxRuntimeExports.jsx(kge,{})]})}):xt.amount>0?t.jsxRuntimeExports.jsxs(sGn,{onClick:()=>de("Text Button","Pay Early"),children:[xa.payEarly,t.jsxRuntimeExports.jsx(kge,{})]}):null)]})]}):$&&A?t.jsxRuntimeExports.jsx(sge,{cardType:"creditCard","data-testid":_("card-list-page-promo-card-back","credit"),header:Qr.listPage.spendSmarter,title:Qr.listPage.setUpText.replace("__cardType__",Qr.listPage.credit),creditLimit:Ao("0,0",V.amount,V.currencySymbol),onCreateNowClick:je}):S?t.jsxRuntimeExports.jsx(nge,{cardPromoType:"credit","data-testid":_("card-list-page-promo-card","credit"),cardText:Qr.listPage.creditCards,header:Qr.listPage.getAccessTo,title:Qr.listPage.creditCards,subTitle:Qr.listPage.promoSubText.credit,slidingTextList:Ige("credit",N,{amount:I,currencyCode:V.currencyCode,currencySymbol:V.currencySymbol}),onClick:pe,status:tn?"rejected":zt?"under_review":void 0,statusMessage:tn?Qr.listPage.status.rejectedMessage:zt?Qr.listPage.status.underReviewMessage:void 0}):null,mt||wt?t.jsxRuntimeExports.jsxs(Lge,{windowSize:nn,"data-testid":_("debit-spend-bar-container"),children:[t.jsxRuntimeExports.jsxs(Dge,{children:[t.jsxRuntimeExports.jsxs(Oge,{children:[t.jsxRuntimeExports.jsx(mz,{children:dp.debitCardSpend}),t.jsxRuntimeExports.jsx(MGn,{})]}),t.jsxRuntimeExports.jsx(_ge,{children:t.jsxRuntimeExports.jsx(TGn,{children:t.jsxRuntimeExports.jsx(ls,{amount:e.debitCardSummary?.currentMonthSpends,integerStyles:{...z.h7Medium.cssObject},decimalStyles:{...z.extraLargeSemiBold.cssObject}})})}),t.jsxRuntimeExports.jsx(wGn,{children:$t!==0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[$t<0?t.jsxRuntimeExports.jsx($Gn,{}):t.jsxRuntimeExports.jsx(RGn,{}),t.jsxRuntimeExports.jsx(EGn,{hasNegativeValue:$t<0,children:Ao("0,0.00",$t,e.debitCardSummary?.currentMonthSpends.currencySymbol)}),t.jsxRuntimeExports.jsx(dLe,{children:dp.compareToLastMonth})]}):null})]}),t.jsxRuntimeExports.jsx(cLe,{children:t.jsxRuntimeExports.jsxs(Mge,{children:[`${rc.texts.limitReset} `,t.jsxRuntimeExports.jsx(CGn,{children:Mo!=null?Mo.format(F$.visual.MMMDFormat):null})]})})]}):k&&T?t.jsxRuntimeExports.jsx(sge,{cardType:"debitCard","data-testid":_("card-list-page-promo-card-back","debit"),header:Qr.listPage.spendSmarter,title:Qr.listPage.setUpText.replace("__cardType__",Qr.listPage.debit),onCreateNowClick:je}):k?t.jsxRuntimeExports.jsx(nge,{cardPromoType:"debit","data-testid":_("card-list-page-promo-card","debit"),cardText:Qr.listPage.debitCards,header:Qr.listPage.getAccessTo,title:Qr.listPage.debitCards,subTitle:Qr.listPage.promoSubText.debit,slidingTextList:Ige("debit",N),onClick:pe}):null,t.jsxRuntimeExports.jsxs(yGn,{windowSize:nn,"data-testid":_("credit-spend-info-container"),children:[b?t.jsxRuntimeExports.jsxs(pGn,{children:[t.jsxRuntimeExports.jsx(mz,{style:{textAlign:"start"},children:dp.totalCashback}),t.jsxRuntimeExports.jsx(ls,{amount:e.totalCashback,style:{justifyContent:"flex-start",color:v.success,marginTop:o.sp1},integerStyles:z.h7Medium.cssObject,decimalStyles:z.standardSemiBold.cssObject}),e.totalCashback.amount>0?t.jsxRuntimeExports.jsx(hGn,{windowSize:nn,children:t.jsxRuntimeExports.jsxs(vGn,{windowSize:nn,onClick:re,"data-testid":_("total-cashback-info"),children:[t.jsxRuntimeExports.jsx(xGn,{children:dp.overview}),t.jsxRuntimeExports.jsx(kGn,{})]})}):null]}):null,t.jsxRuntimeExports.jsx(DGn,{})]})]}),e.cards.length===0&&In===!0||en?t.jsxRuntimeExports.jsx(IGn,{children:t.jsxRuntimeExports.jsx(yTe,{companyLegalName:r,cards:e.cards,admins:i,hasZeniFinopsRoles:ts,cashbackRate:N})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[Ae&&le.cardId!=null&&Go&&t.jsxRuntimeExports.jsx(KW,{showCloseCardDrawer:!0,onCloseCloseCardDrawer:()=>{_e(!1),ut()},isChargeCardAdmin:!0,chargeCardsByCardId:{[le.cardId]:Go},cardRecurringExpensesByCardId:{[le.cardId]:le.recurringExpenses},cardRecurringExpenseFetchState:le.recurringExpensesFetchState.fetchState,closeCardFetchState:le.closeChargeCardsFetchState.fetchState,onConfirmClick:jn,onDismissClick:()=>{_e(!1),ut()},onRemoveCardClick:()=>{}}),$e&&le.cardId!=null&&Go&&t.jsxRuntimeExports.jsx(XW,{showLockCardDrawer:!0,onCloseLockCardDrawer:()=>{Be(!1),ut()},isChargeCardAdmin:!0,chargeCardsByCardId:{[le.cardId]:Go},cardRecurringExpensesByCardId:{[le.cardId]:le.recurringExpenses},cardRecurringExpenseFetchState:le.recurringExpensesFetchState.fetchState,lockCardFetchState:le.lockChargeCardsFetchState.fetchState,onConfirmClick:Ln,onDismissClick:()=>{Be(!1),ut()},onRemoveCardClick:()=>{}}),ke&&ae.bulkActionCardIds.length>0&&t.jsxRuntimeExports.jsx(KW,{showCloseCardDrawer:!0,onCloseCloseCardDrawer:()=>{Oe(!1),ye([])},isChargeCardAdmin:!0,chargeCardsByCardId:et.chargeCardsByCardId,cardRecurringExpensesByCardId:et.cardRecurringExpensesByCardId,cardRecurringExpenseFetchState:et.fetchState,closeCardFetchState:e.closeChargeCardsFetchState.fetchState,onConfirmClick:ri,onDismissClick:()=>{Oe(!1),ye([])},onRemoveCardClick:mn}),Te&&ae.bulkActionCardIds.length>0&&t.jsxRuntimeExports.jsx(XW,{showLockCardDrawer:!0,onCloseLockCardDrawer:()=>{Re(!1),ye([])},isChargeCardAdmin:!0,chargeCardsByCardId:et.chargeCardsByCardId,cardRecurringExpensesByCardId:et.cardRecurringExpensesByCardId,cardRecurringExpenseFetchState:et.fetchState,lockCardFetchState:e.lockChargeCardsFetchState.fetchState,onConfirmClick:Hc,onDismissClick:()=>{Re(!1),ye([])},onRemoveCardClick:mn}),Ne&&le.cardId!=null&&Go&&t.jsxRuntimeExports.jsx(rLe,{currentCardName:Go.cardName,renameFetchState:le.updateChargeCardNameFetchState.fetchState,onCancelClick:()=>{Pe(!1),ut()},onSubmitClick:Dt=>{le.cardId!=null&&K(le.cardId,Dt)}}),Qe&&le.cardId!=null&&Go&&t.jsxRuntimeExports.jsx(aLe,{controllerEmails:B,isChargeCardFeatureEnabled:$,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:A,productInformation:xn,cashbackInformation:_s,creditAccountInformation:us,debitAccountInformation:js,cardDetail:Go,depositAccountLimitFetchState:le.depositAccountLimitFetchState.fetchState,creditAccount:We,creditAccountRepayment:nt,signedInUser:F,isDebitCard:Go.type.code.includes("debit"),classListFetchState:"Not-Started",currentLimitAmount:Go.limit,currentSpentAmount:Go.balance,maxLimitAmount:Go.type.code.includes("debit")?le.depositAccountLimit?.cardLimits.dailyCardTransactionLimit:We.limit,isDisabled:Go.type.code.includes("debit")&&le.depositAccountLimitFetchState.fetchState!=="Completed",updateLimitFetchState:le.updateChargeCardLimitFetchState.fetchState,onCancelClick:()=>{Je(!1),ut()},onSubmitClick:Dt=>{if(le.cardId!=null){const mo={amount:Dt,currencyCode:Go.limit.currencyCode,currencySymbol:Go.limit.currencySymbol};f(le.cardId,mo,Go.creditLimitFrequency,Fe("0,0.[00]",mo))}},recommendations:Go.recommendations}),Me&&pt.length>0&&t.jsxRuntimeExports.jsx(TVn,{currentSpentAmount:Bt??{amount:0,currencyCode:pt[0].limit.currencyCode,currencySymbol:pt[0].limit.currencySymbol},maxLimitAmountForCreditCard:e.creditAccount.limit,maxLimitAmountForDebitCard:Ht,hasCreditCard:ae.hasCreditCards,hasDebitCard:ae.hasDebitCards,signedInUser:F,isDisabled:ae.hasDebitCards&&P.fetchState!=="Completed",updateLimitFetchState:e.updateChargeCardsSpendLimitFetchState.fetchState,onCancelClick:()=>{Ie(!1),ye([])},onSubmitClick:Dt=>{const mo={amount:Dt,currencyCode:pt[0].limit.currencyCode,currencySymbol:pt[0].limit.currencySymbol};h(ae.bulkActionCardIds,mo,pt[0].creditLimitFrequency)}}),t.jsxRuntimeExports.jsx(nLe,{cardsSelectedForBulkAction:ae.bulkActionCardIds,isBulkActionAllowed:pn,firstSelectedCardStatus:St,bulkSubmissionLimit:XTe,removeAllCardsFromBulkActionList:()=>ye([]),updateBulkActionList:ye,onProceedForBulkActionClick:yn,onBulkLockClick:Jt,onBulkCloseClick:gt,setShowBulkChangeSpendLimitPopup:Ie,depositAccountListWithDebitCardIssued:P,setCardIdForRowAction:ge,setActionTypeForRowAction:Ue,cashbackInformation:_s,creditAccountInformation:us,debitAccountInformation:js,productInformation:xn,controllerEmails:B,isChargeCardFeatureEnabled:$,isCardControlsEnabled:y,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:A,creditAccount:We,creditAccountRepayment:nt,cardList:e.cards,showViewForCardUser:!1,signedInUser:F,fetchState:e.fetchState,revokeChargeCardsInviteFetchState:e.revokeChargeCardsInviteFetchState.fetchState,unlockChargeCardsFetchState:e.unlockChargeCardsFetchState.fetchState,onReloadCards:ie,onChargeCardRowClick:G,searchText:n,receiptBotEmail:e.chargeCardConfig.receiptBotEmail,uiState:M,resendInviteId:e?.resendCardInvite?.cardId,onColumnSortConfigChanged:ne,onChargeCardResendInviteClick:J,rowActionView:le,isCardsCommentingEnabled:C})]})]})]}),C?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:`dashboard_${ds.currentTenant?.companyId}`,children:t.jsxRuntimeExports.jsx(tGn,{threadData:dt,isThreadsOpen:yt,setIsThreadsOpen:He,windowSize:nn,backgroundColor:Nt.colors.background})}):null]})},tGn=({threadData:e,isThreadsOpen:n,setIsThreadsOpen:i,windowSize:r,backgroundColor:a})=>{const l=ht(),c=g.useMemo(()=>({application:"dashboard",companyId:l.currentTenant?.companyId,tab:"cards",entityId:e?.entityId,isGlobalComment:!1}),[l.currentTenant?.companyId,e?.entityId]),{threads:d,isLoading:u}=O9({filter:c});return t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:n,allowComposer:!1,drawerTitle:XUn,threads:d,autoExpand:!0,autoFocus:!1,filter:{application:"dashboard",companyId:l.currentTenant?.companyId,isGlobalComment:!1,tab:"cards"},isLoading:u,textOverrides:{composerPlaceholder:qUn,replyComposerPlaceholder:ZUn,threadResolve:KUn,threadUnResolve:JUn},onThreadClick:()=>{},onCloseAllThreadsDrawer:()=>i(!1),drawerSectionStyle:{width:r==="small"?"100%":"400px",boxSizing:r==="small"?"border-box":"content-box",padding:`${o.sp0} ${o.sp4}`,backgroundColor:a},collapsibleThreadStyle:{width:r==="small"?"100%":"360px"}})},oGn=s(it)`
58979
58979
  color: ${e=>e.isImportant?v.important:e.theme.colors.primary};
58980
58980
  text-align: end;
58981
58981
  `,nGn=s(it)`
@@ -59608,7 +59608,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
59608
59608
  color: ${v.primaryDark};
59609
59609
  padding: 2px ${o.sp2};
59610
59610
  background-color: ${v.blackColor};
59611
- `,fLe=e=>j.createElement("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M35 35H5.85714C4.56895 35 3.33352 34.2836 2.42262 33.0083C1.51173 31.7331 1 30.0035 1 28.2V1",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),yLe=e=>j.createElement("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M35 1L35 30.1429C35 31.4311 34.2836 32.6665 33.0083 33.5774C31.7331 34.4883 30.0035 35 28.2 35L1 35",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),jLe=e=>j.createElement("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M35 1H5.85714C4.56895 1 3.33352 1.71643 2.42262 2.99167C1.51173 4.26692 1 5.99653 1 7.8V35",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),CLe=e=>j.createElement("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M35 35L35 5.85714C35 4.56895 34.2836 3.33352 33.0083 2.42262C31.7331 1.51173 30.0035 1 28.2 1L1 0.999999",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),{common:sqn,spendManagement:{chargeCard:{cardDetails:jl}}}=O.getLocalizedStrings(),Aa={chargeCardWidth:384,chargeCardHeight:240,cardLoadingShineWidth:200,cardLoadingShineHeight:240,zeniLogoWidth:p[6],zeniLogoHeight:p[6],visaLogoWidth:p[6],visaLogoHeight:13,cardTintIconWidth:277,cardTintIconHeight:242,colorPaletteLeftTransitionValue:-350,rightSectionWidth:384,rightSectionHeight:240,cardContainerContentGap:new w(p[4],p[4],p[4],p[3])},bLe=({isChargeCardAdmin:e,chargeCardDetailView:n,productInformation:i,cashbackInformation:r,creditAccountInformation:a,debitAccountInformation:l,secretRevealed:c,isOwnCard:d,vgsVaultId:u,showSecretInfo:m,controllerEmails:x,isChargeCardFeatureEnabled:h,isDebitCardFeatureEnabled:f,isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:C,chargeCardCashbackDetailState:b,creditAccount:E,creditAccountRepayment:$,isShowingInDrawer:R,isSandboxEnv:S,isCardDetailErrored:k,signedInUserToken:T,selectedColor:A,cardDetailsFetchState:I,setCardDetailsFetchState:B,setIsCardDetailErrored:L,setShowSecretInfo:P,setSecretRevealed:D,setShowPhoneNumberForOtp:M,isCardDetailFetching:F,handleColorCodeClick:V,onFireOnClickAnalytics:N,onUnlockChargeCard:H})=>{const[W,U]=g.useState(!1),[Y,q]=g.useState(!1),[Z,G]=g.useState(!1),[K,J]=g.useState(!1),[oe,ee]=g.useState(!1),[te,se]=g.useState(!1),[ie,re]=g.useState(()=>{const Je=n.chargeCard?.status.code;return Je==="locked"||Je==="closed"||Je==="closed_by_customer"}),[ne,me]=g.useState(!1),[pe,je]=g.useState(!1),ce=g.useRef(void 0),de=n.chargeCard?.type.code??"business_virtual_credit_card",{isMobileOrTabletScreen:ue}=W5(),le=X(),ae=R?.75:le==="small"?.85:1,ge=n.lockChargeCardsFetchState.fetchState,ye=Ye(ge),he=n.unlockChargeCardsFetchState.fetchState,Ce=Ye(he),we=n.closeChargeCardsFetchState.fetchState,ve=Ye(we),Ee=n.chargeCard?.status.code==="locked",Se=n.chargeCard?.status.code==="closed"||n.chargeCard?.status.code==="closed_by_customer",[$e]=Rn("UnlockCard"),[Be]=Rn("LockCard"),[Ae]=Rn("CloseCard");g.useEffect(()=>{if(!(Y&&Ee)){G(!1);return}const tt=setTimeout(()=>{G(!0)},400);return()=>clearTimeout(tt)},[Y,Ee]),g.useEffect(()=>{(Ee||Se)&&!ie&&(re(!0),me(!1))},[Ee,Se]),g.useEffect(()=>{ye==="In-Progress"&&ge==="Completed"&&(ce.current&&clearTimeout(ce.current),J(!1),re(!1),me(!0),setTimeout(()=>{J(!0)},0),ce.current=setTimeout(()=>{J(!1),re(!0),q(!1)},1e3))},[ge,ye]),g.useEffect(()=>{Ce==="In-Progress"&&he==="Completed"&&(ce.current&&clearTimeout(ce.current),je(!0),ee(!1),setTimeout(()=>{ee(!0)},0),ce.current=setTimeout(()=>{ee(!1),re(!1),je(!1)},1e3))},[he,Ce]),g.useEffect(()=>{ve==="In-Progress"&&we==="Completed"&&(ce.current&&clearTimeout(ce.current),se(!1),re(!1),me(!0),setTimeout(()=>{se(!0)},0),ce.current=setTimeout(()=>{se(!1),re(!0)},1e3))},[we,ve]);const _e=ue?jl.tapCardCopyText:jl.scanNowAndAddToWallet,Te=ue?jl.tapCardCopyText:t.jsxRuntimeExports.jsxs(lqn,{children:[t.jsxRuntimeExports.jsx(Lqn,{}),jl.clickTheCardToFetchDetailsText]}),Re=n.chargeCard?.isLockedByAdmin??!1,ke=le==="small"?jl.tapCardCopyText:jl.clickTheCardToCopyDetailsText,Oe=le==="small"?jl.tapCardCopyText:jl.clickTheCardToFetchDetailsText,Me=R?_e:ke,Ie=R?Te:Oe,Ne=F(I)||n.updateFetchState.fetchState==="In-Progress"||n.unlockChargeCardsFetchState.fetchState==="In-Progress",Pe=(I.cvv!==!0||I.number!==!0)&&d,Ue=!!n.chargeCard?.type.code.includes("debit");return t.jsxRuntimeExports.jsxs(xqn,{windowSize:le,scaleFactor:ae,children:[t.jsxRuntimeExports.jsxs(gqn,{isCardLocked:Ee,isChargeCardAdmin:e,isLockedByAdmin:Re,unlockFetchState:n.unlockChargeCardsFetchState.fetchState,onClick:Je=>{Je.stopPropagation(),Ee&&he!=="In-Progress"&&(e||!Re)&&H(e)},onMouseEnter:()=>{(e||!Re)&&he!=="In-Progress"&&q(!0)},onMouseLeave:()=>{(e||!Re)&&he!=="In-Progress"&&q(!1)},children:[c&&R?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Aqn,{}),t.jsxRuntimeExports.jsx(kqn,{}),t.jsxRuntimeExports.jsx(Iqn,{}),t.jsxRuntimeExports.jsx(Tqn,{})]}):null,t.jsxRuntimeExports.jsx(fqn,{play:ie,animate:ne,fadeOut:pe,unlockInProgress:he==="In-Progress"||pe||Ce==="In-Progress"&&he==="Completed"}),oe&&$e!=null?t.jsxRuntimeExports.jsx(Aj,{style:{width:o.sp9,height:o.sp9,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:2,backgroundColor:v.overlayBackgroundBlack,borderRadius:o.sp11},animationData:$e,loop:!1,play:oe,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}}):te&&Ae!=null?t.jsxRuntimeExports.jsx(Aj,{style:{width:56,height:56,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:2},animationData:Ae,loop:!1,play:te,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}}):ie?Se?t.jsxRuntimeExports.jsx($qn,{}):he==="In-Progress"?t.jsxRuntimeExports.jsx(Cqn,{}):pe||Ce==="In-Progress"&&he==="Completed"?null:t.jsxRuntimeExports.jsx(Eqn,{isHovered:Y&&Ee,children:t.jsxRuntimeExports.jsxs(wqn,{isHovered:Y&&Ee,children:[t.jsxRuntimeExports.jsx(wLe,{}),t.jsxRuntimeExports.jsx(bqn,{isVisible:Y&&Ee,shouldEnterLayout:Z,children:jl.moreOptions.unlock})]})}):K&&Be!=null?t.jsxRuntimeExports.jsx(Aj,{style:{width:72,height:72,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:2},animationData:Be,loop:!1,play:K,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}}):null,de.includes("virtual")?t.jsxRuntimeExports.jsxs(yqn,{isShowingInDrawer:R,isOwnCard:d,scaleFactor:ae,bgColor:A?.toString(),showColorPalette:W,isDebitCard:Ue,"data-testid":_("virtual-charge-card-detail"),onClick:()=>{W===!1&&d===!0&&F(I)===!1&&he!=="In-Progress"&&Ee===!1&&xae({signedInUserToken:T,showSecretInfo:m,setShowPhoneNumberPopup:M,onFireOnClickAnalytics:N,setShowSecretInfo:P})},enableClick:Pe&&!Ee&&!Se||Ee&&he!=="In-Progress",cardDetailsFetchState:Ne||n.chargeCard?.cardColorCode===void 0,children:[t.jsxRuntimeExports.jsx(Vge,{scaleFactor:ae,shouldAppear:Ne||n.chargeCard?.cardColorCode===void 0}),t.jsxRuntimeExports.jsx(kYn,{leftTransitionValue:ae*Aa.colorPaletteLeftTransitionValue,hasBorderShadow:!1,tickStyles:{width:"12px",height:"12px"},colorInState:n.chargeCard?.cardColorCode!=null?new t.Color(n.chargeCard.cardColorCode):void 0,styles:{height:"100%",maxWidth:"78%",top:R?"unset":o.sp0,left:W?o.sp0:`${ae*Aa.colorPaletteLeftTransitionValue}px`},coloredCircleStyles:{width:o.sp4,height:o.sp4,margin:"unset"},colorPaletteTitleStyles:{padding:`${o.sp5} ${o.sp7} ${o.sp3} ${o.sp5}`},closeStyles:{width:o.sp3,height:o.sp3},ColorListStyles:{gap:o.sp3},isColorPaletteVisible:W,toggleColorPaletteVisibility:Je=>{U(Je)},handleColorClick:(Je,tt)=>{V(Je,tt),tt&&U(!1)}}),t.jsxRuntimeExports.jsx(Sqn,{scaleFactor:ae}),t.jsxRuntimeExports.jsx(Hge,{productInformation:i,cashbackInformation:r,creditAccountInformation:a,debitAccountInformation:l,secretRevealed:c,setSecretRevealed:D,onFireOnClickAnalytics:N,isCardColorUndefined:n.chargeCard?.cardColorCode==null,isCardColorUpdating:n.updateFetchState.fetchState==="In-Progress",isSandboxEnv:S,cardDetailsFetchState:I,setCardDetailsFetchState:B,isCardDetailErrored:k,setIsCardDetailErrored:L,chargeCard:n.chargeCard,vgsVaultId:u,showSecretInfo:m,creditAccountRepayment:$,token:T?.token,isDebitCard:Ue,depositAccountLimitFetchState:n.depositAccountLimitFetchState.fetchState,controllerEmails:x,isChargeCardFeatureEnabled:h,isDebitCardFeatureEnabled:f,isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:C,creditAccount:E,chargeCardCashbackDetailState:b,cardInfoTitleStyles:{...z.smallRegular.cssObject},styles:{gap:`${o.sp3}`,paddingLeft:`${o.sp4}`},cvvSecStyles:{minWidth:"39px",marginRight:`${o.sp3}`},sourceId:R?"addToWalletDrawer":"cardDetail"}),t.jsxRuntimeExports.jsxs(Qge,{children:[t.jsxRuntimeExports.jsxs(Rqn,{children:[t.jsxRuntimeExports.jsx(Uge,{scaleFactor:ae}),t.jsxRuntimeExports.jsx(mqn,{onClick:Je=>{Je.stopPropagation(),d&&U(!W)},"data-testid":_("card-color-selector"),children:d?t.jsxRuntimeExports.jsx(Le,{enterDelay:600,title:jl.cardColours,placement:"left",children:t.jsxRuntimeExports.jsx(Wge,{isShowingInDrawer:R})}):t.jsxRuntimeExports.jsx(Wge,{isShowingInDrawer:R})})]}),t.jsxRuntimeExports.jsx(cqn,{scaleFactor:ae})]})]}):t.jsxRuntimeExports.jsxs(Bqn,{scaleFactor:ae,enableClick:Pe&&!Ee&&!Se||Ee&&he!=="In-Progress",isOwnCard:d,isShowingInDrawer:R,onClick:()=>{d===!0&&Ee===!1&&he!=="In-Progress"&&F(I)===!1&&xae({signedInUserToken:T,showSecretInfo:m,setShowPhoneNumberPopup:M,onFireOnClickAnalytics:N,setShowSecretInfo:P})},"data-testid":_("physical-charge-card-detail"),children:[t.jsxRuntimeExports.jsx(Vge,{scaleFactor:ae,shouldAppear:Ne}),t.jsxRuntimeExports.jsxs(Pqn,{flipCard:c,children:[t.jsxRuntimeExports.jsx(Mqn,{children:t.jsxRuntimeExports.jsx(cL,{scaleFactor:ae,isClickable:Pe,isLoading:Ne,isDebitCard:Ue})}),m?t.jsxRuntimeExports.jsxs(Dqn,{isDebitCard:Ue,children:[t.jsxRuntimeExports.jsx(Hge,{productInformation:i,cashbackInformation:r,creditAccountInformation:a,debitAccountInformation:l,secretRevealed:c,setSecretRevealed:D,onFireOnClickAnalytics:N,isCardColorUndefined:n.chargeCard?.cardColorCode==null,isCardColorUpdating:n.updateFetchState.fetchState==="In-Progress",isSandboxEnv:S,cardDetailsFetchState:I,setCardDetailsFetchState:B,isCardDetailErrored:k,setIsCardDetailErrored:L,chargeCard:n.chargeCard,vgsVaultId:u,showSecretInfo:m,token:T?.token,isDebitCard:Ue,depositAccountLimitFetchState:n.depositAccountLimitFetchState.fetchState,controllerEmails:x,isChargeCardFeatureEnabled:h,isDebitCardFeatureEnabled:f,isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:C,creditAccount:n.creditAccount,creditAccountRepayment:$,chargeCardCashbackDetailState:b,cardInfoTitleStyles:{...z.smallRegular.cssObject},styles:{gap:`${o.sp3}`,paddingLeft:`${o.sp4}`},cvvSecStyles:{minWidth:"39px",marginRight:`${o.sp3}`},sourceId:R?"addToWalletDrawer":"cardDetail"}),t.jsxRuntimeExports.jsx(Qge,{children:t.jsxRuntimeExports.jsx(vqn,{children:t.jsxRuntimeExports.jsx(Uge,{scaleFactor:ae})})})]}):null]})]})]}),Se?t.jsxRuntimeExports.jsx(iqn,{children:jl.cardClosedMessage}):Re&&!e?t.jsxRuntimeExports.jsx(rqn,{children:jl.cardLockedByAdminMessage}):Ee?t.jsxRuntimeExports.jsx(fz,{children:jl.cardLockedMessage}):d===!0&&!Ne?I.cvv===!0&&I.number===!0?t.jsxRuntimeExports.jsx(jqn,{children:sqn.loading}):k?t.jsxRuntimeExports.jsx(aqn,{}):t.jsxRuntimeExports.jsx(fz,{children:c?Me:Ie}):Ne?t.jsxRuntimeExports.jsx(fz,{children:jl.loading}):null]})},iqn=s(ze)`
59611
+ `,fLe=e=>j.createElement("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M35 35H5.85714C4.56895 35 3.33352 34.2836 2.42262 33.0083C1.51173 31.7331 1 30.0035 1 28.2V1",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),yLe=e=>j.createElement("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M35 1L35 30.1429C35 31.4311 34.2836 32.6665 33.0083 33.5774C31.7331 34.4883 30.0035 35 28.2 35L1 35",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),jLe=e=>j.createElement("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M35 1H5.85714C4.56895 1 3.33352 1.71643 2.42262 2.99167C1.51173 4.26692 1 5.99653 1 7.8V35",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),CLe=e=>j.createElement("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M35 35L35 5.85714C35 4.56895 34.2836 3.33352 33.0083 2.42262C31.7331 1.51173 30.0035 1 28.2 1L1 0.999999",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),{common:sqn,spendManagement:{chargeCard:{cardDetails:jl}}}=O.getLocalizedStrings(),Aa={chargeCardWidth:384,chargeCardHeight:240,cardLoadingShineWidth:200,cardLoadingShineHeight:240,zeniLogoWidth:p[6],zeniLogoHeight:p[6],visaLogoWidth:p[6],visaLogoHeight:13,cardTintIconWidth:277,cardTintIconHeight:242,colorPaletteLeftTransitionValue:-350,rightSectionWidth:384,rightSectionHeight:240,cardContainerContentGap:new w(p[4],p[4],p[4],p[3])},bLe=({isChargeCardAdmin:e,chargeCardDetailView:n,productInformation:i,cashbackInformation:r,creditAccountInformation:a,debitAccountInformation:l,secretRevealed:c,isOwnCard:d,vgsVaultId:u,showSecretInfo:m,controllerEmails:x,isChargeCardFeatureEnabled:h,isDebitCardFeatureEnabled:f,isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:C,chargeCardCashbackDetailState:b,creditAccount:E,creditAccountRepayment:$,isShowingInDrawer:R,isSandboxEnv:S,isCardDetailErrored:k,signedInUserToken:T,selectedColor:A,cardDetailsFetchState:I,setCardDetailsFetchState:B,setIsCardDetailErrored:L,setShowSecretInfo:P,setSecretRevealed:D,setShowPhoneNumberForOtp:M,isCardDetailFetching:F,handleColorCodeClick:V,onFireOnClickAnalytics:N,onUnlockChargeCard:H})=>{const[W,U]=g.useState(!1),[Y,q]=g.useState(!1),[Z,G]=g.useState(!1),[K,J]=g.useState(!1),[oe,ee]=g.useState(!1),[te,se]=g.useState(!1),[ie,re]=g.useState(()=>{const Je=n.chargeCard?.status.code;return Je==="locked"||Je==="closed"||Je==="closed_by_customer"}),[ne,me]=g.useState(!1),[pe,je]=g.useState(!1),ce=g.useRef(void 0),de=n.chargeCard?.type.code??"business_virtual_credit_card",{isMobileOrTabletScreen:ue}=W5(),le=X(),ae=R?.75:le==="small"?.85:1,ge=n.lockChargeCardsFetchState.fetchState,ye=Ye(ge),he=n.unlockChargeCardsFetchState.fetchState,Ce=Ye(he),we=n.closeChargeCardsFetchState.fetchState,ve=Ye(we),Ee=n.chargeCard?.status.code==="locked",Se=n.chargeCard?.status.code==="closed"||n.chargeCard?.status.code==="closed_by_customer",[$e]=Rn("UnlockCard"),[Be]=Rn("LockCard"),[Ae]=Rn("CloseCard");g.useEffect(()=>{if(!(Y&&Ee)){G(!1);return}const tt=setTimeout(()=>{G(!0)},400);return()=>clearTimeout(tt)},[Y,Ee]),g.useEffect(()=>{(Ee||Se)&&!ie&&(re(!0),me(!1))},[Ee,Se]),g.useEffect(()=>{ye==="In-Progress"&&ge==="Completed"&&(ce.current&&clearTimeout(ce.current),J(!1),re(!1),me(!0),setTimeout(()=>{J(!0)},0),ce.current=setTimeout(()=>{J(!1),re(!0),q(!1)},1e3))},[ge,ye]),g.useEffect(()=>{Ce==="In-Progress"&&he==="Completed"&&(ce.current&&clearTimeout(ce.current),je(!0),ee(!1),setTimeout(()=>{ee(!0)},0),ce.current=setTimeout(()=>{ee(!1),re(!1),je(!1)},1e3))},[he,Ce]),g.useEffect(()=>{ve==="In-Progress"&&we==="Completed"&&(ce.current&&clearTimeout(ce.current),se(!1),re(!1),me(!0),setTimeout(()=>{se(!0)},0),ce.current=setTimeout(()=>{se(!1),re(!0)},1e3))},[we,ve]);const _e=ue?jl.tapCardCopyText:jl.scanNowAndAddToWallet,Te=ue?jl.tapCardCopyText:t.jsxRuntimeExports.jsxs(lqn,{children:[t.jsxRuntimeExports.jsx(Lqn,{}),jl.clickTheCardToFetchDetailsText]}),Re=n.chargeCard?.isLockedByAdmin??!1,ke=le==="small"?jl.tapCardCopyText:jl.clickTheCardToCopyDetailsText,Oe=le==="small"?jl.tapCardCopyText:jl.clickTheCardToFetchDetailsText,Me=R?_e:ke,Ie=R?Te:Oe,Ne=F(I)||n.updateFetchState.fetchState==="In-Progress"||n.unlockChargeCardsFetchState.fetchState==="In-Progress",Pe=(I.cvv!==!0||I.number!==!0)&&d,Qe=!!n.chargeCard?.type.code.includes("debit");return t.jsxRuntimeExports.jsxs(xqn,{windowSize:le,scaleFactor:ae,children:[t.jsxRuntimeExports.jsxs(gqn,{isCardLocked:Ee,isChargeCardAdmin:e,isLockedByAdmin:Re,unlockFetchState:n.unlockChargeCardsFetchState.fetchState,onClick:Je=>{Je.stopPropagation(),Ee&&he!=="In-Progress"&&(e||!Re)&&H(e)},onMouseEnter:()=>{(e||!Re)&&he!=="In-Progress"&&q(!0)},onMouseLeave:()=>{(e||!Re)&&he!=="In-Progress"&&q(!1)},children:[c&&R?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Aqn,{}),t.jsxRuntimeExports.jsx(kqn,{}),t.jsxRuntimeExports.jsx(Iqn,{}),t.jsxRuntimeExports.jsx(Tqn,{})]}):null,t.jsxRuntimeExports.jsx(fqn,{play:ie,animate:ne,fadeOut:pe,unlockInProgress:he==="In-Progress"||pe||Ce==="In-Progress"&&he==="Completed"}),oe&&$e!=null?t.jsxRuntimeExports.jsx(Aj,{style:{width:o.sp9,height:o.sp9,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:2,backgroundColor:v.overlayBackgroundBlack,borderRadius:o.sp11},animationData:$e,loop:!1,play:oe,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}}):te&&Ae!=null?t.jsxRuntimeExports.jsx(Aj,{style:{width:56,height:56,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:2},animationData:Ae,loop:!1,play:te,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}}):ie?Se?t.jsxRuntimeExports.jsx($qn,{}):he==="In-Progress"?t.jsxRuntimeExports.jsx(Cqn,{}):pe||Ce==="In-Progress"&&he==="Completed"?null:t.jsxRuntimeExports.jsx(Eqn,{isHovered:Y&&Ee,children:t.jsxRuntimeExports.jsxs(wqn,{isHovered:Y&&Ee,children:[t.jsxRuntimeExports.jsx(wLe,{}),t.jsxRuntimeExports.jsx(bqn,{isVisible:Y&&Ee,shouldEnterLayout:Z,children:jl.moreOptions.unlock})]})}):K&&Be!=null?t.jsxRuntimeExports.jsx(Aj,{style:{width:72,height:72,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:2},animationData:Be,loop:!1,play:K,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}}):null,de.includes("virtual")?t.jsxRuntimeExports.jsxs(yqn,{isShowingInDrawer:R,isOwnCard:d,scaleFactor:ae,bgColor:A?.toString(),showColorPalette:W,isDebitCard:Qe,"data-testid":_("virtual-charge-card-detail"),onClick:()=>{W===!1&&d===!0&&F(I)===!1&&he!=="In-Progress"&&Ee===!1&&xae({signedInUserToken:T,showSecretInfo:m,setShowPhoneNumberPopup:M,onFireOnClickAnalytics:N,setShowSecretInfo:P})},enableClick:Pe&&!Ee&&!Se||Ee&&he!=="In-Progress",cardDetailsFetchState:Ne||n.chargeCard?.cardColorCode===void 0,children:[t.jsxRuntimeExports.jsx(Vge,{scaleFactor:ae,shouldAppear:Ne||n.chargeCard?.cardColorCode===void 0}),t.jsxRuntimeExports.jsx(kYn,{leftTransitionValue:ae*Aa.colorPaletteLeftTransitionValue,hasBorderShadow:!1,tickStyles:{width:"12px",height:"12px"},colorInState:n.chargeCard?.cardColorCode!=null?new t.Color(n.chargeCard.cardColorCode):void 0,styles:{height:"100%",maxWidth:"78%",top:R?"unset":o.sp0,left:W?o.sp0:`${ae*Aa.colorPaletteLeftTransitionValue}px`},coloredCircleStyles:{width:o.sp4,height:o.sp4,margin:"unset"},colorPaletteTitleStyles:{padding:`${o.sp5} ${o.sp7} ${o.sp3} ${o.sp5}`},closeStyles:{width:o.sp3,height:o.sp3},ColorListStyles:{gap:o.sp3},isColorPaletteVisible:W,toggleColorPaletteVisibility:Je=>{U(Je)},handleColorClick:(Je,tt)=>{V(Je,tt),tt&&U(!1)}}),t.jsxRuntimeExports.jsx(Sqn,{scaleFactor:ae}),t.jsxRuntimeExports.jsx(Hge,{productInformation:i,cashbackInformation:r,creditAccountInformation:a,debitAccountInformation:l,secretRevealed:c,setSecretRevealed:D,onFireOnClickAnalytics:N,isCardColorUndefined:n.chargeCard?.cardColorCode==null,isCardColorUpdating:n.updateFetchState.fetchState==="In-Progress",isSandboxEnv:S,cardDetailsFetchState:I,setCardDetailsFetchState:B,isCardDetailErrored:k,setIsCardDetailErrored:L,chargeCard:n.chargeCard,vgsVaultId:u,showSecretInfo:m,creditAccountRepayment:$,token:T?.token,isDebitCard:Qe,depositAccountLimitFetchState:n.depositAccountLimitFetchState.fetchState,controllerEmails:x,isChargeCardFeatureEnabled:h,isDebitCardFeatureEnabled:f,isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:C,creditAccount:E,chargeCardCashbackDetailState:b,cardInfoTitleStyles:{...z.smallRegular.cssObject},styles:{gap:`${o.sp3}`,paddingLeft:`${o.sp4}`},cvvSecStyles:{minWidth:"39px",marginRight:`${o.sp3}`},sourceId:R?"addToWalletDrawer":"cardDetail"}),t.jsxRuntimeExports.jsxs(Qge,{children:[t.jsxRuntimeExports.jsxs(Rqn,{children:[t.jsxRuntimeExports.jsx(Uge,{scaleFactor:ae}),t.jsxRuntimeExports.jsx(mqn,{onClick:Je=>{Je.stopPropagation(),d&&U(!W)},"data-testid":_("card-color-selector"),children:d?t.jsxRuntimeExports.jsx(Le,{enterDelay:600,title:jl.cardColours,placement:"left",children:t.jsxRuntimeExports.jsx(Wge,{isShowingInDrawer:R})}):t.jsxRuntimeExports.jsx(Wge,{isShowingInDrawer:R})})]}),t.jsxRuntimeExports.jsx(cqn,{scaleFactor:ae})]})]}):t.jsxRuntimeExports.jsxs(Bqn,{scaleFactor:ae,enableClick:Pe&&!Ee&&!Se||Ee&&he!=="In-Progress",isOwnCard:d,isShowingInDrawer:R,onClick:()=>{d===!0&&Ee===!1&&he!=="In-Progress"&&F(I)===!1&&xae({signedInUserToken:T,showSecretInfo:m,setShowPhoneNumberPopup:M,onFireOnClickAnalytics:N,setShowSecretInfo:P})},"data-testid":_("physical-charge-card-detail"),children:[t.jsxRuntimeExports.jsx(Vge,{scaleFactor:ae,shouldAppear:Ne}),t.jsxRuntimeExports.jsxs(Pqn,{flipCard:c,children:[t.jsxRuntimeExports.jsx(Mqn,{children:t.jsxRuntimeExports.jsx(cL,{scaleFactor:ae,isClickable:Pe,isLoading:Ne,isDebitCard:Qe})}),m?t.jsxRuntimeExports.jsxs(Dqn,{isDebitCard:Qe,children:[t.jsxRuntimeExports.jsx(Hge,{productInformation:i,cashbackInformation:r,creditAccountInformation:a,debitAccountInformation:l,secretRevealed:c,setSecretRevealed:D,onFireOnClickAnalytics:N,isCardColorUndefined:n.chargeCard?.cardColorCode==null,isCardColorUpdating:n.updateFetchState.fetchState==="In-Progress",isSandboxEnv:S,cardDetailsFetchState:I,setCardDetailsFetchState:B,isCardDetailErrored:k,setIsCardDetailErrored:L,chargeCard:n.chargeCard,vgsVaultId:u,showSecretInfo:m,token:T?.token,isDebitCard:Qe,depositAccountLimitFetchState:n.depositAccountLimitFetchState.fetchState,controllerEmails:x,isChargeCardFeatureEnabled:h,isDebitCardFeatureEnabled:f,isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:C,creditAccount:n.creditAccount,creditAccountRepayment:$,chargeCardCashbackDetailState:b,cardInfoTitleStyles:{...z.smallRegular.cssObject},styles:{gap:`${o.sp3}`,paddingLeft:`${o.sp4}`},cvvSecStyles:{minWidth:"39px",marginRight:`${o.sp3}`},sourceId:R?"addToWalletDrawer":"cardDetail"}),t.jsxRuntimeExports.jsx(Qge,{children:t.jsxRuntimeExports.jsx(vqn,{children:t.jsxRuntimeExports.jsx(Uge,{scaleFactor:ae})})})]}):null]})]})]}),Se?t.jsxRuntimeExports.jsx(iqn,{children:jl.cardClosedMessage}):Re&&!e?t.jsxRuntimeExports.jsx(rqn,{children:jl.cardLockedByAdminMessage}):Ee?t.jsxRuntimeExports.jsx(fz,{children:jl.cardLockedMessage}):d===!0&&!Ne?I.cvv===!0&&I.number===!0?t.jsxRuntimeExports.jsx(jqn,{children:sqn.loading}):k?t.jsxRuntimeExports.jsx(aqn,{}):t.jsxRuntimeExports.jsx(fz,{children:c?Me:Ie}):Ne?t.jsxRuntimeExports.jsx(fz,{children:jl.loading}):null]})},iqn=s(ze)`
59612
59612
  color: ${v.important};
59613
59613
  `,rqn=s(ze)`
59614
59614
  color: ${e=>e.theme.colors.primary};
@@ -60667,7 +60667,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
60667
60667
  background: ${e.theme.colors.grey5};
60668
60668
  }
60669
60669
  `:null}
60670
- `,Tx={bottomContentContainerPadding:new w(p[3],p[8]),styledAIIconContainerSize:new w(p[3],p[3]),bannerWrapperMarginLeftRight:new w(p[3],p[5]),bannerWrapperMarginBottom:new w(p[0],p[3]),payNowSectionPaddingLeftRight:new w(p[3],p[0]),styledHighImportanceIconMarginRight:new w(p[0],p[1])},DLe=O.getLocalizedStrings(),{common:Ld,spendManagement:NJn,dateFormat:HJn}=DLe,yr=NJn.chargeCard,{common:{texts:{comments:_Le}},collaboration:{threads:{placeholder:{addANewComment:WJn,replyAComment:VJn},tooltip:{resolveComment:QJn,unResolveComment:UJn}}}}=DLe,GJn={drawerSectionPaddingLeftRight:new w(p[4],p[5])},YJn=({chargeCardDetailView:e,onUnlockChargeCard:n,onCloseChargeCard:i,cardsEndPoint:r,classListFetchState:a,transactionAttachmentsEndpointToFetch:l,transactionAttachmentEndpointToDownload:c,authParams:d,hideSorting:u,cardId:m,vgsVaultId:x,controllerEmails:h,isCardsCommentingEnabled:f,isCardControlsEnabled:y,isChargeCardFeatureEnabled:C,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:E,isChargeCardSetupEnabled:$,chargeCardCashbackDetailState:R,onFetchChargeCardsRecurringExpenses:S,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,creditAccount:B,cardIssuedByRoles:L,cardIssuedByDepartmentName:P,cardHolderRoles:D,cardHolderDepartmentName:M,loggedInUserRole:F,appleWalletLink:V,googleWalletLink:N,signedInUser:H,signedInUserToken:W,chargeCardsRecurringExpensesState:U,isSandboxEnv:Y,isEarlyPayEnabled:q,documentAiReceiptMaxSizeLimit:Z,isSnackbarOpen:G,onFireOnClickAnalytics:K,onUpdateDebitCardPinAttempt:J,onFireVerifyPopOnClickAnalytics:oe,onBackClick:ee,onReloadTransactions:te,onFetchChargeCardTransactionList:se,onGetOtp:ie,onLockChargeCard:re,onResendOtp:ne,onVerifyOtp:me,updateChargeCardName:pe,onVerifyOtpSuccess:je,onColorCodeChange:ce,onColumnSortConfigChanged:de,updateChargeCardTransactionAttachments:ue,updateChargeCardTransactionUploadReceiptsFetchStatus:le,updateChargeCardTransactionReceiptsShowTick:ae,updateChargeCardTransactionIsViewReceiptClicked:ge,onUploadReceiptComplete:ye,removeSnackbar:he,onChargeCardTransactionRowClick:Ce,onChargeCardRevokeInviteClick:we,onUpdateScrollYOffset:ve,updateSpendLimit:Ee,shouldOpenCreditCardPaymentDrawer:Se,sidePanelIsOpen:$e,sidePanelIsFullView:Be,panelContent:Ae,isAiCfoAccessEnabled:_e,onAskAiCfoClick:Te,navigate:Re})=>{const ke=g.useRef(!0),Oe=t.useTheme(),Me=X(),Ie=ht(),Pe=ro().analytics,[,Ue]=al(),[Je,tt]=g.useState(!1),[Qe,dt]=g.useState(!1),[ct,yt]=g.useState(!1),[He,jt]=g.useState(!1),[St,We]=g.useState(!1),[nt,ut]=g.useState(!1),[pt,Bt]=g.useState(!1),[Ht,$o]=g.useState(!1),[Tt,Gt]=g.useState(!1),[so,no]=g.useState(!1),[Xe,ft]=g.useState(!1),[oo,on]=g.useState(!1),[To,kn]=g.useState(!1),[Dn,qt]=g.useState(!1),[dn,Zs]=g.useState(!1),[Yn,Hs]=g.useState(!1),[yn,Go]=g.useState("apple"),[ds,In]=g.useState(null),[ts,pn]=g.useState(!1),{setRequestToOpenThread:_s}=g.useContext(vs),us=zt=>{In({...zt}),pn(!0)},js=(zt,tn)=>{if(pn(!1),_s({threadId:tn,companyId:zt.companyId,entityType:zt.entityType}),zt.url&&Re!=null){const Dt=new URL(zt.url,window.location.origin);Re(Dt.pathname+Dt.search+Dt.hash,{state:{pathnameStackToGoBack:[window.location.pathname]}})}},[xn,As]=g.useState({number:!1,cvv:!1});g.useEffect(()=>{To===!1&&qt(!1)},[To]);const nn=g.useRef("noAnimation"),os=e.chargeCard?.cardHolderUserId===H.userId,qe=g.useMemo(()=>{const zt=new Set;return e.transactions.forEach(tn=>{zt.add(Vu(tn.thirdPartyTransactionId??tn.id))}),zt},[e.transactions]),xt=`${e.chargeCard?.cardHolderUser?.firstName??""} ${e.chargeCard?.cardHolderUser?.lastName??""}`,Wt=e.chargeCard?.billingAddress,Ze=Q.hasChargeCardAdminLevelAccess(Ie.loggedInUserRoleMap),{text1:Mo,text2:Lo}=e9(Wt),_n=`${Mo} ${Lo}`,ns=e.chargeCard?.isDeclinedTransaction===!0,Vt=()=>{jz({chargeCardDetailView:e,chargeCardCashbackDetailState:R,isChargeCardFeatureEnabled:C,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,isDebitCard:vo,isChargeCardAdmin:Ze,analytics:Pe,controllerEmails:h,actionField:"Receipt Email",actionDetails:e.chargeCardConfig.receiptBotEmail}),Ue(e.chargeCardConfig.receiptBotEmail),tt(!0)},en=()=>{K("card owner copied"),jz({chargeCardDetailView:e,chargeCardCashbackDetailState:R,isChargeCardFeatureEnabled:C,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,isDebitCard:vo,isChargeCardAdmin:Ze,analytics:Pe,controllerEmails:h,actionField:"Card Owner",actionDetails:xt}),Ue(xt),We(!0)},On=()=>{K("billing address copied"),jz({chargeCardDetailView:e,chargeCardCashbackDetailState:R,isChargeCardFeatureEnabled:C,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,isDebitCard:vo,isChargeCardAdmin:Ze,analytics:Pe,controllerEmails:h,actionField:"Billing Address",actionDetails:_n}),Ue(_n),ut(!0)};g.useEffect(()=>{Je===!0&&setTimeout(()=>{tt(!1)},800),St===!0&&setTimeout(()=>{We(!1)},800),nt===!0&&setTimeout(()=>{ut(!1)},800)},[St,nt,Je]);const[$t,bo]=g.useState(!1),[mt,Qt]=g.useState(e.chargeCard?.cardColorCode!=null?new t.Color(e.chargeCard.cardColorCode):void 0);g.useEffect(()=>{e.chargeCard?.cardColorCode!=null&&Qt(new t.Color(e.chargeCard.cardColorCode))},[e.chargeCard?.cardColorCode]);const wt={amount:e.chargeCard!=null?e.chargeCard.balance.amount:0,currencyCode:e.chargeCard!=null?e.chargeCard.balance.currencyCode:Ld.currency.countryCode,currencySymbol:e.chargeCard!=null?e.chargeCard.balance.currencySymbol:Ld.currency.currencySymbol};g.useEffect(()=>{ke.current===!0?ke.current=!1:K(To===!1?"card details hidden":"card detail revealed")},[To]);const Kt=(zt,tn)=>{if(tn===!0){const Dt=PNo(zt.toString())??Ld.strings.empty;K("color selected",Dt),ce(Dt),bo(!1)}Qt(zt)},ks=zt=>{const{cvv:tn,number:Dt}=zt;return tn===!0||Dt===!0},{isMobileOrTabletScreen:_o}=W5(),Ct=e.chargeCard?.status.code!=="request_on_hold"&&e.chargeCard?.status.code!=="inactive",Ot=e.updateChargeCardLimitFetchState.fetchState,Yo=e.updateChargeCardNameFetchState.fetchState,Mt=e.lockChargeCardsFetchState.fetchState,fo=e.closeChargeCardsFetchState.fetchState,ot=Ye(Ot),Lt=Ye(Yo),Nt=Ye(Mt),qn=Ye(fo);g.useEffect(()=>{ot==="In-Progress"&&Ot==="Completed"?Gt(!1):Lt==="In-Progress"&&Yo==="Completed"?no(!1):Nt==="In-Progress"&&Mt==="Completed"?ft(!1):qn==="In-Progress"&&fo==="Completed"&&on(!1)},[Ot,Yo,Mt,fo,ot,Lt,Nt,qn]);const vo=e.chargeCard?.type.code==="business_physical_debit_card"||e.chargeCard?.type.code==="business_virtual_debit_card",jn=Ze&&(e.chargeCard?.status.code==="active"||e.chargeCard?.status.code==="locked")&&wt.amount<(vo?e.depositAccountLimit?.cardLimits.dailyCardTransactionLimit.amount??0:e.creditAccount.limit.amount),Ln=e.creditAccountRepayment.initiatedRepayments.amount>0&&Ze&&ns,ri=()=>{if(!y)return[{value:"changePin",label:yr.cardDetails.moreOptions.changePin}];const zt=[{value:"changePin",label:yr.cardDetails.moreOptions.changePin},{value:"unlock",label:yr.cardDetails.moreOptions.unlock},{value:"updateSpendLimit",label:yr.cardDetails.moreOptions.updateSpendLimit},{value:"rename",label:yr.cardDetails.moreOptions.rename},{value:"lock",label:yr.cardDetails.moreOptions.lock},{value:"close",label:yr.cardDetails.moreOptions.close},{value:"revokeInvite",label:yr.cardDetails.moreOptions.revokeInvite}],tn=e.chargeCard?.status.code,Dt=tn==="locked",mo=tn==="inactive",to=tn==="request_on_hold",eo=e.chargeCard?.isLockedByAdmin===!0,mi=vo&&os,Zo=Ze;if(to){const ss=[];return Zo&&ss.push("revokeInvite"),ss.push("rename"),zt.filter(_a=>ss.includes(_a.value))}if(mo){const ss=[];return ss.push("rename"),mi&&ss.push("changePin"),Zo&&ss.push("close"),zt.filter(_a=>ss.includes(_a.value))}const hs={changePin:mi&&!Dt,lock:!Dt,unlock:Dt&&(Ze||!eo),rename:!0,updateSpendLimit:Zo,close:Zo};return zt.filter(ss=>hs[ss.value])},Hc=t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(v5,{entity:"debit_cards",isDisabled:e.unlockChargeCardsFetchState.fetchState==="In-Progress"?"disabled":void 0,onOptionSelection:zt=>{zt==="changePin"?(W==null||W.expiry.isBefore(new Date)?ie(e.loggedInUserPhone):jt(!0),yt(!0)):zt==="updateSpendLimit"?Gt(!0):zt==="rename"?no(!0):zt==="lock"?(ft(!0),S()):zt==="close"?(on(!0),S()):zt==="unlock"?n(Ze):zt==="revokeInvite"&&we()},isMoreOption:!0,options:ri(),customStyleConfig:{control:()=>({backgroundColor:"inherit",cursor:"pointer",border:"none",":hover":{backgroundColor:"inherit"}}),valueContainer:zt=>({...zt,display:"flex",alignItems:"center",padding:0})}})}),et=zt=>zt.reasonType==="other"?zt.reason:zt.reasonType,Jt=zt=>{const tn=et(zt);re(Ze,tn)},gt=zt=>{const tn=et(zt);i(tn)},mn=()=>{const zt=e.chargeCard?.status.code;if(zt==="closed"||zt==="closed_by_customer")return null;if(!y)return os&&vo?Hc:null;if(!os&&!Ze)return null;const tn=e.chargeCard?.isLockedByAdmin===!0;return os&&!Ze&&tn&&zt==="locked"?null:Hc};return t.jsxRuntimeExports.jsxs(cXn,{children:[Xe&&e.chargeCard!=null&&t.jsxRuntimeExports.jsx(XW,{showLockCardDrawer:!0,onCloseLockCardDrawer:()=>ft(!1),isChargeCardAdmin:Ze,chargeCardsByCardId:{[e.chargeCard.id]:e.chargeCard},cardRecurringExpensesByCardId:{[e.chargeCard.id]:U.recurringExpenses},cardRecurringExpenseFetchState:U.fetchState,lockCardFetchState:e.lockChargeCardsFetchState.fetchState,onConfirmClick:Jt,onDismissClick:()=>ft(!1),onRemoveCardClick:()=>{}}),oo&&e.chargeCard!=null&&t.jsxRuntimeExports.jsx(KW,{showCloseCardDrawer:!0,onCloseCloseCardDrawer:()=>on(!1),isChargeCardAdmin:Ze,chargeCardsByCardId:{[e.chargeCard.id]:e.chargeCard},cardRecurringExpensesByCardId:{[e.chargeCard.id]:U.recurringExpenses},cardRecurringExpenseFetchState:U.fetchState,closeCardFetchState:e.closeChargeCardsFetchState.fetchState,onConfirmClick:gt,onDismissClick:()=>on(!1),onRemoveCardClick:()=>{}}),He&&e.chargeCard?.cardProviderID!=null?t.jsxRuntimeExports.jsx(BJn,{signedInUserToken:W,vgsVaultId:x,onCancelClick:()=>{jt(!1),yt(!0)},isSandboxEnv:!0,cardProviderID:e.chargeCard?.cardProviderID,onChangePinSuccess:()=>{jt(!1),yt(!0)},onUpdateDebitCardPinAttempt:J}):null,_o?null:t.jsxRuntimeExports.jsx(gJn,{isChargeCardAdmin:Ze,controllerEmails:h,isChargeCardFeatureEnabled:C,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:E,isChargeCardSetupEnabled:$,chargeCardCashbackDetailState:R,creditAccountRepayment:e.creditAccountRepayment,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,creditAccount:e.creditAccount,selectedColor:mt,walletType:yn,onFireOnClickAnalytics:K,isSandboxEnv:Y,chargeCardDetailView:e,vgsVaultId:x,signedInUserToken:W,showSecretInfo:To,changePinInProcess:ct,setShowChangePinPopup:jt,isCardDetailErrored:dn,cardDetailsFetchState:xn,setCardDetailsFetchState:As,setIsCardDetailErrored:Zs,isCardDetailFetching:ks,handleColorCodeClick:Kt,isDrawerOpen:Yn,setIsAddToWalletDrawerOpen:Hs,onVerifyOtp:me,onVerifyOtpSuccess:je,onFireVerifyPopOnClickAnalytics:oe,onResendOtp:ne,setShowSecretInfo:kn,secretRevealed:Dn,setSecretRevealed:qt,onGetOtp:ie,showDrawerAnimation:nn}),t.jsxRuntimeExports.jsx(Rt,{rightSideComponent:t.jsxRuntimeExports.jsxs(ii,{children:[f&&!ts?t.jsxRuntimeExports.jsx(ZJn,{pageEntityIds:qe,onClick:()=>{In(null),pn(!0)}}):null,mn(),t.jsxRuntimeExports.jsx(ms,{dataTestId:"cards-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:_e,onAskAiCfoClick:Te})]}),navBarContainerStyles:{paddingTop:p[2],alignItems:"center",paddingBottom:p[2]},source:"ChargeCardDetailPage",title:e.chargeCard?.cardName??yr.cardList.title.cards,hideSearchBtn:!0,showBackButton:!0,showMenuIcon:!1,backgroundColor:Oe.colors.grey5,style:{zIndex:3},onBackClick:ee,titleStyle:{marginTop:p[0],...Me==="small"&&{textAlign:"left"}},leftComponentStyle:Me==="small"?{width:"80%"}:void 0,rightComponentStyle:Me==="small"?{width:"10%"}:void 0}),t.jsxRuntimeExports.jsx(VC,{phoneNumberPopupDescription:yr.cardDetails.verifyPhoneNumberDescription,showOtpPopup:pt,showPhoneNumberPopup:Ht,twoFactorAuthenticationView:e.twoFAView,loggedInUserPhone:e.loggedInUserPhone,onVerifyOtp:me,onVerifyOtpSuccess:zt=>{je(zt),ct?jt(!0):kn(!0)},onFireVerifyPopOnClickAnalytics:oe,setShowOtpPopup:Bt,onResendOtp:ne,setShowPhoneNumberPopup:$o,onGetOtp:ie}),so&&t.jsxRuntimeExports.jsx(rLe,{currentCardName:e.chargeCard?.cardName??"",renameFetchState:e.updateChargeCardNameFetchState.fetchState,onCancelClick:()=>no(!1),onSubmitClick:zt=>{e.chargeCard&&pe(Ze,zt)}}),Tt&&e.chargeCard!=null?t.jsxRuntimeExports.jsx(aLe,{controllerEmails:h,isChargeCardFeatureEnabled:C,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:E,isChargeCardSetupEnabled:$,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,cardDetail:e.chargeCard,transactionStatistics:e.transactionStatistics,depositAccountLimitFetchState:e.depositAccountLimitFetchState.fetchState,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,signedInUser:H,isDebitCard:vo,cardIssuedByRoles:L,cardHolderRoles:D,loggedInUserRole:F,cardIssuedByDepartmentName:P,cardHolderDepartmentName:M,classListFetchState:a,currentLimitAmount:e.chargeCard?.limit??{amount:0,currencyCode:Ld.currency.countryCode,currencySymbol:Ld.currency.currencySymbol},currentSpentAmount:e.chargeCard?.balance??{amount:0,currencyCode:Ld.currency.countryCode,currencySymbol:Ld.currency.currencySymbol},maxLimitAmount:vo?e.depositAccountLimit?.cardLimits.dailyCardTransactionLimit:e.creditAccount.limit,isDisabled:vo&&e.depositAccountLimitFetchState.fetchState!=="Completed",updateLimitFetchState:e.updateChargeCardLimitFetchState.fetchState,onCancelClick:()=>Gt(!1),onSubmitClick:zt=>{if(e.chargeCard){const tn={amount:zt,currencyCode:e.chargeCard.limit.currencyCode,currencySymbol:e.chargeCard.limit.currencySymbol};Ee(e.chargeCard.id,tn,e.chargeCard.creditLimitFrequency,Fe("0,0.[00]",tn))}},recommendations:e?.chargeCard?.recommendations}):null,e.fetchState==="Not-Started"||e.fetchState==="In-Progress"?t.jsxRuntimeExports.jsx(mLe,{}):e.fetchState==="Error"?t.jsxRuntimeExports.jsxs(nXn,{windowSize:Me,children:[t.jsxRuntimeExports.jsx(rXn,{onClick:te,"data-testid":_("reload-card-detail"),children:t.jsxRuntimeExports.jsx(lXn,{})}),t.jsxRuntimeExports.jsx(aXn,{children:Ld.reloadPage.label})]}):t.jsxRuntimeExports.jsx(U0,{isOpen:$e??!1,isFullView:Be??!1,panelContent:Ae,headerContent:t.jsxRuntimeExports.jsxs(c2e,{children:[t.jsxRuntimeExports.jsx(Oqn,{controllerEmails:h,isChargeCardFeatureEnabled:C,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:E,isChargeCardSetupEnabled:$,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,isDebitCard:vo,chargeCardCashbackDetailState:R,cardIssuedByRoles:L,cardIssuedByDepartmentName:P,cardHolderRoles:D,cardHolderDepartmentName:M,classListFetchState:a,chargeCardDetailView:e,spent:wt,isCardNotPending:Ct,cardOwnerName:xt,appleWalletLink:V,googleWalletLink:N,addressToShow:Wt,secretRevealed:Dn,isOwnCard:os,vgsVaultId:x,showSecretInfo:To,isSandboxEnv:Y,isCardDetailErrored:dn,signedInUserToken:W,selectedColor:mt,cardDetailsFetchState:xn,setCardDetailsFetchState:As,setIsCardDetailErrored:Zs,setSecretRevealed:qt,isCardDetailFetching:ks,handleColorCodeClick:Kt,onFireOnClickAnalytics:K,setShowPhoneNumberPopup:$o,setShowChangeSpendLimitPopup:Gt,setShowSecretInfo:kn,showUpdateSpendLimitAction:jn,onOwnerNameCopyClick:en,onAddressCopyClick:On,onUnlockChargeCard:n}),q?Ln?t.jsxRuntimeExports.jsxs(JJn,{windowSize:Me,children:[t.jsxRuntimeExports.jsx(uXn,{}),t.jsxRuntimeExports.jsx(eXn,{children:` ${yr.payEarly.paymentOf} ${Fe("0,0.[00]",e.creditAccountRepayment.initiatedRepayments)} ${yr.payEarly.madeOn} ${e.creditAccountRepayment.initiatedRepaymentDate?.format(HJn.visual.MMMDFormat)} ${yr.payEarly.isProcessing} ${yr.payEarly.theCompanyCreditLimitWillUpdateIn23BusinessDays}`})]}):ns?Ze?t.jsxRuntimeExports.jsxs(OLe,{onClick:()=>{Se(!0)},windowSize:Me,children:[t.jsxRuntimeExports.jsx(d2e,{windowSize:Me}),t.jsxRuntimeExports.jsxs(sXn,{children:[t.jsxRuntimeExports.jsx(u2e,{children:yr.payEarly.transactionsMayBeDeclinedBecauseTheCompanyCreditLimitIsRunningLow}),t.jsxRuntimeExports.jsxs(tXn,{className:"pay-now-button",children:[yr.payEarly.payNow,t.jsxRuntimeExports.jsx(XJn,{})]})]})]}):t.jsxRuntimeExports.jsxs(KJn,{windowSize:Me,children:[t.jsxRuntimeExports.jsx(d2e,{windowSize:Me}),t.jsxRuntimeExports.jsx(iXn,{children:t.jsxRuntimeExports.jsx(u2e,{children:yr.payEarly.yourTransactionsMayBeDeclinedBecauseTheCompanyCreditLimitIsRunningLowWeHaveNotifiedYourAdmin})})]}):null:null,os&&Me!=="small"&&Ct&&vo===!1?t.jsxRuntimeExports.jsx(EYn,{style:{marginTop:ns?o.sp5:o.sp4},classListFetchState:a,controllerEmails:h,isChargeCardFeatureEnabled:C,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:E,isChargeCardSetupEnabled:$,chargeCardDetailView:e,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,cardIssuedByRoles:L,cardHolderRoles:D,cardIssuedByDepartmentName:P,cardHolderDepartmentName:M,isDebitCard:vo,appleWalletLink:V,googleWalletLink:N,setWalletType:Go,setIsAddToWalletDrawerOpen:Hs,showDrawerAnimation:nn}):null]}),listContent:t.jsxRuntimeExports.jsx(c2e,{children:t.jsxRuntimeExports.jsx(v0,{sharedItems:{sharedFunctions:{subtreeFunctions:{openAllThreadsDrawer:us}},sharedRef:void 0},children:t.jsxRuntimeExports.jsxs(wXn,{windowSize:Me,isOwnCard:os,isMobileOrTabletScreen:_o,children:[Ct&&e.transactions.length>0?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(pXn,{windowSize:Me,children:[t.jsxRuntimeExports.jsx(gXn,{windowSize:Me,children:t.jsxRuntimeExports.jsx(fXn,{})}),t.jsxRuntimeExports.jsxs(dXn,{windowSize:Me,children:[t.jsxRuntimeExports.jsxs(mXn,{children:[t.jsxRuntimeExports.jsx(oXn,{children:yr.aiAccountantText}),Ld.strings.space,yr.aiAccountantMessage,Ld.strings.space]}),t.jsxRuntimeExports.jsxs(hXn,{"data-testid":_("charge-card-detail-copy-email"),onClick:Vt,onMouseEnter:()=>dt(!0),onMouseLeave:()=>dt(!1),children:[t.jsxRuntimeExports.jsx(xXn,{children:e.chargeCardConfig.receiptBotEmail}),Je===!0?t.jsxRuntimeExports.jsxs(m2e,{children:[t.jsxRuntimeExports.jsx(jXn,{}),t.jsxRuntimeExports.jsx(p2e,{children:t.jsxRuntimeExports.jsx(x2e,{shouldDisplay:Qe||Je,color:v.primaryDark,children:Ld.copyToClipBoard.copied})})]}):t.jsxRuntimeExports.jsxs(m2e,{children:[t.jsxRuntimeExports.jsx(yXn,{color:Qe?Oe.colors.primary:void 0}),t.jsxRuntimeExports.jsx(p2e,{children:t.jsxRuntimeExports.jsx(x2e,{shouldDisplay:Qe&&Me!=="small",children:Ld.copyToClipBoard.copy})})]})]})]})]})}):null,t.jsxRuntimeExports.jsx(VKn,{isCardsCommentingEnabled:f,cardStatusCode:e.chargeCard?.status.code,cardCodeType:e.chargeCard?.type.code,cardId:m,documentAiReceiptMaxSizeLimit:Z,uploadReceiptsFetchStateByTransactionId:e.uploadReceiptsFetchStateByTransactionId,isSnackbarOpen:G,uploadReceiptsShowTickByTransactionId:e.uploadReceiptsShowTickByTransactionId,isViewReceiptClickedImmediatelyAfterUploadTransactionId:e.isViewReceiptClickedImmediatelyAfterUploadTransactionId,receiptRequiredAboveAmount:e.chargeCardConfig.receiptRequiredAboveAmount,cardsEndPoint:r,transactionAttachmentsEndpointToFetch:l,transactionAttachmentEndpointToDownload:c,authParams:d,hideSorting:u,transactions:e.transactions,cardHolderUser:e.chargeCard?.cardHolderUser,uiState:e.uiState,fetchState:e.transactionListFetchState.fetchState,isAiCategorizationEnabledForCardsTransactions:e.chargeCardConfig.isAiCategorizationEnabledForCardsTransactions,onReloadTransactions:te,onFetchChargeCardTransactionList:se,isOwnCard:os,onColumnSortConfigChanged:de,removeSnackbar:he,onChargeCardTransactionRowClick:Ce,onUpdateScrollYOffset:ve,onUploadReceiptComplete:ye,updateChargeCardTransactionAttachments:ue,updateChargeCardTransactionUploadReceiptsFetchStatus:le,updateChargeCardTransactionReceiptsShowTick:ae,updateChargeCardTransactionIsViewReceiptClicked:ge})]})})})}),f?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:`dashboard_${Ie.currentTenant?.companyId}`,children:t.jsxRuntimeExports.jsx(qJn,{threadData:ds,isThreadsOpen:ts,pageEntityIds:qe,setIsThreadsOpen:pn,onThreadClick:js,windowSize:Me,backgroundColor:Oe.colors.background})}):null]})},qJn=({threadData:e,isThreadsOpen:n,pageEntityIds:i,setIsThreadsOpen:r,onThreadClick:a,windowSize:l,backgroundColor:c})=>{const d=ht(),u=e?.entityId,m=g.useMemo(()=>({application:"dashboard",companyId:d.currentTenant?.companyId,tab:"transaction",entityId:u,isGlobalComment:!1}),[d.currentTenant?.companyId,u]),{threads:x,isLoading:h}=O9({filter:m}),f=g.useMemo(()=>u!=null?x:x.filter(y=>i.has(y.metadata.entityId)),[x,u,i]);return t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:n,allowComposer:!1,drawerTitle:_Le,threads:f,autoExpand:!0,autoFocus:!1,filter:{application:"dashboard",companyId:d.currentTenant?.companyId,tab:"transaction",isGlobalComment:!1},isLoading:h,textOverrides:{composerPlaceholder:WJn,replyComposerPlaceholder:VJn,threadResolve:QJn,threadUnResolve:UJn},onThreadClick:(y,C)=>a(y,C),onCloseAllThreadsDrawer:()=>r(!1),drawerSectionStyle:{width:l==="small"?"100%":"400px",boxSizing:l==="small"?"border-box":"content-box",padding:`${o.sp0} ${GJn.drawerSectionPaddingLeftRight.valuePx(l)}`,backgroundColor:c},collapsibleThreadStyle:{width:l==="small"?"100%":"360px"}})},ZJn=({pageEntityIds:e,onClick:n})=>{const i=ht(),r=g.useMemo(()=>({application:"dashboard",companyId:i.currentTenant?.companyId,tab:"transaction",isGlobalComment:!1}),[i.currentTenant?.companyId]),{threads:a,isLoading:l}=sa(r,!1,!0),c=g.useMemo(()=>a.filter(d=>e.has(d.metadata.entityId)).length,[a,e]);return t.jsxRuntimeExports.jsx(Le,{title:_Le,placement:"bottom",display:"flex",arrow:!0,enterDelay:600,children:t.jsxRuntimeExports.jsxs(CXn,{isDisabled:l,"data-testid":_("charge-card-detail-comment-button"),onClick:l?void 0:d=>{d.preventDefault(),d.stopPropagation(),n()},children:[t.jsxRuntimeExports.jsx(Br,{count:l?void 0:c,isLoading:l,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(bXn,{})]})})},jz=({chargeCardDetailView:e,chargeCardCashbackDetailState:n,isChargeCardFeatureEnabled:i,productInformation:r,cashbackInformation:a,creditAccountInformation:l,debitAccountInformation:c,creditAccount:d,creditAccountRepayment:u,isDebitCard:m,isChargeCardAdmin:x,analytics:h,controllerEmails:f,actionDetails:y,actionField:C})=>{e.chargeCard!=null&&n.fetchState==="Completed"&&(!i||d.fetchState==="Completed"&&u.fetchState==="Completed")&&(!(m&&x)||e.depositAccountLimitFetchState.fetchState==="Completed")&&h.trackCardsCopyIconClick(f,r,"Cards Detail","Copy","copied",C,y,a,l,c)},c2e=s.div``,OLe=s.div`
60670
+ `,Tx={bottomContentContainerPadding:new w(p[3],p[8]),styledAIIconContainerSize:new w(p[3],p[3]),bannerWrapperMarginLeftRight:new w(p[3],p[5]),bannerWrapperMarginBottom:new w(p[0],p[3]),payNowSectionPaddingLeftRight:new w(p[3],p[0]),styledHighImportanceIconMarginRight:new w(p[0],p[1])},DLe=O.getLocalizedStrings(),{common:Ld,spendManagement:NJn,dateFormat:HJn}=DLe,yr=NJn.chargeCard,{common:{texts:{comments:_Le}},collaboration:{threads:{placeholder:{addANewComment:WJn,replyAComment:VJn},tooltip:{resolveComment:QJn,unResolveComment:UJn}}}}=DLe,GJn={drawerSectionPaddingLeftRight:new w(p[4],p[5])},YJn=({chargeCardDetailView:e,onUnlockChargeCard:n,onCloseChargeCard:i,cardsEndPoint:r,classListFetchState:a,transactionAttachmentsEndpointToFetch:l,transactionAttachmentEndpointToDownload:c,authParams:d,hideSorting:u,cardId:m,vgsVaultId:x,controllerEmails:h,isCardsCommentingEnabled:f,isCardControlsEnabled:y,isChargeCardFeatureEnabled:C,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:E,isChargeCardSetupEnabled:$,chargeCardCashbackDetailState:R,onFetchChargeCardsRecurringExpenses:S,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,creditAccount:B,cardIssuedByRoles:L,cardIssuedByDepartmentName:P,cardHolderRoles:D,cardHolderDepartmentName:M,loggedInUserRole:F,appleWalletLink:V,googleWalletLink:N,signedInUser:H,signedInUserToken:W,chargeCardsRecurringExpensesState:U,isSandboxEnv:Y,isEarlyPayEnabled:q,documentAiReceiptMaxSizeLimit:Z,isSnackbarOpen:G,onFireOnClickAnalytics:K,onUpdateDebitCardPinAttempt:J,onFireVerifyPopOnClickAnalytics:oe,onBackClick:ee,onReloadTransactions:te,onFetchChargeCardTransactionList:se,onGetOtp:ie,onLockChargeCard:re,onResendOtp:ne,onVerifyOtp:me,updateChargeCardName:pe,onVerifyOtpSuccess:je,onColorCodeChange:ce,onColumnSortConfigChanged:de,updateChargeCardTransactionAttachments:ue,updateChargeCardTransactionUploadReceiptsFetchStatus:le,updateChargeCardTransactionReceiptsShowTick:ae,updateChargeCardTransactionIsViewReceiptClicked:ge,onUploadReceiptComplete:ye,removeSnackbar:he,onChargeCardTransactionRowClick:Ce,onChargeCardRevokeInviteClick:we,onUpdateScrollYOffset:ve,updateSpendLimit:Ee,shouldOpenCreditCardPaymentDrawer:Se,sidePanelIsOpen:$e,sidePanelIsFullView:Be,panelContent:Ae,isAiCfoAccessEnabled:_e,onAskAiCfoClick:Te,navigate:Re})=>{const ke=g.useRef(!0),Oe=t.useTheme(),Me=X(),Ie=ht(),Pe=ro().analytics,[,Qe]=al(),[Je,tt]=g.useState(!1),[Ue,dt]=g.useState(!1),[ct,yt]=g.useState(!1),[He,jt]=g.useState(!1),[St,We]=g.useState(!1),[nt,ut]=g.useState(!1),[pt,Bt]=g.useState(!1),[Ht,$o]=g.useState(!1),[Tt,Gt]=g.useState(!1),[so,no]=g.useState(!1),[Xe,ft]=g.useState(!1),[oo,on]=g.useState(!1),[To,kn]=g.useState(!1),[Dn,qt]=g.useState(!1),[dn,Zs]=g.useState(!1),[Yn,Hs]=g.useState(!1),[yn,Go]=g.useState("apple"),[ds,In]=g.useState(null),[ts,pn]=g.useState(!1),{setRequestToOpenThread:_s}=g.useContext(vs),us=zt=>{In({...zt}),pn(!0)},js=(zt,tn)=>{if(pn(!1),_s({threadId:tn,companyId:zt.companyId,entityType:zt.entityType}),zt.url&&Re!=null){const Dt=new URL(zt.url,window.location.origin);Re(Dt.pathname+Dt.search+Dt.hash,{state:{pathnameStackToGoBack:[window.location.pathname]}})}},[xn,As]=g.useState({number:!1,cvv:!1});g.useEffect(()=>{To===!1&&qt(!1)},[To]);const nn=g.useRef("noAnimation"),os=e.chargeCard?.cardHolderUserId===H.userId,qe=g.useMemo(()=>{const zt=new Set;return e.transactions.forEach(tn=>{zt.add(Vu(tn.thirdPartyTransactionId??tn.id))}),zt},[e.transactions]),xt=`${e.chargeCard?.cardHolderUser?.firstName??""} ${e.chargeCard?.cardHolderUser?.lastName??""}`,Wt=e.chargeCard?.billingAddress,Ze=Q.hasChargeCardAdminLevelAccess(Ie.loggedInUserRoleMap),{text1:Mo,text2:Lo}=e9(Wt),_n=`${Mo} ${Lo}`,ns=e.chargeCard?.isDeclinedTransaction===!0,Vt=()=>{jz({chargeCardDetailView:e,chargeCardCashbackDetailState:R,isChargeCardFeatureEnabled:C,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,isDebitCard:vo,isChargeCardAdmin:Ze,analytics:Pe,controllerEmails:h,actionField:"Receipt Email",actionDetails:e.chargeCardConfig.receiptBotEmail}),Qe(e.chargeCardConfig.receiptBotEmail),tt(!0)},en=()=>{K("card owner copied"),jz({chargeCardDetailView:e,chargeCardCashbackDetailState:R,isChargeCardFeatureEnabled:C,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,isDebitCard:vo,isChargeCardAdmin:Ze,analytics:Pe,controllerEmails:h,actionField:"Card Owner",actionDetails:xt}),Qe(xt),We(!0)},On=()=>{K("billing address copied"),jz({chargeCardDetailView:e,chargeCardCashbackDetailState:R,isChargeCardFeatureEnabled:C,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,isDebitCard:vo,isChargeCardAdmin:Ze,analytics:Pe,controllerEmails:h,actionField:"Billing Address",actionDetails:_n}),Qe(_n),ut(!0)};g.useEffect(()=>{Je===!0&&setTimeout(()=>{tt(!1)},800),St===!0&&setTimeout(()=>{We(!1)},800),nt===!0&&setTimeout(()=>{ut(!1)},800)},[St,nt,Je]);const[$t,bo]=g.useState(!1),[mt,Qt]=g.useState(e.chargeCard?.cardColorCode!=null?new t.Color(e.chargeCard.cardColorCode):void 0);g.useEffect(()=>{e.chargeCard?.cardColorCode!=null&&Qt(new t.Color(e.chargeCard.cardColorCode))},[e.chargeCard?.cardColorCode]);const wt={amount:e.chargeCard!=null?e.chargeCard.balance.amount:0,currencyCode:e.chargeCard!=null?e.chargeCard.balance.currencyCode:Ld.currency.countryCode,currencySymbol:e.chargeCard!=null?e.chargeCard.balance.currencySymbol:Ld.currency.currencySymbol};g.useEffect(()=>{ke.current===!0?ke.current=!1:K(To===!1?"card details hidden":"card detail revealed")},[To]);const Kt=(zt,tn)=>{if(tn===!0){const Dt=PNo(zt.toString())??Ld.strings.empty;K("color selected",Dt),ce(Dt),bo(!1)}Qt(zt)},ks=zt=>{const{cvv:tn,number:Dt}=zt;return tn===!0||Dt===!0},{isMobileOrTabletScreen:_o}=W5(),Ct=e.chargeCard?.status.code!=="request_on_hold"&&e.chargeCard?.status.code!=="inactive",Ot=e.updateChargeCardLimitFetchState.fetchState,Yo=e.updateChargeCardNameFetchState.fetchState,Mt=e.lockChargeCardsFetchState.fetchState,fo=e.closeChargeCardsFetchState.fetchState,ot=Ye(Ot),Lt=Ye(Yo),Nt=Ye(Mt),qn=Ye(fo);g.useEffect(()=>{ot==="In-Progress"&&Ot==="Completed"?Gt(!1):Lt==="In-Progress"&&Yo==="Completed"?no(!1):Nt==="In-Progress"&&Mt==="Completed"?ft(!1):qn==="In-Progress"&&fo==="Completed"&&on(!1)},[Ot,Yo,Mt,fo,ot,Lt,Nt,qn]);const vo=e.chargeCard?.type.code==="business_physical_debit_card"||e.chargeCard?.type.code==="business_virtual_debit_card",jn=Ze&&(e.chargeCard?.status.code==="active"||e.chargeCard?.status.code==="locked")&&wt.amount<(vo?e.depositAccountLimit?.cardLimits.dailyCardTransactionLimit.amount??0:e.creditAccount.limit.amount),Ln=e.creditAccountRepayment.initiatedRepayments.amount>0&&Ze&&ns,ri=()=>{if(!y)return[{value:"changePin",label:yr.cardDetails.moreOptions.changePin}];const zt=[{value:"changePin",label:yr.cardDetails.moreOptions.changePin},{value:"unlock",label:yr.cardDetails.moreOptions.unlock},{value:"updateSpendLimit",label:yr.cardDetails.moreOptions.updateSpendLimit},{value:"rename",label:yr.cardDetails.moreOptions.rename},{value:"lock",label:yr.cardDetails.moreOptions.lock},{value:"close",label:yr.cardDetails.moreOptions.close},{value:"revokeInvite",label:yr.cardDetails.moreOptions.revokeInvite}],tn=e.chargeCard?.status.code,Dt=tn==="locked",mo=tn==="inactive",to=tn==="request_on_hold",eo=e.chargeCard?.isLockedByAdmin===!0,mi=vo&&os,Zo=Ze;if(to){const ss=[];return Zo&&ss.push("revokeInvite"),ss.push("rename"),zt.filter(_a=>ss.includes(_a.value))}if(mo){const ss=[];return ss.push("rename"),mi&&ss.push("changePin"),Zo&&ss.push("close"),zt.filter(_a=>ss.includes(_a.value))}const hs={changePin:mi&&!Dt,lock:!Dt,unlock:Dt&&(Ze||!eo),rename:!0,updateSpendLimit:Zo,close:Zo};return zt.filter(ss=>hs[ss.value])},Hc=t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(v5,{entity:"debit_cards",isDisabled:e.unlockChargeCardsFetchState.fetchState==="In-Progress"?"disabled":void 0,onOptionSelection:zt=>{zt==="changePin"?(W==null||W.expiry.isBefore(new Date)?ie(e.loggedInUserPhone):jt(!0),yt(!0)):zt==="updateSpendLimit"?Gt(!0):zt==="rename"?no(!0):zt==="lock"?(ft(!0),S()):zt==="close"?(on(!0),S()):zt==="unlock"?n(Ze):zt==="revokeInvite"&&we()},isMoreOption:!0,options:ri(),customStyleConfig:{control:()=>({backgroundColor:"inherit",cursor:"pointer",border:"none",":hover":{backgroundColor:"inherit"}}),valueContainer:zt=>({...zt,display:"flex",alignItems:"center",padding:0})}})}),et=zt=>zt.reasonType==="other"?zt.reason:zt.reasonType,Jt=zt=>{const tn=et(zt);re(Ze,tn)},gt=zt=>{const tn=et(zt);i(tn)},mn=()=>{const zt=e.chargeCard?.status.code;if(zt==="closed"||zt==="closed_by_customer")return null;if(!y)return os&&vo?Hc:null;if(!os&&!Ze)return null;const tn=e.chargeCard?.isLockedByAdmin===!0;return os&&!Ze&&tn&&zt==="locked"?null:Hc};return t.jsxRuntimeExports.jsxs(cXn,{children:[Xe&&e.chargeCard!=null&&t.jsxRuntimeExports.jsx(XW,{showLockCardDrawer:!0,onCloseLockCardDrawer:()=>ft(!1),isChargeCardAdmin:Ze,chargeCardsByCardId:{[e.chargeCard.id]:e.chargeCard},cardRecurringExpensesByCardId:{[e.chargeCard.id]:U.recurringExpenses},cardRecurringExpenseFetchState:U.fetchState,lockCardFetchState:e.lockChargeCardsFetchState.fetchState,onConfirmClick:Jt,onDismissClick:()=>ft(!1),onRemoveCardClick:()=>{}}),oo&&e.chargeCard!=null&&t.jsxRuntimeExports.jsx(KW,{showCloseCardDrawer:!0,onCloseCloseCardDrawer:()=>on(!1),isChargeCardAdmin:Ze,chargeCardsByCardId:{[e.chargeCard.id]:e.chargeCard},cardRecurringExpensesByCardId:{[e.chargeCard.id]:U.recurringExpenses},cardRecurringExpenseFetchState:U.fetchState,closeCardFetchState:e.closeChargeCardsFetchState.fetchState,onConfirmClick:gt,onDismissClick:()=>on(!1),onRemoveCardClick:()=>{}}),He&&e.chargeCard?.cardProviderID!=null?t.jsxRuntimeExports.jsx(BJn,{signedInUserToken:W,vgsVaultId:x,onCancelClick:()=>{jt(!1),yt(!0)},isSandboxEnv:!0,cardProviderID:e.chargeCard?.cardProviderID,onChangePinSuccess:()=>{jt(!1),yt(!0)},onUpdateDebitCardPinAttempt:J}):null,_o?null:t.jsxRuntimeExports.jsx(gJn,{isChargeCardAdmin:Ze,controllerEmails:h,isChargeCardFeatureEnabled:C,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:E,isChargeCardSetupEnabled:$,chargeCardCashbackDetailState:R,creditAccountRepayment:e.creditAccountRepayment,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,creditAccount:e.creditAccount,selectedColor:mt,walletType:yn,onFireOnClickAnalytics:K,isSandboxEnv:Y,chargeCardDetailView:e,vgsVaultId:x,signedInUserToken:W,showSecretInfo:To,changePinInProcess:ct,setShowChangePinPopup:jt,isCardDetailErrored:dn,cardDetailsFetchState:xn,setCardDetailsFetchState:As,setIsCardDetailErrored:Zs,isCardDetailFetching:ks,handleColorCodeClick:Kt,isDrawerOpen:Yn,setIsAddToWalletDrawerOpen:Hs,onVerifyOtp:me,onVerifyOtpSuccess:je,onFireVerifyPopOnClickAnalytics:oe,onResendOtp:ne,setShowSecretInfo:kn,secretRevealed:Dn,setSecretRevealed:qt,onGetOtp:ie,showDrawerAnimation:nn}),t.jsxRuntimeExports.jsx(Rt,{rightSideComponent:t.jsxRuntimeExports.jsxs(ii,{children:[f&&!ts?t.jsxRuntimeExports.jsx(ZJn,{pageEntityIds:qe,onClick:()=>{In(null),pn(!0)}}):null,mn(),t.jsxRuntimeExports.jsx(ms,{dataTestId:"cards-detail-ask-ai-cfo-button",isAiCfoAccessEnabled:_e,onAskAiCfoClick:Te})]}),navBarContainerStyles:{paddingTop:p[2],alignItems:"center",paddingBottom:p[2]},source:"ChargeCardDetailPage",title:e.chargeCard?.cardName??yr.cardList.title.cards,hideSearchBtn:!0,showBackButton:!0,showMenuIcon:!1,backgroundColor:Oe.colors.grey5,style:{zIndex:3},onBackClick:ee,titleStyle:{marginTop:p[0],...Me==="small"&&{textAlign:"left"}},leftComponentStyle:Me==="small"?{width:"80%"}:void 0,rightComponentStyle:Me==="small"?{width:"10%"}:void 0}),t.jsxRuntimeExports.jsx(VC,{phoneNumberPopupDescription:yr.cardDetails.verifyPhoneNumberDescription,showOtpPopup:pt,showPhoneNumberPopup:Ht,twoFactorAuthenticationView:e.twoFAView,loggedInUserPhone:e.loggedInUserPhone,onVerifyOtp:me,onVerifyOtpSuccess:zt=>{je(zt),ct?jt(!0):kn(!0)},onFireVerifyPopOnClickAnalytics:oe,setShowOtpPopup:Bt,onResendOtp:ne,setShowPhoneNumberPopup:$o,onGetOtp:ie}),so&&t.jsxRuntimeExports.jsx(rLe,{currentCardName:e.chargeCard?.cardName??"",renameFetchState:e.updateChargeCardNameFetchState.fetchState,onCancelClick:()=>no(!1),onSubmitClick:zt=>{e.chargeCard&&pe(Ze,zt)}}),Tt&&e.chargeCard!=null?t.jsxRuntimeExports.jsx(aLe,{controllerEmails:h,isChargeCardFeatureEnabled:C,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:E,isChargeCardSetupEnabled:$,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,cardDetail:e.chargeCard,transactionStatistics:e.transactionStatistics,depositAccountLimitFetchState:e.depositAccountLimitFetchState.fetchState,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,signedInUser:H,isDebitCard:vo,cardIssuedByRoles:L,cardHolderRoles:D,loggedInUserRole:F,cardIssuedByDepartmentName:P,cardHolderDepartmentName:M,classListFetchState:a,currentLimitAmount:e.chargeCard?.limit??{amount:0,currencyCode:Ld.currency.countryCode,currencySymbol:Ld.currency.currencySymbol},currentSpentAmount:e.chargeCard?.balance??{amount:0,currencyCode:Ld.currency.countryCode,currencySymbol:Ld.currency.currencySymbol},maxLimitAmount:vo?e.depositAccountLimit?.cardLimits.dailyCardTransactionLimit:e.creditAccount.limit,isDisabled:vo&&e.depositAccountLimitFetchState.fetchState!=="Completed",updateLimitFetchState:e.updateChargeCardLimitFetchState.fetchState,onCancelClick:()=>Gt(!1),onSubmitClick:zt=>{if(e.chargeCard){const tn={amount:zt,currencyCode:e.chargeCard.limit.currencyCode,currencySymbol:e.chargeCard.limit.currencySymbol};Ee(e.chargeCard.id,tn,e.chargeCard.creditLimitFrequency,Fe("0,0.[00]",tn))}},recommendations:e?.chargeCard?.recommendations}):null,e.fetchState==="Not-Started"||e.fetchState==="In-Progress"?t.jsxRuntimeExports.jsx(mLe,{}):e.fetchState==="Error"?t.jsxRuntimeExports.jsxs(nXn,{windowSize:Me,children:[t.jsxRuntimeExports.jsx(rXn,{onClick:te,"data-testid":_("reload-card-detail"),children:t.jsxRuntimeExports.jsx(lXn,{})}),t.jsxRuntimeExports.jsx(aXn,{children:Ld.reloadPage.label})]}):t.jsxRuntimeExports.jsx(U0,{isOpen:$e??!1,isFullView:Be??!1,panelContent:Ae,headerContent:t.jsxRuntimeExports.jsxs(c2e,{children:[t.jsxRuntimeExports.jsx(Oqn,{controllerEmails:h,isChargeCardFeatureEnabled:C,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:E,isChargeCardSetupEnabled:$,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,isDebitCard:vo,chargeCardCashbackDetailState:R,cardIssuedByRoles:L,cardIssuedByDepartmentName:P,cardHolderRoles:D,cardHolderDepartmentName:M,classListFetchState:a,chargeCardDetailView:e,spent:wt,isCardNotPending:Ct,cardOwnerName:xt,appleWalletLink:V,googleWalletLink:N,addressToShow:Wt,secretRevealed:Dn,isOwnCard:os,vgsVaultId:x,showSecretInfo:To,isSandboxEnv:Y,isCardDetailErrored:dn,signedInUserToken:W,selectedColor:mt,cardDetailsFetchState:xn,setCardDetailsFetchState:As,setIsCardDetailErrored:Zs,setSecretRevealed:qt,isCardDetailFetching:ks,handleColorCodeClick:Kt,onFireOnClickAnalytics:K,setShowPhoneNumberPopup:$o,setShowChangeSpendLimitPopup:Gt,setShowSecretInfo:kn,showUpdateSpendLimitAction:jn,onOwnerNameCopyClick:en,onAddressCopyClick:On,onUnlockChargeCard:n}),q?Ln?t.jsxRuntimeExports.jsxs(JJn,{windowSize:Me,children:[t.jsxRuntimeExports.jsx(uXn,{}),t.jsxRuntimeExports.jsx(eXn,{children:` ${yr.payEarly.paymentOf} ${Fe("0,0.[00]",e.creditAccountRepayment.initiatedRepayments)} ${yr.payEarly.madeOn} ${e.creditAccountRepayment.initiatedRepaymentDate?.format(HJn.visual.MMMDFormat)} ${yr.payEarly.isProcessing} ${yr.payEarly.theCompanyCreditLimitWillUpdateIn23BusinessDays}`})]}):ns?Ze?t.jsxRuntimeExports.jsxs(OLe,{onClick:()=>{Se(!0)},windowSize:Me,children:[t.jsxRuntimeExports.jsx(d2e,{windowSize:Me}),t.jsxRuntimeExports.jsxs(sXn,{children:[t.jsxRuntimeExports.jsx(u2e,{children:yr.payEarly.transactionsMayBeDeclinedBecauseTheCompanyCreditLimitIsRunningLow}),t.jsxRuntimeExports.jsxs(tXn,{className:"pay-now-button",children:[yr.payEarly.payNow,t.jsxRuntimeExports.jsx(XJn,{})]})]})]}):t.jsxRuntimeExports.jsxs(KJn,{windowSize:Me,children:[t.jsxRuntimeExports.jsx(d2e,{windowSize:Me}),t.jsxRuntimeExports.jsx(iXn,{children:t.jsxRuntimeExports.jsx(u2e,{children:yr.payEarly.yourTransactionsMayBeDeclinedBecauseTheCompanyCreditLimitIsRunningLowWeHaveNotifiedYourAdmin})})]}):null:null,os&&Me!=="small"&&Ct&&vo===!1?t.jsxRuntimeExports.jsx(EYn,{style:{marginTop:ns?o.sp5:o.sp4},classListFetchState:a,controllerEmails:h,isChargeCardFeatureEnabled:C,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:E,isChargeCardSetupEnabled:$,chargeCardDetailView:e,creditAccount:B,creditAccountRepayment:e.creditAccountRepayment,productInformation:k,cashbackInformation:T,creditAccountInformation:A,debitAccountInformation:I,cardIssuedByRoles:L,cardHolderRoles:D,cardIssuedByDepartmentName:P,cardHolderDepartmentName:M,isDebitCard:vo,appleWalletLink:V,googleWalletLink:N,setWalletType:Go,setIsAddToWalletDrawerOpen:Hs,showDrawerAnimation:nn}):null]}),listContent:t.jsxRuntimeExports.jsx(c2e,{children:t.jsxRuntimeExports.jsx(v0,{sharedItems:{sharedFunctions:{subtreeFunctions:{openAllThreadsDrawer:us}},sharedRef:void 0},children:t.jsxRuntimeExports.jsxs(wXn,{windowSize:Me,isOwnCard:os,isMobileOrTabletScreen:_o,children:[Ct&&e.transactions.length>0?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(pXn,{windowSize:Me,children:[t.jsxRuntimeExports.jsx(gXn,{windowSize:Me,children:t.jsxRuntimeExports.jsx(fXn,{})}),t.jsxRuntimeExports.jsxs(dXn,{windowSize:Me,children:[t.jsxRuntimeExports.jsxs(mXn,{children:[t.jsxRuntimeExports.jsx(oXn,{children:yr.aiAccountantText}),Ld.strings.space,yr.aiAccountantMessage,Ld.strings.space]}),t.jsxRuntimeExports.jsxs(hXn,{"data-testid":_("charge-card-detail-copy-email"),onClick:Vt,onMouseEnter:()=>dt(!0),onMouseLeave:()=>dt(!1),children:[t.jsxRuntimeExports.jsx(xXn,{children:e.chargeCardConfig.receiptBotEmail}),Je===!0?t.jsxRuntimeExports.jsxs(m2e,{children:[t.jsxRuntimeExports.jsx(jXn,{}),t.jsxRuntimeExports.jsx(p2e,{children:t.jsxRuntimeExports.jsx(x2e,{shouldDisplay:Ue||Je,color:v.primaryDark,children:Ld.copyToClipBoard.copied})})]}):t.jsxRuntimeExports.jsxs(m2e,{children:[t.jsxRuntimeExports.jsx(yXn,{color:Ue?Oe.colors.primary:void 0}),t.jsxRuntimeExports.jsx(p2e,{children:t.jsxRuntimeExports.jsx(x2e,{shouldDisplay:Ue&&Me!=="small",children:Ld.copyToClipBoard.copy})})]})]})]})]})}):null,t.jsxRuntimeExports.jsx(VKn,{isCardsCommentingEnabled:f,cardStatusCode:e.chargeCard?.status.code,cardCodeType:e.chargeCard?.type.code,cardId:m,documentAiReceiptMaxSizeLimit:Z,uploadReceiptsFetchStateByTransactionId:e.uploadReceiptsFetchStateByTransactionId,isSnackbarOpen:G,uploadReceiptsShowTickByTransactionId:e.uploadReceiptsShowTickByTransactionId,isViewReceiptClickedImmediatelyAfterUploadTransactionId:e.isViewReceiptClickedImmediatelyAfterUploadTransactionId,receiptRequiredAboveAmount:e.chargeCardConfig.receiptRequiredAboveAmount,cardsEndPoint:r,transactionAttachmentsEndpointToFetch:l,transactionAttachmentEndpointToDownload:c,authParams:d,hideSorting:u,transactions:e.transactions,cardHolderUser:e.chargeCard?.cardHolderUser,uiState:e.uiState,fetchState:e.transactionListFetchState.fetchState,isAiCategorizationEnabledForCardsTransactions:e.chargeCardConfig.isAiCategorizationEnabledForCardsTransactions,onReloadTransactions:te,onFetchChargeCardTransactionList:se,isOwnCard:os,onColumnSortConfigChanged:de,removeSnackbar:he,onChargeCardTransactionRowClick:Ce,onUpdateScrollYOffset:ve,onUploadReceiptComplete:ye,updateChargeCardTransactionAttachments:ue,updateChargeCardTransactionUploadReceiptsFetchStatus:le,updateChargeCardTransactionReceiptsShowTick:ae,updateChargeCardTransactionIsViewReceiptClicked:ge})]})})})}),f?t.jsxRuntimeExports.jsx(Ps.RoomProvider,{id:`dashboard_${Ie.currentTenant?.companyId}`,children:t.jsxRuntimeExports.jsx(qJn,{threadData:ds,isThreadsOpen:ts,pageEntityIds:qe,setIsThreadsOpen:pn,onThreadClick:js,windowSize:Me,backgroundColor:Oe.colors.background})}):null]})},qJn=({threadData:e,isThreadsOpen:n,pageEntityIds:i,setIsThreadsOpen:r,onThreadClick:a,windowSize:l,backgroundColor:c})=>{const d=ht(),u=e?.entityId,m=g.useMemo(()=>({application:"dashboard",companyId:d.currentTenant?.companyId,tab:"transaction",entityId:u,isGlobalComment:!1}),[d.currentTenant?.companyId,u]),{threads:x,isLoading:h}=O9({filter:m}),f=g.useMemo(()=>u!=null?x:x.filter(y=>i.has(y.metadata.entityId)),[x,u,i]);return t.jsxRuntimeExports.jsx(aa,{isDrawerOpen:n,allowComposer:!1,drawerTitle:_Le,threads:f,autoExpand:!0,autoFocus:!1,filter:{application:"dashboard",companyId:d.currentTenant?.companyId,tab:"transaction",isGlobalComment:!1},isLoading:h,textOverrides:{composerPlaceholder:WJn,replyComposerPlaceholder:VJn,threadResolve:QJn,threadUnResolve:UJn},onThreadClick:(y,C)=>a(y,C),onCloseAllThreadsDrawer:()=>r(!1),drawerSectionStyle:{width:l==="small"?"100%":"400px",boxSizing:l==="small"?"border-box":"content-box",padding:`${o.sp0} ${GJn.drawerSectionPaddingLeftRight.valuePx(l)}`,backgroundColor:c},collapsibleThreadStyle:{width:l==="small"?"100%":"360px"}})},ZJn=({pageEntityIds:e,onClick:n})=>{const i=ht(),r=g.useMemo(()=>({application:"dashboard",companyId:i.currentTenant?.companyId,tab:"transaction",isGlobalComment:!1}),[i.currentTenant?.companyId]),{threads:a,isLoading:l}=sa(r,!1,!0),c=g.useMemo(()=>a.filter(d=>e.has(d.metadata.entityId)).length,[a,e]);return t.jsxRuntimeExports.jsx(Le,{title:_Le,placement:"bottom",display:"flex",arrow:!0,enterDelay:600,children:t.jsxRuntimeExports.jsxs(CXn,{isDisabled:l,"data-testid":_("charge-card-detail-comment-button"),onClick:l?void 0:d=>{d.preventDefault(),d.stopPropagation(),n()},children:[t.jsxRuntimeExports.jsx(Br,{count:l?void 0:c,isLoading:l,style:{left:"12px"}}),t.jsxRuntimeExports.jsx(bXn,{})]})})},jz=({chargeCardDetailView:e,chargeCardCashbackDetailState:n,isChargeCardFeatureEnabled:i,productInformation:r,cashbackInformation:a,creditAccountInformation:l,debitAccountInformation:c,creditAccount:d,creditAccountRepayment:u,isDebitCard:m,isChargeCardAdmin:x,analytics:h,controllerEmails:f,actionDetails:y,actionField:C})=>{e.chargeCard!=null&&n.fetchState==="Completed"&&(!i||d.fetchState==="Completed"&&u.fetchState==="Completed")&&(!(m&&x)||e.depositAccountLimitFetchState.fetchState==="Completed")&&h.trackCardsCopyIconClick(f,r,"Cards Detail","Copy","copied",C,y,a,l,c)},c2e=s.div``,OLe=s.div`
60671
60671
  background: ${v.important};
60672
60672
  display: flex;
60673
60673
  align-items: center;
@@ -63649,7 +63649,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
63649
63649
  `,Gls=s.div`
63650
63650
  display: flex;
63651
63651
  justify-content: flex-end;
63652
- `,Yls=e=>j.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("rect",{x:10,y:2,width:12,height:12,rx:2,stroke:"currentColor",strokeWidth:1.5}),j.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 10.75C7 10.3358 6.66421 10 6.25 10H3.70967C2.76545 10 2 10.7654 2 11.7097V20.2936C2 21.2378 2.76544 22.0033 3.70966 22.0033H12.2936C13.2378 22.0033 14.0033 21.2378 14.0033 20.2936V17.75C14.0033 17.3358 13.6675 17 13.2533 17C12.8391 17 12.5033 17.3358 12.5033 17.75V20.2936C12.5033 20.4094 12.4094 20.5033 12.2936 20.5033H3.70966C3.59387 20.5033 3.5 20.4094 3.5 20.2936V11.7097C3.5 11.5939 3.59387 11.5 3.70967 11.5H6.25C6.66421 11.5 7 11.1642 7 10.75Z",fill:"currentColor"})),ip=O.getLocalizedStrings(),L0e=e=>`${e}_form`,qls={rowGap:new w(p[0],p[5],p[5])},{common:{footer:B0e},taskManagement:Ua}=O.getLocalizedStrings(),Zls=({taskListView:e,tagListView:n,isTaskTemplatesEnabled:i,taskListFetchState:r,onCreateTagClick:a,updateTask:l,onDragNDrop:c,onDeleteTaskGroup:d,updateLocalData:u,onTaskManagementRowClick:m,onParentTaskClick:x,onReloadTasks:h,onColumnSortConfigChanged:f,onSearchTextChanged:y,onTabChange:C,onBackClick:b,bulkUpdateTasks:E,onNewTaskClick:$,onFiltersChange:R,resetLocalData:S,handleCreateGroup:k,assignGroupToTasks:T,onAddNewTaskToTaskGroup:A,onGroupByFilterChange:I,onTaskGroupRename:B,analytics:L,onTimeSpentUpdate:P,onShowToast:D,handleGroupTemplateClick:M,handleGroupTemplateTaskClick:F,handleNewTaskInitialization:V,onTaskGroupNameClick:N,isAiCfoAccessEnabled:H,isZeniUser:W,isTaskBulkResolutionEnabled:U,isTaskCannedResponsesEnabled:Y,isTaskCategorizationEnabled:q,isTaskGroupAssigneesEnabled:Z,isTaskRecurringParentEnabled:G,onAskAiCfoClick:K,onQuickResponsesClick:J})=>{const[oe,ee]=g.useState(!1),[te,se]=g.useState(null),[ie,re]=g.useState(null),[ne,me]=g.useState(null),[pe,je]=g.useState(null),[ce,de]=g.useState(!1),ue=X(),le=ht(),{fetchState:ae,uiState:ge,filters:ye,userList:he,taskGroupsWithTasksList:Ce,currentTab:we,tabCounts:ve}=e,{tagList:Ee}=n,Se=t.useTheme(),$e=g.useMemo(()=>Q.ALL_TASK_LIST_TABS.map(Qe=>({id:Qe,label:ip.taskManagement.taskList.tabs[Qe],countDetails:{count:ve[Qe],isFetching:ae==="In-Progress"}})),[ve,ae]),Be=Qe=>{de(Qe)},Ae=g.useCallback(Qe=>{je(Qe.currentTarget)},[]),_e=g.useCallback(Qe=>{I(Qe)},[I]),Te=g.useCallback(()=>{I("groupName")},[I]),Re=g.useCallback(Qe=>{V(Qe)},[V]),ke=he.users.map(Qe=>Qe.user).filter(Qe=>Qe!=null),Oe={entity:"task_management",showNewButtonOnNavbar:!0,showEntityEmailInfoIconOnNavbar:!1,newButtonLabel:ip.common.create,isSearchOpen:ce,searchPlaceHolder:ip.taskManagement.taskList.searchPlaceHolder,searchText:ge.searchText,showSettingsIcon:J!=null&&W===!0&&Y===!0,onClickSetupIcon:J,showStatementButtonOnNavbar:!1,showDownloadButtonOnNavbar:!1,disableDownloadButton:!0,filters:ye,searchTextBoxStyle:{right:"108px"},onNewButtonClick:Ae,onSearchOpen:Be,onSearchTextChanged:y,onFiltersChange:R,analytics:L,downloadState:"Not-Started",createdByUserListLoaded:he.fetchState==="Completed"||he.fetchState==="Error",groupByFiltersComponent:{component:t.jsxRuntimeExports.jsx(Wrs,{value:ge.groupByKey,resetDisabled:ge.groupByKey==="groupName",onChange:_e,onReset:Te}),height:90},getFilterOptions:()=>AY("task_management",ke,le.loggedInUserRole??[],n.tagList)},Me=g.useCallback(Qe=>{je(null),se(Kh),u({...e.localData,newTaskGroupName:Qe})},[e.localData,u]),Ie=g.useCallback(()=>{je(null)},[]),Ne=g.useCallback(()=>{ie!=null&&d(ie)},[ie,d]),Pe=g.useCallback(()=>{se(Kh)},[]),Ue=g.useCallback(Qe=>{me(dt=>dt===Qe?null:Qe)},[]);g.useEffect(()=>{e.taskGroupDeleteStatus.fetchState==="Completed"&&ee(!1)},[e.taskGroupDeleteStatus.fetchState]),g.useEffect(()=>{i&&e.taskGroupTemplates.length>0&&me(e.taskGroupTemplates[0].id)},[i,e.taskGroupTemplates]);const Je=()=>ae==="Error"?t.jsxRuntimeExports.jsxs(ncs,{children:[t.jsxRuntimeExports.jsx(scs,{onClick:h,children:t.jsxRuntimeExports.jsx(ics,{})}),t.jsxRuntimeExports.jsx(rcs,{children:ip.common.reloadPage.label})]}):ae==="Completed"&&Ce.length===0?t.jsxRuntimeExports.jsx(il,{message:ip.taskManagement.taskList.noDataText}):ae==="Not-Started"||ae==="In-Progress"?r==="In-Progress"?t.jsxRuntimeExports.jsx(hls,{}):t.jsxRuntimeExports.jsx(K0,{fetchState:ae}):t.jsxRuntimeExports.jsx(Kls,{taskListView:e,tagList:Ee,renameActiveField:te,bulkUpdateTasks:E,updateTask:l,onDragNDrop:c,onAddNewTaskToTaskGroup:A,onColumnSortConfigChanged:f,onTaskManagementRowClick:m,assignGroupToTasks:T,handleCreateGroup:k,resetLocalData:S,setGroupCreationInProgress:Pe,setShowDeleteModal:ee,updateLocalData:u,setActiveTaskGroupId:re,setRenameActiveField:se,onTaskGroupRename:B,onTimeSpentUpdate:P,onShowToast:D,onCreateTagClick:a,onTaskGroupNameClick:N,onParentTaskClick:x,isZeniUser:W,isTaskBulkResolutionEnabled:U,isTaskGroupAssigneesEnabled:Z,isTaskRecurringParentEnabled:G}),tt=t.jsxRuntimeExports.jsxs(ii,{children:[t.jsxRuntimeExports.jsx(lB,{spendManagementSectionProps:Oe}),t.jsxRuntimeExports.jsx(ms,{isAiCfoAccessEnabled:H,onAskAiCfoClick:K})]});return t.jsxRuntimeExports.jsxs(ocs,{children:[t.jsxRuntimeExports.jsx(Rt,{title:ip.taskManagement.taskList.pageTitle,showBackButton:!1,showBorderBottom:!1,showMenuIcon:ue==="medium-compact"||ue==="small",backgroundColor:Se.colors.grey4,style:{zIndex:3},onBackClick:b,rightSideComponent:tt,isSearchOpen:ce,source:"TaskManagementPage"}),t.jsxRuntimeExports.jsx(uas,{anchorEl:pe,groupByKey:ge.groupByKey,taskGroupTemplates:e.taskGroupTemplates,taskCreationFromTemplateStatus:e.taskCreationFromTemplateStatus,isTaskTemplatesEnabled:i,onClose:Ie,onNewTaskClick:$,onNewGroupClick:Me,handleGroupTemplateClick:M,handleGroupTemplateTaskClick:F,onNewTaskInitialization:Re,onExpandTemplate:Ue,expandedTemplate:ne}),q===!0?t.jsxRuntimeExports.jsx(_c,{allTabs:$e,selectedTab:we,onTabChange:Qe=>C(Qe.id),containerStyle:{justifyContent:"flex-start",paddingLeft:di.valuePx(ue),borderBottom:`1px solid ${Se.colors.grey2}`}}):null,t.jsxRuntimeExports.jsx(tcs,{children:Je()}),t.jsxRuntimeExports.jsx(bt,{controller:oe===!0,children:t.jsxRuntimeExports.jsx(po,{action:{onOkClick:Ne,onCancelClick:()=>{ee(!1)}},isLoading:e.taskGroupDeleteStatus.fetchState==="In-Progress",secondaryButtonText:ip.common.cancel,primaryButtonText:ip.common.confirm,titleComponent:t.jsxRuntimeExports.jsx(So,{children:ip.taskManagement.taskList.taskGroup.deleteTaskGroup}),proceedButtonVariant:"destructive",descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:ip.taskManagement.taskList.deleteConfirmationMessage})})})]})},Kls=({taskListView:e,tagList:n,renameActiveField:i,bulkUpdateTasks:r,updateTask:a,onTaskGroupRename:l,setRenameActiveField:c,onDragNDrop:d,updateLocalData:u,setShowDeleteModal:m,handleCreateGroup:x,resetLocalData:h,assignGroupToTasks:f,setGroupCreationInProgress:y,onTaskManagementRowClick:C,onColumnSortConfigChanged:b,onAddNewTaskToTaskGroup:E,setActiveTaskGroupId:$,onTimeSpentUpdate:R,onShowToast:S,onCreateTagClick:k,onTaskGroupNameClick:T,onParentTaskClick:A,isZeniUser:I,isTaskBulkResolutionEnabled:B,isTaskGroupAssigneesEnabled:L,isTaskRecurringParentEnabled:P})=>{const D=g.useRef(null);qs({componentName:"task.management.list"});const[F,V]=g.useState(null),[N,H]=g.useState(null),[W,U]=g.useState(null),[Y,q]=g.useState(null),Z=ke=>Oe=>{U(ke),H(Oe.currentTarget)},G=()=>{U(null),H(null)},K=g.useRef({}),J=X(),{currentTab:oe,localData:ee,taskGroupsWithTasksList:te,uiState:se,userGroupList:ie}=e,re=L===!0?ie:{userGroups:[],fetchState:ie.fetchState},ne=e.updateTasksFetchState.fetchState==="In-Progress",[me,pe]=g.useState([]),je=g.useRef(null);Frs({scrollContainerRef:je,isEnabled:J!=="small"});const ce=g.useMemo(()=>e.userList.users.map(ke=>ke.user).filter(ke=>ke!=null),[e.userList.users]),de=t.useForm({mode:"onSubmit",reValidateMode:"onSubmit",shouldFocusError:!0,defaultValues:g.useMemo(()=>P0e(e.taskGroupsWithTasksList,ee,ce,n,e.userGroupList.userGroups),[e.taskGroupsWithTasksList,e.userGroupList.userGroups,ee,ce,n]),values:g.useMemo(()=>P0e(e.taskGroupsWithTasksList,ee,ce,n,e.userGroupList.userGroups),[e.taskGroupsWithTasksList,e.userGroupList.userGroups,ee,ce,n])}),ue=g.useMemo(()=>{if(i!==Kh)return te;const ke=[],Oe=te.map(Me=>{const Ie=Me.tasks.filter(Ne=>{const Pe=ee.selectedTaskIds.includes(Ne.id)===!0;return Pe&&ke.push(Ne),Pe===!1});return{...Me,tasks:Ie}});return Oe.unshift({groupName:"",isDefault:!1,id:Kh,tasks:ke}),Oe},[i,te,ee.selectedTaskIds]),le=g.useCallback(ke=>me.includes(ue[ke].id)||ue[ke].tasks.length===0?100:K.current?.[ke]!=null?K.current[ke]+qls.rowGap.value(J):(rq*1+nq)*3+sq+iq,[me,ue,J]),ae=g.useCallback(ke=>{V(ke.currentTarget)},[]),ge=g.useCallback((ke,Oe)=>{K.current={...K.current,[ke]:Oe},D.current?.resetAfterIndex(0,!0)},[J,D,te]),ye=g.useCallback(ke=>{pe(Oe=>Oe.includes(ke)?Oe.filter(Me=>ke!==Me):[...Oe,ke]),D.current?.resetAfterIndex(0,!0)},[]),he=g.useCallback(()=>{V(null)},[]),Ce=g.useCallback(()=>{pe(te.map(ke=>ke.id)),D.current?.resetAfterIndex(0,!0)},[te]),we=g.useCallback(()=>{pe([]),D.current?.resetAfterIndex(0,!0)},[]),ve=g.useCallback(()=>{y(),D.current?.scrollTo(0),he()},[he,y]),Ee=g.useCallback(ke=>{$(ke),m(!0)},[$,m]),Se=g.useCallback(()=>{ee.selectedTaskIds.length>0?i!==Kh?ve():x(!0):i===Kh?x(!1):i!=null&&l(i,ee.existingTaskGroupNamesByGroupId[i])},[ee.selectedTaskIds.length,ee.existingTaskGroupNamesByGroupId,i,ve,x,l]),$e=g.useCallback(()=>{c(null),h()},[h,c]),Be=g.useCallback(ke=>{h(),c(ke)},[h,c]),Ae=g.useCallback(()=>{ee.defaultTaskGroupId!=null&&f(ee.defaultTaskGroupId)},[f,ee.defaultTaskGroupId]),_e=async(ke,Oe)=>{if(ke.includes(aY)){const Ie=ke.split(".")[2],Pe=te.flatMap(Je=>Je.tasks).find(Je=>Je.id===Ie),Ue=Oe[tu][Tg][Ie].priority.selectedOption;if(Pe!=null&&Ue!=null){const Je=Q.allTaskPriority.find(tt=>tt.code===Ue);Je!=null&&a(Pe,{priority:Je})}return}if(ke.includes(rY)){const Ie=ke.split(".")[2],Pe=te.flatMap(Je=>Je.tasks).find(Je=>Je.id===Ie),Ue=Oe[tu][Tg][Ie].status.selectedOption;if(Pe!=null&&Ue!=null){const Je=Q.allTaskStatus.find(tt=>tt.code===Ue);Pe!=null&&Je!=null&&a(Pe,{status:Je})}return}if(ke.includes(cY)){const Ie=ke.split(".")[2],Pe=te.flatMap(Qe=>Qe.tasks).find(Qe=>Qe.id===Ie),Ue=te.find(Qe=>Qe.tasks.find(dt=>dt.id===Ie))?.id,Je=Oe[tu][Tg][Ie].assignees.selectedUsers.map(Qe=>Qe.userId),tt=Oe[tu][Tg][Ie].assignees.selectedUserGroups?.map(Qe=>Qe.userGroupId);Ue!=null&&Je!=null&&Pe!=null&&a(Pe,{assignees:Je,groupAssignees:tt});return}if(ke.includes(lY)){const Ie=ke.split(".")[2],Pe=te.flatMap(tt=>tt.tasks).find(tt=>tt.id===Ie),Ue=te.find(tt=>tt.tasks.find(Qe=>Qe.id===Ie))?.id,Je=Oe[tu][Tg][Ie].dueDate.date;Ue!=null&&Je!=null&&Pe!=null&&a(Pe,{dueDate:Je});return}if(ke.includes(dY)){const Ie=ke.split(".")[2],Pe=te.flatMap(tt=>tt.tasks).find(tt=>tt.id===Ie),Ue=te.find(tt=>tt.tasks.find(Qe=>Qe.id===Ie))?.id,Je=Oe[tu][Tg][Ie].tags.selectedOptions;Ue!=null&&Je!=null&&Pe!=null&&a(Pe,{tagIds:Je});return}ke.includes(F2)&&de.trigger(ke);const Me=ecs(ke,Oe,ee);u(Me)};g.useEffect(()=>{const ke=de.watch((Oe,{name:Me})=>{Me!=null&&Oe!=null&&t.defer(()=>_e(Me,Oe))});return()=>{ke.unsubscribe()}}),g.useEffect(()=>{e.taskGroupCreationStatus.fetchState==="Completed"&&c(null)},[c,e.taskGroupCreationStatus.fetchState]),g.useEffect(()=>{e.taskGroupUpdateStatus.fetchState==="Completed"&&c(null)},[c,e.taskGroupUpdateStatus.fetchState]);const Te=ee.selectedTaskIds.length>0&&i!==Kh,Re=ee.newTaskGroupName.length>0||ee.selectedTaskIds.length>0||i!==null;return t.jsxRuntimeExports.jsxs(t.FormProvider,{...de,children:[t.jsxRuntimeExports.jsx("form",{id:L0e(tle),onSubmit:de.handleSubmit(Se),style:{width:"100%"},children:t.jsxRuntimeExports.jsx(acs,{isFooterVisible:Re,windowSize:J,children:t.jsxRuntimeExports.jsx(t.AutoSizer,{children:({height:ke,width:Oe})=>t.jsxRuntimeExports.jsx(t.VariableSizeList,{ref:D,outerRef:je,height:ke,itemCount:ue.length,itemSize:le,estimatedItemSize:jC,itemKey:Me=>ue[Me].id,width:Oe,overscanCount:a6,itemData:{tagList:n,taskGroupsWithTasksList:ue,uiState:se,collapsedGroups:me,userList:e.userList,userGroupList:re.userGroups,renameActiveField:i,selectedRowIds:ee.selectedTaskIds,existingTaskGroupNamesByGroupId:ee.existingTaskGroupNamesByGroupId,onRenameClick:Be,handleOnDragNDrop:d,onCollapseToggle:ye,setRowHeight:ge,onTaskManagementRowClick:C,onColumnSortConfigChanged:b,onAddNewTaskToTaskGroup:E,onCollapseAll:Ce,onDeleteTaskGroup:Ee,onExpandAll:we,onTimeSpentUpdate:R,onShowToast:S,onCreateTagClick:k,onTaskGroupNameClick:T,onParentTaskClick:A,isZeniUser:I,isTaskRecurringParentEnabled:P},initialScrollOffset:0,children:Jls})})})}),Re?t.jsxRuntimeExports.jsx(_t,{formId:L0e(tle),style:{pointerEvents:ne?"none":"auto"},primaryBtn:{label:B0e.save,style:{width:"135px"},isLoading:e.taskGroupCreationStatus.fetchState==="In-Progress"||e.taskGroupUpdateStatus.fetchState==="In-Progress"},cancelBtn:{label:B0e.cancel,style:{width:"135px",border:"none"},onClick:$e,prefixIcon:t.jsxRuntimeExports.jsx(pcs,{})},helperContainerStyle:J==="small"?{width:"100%"}:void 0,leftSideComponent:t.jsxRuntimeExports.jsx(bt,{controller:J!=="small"&&ee.selectedTaskIds.length>0,children:t.jsxRuntimeExports.jsxs(ccs,{children:[t.jsxRuntimeExports.jsx(oBe,{count:ee.selectedTaskIds.length}),t.jsxRuntimeExports.jsx(dcs,{children:ee.selectedTaskIds.length>1?Ua.taskList.footer.tasksSelected:Ua.taskList.footer.taskSelected})]})}),rightSideComponent:t.jsxRuntimeExports.jsx(bt,{controller:J!=="small"&&ee.selectedTaskIds.length>0&&oe==="live",children:t.jsxRuntimeExports.jsx(fcs,{children:B===!0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Le,{enterDelay:600,title:Ua.taskList.footer.snooze,children:t.jsxRuntimeExports.jsx(Az,{onClick:ke=>q(ke.currentTarget),children:t.jsxRuntimeExports.jsx(xcs,{})})}),t.jsxRuntimeExports.jsx(Le,{enterDelay:600,title:Ua.taskList.footer.archive,children:t.jsxRuntimeExports.jsx(Az,{onClick:()=>r(ee.selectedTaskIds,{isArchived:!0}),children:t.jsxRuntimeExports.jsx(hcs,{})})}),t.jsxRuntimeExports.jsx(Le,{enterDelay:600,title:Ua.taskList.footer.delete,children:t.jsxRuntimeExports.jsx(Az,{onClick:()=>r(ee.selectedTaskIds,{isDeleted:!0}),children:t.jsxRuntimeExports.jsx(gcs,{})})})]}):null})}),showPrimaryButton:Te===!1,customPrimaryButton:Te?ne?t.jsxRuntimeExports.jsx(Et,{size:"Standard",start:!0}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[oe==="live"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[B===!0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.status,onClick:Z("status"),size:"standard"}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.priority,onClick:Z("priority"),size:"standard"}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.assignees,onClick:Z("assignees"),size:"standard"}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.dates,onClick:Z("dates"),size:"standard"}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.tags,onClick:Z("tags"),size:"standard"}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.timeSpent,onClick:Z("timeSpent"),size:"standard"})]}):null,t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.moveTo,onClick:ae,size:"standard",prefixIcon:t.jsxRuntimeExports.jsx(mcs,{})}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.ungroup,onClick:Ae,size:"standard",prefixIcon:t.jsxRuntimeExports.jsx(ucs,{})}),t.jsxRuntimeExports.jsx(Zrs,{taskGroupsList:te,anchorEl:F,groupByKey:se.groupByKey,onCreateNewGroup:ve,onExistingGroupSelection:ke=>{he(),f(ke)},onClose:he}),t.jsxRuntimeExports.jsx(Fls,{anchorEl:W==="status"?N:null,onSelect:ke=>{const Oe=Q.allTaskStatus.find(Me=>Me.code===ke);Oe!=null&&r(ee.selectedTaskIds,{status:Oe})},onClose:G}),t.jsxRuntimeExports.jsx(zls,{anchorEl:W==="priority"?N:null,onSelect:ke=>{const Oe=Q.allTaskPriority.find(Me=>Me.code===ke);Oe!=null&&r(ee.selectedTaskIds,{priority:Oe})},onClose:G}),t.jsxRuntimeExports.jsx(Sls,{anchorEl:W==="assignees"?N:null,userList:ce,userGroupList:re.userGroups,onSelect:(ke,Oe)=>{r(ee.selectedTaskIds,{assignees:ke,groupAssignees:Oe})},onClose:G}),t.jsxRuntimeExports.jsx(_ls,{anchorEl:W==="dates"?N:null,onSelect:ke=>{r(ee.selectedTaskIds,{dueDate:ke})},onClose:G}),t.jsxRuntimeExports.jsx(Hls,{anchorEl:W==="tags"?N:null,tagList:n,onSelect:ke=>{r(ee.selectedTaskIds,{tagIds:ke})},onClose:G}),t.jsxRuntimeExports.jsx(Vls,{anchorEl:W==="timeSpent"?N:null,onSelect:ke=>{r(ee.selectedTaskIds,{timeSpent:ke})},onClose:G})]}):null,oe==="archived"?t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.unarchive,onClick:()=>r(ee.selectedTaskIds,{isArchived:!1}),size:"standard"}):null,oe==="deleted"?t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.undoDelete,onClick:()=>r(ee.selectedTaskIds,{isDeleted:!1}),size:"standard"}):null,oe==="snoozed"?t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.unsnooze,onClick:()=>r(ee.selectedTaskIds,{snoozedUntil:null}),size:"standard"}):null]}):void 0}):null,t.jsxRuntimeExports.jsx(cSe,{anchorEl:Y,onClose:()=>q(null),onSnooze:ke=>{r(ee.selectedTaskIds,{snoozedUntil:Q.zeniDate(ke)}),q(null)}})]})},Jls=({index:e,style:n,data:i})=>{const r=g.useRef(null),a=X(),{tagList:l,taskGroupsWithTasksList:c,uiState:d,renameActiveField:u,collapsedGroups:m,onCollapseToggle:x,onTaskManagementRowClick:h,setRowHeight:f,onColumnSortConfigChanged:y,onCollapseAll:C,onExpandAll:b,onAddNewTaskToTaskGroup:E,onDeleteTaskGroup:$,handleOnDragNDrop:R,onRenameClick:S,userList:k,selectedRowIds:T,existingTaskGroupNamesByGroupId:A,onTimeSpentUpdate:I,onShowToast:B,onCreateTagClick:L,onTaskGroupNameClick:P,userGroupList:D,onParentTaskClick:M,isZeniUser:F,isTaskRecurringParentEnabled:V}=i;g.useEffect(()=>{r.current?.firstElementChild!=null&&f(e,r.current.firstElementChild.clientHeight)},[e,r,a,c[e]?.tasks]);const N=g.useCallback(Y=>{const q=Y.dataTransfer.getData("row");R(q,c[e].id)},[R,e,c]),H=g.useCallback(Y=>{Y.preventDefault()},[]),W=(Y,q)=>{Y.dataTransfer.setData("row",q)},U=()=>{S(c[e].id)};return t.jsxRuntimeExports.jsx(lcs,{style:{...n,width:"100%"},ref:r,onDrop:N,onDragOver:H,children:t.jsxRuntimeExports.jsx(Xls,{taskGroup:c[e],showGroupName:!0,tagList:l,uiState:d,isCollapsed:m.includes(c[e].id),onCollapseToggle:x,showRenameTextField:u===c[e].id,userGroupList:D,isSelectionAllowed:u==null,onTaskManagementRowClick:h,onColumnSortConfigChanged:y,onAddNewTaskToTaskGroup:E,onCollapseAll:C,onDeleteTaskGroup:$,onExpandAll:b,selectedRowIds:T,userList:k,existingTaskGroupNamesByGroupId:A,onDragStart:W,onRenameClick:U,onTimeSpentUpdate:I,onShowToast:B,onCreateTagClick:L,onTaskGroupNameClick:P,onParentTaskClick:M,isZeniUser:F,isTaskRecurringParentEnabled:V},c[e].id)})},Xls=({taskGroup:e,userGroupList:n,tagList:i,showGroupName:r,uiState:a,showRenameTextField:l,isCollapsed:c,isSelectionAllowed:d,selectedRowIds:u,userList:m,existingTaskGroupNamesByGroupId:x,onRenameClick:h,onTaskManagementRowClick:f,onCollapseToggle:y,onColumnSortConfigChanged:C,onCollapseAll:b,onExpandAll:E,onAddNewTaskToTaskGroup:$,onDeleteTaskGroup:R,onDragStart:S,onTimeSpentUpdate:k,onShowToast:T,onCreateTagClick:A,onTaskGroupNameClick:I,onParentTaskClick:B,isZeniUser:L,isTaskRecurringParentEnabled:P})=>{const M=X()==="small"?zas:LZo;return t.jsxRuntimeExports.jsx(M,{taskGroup:e,tagList:i,userList:m,sectionId:tu,showGroupName:r,uiState:a,showRenameTextField:l,isCollapsed:c,isSelectionAllowed:d,selectedRowIds:u,existingTaskGroupNamesByGroupId:x,userGroupList:n,onAddNewTaskToTaskGroup:$,onCollapseAll:b,onDeleteTaskGroup:R,onExpandAll:E,onCollapseToggle:y,onTaskManagementRowClick:f,onColumnSortConfigChanged:C,onDragStart:S,onRenameClick:h,onTimeSpentUpdate:k,onShowToast:T,onCreateTagClick:A,onTaskGroupNameClick:I,onParentTaskClick:B,isZeniUser:L,isTaskRecurringParentEnabled:P})},P0e=(e,n,i,r,a)=>{const l={},c={};e.forEach(u=>{c[u.id]={[d9]:[],[R2]:n.existingTaskGroupNamesByGroupId[u.id]},u.tasks.forEach(m=>{n.selectedTaskIds.includes(m.id)&&c[u.id].selectedIds.push(m.id),l[m.id]={[rY]:{selectedOption:m.status.code,allOptions:Q.allTaskStatus.map(x=>({label:x.name,value:x.code}))},[aY]:{selectedOption:m.priority.code,allOptions:Q.allTaskPriority.map(x=>({label:x.name,value:x.code}))},[lY]:{date:m.dueDate,showBusinessDay:!1},[cY]:{allUsers:i,selectedUsers:m.assigneeUsers.map(x=>x.user),allUserGroups:a,selectedUserGroups:m.groupAssignees.map(x=>a.find(h=>h.userGroupId===x)).filter(x=>x!=null)},[dY]:{allOptions:u9(r),selectedOptions:m.tagIds},[F2]:m.timeSpent}})});const d={[iY]:{[Kh]:{[R2]:n.newTaskGroupName,[d9]:[]},...c},[Tg]:l};return{[tu]:d}},ecs=(e,n,i)=>{if(e.includes(tu)){const r=e.split(".")[2];if(e.includes(R2))return e.includes(Kh)?{...i,newTaskGroupName:n[tu].groupData[r][R2]}:{...i,existingTaskGroupNamesByGroupId:{...i.existingTaskGroupNamesByGroupId,[r]:n[tu].groupData[r][R2]}};if(e.includes(d9)){const a=t.flatten(t.map(Object.values(n[tu][iY]),d9)).filter(l=>l!==ip.common.all.toLocaleLowerCase());return{...i,selectedTaskIds:a}}}return i},tcs=s.div`
63652
+ `,Yls=e=>j.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("rect",{x:10,y:2,width:12,height:12,rx:2,stroke:"currentColor",strokeWidth:1.5}),j.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 10.75C7 10.3358 6.66421 10 6.25 10H3.70967C2.76545 10 2 10.7654 2 11.7097V20.2936C2 21.2378 2.76544 22.0033 3.70966 22.0033H12.2936C13.2378 22.0033 14.0033 21.2378 14.0033 20.2936V17.75C14.0033 17.3358 13.6675 17 13.2533 17C12.8391 17 12.5033 17.3358 12.5033 17.75V20.2936C12.5033 20.4094 12.4094 20.5033 12.2936 20.5033H3.70966C3.59387 20.5033 3.5 20.4094 3.5 20.2936V11.7097C3.5 11.5939 3.59387 11.5 3.70967 11.5H6.25C6.66421 11.5 7 11.1642 7 10.75Z",fill:"currentColor"})),ip=O.getLocalizedStrings(),L0e=e=>`${e}_form`,qls={rowGap:new w(p[0],p[5],p[5])},{common:{footer:B0e},taskManagement:Ua}=O.getLocalizedStrings(),Zls=({taskListView:e,tagListView:n,isTaskTemplatesEnabled:i,taskListFetchState:r,onCreateTagClick:a,updateTask:l,onDragNDrop:c,onDeleteTaskGroup:d,updateLocalData:u,onTaskManagementRowClick:m,onParentTaskClick:x,onReloadTasks:h,onColumnSortConfigChanged:f,onSearchTextChanged:y,onTabChange:C,onBackClick:b,bulkUpdateTasks:E,onNewTaskClick:$,onFiltersChange:R,resetLocalData:S,handleCreateGroup:k,assignGroupToTasks:T,onAddNewTaskToTaskGroup:A,onGroupByFilterChange:I,onTaskGroupRename:B,analytics:L,onTimeSpentUpdate:P,onShowToast:D,handleGroupTemplateClick:M,handleGroupTemplateTaskClick:F,handleNewTaskInitialization:V,onTaskGroupNameClick:N,isAiCfoAccessEnabled:H,isZeniUser:W,isTaskBulkResolutionEnabled:U,isTaskCannedResponsesEnabled:Y,isTaskCategorizationEnabled:q,isTaskGroupAssigneesEnabled:Z,isTaskRecurringParentEnabled:G,onAskAiCfoClick:K,onQuickResponsesClick:J})=>{const[oe,ee]=g.useState(!1),[te,se]=g.useState(null),[ie,re]=g.useState(null),[ne,me]=g.useState(null),[pe,je]=g.useState(null),[ce,de]=g.useState(!1),ue=X(),le=ht(),{fetchState:ae,uiState:ge,filters:ye,userList:he,taskGroupsWithTasksList:Ce,currentTab:we,tabCounts:ve}=e,{tagList:Ee}=n,Se=t.useTheme(),$e=g.useMemo(()=>Q.ALL_TASK_LIST_TABS.map(Ue=>({id:Ue,label:ip.taskManagement.taskList.tabs[Ue],countDetails:{count:ve[Ue],isFetching:ae==="In-Progress"}})),[ve,ae]),Be=Ue=>{de(Ue)},Ae=g.useCallback(Ue=>{je(Ue.currentTarget)},[]),_e=g.useCallback(Ue=>{I(Ue)},[I]),Te=g.useCallback(()=>{I("groupName")},[I]),Re=g.useCallback(Ue=>{V(Ue)},[V]),ke=he.users.map(Ue=>Ue.user).filter(Ue=>Ue!=null),Oe={entity:"task_management",showNewButtonOnNavbar:!0,showEntityEmailInfoIconOnNavbar:!1,newButtonLabel:ip.common.create,isSearchOpen:ce,searchPlaceHolder:ip.taskManagement.taskList.searchPlaceHolder,searchText:ge.searchText,showSettingsIcon:J!=null&&W===!0&&Y===!0,onClickSetupIcon:J,showStatementButtonOnNavbar:!1,showDownloadButtonOnNavbar:!1,disableDownloadButton:!0,filters:ye,searchTextBoxStyle:{right:"108px"},onNewButtonClick:Ae,onSearchOpen:Be,onSearchTextChanged:y,onFiltersChange:R,analytics:L,downloadState:"Not-Started",createdByUserListLoaded:he.fetchState==="Completed"||he.fetchState==="Error",groupByFiltersComponent:{component:t.jsxRuntimeExports.jsx(Wrs,{value:ge.groupByKey,resetDisabled:ge.groupByKey==="groupName",onChange:_e,onReset:Te}),height:90},getFilterOptions:()=>AY("task_management",ke,le.loggedInUserRole??[],n.tagList)},Me=g.useCallback(Ue=>{je(null),se(Kh),u({...e.localData,newTaskGroupName:Ue})},[e.localData,u]),Ie=g.useCallback(()=>{je(null)},[]),Ne=g.useCallback(()=>{ie!=null&&d(ie)},[ie,d]),Pe=g.useCallback(()=>{se(Kh)},[]),Qe=g.useCallback(Ue=>{me(dt=>dt===Ue?null:Ue)},[]);g.useEffect(()=>{e.taskGroupDeleteStatus.fetchState==="Completed"&&ee(!1)},[e.taskGroupDeleteStatus.fetchState]),g.useEffect(()=>{i&&e.taskGroupTemplates.length>0&&me(e.taskGroupTemplates[0].id)},[i,e.taskGroupTemplates]);const Je=()=>ae==="Error"?t.jsxRuntimeExports.jsxs(ncs,{children:[t.jsxRuntimeExports.jsx(scs,{onClick:h,children:t.jsxRuntimeExports.jsx(ics,{})}),t.jsxRuntimeExports.jsx(rcs,{children:ip.common.reloadPage.label})]}):ae==="Completed"&&Ce.length===0?t.jsxRuntimeExports.jsx(il,{message:ip.taskManagement.taskList.noDataText}):ae==="Not-Started"||ae==="In-Progress"?r==="In-Progress"?t.jsxRuntimeExports.jsx(hls,{}):t.jsxRuntimeExports.jsx(K0,{fetchState:ae}):t.jsxRuntimeExports.jsx(Kls,{taskListView:e,tagList:Ee,renameActiveField:te,bulkUpdateTasks:E,updateTask:l,onDragNDrop:c,onAddNewTaskToTaskGroup:A,onColumnSortConfigChanged:f,onTaskManagementRowClick:m,assignGroupToTasks:T,handleCreateGroup:k,resetLocalData:S,setGroupCreationInProgress:Pe,setShowDeleteModal:ee,updateLocalData:u,setActiveTaskGroupId:re,setRenameActiveField:se,onTaskGroupRename:B,onTimeSpentUpdate:P,onShowToast:D,onCreateTagClick:a,onTaskGroupNameClick:N,onParentTaskClick:x,isZeniUser:W,isTaskBulkResolutionEnabled:U,isTaskGroupAssigneesEnabled:Z,isTaskRecurringParentEnabled:G}),tt=t.jsxRuntimeExports.jsxs(ii,{children:[t.jsxRuntimeExports.jsx(lB,{spendManagementSectionProps:Oe}),t.jsxRuntimeExports.jsx(ms,{isAiCfoAccessEnabled:H,onAskAiCfoClick:K})]});return t.jsxRuntimeExports.jsxs(ocs,{children:[t.jsxRuntimeExports.jsx(Rt,{title:ip.taskManagement.taskList.pageTitle,showBackButton:!1,showBorderBottom:!1,showMenuIcon:ue==="medium-compact"||ue==="small",backgroundColor:Se.colors.grey4,style:{zIndex:3},onBackClick:b,rightSideComponent:tt,isSearchOpen:ce,source:"TaskManagementPage"}),t.jsxRuntimeExports.jsx(uas,{anchorEl:pe,groupByKey:ge.groupByKey,taskGroupTemplates:e.taskGroupTemplates,taskCreationFromTemplateStatus:e.taskCreationFromTemplateStatus,isTaskTemplatesEnabled:i,onClose:Ie,onNewTaskClick:$,onNewGroupClick:Me,handleGroupTemplateClick:M,handleGroupTemplateTaskClick:F,onNewTaskInitialization:Re,onExpandTemplate:Qe,expandedTemplate:ne}),q===!0?t.jsxRuntimeExports.jsx(_c,{allTabs:$e,selectedTab:we,onTabChange:Ue=>C(Ue.id),containerStyle:{justifyContent:"flex-start",paddingLeft:di.valuePx(ue),borderBottom:`1px solid ${Se.colors.grey2}`}}):null,t.jsxRuntimeExports.jsx(tcs,{children:Je()}),t.jsxRuntimeExports.jsx(bt,{controller:oe===!0,children:t.jsxRuntimeExports.jsx(po,{action:{onOkClick:Ne,onCancelClick:()=>{ee(!1)}},isLoading:e.taskGroupDeleteStatus.fetchState==="In-Progress",secondaryButtonText:ip.common.cancel,primaryButtonText:ip.common.confirm,titleComponent:t.jsxRuntimeExports.jsx(So,{children:ip.taskManagement.taskList.taskGroup.deleteTaskGroup}),proceedButtonVariant:"destructive",descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:ip.taskManagement.taskList.deleteConfirmationMessage})})})]})},Kls=({taskListView:e,tagList:n,renameActiveField:i,bulkUpdateTasks:r,updateTask:a,onTaskGroupRename:l,setRenameActiveField:c,onDragNDrop:d,updateLocalData:u,setShowDeleteModal:m,handleCreateGroup:x,resetLocalData:h,assignGroupToTasks:f,setGroupCreationInProgress:y,onTaskManagementRowClick:C,onColumnSortConfigChanged:b,onAddNewTaskToTaskGroup:E,setActiveTaskGroupId:$,onTimeSpentUpdate:R,onShowToast:S,onCreateTagClick:k,onTaskGroupNameClick:T,onParentTaskClick:A,isZeniUser:I,isTaskBulkResolutionEnabled:B,isTaskGroupAssigneesEnabled:L,isTaskRecurringParentEnabled:P})=>{const D=g.useRef(null);qs({componentName:"task.management.list"});const[F,V]=g.useState(null),[N,H]=g.useState(null),[W,U]=g.useState(null),[Y,q]=g.useState(null),Z=ke=>Oe=>{U(ke),H(Oe.currentTarget)},G=()=>{U(null),H(null)},K=g.useRef({}),J=X(),{currentTab:oe,localData:ee,taskGroupsWithTasksList:te,uiState:se,userGroupList:ie}=e,re=L===!0?ie:{userGroups:[],fetchState:ie.fetchState},ne=e.updateTasksFetchState.fetchState==="In-Progress",[me,pe]=g.useState([]),je=g.useRef(null);Frs({scrollContainerRef:je,isEnabled:J!=="small"});const ce=g.useMemo(()=>e.userList.users.map(ke=>ke.user).filter(ke=>ke!=null),[e.userList.users]),de=t.useForm({mode:"onSubmit",reValidateMode:"onSubmit",shouldFocusError:!0,defaultValues:g.useMemo(()=>P0e(e.taskGroupsWithTasksList,ee,ce,n,e.userGroupList.userGroups),[e.taskGroupsWithTasksList,e.userGroupList.userGroups,ee,ce,n]),values:g.useMemo(()=>P0e(e.taskGroupsWithTasksList,ee,ce,n,e.userGroupList.userGroups),[e.taskGroupsWithTasksList,e.userGroupList.userGroups,ee,ce,n])}),ue=g.useMemo(()=>{if(i!==Kh)return te;const ke=[],Oe=te.map(Me=>{const Ie=Me.tasks.filter(Ne=>{const Pe=ee.selectedTaskIds.includes(Ne.id)===!0;return Pe&&ke.push(Ne),Pe===!1});return{...Me,tasks:Ie}});return Oe.unshift({groupName:"",isDefault:!1,id:Kh,tasks:ke}),Oe},[i,te,ee.selectedTaskIds]),le=g.useCallback(ke=>me.includes(ue[ke].id)||ue[ke].tasks.length===0?100:K.current?.[ke]!=null?K.current[ke]+qls.rowGap.value(J):(rq*1+nq)*3+sq+iq,[me,ue,J]),ae=g.useCallback(ke=>{V(ke.currentTarget)},[]),ge=g.useCallback((ke,Oe)=>{K.current={...K.current,[ke]:Oe},D.current?.resetAfterIndex(0,!0)},[J,D,te]),ye=g.useCallback(ke=>{pe(Oe=>Oe.includes(ke)?Oe.filter(Me=>ke!==Me):[...Oe,ke]),D.current?.resetAfterIndex(0,!0)},[]),he=g.useCallback(()=>{V(null)},[]),Ce=g.useCallback(()=>{pe(te.map(ke=>ke.id)),D.current?.resetAfterIndex(0,!0)},[te]),we=g.useCallback(()=>{pe([]),D.current?.resetAfterIndex(0,!0)},[]),ve=g.useCallback(()=>{y(),D.current?.scrollTo(0),he()},[he,y]),Ee=g.useCallback(ke=>{$(ke),m(!0)},[$,m]),Se=g.useCallback(()=>{ee.selectedTaskIds.length>0?i!==Kh?ve():x(!0):i===Kh?x(!1):i!=null&&l(i,ee.existingTaskGroupNamesByGroupId[i])},[ee.selectedTaskIds.length,ee.existingTaskGroupNamesByGroupId,i,ve,x,l]),$e=g.useCallback(()=>{c(null),h()},[h,c]),Be=g.useCallback(ke=>{h(),c(ke)},[h,c]),Ae=g.useCallback(()=>{ee.defaultTaskGroupId!=null&&f(ee.defaultTaskGroupId)},[f,ee.defaultTaskGroupId]),_e=async(ke,Oe)=>{if(ke.includes(aY)){const Ie=ke.split(".")[2],Pe=te.flatMap(Je=>Je.tasks).find(Je=>Je.id===Ie),Qe=Oe[tu][Tg][Ie].priority.selectedOption;if(Pe!=null&&Qe!=null){const Je=Q.allTaskPriority.find(tt=>tt.code===Qe);Je!=null&&a(Pe,{priority:Je})}return}if(ke.includes(rY)){const Ie=ke.split(".")[2],Pe=te.flatMap(Je=>Je.tasks).find(Je=>Je.id===Ie),Qe=Oe[tu][Tg][Ie].status.selectedOption;if(Pe!=null&&Qe!=null){const Je=Q.allTaskStatus.find(tt=>tt.code===Qe);Pe!=null&&Je!=null&&a(Pe,{status:Je})}return}if(ke.includes(cY)){const Ie=ke.split(".")[2],Pe=te.flatMap(Ue=>Ue.tasks).find(Ue=>Ue.id===Ie),Qe=te.find(Ue=>Ue.tasks.find(dt=>dt.id===Ie))?.id,Je=Oe[tu][Tg][Ie].assignees.selectedUsers.map(Ue=>Ue.userId),tt=Oe[tu][Tg][Ie].assignees.selectedUserGroups?.map(Ue=>Ue.userGroupId);Qe!=null&&Je!=null&&Pe!=null&&a(Pe,{assignees:Je,groupAssignees:tt});return}if(ke.includes(lY)){const Ie=ke.split(".")[2],Pe=te.flatMap(tt=>tt.tasks).find(tt=>tt.id===Ie),Qe=te.find(tt=>tt.tasks.find(Ue=>Ue.id===Ie))?.id,Je=Oe[tu][Tg][Ie].dueDate.date;Qe!=null&&Je!=null&&Pe!=null&&a(Pe,{dueDate:Je});return}if(ke.includes(dY)){const Ie=ke.split(".")[2],Pe=te.flatMap(tt=>tt.tasks).find(tt=>tt.id===Ie),Qe=te.find(tt=>tt.tasks.find(Ue=>Ue.id===Ie))?.id,Je=Oe[tu][Tg][Ie].tags.selectedOptions;Qe!=null&&Je!=null&&Pe!=null&&a(Pe,{tagIds:Je});return}ke.includes(F2)&&de.trigger(ke);const Me=ecs(ke,Oe,ee);u(Me)};g.useEffect(()=>{const ke=de.watch((Oe,{name:Me})=>{Me!=null&&Oe!=null&&t.defer(()=>_e(Me,Oe))});return()=>{ke.unsubscribe()}}),g.useEffect(()=>{e.taskGroupCreationStatus.fetchState==="Completed"&&c(null)},[c,e.taskGroupCreationStatus.fetchState]),g.useEffect(()=>{e.taskGroupUpdateStatus.fetchState==="Completed"&&c(null)},[c,e.taskGroupUpdateStatus.fetchState]);const Te=ee.selectedTaskIds.length>0&&i!==Kh,Re=ee.newTaskGroupName.length>0||ee.selectedTaskIds.length>0||i!==null;return t.jsxRuntimeExports.jsxs(t.FormProvider,{...de,children:[t.jsxRuntimeExports.jsx("form",{id:L0e(tle),onSubmit:de.handleSubmit(Se),style:{width:"100%"},children:t.jsxRuntimeExports.jsx(acs,{isFooterVisible:Re,windowSize:J,children:t.jsxRuntimeExports.jsx(t.AutoSizer,{children:({height:ke,width:Oe})=>t.jsxRuntimeExports.jsx(t.VariableSizeList,{ref:D,outerRef:je,height:ke,itemCount:ue.length,itemSize:le,estimatedItemSize:jC,itemKey:Me=>ue[Me].id,width:Oe,overscanCount:a6,itemData:{tagList:n,taskGroupsWithTasksList:ue,uiState:se,collapsedGroups:me,userList:e.userList,userGroupList:re.userGroups,renameActiveField:i,selectedRowIds:ee.selectedTaskIds,existingTaskGroupNamesByGroupId:ee.existingTaskGroupNamesByGroupId,onRenameClick:Be,handleOnDragNDrop:d,onCollapseToggle:ye,setRowHeight:ge,onTaskManagementRowClick:C,onColumnSortConfigChanged:b,onAddNewTaskToTaskGroup:E,onCollapseAll:Ce,onDeleteTaskGroup:Ee,onExpandAll:we,onTimeSpentUpdate:R,onShowToast:S,onCreateTagClick:k,onTaskGroupNameClick:T,onParentTaskClick:A,isZeniUser:I,isTaskRecurringParentEnabled:P},initialScrollOffset:0,children:Jls})})})}),Re?t.jsxRuntimeExports.jsx(_t,{formId:L0e(tle),style:{pointerEvents:ne?"none":"auto"},primaryBtn:{label:B0e.save,style:{width:"135px"},isLoading:e.taskGroupCreationStatus.fetchState==="In-Progress"||e.taskGroupUpdateStatus.fetchState==="In-Progress"},cancelBtn:{label:B0e.cancel,style:{width:"135px",border:"none"},onClick:$e,prefixIcon:t.jsxRuntimeExports.jsx(pcs,{})},helperContainerStyle:J==="small"?{width:"100%"}:void 0,leftSideComponent:t.jsxRuntimeExports.jsx(bt,{controller:J!=="small"&&ee.selectedTaskIds.length>0,children:t.jsxRuntimeExports.jsxs(ccs,{children:[t.jsxRuntimeExports.jsx(oBe,{count:ee.selectedTaskIds.length}),t.jsxRuntimeExports.jsx(dcs,{children:ee.selectedTaskIds.length>1?Ua.taskList.footer.tasksSelected:Ua.taskList.footer.taskSelected})]})}),rightSideComponent:t.jsxRuntimeExports.jsx(bt,{controller:J!=="small"&&ee.selectedTaskIds.length>0&&oe==="live",children:t.jsxRuntimeExports.jsx(fcs,{children:B===!0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Le,{enterDelay:600,title:Ua.taskList.footer.snooze,children:t.jsxRuntimeExports.jsx(Az,{onClick:ke=>q(ke.currentTarget),children:t.jsxRuntimeExports.jsx(xcs,{})})}),t.jsxRuntimeExports.jsx(Le,{enterDelay:600,title:Ua.taskList.footer.archive,children:t.jsxRuntimeExports.jsx(Az,{onClick:()=>r(ee.selectedTaskIds,{isArchived:!0}),children:t.jsxRuntimeExports.jsx(hcs,{})})}),t.jsxRuntimeExports.jsx(Le,{enterDelay:600,title:Ua.taskList.footer.delete,children:t.jsxRuntimeExports.jsx(Az,{onClick:()=>r(ee.selectedTaskIds,{isDeleted:!0}),children:t.jsxRuntimeExports.jsx(gcs,{})})})]}):null})}),showPrimaryButton:Te===!1,customPrimaryButton:Te?ne?t.jsxRuntimeExports.jsx(Et,{size:"Standard",start:!0}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[oe==="live"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[B===!0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.status,onClick:Z("status"),size:"standard"}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.priority,onClick:Z("priority"),size:"standard"}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.assignees,onClick:Z("assignees"),size:"standard"}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.dates,onClick:Z("dates"),size:"standard"}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.tags,onClick:Z("tags"),size:"standard"}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.timeSpent,onClick:Z("timeSpent"),size:"standard"})]}):null,t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.moveTo,onClick:ae,size:"standard",prefixIcon:t.jsxRuntimeExports.jsx(mcs,{})}),t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.ungroup,onClick:Ae,size:"standard",prefixIcon:t.jsxRuntimeExports.jsx(ucs,{})}),t.jsxRuntimeExports.jsx(Zrs,{taskGroupsList:te,anchorEl:F,groupByKey:se.groupByKey,onCreateNewGroup:ve,onExistingGroupSelection:ke=>{he(),f(ke)},onClose:he}),t.jsxRuntimeExports.jsx(Fls,{anchorEl:W==="status"?N:null,onSelect:ke=>{const Oe=Q.allTaskStatus.find(Me=>Me.code===ke);Oe!=null&&r(ee.selectedTaskIds,{status:Oe})},onClose:G}),t.jsxRuntimeExports.jsx(zls,{anchorEl:W==="priority"?N:null,onSelect:ke=>{const Oe=Q.allTaskPriority.find(Me=>Me.code===ke);Oe!=null&&r(ee.selectedTaskIds,{priority:Oe})},onClose:G}),t.jsxRuntimeExports.jsx(Sls,{anchorEl:W==="assignees"?N:null,userList:ce,userGroupList:re.userGroups,onSelect:(ke,Oe)=>{r(ee.selectedTaskIds,{assignees:ke,groupAssignees:Oe})},onClose:G}),t.jsxRuntimeExports.jsx(_ls,{anchorEl:W==="dates"?N:null,onSelect:ke=>{r(ee.selectedTaskIds,{dueDate:ke})},onClose:G}),t.jsxRuntimeExports.jsx(Hls,{anchorEl:W==="tags"?N:null,tagList:n,onSelect:ke=>{r(ee.selectedTaskIds,{tagIds:ke})},onClose:G}),t.jsxRuntimeExports.jsx(Vls,{anchorEl:W==="timeSpent"?N:null,onSelect:ke=>{r(ee.selectedTaskIds,{timeSpent:ke})},onClose:G})]}):null,oe==="archived"?t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.unarchive,onClick:()=>r(ee.selectedTaskIds,{isArchived:!1}),size:"standard"}):null,oe==="deleted"?t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.undoDelete,onClick:()=>r(ee.selectedTaskIds,{isDeleted:!1}),size:"standard"}):null,oe==="snoozed"?t.jsxRuntimeExports.jsx(Ge,{variant:"ghost",label:Ua.taskList.footer.unsnooze,onClick:()=>r(ee.selectedTaskIds,{snoozedUntil:null}),size:"standard"}):null]}):void 0}):null,t.jsxRuntimeExports.jsx(cSe,{anchorEl:Y,onClose:()=>q(null),onSnooze:ke=>{r(ee.selectedTaskIds,{snoozedUntil:Q.zeniDate(ke)}),q(null)}})]})},Jls=({index:e,style:n,data:i})=>{const r=g.useRef(null),a=X(),{tagList:l,taskGroupsWithTasksList:c,uiState:d,renameActiveField:u,collapsedGroups:m,onCollapseToggle:x,onTaskManagementRowClick:h,setRowHeight:f,onColumnSortConfigChanged:y,onCollapseAll:C,onExpandAll:b,onAddNewTaskToTaskGroup:E,onDeleteTaskGroup:$,handleOnDragNDrop:R,onRenameClick:S,userList:k,selectedRowIds:T,existingTaskGroupNamesByGroupId:A,onTimeSpentUpdate:I,onShowToast:B,onCreateTagClick:L,onTaskGroupNameClick:P,userGroupList:D,onParentTaskClick:M,isZeniUser:F,isTaskRecurringParentEnabled:V}=i;g.useEffect(()=>{r.current?.firstElementChild!=null&&f(e,r.current.firstElementChild.clientHeight)},[e,r,a,c[e]?.tasks]);const N=g.useCallback(Y=>{const q=Y.dataTransfer.getData("row");R(q,c[e].id)},[R,e,c]),H=g.useCallback(Y=>{Y.preventDefault()},[]),W=(Y,q)=>{Y.dataTransfer.setData("row",q)},U=()=>{S(c[e].id)};return t.jsxRuntimeExports.jsx(lcs,{style:{...n,width:"100%"},ref:r,onDrop:N,onDragOver:H,children:t.jsxRuntimeExports.jsx(Xls,{taskGroup:c[e],showGroupName:!0,tagList:l,uiState:d,isCollapsed:m.includes(c[e].id),onCollapseToggle:x,showRenameTextField:u===c[e].id,userGroupList:D,isSelectionAllowed:u==null,onTaskManagementRowClick:h,onColumnSortConfigChanged:y,onAddNewTaskToTaskGroup:E,onCollapseAll:C,onDeleteTaskGroup:$,onExpandAll:b,selectedRowIds:T,userList:k,existingTaskGroupNamesByGroupId:A,onDragStart:W,onRenameClick:U,onTimeSpentUpdate:I,onShowToast:B,onCreateTagClick:L,onTaskGroupNameClick:P,onParentTaskClick:M,isZeniUser:F,isTaskRecurringParentEnabled:V},c[e].id)})},Xls=({taskGroup:e,userGroupList:n,tagList:i,showGroupName:r,uiState:a,showRenameTextField:l,isCollapsed:c,isSelectionAllowed:d,selectedRowIds:u,userList:m,existingTaskGroupNamesByGroupId:x,onRenameClick:h,onTaskManagementRowClick:f,onCollapseToggle:y,onColumnSortConfigChanged:C,onCollapseAll:b,onExpandAll:E,onAddNewTaskToTaskGroup:$,onDeleteTaskGroup:R,onDragStart:S,onTimeSpentUpdate:k,onShowToast:T,onCreateTagClick:A,onTaskGroupNameClick:I,onParentTaskClick:B,isZeniUser:L,isTaskRecurringParentEnabled:P})=>{const M=X()==="small"?zas:LZo;return t.jsxRuntimeExports.jsx(M,{taskGroup:e,tagList:i,userList:m,sectionId:tu,showGroupName:r,uiState:a,showRenameTextField:l,isCollapsed:c,isSelectionAllowed:d,selectedRowIds:u,existingTaskGroupNamesByGroupId:x,userGroupList:n,onAddNewTaskToTaskGroup:$,onCollapseAll:b,onDeleteTaskGroup:R,onExpandAll:E,onCollapseToggle:y,onTaskManagementRowClick:f,onColumnSortConfigChanged:C,onDragStart:S,onRenameClick:h,onTimeSpentUpdate:k,onShowToast:T,onCreateTagClick:A,onTaskGroupNameClick:I,onParentTaskClick:B,isZeniUser:L,isTaskRecurringParentEnabled:P})},P0e=(e,n,i,r,a)=>{const l={},c={};e.forEach(u=>{c[u.id]={[d9]:[],[R2]:n.existingTaskGroupNamesByGroupId[u.id]},u.tasks.forEach(m=>{n.selectedTaskIds.includes(m.id)&&c[u.id].selectedIds.push(m.id),l[m.id]={[rY]:{selectedOption:m.status.code,allOptions:Q.allTaskStatus.map(x=>({label:x.name,value:x.code}))},[aY]:{selectedOption:m.priority.code,allOptions:Q.allTaskPriority.map(x=>({label:x.name,value:x.code}))},[lY]:{date:m.dueDate,showBusinessDay:!1},[cY]:{allUsers:i,selectedUsers:m.assigneeUsers.map(x=>x.user),allUserGroups:a,selectedUserGroups:m.groupAssignees.map(x=>a.find(h=>h.userGroupId===x)).filter(x=>x!=null)},[dY]:{allOptions:u9(r),selectedOptions:m.tagIds},[F2]:m.timeSpent}})});const d={[iY]:{[Kh]:{[R2]:n.newTaskGroupName,[d9]:[]},...c},[Tg]:l};return{[tu]:d}},ecs=(e,n,i)=>{if(e.includes(tu)){const r=e.split(".")[2];if(e.includes(R2))return e.includes(Kh)?{...i,newTaskGroupName:n[tu].groupData[r][R2]}:{...i,existingTaskGroupNamesByGroupId:{...i.existingTaskGroupNamesByGroupId,[r]:n[tu].groupData[r][R2]}};if(e.includes(d9)){const a=t.flatten(t.map(Object.values(n[tu][iY]),d9)).filter(l=>l!==ip.common.all.toLocaleLowerCase());return{...i,selectedTaskIds:a}}}return i},tcs=s.div`
63653
63653
  display: block;
63654
63654
  height: 100%;
63655
63655
  `,ocs=s.div`
@@ -69148,7 +69148,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
69148
69148
  z-index: ${p[2]};
69149
69149
  min-width: ${hY}px;
69150
69150
  max-width: ${xY}px;
69151
- `,iS="monthEndReportFormSection",p5e="monthEndReportPage",ac=O.getLocalizedStrings();function m7s({companyId:e,enableZeniGPTFeature:n,monthEndReportView:i,previewMode:r,customerRequestData:a,allThreadsSectionOpen:l,filterMetaData:c,newThreadMetadata:d,isZeniUser:u,selectedPeriod:m,improveUsingZeniGPTClick:x,onRemoveFileAttachment:h,onUpdateFileAttachment:f,onCloseAllThreadsSection:y,previewMonthEndReport:C,saveMonthEndReport:b,onEditClick:E,onOpenFileAttachmentSnackBar:$,onClickCustomerRequest:R,sendMonthEndReport:S}){const k=t.useTheme(),[T,A]=g.useState(),[I,B]=g.useState(0),[L,P]=g.useState(0),D=g.useRef(),M=g.useRef(null),F=g.useRef(null),{html:V,subject:N,improveUsingZeniGPTStatus:H}=i,[W,U]=g.useState(),[Y,q]=g.useState(!1),[Z,G]=g.useState(!1),K=g.useRef(null),J=g.useRef(null),oe=zSe(l,250),ee=i.fetchState==="Not-Started"||i.fetchState==="In-Progress"||i.companyMonthEndReportTemplatesData.fetchState==="Not-Started"||i.companyMonthEndReportTemplatesData.fetchState==="In-Progress",{threadsRefs:te,sortedThreads:se,threadsPositions:ie,observer:re,unresolvedThreadsMap:ne,handleRemoveFloatingThread:me}=YSe(c,K,!r,ee,u),pe=g.useCallback(()=>{l?J.current!=null&&P(Math.min((J.current.offsetWidth-gb-p[4])/2,J.current.offsetWidth-gb-xY-p[4])):J.current!=null&&B(Math.min((J.current.offsetWidth-gb-p[4])/2,J.current.offsetWidth-gb-hY-p[4]))},[l]);g.useEffect(()=>{pe()},[l,pe]),g.useEffect(()=>(window.addEventListener("resize",pe),()=>{window.removeEventListener("resize",pe)}),[pe]);const je=u?vs:Nu,{openThread:ce,addThread:de,setOpenThread:ue}=g.useContext(je),le=qSe(gW,!1,!r),ae=K.current?.getBoundingClientRect(),ge=le!=null&&le.coords&&ae?{left:le.coords.left-ae.left,top:le.coords.top-ae.top}:void 0,ye=g.useCallback(()=>{const Ie=window.getSelection()?.getRangeAt(0),Ne=GSe();if(!Ie||Ne==null)return;const Pe={...d,...Ne,startPath:Ne.startPath.join(),endPath:Ne.endPath.join()},Ue=`${t.nanoid()}${$s}`,Je=`cockpit_${e}`;de(Ue,{type:"thread",id:Ue,roomId:Je,createdAt:new Date,comments:[],metadata:Pe,updatedAt:new Date,resolved:!1}),ue(Ue)},[de,e,d,ue]);g.useEffect(()=>{ce!=null&&l&&y()},[l,ce,y]);const he=H.fetchState==="In-Progress",Ce=t.useForm({mode:"all",defaultValues:m5e(i),values:m5e(i)}),we=Ce.handleSubmit(Ie=>{const{recipientEmailList:Ne,subject:Pe}=Ie[iS];if(r===!0)S?.(W?.id);else{const Ue=T?.replace(Xj,ac.common.strings.empty);Ne!=null&&Pe!=null&&C(Ne,Pe,W?.id,Ue!=null&&Ue.length>0?T:void 0)}}),ve=()=>{M.current!=null&&M.current.click()},Ee=()=>{W!==void 0&&W!=null&&(h([W.id]),U(void 0),q(!1))},Se=Ie=>{const Ne=Ie.target.files?Ie.target.files[0]:null;if(Ne)if(!Q.toSupportedAttachmentFileType(Ne.type)||Z)console.warn("Please select a valid file.");else{const Pe=new FileReader;Pe.onload=function(Ue){const Je=Ue.target?.result;if(typeof Je=="string"){const tt={data:Je.split(",")[1],name:Ne.name,id:Q.getAttachmentFileIdByFileName(e,Ne.name)};U(tt),q(!0),f([tt])}},Pe.readAsDataURL(Ne)}},$e=()=>{F.current&&F.current.scrollIntoView({behavior:"smooth"})},Be=()=>{const Ie=Ce.getValues(),{recipientEmailList:Ne,subject:Pe}=Ie[iS];Ne!=null&&Pe!=null&&b(Ne,Pe,W?.id,T)};g.useEffect(()=>{A(i.zeniRequestsHtml)},[i.zeniRequestsHtml]),g.useEffect(()=>{D.current=W},[W]),g.useEffect(()=>{U(Q.mapAttachmentFileToAttachmentFilePayload(i.attachmentFile)),q(!1)},[i.attachmentFile]),g.useEffect(()=>{Z&&$()},[Z,$]);const _e=Q.zeniDate(`${m.year}-${m.month}-01`).format(ac.dateFormat.visual.MMMMFormat),Te=V!=null?V.split(Bb):[],Re=i.concatenatedHtml,ke=()=>i.lastDraftSavedDate!=null&&r===!1?t.jsxRuntimeExports.jsx(WSe,{time:i.lastDraftSavedDate,user:i.reportLastSavedByUser,timeStampLabel:ac.cockpit.monthEndReport.timeStampLabel}):null,Oe=()=>u===!0?oe?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(p7s,{allThreadsSectionOpen:l,children:t.jsxRuntimeExports.jsx(EQ,{autoExpand:!0,autoFocus:!1,style:{borderLeft:`1px solid ${k.colors.grey3}`},drawerSectionStyle:{width:`calc(100% - ${o.sp5} - ${o.sp5})`,backgroundColor:k.colors.background},threadsContainerStyle:{paddingBottom:r?"160px":o.sp12},collapsibleThreadStyle:{width:`calc(100% - ${o.sp4})`},allowComposer:!1,drawerTitle:ac.common.texts.comments,filter:c,textOverrides:{},preventResolvedThreadClick:!0,onThreadClick:(Ie,Ne)=>{ue(Ne);const Pe=se.findIndex(Ue=>Ue[0]===Ne);y(),te.current?.[Pe]?.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},onCloseAllThreadsDrawer:()=>y()})}),t.jsxRuntimeExports.jsx(Jz,{availableWidth:I})]}):t.jsxRuntimeExports.jsx(KSe,{observer:re,canvasContainerRef:K,sortedThreads:se,threadsPositions:ie,threadsRefs:te,unresolvedThreadsMap:ne,editorMode:!r,style:{minWidth:`${I}px`,position:"relative",height:"fit-content",top:`${K.current?.offsetTop}px`,minHeight:o.sp12},handleRemoveFloatingThread:me}):t.jsxRuntimeExports.jsx(Jz,{availableWidth:I}),Me=(i.zeniRequestsData??[]).length+mY(i.companyMonthEndReportTemplatesData).length;return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(e7s,{ref:J,children:[t.jsxRuntimeExports.jsx(Jz,{availableWidth:l?L:I}),t.jsxRuntimeExports.jsxs(X6s,{children:[t.jsxRuntimeExports.jsx(t.FormProvider,{...Ce,children:t.jsxRuntimeExports.jsx("form",{id:x5e(p5e),onSubmit:we,children:t.jsxRuntimeExports.jsxs(c7s,{children:[t.jsxRuntimeExports.jsx(QSe,{sectionId:iS,previewMode:r,subject:N}),!r&&Me>0?t.jsxRuntimeExports.jsx(VSe,{totalItems:Me,onClickCustomerRequest:R}):null,t.jsxRuntimeExports.jsxs(n7s,{id:gW,ref:K,children:[t.jsxRuntimeExports.jsxs(s7s,{className:"monthEndReportCanvasWrapper",children:[W!=null||Z?t.jsxRuntimeExports.jsx(i7s,{"data-testid":_("email-attachment-container"),onClick:$e,children:t.jsxRuntimeExports.jsx(HSe,{fileSizeError:Z,setFileSizeError:G,loading:!1,showAnimation:!r&&Y})}):null,r?t.jsxRuntimeExports.jsx(u5e,{dangerouslySetInnerHTML:{__html:ZSe(Re)}}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(o7s,{id:WA,children:[t.jsxRuntimeExports.jsx(De,{dangerouslySetInnerHTML:{__html:Te[0]!=null?Te[0]+"</body></html>":ac.common.strings.empty}}),t.jsxRuntimeExports.jsxs(t7s,{children:[t.jsxRuntimeExports.jsx(l7s,{children:ac.cockpit.monthEndReport.editorTitle}),t.jsxRuntimeExports.jsx(a7s,{children:ac.cockpit.monthEndReport.editorNote})]})]}),t.jsxRuntimeExports.jsx(r7s,{id:r6,children:t.jsxRuntimeExports.jsx(eAe,{handleFileInputClick:ve,fileAttached:W!=null,enableZeniGPTFeature:n,isZeniGPTResponseLoading:he,initialHtmlString:i.zeniRequestsHtml,improveUsingZeniGPTClick:x,setZeniRequestsHtml:A,customerRequestData:a})}),t.jsxRuntimeExports.jsx(u5e,{id:p9,dangerouslySetInnerHTML:{__html:Te[1]!=null?"<html><body>"+Te[1]:ac.common.strings.empty}})]}),W!=null?t.jsxRuntimeExports.jsx(USe,{ref:F,fileName:W.name,fileSize:SCe(W.data),onRemove:Ee,isRemovable:!r}):null]}),ge?t.jsxRuntimeExports.jsx(FSe,{style:{zIndex:15},coords:ge,alignment:le.alignment,onClick:ye}):null,t.jsxRuntimeExports.jsx(tAe,{canvasContainerRef:K,sortedThreads:se,editorMode:!r,isZeniUser:u})]})]})})}),t.jsxRuntimeExports.jsx(yu,{name:W?.name??ac.common.strings.empty,fileRef:M,sizeLimit:J6s,acceptableTypes:K6s,onFileChange:async Ie=>{Se(Ie)},onFileSizeError:Ie=>G(Ie),multiple:!1})]}),Oe()]}),t.jsxRuntimeExports.jsx(_t,{style:{zIndex:10},leftSideComponent:ke(),formId:x5e(p5e),cancelBtn:{isDisabled:he,label:r===!0?ac.cockpit.monthEndReport.editButtonLabel:ac.cockpit.monthEndReport.saveChanges,onClick:r===!0?E:Be,style:{width:"136px",padding:`${o.sp0} ${o.sp3}`,boxSizing:"border-box"},size:"medium",isLoading:i.saveMonthEndReportStatus.fetchState==="In-Progress",reverseSpinnerColor:!1},primaryBtn:{isDisabled:he,isLoading:r===!0?i.sendMonthEndReportStatus.fetchState==="In-Progress":i.previewMonthEndReportStatus.fetchState==="In-Progress",style:{width:r===!0?"unset":"136px"},label:r===!0?ac.cockpit.monthEndReport.sendEmailButtonLabel.replace("__month__",_e):ac.cockpit.monthEndReport.preview,size:"medium"}})]})}const m5e=e=>({[iS]:{recipientEmailList:e.recipientEmailList,subject:e.subject??ac.common.strings.empty}}),x5e=e=>`${e}_form`,LPe=g.createContext(!1),BPe=LPe.Provider,MB=()=>g.useContext(LPe),x7s=p[5],Wb=44,rS=12,h7s=["memo_and_receipt","activity","paymentAccount","receipt"],h5e=e=>Q.stringToUnionStrict(e,h7s),Xz=905,g7s=1240,f7s=1440,y7s=1920;function _x(e,n,i,r){const a=n,l=Math.round(n*g7s/Xz),c=Math.round(n*f7s/Xz),d=Math.round(n*y7s/Xz),u=i??c,m=r??u;return new w(e,n,a,Math.min(l,u),Math.min(c,u),Math.min(d,m))}const{expenseAutomation:{transactions:{header:{vendors:j7s,category:C7s,classText:b7s,project:w7s,date:E7s,type:$7s,amount:R7s,toFrom:v7s,memoReceipt:S7s}}}}=O.getLocalizedStrings(),PPe={key:"vendor",value:j7s,sortOrder:"ascending",width:_x(194,194,194,194),clippedWidth:_x(186,186,186,186),singleColumnEnabledWidthPercentage:14,doubleColumnDisabledWidthPercentage:17,doubleColumnEnabledWidthPercentage:12,customStyle:{common:{paddingLeft:p[7],paddingRight:p[3]},quickView:{paddingLeft:p[9]}},isSticky:!1},A7s={key:"payment_account",value:v7s,sortOrder:"ascending",width:_x(228,228,228,228),singleColumnEnabledWidthPercentage:16,doubleColumnDisabledWidthPercentage:19,doubleColumnEnabledWidthPercentage:14,customStyle:{common:{paddingLeft:p[8],paddingRight:p[3]}}},k7s={key:"category",value:C7s,sortOrder:"ascending",width:_x(228,228,228,228),singleColumnEnabledWidthPercentage:16,doubleColumnDisabledWidthPercentage:19,doubleColumnEnabledWidthPercentage:14,customStyle:{common:{paddingLeft:p[8],paddingRight:p[3]}}},I7s={key:"class",value:b7s,sortOrder:"ascending",width:_x(228,228,228,228),singleColumnEnabledWidthPercentage:16,doubleColumnEnabledWidthPercentage:14,customStyle:{common:{paddingLeft:p[8],paddingRight:p[3]}}},T7s={key:"project",value:w7s,sortOrder:"ascending",width:_x(228,228,228,228),singleColumnEnabledWidthPercentage:16,doubleColumnEnabledWidthPercentage:14,customStyle:{common:{paddingLeft:p[8],paddingRight:p[3]}}},L7s={key:"date",value:E7s,sortOrder:"descending",width:_x(116,116,116,116),singleColumnEnabledWidthPercentage:9,doubleColumnDisabledWidthPercentage:11,doubleColumnEnabledWidthPercentage:7,customStyle:{common:{paddingLeft:p[3],paddingRight:p[3]}}},B7s={key:"transaction_type",value:$7s,sortOrder:"descending",width:_x(165,165,165,165),singleColumnEnabledWidthPercentage:9,doubleColumnDisabledWidthPercentage:11,doubleColumnEnabledWidthPercentage:10,customStyle:{common:{paddingLeft:p[3],paddingRight:p[3]}}},P7s={key:"memo_and_receipt",value:S7s,sortOrder:"ascending",width:_x(136,136,136,136),singleColumnEnabledWidthPercentage:9,doubleColumnDisabledWidthPercentage:10,doubleColumnEnabledWidthPercentage:8,customStyle:{common:{paddingLeft:p[3],justifyContent:"center",display:"flex",alignItems:"center",paddingRight:p[3]}}},MPe={key:"amount",value:R7s,sortOrder:"ascending",width:_x(128,128,128,128),singleColumnEnabledWidthPercentage:11,doubleColumnDisabledWidthPercentage:13,doubleColumnEnabledWidthPercentage:7,customStyle:{common:{paddingRight:p[4],justifyContent:"flex-end",display:"flex",alignItems:"center",paddingLeft:p[3]}}},vq=(e=!0,n=!1)=>[PPe,A7s,k7s,...e?[I7s]:[],...n?[T7s]:[],L7s,B7s,P7s,MPe],Sq=(e,n,i)=>{const r=(n?1:0)+(i?1:0);return r===0?e.doubleColumnDisabledWidthPercentage??e.singleColumnEnabledWidthPercentage:r===2?e.doubleColumnEnabledWidthPercentage??e.singleColumnEnabledWidthPercentage:e.singleColumnEnabledWidthPercentage},Aq=[{...PPe,width:new w(60,60),singleColumnEnabledWidthPercentage:60,doubleColumnDisabledWidthPercentage:60,doubleColumnEnabledWidthPercentage:60,customStyle:{common:{paddingLeft:p[9],paddingRight:p[3]}}},{...MPe,width:new w(40,40),singleColumnEnabledWidthPercentage:40,doubleColumnDisabledWidthPercentage:40,doubleColumnEnabledWidthPercentage:40}],eF={sortKey:"date",sortOrder:"descending"},M7s=1195,D7s=228,_7s=228,DPe=(e=!0,n=!1)=>{let i=M7s;return e&&(i+=D7s),n&&(i+=_7s),new w(i,i,i,i,i,i)},_Pe=({sortConfig:e,isAccountingClassesEnabled:n,showProjectField:i,isDisabled:r,onColumnSortConfigChanged:a})=>{const l=X(),c=mr(),d=MB(),u=g.useMemo(()=>c?Aq:vq(n,i),[c,n,i]),[m,x]=g.useState(()=>t.cloneDeep(u));g.useEffect(()=>{const y=t.cloneDeep(u);for(const C of y)C.key===e.sortKey?C.sortOrder=e.sortOrder:C.sortOrder="ascending";x(y)},[u,e.sortKey,e.sortOrder]);const h=(y,C)=>{let b=C;e.sortKey===y&&(b=C==="ascending"?"descending":"ascending"),a(y,b)},f=y=>{h5e(y.key)==null&&h(Q.toTransactionsSortKey(y.key),y.sortOrder)};return t.jsxRuntimeExports.jsx(O7s,{"data-testid":_("transaction-categorization-header-container"),flexibleWidth:d,isQuickViewMode:c,windowSize:l,children:m.map((y,C)=>{const b=c||r!=null||h5e(y.key)!=null,E=Sq(y,n,i);return t.jsxRuntimeExports.jsxs(z7s,{actualDataValue:y.key,"data-testid":_("transaction-categorization-header-wrapper",y.key),flexibleWidth:d,isLastItem:C===m.length-1,isQuickViewMode:c,isSortDisabled:b,isSticky:y.isSticky===!0,sortDataValue:e.sortKey,style:c&&y.customStyle?.quickView||y.customStyle?.common,windowSize:l,widthPercentage:E,wrapperWidth:y.key==="vendor"&&!c?y?.clippedWidth??y.width:y.width,children:[t.jsxRuntimeExports.jsxs(V7s,{"data-testid":_("transaction-categorization-header",y.value?y.value:y.key),onClick:b===!0?void 0:()=>f(y),isSortDisabled:b,children:[t.jsxRuntimeExports.jsx(Q7s,{children:y.value}),b?null:t.jsxRuntimeExports.jsx(N7s,{sortConfig:e,headerData:y,"data-testid":_("transaction-categorization-sort-icon",y.key),children:t.jsxRuntimeExports.jsx(W7s,{})})]}),b?null:t.jsxRuntimeExports.jsx(H7s,{isSortDisabled:b,sortDataValue:e.sortKey,isVisible:e.sortKey===y.key&&e.sortKey!==eF.sortKey,"data-testid":_("transaction-categorization-close-icon",y.key),children:t.jsxRuntimeExports.jsx(F7s,{onClick:()=>{h(eF.sortKey,eF.sortOrder)},"data-testid":_("transaction-categorization-close-icon-button",y.key)})})]},y.key)})})},O7s=s.div`
69151
+ `,iS="monthEndReportFormSection",p5e="monthEndReportPage",ac=O.getLocalizedStrings();function m7s({companyId:e,enableZeniGPTFeature:n,monthEndReportView:i,previewMode:r,customerRequestData:a,allThreadsSectionOpen:l,filterMetaData:c,newThreadMetadata:d,isZeniUser:u,selectedPeriod:m,improveUsingZeniGPTClick:x,onRemoveFileAttachment:h,onUpdateFileAttachment:f,onCloseAllThreadsSection:y,previewMonthEndReport:C,saveMonthEndReport:b,onEditClick:E,onOpenFileAttachmentSnackBar:$,onClickCustomerRequest:R,sendMonthEndReport:S}){const k=t.useTheme(),[T,A]=g.useState(),[I,B]=g.useState(0),[L,P]=g.useState(0),D=g.useRef(),M=g.useRef(null),F=g.useRef(null),{html:V,subject:N,improveUsingZeniGPTStatus:H}=i,[W,U]=g.useState(),[Y,q]=g.useState(!1),[Z,G]=g.useState(!1),K=g.useRef(null),J=g.useRef(null),oe=zSe(l,250),ee=i.fetchState==="Not-Started"||i.fetchState==="In-Progress"||i.companyMonthEndReportTemplatesData.fetchState==="Not-Started"||i.companyMonthEndReportTemplatesData.fetchState==="In-Progress",{threadsRefs:te,sortedThreads:se,threadsPositions:ie,observer:re,unresolvedThreadsMap:ne,handleRemoveFloatingThread:me}=YSe(c,K,!r,ee,u),pe=g.useCallback(()=>{l?J.current!=null&&P(Math.min((J.current.offsetWidth-gb-p[4])/2,J.current.offsetWidth-gb-xY-p[4])):J.current!=null&&B(Math.min((J.current.offsetWidth-gb-p[4])/2,J.current.offsetWidth-gb-hY-p[4]))},[l]);g.useEffect(()=>{pe()},[l,pe]),g.useEffect(()=>(window.addEventListener("resize",pe),()=>{window.removeEventListener("resize",pe)}),[pe]);const je=u?vs:Nu,{openThread:ce,addThread:de,setOpenThread:ue}=g.useContext(je),le=qSe(gW,!1,!r),ae=K.current?.getBoundingClientRect(),ge=le!=null&&le.coords&&ae?{left:le.coords.left-ae.left,top:le.coords.top-ae.top}:void 0,ye=g.useCallback(()=>{const Ie=window.getSelection()?.getRangeAt(0),Ne=GSe();if(!Ie||Ne==null)return;const Pe={...d,...Ne,startPath:Ne.startPath.join(),endPath:Ne.endPath.join()},Qe=`${t.nanoid()}${$s}`,Je=`cockpit_${e}`;de(Qe,{type:"thread",id:Qe,roomId:Je,createdAt:new Date,comments:[],metadata:Pe,updatedAt:new Date,resolved:!1}),ue(Qe)},[de,e,d,ue]);g.useEffect(()=>{ce!=null&&l&&y()},[l,ce,y]);const he=H.fetchState==="In-Progress",Ce=t.useForm({mode:"all",defaultValues:m5e(i),values:m5e(i)}),we=Ce.handleSubmit(Ie=>{const{recipientEmailList:Ne,subject:Pe}=Ie[iS];if(r===!0)S?.(W?.id);else{const Qe=T?.replace(Xj,ac.common.strings.empty);Ne!=null&&Pe!=null&&C(Ne,Pe,W?.id,Qe!=null&&Qe.length>0?T:void 0)}}),ve=()=>{M.current!=null&&M.current.click()},Ee=()=>{W!==void 0&&W!=null&&(h([W.id]),U(void 0),q(!1))},Se=Ie=>{const Ne=Ie.target.files?Ie.target.files[0]:null;if(Ne)if(!Q.toSupportedAttachmentFileType(Ne.type)||Z)console.warn("Please select a valid file.");else{const Pe=new FileReader;Pe.onload=function(Qe){const Je=Qe.target?.result;if(typeof Je=="string"){const tt={data:Je.split(",")[1],name:Ne.name,id:Q.getAttachmentFileIdByFileName(e,Ne.name)};U(tt),q(!0),f([tt])}},Pe.readAsDataURL(Ne)}},$e=()=>{F.current&&F.current.scrollIntoView({behavior:"smooth"})},Be=()=>{const Ie=Ce.getValues(),{recipientEmailList:Ne,subject:Pe}=Ie[iS];Ne!=null&&Pe!=null&&b(Ne,Pe,W?.id,T)};g.useEffect(()=>{A(i.zeniRequestsHtml)},[i.zeniRequestsHtml]),g.useEffect(()=>{D.current=W},[W]),g.useEffect(()=>{U(Q.mapAttachmentFileToAttachmentFilePayload(i.attachmentFile)),q(!1)},[i.attachmentFile]),g.useEffect(()=>{Z&&$()},[Z,$]);const _e=Q.zeniDate(`${m.year}-${m.month}-01`).format(ac.dateFormat.visual.MMMMFormat),Te=V!=null?V.split(Bb):[],Re=i.concatenatedHtml,ke=()=>i.lastDraftSavedDate!=null&&r===!1?t.jsxRuntimeExports.jsx(WSe,{time:i.lastDraftSavedDate,user:i.reportLastSavedByUser,timeStampLabel:ac.cockpit.monthEndReport.timeStampLabel}):null,Oe=()=>u===!0?oe?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(p7s,{allThreadsSectionOpen:l,children:t.jsxRuntimeExports.jsx(EQ,{autoExpand:!0,autoFocus:!1,style:{borderLeft:`1px solid ${k.colors.grey3}`},drawerSectionStyle:{width:`calc(100% - ${o.sp5} - ${o.sp5})`,backgroundColor:k.colors.background},threadsContainerStyle:{paddingBottom:r?"160px":o.sp12},collapsibleThreadStyle:{width:`calc(100% - ${o.sp4})`},allowComposer:!1,drawerTitle:ac.common.texts.comments,filter:c,textOverrides:{},preventResolvedThreadClick:!0,onThreadClick:(Ie,Ne)=>{ue(Ne);const Pe=se.findIndex(Qe=>Qe[0]===Ne);y(),te.current?.[Pe]?.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},onCloseAllThreadsDrawer:()=>y()})}),t.jsxRuntimeExports.jsx(Jz,{availableWidth:I})]}):t.jsxRuntimeExports.jsx(KSe,{observer:re,canvasContainerRef:K,sortedThreads:se,threadsPositions:ie,threadsRefs:te,unresolvedThreadsMap:ne,editorMode:!r,style:{minWidth:`${I}px`,position:"relative",height:"fit-content",top:`${K.current?.offsetTop}px`,minHeight:o.sp12},handleRemoveFloatingThread:me}):t.jsxRuntimeExports.jsx(Jz,{availableWidth:I}),Me=(i.zeniRequestsData??[]).length+mY(i.companyMonthEndReportTemplatesData).length;return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(e7s,{ref:J,children:[t.jsxRuntimeExports.jsx(Jz,{availableWidth:l?L:I}),t.jsxRuntimeExports.jsxs(X6s,{children:[t.jsxRuntimeExports.jsx(t.FormProvider,{...Ce,children:t.jsxRuntimeExports.jsx("form",{id:x5e(p5e),onSubmit:we,children:t.jsxRuntimeExports.jsxs(c7s,{children:[t.jsxRuntimeExports.jsx(QSe,{sectionId:iS,previewMode:r,subject:N}),!r&&Me>0?t.jsxRuntimeExports.jsx(VSe,{totalItems:Me,onClickCustomerRequest:R}):null,t.jsxRuntimeExports.jsxs(n7s,{id:gW,ref:K,children:[t.jsxRuntimeExports.jsxs(s7s,{className:"monthEndReportCanvasWrapper",children:[W!=null||Z?t.jsxRuntimeExports.jsx(i7s,{"data-testid":_("email-attachment-container"),onClick:$e,children:t.jsxRuntimeExports.jsx(HSe,{fileSizeError:Z,setFileSizeError:G,loading:!1,showAnimation:!r&&Y})}):null,r?t.jsxRuntimeExports.jsx(u5e,{dangerouslySetInnerHTML:{__html:ZSe(Re)}}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(o7s,{id:WA,children:[t.jsxRuntimeExports.jsx(De,{dangerouslySetInnerHTML:{__html:Te[0]!=null?Te[0]+"</body></html>":ac.common.strings.empty}}),t.jsxRuntimeExports.jsxs(t7s,{children:[t.jsxRuntimeExports.jsx(l7s,{children:ac.cockpit.monthEndReport.editorTitle}),t.jsxRuntimeExports.jsx(a7s,{children:ac.cockpit.monthEndReport.editorNote})]})]}),t.jsxRuntimeExports.jsx(r7s,{id:r6,children:t.jsxRuntimeExports.jsx(eAe,{handleFileInputClick:ve,fileAttached:W!=null,enableZeniGPTFeature:n,isZeniGPTResponseLoading:he,initialHtmlString:i.zeniRequestsHtml,improveUsingZeniGPTClick:x,setZeniRequestsHtml:A,customerRequestData:a})}),t.jsxRuntimeExports.jsx(u5e,{id:p9,dangerouslySetInnerHTML:{__html:Te[1]!=null?"<html><body>"+Te[1]:ac.common.strings.empty}})]}),W!=null?t.jsxRuntimeExports.jsx(USe,{ref:F,fileName:W.name,fileSize:SCe(W.data),onRemove:Ee,isRemovable:!r}):null]}),ge?t.jsxRuntimeExports.jsx(FSe,{style:{zIndex:15},coords:ge,alignment:le.alignment,onClick:ye}):null,t.jsxRuntimeExports.jsx(tAe,{canvasContainerRef:K,sortedThreads:se,editorMode:!r,isZeniUser:u})]})]})})}),t.jsxRuntimeExports.jsx(yu,{name:W?.name??ac.common.strings.empty,fileRef:M,sizeLimit:J6s,acceptableTypes:K6s,onFileChange:async Ie=>{Se(Ie)},onFileSizeError:Ie=>G(Ie),multiple:!1})]}),Oe()]}),t.jsxRuntimeExports.jsx(_t,{style:{zIndex:10},leftSideComponent:ke(),formId:x5e(p5e),cancelBtn:{isDisabled:he,label:r===!0?ac.cockpit.monthEndReport.editButtonLabel:ac.cockpit.monthEndReport.saveChanges,onClick:r===!0?E:Be,style:{width:"136px",padding:`${o.sp0} ${o.sp3}`,boxSizing:"border-box"},size:"medium",isLoading:i.saveMonthEndReportStatus.fetchState==="In-Progress",reverseSpinnerColor:!1},primaryBtn:{isDisabled:he,isLoading:r===!0?i.sendMonthEndReportStatus.fetchState==="In-Progress":i.previewMonthEndReportStatus.fetchState==="In-Progress",style:{width:r===!0?"unset":"136px"},label:r===!0?ac.cockpit.monthEndReport.sendEmailButtonLabel.replace("__month__",_e):ac.cockpit.monthEndReport.preview,size:"medium"}})]})}const m5e=e=>({[iS]:{recipientEmailList:e.recipientEmailList,subject:e.subject??ac.common.strings.empty}}),x5e=e=>`${e}_form`,LPe=g.createContext(!1),BPe=LPe.Provider,MB=()=>g.useContext(LPe),x7s=p[5],Wb=44,rS=12,h7s=["memo_and_receipt","activity","paymentAccount","receipt"],h5e=e=>Q.stringToUnionStrict(e,h7s),Xz=905,g7s=1240,f7s=1440,y7s=1920;function _x(e,n,i,r){const a=n,l=Math.round(n*g7s/Xz),c=Math.round(n*f7s/Xz),d=Math.round(n*y7s/Xz),u=i??c,m=r??u;return new w(e,n,a,Math.min(l,u),Math.min(c,u),Math.min(d,m))}const{expenseAutomation:{transactions:{header:{vendors:j7s,category:C7s,classText:b7s,project:w7s,date:E7s,type:$7s,amount:R7s,toFrom:v7s,memoReceipt:S7s}}}}=O.getLocalizedStrings(),PPe={key:"vendor",value:j7s,sortOrder:"ascending",width:_x(194,194,194,194),clippedWidth:_x(186,186,186,186),singleColumnEnabledWidthPercentage:14,doubleColumnDisabledWidthPercentage:17,doubleColumnEnabledWidthPercentage:12,customStyle:{common:{paddingLeft:p[7],paddingRight:p[3]},quickView:{paddingLeft:p[9]}},isSticky:!1},A7s={key:"payment_account",value:v7s,sortOrder:"ascending",width:_x(228,228,228,228),singleColumnEnabledWidthPercentage:16,doubleColumnDisabledWidthPercentage:19,doubleColumnEnabledWidthPercentage:14,customStyle:{common:{paddingLeft:p[8],paddingRight:p[3]}}},k7s={key:"category",value:C7s,sortOrder:"ascending",width:_x(228,228,228,228),singleColumnEnabledWidthPercentage:16,doubleColumnDisabledWidthPercentage:19,doubleColumnEnabledWidthPercentage:14,customStyle:{common:{paddingLeft:p[8],paddingRight:p[3]}}},I7s={key:"class",value:b7s,sortOrder:"ascending",width:_x(228,228,228,228),singleColumnEnabledWidthPercentage:16,doubleColumnEnabledWidthPercentage:14,customStyle:{common:{paddingLeft:p[8],paddingRight:p[3]}}},T7s={key:"project",value:w7s,sortOrder:"ascending",width:_x(228,228,228,228),singleColumnEnabledWidthPercentage:16,doubleColumnEnabledWidthPercentage:14,customStyle:{common:{paddingLeft:p[8],paddingRight:p[3]}}},L7s={key:"date",value:E7s,sortOrder:"descending",width:_x(116,116,116,116),singleColumnEnabledWidthPercentage:9,doubleColumnDisabledWidthPercentage:11,doubleColumnEnabledWidthPercentage:7,customStyle:{common:{paddingLeft:p[3],paddingRight:p[3]}}},B7s={key:"transaction_type",value:$7s,sortOrder:"descending",width:_x(165,165,165,165),singleColumnEnabledWidthPercentage:9,doubleColumnDisabledWidthPercentage:11,doubleColumnEnabledWidthPercentage:10,customStyle:{common:{paddingLeft:p[3],paddingRight:p[3]}}},P7s={key:"memo_and_receipt",value:S7s,sortOrder:"ascending",width:_x(136,136,136,136),singleColumnEnabledWidthPercentage:9,doubleColumnDisabledWidthPercentage:10,doubleColumnEnabledWidthPercentage:8,customStyle:{common:{paddingLeft:p[3],justifyContent:"center",display:"flex",alignItems:"center",paddingRight:p[3]}}},MPe={key:"amount",value:R7s,sortOrder:"ascending",width:_x(128,128,128,128),singleColumnEnabledWidthPercentage:11,doubleColumnDisabledWidthPercentage:13,doubleColumnEnabledWidthPercentage:7,customStyle:{common:{paddingRight:p[4],justifyContent:"flex-end",display:"flex",alignItems:"center",paddingLeft:p[3]}}},vq=(e=!0,n=!1)=>[PPe,A7s,k7s,...e?[I7s]:[],...n?[T7s]:[],L7s,B7s,P7s,MPe],Sq=(e,n,i)=>{const r=(n?1:0)+(i?1:0);return r===0?e.doubleColumnDisabledWidthPercentage??e.singleColumnEnabledWidthPercentage:r===2?e.doubleColumnEnabledWidthPercentage??e.singleColumnEnabledWidthPercentage:e.singleColumnEnabledWidthPercentage},Aq=[{...PPe,width:new w(60,60),singleColumnEnabledWidthPercentage:60,doubleColumnDisabledWidthPercentage:60,doubleColumnEnabledWidthPercentage:60,customStyle:{common:{paddingLeft:p[9],paddingRight:p[3]}}},{...MPe,width:new w(40,40),singleColumnEnabledWidthPercentage:40,doubleColumnDisabledWidthPercentage:40,doubleColumnEnabledWidthPercentage:40}],eF={sortKey:"date",sortOrder:"descending"},M7s=1195,D7s=228,_7s=228,DPe=(e=!0,n=!1)=>{let i=M7s;return e&&(i+=D7s),n&&(i+=_7s),new w(i,i,i,i,i,i)},_Pe=({sortConfig:e,isAccountingClassesEnabled:n,showProjectField:i,isDisabled:r,onColumnSortConfigChanged:a})=>{const l=X(),c=mr(),d=MB(),u=g.useMemo(()=>c?Aq:vq(n,i),[c,n,i]),[m,x]=g.useState(()=>t.cloneDeep(u));g.useEffect(()=>{const y=t.cloneDeep(u);for(const C of y)C.key===e.sortKey?C.sortOrder=e.sortOrder:C.sortOrder="ascending";x(y)},[u,e.sortKey,e.sortOrder]);const h=(y,C)=>{let b=C;e.sortKey===y&&(b=C==="ascending"?"descending":"ascending"),a(y,b)},f=y=>{h5e(y.key)==null&&h(Q.toTransactionsSortKey(y.key),y.sortOrder)};return t.jsxRuntimeExports.jsx(O7s,{"data-testid":_("transaction-categorization-header-container"),flexibleWidth:d,isQuickViewMode:c,windowSize:l,children:m.map((y,C)=>{const b=c||r!=null||h5e(y.key)!=null,E=Sq(y,n,i);return t.jsxRuntimeExports.jsxs(z7s,{actualDataValue:y.key,"data-testid":_("transaction-categorization-header-wrapper",y.key),flexibleWidth:d,isLastItem:C===m.length-1,isQuickViewMode:c,isSortDisabled:b,isSticky:y.isSticky===!0,sortDataValue:e.sortKey,style:c&&y.customStyle?.quickView||y.customStyle?.common,windowSize:l,widthPercentage:E,wrapperWidth:y.key==="vendor"&&!c?y?.clippedWidth??y.width:y.width,children:[t.jsxRuntimeExports.jsxs(V7s,{"data-testid":_("transaction-categorization-header",y.value?y.value:y.key),onClick:b===!0?void 0:()=>f(y),isSortDisabled:b,children:[t.jsxRuntimeExports.jsx(Q7s,{children:y.value}),b?null:t.jsxRuntimeExports.jsx(N7s,{sortConfig:e,headerData:y,"data-testid":_("transaction-categorization-sort-icon",y.key),children:t.jsxRuntimeExports.jsx(W7s,{})})]}),b?null:t.jsxRuntimeExports.jsx(H7s,{isSortDisabled:b,sortDataValue:e.sortKey,isVisible:e.sortKey===y.key&&e.sortKey!==eF.sortKey,"data-testid":_("transaction-categorization-close-icon",y.key),children:t.jsxRuntimeExports.jsx(F7s,{onClick:()=>{h(eF.sortKey,eF.sortOrder)},"data-testid":_("transaction-categorization-close-icon-button",y.key)})})]},y.key)})})},O7s=s.div`
69152
69152
  top: ${o.sp0};
69153
69153
  left: ${o.sp0};
69154
69154
  height: ${x7s}px;
@@ -69241,7 +69241,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
69241
69241
  }
69242
69242
  `,Q7s=s(it)`
69243
69243
  display: flex;
69244
- `,tF="expenseAutomationTransactionsPage",K3="transactionCategorizationListTable",Ui="account",yc="class",$j="project",pp="lineEntitySelection",U7s="lineEntity",G7s="recommendations",OPe="lineInfo",Y7s="vendorDetails",q7s="customerDetails",aS="selectedTransactionIds",Qm=(e,n,i)=>`${e}.${i}.${n}`,Z7s=e=>j.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M4.85022 13.5836L5.52057 12.9133C5.63229 12.8016 5.77164 12.7217 5.92438 12.6815C6.07712 12.6413 6.23779 12.6424 6.38999 12.6846C6.54218 12.7268 6.68046 12.8086 6.7907 12.9217C6.90094 13.0348 6.97919 13.1751 7.01747 13.3283L7.08174 13.5836L7.8119 13.0972C7.98361 12.9827 8.1897 12.9312 8.39508 12.9515C8.60046 12.9719 8.79245 13.0628 8.93837 13.2087L9.31326 13.5836H11.0985",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M17.4206 6H2.24629C2.12792 6 2.01441 6.04702 1.93071 6.13072C1.84701 6.21442 1.79999 6.32794 1.79999 6.4463V17.1576C1.79999 17.276 1.84701 17.3895 1.93071 17.4732C2.01441 17.5569 2.12792 17.6039 2.24629 17.6039H21.8837C22.0021 17.6039 22.1156 17.5569 22.1993 17.4732C22.283 17.3895 22.33 17.276 22.33 17.1576V6.4463C22.33 6.32794 22.283 6.21442 22.1993 6.13072C22.1156 6.04702 22.0021 6 21.8837 6H17.4206Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M16.0854 9.6521H19.6559V12.0656H16.0854V9.6521Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),K7s=e=>j.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M20.25 19.5H6.75C6.55109 19.5 6.36032 19.421 6.21967 19.2803C6.07902 19.1397 6 18.9489 6 18.75V2.25C6 2.05109 6.07902 1.86032 6.21967 1.71967C6.36032 1.57902 6.55109 1.5 6.75 1.5H15.75L21 6.75V18.75C21 18.9489 20.921 19.1397 20.7803 19.2803C20.6397 19.421 20.4489 19.5 20.25 19.5Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M15.75 1.5V6.75H21",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M10.4941 11.2559H16.4941",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M10.4941 14.2559H16.4941",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M16.5 22.5H3V5.85315",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),{common:{strings:{underscore:J7s,hyphen:Um,empty:Ng,colon:g5e},tooltips:{addReceipt:X7s,viewReceipt:ebs,viewReceipts:tbs}},expenseAutomation:{transactions:Kc},dateFormat:obs}=O.getLocalizedStrings(),vu={containerPaddingLeftRight:new w(p[3],p[3]),containerPaddingTopBottom:new w(6,6),controlHeight:new w(p[4],p[5]),nameLogoWidth:new w(p[2],p[3]),nameLogoHeight:new w(p[2],p[3]),borderRadius:6},f5e=({windowSize:e,wrapperWidth:n,widthPercentage:i})=>t.jsxRuntimeExports.jsxs(fa,{windowSize:e,wrapperWidth:n,widthPercentage:i,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(Fk,{children:t.jsxRuntimeExports.jsx("span",{})}),t.jsxRuntimeExports.jsx(fb,{children:t.jsxRuntimeExports.jsx(fe,{width:"100%",height:p[4]})})]}),nbs=(e,n)=>e==="journal_entry"&&n==="credit",sbs=({transactionView:e,transaction:n,sectionId:i,vendorSearchAutoCompleteData:r,vendorSearchAutoCompleteActions:a,selectedTab:l,containerRef:c,listContainerRef:d,isAccountingClassesEnabled:u,showProjectField:m,isCOTEnabled:x,isCreateTransferEntryFromExpenseEnabled:h,isPanelSelected:f,cotTracking:y,onTransactionCategorizationRowClick:C,setCurrentTransactionInAction:b,vendorLoadOptions:E,openTooltipId:$,setOpenTooltipId:R,isUncategorizedExpenseCategoryEnabled:S,onOpenTransferDrawer:k,authParams:T,onUploadTransactionReceipt:A,rowCommenting:I})=>{const B=X(),L=mr(),P=MB(),{isCommentingActive:D,rowRef:M,totalThreadCount:F,isThreadsLoading:V,handleActiveThreadClick:N,handleAddRowCommentClick:H}=I,[W,U]=g.useState(!1),{lineItemById:Y,sortedLineItems:q}=n.transactionReviewLocalData,Z=n.transactionReviewLocalData.tabSpecificLineItems?.[l]||[],G=q.filter(Ee=>Z.indexOf(Ee)!==-1),K=[];G.forEach(Ee=>{K.push(Y[Ee])});const{accountList:J,accountsHierarchyList:oe,classHierarchyList:ee,classList:te,projectList:se,uncategorizedAccounts:ie,transactions:re,selectedCheckBoxTransactionIds:ne}=e,me=se?.projects??[],pe=e.uploadReceiptStatusById,je=ne.includes(n.transactionId),ce=L!==!0&&je===!0,de=t.useTheme(),ue={control:()=>({marginLeft:-2,backgroundColor:W?de.colors.background:de.colors.grey5,minHeight:p[5]}),valueContainer:()=>({justifyContent:"flex-start",paddingLeft:p[0],height:p[5],backgroundColor:de.colors.grey5}),menu:()=>({width:"150%",background:de.colors.grey5}),singleValue:()=>({color:W||ce?de.colors.primary:de.colors.champion,paddingLeft:p[2]}),input:Ee=>({...Ee,color:W||ce?de.colors.primary:de.colors.champion,textAlign:"left",paddingLeft:p[2]}),menuPortal:Ee=>({...Ee,zIndex:10})},le={...ue,singleValue:Ee=>({...Ee,color:W||ce?de.colors.primary:de.colors.champion}),menu:()=>({marginTop:p[1],marginLeft:-p[2]}),input:Ee=>({...Ee,color:W||ce?de.colors.primary:de.colors.champion,textAlign:"left",...z.standardMedium}),control:Ee=>({...Ee,height:p[5]})},ae=re.find(Ee=>Ee.id===n.transactionId),ge=(Ee,Se)=>{const{transactionType:$e}=Se.transactionReviewLocalData;let Ae=Ee.target;for(;Ae;){if(Ae.classList.contains("select-value-container")||Ae.classList.contains("item-value-container")||Ae.classList.contains("grouped-single-select-field__value-container")||Ae.classList.contains("auto-complete-grouped-creatable-single-custom-group-select-field__option")||Ae.classList.contains("grouped-single-select-field__input")||Ae.classList.contains("grouped-single-select-field__menu"))return;Ae=Ae.parentElement}$e!=null&&C(Se.transactionId,$e)},ye=g.useRef(null),[he,Ce]=g.useState(void 0),[we,ve]=g.useState("bottom");return g.useEffect(()=>{if(he===void 0)return;const Se=d?.current?._outerRef??null,$e=()=>{const Be=ye.current;if(Be==null||Se==null)return;const Ae=Be.getBoundingClientRect(),_e=Se.getBoundingClientRect(),Te=Se.scrollTop+(Ae.bottom-_e.top),Re=Se.scrollHeight-Te;ve(Re>=288?"bottom":"top")};return $e(),window.addEventListener("resize",$e),Se?.addEventListener("scroll",$e),()=>{window.removeEventListener("resize",$e),Se?.removeEventListener("scroll",$e)}},[d,he]),t.jsxRuntimeExports.jsx(rbs,{ref:M,onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1),children:t.jsxRuntimeExports.jsxs(lbs,{className:"categorization-row-card",windowSize:B,isSelected:je,isPanelSelected:f,isQuickViewMode:L,isHovered:W,style:{position:"relative"},children:[t.jsxRuntimeExports.jsx(cbs,{windowSize:B,isQuickViewMode:L,children:K.map((Ee,Se)=>t.jsxRuntimeExports.jsx(dbs,{ref:he===Se?ye:void 0,isFirstItem:Se===0,isLastItem:Se===K.length-1,"data-testid":_("transaction-categorization-list-row",Ee.lineId),flexibleWidth:P,isQuickViewMode:L,windowSize:B,onClick:$e=>ge($e,n),children:t.jsxRuntimeExports.jsx(ibs,{isAccountingClassesEnabled:u,showProjectField:m,allProjectList:me,line:Ee,isHovered:W||ce||f,isSelected:je,isQuickViewMode:L,lineIndex:Se,sectionId:i,transaction:n,currentTransaction:ae,windowSize:B,accountsHierarchyList:oe,classHierarchyList:ee,allAccountList:J,allClassList:te,uncategorizedAccounts:ie,vendorSearchAutoCompleteData:r,vendorSearchAutoCompleteActions:a,setCurrentTransactionInAction:b,vendorLoadOptions:E,customStyle:ue,customStyleAutoComplete:le,recommendations:Ee.recommendationsWithCOT,selectedTab:l,isCOTEnabled:x,menuPlacement:we,cotTracking:y,openTooltipId:$,setOpenTooltipId:R,isUncategorizedExpenseCategoryEnabled:S,authParams:T,uploadReceiptStatus:pe?.[n.transactionId],onUploadTransactionReceipt:A,onDropdownClose:()=>Ce(void 0),onDropdownOpen:()=>Ce(Se),onOpenTransferDrawer:k,isCreateTransferEntryFromExpenseEnabled:h})},`${n.transactionId}.${Ee.lineId}.${Se}`))},n.transactionId),L===!0&&D&&F>0?t.jsxRuntimeExports.jsx(ia,{flushRight:!0,children:t.jsxRuntimeExports.jsx(ra,{isLoading:V,count:F,style:{backgroundColor:de.colors.grey4,borderRadius:"50% 50% 50% 0",cursor:"pointer"},openThread:N})}):null,L===!0&&D&&V===!1&&F===0?t.jsxRuntimeExports.jsx(ia,{flushRight:!0,innerClassName:"comment-add-icon",children:t.jsxRuntimeExports.jsx(m4,{"data-testid":_("expense-automation-transaction-row-add-comment",n.transactionId),onClick:H})}):null,t.jsxRuntimeExports.jsx(p6,{state:I})]},n.transactionId)})},ibs=({accountsHierarchyList:e,allAccountList:n,allClassList:i,allProjectList:r,showProjectField:a,classHierarchyList:l,customStyle:c,customStyleAutoComplete:d,line:u,lineIndex:m,transaction:x,currentTransaction:h,windowSize:f,uncategorizedAccounts:y,isHovered:C=!1,isQuickViewMode:b=!1,sectionId:E,recommendations:$,vendorSearchAutoCompleteData:R,selectedTab:S,isCOTEnabled:k,menuPlacement:T,cotTracking:A,openTooltipId:I,setCurrentTransactionInAction:B,vendorLoadOptions:L,setOpenTooltipId:P,isUncategorizedExpenseCategoryEnabled:D,isAccountingClassesEnabled:M,isCreateTransferEntryFromExpenseEnabled:F,onDropdownClose:V,onDropdownOpen:N,authParams:H,onOpenTransferDrawer:W,uploadReceiptStatus:U,onUploadTransactionReceipt:Y})=>{const{transactionDate:q,transactionType:Z,transactionTypeName:G,memo:K}=x.transactionReviewLocalData,[J,oe]=g.useState(!1),ee=g.useMemo(()=>typeof document<"u"?document.body:null,[]),te=g.useMemo(()=>({...c,control:()=>({height:0,minHeight:0,overflow:"hidden",border:"none",padding:0,margin:0}),menuPortal:Ct=>({...Ct,zIndex:wG})}),[c]),se=h?.account?.accountType,ie=x.transactionReviewLocalData.sortedLineItems.length>1,re=F===!0&&RA(se)&&!ie,ne=F===!0&&RA(se)&&ie,me=h?.accountIntegrationId,pe=Qm(E,"transactionType",m.toString()),{setValue:je,watch:ce}=t.useFormContext(),de=ce(pe),ue=g.useRef(de?.selectedOption);g.useEffect(()=>{const Ct=de?.selectedOption,Ot=Ct==="transfer"||Ct==="credit_card_payment",Yo=ue.current==="transfer"||ue.current==="credit_card_payment";if(ue.current=Ct,Ot&&!Yo&&W!=null){oe(!1);const Mt=x.transactionReviewLocalData,fo=Mt.sortedLineItems.map(ot=>Mt.lineItemById[ot]).find(ot=>ot!=null);fo!=null&&(W({transactionId:x.transactionId,transactionType:Ct,sourceTransactionType:Z??"expense",payee:Mt.vendorDetails?.name??Mt.vendor?.name??"",category:fo.account?.accountName??"",className:fo.class?.className??"",amount:fo.amount,debitAccountIntegrationId:me??"",debitAccountName:h?.account?.accountName??"",memo:Mt.memo??""}),je(pe,Nj(Z??"expense",se)))}},[de?.selectedOption,W,je,Z,pe,x.transactionId,x.transactionReviewLocalData,h,me,se]);const le=g.useCallback((Ct,Ot)=>{A?.onCOTView!=null&&A.onCOTView(u.lineId,x.transactionId,Ct,Ot)},[A,u.lineId,x.transactionId]),ae=u.lineDescription,ge=g.useMemo(()=>{if(ae||K)return[{title:Kc.description,description:ae||Um},{title:Kc.header.memo,description:K||Um}]},[K,ae]),ye=Qm(E,pp,m.toString()),he=Qm(E,Ui,m.toString()),Ce=Qm(E,yc,m.toString()),we=Qm(E,$j,m.toString()),ve=(Ct,Ot)=>{if(b)return;let Yo;switch(Ot){case"vendor":Yo=ye;break;case"category":Yo=he;break;case"class":Yo=Ce;break;default:return}je(`${Yo}.selectedOption`,Ct,{shouldValidate:!0,shouldDirty:!0})},Ee=t.useTheme(),Se=g.useMemo(()=>h!=null&&Q.isVendorTransaction(h)===!0?{id:x.transactionReviewLocalData.customer?.id??"",logo:x.transactionReviewLocalData.customer?.logo,name:x.transactionReviewLocalData.customer?.name??""}:{id:u.customer?.id??"",logo:u.customer?.logo,name:u.customer?.name??""},[h,u.customer?.id,u.customer?.logo,u.customer?.name,x.transactionReviewLocalData.customer?.id,x.transactionReviewLocalData.customer?.logo,x.transactionReviewLocalData.customer?.name]),$e=g.useMemo(()=>h!=null&&Q.isVendorTransaction(h)===!0?{id:x.transactionReviewLocalData.vendor?.id??"",logo:x.transactionReviewLocalData.vendor?.logo,name:x.transactionReviewLocalData.vendor?.name??""}:{id:u.vendor?.id??"",logo:u.vendor?.logo,name:u.vendor?.name??""},[h,u.vendor?.id,u.vendor?.logo,u.vendor?.name,x.transactionReviewLocalData.vendor?.id,x.transactionReviewLocalData.vendor?.logo,x.transactionReviewLocalData.vendor?.name]),Be=u[yc]?.classId,Ae=u[yc]?.className,_e=u.project?.projectId,Te=u.project?.projectName,Re=u[Ui]?.qboId??u[Ui]?.accountId,ke=u[Ui]?.accountName,Oe=Se?.id,Me=$e?.id,Ie=$e?.name,[Ne,Pe]=g.useState(!Be),[Ue,Je]=g.useState(!_e),[tt,Qe]=g.useState(!Re||u[Ui]?.qboId!=null&&Q.isAccountUncategorized(y,u[Ui].qboId,D===!0?["income"]:void 0)===!0),[dt,ct]=g.useState(!Me||!Oe),yt=Ct=>$?.find(Yo=>Yo.vendor?.qboId===Ct||Yo.vendor?.id===Ct||Yo.vendor?.name===Ct)?.vendor?.reason??"",He=x.transactionReviewLocalData.lineItemById[u.lineId]?.recommendationsWithCOT||[],jt=N9(e,He),St=H9(l,He),We=PC(r),nt=Ct=>n.filter(Yo=>Yo.qboId===Ct)[0]?.qboId,ut=Ct=>i.filter(Yo=>Yo.classId===Ct)[0]?.accountingClassNumber??void 0,pt=g.useCallback(Ct=>Q.isAccountUncategorized(y,Ct,D===!0?["income"]:void 0),[y,D]),[Bt,Ht]=g.useState(!1),[$o,Tt]=g.useState(!1),[Gt,so]=g.useState(!1),[no,Xe]=g.useState(!1),[ft,oo]=g.useState(0),[on,To]=g.useState(null),[kn,Dn]=g.useState([]),[qt,dn]=g.useState(void 0),Zs=g.useRef(null),[Yn,Hs]=g.useState(0),[yn,Go]=g.useState(0),ds=UV()?.url,[In,ts]=g.useState(!1),pn=(Ct,Ot)=>{B({transactionId:x.transactionId,lineItemId:u.lineId}),L(Ct,Ot)},_s=()=>{ct(!(Me||Oe)),Ht(!1),V?.()},us=()=>{Re&&u[Ui]?.qboId!=null&&Q.isAccountUncategorized(y,u[Ui].qboId,D===!0?["income"]:void 0)===!1?Qe(!1):Qe(!0),ts(!1),V?.()},js=()=>{Pe(!Be),Tt(!1),V?.()},xn=()=>{Je(!_e),so(!1),V?.()},As=()=>{b||(Me||Oe)&&(Ht(!0),N?.())},nn=()=>{b||(Tt(!0),N?.())},os=()=>{b||(so(!0),N?.())},qe=()=>{b||(ts(!0),N?.())};g.useEffect(()=>{Re&&u[Ui]?.qboId!=null&&Q.isAccountUncategorized(y,u[Ui].qboId,D===!0?["income"]:void 0)===!1?Qe(!1):Qe(!0)},[Re]),g.useEffect(()=>{Pe(!Be)},[Be]),g.useEffect(()=>{Je(!_e)},[_e]),g.useEffect(()=>{ct(!(Me||Oe))},[Me,Oe]);const xt=x.transactionReviewLocalData.selectedEntity,Wt=x.transactionReviewLocalData.lineItemById[u.lineId].selectedEntityLine,Ze=h!=null&&Q.isVendorTransaction(h)===!0?xt:Wt,Mo=g.useMemo(()=>{const Ct=x.transactionReviewLocalData.lineItemById[u.lineId]?.recommendationsWithCOT||[],Ot=R.entityAutoCompleteView;return{selectedOption:Ze?.qboId??Ze?.id,defaultOptions:K5(Ot,Ze,Ct??[])}},[Ze,x.transactionReviewLocalData.lineItemById,u.lineId,R.entityAutoCompleteView]),Lo=()=>Ze!=null&&Ze.logo!=null?t.jsxRuntimeExports.jsx(Cu,{photoUrl:Ze.logo.toString(),styles:{width:vu.nameLogoWidth.valuePx(f),height:vu.nameLogoHeight.valuePx(f)},fallbackAvatar:t.jsxRuntimeExports.jsx(j5e,{children:t.jsxRuntimeExports.jsx(Jo,{name:Ze.name})})}):Ze!=null&&Ze.name!=null?t.jsxRuntimeExports.jsx(j5e,{children:t.jsxRuntimeExports.jsx(Jo,{name:Ze.name})}):null,_n=(Ct,Ot,Yo)=>{if(Ot==null||!Ot)return;let Mt=[];return Ct.forEach(fo=>{Mt=Mt.concat(fo.options)}),Mt.find(fo=>fo.value===Ot)?.label??Yo??Ot},ns=_n(St,Be,Ae),Vt=_n(We,_e,Te),en=_n(jt,Re,ke),On=S==="review",$t=y2("vendor",Mo.defaultOptions,Mo.selectedOption),bo=y2("category",jt,Re),mt=y2("class",St,Be),Qt=Ct=>{const{isLineRecommendationsLoading:Ot,itemsData:Yo,key:Mt,resolvedWidthPercentage:fo}=Ct;if(Ot===!0)return t.jsxRuntimeExports.jsx(f5e,{windowSize:f,wrapperWidth:Yo.width,widthPercentage:fo},Mt);const ot=h?.lines!=null?h.lines[m]:void 0;return t.jsxRuntimeExports.jsxs(fa,{windowSize:f,wrapperWidth:Yo.width,widthPercentage:fo,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(oF,{isCOTEnabled:k,recommendations:He,type:"category",isReviewTab:On,isEnabled:!!u[Ui]?.isPreFilled,isAccountOptionDisabled:pt,isMisCategorized:bo,onRecommendationClick:ve,selectedValue:Re,selectedValueLabel:en,existingOption:{label:ot?.account?.accountName,value:ot?.account?.qboId??ot?.account?.accountId},cotTracking:A,lineId:u.lineId,transactionId:x.transactionId,openTooltipId:I,setOpenTooltipId:P}),t.jsxRuntimeExports.jsx(fb,{children:tt===!0?t.jsxRuntimeExports.jsx(fR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(gR,{onClick:Lt=>{Lt.stopPropagation(),!b&&(N?.(),Qe(!1),ts(!0))},"data-testid":_("category-selection-field",he),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[Kc.addCategory,t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})}):In===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:us,children:t.jsxRuntimeExports.jsx(nF,{isHovered:C,"data-testid":_("category-selection-dropdown-container",he),children:t.jsxRuntimeExports.jsx(Ll,{name:he,placeholder:Kc.addCategory,valueToId:Lt=>nt(Lt),type:"category",pageSource:"list_page",transactionStatus:On?"pending_review":"auto_categorized",showCOT:k,defaultValue:{selectedOption:Re,selectedOptionLabel:ke,allOptions:jt},style:{display:"flex",flexGrow:1,width:"100%",cursor:"inherit"},registerOptions:{required:!1},menuIsOpen:In,autoFocus:!tt&&(!Re||u[Ui]?.qboId!=null&&[y.expense?.qboId,y.income?.qboId].includes(u[Ui].qboId)),onMenuClose:us,customStyleConfig:c,disableCurrentOption:pt,menuPlacement:T,menuPortal:document.body,onCOTView:le})})}):t.jsxRuntimeExports.jsx(yR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(sF,{onClick:qe,"data-testid":_("category-label-text",he),children:[t.jsxRuntimeExports.jsx(Xn,{text:en??"",itemTextStyle:{color:C?Ee.colors.primary:Ee.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})})})]},Mt)},wt=u!=null&&u.categoryClassRecommendationsFetchState?.fetchState==="In-Progress",Kt=()=>{const Ct=b?Aq:vq(M,a);return Ct.map((Ot,Yo)=>{const Mt=`${x.transactionId}_${Ot.key}_${u.lineId}`,fo=Sq(Ot,M,a);if(m>0&&h!=null&&Q.isVendorTransaction(h)===!0&&Ot.key==="vendor")return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,isQuickViewMode:b,isSticky:Ot.isSticky===!0},Mt);if(m>0&&(Ot.key==="transaction_type"||Ot.key==="memo_and_receipt"||Ot.key==="payment_account"&&Z!=="journal_entry"))return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,isQuickViewMode:b},Mt);switch(Ot.key){case"activity":return t.jsxRuntimeExports.jsx(FPe,{},Mt);case"vendor":default:return t.jsxRuntimeExports.jsxs(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,isQuickViewMode:b,isSticky:Ot.isSticky===!0,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(oF,{isCOTEnabled:k,recommendations:He,type:"vendor",isEnabled:!!Ze?.isPreFilled,isMisCategorized:$t,onRecommendationClick:ve,selectedValue:Me,selectedValueLabel:Ie,isReviewTab:On,isAccountOptionDisabled:pt,existingOption:{label:h!=null&&Q.isVendorTransaction(h)===!0?h?.vendor?.name:void 0,value:h!=null&&Q.isVendorTransaction(h)===!0?h?.vendor?.id:void 0},cotTracking:A,lineId:u.lineId,transactionId:x.transactionId,openTooltipId:I,setOpenTooltipId:P}),t.jsxRuntimeExports.jsx(fb,{children:dt===!0?t.jsxRuntimeExports.jsx(fR,{isHovered:C,isQuickViewMode:b,children:t.jsxRuntimeExports.jsxs(gR,{onClick:ot=>{ot.stopPropagation(),!b&&(N?.(),ct(!1),Ht(!0))},"data-testid":_("add-vendor-button",E),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[Kc.addPayee,b===!1&&t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})}):Bt===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:_s,children:t.jsxRuntimeExports.jsx(vbs,{"data-testid":_("vendor-selection-dropdown-container",Qm(E,pp,m.toString())),children:t.jsxRuntimeExports.jsx(TG,{name:ye,placeholder:Kc.addPayee,valueToInfo:yt,defaultValue:{selectedOption:Mo.selectedOption,selectedOptionLabel:Ie,defaultOptions:Mo.defaultOptions},type:"vendor",autoFocus:!dt,style:{width:"100%"},pageSource:"list_page",transactionStatus:On?"pending_review":"auto_categorized",isOptionRemovable:!1,customStyleConfig:d,menuIsOpen:Bt,onMenuClose:_s,registerOptions:{required:!1},loadOptions:pn,showCOT:k,onCOTView:le,menuPlacement:T,menuPortal:document.body})})}):t.jsxRuntimeExports.jsx(Ibs,{children:t.jsxRuntimeExports.jsxs(yR,{isHovered:C,isQuickViewMode:b,children:[Lo(),t.jsxRuntimeExports.jsxs(Rbs,{onClick:As,"data-testid":_("vendor-name-text",E),children:[Ze!=null&&Ze.name?t.jsxRuntimeExports.jsx(Xn,{text:Ze.name,itemTextStyle:{color:C?Ee.colors.primary:Ee.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}):t.jsxRuntimeExports.jsx(kbs,{children:Um}),b===!1&&t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})]})})})]},Mt);case"category":return nbs(Z,u.postingType)?t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,style:{paddingLeft:o.sp6},isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsx(D7,{style:{textAlign:"left",width:"100%"},children:Um})})},Mt):Qt({isLineRecommendationsLoading:wt,itemsData:Ot,key:Mt,resolvedWidthPercentage:fo});case"class":{if(!M)return null;if(wt===!0)return t.jsxRuntimeExports.jsx(f5e,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo},Mt);const ot=h?.lines!=null?h?.lines[m]:void 0;return t.jsxRuntimeExports.jsxs(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(oF,{isCOTEnabled:k,recommendations:He,type:"class",isReviewTab:On,isEnabled:!!u[yc]?.isPreFilled,isAccountOptionDisabled:pt,isMisCategorized:mt,onRecommendationClick:ve,selectedValue:Be,selectedValueLabel:ns,existingOption:{label:ot?.class?.className,value:ot?.class?.classId},cotTracking:A,lineId:u.lineId,transactionId:x.transactionId,openTooltipId:I,setOpenTooltipId:P}),t.jsxRuntimeExports.jsx(fb,{children:Ne===!0?t.jsxRuntimeExports.jsx(fR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(gR,{onClick:Lt=>{Lt.stopPropagation(),!b&&(N?.(),Pe(!1),Tt(!0))},"data-testid":_("class-selection-field",Ce),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[Kc.addClass,t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})}):$o===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:js,children:t.jsxRuntimeExports.jsx(nF,{isHovered:C,"data-testid":_("class-selection-dropdown-container",Ce),children:t.jsxRuntimeExports.jsx(Ll,{name:Ce,placeholder:Kc.addClass,valueToId:Lt=>ut(Lt),type:"class",showCOT:k,defaultValue:{selectedOption:Be,selectedOptionLabel:Ae,allOptions:St},pageSource:"list_page",transactionStatus:On?"pending_review":"auto_categorized",menuIsOpen:$o,registerOptions:{required:!1},style:{width:"100%"},autoFocus:!Ne&&!Be,customStyleConfig:c,onMenuClose:js,menuPlacement:T,menuPortal:document.body,onCOTView:le})})}):t.jsxRuntimeExports.jsx(yR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(sF,{"data-testid":_("class-selection-field",Ce),onClick:nn,children:[t.jsxRuntimeExports.jsx(Xn,{text:ns??"",itemTextStyle:{color:C?Ee.colors.primary:Ee.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})})})]},Mt)}case"project":return a?t.jsxRuntimeExports.jsxs(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(Fk,{children:t.jsxRuntimeExports.jsx("span",{})}),t.jsxRuntimeExports.jsx(fb,{children:Ue===!0?t.jsxRuntimeExports.jsx(fR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(gR,{onClick:ot=>{ot.stopPropagation(),!b&&(N?.(),Je(!1),so(!0))},"data-testid":_("project-selection-field",we),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[Kc.addProject,t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})}):Gt===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:xn,children:t.jsxRuntimeExports.jsx(nF,{isHovered:C,"data-testid":_("project-selection-dropdown-container",we),children:t.jsxRuntimeExports.jsx(Ll,{name:we,placeholder:Kc.addProject,type:"project",showCOT:!1,defaultValue:{selectedOption:_e,selectedOptionLabel:Te,allOptions:We},pageSource:"list_page",transactionStatus:On?"pending_review":"auto_categorized",menuIsOpen:Gt,registerOptions:{required:!1},style:{width:"100%"},autoFocus:!Ue&&!_e,customStyleConfig:c,onMenuClose:xn,menuPlacement:T,menuPortal:document.body})})}):t.jsxRuntimeExports.jsx(yR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(sF,{"data-testid":_("project-selection-field",we),onClick:os,children:[t.jsxRuntimeExports.jsx(Xn,{text:Vt??"",itemTextStyle:{color:C?Ee.colors.primary:Ee.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})})})]},Mt):null;case"date":return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsx(jV,{"data-testid":_("date-field",Qm(E,yc,m.toString())),children:t.jsxRuntimeExports.jsx(D7,{style:{color:C?Ee.colors.primary:Ee.colors.champion},children:q!=null?q.format(obs.visual.MMMDCommaYYYYformat):null})})})},Mt);case"transaction_type":{const ot=Z==="expense"||Z==="check";return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:G!=null?t.jsxRuntimeExports.jsx(Bh,{windowSize:f,"data-testid":_("transaction-type-field",Qm(E,yc,m.toString())),isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsxs(Abs,{className:ot&&re?"select-value-container":void 0,children:[ot&&ne?t.jsxRuntimeExports.jsx(Le,{title:Kc.transactionTypeDropdown.multilineNotEligibleTooltip,enterDelay:600,placement:"bottom",children:t.jsxRuntimeExports.jsx(ao,{label:G??Z})}):t.jsxRuntimeExports.jsx(ao,{label:G??Z,onClick:ot&&re?()=>{je(pe,Nj(Z??"expense",se)),oe(!0)}:void 0,capsuleBackground:re&&J?Ee.colors.background:void 0,showChevron:ot&&re}),ot&&re&&J&&t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>oe(!1),children:t.jsxRuntimeExports.jsx(Sbs,{children:t.jsxRuntimeExports.jsx(Ll,{name:pe,defaultValue:Nj(Z??"expense",se),pageSource:"list_page",showCOT:!1,transactionStatus:On?"pending_review":"auto_categorized",type:"category",menuIsOpen:J,autoFocus:!0,onMenuClose:()=>oe(!1),customStyleConfig:te,menuPlacement:T,menuPortal:ee,allowEmpty:!1,menuOptionPresentation:"typePill"})})})]})}):null},Mt)}case"amount":{const ot=Fe("0,0.[00]",u.amount,!0);return t.jsxRuntimeExports.jsx(fa,{windowSize:f,style:{marginRight:p[0]},wrapperWidth:Ot.width,widthPercentage:fo,isQuickViewMode:b,isLastItem:!0,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,isLastItem:!0,style:{justifyContent:"flex-end"},children:t.jsxRuntimeExports.jsx(jV,{"data-testid":_("transaction-amount-field",Qm(E,yc,m.toString())),style:{color:C?Ee.colors.primary:Ee.colors.champion},children:ot})})},Mt)}case"payment_account":{if(Z==="journal_entry")return u.postingType==="credit"?Qt({isLineRecommendationsLoading:wt,itemsData:Ot,key:Mt,resolvedWidthPercentage:fo}):t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,style:{paddingLeft:o.sp6},isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsx(D7,{style:{textAlign:"left",width:"100%"},children:Um})})},Mt);if(!(Z==="expense"||Z==="check"||Z==="bill_payment"||Z==="vendor_credit"||Z==="credit_card_credit"||Z==="deposit"||Z==="sales_receipt"||Z==="refund"||Z==="payment"))return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,style:{paddingLeft:o.sp6},isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsx(D7,{style:{textAlign:"left",width:"100%"},children:Um})})},Mt);const Lt=h?.account?.accountName,Nt=h?.paymentType,qn=h?.paymentTypeName,vo=Nt==="credit_card"?mbs:Nt==="cash"?xbs:Nt==="check"?gbs:Nt==="ach"?Pbs:hbs,jn={title:Ng,items:[{text:Kc.paymentAccountTooltip.accountLabel+g5e,amount:Lt??Um},...qn!=null?[{text:Kc.paymentAccountTooltip.methodLabel+g5e,amount:qn}]:[]]};return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",variant:"list-description",data:jn,title:Lt??Um,enterDelay:600,arrow:!0,style:{overflow:"hidden",minWidth:0},children:t.jsxRuntimeExports.jsxs(pbs,{"data-testid":_("payment-account",E),style:{color:C?Ee.colors.primary:Ee.colors.champion},children:[vo!=null&&t.jsxRuntimeExports.jsx(vo,{style:{color:C?Ee.colors.primary:Ee.colors.champion,width:o.sp5}}),t.jsxRuntimeExports.jsx(D7,{style:{color:"inherit",whiteSpace:"pre-wrap"},children:Lt??Um})]})})})},Mt)}case"memo_and_receipt":{const ot=h?.attachments??[],Lt=U?.fetchState==="In-Progress",Nt=vo=>{if(vo.stopPropagation(),ot.length===0||h==null)return;if(ds==null){console.warn("webV2MicroServiceEndpoint is not available, cannot fetch attachments.");return}dn(ot[0]),oo(0),Xe(!0);const jn=ot.map(ri=>ri.id),Ln=`${ds}/transaction_attachments`;ES(Ln,H,{transaction_key:{transaction_id:h.id,transaction_type:h.type},attachment_ids:jn}).then(ri=>{Dn(ri),ri.length>0&&To(ri[0])})},qn=vo=>{vo.stopPropagation(),Zs.current?.click()};return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,"data-testid":_("memo-field",Qm(E,yc,m.toString())),children:t.jsxRuntimeExports.jsxs(Tbs,{onClick:vo=>vo.stopPropagation(),children:[ge!=null?t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",data:ge,variant:"multi-information-points",arrow:!0,style:{maxHeight:"min(60vh, 360px)",overflowY:"auto",overflowX:"hidden"},children:t.jsxRuntimeExports.jsx(jbs,{"data-testid":_("memo-icon",E),style:{color:C?Ee.colors.primary:Ee.colors.champion}})}):t.jsxRuntimeExports.jsx(ybs,{style:{margin:0},children:Um}),Lt?t.jsxRuntimeExports.jsx(Et,{size:"Small",style:{display:"flex"},start:!0}):ot.length===0?t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:X7s,arrow:!0,enterDelay:600,children:t.jsxRuntimeExports.jsx(fbs,{"data-testid":_("upload-receipt-icon",E),style:{margin:0},onClick:vo=>{vo.stopPropagation(),qn(vo)}})}):ot.length===1?t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:ebs,arrow:!0,enterDelay:600,children:t.jsxRuntimeExports.jsx(Lbs,{"data-testid":_("view-receipt-icon",E),style:{color:C?Ee.colors.primary:Ee.colors.champion},onClick:Nt})}):t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",arrow:!0,title:tbs,enterDelay:600,children:t.jsxRuntimeExports.jsx(Bbs,{"data-testid":_("view-receipts-icon",E),style:{color:C?Ee.colors.primary:Ee.colors.hero},onClick:Nt})}),t.jsxRuntimeExports.jsx(yu,{name:`transaction-receipt-${x.transactionId}`,fileRef:Zs,sizeLimit:o5,multiple:!0,acceptableTypes:[...Q.SUPPORTED_TRANSACTION_LINE_ATTACHMENT_FILE_TYPES],onFileChange:vo=>{const jn=vo.target.files;if(jn!=null&&jn.length>0){const Ln=Array.from(jn);Y(S,x.transactionId,Z??Ng,Ln,Ln.map(ri=>ri.name))}},onFileSizeError:()=>{}})]})},Mt)}}})},ks=h?.attachments??[],_o=qt??ks[0];return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[Kt(),no&&ks.length>0&&_o!=null?Ns.createPortal(t.jsxRuntimeExports.jsx(Q5,{allFiles:kn,fileSource:on,file:_o,title:_o.fileName,attachments:ks,showNavigation:!1,setFileSource:To,setShowFullScreenView:Xe,onCrossClick:()=>{Xe(!1),To(null),Dn([]),dn(void 0),oo(0)},onNextClick:()=>{const Ct=(ft+1)%ks.length;oo(Ct),dn(ks[Ct]),kn[Ct]!=null&&To(kn[Ct])},onPreviousClick:()=>{const Ct=(ft-1+ks.length)%ks.length;oo(Ct),dn(ks[Ct]),kn[Ct]!=null&&To(kn[Ct])},setSelectedFileAttachment:Ct=>{dn(typeof Ct=="function"?Ot=>Ct(Ot??ks[0]):Ct)},handleTouchStart:Ct=>Hs(Ct.targetTouches[0].clientX),handleTouchMove:Ct=>Go(Ct.targetTouches[0].clientX),handleTouchEnd:()=>{if(Yn-yn>50&&yn!==0&&ft<ks.length-1){const Ct=ft+1;oo(Ct),dn(ks[Ct]),kn[Ct]!=null&&To(kn[Ct]),Hs(0),Go(0)}else if(Yn-yn<-50&&yn!==0&&ft>0){const Ct=ft-1;oo(Ct),dn(ks[Ct]),kn[Ct]!=null&&To(kn[Ct]),Hs(0),Go(0)}}}),document.body):null]})},y5e=({isEnabled:e,isMisCategorized:n,hasRecommendations:i,isTooltipVisible:r=!1,type:a})=>e?r?t.jsxRuntimeExports.jsx(Cbs,{"data-testid":_("recommendation-icon",a)}):t.jsxRuntimeExports.jsx(bbs,{className:"ai-icon-selected-plain","data-testid":_("recommendation-icon",a)}):!e&&n||i?r?t.jsxRuntimeExports.jsx(Ebs,{"data-testid":_("recommendation-icon",a)}):t.jsxRuntimeExports.jsx(wbs,{"data-testid":_("recommendation-icon",a)}):null,Fk=({children:e})=>t.jsxRuntimeExports.jsx(NPe,{children:e}),oF=({recommendations:e,isCOTEnabled:n,type:i,isReviewTab:r,selectedValueLabel:a,isEnabled:l=!1,isMisCategorized:c=!1,selectedValue:d,existingOption:u,cotTracking:m,lineId:x,openTooltipId:h,transactionId:f,isAccountOptionDisabled:y,onRecommendationClick:C,setOpenTooltipId:b})=>{const E=g.useMemo(()=>`${f}:${x}:${i}`,[f,x,i]),$=h===E,S=ro().analytics,{createAlternateRecommendationCallback:k}=y8(),T=g.useCallback(M=>{const F=e[1],V=e[0];k(i,{currentValue:a??Ng,transactionCurrentStatus:r?"pending_review":"auto_categorized",transactionPage:"list_page",cotTracking:m?{transactionId:f,lineId:x,onCOTView:(N,H,W,U)=>{m.onCOTView?.(N,H,W,U)}}:void 0},F,V)(M)},[k,e,a,r,i,m,x,f]),A=V9(e,i,n,u,"list_page",r?"pending_review":"auto_categorized",C,T,d,y),I=DC(e,i),B=g.useCallback(()=>{b(E);const M=A?.recommendations[0]?.cot??[],F=A?.recommendations[1]?.cot??[],V=F.length>0;if(S.trackTransactionCotView({recommendationFor:i,currentValue:a??Ng,recommendation:A?.recommendations[0]?.name??Ng,recommendationCot:M,isRecommendationCotAvailable:M.length>0,recommendationReason:A?.recommendations[0]?.reason??Ng,recommendationConfidencePercentage:A?.recommendations[0]?.confidencePercentage??null,recommendationConfidenceLevel:Ic(Ia(A?.recommendations[0]?.confidencePercentage).toLocaleLowerCase()),alternativeRecommendation:A?.recommendations[1]?.name??Ng,alternativeRecommendationCot:F,isAlternativeRecommendationCotAvailable:V,alternativeRecommendationReason:A?.recommendations[1]?.reason??Ng,alternativeRecommendationConfidencePercentage:A?.recommendations[1]?.confidencePercentage??null,alternativeRecommendationConfidenceLevel:V?Ic(Ia(A?.recommendations[1]?.confidencePercentage).toLocaleLowerCase()):null,transactionCurrentStatus:r?"pending_review":"auto_categorized",transactionPage:"list_page"}),m?.onCOTView!=null){const N=f8(A);N!=null&&m.onCOTView(x,f,i,N)}},[S,A,r,a,i,x,f,E,b]),L=g.useCallback(()=>{h===E&&b(void 0)},[h,E,b]),P=g.useMemo(()=>!d||!I?!1:e.some(M=>i==="vendor"&&M.vendor!=null?M.vendor.id===d||M.vendor.qboId===d:i==="category"&&M.account!=null?M.account.qboId===d||M.account.accountId===d:i==="class"&&M.class!=null?M.class.classId===d:!1),[d,I,e,i]);if(!I)return t.jsxRuntimeExports.jsx(NPe,{});const D=l||P;return A?t.jsxRuntimeExports.jsx(Fk,{children:t.jsxRuntimeExports.jsx(Le,{variant:"chain-of-thought",data:A,placement:"bottom-start",disableIntersectionObserver:!0,position:"static",display:"block",open:$,style:{width:"auto",height:"auto"},leaveDelay:200,onOpen:B,onClose:L,children:t.jsxRuntimeExports.jsx($bs,{"data-testid":_("recommendation-icon",i),children:t.jsxRuntimeExports.jsx(y5e,{isEnabled:D,isMisCategorized:c,hasRecommendations:I,isTooltipVisible:$})})})}):t.jsxRuntimeExports.jsx(Fk,{children:t.jsxRuntimeExports.jsx(y5e,{isEnabled:D,isMisCategorized:c,hasRecommendations:I,isTooltipVisible:$,type:i})})},zPe=({isAccountingClassesEnabled:e,showProjectField:n})=>{const i=X(),r=mr(),a=MB(),l=r?Aq:vq(e,n);return t.jsxRuntimeExports.jsx(abs,{$flexibleWidth:a,windowSize:i,isQuickViewMode:r,children:l.map((c,d)=>{const u=`${d}${J7s}${c.key}`,m=Sq(c,e,n);switch(c.key){case"activity":return t.jsxRuntimeExports.jsx(FPe,{},u);case"vendor":return t.jsxRuntimeExports.jsx(fa,{windowSize:i,wrapperWidth:c.width,widthPercentage:m,isQuickViewMode:r,isSticky:c.isSticky,style:c.customStyle?.common,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:i,isLastItem:d===l.length-1,children:t.jsxRuntimeExports.jsxs(jV,{children:[t.jsxRuntimeExports.jsx(xs,{width:p[4],height:p[4]}),t.jsxRuntimeExports.jsx(fe,{height:p[4],width:p[12],style:{display:"flex",alignItems:"center"}})]})})},u);default:{const x=d===l.length-1;return t.jsxRuntimeExports.jsx(fa,{isLastItem:x,windowSize:i,wrapperWidth:c.width,widthPercentage:m,isQuickViewMode:r,style:c.customStyle?.common,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:i,isLastItem:x,children:t.jsxRuntimeExports.jsx(fe,{width:"100%",height:p[4],style:{display:"flex",alignItems:"center"}})})},u)}}})})},FPe=s.div`
69244
+ `,tF="expenseAutomationTransactionsPage",K3="transactionCategorizationListTable",Ui="account",yc="class",$j="project",pp="lineEntitySelection",U7s="lineEntity",G7s="recommendations",OPe="lineInfo",Y7s="vendorDetails",q7s="customerDetails",aS="selectedTransactionIds",Qm=(e,n,i)=>`${e}.${i}.${n}`,Z7s=e=>j.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M4.85022 13.5836L5.52057 12.9133C5.63229 12.8016 5.77164 12.7217 5.92438 12.6815C6.07712 12.6413 6.23779 12.6424 6.38999 12.6846C6.54218 12.7268 6.68046 12.8086 6.7907 12.9217C6.90094 13.0348 6.97919 13.1751 7.01747 13.3283L7.08174 13.5836L7.8119 13.0972C7.98361 12.9827 8.1897 12.9312 8.39508 12.9515C8.60046 12.9719 8.79245 13.0628 8.93837 13.2087L9.31326 13.5836H11.0985",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M17.4206 6H2.24629C2.12792 6 2.01441 6.04702 1.93071 6.13072C1.84701 6.21442 1.79999 6.32794 1.79999 6.4463V17.1576C1.79999 17.276 1.84701 17.3895 1.93071 17.4732C2.01441 17.5569 2.12792 17.6039 2.24629 17.6039H21.8837C22.0021 17.6039 22.1156 17.5569 22.1993 17.4732C22.283 17.3895 22.33 17.276 22.33 17.1576V6.4463C22.33 6.32794 22.283 6.21442 22.1993 6.13072C22.1156 6.04702 22.0021 6 21.8837 6H17.4206Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M16.0854 9.6521H19.6559V12.0656H16.0854V9.6521Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),K7s=e=>j.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M20.25 19.5H6.75C6.55109 19.5 6.36032 19.421 6.21967 19.2803C6.07902 19.1397 6 18.9489 6 18.75V2.25C6 2.05109 6.07902 1.86032 6.21967 1.71967C6.36032 1.57902 6.55109 1.5 6.75 1.5H15.75L21 6.75V18.75C21 18.9489 20.921 19.1397 20.7803 19.2803C20.6397 19.421 20.4489 19.5 20.25 19.5Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M15.75 1.5V6.75H21",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M10.4941 11.2559H16.4941",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M10.4941 14.2559H16.4941",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M16.5 22.5H3V5.85315",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),{common:{strings:{underscore:J7s,hyphen:Um,empty:Ng,colon:g5e},tooltips:{addReceipt:X7s,viewReceipt:ebs,viewReceipts:tbs}},expenseAutomation:{transactions:Kc},dateFormat:obs}=O.getLocalizedStrings(),vu={containerPaddingLeftRight:new w(p[3],p[3]),containerPaddingTopBottom:new w(6,6),controlHeight:new w(p[4],p[5]),nameLogoWidth:new w(p[2],p[3]),nameLogoHeight:new w(p[2],p[3]),borderRadius:6},f5e=({windowSize:e,wrapperWidth:n,widthPercentage:i})=>t.jsxRuntimeExports.jsxs(fa,{windowSize:e,wrapperWidth:n,widthPercentage:i,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(Fk,{children:t.jsxRuntimeExports.jsx("span",{})}),t.jsxRuntimeExports.jsx(fb,{children:t.jsxRuntimeExports.jsx(fe,{width:"100%",height:p[4]})})]}),nbs=(e,n)=>e==="journal_entry"&&n==="credit",sbs=({transactionView:e,transaction:n,sectionId:i,vendorSearchAutoCompleteData:r,vendorSearchAutoCompleteActions:a,selectedTab:l,containerRef:c,listContainerRef:d,isAccountingClassesEnabled:u,showProjectField:m,isCOTEnabled:x,isCreateTransferEntryFromExpenseEnabled:h,isPanelSelected:f,cotTracking:y,onTransactionCategorizationRowClick:C,setCurrentTransactionInAction:b,vendorLoadOptions:E,openTooltipId:$,setOpenTooltipId:R,isUncategorizedExpenseCategoryEnabled:S,onOpenTransferDrawer:k,authParams:T,onUploadTransactionReceipt:A,rowCommenting:I})=>{const B=X(),L=mr(),P=MB(),{isCommentingActive:D,rowRef:M,totalThreadCount:F,isThreadsLoading:V,handleActiveThreadClick:N,handleAddRowCommentClick:H}=I,[W,U]=g.useState(!1),{lineItemById:Y,sortedLineItems:q}=n.transactionReviewLocalData,Z=n.transactionReviewLocalData.tabSpecificLineItems?.[l]||[],G=q.filter(Ee=>Z.indexOf(Ee)!==-1),K=[];G.forEach(Ee=>{K.push(Y[Ee])});const{accountList:J,accountsHierarchyList:oe,classHierarchyList:ee,classList:te,projectList:se,uncategorizedAccounts:ie,transactions:re,selectedCheckBoxTransactionIds:ne}=e,me=se?.projects??[],pe=e.uploadReceiptStatusById,je=ne.includes(n.transactionId),ce=L!==!0&&je===!0,de=t.useTheme(),ue={control:()=>({marginLeft:-2,backgroundColor:W?de.colors.background:de.colors.grey5,minHeight:p[5]}),valueContainer:()=>({justifyContent:"flex-start",paddingLeft:p[0],height:p[5],backgroundColor:de.colors.grey5}),menu:()=>({width:"150%",background:de.colors.grey5}),singleValue:()=>({color:W||ce?de.colors.primary:de.colors.champion,paddingLeft:p[2]}),input:Ee=>({...Ee,color:W||ce?de.colors.primary:de.colors.champion,textAlign:"left",paddingLeft:p[2]}),menuPortal:Ee=>({...Ee,zIndex:10})},le={...ue,singleValue:Ee=>({...Ee,color:W||ce?de.colors.primary:de.colors.champion}),menu:()=>({marginTop:p[1],marginLeft:-p[2]}),input:Ee=>({...Ee,color:W||ce?de.colors.primary:de.colors.champion,textAlign:"left",...z.standardMedium}),control:Ee=>({...Ee,height:p[5]})},ae=re.find(Ee=>Ee.id===n.transactionId),ge=(Ee,Se)=>{const{transactionType:$e}=Se.transactionReviewLocalData;let Ae=Ee.target;for(;Ae;){if(Ae.classList.contains("select-value-container")||Ae.classList.contains("item-value-container")||Ae.classList.contains("grouped-single-select-field__value-container")||Ae.classList.contains("auto-complete-grouped-creatable-single-custom-group-select-field__option")||Ae.classList.contains("grouped-single-select-field__input")||Ae.classList.contains("grouped-single-select-field__menu"))return;Ae=Ae.parentElement}$e!=null&&C(Se.transactionId,$e)},ye=g.useRef(null),[he,Ce]=g.useState(void 0),[we,ve]=g.useState("bottom");return g.useEffect(()=>{if(he===void 0)return;const Se=d?.current?._outerRef??null,$e=()=>{const Be=ye.current;if(Be==null||Se==null)return;const Ae=Be.getBoundingClientRect(),_e=Se.getBoundingClientRect(),Te=Se.scrollTop+(Ae.bottom-_e.top),Re=Se.scrollHeight-Te;ve(Re>=288?"bottom":"top")};return $e(),window.addEventListener("resize",$e),Se?.addEventListener("scroll",$e),()=>{window.removeEventListener("resize",$e),Se?.removeEventListener("scroll",$e)}},[d,he]),t.jsxRuntimeExports.jsx(rbs,{ref:M,onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1),children:t.jsxRuntimeExports.jsxs(lbs,{className:"categorization-row-card",windowSize:B,isSelected:je,isPanelSelected:f,isQuickViewMode:L,isHovered:W,style:{position:"relative"},children:[t.jsxRuntimeExports.jsx(cbs,{windowSize:B,isQuickViewMode:L,children:K.map((Ee,Se)=>t.jsxRuntimeExports.jsx(dbs,{ref:he===Se?ye:void 0,isFirstItem:Se===0,isLastItem:Se===K.length-1,"data-testid":_("transaction-categorization-list-row",Ee.lineId),flexibleWidth:P,isQuickViewMode:L,windowSize:B,onClick:$e=>ge($e,n),children:t.jsxRuntimeExports.jsx(ibs,{isAccountingClassesEnabled:u,showProjectField:m,allProjectList:me,line:Ee,isHovered:W||ce||f,isSelected:je,isQuickViewMode:L,lineIndex:Se,sectionId:i,transaction:n,currentTransaction:ae,windowSize:B,accountsHierarchyList:oe,classHierarchyList:ee,allAccountList:J,allClassList:te,uncategorizedAccounts:ie,vendorSearchAutoCompleteData:r,vendorSearchAutoCompleteActions:a,setCurrentTransactionInAction:b,vendorLoadOptions:E,customStyle:ue,customStyleAutoComplete:le,recommendations:Ee.recommendationsWithCOT,selectedTab:l,isCOTEnabled:x,menuPlacement:we,cotTracking:y,openTooltipId:$,setOpenTooltipId:R,isUncategorizedExpenseCategoryEnabled:S,authParams:T,uploadReceiptStatus:pe?.[n.transactionId],onUploadTransactionReceipt:A,onDropdownClose:()=>Ce(void 0),onDropdownOpen:()=>Ce(Se),onOpenTransferDrawer:k,isCreateTransferEntryFromExpenseEnabled:h})},`${n.transactionId}.${Ee.lineId}.${Se}`))},n.transactionId),L===!0&&D&&F>0?t.jsxRuntimeExports.jsx(ia,{flushRight:!0,children:t.jsxRuntimeExports.jsx(ra,{isLoading:V,count:F,style:{backgroundColor:de.colors.grey4,borderRadius:"50% 50% 50% 0",cursor:"pointer"},openThread:N})}):null,L===!0&&D&&V===!1&&F===0?t.jsxRuntimeExports.jsx(ia,{flushRight:!0,innerClassName:"comment-add-icon",children:t.jsxRuntimeExports.jsx(m4,{"data-testid":_("expense-automation-transaction-row-add-comment",n.transactionId),onClick:H})}):null,t.jsxRuntimeExports.jsx(p6,{state:I})]},n.transactionId)})},ibs=({accountsHierarchyList:e,allAccountList:n,allClassList:i,allProjectList:r,showProjectField:a,classHierarchyList:l,customStyle:c,customStyleAutoComplete:d,line:u,lineIndex:m,transaction:x,currentTransaction:h,windowSize:f,uncategorizedAccounts:y,isHovered:C=!1,isQuickViewMode:b=!1,sectionId:E,recommendations:$,vendorSearchAutoCompleteData:R,selectedTab:S,isCOTEnabled:k,menuPlacement:T,cotTracking:A,openTooltipId:I,setCurrentTransactionInAction:B,vendorLoadOptions:L,setOpenTooltipId:P,isUncategorizedExpenseCategoryEnabled:D,isAccountingClassesEnabled:M,isCreateTransferEntryFromExpenseEnabled:F,onDropdownClose:V,onDropdownOpen:N,authParams:H,onOpenTransferDrawer:W,uploadReceiptStatus:U,onUploadTransactionReceipt:Y})=>{const{transactionDate:q,transactionType:Z,transactionTypeName:G,memo:K}=x.transactionReviewLocalData,[J,oe]=g.useState(!1),ee=g.useMemo(()=>typeof document<"u"?document.body:null,[]),te=g.useMemo(()=>({...c,control:()=>({height:0,minHeight:0,overflow:"hidden",border:"none",padding:0,margin:0}),menuPortal:Ct=>({...Ct,zIndex:wG})}),[c]),se=h?.account?.accountType,ie=x.transactionReviewLocalData.sortedLineItems.length>1,re=F===!0&&RA(se)&&!ie,ne=F===!0&&RA(se)&&ie,me=h?.accountIntegrationId,pe=Qm(E,"transactionType",m.toString()),{setValue:je,watch:ce}=t.useFormContext(),de=ce(pe),ue=g.useRef(de?.selectedOption);g.useEffect(()=>{const Ct=de?.selectedOption,Ot=Ct==="transfer"||Ct==="credit_card_payment",Yo=ue.current==="transfer"||ue.current==="credit_card_payment";if(ue.current=Ct,Ot&&!Yo&&W!=null){oe(!1);const Mt=x.transactionReviewLocalData,fo=Mt.sortedLineItems.map(ot=>Mt.lineItemById[ot]).find(ot=>ot!=null);fo!=null&&(W({transactionId:x.transactionId,transactionType:Ct,sourceTransactionType:Z??"expense",payee:Mt.vendorDetails?.name??Mt.vendor?.name??"",category:fo.account?.accountName??"",className:fo.class?.className??"",amount:fo.amount,debitAccountIntegrationId:me??"",debitAccountName:h?.account?.accountName??"",memo:Mt.memo??""}),je(pe,Nj(Z??"expense",se)))}},[de?.selectedOption,W,je,Z,pe,x.transactionId,x.transactionReviewLocalData,h,me,se]);const le=g.useCallback((Ct,Ot)=>{A?.onCOTView!=null&&A.onCOTView(u.lineId,x.transactionId,Ct,Ot)},[A,u.lineId,x.transactionId]),ae=u.lineDescription,ge=g.useMemo(()=>{if(ae||K)return[{title:Kc.description,description:ae||Um},{title:Kc.header.memo,description:K||Um}]},[K,ae]),ye=Qm(E,pp,m.toString()),he=Qm(E,Ui,m.toString()),Ce=Qm(E,yc,m.toString()),we=Qm(E,$j,m.toString()),ve=(Ct,Ot)=>{if(b)return;let Yo;switch(Ot){case"vendor":Yo=ye;break;case"category":Yo=he;break;case"class":Yo=Ce;break;default:return}je(`${Yo}.selectedOption`,Ct,{shouldValidate:!0,shouldDirty:!0})},Ee=t.useTheme(),Se=g.useMemo(()=>h!=null&&Q.isVendorTransaction(h)===!0?{id:x.transactionReviewLocalData.customer?.id??"",logo:x.transactionReviewLocalData.customer?.logo,name:x.transactionReviewLocalData.customer?.name??""}:{id:u.customer?.id??"",logo:u.customer?.logo,name:u.customer?.name??""},[h,u.customer?.id,u.customer?.logo,u.customer?.name,x.transactionReviewLocalData.customer?.id,x.transactionReviewLocalData.customer?.logo,x.transactionReviewLocalData.customer?.name]),$e=g.useMemo(()=>h!=null&&Q.isVendorTransaction(h)===!0?{id:x.transactionReviewLocalData.vendor?.id??"",logo:x.transactionReviewLocalData.vendor?.logo,name:x.transactionReviewLocalData.vendor?.name??""}:{id:u.vendor?.id??"",logo:u.vendor?.logo,name:u.vendor?.name??""},[h,u.vendor?.id,u.vendor?.logo,u.vendor?.name,x.transactionReviewLocalData.vendor?.id,x.transactionReviewLocalData.vendor?.logo,x.transactionReviewLocalData.vendor?.name]),Be=u[yc]?.classId,Ae=u[yc]?.className,_e=u.project?.projectId,Te=u.project?.projectName,Re=u[Ui]?.qboId??u[Ui]?.accountId,ke=u[Ui]?.accountName,Oe=Se?.id,Me=$e?.id,Ie=$e?.name,[Ne,Pe]=g.useState(!Be),[Qe,Je]=g.useState(!_e),[tt,Ue]=g.useState(!Re||u[Ui]?.qboId!=null&&Q.isAccountUncategorized(y,u[Ui].qboId,D===!0?["income"]:void 0)===!0),[dt,ct]=g.useState(!Me||!Oe),yt=Ct=>$?.find(Yo=>Yo.vendor?.qboId===Ct||Yo.vendor?.id===Ct||Yo.vendor?.name===Ct)?.vendor?.reason??"",He=x.transactionReviewLocalData.lineItemById[u.lineId]?.recommendationsWithCOT||[],jt=N9(e,He),St=H9(l,He),We=PC(r),nt=Ct=>n.filter(Yo=>Yo.qboId===Ct)[0]?.qboId,ut=Ct=>i.filter(Yo=>Yo.classId===Ct)[0]?.accountingClassNumber??void 0,pt=g.useCallback(Ct=>Q.isAccountUncategorized(y,Ct,D===!0?["income"]:void 0),[y,D]),[Bt,Ht]=g.useState(!1),[$o,Tt]=g.useState(!1),[Gt,so]=g.useState(!1),[no,Xe]=g.useState(!1),[ft,oo]=g.useState(0),[on,To]=g.useState(null),[kn,Dn]=g.useState([]),[qt,dn]=g.useState(void 0),Zs=g.useRef(null),[Yn,Hs]=g.useState(0),[yn,Go]=g.useState(0),ds=UV()?.url,[In,ts]=g.useState(!1),pn=(Ct,Ot)=>{B({transactionId:x.transactionId,lineItemId:u.lineId}),L(Ct,Ot)},_s=()=>{ct(!(Me||Oe)),Ht(!1),V?.()},us=()=>{Re&&u[Ui]?.qboId!=null&&Q.isAccountUncategorized(y,u[Ui].qboId,D===!0?["income"]:void 0)===!1?Ue(!1):Ue(!0),ts(!1),V?.()},js=()=>{Pe(!Be),Tt(!1),V?.()},xn=()=>{Je(!_e),so(!1),V?.()},As=()=>{b||(Me||Oe)&&(Ht(!0),N?.())},nn=()=>{b||(Tt(!0),N?.())},os=()=>{b||(so(!0),N?.())},qe=()=>{b||(ts(!0),N?.())};g.useEffect(()=>{Re&&u[Ui]?.qboId!=null&&Q.isAccountUncategorized(y,u[Ui].qboId,D===!0?["income"]:void 0)===!1?Ue(!1):Ue(!0)},[Re]),g.useEffect(()=>{Pe(!Be)},[Be]),g.useEffect(()=>{Je(!_e)},[_e]),g.useEffect(()=>{ct(!(Me||Oe))},[Me,Oe]);const xt=x.transactionReviewLocalData.selectedEntity,Wt=x.transactionReviewLocalData.lineItemById[u.lineId].selectedEntityLine,Ze=h!=null&&Q.isVendorTransaction(h)===!0?xt:Wt,Mo=g.useMemo(()=>{const Ct=x.transactionReviewLocalData.lineItemById[u.lineId]?.recommendationsWithCOT||[],Ot=R.entityAutoCompleteView;return{selectedOption:Ze?.qboId??Ze?.id,defaultOptions:K5(Ot,Ze,Ct??[])}},[Ze,x.transactionReviewLocalData.lineItemById,u.lineId,R.entityAutoCompleteView]),Lo=()=>Ze!=null&&Ze.logo!=null?t.jsxRuntimeExports.jsx(Cu,{photoUrl:Ze.logo.toString(),styles:{width:vu.nameLogoWidth.valuePx(f),height:vu.nameLogoHeight.valuePx(f)},fallbackAvatar:t.jsxRuntimeExports.jsx(j5e,{children:t.jsxRuntimeExports.jsx(Jo,{name:Ze.name})})}):Ze!=null&&Ze.name!=null?t.jsxRuntimeExports.jsx(j5e,{children:t.jsxRuntimeExports.jsx(Jo,{name:Ze.name})}):null,_n=(Ct,Ot,Yo)=>{if(Ot==null||!Ot)return;let Mt=[];return Ct.forEach(fo=>{Mt=Mt.concat(fo.options)}),Mt.find(fo=>fo.value===Ot)?.label??Yo??Ot},ns=_n(St,Be,Ae),Vt=_n(We,_e,Te),en=_n(jt,Re,ke),On=S==="review",$t=y2("vendor",Mo.defaultOptions,Mo.selectedOption),bo=y2("category",jt,Re),mt=y2("class",St,Be),Qt=Ct=>{const{isLineRecommendationsLoading:Ot,itemsData:Yo,key:Mt,resolvedWidthPercentage:fo}=Ct;if(Ot===!0)return t.jsxRuntimeExports.jsx(f5e,{windowSize:f,wrapperWidth:Yo.width,widthPercentage:fo},Mt);const ot=h?.lines!=null?h.lines[m]:void 0;return t.jsxRuntimeExports.jsxs(fa,{windowSize:f,wrapperWidth:Yo.width,widthPercentage:fo,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(oF,{isCOTEnabled:k,recommendations:He,type:"category",isReviewTab:On,isEnabled:!!u[Ui]?.isPreFilled,isAccountOptionDisabled:pt,isMisCategorized:bo,onRecommendationClick:ve,selectedValue:Re,selectedValueLabel:en,existingOption:{label:ot?.account?.accountName,value:ot?.account?.qboId??ot?.account?.accountId},cotTracking:A,lineId:u.lineId,transactionId:x.transactionId,openTooltipId:I,setOpenTooltipId:P}),t.jsxRuntimeExports.jsx(fb,{children:tt===!0?t.jsxRuntimeExports.jsx(fR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(gR,{onClick:Lt=>{Lt.stopPropagation(),!b&&(N?.(),Ue(!1),ts(!0))},"data-testid":_("category-selection-field",he),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[Kc.addCategory,t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})}):In===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:us,children:t.jsxRuntimeExports.jsx(nF,{isHovered:C,"data-testid":_("category-selection-dropdown-container",he),children:t.jsxRuntimeExports.jsx(Ll,{name:he,placeholder:Kc.addCategory,valueToId:Lt=>nt(Lt),type:"category",pageSource:"list_page",transactionStatus:On?"pending_review":"auto_categorized",showCOT:k,defaultValue:{selectedOption:Re,selectedOptionLabel:ke,allOptions:jt},style:{display:"flex",flexGrow:1,width:"100%",cursor:"inherit"},registerOptions:{required:!1},menuIsOpen:In,autoFocus:!tt&&(!Re||u[Ui]?.qboId!=null&&[y.expense?.qboId,y.income?.qboId].includes(u[Ui].qboId)),onMenuClose:us,customStyleConfig:c,disableCurrentOption:pt,menuPlacement:T,menuPortal:document.body,onCOTView:le})})}):t.jsxRuntimeExports.jsx(yR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(sF,{onClick:qe,"data-testid":_("category-label-text",he),children:[t.jsxRuntimeExports.jsx(Xn,{text:en??"",itemTextStyle:{color:C?Ee.colors.primary:Ee.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})})})]},Mt)},wt=u!=null&&u.categoryClassRecommendationsFetchState?.fetchState==="In-Progress",Kt=()=>{const Ct=b?Aq:vq(M,a);return Ct.map((Ot,Yo)=>{const Mt=`${x.transactionId}_${Ot.key}_${u.lineId}`,fo=Sq(Ot,M,a);if(m>0&&h!=null&&Q.isVendorTransaction(h)===!0&&Ot.key==="vendor")return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,isQuickViewMode:b,isSticky:Ot.isSticky===!0},Mt);if(m>0&&(Ot.key==="transaction_type"||Ot.key==="memo_and_receipt"||Ot.key==="payment_account"&&Z!=="journal_entry"))return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,isQuickViewMode:b},Mt);switch(Ot.key){case"activity":return t.jsxRuntimeExports.jsx(FPe,{},Mt);case"vendor":default:return t.jsxRuntimeExports.jsxs(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,isQuickViewMode:b,isSticky:Ot.isSticky===!0,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(oF,{isCOTEnabled:k,recommendations:He,type:"vendor",isEnabled:!!Ze?.isPreFilled,isMisCategorized:$t,onRecommendationClick:ve,selectedValue:Me,selectedValueLabel:Ie,isReviewTab:On,isAccountOptionDisabled:pt,existingOption:{label:h!=null&&Q.isVendorTransaction(h)===!0?h?.vendor?.name:void 0,value:h!=null&&Q.isVendorTransaction(h)===!0?h?.vendor?.id:void 0},cotTracking:A,lineId:u.lineId,transactionId:x.transactionId,openTooltipId:I,setOpenTooltipId:P}),t.jsxRuntimeExports.jsx(fb,{children:dt===!0?t.jsxRuntimeExports.jsx(fR,{isHovered:C,isQuickViewMode:b,children:t.jsxRuntimeExports.jsxs(gR,{onClick:ot=>{ot.stopPropagation(),!b&&(N?.(),ct(!1),Ht(!0))},"data-testid":_("add-vendor-button",E),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[Kc.addPayee,b===!1&&t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})}):Bt===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:_s,children:t.jsxRuntimeExports.jsx(vbs,{"data-testid":_("vendor-selection-dropdown-container",Qm(E,pp,m.toString())),children:t.jsxRuntimeExports.jsx(TG,{name:ye,placeholder:Kc.addPayee,valueToInfo:yt,defaultValue:{selectedOption:Mo.selectedOption,selectedOptionLabel:Ie,defaultOptions:Mo.defaultOptions},type:"vendor",autoFocus:!dt,style:{width:"100%"},pageSource:"list_page",transactionStatus:On?"pending_review":"auto_categorized",isOptionRemovable:!1,customStyleConfig:d,menuIsOpen:Bt,onMenuClose:_s,registerOptions:{required:!1},loadOptions:pn,showCOT:k,onCOTView:le,menuPlacement:T,menuPortal:document.body})})}):t.jsxRuntimeExports.jsx(Ibs,{children:t.jsxRuntimeExports.jsxs(yR,{isHovered:C,isQuickViewMode:b,children:[Lo(),t.jsxRuntimeExports.jsxs(Rbs,{onClick:As,"data-testid":_("vendor-name-text",E),children:[Ze!=null&&Ze.name?t.jsxRuntimeExports.jsx(Xn,{text:Ze.name,itemTextStyle:{color:C?Ee.colors.primary:Ee.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}):t.jsxRuntimeExports.jsx(kbs,{children:Um}),b===!1&&t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})]})})})]},Mt);case"category":return nbs(Z,u.postingType)?t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,style:{paddingLeft:o.sp6},isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsx(D7,{style:{textAlign:"left",width:"100%"},children:Um})})},Mt):Qt({isLineRecommendationsLoading:wt,itemsData:Ot,key:Mt,resolvedWidthPercentage:fo});case"class":{if(!M)return null;if(wt===!0)return t.jsxRuntimeExports.jsx(f5e,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo},Mt);const ot=h?.lines!=null?h?.lines[m]:void 0;return t.jsxRuntimeExports.jsxs(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(oF,{isCOTEnabled:k,recommendations:He,type:"class",isReviewTab:On,isEnabled:!!u[yc]?.isPreFilled,isAccountOptionDisabled:pt,isMisCategorized:mt,onRecommendationClick:ve,selectedValue:Be,selectedValueLabel:ns,existingOption:{label:ot?.class?.className,value:ot?.class?.classId},cotTracking:A,lineId:u.lineId,transactionId:x.transactionId,openTooltipId:I,setOpenTooltipId:P}),t.jsxRuntimeExports.jsx(fb,{children:Ne===!0?t.jsxRuntimeExports.jsx(fR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(gR,{onClick:Lt=>{Lt.stopPropagation(),!b&&(N?.(),Pe(!1),Tt(!0))},"data-testid":_("class-selection-field",Ce),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[Kc.addClass,t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})}):$o===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:js,children:t.jsxRuntimeExports.jsx(nF,{isHovered:C,"data-testid":_("class-selection-dropdown-container",Ce),children:t.jsxRuntimeExports.jsx(Ll,{name:Ce,placeholder:Kc.addClass,valueToId:Lt=>ut(Lt),type:"class",showCOT:k,defaultValue:{selectedOption:Be,selectedOptionLabel:Ae,allOptions:St},pageSource:"list_page",transactionStatus:On?"pending_review":"auto_categorized",menuIsOpen:$o,registerOptions:{required:!1},style:{width:"100%"},autoFocus:!Ne&&!Be,customStyleConfig:c,onMenuClose:js,menuPlacement:T,menuPortal:document.body,onCOTView:le})})}):t.jsxRuntimeExports.jsx(yR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(sF,{"data-testid":_("class-selection-field",Ce),onClick:nn,children:[t.jsxRuntimeExports.jsx(Xn,{text:ns??"",itemTextStyle:{color:C?Ee.colors.primary:Ee.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})})})]},Mt)}case"project":return a?t.jsxRuntimeExports.jsxs(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,className:"item-value-container",children:[t.jsxRuntimeExports.jsx(Fk,{children:t.jsxRuntimeExports.jsx("span",{})}),t.jsxRuntimeExports.jsx(fb,{children:Qe===!0?t.jsxRuntimeExports.jsx(fR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(gR,{onClick:ot=>{ot.stopPropagation(),!b&&(N?.(),Je(!1),so(!0))},"data-testid":_("project-selection-field",we),style:{display:"inline-flex",alignItems:"center",color:v.neutralGrey1Light,cursor:"pointer"},children:[Kc.addProject,t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})}):Gt===!0?t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:xn,children:t.jsxRuntimeExports.jsx(nF,{isHovered:C,"data-testid":_("project-selection-dropdown-container",we),children:t.jsxRuntimeExports.jsx(Ll,{name:we,placeholder:Kc.addProject,type:"project",showCOT:!1,defaultValue:{selectedOption:_e,selectedOptionLabel:Te,allOptions:We},pageSource:"list_page",transactionStatus:On?"pending_review":"auto_categorized",menuIsOpen:Gt,registerOptions:{required:!1},style:{width:"100%"},autoFocus:!Qe&&!_e,customStyleConfig:c,onMenuClose:xn,menuPlacement:T,menuPortal:document.body})})}):t.jsxRuntimeExports.jsx(yR,{isHovered:C,children:t.jsxRuntimeExports.jsxs(sF,{"data-testid":_("project-selection-field",we),onClick:os,children:[t.jsxRuntimeExports.jsx(Xn,{text:Vt??"",itemTextStyle:{color:C?Ee.colors.primary:Ee.colors.champion,fontSize:z.standardMedium.fontSizeValue,fontWeight:z.standardMedium.fontWeight}}),t.jsxRuntimeExports.jsx(ug,{children:t.jsxRuntimeExports.jsx(dg,{})})]})})})]},Mt):null;case"date":return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsx(jV,{"data-testid":_("date-field",Qm(E,yc,m.toString())),children:t.jsxRuntimeExports.jsx(D7,{style:{color:C?Ee.colors.primary:Ee.colors.champion},children:q!=null?q.format(obs.visual.MMMDCommaYYYYformat):null})})})},Mt);case"transaction_type":{const ot=Z==="expense"||Z==="check";return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:G!=null?t.jsxRuntimeExports.jsx(Bh,{windowSize:f,"data-testid":_("transaction-type-field",Qm(E,yc,m.toString())),isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsxs(Abs,{className:ot&&re?"select-value-container":void 0,children:[ot&&ne?t.jsxRuntimeExports.jsx(Le,{title:Kc.transactionTypeDropdown.multilineNotEligibleTooltip,enterDelay:600,placement:"bottom",children:t.jsxRuntimeExports.jsx(ao,{label:G??Z})}):t.jsxRuntimeExports.jsx(ao,{label:G??Z,onClick:ot&&re?()=>{je(pe,Nj(Z??"expense",se)),oe(!0)}:void 0,capsuleBackground:re&&J?Ee.colors.background:void 0,showChevron:ot&&re}),ot&&re&&J&&t.jsxRuntimeExports.jsx(t.ClickAwayListener,{onClickAway:()=>oe(!1),children:t.jsxRuntimeExports.jsx(Sbs,{children:t.jsxRuntimeExports.jsx(Ll,{name:pe,defaultValue:Nj(Z??"expense",se),pageSource:"list_page",showCOT:!1,transactionStatus:On?"pending_review":"auto_categorized",type:"category",menuIsOpen:J,autoFocus:!0,onMenuClose:()=>oe(!1),customStyleConfig:te,menuPlacement:T,menuPortal:ee,allowEmpty:!1,menuOptionPresentation:"typePill"})})})]})}):null},Mt)}case"amount":{const ot=Fe("0,0.[00]",u.amount,!0);return t.jsxRuntimeExports.jsx(fa,{windowSize:f,style:{marginRight:p[0]},wrapperWidth:Ot.width,widthPercentage:fo,isQuickViewMode:b,isLastItem:!0,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,isLastItem:!0,style:{justifyContent:"flex-end"},children:t.jsxRuntimeExports.jsx(jV,{"data-testid":_("transaction-amount-field",Qm(E,yc,m.toString())),style:{color:C?Ee.colors.primary:Ee.colors.champion},children:ot})})},Mt)}case"payment_account":{if(Z==="journal_entry")return u.postingType==="credit"?Qt({isLineRecommendationsLoading:wt,itemsData:Ot,key:Mt,resolvedWidthPercentage:fo}):t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,style:{paddingLeft:o.sp6},isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsx(D7,{style:{textAlign:"left",width:"100%"},children:Um})})},Mt);if(!(Z==="expense"||Z==="check"||Z==="bill_payment"||Z==="vendor_credit"||Z==="credit_card_credit"||Z==="deposit"||Z==="sales_receipt"||Z==="refund"||Z==="payment"))return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,style:{paddingLeft:o.sp6},isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsx(D7,{style:{textAlign:"left",width:"100%"},children:Um})})},Mt);const Lt=h?.account?.accountName,Nt=h?.paymentType,qn=h?.paymentTypeName,vo=Nt==="credit_card"?mbs:Nt==="cash"?xbs:Nt==="check"?gbs:Nt==="ach"?Pbs:hbs,jn={title:Ng,items:[{text:Kc.paymentAccountTooltip.accountLabel+g5e,amount:Lt??Um},...qn!=null?[{text:Kc.paymentAccountTooltip.methodLabel+g5e,amount:qn}]:[]]};return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:f,isLastItem:Yo===Ct.length-1,children:t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",variant:"list-description",data:jn,title:Lt??Um,enterDelay:600,arrow:!0,style:{overflow:"hidden",minWidth:0},children:t.jsxRuntimeExports.jsxs(pbs,{"data-testid":_("payment-account",E),style:{color:C?Ee.colors.primary:Ee.colors.champion},children:[vo!=null&&t.jsxRuntimeExports.jsx(vo,{style:{color:C?Ee.colors.primary:Ee.colors.champion,width:o.sp5}}),t.jsxRuntimeExports.jsx(D7,{style:{color:"inherit",whiteSpace:"pre-wrap"},children:Lt??Um})]})})})},Mt)}case"memo_and_receipt":{const ot=h?.attachments??[],Lt=U?.fetchState==="In-Progress",Nt=vo=>{if(vo.stopPropagation(),ot.length===0||h==null)return;if(ds==null){console.warn("webV2MicroServiceEndpoint is not available, cannot fetch attachments.");return}dn(ot[0]),oo(0),Xe(!0);const jn=ot.map(ri=>ri.id),Ln=`${ds}/transaction_attachments`;ES(Ln,H,{transaction_key:{transaction_id:h.id,transaction_type:h.type},attachment_ids:jn}).then(ri=>{Dn(ri),ri.length>0&&To(ri[0])})},qn=vo=>{vo.stopPropagation(),Zs.current?.click()};return t.jsxRuntimeExports.jsx(fa,{windowSize:f,wrapperWidth:Ot.width,widthPercentage:fo,"data-testid":_("memo-field",Qm(E,yc,m.toString())),children:t.jsxRuntimeExports.jsxs(Tbs,{onClick:vo=>vo.stopPropagation(),children:[ge!=null?t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",data:ge,variant:"multi-information-points",arrow:!0,style:{maxHeight:"min(60vh, 360px)",overflowY:"auto",overflowX:"hidden"},children:t.jsxRuntimeExports.jsx(jbs,{"data-testid":_("memo-icon",E),style:{color:C?Ee.colors.primary:Ee.colors.champion}})}):t.jsxRuntimeExports.jsx(ybs,{style:{margin:0},children:Um}),Lt?t.jsxRuntimeExports.jsx(Et,{size:"Small",style:{display:"flex"},start:!0}):ot.length===0?t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:X7s,arrow:!0,enterDelay:600,children:t.jsxRuntimeExports.jsx(fbs,{"data-testid":_("upload-receipt-icon",E),style:{margin:0},onClick:vo=>{vo.stopPropagation(),qn(vo)}})}):ot.length===1?t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",title:ebs,arrow:!0,enterDelay:600,children:t.jsxRuntimeExports.jsx(Lbs,{"data-testid":_("view-receipt-icon",E),style:{color:C?Ee.colors.primary:Ee.colors.champion},onClick:Nt})}):t.jsxRuntimeExports.jsx(Le,{display:"flex",placement:"bottom",arrow:!0,title:tbs,enterDelay:600,children:t.jsxRuntimeExports.jsx(Bbs,{"data-testid":_("view-receipts-icon",E),style:{color:C?Ee.colors.primary:Ee.colors.hero},onClick:Nt})}),t.jsxRuntimeExports.jsx(yu,{name:`transaction-receipt-${x.transactionId}`,fileRef:Zs,sizeLimit:o5,multiple:!0,acceptableTypes:[...Q.SUPPORTED_TRANSACTION_LINE_ATTACHMENT_FILE_TYPES],onFileChange:vo=>{const jn=vo.target.files;if(jn!=null&&jn.length>0){const Ln=Array.from(jn);Y(S,x.transactionId,Z??Ng,Ln,Ln.map(ri=>ri.name))}},onFileSizeError:()=>{}})]})},Mt)}}})},ks=h?.attachments??[],_o=qt??ks[0];return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[Kt(),no&&ks.length>0&&_o!=null?Ns.createPortal(t.jsxRuntimeExports.jsx(Q5,{allFiles:kn,fileSource:on,file:_o,title:_o.fileName,attachments:ks,showNavigation:!1,setFileSource:To,setShowFullScreenView:Xe,onCrossClick:()=>{Xe(!1),To(null),Dn([]),dn(void 0),oo(0)},onNextClick:()=>{const Ct=(ft+1)%ks.length;oo(Ct),dn(ks[Ct]),kn[Ct]!=null&&To(kn[Ct])},onPreviousClick:()=>{const Ct=(ft-1+ks.length)%ks.length;oo(Ct),dn(ks[Ct]),kn[Ct]!=null&&To(kn[Ct])},setSelectedFileAttachment:Ct=>{dn(typeof Ct=="function"?Ot=>Ct(Ot??ks[0]):Ct)},handleTouchStart:Ct=>Hs(Ct.targetTouches[0].clientX),handleTouchMove:Ct=>Go(Ct.targetTouches[0].clientX),handleTouchEnd:()=>{if(Yn-yn>50&&yn!==0&&ft<ks.length-1){const Ct=ft+1;oo(Ct),dn(ks[Ct]),kn[Ct]!=null&&To(kn[Ct]),Hs(0),Go(0)}else if(Yn-yn<-50&&yn!==0&&ft>0){const Ct=ft-1;oo(Ct),dn(ks[Ct]),kn[Ct]!=null&&To(kn[Ct]),Hs(0),Go(0)}}}),document.body):null]})},y5e=({isEnabled:e,isMisCategorized:n,hasRecommendations:i,isTooltipVisible:r=!1,type:a})=>e?r?t.jsxRuntimeExports.jsx(Cbs,{"data-testid":_("recommendation-icon",a)}):t.jsxRuntimeExports.jsx(bbs,{className:"ai-icon-selected-plain","data-testid":_("recommendation-icon",a)}):!e&&n||i?r?t.jsxRuntimeExports.jsx(Ebs,{"data-testid":_("recommendation-icon",a)}):t.jsxRuntimeExports.jsx(wbs,{"data-testid":_("recommendation-icon",a)}):null,Fk=({children:e})=>t.jsxRuntimeExports.jsx(NPe,{children:e}),oF=({recommendations:e,isCOTEnabled:n,type:i,isReviewTab:r,selectedValueLabel:a,isEnabled:l=!1,isMisCategorized:c=!1,selectedValue:d,existingOption:u,cotTracking:m,lineId:x,openTooltipId:h,transactionId:f,isAccountOptionDisabled:y,onRecommendationClick:C,setOpenTooltipId:b})=>{const E=g.useMemo(()=>`${f}:${x}:${i}`,[f,x,i]),$=h===E,S=ro().analytics,{createAlternateRecommendationCallback:k}=y8(),T=g.useCallback(M=>{const F=e[1],V=e[0];k(i,{currentValue:a??Ng,transactionCurrentStatus:r?"pending_review":"auto_categorized",transactionPage:"list_page",cotTracking:m?{transactionId:f,lineId:x,onCOTView:(N,H,W,U)=>{m.onCOTView?.(N,H,W,U)}}:void 0},F,V)(M)},[k,e,a,r,i,m,x,f]),A=V9(e,i,n,u,"list_page",r?"pending_review":"auto_categorized",C,T,d,y),I=DC(e,i),B=g.useCallback(()=>{b(E);const M=A?.recommendations[0]?.cot??[],F=A?.recommendations[1]?.cot??[],V=F.length>0;if(S.trackTransactionCotView({recommendationFor:i,currentValue:a??Ng,recommendation:A?.recommendations[0]?.name??Ng,recommendationCot:M,isRecommendationCotAvailable:M.length>0,recommendationReason:A?.recommendations[0]?.reason??Ng,recommendationConfidencePercentage:A?.recommendations[0]?.confidencePercentage??null,recommendationConfidenceLevel:Ic(Ia(A?.recommendations[0]?.confidencePercentage).toLocaleLowerCase()),alternativeRecommendation:A?.recommendations[1]?.name??Ng,alternativeRecommendationCot:F,isAlternativeRecommendationCotAvailable:V,alternativeRecommendationReason:A?.recommendations[1]?.reason??Ng,alternativeRecommendationConfidencePercentage:A?.recommendations[1]?.confidencePercentage??null,alternativeRecommendationConfidenceLevel:V?Ic(Ia(A?.recommendations[1]?.confidencePercentage).toLocaleLowerCase()):null,transactionCurrentStatus:r?"pending_review":"auto_categorized",transactionPage:"list_page"}),m?.onCOTView!=null){const N=f8(A);N!=null&&m.onCOTView(x,f,i,N)}},[S,A,r,a,i,x,f,E,b]),L=g.useCallback(()=>{h===E&&b(void 0)},[h,E,b]),P=g.useMemo(()=>!d||!I?!1:e.some(M=>i==="vendor"&&M.vendor!=null?M.vendor.id===d||M.vendor.qboId===d:i==="category"&&M.account!=null?M.account.qboId===d||M.account.accountId===d:i==="class"&&M.class!=null?M.class.classId===d:!1),[d,I,e,i]);if(!I)return t.jsxRuntimeExports.jsx(NPe,{});const D=l||P;return A?t.jsxRuntimeExports.jsx(Fk,{children:t.jsxRuntimeExports.jsx(Le,{variant:"chain-of-thought",data:A,placement:"bottom-start",disableIntersectionObserver:!0,position:"static",display:"block",open:$,style:{width:"auto",height:"auto"},leaveDelay:200,onOpen:B,onClose:L,children:t.jsxRuntimeExports.jsx($bs,{"data-testid":_("recommendation-icon",i),children:t.jsxRuntimeExports.jsx(y5e,{isEnabled:D,isMisCategorized:c,hasRecommendations:I,isTooltipVisible:$})})})}):t.jsxRuntimeExports.jsx(Fk,{children:t.jsxRuntimeExports.jsx(y5e,{isEnabled:D,isMisCategorized:c,hasRecommendations:I,isTooltipVisible:$,type:i})})},zPe=({isAccountingClassesEnabled:e,showProjectField:n})=>{const i=X(),r=mr(),a=MB(),l=r?Aq:vq(e,n);return t.jsxRuntimeExports.jsx(abs,{$flexibleWidth:a,windowSize:i,isQuickViewMode:r,children:l.map((c,d)=>{const u=`${d}${J7s}${c.key}`,m=Sq(c,e,n);switch(c.key){case"activity":return t.jsxRuntimeExports.jsx(FPe,{},u);case"vendor":return t.jsxRuntimeExports.jsx(fa,{windowSize:i,wrapperWidth:c.width,widthPercentage:m,isQuickViewMode:r,isSticky:c.isSticky,style:c.customStyle?.common,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:i,isLastItem:d===l.length-1,children:t.jsxRuntimeExports.jsxs(jV,{children:[t.jsxRuntimeExports.jsx(xs,{width:p[4],height:p[4]}),t.jsxRuntimeExports.jsx(fe,{height:p[4],width:p[12],style:{display:"flex",alignItems:"center"}})]})})},u);default:{const x=d===l.length-1;return t.jsxRuntimeExports.jsx(fa,{isLastItem:x,windowSize:i,wrapperWidth:c.width,widthPercentage:m,isQuickViewMode:r,style:c.customStyle?.common,children:t.jsxRuntimeExports.jsx(Bh,{windowSize:i,isLastItem:x,children:t.jsxRuntimeExports.jsx(fe,{width:"100%",height:p[4],style:{display:"flex",alignItems:"center"}})})},u)}}})})},FPe=s.div`
69245
69245
  width: ${o.sp0};
69246
69246
  height: ${o.sp0};
69247
69247
  `,rbs=s.div`
@@ -69710,7 +69710,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
69710
69710
  `,t9s=s.div`
69711
69711
  box-sizing: border-box;
69712
69712
  border-bottom: 1px solid ${e=>e.theme.colors.grey2};
69713
- `,o9s=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M7.73364 5.75V8.75L10.2336 10.25",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M4.94497 5.41509L2.45001 5.57365L2.29144 3.07868",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M12.1238 12.3564C12.9856 11.5725 13.5974 10.552 13.8826 9.42236C14.1678 8.29274 14.1138 7.10414 13.7273 6.00504C13.3408 4.90595 12.6391 3.94511 11.7097 3.24258C10.7802 2.54005 9.66441 2.12698 8.50157 2.05499C7.33874 1.98299 6.18048 2.25526 5.1715 2.83778C4.16252 3.42029 3.19185 4.62637 3.19185 4.62637",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M3.71814 12.2044C3.00509 11.4799 2.48879 10.5854 2.21814 9.60562",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M9.5 13.8125C8.5163 14.0679 7.4837 14.0679 6.5 13.8125",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),{common:n9s,transactionDetail:{notCategorizedTooltipText:s9s},expenseAutomation:{transactions:i9s}}=O.getLocalizedStrings(),VPe=g.createContext({headerHeight:0,headerNode:null,totalMinWidth:void 0}),r9s=g.forwardRef(function({children:n,style:i,...r},a){const{headerHeight:l,headerNode:c,totalMinWidth:d}=g.useContext(VPe),u=i;return t.jsxRuntimeExports.jsxs("div",{ref:a,style:{...u,position:"relative",height:(u.height??0)+l,minWidth:d},...r,children:[c,n]})}),a9s=({selectedTab:e,transactionView:n,authParams:i,sectionId:r,isAccountingClassesEnabled:a,showProjectField:l,isCOTEnabled:c,isCreateTransferEntryFromExpenseEnabled:d,isDisabled:u,vendorSearchAutoCompleteActions:m,isTransactionActivityEnabled:x,vendorSearchAutoCompleteData:h,setCurrentTransactionInAction:f,vendorLoadOptions:y,onTransactionCategorizationRowClick:C,onUpdateTransactionCategorizationUIState:b,onFetchTransactionCategorizationList:E,containerRef:$,cotTracking:R,isUncategorizedExpenseCategoryEnabled:S,onOpenTransferDrawer:k,setActivityLogTransactionId:T,onUploadTransactionReceipt:A,onUpdateScrollYOffSetTransactionCategorizationUIState:I})=>{const B=X(),L=mr(),[P,D]=g.useState(void 0),[M,F]=g.useState(null),{fetchState:V,uiState:N,transactionLocalData:H,selectedCheckBoxTransactionIds:W,transactionIdsWithUnsavedData:U,transactions:Y,uncategorizedAccounts:q,inFlightCategoryClassRecommendationsByTransactionId:Z}=n;qs({componentName:`expense_automation.transaction_categorization.${e}`,enabled:V==="Completed"});const G=g.useMemo(()=>Y.map(Te=>Vu(Te.id)),[Y]);Y0("transaction_categorization",G);const K=g.useRef(null),J=g.useRef({}),oe=g.useRef(null),ee=g.useMemo(()=>t.debounce(()=>{const Te=oe.current??0;oe.current=null,K.current?.resetAfterIndex(Te,!1)},50),[]),{control:te}=t.useFormContext();g.useEffect(()=>{J.current={},K.current?.resetAfterIndex(0,!0)},[B,H,L]),g.useEffect(()=>{const Te=N.scrollPosition?.scrollTop??0;K.current?.scrollTo(Te)},[e]);const[se,ie]=g.useState(0),re=g.useCallback(Te=>{Te!=null&&ie(Te.getBoundingClientRect().height)},[]),ne=DPe(a,l).value(B),me=g.useCallback(Te=>{if(J.current?.[Te]!=null)return J.current[Te];if(H[Te]==null)return Wb+rS;const Re=H[Te].transactionReviewLocalData,ke=Re.tabSpecificLineItems?.[e]??[],Oe=ke.length>0?ke.length:Object.keys(Re.lineItemById).length;return Oe!=null&&!isNaN(Oe)&&Oe>1?Wb*Oe+rS:Wb+rS},[H,B,N.sortKey,N.sortOrder,e]),pe=g.useCallback((Te,Re)=>{J.current[Te]!==Re&&(J.current[Te]=Re,oe.current=oe.current==null?Te:Math.min(oe.current,Te),ee())},[B,H,N.sortKey,N.sortOrder,ee]),je=g.useCallback(()=>{(N.pageToken!=null&&n.refreshStatus.fetchState!=="In-Progress"||n.refreshStatus.fetchState==="Completed")&&E(e,N.searchString,!0,N.pageToken,!0,!1)},[n.refreshStatus.fetchState,E,e,N.pageToken,N.searchString,N.sortKey,N.sortOrder]),ce=g.useCallback(()=>{N.pageToken!=null&&je()},[je,N.pageToken,N.sortKey,N.sortOrder]),de=g.useMemo(()=>t.debounce(Te=>I(e,{scrollPosition:{scrollTop:Te}}),1e3,{trailing:!0}),[e]),ue=Te=>Te<n.transactionLocalData.length,le=(Te,Re)=>{b(e,{sortOrder:Re,sortKey:Te}),E(e,N.searchString,!1,null,!1,!0)},ae=Te=>{if(Z?.[Te]===!0)return!0;if(e==="autoCategorized")return!W.includes(Te);const Re=H.find(Oe=>Oe.transactionId===Te)?.transactionReviewLocalData,ke=Y.find(Oe=>Oe.id===Te);return ke!=null&&Re!=null?Q.checkIfAllLineItemsAreCategoryClassFilled(ke,Re,q,S,a)?S===!0&&Q.isAnyItemWithUncategorizedExpenseAccount(q,Re.lineItemById,["expense"])?U.includes(Te)===!1:!1:!0:W.length===0?!0:!W.includes(Te)},ge=Te=>{const Re=ae(Te);let ke=!1;if(S===!0&&Re===!0&&e==="review"){const Oe=H.find(Me=>Me.transactionId===Te);Oe!=null&&Q.isAnyItemWithUncategorizedExpenseAccount(q,Oe.transactionReviewLocalData.lineItemById,["expense"])&&(ke=!U.includes(Te))}return{isCheckboxDisabled:Re,showException:ke,exceptionInfo:ke?s9s:void 0}};let ye=[];(V==="Completed"||n.transactionLocalData.length>0)&&(ye=H.map(Te=>Te.transactionId));const he={label:"All",value:"allTransactionOptionId",defaultChecked:!1,groupLabel:!1},{title:Ce,subTitle:we}=Kr("transaction_categorization").allDoneText,ve=H.map(Te=>Te.transactionId),Ee=g.useMemo(()=>n.totalCountByTab[e],[e,n.totalCountByTab]),Se=g.useMemo(()=>N.pageToken!=null?H.length+1:H.length,[H,N.pageToken]),$e=g.useCallback(Te=>`${H[Te]?.transactionId??""}-${Te}`,[H]),Be=g.useCallback(({scrollOffset:Te})=>{de(Te)},[de]),Ae=n.uiState.scrollPosition?.scrollTop,_e=V==="Completed"&&H.length===0;return t.jsxRuntimeExports.jsx(g9s,{windowSize:B,$isQuickViewMode:L,isInitialLoading:V==="Not-Started"||V==="In-Progress"&&H.length===0,"data-testid":_("transaction-categorization-list-table-wrapper"),children:t.jsxRuntimeExports.jsx(f9s,{windowSize:B,$isQuickViewMode:L,"data-testid":_("transaction-categorization-list-table-container"),children:V==="Error"?t.jsxRuntimeExports.jsxs(j9s,{windowSize:B,"data-testid":_("transaction-categorization-reload-page"),children:[t.jsxRuntimeExports.jsx(C9s,{onClick:()=>E(e,void 0,!0,null,!1,!0),"data-testid":_("transaction-categorization-reload-icon"),children:t.jsxRuntimeExports.jsx(An,{})}),t.jsxRuntimeExports.jsx(b9s,{"data-testid":_("transaction-categorization-reload-label"),children:n9s.reloadPage.label})]}):_e?t.jsxRuntimeExports.jsx(uu,{tab:"transaction_categorization",title:Ce,subTitle:we,"data-testid":_("transaction-categorization-empty-table-section")}):V==="Not-Started"||V==="In-Progress"&&H.length===0?t.jsxRuntimeExports.jsx(Ubs,{sortConfig:{sortKey:N.sortKey,sortOrder:N.sortOrder},fetchState:V,isAccountingClassesEnabled:a,showProjectField:l,onColumnSortConfigChanged:le,"data-testid":_("transaction-categorization-list-table-empty-table")}):t.jsxRuntimeExports.jsx(y9s,{windowSize:B,$isQuickViewMode:L,"data-testid":_("transaction-categorization-list-table-view"),children:t.jsxRuntimeExports.jsx(t.Controller,{control:te,name:"selectedTransactionIds",defaultValue:[],render:({field:{value:Te,ref:Re,onChange:ke}})=>{const Oe=L?void 0:CV+ne+Nk,Me=t.jsxRuntimeExports.jsx(WPe,{ref:re,children:t.jsxRuntimeExports.jsxs(w9s,{children:[!L&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Hk,{type:"left",children:t.jsxRuntimeExports.jsx(tB,{selectionLimit:Q.MAX_SELECTION_LIMIT,value:Te,checkBoxContainerStyle:{width:"auto",backgroundColor:"inherit"},checkBox:{label:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),value:"allTransactionOptionId",defaultChecked:!1,groupLabel:!1},isDisabled:"disabled",groupLabelCheckBox:he,allCheckBoxValues:ye,mode:"off",draggable:!1,checkBoxStyle:{padding:0},labelCheckBoxStyle:{padding:0},name:"transactionCategorizationHeader",index:0,onChangeHandler:Ne=>oB({event:Ne,value:Te,allCheckBoxValues:ye,groupLabelCheckBox:he,onChange:ke}),ref:Re})}),t.jsxRuntimeExports.jsx(Wk,{type:"left"})]}),t.jsxRuntimeExports.jsx(E9s,{isQuickViewMode:L,children:t.jsxRuntimeExports.jsx(_Pe,{isAccountingClassesEnabled:a,showProjectField:l,sortConfig:{sortKey:N.sortKey,sortOrder:N.sortOrder},isDisabled:u,onColumnSortConfigChanged:le})}),!L&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Hk,{type:"right"}),t.jsxRuntimeExports.jsx(Wk,{type:"right"})]})]})}),Ie={value:Te,allCheckBoxValues:ye,groupLabelCheckBox:he,categorizationGroupValue:ve,transactionLocalData:H,isQuickViewMode:L,mode:"always_on",setRowHeight:pe,isItemLoaded:ue,ref:Re,onChange:ke,selectedCheckBoxTransactionIds:W,isAccountingClassesEnabled:a,showProjectField:l,isTransactionActivityEnabled:x,setActivityLogTransactionId:T,contentWidth:ne,buildCheckboxMeta:ge,transactionView:n,authParams:i,sectionId:r,isCOTEnabled:c,vendorSearchAutoCompleteActions:m,vendorSearchAutoCompleteData:h,setCurrentTransactionInAction:f,vendorLoadOptions:y,onTransactionCategorizationRowClick:C,containerRef:$,listRef:K,cotTracking:R,openTooltipId:P,setOpenTooltipId:D,isUncategorizedExpenseCategoryEnabled:S,isCreateTransferEntryFromExpenseEnabled:d,onOpenTransferDrawer:k,onUploadTransactionReceipt:A,selectedTab:e,hoveredTransactionId:M,setHoveredTransactionId:F,itemCount:Se,headerHeight:se};return t.jsxRuntimeExports.jsx(t.AutoSizer,{style:Dbs,children:({height:Ne,width:Pe})=>{if(Ne<=0||Pe<=0)return null;const Ue=!L&&ne+CV+Nk<=Pe;return t.jsxRuntimeExports.jsx(BPe,{value:Ue,children:t.jsxRuntimeExports.jsx(VPe.Provider,{value:{headerHeight:se,headerNode:Me,totalMinWidth:Oe},children:t.jsxRuntimeExports.jsx(Obs,{style:{height:Ne,width:Pe},children:t.jsxRuntimeExports.jsx(t.InfiniteLoader,{isItemLoaded:ue,itemCount:Ee,loadMoreItems:ce,children:({onItemsRendered:Je,ref:tt})=>t.jsxRuntimeExports.jsx(t.VariableSizeList,{ref:Qe=>{tt(Qe),K.current=Qe},height:Ne,width:Pe,itemCount:Se,itemSize:me,style:{...zbs,borderRadius:L?o.sp2:o.sp0},innerElementType:r9s,onItemsRendered:Je,onScroll:Be,overscanCount:Nwe,itemData:Ie,itemKey:$e,initialScrollOffset:Ae,children:m9s})})})})})}})}})})})})};function l9s({transactionId:e,children:n}){const i=u6({transactionId:e,rowEntityType:"expense_automation.transaction.row"});return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:n(i)})}function c9s({rowCommenting:e,transactionId:n}){const i=t.useTheme(),{isCommentingActive:r,totalThreadCount:a,isThreadsLoading:l,handleActiveThreadClick:c,handleAddRowCommentClick:d}=e;return r!==!0?null:t.jsxRuntimeExports.jsx(d9s,{children:t.jsxRuntimeExports.jsx(u9s,{children:t.jsxRuntimeExports.jsx(p9s,{children:a>0?t.jsxRuntimeExports.jsx(ra,{isLoading:l,count:a,style:{backgroundColor:i.colors.grey4,borderRadius:"50% 50% 50% 0",cursor:"pointer"},openThread:c}):l===!1?t.jsxRuntimeExports.jsx(m4,{className:"comment-add-icon","data-testid":_("expense-automation-transaction-row-add-comment",n),onClick:d}):null})})})}const d9s=s.div`
69713
+ `,o9s=e=>j.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M7.73364 5.75V8.75L10.2336 10.25",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M4.94497 5.41509L2.45001 5.57365L2.29144 3.07868",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M12.1238 12.3564C12.9856 11.5725 13.5974 10.552 13.8826 9.42236C14.1678 8.29274 14.1138 7.10414 13.7273 6.00504C13.3408 4.90595 12.6391 3.94511 11.7097 3.24258C10.7802 2.54005 9.66441 2.12698 8.50157 2.05499C7.33874 1.98299 6.18048 2.25526 5.1715 2.83778C4.16252 3.42029 3.19185 4.62637 3.19185 4.62637",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M3.71814 12.2044C3.00509 11.4799 2.48879 10.5854 2.21814 9.60562",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M9.5 13.8125C8.5163 14.0679 7.4837 14.0679 6.5 13.8125",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),{common:n9s,transactionDetail:{notCategorizedTooltipText:s9s},expenseAutomation:{transactions:i9s}}=O.getLocalizedStrings(),VPe=g.createContext({headerHeight:0,headerNode:null,totalMinWidth:void 0}),r9s=g.forwardRef(function({children:n,style:i,...r},a){const{headerHeight:l,headerNode:c,totalMinWidth:d}=g.useContext(VPe),u=i;return t.jsxRuntimeExports.jsxs("div",{ref:a,style:{...u,position:"relative",height:(u.height??0)+l,minWidth:d},...r,children:[c,n]})}),a9s=({selectedTab:e,transactionView:n,authParams:i,sectionId:r,isAccountingClassesEnabled:a,showProjectField:l,isCOTEnabled:c,isCreateTransferEntryFromExpenseEnabled:d,isDisabled:u,vendorSearchAutoCompleteActions:m,isTransactionActivityEnabled:x,vendorSearchAutoCompleteData:h,setCurrentTransactionInAction:f,vendorLoadOptions:y,onTransactionCategorizationRowClick:C,onUpdateTransactionCategorizationUIState:b,onFetchTransactionCategorizationList:E,containerRef:$,cotTracking:R,isUncategorizedExpenseCategoryEnabled:S,onOpenTransferDrawer:k,setActivityLogTransactionId:T,onUploadTransactionReceipt:A,onUpdateScrollYOffSetTransactionCategorizationUIState:I})=>{const B=X(),L=mr(),[P,D]=g.useState(void 0),[M,F]=g.useState(null),{fetchState:V,uiState:N,transactionLocalData:H,selectedCheckBoxTransactionIds:W,transactionIdsWithUnsavedData:U,transactions:Y,uncategorizedAccounts:q,inFlightCategoryClassRecommendationsByTransactionId:Z}=n;qs({componentName:`expense_automation.transaction_categorization.${e}`,enabled:V==="Completed"});const G=g.useMemo(()=>Y.map(Te=>Vu(Te.id)),[Y]);Y0("transaction_categorization",G);const K=g.useRef(null),J=g.useRef({}),oe=g.useRef(null),ee=g.useMemo(()=>t.debounce(()=>{const Te=oe.current??0;oe.current=null,K.current?.resetAfterIndex(Te,!1)},50),[]),{control:te}=t.useFormContext();g.useEffect(()=>{J.current={},K.current?.resetAfterIndex(0,!0)},[B,H,L]),g.useEffect(()=>{const Te=N.scrollPosition?.scrollTop??0;K.current?.scrollTo(Te)},[e]);const[se,ie]=g.useState(0),re=g.useCallback(Te=>{Te!=null&&ie(Te.getBoundingClientRect().height)},[]),ne=DPe(a,l).value(B),me=g.useCallback(Te=>{if(J.current?.[Te]!=null)return J.current[Te];if(H[Te]==null)return Wb+rS;const Re=H[Te].transactionReviewLocalData,ke=Re.tabSpecificLineItems?.[e]??[],Oe=ke.length>0?ke.length:Object.keys(Re.lineItemById).length;return Oe!=null&&!isNaN(Oe)&&Oe>1?Wb*Oe+rS:Wb+rS},[H,B,N.sortKey,N.sortOrder,e]),pe=g.useCallback((Te,Re)=>{J.current[Te]!==Re&&(J.current[Te]=Re,oe.current=oe.current==null?Te:Math.min(oe.current,Te),ee())},[B,H,N.sortKey,N.sortOrder,ee]),je=g.useCallback(()=>{(N.pageToken!=null&&n.refreshStatus.fetchState!=="In-Progress"||n.refreshStatus.fetchState==="Completed")&&E(e,N.searchString,!0,N.pageToken,!0,!1)},[n.refreshStatus.fetchState,E,e,N.pageToken,N.searchString,N.sortKey,N.sortOrder]),ce=g.useCallback(()=>{N.pageToken!=null&&je()},[je,N.pageToken,N.sortKey,N.sortOrder]),de=g.useMemo(()=>t.debounce(Te=>I(e,{scrollPosition:{scrollTop:Te}}),1e3,{trailing:!0}),[e]),ue=Te=>Te<n.transactionLocalData.length,le=(Te,Re)=>{b(e,{sortOrder:Re,sortKey:Te}),E(e,N.searchString,!1,null,!1,!0)},ae=Te=>{if(Z?.[Te]===!0)return!0;if(e==="autoCategorized")return!W.includes(Te);const Re=H.find(Oe=>Oe.transactionId===Te)?.transactionReviewLocalData,ke=Y.find(Oe=>Oe.id===Te);return ke!=null&&Re!=null?Q.checkIfAllLineItemsAreCategoryClassFilled(ke,Re,q,S,a)?S===!0&&Q.isAnyItemWithUncategorizedExpenseAccount(q,Re.lineItemById,["expense"])?U.includes(Te)===!1:!1:!0:W.length===0?!0:!W.includes(Te)},ge=Te=>{const Re=ae(Te);let ke=!1;if(S===!0&&Re===!0&&e==="review"){const Oe=H.find(Me=>Me.transactionId===Te);Oe!=null&&Q.isAnyItemWithUncategorizedExpenseAccount(q,Oe.transactionReviewLocalData.lineItemById,["expense"])&&(ke=!U.includes(Te))}return{isCheckboxDisabled:Re,showException:ke,exceptionInfo:ke?s9s:void 0}};let ye=[];(V==="Completed"||n.transactionLocalData.length>0)&&(ye=H.map(Te=>Te.transactionId));const he={label:"All",value:"allTransactionOptionId",defaultChecked:!1,groupLabel:!1},{title:Ce,subTitle:we}=Kr("transaction_categorization").allDoneText,ve=H.map(Te=>Te.transactionId),Ee=g.useMemo(()=>n.totalCountByTab[e],[e,n.totalCountByTab]),Se=g.useMemo(()=>N.pageToken!=null?H.length+1:H.length,[H,N.pageToken]),$e=g.useCallback(Te=>`${H[Te]?.transactionId??""}-${Te}`,[H]),Be=g.useCallback(({scrollOffset:Te})=>{de(Te)},[de]),Ae=n.uiState.scrollPosition?.scrollTop,_e=V==="Completed"&&H.length===0;return t.jsxRuntimeExports.jsx(g9s,{windowSize:B,$isQuickViewMode:L,isInitialLoading:V==="Not-Started"||V==="In-Progress"&&H.length===0,"data-testid":_("transaction-categorization-list-table-wrapper"),children:t.jsxRuntimeExports.jsx(f9s,{windowSize:B,$isQuickViewMode:L,"data-testid":_("transaction-categorization-list-table-container"),children:V==="Error"?t.jsxRuntimeExports.jsxs(j9s,{windowSize:B,"data-testid":_("transaction-categorization-reload-page"),children:[t.jsxRuntimeExports.jsx(C9s,{onClick:()=>E(e,void 0,!0,null,!1,!0),"data-testid":_("transaction-categorization-reload-icon"),children:t.jsxRuntimeExports.jsx(An,{})}),t.jsxRuntimeExports.jsx(b9s,{"data-testid":_("transaction-categorization-reload-label"),children:n9s.reloadPage.label})]}):_e?t.jsxRuntimeExports.jsx(uu,{tab:"transaction_categorization",title:Ce,subTitle:we,"data-testid":_("transaction-categorization-empty-table-section")}):V==="Not-Started"||V==="In-Progress"&&H.length===0?t.jsxRuntimeExports.jsx(Ubs,{sortConfig:{sortKey:N.sortKey,sortOrder:N.sortOrder},fetchState:V,isAccountingClassesEnabled:a,showProjectField:l,onColumnSortConfigChanged:le,"data-testid":_("transaction-categorization-list-table-empty-table")}):t.jsxRuntimeExports.jsx(y9s,{windowSize:B,$isQuickViewMode:L,"data-testid":_("transaction-categorization-list-table-view"),children:t.jsxRuntimeExports.jsx(t.Controller,{control:te,name:"selectedTransactionIds",defaultValue:[],render:({field:{value:Te,ref:Re,onChange:ke}})=>{const Oe=L?void 0:CV+ne+Nk,Me=t.jsxRuntimeExports.jsx(WPe,{ref:re,children:t.jsxRuntimeExports.jsxs(w9s,{children:[!L&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Hk,{type:"left",children:t.jsxRuntimeExports.jsx(tB,{selectionLimit:Q.MAX_SELECTION_LIMIT,value:Te,checkBoxContainerStyle:{width:"auto",backgroundColor:"inherit"},checkBox:{label:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),value:"allTransactionOptionId",defaultChecked:!1,groupLabel:!1},isDisabled:"disabled",groupLabelCheckBox:he,allCheckBoxValues:ye,mode:"off",draggable:!1,checkBoxStyle:{padding:0},labelCheckBoxStyle:{padding:0},name:"transactionCategorizationHeader",index:0,onChangeHandler:Ne=>oB({event:Ne,value:Te,allCheckBoxValues:ye,groupLabelCheckBox:he,onChange:ke}),ref:Re})}),t.jsxRuntimeExports.jsx(Wk,{type:"left"})]}),t.jsxRuntimeExports.jsx(E9s,{isQuickViewMode:L,children:t.jsxRuntimeExports.jsx(_Pe,{isAccountingClassesEnabled:a,showProjectField:l,sortConfig:{sortKey:N.sortKey,sortOrder:N.sortOrder},isDisabled:u,onColumnSortConfigChanged:le})}),!L&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Hk,{type:"right"}),t.jsxRuntimeExports.jsx(Wk,{type:"right"})]})]})}),Ie={value:Te,allCheckBoxValues:ye,groupLabelCheckBox:he,categorizationGroupValue:ve,transactionLocalData:H,isQuickViewMode:L,mode:"always_on",setRowHeight:pe,isItemLoaded:ue,ref:Re,onChange:ke,selectedCheckBoxTransactionIds:W,isAccountingClassesEnabled:a,showProjectField:l,isTransactionActivityEnabled:x,setActivityLogTransactionId:T,contentWidth:ne,buildCheckboxMeta:ge,transactionView:n,authParams:i,sectionId:r,isCOTEnabled:c,vendorSearchAutoCompleteActions:m,vendorSearchAutoCompleteData:h,setCurrentTransactionInAction:f,vendorLoadOptions:y,onTransactionCategorizationRowClick:C,containerRef:$,listRef:K,cotTracking:R,openTooltipId:P,setOpenTooltipId:D,isUncategorizedExpenseCategoryEnabled:S,isCreateTransferEntryFromExpenseEnabled:d,onOpenTransferDrawer:k,onUploadTransactionReceipt:A,selectedTab:e,hoveredTransactionId:M,setHoveredTransactionId:F,itemCount:Se,headerHeight:se};return t.jsxRuntimeExports.jsx(t.AutoSizer,{style:Dbs,children:({height:Ne,width:Pe})=>{if(Ne<=0||Pe<=0)return null;const Qe=!L&&ne+CV+Nk<=Pe;return t.jsxRuntimeExports.jsx(BPe,{value:Qe,children:t.jsxRuntimeExports.jsx(VPe.Provider,{value:{headerHeight:se,headerNode:Me,totalMinWidth:Oe},children:t.jsxRuntimeExports.jsx(Obs,{style:{height:Ne,width:Pe},children:t.jsxRuntimeExports.jsx(t.InfiniteLoader,{isItemLoaded:ue,itemCount:Ee,loadMoreItems:ce,children:({onItemsRendered:Je,ref:tt})=>t.jsxRuntimeExports.jsx(t.VariableSizeList,{ref:Ue=>{tt(Ue),K.current=Ue},height:Ne,width:Pe,itemCount:Se,itemSize:me,style:{...zbs,borderRadius:L?o.sp2:o.sp0},innerElementType:r9s,onItemsRendered:Je,onScroll:Be,overscanCount:Nwe,itemData:Ie,itemKey:$e,initialScrollOffset:Ae,children:m9s})})})})})}})}})})})})};function l9s({transactionId:e,children:n}){const i=u6({transactionId:e,rowEntityType:"expense_automation.transaction.row"});return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:n(i)})}function c9s({rowCommenting:e,transactionId:n}){const i=t.useTheme(),{isCommentingActive:r,totalThreadCount:a,isThreadsLoading:l,handleActiveThreadClick:c,handleAddRowCommentClick:d}=e;return r!==!0?null:t.jsxRuntimeExports.jsx(d9s,{children:t.jsxRuntimeExports.jsx(u9s,{children:t.jsxRuntimeExports.jsx(p9s,{children:a>0?t.jsxRuntimeExports.jsx(ra,{isLoading:l,count:a,style:{backgroundColor:i.colors.grey4,borderRadius:"50% 50% 50% 0",cursor:"pointer"},openThread:c}):l===!1?t.jsxRuntimeExports.jsx(m4,{className:"comment-add-icon","data-testid":_("expense-automation-transaction-row-add-comment",n),onClick:d}):null})})})}const d9s=s.div`
69714
69714
  position: sticky;
69715
69715
  right: ${Nk}px;
69716
69716
  flex: 0 0 0;
@@ -69829,7 +69829,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
69829
69829
  box-sizing: border-box;
69830
69830
  border-top: ${e=>e.isFirstItem!==!0?`1px solid ${e.theme.colors.grey2}`:"none"};
69831
69831
  border-bottom: ${e=>e.isQuickViewMode!==!0&&e.isLastItem===!0?`1px solid ${e.theme.colors.grey2}`:"none"};
69832
- `,$9s=({selectedTab:e,transactionView:n,authParams:i,sectionId:r,vendorSearchAutoCompleteData:a,vendorSearchAutoCompleteActions:l,isAccountingClassesEnabled:c,isCOTEnabled:d,isCreateTransferEntryFromExpenseEnabled:u,isProjectsTransactionsEnabled:m,isTransactionActivityEnabled:x,setCurrentFooterFormId:h,setLocalDataForCategoryAndClass:f,onTransactionCategorizationRowClick:y,onUpdateTransactionCategorizationUIState:C,onUpdateScrollYOffSetTransactionCategorizationUIState:b,onFetchTransactionCategorizationList:E,onSaveUpdateTransactionCategorization:$,onUpdateSelectedCheckboxTransactionIds:R,onFetchRecommendationsForEntityCategorization:S,onFetchRecommendationsForEntityCategorizationWithCustomer:k,onOpenTransferRightPanel:T,setActivityLogTransactionId:A,onUploadTransactionReceipt:I})=>{const[B,L]=g.useState({transactionId:void 0,lineItemId:void 0}),P=g.useRef(),D=g.useRef({}),{useDynamicConfig:M}=Dc(),{configValue:F}=M(Fx.enableUncategorizedExpenseCategory),V=F?.uncategorized_expense_category_enabled===!0,N=(pe,je,ce,de)=>{const ue={...D.current};ue[je]==null&&(ue[je]=[]);let le=ue[je].findIndex(ge=>ge.lineId===pe);if(le===-1){const ge={lineId:pe,category:{recommendationTypesViewed:[]},class:{recommendationTypesViewed:[]},vendor:{recommendationTypesViewed:[]},project:{recommendationTypesViewed:[]}};ue[je].push(ge),le=ue[je].length-1}else{const ge=ue[je][le];ue[je][le]={...ge,category:{...ge.category,recommendationTypesViewed:[...ge.category.recommendationTypesViewed]},class:{...ge.class,recommendationTypesViewed:[...ge.class.recommendationTypesViewed]},vendor:{...ge.vendor,recommendationTypesViewed:[...ge.vendor.recommendationTypesViewed]},project:ge.project!=null?{...ge.project,recommendationTypesViewed:[...ge.project.recommendationTypesViewed]}:{recommendationTypesViewed:[]}}}const ae=ue[je][le][ce];de!=null&&de!==""&&ae!=null&&!ae.recommendationTypesViewed.includes(de)&&ae.recommendationTypesViewed.push(de),D.current=ue},{transactions:H,transactionLocalData:W,accountsHierarchyList:U,classHierarchyList:Y,accountList:q,classList:Z,isAccountingProjectsEnabled:G,projectList:K,selectedCheckBoxTransactionIds:J,uncategorizedAccounts:oe}=n,ee=g.useMemo(()=>K?.projects??[],[K?.projects]),te=(G??!1)&&m,se=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:g.useMemo(()=>$5e(J,W,U,Y,ee,a.entityAutoCompleteView),[U,Y,ee,J,W,a.entityAutoCompleteView]),values:g.useMemo(()=>$5e(J,W,U,Y,ee,a.entityAutoCompleteView),[U,Y,ee,J,W,a.entityAutoCompleteView]),resetOptions:{keepDefaultValues:!0,keepDirty:!1}});g.useEffect(()=>()=>{h("expenseAutomationPage")},[]),g.useEffect(()=>{J.length>0?h(tF):h("expenseAutomationPage")},[J,h]);const ie=se.handleSubmit(pe=>{const je=pe[aS],ce=D.current;$(e,je,ce),je.forEach(de=>{delete D.current[de]})}),re=async(pe,je)=>{if(pe!=null){if(pe===aS){const ce=se.getValues(aS);if(ce.length<J.length){R(e,ce);return}if(ce.length===Q.MAX_SELECTION_LIMIT){R(e,ce);return}const de=ce[ce.length-1],ue=je[K3].findIndex(ae=>ae.transactionId===de),le=se.getValues(`${K3}.${ue}.lineInfo`);if(le!=null){let ae=!1;if(le.every(ye=>(ae=Q.isAccountUncategorized(oe,ye[Ui].selectedOption,V?["income"]:void 0),!!ye[Ui].selectedOption&&ye[Ui].selectedOption!=null&&!ae&&(c===!1||!!ye[yc].selectedOption)&&!!ye[pp].selectedOption))===!0){R(e,ce);return}else{const ye=ce.filter(he=>he!==de);R(e,ye);return}}return}if(pe.includes(Ui)===!0||pe.includes(yc)===!0||pe.includes($j)===!0){const ce=parseInt(pe.split(".")[1]),de=parseInt(pe.split(".")[3]),ue=se.getValues(`${K3}.${ce}.lineInfo`),le=ue[de];if(pe.includes(Ui)||pe.includes(yc)||pe.includes($j)){const{transactionId:ae,lineId:ge,recommendations:ye}=le;if(ue!=null){const he=le[Ui].selectedOption,Ce=le[yc].selectedOption,we=le[$j]?.selectedOption,ve=le[pp].selectedOption,Ee=le[pp].selectedOption,Se=le[pp].defaultOptions,$e=Se?.find(tt=>tt.options?.find(Qe=>Qe.value===ve))?.options?.find(tt=>tt.value===ve)?.label,Be=Se?.find(tt=>tt.options?.find(Qe=>Qe.value===Ee))?.options?.find(tt=>tt.value===Ee)?.label,Ae=a.entityAutoCompleteView.vendor.find(tt=>tt.qboId===ve),_e=a.entityAutoCompleteView.customer.find(tt=>tt.qboId===Ee),Te=ye.find(tt=>tt.vendor?.qboId===ve)?.vendor,Re=ve||Ae?.qboId||Te?.qboId?{id:ve??Ae?.qboId??Te?.qboId??"",name:$e??Ae?.name??Te?.name??"",logo:Ae?.logo??Te?.logo}:void 0,ke=Ee||_e?.qboId?{id:Ee??_e?.qboId??"",name:Be??_e?.name??"",logo:_e?.logo}:void 0,Oe=q.find(tt=>tt.qboId===he),Me=Z.find(tt=>tt.classId===Ce),Ie=ee.find(tt=>tt.projectId===we),Ne=n.transactionLocalData.find(tt=>tt.transactionId===ae)?.transactionReviewLocalData.lineItemById[ge],Pe=Ne?.account,Ue=Ne?.class,Je=Ne?.project;f(e,ae,ge,H,Re?.id,ke?.id,pe.includes(Ui)&&Oe!=null?{...Oe,isPreFilled:!1}:Pe,pe.includes(yc)&&Me!=null?{...Me,isPreFilled:!1}:Ue,void 0,ye,V,c,pe.includes($j)&&Ie!=null?{projectId:Ie.projectId,projectName:Ie.projectName,accountingProviderProjectId:Ie.accountingProviderProjectId}:Je)}return}}if(pe.includes(pp)){const ce=parseInt(pe.split(".")[1]),de=parseInt(pe.split(".")[3]),ue=se.getValues(`${K3}.${ce}.lineInfo`);if(ue!=null){const le=ue[de],{transactionId:ae,recommendations:ge}=le,ye=le[pp].selectedOption,he=le[pp].selectedOption,Ce=le[pp].defaultOptions,we=Ce?.flatMap(ke=>ke.options)?.find(ke=>ke.value===ye)?.label,ve=Ce?.flatMap(ke=>ke.options)?.find(ke=>ke.value===he)?.label,Ee=a.entityAutoCompleteView.vendor.find(ke=>ke.qboId===ye),Se=a.entityAutoCompleteView.customer.find(ke=>ke.qboId===he),$e=ge.find(ke=>ke.vendor?.qboId===ye)?.vendor,Be=ye!==""&&ye!=null?ye:we!==""&&we!=null?we:"",Ae=(Ee?.qboId!=null&&Ee.qboId!==""?Ee.qboId:null)??($e?.qboId!=null&&$e.qboId!==""?$e.qboId:null)??(ye!=null&&ye!==""?ye:null),_e={id:Ae??we??"",name:we!=null&&we!==""?we:Ee?.name!=null&&Ee.name!==""?Ee.name:$e?.name!=null&&$e.name!==""?$e.name:Ae!=null&&Ae!==""?Ae:"",logo:Ee?.logo??$e?.logo},Te=Se?.qboId!=null&&Se.qboId!==""?{id:Se.qboId??he??"",name:ve??Se.name??"",logo:Se.logo}:void 0,Re=H.find(ke=>ke.id===ae);if(Re!=null){const ke=n.transactionLocalData.find(Pe=>Pe.transactionId===Re.id)?.transactionReviewLocalData,Oe=ke?.lineItemById[le.lineId],Me=Q.isVendorTransaction(Re)===!0?ke?.selectedEntity:Oe?.selectedEntityLine,Ie=Te?.id!=null&&Te.id!==""?{id:Te.id,name:Te.name,type:"customer",qboId:Te.id,zeniId:Te.id,logo:Te.logo}:_e.id!==""&&_e.id!=null?{id:Be,name:we!=null&&we!==""?we:Be,type:"vendor",qboId:Be,zeniId:Be,logo:_e.logo,isPreFilled:Me?.id===Ae&&Me?.isPreFilled}:void 0,Ne={transactionId:{id:Re.id,type:Re.type},transaction:Re,lineIds:Re.type!=="journal_entry"?Re.lines?.map(Pe=>Pe.id)??[]:[le.lineId]};Ie?.type==="customer"?k(le.amount.amount,Ne,!1,e,Ie,Te,V):S(le.amount.amount,Ne,!1,e,Ie,_e,V)}}l.onCancelAutoComplete?.();return}}};g.useEffect(()=>{const pe=se.watch((je,{name:ce})=>{ce!=null&&je!=null&&t.defer(()=>re(ce,je))});return()=>{pe.unsubscribe()}}),g.useEffect(()=>{if(a.entityAutoCompleteView.fetchState==="Completed"){const pe=n.transactionLocalData.find(je=>je.transactionId===B.transactionId);if(pe){const{transactionReviewLocalData:je}=pe,{selectedEntity:ce}=je,de=B?.lineItemId??je.sortedLineItems[0],ue=je.lineItemById[de],le=ue.selectedEntityLine;P.current?.(K5(a.entityAutoCompleteView,ce??le,ue?.recommendationsWithCOT??[]))}L({transactionId:void 0,lineItemId:void 0})}},[a.entityAutoCompleteView.fetchState]);const ne=(pe,je)=>{l.onAutoCompleteInputChange?.(pe),P.current=je},me=g.useRef(null);return t.jsxRuntimeExports.jsx(v9s,{ref:me,"data-testid":_("transaction-categorization-list-page"),children:t.jsxRuntimeExports.jsx(t.FormProvider,{...se,children:t.jsxRuntimeExports.jsx("form",{id:E5e(tF),onSubmit:ie,style:{height:"100%",width:"100%"},"data-testid":_(E5e(tF)),children:t.jsxRuntimeExports.jsx(a9s,{isAccountingClassesEnabled:c,showProjectField:te,isTransactionActivityEnabled:x,selectedTab:e,sectionId:r,transactionView:n,authParams:i,setCurrentTransactionInAction:L,onUpdateTransactionCategorizationUIState:C,onUpdateScrollYOffSetTransactionCategorizationUIState:b,onFetchTransactionCategorizationList:E,onTransactionCategorizationRowClick:y,vendorLoadOptions:ne,vendorSearchAutoCompleteData:a,vendorSearchAutoCompleteActions:l,containerRef:me,onOpenTransferDrawer:T,isCOTEnabled:d,isCreateTransferEntryFromExpenseEnabled:u,cotTracking:{onCOTView:N},isUncategorizedExpenseCategoryEnabled:V,setActivityLogTransactionId:A,onUploadTransactionReceipt:I})})})})},E5e=e=>`${e}_form`,$5e=(e,n,i,r,a,l)=>({[K3]:n.map(d=>R9s(d.transactionId,d.transactionReviewLocalData,i,r,a,l)),[aS]:e}),R9s=(e,n,i,r,a,l)=>{const{lineItemById:c,sortedLineItems:d,selectedEntity:u}=n,m=Object.values(c).sort((h,f)=>d.indexOf(h.lineId)-d.indexOf(f.lineId)),x=m[0]?.lineId;return{[OPe]:m.map(h=>{const f=h.account?.qboId??h.account?.accountId,y=h.class?.classId,C=h.selectedEntityLine;return{id:h.id,transactionId:h.transactionId,type:h.type,amount:h.amount,lineDetailType:h.lineDetailType,platformLineDetailType:h.platformLineDetailType,lineTransactionType:h.lineTransactionType,postingType:h.postingType,postingTypeName:h.postingTypeName,customer:h.customer,vendor:h.vendor,billable:h.billable,item:h.item,isCategoryMiscategorized:h.isCategoryMiscategorized,isClassMiscategorized:h.isClassMiscategorized,lineId:h.id,[Ui]:{selectedOption:f,allOptions:N9(i,h.recommendationsWithCOT)},[yc]:{selectedOption:y,allOptions:H9(r,h.recommendationsWithCOT)},[$j]:{selectedOption:h.project?.projectId,allOptions:PC(a)},[pp]:{selectedOption:u?.id??C?.id??u?.name??C?.name,defaultOptions:K5(l,u??C,n.lineItemById[x]?.recommendationsWithCOT??[])},[U7s]:h.lineEntity,[G7s]:h.recommendationsWithCOT??[]}}),transactionId:e,[Y7s]:n.vendorDetails!=null&&n.vendorDetails.id!=null?{id:n.vendorDetails.id,qboId:n.vendorDetails.qboId,name:n.vendorDetails.name}:void 0,[q7s]:n.customerDetails!=null&&n.customerDetails.id!=null?{id:n.customerDetails.id,qboId:n.customerDetails.qboId,name:n.customerDetails.name}:void 0}},v9s=s.div`
69832
+ `,$9s=({selectedTab:e,transactionView:n,authParams:i,sectionId:r,vendorSearchAutoCompleteData:a,vendorSearchAutoCompleteActions:l,isAccountingClassesEnabled:c,isCOTEnabled:d,isCreateTransferEntryFromExpenseEnabled:u,isProjectsTransactionsEnabled:m,isTransactionActivityEnabled:x,setCurrentFooterFormId:h,setLocalDataForCategoryAndClass:f,onTransactionCategorizationRowClick:y,onUpdateTransactionCategorizationUIState:C,onUpdateScrollYOffSetTransactionCategorizationUIState:b,onFetchTransactionCategorizationList:E,onSaveUpdateTransactionCategorization:$,onUpdateSelectedCheckboxTransactionIds:R,onFetchRecommendationsForEntityCategorization:S,onFetchRecommendationsForEntityCategorizationWithCustomer:k,onOpenTransferRightPanel:T,setActivityLogTransactionId:A,onUploadTransactionReceipt:I})=>{const[B,L]=g.useState({transactionId:void 0,lineItemId:void 0}),P=g.useRef(),D=g.useRef({}),{useDynamicConfig:M}=Dc(),{configValue:F}=M(Fx.enableUncategorizedExpenseCategory),V=F?.uncategorized_expense_category_enabled===!0,N=(pe,je,ce,de)=>{const ue={...D.current};ue[je]==null&&(ue[je]=[]);let le=ue[je].findIndex(ge=>ge.lineId===pe);if(le===-1){const ge={lineId:pe,category:{recommendationTypesViewed:[]},class:{recommendationTypesViewed:[]},vendor:{recommendationTypesViewed:[]},project:{recommendationTypesViewed:[]}};ue[je].push(ge),le=ue[je].length-1}else{const ge=ue[je][le];ue[je][le]={...ge,category:{...ge.category,recommendationTypesViewed:[...ge.category.recommendationTypesViewed]},class:{...ge.class,recommendationTypesViewed:[...ge.class.recommendationTypesViewed]},vendor:{...ge.vendor,recommendationTypesViewed:[...ge.vendor.recommendationTypesViewed]},project:ge.project!=null?{...ge.project,recommendationTypesViewed:[...ge.project.recommendationTypesViewed]}:{recommendationTypesViewed:[]}}}const ae=ue[je][le][ce];de!=null&&de!==""&&ae!=null&&!ae.recommendationTypesViewed.includes(de)&&ae.recommendationTypesViewed.push(de),D.current=ue},{transactions:H,transactionLocalData:W,accountsHierarchyList:U,classHierarchyList:Y,accountList:q,classList:Z,isAccountingProjectsEnabled:G,projectList:K,selectedCheckBoxTransactionIds:J,uncategorizedAccounts:oe}=n,ee=g.useMemo(()=>K?.projects??[],[K?.projects]),te=(G??!1)&&m,se=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:g.useMemo(()=>$5e(J,W,U,Y,ee,a.entityAutoCompleteView),[U,Y,ee,J,W,a.entityAutoCompleteView]),values:g.useMemo(()=>$5e(J,W,U,Y,ee,a.entityAutoCompleteView),[U,Y,ee,J,W,a.entityAutoCompleteView]),resetOptions:{keepDefaultValues:!0,keepDirty:!1}});g.useEffect(()=>()=>{h("expenseAutomationPage")},[]),g.useEffect(()=>{J.length>0?h(tF):h("expenseAutomationPage")},[J,h]);const ie=se.handleSubmit(pe=>{const je=pe[aS],ce=D.current;$(e,je,ce),je.forEach(de=>{delete D.current[de]})}),re=async(pe,je)=>{if(pe!=null){if(pe===aS){const ce=se.getValues(aS);if(ce.length<J.length){R(e,ce);return}if(ce.length===Q.MAX_SELECTION_LIMIT){R(e,ce);return}const de=ce[ce.length-1],ue=je[K3].findIndex(ae=>ae.transactionId===de),le=se.getValues(`${K3}.${ue}.lineInfo`);if(le!=null){let ae=!1;if(le.every(ye=>(ae=Q.isAccountUncategorized(oe,ye[Ui].selectedOption,V?["income"]:void 0),!!ye[Ui].selectedOption&&ye[Ui].selectedOption!=null&&!ae&&(c===!1||!!ye[yc].selectedOption)&&!!ye[pp].selectedOption))===!0){R(e,ce);return}else{const ye=ce.filter(he=>he!==de);R(e,ye);return}}return}if(pe.includes(Ui)===!0||pe.includes(yc)===!0||pe.includes($j)===!0){const ce=parseInt(pe.split(".")[1]),de=parseInt(pe.split(".")[3]),ue=se.getValues(`${K3}.${ce}.lineInfo`),le=ue[de];if(pe.includes(Ui)||pe.includes(yc)||pe.includes($j)){const{transactionId:ae,lineId:ge,recommendations:ye}=le;if(ue!=null){const he=le[Ui].selectedOption,Ce=le[yc].selectedOption,we=le[$j]?.selectedOption,ve=le[pp].selectedOption,Ee=le[pp].selectedOption,Se=le[pp].defaultOptions,$e=Se?.find(tt=>tt.options?.find(Ue=>Ue.value===ve))?.options?.find(tt=>tt.value===ve)?.label,Be=Se?.find(tt=>tt.options?.find(Ue=>Ue.value===Ee))?.options?.find(tt=>tt.value===Ee)?.label,Ae=a.entityAutoCompleteView.vendor.find(tt=>tt.qboId===ve),_e=a.entityAutoCompleteView.customer.find(tt=>tt.qboId===Ee),Te=ye.find(tt=>tt.vendor?.qboId===ve)?.vendor,Re=ve||Ae?.qboId||Te?.qboId?{id:ve??Ae?.qboId??Te?.qboId??"",name:$e??Ae?.name??Te?.name??"",logo:Ae?.logo??Te?.logo}:void 0,ke=Ee||_e?.qboId?{id:Ee??_e?.qboId??"",name:Be??_e?.name??"",logo:_e?.logo}:void 0,Oe=q.find(tt=>tt.qboId===he),Me=Z.find(tt=>tt.classId===Ce),Ie=ee.find(tt=>tt.projectId===we),Ne=n.transactionLocalData.find(tt=>tt.transactionId===ae)?.transactionReviewLocalData.lineItemById[ge],Pe=Ne?.account,Qe=Ne?.class,Je=Ne?.project;f(e,ae,ge,H,Re?.id,ke?.id,pe.includes(Ui)&&Oe!=null?{...Oe,isPreFilled:!1}:Pe,pe.includes(yc)&&Me!=null?{...Me,isPreFilled:!1}:Qe,void 0,ye,V,c,pe.includes($j)&&Ie!=null?{projectId:Ie.projectId,projectName:Ie.projectName,accountingProviderProjectId:Ie.accountingProviderProjectId}:Je)}return}}if(pe.includes(pp)){const ce=parseInt(pe.split(".")[1]),de=parseInt(pe.split(".")[3]),ue=se.getValues(`${K3}.${ce}.lineInfo`);if(ue!=null){const le=ue[de],{transactionId:ae,recommendations:ge}=le,ye=le[pp].selectedOption,he=le[pp].selectedOption,Ce=le[pp].defaultOptions,we=Ce?.flatMap(ke=>ke.options)?.find(ke=>ke.value===ye)?.label,ve=Ce?.flatMap(ke=>ke.options)?.find(ke=>ke.value===he)?.label,Ee=a.entityAutoCompleteView.vendor.find(ke=>ke.qboId===ye),Se=a.entityAutoCompleteView.customer.find(ke=>ke.qboId===he),$e=ge.find(ke=>ke.vendor?.qboId===ye)?.vendor,Be=ye!==""&&ye!=null?ye:we!==""&&we!=null?we:"",Ae=(Ee?.qboId!=null&&Ee.qboId!==""?Ee.qboId:null)??($e?.qboId!=null&&$e.qboId!==""?$e.qboId:null)??(ye!=null&&ye!==""?ye:null),_e={id:Ae??we??"",name:we!=null&&we!==""?we:Ee?.name!=null&&Ee.name!==""?Ee.name:$e?.name!=null&&$e.name!==""?$e.name:Ae!=null&&Ae!==""?Ae:"",logo:Ee?.logo??$e?.logo},Te=Se?.qboId!=null&&Se.qboId!==""?{id:Se.qboId??he??"",name:ve??Se.name??"",logo:Se.logo}:void 0,Re=H.find(ke=>ke.id===ae);if(Re!=null){const ke=n.transactionLocalData.find(Pe=>Pe.transactionId===Re.id)?.transactionReviewLocalData,Oe=ke?.lineItemById[le.lineId],Me=Q.isVendorTransaction(Re)===!0?ke?.selectedEntity:Oe?.selectedEntityLine,Ie=Te?.id!=null&&Te.id!==""?{id:Te.id,name:Te.name,type:"customer",qboId:Te.id,zeniId:Te.id,logo:Te.logo}:_e.id!==""&&_e.id!=null?{id:Be,name:we!=null&&we!==""?we:Be,type:"vendor",qboId:Be,zeniId:Be,logo:_e.logo,isPreFilled:Me?.id===Ae&&Me?.isPreFilled}:void 0,Ne={transactionId:{id:Re.id,type:Re.type},transaction:Re,lineIds:Re.type!=="journal_entry"?Re.lines?.map(Pe=>Pe.id)??[]:[le.lineId]};Ie?.type==="customer"?k(le.amount.amount,Ne,!1,e,Ie,Te,V):S(le.amount.amount,Ne,!1,e,Ie,_e,V)}}l.onCancelAutoComplete?.();return}}};g.useEffect(()=>{const pe=se.watch((je,{name:ce})=>{ce!=null&&je!=null&&t.defer(()=>re(ce,je))});return()=>{pe.unsubscribe()}}),g.useEffect(()=>{if(a.entityAutoCompleteView.fetchState==="Completed"){const pe=n.transactionLocalData.find(je=>je.transactionId===B.transactionId);if(pe){const{transactionReviewLocalData:je}=pe,{selectedEntity:ce}=je,de=B?.lineItemId??je.sortedLineItems[0],ue=je.lineItemById[de],le=ue.selectedEntityLine;P.current?.(K5(a.entityAutoCompleteView,ce??le,ue?.recommendationsWithCOT??[]))}L({transactionId:void 0,lineItemId:void 0})}},[a.entityAutoCompleteView.fetchState]);const ne=(pe,je)=>{l.onAutoCompleteInputChange?.(pe),P.current=je},me=g.useRef(null);return t.jsxRuntimeExports.jsx(v9s,{ref:me,"data-testid":_("transaction-categorization-list-page"),children:t.jsxRuntimeExports.jsx(t.FormProvider,{...se,children:t.jsxRuntimeExports.jsx("form",{id:E5e(tF),onSubmit:ie,style:{height:"100%",width:"100%"},"data-testid":_(E5e(tF)),children:t.jsxRuntimeExports.jsx(a9s,{isAccountingClassesEnabled:c,showProjectField:te,isTransactionActivityEnabled:x,selectedTab:e,sectionId:r,transactionView:n,authParams:i,setCurrentTransactionInAction:L,onUpdateTransactionCategorizationUIState:C,onUpdateScrollYOffSetTransactionCategorizationUIState:b,onFetchTransactionCategorizationList:E,onTransactionCategorizationRowClick:y,vendorLoadOptions:ne,vendorSearchAutoCompleteData:a,vendorSearchAutoCompleteActions:l,containerRef:me,onOpenTransferDrawer:T,isCOTEnabled:d,isCreateTransferEntryFromExpenseEnabled:u,cotTracking:{onCOTView:N},isUncategorizedExpenseCategoryEnabled:V,setActivityLogTransactionId:A,onUploadTransactionReceipt:I})})})})},E5e=e=>`${e}_form`,$5e=(e,n,i,r,a,l)=>({[K3]:n.map(d=>R9s(d.transactionId,d.transactionReviewLocalData,i,r,a,l)),[aS]:e}),R9s=(e,n,i,r,a,l)=>{const{lineItemById:c,sortedLineItems:d,selectedEntity:u}=n,m=Object.values(c).sort((h,f)=>d.indexOf(h.lineId)-d.indexOf(f.lineId)),x=m[0]?.lineId;return{[OPe]:m.map(h=>{const f=h.account?.qboId??h.account?.accountId,y=h.class?.classId,C=h.selectedEntityLine;return{id:h.id,transactionId:h.transactionId,type:h.type,amount:h.amount,lineDetailType:h.lineDetailType,platformLineDetailType:h.platformLineDetailType,lineTransactionType:h.lineTransactionType,postingType:h.postingType,postingTypeName:h.postingTypeName,customer:h.customer,vendor:h.vendor,billable:h.billable,item:h.item,isCategoryMiscategorized:h.isCategoryMiscategorized,isClassMiscategorized:h.isClassMiscategorized,lineId:h.id,[Ui]:{selectedOption:f,allOptions:N9(i,h.recommendationsWithCOT)},[yc]:{selectedOption:y,allOptions:H9(r,h.recommendationsWithCOT)},[$j]:{selectedOption:h.project?.projectId,allOptions:PC(a)},[pp]:{selectedOption:u?.id??C?.id??u?.name??C?.name,defaultOptions:K5(l,u??C,n.lineItemById[x]?.recommendationsWithCOT??[])},[U7s]:h.lineEntity,[G7s]:h.recommendationsWithCOT??[]}}),transactionId:e,[Y7s]:n.vendorDetails!=null&&n.vendorDetails.id!=null?{id:n.vendorDetails.id,qboId:n.vendorDetails.qboId,name:n.vendorDetails.name}:void 0,[q7s]:n.customerDetails!=null&&n.customerDetails.id!=null?{id:n.customerDetails.id,qboId:n.customerDetails.qboId,name:n.customerDetails.name}:void 0}},v9s=s.div`
69833
69833
  display: flex;
69834
69834
  width: 100%;
69835
69835
  height: 100%;
@@ -69852,7 +69852,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
69852
69852
  display: flex;
69853
69853
  flex-direction: column;
69854
69854
  width: 100%;
69855
- `,k9s=e=>{const{currentFooterFormId:n,filters:i,onJeAccountSettingsChange:r,onSaveJeAccountSettingsClick:a,setResetJeAccountSettingsForm:l,expenseAutomationViewSelector:c,isAccountingClassesEnabled:d,isProjectsTransactionsEnabled:u,isTransactionActivityEnabled:m,authParams:x,receiptUploadEndpoint:h,companyId:f,vendorSearchAutoCompleteActions:y,vendorSearchAutoCompleteData:C,enableMonthEndInsightsZeniGPTFeature:b,monthEndInsightsPreviewMode:E,monthEndInsightsCustomerRequestData:$,allThreadsSectionOpen:R,loggedInUser:S,isCOTEnabled:k,setCurrentFooterFormId:T,onFetchRecommendationsForEntityCategorization:A,onFetchRecommendationsForEntityCategorizationWithCustomer:I,onTransactionCategorizationRowClick:B,onFetchMissingReceiptsList:L,onMissingReceiptsRowClick:P,onUploadReceiptAttachment:D,onUploadReceiptComplete:M,onUploadReceiptFetchStatus:F,onReconTabColumnSortConfigChanged:V,onReloadReconciliationListPage:N,onUpdateReconcileTabLocalData:H,onUpdateMissingReceiptsUIState:W,onUpdateJESchedulesUIState:U,onFetchTransactionCategorizationList:Y,onUpdateTransactionCategorizationUIState:q,onUpdateScrollYOffSetTransactionCategorizationUIState:Z,handleJeScheduleClick:G,ignoreRecommendedJeSchedule:K,onJESchedulesFormDataChange:J,onPostJESchedule:oe,selectedMainTab:ee,setLocalDataForCategoryAndClass:te,resetTransactionCategorizationLocalData:se,updateSelectedVendorForTransaction:ie,onSaveUpdateTransactionCategorization:re,onUpdateSelectedCheckboxTransactionIds:ne,improveMonthEndInsightsUsingZeniGPTClick:me,onRemoveFileAttachment:pe,onUpdateFileAttachment:je,onCloseAllThreadsSection:ce,onEditMonthEndInsightsClick:de,previewMonthEndReport:ue,saveMonthEndReport:le,onOpenFileAttachmentSnackBar:ae,onCloseFileAttachmentSnackBar:ge,onClickCustomerRequest:ye,sendMonthEndReport:he,markAsReview:Ce,onReloadPage:we,updateOperatingExpensesIdsForReview:ve,onFetchReimbursementView:Ee,updateSectionIdsForReview:Se,onUpdateFluxAnalysisUIState:$e,fetchFluxViewOnScroll:Be,onFetchFluxViewList:Ae,setIsJeAccountSettingsOpened:_e,onReviewClicked:Te,setOpenDrawerClicked:Re,onEstablishConnectionClick:ke,onFetchLinkTokenClick:Oe,updateReconReviewTabLocalData:Me,onReconReviewTabColumnSortConfigChanged:Ie,onSaveReconciliation:Ne,onSaveReconciliationReview:Pe,onReconMatchedTransactionClick:Ue,onAddStatementClick:Je,redirectToVendorDetailPage:tt,onOpenTransferRightPanel:Qe,isCreateTransferEntryFromExpenseEnabled:dt,setActivityLogTransactionId:ct,onReconNodeCollapseToggled:yt,onExcludeAccountFromReconciliation:He,onIncludeAccountIntoReconciliation:jt,isReconV3Enabled:St}=e,{currentSelectedView:We,missingReceipts:nt,transactionView:ut,selectedPeriod:pt,monthEndInsights:Bt,selectedTransactionCategorizationTab:Ht,reconciliation:$o}=c;switch(We){case"transaction_categorization":{if(ut.fetchState==="Completed"&&ut.transactionLocalData.length===0){const{title:Tt,subTitle:Gt}=Kr(We).allDoneText,{expenseAutomation:{transactions:{emptyStates:so}}}=O.getLocalizedStrings(),no=n5s(ut.uiState.searchString??"",i);return t.jsxRuntimeExports.jsx(uu,{tab:We,title:no&&so?.noSearchResults?.title?so.noSearchResults.title:Tt,subTitle:no&&so?.noSearchResults?.subTitle?so.noSearchResults.subTitle:Gt,useNoSearchResultIcon:no})}return t.jsxRuntimeExports.jsx($9s,{setCurrentFooterFormId:T,selectedPeriod:pt,selectedTab:Ht,sectionId:K3,transactionView:ut,authParams:x,isAccountingClassesEnabled:d,isProjectsTransactionsEnabled:u,isTransactionActivityEnabled:m,onUpdateTransactionCategorizationUIState:q,onUpdateScrollYOffSetTransactionCategorizationUIState:Z,onFetchTransactionCategorizationList:Y,onTransactionCategorizationRowClick:B,setLocalDataForCategoryAndClass:te,resetTransactionCategorizationLocalData:se,updateSelectedVendorForTransaction:ie,onSaveUpdateTransactionCategorization:re,onUpdateSelectedCheckboxTransactionIds:ne,vendorSearchAutoCompleteActions:y,vendorSearchAutoCompleteData:C,onFetchRecommendationsForEntityCategorization:A,onFetchRecommendationsForEntityCategorizationWithCustomer:I,isCOTEnabled:k,isCreateTransferEntryFromExpenseEnabled:dt,onOpenTransferRightPanel:Qe,setActivityLogTransactionId:ct,onUploadTransactionReceipt:e.onUploadTransactionReceipt})}case"je_schedules":return t.jsxRuntimeExports.jsx(JCs,{isAccountingClassesEnabled:d,selectedMainTab:ee,setIsJeAccountSettingsOpened:_e,expenseAutomationViewSelector:c,setResetJeAccountSettingsForm:l,currentFooterFormId:n,onJeAccountSettingsChange:r,onSaveJeAccountSettingsClick:a,setCurrentFooterFormId:T,handleJeScheduleClick:G,ignoreRecommendedJeSchedule:K,onJESchedulesFormDataChange:J,onPostJESchedule:oe,onUpdateJESchedulesUIState:U,vendorSearchAutoCompleteActions:y,vendorSearchAutoCompleteData:C});case"missing_receipts":return nt.fetchState==="Completed"&&nt.transactions.length===0?t.jsxRuntimeExports.jsx(uu,{tab:We,title:Kr(We).allDoneText.title,subTitle:Kr(We).allDoneText.subTitle}):t.jsxRuntimeExports.jsx(z6s,{onUpdateMissingReceiptsUIState:W,onFetchMissingReceiptsList:L,missingReceipts:nt,receiptUploadEndpoint:h,authParams:x,isAccountingClassesEnabled:d,selectedPeriod:pt,onMissingReceiptsRowClick:P,onUploadReceiptComplete:M,onUploadReceiptFetchStatus:F,onUploadReceiptAttachment:D});case"month_end_insights":if(Bt!=null&&c.monthEndCloseChecksView.monthEndCloseChecks!=null){if(Bt.fetchState==="Not-Started"||Bt.fetchState==="In-Progress"||Bt.companyMonthEndReportTemplatesData.fetchState==="Not-Started"||Bt.companyMonthEndReportTemplatesData.fetchState==="In-Progress")return t.jsxRuntimeExports.jsx(K0,{fetchState:"In-Progress"});{const Tt={application:"cockpit",companyId:f,entityId:f,tab:"expense_automation",isGlobalComment:!1,entityType:"expense_automation.monthEndEmail",companyName:Bt.companyName,url:window.location.href},{url:Gt,...so}=Tt,no={...so};return t.jsxRuntimeExports.jsx(A9s,{children:t.jsxRuntimeExports.jsx(m7s,{allThreadsSectionOpen:R,customerRequestData:$,companyId:f,enableZeniGPTFeature:b,filterMetaData:no,selectedPeriod:c.selectedPeriod,improveUsingZeniGPTClick:me,isZeniUser:S?.userEmail?.includes("zeni.ai")??!1,monthEndReportView:Bt,newThreadMetadata:Tt,onClickCustomerRequest:ye,onCloseAllThreadsSection:ce,onCloseFileAttachmentSnackBar:ge,onOpenFileAttachmentSnackBar:ae,onRemoveFileAttachment:pe,onUpdateFileAttachment:je,previewMode:E,previewMonthEndReport:ue,saveMonthEndReport:le,onEditClick:de,sendMonthEndReport:he})})}}else return null;case"flux_analysis":{const Tt=c.fluxAnalysis,Gt=Tt.fetchStatus.fetchState,so=Tt.sections.generalExpense.vendors.length>0||Tt.sections.reimbursement.vendors.length>0;return Gt==="Not-Started"||Gt==="In-Progress"&&!so?t.jsxRuntimeExports.jsx(Njs,{}):Gt==="Completed"&&Tt.sections.generalExpense.vendors.length===0&&Tt.sections.reimbursement.vendors.length===0?t.jsxRuntimeExports.jsx(uu,{tab:We,title:Kr(We).allDoneText.title,subTitle:Kr(We).allDoneText.subTitle}):t.jsxRuntimeExports.jsx(Tjs,{isAccountingClassesEnabled:d,fluxAnalysis:Tt,selectedPeriod:c.selectedPeriod,markAsReview:Ce,onReloadPage:we,updateOperatingExpensesIdsForReview:ve,updateSectionIdsForReview:Se,onUpdateFluxAnalysisUIState:$e,setCurrentFooterFormId:T,fetchFluxViewOnScroll:Be,onFetchFluxViewList:Ae,onFetchReimbursementView:Ee,redirectToVendorDetailPage:tt})}case"reconciliation":return t.jsxRuntimeExports.jsx(mjs,{onReloadReconciliationListPage:N,currentFooterFormId:n,isAccountingClassesEnabled:d,reconciliation:$o,companyId:f,vendorSearchAutoCompleteActions:y,vendorSearchAutoCompleteData:C,onReviewClicked:Te,setOpenDrawerClicked:Re,setCurrentFooterFormId:T,onReconTabColumnSortConfigChanged:V,onUpdateReconcileTabLocalData:H,onEstablishConnectionClick:ke,onFetchLinkTokenClick:Oe,updateReconReviewTabLocalData:Me,onReconReviewTabColumnSortConfigChanged:Ie,onSaveReconciliation:Ne,onSaveReconciliationReview:Pe,onReconMatchedTransactionClick:Ue,onAddStatementClick:Je,onReconNodeCollapseToggled:yt,onExcludeAccountFromReconciliation:He,onIncludeAccountIntoReconciliation:jt,isReconV3Enabled:St});default:return t.jsxRuntimeExports.jsx(uu,{tab:We,title:Kr(We).allDoneText.title,subTitle:Kr(We).allDoneText.subTitle})}};function lS(e){const n=X();return t.jsxRuntimeExports.jsx(S9s,{windowSize:n,children:t.jsxRuntimeExports.jsx(k9s,{...e})})}const I9s=e=>j.createElement("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M9.75 4.5L6 8.25L2.25 4.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),T9s=e=>j.createElement("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M2.25 7.5L6 3.75L9.75 7.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),L9s=s.div`
69855
+ `,k9s=e=>{const{currentFooterFormId:n,filters:i,onJeAccountSettingsChange:r,onSaveJeAccountSettingsClick:a,setResetJeAccountSettingsForm:l,expenseAutomationViewSelector:c,isAccountingClassesEnabled:d,isProjectsTransactionsEnabled:u,isTransactionActivityEnabled:m,authParams:x,receiptUploadEndpoint:h,companyId:f,vendorSearchAutoCompleteActions:y,vendorSearchAutoCompleteData:C,enableMonthEndInsightsZeniGPTFeature:b,monthEndInsightsPreviewMode:E,monthEndInsightsCustomerRequestData:$,allThreadsSectionOpen:R,loggedInUser:S,isCOTEnabled:k,setCurrentFooterFormId:T,onFetchRecommendationsForEntityCategorization:A,onFetchRecommendationsForEntityCategorizationWithCustomer:I,onTransactionCategorizationRowClick:B,onFetchMissingReceiptsList:L,onMissingReceiptsRowClick:P,onUploadReceiptAttachment:D,onUploadReceiptComplete:M,onUploadReceiptFetchStatus:F,onReconTabColumnSortConfigChanged:V,onReloadReconciliationListPage:N,onUpdateReconcileTabLocalData:H,onUpdateMissingReceiptsUIState:W,onUpdateJESchedulesUIState:U,onFetchTransactionCategorizationList:Y,onUpdateTransactionCategorizationUIState:q,onUpdateScrollYOffSetTransactionCategorizationUIState:Z,handleJeScheduleClick:G,ignoreRecommendedJeSchedule:K,onJESchedulesFormDataChange:J,onPostJESchedule:oe,selectedMainTab:ee,setLocalDataForCategoryAndClass:te,resetTransactionCategorizationLocalData:se,updateSelectedVendorForTransaction:ie,onSaveUpdateTransactionCategorization:re,onUpdateSelectedCheckboxTransactionIds:ne,improveMonthEndInsightsUsingZeniGPTClick:me,onRemoveFileAttachment:pe,onUpdateFileAttachment:je,onCloseAllThreadsSection:ce,onEditMonthEndInsightsClick:de,previewMonthEndReport:ue,saveMonthEndReport:le,onOpenFileAttachmentSnackBar:ae,onCloseFileAttachmentSnackBar:ge,onClickCustomerRequest:ye,sendMonthEndReport:he,markAsReview:Ce,onReloadPage:we,updateOperatingExpensesIdsForReview:ve,onFetchReimbursementView:Ee,updateSectionIdsForReview:Se,onUpdateFluxAnalysisUIState:$e,fetchFluxViewOnScroll:Be,onFetchFluxViewList:Ae,setIsJeAccountSettingsOpened:_e,onReviewClicked:Te,setOpenDrawerClicked:Re,onEstablishConnectionClick:ke,onFetchLinkTokenClick:Oe,updateReconReviewTabLocalData:Me,onReconReviewTabColumnSortConfigChanged:Ie,onSaveReconciliation:Ne,onSaveReconciliationReview:Pe,onReconMatchedTransactionClick:Qe,onAddStatementClick:Je,redirectToVendorDetailPage:tt,onOpenTransferRightPanel:Ue,isCreateTransferEntryFromExpenseEnabled:dt,setActivityLogTransactionId:ct,onReconNodeCollapseToggled:yt,onExcludeAccountFromReconciliation:He,onIncludeAccountIntoReconciliation:jt,isReconV3Enabled:St}=e,{currentSelectedView:We,missingReceipts:nt,transactionView:ut,selectedPeriod:pt,monthEndInsights:Bt,selectedTransactionCategorizationTab:Ht,reconciliation:$o}=c;switch(We){case"transaction_categorization":{if(ut.fetchState==="Completed"&&ut.transactionLocalData.length===0){const{title:Tt,subTitle:Gt}=Kr(We).allDoneText,{expenseAutomation:{transactions:{emptyStates:so}}}=O.getLocalizedStrings(),no=n5s(ut.uiState.searchString??"",i);return t.jsxRuntimeExports.jsx(uu,{tab:We,title:no&&so?.noSearchResults?.title?so.noSearchResults.title:Tt,subTitle:no&&so?.noSearchResults?.subTitle?so.noSearchResults.subTitle:Gt,useNoSearchResultIcon:no})}return t.jsxRuntimeExports.jsx($9s,{setCurrentFooterFormId:T,selectedPeriod:pt,selectedTab:Ht,sectionId:K3,transactionView:ut,authParams:x,isAccountingClassesEnabled:d,isProjectsTransactionsEnabled:u,isTransactionActivityEnabled:m,onUpdateTransactionCategorizationUIState:q,onUpdateScrollYOffSetTransactionCategorizationUIState:Z,onFetchTransactionCategorizationList:Y,onTransactionCategorizationRowClick:B,setLocalDataForCategoryAndClass:te,resetTransactionCategorizationLocalData:se,updateSelectedVendorForTransaction:ie,onSaveUpdateTransactionCategorization:re,onUpdateSelectedCheckboxTransactionIds:ne,vendorSearchAutoCompleteActions:y,vendorSearchAutoCompleteData:C,onFetchRecommendationsForEntityCategorization:A,onFetchRecommendationsForEntityCategorizationWithCustomer:I,isCOTEnabled:k,isCreateTransferEntryFromExpenseEnabled:dt,onOpenTransferRightPanel:Ue,setActivityLogTransactionId:ct,onUploadTransactionReceipt:e.onUploadTransactionReceipt})}case"je_schedules":return t.jsxRuntimeExports.jsx(JCs,{isAccountingClassesEnabled:d,selectedMainTab:ee,setIsJeAccountSettingsOpened:_e,expenseAutomationViewSelector:c,setResetJeAccountSettingsForm:l,currentFooterFormId:n,onJeAccountSettingsChange:r,onSaveJeAccountSettingsClick:a,setCurrentFooterFormId:T,handleJeScheduleClick:G,ignoreRecommendedJeSchedule:K,onJESchedulesFormDataChange:J,onPostJESchedule:oe,onUpdateJESchedulesUIState:U,vendorSearchAutoCompleteActions:y,vendorSearchAutoCompleteData:C});case"missing_receipts":return nt.fetchState==="Completed"&&nt.transactions.length===0?t.jsxRuntimeExports.jsx(uu,{tab:We,title:Kr(We).allDoneText.title,subTitle:Kr(We).allDoneText.subTitle}):t.jsxRuntimeExports.jsx(z6s,{onUpdateMissingReceiptsUIState:W,onFetchMissingReceiptsList:L,missingReceipts:nt,receiptUploadEndpoint:h,authParams:x,isAccountingClassesEnabled:d,selectedPeriod:pt,onMissingReceiptsRowClick:P,onUploadReceiptComplete:M,onUploadReceiptFetchStatus:F,onUploadReceiptAttachment:D});case"month_end_insights":if(Bt!=null&&c.monthEndCloseChecksView.monthEndCloseChecks!=null){if(Bt.fetchState==="Not-Started"||Bt.fetchState==="In-Progress"||Bt.companyMonthEndReportTemplatesData.fetchState==="Not-Started"||Bt.companyMonthEndReportTemplatesData.fetchState==="In-Progress")return t.jsxRuntimeExports.jsx(K0,{fetchState:"In-Progress"});{const Tt={application:"cockpit",companyId:f,entityId:f,tab:"expense_automation",isGlobalComment:!1,entityType:"expense_automation.monthEndEmail",companyName:Bt.companyName,url:window.location.href},{url:Gt,...so}=Tt,no={...so};return t.jsxRuntimeExports.jsx(A9s,{children:t.jsxRuntimeExports.jsx(m7s,{allThreadsSectionOpen:R,customerRequestData:$,companyId:f,enableZeniGPTFeature:b,filterMetaData:no,selectedPeriod:c.selectedPeriod,improveUsingZeniGPTClick:me,isZeniUser:S?.userEmail?.includes("zeni.ai")??!1,monthEndReportView:Bt,newThreadMetadata:Tt,onClickCustomerRequest:ye,onCloseAllThreadsSection:ce,onCloseFileAttachmentSnackBar:ge,onOpenFileAttachmentSnackBar:ae,onRemoveFileAttachment:pe,onUpdateFileAttachment:je,previewMode:E,previewMonthEndReport:ue,saveMonthEndReport:le,onEditClick:de,sendMonthEndReport:he})})}}else return null;case"flux_analysis":{const Tt=c.fluxAnalysis,Gt=Tt.fetchStatus.fetchState,so=Tt.sections.generalExpense.vendors.length>0||Tt.sections.reimbursement.vendors.length>0;return Gt==="Not-Started"||Gt==="In-Progress"&&!so?t.jsxRuntimeExports.jsx(Njs,{}):Gt==="Completed"&&Tt.sections.generalExpense.vendors.length===0&&Tt.sections.reimbursement.vendors.length===0?t.jsxRuntimeExports.jsx(uu,{tab:We,title:Kr(We).allDoneText.title,subTitle:Kr(We).allDoneText.subTitle}):t.jsxRuntimeExports.jsx(Tjs,{isAccountingClassesEnabled:d,fluxAnalysis:Tt,selectedPeriod:c.selectedPeriod,markAsReview:Ce,onReloadPage:we,updateOperatingExpensesIdsForReview:ve,updateSectionIdsForReview:Se,onUpdateFluxAnalysisUIState:$e,setCurrentFooterFormId:T,fetchFluxViewOnScroll:Be,onFetchFluxViewList:Ae,onFetchReimbursementView:Ee,redirectToVendorDetailPage:tt})}case"reconciliation":return t.jsxRuntimeExports.jsx(mjs,{onReloadReconciliationListPage:N,currentFooterFormId:n,isAccountingClassesEnabled:d,reconciliation:$o,companyId:f,vendorSearchAutoCompleteActions:y,vendorSearchAutoCompleteData:C,onReviewClicked:Te,setOpenDrawerClicked:Re,setCurrentFooterFormId:T,onReconTabColumnSortConfigChanged:V,onUpdateReconcileTabLocalData:H,onEstablishConnectionClick:ke,onFetchLinkTokenClick:Oe,updateReconReviewTabLocalData:Me,onReconReviewTabColumnSortConfigChanged:Ie,onSaveReconciliation:Ne,onSaveReconciliationReview:Pe,onReconMatchedTransactionClick:Qe,onAddStatementClick:Je,onReconNodeCollapseToggled:yt,onExcludeAccountFromReconciliation:He,onIncludeAccountIntoReconciliation:jt,isReconV3Enabled:St});default:return t.jsxRuntimeExports.jsx(uu,{tab:We,title:Kr(We).allDoneText.title,subTitle:Kr(We).allDoneText.subTitle})}};function lS(e){const n=X();return t.jsxRuntimeExports.jsx(S9s,{windowSize:n,children:t.jsxRuntimeExports.jsx(k9s,{...e})})}const I9s=e=>j.createElement("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M9.75 4.5L6 8.25L2.25 4.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),T9s=e=>j.createElement("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M2.25 7.5L6 3.75L9.75 7.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),L9s=s.div`
69856
69856
  width: 100%;
69857
69857
  box-sizing: border-box;
69858
69858
  border: 1px solid ${e=>e.theme.colors.grey2};
@@ -71331,7 +71331,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
71331
71331
  width: ${o.sp3};
71332
71332
  cursor: pointer;
71333
71333
  color: inherit;
71334
- `,{common:{footer:Vi,texts:{maxLimitReached:V$s,confirmAction:Q$s},headers:gMe,create:U$s,strings:Vb,texts:Rj,cancel:G$s,confirm:Y$s,monthsByIndex:q$s},dateFormat:{visual:{MMMDCommaYYYYformat:a4e}},expenseAutomation:cS,uncategorizedTransactionList:{missingReceipt:{bulkUpload:Z$s}}}=O.getLocalizedStrings();function K$s(...e){for(const n of e)if(n!=null&&n>0&&!Number.isNaN(n))return n;return 0}const J$s=e=>{const{accountsForFilters:n,categoryOptions:i,classesForFilters:r,expenseAutomationViewSelector:a,isDisabled:l,isRealtimeInsightsFeatureEnabled:c,isUncategorizedExpenseCategoryEnabled:d,isCOTEnabled:u,onUpdateTab:m,onReconTabUpdate:x,onUpdateStep:h,onSearchTextChanged:f,onFiltersChange:y,onRefresh:C,onClose:b,onBack:E,onBulkUploadConfirmMatchAcknowledged:$,onClearMissingReceiptsTabNavigation:R,closeSidePanel:S,initialMissingReceiptsTab:k,resetTransactionCategorizationLocalData:T,updateOperatingExpensesIdsForReview:A,clearJeScheduleLocalData:I,onSaveReconciliation:B}=e,{isAccountingClassesEnabled:L}=e,P=e.bulkUploadEndpoint!=null||e.onBulkUploadFiles!=null,D=P$s({authParams:e.authParams,bulkUploadEndpoint:e.bulkUploadEndpoint,onBulkUploadProgress:e.onBulkUploadProgress,onBulkUploadSuccess:e.onBulkUploadSuccess,onBulkUploadUploadedFileCount:e.onBulkUploadUploadedFileCount,onBulkUploadFilesFallback:e.onBulkUploadFiles,onUploadError:e.onBulkUploadError}),{currentSelectedView:M,allSteps:F,missingReceipts:V,jeSchedules:N,fluxAnalysis:H,monthEndInsights:W,transactionView:U,selectedTransactionCategorizationTab:Y,reconciliation:q,selectedPeriod:Z}=a,{pendingMissingReceiptsTabNavigation:G}=V,[K,J]=g.useState("expenseAutomationPage"),oe=N.uiState.selectedMainTab??"pending_review",{onUpdateJESchedulesUIState:ee}=e,te=g.useCallback(Vt=>{ee({selectedMainTab:Vt})},[ee]),[se,ie]=g.useState(()=>{}),[re,ne]=g.useState(!1),me=X(),pe=!!e.loggedInUser?.userEmail?.includes("zeni.ai"),je=pe?vs:Nu,{openThread:ce,setOpenThread:de}=g.useContext(je),{useFeatureGate:ue}=Dc(),le=ue($p.isExpenseAutomationSearchAndFilterEnabled),{isReconV3Enabled:ae}=e,[ge,ye]=g.useState(!1),[he,Ce]=g.useState(!1),[we,ve]=g.useState(k??"missing"),Ee=g.useRef(null);g.useEffect(()=>{const Vt=Ee.current;Vt!==null&&Vt!==we&&S?.(),Ee.current=we},[we,S]);const Se=g.useCallback(Vt=>{ve(Vt)},[]),[$e,Be]=g.useState(null),Ae=g.useCallback(Vt=>{Be(Vt),J(Vt!=null?"expenseAutomationMissingReceipts":"expenseAutomationPage")},[J]),_e=e.bulkUploadSelector?.confirmMatchStatus.fetchState,Te=g.useRef(void 0);g.useEffect(()=>{Te.current==="In-Progress"&&_e==="Completed"&&$e!=null&&(Ae(null),$?.()),Te.current=_e},[_e,$e,Ae,$]),g.useEffect(()=>{we!=="unmatched"&&Ae(null)},[we,Ae]),g.useEffect(()=>{G==="unmatched"&&(P&&Se("unmatched"),R?.())},[G,R,P,Se]),g.useEffect(()=>{P===!1&&(we==="unmatched"||we==="completed")&&Se("missing")},[P,we,Se]);const{bulkUploadSelector:Re,onSetBulkUploadCompletedSubTab:ke}=e,Oe=g.useRef(null);g.useEffect(()=>{if(Re==null||Re.phase!=="completed")return;const Vt=Re.currentBatchId;if(Vt==null||Re.currentBatchDetailsFetched!==!0||Oe.current===Vt)return;Oe.current=Vt,Re.unmatchedFiles.length+Re.pastUnmatchedFiles.length>0?Se("unmatched"):(Se("completed"),ke?.("ai_accountant"))},[Re,ke,Se]);const[Me,Ie]=g.useState({categories:[],categoryCombinationOperator:"AND"});g.useEffect(()=>{if(le.isFeatureEnabled===!1&&Me.categories.length>0){const Vt={categories:[],categoryCombinationOperator:"AND"};Ie(Vt),y(Vt)}},[le.isFeatureEnabled,Me.categories.length,y]);const Ne=F.find(Vt=>Vt.step===M),{nextStep:Pe,previousStep:Ue}=tRs(F,M),{uiState:{searchString:Je,pageToken:tt},totalCountByTab:Qe,parentTabTotalCountByTab:dt,transactions:ct,fetchStateByTransactionTabs:yt,transactionLocalData:He}=U,[jt,St]=g.useState(Je??"");g.useEffect(()=>{St(Je??"")},[Je]);const We=g.useMemo(()=>t.debounce(Vt=>f(Vt),500,{leading:!1,trailing:!0}),[f]);g.useEffect(()=>()=>{We.cancel()},[We]);const nt=g.useCallback(Vt=>{St(Vt),We(Vt)},[We]),{selectedReconAccount:ut,reconciliationTabsState:{reconcile:{localData:{selectedTransactionIds:pt}}}}=q;let Bt="Not-Started",Ht="complete";switch(M){case"missing_receipts":Bt=V.refreshStatus.fetchState,Ht=V.completionStatus,we==="unmatched"&&e.bulkUploadSelector!=null&&(e.bulkUploadSelector.batchListFetchState.fetchState==="In-Progress"||e.bulkUploadSelector.batchDetailsPaginationState.fetchState==="In-Progress"||e.bulkUploadSelector.batchDetailsRevalidating===!0)&&Bt!=="In-Progress"&&(Bt="In-Progress");break;case"je_schedules":Bt=N.refreshStatus.fetchState,Ht=N.completionStatus;break;case"month_end_insights":W!=null&&(Bt=W?.fetchState);break;case"flux_analysis":Bt=H.refreshStatus.fetchState,Ht=H.completionStatus;break;case"transaction_categorization":Bt=U.refreshStatus.fetchState,Ht=U.completionStatus;break;case"reconciliation":ut==null?(Bt=q.refreshStatus.fetchState,Ht=q.completionStatus):(Bt=q.selectedReconAccount?.refreshStatus.fetchState??"Not-Started",Ht=q.completionStatus)}const $o=a.monthEndCloseChecksView.fetchState,Tt=$o==="Not-Started"||$o==="In-Progress",Gt=a.monthEndCloseChecksView.monthEndCloseChecks?.monthEndCloseCheckList.find(Vt=>Vt.id===M),so=Tt?void 0:Math.floor(Gt?.progress??0),no=()=>{se()},Xe=Vt=>{Ie(Vt),y(Vt)},ft=g.useMemo(()=>{const Vt=Q.TRANSACTION_FILTER_CATEGORIES,en=n??[],On=r??[];return Vt.reduce(($t,bo)=>{const mt=bo.value;switch(mt){case"amount":return{...$t,[mt]:[]};case"payment_account_name":{const Qt=en.map(wt=>({label:wt.accountName??"",value:wt.accountName??""}));return{...$t,[mt]:Qt}}case"payment_account_type":{const Qt=new Set,wt=[];for(const Kt of ct)Kt.paymentType==null||Kt.paymentType===""||Qt.has(Kt.paymentType)||(Qt.add(Kt.paymentType),wt.push({label:Kt.paymentTypeName??Kt.paymentType,value:Kt.paymentType}));return{...$t,[mt]:wt}}case"class":{const Qt=On.map(wt=>({label:wt.className??"",value:wt.classId??""}));return{...$t,[mt]:Qt}}case"category":{const Qt=i?.map(wt=>({label:wt.accountName??"",value:wt.accountId??""}))??[];return{...$t,[mt]:Qt}}default:return{...$t,[mt]:[]}}},{})},[n,r,i,ct]),{saveStatus:oo,selectedCheckBoxTransactionIds:on}=U,To=()=>{const Vt=yPe(a.fluxAnalysis.sections,a.fluxAnalysis.reviewOperatingExpensesIds);switch(K){case"expenseAutomationFluxPage":return{formId:"expenseAutomationFluxPage",isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Vt===!0?Vi.markAsReviewed:Rj.undo,style:{justifyContent:"space-evenly"},isLoading:a.fluxAnalysis.bulkReviewStatus.fetchState==="In-Progress",isDisabled:!1},leftSideComponent:gF(a.fluxAnalysis.reviewOperatingExpensesIds.length,u8,me,Rj.vendor,M),cancelBtn:{label:Vi.cancel,style:{width:"96px",justifyContent:"space-evenly"},onClick:()=>{A([])}}};case"expenseAutomationTransactionsPage":return{formId:"expenseAutomationTransactionsPage",isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Vi.save,style:{minWidth:"96px",justifyContent:"space-evenly"},isLoading:oo.fetchState==="In-Progress",isDisabled:U.hasInFlightCategoryClassRecommendations===!0},leftSideComponent:gF(on.length,Q.MAX_SELECTION_LIMIT,me,Rj.transaction,M),cancelBtn:{label:Vi.cancel,style:{width:"96px",justifyContent:"space-evenly"},onClick:()=>{T(Y,ct.map(en=>en.id),Z,!1,Qe[Y],Q.getLineItemsByTransactionIdsFromLocalData(He,Y),d,tt)}}};case"expenseAutomationJESchedulePage":return{formId:"expenseAutomationJESchedulePage",nextBtnLabel:Vi.next,backBtnLabel:Vi.back,isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Vi.next,style:{justifyContent:"space-evenly"},isDisabled:l||Ne?.isNextDisabled===!0||Pe==null,suffixIcon:t.jsxRuntimeExports.jsx(i4e,{}),onClick:()=>{Pe!=null&&h(Pe.step)}},cancelBtn:{label:Vi.back,isDisabled:l||Ne?.isPrevDisabled===!0||Ue==null,style:{width:"96px",justifyContent:"space-evenly"},prefixIcon:t.jsxRuntimeExports.jsx(r4e,{}),onClick:()=>{Ue!=null&&h(Ue.step)}}};case"expenseAutomationBankReconReconcilePage":return{formId:"expenseAutomationBankReconReconcilePage",nextBtnLabel:Vi.reconcile,backBtnLabel:Vi.saveForLater,isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Vi.reconcile,onClick:()=>{B({reconcileAction:"reconcile"})},isDisabled:q.reconciliationTabsState.balances.variance.amount!==0,isLoading:q.actionFetchStates.reconcileFetch.fetchState==="In-Progress",style:{justifyContent:"space-evenly",minWidth:132}},leftSideComponent:gF(pt.length,1/0,me,Rj.transaction,M),cancelBtn:{onClick:()=>{B({reconcileAction:"save_reconcile_for_later"})},reverseSpinnerColor:!1,isLoading:q.actionFetchStates.saveForLaterFetch.fetchState==="In-Progress",label:Vi.saveForLater,style:{minWidth:132,justifyContent:"space-evenly"}}};case"expenseAutomationJEAccountSettingsPage":return{formId:"expenseAutomationJEAccountSettingsPage",nextBtnLabel:Vi.save,backBtnLabel:Vi.cancel,isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Vi.save,isLoading:N.accountSettingsView.saveState.fetchState==="In-Progress",style:{justifyContent:"space-evenly",minWidth:82}},cancelBtn:{onClick:()=>no(),label:Vi.cancel,style:{minWidth:82,justifyContent:"space-evenly"}}};case"expenseAutomationMissingReceipts":return{formId:"expenseAutomationMissingReceipts",isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Z$s.confirmMatch,isLoading:e.bulkUploadSelector?.confirmMatchStatus.fetchState==="In-Progress",isDisabled:$e==null||e.bulkUploadSelector?.confirmMatchStatus.fetchState==="In-Progress",style:{minWidth:"96px",justifyContent:"space-evenly"},onClick:()=>{$e!=null&&e.bulkUploadSelector?.confirmMatchStatus.fetchState!=="In-Progress"&&e.onConfirmBulkUploadMatch?.($e.batchId,$e.attachmentId,$e.transactionId,$e.transactionType,$e.fileName)}},cancelBtn:{label:Vi.cancel,style:{width:"96px",justifyContent:"space-evenly"},onClick:()=>Ae(null)}};default:{const en=M==="reconciliation"&&a.reconciliation.selectedTab==="review"&&a.reconciliation.selectedAccountId!=null,On=M==="reconciliation"&&a.reconciliation.selectedAccountId==null,$t=M==="reconciliation"&&a.reconciliation.selectedTab==="reconcile"&&a.reconciliation.selectedAccountId!=null,bo=Pe?.step==="month_end_insights"&&(M==="flux_analysis"&&(a.fluxAnalysis.sections.generalExpense?.balancesByMonth!=null||a.fluxAnalysis.sections.reimbursement?.balancesByMonth!=null)||On),mt=M==="transaction_categorization"&&a.selectedTransactionCategorizationTab==="review",Qt=M==="transaction_categorization"&&a.selectedTransactionCategorizationTab==="autoCategorized",wt=a.monthEndCloseChecksView.monthEndCloseChecks?.monthEndCloseCheckList.find(_o=>_o.id==="month_end_insights"),Kt=a.monthEndCloseChecksView.monthEndCloseChecks?.reportEmailSentDate==null&&wt?.isDisabled===!1&&(c||Ne?.isNextDisabled===!1),ks=Pe?.step==="month_end_insights"&&(On||M==="flux_analysis")?!Kt:Ne?.isNextDisabled===!0;return{formId:"expenseAutomationPage",nextBtnLabel:Vi.next,backBtnLabel:Vi.back,isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:bo===!0?eRs(a.selectedPeriod.month):Vi.next,style:{justifyContent:"space-evenly"},isDisabled:ks||Pe==null,suffixIcon:t.jsxRuntimeExports.jsx(i4e,{}),onClick:()=>{mt?m("autoCategorized"):en?x("reconcile"):Pe!=null&&h(Pe.step)}},cancelBtn:{label:Vi.back,isDisabled:l||Ne?.isPrevDisabled===!0||Ue==null,style:{width:"96px",justifyContent:"space-evenly"},prefixIcon:t.jsxRuntimeExports.jsx(r4e,{}),onClick:()=>{Qt?m("review"):$t?x("review"):en?E():Ue!=null&&h(Ue.step)}}}}}},kn=()=>{switch(K){case"expenseAutomationFluxPage":return{confirmAction:()=>{ye(!1),A([]),b()}};case"expenseAutomationTransactionsPage":return{confirmAction:()=>{ye(!1),T(Y,ct.map(Vt=>Vt.id),Z,!1,Qe[Y],Q.getLineItemsByTransactionIdsFromLocalData(He,Y),d,tt),b()}};case"expenseAutomationJESchedulePage":return{confirmAction:()=>{ye(!1),I(),b()}};default:return{confirmAction:()=>{ye(!1)},confirmationDescription:Vb.empty}}},Dn=()=>{K==="expenseAutomationFluxPage"||K==="expenseAutomationJESchedulePage"||K==="expenseAutomationTransactionsPage"?ye(!0):b()},{primaryBtn:qt,cancelBtn:dn,leftSideComponent:Zs}=To(),{confirmAction:Yn}=kn(),Hs=Vt=>{if(M==="transaction_categorization"&&(Vt==="autoCategorized"||Vt==="review")){const en=Vt;return{count:dt[en],isFetching:yt[en].fetchState==="In-Progress"}}if(M==="reconciliation"){const{reconciliation:en}=a,{selectedAccountId:On}=en;return On==null?{count:0,isFetching:!1}:Vt==="review"?{count:en.accountReconciliationsByAccountID[On]?.accountReconEntity?.transactionsToReview.length,isFetching:en.accountReconciliationsByAccountID[On]?.transactionFetchState.fetchState==="In-Progress"}:{count:en.accountReconciliationsByAccountID[On]?.accountReconEntity?.transactionsToReconcile.length,isFetching:en.accountReconciliationsByAccountID[On]?.transactionFetchState.fetchState==="In-Progress"}}if(M==="missing_receipts"){if(Vt==="missing")return{count:V.transactions.length,isFetching:V.fetchState==="In-Progress"};if(Vt==="unmatched")return{count:(e.bulkUploadSelector?.unmatchedFiles.length??0)+(e.bulkUploadSelector?.pastUnmatchedFiles.length??0),isFetching:we==="unmatched"&&ZPe({bulkUploadSelector:e.bulkUploadSelector})};if(Vt==="completed")return{count:e.bulkUploadSelector?.completedTransactions?.totalCount??0,isFetching:e.bulkUploadSelector?.completedTransactions?.fetchState?.fetchState==="In-Progress",hideCountInTab:!0}}if(M==="je_schedules"){if(Vt==="pending_review")return{count:N.draftSchedules.length+N.resolveSchedules.length,isFetching:N.fetchState==="In-Progress"};if(Vt==="ongoing")return N.ongoingSchedules.length>0?{count:N.ongoingSchedules.length,isFetching:!1}:void 0;if(Vt==="completed")return N.completedSchedules.length>0?{count:N.completedSchedules.length,isFetching:!1}:void 0}},yn=M==="reconciliation"&&q.selectedAccountId!=null&&q.selectedReconAccount!=null,{month:Go,year:ds}=Z,In=Q.dateNow().set("month",Go-1).set("year",ds),ts=In.startOf("month").format(a4e),pn=In.endOf("month").format(a4e),_s=`${ts} ${Vb.hyphen} ${pn}`,us=e.sidePanelIsOpen??!1,js=e.sidePanelIsFullView??!1,xn=M==="missing_receipts"&&we==="missing"&&P,As=e.bulkUploadSelector?.phase,nn=e.bulkUploadSelector,os=K$s(nn?.progress.total,nn?.uploadedFileCount,D.uploadFileCount),qe={bulkUploadPhase:As,isDraggingFiles:D.isDraggingFiles,isUploading:D.isUploading===!0,matchingProgressBannerTotal:os,onDismissUploadError:D.clearUploadError,onFilesSelected:D.handleBulkUploadFiles,showEmailOrDropZone:D.isUploading!==!0&&As!=="matching"&&V.fetchState!=="In-Progress"&&V.fetchState!=="Not-Started",uploadError:D.uploadError,uploadFileCount:D.uploadFileCount},xt=M==="missing_receipts"&&we==="completed"&&P&&e.bulkUploadSelector!=null,Wt=M==="transaction_categorization"&&Y==="autoCategorized",Ze={onDragLeave:D.handleDragLeave,onDragOver:D.handleDragOver,onDrop:D.handleDrop},Mo=M==="reconciliation"&&q.selectedAccountId==null,Lo=Wt?t.jsxRuntimeExports.jsx($3s,{activeSubTab:U.selectedTransactionCategorizationCompletedSubTab,allTabs:M$s,onSubTabChange:e.onUpdateTransactionCategorizationCompletedSubTab}):null,_n=xn===!0&&!(us&&js)?t.jsxRuntimeExports.jsx(Z5e,{...Ze,children:t.jsxRuntimeExports.jsx(n4e,{...qe})}):xt===!0&&!(us&&js)&&e.bulkUploadSelector!=null?t.jsxRuntimeExports.jsx(s4e,{activeSubTab:e.bulkUploadSelector.completedSubTab,onSubTabChange:Vt=>{e.onSetBulkUploadCompletedSubTab?.(Vt)}}):Wt&&!(us&&js)?Lo:Mo?ae===!0?q.fetchStatus.fetchState==="Completed"?t.jsxRuntimeExports.jsx(Z9s,{reconciliation:q}):null:t.jsxRuntimeExports.jsx(Q9s,{}):null,ns=e.isExpenseAutomationCommentingEnabled===!0&&(M==="transaction_categorization"||M==="reconciliation"||M==="missing_receipts"||M==="flux_analysis"||M==="je_schedules");return t.jsxRuntimeExports.jsx(Hdo,{companyId:e.companyId,currentSelectedView:M,isCommentingEnabled:ns,onThreadClickRoute:e.onExpenseAutomationCommentingThreadClick,children:t.jsxRuntimeExports.jsxs(O$s,{children:[ge?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:Q$s}),primaryButtonText:Y$s,secondaryButtonText:G$s,proceedButtonVariant:"destructive",action:{onOkClick:()=>{Yn()},onCancelClick:()=>ye(!1)},descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:cS.confirmationDescription})}):null,t.jsxRuntimeExports.jsx(U0,{isOpen:e.sidePanelIsOpen??!1,isFullView:e.sidePanelIsFullView??!1,listContentPercent:e.sidePanelListPercent,disableMarginTop:L$s(M,P),panelContent:e.panelContent,headerContent:t.jsxRuntimeExports.jsx(L5s,{filters:Me,selectedEntity:"transaction_categorization",vendorSearchAutoCompleteData:e.vendorSearchAutoCompleteData,vendorSearchAutoCompleteActions:e.vendorSearchAutoCompleteActions,hideTabSwitcher:re===!0,isCompletionLoading:Tt,completionProgressRaw:Gt!=null&&Number.isFinite(Gt.progress)?Gt.progress:void 0,completionPercentage:so,onBack:E,navBarCustomElement:M==="reconciliation"&&q.selectedAccountId!=null?t.jsxRuntimeExports.jsx(X$s,{reconciliation:q}):void 0,onReconTabUpdate:x,currentRecontab:q.selectedTab,currentMissingReceiptsTab:we,onMissingReceiptsTabUpdate:Se,currentJeTab:oe,onJeTabUpdate:te,selectedGenericTab:M==="je_schedules"?oe:void 0,searchText:jt,onRefresh:M==="missing_receipts"?()=>{switch(we){case"missing":e.onFetchMissingReceiptsList();break;case"unmatched":e.onFetchBulkUploadBatches?.({cacheOverride:!0,invalidateBatchDetailsCache:!0});break;case"completed":e.onFetchCompletedTransactions?.(void 0,!0);break}}:C,onFiltersChange:Xe,filterOptions:ft,onGenericTabChange:M==="je_schedules"?Vt=>te(Vt.id):void 0,reconcileDetailPageFetchState:q.selectedAccountId!=null?q.accountReconciliationsByAccountID[q.selectedAccountId]?.transactionFetchState.fetchState:"Not-Started",selectedReconAccountId:yn?q.selectedAccountId:void 0,currentSelectedView:M,titleStyle:{justifyContent:"center",marginLeft:o.sp0},headerData:Kr(M,dt.autoCategorized,yn?q.selectedAccountId:void 0,yn?q.selectedReconAccount?.accountReconEntity?.account.accountName:void 0,yn?_s:void 0,Y,le.isFeatureEnabled,M==="missing_receipts"?{includeBulkUploadTabs:P,navTitle:P?gMe.receipts:void 0}:void 0,ns),currentTab:Y,getTabCountAndFetchState:Hs,completionStatus:Ht,refreshStatus:Bt,companyId:e.companyId,companyName:a.monthEndInsights?.companyName??Vb.empty,isZeniUser:pe,onAllThreadsClick:()=>{ce!=null&&de(null),Ce(!0)},onUpdateTab:m,onSearchTextChanged:nt,onClose:Dn,belowTabsSlot:_n,isAiCfoAccessEnabled:e.isAiCfoAccessEnabled,onAskAiCfoClick:e.onAskAiCfoClick}),listContent:t.jsxRuntimeExports.jsxs(z$s,{children:[M==="missing_receipts"?t.jsxRuntimeExports.jsx(LEs,{isAccountingClassesEnabled:L,missingReceiptsTab:we,missingTransactionCount:V.transactions.length,missingReceiptsBulkUploadChromeInPageBody:xn===!0&&us&&js?t.jsxRuntimeExports.jsx(Z5e,{...Ze,children:t.jsxRuntimeExports.jsx(n4e,{...qe})}):null,missingReceiptsCompletedChromeInPageBody:xt===!0&&us&&js&&e.bulkUploadSelector!=null?t.jsxRuntimeExports.jsx(s4e,{activeSubTab:e.bulkUploadSelector.completedSubTab,onSubTabChange:Vt=>{e.onSetBulkUploadCompletedSubTab?.(Vt)}}):Wt&&us&&js?Lo:null,bulkUploadInteractions:D,bulkUploadSelector:e.bulkUploadSelector,selectedPeriod:Z,authParams:e.authParams,bulkUploadEndpoint:e.bulkUploadEndpoint,transactionAttachmentsEndpoint:e.transactionAttachmentsEndpoint,onBulkUploadSuccess:e.onBulkUploadSuccess,onBulkUploadFiles:e.onBulkUploadFiles,onClearBulkUploadBatchDetailsForScopeChange:e.onClearBulkUploadBatchDetailsForScopeChange,onFetchBulkUploadBatches:e.onFetchBulkUploadBatches,onFetchMoreBatchDetails:e.onFetchMoreBatchDetails,onFetchCompletedTransactions:e.onFetchCompletedTransactions,onDeleteUnmatchedReceipt:e.onDeleteUnmatchedReceipt,onLoadMoreManualSearch:e.onLoadMoreManualSearch,onSearchTransactionsForManualMatch:e.onSearchTransactionsForManualMatch,onPendingMatchChange:Ae,pendingMatchAttachmentId:$e?.attachmentId??null,pendingMatchTransactionId:$e?.transactionId??null,onMissingReceiptsRowClick:e.onMissingReceiptsRowClick,onSetBulkUploadCompletedSubTab:e.onSetBulkUploadCompletedSubTab,onSetBulkUploadSortConfig:e.onSetBulkUploadSortConfig,onResetBulkUploadSort:e.onResetBulkUploadSort,setMissingReceiptsTab:Se,tableSectionProps:{parentProps:{...e,filters:Me,isAccountingClassesEnabled:L},isCOTEnabled:u,setIsJeAccountSettingsOpened:ne,setResetJeAccountSettingsForm:ie,allThreadsSectionOpen:he,setCurrentFooterFormId:J,currentFooterFormId:K,onCloseAllThreadsSection:()=>Ce(!1)}}):M==="flux_analysis"?t.jsxRuntimeExports.jsxs(W$s,{children:[t.jsxRuntimeExports.jsx(K9s,{}),t.jsxRuntimeExports.jsx(lS,{filters:Me,...e,isAccountingClassesEnabled:L,isCOTEnabled:u,selectedMainTab:oe,setIsJeAccountSettingsOpened:ne,setResetJeAccountSettingsForm:ie,allThreadsSectionOpen:he,setCurrentFooterFormId:J,currentFooterFormId:K,onCloseAllThreadsSection:()=>Ce(!1)})]}):M==="transaction_categorization"?t.jsxRuntimeExports.jsxs(F$s,{children:[t.jsxRuntimeExports.jsx(N$s,{children:t.jsxRuntimeExports.jsx(lS,{filters:Me,...e,isAccountingClassesEnabled:L,isCOTEnabled:u,selectedMainTab:oe,setIsJeAccountSettingsOpened:ne,setResetJeAccountSettingsForm:ie,allThreadsSectionOpen:he,setCurrentFooterFormId:J,currentFooterFormId:K,onCloseAllThreadsSection:()=>Ce(!1)})}),e.isTransactionActivityEnabled===!0||e.isRightPanelOpen===!0?t.jsxRuntimeExports.jsx(H$s,{$isOpen:e.isRightPanelOpen===!0&&e.rightSidePanel!=null,children:e.isRightPanelOpen===!0&&e.rightSidePanel!=null?e.rightSidePanel:null}):null]}):t.jsxRuntimeExports.jsx(lS,{filters:Me,...e,isAccountingClassesEnabled:L,isCOTEnabled:u,selectedMainTab:oe,setIsJeAccountSettingsOpened:ne,setResetJeAccountSettingsForm:ie,allThreadsSectionOpen:he,setCurrentFooterFormId:J,currentFooterFormId:K,onCloseAllThreadsSection:()=>Ce(!1)}),t.jsxRuntimeExports.jsx(bt,{controller:M!=="month_end_insights"&&e.sidePanelIsOpen!==!0&&K!=="expenseAutomationPage",children:t.jsxRuntimeExports.jsx(_t,{style:{width:"-webkit-fill-available",height:p[8]},formId:oRs(K),primaryBtn:qt,leftSideComponent:Zs,cancelBtn:dn,separatorStyle:{marginRight:o.sp4}})})]})})]})})},X$s=({reconciliation:e})=>{const{clearedBalance:n,variance:i,variancePercentage:r,deposits:a,payments:l}=e.reconciliationTabsState.balances,{balance:c}=e.selectedReconAccount?.accountReconEntity??{},{selectedReconAccount:d}=e,{transactionFetchState:u}=d??{},m=u?.fetchState==="In-Progress";return t.jsxRuntimeExports.jsx(aRs,{children:t.jsxRuntimeExports.jsxs(lRs,{children:[t.jsxRuntimeExports.jsx(fF,{children:m?t.jsxRuntimeExports.jsxs(wF,{children:[t.jsxRuntimeExports.jsx(fe,{height:22,width:120,style:{borderRadius:o.sp2}}),t.jsxRuntimeExports.jsx(fe,{height:27,width:120,style:{borderRadius:o.sp2}})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(yF,{children:[t.jsxRuntimeExports.jsx(jF,{children:cS.accountRecon.reconciliation.headers.bankBalance}),t.jsxRuntimeExports.jsx(bF,{children:t.jsxRuntimeExports.jsx(cRs,{})})]}),t.jsxRuntimeExports.jsx(CF,{children:Fe("0,0.00",c)})]})}),t.jsxRuntimeExports.jsx(fF,{children:m?t.jsxRuntimeExports.jsxs(wF,{children:[t.jsxRuntimeExports.jsx(fe,{height:22,width:120,style:{borderRadius:o.sp2}}),t.jsxRuntimeExports.jsx(fe,{height:27,width:120,style:{borderRadius:o.sp2}})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(yF,{children:[t.jsxRuntimeExports.jsxs(mRs,{children:[t.jsxRuntimeExports.jsx(jF,{children:cS.accountRecon.reconciliation.headers.clearedBalance}),t.jsxRuntimeExports.jsx(Le,{placement:"bottom",title:t.jsxRuntimeExports.jsxs(xRs,{children:[t.jsxRuntimeExports.jsxs(l4e,{children:[t.jsxRuntimeExports.jsxs(c4e,{children:[l.count," ",Rj.payments]}),t.jsxRuntimeExports.jsx(d4e,{children:Fe("0,0.[00]",l.totalAmount)})]}),t.jsxRuntimeExports.jsxs(l4e,{children:[t.jsxRuntimeExports.jsxs(c4e,{children:[a.count," ",Rj.deposits]}),t.jsxRuntimeExports.jsx(d4e,{children:Fe("0,0.[00]",a.totalAmount)})]})]}),display:"flex",children:t.jsxRuntimeExports.jsx(pRs,{})})]}),t.jsxRuntimeExports.jsx(bF,{children:t.jsxRuntimeExports.jsx(uRs,{})})]}),t.jsxRuntimeExports.jsx(CF,{children:Fe("0,0.00",n)})]})}),t.jsxRuntimeExports.jsx(fF,{children:m?t.jsxRuntimeExports.jsxs(wF,{children:[t.jsxRuntimeExports.jsx(fe,{height:22,width:120,style:{borderRadius:o.sp2}}),t.jsxRuntimeExports.jsx(fe,{height:27,width:120,style:{borderRadius:o.sp2}})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(yF,{children:[t.jsxRuntimeExports.jsx(jF,{children:cS.accountRecon.reconciliation.headers.variance}),t.jsxRuntimeExports.jsx(bF,{children:t.jsxRuntimeExports.jsx(dRs,{})})]}),t.jsxRuntimeExports.jsxs(CF,{children:[Fe("0,0.00",i),r!=null&&t.jsxRuntimeExports.jsx("span",{style:{marginLeft:2},children:`(${r.toFixed(2)}%)`})]})]})})]})})},gF=(e,n,i,r,a)=>{const l=r,c=(e>1?l+"s":l)+" selected";return e>0?t.jsxRuntimeExports.jsxs(nRs,{currentView:a,style:i==="small"?{position:"absolute",top:o.sp2,left:`-${o.sp5}`}:{},children:[t.jsxRuntimeExports.jsx(sRs,{multiDigit:e>=5,children:e}),t.jsxRuntimeExports.jsx(iRs,{children:c}),e===n?t.jsxRuntimeExports.jsx(rRs,{children:`(${V$s})`}):null]}):null},eRs=e=>{const n=q$s[e];return`${U$s}${Vb.space}${n}${Vb.space}${gMe.insights}`};function tRs(e,n){if(e.length===0)return{nextStep:void 0,previousStep:void 0};const i=e.findIndex(d=>d.step===n);if(i===-1)return{nextStep:void 0,previousStep:void 0};const r=(i+1)%e.length,a=(i-1+e.length)%e.length,l=e[r],c=e[a];return{nextStep:l,previousStep:c}}const oRs=e=>`${e}_form`,nRs=s.div`
71334
+ `,{common:{footer:Vi,texts:{maxLimitReached:V$s,confirmAction:Q$s},headers:gMe,create:U$s,strings:Vb,texts:Rj,cancel:G$s,confirm:Y$s,monthsByIndex:q$s},dateFormat:{visual:{MMMDCommaYYYYformat:a4e}},expenseAutomation:cS,uncategorizedTransactionList:{missingReceipt:{bulkUpload:Z$s}}}=O.getLocalizedStrings();function K$s(...e){for(const n of e)if(n!=null&&n>0&&!Number.isNaN(n))return n;return 0}const J$s=e=>{const{accountsForFilters:n,categoryOptions:i,classesForFilters:r,expenseAutomationViewSelector:a,isDisabled:l,isRealtimeInsightsFeatureEnabled:c,isUncategorizedExpenseCategoryEnabled:d,isCOTEnabled:u,onUpdateTab:m,onReconTabUpdate:x,onUpdateStep:h,onSearchTextChanged:f,onFiltersChange:y,onRefresh:C,onClose:b,onBack:E,onBulkUploadConfirmMatchAcknowledged:$,onClearMissingReceiptsTabNavigation:R,closeSidePanel:S,initialMissingReceiptsTab:k,resetTransactionCategorizationLocalData:T,updateOperatingExpensesIdsForReview:A,clearJeScheduleLocalData:I,onSaveReconciliation:B}=e,{isAccountingClassesEnabled:L}=e,P=e.bulkUploadEndpoint!=null||e.onBulkUploadFiles!=null,D=P$s({authParams:e.authParams,bulkUploadEndpoint:e.bulkUploadEndpoint,onBulkUploadProgress:e.onBulkUploadProgress,onBulkUploadSuccess:e.onBulkUploadSuccess,onBulkUploadUploadedFileCount:e.onBulkUploadUploadedFileCount,onBulkUploadFilesFallback:e.onBulkUploadFiles,onUploadError:e.onBulkUploadError}),{currentSelectedView:M,allSteps:F,missingReceipts:V,jeSchedules:N,fluxAnalysis:H,monthEndInsights:W,transactionView:U,selectedTransactionCategorizationTab:Y,reconciliation:q,selectedPeriod:Z}=a,{pendingMissingReceiptsTabNavigation:G}=V,[K,J]=g.useState("expenseAutomationPage"),oe=N.uiState.selectedMainTab??"pending_review",{onUpdateJESchedulesUIState:ee}=e,te=g.useCallback(Vt=>{ee({selectedMainTab:Vt})},[ee]),[se,ie]=g.useState(()=>{}),[re,ne]=g.useState(!1),me=X(),pe=!!e.loggedInUser?.userEmail?.includes("zeni.ai"),je=pe?vs:Nu,{openThread:ce,setOpenThread:de}=g.useContext(je),{useFeatureGate:ue}=Dc(),le=ue($p.isExpenseAutomationSearchAndFilterEnabled),{isReconV3Enabled:ae}=e,[ge,ye]=g.useState(!1),[he,Ce]=g.useState(!1),[we,ve]=g.useState(k??"missing"),Ee=g.useRef(null);g.useEffect(()=>{const Vt=Ee.current;Vt!==null&&Vt!==we&&S?.(),Ee.current=we},[we,S]);const Se=g.useCallback(Vt=>{ve(Vt)},[]),[$e,Be]=g.useState(null),Ae=g.useCallback(Vt=>{Be(Vt),J(Vt!=null?"expenseAutomationMissingReceipts":"expenseAutomationPage")},[J]),_e=e.bulkUploadSelector?.confirmMatchStatus.fetchState,Te=g.useRef(void 0);g.useEffect(()=>{Te.current==="In-Progress"&&_e==="Completed"&&$e!=null&&(Ae(null),$?.()),Te.current=_e},[_e,$e,Ae,$]),g.useEffect(()=>{we!=="unmatched"&&Ae(null)},[we,Ae]),g.useEffect(()=>{G==="unmatched"&&(P&&Se("unmatched"),R?.())},[G,R,P,Se]),g.useEffect(()=>{P===!1&&(we==="unmatched"||we==="completed")&&Se("missing")},[P,we,Se]);const{bulkUploadSelector:Re,onSetBulkUploadCompletedSubTab:ke}=e,Oe=g.useRef(null);g.useEffect(()=>{if(Re==null||Re.phase!=="completed")return;const Vt=Re.currentBatchId;if(Vt==null||Re.currentBatchDetailsFetched!==!0||Oe.current===Vt)return;Oe.current=Vt,Re.unmatchedFiles.length+Re.pastUnmatchedFiles.length>0?Se("unmatched"):(Se("completed"),ke?.("ai_accountant"))},[Re,ke,Se]);const[Me,Ie]=g.useState({categories:[],categoryCombinationOperator:"AND"});g.useEffect(()=>{if(le.isFeatureEnabled===!1&&Me.categories.length>0){const Vt={categories:[],categoryCombinationOperator:"AND"};Ie(Vt),y(Vt)}},[le.isFeatureEnabled,Me.categories.length,y]);const Ne=F.find(Vt=>Vt.step===M),{nextStep:Pe,previousStep:Qe}=tRs(F,M),{uiState:{searchString:Je,pageToken:tt},totalCountByTab:Ue,parentTabTotalCountByTab:dt,transactions:ct,fetchStateByTransactionTabs:yt,transactionLocalData:He}=U,[jt,St]=g.useState(Je??"");g.useEffect(()=>{St(Je??"")},[Je]);const We=g.useMemo(()=>t.debounce(Vt=>f(Vt),500,{leading:!1,trailing:!0}),[f]);g.useEffect(()=>()=>{We.cancel()},[We]);const nt=g.useCallback(Vt=>{St(Vt),We(Vt)},[We]),{selectedReconAccount:ut,reconciliationTabsState:{reconcile:{localData:{selectedTransactionIds:pt}}}}=q;let Bt="Not-Started",Ht="complete";switch(M){case"missing_receipts":Bt=V.refreshStatus.fetchState,Ht=V.completionStatus,we==="unmatched"&&e.bulkUploadSelector!=null&&(e.bulkUploadSelector.batchListFetchState.fetchState==="In-Progress"||e.bulkUploadSelector.batchDetailsPaginationState.fetchState==="In-Progress"||e.bulkUploadSelector.batchDetailsRevalidating===!0)&&Bt!=="In-Progress"&&(Bt="In-Progress");break;case"je_schedules":Bt=N.refreshStatus.fetchState,Ht=N.completionStatus;break;case"month_end_insights":W!=null&&(Bt=W?.fetchState);break;case"flux_analysis":Bt=H.refreshStatus.fetchState,Ht=H.completionStatus;break;case"transaction_categorization":Bt=U.refreshStatus.fetchState,Ht=U.completionStatus;break;case"reconciliation":ut==null?(Bt=q.refreshStatus.fetchState,Ht=q.completionStatus):(Bt=q.selectedReconAccount?.refreshStatus.fetchState??"Not-Started",Ht=q.completionStatus)}const $o=a.monthEndCloseChecksView.fetchState,Tt=$o==="Not-Started"||$o==="In-Progress",Gt=a.monthEndCloseChecksView.monthEndCloseChecks?.monthEndCloseCheckList.find(Vt=>Vt.id===M),so=Tt?void 0:Math.floor(Gt?.progress??0),no=()=>{se()},Xe=Vt=>{Ie(Vt),y(Vt)},ft=g.useMemo(()=>{const Vt=Q.TRANSACTION_FILTER_CATEGORIES,en=n??[],On=r??[];return Vt.reduce(($t,bo)=>{const mt=bo.value;switch(mt){case"amount":return{...$t,[mt]:[]};case"payment_account_name":{const Qt=en.map(wt=>({label:wt.accountName??"",value:wt.accountName??""}));return{...$t,[mt]:Qt}}case"payment_account_type":{const Qt=new Set,wt=[];for(const Kt of ct)Kt.paymentType==null||Kt.paymentType===""||Qt.has(Kt.paymentType)||(Qt.add(Kt.paymentType),wt.push({label:Kt.paymentTypeName??Kt.paymentType,value:Kt.paymentType}));return{...$t,[mt]:wt}}case"class":{const Qt=On.map(wt=>({label:wt.className??"",value:wt.classId??""}));return{...$t,[mt]:Qt}}case"category":{const Qt=i?.map(wt=>({label:wt.accountName??"",value:wt.accountId??""}))??[];return{...$t,[mt]:Qt}}default:return{...$t,[mt]:[]}}},{})},[n,r,i,ct]),{saveStatus:oo,selectedCheckBoxTransactionIds:on}=U,To=()=>{const Vt=yPe(a.fluxAnalysis.sections,a.fluxAnalysis.reviewOperatingExpensesIds);switch(K){case"expenseAutomationFluxPage":return{formId:"expenseAutomationFluxPage",isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Vt===!0?Vi.markAsReviewed:Rj.undo,style:{justifyContent:"space-evenly"},isLoading:a.fluxAnalysis.bulkReviewStatus.fetchState==="In-Progress",isDisabled:!1},leftSideComponent:gF(a.fluxAnalysis.reviewOperatingExpensesIds.length,u8,me,Rj.vendor,M),cancelBtn:{label:Vi.cancel,style:{width:"96px",justifyContent:"space-evenly"},onClick:()=>{A([])}}};case"expenseAutomationTransactionsPage":return{formId:"expenseAutomationTransactionsPage",isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Vi.save,style:{minWidth:"96px",justifyContent:"space-evenly"},isLoading:oo.fetchState==="In-Progress",isDisabled:U.hasInFlightCategoryClassRecommendations===!0},leftSideComponent:gF(on.length,Q.MAX_SELECTION_LIMIT,me,Rj.transaction,M),cancelBtn:{label:Vi.cancel,style:{width:"96px",justifyContent:"space-evenly"},onClick:()=>{T(Y,ct.map(en=>en.id),Z,!1,Ue[Y],Q.getLineItemsByTransactionIdsFromLocalData(He,Y),d,tt)}}};case"expenseAutomationJESchedulePage":return{formId:"expenseAutomationJESchedulePage",nextBtnLabel:Vi.next,backBtnLabel:Vi.back,isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Vi.next,style:{justifyContent:"space-evenly"},isDisabled:l||Ne?.isNextDisabled===!0||Pe==null,suffixIcon:t.jsxRuntimeExports.jsx(i4e,{}),onClick:()=>{Pe!=null&&h(Pe.step)}},cancelBtn:{label:Vi.back,isDisabled:l||Ne?.isPrevDisabled===!0||Qe==null,style:{width:"96px",justifyContent:"space-evenly"},prefixIcon:t.jsxRuntimeExports.jsx(r4e,{}),onClick:()=>{Qe!=null&&h(Qe.step)}}};case"expenseAutomationBankReconReconcilePage":return{formId:"expenseAutomationBankReconReconcilePage",nextBtnLabel:Vi.reconcile,backBtnLabel:Vi.saveForLater,isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Vi.reconcile,onClick:()=>{B({reconcileAction:"reconcile"})},isDisabled:q.reconciliationTabsState.balances.variance.amount!==0,isLoading:q.actionFetchStates.reconcileFetch.fetchState==="In-Progress",style:{justifyContent:"space-evenly",minWidth:132}},leftSideComponent:gF(pt.length,1/0,me,Rj.transaction,M),cancelBtn:{onClick:()=>{B({reconcileAction:"save_reconcile_for_later"})},reverseSpinnerColor:!1,isLoading:q.actionFetchStates.saveForLaterFetch.fetchState==="In-Progress",label:Vi.saveForLater,style:{minWidth:132,justifyContent:"space-evenly"}}};case"expenseAutomationJEAccountSettingsPage":return{formId:"expenseAutomationJEAccountSettingsPage",nextBtnLabel:Vi.save,backBtnLabel:Vi.cancel,isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Vi.save,isLoading:N.accountSettingsView.saveState.fetchState==="In-Progress",style:{justifyContent:"space-evenly",minWidth:82}},cancelBtn:{onClick:()=>no(),label:Vi.cancel,style:{minWidth:82,justifyContent:"space-evenly"}}};case"expenseAutomationMissingReceipts":return{formId:"expenseAutomationMissingReceipts",isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:Z$s.confirmMatch,isLoading:e.bulkUploadSelector?.confirmMatchStatus.fetchState==="In-Progress",isDisabled:$e==null||e.bulkUploadSelector?.confirmMatchStatus.fetchState==="In-Progress",style:{minWidth:"96px",justifyContent:"space-evenly"},onClick:()=>{$e!=null&&e.bulkUploadSelector?.confirmMatchStatus.fetchState!=="In-Progress"&&e.onConfirmBulkUploadMatch?.($e.batchId,$e.attachmentId,$e.transactionId,$e.transactionType,$e.fileName)}},cancelBtn:{label:Vi.cancel,style:{width:"96px",justifyContent:"space-evenly"},onClick:()=>Ae(null)}};default:{const en=M==="reconciliation"&&a.reconciliation.selectedTab==="review"&&a.reconciliation.selectedAccountId!=null,On=M==="reconciliation"&&a.reconciliation.selectedAccountId==null,$t=M==="reconciliation"&&a.reconciliation.selectedTab==="reconcile"&&a.reconciliation.selectedAccountId!=null,bo=Pe?.step==="month_end_insights"&&(M==="flux_analysis"&&(a.fluxAnalysis.sections.generalExpense?.balancesByMonth!=null||a.fluxAnalysis.sections.reimbursement?.balancesByMonth!=null)||On),mt=M==="transaction_categorization"&&a.selectedTransactionCategorizationTab==="review",Qt=M==="transaction_categorization"&&a.selectedTransactionCategorizationTab==="autoCategorized",wt=a.monthEndCloseChecksView.monthEndCloseChecks?.monthEndCloseCheckList.find(_o=>_o.id==="month_end_insights"),Kt=a.monthEndCloseChecksView.monthEndCloseChecks?.reportEmailSentDate==null&&wt?.isDisabled===!1&&(c||Ne?.isNextDisabled===!1),ks=Pe?.step==="month_end_insights"&&(On||M==="flux_analysis")?!Kt:Ne?.isNextDisabled===!0;return{formId:"expenseAutomationPage",nextBtnLabel:Vi.next,backBtnLabel:Vi.back,isNextDisabled:!1,isPrevDisabled:!1,primaryBtn:{label:bo===!0?eRs(a.selectedPeriod.month):Vi.next,style:{justifyContent:"space-evenly"},isDisabled:ks||Pe==null,suffixIcon:t.jsxRuntimeExports.jsx(i4e,{}),onClick:()=>{mt?m("autoCategorized"):en?x("reconcile"):Pe!=null&&h(Pe.step)}},cancelBtn:{label:Vi.back,isDisabled:l||Ne?.isPrevDisabled===!0||Qe==null,style:{width:"96px",justifyContent:"space-evenly"},prefixIcon:t.jsxRuntimeExports.jsx(r4e,{}),onClick:()=>{Qt?m("review"):$t?x("review"):en?E():Qe!=null&&h(Qe.step)}}}}}},kn=()=>{switch(K){case"expenseAutomationFluxPage":return{confirmAction:()=>{ye(!1),A([]),b()}};case"expenseAutomationTransactionsPage":return{confirmAction:()=>{ye(!1),T(Y,ct.map(Vt=>Vt.id),Z,!1,Ue[Y],Q.getLineItemsByTransactionIdsFromLocalData(He,Y),d,tt),b()}};case"expenseAutomationJESchedulePage":return{confirmAction:()=>{ye(!1),I(),b()}};default:return{confirmAction:()=>{ye(!1)},confirmationDescription:Vb.empty}}},Dn=()=>{K==="expenseAutomationFluxPage"||K==="expenseAutomationJESchedulePage"||K==="expenseAutomationTransactionsPage"?ye(!0):b()},{primaryBtn:qt,cancelBtn:dn,leftSideComponent:Zs}=To(),{confirmAction:Yn}=kn(),Hs=Vt=>{if(M==="transaction_categorization"&&(Vt==="autoCategorized"||Vt==="review")){const en=Vt;return{count:dt[en],isFetching:yt[en].fetchState==="In-Progress"}}if(M==="reconciliation"){const{reconciliation:en}=a,{selectedAccountId:On}=en;return On==null?{count:0,isFetching:!1}:Vt==="review"?{count:en.accountReconciliationsByAccountID[On]?.accountReconEntity?.transactionsToReview.length,isFetching:en.accountReconciliationsByAccountID[On]?.transactionFetchState.fetchState==="In-Progress"}:{count:en.accountReconciliationsByAccountID[On]?.accountReconEntity?.transactionsToReconcile.length,isFetching:en.accountReconciliationsByAccountID[On]?.transactionFetchState.fetchState==="In-Progress"}}if(M==="missing_receipts"){if(Vt==="missing")return{count:V.transactions.length,isFetching:V.fetchState==="In-Progress"};if(Vt==="unmatched")return{count:(e.bulkUploadSelector?.unmatchedFiles.length??0)+(e.bulkUploadSelector?.pastUnmatchedFiles.length??0),isFetching:we==="unmatched"&&ZPe({bulkUploadSelector:e.bulkUploadSelector})};if(Vt==="completed")return{count:e.bulkUploadSelector?.completedTransactions?.totalCount??0,isFetching:e.bulkUploadSelector?.completedTransactions?.fetchState?.fetchState==="In-Progress",hideCountInTab:!0}}if(M==="je_schedules"){if(Vt==="pending_review")return{count:N.draftSchedules.length+N.resolveSchedules.length,isFetching:N.fetchState==="In-Progress"};if(Vt==="ongoing")return N.ongoingSchedules.length>0?{count:N.ongoingSchedules.length,isFetching:!1}:void 0;if(Vt==="completed")return N.completedSchedules.length>0?{count:N.completedSchedules.length,isFetching:!1}:void 0}},yn=M==="reconciliation"&&q.selectedAccountId!=null&&q.selectedReconAccount!=null,{month:Go,year:ds}=Z,In=Q.dateNow().set("month",Go-1).set("year",ds),ts=In.startOf("month").format(a4e),pn=In.endOf("month").format(a4e),_s=`${ts} ${Vb.hyphen} ${pn}`,us=e.sidePanelIsOpen??!1,js=e.sidePanelIsFullView??!1,xn=M==="missing_receipts"&&we==="missing"&&P,As=e.bulkUploadSelector?.phase,nn=e.bulkUploadSelector,os=K$s(nn?.progress.total,nn?.uploadedFileCount,D.uploadFileCount),qe={bulkUploadPhase:As,isDraggingFiles:D.isDraggingFiles,isUploading:D.isUploading===!0,matchingProgressBannerTotal:os,onDismissUploadError:D.clearUploadError,onFilesSelected:D.handleBulkUploadFiles,showEmailOrDropZone:D.isUploading!==!0&&As!=="matching"&&V.fetchState!=="In-Progress"&&V.fetchState!=="Not-Started",uploadError:D.uploadError,uploadFileCount:D.uploadFileCount},xt=M==="missing_receipts"&&we==="completed"&&P&&e.bulkUploadSelector!=null,Wt=M==="transaction_categorization"&&Y==="autoCategorized",Ze={onDragLeave:D.handleDragLeave,onDragOver:D.handleDragOver,onDrop:D.handleDrop},Mo=M==="reconciliation"&&q.selectedAccountId==null,Lo=Wt?t.jsxRuntimeExports.jsx($3s,{activeSubTab:U.selectedTransactionCategorizationCompletedSubTab,allTabs:M$s,onSubTabChange:e.onUpdateTransactionCategorizationCompletedSubTab}):null,_n=xn===!0&&!(us&&js)?t.jsxRuntimeExports.jsx(Z5e,{...Ze,children:t.jsxRuntimeExports.jsx(n4e,{...qe})}):xt===!0&&!(us&&js)&&e.bulkUploadSelector!=null?t.jsxRuntimeExports.jsx(s4e,{activeSubTab:e.bulkUploadSelector.completedSubTab,onSubTabChange:Vt=>{e.onSetBulkUploadCompletedSubTab?.(Vt)}}):Wt&&!(us&&js)?Lo:Mo?ae===!0?q.fetchStatus.fetchState==="Completed"?t.jsxRuntimeExports.jsx(Z9s,{reconciliation:q}):null:t.jsxRuntimeExports.jsx(Q9s,{}):null,ns=e.isExpenseAutomationCommentingEnabled===!0&&(M==="transaction_categorization"||M==="reconciliation"||M==="missing_receipts"||M==="flux_analysis"||M==="je_schedules");return t.jsxRuntimeExports.jsx(Hdo,{companyId:e.companyId,currentSelectedView:M,isCommentingEnabled:ns,onThreadClickRoute:e.onExpenseAutomationCommentingThreadClick,children:t.jsxRuntimeExports.jsxs(O$s,{children:[ge?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:Q$s}),primaryButtonText:Y$s,secondaryButtonText:G$s,proceedButtonVariant:"destructive",action:{onOkClick:()=>{Yn()},onCancelClick:()=>ye(!1)},descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:cS.confirmationDescription})}):null,t.jsxRuntimeExports.jsx(U0,{isOpen:e.sidePanelIsOpen??!1,isFullView:e.sidePanelIsFullView??!1,listContentPercent:e.sidePanelListPercent,disableMarginTop:L$s(M,P),panelContent:e.panelContent,headerContent:t.jsxRuntimeExports.jsx(L5s,{filters:Me,selectedEntity:"transaction_categorization",vendorSearchAutoCompleteData:e.vendorSearchAutoCompleteData,vendorSearchAutoCompleteActions:e.vendorSearchAutoCompleteActions,hideTabSwitcher:re===!0,isCompletionLoading:Tt,completionProgressRaw:Gt!=null&&Number.isFinite(Gt.progress)?Gt.progress:void 0,completionPercentage:so,onBack:E,navBarCustomElement:M==="reconciliation"&&q.selectedAccountId!=null?t.jsxRuntimeExports.jsx(X$s,{reconciliation:q}):void 0,onReconTabUpdate:x,currentRecontab:q.selectedTab,currentMissingReceiptsTab:we,onMissingReceiptsTabUpdate:Se,currentJeTab:oe,onJeTabUpdate:te,selectedGenericTab:M==="je_schedules"?oe:void 0,searchText:jt,onRefresh:M==="missing_receipts"?()=>{switch(we){case"missing":e.onFetchMissingReceiptsList();break;case"unmatched":e.onFetchBulkUploadBatches?.({cacheOverride:!0,invalidateBatchDetailsCache:!0});break;case"completed":e.onFetchCompletedTransactions?.(void 0,!0);break}}:C,onFiltersChange:Xe,filterOptions:ft,onGenericTabChange:M==="je_schedules"?Vt=>te(Vt.id):void 0,reconcileDetailPageFetchState:q.selectedAccountId!=null?q.accountReconciliationsByAccountID[q.selectedAccountId]?.transactionFetchState.fetchState:"Not-Started",selectedReconAccountId:yn?q.selectedAccountId:void 0,currentSelectedView:M,titleStyle:{justifyContent:"center",marginLeft:o.sp0},headerData:Kr(M,dt.autoCategorized,yn?q.selectedAccountId:void 0,yn?q.selectedReconAccount?.accountReconEntity?.account.accountName:void 0,yn?_s:void 0,Y,le.isFeatureEnabled,M==="missing_receipts"?{includeBulkUploadTabs:P,navTitle:P?gMe.receipts:void 0}:void 0,ns),currentTab:Y,getTabCountAndFetchState:Hs,completionStatus:Ht,refreshStatus:Bt,companyId:e.companyId,companyName:a.monthEndInsights?.companyName??Vb.empty,isZeniUser:pe,onAllThreadsClick:()=>{ce!=null&&de(null),Ce(!0)},onUpdateTab:m,onSearchTextChanged:nt,onClose:Dn,belowTabsSlot:_n,isAiCfoAccessEnabled:e.isAiCfoAccessEnabled,onAskAiCfoClick:e.onAskAiCfoClick}),listContent:t.jsxRuntimeExports.jsxs(z$s,{children:[M==="missing_receipts"?t.jsxRuntimeExports.jsx(LEs,{isAccountingClassesEnabled:L,missingReceiptsTab:we,missingTransactionCount:V.transactions.length,missingReceiptsBulkUploadChromeInPageBody:xn===!0&&us&&js?t.jsxRuntimeExports.jsx(Z5e,{...Ze,children:t.jsxRuntimeExports.jsx(n4e,{...qe})}):null,missingReceiptsCompletedChromeInPageBody:xt===!0&&us&&js&&e.bulkUploadSelector!=null?t.jsxRuntimeExports.jsx(s4e,{activeSubTab:e.bulkUploadSelector.completedSubTab,onSubTabChange:Vt=>{e.onSetBulkUploadCompletedSubTab?.(Vt)}}):Wt&&us&&js?Lo:null,bulkUploadInteractions:D,bulkUploadSelector:e.bulkUploadSelector,selectedPeriod:Z,authParams:e.authParams,bulkUploadEndpoint:e.bulkUploadEndpoint,transactionAttachmentsEndpoint:e.transactionAttachmentsEndpoint,onBulkUploadSuccess:e.onBulkUploadSuccess,onBulkUploadFiles:e.onBulkUploadFiles,onClearBulkUploadBatchDetailsForScopeChange:e.onClearBulkUploadBatchDetailsForScopeChange,onFetchBulkUploadBatches:e.onFetchBulkUploadBatches,onFetchMoreBatchDetails:e.onFetchMoreBatchDetails,onFetchCompletedTransactions:e.onFetchCompletedTransactions,onDeleteUnmatchedReceipt:e.onDeleteUnmatchedReceipt,onLoadMoreManualSearch:e.onLoadMoreManualSearch,onSearchTransactionsForManualMatch:e.onSearchTransactionsForManualMatch,onPendingMatchChange:Ae,pendingMatchAttachmentId:$e?.attachmentId??null,pendingMatchTransactionId:$e?.transactionId??null,onMissingReceiptsRowClick:e.onMissingReceiptsRowClick,onSetBulkUploadCompletedSubTab:e.onSetBulkUploadCompletedSubTab,onSetBulkUploadSortConfig:e.onSetBulkUploadSortConfig,onResetBulkUploadSort:e.onResetBulkUploadSort,setMissingReceiptsTab:Se,tableSectionProps:{parentProps:{...e,filters:Me,isAccountingClassesEnabled:L},isCOTEnabled:u,setIsJeAccountSettingsOpened:ne,setResetJeAccountSettingsForm:ie,allThreadsSectionOpen:he,setCurrentFooterFormId:J,currentFooterFormId:K,onCloseAllThreadsSection:()=>Ce(!1)}}):M==="flux_analysis"?t.jsxRuntimeExports.jsxs(W$s,{children:[t.jsxRuntimeExports.jsx(K9s,{}),t.jsxRuntimeExports.jsx(lS,{filters:Me,...e,isAccountingClassesEnabled:L,isCOTEnabled:u,selectedMainTab:oe,setIsJeAccountSettingsOpened:ne,setResetJeAccountSettingsForm:ie,allThreadsSectionOpen:he,setCurrentFooterFormId:J,currentFooterFormId:K,onCloseAllThreadsSection:()=>Ce(!1)})]}):M==="transaction_categorization"?t.jsxRuntimeExports.jsxs(F$s,{children:[t.jsxRuntimeExports.jsx(N$s,{children:t.jsxRuntimeExports.jsx(lS,{filters:Me,...e,isAccountingClassesEnabled:L,isCOTEnabled:u,selectedMainTab:oe,setIsJeAccountSettingsOpened:ne,setResetJeAccountSettingsForm:ie,allThreadsSectionOpen:he,setCurrentFooterFormId:J,currentFooterFormId:K,onCloseAllThreadsSection:()=>Ce(!1)})}),e.isTransactionActivityEnabled===!0||e.isRightPanelOpen===!0?t.jsxRuntimeExports.jsx(H$s,{$isOpen:e.isRightPanelOpen===!0&&e.rightSidePanel!=null,children:e.isRightPanelOpen===!0&&e.rightSidePanel!=null?e.rightSidePanel:null}):null]}):t.jsxRuntimeExports.jsx(lS,{filters:Me,...e,isAccountingClassesEnabled:L,isCOTEnabled:u,selectedMainTab:oe,setIsJeAccountSettingsOpened:ne,setResetJeAccountSettingsForm:ie,allThreadsSectionOpen:he,setCurrentFooterFormId:J,currentFooterFormId:K,onCloseAllThreadsSection:()=>Ce(!1)}),t.jsxRuntimeExports.jsx(bt,{controller:M!=="month_end_insights"&&e.sidePanelIsOpen!==!0&&K!=="expenseAutomationPage",children:t.jsxRuntimeExports.jsx(_t,{style:{width:"-webkit-fill-available",height:p[8]},formId:oRs(K),primaryBtn:qt,leftSideComponent:Zs,cancelBtn:dn,separatorStyle:{marginRight:o.sp4}})})]})})]})})},X$s=({reconciliation:e})=>{const{clearedBalance:n,variance:i,variancePercentage:r,deposits:a,payments:l}=e.reconciliationTabsState.balances,{balance:c}=e.selectedReconAccount?.accountReconEntity??{},{selectedReconAccount:d}=e,{transactionFetchState:u}=d??{},m=u?.fetchState==="In-Progress";return t.jsxRuntimeExports.jsx(aRs,{children:t.jsxRuntimeExports.jsxs(lRs,{children:[t.jsxRuntimeExports.jsx(fF,{children:m?t.jsxRuntimeExports.jsxs(wF,{children:[t.jsxRuntimeExports.jsx(fe,{height:22,width:120,style:{borderRadius:o.sp2}}),t.jsxRuntimeExports.jsx(fe,{height:27,width:120,style:{borderRadius:o.sp2}})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(yF,{children:[t.jsxRuntimeExports.jsx(jF,{children:cS.accountRecon.reconciliation.headers.bankBalance}),t.jsxRuntimeExports.jsx(bF,{children:t.jsxRuntimeExports.jsx(cRs,{})})]}),t.jsxRuntimeExports.jsx(CF,{children:Fe("0,0.00",c)})]})}),t.jsxRuntimeExports.jsx(fF,{children:m?t.jsxRuntimeExports.jsxs(wF,{children:[t.jsxRuntimeExports.jsx(fe,{height:22,width:120,style:{borderRadius:o.sp2}}),t.jsxRuntimeExports.jsx(fe,{height:27,width:120,style:{borderRadius:o.sp2}})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(yF,{children:[t.jsxRuntimeExports.jsxs(mRs,{children:[t.jsxRuntimeExports.jsx(jF,{children:cS.accountRecon.reconciliation.headers.clearedBalance}),t.jsxRuntimeExports.jsx(Le,{placement:"bottom",title:t.jsxRuntimeExports.jsxs(xRs,{children:[t.jsxRuntimeExports.jsxs(l4e,{children:[t.jsxRuntimeExports.jsxs(c4e,{children:[l.count," ",Rj.payments]}),t.jsxRuntimeExports.jsx(d4e,{children:Fe("0,0.[00]",l.totalAmount)})]}),t.jsxRuntimeExports.jsxs(l4e,{children:[t.jsxRuntimeExports.jsxs(c4e,{children:[a.count," ",Rj.deposits]}),t.jsxRuntimeExports.jsx(d4e,{children:Fe("0,0.[00]",a.totalAmount)})]})]}),display:"flex",children:t.jsxRuntimeExports.jsx(pRs,{})})]}),t.jsxRuntimeExports.jsx(bF,{children:t.jsxRuntimeExports.jsx(uRs,{})})]}),t.jsxRuntimeExports.jsx(CF,{children:Fe("0,0.00",n)})]})}),t.jsxRuntimeExports.jsx(fF,{children:m?t.jsxRuntimeExports.jsxs(wF,{children:[t.jsxRuntimeExports.jsx(fe,{height:22,width:120,style:{borderRadius:o.sp2}}),t.jsxRuntimeExports.jsx(fe,{height:27,width:120,style:{borderRadius:o.sp2}})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(yF,{children:[t.jsxRuntimeExports.jsx(jF,{children:cS.accountRecon.reconciliation.headers.variance}),t.jsxRuntimeExports.jsx(bF,{children:t.jsxRuntimeExports.jsx(dRs,{})})]}),t.jsxRuntimeExports.jsxs(CF,{children:[Fe("0,0.00",i),r!=null&&t.jsxRuntimeExports.jsx("span",{style:{marginLeft:2},children:`(${r.toFixed(2)}%)`})]})]})})]})})},gF=(e,n,i,r,a)=>{const l=r,c=(e>1?l+"s":l)+" selected";return e>0?t.jsxRuntimeExports.jsxs(nRs,{currentView:a,style:i==="small"?{position:"absolute",top:o.sp2,left:`-${o.sp5}`}:{},children:[t.jsxRuntimeExports.jsx(sRs,{multiDigit:e>=5,children:e}),t.jsxRuntimeExports.jsx(iRs,{children:c}),e===n?t.jsxRuntimeExports.jsx(rRs,{children:`(${V$s})`}):null]}):null},eRs=e=>{const n=q$s[e];return`${U$s}${Vb.space}${n}${Vb.space}${gMe.insights}`};function tRs(e,n){if(e.length===0)return{nextStep:void 0,previousStep:void 0};const i=e.findIndex(d=>d.step===n);if(i===-1)return{nextStep:void 0,previousStep:void 0};const r=(i+1)%e.length,a=(i-1+e.length)%e.length,l=e[r],c=e[a];return{nextStep:l,previousStep:c}}const oRs=e=>`${e}_form`,nRs=s.div`
71335
71335
  display: flex;
71336
71336
  justify-content: flex-start;
71337
71337
  align-items: center;
@@ -72140,7 +72140,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
72140
72140
  color: ${e=>e.status==="connected"?e.theme.colors.success:e.status==="reconnect"?e.theme.colors.important:e.theme.colors.link};
72141
72141
  cursor: pointer;
72142
72142
  text-decoration: underline;
72143
- `,{common:l1,expenseAutomation:{accountRecon:ji}}=O.getLocalizedStrings();function RV(e){return typeof e=="number"&&Number.isFinite(e)}function dSs(e){const n=e.accountSubType?.replace(/_/g," ")??"",i=n.length>0?n.charAt(0).toUpperCase()+n.slice(1):"",r=e.qboId!=null&&e.qboId.length>=4?e.qboId.slice(-4):"";return i.length===0&&r.length===0?"":r.length===0?i:`${i} • • • • ${r}`}function $Me(e,n){const{accountReconEntity:i,statementParseInProgress:r}=e;return i.statementStatus?.code==="uploaded"||r===!0||n||i.statementMetaData?.file!=null}function uSs(e){const n=e.accountReconEntity,i=n.reconciliationStatus;if(i?.code==="save_for_later"||i?.code==="pending")return!0;const r=e.accountConnectionStatus==="connected",a=n.statementDataStatus?.code==="validated"||n.statementDataStatus?.code==="processed";return!!(i==null&&(r||a)&&n.balance!=null&&n.clearedBalance!=null)}function pSs(e){return e==null||!RV(e.amount)?!1:(e.currencySymbol??"").length>0}function mSs({variance:e,variancePercentage:n}){if(!pSs(e))return t.jsxRuntimeExports.jsx($V,{children:l1.strings.hyphen});const i=n!=null&&Number.isFinite(n)?n:null;return t.jsxRuntimeExports.jsxs(Kvs,{children:[t.jsxRuntimeExports.jsx(qvs,{children:Fe("0,0",e)}),i!=null?t.jsxRuntimeExports.jsxs(Zvs,{children:["(",i===0?"0":i.toFixed(2),l1.strings.percentage,")"]}):null]})}const RMe=(e,n)=>`${e}.${n}`,xSs="accountReconDrawerDetailsPage",Tq="accountReconDrawerDetailsSection";function hSs({accountReconciliation:e,plaidConnectionDetails:n,monthYearPeriod:i,openFilePicker:r,filesEndPoint:a,authParams:l,excludeAccountFetch:c,onDismissClick:d,onFetchLinkTokenClick:u,onEstablishConnectionClick:m,onExcludeFromReconciliation:x,onSelectSourceType:h,onDeleteFile:f,onEditFileName:y,onStatementUploadSuccess:C,onUploadWindowOpenedOnce:b,onFileUploadStarted:E,onRetryParsing:$,onReviewClicked:R,onDismissStatementProcessingFailed:S,onReuploadStatement:k,onStatementConfirmSave:T,onStatementFormDataChange:A,statementProcessingFailed:I,isReconV3Enabled:B}){const L=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:B4e(e),resetOptions:{keepDirtyValues:!0,keepErrors:!0},values:B4e(e)}),[P,D]=g.useState(!1),[M,F]=g.useState({completedSteps:0,isActive:!1,showParseInfo:!1,uploadComplete:!1}),[V,N]=g.useState(void 0);g.useEffect(()=>{M.showParseInfo!==!0&&N(void 0)},[M.showParseInfo]);const H=L.handleSubmit(()=>{}),[W,U]=g.useState(void 0),Y=n.link_account_no_microdeposit,q=n.update_account,Z=W==="update_account"?q:Y,[G,K]=g.useState(Z.linkToken??null),[J,oe]=g.useState(!1),[ee,te]=g.useState(!1),[se,ie]=g.useState(void 0),[re,ne]=g.useState(void 0),[me,pe]=g.useState(!1),je=g.useCallback(()=>{U("link_account_no_microdeposit")},[]),ce=g.useCallback(()=>{U("update_account"),u("update_account",e.paymentAccountId)},[e.paymentAccountId]),de={onOkClick:()=>{se!=null&&(f(se),ie(void 0)),ne(void 0),te(!1)},onCancelClick:()=>{ie(void 0),te(!1)}},ue=g.useRef(W);g.useEffect(()=>{ue.current=W},[W]);const le=M.isActive&&!M.showParseInfo&&e.parsedStatementData!=null,ae=e.accountReconEntity.statementDataStatus?.code,ge=g.useCallback(()=>{pe(!1),S?.()},[S]),ye=g.useCallback(()=>{ge(),k?.()},[ge,k]);g.useEffect(()=>{I===!0&&ae?.includes("failed")===!0&&(F({isActive:!1,uploadComplete:!1,showParseInfo:!1,completedSteps:0}),pe(!0))},[I,ae]);const he=g.useCallback(()=>{F(Ue=>({...Ue,showParseInfo:!0}))},[]);g.useEffect(()=>{B===!0&&!M.isActive&&e.statementUploadStatus?.fetchState==="In-Progress"&&(F({isActive:!0,uploadComplete:!1,showParseInfo:!1,completedSteps:0}),S?.())},[B,M.isActive,e.statementUploadStatus?.fetchState,S]),g.useEffect(()=>{M.isActive&&!M.uploadComplete&&e.accountReconEntity.statementMetaData?.file!=null&&F(Ue=>({...Ue,uploadComplete:!0}))},[M.isActive,M.uploadComplete,e.accountReconEntity.statementMetaData?.file]),g.useEffect(()=>{B===!0&&e.reparseStatementStatus?.fetchState==="In-Progress"&&(F({isActive:!0,uploadComplete:!0,showParseInfo:!1,completedSteps:0}),S?.())},[B,e.reparseStatementStatus?.fetchState,S]);const Ce=()=>{F({isActive:!1,uploadComplete:!1,showParseInfo:!1,completedSteps:0})},we=()=>{F({isActive:!1,uploadComplete:!1,showParseInfo:!1,completedSteps:0})},ve=()=>{F({isActive:!1,uploadComplete:!1,showParseInfo:!1,completedSteps:0})},Ee=()=>{const Ue=e.accountReconEntity.statementMetaData?.statementUploadId??"";Ue!==""&&$!=null&&$(e.accountReconEntity.account.accountId,i,Ue)},Se=()=>{T?.()},$e=g.useCallback(Ue=>{m(Ue,e.accountReconEntity.account.accountId,ue.current),U(void 0),oe(!1)},[m,e.accountReconEntity.account.accountId]),Be=g.useCallback((Ue,Je)=>{Ue!=null&&console.log("Plaid Connection Error",Ue,Je),U(void 0),oe(!1)},[]),{open:Ae,ready:_e}=Pc.usePlaidLink({token:G,onSuccess:$e,onExit:Be});g.useEffect(()=>{(Q.zeniDate(new Date().toISOString()).isAfter(Z.expiration)||Z.linkToken==null)&&Z.fetchStatus.fetchState==="Not-Started"&&u("link_account_no_microdeposit")},[Z.fetchStatus.fetchState]),g.useEffect(()=>{!J&&W!=null&&Z.linkToken===G&&Z.fetchStatus.fetchState==="Completed"&&_e&&oe(!0)},[_e,G,Z.fetchStatus.fetchState,Z.linkToken,W,J]),g.useEffect(()=>{Z.fetchStatus.fetchState==="Completed"&&Z.linkToken!=null&&Z.linkToken!==G&&K(Z.linkToken)},[Z.fetchStatus.fetchState,Z.linkToken,G]),g.useEffect(()=>{J&&Ae()},[J,Ae]),g.useEffect(()=>{c.fetchState==="Completed"&&D(!1)},[c.fetchState]);const Te=e.accountReconEntity.account,Re=e.accountReconEntity.statementMetaData?.file,ke=e.accountConnectionStatus==="connected"||e.accountConnectionStatus==="reconnect"||e.connectionInProgress===!0,Oe=dSs(Te),Me=ke||$Me(e,!1),[Ie,Ne]=g.useState(Re);g.useEffect(()=>{M.showParseInfo!==!0&&Ne(Re)},[M.showParseInfo,Re]);const Pe=M.showParseInfo===!0?Ie:Re;if(M.showParseInfo||M.isActive){const Ue=M.showParseInfo?ve:Ce;return t.jsxRuntimeExports.jsx(GRs,{accountName:Te.accountName??"",file:Pe,navSource:M.showParseInfo?"StatementParseInfo":"StatementProcessingPage",highlightedCitations:M.showParseInfo?V:void 0,onBack:Ue,children:M.showParseInfo?t.jsxRuntimeExports.jsx(bMe,{parsedData:e.parsedStatementData,statementUpdateFetchState:e.statementUpdateStatus.fetchState,onClose:ve,onRetry:Ee,onConfirmSave:Se,onFormDataChange:Je=>A?.(Je),onHighlightedCitationsChange:N}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(EMe,{isUploadComplete:M.uploadComplete,_storyCompletedSteps:M.completedSteps,isParsedDataReady:le,onCancel:Ce,onContinueInBackground:we,onAllStepsComplete:he})})})}return t.jsxRuntimeExports.jsxs(Bvs,{children:[t.jsxRuntimeExports.jsx(Mvs,{children:t.jsxRuntimeExports.jsxs(Dvs,{children:[t.jsxRuntimeExports.jsxs(_vs,{children:[t.jsxRuntimeExports.jsx(Hvs,{children:Te.accountName}),Me===!0&&Oe.length>0?t.jsxRuntimeExports.jsx(Wvs,{children:Oe}):null]}),e.accountConnectionStatus==="connected"?t.jsxRuntimeExports.jsx(Z5,{tagTitle:ji.reconciliation.drawer.values.connected,textColor:{color:t.Color(v.tagSuccessColorLight),backgroundColor:t.Color(v.tagSuccessBgLight),borderColor:t.Color(v.tagSuccessBgLight)},style:{padding:o.sp0}}):null,t.jsxRuntimeExports.jsxs(Ovs,{children:[t.jsxRuntimeExports.jsx(Gx,{moreIconType:"plain",menuPosition:"fixed",menuPortalTarget:typeof document<"u"?document.body:null,options:[{label:ji.reconciliation.drawer.excludeFromReconciliation,value:"exclude"}],onOptionSelection:Ue=>{Ue==="exclude"&&D(!0)},valueToIcon:Ue=>Ue==="exclude"?t.jsxRuntimeExports.jsx(zvs,{}):null,customStyleConfig:{menu:Ue=>({...Ue,width:"max-content"})}}),t.jsxRuntimeExports.jsx(Fvs,{type:"button","aria-label":"Close",onClick:d,children:t.jsxRuntimeExports.jsx(Nvs,{})})]})]})}),t.jsxRuntimeExports.jsxs(Pvs,{children:[t.jsxRuntimeExports.jsxs(t.FormProvider,{...L,children:[t.jsxRuntimeExports.jsx("form",{style:{width:"100%"},id:xSs,onSubmit:H,children:t.jsxRuntimeExports.jsx(gSs,{monthYearPeriod:i,accountReconciliation:e,filesEndPoint:a,openFilePicker:r,authParams:l,onConnectClick:je,onReconnectClick:ce,onSelectSourceType:h,onEditFileName:y,onStatementUploadSuccess:C,onUploadWindowOpenedOnce:b,onFileUploadStarted:()=>{E?.(),B===!0&&F({isActive:!0,uploadComplete:!1,showParseInfo:!1,completedSteps:0})},setShowConfirmationPopup:te,setDeleteFileId:ie,uploadErrorMessage:re,setUploadErrorMessage:ne})}),me?t.jsxRuntimeExports.jsx(po,{shouldClickAway:!1,containerStyle:{width:416,maxWidth:416},titleComponent:t.jsxRuntimeExports.jsx(So,{children:ji.reconciliation.drawer.fileValidationFailed.heading}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:ji.reconciliation.drawer.fileValidationFailed.description}),secondaryButtonText:ji.reconciliation.drawer.fileValidationFailed.cancel,primaryButtonText:ji.reconciliation.drawer.fileValidationFailed.reupload,primaryButtonWidth:178,secondaryButtonWidth:178,action:{onCancelClick:ge,onOkClick:ye},children:t.jsxRuntimeExports.jsx(Vvs,{children:t.jsxRuntimeExports.jsx(mu,{name:RMe(Tq,"file"),file:e.accountReconEntity.statementMetaData?.file,showPhotoPicker:!1,isDisabled:!0,sizeLimit:1e7,deleteFileStatusById:{},updateFileStatusById:{},filesEndPoint:a,authParams:l,acceptableTypes:["application/pdf","image/jpg","image/jpeg","image/png"]})})}):null]}),ee===!0||e.statementDeleteStatus.fetchState==="In-Progress"?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:ji.reconciliation.drawer.deleteConfirmation.heading}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:ji.reconciliation.drawer.deleteConfirmation.description}),isLoading:e.statementDeleteStatus.fetchState==="In-Progress",proceedButtonVariant:"destructive",primaryButtonText:l1.confirm,secondaryButtonText:l1.cancel,action:de}):null]}),P?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(rSs,{children:ji.reconciliation.drawer.excludeConfirmation.heading(e.accountReconEntity.account.accountName)}),descriptionComponent:t.jsxRuntimeExports.jsx(aSs,{children:ji.reconciliation.drawer.excludeConfirmation.description}),primaryButtonText:l1.confirm,secondaryButtonText:l1.cancel,proceedButtonVariant:"destructive",secondaryButtonVariant:"secondary",isLoading:c.fetchState==="In-Progress",showLine:!1,action:{onOkClick:()=>{x()},onCancelClick:()=>{D(!1)}}}):null,uSs(e)?t.jsxRuntimeExports.jsx(iSs,{children:t.jsxRuntimeExports.jsx(Ge,{suffixIcon:t.jsxRuntimeExports.jsx(Fo,{style:{marginTop:"2px"},width:o.sp3,height:o.sp3}),label:ji.reconciliation.status.review,size:"medium",variant:"primary",onClick:()=>{R?.(e.accountReconEntity.account.accountId)}})}):null]})}const gSs=({monthYearPeriod:e,accountReconciliation:n,filesEndPoint:i,authParams:r,openFilePicker:a,onConnectClick:l,onReconnectClick:c,setDeleteFileId:d,setShowConfirmationPopup:u,onEditFileName:m,onSelectSourceType:x,onStatementUploadSuccess:h,onUploadWindowOpenedOnce:f,onFileUploadStarted:y,uploadErrorMessage:C,setUploadErrorMessage:b})=>{const[E,$]=g.useState(!1),R=n.accountReconEntity.account.accountType==="bank",S=n.accountConnectionStatus==="connected"||n.accountConnectionStatus==="reconnect"||n.connectionInProgress===!0,k=$Me(n,E),T=R===!0&&S===!1&&k===!1,A=R===!0&&(T===!0||k===!0),I=k===!1;g.useEffect(()=>{n.accountReconEntity.statementStatus.code==="uploaded"&&(n.accountReconEntity.statementDataStatus?.code==="validation_failed"||n.accountReconEntity.statementDataStatus?.code==="parsing_failed"||n.accountReconEntity.statementDataStatus?.code==="processing_failed")&&b(ZU(n.accountReconEntity.statementDataStatus?.code,"drawer",n.accountReconEntity.errorMessage?.errorShort))},[n.accountReconEntity.statementStatus.code,n.accountReconEntity.statementDataStatus?.code,n.accountReconEntity.errorMessage?.errorShort,b]);const B=["reconciled","in_progress","reconciled_via_qbo"],L=n.accountReconEntity.reconciliationStatus!=null&&B.includes(n.accountReconEntity.reconciliationStatus.code),P=O.numberFormatter(0),D=n.accountReconEntity,M=D.matchProgress?.matched,F=t.jsxRuntimeExports.jsx(mu,{name:RMe(Tq,"file"),file:n.accountReconEntity.statementMetaData?.file,showPhotoPicker:!1,isDisabled:L,sizeLimit:1e7,onFileSizeError:V=>{V&&b(l1.fileElementPicker.sizeLimit)},deleteFileStatusById:{},updateFileStatusById:{},filesEndPoint:i,authParams:r,acceptableTypes:["application/pdf","image/jpg","image/jpeg","image/png"],placeholderText:ji.reconciliation.drawer.downloadPlaceholder,autoOpenFilePicker:a,accountStatementUpload:{uploadHelper:Q.uploadAccountStatementIntoDocumentAI,metadataPayload:{accountId:n.accountReconEntity.account.accountId,accountType:n.accountReconEntity.account.accountType??"bank",monthYearPeriod:e},errorMessage:C,onUploadError:V=>{b(V?.message)},onUploadSuccess:V=>{h(V),$(!1)},onUploadStart:()=>{$(!0),b(void 0),y?.()},onUploadWindowOpenedOnce:()=>{f()}},onDeleteFile:V=>{d(V),u(!0)},onEditFileName:(V,N)=>{m(V,N)}});return t.jsxRuntimeExports.jsxs(Qvs,{children:[t.jsxRuntimeExports.jsxs(Uvs,{children:[t.jsxRuntimeExports.jsxs(SF,{children:[t.jsxRuntimeExports.jsx(AF,{children:ji.reconciliation.statsCards.autoMatched}),RV(M)?t.jsxRuntimeExports.jsx(Gvs,{children:P.format(M)}):t.jsxRuntimeExports.jsx($V,{children:l1.strings.hyphen})]}),t.jsxRuntimeExports.jsxs(SF,{children:[t.jsxRuntimeExports.jsx(AF,{children:ji.reconciliation.statsCards.needsReview}),RV(D.needsReview)?t.jsxRuntimeExports.jsx(Yvs,{children:P.format(D.needsReview)}):t.jsxRuntimeExports.jsx($V,{children:l1.strings.hyphen})]}),t.jsxRuntimeExports.jsxs(SF,{children:[t.jsxRuntimeExports.jsx(AF,{children:ji.reconciliation.headers.variance}),t.jsxRuntimeExports.jsx(mSs,{variance:D.variance,variancePercentage:D.variancePercentage})]})]}),A===!0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Jvs,{children:ji.reconciliation.drawer.source}),T===!0?t.jsxRuntimeExports.jsxs(Xvs,{children:[t.jsxRuntimeExports.jsxs(k4e,{children:[t.jsxRuntimeExports.jsx(T4e,{}),t.jsxRuntimeExports.jsxs(w4e,{children:[t.jsxRuntimeExports.jsx(E4e,{children:"Connect bank account"}),t.jsxRuntimeExports.jsx($4e,{children:"Sign in securely via Plaid"})]})]}),t.jsxRuntimeExports.jsx(Ge,{size:"medium",variant:"primary",label:ji.reconciliation.drawer.values.connect,onClick:()=>{x(Q.toReconciliationAccountSource("plaid")),l()}})]}):t.jsxRuntimeExports.jsxs(eSs,{children:[t.jsxRuntimeExports.jsxs(k4e,{children:[t.jsxRuntimeExports.jsx(T4e,{}),t.jsxRuntimeExports.jsxs(w4e,{children:[t.jsxRuntimeExports.jsx(E4e,{children:ji.reconciliation.menu.bankConnection}),t.jsxRuntimeExports.jsx($4e,{children:"Sign in securely via Plaid"})]})]}),t.jsxRuntimeExports.jsx(fSs,{status:n.accountConnectionStatus,connectionInProgress:n.connectionInProgress,onConnectClick:l,onReconnectClick:c})]}),k===!0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(R4e,{children:ji.reconciliation.menu.statement}),t.jsxRuntimeExports.jsxs(v4e,{children:[I===!0?t.jsxRuntimeExports.jsxs(S4e,{children:[t.jsxRuntimeExports.jsx(L4e,{}),t.jsxRuntimeExports.jsx(A4e,{children:"Upload a PDF or CSV bank statement to reconcile transactions manually."})]}):null,F]})]}):null]}):null,T===!0?t.jsxRuntimeExports.jsxs(tSs,{children:[t.jsxRuntimeExports.jsx(I4e,{}),t.jsxRuntimeExports.jsx(oSs,{children:"OR"}),t.jsxRuntimeExports.jsx(I4e,{})]}):null,T===!0||A===!1?t.jsxRuntimeExports.jsxs(nSs,{children:[t.jsxRuntimeExports.jsx(R4e,{children:ji.reconciliation.menu.statement}),t.jsxRuntimeExports.jsxs(v4e,{children:[I===!0?t.jsxRuntimeExports.jsxs(S4e,{children:[t.jsxRuntimeExports.jsx(L4e,{}),t.jsxRuntimeExports.jsx(A4e,{children:"Upload a PDF or CSV bank statement to reconcile transactions manually."})]}):null,F]})]}):null]})},fSs=({status:e,connectionInProgress:n,onConnectClick:i,onReconnectClick:r})=>n?t.jsxRuntimeExports.jsx(kF,{children:ji.reconciliation.drawer.values.connecting}):e==="connected"?t.jsxRuntimeExports.jsxs(kF,{children:[t.jsxRuntimeExports.jsx(sSs,{}),t.jsxRuntimeExports.jsx(lSs,{children:ji.reconciliation.drawer.values.connected})]}):t.jsxRuntimeExports.jsx(kF,{onClick:e==="reconnect"?r:i,children:t.jsxRuntimeExports.jsx(cSs,{status:e,children:e==="reconnect"?ji.reconciliation.drawer.values.reconnect:ji.reconciliation.drawer.values.connect})}),B4e=e=>({[Tq]:{file:e.accountReconEntity.statementMetaData?.file,selectedType:e.localData?.accountSource}}),vMe={width:new w(343,580,756),largeLabelWidth:new w(150,210,252),paddingTopBottom:new w(p[3],p[3]),labelHeight:new w(p[6],p[6]),labelMarginLeft:new w(p[3],p[4]),labelMarginRight:new w(p[3],p[4]),labelMarginTop:new w(p[2],p[2]),controlHeight:new w(p[6],p[6]),paddingBottom:new w(p[3],p[2])},ySs=({sectionId:e,internationalOnboardingDetails:n,filesEndPoint:i,authParams:r,isReadonly:a,deleteFileStatusById:l,updateFileStatusById:c,onEditFileName:d,onDeleteFile:u,updateFilesEntity:m})=>{const x=X(),{verificationFormLocalData:h}=n,{dateFormat:{visual:f},common:{documents:y},commonSetUp:{businessVerification:C},spendManagement:{billPay:{vendorCreation:{wireDetails:{international:b}}}}}=O.getLocalizedStrings(),E=vMe.largeLabelWidth.value(x),[$,R]=g.useState(!1),S=n.verificationFormFields.slice().sort((k,T)=>k.type==="file"&&T.type!=="file"?-1:0);return t.jsxRuntimeExports.jsx(jSs,{children:t.jsxRuntimeExports.jsx(CSs,{windowSize:x,children:S.map(k=>{switch(k.type){case"file":return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(gC,{name:pg(e,k.name),isDisabled:a,sizeLimit:fu,deleteFileStatusById:l,updateFileStatusById:c,filesEndPoint:i,authParams:r,label:{label:k.label,width:E},style:{width:"auto"},filemetadataPayload:{documentType:"certificate_of_good_standing",purposeId:"international_wire_business_verification",documentSide:"front"},file:n.userFiles.find(T=>T.fileId===h[k.name]),acceptableTypes:["image/jpg","image/jpeg","image/png","application/pdf","image/heic","image/heif"],registerOptions:{required:!0},hasError:$,updateFilesEntity:m,onEditFileName:d,onDeleteFile:u,onFileSizeError:T=>R(T),placeholderText:C.dragDropClickPlaceholder,showPhotoPicker:!0,useMobileCam:!0,showWebCamPopUpCloseIcon:!0,additionalInfoLabel:y.formatDocumentMax10MB},pg(e,k.name))});case"date":return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Pr,{isDisabled:a,label:{label:k.label+b.colon,width:E},style:{width:"auto"},dateField:{name:pg(e,k.name),placeholder:k.placeholder,defaultValue:h[k.name]?Q.zeniDate(h[k.name]):void 0,dateFormat:f.defaultInput,maxDate:Q.dateNow().subtract(1,"day"),minDate:Q.zeniDate("01 Jan 1900"),autoComplete:"off",registerOptions:{required:!0}}},pg(e,k.name))});case"enum":return k.isMultipleValuesAllowed===!1?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Bs,{isDisabled:a,label:{label:k.label+b.colon,width:E},style:{width:"auto"},singleSelectPickerField:{name:pg(e,k.name),placeholder:k.placeholder,optionHeight:p[6],optionTextStyle:z.standardRegular,maxMenuHeight:206,registerOptions:{required:!0,validate:T=>T!=null&&!!T.selectedOption},defaultValue:{selectedOption:h[k.name],allOptions:k.fieldValues.map(T=>({label:T.description,value:T.code}))}}},pg(e,k.name))}):t.jsxRuntimeExports.jsx(FG,{isDisabled:a,label:{label:k.label+b.colon,width:E},style:{width:"auto"},multiSelectField:{name:pg(e,k.name),placeholder:k.placeholder,registerOptions:{required:!0,validate:T=>T!=null&&!!T.selectedOptions&&T.selectedOptions.length>0},defaultValue:U9(h[k.name],k.fieldValues.map(T=>T.code))}},pg(e,k.name));default:return}})})})},pg=(e,n)=>`${e}.formData.${n}`,jSs=s.div`
72143
+ `,{common:l1,expenseAutomation:{accountRecon:ji}}=O.getLocalizedStrings();function RV(e){return typeof e=="number"&&Number.isFinite(e)}function dSs(e){const n=e.accountSubType?.replace(/_/g," ")??"",i=n.length>0?n.charAt(0).toUpperCase()+n.slice(1):"",r=e.qboId!=null&&e.qboId.length>=4?e.qboId.slice(-4):"";return i.length===0&&r.length===0?"":r.length===0?i:`${i} • • • • ${r}`}function $Me(e,n){const{accountReconEntity:i,statementParseInProgress:r}=e;return i.statementStatus?.code==="uploaded"||r===!0||n||i.statementMetaData?.file!=null}function uSs(e){const n=e.accountReconEntity,i=n.reconciliationStatus;if(i?.code==="save_for_later"||i?.code==="pending")return!0;const r=e.accountConnectionStatus==="connected",a=n.statementDataStatus?.code==="validated"||n.statementDataStatus?.code==="processed";return!!(i==null&&(r||a)&&n.balance!=null&&n.clearedBalance!=null)}function pSs(e){return e==null||!RV(e.amount)?!1:(e.currencySymbol??"").length>0}function mSs({variance:e,variancePercentage:n}){if(!pSs(e))return t.jsxRuntimeExports.jsx($V,{children:l1.strings.hyphen});const i=n!=null&&Number.isFinite(n)?n:null;return t.jsxRuntimeExports.jsxs(Kvs,{children:[t.jsxRuntimeExports.jsx(qvs,{children:Fe("0,0",e)}),i!=null?t.jsxRuntimeExports.jsxs(Zvs,{children:["(",i===0?"0":i.toFixed(2),l1.strings.percentage,")"]}):null]})}const RMe=(e,n)=>`${e}.${n}`,xSs="accountReconDrawerDetailsPage",Tq="accountReconDrawerDetailsSection";function hSs({accountReconciliation:e,plaidConnectionDetails:n,monthYearPeriod:i,openFilePicker:r,filesEndPoint:a,authParams:l,excludeAccountFetch:c,onDismissClick:d,onFetchLinkTokenClick:u,onEstablishConnectionClick:m,onExcludeFromReconciliation:x,onSelectSourceType:h,onDeleteFile:f,onEditFileName:y,onStatementUploadSuccess:C,onUploadWindowOpenedOnce:b,onFileUploadStarted:E,onRetryParsing:$,onReviewClicked:R,onDismissStatementProcessingFailed:S,onReuploadStatement:k,onStatementConfirmSave:T,onStatementFormDataChange:A,statementProcessingFailed:I,isReconV3Enabled:B}){const L=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:B4e(e),resetOptions:{keepDirtyValues:!0,keepErrors:!0},values:B4e(e)}),[P,D]=g.useState(!1),[M,F]=g.useState({completedSteps:0,isActive:!1,showParseInfo:!1,uploadComplete:!1}),[V,N]=g.useState(void 0);g.useEffect(()=>{M.showParseInfo!==!0&&N(void 0)},[M.showParseInfo]);const H=L.handleSubmit(()=>{}),[W,U]=g.useState(void 0),Y=n.link_account_no_microdeposit,q=n.update_account,Z=W==="update_account"?q:Y,[G,K]=g.useState(Z.linkToken??null),[J,oe]=g.useState(!1),[ee,te]=g.useState(!1),[se,ie]=g.useState(void 0),[re,ne]=g.useState(void 0),[me,pe]=g.useState(!1),je=g.useCallback(()=>{U("link_account_no_microdeposit")},[]),ce=g.useCallback(()=>{U("update_account"),u("update_account",e.paymentAccountId)},[e.paymentAccountId]),de={onOkClick:()=>{se!=null&&(f(se),ie(void 0)),ne(void 0),te(!1)},onCancelClick:()=>{ie(void 0),te(!1)}},ue=g.useRef(W);g.useEffect(()=>{ue.current=W},[W]);const le=M.isActive&&!M.showParseInfo&&e.parsedStatementData!=null,ae=e.accountReconEntity.statementDataStatus?.code,ge=g.useCallback(()=>{pe(!1),S?.()},[S]),ye=g.useCallback(()=>{ge(),k?.()},[ge,k]);g.useEffect(()=>{I===!0&&ae?.includes("failed")===!0&&(F({isActive:!1,uploadComplete:!1,showParseInfo:!1,completedSteps:0}),pe(!0))},[I,ae]);const he=g.useCallback(()=>{F(Qe=>({...Qe,showParseInfo:!0}))},[]);g.useEffect(()=>{B===!0&&!M.isActive&&e.statementUploadStatus?.fetchState==="In-Progress"&&(F({isActive:!0,uploadComplete:!1,showParseInfo:!1,completedSteps:0}),S?.())},[B,M.isActive,e.statementUploadStatus?.fetchState,S]),g.useEffect(()=>{M.isActive&&!M.uploadComplete&&e.accountReconEntity.statementMetaData?.file!=null&&F(Qe=>({...Qe,uploadComplete:!0}))},[M.isActive,M.uploadComplete,e.accountReconEntity.statementMetaData?.file]),g.useEffect(()=>{B===!0&&e.reparseStatementStatus?.fetchState==="In-Progress"&&(F({isActive:!0,uploadComplete:!0,showParseInfo:!1,completedSteps:0}),S?.())},[B,e.reparseStatementStatus?.fetchState,S]);const Ce=()=>{F({isActive:!1,uploadComplete:!1,showParseInfo:!1,completedSteps:0})},we=()=>{F({isActive:!1,uploadComplete:!1,showParseInfo:!1,completedSteps:0})},ve=()=>{F({isActive:!1,uploadComplete:!1,showParseInfo:!1,completedSteps:0})},Ee=()=>{const Qe=e.accountReconEntity.statementMetaData?.statementUploadId??"";Qe!==""&&$!=null&&$(e.accountReconEntity.account.accountId,i,Qe)},Se=()=>{T?.()},$e=g.useCallback(Qe=>{m(Qe,e.accountReconEntity.account.accountId,ue.current),U(void 0),oe(!1)},[m,e.accountReconEntity.account.accountId]),Be=g.useCallback((Qe,Je)=>{Qe!=null&&console.log("Plaid Connection Error",Qe,Je),U(void 0),oe(!1)},[]),{open:Ae,ready:_e}=Pc.usePlaidLink({token:G,onSuccess:$e,onExit:Be});g.useEffect(()=>{(Q.zeniDate(new Date().toISOString()).isAfter(Z.expiration)||Z.linkToken==null)&&Z.fetchStatus.fetchState==="Not-Started"&&u("link_account_no_microdeposit")},[Z.fetchStatus.fetchState]),g.useEffect(()=>{!J&&W!=null&&Z.linkToken===G&&Z.fetchStatus.fetchState==="Completed"&&_e&&oe(!0)},[_e,G,Z.fetchStatus.fetchState,Z.linkToken,W,J]),g.useEffect(()=>{Z.fetchStatus.fetchState==="Completed"&&Z.linkToken!=null&&Z.linkToken!==G&&K(Z.linkToken)},[Z.fetchStatus.fetchState,Z.linkToken,G]),g.useEffect(()=>{J&&Ae()},[J,Ae]),g.useEffect(()=>{c.fetchState==="Completed"&&D(!1)},[c.fetchState]);const Te=e.accountReconEntity.account,Re=e.accountReconEntity.statementMetaData?.file,ke=e.accountConnectionStatus==="connected"||e.accountConnectionStatus==="reconnect"||e.connectionInProgress===!0,Oe=dSs(Te),Me=ke||$Me(e,!1),[Ie,Ne]=g.useState(Re);g.useEffect(()=>{M.showParseInfo!==!0&&Ne(Re)},[M.showParseInfo,Re]);const Pe=M.showParseInfo===!0?Ie:Re;if(M.showParseInfo||M.isActive){const Qe=M.showParseInfo?ve:Ce;return t.jsxRuntimeExports.jsx(GRs,{accountName:Te.accountName??"",file:Pe,navSource:M.showParseInfo?"StatementParseInfo":"StatementProcessingPage",highlightedCitations:M.showParseInfo?V:void 0,onBack:Qe,children:M.showParseInfo?t.jsxRuntimeExports.jsx(bMe,{parsedData:e.parsedStatementData,statementUpdateFetchState:e.statementUpdateStatus.fetchState,onClose:ve,onRetry:Ee,onConfirmSave:Se,onFormDataChange:Je=>A?.(Je),onHighlightedCitationsChange:N}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(EMe,{isUploadComplete:M.uploadComplete,_storyCompletedSteps:M.completedSteps,isParsedDataReady:le,onCancel:Ce,onContinueInBackground:we,onAllStepsComplete:he})})})}return t.jsxRuntimeExports.jsxs(Bvs,{children:[t.jsxRuntimeExports.jsx(Mvs,{children:t.jsxRuntimeExports.jsxs(Dvs,{children:[t.jsxRuntimeExports.jsxs(_vs,{children:[t.jsxRuntimeExports.jsx(Hvs,{children:Te.accountName}),Me===!0&&Oe.length>0?t.jsxRuntimeExports.jsx(Wvs,{children:Oe}):null]}),e.accountConnectionStatus==="connected"?t.jsxRuntimeExports.jsx(Z5,{tagTitle:ji.reconciliation.drawer.values.connected,textColor:{color:t.Color(v.tagSuccessColorLight),backgroundColor:t.Color(v.tagSuccessBgLight),borderColor:t.Color(v.tagSuccessBgLight)},style:{padding:o.sp0}}):null,t.jsxRuntimeExports.jsxs(Ovs,{children:[t.jsxRuntimeExports.jsx(Gx,{moreIconType:"plain",menuPosition:"fixed",menuPortalTarget:typeof document<"u"?document.body:null,options:[{label:ji.reconciliation.drawer.excludeFromReconciliation,value:"exclude"}],onOptionSelection:Qe=>{Qe==="exclude"&&D(!0)},valueToIcon:Qe=>Qe==="exclude"?t.jsxRuntimeExports.jsx(zvs,{}):null,customStyleConfig:{menu:Qe=>({...Qe,zIndex:2e3,minWidth:220,width:"max-content"}),menuPortal:Qe=>({...Qe,zIndex:2e3})}}),t.jsxRuntimeExports.jsx(Fvs,{type:"button","aria-label":"Close",onClick:d,children:t.jsxRuntimeExports.jsx(Nvs,{})})]})]})}),t.jsxRuntimeExports.jsxs(Pvs,{children:[t.jsxRuntimeExports.jsxs(t.FormProvider,{...L,children:[t.jsxRuntimeExports.jsx("form",{style:{width:"100%"},id:xSs,onSubmit:H,children:t.jsxRuntimeExports.jsx(gSs,{monthYearPeriod:i,accountReconciliation:e,filesEndPoint:a,openFilePicker:r,authParams:l,onConnectClick:je,onReconnectClick:ce,onSelectSourceType:h,onEditFileName:y,onStatementUploadSuccess:C,onUploadWindowOpenedOnce:b,onFileUploadStarted:()=>{E?.(),B===!0&&F({isActive:!0,uploadComplete:!1,showParseInfo:!1,completedSteps:0})},setShowConfirmationPopup:te,setDeleteFileId:ie,uploadErrorMessage:re,setUploadErrorMessage:ne})}),me?t.jsxRuntimeExports.jsx(po,{shouldClickAway:!1,containerStyle:{width:416,maxWidth:416},titleComponent:t.jsxRuntimeExports.jsx(So,{children:ji.reconciliation.drawer.fileValidationFailed.heading}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:ji.reconciliation.drawer.fileValidationFailed.description}),secondaryButtonText:ji.reconciliation.drawer.fileValidationFailed.cancel,primaryButtonText:ji.reconciliation.drawer.fileValidationFailed.reupload,primaryButtonWidth:178,secondaryButtonWidth:178,action:{onCancelClick:ge,onOkClick:ye},children:t.jsxRuntimeExports.jsx(Vvs,{children:t.jsxRuntimeExports.jsx(mu,{name:RMe(Tq,"file"),file:e.accountReconEntity.statementMetaData?.file,showPhotoPicker:!1,isDisabled:!0,sizeLimit:1e7,deleteFileStatusById:{},updateFileStatusById:{},filesEndPoint:a,authParams:l,acceptableTypes:["application/pdf","image/jpg","image/jpeg","image/png"]})})}):null]}),ee===!0||e.statementDeleteStatus.fetchState==="In-Progress"?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(So,{children:ji.reconciliation.drawer.deleteConfirmation.heading}),descriptionComponent:t.jsxRuntimeExports.jsx(Po,{children:ji.reconciliation.drawer.deleteConfirmation.description}),isLoading:e.statementDeleteStatus.fetchState==="In-Progress",proceedButtonVariant:"destructive",primaryButtonText:l1.confirm,secondaryButtonText:l1.cancel,action:de}):null]}),P?t.jsxRuntimeExports.jsx(po,{titleComponent:t.jsxRuntimeExports.jsx(rSs,{children:ji.reconciliation.drawer.excludeConfirmation.heading(e.accountReconEntity.account.accountName)}),descriptionComponent:t.jsxRuntimeExports.jsx(aSs,{children:ji.reconciliation.drawer.excludeConfirmation.description}),primaryButtonText:l1.confirm,secondaryButtonText:l1.cancel,proceedButtonVariant:"destructive",secondaryButtonVariant:"secondary",isLoading:c.fetchState==="In-Progress",showLine:!1,action:{onOkClick:()=>{x()},onCancelClick:()=>{D(!1)}}}):null,uSs(e)?t.jsxRuntimeExports.jsx(iSs,{children:t.jsxRuntimeExports.jsx(Ge,{suffixIcon:t.jsxRuntimeExports.jsx(Fo,{style:{marginTop:"2px"},width:o.sp3,height:o.sp3}),label:ji.reconciliation.status.review,size:"medium",variant:"primary",onClick:()=>{R?.(e.accountReconEntity.account.accountId)}})}):null]})}const gSs=({monthYearPeriod:e,accountReconciliation:n,filesEndPoint:i,authParams:r,openFilePicker:a,onConnectClick:l,onReconnectClick:c,setDeleteFileId:d,setShowConfirmationPopup:u,onEditFileName:m,onSelectSourceType:x,onStatementUploadSuccess:h,onUploadWindowOpenedOnce:f,onFileUploadStarted:y,uploadErrorMessage:C,setUploadErrorMessage:b})=>{const[E,$]=g.useState(!1),R=n.accountReconEntity.account.accountType==="bank",S=n.accountConnectionStatus==="connected"||n.accountConnectionStatus==="reconnect"||n.connectionInProgress===!0,k=$Me(n,E),T=R===!0&&S===!1&&k===!1,A=R===!0&&(T===!0||k===!0),I=k===!1;g.useEffect(()=>{n.accountReconEntity.statementStatus.code==="uploaded"&&(n.accountReconEntity.statementDataStatus?.code==="validation_failed"||n.accountReconEntity.statementDataStatus?.code==="parsing_failed"||n.accountReconEntity.statementDataStatus?.code==="processing_failed")&&b(ZU(n.accountReconEntity.statementDataStatus?.code,"drawer",n.accountReconEntity.errorMessage?.errorShort))},[n.accountReconEntity.statementStatus.code,n.accountReconEntity.statementDataStatus?.code,n.accountReconEntity.errorMessage?.errorShort,b]);const B=["reconciled","in_progress","reconciled_via_qbo"],L=n.accountReconEntity.reconciliationStatus!=null&&B.includes(n.accountReconEntity.reconciliationStatus.code),P=O.numberFormatter(0),D=n.accountReconEntity,M=D.matchProgress?.matched,F=t.jsxRuntimeExports.jsx(mu,{name:RMe(Tq,"file"),file:n.accountReconEntity.statementMetaData?.file,showPhotoPicker:!1,isDisabled:L,sizeLimit:1e7,onFileSizeError:V=>{V&&b(l1.fileElementPicker.sizeLimit)},deleteFileStatusById:{},updateFileStatusById:{},filesEndPoint:i,authParams:r,acceptableTypes:["application/pdf","image/jpg","image/jpeg","image/png"],placeholderText:ji.reconciliation.drawer.downloadPlaceholder,autoOpenFilePicker:a,accountStatementUpload:{uploadHelper:Q.uploadAccountStatementIntoDocumentAI,metadataPayload:{accountId:n.accountReconEntity.account.accountId,accountType:n.accountReconEntity.account.accountType??"bank",monthYearPeriod:e},errorMessage:C,onUploadError:V=>{b(V?.message)},onUploadSuccess:V=>{h(V),$(!1)},onUploadStart:()=>{$(!0),b(void 0),y?.()},onUploadWindowOpenedOnce:()=>{f()}},onDeleteFile:V=>{d(V),u(!0)},onEditFileName:(V,N)=>{m(V,N)}});return t.jsxRuntimeExports.jsxs(Qvs,{children:[t.jsxRuntimeExports.jsxs(Uvs,{children:[t.jsxRuntimeExports.jsxs(SF,{children:[t.jsxRuntimeExports.jsx(AF,{children:ji.reconciliation.statsCards.autoMatched}),RV(M)?t.jsxRuntimeExports.jsx(Gvs,{children:P.format(M)}):t.jsxRuntimeExports.jsx($V,{children:l1.strings.hyphen})]}),t.jsxRuntimeExports.jsxs(SF,{children:[t.jsxRuntimeExports.jsx(AF,{children:ji.reconciliation.statsCards.needsReview}),RV(D.needsReview)?t.jsxRuntimeExports.jsx(Yvs,{children:P.format(D.needsReview)}):t.jsxRuntimeExports.jsx($V,{children:l1.strings.hyphen})]}),t.jsxRuntimeExports.jsxs(SF,{children:[t.jsxRuntimeExports.jsx(AF,{children:ji.reconciliation.headers.variance}),t.jsxRuntimeExports.jsx(mSs,{variance:D.variance,variancePercentage:D.variancePercentage})]})]}),A===!0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Jvs,{children:ji.reconciliation.drawer.source}),T===!0?t.jsxRuntimeExports.jsxs(Xvs,{children:[t.jsxRuntimeExports.jsxs(k4e,{children:[t.jsxRuntimeExports.jsx(T4e,{}),t.jsxRuntimeExports.jsxs(w4e,{children:[t.jsxRuntimeExports.jsx(E4e,{children:"Connect bank account"}),t.jsxRuntimeExports.jsx($4e,{children:"Sign in securely via Plaid"})]})]}),t.jsxRuntimeExports.jsx(Ge,{size:"medium",variant:"primary",label:ji.reconciliation.drawer.values.connect,onClick:()=>{x(Q.toReconciliationAccountSource("plaid")),l()}})]}):t.jsxRuntimeExports.jsxs(eSs,{children:[t.jsxRuntimeExports.jsxs(k4e,{children:[t.jsxRuntimeExports.jsx(T4e,{}),t.jsxRuntimeExports.jsxs(w4e,{children:[t.jsxRuntimeExports.jsx(E4e,{children:ji.reconciliation.menu.bankConnection}),t.jsxRuntimeExports.jsx($4e,{children:"Sign in securely via Plaid"})]})]}),t.jsxRuntimeExports.jsx(fSs,{status:n.accountConnectionStatus,connectionInProgress:n.connectionInProgress,onConnectClick:l,onReconnectClick:c})]}),k===!0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(R4e,{children:ji.reconciliation.menu.statement}),t.jsxRuntimeExports.jsxs(v4e,{children:[I===!0?t.jsxRuntimeExports.jsxs(S4e,{children:[t.jsxRuntimeExports.jsx(L4e,{}),t.jsxRuntimeExports.jsx(A4e,{children:"Upload a PDF or CSV bank statement to reconcile transactions manually."})]}):null,F]})]}):null]}):null,T===!0?t.jsxRuntimeExports.jsxs(tSs,{children:[t.jsxRuntimeExports.jsx(I4e,{}),t.jsxRuntimeExports.jsx(oSs,{children:"OR"}),t.jsxRuntimeExports.jsx(I4e,{})]}):null,T===!0||A===!1?t.jsxRuntimeExports.jsxs(nSs,{children:[t.jsxRuntimeExports.jsx(R4e,{children:ji.reconciliation.menu.statement}),t.jsxRuntimeExports.jsxs(v4e,{children:[I===!0?t.jsxRuntimeExports.jsxs(S4e,{children:[t.jsxRuntimeExports.jsx(L4e,{}),t.jsxRuntimeExports.jsx(A4e,{children:"Upload a PDF or CSV bank statement to reconcile transactions manually."})]}):null,F]})]}):null]})},fSs=({status:e,connectionInProgress:n,onConnectClick:i,onReconnectClick:r})=>n?t.jsxRuntimeExports.jsx(kF,{children:ji.reconciliation.drawer.values.connecting}):e==="connected"?t.jsxRuntimeExports.jsxs(kF,{children:[t.jsxRuntimeExports.jsx(sSs,{}),t.jsxRuntimeExports.jsx(lSs,{children:ji.reconciliation.drawer.values.connected})]}):t.jsxRuntimeExports.jsx(kF,{onClick:e==="reconnect"?r:i,children:t.jsxRuntimeExports.jsx(cSs,{status:e,children:e==="reconnect"?ji.reconciliation.drawer.values.reconnect:ji.reconciliation.drawer.values.connect})}),B4e=e=>({[Tq]:{file:e.accountReconEntity.statementMetaData?.file,selectedType:e.localData?.accountSource}}),vMe={width:new w(343,580,756),largeLabelWidth:new w(150,210,252),paddingTopBottom:new w(p[3],p[3]),labelHeight:new w(p[6],p[6]),labelMarginLeft:new w(p[3],p[4]),labelMarginRight:new w(p[3],p[4]),labelMarginTop:new w(p[2],p[2]),controlHeight:new w(p[6],p[6]),paddingBottom:new w(p[3],p[2])},ySs=({sectionId:e,internationalOnboardingDetails:n,filesEndPoint:i,authParams:r,isReadonly:a,deleteFileStatusById:l,updateFileStatusById:c,onEditFileName:d,onDeleteFile:u,updateFilesEntity:m})=>{const x=X(),{verificationFormLocalData:h}=n,{dateFormat:{visual:f},common:{documents:y},commonSetUp:{businessVerification:C},spendManagement:{billPay:{vendorCreation:{wireDetails:{international:b}}}}}=O.getLocalizedStrings(),E=vMe.largeLabelWidth.value(x),[$,R]=g.useState(!1),S=n.verificationFormFields.slice().sort((k,T)=>k.type==="file"&&T.type!=="file"?-1:0);return t.jsxRuntimeExports.jsx(jSs,{children:t.jsxRuntimeExports.jsx(CSs,{windowSize:x,children:S.map(k=>{switch(k.type){case"file":return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(gC,{name:pg(e,k.name),isDisabled:a,sizeLimit:fu,deleteFileStatusById:l,updateFileStatusById:c,filesEndPoint:i,authParams:r,label:{label:k.label,width:E},style:{width:"auto"},filemetadataPayload:{documentType:"certificate_of_good_standing",purposeId:"international_wire_business_verification",documentSide:"front"},file:n.userFiles.find(T=>T.fileId===h[k.name]),acceptableTypes:["image/jpg","image/jpeg","image/png","application/pdf","image/heic","image/heif"],registerOptions:{required:!0},hasError:$,updateFilesEntity:m,onEditFileName:d,onDeleteFile:u,onFileSizeError:T=>R(T),placeholderText:C.dragDropClickPlaceholder,showPhotoPicker:!0,useMobileCam:!0,showWebCamPopUpCloseIcon:!0,additionalInfoLabel:y.formatDocumentMax10MB},pg(e,k.name))});case"date":return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Pr,{isDisabled:a,label:{label:k.label+b.colon,width:E},style:{width:"auto"},dateField:{name:pg(e,k.name),placeholder:k.placeholder,defaultValue:h[k.name]?Q.zeniDate(h[k.name]):void 0,dateFormat:f.defaultInput,maxDate:Q.dateNow().subtract(1,"day"),minDate:Q.zeniDate("01 Jan 1900"),autoComplete:"off",registerOptions:{required:!0}}},pg(e,k.name))});case"enum":return k.isMultipleValuesAllowed===!1?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Bs,{isDisabled:a,label:{label:k.label+b.colon,width:E},style:{width:"auto"},singleSelectPickerField:{name:pg(e,k.name),placeholder:k.placeholder,optionHeight:p[6],optionTextStyle:z.standardRegular,maxMenuHeight:206,registerOptions:{required:!0,validate:T=>T!=null&&!!T.selectedOption},defaultValue:{selectedOption:h[k.name],allOptions:k.fieldValues.map(T=>({label:T.description,value:T.code}))}}},pg(e,k.name))}):t.jsxRuntimeExports.jsx(FG,{isDisabled:a,label:{label:k.label+b.colon,width:E},style:{width:"auto"},multiSelectField:{name:pg(e,k.name),placeholder:k.placeholder,registerOptions:{required:!0,validate:T=>T!=null&&!!T.selectedOptions&&T.selectedOptions.length>0},defaultValue:U9(h[k.name],k.fieldValues.map(T=>T.code))}},pg(e,k.name));default:return}})})})},pg=(e,n)=>`${e}.formData.${n}`,jSs=s.div`
72144
72144
  display: flex;
72145
72145
  flex-direction: column;
72146
72146
  `,CSs=s.div`
@@ -74162,7 +74162,7 @@ ${Ks.beneficiaryAddress} ${oe}`,d(je),L(!0)},ie=(pe,je,ce,de)=>{let ue,le;switch
74162
74162
  flex-direction: column;
74163
74163
  width: 100%;
74164
74164
  padding-top: ${o.sp3};
74165
- `,sBs=e=>j.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M5.62069 7.42676H2.09973",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M21.8994 7.42676H10.1617",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M13.8383 16.6963H2.09973",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M21.8994 16.6963H18.3793",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M5.62061 7.2989C5.62061 7.59707 5.67934 7.89233 5.79344 8.16781C5.90755 8.44329 6.0748 8.6936 6.28564 8.90444C6.49649 9.11528 6.74679 9.28253 7.02227 9.39664C7.29775 9.51075 7.59301 9.56948 7.89118 9.56948C8.18936 9.56948 8.48462 9.51075 8.7601 9.39664C9.03558 9.28253 9.28588 9.11528 9.49672 8.90444C9.70757 8.6936 9.87482 8.44329 9.98892 8.16781C10.103 7.89233 10.1618 7.59707 10.1618 7.2989C10.1618 6.6967 9.92254 6.11917 9.49672 5.69336C9.07091 5.26754 8.49338 5.02832 7.89118 5.02832C7.28899 5.02832 6.71146 5.26754 6.28564 5.69336C5.85983 6.11917 5.62061 6.6967 5.62061 7.2989Z",stroke:"currentColor",strokeWidth:1.5}),j.createElement("path",{d:"M13.8383 16.6983C13.8383 17.3005 14.0775 17.878 14.5033 18.3039C14.9291 18.7297 15.5066 18.9689 16.1088 18.9689C16.711 18.9689 17.2886 18.7297 17.7144 18.3039C18.1402 17.878 18.3794 17.3005 18.3794 16.6983C18.3794 16.0961 18.1402 15.5186 17.7144 15.0928C17.2886 14.667 16.711 14.4277 16.1088 14.4277C15.5066 14.4277 14.9291 14.667 14.5033 15.0928C14.0775 15.5186 13.8383 16.0961 13.8383 16.6983Z",stroke:"currentColor",strokeWidth:1.5})),B3={setupDetailsRowGap:new w(12,p[5],p[5]),sectionRowGap:new w(p[5],p[5],p[5]),iconWidthHeight:new w(20,p[3]),subTitlePaddingTop:new w(12,p[3]),subTitlePaddingBottom:new w(p[3],p[3]),overlayWidth:new w(100,100,59)},iBs="treasurySetUpPage",uS="payAccount",G7={VERIFIED:"verified",PENDING_REVIEW:"pending_review"},rv={IN_PROGRESS:"In-Progress",COMPLETED:"Completed",NOT_STARTED:"Not-Started"},sp={PORTFOLIO_ALLOCATION:"portfolio-allocation",TRANSFER:"transfer",ADDITIONAL_VERIFICATION:"additional-verification"},{commonSetUp:rBs,spendManagement:aBs}=O.getLocalizedStrings(),{zeniAccounts:lBs,treasury:Sy}=aBs,{setUp:av}=rBs,cBs=({isDisabled:e,meetingUrl:n,currentTenant:i,businessVerificationDetails:r,connectedAccountProvider:a,accountsPromoConfig:l,isAccountsEnabled:c,showTreasurySetupOverlay:d,transactions:u,treasurySetupView:m,transferDetails:x,isFirstTransfer:h,maxInsuredAmount:f,setShowTreasurySetupOverlay:y,onFetchLinkTokenClick:C,onEnableTreasuryClick:b,onUpdatePrimaryFundingAccount:E,onUpdateTreasuryClick:$,onBusinessVerificationSectionClick:R,onUpdatePaymentAccountStatus:S,onUpdatePaymentAccountLoginStatus:k,onEstablishConnectionClick:T,onEstablishConnectionSuccess:A,onClickMenuIcon:I,onAdditionalVerificationFieldsChanged:B,onSendForVerificationClick:L,onConfirmFundAllocation:P,onSignUpClick:D,onNavigateToDashboard:M,onUpdateFundAllocation:F,onTransferSaveChangesToLocalStore:V,onOverlayClose:N})=>{const W=ro().analytics,U=t.useTheme(),Y=X(),[q,Z]=g.useState(sp.PORTFOLIO_ALLOCATION),[G,K]=g.useState(!1),[J,oe]=g.useState(!1),[ee,te]=g.useState(!1),{fetchState:se,companyTreasuryInfo:ie,isRefreshingViewInBackground:re,updateStatus:ne,plaidConnectionDetails:me,allBankAccounts:pe,selectedCompanyOfficer:je,primaryFundingAccount:ce,allFundingAccounts:de,currentAllocation:ue,fundAllocationLocalData:le,portfolioAllocationUpdateStatus:ae,isAtomicAccountExists:ge}=m,ye=Ye(ae.fetchState),he=i.company?.companyBillPayInfo?.businessVerificationStatus,Ce=he?.code===G7.PENDING_REVIEW||he?.code===G7.VERIFIED,{companyDetailsLocalData:we}=r,ve=x.transferMoneyParties.length>0,Ee=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:g.useMemo(()=>$ye(m),[m]),values:$ye(m)}),Se=Ee.handleSubmit(ct=>{b()}),$e=(ct,yt)=>{if(ct===yt)return;const He=de.find(jt=>jt.id===ct);He!=null&&E(ct,He.accType)},Be=(ct,yt,He)=>{if(ce?.id==null||ct===He)return;const jt=yt.find(St=>St.value===ct);jt!=null&&typeof jt.label=="string"&&W.trackConnectBankLink(jt.value,jt.label,"zeni_treasury"),$(ct,ce.id,ce.accType)},Ae=async(ct,yt)=>{if(!ct.includes(uS))return;const He=yt[uS];if(ct.includes("fundingAccount")){const jt=He.fundingAccount.selectedOption;jt!=null&&$e(jt,ce?.id)}else He.account.selectedOption!=null&&Be(He.account.selectedOption,He.account.allOptions,ce?.zeniAccountId)};g.useEffect(()=>{const ct=Ee.watch((yt,{name:He})=>{He!=null&&yt!=null&&t.defer(()=>Ae(He,yt))});return()=>{ct.unsubscribe()}},[Ee]),g.useEffect(()=>{ye===rv.IN_PROGRESS&&ae.fetchState===rv.COMPLETED&&q===sp.PORTFOLIO_ALLOCATION&&y(!1)},[ye,ae.fetchState]);const _e=ie?.businessVerificationStatus?.code===G7.VERIFIED,Te=ie?.businessVerificationStatus?.code===G7.PENDING_REVIEW,Re=_e||Te,ke=ue!=null?{code:"complete",name:"Complete"}:{code:"require_info",name:"Require info"},Oe=se===rv.IN_PROGRESS||se===rv.NOT_STARTED,Me=U.mode==="light"?new t.Color(U.colors.brandColorJadeLight):new t.Color(U.colors.brandColorJadeDark),Ie=()=>{K(!0),y(!0),Z(sp.PORTFOLIO_ALLOCATION)},Ne=()=>{P(),G||(W.trackTreasuryVerificationNavigation("next",he?.code??""),ve?Z(sp.TRANSFER):Ue())},Pe=()=>{W.trackTreasuryVerificationNavigation("next",he?.code??""),pS(W,"review",x.treasuryTransferMoneyLocalData,le,"Onboarding"),te(!0),oe(!0)},Ue=()=>{pS(W,"skip",x.treasuryTransferMoneyLocalData,le,"Onboarding"),te(!1),Ce?Z(sp.ADDITIONAL_VERIFICATION):R(!0,!1)},Je=()=>{y(!1),N?.()},tt=()=>{W.trackTreasuryVerificationNavigation("back",he?.code??""),Z(sp.PORTFOLIO_ALLOCATION)},Qe=()=>{W.trackTreasuryVerificationNavigation("back",he?.code??""),Z(sp.TRANSFER)},dt=()=>{pS(W,"confirm",x.treasuryTransferMoneyLocalData,le,"Onboarding"),W.trackTreasuryVerificationNavigation("next",he?.code??""),Ce?Z(sp.ADDITIONAL_VERIFICATION):R(!0,!0)};return t.jsxRuntimeExports.jsxs(uBs,{children:[t.jsxRuntimeExports.jsxs(t.Drawer,{anchor:"right",open:d,onClose:Je,PaperProps:{style:{width:B3.overlayWidth.valuePercentage(Y)}},style:{backgroundColor:v.drawerBackground},transitionDuration:250,children:[q===sp.PORTFOLIO_ALLOCATION&&t.jsxRuntimeExports.jsx(TMe,{treasurySetupView:m,onUpdateFundAllocation:F,onBackClick:Je,onNextClick:Ne,isReadOnly:d?!1:ge&&ue!=null,isEditMode:G,skipTransferStep:!ve}),q===sp.TRANSFER&&t.jsxRuntimeExports.jsx(DMe,{isFirstTransfer:h,maxInsuredAmount:f,transferDetails:x,onSaveChangesToLocalStore:V,treasurySetupView:m,showReviewContent:J,setShowReviewContent:oe,plaidConnectionDetails:me,onReviewClick:Pe,onBackClick:tt,onCancelClick:Je,onEstablishConnectionClick:T,onFetchLinkTokenClick:C,onSkipClick:Ue,onTransferClick:dt,isOnSetup:!0}),q===sp.ADDITIONAL_VERIFICATION&&t.jsxRuntimeExports.jsx(Hks,{updateStatus:ne,companyOfficer:je,companyDetails:we,isDetailsSubmitted:Re,isTransferInitiated:ee,transferDetails:x,onClose:Qe,onCloseOverlay:Je,onAdditionalVerificationFieldsChanged:B,onSendForVerificationClick:L,skipTransferStep:!ve})]}),t.jsxRuntimeExports.jsx(Rt,{title:Sy.setup.setupTitle,backgroundColor:U.colors.grey4,style:{zIndex:3},onBackClick:M,showMenuIcon:Y==="medium-compact"||Y==="small",onClickMenuIcon:I,source:"treasury"}),t.jsxRuntimeExports.jsx(dBs,{windowSize:Y,children:Oe?t.jsxRuntimeExports.jsx(i6,{sectionCount:3,wideLayout:!0}):t.jsxRuntimeExports.jsx(t.FormProvider,{...Ee,children:t.jsxRuntimeExports.jsx("form",{id:mBs(iBs),onSubmit:Se,children:t.jsxRuntimeExports.jsxs(pBs,{windowSize:Y,children:[t.jsxRuntimeExports.jsx(nl,{onClick:Ie,title:Sy.setup.title,subTitle:Sy.setup.subTitle,header:Sy.setup.header,status:ke,icon:{element:t.jsxRuntimeExports.jsx(sBs,{width:B3.iconWidthHeight.valuePx(Y),height:B3.iconWidthHeight.valuePx(Y)}),color:Me},isLoading:re,isActiveWhileLoading:!0}),t.jsxRuntimeExports.jsx(nl,{onClick:()=>R(!1,!1),title:av.businessVerificationTitle,subTitle:av.businessVerificationSubTitle,header:av.businessVerificationHeader,icon:{element:t.jsxRuntimeExports.jsx(pr,{width:B3.iconWidthHeight.valuePx(Y),height:B3.iconWidthHeight.valuePx(Y)}),color:Me},status:ie?.businessVerificationStatus,isLoading:re,isActiveWhileLoading:!0,additionalInfo:ie?.businessVerificationStatus?.code===G7.PENDING_REVIEW?u!=null&&u.length>0?Sy.setup.verificationInProgress:av.businessVerificationAdditionalInfo:void 0}),t.jsxRuntimeExports.jsx(S8,{connectedAccountProvider:a,plaidConnectionDetails:me,allBankAccounts:pe,sectionId:uS,isDisabled:e,header:lBs.accountSectionHeader,onFetchLinkTokenClick:C,onEstablishConnectionClick:T,onUpdatePaymentAccountStatus:S,onUpdatePaymentAccountLoginStatus:k,onEstablishConnectionSuccess:A,analytics:W,productType:"zeni_treasury",onSignUpClick:D,primaryFundingAccount:ce,isAccountsEnabled:c,allFundingAccounts:de,pageName:Sy.setup.setupPageName,accountsPromoConfig:l})]})})})}),t.jsxRuntimeExports.jsx(eh,{isFooterRendered:_e,meetingUrl:n,analytics:W,productType:"zeni_treasury"})]})};function $ye(e){const{allBankAccounts:n,allFundingAccounts:i,primaryFundingAccount:r}=e;return{[uS]:{fundingAccount:{selectedOption:r?.id,allOptions:i.map(a=>({label:a.label,value:a.id,isRecommended:a.accType==="depositAccount"}))},account:{selectedOption:r?.zeniAccountId,allOptions:n.map(a=>({label:a.accountName,value:a.accountId}))}}}}const pS=(e,n,i,r,a)=>{const{fromAccount:l,toAccount:c,amount:d}=i,u=c?.accType==="treasuryAccount",m=u?`${l?.label??""} ${l?.maskedAccountNumber??""}`:"Treasury",x=u?"Treasury":`${c?.label??""} ${c?.maskedAccountNumber??""}`,h=f=>Object.values(f.allocation).map(String).join("-");e.trackTreasuryTransferAction(n,m,x,d.amount,h(r),a)},dBs=s.div`
74165
+ `,sBs=e=>j.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},j.createElement("path",{d:"M5.62069 7.42676H2.09973",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M21.8994 7.42676H10.1617",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M13.8383 16.6963H2.09973",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M21.8994 16.6963H18.3793",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"}),j.createElement("path",{d:"M5.62061 7.2989C5.62061 7.59707 5.67934 7.89233 5.79344 8.16781C5.90755 8.44329 6.0748 8.6936 6.28564 8.90444C6.49649 9.11528 6.74679 9.28253 7.02227 9.39664C7.29775 9.51075 7.59301 9.56948 7.89118 9.56948C8.18936 9.56948 8.48462 9.51075 8.7601 9.39664C9.03558 9.28253 9.28588 9.11528 9.49672 8.90444C9.70757 8.6936 9.87482 8.44329 9.98892 8.16781C10.103 7.89233 10.1618 7.59707 10.1618 7.2989C10.1618 6.6967 9.92254 6.11917 9.49672 5.69336C9.07091 5.26754 8.49338 5.02832 7.89118 5.02832C7.28899 5.02832 6.71146 5.26754 6.28564 5.69336C5.85983 6.11917 5.62061 6.6967 5.62061 7.2989Z",stroke:"currentColor",strokeWidth:1.5}),j.createElement("path",{d:"M13.8383 16.6983C13.8383 17.3005 14.0775 17.878 14.5033 18.3039C14.9291 18.7297 15.5066 18.9689 16.1088 18.9689C16.711 18.9689 17.2886 18.7297 17.7144 18.3039C18.1402 17.878 18.3794 17.3005 18.3794 16.6983C18.3794 16.0961 18.1402 15.5186 17.7144 15.0928C17.2886 14.667 16.711 14.4277 16.1088 14.4277C15.5066 14.4277 14.9291 14.667 14.5033 15.0928C14.0775 15.5186 13.8383 16.0961 13.8383 16.6983Z",stroke:"currentColor",strokeWidth:1.5})),B3={setupDetailsRowGap:new w(12,p[5],p[5]),sectionRowGap:new w(p[5],p[5],p[5]),iconWidthHeight:new w(20,p[3]),subTitlePaddingTop:new w(12,p[3]),subTitlePaddingBottom:new w(p[3],p[3]),overlayWidth:new w(100,100,59)},iBs="treasurySetUpPage",uS="payAccount",G7={VERIFIED:"verified",PENDING_REVIEW:"pending_review"},rv={IN_PROGRESS:"In-Progress",COMPLETED:"Completed",NOT_STARTED:"Not-Started"},sp={PORTFOLIO_ALLOCATION:"portfolio-allocation",TRANSFER:"transfer",ADDITIONAL_VERIFICATION:"additional-verification"},{commonSetUp:rBs,spendManagement:aBs}=O.getLocalizedStrings(),{zeniAccounts:lBs,treasury:Sy}=aBs,{setUp:av}=rBs,cBs=({isDisabled:e,meetingUrl:n,currentTenant:i,businessVerificationDetails:r,connectedAccountProvider:a,accountsPromoConfig:l,isAccountsEnabled:c,showTreasurySetupOverlay:d,transactions:u,treasurySetupView:m,transferDetails:x,isFirstTransfer:h,maxInsuredAmount:f,setShowTreasurySetupOverlay:y,onFetchLinkTokenClick:C,onEnableTreasuryClick:b,onUpdatePrimaryFundingAccount:E,onUpdateTreasuryClick:$,onBusinessVerificationSectionClick:R,onUpdatePaymentAccountStatus:S,onUpdatePaymentAccountLoginStatus:k,onEstablishConnectionClick:T,onEstablishConnectionSuccess:A,onClickMenuIcon:I,onAdditionalVerificationFieldsChanged:B,onSendForVerificationClick:L,onConfirmFundAllocation:P,onSignUpClick:D,onNavigateToDashboard:M,onUpdateFundAllocation:F,onTransferSaveChangesToLocalStore:V,onOverlayClose:N})=>{const W=ro().analytics,U=t.useTheme(),Y=X(),[q,Z]=g.useState(sp.PORTFOLIO_ALLOCATION),[G,K]=g.useState(!1),[J,oe]=g.useState(!1),[ee,te]=g.useState(!1),{fetchState:se,companyTreasuryInfo:ie,isRefreshingViewInBackground:re,updateStatus:ne,plaidConnectionDetails:me,allBankAccounts:pe,selectedCompanyOfficer:je,primaryFundingAccount:ce,allFundingAccounts:de,currentAllocation:ue,fundAllocationLocalData:le,portfolioAllocationUpdateStatus:ae,isAtomicAccountExists:ge}=m,ye=Ye(ae.fetchState),he=i.company?.companyBillPayInfo?.businessVerificationStatus,Ce=he?.code===G7.PENDING_REVIEW||he?.code===G7.VERIFIED,{companyDetailsLocalData:we}=r,ve=x.transferMoneyParties.length>0,Ee=t.useForm({mode:"all",reValidateMode:"onChange",defaultValues:g.useMemo(()=>$ye(m),[m]),values:$ye(m)}),Se=Ee.handleSubmit(ct=>{b()}),$e=(ct,yt)=>{if(ct===yt)return;const He=de.find(jt=>jt.id===ct);He!=null&&E(ct,He.accType)},Be=(ct,yt,He)=>{if(ce?.id==null||ct===He)return;const jt=yt.find(St=>St.value===ct);jt!=null&&typeof jt.label=="string"&&W.trackConnectBankLink(jt.value,jt.label,"zeni_treasury"),$(ct,ce.id,ce.accType)},Ae=async(ct,yt)=>{if(!ct.includes(uS))return;const He=yt[uS];if(ct.includes("fundingAccount")){const jt=He.fundingAccount.selectedOption;jt!=null&&$e(jt,ce?.id)}else He.account.selectedOption!=null&&Be(He.account.selectedOption,He.account.allOptions,ce?.zeniAccountId)};g.useEffect(()=>{const ct=Ee.watch((yt,{name:He})=>{He!=null&&yt!=null&&t.defer(()=>Ae(He,yt))});return()=>{ct.unsubscribe()}},[Ee]),g.useEffect(()=>{ye===rv.IN_PROGRESS&&ae.fetchState===rv.COMPLETED&&q===sp.PORTFOLIO_ALLOCATION&&y(!1)},[ye,ae.fetchState]);const _e=ie?.businessVerificationStatus?.code===G7.VERIFIED,Te=ie?.businessVerificationStatus?.code===G7.PENDING_REVIEW,Re=_e||Te,ke=ue!=null?{code:"complete",name:"Complete"}:{code:"require_info",name:"Require info"},Oe=se===rv.IN_PROGRESS||se===rv.NOT_STARTED,Me=U.mode==="light"?new t.Color(U.colors.brandColorJadeLight):new t.Color(U.colors.brandColorJadeDark),Ie=()=>{K(!0),y(!0),Z(sp.PORTFOLIO_ALLOCATION)},Ne=()=>{P(),G||(W.trackTreasuryVerificationNavigation("next",he?.code??""),ve?Z(sp.TRANSFER):Qe())},Pe=()=>{W.trackTreasuryVerificationNavigation("next",he?.code??""),pS(W,"review",x.treasuryTransferMoneyLocalData,le,"Onboarding"),te(!0),oe(!0)},Qe=()=>{pS(W,"skip",x.treasuryTransferMoneyLocalData,le,"Onboarding"),te(!1),Ce?Z(sp.ADDITIONAL_VERIFICATION):R(!0,!1)},Je=()=>{y(!1),N?.()},tt=()=>{W.trackTreasuryVerificationNavigation("back",he?.code??""),Z(sp.PORTFOLIO_ALLOCATION)},Ue=()=>{W.trackTreasuryVerificationNavigation("back",he?.code??""),Z(sp.TRANSFER)},dt=()=>{pS(W,"confirm",x.treasuryTransferMoneyLocalData,le,"Onboarding"),W.trackTreasuryVerificationNavigation("next",he?.code??""),Ce?Z(sp.ADDITIONAL_VERIFICATION):R(!0,!0)};return t.jsxRuntimeExports.jsxs(uBs,{children:[t.jsxRuntimeExports.jsxs(t.Drawer,{anchor:"right",open:d,onClose:Je,PaperProps:{style:{width:B3.overlayWidth.valuePercentage(Y)}},style:{backgroundColor:v.drawerBackground},transitionDuration:250,children:[q===sp.PORTFOLIO_ALLOCATION&&t.jsxRuntimeExports.jsx(TMe,{treasurySetupView:m,onUpdateFundAllocation:F,onBackClick:Je,onNextClick:Ne,isReadOnly:d?!1:ge&&ue!=null,isEditMode:G,skipTransferStep:!ve}),q===sp.TRANSFER&&t.jsxRuntimeExports.jsx(DMe,{isFirstTransfer:h,maxInsuredAmount:f,transferDetails:x,onSaveChangesToLocalStore:V,treasurySetupView:m,showReviewContent:J,setShowReviewContent:oe,plaidConnectionDetails:me,onReviewClick:Pe,onBackClick:tt,onCancelClick:Je,onEstablishConnectionClick:T,onFetchLinkTokenClick:C,onSkipClick:Qe,onTransferClick:dt,isOnSetup:!0}),q===sp.ADDITIONAL_VERIFICATION&&t.jsxRuntimeExports.jsx(Hks,{updateStatus:ne,companyOfficer:je,companyDetails:we,isDetailsSubmitted:Re,isTransferInitiated:ee,transferDetails:x,onClose:Ue,onCloseOverlay:Je,onAdditionalVerificationFieldsChanged:B,onSendForVerificationClick:L,skipTransferStep:!ve})]}),t.jsxRuntimeExports.jsx(Rt,{title:Sy.setup.setupTitle,backgroundColor:U.colors.grey4,style:{zIndex:3},onBackClick:M,showMenuIcon:Y==="medium-compact"||Y==="small",onClickMenuIcon:I,source:"treasury"}),t.jsxRuntimeExports.jsx(dBs,{windowSize:Y,children:Oe?t.jsxRuntimeExports.jsx(i6,{sectionCount:3,wideLayout:!0}):t.jsxRuntimeExports.jsx(t.FormProvider,{...Ee,children:t.jsxRuntimeExports.jsx("form",{id:mBs(iBs),onSubmit:Se,children:t.jsxRuntimeExports.jsxs(pBs,{windowSize:Y,children:[t.jsxRuntimeExports.jsx(nl,{onClick:Ie,title:Sy.setup.title,subTitle:Sy.setup.subTitle,header:Sy.setup.header,status:ke,icon:{element:t.jsxRuntimeExports.jsx(sBs,{width:B3.iconWidthHeight.valuePx(Y),height:B3.iconWidthHeight.valuePx(Y)}),color:Me},isLoading:re,isActiveWhileLoading:!0}),t.jsxRuntimeExports.jsx(nl,{onClick:()=>R(!1,!1),title:av.businessVerificationTitle,subTitle:av.businessVerificationSubTitle,header:av.businessVerificationHeader,icon:{element:t.jsxRuntimeExports.jsx(pr,{width:B3.iconWidthHeight.valuePx(Y),height:B3.iconWidthHeight.valuePx(Y)}),color:Me},status:ie?.businessVerificationStatus,isLoading:re,isActiveWhileLoading:!0,additionalInfo:ie?.businessVerificationStatus?.code===G7.PENDING_REVIEW?u!=null&&u.length>0?Sy.setup.verificationInProgress:av.businessVerificationAdditionalInfo:void 0}),t.jsxRuntimeExports.jsx(S8,{connectedAccountProvider:a,plaidConnectionDetails:me,allBankAccounts:pe,sectionId:uS,isDisabled:e,header:lBs.accountSectionHeader,onFetchLinkTokenClick:C,onEstablishConnectionClick:T,onUpdatePaymentAccountStatus:S,onUpdatePaymentAccountLoginStatus:k,onEstablishConnectionSuccess:A,analytics:W,productType:"zeni_treasury",onSignUpClick:D,primaryFundingAccount:ce,isAccountsEnabled:c,allFundingAccounts:de,pageName:Sy.setup.setupPageName,accountsPromoConfig:l})]})})})}),t.jsxRuntimeExports.jsx(eh,{isFooterRendered:_e,meetingUrl:n,analytics:W,productType:"zeni_treasury"})]})};function $ye(e){const{allBankAccounts:n,allFundingAccounts:i,primaryFundingAccount:r}=e;return{[uS]:{fundingAccount:{selectedOption:r?.id,allOptions:i.map(a=>({label:a.label,value:a.id,isRecommended:a.accType==="depositAccount"}))},account:{selectedOption:r?.zeniAccountId,allOptions:n.map(a=>({label:a.accountName,value:a.accountId}))}}}}const pS=(e,n,i,r,a)=>{const{fromAccount:l,toAccount:c,amount:d}=i,u=c?.accType==="treasuryAccount",m=u?`${l?.label??""} ${l?.maskedAccountNumber??""}`:"Treasury",x=u?"Treasury":`${c?.label??""} ${c?.maskedAccountNumber??""}`,h=f=>Object.values(f.allocation).map(String).join("-");e.trackTreasuryTransferAction(n,m,x,d.amount,h(r),a)},dBs=s.div`
74166
74166
  display: flex;
74167
74167
  justify-content: flex-start;
74168
74168
  height: 100%;