@tantainnovative/ndpr-toolkit 3.3.0 → 3.4.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.
Files changed (176) hide show
  1. package/CHANGELOG.md +529 -0
  2. package/README.md +4 -4
  3. package/dist/{ConsentBanner-CDRT0o2k.d.mts → ConsentBanner-F5ayys5K.d.mts} +10 -0
  4. package/dist/{ConsentBanner-Vxyt8SCX.d.ts → ConsentBanner-VqIPophc.d.ts} +10 -0
  5. package/dist/{styling-B7CBzYG7.d.ts → ConsentManager-C7I3PDe8.d.mts} +2 -62
  6. package/dist/{styling-uJLsBbER.d.mts → ConsentManager-CQ2IZtUU.d.ts} +2 -62
  7. package/dist/{sanitize-B0AzEm1D.d.mts → NDPRProvider-DYFb8xEl.d.ts} +2 -94
  8. package/dist/{sanitize-B0AzEm1D.d.ts → NDPRProvider-U3QNu6MA.d.mts} +2 -94
  9. package/dist/adapters.js +1 -1
  10. package/dist/adapters.mjs +1 -1
  11. package/dist/breach.js +1 -1
  12. package/dist/breach.mjs +1 -1
  13. package/dist/chunk-2AW7KAZO.mjs +2 -0
  14. package/dist/chunk-2WH4DLV5.js +3 -0
  15. package/dist/chunk-3NQQSU4P.js +2 -0
  16. package/dist/chunk-3VQAYQR7.js +7 -0
  17. package/dist/chunk-4R42ZNO7.mjs +318 -0
  18. package/dist/chunk-5HL4UBFV.js +2 -0
  19. package/dist/chunk-6FGCGLH5.mjs +2 -0
  20. package/dist/chunk-6HZL2WDU.mjs +2 -0
  21. package/dist/chunk-6QPRDQZF.js +2 -0
  22. package/dist/chunk-74Z23WUA.mjs +2 -0
  23. package/dist/chunk-AHSMDPG5.js +132 -0
  24. package/dist/chunk-BN77GP4W.mjs +2 -0
  25. package/dist/chunk-C5QO3SX4.js +2 -0
  26. package/dist/chunk-CISJAQ6W.mjs +2 -0
  27. package/dist/chunk-DCJK5OZT.mjs +2 -0
  28. package/dist/chunk-DUY6F3GT.mjs +94 -0
  29. package/dist/chunk-EHAZIKDX.js +81 -0
  30. package/dist/chunk-EPT2K355.mjs +2 -0
  31. package/dist/chunk-HGGLW5TE.js +2 -0
  32. package/dist/chunk-HQSU7LGM.js +94 -0
  33. package/dist/chunk-IZCWCE7W.mjs +2 -0
  34. package/dist/chunk-JBSCER34.js +2 -0
  35. package/dist/chunk-KF3EFJEF.mjs +3 -0
  36. package/dist/chunk-KSERBMXW.mjs +4 -0
  37. package/dist/chunk-LJNNPAFU.mjs +2 -0
  38. package/dist/{chunk-UXMGBIX6.js → chunk-LSCMXAPY.mjs} +4 -4
  39. package/dist/chunk-LSNL4XR5.js +2 -0
  40. package/dist/chunk-M2TPT5GB.js +2 -0
  41. package/dist/chunk-MCWV7S2G.js +2 -0
  42. package/dist/chunk-MG73MOZC.mjs +15 -0
  43. package/dist/chunk-NCOZB2WU.mjs +2 -0
  44. package/dist/chunk-NQNFS3QI.js +7 -0
  45. package/dist/chunk-OPYQIJKY.js +2 -0
  46. package/dist/{chunk-ZEOQYWOE.mjs → chunk-P2YV6DR3.js} +4 -4
  47. package/dist/chunk-P6QAFBCV.js +2 -0
  48. package/dist/chunk-QVULSG6J.mjs +3 -0
  49. package/dist/chunk-R5FW5XUQ.mjs +2 -0
  50. package/dist/chunk-RGNP45VR.js +2 -0
  51. package/dist/chunk-RLYTX3MM.js +2 -0
  52. package/dist/chunk-RNTNHVKZ.js +15 -0
  53. package/dist/chunk-RRVKUCFR.mjs +2 -0
  54. package/dist/chunk-RXL6CZAI.js +2 -0
  55. package/dist/chunk-RY3PGVLZ.mjs +2 -0
  56. package/dist/chunk-SUEGUY35.js +2 -0
  57. package/dist/chunk-SYMQJO2W.mjs +7 -0
  58. package/dist/chunk-TCN22KYP.mjs +7 -0
  59. package/dist/chunk-UFPSUO52.js +318 -0
  60. package/dist/chunk-VTITKWGX.mjs +2 -0
  61. package/dist/chunk-WH6ZMUOS.mjs +81 -0
  62. package/dist/chunk-WTJGLNTB.js +3 -0
  63. package/dist/chunk-XHROISIF.mjs +2 -0
  64. package/dist/chunk-XMBSJJ5U.js +4 -0
  65. package/dist/chunk-XSEZDQLB.js +2 -0
  66. package/dist/chunk-Z6IIMLZU.mjs +2 -0
  67. package/dist/chunk-ZLSWOFAY.mjs +132 -0
  68. package/dist/chunk-ZPKVLTSX.js +2 -0
  69. package/dist/consent.d.mts +6 -4
  70. package/dist/consent.d.ts +6 -4
  71. package/dist/consent.js +1 -1
  72. package/dist/consent.mjs +1 -1
  73. package/dist/core.d.mts +6 -25
  74. package/dist/core.d.ts +6 -25
  75. package/dist/core.js +1 -1
  76. package/dist/core.mjs +1 -1
  77. package/dist/cross-border.d.mts +2 -2
  78. package/dist/cross-border.d.ts +2 -2
  79. package/dist/cross-border.js +1 -1
  80. package/dist/cross-border.mjs +1 -1
  81. package/dist/docx-BxKascXN.d.ts +64 -0
  82. package/dist/docx-CV7Vsry_.d.mts +64 -0
  83. package/dist/dpia.js +1 -1
  84. package/dist/dpia.mjs +1 -1
  85. package/dist/dsr.js +1 -1
  86. package/dist/dsr.mjs +1 -1
  87. package/dist/hooks.d.mts +4 -4
  88. package/dist/hooks.d.ts +4 -4
  89. package/dist/hooks.js +1 -1
  90. package/dist/hooks.mjs +1 -1
  91. package/dist/index.d.mts +8 -6
  92. package/dist/index.d.ts +8 -6
  93. package/dist/index.js +1 -1
  94. package/dist/index.mjs +1 -1
  95. package/dist/lawful-basis.js +1 -1
  96. package/dist/lawful-basis.mjs +1 -1
  97. package/dist/locale-CxJx2tzn.d.mts +25 -0
  98. package/dist/locale-DSkrtf-c.d.ts +25 -0
  99. package/dist/{policy-engine-C6nC2t3a.d.ts → policy-engine-CCUCud2T.d.ts} +1 -1
  100. package/dist/{policy-engine-DefZcX3R.d.mts → policy-engine-fYSqEqSW.d.mts} +1 -1
  101. package/dist/{policy-sections-DFDPVCCg.d.ts → policy-sections-BYx6fEFk.d.ts} +4 -2
  102. package/dist/{policy-sections-Bylm31kZ.d.mts → policy-sections-Dm97Nq8m.d.mts} +4 -2
  103. package/dist/{policy-templates-CIKcV0i1.d.ts → policy-templates-DhLwq4R-.d.ts} +8 -1
  104. package/dist/{policy-templates-DMsPwOSZ.d.mts → policy-templates-DwYl2329.d.mts} +8 -1
  105. package/dist/policy.d.mts +36 -71
  106. package/dist/policy.d.ts +36 -71
  107. package/dist/policy.js +1 -1
  108. package/dist/policy.mjs +1 -1
  109. package/dist/presets.d.mts +2 -2
  110. package/dist/presets.d.ts +2 -2
  111. package/dist/presets.js +1 -1
  112. package/dist/presets.mjs +1 -1
  113. package/dist/ropa.js +1 -1
  114. package/dist/ropa.mjs +1 -1
  115. package/dist/sanitize-CxxwKxAx.d.mts +94 -0
  116. package/dist/sanitize-CxxwKxAx.d.ts +94 -0
  117. package/dist/server.d.mts +24 -0
  118. package/dist/server.d.ts +24 -0
  119. package/dist/server.js +2 -0
  120. package/dist/server.mjs +2 -0
  121. package/dist/styles.css +1423 -31
  122. package/dist/styling-BMDGQDgS.d.mts +64 -0
  123. package/dist/styling-BaoQtV06.d.ts +64 -0
  124. package/dist/unstyled.d.mts +52 -19
  125. package/dist/unstyled.d.ts +52 -19
  126. package/dist/unstyled.js +1 -1
  127. package/dist/unstyled.mjs +1 -1
  128. package/dist/{useAdaptivePolicyWizard-A1PyOy6P.d.mts → useAdaptivePolicyWizard-BnjW4OR4.d.mts} +1 -1
  129. package/dist/{useAdaptivePolicyWizard-LVIKhAxw.d.ts → useAdaptivePolicyWizard-sb3m4-Zk.d.ts} +1 -1
  130. package/dist/{useCrossBorderTransfer-BGNZt2lk.d.mts → useCrossBorderTransfer-DixjLjN1.d.mts} +1 -1
  131. package/dist/{useCrossBorderTransfer-COqjgjsu.d.ts → useCrossBorderTransfer-DvSq06lv.d.ts} +1 -1
  132. package/dist/{useDefaultPrivacyPolicy-BsYttRey.d.mts → useDefaultPrivacyPolicy-Cs2WQSYQ.d.mts} +34 -9
  133. package/dist/{useDefaultPrivacyPolicy-C-mG-A5S.d.ts → useDefaultPrivacyPolicy-DkOqMg2e.d.ts} +34 -9
  134. package/package.json +20 -6
  135. package/dist/chunk-256APOQM.js +0 -2
  136. package/dist/chunk-25OOUES4.js +0 -2
  137. package/dist/chunk-4JKTIR33.mjs +0 -2
  138. package/dist/chunk-5BUS6AI7.js +0 -2
  139. package/dist/chunk-6BXUVS6E.js +0 -81
  140. package/dist/chunk-6JCRDJQI.mjs +0 -2
  141. package/dist/chunk-6RQGQZT2.js +0 -2
  142. package/dist/chunk-6YN73KR7.mjs +0 -2
  143. package/dist/chunk-CDZDT2OS.mjs +0 -320
  144. package/dist/chunk-CSIJCLGZ.mjs +0 -2
  145. package/dist/chunk-CWUPGY3M.mjs +0 -3
  146. package/dist/chunk-E63VPR7U.js +0 -2
  147. package/dist/chunk-FDDI426Y.mjs +0 -2
  148. package/dist/chunk-GCQRHMTQ.mjs +0 -144
  149. package/dist/chunk-GMLCWGNJ.js +0 -7
  150. package/dist/chunk-GQVNLUP2.js +0 -94
  151. package/dist/chunk-GXLSOZCH.mjs +0 -2
  152. package/dist/chunk-IQJO7WIH.js +0 -7
  153. package/dist/chunk-LETEUS5X.mjs +0 -2
  154. package/dist/chunk-LU4PFST7.js +0 -144
  155. package/dist/chunk-M6XETYNL.js +0 -2
  156. package/dist/chunk-NBSVFQ5G.js +0 -2
  157. package/dist/chunk-NUDVUAD4.mjs +0 -81
  158. package/dist/chunk-NUULHXVL.mjs +0 -7
  159. package/dist/chunk-PM7O5IGE.mjs +0 -2
  160. package/dist/chunk-Q7VHB64E.mjs +0 -2
  161. package/dist/chunk-QDHHD2KR.mjs +0 -94
  162. package/dist/chunk-SAA7UVI2.js +0 -3
  163. package/dist/chunk-TI2M7H6R.mjs +0 -7
  164. package/dist/chunk-TKVJ3OOV.mjs +0 -2
  165. package/dist/chunk-TXXWCB5O.js +0 -320
  166. package/dist/chunk-UGY5ZYUG.js +0 -2
  167. package/dist/chunk-UO6QPJLH.js +0 -2
  168. package/dist/chunk-UX6ZZNEM.mjs +0 -3
  169. package/dist/chunk-VLSGE2YA.js +0 -2
  170. package/dist/chunk-XFUEZ3MP.mjs +0 -2
  171. package/dist/chunk-XHSHPB74.js +0 -2
  172. package/dist/chunk-YCX6BFOQ.js +0 -2
  173. package/dist/chunk-YURSF2YO.mjs +0 -2
  174. package/dist/chunk-YZXUAIYN.js +0 -3
  175. package/dist/chunk-ZGJA7OO4.js +0 -2
  176. package/dist/chunk-ZT7KNFAU.mjs +0 -2
