@tantainnovative/ndpr-toolkit 3.4.0 → 3.5.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 (188) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +80 -38
  3. package/dist/adapters.d.mts +34 -25
  4. package/dist/adapters.d.ts +34 -25
  5. package/dist/breach.d.mts +803 -44
  6. package/dist/breach.d.ts +803 -44
  7. package/dist/breach.js +2 -1
  8. package/dist/breach.mjs +2 -1
  9. package/dist/{chunk-2WH4DLV5.js → chunk-3EGQWLJ6.js} +3 -3
  10. package/dist/chunk-B4Z5MBUC.mjs +2 -0
  11. package/dist/{chunk-LSCMXAPY.mjs → chunk-CKGJK4D7.mjs} +3 -3
  12. package/dist/{chunk-XSEZDQLB.js → chunk-CKJAECGV.js} +2 -2
  13. package/dist/{chunk-AHSMDPG5.js → chunk-CPK5D5FY.js} +2 -2
  14. package/dist/{chunk-DCJK5OZT.mjs → chunk-CWHBCQGT.mjs} +2 -2
  15. package/dist/{chunk-KSERBMXW.mjs → chunk-F5TXUA4O.mjs} +3 -3
  16. package/dist/{chunk-BN77GP4W.mjs → chunk-GN5C32JB.mjs} +2 -2
  17. package/dist/{chunk-ZLSWOFAY.mjs → chunk-GRLIPT5V.mjs} +2 -2
  18. package/dist/{chunk-DUY6F3GT.mjs → chunk-H3EYBSVP.mjs} +3 -3
  19. package/dist/{chunk-MG73MOZC.mjs → chunk-I557S566.mjs} +2 -2
  20. package/dist/{chunk-QVULSG6J.mjs → chunk-ID2NYIVE.mjs} +3 -3
  21. package/dist/chunk-J5WCPZLW.js +2 -0
  22. package/dist/{chunk-4R42ZNO7.mjs → chunk-JFFOPHU3.mjs} +57 -57
  23. package/dist/{chunk-P2YV6DR3.js → chunk-LIM64IV2.js} +3 -3
  24. package/dist/chunk-LU7PKE7Y.mjs +2 -0
  25. package/dist/{chunk-HQSU7LGM.js → chunk-LWXZMKC2.js} +4 -4
  26. package/dist/{chunk-XMBSJJ5U.js → chunk-ORFC66EA.js} +3 -3
  27. package/dist/{chunk-VTITKWGX.mjs → chunk-QSVVAZVT.mjs} +2 -2
  28. package/dist/chunk-SCWNM4PC.mjs +2 -0
  29. package/dist/{chunk-EHAZIKDX.js → chunk-SKKOMFXH.js} +2 -2
  30. package/dist/{chunk-WH6ZMUOS.mjs → chunk-TUNQUVHU.mjs} +2 -2
  31. package/dist/chunk-TV4U6AIS.js +2 -0
  32. package/dist/{chunk-ZYLDLGFL.js → chunk-VIQUXWJC.js} +2 -2
  33. package/dist/{chunk-SUEGUY35.js → chunk-XIM7KMD6.js} +2 -2
  34. package/dist/{chunk-P6QAFBCV.js → chunk-XNSZ7KUH.js} +2 -2
  35. package/dist/{chunk-RNTNHVKZ.js → chunk-YPKUHSK4.js} +2 -2
  36. package/dist/{chunk-UFPSUO52.js → chunk-Z73T6MWY.js} +57 -57
  37. package/dist/consent.d.mts +648 -84
  38. package/dist/consent.d.ts +648 -84
  39. package/dist/consent.js +2 -1
  40. package/dist/consent.mjs +2 -1
  41. package/dist/core.d.mts +2049 -23
  42. package/dist/core.d.ts +2049 -23
  43. package/dist/core.js +1 -1
  44. package/dist/core.mjs +1 -1
  45. package/dist/cross-border.d.mts +470 -99
  46. package/dist/cross-border.d.ts +470 -99
  47. package/dist/cross-border.js +1 -0
  48. package/dist/cross-border.mjs +1 -0
  49. package/dist/dpia.d.mts +591 -37
  50. package/dist/dpia.d.ts +591 -37
  51. package/dist/dpia.js +1 -0
  52. package/dist/dpia.mjs +1 -0
  53. package/dist/dsr.d.mts +654 -37
  54. package/dist/dsr.d.ts +654 -37
  55. package/dist/dsr.js +2 -1
  56. package/dist/dsr.mjs +2 -1
  57. package/dist/hooks.d.mts +2174 -30
  58. package/dist/hooks.d.ts +2174 -30
  59. package/dist/hooks.js +2 -1
  60. package/dist/hooks.mjs +2 -1
  61. package/dist/index.d.mts +4428 -43
  62. package/dist/index.d.ts +4428 -43
  63. package/dist/index.js +2 -1
  64. package/dist/index.mjs +2 -1
  65. package/dist/lawful-basis.d.mts +368 -32
  66. package/dist/lawful-basis.d.ts +368 -32
  67. package/dist/lawful-basis.js +1 -0
  68. package/dist/lawful-basis.mjs +1 -0
  69. package/dist/policy.d.mts +1178 -83
  70. package/dist/policy.d.ts +1178 -83
  71. package/dist/policy.js +2 -1
  72. package/dist/policy.mjs +2 -1
  73. package/dist/presets.d.mts +1020 -114
  74. package/dist/presets.d.ts +1020 -114
  75. package/dist/presets.js +2 -1
  76. package/dist/presets.mjs +2 -1
  77. package/dist/ropa.d.mts +396 -31
  78. package/dist/ropa.d.ts +396 -31
  79. package/dist/ropa.js +2 -1
  80. package/dist/ropa.mjs +2 -1
  81. package/dist/server.d.mts +2133 -24
  82. package/dist/server.d.ts +2133 -24
  83. package/dist/server.js +1 -1
  84. package/dist/server.mjs +1 -1
  85. package/dist/unstyled.d.mts +523 -55
  86. package/dist/unstyled.d.ts +523 -55
  87. package/dist/unstyled.js +2 -1
  88. package/dist/unstyled.mjs +2 -1
  89. package/package.json +3 -3
  90. package/dist/BreachReportForm-DpRrBoxU.d.ts +0 -158
  91. package/dist/BreachReportForm-yJ2Zl6gz.d.mts +0 -158
  92. package/dist/ConsentBanner-F5ayys5K.d.mts +0 -156
  93. package/dist/ConsentBanner-VqIPophc.d.ts +0 -156
  94. package/dist/ConsentManager-C7I3PDe8.d.mts +0 -105
  95. package/dist/ConsentManager-CQ2IZtUU.d.ts +0 -105
  96. package/dist/CrossBorderTransferManager-D5Lc0e46.d.ts +0 -90
  97. package/dist/CrossBorderTransferManager-DkZhv9vD.d.mts +0 -90
  98. package/dist/DPIAQuestionnaire-VXBoWFMC.d.ts +0 -123
  99. package/dist/DPIAQuestionnaire-jkt1Veb6.d.mts +0 -123
  100. package/dist/DSRRequestForm-D8rPTNmU.d.ts +0 -146
  101. package/dist/DSRRequestForm-DRouEr9j.d.mts +0 -146
  102. package/dist/DSRTracker-Bl__d4df.d.ts +0 -163
  103. package/dist/DSRTracker-CSVDfgQQ.d.mts +0 -163
  104. package/dist/LawfulBasisTracker-CBqOxX1D.d.mts +0 -85
  105. package/dist/LawfulBasisTracker-Cg30NbDA.d.ts +0 -85
  106. package/dist/NDPRDashboard-CLJpEg0X.d.mts +0 -44
  107. package/dist/NDPRDashboard-DDWNd2Ah.d.ts +0 -44
  108. package/dist/NDPRProvider-DYFb8xEl.d.ts +0 -68
  109. package/dist/NDPRProvider-U3QNu6MA.d.mts +0 -68
  110. package/dist/PolicyExporter-Bgi6nz82.d.mts +0 -291
  111. package/dist/PolicyExporter-BnvuFncj.d.ts +0 -291
  112. package/dist/ROPAManager-BS4eB8Hw.d.mts +0 -79
  113. package/dist/ROPAManager-qxTrXLkD.d.ts +0 -79
  114. package/dist/RegulatoryReportGenerator-BUYgzTTT.d.ts +0 -282
  115. package/dist/RegulatoryReportGenerator-DwcHcEFp.d.mts +0 -282
  116. package/dist/StepIndicator-CgrlokSV.d.ts +0 -171
  117. package/dist/StepIndicator-W8S_QjgO.d.mts +0 -171
  118. package/dist/breach-B_-6lDqS.d.mts +0 -17
  119. package/dist/breach-CzXqSsaY.d.ts +0 -17
  120. package/dist/breach-Eu9byel8.d.mts +0 -185
  121. package/dist/breach-Eu9byel8.d.ts +0 -185
  122. package/dist/chunk-5X32J5IA.mjs +0 -2
  123. package/dist/chunk-7D2OIPHH.mjs +0 -2
  124. package/dist/chunk-JKKRPS4P.js +0 -2
  125. package/dist/chunk-NCOZB2WU.mjs +0 -2
  126. package/dist/chunk-RGNP45VR.js +0 -2
  127. package/dist/compliance-score-racQe_E_.d.mts +0 -115
  128. package/dist/compliance-score-racQe_E_.d.ts +0 -115
  129. package/dist/consent-CmVzqZUk.d.mts +0 -99
  130. package/dist/consent-CmVzqZUk.d.ts +0 -99
  131. package/dist/consent-audit-BdByjYlM.d.mts +0 -65
  132. package/dist/consent-audit-DhbfMR0n.d.ts +0 -65
  133. package/dist/cross-border-BBi9rZyO.d.mts +0 -54
  134. package/dist/cross-border-Dy-U9Hu6.d.ts +0 -54
  135. package/dist/cross-border-UyT00llA.d.mts +0 -141
  136. package/dist/cross-border-UyT00llA.d.ts +0 -141
  137. package/dist/docx-BxKascXN.d.ts +0 -64
  138. package/dist/docx-CV7Vsry_.d.mts +0 -64
  139. package/dist/dpia-D82hUrJe.d.ts +0 -15
  140. package/dist/dpia-DQDFw2_l.d.mts +0 -15
  141. package/dist/dpia-c9GiiOq0.d.mts +0 -137
  142. package/dist/dpia-c9GiiOq0.d.ts +0 -137
  143. package/dist/dsr-CIx5sd7e.d.ts +0 -14
  144. package/dist/dsr-XZ_HqTlA.d.mts +0 -14
  145. package/dist/dsr-yKbqX531.d.mts +0 -128
  146. package/dist/dsr-yKbqX531.d.ts +0 -128
  147. package/dist/lawful-basis-BEyI0kGg.d.ts +0 -57
  148. package/dist/lawful-basis-C2eGaoHM.d.mts +0 -57
  149. package/dist/lawful-basis-Cv1VmDLn.d.mts +0 -112
  150. package/dist/lawful-basis-Cv1VmDLn.d.ts +0 -112
  151. package/dist/locale-CxJx2tzn.d.mts +0 -25
  152. package/dist/locale-DSkrtf-c.d.ts +0 -25
  153. package/dist/policy-engine-CCUCud2T.d.ts +0 -154
  154. package/dist/policy-engine-fYSqEqSW.d.mts +0 -154
  155. package/dist/policy-sections-BYx6fEFk.d.ts +0 -56
  156. package/dist/policy-sections-Dm97Nq8m.d.mts +0 -56
  157. package/dist/policy-templates-DhLwq4R-.d.ts +0 -43
  158. package/dist/policy-templates-DwYl2329.d.mts +0 -43
  159. package/dist/privacy-Ca6te9Ir.d.mts +0 -138
  160. package/dist/privacy-Ca6te9Ir.d.ts +0 -138
  161. package/dist/ropa-BDTM06tr.d.ts +0 -152
  162. package/dist/ropa-CFHuT7jE.d.mts +0 -152
  163. package/dist/ropa-CyynscU6.d.ts +0 -51
  164. package/dist/ropa-NIgxd8uP.d.mts +0 -51
  165. package/dist/sanitize-CxxwKxAx.d.mts +0 -94
  166. package/dist/sanitize-CxxwKxAx.d.ts +0 -94
  167. package/dist/styling-BMDGQDgS.d.mts +0 -64
  168. package/dist/styling-BaoQtV06.d.ts +0 -64
  169. package/dist/types-DK2CoKOC.d.mts +0 -10
  170. package/dist/types-DK2CoKOC.d.ts +0 -10
  171. package/dist/useAdaptivePolicyWizard-BnjW4OR4.d.mts +0 -52
  172. package/dist/useAdaptivePolicyWizard-sb3m4-Zk.d.ts +0 -52
  173. package/dist/useBreach-CPr86Yan.d.mts +0 -115
  174. package/dist/useBreach-DkVXvtJK.d.ts +0 -115
  175. package/dist/useConsent-DCNkIJHR.d.mts +0 -75
  176. package/dist/useConsent-dOcELSfX.d.ts +0 -75
  177. package/dist/useCrossBorderTransfer-DixjLjN1.d.mts +0 -78
  178. package/dist/useCrossBorderTransfer-DvSq06lv.d.ts +0 -78
  179. package/dist/useDPIA-B6180UQn.d.mts +0 -109
  180. package/dist/useDPIA-CTqbNbww.d.ts +0 -109
  181. package/dist/useDSR-WvHk8_iu.d.mts +0 -85
  182. package/dist/useDSR-wH4H6hSM.d.ts +0 -85
  183. package/dist/useDefaultPrivacyPolicy-Cs2WQSYQ.d.mts +0 -162
  184. package/dist/useDefaultPrivacyPolicy-DkOqMg2e.d.ts +0 -162
  185. package/dist/useLawfulBasis-CKJ-kw84.d.mts +0 -79
  186. package/dist/useLawfulBasis-DFTmu1ca.d.ts +0 -79
  187. package/dist/useROPA-BSSU1rfx.d.ts +0 -76
  188. package/dist/useROPA-C2hjaBTz.d.mts +0 -76
