(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4650],{68523:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings/regulations",function(){return t(66773)}])},66773:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return L}});var i=t(24246),s=t(36010),l=t(79894),o=t.n(l),a=t(16134),r=t(59849),c=t(77213),d=t(77830),u=t(58754),h=t(64781),g=t(98784),m=t.n(g),p=t(86677),x=t(27378),j=t(812),C=t(58452),f=t(26917),y=t(46628),v=t(26089),w=t(31883),_=t(61524),S=t(67991),O=t(12282),k=e=>{let{regulations:n,isOpen:t,onClose:l,selected:o,onChange:a}=e,[r,c]=(0,x.useState)(o),{allSelected:d,handleToggleAll:u,handleToggleSelection:h}=(0,S.QZ)({items:n,selected:r,onChange:c}),g=r.length,m=n[0].continent;return(0,i.jsxs)(s.TGG,{size:"2xl",isOpen:t,onClose:l,isCentered:!0,children:[(0,i.jsx)(s.T5Q,{}),(0,i.jsxs)(s.Z8H,{"data-testid":"regulation-modal",children:[(0,i.jsx)(O.h4,{title:"Select regulations"}),(0,i.jsxs)(s.zOL,{p:6,maxHeight:"70vh",overflowY:"auto",children:[(0,i.jsx)(O.x$,{title:m,allSelected:d,onToggleAll:u,numSelected:g}),(0,i.jsx)(s.RmD,{columns:3,spacing:6,paddingInline:4,children:n.map(e=>(0,i.jsx)(s.gxE,{size:"sm",colorScheme:"complimentary",isChecked:r.includes(e.id),onChange:()=>h(e.id),"data-testid":"".concat(e.name,"-checkbox"),children:e.name},e.id))})]}),(0,i.jsx)(O.$_,{onApply:()=>{a(r),l()},onClose:l})]})]})},E=e=>{let{title:n,items:t,selected:l,onChange:o}=e,a=(0,s.E2M)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_.ZP,{title:n,items:t,selected:l,onChange:o,numSelected:l.length,indeterminate:[],onViewMore:t.length>_.I_?a.onOpen:void 0}),(0,i.jsx)(k,{regulations:t,isOpen:a.isOpen,onClose:a.onClose,selected:l,onChange:o},"regulation-modal-selected-".concat(l.length))]})},T=t(85759);let Z=(e,n)=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLocaleLowerCase().includes(n.toLocaleLowerCase())};var b=e=>{var n;let{data:t}=e,l=(0,s.p8r)(),o=(0,s.E2M)(),[a,r]=(0,x.useState)(null!==(n=t.regulations)&&void 0!==n?n:[]),[c,u]=(0,x.useState)(""),[g,{isLoading:_}]=(0,h.WA)(),S=(0,x.useMemo)(()=>{var e,n;let i=null!==(n=null===(e=t.regulations)||void 0===e?void 0:e.filter(e=>Z(e,c)))&&void 0!==n?n:[];return(0,T.F7)(i)},[t.regulations,c]),O=!m().isEqual(a,t.regulations),k=(0,p.useRouter)(),b=()=>{k.push(d.r5).then(()=>{l.closeAll()})},L=async()=>{let e=await g({regulations:a.map(e=>({id:e.id,selected:e.selected})),locations:[]});(0,w.D4)(e)?l((0,y.Vo)((0,j.e$)(e.error))):l((0,y.t5)((0,i.jsxs)(s.Bjg,{display:"inline",children:["Fides has automatically associated the relevant locations with your regulation choices.",(0,i.jsx)(v.Z,{onClick:b,children:"View locations here."})]})))},M=e=>{r(a.map(n=>{let t=e.find(e=>e.id===n.id);return null!=t?t:n}))};return(0,i.jsxs)(s.s_g,{alignItems:"start",spacing:4,children:[(0,i.jsx)(s.TJV,{maxWidth:"510px",width:"100%",children:(0,i.jsx)(f.Z,{onChange:u,placeholder:"Search",value:c,onClear:()=>u("")})}),(0,i.jsx)(s.RmD,{columns:{base:1,md:2,xl:3},spacing:6,width:"100%",children:Object.entries(S).map(e=>{let[n,t]=e,s=a.filter(e=>t.find(n=>n.id===e.id)&&e.selected).map(e=>e.id);return(0,i.jsx)(E,{title:n,items:t,selected:s,onChange:e=>{M(t.map(n=>e.includes(n.id)?{...n,selected:!0}:{...n,selected:!1}))}},n)})}),(0,i.jsx)(C.Z,{isOpen:o.isOpen,onClose:o.onClose,onConfirm:()=>{L(),o.onClose()},title:"Location updates",message:"Modifications in your regulation settings may also affect your location settings to simplify management. You can override any Fides-initiated changes directly in the location settings.",isCentered:!0,icon:(0,i.jsx)(s.aNP,{color:"orange"})}),O&&(0,i.jsx)(s.zxk,{type:"primary",onClick:o.onOpen,loading:_,"data-testid":"save-btn",children:"Save"})]})},L=()=>{let{isLoading:e,error:n}=(0,h.QM)(),t=(0,a.C)(h.P8);return n?(0,i.jsx)(r.Z,{error:n,defaultMessage:"A problem occurred while fetching regulations settings"}):(0,i.jsx)(c.Z,{title:"Regulations",children:(0,i.jsxs)(s.TJV,{"data-testid":"regulation-management",children:[(0,i.jsx)(u.Z,{heading:"Regulations"}),(0,i.jsxs)(s.Bjg,{pb:6,fontSize:"sm",maxWidth:"600px",children:["Select the regulations that apply to your organizations compliance requirements. The selections you make here will automatically update your location selections."," ",(0,i.jsx)(s.iUA,{as:o(),href:d.r5,color:"complimentary.500",children:"You can view your location settings here."})]}),(0,i.jsx)(s.TJV,{children:e?(0,i.jsx)(s.Y6B,{}):(0,i.jsx)(b,{data:t})})]})})}}},function(e){e.O(0,[5791,2888,9774,179],function(){return e(e.s=68523)}),_N_E=e.O()}]);