@redacto.io/consent-sdk-js 2.1.0-beta.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/redacto-privacy-center.global.js +1 -1
- package/dist/redacto-privacy-center.global.js.map +1 -1
- package/dist/redacto-privacy-center.js +5 -1
- package/dist/redacto-privacy-center.mjs +5 -1
- package/dist/redacto.d.mts +20 -1
- package/dist/redacto.d.ts +20 -1
- package/dist/redacto.global.js +76 -76
- package/dist/redacto.global.js.map +1 -1
- package/dist/redacto.js +914 -333
- package/dist/redacto.mjs +852 -333
- package/package.json +2 -2
|
@@ -663,7 +663,7 @@ ${t}`,r=_n.get(n);if(r)r.inFlight===0&&(r.keep=!1);else{if(r={key:Ty(),inFlight:
|
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
`,document.head.appendChild(g)}setTimeout(()=>{a.style.animation="pc-slideOutRight 0.3s ease-out",setTimeout(()=>{Cs.delete(r),a.parentNode&&a.parentNode.removeChild(a)},300)},s)},Ce={success:(e,t)=>Li(e,"success",t),error:(e,t)=>Li(e,"error",t),info:(e,t)=>Li(e,"info",t),warning:(e,t)=>Li(e,"warning",t)};var Ao=(e,t=d)=>{let o=new Date,n=new Date(e);if(Number.isNaN(n.getTime()))return t("justNow");let r=o.getTime()-n.getTime(),a=Math.floor(r/6e4);if(a<1)return t("justNow");if(a<60)return t("minutesAgo",{count:a});let s=Math.floor(a/60);if(s<24)return t("hoursAgo",{count:s});let c=Math.floor(s/24);if(c<7)return t("daysAgo",{count:c});let p=Math.floor(c/7);return t("weeksAgo",{count:p})};function Bi(){let e=new Map,t=null,o=n=>Array.from(n.querySelectorAll("button"));return{reset(){e=new Map},register(n,r){e.set(n,r)},capture(){t=null;let n=document.activeElement;if(n)for(let[r,a]of e){if(a===n){t={key:r,index:-1};return}if(a.contains(n)){let s=o(a).findIndex(c=>c===n);t={key:r,index:s};return}}},restore(){let n=t;if(t=null,!n)return;let r=e.get(n.key);if(!r||!r.isConnected)return;let a=n.index<0?r:o(r)[n.index];a&&document.activeElement!==a&&a.focus({preventScroll:!0})}}}var Iy=e=>{let t=e.toLowerCase();return t.includes("consent")||t.includes("grant")?{variant:"success",Icon:"ShieldCheck"}:t.includes("case")?{variant:"info",Icon:"FileText"}:t.includes("access")||t.includes("view")?{variant:"info",Icon:"Eye"}:t.includes("grievance")||t.includes("request")?{variant:"warning",Icon:"MessageSquareWarning"}:{variant:"secondary",Icon:"Activity"}},Ny=e=>{let t=[],o=new Map;for(let n of e){let r=ze(n.timestamp),a=r.format("YYYY-MM-DD"),s=o.get(a);s||(s={key:a,label:r.format(Ci.DATE),newest:n.timestamp,items:[]},o.set(a,s),t.push(s)),s.items.push(n)}return t};function xs(e,{activities:t}){let o=Ny(t);return i("div",{style:{width:"100%"}},o.map((n,r)=>i("div",{style:{marginTop:r===0?0:U("--pc-spacing-lg")}},i("div",{style:{display:"flex",alignItems:"baseline",gap:U("--pc-spacing-sm"),marginBottom:U("--pc-spacing-md"),paddingLeft:"0.125rem"}},F(e,{as:"span",size:"xs",weight:"bold",color:"primary",style:{textTransform:"uppercase",letterSpacing:"0.04em"}},n.label),F(e,{as:"span",size:"xs",color:"tertiary"},Ao(n.newest,d))),i("div",{style:{position:"relative"}},i("span",{"aria-hidden":!0,style:{position:"absolute",top:gr/2,bottom:gr/2,left:Ap,width:2,marginLeft:-1,background:`linear-gradient(180deg, transparent 0, ${U("--pc-border-color")} 12px, ${U("--pc-border-color")} calc(100% - 12px), transparent 100%)`}}),n.items.map(a=>Dy(e,{activity:a}))))))}function Dy(e,{activity:t}){let{variant:o,Icon:n}=Iy(t.activity_type),r=Sp[o],a=t.title_display||t.title,s=t.description_display||t.description,c=t.activity_type_display||Gp(t.activity_type),p=ze(t.timestamp),g=p.format(Ci.TIME),f=Ao(t.timestamp,d),y=p.format(Ci.TOOLTIP);return i("div",{className:"pc-timeline-item pc-timeline-row",style:{position:"relative",display:"grid",gridTemplateColumns:`${Cp} ${xp} 1fr`,columnGap:`${is}px`}},Dt(e,{content:y,placement:"top"},i("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",textAlign:"right",paddingTop:"0.5rem",cursor:"help"}},F(e,{as:"span",size:"sm",weight:"medium",color:"secondary",style:{whiteSpace:"nowrap",lineHeight:1.3}},g),F(e,{as:"span",size:"xs",color:"tertiary",style:{whiteSpace:"nowrap",lineHeight:1.3}},f))),i("div",{style:{display:"flex",justifyContent:"center",paddingTop:"0.5rem"}},i("div",{style:{position:"relative",zIndex:1,width:gr,height:gr,borderRadius:"9999px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:U("--pc-bg-primary"),backgroundImage:`linear-gradient(${r.bg}, ${r.bg})`,color:r.color,boxShadow:`0 0 0 3px ${U("--pc-bg-primary")}`}},G(n,{size:16,strokeWidth:2.25,"aria-hidden":!0}))),i("div",{className:"pc-timeline-content",style:{minWidth:0,marginBottom:U("--pc-spacing-sm"),padding:"0.5rem 0.625rem",borderRadius:U("--pc-border-radius-md")}},i("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"}},F(e,{size:"sm",weight:"semibold",color:"primary",style:{minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},a),st(e,{variant:o,size:"sm",style:{flexShrink:0}},c)),s?F(e,{size:"sm",color:"secondary",title:s,style:{marginTop:"0.125rem",lineHeight:1.5,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"}},s):null))}var Hi=e=>j({value:e});function As(e){let t=e.get(Te),o=e.get(Re),{consentClient:n}=e.get(Ue),r=J(),a=()=>{var _;let T=t.get().organization;return{organizationId:T==null?void 0:T.uuid,workspaceId:(_=T==null?void 0:T.workspaces[0])==null?void 0:_.uuid}},s=()=>ct(o),c=Hi([]),p=Hi(0),g=Hi(!0),f=Hi(!1),y=()=>c.get().value.length<p.get().value,A=!1,S=0,b=async T=>{let{organizationId:_,workspaceId:R}=a();return!_||!R?null:Pi(_,R,T,Np,s(),n,at().langParam)},x=async()=>{var P,D,O;let T=++S,_=()=>!e.disposed&&T===S,{organizationId:R,workspaceId:k}=a();A=!1,f.set({value:!1}),g.set({value:!0}),c.set({value:[]}),p.set({value:0});try{let I=await b(0);if(!_())return;if(R&&k&&!I)throw new Error(as);p.set({value:(D=(P=I==null?void 0:I.pagination)==null?void 0:P.total_count)!=null?D:0}),c.set({value:(O=I==null?void 0:I.data)!=null?O:[]})}catch(I){if(!_())return;console.error(I),c.set({value:[]}),p.set({value:0}),Ce.error(d("failedToFetchActivityData"))}finally{_()&&g.set({value:!1})}},u=async()=>{var R,k,P;if(A||!y())return;let T=S,_=()=>!e.disposed&&T===S;A=!0,f.set({value:!0});try{let D=await b(c.get().value.length);if(!_())return;if(!D)throw new Error(as);p.set({value:(k=(R=D.pagination)==null?void 0:R.total_count)!=null?k:p.get().value}),c.set({value:[...c.get().value,...(P=D.data)!=null?P:[]]})}catch(D){if(!_())return;console.error(D),Ce.error(d("failedToFetchActivityData"))}finally{_()&&(A=!1,f.set({value:!1}))}},m=V([t,o.state,r],()=>{let{organizationId:T,workspaceId:_}=a(),{accessToken:R,refreshToken:k}=o.state.get();return JSON.stringify([T!=null?T:null,_!=null?_:null,R,k,r.get().language])}),v=null,C=!1,h=()=>{C||(C=!0,queueMicrotask(()=>{if(C=!1,e.disposed)return;let T=m.get().value;T!==v&&(v=T,x())}))};e.watch(m,h),h();let w=B(e,[r,g,c,p],T=>{if(g.get().value)return My();let _=c.get().value;if(_.length===0)return Ot(T,{icon:G("History",{size:28,"aria-hidden":!0}),title:d("noActivitiesYet"),description:d("noActivitiesDescription")});let R;if(y()){let k=i("div",{"aria-hidden":!0,style:{position:"absolute",bottom:0,left:0,height:1,width:1}});if(typeof IntersectionObserver!="undefined"){let D=new IntersectionObserver(O=>{var I;(I=O[0])!=null&&I.isIntersecting&&u()},{root:null,rootMargin:"600px 0px"});D.observe(k),T.onCleanup(()=>D.disconnect())}let P=B(T,[f],D=>f.get().value?Ve(D,{size:"sm"}):null);R=i("div",{style:{position:"relative",minHeight:"2.75rem",display:"flex",alignItems:"center",justifyContent:"center"}},k,P.el)}else R=i("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"2.75rem"}},F(T,{as:"span",size:"xs",color:"tertiary"},d("allCaughtUp")));return[xs(T,{activities:_}),R]});return i("div",{style:{width:"100%"}},w.el)}function My(){let e=t=>({animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",backgroundColor:U("--pc-bg-tertiary"),borderRadius:U("--pc-border-radius-md"),...t});return i("div",{style:{width:"100%"}},i("div",{style:{...e({height:"0.75rem",width:"7rem"}),marginBottom:U("--pc-spacing-md")}}),Array.from({length:6}).map(()=>i("div",{style:{display:"grid",gridTemplateColumns:"64px 34px 1fr",columnGap:"12px",marginBottom:U("--pc-spacing-sm")}},i("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"0.25rem",paddingTop:"0.5rem"}},i("div",{style:e({height:"0.75rem",width:"3rem"})}),i("div",{style:e({height:"0.625rem",width:"2.25rem"})})),i("div",{style:{display:"flex",justifyContent:"center",paddingTop:"0.5rem"}},i("div",{style:e({width:30,height:30,borderRadius:"9999px"})})),i("div",{style:{display:"flex",flexDirection:"column",gap:"0.4375rem",padding:"0.5rem 0.625rem"}},i("div",{style:e({height:"0.875rem",width:"40%"})}),i("div",{style:e({height:"0.75rem",width:"72%"})})))))}function yd(e){return Ie.language||Ie.changeLanguage("en"),i("div",{style:{width:"100%"}},i("div",{style:{paddingTop:"0.5rem"}},As(e)))}var hd=e=>e?new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"-",bd=e=>{let t=new Date(e),o={day:"2-digit",month:"short",year:"numeric"};return t.toLocaleString("en-US",o)};var So=hd;var vd=e=>e?Pp.includes(e.toLowerCase()):!1;var Fi=e=>{let t=e.toLowerCase().replace(/_/g,"");return t==="completed"?"success":t==="rejected"||t==="declined"?"error":t==="processing"||t==="inprogress"||t==="expired"?"warning":t==="initiated"?"info":"secondary"},Ui=e=>e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "),Cd=e=>e&&(e.url||e.download_url)||null;function xd(e){let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric"})+", "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}function zi(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ss(e){return e.size===0?"File is empty. Please select a valid file.":e.size>Ep?"File size must not exceed 10 MB.":!e.type||e.type.trim()===""?"Could not determine file type. Please try a different file.":Rp.includes(e.type)?null:"File type not supported. Allowed: PDF, JPG, PNG, WEBP, DOC, DOCX, XLS, XLSX, TXT, CSV."}function ws(e){if(!(e instanceof Error))return"Something went wrong. Please try again.";let t=e.message;return t.includes("[409]")||t.includes("document_already_exists")?"This document has already been uploaded.":t.includes("[422]")?"File format not accepted. Please upload a PDF, image, or Office document.":t.includes("[400]")||t.includes("empty_file")?"File is empty or the request is invalid.":t.includes("[500]")?"Something went wrong on the server. Please try again.":"Document upload failed. Please try again."}var wo=qe("QueryCache"),Cr=e=>typeof e=="function"?e():e,Ad=(e,t)=>!en(t)&&e<1,Sd=e=>Math.min(1e3*2**e,3e4);function qi(e,t){let o=e.get(wo),n=()=>{let{organizationId:a,workspaceId:s,contact:c,authContext:p,consentClient:g}=t.get(),f=p==null?void 0:p.accessToken,{currentLanguage:y,langParam:A}=at();return{key:["caseHistory",a,s,c,f,y],fn:async()=>{if(!a||!s||!c)return[];let S=await Pn(a,s,c,void 0,void 0,p,g,A);return(S==null?void 0:S.data)||[]},enabled:!!a&&!!s&&!!c&&!!g,retry:Ad,retryDelay:Sd}},r=o.query(e,n());return e.watch(t,()=>r.setOptions(n())),e.watch(J(),()=>r.setOptions(n())),r}function wd(e,t){let o=e.get(wo),n=()=>{let{organizationId:a,workspaceId:s,caseUuid:c,authContext:p,consentClient:g}=t.get(),f=p==null?void 0:p.accessToken;return{key:["caseMessages",a,s,c,f],fn:async()=>{if(!a||!s||!c)return[];let y=await $p(a,s,c,p,g);if(y===null)throw new Error("Failed to fetch case messages");return[...y].sort((A,S)=>{let b=new Date(A.created_at).getTime(),x=new Date(S.created_at).getTime();return isNaN(b)||isNaN(x)?A.created_at<S.created_at?-1:1:b-x})},enabled:!!a&&!!s&&!!c&&!!g,retry:Ad,retryDelay:Sd}},r=o.query(e,n());return e.watch(t,()=>r.setOptions(n())),r}function Td(e,t){let o=e.get(wo);return o.mutation(async({body:n,documentUuids:r})=>{let{organizationId:a,workspaceId:s,caseUuid:c,authContext:p,consentClient:g}=Cr(t);if(!a||!s||!c)throw new Error("Missing params");let f=await Yp(a,s,c,n,r,p,g);if(f===null)throw new Error("Send case message failed");return f},{onSuccess:()=>{let{organizationId:n,workspaceId:r,caseUuid:a}=Cr(t);o.invalidate(["caseMessages",n,r,a])}})}function kd(e,t){return e.get(wo).mutation(async n=>{let{organizationId:r,workspaceId:a,caseUuid:s,authContext:c,consentClient:p}=Cr(t);if(!r||!a||!s)throw new Error("Missing params");let g=await Xp(r,a,s,n,c,p);if(g===null)throw new Error("Upload case document failed");return g})}function Ed(e,t){let o=e.get(wo);return o.mutation(async({requestEventUuid:n,documentUuid:r,body:a})=>{let{organizationId:s,workspaceId:c,caseUuid:p,authContext:g,consentClient:f}=Cr(t);if(!s||!c||!p)throw new Error("Missing params");let y=await Jp(s,c,p,n,r,a,g,f);if(y===null)throw new Error("Submit document for request failed");return y},{onSuccess:()=>{let{organizationId:n,workspaceId:r,caseUuid:a}=Cr(t);o.invalidate(["caseMessages",n,r,a])}})}var Oy={width:"auto"},Nn=(e,{enabled:t,autoWidth:o=!1,children:n})=>t?Dt(e,{content:()=>vi(),triggerStyle:o?Oy:void 0},n):n;var Rd=(e,{message:t,onUpload:o,isSubmitting:n,isCaseFinalized:r})=>{let a=t.document_request_metadata;if(!a)return null;let s=_p.includes(a.document_request_status),c=Ip[a.document_request_status];return i("div",{className:"pc-doc-request-card",style:{border:`1.5px dashed ${Be.info.border}`,backgroundColor:Be.info.bg}},i("div",{className:"pc-doc-request-header"},G("IoAttach",{size:16,className:"pc-doc-request-icon",style:{color:Be.info.color}}),i("div",null,i("div",{className:"pc-doc-request-title",style:{color:Be.infoDark}},d("documentRequestedLabel",{title:a.title})),a.accepted_document?i("div",{className:"pc-doc-request-accepted",style:{color:Be.info.color}},d("acceptedLabel",{accepted:a.accepted_document})):null),i("span",{className:"pc-doc-request-status",style:{color:c.color,border:`1px solid ${c.color}`}},d(c.labelKey))),s?Nn(e,{enabled:r,autoWidth:!0,children:be(e,{variant:"outline",size:"sm",disabled:n||r,onClick:r?void 0:()=>o(t.uuid),className:"pc-doc-request-upload-btn"},n?Ve(e,{variant:"spinner",size:"sm"}):G("IoAttach",{size:14}),d("uploadAndSubmit"))}):null,a.document_request_status==="rejected"&&a.rejection_reason?i("div",{className:"pc-doc-request-rejection",style:{color:Be.error.color,backgroundColor:Be.error.bg}},d("rejectionReasonLabel",{reason:a.rejection_reason})):null)};var Vi=(e,{icon:t,color:o,bgColor:n,borderColor:r,text:a,subText:s,timestamp:c})=>i("div",{className:"pc-status-event"},i("div",{className:"pc-status-event-pill",style:{backgroundColor:n,border:`1px solid ${r}`,color:o}},t,i("span",null,a)),s?i("div",{className:"pc-status-event-sub",style:{color:o}},s):null,i("span",{className:"pc-status-event-time"},c));var Ly=/^https?:\/\/[^\s"'<>\\]+$/i,Dn=e=>{var o;let t=(o=e==null?void 0:e.trim())!=null?o:"";return Ly.test(t)?t:null};var Gi=(e,{doc:t})=>{let o=Dn(Cd(t.file_url)),n=t.file_name||d("document"),r=()=>[G("IoDocumentText",{size:20,className:"pc-attachment-icon"}),i("div",{className:"pc-attachment-info"},i("div",{className:"pc-attachment-name"},n),i("div",{className:"pc-attachment-size"},t.file_size?zi(t.file_size):null))];return o?i("a",{href:o,target:"_blank",rel:"noopener noreferrer","aria-label":d("downloadAttachment",{fileName:n}),className:"pc-attachment-card"},...r()):i("div",{className:"pc-attachment-card"},...r())};var Pd=(e,{message:t,isPrincipal:o,senderLabel:n,timestamp:r})=>{let a=o?"sent":"received";return i("div",{className:`pc-chat-bubble-wrap pc-chat-bubble-wrap--${a}`},i("span",{className:"pc-chat-sender"},n," \xB7 ",r),t.body?i("div",{className:`pc-chat-bubble pc-chat-bubble--${a}`},t.body):null,...t.documents.map(s=>Gi(e,{doc:s})))};var _d=(e,{message:t,onUploadForRequest:o,isSubmittingForRequest:n,isCaseFinalized:r})=>{var p;let a=t.sender_role==="data_principal",s=xd(t.created_at),c=a?d("senderYou"):t.triggered_by_email||d("senderPrivacyTeam");switch(t.message_type){case"document_requested":return St(t.body?i("div",{className:"pc-chat-bubble-wrap pc-chat-bubble-wrap--received"},i("span",{className:"pc-chat-sender"},c," \xB7 ",s),i("div",{className:"pc-chat-bubble pc-chat-bubble--received"},t.body)):null,Rd(e,{message:t,onUpload:o,isSubmitting:n,isCaseFinalized:r}));case"document_approved":return Vi(e,{icon:G("IoCheckmarkCircle",{size:18}),color:Be.success.color,bgColor:Be.success.bg,borderColor:Be.success.border,text:d("documentAccepted"),timestamp:s});case"document_rejected":return Vi(e,{icon:G("IoCloseCircle",{size:18}),color:Be.error.color,bgColor:Be.error.bg,borderColor:Be.error.border,text:d("documentRejected"),subText:(p=t.document_request_metadata)==null?void 0:p.rejection_reason,timestamp:s});case"document_replacement_requested":return Vi(e,{icon:G("IoAlertCircle",{size:18}),color:Be.warning.color,bgColor:Be.warning.bg,borderColor:Be.warning.border,text:d("replacementRequested"),subText:t.body,timestamp:s});default:return Pd(e,{message:t,isPrincipal:a,senderLabel:c,timestamp:s})}};var Id=(e,{messageText:t,onMessageTextChange:o,pendingUpload:n,onRemovePendingUpload:r,onAttachClick:a,onSend:s,isSending:c,isUploading:p,isCaseFinalized:g})=>{let f=J(),y=v=>{v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),s())},A=i("textarea",{value:me(t),onChange:v=>o(v.target.value),onKeyDown:y,placeholder:d("writeMessagePlaceholder"),rows:3,className:"pc-composer-textarea",disabled:me(g)});rt(e,t,v=>{A.value!==v&&(A.value=v)}),rt(e,g,v=>{A.disabled=v}),e.watch(f,()=>{A.placeholder=d("writeMessagePlaceholder")});let S=B(e,[et(n),f],v=>{let C=me(n);return C?i("div",{className:"pc-composer-pending-row"},i("div",{className:"pc-composer-pending-pill"},G("IoDocumentText",{size:14}),i("span",null,C.file_name),i("span",{className:"pc-composer-pending-size"},zi(C.file_size)),i("button",{type:"button","aria-label":d("removeAttachment"),onClick:r,className:"pc-composer-remove-btn"},"\xD7"))):null}),b=B(e,[et(g)],v=>Nn(v,{enabled:me(g),children:A})),x=V([et(t),et(n)],()=>!!me(t).trim()||!!me(n)),u=B(e,[et(c),et(p),et(g),x,f],v=>{let C=me(c),h=me(p),w=me(g);return[Nn(v,{enabled:w,autoWidth:!0,children:be(v,{variant:"outline",size:"sm",disabled:h||C||w,onClick:a,className:"pc-composer-btn"},h?Ve(v,{variant:"spinner",size:"sm"}):G("IoAttach",{size:16}),d("attachFile"))}),Nn(v,{enabled:w,autoWidth:!0,children:be(v,{size:"sm",disabled:!x.get().value||C||h||w,onClick:s,className:"pc-composer-btn"},C?Ve(v,{variant:"spinner",size:"sm"}):null,d("send"),G("IoSend",{size:14}))})]}),m=i("div",{className:"pc-composer-footer"},d("messagesSecureFooter"));return e.watch(f,()=>{m.textContent=d("messagesSecureFooter")}),i("div",{className:"pc-composer"},S.el,i("div",{className:"pc-composer-textarea-wrap"},b.el),i("div",{className:"pc-composer-actions"},u.el),m)};function Nd(e,t,o){let n={current:null},r=!0,a=!0;return e.setInterval(()=>{o!=null&&o()||t()},3e4),{scrollContainerRef:n,handleScroll:()=>{let g=n.current;g&&(r=g.scrollHeight-g.scrollTop-g.clientHeight<100)},scrollToBottom:()=>{a=!0},onMessagesRendered:()=>{let g=n.current;g&&(r||a)&&(g.scrollTop=g.scrollHeight,a=!1)}}}function Dd(e,t,o,n,r){let a=j({value:null}),s=j({value:null}),c=m=>a.set({value:m}),p=m=>s.set({value:m}),g={current:null},f={current:null},y=null,A=m=>(...v)=>{e.disposed||m(...v)},S=m=>{var w;let v=m.target,C=(w=v.files)==null?void 0:w[0];if(!C)return;v.value="";let h=Ss(C);if(h){Ce.error(h);return}t.mutate(C).then(A(T=>{T?(c({uuid:T.uuid,file_name:T.file_name,file_size:T.file_size}),Ce.success(`"${T.file_name}" uploaded successfully`)):Ce.error("Document upload failed. Please try again.")}),A(T=>{Ce.error(ws(T))}))},b=(m,v)=>{let C=Ss(v);if(C){Ce.error(C);return}p(m),t.mutate(v).then(A(h=>{if(!h){p(null),Ce.error("Document upload failed. Please try again.");return}Ce.success(`"${h.file_name}" uploaded successfully`),o.mutate({requestEventUuid:m,documentUuid:h.uuid,body:""}).then(A(()=>{p(null),r(),n()}),A(()=>{p(null),Ce.error("Failed to submit document. Please try again.")}))}),A(h=>{p(null),Ce.error(ws(h))}))};return{pendingUpload:a,setPendingUpload:c,submittingForRequest:s,attachInputRef:g,submitInputRef:f,handleAttachFile:S,handleSubmitInputChange:m=>{var w;let v=m.target,C=(w=v.files)==null?void 0:w[0];v.value="";let h=y;y=null,C&&h&&b(h,C)},triggerUploadForRequest:m=>{var v;y=m,(v=f.current)==null||v.click()}}}var By=(e,t)=>e.messages===t.messages&&e.isLoading===t.isLoading&&e.isError===t.isError&&e.language===t.language&&e.submittingForRequest===t.submittingForRequest&&e.isCaseFinalized===t.isCaseFinalized,Md=(e,{caseUuid:t,caseStatus:o})=>{let n=J(),r=e.get(Te),a=e.get(Re),{consentClient:s}=e.get(Ue),c=V([et(o)],()=>vd(me(o))),p=()=>ct(a),g=()=>{var Pe;let ce=r.get().organization;return{organizationId:ce==null?void 0:ce.uuid,workspaceId:(Pe=ce==null?void 0:ce.workspaces[0])==null?void 0:Pe.uuid,caseUuid:me(t),authContext:p(),consentClient:s}},f=j(g()),y=()=>f.set(g());e.watch(a.state,y),e.watch(r,y),rt(e,t,y);let A=wd(e,f),S=()=>{A.refetch()},b=Td(e,g),x=kd(e,g),u=Ed(e,g),v=Nd(e,S,()=>kn(p())),{scrollContainerRef:C,handleScroll:h,scrollToBottom:w}=v,T=Dd(e,x,u,S,w),{pendingUpload:_,setPendingUpload:R,submittingForRequest:k,attachInputRef:P,submitInputRef:D,handleAttachFile:O,handleSubmitInputChange:I,triggerUploadForRequest:L}=T,K=j({value:""}),Y=()=>{if(b.state.get().isPending||x.state.get().isPending)return;let ce=K.get().value.trim(),Pe=_.get().value;!ce&&!Pe||b.mutate({body:ce,documentUuids:Pe?[Pe.uuid]:[]}).then(()=>{e.disposed||(K.set({value:""}),R(null),w(),S())},()=>{})},he=V([b.state],()=>b.state.get().isPending),te=V([x.state],()=>x.state.get().isPending),X=V([A],()=>A.get().isFetching),ae=i("span",{className:"pc-messages-notice-text"}),ve=G("IoRefresh",{size:16,style:{animation:"none"}}),Q=()=>d("refreshMessages",{defaultValue:"Refresh messages"}),le=i("button",{type:"button",onClick:()=>S(),disabled:X.get().value,"aria-label":Q(),title:Q(),className:"pc-messages-refresh-btn",style:{color:Be.infoBanner.color}},ve),we=()=>{ae.textContent=c.get().value?vi():d("secureMessagesNotice"),le.setAttribute("aria-label",Q()),le.title=Q()},ge=()=>{let ce=X.get().value;le.disabled=ce,ve.style.animation=ce?"pc-spin 1s linear infinite":"none"};we(),ge(),e.watch(c,we),e.watch(n,we),e.watch(X,ge);let ie=null,de=V([A,n,k,c],()=>{let ce=A.get(),Pe={messages:ce.data,isLoading:ce.isLoading,isError:ce.status==="error",language:n.get().language,submittingForRequest:k.get().value,isCaseFinalized:c.get().value};return ie&&By(ie,Pe)?ie:(ie=Pe,Pe)}),Je=0,Qe;e.watch(de,()=>{var ce,Pe;Je=(Pe=(ce=C.current)==null?void 0:ce.scrollTop)!=null?Pe:0});let Ke=B(e,[de],ce=>{var Se;let Pe=de.get().value,At=(Se=Pe.messages)!=null?Se:[];return[Pe.isLoading?i("div",{className:"pc-messages-center"},Ve(ce,{variant:"spinner",size:"md"})):null,Pe.isError?i("div",{className:"pc-messages-center-text"},F(ce,{size:"sm",color:"secondary"},d("errorLoadingMessages"))):null,!Pe.isLoading&&!Pe.isError&&At.length===0?i("div",{className:"pc-messages-empty"},G("IoDocumentText",{size:40,className:"pc-messages-empty-icon"}),F(ce,{size:"sm",color:"secondary"},d("noMessagesYet"))):null,...At.map(ke=>_d(ce,{message:ke,onUploadForRequest:L,isSubmittingForRequest:Pe.submittingForRequest===ke.uuid,isCaseFinalized:Pe.isCaseFinalized}))]});return e.watch(de,()=>{let ce=C.current;ce&&(ce.scrollTop=Je);let{messages:Pe}=de.get().value;Pe!==Qe&&(Qe=Pe,v.onMessagesRendered())}),Qe=de.get().value.messages,queueMicrotask(()=>{e.disposed||v.onMessagesRendered()}),i("div",{className:"pc-messages-container"},i("input",{ref:ce=>{ce instanceof HTMLInputElement&&(P.current=ce)},type:"file",className:"pc-hidden",onChange:O}),i("input",{ref:ce=>{ce instanceof HTMLInputElement&&(D.current=ce)},type:"file",className:"pc-hidden",onChange:I}),i("div",{className:"pc-messages-notice",style:{backgroundColor:Be.infoBanner.bg,borderBottom:`1px solid ${Be.infoBanner.border}`,color:Be.infoBanner.color}},i("span",null,"\u{1F512}"),ae,le),i("div",{ref:ce=>{ce instanceof HTMLElement&&(C.current=ce)},onScroll:h,className:"pc-messages-list"},Ke.el),Id(e,{messageText:K,onMessageTextChange:ce=>K.set({value:ce}),pendingUpload:_,onRemovePendingUpload:()=>R(null),onAttachClick:()=>{var ce;return(ce=P.current)==null?void 0:ce.click()},onSend:Y,isSending:he,isUploading:te,isCaseFinalized:c}))};var Hy=e=>({uuid:e,file_name:null,content_type:null,file_size:null,file_url:null}),Fy=(e,t,o)=>{var g;let n=e.get(Te).get().organization,r=e.get(Re),{consentClient:a}=e.get(Ue),s=n==null?void 0:n.uuid,c=(g=n==null?void 0:n.workspaces[0])==null?void 0:g.uuid,p=f=>{let y=j({value:Hy(f)});return s&&c&&Qp(s,c,t,f,ct(r),a).catch(()=>null).then(A=>{A&&!e.disposed&&y.set({value:A})}),B(e,[y],A=>Gi(A,{doc:y.get().value})).el};return i("div",{className:"pc-request-description"},F(e,{size:"sm",weight:"semibold",className:"pc-request-description-title"},d("myDocuments")),i("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"}},...o.map(p)))},Od=(e,{selectedCase:t,request_details:o,requestTypeLabel:n})=>{var p,g,f,y;let r=(A,S)=>i("div",null,F(e,{size:"xs",weight:"medium",color:"secondary",className:"pc-request-field-label"},A),S),a=(p=t.requestor_note)==null?void 0:p.trim(),s=t.time_period,c=(g=t.supporting_docs_uuids)!=null?g:[];return i("div",{className:"pc-request-details"},i("div",{className:"pc-request-summary-card"},i("div",{className:"pc-case-details-grid pc-request-summary-grid"},r(d("requestType"),F(e,{size:"sm",weight:"semibold",className:"pc-request-field-value--capitalize"},n)),r(d("status"),st(e,{variant:Fi(t.status),size:"sm",className:"pc-status-badge"},t.status_display||Ui(t.status))),r(d("createdAt"),F(e,{size:"sm",weight:"medium",className:"pc-request-field-value"},So(t.created_at))),s?r(d("timePeriod"),F(e,{size:"sm",weight:"medium",className:"pc-request-field-value"},(y=(f=bi().find(A=>A.value===String(s)))==null?void 0:f.label)!=null?y:String(s))):null,t.completed_at?r(d("completedAt"),F(e,{size:"sm",weight:"medium",className:"pc-request-field-value"},So(t.completed_at))):null)),t.description_display||t.description?i("div",{className:"pc-request-description"},F(e,{size:"sm",weight:"semibold",className:"pc-request-description-title"},d("descriptionLabel")),F(e,{size:"sm",color:"secondary",className:"pc-request-description-text"},t.description_display||t.description)):null,a?i("div",{className:"pc-request-description"},F(e,{size:"sm",weight:"semibold",className:"pc-request-description-title"},d("additionalNote")),F(e,{size:"sm",color:"secondary",className:"pc-request-description-text"},a)):null,c.length>0?Fy(e,t.uuid,c):null,o?i("div",{className:"pc-request-specifics"},i("div",{className:"pc-request-section-divider"},i("span",{className:"pc-request-section-title"},d("requestSpecifics"))),o.purposes&&o.purposes.length>0?i("div",null,F(e,{size:"sm",weight:"semibold",className:"pc-request-section-heading"},d("purposesInvolved")),i("ul",{className:"pc-request-purpose-list"},...o.purposes.map(A=>{var S,b,x;return i("li",{className:"pc-request-purpose-item"},i("div",{className:"pc-request-purpose-name"},(S=A.purpose)==null?void 0:S.name),(b=A.purpose)!=null&&b.description?i("div",{className:"pc-request-purpose-desc"},A.purpose.description):null,(x=A.purpose)!=null&&x.data_elements&&A.purpose.data_elements.some(u=>u.selected)?i("div",{className:"pc-request-data-elements"},...A.purpose.data_elements.filter(u=>u.selected).map(u=>st(e,{variant:"secondary",size:"sm",className:"pc-status-badge"},u.name))):null)}))):null,o.correction_data&&o.correction_data.length>0?i("div",null,F(e,{size:"sm",weight:"semibold",className:"pc-request-section-heading"},d("dataToCorrect")),i("div",{className:"pcOverflowXAuto"},i("div",{className:"pc-request-table-wrap"},He(e,{className:"pc-request-table"},si(e,{className:"pc-request-table-header"},lr(e,{},...[d("field"),d("currentValue"),d("newValue")].map(A=>ci(e,{className:"pc-request-table-head"},A)))),li(e,{},...o.correction_data.map(A=>lr(e,{className:"pc-request-table-row"},wn(e,{className:"pc-request-table-cell pc-request-table-cell--name"},A.name),wn(e,{className:"pc-request-table-cell pc-request-table-cell--value"},A.curr_value||"-"),wn(e,{className:"pc-request-table-cell pc-request-table-cell--value"},A.new_value||"-")))))))):null,o.nomination_data?i("div",null,F(e,{size:"sm",weight:"semibold",className:"pc-request-section-heading"},d("nomination")),i("div",{className:"pc-request-nomination-card"},i("div",{className:"pc-request-nomination-field"},F(e,{size:"xs",weight:"medium",color:"secondary"},d("nomineeEmail")),F(e,{size:"sm",weight:"medium",className:"pc-request-field-value"},o.nomination_data.nominee_email||"-")),i("div",{className:"pc-request-nomination-field"},F(e,{size:"xs",weight:"medium",color:"secondary"},d("nomineeMobile")),F(e,{size:"sm",weight:"medium",className:"pc-request-field-value"},o.nomination_data.nominee_mobile||"-")))):null,o.grievance_types&&o.grievance_types.length>0?i("div",null,F(e,{size:"sm",weight:"semibold",className:"pc-request-section-heading"},d("grievanceTypes")),i("div",{className:"pc-request-grievance-wrap"},...o.grievance_types.map(A=>{var S;return st(e,{variant:"secondary",size:"sm",className:"pc-status-badge"},(S=A.grievance)==null?void 0:S.replace("_"," "))}))):null):null)};var Ld=()=>{try{return typeof window!="undefined"&&sessionStorage.getItem("email")||""}catch{return""}},Bd=e=>{let t=e.get(yt),{navigateTo:o,setSelectedCase:n}=t,r=e.get(Te),a=e.get(Re),{consentClient:s}=e.get(Ue),c=J(),p=j({value:"request-details"}),g=()=>ct(a),f=()=>{var k;let R=r.get().organization;return{organizationId:R==null?void 0:R.uuid,workspaceId:(k=R==null?void 0:R.workspaces[0])==null?void 0:k.uuid}},y=()=>({...f(),contact:Ld(),authContext:g(),consentClient:s}),A=j(y()),S=()=>A.set(y());e.watch(a.state,S),e.watch(r,S);let b=qi(e,A),x=()=>{var P;let{selectedCase:R,pendingCaseUuid:k}=t.state.get();return(P=R==null?void 0:R.uuid)!=null?P:k},u,m,v=!1,C=()=>{let R=b.get().data,k=b.get().isLoading,P=x(),{organizationId:D,workspaceId:O}=f(),I=Ld();if((R!==u||P!==m)&&(u=R,m=P,R)){if(R.length===0)o("form");else if(P){let L=R.find(K=>K.uuid===P);L?n(L):o("form")}}e.disposed||(P&&!k&&R===void 0&&(!D||!O||!I)&&o("form"),!e.disposed&&!t.state.get().selectedCase&&!P&&!k&&o("form"))},h=()=>{v||(v=!0,queueMicrotask(()=>{v=!1,e.disposed||C()}))};e.watch(b,h),e.watch(t.state,h),e.watch(A,h),h();let w=V([t.state],()=>t.state.get().selectedCase),T=V([w,b],()=>w.get().value?"case":b.get().isLoading?"loading":"none");return B(e,[T],R=>w.get().value?_(R):T.get().value==="loading"?i("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px"}},Ve(R,{size:"lg"})):null).el;function _(R){let k=w.get().value,P=()=>{var X;return k=(X=w.get().value)!=null?X:k,k},D=X=>X.request_type_display||X.request_type.replace("_"," "),O=document.createTextNode(d("backToHome"));R.watch(c,()=>{O.data=d("backToHome")});let I=B(R,[w,c],()=>{let X=P();if(!X)return null;let ae=X.due_date&&new Date(X.due_date)<new Date;return[i("span",{className:"pc-case-header-id"},X.case_id),i("span",null,"\xB7"),i("span",null,D(X)),i("span",null,"\xB7"),i("span",null,d("submitted")," ",So(X.created_at)),X.due_date?[i("span",null,"\xB7"),i("span",{className:ae?"pc-case-header-overdue":void 0},d("responseDue")," ",So(X.due_date))]:null,i("span",null,"\xB7"),st(R,{variant:Fi(X.status),size:"sm",className:"pc-status-badge"},X.status_display||Ui(X.status))]}),L=()=>[{id:"request-details",label:d("requestDetails")},{id:"messages",label:d("messages")}],K=L().map(X=>{let ae=i("button",{onClick:()=>p.set({value:X.id})},X.label),ve=()=>{ae.className=`pc-case-tab ${p.get().value===X.id?"pc-case-tab--active":""}`};return ve(),R.watch(p,ve),{id:X.id,button:ae}});R.watch(c,()=>{for(let X of L()){let ae=K.find(ve=>ve.id===X.id);ae&&(ae.button.textContent=X.label)}});let Y=V([w],()=>{var X,ae;return(ae=(X=P())==null?void 0:X.uuid)!=null?ae:""}),he=V([w],()=>{var X,ae;return(ae=(X=P())==null?void 0:X.status)!=null?ae:""}),te=B(R,[p],X=>p.get().value==="messages"?Md(X,{caseUuid:Y,caseStatus:he}):B(X,[w,c],ae=>{let ve=P();return ve?Od(ae,{selectedCase:ve,request_details:ve.request_details,requestTypeLabel:D(ve)}):null}).el);return i("div",{className:"pc-case-page"},i("div",{className:"pc-case-back"},be(R,{variant:"text",size:"sm",onClick:()=>o("form"),className:"pc-case-back-btn"},G("IoArrowBack",{size:16,className:"pc-case-back-icon"}),O)),i("div",{className:"pc-case-header"},I.el),i("div",{className:"pc-case-tabs"},...K.map(X=>X.button)),i("div",{className:"pc-case-tab-content"},te.el))}};var Uy=10;function tn(e){var p;let t=j({expanded:{},pageIndex:0,pageSize:(p=e.initialPageSize)!=null?p:Uy}),o=!1,n,r=!1,a=()=>e.pageCount?e.pageCount():Math.ceil(e.data().length/t.get().pageSize),s=g=>{let f=e.pageCount?e.pageCount():-1,y=f===-1?Number.MAX_SAFE_INTEGER:f-1;t.set({pageIndex:Math.max(0,Math.min(g,y))})},c=(g,f)=>{let y=e.getRowId?e.getRowId(g,f):String(f),A={id:y,index:f,original:g,getIsExpanded:()=>!!t.get().expanded[y],toggleExpanded(S){let b=t.get().expanded,x=!!b[y],u=S!=null?S:!x;if(!x&&u)t.set({expanded:{...b,[y]:!0}});else if(x&&!u){let m={...b};delete m[y],t.set({expanded:m})}},getCanExpand:()=>e.getRowCanExpand?e.getRowCanExpand(A):!1};return A};return{columns:e.columns,state:t,rows(){let g=e.data();return o&&g!==n&&!e.manualPagination&&!r&&(r=!0,queueMicrotask(()=>{r=!1,s(0)})),o=!0,n=g,g.map(c)},pageCount:a,setPageIndex:s,setPageSize(g){let{pageIndex:f,pageSize:y}=t.get(),A=Math.max(1,g);t.set({pageSize:A,pageIndex:Math.floor(y*f/A)})},canPreviousPage:()=>t.get().pageIndex>0,canNextPage(){let g=a();return g===-1?!0:g===0?!1:t.get().pageIndex<g-1}}}var Lt=e=>`var(${e})`,Hd=e=>(e==null?void 0:e.align)||"left";function Mn(e,{table:t,variant:o="modern",classNames:n,isLoading:r=!1,showLoadingText:a=!1,className:s,customLoader:c,expandedComponent:p,onRowClick:g,deps:f=[]}){let y=null,A=[],b=[V([t.state],()=>`${t.state.get().pageIndex}:${t.state.get().pageSize}`),J(),...f];typeof r!="boolean"&&b.push(r);let x=()=>{for(let w of A){let T=y===w.row.id;w.tr.style.backgroundColor=T?Lt("--pc-bg-hover"):""}},u=()=>{for(let w of A){let T=w.row.getIsExpanded();w.tr.style.borderBottom=T?"none":l.tableRow.borderBottom,w.expandedTr&&(w.expandedTr.style.pointerEvents=T?"auto":"none"),w.expandedCell&&(w.expandedCell.style.padding=T?"":"0",w.expandedCell.style.height=T?"":"0"),w.panel&&(w.panel.style.maxHeight=T?"1200px":"0",w.panel.style.opacity=T?"1":"0",w.panel.style.transform=T?"translateY(0)":"translateY(-6px)")}},m=i("div",{className:`pc-table-container ${(n==null?void 0:n.container)||""} ${s||""}`,style:{...l.wFull,maxWidth:"100%",...l.overflowXAuto,borderRadius:Lt("--pc-border-radius-md"),border:`1px solid ${Lt("--pc-border-color")}`,backgroundColor:Lt("--pc-bg-primary"),transition:"background-color 0.3s ease, border-color 0.3s ease"}}),v=(w,T)=>{let _=Hd(T.meta);return He.Head(w,{colSpan:1,className:n==null?void 0:n.headerCellClassName,style:{position:"relative",textAlign:_}},i("div",{style:{...l.flex,...l.itemsStart,justifyContent:_==="right"?"flex-end":_==="center"?"center":"flex-start"}},typeof T.header=="function"?T.header(w):T.header),i("div",{style:{position:"absolute",right:0,top:0,height:"100%",width:"2px",cursor:"col-resize",backgroundColor:Lt("--pc-border-color"),display:"none",transition:"background-color 0.2s ease"},onMouseEnter:R=>{let k=R.currentTarget;k.style.display="block",k.style.backgroundColor=Lt("--pc-primary")},onMouseLeave:R=>{let k=R.currentTarget;k.style.display="none",k.style.backgroundColor=Lt("--pc-border-color")}}))},C=(w,T)=>{let _=t.columns,R=He.Row(w,{className:n==null?void 0:n.rowClassName,style:{...g?{cursor:"pointer"}:{}},onClick:g?()=>g(T.original,T):void 0,onMouseEnter:()=>{y=T.id,x()},onMouseLeave:I=>{let L=I.currentTarget.nextElementSibling,K=I.relatedTarget;L&&K&&L.contains(K)||y===T.id&&(y=null,x())}},..._.map(I=>He.Cell(w,{className:n==null?void 0:n.cellClassName,style:{textAlign:Hd(I.meta)}},I.cell({row:T,getValue:()=>{var L;return(L=I.accessor)==null?void 0:L.call(I,T.original)},ctx:w})))),k={row:T,tr:R,expandedTr:null,expandedCell:null,panel:null};if(A.push(k),!p)return[R];let P=i("div",{style:{overflow:"hidden",maxHeight:"0",opacity:0,transform:"translateY(-6px)",transition:"max-height 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease, transform 220ms ease",willChange:"max-height, opacity, transform"}},p(w,T)),D=He.Cell(w,{colSpan:_.length,className:n==null?void 0:n.expandedCellClassName,style:{padding:"0",height:"0",border:"none"}},P),O=He.Row(w,{className:n==null?void 0:n.expandedRowClassName,style:{pointerEvents:"none"},onMouseEnter:()=>{y=T.id,x()},onMouseLeave:I=>{let L=I.currentTarget.previousElementSibling,K=I.relatedTarget;L&&K&&L.contains(K)||y===T.id&&(y=null,x())}},D);return k.expandedTr=O,k.expandedCell=D,k.panel=P,[R,O]},h=B(e,b,w=>{A=[];let T=t.rows(),_=me(r),R=He.Body(w,{className:n==null?void 0:n.bodyClassName},...T.map(P=>C(w,P))),k=He(w,{variant:o,className:n==null?void 0:n.tableClassName,style:{minWidth:"100%",backgroundColor:Lt("--pc-bg-primary")}},He.Header(w,{className:n==null?void 0:n.headerClassName},He.Row(w,{className:n==null?void 0:n.rowClassName},...t.columns.map(P=>v(w,P)))),R);return u(),x(),[k,_?i("div",{style:{...l.flex,...l.flexCol,...l.itemsCenter,...l.justifyCenter,minHeight:"320px",height:"100%",backgroundColor:Lt("--pc-bg-primary"),transition:"background-color 0.3s ease"}},c?typeof c=="function"?c(w):c:i("div",{style:{...l.flex,...l.flexCol,...l.itemsCenter,...l.justifyCenter,...l.gapMd}},Ve(w),a?i("h6",{style:{...l.fontWeightMedium,color:Lt("--pc-text-secondary"),transition:"color 0.3s ease"}},"Loading..."):null)):null,T.length===0&&!_?i("div",{style:{...l.flex,...l.flexCol,...l.itemsCenter,...l.justifyCenter,minHeight:"320px",padding:Lt("--pc-spacing-2xl"),backgroundColor:Lt("--pc-bg-primary"),transition:"background-color 0.3s ease"}},Ot(w,{icon:jt("svg",{viewBox:"0 0 24 24",fill:"currentColor",style:{width:"64px",height:"64px",color:Lt("--pc-text-tertiary"),transition:"color 0.3s ease"}},jt("path",{d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h16a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1v-2zM3 16a1 1 0 011-1h16a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1v-2z"})),title:d("noData")})):null]});return m.append(h.el),e.watch(t.state,()=>u()),m}var eo=e=>`var(${e})`,Ts=[{value:5,label:"5"},{value:10,label:"10"},{value:15,label:"15"},{value:20,label:"20"},{value:25,label:"25"}];function xr(e,{table:t,showPageSize:o=!0,showSelectedCount:n=!1,className:r,deps:a=[]}){return B(e,[t.state,J(),...a],s=>{let{pageIndex:c,pageSize:p}=t.state.get(),g=Ts.find(w=>w.value===p)||Ts[1],f=c+1,y=t.pageCount(),A=t.rows().length,S=y>0||A>0;if(!S&&A===0&&y===0)return null;let b=()=>t.canPreviousPage(),x=()=>t.canNextPage(),u=(w,T,_,R)=>Nt(s,{size:"sm",variant:"outline","aria-label":w,onClick:_,disabled:!R(),style:{borderRadius:"0.5rem",borderColor:eo("--pc-border-color"),color:eo("--pc-text-primary"),backgroundColor:eo("--pc-bg-primary"),transition:"all 0.2s ease"},onMouseEnter:k=>{if(!R())return;let P=k.currentTarget;P.style.backgroundColor=eo("--pc-bg-hover"),P.style.borderColor=eo("--pc-primary"),P.style.color=eo("--pc-primary")},onMouseLeave:k=>{let P=k.currentTarget;P.style.backgroundColor=eo("--pc-bg-primary"),P.style.borderColor=eo("--pc-border-color"),P.style.color=eo("--pc-text-primary")}},G(T,{size:14})),m=()=>i("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"0.25rem",flexShrink:0}},u(d("goToFirstPage"),"PiCaretDoubleLeftBold",()=>t.setPageIndex(0),b),u(d("goToPreviousPage"),"PiCaretLeftBold",()=>t.setPageIndex(t.state.get().pageIndex-1),b),u(d("goToNextPage"),"PiCaretRightBold",()=>t.setPageIndex(t.state.get().pageIndex+1),x),u(d("goToLastPage"),"PiCaretDoubleRightBold",()=>t.setPageIndex(t.pageCount()-1),x)),v=()=>y>0?i("div",{style:{...l.flex,...l.itemsCenter,...l.gapXs,marginRight:eo("--pc-spacing-xs"),flexShrink:0}},F(s,{size:"sm",color:"secondary",style:{whiteSpace:"nowrap"}},d("pageOf",{current:f,total:y}))):null,C=()=>F(s,{size:"sm",color:"secondary",style:{whiteSpace:"nowrap",flexShrink:0}},d("rowsPerPage")),h=()=>bt(s,{size:"sm",options:Ts,value:g!=null?g:null,onChange:w=>{w&&t.setPageSize(Number(w.value))},style:{width:"56px",minWidth:"56px",flexShrink:0}});return i("div",{className:r,style:{...l.flex,...l.flexCol,...l.itemsCenter,width:"100%",paddingTop:"0.375rem",paddingBottom:"0.125rem",gap:"0.375rem",minHeight:"44px",opacity:S?1:.5,pointerEvents:S?"auto":"none"}},i("div",{style:{...l.flex,...l.flexCol,...l.itemsCenter,...l.gapSm,width:"100%"},className:"pc-block-xs pc-hidden-sm"},o?i("div",{style:{...l.flex,...l.itemsCenter,...l.gapSm,width:"100%",...l.justifyCenter}},C(),h()):null,i("div",{style:{...l.flex,...l.itemsCenter,...l.gapSm,flexWrap:"wrap",...l.justifyCenter}},v(),m())),i("div",{style:{...l.flex,...l.itemsCenter,...l.justifyBetween,width:"100%",flexWrap:"wrap",gap:eo("--pc-spacing-sm")},className:"pc-hidden-xs pc-flex-sm"},i("div",{style:{...l.flex,...l.itemsCenter,...l.gapSm,flexShrink:0,flexWrap:"wrap"}},o?i("div",{style:{...l.flex,...l.itemsCenter,...l.gapSm,flexShrink:0}},C(),h()):null,n?F(s,{size:"sm",color:"secondary",style:{whiteSpace:"nowrap",flexShrink:0}},d("rowsSelected",{count:0,total:A})):null),i("div",{style:{...l.flex,...l.itemsCenter,...l.gapSm,flexShrink:0,flexWrap:"wrap"}},v(),m())))}).el}var lo=qe("usePageChrome");function Fd(){let e=j({pageChromeOverride:null,headerStatus:null});return{state:e,setPageChromeOverride:t=>e.set({pageChromeOverride:t}),clearPageChromeOverride:()=>e.set({pageChromeOverride:null}),setHeaderStatus:t=>e.set({headerStatus:t})}}var Ud=bd,zy=["=","+","-","@"," ","\r"],qy="\uFEFF",Es=()=>[{label:d("statusActive"),value:"ACTIVE"},{label:d("statusWithdrawn"),value:"WITHDRAW"},{label:d("statusExpired"),value:"EXPIRED"},{label:d("statusDeclined"),value:"DECLINED"}],zd=e=>{var s;if(!e||e.length===0)return;let t=c=>{let p=c!=null?c:"";return`"${(p.length>0&&zy.includes(p.charAt(0))?`'${p}`:p).replace(/"/g,'""')}"`},o=Object.keys((s=e[0])!=null?s:{}),n=o.map(t).join(","),r=e.map(c=>o.map(p=>t(c[p])).join(",")),a=[n,...r].join(`
|
|
666
|
-
`);try{let c=new Blob([qy,a],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(c),g=document.createElement("a");g.href=p,g.setAttribute("download","consent-records.csv"),document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(p)}catch(c){console.error("Failed to export CSV:",c)}};var Tt=e=>`var(${e})`,co=(e,t,o=Tt("--pc-border-radius-md"))=>i("div",{style:{height:e,width:t,animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",borderRadius:o,backgroundColor:Tt("--pc-bg-tertiary")}}),qd={display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:Tt("--pc-spacing-md"),paddingLeft:Tt("--pc-spacing-lg"),paddingRight:Tt("--pc-spacing-lg"),paddingTop:Tt("--pc-spacing-md"),paddingBottom:Tt("--pc-spacing-md")},Vd=e=>i("div",{style:{borderRadius:`${Tt("--pc-border-radius-lg")} ${Tt("--pc-border-radius-lg")} 0 0`,border:`1px solid ${Tt("--pc-border-color")}`,borderBottom:"none",backgroundColor:Tt("--pc-bg-primary")}},i("div",{style:{borderBottom:`1px solid ${Tt("--pc-border-color")}`,backgroundColor:Tt("--pc-bg-secondary")}},i("div",{style:qd,className:"pc-grid-responsive"},...Array.from({length:7},()=>co("1rem","6rem")))),...Array.from({length:yi},(t,o)=>i("div",{style:{borderBottom:o===yi-1?"none":`1px solid ${Tt("--pc-border-color")}`,backgroundColor:Tt("--pc-bg-primary")}},i("div",{style:qd,className:"pc-grid-responsive"},i("div",{style:{...l.flex,...l.flexCol,...l.gapXs}},co("1rem","8rem"),co("0.75rem","12rem")),i("div",{style:{...l.flex,...l.flexCol,...l.gapXs}},co("1rem","6rem"),co("0.75rem","8rem")),i("div",{style:{...l.flex,...l.itemsCenter}},co("1.5rem","5rem","9999px")),i("div",{style:{...l.flex,...l.itemsCenter}},co("1rem","6rem")),i("div",{style:{...l.flex,...l.itemsCenter}},co("1rem","6rem")),i("div",{style:{...l.flex,...l.itemsCenter}},co("1rem","4rem")),i("div",{style:{...l.flex,...l.itemsCenter}},co("1.5rem","4rem"))))));var tt={yes:"Yes",no:"No",mixed:"Partly",savedAnswer:"Saved answer: {answer}",confirmAcceptAllTitle:"Accept every purpose?",confirmAcceptAllDetail:"This agrees to all purposes on this notice, including any you left unselected.",confirmAcceptSelectedTitle:"Confirm your selections?",confirmAcceptSelectedDetail:"Only the purposes you selected are recorded as agreed. The rest are recorded as not agreed.",confirmDeclineTitle:"Decline this notice?",confirmDeclineDetail:"Nothing is recorded as agreed, including any purposes you selected.",otpTitle:"Enter the verification code",otpDescription:"Ask the customer to read out the code they were sent. Your selections are locked until it is confirmed.",otpSubmit:"Confirm code",otpVerifying:"Verifying...",otpFailed:"Could not verify that code.",productPoliciesLabel:"Privacy policies:",hintNothingChosen:"Select at least one purpose to confirm.",hintNothingEngaged:"Select or change a purpose for the product you are consenting to.",hintRequiredOutstanding:"Accept the required purposes to confirm."};var Gd="https://api.redacto.io/consent";var Lk={"nothing-chosen":tt.hintNothingChosen,"nothing-engaged":tt.hintNothingEngaged,"required-outstanding":tt.hintRequiredOutstanding,productsIncomplete:e=>`Accept the required purposes for ${e.join(", ")} to confirm.`};var Bk={title:tt.otpTitle,description:tt.otpDescription,submit:tt.otpSubmit,verifying:tt.otpVerifying,failed:tt.otpFailed},Hk=tt.productPoliciesLabel;var Fk={onRecord:e=>tt.savedAnswer.replace("{answer}",e),mixed:tt.mixed,options:[{label:tt.yes,value:!0},{label:tt.no,value:!1}]};var Uk={"accept-all":{title:tt.confirmAcceptAllTitle,detail:tt.confirmAcceptAllDetail},"accept-selected":{title:tt.confirmAcceptSelectedTitle,detail:tt.confirmAcceptSelectedDetail},decline:{title:tt.confirmDeclineTitle,detail:tt.confirmDeclineDetail},confirm:tt.yes,cancel:tt.no};var On="data-redacto-notice-font";var zk=`
|
|
666
|
+
`);try{let c=new Blob([qy,a],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(c),g=document.createElement("a");g.href=p,g.setAttribute("download","consent-records.csv"),document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(p)}catch(c){console.error("Failed to export CSV:",c)}};var Tt=e=>`var(${e})`,co=(e,t,o=Tt("--pc-border-radius-md"))=>i("div",{style:{height:e,width:t,animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",borderRadius:o,backgroundColor:Tt("--pc-bg-tertiary")}}),qd={display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:Tt("--pc-spacing-md"),paddingLeft:Tt("--pc-spacing-lg"),paddingRight:Tt("--pc-spacing-lg"),paddingTop:Tt("--pc-spacing-md"),paddingBottom:Tt("--pc-spacing-md")},Vd=e=>i("div",{style:{borderRadius:`${Tt("--pc-border-radius-lg")} ${Tt("--pc-border-radius-lg")} 0 0`,border:`1px solid ${Tt("--pc-border-color")}`,borderBottom:"none",backgroundColor:Tt("--pc-bg-primary")}},i("div",{style:{borderBottom:`1px solid ${Tt("--pc-border-color")}`,backgroundColor:Tt("--pc-bg-secondary")}},i("div",{style:qd,className:"pc-grid-responsive"},...Array.from({length:7},()=>co("1rem","6rem")))),...Array.from({length:yi},(t,o)=>i("div",{style:{borderBottom:o===yi-1?"none":`1px solid ${Tt("--pc-border-color")}`,backgroundColor:Tt("--pc-bg-primary")}},i("div",{style:qd,className:"pc-grid-responsive"},i("div",{style:{...l.flex,...l.flexCol,...l.gapXs}},co("1rem","8rem"),co("0.75rem","12rem")),i("div",{style:{...l.flex,...l.flexCol,...l.gapXs}},co("1rem","6rem"),co("0.75rem","8rem")),i("div",{style:{...l.flex,...l.itemsCenter}},co("1.5rem","5rem","9999px")),i("div",{style:{...l.flex,...l.itemsCenter}},co("1rem","6rem")),i("div",{style:{...l.flex,...l.itemsCenter}},co("1rem","6rem")),i("div",{style:{...l.flex,...l.itemsCenter}},co("1rem","4rem")),i("div",{style:{...l.flex,...l.itemsCenter}},co("1.5rem","4rem"))))));var tt={yes:"Yes",no:"No",mixed:"Partly",savedAnswer:"Saved answer: {answer}",confirmAcceptAllTitle:"Accept every purpose?",confirmAcceptAllDetail:"This agrees to all purposes on this notice, including any you left unselected.",confirmAcceptSelectedTitle:"Confirm your selections?",confirmAcceptSelectedDetail:"Only the purposes you selected are recorded as agreed. The rest are recorded as not agreed.",confirmDeclineTitle:"Decline this notice?",confirmDeclineDetail:"Nothing is recorded as agreed, including any purposes you selected.",otpTitle:"Enter the verification code",otpDescription:"Ask the customer to read out the code they were sent. Your selections are locked until it is confirmed.",otpSubmit:"Confirm code",otpVerifying:"Verifying...",otpFailed:"Could not verify that code.",productPoliciesLabel:"Privacy policies:",hintNothingChosen:"Select at least one purpose to confirm.",hintNothingEngaged:"Select or change a purpose for the product you are consenting to.",hintRequiredOutstanding:"Accept the required purposes to confirm.",errorTitle:"Error Loading Consent Notice",errorMessage:"Failed to load consent notice. Please try again.",errorRefresh:"Refresh",errorClose:"Close error message"};var Gd="https://api.redacto.io/consent";var Lk={"nothing-chosen":tt.hintNothingChosen,"nothing-engaged":tt.hintNothingEngaged,"required-outstanding":tt.hintRequiredOutstanding,productsIncomplete:e=>`Accept the required purposes for ${e.join(", ")} to confirm.`};var Bk={title:tt.otpTitle,description:tt.otpDescription,submit:tt.otpSubmit,verifying:tt.otpVerifying,failed:tt.otpFailed},Hk=tt.productPoliciesLabel;var Fk={onRecord:e=>tt.savedAnswer.replace("{answer}",e),mixed:tt.mixed,options:[{label:tt.yes,value:!0},{label:tt.no,value:!1}]};var Uk={"accept-all":{title:tt.confirmAcceptAllTitle,detail:tt.confirmAcceptAllDetail},"accept-selected":{title:tt.confirmAcceptSelectedTitle,detail:tt.confirmAcceptSelectedDetail},decline:{title:tt.confirmDeclineTitle,detail:tt.confirmDeclineDetail},confirm:tt.yes,cancel:tt.no};var On="data-redacto-notice-font";var zk=`
|
|
667
667
|
[${On}] button,
|
|
668
668
|
[${On}] input,
|
|
669
669
|
[${On}] optgroup,
|