@@ -1,6 +1,6 @@
1
- 'use strict';var chunkP2YV6DR3_js=require('./chunk-P2YV6DR3.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ye=({sections:_=chunkP2YV6DR3_js.c,variables:U=chunkP2YV6DR3_js.d,onGenerate:L,title:M="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:K="",buttonClassName:T="",generateButtonText:Q="Generate Policy",showPreview:B=true,allowEditing:N=true,classNames:r,unstyled:x=false})=>{let P=react.useId(),[A,n]=react.useState(_),[i,s]=react.useState(U),[m,$]=react.useState("sections"),[S,X]=react.useState(""),[F,R]=react.useState(""),[J,Z]=react.useState(false),[v,I]=react.useState({});react.useEffect(()=>{n(_);},[_]),react.useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(b=>b.id===l?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},b),{value:c}):b)),v[l]&&I(a=>{let b=chunkMQFZHA2D_js.a({},a);return delete b[l],b});},j=()=>{let l={},c=true;return i.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=A.filter(b=>b.included),c=Object.fromEntries(i.map(b=>[b.name,b.value])),a="";l.forEach(b=>{a+=`## ${b.title}
1
+ 'use strict';var chunkLIM64IV2_js=require('./chunk-LIM64IV2.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ye=({sections:_=chunkLIM64IV2_js.c,variables:U=chunkLIM64IV2_js.d,onGenerate:L,title:M="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:K="",buttonClassName:T="",generateButtonText:Q="Generate Policy",showPreview:B=true,allowEditing:N=true,classNames:r,unstyled:x=false})=>{let P=react.useId(),[A,n]=react.useState(_),[i,s]=react.useState(U),[m,$]=react.useState("sections"),[S,X]=react.useState(""),[F,R]=react.useState(""),[J,Z]=react.useState(false),[v,I]=react.useState({});react.useEffect(()=>{n(_);},[_]),react.useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(b=>b.id===l?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},b),{value:c}):b)),v[l]&&I(a=>{let b=chunkMQFZHA2D_js.a({},a);return delete b[l],b});},j=()=>{let l={},c=true;return i.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=A.filter(b=>b.included),c=Object.fromEntries(i.map(b=>[b.name,b.value])),a="";l.forEach(b=>{a+=`## ${b.title}
2
2
 
3
- `,a+=chunkP2YV6DR3_js.b(b.template,c),a+=`
3
+ `,a+=chunkLIM64IV2_js.b(b.template,c),a+=`
4
4
 
5
5
  `;}),X(a),R(a),Z(true),$("preview");},h=()=>{L({sections:A,variables:i,content:N?F:S});},g=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-generator",className:chunkE64TU6IU_js.a("ndpr-form-section",r==null?void 0:r.sectionList,x),role:"group","aria-labelledby":`${P}-sections-heading`,children:[jsxRuntime.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}`,a=l.description?`${P}-section-desc-${l.id}`:void 0;return jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("border border-gray-200 dark:border-gray-700 rounded-md p-4",r==null?void 0:r.sectionItem,x),children:jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:c,type:"checkbox",checked:l.included,onChange:()=>G(l.id),disabled:l.required,"aria-describedby":a,className:chunkE64TU6IU_js.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,x)})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[l.title," ",l.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),l.required&&jsxRuntime.jsx("span",{className:"sr-only",children:" (required)"})]}),l.description&&jsxRuntime.jsx("p",{id:a,className:"ndpr-text-muted mt-1",children:l.description})]})]})},l.id)}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:"Next: Fill Variables"})})]}),w=()=>{let l={};return i.forEach(c=>{let a=c.id.split(".")[0];l[a]||(l[a]=[]),l[a].push(c);}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",r==null?void 0:r.form,x),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:Object.entries(l).map(([c,a])=>{let b=A.find(e=>e.id===c);return b&&!b.included?null:jsxRuntime.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsx("h4",{className:"font-medium text-lg mb-3",children:b?b.title:"General Information"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:a.map(e=>{let y=`${P}-var-${e.id}`,u=e.description?`${P}-var-desc-${e.id}`:void 0,z=v[e.id]?`${P}-var-err-${e.id}`:void 0,O=[u,z].filter(Boolean).join(" ")||void 0;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:y,className:"ndpr-form-field__label",children:[e.name," ",e.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),e.description&&jsxRuntime.jsx("p",{id:u,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsxRuntime.jsx("textarea",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),rows:4,className:chunkE64TU6IU_js.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,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxRuntime.jsxs("select",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),className:chunkE64TU6IU_js.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,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),e.options.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]}):jsxRuntime.jsx("input",{id:y,type:e.inputType,value:e.value,onChange:E=>W(e.id,E.target.value),className:chunkE64TU6IU_js.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,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}),v[e.id]&&jsxRuntime.jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:v[e.id]})]},e.id)})})]},c)})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.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 ${T}`,children:"Back to Sections"}),jsxRuntime.jsx("button",{onClick:ee,className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:Q})]})]})},C=()=>{let l=`${P}-policy-content`;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),N?jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:l,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsxRuntime.jsx("textarea",{id:l,value:F,onChange:c=>R(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsxRuntime.jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsxRuntime.jsx("div",{className:"prose dark:prose-invert max-w-none",children:S.split(`
6
6
  `).map((c,a)=>c.startsWith("## ")?jsxRuntime.jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},a):c.startsWith("### ")?jsxRuntime.jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},a):c===""?jsxRuntime.jsx("br",{},a):jsxRuntime.jsx("p",{className:"mb-2",children:c},a))})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.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 ${T}`,children:"Back to Variables"}),jsxRuntime.jsx("button",{onClick:h,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${K}`,r==null?void 0:r.root,x),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6",r==null?void 0:r.header,x),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",r==null?void 0:r.title,x),children:M}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("ndpr-card__subtitle",r==null?void 0:r.description,x),children:V})]}),jsxRuntime.jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxRuntime.jsxs("ol",{className:"flex items-center w-full",children:[jsxRuntime.jsxs("li",{className:`flex w-full items-center ${m==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} 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:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="sections"?"step":void 0,children:"1"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="sections"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex w-full items-center ${m==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} 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:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="variables"?"step":void 0,children:"2"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="variables"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex items-center ${m==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="preview"?"step":void 0,children:"3"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="preview"?" (current step)":""})]})]})}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("ndpr-alert ndpr-alert--info",r==null?void 0:r.complianceNotice,x),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info 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."})]}),q()]})};var _e=({content:_,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:A,lastUpdated:n,classNames:i,unstyled:s=false})=>{let m=react.useId(),[$,S]=react.useState("preview"),X=`${m}-tab-preview`,F=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,v=(()=>{let h=_.split(`
@@ -90,5 +90,5 @@
90
90
  <p>&copy; ${new Date().getFullYear()} ${L||"Company"}. All rights reserved.</p>
91
91
  </div>
92
92
  </body>