@@ -1,94 +0,0 @@
1
- import {b,c,a as a$2}from'./chunk-ZEOQYWOE.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {d,b as b$1,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useId,useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var fe=({sections:E=b,variables:M=c,onGenerate:T,title:Y="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:N="",buttonClassName:F="",generateButtonText:Q="Generate Policy",showPreview:R=true,allowEditing:X=true,classNames:r,unstyled:h=false})=>{let P=useId(),[A,a$3]=useState(E),[o,g]=useState(M),[s,$]=useState("sections"),[L,J]=useState(""),[I,q]=useState(""),[K,Z]=useState(false),[v,O]=useState({});useEffect(()=>{a$3(E);},[E]),useEffect(()=>{g(M);},[M]);let G=l=>{a$3(c=>c.map(d=>d.id===l?b$1(a$1({},d),{included:!d.included}):d));},W=(l,c)=>{g(d=>d.map(u=>u.id===l?b$1(a$1({},u),{value:c}):u)),v[l]&&O(d=>{let u=a$1({},d);return delete u[l],u});},j=()=>{let l={},c=true;return o.forEach(d=>{d.required&&!d.value&&(l[d.id]=`${d.name} is required`,c=false);}),O(l),c},ee=()=>{if(!j()){$("variables");return}let l=A.filter(u=>u.included),c=Object.fromEntries(o.map(u=>[u.name,u.value])),d="";l.forEach(u=>{d+=`## ${u.title}
2
-
3
- `,d+=a$2(u.template,c),d+=`
4
-
5
- `;}),J(d),q(d),Z(true),$("preview");},x=()=>{T({sections:A,variables:o,content:X?I:L});},m=()=>jsxs("div",{className:a("space-y-4",r==null?void 0:r.sectionList,h),role:"group","aria-labelledby":`${P}-sections-heading`,children:[jsx("h3",{id:`${P}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),A.map(l=>{let c=`${P}-section-${l.id}`,d=l.description?`${P}-section-desc-${l.id}`:void 0;return jsx("div",{className:a("border border-gray-200 dark:border-gray-700 rounded-md p-4",r==null?void 0:r.sectionItem,h),children:jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:c,type:"checkbox",checked:l.included,onChange:()=>G(l.id),disabled:l.required,"aria-describedby":d,className:a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",r==null?void 0:r.input,h)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:c,className:"font-medium text-gray-900 dark:text-white",children:[l.title," ",l.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),l.required&&jsx("span",{className:"sr-only",children:" (required)"})]}),l.description&&jsx("p",{id:d,className:"text-gray-600 dark:text-gray-400 mt-1",children:l.description})]})]})},l.id)}),jsx("div",{className:"mt-6",children:jsx("button",{onClick:()=>$("variables"),className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${F}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),h),children:"Next: Fill Variables"})})]}),w=()=>{let l={};return o.forEach(c=>{let d=c.id.split(".")[0];l[d]||(l[d]=[]),l[d].push(c);}),jsxs("div",{className:a("",r==null?void 0:r.form,h),children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsx("div",{className:"space-y-6",children:Object.entries(l).map(([c,d])=>{let u=A.find(e=>e.id===c);return u&&!u.included?null:jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsx("h4",{className:"font-medium text-lg mb-3",children:u?u.title:"General Information"}),jsx("div",{className:"space-y-4",children:d.map(e=>{let f=`${P}-var-${e.id}`,b=e.description?`${P}-var-desc-${e.id}`:void 0,z=v[e.id]?`${P}-var-err-${e.id}`:void 0,B=[b,z].filter(Boolean).join(" ")||void 0;return jsxs("div",{children:[jsxs("label",{htmlFor:f,className:"block text-sm font-medium mb-1",children:[e.name," ",e.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),e.description&&jsx("p",{id:b,className:"text-xs text-gray-600 dark:text-gray-400 mb-2",children:e.description}),e.inputType==="textarea"?jsx("textarea",{id:f,value:e.value,onChange:D=>W(e.id,D.target.value),rows:4,className:a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,h),required:e.required,"aria-required":e.required||void 0,"aria-describedby":B,"aria-invalid":v[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxs("select",{id:f,value:e.value,onChange:D=>W(e.id,D.target.value),className:a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,h),required:e.required,"aria-required":e.required||void 0,"aria-describedby":B,"aria-invalid":v[e.id]?true:void 0,children:[jsx("option",{value:"",children:"Select an option"}),e.options.map(D=>jsx("option",{value:D,children:D},D))]}):jsx("input",{id:f,type:e.inputType,value:e.value,onChange:D=>W(e.id,D.target.value),className:a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,h),required:e.required,"aria-required":e.required||void 0,"aria-describedby":B,"aria-invalid":v[e.id]?true:void 0}),v[e.id]&&jsx("p",{id:z,role:"alert",className:"mt-1 text-sm text-red-600 dark:text-red-500",children:v[e.id]})]},e.id)})})]},c)})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${F}`,children:"Back to Sections"}),jsx("button",{onClick:ee,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${F}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),h),children:Q})]})]})},C=()=>{let l=`${P}-policy-content`;return jsxs("div",{children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),X?jsxs("div",{className:"mb-4",children:[jsx("label",{htmlFor:l,className:"block text-sm font-medium mb-1",children:"Edit Policy Content"}),jsx("textarea",{id:l,value:I,onChange:c=>q(c.target.value),rows:20,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] font-mono text-sm"})]}):jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-4","aria-live":"polite",children:jsx("div",{className:"prose dark:prose-invert max-w-none",children:L.split(`
6
- `).map((c,d)=>c.startsWith("## ")?jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},d):c.startsWith("### ")?jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},d):c===""?jsx("br",{},d):jsx("p",{className:"mb-2",children:c},d))})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${F}`,children:"Back to Variables"}),jsx("button",{onClick:x,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${F}`,children:"Save Policy"})]})]})},U=()=>{switch(s){case "sections":return m();case "variables":return w();case "preview":return C();default:return m()}};return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${N}`,r==null?void 0:r.root,h),children:[jsxs("div",{className:a("mb-6",r==null?void 0:r.header,h),children:[jsx("h2",{className:a("text-xl font-bold mb-2",r==null?void 0:r.title,h),children:Y}),jsx("p",{className:a("text-gray-600 dark:text-gray-300",r==null?void 0:r.description,h),children:V})]}),jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxs("ol",{className:"flex items-center w-full",children:[jsxs("li",{className:`flex w-full items-center ${s==="sections"?"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${s==="sections"?"bg-[rgb(var(--ndpr-primary)/0.1)] dark:bg-[rgb(var(--ndpr-primary)/0.2)]":"bg-gray-100 dark:bg-gray-700"} rounded-full shrink-0`,"aria-current":s==="sections"?"step":void 0,children:"1"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsx("span",{className:"sr-only",children:s==="sections"?" (current step)":""})]}),jsxs("li",{className:`flex w-full items-center ${s==="variables"?"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${s==="variables"?"bg-[rgb(var(--ndpr-primary)/0.1)] dark:bg-[rgb(var(--ndpr-primary)/0.2)]":"bg-gray-100 dark:bg-gray-700"} rounded-full shrink-0`,"aria-current":s==="variables"?"step":void 0,children:"2"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsx("span",{className:"sr-only",children:s==="variables"?" (current step)":""})]}),jsxs("li",{className:`flex items-center ${s==="preview"?"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400"}`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${s==="preview"?"bg-[rgb(var(--ndpr-primary)/0.1)] dark:bg-[rgb(var(--ndpr-primary)/0.2)]":"bg-gray-100 dark:bg-gray-700"} rounded-full shrink-0`,"aria-current":s==="preview"?"step":void 0,children:"3"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsx("span",{className:"sr-only",children:s==="preview"?" (current step)":""})]})]})}),jsxs("div",{className:a("mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",r==null?void 0:r.complianceNotice,h),children:[jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"text-blue-700 dark:text-blue-300 text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),U()]})};var Ee=({content:E,sections:M,variables:T,onExport:Y,onEdit:V,title:N="Privacy Policy Preview",description:F="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:R="",showExportOptions:X=true,showEditButton:r=true,showTableOfContents:h=true,showMetadata:P=true,organizationName:A,lastUpdated:a$1=new Date,classNames:o,unstyled:g=false})=>{let s=useId(),[$,L]=useState("preview"),J=`${s}-tab-preview`,I=`${s}-tab-markdown`,q=`${s}-panel-preview`,K=`${s}-panel-markdown`,v=(()=>{let x=E.split(`
7
- `),m=[];return x.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),U=`${s}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;m.push({id:U,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),U=`${s}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;m.push({id:U,title:C,level:3});}}),m})(),O=x=>{if(Y)Y(x);else if(x==="markdown"){let m=document.createElement("a"),w=new Blob([E],{type:"text/markdown"});m.href=URL.createObjectURL(w),m.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(m),m.click(),document.body.removeChild(m);}},G=()=>!h||v.length===0?null:jsxs("nav",{"aria-label":"Table of contents",className:"mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsx("ul",{className:"space-y-1",children:v.map((x,m)=>jsx("li",{style:{marginLeft:`${(x.level-2)*1.5}rem`},children:jsx("a",{href:`#${x.id}`,className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline",children:x.title})},m))})]}),W=()=>P?jsxs("div",{className:"mb-6",children:[jsx("h1",{className:"text-2xl font-bold mb-2",children:A?`${A} Privacy Policy`:"Privacy Policy"}),jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Last Updated: ",a$1.toLocaleDateString()]})]}):null,j=()=>jsx("div",{className:a("prose dark:prose-invert max-w-none",o==null?void 0:o.sectionContent,g),children:E.split(`
8
- `).map((x,m)=>{if(x.startsWith("## ")){let w=x.substring(3).trim(),C=`${s}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h3",{id:C,className:a("text-xl font-bold mt-6 mb-3",o==null?void 0:o.sectionTitle,g),children:w},m)}else if(x.startsWith("### ")){let w=x.substring(4).trim(),C=`${s}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h4",{id:C,className:a("text-lg font-bold mt-4 mb-2",o==null?void 0:o.sectionTitle,g),children:w},m)}else return x===""?jsx("br",{},m):jsx("p",{className:"mb-2",children:x},m)})}),ee=()=>X?jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxs("div",{className:"flex flex-wrap gap-3",children:[jsx("button",{onClick:()=>O("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${R}`,children:"Export as PDF"}),jsx("button",{onClick:()=>O("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${R}`,children:"Export as DOCX"}),jsx("button",{onClick:()=>O("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${R}`,children:"Export as HTML"}),jsx("button",{onClick:()=>O("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${R}`,children:"Export as Markdown"})]})]}):null;return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o==null?void 0:o.root,g),children:[jsxs("div",{className:a("flex justify-between items-start mb-6",o==null?void 0:o.header,g),children:[jsxs("div",{children:[jsx("h2",{className:a("text-xl font-bold mb-2",o==null?void 0:o.title,g),children:N}),jsx("p",{className:a("text-gray-600 dark:text-gray-300",o==null?void 0:o.description,g),children:F})]}),r&&V&&jsx("button",{onClick:V,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${R}`,children:"Edit Policy"})]}),jsxs("div",{className:a("mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",o==null?void 0:o.complianceNotice,g),children:[jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"text-blue-700 dark:text-blue-300 text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:J,"aria-selected":$==="preview","aria-controls":q,onClick:()=>L("preview"),className:`inline-block p-4 ${$==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:I,"aria-selected":$==="markdown","aria-controls":K,onClick:()=>L("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsx("div",{className:a("bg-white dark:bg-gray-800 p-4 rounded-md",o==null?void 0:o.content,g),children:$==="preview"?jsxs("div",{role:"tabpanel",id:q,"aria-labelledby":J,"aria-live":"polite",children:[W(),G(),jsx("div",{className:a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",o==null?void 0:o.section,g),children:j()})]}):jsx("div",{role:"tabpanel",id:K,"aria-labelledby":I,children:jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:E})})}),ee()]})};var Ae=({content:E,title:M="Privacy Policy",organizationName:T,lastUpdated:Y=new Date,onExportComplete:V,componentTitle:N="Export Privacy Policy",description:F="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:R="",showExportHistory:X=true,includeComplianceNotice:r=true,includeLogo:h=false,logoUrl:P,customStyles:A,classNames:a$1,unstyled:o=false})=>{let g=useId(),[s,$]=useState([]),[L,J]=useState("pdf"),[I,q]=useState(false),[K,Z]=useState(null),[v,O]=useState(""),[G,W]=useState(""),[j,ee]=useState(""),[x,m]=useState(false),w=e=>{let f=new Date().toISOString().split("T")[0];return `${T?T.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${f}.${e.toLowerCase()}`},C=e=>v?v.endsWith(`.${e.toLowerCase()}`)?v:`${v}.${e.toLowerCase()}`:w(e),U=()=>{let e=T?`${T} ${M}`:M,f=Y.toLocaleDateString(),b=`<!DOCTYPE html>
9
- <html lang="en">
10
- <head>
11
- <meta charset="UTF-8">
12
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
13
- <title>${e}</title>
14
- <style>
15
- body {
16
- font-family: Arial, sans-serif;
17
- line-height: 1.6;
18
- color: #333;
19
- max-width: 800px;
20
- margin: 0 auto;
21
- padding: 20px;
22
- }
23
- h1 {
24
- font-size: 24px;
25
- margin-bottom: 10px;
26
- }
27
- h2 {
28
- font-size: 20px;
29
- margin-top: 30px;
30
- margin-bottom: 10px;
31
- border-bottom: 1px solid #eee;
32
- padding-bottom: 5px;
33
- }
34
- h3 {
35
- font-size: 18px;
36
- margin-top: 20px;
37
- margin-bottom: 10px;
38
- }
39
- p {
40
- margin-bottom: 15px;
41
- }
42
- .header {
43
- text-align: center;
44
- margin-bottom: 30px;
45
- }
46
- .footer {
47
- margin-top: 50px;
48
- text-align: center;
49
- font-size: 12px;
50
- color: #666;
51
- border-top: 1px solid #eee;
52
- padding-top: 20px;
53
- }
54
- .logo {
55
- max-width: 200px;
56
- margin-bottom: 20px;
57
- }
58
- .last-updated {
59
- font-size: 12px;
60
- color: #666;
61
- margin-bottom: 30px;
62
- }
63
- .compliance-notice {
64
- background-color: #f8f9fa;
65
- border: 1px solid #e9ecef;
66
- padding: 15px;
67
- margin-bottom: 30px;
68
- font-size: 14px;
69
- }
70
- ${A||""}
71
- </style>
72
- </head>
73
- <body>
74
- <div class="header">
75
- ${h&&P?`<img src="${P}" alt="${T||"Company"} Logo" class="logo">`:""}
76
- ${G?`<div class="custom-header">${G}</div>`:""}
77
- <h1>${e}</h1>
78
- <div class="last-updated">Last Updated: ${f}</div>
79
- </div>`;r&&(b+=`
80
- <div class="compliance-notice">
81
- <strong>NDPA Compliance Notice:</strong> This privacy policy has been created to comply with the Nigeria Data Protection Act (NDPA) 2023.
82
- It outlines how we collect, use, disclose, and protect your personal information in accordance with NDPA requirements.
83
- </div>`);let z=E.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return b+=`
84
- <div class="content">
85
- <p>${z}</p>
86
- </div>
87
-
88
- <div class="footer">
89
- ${j?`<div class="custom-footer">${j}</div>`:""}
90
- <p>&copy; ${new Date().getFullYear()} ${T||"Company"}. All rights reserved.</p>
91
- </div>
92
- </body>
93
- </html>`,b},l=()=>d(null,null,function*(){q(true),Z(null);try{let e=L.toLowerCase(),f="",b;switch(e){case "pdf":let te=U();b=new Blob([te],{type:"text/html"}),f=URL.createObjectURL(b);break;case "docx":b=new Blob([E],{type:"text/plain"}),f=URL.createObjectURL(b);break;case "html":let pe=U();b=new Blob([pe],{type:"text/html"}),f=URL.createObjectURL(b);break;default:b=new Blob([E],{type:"text/markdown"}),f=URL.createObjectURL(b);break}let z=C(e),B=document.createElement("a");B.href=f,B.download=z,document.body.appendChild(B),B.click(),document.body.removeChild(B);let D={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:f,filename:z};$(te=>[D,...te]),V&&V(e,f);}catch(e){console.error("Export error:",e),Z("An error occurred during export. Please try again.");}finally{q(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],f=`${g}-export-format`;return jsxs("div",{className:a("mb-6",a$1==null?void 0:a$1.formatSelector,o),children:[jsx("label",{htmlFor:f,className:"block text-sm font-medium mb-1",children:"Export Format"}),jsx("select",{id:f,value:L,onChange:b=>J(b.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",a$1==null?void 0:a$1.formatOption,o),children:e.map(b=>jsx("option",{value:b.value,children:b.label},b.value))})]})},d$1=()=>x?jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsx("button",{type:"button",onClick:()=>m(false),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] text-sm",children:"Hide Advanced Options"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${g}-custom-filename`,className:"block text-sm font-medium mb-1",children:"Custom Filename"}),jsx("input",{type:"text",id:`${g}-custom-filename`,value:v,onChange:e=>O(e.target.value),placeholder:w(L),"aria-describedby":`${g}-custom-filename-desc`,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("p",{id:`${g}-custom-filename-desc`,className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:"Leave blank to use the default filename format."})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${g}-custom-header`,className:"block text-sm font-medium mb-1",children:"Custom Header HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${g}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${g}-custom-footer`,className:"block text-sm font-medium mb-1",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${g}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`${g}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>m(e.target.checked),"aria-describedby":`${g}-compliance-notice-desc`,className:"w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})}),jsxs("div",{className:"ml-3 text-sm",children:[jsx("label",{htmlFor:`${g}-include-compliance-notice`,className:"font-medium text-gray-900 dark:text-white",children:"Include NDPA Compliance Notice"}),jsx("p",{id:`${g}-compliance-notice-desc`,className:"text-gray-600 dark:text-gray-400",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsx("button",{type:"button",onClick:()=>m(true),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] text-sm mb-6",children:"Show Advanced Options"}),u=()=>!X||s.length===0?null:jsxs("div",{className:a("mt-6",a$1==null?void 0:a$1.preview,o),children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Date"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Format"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Filename"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Actions"})]})}),jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:s.map(e=>jsxs("tr",{children:[jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:new Date(e.timestamp).toLocaleString()}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:e.format.toUpperCase()}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:e.filename}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsx("a",{href:e.url,download:e.filename,className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,a$1==null?void 0:a$1.root,o),children:[jsxs("div",{className:a("mb-6",a$1==null?void 0:a$1.header,o),children:[jsx("h2",{className:a("text-xl font-bold mb-2",a$1==null?void 0:a$1.title,o),children:N}),jsx("p",{className:a("text-gray-600 dark:text-gray-300",a$1==null?void 0:a$1.description,o),children:F})]}),c(),d$1(),jsxs("div",{className:"mb-6",children:[jsx("button",{onClick:l,disabled:I,className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${R} ${I?"opacity-70 cursor-not-allowed":""}`,(a$1==null?void 0:a$1.primaryButton)||(a$1==null?void 0:a$1.exportButton),o),children:I?"Exporting...":`Export as ${L.toUpperCase()}`}),K&&jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-500",children:K})]}),jsxs("div",{className:a("mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",a$1==null?void 0:a$1.complianceNotice,o),children:[jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"Export Tips"}),jsxs("ul",{className:"text-blue-700 dark:text-blue-300 text-sm list-disc list-inside space-y-1",children:[jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),u()]})};export{fe as a,Ee as b,Ae as c};//# sourceMappingURL=chunk-QDHHD2KR.mjs.map
94
- //# sourceMappingURL=chunk-QDHHD2KR.mjs.map
@@ -1,3 +0,0 @@
1
- 'use strict';var chunkI54CDQGN_js=require('./chunk-I54CDQGN.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var qe=({categories:pe,onSubmit:ge,onValidationError:N,title:be="Report a Data Breach",formDescription:fe="Use this form to report a suspected or confirmed data breach in accordance with NDPA Section 40. All fields marked with * are required.",submitButtonText:ue="Submit Report",className:M="",buttonClassName:z="",classNames:d={},unstyled:c=false,isSubmitting:f=false,showConfirmation:he=true,confirmationMessage:ve="Your breach report has been submitted successfully. The data protection team has been notified.",allowAttachments:ye=true,maxAttachments:A=5,maxFileSize:k=5*1024*1024,allowedFileTypes:w=[".pdf",".jpg",".jpeg",".png",".doc",".docx",".xls",".xlsx",".txt"],defaultValues:t,onReset:S})=>{var ie,oe,se,ne,de;let L=r=>{if(!r)return "";let o=new Date(r),l=s=>String(s).padStart(2,"0");return `${o.getFullYear()}-${l(o.getMonth()+1)}-${l(o.getDate())}T${l(o.getHours())}:${l(o.getMinutes())}`},[D,O]=react.useState((t==null?void 0:t.title)||""),[C,Y]=react.useState((t==null?void 0:t.description)||""),[F,U]=react.useState((t==null?void 0:t.category)||""),[T,H]=react.useState(L(t==null?void 0:t.discoveredAt)),[R,_]=react.useState(L(t==null?void 0:t.occurredAt)),[B,Z]=react.useState(((ie=t==null?void 0:t.reporter)==null?void 0:ie.name)||""),[v,G]=react.useState(((oe=t==null?void 0:t.reporter)==null?void 0:oe.email)||""),[j,K]=react.useState(((se=t==null?void 0:t.reporter)==null?void 0:se.department)||""),[E,W]=react.useState(((ne=t==null?void 0:t.reporter)==null?void 0:ne.phone)||""),[J,Q]=react.useState((t==null?void 0:t.affectedSystems)||[]),[xe,X]=react.useState(((de=t==null?void 0:t.affectedSystems)==null?void 0:de.join(", "))||""),[q,V]=react.useState((t==null?void 0:t.dataTypes)||[]),[u,ee]=react.useState((t==null?void 0:t.estimatedAffectedSubjects)!=null?String(t.estimatedAffectedSubjects):""),[re,te]=react.useState((t==null?void 0:t.status)||"ongoing"),[I,ae]=react.useState((t==null?void 0:t.initialActions)||""),[y,$]=react.useState([]),[Ne,P]=react.useState(false),[i,h]=react.useState({}),Ae=()=>{O(""),Y(""),U(""),H(""),_(""),Z(""),G(""),K(""),W(""),Q([]),X(""),V([]),ee(""),te("ongoing"),ae(""),$([]),P(false),h({}),S==null||S();},ke=r=>{let o=r.target.value;X(o);let l=o.split(",").map(s=>s.trim()).filter(Boolean);Q(l);},we=r=>{V(o=>o.includes(r)?o.filter(l=>l!==r):[...o,r]);},Se=r=>{var me;let o=r.target.files;if(!o)return;let l=[],s={};if(y.length+o.length>A){s.attachments=`Maximum of ${A} files allowed`,h(p=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},p),s));return}for(let p=0;p<o.length;p++){let x=o[p];if(x.size>k){s.attachments=`File ${x.name} exceeds the maximum size of ${k/(1024*1024)}MB`;continue}let ce="."+((me=x.name.split(".").pop())==null?void 0:me.toLowerCase());if(!w.includes(ce)){s.attachments=`File type ${ce} is not allowed`;continue}l.push(x);}l.length>0&&$(p=>[...p,...l]),Object.keys(s).length>0?h(p=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},p),s)):h(p=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},p),{attachments:""}));},De=r=>{$(o=>o.filter((l,s)=>s!==r));},Ce=()=>{let r={};return D.trim()||(r.breachTitle="Breach title is required"),C.trim()||(r.description="Description is required"),F||(r.category="Category is required"),T||(r.discoveredAt="Discovery date is required"),B.trim()||(r.reporterName="Reporter name is required"),v.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(v)||(r.reporterEmail="Reporter email is invalid"):r.reporterEmail="Reporter email is required",j.trim()||(r.reporterDepartment="Reporter department is required"),J.length===0&&(r.affectedSystems="At least one affected system is required"),q.length===0&&(r.dataTypes="At least one data type is required"),u&&isNaN(Number(u))&&(r.estimatedAffectedSubjects="Estimated affected subjects must be a number"),h(r),r},Fe=r=>{r.preventDefault();let o=Ce();if(Object.keys(o).length>0){N==null||N(o);return}let l={title:chunkI54CDQGN_js.a(D),description:chunkI54CDQGN_js.a(C),category:F,discoveredAt:new Date(T).getTime(),occurredAt:R?new Date(R).getTime():void 0,reportedAt:Date.now(),reporter:{name:chunkI54CDQGN_js.a(B),email:chunkI54CDQGN_js.a(v),department:chunkI54CDQGN_js.a(j),phone:E?chunkI54CDQGN_js.a(E):void 0},affectedSystems:J.map(s=>chunkI54CDQGN_js.a(s)),dataTypes:q,estimatedAffectedSubjects:u?Number(u):void 0,status:re,initialActions:I?chunkI54CDQGN_js.a(I):void 0,attachments:y.map(s=>({name:s.name,type:s.type,size:s.size,file:s}))};ge(l),he&&P(true);};if(Ne)return jsxRuntime.jsxs("div",{className:`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${M}`,children:[jsxRuntime.jsx("h2",{className:"text-lg font-bold text-green-800 dark:text-green-200 mb-2",children:"Report Submitted"}),jsxRuntime.jsx("p",{className:"text-green-700 dark:text-green-300",children:ve}),jsxRuntime.jsxs("div",{className:"mt-4 p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold text-yellow-800 dark:text-yellow-200 mb-2",children:"Important: Next Steps"}),jsxRuntime.jsx("p",{className:"text-yellow-700 dark:text-yellow-300 text-sm",children:"Under the NDPA (Section 40), data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsxRuntime.jsx("button",{onClick:()=>P(false),className:`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${z}`,children:"Report Another Breach"})]});let Te=[{id:"personal",label:"Personal Information (names, addresses)"},{id:"contact",label:"Contact Information (email, phone)"},{id:"financial",label:"Financial Information (bank details, payment info)"},{id:"health",label:"Health Information"},{id:"identification",label:"Identification Documents (ID cards, passports)"},{id:"login",label:"Login Credentials"},{id:"biometric",label:"Biometric Data"},{id:"children",label:"Children's Data"},{id:"location",label:"Location Data"},{id:"communications",label:"Communications Content"}];return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${M}`,d.root,c),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",d.title,c),children:be}),jsxRuntime.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:fe}),jsxRuntime.jsx("form",{onSubmit:Fe,className:chunkE64TU6IU_js.a("",d.form,c),children:jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",d.fieldGroup,c),children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Breach Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"breachTitle",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",d.label,c),children:["Breach Title/Summary ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"breachTitle",value:D,onChange:r=>O(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.input,c),required:true,"aria-invalid":!!i.breachTitle,"aria-describedby":i.breachTitle?"breachTitle-error":void 0}),i.breachTitle&&jsxRuntime.jsx("p",{id:"breachTitle-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.breachTitle})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"category",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",d.label,c),children:["Breach Category ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsxs("select",{id:"category",value:F,onChange:r=>U(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.select,c),required:true,"aria-invalid":!!i.category,"aria-describedby":i.category?"category-error":void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select a category"}),pe.map(r=>jsxRuntime.jsx("option",{value:r.id,children:r.name},r.id))]}),i.category&&jsxRuntime.jsx("p",{id:"category-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.category})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"description",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",d.label,c),children:["Detailed Description ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"description",value:C,onChange:r=>Y(r.target.value),rows:4,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.textarea,c),required:true,"aria-invalid":!!i.description,"aria-describedby":i.description?"description-error":void 0}),i.description&&jsxRuntime.jsx("p",{id:"description-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.description})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"discoveredAt",className:"block text-sm font-medium mb-1",children:["Date Discovered ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"datetime-local",id:"discoveredAt",value:T,onChange:r=>H(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.discoveredAt,"aria-describedby":i.discoveredAt?"discoveredAt-error":void 0}),i.discoveredAt&&jsxRuntime.jsx("p",{id:"discoveredAt-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.discoveredAt})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"occurredAt",className:"block text-sm font-medium mb-1",children:"Date Occurred (if known)"}),jsxRuntime.jsx("input",{type:"datetime-local",id:"occurredAt",value:R,onChange:r=>_(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Reporter Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterName",className:"block text-sm font-medium mb-1",children:["Your Name ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"reporterName",value:B,onChange:r=>Z(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.reporterName,"aria-describedby":i.reporterName?"reporterName-error":void 0}),i.reporterName&&jsxRuntime.jsx("p",{id:"reporterName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.reporterName})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterEmail",className:"block text-sm font-medium mb-1",children:["Your Email ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"email",id:"reporterEmail",value:v,onChange:r=>G(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.reporterEmail,"aria-describedby":i.reporterEmail?"reporterEmail-error":void 0}),i.reporterEmail&&jsxRuntime.jsx("p",{id:"reporterEmail-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.reporterEmail})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterDepartment",className:"block text-sm font-medium mb-1",children:["Your Department ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"reporterDepartment",value:j,onChange:r=>K(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.reporterDepartment,"aria-describedby":i.reporterDepartment?"reporterDepartment-error":void 0}),i.reporterDepartment&&jsxRuntime.jsx("p",{id:"reporterDepartment-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.reporterDepartment})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"reporterPhone",className:"block text-sm font-medium mb-1",children:"Your Phone Number (Optional)"}),jsxRuntime.jsx("input",{type:"tel",id:"reporterPhone",value:E,onChange:r=>W(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Impact Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"affectedSystems",className:"block text-sm font-medium mb-1",children:["Affected Systems/Applications ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"affectedSystems",value:xe,onChange:ke,placeholder:"e.g. CRM, Email Server, Website (comma separated)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.affectedSystems,"aria-describedby":i.affectedSystems?"affectedSystems-error":void 0}),i.affectedSystems&&jsxRuntime.jsx("p",{id:"affectedSystems-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.affectedSystems})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"estimatedAffectedSubjects",className:"block text-sm font-medium mb-1",children:"Estimated Number of Affected Data Subjects"}),jsxRuntime.jsx("input",{type:"text",id:"estimatedAffectedSubjects",value:u,onChange:r=>ee(r.target.value),placeholder:"e.g. 100",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]","aria-invalid":!!i.estimatedAffectedSubjects,"aria-describedby":i.estimatedAffectedSubjects?"estimatedAffectedSubjects-error":void 0}),i.estimatedAffectedSubjects&&jsxRuntime.jsx("p",{id:"estimatedAffectedSubjects-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.estimatedAffectedSubjects})]}),jsxRuntime.jsxs("fieldset",{className:"md:col-span-2",children:[jsxRuntime.jsxs("legend",{className:"block text-sm font-medium mb-1",children:["Types of Data Involved ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:Te.map(r=>jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"checkbox",id:`dataType_${r.id}`,checked:q.includes(r.id),onChange:()=>we(r.id),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("label",{htmlFor:`dataType_${r.id}`,className:"ml-2 text-sm text-gray-700 dark:text-gray-300",children:r.label})]},r.id))}),i.dataTypes&&jsxRuntime.jsx("p",{id:"dataTypes-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.dataTypes})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"status",className:"block text-sm font-medium mb-1",children:["Current Status ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsxs("select",{id:"status",value:re,onChange:r=>te(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.select,c),required:true,children:[jsxRuntime.jsx("option",{value:"ongoing",children:"Ongoing (breach is still active)"}),jsxRuntime.jsx("option",{value:"contained",children:"Contained (breach is stopped but not resolved)"}),jsxRuntime.jsx("option",{value:"resolved",children:"Resolved (breach is fully addressed)"})]})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"initialActions",className:"block text-sm font-medium mb-1",children:"Initial Actions Taken"}),jsxRuntime.jsx("textarea",{id:"initialActions",value:I,onChange:r=>ae(r.target.value),placeholder:"Describe any immediate actions that have been taken to address the breach",rows:3,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.textarea,c)})]})]})]}),ye&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Attachments"}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1",children:"Upload Supporting Files (Optional)"}),jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-2",children:["Max ",A," files, ",k/(1024*1024),"MB each. Allowed types: ",w.join(", ")]}),jsxRuntime.jsx("input",{type:"file",onChange:Se,multiple:true,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",accept:w.join(",")}),i.attachments&&jsxRuntime.jsx("p",{id:"attachments-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.attachments})]}),y.length>0&&jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium mb-2",children:"Attached Files:"}),jsxRuntime.jsx("ul",{className:"space-y-2",children:y.map((r,o)=>jsxRuntime.jsxs("li",{className:"flex items-center justify-between p-2 bg-gray-50 dark:bg-gray-700 rounded",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400 mr-2",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M8 4a3 3 0 00-3 3v4a5 5 0 0010 0V7a1 1 0 112 0v4a7 7 0 11-14 0V7a5 5 0 0110 0v4a3 3 0 11-6 0V7a1 1 0 012 0v4a1 1 0 102 0V7a3 3 0 00-3-3z",clipRule:"evenodd"})}),jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:r.name}),jsxRuntime.jsxs("span",{className:"ml-2 text-xs text-gray-600 dark:text-gray-400",children:["(",(r.size/1024).toFixed(1)," KB)"]})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>De(o),className:"text-red-500 hover:text-red-700",children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},o))})]})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mt-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",d.notice,c),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.jsx("p",{className:"text-blue-700 dark:text-blue-300 text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsxRuntime.jsxs("div",{className:"mt-6 relative flex gap-3",children:[f&&d.loadingOverlay&&jsxRuntime.jsx("div",{className:d.loadingOverlay}),jsxRuntime.jsx("button",{type:"submit",disabled:f,className:chunkE64TU6IU_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${z} ${f?"opacity-50 cursor-not-allowed":""}`,d.primaryButton||d.submitButton,c),children:f?"Submitting...":ue}),jsxRuntime.jsx("button",{type:"button",onClick:Ae,disabled:f,className:chunkE64TU6IU_js.a("px-6 py-3 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",void 0,c),children:"Reset"})]})]})})]})};
2
- exports.a=qe;//# sourceMappingURL=chunk-SAA7UVI2.js.map
3
- //# sourceMappingURL=chunk-SAA7UVI2.js.map
@@ -1,7 +0,0 @@
1
- import {e,g,h,f}from'./chunk-75TJPK2N.mjs';import {a as a$1}from'./chunk-AYKLAEOU.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useState,useMemo,useEffect,useCallback}from'react';import {jsxs,jsx}from'react/jsx-runtime';var _=[{value:"adequacy_decision",label:"Adequacy Decision (Section 41)"},{value:"standard_clauses",label:"Standard Contractual Clauses (Section 42)"},{value:"binding_corporate_rules",label:"Binding Corporate Rules (Section 43)"},{value:"ndpc_authorization",label:"NDPC Authorization (Section 44)"},{value:"explicit_consent",label:"Explicit Consent (Section 45(a))"},{value:"contract_performance",label:"Contract Performance (Section 45(b))"},{value:"public_interest",label:"Public Interest (Section 45(c))"},{value:"legal_claims",label:"Legal Claims (Section 45(d))"},{value:"vital_interests",label:"Vital Interests (Section 45(e))"}],G=[{value:"adequate",label:"Adequate"},{value:"inadequate",label:"Inadequate"},{value:"pending_review",label:"Pending Review"},{value:"unknown",label:"Unknown"}],J=[{value:"one_time",label:"One-Time"},{value:"periodic",label:"Periodic"},{value:"continuous",label:"Continuous"}],X=[{value:"active",label:"Active"},{value:"suspended",label:"Suspended"},{value:"terminated",label:"Terminated"},{value:"pending_approval",label:"Pending Approval"}],Z={destinationCountry:"",destinationCountryCode:"",adequacyStatus:"unknown",transferMechanism:"adequacy_decision",dataCategories:"",includesSensitiveData:false,estimatedDataSubjects:"",recipientOrganization:"",recipientContactName:"",recipientContactEmail:"",recipientContactPhone:"",recipientContactAddress:"",purpose:"",safeguards:"",riskAssessment:"",riskLevel:"medium",frequency:"one_time",status:"active",tiaCompleted:false,tiaReference:"",ndpcApprovalApplied:false,ndpcApprovalApproved:false,ndpcApprovalReference:""},Ce=({transfers:g$1,onAddTransfer:q,onUpdateTransfer:F,onRemoveTransfer:M,summary:E,title:ee="Cross-Border Data Transfer Manager",description:te="Manage and document cross-border personal data transfers in compliance with NDPA 2023 Part VI (Sections 41-45).",className:re="",buttonClassName:P="",showSummary:ae=true,showTIA:ie=true,classNames:r,unstyled:d})=>{let[b$1,A]=useState(null),[j,w]=useState(false),[x,z]=useState(null),[n,B]=useState(Z),[y,L]=useState(null),[S,ne]=useState("all"),[T,de]=useState("all"),C=useMemo(()=>{let e=[...g$1];return S!=="all"&&(e=e.filter(a=>a.status===S)),T!=="all"&&(e=e.filter(a=>a.transferMechanism===T)),e.sort((a,l)=>l.updatedAt-a.updatedAt),e},[g$1,S,T]);useEffect(()=>{C.length>0&&!b$1&&A(C[0].id);},[C,b$1]);let $=useMemo(()=>{var e;return b$1&&(e=g$1.find(a=>a.id===b$1))!=null?e:null},[g$1,b$1]),k=useCallback(e=>new Date(e).toLocaleDateString(),[]),h$1=useCallback(()=>{B(Z),z(null),L(null);},[]),oe=useCallback(()=>{h$1(),w(true);},[h$1]),le=useCallback(e=>{var a,l,u,v;z(e.id),B({destinationCountry:e.destinationCountry,destinationCountryCode:e.destinationCountryCode||"",adequacyStatus:e.adequacyStatus,transferMechanism:e.transferMechanism,dataCategories:e.dataCategories.join(", "),includesSensitiveData:e.includesSensitiveData,estimatedDataSubjects:((a=e.estimatedDataSubjects)==null?void 0:a.toString())||"",recipientOrganization:e.recipientOrganization,recipientContactName:e.recipientContact.name,recipientContactEmail:e.recipientContact.email,recipientContactPhone:e.recipientContact.phone||"",recipientContactAddress:e.recipientContact.address||"",purpose:e.purpose,safeguards:e.safeguards.join(`
2
- `),riskAssessment:e.riskAssessment,riskLevel:e.riskLevel,frequency:e.frequency,status:e.status,tiaCompleted:e.tiaCompleted,tiaReference:e.tiaReference||"",ndpcApprovalApplied:((l=e.ndpcApproval)==null?void 0:l.applied)||false,ndpcApprovalApproved:((u=e.ndpcApproval)==null?void 0:u.approved)||false,ndpcApprovalReference:((v=e.ndpcApproval)==null?void 0:v.referenceNumber)||""}),w(true);},[]),p=useCallback((e,a$1)=>{B(l=>b(a({},l),{[e]:a$1}));},[]),V=useCallback(()=>{let e$1=e(n.transferMechanism),a=Date.now();return {destinationCountry:n.destinationCountry.trim(),destinationCountryCode:n.destinationCountryCode.trim()||void 0,adequacyStatus:n.adequacyStatus,transferMechanism:n.transferMechanism,dataCategories:n.dataCategories.split(",").map(l=>l.trim()).filter(Boolean),includesSensitiveData:n.includesSensitiveData,estimatedDataSubjects:n.estimatedDataSubjects?parseInt(n.estimatedDataSubjects,10):void 0,recipientOrganization:n.recipientOrganization.trim(),recipientContact:{name:n.recipientContactName.trim(),email:n.recipientContactEmail.trim(),phone:n.recipientContactPhone.trim()||void 0,address:n.recipientContactAddress.trim()||void 0},purpose:n.purpose.trim(),safeguards:n.safeguards.split(`
3
- `).map(l=>l.trim()).filter(Boolean),riskAssessment:n.riskAssessment.trim(),riskLevel:n.riskLevel,frequency:n.frequency,status:e$1&&!n.ndpcApprovalApproved?"pending_approval":n.status,tiaCompleted:n.tiaCompleted,tiaReference:n.tiaReference.trim()||void 0,ndpcApproval:e$1?{required:true,applied:n.ndpcApprovalApplied,approved:n.ndpcApprovalApproved||void 0,referenceNumber:n.ndpcApprovalReference.trim()||void 0,appliedAt:n.ndpcApprovalApplied?a:void 0,approvedAt:n.ndpcApprovalApproved?a:void 0}:void 0,startDate:a,reviewDate:a+365*24*60*60*1e3}},[n]),pe=useCallback(()=>{let e=V(),a$1=a({id:x||"temp",createdAt:Date.now(),updatedAt:Date.now()},e),l=g(a$1);L(l),l.isValid&&(x?F&&F(x,e):q&&q(e),h$1(),w(false));},[V,x,F,q,h$1]),U=useCallback(()=>{h$1(),w(false);},[h$1]),se=useCallback(e=>{M&&M(e),b$1===e&&A(null);},[M,b$1]),H=useCallback(e=>jsxs("span",{className:a$1(`px-2 py-1 rounded text-xs font-medium ${{low:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",medium:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",high:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}[e]}`,r==null?void 0:r.riskBadge,d),children:[e.charAt(0).toUpperCase()+e.slice(1)," Risk"]}),[r==null?void 0:r.riskBadge,d]),Y=useCallback(e=>{let a={active:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",suspended:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",terminated:"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",pending_approval:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200"},l={active:"Active",suspended:"Suspended",terminated:"Terminated",pending_approval:"Pending Approval"};return jsx("span",{className:a$1(`px-2 py-1 rounded text-xs font-medium ${a[e]}`,r==null?void 0:r.statusBadge,d),children:l[e]})},[r==null?void 0:r.statusBadge,d]),ue=useCallback(e$1=>{var u;let a=e(e$1),l=((u=_.find(v=>v.value===e$1))==null?void 0:u.label)||e$1;return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${a?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200"}`,children:l})},[]),D=useMemo(()=>E||{totalActiveTransfers:g$1.filter(e=>e.status==="active").length,pendingApproval:g$1.filter(e=>{var a,l;return e.status==="pending_approval"||((a=e.ndpcApproval)==null?void 0:a.required)&&!((l=e.ndpcApproval)!=null&&l.approved)}),highRiskTransfers:g$1.filter(e=>e.riskLevel==="high"&&e.status==="active"),missingTIA:g$1.filter(e=>!e.tiaCompleted&&e.status==="active"),byMechanism:{},byAdequacy:{},dueForReview:[],lastUpdated:Date.now()},[E,g$1]),ce=()=>jsxs("div",{role:"status","aria-label":"Transfer compliance summary",className:a$1("mb-6 grid grid-cols-2 md:grid-cols-4 gap-4",r==null?void 0:r.summary,d),children:[jsxs("div",{className:a$1("bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"text-2xl font-bold text-blue-800 dark:text-blue-200",children:D.totalActiveTransfers}),jsx("p",{className:"text-sm text-blue-600 dark:text-blue-300",children:"Active Transfers"})]}),jsxs("div",{className:a$1("bg-purple-50 dark:bg-purple-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"text-2xl font-bold text-purple-800 dark:text-purple-200",children:D.pendingApproval.length}),jsx("p",{className:"text-sm text-purple-600 dark:text-purple-300",children:"Pending Approval"})]}),jsxs("div",{className:a$1("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"text-2xl font-bold text-red-800 dark:text-red-200",children:D.highRiskTransfers.length}),jsx("p",{className:"text-sm text-red-600 dark:text-red-300",children:"High Risk"})]}),jsxs("div",{className:a$1("bg-yellow-50 dark:bg-yellow-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"text-2xl font-bold text-yellow-800 dark:text-yellow-200",children:D.missingTIA.length}),jsx("p",{className:"text-sm text-yellow-600 dark:text-yellow-300",children:"Missing TIA"})]})]}),me=()=>{let e$1=e(n.transferMechanism);return jsxs("div",{className:a$1("bg-gray-50 dark:bg-gray-700 p-6 rounded-lg mb-6",r==null?void 0:r.form,d),children:[jsxs("div",{className:a$1("flex justify-between items-center mb-4",r==null?void 0:r.header,d),children:[jsx("h3",{className:"text-lg font-medium",children:x?"Edit Transfer":"Add New Transfer"}),jsx("button",{onClick:U,"aria-label":"Cancel form",className:"text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",children:"Cancel"})]}),y&&!y.isValid&&jsxs("div",{id:"cb-form-errors",role:"alert",className:"mb-4 bg-red-50 dark:bg-red-900/20 p-3 rounded-md",children:[jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside text-sm text-red-700 dark:text-red-300",children:y.errors.map((a,l)=>jsx("li",{children:a},l))})]}),y&&y.warnings.length>0&&jsxs("div",{id:"cb-form-warnings",role:"alert",className:"mb-4 bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md",children:[jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-200 mb-1",children:"Warnings:"}),jsx("ul",{className:"list-disc list-inside text-sm text-yellow-700 dark:text-yellow-300",children:y.warnings.map((a,l)=>jsx("li",{children:a},l))})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"cb-destinationCountry",className:"block text-sm font-medium mb-1",children:["Destination Country ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{id:"cb-destinationCountry",type:"text",value:n.destinationCountry,onChange:a=>p("destinationCountry",a.target.value),placeholder:"e.g. United Kingdom","aria-required":"true","aria-describedby":"cb-form-errors","aria-label":"Destination country",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-destinationCountryCode",className:"block text-sm font-medium mb-1",children:"Country Code (ISO)"}),jsx("input",{id:"cb-destinationCountryCode",type:"text",value:n.destinationCountryCode,onChange:a=>p("destinationCountryCode",a.target.value),placeholder:"e.g. GB",maxLength:3,"aria-label":"Country code in ISO format",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-recipientOrganization",className:"block text-sm font-medium mb-1",children:["Recipient Organization ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{id:"cb-recipientOrganization",type:"text",value:n.recipientOrganization,onChange:a=>p("recipientOrganization",a.target.value),placeholder:"Organization name","aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-transferMechanism",className:"block text-sm font-medium mb-1",children:["Transfer Mechanism ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("select",{id:"cb-transferMechanism",value:n.transferMechanism,onChange:a=>p("transferMechanism",a.target.value),"aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,d),children:_.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-adequacyStatus",className:"block text-sm font-medium mb-1",children:"Adequacy Status"}),jsx("select",{id:"cb-adequacyStatus",value:n.adequacyStatus,onChange:a=>p("adequacyStatus",a.target.value),"aria-label":"Select adequacy status of destination country",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,d),children:G.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-medium mb-1",children:"Risk Level"}),jsxs("select",{value:n.riskLevel,onChange:a=>p("riskLevel",a.target.value),className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,d),children:[jsx("option",{value:"low",children:"Low"}),jsx("option",{value:"medium",children:"Medium"}),jsx("option",{value:"high",children:"High"})]})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-dataCategories",className:"block text-sm font-medium mb-1",children:["Data Categories ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{id:"cb-dataCategories",type:"text",value:n.dataCategories,onChange:a=>p("dataCategories",a.target.value),placeholder:"Comma-separated, e.g. Names, Email addresses, Phone numbers","aria-required":"true","aria-describedby":"cb-dataCategories-help",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)}),jsx("p",{id:"cb-dataCategories-help",className:"text-xs text-gray-500 mt-1",children:"Separate categories with commas"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"includesSensitiveData",checked:n.includesSensitiveData,onChange:a=>p("includesSensitiveData",a.target.checked),className:"h-4 w-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:"includesSensitiveData",className:"text-sm font-medium",children:"Includes sensitive personal data"})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-medium mb-1",children:"Estimated Data Subjects"}),jsx("input",{type:"number",value:n.estimatedDataSubjects,onChange:a=>p("estimatedDataSubjects",a.target.value),placeholder:"Number of data subjects",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-recipientContactName",className:"block text-sm font-medium mb-1",children:["Recipient Contact Name ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{id:"cb-recipientContactName",type:"text",value:n.recipientContactName,onChange:a=>p("recipientContactName",a.target.value),placeholder:"Contact person name","aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-recipientContactEmail",className:"block text-sm font-medium mb-1",children:["Recipient Contact Email ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{id:"cb-recipientContactEmail",type:"email",value:n.recipientContactEmail,onChange:a=>p("recipientContactEmail",a.target.value),placeholder:"contact@example.com","aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-medium mb-1",children:"Recipient Contact Phone"}),jsx("input",{type:"text",value:n.recipientContactPhone,onChange:a=>p("recipientContactPhone",a.target.value),placeholder:"Phone number",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-medium mb-1",children:"Recipient Contact Address"}),jsx("input",{type:"text",value:n.recipientContactAddress,onChange:a=>p("recipientContactAddress",a.target.value),placeholder:"Address",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-purpose",className:"block text-sm font-medium mb-1",children:["Purpose of Transfer ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("textarea",{id:"cb-purpose",value:n.purpose,onChange:a=>p("purpose",a.target.value),placeholder:"Describe the purpose of this data transfer",rows:2,"aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-safeguards",className:"block text-sm font-medium mb-1",children:["Safeguards ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("textarea",{id:"cb-safeguards",value:n.safeguards,onChange:a=>p("safeguards",a.target.value),placeholder:`One safeguard per line, e.g.
4
- End-to-end encryption
5
- Access control policies
6
- Regular security audits`,rows:3,"aria-required":"true","aria-describedby":"cb-safeguards-help",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)}),jsx("p",{id:"cb-safeguards-help",className:"text-xs text-gray-500 mt-1",children:"Enter one safeguard per line"})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-riskAssessment",className:"block text-sm font-medium mb-1",children:["Risk Assessment Summary ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("textarea",{id:"cb-riskAssessment",value:n.riskAssessment,onChange:a=>p("riskAssessment",a.target.value),placeholder:"Summarize the risk assessment for this transfer",rows:2,"aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-medium mb-1",children:"Transfer Frequency"}),jsx("select",{value:n.frequency,onChange:a=>p("frequency",a.target.value),className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,d),children:J.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-medium mb-1",children:"Status"}),jsx("select",{value:n.status,onChange:a=>p("status",a.target.value),className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,d),children:X.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]})]}),e$1&&jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",children:[jsx("h4",{className:"text-sm font-medium text-blue-800 dark:text-blue-200 mb-3",children:"NDPC Approval Required"}),jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300 mb-3",children:"The selected transfer mechanism requires approval from the Nigeria Data Protection Commission."}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"ndpcApprovalApplied",checked:n.ndpcApprovalApplied,onChange:a=>p("ndpcApprovalApplied",a.target.checked),className:"h-4 w-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:"ndpcApprovalApplied",className:"text-sm",children:"Application submitted"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"ndpcApprovalApproved",checked:n.ndpcApprovalApproved,onChange:a=>p("ndpcApprovalApproved",a.target.checked),className:"h-4 w-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:"ndpcApprovalApproved",className:"text-sm",children:"Approval granted"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{className:"block text-sm font-medium mb-1",children:"NDPC Reference Number"}),jsx("input",{type:"text",value:n.ndpcApprovalReference,onChange:a=>p("ndpcApprovalReference",a.target.value),placeholder:"Reference number (if available)",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]})]})]}),ie&&jsxs("div",{className:"mt-4 p-4 bg-gray-100 dark:bg-gray-600 rounded-md",children:[jsx("h4",{className:"text-sm font-medium mb-3",children:"Transfer Impact Assessment"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"tiaCompleted",checked:n.tiaCompleted,onChange:a=>p("tiaCompleted",a.target.checked),className:"h-4 w-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:"tiaCompleted",className:"text-sm",children:"TIA completed"})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-medium mb-1",children:"TIA Reference"}),jsx("input",{type:"text",value:n.tiaReference,onChange:a=>p("tiaReference",a.target.value),placeholder:"Document reference",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,d)})]})]})]}),jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[jsx("button",{onClick:U,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600",children:"Cancel"}),jsx("button",{onClick:pe,className:a$1(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${P}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),d),children:x?"Update Transfer":"Add Transfer"})]})]})},ge=e=>{var u,v;let a=h(e),l=g(e);return jsxs("div",{role:"status","aria-label":"Transfer details",className:a$1("",r==null?void 0:r.detailPanel,d),children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxs("h3",{className:"text-lg font-medium",children:[e.destinationCountry," \u2014 ",e.recipientOrganization]}),jsxs("div",{className:"flex gap-2",children:[Y(e.status),H(e.riskLevel)]})]}),!l.isValid&&jsxs("div",{className:"mb-4 bg-red-50 dark:bg-red-900/20 p-3 rounded-md",children:[jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Compliance Issues"}),jsx("ul",{className:"list-disc list-inside text-sm text-red-700 dark:text-red-300",children:l.errors.map((s,m)=>jsx("li",{children:s},m))})]}),l.warnings.length>0&&jsxs("div",{className:"mb-4 bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md",children:[jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-200 mb-1",children:"Warnings"}),jsx("ul",{className:"list-disc list-inside text-sm text-yellow-700 dark:text-yellow-300",children:l.warnings.map((s,m)=>jsx("li",{children:s},m))})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Destination:"})," ",e.destinationCountry,e.destinationCountryCode?` (${e.destinationCountryCode})`:""]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Adequacy:"})," ",(u=G.find(s=>s.value===e.adequacyStatus))==null?void 0:u.label]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Frequency:"})," ",(v=J.find(s=>s.value===e.frequency))==null?void 0:v.label]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Start Date:"})," ",k(e.startDate)]}),e.endDate&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"End Date:"})," ",k(e.endDate)]}),e.reviewDate&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Next Review:"})," ",k(e.reviewDate)]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Recipient:"})," ",e.recipientOrganization]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Contact:"})," ",e.recipientContact.name," (",e.recipientContact.email,")"]}),e.estimatedDataSubjects&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Data Subjects:"})," ",e.estimatedDataSubjects.toLocaleString()]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",e.includesSensitiveData?"Yes":"No"]})]})]}),jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium mb-1",children:"Transfer Mechanism"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:jsx("p",{className:"text-sm text-gray-700 dark:text-gray-200",children:f(e.transferMechanism)})})]}),jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium mb-1",children:"Purpose"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md",children:e.purpose})]}),jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium mb-1",children:"Data Categories"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.dataCategories.map((s,m)=>jsx("span",{className:"px-2 py-1 bg-gray-100 dark:bg-gray-600 rounded text-xs",children:s},m))})]}),jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium mb-1",children:"Safeguards"}),jsx("ul",{className:"list-disc list-inside text-sm text-gray-600 dark:text-gray-300",children:e.safeguards.map((s,m)=>jsx("li",{children:s},m))})]}),jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium mb-1",children:"Risk Assessment"}),jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:[jsx("p",{className:"text-sm text-gray-700 dark:text-gray-200 mb-2",children:e.riskAssessment}),jsxs("div",{className:"mt-2",role:"status","aria-label":"Automated risk assessment result",children:[jsxs("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:["Automated Assessment (Score: ",a.riskScore,")"]}),a.factors.length>0&&jsx("ul",{className:"list-disc list-inside text-xs text-gray-600 dark:text-gray-400",children:a.factors.map((s,m)=>jsx("li",{children:s},m))}),a.recommendations.length>0&&jsxs("div",{className:"mt-2",children:[jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Recommendations:"}),jsx("ul",{className:"list-disc list-inside text-xs text-gray-600 dark:text-gray-400",children:a.recommendations.map((s,m)=>jsx("li",{children:s},m))})]})]})]})]}),e.ndpcApproval&&jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium mb-1",children:"NDPC Approval"}),jsxs("div",{className:a$1(`p-3 rounded-md ${e.ndpcApproval.approved?"bg-green-50 dark:bg-green-900/20":e.ndpcApproval.applied?"bg-yellow-50 dark:bg-yellow-900/20":"bg-red-50 dark:bg-red-900/20"}`,r==null?void 0:r.approvalStatus,d),children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",e.ndpcApproval.approved?"Approved":e.ndpcApproval.applied?"Application Submitted":"Not Applied"]}),e.ndpcApproval.referenceNumber&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Reference:"})," ",e.ndpcApproval.referenceNumber]}),e.ndpcApproval.appliedAt&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Applied:"})," ",k(e.ndpcApproval.appliedAt)]}),e.ndpcApproval.approvedAt&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Approved:"})," ",k(e.ndpcApproval.approvedAt)]})]})]}),jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium mb-1",children:"Transfer Impact Assessment"}),jsxs("div",{className:`p-3 rounded-md ${e.tiaCompleted?"bg-green-50 dark:bg-green-900/20":"bg-yellow-50 dark:bg-yellow-900/20"}`,children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",e.tiaCompleted?"Completed":"Not Completed"]}),e.tiaReference&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Reference:"})," ",e.tiaReference]})]})]}),jsxs("div",{className:"flex gap-3 mt-6",children:[jsx("button",{onClick:()=>le(e),"aria-label":`Edit transfer to ${e.destinationCountry}`,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${P}`,children:"Edit"}),jsx("button",{onClick:()=>se(e.id),"aria-label":`Remove transfer to ${e.destinationCountry}`,className:"px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700",children:"Remove"})]})]})};return jsxs("div",{className:a$1(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${re}`,r==null?void 0:r.root,d),children:[jsx("h2",{className:a$1("text-xl font-bold mb-2",r==null?void 0:r.title,d),children:ee}),jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:te}),ae&&ce(),!j&&jsx("div",{className:"mb-6",children:jsx("button",{onClick:oe,className:a$1(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${P}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),d),children:"Add Transfer"})}),j&&me(),jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"cbStatusFilter",className:"block text-sm font-medium mb-1",children:"Status Filter"}),jsxs("select",{id:"cbStatusFilter",value:S,onChange:e=>ne(e.target.value),"aria-label":"Filter transfers by status",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,d),children:[jsx("option",{value:"all",children:"All Statuses"}),X.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cbMechanismFilter",className:"block text-sm font-medium mb-1",children:"Mechanism Filter"}),jsxs("select",{id:"cbMechanismFilter",value:T,onChange:e=>de(e.target.value),"aria-label":"Filter transfers by mechanism",className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,d),children:[jsx("option",{value:"all",children:"All Mechanisms"}),_.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxs("div",{className:"md:col-span-1",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Transfers"}),C.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No cross-border transfers found."}):jsx("div",{className:a$1("space-y-2 max-h-96 overflow-y-auto pr-2",r==null?void 0:r.transferList,d),children:C.map(e=>{var a,l;return jsxs("div",{className:a$1(`p-3 rounded-md cursor-pointer ${b$1===e.id?"bg-[rgb(var(--ndpr-primary)/0.05)] dark:bg-[rgb(var(--ndpr-primary)/0.1)] border border-[rgb(var(--ndpr-primary)/0.2)] dark:border-[rgb(var(--ndpr-primary)/0.3)]":"bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"}`,r==null?void 0:r.transferItem,d),role:"button",tabIndex:0,"aria-label":`View transfer to ${e.destinationCountry}`,onClick:()=>A(e.id),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),A(e.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:e.destinationCountry}),H(e.riskLevel)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:e.recipientOrganization}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:ue(e.transferMechanism)}),jsxs("div",{className:"flex justify-between items-center mt-2",children:[Y(e.status),((a=e.ndpcApproval)==null?void 0:a.required)&&!((l=e.ndpcApproval)!=null&&l.approved)&&jsx("span",{className:"text-xs text-purple-600 dark:text-purple-400",children:"NDPC Pending"})]})]},e.id)})})]}),jsx("div",{className:"md:col-span-2",children:$?ge($):jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Select a transfer to view details"})})})]})]})};export{Ce as a};//# sourceMappingURL=chunk-TI2M7H6R.mjs.map
7
- //# sourceMappingURL=chunk-TI2M7H6R.mjs.map
@@ -1,2 +0,0 @@
1
- import {g}from'./chunk-75TJPK2N.mjs';import {a as a$1}from'./chunk-6WIP33TW.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect,useCallback}from'react';function j(m,l){return l?a$1(m):{load:()=>null,save:()=>{},remove:()=>{}}}function Q({initialTransfers:m=[],adapter:l,storageKey:R="ndpr_cross_border_transfers",useLocalStorage:q=true,onAdd:g$1,onUpdate:C,onRemove:B}={}){let y=l!=null?l:j(R,q),v=useRef(y);v.current=y;let[i,u]=useState(m),[x,T]=useState(true);useEffect(()=>{let e=false;try{let r=v.current.load();r instanceof Promise?r.then(t=>{e||(t&&u(t),T(!1));},()=>{e||T(!1);}):(r&&u(r),T(!1));}catch(r){e||T(false);}return ()=>{e=true;}},[]);let f=useCallback(e=>{Promise.resolve(v.current.save(e)).catch(r=>{console.warn("[ndpr-toolkit] Failed to save cross-border transfers:",r);});},[]),M=()=>"cbt_"+Date.now()+"_"+Math.random().toString(36).substring(2,11),D=useCallback(e=>{let r=Date.now(),t=b(a({},e),{id:M(),createdAt:r,updatedAt:r});return u(a=>{let n=[...a,t];return f(n),n}),g$1&&g$1(t),t},[g$1,f]),k=useCallback((e,r)=>{let t=null;return u(a$1=>{let n=a$1.findIndex(A=>A.id===e);if(n===-1)return a$1;t=b(a(a({},a$1[n]),r),{updatedAt:Date.now()});let o=[...a$1];return o[n]=t,f(o),o}),t&&C&&C(t),t},[C,f]),I=useCallback(e=>{let r=false;return u(t=>{if(t.findIndex(o=>o.id===e)===-1)return t;r=true;let n=t.filter(o=>o.id!==e);return f(n),n}),r&&B&&B(e),r},[B,f]),L=useCallback(e=>i.find(r=>r.id===e)||null,[i]),U=useCallback(()=>{let e=Date.now(),r=i.filter(s=>s.status==="active"),t=["adequacy_decision","standard_clauses","binding_corporate_rules","ndpc_authorization","explicit_consent","contract_performance","public_interest","legal_claims","vital_interests"],a={};for(let s of t)a[s]=r.filter(c=>c.transferMechanism===s).length;let n=["adequate","inadequate","pending_review","unknown"],o={};for(let s of n)o[s]=r.filter(c=>c.adequacyStatus===s).length;let A=i.filter(s=>{var c,b;return s.status==="pending_approval"||((c=s.ndpcApproval)==null?void 0:c.required)&&!((b=s.ndpcApproval)!=null&&b.approved)}),P=720*60*60*1e3,V=i.filter(s=>s.reviewDate&&s.reviewDate<=e+P&&s.status==="active"),F=i.filter(s=>!s.tiaCompleted&&s.status==="active"),z=i.filter(s=>s.riskLevel==="high"&&s.status==="active");return {totalActiveTransfers:r.length,byMechanism:a,byAdequacy:o,pendingApproval:A,dueForReview:V,missingTIA:F,highRiskTransfers:z,lastUpdated:e}},[i]),O=useCallback(e=>g(e),[]);return {transfers:i,addTransfer:D,updateTransfer:k,removeTransfer:I,getTransfer:L,getSummary:U,validateTransfer:O,isLoading:x}}export{Q as a};//# sourceMappingURL=chunk-TKVJ3OOV.mjs.map
2
- //# sourceMappingURL=chunk-TKVJ3OOV.mjs.map