1"use strict";(globalThis.webpackChunkninjapipe=globalThis.webpackChunkninjapipe||[]).push([[39321,61702,78771,87310],{78771(_o,De,r){r.r(De),r.d(De,{default:()=>Y});var i=r(51477),U=r(22145),d=r(9795),$=r(50388),v=r(6227),q=r(82380),H=r(35139),X=r(22725),j=r(8984),ve=r(48362),M=r(42727),Pe=r(95910),R=r(72175),he=r(68779),P=r(14998),de=r(93078),me=r(33643),y=r(78378),Ee=r(31623),Me=r(2440),re=r(14813),T=r(52849),S=r(70481);function Y(ge){var ce,B,le,Ie,We,ye,Ue,ee,be,ae,$e,e,K,Re,Ve,V,Se,_e;let{open:A,title:I="Are you sure?",description:J="",onConfirm:E,onCancel:Q,onDismiss:ne,confirmText:mo="Confirm",cancelText:fe="Cancel",loading:ue=!1,confirmDisabled:fo=!1,isDark:Fe=null,primaryColor:O=null,nestedInModal:se=!1,disableBackdropClick:Ae=!1,children:G,confirmDestructive:io=!1,showDontAskAgain:Ye=!1,dontAskAgainChecked:Ze=!1,onDontAskAgainChange:go,dontAskAgainLabel:So="Don't ask me again",maxWidth:Ao="xs",contentMaxHeight:Z}=ge;const{t:Ce}=(0,de.Bd)(),qe=(0,me.rn)(),Ke=(0,y.e)(),eo=O||qe,oo=Fe!==null?Fe:Ke,ie=(0,i.useMemo)(()=>(0,Ee.jM)(oo?"dark":"light",eo),[oo,eo]),Wo=(0,R.A)(),Po=(0,he.A)(Wo.breakpoints.down("sm")),gt=(0,i.useCallback)(()=>{if(!ue){var Lo;(Lo=ne??Q)===null||Lo===void 0||Lo()}},[ue,ne,Q]),Pt=(0,i.useCallback)(()=>{ue||Q?.()},[ue,Q]),{dialogOnClose:Mt,disableEscapeKeyDown:$t}=(0,Me.s)({onRequestClose:gt,isBusy:ue,allowBackdropClick:!Ae}),Rt=!!J||Ye||!!G,Jo=(0,i.useMemo)(()=>({fontWeight:600,minWidth:{xs:"100%",sm:120}}),[]),Ot=(0,i.useMemo)(()=>({...Jo,textTransform:"none",borderRadius:1,px:2.5,py:1,fontSize:12,boxShadow:"none"}),[Jo]);return(0,S.jsxs)(U.A,{open:A,onClose:Mt,maxWidth:Ao,fullWidth:!0,fullScreen:Po,disableEscapeKeyDown:$t,sx:se?{zIndex:1400}:void 0,PaperProps:{sx:{bgcolor:((ce=ie.background)===null||ce===void 0?void 0:ce.modal)||((B=ie.background)===null||B===void 0?void 0:B.secondary),borderRadius:Po?0:3,color:(le=ie.text)===null||le===void 0?void 0:le.primary,border:Po?"none":`1px solid ${(Ie=ie.border)===null||Ie===void 0?void 0:Ie.primary}`,boxShadow:Po?"none":oo?"0 10px 30px rgba(0,0,0,0.45)":"0 14px 30px rgba(15,23,42,0.25)",overflow:"hidden",maxHeight:Po?"100%":"90vh",display:"flex",flexDirection:"column"}},children:[(0,S.jsx)(d.A,{sx:{flexShrink:0,px:3,pt:2.5,pb:.75,borderBottom:"none"},children:(0,S.jsxs)($.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:1},children:[(0,S.jsx)(v.A,{variant:"h6",component:"div",sx:{flex:1,minWidth:0,fontWeight:600,fontSize:18,color:(We=ie.text)===null||We===void 0?void 0:We.primary,lineHeight:1.35},children:I}),(0,S.jsx)(q.A,{type:"button",onClick:gt,disabled:ue,size:"small","aria-label":Ce("common.close","Close"),sx:{color:(ye=ie.text)===null||ye===void 0?void 0:ye.tertiary,flexShrink:0,mt:-.25,"&:hover":{bgcolor:(Ue=ie.background)===null||Ue===void 0?void 0:Ue.tertiary,color:(ee=ie.text)===null||ee===void 0?void 0:ee.primary}},children:(0,S.jsx)(P.X,{size:20})})]})}),Rt&&(0,S.jsx)(H.A,{sx:{flex:"1 1 auto",display:"flex",flexDirection:"column",minHeight:0,px:0,pt:0,pb:0,overflow:"hidden"},children:(0,S.jsx)($.A,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0,maxHeight:Po?"none":Z||"min(50vh, 320px)"},children:(0,S.jsxs)($.A,{sx:{flex:1,minHeight:0,overflowY:"auto",overscrollBehavior:"contain",p:{xs:2,sm:2.5},display:"flex",flexDirection:"column",gap:2,background:oo?`linear-gradient(185deg, ${(be=ie.background)===null||be===void 0?void 0:be.secondary} 0%, ${(ae=ie.background)===null||ae===void 0?void 0:ae.primary} 100%)`:`linear-gradient(185deg, ${($e=ie.background)===null||$e===void 0?void 0:$e.secondary} 0%, ${(e=ie.background)===null||e===void 0?void 0:e.tertiary} 100%)`},children:[J&&(typeof J=="string"?(0,S.jsx)(v.A,{sx:{color:(K=ie.text)===null||K===void 0?void 0:K.secondary,fontSize:15,lineHeight:1.5},children:J}):(0,S.jsx)($.A,{sx:{color:(Re=ie.text)===null||Re===void 0?void 0:Re.secondary,fontSize:15,lineHeight:1.5},children:J})),Ye&&(0,S.jsx)(X.A,{control:(0,S.jsx)(j.A,{checked:Ze,onChange:Lo=>go?.(Lo.target.checked),sx:{color:(Ve=ie.text)===null||Ve===void 0?void 0:Ve.tertiary,"&.Mui-checked":{color:eo}}}),label:(0,S.jsx)(v.A,{variant:"body2",sx:{color:(V=ie.text)===null||V===void 0?void 0:V.secondary},children:So}),sx:{m:0,alignItems:"flex-start"}}),G]})})}),(0,S.jsxs)(ve.A,{sx:{flexShrink:0,px:3,py:2,mt:0,borderTop:`1px solid ${(Se=ie.border)===null||Se===void 0?void 0:Se.primary}
1`,bgcolor:(_e=ie.background)===null||_e===void 0?void 0:_e.secondary,justifyContent:"flex-end",gap:1.5,flexWrap:"wrap",flexDirection:{xs:"column-reverse",sm:"row"}},children:[(0,S.jsx)(T.A,{type:"button",onClick:Pt,disabled:ue,primaryColor:eo,sx:Jo,children:fe}),io?(0,S.jsx)(M.A,{type:"button",variant:"contained",color:"error",onClick:E,disabled:ue||fo,sx:Ot,children:ue?(0,S.jsx)(Pe.A,{size:20,color:"inherit"}):mo}):(0,S.jsx)(re.A,{type:"button",onClick:E,disabled:ue||fo,primaryColor:eo,sx:Jo,children:ue?(0,S.jsx)(Pe.A,{size:20,color:"inherit"}):mo})]})]})}},45879(_o,De,r){r.d(De,{Ay:()=>ge});var i=r(51477),U=r(34016),d=r(12239),$=r(67339),v=r(80015),q=r(18166),H=r(52405),X=r(75889),j=r(26474),ve=r(72175),M=r(68779),Pe=r(33643),R=r(78378),he=r(31623),P=r(77222),de=r(55881),me=r(44889),y=r(64530),Ee=r(71023),Me=r(32831),re=r(88496),T=r(70481);const S=ce=>{var B;let{columns:le=[],actionsColumn:Ie=!1,loading:We=!1,empty:ye=!1,emptyState:Ue,children:ee,stickyHeader:be=!1,dense:ae=!1,embedded:$e=!1,resizableColumns:e=!1,columnWidthPersistenceKey:K=null,showColumnDividers:Re,headerPrefix:Ve=null,actionsColumnWidth:V=48}=ce;const Se=(0,R.e)(),_e=(0,he.jM)(Se?"dark":"light",(0,Pe.rn)()),A=Re??e,I=(0,i.useMemo)(()=>e?(0,Me.nU)(le,!0):[],[le,e]),J=(0,T.jsx)(Y,{columns:le,actionsColumn:Ie,loading:We,empty:ye,emptyState:Ue,stickyHeader:be,dense:ae,resizableColumns:e,showColumnDividers:A,headerPrefix:Ve,actionsColumnWidth:V,resizableColumnDefs:I,children:ee}),E=(0,i.useMemo)(()=>{var ne;return{bgcolor:(ne=_e.background)===null||ne===void 0?void 0:ne.secondary,borderRadius:{xs:2,sm:3},boxShadow:Se?"0 2px 8px rgba(0, 0, 0, 0.2)":"0 2px 8px rgba(0, 0, 0, 0.05)",border:"none",p:0,height:"100%",width:"100%",overflow:"hidden"}},[(B=_e.background)===null||B===void 0?void 0:B.secondary,Se]),Q=e?(0,T.jsx)(Ee.e,{enabled:!0,columnDefs:I,persistenceKey:K,children:J}):J;
1return $e?Q:(0,T.jsx)(U.A,{sx:E,children:(0,T.jsx)(d.A,{sx:{p:0,overflow:"hidden"},children:Q})})};function Y(ce){let{columns:B,actionsColumn:le,loading:Ie,empty:We,emptyState:ye,children:Ue,stickyHeader:ee,dense:be,resizableColumns:ae,showColumnDividers:$e,headerPrefix:e,actionsColumnWidth:K,resizableColumnDefs:Re}=ce;const Ve=(0,ve.A)(),V=(0,M.A)(Ve.breakpoints.down("sm")),Se=(0,Pe.rn)(),_e=(0,R.e)(),A=(0,he.jM)(_e?"dark":"light",Se),I=(0,Ee.W)(),J=B.length+(le?1:0)+(e?1:0),E=(0,i.useMemo)(()=>{var O,se,Ae,G;return{overflowX:"auto",overflowY:"hidden",width:"100%",maxWidth:"100%","& table":{tableLayout:ae||V?"fixed":"auto",minWidth:"100%",width:"100%"},"&::-webkit-scrollbar":{height:{xs:6,sm:8}},"&::-webkit-scrollbar-track":{bgcolor:(O=A.background)===null||O===void 0?void 0:O.primary},"&::-webkit-scrollbar-thumb":{bgcolor:((se=A.border)===null||se===void 0?void 0:se.primary)||((Ae=A.background)===null||Ae===void 0?void 0:Ae.tertiary),borderRadius:4,"&:hover":{bgcolor:(G=A.text)===null||G===void 0?void 0:G.tertiary}}}},[A,V,ae]),Q=(0,i.useMemo)(()=>be?{py:{xs:.35,sm:.45},px:{xs:.75,sm:1.1}}:{py:{xs:.75,sm:1},px:{xs:1,sm:1.5}},[be]),ne=(0,i.useMemo)(()=>{var O,se,Ae,G,io,Ye,Ze;return $e?(0,re.N$)(A,_e):{bgcolor:((O=A.background)===null||O===void 0?void 0:O.tertiary)||((se=A.background)===null||se===void 0?void 0:se.secondary),"& th":{bgcolor:((Ae=A.background)===null||Ae===void 0?void 0:Ae.tertiary)||((G=A.background)===null||G===void 0?void 0:G.secondary),borderColor:((io=A.border)===null||io===void 0?void 0:io.primary)||((Ye=A.background)===null||Ye===void 0?void 0:Ye.secondary),color:(Ze=A.text)===null||Ze===void 0?void 0:Ze.tertiary,fontWeight:600,fontSize:be?{xs:10,sm:12}:{xs:11,sm:13},...Q}}},[A,be,Q,_e,$e]),mo=(0,i.useMemo)(()=>{const O=be?{"& .MuiTableCell-root":Q}:null;return $e?{...O||{},...(0,re.Ok)(A,_e)}:O},[A,be,Q,_e,$e]),fe=(0,i.useMemo)(()=>B.map(O=>O.id),[B]),ue=()=>{if(Ie)return(0,T.jsx)(P.A,{columns:fe,rows:10,showActionsColumn:le});if(We&&ye){var O,se,Ae;return(0,T.jsx)($.A,{children:(0,T.jsx)(v.A,{colSpan:J,sx:{p:0,border:"none"},children:(0,T.jsx)(de.Ay,{illustration:ye.illustration,title:ye.title,subtitle:ye.subtitle,illustrationSize:(O=ye.illustrationSize)!==null&&O!==void 0?O:200,actionButtonLabel:(se=ye.action)===null||se===void 0?void 0:se.label,onActionPress:(Ae=ye.action)===null||Ae===void 0?void 0:Ae.onClick})})})}return Ue},fo=()=>B.map(O=>{const se=Re.find(G=>G.id===O.id),Ae=O.label;if(ae&&se?.resizable!==!1&&I.enabled)return(0,T.jsx)(me.A,{columnId:O.id,align:O.align,width:I.getColumnWidth(O.id),minWidth:se.minWidth,maxWidth:se.maxWidth,resizable:!0,onResize:G=>I.setColumnWidthLive(O.id,G),onResizeEnd:G=>{I.commitColumnWidth(O.id,G),I.schedulePersistColumnWidths()},resizeHandleColor:I.columnResizeHandleColor,columnDividerColor:I.columnDividerColor,sx:{...Q,whiteSpace:"nowrap"},children:Ae},O.id);if(ae&&se){const G=I.enabled?I.getColumnWidth(O.id):se.defaultWidth;return(0,T.jsx)(v.A,{"data-np-col":O.id,align:O.align,sx:{...Q,width:G,minWidth:G,maxWidth:G,whiteSpace:"nowrap",...$e?(0,re.K7)(A,_e):{}},children:Ae},O.id)}return(0,T.jsx)(v.A,{align:O.align,sx:{...Q,minWidth:O.minWidth,width:O.flex?void 0:O.width,whiteSpace:"nowrap"},children:Ae},O.id)}),Fe=ae?y.A:q.A;return(0,T.jsx)(H.A,{sx:E,children:(0,T.jsxs)(Fe,{size:be?"small":"medium",sx:{minWidth:"100%",width:"100%",tableLayout:ae||V?"fixed":"auto"},stickyHeader:ee,children:[(0,T.jsx)(X.A,{children:(0,T.jsxs)($.A,{sx:ne,children:[e,fo(),le&&(0,T.jsx)(v.A,{align:"right",sx:{...Q,width:ae?K:V?50:80,minWidth:ae?K:V?50:80,maxWidth:ae?K:void 0,...$e?{borderRight:"none"}:{}}})]})}),(0,T.jsx)(j.A,{sx:mo,children:ue()})]})})}const ge=S},49265(_o,De,r){r.d(De,{A:()=>T});var i=r(51477),U=r(50388),d=r(6227),$=r(22145),v=r(9795),q=r(82380),H=r(35139),X=r(95910),j=r(48362),ve=r(93078),M=r(14998),Pe=r(78378),R=r(33643),he=r(31623),P=r(2440),de=r(14813),me=r(52849),y=r(70481);const Ee=new Set(["image","pdf","video","audio"]);function Me(S,Y){const ce=(S||(Y||"").split("/").pop().split("?")[0]||"").split(".").pop().toLowerCase();return{jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",bmp:"image",ico:"image",mp4:"video",webm:"video",ogg:"video",avi:"video",mov:"video",wmv:"video",flv:"video",mkv:"video",mp3:"audio",wav:"audio",aac:"audio",flac:"audio",m4a:"audio",wma:"audio",pdf:"pdf",doc:"document",docx:"document",txt:"document",rtf:"document",xls:"spreadsheet",xlsx:"spreadsheet",csv:"spreadsheet",ppt:"presentation",pptx:"presentation",js:"code",jsx:"code",ts:"code",tsx:"code",html:"code",css:"code",scss:"code",sass:"code",json:"code",xml:"code",yaml:"code",yml:"code",md:"code",zip:"archive",rar:"archive","7z":"archive",tar:"archive",gz:"archive"}[ce]||"unknown"}const T=S=>{var Y,ge,ce,B,le,Ie,We,ye,Ue,ee,be,ae,$e,e;let{url:K,title:Re="",description:Ve="",fileName:V="",isOpen:Se=!1,onClose:_e}=S;const{t:A}=(0,ve.Bd)(),I=(0,R.rn)(),J=(0,Pe.e)(),E=(0,he.jM)(J?"dark":"light",I),Q=(0,i.useMemo)(()=>({width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",minHeight:0,objectFit:"contain",borderRadius:1}),[]),[ne,mo]=(0,i.useState)("unknown"),[fe,ue]=(0,i.useState)(!0),[fo,Fe]=(0,i.useState)(null),O=(0,i.useMemo)(()=>`${Se?"open":"closed"}:${K||""}:${V||""}`,[Se,K,V]),se=(0,i.useMemo)(()=>{const Z=String(Re||"").trim();if(Z)return Z;const Ce=String(V||"").trim();return Ce||A("filePreview.title","File preview")},[Re,V,A]),Ae=(0,i.useMemo)(()=>{const Z=String(Ve||"").trim();if(Z)return Z;const Ce=String(V||"").trim();return Ce&&Ce!==se?Ce:""},[Ve,V,se]);(0,i.useEffect)(()=>
1{if(!Se||!K){ue(!1),Fe(null);return}const Z=Me(V,K);mo(Z),Fe(null),ue(Ee.has(Z))},[O,Se,K,V]);const G=(0,i.useCallback)(()=>{_e?.()},[_e]),{dialogOnClose:io}=(0,P.s)({onRequestClose:G,isBusy:!1});(0,i.useEffect)(()=>{if(!Se)return;const Z=Ce=>{Ce.key!=="Escape"&&Ce.key!=="Esc"||(Ce.preventDefault(),Ce.stopPropagation(),G())};return window.addEventListener("keydown",Z,!0),()=>window.removeEventListener("keydown",Z,!0)},[Se,G]);const Ye=(0,i.useCallback)(()=>{ue(!1)},[]),Ze=(0,i.useCallback)(Z=>{Fe(Z),ue(!1)},[]),go=async()=>{try{const Ce=await(await fetch(K)).blob(),qe=window.URL.createObjectURL(Ce),Ke=document.createElement("a");Ke.href=qe,Ke.download=V||K.split("/").pop().split("?")[0],document.body.appendChild(Ke),Ke.click(),document.body.removeChild(Ke),window.URL.revokeObjectURL(qe)}catch(Z){console.error("Error downloading file:",Z),Fe(A("filePreview.downloadFailed","Failed to download file"))}},So=Z=>{var Ce,qe,Ke,eo,oo,ie,Wo;switch(Z){case"image":return(0,y.jsx)(M._V3,{size:48,color:(Ce=E.text)===null||Ce===void 0?void 0:Ce.tertiary});case"video":return(0,y.jsx)(M.ylc,{size:48,color:(qe=E.text)===null||qe===void 0?void 0:qe.tertiary});case"audio":return(0,y.jsx)(M.bY4,{size:48,color:(Ke=E.text)===null||Ke===void 0?void 0:Ke.tertiary});case"pdf":return(0,y.jsx)(M.F7W,{size:48,color:(eo=E.text)===null||eo===void 0?void 0:eo.tertiary});case"spreadsheet":return(0,y.jsx)(M.nmj,{size:48,color:(oo=E.text)===null||oo===void 0?void 0:oo.tertiary});case"code":return(0,y.jsx)(M.GDI,{size:48,color:(ie=E.text)===null||ie===void 0?void 0:ie.tertiary});default:return(0,y.jsx)(M.iUU,{size:48,color:(Wo=E.text)===null||Wo===void 0?void 0:Wo.tertiary})}},Ao=()=>{var Z,Ce,qe,Ke;if(fo){var eo,oo,ie;return(0,y.jsxs)(U.A,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:{xs:280,sm:360},width:"100%",color:(eo=E.status)===null||eo===void 0?void 0:eo.error},children:[(0,y.jsx)(M.iUU,{size:64}),(0,y.jsx)(d.A,{sx:{mt:2,fontSize:16,color:(oo=E.text)===null||oo===void 0?void 0:oo.primary},children:A("filePreview.loadError","Error loading file")}),(0,y.jsx)(d.A,{sx:{mt:1,fontSize:14,color:(ie=E.text)===null||ie===void 0?void 0:ie.tertiary},children:fo})]})}switch(ne){case"image":return(0,y.jsx)(U.A,{component:"img",src:K,alt:V||"Preview",sx:{...Q,opacity:fe?0:1,transition:"opacity 0.2s ease"},onLoad:Ye,onError:()=>Ze(A("filePreview.imageLoadFailed","Failed to load image"))});case"pdf":return(0,y.jsx)(U.A,{component:"iframe",title:V||Re||"PDF preview",src:K,sx:{...Q,border:"none",opacity:fe?0:1,transition:"opacity 0.2s ease"},onLoad:Ye,onError:()=>Ze(A("filePreview.pdfLoadFailed","Failed to load PDF"))});case"video":return(0,y.jsx)(U.A,{component:"video",src:K,controls:!0,sx:{...Q,opacity:fe?0:1,transition:"opacity 0.2s ease"},onLoadedData:Ye,onError:()=>Ze(A("filePreview.videoLoadFailed","Failed to load video"))});case"audio":return(0,y.jsxs)(U.A,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:{xs:220,sm:280},width:"100%",opacity:fe?0:1,transition:"opacity 0.2s ease"},children:[(0,y.jsx)(M.bY4,{size:64,color:(Z=E.text)===null||Z===void 0?void 0:Z.tertiary}),(0,y.jsx)(U.A,{component:"audio",src:K,controls:!0,sx:{mt:2,width:"100%",maxWidth:420},onLoadedData:Ye,onError:()=>Ze(A("filePreview.audioLoadFailed","Failed to load audio"))})]});default:return(0,y.jsxs)(U.A,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:{xs:280,sm:360},width:"100%",color:(Ce=E.text)===null||Ce===void 0?void 0:Ce.secondary},children:[So(ne),(0,y.jsx)(d.A,{sx:{mt:2,fontSize:16,color:(qe=E.text)===null||qe===void 0?void 0:qe.primary},children:A("filePreview.notAvailable","Preview not available")}),(0,y.jsx)(d.A,{sx:{mt:1,fontSize:14,color:(Ke=E.text)===null||Ke===void 0?void 0:Ke.tertiary},children:A("filePreview.unsupportedType","This file type cannot be previewed")})]})}};return(0,y.jsxs)($.A,{open:Se,onClose:io,fullScreen:!0,disableEscapeKeyDown:!1,slotProps:{root:{sx:{zIndex:Z=>Z.zIndex.snackbar+1}}},PaperProps:{sx:{bgcolor:(Y=E.background)===null||Y===void 0?void 0:Y.secondary,borderRadius:0,color:(ge=E.text)===null||ge===void 0?void 0:ge.primary,boxShadow:"none",border:"none",overflow:"hidden",
1width:"100%",height:"100%",maxHeight:"100%",display:"flex",flexDirection:"column"}},children:[(0,y.jsx)(v.A,{sx:{flexShrink:0,px:3,pt:2.5,pb:.75,borderBottom:"none"},children:(0,y.jsxs)(U.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:1},children:[(0,y.jsxs)(U.A,{sx:{flex:1,minWidth:0},children:[(0,y.jsx)(d.A,{variant:"h6",sx:{fontWeight:600,fontSize:18,color:(ce=E.text)===null||ce===void 0?void 0:ce.primary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:se}),Ae?(0,y.jsx)(d.A,{sx:{mt:.75,fontSize:13,color:(B=E.text)===null||B===void 0?void 0:B.tertiary,lineHeight:1.45,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ae}):null]}),(0,y.jsx)(q.A,{"aria-label":A("common.close","Close"),onClick:G,size:"small",sx:{color:(le=E.text)===null||le===void 0?void 0:le.tertiary,mt:-.25,flexShrink:0,"&:hover":{bgcolor:(Ie=E.background)===null||Ie===void 0?void 0:Ie.tertiary,color:(We=E.text)===null||We===void 0?void 0:We.primary}},children:(0,y.jsx)(M.X,{size:20})})]})}),(0,y.jsx)(H.A,{sx:{flex:"1 1 auto",display:"flex",flexDirection:"column",minHeight:0,px:0,pt:0,pb:0,overflow:"hidden"},children:(0,y.jsxs)(U.A,{sx:{flex:1,minHeight:0,overflow:"hidden",overscrollBehavior:"contain",p:{xs:2,sm:2.5},display:"flex",alignItems:"center",justifyContent:"center",position:"relative",height:"100%",background:J?`linear-gradient(185deg, ${(ye=E.background)===null||ye===void 0?void 0:ye.secondary} 0%, ${(Ue=E.background)===null||Ue===void 0?void 0:Ue.primary} 100%)`:`linear-gradient(185deg, ${(ee=E.background)===null||ee===void 0?void 0:ee.secondary} 0%, ${(be=E.background)===null||be===void 0?void 0:be.tertiary} 100%)`},children:[fe?(0,y.jsxs)(U.A,{sx:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,zIndex:2,bgcolor:J?"rgba(26, 26, 26, 0.55)":"rgba(255, 255, 255, 0.72)"},children:[(0,y.jsx)(X.A,{size:40,sx:{color:I}}),(0,y.jsx)(d.A,{sx:{color:(ae=E.text)===null||ae===void 0?void 0:ae.secondary,fontSize:14},children:A("filePreview.loading","Loading preview\u2026")})]}):null,(0,y.jsx)(U.A,{sx:{width:"100%",height:"100%",minHeight:0,display:"flex",alignItems:"center",justifyContent:"center"},children:Ao()})]})}),(0,y.jsxs)(j.A,{sx:{flexShrink:0,px:3,py:2,borderTop:`1px solid ${($e=E.border)===null||$e===void 0?void 0:$e.primary}`,bgcolor:(e=E.background)===null||e===void 0?void 0:e.secondary,justifyContent:"flex-end",gap:1.5,flexWrap:"wrap",alignItems:"center"},children:[(0,y.jsx)(me.A,{type:"button",onClick:G,children:A("common.close","Close")}),(0,y.jsx)(de.A,{type:"button",onClick:go,disabled:!K||fe,startIcon:(0,y.jsx)(M.f5X,{size:16}),children:A("common.download","Download")})]})]})}},72733(_o,De,r){r.d(De,{A:()=>Ee});var i=r(51477),U=r(34016),d=r(12239),$=r(50388),v=r(91234),q=r(6227),H=r(82380),X=r(14998),j=r(78378),ve=r(33643),M=r(31623),Pe=r(45719),R=r(70481);const he=1e3,P=700,de={default:{cardHeight:{xs:110,sm:120,md:130},contentPadding:{xs:1.5,md:2},labelFontSize:{xs:12,md:14},valueFontSize:{xs:24,md:28},inlineSkeletonFontSize:{xs:24,md:28},progressBarHeight:4,refreshIconPx:16,minWidth:140,shimmerLabelW:80,shimmerLabelH:16,shimmerValueW:120,shimmerValueH:32,shimmerLabelMb:2},small:{cardHeight:{xs:86,sm:92,md:96},contentPadding:{xs:1,md:1.25},labelFontSize:{xs:10,md:11},valueFontSize:{xs:18,md:20},inlineSkeletonFontSize:{xs:18,md:20},progressBarHeight:3,refreshIconPx:14,minWidth:120,shimmerLabelW:64,shimmerLabelH:12,shimmerValueW:88,shimmerValueH:22,shimmerLabelMb:1.25}},me=Me=>{var re,T,S;let{colors:Y,shimmerStyles:ge,isDark:ce,layout:B}=Me;return(0,R.jsx)(U.A,{sx:{bgcolor:(re=Y.background)===null||re===void 0?void 0:re.secondary,borderRadius:3,boxShadow:ce?"0 2px 8px rgba(0, 0, 0, 0.2)":"0 2px 8px rgba(0, 0, 0, 0.05)",border:"none",p:0,height:B.cardHeight,width:"100%",minWidth:B.minWidth,maxWidth:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column"}
1,children:(0,R.jsxs)(d.A,{sx:{p:B.contentPadding,height:"100%",display:"flex",flexDirection:"column"},children:[(0,R.jsx)($.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:B.shimmerLabelMb},children:(0,R.jsxs)($.A,{children:[(0,R.jsx)(v.A,{variant:"text",animation:"wave",width:B.shimmerLabelW,height:B.shimmerLabelH,sx:{...ge,mb:.5}}),(0,R.jsx)(v.A,{variant:"text",animation:"wave",width:B.shimmerValueW,height:B.shimmerValueH,sx:{...ge,mb:.5,animationDelay:"160ms"}})]})}),(0,R.jsx)($.A,{sx:{width:"100%",height:B.progressBarHeight,bgcolor:((T=Y.border)===null||T===void 0?void 0:T.primary)||((S=Y.background)===null||S===void 0?void 0:S.secondary),borderRadius:2,overflow:"hidden"},children:(0,R.jsx)(v.A,{variant:"rectangular",animation:"wave",width:"70%",height:"100%",sx:{...ge,borderRadius:2,animationDelay:"320ms"}})})]})})},Ee=Me=>{var re,T,S,Y,ge,ce,B,le,Ie;let{label:We,value:ye,progressPercentage:Ue,progressColor:ee,isLoading:be=!1,loadingVariant:ae="card",formatValue:$e,onRefresh:e,isRefreshing:K=!1,primaryColor:Re,variant:Ve="default",sx:V={}}=Me;const Se=(0,ve.rn)(),_e=Re??Se,A=(0,j.e)(),I=(0,M.jM)(A?"dark":"light",_e),[J,E]=(0,i.useState)("idle"),Q=(0,i.useRef)(0),ne=ee||((re=I.status)===null||re===void 0?void 0:re.success)||"#10b981",mo=(0,Pe.d)(A),fe=Ve==="small"?de.small:de.default,ue=(0,i.useCallback)(()=>{J!=="idle"||K||(Q.current=performance.now(),E("spin"),e())},[e,J,K]);(0,i.useEffect)(()=>{if(J!=="spin"||K)return;const go=performance.now()-Q.current,So=Math.max(0,he-go),Ao=window.setTimeout(()=>{E(Z=>Z==="spin"?"check":Z)},So);return()=>window.clearTimeout(Ao)},[J,K]),(0,i.useEffect)(()=>{if(J!=="check")return;const go=window.setTimeout(()=>E("idle"),P);return()=>window.clearTimeout(go)},[J]);const fo=K||J==="spin",Fe=J==="check",O=J!=="idle"||K,se={bgcolor:(T=I.background)===null||T===void 0?void 0:T.secondary,borderRadius:3,boxShadow:A?"0 2px 8px rgba(0, 0, 0, 0.2)":"0 2px 8px rgba(0, 0, 0, 0.05)",border:"none",p:0,height:fe.cardHeight,width:"100%",minWidth:fe.minWidth,maxWidth:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",...V},Ae={p:fe.contentPadding,height:"100%",display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box"},G={fontSize:fe.valueFontSize,fontWeight:700,color:(S=I.text)===null||S===void 0?void 0:S.primary,mb:.5,wordBreak:"break-word",lineHeight:1.2},io=be&&ae==="card",Ye=be&&ae==="inline";if(io)return(0,R.jsx)(me,{colors:I,shimmerStyles:mo,isDark:A,layout:fe});const Ze=Ye?null:$e?$e(ye):ye;return(0,R.jsx)(U.A,{sx:se,children:(0,R.jsxs)(d.A,{sx:Ae,children:[(0,R.jsxs)($.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",flex:1,minWidth:0},children:[(0,R.jsxs)($.A,{sx:{flex:1,minWidth:0,pr:e?.5:0},children:[(0,R.jsx)(q.A,{sx:{color:(Y=I.text)===null||Y===void 0?void 0:Y.tertiary,fontSize:fe.labelFontSize,fontWeight:500,mb:.5,wordBreak:"break-word"},children:We}),Ye?(0,R.jsx)($.A,{"aria-hidden":!0,sx:{fontSize:fe.inlineSkeletonFontSize,lineHeight:1.2,mb:.5,width:"100%",minWidth:0},children:(0,R.jsx)(v.A,{variant:"rounded",animation:"wave",sx:{display:"block",width:"min(100%, 11rem)",height:"1.2em",transform:"none",borderRadius:1,...mo}})}):(0,R.jsx)(q.A,{sx:G,children:Ze})]}),e&&(0,R.jsx)(H.A,{size:"small",onClick:ue,disabled:O,"aria-label":Fe?"Updated":fo?"Refreshing":"Refresh",sx:{color:Fe?ne:(ge=I.text)===null||ge===void 0?void 0:ge.tertiary,p:.5,"&:hover":{color:_e,bgcolor:(ce=I.background)===null||ce===void 0?void 0:ce.tertiary},"&.Mui-disabled":{color:Fe?ne:(B=I.text)===null||B===void 0?void 0:B.tertiary,opacity:Fe?1:.7}},children:(0,R.jsx)($.A,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:fe.refreshIconPx,height:fe.refreshIconPx,animation:fo?"statWidgetSpin 1s linear infinite":"none","@keyframes statWidgetSpin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}},...Fe&&{animation:"statWidgetCheckIn 0.35s ease-out","@keyframes statWidgetCheckIn":{from:{transform:"scale(0.65)",opacity:.5},to:{transform:"scale(1)",opacity:1}}}},children:Fe?(0,R.jsx)(X.Jlk,{size:fe.refreshIconPx,strokeWidth:2.5,"aria-hidden":!0}):(0,R.jsx)(X.e9t,{size:fe.refreshIconPx,"aria-hidden":!0})})})]}),Ue!==void 0&&(0,R.jsx)($.A,{sx:{width:"100%",height:fe.progressBarHeight,bgcolor:((le=I.border)===null||le===void 0?void 0:le.primary)||((Ie=I.background)===null||Ie===void 0?void 0:Ie.secondary),borderRadius:2,overflow:"hidden",mt:"auto"},children:(0,R.jsx)($.A,{sx:{width:"100%",height:"100%",bgcolor:ne,borderRadius:2}})})]})})}},54562(_o,De,r){r.d(De,{A:()=>R});var i=r(51477),U=r(50388),d=r(38754),$=r(91960),v=r(82380),q=r(14998),H=r(93078),X=r(78378),j=r(33643),ve=r(31623),M=r(70481);const R=he=>{var P,de,me,y,Ee,Me,re,T,S,Y,ge,ce,B;let{value:le,onCopy:Ie,onOpen:We,placeholder:ye="",readOnly:Ue=!0,fullWidth:ee=!0,showOpenButton:be=!1,
1copyButtonText:ae,copiedButtonText:$e,size:e="small",multiline:K=!1,rows:Re=1,sx:Ve={}}=he;const{t:V}=(0,H.Bd)(),Se=(0,X.e)(),_e=(0,j.rn)(),A=(0,ve.jM)(Se?"dark":"light",_e),[I,J]=(0,i.useState)(!1),E=ae||V("common.copy","Copy"),Q=$e||V("common.copied","Copied"),ne=async()=>{if(Ie)await Ie(le);else try{await navigator.clipboard.writeText(le)}catch(ue){console.error("Failed to copy: ",ue)}J(!0),setTimeout(()=>J(!1),2e3)},fe=1+(be&&We?1:0)>1?7.5:5;return(0,M.jsxs)(U.A,{sx:{position:"relative",flex:1,minWidth:0,width:"100%",bgcolor:(P=A.background)===null||P===void 0?void 0:P.primary,borderRadius:1,border:`1px solid ${(de=A.border)===null||de===void 0?void 0:de.primary}`,p:.75,...Ve},children:[(0,M.jsx)(d.A,{value:le,placeholder:ye,fullWidth:ee,variant:"outlined",size:e,multiline:K,rows:Re,InputProps:{readOnly:Ue,sx:{color:(me=A.text)===null||me===void 0?void 0:me.primary,fontFamily:K?"monospace":"inherit",fontSize:K?"12px":"inherit",pr:`${fe*8}px`,"& .MuiOutlinedInput-notchedOutline":{borderColor:"transparent"}}}}),(0,M.jsxs)(U.A,{sx:{position:"absolute",top:6,right:6,display:"flex",alignItems:"center",gap:.25,pointerEvents:"none","& .MuiIconButton-root":{pointerEvents:"auto"}},children:[(0,M.jsx)($.A,{title:I?Q:E,placement:"top",children:(0,M.jsx)("span",{children:(0,M.jsx)(v.A,{size:"small",onClick:ne,"aria-label":I?Q:E,sx:{width:30,height:30,color:I?(y=A.status)===null||y===void 0?void 0:y.success:(Ee=A.text)===null||Ee===void 0?void 0:Ee.secondary,bgcolor:(Me=A.background)===null||Me===void 0?void 0:Me.secondary,border:`1px solid ${(re=A.border)===null||re===void 0?void 0:re.primary}`,"&:hover":{bgcolor:(T=A.background)===null||T===void 0?void 0:T.tertiary,color:I?(S=A.status)===null||S===void 0?void 0:S.success:A.primary}},children:I?(0,M.jsx)(q.Jlk,{size:14,strokeWidth:2.5}):(0,M.jsx)(q.QRo,{size:14,strokeWidth:2})})})}),be&&We&&(0,M.jsx)($.A,{title:V("common.open","Open"),placement:"top",children:(0,M.jsx)(v.A,{size:"small",onClick:We,"aria-label":V("common.open","Open"),sx:{width:30,height:30,color:(Y=A.text)===null||Y===void 0?void 0:Y.secondary,bgcolor:(ge=A.background)===null||ge===void 0?void 0:ge.secondary,border:`1px solid ${(ce=A.border)===null||ce===void 0?void 0:ce.primary}`,"&:hover":{bgcolor:(B=A.background)===null||B===void 0?void 0:B.tertiary,color:A.primary}},children:(0,M.jsx)(q.GrD,{size:14,strokeWidth:2})})})]})]})}},46095(_o,De,r){r.d(De,{A:()=>$});var i=r(51477),U=r(58281),d=r(70481);function $(v){let{checked:q=!1,indeterminate:H=!1,onChange:X,onMouseDown:j,compact:ve=!1,primaryColor:M,sx:Pe={},...R}=v;return(0,d.jsx)(U.A,{checked:q,indeterminate:H,size:ve?"small":"medium",primaryColor:M,onChange:he=>X?.(he),onMouseDown:j,sx:{marginInlineEnd:0,flexShrink:0,...Pe},...R})}},77222(_o,De,r){r.d(De,{A:()=>Pe});var i=r(51477),U=r(67339),d=r(80015),$=r(91234),v=r(50388),q=r(33643),H=r(78378),X=r(31623),j=r(70481);const ve=i.memo(R=>{var he,P,de,me;let{columns:y,colors:Ee,isDark:Me,reserveLeadingCheckboxCell:re,showActionsColumn:T,avatarColumnId:S}=R;const Y=Me?((he=Ee.background)===null||he===void 0?void 0:he.tertiary)||((P=Ee.background)===null||P===void 0?void 0:P.secondary):((de=Ee.border)===null||de===void 0?void 0:de.secondary)||((me=Ee.background)===null||me===void 0?void 0:me.secondary);return(0,j.jsxs)(U.A,{children:[re?(0,j.jsx)(d.A,{sx:{py:{xs:.5,sm:.5},px:{xs:1,sm:1.5},width:{xs:"40px",sm:"50px"},minWidth:{xs:"40px",sm:"50px"}},children:(0,j.jsx)($.A,{variant:"rectangular",width:20,height:20,sx:{bgcolor:Y,borderRadius:.5}})}):null,y.map((ge,ce)=>{const B=`col-${ce}-${String(ge)}`,le=S!=null&&ge===S;return(0,j.jsx)(d.A,{children:le?(0,j.jsxs)(v.A,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,j.jsx)($.A,{variant:"circular",width:32,height:32,sx:{bgcolor:Y}}),(0,j.jsx)($.A,{variant:"text",width:"65%",height:20,sx:{bgcolor:Y}})]}):(0,j.jsx)($.A,{variant:"text",width:"80%",height:20,sx:{bgcolor:Y}})},B)}),T?(0,j.jsx)(d.A,{sx:{width:{xs:50,sm:80},minWidth:{xs:50,sm:80}},children:(0,j.jsx)($.A,{variant:"rectangular",width:32,height:32,sx:{bgcolor:Y}})}):null]})});ve.displayName="TableRowShimmer";const M=i.memo(R=>{let{columns:he=[],rows:P=10,reserveLeadingCheckboxCell:de=!1,showActionsColumn:me=!0,avatarColumnId:y}=R;const Ee=(0,q.rn)(),Me=(0,H.e)(),re=(0,X.jM)(Me?"dark":"light",Ee);return(0,j.jsx)(j.Fragment,{children:Array.from({length:P}).map((T,S)=>(0,j.jsx)(ve,{columns:he,colors:re,isDark:Me,reserveLeadingCheckboxCell:de,showActionsColumn:me,avatarColumnId:y},S))})});M.displayName="TableShimmer";const Pe=M},34789(_o,De,r){r.r(De),r.d(De,{default:()=>fn});var i=r(51477),U=r(77020),d=r(50388),$=r(77604),v=r(6227),q=r(42727),H=r(34016),X=r(12239),j=r(88151),ve=r(67339),M=r(80015),Pe=r(82380),R=r(72992),he=r(56155),P=r(14998),de=r(88715),me=r(93078),y=r(67763),Ee=r(11110),Me=r(55881),re=r(72733),T=r(14813),S=r(70354),Y=r(45879),ge=r(82675),ce=r(9995),B=r(17573),le=r(59581),Ie=r(54562),We=r(78378),ye=r(33643),Ue=r(31623),ee=r(69889),be=r(55022),ae=r(39817),$e=r(38686),e=r(70481);function K(t){switch(t){case"email":return(0,e.jsx)(ee.jQL,{size:16});case"phone":return(0,e.jsx)(ee.stL,{size:16});case"file":return(0,e.jsx)(ee.g6N,{size:16});case"image":return(0,e.jsx)(ee.QJ3,{size:16});case"signature":return(0,e.jsx)(ee.nRQ,{size:16});case"productSelection":return(0,e.jsx)(ee.kPR,{size:16});case"bookings":return(0,e.jsx)(ee._vE,{size:16});case"hidden":return(0,e.jsx)(ee.C7u,{size:16});default:return(0,e.jsx)(ee.nRQ,{size:16})}}function Re(t){var n;const s=(n=t.split(".").pop())===null||n===void 0?void 0:n.toLowerCase();return{pdf:"/filetypes/red-pdf-file-format-24084.png",doc:"/filetypes/blue-word-document-doc-24085.png",docx:"/filetypes/blue-word-document-docx-24086.png",xls:"/filetypes/green-xls-excel-file-format-extension-24090.png",xlsx:"/filetypes/green-xlsx-excel-file-format-extension-24091.png",ppt:"/filetypes/powerpoint-ppt-file-format-extension-24092.png",pptx:"/filetypes/powerpoint-ppt-file-format-extension-24092.png",txt:"/filetypes/txt-file-format-extension-24095.png",rtf:"/filetypes/txt-file-format-extension-24095.png",csv:"/filetypes/green-csv-file-format-extension-24093.png",jpg:"/filetypes/jpg-image-file-format-extension-24098.png",jpeg:"/filetypes/jpg-image-file-format-extension-24098.png",png:"/filetypes/png-image-file-format-extension-24099.png",gif:"/filetypes/red-gif-image-file-format-extension-24105.png",svg:"/filetypes/red-svg-image-file-format-extension-24101.png",bmp:"/filetypes/green-image-file-format-extension-24112.png",webp:"/filetypes/green-image-file-format-extension-24112.png",mp4:"/filetypes/blue-mp4-file-format-extension-24097.png",avi:"/filetypes/red-video-file-format-extension-24113.png",mov:"/filetypes/red-video-file-format-extension-24113.png",wmv:"/filetypes/red-video-file-format-extension-24113.png",flv:"/filetypes/red-video-file-format-extension-24113.png",mp3:"/filetypes/blue-mp3-music-file-format-extension-24096.png",wav:"/filetypes/music-file-format-extension-24114.png",flac:"/filetypes/music-file-format-extension-24114.png",aac:"/filetypes/music-file-format-extension-24114.png",zip:"/filetypes/yellow-zip-file-format-extension-24094.png",rar:"/filetypes/yellow-zip-file-format-extension-24094.png","7z":"/filetypes/yellow-zip-file-format-extension-24094.png",tar:"/filetypes/yellow-zip-file-format-extension-24094.png",gz:"/filetypes/yellow-zip-file-format-extension-24094.png"}[s]||"/filetypes/green-image-file-format-extension-24112.png"}function Ve(t){var n;const s=(n=t.split(".").pop())===null||n===void 0?void 0:n.toLowerCase();return["jpg","jpeg","png","gif","svg","bmp","webp"].includes(s)}const V=6;function Se(t){if(t.length>320)return!0;let n=1;for(let s=0;s<t.length;s+=1)if(t.charCodeAt(s)===10&&(n+=1),n>V)return!0;return!1}function _e(t){let{text:n,readAllLabel:s,showLessLabel:l,accentColor:a}=t;const c=(0,i.useRef)(null),[x,p]=(0,i.useState)(!1),[f,g]=(0,i.useState)(()=>Se(n)),D=(0,i.useCallback)(()=>{const W=c.current;!W||x||g(W.scrollHeight>W.clientHeight+1)},[x]);return(0,i.useLayoutEffect)(()=>{p(!1),g(Se(n))},[n]),(0,i.useLayoutEffect)(()=>{D()},[D,n,x]),(0,i.useLayoutEffect)(()=>{const W=c.current;if(!W||x||typeof ResizeObserver>"u")return;const w=new ResizeObserver(D);return w.observe(W),()=>w.disconnect()},[x,D]),(0,e.jsxs)(d.A,{children:[(0,e.jsx)(v.A,{component:"div",ref:c,sx:{color:"inherit",fontSize:"inherit",lineHeight:"inherit",fontWeight:400,whiteSpace:"pre-wrap",overflowWrap:"anywhere",...x?
1null:{display:"-webkit-box",WebkitLineClamp:V,WebkitBoxOrient:"vertical",overflow:"hidden"}},children:n}),f||x?(0,e.jsx)(d.A,{component:"button",type:"button",onClick:()=>p(W=>!W),"aria-expanded":x,sx:{mt:.75,p:0,border:0,background:"none",cursor:"pointer",font:"inherit",fontSize:13,fontWeight:600,lineHeight:1.4,textAlign:"left",color:a,"&:hover":{textDecoration:"underline"},"&:focus-visible":{outline:`2px solid ${a}`,outlineOffset:2}},children:x?l:s}):null]})}function A(t){let{field:n,value:s,colors:l,primaryColor:a,t:c,productEnrichmentById:x,onFileClick:p}=t;if(s==null||s===""){var f;return(0,e.jsx)("span",{style:{color:(f=l.text)===null||f===void 0?void 0:f.tertiary,fontStyle:"italic"},children:c("forms.responses.noResponse")})}if(n?.type==="bookings")return(0,e.jsx)($e.A,{field:n,value:s,colors:l,primaryColor:a});if(n?.type==="productSelection")return(0,e.jsx)(be.A,{field:n,value:s,colors:l,primaryColor:a,extraSnapshots:x});if(n?.type==="teamMemberPicker"){const w=(0,ae.Hx)(s,n,c);if(!w){var g;return(0,e.jsx)("span",{style:{color:(g=l.text)===null||g===void 0?void 0:g.tertiary,fontStyle:"italic"},children:c("forms.responses.noResponse")})}return w}if(Array.isArray(s)){if(s.length===0){var D;return(0,e.jsx)("span",{style:{color:(D=l.text)===null||D===void 0?void 0:D.tertiary,fontStyle:"italic"},children:c("forms.responses.noResponse")})}return s[0]&&s[0].url?(0,e.jsx)(d.A,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:s.map((w,k)=>{var N,Le,oe,Ne,Be,to,xe,Je,lo,no,xo;const Oe=String(w.name||w.url||c("forms.responses.fileFallbackName")),Xe=Ve(Oe)||String(w.type||"").toLowerCase().startsWith("image/");return(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1.5,p:1.5,bgcolor:(N=l.background)===null||N===void 0?void 0:N.secondary,borderRadius:1.5,border:`1px solid ${(Le=l.border)===null||Le===void 0?void 0:Le.primary}`,"&:hover":{bgcolor:(oe=l.background)===null||oe===void 0?void 0:oe.tertiary,borderColor:((Ne=l.border)===null||Ne===void 0?void 0:Ne.secondary)||l.primary},cursor:p?"pointer":"default",transition:"background-color 0.2s ease, border-color 0.2s ease"},onClick:()=>p?.(w),children:[(0,e.jsx)(d.A,{sx:{width:Xe?72:48,height:Xe?60:48,bgcolor:(Be=l.background)===null||Be===void 0?void 0:Be.primary,borderRadius:1,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,e.jsx)(d.A,{component:"img",src:Xe?w.url:Re(Oe),alt:Xe?c("forms.responses.imagePreviewAlt",{name:Oe}):"",loading:"lazy",sx:{width:Xe?"100%":28,height:Xe?"100%":28,objectFit:Xe?"cover":"contain"},onError:ro=>{ro.currentTarget.onerror=null,ro.currentTarget.src=Re(Oe),ro.currentTarget.style.width="28px",ro.currentTarget.style.height="28px",ro.currentTarget.style.objectFit="contain"}})}),(0,e.jsxs)(d.A,{sx:{flex:1,minWidth:0},children:[(0,e.jsx)(v.A,{title:Oe,sx:{color:(to=l.text)===null||to===void 0?void 0:to.primary,fontWeight:600,fontSize:14,mb:.25,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Oe}),(0,e.jsx)(v.A,{sx:{color:(xe=l.text)===null||xe===void 0?void 0:xe.secondary,fontSize:12},children:w.size?`${(w.size/1024/1024).toFixed(2)} MB`:c("forms.responses.unknownSize")})]}),(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:.25,flexShrink:0},children:[Xe?(0,e.jsx)(Pe.A,{size:"small","aria-label":c("forms.responses.previewFile",{name:Oe}),onClick:ro=>{ro.stopPropagation(),p?.(w)},sx:{color:(Je=l.text)===null||Je===void 0?void 0:Je.secondary,"&:hover":{color:l.primary,bgcolor:(lo=l.background)===null||lo===void 0?void 0:lo.primary}},children:(0,e.jsx)(ee.HvQ,{size:18})}):null,(0,e.jsx)(Pe.A,{component:"a",href:w.url,download:Oe,target:"_blank",rel:"noopener noreferrer",size:"small","aria-label":c("forms.responses.downloadFile",{name:Oe}),onClick:ro=>ro.stopPropagation(),sx:{color:(no=l.text)===null||no===void 0?void 0:no.secondary,"&:hover":{color:l.primary,bgcolor:(xo=l.background)===null||xo===void 0?void 0:xo.primary}},children:(0,e.jsx)(ee.i8u,{size:18})})]})]},`${w.url}-${k}`)})}):s.join(", ")}if(typeof s=="string")return(0,e.jsx)(_e,{text:s,readAllLabel:c("forms.responses.dialog.readAll"),showLessLabel:c("forms.responses.dialog.showLess"),accentColor:l.primary||a});if(typeof s=="object"){if(n?.type==="dateRange"&&(Object.prototype.hasOwnProperty.call(s,"startDate")||Object.prototype.hasOwnProperty.call(s,"endDate"))){const w=typeof s.startDate=="string"?s.startDate.trim():"",k=typeof s.endDate=="string"?s.endDate.trim():"";if(!w&&!k){var W;return(0,e.jsx)("span",{style:{color:(W=l.text)===null||W===void 0?void 0:W.tertiary,fontStyle:"italic"},children:c("forms.responses.noResponse")})}return w&&k?`${w} - ${k}`:w||k}return JSON.stringify(s)}return String(s)}var I=r(24145),J=r(29874),E=r(68999),Q=r(66796),ne=r(8612);const mo=new Set(["divider","heading","paragraph","spacer","layoutImage","layoutVideo","pageBreak","recaptcha","turnstile","layoutColumns1","layoutColumns2","layoutColumns3"]),fe=null;function ue(t){return!!(t?.type&&!mo.has(t.type))}const fo=Number.POSITIVE_INFINITY,Fe=80;function O(t){var n,s,l;const a=String((n=t?.id)!==null&&n!==void 0?n:"").trim();if(a)return`id:${a}`;const c=t?.type||"",x=String((s=(l=t?.label)!==null&&l!==void 0?l:t?.name)!==null&&s!==void 0?s:"").trim().toLowerCase();return c&&x?`type-label:${c}:${x}`:`orphan:${c}:${x}`}function se(t,n){var s,l,a,c,x,p;
1if(!t||!n)return!1;const f=String((s=t.id)!==null&&s!==void 0?s:"").trim(),g=String((l=n.id)!==null&&l!==void 0?l:"").trim();if(f&&g)return f===g;if((t.type||"")!==(n.type||""))return!1;const D=String((a=(c=t.label)!==null&&c!==void 0?c:t.name)!==null&&a!==void 0?a:"").trim().toLowerCase(),W=String((x=(p=n.label)!==null&&p!==void 0?p:n.name)!==null&&x!==void 0?x:"").trim().toLowerCase();return!!(D&&W&&D===W)}function Ae(t,n){const s=[],l=new Set,a=x=>{if(!ue(x))return;const p=O(x);l.has(p)||s.some(f=>se(f,x))||(l.add(p),s.push(x))},c=(0,Q.kU)(t);for(const x of c)a(x);if(Array.isArray(n)&&n.length>0){const x=[...n].sort((p,f)=>{const g=p!=null&&p.submitted_at?new Date(p.submitted_at).getTime():0,D=f!=null&&f.submitted_at?new Date(f.submitted_at).getTime():0;return g-D});for(const p of x){const f=(0,Q.kU)(p?.form_structure);for(const g of f)a(g)}}return s}function G(t,n,s){return n?.type==="productSelection"?(0,E.l7)(t,n,s).length===0:!!(t==null||t===""||Array.isArray(t)&&t.length===0)}function io(t,n,s){const l=(0,I.X4)(t,n,s);if(!l)return t;if(t?.type==="productSelection"){var a,c;const f=l.productSnapshots&&typeof l.productSnapshots=="object"?l.productSnapshots:{},g=t.productSnapshots&&typeof t.productSnapshots=="object"?t.productSnapshots:{};return{...t,allowMultiple:(a=l.allowMultiple)!==null&&a!==void 0?a:t.allowMultiple,allowQuantity:(c=l.allowQuantity)!==null&&c!==void 0?c:t.allowQuantity,productSnapshots:{...f,...g}}}if(t?.type==="teamMemberPicker"){var x,p;const f=l.memberSnapshots&&typeof l.memberSnapshots=="object"?l.memberSnapshots:{},g=t.memberSnapshots&&typeof t.memberSnapshots=="object"?t.memberSnapshots:{};return{...t,specificMembersOnly:(x=l.specificMembersOnly)!==null&&x!==void 0?x:t.specificMembersOnly,allowMultiple:(p=l.allowMultiple)!==null&&p!==void 0?p:t.allowMultiple,memberSnapshots:{...f,...g}}}return t}function Ye(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fo;if(!Array.isArray(t))return[];const s=(0,Q.kU)(t).filter(l=>ue(l));return!Number.isFinite(n)||n<=0?s:s.slice(0,n)}function Ze(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Fe;const s=String(t??"").trim();return s?s.length<=n?s:`${s.slice(0,n)}\u2026`:""}function go(t){return Array.isArray(t)&&t.length>0&&t.every(n=>n&&typeof n=="object"&&(n.url||n.name))}function So(t,n,s,l){const a=(0,E.l7)(t,n,s);if(a.length===0)return"";const c=n?.showProductPricing!==!1,x=(0,E.SQ)(n?.allowQuantity),p=a.map(f=>{const D=[f.name||l("forms.responses.productSelection.unnamedProduct",{defaultValue:"Product"})];return x&&f.quantity>1&&D.push(`\xD7 ${f.quantity}`),c&&f.price!=null&&!Number.isNaN(Number(f.price))&&D.push(new Intl.NumberFormat(void 0,{style:"currency",currency:(f.currency||"USD").slice(0,3)}).format(Number(f.price))),f.sku&&D.push(f.sku),D.join(" \xB7 ")});return Ze(p.join(", "))}function Ao(t,n,s,l){if(n==null||n==="")return"";const a=t?.type||"";if(a==="signature")return s("forms.responses.table.signed");if(a==="file"||a==="image"||go(n)){const p=(Array.isArray(n)?n:[n]).filter(Boolean).length;return p===0?"":s("forms.responses.table.attachments",{count:p})}if(a==="productSelection")return So(n,t,l,s);if(a==="teamMemberPicker")return(0,ae.Hx)(n,t,s);const c=(0,J.lv)(n);return Ze(c)}function Z(t,n,s,l,a,c,x){var p;const f=String(n||"").trim().toLowerCase();if(!f||(p=t.id)!==null&&p!==void 0&&p.toLowerCase().includes(f)||l&&t.submitted_at&&l(t.submitted_at).toLowerCase().includes(f))return!0;const g=(0,ne.W)(t);if(g&&g.toLowerCase().includes(f))return!0;if(t.contact_id&&s){var D;const k=s.get(String(t.contact_id));if(k!=null&&(D=k.label)!==null&&D!==void 0&&D.toLowerCase().includes(f))return!0}const W=Ae(x,[t]),w=t.response_json;if(!Array.isArray(W)||W.length===0||!w||typeof w!="object")return!1;for(const k of W){if(!ue(k))continue;const N=(0,I.$B)(w,k,W,t.form_structure,W),Le=io(k,t.form_structure,W),oe=a?Ao(Le,N,a,c):(0,J.lv)(N);if(oe&&String(oe).toLowerCase().includes(f))return!0;if(k.type==="productSelection"){const Be=So(N,Le,c,a||(()=>"Product"));if(Be&&Be.toLowerCase().includes(f))return!0}if(k.type==="teamMemberPicker"){const Be=(0,ae.Hx)(N,Le,a||(()=>"Team member"));if(Be&&Be.toLowerCase().includes(f))return!0}const Ne=(0,J.lv)(N);if(Ne&&Ne.toLowerCase().includes(f))return!0}return!1}function Ce(t,n){return Array.isArray(n)?n.map(s=>({field:s,columnId:(0,I.OZ)(s,t)})):[]}function qe(t,n,s){return(0,I.$B)(t.response_json,n,s,t?.form_structure,s)}function Ke(t,n,s){return io(n,t?.form_structure,s)}function eo(t){var n,s,l,a,c,x,p,f,g,D,W,w,k,N,Le,oe,Ne;let{open:Be,onClose:to,response:xe,displayStructure:Je=[],formatDate:lo,productEnrichmentById:no,onFileClick:xo,onDownloadPdf:Oe,pdfBusy:Xe,canDelete:ro=!1,onDelete:Go}=t;const{t:ze}
1=(0,me.Bd)(),Bo=(0,We.e)(),zo=(0,ye.rn)(),te=(0,Ue.jM)(Bo?"dark":"light",zo);return(0,e.jsxs)(ge.Ay,{anchor:"right",open:Be,onClose:to,ModalProps:{sx:{zIndex:po=>po.zIndex.snackbar},BackdropProps:{sx:{backdropFilter:"blur(4px)",backgroundColor:"rgba(0, 0, 0, 0.35)"}}},PaperProps:{sx:{width:{xs:"100%",sm:520},maxWidth:"100%",bgcolor:((n=te.background)===null||n===void 0?void 0:n.modal)||((s=te.background)===null||s===void 0?void 0:s.secondary),borderLeft:`1px solid ${(l=te.border)===null||l===void 0?void 0:l.primary}`,boxShadow:Bo?"0 8px 32px rgba(0,0,0,0.4)":"0 8px 32px rgba(0,0,0,0.1)",display:"flex",flexDirection:"column"}},children:[(0,e.jsxs)(d.A,{sx:{px:2,py:1.75,borderBottom:`1px solid ${(a=te.border)===null||a===void 0?void 0:a.primary}`,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0},children:[(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1.5,minWidth:0},children:[(0,e.jsx)(d.A,{sx:{p:1.25,borderRadius:1.5,bgcolor:`${zo}20`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,e.jsx)(P.KJW,{size:20,color:te.primary})}),(0,e.jsxs)(d.A,{sx:{minWidth:0},children:[(0,e.jsx)(v.A,{variant:"h6",sx:{color:(c=te.text)===null||c===void 0?void 0:c.primary,fontWeight:600,fontSize:17},children:ze("forms.responses.dialog.title")}),xe&&(0,e.jsxs)(d.A,{children:[(0,e.jsx)(v.A,{variant:"body2",sx:{color:(x=te.text)===null||x===void 0?void 0:x.secondary,fontSize:13},children:ze("forms.responses.dialog.submittedOn",{date:lo(xe.submitted_at)})}),(0,ne.f)(xe)&&(0,e.jsx)(v.A,{variant:"body2",sx:{color:(p=te.text)===null||p===void 0?void 0:p.primary,fontSize:13,fontWeight:600},children:ze("forms.responses.dialog.paidAmount",{amount:(0,ne.W)(xe)})})]})]})]}),(0,e.jsx)(Pe.A,{onClick:to,size:"small","aria-label":ze("common.close"),sx:{color:(f=te.text)===null||f===void 0?void 0:f.secondary,flexShrink:0,"&:hover":{color:(g=te.text)===null||g===void 0?void 0:g.primary,bgcolor:(D=te.background)===null||D===void 0?void 0:D.tertiary}},children:(0,e.jsx)(P.X,{size:18})})]}),(0,e.jsx)(d.A,{sx:{flex:1,overflowY:"auto",px:2,py:2},children:xe&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(d.A,{sx:{mb:2},children:[(0,e.jsx)(v.A,{variant:"body2",sx:{color:(W=te.text)===null||W===void 0?void 0:W.secondary,mb:.75,fontWeight:500,fontSize:12},children:ze("forms.responses.dialog.responseId")}),(0,e.jsx)(Ie.A,{value:xe.id,multiline:!0,rows:1,copyButtonText:ze("forms.shareModal.copy"),copiedButtonText:ze("forms.shareModal.copied"),sx:{p:.5,"& .MuiOutlinedInput-root":{py:0,minHeight:0},"& .MuiOutlinedInput-input":{py:.75,lineHeight:1.35}}})]}),(0,e.jsx)(ce.A,{sx:{borderColor:(w=te.border)===null||w===void 0?void 0:w.primary,mb:2}}),(0,e.jsx)(v.A,{variant:"subtitle1",sx:{color:(k=te.text)===null||k===void 0?void 0:k.primary,mb:1.5,fontWeight:600,fontSize:15},children:ze("forms.responses.dialog.formResponses")}),(0,e.jsx)(B.A,{spacing:1.25,children:Je.filter(ue).map(po=>{var Uo,Fo,Ko,No,Ho,Vo,Xo;const Zo=io(po,xe.form_structure,Je),qo=(0,I.$B)(xe.response_json,po,Je,xe.form_structure,Je),lt=G(qo,Zo,no);return(0,e.jsxs)(d.A,{sx:{px:1.75,py:1.5,bgcolor:(Uo=te.background)===null||Uo===void 0?void 0:Uo.primary,borderRadius:1.5,border:`1px solid ${(Fo=te.border)===null||Fo===void 0?void 0:Fo.primary}`},children:[(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[(0,e.jsx)(d.A,{sx:{color:(Ko=te.text)===null||Ko===void 0?void 0:Ko.secondary,display:"flex",lineHeight:0},children:K(po.type)}),(0,e.jsx)(v.A,{variant:"subtitle2",sx:{color:(No=te.text)===null||No===void 0?void 0:No.primary,fontWeight:600,fontSize:13},children:po.label}),po.required&&(0,e.jsx)(le.A,{label:ze("forms.responses.dialog.required"),size:"small",sx:{bgcolor:Bo?"#ef444420":"#fee2e2",color:(Ho=te.status)===null||Ho===void 0?void 0:Ho.error,fontSize:10,height:18}})]}),(0,e.jsx)(d.A,{sx:{color:(Vo=te.text)===null||Vo===void 0?void 0:Vo.secondary,lineHeight:1.5,fontSize:13},children:lt?(0,e.jsx)(v.A,{sx:{color:(Xo=te.text)===null||Xo===void 0?void 0:Xo.tertiary,fontSize:13},children:ze("forms.responses.table.empty")}):A({field:Zo,value:qo,colors:te,primaryColor:zo,t:ze,productEnrichmentById:no,onFileClick:xo})})]},O(po))})})]})}),(0,e.jsxs)(d.A,{sx:{px:2,py:1.75,borderTop:`1px solid ${(N=te.border)===null||N===void 0?void 0:N.primary}`,bgcolor:(Le=te.background)===null||Le===void 0?void 0:Le.secondary,display:"flex",justifyContent:"space-between",flexWrap:"wrap",gap:1,flexShrink:0},children:[(0,e.jsx)(T.A,{variant:"outlined",startIcon:(0,e.jsx)(P.iUU,{size:16}),disabled:Xe||!xe,onClick:()=>xe&&Oe?.(xe),sx:{borderRadius:2,textTransform:"none"},children:ze(Xe?"forms.responses.download.pdfGenerating":"forms.responses.download.pdf")}
1),ro&&Go&&xe&&(0,e.jsx)(q.A,{variant:"outlined",color:"error",startIcon:(0,e.jsx)(P.TBR,{size:16}),onClick:()=>Go(xe),sx:{borderRadius:2,textTransform:"none"},children:ze("forms.responses.delete.action")}),(0,e.jsx)(q.A,{onClick:to,sx:{color:(oe=te.text)===null||oe===void 0?void 0:oe.secondary,textTransform:"none",fontWeight:500,ml:"auto","&:hover":{color:(Ne=te.text)===null||Ne===void 0?void 0:Ne.primary}},children:ze("common.close")})]})]})}var oo=r(78771),ie=r(46095),Wo=r(49265),Po=r(65005);const gt=2;function Pt(t){var n,s;let{imageUrl:l,colors:a,size:c=28}=t;const[x,p]=(0,i.useState)(!1),f=(0,E.qQ)(l);if(x||!f){var g,D,W;return(0,e.jsx)(d.A,{sx:{width:c,height:c,flexShrink:0,borderRadius:1,bgcolor:(g=a.background)===null||g===void 0?void 0:g.tertiary,border:`1px solid ${(D=a.border)===null||D===void 0?void 0:D.primary}`,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,e.jsx)(ee.kPR,{size:c*.5,stroke:1.25,color:((W=a.text)===null||W===void 0?void 0:W.secondary)||"#888"})})}return(0,e.jsx)(d.A,{sx:{width:c,height:c,flexShrink:0,borderRadius:1,overflow:"hidden",bgcolor:(n=a.background)===null||n===void 0?void 0:n.tertiary,border:`1px solid ${(s=a.border)===null||s===void 0?void 0:s.primary}`},children:(0,e.jsx)(d.A,{component:"img",src:f,alt:"",onError:()=>p(!0),sx:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})})}function Mt(t){var n;let{field:s,value:l,colors:a,primaryColor:c,extraSnapshots:x}=t;const{t:p}=(0,me.Bd)(),{formatCurrency:f}=(0,Po.H)(),g=(0,E.l7)(l,s,x),D=s?.showProductImages!==!1,W=s?.showProductPricing!==!1,w=(0,E.SQ)(s?.allowQuantity);if(g.length===0)return null;const k=g.slice(0,gt),N=g.length-k.length,Le=oe=>!W||oe.price==null||Number.isNaN(Number(oe.price))?"":f(Number(oe.price));return(0,e.jsxs)(d.A,{sx:{display:"flex",flexDirection:"column",gap:.5,minWidth:0,maxWidth:280},children:[k.map(oe=>{var Ne,Be,to,xe,Je,lo,no;const xo=oe.name||p("forms.responses.productSelection.unnamedProduct",{defaultValue:"Product"}),Oe=Le(oe),Xe=[xo,w?`\xD7 ${oe.quantity}`:null,Oe].filter(Boolean).join(" \xB7 ");return(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},title:Xe,children:[D?(0,e.jsx)(Pt,{imageUrl:oe.imageUrl,colors:a}):(0,e.jsx)(d.A,{sx:{width:28,height:28,flexShrink:0,borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:(Ne=a.background)===null||Ne===void 0?void 0:Ne.tertiary,border:`1px solid ${(Be=a.border)===null||Be===void 0?void 0:Be.primary}`},children:(0,e.jsx)(ee.kPR,{size:14,stroke:1.25,color:c||"#0084ff"})}),(0,e.jsxs)(d.A,{sx:{flex:1,minWidth:0},children:[(0,e.jsx)(v.A,{sx:{fontSize:13,fontWeight:500,color:(to=a.text)===null||to===void 0?void 0:to.primary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.3},children:xo}),(w||Oe||oe.sku)&&(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:.5,mt:.15,minWidth:0},children:[w&&oe.quantity>1?(0,e.jsx)(le.A,{label:p("forms.responses.productSelection.qtyChip",{count:oe.quantity}),size:"small",sx:{height:18,fontSize:10,fontWeight:600,bgcolor:(xe=a.background)===null||xe===void 0?void 0:xe.tertiary,color:(Je=a.text)===null||Je===void 0?void 0:Je.secondary,border:`1px solid ${(lo=a.border)===null||lo===void 0?void 0:lo.primary}`,"& .MuiChip-label":{px:.75}}}):null,Oe?(0,e.jsx)(v.A,{variant:"caption",sx:{color:(no=a.text)===null||no===void 0?void 0:no.secondary,fontSize:11,whiteSpace:"nowrap"},children:Oe}):null]})]})]},oe.id)}),N>0?(0,e.jsx)(v.A,{sx:{fontSize:11,color:(n=a.text)===null||n===void 0?void 0:n.tertiary,pl:D?4.5:0},children:p("forms.responses.table.moreProducts",{count:N})}):null]})}const $t=2;function Rt(t){var n,s,l;let{file:a,colors:c}=t;const[x,p]=(0,i.useState)(!1),f=String(a?.name||a?.url||""),g=!x&&(Ve(f)||String(a?.type||"").toLowerCase().startsWith("image/"));return(0,e.jsx)(d.A,{sx:{width:32,height:32,flexShrink:0,borderRadius:1,overflow:"hidden",bgcolor:(n=c.background)===null||n===void 0?void 0:n.tertiary,border:`1px solid ${(s=c.border)===null||s===void 0?void 0:s.primary}`,display:"flex",alignItems:"center",justifyContent:"center"},children:g?(0,e.jsx)(d.A,{component:"img",src:a.url,alt:"",loading:"lazy",onError:()=>p(!0),sx:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):f?(0,e.jsx)(d.A,{component:"img",src:Re(f),alt:"",sx:{width:20,height:20,objectFit:"contain"}}):(0,e.jsx)(ee.g6N,{size:18,color:(l=c.text)===null||l===void 0?void 0:l.secondary})})}function Jo(t){var n;let{value:s,colors:l,onFileClick:a}=t;const{t:c}=(0,me.Bd)(),x=(Array.isArray(s)?s:[s]).filter(g=>g&&typeof g=="object"&&(g.url||g.name));if(x.length===0)return null;const p=x.slice(0,$t),f=x.length-p.length;return(0,e.jsxs)(d.A,{sx:{display:"flex",flexDirection:"column",gap:.5,minWidth:0,maxWidth:280},children:[p.map((g,D)=>{var W,w;const k=String(g.name||g.url||c("forms.responses.fileFallbackName"));return(0,e.jsxs)(d.A,{component:a?"button":"div",...a?{type:"button"}:{},onClick:N=>{N.stopPropagation(),a?.(g)},title:k,sx:{appearance:"none",width:"100%",p:0,m:0,border:0,bgcolor:"transparent",color:"inherit",font:"inherit",textAlign:"left",display:"flex",alignItems:"center",gap:.75,minWidth:0,cursor:a?"pointer":"default",borderRadius:1,"&:focus-visible":{outline:`2px solid ${l.primary}`,outlineOffset:2}},children:[(0,e.jsx)(Rt,{file:g,colors:l}),(0,e.jsxs)(d.A,{sx:{flex:1,minWidth:0},children:[(0,e.jsx)(v.A,{sx:{fontSize:13,fontWeight:500,color:(W=l.text)===null||W===void 0?void 0:W.primary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.3},children:k}),g.size?(0,e.jsxs)(v.A,{sx:{color:(w=l.text)===null||w===void 0?void 0:w.secondary,fontSize:10.5,lineHeight:1.25},children:[(g.size/1024/1024).toFixed(2)," MB"]}):null]})]},`${g.url||k}-${D}`)}),f>0?(0,e.jsx)(v.A,{sx:{fontSize:11,color:(n=l.text)===null||n===void 0?void 0:n.tertiary,pl:4.75},children:c("forms.responses.table.moreAttachments",{count:f})}):null]})}var Ot=r(6670),Lo=r(684),Zr=r(43377),qr=r(85813);function en(t,n){return t==null||t===""||!n?"":`${typeof window<"u"?window.location.origin:""}/forms/responses/${encodeURIComponent(String(t))}?submission=${encodeURIComponent(String(n))}`}function xr(t){const n=t?.form_structure,s=t?.response_json;
1if(!Array.isArray(n)||!s||typeof s!="object")return"";const l=["email","phone","text","textarea"];for(const a of l)for(const c of n){if(!c||c.type!==a)continue;const x=(0,I.$B)(s,c,n),p=x==null||x===""?"":String(x).trim();if(p)return p.length>80?`${p.slice(0,80)}\u2026`:p}for(const a of n){if(!a)continue;const c=(0,I.$B)(s,a,n),x=Ao(a,c,()=>"");if(x)return x}return""}function on(t){let{formName:n,submittedAt:s,contactLabel:l,formatDate:a,t:c,response:x}=t;const p=n&&String(n).trim()||c("forms.responses.share.defaultFormName"),f=s&&a?a(s):"",g=x?xr(x):"";return l&&f?`${p} \u2014 ${l} (${f})`:l?`${p} \u2014 ${l}`:g&&f?`${p} \u2014 ${g} (${f})`:f?`${p} \u2014 ${f}`:g?`${p} \u2014 ${g}`:p}function tn(t){let{submittedAt:n,contactLabel:s,formatDate:l,response:a}=t;const c=a?xr(a):"",x=n&&l?l(n):"";return s&&c&&s!==c?`${s} \xB7 ${c}`:s||c||x||null}const rn="submitted",nn="desc";function Wn(t,n){return t===rn&&n===nn}function pr(t,n,s){if(!(t!=null&&t.submitted_by_account_id))return"";const l=n?.get(String(t.submitted_by_account_id));return l?s(l.first_name,l.last_name,l.email).trim().toLowerCase():""}function vr(t,n){if(!(t!=null&&t.contact_id))return"";const s=n?.get(String(t.contact_id));return(s?.label||"").trim().toLowerCase()}function hr(t,n,s,l,a,c){var x;const p=s.find(D=>D.columnId===n);if(!p)return"";const f=Ke(t,p.field,l),g=qe(t,p.field,l);return((x=p.field)===null||x===void 0?void 0:x.type)==="productSelection"?So(g,f,c,a).toLowerCase():Ao(f,g,a,c).toLowerCase()}function yt(t,n,s){const l=!t,a=!n;return l&&a?0:l?1:a?-1:t.localeCompare(n,void 0,{sensitivity:"base",numeric:!0})*s}function sn(t,n,s,l,a){const c=l==="asc"?1:-1,{contactById:x,tableFieldColumns:p,formStructure:f,t:g,productEnrichmentById:D}=a;if(s==="submitted"){const k=t!=null&&t.submitted_at?new Date(t.submitted_at).getTime():0,N=n!=null&&n.submitted_at?new Date(n.submitted_at).getTime():0;return Number.isNaN(k)&&Number.isNaN(N)?0:Number.isNaN(k)?1:Number.isNaN(N)?-1:(k-N)*c}if(s==="paid"){const k=Number(t?.payment_amount_minor),N=Number(n?.payment_amount_minor),Le=Number.isFinite(k)&&k>=1,oe=Number.isFinite(N)&&N>=1;return!Le&&!oe?0:Le?oe?k!==N?(k-N)*c:yt(String(t?.payment_currency||"").toLowerCase(),String(n?.payment_currency||"").toLowerCase(),c):-1:1}if(s==="contact")return yt(vr(t,x),vr(n,x),c);
1if(s==="submitter"){const{submitterById:k,teamMemberDisplayName:N}=a;return yt(pr(t,k,N),pr(n,k,N),c)}const W=hr(t,s,p,f,g,D),w=hr(n,s,p,f,g,D);return yt(W,w,c)}function ln(t,n,s,l){return!Array.isArray(t)||t.length<=1?t||[]:[...t].sort((a,c)=>sn(a,c,n,s,l))}function an(t,n,s,l){return s.get(t)||l("forms.responses.sort.unknownColumn")}function dn(t,n,s){return s(t==="submitted"?n==="asc"?"forms.responses.sort.semantics.dateAsc":"forms.responses.sort.semantics.dateDesc":t==="paid"?n==="asc"?"forms.responses.sort.semantics.amountAsc":"forms.responses.sort.semantics.amountDesc":n==="asc"?"forms.responses.sort.semantics.textAsc":"forms.responses.sort.semantics.textDesc")}var cn=r(52886);function un(t){if(!t)return"?";const n=[t.first_name,t.last_name].filter(Boolean);return n.length>=2?`${n[0][0]||""}${n[1][0]||""}`.toUpperCase().slice(0,2):n.length===1?String(n[0]).slice(0,2).toUpperCase():t.email?String(t.email)[0].toUpperCase():"?"}const gr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,yr=100;function mn(t){const n=new Set;if(!Array.isArray(t))return n;for(const s of t){const l=s.form_structure,a=s.response_json;if(!(!Array.isArray(l)||!a||typeof a!="object"))for(const c of l){if(c?.type!=="productSelection")continue;const x=a[c.id],p=Array.isArray(x)?x:x!=null&&x!==""?[x]:[];for(const f of p){if(f&&typeof f=="object"&&!Array.isArray(f)&&f.id!=null){const D=String(f.id).trim();gr.test(D)&&n.add(D);continue}const g=f==null?"":String(f).trim();gr.test(g)&&n.add(g)}}}return n}function fn(){var t,n,s,l,a,c,x,p,f,g,D,W,w,k,N,Le,oe,Ne,Be,to,xe,Je,lo,no,xo,Oe,Xe,ro,Go,ze,Bo,zo,te,po,Uo,Fo,Ko,No,Ho,Vo,Xo,Zo,qo,lt,wt,kt,Tt,It,Wt;const{formId:at}=(0,de.g)(),br=(0,de.Zp)(),[Lt,_r]=(0,de.ok)(),{t:h}=(0,me.Bd)(),{canDelete:ao}=(0,Lo.Sk)(),{showToast:bt}=(0,Zr.d)(),et=(0,We.e)(),pe=(0,ye.rn)(),m=(0,Ue.jM)(et?"dark":"light",pe),[b,xn]=(0,i.useState)(null),[ke,Ar]=(0,i.useState)([]),[Mo,Cr]=(0,i.useState)(!0),[jr,_t]=(0,i.useState)(null),[$o,Bt]=(0,i.useState)(null),[Er,At]=(0,i.useState)(!1),[ot,pn]=(0,i.useState)(""),[dt,Sr]=(0,i.useState)(null),[vn,Dr]=(0,i.useState)(!1),[Pr,Mr]=(0,i.useState)(null),[tt,$r]=(0,i.useState)(null),[Rr,Or]=(0,i.useState)(null),[co,zt]=(0,i.useState)("all"),[Ct,Ut]=(0,i.useState)([]),[Ft,wr]=(0,i.useState)(!1),[Ro,Kt]=(0,i.useState)({}),[Nt,Ht]=(0,i.useState)([]),[hn,kr]=(0,i.useState)(!1),[je,Vt]=(0,i.useState)(null),[Tr,Xt]=(0,i.useState)(null),[gn,Qt]=(0,i.useState)(!1),[Ir,Wr]=(0,i.useState)(!1),[yo,Lr]=(0,i.useState)(!1),[Do,Qo]=(0,i.useState)(()=>new Set),[ct,Yt]=(0,i.useState)(!1),[yn,Jt]=(0,i.useState)(!1),[Gt,Br]=(0,i.useState)(!1),rt=(0,i.useRef)(null),jt=(0,i.useRef)(!1),ut=(0,i.useCallback)((o,u,C)=>`${o||""} ${u||""}`.trim()||C||"",[]),Zt=(0,i.useCallback)(o=>{const u=o?.first_name,C=o?.last_name;if(u&&C)return`${u[0]||""}${C[0]||""}`.toUpperCase().slice(0,2);if(u)return String(u).slice(0,2).toUpperCase();const _=o?.email;return _?String(_).slice(0,2).toUpperCase():"?"},[]),qt=(0,i.useCallback)(async()=>{try{const o=U.A.get("sb-workspace")?JSON.parse(U.A.get("sb-workspace")):null;if(!(o!=null&&o.id))return;kr(!0);const{data:u,error:C}=await y.ND.rpc("get_workspace_members_by_status",{workspace_id_param:o.id,status_param:"active"});if(C){console.error("Error fetching team members for form response share:",C),Ht([]);return}Ht((u||[]).map(_=>({id:_.account_id,name:ut(_.first_name,_.last_name,_.email),email:_.email,role:_.role,status:"Active",avatar:Zt(_),pictureUrl:_.picture_url||null,joined_at:_.joined_at})))}catch(o){console.error("Error loading team members for form response share:",o),Ht([])}finally{kr(!1)}},[ut,Zt]);(0,i.useEffect)(()=>{(async()=>{try{Cr(!0),_t(null),zt("all"),Ut([]);const{data:u,error:C}=await y.ND.from("forms").select("*").eq("id",at).single();if(C){console.error("Error fetching form:",C),_t(C.message);return}xn(u);const{data:_,error:z}=await y.ND.from("form_submissions").select("*").eq("form_id",at).order("submitted_at",{ascending:!1});if(z){console.error("Error fetching responses:",z),_t(z.message);return}const F=_||[];Ar(F);const L=new Set;F.forEach(Ge=>{Ge.contact_id&&L.add(Ge.contact_id)});const{data:we,error:Te}=await y.ND.from("form_submit_access_tokens").select("contact_id").eq("form_id",at).is("revoked_at",null);if(!Te&&we!==null&&we!==void 0&&we.length&&we.forEach(Ge=>{Ge.contact_id&&L.add(Ge.contact_id)}),L.size===0){Ut([]);return}const He=[...L],{data:vo,error:jo}=await y.ND.from("contacts").select("id, first_name, last_name, email, avatar_url").in("id",He);jo&&console.warn("Could not load contact names for form filter:",jo);const vt=new Map((vo||[]).map(Ge=>[String(Ge.id),Ge])),ht=He.map(Ge=>{const Eo=String(Ge),ho=vt.get(Eo),To=ho!=null?`${ho.first_name||""} ${ho.last_name||""}`.trim()||ho.email||Eo:`${Eo.slice(0,8)}\u2026`;return{id:Eo,label:To,avatar_url:ho?.avatar_url||null,initials:un(ho)}}).sort((Ge,Eo)=>Ge.label.localeCompare(Eo.label,void 0,{sensitivity:"base"}));Ut(ht)}catch(u){console.error("Error:",u),_t(u.message)}finally{Cr(!1)}})()},[at]),(0,i.useEffect)(()=>{ke.some(o=>o.submitted_by_account_id)&&qt()},[ke,qt]),(0,i.useEffect)(()=>{const o=b?.workspace_id;if(!o||!ke.length){Kt({});return}const u=mn(ke);if(u.size===0){Kt({});return}let C=!1;return(async()=>{const{data:_,error:z}=await y.ND.from("products").select("id,name,description,sku,price,currency,image_url,settings_json").eq("workspace_id",o).in("id",[...u]);if(C||z)return;const F={};for(const L of _||[]){const we=(0,E.$v)(L);we&&(F[we.id]=we)}Kt(F)})(),()=>{C=!0}},[b?.workspace_id,ke]);const zr=o=>{Bt(o),At(!0)},Ur=(0,i.useCallback)(async o=>{if(!(o!=null&&o.length)||!ao("forms")||!(b!=null&&b.id))return!1;const u=[...new Set(o.map(_=>String(_)))];for(let _=0;_<u.length;_+=yr){const z=u.slice(_,_+yr),{error:F}=await y.ND.from("form_submissions").delete().in("id",z).eq("form_id",b.id);if(F)throw F}const C=new Set(u);return Ar(_=>_.filter(z=>
1!C.has(String(z.id)))),$o&&C.has(String($o.id))&&(Bt(null),At(!1)),Qo(_=>{const z=new Set(_);return u.forEach(F=>z.delete(F)),z}),!0},[ao,b?.id,$o]),Fr=(o,u)=>{var C;u==null||(C=u.stopPropagation)===null||C===void 0||C.call(u),ao("forms")&&(Xt(o),Qt(!0))},bn=async()=>{if(!(!Tr||!ao("forms")||!b))try{if(Wr(!0),!await Ur([Tr.id]))return;bt(h("forms.responses.delete.success"),"success"),Qt(!1),Xt(null)}catch(o){console.error("Error deleting form response:",o),bt(h("forms.responses.delete.error"),"error")}finally{Wr(!1)}},_n=()=>{!ao("forms")||Do.size===0||Jt(!0)},An=async()=>{if(!ao("forms")||Do.size===0||!b)return;const o=Array.from(Do);try{if(Br(!0),!await Ur(o))return;bt(h("forms.responses.batchDelete.success",{count:o.length}),"success"),Jt(!1),Qo(new Set),Yt(!1),Lr(!1)}catch(u){console.error("Error bulk deleting form responses:",u),bt(h("forms.responses.batchDelete.error"),"error")}finally{Br(!1)}},Cn=()=>{Lr(o=>(o&&(Qo(new Set),Yt(!1),rt.current=null),!o))};(0,i.useEffect)(()=>{const o=Lt.get("submission");if(!o||Mo||!ke.length)return;const u=ke.find(_=>String(_.id)===String(o));if(!u)return;Bt(u),At(!0);const C=new URLSearchParams(Lt);C.delete("submission"),_r(C,{replace:!0})},[Mo,ke,Lt,_r]);const jn=(o,u)=>{o.stopPropagation(),Mr(o.currentTarget),$r(u)},Et=()=>{Mr(null),$r(null)},En=o=>{Or(o.currentTarget)},er=()=>{Or(null)},Yo=o=>new Date(o).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Kr=o=>{o!=null&&o.url&&(Sr({url:o.url,fileName:o.name,title:o.name,description:o.size?`${(o.size/1024/1024).toFixed(2)} MB`:""}),Dr(!0))},Nr=async o=>{if(!(!b||!o||Ft)){wr(!0);try{const u=b.settings_json||{};await(0,qr.U)({formName:b.name,formDescription:b.description||"",pdfDesign:u.pdfDesign||{},formPrimaryColor:u.primaryColor||"#0084ff",response:o})}catch(u){console.error("PDF export failed:",u),window.alert(h("forms.responses.download.pdfError"))}finally{wr(!1)}}},Sn=o=>{const u=JSON.stringify(o,null,2),C=new Blob([u],{type:"application/json"}),_=URL.createObjectURL(C),z=document.createElement("a");z.href=_,z.download=`response-${o.id.substring(0,8)}.json`,document.body.appendChild(z),z.click(),document.body.removeChild(z),URL.revokeObjectURL(_)},Dn=o=>{var u;const C=`<?xml version="1.0" encoding="UTF-8"?> 2<response> 3 <id>${o.id}</id> 4 <form_id>${o.form_id}</form_id> 5 <submitted_at>${o.submitted_at}</submitted_at> 6 ${(0,ne.f)(o)?`<payment_amount_minor>${o.payment_amount_minor}</payment_amount_minor> 7 <payment_currency>${o.payment_currency}</payment_currency>`:""} 8 <created_at>${o.created_at}</created_at> 9 <updated_at>${o.updated_at}</updated_at> 10 <form_structure> 11 ${((u=o.form_structure)===null||u===void 0?void 0:u.map(L=>` 12 <field> 13 <id>${L.id}</id> 14 <type>${L.type}</type> 15 <label>${L.label}</label> 16 <required>${L.required}</required> 17 ${L.options?`<options>${L.options.map(we=>`<option>${we}</option>`).join("")}</options>`:""} 18 </field>`).join(""))||""} 19 </form_structure> 20 <response_data> 21 ${Object.entries(o.response_json||{}).map(L=>{let[we,Te]=L;return` 22 <field id="${we}"> 23 <value>${Array.isArray(Te)?Te.map(He=>typeof He=="object"?JSON.stringify(He):He).join(","):Te}</value> 24 </field>`}).join("")} 25 </response_data> 26</response>`,_=new Blob([C],{type:"application/xml"}),z=URL.createObjectURL(_),F=document.createElement("a");F.href=z,F.download=`response-${o.id.substring(0,8)}.xml`,document.body.appendChild(F),F.click(),document.body.removeChild(F),URL.revokeObjectURL(z)},Pn=o=>{const u=o??ke,C={form:{id:b.id,name:b.name,description:b.description,status:b.status,created_at:b.created_at},responses:u,export_info:{exported_at:new Date().toISOString(),total_responses:u.length,form_id:b.id,contact_filter:co==="all"?null:co}},_=JSON.stringify(C,null,2),z=new Blob([_],{type:"application/json"}),F=URL.createObjectURL(z),L=document.createElement("a");L.href=F,L.download=`${b.name.replace(/[^a-zA-Z0-9]/g,"-")}-all-responses.json`,document.body.appendChild(L),L.click(),document.body.removeChild(L),URL.revokeObjectURL(F)},Mn=o=>{const u=o??ke,C=`<?xml version="1.0" encoding="UTF-8"?> 27<form_responses> 28 <form_info> 29 <id>${b.id}</id> 30 <name>${b.name}</name> 31 <description>${b.description}</description> 32 <status>${b.status}</status> 33 <created_at>${b.created_at}</created_at> 34 </form_info> 35 <export_info> 36 <exported_at>${new Date().toISOString()}</exported_at> 37 <total_responses>${u.length}</total_responses> 38 <form_id>${b.id}</form_id> 39 ${co!=="all"?`<contact_filter>${co}</contact_filter>`:""} 40 </export_info> 41 <responses> 42 ${u.map(L=>{var we;return` 43 <response> 44 <id>${L.id}</id> 45 <form_id>${L.form_id}</form_id> 46 <submitted_at>${L.submitted_at}</submitted_at> 47 ${(0,ne.f)(L)?`<payment_amount_minor>${L.payment_amount_minor}</payment_amount_minor> 48 <payment_currency>${L.payment_currency}</payment_currency>`:""} 49 <created_at>${L.created_at}</created_at> 50 <updated_at>${L.updated_at}</updated_at> 51 <form_structure> 52 ${((we=L.form_structure)===null||we===void 0?void 0:we.map(Te=>` 53 <field> 54 <id>${Te.id}</id> 55 <type>${Te.type}</type> 56 <label>${Te.label}</label> 57 <required>${Te.required}</required> 58 ${Te.options?`<options>${Te.options.map(He=>`<option>${He}</option>`).join("")}</options>`:""} 59 </field>`).join(""))||""} 60 </form_structure> 61 <response_data> 62 ${Object.entries(L.response_json||{}).map(Te=>{let[He,vo]=Te;return` 63 <field id="${He}"> 64 <value>${Array.isArray(vo)?vo.map(jo=>typeof jo=="object"?JSON.stringify(jo):jo).join(","):vo}</value> 65 </field>`}).join("")} 66 </response_data> 67 </response>`}).join("")} 68 </responses> 69</form_responses>`,_=new Blob([C],{type:"application/xml"}),z=URL.createObjectURL(_),F=document.createElement("a");F.href=z,F.download=`${b.name.replace(/[^a-zA-Z0-9]/g,"-")}-all-responses.xml`,document.body.appendChild(F),F.click(),document.body.removeChild(F),URL.revokeObjectURL(z)},mt=(0,i.useMemo)(()=>{const o=new Map;return Ct.forEach(u=>o.set(String(u.id),u)),o},[Ct]),or=(0,i.useMemo)(()=>{const o=new Map;return Nt.forEach(u=>{u!=null&&u.id&&o.set(String(u.id),u)}),o},[Nt]),bo=(0,i.useMemo)(()=>Ae(b?.fields_json,ke),[b?.fields_json,ke]),Hr=(0,i.useMemo)(()=>Ye(bo),[bo]),Oo=(0,i.useMemo)(()=>Ce(bo,Hr),[bo,Hr]),ft=(0,i.useMemo)(()=>(0,E.vM)(b?.fields_json)||ke.some(o=>(0,ne.f)(o)),[b?.fields_json,ke]),xt=(0,i.useMemo)(()=>ke.some(o=>o.contact_id!=null),[ke]),pt=(0,i.useMemo)(()=>ke.some(o=>o.submitted_by_account_id!=null)||(0,cn.cv)(b?.settings_json),[ke,b?.settings_json]),wo=(0,i.useMemo)(()=>{const o=new Map;return o.set("submitted",h("forms.responses.table.submitted")),ft&&o.set("paid",h("forms.responses.table.paid")),xt&&o.set("contact",h("forms.responses.table.contact")),pt&&o.set("submitter",h("forms.responses.table.submittedBy")),Oo.forEach(u=>{let{field:C,columnId:_}=u;o.set(_,C.label||C.name||_)}),o},[ft,xt,pt,Oo,h]),Vr=(0,i.useCallback)(o=>{Vt(u=>u?.columnId===o?{columnId:o,order:u.order==="asc"?"desc":"asc"}:{columnId:o,order:"asc"})},[]),nt=(0,i.useCallback)((o,u)=>{var C;return(0,e.jsxs)(d.A,{component:"button",type:"button",onClick:_=>{_.stopPropagation(),Vr(o)},"aria-label":h("forms.responses.sort.sortByColumnAria",{column:u}),sx:{display:"inline-flex",alignItems:"center",gap:.5,border:"none",background:"none",padding:0,margin:0,cursor:"pointer",color:"inherit",font:"inherit",fontWeight:je?.columnId===o?700:600,textTransform:"inherit",letterSpacing:"inherit","&:hover":{color:m.primary}},children:[(0,e.jsx)("span",{children:u}),je?.columnId===o?je.order==="asc"?(0,e.jsx)(P.gE3,{size:14,color:m.primary,"aria-hidden":!0}):(0,e.jsx)(P.eqt,{size:14,color:m.primary,"aria-hidden":!0}):(0,e.jsx)(P.hDL,{size:14,color:(C=m.text)===null||C===void 0?void 0:C.tertiary,"aria-hidden":!0})]})},[m.primary,(t=m.text)===null||t===void 0?void 0:t.tertiary,Vr,je,h]),tr=(0,i.useMemo)(()=>{const o=[{id:"submitted",label:nt("submitted",wo.get("submitted")),minWidth:"150px",
69width:"170px"}];return ft&&o.push({id:"paid",label:nt("paid",wo.get("paid")),minWidth:"110px",width:"130px"}),xt&&o.push({id:"contact",label:nt("contact",wo.get("contact")),minWidth:"140px",width:"160px"}),pt&&o.push({id:"submitter",label:nt("submitter",wo.get("submitter")),minWidth:"140px",width:"180px"}),Oo.forEach(u=>{let{field:C,columnId:_}=u;o.push({id:_,label:nt(_,wo.get(_)),minWidth:"120px",flex:Oo.length<=4})}),o},[ft,xt,pt,Oo,wo,nt]),$n=(0,i.useMemo)(()=>je?an(je.columnId,je.order,wo,h):"",[je,wo,h]),Rn=(0,i.useMemo)(()=>je?dn(je.columnId,je.order,h):"",[je,h]),St=(0,i.useMemo)(()=>[{value:"all",label:h("forms.responses.contactFilter.all"),avatar_url:null,initials:null},...Ct.map(o=>({value:String(o.id),label:h("forms.responses.contactFilter.byContact",{name:o.label}),avatar_url:o.avatar_url||null,initials:o.initials||"?"}))],[Ct,h]),rr=St.length>1,On=(0,i.useMemo)(()=>o=>o.value==="all"?P.zWC:function(C){var _;let{size:z=16}=C;const F=typeof z=="number"?z:16;return(0,e.jsx)($.A,{alt:"",src:o.avatar_url||void 0,sx:{width:F,height:F,fontSize:Math.max(9,F*.36),bgcolor:`${pe}22`,color:pe,border:`1px solid ${(_=m.border)===null||_===void 0?void 0:_.primary}`},children:o.initials||"?"})},[pe,(n=m.border)===null||n===void 0?void 0:n.primary]);(0,i.useEffect)(()=>{co!=="all"&&(St.some(o=>o.value===co)||zt("all"))},[St,co]);const so=(0,i.useMemo)(()=>{if(co==="all")return ke;const o=String(co);return ke.filter(u=>u.contact_id!=null&&String(u.contact_id)===o)},[ke,co]),nr=(0,i.useMemo)(()=>ot?so.filter(o=>Z(o,ot,mt,Yo,h,Ro,bo)):so,[so,ot,mt,Yo,h,Ro,bo]),ko=(0,i.useMemo)(()=>je?ln(nr,je.columnId,je.order,{contactById:mt,submitterById:or,teamMemberDis
69playName:ut,tableFieldColumns:Oo,formStructure:bo,t:h,productEnrichmentById:Ro}):nr,[nr,je,mt,or,ut,Oo,bo,h,Ro]),Co=(0,i.useMemo)(()=>ko.map(o=>String(o.id)),[ko]),Dt=(0,i.useMemo)(()=>{let o=0;for(const u of Co)Do.has(u)&&(o+=1);return o},[Co,Do]);(0,i.useEffect)(()=>{Qo(o=>{if(o.size===0)return o;const u=new Set(Co);let C=!1;const _=new Set;for(const z of o)u.has(z)?_.add(z):C=!0;return C?_:o})},[Co]),(0,i.useEffect)(()=>{Yt(Co.length>0&&Dt===Co.length)},[Co,Dt]);const Xr=(0,i.useCallback)((o,u,C)=>{const _=String(o),z=jt.current;if(jt.current=!1,z&&rt.current!==null&&ko.length>0){const F=Math.min(rt.current,C),L=Math.max(rt.current,C);Qo(we=>{const Te=new Set(we);for(let He=F;He<=L;He+=1){const vo=ko[He];vo&&Te.add(String(vo.id))}return Te}),rt.current=C;return}Qo(F=>{const L=new Set(F);return u?L.add(_):L.delete(_),L}),rt.current=C},[ko]),Qr=(0,i.useCallback)(()=>{Qo(o=>{const u=new Set(o);return ct?Co.forEach(C=>u.delete(C)):Co.forEach(C=>u.add(C)),u})},[ct,Co]),wn=(0,i.useMemo)(()=>!yo||!ao("forms")?tr:[{id:"__select",label:(0,e.jsx)(ie.A,{checked:ct,indeterminate:Dt>0&&!ct,onChange:Qr,compact:!0,primaryColor:pe}),width:"48px",minWidth:"48px"},...tr],[yo,ao,tr,Qr,pe,ct,Dt]),Yr=(0,i.useMemo)(()=>{var o;return{bgcolor:(o=m.background)===null||o===void 0?void 0:o.secondary,borderRadius:3,boxShadow:et?"0 2px 8px rgba(0, 0, 0, 0.2)":"0 2px 8px rgba(0, 0, 0, 0.05)",border:"none",p:0,height:"100%",mt:2}},[m,et]);if(Mo){var sr,ir;return(0,e.jsx)(d.A,{sx:{p:4,display:"flex",justifyContent:"center",alignItems:"center",minHeight:"50vh",bgcolor:(sr=m.background)===null||sr===void 0?void 0:sr.primary},children:(0,e.jsx)(v.A,{sx:{color:(ir=m.text)===null||ir===void 0?void 0:ir.primary},children:h("forms.responses.loading")})})}if(!b){var lr,ar;return(0,e.jsx)(d.A,{sx:{p:4,bgcolor:(lr=m.background)===null||lr===void 0?void 0:lr.primary},children:(0,e.jsx)(v.A,{sx:{color:(ar=m.text)===null||ar===void 0?void 0:ar.primary},children:h("forms.responses.formNotFound")})})}return(0,e.jsxs)(d.A,{sx:{p:{xs:1,md:2},color:(s=m.text)===null||s===void 0?void 0:s.primary,minHeight:"100vh",bgcolor:(l=m.background)===null||l===void 0?void 0:l.primary},children:[!Mo&&!jr&&b&&(0,e.jsxs)(d.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:3,mt:2,flexWrap:{xs:"wrap",md:"nowrap"}},children:[(0,e.jsxs)(d.A,{children:[(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1,mb:2,fontSize:"14px"},children:[(0,e.jsxs)(q.A,{component:"button",onClick:()=>br("/forms"),sx:{color:(a=m.text)===null||a===void 0?void 0:a.tertiary,textDecoration:"none",fontWeight:500,fontSize:"14px",display:"flex",alignItems:"center",gap:.5,transition:"color 0.2s ease",textTransform:"none",minWidth:"auto",p:0,"&:hover":{color:m.primary,bgcolor:"transparent"}},children:[(0,e.jsx)(P.vEG,{size:14}),h("sidebar.menuItems.forms")]}),(0,e.jsx)(v.A,{sx:{color:(c=m.text)===null||c===void 0?void 0:c.tertiary,fontWeight:500},children:"/"}),(0,e.jsx)(v.A,{sx:{color:(x=m.text)===null||x===void 0?void 0:x.primary,fontSize:"14px",fontWeight:600},children:b.name})]}),(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:2,mb:1},children:[(0,e.jsx)(d.A,{sx:{p:1,borderRadius:2,bgcolor:(p=m.background)===null||p===void 0?void 0:p.primary,color:m.primary},children:(0,e.jsx)(P.vEG,{size:24})}),(0,e.jsxs)(d.A,{children:[(0,e.jsx)(v.A,{variant:"h4",sx:{fontWeight:700,color:(f=m.text)===null||f===void 0?void 0:f.primary,letterSpacing:-1,mb:.5},children:b.name}),(0,e.jsx)(v.A,{sx:{color:(g=m.text)===null||g===void 0?void 0:g.secondary,mb:0},children:b.description})]})]})]}),(0,e.jsxs)(d.A,{sx:{display:"flex",gap:1,mt:{xs:2,md:0}},children:[(0,e.jsx)(T.A,{variant:"outlined",startIcon:(0,e.jsx)(P.f5X,{size:16}),onClick:En,disabled:so.length===0,sx:{borderRadius:2},children:h("forms.responses.exportAll")}),(0,e.jsx)(T.A,{variant:"outlined",startIcon:(0,e.jsx)(P.nkM,{size:16}),onClick:()=>br("/forms"),sx:{borderRadius:2},children:h("common.back")})]})]}),!Mo&&!jr&&b&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(d.A,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, 1fr)",md:"repeat(3, 1fr)"},gap:2,mb:3},children:[(0,e.jsx)(re.A,{variant:"small",label:h("forms.responses.metrics.totalResponses"),value:so.length.toLocaleStr
69ing(),progressPercentage:70,progressColor:m.primary,isLoading:Mo}),(0,e.jsx)(re.A,{variant:"small",label:h("forms.responses.metrics.status"),value:b.status,progressPercentage:100,progressColor:b.status==="Active"?(D=m.status)===null||D===void 0?void 0:D.success:(W=m.text)===null||W===void 0?void 0:W.tertiary,isLoading:Mo}),(0,e.jsx)(re.A,{variant:"small",label:h("forms.responses.metrics.lastResponse"),value:so.length>0?Yo(so[0].submitted_at):h("common.none"),progressPercentage:so.length>0?100:0,progressColor:(w=m.status)===null||w===void 0?void 0:w.info,isLoading:Mo})]}),(0,e.jsx)(H.A,{sx:Yr,children:(0,e.jsx)(X.A,{sx:{p:1.5,"&:last-child":{paddingBottom:1.5}},children:(0,e.jsxs)(d.A,{sx:{display:"flex",gap:2,alignItems:"center",flexWrap:"wrap"},children:[rr?(0,e.jsx)(d.A,{sx:{width:{xs:"100%",sm:280},flexShrink:0},children:(0,e.jsx)(S.A,{label:!1,value:co,onChange:o=>zt(String(o.target.value)),options:St,placeholder:h("forms.responses.contactFilter.all"),fullWidth:!0,mb:0,size:"small",getOptionValue:o=>String(o.value),getOptionIcon:On})}):null,(0,e.jsx)(d.A,{sx:{flex:1,minWidth:rr?200:0,width:rr?void 0:"100%"},children:(0,e.jsx)(Ee.A,{placeholder:h("forms.responses.search.placeholder"),value:ot,onChange:o=>pn(o.target.value),size:"small",sx:{"& .MuiOutlinedInput-root":{minHeight:40,height:40,boxSizing:"border-box"},"& .MuiOutlinedInput-root input":{py:0,height:"100%",boxSizing:"border-box"}}})}),ao("forms")&&ko.length>0&&(0,e.jsx)(q.A,{variant:yo?"contained":"outlined",size:"small",startIcon:(0,e.jsx)(P.SE8,{size:16}),onClick:Cn,sx:{borderRadius:2,textTransform:"none",fontWeight:600,flexShrink:0,...yo?{bgcolor:pe,color:"#fff","&:hover":{bgcolor:pe,opacity:.92}}:{color:(k=m.text)===null||k===void 0?void 0:k.primary,borderColor:(N=m.border)===null||N===void 0?void 0:N.primary,"&:hover":{borderColor:pe,bgcolor:`${pe}12`}}},children:h(yo?"forms.responses.bulkActions.exitSelection":"forms.responses.bulkActions.selectResponses")})]})})}),je?(0,e.jsxs)(j.A,{severity:"info",icon:(0,e.jsx)(P.hDL,{size:22,"aria-hidden":!0}),sx:{mt:2,borderRadius:2,bgcolor:(Le=m.background)===null||Le===void 0?void 0:Le.tertiary,color:(oe=m.text)===null||oe===void 0?void 0:oe.primary,border:`1px solid ${((Ne=m.border)===null||Ne===void 0?void 0:Ne.primary)||((Be=m.background)===null||Be===void 0?void 0:Be.secondary)}`,"& .MuiAlert-icon":{color:pe},"& .MuiAlert-message":{display:"flex",flexWrap:"wrap",alignItems:"center",columnGap:1,rowGap:.5,py:.25}},children:[(0,e.jsxs)(d.A,{sx:{display:"flex",flexDirection:"column",gap:.5,alignItems:"flex-start"},children:[(0,e.jsxs)(v.A,{component:"span",variant:"body2",sx:{color:(to=m.text)===null||to===void 0?void 0:to.primary},children:[je.order==="asc"?h("forms.responses.sort.sortedByAscending"):h("forms.responses.sort.sortedByDescending")," ",(0,e.jsx)(v.A,{component:"strong",variant:"body2",sx:{fontWeight:700,color:"inherit"},children:$n}),"."]}),(0,e.jsx)(v.A,{variant:"caption",sx:{color:(xe=m.text)===null||xe===void 0?void 0:xe.tertiary,lineHeight:1.35},children:Rn})]}),(0,e.jsx)(q.A,{color:"inherit",size:"small",startIcon:je.order==="asc"?(0,e.jsx)(P.eqt,{size:16,"aria-hidden":!0}):(0,e.jsx)(P.gE3,{size:16,"aria-hidden":!0}),onClick:()=>Vt(o=>o&&{...o,order:o.order==="asc"?"desc":"asc"}),"aria-label":je.order==="asc"?h("forms.responses.sort.switchToDescendingAria"):h("forms.responses.sort.switchToAscendingAria"),sx:{textTransform:"none",fontWeight:600,color:pe,whiteSpace:"nowrap",flexShrink:0,alignSelf:"center",py:.25,minWidth:"auto"},children:je.order==="asc"?h("forms.responses.sort.order.descending"):h("forms.responses.sort.order.ascending")}),(0,e.jsx)(q.A,{color:"inherit",size:"small",onClick:()=>Vt(null),sx:{textTransform:"none",fontWeight:600,color:pe,whiteSpace:"nowrap",flexShrink:0,alignSelf:"center",py:.25,minWidth:"auto"},children:h("forms.responses.sort.resetSort")})]}):null,yo&&Do.size>0&&(0,e.jsx)(H.A,{sx:{bgcolor:(Je=m.background)===null||Je===void 0?void 0:Je.secondary,borderRadius:2,boxShadow:et?"0 2px 8px rgba(0,0,0,0.2)":"0 2px 8px rgba(0,0,0,0.05)",border:`1px solid ${(lo=m.border)===null||lo===void 0?void 0:lo.primary}`,mt:2},children:(0,e.jsxs)(X.A,{sx:{py:1.5,px:1.5,display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:1.5,"&:last-child":{pb:1.5}},children:[(0,e.jsx)(v.A,{sx:{color:(no=m.text)===null||no===void 0?void 0:no.primary,fontWeight:600,fontSize:14},children:h("forms.responses.bulkActions.selected",{count:Do.size})}),ao("forms")&&(0,e.jsx)(q.A,{variant:"outlined",size:"small",startIcon:(0,e.jsx)(P.TBR,{size:14}),onClick:_n,disabled:Gt,sx:{color:((xo=m.status)===null||xo===void 0?void 0:xo.error)||"#d32f2f",borderColor:((Oe=m.status)===null||Oe===void 0?void 0:Oe.error)||"#d32f2f",borderRadius:1.5,textTransform:"none",fontWeight:600,"&:hover":{bgcolor:`${((Xe=m.status)===null||Xe===void 0?void 0:Xe.error)||"#d32f2f"}14`,borderColor:((ro=m.status)===null||ro===void 0?void 0:ro.error)||"#d32f2f"}},children:h("forms.responses.bulkActions.delete")})]})}),(0,e.jsx)(H.A,{sx:Yr,children:(0,e.jsx)(X.A,{sx:{p:0},children:(0,e.jsx)(Y.Ay,{embedded:!0,stickyHeader:!0,dense:!0,actionsColumn:!0,columns:wn,empty:ko.length===0,emptyState:{illustration:Me.H,title:co!=="all"&&so.length===0?h("forms.responses.emptyState.noResponsesForContact"):h(ot?"forms.responses.emptyState.noResults":"forms.responses.emptyState.noResponses"),subtitle:co!=="all"&&so.length===0?h("forms.responses.emptyState.noResponsesForContactDescription"):h(ot?"forms.responses.emptyState.noResultsDescription":"forms.responses.emptyState.noResponsesDescription"),...(0,Me.uW)(pe)},children:ko.map((o,u)=>{var C,_,z,F,L,we,Te,He,vo,jo,vt,ht,Ge,Eo;const ho=$o?.id===o.id&&Er,To=Do.has(String(o.id)),uo=o.contact_id!=null?mt.get(String(o.contact_id)):null,Io=o.submitted_by_account_id!=null?or.get(String(o.submitted_by_account_id)):null,Jr=Io?ut(Io.first_name,Io.last_name,Io.email):"";return(0,e.jsxs)(ve.A,{selected:ho||To,sx:{cursor:"pointer",userSelect:yo?"none":void 0,WebkitUserSelect:yo?"none":void 0,bgcolor:ho?`${pe}12`:To?`${pe}08`:void 0,"&:hover":{bgcolor:ho?`${pe}16`:To?`${pe}12`:(C=m.background)===null||C===void 0?void 0:C.tertiary},"& td":{borderColor:(_=m.border)===null||_===void 0?void 0:_.primary,color:(z=m.text)===null||z===void 0?void 0:z.primary,py:1.25,px:{xs:.75,sm:1.1},maxWidth:280}},onMouseDown:Qe=>{yo&&(jt.current=Qe.shiftKey)},onClick:()=>
69{if(yo){Xr(o.id,!To,u);return}zr(o)},children:[yo&&ao("forms")&&(0,e.jsx)(M.A,{sx:{width:48,minWidth:48,maxWidth:48,px:.75},onClick:Qe=>Qe.stopPropagation(),children:(0,e.jsx)(ie.A,{checked:To,onChange:()=>Xr(o.id,!To,u),onMouseDown:Qe=>{jt.current=Qe.shiftKey},compact:!0,primaryColor:pe})}),(0,e.jsx)(M.A,{children:(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,e.jsx)(P.VvS,{size:15,color:(F=m.text)===null||F===void 0?void 0:F.secondary}),(0,e.jsx)(v.A,{sx:{color:(L=m.text)===null||L===void 0?void 0:L.primary,fontWeight:500,fontSize:13,whiteSpace:"nowrap"},children:Yo(o.submitted_at)})]})}),ft&&(0,e.jsx)(M.A,{children:(0,e.jsx)(v.A,{sx:{color:(0,ne.f)(o)?(we=m.text)===null||we===void 0?void 0:we.primary:(Te=m.text)===null||Te===void 0?void 0:Te.tertiary,fontWeight:(0,ne.f)(o)?600:500,fontSize:13,whiteSpace:"nowrap"},children:(0,ne.W)(o)||h("forms.responses.table.empty")})}),xt&&(0,e.jsx)(M.A,{children:uo?(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,e.jsx)($.A,{alt:"",src:uo.avatar_url||void 0,sx:{width:24,height:24,fontSize:10,bgcolor:`${pe}22`,color:pe,flexShrink:0},children:uo.initials||"?"}),(0,e.jsx)(v.A,{sx:{fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:uo.label})]}):(0,e.jsx)(v.A,{sx:{color:(He=m.text)===null||He===void 0?void 0:He.tertiary,fontSize:13,fontStyle:"italic"},children:h("forms.responses.table.anonymous")})}),pt&&(0,e.jsx)(M.A,{children:Jr?(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,e.jsx)($.A,{alt:"",src:Io?.avatar_url||void 0,sx:{width:24,height:24,fontSize:10,bgcolor:`${pe}22`,color:pe,flexShrink:0},children:Zt(Io)}),(0,e.jsx)(v.A,{sx:{fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Jr})]}):(0,e.jsx)(v.A,{sx:{color:(vo=m.text)===null||vo===void 0?void 0:vo.tertiary,fontSize:13,fontStyle:"italic"},children:h("forms.responses.table.anonymous")})}),Oo.map(Qe=>{var dr,cr,ur;let{field:st,columnId:kn}=Qe;const mr=Ke(o,st,bo),it=qe(o,st,bo),fr=G(it,mr,Ro),Gr=fr?"":Ao(mr,it,h,Ro),Tn=!fr&&(st.type==="file"||st.type==="image"||st.type==="signature"||Array.isArray(it)&&((dr=it[0])===null||dr===void 0?void 0:dr.url)),In=st.type==="productSelection";return(0,e.jsx)(M.A,{children:fr?(0,e.jsx)(v.A,{sx:{color:(cr=m.text)===null||cr===void 0?void 0:cr.tertiary,fontSize:13},children:h("forms.responses.table.empty")}):In?(0,e.jsx)(Mt,{field:mr,value:it,colors:m,primaryColor:pe,extraSnapshots:Ro}):Tn?(0,e.jsx)(Jo,{value:it,colors:m,onFileClick:Kr}):(0,e.jsx)(d.A,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:(0,e.jsx)(v.A,{sx:{fontSize:13,color:(ur=m.text)===null||ur===void 0?void 0:ur.primary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:Gr,children:Gr})})},`${o.id}-${kn}`)}),(0,e.jsx)(M.A,{align:"right",children:(0,e.jsxs)(d.A,{sx:{display:"flex",gap:.5,justifyContent:"flex-end",alignItems:"center"},children:[(0,e.jsx)(d.A,{onClick:Qe=>Qe.stopPropagation(),onMouseDown:Qe=>Qe.stopPropagation(),sx:{display:"inline-flex",alignItems:"center"},children:(0,e.jsx)(Ot.A,{compact:!0,shareUrl:en(at,o.id),entityLabel:on({formName:b?.name,submittedAt:o.submitted_at,contactLabel:uo?.label,formatDate:Yo,t:h,response:o}),teamMembers:Nt,teamMembersLoading:hn,onEnsureTeamMembers:qt,translationKeyPrefix:"forms.responses",messageTranslationKey:"forms.responses.shareToChatLinkBody",shareEntityKind:"form_response",sharePreview:{entityId:o.id,subtitle:tn({submittedAt:o.submitted_at,contactLabel:uo?.label,formatDate:Yo,response:o}),avatarUrl:uo?.avatar_url||null}})}),(0,e.jsx)(Pe.A,{size:"small",onClick:Qe=>{Qe.stopPropagation(),zr(o)},sx:{color:(jo=m.text)===null||jo===void 0?void 0:jo.secondary,"&:hover":{color:m.primary,bgcolor:`${pe}20`}},children:(0,e.jsx)(P.kU3,{size:16})}),(0,e.jsx)(Pe.A,{size:"small",onClick:Qe=>jn(Qe,o),sx:{color:(vt=m.text)===null||vt===void 0?void 0:vt.secondary,"&:hover":{color:m.primary,bgcolor:`${pe}20`}},children:(0,e.jsx)(P.f5X,{size:16})}),ao("forms")&&(0,e.jsx)(Pe.A,{size:"small","aria-label":h("forms.responses.delete.action"),onClick:Qe=>Fr(o,Qe),sx:{color:(ht=m.text)===null||ht===void 0?void 0:ht.secondary,"&:hover":{color:((Ge=m.status)===null||Ge===void 0?void 0:Ge.error)||"#d32f2f",bgcolor:`${((Eo=m.status)===null||Eo===void 0?void 0:Eo.error)||"#d32f2f"}20`}},children:(0,e.jsx)(P.TBR,{size:16})})]})})]},o.id)})})})})]}),(0,e.jsx)(eo,{open:Er,onClose:()=>At(!1),response:$o,displayStructure:bo,formatDate:Yo,productEnrichmentById:Ro,onFileClick:Kr,onDownloadPdf:Nr,pdfBusy:Ft,canDelete:ao("forms"),onDelete:$o?o=>Fr(o):void 0}),(0,e.jsx)(oo.default,{open:gn,title:h("forms.responses.delete.title"),description:h("forms.responses.delete.description"),onConfirm:bn,onCancel:()=>{Ir||(Qt(!1),Xt(null))},confirmText:h("common.delete"),cancelText:h("common.cancel"),loading:Ir,confirmDestructive:!0}),(0,e.jsx)(oo.default,{open:yn,title:h("forms.responses.batchDelete.title"),description:h("forms.responses.batchDelete.description",{count:Do.size}),onConfirm:An,onCancel:()=>{Gt||Jt(!1)},confirmText:h("common.delete"),cancelText:h("common.cancel"),loading:Gt,confirmDestructive:!0}),dt&&(0,e.jsx)(Wo.A,{isOpen:vn,onClose:()=>{Dr(!1),Sr(null)}
69,url:dt.url,fileName:dt.fileName,title:dt.title,description:dt.description}),(0,e.jsxs)(R.A,{anchorEl:Pr,open:!!Pr,onClose:Et,PaperProps:{sx:{bgcolor:(Go=m.background)===null||Go===void 0?void 0:Go.secondary,border:`1px solid ${(ze=m.border)===null||ze===void 0?void 0:ze.primary}`,borderRadius:2,boxShadow:et?"0 8px 32px rgba(0,0,0,0.4)":"0 8px 32px rgba(0,0,0,0.1)"}},children:[(0,e.jsx)(he.A,{onClick:()=>{tt&&Sn(tt),Et()},sx:{color:(Bo=m.text)===null||Bo===void 0?void 0:Bo.primary,"&:hover":{bgcolor:(zo=m.background)===null||zo===void 0?void 0:zo.tertiary}},children:(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,e.jsx)(P.iUU,{size:16,color:(te=m.text)===null||te===void 0?void 0:te.secondary}),(0,e.jsx)(v.A,{sx:{fontSize:14},children:h("forms.responses.download.json")})]})}),(0,e.jsx)(he.A,{onClick:()=>{tt&&Dn(tt),Et()},sx:{color:(po=m.text)===null||po===void 0?void 0:po.primary,"&:hover":{bgcolor:(Uo=m.background)===null||Uo===void 0?void 0:Uo.tertiary}},children:(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,e.jsx)(P.iUU,{size:16,color:(Fo=m.text)===null||Fo===void 0?void 0:Fo.secondary}),(0,e.jsx)(v.A,{sx:{fontSize:14},children:h("forms.responses.download.xml")})]})}),(0,e.jsx)(he.A,{onClick:async()=>{tt&&await Nr(tt),Et()},disabled:Ft,sx:{color:(Ko=m.text)===null||Ko===void 0?void 0:Ko.primary,"&:hover":{bgcolor:(No=m.background)===null||No===void 0?void 0:No.tertiary}},children:(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,e.jsx)(P.iUU,{size:16,color:(Ho=m.text)===null||Ho===void 0?void 0:Ho.secondary}),(0,e.jsx)(v.A,{sx:{fontSize:14},children:h("forms.responses.download.pdf")})]})})]}),(0,e.jsxs)(R.A,{anchorEl:Rr,open:!!Rr,onClose:er,PaperProps:{sx:{bgcolor:(Vo=m.background)===null||Vo===void 0?void 0:Vo.secondary,border:`1px solid ${(Xo=m.border)===null||Xo===void 0?void 0:Xo.primary}`,borderRadius:2,boxShadow:et?"0 8px 32px rgba(0,0,0,0.4)":"0 8px 32px rgba(0,0,0,0.1)"}},children:[(0,e.jsx)(he.A,{onClick:()=>{Pn(so),er()},sx:{color:(Zo=m.text)===null||Zo===void 0?void 0:Zo.primary,"&:hover":{bgcolor:(qo=m.background)===null||qo===void 0?void 0:qo.tertiary}},children:(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,e.jsx)(P.iUU,{size:16,color:(lt=m.text)===null||lt===void 0?void 0:lt.secondary}),(0,e.jsxs)(d.A,{children:[(0,e.jsx)(v.A,{sx:{fontSize:14,fontWeight:500},children:h("forms.responses.download.allJson")}),(0,e.jsx)(v.A,{sx:{fontSize:12,color:(wt=m.text)===null||wt===void 0?void 0:wt.secondary},children:h("forms.responses.download.responseCount",{count:so.length})})]})]})}),(0,e.jsx)(he.A,{onClick:()=>{Mn(so),er()},sx:{color:(kt=m.text)===null||kt===void 0?void 0:kt.primary,"&:hover":{bgcolor:(Tt=m.background)===null||Tt===void 0?void 0:Tt.tertiary}},children:(0,e.jsxs)(d.A,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,e.jsx)(P.iUU,{size:16,color:(It=m.text)===null||It===void 0?void 0:It.secondary}),(0,e.jsxs)(d.A,{children:[(0,e.jsx)(v.A,{sx:{fontSize:14,fontWeight:500},children:h("forms.responses.download.allXml")}),(0,e.jsx)(v.A,{sx:{fontSize:12,color:(Wt=m.text)===null||Wt===void 0?void 0:Wt.secondary},children:h("forms.responses.download.responseCount",{count:so.length})})]})]})})]})]})}},52886(_o,De,r){r.d(De,{CP:()=>i,M6:()=>X,QX:()=>$,cv:()=>v,k6:()=>U});const i="public",U="team",d=new Set([i,U]);function $(j){const ve=j?.audience;return typeof ve=="string"&&d.has(ve)?ve:i}function v(j){return $(j)===U}function q(j){return $(j)===i}function H(j){return!j||typeof j!="object"?{}:j.settings_json&&typeof j.settings_json=="object"?j.settings_json:j.settings&&typeof j.settings=="object"?j.settings:typeof j.audience=="string"?{audience:j.audience}:{}}function X(j){return v(H(j))}},446(_o,De,r){r.d(De,{S:()=>U});var i=r(67763);const U=async d=>{let{accountId:$,accountIds:v,workspaceId:q,notification:H}=d;try{if(!H||!H.title||!H.body)throw new Error("Notification title and body are required");const X={notification:{title:H.title,body:H.body,data:H.data||{},sound:H.sound!==!1,badge:H.badge,category:H.category,priority:H.priority||"default",channelId:H.channelId||"default"}};if(q)X.workspaceId=q;else if(v&&v.length>0)X.accountIds=v;else if($)X.accountId=$;
69else throw new Error("Must provide either workspaceId, accountIds, or accountId");const{data:j,error:ve}=await i.ND.functions.invoke("push-notifications",{body:X});return ve?(console.error("Error calling push-notifications Edge Function:",ve),{success:!1,error:ve.message}):{success:!0,data:j}}catch(X){return console.error("Error in sendPushNotification:",X),{success:!1,error:X.message}}}},52405(_o,De,r){r.d(De,{A:()=>P});var i=r(51477),U=r(49992),d=r(82427),$=r(58996),v=r(79257),q=r(4349),H=r(17257);function X(de){return(0,H.Ay)("MuiTableContainer",de)}const j=(0,q.A)("MuiTableContainer",["root"]),ve=null;var M=r(70481);const Pe=de=>{const{classes:me}=de,y={root:["root"]};return(0,d.A)(y,X,me)},R=(0,$.Ay)("div",{name:"MuiTableContainer",slot:"Root"})({width:"100%",overflowX:"auto"}),P=i.forwardRef(function(me,y){const Ee=(0,v.b)({props:me,name:"MuiTableContainer"}),{className:Me,component:re="div",...T}=Ee,S={...Ee,component:re},Y=Pe(S);return(0,M.jsx)(R,{ref:y,as:re,className:(0,U.A)(Y.root,Me),ownerState:S,...T})})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.