93
- </html>`,u},l=()=>chunkMQFZHA2D_js.d(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),y="",u;switch(e){case "pdf":let te=q();u=new Blob([te],{type:"text/html"}),y=URL.createObjectURL(u);break;case "docx":u=new Blob([_],{type:"text/plain"}),y=URL.createObjectURL(u);break;case "html":let pe=q();u=new Blob([pe],{type:"text/html"}),y=URL.createObjectURL(u);break;default:u=new Blob([_],{type:"text/markdown"}),y=URL.createObjectURL(u);break}let z=C(e),O=document.createElement("a");O.href=y,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let E={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:y,filename:z};$(te=>[E,...te]),V&&V(e,y);}catch(e){console.error("[ndpr-toolkit] Export error:",e),Z("An error occurred during export. Please try again.");}finally{R(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)"}],y=`${s}-export-format`;return jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-exporter",className:chunkE64TU6IU_js.a("mb-6",n==null?void 0:n.formatSelector,i),children:[jsxRuntime.jsx("label",{htmlFor:y,className:"ndpr-form-field__label",children:"Export Format"}),jsxRuntime.jsx("select",{id:y,value:S,onChange:u=>X(u.target.value),className:chunkE64TU6IU_js.a("ndpr-form-field__input",n==null?void 0:n.formatOption,i),children:e.map(u=>jsxRuntime.jsx("option",{value:u.value,children:u.label},u.value))})]})},a=()=>h?jsxRuntime.jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>g(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsxRuntime.jsx("input",{type:"text",id:`${s}-custom-filename`,value:v,onChange:e=>I(e.target.value),placeholder:w(S),"aria-describedby":`${s}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsxRuntime.jsx("p",{id:`${s}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:`${s}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>g(e.target.checked),"aria-describedby":`${s}-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"})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsx("label",{htmlFor:`${s}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsxRuntime.jsx("p",{id:`${s}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>g(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),b=()=>!N||m.length===0?null:jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mt-6",n==null?void 0:n.preview,i),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsxRuntime.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsxRuntime.jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(e=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsxRuntime.jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,i),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6",n==null?void 0:n.header,i),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",n==null?void 0:n.title,i),children:K}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("ndpr-card__subtitle",n==null?void 0:n.description,i),children:T})]}),c(),a(),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("button",{onClick:l,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 ${B} ${F?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),i),children:F?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsxRuntime.jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,i),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxRuntime.jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsxRuntime.jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsxRuntime.jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsxRuntime.jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsxRuntime.jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),b()]})};exports.a=ye;exports.b=_e;exports.c=Ae;//# sourceMappingURL=chunk-HQSU7LGM.js.map
94
- //# sourceMappingURL=chunk-HQSU7LGM.js.map
93
+ </html>`,u},l=()=>chunkMQFZHA2D_js.d(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),y="",u;switch(e){case "pdf":let te=q();u=new Blob([te],{type:"text/html"}),y=URL.createObjectURL(u);break;case "docx":u=new Blob([_],{type:"text/plain"}),y=URL.createObjectURL(u);break;case "html":let pe=q();u=new Blob([pe],{type:"text/html"}),y=URL.createObjectURL(u);break;default:u=new Blob([_],{type:"text/markdown"}),y=URL.createObjectURL(u);break}let z=C(e),O=document.createElement("a");O.href=y,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let E={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:y,filename:z};$(te=>[E,...te]),V&&V(e,y);}catch(e){console.error("[ndpr-toolkit] Export error:",e),Z("An error occurred during export. Please try again.");}finally{R(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)"}],y=`${s}-export-format`;return jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-exporter",className:chunkE64TU6IU_js.a("mb-6",n==null?void 0:n.formatSelector,i),children:[jsxRuntime.jsx("label",{htmlFor:y,className:"ndpr-form-field__label",children:"Export Format"}),jsxRuntime.jsx("select",{id:y,value:S,onChange:u=>X(u.target.value),className:chunkE64TU6IU_js.a("ndpr-form-field__input",n==null?void 0:n.formatOption,i),children:e.map(u=>jsxRuntime.jsx("option",{value:u.value,children:u.label},u.value))})]})},a=()=>h?jsxRuntime.jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>g(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsxRuntime.jsx("input",{type:"text",id:`${s}-custom-filename`,value:v,onChange:e=>I(e.target.value),placeholder:w(S),"aria-describedby":`${s}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsxRuntime.jsx("p",{id:`${s}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:`${s}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>g(e.target.checked),"aria-describedby":`${s}-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"})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsx("label",{htmlFor:`${s}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsxRuntime.jsx("p",{id:`${s}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>g(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),b=()=>!N||m.length===0?null:jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mt-6",n==null?void 0:n.preview,i),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsxRuntime.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsxRuntime.jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(e=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsxRuntime.jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,i),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6",n==null?void 0:n.header,i),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",n==null?void 0:n.title,i),children:K}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("ndpr-card__subtitle",n==null?void 0:n.description,i),children:T})]}),c(),a(),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("button",{onClick:l,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 ${B} ${F?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),i),children:F?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsxRuntime.jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,i),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxRuntime.jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsxRuntime.jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsxRuntime.jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsxRuntime.jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsxRuntime.jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),b()]})};exports.a=ye;exports.b=_e;exports.c=Ae;//# sourceMappingURL=chunk-LWXZMKC2.js.map
94
+ //# sourceMappingURL=chunk-LWXZMKC2.js.map
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkUFPSUO52_js=require('./chunk-UFPSUO52.js'),chunkRNTNHVKZ_js=require('./chunk-RNTNHVKZ.js'),chunkAHSMDPG5_js=require('./chunk-AHSMDPG5.js'),chunkELKB2AFZ_js=require('./chunk-ELKB2AFZ.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');var nt=10,Rt="ndpr_policy_draft",_t=2e3;function st(){return `section_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function it(){return `draft_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function w(u,A,M){let S=Date.now();return {id:M,title:`Privacy Policy${u.org.name?` \u2014 ${u.org.name}`:""}`,templateId:"adaptive-policy-wizard",organizationInfo:{name:u.org.name,website:u.org.website,privacyEmail:u.org.privacyEmail,address:u.org.address,dpoName:u.org.dpoName,dpoEmail:u.org.dpoEmail,industry:u.org.industry},sections:A,variableValues:{},effectiveDate:S,lastUpdated:S,version:"1.0",applicableFrameworks:["ndpa","ndpr"]}}function Ut(u={}){var K;let{onComplete:A,onComplianceChange:M}=u,S=react.useRef((K=u.adapter)!=null?K:chunkELKB2AFZ_js.a(Rt));u.adapter&&(S.current=u.adapter);let f=react.useRef(it()),[P,y]=react.useState(1),[n,v]=react.useState(chunkRNTNHVKZ_js.b),[b,O]=react.useState([]),[x,I]=react.useState({}),[E,$]=react.useState([]),[at,q]=react.useState(false),[ct,z]=react.useState(null),[N,U]=react.useState(true),T=react.useRef(false),R=react.useRef(null);react.useEffect(()=>{let t=false,e=r=>{r&&(f.current=r.id,v(r.templateContext),O(r.customSections),I(r.sectionOverrides),$(r.sectionOrder),y(r.currentStep),z(r.lastSavedAt),q(true));};try{let r=S.current.load();r instanceof Promise?r.then(i=>{t||(e(i),U(!1));},()=>{t||U(!1);}):(e(r),U(!1));}catch(r){t||U(false);}return ()=>{t=true;}},[]);let l=react.useMemo(()=>{let e=chunkAHSMDPG5_js.c(n).map(o=>x[o.id]?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},o),{template:x[o.id]}):o),r=b.map(o=>{var d;return {id:o.id,title:o.title,template:(d=x[o.id])!=null?d:o.content,order:o.order,required:false,included:true}}),i=[...e,...r];if(E.length>0){let o=new Map(E.map((d,p)=>[d,p]));return [...i].sort((d,p)=>{let m=o.has(d.id)?o.get(d.id):i.length,C=o.has(p.id)?o.get(p.id):i.length;return m-C})}return [...i].sort((o,d)=>{var p,m;return ((p=o.order)!=null?p:0)-((m=d.order)!=null?m:0)})},[n,b,x,E]),s=react.useMemo(()=>!n.org.name&&!n.org.privacyEmail?null:w(n,l,f.current),[n,l]),Y=react.useMemo(()=>w(chunkRNTNHVKZ_js.b(),[],f.current),[]),V=react.useMemo(()=>chunkRNTNHVKZ_js.c(s!=null?s:Y,n),[s,n,Y]),_=V.percentage,D=V.gaps,j=react.useRef({score:-1,gaps:[]});react.useEffect(()=>{let t=j.current;M&&(_!==t.score||D!==t.gaps)&&M(_,D),j.current={score:_,gaps:D};},[_,D,M]);let dt=react.useMemo(()=>{switch(P){case 1:return n.org.name.trim().length>0&&n.org.privacyEmail.trim().length>0;case 2:return n.dataCategories.some(t=>t.selected);case 3:return n.purposes.length>0;case 4:return true;default:return false}},[P,n]),lt=react.useCallback(t=>{let e=Math.min(Math.max(1,t),4);e<4&&(T.current=false),y(e);},[]),pt=react.useCallback(()=>{y(t=>Math.min(t+1,4));},[]),ut=react.useCallback(()=>{T.current=false,y(t=>Math.max(t-1,1));},[]),mt=react.useCallback(t=>{v(e=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},e),t));},[]),gt=react.useCallback(t=>{v(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{org:chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},e.org),t)}));},[]),ft=react.useCallback(t=>{v(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{dataCategories:e.dataCategories.map(r=>r.id===t?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},r),{selected:!r.selected}):r)}));},[]),Pt=react.useCallback(t=>{v(e=>{let r=t,i=e.purposes.includes(r);return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{purposes:i?e.purposes.filter(o=>o!==t):[...e.purposes,r]})});},[]),yt=react.useCallback(t=>{v(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{thirdPartyProcessors:[...e.thirdPartyProcessors,t]}));},[]),Ct=react.useCallback(t=>{v(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{thirdPartyProcessors:e.thirdPartyProcessors.filter((r,i)=>i!==t)}));},[]),St=react.useCallback(t=>{O(e=>e.length>=nt?e:[...e,chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{id:st(),required:false})]);},[]),vt=react.useCallback((t,e)=>{O(r=>r.map(i=>i.id===t?chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},i),e):i));},[]),xt=react.useCallback(t=>{O(e=>e.filter(r=>r.id!==t)),$(e=>e.filter(r=>r!==t)),I(e=>{let r=chunkMQFZHA2D_js.a({},e);return delete r[t],r});},[]),ht=react.useCallback((t,e)=>{$(r=>{let i=r.length>0?r:l.map(m=>m.id),o=i.indexOf(t);if(o===-1){let m=l.map(It=>It.id),C=m.indexOf(t);if(C===-1)return r;let G=e==="up"?C-1:C+1;if(G<0||G>=m.length)return m;let k=[...m];return [k[C],k[G]]=[k[G],k[C]],k}let d=e==="up"?o-1:o+1;if(d<0||d>=i.length)return i;let p=[...i];return [p[o],p[d]]=[p[d],p[o]],p});},[l]),Dt=react.useCallback((t,e)=>{I(r=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},r),{[t]:e}));},[]),bt=react.useCallback(t=>{let e=D.find(r=>r.requirementId===t);if(e)switch(e.fixType){case "fill_field":{T.current=false;let i=["data-categories-disclosed"],o=["purpose-of-processing"];i.includes(t)?y(2):o.includes(t)?y(3):(y(1));break}case "add_section":{if(!e.suggestedContent)break;O(r=>r.length>=nt?r:[...r,{id:st(),title:e.requirement,content:e.suggestedContent,order:999,required:false}]);break}case "add_content":{if(!e.suggestedContent)break;let r="data-subject-rights";I(i=>{var d,p,m;let o=(m=(p=i[r])!=null?p:(d=l.find(C=>C.id===r))==null?void 0:d.template)!=null?m:"";return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{[r]:`${o}
1
+ 'use strict';var chunkZ73T6MWY_js=require('./chunk-Z73T6MWY.js'),chunkYPKUHSK4_js=require('./chunk-YPKUHSK4.js'),chunkCPK5D5FY_js=require('./chunk-CPK5D5FY.js'),chunkELKB2AFZ_js=require('./chunk-ELKB2AFZ.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');var nt=10,Rt="ndpr_policy_draft",_t=2e3;function st(){return `section_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function it(){return `draft_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function w(u,A,M){let S=Date.now();return {id:M,title:`Privacy Policy${u.org.name?` \u2014 ${u.org.name}`:""}`,templateId:"adaptive-policy-wizard",organizationInfo:{name:u.org.name,website:u.org.website,privacyEmail:u.org.privacyEmail,address:u.org.address,dpoName:u.org.dpoName,dpoEmail:u.org.dpoEmail,industry:u.org.industry},sections:A,variableValues:{},effectiveDate:S,lastUpdated:S,version:"1.0",applicableFrameworks:["ndpa","ndpr"]}}function Ut(u={}){var K;let{onComplete:A,onComplianceChange:M}=u,S=react.useRef((K=u.adapter)!=null?K:chunkELKB2AFZ_js.a(Rt));u.adapter&&(S.current=u.adapter);let f=react.useRef(it()),[P,y]=react.useState(1),[n,v]=react.useState(chunkYPKUHSK4_js.b),[b,O]=react.useState([]),[x,I]=react.useState({}),[E,$]=react.useState([]),[at,q]=react.useState(false),[ct,z]=react.useState(null),[N,U]=react.useState(true),T=react.useRef(false),R=react.useRef(null);react.useEffect(()=>{let t=false,e=r=>{r&&(f.current=r.id,v(r.templateContext),O(r.customSections),I(r.sectionOverrides),$(r.sectionOrder),y(r.currentStep),z(r.lastSavedAt),q(true));};try{let r=S.current.load();r instanceof Promise?r.then(i=>{t||(e(i),U(!1));},()=>{t||U(!1);}):(e(r),U(!1));}catch(r){t||U(false);}return ()=>{t=true;}},[]);let l=react.useMemo(()=>{let e=chunkCPK5D5FY_js.c(n).map(o=>x[o.id]?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},o),{template:x[o.id]}):o),r=b.map(o=>{var d;return {id:o.id,title:o.title,template:(d=x[o.id])!=null?d:o.content,order:o.order,required:false,included:true}}),i=[...e,...r];if(E.length>0){let o=new Map(E.map((d,p)=>[d,p]));return [...i].sort((d,p)=>{let m=o.has(d.id)?o.get(d.id):i.length,C=o.has(p.id)?o.get(p.id):i.length;return m-C})}return [...i].sort((o,d)=>{var p,m;return ((p=o.order)!=null?p:0)-((m=d.order)!=null?m:0)})},[n,b,x,E]),s=react.useMemo(()=>!n.org.name&&!n.org.privacyEmail?null:w(n,l,f.current),[n,l]),Y=react.useMemo(()=>w(chunkYPKUHSK4_js.b(),[],f.current),[]),V=react.useMemo(()=>chunkYPKUHSK4_js.c(s!=null?s:Y,n),[s,n,Y]),_=V.percentage,D=V.gaps,j=react.useRef({score:-1,gaps:[]});react.useEffect(()=>{let t=j.current;M&&(_!==t.score||D!==t.gaps)&&M(_,D),j.current={score:_,gaps:D};},[_,D,M]);let dt=react.useMemo(()=>{switch(P){case 1:return n.org.name.trim().length>0&&n.org.privacyEmail.trim().length>0;case 2:return n.dataCategories.some(t=>t.selected);case 3:return n.purposes.length>0;case 4:return true;default:return false}},[P,n]),lt=react.useCallback(t=>{let e=Math.min(Math.max(1,t),4);e<4&&(T.current=false),y(e);},[]),pt=react.useCallback(()=>{y(t=>Math.min(t+1,4));},[]),ut=react.useCallback(()=>{T.current=false,y(t=>Math.max(t-1,1));},[]),mt=react.useCallback(t=>{v(e=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},e),t));},[]),gt=react.useCallback(t=>{v(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{org:chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},e.org),t)}));},[]),ft=react.useCallback(t=>{v(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{dataCategories:e.dataCategories.map(r=>r.id===t?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},r),{selected:!r.selected}):r)}));},[]),Pt=react.useCallback(t=>{v(e=>{let r=t,i=e.purposes.includes(r);return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{purposes:i?e.purposes.filter(o=>o!==t):[...e.purposes,r]})});},[]),yt=react.useCallback(t=>{v(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{thirdPartyProcessors:[...e.thirdPartyProcessors,t]}));},[]),Ct=react.useCallback(t=>{v(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{thirdPartyProcessors:e.thirdPartyProcessors.filter((r,i)=>i!==t)}));},[]),St=react.useCallback(t=>{O(e=>e.length>=nt?e:[...e,chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{id:st(),required:false})]);},[]),vt=react.useCallback((t,e)=>{O(r=>r.map(i=>i.id===t?chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},i),e):i));},[]),xt=react.useCallback(t=>{O(e=>e.filter(r=>r.id!==t)),$(e=>e.filter(r=>r!==t)),I(e=>{let r=chunkMQFZHA2D_js.a({},e);return delete r[t],r});},[]),ht=react.useCallback((t,e)=>{$(r=>{let i=r.length>0?r:l.map(m=>m.id),o=i.indexOf(t);if(o===-1){let m=l.map(It=>It.id),C=m.indexOf(t);if(C===-1)return r;let G=e==="up"?C-1:C+1;if(G<0||G>=m.length)return m;let k=[...m];return [k[C],k[G]]=[k[G],k[C]],k}let d=e==="up"?o-1:o+1;if(d<0||d>=i.length)return i;let p=[...i];return [p[o],p[d]]=[p[d],p[o]],p});},[l]),Dt=react.useCallback((t,e)=>{I(r=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},r),{[t]:e}));},[]),bt=react.useCallback(t=>{let e=D.find(r=>r.requirementId===t);if(e)switch(e.fixType){case "fill_field":{T.current=false;let i=["data-categories-disclosed"],o=["purpose-of-processing"];i.includes(t)?y(2):o.includes(t)?y(3):(y(1));break}case "add_section":{if(!e.suggestedContent)break;O(r=>r.length>=nt?r:[...r,{id:st(),title:e.requirement,content:e.suggestedContent,order:999,required:false}]);break}case "add_content":{if(!e.suggestedContent)break;let r="data-subject-rights";I(i=>{var d,p,m;let o=(m=(p=i[r])!=null?p:(d=l.find(C=>C.id===r))==null?void 0:d.template)!=null?m:"";return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{[r]:`${o}
2
2
 
3
- ${e.suggestedContent}`.trim()})});break}}},[D,l]),X=react.useCallback(t=>({id:f.current,templateContext:n,customSections:b,sectionOverrides:x,sectionOrder:E,currentStep:t,lastSavedAt:Date.now(),status:"draft"}),[n,b,x,E]),Ot=react.useCallback(()=>chunkMQFZHA2D_js.d(null,null,function*(){let t=X(P);try{yield Promise.resolve(S.current.save(t)),z(t.lastSavedAt),q(!0);}catch(e){console.warn("[ndpr-toolkit] Failed to save draft:",e);}}),[X,P]),Et=react.useCallback(()=>{Promise.resolve(S.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove draft:",t);}),f.current=it(),T.current=false,v(chunkRNTNHVKZ_js.b()),O([]),I({}),$([]),y(1),q(false),z(null);},[]);react.useEffect(()=>{if(!N)return R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{let t=X(P);Promise.resolve(S.current.save(t)).then(()=>{z(t.lastSavedAt),q(true);}).catch(e=>{console.warn("[ndpr-toolkit] Auto-save failed:",e);});},_t),()=>{R.current&&clearTimeout(R.current);}},[n,b,x,E,P,N,X]),react.useEffect(()=>{P===4&&s&&A&&!T.current&&(T.current=true,A(s));},[P,s,A]);let Tt=react.useCallback(t=>chunkMQFZHA2D_js.d(null,null,function*(){let e=s!=null?s:w(n,l,f.current);return chunkUFPSUO52_js.c(e,t)}),[s,n,l]),wt=react.useCallback(t=>chunkMQFZHA2D_js.d(null,null,function*(){let e=s!=null?s:w(n,l,f.current);return chunkUFPSUO52_js.d(e,t)}),[s,n,l]),At=react.useCallback(t=>{let e=s!=null?s:w(n,l,f.current);return chunkUFPSUO52_js.a(e,t)},[s,n,l]),Mt=react.useCallback(()=>{let t=s!=null?s:w(n,l,f.current);return chunkUFPSUO52_js.b(t)},[s,n,l]);return {currentStep:P,goToStep:lt,nextStep:pt,prevStep:ut,canProceed:dt,context:n,updateContext:mt,updateOrg:gt,toggleDataCategory:ft,togglePurpose:Pt,addProcessor:yt,removeProcessor:Ct,policy:s,sections:l,customSections:b,addCustomSection:St,updateCustomSection:vt,removeCustomSection:xt,reorderSections:ht,editSectionContent:Dt,sectionOverrides:x,complianceScore:_,complianceResult:V,complianceGaps:D,applyFix:bt,handleExportPDF:Tt,handleExportDOCX:wt,handleExportHTML:At,handleExportMarkdown:Mt,isDraftSaved:at,lastSavedAt:ct,saveDraft:Ot,discardDraft:Et,isLoading:N}}exports.a=Ut;//# sourceMappingURL=chunk-XMBSJJ5U.js.map
4
- //# sourceMappingURL=chunk-XMBSJJ5U.js.map
3
+ ${e.suggestedContent}`.trim()})});break}}},[D,l]),X=react.useCallback(t=>({id:f.current,templateContext:n,customSections:b,sectionOverrides:x,sectionOrder:E,currentStep:t,lastSavedAt:Date.now(),status:"draft"}),[n,b,x,E]),Ot=react.useCallback(()=>chunkMQFZHA2D_js.d(null,null,function*(){let t=X(P);try{yield Promise.resolve(S.current.save(t)),z(t.lastSavedAt),q(!0);}catch(e){console.warn("[ndpr-toolkit] Failed to save draft:",e);}}),[X,P]),Et=react.useCallback(()=>{Promise.resolve(S.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove draft:",t);}),f.current=it(),T.current=false,v(chunkYPKUHSK4_js.b()),O([]),I({}),$([]),y(1),q(false),z(null);},[]);react.useEffect(()=>{if(!N)return R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{let t=X(P);Promise.resolve(S.current.save(t)).then(()=>{z(t.lastSavedAt),q(true);}).catch(e=>{console.warn("[ndpr-toolkit] Auto-save failed:",e);});},_t),()=>{R.current&&clearTimeout(R.current);}},[n,b,x,E,P,N,X]),react.useEffect(()=>{P===4&&s&&A&&!T.current&&(T.current=true,A(s));},[P,s,A]);let Tt=react.useCallback(t=>chunkMQFZHA2D_js.d(null,null,function*(){let e=s!=null?s:w(n,l,f.current);return chunkZ73T6MWY_js.c(e,t)}),[s,n,l]),wt=react.useCallback(t=>chunkMQFZHA2D_js.d(null,null,function*(){let e=s!=null?s:w(n,l,f.current);return chunkZ73T6MWY_js.d(e,t)}),[s,n,l]),At=react.useCallback(t=>{let e=s!=null?s:w(n,l,f.current);return chunkZ73T6MWY_js.a(e,t)},[s,n,l]),Mt=react.useCallback(()=>{let t=s!=null?s:w(n,l,f.current);return chunkZ73T6MWY_js.b(t)},[s,n,l]);return {currentStep:P,goToStep:lt,nextStep:pt,prevStep:ut,canProceed:dt,context:n,updateContext:mt,updateOrg:gt,toggleDataCategory:ft,togglePurpose:Pt,addProcessor:yt,removeProcessor:Ct,policy:s,sections:l,customSections:b,addCustomSection:St,updateCustomSection:vt,removeCustomSection:xt,reorderSections:ht,editSectionContent:Dt,sectionOverrides:x,complianceScore:_,complianceResult:V,complianceGaps:D,applyFix:bt,handleExportPDF:Tt,handleExportDOCX:wt,handleExportHTML:At,handleExportMarkdown:Mt,isDraftSaved:at,lastSavedAt:ct,saveDraft:Ot,discardDraft:Et,isLoading:N}}exports.a=Ut;//# sourceMappingURL=chunk-ORFC66EA.js.map
4
+ //# sourceMappingURL=chunk-ORFC66EA.js.map
@@ -1,2 +1,2 @@
1
- import {b,d,a as a$1,c}from'./chunk-SHMJNRHO.mjs';import {a as a$2}from'./chunk-AYKLAEOU.mjs';import {a,b as b$1}from'./chunk-WWT2ZSNU.mjs';import {useState,useMemo,useEffect,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var T=[{value:"consent",label:"Consent (Section 25(1)(a))"},{value:"contract",label:"Contract (Section 25(1)(b))"},{value:"legal_obligation",label:"Legal Obligation (Section 25(1)(c))"},{value:"vital_interests",label:"Vital Interests (Section 25(1)(d))"},{value:"public_interest",label:"Public Interest (Section 25(1)(e))"},{value:"legitimate_interests",label:"Legitimate Interests (Section 25(1)(f))"}],ee=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"archived",label:"Archived"}],Ee=[{value:"data_subject",label:"Directly from Data Subject"},{value:"third_party",label:"Third Party"},{value:"public_source",label:"Public Source"},{value:"other",label:"Other"}];function Oe(){let l=Date.now();return {id:`proc_${l}_${Math.random().toString(36).substring(2,11)}`,name:"",description:"",controllerDetails:{name:"",contact:"",address:""},lawfulBasis:"consent",lawfulBasisJustification:"",purposes:[],dataCategories:[],dataSubjectCategories:[],recipients:[],retentionPeriod:"",securityMeasures:[],dataSource:"data_subject",dpiaRequired:false,automatedDecisionMaking:false,status:"active",createdAt:l,updatedAt:l}}function te(l){return l?new Date(l).toLocaleDateString():"N/A"}var $e=({ropa:l,onAddRecord:R,onUpdateRecord:D,onArchiveRecord:w,title:re="Record of Processing Activities (ROPA)",description:ie="Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",className:ae="",buttonClassName:B="",classNames:e,unstyled:n})=>{let[f,b$2]=useState("list"),[S,ne]=useState(""),[P,de]=useState("all"),[k,le]=useState("all"),[o,h]=useState(null),[U,C]=useState([]),[F,$]=useState(""),[I,H]=useState(""),[M,V]=useState(""),[L,J]=useState(""),[E,z]=useState(""),[O,G]=useState(""),[j,W]=useState(""),g=useMemo(()=>b(l),[l]),_=useMemo(()=>d(l),[l]),K=useMemo(()=>{let r=[...l.records];if(P!=="all"&&(r=r.filter(a=>a.status===P)),k!=="all"&&(r=r.filter(a=>a.lawfulBasis===k)),S){let a=S.toLowerCase();r=r.filter(p=>p.name.toLowerCase().includes(a)||p.description.toLowerCase().includes(a)||p.dataCategories.some(m=>m.toLowerCase().includes(a))||p.department&&p.department.toLowerCase().includes(a));}return r},[l.records,P,k,S]);useEffect(()=>{o&&($(o.purposes.join(", ")),H(o.dataCategories.join(", ")),V((o.sensitiveDataCategories||[]).join(", ")),J(o.dataSubjectCategories.join(", ")),z(o.recipients.join(", ")),G(o.securityMeasures.join(", ")),W((o.systemsUsed||[]).join(", ")));},[o==null?void 0:o.id]);let oe=useCallback(()=>{let r=Oe();r.controllerDetails.name=l.organizationName,r.controllerDetails.contact=l.organizationContact,r.controllerDetails.address=l.organizationAddress,l.ndpcRegistrationNumber&&(r.controllerDetails.registrationNumber=l.ndpcRegistrationNumber),l.dpoDetails&&(r.controllerDetails.dpoContact=l.dpoDetails.email),h(r),C([]),b$2("form");},[l.organizationName,l.organizationContact,l.organizationAddress,l.ndpcRegistrationNumber,l.dpoDetails]),pe=useCallback(r=>{h(a({},r)),C([]),b$2("form");},[]),v=r=>r.split(",").map(a=>a.trim()).filter(a=>a.length>0),ue=useCallback(()=>{if(!o)return;let r=b$1(a({},o),{purposes:v(F),dataCategories:v(I),sensitiveDataCategories:v(M),dataSubjectCategories:v(L),recipients:v(E),securityMeasures:v(O),systemsUsed:v(j),updatedAt:Date.now()});r.sensitiveDataCategories&&r.sensitiveDataCategories.length===0&&(r.sensitiveDataCategories=void 0),r.systemsUsed&&r.systemsUsed.length===0&&(r.systemsUsed=void 0);let a$2=a$1(r);if(!a$2.valid){C(a$2.errors);return}l.records.find(m=>m.id===r.id)?D==null||D(r.id,r):R==null||R(r),h(null),C([]),b$2("list");},[o,F,I,M,L,E,O,j,l.records,D,R]),ce=useCallback(r=>{w==null||w(r);},[w]),se=useCallback(()=>{let r=c(l),a=new Blob([r],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(a),m=document.createElement("a");m.href=p,m.download=`ropa_${l.organizationName.replace(/\s+/g,"_").toLowerCase()}_${new Date().toISOString().slice(0,10)}.csv`,m.click(),setTimeout(()=>URL.revokeObjectURL(p),100);},[l]),Q=useCallback(()=>{h(null),C([]),b$2("list");},[]),c$1=useCallback((r,a$1)=>{h(p=>p&&b$1(a({},p),{[r]:a$1}));},[]),q=useCallback((r,a$1)=>{h(p=>p&&b$1(a({},p),{controllerDetails:b$1(a({},p.controllerDetails),{[r]:a$1})}));},[]),ge=useCallback(r=>!!r.nextReviewDate&&r.nextReviewDate<=Date.now(),[]),me=useCallback(r=>{ne(r.target.value);},[]),ve=useCallback(r=>{de(r.target.value);},[]),fe=useCallback(r=>{le(r.target.value);},[]),be=useCallback(r=>{$(r.target.value);},[]),he=useCallback(r=>{H(r.target.value);},[]),_e=useCallback(r=>{V(r.target.value);},[]),xe=useCallback(r=>{J(r.target.value);},[]),Ce=useCallback(r=>{z(r.target.value);},[]),ye=useCallback(r=>{G(r.target.value);},[]),Re=useCallback(r=>{W(r.target.value);},[]),De=useCallback(()=>b$2("list"),[]),we=useCallback(()=>b$2("summary"),[]),Se=useCallback(r=>{let a={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--warning",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},p={active:"Active",inactive:"Inactive",archived:"Archived"};return jsx("span",{className:a$2(`px-2 py-1 rounded text-xs font-medium ${a[r]}`,e==null?void 0:e.statusBadge,n),children:p[r]})},[e==null?void 0:e.statusBadge,n]),Pe=useCallback(r=>jsx("span",{className:"ndpr-badge ndpr-badge--info",children:{consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"}[r]}),[]),ke=()=>jsxs("div",{className:a$2("mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",e==null?void 0:e.orgInfo,n),children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Organization"}),jsx("p",{className:"ndpr-section-heading",children:l.organizationName})]}),l.dpoDetails&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Data Protection Officer"}),jsx("p",{className:"ndpr-section-heading",children:l.dpoDetails.name}),jsx("p",{className:"ndpr-form-field__hint",children:l.dpoDetails.email})]}),l.ndpcRegistrationNumber&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"NDPC Registration No."}),jsx("p",{className:"ndpr-section-heading",children:l.ndpcRegistrationNumber})]})]}),jsxs("div",{className:"mt-2 text-xs ndpr-text-muted",children:["Version ",l.version," | Last Updated: ",te(l.lastUpdated)]})]}),Ae=()=>jsxs("div",{className:a$2("mb-6",e==null?void 0:e.summary,n),children:[jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[jsxs("div",{className:a$2("p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.totalRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Total Records"})]}),jsxs("div",{className:a$2("p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-success",children:g.activeRecords}),jsx("p",{className:"text-xs ndpr-text-success",children:"Active"})]}),jsxs("div",{className:a$2("p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.crossBorderRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Cross-Border"})]}),jsxs("div",{className:a$2("p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:_.length}),jsx("p",{className:"text-xs ndpr-text-warning",children:"Records with Gaps"})]})]}),jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"By Lawful Basis"}),T.map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.label.split(" (")[0]}),jsx("span",{className:"font-medium",children:g.byLawfulBasis[r.value]||0})]},r.value))]}),jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Risk Indicators"}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Sensitive Data"}),jsx("span",{className:"font-medium",children:g.sensitiveDataRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"DPIA Required"}),jsx("span",{className:"font-medium",children:g.dpiaRequiredRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Automated Decisions"}),jsx("span",{className:"font-medium",children:g.automatedDecisionRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Due for Review"}),jsx("span",{className:`font-medium ${g.recordsDueForReview.length>0?"ndpr-text-destructive":""}`,children:g.recordsDueForReview.length})]})]}),g.topDepartments.length>0&&jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Top Departments"}),g.topDepartments.slice(0,5).map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.department}),jsx("span",{className:"font-medium",children:r.count})]},r.department))]})]}),_.length>0&&jsxs("div",{className:a$2("p-3 bg-red-50 dark:bg-red-900/20 rounded-md",e==null?void 0:e.complianceGap,n),role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-2",children:"Compliance Gaps Detected"}),_.slice(0,5).map(r=>jsxs("div",{className:"mb-2",children:[jsx("p",{className:"text-xs font-medium ndpr-text-destructive",children:r.recordName}),jsx("ul",{className:"list-disc list-inside",children:r.gaps.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]},r.recordId)),_.length>5&&jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["...and ",_.length-5," more record(s) with gaps."]})]})]}),Be=()=>jsxs("div",{children:[jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"ropaSearch",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"ropaSearch",value:S,onChange:me,placeholder:"Search records...",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaStatusFilter",className:"ndpr-form-field__label",children:"Status"}),jsxs("select",{id:"ropaStatusFilter",value:P,onChange:ve,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Statuses"}),ee.map(r=>jsx("option",{value:r.value,children:r.label},r.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaBasisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxs("select",{id:"ropaBasisFilter",value:k,onChange:fe,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Bases"}),T.map(r=>jsx("option",{value:r.value,children:r.label.split(" (")[0]},r.value))]})]}),jsxs("div",{className:"flex items-end space-x-2",children:[jsx("button",{onClick:oe,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${B}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:"Add Record"}),jsx("button",{onClick:se,"aria-label":"Export ROPA records as CSV",className:a$2(`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 text-sm ${B}`,(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.exportButton),n),children:"Export CSV"})]})]}),K.length===0?jsx("p",{className:"ndpr-empty-state",children:"No processing records found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a$2("w-full text-sm text-left",e==null?void 0:e.table,n),children:[jsx("thead",{className:a$2("ndpr-table__head",e==null?void 0:e.tableHeader,n),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Name"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Data Categories"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"Last Reviewed"}),jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsx("tbody",{children:K.map(r=>{let a=ge(r),p=_.some(m=>m.recordId===r.id);return jsxs("tr",{className:a$2(`border-b dark:border-gray-600 ${a?"bg-red-50 dark:bg-red-900/10":p?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} hover:bg-gray-50 dark:hover:bg-gray-700`,e==null?void 0:e.tableRow,n),children:[jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{children:[jsx("p",{className:"font-medium",children:r.name}),r.department&&jsx("p",{className:"ndpr-form-field__hint",children:r.department}),a&&jsx("span",{className:"text-xs ndpr-text-destructive font-medium",children:"Review Overdue"})]})}),jsx("td",{className:"ndpr-table__cell",children:Pe(r.lawfulBasis)}),jsx("td",{className:"ndpr-table__cell",children:jsx("p",{className:"text-xs ndpr-text-muted max-w-xs truncate",children:r.dataCategories.join(", ")})}),jsx("td",{className:"ndpr-table__cell",children:Se(r.status)}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:te(r.lastReviewedAt)}),jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>pe(r),"aria-label":`Edit record: ${r.name}`,className:"ndpr-text-primary hover:underline text-xs",children:"Edit"}),r.status!=="archived"&&jsx("button",{onClick:()=>ce(r.id),"aria-label":`Archive record: ${r.name}`,className:"ndpr-text-muted hover:underline text-xs",children:"Archive"})]})})]},r.id)})})]})})]}),Fe=useMemo(()=>o?!l.records.find(r=>r.id===o.id):true,[o,l.records]),Ie=()=>{if(!o)return null;let r=Fe;return jsxs("div",{"data-ndpr-component":"ropa-manager",className:a$2("",e==null?void 0:e.form,n),children:[jsxs("div",{className:a$2("flex justify-between items-center mb-4",e==null?void 0:e.header,n),children:[jsx("h3",{className:"ndpr-section-heading",children:r?"Add Processing Record":"Edit Processing Record"}),jsx("button",{onClick:Q,className:"ndpr-button ndpr-button--ghost ndpr-button--sm",children:"Cancel"})]}),U.length>0&&jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside",children:U.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Basic Information"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"recordName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsx("input",{type:"text",id:"recordName",value:o.name,onChange:a=>c$1("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customer Account Management"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordDepartment",className:"ndpr-form-field__label",children:"Department"}),jsx("input",{type:"text",id:"recordDepartment",value:o.department||"",onChange:a=>c$1("department",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Marketing"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"recordDescription",className:"ndpr-form-field__label",children:"Description *"}),jsx("textarea",{id:"recordDescription",value:o.description,onChange:a=>c$1("description",a.target.value),rows:3,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe what personal data processing is performed..."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordStatus",className:"ndpr-form-field__label",children:"Status *"}),jsx("select",{id:"recordStatus",value:o.status,onChange:a=>c$1("status",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:ee.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Controller Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"controllerName",className:"ndpr-form-field__label",children:"Controller Name *"}),jsx("input",{type:"text",id:"controllerName",value:o.controllerDetails.name,onChange:a=>q("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"controllerContact",className:"ndpr-form-field__label",children:"Controller Contact *"}),jsx("input",{type:"text",id:"controllerContact",value:o.controllerDetails.contact,onChange:a=>q("contact",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"controllerAddress",className:"ndpr-form-field__label",children:"Controller Address *"}),jsx("input",{type:"text",id:"controllerAddress",value:o.controllerDetails.address,onChange:a=>q("address",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Lawful Basis (NDPA Section 25)"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis *"}),jsx("select",{id:"lawfulBasis",value:o.lawfulBasis,onChange:a=>c$1("lawfulBasis",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:T.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasisJustification",className:"ndpr-form-field__label",children:"Justification *"}),jsx("textarea",{id:"lawfulBasisJustification",value:o.lawfulBasisJustification,onChange:a=>c$1("lawfulBasisJustification",a.target.value),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Explain why this lawful basis applies..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Data Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Purposes * (comma-separated)"}),jsx("input",{type:"text",id:"purposes",value:F,onChange:be,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Account management, Service delivery"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories * (comma-separated)"}),jsx("input",{type:"text",id:"dataCategories",value:I,onChange:he,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Name, Email, Phone number"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveData",className:"ndpr-form-field__label",children:"Sensitive Data Categories (comma-separated)"}),jsx("input",{type:"text",id:"sensitiveData",value:M,onChange:_e,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Health data, Biometric data"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"subjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories * (comma-separated)"}),jsx("input",{type:"text",id:"subjectCategories",value:L,onChange:xe,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customers, Employees"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients * (comma-separated)"}),jsx("input",{type:"text",id:"recipients",value:E,onChange:Ce,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Payment processors, Cloud service providers"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSource",className:"ndpr-form-field__label",children:"Data Source *"}),jsx("select",{id:"dataSource",value:o.dataSource,onChange:a=>c$1("dataSource",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:Ee.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),o.dataSource==="third_party"&&jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"thirdPartyDetails",className:"ndpr-form-field__label",children:"Third-Party Source Details *"}),jsx("input",{type:"text",id:"thirdPartyDetails",value:o.thirdPartySourceDetails||"",onChange:a=>c$1("thirdPartySourceDetails",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the third-party data source..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Retention and Security"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:o.retentionPeriod,onChange:a=>c$1("retentionPeriod",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., 5 years after account closure"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:o.retentionJustification||"",onChange:a=>c$1("retentionJustification",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Why this retention period is necessary..."})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"securityMeasures",className:"ndpr-form-field__label",children:"Security Measures * (comma-separated)"}),jsx("input",{type:"text",id:"securityMeasures",value:O,onChange:ye,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Encryption at rest, Access controls, Audit logging"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"systemsUsed",className:"ndpr-form-field__label",children:"Systems Used (comma-separated)"}),jsx("input",{type:"text",id:"systemsUsed",value:j,onChange:Re,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., CRM, ERP, Cloud Storage"})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Risk Indicators"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"dpiaRequired",checked:o.dpiaRequired,onChange:a=>c$1("dpiaRequired",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"dpiaRequired",className:"ndpr-text-sm ndpr-font-medium",children:"DPIA Required"})]}),o.dpiaRequired&&jsxs("div",{children:[jsx("label",{htmlFor:"dpiaReference",className:"ndpr-form-field__label",children:"DPIA Reference *"}),jsx("input",{type:"text",id:"dpiaReference",value:o.dpiaReference||"",onChange:a=>c$1("dpiaReference",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Reference to the completed DPIA"})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"automatedDecisionMaking",checked:o.automatedDecisionMaking,onChange:a=>c$1("automatedDecisionMaking",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"automatedDecisionMaking",className:"ndpr-text-sm ndpr-font-medium",children:"Automated Decision-Making"})]}),o.automatedDecisionMaking&&jsxs("div",{children:[jsx("label",{htmlFor:"automatedDecisionMakingDetails",className:"ndpr-form-field__label",children:"Automated Decision-Making Details *"}),jsx("textarea",{id:"automatedDecisionMakingDetails",value:o.automatedDecisionMakingDetails||"",onChange:a=>c$1("automatedDecisionMakingDetails",a.target.value||void 0),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the automated decision-making process..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Review Schedule"}),jsx("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:jsxs("div",{children:[jsx("label",{htmlFor:"nextReviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsx("input",{type:"date",id:"nextReviewDate",value:o.nextReviewDate?new Date(o.nextReviewDate).toISOString().slice(0,10):"",onChange:a=>c$1("nextReviewDate",a.target.value?new Date(a.target.value).getTime():void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})})]}),jsxs("div",{className:"flex justify-end space-x-3",children:[jsx("button",{onClick:Q,className:"ndpr-button ndpr-button--secondary ndpr-button--sm",children:"Cancel"}),jsx("button",{onClick:ue,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${B}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:r?"Add Record":"Save Changes"})]})]})]})},Me=()=>jsxs("div",{className:"ndpr-section-divider ndpr-text-sm",children:[jsx("button",{onClick:De,className:`pb-2 text-sm font-medium ${f==="list"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Processing Records"}),jsx("button",{onClick:we,className:`pb-2 text-sm font-medium ${f==="summary"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Compliance Summary"})]});return jsxs("div",{className:a$2(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ae}`,e==null?void 0:e.root,n),children:[jsx("h2",{className:a$2("ndpr-section-heading",e==null?void 0:e.title,n),children:re}),jsx("p",{className:"ndpr-card__subtitle",children:ie}),ke(),f!=="form"&&Me(),f==="list"&&Be(),f==="summary"&&Ae(),f==="form"&&Ie()]})};export{$e as a};//# sourceMappingURL=chunk-VTITKWGX.mjs.map
2
- //# sourceMappingURL=chunk-VTITKWGX.mjs.map
1
+ import {b,d,a as a$1,c}from'./chunk-SHMJNRHO.mjs';import {a as a$2}from'./chunk-AYKLAEOU.mjs';import {a,b as b$1}from'./chunk-WWT2ZSNU.mjs';import {useState,useMemo,useEffect,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var T=[{value:"consent",label:"Consent (Section 25(1)(a))"},{value:"contract",label:"Contract (Section 25(1)(b))"},{value:"legal_obligation",label:"Legal Obligation (Section 25(1)(c))"},{value:"vital_interests",label:"Vital Interests (Section 25(1)(d))"},{value:"public_interest",label:"Public Interest (Section 25(1)(e))"},{value:"legitimate_interests",label:"Legitimate Interests (Section 25(1)(f))"}],ee=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"archived",label:"Archived"}],Ee=[{value:"data_subject",label:"Directly from Data Subject"},{value:"third_party",label:"Third Party"},{value:"public_source",label:"Public Source"},{value:"other",label:"Other"}];function Oe(){let l=Date.now();return {id:`proc_${l}_${Math.random().toString(36).substring(2,11)}`,name:"",description:"",controllerDetails:{name:"",contact:"",address:""},lawfulBasis:"consent",lawfulBasisJustification:"",purposes:[],dataCategories:[],dataSubjectCategories:[],recipients:[],retentionPeriod:"",securityMeasures:[],dataSource:"data_subject",dpiaRequired:false,automatedDecisionMaking:false,status:"active",createdAt:l,updatedAt:l}}function te(l){return l?new Date(l).toLocaleDateString():"N/A"}var $e=({ropa:l,onAddRecord:R,onUpdateRecord:D,onArchiveRecord:w,title:re="Record of Processing Activities (ROPA)",description:ie="Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",className:ae="",buttonClassName:B="",classNames:e,unstyled:n})=>{let[f,b$2]=useState("list"),[S,ne]=useState(""),[P,de]=useState("all"),[k,le]=useState("all"),[o,h]=useState(null),[U,C]=useState([]),[F,$]=useState(""),[I,H]=useState(""),[M,V]=useState(""),[L,J]=useState(""),[E,z]=useState(""),[O,G]=useState(""),[j,W]=useState(""),g=useMemo(()=>b(l),[l]),_=useMemo(()=>d(l),[l]),K=useMemo(()=>{let r=[...l.records];if(P!=="all"&&(r=r.filter(a=>a.status===P)),k!=="all"&&(r=r.filter(a=>a.lawfulBasis===k)),S){let a=S.toLowerCase();r=r.filter(p=>p.name.toLowerCase().includes(a)||p.description.toLowerCase().includes(a)||p.dataCategories.some(m=>m.toLowerCase().includes(a))||p.department&&p.department.toLowerCase().includes(a));}return r},[l.records,P,k,S]);useEffect(()=>{o&&($(o.purposes.join(", ")),H(o.dataCategories.join(", ")),V((o.sensitiveDataCategories||[]).join(", ")),J(o.dataSubjectCategories.join(", ")),z(o.recipients.join(", ")),G(o.securityMeasures.join(", ")),W((o.systemsUsed||[]).join(", ")));},[o==null?void 0:o.id]);let oe=useCallback(()=>{let r=Oe();r.controllerDetails.name=l.organizationName,r.controllerDetails.contact=l.organizationContact,r.controllerDetails.address=l.organizationAddress,l.ndpcRegistrationNumber&&(r.controllerDetails.registrationNumber=l.ndpcRegistrationNumber),l.dpoDetails&&(r.controllerDetails.dpoContact=l.dpoDetails.email),h(r),C([]),b$2("form");},[l.organizationName,l.organizationContact,l.organizationAddress,l.ndpcRegistrationNumber,l.dpoDetails]),pe=useCallback(r=>{h(a({},r)),C([]),b$2("form");},[]),v=r=>r.split(",").map(a=>a.trim()).filter(a=>a.length>0),ue=useCallback(()=>{if(!o)return;let r=b$1(a({},o),{purposes:v(F),dataCategories:v(I),sensitiveDataCategories:v(M),dataSubjectCategories:v(L),recipients:v(E),securityMeasures:v(O),systemsUsed:v(j),updatedAt:Date.now()});r.sensitiveDataCategories&&r.sensitiveDataCategories.length===0&&(r.sensitiveDataCategories=void 0),r.systemsUsed&&r.systemsUsed.length===0&&(r.systemsUsed=void 0);let a$2=a$1(r);if(!a$2.valid){C(a$2.errors);return}l.records.find(m=>m.id===r.id)?D==null||D(r.id,r):R==null||R(r),h(null),C([]),b$2("list");},[o,F,I,M,L,E,O,j,l.records,D,R]),ce=useCallback(r=>{w==null||w(r);},[w]),se=useCallback(()=>{let r=c(l),a=new Blob([r],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(a),m=document.createElement("a");m.href=p,m.download=`ropa_${l.organizationName.replace(/\s+/g,"_").toLowerCase()}_${new Date().toISOString().slice(0,10)}.csv`,m.click(),setTimeout(()=>URL.revokeObjectURL(p),100);},[l]),Q=useCallback(()=>{h(null),C([]),b$2("list");},[]),c$1=useCallback((r,a$1)=>{h(p=>p&&b$1(a({},p),{[r]:a$1}));},[]),q=useCallback((r,a$1)=>{h(p=>p&&b$1(a({},p),{controllerDetails:b$1(a({},p.controllerDetails),{[r]:a$1})}));},[]),ge=useCallback(r=>!!r.nextReviewDate&&r.nextReviewDate<=Date.now(),[]),me=useCallback(r=>{ne(r.target.value);},[]),ve=useCallback(r=>{de(r.target.value);},[]),fe=useCallback(r=>{le(r.target.value);},[]),be=useCallback(r=>{$(r.target.value);},[]),he=useCallback(r=>{H(r.target.value);},[]),_e=useCallback(r=>{V(r.target.value);},[]),xe=useCallback(r=>{J(r.target.value);},[]),Ce=useCallback(r=>{z(r.target.value);},[]),ye=useCallback(r=>{G(r.target.value);},[]),Re=useCallback(r=>{W(r.target.value);},[]),De=useCallback(()=>b$2("list"),[]),we=useCallback(()=>b$2("summary"),[]),Se=useCallback(r=>{let a={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--warning",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},p={active:"Active",inactive:"Inactive",archived:"Archived"};return jsx("span",{className:a$2(`px-2 py-1 rounded text-xs font-medium ${a[r]}`,e==null?void 0:e.statusBadge,n),children:p[r]})},[e==null?void 0:e.statusBadge,n]),Pe=useCallback(r=>jsx("span",{className:"ndpr-badge ndpr-badge--info",children:{consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"}[r]}),[]),ke=()=>jsxs("div",{className:a$2("mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",e==null?void 0:e.orgInfo,n),children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Organization"}),jsx("p",{className:"ndpr-section-heading",children:l.organizationName})]}),l.dpoDetails&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Data Protection Officer"}),jsx("p",{className:"ndpr-section-heading",children:l.dpoDetails.name}),jsx("p",{className:"ndpr-form-field__hint",children:l.dpoDetails.email})]}),l.ndpcRegistrationNumber&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"NDPC Registration No."}),jsx("p",{className:"ndpr-section-heading",children:l.ndpcRegistrationNumber})]})]}),jsxs("div",{className:"mt-2 text-xs ndpr-text-muted",children:["Version ",l.version," | Last Updated: ",te(l.lastUpdated)]})]}),Ae=()=>jsxs("div",{className:a$2("mb-6",e==null?void 0:e.summary,n),children:[jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[jsxs("div",{className:a$2("p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.totalRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Total Records"})]}),jsxs("div",{className:a$2("p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-success",children:g.activeRecords}),jsx("p",{className:"text-xs ndpr-text-success",children:"Active"})]}),jsxs("div",{className:a$2("p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.crossBorderRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Cross-Border"})]}),jsxs("div",{className:a$2("p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:_.length}),jsx("p",{className:"text-xs ndpr-text-warning",children:"Records with Gaps"})]})]}),jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"By Lawful Basis"}),T.map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.label.split(" (")[0]}),jsx("span",{className:"font-medium",children:g.byLawfulBasis[r.value]||0})]},r.value))]}),jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Risk Indicators"}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Sensitive Data"}),jsx("span",{className:"font-medium",children:g.sensitiveDataRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"DPIA Required"}),jsx("span",{className:"font-medium",children:g.dpiaRequiredRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Automated Decisions"}),jsx("span",{className:"font-medium",children:g.automatedDecisionRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Due for Review"}),jsx("span",{className:`font-medium ${g.recordsDueForReview.length>0?"ndpr-text-destructive":""}`,children:g.recordsDueForReview.length})]})]}),g.topDepartments.length>0&&jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Top Departments"}),g.topDepartments.slice(0,5).map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.department}),jsx("span",{className:"font-medium",children:r.count})]},r.department))]})]}),_.length>0&&jsxs("div",{className:a$2("p-3 bg-red-50 dark:bg-red-900/20 rounded-md",e==null?void 0:e.complianceGap,n),role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-2",children:"Compliance Gaps Detected"}),_.slice(0,5).map(r=>jsxs("div",{className:"mb-2",children:[jsx("p",{className:"text-xs font-medium ndpr-text-destructive",children:r.recordName}),jsx("ul",{className:"list-disc list-inside",children:r.gaps.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]},r.recordId)),_.length>5&&jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["...and ",_.length-5," more record(s) with gaps."]})]})]}),Be=()=>jsxs("div",{children:[jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"ropaSearch",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"ropaSearch",value:S,onChange:me,placeholder:"Search records...",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaStatusFilter",className:"ndpr-form-field__label",children:"Status"}),jsxs("select",{id:"ropaStatusFilter",value:P,onChange:ve,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Statuses"}),ee.map(r=>jsx("option",{value:r.value,children:r.label},r.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaBasisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxs("select",{id:"ropaBasisFilter",value:k,onChange:fe,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Bases"}),T.map(r=>jsx("option",{value:r.value,children:r.label.split(" (")[0]},r.value))]})]}),jsxs("div",{className:"flex items-end space-x-2",children:[jsx("button",{onClick:oe,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${B}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:"Add Record"}),jsx("button",{onClick:se,"aria-label":"Export ROPA records as CSV",className:a$2(`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 text-sm ${B}`,(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.exportButton),n),children:"Export CSV"})]})]}),K.length===0?jsx("p",{className:"ndpr-empty-state",children:"No processing records found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a$2("w-full text-sm text-left",e==null?void 0:e.table,n),children:[jsx("thead",{className:a$2("ndpr-table__head",e==null?void 0:e.tableHeader,n),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Name"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Data Categories"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"Last Reviewed"}),jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsx("tbody",{children:K.map(r=>{let a=ge(r),p=_.some(m=>m.recordId===r.id);return jsxs("tr",{className:a$2(`border-b dark:border-gray-600 ${a?"bg-red-50 dark:bg-red-900/10":p?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} hover:bg-gray-50 dark:hover:bg-gray-700`,e==null?void 0:e.tableRow,n),children:[jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{children:[jsx("p",{className:"font-medium",children:r.name}),r.department&&jsx("p",{className:"ndpr-form-field__hint",children:r.department}),a&&jsx("span",{className:"text-xs ndpr-text-destructive font-medium",children:"Review Overdue"})]})}),jsx("td",{className:"ndpr-table__cell",children:Pe(r.lawfulBasis)}),jsx("td",{className:"ndpr-table__cell",children:jsx("p",{className:"text-xs ndpr-text-muted max-w-xs truncate",children:r.dataCategories.join(", ")})}),jsx("td",{className:"ndpr-table__cell",children:Se(r.status)}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:te(r.lastReviewedAt)}),jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>pe(r),"aria-label":`Edit record: ${r.name}`,className:"ndpr-text-primary hover:underline text-xs",children:"Edit"}),r.status!=="archived"&&jsx("button",{onClick:()=>ce(r.id),"aria-label":`Archive record: ${r.name}`,className:"ndpr-text-muted hover:underline text-xs",children:"Archive"})]})})]},r.id)})})]})})]}),Fe=useMemo(()=>o?!l.records.find(r=>r.id===o.id):true,[o,l.records]),Ie=()=>{if(!o)return null;let r=Fe;return jsxs("div",{"data-ndpr-component":"ropa-manager",className:a$2("",e==null?void 0:e.form,n),children:[jsxs("div",{className:a$2("flex justify-between items-center mb-4",e==null?void 0:e.header,n),children:[jsx("h3",{className:"ndpr-section-heading",children:r?"Add Processing Record":"Edit Processing Record"}),jsx("button",{onClick:Q,className:"ndpr-button ndpr-button--ghost ndpr-button--sm",children:"Cancel"})]}),U.length>0&&jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside",children:U.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Basic Information"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"recordName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsx("input",{type:"text",id:"recordName",value:o.name,onChange:a=>c$1("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customer Account Management"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordDepartment",className:"ndpr-form-field__label",children:"Department"}),jsx("input",{type:"text",id:"recordDepartment",value:o.department||"",onChange:a=>c$1("department",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Marketing"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"recordDescription",className:"ndpr-form-field__label",children:"Description *"}),jsx("textarea",{id:"recordDescription",value:o.description,onChange:a=>c$1("description",a.target.value),rows:3,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe what personal data processing is performed..."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordStatus",className:"ndpr-form-field__label",children:"Status *"}),jsx("select",{id:"recordStatus",value:o.status,onChange:a=>c$1("status",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:ee.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Controller Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"controllerName",className:"ndpr-form-field__label",children:"Controller Name *"}),jsx("input",{type:"text",id:"controllerName",value:o.controllerDetails.name,onChange:a=>q("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"controllerContact",className:"ndpr-form-field__label",children:"Controller Contact *"}),jsx("input",{type:"text",id:"controllerContact",value:o.controllerDetails.contact,onChange:a=>q("contact",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"controllerAddress",className:"ndpr-form-field__label",children:"Controller Address *"}),jsx("input",{type:"text",id:"controllerAddress",value:o.controllerDetails.address,onChange:a=>q("address",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Lawful Basis (NDPA Section 25)"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis *"}),jsx("select",{id:"lawfulBasis",value:o.lawfulBasis,onChange:a=>c$1("lawfulBasis",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:T.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasisJustification",className:"ndpr-form-field__label",children:"Justification *"}),jsx("textarea",{id:"lawfulBasisJustification",value:o.lawfulBasisJustification,onChange:a=>c$1("lawfulBasisJustification",a.target.value),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Explain why this lawful basis applies..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Data Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Purposes * (comma-separated)"}),jsx("input",{type:"text",id:"purposes",value:F,onChange:be,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Account management, Service delivery"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories * (comma-separated)"}),jsx("input",{type:"text",id:"dataCategories",value:I,onChange:he,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Name, Email, Phone number"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveData",className:"ndpr-form-field__label",children:"Sensitive Data Categories (comma-separated)"}),jsx("input",{type:"text",id:"sensitiveData",value:M,onChange:_e,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Health data, Biometric data"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"subjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories * (comma-separated)"}),jsx("input",{type:"text",id:"subjectCategories",value:L,onChange:xe,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customers, Employees"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients * (comma-separated)"}),jsx("input",{type:"text",id:"recipients",value:E,onChange:Ce,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Payment processors, Cloud service providers"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSource",className:"ndpr-form-field__label",children:"Data Source *"}),jsx("select",{id:"dataSource",value:o.dataSource,onChange:a=>c$1("dataSource",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:Ee.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),o.dataSource==="third_party"&&jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"thirdPartyDetails",className:"ndpr-form-field__label",children:"Third-Party Source Details *"}),jsx("input",{type:"text",id:"thirdPartyDetails",value:o.thirdPartySourceDetails||"",onChange:a=>c$1("thirdPartySourceDetails",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the third-party data source..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Retention and Security"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:o.retentionPeriod,onChange:a=>c$1("retentionPeriod",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., 5 years after account closure"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:o.retentionJustification||"",onChange:a=>c$1("retentionJustification",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Why this retention period is necessary..."})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"securityMeasures",className:"ndpr-form-field__label",children:"Security Measures * (comma-separated)"}),jsx("input",{type:"text",id:"securityMeasures",value:O,onChange:ye,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Encryption at rest, Access controls, Audit logging"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"systemsUsed",className:"ndpr-form-field__label",children:"Systems Used (comma-separated)"}),jsx("input",{type:"text",id:"systemsUsed",value:j,onChange:Re,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., CRM, ERP, Cloud Storage"})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Risk Indicators"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"dpiaRequired",checked:o.dpiaRequired,onChange:a=>c$1("dpiaRequired",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"dpiaRequired",className:"ndpr-text-sm ndpr-font-medium",children:"DPIA Required"})]}),o.dpiaRequired&&jsxs("div",{children:[jsx("label",{htmlFor:"dpiaReference",className:"ndpr-form-field__label",children:"DPIA Reference *"}),jsx("input",{type:"text",id:"dpiaReference",value:o.dpiaReference||"",onChange:a=>c$1("dpiaReference",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Reference to the completed DPIA"})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"automatedDecisionMaking",checked:o.automatedDecisionMaking,onChange:a=>c$1("automatedDecisionMaking",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"automatedDecisionMaking",className:"ndpr-text-sm ndpr-font-medium",children:"Automated Decision-Making"})]}),o.automatedDecisionMaking&&jsxs("div",{children:[jsx("label",{htmlFor:"automatedDecisionMakingDetails",className:"ndpr-form-field__label",children:"Automated Decision-Making Details *"}),jsx("textarea",{id:"automatedDecisionMakingDetails",value:o.automatedDecisionMakingDetails||"",onChange:a=>c$1("automatedDecisionMakingDetails",a.target.value||void 0),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the automated decision-making process..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Review Schedule"}),jsx("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:jsxs("div",{children:[jsx("label",{htmlFor:"nextReviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsx("input",{type:"date",id:"nextReviewDate",value:o.nextReviewDate?new Date(o.nextReviewDate).toISOString().slice(0,10):"",onChange:a=>c$1("nextReviewDate",a.target.value?new Date(a.target.value).getTime():void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})})]}),jsxs("div",{className:"flex justify-end space-x-3",children:[jsx("button",{onClick:Q,className:"ndpr-button ndpr-button--secondary ndpr-button--sm",children:"Cancel"}),jsx("button",{onClick:ue,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${B}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:r?"Add Record":"Save Changes"})]})]})]})},Me=()=>jsxs("div",{className:"ndpr-section-divider ndpr-text-sm",children:[jsx("button",{onClick:De,className:`pb-2 text-sm font-medium ${f==="list"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Processing Records"}),jsx("button",{onClick:we,className:`pb-2 text-sm font-medium ${f==="summary"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Compliance Summary"})]});return jsxs("div",{className:a$2(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ae}`,e==null?void 0:e.root,n),children:[jsx("h2",{className:a$2("ndpr-section-heading",e==null?void 0:e.title,n),children:re}),jsx("p",{className:"ndpr-card__subtitle",children:ie}),ke(),f!=="form"&&Me(),f==="list"&&Be(),f==="summary"&&Ae(),f==="form"&&Ie()]})};export{$e as a};//# sourceMappingURL=chunk-QSVVAZVT.mjs.map
2
+ //# sourceMappingURL=chunk-QSVVAZVT.mjs.map
@@ -0,0 +1,2 @@
1
+ import {b}from'./chunk-B4Z5MBUC.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var oe=({requests:w,onSelectRequest:P,onUpdateStatus:I,onAssignRequest:V,title:H="Data Subject Request Dashboard",description:X="Track and manage data subject requests in compliance with NDPA Part IV requirements.",className:J="",buttonClassName:F="",showRequestDetails:Y=true,showRequestTimeline:z=true,showDeadlineAlerts:B=true,assignees:i=[],classNames:l,unstyled:k=false})=>{let[y,f]=useState(null),[D,O]=useState(w),[j,M]=useState("all"),[C,T]=useState("all"),[A,_]=useState(""),[$,G]=useState("createdAt"),[U,Z]=useState("desc"),[S,Q]=useState("");useEffect(()=>{let e=[...w];if(j!=="all"&&(e=e.filter(r=>r.status===j)),C!=="all"&&(e=e.filter(r=>r.type===C)),A){let r=A.toLowerCase();e=e.filter(p=>p.subject.name.toLowerCase().includes(r)||p.subject.email.toLowerCase().includes(r)||p.description&&p.description.toLowerCase().includes(r));}e.sort((r,p)=>{let h=0;switch($){case "createdAt":h=r.createdAt-p.createdAt;break;case "dueDate":h=(r.dueDate||0)-(p.dueDate||0);break;case "type":h=r.type.localeCompare(p.type);break;case "status":h=r.status.localeCompare(p.status);break;default:h=r.createdAt-p.createdAt;}return U==="asc"?h:-h}),O(e);},[w,j,C,A,$,U]),useEffect(()=>{D.length>0&&(y&&D.some(r=>r.id===y)||f(D[0].id));},[D,y]);let E=e=>{f(e),P&&P(e);},L=e=>{y&&I&&I(y,e);},W=()=>{y&&S&&V&&(V(y,S),Q(""));},R=e=>new Date(e).toLocaleDateString(),q=e=>{let r=Date.now(),p=(e-r)/(1440*60*1e3);return Math.ceil(p)},m=y?w.find(e=>e.id===y):null,t=e=>{let r={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},p={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${r[e]}`,children:p[e]})},s=e=>jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",inProgress:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",rejected:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",awaitingVerification:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200"}[e]}`,l==null?void 0:l.statusBadge,k),children:e==="inProgress"?"In Progress":e==="awaitingVerification"?"Awaiting Verification":e.charAt(0).toUpperCase()+e.slice(1)}),g=e=>{if(!e.dueDate)return null;let r=q(e.dueDate);return r<=0?jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",role:"alert","aria-live":"polite",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Deadline Passed"}),jsx("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:"The response deadline has passed. Immediate action is required."})]}):r<=3?jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",role:"alert","aria-live":"polite",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Urgent: Deadline Approaching"}),jsxs("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:["Only ",r," day",r!==1?"s":""," remaining until the response deadline."]})]}):r<=7?jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md","aria-live":"polite",children:[jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium",children:"Deadline Approaching"}),jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:[r," days remaining until the response deadline."]})]}):jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md","aria-live":"polite",children:[jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"Deadline Tracking"}),jsxs("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1",children:[r," days remaining until the response deadline."]})]})},x=e=>{let r=[{title:"Request Received",date:e.createdAt,completed:true,description:`Request was received on ${R(e.createdAt)}.`}];return e.verifiedAt?r.push({title:"Identity Verified",date:e.verifiedAt,completed:true,description:`Data subject's identity was verified on ${R(e.verifiedAt)}.`}):e.status==="awaitingVerification"&&r.push({title:"Identity Verification",date:Date.now(),completed:false,description:"Awaiting verification of data subject's identity."}),(e.status==="inProgress"||e.status==="completed"||e.status==="rejected")&&r.push({title:"Processing Started",date:e.updatedAt,completed:true,description:`Request processing started on ${R(e.updatedAt)}.`}),e.status==="completed"?r.push({title:"Request Completed",date:e.completedAt||Date.now(),completed:true,description:`Request was completed on ${R(e.completedAt||Date.now())}.`}):e.status==="rejected"&&r.push({title:"Request Rejected",date:e.completedAt||Date.now(),completed:true,description:`Request was rejected on ${R(e.completedAt||Date.now())}.${e.rejectionReason?` Reason: ${e.rejectionReason}`:""}`}),e.dueDate&&r.push({title:"Response Deadline",date:e.dueDate,completed:Date.now()>e.dueDate,description:`Response is due by ${R(e.dueDate)}.`}),jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:r.map((p,h)=>jsxs("li",{className:"mb-6 ml-4",children:[jsx("div",{className:`absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ${p.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700"}`}),jsx("time",{className:"mb-1 text-sm font-normal leading-none text-gray-600 dark:text-gray-500",children:p.date?R(p.date):"Pending"}),jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:p.title}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:p.description})]},h))})]})},o=()=>[{value:"all",label:"All Types"},{value:"information",label:"Information (NDPA Section 29)"},{value:"access",label:"Access (NDPA Section 30)"},{value:"rectification",label:"Rectification (NDPA Section 31)"},{value:"erasure",label:"Erasure (NDPA Section 32)"},{value:"restriction",label:"Restriction (NDPA Section 33)"},{value:"portability",label:"Portability (NDPA Section 34)"},{value:"objection",label:"Objection (NDPA Section 35)"},{value:"automated_decision_making",label:"Automated Decision-Making (NDPA Section 36)"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value)),u=()=>[{value:"all",label:"All Statuses"},{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value)),v=()=>[{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value));return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${J}`,l==null?void 0:l.root,k),children:[jsxs("div",{className:a("",l==null?void 0:l.header,k),children:[jsx("h2",{className:a("text-xl font-bold mb-2",l==null?void 0:l.title,k),children:H}),jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:X})]}),jsxs("div",{className:a("mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",l==null?void 0:l.filters,k),children:[jsxs("div",{children:[jsx("label",{htmlFor:"statusFilter",className:"block text-sm font-medium mb-1",children:"Status Filter"}),jsx("select",{id:"statusFilter",value:j,onChange:e=>M(e.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))]",children:u()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"typeFilter",className:"block text-sm font-medium mb-1",children:"Request Type Filter"}),jsx("select",{id:"typeFilter",value:C,onChange:e=>T(e.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))]",children:o()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sortBy",className:"block text-sm font-medium mb-1",children:"Sort By"}),jsxs("select",{id:"sortBy",value:$,onChange:e=>G(e.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))]",children:[jsx("option",{value:"createdAt",children:"Date Received"}),jsx("option",{value:"dueDate",children:"Due Date"}),jsx("option",{value:"type",children:"Request Type"}),jsx("option",{value:"status",children:"Status"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchTerm",className:"block text-sm font-medium mb-1",children:"Search"}),jsx("input",{type:"text",id:"searchTerm",value:A,onChange:e=>_(e.target.value),placeholder:"Search requests...",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:"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:"DSR Requests"}),D.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data subject requests found."}):jsx("div",{className:a("space-y-2 max-h-96 overflow-y-auto pr-2",l==null?void 0:l.requestList,k),children:D.map(e=>{let r=e.dueDate?q(e.dueDate):null,p=null;return r!==null&&(r<=0?p=jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-bold",children:"Overdue"}):r<=3?p=jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:"Urgent"}):r<=7&&(p=jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Soon"}))),jsxs("div",{role:"button",tabIndex:0,"aria-label":`View request from ${e.subject.name}`,"aria-selected":y===e.id,className:a(`p-3 rounded-md cursor-pointer ${y===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"}`,l==null?void 0:l.requestItem,k),onClick:()=>E(e.id),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),E(e.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:e.subject.name}),t(e.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:e.subject.email}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:["Received: ",R(e.createdAt)]}),jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsx("div",{children:s(e.status)}),jsx("div",{children:p})]})]},e.id)})})]}),jsx("div",{className:a("md:col-span-2",l==null?void 0:l.detailPanel,k),children:m?jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsx("h3",{className:"text-lg font-medium",children:m.subject.name}),jsxs("div",{className:"flex space-x-2",children:[t(m.type),s(m.status)]})]}),B&&m.dueDate&&jsx("div",{className:"mb-4",children:g(m)}),Y&&jsxs("div",{className:"mb-6",children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Email:"})," ",m.subject.email]}),m.subject.phone&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Phone:"})," ",m.subject.phone]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Received:"})," ",R(m.createdAt)]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Request Type:"})," ",{information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"}[m.type]||m.type]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",m.status==="inProgress"?"In Progress":m.status==="awaitingVerification"?"Awaiting Verification":m.status.charAt(0).toUpperCase()+m.status.slice(1)]}),m.dueDate&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Due Date:"})," ",R(m.dueDate)]})]})]}),m.description&&jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium",children:"Request Details:"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:m.description})]}),m.additionalInfo&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium",children:"Additional Information:"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:typeof m.additionalInfo=="object"?JSON.stringify(m.additionalInfo,null,2):String(m.additionalInfo||"No additional information provided")})]})]}),jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("h3",{id:"update-status-heading",className:"text-md font-medium mb-2",children:"Update Status"}),jsxs("div",{className:"flex space-x-2",children:[jsx("select",{"aria-label":"Update request status",value:m.status,onChange:e=>L(e.target.value),className:"flex-grow 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))]",children:v()}),jsx("button",{onClick:()=>L(m.status),"aria-label":"Apply status update",className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${F}`,children:"Update"})]})]}),i.length>0&&jsxs("div",{children:[jsx("h3",{id:"assign-request-heading",className:"text-md font-medium mb-2",children:"Assign Request"}),jsxs("div",{className:"flex space-x-2",children:[jsxs("select",{"aria-label":"Select assignee",value:S,onChange:e=>Q(e.target.value),className:"flex-grow 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))]",children:[jsx("option",{value:"",children:"Select Assignee"}),i.map(e=>jsx("option",{value:e,children:e},e))]}),jsx("button",{onClick:W,disabled:!S,"aria-label":"Assign request to selected person",className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] disabled:bg-gray-300 disabled:text-gray-500 ${F}`,children:"Assign"})]})]})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Request Summary"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:jsx("pre",{children:JSON.stringify(b(m),null,2)})})})]}),z&&x(m)]}):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 request to view details"})})})]})]})};var ue=({requests:w,onSelectRequest:P,title:I="DSR Request Tracker",description:V="Track the status and progress of data subject requests as required by NDPA Part IV.",className:H="",buttonClassName:X="",showSummaryStats:J=true,showTypeBreakdown:F=true,showStatusBreakdown:Y=true,showTimelineChart:z=true,showOverdueRequests:B=true,classNames:i,unstyled:l=false})=>{let[k,y]=useState("30days"),[f,D]=useState(w),[O,j]=useState([]),[M,C]=useState([]);useEffect(()=>{let t=Date.now(),s;switch(k){case "7days":s=w.filter(o=>t-o.createdAt<=10080*60*1e3);break;case "30days":s=w.filter(o=>t-o.createdAt<=720*60*60*1e3);break;case "90days":s=w.filter(o=>t-o.createdAt<=2160*60*60*1e3);break;default:s=[...w];}D(s);let g=s.filter(o=>o.dueDate&&t>o.dueDate&&o.status!=="completed"&&o.status!=="rejected");j(g);let x=s.filter(o=>o.dueDate&&t<o.dueDate&&o.dueDate-t<=10080*60*1e3&&o.status!=="completed"&&o.status!=="rejected");C(x);},[w,k]);let T=t=>{P&&P(t);},A=t=>new Date(t).toLocaleDateString(),_=t=>{let s=Date.now(),g=(t-s)/(1440*60*1e3);return Math.ceil(g)},$=()=>{let t=f.filter(g=>g.status==="completed"&&g.completedAt&&g.createdAt);if(t.length===0)return null;let s=t.reduce((g,x)=>{let o=((x.completedAt||0)-x.createdAt)/864e5;return g+o},0);return Number((s/t.length).toFixed(1))},G=()=>{let t=f.filter(g=>(g.status==="completed"||g.status==="rejected")&&g.completedAt&&g.dueDate);if(t.length===0)return null;let s=t.filter(g=>(g.completedAt||0)<=(g.dueDate||0));return Math.round(s.length/t.length*100)},U=()=>{let t={};return f.forEach(s=>{t[s.type]=(t[s.type]||0)+1;}),{information:t.information||0,access:t.access||0,rectification:t.rectification||0,erasure:t.erasure||0,restriction:t.restriction||0,portability:t.portability||0,objection:t.objection||0,automated_decision_making:t.automated_decision_making||0}},Z=()=>{let t={};return f.forEach(s=>{t[s.status]=(t[s.status]||0)+1;}),{pending:t.pending||0,awaitingVerification:t.awaitingVerification||0,inProgress:t.inProgress||0,completed:t.completed||0,rejected:t.rejected||0}},S=t=>{let s={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},g={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${s[t]}`,children:g[t]})},E=()=>{let t=f.length,s=f.filter(u=>u.status!=="completed"&&u.status!=="rejected").length;f.filter(u=>u.status==="completed"||u.status==="rejected").length;let x=$(),o=G();return jsxs("div",{className:a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.stats,l),children:[jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Total Requests"}),jsx("p",{className:"text-2xl font-bold",children:t})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Pending Requests"}),jsx("p",{className:"text-2xl font-bold",children:s})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Avg. Response Time"}),jsx("p",{className:"text-2xl font-bold",children:x!==null?`${x} days`:"N/A"})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Compliance Rate"}),jsx("p",{className:"text-2xl font-bold",children:o!==null?`${o}%`:"N/A"})]})]})},L=()=>{let t=U(),s=f.length,g=Object.entries(t).sort(([,x],[,o])=>o-x).map(([x])=>x);return jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",i==null?void 0:i.table,l),children:[jsx("h3",{className:a("text-lg font-medium mb-4",i==null?void 0:i.tableHeader,l),children:"Request Types"}),s===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsx("div",{className:"space-y-4",children:g.map(x=>{let o=t[x],u=Math.round(o/s*100);return jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-center mb-1",children:[jsxs("div",{className:"flex items-center",children:[S(x),jsxs("span",{className:"ml-2 text-sm",children:[o," requests"]})]}),jsxs("span",{className:"text-sm font-medium",children:[u,"%"]})]}),jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5",children:jsx("div",{className:"bg-[rgb(var(--ndpr-primary))] h-2.5 rounded-full",style:{width:`${u}%`}})})]},x)})})]})},W=()=>{let t=Z(),s=f.length,g=["pending","awaitingVerification","inProgress","completed","rejected"],x={pending:"bg-yellow-500",awaitingVerification:"bg-purple-500",inProgress:"bg-blue-500",completed:"bg-green-500",rejected:"bg-red-500"};return jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",i==null?void 0:i.table,l),children:[jsx("h3",{className:a("text-lg font-medium mb-4",i==null?void 0:i.tableHeader,l),children:"Request Status"}),s===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxs("div",{children:[jsx("div",{className:"flex h-4 mb-2",children:g.map(o=>{let u=t[o],v=u/s*100;return v>0?jsx("div",{className:`${x[o]} first:rounded-l-full last:rounded-r-full`,style:{width:`${v}%`},title:`${o}: ${u} (${Math.round(v)}%)`},o):null})}),jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 mt-4",children:g.map(o=>{let u=t[o],v=Math.round(u/s*100);return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:`w-3 h-3 rounded-full ${x[o]} mr-2`}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium",children:o==="inProgress"?"In Progress":o==="awaitingVerification"?"Awaiting Verification":o.charAt(0).toUpperCase()+o.slice(1)}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:[u," (",v,"%)"]})]})]},o)})})]})]})},R=()=>{let t={};f.forEach(u=>{let v=new Date(u.createdAt),e=`${v.getFullYear()}-${String(v.getMonth()+1).padStart(2,"0")}`;t[e]=(t[e]||0)+1;});let g=Object.keys(t).sort().slice(-6),x=Math.max(...Object.values(t).filter(u=>u>0),1),o=u=>{let[v,e]=u.split("-");return `${e}/${v.slice(2)}`};return jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),g.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxs("div",{className:"h-40",children:[jsx("div",{className:"flex h-32 items-end justify-between space-x-2",children:g.map(u=>{let v=t[u],e=`${v/x*100}%`;return jsx("div",{className:"flex flex-col items-center flex-1",children:jsx("div",{className:"w-full bg-[rgb(var(--ndpr-primary))] rounded-t",style:{height:e},title:`${o(u)}: ${v} requests`})},u)})}),jsx("div",{className:"flex justify-between mt-2",children:g.map(u=>jsx("div",{className:"text-xs text-center",children:o(u)},u))})]})]})},q=()=>jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6","aria-live":"polite",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Overdue Requests"}),O.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No overdue requests."}):jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:O.map(t=>jsxs("div",{role:"button",tabIndex:0,"aria-label":`View overdue request from ${t.subject.name}`,className:a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md cursor-pointer hover:bg-red-100 dark:hover:bg-red-900/30",i==null?void 0:i.tableRow,l),onClick:()=>T(t.id),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),T(t.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),S(t.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxs("div",{className:"flex justify-between items-center",children:[jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",A(t.dueDate||0)]}),jsxs("p",{className:"text-xs font-bold text-red-600 dark:text-red-400",children:["Overdue by ",Math.abs(_(t.dueDate||0))," days"]})]})]},t.id))})]}),m=()=>jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6","aria-live":"polite",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Upcoming Deadlines"}),M.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No upcoming deadlines in the next 7 days."}):jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:M.map(t=>{let s=_(t.dueDate||0);return jsxs("div",{role:"button",tabIndex:0,"aria-label":`View upcoming deadline for ${t.subject.name}`,className:a("p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-md cursor-pointer hover:bg-yellow-100 dark:hover:bg-yellow-900/30",i==null?void 0:i.tableRow,l),onClick:()=>T(t.id),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),T(t.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),S(t.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxs("div",{className:"flex justify-between items-center",children:[jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",A(t.dueDate||0)]}),jsxs("p",{className:`text-xs font-bold ${s<=3?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`,children:["Due in ",s," days"]})]})]},t.id)})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${H}`,i==null?void 0:i.root,l),children:[jsxs("div",{className:a("flex flex-col md:flex-row md:justify-between md:items-center mb-6",i==null?void 0:i.header,l),children:[jsxs("div",{children:[jsx("h2",{className:a("text-xl font-bold mb-2",i==null?void 0:i.title,l),children:I}),jsx("p",{className:"text-gray-600 dark:text-gray-300",children:V})]}),jsxs("div",{className:"mt-4 md:mt-0",children:[jsx("label",{htmlFor:"timeframe",className:"block text-sm font-medium mb-1",children:"Timeframe"}),jsxs("select",{id:"timeframe",value:k,onChange:t=>y(t.target.value),className:"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))]",children:[jsx("option",{value:"7days",children:"Last 7 Days"}),jsx("option",{value:"30days",children:"Last 30 Days"}),jsx("option",{value:"90days",children:"Last 90 Days"}),jsx("option",{value:"all",children:"All Time"})]})]})]}),J&&E(),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxs("div",{children:[F&&L(),Y&&W()]}),jsxs("div",{children:[z&&R(),B&&q(),B&&m()]})]})]})};export{oe as a,ue as b};//# sourceMappingURL=chunk-SCWNM4PC.mjs.map
2
+ //# sourceMappingURL=chunk-SCWNM4PC.mjs.map
@@ -77,5 +77,5 @@ This notification is made in compliance with the Nigeria Data Protection Act (ND
77
77
  <style>body{font-family:monospace;white-space:pre-wrap;max-width:800px;margin:2rem auto;padding:0 1rem;}</style>
78
78
  </head>
79
79
  <body>${h.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</body>
80
- </html>`;break}case "pdf":p="text/plain",w="pdf.txt",M=h;break;case "docx":p="text/plain",w="docx.txt",M=h;break;default:p="text/plain",w="txt",M=h;}let P=document.createElement("a"),a=new Blob([M],{type:p});P.href=URL.createObjectURL(a),P.download=`NDPC_Breach_Notification_${new Date().toISOString().split("T")[0]}.${w}`,document.body.appendChild(P),P.click(),document.body.removeChild(P);},ee=()=>[{value:"email",label:"Email"},{value:"portal",label:"NDPC Portal"},{value:"letter",label:"Formal Letter"},{value:"other",label:"Other"}].map(w=>jsxRuntime.jsx("option",{value:w.value,children:w.label},w.value));return jsxRuntime.jsxs("div",{"data-ndpr-component":"regulatory-report-generator",className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o.root,l),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",o.header,l),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",o.title,l),children:K}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:Z})]}),g?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsxRuntime.jsx("h3",{className:"text-lg font-bold ndpr-text-success mb-2",children:"Report Generated Successfully"}),jsxRuntime.jsx("p",{className:"ndpr-text-success",children:"Your NDPC notification report has been generated and is ready for submission. Please review the report carefully before submitting it to the NDPC."})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Submission Details"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Method:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:q.charAt(0).toUpperCase()+q.slice(1)})]}),S&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Contact Name:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:S})]}),I&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Contact Email:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:I})]}),T&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Contact Phone:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:T})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Date Generated:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:N(Date.now())})]}),jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Breach ID:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:u.id})]}),H&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Reference Number:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:H})]})]})]})]}),C&&jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Report Preview"}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("ndpr-panel",o.reportPreview,l),children:jsxRuntime.jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:h})})]}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[ae&&jsxRuntime.jsxs("button",{onClick:E,className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${b}`,o.secondaryButton||o.downloadButton,l),children:["Download Report (",B.toUpperCase(),")"]}),jsxRuntime.jsx("button",{onClick:()=>x(false),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 ${b}`,children:"Edit Report"})]})]}):jsxRuntime.jsx("form",{onSubmit:z,children:jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Notification Method"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"method",className:"ndpr-form-field__label",children:["Method of Submission ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"method",value:q,onChange:p=>U(p.target.value),className:"ndpr-form-field__input",required:true,children:ee()})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"referenceNumber",className:"ndpr-form-field__label",children:"Reference Number (if available)"}),jsxRuntime.jsx("input",{type:"text",id:"referenceNumber",value:H,onChange:p=>X(p.target.value),placeholder:"e.g. NDPC/BR/2024/001",className:"ndpr-form-field__input"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"NDPC Contact (if known)"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactName",className:"ndpr-form-field__label",children:"Contact Name"}),jsxRuntime.jsx("input",{type:"text",id:"contactName",value:S,onChange:p=>L(p.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactEmail",className:"ndpr-form-field__label",children:"Contact Email"}),jsxRuntime.jsx("input",{type:"email",id:"contactEmail",value:I,onChange:p=>j(p.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactPhone",className:"ndpr-form-field__label",children:"Contact Phone"}),jsxRuntime.jsx("input",{type:"tel",id:"contactPhone",value:T,onChange:p=>O(p.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Additional Information"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"additionalInfo",className:"ndpr-form-field__label",children:"Additional Information to Include"}),jsxRuntime.jsx("textarea",{id:"additionalInfo",value:ie,onChange:p=>V(p.target.value),rows:3,placeholder:"Any additional information you want to include in the report",className:"ndpr-form-field__input"})]})]}),$&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Report Content"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reportContent",className:"ndpr-form-field__label",children:["Edit Report Content ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"reportContent",value:h,onChange:p=>_(p.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono",required:true})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.jsx("p",{className:"ndpr-text-info 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. This report will help you comply with this requirement."})]}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{type:"submit",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 ${b}`,o.primaryButton||o.generateButton,l),children:se})})]})})]})};exports.a=xe;exports.b=Se;exports.c=Te;//# sourceMappingURL=chunk-EHAZIKDX.js.map
81
- //# sourceMappingURL=chunk-EHAZIKDX.js.map
80
+ </html>`;break}case "pdf":p="text/plain",w="pdf.txt",M=h;break;case "docx":p="text/plain",w="docx.txt",M=h;break;default:p="text/plain",w="txt",M=h;}let P=document.createElement("a"),a=new Blob([M],{type:p});P.href=URL.createObjectURL(a),P.download=`NDPC_Breach_Notification_${new Date().toISOString().split("T")[0]}.${w}`,document.body.appendChild(P),P.click(),document.body.removeChild(P);},ee=()=>[{value:"email",label:"Email"},{value:"portal",label:"NDPC Portal"},{value:"letter",label:"Formal Letter"},{value:"other",label:"Other"}].map(w=>jsxRuntime.jsx("option",{value:w.value,children:w.label},w.value));return jsxRuntime.jsxs("div",{"data-ndpr-component":"regulatory-report-generator",className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o.root,l),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",o.header,l),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",o.title,l),children:K}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:Z})]}),g?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsxRuntime.jsx("h3",{className:"text-lg font-bold ndpr-text-success mb-2",children:"Report Generated Successfully"}),jsxRuntime.jsx("p",{className:"ndpr-text-success",children:"Your NDPC notification report has been generated and is ready for submission. Please review the report carefully before submitting it to the NDPC."})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Submission Details"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Method:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:q.charAt(0).toUpperCase()+q.slice(1)})]}),S&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Contact Name:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:S})]}),I&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Contact Email:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:I})]}),T&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Contact Phone:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:T})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Date Generated:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:N(Date.now())})]}),jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Breach ID:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:u.id})]}),H&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Reference Number:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:H})]})]})]})]}),C&&jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Report Preview"}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("ndpr-panel",o.reportPreview,l),children:jsxRuntime.jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:h})})]}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[ae&&jsxRuntime.jsxs("button",{onClick:E,className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${b}`,o.secondaryButton||o.downloadButton,l),children:["Download Report (",B.toUpperCase(),")"]}),jsxRuntime.jsx("button",{onClick:()=>x(false),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 ${b}`,children:"Edit Report"})]})]}):jsxRuntime.jsx("form",{onSubmit:z,children:jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Notification Method"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"method",className:"ndpr-form-field__label",children:["Method of Submission ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"method",value:q,onChange:p=>U(p.target.value),className:"ndpr-form-field__input",required:true,children:ee()})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"referenceNumber",className:"ndpr-form-field__label",children:"Reference Number (if available)"}),jsxRuntime.jsx("input",{type:"text",id:"referenceNumber",value:H,onChange:p=>X(p.target.value),placeholder:"e.g. NDPC/BR/2024/001",className:"ndpr-form-field__input"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"NDPC Contact (if known)"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactName",className:"ndpr-form-field__label",children:"Contact Name"}),jsxRuntime.jsx("input",{type:"text",id:"contactName",value:S,onChange:p=>L(p.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactEmail",className:"ndpr-form-field__label",children:"Contact Email"}),jsxRuntime.jsx("input",{type:"email",id:"contactEmail",value:I,onChange:p=>j(p.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactPhone",className:"ndpr-form-field__label",children:"Contact Phone"}),jsxRuntime.jsx("input",{type:"tel",id:"contactPhone",value:T,onChange:p=>O(p.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Additional Information"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"additionalInfo",className:"ndpr-form-field__label",children:"Additional Information to Include"}),jsxRuntime.jsx("textarea",{id:"additionalInfo",value:ie,onChange:p=>V(p.target.value),rows:3,placeholder:"Any additional information you want to include in the report",className:"ndpr-form-field__input"})]})]}),$&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Report Content"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reportContent",className:"ndpr-form-field__label",children:["Edit Report Content ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"reportContent",value:h,onChange:p=>_(p.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono",required:true})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.jsx("p",{className:"ndpr-text-info 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. This report will help you comply with this requirement."})]}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{type:"submit",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 ${b}`,o.primaryButton||o.generateButton,l),children:se})})]})})]})};exports.a=xe;exports.b=Se;exports.c=Te;//# sourceMappingURL=chunk-SKKOMFXH.js.map
81
+ //# sourceMappingURL=chunk-SKKOMFXH.js.map
@@ -77,5 +77,5 @@ This notification is made in compliance with the Nigeria Data Protection Act (ND
77
77
  <style>body{font-family:monospace;white-space:pre-wrap;max-width:800px;margin:2rem auto;padding:0 1rem;}</style>
78
78
  </head>
79
79
  <body>${h.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</body>
80
- </html>`;break}case "pdf":p="text/plain",w="pdf.txt",M=h;break;case "docx":p="text/plain",w="docx.txt",M=h;break;default:p="text/plain",w="txt",M=h;}let P=document.createElement("a"),a=new Blob([M],{type:p});P.href=URL.createObjectURL(a),P.download=`NDPC_Breach_Notification_${new Date().toISOString().split("T")[0]}.${w}`,document.body.appendChild(P),P.click(),document.body.removeChild(P);},ee=()=>[{value:"email",label:"Email"},{value:"portal",label:"NDPC Portal"},{value:"letter",label:"Formal Letter"},{value:"other",label:"Other"}].map(w=>jsx("option",{value:w.value,children:w.label},w.value));return jsxs("div",{"data-ndpr-component":"regulatory-report-generator",className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o.root,l),children:[jsxs("div",{className:a("",o.header,l),children:[jsx("h2",{className:a("ndpr-section-heading",o.title,l),children:K}),jsx("p",{className:"ndpr-card__subtitle",children:Z})]}),g?jsxs("div",{children:[jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsx("h3",{className:"text-lg font-bold ndpr-text-success mb-2",children:"Report Generated Successfully"}),jsx("p",{className:"ndpr-text-success",children:"Your NDPC notification report has been generated and is ready for submission. Please review the report carefully before submitting it to the NDPC."})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"ndpr-section-heading",children:"Submission Details"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Method:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:q.charAt(0).toUpperCase()+q.slice(1)})]}),S&&jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Contact Name:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:S})]}),I&&jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Contact Email:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:I})]}),T&&jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Contact Phone:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:T})]})]}),jsxs("div",{children:[jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Date Generated:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:N(Date.now())})]}),jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Breach ID:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:u.id})]}),H&&jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Reference Number:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:H})]})]})]})]}),C&&jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"ndpr-section-heading",children:"Report Preview"}),jsx("div",{className:a("ndpr-panel",o.reportPreview,l),children:jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:h})})]}),jsxs("div",{className:"ndpr-card__footer",children:[ae&&jsxs("button",{onClick:E,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${b}`,o.secondaryButton||o.downloadButton,l),children:["Download Report (",B.toUpperCase(),")"]}),jsx("button",{onClick:()=>x(false),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 ${b}`,children:"Edit Report"})]})]}):jsx("form",{onSubmit:z,children:jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Notification Method"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"method",className:"ndpr-form-field__label",children:["Method of Submission ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("select",{id:"method",value:q,onChange:p=>U(p.target.value),className:"ndpr-form-field__input",required:true,children:ee()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"referenceNumber",className:"ndpr-form-field__label",children:"Reference Number (if available)"}),jsx("input",{type:"text",id:"referenceNumber",value:H,onChange:p=>X(p.target.value),placeholder:"e.g. NDPC/BR/2024/001",className:"ndpr-form-field__input"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"NDPC Contact (if known)"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxs("div",{children:[jsx("label",{htmlFor:"contactName",className:"ndpr-form-field__label",children:"Contact Name"}),jsx("input",{type:"text",id:"contactName",value:S,onChange:p=>L(p.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"contactEmail",className:"ndpr-form-field__label",children:"Contact Email"}),jsx("input",{type:"email",id:"contactEmail",value:I,onChange:p=>j(p.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"contactPhone",className:"ndpr-form-field__label",children:"Contact Phone"}),jsx("input",{type:"tel",id:"contactPhone",value:T,onChange:p=>O(p.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Additional Information"}),jsxs("div",{children:[jsx("label",{htmlFor:"additionalInfo",className:"ndpr-form-field__label",children:"Additional Information to Include"}),jsx("textarea",{id:"additionalInfo",value:ie,onChange:p=>V(p.target.value),rows:3,placeholder:"Any additional information you want to include in the report",className:"ndpr-form-field__input"})]})]}),$&&jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Report Content"}),jsxs("div",{children:[jsxs("label",{htmlFor:"reportContent",className:"ndpr-form-field__label",children:["Edit Report Content ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"reportContent",value:h,onChange:p=>_(p.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono",required:true})]})]}),jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsx("p",{className:"ndpr-text-info 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. This report will help you comply with this requirement."})]}),jsx("div",{className:"mt-6",children:jsx("button",{type:"submit",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 ${b}`,o.primaryButton||o.generateButton,l),children:se})})]})})]})};export{xe as a,Se as b,Te as c};//# sourceMappingURL=chunk-WH6ZMUOS.mjs.map
81
- //# sourceMappingURL=chunk-WH6ZMUOS.mjs.map
80
+ </html>`;break}case "pdf":p="text/plain",w="pdf.txt",M=h;break;case "docx":p="text/plain",w="docx.txt",M=h;break;default:p="text/plain",w="txt",M=h;}let P=document.createElement("a"),a=new Blob([M],{type:p});P.href=URL.createObjectURL(a),P.download=`NDPC_Breach_Notification_${new Date().toISOString().split("T")[0]}.${w}`,document.body.appendChild(P),P.click(),document.body.removeChild(P);},ee=()=>[{value:"email",label:"Email"},{value:"portal",label:"NDPC Portal"},{value:"letter",label:"Formal Letter"},{value:"other",label:"Other"}].map(w=>jsx("option",{value:w.value,children:w.label},w.value));return jsxs("div",{"data-ndpr-component":"regulatory-report-generator",className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o.root,l),children:[jsxs("div",{className:a("",o.header,l),children:[jsx("h2",{className:a("ndpr-section-heading",o.title,l),children:K}),jsx("p",{className:"ndpr-card__subtitle",children:Z})]}),g?jsxs("div",{children:[jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsx("h3",{className:"text-lg font-bold ndpr-text-success mb-2",children:"Report Generated Successfully"}),jsx("p",{className:"ndpr-text-success",children:"Your NDPC notification report has been generated and is ready for submission. Please review the report carefully before submitting it to the NDPC."})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"ndpr-section-heading",children:"Submission Details"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Method:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:q.charAt(0).toUpperCase()+q.slice(1)})]}),S&&jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Contact Name:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:S})]}),I&&jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Contact Email:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:I})]}),T&&jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Contact Phone:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:T})]})]}),jsxs("div",{children:[jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Date Generated:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:N(Date.now())})]}),jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Breach ID:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:u.id})]}),H&&jsxs("p",{className:a("ndpr-text-sm",o.field,l),children:[jsx("span",{className:a("font-medium",o.fieldLabel,l),children:"Reference Number:"})," ",jsx("span",{className:a("",o.fieldValue,l),children:H})]})]})]})]}),C&&jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"ndpr-section-heading",children:"Report Preview"}),jsx("div",{className:a("ndpr-panel",o.reportPreview,l),children:jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:h})})]}),jsxs("div",{className:"ndpr-card__footer",children:[ae&&jsxs("button",{onClick:E,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${b}`,o.secondaryButton||o.downloadButton,l),children:["Download Report (",B.toUpperCase(),")"]}),jsx("button",{onClick:()=>x(false),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 ${b}`,children:"Edit Report"})]})]}):jsx("form",{onSubmit:z,children:jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Notification Method"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"method",className:"ndpr-form-field__label",children:["Method of Submission ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("select",{id:"method",value:q,onChange:p=>U(p.target.value),className:"ndpr-form-field__input",required:true,children:ee()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"referenceNumber",className:"ndpr-form-field__label",children:"Reference Number (if available)"}),jsx("input",{type:"text",id:"referenceNumber",value:H,onChange:p=>X(p.target.value),placeholder:"e.g. NDPC/BR/2024/001",className:"ndpr-form-field__input"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"NDPC Contact (if known)"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxs("div",{children:[jsx("label",{htmlFor:"contactName",className:"ndpr-form-field__label",children:"Contact Name"}),jsx("input",{type:"text",id:"contactName",value:S,onChange:p=>L(p.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"contactEmail",className:"ndpr-form-field__label",children:"Contact Email"}),jsx("input",{type:"email",id:"contactEmail",value:I,onChange:p=>j(p.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"contactPhone",className:"ndpr-form-field__label",children:"Contact Phone"}),jsx("input",{type:"tel",id:"contactPhone",value:T,onChange:p=>O(p.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Additional Information"}),jsxs("div",{children:[jsx("label",{htmlFor:"additionalInfo",className:"ndpr-form-field__label",children:"Additional Information to Include"}),jsx("textarea",{id:"additionalInfo",value:ie,onChange:p=>V(p.target.value),rows:3,placeholder:"Any additional information you want to include in the report",className:"ndpr-form-field__input"})]})]}),$&&jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Report Content"}),jsxs("div",{children:[jsxs("label",{htmlFor:"reportContent",className:"ndpr-form-field__label",children:["Edit Report Content ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"reportContent",value:h,onChange:p=>_(p.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono",required:true})]})]}),jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsx("p",{className:"ndpr-text-info 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. This report will help you comply with this requirement."})]}),jsx("div",{className:"mt-6",children:jsx("button",{type:"submit",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 ${b}`,o.primaryButton||o.generateButton,l),children:se})})]})})]})};export{xe as a,Se as b,Te as c};//# sourceMappingURL=chunk-TUNQUVHU.mjs.map
81
+ //# sourceMappingURL=chunk-TUNQUVHU.mjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkLIM64IV2_js=require('./chunk-LIM64IV2.js'),chunkELKB2AFZ_js=require('./chunk-ELKB2AFZ.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function W(e,s){return s?chunkELKB2AFZ_js.a(e):{load:()=>null,save:()=>{},remove:()=>{}}}function A({templates:e,initialPolicy:s,adapter:y,storageKey:l="ndpr_privacy_policy",persist:f,useLocalStorage:D,onGenerate:T}){var V;let O=(V=f!=null?f:D)!=null?V:true,w=y!=null?y:W(l,O),c=react.useRef(w);c.current=w;let[n,p]=react.useState(s||null),[o,g]=react.useState(null),[u,S]=react.useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[C,E]=react.useState(true),R=react.useRef(e);R.current=e,react.useEffect(()=>{if(s){E(false);return}let t=false;try{let r=c.current.load(),i=a=>{if(a){if(p(a),a.templateId){let P=R.current.find(b=>b.id===a.templateId);P&&g(P);}a.organizationInfo&&S(a.organizationInfo);}E(!1);};r instanceof Promise?r.then(a=>{t||i(a);},()=>{t||E(!1);}):i(r);}catch(r){t||E(false);}return ()=>{t=true;}},[s]);let k=t=>{Promise.resolve(c.current.save(t)).catch(r=>{console.warn("[ndpr-toolkit] Failed to save policy:",r);});},j=react.useCallback(t=>{let r=e.find(b=>b.id===t);if(!r)return false;g(r);let i=r.sections.map(b=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},b),{customContent:void 0})),a={};Object.keys(r.variables).forEach(b=>{a[b]=r.variables[b].defaultValue||"";});let P=Date.now();return p({id:"policy_"+P+"_"+Math.random().toString(36).substr(2,9),title:"",templateId:r.id,organizationInfo:u,sections:i,variableValues:a,effectiveDate:P,lastUpdated:P,version:"1.0"}),true},[e,u]),I=react.useCallback(t=>{S(r=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},r),t));},[]),F=react.useCallback((t,r)=>{o&&(n?p(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(a=>a.id===t?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{included:r}):a)})):g(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(a=>a.id===t?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{included:r}):a)})));},[o,n]),M=react.useCallback((t,r)=>{o&&(n?p(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(a=>a.id===t?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{customContent:r}):a)})):g(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(a=>a.id===t?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{customContent:r}):a)})));},[o,n]),$=react.useCallback((t,r)=>{n&&p(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{variableValues:chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i.variableValues),{[t]:r})}));},[n]),B=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),G=react.useCallback(()=>{if(!o)return null;let t=Date.now(),r={id:(n==null?void 0:n.id)||B(),title:`Privacy Policy for ${u.name}`,templateId:o.id,organizationInfo:u,sections:o.sections.map(i=>{var a;return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{customContent:(a=n==null?void 0:n.sections.find(P=>P.id===i.id))==null?void 0:a.customContent})}),variableValues:(n==null?void 0:n.variableValues)||{},effectiveDate:t,lastUpdated:t,version:"1.0"};return p(r),k(r),T&&T(r),r},[o,n,u,T]),K=react.useCallback(()=>{if(!n)return {fullText:"",sectionTexts:{},missingVariables:[]};let t=chunkLIM64IV2_js.b(n.sections,n.organizationInfo);return typeof t=="string"?{fullText:t,sectionTexts:{full:t},missingVariables:[]}:t},[n]),H=react.useCallback(()=>{p(null),g(null),S({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(c.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove policy:",t);});},[]),J=react.useCallback(()=>{let t=[];if(o||t.push("No template selected"),u.name||t.push("Organization name is required"),u.website||t.push("Organization website is required"),u.privacyEmail||t.push("Privacy contact email is required"),o){let r=o.sections.filter(a=>a.required),i=(n==null?void 0:n.sections.filter(a=>a.included))||[];r.forEach(a=>{i.some(P=>P.id===a.id)||t.push(`Required section "${a.title}" must be included`);});}return o&&n&&Object.entries(o.variables).forEach(([r,i])=>{i.required&&!n.variableValues[r]&&t.push(`Required variable "${i.name}" must have a value`);}),{valid:t.length===0,errors:t}},[o,u,n]);return {policy:n,selectedTemplate:o,organizationInfo:u,selectTemplate:j,updateOrganizationInfo:I,toggleSection:F,updateSectionContent:M,updateVariableValue:$,generatePolicy:G,getPolicyText:K,resetPolicy:H,isValid:J,isLoading:C}}var _="default-business";function X(e){return e.toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"})}function Y(e){let{sections:s,variables:y}=chunkLIM64IV2_js.e(),l={};return e&&(e.name&&(l.orgName=e.name),e.email&&(l.privacyEmail=e.email),e.website&&(l.website=e.website),e.address&&(l.address=e.address),e.industry&&(l.industry=e.industry),e.dpoName&&(l.dpoName=e.dpoName),e.dpoEmail&&(l.dpoEmail=e.dpoEmail)),l.effectiveDate||(l.effectiveDate=X(new Date)),{id:_,name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:s,variables:Object.fromEntries(y.map(f=>[f.name,{name:f.name,description:f.description,required:f.required,defaultValue:l[f.name]||f.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true}}function Z(e){if(!e)return {};let s={};return e.name&&(s.name=e.name),e.email&&(s.privacyEmail=e.email),e.website&&(s.website=e.website),e.address&&(s.address=e.address),e.industry&&(s.industry=e.industry),e.dpoName&&(s.dpoName=e.dpoName),e.dpoEmail&&(s.dpoEmail=e.dpoEmail),s}function ce(e={}){var o;let{orgInfo:s,autoGenerate:y=true,storageKey:l,persist:f,useLocalStorage:D,adapter:T}=e,O=(o=f!=null?f:D)!=null?o:true,w=react.useRef(null);w.current===null&&(w.current=Y(s));let c=A({templates:[w.current],adapter:T,storageKey:l,persist:O}),n=react.useRef(false),p=react.useRef(false);return react.useEffect(()=>{if(!y||c.isLoading||n.current)return;if(!T&&O!==false&&typeof window!="undefined"&&typeof window.localStorage!="undefined")try{if(window.localStorage.getItem(l!=null?l:"ndpr_privacy_policy")){n.current=!0,p.current=!0;return}}catch(S){}if(c.policy){n.current=true,p.current=true;return}n.current=true;let u=Z(s);Object.keys(u).length>0&&c.updateOrganizationInfo(u),c.selectedTemplate||c.selectTemplate(_);},[y,c.isLoading]),react.useEffect(()=>{var u;if(!y||p.current||!n.current||!c.selectedTemplate)return;let g=(u=s==null?void 0:s.name)!=null?u:"";g&&c.organizationInfo.name!==g||(p.current=true,c.generatePolicy());},[y,c.selectedTemplate,c.organizationInfo]),c}exports.a=A;exports.b=ce;//# sourceMappingURL=chunk-TV4U6AIS.js.map
2
+ //# sourceMappingURL=chunk-TV4U6AIS.js.map